@bakapiano/ccsm 0.14.0 → 0.15.1

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 (53) hide show
  1. package/CLAUDE.md +474 -475
  2. package/README.md +189 -190
  3. package/bin/ccsm.js +194 -194
  4. package/lib/cliActivity.js +118 -0
  5. package/lib/codexSeed.js +147 -0
  6. package/lib/config.js +205 -188
  7. package/lib/folders.js +105 -105
  8. package/lib/localCliSessions.js +489 -489
  9. package/lib/persistedSessions.js +144 -142
  10. package/lib/webTerminal.js +224 -224
  11. package/lib/workspace.js +230 -230
  12. package/package.json +57 -57
  13. package/public/css/base.css +99 -99
  14. package/public/css/cards.css +183 -183
  15. package/public/css/feedback.css +303 -303
  16. package/public/css/forms.css +405 -405
  17. package/public/css/layout.css +160 -160
  18. package/public/css/modal.css +190 -190
  19. package/public/css/responsive.css +10 -10
  20. package/public/css/sidebar.css +613 -608
  21. package/public/css/terminals.css +294 -294
  22. package/public/css/tokens.css +81 -81
  23. package/public/css/wco.css +98 -98
  24. package/public/css/widgets.css +1628 -1628
  25. package/public/index.html +111 -105
  26. package/public/js/api.js +296 -280
  27. package/public/js/components/AdoptModal.js +343 -343
  28. package/public/js/components/App.js +35 -35
  29. package/public/js/components/DirectoryPicker.js +203 -203
  30. package/public/js/components/EntityFormModal.js +141 -141
  31. package/public/js/components/Modal.js +51 -51
  32. package/public/js/components/OfflineBanner.js +93 -93
  33. package/public/js/components/PageTitleBar.js +13 -13
  34. package/public/js/components/Picker.js +179 -179
  35. package/public/js/components/Popover.js +55 -55
  36. package/public/js/components/Sidebar.js +299 -299
  37. package/public/js/components/TerminalView.js +314 -314
  38. package/public/js/components/useDragSort.js +67 -67
  39. package/public/js/dialog.js +67 -67
  40. package/public/js/icons.js +177 -177
  41. package/public/js/main.js +132 -132
  42. package/public/js/pages/AboutPage.js +173 -165
  43. package/public/js/pages/ConfigurePage.js +513 -475
  44. package/public/js/pages/LaunchPage.js +369 -369
  45. package/public/js/pages/SessionsPage.js +101 -97
  46. package/public/js/state.js +231 -231
  47. package/scripts/dev.js +44 -11
  48. package/scripts/install.js +158 -158
  49. package/scripts/restart-helper.js +96 -0
  50. package/scripts/upgrade-helper.js +6 -1
  51. package/server.js +1282 -1254
  52. package/lib/cliSessionWatcher.js +0 -275
  53. package/public/manifest.webmanifest +0 -15
@@ -1,97 +1,101 @@
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, clearResumeFailure, 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 = () => {
68
+ clearResumeFailure(session.id);
69
+ setResumeError(null);
70
+ setRetryNonce((n) => n + 1);
71
+ };
72
+
73
+ return html`
74
+ <${PageTitleBar} title=${html`
75
+ <span class="session-title-text">${title}</span>
76
+ <span class="session-title-meta">
77
+ <span class="mono">${session.cwd}</span>
78
+ <span>·</span>
79
+ <span>${cli ? cli.name : session.cliId}</span>
80
+ ${session.repos.length ? html`<span>·</span><span>${session.repos.join(', ')}</span>` : null}
81
+ <span>·</span>
82
+ <span>${running ? 'running' : (resumeError ? 'resume failed' : 'resuming…')}</span>
83
+ </span>
84
+ `}>
85
+ </${PageTitleBar}>
86
+ <div class="session-pane">
87
+ <div class="session-pane-body">
88
+ ${running
89
+ ? html`<${TerminalView} terminalId=${session.id} />`
90
+ : html`
91
+ <div class="terminal-empty">
92
+ ${resumeError ? html`
93
+ <div>Failed to resume: <span class="mono">${resumeError}</span></div>
94
+ <button class="action primary" onClick=${onRetry}>Retry</button>
95
+ ` : html`
96
+ <div>Resuming session…</div>
97
+ `}
98
+ </div>`}
99
+ </div>
100
+ </div>`;
101
+ }