refactor(mcp): simplify workflow and observation scope
This commit is contained in:
@@ -38,14 +38,6 @@ const activeExample = {
|
||||
application_root: "/Applications/Example.app/Contents/Resources",
|
||||
args: [],
|
||||
actions: [{ step_id: "exercise-ipc", kind: "click", selector: "#run" }],
|
||||
limits: {
|
||||
max_duration_ms: 60_000,
|
||||
action_timeout_ms: 5_000,
|
||||
max_actions: 20,
|
||||
max_ipc_events: 2_000,
|
||||
max_processes: 32,
|
||||
max_windows: 32,
|
||||
},
|
||||
};
|
||||
|
||||
/** Root-confined Electron file-page discovery and inspection contracts. */
|
||||
@@ -72,7 +64,7 @@ export const ELECTRON_TOOL_CONTRACTS = [
|
||||
name: "inspect_electron_page",
|
||||
...toolContractMetadata("inspect_electron_page"),
|
||||
description:
|
||||
"Passively inspect one approved Electron file page through CDP. Returns root-confined frames, DOM structure, resource paths, and scripts without evaluating renderer JavaScript or invoking Electron APIs; script contents require separate approval.",
|
||||
"Passively inspect one Electron file page using its list_electron_targets Evidence and returned target ID. Pass the discovery Evidence ID to reuse its endpoint and authorized file roots; this avoids repeating scope and cannot widen permission. Returns frames, DOM structure, resource paths, and scripts without evaluating renderer JavaScript or invoking Electron APIs.",
|
||||
kind: "electron-provider",
|
||||
inputSchema: inspectElectronPageToolInputSchema,
|
||||
outputSchema: inspectionOutputSchema,
|
||||
@@ -80,8 +72,7 @@ export const ELECTRON_TOOL_CONTRACTS = [
|
||||
{
|
||||
title: "Inspect an approved Electron page",
|
||||
input: {
|
||||
cdp_endpoint: endpoint,
|
||||
allowed_file_roots: [root],
|
||||
discovery_evidence_id: "EVIDENCE_ID_FROM_LIST_ELECTRON_TARGETS",
|
||||
target_id: "TARGET_ID_FROM_LIST_ELECTRON_TARGETS",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ export const JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS = [
|
||||
name: "observe_javascript_runtime",
|
||||
...toolContractMetadata("observe_javascript_runtime"),
|
||||
description:
|
||||
"Attach passively to one exact approved Node/Electron V8 Inspector target and capture bounded Debugger.scriptParsed plus Runtime execution-context events. REA sends only Runtime.enable and Debugger.enable: it never evaluates, pauses, resumes, reads source, or instruments the target. require/import edges, EventEmitter activity, and Electron IPC remain explicit unknowns; reconcile the returned Evidence with static Application Graph Evidence using reconcile_javascript_runtime.",
|
||||
"Attach passively to one Node/Electron V8 Inspector target using its list_javascript_runtime_targets Evidence and returned target ID. Pass the discovery Evidence ID to reuse its endpoint and authorized file/origin scope; this avoids repeating scope and cannot widen permission. Captures Debugger.scriptParsed and Runtime execution-context events. REA never evaluates, pauses, resumes, reads source, or instruments the target; require/import edges, EventEmitter activity, and Electron IPC remain explicit unknowns. Reconcile the result with static Application Graph Evidence using reconcile_javascript_runtime.",
|
||||
kind: "runtime-provider",
|
||||
inputSchema: observeJavaScriptRuntimeToolInputSchema,
|
||||
outputSchema: evidenceResultOf(javascriptRuntimeObservationSchema),
|
||||
@@ -44,8 +44,8 @@ export const JAVASCRIPT_RUNTIME_OBSERVATION_TOOL_CONTRACTS = [
|
||||
{
|
||||
title: "Observe one approved Node runtime",
|
||||
input: {
|
||||
inspector_endpoint: endpoint,
|
||||
allowed_file_roots: [root],
|
||||
discovery_evidence_id:
|
||||
"EVIDENCE_ID_FROM_LIST_JAVASCRIPT_RUNTIME_TARGETS",
|
||||
target_id: "TARGET_ID_FROM_LIST_JAVASCRIPT_RUNTIME_TARGETS",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -84,15 +84,14 @@ describe("guided prompt contracts", () => {
|
||||
).toBeLessThan(
|
||||
rendered.get("audit_residual_unknowns")?.indexOf("`update_unknown`") ?? 0,
|
||||
);
|
||||
expect(rendered.get("prepare_bounded_process_capture")).not.toContain(
|
||||
"`binary_session`",
|
||||
);
|
||||
expect(
|
||||
rendered
|
||||
.get("prepare_bounded_process_capture")
|
||||
?.indexOf("`binary_session`"),
|
||||
).toBeLessThan(
|
||||
rendered
|
||||
.get("prepare_bounded_process_capture")
|
||||
?.indexOf("`capture_process_scenario`") ?? 0,
|
||||
);
|
||||
?.indexOf("`capture_process_scenario`"),
|
||||
).toBeGreaterThanOrEqual(0);
|
||||
expect(
|
||||
rendered
|
||||
.get("compare_application_versions")
|
||||
|
||||
@@ -116,18 +116,14 @@ export const PROMPT_CONTRACTS = [
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
tools: [
|
||||
"binary_session",
|
||||
"open_binary",
|
||||
"analyze_javascript_application",
|
||||
],
|
||||
tools: ["open_binary", "analyze_javascript_application"],
|
||||
instruction:
|
||||
"For an approved JavaScript/Electron artifact, reconstruct its application graph without execution when useful; open target_path only when no matching target is active.",
|
||||
},
|
||||
{
|
||||
tools: ["list_documents", "set_current_document", "binary_overview"],
|
||||
tools: ["list_documents", "set_current_document"],
|
||||
instruction:
|
||||
"Select an explicitly discovered document, then establish bounded binary, language, segment, and procedure context.",
|
||||
"Select a document only when needed for the requested analysis.",
|
||||
},
|
||||
{
|
||||
tools: ["search_strings", "search_procedures", "procedure_address"],
|
||||
@@ -294,7 +290,7 @@ export const PROMPT_CONTRACTS = [
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
tools: ["binary_session", "open_binary", "binary_overview"],
|
||||
tools: ["open_binary"],
|
||||
instruction:
|
||||
"Confirm the target only when needed; open or analyze it if it is not already active and the request requires it.",
|
||||
},
|
||||
@@ -395,11 +391,6 @@ export const PROMPT_CONTRACTS = [
|
||||
),
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
tools: ["binary_session"],
|
||||
instruction:
|
||||
"Inspect capture capability, declared effects, and limits before proposing execution. An unavailable capability is not permission to widen policy.",
|
||||
},
|
||||
{
|
||||
tools: ["get_evidence_bundle"],
|
||||
instruction:
|
||||
|
||||
Reference in New Issue
Block a user