refactor(tools): remove redundant limits and acknowledgements

This commit is contained in:
morluto
2026-09-29 10:53:45 +08:00
parent 7ba3580c86
commit bd0e341572
158 changed files with 599 additions and 1527 deletions
-1
View File
@@ -140,7 +140,6 @@ const baseScenario = () => ({
max_storage_entries: 256,
max_total_metadata_bytes: 4 * 1_024 * 1_024,
},
approved: true,
});
describe("browserScenarioSchema", () => {
@@ -11,7 +11,6 @@ describe("CDP execution-context retention", () => {
cdp_endpoint: "http://127.0.0.1:9222",
allowed_origins: ["https://app.example.test"],
target_id: "page-1",
approved: true,
});
const browser = new CdpCaptureEvents(
request,
-1
View File
@@ -40,7 +40,6 @@ describe("CDP document capture", () => {
cdp_endpoint: "http://127.0.0.1:9222",
allowed_origins: [origin],
target_id: "page-1",
approved: true,
});
const snapshot = {
strings: [`${origin}/main`, `${origin}/frame`, "#document", "DIV", ""],
@@ -99,7 +99,6 @@ const scenario = (
max_storage_entries: 10,
max_total_metadata_bytes: 16_384,
},
approved: true,
});
type SnapshotKind = BrowserScenario["capture"]["after_each_step"][number];
@@ -23,7 +23,6 @@ it("parses bounded window, renderer, and deep-link actions for agents", () => {
url: "rea-fixture://open/item",
},
],
approved: true,
});
expect(input.actions).toEqual([
@@ -57,7 +56,6 @@ it("rejects non-absolute deep-link values", () => {
url: "not a URL",
},
],
approved: true,
});
expect(result.success).toBe(false);
@@ -70,7 +68,6 @@ it("redacts action inputs from Playwright failures", async () => {
application_path: "/opt/app/main.js",
application_root: "/opt/app",
actions: [{ step_id: "click-step", kind: "click", selector }],
approved: true,
});
const page = {
locator: () => ({
@@ -111,7 +108,6 @@ it("runs an untargeted deep-link without requiring a BrowserWindow", async () =>
url: "rea-fixture://open/item",
},
],
approved: true,
});
const application = {
windows: () => [],
@@ -68,7 +68,6 @@ describe("PlaywrightScenarioEvents", () => {
max_storage_entries: 10,
max_total_metadata_bytes: 1_000_000,
},
approved: true,
});
const secrets = BrowserScenarioSecrets.resolve(scenario, {});
if (secrets === undefined) throw new Error("Expected resolved secrets");
+9 -30
View File
@@ -224,12 +224,6 @@ const normalizeSourceMap = (
);
try {
const map = new AnyMap(text, request.fetchUrl);
if (map.sources.length > input.analysis_limits.max_original_sources)
return emptySourceMapItem(
request,
"truncated",
"Source map exceeds the original-source inventory limit.",
);
const resolvedBySource = new Map<string, string>();
const originalSources = map.sources.map((source, index) => {
const content = map.sourcesContent?.[index];
@@ -267,28 +261,18 @@ const normalizeSourceMap = (
name: mapping.name?.slice(0, 1_024) ?? null,
});
});
const modules = originalModuleEdges(
originalSources,
input.analysis_limits.max_findings,
);
const modules = originalModuleEdges(originalSources);
const mappingTruncated = totalMappings > mappings.length;
const limitations = [
...(mappingTruncated
? [
`Mappings were truncated from ${String(totalMappings)} to ${String(mappings.length)}.`,
]
: []),
...(modules.truncated
? [
`Original module edges were truncated to ${String(modules.edges.length)}.`,
]
: []),
];
const limitations = mappingTruncated
? [
`Mappings were truncated from ${String(totalMappings)} to ${String(mappings.length)}.`,
]
: [];
const parsed = {
...sourceMapContext(request),
artifact: createWebTextArtifact(text, "application/source-map+json"),
original_sources: originalSources,
original_module_edges: modules.edges,
original_module_edges: modules,
mappings,
};
return limitations.length === 0
@@ -309,11 +293,7 @@ const normalizeSourceMap = (
const originalModuleEdges = (
sources: ParsedSourceMapItem["original_sources"],
maximum: number,
): {
readonly edges: ParsedSourceMapItem["original_module_edges"];
readonly truncated: boolean;
} => {
): ParsedSourceMapItem["original_module_edges"] => {
const edges: ParsedSourceMapItem["original_module_edges"] = [];
const seen = new Set<string>();
for (const source of sources) {
@@ -325,7 +305,6 @@ const originalModuleEdges = (
const key = `${source.source}\0${detector.kind}\0${specifier}`;
if (seen.has(key)) continue;
seen.add(key);
if (edges.length >= maximum) return { edges, truncated: true };
edges.push({
from_source: source.source,
kind: detector.kind,
@@ -335,7 +314,7 @@ const originalModuleEdges = (
}
}
}
return { edges, truncated: false };
return edges;
};
const validSourceMapEnvelope = (text: string): boolean => {