@miraland-labs/conduit-bridge 0.13.0 → 0.13.1

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/driver.js CHANGED
@@ -152,7 +152,7 @@ export function extractAgentReportJsonText(text) {
152
152
  const fromUnclosed = unclosed?.[1]?.trim();
153
153
  if (fromUnclosed)
154
154
  return fromUnclosed;
155
- const start = text.lastIndexOf("{");
155
+ const start = text.indexOf("{");
156
156
  if (start < 0)
157
157
  throw new Error("Agent did not emit the required structured report");
158
158
  return text.slice(start).trim();
package/dist/execution.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { spawn } from "node:child_process";
1
2
  import { createHash } from "node:crypto";
2
3
  import { z } from "zod";
3
4
  import { ConduitRequestError } from "./client.js";
@@ -9,6 +10,30 @@ import { attemptWorktreePath, createAttemptWorktree, proveResumeWorktree, quaran
9
10
  import { buildWorkspaceBrief, ensureCommitAvailable, normalizeRepositoryUrl, resolveAttemptStartCommit } from "./brief.js";
10
11
  import { ensureDeliveryPullRequest } from "./ensure-pull-request.js";
11
12
  import { captureVerificationFailure, ensureTestEvidence } from "./ensure-test-evidence.js";
13
+ /** Keep a Mac awake only while an assignment is active; display sleep remains allowed. */
14
+ export function startIdleSleepGuard(options = {}) {
15
+ if ((options.platform ?? process.platform) !== "darwin")
16
+ return () => undefined;
17
+ const launch = options.launch ?? ((command, args) => spawn(command, args, { stdio: "ignore" }));
18
+ let guard;
19
+ try {
20
+ // -w ties the assertion to the runner as a crash-safe ceiling; normal completion kills it sooner.
21
+ guard = launch("caffeinate", ["-i", "-w", String(options.pid ?? process.pid)]);
22
+ }
23
+ catch (error) {
24
+ console.error(`Idle-sleep guard unavailable: ${redactSecrets(error instanceof Error ? error.message : "unknown")}`);
25
+ return () => undefined;
26
+ }
27
+ guard.once("error", (error) => console.error(`Idle-sleep guard unavailable: ${redactSecrets(error.message)}`));
28
+ guard.unref();
29
+ let released = false;
30
+ return () => {
31
+ if (released)
32
+ return;
33
+ released = true;
34
+ guard.kill("SIGTERM");
35
+ };
36
+ }
12
37
  /** Feedback text for changes_requested summaries (plain string or `{ feedback }`). */
13
38
  function changesRequestedFeedback(summary) {
14
39
  if (!summary)
@@ -710,6 +735,7 @@ async function runClaimedAssignment(client, config, driver, workspace, brief, ta
710
735
  executionKind,
711
736
  sourceAttemptId: sourceAttemptId ?? undefined,
712
737
  });
738
+ const releaseIdleSleep = startIdleSleepGuard();
713
739
  const renewTimer = setInterval(() => { void renewLeases(client, config).catch((error) => console.error(`Lease renewal failed: ${redactSecrets(error instanceof Error ? error.message : "unknown")}`)); }, 60_000);
714
740
  let heartbeatRunning = false;
715
741
  const heartbeatTimer = supervision ? setInterval(() => {
@@ -948,6 +974,7 @@ async function runClaimedAssignment(client, config, driver, workspace, brief, ta
948
974
  console.log(`Assignment ${taskId} delivered for review and acceptance.`);
949
975
  }
950
976
  finally {
977
+ releaseIdleSleep();
951
978
  clearInterval(renewTimer);
952
979
  if (heartbeatTimer)
953
980
  clearInterval(heartbeatTimer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miraland-labs/conduit-bridge",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Conduit Bridge CLI — join, connect, disconnect, multi-driver lanes, and run Claude Code / Codex / Cursor / OpenCode / Pi / Kiro / Antigravity agents for a Conduit organization",
5
5
  "type": "module",
6
6
  "bin": {