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,537 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turn projector — maps the agent-runtime message stream (Claude-Code-style)
|
|
3
|
-
* onto agent-pane items and turn lifecycle.
|
|
4
|
-
*
|
|
5
|
-
* Projection (idempotent upsert by external ids):
|
|
6
|
-
* - stream_event(text/thinking) → agent_message / reasoning items (live deltas)
|
|
7
|
-
* - assistant → completes the round's text/thoughts items
|
|
8
|
-
* - user(tool_result) → file_change / command_execution / mcp_tool_call
|
|
9
|
-
* / web_search items from the action data
|
|
10
|
-
* - result → terminal: turn completed / failed / cancelled
|
|
11
|
-
*
|
|
12
|
-
* Watch-dog (Claude Code stream-watchdog analog): no `result` within
|
|
13
|
-
* RESULT_TIMEOUT after the last MESSAGE (heartbeats do not reset it) →
|
|
14
|
-
* HTTP snapshot reconcile (GET /sessions/:id/inputs incl. aiActions) fills
|
|
15
|
-
* missing rounds; a still-running session re-arms the watchdog up to
|
|
16
|
-
* MAX_RESULT_EXTENSIONS times, then the turn fails with a timeout error.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { getDb } from '../db/index.ts';
|
|
20
|
-
import { broadcast } from '../ws/index.ts';
|
|
21
|
-
import type { Item } from '../db/schema.ts';
|
|
22
|
-
import type { RepoburgRuntimeClient, RepoburgSessionInput } from './repoburg-client.ts';
|
|
23
|
-
import {
|
|
24
|
-
completeItem,
|
|
25
|
-
insertItem,
|
|
26
|
-
mapActionToItem,
|
|
27
|
-
mapUsage,
|
|
28
|
-
setSessionStatus,
|
|
29
|
-
} from './action-mapping.ts';
|
|
30
|
-
import type {
|
|
31
|
-
AgentRuntimeMessage,
|
|
32
|
-
AssistantMessage,
|
|
33
|
-
ResultMessage,
|
|
34
|
-
StreamEventMessage,
|
|
35
|
-
UserMessage,
|
|
36
|
-
} from './agent-runtime-client.ts';
|
|
37
|
-
|
|
38
|
-
/** No result message within this window after the last message → reconcile. */
|
|
39
|
-
export const RESULT_TIMEOUT_MS = 15 * 60_000;
|
|
40
|
-
/** Reconcile extensions while the backend reports the session still running. */
|
|
41
|
-
export const MAX_RESULT_EXTENSIONS = 3;
|
|
42
|
-
|
|
43
|
-
/** Per-round projected state. */
|
|
44
|
-
interface RoundInfo {
|
|
45
|
-
messageItemId: string | null;
|
|
46
|
-
reasoningItemId: string | null;
|
|
47
|
-
messageExternalId: string;
|
|
48
|
-
reasoningExternalId: string;
|
|
49
|
-
text: string;
|
|
50
|
-
thoughts: string;
|
|
51
|
-
finalPlain: string | null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface ProjectorDeps {
|
|
55
|
-
agentPaneSessionId: string;
|
|
56
|
-
turnId: string;
|
|
57
|
-
repoburgSessionId: string;
|
|
58
|
-
client: RepoburgRuntimeClient;
|
|
59
|
-
/** Optional hook: called once when the turn reaches a terminal state. */
|
|
60
|
-
onFinished?: () => void;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export class TurnProjector {
|
|
64
|
-
private readonly rounds = new Map<string, RoundInfo>();
|
|
65
|
-
private done = false;
|
|
66
|
-
private resultTimer: ReturnType<typeof setTimeout> | null = null;
|
|
67
|
-
private extensions = 0;
|
|
68
|
-
|
|
69
|
-
constructor(private readonly deps: ProjectorDeps) {
|
|
70
|
-
this.armResultWatchdog();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
get isDone(): boolean {
|
|
74
|
-
return this.done;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** Main entry — dispatch one agent-runtime message. */
|
|
78
|
-
handle(message: AgentRuntimeMessage): void {
|
|
79
|
-
if (this.done) return;
|
|
80
|
-
switch (message.type) {
|
|
81
|
-
case 'system':
|
|
82
|
-
break; // init — connection marker only
|
|
83
|
-
case 'stream_event':
|
|
84
|
-
this.handleStreamEvent(message);
|
|
85
|
-
break;
|
|
86
|
-
case 'assistant':
|
|
87
|
-
this.handleAssistant(message);
|
|
88
|
-
break;
|
|
89
|
-
case 'user':
|
|
90
|
-
this.handleUser(message);
|
|
91
|
-
break;
|
|
92
|
-
case 'result':
|
|
93
|
-
this.handleResult(message);
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/** Reset the result watchdog (any MESSAGE resets it; heartbeats do not). */
|
|
99
|
-
touch(): void {
|
|
100
|
-
if (this.done) return;
|
|
101
|
-
this.armResultWatchdog();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** Stop the projector (turn finalized externally). Clears timers. */
|
|
105
|
-
close(): void {
|
|
106
|
-
this.clearWatchdog();
|
|
107
|
-
this.done = true;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// -------------------------------------------------------------------------
|
|
111
|
-
// Message handlers
|
|
112
|
-
// -------------------------------------------------------------------------
|
|
113
|
-
|
|
114
|
-
private round(inputId: string): RoundInfo {
|
|
115
|
-
let info = this.rounds.get(inputId);
|
|
116
|
-
if (!info) {
|
|
117
|
-
info = {
|
|
118
|
-
messageItemId: null,
|
|
119
|
-
reasoningItemId: null,
|
|
120
|
-
messageExternalId: `${inputId}-text`,
|
|
121
|
-
reasoningExternalId: `${inputId}-thoughts`,
|
|
122
|
-
text: '',
|
|
123
|
-
thoughts: '',
|
|
124
|
-
finalPlain: null,
|
|
125
|
-
};
|
|
126
|
-
this.rounds.set(inputId, info);
|
|
127
|
-
}
|
|
128
|
-
return info;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
private handleStreamEvent(msg: StreamEventMessage): void {
|
|
132
|
-
const db = getDb();
|
|
133
|
-
const info = this.round(msg.inputId);
|
|
134
|
-
const kind = msg.delta.type === 'thinking' ? 'thoughts' : 'text';
|
|
135
|
-
|
|
136
|
-
if (kind === 'text') info.text += msg.delta.text;
|
|
137
|
-
else info.thoughts += msg.delta.text;
|
|
138
|
-
|
|
139
|
-
const externalId = kind === 'text' ? info.messageExternalId : info.reasoningExternalId;
|
|
140
|
-
const type: Item['type'] = kind === 'text' ? 'agent_message' : 'reasoning';
|
|
141
|
-
const itemId = kind === 'text' ? info.messageItemId : info.reasoningItemId;
|
|
142
|
-
|
|
143
|
-
if (!itemId) {
|
|
144
|
-
const item = insertItem(
|
|
145
|
-
db,
|
|
146
|
-
this.deps.agentPaneSessionId,
|
|
147
|
-
this.deps.turnId,
|
|
148
|
-
externalId,
|
|
149
|
-
type,
|
|
150
|
-
{ text: kind === 'text' ? info.text : info.thoughts },
|
|
151
|
-
'in_progress',
|
|
152
|
-
'item:started',
|
|
153
|
-
);
|
|
154
|
-
if (kind === 'text') info.messageItemId = item.id;
|
|
155
|
-
else info.reasoningItemId = item.id;
|
|
156
|
-
} else {
|
|
157
|
-
// Subsequent chunks stream as deltas (frontend matches by external id).
|
|
158
|
-
broadcast('item:delta', {
|
|
159
|
-
sessionId: this.deps.agentPaneSessionId,
|
|
160
|
-
turnId: this.deps.turnId,
|
|
161
|
-
itemId: externalId,
|
|
162
|
-
delta: msg.delta.text,
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
this.touch();
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
private handleAssistant(msg: AssistantMessage): void {
|
|
169
|
-
const info = this.round(msg.inputId);
|
|
170
|
-
|
|
171
|
-
// The assistant message is the AUTHORITATIVE round content — replace the
|
|
172
|
-
// accumulated deltas (they may be partial when deltas were off/missed).
|
|
173
|
-
const text = msg.content
|
|
174
|
-
.filter((b) => b.type === 'text')
|
|
175
|
-
.map((b) => (b as { text: string }).text)
|
|
176
|
-
.join('');
|
|
177
|
-
const thinking = msg.content
|
|
178
|
-
.filter((b) => b.type === 'thinking')
|
|
179
|
-
.map((b) => (b as { thinking: string }).thinking)
|
|
180
|
-
.join('');
|
|
181
|
-
if (text) info.text = text;
|
|
182
|
-
if (thinking) info.thoughts = thinking;
|
|
183
|
-
|
|
184
|
-
// Complete (or create) the round's items — deltas may have been off/missed.
|
|
185
|
-
this.upsertCompletedTextItem(info, 'message', info.text);
|
|
186
|
-
this.upsertCompletedTextItem(info, 'reasoning', info.thoughts);
|
|
187
|
-
this.touch();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/** Complete a round's text/thoughts item — creates it when deltas were
|
|
191
|
-
* off or missed, otherwise completes the streamed in_progress item. */
|
|
192
|
-
private upsertCompletedTextItem(
|
|
193
|
-
info: RoundInfo,
|
|
194
|
-
kind: 'message' | 'reasoning',
|
|
195
|
-
text: string,
|
|
196
|
-
): void {
|
|
197
|
-
if (!text) return;
|
|
198
|
-
const db = getDb();
|
|
199
|
-
const externalId = kind === 'message' ? info.messageExternalId : info.reasoningExternalId;
|
|
200
|
-
const itemId = kind === 'message' ? info.messageItemId : info.reasoningItemId;
|
|
201
|
-
const type: Item['type'] = kind === 'message' ? 'agent_message' : 'reasoning';
|
|
202
|
-
|
|
203
|
-
if (itemId) {
|
|
204
|
-
const itemRow = db.prepare('SELECT * FROM items WHERE id = ?').get(itemId) as
|
|
205
|
-
| Item
|
|
206
|
-
| undefined;
|
|
207
|
-
if (itemRow) {
|
|
208
|
-
completeItem(db, this.deps.agentPaneSessionId, this.deps.turnId, itemRow, { text }, 'completed');
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
// Idempotent: skip when an item with this external id already exists
|
|
213
|
-
// (e.g. replayed after reconnect).
|
|
214
|
-
const existing = db
|
|
215
|
-
.prepare('SELECT id FROM items WHERE turn_id = ? AND external_item_id = ?')
|
|
216
|
-
.get(this.deps.turnId, externalId);
|
|
217
|
-
if (existing) return;
|
|
218
|
-
const item = insertItem(
|
|
219
|
-
db,
|
|
220
|
-
this.deps.agentPaneSessionId,
|
|
221
|
-
this.deps.turnId,
|
|
222
|
-
externalId,
|
|
223
|
-
type,
|
|
224
|
-
{ text },
|
|
225
|
-
'completed',
|
|
226
|
-
'item:completed',
|
|
227
|
-
);
|
|
228
|
-
if (kind === 'message') info.messageItemId = item.id;
|
|
229
|
-
else info.reasoningItemId = item.id;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
private handleUser(msg: UserMessage): void {
|
|
233
|
-
const db = getDb();
|
|
234
|
-
for (const block of msg.content) {
|
|
235
|
-
const info = this.round(msg.inputId);
|
|
236
|
-
// Synthesize the RepoburgAction shape from the tool_result payload —
|
|
237
|
-
// failed actions carry their text as the error, successful as output.
|
|
238
|
-
const action = {
|
|
239
|
-
...block.action,
|
|
240
|
-
executionLogs: [
|
|
241
|
-
{
|
|
242
|
-
output: block.is_error ? '' : block.content,
|
|
243
|
-
error_message: block.is_error ? block.content : null,
|
|
244
|
-
},
|
|
245
|
-
],
|
|
246
|
-
};
|
|
247
|
-
if (action.action_type === 'final') info.finalPlain = action.plain ?? null;
|
|
248
|
-
|
|
249
|
-
const externalId = `${msg.inputId}-action-${action.id}`;
|
|
250
|
-
const mapped = mapActionToItem(action);
|
|
251
|
-
if (!mapped) continue;
|
|
252
|
-
|
|
253
|
-
// Idempotent upsert — skip when already projected (reconnect replay
|
|
254
|
-
// or snapshot overlap).
|
|
255
|
-
const existing = db
|
|
256
|
-
.prepare('SELECT id FROM items WHERE turn_id = ? AND external_item_id = ?')
|
|
257
|
-
.get(this.deps.turnId, externalId);
|
|
258
|
-
if (existing) continue;
|
|
259
|
-
|
|
260
|
-
insertItem(
|
|
261
|
-
db,
|
|
262
|
-
this.deps.agentPaneSessionId,
|
|
263
|
-
this.deps.turnId,
|
|
264
|
-
externalId,
|
|
265
|
-
mapped.type,
|
|
266
|
-
mapped.data,
|
|
267
|
-
mapped.status,
|
|
268
|
-
'item:completed',
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
this.touch();
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
private handleResult(msg: ResultMessage): void {
|
|
275
|
-
switch (msg.subtype) {
|
|
276
|
-
case 'success':
|
|
277
|
-
this.finishSuccess(msg);
|
|
278
|
-
break;
|
|
279
|
-
case 'aborted':
|
|
280
|
-
this.finishAborted();
|
|
281
|
-
break;
|
|
282
|
-
case 'error_during_execution':
|
|
283
|
-
default:
|
|
284
|
-
this.finishFailed((msg.errors ?? []).join('; ') || 'Agent turn failed.');
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// -------------------------------------------------------------------------
|
|
290
|
-
// Terminal states
|
|
291
|
-
// -------------------------------------------------------------------------
|
|
292
|
-
|
|
293
|
-
private finishSuccess(msg: ResultMessage): void {
|
|
294
|
-
const db = getDb();
|
|
295
|
-
const now = new Date().toISOString();
|
|
296
|
-
const lastRound = [...this.rounds.values()].pop();
|
|
297
|
-
|
|
298
|
-
const responseText = msg.result || lastRound?.text || lastRound?.finalPlain || '';
|
|
299
|
-
const usage = msg.usage
|
|
300
|
-
? mapUsage({
|
|
301
|
-
input: msg.usage.input_tokens,
|
|
302
|
-
cached: msg.usage.cache_read_input_tokens,
|
|
303
|
-
output: msg.usage.output_tokens,
|
|
304
|
-
})
|
|
305
|
-
: null;
|
|
306
|
-
|
|
307
|
-
this.closeOpenItems('completed');
|
|
308
|
-
db.prepare(
|
|
309
|
-
'UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?',
|
|
310
|
-
).run('completed', responseText || null, usage ? JSON.stringify(usage) : null, now, this.deps.turnId);
|
|
311
|
-
setSessionStatus(db, this.deps.agentPaneSessionId, 0, 'active', now, true);
|
|
312
|
-
|
|
313
|
-
broadcast('turn:completed', {
|
|
314
|
-
sessionId: this.deps.agentPaneSessionId,
|
|
315
|
-
turnId: this.deps.turnId,
|
|
316
|
-
...(usage ? { usage } : {}),
|
|
317
|
-
hasUnreviewed: true,
|
|
318
|
-
});
|
|
319
|
-
void this.syncTitle();
|
|
320
|
-
this.finalize();
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/** Fire-and-forget: copy the runtime session title once (new sessions). */
|
|
324
|
-
private async syncTitle(): Promise<void> {
|
|
325
|
-
try {
|
|
326
|
-
const db = getDb();
|
|
327
|
-
const session = db.prepare('SELECT title FROM sessions WHERE id = ?').get(
|
|
328
|
-
this.deps.agentPaneSessionId,
|
|
329
|
-
) as { title: string | null } | undefined;
|
|
330
|
-
if (!session || session.title) return;
|
|
331
|
-
|
|
332
|
-
const runtimeSession = await this.deps.client.getSession(this.deps.repoburgSessionId);
|
|
333
|
-
const title = (runtimeSession.session_title || '').trim();
|
|
334
|
-
if (!title) return;
|
|
335
|
-
|
|
336
|
-
const now = new Date().toISOString();
|
|
337
|
-
db.prepare('UPDATE sessions SET title = ?, updated_at = ? WHERE id = ?').run(
|
|
338
|
-
title,
|
|
339
|
-
now,
|
|
340
|
-
this.deps.agentPaneSessionId,
|
|
341
|
-
);
|
|
342
|
-
broadcast('session:title', { sessionId: this.deps.agentPaneSessionId, title });
|
|
343
|
-
} catch {
|
|
344
|
-
// Title sync is best-effort.
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
private finishFailed(error: string): void {
|
|
349
|
-
const db = getDb();
|
|
350
|
-
const now = new Date().toISOString();
|
|
351
|
-
this.closeOpenItems('failed');
|
|
352
|
-
db.prepare('UPDATE turns SET status = ?, error = ?, updated_at = ? WHERE id = ?').run(
|
|
353
|
-
'failed',
|
|
354
|
-
error,
|
|
355
|
-
now,
|
|
356
|
-
this.deps.turnId,
|
|
357
|
-
);
|
|
358
|
-
setSessionStatus(db, this.deps.agentPaneSessionId, 0, 'failed', now);
|
|
359
|
-
broadcast('turn:failed', {
|
|
360
|
-
sessionId: this.deps.agentPaneSessionId,
|
|
361
|
-
turnId: this.deps.turnId,
|
|
362
|
-
error,
|
|
363
|
-
});
|
|
364
|
-
this.finalize();
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
private finishAborted(): void {
|
|
368
|
-
const db = getDb();
|
|
369
|
-
const now = new Date().toISOString();
|
|
370
|
-
this.closeOpenItems('completed');
|
|
371
|
-
db.prepare('UPDATE turns SET status = ?, updated_at = ? WHERE id = ?').run(
|
|
372
|
-
'aborted',
|
|
373
|
-
now,
|
|
374
|
-
this.deps.turnId,
|
|
375
|
-
);
|
|
376
|
-
setSessionStatus(db, this.deps.agentPaneSessionId, 0, 'active', now);
|
|
377
|
-
broadcast('turn:cancelled', {
|
|
378
|
-
sessionId: this.deps.agentPaneSessionId,
|
|
379
|
-
turnId: this.deps.turnId,
|
|
380
|
-
});
|
|
381
|
-
this.finalize();
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
private finalize(): void {
|
|
385
|
-
this.clearWatchdog();
|
|
386
|
-
this.done = true;
|
|
387
|
-
this.deps.onFinished?.();
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/** Close every still in_progress item of this turn with the given status. */
|
|
391
|
-
private closeOpenItems(status: Item['status']): void {
|
|
392
|
-
const db = getDb();
|
|
393
|
-
const now = new Date().toISOString();
|
|
394
|
-
db.prepare('UPDATE items SET status = ?, updated_at = ? WHERE turn_id = ? AND status = ?').run(
|
|
395
|
-
status,
|
|
396
|
-
now,
|
|
397
|
-
this.deps.turnId,
|
|
398
|
-
'in_progress',
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
// -------------------------------------------------------------------------
|
|
403
|
-
// Watch-dog + snapshot reconcile
|
|
404
|
-
// -------------------------------------------------------------------------
|
|
405
|
-
|
|
406
|
-
private armResultWatchdog(): void {
|
|
407
|
-
if (this.done) return;
|
|
408
|
-
this.clearWatchdog();
|
|
409
|
-
this.resultTimer = setTimeout(() => {
|
|
410
|
-
void this.reconcileFromSnapshot();
|
|
411
|
-
}, RESULT_TIMEOUT_MS);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
private clearWatchdog(): void {
|
|
415
|
-
if (this.resultTimer) {
|
|
416
|
-
clearTimeout(this.resultTimer);
|
|
417
|
-
this.resultTimer = null;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/** Snapshot reconcile: project missing rounds from the runtime's HTTP
|
|
422
|
-
* snapshot, then complete the turn when the session stopped running. */
|
|
423
|
-
private async reconcileFromSnapshot(): Promise<void> {
|
|
424
|
-
if (this.done) return;
|
|
425
|
-
const { client, repoburgSessionId } = this.deps;
|
|
426
|
-
try {
|
|
427
|
-
const [inputs, session] = await Promise.all([
|
|
428
|
-
client.getSessionInputs(repoburgSessionId),
|
|
429
|
-
client.getSession(repoburgSessionId),
|
|
430
|
-
]);
|
|
431
|
-
if (this.done) return; // A result arrived while fetching.
|
|
432
|
-
|
|
433
|
-
for (const input of inputs) {
|
|
434
|
-
if (input.role === 'model') this.projectSnapshotRound(input);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
if (!session.is_running) {
|
|
438
|
-
// The loop is over — finish from the snapshot's last round.
|
|
439
|
-
const modelInputs = inputs.filter((i) => i.role === 'model');
|
|
440
|
-
const last = modelInputs[modelInputs.length - 1];
|
|
441
|
-
const lastRound = [...this.rounds.values()].pop();
|
|
442
|
-
const responseText =
|
|
443
|
-
lastRound?.text ||
|
|
444
|
-
lastRound?.finalPlain ||
|
|
445
|
-
extractFinalPlain(last) ||
|
|
446
|
-
last?.raw_llm_response ||
|
|
447
|
-
'';
|
|
448
|
-
const usage = last
|
|
449
|
-
? mapUsage({
|
|
450
|
-
input: last.input_token_count ?? 0,
|
|
451
|
-
cached: last.cached_token_count ?? 0,
|
|
452
|
-
output: last.output_token_count ?? 0,
|
|
453
|
-
})
|
|
454
|
-
: null;
|
|
455
|
-
const db = getDb();
|
|
456
|
-
const now = new Date().toISOString();
|
|
457
|
-
this.closeOpenItems('completed');
|
|
458
|
-
db.prepare(
|
|
459
|
-
'UPDATE turns SET status = ?, agent_response = ?, token_usage = ?, updated_at = ? WHERE id = ?',
|
|
460
|
-
).run('completed', responseText || null, usage ? JSON.stringify(usage) : null, now, this.deps.turnId);
|
|
461
|
-
setSessionStatus(db, this.deps.agentPaneSessionId, 0, 'active', now, true);
|
|
462
|
-
broadcast('turn:completed', {
|
|
463
|
-
sessionId: this.deps.agentPaneSessionId,
|
|
464
|
-
turnId: this.deps.turnId,
|
|
465
|
-
...(usage ? { usage } : {}),
|
|
466
|
-
hasUnreviewed: true,
|
|
467
|
-
});
|
|
468
|
-
void this.syncTitle();
|
|
469
|
-
this.finalize();
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// Still running — re-arm or give up.
|
|
474
|
-
if (this.extensions < MAX_RESULT_EXTENSIONS) {
|
|
475
|
-
this.extensions += 1;
|
|
476
|
-
this.armResultWatchdog();
|
|
477
|
-
} else {
|
|
478
|
-
this.finishFailed(
|
|
479
|
-
`No result within ${(RESULT_TIMEOUT_MS / 60_000) * (MAX_RESULT_EXTENSIONS + 1)} minutes — the runtime session is still running. Check repoburg logs.`,
|
|
480
|
-
);
|
|
481
|
-
}
|
|
482
|
-
} catch (err) {
|
|
483
|
-
console.error('[repoburg] snapshot reconcile failed:', err);
|
|
484
|
-
if (this.extensions < MAX_RESULT_EXTENSIONS) {
|
|
485
|
-
this.extensions += 1;
|
|
486
|
-
this.armResultWatchdog();
|
|
487
|
-
} else {
|
|
488
|
-
this.finishFailed(`Snapshot reconcile failed: ${(err as Error).message}`);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/** Project one round from the snapshot (idempotent — live-projected
|
|
494
|
-
* rounds already exist and are skipped). */
|
|
495
|
-
private projectSnapshotRound(input: RepoburgSessionInput): void {
|
|
496
|
-
if (!input.raw_llm_response && !input.thoughts && !input.aiActions?.length) return;
|
|
497
|
-
const info = this.round(input.id);
|
|
498
|
-
info.text = info.text || (input.raw_llm_response ?? '');
|
|
499
|
-
info.thoughts = info.thoughts || (input.thoughts ?? '');
|
|
500
|
-
|
|
501
|
-
this.upsertCompletedTextItem(info, 'message', info.text);
|
|
502
|
-
this.upsertCompletedTextItem(info, 'reasoning', info.thoughts);
|
|
503
|
-
|
|
504
|
-
const actions = [...(input.aiActions ?? [])].sort(
|
|
505
|
-
(a, b) => (a.order_of_execution ?? 0) - (b.order_of_execution ?? 0),
|
|
506
|
-
);
|
|
507
|
-
const db = getDb();
|
|
508
|
-
for (const action of actions) {
|
|
509
|
-
if (action.action_type === 'final') info.finalPlain = action.plain ?? null;
|
|
510
|
-
const mapped = mapActionToItem(action);
|
|
511
|
-
if (!mapped) continue;
|
|
512
|
-
const externalId = `${input.id}-action-${action.id}`;
|
|
513
|
-
const existing = db
|
|
514
|
-
.prepare('SELECT id FROM items WHERE turn_id = ? AND external_item_id = ?')
|
|
515
|
-
.get(this.deps.turnId, externalId);
|
|
516
|
-
if (existing) continue;
|
|
517
|
-
insertItem(
|
|
518
|
-
db,
|
|
519
|
-
this.deps.agentPaneSessionId,
|
|
520
|
-
this.deps.turnId,
|
|
521
|
-
externalId,
|
|
522
|
-
mapped.type,
|
|
523
|
-
mapped.data,
|
|
524
|
-
mapped.status,
|
|
525
|
-
'item:completed',
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
/** Extract the plain text of a final/html_final action from a snapshot input. */
|
|
532
|
-
function extractFinalPlain(input: RepoburgSessionInput | undefined): string | null {
|
|
533
|
-
const action = input?.aiActions?.find(
|
|
534
|
-
(a) => a.action_type === 'final' || a.action_type === 'html_final',
|
|
535
|
-
);
|
|
536
|
-
return action?.plain ?? null;
|
|
537
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { FastifyInstance } from 'fastify';
|
|
2
|
-
import { getSharedAppServer } from '../codex/shared-app-server.ts';
|
|
3
|
-
import type { FileSearchResult } from '../codex/app-server-types.ts';
|
|
4
|
-
|
|
5
|
-
/** Register file search routes. */
|
|
6
|
-
export async function registerFileRoutes(fastify: FastifyInstance): Promise<void> {
|
|
7
|
-
// GET /api/files/search?q=...&cwd=... — fuzzy file search via app-server
|
|
8
|
-
fastify.get<{ Querystring: { q?: string; cwd?: string } }>('/api/files/search', async (request) => {
|
|
9
|
-
const { q = '', cwd = process.cwd() } = request.query;
|
|
10
|
-
|
|
11
|
-
if (!q.trim()) {
|
|
12
|
-
return { entries: [], truncated: false };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
const result = await getSharedAppServer().request<FileSearchResult>('fuzzyFileSearch', {
|
|
17
|
-
query: q,
|
|
18
|
-
roots: [cwd],
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const entries = (result.results ?? []).map((r) => ({
|
|
22
|
-
path: r.path,
|
|
23
|
-
kind: r.match_type,
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
return { entries, truncated: false };
|
|
27
|
-
} catch {
|
|
28
|
-
return { entries: [], truncated: false };
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { FastifyInstance } from 'fastify';
|
|
2
|
-
import type { Extension } from '@agentpane/shared';
|
|
3
|
-
import { getSharedAppServer } from '../codex/shared-app-server.ts';
|
|
4
|
-
import type { McpListResult, AppServerMcpServer } from '../codex/app-server-types.ts';
|
|
5
|
-
|
|
6
|
-
/** Map an app-server MCP server to the shared Extension type. */
|
|
7
|
-
function mapMcpServer(server: AppServerMcpServer): Extension {
|
|
8
|
-
return {
|
|
9
|
-
id: server.name,
|
|
10
|
-
name: server.serverInfo?.title ?? server.name,
|
|
11
|
-
description: server.serverInfo?.description ?? '',
|
|
12
|
-
type: 'mcp-server',
|
|
13
|
-
enabled: true,
|
|
14
|
-
metadata: {
|
|
15
|
-
version: server.serverInfo?.version,
|
|
16
|
-
authStatus: server.authStatus,
|
|
17
|
-
hasTools: Boolean(server.tools && Object.keys(server.tools).length > 0),
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** Register MCP routes. */
|
|
23
|
-
export async function registerMcpRoutes(fastify: FastifyInstance): Promise<void> {
|
|
24
|
-
// GET /api/mcp — list all MCP servers from the app-server
|
|
25
|
-
fastify.get('/api/mcp', async () => {
|
|
26
|
-
const result = await getSharedAppServer().request<McpListResult>('mcpServerStatus/list', {
|
|
27
|
-
detail: 'toolsAndAuthOnly',
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const servers: Extension[] = (result.data ?? []).map(mapMcpServer);
|
|
31
|
-
return servers;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
-
import Fastify, { type FastifyInstance } from 'fastify';
|
|
3
|
-
import type { ModelInfo } from '@agentpane/shared';
|
|
4
|
-
|
|
5
|
-
// Mock registry to return a mock provider with getModels()
|
|
6
|
-
const mocks = vi.hoisted(() => ({
|
|
7
|
-
getModels: vi.fn().mockResolvedValue([]),
|
|
8
|
-
}));
|
|
9
|
-
|
|
10
|
-
vi.mock('../providers/registry.ts', () => ({
|
|
11
|
-
getProvider: vi.fn(() => ({
|
|
12
|
-
getModels: mocks.getModels,
|
|
13
|
-
startTurn: vi.fn(),
|
|
14
|
-
interruptTurn: vi.fn(),
|
|
15
|
-
clearThread: vi.fn(),
|
|
16
|
-
clearAllThreads: vi.fn(),
|
|
17
|
-
shutdown: vi.fn(),
|
|
18
|
-
})),
|
|
19
|
-
hasProvider: vi.fn(() => true),
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
import { registerModelRoutes } from './models.ts';
|
|
23
|
-
import { hasProvider } from '../providers/registry.ts';
|
|
24
|
-
|
|
25
|
-
const MOCK_MODELS: ModelInfo[] = [
|
|
26
|
-
{
|
|
27
|
-
slug: 'gpt-5.6-sol',
|
|
28
|
-
displayName: 'GPT-5.6-Sol',
|
|
29
|
-
description: 'Flagship model',
|
|
30
|
-
defaultReasoning: 'low',
|
|
31
|
-
reasoningLevels: [
|
|
32
|
-
{ effort: 'low', label: 'Low' },
|
|
33
|
-
{ effort: 'high', label: 'High' },
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
slug: 'gpt-5.4',
|
|
38
|
-
displayName: 'GPT-5.4',
|
|
39
|
-
description: 'Everyday model',
|
|
40
|
-
defaultReasoning: 'medium',
|
|
41
|
-
reasoningLevels: [
|
|
42
|
-
{ effort: 'low', label: 'Low' },
|
|
43
|
-
{ effort: 'medium', label: 'Medium' },
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
describe('Model routes', () => {
|
|
49
|
-
let app: FastifyInstance;
|
|
50
|
-
|
|
51
|
-
beforeEach(async () => {
|
|
52
|
-
vi.clearAllMocks();
|
|
53
|
-
vi.mocked(hasProvider).mockReturnValue(true);
|
|
54
|
-
mocks.getModels.mockResolvedValue(MOCK_MODELS);
|
|
55
|
-
app = Fastify();
|
|
56
|
-
await registerModelRoutes(app);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
describe('GET /api/providers/:id/models', () => {
|
|
60
|
-
it('returns model list for codex', async () => {
|
|
61
|
-
const res = await app.inject({ method: 'GET', url: '/api/providers/codex/models' });
|
|
62
|
-
expect(res.statusCode).toBe(200);
|
|
63
|
-
const models = res.json();
|
|
64
|
-
expect(models).toHaveLength(2);
|
|
65
|
-
|
|
66
|
-
expect(models[0].slug).toBe('gpt-5.6-sol');
|
|
67
|
-
expect(models[0].displayName).toBe('GPT-5.6-Sol');
|
|
68
|
-
expect(models[0].description).toBe('Flagship model');
|
|
69
|
-
expect(models[0].defaultReasoning).toBe('low');
|
|
70
|
-
expect(models[0].reasoningLevels).toEqual([
|
|
71
|
-
{ effort: 'low', label: 'Low' },
|
|
72
|
-
{ effort: 'high', label: 'High' },
|
|
73
|
-
]);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('returns 404 for unregistered provider', async () => {
|
|
77
|
-
// Override hasProvider to return false for this test
|
|
78
|
-
const { hasProvider } = await import('../providers/registry.ts');
|
|
79
|
-
vi.mocked(hasProvider).mockReturnValue(false);
|
|
80
|
-
const res = await app.inject({ method: 'GET', url: '/api/providers/unknown/models' });
|
|
81
|
-
expect(res.statusCode).toBe(404);
|
|
82
|
-
expect(res.json()).toEqual({ error: 'No models available for provider: unknown' });
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('returns empty array when provider getModels fails', async () => {
|
|
86
|
-
mocks.getModels.mockResolvedValue([]);
|
|
87
|
-
const res = await app.inject({ method: 'GET', url: '/api/providers/codex/models' });
|
|
88
|
-
expect(res.statusCode).toBe(200);
|
|
89
|
-
expect(res.json()).toEqual([]);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|