fix(tools)!: simplify direct invocation and harden boundary contracts (#555)

Remove REA permission grants, scope ceilings, approval confirmations, and inert settings. Preserve selected local evidence, accept caller-chosen commands and paths, and report actual runtime failures.

Harden provider results, schema serialization, snapshot evidence binding, archive paths, source maps, native screenshots, managed EH parsing, and cancellation cleanup. Regenerate tool metadata and document direct invocation.

BREAKING CHANGE: Removed permission configuration and policy commands, approval fields, filesystem scope inputs, and fixed confirmation options. Process capture inherits the host environment and accepts command names; callers must refresh tool schemas and migrate removed fields.
This commit is contained in:
morluto
2026-10-05 20:16:44 +08:00
committed by GitHub
parent 4f099a10f8
commit b5e98915c6
350 changed files with 5347 additions and 10599 deletions
+2 -3
View File
@@ -119,7 +119,6 @@ export const APPLICATION_TOOL_CONTRACTS = [
query: {
seed: { kind: "semantic-node", node_id: `jsrg_node_${HASH}` },
direction: "backward-provenance",
source_map_authority: { authority: "none" },
},
},
},
@@ -242,7 +241,7 @@ export const APPLICATION_TOOL_CONTRACTS = [
name: "execute_node_characterization",
...toolContractMetadata("execute_node_characterization"),
description:
"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.",
"Recompute and execute one exact Node characterization plan in the owned controlled-replay boundary. The supplied plan_sha256 is checked against the freshly computed plan_sha256 as content identity; a mismatch fails before execution. Returns transformation, replay, cleanup, and provider-neutral characterization Evidence.",
kind: "application",
inputSchema: nodeCharacterizationExecutionInputSchema,
outputSchema: nodeCharacterizationExecutionOutputSchema,
@@ -250,7 +249,7 @@ export const APPLICATION_TOOL_CONTRACTS = [
{
title: "Execute one exact characterization plan",
input: {
approved_plan_sha256: HASH,
plan_sha256: HASH,
preparation: NODE_PREPARATION_EXAMPLE,
},
},
+5 -21
View File
@@ -7,31 +7,15 @@ import { toolContractMetadata } from "./toolEffects.js";
import { requireOutputSchema } from "./toolOutputSchemaPrimitives.js";
import { appleAssetCatalogInputSchema } from "../domain/appleAssetCatalog.js";
import { keyedArchiveInputSchema } from "../domain/keyedArchive.js";
const integrityInput = {
fail: {
integrity_policy: z.literal("fail").default("fail"),
integrity_continue_approved: z.literal(false).default(false),
},
continue: {
integrity_policy: z.literal("record-and-continue"),
integrity_continue_approved: z.literal(true),
},
} as const;
const artifactInventoryFacts = {
native_mount_approved: z.boolean().default(false),
} as const;
/** Exact caller boundary for deterministic artifact inventory. */
export const artifactInventoryInputSchema = z.union([
z.object({ ...artifactInventoryFacts, ...integrityInput.fail }),
z.object({ ...artifactInventoryFacts, ...integrityInput.continue }),
]);
export const artifactInventoryInputSchema = z.strictObject({
integrity_policy: z.enum(["fail", "record-and-continue"]).default("fail"),
});
/** Extraction needs no selector: it materializes every regular child file. */
export const artifactExtractionInputSchema = z.strictObject({});
/** Provider input after the local permission boundary chooses its destination. */
/** Provider input containing the destination chosen by the local adapter. */
export const artifactExtractionExecutionSchema = z.strictObject({
output_root: z.string().min(1),
});
@@ -74,7 +58,7 @@ const artifact = <
export const ARTIFACT_TOOL_CONTRACTS = [
artifact(
"inspect_artifact",
"Inspect an active archive or application package in one call. Returns the complete content-addressed artifact graph, source Evidence, observations, relationships, integrity contradictions, hypotheses, unexplored branches, limitations, and next probes inline. It does not extract files; use extract_artifact to materialize its regular contents.",
"Inspect an active archive or application package in one call. Returns the complete content-addressed artifact graph, source Evidence, observations, relationships, integrity contradictions, hypotheses, unexplored branches, limitations, and next probes inline. Read-only DMG mounting is used automatically on supported macOS hosts. Integrity mismatches fail by default; record-and-continue keeps mismatches explicitly untrusted. It does not extract files; use extract_artifact to materialize its regular contents.",
artifactInventoryInputSchema,
),
artifact(
@@ -9,12 +9,8 @@ const example: Record<string, JsonValue> = {
browser: {
mode: "launch",
executable_path: "/opt/chromium/chrome",
headless: true,
user_data: "temporary-owned",
cleanup: "close-and-delete-profile",
},
start_url: { url: "https://app.example.test/", query: [] },
allowed_origins: ["https://app.example.test"],
actions: [
{
step_id: "settle",
@@ -30,7 +26,7 @@ export const BROWSER_SCENARIO_TOOL_CONTRACTS = [
name: "capture_browser_scenario",
...toolContractMetadata("capture_browser_scenario"),
description:
"Run a controlled browser scenario when passive observation cannot exercise the application. Launch an approved executable or connect to an approved loopback CDP target, declare the allowed origins, and provide actions. Environment, empty storage, disabled request replay, redaction, and a URL-only final capture are defaults; provide secrets, initial storage, request replay, or additional artifacts when needed. Actions run until completion or cancellation unless timeout_ms is set. Results are returned inline.",
"Run a controlled browser scenario when passive observation cannot exercise the application. Launch the selected executable or connect to a loopback CDP target, provide a start URL and actions, and optionally declare additional origins for navigation, storage, or request replay. By default, only the start URL origin is in scope. Environment, empty storage, disabled request replay, redaction, and a URL-only final capture are defaults; provide secrets, initial storage, request replay, or additional artifacts when needed. Actions run until completion or cancellation unless timeout_ms is set. Results are returned inline.",
kind: "browser-provider",
inputSchema: browserScenarioInputSchema,
outputSchema: evidenceResultOf(browserScenarioCaptureSchema),
+9 -15
View File
@@ -114,22 +114,21 @@ const exampleScenarioCapture = () => ({
limitations: [],
});
/** Origin-scoped, passive browser reverse-engineering contracts. */
/** Passive browser reverse-engineering contracts. */
export const BROWSER_TOOL_CONTRACTS = [
{
name: "list_browser_targets",
...toolContractMetadata("list_browser_targets"),
description:
"List every page target from an approved user-owned loopback Chrome DevTools Protocol endpoint whose current URL matches an approved exact origin. URL credentials, query values, and fragments are redacted.",
"List page targets exposed by the selected loopback Chrome DevTools Protocol endpoint. Optionally filter by exact origin. URLs preserve query values and fragments; only URL userinfo credentials are removed.",
kind: "browser-provider",
inputSchema: listBrowserTargetsInputSchema,
outputSchema: listOutputSchema,
examples: [
{
title: "List approved browser page targets",
title: "List browser page targets",
input: {
cdp_endpoint: endpoint,
allowed_origins: [origin],
},
},
],
@@ -138,16 +137,15 @@ export const BROWSER_TOOL_CONTRACTS = [
name: "inspect_web_page",
...toolContractMetadata("inspect_web_page"),
description:
"Passively inspect one approved page target through CDP without evaluating JavaScript, navigating, clicking, closing, or mutating the page. Returns DOM structure, accessibility, scripts, resources, attach-window network and console metadata, workers, and redacted storage inventory as Evidence.",
"Passively inspect one selected page target through CDP without evaluating JavaScript, navigating, clicking, closing, or mutating the page. If no origin filter is supplied, capture is scoped to the target's current origin. Returns DOM structure, accessibility, scripts, resources, attach-window network and console metadata, workers, and redacted storage inventory as Evidence.",
kind: "browser-provider",
inputSchema: inspectWebPageInputSchema,
outputSchema: inspectionOutputSchema,
examples: [
{
title: "Inspect one approved browser page",
title: "Inspect one browser page",
input: {
cdp_endpoint: endpoint,
allowed_origins: [origin],
target_id: "TARGET_ID_FROM_LIST_BROWSER_TARGETS",
},
},
@@ -157,16 +155,15 @@ export const BROWSER_TOOL_CONTRACTS = [
name: "analyze_web_bundle",
...toolContractMetadata("analyze_web_bundle"),
description:
"Capture JavaScript source from one configured CDP page and statically derive a 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.",
"Capture JavaScript source from one selected CDP page and statically derive a chunk graph, route and endpoint candidates, vendor fingerprints, page-declared WebMCP metadata, and optionally fetch source maps from the selected target origin or explicitly requested origins. JavaScript is parsed but never executed.",
kind: "browser-provider",
inputSchema: analyzeWebBundleInputSchema,
outputSchema: bundleOutputSchema,
examples: [
{
title: "Analyze an approved page bundle",
title: "Analyze a page bundle",
input: {
cdp_endpoint: endpoint,
allowed_origins: [origin],
target_id: "TARGET_ID_FROM_LIST_BROWSER_TARGETS",
observation_ms: 500,
include_accessibility_text: false,
@@ -181,7 +178,7 @@ export const BROWSER_TOOL_CONTRACTS = [
name: "observe_web_session",
...toolContractMetadata("observe_web_session"),
description:
"Arm a CDP observation window of the requested duration while the user operates the page. Allows approved same-origin reload and SPA navigation, records every observed navigation, redirect, lifecycle, and failure event, and stops before retaining an out-of-policy destination.",
"Arm a CDP observation window of the requested duration while the user operates the page. By default it follows the selected target's current origin; an explicit origin list controls which origins may be retained. Records navigation, redirect, lifecycle, and failure events.",
kind: "browser-provider",
inputSchema: observeWebSessionInputSchema,
outputSchema: observationSessionOutputSchema,
@@ -190,7 +187,6 @@ export const BROWSER_TOOL_CONTRACTS = [
title: "Observe one external user action",
input: {
cdp_endpoint: endpoint,
allowed_origins: [origin],
target_id: "TARGET_ID_FROM_LIST_BROWSER_TARGETS",
observation_ms: 10_000,
},
@@ -210,7 +206,6 @@ export const BROWSER_TOOL_CONTRACTS = [
title: "Discover current WebMCP declarations",
input: {
cdp_endpoint: endpoint,
allowed_origins: [origin],
target_id: "TARGET_ID_FROM_LIST_BROWSER_TARGETS",
observation_ms: 100,
},
@@ -255,10 +250,9 @@ export const BROWSER_TOOL_CONTRACTS = [
outputSchema: screenshotOutputSchema,
examples: [
{
title: "Capture an approved viewport",
title: "Capture a viewport",
input: {
cdp_endpoint: endpoint,
allowed_origins: [origin],
target_id: "TARGET_ID_FROM_LIST_BROWSER_TARGETS",
},
},
+5 -6
View File
@@ -34,24 +34,23 @@ const endpoint = "http://127.0.0.1:9223";
const activeExample = {
executable_path: "/Applications/Electron.app/Contents/MacOS/Electron",
application_path: "/Applications/Example.app/Contents/Resources/main.js",
application_root: "/Applications/Example.app/Contents/Resources",
args: [],
actions: [{ step_id: "exercise-ipc", kind: "click", selector: "#run" }],
};
/** Root-confined Electron file-page discovery and inspection contracts. */
/** Endpoint-scoped Electron file-page discovery and inspection contracts. */
export const ELECTRON_TOOL_CONTRACTS = [
{
name: "list_electron_targets",
...toolContractMetadata("list_electron_targets"),
description:
"List every Electron file:// page target from an approved user-owned loopback CDP endpoint. Every path is canonicalized and must remain contained by an approved filesystem root, including after symlink resolution.",
"List every Electron file:// page target from a selected loopback CDP endpoint. Local file paths are canonicalized after symlink resolution. Selecting an endpoint exposes every eligible target and its local path metadata.",
kind: "electron-provider",
inputSchema: listElectronTargetsInputSchema,
outputSchema: listOutputSchema,
examples: [
{
title: "List approved Electron file pages",
title: "List Electron file pages",
input: {
cdp_endpoint: endpoint,
},
@@ -68,7 +67,7 @@ export const ELECTRON_TOOL_CONTRACTS = [
outputSchema: inspectionOutputSchema,
examples: [
{
title: "Inspect an approved Electron page",
title: "Inspect an Electron page",
input: {
cdp_endpoint: endpoint,
target_id: "TARGET_ID_FROM_LIST_ELECTRON_TARGETS",
@@ -113,7 +112,7 @@ export const ELECTRON_TOOL_CONTRACTS = [
name: "capture_electron_scenario",
...toolContractMetadata("capture_electron_scenario"),
description:
"Use this for an explicitly approved, provider-owned Electron run when passive CDP or Inspector observation cannot exercise application behavior. REA owns startup and teardown, accepts caller-defined click/wait actions plus window-targeted renderer reload/crash and synthetic open-url/second-instance delivery, and returns correlated window/WebContents/process/preload/session/navigation/shell/IPC evidence without retaining payload values. Results identify observed and unavailable event families, coverage status, action targets, and truncation. External shell, navigation, permission, download, popup, updater, and OS-integration effects are blocked and recorded. Use passive Electron tools for observation-only work.",
"Use this for a provider-owned Electron run when passive CDP or Inspector observation cannot exercise application behavior. REA owns startup and teardown, accepts caller-defined click/wait actions plus window-targeted renderer reload/crash and synthetic open-url/second-instance delivery, and returns correlated window/WebContents/process/preload/session/navigation/shell/IPC evidence without retaining payload values. Results identify observed and unavailable event families, coverage status, action targets, and truncation. External shell, navigation, permission, download, popup, updater, and OS-integration effects are blocked and recorded. Use passive Electron tools for observation-only work.",
kind: "electron-provider",
inputSchema: electronActiveObservationInputSchema,
outputSchema: evidenceResultOf(electronActiveObservationResultSchema),
-40
View File
@@ -2,7 +2,6 @@ import { z } from "zod";
const categorySchema = z.enum([
"invalid_input",
"permission_required",
"unsupported_provider",
"integrity_mismatch",
"truncated",
@@ -14,8 +13,6 @@ const categorySchema = z.enum([
const remediationSchema = z
.object({
action: z.string().min(1),
restart_required: z.boolean(),
elicitation_supported: z.boolean().optional(),
})
.strict();
const common = {
@@ -30,28 +27,6 @@ const generic = <Code extends string>(code: Code) =>
.object({ code: z.literal(code), ...common, details: genericDetails })
.strict();
const scopeSchema = z
.object({
capability: z.string(),
roots: z.array(z.string()),
executables: z.array(z.string()),
environment_names: z.array(z.string()),
origins: z.array(z.string()).optional(),
network: z.enum(["none", "loopback", "external"]),
mount: z.boolean(),
})
.strict();
const missingScopeSchema = z
.object({
roots: z.array(z.string()).optional(),
executables: z.array(z.string()).optional(),
environment_names: z.array(z.string()).optional(),
origins: z.array(z.string()).optional(),
network: z.enum(["none", "loopback", "external"]).optional(),
mount: z.literal(true).optional(),
})
.strict();
/** Stable discriminated schema shared by every CLI and MCP error surface. */
export const analysisErrorProjectionSchema = z.discriminatedUnion("code", [
generic("invalid_request"),
@@ -77,21 +52,6 @@ export const analysisErrorProjectionSchema = z.discriminatedUnion("code", [
generic("artifact_operation_failed"),
generic("evidence_integrity_mismatch"),
generic("truncated"),
z
.object({
code: z.literal("permission_required"),
...common,
details: z
.object({
capability: z.string(),
requested: scopeSchema,
missing: missingScopeSchema,
ceiling: scopeSchema.nullable(),
})
.strict()
.optional(),
})
.strict(),
generic("process_capture_failed"),
generic("cleanup_incomplete"),
generic("revision_conflict"),
@@ -22,8 +22,8 @@ const reconciliationEvidence = createEvidence(
parameters: {
static_layers:
JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE.static_layers.map(
({ role, analysis }) => ({
role,
({ analysis }) => ({
role: "application",
evidence_id: analysis.evidence_id,
runtime_mappings: [],
}),
@@ -22,7 +22,7 @@ export const JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS = [
outputSchema: evidenceResultOf(javascriptRuntimeTargetListSchema),
examples: [
{
title: "List approved Node Inspector targets",
title: "List Node Inspector targets",
input: {
inspector_endpoint: endpoint,
},
@@ -39,7 +39,7 @@ export const JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS = [
outputSchema: evidenceResultOf(javascriptRuntimeObservationSchema),
examples: [
{
title: "Observe one approved Node runtime",
title: "Observe one Node runtime",
input: {
inspector_endpoint: endpoint,
target_id: "TARGET_ID_FROM_LIST_JAVASCRIPT_RUNTIME_TARGETS",
@@ -238,7 +238,7 @@ const runtimeEvidence = createEvidence(
/** Compact valid Evidence pair used by the public reconciliation contract. */
export const JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE = {
static_layers: [{ role: "application", analysis: staticEvidence }],
static_layers: [{ analysis: staticEvidence }],
runtime_observations: [runtimeEvidence],
};
+19 -7
View File
@@ -73,14 +73,26 @@ export const managedNativeVerificationReferenceInputSchema = z
const managedApplicationGraphReferenceFacts = {} as const;
const managedApplicationGraphReferenceShape = z.strictObject({
...managedApplicationGraphReferenceFacts,
managed_artifact: evidenceSchema.optional(),
managed_members: evidenceSchema.optional(),
managed_native_boundaries: evidenceSchema.optional(),
});
/** Inline Evidence sources for managed application graph projection. */
export const managedApplicationGraphReferenceInputSchema = z
.strictObject({
...managedApplicationGraphReferenceFacts,
managed_artifact: evidenceSchema.optional(),
managed_members: evidenceSchema.optional(),
managed_native_boundaries: evidenceSchema.optional(),
})
.union([
managedApplicationGraphReferenceShape.extend({
managed_artifact: evidenceSchema,
}),
managedApplicationGraphReferenceShape.extend({
managed_members: evidenceSchema,
}),
managedApplicationGraphReferenceShape.extend({
managed_native_boundaries: evidenceSchema,
}),
])
.superRefine((input, context) => {
const ids = [
input.managed_artifact?.evidence_id,
@@ -184,7 +196,7 @@ export const MANAGED_WORKFLOW_TOOL_CONTRACTS = [
name: "plan_managed_runtime_correlation",
...toolContractMetadata("plan_managed_runtime_correlation"),
description:
"Prepare a separately authorized managed runtime-correlation admission plan from authenticated inspect_managed_members Evidence. The operation is default-disabled, requires the managed_runtime permission ceiling and grant, locks the exact artifact SHA-256, MVID, method signature, and limited decoded-IL tuple hash, distinguishes attach/load/debugger/reflection/instrumentation effects, and records that no target code was executed.",
"Prepare a non-executing managed runtime-correlation plan from authenticated inspect_managed_members Evidence. Planning does not probe or launch a runtime; it records the configured executable or the default command name, locks the exact artifact SHA-256, MVID, method signature, and decoded-IL hash, and describes requested effects and bounds without claiming execution or confinement.",
kind: "application",
inputSchema: managedRuntimeCorrelationReferenceInputSchema,
outputSchema: runtimeOutputSchema,
+3 -6
View File
@@ -15,13 +15,10 @@ const examples: Readonly<Record<string, Readonly<Record<string, unknown>>>> = {
inspect_signature: {},
inspect_plist: { path: "/Applications/Example.app/Contents/Info.plist" },
list_architectures: {},
observe_native_ui: { pid: 123, window_id: 456, observation_approved: true },
observe_native_ui: { pid: 123, window_id: 456 },
capture_native_ui_scenario: {
pid: 123,
window_id: 456,
observation_approved: true,
actions_approved: true,
restore: "leave-as-is",
steps: [{ kind: "wait", milliseconds: 100 }],
},
demangle_swift: { symbols: ["$s4Test3fooyyF"] },
@@ -55,12 +52,12 @@ const native = <Name extends string, Schema extends z.ZodObject>(
export const NATIVE_TOOL_CONTRACTS = [
native(
"observe_native_ui",
"Passively observe one explicitly approved already-running native app PID and window ID bound to the active Mach-O target. Captures a bounded accessibility tree and selected-window screenshot; OS permission denial fails without broad capture or target launch.",
"Observe an already-running native app by PID and window ID, bound to the active Mach-O target. Captures a bounded accessibility tree and selected-window screenshot; OS permission denial fails without broad capture or target launch.",
nativeUiObservationInputSchema,
),
native(
"capture_native_ui_scenario",
"Run separately approved selected-element press, increment/decrement scroll, AXValue text entry and bounded wait steps in one exact native app window. Returns ordered before/after captures and action/capture failures. Actions can change app data, network activity and persistent state. The caller must choose leave-as-is; automatic restoration is unsupported.",
"Run selected-element press, increment/decrement scroll, AXValue text entry and bounded wait steps in one exact native app window. Returns ordered before/after captures and action/capture failures. Actions can change app data, network activity and persistent state; application state is left as-is and restoration is not attempted.",
nativeUiScenarioInputSchema,
),
native(
+6 -6
View File
@@ -307,7 +307,7 @@ export const PROMPT_CONTRACTS = [
{
tools: ["capture_process_scenario", "correlate_static_and_runtime"],
instruction:
"Reuse a supplied capture when relevant; otherwise capture when enabled and authorized. Correlate through explicit hypotheses rather than timing or name coincidence.",
"Reuse a supplied capture when relevant; otherwise capture a bounded runtime reproduction when it can distinguish competing explanations. Correlate through explicit hypotheses rather than timing or name coincidence.",
},
{
tools: ["record_unknown"],
@@ -363,18 +363,18 @@ export const PROMPT_CONTRACTS = [
name: "prepare_bounded_process_capture",
title: "Prepare a bounded process capture",
description:
"Design an approval-gated process capture scenario with exact executable, filesystem, environment, network, replay, timeout, and cleanup boundaries.",
"Choose a command, inputs, observations, and stopping conditions for a process capture that answers the behavioral question.",
objective:
"Prepare and, after authorization, run a controlled process experiment that can answer the stated behavioral question.",
"Run a caller-selected process experiment that can answer the stated behavioral question.",
arguments: {
behavior_question: required(
"Behavioral question the capture must answer and stopping condition",
),
executable: required(
"Absolute executable path requested for the scenario",
"Command name or executable path requested for the scenario",
),
working_directory: required(
"Absolute working directory requested for the scenario",
"Working directory requested for the scenario",
),
prior_capture_evidence_id: optional(
"Retained process capture Evidence to compare or refine",
@@ -385,7 +385,7 @@ export const PROMPT_CONTRACTS = [
{
tools: ["capture_process_scenario"],
instruction:
"Present the requested scenario and explain the actual authority, runtime constraints, and cleanup behavior. Run only when operator policy authorizes it.",
"Run the caller-provided scenario. Explain command lookup, effective working directory, inherited environment, optional filesystem observations, and that the target runs with the current user's permissions.",
},
{
tools: ["compare_process_captures"],
+2 -2
View File
@@ -302,7 +302,7 @@ export const OFFICIAL_TOOL_CONTRACTS = [
),
official(
"xrefs",
"Return analyzed references to a code or data address, defaulting to the current cursor. Use to connect strings, globals, selectors, and functions; bare addresses are untyped and indirect references may be incomplete.",
"Return analyzed references to a code or data address. Hopper may default to its current cursor; headless providers such as Ghidra require an explicit address. Use to connect strings, globals, selectors, and functions; bare addresses are untyped and indirect references may be incomplete.",
z.object({ document, address: optionalAddress }),
),
] as const satisfies readonly ToolContract[];
@@ -415,7 +415,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 and records residual unknowns linked to that Evidence. 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 caller-selected command under a PTY and return process capture Evidence with residual unknowns. A command name resolves through the inherited PATH; the working directory defaults to the caller's current directory; host environment variables are inherited with scenario overrides. Filesystem snapshots are opt-in through filesystem_observation_paths. The target runs with the current user's permissions; this is not a security sandbox.",
processScenarioSchema,
),
session(
@@ -288,7 +288,6 @@ export const toolUnavailabilityReason = z.enum([
"provider_unavailable",
"target_unsupported",
"unsupported_host",
"policy_disabled",
]);
export const toolAvailability = z.discriminatedUnion("available", [
+6 -8
View File
@@ -4,13 +4,12 @@ import type { ToolContract } from "./toolContractTypes.js";
const PROPERTY_DESCRIPTIONS: Readonly<Record<string, string>> = {
addresses: "Ordered provider-normalized procedure addresses to analyze.",
approved: "Explicit operator approval to perform this operation.",
after: "The later or right-hand observation to compare.",
before: "The earlier or left-hand observation to compare.",
boundary_id: "Exact reconstruction boundary identifier to evaluate.",
case_sensitive:
"Whether text matching distinguishes uppercase and lowercase.",
cdp_endpoint: "Approved literal loopback Chrome DevTools Protocol endpoint.",
cdp_endpoint: "Literal loopback Chrome DevTools Protocol endpoint.",
comment: "Exact analyst comment text to write.",
comparisons: "Validated comparison Evidence records to aggregate.",
coverage: "Exact reconstruction-coverage commitment to verify.",
@@ -19,13 +18,13 @@ const PROPERTY_DESCRIPTIONS: Readonly<Record<string, string>> = {
error: "Structured, caller-actionable error when the operation fails.",
evidence: "Evidence record produced by this operation.",
evidence_id: "Stable identifier of the recorded Evidence observation.",
executable: "Approved absolute path of the executable to run.",
executable: "Command name or executable path to run.",
format: "Declared input artifact format.",
name: "Exact name used by this operation.",
pattern:
"Literal text or regular expression used to filter matching results.",
phase: "Current plan or execution phase of the operation.",
plan: "Content-bound execution plan and its approval commitment.",
plan: "Content-bound execution plan and its digest commitment.",
query: "Non-empty feature or text query to investigate.",
question: "Concrete unresolved question to retain for later investigation.",
result: "Primary structured result returned by this operation.",
@@ -43,7 +42,8 @@ const PROPERTY_DESCRIPTIONS: Readonly<Record<string, string>> = {
status: "Current lifecycle or verification status.",
summary: "Concise evidence-backed summary of the result.",
symbols: "Ordered Swift symbols to demangle.",
target_id: "Exact authorized CDP target identifier.",
target_id:
"Exact CDP target identifier selected from the endpoint's target listing.",
unknown_id: "Exact residual-unknown identifier.",
};
@@ -112,8 +112,6 @@ const fallbackPropertyDescription = (property: string): string => {
const explicit = PROPERTY_DESCRIPTIONS[property];
if (explicit !== undefined) return explicit;
const words = property.replaceAll("_", " ");
if (property.endsWith("_approved"))
return `Explicit operator approval for ${words.slice(0, -9)}.`;
if (property.startsWith("max_"))
return `Maximum permitted ${words.slice(4)} for this operation.`;
if (property.startsWith("include_"))
@@ -133,7 +131,7 @@ const fallbackPropertyDescription = (property: string): string => {
if (property.endsWith("_bytes"))
return `Byte count for ${words.slice(0, -6)}.`;
if (property.endsWith("_root") || property.endsWith("_roots"))
return `Approved canonical filesystem ${words}.`;
return `Local filesystem ${words} selected for this operation.`;
if (property.startsWith("is_") || property.startsWith("has_"))
return `Whether ${words}.`;
return `Value for ${words}.`;
+3 -6
View File
@@ -78,15 +78,12 @@ describe("workflow input contracts", () => {
).toBe(true);
});
it("requires explicit approval for record-and-continue artifact inspection", () => {
const input = {
integrity_policy: "record-and-continue" as const,
integrity_continue_approved: false,
};
it("accepts an explicit artifact integrity continuation policy", () => {
const input = { integrity_policy: "record-and-continue" as const };
const inspect = ARTIFACT_TOOL_CONTRACTS.find(
({ name }) => name === "inspect_artifact",
);
if (inspect === undefined) throw new Error("Missing inspect_artifact");
expect(inspect.inputSchema.safeParse(input).success).toBe(false);
expect(inspect.inputSchema.safeParse(input).success).toBe(true);
});
});