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
-24
View File
@@ -71,7 +71,6 @@ it(
arguments: {
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
approved: true,
},
});
expect(listed.isError).not.toBe(true);
@@ -80,33 +79,17 @@ it(
targets: [{ target_id: "allowed-page" }],
},
});
const unapprovedSourceCapture = await connected.client.callTool({
name: "inspect_web_page",
arguments: {
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
approved: true,
include_script_sources: true,
},
});
expect(unapprovedSourceCapture.isError).toBe(true);
const inspected = await connected.client.callTool({
name: "inspect_web_page",
arguments: {
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
approved: true,
observation_ms: 0,
include_console_text: true,
console_text_approved: true,
include_json_body_shapes: true,
json_body_schema_approved: true,
include_websocket_shapes: true,
websocket_shape_approved: true,
include_script_sources: true,
source_capture_approved: true,
},
});
expect(inspected.isError).not.toBe(true);
@@ -146,8 +129,6 @@ it(
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
approved: true,
source_capture_approved: true,
observation_ms: 0,
},
});
@@ -174,7 +155,6 @@ const verifySessionAndComparisonTools = async (
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
approved: true,
observation_ms: 5,
},
});
@@ -193,7 +173,6 @@ const verifySessionAndComparisonTools = async (
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
approved: true,
observation_ms: 0,
},
});
@@ -228,8 +207,6 @@ const verifySessionAndComparisonTools = async (
cdp_endpoint: browser.endpoint,
allowed_origins: [browser.allowedOrigin],
target_id: "allowed-page",
approved: true,
screenshot_approved: true,
},
});
expect(screenshot.isError).not.toBe(true);
@@ -262,7 +239,6 @@ it("denies origins outside the administrator ceiling before CDP attach", async (
cdp_endpoint: browser.endpoint,
allowed_origins: ["https://unapproved.example.test"],
target_id: "allowed-page",
approved: true,
observation_ms: 0,
},
});
@@ -163,7 +163,6 @@ const scenario = (origin = "https://app.example.test") => ({
max_storage_entries: 100,
max_total_metadata_bytes: 1_048_576,
},
approved: true,
});
describe("browser scenario MCP tool", () => {
-5
View File
@@ -88,7 +88,6 @@ it("exposes root-confined Electron discovery and inspection as Evidence v2", asy
arguments: {
cdp_endpoint: browser.endpoint,
allowed_file_roots: [root],
approved: true,
},
});
expect(listed.isError).not.toBe(true);
@@ -103,10 +102,8 @@ it("exposes root-confined Electron discovery and inspection as Evidence v2", asy
cdp_endpoint: browser.endpoint,
allowed_file_roots: [root],
target_id: "electron-page",
approved: true,
observation_ms: 0,
include_script_sources: true,
source_capture_approved: true,
},
});
const analyzed = await client.callTool({
@@ -171,7 +168,6 @@ it("exposes root-confined Electron discovery and inspection as Evidence v2", asy
arguments: {
cdp_endpoint: browser.endpoint,
allowed_file_roots: [outside],
approved: true,
},
});
expect(denied.isError).toBe(true);
@@ -248,7 +244,6 @@ it("exposes active Electron scenarios through the separately granted MCP boundar
actions: [
{ step_id: "submit", kind: "click", selector: "#submit-secret" },
],
approved: true,
},
});
expect(captured.isError, JSON.stringify(captured)).not.toBe(true);
@@ -249,7 +249,6 @@ it("cannot omit a session-owned active unknown from reconstruction input", async
expect(session.recordEvidence(evidence).ok).toBe(true);
expect(
session.recordUnknown({
approved: true,
question: "Was terminal equivalence reproduced independently?",
severity: "high",
domain: "reconstruction-verification",
@@ -72,7 +72,6 @@ describe("JavaScript runtime observation MCP tools", () => {
inspector_endpoint: inspector.endpoint,
allowed_file_roots: [root],
allowed_origins: [],
approved: true,
},
});
expect(listed.isError).not.toBe(true);
@@ -90,7 +89,6 @@ describe("JavaScript runtime observation MCP tools", () => {
allowed_origins: [],
target_id: inspector.targetId,
runtime_kind: "node",
approved: true,
observation_ms: 10,
},
});
@@ -126,7 +124,6 @@ describe("JavaScript runtime observation MCP tools", () => {
allowed_origins: [],
target_id: inspector.targetId,
runtime_kind: "node",
approved: true,
observation_ms: 10,
limits: {
max_events: 10_000,
+25
View File
@@ -57,6 +57,31 @@ interface Invocation {
const resources: Array<{ close(): Promise<void> }> = [];
describe("read_bytes contract", () => {
it("accepts lengths above the former arbitrary ceiling and rejects zero", () => {
const contract = OFFICIAL_TOOL_CONTRACTS.find(
({ name }) => name === "read_bytes",
);
expect(contract).toBeDefined();
expect(
contract?.inputSchema.safeParse({ address: "0x1000", length: 4097 })
.success,
).toBe(true);
expect(
contract?.inputSchema.safeParse({ address: "0x1000", length: 0 }).success,
).toBe(false);
expect(
contract?.outputSchema.shape.result.safeParse({
address: "0x1000",
requested_bytes: 4097,
returned_bytes: 4097,
bytes_hex: "ff".repeat(4097),
complete: true,
}).success,
).toBe(true);
});
});
afterEach(async () => {
await Promise.all(
resources.splice(0).map(async (resource) => resource.close()),
@@ -90,7 +90,6 @@ describe("process-capture MCP elicitation handshake", () => {
const captured = await client.callTool({
name: "capture_process_scenario",
arguments: {
approved: true,
executable: process.execPath,
arguments: ["-e", "process.exit(0)"],
working_directory: root,
@@ -69,7 +69,6 @@ describe("process-capture MCP elicitation handshake", () => {
const call = {
name: "capture_process_scenario",
arguments: {
approved: true,
executable: process.execPath,
arguments: ["-e", "process.exit(0)"],
working_directory: root,
@@ -93,7 +93,6 @@ describe("guided prompt completion from investigation records", () => {
])
expect(session.recordEvidence(evidence).ok).toBe(true);
const unknown = session.recordUnknown({
approved: true,
question: "Which branch handles the fallback?",
severity: "medium",
domain: "control-flow",
@@ -122,7 +121,6 @@ describe("guided prompt completion from investigation records", () => {
]);
const resolved = session.updateUnknown({
approved: true,
unknown_id: unknown.value.unknown_id,
expected_revision: unknown.value.revision,
status: "resolved",
-2
View File
@@ -156,7 +156,6 @@ describe("target-free MCP workflow", () => {
const resolved = await mcp.callTool({
name: "update_unknown",
arguments: {
approved: true,
unknown_id: recordedUnknown.unknown_id,
expected_revision: 1,
status: "resolved",
@@ -253,7 +252,6 @@ describe("process residuals over MCP", () => {
const captured = await mcp.callTool({
name: "capture_process_scenario",
arguments: {
approved: true,
unknown_registry_approved: true,
executable: process.execPath,
arguments: [processFixture, "partial"],
-1
View File
@@ -133,7 +133,6 @@ export const snapshotAndRecordUnknown = async (
await mcp.callTool({
name: "record_unknown",
arguments: {
approved: true,
question: "Does the alternate branch execute?",
severity: "medium",
domain: "control-flow",