agent-relay-runner 0.127.4 → 0.127.6

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.
@@ -12,6 +12,7 @@ import { assembleLaunch } from "./launch-assembly";
12
12
  const MAX_TIMER_DELAY_MS = 2_147_483_647;
13
13
  const LOG_TAIL_BYTES = 128 * 1024;
14
14
  const RUNNER_CLAIMED_GUIDANCE_RE = /\s*Claim this task before working it, then update task status when finished\.\s*$/;
15
+ const PROVIDER_DISPLAY_NAMES: Record<string, string> = { claude: "Claude", codex: "Codex" };
15
16
 
16
17
  interface RuntimeProviderOptions {
17
18
  provider: string;
@@ -234,6 +235,40 @@ export function providerExitDiagnostics(input: {
234
235
  };
235
236
  }
236
237
 
238
+ export function providerExitResumeId(diagnostics: Record<string, unknown>): string | undefined {
239
+ const value = diagnostics.claudeResumeId;
240
+ return typeof value === "string" && value.length > 0 ? value : undefined;
241
+ }
242
+
243
+ export function providerManualRecoveryReason(diagnostics: Record<string, unknown>): string {
244
+ return providerExitResumeId(diagnostics)
245
+ ? "claude-exit-manual-resume-available"
246
+ : "claude-exit-manual-intervention-required";
247
+ }
248
+
249
+ export function providerDisplayName(provider: string): string {
250
+ return PROVIDER_DISPLAY_NAMES[provider] ?? provider;
251
+ }
252
+
253
+ export function providerMonitorUnavailableMessage(provider: string): string {
254
+ return `no ${providerDisplayName(provider)} monitor connected`;
255
+ }
256
+
257
+ export function providerManualRecoveryMessage(provider: string, diagnostics: Record<string, unknown>): string {
258
+ const displayName = providerDisplayName(provider);
259
+ return providerExitResumeId(diagnostics)
260
+ ? `${displayName} exited; runner will not auto-resume. Resume id captured for manual recovery.`
261
+ : `${displayName} exited; runner will not restart automatically.`;
262
+ }
263
+
264
+ export function providerExitLastError(provider: string, marker: Record<string, unknown>): string {
265
+ const resumeId = providerExitResumeId(marker);
266
+ const displayName = providerDisplayName(provider);
267
+ return resumeId
268
+ ? `${displayName} provider exited; resume id ${resumeId} captured for manual recovery`
269
+ : `${displayName} provider exited; manual intervention required`;
270
+ }
271
+
237
272
  export function commandTimeoutMs(params: Record<string, unknown>, fallback = 10_000): number {
238
273
  const raw = params.timeoutMs;
239
274
  if (typeof raw !== "number" || !Number.isSafeInteger(raw) || raw <= 0) return fallback;
@@ -242,7 +277,7 @@ export function commandTimeoutMs(params: Record<string, unknown>, fallback = 10_
242
277
 
243
278
  export function shouldLogDeliveryFailure(error: unknown): boolean {
244
279
  const message = errMessage(error);
245
- return message !== "no Claude monitor connected";
280
+ return message !== providerMonitorUnavailableMessage("claude");
246
281
  }
247
282
 
248
283
  export function runtimeTokenRenewDelayMs(expiresAtSeconds: number, nowMs = Date.now()): number | undefined {