refactor(tools): remove redundant limits and acknowledgements
This commit is contained in:
@@ -5,7 +5,7 @@ export const analysisSearchInput = {
|
||||
pattern: z
|
||||
.string()
|
||||
.min(1)
|
||||
.describe("The literal text or bounded regex pattern to search for"),
|
||||
.describe("The literal text or regex pattern to search for"),
|
||||
mode: z.enum(["literal", "regex"]).default("literal"),
|
||||
case_sensitive: z.boolean().default(false).describe("Whether to match case"),
|
||||
document: z.string().optional().describe("The document name"),
|
||||
|
||||
@@ -55,7 +55,6 @@ const reconstructionObligationLedgerOutputSchema = evidenceResultOf(
|
||||
);
|
||||
const HASH = "0".repeat(64);
|
||||
const NODE_PREPARATION_EXAMPLE = jsonObjectSchema.parse({
|
||||
preparation_approved: true,
|
||||
selected_alias: "bundle",
|
||||
expected_effect: "pure",
|
||||
instrumentation: {
|
||||
@@ -130,7 +129,7 @@ export const APPLICATION_TOOL_CONTRACTS = [
|
||||
name: "compare_application_versions",
|
||||
...toolContractMetadata("compare_application_versions"),
|
||||
description:
|
||||
"Compare two authenticated JavaScript Application Graph versions supplied as full Evidence or Evidence IDs returned earlier in this session. Uses unique-only exact digest, module source digest, source-map identity, structural fingerprint, and non-module semantic-key tiers. Reports added, removed, changed, ambiguous, and unknown entities plus a bounded changed_from graph without fuzzy or module-ordinal pairing.",
|
||||
"Compare two authenticated JavaScript Application Graph versions supplied as full Evidence or Evidence IDs returned earlier in this session. Uses unique-only exact digest, module source digest, source-map identity, structural fingerprint, and non-module semantic-key tiers. Reports added, removed, changed, ambiguous, and unknown entities plus the complete matching changed_from graph without fuzzy or module-ordinal pairing.",
|
||||
kind: "application",
|
||||
inputSchema: compareApplicationVersionsRequestSchema,
|
||||
outputSchema: comparisonOutputSchema,
|
||||
@@ -176,7 +175,7 @@ export const APPLICATION_TOOL_CONTRACTS = [
|
||||
name: "run_controlled_replay",
|
||||
...toolContractMetadata("run_controlled_replay"),
|
||||
description:
|
||||
"Plan or execute a content-bound extracted-module JavaScript replay inside the Linux Bubblewrap, seccomp, and cgroup boundary. Execution requires approved: true and the exact plan digest. Supports deterministic boundary cases and optional left/right differential comparison; observations have controlled-replay authority and do not claim real application runtime behavior.",
|
||||
"Plan or execute a content-bound extracted-module JavaScript replay inside the Linux Bubblewrap, seccomp, and cgroup boundary. Execution requires the exact plan digest. Supports deterministic boundary cases and optional left/right differential comparison; observations have controlled-replay authority and do not claim real application runtime behavior.",
|
||||
kind: "application",
|
||||
inputSchema: controlledReplayInputSchema,
|
||||
outputSchema: controlledReplayOutputSchema,
|
||||
@@ -228,7 +227,7 @@ export const APPLICATION_TOOL_CONTRACTS = [
|
||||
name: "prepare_node_characterization",
|
||||
...toolContractMetadata("prepare_node_characterization"),
|
||||
description:
|
||||
"Prepare a hash-bound Node/JavaScript characterization plan and deterministic reversible export transformation without executing target code. The exact source, selected byte range, runtime closure, sandbox profile, cases, and limits are committed for separate execution approval.",
|
||||
"Prepare a hash-bound Node/JavaScript characterization plan and deterministic reversible export transformation without executing target code. The exact source, selected byte range, runtime closure, sandbox profile, cases, and limits are committed for later execution.",
|
||||
kind: "application",
|
||||
inputSchema: nodeCharacterizationPreparationInputSchema,
|
||||
outputSchema: nodeCharacterizationPreparationOutputSchema,
|
||||
@@ -243,15 +242,14 @@ export const APPLICATION_TOOL_CONTRACTS = [
|
||||
name: "execute_node_characterization",
|
||||
...toolContractMetadata("execute_node_characterization"),
|
||||
description:
|
||||
"Recompute and execute one separately approved exact Node characterization plan in the owned controlled-replay boundary. Returns transformation, replay, cleanup, and provider-neutral characterization Evidence; stale plans fail before execution.",
|
||||
"Recompute and execute one exact Node characterization plan in the owned controlled-replay boundary. Returns transformation, replay, cleanup, and provider-neutral characterization Evidence; stale plans fail before execution.",
|
||||
kind: "application",
|
||||
inputSchema: nodeCharacterizationExecutionInputSchema,
|
||||
outputSchema: nodeCharacterizationExecutionOutputSchema,
|
||||
examples: [
|
||||
{
|
||||
title: "Execute one approved exact characterization plan",
|
||||
title: "Execute one exact characterization plan",
|
||||
input: {
|
||||
execution_approved: true,
|
||||
approved_plan_sha256: HASH,
|
||||
preparation: NODE_PREPARATION_EXAMPLE,
|
||||
},
|
||||
|
||||
@@ -51,7 +51,6 @@ const compareApplicationVersionsFacts = {
|
||||
right_native_observations:
|
||||
compareApplicationVersionsInputSchema.shape.right_native_observations,
|
||||
right_native_observation_evidence_ids: z.array(evidenceIdSchema).default([]),
|
||||
limits: compareApplicationVersionsInputSchema.shape.limits,
|
||||
unknown_registry_approved:
|
||||
compareApplicationVersionsInputSchema.shape.unknown_registry_approved,
|
||||
} as const;
|
||||
|
||||
@@ -65,7 +65,6 @@ const example: Record<string, JsonValue> = {
|
||||
max_storage_entries: 256,
|
||||
max_total_metadata_bytes: 4_194_304,
|
||||
},
|
||||
approved: true,
|
||||
};
|
||||
|
||||
/** Controlled browser scenario contract shared by MCP and catalog generation. */
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
webPageInspectionSchema,
|
||||
} from "../domain/browserObservation.js";
|
||||
import {
|
||||
analyzeWebBundleInputSchema,
|
||||
analyzeWebBundleToolInputSchema,
|
||||
webBundleAnalysisSchema,
|
||||
} from "../domain/webBundleAnalysis.js";
|
||||
import {
|
||||
@@ -130,7 +130,6 @@ export const BROWSER_TOOL_CONTRACTS = [
|
||||
input: {
|
||||
cdp_endpoint: endpoint,
|
||||
allowed_origins: [origin],
|
||||
approved: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -149,16 +148,12 @@ export const BROWSER_TOOL_CONTRACTS = [
|
||||
input: {
|
||||
cdp_endpoint: endpoint,
|
||||
allowed_origins: [origin],
|
||||
approved: true,
|
||||
target_id: "TARGET_ID_FROM_LIST_BROWSER_TARGETS",
|
||||
observation_ms: 500,
|
||||
include_accessibility_text: false,
|
||||
include_console_text: false,
|
||||
console_text_approved: false,
|
||||
include_json_body_shapes: false,
|
||||
json_body_schema_approved: false,
|
||||
include_websocket_shapes: false,
|
||||
websocket_shape_approved: false,
|
||||
include_script_sources: false,
|
||||
include_storage_keys: false,
|
||||
include_storage_fingerprints: false,
|
||||
@@ -194,9 +189,9 @@ export const BROWSER_TOOL_CONTRACTS = [
|
||||
name: "analyze_web_bundle",
|
||||
...toolContractMetadata("analyze_web_bundle"),
|
||||
description:
|
||||
"Capture explicitly approved JavaScript source from one approved CDP page and statically derive a bounded chunk graph, route and endpoint candidates, vendor fingerprints, page-declared WebMCP metadata, and optional separately approved source-map evidence. JavaScript is parsed but never executed.",
|
||||
"Capture JavaScript source from one configured CDP page and statically derive a bounded chunk graph, route and endpoint candidates, vendor fingerprints, page-declared WebMCP metadata, and optionally fetch source maps from allowed origins. JavaScript is parsed but never executed.",
|
||||
kind: "browser-provider",
|
||||
inputSchema: analyzeWebBundleInputSchema,
|
||||
inputSchema: analyzeWebBundleToolInputSchema,
|
||||
outputSchema: bundleOutputSchema,
|
||||
examples: [
|
||||
{
|
||||
@@ -204,24 +199,12 @@ export const BROWSER_TOOL_CONTRACTS = [
|
||||
input: {
|
||||
cdp_endpoint: endpoint,
|
||||
allowed_origins: [origin],
|
||||
approved: true,
|
||||
target_id: "TARGET_ID_FROM_LIST_BROWSER_TARGETS",
|
||||
observation_ms: 500,
|
||||
include_accessibility_text: false,
|
||||
include_script_sources: true,
|
||||
include_storage_keys: false,
|
||||
source_capture_approved: true,
|
||||
fetch_source_maps: false,
|
||||
source_map_fetch_approved: false,
|
||||
analysis_limits: {
|
||||
max_findings: 1_000,
|
||||
max_ast_nodes: 250_000,
|
||||
max_source_maps: 100,
|
||||
max_source_map_bytes: 4_194_304,
|
||||
max_total_source_map_bytes: 16_777_216,
|
||||
max_source_map_mappings: 10_000,
|
||||
max_original_sources: 2_000,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -241,7 +224,6 @@ export const BROWSER_TOOL_CONTRACTS = [
|
||||
cdp_endpoint: endpoint,
|
||||
allowed_origins: [origin],
|
||||
target_id: "TARGET_ID_FROM_LIST_BROWSER_TARGETS",
|
||||
approved: true,
|
||||
observation_ms: 10_000,
|
||||
max_timeline_events: 2_000,
|
||||
},
|
||||
@@ -263,7 +245,6 @@ export const BROWSER_TOOL_CONTRACTS = [
|
||||
cdp_endpoint: endpoint,
|
||||
allowed_origins: [origin],
|
||||
target_id: "TARGET_ID_FROM_LIST_BROWSER_TARGETS",
|
||||
approved: true,
|
||||
observation_ms: 100,
|
||||
max_tools: 500,
|
||||
max_schema_bytes: 262_144,
|
||||
@@ -306,7 +287,7 @@ export const BROWSER_TOOL_CONTRACTS = [
|
||||
name: "capture_web_screenshot",
|
||||
...toolContractMetadata("capture_web_screenshot"),
|
||||
description:
|
||||
"Capture the current visible viewport of one approved page as a bounded, content-addressed PNG artifact. Screenshot capture requires separate explicit approval and never scrolls, navigates, or evaluates page JavaScript.",
|
||||
"Capture the current visible viewport of one configured page as a bounded, content-addressed PNG artifact. The operation never scrolls, navigates, or evaluates page JavaScript.",
|
||||
kind: "browser-provider",
|
||||
inputSchema: captureWebScreenshotInputSchema,
|
||||
outputSchema: screenshotOutputSchema,
|
||||
@@ -317,8 +298,6 @@ export const BROWSER_TOOL_CONTRACTS = [
|
||||
cdp_endpoint: endpoint,
|
||||
allowed_origins: [origin],
|
||||
target_id: "TARGET_ID_FROM_LIST_BROWSER_TARGETS",
|
||||
approved: true,
|
||||
screenshot_approved: true,
|
||||
maximum_image_bytes: 4_194_304,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -104,7 +104,7 @@ describe("tool contract surface", () => {
|
||||
for (const contract of contracts) {
|
||||
const inputSchema = contractJsonSchema(contract.inputSchema);
|
||||
const outputSchema = contractJsonSchema(contract.outputSchema);
|
||||
expect(describesObject(inputSchema)).toBe(true);
|
||||
expect(describesObject(inputSchema), contract.name).toBe(true);
|
||||
expect(describesObject(outputSchema)).toBe(true);
|
||||
expect(contract.title.length).toBeGreaterThan(2);
|
||||
expect(contract.annotations).toEqual(
|
||||
|
||||
@@ -46,7 +46,6 @@ const activeExample = {
|
||||
max_processes: 32,
|
||||
max_windows: 32,
|
||||
},
|
||||
approved: true,
|
||||
};
|
||||
|
||||
/** Root-confined Electron file-page discovery and inspection contracts. */
|
||||
@@ -65,7 +64,6 @@ export const ELECTRON_TOOL_CONTRACTS = [
|
||||
input: {
|
||||
cdp_endpoint: endpoint,
|
||||
allowed_file_roots: [root],
|
||||
approved: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -85,10 +83,8 @@ export const ELECTRON_TOOL_CONTRACTS = [
|
||||
cdp_endpoint: endpoint,
|
||||
allowed_file_roots: [root],
|
||||
target_id: "TARGET_ID_FROM_LIST_ELECTRON_TARGETS",
|
||||
approved: true,
|
||||
observation_ms: 100,
|
||||
include_script_sources: false,
|
||||
source_capture_approved: false,
|
||||
limits: {
|
||||
max_frames: 200,
|
||||
max_dom_nodes: 2_000,
|
||||
|
||||
@@ -7,15 +7,15 @@ const address = z
|
||||
"A provider-normalized address; default memory uses 0x-prefixed hexadecimal",
|
||||
);
|
||||
|
||||
/** Bounded Hopper memory and file-mapping contracts. */
|
||||
/** Hopper memory and file-mapping contracts. */
|
||||
export const HOPPER_MEMORY_TOOL_DEFINITIONS = [
|
||||
{
|
||||
name: "read_bytes",
|
||||
description:
|
||||
"Read at most 4,096 analyzed bytes from one provider-normalized virtual address. The hexadecimal payload reports the exact returned length; incomplete reads remain explicit and unsupported provider APIs return typed capability unavailability.",
|
||||
"Read analyzed bytes from one provider-normalized virtual address. The hexadecimal payload reports the exact returned length; incomplete reads remain explicit and unsupported provider APIs return typed capability unavailability.",
|
||||
inputSchema: z.object({
|
||||
address,
|
||||
length: z.number().int().min(1).max(4_096).default(256),
|
||||
length: z.number().int().min(1).default(256),
|
||||
document,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -28,7 +28,6 @@ export const JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS = [
|
||||
inspector_endpoint: endpoint,
|
||||
allowed_file_roots: [root],
|
||||
allowed_origins: [],
|
||||
approved: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -49,7 +48,6 @@ export const JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS = [
|
||||
allowed_file_roots: [root],
|
||||
allowed_origins: [],
|
||||
target_id: "TARGET_ID_FROM_LIST_JAVASCRIPT_RUNTIME_TARGETS",
|
||||
approved: true,
|
||||
observation_ms: 100,
|
||||
limits: {
|
||||
max_events: 10_000,
|
||||
|
||||
@@ -192,7 +192,6 @@ const runtimeEvidence = createEvidence(
|
||||
allowed_file_roots: [inputPath],
|
||||
target_id: "example-target",
|
||||
include_script_sources: true,
|
||||
source_capture_approved: true,
|
||||
},
|
||||
result: {
|
||||
browser: {
|
||||
|
||||
@@ -406,7 +406,7 @@ export const PROMPT_CONTRACTS = [
|
||||
{
|
||||
tools: ["capture_process_scenario"],
|
||||
instruction:
|
||||
"Present exact executable and working roots, filesystem roots, environment names without secret values, host-network effects, scripted events, replay peers, byte/time/process limits, and cleanup expectations. Run only with operator policy plus approved: true.",
|
||||
"Present exact executable and working roots, filesystem roots, environment names without secret values, host-network effects, scripted events, replay peers, byte/time/process limits, and cleanup expectations. Run only with operator policy authorization.",
|
||||
},
|
||||
{
|
||||
tools: ["compare_process_captures"],
|
||||
|
||||
@@ -44,7 +44,6 @@ export const TOOL_EXAMPLE_OVERRIDES: Readonly<
|
||||
inspect_address_context: { address: "0x1000" },
|
||||
import_evidence_bundle: { path: "evidence.json" },
|
||||
capture_process_scenario: {
|
||||
approved: true,
|
||||
executable: "/usr/bin/true",
|
||||
working_directory: "/tmp",
|
||||
},
|
||||
|
||||
@@ -397,7 +397,7 @@ export const SESSION_TOOL_CONTRACTS = [
|
||||
),
|
||||
session(
|
||||
"capture_process_scenario",
|
||||
"Run one bounded process under a PTY using operator-approved executable and working roots. Produces process capture Evidence. Requires approved: true; unknown_registry_approved: true separately records capture residuals. Captures raw and xterm-rendered terminal frames, scripted interactions, lifecycle filesystem checkpoints, process ownership, declarative command shims, and loopback replay. Disabled unless operator policy enables it; not a security sandbox.",
|
||||
"Run one bounded process under a PTY using operator-approved executable and working roots. Produces process capture Evidence; unknown_registry_approved: true separately records capture residuals. Captures raw and xterm-rendered terminal frames, scripted interactions, lifecycle filesystem checkpoints, process ownership, declarative command shims, and loopback replay. Disabled unless operator policy enables it; not a security sandbox.",
|
||||
processScenarioSchema,
|
||||
),
|
||||
session(
|
||||
@@ -447,12 +447,12 @@ export const SESSION_TOOL_CONTRACTS = [
|
||||
),
|
||||
session(
|
||||
"record_unknown",
|
||||
"Create one deterministic residual unknown and immutable mutation evidence. Requires approved: true, validates all evidence and relationship references, and rejects duplicate stable identity.",
|
||||
"Create one deterministic residual unknown and immutable mutation evidence. Validates all evidence and relationship references, and rejects duplicate stable identity.",
|
||||
recordUnknownInputSchema,
|
||||
),
|
||||
session(
|
||||
"update_unknown",
|
||||
"Append one immutable full-state revision and mutation evidence. Requires approved: true and exact expected_revision; stale concurrent writers fail instead of overwriting newer analysis.",
|
||||
"Append one immutable full-state revision and mutation evidence. Requires exact expected_revision; stale concurrent writers fail instead of overwriting newer analysis.",
|
||||
updateUnknownInputSchema,
|
||||
),
|
||||
session(
|
||||
|
||||
@@ -102,8 +102,8 @@ export const officialOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
|
||||
read_bytes: resultOf(
|
||||
z.object({
|
||||
address: z.string(),
|
||||
requested_bytes: z.number().int().min(1).max(4_096),
|
||||
returned_bytes: z.number().int().min(0).max(4_096),
|
||||
requested_bytes: z.number().int().min(1),
|
||||
returned_bytes: z.number().int().min(0),
|
||||
bytes_hex: z.string().regex(/^(?:[a-f0-9]{2})*$/u),
|
||||
complete: z.boolean(),
|
||||
}),
|
||||
|
||||
@@ -4,7 +4,6 @@ import type { JsonValue } from "../domain/jsonValue.js";
|
||||
export const UNKNOWN_CONTRACT_EXAMPLES = {
|
||||
list_unknowns: {},
|
||||
record_unknown: {
|
||||
approved: true,
|
||||
question: "Does this branch require an unavailable external service?",
|
||||
severity: "medium",
|
||||
domain: "protocol",
|
||||
@@ -17,7 +16,6 @@ export const UNKNOWN_CONTRACT_EXAMPLES = {
|
||||
relationships: [],
|
||||
},
|
||||
update_unknown: {
|
||||
approved: true,
|
||||
unknown_id: `unk_${"0".repeat(64)}`,
|
||||
expected_revision: 1,
|
||||
status: "investigating",
|
||||
|
||||
Reference in New Issue
Block a user