@bakapiano/ccsm 0.15.3 → 0.15.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.
- package/lib/workspace.js +6 -3
- package/package.json +1 -1
- package/server.js +8 -0
package/lib/workspace.js
CHANGED
|
@@ -95,8 +95,11 @@ function nextWorkspaceName(existing) {
|
|
|
95
95
|
throw new Error('Could not allocate workspace name');
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
async function findOrCreateWorkspace({ workDir, repos, requireUnused = true }) {
|
|
99
|
-
|
|
98
|
+
async function findOrCreateWorkspace({ workDir, repos, busyPaths = [], requireUnused = true }) {
|
|
99
|
+
// Without busyPaths, every workspace looks free → find() always
|
|
100
|
+
// returns ws-1 → every new session piles into ws-1. Callers must
|
|
101
|
+
// pass the cwds of currently-running persisted sessions.
|
|
102
|
+
const all = await listWorkspaces({ workDir, repos, busyPaths });
|
|
100
103
|
if (requireUnused) {
|
|
101
104
|
const free = all.find((w) => !w.inUse);
|
|
102
105
|
if (free) return { workspace: free, created: false };
|
|
@@ -104,7 +107,7 @@ async function findOrCreateWorkspace({ workDir, repos, requireUnused = true }) {
|
|
|
104
107
|
const name = nextWorkspaceName(all);
|
|
105
108
|
const wsPath = path.join(workDir, name);
|
|
106
109
|
await ensureDir(wsPath);
|
|
107
|
-
const ws = await describeWorkspace(wsPath, repos,
|
|
110
|
+
const ws = await describeWorkspace(wsPath, repos, busyPaths);
|
|
108
111
|
return { workspace: ws, created: true };
|
|
109
112
|
}
|
|
110
113
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakapiano/ccsm",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"description": "Claude Code Session Manager — Windows web UI to manage many concurrent claude sessions: live list, snapshot/restore, focus existing window, new session in an isolated workspace with repo clones",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "server.js",
|
package/server.js
CHANGED
|
@@ -652,9 +652,17 @@ app.post('/api/sessions/new', async (req, res) => {
|
|
|
652
652
|
workspace = all.find((w) => w.name === req.body.workspace);
|
|
653
653
|
if (!workspace) return fail(`workspace ${req.body.workspace} not found`);
|
|
654
654
|
} else {
|
|
655
|
+
// Collect cwds of currently-running persisted sessions so
|
|
656
|
+
// findOrCreateWorkspace can flag those workspaces as in-use and
|
|
657
|
+
// skip past ws-1 when it's already occupied.
|
|
658
|
+
const running = await persistedSessions.loadAll();
|
|
659
|
+
const busyPaths = running
|
|
660
|
+
.filter((s) => s.status === 'running')
|
|
661
|
+
.map((s) => s.cwd);
|
|
655
662
|
const r = await findOrCreateWorkspace({
|
|
656
663
|
workDir: cfg.workDir,
|
|
657
664
|
repos: cfg.repos,
|
|
665
|
+
busyPaths,
|
|
658
666
|
requireUnused: true,
|
|
659
667
|
});
|
|
660
668
|
workspace = r.workspace;
|