repoburg 1.3.202 → 1.3.209
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 +2103 -32003
- package/agent-pane/backend/dist/server.js +45313 -0
- package/backend/dist/src/agent-runtime/agent-runtime.types.d.ts +1 -0
- package/backend/dist/src/llm-orchestration/hooks/frontend-notification.hook.js +6 -6
- package/backend/dist/src/llm-orchestration/hooks/frontend-notification.hook.js.map +1 -1
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js +1 -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/index.js +28 -8
- package/daemon/package.json +1 -1
- package/model-selector-scroll.png +0 -0
- package/package.json +10 -2
- 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 -236
- 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 -49
- package/agent-pane/backend/src/repoburg/action-mapping.test.ts +0 -122
- package/agent-pane/backend/src/repoburg/action-mapping.ts +0 -294
- package/agent-pane/backend/src/repoburg/agent-runtime-client.test.ts +0 -271
- package/agent-pane/backend/src/repoburg/agent-runtime-client.ts +0 -285
- package/agent-pane/backend/src/repoburg/backend-resolver.test.ts +0 -356
- package/agent-pane/backend/src/repoburg/backend-resolver.ts +0 -261
- package/agent-pane/backend/src/repoburg/repoburg-client.test.ts +0 -180
- package/agent-pane/backend/src/repoburg/repoburg-client.ts +0 -194
- package/agent-pane/backend/src/repoburg/repoburg-provider.test.ts +0 -780
- package/agent-pane/backend/src/repoburg/repoburg-provider.ts +0 -471
- package/agent-pane/backend/src/repoburg/turn-projector.test.ts +0 -621
- package/agent-pane/backend/src/repoburg/turn-projector.ts +0 -637
- 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 -772
- package/agent-pane/backend/src/routes/sessions.ts +0 -565
- 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-CJxD4YmJ.js +0 -370
- package/agent-pane/frontend/dist/assets/index-r-xwfOKQ.css +0 -1
- 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 -246
- 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 -240
- 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/AskUserItem.test.tsx +0 -143
- package/agent-pane/frontend/src/components/AskUserItem.tsx +0 -207
- 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 -377
- package/agent-pane/frontend/src/components/TurnContent.tsx +0 -594
- 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 -131
- package/agent-pane/frontend/src/components/panels/TurnsPanel.tsx +0 -131
- 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 -1338
- 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 -368
- package/agent-pane/frontend/src/styles/app.css +0 -627
- 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 -101
- 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 -134
- 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 -76
- 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 -184
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
|
-
import { render, screen, fireEvent, cleanup } from '@testing-library/react';
|
|
3
|
-
import WorkspaceSidebar from './WorkspaceSidebar.tsx';
|
|
4
|
-
import { resetStore } from '../test/component-helpers.ts';
|
|
5
|
-
import { makeSession, makeWorkspace } from '../test/fixtures.ts';
|
|
6
|
-
|
|
7
|
-
describe('WorkspaceSidebar', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
resetStore();
|
|
10
|
-
});
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
cleanup();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('shows empty state when no workspaces', () => {
|
|
16
|
-
render(<WorkspaceSidebar />);
|
|
17
|
-
expect(screen.getByText(/No workspaces yet/)).toBeInTheDocument();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('renders workspace groups with session counts', () => {
|
|
21
|
-
const ws = makeWorkspace('w1', '/projects/app');
|
|
22
|
-
const s1 = makeSession('s1', { cwd: '/projects/app', title: 'Session A' });
|
|
23
|
-
resetStore({ workspaces: [ws], sessions: [s1] });
|
|
24
|
-
render(<WorkspaceSidebar />);
|
|
25
|
-
expect(screen.getByText('app')).toBeInTheDocument(); // label from path basename
|
|
26
|
-
expect(screen.getByText('Session A')).toBeInTheDocument();
|
|
27
|
-
expect(screen.getByText('1')).toBeInTheDocument(); // session count
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('active session has active class', () => {
|
|
31
|
-
const ws = makeWorkspace('w1', '/app');
|
|
32
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'Active One' });
|
|
33
|
-
resetStore({ workspaces: [ws], sessions: [s1], activeSessionId: 's1' });
|
|
34
|
-
render(<WorkspaceSidebar />);
|
|
35
|
-
const treeItem = screen.getByText('Active One').closest('.tree-item');
|
|
36
|
-
expect(treeItem).toHaveClass('active');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('click on session calls selectSession', () => {
|
|
40
|
-
const selectSession = vi.fn().mockResolvedValue(undefined);
|
|
41
|
-
const ws = makeWorkspace('w1', '/app');
|
|
42
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'Click Me' });
|
|
43
|
-
resetStore({ workspaces: [ws], sessions: [s1], selectSession });
|
|
44
|
-
render(<WorkspaceSidebar />);
|
|
45
|
-
fireEvent.click(screen.getByText('Click Me'));
|
|
46
|
-
expect(selectSession).toHaveBeenCalledWith('s1');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('collapse section header toggles section', () => {
|
|
50
|
-
const ws = makeWorkspace('w1', '/app');
|
|
51
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'Session 1' });
|
|
52
|
-
resetStore({ workspaces: [ws], sessions: [s1] });
|
|
53
|
-
render(<WorkspaceSidebar />);
|
|
54
|
-
const header = document.querySelector('.tree-section-header')!;
|
|
55
|
-
fireEvent.click(header);
|
|
56
|
-
expect(document.querySelector('.tree-section')!.classList.contains('collapsed')).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('plus button on workspace calls createSessionInWorkspace', () => {
|
|
60
|
-
const createSessionInWorkspace = vi.fn().mockResolvedValue(undefined);
|
|
61
|
-
const ws = makeWorkspace('w1', '/app');
|
|
62
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'Session 1' });
|
|
63
|
-
resetStore({ workspaces: [ws], sessions: [s1], createSessionInWorkspace });
|
|
64
|
-
render(<WorkspaceSidebar />);
|
|
65
|
-
const addBtn = document.querySelector('.tree-section-add')!;
|
|
66
|
-
fireEvent.click(addBtn);
|
|
67
|
-
expect(createSessionInWorkspace).toHaveBeenCalledWith('/app');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('context menu on workspace shows New Session and Hide Workspace', () => {
|
|
71
|
-
const ws = makeWorkspace('w1', '/app');
|
|
72
|
-
resetStore({ workspaces: [ws], sessions: [] });
|
|
73
|
-
render(<WorkspaceSidebar />);
|
|
74
|
-
const header = document.querySelector('.tree-section-header')!;
|
|
75
|
-
fireEvent.contextMenu(header);
|
|
76
|
-
expect(screen.getByText('New Session')).toBeInTheDocument();
|
|
77
|
-
expect(screen.getByText('Hide Workspace')).toBeInTheDocument();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('context menu "Hide Workspace" calls removeWorkspace', () => {
|
|
81
|
-
const removeWorkspace = vi.fn().mockResolvedValue(undefined);
|
|
82
|
-
const ws = makeWorkspace('w1', '/app');
|
|
83
|
-
resetStore({ workspaces: [ws], sessions: [], removeWorkspace });
|
|
84
|
-
render(<WorkspaceSidebar />);
|
|
85
|
-
fireEvent.contextMenu(document.querySelector('.tree-section-header')!);
|
|
86
|
-
fireEvent.click(screen.getByText('Hide Workspace'));
|
|
87
|
-
expect(removeWorkspace).toHaveBeenCalledWith('/app');
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('context menu on working session shows Rename, Mark Finished, Delete', () => {
|
|
91
|
-
const ws = makeWorkspace('w1', '/app');
|
|
92
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'Working Session', lifecycle: 'working' });
|
|
93
|
-
resetStore({ workspaces: [ws], sessions: [s1] });
|
|
94
|
-
render(<WorkspaceSidebar />);
|
|
95
|
-
fireEvent.contextMenu(screen.getByText('Working Session'));
|
|
96
|
-
expect(screen.getByText('Rename')).toBeInTheDocument();
|
|
97
|
-
expect(screen.getByText('Mark as Finished')).toBeInTheDocument();
|
|
98
|
-
expect(screen.getByText('Delete Session')).toBeInTheDocument();
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('context menu on finished session shows Reopen and Delete', () => {
|
|
102
|
-
const ws = makeWorkspace('w1', '/app');
|
|
103
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'Finished Session', lifecycle: 'finished' });
|
|
104
|
-
resetStore({ workspaces: [ws], sessions: [s1] });
|
|
105
|
-
render(<WorkspaceSidebar />);
|
|
106
|
-
fireEvent.contextMenu(screen.getByText('Finished Session'));
|
|
107
|
-
expect(screen.getByText('Reopen')).toBeInTheDocument();
|
|
108
|
-
expect(screen.getByText('Delete Session')).toBeInTheDocument();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('rename: inline input appears, Enter calls renameSession', () => {
|
|
112
|
-
const renameSession = vi.fn().mockResolvedValue(undefined);
|
|
113
|
-
const ws = makeWorkspace('w1', '/app');
|
|
114
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'Old Name', lifecycle: 'working' });
|
|
115
|
-
resetStore({ workspaces: [ws], sessions: [s1], renameSession });
|
|
116
|
-
render(<WorkspaceSidebar />);
|
|
117
|
-
// Open context menu and click Rename
|
|
118
|
-
fireEvent.contextMenu(screen.getByText('Old Name'));
|
|
119
|
-
fireEvent.click(screen.getByText('Rename'));
|
|
120
|
-
// Rename input appears
|
|
121
|
-
const input = document.querySelector('.tree-rename-input') as HTMLInputElement;
|
|
122
|
-
expect(input).toBeInTheDocument();
|
|
123
|
-
expect(input.value).toBe('Old Name');
|
|
124
|
-
// Type new name and press Enter
|
|
125
|
-
fireEvent.change(input, { target: { value: 'New Name' } });
|
|
126
|
-
fireEvent.keyDown(input, { key: 'Enter' });
|
|
127
|
-
expect(renameSession).toHaveBeenCalledWith('s1', 'New Name');
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('footer "Add workspace" calls pickAndAddWorkspace', () => {
|
|
131
|
-
const pickAndAddWorkspace = vi.fn().mockResolvedValue(undefined);
|
|
132
|
-
resetStore({ pickAndAddWorkspace });
|
|
133
|
-
render(<WorkspaceSidebar />);
|
|
134
|
-
fireEvent.click(screen.getByText('Add workspace'));
|
|
135
|
-
expect(pickAndAddWorkspace).toHaveBeenCalled();
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
// --- context menu action clicks ---
|
|
139
|
-
|
|
140
|
-
it('context menu "New Session" calls createSessionInWorkspace', () => {
|
|
141
|
-
const createSessionInWorkspace = vi.fn().mockResolvedValue(undefined);
|
|
142
|
-
const ws = makeWorkspace('w1', '/app');
|
|
143
|
-
resetStore({ workspaces: [ws], sessions: [], createSessionInWorkspace });
|
|
144
|
-
render(<WorkspaceSidebar />);
|
|
145
|
-
fireEvent.contextMenu(document.querySelector('.tree-section-header')!);
|
|
146
|
-
fireEvent.click(screen.getByText('New Session'));
|
|
147
|
-
expect(createSessionInWorkspace).toHaveBeenCalledWith('/app');
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it('context menu "Mark as Finished" calls markFinished', () => {
|
|
151
|
-
const markFinished = vi.fn().mockResolvedValue(undefined);
|
|
152
|
-
const ws = makeWorkspace('w1', '/app');
|
|
153
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'Working', lifecycle: 'working' });
|
|
154
|
-
resetStore({ workspaces: [ws], sessions: [s1], markFinished });
|
|
155
|
-
render(<WorkspaceSidebar />);
|
|
156
|
-
fireEvent.contextMenu(screen.getByText('Working'));
|
|
157
|
-
fireEvent.click(screen.getByText('Mark as Finished'));
|
|
158
|
-
expect(markFinished).toHaveBeenCalledWith('s1');
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('context menu "Delete Session" on working session calls deleteSession', () => {
|
|
162
|
-
const deleteSession = vi.fn().mockResolvedValue(undefined);
|
|
163
|
-
const ws = makeWorkspace('w1', '/app');
|
|
164
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'ToDelete', lifecycle: 'working' });
|
|
165
|
-
resetStore({ workspaces: [ws], sessions: [s1], deleteSession });
|
|
166
|
-
render(<WorkspaceSidebar />);
|
|
167
|
-
fireEvent.contextMenu(screen.getByText('ToDelete'));
|
|
168
|
-
fireEvent.click(screen.getByText('Delete Session'));
|
|
169
|
-
expect(deleteSession).toHaveBeenCalledWith('s1');
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it('context menu "Reopen" on finished session calls reopenSession', () => {
|
|
173
|
-
const reopenSession = vi.fn().mockResolvedValue(undefined);
|
|
174
|
-
const ws = makeWorkspace('w1', '/app');
|
|
175
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'ReopenMe', lifecycle: 'finished' });
|
|
176
|
-
resetStore({ workspaces: [ws], sessions: [s1], reopenSession });
|
|
177
|
-
render(<WorkspaceSidebar />);
|
|
178
|
-
fireEvent.contextMenu(screen.getByText('ReopenMe'));
|
|
179
|
-
fireEvent.click(screen.getByText('Reopen'));
|
|
180
|
-
expect(reopenSession).toHaveBeenCalledWith('s1');
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('context menu "Delete Session" on finished session calls deleteSession', () => {
|
|
184
|
-
const deleteSession = vi.fn().mockResolvedValue(undefined);
|
|
185
|
-
const ws = makeWorkspace('w1', '/app');
|
|
186
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'FinDel', lifecycle: 'finished' });
|
|
187
|
-
resetStore({ workspaces: [ws], sessions: [s1], deleteSession });
|
|
188
|
-
render(<WorkspaceSidebar />);
|
|
189
|
-
fireEvent.contextMenu(screen.getByText('FinDel'));
|
|
190
|
-
fireEvent.click(screen.getByText('Delete Session'));
|
|
191
|
-
expect(deleteSession).toHaveBeenCalledWith('s1');
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
// --- finished sub-group ---
|
|
195
|
-
|
|
196
|
-
it('finished sub-group toggle collapses and expands', () => {
|
|
197
|
-
const ws = makeWorkspace('w1', '/app');
|
|
198
|
-
const working = makeSession('s1', { cwd: '/app', title: 'Active', lifecycle: 'working' });
|
|
199
|
-
const finished = makeSession('s2', { cwd: '/app', title: 'Done', lifecycle: 'finished' });
|
|
200
|
-
resetStore({ workspaces: [ws], sessions: [working, finished] });
|
|
201
|
-
render(<WorkspaceSidebar />);
|
|
202
|
-
// Finished sub-group visible
|
|
203
|
-
expect(screen.getByText('Finished')).toBeInTheDocument();
|
|
204
|
-
expect(screen.getByText('Done')).toBeInTheDocument();
|
|
205
|
-
// Click finished header to collapse
|
|
206
|
-
fireEvent.click(screen.getByText('Finished'));
|
|
207
|
-
expect(screen.queryByText('Done')).not.toBeInTheDocument();
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it('workspace with no sessions shows "No sessions"', () => {
|
|
211
|
-
const ws = makeWorkspace('w1', '/app');
|
|
212
|
-
resetStore({ workspaces: [ws], sessions: [] });
|
|
213
|
-
render(<WorkspaceSidebar />);
|
|
214
|
-
expect(screen.getByText('No sessions')).toBeInTheDocument();
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
// --- implicit groups ---
|
|
218
|
-
|
|
219
|
-
it('session with cwd not in any workspace creates implicit group', () => {
|
|
220
|
-
const s1 = makeSession('s1', { cwd: '/unknown/path', title: 'Lonely' });
|
|
221
|
-
resetStore({ workspaces: [], sessions: [s1] });
|
|
222
|
-
render(<WorkspaceSidebar />);
|
|
223
|
-
// Label from path basename
|
|
224
|
-
expect(screen.getByText('path')).toBeInTheDocument();
|
|
225
|
-
expect(screen.getByText('Lonely')).toBeInTheDocument();
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
it('deleted workspace excluded from implicit groups', () => {
|
|
229
|
-
const ws = makeWorkspace('w1', '/app', { deleted: 1 });
|
|
230
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'Orphan' });
|
|
231
|
-
resetStore({ workspaces: [ws], sessions: [s1] });
|
|
232
|
-
render(<WorkspaceSidebar />);
|
|
233
|
-
// Deleted workspace → no group for /app (session not shown in sidebar)
|
|
234
|
-
expect(screen.queryByText('Orphan')).not.toBeInTheDocument();
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
it('session with null cwd shows "Other" group', () => {
|
|
238
|
-
const s1 = makeSession('s1', { cwd: null, title: 'NoCwd' });
|
|
239
|
-
resetStore({ workspaces: [], sessions: [s1] });
|
|
240
|
-
render(<WorkspaceSidebar />);
|
|
241
|
-
expect(screen.getByText('Other')).toBeInTheDocument();
|
|
242
|
-
expect(screen.getByText('NoCwd')).toBeInTheDocument();
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
// --- rename edge cases ---
|
|
246
|
-
|
|
247
|
-
it('rename Escape cancels without calling renameSession', () => {
|
|
248
|
-
const renameSession = vi.fn().mockResolvedValue(undefined);
|
|
249
|
-
const ws = makeWorkspace('w1', '/app');
|
|
250
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'OldName', lifecycle: 'working' });
|
|
251
|
-
resetStore({ workspaces: [ws], sessions: [s1], renameSession });
|
|
252
|
-
render(<WorkspaceSidebar />);
|
|
253
|
-
fireEvent.contextMenu(screen.getByText('OldName'));
|
|
254
|
-
fireEvent.click(screen.getByText('Rename'));
|
|
255
|
-
const input = document.querySelector('.tree-rename-input') as HTMLInputElement;
|
|
256
|
-
fireEvent.keyDown(input, { key: 'Escape' });
|
|
257
|
-
expect(renameSession).not.toHaveBeenCalled();
|
|
258
|
-
expect(document.querySelector('.tree-rename-input')).not.toBeInTheDocument();
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
it('rename blur confirms and calls renameSession', () => {
|
|
262
|
-
const renameSession = vi.fn().mockResolvedValue(undefined);
|
|
263
|
-
const ws = makeWorkspace('w1', '/app');
|
|
264
|
-
const s1 = makeSession('s1', { cwd: '/app', title: 'BlurMe', lifecycle: 'working' });
|
|
265
|
-
resetStore({ workspaces: [ws], sessions: [s1], renameSession });
|
|
266
|
-
render(<WorkspaceSidebar />);
|
|
267
|
-
fireEvent.contextMenu(screen.getByText('BlurMe'));
|
|
268
|
-
fireEvent.click(screen.getByText('Rename'));
|
|
269
|
-
const input = document.querySelector('.tree-rename-input') as HTMLInputElement;
|
|
270
|
-
fireEvent.change(input, { target: { value: 'NewBlur' } });
|
|
271
|
-
fireEvent.blur(input);
|
|
272
|
-
expect(renameSession).toHaveBeenCalledWith('s1', 'NewBlur');
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
// --- sidebar header + button ---
|
|
276
|
-
|
|
277
|
-
it('sidebar header "+" button calls pickAndAddWorkspace', () => {
|
|
278
|
-
const pickAndAddWorkspace = vi.fn().mockResolvedValue(undefined);
|
|
279
|
-
resetStore({ pickAndAddWorkspace });
|
|
280
|
-
render(<WorkspaceSidebar />);
|
|
281
|
-
const addBtn = document.querySelector('.sidebar-add')!;
|
|
282
|
-
fireEvent.click(addBtn);
|
|
283
|
-
expect(pickAndAddWorkspace).toHaveBeenCalled();
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
// --- context menu close ---
|
|
287
|
-
|
|
288
|
-
it('Escape key closes context menu', () => {
|
|
289
|
-
const ws = makeWorkspace('w1', '/app');
|
|
290
|
-
resetStore({ workspaces: [ws], sessions: [] });
|
|
291
|
-
render(<WorkspaceSidebar />);
|
|
292
|
-
fireEvent.contextMenu(document.querySelector('.tree-section-header')!);
|
|
293
|
-
expect(screen.getByText('New Session')).toBeInTheDocument();
|
|
294
|
-
fireEvent.keyDown(document, { key: 'Escape' });
|
|
295
|
-
expect(screen.queryByText('New Session')).not.toBeInTheDocument();
|
|
296
|
-
});
|
|
297
|
-
});
|
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
import { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { useStore } from '../store/store.ts';
|
|
3
|
-
import { deriveSessionStatus } from '../hooks/useSessionStatus.ts';
|
|
4
|
-
import { useOutsideClick } from '../hooks/useOutsideClick.ts';
|
|
5
|
-
import { useEscapeKey } from '../hooks/useEscapeKey.ts';
|
|
6
|
-
import type { Session, Workspace } from '../types/index.ts';
|
|
7
|
-
import StatusDot from './StatusDot.tsx';
|
|
8
|
-
import RuntimeIcon from './RuntimeIcon.tsx';
|
|
9
|
-
import { Plus, ChevronDown, Folder, FolderPlus, Trash2, Edit3, CheckCircle2, RotateCcw } from 'lucide-react';
|
|
10
|
-
|
|
11
|
-
interface ContextMenuState {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
type: 'workspace' | 'session';
|
|
15
|
-
path?: string;
|
|
16
|
-
sessionId?: string;
|
|
17
|
-
sessionTitle?: string | null;
|
|
18
|
-
sessionLifecycle?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface WorkspaceGroup {
|
|
22
|
-
path: string;
|
|
23
|
-
label: string;
|
|
24
|
-
sessions: Session[];
|
|
25
|
-
workspace: Workspace | null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Build workspace groups from active workspaces + session cwd values.
|
|
29
|
-
* Deleted workspace paths are excluded from implicit groups. */
|
|
30
|
-
function buildGroups(workspaces: Workspace[], sessions: Session[]): WorkspaceGroup[] {
|
|
31
|
-
const sessionByCwd = new Map<string, Session[]>();
|
|
32
|
-
|
|
33
|
-
for (const s of sessions) {
|
|
34
|
-
const key = s.cwd || '(no directory)';
|
|
35
|
-
const list = sessionByCwd.get(key) ?? [];
|
|
36
|
-
list.push(s);
|
|
37
|
-
sessionByCwd.set(key, list);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const seenPaths = new Set<string>();
|
|
41
|
-
const deletedPaths = new Set(workspaces.filter((w) => w.deleted === 1).map((w) => w.path));
|
|
42
|
-
const groups: WorkspaceGroup[] = [];
|
|
43
|
-
|
|
44
|
-
// Active explicit workspaces first (deleted = 0)
|
|
45
|
-
for (const ws of workspaces) {
|
|
46
|
-
if (ws.deleted === 1) {
|
|
47
|
-
seenPaths.add(ws.path);
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
seenPaths.add(ws.path);
|
|
51
|
-
groups.push({
|
|
52
|
-
path: ws.path,
|
|
53
|
-
label: ws.label || ws.path.split('/').pop() || ws.path,
|
|
54
|
-
sessions: sessionByCwd.get(ws.path) ?? [],
|
|
55
|
-
workspace: ws,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Implicit groups — session cwd values not in any workspace (active or deleted)
|
|
60
|
-
for (const [path, sess] of sessionByCwd) {
|
|
61
|
-
if (seenPaths.has(path) || deletedPaths.has(path)) continue;
|
|
62
|
-
groups.push({
|
|
63
|
-
path,
|
|
64
|
-
label: path === '(no directory)' ? 'Other' : path.split('/').pop() || path,
|
|
65
|
-
sessions: sess,
|
|
66
|
-
workspace: null,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return groups;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export default function WorkspaceSidebar() {
|
|
74
|
-
const {
|
|
75
|
-
sessions,
|
|
76
|
-
workspaces,
|
|
77
|
-
activeSessionId,
|
|
78
|
-
selectSession,
|
|
79
|
-
deleteSession,
|
|
80
|
-
removeWorkspace,
|
|
81
|
-
createSessionInWorkspace,
|
|
82
|
-
pickAndAddWorkspace,
|
|
83
|
-
renameSession,
|
|
84
|
-
markFinished,
|
|
85
|
-
reopenSession,
|
|
86
|
-
} = useStore();
|
|
87
|
-
const [collapsed, setCollapsed] = useState<Set<string>>(new Set());
|
|
88
|
-
const [subCollapsed, setSubCollapsed] = useState<Set<string>>(new Set());
|
|
89
|
-
const [ctxMenu, setCtxMenu] = useState<ContextMenuState | null>(null);
|
|
90
|
-
const [renamingId, setRenamingId] = useState<string | null>(null);
|
|
91
|
-
const [renameValue, setRenameValue] = useState('');
|
|
92
|
-
const ctxRef = useRef<HTMLDivElement>(null);
|
|
93
|
-
const renameRef = useRef<HTMLInputElement>(null);
|
|
94
|
-
|
|
95
|
-
useOutsideClick(ctxRef, () => setCtxMenu(null), !!ctxMenu);
|
|
96
|
-
useEscapeKey(() => setCtxMenu(null), !!ctxMenu);
|
|
97
|
-
|
|
98
|
-
function toggleSection(path: string) {
|
|
99
|
-
setCollapsed((prev) => {
|
|
100
|
-
const next = new Set(prev);
|
|
101
|
-
if (next.has(path)) next.delete(path);
|
|
102
|
-
else next.add(path);
|
|
103
|
-
return next;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function toggleSubGroup(key: string) {
|
|
108
|
-
setSubCollapsed((prev) => {
|
|
109
|
-
const next = new Set(prev);
|
|
110
|
-
if (next.has(key)) next.delete(key);
|
|
111
|
-
else next.add(key);
|
|
112
|
-
return next;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Focus rename input when it appears
|
|
117
|
-
useEffect(() => {
|
|
118
|
-
if (renamingId && renameRef.current) {
|
|
119
|
-
renameRef.current.focus();
|
|
120
|
-
renameRef.current.select();
|
|
121
|
-
}
|
|
122
|
-
}, [renamingId]);
|
|
123
|
-
|
|
124
|
-
function startRename(id: string, currentTitle: string) {
|
|
125
|
-
setRenamingId(id);
|
|
126
|
-
setRenameValue(currentTitle || id.slice(0, 8));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function confirmRename() {
|
|
130
|
-
if (renamingId) {
|
|
131
|
-
renameSession(renamingId, renameValue);
|
|
132
|
-
}
|
|
133
|
-
setRenamingId(null);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function cancelRename() {
|
|
137
|
-
setRenamingId(null);
|
|
138
|
-
setRenameValue('');
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const groups = buildGroups(workspaces, sessions);
|
|
142
|
-
|
|
143
|
-
function renderSession(s: Session) {
|
|
144
|
-
const isActive = activeSessionId === s.id;
|
|
145
|
-
const status = deriveSessionStatus(s);
|
|
146
|
-
return (
|
|
147
|
-
<div
|
|
148
|
-
key={s.id}
|
|
149
|
-
className={`tree-item ${isActive ? 'active' : ''} ${status.isFinished ? 'tree-item-finished' : ''}`}
|
|
150
|
-
onClick={() => selectSession(s.id)}
|
|
151
|
-
onContextMenu={(e) => {
|
|
152
|
-
e.preventDefault();
|
|
153
|
-
setCtxMenu({
|
|
154
|
-
x: e.clientX,
|
|
155
|
-
y: e.clientY,
|
|
156
|
-
type: 'session',
|
|
157
|
-
sessionId: s.id,
|
|
158
|
-
sessionTitle: s.title,
|
|
159
|
-
sessionLifecycle: s.lifecycle,
|
|
160
|
-
});
|
|
161
|
-
}}
|
|
162
|
-
>
|
|
163
|
-
<RuntimeIcon iconClass={status.iconClass} iconText={status.iconText} size={16} />
|
|
164
|
-
{renamingId === s.id ? (
|
|
165
|
-
<input
|
|
166
|
-
ref={renameRef}
|
|
167
|
-
className="tree-rename-input"
|
|
168
|
-
value={renameValue}
|
|
169
|
-
onChange={(e) => setRenameValue(e.target.value)}
|
|
170
|
-
onClick={(e) => e.stopPropagation()}
|
|
171
|
-
onKeyDown={(e) => {
|
|
172
|
-
if (e.key === 'Enter') confirmRename();
|
|
173
|
-
if (e.key === 'Escape') cancelRename();
|
|
174
|
-
}}
|
|
175
|
-
onBlur={confirmRename}
|
|
176
|
-
/>
|
|
177
|
-
) : (
|
|
178
|
-
<span className="tree-label">{s.title || s.id.slice(0, 8)}</span>
|
|
179
|
-
)}
|
|
180
|
-
{status.dot && <StatusDot status={status.dot} />}
|
|
181
|
-
</div>
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return (
|
|
186
|
-
<div className="ide-sidebar">
|
|
187
|
-
<div className="sidebar-header">
|
|
188
|
-
<span className="sidebar-header-title">Workspaces</span>
|
|
189
|
-
<button className="sidebar-add" title="Add workspace" onClick={() => pickAndAddWorkspace()}>
|
|
190
|
-
<Plus size={14} />
|
|
191
|
-
</button>
|
|
192
|
-
</div>
|
|
193
|
-
|
|
194
|
-
{groups.length === 0 ? (
|
|
195
|
-
<div className="empty-state" style={{ padding: '16px' }}>
|
|
196
|
-
No workspaces yet. Click + to add one.
|
|
197
|
-
</div>
|
|
198
|
-
) : (
|
|
199
|
-
groups.map((group) => {
|
|
200
|
-
const isCollapsed = collapsed.has(group.path);
|
|
201
|
-
const workingSessions = group.sessions.filter((s) => s.lifecycle !== 'finished');
|
|
202
|
-
const finishedSessions = group.sessions.filter((s) => s.lifecycle === 'finished');
|
|
203
|
-
const finishedKey = `${group.path}:finished`;
|
|
204
|
-
const finishedCollapsed = subCollapsed.has(finishedKey);
|
|
205
|
-
|
|
206
|
-
return (
|
|
207
|
-
<div key={group.path} className={`tree-section ${isCollapsed ? 'collapsed' : ''}`}>
|
|
208
|
-
<div
|
|
209
|
-
className="tree-section-header"
|
|
210
|
-
onClick={() => toggleSection(group.path)}
|
|
211
|
-
onContextMenu={(e) => {
|
|
212
|
-
e.preventDefault();
|
|
213
|
-
setCtxMenu({ x: e.clientX, y: e.clientY, type: 'workspace', path: group.path });
|
|
214
|
-
}}
|
|
215
|
-
>
|
|
216
|
-
<ChevronDown size={9} className="tree-chevron" />
|
|
217
|
-
<Folder size={14} />
|
|
218
|
-
<span className="tree-section-label">{group.label}</span>
|
|
219
|
-
<button
|
|
220
|
-
className="tree-section-add"
|
|
221
|
-
title="New session in this workspace"
|
|
222
|
-
onClick={(e) => {
|
|
223
|
-
e.stopPropagation();
|
|
224
|
-
createSessionInWorkspace(group.path);
|
|
225
|
-
}}
|
|
226
|
-
>
|
|
227
|
-
<Plus size={11} />
|
|
228
|
-
</button>
|
|
229
|
-
<span className="tree-count">{group.sessions.length}</span>
|
|
230
|
-
</div>
|
|
231
|
-
<div className="tree-children">
|
|
232
|
-
{/* Working sessions — rendered directly, no sub-group header */}
|
|
233
|
-
{workingSessions.length === 0 && finishedSessions.length === 0 ? (
|
|
234
|
-
<div className="tree-empty">No sessions</div>
|
|
235
|
-
) : (
|
|
236
|
-
workingSessions.map(renderSession)
|
|
237
|
-
)}
|
|
238
|
-
|
|
239
|
-
{/* Finished sub-group — only show if there are finished sessions */}
|
|
240
|
-
{finishedSessions.length > 0 && (
|
|
241
|
-
<div className={`tree-subgroup ${finishedCollapsed ? 'collapsed' : ''}`}>
|
|
242
|
-
<div className="tree-subgroup-header" onClick={() => toggleSubGroup(finishedKey)}>
|
|
243
|
-
<ChevronDown size={8} className="tree-chevron" />
|
|
244
|
-
<span className="tree-subgroup-label">Finished</span>
|
|
245
|
-
<span className="tree-subgroup-count">{finishedSessions.length}</span>
|
|
246
|
-
</div>
|
|
247
|
-
{!finishedCollapsed && (
|
|
248
|
-
<div className="tree-subgroup-items">{finishedSessions.map(renderSession)}</div>
|
|
249
|
-
)}
|
|
250
|
-
</div>
|
|
251
|
-
)}
|
|
252
|
-
</div>
|
|
253
|
-
</div>
|
|
254
|
-
);
|
|
255
|
-
})
|
|
256
|
-
)}
|
|
257
|
-
|
|
258
|
-
<div className="sidebar-footer" onClick={() => pickAndAddWorkspace()}>
|
|
259
|
-
<FolderPlus size={14} />
|
|
260
|
-
<span>Add workspace</span>
|
|
261
|
-
</div>
|
|
262
|
-
|
|
263
|
-
{ctxMenu && (
|
|
264
|
-
<div
|
|
265
|
-
ref={ctxRef}
|
|
266
|
-
className="ctx-menu"
|
|
267
|
-
style={{ position: 'fixed', left: ctxMenu.x, top: ctxMenu.y, zIndex: 500 }}
|
|
268
|
-
>
|
|
269
|
-
{ctxMenu.type === 'workspace' && (
|
|
270
|
-
<>
|
|
271
|
-
<div
|
|
272
|
-
className="ctx-menu-item"
|
|
273
|
-
onClick={() => {
|
|
274
|
-
createSessionInWorkspace(ctxMenu.path!);
|
|
275
|
-
setCtxMenu(null);
|
|
276
|
-
}}
|
|
277
|
-
>
|
|
278
|
-
<Plus size={12} /> New Session
|
|
279
|
-
</div>
|
|
280
|
-
<div
|
|
281
|
-
className="ctx-menu-item ctx-danger"
|
|
282
|
-
onClick={() => {
|
|
283
|
-
removeWorkspace(ctxMenu.path!);
|
|
284
|
-
setCtxMenu(null);
|
|
285
|
-
}}
|
|
286
|
-
>
|
|
287
|
-
<Trash2 size={12} /> Hide Workspace
|
|
288
|
-
</div>
|
|
289
|
-
</>
|
|
290
|
-
)}
|
|
291
|
-
{ctxMenu.type === 'session' && (
|
|
292
|
-
<>
|
|
293
|
-
{ctxMenu.sessionLifecycle !== 'finished' ? (
|
|
294
|
-
<>
|
|
295
|
-
<div
|
|
296
|
-
className="ctx-menu-item"
|
|
297
|
-
onClick={() => {
|
|
298
|
-
startRename(ctxMenu.sessionId!, ctxMenu.sessionTitle ?? '');
|
|
299
|
-
setCtxMenu(null);
|
|
300
|
-
}}
|
|
301
|
-
>
|
|
302
|
-
<Edit3 size={12} /> Rename
|
|
303
|
-
</div>
|
|
304
|
-
<div
|
|
305
|
-
className="ctx-menu-item"
|
|
306
|
-
onClick={() => {
|
|
307
|
-
markFinished(ctxMenu.sessionId!);
|
|
308
|
-
setCtxMenu(null);
|
|
309
|
-
}}
|
|
310
|
-
>
|
|
311
|
-
<CheckCircle2 size={12} /> Mark as Finished
|
|
312
|
-
</div>
|
|
313
|
-
<div
|
|
314
|
-
className="ctx-menu-item ctx-danger"
|
|
315
|
-
onClick={() => {
|
|
316
|
-
deleteSession(ctxMenu.sessionId!);
|
|
317
|
-
setCtxMenu(null);
|
|
318
|
-
}}
|
|
319
|
-
>
|
|
320
|
-
<Trash2 size={12} /> Delete Session
|
|
321
|
-
</div>
|
|
322
|
-
</>
|
|
323
|
-
) : (
|
|
324
|
-
<>
|
|
325
|
-
<div
|
|
326
|
-
className="ctx-menu-item"
|
|
327
|
-
onClick={() => {
|
|
328
|
-
reopenSession(ctxMenu.sessionId!);
|
|
329
|
-
setCtxMenu(null);
|
|
330
|
-
}}
|
|
331
|
-
>
|
|
332
|
-
<RotateCcw size={12} /> Reopen
|
|
333
|
-
</div>
|
|
334
|
-
<div
|
|
335
|
-
className="ctx-menu-item ctx-danger"
|
|
336
|
-
onClick={() => {
|
|
337
|
-
deleteSession(ctxMenu.sessionId!);
|
|
338
|
-
setCtxMenu(null);
|
|
339
|
-
}}
|
|
340
|
-
>
|
|
341
|
-
<Trash2 size={12} /> Delete Session
|
|
342
|
-
</div>
|
|
343
|
-
</>
|
|
344
|
-
)}
|
|
345
|
-
</>
|
|
346
|
-
)}
|
|
347
|
-
</div>
|
|
348
|
-
)}
|
|
349
|
-
</div>
|
|
350
|
-
);
|
|
351
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
interface OptionSubPopupProps {
|
|
2
|
-
title: string;
|
|
3
|
-
options: { value: string; label: string; description?: string }[];
|
|
4
|
-
currentValue: string | null | undefined;
|
|
5
|
-
onSelect: (value: string) => void;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/** Radio-style sub-popup for /sandbox, /websearch, /network commands. */
|
|
10
|
-
export default function OptionSubPopup({ title, options, currentValue, onSelect, onClose }: OptionSubPopupProps) {
|
|
11
|
-
return (
|
|
12
|
-
<div className="slash-popup">
|
|
13
|
-
<div className="slash-popup-header">
|
|
14
|
-
<button className="slash-popup-back" onClick={onClose}>← Back</button>
|
|
15
|
-
<span>{title}</span>
|
|
16
|
-
</div>
|
|
17
|
-
{options.map((opt) => (
|
|
18
|
-
<div
|
|
19
|
-
key={opt.value}
|
|
20
|
-
className={`slash-popup-item ${opt.value === currentValue ? 'selected' : ''}`}
|
|
21
|
-
onClick={() => onSelect(opt.value)}
|
|
22
|
-
>
|
|
23
|
-
<div className="slash-popup-item-main">
|
|
24
|
-
<span className="slash-popup-label">{opt.label}</span>
|
|
25
|
-
{opt.description && <span className="slash-popup-hint">{opt.description}</span>}
|
|
26
|
-
</div>
|
|
27
|
-
{opt.value === currentValue && <span className="slash-popup-check">✓</span>}
|
|
28
|
-
</div>
|
|
29
|
-
))}
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
}
|