refactor: return complete analysis results inline

This commit is contained in:
morluto
2026-09-29 08:07:24 +08:00
parent 07ff8b30ee
commit a2a3243ea8
127 changed files with 402 additions and 1508 deletions
+4 -5
View File
@@ -28,7 +28,7 @@ import {
import { reconstructionClosureResultSchema } from "../domain/reconstructionCoverage.js";
import {
reconstructionObligationLedgerInputSchema,
reconstructionObligationLedgerPageSchema,
reconstructionObligationLedgerSchema,
} from "../domain/reconstructionObligationLedgerSchemas.js";
import {
reconstructionReadinessInputSchema,
@@ -60,7 +60,7 @@ const exportShapeComparisonOutputSchema = evidenceResultOf(
javaScriptExportShapeComparisonResultSchema,
);
const reconstructionObligationLedgerOutputSchema = evidenceResultOf(
reconstructionObligationLedgerPageSchema,
reconstructionObligationLedgerSchema,
);
const reconstructionReadinessOutputSchema = evidenceResultOf(
reconstructionReadinessReportSchema,
@@ -301,13 +301,13 @@ export const APPLICATION_TOOL_CONTRACTS = [
name: "build_reconstruction_obligation_ledger",
...toolContractMetadata("build_reconstruction_obligation_ledger"),
description:
"Generate one deterministic page of a ReconstructionObligationLedger from an authenticated Evidence bundle, reviewed obligations, and an explicit reconstruction manifest. Static candidates remain candidates; duplicate ownership, missing original or reconstruction cases, missing parser/type, weak verifier authority, unenumerated claims, contradictions, dependencies, and residual unknowns fail closed. Every page carries the same full-ledger closure digest and typed per-obligation diagnostics.",
"Generate the complete deterministic ReconstructionObligationLedger from an authenticated Evidence bundle, reviewed obligations, and an explicit reconstruction manifest. Static candidates remain candidates; duplicate ownership, missing original or reconstruction cases, missing parser/type, weak verifier authority, unenumerated claims, contradictions, dependencies, and residual unknowns fail closed. The inline result carries the full-ledger closure digest and typed per-obligation diagnostics.",
kind: "application",
inputSchema: reconstructionObligationLedgerInputSchema,
outputSchema: reconstructionObligationLedgerOutputSchema,
examples: [
{
title: "Generate the first obligation-ledger page",
title: "Generate the complete obligation ledger",
input: {
evidence_bundle: {
artifacts: [],
@@ -323,7 +323,6 @@ export const APPLICATION_TOOL_CONTRACTS = [
bindings: [],
contradictions: [],
},
page: { offset: 0, limit: 50 },
},
},
],
@@ -108,7 +108,6 @@ const compareJavaScriptExportShapesFacts = {
compareJavaScriptExportShapesInputSchema.shape.right_module_path,
right_export_name:
compareJavaScriptExportShapesInputSchema.shape.right_export_name,
limits: compareJavaScriptExportShapesInputSchema.shape.limits,
unknown_registry_approved:
compareJavaScriptExportShapesInputSchema.shape.unknown_registry_approved,
} as const;
+2 -2
View File
@@ -54,8 +54,8 @@ export const TOOL_EXAMPLE_OVERRIDES: Readonly<
right_evidence_id: `ev_${"1".repeat(64)}`,
},
compare_artifacts: {
left_evidence_ids: [ARTIFACT_COMPARISON_EXAMPLE.left.evidence_id],
right_evidence_ids: [ARTIFACT_COMPARISON_EXAMPLE.right.evidence_id],
left_evidence_id: ARTIFACT_COMPARISON_EXAMPLE.left.evidence_id,
right_evidence_id: ARTIFACT_COMPARISON_EXAMPLE.right.evidence_id,
},
compare_functions: {
left_evidence_id: FUNCTION_COMPARISON_EXAMPLE.left.evidence_id,
@@ -70,8 +70,6 @@ export const targetKindSchema = z.enum([
const providerCapabilityFacts = {
operation: z.string(),
pagination: z.enum(["none", "offset", "cursor"]),
exhaustive: z.boolean(),
effects: z.object({
mutates_artifact: z.boolean(),
launches_process: z.boolean(),
@@ -81,11 +79,6 @@ const providerCapabilityFacts = {
changes_permissions: z.boolean(),
requires_root: z.boolean(),
}),
limits: z.object({
max_results: z.number().int().min(0).nullable(),
max_payload_bytes: z.number().int().min(0).nullable(),
timeout_ms: z.number().int().min(0).nullable(),
}),
limitations: z.array(z.string()),
};
@@ -418,26 +411,6 @@ const availableMemoryPermissions = z.object({
source: z.literal("ghidra-memory-block"),
});
export const bounded = (item: z.ZodType) => {
const facts = {
items: z.array(item),
total: z.number().int().min(0).nullable(),
returned: z.number().int().min(0),
} as const;
return z.discriminatedUnion("truncated", [
z.object({
...facts,
truncated: z.literal(false),
next_offset: z.null(),
}),
z.object({
...facts,
truncated: z.literal(true),
next_offset: z.number().int().min(0).nullable(),
}),
]);
};
export const addressedValue = z.object({
address: z.string(),
value: z.string(),
-6
View File
@@ -29,11 +29,9 @@ const PROPERTY_DESCRIPTIONS: Readonly<Record<string, string>> = {
question: "Concrete unresolved question to retain for later investigation.",
result: "Primary structured result returned by this operation.",
left: "Left-hand input used for comparison or differential execution.",
limit: "Maximum number of results to return in this page.",
limits:
"Bounded resource-consumption and result-size limits for this operation.",
mode: "Operation mode that selects the requested behavior.",
offset: "Zero-based index of the first result to return.",
overwrite: "Whether an existing destination may be replaced.",
path: "Local filesystem path used by this operation.",
provider_id:
@@ -119,10 +117,6 @@ const fallbackPropertyDescription = (property: string): string => {
const words = property.replaceAll("_", " ");
if (property.endsWith("_approved"))
return `Explicit operator approval for ${words.slice(0, -9)}.`;
if (property.endsWith("_offset"))
return `Zero-based index of the first ${words.slice(0, -7)} to return.`;
if (property.endsWith("_limit"))
return `Maximum number of ${words.slice(0, -6)} entries to return.`;
if (property.startsWith("max_"))
return `Maximum permitted ${words.slice(4)} for this operation.`;
if (property.startsWith("include_"))