repoburg 1.3.201 → 1.3.204
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-pane/backend/dist/index.js +2714 -32395
- package/agent-pane/backend/dist/server.js +45304 -0
- package/askuser-after-step5-postgres-selected.png +0 -0
- package/askuser-after-step7-answer-sent.png +0 -0
- package/askuser-card-visible.png +0 -0
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.d.ts +16 -0
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js +87 -0
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js.map +1 -1
- package/backend/dist/src/agent-runtime/agent-runtime.types.d.ts +16 -1
- package/backend/dist/src/app.controller.d.ts +1 -0
- package/backend/dist/src/app.service.d.ts +1 -0
- package/backend/dist/src/app.service.js +4 -1
- package/backend/dist/src/app.service.js.map +1 -1
- package/backend/dist/src/interactive-chat/chat.service.d.ts +4 -0
- package/backend/dist/src/interactive-chat/chat.service.js +21 -1
- package/backend/dist/src/interactive-chat/chat.service.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/invoke-subagent.handler.js +12 -1
- package/backend/dist/src/llm-orchestration/action-handlers/invoke-subagent.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.d.ts +1 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.js +1 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.js.map +1 -1
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js +2 -0
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js.map +1 -1
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/daemon/dist/agentPane.js +128 -0
- package/daemon/dist/agentPane.spec.js +183 -0
- package/daemon/dist/api/services.js +4 -0
- package/daemon/dist/index.js +28 -8
- package/daemon/dist/serviceManager.js +30 -11
- package/daemon/dist/serviceManager.spec.js +26 -0
- package/daemon/dist/workspace-validation.js +63 -0
- package/daemon/dist/workspace-validation.spec.js +63 -0
- package/daemon/package.json +1 -1
- package/package.json +15 -2
- package/r2-step4-apple-banana.png +0 -0
- package/r2-step5-after-rewind-apple-last.png +0 -0
- package/r2-step7-apple-cherry.png +0 -0
- package/r2-step8-cherry-menu-no-restore.png +0 -0
- package/r3-step3-live-task-card-running.png +0 -0
- package/r3-step4-after-completion.png +0 -0
- package/r3-step5-persistence-after-reload.png +0 -0
- package/r3-step6-tasks-tab-card.png +0 -0
- package/reverify-answered-state-answer-sent.png +0 -0
- package/reverify-card-visible-after-completion.png +0 -0
- package/rewind-step3-apple-banana-turns.png +0 -0
- package/rewind-step5-ui-unchanged-after-confirmed-rewind.png +0 -0
- package/rewind-step6-apple-menu-no-restore.png +0 -0
- package/rewind-step7-final-turnlist-unchanged.png +0 -0
- package/rewind-step7-negative-error-toast.png +0 -0
- package/rewind-step7-negative-error-toast2.png +0 -0
- package/subagent-r2-step5-turn-after-reload-no-card.png +0 -0
- package/subagent-r2-step6-tasks-panel-card.png +0 -0
- package/subagent-step3-tasks-tab-done-card.png +0 -0
- package/subagent-step4-turn-stuck-no-cards.png +0 -0
- package/agent-pane/.prettierignore +0 -5
- package/agent-pane/.prettierrc +0 -8
- package/agent-pane/backend/coverage/base.css +0 -224
- package/agent-pane/backend/coverage/block-navigation.js +0 -87
- package/agent-pane/backend/coverage/clover.xml +0 -887
- package/agent-pane/backend/coverage/coverage-final.json +0 -10
- package/agent-pane/backend/coverage/favicon.png +0 -0
- package/agent-pane/backend/coverage/index.html +0 -176
- package/agent-pane/backend/coverage/prettify.css +0 -1
- package/agent-pane/backend/coverage/prettify.js +0 -2
- package/agent-pane/backend/coverage/sort-arrow-sprite.png +0 -0
- package/agent-pane/backend/coverage/sorter.js +0 -210
- package/agent-pane/backend/coverage/src/codex/codex-provider.ts.html +0 -1402
- package/agent-pane/backend/coverage/src/codex/index.html +0 -131
- package/agent-pane/backend/coverage/src/codex/item-mapper.ts.html +0 -331
- package/agent-pane/backend/coverage/src/db/index.html +0 -131
- package/agent-pane/backend/coverage/src/db/index.ts.html +0 -436
- package/agent-pane/backend/coverage/src/db/schema.ts.html +0 -175
- package/agent-pane/backend/coverage/src/index.html +0 -116
- package/agent-pane/backend/coverage/src/index.ts.html +0 -262
- package/agent-pane/backend/coverage/src/routes/index.html +0 -146
- package/agent-pane/backend/coverage/src/routes/sessions.ts.html +0 -991
- package/agent-pane/backend/coverage/src/routes/turns.ts.html +0 -256
- package/agent-pane/backend/coverage/src/routes/workspaces.ts.html +0 -406
- package/agent-pane/backend/coverage/src/ws/index.html +0 -116
- package/agent-pane/backend/coverage/src/ws/index.ts.html +0 -238
- package/agent-pane/backend/data.db +0 -0
- package/agent-pane/backend/data.db-shm +0 -0
- package/agent-pane/backend/data.db-wal +0 -0
- package/agent-pane/backend/package-lock.json +0 -5945
- package/agent-pane/backend/package.json +0 -33
- package/agent-pane/backend/scripts/backfill-from-jsonl.ts +0 -206
- package/agent-pane/backend/scripts/import-session-from-jsonl.ts +0 -264
- package/agent-pane/backend/src/claude/claude-message-mapper.test.ts +0 -271
- package/agent-pane/backend/src/claude/claude-message-mapper.ts +0 -259
- package/agent-pane/backend/src/claude/claude-provider.test.ts +0 -455
- package/agent-pane/backend/src/claude/claude-provider.ts +0 -1319
- package/agent-pane/backend/src/claude/claude-types.ts +0 -45
- package/agent-pane/backend/src/codex/app-server-client.test.ts +0 -183
- package/agent-pane/backend/src/codex/app-server-client.ts +0 -247
- package/agent-pane/backend/src/codex/app-server-types.ts +0 -259
- package/agent-pane/backend/src/codex/codex-provider-runtime-config.test.ts +0 -56
- package/agent-pane/backend/src/codex/codex-provider.test.ts +0 -60
- package/agent-pane/backend/src/codex/codex-provider.ts +0 -619
- package/agent-pane/backend/src/codex/item-mapper.test.ts +0 -221
- package/agent-pane/backend/src/codex/item-mapper.ts +0 -86
- package/agent-pane/backend/src/codex/shared-app-server.ts +0 -25
- package/agent-pane/backend/src/db/index.test.ts +0 -125
- package/agent-pane/backend/src/db/index.ts +0 -230
- package/agent-pane/backend/src/db/schema.ts +0 -34
- package/agent-pane/backend/src/index.ts +0 -89
- package/agent-pane/backend/src/integration/__fixtures__/cancel-turn.json +0 -29
- package/agent-pane/backend/src/integration/__fixtures__/delta-streaming.json +0 -40
- package/agent-pane/backend/src/integration/__fixtures__/failed-turn.json +0 -16
- package/agent-pane/backend/src/integration/__fixtures__/mcp-tool-call.json +0 -60
- package/agent-pane/backend/src/integration/__fixtures__/missing-item-started.json +0 -34
- package/agent-pane/backend/src/integration/__fixtures__/multi-item-turn.json +0 -85
- package/agent-pane/backend/src/integration/__fixtures__/multi-turn.json +0 -48
- package/agent-pane/backend/src/integration/__fixtures__/simple-turn.json +0 -35
- package/agent-pane/backend/src/integration/delta-streaming.test.ts +0 -130
- package/agent-pane/backend/src/integration/helpers/app-server-mock.ts +0 -272
- package/agent-pane/backend/src/integration/helpers/test-app.ts +0 -110
- package/agent-pane/backend/src/integration/helpers/ws-capture.ts +0 -64
- package/agent-pane/backend/src/integration/item-lifecycle.test.ts +0 -133
- package/agent-pane/backend/src/integration/mcp-tool-call.test.ts +0 -102
- package/agent-pane/backend/src/integration/missing-item-started.test.ts +0 -91
- package/agent-pane/backend/src/integration/multi-turn.test.ts +0 -121
- package/agent-pane/backend/src/integration/session-operations.test.ts +0 -175
- package/agent-pane/backend/src/integration/threads-claude-fork.test.ts +0 -241
- package/agent-pane/backend/src/integration/threads.test.ts +0 -309
- package/agent-pane/backend/src/integration/title-generation.test.ts +0 -109
- package/agent-pane/backend/src/integration/turn-cancel.test.ts +0 -111
- package/agent-pane/backend/src/integration/turn-failure.test.ts +0 -97
- package/agent-pane/backend/src/integration/turn-lifecycle.test.ts +0 -141
- package/agent-pane/backend/src/providers/index.ts +0 -16
- package/agent-pane/backend/src/providers/registry.test.ts +0 -92
- package/agent-pane/backend/src/providers/registry.ts +0 -43
- package/agent-pane/backend/src/providers/runtime-provider.ts +0 -43
- package/agent-pane/backend/src/repoburg/action-mapping.ts +0 -216
- package/agent-pane/backend/src/repoburg/agent-runtime-client.test.ts +0 -271
- package/agent-pane/backend/src/repoburg/agent-runtime-client.ts +0 -262
- package/agent-pane/backend/src/repoburg/backend-resolver.test.ts +0 -271
- package/agent-pane/backend/src/repoburg/backend-resolver.ts +0 -246
- package/agent-pane/backend/src/repoburg/repoburg-client.test.ts +0 -159
- package/agent-pane/backend/src/repoburg/repoburg-client.ts +0 -181
- package/agent-pane/backend/src/repoburg/repoburg-provider.test.ts +0 -723
- package/agent-pane/backend/src/repoburg/repoburg-provider.ts +0 -422
- package/agent-pane/backend/src/repoburg/turn-projector.test.ts +0 -475
- package/agent-pane/backend/src/repoburg/turn-projector.ts +0 -537
- package/agent-pane/backend/src/routes/files.ts +0 -31
- package/agent-pane/backend/src/routes/mcp.ts +0 -33
- package/agent-pane/backend/src/routes/models.test.ts +0 -92
- package/agent-pane/backend/src/routes/models.ts +0 -16
- package/agent-pane/backend/src/routes/plugins.ts +0 -40
- package/agent-pane/backend/src/routes/providers.test.ts +0 -86
- package/agent-pane/backend/src/routes/providers.ts +0 -86
- package/agent-pane/backend/src/routes/sessions.test.ts +0 -558
- package/agent-pane/backend/src/routes/sessions.ts +0 -504
- package/agent-pane/backend/src/routes/skills.test.ts +0 -114
- package/agent-pane/backend/src/routes/skills.ts +0 -70
- package/agent-pane/backend/src/routes/threads.ts +0 -323
- package/agent-pane/backend/src/routes/turns.test.ts +0 -196
- package/agent-pane/backend/src/routes/turns.ts +0 -103
- package/agent-pane/backend/src/routes/workspaces.test.ts +0 -197
- package/agent-pane/backend/src/routes/workspaces.ts +0 -128
- package/agent-pane/backend/src/ws/index.test.ts +0 -107
- package/agent-pane/backend/src/ws/index.ts +0 -51
- package/agent-pane/backend/tsconfig.json +0 -25
- package/agent-pane/backend/vitest.config.ts +0 -20
- package/agent-pane/eslint.config.js +0 -33
- package/agent-pane/frontend/coverage/base.css +0 -224
- package/agent-pane/frontend/coverage/block-navigation.js +0 -87
- package/agent-pane/frontend/coverage/clover.xml +0 -2962
- package/agent-pane/frontend/coverage/coverage-final.json +0 -37
- package/agent-pane/frontend/coverage/favicon.png +0 -0
- package/agent-pane/frontend/coverage/index.html +0 -251
- package/agent-pane/frontend/coverage/prettify.css +0 -1
- package/agent-pane/frontend/coverage/prettify.js +0 -2
- package/agent-pane/frontend/coverage/sort-arrow-sprite.png +0 -0
- package/agent-pane/frontend/coverage/sorter.js +0 -210
- package/agent-pane/frontend/coverage/src/App.tsx.html +0 -217
- package/agent-pane/frontend/coverage/src/AppInitializer.tsx.html +0 -223
- package/agent-pane/frontend/coverage/src/api/client.ts.html +0 -187
- package/agent-pane/frontend/coverage/src/api/index.html +0 -161
- package/agent-pane/frontend/coverage/src/api/sessions.ts.html +0 -316
- package/agent-pane/frontend/coverage/src/api/websocket.ts.html +0 -544
- package/agent-pane/frontend/coverage/src/api/workspaces.ts.html +0 -199
- package/agent-pane/frontend/coverage/src/components/CollapsibleToolCalls.tsx.html +0 -226
- package/agent-pane/frontend/coverage/src/components/CommandInputBar.tsx.html +0 -382
- package/agent-pane/frontend/coverage/src/components/CommandPalette.tsx.html +0 -715
- package/agent-pane/frontend/coverage/src/components/IdeWorkspace.tsx.html +0 -160
- package/agent-pane/frontend/coverage/src/components/ModelSelector.tsx.html +0 -478
- package/agent-pane/frontend/coverage/src/components/NewSessionDialog.tsx.html +0 -472
- package/agent-pane/frontend/coverage/src/components/RenderArea.tsx.html +0 -574
- package/agent-pane/frontend/coverage/src/components/RightPanel.tsx.html +0 -205
- package/agent-pane/frontend/coverage/src/components/RuntimeIcon.tsx.html +0 -133
- package/agent-pane/frontend/coverage/src/components/SessionTabs.tsx.html +0 -217
- package/agent-pane/frontend/coverage/src/components/StatusBar.tsx.html +0 -271
- package/agent-pane/frontend/coverage/src/components/StatusDot.tsx.html +0 -109
- package/agent-pane/frontend/coverage/src/components/Toast.tsx.html +0 -313
- package/agent-pane/frontend/coverage/src/components/TurnContent.tsx.html +0 -1216
- package/agent-pane/frontend/coverage/src/components/WorkspaceSidebar.tsx.html +0 -1138
- package/agent-pane/frontend/coverage/src/components/index.html +0 -326
- package/agent-pane/frontend/coverage/src/components/panels/ChangesPanel.tsx.html +0 -247
- package/agent-pane/frontend/coverage/src/components/panels/LogsPanel.tsx.html +0 -160
- package/agent-pane/frontend/coverage/src/components/panels/MetricsPanel.tsx.html +0 -427
- package/agent-pane/frontend/coverage/src/components/panels/TurnsPanel.tsx.html +0 -397
- package/agent-pane/frontend/coverage/src/components/panels/index.html +0 -161
- package/agent-pane/frontend/coverage/src/constants/index.html +0 -116
- package/agent-pane/frontend/coverage/src/constants/models.ts.html +0 -406
- package/agent-pane/frontend/coverage/src/hooks/index.html +0 -146
- package/agent-pane/frontend/coverage/src/hooks/useEscapeKey.ts.html +0 -124
- package/agent-pane/frontend/coverage/src/hooks/useOutsideClick.ts.html +0 -142
- package/agent-pane/frontend/coverage/src/hooks/useSessionStatus.ts.html +0 -187
- package/agent-pane/frontend/coverage/src/index.html +0 -146
- package/agent-pane/frontend/coverage/src/main.tsx.html +0 -115
- package/agent-pane/frontend/coverage/src/store/index.html +0 -116
- package/agent-pane/frontend/coverage/src/store/store.ts.html +0 -2404
- package/agent-pane/frontend/coverage/src/test/component-helpers.ts.html +0 -190
- package/agent-pane/frontend/coverage/src/test/fixtures.ts.html +0 -367
- package/agent-pane/frontend/coverage/src/test/index.html +0 -131
- package/agent-pane/frontend/coverage/src/types/index.html +0 -116
- package/agent-pane/frontend/coverage/src/types/index.ts.html +0 -466
- package/agent-pane/frontend/coverage/src/utils/changes.ts.html +0 -202
- package/agent-pane/frontend/coverage/src/utils/duration.ts.html +0 -127
- package/agent-pane/frontend/coverage/src/utils/index.html +0 -131
- package/agent-pane/frontend/dist/assets/index-34WaZYsW.css +0 -1
- package/agent-pane/frontend/dist/assets/index-y7xlT86e.js +0 -362
- package/agent-pane/frontend/dist/index.html +0 -19
- package/agent-pane/frontend/index.html +0 -18
- package/agent-pane/frontend/package-lock.json +0 -4211
- package/agent-pane/frontend/package.json +0 -35
- package/agent-pane/frontend/src/App.test.tsx +0 -74
- package/agent-pane/frontend/src/App.tsx +0 -44
- package/agent-pane/frontend/src/AppInitializer.test.tsx +0 -142
- package/agent-pane/frontend/src/AppInitializer.tsx +0 -46
- package/agent-pane/frontend/src/__tests__/ThreadsPanel.test.tsx +0 -192
- package/agent-pane/frontend/src/api/client.test.ts +0 -126
- package/agent-pane/frontend/src/api/client.ts +0 -34
- package/agent-pane/frontend/src/api/models.ts +0 -7
- package/agent-pane/frontend/src/api/providers.ts +0 -17
- package/agent-pane/frontend/src/api/sessions.test.ts +0 -245
- package/agent-pane/frontend/src/api/sessions.ts +0 -97
- package/agent-pane/frontend/src/api/skills.ts +0 -12
- package/agent-pane/frontend/src/api/websocket.test.ts +0 -288
- package/agent-pane/frontend/src/api/websocket.ts +0 -238
- package/agent-pane/frontend/src/api/workspaces.test.ts +0 -112
- package/agent-pane/frontend/src/api/workspaces.ts +0 -38
- package/agent-pane/frontend/src/components/CollapsibleToolCalls.test.tsx +0 -49
- package/agent-pane/frontend/src/components/CollapsibleToolCalls.tsx +0 -56
- package/agent-pane/frontend/src/components/CommandInputBar.test.tsx +0 -133
- package/agent-pane/frontend/src/components/CommandInputBar.tsx +0 -584
- package/agent-pane/frontend/src/components/CommandPalette.test.tsx +0 -226
- package/agent-pane/frontend/src/components/CommandPalette.tsx +0 -194
- package/agent-pane/frontend/src/components/CommentableText.test.tsx +0 -196
- package/agent-pane/frontend/src/components/CommentableText.tsx +0 -379
- package/agent-pane/frontend/src/components/IdeWorkspace.test.tsx +0 -39
- package/agent-pane/frontend/src/components/IdeWorkspace.tsx +0 -51
- package/agent-pane/frontend/src/components/ModelSelector.test.tsx +0 -129
- package/agent-pane/frontend/src/components/ModelSelector.tsx +0 -191
- package/agent-pane/frontend/src/components/NewSessionDialog.test.tsx +0 -95
- package/agent-pane/frontend/src/components/NewSessionDialog.tsx +0 -129
- package/agent-pane/frontend/src/components/RenderArea.test.tsx +0 -160
- package/agent-pane/frontend/src/components/RenderArea.tsx +0 -170
- package/agent-pane/frontend/src/components/ResizeHandle.tsx +0 -29
- package/agent-pane/frontend/src/components/RightPanel.test.tsx +0 -43
- package/agent-pane/frontend/src/components/RightPanel.tsx +0 -46
- package/agent-pane/frontend/src/components/RuntimeIcon.test.tsx +0 -32
- package/agent-pane/frontend/src/components/RuntimeIcon.tsx +0 -16
- package/agent-pane/frontend/src/components/SessionTabs.test.tsx +0 -72
- package/agent-pane/frontend/src/components/SessionTabs.tsx +0 -49
- package/agent-pane/frontend/src/components/StatusBar.test.tsx +0 -56
- package/agent-pane/frontend/src/components/StatusBar.tsx +0 -129
- package/agent-pane/frontend/src/components/StatusDot.test.tsx +0 -25
- package/agent-pane/frontend/src/components/StatusDot.tsx +0 -8
- package/agent-pane/frontend/src/components/Toast.test.tsx +0 -79
- package/agent-pane/frontend/src/components/Toast.tsx +0 -76
- package/agent-pane/frontend/src/components/TurnContent.test.tsx +0 -298
- package/agent-pane/frontend/src/components/TurnContent.tsx +0 -548
- package/agent-pane/frontend/src/components/WorkspaceSidebar.test.tsx +0 -297
- package/agent-pane/frontend/src/components/WorkspaceSidebar.tsx +0 -351
- package/agent-pane/frontend/src/components/input/OptionSubPopup.tsx +0 -32
- package/agent-pane/frontend/src/components/input/SkillMentionPopup.test.tsx +0 -63
- package/agent-pane/frontend/src/components/input/SkillMentionPopup.tsx +0 -78
- package/agent-pane/frontend/src/components/input/SlashPopup.test.tsx +0 -96
- package/agent-pane/frontend/src/components/input/SlashPopup.tsx +0 -82
- package/agent-pane/frontend/src/components/panels/ChangesPanel.test.tsx +0 -61
- package/agent-pane/frontend/src/components/panels/ChangesPanel.tsx +0 -54
- package/agent-pane/frontend/src/components/panels/TasksPanel.test.tsx +0 -97
- package/agent-pane/frontend/src/components/panels/TasksPanel.tsx +0 -208
- package/agent-pane/frontend/src/components/panels/ThreadsPanel.tsx +0 -382
- package/agent-pane/frontend/src/components/panels/TurnsPanel.test.tsx +0 -83
- package/agent-pane/frontend/src/components/panels/TurnsPanel.tsx +0 -126
- package/agent-pane/frontend/src/constants/models.test.ts +0 -97
- package/agent-pane/frontend/src/constants/models.ts +0 -166
- package/agent-pane/frontend/src/hooks/useEscapeKey.test.ts +0 -42
- package/agent-pane/frontend/src/hooks/useEscapeKey.ts +0 -13
- package/agent-pane/frontend/src/hooks/useOutsideClick.test.ts +0 -92
- package/agent-pane/frontend/src/hooks/useOutsideClick.ts +0 -19
- package/agent-pane/frontend/src/hooks/useProvider.ts +0 -44
- package/agent-pane/frontend/src/hooks/useResizable.test.ts +0 -97
- package/agent-pane/frontend/src/hooks/useResizable.ts +0 -75
- package/agent-pane/frontend/src/hooks/useSessionStatus.test.ts +0 -116
- package/agent-pane/frontend/src/hooks/useSessionStatus.ts +0 -34
- package/agent-pane/frontend/src/main.test.tsx +0 -37
- package/agent-pane/frontend/src/main.tsx +0 -10
- package/agent-pane/frontend/src/store/sessionSlice.ts +0 -440
- package/agent-pane/frontend/src/store/store.test.ts +0 -1319
- package/agent-pane/frontend/src/store/store.ts +0 -37
- package/agent-pane/frontend/src/store/threadSlice.ts +0 -136
- package/agent-pane/frontend/src/store/uiSlice.ts +0 -133
- package/agent-pane/frontend/src/store/workspaceSlice.ts +0 -77
- package/agent-pane/frontend/src/store/wsSlice.ts +0 -361
- package/agent-pane/frontend/src/styles/app.css +0 -611
- package/agent-pane/frontend/src/styles/tokens.css +0 -62
- package/agent-pane/frontend/src/test/component-helpers.ts +0 -38
- package/agent-pane/frontend/src/test/fixtures.ts +0 -100
- package/agent-pane/frontend/src/test-setup.ts +0 -5
- package/agent-pane/frontend/src/types/index.test.ts +0 -128
- package/agent-pane/frontend/src/types/index.ts +0 -132
- package/agent-pane/frontend/src/utils/changes.test.ts +0 -81
- package/agent-pane/frontend/src/utils/changes.ts +0 -39
- package/agent-pane/frontend/src/utils/duration.test.ts +0 -75
- package/agent-pane/frontend/src/utils/duration.ts +0 -14
- package/agent-pane/frontend/tsconfig.json +0 -25
- package/agent-pane/frontend/vite.config.ts +0 -22
- package/agent-pane/frontend/vitest.config.ts +0 -29
- package/agent-pane/package-lock.json +0 -1527
- package/agent-pane/package.json +0 -19
- package/agent-pane/shared/provider-types.ts +0 -67
- package/agent-pane/shared/types.ts +0 -167
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Database schema — TypeScript interfaces.
|
|
2
|
-
// Core types are imported from @agentpane/shared and re-exported.
|
|
3
|
-
// This file adds DB-specific aliases (TurnBase = Turn without items).
|
|
4
|
-
|
|
5
|
-
import type {
|
|
6
|
-
SessionStatus,
|
|
7
|
-
TurnStatus,
|
|
8
|
-
ItemType,
|
|
9
|
-
ItemStatus,
|
|
10
|
-
Session,
|
|
11
|
-
Turn,
|
|
12
|
-
TokenUsage,
|
|
13
|
-
Item,
|
|
14
|
-
Workspace,
|
|
15
|
-
SessionDetail,
|
|
16
|
-
DiscussionThread,
|
|
17
|
-
Attachment,
|
|
18
|
-
} from '@agentpane/shared';
|
|
19
|
-
|
|
20
|
-
// Re-export shared types for backward compatibility with existing imports.
|
|
21
|
-
export type {
|
|
22
|
-
SessionStatus,
|
|
23
|
-
TurnStatus,
|
|
24
|
-
ItemType,
|
|
25
|
-
ItemStatus,
|
|
26
|
-
Session,
|
|
27
|
-
Turn,
|
|
28
|
-
TokenUsage,
|
|
29
|
-
Item,
|
|
30
|
-
Workspace,
|
|
31
|
-
SessionDetail,
|
|
32
|
-
DiscussionThread,
|
|
33
|
-
Attachment,
|
|
34
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import Fastify from 'fastify';
|
|
2
|
-
import cors from '@fastify/cors';
|
|
3
|
-
import type { IncomingMessage } from 'node:http';
|
|
4
|
-
import type { Duplex } from 'node:stream';
|
|
5
|
-
import { initDb } from './db/index.ts';
|
|
6
|
-
import { initWs, handleUpgrade, getWss } from './ws/index.ts';
|
|
7
|
-
import { registerSessionRoutes } from './routes/sessions.ts';
|
|
8
|
-
import { registerTurnRoutes } from './routes/turns.ts';
|
|
9
|
-
import { registerThreadRoutes } from './routes/threads.ts';
|
|
10
|
-
import { registerWorkspaceRoutes } from './routes/workspaces.ts';
|
|
11
|
-
import { registerProviderRoutes } from './routes/providers.ts';
|
|
12
|
-
import { registerModelRoutes } from './routes/models.ts';
|
|
13
|
-
import { registerSkillRoutes } from './routes/skills.ts';
|
|
14
|
-
import { registerPluginRoutes } from './routes/plugins.ts';
|
|
15
|
-
import { registerMcpRoutes } from './routes/mcp.ts';
|
|
16
|
-
import { registerFileRoutes } from './routes/files.ts';
|
|
17
|
-
import './providers/index.ts';
|
|
18
|
-
import { shutdownAllProviders } from './providers/registry.ts';
|
|
19
|
-
|
|
20
|
-
const PORT = 3003;
|
|
21
|
-
|
|
22
|
-
async function main(): Promise<void> {
|
|
23
|
-
// Initialize database
|
|
24
|
-
initDb('data.db');
|
|
25
|
-
|
|
26
|
-
// Create Fastify server.
|
|
27
|
-
// bodyLimit: default is 1 MiB, which rejects image attachments (sent as base64
|
|
28
|
-
// in JSON) larger than ~780 KB with 413 Payload Too Large. 50 MB covers the
|
|
29
|
-
// largest payloads Claude accepts (Anthropic: ~32 MB max request, 5 MB/image).
|
|
30
|
-
const fastify = Fastify({ logger: true, bodyLimit: 50 * 1024 * 1024 });
|
|
31
|
-
|
|
32
|
-
// Register CORS (allow Vite dev server)
|
|
33
|
-
await fastify.register(cors, { origin: true });
|
|
34
|
-
|
|
35
|
-
// Register routes
|
|
36
|
-
await registerSessionRoutes(fastify);
|
|
37
|
-
await registerTurnRoutes(fastify);
|
|
38
|
-
await registerThreadRoutes(fastify);
|
|
39
|
-
await registerWorkspaceRoutes(fastify);
|
|
40
|
-
await registerProviderRoutes(fastify);
|
|
41
|
-
await registerModelRoutes(fastify);
|
|
42
|
-
await registerSkillRoutes(fastify);
|
|
43
|
-
await registerPluginRoutes(fastify);
|
|
44
|
-
await registerMcpRoutes(fastify);
|
|
45
|
-
await registerFileRoutes(fastify);
|
|
46
|
-
|
|
47
|
-
// Initialize WebSocket server (noServer mode)
|
|
48
|
-
const wss = initWs();
|
|
49
|
-
|
|
50
|
-
// Handle HTTP upgrade for /ws path
|
|
51
|
-
fastify.server.on('upgrade', (req: IncomingMessage, socket: Duplex, head: Buffer) => {
|
|
52
|
-
const wsServer = getWss();
|
|
53
|
-
if (wsServer) {
|
|
54
|
-
handleUpgrade(wsServer, req, socket, head);
|
|
55
|
-
} else {
|
|
56
|
-
socket.destroy();
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
wss.on('connection', (ws) => {
|
|
61
|
-
fastify.log.info('WebSocket client connected');
|
|
62
|
-
ws.on('close', () => {
|
|
63
|
-
fastify.log.info('WebSocket client disconnected');
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Start server
|
|
68
|
-
try {
|
|
69
|
-
await fastify.listen({ port: PORT, host: '0.0.0.0' });
|
|
70
|
-
fastify.log.info(`AgentPane backend running on http://localhost:${PORT}`);
|
|
71
|
-
fastify.log.info(`WebSocket endpoint: ws://localhost:${PORT}/ws`);
|
|
72
|
-
} catch (err) {
|
|
73
|
-
fastify.log.error(err);
|
|
74
|
-
process.exit(1);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Graceful shutdown on SIGTERM / SIGINT
|
|
78
|
-
async function gracefulShutdown(signal: string): Promise<void> {
|
|
79
|
-
fastify.log.info(`Received ${signal}, shutting down...`);
|
|
80
|
-
await shutdownAllProviders();
|
|
81
|
-
await fastify.close();
|
|
82
|
-
process.exit(0);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
|
|
86
|
-
process.on('SIGINT', () => gracefulShutdown('SIGINT'));
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
main();
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cancel-turn",
|
|
3
|
-
"description": "Turn that gets interrupted by abort signal — events stop mid-stream",
|
|
4
|
-
"threadId": "thread_fix_004",
|
|
5
|
-
"runStreamedCalls": [
|
|
6
|
-
{
|
|
7
|
-
"prompt": "Write a long essay about history",
|
|
8
|
-
"eventDelay": 200,
|
|
9
|
-
"events": [
|
|
10
|
-
{ "type": "thread.started", "thread_id": "thread_fix_004" },
|
|
11
|
-
{ "type": "item.started", "item": { "id": "item_1", "type": "agent_message", "text": "" } },
|
|
12
|
-
{ "type": "item.updated", "item": { "id": "item_1", "type": "agent_message", "text": "The history of" } },
|
|
13
|
-
{
|
|
14
|
-
"type": "item.updated",
|
|
15
|
-
"item": { "id": "item_1", "type": "agent_message", "text": "The history of the world" }
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"type": "item.updated",
|
|
19
|
-
"item": { "id": "item_1", "type": "agent_message", "text": "The history of the world is vast" }
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"type": "item.updated",
|
|
23
|
-
"item": { "id": "item_1", "type": "agent_message", "text": "The history of the world is vast and complex" }
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"runCalls": []
|
|
29
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "delta-streaming",
|
|
3
|
-
"description": "Agent message with delta streaming + token usage notification",
|
|
4
|
-
"threadId": "thread_delta_001",
|
|
5
|
-
"runStreamedCalls": [
|
|
6
|
-
{
|
|
7
|
-
"prompt": "Say hello",
|
|
8
|
-
"events": [
|
|
9
|
-
{ "type": "thread.started", "thread_id": "thread_delta_001" },
|
|
10
|
-
{ "type": "item.started", "item": { "id": "msg_001", "type": "agentMessage", "text": "" } },
|
|
11
|
-
{ "type": "item.agentMessage.delta", "itemId": "msg_001", "delta": "Hello" },
|
|
12
|
-
{ "type": "item.agentMessage.delta", "itemId": "msg_001", "delta": " there" },
|
|
13
|
-
{ "type": "item.agentMessage.delta", "itemId": "msg_001", "delta": "!" },
|
|
14
|
-
{
|
|
15
|
-
"type": "item.completed",
|
|
16
|
-
"item": { "id": "msg_001", "type": "agentMessage", "text": "Hello there!" }
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"type": "thread.tokenUsage.updated",
|
|
20
|
-
"tokenUsage": {
|
|
21
|
-
"totalTokens": 15910,
|
|
22
|
-
"inputTokens": 15901,
|
|
23
|
-
"cachedInputTokens": 11008,
|
|
24
|
-
"cacheWriteInputTokens": 0,
|
|
25
|
-
"outputTokens": 9,
|
|
26
|
-
"reasoningOutputTokens": 0
|
|
27
|
-
},
|
|
28
|
-
"modelContextWindow": 258400
|
|
29
|
-
},
|
|
30
|
-
{ "type": "turn.completed" }
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"runCalls": [
|
|
35
|
-
{
|
|
36
|
-
"prompt": "Generate a concise 3-5 word title for this conversation. Reply with only the title, nothing else.\n\nUser asked: \"Say hello\"\n\nAgent responded: \"Hello there!\"",
|
|
37
|
-
"result": { "finalResponse": "Hello Greeting Chat" }
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "failed-turn",
|
|
3
|
-
"description": "Turn that fails with an error event",
|
|
4
|
-
"threadId": "thread_fix_003",
|
|
5
|
-
"runStreamedCalls": [
|
|
6
|
-
{
|
|
7
|
-
"prompt": "Do something that fails",
|
|
8
|
-
"events": [
|
|
9
|
-
{ "type": "thread.started", "thread_id": "thread_fix_003" },
|
|
10
|
-
{ "type": "item.started", "item": { "id": "item_1", "type": "agent_message", "text": "" } },
|
|
11
|
-
{ "type": "error", "message": "Rate limit exceeded. Please try again later." }
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"runCalls": []
|
|
16
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mcp-tool-call",
|
|
3
|
-
"description": "Turn with an mcp_tool_call item — tests MCP-specific item mapping",
|
|
4
|
-
"threadId": "thread_fix_007",
|
|
5
|
-
"runStreamedCalls": [
|
|
6
|
-
{
|
|
7
|
-
"prompt": "Search the web for cats",
|
|
8
|
-
"events": [
|
|
9
|
-
{ "type": "thread.started", "thread_id": "thread_fix_007" },
|
|
10
|
-
{
|
|
11
|
-
"type": "item.started",
|
|
12
|
-
"item": {
|
|
13
|
-
"id": "item_1",
|
|
14
|
-
"type": "mcp_tool_call",
|
|
15
|
-
"server": "web-search",
|
|
16
|
-
"tool": "search",
|
|
17
|
-
"arguments": { "query": "cats" },
|
|
18
|
-
"result": null,
|
|
19
|
-
"error": null,
|
|
20
|
-
"status": "in_progress"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"type": "item.completed",
|
|
25
|
-
"item": {
|
|
26
|
-
"id": "item_1",
|
|
27
|
-
"type": "mcp_tool_call",
|
|
28
|
-
"server": "web-search",
|
|
29
|
-
"tool": "search",
|
|
30
|
-
"arguments": { "query": "cats" },
|
|
31
|
-
"result": { "urls": ["https://example.com/cats"] },
|
|
32
|
-
"error": null,
|
|
33
|
-
"status": "completed"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
{ "type": "item.started", "item": { "id": "item_2", "type": "agent_message", "text": "" } },
|
|
37
|
-
{
|
|
38
|
-
"type": "item.completed",
|
|
39
|
-
"item": { "id": "item_2", "type": "agent_message", "text": "I found information about cats for you." }
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"type": "turn.completed",
|
|
43
|
-
"usage": {
|
|
44
|
-
"input_tokens": 20,
|
|
45
|
-
"cached_input_tokens": 0,
|
|
46
|
-
"cache_write_input_tokens": 0,
|
|
47
|
-
"output_tokens": 15,
|
|
48
|
-
"reasoning_output_tokens": 5
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
"runCalls": [
|
|
55
|
-
{
|
|
56
|
-
"prompt": "Generate a concise 3-5 word title for this conversation. Reply with only the title, nothing else.\n\nUser asked: \"Search the web for cats\"\n\nAgent responded: \"I found information about cats for you.\"",
|
|
57
|
-
"result": { "finalResponse": "Web Search For Cats" }
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "missing-item-started",
|
|
3
|
-
"description": "item.updated and item.completed without prior item.started — tests auto-insert fallback",
|
|
4
|
-
"threadId": "thread_fix_006",
|
|
5
|
-
"runStreamedCalls": [
|
|
6
|
-
{
|
|
7
|
-
"prompt": "Hello",
|
|
8
|
-
"events": [
|
|
9
|
-
{ "type": "thread.started", "thread_id": "thread_fix_006" },
|
|
10
|
-
{ "type": "item.updated", "item": { "id": "item_1", "type": "agent_message", "text": "Hello" } },
|
|
11
|
-
{
|
|
12
|
-
"type": "item.completed",
|
|
13
|
-
"item": { "id": "item_1", "type": "agent_message", "text": "Hello! How can I help?" }
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"type": "turn.completed",
|
|
17
|
-
"usage": {
|
|
18
|
-
"input_tokens": 5,
|
|
19
|
-
"cached_input_tokens": 0,
|
|
20
|
-
"cache_write_input_tokens": 0,
|
|
21
|
-
"output_tokens": 10,
|
|
22
|
-
"reasoning_output_tokens": 0
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"runCalls": [
|
|
29
|
-
{
|
|
30
|
-
"prompt": "Generate a concise 3-5 word title for this conversation. Reply with only the title, nothing else.\n\nUser asked: \"Hello\"\n\nAgent responded: \"Hello! How can I help?\"",
|
|
31
|
-
"result": { "finalResponse": "Simple Hello" }
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "multi-item-turn",
|
|
3
|
-
"description": "Turn with reasoning, command_execution, file_change, and agent_message items",
|
|
4
|
-
"threadId": "thread_fix_002",
|
|
5
|
-
"runStreamedCalls": [
|
|
6
|
-
{
|
|
7
|
-
"prompt": "List files and create a test file",
|
|
8
|
-
"events": [
|
|
9
|
-
{ "type": "thread.started", "thread_id": "thread_fix_002" },
|
|
10
|
-
{
|
|
11
|
-
"type": "item.started",
|
|
12
|
-
"item": { "id": "item_1", "type": "reasoning", "text": "I need to list files first" }
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"type": "item.completed",
|
|
16
|
-
"item": {
|
|
17
|
-
"id": "item_1",
|
|
18
|
-
"type": "reasoning",
|
|
19
|
-
"text": "I need to list files first, then create a test file."
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"type": "item.started",
|
|
24
|
-
"item": {
|
|
25
|
-
"id": "item_2",
|
|
26
|
-
"type": "command_execution",
|
|
27
|
-
"command": "ls -la",
|
|
28
|
-
"aggregated_output": "",
|
|
29
|
-
"exit_code": null,
|
|
30
|
-
"status": "in_progress"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"type": "item.completed",
|
|
35
|
-
"item": {
|
|
36
|
-
"id": "item_2",
|
|
37
|
-
"type": "command_execution",
|
|
38
|
-
"command": "ls -la",
|
|
39
|
-
"aggregated_output": "total 0\ndrwxr-xr-x 2 user staff 64 Jan 1 00:00 .",
|
|
40
|
-
"exit_code": 0,
|
|
41
|
-
"status": "completed"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"type": "item.started",
|
|
46
|
-
"item": { "id": "item_3", "type": "file_change", "changes": [], "status": "in_progress" }
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"type": "item.completed",
|
|
50
|
-
"item": {
|
|
51
|
-
"id": "item_3",
|
|
52
|
-
"type": "file_change",
|
|
53
|
-
"changes": [{ "path": "test.txt", "change_type": "added" }],
|
|
54
|
-
"status": "completed"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{ "type": "item.started", "item": { "id": "item_4", "type": "agent_message", "text": "" } },
|
|
58
|
-
{
|
|
59
|
-
"type": "item.completed",
|
|
60
|
-
"item": {
|
|
61
|
-
"id": "item_4",
|
|
62
|
-
"type": "agent_message",
|
|
63
|
-
"text": "I listed the files and created test.txt for you."
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"type": "turn.completed",
|
|
68
|
-
"usage": {
|
|
69
|
-
"input_tokens": 50,
|
|
70
|
-
"cached_input_tokens": 10,
|
|
71
|
-
"cache_write_input_tokens": 5,
|
|
72
|
-
"output_tokens": 40,
|
|
73
|
-
"reasoning_output_tokens": 15
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
"runCalls": [
|
|
80
|
-
{
|
|
81
|
-
"prompt": "Generate a concise 3-5 word title for this conversation. Reply with only the title, nothing else.\n\nUser asked: \"List files and create a test file\"\n\nAgent responded: \"I listed the files and created test.txt for you.\"",
|
|
82
|
-
"result": { "finalResponse": "File Listing and Creation" }
|
|
83
|
-
}
|
|
84
|
-
]
|
|
85
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "multi-turn",
|
|
3
|
-
"description": "Two turns in one session — tests resumeThread path and thread reuse",
|
|
4
|
-
"threadId": "thread_fix_005",
|
|
5
|
-
"runStreamedCalls": [
|
|
6
|
-
{
|
|
7
|
-
"prompt": "What is 2+2?",
|
|
8
|
-
"events": [
|
|
9
|
-
{ "type": "thread.started", "thread_id": "thread_fix_005" },
|
|
10
|
-
{ "type": "item.started", "item": { "id": "item_1", "type": "agent_message", "text": "" } },
|
|
11
|
-
{ "type": "item.completed", "item": { "id": "item_1", "type": "agent_message", "text": "2+2 equals 4." } },
|
|
12
|
-
{
|
|
13
|
-
"type": "turn.completed",
|
|
14
|
-
"usage": {
|
|
15
|
-
"input_tokens": 5,
|
|
16
|
-
"cached_input_tokens": 0,
|
|
17
|
-
"cache_write_input_tokens": 0,
|
|
18
|
-
"output_tokens": 10,
|
|
19
|
-
"reasoning_output_tokens": 0
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"prompt": "What about 3+3?",
|
|
26
|
-
"events": [
|
|
27
|
-
{ "type": "item.started", "item": { "id": "item_2", "type": "agent_message", "text": "" } },
|
|
28
|
-
{ "type": "item.completed", "item": { "id": "item_2", "type": "agent_message", "text": "3+3 equals 6." } },
|
|
29
|
-
{
|
|
30
|
-
"type": "turn.completed",
|
|
31
|
-
"usage": {
|
|
32
|
-
"input_tokens": 15,
|
|
33
|
-
"cached_input_tokens": 5,
|
|
34
|
-
"cache_write_input_tokens": 0,
|
|
35
|
-
"output_tokens": 10,
|
|
36
|
-
"reasoning_output_tokens": 0
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"runCalls": [
|
|
43
|
-
{
|
|
44
|
-
"prompt": "Generate a concise 3-5 word title for this conversation. Reply with only the title, nothing else.\n\nUser asked: \"What is 2+2?\"\n\nAgent responded: \"2+2 equals 4.\"",
|
|
45
|
-
"result": { "finalResponse": "Simple Math Questions" }
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "simple-turn",
|
|
3
|
-
"description": "Single agent_message item, turn completes successfully, title generated",
|
|
4
|
-
"threadId": "thread_fix_001",
|
|
5
|
-
"runStreamedCalls": [
|
|
6
|
-
{
|
|
7
|
-
"prompt": "Hello, how are you?",
|
|
8
|
-
"events": [
|
|
9
|
-
{ "type": "thread.started", "thread_id": "thread_fix_001" },
|
|
10
|
-
{ "type": "item.started", "item": { "id": "item_1", "type": "agent_message", "text": "" } },
|
|
11
|
-
{ "type": "item.updated", "item": { "id": "item_1", "type": "agent_message", "text": "Hello" } },
|
|
12
|
-
{
|
|
13
|
-
"type": "item.completed",
|
|
14
|
-
"item": { "id": "item_1", "type": "agent_message", "text": "Hello! How can I help you today?" }
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"type": "turn.completed",
|
|
18
|
-
"usage": {
|
|
19
|
-
"input_tokens": 10,
|
|
20
|
-
"cached_input_tokens": 0,
|
|
21
|
-
"cache_write_input_tokens": 0,
|
|
22
|
-
"output_tokens": 20,
|
|
23
|
-
"reasoning_output_tokens": 5
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
"runCalls": [
|
|
30
|
-
{
|
|
31
|
-
"prompt": "Generate a concise 3-5 word title for this conversation. Reply with only the title, nothing else.\n\nUser asked: \"Hello, how are you?\"\n\nAgent responded: \"Hello! How can I help you today?\"",
|
|
32
|
-
"result": { "finalResponse": "Simple Hello Chat" }
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration test: delta streaming + token usage.
|
|
3
|
-
*
|
|
4
|
-
* Verifies that item/agentMessage/delta notifications broadcast item:delta
|
|
5
|
-
* events to the frontend, and thread/tokenUsage/updated saves token usage
|
|
6
|
-
* to the DB and broadcasts turn:tokenUsage.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
10
|
-
import { readFileSync } from 'node:fs';
|
|
11
|
-
import { resolve } from 'node:path';
|
|
12
|
-
import type Database from 'better-sqlite3';
|
|
13
|
-
import { createAppServerMock, type Fixture } from './helpers/app-server-mock.ts';
|
|
14
|
-
import { clearBroadcasts, findBroadcast, capturedBroadcasts } from './helpers/ws-capture.ts';
|
|
15
|
-
import type { TestApp } from './helpers/test-app.ts';
|
|
16
|
-
|
|
17
|
-
const fixture = JSON.parse(
|
|
18
|
-
readFileSync(resolve(__dirname, '__fixtures__/delta-streaming.json'), 'utf-8'),
|
|
19
|
-
) as Fixture;
|
|
20
|
-
|
|
21
|
-
vi.mock('../codex/app-server-client.ts', () => ({
|
|
22
|
-
AppServerClient: createAppServerMock(fixture),
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
vi.mock('../ws/index.ts', async (importOriginal) => {
|
|
26
|
-
const actual = (await importOriginal()) as Record<string, unknown>;
|
|
27
|
-
return {
|
|
28
|
-
...actual,
|
|
29
|
-
broadcast: vi.fn((event: string, data: unknown) => {
|
|
30
|
-
capturedBroadcasts.push({ event, data });
|
|
31
|
-
}),
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const { getDb } = await import('../db/index.ts');
|
|
36
|
-
const { createTestApp, waitForTurn } = await import('./helpers/test-app.ts');
|
|
37
|
-
|
|
38
|
-
describe('Integration: delta streaming + token usage', () => {
|
|
39
|
-
let testApp: TestApp;
|
|
40
|
-
|
|
41
|
-
beforeEach(async () => {
|
|
42
|
-
vi.clearAllMocks();
|
|
43
|
-
clearBroadcasts();
|
|
44
|
-
testApp = await createTestApp();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
afterEach(async () => {
|
|
48
|
-
await testApp.cleanup();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('broadcasts item:delta for each delta and saves token usage', async () => {
|
|
52
|
-
const db: Database.Database = getDb();
|
|
53
|
-
|
|
54
|
-
// 1. Create session
|
|
55
|
-
const createRes = await testApp.app.inject({
|
|
56
|
-
method: 'POST',
|
|
57
|
-
url: '/api/sessions',
|
|
58
|
-
payload: { cwd: '/test' },
|
|
59
|
-
});
|
|
60
|
-
expect(createRes.statusCode).toBe(200);
|
|
61
|
-
const session = createRes.json();
|
|
62
|
-
const sessionId = session.id;
|
|
63
|
-
|
|
64
|
-
// 2. Submit turn
|
|
65
|
-
const turnRes = await testApp.app.inject({
|
|
66
|
-
method: 'POST',
|
|
67
|
-
url: `/api/sessions/${sessionId}/turns`,
|
|
68
|
-
payload: { user_prompt: 'Say hello' },
|
|
69
|
-
});
|
|
70
|
-
expect(turnRes.statusCode).toBe(200);
|
|
71
|
-
const turn = turnRes.json();
|
|
72
|
-
const turnId = turn.id;
|
|
73
|
-
|
|
74
|
-
// 3. Wait for turn to complete
|
|
75
|
-
await waitForTurn(db, turnId);
|
|
76
|
-
|
|
77
|
-
// 4. Assert item:delta broadcasts — 3 deltas sent
|
|
78
|
-
const deltaBroadcasts = capturedBroadcasts.filter((b) => b.event === 'item:delta');
|
|
79
|
-
expect(deltaBroadcasts).toHaveLength(3);
|
|
80
|
-
expect((deltaBroadcasts[0].data as { delta: string }).delta).toBe('Hello');
|
|
81
|
-
expect((deltaBroadcasts[1].data as { delta: string }).delta).toBe(' there');
|
|
82
|
-
expect((deltaBroadcasts[2].data as { delta: string }).delta).toBe('!');
|
|
83
|
-
|
|
84
|
-
// 5. Assert all item:delta broadcasts have correct itemId
|
|
85
|
-
for (const b of deltaBroadcasts) {
|
|
86
|
-
const data = b.data as { sessionId: string; turnId: string; itemId: string; delta: string };
|
|
87
|
-
expect(data.sessionId).toBe(sessionId);
|
|
88
|
-
expect(data.turnId).toBe(turnId);
|
|
89
|
-
expect(data.itemId).toBe('msg_001');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// 6. Assert turn:tokenUsage broadcast
|
|
93
|
-
const tokenUsageBroadcast = findBroadcast('turn:tokenUsage') as {
|
|
94
|
-
sessionId: string;
|
|
95
|
-
turnId: string;
|
|
96
|
-
usage: { input_tokens: number; output_tokens: number };
|
|
97
|
-
};
|
|
98
|
-
expect(tokenUsageBroadcast).toBeDefined();
|
|
99
|
-
expect(tokenUsageBroadcast.sessionId).toBe(sessionId);
|
|
100
|
-
expect(tokenUsageBroadcast.turnId).toBe(turnId);
|
|
101
|
-
expect(tokenUsageBroadcast.usage.input_tokens).toBe(15901);
|
|
102
|
-
expect(tokenUsageBroadcast.usage.output_tokens).toBe(9);
|
|
103
|
-
|
|
104
|
-
// 7. Assert DB — token_usage saved
|
|
105
|
-
const dbTurn = db.prepare('SELECT token_usage FROM turns WHERE id = ?').get(turnId) as {
|
|
106
|
-
token_usage: string | null;
|
|
107
|
-
};
|
|
108
|
-
expect(dbTurn.token_usage).not.toBeNull();
|
|
109
|
-
const parsedUsage = JSON.parse(dbTurn.token_usage!);
|
|
110
|
-
expect(parsedUsage.input_tokens).toBe(15901);
|
|
111
|
-
expect(parsedUsage.output_tokens).toBe(9);
|
|
112
|
-
expect(parsedUsage.cached_input_tokens).toBe(11008);
|
|
113
|
-
|
|
114
|
-
// 8. Assert DB — agent_response has final text
|
|
115
|
-
const dbTurnResponse = db.prepare('SELECT agent_response FROM turns WHERE id = ?').get(turnId) as {
|
|
116
|
-
agent_response: string | null;
|
|
117
|
-
};
|
|
118
|
-
expect(dbTurnResponse.agent_response).toBe('Hello there!');
|
|
119
|
-
|
|
120
|
-
// 9. Assert broadcast sequence includes deltas and token usage
|
|
121
|
-
const events = capturedBroadcasts.map((b) => b.event);
|
|
122
|
-
expect(events).toContain('item:delta');
|
|
123
|
-
expect(events).toContain('turn:tokenUsage');
|
|
124
|
-
expect(events).toContain('turn:completed');
|
|
125
|
-
|
|
126
|
-
// 10. Assert turn:completed does NOT have usage (real app-server sends none)
|
|
127
|
-
const completedData = findBroadcast('turn:completed') as { usage?: unknown };
|
|
128
|
-
expect(completedData.usage).toBeUndefined();
|
|
129
|
-
});
|
|
130
|
-
});
|