@bivy/bivy 0.18.11-staging.13 → 0.18.11-staging.14

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/bin/bivy.mjs CHANGED
@@ -2506,7 +2506,8 @@ async function cmdDelegate(args = []) {
2506
2506
  if (!res.ok) throw new Error(data?.error || `HTTP ${res.status}`);
2507
2507
  return data;
2508
2508
  };
2509
- const terminal = (run) => ["succeeded", "failed", "cancelled"].includes(run?.status);
2509
+ // needs_attention = parked by the machine's policy; it won't move on its own.
2510
+ const terminal = (run) => ["succeeded", "failed", "cancelled", "needs_attention"].includes(run?.status);
2510
2511
  // The node caps one wait at 300s; loop until the child ends or our budget does.
2511
2512
  const waitFor = async (runId, seconds) => {
2512
2513
  const deadline = Date.now() + seconds * 1000;
package/dist/run-tools.js CHANGED
@@ -12,6 +12,9 @@ export const RUN_TOOL_LIMITS = {
12
12
  maxAnswer: 8_000,
13
13
  };
14
14
  const TERMINAL = new Set(["succeeded", "failed", "cancelled"]);
15
+ // Parked by the node's policy (usage limit, missing credentials): it won't
16
+ // progress without a person, so waiting ends there and the reason comes back.
17
+ const SETTLED = new Set([...TERMINAL, "needs_attention"]);
15
18
  const STATUSES = new Set(["pending", "claimed", "running", "waiting", "needs_attention", "succeeded", "failed", "cancelled"]);
16
19
  const SOURCE_PREFIX = "agent-delegation:v1:";
17
20
  const bounded = (v, n) => typeof v === "string" && v ? v.slice(0, n) : undefined;
@@ -109,7 +112,7 @@ export class RunDelegationService {
109
112
  if (!raw || provenance?.parentSessionId !== sessionId)
110
113
  throw new Error("delegated Run not found");
111
114
  const value = safeRun(raw, provenance);
112
- if (TERMINAL.has(value.status) && this.backend.answer) {
115
+ if (SETTLED.has(value.status) && this.backend.answer) {
113
116
  // Best-effort: an unreachable machine still leaves status + references.
114
117
  const answer = cached?.value.answer ?? await this.backend.answer(raw).catch(() => undefined);
115
118
  if (answer)
@@ -155,7 +158,7 @@ export class RunDelegationService {
155
158
  if (signal?.aborted)
156
159
  throw signal.reason ?? new Error("wait cancelled; the child Run may still be running");
157
160
  const result = await this.authorized(sessionId, runId, true);
158
- if (TERMINAL.has(result.status))
161
+ if (SETTLED.has(result.status))
159
162
  return result;
160
163
  if (this.now() >= deadline)
161
164
  return { ...result, timedOut: true, wait: { timedOut: true, childContinues: true } };
package/dist/server.js CHANGED
@@ -4667,11 +4667,7 @@ async function runIssueTaskInner(cfg, issue, source, overrides = {}) {
4667
4667
  sessionNamer.setSessionName(record, issueSessionTitle(issue));
4668
4668
  // Best-effort model selection for runtimes that support it (e.g. claude-code, pi).
4669
4669
  if (directives.model && typeof record.session.setModel === "function") {
4670
- try {
4671
- assertSessionModel(record, directives.model);
4672
- await record.session.setModel("", directives.model);
4673
- }
4674
- catch { }
4670
+ await applyRequestedModel(record, { provider: "", id: directives.model });
4675
4671
  }
4676
4672
  if (!record.worktree)
4677
4673
  throw new Error("worktree was not created for the issue session");
@@ -5515,12 +5511,8 @@ async function executeWorkItem(item, report, signal) {
5515
5511
  approvalMode: safety.approval,
5516
5512
  });
5517
5513
  sessionNamer.setSessionName(record, `${issue.identifier}: ${issue.title}`);
5518
- if (item.model) {
5519
- try {
5520
- await record.session.setModel("", item.model);
5521
- }
5522
- catch { }
5523
- }
5514
+ if (item.model)
5515
+ await applyRequestedModel(record, { provider: "", id: item.model });
5524
5516
  await report({ output: { sessionId: record.id, branch }, events: [{ at: new Date().toISOString(), kind: "branch", summary: "Linear issue working branch and session created.", ref: branch, url: issue.url }] });
5525
5517
  await runSessionTurn(record, buildLinearTaskPrompt(issue, item.body), signal);
5526
5518
  if (signal.aborted)
@@ -5597,10 +5589,7 @@ async function executeWorkItem(item, report, signal) {
5597
5589
  sessionNamer.setSessionName(record, item.title);
5598
5590
  persistSessionMetadata(record);
5599
5591
  if (item.model) {
5600
- try {
5601
- await record.session.setModel("", item.model);
5602
- }
5603
- catch { }
5592
+ await applyRequestedModel(record, { provider: "", id: item.model });
5604
5593
  }
5605
5594
  // Record the session id with the control plane BEFORE the (potentially long)
5606
5595
  // turn runs, not just after it completes. A machine restart mid-turn must leave
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bivy/bivy",
3
- "version": "0.18.11-staging.13",
3
+ "version": "0.18.11-staging.14",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0-only",
6
6
  "description": "Run coding agents on machines you own. Open-source, self-hostable agent workspace.",