agent-board-runner 0.1.22 → 0.1.23

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/cli.js CHANGED
@@ -4392,7 +4392,11 @@ async function openWorkflowShell(supabase, config, payload) {
4392
4392
  }
4393
4393
  );
4394
4394
  registerPtySession(executionId, pty, shellTicket);
4395
- pty.onExit(({ exitCode }) => void handleWorkflowShellExit(supabase, executionId, exitCode));
4395
+ const activityWatcher = watchWorkflowShellActivity(supabase, executionId, pty);
4396
+ pty.onExit(({ exitCode }) => {
4397
+ activityWatcher.stop();
4398
+ void handleWorkflowShellExit(supabase, executionId, exitCode);
4399
+ });
4396
4400
  waitForIdleThenRun(pty, () => {
4397
4401
  try {
4398
4402
  writePasteAndSubmit(pty, executionId, instructions, "the workflow runbook", logger.runner);
@@ -4402,14 +4406,27 @@ async function openWorkflowShell(supabase, config, payload) {
4402
4406
  });
4403
4407
  return { claudeSessionId, shellTicket };
4404
4408
  }
4405
- async function handleWorkflowShellExit(supabase, executionId, exitCode) {
4406
- const status = exitCode === 0 ? "done" : "failed";
4409
+ async function completeWorkflowExecution(supabase, executionId, status) {
4407
4410
  const summary = getPtySession(executionId)?.lastAssistantMessage ?? null;
4408
4411
  const { error } = await supabase.rpc("complete_workflow_execution", { p_execution_id: executionId, p_status: status, p_summary: summary });
4409
4412
  if (error) {
4410
- logger.runner.error("WORKFLOW_SHELL", `Failed to record exit status for workflow execution ${executionId}:`, error);
4413
+ logger.runner.error("WORKFLOW_SHELL", `Failed to record ${status} status for workflow execution ${executionId}:`, error);
4411
4414
  }
4412
4415
  }
4416
+ async function handleWorkflowShellExit(supabase, executionId, exitCode) {
4417
+ unregisterAgentActivityWatcher(executionId);
4418
+ await completeWorkflowExecution(supabase, executionId, exitCode === 0 ? "done" : "failed");
4419
+ }
4420
+ function watchWorkflowShellActivity(supabase, executionId, pty) {
4421
+ const watcher = new AgentActivityWatcher((state) => {
4422
+ if (state === "done" || state === "waiting_user") {
4423
+ void completeWorkflowExecution(supabase, executionId, "done");
4424
+ }
4425
+ });
4426
+ pty.onData((chunk) => watcher.push(chunk));
4427
+ registerAgentActivityWatcher(executionId, watcher);
4428
+ return watcher;
4429
+ }
4413
4430
  async function reconcileOrphanedWorkflowExecutions(supabase, config) {
4414
4431
  const { data, error } = await supabase.from("workflow_executions").select("id, project_id, claude_session_id, shell_ticket").eq("runner_id", config.runnerId).in("status", ["running", "paused_on_question"]);
4415
4432
  if (error) {
@@ -4430,7 +4447,11 @@ async function reconcileOrphanedWorkflowExecutions(supabase, config) {
4430
4447
  }
4431
4448
  const pty = resumeAgentPty(registered.repoPath, claudeSessionId, executionId, shellTicket);
4432
4449
  registerPtySession(executionId, pty, shellTicket);
4433
- pty.onExit(({ exitCode }) => void handleWorkflowShellExit(supabase, executionId, exitCode));
4450
+ const activityWatcher = watchWorkflowShellActivity(supabase, executionId, pty);
4451
+ pty.onExit(({ exitCode }) => {
4452
+ activityWatcher.stop();
4453
+ void handleWorkflowShellExit(supabase, executionId, exitCode);
4454
+ });
4434
4455
  logger.runner.info("WORKFLOW_SHELL", `Re-spawned orphaned workflow execution ${executionId} (runner restarted while it was still active).`);
4435
4456
  }
4436
4457
  }
package/dist/index.js CHANGED
@@ -4280,7 +4280,11 @@ async function openWorkflowShell(supabase, config, payload) {
4280
4280
  }
4281
4281
  );
4282
4282
  registerPtySession(executionId, pty, shellTicket);
4283
- pty.onExit(({ exitCode }) => void handleWorkflowShellExit(supabase, executionId, exitCode));
4283
+ const activityWatcher = watchWorkflowShellActivity(supabase, executionId, pty);
4284
+ pty.onExit(({ exitCode }) => {
4285
+ activityWatcher.stop();
4286
+ void handleWorkflowShellExit(supabase, executionId, exitCode);
4287
+ });
4284
4288
  waitForIdleThenRun(pty, () => {
4285
4289
  try {
4286
4290
  writePasteAndSubmit(pty, executionId, instructions, "the workflow runbook", logger.runner);
@@ -4290,14 +4294,27 @@ async function openWorkflowShell(supabase, config, payload) {
4290
4294
  });
4291
4295
  return { claudeSessionId, shellTicket };
4292
4296
  }
4293
- async function handleWorkflowShellExit(supabase, executionId, exitCode) {
4294
- const status = exitCode === 0 ? "done" : "failed";
4297
+ async function completeWorkflowExecution(supabase, executionId, status) {
4295
4298
  const summary = getPtySession(executionId)?.lastAssistantMessage ?? null;
4296
4299
  const { error } = await supabase.rpc("complete_workflow_execution", { p_execution_id: executionId, p_status: status, p_summary: summary });
4297
4300
  if (error) {
4298
- logger.runner.error("WORKFLOW_SHELL", `Failed to record exit status for workflow execution ${executionId}:`, error);
4301
+ logger.runner.error("WORKFLOW_SHELL", `Failed to record ${status} status for workflow execution ${executionId}:`, error);
4299
4302
  }
4300
4303
  }
4304
+ async function handleWorkflowShellExit(supabase, executionId, exitCode) {
4305
+ unregisterAgentActivityWatcher(executionId);
4306
+ await completeWorkflowExecution(supabase, executionId, exitCode === 0 ? "done" : "failed");
4307
+ }
4308
+ function watchWorkflowShellActivity(supabase, executionId, pty) {
4309
+ const watcher = new AgentActivityWatcher((state) => {
4310
+ if (state === "done" || state === "waiting_user") {
4311
+ void completeWorkflowExecution(supabase, executionId, "done");
4312
+ }
4313
+ });
4314
+ pty.onData((chunk) => watcher.push(chunk));
4315
+ registerAgentActivityWatcher(executionId, watcher);
4316
+ return watcher;
4317
+ }
4301
4318
  async function reconcileOrphanedWorkflowExecutions(supabase, config) {
4302
4319
  const { data, error } = await supabase.from("workflow_executions").select("id, project_id, claude_session_id, shell_ticket").eq("runner_id", config.runnerId).in("status", ["running", "paused_on_question"]);
4303
4320
  if (error) {
@@ -4318,7 +4335,11 @@ async function reconcileOrphanedWorkflowExecutions(supabase, config) {
4318
4335
  }
4319
4336
  const pty = resumeAgentPty(registered.repoPath, claudeSessionId, executionId, shellTicket);
4320
4337
  registerPtySession(executionId, pty, shellTicket);
4321
- pty.onExit(({ exitCode }) => void handleWorkflowShellExit(supabase, executionId, exitCode));
4338
+ const activityWatcher = watchWorkflowShellActivity(supabase, executionId, pty);
4339
+ pty.onExit(({ exitCode }) => {
4340
+ activityWatcher.stop();
4341
+ void handleWorkflowShellExit(supabase, executionId, exitCode);
4342
+ });
4322
4343
  logger.runner.info("WORKFLOW_SHELL", `Re-spawned orphaned workflow execution ${executionId} (runner restarted while it was still active).`);
4323
4344
  }
4324
4345
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-board-runner",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Local runner for Agent Board — signs in with your own Supabase account (no shared secrets) and drives Claude Code against repos under your local repos root.",
5
5
  "type": "module",
6
6
  "bin": {