@bakapiano/ccsm 0.10.3 → 0.11.0

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.
Files changed (48) hide show
  1. package/CLAUDE.md +475 -475
  2. package/README.md +190 -190
  3. package/bin/ccsm.js +194 -194
  4. package/lib/cliSessionWatcher.js +249 -249
  5. package/lib/config.js +185 -185
  6. package/lib/folders.js +96 -96
  7. package/lib/localCliSessions.js +489 -177
  8. package/lib/persistedSessions.js +134 -134
  9. package/lib/webTerminal.js +208 -208
  10. package/lib/workspace.js +230 -255
  11. package/package.json +57 -57
  12. package/public/css/base.css +99 -99
  13. package/public/css/cards.css +183 -183
  14. package/public/css/feedback.css +303 -303
  15. package/public/css/forms.css +405 -405
  16. package/public/css/layout.css +160 -160
  17. package/public/css/modal.css +190 -183
  18. package/public/css/responsive.css +10 -10
  19. package/public/css/sidebar.css +616 -601
  20. package/public/css/terminals.css +294 -294
  21. package/public/css/tokens.css +81 -79
  22. package/public/css/wco.css +98 -98
  23. package/public/css/widgets.css +1596 -1375
  24. package/public/index.html +105 -103
  25. package/public/js/api.js +272 -260
  26. package/public/js/components/AdoptModal.js +343 -171
  27. package/public/js/components/App.js +35 -35
  28. package/public/js/components/DirectoryPicker.js +203 -203
  29. package/public/js/components/EntityFormModal.js +105 -105
  30. package/public/js/components/Modal.js +51 -51
  31. package/public/js/components/OfflineBanner.js +93 -93
  32. package/public/js/components/PageTitleBar.js +13 -13
  33. package/public/js/components/Picker.js +179 -179
  34. package/public/js/components/Popover.js +55 -55
  35. package/public/js/components/Sidebar.js +270 -270
  36. package/public/js/components/TerminalView.js +298 -298
  37. package/public/js/components/useDragSort.js +67 -67
  38. package/public/js/dialog.js +67 -67
  39. package/public/js/icons.js +177 -177
  40. package/public/js/main.js +140 -140
  41. package/public/js/pages/AboutPage.js +165 -165
  42. package/public/js/pages/ConfigurePage.js +475 -487
  43. package/public/js/pages/LaunchPage.js +369 -369
  44. package/public/js/pages/SessionsPage.js +97 -97
  45. package/public/js/state.js +231 -231
  46. package/public/manifest.webmanifest +15 -15
  47. package/scripts/install.js +137 -137
  48. package/server.js +1126 -1117
@@ -1,97 +1,97 @@
1
- // Sessions page · the main pane. Shows the terminal for the currently
2
- // selected session (activeSessionId), with a thin header providing
3
- // session metadata + rename/delete actions. When a session is selected
4
- // but not running we auto-resume it — no manual button.
5
-
6
- import { html } from '../html.js';
7
- import { useEffect, useState } from 'preact/hooks';
8
- import { activeSessionId, sessions, config, selectTab, selectSession, clockTick } from '../state.js';
9
- import { resumeSession, deleteSession, setSessionTitle } from '../api.js';
10
- import { setToast } from '../toast.js';
11
- import { ccsmConfirm, ccsmPrompt } from '../dialog.js';
12
- import { TerminalView } from '../components/TerminalView.js';
13
- import { PageTitleBar } from '../components/PageTitleBar.js';
14
- import { IconPencil, IconClose } from '../icons.js';
15
- import { fmtAgo } from '../util.js';
16
-
17
- export function SessionsPage() {
18
- clockTick.value; // resubscribe fmtAgo
19
- const id = activeSessionId.value;
20
- const list = sessions.value;
21
- const session = id ? list.find((s) => s.id === id) : null;
22
- const [resumeError, setResumeError] = useState(null);
23
- // Bumps to force the auto-resume effect to re-run on Retry without
24
- // mutating any signal. Primitive in the dep array → identity changes.
25
- const [retryNonce, setRetryNonce] = useState(0);
26
-
27
- // No session selected → bounce to the Launch page. Done in an effect so
28
- // we don't mutate signals during render. Returning null while the bounce
29
- // is in flight avoids a flash of empty content.
30
- useEffect(() => {
31
- if (!session) selectTab('launch');
32
- }, [session]);
33
-
34
- // Auto-resume when the active session is exited. resumeSession() in
35
- // api.js dedups in-flight calls per session id, so simultaneous fires
36
- // from here and from Sidebar.onClick collapse into one request.
37
- useEffect(() => {
38
- if (!session) return;
39
- if (session.status === 'running') { setResumeError(null); return; }
40
- setResumeError(null);
41
- resumeSession(session.id)
42
- .then((launched) => { if (launched?.id) selectSession(launched.id); })
43
- .catch((e) => { setResumeError(e.message); setToast(e.message, 'error'); });
44
- }, [session?.id, session?.status, retryNonce]);
45
-
46
- if (!session) return null;
47
-
48
- const cli = (config.value?.clis || []).find((c) => c.id === session.cliId);
49
- const running = session.status === 'running';
50
- const title = session.title || session.workspace || session.id.slice(0, 12);
51
-
52
- const onRename = async () => {
53
- const next = await ccsmPrompt('Rename session', title, { okLabel: 'Save' });
54
- if (next === null) return;
55
- try { await setSessionTitle(session.id, next.trim()); }
56
- catch (e) { setToast(e.message, 'error'); }
57
- };
58
- const onDelete = async () => {
59
- const ok = await ccsmConfirm(`Delete session ${title}? PTY will be killed if alive.`, {
60
- title: 'Delete session', okLabel: 'Delete', danger: true });
61
- if (!ok) return;
62
- try {
63
- await deleteSession(session.id);
64
- activeSessionId.value = null;
65
- } catch (e) { setToast(e.message, 'error'); }
66
- };
67
- const onRetry = () => setRetryNonce((n) => n + 1);
68
-
69
- return html`
70
- <${PageTitleBar} title=${html`
71
- <span class="session-title-text">${title}</span>
72
- <span class="session-title-meta">
73
- <span class="mono">${session.cwd}</span>
74
- <span>·</span>
75
- <span>${cli ? cli.name : session.cliId}</span>
76
- ${session.repos.length ? html`<span>·</span><span>${session.repos.join(', ')}</span>` : null}
77
- <span>·</span>
78
- <span>${running ? 'running' : (resumeError ? 'resume failed' : 'resuming…')}</span>
79
- </span>
80
- `}>
81
- </${PageTitleBar}>
82
- <div class="session-pane">
83
- <div class="session-pane-body">
84
- ${running
85
- ? html`<${TerminalView} terminalId=${session.id} />`
86
- : html`
87
- <div class="terminal-empty">
88
- ${resumeError ? html`
89
- <div>Failed to resume: <span class="mono">${resumeError}</span></div>
90
- <button class="action primary" onClick=${onRetry}>Retry</button>
91
- ` : html`
92
- <div>Resuming session…</div>
93
- `}
94
- </div>`}
95
- </div>
96
- </div>`;
97
- }
1
+ // Sessions page · the main pane. Shows the terminal for the currently
2
+ // selected session (activeSessionId), with a thin header providing
3
+ // session metadata + rename/delete actions. When a session is selected
4
+ // but not running we auto-resume it — no manual button.
5
+
6
+ import { html } from '../html.js';
7
+ import { useEffect, useState } from 'preact/hooks';
8
+ import { activeSessionId, sessions, config, selectTab, selectSession, clockTick } from '../state.js';
9
+ import { resumeSession, deleteSession, setSessionTitle } from '../api.js';
10
+ import { setToast } from '../toast.js';
11
+ import { ccsmConfirm, ccsmPrompt } from '../dialog.js';
12
+ import { TerminalView } from '../components/TerminalView.js';
13
+ import { PageTitleBar } from '../components/PageTitleBar.js';
14
+ import { IconPencil, IconClose } from '../icons.js';
15
+ import { fmtAgo } from '../util.js';
16
+
17
+ export function SessionsPage() {
18
+ clockTick.value; // resubscribe fmtAgo
19
+ const id = activeSessionId.value;
20
+ const list = sessions.value;
21
+ const session = id ? list.find((s) => s.id === id) : null;
22
+ const [resumeError, setResumeError] = useState(null);
23
+ // Bumps to force the auto-resume effect to re-run on Retry without
24
+ // mutating any signal. Primitive in the dep array → identity changes.
25
+ const [retryNonce, setRetryNonce] = useState(0);
26
+
27
+ // No session selected → bounce to the Launch page. Done in an effect so
28
+ // we don't mutate signals during render. Returning null while the bounce
29
+ // is in flight avoids a flash of empty content.
30
+ useEffect(() => {
31
+ if (!session) selectTab('launch');
32
+ }, [session]);
33
+
34
+ // Auto-resume when the active session is exited. resumeSession() in
35
+ // api.js dedups in-flight calls per session id, so simultaneous fires
36
+ // from here and from Sidebar.onClick collapse into one request.
37
+ useEffect(() => {
38
+ if (!session) return;
39
+ if (session.status === 'running') { setResumeError(null); return; }
40
+ setResumeError(null);
41
+ resumeSession(session.id)
42
+ .then((launched) => { if (launched?.id) selectSession(launched.id); })
43
+ .catch((e) => { setResumeError(e.message); setToast(e.message, 'error'); });
44
+ }, [session?.id, session?.status, retryNonce]);
45
+
46
+ if (!session) return null;
47
+
48
+ const cli = (config.value?.clis || []).find((c) => c.id === session.cliId);
49
+ const running = session.status === 'running';
50
+ const title = session.title || session.workspace || session.id.slice(0, 12);
51
+
52
+ const onRename = async () => {
53
+ const next = await ccsmPrompt('Rename session', title, { okLabel: 'Save' });
54
+ if (next === null) return;
55
+ try { await setSessionTitle(session.id, next.trim()); }
56
+ catch (e) { setToast(e.message, 'error'); }
57
+ };
58
+ const onDelete = async () => {
59
+ const ok = await ccsmConfirm(`Delete session ${title}? PTY will be killed if alive.`, {
60
+ title: 'Delete session', okLabel: 'Delete', danger: true });
61
+ if (!ok) return;
62
+ try {
63
+ await deleteSession(session.id);
64
+ activeSessionId.value = null;
65
+ } catch (e) { setToast(e.message, 'error'); }
66
+ };
67
+ const onRetry = () => setRetryNonce((n) => n + 1);
68
+
69
+ return html`
70
+ <${PageTitleBar} title=${html`
71
+ <span class="session-title-text">${title}</span>
72
+ <span class="session-title-meta">
73
+ <span class="mono">${session.cwd}</span>
74
+ <span>·</span>
75
+ <span>${cli ? cli.name : session.cliId}</span>
76
+ ${session.repos.length ? html`<span>·</span><span>${session.repos.join(', ')}</span>` : null}
77
+ <span>·</span>
78
+ <span>${running ? 'running' : (resumeError ? 'resume failed' : 'resuming…')}</span>
79
+ </span>
80
+ `}>
81
+ </${PageTitleBar}>
82
+ <div class="session-pane">
83
+ <div class="session-pane-body">
84
+ ${running
85
+ ? html`<${TerminalView} terminalId=${session.id} />`
86
+ : html`
87
+ <div class="terminal-empty">
88
+ ${resumeError ? html`
89
+ <div>Failed to resume: <span class="mono">${resumeError}</span></div>
90
+ <button class="action primary" onClick=${onRetry}>Retry</button>
91
+ ` : html`
92
+ <div>Resuming session…</div>
93
+ `}
94
+ </div>`}
95
+ </div>
96
+ </div>`;
97
+ }