agent-relay-runner 0.10.0 → 0.10.2

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.0",
3
+ "version": "0.10.2",
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.0"
4
+ "version": "0.10.2"
5
5
  }
package/src/runner.ts CHANGED
@@ -88,9 +88,10 @@ export class AgentRunner {
88
88
  }
89
89
 
90
90
  async stop(): Promise<void> {
91
+ const alreadyStopped = this.stopped;
91
92
  this.stopped = true;
92
- await this.bus.statusAsync({ agentStatus: "offline", ready: false });
93
- if (this.process) {
93
+ if (!alreadyStopped) await this.bus.statusAsync({ agentStatus: "offline", ready: false });
94
+ if (this.process && !alreadyStopped) {
94
95
  await this.options.adapter.shutdown(this.process, {
95
96
  graceful: true,
96
97
  timeoutMs: this.options.providerConfig.headless.shutdownTimeoutMs,
@@ -183,7 +184,7 @@ export class AgentRunner {
183
184
  await this.updateCommand(commandId, "failed", undefined, error instanceof Error ? error.message : String(error));
184
185
  } finally {
185
186
  this.claims.finishClaim("command", commandId);
186
- this.publishStatus();
187
+ if (!this.stopped) this.publishStatus();
187
188
  }
188
189
  }
189
190
 
@@ -225,12 +226,14 @@ export class AgentRunner {
225
226
 
226
227
  private publishStatus(): void {
227
228
  const status = this.claims.currentStatus();
229
+ const agentStatus = runnerAgentStatus(status);
228
230
  this.bus.setSemanticStatus(status === "offline" || status === "error" ? "idle" : status);
229
231
  this.bus.status({
230
- agentStatus: status,
231
- ready: status !== "offline" && !this.stopped,
232
+ agentStatus,
233
+ ready: agentStatus !== "offline" && !this.stopped,
232
234
  meta: {
233
235
  runnerId: this.options.runnerId,
236
+ ...(status === "error" ? { terminalStatus: "error" } : {}),
234
237
  busyReasons: this.claims.reasons(),
235
238
  transport: this.bus.transportState,
236
239
  },
@@ -264,6 +267,10 @@ function relayBusUrl(relayUrl: string): string {
264
267
  return url.toString();
265
268
  }
266
269
 
270
+ export function runnerAgentStatus(status: "idle" | "busy" | "offline" | "error"): "idle" | "busy" | "offline" {
271
+ return status === "error" ? "offline" : status;
272
+ }
273
+
267
274
  function lifecycleCapabilities(): Record<string, true> {
268
275
  return {
269
276
  shutdownHard: true,