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,226 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
|
-
import { render, screen, fireEvent, cleanup } from '@testing-library/react';
|
|
3
|
-
import CommandPalette from './CommandPalette.tsx';
|
|
4
|
-
import { resetStore } from '../test/component-helpers.ts';
|
|
5
|
-
import { makeSession, makeDetail } from '../test/fixtures.ts';
|
|
6
|
-
|
|
7
|
-
describe('CommandPalette', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
resetStore();
|
|
10
|
-
});
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
cleanup();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('returns null when show=false', () => {
|
|
16
|
-
const { container } = render(<CommandPalette />);
|
|
17
|
-
expect(container.firstChild).toBeNull();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('renders search input when show=true', () => {
|
|
21
|
-
resetStore({ showCommandPalette: true });
|
|
22
|
-
render(<CommandPalette />);
|
|
23
|
-
expect(screen.getByPlaceholderText('Type a command…')).toBeInTheDocument();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('shows all available commands when query is empty', () => {
|
|
27
|
-
resetStore({ showCommandPalette: true });
|
|
28
|
-
render(<CommandPalette />);
|
|
29
|
-
// "New Session" is always available
|
|
30
|
-
expect(screen.getByText('New Session')).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('filters commands by query', () => {
|
|
34
|
-
resetStore({ showCommandPalette: true });
|
|
35
|
-
render(<CommandPalette />);
|
|
36
|
-
const input = screen.getByPlaceholderText('Type a command…');
|
|
37
|
-
fireEvent.change(input, { target: { value: 'new' } });
|
|
38
|
-
expect(screen.getByText('New Session')).toBeInTheDocument();
|
|
39
|
-
expect(screen.queryByText('Close Tab')).not.toBeInTheDocument();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('shows "No matching commands" when filter empty', () => {
|
|
43
|
-
resetStore({ showCommandPalette: true });
|
|
44
|
-
render(<CommandPalette />);
|
|
45
|
-
const input = screen.getByPlaceholderText('Type a command…');
|
|
46
|
-
fireEvent.change(input, { target: { value: 'xyzzy' } });
|
|
47
|
-
expect(screen.getByText('No matching commands')).toBeInTheDocument();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('ArrowDown moves selection down', () => {
|
|
51
|
-
// Need active session so multiple commands are available
|
|
52
|
-
const session = makeSession('s1');
|
|
53
|
-
const detail = makeDetail('s1', []);
|
|
54
|
-
resetStore({ showCommandPalette: true, activeSessionId: 's1', sessions: [session], sessionDetails: { s1: detail } });
|
|
55
|
-
render(<CommandPalette />);
|
|
56
|
-
const input = screen.getByPlaceholderText('Type a command…');
|
|
57
|
-
fireEvent.keyDown(input, { key: 'ArrowDown' });
|
|
58
|
-
const items = document.querySelectorAll('.palette-item');
|
|
59
|
-
expect(items[1]).toHaveClass('selected');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('ArrowUp moves selection up', () => {
|
|
63
|
-
const session = makeSession('s1');
|
|
64
|
-
const detail = makeDetail('s1', []);
|
|
65
|
-
resetStore({ showCommandPalette: true, activeSessionId: 's1', sessions: [session], sessionDetails: { s1: detail } });
|
|
66
|
-
render(<CommandPalette />);
|
|
67
|
-
const input = screen.getByPlaceholderText('Type a command…');
|
|
68
|
-
// Move down twice, then up once
|
|
69
|
-
fireEvent.keyDown(input, { key: 'ArrowDown' });
|
|
70
|
-
fireEvent.keyDown(input, { key: 'ArrowDown' });
|
|
71
|
-
fireEvent.keyDown(input, { key: 'ArrowUp' });
|
|
72
|
-
const items = document.querySelectorAll('.palette-item');
|
|
73
|
-
expect(items[1]).toHaveClass('selected');
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('Enter executes selected command and closes palette', () => {
|
|
77
|
-
const setShowCommandPalette = vi.fn();
|
|
78
|
-
const setShowNewSessionDialog = vi.fn();
|
|
79
|
-
resetStore({ showCommandPalette: true, setShowCommandPalette, setShowNewSessionDialog });
|
|
80
|
-
render(<CommandPalette />);
|
|
81
|
-
const input = screen.getByPlaceholderText('Type a command…');
|
|
82
|
-
fireEvent.keyDown(input, { key: 'Enter' });
|
|
83
|
-
// First command is "New Session" — always available
|
|
84
|
-
expect(setShowNewSessionDialog).toHaveBeenCalledWith(true);
|
|
85
|
-
expect(setShowCommandPalette).toHaveBeenCalledWith(false);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('ESC closes palette', () => {
|
|
89
|
-
const setShowCommandPalette = vi.fn();
|
|
90
|
-
resetStore({ showCommandPalette: true, setShowCommandPalette });
|
|
91
|
-
render(<CommandPalette />);
|
|
92
|
-
fireEvent.keyDown(screen.getByPlaceholderText('Type a command…'), { key: 'Escape' });
|
|
93
|
-
expect(setShowCommandPalette).toHaveBeenCalledWith(false);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('click on command executes and closes', () => {
|
|
97
|
-
const setShowCommandPalette = vi.fn();
|
|
98
|
-
const setShowNewSessionDialog = vi.fn();
|
|
99
|
-
resetStore({ showCommandPalette: true, setShowCommandPalette, setShowNewSessionDialog });
|
|
100
|
-
render(<CommandPalette />);
|
|
101
|
-
fireEvent.click(screen.getByText('New Session'));
|
|
102
|
-
expect(setShowNewSessionDialog).toHaveBeenCalledWith(true);
|
|
103
|
-
expect(setShowCommandPalette).toHaveBeenCalledWith(false);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// --- command actions ---
|
|
107
|
-
|
|
108
|
-
it('Delete Session action calls deleteSession', () => {
|
|
109
|
-
const setShowCommandPalette = vi.fn();
|
|
110
|
-
const deleteSession = vi.fn().mockResolvedValue(undefined);
|
|
111
|
-
const session = makeSession('s1');
|
|
112
|
-
resetStore({
|
|
113
|
-
showCommandPalette: true,
|
|
114
|
-
activeSessionId: 's1',
|
|
115
|
-
sessions: [session],
|
|
116
|
-
setShowCommandPalette,
|
|
117
|
-
deleteSession,
|
|
118
|
-
});
|
|
119
|
-
render(<CommandPalette />);
|
|
120
|
-
fireEvent.click(screen.getByText('Delete Session'));
|
|
121
|
-
expect(deleteSession).toHaveBeenCalledWith('s1');
|
|
122
|
-
expect(setShowCommandPalette).toHaveBeenCalledWith(false);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('Send Message action focuses .cmd-input element', () => {
|
|
126
|
-
// Stub a mock input element with focus
|
|
127
|
-
const mockFocus = vi.fn();
|
|
128
|
-
const mockInput = { focus: mockFocus } as unknown as HTMLInputElement;
|
|
129
|
-
const origQuery = document.querySelector;
|
|
130
|
-
document.querySelector = vi.fn((sel: string) =>
|
|
131
|
-
sel === '.cmd-input' ? mockInput : origQuery.call(document, sel),
|
|
132
|
-
) as typeof document.querySelector;
|
|
133
|
-
|
|
134
|
-
const session = makeSession('s1');
|
|
135
|
-
const detail = makeDetail('s1', []);
|
|
136
|
-
resetStore({
|
|
137
|
-
showCommandPalette: true,
|
|
138
|
-
activeSessionId: 's1',
|
|
139
|
-
sessions: [session],
|
|
140
|
-
sessionDetails: { s1: detail },
|
|
141
|
-
});
|
|
142
|
-
render(<CommandPalette />);
|
|
143
|
-
fireEvent.click(screen.getByText('Send Message'));
|
|
144
|
-
expect(mockFocus).toHaveBeenCalled();
|
|
145
|
-
document.querySelector = origQuery;
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('Cancel Turn action calls cancelTurn when running', () => {
|
|
149
|
-
const setShowCommandPalette = vi.fn();
|
|
150
|
-
const cancelTurn = vi.fn().mockResolvedValue(undefined);
|
|
151
|
-
const session = makeSession('s1', { is_running: 1 });
|
|
152
|
-
const detail = makeDetail('s1', [], { is_running: 1 });
|
|
153
|
-
resetStore({
|
|
154
|
-
showCommandPalette: true,
|
|
155
|
-
activeSessionId: 's1',
|
|
156
|
-
sessions: [session],
|
|
157
|
-
sessionDetails: { s1: detail },
|
|
158
|
-
setShowCommandPalette,
|
|
159
|
-
cancelTurn,
|
|
160
|
-
});
|
|
161
|
-
render(<CommandPalette />);
|
|
162
|
-
fireEvent.click(screen.getByText('Cancel Turn'));
|
|
163
|
-
expect(cancelTurn).toHaveBeenCalled();
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('tab-switch commands call switchRightTab with correct tab', () => {
|
|
167
|
-
const switchRightTab = vi.fn();
|
|
168
|
-
const session = makeSession('s1');
|
|
169
|
-
const detail = makeDetail('s1', []);
|
|
170
|
-
resetStore({
|
|
171
|
-
showCommandPalette: true,
|
|
172
|
-
activeSessionId: 's1',
|
|
173
|
-
sessions: [session],
|
|
174
|
-
sessionDetails: { s1: detail },
|
|
175
|
-
switchRightTab,
|
|
176
|
-
});
|
|
177
|
-
render(<CommandPalette />);
|
|
178
|
-
fireEvent.click(screen.getByText('Switch to Turns Tab'));
|
|
179
|
-
expect(switchRightTab).toHaveBeenCalledWith('turns');
|
|
180
|
-
fireEvent.click(screen.getByText('Switch to Changes Tab'));
|
|
181
|
-
expect(switchRightTab).toHaveBeenCalledWith('changes');
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it('Close Tab action calls closeTab', () => {
|
|
185
|
-
const setShowCommandPalette = vi.fn();
|
|
186
|
-
const closeTab = vi.fn().mockResolvedValue(undefined);
|
|
187
|
-
const session = makeSession('s1');
|
|
188
|
-
resetStore({
|
|
189
|
-
showCommandPalette: true,
|
|
190
|
-
activeSessionId: 's1',
|
|
191
|
-
sessions: [session],
|
|
192
|
-
setShowCommandPalette,
|
|
193
|
-
closeTab,
|
|
194
|
-
});
|
|
195
|
-
render(<CommandPalette />);
|
|
196
|
-
fireEvent.click(screen.getByText('Close Tab'));
|
|
197
|
-
expect(closeTab).toHaveBeenCalledWith('s1');
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
// --- UI interactions ---
|
|
201
|
-
|
|
202
|
-
it('overlay click closes palette', () => {
|
|
203
|
-
const setShowCommandPalette = vi.fn();
|
|
204
|
-
resetStore({ showCommandPalette: true, setShowCommandPalette });
|
|
205
|
-
render(<CommandPalette />);
|
|
206
|
-
fireEvent.click(document.querySelector('.palette-overlay')!);
|
|
207
|
-
expect(setShowCommandPalette).toHaveBeenCalledWith(false);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it('mouse enter on item sets selected class', () => {
|
|
211
|
-
const session = makeSession('s1');
|
|
212
|
-
const detail = makeDetail('s1', []);
|
|
213
|
-
resetStore({
|
|
214
|
-
showCommandPalette: true,
|
|
215
|
-
activeSessionId: 's1',
|
|
216
|
-
sessions: [session],
|
|
217
|
-
sessionDetails: { s1: detail },
|
|
218
|
-
});
|
|
219
|
-
render(<CommandPalette />);
|
|
220
|
-
const items = document.querySelectorAll('.palette-item');
|
|
221
|
-
// Hover over second item
|
|
222
|
-
fireEvent.mouseEnter(items[1]);
|
|
223
|
-
expect(items[1]).toHaveClass('selected');
|
|
224
|
-
expect(items[0]).not.toHaveClass('selected');
|
|
225
|
-
});
|
|
226
|
-
});
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, useRef, useMemo } from 'react';
|
|
2
|
-
import { useStore } from '../store/store.ts';
|
|
3
|
-
import { Plus, Trash2, Send, Square, List, FileCode, X, CornerDownLeft } from 'lucide-react';
|
|
4
|
-
import type { RightTab } from '../types/index.ts';
|
|
5
|
-
|
|
6
|
-
interface Command {
|
|
7
|
-
id: string;
|
|
8
|
-
label: string;
|
|
9
|
-
hint: string;
|
|
10
|
-
icon: typeof Plus;
|
|
11
|
-
action: () => void;
|
|
12
|
-
available: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function CommandPalette() {
|
|
16
|
-
const show = useStore((s) => s.showCommandPalette);
|
|
17
|
-
const setShow = useStore((s) => s.setShowCommandPalette);
|
|
18
|
-
const store = useStore();
|
|
19
|
-
|
|
20
|
-
const [query, setQuery] = useState('');
|
|
21
|
-
const [selectedIdx, setSelectedIdx] = useState(0);
|
|
22
|
-
const inputRef = useRef<HTMLInputElement>(null);
|
|
23
|
-
|
|
24
|
-
// Build commands
|
|
25
|
-
const commands: Command[] = useMemo(() => {
|
|
26
|
-
const detail = store.activeSessionId ? store.sessionDetails[store.activeSessionId] : null;
|
|
27
|
-
const isRunning = detail?.is_running === 1;
|
|
28
|
-
|
|
29
|
-
return [
|
|
30
|
-
{
|
|
31
|
-
id: 'new-session',
|
|
32
|
-
label: 'New Session',
|
|
33
|
-
hint: 'Create a new Codex session',
|
|
34
|
-
icon: Plus,
|
|
35
|
-
action: () => store.setShowNewSessionDialog(true),
|
|
36
|
-
available: true,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: 'delete-session',
|
|
40
|
-
label: 'Delete Session',
|
|
41
|
-
hint: 'Delete the active session',
|
|
42
|
-
icon: Trash2,
|
|
43
|
-
action: () => {
|
|
44
|
-
if (store.activeSessionId) store.deleteSession(store.activeSessionId);
|
|
45
|
-
},
|
|
46
|
-
available: !!store.activeSessionId,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: 'send-message',
|
|
50
|
-
label: 'Send Message',
|
|
51
|
-
hint: 'Focus the message input',
|
|
52
|
-
icon: Send,
|
|
53
|
-
action: () => {
|
|
54
|
-
const el = document.querySelector<HTMLInputElement>('.cmd-input');
|
|
55
|
-
el?.focus();
|
|
56
|
-
},
|
|
57
|
-
available: !!store.activeSessionId && !isRunning,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: 'cancel-turn',
|
|
61
|
-
label: 'Cancel Turn',
|
|
62
|
-
hint: 'Cancel the running turn',
|
|
63
|
-
icon: Square,
|
|
64
|
-
action: () => store.cancelTurn(),
|
|
65
|
-
available: isRunning,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
id: 'tab-turns',
|
|
69
|
-
label: 'Switch to Turns Tab',
|
|
70
|
-
hint: 'View conversation timeline',
|
|
71
|
-
icon: List,
|
|
72
|
-
action: () => store.switchRightTab('turns' as RightTab),
|
|
73
|
-
available: !!store.activeSessionId,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
id: 'tab-changes',
|
|
77
|
-
label: 'Switch to Changes Tab',
|
|
78
|
-
hint: 'View file changes',
|
|
79
|
-
icon: FileCode,
|
|
80
|
-
action: () => store.switchRightTab('changes' as RightTab),
|
|
81
|
-
available: !!store.activeSessionId,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
id: 'close-tab',
|
|
85
|
-
label: 'Close Tab',
|
|
86
|
-
hint: 'Close the active session tab',
|
|
87
|
-
icon: X,
|
|
88
|
-
action: () => {
|
|
89
|
-
if (store.activeSessionId) store.closeTab(store.activeSessionId);
|
|
90
|
-
},
|
|
91
|
-
available: !!store.activeSessionId,
|
|
92
|
-
},
|
|
93
|
-
];
|
|
94
|
-
}, [store]);
|
|
95
|
-
|
|
96
|
-
// Filter commands
|
|
97
|
-
const filtered = useMemo(() => {
|
|
98
|
-
const q = query.toLowerCase().trim();
|
|
99
|
-
const available = commands.filter((c) => c.available);
|
|
100
|
-
if (!q) return available;
|
|
101
|
-
return available.filter((c) => c.label.toLowerCase().includes(q) || c.hint.toLowerCase().includes(q));
|
|
102
|
-
}, [commands, query]);
|
|
103
|
-
|
|
104
|
-
// Reset on open
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
if (show) {
|
|
107
|
-
setQuery('');
|
|
108
|
-
setSelectedIdx(0);
|
|
109
|
-
setTimeout(() => inputRef.current?.focus(), 50);
|
|
110
|
-
}
|
|
111
|
-
}, [show]);
|
|
112
|
-
|
|
113
|
-
// Keyboard navigation
|
|
114
|
-
function handleKeyDown(e: React.KeyboardEvent) {
|
|
115
|
-
if (e.key === 'ArrowDown') {
|
|
116
|
-
e.preventDefault();
|
|
117
|
-
setSelectedIdx((i) => Math.min(i + 1, filtered.length - 1));
|
|
118
|
-
} else if (e.key === 'ArrowUp') {
|
|
119
|
-
e.preventDefault();
|
|
120
|
-
setSelectedIdx((i) => Math.max(i - 1, 0));
|
|
121
|
-
} else if (e.key === 'Enter') {
|
|
122
|
-
e.preventDefault();
|
|
123
|
-
const cmd = filtered[selectedIdx];
|
|
124
|
-
if (cmd) {
|
|
125
|
-
cmd.action();
|
|
126
|
-
setShow(false);
|
|
127
|
-
}
|
|
128
|
-
} else if (e.key === 'Escape') {
|
|
129
|
-
setShow(false);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (!show) return null;
|
|
134
|
-
|
|
135
|
-
return (
|
|
136
|
-
<div className="palette-overlay" onClick={() => setShow(false)}>
|
|
137
|
-
<div className="palette" onClick={(e) => e.stopPropagation()}>
|
|
138
|
-
<div className="palette-search">
|
|
139
|
-
<input
|
|
140
|
-
ref={inputRef}
|
|
141
|
-
type="text"
|
|
142
|
-
placeholder="Type a command…"
|
|
143
|
-
value={query}
|
|
144
|
-
onChange={(e) => {
|
|
145
|
-
setQuery(e.target.value);
|
|
146
|
-
setSelectedIdx(0);
|
|
147
|
-
}}
|
|
148
|
-
onKeyDown={handleKeyDown}
|
|
149
|
-
/>
|
|
150
|
-
<span className="palette-esc">ESC</span>
|
|
151
|
-
</div>
|
|
152
|
-
{filtered.length === 0 ? (
|
|
153
|
-
<div className="palette-empty">No matching commands</div>
|
|
154
|
-
) : (
|
|
155
|
-
<div className="palette-list">
|
|
156
|
-
{filtered.map((cmd, i) => {
|
|
157
|
-
const Icon = cmd.icon;
|
|
158
|
-
return (
|
|
159
|
-
<div
|
|
160
|
-
key={cmd.id}
|
|
161
|
-
className={`palette-item ${i === selectedIdx ? 'selected' : ''}`}
|
|
162
|
-
onClick={() => {
|
|
163
|
-
cmd.action();
|
|
164
|
-
setShow(false);
|
|
165
|
-
}}
|
|
166
|
-
onMouseEnter={() => setSelectedIdx(i)}
|
|
167
|
-
>
|
|
168
|
-
<span className="palette-item-icon">
|
|
169
|
-
<Icon size={16} />
|
|
170
|
-
</span>
|
|
171
|
-
<span className="palette-item-label">{cmd.label}</span>
|
|
172
|
-
<span className="palette-item-hint">{cmd.hint}</span>
|
|
173
|
-
{i === selectedIdx && <CornerDownLeft size={12} className="palette-item-enter" />}
|
|
174
|
-
</div>
|
|
175
|
-
);
|
|
176
|
-
})}
|
|
177
|
-
</div>
|
|
178
|
-
)}
|
|
179
|
-
<div className="palette-footer">
|
|
180
|
-
<span className="palette-footer-hint">
|
|
181
|
-
<span className="kbd">↑</span>
|
|
182
|
-
<span className="kbd">↓</span> Navigate
|
|
183
|
-
</span>
|
|
184
|
-
<span className="palette-footer-hint">
|
|
185
|
-
<span className="kbd">↵</span> Select
|
|
186
|
-
</span>
|
|
187
|
-
<span className="palette-footer-hint">
|
|
188
|
-
<span className="kbd">Esc</span> Close
|
|
189
|
-
</span>
|
|
190
|
-
</div>
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
);
|
|
194
|
-
}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import { render, screen, fireEvent, cleanup, act } from '@testing-library/react';
|
|
3
|
-
import CommentableText from './CommentableText.tsx';
|
|
4
|
-
import { resetStore } from '../test/component-helpers.ts';
|
|
5
|
-
import { useStore } from '../store/store.ts';
|
|
6
|
-
|
|
7
|
-
const CONTENT = 'Hello world this is a line of text';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Select a character range within the rendered markdown container's text node.
|
|
11
|
-
* `backward` emulates a drag selection from end -> start by collapsing the
|
|
12
|
-
* caret to the end and extending it back to the start (anchor after focus).
|
|
13
|
-
*/
|
|
14
|
-
function selectChars(startChar: number, endChar: number, backward: boolean): void {
|
|
15
|
-
const p = screen.getByText(CONTENT);
|
|
16
|
-
const textNode = p.firstChild as Text;
|
|
17
|
-
const sel = window.getSelection()!;
|
|
18
|
-
sel.removeAllRanges();
|
|
19
|
-
if (backward) {
|
|
20
|
-
// anchor at the end, then extend the focus back to the start
|
|
21
|
-
sel.collapse(textNode, endChar);
|
|
22
|
-
sel.extend(textNode, startChar);
|
|
23
|
-
} else {
|
|
24
|
-
sel.collapse(textNode, startChar);
|
|
25
|
-
sel.extend(textNode, endChar);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Dispatch a native `mouseup` whose target is OUTSIDE the markdown container
|
|
30
|
-
* (on document.body), eminating a release in the surrounding padding/gutter. */
|
|
31
|
-
function dispatchMouseUpOutside(): void {
|
|
32
|
-
const evt = new MouseEvent('mouseup', { bubbles: true });
|
|
33
|
-
document.body.dispatchEvent(evt);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** Open the discuss popover via a backward selection + Discuss click. Returns the textarea. */
|
|
37
|
-
function openDiscuss(): HTMLTextAreaElement {
|
|
38
|
-
selectChars(0, 5, true);
|
|
39
|
-
act(() => {
|
|
40
|
-
dispatchMouseUpOutside();
|
|
41
|
-
});
|
|
42
|
-
fireEvent.click(screen.getByText('Discuss'));
|
|
43
|
-
return screen.getByPlaceholderText('Ask about this text…') as HTMLTextAreaElement;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
describe('CommentableText — selection quote button', () => {
|
|
47
|
-
beforeEach(() => {
|
|
48
|
-
resetStore();
|
|
49
|
-
// jsdom has no layout engine, so Range lacks getBoundingClientRect/getClientRects.
|
|
50
|
-
// Polyfill with zero rects so the production positioning code can run.
|
|
51
|
-
const zeroRect = {
|
|
52
|
-
x: 0, y: 0, top: 0, left: 0, right: 0, bottom: 0, width: 0, height: 0,
|
|
53
|
-
toJSON: () => ({}),
|
|
54
|
-
};
|
|
55
|
-
(Range.prototype as unknown as { getBoundingClientRect: unknown }).getBoundingClientRect =
|
|
56
|
-
() => zeroRect;
|
|
57
|
-
(Range.prototype as unknown as { getClientRects: unknown }).getClientRects = () => [];
|
|
58
|
-
// jsdom has no layout, so offsetWidth/offsetHeight are 0. Mock the popover
|
|
59
|
-
// dimensions so the viewport-clamp logic in useLayoutEffect can be exercised.
|
|
60
|
-
Object.defineProperty(HTMLElement.prototype, 'offsetWidth', { configurable: true, get: () => 320 });
|
|
61
|
-
Object.defineProperty(HTMLElement.prototype, 'offsetHeight', { configurable: true, get: () => 140 });
|
|
62
|
-
});
|
|
63
|
-
afterEach(() => {
|
|
64
|
-
cleanup();
|
|
65
|
-
window.getSelection()?.removeAllRanges();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('shows the Quote button when a forward selection is released outside the container', () => {
|
|
69
|
-
render(
|
|
70
|
-
<CommentableText itemId="i1" turnId="t1" sessionId="s1" content={CONTENT} threads={[]} />,
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
selectChars(0, 5, false);
|
|
74
|
-
act(() => {
|
|
75
|
-
dispatchMouseUpOutside();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Before the fix, the container-only onMouseUp never fired for a release
|
|
79
|
-
// outside the container, so the button did not appear.
|
|
80
|
-
expect(screen.getByText('Quote')).toBeInTheDocument();
|
|
81
|
-
expect(screen.getByText('Discuss')).toBeInTheDocument();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('shows the Quote button for a backward selection dragged to the line start (the reported bug)', () => {
|
|
85
|
-
render(
|
|
86
|
-
<CommentableText itemId="i1" turnId="t1" sessionId="s1" content={CONTENT} threads={[]} />,
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
// Drag from the very end back to the very start (line start).
|
|
90
|
-
selectChars(0, CONTENT.length, true);
|
|
91
|
-
act(() => {
|
|
92
|
-
dispatchMouseUpOutside();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
expect(screen.getByText('Quote')).toBeInTheDocument();
|
|
96
|
-
expect(screen.getByText('Discuss')).toBeInTheDocument();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('populates the store quotedText when Quote is clicked after a backward selection', () => {
|
|
100
|
-
render(
|
|
101
|
-
<CommentableText itemId="i1" turnId="t1" sessionId="s1" content={CONTENT} threads={[]} />,
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
selectChars(0, 5, true);
|
|
105
|
-
act(() => {
|
|
106
|
-
dispatchMouseUpOutside();
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
fireEvent.click(screen.getByText('Quote'));
|
|
110
|
-
|
|
111
|
-
const quoted = useStore.getState().quotedText;
|
|
112
|
-
expect(quoted).toBeTruthy();
|
|
113
|
-
expect(quoted).toContain('QUOTE');
|
|
114
|
-
expect(quoted).toContain('Hello');
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('keeps the discuss popover on-screen for a backward selection near the left edge', () => {
|
|
118
|
-
render(
|
|
119
|
-
<CommentableText itemId="i1" turnId="t1" sessionId="s1" content={CONTENT} threads={[]} />,
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
// Backward selection near the start anchors the button at the left edge.
|
|
123
|
-
selectChars(0, 5, true);
|
|
124
|
-
act(() => {
|
|
125
|
-
dispatchMouseUpOutside();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
fireEvent.click(screen.getByText('Discuss'));
|
|
129
|
-
|
|
130
|
-
const popover = document.querySelector('.thread-create-popover') as HTMLElement;
|
|
131
|
-
expect(popover).toBeTruthy();
|
|
132
|
-
const left = parseFloat(popover.style.left);
|
|
133
|
-
const top = parseFloat(popover.style.top);
|
|
134
|
-
// Popover opens to the left via translateX(-100%): visible left edge = left - 320.
|
|
135
|
-
// It must stay on-screen: left edge >= 8 → left >= 328.
|
|
136
|
-
expect(left).toBeGreaterThanOrEqual(328);
|
|
137
|
-
// Right edge (= left) must not overflow the viewport right.
|
|
138
|
-
expect(left).toBeLessThanOrEqual(window.innerWidth - 8);
|
|
139
|
-
// Top edge must be within the viewport.
|
|
140
|
-
expect(top).toBeGreaterThanOrEqual(8);
|
|
141
|
-
expect(top + 140).toBeLessThanOrEqual(window.innerHeight - 8);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('auto-dismisses the popover on outside click when empty', () => {
|
|
145
|
-
render(
|
|
146
|
-
<CommentableText itemId="i1" turnId="t1" sessionId="s1" content={CONTENT} threads={[]} />,
|
|
147
|
-
);
|
|
148
|
-
openDiscuss();
|
|
149
|
-
expect(screen.queryByPlaceholderText('Ask about this text…')).toBeInTheDocument();
|
|
150
|
-
fireEvent.mouseDown(document.body);
|
|
151
|
-
expect(screen.queryByPlaceholderText('Ask about this text…')).not.toBeInTheDocument();
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it('does not auto-dismiss the popover on outside click when it has typed text', () => {
|
|
155
|
-
render(
|
|
156
|
-
<CommentableText itemId="i1" turnId="t1" sessionId="s1" content={CONTENT} threads={[]} />,
|
|
157
|
-
);
|
|
158
|
-
const ta = openDiscuss();
|
|
159
|
-
fireEvent.change(ta, { target: { value: 'a note' } });
|
|
160
|
-
|
|
161
|
-
// Outside click must NOT close a popover that has typed text.
|
|
162
|
-
fireEvent.mouseDown(document.body);
|
|
163
|
-
const still = screen.getByPlaceholderText('Ask about this text…') as HTMLTextAreaElement;
|
|
164
|
-
expect(still).toBeInTheDocument();
|
|
165
|
-
expect(still.value).toBe('a note');
|
|
166
|
-
|
|
167
|
-
// The X button closes explicitly regardless of content.
|
|
168
|
-
fireEvent.click(document.querySelector('.thread-create-close') as HTMLElement);
|
|
169
|
-
expect(screen.queryByPlaceholderText('Ask about this text…')).not.toBeInTheDocument();
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it('closes the popover on a single Esc when empty', () => {
|
|
173
|
-
render(
|
|
174
|
-
<CommentableText itemId="i1" turnId="t1" sessionId="s1" content={CONTENT} threads={[]} />,
|
|
175
|
-
);
|
|
176
|
-
const ta = openDiscuss();
|
|
177
|
-
fireEvent.keyDown(ta, { key: 'Escape' });
|
|
178
|
-
expect(screen.queryByPlaceholderText('Ask about this text…')).not.toBeInTheDocument();
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('requires double Esc to close the popover when it has typed text', () => {
|
|
182
|
-
render(
|
|
183
|
-
<CommentableText itemId="i1" turnId="t1" sessionId="s1" content={CONTENT} threads={[]} />,
|
|
184
|
-
);
|
|
185
|
-
const ta = openDiscuss();
|
|
186
|
-
fireEvent.change(ta, { target: { value: 'a note' } });
|
|
187
|
-
|
|
188
|
-
// First Esc: protected — must not close.
|
|
189
|
-
fireEvent.keyDown(ta, { key: 'Escape' });
|
|
190
|
-
expect(screen.queryByPlaceholderText('Ask about this text…')).toBeInTheDocument();
|
|
191
|
-
|
|
192
|
-
// Second Esc within the window: closes.
|
|
193
|
-
fireEvent.keyDown(ta, { key: 'Escape' });
|
|
194
|
-
expect(screen.queryByPlaceholderText('Ask about this text…')).not.toBeInTheDocument();
|
|
195
|
-
});
|
|
196
|
-
});
|