mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 13:45:30 +00:00
* 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
56 lines
3.0 KiB
TypeScript
56 lines
3.0 KiB
TypeScript
import {
|
||
inspectWebNetworkCaptureInputSchema,
|
||
webNetworkCaptureSchema,
|
||
} from "../domain/webNetworkCapture.js";
|
||
import type { ToolContract } from "./toolContractTypes.js";
|
||
import { toolContractMetadata, toolEffects } from "./toolEffects.js";
|
||
import {
|
||
analysisDetailSchema,
|
||
analysisDetailOutputSchemaOf,
|
||
} from "./analysisDetail.js";
|
||
import { webNetworkCaptureSummaryViewResultSchema } from "../domain/analysisView/analysisViewResult.js";
|
||
|
||
/** Historical inspection is distinct from live browser capture and runtime authority. */
|
||
export const WEB_NETWORK_CAPTURE_TOOL_CONTRACTS = [
|
||
{
|
||
name: "inspect_web_network_capture",
|
||
cli: true,
|
||
...toolContractMetadata(
|
||
"inspect_web_network_capture",
|
||
toolEffects({
|
||
mutatesSession: true,
|
||
writesFilesystem: true,
|
||
launchesProcess: true,
|
||
}),
|
||
),
|
||
description:
|
||
"Inspect a saved local HAR 1.2, mitmproxy, Fiddler SAZ or supported aioquic qlog capture without contacting recorded URLs. Returns source-linked records, preserved producer fields, precise numbers, exposed bytes and explicit coverage/limitations; transport credentials and explicitly marked sensitive values are excluded. Use inspect_web_page for a live CDP page. Preserve capture_path exactly as supplied; it names a path on the REA host, not a path to rebase onto the client workspace. Select format; record_ordinals selects records after full decoding and also decodes recognized protobuf/gRPC bodies. Optional protobuf selects body_pointers, framing and a local FileDescriptorSet/message_type; native gRPC and gRPC-web remain distinct, ambiguous readings stay candidates and compressed payloads stay unknown. Default complete delivery is inline. detail summary retains Evidence for inspect_analysis_view kind capture (preview/complete), protobuf (bodies/frames/fields), or qlog; large text/schema values require explicit fields. Qlog supports aioquic 1.5.0 JSON qlog 0.3 and reports STREAM interval unions/endpoint loss declarations, not recovered bodies or proved network loss. SAZ preserves encoded bytes without replay/HAR conversion; encrypted archives are unsupported. Mitmproxy requires caller-supplied mitmdump 12.2.3 on Linux. Malformed or oversized captures return no partial success; browser transaction attribution and HAR text’s original bytes remain unknown.",
|
||
kind: "application",
|
||
inputSchema: inspectWebNetworkCaptureInputSchema.extend({
|
||
detail: analysisDetailSchema,
|
||
}),
|
||
outputSchema: analysisDetailOutputSchemaOf(
|
||
webNetworkCaptureSchema,
|
||
webNetworkCaptureSummaryViewResultSchema,
|
||
),
|
||
examples: [
|
||
{
|
||
title: "Inspect retained aioquic qlog events",
|
||
input: {
|
||
capture_path: "/captures/origin.qlog",
|
||
format: "qlog",
|
||
record_ordinals: [0, 2],
|
||
},
|
||
},
|
||
{
|
||
title: "Inspect historical HAR entries",
|
||
input: {
|
||
capture_path: "/captures/session.har",
|
||
format: "har",
|
||
record_ordinals: [0, 2],
|
||
},
|
||
},
|
||
],
|
||
},
|
||
] as const satisfies readonly ToolContract[];
|