mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
test(cli-rs): prove attention over P-PTY and failure toasts over P-APP
The P-PTY runner can push events from a step and classifies OSC 7501 as status. E.19a/attention compares the program status records and the notifications under scripted focus reports; the two failure-toast scenarios compare the plugin's toasts. N03-status-order records that the order between the two OSC kinds is not fixed in Rust.
This commit is contained in:
parent
85e6c4ed57
commit
1ba71456fa
11 changed files with 1594 additions and 3 deletions
17
packages/cli-rs/parity/deviations/N03-status-order.md
Normal file
17
packages/cli-rs/parity/deviations/N03-status-order.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# N03: order between notifications and program status records
|
||||
|
||||
TypeScript: the notifications plugin's `data.on` handlers run while the event is applied, before Solid runs the
|
||||
program status effect of `context/session-tabs.tsx:180-200`. A permission request therefore writes its
|
||||
notification (OSC 777, 9 or 99) first, and then the OSC 7501 records.
|
||||
|
||||
Rust: the store wakes the UI with a change message, and passes the event to the plugin as a separate signal
|
||||
message (`crates/store/src/connection.rs`, `Data::apply`). Two tokio tasks post these messages. The program status
|
||||
records go out on the change message (`features/attention/program_status.rs`) and the notification on the signal,
|
||||
so either one can come first.
|
||||
|
||||
Each sequence is the same as in TypeScript: the same records in the same order, and the same notifications in the
|
||||
same order. Only the order between the two kinds is not fixed. `E.19a/attention.pty.ts` compares them with
|
||||
`oscByKind`.
|
||||
|
||||
Reason: the terminal treats the two kinds independently, so their order has no effect. Fixing it would mean one
|
||||
queue for store changes and signals, which every view would then share.
|
||||
|
|
@ -0,0 +1,468 @@
|
|||
{
|
||||
"scenario": "E.19a/failed-toast-other",
|
||||
"width": 100,
|
||||
"height": 30,
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"config": {
|
||||
"experimental": {
|
||||
"new-designs": true
|
||||
},
|
||||
"animations": false
|
||||
},
|
||||
"args": {},
|
||||
"routes": [],
|
||||
"steps": [
|
||||
{
|
||||
"checkpoint": "home",
|
||||
"until": "Ask anything",
|
||||
"masks": [
|
||||
{
|
||||
"x": 16,
|
||||
"y": 16,
|
||||
"width": 84,
|
||||
"height": 1,
|
||||
"reason": "the placeholder: random in TS, not drawn yet in Rust (T17-home-prompt)"
|
||||
},
|
||||
{
|
||||
"x": 50,
|
||||
"y": 20,
|
||||
"width": 50,
|
||||
"height": 1,
|
||||
"reason": "the prompt footer hints are E.14's (P01-read-only-prompt)"
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 28,
|
||||
"width": 30,
|
||||
"height": 1,
|
||||
"reason": "the home footer's MCP count is E.14's (F01-home-footer-counts)"
|
||||
}
|
||||
],
|
||||
"fixture": "E.19a/failed-toast-other/home"
|
||||
},
|
||||
{
|
||||
"event": {
|
||||
"id": "evt_failed",
|
||||
"created": 1,
|
||||
"type": "session.execution.failed",
|
||||
"durable": {
|
||||
"aggregateID": "ses_c",
|
||||
"seq": 1,
|
||||
"version": 1
|
||||
},
|
||||
"data": {
|
||||
"sessionID": "ses_c",
|
||||
"error": {
|
||||
"type": "unknown",
|
||||
"message": "Plugin failed during skill.transform."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"checkpoint": "failed",
|
||||
"until": "Session failed",
|
||||
"masks": [
|
||||
{
|
||||
"x": 16,
|
||||
"y": 16,
|
||||
"width": 84,
|
||||
"height": 1,
|
||||
"reason": "the placeholder: random in TS, not drawn yet in Rust (T17-home-prompt)"
|
||||
},
|
||||
{
|
||||
"x": 50,
|
||||
"y": 20,
|
||||
"width": 50,
|
||||
"height": 1,
|
||||
"reason": "the prompt footer hints are E.14's (P01-read-only-prompt)"
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 28,
|
||||
"width": 30,
|
||||
"height": 1,
|
||||
"reason": "the home footer's MCP count is E.14's (F01-home-footer-counts)"
|
||||
}
|
||||
],
|
||||
"fixture": "E.19a/failed-toast-other/failed"
|
||||
}
|
||||
],
|
||||
"requests": {
|
||||
"writes": [],
|
||||
"reads": [
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/agent",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/command",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/config",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": []
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/experimental/migration/v1",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"status": "completed"
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/form",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/fs/list",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"<cwd>"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/info",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"version": "test",
|
||||
"pid": 0,
|
||||
"urls": [],
|
||||
"paths": {
|
||||
"tmp": "/tmp"
|
||||
},
|
||||
"capabilities": {
|
||||
"persistentPty": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/integration",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/location",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/mcp",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/mcp/resource",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"resources": [],
|
||||
"templates": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/model",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/plugin",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/project",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": []
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/provider",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/reference",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"canonical": "/tmp/opencode/packages/tui"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/session/active",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"data": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/shell",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/skill",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/vcs",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"branch": {
|
||||
"current": "main",
|
||||
"default": "main"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
{
|
||||
"width": 100,
|
||||
"height": 30,
|
||||
"rows": [
|
||||
" ",
|
||||
" ┃ ┃ ",
|
||||
" ┃ Session failed › Open ┃ ",
|
||||
" ┃ ┃ ",
|
||||
" ┃ Plugin failed during skill.transform. ┃ ",
|
||||
" ┃ ┃ ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ▄ ",
|
||||
" █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█ ",
|
||||
" █ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀ ",
|
||||
" ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ",
|
||||
" ",
|
||||
" ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",
|
||||
" /tmp/opencode/packages/tui:main ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" test ",
|
||||
" "
|
||||
],
|
||||
"styles": [
|
||||
"#ffffffff #0a0a0aff 0",
|
||||
"#e06c75ff #0a0a0aff 0",
|
||||
"#ffffffff #1e1e1eff 0",
|
||||
"#eeeeeeff #1e1e1eff 1",
|
||||
"#808080ff #1e1e1eff 0",
|
||||
"#eeeeeeff #1e1e1eff 0",
|
||||
"#808080ff #0a0a0aff 0",
|
||||
"#eeeeeeff #0a0a0aff 1",
|
||||
"#808080ff #282828ff 0",
|
||||
"#eeeeeeff #434343ff 1",
|
||||
"#282828ff #0a0a0aff 0",
|
||||
"#484848ff #0a0a0aff 0",
|
||||
"#00000000 #00000000 0",
|
||||
"#1e1e1eff #0a0a0aff 0"
|
||||
],
|
||||
"runs": [
|
||||
[[0,100]],
|
||||
[[0,55],[1,1],[2,41],[1,1],[0,2]],
|
||||
[[0,55],[1,1],[2,2],[3,14],[2,17],[4,6],[2,2],[1,1],[0,2]],
|
||||
[[0,55],[1,1],[2,41],[1,1],[0,2]],
|
||||
[[0,55],[1,1],[2,2],[5,37],[2,2],[1,1],[0,2]],
|
||||
[[0,55],[1,1],[2,41],[1,1],[0,2]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,31],[6,19],[0,1],[7,19],[0,30]],
|
||||
[[0,31],[6,19],[0,1],[7,19],[0,30]],
|
||||
[[0,31],[6,1],[8,2],[6,3],[8,2],[6,3],[8,3],[6,2],[8,2],[6,1],[0,1],[7,1],[9,3],[7,2],[9,2],[7,3],[9,2],[7,3],[9,3],[0,30]],
|
||||
[[0,31],[6,16],[10,2],[6,1],[0,1],[7,19],[0,30]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,13],[11,1],[2,74],[0,12]],
|
||||
[[0,13],[11,1],[2,2],[12,84]],
|
||||
[[0,13],[11,1],[2,74],[0,12]],
|
||||
[[0,13],[11,1],[2,74],[0,12]],
|
||||
[[0,13],[11,1],[13,74],[0,12]],
|
||||
[[0,13],[6,31],[0,6],[12,50]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[12,30],[0,64],[6,4],[0,2]],
|
||||
[[0,100]]
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"width": 100,
|
||||
"height": 30,
|
||||
"rows": [
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ▄ ",
|
||||
" █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█ ",
|
||||
" █ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀ ",
|
||||
" ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ",
|
||||
" ",
|
||||
" ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",
|
||||
" /tmp/opencode/packages/tui:main ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" test ",
|
||||
" "
|
||||
],
|
||||
"styles": [
|
||||
"#ffffffff #0a0a0aff 0",
|
||||
"#808080ff #0a0a0aff 0",
|
||||
"#eeeeeeff #0a0a0aff 1",
|
||||
"#808080ff #282828ff 0",
|
||||
"#eeeeeeff #434343ff 1",
|
||||
"#282828ff #0a0a0aff 0",
|
||||
"#484848ff #0a0a0aff 0",
|
||||
"#ffffffff #1e1e1eff 0",
|
||||
"#00000000 #00000000 0",
|
||||
"#1e1e1eff #0a0a0aff 0"
|
||||
],
|
||||
"runs": [
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,31],[1,19],[0,1],[2,19],[0,30]],
|
||||
[[0,31],[1,19],[0,1],[2,19],[0,30]],
|
||||
[[0,31],[1,1],[3,2],[1,3],[3,2],[1,3],[3,3],[1,2],[3,2],[1,1],[0,1],[2,1],[4,3],[2,2],[4,2],[2,3],[4,2],[2,3],[4,3],[0,30]],
|
||||
[[0,31],[1,16],[5,2],[1,1],[0,1],[2,19],[0,30]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,13],[6,1],[7,74],[0,12]],
|
||||
[[0,13],[6,1],[7,2],[8,84]],
|
||||
[[0,13],[6,1],[7,74],[0,12]],
|
||||
[[0,13],[6,1],[7,74],[0,12]],
|
||||
[[0,13],[6,1],[9,74],[0,12]],
|
||||
[[0,13],[1,31],[0,6],[8,50]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[0,100]],
|
||||
[[8,30],[0,64],[1,4],[0,2]],
|
||||
[[0,100]]
|
||||
]
|
||||
}
|
||||
619
packages/cli-rs/parity/fixtures/E.19a/failed-toast.app.json
Normal file
619
packages/cli-rs/parity/fixtures/E.19a/failed-toast.app.json
Normal file
|
|
@ -0,0 +1,619 @@
|
|||
{
|
||||
"scenario": "E.19a/failed-toast",
|
||||
"width": 100,
|
||||
"height": 30,
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"config": {
|
||||
"experimental": {
|
||||
"new-designs": true
|
||||
},
|
||||
"animations": false
|
||||
},
|
||||
"args": {
|
||||
"sessionID": "ses_b"
|
||||
},
|
||||
"routes": [
|
||||
{
|
||||
"path": "/api/session/ses_b",
|
||||
"json": {
|
||||
"data": {
|
||||
"id": "ses_b",
|
||||
"title": "Fix the parser",
|
||||
"projectID": "proj_test",
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
}
|
||||
},
|
||||
"time": {
|
||||
"created": 1,
|
||||
"updated": 1
|
||||
},
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/api/session/ses_b/message",
|
||||
"json": {
|
||||
"data": [],
|
||||
"cursor": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/api/session/ses_b/inbox",
|
||||
"json": {
|
||||
"data": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"checkpoint": "open",
|
||||
"until": "Fix the parser",
|
||||
"masks": [
|
||||
{
|
||||
"x": 60,
|
||||
"y": 28,
|
||||
"width": 40,
|
||||
"height": 1,
|
||||
"reason": "the prompt footer hints are E.14's (P01-read-only-prompt)"
|
||||
}
|
||||
],
|
||||
"fixture": "E.19a/failed-toast/open"
|
||||
},
|
||||
{
|
||||
"event": {
|
||||
"id": "evt_started_1",
|
||||
"created": 1,
|
||||
"type": "session.execution.started",
|
||||
"durable": {
|
||||
"aggregateID": "ses_b",
|
||||
"seq": 1,
|
||||
"version": 1
|
||||
},
|
||||
"data": {
|
||||
"sessionID": "ses_b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"event": {
|
||||
"id": "evt_failed_2",
|
||||
"created": 2,
|
||||
"type": "session.execution.failed",
|
||||
"durable": {
|
||||
"aggregateID": "ses_b",
|
||||
"seq": 2,
|
||||
"version": 1
|
||||
},
|
||||
"data": {
|
||||
"sessionID": "ses_b",
|
||||
"error": {
|
||||
"type": "unknown",
|
||||
"message": "The provider returned an error."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"checkpoint": "failed",
|
||||
"until": "Session failed",
|
||||
"masks": [
|
||||
{
|
||||
"x": 60,
|
||||
"y": 28,
|
||||
"width": 40,
|
||||
"height": 1,
|
||||
"reason": "the prompt footer hints are E.14's (P01-read-only-prompt)"
|
||||
}
|
||||
],
|
||||
"fixture": "E.19a/failed-toast/failed"
|
||||
}
|
||||
],
|
||||
"requests": {
|
||||
"writes": [],
|
||||
"reads": [
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/agent",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/command",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/config",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": []
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/experimental/migration/v1",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"status": "completed"
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/experimental/session/ses_b/terminal",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/form",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/fs/list",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"<cwd>"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/info",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"version": "test",
|
||||
"pid": 0,
|
||||
"urls": [],
|
||||
"paths": {
|
||||
"tmp": "/tmp"
|
||||
},
|
||||
"capabilities": {
|
||||
"persistentPty": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/integration",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/location",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/mcp",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/mcp/resource",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"resources": [],
|
||||
"templates": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/model",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/plugin",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/project",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": []
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/provider",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/reference",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"canonical": "/tmp/opencode/packages/tui"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/session",
|
||||
"query": {
|
||||
"limit": [
|
||||
"200"
|
||||
],
|
||||
"order": [
|
||||
"desc"
|
||||
],
|
||||
"parentID": [
|
||||
"ses_b"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"data": [],
|
||||
"cursor": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/session/active",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"data": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/session/ses_b",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"data": {
|
||||
"id": "ses_b",
|
||||
"title": "Fix the parser",
|
||||
"projectID": "proj_test",
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
}
|
||||
},
|
||||
"time": {
|
||||
"created": 1,
|
||||
"updated": 1
|
||||
},
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/session/ses_b/form",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/session/ses_b/inbox",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/session/ses_b/message",
|
||||
"query": {
|
||||
"limit": [
|
||||
"20"
|
||||
],
|
||||
"order": [
|
||||
"desc"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"data": [],
|
||||
"cursor": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/session/ses_b/permission",
|
||||
"query": {},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/shell",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/skill",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/api/vcs",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"location": {
|
||||
"directory": "/tmp/opencode/packages/tui",
|
||||
"project": {
|
||||
"id": "proj_test",
|
||||
"directory": "/tmp/opencode",
|
||||
"canonical": "/tmp/opencode"
|
||||
}
|
||||
},
|
||||
"data": {
|
||||
"branch": {
|
||||
"current": "main",
|
||||
"default": "main"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "POST",
|
||||
"path": "/api/rpc/opencode.goal/get",
|
||||
"query": {
|
||||
"location[directory]": [
|
||||
"/tmp/opencode/packages/tui"
|
||||
]
|
||||
},
|
||||
"body": {
|
||||
"input": {
|
||||
"sessionID": "ses_b"
|
||||
}
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"output": null
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"width": 100,
|
||||
"height": 30,
|
||||
"rows": [
|
||||
" Fix the parser + ",
|
||||
" ┃ ┃ ",
|
||||
" Error: The provider returned an error. ┃ Session failed x ┃ ",
|
||||
" ┃ ┃ ",
|
||||
" ┃ The provider returned an error. ┃ ",
|
||||
" ┃ ┃ ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",
|
||||
" /tmp/opencode/packages/tui:main ",
|
||||
" "
|
||||
],
|
||||
"styles": [
|
||||
"#ffffffff #1e1e1eff 0",
|
||||
"#eeeeeeff #1e1e1eff 1",
|
||||
"#808080ff #0a0a0aff 0",
|
||||
"#ffffffff #0a0a0aff 0",
|
||||
"#e06c75ff #0a0a0aff 0",
|
||||
"#808080ff #1e1e1eff 0",
|
||||
"#eeeeeeff #1e1e1eff 0",
|
||||
"#484848ff #0a0a0aff 0",
|
||||
"#1e1e1eff #0a0a0aff 0",
|
||||
"#00000000 #00000000 0"
|
||||
],
|
||||
"runs": [
|
||||
[[0,3],[1,14],[0,15],[2,3],[3,65]],
|
||||
[[3,61],[4,1],[0,35],[4,1],[3,2]],
|
||||
[[3,5],[4,38],[3,18],[4,1],[0,2],[1,14],[0,16],[5,1],[0,2],[4,1],[3,2]],
|
||||
[[3,61],[4,1],[0,35],[4,1],[3,2]],
|
||||
[[3,61],[4,1],[0,2],[6,31],[0,2],[4,1],[3,2]],
|
||||
[[3,61],[4,1],[0,35],[4,1],[3,2]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,2],[7,1],[0,95],[3,2]],
|
||||
[[3,2],[7,1],[0,95],[3,2]],
|
||||
[[3,2],[7,1],[0,95],[3,2]],
|
||||
[[3,2],[7,1],[0,95],[3,2]],
|
||||
[[3,2],[7,1],[8,95],[3,2]],
|
||||
[[3,2],[2,31],[3,27],[9,40]],
|
||||
[[3,100]]
|
||||
]
|
||||
}
|
||||
77
packages/cli-rs/parity/fixtures/E.19a/failed-toast/open.json
Normal file
77
packages/cli-rs/parity/fixtures/E.19a/failed-toast/open.json
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"width": 100,
|
||||
"height": 30,
|
||||
"rows": [
|
||||
" Fix the parser + ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ┃ ",
|
||||
" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",
|
||||
" /tmp/opencode/packages/tui:main ",
|
||||
" "
|
||||
],
|
||||
"styles": [
|
||||
"#ffffffff #1e1e1eff 0",
|
||||
"#eeeeeeff #1e1e1eff 1",
|
||||
"#808080ff #0a0a0aff 0",
|
||||
"#ffffffff #0a0a0aff 0",
|
||||
"#484848ff #0a0a0aff 0",
|
||||
"#1e1e1eff #0a0a0aff 0",
|
||||
"#00000000 #00000000 0"
|
||||
],
|
||||
"runs": [
|
||||
[[0,3],[1,14],[0,15],[2,3],[3,65]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,100]],
|
||||
[[3,2],[4,1],[0,95],[3,2]],
|
||||
[[3,2],[4,1],[0,95],[3,2]],
|
||||
[[3,2],[4,1],[0,95],[3,2]],
|
||||
[[3,2],[4,1],[0,95],[3,2]],
|
||||
[[3,2],[4,1],[5,95],[3,2]],
|
||||
[[3,2],[2,31],[3,27],[6,40]],
|
||||
[[3,100]]
|
||||
]
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ import { tmpdir } from "node:os"
|
|||
import { rm } from "node:fs/promises"
|
||||
import { EmbeddedTerminalRenderable } from "@opentui/core"
|
||||
import { createTestRenderer } from "@opentui/core/testing"
|
||||
import { startFakeServer, type Options } from "../lib/fake-server"
|
||||
import { startFakeServer, type FakeServer, type Options } from "../lib/fake-server"
|
||||
import {
|
||||
buildRust,
|
||||
command,
|
||||
|
|
@ -29,11 +29,13 @@ import {
|
|||
import { requestLog } from "../cli/run"
|
||||
import { diffRecords } from "../cli/diff"
|
||||
|
||||
export type OscKind = "title" | "progress" | "clipboard" | "notify" | "other"
|
||||
export type OscKind = "title" | "progress" | "status" | "clipboard" | "notify" | "other"
|
||||
|
||||
export type PtyStep = {
|
||||
// Written to the terminal as is, for example "\x03" for Ctrl+C.
|
||||
// Written to the terminal as is, for example "\x03" for Ctrl+C, or "\x1b[O" to report a focus loss.
|
||||
keys?: string
|
||||
// Pushed to the `fallback: "tui"` event stream after the keys.
|
||||
emit?: Parameters<FakeServer["emit"]>[0][]
|
||||
// Waits until an OSC sequence or the screen matches (a string matches as a substring).
|
||||
until?: { osc?: string | RegExp; screen?: string | RegExp }
|
||||
// Waits until the screen has not changed for this long.
|
||||
|
|
@ -52,6 +54,8 @@ export type PtyCase = {
|
|||
steps: PtyStep[]
|
||||
// The OSC kinds the comparison keeps. Terminal queries (colors, pointer shape) are `other`.
|
||||
osc?: OscKind[]
|
||||
// Compare the OSC log one kind at a time, in the order of `osc`, when the order between kinds is not fixed.
|
||||
oscByKind?: boolean
|
||||
// Wait for the program to exit after the last step and record the code; otherwise it is killed.
|
||||
exits?: boolean
|
||||
// Plan 7.5: line masks for checkpoints. Each match becomes `<masked>`; say why in `reason`.
|
||||
|
|
@ -100,6 +104,7 @@ export async function runPty(side: Side, value: PtyCase) {
|
|||
const failures: string[] = []
|
||||
for (const step of value.steps) {
|
||||
if (step.keys !== undefined) proc.terminal?.write(step.keys)
|
||||
step.emit?.forEach((event) => server?.emit(event))
|
||||
const failure = await waitFor(step, { screen, osc: () => oscLog(output.text), exited })
|
||||
if (failure) {
|
||||
failures.push(failure)
|
||||
|
|
@ -122,6 +127,7 @@ export async function runPty(side: Side, value: PtyCase) {
|
|||
exit: value.exits ? (exit?.code ?? "timeout") : "killed",
|
||||
osc: oscLog(output.text)
|
||||
.filter((entry) => kinds.includes(entry.kind))
|
||||
.toSorted((a, b) => (value.oscByKind ? kinds.indexOf(a.kind) - kinds.indexOf(b.kind) : 0))
|
||||
.map((entry) => normalize(`${entry.kind} ${entry.data}`, context)),
|
||||
checkpoints: Object.fromEntries(
|
||||
Object.entries(checkpoints).map(([name, lines]) => [
|
||||
|
|
@ -150,6 +156,8 @@ function oscKind(data: string): OscKind {
|
|||
const code = data.split(";")[0]
|
||||
if (["0", "1", "2"].includes(code)) return "title"
|
||||
if (data.startsWith("9;4;")) return "progress"
|
||||
// `7501;?` asks whether the terminal has the program status protocol.
|
||||
if (code === "7501") return data === "7501;?" ? "other" : "status"
|
||||
if (code === "52") return "clipboard"
|
||||
// `99;…:p=?;` asks the terminal which kitty notification features it has.
|
||||
if (code === "99" && /[:;]p=\?/.test(data)) return "other"
|
||||
|
|
|
|||
90
packages/cli-rs/parity/scenarios/E.19a/attention.pty.ts
Normal file
90
packages/cli-rs/parity/scenarios/E.19a/attention.pty.ts
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
// Attention (N01, N03, N04, F09): `-s ses_b` opens a session with `attention.notifications` on. The steps report a
|
||||
// focus loss, then the session works, asks for a permission, gets the reply and is done; then focus returns and the
|
||||
// session fails. Compared: the OSC 7501 program status records (`context/program-status.ts`) and the notifications
|
||||
// (`attention.ts`), which go out only while the terminal is blurred. Quitting clears the root record.
|
||||
import { definePty } from "../../pty/run"
|
||||
|
||||
const config = JSON.stringify({
|
||||
experimental: { "new-designs": true },
|
||||
debug: { devtools: false },
|
||||
animations: false,
|
||||
attention: { notifications: true },
|
||||
})
|
||||
|
||||
const session = {
|
||||
id: "ses_b",
|
||||
title: "Fix the parser",
|
||||
projectID: "proj_test",
|
||||
cost: 0,
|
||||
tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
|
||||
time: { created: 1, updated: 2 },
|
||||
location: { directory: "/tmp/opencode/packages/tui" },
|
||||
}
|
||||
|
||||
const durable = (seq: number) => ({ aggregateID: "ses_b", seq, version: 1 })
|
||||
const execution = (kind: string, seq: number, data: Record<string, unknown> = {}) =>
|
||||
({
|
||||
id: `evt_${kind}_${seq}`,
|
||||
created: seq,
|
||||
type: `session.execution.${kind}`,
|
||||
durable: durable(seq),
|
||||
data: { sessionID: "ses_b", ...data },
|
||||
}) as never
|
||||
|
||||
export default definePty({
|
||||
args: ["-s", "ses_b"],
|
||||
cols: 100,
|
||||
rows: 30,
|
||||
env: { OPENCODE_CLI_CONFIG_CONTENT: config },
|
||||
server: {
|
||||
fallback: "tui",
|
||||
routes: [
|
||||
{ path: "/api/session/ses_b", json: { data: session } },
|
||||
{ path: "/api/session/ses_b/message", json: { data: [], cursor: {} } },
|
||||
{ path: "/api/session/ses_b/inbox", json: { data: [] } },
|
||||
],
|
||||
},
|
||||
steps: [
|
||||
{ until: { screen: "Fix the parser" }, settle: 500, timeout: 30_000 },
|
||||
// Focus out.
|
||||
{ keys: "\x1b[O", settle: 200 },
|
||||
{ emit: [execution("started", 1)], until: { osc: "state=working" }, settle: 300 },
|
||||
{
|
||||
emit: [
|
||||
{
|
||||
id: "evt_asked",
|
||||
created: 2,
|
||||
type: "permission.asked",
|
||||
data: { id: "per_1", sessionID: "ses_b", action: "edit", resources: [], metadata: {}, save: [] },
|
||||
} as never,
|
||||
],
|
||||
until: { osc: "state=blocked" },
|
||||
settle: 300,
|
||||
},
|
||||
{
|
||||
emit: [
|
||||
{
|
||||
id: "evt_replied",
|
||||
created: 3,
|
||||
type: "permission.replied",
|
||||
data: { sessionID: "ses_b", requestID: "per_1", reply: "once" },
|
||||
} as never,
|
||||
],
|
||||
settle: 300,
|
||||
},
|
||||
{ emit: [execution("succeeded", 4)], until: { osc: "state=idle" }, settle: 300 },
|
||||
// Focus in: the failure toasts but does not notify.
|
||||
{ keys: "\x1b[I", settle: 200 },
|
||||
{
|
||||
emit: [execution("started", 5), execution("failed", 6, { error: { type: "unknown", message: "boom" } })],
|
||||
until: { screen: "Session failed" },
|
||||
settle: 300,
|
||||
},
|
||||
{ keys: "\x03", settle: 300 },
|
||||
{ keys: "\x03" },
|
||||
],
|
||||
osc: ["status", "notify"],
|
||||
// Deviation N03-status-order: the order between a notification and a status record is not fixed in Rust.
|
||||
oscByKind: true,
|
||||
exits: true,
|
||||
})
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
// A failed execution of a session that is not open shows the error toast with an "Open" action (F09, the plugin
|
||||
// toast's `sessionID`), here on home.
|
||||
import { defineApp } from "../../lib/app"
|
||||
|
||||
// As in `E.1/mcp-toast.app.ts`: the home prompt and footer rows other steps own.
|
||||
const masks = [
|
||||
{
|
||||
x: 16,
|
||||
y: 16,
|
||||
width: 84,
|
||||
height: 1,
|
||||
reason: "the placeholder: random in TS, not drawn yet in Rust (T17-home-prompt)",
|
||||
},
|
||||
{ x: 50, y: 20, width: 50, height: 1, reason: "the prompt footer hints are E.14's (P01-read-only-prompt)" },
|
||||
{ x: 0, y: 28, width: 30, height: 1, reason: "the home footer's MCP count is E.14's (F01-home-footer-counts)" },
|
||||
]
|
||||
|
||||
export default defineApp({
|
||||
config: { experimental: { "new-designs": true } },
|
||||
steps: [
|
||||
{ checkpoint: "home", until: "Ask anything", masks },
|
||||
{
|
||||
event: {
|
||||
id: "evt_failed",
|
||||
created: 1,
|
||||
type: "session.execution.failed",
|
||||
durable: { aggregateID: "ses_c", seq: 1, version: 1 },
|
||||
data: { sessionID: "ses_c", error: { type: "unknown", message: "Plugin failed during skill.transform." } },
|
||||
},
|
||||
},
|
||||
{ checkpoint: "failed", until: "Session failed", masks },
|
||||
],
|
||||
})
|
||||
35
packages/cli-rs/parity/scenarios/E.19a/failed-toast.app.ts
Normal file
35
packages/cli-rs/parity/scenarios/E.19a/failed-toast.app.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// A failed execution of the open session shows the notifications plugin's error toast (F09): "Session failed" and
|
||||
// the error message, without an action, since the session is already open.
|
||||
import { defineApp, session } from "../../lib/app"
|
||||
|
||||
const execution = (kind: string, seq: number, data: Record<string, unknown> = {}) => ({
|
||||
id: `evt_${kind}_${seq}`,
|
||||
created: seq,
|
||||
type: `session.execution.${kind}`,
|
||||
durable: { aggregateID: "ses_b", seq, version: 1 },
|
||||
data: { sessionID: "ses_b", ...data },
|
||||
})
|
||||
|
||||
const footer = {
|
||||
x: 60,
|
||||
y: 28,
|
||||
width: 40,
|
||||
height: 1,
|
||||
reason: "the prompt footer hints are E.14's (P01-read-only-prompt)",
|
||||
}
|
||||
|
||||
export default defineApp({
|
||||
config: { experimental: { "new-designs": true } },
|
||||
args: { sessionID: "ses_b" },
|
||||
routes: [
|
||||
{ path: "/api/session/ses_b", json: { data: session("ses_b", "Fix the parser") } },
|
||||
{ path: "/api/session/ses_b/message", json: { data: [], cursor: {} } },
|
||||
{ path: "/api/session/ses_b/inbox", json: { data: [] } },
|
||||
],
|
||||
steps: [
|
||||
{ checkpoint: "open", until: "Fix the parser", masks: [footer] },
|
||||
{ event: execution("started", 1) },
|
||||
{ event: execution("failed", 2, { error: { type: "unknown", message: "The provider returned an error." } }) },
|
||||
{ checkpoint: "failed", until: "Session failed", masks: [footer] },
|
||||
],
|
||||
})
|
||||
Loading…
Add table
Reference in a new issue