@bakapiano/ccsm 0.22.5 → 0.22.7
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/CLAUDE.md +538 -538
- package/README.md +189 -189
- package/bin/ccsm.js +235 -235
- package/lib/cliActivity.js +139 -139
- package/lib/codexSeed.js +183 -183
- package/lib/config.js +279 -274
- package/lib/devices.js +229 -229
- package/lib/folders.js +124 -124
- package/lib/localCliSessions.js +519 -519
- package/lib/persistedSessions.js +129 -129
- package/lib/tunnel.js +621 -621
- package/lib/webTerminal.js +225 -225
- package/lib/workspace.js +233 -233
- package/package.json +57 -57
- package/public/css/base.css +99 -99
- package/public/css/cards.css +183 -183
- package/public/css/feedback.css +504 -504
- package/public/css/forms.css +453 -453
- package/public/css/layout.css +177 -176
- package/public/css/modal.css +190 -190
- package/public/css/responsive.css +176 -176
- package/public/css/sidebar.css +707 -707
- package/public/css/terminals.css +547 -553
- package/public/css/tokens.css +81 -81
- package/public/css/wco.css +196 -196
- package/public/css/widgets.css +2725 -2725
- package/public/index.html +152 -152
- package/public/js/api.js +371 -371
- package/public/js/backend.js +149 -149
- package/public/js/components/App.js +73 -73
- package/public/js/components/DirectoryPicker.js +203 -203
- package/public/js/components/EntityFormModal.js +153 -153
- package/public/js/components/Modal.js +57 -57
- package/public/js/components/OfflineBanner.js +67 -67
- package/public/js/components/PageTitleBar.js +13 -13
- package/public/js/components/PendingApprovalOverlay.js +128 -128
- package/public/js/components/Picker.js +179 -179
- package/public/js/components/Popover.js +55 -55
- package/public/js/components/RestartOverlay.js +36 -36
- package/public/js/components/Sidebar.js +380 -380
- package/public/js/components/TerminalInstance.js +28 -9
- package/public/js/components/XtermTerminal.js +62 -2
- package/public/js/components/useDragSort.js +67 -67
- package/public/js/dialog.js +67 -67
- package/public/js/icons.js +212 -212
- package/public/js/main.js +296 -296
- package/public/js/pages/AboutPage.js +90 -90
- package/public/js/pages/ConfigurePage.js +728 -713
- package/public/js/pages/LaunchPage.js +421 -421
- package/public/js/pages/RemotePage.js +743 -743
- package/public/js/pages/SessionsPage.js +73 -80
- package/public/js/state.js +335 -335
- package/scripts/dev.js +149 -149
- package/scripts/install.js +153 -153
- package/scripts/restart-helper.js +96 -96
- package/scripts/upgrade-helper.js +687 -687
- package/server.js +1820 -1807
- package/public/manifest.webmanifest +0 -25
- package/public/setup/index.html +0 -567
package/lib/persistedSessions.js
CHANGED
|
@@ -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
|
+
};
|