mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
* refactor(cli): project view-delivery inspectors from their contracts * refactor(cli): project APK signature, desktop application and EVM inspectors from contracts (#10603)
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import type { Logger } from "pino";
|
|
|
|
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
|
import { createModelArtifactService } from "../composition/model.js";
|
|
import { INSPECT_MODEL_ARTIFACT_CONTRACT } from "../contracts/model/modelToolContracts.js";
|
|
import {
|
|
deliverWithService,
|
|
registerContractCommand,
|
|
} from "./contractCommand.js";
|
|
import type { CliInstance } from "./types.js";
|
|
|
|
/** One-shot summaries export the same complete observations used by MCP retained pages. */
|
|
export const registerModelCommands = (
|
|
cli: CliInstance,
|
|
logger: Logger,
|
|
): void => {
|
|
const deliver = deliverWithService(
|
|
createModelArtifactService,
|
|
"model-artifact",
|
|
);
|
|
registerContractCommand(
|
|
cli,
|
|
logger,
|
|
INSPECT_MODEL_ARTIFACT_CONTRACT,
|
|
{
|
|
command: CLI_COMMANDS.inspectModelArtifact,
|
|
description:
|
|
"Inspect GGUF or safetensors headers without loading model weights",
|
|
positionals: ["path"],
|
|
callerPaths: ["path"],
|
|
evidenceDelivery: true,
|
|
viewDelivery: {
|
|
invalidJson: "view must be a JSON model page selection",
|
|
kind: "model-artifact",
|
|
},
|
|
fields: {
|
|
path: { description: "Local model file, detected by content" },
|
|
hash: {
|
|
description:
|
|
"header reads declarations only; full additionally streams all bytes for SHA-256",
|
|
},
|
|
view: {
|
|
description:
|
|
"JSON model page selection; requires --detail summary and --evidence_output",
|
|
},
|
|
},
|
|
},
|
|
// The CLI delivers the summary itself, so the service returns complete
|
|
// Evidence; the contract's own default would retain a summary instead.
|
|
(input, context) => deliver({ ...input, detail: "complete" }, context),
|
|
);
|
|
};
|