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,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration test: full turn lifecycle.
|
|
3
|
-
*
|
|
4
|
-
* Verifies the complete pipeline: HTTP POST → startTurn → runStreamed
|
|
5
|
-
* (replayed) → handleEvent → DB writes → WS broadcasts.
|
|
6
|
-
*
|
|
7
|
-
* Uses the real codex-provider.ts code with a mocked app-server client.
|
|
8
|
-
* The HTTP route handler calls startTurn() fire-and-forget. Tests wait
|
|
9
|
-
* for the turn to reach terminal status by polling the DB.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
13
|
-
import { readFileSync } from 'node:fs';
|
|
14
|
-
import { resolve } from 'node:path';
|
|
15
|
-
import type Database from 'better-sqlite3';
|
|
16
|
-
import { createAppServerMock, type Fixture } from './helpers/app-server-mock.ts';
|
|
17
|
-
import { clearBroadcasts, findBroadcast, expectBroadcastSequence, capturedBroadcasts } from './helpers/ws-capture.ts';
|
|
18
|
-
import type { TestApp } from './helpers/test-app.ts';
|
|
19
|
-
|
|
20
|
-
const fixture = JSON.parse(readFileSync(resolve(__dirname, '__fixtures__/simple-turn.json'), 'utf-8')) as Fixture;
|
|
21
|
-
|
|
22
|
-
vi.mock('../codex/app-server-client.ts', () => ({
|
|
23
|
-
AppServerClient: createAppServerMock(fixture),
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
vi.mock('../ws/index.ts', async (importOriginal) => {
|
|
27
|
-
const actual = (await importOriginal()) as Record<string, unknown>;
|
|
28
|
-
return {
|
|
29
|
-
...actual,
|
|
30
|
-
broadcast: vi.fn((event: string, data: unknown) => {
|
|
31
|
-
capturedBroadcasts.push({ event, data });
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const { getDb } = await import('../db/index.ts');
|
|
37
|
-
const { createTestApp, waitForTurn } = await import('./helpers/test-app.ts');
|
|
38
|
-
|
|
39
|
-
describe('Integration: turn lifecycle', () => {
|
|
40
|
-
let testApp: TestApp;
|
|
41
|
-
|
|
42
|
-
beforeEach(async () => {
|
|
43
|
-
vi.clearAllMocks();
|
|
44
|
-
clearBroadcasts();
|
|
45
|
-
testApp = await createTestApp();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
afterEach(async () => {
|
|
49
|
-
await testApp.cleanup();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('completes a full turn: HTTP → startTurn → events → DB → WS', async () => {
|
|
53
|
-
const db: Database.Database = getDb();
|
|
54
|
-
|
|
55
|
-
// 1. Create session via HTTP
|
|
56
|
-
const createRes = await testApp.app.inject({
|
|
57
|
-
method: 'POST',
|
|
58
|
-
url: '/api/sessions',
|
|
59
|
-
payload: { cwd: '/test' },
|
|
60
|
-
});
|
|
61
|
-
expect(createRes.statusCode).toBe(200);
|
|
62
|
-
const session = createRes.json();
|
|
63
|
-
const sessionId = session.id;
|
|
64
|
-
|
|
65
|
-
// 2. Submit turn via HTTP — route handler calls startTurn() fire-and-forget
|
|
66
|
-
const turnRes = await testApp.app.inject({
|
|
67
|
-
method: 'POST',
|
|
68
|
-
url: `/api/sessions/${sessionId}/turns`,
|
|
69
|
-
payload: { user_prompt: 'Hello, how are you?' },
|
|
70
|
-
});
|
|
71
|
-
expect(turnRes.statusCode).toBe(200);
|
|
72
|
-
const turn = turnRes.json();
|
|
73
|
-
const turnId = turn.id;
|
|
74
|
-
expect(turn.status).toBe('pending');
|
|
75
|
-
|
|
76
|
-
// 3. Wait for turn to reach terminal status
|
|
77
|
-
await waitForTurn(db, turnId);
|
|
78
|
-
|
|
79
|
-
// 4. Assert DB state — session
|
|
80
|
-
const dbSession = db.prepare('SELECT * FROM sessions WHERE id = ?').get(sessionId) as {
|
|
81
|
-
external_thread_id: string | null;
|
|
82
|
-
is_running: number;
|
|
83
|
-
status: string;
|
|
84
|
-
has_unreviewed: number;
|
|
85
|
-
title: string | null;
|
|
86
|
-
};
|
|
87
|
-
expect(dbSession.external_thread_id).toBe('thread_fix_001');
|
|
88
|
-
expect(dbSession.is_running).toBe(0);
|
|
89
|
-
expect(dbSession.status).toBe('active');
|
|
90
|
-
expect(dbSession.has_unreviewed).toBe(1);
|
|
91
|
-
|
|
92
|
-
// 5. Assert DB state — turn
|
|
93
|
-
const dbTurn = db.prepare('SELECT * FROM turns WHERE id = ?').get(turnId) as {
|
|
94
|
-
status: string;
|
|
95
|
-
agent_response: string | null;
|
|
96
|
-
token_usage: string | null;
|
|
97
|
-
};
|
|
98
|
-
expect(dbTurn.status).toBe('completed');
|
|
99
|
-
expect(dbTurn.agent_response).toBe('Hello! How can I help you today?');
|
|
100
|
-
// Real app-server does not send usage in turn/completed — token_usage is null
|
|
101
|
-
// until thread/tokenUsage/updated notification is implemented
|
|
102
|
-
expect(dbTurn.token_usage).toBeNull();
|
|
103
|
-
|
|
104
|
-
// 6. Assert DB state — items
|
|
105
|
-
const items = db.prepare('SELECT * FROM items WHERE turn_id = ? ORDER BY created_at ASC').all(turnId) as {
|
|
106
|
-
id: string;
|
|
107
|
-
type: string;
|
|
108
|
-
data: string;
|
|
109
|
-
status: string;
|
|
110
|
-
}[];
|
|
111
|
-
expect(items).toHaveLength(1);
|
|
112
|
-
expect(items[0].type).toBe('agent_message');
|
|
113
|
-
expect(items[0].status).toBe('completed');
|
|
114
|
-
expect(JSON.parse(items[0].data)).toEqual({ text: 'Hello! How can I help you today?' });
|
|
115
|
-
|
|
116
|
-
// 7. Assert WS broadcasts — order matters
|
|
117
|
-
expectBroadcastSequence(['turn:started', 'item:started', 'item:updated', 'item:completed', 'turn:completed']);
|
|
118
|
-
|
|
119
|
-
// 8. Assert turn:completed broadcast payload (no usage — real app-server)
|
|
120
|
-
const completedData = findBroadcast('turn:completed') as {
|
|
121
|
-
sessionId: string;
|
|
122
|
-
turnId: string;
|
|
123
|
-
hasUnreviewed: boolean;
|
|
124
|
-
};
|
|
125
|
-
expect(completedData.sessionId).toBe(sessionId);
|
|
126
|
-
expect(completedData.turnId).toBe(turnId);
|
|
127
|
-
expect(completedData.hasUnreviewed).toBe(true);
|
|
128
|
-
|
|
129
|
-
// 9. Title generation is fire-and-forget — wait for it
|
|
130
|
-
await new Promise((r) => setTimeout(r, 500));
|
|
131
|
-
const dbSessionTitled = db.prepare('SELECT title FROM sessions WHERE id = ?').get(sessionId) as {
|
|
132
|
-
title: string | null;
|
|
133
|
-
};
|
|
134
|
-
expect(dbSessionTitled.title).toBe('Simple Hello Chat');
|
|
135
|
-
|
|
136
|
-
// 10. Verify session:title broadcast
|
|
137
|
-
const titleData = findBroadcast('session:title') as { sessionId: string; title: string };
|
|
138
|
-
expect(titleData.sessionId).toBe(sessionId);
|
|
139
|
-
expect(titleData.title).toBe('Simple Hello Chat');
|
|
140
|
-
});
|
|
141
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provider registration — imports providers and registers them.
|
|
3
|
-
*
|
|
4
|
-
* Imported for side effects in `index.ts`:
|
|
5
|
-
* import './providers/index.ts';
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { codexProvider } from '../codex/codex-provider.ts';
|
|
9
|
-
import { claudeProvider } from '../claude/claude-provider.ts';
|
|
10
|
-
import { repoburgProvider } from '../repoburg/repoburg-provider.ts';
|
|
11
|
-
import { registerProvider } from './registry.ts';
|
|
12
|
-
|
|
13
|
-
// Register built-in providers
|
|
14
|
-
registerProvider('codex', codexProvider);
|
|
15
|
-
registerProvider('claude', claudeProvider);
|
|
16
|
-
registerProvider('repoburg', repoburgProvider);
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
-
import type { RuntimeProvider } from './runtime-provider.ts';
|
|
3
|
-
|
|
4
|
-
// Use dynamic import to get a fresh module instance per test.
|
|
5
|
-
// vi.resetModules() ensures the registry Map starts empty each time.
|
|
6
|
-
|
|
7
|
-
function makeMockProvider(): RuntimeProvider {
|
|
8
|
-
return {
|
|
9
|
-
startTurn: vi.fn().mockResolvedValue(undefined),
|
|
10
|
-
interruptTurn: vi.fn().mockResolvedValue(true),
|
|
11
|
-
clearThread: vi.fn(),
|
|
12
|
-
clearAllThreads: vi.fn(),
|
|
13
|
-
getModels: vi.fn().mockResolvedValue([]),
|
|
14
|
-
shutdown: vi.fn().mockResolvedValue(undefined),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
describe('Provider registry', () => {
|
|
19
|
-
let registry: typeof import('./registry.ts');
|
|
20
|
-
|
|
21
|
-
beforeEach(async () => {
|
|
22
|
-
vi.resetModules();
|
|
23
|
-
registry = await import('./registry.ts');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('registerProvider + getProvider', () => {
|
|
27
|
-
it('registers and retrieves a provider', () => {
|
|
28
|
-
const mock = makeMockProvider();
|
|
29
|
-
registry.registerProvider('test', mock);
|
|
30
|
-
expect(registry.getProvider('test')).toBe(mock);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('throws for unregistered provider', () => {
|
|
34
|
-
expect(() => registry.getProvider('unknown')).toThrow('Unknown provider: unknown');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('overwrites previous registration with same ID', () => {
|
|
38
|
-
const mock1 = makeMockProvider();
|
|
39
|
-
const mock2 = makeMockProvider();
|
|
40
|
-
registry.registerProvider('test', mock1);
|
|
41
|
-
registry.registerProvider('test', mock2);
|
|
42
|
-
expect(registry.getProvider('test')).toBe(mock2);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe('hasProvider', () => {
|
|
47
|
-
it('returns true for registered provider', () => {
|
|
48
|
-
registry.registerProvider('test', makeMockProvider());
|
|
49
|
-
expect(registry.hasProvider('test')).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('returns false for unregistered provider', () => {
|
|
53
|
-
expect(registry.hasProvider('unknown')).toBe(false);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
describe('clearAllProviders', () => {
|
|
58
|
-
it('calls clearAllThreads on all registered providers', () => {
|
|
59
|
-
const mock1 = makeMockProvider();
|
|
60
|
-
const mock2 = makeMockProvider();
|
|
61
|
-
registry.registerProvider('p1', mock1);
|
|
62
|
-
registry.registerProvider('p2', mock2);
|
|
63
|
-
|
|
64
|
-
registry.clearAllProviders();
|
|
65
|
-
|
|
66
|
-
expect(mock1.clearAllThreads).toHaveBeenCalledTimes(1);
|
|
67
|
-
expect(mock2.clearAllThreads).toHaveBeenCalledTimes(1);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('does nothing when no providers registered', () => {
|
|
71
|
-
expect(() => registry.clearAllProviders()).not.toThrow();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
describe('shutdownAllProviders', () => {
|
|
76
|
-
it('calls shutdown on all registered providers', async () => {
|
|
77
|
-
const mock1 = makeMockProvider();
|
|
78
|
-
const mock2 = makeMockProvider();
|
|
79
|
-
registry.registerProvider('p1', mock1);
|
|
80
|
-
registry.registerProvider('p2', mock2);
|
|
81
|
-
|
|
82
|
-
await registry.shutdownAllProviders();
|
|
83
|
-
|
|
84
|
-
expect(mock1.shutdown).toHaveBeenCalledTimes(1);
|
|
85
|
-
expect(mock2.shutdown).toHaveBeenCalledTimes(1);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('does nothing when no providers registered', async () => {
|
|
89
|
-
await expect(registry.shutdownAllProviders()).resolves.toBeUndefined();
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provider registry — Map-based dispatch.
|
|
3
|
-
*
|
|
4
|
-
* Routes call `getProvider(session.runtime_type).startTurn(...)`.
|
|
5
|
-
* No if/else branching in route handlers.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { RuntimeProvider } from './runtime-provider.ts';
|
|
9
|
-
|
|
10
|
-
const providers = new Map<string, RuntimeProvider>();
|
|
11
|
-
|
|
12
|
-
/** Register a provider by its runtime type ID. */
|
|
13
|
-
export function registerProvider(id: string, provider: RuntimeProvider): void {
|
|
14
|
-
providers.set(id, provider);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** Get a provider by runtime type. Throws if not registered. */
|
|
18
|
-
export function getProvider(runtimeType: string): RuntimeProvider {
|
|
19
|
-
const provider = providers.get(runtimeType);
|
|
20
|
-
if (!provider) {
|
|
21
|
-
throw new Error(`Unknown provider: ${runtimeType}`);
|
|
22
|
-
}
|
|
23
|
-
return provider;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Check if a provider is registered. */
|
|
27
|
-
export function hasProvider(runtimeType: string): boolean {
|
|
28
|
-
return providers.has(runtimeType);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Clear all in-memory state for all providers. Used in test cleanup. */
|
|
32
|
-
export function clearAllProviders(): void {
|
|
33
|
-
for (const provider of providers.values()) {
|
|
34
|
-
provider.clearAllThreads();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** Graceful shutdown for all registered providers. */
|
|
39
|
-
export async function shutdownAllProviders(): Promise<void> {
|
|
40
|
-
for (const provider of providers.values()) {
|
|
41
|
-
await provider.shutdown();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime provider interface — one interface for all providers.
|
|
3
|
-
*
|
|
4
|
-
* Each provider (Codex, Claude, etc.) implements this interface.
|
|
5
|
-
* Routes dispatch via the registry Map — no if/else branching.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { Session, Turn } from '../db/schema.ts';
|
|
9
|
-
import type { ModelInfo, ProviderSlashCommand } from '@agentpane/shared';
|
|
10
|
-
|
|
11
|
-
/** Runtime provider — turn lifecycle, cleanup, metadata, and shutdown. */
|
|
12
|
-
export interface RuntimeProvider {
|
|
13
|
-
/** Start a turn. Fire-and-forget — events stream via WebSocket. */
|
|
14
|
-
startTurn(session: Session, turn: Turn): Promise<void>;
|
|
15
|
-
/** Cancel a running turn. Returns true if a turn was cancelled. */
|
|
16
|
-
interruptTurn(sessionId: string): Promise<boolean>;
|
|
17
|
-
/** Remove session from in-memory state. Used after rewind/branch/model-change. */
|
|
18
|
-
clearThread(sessionId: string): void;
|
|
19
|
-
/** Remove a specific thread's branched session entry. Used when a thread is deleted. */
|
|
20
|
-
clearThreadBranch?(sessionId: string, threadId: string): void;
|
|
21
|
-
/** Clear all in-memory state. Used in test cleanup. */
|
|
22
|
-
clearAllThreads(): void;
|
|
23
|
-
/** Fetch available models for this provider. */
|
|
24
|
-
getModels(): Promise<ModelInfo[]>;
|
|
25
|
-
/** Fetch provider-native slash commands (e.g. Claude CLI `/compact`, `/clear`).
|
|
26
|
-
* Optional — providers without a command surface omit it and return `[]`. */
|
|
27
|
-
getCommands?(): Promise<ProviderSlashCommand[]>;
|
|
28
|
-
/** Fork the provider-native session at a branch point.
|
|
29
|
-
* Returns the new provider-native session ID, or null if there is no thread to fork.
|
|
30
|
-
* Optional — providers without fork support omit it. */
|
|
31
|
-
forkSession?(session: Session, targetTurn: Turn): Promise<string | null>;
|
|
32
|
-
/** Change the model for a running session without restarting the CLI process.
|
|
33
|
-
* Only supported in streaming-input mode (Claude). If the session hasn't
|
|
34
|
-
* started yet, the new model is read from the DB on next startTurn.
|
|
35
|
-
* Optional — providers without mid-session model switching omit it. */
|
|
36
|
-
setModel?(sessionId: string, model: string): Promise<void>;
|
|
37
|
-
/** Stop a running background task (e.g. Monitor) by task ID.
|
|
38
|
-
* Emits a task_notification with status 'stopped'.
|
|
39
|
-
* Optional — providers without background task support omit it. */
|
|
40
|
-
stopTask?(sessionId: string, taskId: string): Promise<void>;
|
|
41
|
-
/** Graceful shutdown — close processes, release resources. */
|
|
42
|
-
shutdown(): Promise<void>;
|
|
43
|
-
}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared mapping helpers for the repoburg provider: repoburg AIAction →
|
|
3
|
-
* agent-pane item shapes, DB item helpers, and usage mapping.
|
|
4
|
-
* Used by both the provider (turn orchestration) and the turn projector
|
|
5
|
-
* (message-stream projection).
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
9
|
-
import type Database from 'better-sqlite3';
|
|
10
|
-
import { broadcast } from '../ws/index.ts';
|
|
11
|
-
import type { Item, ItemStatus } from '../db/schema.ts';
|
|
12
|
-
import type { RepoburgAction } from './repoburg-client.ts';
|
|
13
|
-
|
|
14
|
-
/** Safely parse a JSON string field from an action row. */
|
|
15
|
-
export function parseJsonArgs(raw: string | null | undefined): Record<string, unknown> | null {
|
|
16
|
-
if (!raw) return null;
|
|
17
|
-
try {
|
|
18
|
-
const parsed = JSON.parse(raw);
|
|
19
|
-
return typeof parsed === 'object' && parsed !== null ? (parsed as Record<string, unknown>) : null;
|
|
20
|
-
} catch {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Map a repoburg AIAction (+ its first execution log) to an agent-pane item
|
|
26
|
-
* shape. Returns null for actions that carry no displayable content
|
|
27
|
-
* (final/html_final — their text is part of the LLM response). */
|
|
28
|
-
export function mapActionToItem(
|
|
29
|
-
action: RepoburgAction,
|
|
30
|
-
): { type: Item['type']; data: Record<string, unknown>; status: ItemStatus } | null {
|
|
31
|
-
const failed = action.status === 'EXECUTION_FAILED';
|
|
32
|
-
const status: ItemStatus = failed ? 'failed' : 'completed';
|
|
33
|
-
const log = action.executionLogs?.[0];
|
|
34
|
-
const output = log?.output ?? '';
|
|
35
|
-
const errorMsg = log?.error_message ?? '';
|
|
36
|
-
|
|
37
|
-
switch (action.action_type) {
|
|
38
|
-
case 'create_file':
|
|
39
|
-
case 'overwrite_file':
|
|
40
|
-
case 'patch':
|
|
41
|
-
case 'quick_edit':
|
|
42
|
-
case 'apply_diff':
|
|
43
|
-
case 'write_todo':
|
|
44
|
-
case 'delete_file': {
|
|
45
|
-
const kind =
|
|
46
|
-
action.action_type === 'create_file'
|
|
47
|
-
? 'add'
|
|
48
|
-
: action.action_type === 'delete_file'
|
|
49
|
-
? 'delete'
|
|
50
|
-
: 'modify';
|
|
51
|
-
return {
|
|
52
|
-
type: 'file_change',
|
|
53
|
-
data: { changes: [{ path: action.file_path ?? '', kind }], status },
|
|
54
|
-
status,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
case 'run_command':
|
|
59
|
-
case 'execute_code':
|
|
60
|
-
return {
|
|
61
|
-
type: 'command_execution',
|
|
62
|
-
data: {
|
|
63
|
-
command: action.command_string ?? action.action_type,
|
|
64
|
-
aggregated_output: output,
|
|
65
|
-
exit_code: failed ? 1 : 0,
|
|
66
|
-
status,
|
|
67
|
-
},
|
|
68
|
-
status,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
case 'invoke_subagent': {
|
|
72
|
-
const args = parseJsonArgs(action.arguments);
|
|
73
|
-
return {
|
|
74
|
-
type: 'mcp_tool_call',
|
|
75
|
-
data: {
|
|
76
|
-
server: null,
|
|
77
|
-
tool: 'Agent',
|
|
78
|
-
arguments: {
|
|
79
|
-
description: (args?.agent_name as string) ?? (args?.agentName as string) ?? 'Subagent',
|
|
80
|
-
prompt: (args?.prompt as string) ?? '',
|
|
81
|
-
},
|
|
82
|
-
result: output ? [{ type: 'text', text: output }] : null,
|
|
83
|
-
error: failed ? errorMsg || 'Sub-agent failed' : null,
|
|
84
|
-
status,
|
|
85
|
-
},
|
|
86
|
-
status,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
case 'web_search': {
|
|
91
|
-
const args = parseJsonArgs(action.arguments);
|
|
92
|
-
return { type: 'web_search', data: { query: (args?.query as string) ?? '' }, status };
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
case 'final':
|
|
96
|
-
case 'html_final':
|
|
97
|
-
case 'ask_user':
|
|
98
|
-
// Their text is part of the LLM response — no separate item.
|
|
99
|
-
return null;
|
|
100
|
-
|
|
101
|
-
default: {
|
|
102
|
-
// MCP tools (serverName__toolName) and remaining built-ins → generic tool call.
|
|
103
|
-
const isMcp = !!(action.server_name && action.tool_name);
|
|
104
|
-
return {
|
|
105
|
-
type: 'mcp_tool_call',
|
|
106
|
-
data: {
|
|
107
|
-
server: isMcp ? action.server_name : null,
|
|
108
|
-
tool: isMcp ? action.tool_name : action.action_type,
|
|
109
|
-
arguments: parseJsonArgs(action.arguments),
|
|
110
|
-
result: output ? [{ type: 'text', text: output }] : null,
|
|
111
|
-
error: failed ? errorMsg || 'Action failed' : null,
|
|
112
|
-
status,
|
|
113
|
-
},
|
|
114
|
-
status,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** Map repoburg token counts to the agent-pane TokenUsage shape. */
|
|
121
|
-
export function mapUsage(u: {
|
|
122
|
-
input: number;
|
|
123
|
-
cached: number;
|
|
124
|
-
output: number;
|
|
125
|
-
}): {
|
|
126
|
-
input_tokens: number;
|
|
127
|
-
cached_input_tokens: number;
|
|
128
|
-
cache_write_input_tokens: number;
|
|
129
|
-
output_tokens: number;
|
|
130
|
-
reasoning_output_tokens: number;
|
|
131
|
-
} {
|
|
132
|
-
return {
|
|
133
|
-
input_tokens: u.input,
|
|
134
|
-
cached_input_tokens: u.cached,
|
|
135
|
-
cache_write_input_tokens: 0,
|
|
136
|
-
output_tokens: u.output,
|
|
137
|
-
reasoning_output_tokens: 0,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/** Update the running state and status of a session. */
|
|
142
|
-
export function setSessionStatus(
|
|
143
|
-
db: Database.Database,
|
|
144
|
-
sessionId: string,
|
|
145
|
-
isRunning: 0 | 1,
|
|
146
|
-
status: string,
|
|
147
|
-
now: string,
|
|
148
|
-
hasUnreviewed = false,
|
|
149
|
-
): void {
|
|
150
|
-
if (hasUnreviewed) {
|
|
151
|
-
db.prepare('UPDATE sessions SET is_running = ?, status = ?, has_unreviewed = 1, updated_at = ? WHERE id = ?').run(
|
|
152
|
-
isRunning,
|
|
153
|
-
status,
|
|
154
|
-
now,
|
|
155
|
-
sessionId,
|
|
156
|
-
);
|
|
157
|
-
} else {
|
|
158
|
-
db.prepare('UPDATE sessions SET is_running = ?, status = ?, updated_at = ? WHERE id = ?').run(
|
|
159
|
-
isRunning,
|
|
160
|
-
status,
|
|
161
|
-
now,
|
|
162
|
-
sessionId,
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/** Insert an item row and broadcast it. Returns the created item. */
|
|
168
|
-
export function insertItem(
|
|
169
|
-
db: Database.Database,
|
|
170
|
-
sessionId: string,
|
|
171
|
-
turnId: string,
|
|
172
|
-
externalId: string,
|
|
173
|
-
type: Item['type'],
|
|
174
|
-
data: Record<string, unknown>,
|
|
175
|
-
status: ItemStatus,
|
|
176
|
-
broadcastEvent: 'item:started' | 'item:completed',
|
|
177
|
-
): Item {
|
|
178
|
-
const now = new Date().toISOString();
|
|
179
|
-
const itemId = uuidv4();
|
|
180
|
-
db.prepare(
|
|
181
|
-
'INSERT INTO items (id, turn_id, external_item_id, type, data, status, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)',
|
|
182
|
-
).run(itemId, turnId, externalId, type, JSON.stringify(data), status, now, now);
|
|
183
|
-
|
|
184
|
-
const item: Item = {
|
|
185
|
-
id: itemId,
|
|
186
|
-
turn_id: turnId,
|
|
187
|
-
external_item_id: externalId,
|
|
188
|
-
type,
|
|
189
|
-
data,
|
|
190
|
-
status,
|
|
191
|
-
created_at: now,
|
|
192
|
-
updated_at: now,
|
|
193
|
-
};
|
|
194
|
-
broadcast(broadcastEvent, { sessionId, turnId, item });
|
|
195
|
-
return item;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/** Update an item's data + status and broadcast the completed item. */
|
|
199
|
-
export function completeItem(
|
|
200
|
-
db: Database.Database,
|
|
201
|
-
sessionId: string,
|
|
202
|
-
turnId: string,
|
|
203
|
-
item: Item,
|
|
204
|
-
data: Record<string, unknown>,
|
|
205
|
-
status: ItemStatus,
|
|
206
|
-
): void {
|
|
207
|
-
const now = new Date().toISOString();
|
|
208
|
-
db.prepare('UPDATE items SET data = ?, status = ?, updated_at = ? WHERE id = ?').run(
|
|
209
|
-
JSON.stringify(data),
|
|
210
|
-
status,
|
|
211
|
-
now,
|
|
212
|
-
item.id,
|
|
213
|
-
);
|
|
214
|
-
const updated: Item = { ...item, data, status, updated_at: now };
|
|
215
|
-
broadcast('item:completed', { sessionId, turnId, item: updated });
|
|
216
|
-
}
|