feat(python): query selected pyc code-object facts (#6928)

* feat(python): query retained pyc code-object facts

* test(python): bind complete pyc selection benchmark tasks

* test(python): include server instructions in token accounting

* docs(perf): record pyc selected-facts task measurements

* test(python): keep oracle dependencies separate from selected targets

* docs(perf): record guarded oracle requalification

* test(python): narrow complete Evidence through its owning contract
This commit is contained in:
gensokyo-dev authored and GitHub committed 2026-10-24 10:23:06 +08:00
1 parent 315b23403f
commit e2463372ea
22 files changed
+3664 -156

No files matched your search

+47 -26
View File
@@ -8,7 +8,13 @@ import type { Logger } from "pino";
import type { CliInstance } from "./types.js";
import { withCommandCancellation } from "./commandCancellation.js";
import { inspectPythonPycInputSchema } from "../domain/python/pythonPyc.js";
import { finishAnalysisCommand } from "./finishAnalysisCommand.js";
import {
analysisEvidenceDeliveryOptions,
deliverCliAnalysisEvidence,
parseCliAnalysisEvidenceDelivery,
} from "./analysisEvidenceDelivery.js";
import { pythonPycDeliverySchema } from "../domain/analysisView/pythonPycView.js";
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
/** Inspect operator-selected pyc files through the same shared workflow as MCP. */
export const registerPythonPycCommands = (
@@ -26,32 +32,47 @@ export const registerPythonPycCommands = (
maxObjects: inspectPythonPycInputSchema.shape.max_objects,
maxDepth: inspectPythonPycInputSchema.shape.max_depth,
maxStringBytes: inspectPythonPycInputSchema.shape.max_string_bytes,
...analysisEvidenceDeliveryOptions,
view: z
.string()
.optional()
.describe(
"JSON python-pyc view; requires --detail summary and --evidence_output",
),
}),
run: ({ args, options }) =>
withCommandCancellation(async (signal) => {
const service = createPythonPycService();
return await logCliCommand(
logger,
CLI_COMMANDS.inspectPythonPyc,
async () =>
finishAnalysisCommand(
() =>
service.inspect(
{
path: absoluteCallerPath(args.path),
max_file_bytes: options.maxFileBytes,
max_objects: options.maxObjects,
max_depth: options.maxDepth,
max_string_bytes: options.maxStringBytes,
},
{ signal },
),
service,
"rea-python-pyc",
"inspect_python_pyc",
signal,
),
);
}),
withCommandCancellation((signal) =>
logCliCommand(logger, CLI_COMMANDS.inspectPythonPyc, async () => {
const delivery = parseCliAnalysisEvidenceDelivery(
"inspect_python_pyc",
options,
pythonPycDeliverySchema,
);
if (!delivery.ok) return projectAnalysisError(delivery.error);
const service = createPythonPycService();
return deliverCliAnalysisEvidence({
run: () =>
service.inspect(
{
path: absoluteCallerPath(args.path),
max_file_bytes: options.maxFileBytes,
max_objects: options.maxObjects,
max_depth: options.maxDepth,
max_string_bytes: options.maxStringBytes,
},
{ signal },
),
service,
providerId: "rea-python-pyc",
operation: "inspect_python_pyc",
signal,
detail: delivery.value.detail,
evidenceOutput: delivery.value.evidenceOutput,
...(delivery.value.view === undefined
? {}
: { view: delivery.value.view }),
});
}),
),
});
};