benignswarm 0.12.126 → 0.12.128

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.
@@ -78,7 +78,17 @@ export function antigravitySettings(sandbox, cwd, b9sHome, apiHost, extraWritabl
78
78
  const wanted = [...new Set([dirname(cwd), b9sHome, ...extraWritable])];
79
79
  const containsCheckout = (dir) => cwd === dir || cwd.startsWith(dir.endsWith(sep) ? dir : dir + sep);
80
80
  const around = wanted.filter(containsCheckout);
81
- const beside = wanted.filter((dir) => !containsCheckout(dir));
81
+ // A folder inside the checkout's parent, which is already granted by permission, needs nothing
82
+ // more and must not become a workspace: with the clone's shared git folders (<clone>/.git/logs and the like, inside
83
+ // the checkout's parent) added as workspaces, agy ran every command in <clone>/.git/logs. The
84
+ // start's own `git ls-remote origin` then read the clone's SSH origin and failed, so each start
85
+ // attempt spent a model turn and no session came up (verified with agy on Linux, two models;
86
+ // granted through the parent alone, commands run in the checkout and git can branch, commit and
87
+ // add worktrees).
88
+ const within = (dir, outer) => dir !== outer && dir.startsWith(outer.endsWith(sep) ? outer : outer + sep);
89
+ const parent = dirname(cwd);
90
+ const besideCheckout = (dir) => within(dir, parent) && !within(dir, cwd);
91
+ const beside = wanted.filter((dir) => !containsCheckout(dir) && !besideCheckout(dir));
82
92
  const allow = [...new Set([...antigravitySandboxPermissions(apiHost, b9sHome, b9sBin, nodeBin, repoDirectory(cwd)), ...around.map((dir) => `write_file(${dir})`)])];
83
93
  return [
84
94
  "--sandbox", "--settings",
package/dist/args.js CHANGED
@@ -37,7 +37,7 @@ export const STRING_FLAGS = [
37
37
  "purpose", "storage-mode", "hosts", "arn", "version-id",
38
38
  "mode", "weights", "quality-target", "half-life", "min-samples", "build-explore", "review-explore", "pause-build", "pause-review", "class",
39
39
  "expires-at", "conflicts-with", "source-channel-id", "source-message-id",
40
- "metadata-file",
40
+ "metadata-file", "confirm-agent", "confirm-parked",
41
41
  ];
42
42
  export const BOOL_FLAGS = [
43
43
  "latest", "no-restart", "json", "follow", "account", "help", "version", "broadcast", "create-channels",
@@ -256,7 +256,7 @@ export async function harnessStart(p, out, harness) {
256
256
  `If you ran on another machine before, read your latest note first: \`b9s handoffs --agent ${creds.agent}\` (your units, branches and chat are on the server as before).`,
257
257
  ].join("\n");
258
258
  const diagnostic = [];
259
- if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (m) => diagnostic.push(m), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, harness))) {
259
+ if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (m) => diagnostic.push(m), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, harness, session ? probeFor(harness, session, ref) : undefined))) {
260
260
  throw new CliError("turn_mode_fault", refusalReason(diagnostic));
261
261
  }
262
262
  reportMachineStartProgress("onboarding_turn_running");
@@ -580,7 +580,7 @@ export function runClaudeSandboxSelfCheck(bin, settings, maxBudgetUsd, env, cwd,
580
580
  /** Guard a model-spending connectivity preflight independently from the agent's real turn. */
581
581
  export async function runGuardedClaudeSandboxSelfCheck(ref, turnsPerHour, bin, settings, maxBudgetUsd, env, cwd, session, run = runClaudeSandboxSelfCheck, unproductivePerHour = DEFAULT_UNPRODUCTIVE_PER_HOUR) {
582
582
  const diagnostic = [];
583
- if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (message) => diagnostic.push(message), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, "claude-code"))) {
583
+ if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (message) => diagnostic.push(message), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, "claude-code", probeFor("claude-code", session, ref)))) {
584
584
  throw new CliError("turn_mode_fault", refusalReason(diagnostic));
585
585
  }
586
586
  const probe = probeFor("claude-code", session, ref);
@@ -631,7 +631,7 @@ export function assertAntigravitySelfCheck(output) {
631
631
  /** Run the two connectivity checks through the real model tools inside the per-turn sandbox. */
632
632
  export async function runAntigravitySandboxSelfCheck(ref, bin, settings, cwd, session, model, effort, timeoutSeconds, logPath, turnsPerHour = DEFAULT_TURNS_PER_HOUR, env = antigravityTurnEnv("workspace-write"), unproductivePerHour = DEFAULT_UNPRODUCTIVE_PER_HOUR) {
633
633
  const diagnostic = [];
634
- if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (message) => diagnostic.push(message), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, "antigravity"))) {
634
+ if (!(await beginTurnGuardAttempt(ref, turnsPerHour, (message) => diagnostic.push(message), process.env, unproductivePerHour, process.env.BSCHAT_MACHINE_SESSION_ID, "antigravity", probeFor("antigravity", session, ref)))) {
635
635
  throw new CliError("turn_mode_fault", refusalReason(diagnostic));
636
636
  }
637
637
  const prompt = [
@@ -68,7 +68,7 @@ function writeMachineState(s) {
68
68
  * again once with them. 2: the agent's own worktree git folder is writable under workspace-write.
69
69
  * 3: turns get TMPDIR beside the checkout instead of the system's /tmp.
70
70
  */
71
- const START_REV = 9;
71
+ const START_REV = 10;
72
72
  export const sessionFingerprint = (s, writable = [], imageDigest = null) => JSON.stringify([s.id, s.harness, ...(s.provider && s.provider !== "anthropic" ? [s.provider] : []), s.dir, s.sandbox, s.model, s.effort, s.turn_timeout, s.turns_per_hour ?? DEFAULT_TURNS_PER_HOUR, s.unproductive_per_hour ?? DEFAULT_UNPRODUCTIVE_PER_HOUR, s.turn_coalesce_seconds ?? 180, s.thread, ...(writable.length ? [writable] : []), ...(imageDigest ? [imageDigest] : []), ...(START_REV > 1 ? [`rev${START_REV}`] : [])]);
73
73
  /** A server thread update must restart the watcher even if a stored fingerprint is unexpectedly stale. */
74
74
  export function sessionConfigChanged(s, local, fingerprint) {
@@ -1035,7 +1035,7 @@ async function turnActivity(name, env) {
1035
1035
  return snapshot;
1036
1036
  }
1037
1037
  /** Reserve every actual harness launch, including b9s start's onboarding turn. */
1038
- export async function beginTurnGuardAttempt(name, turnsPerHour, log, env = process.env, unproductivePerHour = DEFAULT_UNPRODUCTIVE_PER_HOUR, machineSessionId = env.BSCHAT_MACHINE_SESSION_ID, harness) {
1038
+ export async function beginTurnGuardAttempt(name, turnsPerHour, log, env = process.env, unproductivePerHour = DEFAULT_UNPRODUCTIVE_PER_HOUR, machineSessionId = env.BSCHAT_MACHINE_SESSION_ID, harness, resample) {
1039
1039
  let current = readState(name, env);
1040
1040
  const creds = loadAgent(name, env);
1041
1041
  const waiting = current.turn_telemetry_completion_pending;
@@ -1078,6 +1078,13 @@ export async function beginTurnGuardAttempt(name, turnsPerHour, log, env = proce
1078
1078
  return false;
1079
1079
  if (!turnMemoryFloorAllows(log))
1080
1080
  return false;
1081
+ // An unverified turn is sampled again here, by whoever is about to start a turn. Only the
1082
+ // watcher's tick did so, and a session start refuses while a turn is unverified: when the watcher
1083
+ // was not running (a restart whose first turn failed and whose sample did not get through), start
1084
+ // was refused on every pass with the hour-old error and nothing ever sampled again. A sample that
1085
+ // fails leaves the turn unverified exactly as before; this adds a sample, never a verdict.
1086
+ if (resample && unverifiedTurn(current.turn_guard))
1087
+ await completePendingTurnGuard(name, resample, log, undefined, undefined, env);
1081
1088
  const before = await turnActivity(name, env);
1082
1089
  current = readState(name, env);
1083
1090
  if (current.turn_guard?.fault) {
@@ -952,7 +952,27 @@ export async function wu(p, out) {
952
952
  return;
953
953
  }
954
954
  case "expedite": {
955
- const r = await client.call("POST", `${base}/${num()}/expedite`, {});
955
+ const expectedAgent = str(p.flags, "confirm-agent");
956
+ const expectedParked = str(p.flags, "confirm-parked");
957
+ if ((expectedAgent === undefined) !== (expectedParked === undefined)) {
958
+ throw new CliError("usage", 'wu expedite <n> [--confirm-agent <agent-id> --confirm-parked <unit-number>]');
959
+ }
960
+ if (expectedAgent === undefined) {
961
+ const preview = await client.call("POST", `${base}/${num()}/expedite`, { dry_run: true });
962
+ const agent = preview.agent;
963
+ const parked = preview.parked_unit;
964
+ if (!agent?.id || !agent?.name || !parked?.number || !parked?.title) {
965
+ out.print(`WU #${num()}: ${preview.urgent_unit?.title ?? "Urgent work"}\nNo eligible worker and active unit are available to expedite this urgent unit.`, preview);
966
+ return;
967
+ }
968
+ out.print(`WU #${num()}: ${preview.urgent_unit?.title ?? "Urgent work"}\nExpedite preview: assign WU #${num()} to ${agent.name} (${agent.id}) and park WU #${parked.number} “${parked.title}”.\nReview these exact targets, then confirm with: b9s wu expedite ${num()} --confirm-agent ${agent.id} --confirm-parked ${parked.number}`, preview);
969
+ return;
970
+ }
971
+ const parkedNumber = Number(expectedParked);
972
+ if (!Number.isSafeInteger(parkedNumber) || parkedNumber < 1) {
973
+ throw new CliError("usage", "--confirm-parked must be a positive work-unit number from the preview");
974
+ }
975
+ const r = await client.call("POST", `${base}/${num()}/expedite`, { expect: { agent: expectedAgent, parked_unit: parkedNumber } });
956
976
  out.print(`${fmt(r.unit)}\nWU #${num()} expedited to ${r.unit.owner_name}; the owner's current unit is parked until this unit is submitted.`, r);
957
977
  return;
958
978
  }
package/dist/help.js CHANGED
@@ -84,7 +84,7 @@ Agent commands
84
84
  b9s wu assign <n> --to <agent> [--reason "why"] reassign an assigned or queued unit in place
85
85
  b9s wu lands-with <n> <base-unit|clear> set or clear the base WU whose landing gates this unit
86
86
  b9s wu priority <n> urgent|normal --note "why this priority changed" operator or assigner: change dispatch priority; urgent work is dispatched first
87
- b9s wu expedite <n> operator or assigner: interrupt a qualified, wakeable worker for an urgent unit; their current unit resumes when this one is submitted
87
+ b9s wu expedite <n> [--confirm-agent <id> --confirm-parked <n>] operator or assigner: preview exact targets first, then confirm them; 409 means preview again
88
88
  b9s wu take <n> [--to <agent>] [--reason "why"] pull a unit or hand it to someone
89
89
  reason is required when an assigner uses its assign_outside_qualifications role capability
90
90
  b9s wu next take the oldest queued unit you qualify for
@@ -338,8 +338,8 @@ the returned object and warning, then exits 3. Inspect the object and do not ret
338
338
  b9s-admin agent --account bench|unbench <agent> [--note <text>]
339
339
  b9s-admin agent --account retire <agent> [--note <text> | --note-file <file>] --yes
340
340
  b9s-admin agent list <project>
341
- b9s-admin agent bench <project>/<agent> [--note <text>] suspend keys and free an active seat
342
- b9s-admin agent unbench <project>/<agent> restore keys if a seat is available
341
+ b9s-admin agent bench <project>/<agent> [--note <text>] suspend keys and free an active seat (manual agents only; console Agents/Machines also bench/unbench with seat counts)
342
+ b9s-admin agent unbench <project>/<agent> restore keys if a seat is available (402 plan_limit when full; refuses pool slots with 409 — restore in Pools)
343
343
  b9s-admin agent retire <project>/<agent> [--note <text> | --note-file <file>] --yes revoke keys, remove machine sessions, release units, optionally save a resume handoff
344
344
  b9s-admin agent away <project>/<agent> (--for <minutes|hours> | --until <ISO timestamp>) --reason "why"
345
345
  b9s-admin agent back <project>/<agent>
@@ -478,7 +478,7 @@ Pools (fixed or adaptive; the server names the agents and places them on machine
478
478
  pool writes first show a server impact preview; confirm a fresh revision with --impact-revision <revision>
479
479
  b9s-admin pool list [project] | show <project>/<name> | events <project>/<name> [--limit 1..100]
480
480
  Console: Pools → pool details → Adaptive history and overrides.
481
- Console → Pools shows account/project placement, slot work/session state, and machine headroom
481
+ Console → Pools shows seat/agent counts, placement, slot work/session state, machine headroom, and previewed slot suspend/restore (with /account recovery on 402 plan_limit)
482
482
  b9s-admin pool pause|resume <project>/<name> [--reason <text>] pause only automatic scaling; sessions keep running
483
483
  b9s-admin pool pin <project>/<name> <slot> --machine <name> [--until <ISO>] [--reason <text>] | unpin <project>/<name> <slot>
484
484
  b9s-admin pool suspend|restore <project>/<name> <slot> [--reason <text>] [--note <text>] suspended agents stay benched until restored; no replacement is created
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.12.126";
1
+ export const CLI_VERSION = "0.12.128";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benignswarm",
3
- "version": "0.12.126",
3
+ "version": "0.12.128",
4
4
  "description": "b9s: chat, status board and evidence store for coding agents (benignswarm.org)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {