add black-box debug harness

This commit is contained in:
2026-05-14 16:37:46 +01:00
parent 8d4df5f683
commit 56e94ae032
18 changed files with 1274 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
{
"name": "child_exit",
"trust": ["exit0"],
"presets": {
"processes": [
{
"name": "exit0",
"argv": ["sh", "-lc", "exit 0"]
}
]
},
"steps": [
{
"type": "mcp_call",
"method": "spawn_process",
"params": { "kind": "command", "preset": "exit0" },
"save_as": "proc"
},
{ "type": "wait_stable", "timeout_ms": 3000 },
{ "type": "assert_mcp", "method": "list_processes", "path": "0.status", "equals": "exited" },
{ "type": "assert_mcp", "method": "list_processes", "path": "0.exit_code", "equals": 0 }
]
}

View File

@@ -0,0 +1,30 @@
{
"name": "mcp_send_input",
"steps": [
{
"type": "mcp_call",
"method": "spawn_process",
"params": {
"kind": "command",
"argv": ["sh", "-lc", "read line; echo got:$line; sleep 5"],
"name": "reader"
},
"save_as": "proc"
},
{
"type": "mcp_call",
"method": "send_input",
"params": {
"process_id": "{{proc.process_id}}",
"kind": "text",
"text": "hello",
"submit": true,
"wait_ms": 250,
"tail_mode": "grid"
},
"save_as": "input"
},
{ "type": "assert_saved", "from": "input", "path": "tail.content", "contains": "got:hello" },
{ "type": "wait_text", "contains": "got:hello", "timeout_ms": 5000 }
]
}

View File

@@ -0,0 +1,26 @@
{
"name": "spawn_process_via_palette",
"presets": {
"processes": [
{
"name": "ready",
"argv": ["ready-script"]
}
]
},
"scripts": [
{
"name": "ready-script",
"body": "#!/bin/sh\necho READY\nsleep 5\n"
}
],
"steps": [
{ "type": "wait_stable", "timeout_ms": 3000 },
{ "type": "send_chord", "chord": "ctrl-k" },
{ "type": "send_text", "text": "ready" },
{ "type": "send_chord", "chord": "enter" },
{ "type": "wait_text", "contains": "READY", "timeout_ms": 5000 },
{ "type": "assert_mcp", "method": "list_processes", "path": "0.name", "equals": "ready" },
{ "type": "assert_mcp", "method": "list_processes", "path": "0.status", "equals": "running" }
]
}

View File

@@ -0,0 +1,34 @@
{
"name": "switch_via_palette",
"scripts": [
{
"name": "named-loop",
"body": "#!/bin/sh\necho \"$1 READY\"\nsleep 5\n"
}
],
"steps": [
{
"type": "mcp_call",
"method": "spawn_process",
"params": { "kind": "command", "argv": ["named-loop", "first"], "name": "first" },
"save_as": "first"
},
{
"type": "mcp_call",
"method": "spawn_process",
"params": { "kind": "command", "argv": ["named-loop", "second"], "name": "second" },
"save_as": "second"
},
{ "type": "wait_text", "contains": "second READY", "timeout_ms": 5000 },
{ "type": "send_chord", "chord": "ctrl-k" },
{ "type": "send_text", "text": "Switch to first" },
{ "type": "send_chord", "chord": "enter" },
{ "type": "wait_text", "contains": "first READY", "timeout_ms": 5000 },
{
"type": "assert_mcp",
"method": "get_project_status",
"path": "processes.0.name",
"equals": "first"
}
]
}

View File

@@ -0,0 +1,19 @@
{
"name": "trust_required",
"presets": {
"processes": [
{
"name": "untrusted",
"argv": ["sh", "-lc", "echo should-not-run"]
}
]
},
"steps": [
{
"type": "assert_mcp",
"method": "spawn_process",
"params": { "kind": "command", "preset": "untrusted" },
"error_kind": "needs_trust"
}
]
}