@clipboard-health/groundcrew 4.45.3 → 4.45.5
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/commands/cleaner.d.ts +1 -1
- package/dist/commands/cleaner.d.ts.map +1 -1
- package/dist/commands/cleaner.js +2 -9
- package/dist/commands/openWorkspace.d.ts.map +1 -1
- package/dist/commands/openWorkspace.js +1 -0
- package/dist/commands/resumeWorkspace.d.ts.map +1 -1
- package/dist/commands/resumeWorkspace.js +1 -0
- package/dist/commands/reviewer.d.ts +5 -2
- package/dist/commands/reviewer.d.ts.map +1 -1
- package/dist/commands/reviewer.js +24 -4
- package/dist/commands/setupWorkspace.d.ts.map +1 -1
- package/dist/commands/setupWorkspace.js +1 -0
- package/dist/commands/teardownReporter.d.ts +8 -1
- package/dist/commands/teardownReporter.d.ts.map +1 -1
- package/dist/commands/teardownReporter.js +16 -0
- package/dist/lib/agentLaunch.d.ts +1 -0
- package/dist/lib/agentLaunch.d.ts.map +1 -1
- package/dist/lib/agentLaunch.js +4 -0
- package/dist/lib/config.d.ts +9 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +23 -7
- package/dist/lib/launchCommand.d.ts +6 -0
- package/dist/lib/launchCommand.d.ts.map +1 -1
- package/dist/lib/launchCommand.js +4 -1
- package/dist/lib/srtLaunch.d.ts +2 -0
- package/dist/lib/srtLaunch.d.ts.map +1 -1
- package/dist/lib/srtLaunch.js +1 -0
- package/dist/lib/srtPolicy.d.ts +6 -0
- package/dist/lib/srtPolicy.d.ts.map +1 -1
- package/dist/lib/srtPolicy.js +1 -0
- package/dist/lib/usage.d.ts.map +1 -1
- package/dist/lib/usage.js +60 -7
- package/docs/configuration.md +1 -0
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { ResolvedConfig } from "../lib/config.ts";
|
|
7
7
|
import { type BoardState } from "../lib/taskSource.ts";
|
|
8
|
-
import {
|
|
8
|
+
import type { WorktreeEntry } from "../lib/worktrees.ts";
|
|
9
9
|
interface CleanerDeps {
|
|
10
10
|
config: ResolvedConfig;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleaner.d.ts","sourceRoot":"","sources":["../../src/commands/cleaner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"cleaner.d.ts","sourceRoot":"","sources":["../../src/commands/cleaner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,UAAU,WAAW;IACnB,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,CAAC,UAAU,EAAE;QACpB,KAAK,EAAE,UAAU,CAAC;QAClB,eAAe,EAAE,SAAS,aAAa,EAAE,CAAC;QAC1C,MAAM,EAAE,OAAO,CAAC;QAChB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CA8CxD"}
|
package/dist/commands/cleaner.js
CHANGED
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
* tasks that have reached a terminal status. One per `orchestrate()`
|
|
4
4
|
* invocation; stateless across iterations. Mirrors `Dispatcher`.
|
|
5
5
|
*/
|
|
6
|
-
import { recordCleanedUpRuns } from "../lib/runStateCleanup.js";
|
|
7
6
|
import { naturalIdFromCanonical } from "../lib/taskSource.js";
|
|
8
7
|
import { log, logEvent } from "../lib/util.js";
|
|
9
|
-
import {
|
|
10
|
-
import { logTeardown, recordTeardownEvents } from "./teardownReporter.js";
|
|
8
|
+
import { reapWorktrees } from "./teardownReporter.js";
|
|
11
9
|
export function createCleaner(deps) {
|
|
12
10
|
const { config } = deps;
|
|
13
11
|
async function runOnce(arguments_) {
|
|
@@ -37,12 +35,7 @@ export function createCleaner(deps) {
|
|
|
37
35
|
return;
|
|
38
36
|
}
|
|
39
37
|
log(`Cleaning up ${stale.length} terminal worktree(s)`);
|
|
40
|
-
|
|
41
|
-
? await worktrees.teardown(config, stale)
|
|
42
|
-
: await worktrees.teardown(config, stale, { signal });
|
|
43
|
-
recordCleanedUpRuns(config, result.removed);
|
|
44
|
-
logTeardown(result);
|
|
45
|
-
recordTeardownEvents(result);
|
|
38
|
+
await reapWorktrees(config, stale, signal);
|
|
46
39
|
}
|
|
47
40
|
return { runOnce };
|
|
48
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openWorkspace.d.ts","sourceRoot":"","sources":["../../src/commands/openWorkspace.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiC,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AActF,UAAU,gBAAgB;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA6JD,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"openWorkspace.d.ts","sourceRoot":"","sources":["../../src/commands/openWorkspace.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiC,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AActF,UAAU,gBAAgB;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA6JD,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAyGf;AA4ID,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAE3E;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpE"}
|
|
@@ -172,6 +172,7 @@ export async function openWorkspace(config, options) {
|
|
|
172
172
|
prepareWorktreeCommand,
|
|
173
173
|
sandboxName,
|
|
174
174
|
workspaceKind,
|
|
175
|
+
readOnlyDirs: config.local.readOnlyDirs,
|
|
175
176
|
omitPromptArgument,
|
|
176
177
|
}));
|
|
177
178
|
const launchCmd = stageWorkspaceLaunchCommand(stagedPrompt.directory, launchCommand);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resumeWorkspace.d.ts","sourceRoot":"","sources":["../../src/commands/resumeWorkspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoC,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAiBzF,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAyKD,wBAAsB,eAAe,CACnC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"resumeWorkspace.d.ts","sourceRoot":"","sources":["../../src/commands/resumeWorkspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoC,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAiBzF,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAyKD,wBAAsB,eAAe,CACnC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAoGf;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGtE"}
|
|
@@ -194,6 +194,7 @@ export async function resumeWorkspace(config, options) {
|
|
|
194
194
|
secretsFile,
|
|
195
195
|
sandboxName,
|
|
196
196
|
workspaceKind,
|
|
197
|
+
readOnlyDirs: config.local.readOnlyDirs,
|
|
197
198
|
workerEnvironment: workerEnvironmentForTask({
|
|
198
199
|
taskId: context.completionTaskId,
|
|
199
200
|
markDoneSupported: context.completionMarkDoneSupported,
|
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
* dispatch slot (slot math counts only in-progress) while leaving the
|
|
8
8
|
* worktree intact for review, since the cleaner only tears down `done`.
|
|
9
9
|
* - A **merged** PR (on an in-progress or in-review task) → `markDone`:
|
|
10
|
-
* the work has landed, so the task is terminal
|
|
11
|
-
*
|
|
10
|
+
* the work has landed, so the task is terminal. On a successful `markDone`
|
|
11
|
+
* the reviewer tears the worktree down immediately (same step). The cleaner
|
|
12
|
+
* remains the level-triggered backstop for sources where `markDone` is
|
|
13
|
+
* unsupported or that keep reporting `done`. `merged` never routes to
|
|
14
|
+
* `in-review`.
|
|
12
15
|
*
|
|
13
16
|
* Sources that don't implement `markDone` (e.g. Linear) return `unsupported`;
|
|
14
17
|
* the reviewer logs the skip and does nothing — there is no in-review
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../src/commands/reviewer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../src/commands/reviewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACL,KAAK,UAAU,EAIhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAK,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC,CAAC;AAE7C,UAAU,YAAY;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,sEAAsE;AACtE,UAAU,eAAe;IACvB,KAAK,EAAE,UAAU,CAAC;IAClB,eAAe,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,CAAC,UAAU,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AA+CD,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,CAiJ3D"}
|
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
* dispatch slot (slot math counts only in-progress) while leaving the
|
|
8
8
|
* worktree intact for review, since the cleaner only tears down `done`.
|
|
9
9
|
* - A **merged** PR (on an in-progress or in-review task) → `markDone`:
|
|
10
|
-
* the work has landed, so the task is terminal
|
|
11
|
-
*
|
|
10
|
+
* the work has landed, so the task is terminal. On a successful `markDone`
|
|
11
|
+
* the reviewer tears the worktree down immediately (same step). The cleaner
|
|
12
|
+
* remains the level-triggered backstop for sources where `markDone` is
|
|
13
|
+
* unsupported or that keep reporting `done`. `merged` never routes to
|
|
14
|
+
* `in-review`.
|
|
12
15
|
*
|
|
13
16
|
* Sources that don't implement `markDone` (e.g. Linear) return `unsupported`;
|
|
14
17
|
* the reviewer logs the skip and does nothing — there is no in-review
|
|
@@ -24,6 +27,7 @@
|
|
|
24
27
|
import { naturalIdFromCanonical, } from "../lib/taskSource.js";
|
|
25
28
|
import { debug, errorMessage, log, logEvent } from "../lib/util.js";
|
|
26
29
|
import { effectiveBranchName } from "../lib/worktreeRunState.js";
|
|
30
|
+
import { reapWorktrees } from "./teardownReporter.js";
|
|
27
31
|
// Maps a worktree's PRs to the transition its task should make. A merged PR
|
|
28
32
|
// means the work landed → done; an open PR on an in-progress task means it's
|
|
29
33
|
// up for review. `merged` wins over `open`. An open PR on an already in-review
|
|
@@ -118,7 +122,15 @@ export function createReviewer(deps) {
|
|
|
118
122
|
return;
|
|
119
123
|
}
|
|
120
124
|
// oxlint-disable-next-line no-await-in-loop -- single write-back then return; never iterates past the first actionable worktree.
|
|
121
|
-
await advance({
|
|
125
|
+
await advance({
|
|
126
|
+
issue,
|
|
127
|
+
task,
|
|
128
|
+
pullRequest,
|
|
129
|
+
transition,
|
|
130
|
+
entry,
|
|
131
|
+
reviewerConfig,
|
|
132
|
+
signal,
|
|
133
|
+
});
|
|
122
134
|
return;
|
|
123
135
|
}
|
|
124
136
|
}
|
|
@@ -126,7 +138,7 @@ export function createReviewer(deps) {
|
|
|
126
138
|
// task keeps its status and is retried next tick, exactly like a failed
|
|
127
139
|
// lookup. We never let one task's writeback abort the others' reviews.
|
|
128
140
|
async function advance(arguments_) {
|
|
129
|
-
const { issue, task, pullRequest, transition } = arguments_;
|
|
141
|
+
const { issue, task, pullRequest, transition, entry, reviewerConfig, signal } = arguments_;
|
|
130
142
|
try {
|
|
131
143
|
const result = transition === "done" ? await board.markDone(issue) : await board.markInReview(issue);
|
|
132
144
|
if (result.outcome === "unsupported") {
|
|
@@ -147,6 +159,14 @@ export function createReviewer(deps) {
|
|
|
147
159
|
state: pullRequest.state,
|
|
148
160
|
to: transition,
|
|
149
161
|
});
|
|
162
|
+
if (transition === "done" && reviewerConfig !== undefined) {
|
|
163
|
+
try {
|
|
164
|
+
await reapWorktrees(reviewerConfig, [entry], signal);
|
|
165
|
+
}
|
|
166
|
+
catch (teardownError) {
|
|
167
|
+
log(`Teardown failed for ${task}: ${errorMessage(teardownError)}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
150
170
|
}
|
|
151
171
|
catch (error) {
|
|
152
172
|
log(`Failed to advance ${task} to ${transition}: ${errorMessage(error)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupWorkspace.d.ts","sourceRoot":"","sources":["../../src/commands/setupWorkspace.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAA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cAAc,CAClC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,qBAAqB,EAC9B,UAAU,GAAE,wBAA6B,GACxC,OAAO,CAAC,IAAI,CAAC,CAiJf;AA8MD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,OAAO,CAAC,IAAI,CAAC,CAkDf"}
|
|
@@ -115,6 +115,7 @@ export async function setupWorkspace(config, options, runOptions = {}) {
|
|
|
115
115
|
prepareWorktreeCommand,
|
|
116
116
|
sandboxName,
|
|
117
117
|
workspaceKind,
|
|
118
|
+
readOnlyDirs: config.local.readOnlyDirs,
|
|
118
119
|
workerEnvironment: workerEnvironmentForTask({
|
|
119
120
|
taskId: completionTaskId,
|
|
120
121
|
markDoneSupported: completionMarkDoneSupported,
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolvedConfig } from "../lib/config.ts";
|
|
2
|
+
import { type TeardownResult, type WorktreeEntry } from "../lib/worktrees.ts";
|
|
2
3
|
export declare function logTeardown(result: TeardownResult): void;
|
|
4
|
+
/**
|
|
5
|
+
* Shared helper: runs `worktrees.teardown` then records run-state cleanup,
|
|
6
|
+
* logs the result, and emits telemetry events. Used by both the cleaner and
|
|
7
|
+
* the reviewer fast-path so the sequence is never duplicated.
|
|
8
|
+
*/
|
|
9
|
+
export declare function reapWorktrees(config: ResolvedConfig, entries: readonly WorktreeEntry[], signal?: AbortSignal): Promise<TeardownResult>;
|
|
3
10
|
export declare function recordTeardownEvents(result: TeardownResult): void;
|
|
4
11
|
//# sourceMappingURL=teardownReporter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teardownReporter.d.ts","sourceRoot":"","sources":["../../src/commands/teardownReporter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"teardownReporter.d.ts","sourceRoot":"","sources":["../../src/commands/teardownReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAa,MAAM,qBAAqB,CAAC;AAEzF,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAmBxD;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,cAAc,CAAC,CASzB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAwCjE"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { recordCleanedUpRuns } from "../lib/runStateCleanup.js";
|
|
1
2
|
import { debug, errorMessage, log, logEvent, okMark } from "../lib/util.js";
|
|
3
|
+
import { worktrees } from "../lib/worktrees.js";
|
|
2
4
|
export function logTeardown(result) {
|
|
3
5
|
if (result.workspaceProbe.kind === "unavailable" && result.workspaceProbe.error !== undefined) {
|
|
4
6
|
log(`workspace list failed: ${errorMessage(result.workspaceProbe.error)}`);
|
|
@@ -20,6 +22,20 @@ export function logTeardown(result) {
|
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Shared helper: runs `worktrees.teardown` then records run-state cleanup,
|
|
27
|
+
* logs the result, and emits telemetry events. Used by both the cleaner and
|
|
28
|
+
* the reviewer fast-path so the sequence is never duplicated.
|
|
29
|
+
*/
|
|
30
|
+
export async function reapWorktrees(config, entries, signal) {
|
|
31
|
+
const result = signal === undefined
|
|
32
|
+
? await worktrees.teardown(config, entries)
|
|
33
|
+
: await worktrees.teardown(config, entries, { signal });
|
|
34
|
+
recordCleanedUpRuns(config, result.removed);
|
|
35
|
+
logTeardown(result);
|
|
36
|
+
recordTeardownEvents(result);
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
23
39
|
export function recordTeardownEvents(result) {
|
|
24
40
|
if (result.workspaceProbe.kind === "unavailable") {
|
|
25
41
|
logEvent("cleanup", {
|
|
@@ -24,6 +24,7 @@ export declare function composeAgentLaunch(input: {
|
|
|
24
24
|
omitPromptArgument?: boolean | undefined;
|
|
25
25
|
taskSourceWritePaths?: readonly string[] | undefined;
|
|
26
26
|
safehouseEnableFeatures?: readonly string[] | undefined;
|
|
27
|
+
readOnlyDirs?: readonly string[] | undefined;
|
|
27
28
|
}): {
|
|
28
29
|
launchCommand: string;
|
|
29
30
|
srtSettingsDir: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentLaunch.d.ts","sourceRoot":"","sources":["../../src/lib/agentLaunch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agentLaunch.d.ts","sourceRoot":"","sources":["../../src/lib/agentLaunch.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAErB,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAM5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,MAAM,EAAE,WAAW,CAAC;IACpB,aAAa,EAAE,oBAAoB,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CA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aunch.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
1
2
|
import { ensureClearance, resolveSafehouseCmuxIntegration, safehouseCmuxIntegrationWarningLines, } from "@clipboard-health/clearance";
|
|
2
3
|
import { clearanceAllowHostsFilesFromEnvironment } from "./clearanceAllowlist.js";
|
|
3
4
|
import { cmuxAgentHookSettingsJson } from "./cmuxAgentHooks.js";
|
|
@@ -24,6 +25,7 @@ export function composeAgentLaunch(input) {
|
|
|
24
25
|
worktreeDir: input.worktreeDir,
|
|
25
26
|
definition: input.definition,
|
|
26
27
|
taskSourceWritePaths: input.taskSourceWritePaths,
|
|
28
|
+
readOnlyDirs: input.readOnlyDirs,
|
|
27
29
|
})
|
|
28
30
|
: undefined;
|
|
29
31
|
const safehouseAgentIntegration = input.runner === "safehouse"
|
|
@@ -48,6 +50,8 @@ export function composeAgentLaunch(input) {
|
|
|
48
50
|
safehouseAddDirs: input.runner === "safehouse" ? resolveSafehouseAddDirs(input.worktreeDir) : undefined,
|
|
49
51
|
safehouseAgentAddDirs: input.runner === "safehouse" ? (input.taskSourceWritePaths ?? []) : undefined,
|
|
50
52
|
safehouseEnableFeatures: input.runner === "safehouse" ? input.safehouseEnableFeatures : undefined,
|
|
53
|
+
// Safehouse rejects nonexistent --add-dirs-ro paths, so drop absent ones.
|
|
54
|
+
safehouseAgentAddDirsReadOnly: input.runner === "safehouse" ? (input.readOnlyDirs ?? []).filter(existsSync) : undefined,
|
|
51
55
|
safehouseAgentIntegration,
|
|
52
56
|
});
|
|
53
57
|
return { launchCommand, srtSettingsDir: staged?.directory };
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -292,6 +292,13 @@ export interface Config {
|
|
|
292
292
|
*/
|
|
293
293
|
enable?: string[];
|
|
294
294
|
};
|
|
295
|
+
/**
|
|
296
|
+
* Host directories re-opened read-only inside the sandbox (safehouse +
|
|
297
|
+
* srt), for toolchains the sandbox profile masks but does not re-open.
|
|
298
|
+
* `~` is expanded. Defaults to tfenv's config root so `terraform`/`tfenv`
|
|
299
|
+
* work in the sandbox; set your own list to add or replace entries.
|
|
300
|
+
*/
|
|
301
|
+
readOnlyDirs?: string[];
|
|
295
302
|
};
|
|
296
303
|
logging?: {
|
|
297
304
|
/**
|
|
@@ -369,6 +376,8 @@ export interface ResolvedConfig {
|
|
|
369
376
|
safehouse: {
|
|
370
377
|
enable: readonly string[];
|
|
371
378
|
};
|
|
379
|
+
/** Resolved, `~`-expanded read-only sandbox dirs. Defaults to tfenv's config root. */
|
|
380
|
+
readOnlyDirs: string[];
|
|
372
381
|
};
|
|
373
382
|
logging: {
|
|
374
383
|
file: string;
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAO1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AAE3F,MAAM,WAAW,YAAY;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,QAAQ,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvE,eAAO,MAAM,uBAAuB,EAAE,SAAS,oBAAoB,EAKzD,CAAC;AAEX;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,KAAK,GAAG,KAAK,GAAG,MA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AAU,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAGpE"}
|
package/dist/lib/config.js
CHANGED
|
@@ -51,6 +51,28 @@ const DEFAULT_GIT = {
|
|
|
51
51
|
remote: "origin",
|
|
52
52
|
defaultBranch: "main",
|
|
53
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* Read-only sandbox dirs granted by default: tfenv's config root, which the
|
|
56
|
+
* safehouse/srt profiles mask but don't re-open. `~` expands at normalization.
|
|
57
|
+
*/
|
|
58
|
+
const DEFAULT_LOCAL_READ_ONLY_DIRS = ["~/.config/tfenv"];
|
|
59
|
+
function normalizeLocal(userLocal) {
|
|
60
|
+
return {
|
|
61
|
+
runner: normalizeLocalRunner(userLocal?.runner, "local.runner") ?? "auto",
|
|
62
|
+
networkEgress: normalizeNetworkEgress(userLocal?.networkEgress, "local.networkEgress") ?? "allowlisted",
|
|
63
|
+
safehouse: {
|
|
64
|
+
enable: normalizeSafehouseEnable(userLocal?.safehouse, "local.safehouse"),
|
|
65
|
+
},
|
|
66
|
+
readOnlyDirs: normalizeReadOnlyDirs(userLocal?.readOnlyDirs),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function normalizeReadOnlyDirs(value) {
|
|
70
|
+
const dirs = value ?? DEFAULT_LOCAL_READ_ONLY_DIRS;
|
|
71
|
+
if (!isStringArray(dirs)) {
|
|
72
|
+
fail("local.readOnlyDirs must be an array of strings");
|
|
73
|
+
}
|
|
74
|
+
return dirs.map(expandHome);
|
|
75
|
+
}
|
|
54
76
|
const DEFAULT_ORCHESTRATOR = {
|
|
55
77
|
maximumInProgress: 4,
|
|
56
78
|
pollIntervalMilliseconds: 120_000,
|
|
@@ -685,13 +707,7 @@ function applyDefaults(user, configDir) {
|
|
|
685
707
|
initial: resolveInitialPrompt(user.prompts, configDir),
|
|
686
708
|
},
|
|
687
709
|
workspaceKind: normalizeWorkspaceKind(user.workspaceKind, "workspaceKind") ?? "auto",
|
|
688
|
-
local:
|
|
689
|
-
runner: normalizeLocalRunner(userLocal?.runner, "local.runner") ?? "auto",
|
|
690
|
-
networkEgress: normalizeNetworkEgress(userLocal?.networkEgress, "local.networkEgress") ?? "allowlisted",
|
|
691
|
-
safehouse: {
|
|
692
|
-
enable: normalizeSafehouseEnable(userLocal?.safehouse, "local.safehouse"),
|
|
693
|
-
},
|
|
694
|
-
},
|
|
710
|
+
local: normalizeLocal(userLocal),
|
|
695
711
|
logging: {
|
|
696
712
|
file: expandHome(normalizeOptionalString(user.logging?.file, "logging.file") ?? defaultLogFile()),
|
|
697
713
|
},
|
|
@@ -159,6 +159,12 @@ interface LaunchCommandArguments {
|
|
|
159
159
|
* `--enable` flag.
|
|
160
160
|
*/
|
|
161
161
|
safehouseEnableFeatures?: readonly string[] | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Extra read-only paths granted only to the Safehouse agent wrap via
|
|
164
|
+
* `--add-dirs-ro` (host toolchains the Safehouse profile masks but doesn't
|
|
165
|
+
* re-open). Read-only so the agent cannot mutate host toolchain state.
|
|
166
|
+
*/
|
|
167
|
+
safehouseAgentAddDirsReadOnly?: readonly string[] | undefined;
|
|
162
168
|
/**
|
|
163
169
|
* Extra host-terminal integration surface granted only to the Safehouse agent
|
|
164
170
|
* wrap. The agent may need to execute host shims and reach their sockets
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launchCommand.d.ts","sourceRoot":"","sources":["../../src/lib/launchCommand.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe,CAE/F;AAED;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,GAAE,MA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ouseLaunchCommand(arguments_) {
|
|
|
452
452
|
]);
|
|
453
453
|
const safehouseAddDirsFlag = safehousePathListFlag("--add-dirs", safehousePrepareAddDirs);
|
|
454
454
|
const safehouseAgentAddDirsFlag = safehousePathListFlag("--add-dirs", safehouseAgentAddDirs);
|
|
455
|
-
const safehouseAgentAddDirsReadOnlyFlag = safehousePathListFlag("--add-dirs-ro",
|
|
455
|
+
const safehouseAgentAddDirsReadOnlyFlag = safehousePathListFlag("--add-dirs-ro", uniqueStrings([
|
|
456
|
+
...(safehouseAgentIntegration?.addDirsReadOnly ?? []),
|
|
457
|
+
...(arguments_.safehouseAgentAddDirsReadOnly ?? []),
|
|
458
|
+
]));
|
|
456
459
|
// Optional sandbox integrations (e.g. `agent-browser`) layered onto the agent
|
|
457
460
|
// profile only — the repo-controlled prepareWorktree hook never needs them.
|
|
458
461
|
const safehouseEnableFlag = safehouseEnableFeaturesFlag(arguments_.safehouseEnableFeatures ?? []);
|
package/dist/lib/srtLaunch.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export declare function buildAndStageSrtLaunch(input: {
|
|
|
53
53
|
definition: AgentDefinition;
|
|
54
54
|
/** Local task-source directories the agent needs for self-completion writeback. */
|
|
55
55
|
taskSourceWritePaths?: readonly string[] | undefined;
|
|
56
|
+
/** Absolute host dirs re-opened read-only (`config.local.readOnlyDirs`). */
|
|
57
|
+
readOnlyDirs?: readonly string[] | undefined;
|
|
56
58
|
/** Defaults to `os.homedir()`. Injected in tests to seed from a fixture home. */
|
|
57
59
|
homeDir?: string;
|
|
58
60
|
}): StagedSrtLaunch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"srtLaunch.d.ts","sourceRoot":"","sources":["../../src/lib/srtLaunch.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKnD,MAAM,WAAW,eAAe;IAC9B,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAk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,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;IAC5B,mFAAmF;IACnF,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACrD,4EAA4E;IAC5E,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7C,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,eAAe,CA+ClB"}
|
package/dist/lib/srtLaunch.js
CHANGED
|
@@ -56,6 +56,7 @@ export function buildAndStageSrtLaunch(input) {
|
|
|
56
56
|
hosts: readEnvironmentVariable("CLEARANCE_ALLOW_HOSTS"),
|
|
57
57
|
files: clearanceAllowHostsFilesFromEnvironment(),
|
|
58
58
|
}),
|
|
59
|
+
readOnlyDirs: input.readOnlyDirs ?? [],
|
|
59
60
|
};
|
|
60
61
|
const directory = mkdtempSync(path.join(os.tmpdir(), `groundcrew-srt-${input.task}-`));
|
|
61
62
|
const relocation = agentConfigRelocation(agent);
|
package/dist/lib/srtPolicy.d.ts
CHANGED
|
@@ -75,6 +75,12 @@ export interface BuildSrtSettingsInput {
|
|
|
75
75
|
homeDir?: string;
|
|
76
76
|
/** Defaults to `process.execPath`; used to locate the global node_modules to deny writes to. */
|
|
77
77
|
nodeExecPath?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Absolute host dirs re-opened read-only from `config.local.readOnlyDirs`
|
|
80
|
+
* (toolchains the profile masks but doesn't re-open, e.g. tfenv). srt skips
|
|
81
|
+
* any that don't exist, so passing an absent path is harmless.
|
|
82
|
+
*/
|
|
83
|
+
readOnlyDirs?: readonly string[];
|
|
78
84
|
}
|
|
79
85
|
/**
|
|
80
86
|
* How an agent that cannot run with a read-only config home is pointed at a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"srtPolicy.d.ts","sourceRoot":"","sources":["../../src/lib/srtPolicy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC,EAAE,MAAM,CAAC;IACjB,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kFAAkF;IAClF,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAEtF;AAsMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,oBAAoB,CA0HnF"}
|
package/dist/lib/srtPolicy.js
CHANGED
|
@@ -249,6 +249,7 @@ export function buildSrtSettings(input) {
|
|
|
249
249
|
...TOOLCHAIN_READ_ROOTS.map(underHome),
|
|
250
250
|
...GIT_READ_PATHS.map(underHome),
|
|
251
251
|
...profile.readPaths.map(underHome),
|
|
252
|
+
...(input.readOnlyDirs ?? []),
|
|
252
253
|
...keychainRead,
|
|
253
254
|
...(input.relocatedConfigDir === undefined ? [] : [input.relocatedConfigDir]),
|
|
254
255
|
...(input.taskSourceWritePaths ?? []),
|
package/dist/lib/usage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/lib/usage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,aAAa,CAAC;AA+BnE,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,eAK7B,CAAC;
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/lib/usage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,aAAa,CAAC;AA+BnE,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,eAK7B,CAAC;AA8JF,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,EAAE,CAI5D;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,cAAc,EACtB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,CAAC,CA+BvB"}
|
package/dist/lib/usage.js
CHANGED
|
@@ -52,12 +52,30 @@ async function codexbarUsage(definition, signal) {
|
|
|
52
52
|
"--format",
|
|
53
53
|
"json",
|
|
54
54
|
];
|
|
55
|
-
const
|
|
55
|
+
const options = signal === undefined
|
|
56
56
|
? { timeoutMs: CODEXBAR_TIMEOUT_MS }
|
|
57
|
-
: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
: { signal, timeoutMs: CODEXBAR_TIMEOUT_MS };
|
|
58
|
+
let out;
|
|
59
|
+
try {
|
|
60
|
+
out = await runCommandAsync("codexbar", arguments_, options);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (signal?.aborted === true) {
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
// codexbar exits non-zero (e.g. status 3 for "no rate limit events yet")
|
|
67
|
+
// for handled provider conditions while still writing its JSON payload to
|
|
68
|
+
// stdout. runCommandAsync rejects on the exit code, so recover that payload
|
|
69
|
+
// and parse it like a success — its per-entry `error` field, not the exit
|
|
70
|
+
// code, distinguishes "available" from a genuine failure below. A missing
|
|
71
|
+
// or unparseable payload is a real failure: rethrow so the caller fails
|
|
72
|
+
// closed.
|
|
73
|
+
const recovered = recoverStdout(error);
|
|
74
|
+
if (recovered === undefined) {
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
out = recovered;
|
|
78
|
+
}
|
|
61
79
|
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- JSON.parse returns any; codexbar's --format json output matches CodexbarEntry[]
|
|
62
80
|
const parsed = JSON.parse(out);
|
|
63
81
|
// codexbar can return multiple entries when a provider has several
|
|
@@ -77,8 +95,16 @@ async function codexbarUsage(definition, signal) {
|
|
|
77
95
|
throw new Error(`codexbar returned no matching entry for provider=${provider}, source=${source}`);
|
|
78
96
|
}
|
|
79
97
|
if (!match.usage) {
|
|
80
|
-
// codexbar
|
|
81
|
-
//
|
|
98
|
+
// codexbar reports a valid session that simply has no rate-limit events
|
|
99
|
+
// recorded yet — a fresh, low-traffic, or unlimited-quota account that has
|
|
100
|
+
// consumed nothing the windows can measure. That is the *least* exhausted
|
|
101
|
+
// state, not an unreadable one: return empty windows so it normalizes to
|
|
102
|
+
// `session: null` (available) instead of fail-closing to exhausted.
|
|
103
|
+
if (isNoRateLimitEvents(match.error)) {
|
|
104
|
+
return {};
|
|
105
|
+
}
|
|
106
|
+
// codexbar can otherwise return `{error: ...}` instead of `{usage: ...}`
|
|
107
|
+
// when the underlying provider failed (e.g. codex app-server crashed). The
|
|
82
108
|
// outer catch in getUsageByAgent turns this into a fail-closed
|
|
83
109
|
// exhausted entry; surface codexbar's error message so the operator
|
|
84
110
|
// can fix the underlying CLI.
|
|
@@ -87,6 +113,33 @@ async function codexbarUsage(definition, signal) {
|
|
|
87
113
|
}
|
|
88
114
|
return match.usage;
|
|
89
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* codexbar signals an authenticated account with zero recorded rate-limit
|
|
118
|
+
* events via this provider error (e.g. "Found sessions, but no rate limit
|
|
119
|
+
* events yet."). It means no quota consumed — available — not a probe failure.
|
|
120
|
+
*/
|
|
121
|
+
function isNoRateLimitEvents(error) {
|
|
122
|
+
return /no rate limit events/i.test(error?.message ?? "");
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* runCommandAsync rejects on a non-zero exit, attaching the captured stdout
|
|
126
|
+
* Buffer to the thrown error's `cause`. codexbar uses non-zero exits for handled
|
|
127
|
+
* provider conditions while still emitting its JSON payload, so pull that stdout
|
|
128
|
+
* back out to parse like a success. Returns undefined when no stdout was
|
|
129
|
+
* captured (a real failure with nothing to parse).
|
|
130
|
+
*/
|
|
131
|
+
function recoverStdout(error) {
|
|
132
|
+
/* v8 ignore next 3 @preserve -- runCommandAsync always rejects with an Error */
|
|
133
|
+
if (!(error instanceof Error)) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
// A plain command failure with no captured output carries no cause/stdout.
|
|
137
|
+
if (!(error.cause instanceof Error) || !("stdout" in error.cause)) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
const { stdout } = error.cause;
|
|
141
|
+
return Buffer.isBuffer(stdout) ? stdout.toString("utf8") : undefined;
|
|
142
|
+
}
|
|
90
143
|
function toFraction(value) {
|
|
91
144
|
if (value === undefined || value === null) {
|
|
92
145
|
return null;
|
package/docs/configuration.md
CHANGED
|
@@ -339,4 +339,5 @@ and hook contract.
|
|
|
339
339
|
| `workspaceKind` | `"auto"` | Terminal session manager. `"auto"` picks `cmux` when on PATH, else `tmux`. Set to `"cmux"`, `"tmux"`, or `"zellij"` to fail loudly when the chosen backend is missing. |
|
|
340
340
|
| `local.runner` | `"auto"` | Local isolation backend. `"auto"` uses `safehouse` on macOS and `sdx` on Linux/WSL. Explicit: `"safehouse"`, `"sdx"`, `"none"`. `"none"` is never picked implicitly. |
|
|
341
341
|
| `local.networkEgress` | `"allowlisted"` | Network egress posture. With `local.runner: "safehouse"`, `"allowlisted"` wraps with Clearance and `"open"` keeps the Safehouse filesystem sandbox while opening network egress. Ignored by `srt`, `sdx`, and `none`; `srt` keeps enforcing its own allowlist. |
|
|
342
|
+
| `local.readOnlyDirs` | `~/.config/tfenv` | Host directories re-opened read-only inside the sandbox (`safehouse` + `srt`), for toolchains the sandbox profile masks but does not re-open. `~` is expanded. Defaults to tfenv's config root so `terraform`/`tfenv` work in the sandbox; set your own list to add or replace entries. Ignored by `sdx` and `none`. |
|
|
342
343
|
| `logging.file` | XDG state path | Append-mode log file. `log()` / `logEvent()` tee here in addition to stdout. Defaults to `${XDG_STATE_HOME:-$HOME/.local/state}/groundcrew/groundcrew.log`. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipboard-health/groundcrew",
|
|
3
|
-
"version": "4.45.
|
|
3
|
+
"version": "4.45.5",
|
|
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",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@tsconfig/node24": "24.0.4",
|
|
84
84
|
"@tsconfig/strictest": "2.0.8",
|
|
85
85
|
"@types/node": "25.9.4",
|
|
86
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
86
|
+
"@typescript/native-preview": "7.0.0-dev.20260621.1",
|
|
87
87
|
"@vitest/coverage-v8": "4.1.9",
|
|
88
88
|
"cspell": "10.0.1",
|
|
89
89
|
"dependency-cruiser": "17.4.3",
|