@rallycry/conveyor-agent 11.0.15 → 11.0.16

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startWorkbenchServer
3
- } from "./chunk-IBAIJY7V.js";
3
+ } from "./chunk-7TSQXIN3.js";
4
4
  import {
5
5
  TOMBSTONE_MESSAGE,
6
6
  isLegacyEntrypointLaunch
@@ -12,7 +12,7 @@ import {
12
12
  refreshSkillsAfterCheckout,
13
13
  runPreReadyBinds
14
14
  } from "./chunk-SR66HQKB.js";
15
- import "./chunk-JG3VMWRQ.js";
15
+ import "./chunk-QLMNQSJL.js";
16
16
  import {
17
17
  GitPrepJob,
18
18
  defaultGit,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadPtySpawn
3
- } from "./chunk-JG3VMWRQ.js";
3
+ } from "./chunk-QLMNQSJL.js";
4
4
  import {
5
5
  terminateProcessGroup
6
6
  } from "./chunk-W4LZ7R6Z.js";
@@ -38,6 +38,36 @@ var RemoteProcessHandle = class extends EventEmitter {
38
38
  };
39
39
 
40
40
  // src/workbench/client.ts
41
+ var WORKBENCH_COMMAND_ENV_DENYLIST = /* @__PURE__ */ new Set([
42
+ "POD_BOOTSTRAP_TOKEN",
43
+ "CONVEYOR_BOOTSTRAP_TOKEN",
44
+ "CONVEYOR_WORKBENCH_TOKEN",
45
+ "CONVEYOR_TASK_TOKEN",
46
+ "CONVEYOR_PROJECT_TOKEN",
47
+ "CONVEYOR_GIT_SECRET",
48
+ "CONVEYOR_GIT_CREDENTIAL_DIR",
49
+ "CONVEYOR_GITHUB_TOKEN",
50
+ "CONVEYOR_GITHUB_TOKEN_FILE",
51
+ "GH_TOKEN",
52
+ "GITHUB_TOKEN",
53
+ "GH_CONFIG_DIR",
54
+ "ANTHROPIC_API_KEY",
55
+ "CLAUDE_CODE_OAUTH_TOKEN",
56
+ "CONVEYOR_AGENT_KEY",
57
+ "CONVEYOR_CLAUDE_OAUTH",
58
+ "CONVEYOR_CODEX_OAUTH",
59
+ "CONVEYOR_OPENCODE_OAUTH",
60
+ "CLOUDSDK_AUTH_ACCESS_TOKEN"
61
+ ]);
62
+ function serializableEnv(env) {
63
+ const result = {};
64
+ for (const [key, value] of Object.entries(env)) {
65
+ if (typeof value === "string" && !WORKBENCH_COMMAND_ENV_DENYLIST.has(key)) {
66
+ result[key] = value;
67
+ }
68
+ }
69
+ return result;
70
+ }
41
71
  function frameError(frame) {
42
72
  return new WorkbenchError(frame.message, frame.code);
43
73
  }
@@ -158,7 +188,7 @@ var WorkbenchClient = class {
158
188
  }
159
189
  /** Mirrors setup/commands.ts runSetupCommand (shell form, streamed output,
160
190
  * abort → graceful term-group kill, non-zero exit rejects). */
161
- runSetupCommand(cmd, cwd, onOutput, signal) {
191
+ runSetupCommand(cmd, cwd, onOutput, signal, env = process.env) {
162
192
  return new Promise((resolve, reject) => {
163
193
  if (signal?.aborted) {
164
194
  const error = new Error("Operation aborted");
@@ -170,7 +200,7 @@ var WorkbenchClient = class {
170
200
  let exited = false;
171
201
  let aborting = false;
172
202
  const socket = this.open(
173
- { op: "exec", command: cmd, cwd },
203
+ { op: "exec", command: cmd, cwd, env: serializableEnv(env) },
174
204
  (frame) => {
175
205
  if (frame.t === "out" && !aborting) {
176
206
  onOutput(frame.s, Buffer.from(frame.d, "base64").toString("utf8"));
@@ -204,14 +234,14 @@ var WorkbenchClient = class {
204
234
  }
205
235
  /** Mirrors setup/commands.ts runStartCommand: returns a live handle that
206
236
  * emits exit/error and whose kill() runs the graceful term-group stop. */
207
- runStartCommand(cmd, cwd, onOutput) {
237
+ runStartCommand(cmd, cwd, onOutput, env = process.env) {
208
238
  let socket;
209
239
  const handle = new RemoteProcessHandle(() => {
210
240
  if (socket) writeFrame(socket, { t: "signal", mode: "term-group" });
211
241
  });
212
242
  let exited = false;
213
243
  socket = this.open(
214
- { op: "exec", command: cmd, cwd },
244
+ { op: "exec", command: cmd, cwd, env: serializableEnv(env) },
215
245
  (frame) => {
216
246
  if (frame.t === "out") {
217
247
  onOutput(frame.s, Buffer.from(frame.d, "base64").toString("utf8"));
@@ -29,7 +29,7 @@ import {
29
29
  spawnOptionsFingerprint,
30
30
  transcriptSize,
31
31
  turnOptionsFrom
32
- } from "./chunk-JG3VMWRQ.js";
32
+ } from "./chunk-QLMNQSJL.js";
33
33
  import {
34
34
  AgentConnection,
35
35
  CodespacePortVisibility,
@@ -59,7 +59,7 @@ import {
59
59
  statWorkspacePath,
60
60
  updateRemoteToken,
61
61
  verifyGitCredential
62
- } from "./chunk-YMZ6Q55T.js";
62
+ } from "./chunk-M4SD2ESQ.js";
63
63
  import {
64
64
  registerBootMilestoneSocketFallback,
65
65
  reportBootMilestone
@@ -80,7 +80,7 @@ import {
80
80
  } from "./chunk-IA45XHOA.js";
81
81
  import {
82
82
  getWorkbenchClient
83
- } from "./chunk-TOTCEWJD.js";
83
+ } from "./chunk-B54XFOXL.js";
84
84
  import {
85
85
  workbenchEnabled
86
86
  } from "./chunk-KMB3BU4S.js";
@@ -16038,6 +16038,7 @@ var SessionRunner = class _SessionRunner {
16038
16038
  `);
16039
16039
  }
16040
16040
  }
16041
+ this.workspaceCommands?.notifyWorkspaceReady();
16041
16042
  this.mode.applyServerMode(this.fullContext?.agentMode, this.fullContext?.isAuto);
16042
16043
  this.mode.resolveInitialMode(this.taskContext);
16043
16044
  if (this.fullContext?.isAuto && PRE_BUILD_TASK_STATUSES.has(this.taskContext.status) && this.mode.isBuildCapable && hasTaskPlan(this.fullContext.plan)) {
@@ -16070,7 +16071,6 @@ var SessionRunner = class _SessionRunner {
16070
16071
  `
16071
16072
  );
16072
16073
  }
16073
- this.workspaceCommands?.notifyLoopReady();
16074
16074
  while (!this.stopped) {
16075
16075
  if (this._state !== "idle") await this.setState("idle");
16076
16076
  await this.coreLoop();
@@ -16238,7 +16238,6 @@ var SessionRunner = class _SessionRunner {
16238
16238
  }
16239
16239
  if (delivery === "prefill") {
16240
16240
  await this.setState("waiting_for_input");
16241
- this.workspaceCommands?.notifyLoopReady();
16242
16241
  await this.callbacks.onEvent({ type: "execute_mode", mode: effectiveMode, delivery });
16243
16242
  if (this.pendingMessages.length > 0) {
16244
16243
  if (!this.stopped) await this.setState("idle");
@@ -16381,7 +16380,6 @@ var SessionRunner = class _SessionRunner {
16381
16380
  */
16382
16381
  async runPrefilledMessage(msg, effectiveMode) {
16383
16382
  await this.setState("waiting_for_input");
16384
- this.workspaceCommands?.notifyLoopReady();
16385
16383
  await this.callbacks.onEvent({
16386
16384
  type: "execute_mode",
16387
16385
  mode: effectiveMode,
@@ -16718,7 +16716,6 @@ var SessionRunner = class _SessionRunner {
16718
16716
  return this.callbacks.onStatusChange(status);
16719
16717
  },
16720
16718
  onEvent: (event) => {
16721
- this.workspaceCommands?.notifyLoopReady();
16722
16719
  if (!this.agentLiveReported) {
16723
16720
  this.agentLiveReported = true;
16724
16721
  void reportBootMilestone({ key: "agent_live" });
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  WorkbenchError,
22
22
  getWorkbenchClient
23
- } from "./chunk-TOTCEWJD.js";
23
+ } from "./chunk-B54XFOXL.js";
24
24
  import {
25
25
  workbenchEnabled
26
26
  } from "./chunk-KMB3BU4S.js";
@@ -200,7 +200,7 @@ async function loadPtySpawn() {
200
200
  async function resolvePtySpawn() {
201
201
  const { workbenchEnabled } = await import("./mode-ZJSOSLGU.js");
202
202
  if (!workbenchEnabled()) return loadPtySpawn();
203
- const { getWorkbenchClient } = await import("./client-6AUPKKMV.js");
203
+ const { getWorkbenchClient } = await import("./client-DVVHMIOO.js");
204
204
  return (file, args, options) => getWorkbenchClient().spawnPty(file, args, options);
205
205
  }
206
206
  function sessionTempBase() {
@@ -5,7 +5,7 @@ import {
5
5
  readWorkspaceBytes,
6
6
  statWorkspacePath,
7
7
  workspacePathExists
8
- } from "./chunk-YMZ6Q55T.js";
8
+ } from "./chunk-M4SD2ESQ.js";
9
9
  import {
10
10
  reportBootMilestone
11
11
  } from "./chunk-GL2DIQEQ.js";
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-W4LZ7R6Z.js";
17
17
  import {
18
18
  getWorkbenchClient
19
- } from "./chunk-TOTCEWJD.js";
19
+ } from "./chunk-B54XFOXL.js";
20
20
  import {
21
21
  workbenchEnabled
22
22
  } from "./chunk-KMB3BU4S.js";
@@ -197,8 +197,12 @@ async function runDepsSync(options) {
197
197
  let plan = null;
198
198
  try {
199
199
  plan = await resolveDepsSyncPlan(options);
200
- } catch {
201
- return { outcome: "skipped" };
200
+ } catch (error) {
201
+ const cause = error instanceof Error ? error.message : String(error);
202
+ const message = `Dependency state inspection failed before install could start: ${cause}.`;
203
+ options.onOutput("stderr", `[deps] ${message}
204
+ `);
205
+ return { outcome: "failed", message };
202
206
  }
203
207
  if (!plan) return { outcome: "skipped" };
204
208
  const { onOutput, runCommand, env } = options;
@@ -449,16 +453,14 @@ var WorkspaceCommandSupervisor = class {
449
453
  startCommandLaunchRequested = false;
450
454
  started = false;
451
455
  stopped = false;
452
- /** Resolved by notifyLoopReady() once the PTY is live — the runner fires it
453
- * on the first harness event of the initial query (or when a prefill
454
- * parks), NOT after the first turn completes, so the app's start command
455
- * isn't held behind a long working turn. Also resolved by stop() if
456
- * shutdown arrives first either way unblocks the awaiter in
457
- * runSetupAndStart so a supervisor stopped before the loop ever signals
458
- * doesn't hang its background task (and therefore stop()) forever. */
459
- resolveLoopReady;
460
- loopReady = new Promise((resolve) => {
461
- this.resolveLoopReady = resolve;
456
+ /** Resolved once SessionRunner has finished the authoritative task-branch
457
+ * checkout and WIP restore. Those operations can change bun.lock and the
458
+ * schema, so dependency repair and preview startup must not read the tree
459
+ * before this boundary. stop() also resolves it so a failed early boot
460
+ * cannot leave its background task parked forever. */
461
+ resolveWorkspaceReady;
462
+ workspaceReady = new Promise((resolve) => {
463
+ this.resolveWorkspaceReady = resolve;
462
464
  });
463
465
  constructor(options) {
464
466
  this.config = options.config;
@@ -508,17 +510,20 @@ var WorkspaceCommandSupervisor = class {
508
510
  );
509
511
  }
510
512
  }
511
- /** Release the start-command launch called once the runner's core loop
512
- * (the PTY) is live. Idempotent; resolving an already-settled promise is a
513
- * no-op, so a late/duplicate call (or one after stop() already resolved
514
- * it) is harmless. */
513
+ /** Release dependency reconciliation and preview startup after the runner
514
+ * has made the workspace authoritative. Idempotent by Promise semantics. */
515
+ notifyWorkspaceReady() {
516
+ this.resolveWorkspaceReady();
517
+ }
518
+ /** @deprecated Call notifyWorkspaceReady once checkout and WIP restore
519
+ * finish. Kept for simplified callers while they adopt that boundary. */
515
520
  notifyLoopReady() {
516
- this.resolveLoopReady();
521
+ this.notifyWorkspaceReady();
517
522
  }
518
523
  stop() {
519
524
  if (this.shutdownPromise) return this.shutdownPromise;
520
525
  this.stopped = true;
521
- this.resolveLoopReady();
526
+ this.resolveWorkspaceReady();
522
527
  this.abortController.abort();
523
528
  const backgroundTasks = [...this.backgroundTasks];
524
529
  const termination = this.terminateAllStartCommands();
@@ -549,7 +554,7 @@ var WorkspaceCommandSupervisor = class {
549
554
  });
550
555
  if (this.stopped) return;
551
556
  this.reportBootMilestoneFn("sidecars_ready");
552
- await this.loopReady;
557
+ await this.workspaceReady;
553
558
  if (this.stopped) return;
554
559
  await this.reportTurboCacheFn({
555
560
  onOutput: (stream, data) => this.forwardSetupOutput(stream, data)
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  WorkspaceCommandSupervisor,
8
8
  startWorkspaceCommandsAfterConnect,
9
9
  stopWorkspaceCommands
10
- } from "./chunk-DDECZOAT.js";
10
+ } from "./chunk-X2MKHJBZ.js";
11
11
  import {
12
12
  DEFAULT_SONNET_MODEL,
13
13
  PtyHarness,
@@ -27,13 +27,13 @@ import {
27
27
  resolveTuiKindFromEnv,
28
28
  runUsageProbe,
29
29
  sampleKeyUsage
30
- } from "./chunk-UP5CGWRY.js";
30
+ } from "./chunk-GAUVITY7.js";
31
31
  import "./chunk-SR66HQKB.js";
32
32
  import {
33
33
  inheritedEnv,
34
34
  resolvePtySpawn,
35
35
  sessionTempBase
36
- } from "./chunk-JG3VMWRQ.js";
36
+ } from "./chunk-QLMNQSJL.js";
37
37
  import {
38
38
  AgentConnection,
39
39
  CodespacePortVisibility,
@@ -44,12 +44,12 @@ import {
44
44
  createServiceLogger,
45
45
  fetchBootstrap,
46
46
  loadConveyorConfig
47
- } from "./chunk-YMZ6Q55T.js";
47
+ } from "./chunk-M4SD2ESQ.js";
48
48
  import "./chunk-GL2DIQEQ.js";
49
49
  import "./chunk-W4LZ7R6Z.js";
50
50
  import "./chunk-7P6QZHXZ.js";
51
51
  import "./chunk-IA45XHOA.js";
52
- import "./chunk-TOTCEWJD.js";
52
+ import "./chunk-B54XFOXL.js";
53
53
  import "./chunk-KMB3BU4S.js";
54
54
  import "./chunk-6Q6LQBWO.js";
55
55
 
@@ -462,7 +462,11 @@ var AdhocSessionRunner = class {
462
462
  return;
463
463
  }
464
464
  this.commandSupervisor.start();
465
- this.commandSupervisor.notifyLoopReady?.();
465
+ if (this.commandSupervisor.notifyWorkspaceReady) {
466
+ this.commandSupervisor.notifyWorkspaceReady();
467
+ } else {
468
+ this.commandSupervisor.notifyLoopReady?.();
469
+ }
466
470
  await this.connection.emitStatus("running");
467
471
  this.callbacks.onEvent?.({ type: "adhoc_runner_started", projectId: this.config.projectId });
468
472
  this.lifecycle.startIdleTimer();
@@ -1201,7 +1205,7 @@ function wireSpawnChildren(mode, connection, supervisors, logger7) {
1201
1205
 
1202
1206
  // src/cli.ts
1203
1207
  if (process.argv[2] === "boot") {
1204
- const { runBoot } = await import("./boot-V3DNJ3MV.js");
1208
+ const { runBoot } = await import("./boot-CCRZMY2P.js");
1205
1209
  process.exit(await runBoot(process.argv.slice(3)));
1206
1210
  }
1207
1211
  if (isLegacyEntrypointLaunch(process.env)) {
@@ -1303,7 +1307,7 @@ process.on("unhandledRejection", (reason) => {
1303
1307
  process.exit(1);
1304
1308
  });
1305
1309
  if (process.env.CONVEYOR_MODE === "workbench") {
1306
- const { startWorkbenchServer } = await import("./server-2IZBKD3Q.js");
1310
+ const { startWorkbenchServer } = await import("./server-WM23BC5C.js");
1307
1311
  const { oomWatchdogOptionsFromEnv } = await import("./oom-watchdog-PAC5OJJG.js");
1308
1312
  const { DEFAULT_WORKBENCH_PORT } = await import("./protocol-QBCYO4GI.js");
1309
1313
  const port = Number(process.env.CONVEYOR_WORKBENCH_PORT) || DEFAULT_WORKBENCH_PORT;
@@ -1454,7 +1458,7 @@ if (!RUNNER_MODES.includes(CONVEYOR_MODE)) {
1454
1458
  process.exit(1);
1455
1459
  }
1456
1460
  if (CONVEYOR_MODE === "serving") {
1457
- const { runServingSession } = await import("./serve-boot-FJSZE737.js");
1461
+ const { runServingSession } = await import("./serve-boot-VJR6J5PL.js");
1458
1462
  exitContext.runnerMode = "serving";
1459
1463
  exitContext.sessionId = process.env.CONVEYOR_SESSION_ID ?? exitContext.sessionId;
1460
1464
  const outcome = await runServingSession({
@@ -4,7 +4,7 @@ import {
4
4
  WorkbenchError,
5
5
  getWorkbenchClient,
6
6
  resetWorkbenchClient
7
- } from "./chunk-TOTCEWJD.js";
7
+ } from "./chunk-B54XFOXL.js";
8
8
  import "./chunk-KMB3BU4S.js";
9
9
  import "./chunk-6Q6LQBWO.js";
10
10
  export {
package/dist/index.d.ts CHANGED
@@ -683,11 +683,11 @@ interface SessionRunnerPortDiscovery {
683
683
  start(): Promise<void>;
684
684
  stop(): void;
685
685
  }
686
- /** Duck-typed handle onto the boot supervisor just enough surface for the
687
- * runner to release the app's start command once the core loop is live.
688
- * Avoids importing the concrete WorkspaceCommandSupervisor class here. */
686
+ /** Duck-typed handle onto the boot supervisor. The runner releases setup only
687
+ * after its task-branch checkout and WIP restore have made the workspace
688
+ * authoritative. Avoids importing the concrete supervisor here. */
689
689
  interface SessionRunnerWorkspaceCommands {
690
- notifyLoopReady(): void;
690
+ notifyWorkspaceReady(): void;
691
691
  }
692
692
  interface SessionRunnerDependencies {
693
693
  portDiscovery?: SessionRunnerPortDiscovery;
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  SessionRunner,
3
3
  unshallowRepo
4
- } from "./chunk-UP5CGWRY.js";
4
+ } from "./chunk-GAUVITY7.js";
5
5
  import "./chunk-SR66HQKB.js";
6
- import "./chunk-JG3VMWRQ.js";
6
+ import "./chunk-QLMNQSJL.js";
7
7
  import {
8
8
  AgentConnection,
9
9
  GIT_TIMEOUT_MS,
@@ -17,7 +17,7 @@ import {
17
17
  stageAndCommit,
18
18
  updateRemoteToken,
19
19
  workspacePathExists
20
- } from "./chunk-YMZ6Q55T.js";
20
+ } from "./chunk-M4SD2ESQ.js";
21
21
  import "./chunk-GL2DIQEQ.js";
22
22
  import {
23
23
  runAuthTokenCommand,
@@ -28,7 +28,7 @@ import "./chunk-7P6QZHXZ.js";
28
28
  import "./chunk-IA45XHOA.js";
29
29
  import {
30
30
  getWorkbenchClient
31
- } from "./chunk-TOTCEWJD.js";
31
+ } from "./chunk-B54XFOXL.js";
32
32
  import {
33
33
  workbenchEnabled
34
34
  } from "./chunk-KMB3BU4S.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WorkspaceCommandSupervisor
3
- } from "./chunk-DDECZOAT.js";
3
+ } from "./chunk-X2MKHJBZ.js";
4
4
  import {
5
5
  AgentConnection,
6
6
  CodespacePortVisibility,
@@ -11,11 +11,11 @@ import {
11
11
  createServiceLogger,
12
12
  ensureOnTaskBranch,
13
13
  loadConveyorConfig
14
- } from "./chunk-YMZ6Q55T.js";
14
+ } from "./chunk-M4SD2ESQ.js";
15
15
  import "./chunk-GL2DIQEQ.js";
16
16
  import "./chunk-W4LZ7R6Z.js";
17
17
  import "./chunk-IA45XHOA.js";
18
- import "./chunk-TOTCEWJD.js";
18
+ import "./chunk-B54XFOXL.js";
19
19
  import "./chunk-KMB3BU4S.js";
20
20
  import "./chunk-6Q6LQBWO.js";
21
21
 
@@ -123,7 +123,11 @@ var ServeSessionRunner = class {
123
123
  );
124
124
  }
125
125
  this.commandSupervisor.start();
126
- this.commandSupervisor.notifyLoopReady?.();
126
+ if (this.commandSupervisor.notifyWorkspaceReady) {
127
+ this.commandSupervisor.notifyWorkspaceReady();
128
+ } else {
129
+ this.commandSupervisor.notifyLoopReady?.();
130
+ }
127
131
  await this.connection.emitStatus("idle");
128
132
  this.callbacks.onEvent?.({ type: "serve_runner_started", taskId: this.config.taskId });
129
133
  await this.waitUntilStopped();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  startWorkbenchServer
3
- } from "./chunk-IBAIJY7V.js";
4
- import "./chunk-JG3VMWRQ.js";
3
+ } from "./chunk-7TSQXIN3.js";
4
+ import "./chunk-QLMNQSJL.js";
5
5
  import "./chunk-W4LZ7R6Z.js";
6
6
  import "./chunk-6Q6LQBWO.js";
7
7
  import "./chunk-6W6UZ4SJ.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rallycry/conveyor-agent",
3
- "version": "11.0.15",
3
+ "version": "11.0.16",
4
4
  "description": "Conveyor Agent Runner v10 - PTY harness for the task chat (SDK harness for audit/project-chat). Agent-as-User architecture with BaseService patterns. Works locally too.",
5
5
  "keywords": [
6
6
  "agent",