* fix(domain): preserve prototype-named JSON members through Evidence boundaries Zod's z.json() record projection drops own __proto__ members as a prototype-pollution guard, so provider replies carrying them lost evidence before hashing/serialization and CLI/MCP output. The shared schema now validates with z.json() as before, then rebuilds the value keeping prototype-named own members as ordinary data properties (__proto__ via Object.defineProperty, so the prototype is never mutated). parseHarJson no longer rejects __proto__ members; the explicit unsupported case from #992 is replaced with a preservation regression, and the inspect_web_network_capture contract text is updated to match. Fixes #1036 * fix(domain): bound JSON depth and oversized payloads at parsing boundaries jsonValueSchema re-walked hostile input through z.json()'s recursive core, so a deeply nested payload from an MCP tool argument, inline evidence, provider result, or keyed archive threw RangeError: Maximum call stack size exceeded instead of a validation issue. The schema now runs an iterative depth guard first and keeps z.json() for full JSON semantics behind it, which also turns cyclic values into validation errors. The 1000-edge limit stays far below the range where the recursive core overflows its stack (measured between 2000 and 3000 on Node 24) while leaving room for legitimately deep target-derived trees such as compiled NIB view hierarchies, and the guard narrows with a typed record check instead of any or unchecked casts. The non-recursive JSON Schema advertisement stays intact on both the public and standard projection paths. Two payload sizes get explicit budgets tied to their producer constraints: web text artifacts reject beyond the 16 MiB source budget the web tooling already advertises, and native UI screenshot base64 beyond the 64 MiB helper output budget. Regenerated product catalog, skill catalog digest, and completion-ledger manifest follow the schema-boundary change. * fix(validation): preserve depth diagnostics across process inputs --------- Co-authored-by: DeryFerd <deryferdikao125@gmail.com> Co-authored-by: N0zoM1z0 <1705004398@qq.com>
31 lines
1.8 KiB
TypeScript
31 lines
1.8 KiB
TypeScript
import {
|
|
inspectWebNetworkCaptureInputSchema,
|
|
webNetworkCaptureSchema,
|
|
} from "../domain/webNetworkCapture.js";
|
|
import type { ToolContract } from "./toolContracts.js";
|
|
import { toolContractMetadata } from "./toolEffects.js";
|
|
import { evidenceResultOf } from "./toolOutputSchemas.js";
|
|
|
|
/** Historical inspection is distinct from live browser capture and runtime authority. */
|
|
export const WEB_NETWORK_CAPTURE_TOOL_CONTRACTS = [
|
|
{
|
|
name: "inspect_web_network_capture",
|
|
...toolContractMetadata("inspect_web_network_capture"),
|
|
description:
|
|
"Inspect retained local HAR 1.2 or native mitmproxy capture records without contacting recorded URLs. Returns original ordinals, pointers/byte ranges, preserved producer fields, precise numeric representations and exact exposed binary bytes inline. Excludes known transport credentials and explicitly marked values. Decodes every record before optional ordinal selection; malformed or oversized captures return no partial success. Duplicate HAR members are invalid; prototype-named members such as __proto__ are preserved as ordinary own JSON members without prototype mutation. Uses pinned upstream parsers, owned temporary files and bounded offline processes. Native mitmproxy requires caller-supplied mitmdump 12.2.3 on Linux. Browser transaction IDs, runtime attribution and original bytes of HAR Unicode text remain unknown.",
|
|
kind: "browser-provider",
|
|
inputSchema: inspectWebNetworkCaptureInputSchema,
|
|
outputSchema: evidenceResultOf(webNetworkCaptureSchema),
|
|
examples: [
|
|
{
|
|
title: "Inspect historical HAR entries",
|
|
input: {
|
|
capture_path: "/captures/session.har",
|
|
format: "har",
|
|
record_ordinals: [0, 2],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
] as const satisfies readonly ToolContract[];
|