@clipboard-health/groundcrew 4.45.6 → 4.45.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/dist/lib/cmuxAdapter.d.ts.map +1 -1
- package/dist/lib/cmuxAdapter.js +66 -20
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmuxAdapter.d.ts","sourceRoot":"","sources":["../../src/lib/cmuxAdapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"cmuxAdapter.d.ts","sourceRoot":"","sources":["../../src/lib/cmuxAdapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,OAAO,EAKb,MAAM,uBAAuB,CAAC;AAG/B,eAAO,MAAM,WAAW,EAAE,OA+EzB,CAAC"}
|
package/dist/lib/cmuxAdapter.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* per-workspace status pill, which `open` applies best-effort.
|
|
5
5
|
*/
|
|
6
6
|
import { isSignalAborted, runWorkspaceCommand, } from "./workspaceAdapter.js";
|
|
7
|
-
import { debug, errorMessage, log } from "./util.js";
|
|
7
|
+
import { debug, errorMessage, log, logEvent } from "./util.js";
|
|
8
8
|
export const cmuxAdapter = {
|
|
9
9
|
async open(spec, signal) {
|
|
10
10
|
let output;
|
|
@@ -58,28 +58,21 @@ export const cmuxAdapter = {
|
|
|
58
58
|
debug(`cmux close-workspace skipped for ${name}: list-workspaces failed, no usable id`);
|
|
59
59
|
return { kind: "unavailable" };
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
61
|
+
const matches = raw.filter((ws) => cmuxTaskId(ws) === name);
|
|
62
|
+
if (matches.length === 0) {
|
|
63
63
|
return { kind: "missing" };
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (remaining === undefined) {
|
|
75
|
-
return { kind: "unavailable", error };
|
|
76
|
-
}
|
|
77
|
-
const isStillPresent = remaining.some((ws) => cmuxTaskId(ws) === name);
|
|
78
|
-
if (!isStillPresent) {
|
|
79
|
-
return { kind: "closed" };
|
|
80
|
-
}
|
|
81
|
-
throw error;
|
|
65
|
+
if (matches.length > 1) {
|
|
66
|
+
// A single task id maps to many cmux workspaces only after a leaked launch
|
|
67
|
+
// or session-restore duplication. Surface the leak so it's observable
|
|
68
|
+
// rather than silently reconciled away.
|
|
69
|
+
logEvent("cmux_close", {
|
|
70
|
+
outcome: "duplicate_markers",
|
|
71
|
+
task: name,
|
|
72
|
+
duplicates: matches.length,
|
|
73
|
+
});
|
|
82
74
|
}
|
|
75
|
+
return await closeAllCmuxMatches(matches, signal);
|
|
83
76
|
},
|
|
84
77
|
accessHint(_name) {
|
|
85
78
|
// cmux is a TUI; users surface workspaces by launching the cmux app,
|
|
@@ -184,6 +177,59 @@ async function applyCmuxStatus(workspaceId, status, signal) {
|
|
|
184
177
|
arguments_.push("--workspace", workspaceId);
|
|
185
178
|
await runWorkspaceCommand("cmux", arguments_, signal);
|
|
186
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Closes every workspace sharing the requested marker. Closes run sequentially:
|
|
182
|
+
* a failure path re-lists cmux to confirm the workspace is gone, and firing N
|
|
183
|
+
* mutations plus N confirmation lists concurrently would race on that shared
|
|
184
|
+
* state. Each match is attempted even when an earlier one fails, so a single
|
|
185
|
+
* stuck duplicate can't orphan the rest; a confirmed-still-present failure is
|
|
186
|
+
* collected and rethrown only after the loop (preserving single-match
|
|
187
|
+
* semantics). A failure that cannot be confirmed yields `unavailable`; `closed`
|
|
188
|
+
* wins only when every match is gone.
|
|
189
|
+
*/
|
|
190
|
+
async function closeAllCmuxMatches(matches, signal) {
|
|
191
|
+
let unavailable;
|
|
192
|
+
const errors = [];
|
|
193
|
+
for (const match of matches) {
|
|
194
|
+
try {
|
|
195
|
+
// oxlint-disable-next-line no-await-in-loop -- sequential by design; failure re-lists shared cmux state
|
|
196
|
+
const result = await closeCmuxMatch(match, signal);
|
|
197
|
+
if (result.kind === "unavailable") {
|
|
198
|
+
unavailable = result;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
if (isSignalAborted(signal)) {
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
errors.push(error);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (errors.length > 0) {
|
|
209
|
+
throw errors.length === 1 ? errors[0] : new AggregateError(errors);
|
|
210
|
+
}
|
|
211
|
+
return unavailable ?? { kind: "closed" };
|
|
212
|
+
}
|
|
213
|
+
async function closeCmuxMatch(match, signal) {
|
|
214
|
+
try {
|
|
215
|
+
await closeCmuxWorkspace(match.id, signal);
|
|
216
|
+
return { kind: "closed" };
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
if (isSignalAborted(signal)) {
|
|
220
|
+
throw error;
|
|
221
|
+
}
|
|
222
|
+
const remaining = await listCmuxRaw(signal);
|
|
223
|
+
if (remaining === undefined) {
|
|
224
|
+
return { kind: "unavailable", error };
|
|
225
|
+
}
|
|
226
|
+
const isStillPresent = remaining.some((ws) => ws.id === match.id);
|
|
227
|
+
if (!isStillPresent) {
|
|
228
|
+
return { kind: "closed" };
|
|
229
|
+
}
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
187
233
|
async function closeCmuxWorkspace(workspaceId, signal) {
|
|
188
234
|
await runWorkspaceCommand("cmux", ["close-workspace", "--workspace", workspaceId], signal);
|
|
189
235
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipboard-health/groundcrew",
|
|
3
|
-
"version": "4.45.
|
|
3
|
+
"version": "4.45.7",
|
|
4
4
|
"description": "Linear-driven orchestrator that launches AI coding agents in git worktrees, with workspace lifecycle and usage tracking.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"cspell": "10.0.1",
|
|
89
89
|
"dependency-cruiser": "17.4.3",
|
|
90
90
|
"husky": "9.1.7",
|
|
91
|
-
"jscpd": "5.0.
|
|
91
|
+
"jscpd": "5.0.11",
|
|
92
92
|
"knip": "6.16.1",
|
|
93
93
|
"lint-staged": "17.0.7",
|
|
94
94
|
"markdownlint-cli2": "0.22.1",
|