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
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 03:50:32 +08:00
1 parent ae634eb5f6
commit 717333ce9b
67 files changed
+1393 -1178

No files matched your search

@@ -1,5 +1,8 @@
import type { ToolContract } from "../toolContractTypes.js";
import { toolContractMetadata } from "../toolEffects.js";
import {
toolContractMetadata,
browserEvidenceEffects,
} from "../toolEffects.js";
import { evidenceResultOf } from "../toolOutputSchemaPrimitives.js";
import {
javascriptRuntimeObservationSchema,
@@ -15,7 +18,10 @@ export const JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS = [
{
name: "list_javascript_runtime_targets",
cli: true,
...toolContractMetadata("list_javascript_runtime_targets"),
...toolContractMetadata(
"list_javascript_runtime_targets",
browserEvidenceEffects,
),
description:
"List every eligible Node/Electron V8 Inspector target from an explicit literal-loopback endpoint. Node discovery file locations that cannot be verified are preserved as unresolved reported URLs; they do not prove filesystem identity. Listing does not attach to targets.",
kind: "runtime-provider",
@@ -33,7 +39,10 @@ export const JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS = [
{
name: "observe_javascript_runtime",
cli: true,
...toolContractMetadata("observe_javascript_runtime"),
...toolContractMetadata(
"observe_javascript_runtime",
browserEvidenceEffects,
),
description:
"Passively observe loaded-script and execution-context metadata on one loopback Node/Electron V8 Inspector target, selected by inspector_endpoint and target_id. Presence/attachability and file locations are rechecked; verified file paths stay separate from reported URLs, including distinct query/fragment identities. Parse failures are counted separately from malformed events. REA does not read source, evaluate, pause/resume or instrument execution; imports, EventEmitter activity and Electron IPC remain unknown. Use reconcile_javascript_runtime with static application Evidence. The selected endpoint exposes every target it serves to this tool.",
kind: "runtime-provider",