feat(browser): trace captured website source-map locations (#897)
* refactor(browser): share captured-script acquisition boundaries Reuse stable capture/source acquisition and identity validation for module and source-map analysis. Preserve host I/O, malformed input, unavailable source and digest mismatch diagnostics. Refs #851 Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing) * feat(browser): trace captured website source-map locations Refs #851. Preserve selected capture/map byte identity, duplicate mappings and embedded source evidence through the pinned upstream codec. Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing) * test(browser): verify source-map artifacts and synchronize generated contracts Cover byte-preserving map reads and actionable filesystem constraints. Refresh generated public schemas and metadata on current main. Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing) * fix(browser): preserve inert source-map URL context The selected URL is local codec context and grants no transport authority. Preserve its reported text and verify normal/userinfo contexts through real public interfaces, alongside independent manifest byte identity. Assisted-by: Yukari (gensokyo-skills:yukari-boundary-analysis) Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
This commit is contained in:
@@ -9,9 +9,37 @@ import {
|
||||
} from "../domain/webModuleTrace.js";
|
||||
import { toolContractMetadata } from "./toolEffects.js";
|
||||
import { evidenceResultOf } from "./toolOutputSchemas.js";
|
||||
import {
|
||||
webSourceLocationInputSchema,
|
||||
webSourceLocationResultSchema,
|
||||
} from "../domain/webSourceLocation.js";
|
||||
|
||||
/** Local captured-script publication contracts shared by CLI and MCP. */
|
||||
export const WEB_SCRIPT_TOOL_CONTRACTS = [
|
||||
{
|
||||
name: "trace_web_source_location",
|
||||
...toolContractMetadata("trace_web_source_location"),
|
||||
description:
|
||||
"Trace one generated position in an exported website script through an explicitly paired local source map. Verifies manifest, selected script and map SHA-256/byte identities; returns every equal-position mapping, reported source/root, resolved source URL, embedded sourcesContent and original position inline. One-based lines and zero-based UTF-16 columns; greatest generated position <= requested across lines. Duplicate sources and generated-only mappings remain distinct. Caller-selected pairing does not establish deployment authenticity or execution. Regular maps and inline indexed sections only; external section URLs are unsupported. No network access or application execution; uses the pinned upstream codec in an owned Node process with private temporary files, independent 192 MiB old-generation heap and 20-second deadline. 4 MiB map, 32 MiB reply; complete evidence or actionable resource failure. Cleanup may extend the deadline.",
|
||||
kind: "application",
|
||||
inputSchema: webSourceLocationInputSchema,
|
||||
outputSchema: evidenceResultOf(webSourceLocationResultSchema),
|
||||
examples: [
|
||||
{
|
||||
title:
|
||||
"Trace a selected captured JavaScript point to embedded original source",
|
||||
input: {
|
||||
manifest_path: "/analysis/scripts/manifest.json",
|
||||
script_index: 0,
|
||||
source_map: {
|
||||
path: "/analysis/app.js.map",
|
||||
url: "https://example.test/app.js.map",
|
||||
},
|
||||
generated_position: { line: 1, column: 25 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "trace_web_module_imports",
|
||||
...toolContractMetadata("trace_web_module_imports"),
|
||||
|
||||
Reference in New Issue
Block a user