agent-relay-runner 0.10.3 → 0.10.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-runner",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "description": "Unified provider lifecycle runner for Agent Relay",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "agent-relay-runner",
3
3
  "description": "Thin Agent Relay runner bridge for Claude Code",
4
- "version": "0.10.3"
4
+ "version": "0.10.4"
5
5
  }
package/src/runner.ts CHANGED
@@ -82,6 +82,7 @@ export class AgentRunner {
82
82
  this.bus.on("command", (type, params, commandId, command) => {
83
83
  void this.handleCommand(type, params, commandId, command);
84
84
  });
85
+ this.bus.on("error", (code, message) => this.handleBusError(String(code), String(message)));
85
86
  await this.bus.connect();
86
87
  this.process = await this.spawnProvider();
87
88
  this.publishStatus();
@@ -217,6 +218,17 @@ export class AgentRunner {
217
218
  await this.bus.updateCommand(commandId, { status, ...(result ? { result } : {}), ...(error ? { error } : {}) });
218
219
  }
219
220
 
221
+ private handleBusError(code: string, message: string): void {
222
+ const action = runnerBusErrorAction(code, this.stopped);
223
+ if (action === "ignore") return;
224
+ console.error(`[runner] bus error ${code}: ${message}`);
225
+ if (action === "stop") {
226
+ void this.stop().catch((error) => {
227
+ console.error(`[runner] stop after bus error failed: ${error}`);
228
+ }).finally(() => process.exit(0));
229
+ }
230
+ }
231
+
220
232
  private setProviderStatus(status: SemanticStatus): void {
221
233
  if (status === "busy") this.claims.setProviderBusy(true);
222
234
  else if (status === "idle") this.claims.setProviderBusy(false);
@@ -271,6 +283,11 @@ export function runnerAgentStatus(status: "idle" | "busy" | "offline" | "error")
271
283
  return status === "error" ? "offline" : status;
272
284
  }
273
285
 
286
+ export function runnerBusErrorAction(code: string, stopped: boolean): "ignore" | "log" | "stop" {
287
+ if (code === "STALE_SESSION") return stopped ? "ignore" : "stop";
288
+ return "log";
289
+ }
290
+
274
291
  function lifecycleCapabilities(): Record<string, true> {
275
292
  return {
276
293
  shutdownHard: true,