@bakapiano/ccsm 0.22.2 → 0.22.4

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 (60) hide show
  1. package/CLAUDE.md +538 -538
  2. package/README.md +189 -189
  3. package/bin/ccsm.js +235 -235
  4. package/lib/cliActivity.js +139 -139
  5. package/lib/codexSeed.js +183 -183
  6. package/lib/config.js +274 -274
  7. package/lib/devices.js +229 -229
  8. package/lib/folders.js +124 -124
  9. package/lib/localCliSessions.js +519 -519
  10. package/lib/persistedSessions.js +129 -129
  11. package/lib/tunnel.js +621 -621
  12. package/lib/webTerminal.js +233 -231
  13. package/lib/workspace.js +233 -233
  14. package/package.json +57 -57
  15. package/public/css/base.css +99 -99
  16. package/public/css/cards.css +183 -183
  17. package/public/css/feedback.css +504 -504
  18. package/public/css/forms.css +453 -453
  19. package/public/css/layout.css +176 -176
  20. package/public/css/modal.css +190 -190
  21. package/public/css/responsive.css +176 -176
  22. package/public/css/sidebar.css +707 -707
  23. package/public/css/terminals.css +592 -592
  24. package/public/css/tokens.css +81 -81
  25. package/public/css/wco.css +196 -196
  26. package/public/css/widgets.css +2725 -2725
  27. package/public/index.html +152 -152
  28. package/public/js/api.js +371 -371
  29. package/public/js/backend.js +149 -149
  30. package/public/js/components/App.js +73 -73
  31. package/public/js/components/DirectoryPicker.js +203 -203
  32. package/public/js/components/EntityFormModal.js +153 -153
  33. package/public/js/components/Modal.js +57 -57
  34. package/public/js/components/OfflineBanner.js +67 -67
  35. package/public/js/components/PageTitleBar.js +13 -13
  36. package/public/js/components/PendingApprovalOverlay.js +128 -128
  37. package/public/js/components/Picker.js +179 -179
  38. package/public/js/components/Popover.js +55 -55
  39. package/public/js/components/RestartOverlay.js +36 -36
  40. package/public/js/components/Sidebar.js +380 -380
  41. package/public/js/components/TerminalInstance.js +187 -15
  42. package/public/js/components/TerminalResizeDebouncer.js +126 -0
  43. package/public/js/components/XtermTerminal.js +148 -14
  44. package/public/js/components/useDragSort.js +67 -67
  45. package/public/js/dialog.js +67 -67
  46. package/public/js/icons.js +212 -212
  47. package/public/js/main.js +296 -296
  48. package/public/js/pages/AboutPage.js +90 -90
  49. package/public/js/pages/ConfigurePage.js +713 -713
  50. package/public/js/pages/LaunchPage.js +421 -421
  51. package/public/js/pages/RemotePage.js +743 -743
  52. package/public/js/pages/SessionsPage.js +100 -100
  53. package/public/js/state.js +335 -335
  54. package/public/manifest.webmanifest +25 -0
  55. package/public/setup/index.html +567 -0
  56. package/scripts/dev.js +149 -149
  57. package/scripts/install.js +153 -153
  58. package/scripts/restart-helper.js +96 -96
  59. package/scripts/upgrade-helper.js +687 -687
  60. package/server.js +1807 -1807
@@ -1,24 +1,24 @@
1
- 'use strict';
2
-
3
- // ccsm-owned session records. Replaces the old "scan ~/.claude/sessions/
4
- // + tasklist" path entirely: we no longer try to enumerate every claude
5
- // process on the machine. Instead, every session ccsm starts (via the
6
- // web terminal) gets recorded here, and the user organises them in
7
- // folders.
8
- //
9
- // Each entry:
10
- // {
11
- // id: 'sess-...', // ccsm's session id (matches webTerminal id)
12
- // cliId: 'claude', // which CLI from config.clis
13
- // cwd: '...', // absolute workspace path
14
- // workspace: 'ws-3', // basename of cwd (display)
15
- // title: '', // user-edited label (Configure / sidebar tree)
16
- // folderId: null, // nullable; null = "Unsorted" top-level
17
- // repos: ['foo','bar'], // names of repos cloned into cwd at launch
18
- // createdAt: 1234,
19
- // lastActiveAt: 1234, // updated on attach/input; drives sort
20
- // status: 'running'|'exited',
21
- // exitedAt: null,
1
+ 'use strict';
2
+
3
+ // ccsm-owned session records. Replaces the old "scan ~/.claude/sessions/
4
+ // + tasklist" path entirely: we no longer try to enumerate every claude
5
+ // process on the machine. Instead, every session ccsm starts (via the
6
+ // web terminal) gets recorded here, and the user organises them in
7
+ // folders.
8
+ //
9
+ // Each entry:
10
+ // {
11
+ // id: 'sess-...', // ccsm's session id (matches webTerminal id)
12
+ // cliId: 'claude', // which CLI from config.clis
13
+ // cwd: '...', // absolute workspace path
14
+ // workspace: 'ws-3', // basename of cwd (display)
15
+ // title: '', // user-edited label (Configure / sidebar tree)
16
+ // folderId: null, // nullable; null = "Unsorted" top-level
17
+ // repos: ['foo','bar'], // names of repos cloned into cwd at launch
18
+ // createdAt: 1234,
19
+ // lastActiveAt: 1234, // updated on attach/input; drives sort
20
+ // status: 'running'|'exited',
21
+ // exitedAt: null,
22
22
  // exitCode: null,
23
23
  // pid: null, // current pid if running
24
24
  // cliSessionId: null, // upstream CLI's session UUID. Pre-assigned
@@ -30,119 +30,119 @@
30
30
  // // it from ccsm; prevents auto-resume until
31
31
  // // they press Resume.
32
32
  // }
33
-
34
- const path = require('node:path');
35
- const fs = require('node:fs/promises');
36
- const { DATA_DIR } = require('./config');
37
- const { atomicWriteJson, withFileLock } = require('./atomicJson');
38
-
39
- const FILE = path.join(DATA_DIR, 'sessions.json');
40
-
41
- async function loadAll() {
42
- try {
43
- const raw = await fs.readFile(FILE, 'utf8');
44
- const j = JSON.parse(raw);
45
- return Array.isArray(j) ? j : [];
46
- } catch (e) {
47
- if (e.code === 'ENOENT') return [];
48
- throw e;
49
- }
50
- }
51
-
52
- async function saveAll(list) {
53
- await atomicWriteJson(FILE, list);
54
- }
55
-
56
- function genId() {
57
- return 'sess-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 8);
58
- }
59
-
60
- async function create(opts) {
61
- return withFileLock(FILE, async () => {
62
- const { cliId, cwd, workspace, repos = [], folderId = null, title = '', status = 'running', cliSessionId = null } = opts;
63
- const list = await loadAll();
64
- const entry = {
65
- id: genId(),
66
- cliId,
67
- cwd,
68
- workspace,
69
- title,
70
- folderId,
71
- repos,
72
- createdAt: Date.now(),
73
- lastActiveAt: Date.now(),
74
- status,
75
- exitedAt: status === 'exited' ? Date.now() : null,
33
+
34
+ const path = require('node:path');
35
+ const fs = require('node:fs/promises');
36
+ const { DATA_DIR } = require('./config');
37
+ const { atomicWriteJson, withFileLock } = require('./atomicJson');
38
+
39
+ const FILE = path.join(DATA_DIR, 'sessions.json');
40
+
41
+ async function loadAll() {
42
+ try {
43
+ const raw = await fs.readFile(FILE, 'utf8');
44
+ const j = JSON.parse(raw);
45
+ return Array.isArray(j) ? j : [];
46
+ } catch (e) {
47
+ if (e.code === 'ENOENT') return [];
48
+ throw e;
49
+ }
50
+ }
51
+
52
+ async function saveAll(list) {
53
+ await atomicWriteJson(FILE, list);
54
+ }
55
+
56
+ function genId() {
57
+ return 'sess-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 8);
58
+ }
59
+
60
+ async function create(opts) {
61
+ return withFileLock(FILE, async () => {
62
+ const { cliId, cwd, workspace, repos = [], folderId = null, title = '', status = 'running', cliSessionId = null } = opts;
63
+ const list = await loadAll();
64
+ const entry = {
65
+ id: genId(),
66
+ cliId,
67
+ cwd,
68
+ workspace,
69
+ title,
70
+ folderId,
71
+ repos,
72
+ createdAt: Date.now(),
73
+ lastActiveAt: Date.now(),
74
+ status,
75
+ exitedAt: status === 'exited' ? Date.now() : null,
76
76
  exitCode: null,
77
77
  pid: null,
78
78
  cliSessionId,
79
79
  manualStopped: false,
80
80
  };
81
- list.push(entry);
82
- await saveAll(list);
83
- return entry;
84
- });
85
- }
86
-
87
- async function get(id) {
88
- const list = await loadAll();
89
- return list.find((s) => s.id === id) || null;
90
- }
91
-
92
- async function update(id, patch) {
93
- return withFileLock(FILE, async () => {
94
- const list = await loadAll();
95
- const idx = list.findIndex((s) => s.id === id);
96
- if (idx < 0) return null;
97
- list[idx] = { ...list[idx], ...patch };
98
- await saveAll(list);
99
- return list[idx];
100
- });
101
- }
102
-
103
- async function remove(id) {
104
- return withFileLock(FILE, async () => {
105
- const list = await loadAll();
106
- const idx = list.findIndex((s) => s.id === id);
107
- if (idx < 0) return false;
108
- list.splice(idx, 1);
109
- await saveAll(list);
110
- return true;
111
- });
112
- }
113
-
114
- // Convenience helpers used at runtime so callers don't have to do
115
- // load/find/update/save themselves.
81
+ list.push(entry);
82
+ await saveAll(list);
83
+ return entry;
84
+ });
85
+ }
86
+
87
+ async function get(id) {
88
+ const list = await loadAll();
89
+ return list.find((s) => s.id === id) || null;
90
+ }
91
+
92
+ async function update(id, patch) {
93
+ return withFileLock(FILE, async () => {
94
+ const list = await loadAll();
95
+ const idx = list.findIndex((s) => s.id === id);
96
+ if (idx < 0) return null;
97
+ list[idx] = { ...list[idx], ...patch };
98
+ await saveAll(list);
99
+ return list[idx];
100
+ });
101
+ }
102
+
103
+ async function remove(id) {
104
+ return withFileLock(FILE, async () => {
105
+ const list = await loadAll();
106
+ const idx = list.findIndex((s) => s.id === id);
107
+ if (idx < 0) return false;
108
+ list.splice(idx, 1);
109
+ await saveAll(list);
110
+ return true;
111
+ });
112
+ }
113
+
114
+ // Convenience helpers used at runtime so callers don't have to do
115
+ // load/find/update/save themselves.
116
116
  async function markRunning(id, pid) {
117
117
  return update(id, { status: 'running', pid, exitedAt: null, exitCode: null, manualStopped: false, lastActiveAt: Date.now() });
118
118
  }
119
-
120
- async function markExited(id, exitCode) {
121
- return update(id, { status: 'exited', exitCode: exitCode ?? null, exitedAt: Date.now(), pid: null });
122
- }
123
-
124
- async function touch(id) {
125
- return update(id, { lastActiveAt: Date.now() });
126
- }
127
-
128
- async function setFolder(id, folderId) {
129
- return update(id, { folderId: folderId || null });
130
- }
131
-
132
- async function setTitle(id, title) {
133
- return update(id, { title: title || '' });
134
- }
135
-
136
- module.exports = {
137
- loadAll,
138
- create,
139
- get,
140
- update,
141
- remove,
142
- markRunning,
143
- markExited,
144
- touch,
145
- setFolder,
146
- setTitle,
147
- FILE,
148
- };
119
+
120
+ async function markExited(id, exitCode) {
121
+ return update(id, { status: 'exited', exitCode: exitCode ?? null, exitedAt: Date.now(), pid: null });
122
+ }
123
+
124
+ async function touch(id) {
125
+ return update(id, { lastActiveAt: Date.now() });
126
+ }
127
+
128
+ async function setFolder(id, folderId) {
129
+ return update(id, { folderId: folderId || null });
130
+ }
131
+
132
+ async function setTitle(id, title) {
133
+ return update(id, { title: title || '' });
134
+ }
135
+
136
+ module.exports = {
137
+ loadAll,
138
+ create,
139
+ get,
140
+ update,
141
+ remove,
142
+ markRunning,
143
+ markExited,
144
+ touch,
145
+ setFolder,
146
+ setTitle,
147
+ FILE,
148
+ };