benignswarm 0.12.91 → 0.12.92
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/args.js +2 -2
- package/dist/capabilities.js +84 -9
- package/dist/commands/codex-start.js +139 -11
- package/dist/commands/hook.js +1 -1
- package/dist/commands/machine-admin.js +13 -1
- package/dist/commands/machine.js +26 -5
- package/dist/commands/watch.js +62 -44
- package/dist/commands/wu.js +51 -15
- package/dist/git.js +57 -8
- package/dist/harnesses.js +96 -1
- package/dist/help.js +8 -4
- package/dist/maintenance.js +3 -3
- package/dist/turn.js +10 -2
- package/dist/usage.js +20 -6
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/args.js
CHANGED
|
@@ -3,8 +3,8 @@ import { CliError } from "./errors.js";
|
|
|
3
3
|
// These options accept comma-separated collections, so repeating them should
|
|
4
4
|
// append another collection instead of discarding earlier values.
|
|
5
5
|
export const LIST_FLAGS = ["tags", "projects", "evidence", "statuses", "depends-on", "default-tags", "units", "waits-on", "needs", "exclude", "remove", "post", "harness", "variant", "requires", "reworks"];
|
|
6
|
-
export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "tier", "description", "permissions", "cardinality", "assign-outside-qualifications", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "provider", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "unacked-after", "category", "command", "command-pattern", "follow-delay", "env", "scope", "scope-file", "scope-from", "append", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "by", "target", "milestone", "file", "exit", "depends-on", "default-tags", "source", "on", "partial", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes", "churn", "unmet", "require-cited-changes", "checks-every", "propose", "waits-on", "sandbox", "thread", "turn-timeout", "turns-per-hour", "session", "plain", "if-yes", "if-no", "ssh", "variant", "count", "needs", "min-ram", "exclude", "carry", "from", "to-ssh", "wait", "writable", "dsh", "for", "until", "reason", "at", "requires", "priority", "informs", "amend", "waive-informs", "text", "kind", "claim", "decision", "sha", "value", "expect", "expectations", "reworks"];
|
|
7
|
-
export const BOOL_FLAGS = ["latest", "no-restart", "json", "follow", "account", "help", "version", "broadcast", "create-channels", "read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "template", "scope-only", "unread", "pending", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full", "no-bind", "all", "here", "keep-worktree", "prune", "abandon", "defer", "hold", "clear", "met", "shared", "archive", "approve", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "print-apparmor", "cancel", "rerun", "confirmed", "refuted", "no-source"];
|
|
6
|
+
export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "tier", "description", "permissions", "cardinality", "assign-outside-qualifications", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "provider", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "unacked-after", "category", "command", "command-pattern", "follow-delay", "env", "scope", "scope-file", "scope-from", "append", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "max-budget-usd", "by", "target", "milestone", "file", "exit", "depends-on", "default-tags", "source", "on", "partial", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes", "churn", "unmet", "require-cited-changes", "checks-every", "propose", "waits-on", "sandbox", "thread", "turn-timeout", "turns-per-hour", "session", "plain", "if-yes", "if-no", "ssh", "variant", "count", "needs", "min-ram", "exclude", "carry", "from", "to-ssh", "wait", "writable", "dsh", "for", "until", "reason", "at", "requires", "priority", "informs", "amend", "waive-informs", "text", "kind", "claim", "decision", "sha", "value", "expect", "expectations", "reworks"];
|
|
7
|
+
export const BOOL_FLAGS = ["latest", "no-restart", "json", "follow", "account", "help", "version", "broadcast", "create-channels", "read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "template", "scope-only", "unread", "pending", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full", "no-bind", "all", "here", "keep-worktree", "prune", "abandon", "defer", "hold", "clear", "met", "shared", "archive", "approve", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "print-apparmor", "cancel", "rerun", "confirmed", "refuted", "no-source", "allow-lower-tier"];
|
|
8
8
|
export function parse(argv) {
|
|
9
9
|
const options = {};
|
|
10
10
|
for (const f of STRING_FLAGS)
|
package/dist/capabilities.js
CHANGED
|
@@ -1,10 +1,80 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
1
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
2
2
|
import { mkdtempSync, rmSync } from "node:fs";
|
|
3
3
|
import { homedir, tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
+
import { performance } from "node:perf_hooks";
|
|
6
|
+
export const DEFAULT_CAPABILITY_TIMEOUT_MS = 60_000;
|
|
7
|
+
const MAX_OUTPUT_BYTES = 64 * 1024;
|
|
8
|
+
function appendLimited(chunks, capturedBytes, chunk) {
|
|
9
|
+
const remaining = MAX_OUTPUT_BYTES - capturedBytes;
|
|
10
|
+
if (remaining > 0)
|
|
11
|
+
chunks.push(chunk.subarray(0, remaining));
|
|
12
|
+
return { capturedBytes: capturedBytes + Math.min(chunk.length, Math.max(remaining, 0)), exceeded: chunk.length > remaining };
|
|
13
|
+
}
|
|
14
|
+
function runProbe(command, cwd, timeoutMs) {
|
|
15
|
+
const startedAt = performance.now();
|
|
16
|
+
const stdout = [];
|
|
17
|
+
const stderr = [];
|
|
18
|
+
let stdoutBytes = 0;
|
|
19
|
+
let stderrBytes = 0;
|
|
20
|
+
let outputExceeded = false;
|
|
21
|
+
let spawnError = null;
|
|
22
|
+
let killError = null;
|
|
23
|
+
let timedOut = false;
|
|
24
|
+
const child = spawn("/bin/sh", ["-lc", command], {
|
|
25
|
+
cwd,
|
|
26
|
+
detached: process.platform !== "win32",
|
|
27
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
28
|
+
});
|
|
29
|
+
child.stdout.on("data", (chunk) => {
|
|
30
|
+
const next = appendLimited(stdout, stdoutBytes, chunk);
|
|
31
|
+
stdoutBytes = next.capturedBytes;
|
|
32
|
+
outputExceeded ||= next.exceeded;
|
|
33
|
+
});
|
|
34
|
+
child.stderr.on("data", (chunk) => {
|
|
35
|
+
const next = appendLimited(stderr, stderrBytes, chunk);
|
|
36
|
+
stderrBytes = next.capturedBytes;
|
|
37
|
+
outputExceeded ||= next.exceeded;
|
|
38
|
+
});
|
|
39
|
+
child.on("error", (error) => { spawnError = error; });
|
|
40
|
+
const timer = setTimeout(() => {
|
|
41
|
+
timedOut = true;
|
|
42
|
+
if (process.platform !== "win32" && child.pid !== undefined) {
|
|
43
|
+
// detached gives the shell and its descendants a private process group. Kill the group,
|
|
44
|
+
// since killing only the shell leaves tools such as xcrun holding its output pipes open.
|
|
45
|
+
try {
|
|
46
|
+
process.kill(-child.pid, "SIGKILL");
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (error.code !== "ESRCH") {
|
|
50
|
+
killError = error;
|
|
51
|
+
child.kill("SIGKILL");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
child.kill("SIGKILL");
|
|
57
|
+
}
|
|
58
|
+
}, timeoutMs);
|
|
59
|
+
return new Promise((resolve) => {
|
|
60
|
+
child.on("close", (status) => {
|
|
61
|
+
clearTimeout(timer);
|
|
62
|
+
resolve({
|
|
63
|
+
status,
|
|
64
|
+
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
65
|
+
stderr: Buffer.concat(stderr).toString("utf8"),
|
|
66
|
+
error: spawnError ?? (outputExceeded ? new Error(`probe output exceeded ${MAX_OUTPUT_BYTES} bytes`) : null),
|
|
67
|
+
killError,
|
|
68
|
+
timedOut,
|
|
69
|
+
elapsedMs: Math.round(performance.now() - startedAt),
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
5
74
|
/** Run every declaration and preserve failures as results, so dispatch can explain a missing tool. */
|
|
6
|
-
export function probeCapabilities(definitions, projectDir) {
|
|
7
|
-
|
|
75
|
+
export async function probeCapabilities(definitions, projectDir) {
|
|
76
|
+
const results = [];
|
|
77
|
+
for (const definition of definitions) {
|
|
8
78
|
let cwd = homedir();
|
|
9
79
|
let temporary = null;
|
|
10
80
|
try {
|
|
@@ -19,13 +89,17 @@ export function probeCapabilities(definitions, projectDir) {
|
|
|
19
89
|
throw new Error(full.error?.message ?? (full.stderr || full.stdout || "git sparse-checkout disable failed").trim());
|
|
20
90
|
cwd = path;
|
|
21
91
|
}
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
92
|
+
const timeoutMs = definition.timeout_ms ?? DEFAULT_CAPABILITY_TIMEOUT_MS;
|
|
93
|
+
const result = await runProbe(definition.probe, cwd, timeoutMs);
|
|
94
|
+
const output = `${result.stdout}${result.stderr}`.trim().split(/\r?\n/, 1)[0] ?? "";
|
|
95
|
+
const ok = result.status === 0 && !result.error && !result.timedOut;
|
|
96
|
+
const error = result.timedOut
|
|
97
|
+
? `timed out after ${result.elapsedMs} ms${result.killError ? `; failed to kill probe process group: ${result.killError.message}` : ""}`
|
|
98
|
+
: result.error?.message ?? (ok ? null : output || `probe exited ${result.status}`);
|
|
99
|
+
results.push({ name: definition.name, ok, version: ok ? (result.stdout.trim().split(/\r?\n/, 1)[0]?.slice(0, 200) || null) : null, error: error?.slice(0, 500) ?? null });
|
|
26
100
|
}
|
|
27
101
|
catch (error) {
|
|
28
|
-
|
|
102
|
+
results.push({ name: definition.name, ok: false, version: null, error: error.message.split(/\r?\n/, 1)[0].slice(0, 500) });
|
|
29
103
|
}
|
|
30
104
|
finally {
|
|
31
105
|
if (temporary) {
|
|
@@ -37,5 +111,6 @@ export function probeCapabilities(definitions, projectDir) {
|
|
|
37
111
|
}
|
|
38
112
|
}
|
|
39
113
|
}
|
|
40
|
-
}
|
|
114
|
+
}
|
|
115
|
+
return results;
|
|
41
116
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
-
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, unlinkSync } from "node:fs";
|
|
2
|
+
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { dirname, join as joinPath } from "node:path";
|
|
5
5
|
import { bool, str } from "../args.js";
|
|
@@ -13,10 +13,11 @@ import { readState, writeState } from "../state.js";
|
|
|
13
13
|
import { join } from "./join.js";
|
|
14
14
|
import { beginTurnGuardAttempt, completePendingTurnGuard, installWatcherService } from "./watch.js";
|
|
15
15
|
import { randomUUID } from "node:crypto";
|
|
16
|
-
import { HARNESS_BIN, HARNESS_LABEL, claudeResultError, claudeResultFile, claudeSettings, claudeTranscript, dshPath, dshResultError, dshSessionFromEvents, dshSettings, dshTurnLog, probeFor } from "../harnesses.js";
|
|
16
|
+
import { HARNESS_BIN, HARNESS_LABEL, assertClaudeSelfCheck, claudeCodePath, claudeResultError, claudeResultFile, claudeSandboxEnv, claudeSettings, claudeTranscript, claudeTurnArgs, dshPath, dshResultError, dshSessionFromEvents, dshSettings, dshTurnLog, probeFor } from "../harnesses.js";
|
|
17
17
|
import { claudeTurnEnv } from "../providers.js";
|
|
18
18
|
import { DEFAULT_TURNS_PER_HOUR } from "../turn-guard.js";
|
|
19
19
|
const SANDBOXES = ["read-only", "workspace-write", "danger-full-access"];
|
|
20
|
+
export const DEFAULT_CLAUDE_MAX_BUDGET_USD = 1;
|
|
20
21
|
/**
|
|
21
22
|
* `b9s start` (and `b9s codex start`): one command that brings an agent up on this machine
|
|
22
23
|
* headless, with no app involved, so it works the same over ssh on a remote machine. It enrolls the
|
|
@@ -62,9 +63,17 @@ export async function harnessStart(p, out, harness) {
|
|
|
62
63
|
if (provider === "deepseek" && harness !== "claude-code")
|
|
63
64
|
throw new CliError("usage", "--provider deepseek requires --harness claude-code");
|
|
64
65
|
const model = str(p.flags, "model") ?? (provider === "deepseek" ? "deepseek-flash" : undefined);
|
|
66
|
+
const budgetFlag = str(p.flags, "max-budget-usd");
|
|
67
|
+
if (budgetFlag !== undefined && (harness !== "claude-code" || sandbox !== "workspace-write"))
|
|
68
|
+
throw new CliError("usage", "--max-budget-usd is only valid for Claude Code workspace-write sessions");
|
|
69
|
+
const maxBudgetUsd = budgetFlag === undefined ? DEFAULT_CLAUDE_MAX_BUDGET_USD : Number(budgetFlag);
|
|
70
|
+
if (harness === "claude-code" && sandbox === "workspace-write" && (!Number.isFinite(maxBudgetUsd) || maxBudgetUsd <= 0))
|
|
71
|
+
throw new CliError("usage", "--max-budget-usd must be a positive dollar amount");
|
|
65
72
|
const bin = harness === "dsh"
|
|
66
73
|
? dshPath(dshOverride)
|
|
67
|
-
:
|
|
74
|
+
: harness === "claude-code" && sandbox === "workspace-write"
|
|
75
|
+
? claudeCodePath() ?? (() => { throw new CliError("not_found", "Claude Code was not found on PATH or under ~/.local/share/claude/versions; add the native installer's active version to PATH or install Claude Code with `npm i -g @anthropic-ai/claude-code`"); })()
|
|
76
|
+
: which(HARNESS_BIN[harness], harness === "codex" ? "install the Codex CLI (npm i -g @openai/codex)" : "install Claude Code (npm i -g @anthropic-ai/claude-code)");
|
|
68
77
|
if (!bin)
|
|
69
78
|
throw new CliError("not_found", "DeepSeek Harness CLI dsh was not found; install DeepSeek Harness or pass --dsh <path>");
|
|
70
79
|
if (harness === "dsh" && !existsSync(bin))
|
|
@@ -80,7 +89,9 @@ export async function harnessStart(p, out, harness) {
|
|
|
80
89
|
: harness === "dsh"
|
|
81
90
|
? dshSettings(sandbox, process.cwd(), configRoot(), [...writable, ...ownWorktreeGitDir(process.cwd())])
|
|
82
91
|
: claudeSettings(sandbox, model, effort, process.cwd(), configRoot(), writable);
|
|
83
|
-
const providerEnv = claudeTurnEnv(harness === "claude-code" ? provider : undefined, model);
|
|
92
|
+
const providerEnv = { ...claudeTurnEnv(harness === "claude-code" ? provider : undefined, model), ...(harness === "claude-code" ? claudeSandboxEnv(sandbox) : {}) };
|
|
93
|
+
if (harness === "claude-code" && sandbox === "workspace-write")
|
|
94
|
+
configureHttpsOriginForWorktree(process.cwd());
|
|
84
95
|
// 1. Who: enroll with the invite token, or use credentials already on this machine.
|
|
85
96
|
const lines = [];
|
|
86
97
|
const token = str(p.flags, "token");
|
|
@@ -122,6 +133,9 @@ export async function harnessStart(p, out, harness) {
|
|
|
122
133
|
if (harness === "claude-code") {
|
|
123
134
|
if (!claudeTranscript(session))
|
|
124
135
|
throw new CliError("not_found", `no Claude Code transcript for session ${session} under ~/.claude/projects on this machine`);
|
|
136
|
+
if (sandbox === "workspace-write") {
|
|
137
|
+
await runGuardedClaudeSandboxSelfCheck(ref, turnsPerHour, bin, settings, maxBudgetUsd, providerEnv, process.cwd(), randomUUID());
|
|
138
|
+
}
|
|
125
139
|
lines.push(`Adopted Claude Code session ${session}. Do not resume it in a terminal while the watcher runs it: two clients on one session conflict.`);
|
|
126
140
|
}
|
|
127
141
|
else {
|
|
@@ -132,6 +146,12 @@ export async function harnessStart(p, out, harness) {
|
|
|
132
146
|
}
|
|
133
147
|
}
|
|
134
148
|
else {
|
|
149
|
+
// The proxy/Git preflight spends model tokens, so it is its own guarded harness launch. The
|
|
150
|
+
// first real turn resumes this same checked session and receives a separate reservation below.
|
|
151
|
+
if (harness === "claude-code" && sandbox === "workspace-write") {
|
|
152
|
+
session = randomUUID();
|
|
153
|
+
await runGuardedClaudeSandboxSelfCheck(ref, turnsPerHour, bin, settings, maxBudgetUsd, providerEnv, process.cwd(), session);
|
|
154
|
+
}
|
|
135
155
|
const logDir = joinPath(configRoot(), "logs");
|
|
136
156
|
mkdirSync(logDir, { recursive: true });
|
|
137
157
|
firstTurnLog = harness === "dsh" ? dshTurnLog(ref) : harness === "claude-code" ? claudeResultFile(ref) : joinPath(logDir, `${harness}.${ref.replace("/", ".")}.first-turn.jsonl`);
|
|
@@ -158,8 +178,8 @@ export async function harnessStart(p, out, harness) {
|
|
|
158
178
|
}
|
|
159
179
|
else {
|
|
160
180
|
// Claude Code takes the session id from us, so nothing has to be read back from its output.
|
|
161
|
-
session
|
|
162
|
-
await startClaudeSession(bin, ["-p", prompt, ...settings, "
|
|
181
|
+
session ??= randomUUID();
|
|
182
|
+
await startClaudeSession(bin, ["-p", prompt, ...settings, ...(sandbox === "workspace-write" ? claudeTurnArgs(maxBudgetUsd) : []), ...claudeSessionStartArgs(sandbox, session), "--output-format", "json"], firstTurnLog, ref, session, providerEnv, model, provider);
|
|
163
183
|
lines.push(`Started Claude Code session ${session}; its first turn (reading its role and inbox) is running, result: ${firstTurnLog}`);
|
|
164
184
|
}
|
|
165
185
|
}
|
|
@@ -179,7 +199,7 @@ export async function harnessStart(p, out, harness) {
|
|
|
179
199
|
if (harness === "codex")
|
|
180
200
|
bindSession("codex", session, ref);
|
|
181
201
|
const transcript = harness === "dsh" ? dshTurnLog(ref) : harness === "claude-code" ? claudeTranscript(session) ?? firstTurnLog ?? "" : codexRollout(session) ?? firstTurnLog ?? "";
|
|
182
|
-
writeState(ref, { ...readState(ref), harness_session: { harness, transcript, session_id: session, at: Date.now(), ...(initialPid ? { initial_pid: initialPid } : {}) } });
|
|
202
|
+
writeState(ref, { ...readState(ref), harness_session: { harness, transcript, session_id: session, at: Date.now(), ...(harness === "claude-code" ? { provider } : {}), ...(initialPid ? { initial_pid: initialPid } : {}) } });
|
|
183
203
|
// A session adopted here may end in a usage-limit error from the machine it came from, written in
|
|
184
204
|
// that machine's local time ("3:32 PM" Central read as UTC on ronald: six hours off). Only errors
|
|
185
205
|
// from turns on this machine pause it; if the account is still limited, the next turn says so here.
|
|
@@ -191,7 +211,7 @@ export async function harnessStart(p, out, harness) {
|
|
|
191
211
|
: harness === "dsh"
|
|
192
212
|
? dshResumeCommand(bin, session, settings, dshTurnLog(ref))
|
|
193
213
|
// The result goes to a file the watcher reads when the turn ends: Claude Code can exit 0 with is_error set.
|
|
194
|
-
: `${shq(bin)} -p {text} ${[...settings, "--resume", session, "--output-format", "json"].map(shq).join(" ")} > ${shq(claudeResultFile(ref))}`;
|
|
214
|
+
: `${shq(bin)} -p {text} ${[...settings, ...(sandbox === "workspace-write" ? claudeTurnArgs(maxBudgetUsd) : []), "--resume", session, "--output-format", "json"].map(shq).join(" ")} > ${shq(claudeResultFile(ref))}`;
|
|
195
215
|
const watcherOut = [];
|
|
196
216
|
// Scratch space beside the checkout, not the system's /tmp: on a machine the checkout lives on the
|
|
197
217
|
// work volume, the folder is inside what the sandbox may write, and it survives a reboot. Learned
|
|
@@ -199,7 +219,7 @@ export async function harnessStart(p, out, harness) {
|
|
|
199
219
|
// volume had 750 GB free, and which empties /tmp at every boot.
|
|
200
220
|
const tmp = sessionTmpDir(process.cwd(), creds.agent);
|
|
201
221
|
mkdirSync(tmp, { recursive: true });
|
|
202
|
-
installWatcherService(ref, exec, interval, Number(str(p.flags, "follow-delay") ?? "300"), { TMPDIR: tmp }, undefined, { json: false, print: (h) => watcherOut.push(h) }, bool(p.flags, "prune"), { harness, session, timeout: turnTimeout, turnsPerHour, provider, model });
|
|
222
|
+
installWatcherService(ref, exec, interval, Number(str(p.flags, "follow-delay") ?? "300"), { TMPDIR: tmp, ...(harness === "claude-code" ? claudeSandboxEnv(sandbox) : {}) }, undefined, { json: false, print: (h) => watcherOut.push(h) }, bool(p.flags, "prune"), { harness, session, timeout: turnTimeout, turnsPerHour, provider, model });
|
|
203
223
|
const wl = watcherOut.join("\n").split("\n");
|
|
204
224
|
lines.push(wl[0].replace(/^Wrote /, "Watcher: wrote "), ...wl.filter((l) => l.startsWith("Linger is off")));
|
|
205
225
|
// 5. Hooks.
|
|
@@ -267,9 +287,19 @@ export async function startDshSession(bin, args, logPath, agent, prompt) {
|
|
|
267
287
|
* minutes; this command does not wait for it) and returns once its transcript exists, or fails
|
|
268
288
|
* with Claude Code's own error when it exits first.
|
|
269
289
|
*/
|
|
270
|
-
async function startClaudeSession(bin, args, logPath, agent, session, providerEnv) {
|
|
290
|
+
async function startClaudeSession(bin, args, logPath, agent, session, providerEnv, model, provider) {
|
|
271
291
|
const fd = openSync(logPath, "w");
|
|
272
|
-
const child = spawn(bin, args, {
|
|
292
|
+
const child = spawn(bin, args, {
|
|
293
|
+
stdio: ["ignore", fd, fd], detached: true, cwd: process.cwd(),
|
|
294
|
+
env: {
|
|
295
|
+
...process.env,
|
|
296
|
+
BSCHAT_AGENT: agent,
|
|
297
|
+
...(model ? { BSCHAT_MODEL: model } : {}),
|
|
298
|
+
BSCHAT_SESSION_ID: session,
|
|
299
|
+
BSCHAT_PROVIDER: provider,
|
|
300
|
+
...providerEnv,
|
|
301
|
+
},
|
|
302
|
+
});
|
|
273
303
|
closeSync(fd);
|
|
274
304
|
let exited = null;
|
|
275
305
|
child.on("exit", (code) => { exited = code ?? 1; });
|
|
@@ -287,6 +317,104 @@ async function startClaudeSession(bin, args, logPath, agent, session, providerEn
|
|
|
287
317
|
}
|
|
288
318
|
throw new CliError("claude_failed", `Claude Code wrote no transcript for session ${session} within 90 s; see ${logPath}`);
|
|
289
319
|
}
|
|
320
|
+
/** GitHub/other SSH origins cannot traverse Claude Code's HTTP-only workspace proxy. */
|
|
321
|
+
export function configureHttpsOriginForWorktree(cwd) {
|
|
322
|
+
const remote = spawnSync("git", ["remote", "get-url", "origin"], { cwd, encoding: "utf8" });
|
|
323
|
+
if (remote.status !== 0)
|
|
324
|
+
throw new CliError("git_origin", `cannot read origin in ${cwd}: ${(remote.stderr ?? "").trim() || "git remote get-url origin failed"}`);
|
|
325
|
+
const url = remote.stdout.trim();
|
|
326
|
+
let host;
|
|
327
|
+
let prefix;
|
|
328
|
+
const scp = /^git@([^:]+):/.exec(url);
|
|
329
|
+
const ssh = /^ssh:\/\/(?:git@)?([^/]+)\//.exec(url);
|
|
330
|
+
if (scp) {
|
|
331
|
+
host = scp[1];
|
|
332
|
+
prefix = `git@${host}:`;
|
|
333
|
+
}
|
|
334
|
+
else if (ssh) {
|
|
335
|
+
host = ssh[1];
|
|
336
|
+
prefix = url.startsWith("ssh://git@") ? `ssh://git@${host}/` : `ssh://${host}/`;
|
|
337
|
+
}
|
|
338
|
+
else if (/^https:\/\//.test(url))
|
|
339
|
+
return;
|
|
340
|
+
else
|
|
341
|
+
throw new CliError("git_origin", `unsupported origin URL for a sandboxed Claude session: ${url || "(empty)"}`, "Set this worktree's origin to an HTTPS URL and configure its existing Git credential helper, then rerun b9s start");
|
|
342
|
+
const enabled = spawnSync("git", ["config", "extensions.worktreeConfig", "true"], { cwd, encoding: "utf8" });
|
|
343
|
+
if (enabled.status !== 0)
|
|
344
|
+
throw new CliError("git_origin", `could not enable per-worktree Git configuration: ${(enabled.stderr ?? "").trim()}`);
|
|
345
|
+
const base = `https://${host}/`;
|
|
346
|
+
const existing = spawnSync("git", ["config", "--worktree", "--get-all", `url.${base}.insteadOf`], { cwd, encoding: "utf8" });
|
|
347
|
+
if ((existing.stdout ?? "").split(/\r?\n/).includes(prefix))
|
|
348
|
+
return;
|
|
349
|
+
const added = spawnSync("git", ["config", "--worktree", "--add", `url.${base}.insteadOf`, prefix], { cwd, encoding: "utf8" });
|
|
350
|
+
if (added.status !== 0)
|
|
351
|
+
throw new CliError("git_origin", `could not add per-worktree HTTPS rewrite for ${url}: ${(added.stderr ?? "").trim()}`, `Run git config --worktree --add 'url.${base}.insteadOf' '${prefix}' in ${cwd}, then rerun b9s start`);
|
|
352
|
+
}
|
|
353
|
+
/** The workspace-write connectivity probe creates the session; the real first turn resumes it. */
|
|
354
|
+
export function claudeSessionStartArgs(sandbox, session) {
|
|
355
|
+
return sandbox === "workspace-write" ? ["--resume", session] : ["--session-id", session];
|
|
356
|
+
}
|
|
357
|
+
export function runClaudeSandboxSelfCheck(bin, settings, maxBudgetUsd, env, cwd, session, agent) {
|
|
358
|
+
const prompt = [
|
|
359
|
+
"BenignSwarm sandbox startup check. Use your Bash tool to execute these two commands separately, exactly as written:",
|
|
360
|
+
"1. b9s me",
|
|
361
|
+
"2. git ls-remote origin",
|
|
362
|
+
"Capture each real exit code and complete stdout/stderr. Do not infer or invent results.",
|
|
363
|
+
'Return only one JSON object with this shape: {"b9s_me":{"status":0,"output":"..."},"git_ls_remote_origin":{"status":0,"output":"..."}}.',
|
|
364
|
+
].join("\n");
|
|
365
|
+
const logPath = joinPath(configRoot(), "logs", `claude-sandbox-self-check.${process.pid}.json`);
|
|
366
|
+
const check = spawnSync(bin, ["-p", prompt, ...settings, ...claudeTurnArgs(maxBudgetUsd), ...(session ? ["--session-id", session] : []), "--output-format", "json"], {
|
|
367
|
+
encoding: "utf8", timeout: 180_000, cwd, env: { ...process.env, ...env, ...(agent ? { BSCHAT_AGENT: agent } : {}) }, maxBuffer: 2 * 1024 * 1024,
|
|
368
|
+
});
|
|
369
|
+
const output = check.stdout ?? "";
|
|
370
|
+
try {
|
|
371
|
+
writeFileSync(logPath, output + (check.stderr ? `\n${check.stderr}` : ""));
|
|
372
|
+
}
|
|
373
|
+
catch { /* the CLI error still includes bounded output */ }
|
|
374
|
+
if (check.error || check.status !== 0) {
|
|
375
|
+
const detail = [check.error?.message, check.status !== 0 ? `Claude Code exited ${check.status ?? "unknown"}: ${(check.stderr ?? "").trim()}` : "", output.trim() ? `Harness output: ${output.trim().slice(-1500)}` : "Harness stdout was empty"].filter(Boolean).join("\n");
|
|
376
|
+
throw new CliError("sandbox_self_check_failed", `Claude Code workspace-write self-check failed; watcher was not enabled.\n${detail || "Claude Code did not complete the check"}\nFull harness output: ${logPath}`, "Ensure the configured HTTPS credential helper can read this repository and that the b9s install is on PATH, then rerun b9s start");
|
|
377
|
+
}
|
|
378
|
+
try {
|
|
379
|
+
assertClaudeSelfCheck(output);
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
const message = error.message;
|
|
383
|
+
throw new CliError("sandbox_self_check_failed", `${message}\nFull harness output: ${logPath}`, "For GitHub, run `gh auth setup-git`; otherwise configure the existing HTTPS credential helper for this worktree, then rerun b9s start. If SSH access is required, use --sandbox danger-full-access");
|
|
384
|
+
}
|
|
385
|
+
let tokens = null;
|
|
386
|
+
try {
|
|
387
|
+
const usage = JSON.parse(output).usage;
|
|
388
|
+
if (usage)
|
|
389
|
+
tokens = (usage.input_tokens ?? 0) + (usage.output_tokens ?? 0) + (usage.cache_read_input_tokens ?? 0) + (usage.cache_creation_input_tokens ?? 0);
|
|
390
|
+
}
|
|
391
|
+
catch { /* the accepted report may be emitted without a usage envelope */ }
|
|
392
|
+
return { output, tokens };
|
|
393
|
+
}
|
|
394
|
+
/** Guard a model-spending connectivity preflight independently from the agent's real turn. */
|
|
395
|
+
export async function runGuardedClaudeSandboxSelfCheck(ref, turnsPerHour, bin, settings, maxBudgetUsd, env, cwd, session, run = runClaudeSandboxSelfCheck) {
|
|
396
|
+
const diagnostic = [];
|
|
397
|
+
if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (message) => diagnostic.push(message)))) {
|
|
398
|
+
throw new CliError("turn_mode_fault", diagnostic.at(-1) ?? "turn mode guard refused the sandbox self-check");
|
|
399
|
+
}
|
|
400
|
+
const probe = probeFor("claude-code", session, ref);
|
|
401
|
+
let result;
|
|
402
|
+
try {
|
|
403
|
+
result = run(bin, settings, maxBudgetUsd, env, cwd, session, ref);
|
|
404
|
+
}
|
|
405
|
+
catch (error) {
|
|
406
|
+
const output = error.message;
|
|
407
|
+
await completePendingTurnGuard(ref, probe, (message) => diagnostic.push(message), output, null);
|
|
408
|
+
const fault = readState(ref).turn_guard?.fault;
|
|
409
|
+
if (fault)
|
|
410
|
+
throw new CliError("turn_mode_fault", `turn mode stopped after ${fault.consecutive_unproductive} consecutive turns without a BenignSwarm call; estimated tokens spent: ${fault.estimated_tokens}; last output: ${fault.output_tail || "(empty)"}`);
|
|
411
|
+
throw error;
|
|
412
|
+
}
|
|
413
|
+
await completePendingTurnGuard(ref, probe, (message) => diagnostic.push(message), result.output, result.tokens);
|
|
414
|
+
const fault = readState(ref).turn_guard?.fault;
|
|
415
|
+
if (fault)
|
|
416
|
+
throw new CliError("turn_mode_fault", `turn mode stopped after ${fault.consecutive_unproductive} consecutive turns without a BenignSwarm call; estimated tokens spent: ${fault.estimated_tokens}; last output: ${fault.output_tail || "(empty)"}`);
|
|
417
|
+
}
|
|
290
418
|
/**
|
|
291
419
|
* The Codex settings a headless turn runs with. Under workspace-write the agent still has to reach
|
|
292
420
|
* the API and write its own b9s state (~/.b9s), and `wu start` puts unit worktrees beside the
|
package/dist/commands/hook.js
CHANGED
|
@@ -664,5 +664,5 @@ function noteSession(name, harness, transcript, sessionId) {
|
|
|
664
664
|
const cur = st.harness_session;
|
|
665
665
|
if (cur && cur.transcript === transcript && cur.harness === harness)
|
|
666
666
|
return;
|
|
667
|
-
writeState(name, { ...st, harness_session: { harness, transcript, session_id: sessionId, at: Date.now() } });
|
|
667
|
+
writeState(name, { ...st, harness_session: { harness, transcript, session_id: sessionId, at: Date.now(), ...(cur?.harness === harness && cur.session_id === sessionId && cur.provider ? { provider: cur.provider } : {}) } });
|
|
668
668
|
}
|
|
@@ -51,6 +51,17 @@ for b in b9s b9s-admin bschat bschat-admin; do [ -e "$HOME/.local/bin/$b" ] || l
|
|
|
51
51
|
step b9s ok "$("$bin" --version) $bin"
|
|
52
52
|
`;
|
|
53
53
|
}
|
|
54
|
+
export function machineCapabilityLines(projects) {
|
|
55
|
+
return projects.flatMap((project) => {
|
|
56
|
+
if (!project.capabilities.length)
|
|
57
|
+
return [];
|
|
58
|
+
const values = project.capabilities.map((capability) => {
|
|
59
|
+
const state = capability.ok ? capability.version ?? "ready" : capability.error ?? "not probed";
|
|
60
|
+
return `${capability.name}: ${state}`;
|
|
61
|
+
});
|
|
62
|
+
return [` ${project.project} capabilities: ${values.join("; ")}`];
|
|
63
|
+
});
|
|
64
|
+
}
|
|
54
65
|
/**
|
|
55
66
|
* Runs `command` on `host` with /bin/sh, whatever the account's login shell: zsh aborts a command
|
|
56
67
|
* whose glob matches nothing (mini1: the archived-sessions pattern of a thread lookup). Output may be
|
|
@@ -132,10 +143,11 @@ export async function machineAdmin(action, rest, p, out) {
|
|
|
132
143
|
`${m.name}: last report ${m.last_report_at ?? "never"}; labels ${(m.labels ?? []).join(", ") || "(none)"}; slots ${m.slots ?? "auto"}; writable ${(m.writable ?? []).join(", ") || "-"}; workdir ${rep.workdir ?? m.workdir ?? "~/bschat"}${rep.workdir_free_bytes ? ` (${Math.round(rep.workdir_free_bytes / 1e9)} GB free)` : ""}`,
|
|
133
144
|
rep.os ? ` ${rep.os}/${rep.arch} ${rep.hostname} as ${rep.user}; ${rep.cpus ?? "?"} CPUs, ${rep.mem_total_bytes ? `${Math.round(rep.mem_total_bytes / 1024 ** 3)} GB RAM` : "? RAM"}; b9s ${rep.bschat?.version}; codex ${rep.codex ? `${rep.codex.version}, ${rep.codex.logged_in ? "logged in" : "NOT logged in"}, sandbox ${rep.codex.sandbox ? (rep.codex.sandbox.ok ? "ok" : `FAILS (${rep.codex.sandbox.error})`) : "?"}` : "missing"}; hooks ${rep.managed_hooks ? "managed by policy" : "user-level"}; linger ${rep.linger ?? "n/a"}; disk free ${rep.disk_free_bytes ? `${Math.round(rep.disk_free_bytes / 1e9)} GB` : "?"}` : " (no report yet: is its daemon running?)",
|
|
134
145
|
];
|
|
146
|
+
const capabilityLines = machineCapabilityLines(m.capabilities ?? []);
|
|
135
147
|
const rows = m.sessions.map((s) => ({ agent: s.agent, pool: s.pool ?? "-", desired: s.desired, state: s.reported?.state ?? "-", thread: s.thread ?? "-", harness: s.harness, provider: s.provider ?? "anthropic", sandbox: s.sandbox, model: s.model ?? "-", dir: s.dir || s.reported?.dir || "(auto)", error: s.reported?.error ?? s.reported?.detail ?? "", last_turn: (s.reported?.last_turn ?? "").replace(/^\S+ b9s watch\[[^\]]+\]: /, "") }));
|
|
136
148
|
const providers = rep.claude_code?.providers ?? {};
|
|
137
149
|
const providerLines = Object.entries(providers).map(([provider, check]) => ` Claude Code ${provider}: ${check.logged_in ? "verified" : `NOT verified (${check.reason ?? "unknown reason"})`}`);
|
|
138
|
-
return out.print([...head, ...providerLines, rows.length ? table(rows, ["agent", "pool", "desired", "state", "thread", "harness", "provider", "sandbox", "model", "dir", "error", "last_turn"]) : " no sessions"].join("\n"), r);
|
|
150
|
+
return out.print([...head, ...capabilityLines, ...providerLines, rows.length ? table(rows, ["agent", "pool", "desired", "state", "thread", "harness", "provider", "sandbox", "model", "dir", "error", "last_turn"]) : " no sessions"].join("\n"), r);
|
|
139
151
|
}
|
|
140
152
|
if (action === "maintenance") {
|
|
141
153
|
// A window on the machine: no new turns from 15 min before, its agents away until it ends.
|
package/dist/commands/machine.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
2
3
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, statSync, statfsSync, writeFileSync } from "node:fs";
|
|
3
4
|
import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, uptime, userInfo } from "node:os";
|
|
4
5
|
import { dirname, join } from "node:path";
|
|
@@ -67,6 +68,9 @@ export function startArgs(s, thread, writable = []) {
|
|
|
67
68
|
const KEY_CHECK_MS = 10 * 60_000;
|
|
68
69
|
const CAPABILITY_PROBE_MS = 60 * 60_000;
|
|
69
70
|
const lastCapabilityProbe = new Map();
|
|
71
|
+
export function turnFaultSessionFields(fault) {
|
|
72
|
+
return { turn_fault_at: new Date(fault.at).toISOString() };
|
|
73
|
+
}
|
|
70
74
|
/** One pass: make what runs here match what the operator declared, then report. */
|
|
71
75
|
export async function reconcile(m, log) {
|
|
72
76
|
const client = Client.raw(m.url, m.key);
|
|
@@ -148,7 +152,7 @@ export async function reconcile(m, log) {
|
|
|
148
152
|
removeService(w);
|
|
149
153
|
log(`${s.agent}: turn mode fault; watcher service stopped`);
|
|
150
154
|
}
|
|
151
|
-
out.push({ id: s.id, state: "error", dir: s.dir, thread: local?.thread ?? s.thread, watcher: "inactive", error });
|
|
155
|
+
out.push({ id: s.id, state: "error", dir: s.dir, thread: local?.thread ?? s.thread, watcher: "inactive", error, ...turnFaultSessionFields(fault) });
|
|
152
156
|
continue;
|
|
153
157
|
}
|
|
154
158
|
if (local) {
|
|
@@ -239,7 +243,7 @@ export async function reconcile(m, log) {
|
|
|
239
243
|
const projectDir = desired.find((s) => s.project_id === project.id && s.dir)?.dir ?? homedir();
|
|
240
244
|
if (!project.capabilities.length)
|
|
241
245
|
continue;
|
|
242
|
-
capabilities[project.id] = probeCapabilities(project.capabilities, projectDir);
|
|
246
|
+
capabilities[project.id] = await probeCapabilities(project.capabilities, projectDir);
|
|
243
247
|
probedProjects.push(project.id);
|
|
244
248
|
log(`${project.name}: probed ${capabilities[project.id].length} declared capabilities`);
|
|
245
249
|
}
|
|
@@ -409,11 +413,11 @@ export function errorText(s) {
|
|
|
409
413
|
function turnFacts(agent, harness, thread) {
|
|
410
414
|
const ph = thread ? probeFor(harness, thread, agent).phase() : null;
|
|
411
415
|
if (!thread || !ph || "missing" in ph)
|
|
412
|
-
return { turn: { running: false, since: null }, process: null, paused_until: null };
|
|
416
|
+
return { turn: { running: false, since: null }, process: null, paused_until: null, pause_started_at: null };
|
|
413
417
|
const until = !ph.running ? probeFor(harness, thread, agent).limitUntil(ph.lastError) : null;
|
|
414
418
|
const unpausedAt = readState(agent).turn_unpaused_at ?? 0;
|
|
415
419
|
const paused = until && until > Date.now() && Date.parse(ph.lastErrorAt ?? "") > unpausedAt ? new Date(until).toISOString() : null;
|
|
416
|
-
return { turn: { running: ph.running, since: ph.running ? ph.startedAt : ph.lastEventAt }, process: ph.running ? turnProcess(thread, harness, undefined, agent) : null, paused_until: paused };
|
|
420
|
+
return { turn: { running: ph.running, since: ph.running ? ph.startedAt : ph.lastEventAt }, process: ph.running ? turnProcess(thread, harness, undefined, agent) : null, paused_until: paused, pause_started_at: paused ? ph.lastErrorAt : null };
|
|
417
421
|
}
|
|
418
422
|
/** The harness process running a turn of this session (`codex exec resume <thread>`, `claude ... --resume <id>`), from ps. */
|
|
419
423
|
export function turnProcess(thread, harness = "codex", psOutput, agent) {
|
|
@@ -604,7 +608,7 @@ export function machineFacts(providersInUse = ["anthropic"]) {
|
|
|
604
608
|
booted_at: new Date(Math.floor((Date.now() - uptime() * 1000) / 60_000) * 60_000).toISOString(),
|
|
605
609
|
daemon_path: path,
|
|
606
610
|
bschat: { version: CLI_VERSION, bin: requireInstall().bin },
|
|
607
|
-
codex: codex.status === 0 ? { version: codex.stdout.trim(), logged_in: login?.status === 0 && /logged in/i.test(`${login.stdout}${login.stderr}`), login: `${login?.stdout ?? ""}${login?.stderr ?? ""}`.trim().slice(0, 200), sandbox: codexSandbox(false, path) } : null,
|
|
611
|
+
codex: codex.status === 0 ? { version: codex.stdout.trim(), logged_in: login?.status === 0 && /logged in/i.test(`${login.stdout}${login.stderr}`), login: `${login?.stdout ?? ""}${login?.stderr ?? ""}`.trim().slice(0, 200), account_fingerprint: codexAccountFingerprint(), sandbox: codexSandbox(false, path) } : null,
|
|
608
612
|
"claude-code": claude,
|
|
609
613
|
claude_code: claude,
|
|
610
614
|
dsh,
|
|
@@ -614,6 +618,17 @@ export function machineFacts(providersInUse = ["anthropic"]) {
|
|
|
614
618
|
at: new Date().toISOString(),
|
|
615
619
|
};
|
|
616
620
|
}
|
|
621
|
+
/** Stable, non-reversible account identity for detecting a login switch without reporting its id. */
|
|
622
|
+
export function codexAccountFingerprint(authFile = join(process.env.CODEX_HOME ?? join(homedir(), ".codex"), "auth.json")) {
|
|
623
|
+
try {
|
|
624
|
+
const auth = JSON.parse(readFileSync(authFile, "utf8"));
|
|
625
|
+
const accountId = auth.tokens?.account_id ?? auth.account_id;
|
|
626
|
+
return typeof accountId === "string" && accountId ? createHash("sha256").update(accountId).digest("hex") : null;
|
|
627
|
+
}
|
|
628
|
+
catch {
|
|
629
|
+
return null;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
617
632
|
/**
|
|
618
633
|
* Provisioning steps that need this machine's own view, run by `machine add` over ssh: linger on
|
|
619
634
|
* Linux, Codex present and logged in, and b9s's hooks in Codex's administrator layer when sudo
|
|
@@ -647,6 +662,12 @@ export function prepare(opts = {}) {
|
|
|
647
662
|
const ok = login.status === 0 && /logged in/i.test(`${login.stdout}${login.stderr}`);
|
|
648
663
|
steps.push({ step: "codex", result: ok ? "ok" : "failed", detail: ok ? `${codex.stdout.trim()}, ${`${login.stdout}${login.stderr}`.trim()}` : `${codex.stdout.trim()} is not logged in: run codex login --device-auth on this machine` });
|
|
649
664
|
}
|
|
665
|
+
const gitName = spawnSync("git", ["config", "--global", "--get", "user.name"], { encoding: "utf8", env: daemonEnv });
|
|
666
|
+
const gitEmail = spawnSync("git", ["config", "--global", "--get", "user.email"], { encoding: "utf8", env: daemonEnv });
|
|
667
|
+
const hasGitIdentity = gitName.status === 0 && !!gitName.stdout.trim() && gitEmail.status === 0 && !!gitEmail.stdout.trim();
|
|
668
|
+
steps.push(hasGitIdentity
|
|
669
|
+
? { step: "git identity", result: "ok", detail: `commits will use ${gitName.stdout.trim()} <${gitEmail.stdout.trim()}>` }
|
|
670
|
+
: { step: "git identity", result: "failed", detail: 'configure both values before agents commit: git config --global user.name "Your Name" && git config --global user.email "you@example.com"' });
|
|
650
671
|
if (codex.status === 0) {
|
|
651
672
|
let sb = codexSandbox(true, daemonPath);
|
|
652
673
|
if (sb.ok)
|