Merge pull request #461 from morluto/agent/comprehensive-repository-audit
fix: harden evidence lifecycle and MCP contracts
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { artifactComparisonInputSchema } from "../domain/artifactComparison.js";
|
||||
import { bundleComparisonInputSchema } from "../domain/bundleComparison.js";
|
||||
import { callPathInputSchema } from "../domain/callPath.js";
|
||||
import { changedBehaviorInputSchema } from "../domain/changedBehavior.js";
|
||||
import { functionComparisonInputSchema } from "../domain/functionComparison.js";
|
||||
import { jsonValueSchema } from "../domain/jsonValue.js";
|
||||
import { processScenarioSchema } from "../domain/processCapture.js";
|
||||
import { processTraceSpecificationSchema } from "../domain/processTraceComparison.js";
|
||||
import { recordUnknownInputSchema } from "../domain/residualUnknown.js";
|
||||
import { reconstructionVerificationInputSchema } from "../domain/reconstructionVerification.js";
|
||||
import { replayMachineRunInputSchema } from "../domain/replayMachineRun.js";
|
||||
import { staticRuntimeCorrelationInputSchema } from "../domain/staticRuntimeCorrelation.js";
|
||||
import { updateUnknownInputSchema } from "../domain/residualUnknown.js";
|
||||
import {
|
||||
openBinaryInputSchema,
|
||||
closeBinaryInputSchema,
|
||||
} from "./sessionLifecycleInputs.js";
|
||||
import { binarySessionInputSchema } from "./sessionStatusContract.js";
|
||||
|
||||
/** Retain the current canonical Evidence bundle as a session resource. */
|
||||
export const snapshotEvidenceBundleInputSchema = z.strictObject({});
|
||||
|
||||
/** Release one session-retained immutable Evidence bundle. */
|
||||
export const releaseEvidenceBundleInputSchema = z.strictObject({
|
||||
bundle_digest: z.string().regex(/^[a-f0-9]{64}$/u),
|
||||
});
|
||||
|
||||
/** Optional document selection for volatile navigation context. */
|
||||
export const navigationContextInputSchema = z.strictObject({
|
||||
document: z.string().min(1).optional(),
|
||||
});
|
||||
|
||||
/** Explicit reproducible address context query. */
|
||||
export const addressContextInputSchema = z.strictObject({
|
||||
address: z.string().min(1),
|
||||
document: z.string().min(1).optional(),
|
||||
});
|
||||
|
||||
/** Session-owned Evidence bundle import options. */
|
||||
export const importEvidenceBundleInputSchema = z.strictObject({
|
||||
path: z.string().min(1),
|
||||
});
|
||||
|
||||
/** Evidence references for deterministic process comparison. */
|
||||
export const processComparisonInputSchema = z.strictObject({
|
||||
left_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
||||
right_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
||||
trace_spec: processTraceSpecificationSchema.optional(),
|
||||
max_capture_age_ms: z.number().int().nonnegative().optional(),
|
||||
unknown_registry_approved: z
|
||||
.literal(true)
|
||||
.optional()
|
||||
.describe("Explicit approval to record capture disagreement durably"),
|
||||
});
|
||||
|
||||
/** Residual-unknown list filters. */
|
||||
export const listUnknownsInputSchema = z.strictObject({
|
||||
status: z
|
||||
.enum(["open", "investigating", "blocked", "contradicted", "resolved"])
|
||||
.optional(),
|
||||
severity: z.enum(["low", "medium", "high", "critical"]).optional(),
|
||||
domain: z.string().trim().min(1).max(100).optional(),
|
||||
offset: z.number().int().min(0).default(0),
|
||||
limit: z.number().int().min(1).max(500).default(100),
|
||||
});
|
||||
|
||||
/** Exact residual-unknown identity to revalidate. */
|
||||
export const verifyUnknownResolutionInputSchema = z.strictObject({
|
||||
unknown_id: z.string().regex(/^unk_[a-f0-9]{64}$/u),
|
||||
});
|
||||
|
||||
export {
|
||||
artifactComparisonInputSchema,
|
||||
binarySessionInputSchema,
|
||||
bundleComparisonInputSchema,
|
||||
callPathInputSchema,
|
||||
changedBehaviorInputSchema,
|
||||
closeBinaryInputSchema,
|
||||
functionComparisonInputSchema,
|
||||
jsonValueSchema,
|
||||
openBinaryInputSchema,
|
||||
processScenarioSchema,
|
||||
reconstructionVerificationInputSchema,
|
||||
recordUnknownInputSchema,
|
||||
replayMachineRunInputSchema,
|
||||
staticRuntimeCorrelationInputSchema,
|
||||
updateUnknownInputSchema,
|
||||
};
|
||||
@@ -43,6 +43,7 @@ export const TOOL_EXAMPLE_OVERRIDES: Readonly<
|
||||
export_evidence_bundle: { path: "/tmp/evidence.json" },
|
||||
inspect_address_context: { address: "0x1000" },
|
||||
import_evidence_bundle: { path: "evidence.json" },
|
||||
release_evidence_bundle: { bundle_digest: "a".repeat(64) },
|
||||
capture_process_scenario: {
|
||||
approved: true,
|
||||
executable: "/usr/bin/true",
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { jsonValueSchema } from "../domain/jsonValue.js";
|
||||
import { TOOL_EXAMPLE_OVERRIDES } from "./toolContractExamples.js";
|
||||
import type { ToolExample } from "./toolContractTypes.js";
|
||||
|
||||
export const document = z.string().optional().describe("The document name");
|
||||
export const address = z
|
||||
.string()
|
||||
.describe(
|
||||
"A provider-normalized address; default memory uses 0x-prefixed hexadecimal",
|
||||
);
|
||||
export const optionalAddress = address.optional();
|
||||
export const procedure = z.string().describe("The procedure name or address");
|
||||
export const pagination = {
|
||||
offset: z.number().int().min(0).default(0),
|
||||
limit: z.number().int().min(1).max(500).default(100),
|
||||
};
|
||||
|
||||
const exampleInputSchema = z.record(z.string(), jsonValueSchema);
|
||||
|
||||
export const examplesFor = (
|
||||
name: string,
|
||||
inputSchema: z.ZodObject,
|
||||
): readonly ToolExample[] => {
|
||||
const parsed = inputSchema.parse(TOOL_EXAMPLE_OVERRIDES[name] ?? {});
|
||||
return [
|
||||
{
|
||||
title: `Example ${name.replaceAll("_", " ")} request`,
|
||||
input: exampleInputSchema.parse(parsed),
|
||||
},
|
||||
];
|
||||
};
|
||||
@@ -1,20 +1,4 @@
|
||||
import { z } from "zod";
|
||||
import { jsonValueSchema } from "../domain/jsonValue.js";
|
||||
import { processScenarioSchema } from "../domain/processCapture.js";
|
||||
import {
|
||||
recordUnknownInputSchema,
|
||||
updateUnknownInputSchema,
|
||||
} from "../domain/residualUnknown.js";
|
||||
import { artifactComparisonInputSchema } from "../domain/artifactComparison.js";
|
||||
import { functionComparisonInputSchema } from "../domain/functionComparison.js";
|
||||
import { bundleComparisonInputSchema } from "../domain/bundleComparison.js";
|
||||
import { changedBehaviorInputSchema } from "../domain/changedBehavior.js";
|
||||
import { callPathInputSchema } from "../domain/callPath.js";
|
||||
import { staticRuntimeCorrelationInputSchema } from "../domain/staticRuntimeCorrelation.js";
|
||||
import { reconstructionVerificationInputSchema } from "../domain/reconstructionVerification.js";
|
||||
import { replayMachineRunInputSchema } from "../domain/replayMachineRun.js";
|
||||
import { processTraceSpecificationSchema } from "../domain/processTraceComparison.js";
|
||||
|
||||
import { enhancedInputSchemas } from "./enhancedInputs.js";
|
||||
import {
|
||||
enhancedOutputSchemas,
|
||||
@@ -22,7 +6,6 @@ import {
|
||||
requireOutputSchema,
|
||||
sessionOutputSchemas,
|
||||
} from "./toolOutputSchemas.js";
|
||||
import { TOOL_EXAMPLE_OVERRIDES } from "./toolContractExamples.js";
|
||||
import { NATIVE_TOOL_CONTRACTS } from "./nativeToolContracts.js";
|
||||
import { ARTIFACT_TOOL_CONTRACTS } from "./artifactToolContracts.js";
|
||||
import { MANAGED_TOOL_CONTRACTS } from "./managedToolContracts.js";
|
||||
@@ -32,48 +15,58 @@ import { ELECTRON_TOOL_CONTRACTS } from "./electronToolContracts.js";
|
||||
import { JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS } from "./javascriptRuntimeObservationToolContracts.js";
|
||||
import { APPLICATION_TOOL_CONTRACTS } from "./applicationToolContracts.js";
|
||||
import {
|
||||
addressContextInputSchema,
|
||||
artifactComparisonInputSchema,
|
||||
binarySessionInputSchema,
|
||||
bundleComparisonInputSchema,
|
||||
callPathInputSchema,
|
||||
changedBehaviorInputSchema,
|
||||
closeBinaryInputSchema,
|
||||
functionComparisonInputSchema,
|
||||
importEvidenceBundleInputSchema,
|
||||
listUnknownsInputSchema,
|
||||
navigationContextInputSchema,
|
||||
openBinaryInputSchema,
|
||||
} from "./sessionLifecycleInputs.js";
|
||||
import type { ToolContract, ToolExample } from "./toolContractTypes.js";
|
||||
processComparisonInputSchema,
|
||||
processScenarioSchema,
|
||||
reconstructionVerificationInputSchema,
|
||||
recordUnknownInputSchema,
|
||||
releaseEvidenceBundleInputSchema,
|
||||
replayMachineRunInputSchema,
|
||||
snapshotEvidenceBundleInputSchema,
|
||||
staticRuntimeCorrelationInputSchema,
|
||||
updateUnknownInputSchema,
|
||||
verifyUnknownResolutionInputSchema,
|
||||
} from "./sessionToolSchemas.js";
|
||||
import {
|
||||
address,
|
||||
document,
|
||||
examplesFor,
|
||||
optionalAddress,
|
||||
pagination,
|
||||
procedure,
|
||||
} from "./toolContractHelpers.js";
|
||||
import type { ToolContract } from "./toolContractTypes.js";
|
||||
import { toolContractMetadata } from "./toolEffects.js";
|
||||
import { binarySessionInputSchema } from "./sessionStatusContract.js";
|
||||
import { functionInstructionInputSchema } from "./functionInstructionContract.js";
|
||||
import { HOPPER_MEMORY_TOOL_DEFINITIONS } from "./hopperMemoryContracts.js";
|
||||
import { analysisSearchInput } from "./analysisSearchContract.js";
|
||||
import { FUNCTION_WORKFLOW_TOOL_CONTRACTS } from "./functionWorkflowToolContracts.js";
|
||||
|
||||
export { binarySessionInputSchema } from "./sessionStatusContract.js";
|
||||
export {
|
||||
addressContextInputSchema,
|
||||
binarySessionInputSchema,
|
||||
importEvidenceBundleInputSchema,
|
||||
listUnknownsInputSchema,
|
||||
navigationContextInputSchema,
|
||||
processComparisonInputSchema,
|
||||
releaseEvidenceBundleInputSchema,
|
||||
snapshotEvidenceBundleInputSchema,
|
||||
verifyUnknownResolutionInputSchema,
|
||||
} from "./sessionToolSchemas.js";
|
||||
|
||||
export type { ToolContract, ToolExample } from "./toolContractTypes.js";
|
||||
|
||||
const document = z.string().optional().describe("The document name");
|
||||
const address = z
|
||||
.string()
|
||||
.describe(
|
||||
"A provider-normalized address; default memory uses 0x-prefixed hexadecimal",
|
||||
);
|
||||
const optionalAddress = address.optional();
|
||||
const procedure = z.string().describe("The procedure name or address");
|
||||
const pagination = {
|
||||
offset: z.number().int().min(0).default(0),
|
||||
limit: z.number().int().min(1).max(500).default(100),
|
||||
};
|
||||
|
||||
const exampleInputSchema = z.record(z.string(), jsonValueSchema);
|
||||
const examplesFor = (
|
||||
name: string,
|
||||
inputSchema: z.ZodObject,
|
||||
): readonly ToolExample[] => {
|
||||
const parsed = inputSchema.parse(TOOL_EXAMPLE_OVERRIDES[name] ?? {});
|
||||
return [
|
||||
{
|
||||
title: `Example ${name.replaceAll("_", " ")} request`,
|
||||
input: exampleInputSchema.parse(parsed),
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
const official = <Name extends string>(
|
||||
name: Name,
|
||||
description: string,
|
||||
@@ -379,53 +372,6 @@ export const exportEvidenceBundleInputSchema = z.strictObject({
|
||||
overwrite: z.boolean().default(false),
|
||||
});
|
||||
|
||||
/** Retain the current canonical Evidence bundle as a session resource. */
|
||||
export const snapshotEvidenceBundleInputSchema = z.strictObject({});
|
||||
|
||||
/** Optional document selection for volatile navigation context. */
|
||||
export const navigationContextInputSchema = z.strictObject({
|
||||
document: z.string().min(1).optional(),
|
||||
});
|
||||
|
||||
/** Explicit reproducible address context query. */
|
||||
export const addressContextInputSchema = z.strictObject({
|
||||
address: z.string().min(1),
|
||||
document: z.string().min(1).optional(),
|
||||
});
|
||||
|
||||
/** Session-owned Evidence bundle import options. */
|
||||
export const importEvidenceBundleInputSchema = z.strictObject({
|
||||
path: z.string().min(1),
|
||||
});
|
||||
|
||||
/** Evidence references for deterministic process comparison. */
|
||||
export const processComparisonInputSchema = z.strictObject({
|
||||
left_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
||||
right_evidence_id: z.string().regex(/^ev_[a-f0-9]{64}$/u),
|
||||
trace_spec: processTraceSpecificationSchema.optional(),
|
||||
max_capture_age_ms: z.number().int().nonnegative().optional(),
|
||||
unknown_registry_approved: z
|
||||
.literal(true)
|
||||
.optional()
|
||||
.describe("Explicit approval to record capture disagreement durably"),
|
||||
});
|
||||
|
||||
/** Residual-unknown list filters. */
|
||||
export const listUnknownsInputSchema = z.strictObject({
|
||||
status: z
|
||||
.enum(["open", "investigating", "blocked", "contradicted", "resolved"])
|
||||
.optional(),
|
||||
severity: z.enum(["low", "medium", "high", "critical"]).optional(),
|
||||
domain: z.string().trim().min(1).max(100).optional(),
|
||||
offset: z.number().int().min(0).default(0),
|
||||
limit: z.number().int().min(1).max(500).default(100),
|
||||
});
|
||||
|
||||
/** Exact residual-unknown identity to revalidate. */
|
||||
export const verifyUnknownResolutionInputSchema = z.strictObject({
|
||||
unknown_id: z.string().regex(/^unk_[a-f0-9]{64}$/u),
|
||||
});
|
||||
|
||||
/** Target lifecycle tools available only on the long-lived MCP adapter. */
|
||||
export const SESSION_TOOL_CONTRACTS = [
|
||||
session(
|
||||
@@ -528,9 +474,14 @@ export const SESSION_TOOL_CONTRACTS = [
|
||||
"Retain the current canonical Evidence v2 bundle as an immutable session resource. Returns a compact digest summary and exact opaque URI; copy that URI unchanged and call MCP resources/read (Codex: read_mcp_resource) for the full bundle. Repeating an unchanged snapshot is idempotent.",
|
||||
snapshotEvidenceBundleInputSchema,
|
||||
),
|
||||
session(
|
||||
"release_evidence_bundle",
|
||||
"Release one immutable session-retained Evidence v2 bundle by exact digest. This is the recovery operation when bounded bundle retention is exhausted; releasing an unknown digest is idempotent and reports released: false.",
|
||||
releaseEvidenceBundleInputSchema,
|
||||
),
|
||||
session(
|
||||
"get_navigation_context",
|
||||
"Return the selected document, current address, and containing/current procedure in one coherent provider-neutral request. A cursor outside any procedure returns procedure: null. Scalar navigation getters remain available for evaluation and compatibility.",
|
||||
"Compose the selected document, current address, and containing/current procedure into one provider-neutral result. The result reflects sequential provider observations, not an atomic cursor snapshot; a cursor outside any procedure returns procedure: null. Scalar navigation getters remain available for evaluation and compatibility.",
|
||||
navigationContextInputSchema,
|
||||
),
|
||||
session(
|
||||
|
||||
@@ -173,6 +173,10 @@ export const TOOL_EFFECTS: Readonly<Record<string, ToolEffects>> = {
|
||||
mayDiscardData: true,
|
||||
}),
|
||||
snapshot_evidence_bundle: effects({ mutatesSession: true }),
|
||||
release_evidence_bundle: effects({
|
||||
mutatesSession: true,
|
||||
mayDiscardData: true,
|
||||
}),
|
||||
get_navigation_context: effects({ mutatesSession: true }),
|
||||
inspect_address_context: effects({ mutatesSession: true }),
|
||||
import_evidence_bundle: effects({ mutatesSession: true }),
|
||||
|
||||
@@ -44,8 +44,8 @@ import { replayMachineRunOutputSchema } from "../domain/replayMachineRun.js";
|
||||
import { analysisErrorProjectionSchema } from "./errorSchemas.js";
|
||||
import {
|
||||
addressList,
|
||||
analysisActivity,
|
||||
addressedEntry,
|
||||
analysisActivity,
|
||||
bounded,
|
||||
containingProcedureResolution,
|
||||
clientFeatureAvailabilitySchema,
|
||||
@@ -75,6 +75,14 @@ const contextFacetSchema = z.discriminatedUnion("state", [
|
||||
remediation: z.string(),
|
||||
}),
|
||||
]);
|
||||
const bookmarkFacetSchema = z.discriminatedUnion("state", [
|
||||
z.object({ state: z.literal("available"), value: z.array(addressedEntry) }),
|
||||
z.object({
|
||||
state: z.literal("unavailable"),
|
||||
reason: z.string(),
|
||||
remediation: z.string(),
|
||||
}),
|
||||
]);
|
||||
|
||||
/** Exact structured-content schemas shared by direct analysis providers. */
|
||||
export const officialOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
|
||||
@@ -426,9 +434,17 @@ export const sessionOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
|
||||
bytes: z.number().int().min(0),
|
||||
records: z.number().int().min(0),
|
||||
unknowns: z.number().int().min(0),
|
||||
scope: z.literal("session"),
|
||||
survives_session: z.literal(false),
|
||||
bundle_uri: z.string().regex(/^rea:\/\/evidence-bundle\/[a-f0-9]{64}$/u),
|
||||
}),
|
||||
),
|
||||
release_evidence_bundle: lifecycleResultOf(
|
||||
z.object({
|
||||
bundle_digest: z.string().regex(/^[a-f0-9]{64}$/u),
|
||||
released: z.boolean(),
|
||||
}),
|
||||
),
|
||||
get_navigation_context: lifecycleResultOf(
|
||||
z.object({
|
||||
document: z.string(),
|
||||
@@ -444,12 +460,13 @@ export const sessionOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
|
||||
procedure: contextFacetSchema,
|
||||
comment: contextFacetSchema,
|
||||
inline_comment: contextFacetSchema,
|
||||
bookmarks: contextFacetSchema,
|
||||
bookmarks: bookmarkFacetSchema,
|
||||
}),
|
||||
),
|
||||
import_evidence_bundle: lifecycleResultOf(
|
||||
z.object({
|
||||
imported: z.number().int().min(0),
|
||||
unknowns_added: z.number().int().min(0),
|
||||
total: z.number().int().min(0),
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -240,6 +240,17 @@ export const toolAvailability = z.object({
|
||||
"policy_disabled",
|
||||
]),
|
||||
remediation: z.string().nullable(),
|
||||
default_mode_available: z.boolean().optional(),
|
||||
modes: z
|
||||
.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
available: z.boolean(),
|
||||
missing_operations: z.array(z.string()),
|
||||
remediation: z.string().nullable(),
|
||||
}),
|
||||
)
|
||||
.optional(),
|
||||
client_requirements: z.object({
|
||||
required: z.array(clientFeatureNameSchema),
|
||||
optional: z.array(clientFeatureNameSchema),
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
import { READINESS_STAGE_IDS } from "../domain/reconstructionReadinessJourneyFindings.js";
|
||||
|
||||
type JsonSchema = Readonly<Record<string, unknown>>;
|
||||
const conditionResultKey = ["t", "hen"].join("");
|
||||
|
||||
const exactlyOne = (left: string, right: string): JsonSchema => ({
|
||||
oneOf: [{ required: [left] }, { required: [right] }],
|
||||
});
|
||||
|
||||
const exclusivePairs = (
|
||||
left: [string, string],
|
||||
right: [string, string],
|
||||
): JsonSchema => ({
|
||||
oneOf: [
|
||||
{
|
||||
required: left,
|
||||
not: {
|
||||
anyOf: right.map((field) => ({ required: [field] })),
|
||||
},
|
||||
},
|
||||
{
|
||||
required: right,
|
||||
not: {
|
||||
anyOf: left.map((field) => ({ required: [field] })),
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const twoEvidenceSources = (
|
||||
left: [string, string],
|
||||
right: [string, string],
|
||||
): JsonSchema => ({
|
||||
allOf: [exactlyOne(left[0], left[1]), exactlyOne(right[0], right[1])],
|
||||
});
|
||||
|
||||
const approvalDependency = (flag: string, approval: string): JsonSchema => ({
|
||||
if: {
|
||||
required: [flag],
|
||||
properties: {
|
||||
[flag]: {
|
||||
const: true,
|
||||
description: `Whether ${flag} was requested`,
|
||||
},
|
||||
},
|
||||
},
|
||||
[conditionResultKey]: {
|
||||
required: [approval],
|
||||
properties: {
|
||||
[approval]: {
|
||||
const: true,
|
||||
description: `Approval for ${flag}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const exactReadinessStages: JsonSchema = {
|
||||
allOf: [
|
||||
{
|
||||
properties: {
|
||||
stages: {
|
||||
description: "Complete reconstruction-readiness stage set",
|
||||
allOf: READINESS_STAGE_IDS.map((stageId) => ({
|
||||
contains: {
|
||||
type: "object",
|
||||
properties: {
|
||||
stage_id: {
|
||||
const: stageId,
|
||||
description: "Readiness stage identifier",
|
||||
},
|
||||
},
|
||||
required: ["stage_id"],
|
||||
description: "One reconstruction-readiness stage",
|
||||
},
|
||||
minContains: 1,
|
||||
maxContains: 1,
|
||||
})),
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
/** Public JSON-Schema constraints that Standard Schema cannot derive from refinements. */
|
||||
export const TOOL_INPUT_JSON_SCHEMA_OVERRIDES: Readonly<
|
||||
Record<string, JsonSchema>
|
||||
> = {
|
||||
compare_web_captures: {
|
||||
...exclusivePairs(
|
||||
["before", "after"],
|
||||
["before_scenario", "after_scenario"],
|
||||
),
|
||||
},
|
||||
inspect_web_page: {
|
||||
allOf: [
|
||||
approvalDependency("include_console_text", "console_text_approved"),
|
||||
approvalDependency(
|
||||
"include_json_body_shapes",
|
||||
"json_body_schema_approved",
|
||||
),
|
||||
approvalDependency(
|
||||
"include_websocket_shapes",
|
||||
"websocket_shape_approved",
|
||||
),
|
||||
],
|
||||
},
|
||||
analyze_web_bundle: {
|
||||
allOf: [
|
||||
approvalDependency("include_console_text", "console_text_approved"),
|
||||
approvalDependency(
|
||||
"include_json_body_shapes",
|
||||
"json_body_schema_approved",
|
||||
),
|
||||
approvalDependency(
|
||||
"include_websocket_shapes",
|
||||
"websocket_shape_approved",
|
||||
),
|
||||
approvalDependency("fetch_source_maps", "source_map_fetch_approved"),
|
||||
],
|
||||
},
|
||||
inspect_electron_page: {
|
||||
allOf: [
|
||||
approvalDependency("include_script_sources", "source_capture_approved"),
|
||||
],
|
||||
},
|
||||
trace_application_feature: {
|
||||
...exactlyOne("application", "application_evidence_id"),
|
||||
},
|
||||
trace_javascript_semantics: {
|
||||
...exactlyOne("application", "application_evidence_id"),
|
||||
},
|
||||
compare_application_versions: twoEvidenceSources(
|
||||
["left", "left_evidence_id"],
|
||||
["right", "right_evidence_id"],
|
||||
),
|
||||
compare_javascript_export_shapes: twoEvidenceSources(
|
||||
["left", "left_evidence_id"],
|
||||
["right", "right_evidence_id"],
|
||||
),
|
||||
compare_source_to_bundle: exactlyOne(
|
||||
"application",
|
||||
"application_evidence_id",
|
||||
),
|
||||
evaluate_reconstruction_readiness: exactReadinessStages,
|
||||
};
|
||||
|
||||
/** Merge a contract-specific public constraint into generated or advertised input JSON Schema. */
|
||||
export const applyToolInputJsonSchemaOverride = (
|
||||
name: string,
|
||||
schema: JsonSchema,
|
||||
): JsonSchema => {
|
||||
const override = TOOL_INPUT_JSON_SCHEMA_OVERRIDES[name];
|
||||
return override === undefined ? schema : { ...schema, ...override };
|
||||
};
|
||||
Reference in New Issue
Block a user