Files
reverse-engineering-anything/src/contracts/environmentToolContracts.ts
T
morluto 717333ce9b refactor(contracts): declare each tool's effect audit on its contract (#11305)
* refactor(contracts): declare each tool's effect audit on its contract

Every public tool's effects lived in a 255-entry TOOL_EFFECT_AUDIT table in
toolEffects.ts, keyed by name and looked up again by toolContractMetadata,
the capability inventory (toolSessionEffects) and tests (TOOL_EFFECTS).

toolContractMetadata(name, audit) now takes the audit from the contract
declaration, and the contract carries both the provider-wide effects and
the session effects. The inventory reads contract.sessionEffects. The
table, TOOL_EFFECTS and toolSessionEffects are removed; toolEffects.ts
keeps the effect type, the shared presets and annotation derivation.

Effects, session effects, annotations and titles are byte-identical for all
255 contracts.

* test(contracts): read focused effect expectations from their contract family
2026-11-16 03:50:32 +08:00

48 lines
2.2 KiB
TypeScript

import {
environmentBuildReportSchema,
exportEnvironmentBundleInputSchema,
} from "../domain/environmentBundleExport.js";
import type { ToolContract } from "./toolContractTypes.js";
import { toolContractMetadata, toolEffects } from "./toolEffects.js";
/** Agent environment bundle contracts shared with the environment-build CLI command. */
export const ENVIRONMENT_TOOL_CONTRACTS = [
{
name: "export_environment_bundle",
...toolContractMetadata(
"export_environment_bundle",
toolEffects({
writesFilesystem: true,
idempotent: false,
}),
),
description:
"Write an agent environment bundle from capture_browser_scenario Evidence or HAR inspect_web_network_capture Evidence to an absent absolute output_directory whose parent exists. Copies complete capture Evidence, including recorded bodies, and derives replay/state read tools and served/withheld writes with coverage and next-recording hints. Preview the same coverage with inspect_analysis_view kind environment-coverage. dry_run reports without writing but still validates the destination. Uses default template rules, reads only selected Evidence and optional package_tarball, and writes only that directory; no network access. The bundle README explains agentenv use. Destination refusals name this tool; other failures name their export stage.",
kind: "application",
inputSchema: exportEnvironmentBundleInputSchema,
outputSchema: environmentBuildReportSchema,
examples: [
{
title: "Write the bundle for a retained browser scenario capture",
input: {
source: {
kind: "retained-evidence",
evidence_id:
"ev_0000000000000000000000000000000000000000000000000000000000000001",
},
output_directory: "/tmp/grafana-env",
name: "grafana",
},
},
{
title: "Check what a capture file's bundle would serve",
input: {
source: { kind: "evidence-file", path: "/tmp/grafana.capture.json" },
output_directory: "/tmp/grafana-env",
dry_run: true,
},
},
],
},
] as const satisfies readonly ToolContract[];