agent-relay 4.0.30 → 4.0.32

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.
Files changed (158) hide show
  1. package/README.md +88 -48
  2. package/bin/agent-relay-broker-darwin-arm64 +0 -0
  3. package/bin/agent-relay-broker-darwin-x64 +0 -0
  4. package/bin/agent-relay-broker-linux-arm64 +0 -0
  5. package/bin/agent-relay-broker-linux-x64 +0 -0
  6. package/dist/index.cjs +309 -129
  7. package/dist/src/cli/bootstrap.d.ts +2 -1
  8. package/dist/src/cli/bootstrap.d.ts.map +1 -1
  9. package/dist/src/cli/bootstrap.js +223 -17
  10. package/dist/src/cli/bootstrap.js.map +1 -1
  11. package/dist/src/cli/commands/agent-management.d.ts.map +1 -1
  12. package/dist/src/cli/commands/agent-management.js +1 -3
  13. package/dist/src/cli/commands/agent-management.js.map +1 -1
  14. package/dist/src/cli/commands/auth.d.ts.map +1 -1
  15. package/dist/src/cli/commands/auth.js +32 -3
  16. package/dist/src/cli/commands/auth.js.map +1 -1
  17. package/dist/src/cli/commands/cloud.d.ts.map +1 -1
  18. package/dist/src/cli/commands/cloud.js +242 -144
  19. package/dist/src/cli/commands/cloud.js.map +1 -1
  20. package/dist/src/cli/commands/core.d.ts.map +1 -1
  21. package/dist/src/cli/commands/core.js +11 -6
  22. package/dist/src/cli/commands/core.js.map +1 -1
  23. package/dist/src/cli/commands/messaging.d.ts.map +1 -1
  24. package/dist/src/cli/commands/messaging.js +1 -3
  25. package/dist/src/cli/commands/messaging.js.map +1 -1
  26. package/dist/src/cli/commands/monitoring.d.ts.map +1 -1
  27. package/dist/src/cli/commands/monitoring.js +5 -4
  28. package/dist/src/cli/commands/monitoring.js.map +1 -1
  29. package/dist/src/cli/commands/on.d.ts.map +1 -1
  30. package/dist/src/cli/commands/on.js +1 -3
  31. package/dist/src/cli/commands/on.js.map +1 -1
  32. package/dist/src/cli/commands/setup.d.ts.map +1 -1
  33. package/dist/src/cli/commands/setup.js +62 -7
  34. package/dist/src/cli/commands/setup.js.map +1 -1
  35. package/dist/src/cli/commands/swarm.d.ts.map +1 -1
  36. package/dist/src/cli/commands/swarm.js +34 -4
  37. package/dist/src/cli/commands/swarm.js.map +1 -1
  38. package/dist/src/cli/index.js +9 -1
  39. package/dist/src/cli/index.js.map +1 -1
  40. package/dist/src/cli/lib/exit.d.ts +49 -0
  41. package/dist/src/cli/lib/exit.d.ts.map +1 -0
  42. package/dist/src/cli/lib/exit.js +73 -0
  43. package/dist/src/cli/lib/exit.js.map +1 -0
  44. package/dist/src/cli/lib/telemetry-helpers.d.ts +20 -0
  45. package/dist/src/cli/lib/telemetry-helpers.d.ts.map +1 -0
  46. package/dist/src/cli/lib/telemetry-helpers.js +31 -0
  47. package/dist/src/cli/lib/telemetry-helpers.js.map +1 -0
  48. package/node_modules/@agent-relay/cloud/package.json +2 -2
  49. package/node_modules/@agent-relay/config/package.json +1 -1
  50. package/node_modules/@agent-relay/hooks/package.json +4 -4
  51. package/node_modules/@agent-relay/sdk/README.md +3 -0
  52. package/node_modules/@agent-relay/sdk/dist/relay.d.ts +16 -0
  53. package/node_modules/@agent-relay/sdk/dist/relay.d.ts.map +1 -1
  54. package/node_modules/@agent-relay/sdk/dist/relay.js +83 -0
  55. package/node_modules/@agent-relay/sdk/dist/relay.js.map +1 -1
  56. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.d.ts +62 -12
  57. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.d.ts.map +1 -1
  58. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.js +137 -47
  59. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.js.map +1 -1
  60. package/node_modules/@agent-relay/sdk/package.json +2 -2
  61. package/node_modules/@agent-relay/telemetry/dist/client.d.ts +14 -2
  62. package/node_modules/@agent-relay/telemetry/dist/client.d.ts.map +1 -1
  63. package/node_modules/@agent-relay/telemetry/dist/client.js +22 -4
  64. package/node_modules/@agent-relay/telemetry/dist/client.js.map +1 -1
  65. package/node_modules/@agent-relay/telemetry/dist/events.d.ts +217 -10
  66. package/node_modules/@agent-relay/telemetry/dist/events.d.ts.map +1 -1
  67. package/node_modules/@agent-relay/telemetry/dist/events.js +11 -0
  68. package/node_modules/@agent-relay/telemetry/dist/events.js.map +1 -1
  69. package/node_modules/@agent-relay/telemetry/dist/index.d.ts +2 -2
  70. package/node_modules/@agent-relay/telemetry/dist/index.d.ts.map +1 -1
  71. package/node_modules/@agent-relay/telemetry/dist/index.js.map +1 -1
  72. package/node_modules/@agent-relay/telemetry/package.json +2 -2
  73. package/node_modules/@agent-relay/trajectory/package.json +2 -2
  74. package/node_modules/@agent-relay/user-directory/package.json +2 -2
  75. package/node_modules/@agent-relay/utils/package.json +2 -2
  76. package/node_modules/@relaycast/sdk/dist/version.d.ts +1 -1
  77. package/node_modules/@relaycast/sdk/dist/version.js +1 -1
  78. package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/package.json +1 -1
  79. package/node_modules/@relaycast/sdk/package.json +2 -2
  80. package/node_modules/agent-trajectories/dist/{chunk-2XT3DOJC.js → chunk-27AQPWHK.js} +136 -72
  81. package/node_modules/agent-trajectories/dist/chunk-27AQPWHK.js.map +1 -0
  82. package/node_modules/agent-trajectories/dist/cli/index.js +135 -71
  83. package/node_modules/agent-trajectories/dist/cli/index.js.map +1 -1
  84. package/node_modules/agent-trajectories/dist/{index-thTh5iI8.d.ts → index-C7XhwsoN.d.ts} +24 -0
  85. package/node_modules/agent-trajectories/dist/index.d.ts +2 -2
  86. package/node_modules/agent-trajectories/dist/index.js +1 -1
  87. package/node_modules/agent-trajectories/dist/sdk/index.d.ts +1 -1
  88. package/node_modules/agent-trajectories/dist/sdk/index.js +1 -1
  89. package/node_modules/agent-trajectories/package.json +1 -1
  90. package/node_modules/axios/CHANGELOG.md +166 -0
  91. package/node_modules/axios/README.md +210 -204
  92. package/node_modules/axios/dist/axios.js +92 -63
  93. package/node_modules/axios/dist/axios.js.map +1 -1
  94. package/node_modules/axios/dist/axios.min.js +2 -2
  95. package/node_modules/axios/dist/axios.min.js.map +1 -1
  96. package/node_modules/axios/dist/browser/axios.cjs +140 -101
  97. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  98. package/node_modules/axios/dist/esm/axios.js +140 -101
  99. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  100. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  101. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  102. package/node_modules/axios/dist/node/axios.cjs +199 -75
  103. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  104. package/node_modules/axios/index.d.cts +14 -28
  105. package/node_modules/axios/index.d.ts +132 -226
  106. package/node_modules/axios/lib/adapters/fetch.js +21 -6
  107. package/node_modules/axios/lib/adapters/http.js +88 -6
  108. package/node_modules/axios/lib/core/AxiosError.js +34 -33
  109. package/node_modules/axios/lib/core/AxiosHeaders.js +24 -25
  110. package/node_modules/axios/lib/core/buildFullPath.js +1 -1
  111. package/node_modules/axios/lib/core/mergeConfig.js +5 -3
  112. package/node_modules/axios/lib/defaults/index.js +13 -8
  113. package/node_modules/axios/lib/env/data.js +1 -1
  114. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -2
  115. package/node_modules/axios/lib/helpers/formDataToJSON.js +3 -1
  116. package/node_modules/axios/lib/helpers/formDataToStream.js +2 -1
  117. package/node_modules/axios/lib/helpers/progressEventReducer.js +5 -5
  118. package/node_modules/axios/lib/helpers/resolveConfig.js +11 -3
  119. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +48 -1
  120. package/node_modules/axios/lib/helpers/toFormData.js +10 -2
  121. package/node_modules/axios/lib/utils.js +10 -10
  122. package/node_modules/axios/package.json +4 -4
  123. package/package.json +9 -9
  124. package/packages/cloud/package.json +2 -2
  125. package/packages/config/package.json +1 -1
  126. package/packages/hooks/package.json +4 -4
  127. package/packages/sdk/README.md +3 -0
  128. package/packages/sdk/dist/relay.d.ts +16 -0
  129. package/packages/sdk/dist/relay.d.ts.map +1 -1
  130. package/packages/sdk/dist/relay.js +83 -0
  131. package/packages/sdk/dist/relay.js.map +1 -1
  132. package/packages/sdk/dist/workflows/file-db.d.ts +62 -12
  133. package/packages/sdk/dist/workflows/file-db.d.ts.map +1 -1
  134. package/packages/sdk/dist/workflows/file-db.js +137 -47
  135. package/packages/sdk/dist/workflows/file-db.js.map +1 -1
  136. package/packages/sdk/package.json +2 -2
  137. package/packages/telemetry/dist/client.d.ts +14 -2
  138. package/packages/telemetry/dist/client.d.ts.map +1 -1
  139. package/packages/telemetry/dist/client.js +22 -4
  140. package/packages/telemetry/dist/client.js.map +1 -1
  141. package/packages/telemetry/dist/events.d.ts +217 -10
  142. package/packages/telemetry/dist/events.d.ts.map +1 -1
  143. package/packages/telemetry/dist/events.js +11 -0
  144. package/packages/telemetry/dist/events.js.map +1 -1
  145. package/packages/telemetry/dist/index.d.ts +2 -2
  146. package/packages/telemetry/dist/index.d.ts.map +1 -1
  147. package/packages/telemetry/dist/index.js.map +1 -1
  148. package/packages/telemetry/package.json +2 -2
  149. package/packages/trajectory/package.json +2 -2
  150. package/packages/user-directory/package.json +2 -2
  151. package/packages/utils/package.json +2 -2
  152. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/index.d.ts +0 -12
  153. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/index.js +0 -17
  154. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/license +0 -9
  155. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/package.json +0 -43
  156. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/readme.md +0 -35
  157. package/node_modules/agent-trajectories/dist/chunk-2XT3DOJC.js.map +0 -1
  158. package/node_modules/color-convert/CHANGELOG.md +0 -54
package/dist/index.cjs CHANGED
@@ -4779,7 +4779,7 @@ var require_has_flag = __commonJS({
4779
4779
  var require_supports_color = __commonJS({
4780
4780
  "node_modules/supports-color/index.js"(exports2, module2) {
4781
4781
  "use strict";
4782
- var os11 = require("os");
4782
+ var os12 = require("os");
4783
4783
  var tty = require("tty");
4784
4784
  var hasFlag = require_has_flag();
4785
4785
  var { env } = process;
@@ -4827,7 +4827,7 @@ var require_supports_color = __commonJS({
4827
4827
  return min;
4828
4828
  }
4829
4829
  if (process.platform === "win32") {
4830
- const osRelease = os11.release().split(".");
4830
+ const osRelease = os12.release().split(".");
4831
4831
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
4832
4832
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
4833
4833
  }
@@ -13391,11 +13391,11 @@ __export(base_exports, {
13391
13391
  setCwd: () => setCwd,
13392
13392
  synchronizedOutput: () => synchronizedOutput
13393
13393
  });
13394
- var import_node_process, import_node_os9, ESC, OSC, BEL, SEP, isTerminalApp, isWindows2, isTmux, cwdFunction, wrapOsc, cursorTo, cursorMove, cursorUp, cursorDown, cursorForward, cursorBackward, cursorLeft, cursorSavePosition, cursorRestorePosition, cursorGetPosition, cursorNextLine, cursorPrevLine, cursorHide, cursorShow, eraseLines, eraseEndLine, eraseStartLine, eraseLine, eraseDown, eraseUp, eraseScreen, scrollUp, scrollDown, clearScreen, clearViewport, isOldWindows, clearTerminal, enterAlternativeScreen, exitAlternativeScreen, beginSynchronizedOutput, endSynchronizedOutput, synchronizedOutput, beep, link, image, iTerm, ConEmu, setCwd;
13394
+ var import_node_process, import_node_os10, ESC, OSC, BEL, SEP, isTerminalApp, isWindows2, isTmux, cwdFunction, wrapOsc, cursorTo, cursorMove, cursorUp, cursorDown, cursorForward, cursorBackward, cursorLeft, cursorSavePosition, cursorRestorePosition, cursorGetPosition, cursorNextLine, cursorPrevLine, cursorHide, cursorShow, eraseLines, eraseEndLine, eraseStartLine, eraseLine, eraseDown, eraseUp, eraseScreen, scrollUp, scrollDown, clearScreen, clearViewport, isOldWindows, clearTerminal, enterAlternativeScreen, exitAlternativeScreen, beginSynchronizedOutput, endSynchronizedOutput, synchronizedOutput, beep, link, image, iTerm, ConEmu, setCwd;
13395
13395
  var init_base = __esm({
13396
13396
  "node_modules/ansi-escapes/base.js"() {
13397
13397
  import_node_process = __toESM(require("node:process"), 1);
13398
- import_node_os9 = __toESM(require("node:os"), 1);
13398
+ import_node_os10 = __toESM(require("node:os"), 1);
13399
13399
  init_environment();
13400
13400
  ESC = "\x1B[";
13401
13401
  OSC = "\x1B]";
@@ -13475,7 +13475,7 @@ var init_base = __esm({
13475
13475
  if (isBrowser || !isWindows2) {
13476
13476
  return false;
13477
13477
  }
13478
- const parts = import_node_os9.default.release().split(".");
13478
+ const parts = import_node_os10.default.release().split(".");
13479
13479
  const major = Number(parts[0]);
13480
13480
  const build = Number(parts[2] ?? 0);
13481
13481
  if (major < 10) {
@@ -16708,7 +16708,7 @@ function delay2(time3) {
16708
16708
  setTimeout(resolve4, time3);
16709
16709
  });
16710
16710
  }
16711
- var import_node_util3, import_util6, import_os, import_string_decoder, import_stream2, import_rfdc, import_crypto2, ANSI_ESCAPE2, ANSI_ESCAPE_CODES, ListrEnvironmentVariables, ListrErrorTypes, ListrEventType, ListrRendererSelection, ListrTaskEventType, ListrTaskState, EventManager, BaseEventMap, CLEAR_LINE_REGEX, BELL_REGEX, color, FIGURES_MAIN, FIGURES_FALLBACK, figures, ListrLogLevels, LISTR_LOGGER_STYLE, LISTR_LOGGER_STDERR_LEVELS, ListrLogger, ProcessOutputBuffer, ProcessOutputStream, ProcessOutput, ListrPromptAdapter, Spinner, ListrDefaultRendererLogLevels, LISTR_DEFAULT_RENDERER_STYLE, PRESET_TIMER, PRESET_TIMESTAMP, DefaultRenderer, SilentRenderer, SimpleRenderer, TestRendererSerializer, TestRenderer, VerboseRenderer, RENDERERS, clone2, Concurrency, ListrError, ListrRendererError, PromptError, TaskWrapper, ListrTaskEventManager, Task, ListrEventManager, Listr;
16711
+ var import_node_util3, import_util6, import_os, import_string_decoder, import_stream2, import_rfdc, import_crypto3, ANSI_ESCAPE2, ANSI_ESCAPE_CODES, ListrEnvironmentVariables, ListrErrorTypes, ListrEventType, ListrRendererSelection, ListrTaskEventType, ListrTaskState, EventManager, BaseEventMap, CLEAR_LINE_REGEX, BELL_REGEX, color, FIGURES_MAIN, FIGURES_FALLBACK, figures, ListrLogLevels, LISTR_LOGGER_STYLE, LISTR_LOGGER_STDERR_LEVELS, ListrLogger, ProcessOutputBuffer, ProcessOutputStream, ProcessOutput, ListrPromptAdapter, Spinner, ListrDefaultRendererLogLevels, LISTR_DEFAULT_RENDERER_STYLE, PRESET_TIMER, PRESET_TIMESTAMP, DefaultRenderer, SilentRenderer, SimpleRenderer, TestRendererSerializer, TestRenderer, VerboseRenderer, RENDERERS, clone2, Concurrency, ListrError, ListrRendererError, PromptError, TaskWrapper, ListrTaskEventManager, Task, ListrEventManager, Listr;
16712
16712
  var init_dist = __esm({
16713
16713
  "node_modules/listr2/dist/index.mjs"() {
16714
16714
  init_eventemitter3();
@@ -16718,7 +16718,7 @@ var init_dist = __esm({
16718
16718
  import_string_decoder = require("string_decoder");
16719
16719
  import_stream2 = require("stream");
16720
16720
  import_rfdc = __toESM(require_rfdc(), 1);
16721
- import_crypto2 = require("crypto");
16721
+ import_crypto3 = require("crypto");
16722
16722
  ANSI_ESCAPE2 = "\x1B[";
16723
16723
  ANSI_ESCAPE_CODES = {
16724
16724
  CURSOR_HIDE: ANSI_ESCAPE2 + "?25l",
@@ -18049,7 +18049,7 @@ var init_dist = __esm({
18049
18049
  };
18050
18050
  Task = class extends ListrTaskEventManager {
18051
18051
  /** Unique id per task, can be used for identifying a Task. */
18052
- id = (0, import_crypto2.randomUUID)();
18052
+ id = (0, import_crypto3.randomUUID)();
18053
18053
  /** The current state of the task. */
18054
18054
  state = ListrTaskState.WAITING;
18055
18055
  /** Subtasks of the current task. */
@@ -27314,7 +27314,7 @@ var DefaultModels = {
27314
27314
  };
27315
27315
 
27316
27316
  // node_modules/@relaycast/sdk/dist/version.js
27317
- var SDK_VERSION = "1.1.2";
27317
+ var SDK_VERSION = "1.1.3";
27318
27318
 
27319
27319
  // node_modules/@relaycast/sdk/node_modules/zod/v4/classic/external.js
27320
27320
  var external_exports2 = {};
@@ -43582,6 +43582,7 @@ var AgentRelay = class {
43582
43582
  onDeliveryUpdate = null;
43583
43583
  onAgentExitRequested = null;
43584
43584
  onAgentIdle = null;
43585
+ onAgentActivityChanged = null;
43585
43586
  onChannelSubscribed = null;
43586
43587
  onChannelUnsubscribed = null;
43587
43588
  // ── Public accessors ────────────────────────────────────────────────────
@@ -43617,6 +43618,7 @@ var AgentRelay = class {
43617
43618
  exitedAgents = /* @__PURE__ */ new Set();
43618
43619
  idleAgents = /* @__PURE__ */ new Set();
43619
43620
  deliveryStates = /* @__PURE__ */ new Map();
43621
+ agentActivityStates = /* @__PURE__ */ new Map();
43620
43622
  outputListeners = /* @__PURE__ */ new Map();
43621
43623
  exitResolvers = /* @__PURE__ */ new Map();
43622
43624
  exitResolverSeq = 0;
@@ -44154,6 +44156,7 @@ var AgentRelay = class {
44154
44156
  this.exitedAgents.clear();
44155
44157
  this.idleAgents.clear();
44156
44158
  this.deliveryStates.clear();
44159
+ this.agentActivityStates.clear();
44157
44160
  this.outputListeners.clear();
44158
44161
  for (const entry of this.exitResolvers.values()) {
44159
44162
  entry.resolve("released");
@@ -44177,6 +44180,68 @@ var AgentRelay = class {
44177
44180
  updateDeliveryState(eventId, to2, status, updatedAt) {
44178
44181
  this.deliveryStates.set(eventId, { eventId, to: to2, status, updatedAt });
44179
44182
  }
44183
+ ensureAgentActivityState(name) {
44184
+ const existing = this.agentActivityStates.get(name);
44185
+ if (existing) {
44186
+ return existing;
44187
+ }
44188
+ const state = {
44189
+ active: false,
44190
+ pendingDeliveries: /* @__PURE__ */ new Map()
44191
+ };
44192
+ this.agentActivityStates.set(name, state);
44193
+ return state;
44194
+ }
44195
+ getDeliveryActivityKey(deliveryId, eventId) {
44196
+ return deliveryId || eventId;
44197
+ }
44198
+ markAgentDeliveryPending(name, deliveryId, eventId, reason) {
44199
+ const state = this.ensureAgentActivityState(name);
44200
+ state.pendingDeliveries.set(this.getDeliveryActivityKey(deliveryId, eventId), eventId);
44201
+ this.setAgentActivity(name, state, state.pendingDeliveries.size > 0, reason, eventId);
44202
+ }
44203
+ closeAgentDelivery(name, reason, eventId, deliveryId) {
44204
+ const state = this.agentActivityStates.get(name);
44205
+ if (!state)
44206
+ return;
44207
+ const key = deliveryId && eventId ? this.getDeliveryActivityKey(deliveryId, eventId) : void 0;
44208
+ if (key) {
44209
+ state.pendingDeliveries.delete(key);
44210
+ } else if (eventId) {
44211
+ const matchingEntry = Array.from(state.pendingDeliveries.entries()).find(([, pendingEventId]) => {
44212
+ return pendingEventId === eventId;
44213
+ });
44214
+ if (matchingEntry) {
44215
+ state.pendingDeliveries.delete(matchingEntry[0]);
44216
+ } else {
44217
+ const oldestKey = state.pendingDeliveries.keys().next().value;
44218
+ if (oldestKey) {
44219
+ state.pendingDeliveries.delete(oldestKey);
44220
+ }
44221
+ }
44222
+ }
44223
+ this.setAgentActivity(name, state, state.pendingDeliveries.size > 0, reason, eventId);
44224
+ }
44225
+ clearAgentDeliveries(name, reason, eventId) {
44226
+ const state = this.agentActivityStates.get(name);
44227
+ if (!state)
44228
+ return;
44229
+ state.pendingDeliveries.clear();
44230
+ this.setAgentActivity(name, state, false, reason, eventId);
44231
+ }
44232
+ setAgentActivity(name, state, active, reason, eventId) {
44233
+ if (state.active === active) {
44234
+ return;
44235
+ }
44236
+ state.active = active;
44237
+ this.onAgentActivityChanged?.({
44238
+ name,
44239
+ active,
44240
+ pendingDeliveries: state.pendingDeliveries.size,
44241
+ reason,
44242
+ eventId
44243
+ });
44244
+ }
44180
44245
  resolveEventTimestamp(candidate) {
44181
44246
  return typeof candidate === "number" ? candidate : Date.now();
44182
44247
  }
@@ -44321,10 +44386,12 @@ var AgentRelay = class {
44321
44386
  this.unsubEvent = client.onEvent((event) => {
44322
44387
  switch (event.kind) {
44323
44388
  case "relay_inbound": {
44389
+ this.closeAgentDelivery(event.from, "relay_inbound", event.event_id);
44324
44390
  if (this.knownAgents.has(event.from)) {
44325
44391
  this.messageReadyAgents.add(event.from);
44326
44392
  this.exitedAgents.delete(event.from);
44327
44393
  }
44394
+ this.clearAgentDeliveries(event.from, "relay_inbound", event.event_id);
44328
44395
  const msg = {
44329
44396
  eventId: event.event_id,
44330
44397
  from: event.from,
@@ -44347,6 +44414,7 @@ var AgentRelay = class {
44347
44414
  }
44348
44415
  case "agent_released": {
44349
44416
  const agent = this.knownAgents.get(event.name) ?? this.ensureAgentHandle(event.name, "pty", []);
44417
+ this.clearAgentDeliveries(event.name, "agent_released");
44350
44418
  this.exitedAgents.add(event.name);
44351
44419
  this.readyAgents.delete(event.name);
44352
44420
  this.messageReadyAgents.delete(event.name);
@@ -44362,6 +44430,7 @@ var AgentRelay = class {
44362
44430
  }
44363
44431
  case "agent_exited": {
44364
44432
  const agent = this.knownAgents.get(event.name) ?? this.ensureAgentHandle(event.name, "pty", []);
44433
+ this.clearAgentDeliveries(event.name, "agent_exited");
44365
44434
  this.exitedAgents.add(event.name);
44366
44435
  this.readyAgents.delete(event.name);
44367
44436
  this.messageReadyAgents.delete(event.name);
@@ -44402,14 +44471,17 @@ var AgentRelay = class {
44402
44471
  break;
44403
44472
  }
44404
44473
  case "delivery_queued": {
44474
+ this.markAgentDeliveryPending(event.name, event.delivery_id, event.event_id, "delivery_queued");
44405
44475
  this.updateDeliveryState(event.event_id, event.name, "queued", this.resolveEventTimestamp(event.timestamp));
44406
44476
  break;
44407
44477
  }
44408
44478
  case "delivery_injected": {
44479
+ this.markAgentDeliveryPending(event.name, event.delivery_id, event.event_id, "delivery_injected");
44409
44480
  this.updateDeliveryState(event.event_id, event.name, "injected", this.resolveEventTimestamp(event.timestamp));
44410
44481
  break;
44411
44482
  }
44412
44483
  case "delivery_active": {
44484
+ this.markAgentDeliveryPending(event.name, event.delivery_id, event.event_id, "delivery_active");
44413
44485
  this.updateDeliveryState(event.event_id, event.name, "active", this.resolveEventTimestamp());
44414
44486
  break;
44415
44487
  }
@@ -44417,7 +44489,11 @@ var AgentRelay = class {
44417
44489
  this.updateDeliveryState(event.event_id, event.name, "verified", this.resolveEventTimestamp());
44418
44490
  break;
44419
44491
  }
44492
+ case "delivery_ack": {
44493
+ break;
44494
+ }
44420
44495
  case "delivery_failed": {
44496
+ this.closeAgentDelivery(event.name, "delivery_failed", event.event_id, event.delivery_id);
44421
44497
  this.updateDeliveryState(event.event_id, event.name, "failed", this.resolveEventTimestamp());
44422
44498
  break;
44423
44499
  }
@@ -44432,6 +44508,7 @@ var AgentRelay = class {
44432
44508
  break;
44433
44509
  }
44434
44510
  case "agent_idle": {
44511
+ this.clearAgentDeliveries(event.name, "agent_idle");
44435
44512
  this.idleAgents.add(event.name);
44436
44513
  this.onAgentIdle?.({
44437
44514
  name: event.name,
@@ -44717,6 +44794,7 @@ var AgentRelay = class {
44717
44794
  this.messageReadyAgents.delete(name);
44718
44795
  this.exitedAgents.delete(name);
44719
44796
  this.idleAgents.delete(name);
44797
+ this.agentActivityStates.delete(name);
44720
44798
  }
44721
44799
  normalizeReleaseOptions(reasonOrOptions) {
44722
44800
  if (typeof reasonOrOptions === "string" || reasonOrOptions === void 0) {
@@ -53135,9 +53213,10 @@ function delay(ms2) {
53135
53213
  // packages/sdk/dist/workflows/trajectory.js
53136
53214
  var import_node_path27 = require("node:path");
53137
53215
 
53138
- // node_modules/agent-trajectories/dist/chunk-2XT3DOJC.js
53216
+ // node_modules/agent-trajectories/dist/chunk-27AQPWHK.js
53139
53217
  var import_module = require("module");
53140
53218
  var import_crypto = require("crypto");
53219
+ var import_crypto2 = require("crypto");
53141
53220
  var import_fs5 = require("fs");
53142
53221
  var import_promises7 = require("fs/promises");
53143
53222
  var import_path4 = require("path");
@@ -53689,6 +53768,16 @@ function expandPath(path24) {
53689
53768
  }
53690
53769
  return path24;
53691
53770
  }
53771
+ var indexLocks = /* @__PURE__ */ new Map();
53772
+ function withIndexLock(path24, task) {
53773
+ const prev = indexLocks.get(path24) ?? Promise.resolve();
53774
+ const next = prev.then(task, task);
53775
+ indexLocks.set(
53776
+ path24,
53777
+ next.catch(() => void 0)
53778
+ );
53779
+ return next;
53780
+ }
53692
53781
  var FileStorage = class {
53693
53782
  baseDir;
53694
53783
  trajectoriesDir;
@@ -53715,10 +53804,10 @@ var FileStorage = class {
53715
53804
  await (0, import_promises7.mkdir)(this.activeDir, { recursive: true });
53716
53805
  await (0, import_promises7.mkdir)(this.completedDir, { recursive: true });
53717
53806
  if (!(0, import_fs5.existsSync)(this.indexPath)) {
53718
- await this.saveIndex({
53719
- version: 1,
53720
- lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
53721
- trajectories: {}
53807
+ await withIndexLock(this.indexPath, async () => {
53808
+ if (!(0, import_fs5.existsSync)(this.indexPath)) {
53809
+ await this.saveIndex(this.emptyIndex());
53810
+ }
53722
53811
  });
53723
53812
  }
53724
53813
  await this.reconcileIndex();
@@ -53746,49 +53835,51 @@ var FileStorage = class {
53746
53835
  skippedSchemaViolation: 0,
53747
53836
  skippedIoError: 0
53748
53837
  };
53749
- const index = await this.loadIndex();
53750
- const before = Object.keys(index.trajectories).length;
53751
- const discovered = [];
53752
- try {
53753
- const activeFiles = await (0, import_promises7.readdir)(this.activeDir);
53754
- for (const file2 of activeFiles) {
53755
- if (!file2.endsWith(".json")) continue;
53756
- discovered.push((0, import_path4.join)(this.activeDir, file2));
53757
- }
53758
- } catch (error48) {
53759
- if (error48.code !== "ENOENT") throw error48;
53760
- }
53761
- await this.walkJsonFilesInto(this.completedDir, discovered);
53762
- for (const filePath of discovered) {
53763
- summary.scanned += 1;
53764
- const result = await this.readTrajectoryFile(filePath);
53765
- if (!result.ok) {
53766
- if (result.reason === "malformed_json") {
53767
- summary.skippedMalformedJson += 1;
53768
- } else if (result.reason === "schema_violation") {
53769
- summary.skippedSchemaViolation += 1;
53770
- } else {
53771
- summary.skippedIoError += 1;
53838
+ await withIndexLock(this.indexPath, async () => {
53839
+ const index = await this.loadIndex();
53840
+ const before = Object.keys(index.trajectories).length;
53841
+ const discovered = [];
53842
+ try {
53843
+ const activeFiles = await (0, import_promises7.readdir)(this.activeDir);
53844
+ for (const file2 of activeFiles) {
53845
+ if (!file2.endsWith(".json")) continue;
53846
+ discovered.push((0, import_path4.join)(this.activeDir, file2));
53772
53847
  }
53773
- continue;
53848
+ } catch (error48) {
53849
+ if (error48.code !== "ENOENT") throw error48;
53850
+ }
53851
+ await this.walkJsonFilesInto(this.completedDir, discovered);
53852
+ for (const filePath of discovered) {
53853
+ summary.scanned += 1;
53854
+ const result = await this.readTrajectoryFile(filePath);
53855
+ if (!result.ok) {
53856
+ if (result.reason === "malformed_json") {
53857
+ summary.skippedMalformedJson += 1;
53858
+ } else if (result.reason === "schema_violation") {
53859
+ summary.skippedSchemaViolation += 1;
53860
+ } else {
53861
+ summary.skippedIoError += 1;
53862
+ }
53863
+ continue;
53864
+ }
53865
+ const trajectory2 = result.trajectory;
53866
+ if (index.trajectories[trajectory2.id]) {
53867
+ summary.alreadyIndexed += 1;
53868
+ continue;
53869
+ }
53870
+ index.trajectories[trajectory2.id] = {
53871
+ title: trajectory2.task.title,
53872
+ status: trajectory2.status,
53873
+ startedAt: trajectory2.startedAt,
53874
+ completedAt: trajectory2.completedAt,
53875
+ path: filePath
53876
+ };
53877
+ summary.added += 1;
53774
53878
  }
53775
- const trajectory2 = result.trajectory;
53776
- if (index.trajectories[trajectory2.id]) {
53777
- summary.alreadyIndexed += 1;
53778
- continue;
53879
+ if (Object.keys(index.trajectories).length !== before) {
53880
+ await this.saveIndex(index);
53779
53881
  }
53780
- index.trajectories[trajectory2.id] = {
53781
- title: trajectory2.task.title,
53782
- status: trajectory2.status,
53783
- startedAt: trajectory2.startedAt,
53784
- completedAt: trajectory2.completedAt,
53785
- path: filePath
53786
- };
53787
- summary.added += 1;
53788
- }
53789
- if (Object.keys(index.trajectories).length !== before) {
53790
- await this.saveIndex(index);
53791
- }
53882
+ });
53792
53883
  const hadSkips = summary.skippedMalformedJson + summary.skippedSchemaViolation + summary.skippedIoError > 0;
53793
53884
  if (summary.added > 0 || hadSkips) {
53794
53885
  const parts = [`reconciled ${summary.added}/${summary.scanned}`];
@@ -53991,17 +54082,19 @@ var FileStorage = class {
53991
54082
  if ((0, import_fs5.existsSync)(activePath)) {
53992
54083
  await (0, import_promises7.unlink)(activePath);
53993
54084
  }
53994
- const index = await this.loadIndex();
53995
- const entry = index.trajectories[id];
53996
- if (entry?.path && (0, import_fs5.existsSync)(entry.path)) {
53997
- await (0, import_promises7.unlink)(entry.path);
53998
- const mdPath = entry.path.replace(".json", ".md");
53999
- if ((0, import_fs5.existsSync)(mdPath)) {
54000
- await (0, import_promises7.unlink)(mdPath);
54085
+ await withIndexLock(this.indexPath, async () => {
54086
+ const index = await this.loadIndex();
54087
+ const entry = index.trajectories[id];
54088
+ if (entry?.path && (0, import_fs5.existsSync)(entry.path)) {
54089
+ await (0, import_promises7.unlink)(entry.path);
54090
+ const mdPath = entry.path.replace(".json", ".md");
54091
+ if ((0, import_fs5.existsSync)(mdPath)) {
54092
+ await (0, import_promises7.unlink)(mdPath);
54093
+ }
54001
54094
  }
54002
- }
54003
- delete index.trajectories[id];
54004
- await this.saveIndex(index);
54095
+ delete index.trajectories[id];
54096
+ await this.saveIndex(index);
54097
+ });
54005
54098
  }
54006
54099
  /**
54007
54100
  * Search trajectories by text
@@ -54079,10 +54172,23 @@ var FileStorage = class {
54079
54172
  const result = await this.readTrajectoryFile(path24);
54080
54173
  return result.ok ? result.trajectory : null;
54081
54174
  }
54175
+ /**
54176
+ * Read and parse the on-disk index.
54177
+ *
54178
+ * Tolerances (belt-and-braces against the read/write race):
54179
+ * - ENOENT: first-run, return an empty index silently.
54180
+ * - Empty file: a concurrent writer truncated index.json in "w" mode
54181
+ * right before we read. Return an empty index silently — this is
54182
+ * not a real corruption, just an interleaving the mutex + atomic
54183
+ * rename should already prevent. Logging here would be noise.
54184
+ * - Non-empty but malformed JSON: genuinely corrupted on disk (hand
54185
+ * edit, disk error, etc). Log it and return an empty index so the
54186
+ * caller can recover, but keep the log so the problem is visible.
54187
+ */
54082
54188
  async loadIndex() {
54189
+ let content;
54083
54190
  try {
54084
- const content = await (0, import_promises7.readFile)(this.indexPath, "utf-8");
54085
- return JSON.parse(content);
54191
+ content = await (0, import_promises7.readFile)(this.indexPath, "utf-8");
54086
54192
  } catch (error48) {
54087
54193
  if (error48.code !== "ENOENT") {
54088
54194
  console.error(
@@ -54090,27 +54196,56 @@ var FileStorage = class {
54090
54196
  error48
54091
54197
  );
54092
54198
  }
54093
- return {
54094
- version: 1,
54095
- lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
54096
- trajectories: {}
54097
- };
54199
+ return this.emptyIndex();
54200
+ }
54201
+ if (content.length === 0) {
54202
+ return this.emptyIndex();
54203
+ }
54204
+ try {
54205
+ return JSON.parse(content);
54206
+ } catch (error48) {
54207
+ console.error(
54208
+ "Error loading trajectory index, using empty index:",
54209
+ error48
54210
+ );
54211
+ return this.emptyIndex();
54098
54212
  }
54099
54213
  }
54214
+ emptyIndex() {
54215
+ return {
54216
+ version: 1,
54217
+ lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
54218
+ trajectories: {}
54219
+ };
54220
+ }
54221
+ /**
54222
+ * Atomic write: stage into a process-unique temp path in the same directory
54223
+ * and then rename over the live file. `rename` is atomic on POSIX, so
54224
+ * concurrent readers in any process either see the old complete file or
54225
+ * the new complete file — never a half-written / zero-byte state.
54226
+ *
54227
+ * Callers MUST hold `withIndexLock(this.indexPath, ...)` so the in-process
54228
+ * read-modify-write cycle stays serialized; the unique temp name also keeps
54229
+ * parallel writers in other processes from colliding on a shared tmp path.
54230
+ */
54100
54231
  async saveIndex(index) {
54101
54232
  index.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
54102
- await (0, import_promises7.writeFile)(this.indexPath, JSON.stringify(index, null, 2), "utf-8");
54233
+ const tmpPath = `${this.indexPath}.${process.pid}.${(0, import_crypto2.randomUUID)()}.tmp`;
54234
+ await (0, import_promises7.writeFile)(tmpPath, JSON.stringify(index, null, 2), "utf-8");
54235
+ await (0, import_promises7.rename)(tmpPath, this.indexPath);
54103
54236
  }
54104
54237
  async updateIndex(trajectory2, filePath) {
54105
- const index = await this.loadIndex();
54106
- index.trajectories[trajectory2.id] = {
54107
- title: trajectory2.task.title,
54108
- status: trajectory2.status,
54109
- startedAt: trajectory2.startedAt,
54110
- completedAt: trajectory2.completedAt,
54111
- path: filePath
54112
- };
54113
- await this.saveIndex(index);
54238
+ await withIndexLock(this.indexPath, async () => {
54239
+ const index = await this.loadIndex();
54240
+ index.trajectories[trajectory2.id] = {
54241
+ title: trajectory2.task.title,
54242
+ status: trajectory2.status,
54243
+ startedAt: trajectory2.startedAt,
54244
+ completedAt: trajectory2.completedAt,
54245
+ path: filePath
54246
+ };
54247
+ await this.saveIndex(index);
54248
+ });
54114
54249
  }
54115
54250
  };
54116
54251
  var require22 = (0, import_module.createRequire)(import_meta_url);
@@ -59612,26 +59747,38 @@ ${preview}
59612
59747
 
59613
59748
  // packages/sdk/dist/workflows/file-db.js
59614
59749
  var import_node_fs21 = require("node:fs");
59750
+ var import_node_os9 = __toESM(require("node:os"), 1);
59615
59751
  var import_node_path29 = __toESM(require("node:path"), 1);
59616
- var JsonFileWorkflowDb = class {
59752
+ var JsonFileWorkflowDb = class _JsonFileWorkflowDb {
59617
59753
  filePath;
59618
- /** Whether the storage directory is writable. False = silent no-op mode. */
59754
+ /** Whether persistence is active. False = in-memory-only mode. */
59619
59755
  writable;
59620
59756
  appendFailedOnce = false;
59621
- constructor(filePath) {
59622
- this.filePath = filePath;
59623
- let writable = false;
59624
- try {
59625
- (0, import_node_fs21.mkdirSync)(import_node_path29.default.dirname(filePath), { recursive: true });
59626
- writable = true;
59627
- } catch {
59628
- }
59757
+ onWriteFailure;
59758
+ /**
59759
+ * Authoritative in-memory mirror. Every mutation updates this; reads
59760
+ * return from here. The jsonl file is only consulted at construction
59761
+ * (to replay prior state for `--resume`) and is otherwise write-only.
59762
+ */
59763
+ cache;
59764
+ constructor(filePathOrOptions) {
59765
+ const options = typeof filePathOrOptions === "string" ? { filePath: filePathOrOptions } : filePathOrOptions;
59766
+ this.onWriteFailure = options.onWriteFailure;
59767
+ const requestedPath = options.filePath ?? import_node_path29.default.join(".agent-relay", "workflow-runs.jsonl");
59768
+ const homeFallback = options.homeFallback ?? false;
59769
+ const { resolvedPath, writable } = _JsonFileWorkflowDb.resolveStoragePath(requestedPath, homeFallback);
59770
+ this.filePath = resolvedPath;
59629
59771
  this.writable = writable;
59772
+ this.cache = _JsonFileWorkflowDb.loadSnapshot(this.filePath);
59630
59773
  }
59631
- /** Returns false if the storage directory could not be created (permission error). */
59774
+ /** Returns false if persistence is not active (in-memory-only mode). */
59632
59775
  isWritable() {
59633
59776
  return this.writable;
59634
59777
  }
59778
+ /** Resolved path on disk. For tests + diagnostics. */
59779
+ getStoragePath() {
59780
+ return this.filePath;
59781
+ }
59635
59782
  hasStepOutputs(runId) {
59636
59783
  try {
59637
59784
  const dir = import_node_path29.default.join(import_node_path29.default.dirname(this.filePath), "step-outputs", runId);
@@ -59641,25 +59788,35 @@ var JsonFileWorkflowDb = class {
59641
59788
  }
59642
59789
  }
59643
59790
  // ── Private helpers ─────────────────────────────────────────────────────
59644
- append(entry) {
59645
- if (!this.writable)
59646
- return;
59647
- try {
59648
- (0, import_node_fs21.appendFileSync)(this.filePath, JSON.stringify(entry) + "\n", "utf8");
59649
- } catch (err) {
59650
- if (!this.appendFailedOnce) {
59651
- this.appendFailedOnce = true;
59652
- console.warn("[workflow] warning: failed to write run state to " + this.filePath + " \u2014 --resume will not be available for this run. Use --start-from instead. Error: " + (err instanceof Error ? err.message : String(err)));
59791
+ static resolveStoragePath(requestedPath, homeFallback) {
59792
+ const candidates = [requestedPath];
59793
+ if (homeFallback) {
59794
+ const base = import_node_path29.default.basename(requestedPath) || "workflow-runs.jsonl";
59795
+ candidates.push(import_node_path29.default.join(import_node_os9.default.homedir(), ".agent-relay", `workflow-runs-${base}`));
59796
+ }
59797
+ for (let i = 0; i < candidates.length; i++) {
59798
+ const candidate = candidates[i];
59799
+ const isLastCandidate = i === candidates.length - 1;
59800
+ try {
59801
+ (0, import_node_fs21.mkdirSync)(import_node_path29.default.dirname(candidate), { recursive: true });
59802
+ if (!isLastCandidate) {
59803
+ (0, import_node_fs21.accessSync)(import_node_path29.default.dirname(candidate), import_node_fs21.constants.W_OK);
59804
+ if ((0, import_node_fs21.existsSync)(candidate)) {
59805
+ (0, import_node_fs21.accessSync)(candidate, import_node_fs21.constants.W_OK);
59806
+ }
59807
+ }
59808
+ return { resolvedPath: candidate, writable: true };
59809
+ } catch {
59653
59810
  }
59654
59811
  }
59812
+ return { resolvedPath: requestedPath, writable: false };
59655
59813
  }
59656
- /** Read all lines and build the latest snapshot for each ID. */
59657
- snapshot() {
59814
+ static loadSnapshot(filePath) {
59658
59815
  const runs = /* @__PURE__ */ new Map();
59659
59816
  const steps = /* @__PURE__ */ new Map();
59660
59817
  let raw = "";
59661
59818
  try {
59662
- raw = (0, import_node_fs21.readFileSync)(this.filePath, "utf8");
59819
+ raw = (0, import_node_fs21.readFileSync)(filePath, "utf8");
59663
59820
  } catch {
59664
59821
  return { runs, steps };
59665
59822
  }
@@ -59679,34 +59836,57 @@ var JsonFileWorkflowDb = class {
59679
59836
  }
59680
59837
  return { runs, steps };
59681
59838
  }
59839
+ append(entry) {
59840
+ if (!this.writable)
59841
+ return;
59842
+ try {
59843
+ (0, import_node_fs21.appendFileSync)(this.filePath, JSON.stringify(entry) + "\n", "utf8");
59844
+ } catch (err) {
59845
+ this.onWriteFailure?.(err, this.filePath);
59846
+ if (!this.appendFailedOnce) {
59847
+ this.appendFailedOnce = true;
59848
+ console.warn("[workflow] warning: failed to write run state to " + this.filePath + " \u2014 --resume will not be available for this run. Use --start-from instead. Error: " + (err instanceof Error ? err.message : String(err)));
59849
+ }
59850
+ }
59851
+ }
59682
59852
  // ── WorkflowDb interface ─────────────────────────────────────────────────
59683
59853
  async insertRun(run) {
59854
+ this.cache.runs.set(run.id, { ...run });
59684
59855
  this.append({ kind: "run", row: run });
59685
59856
  }
59686
59857
  async updateRun(id, patch) {
59687
- const { runs } = this.snapshot();
59688
- const existing = runs.get(id);
59858
+ const existing = this.cache.runs.get(id);
59689
59859
  if (!existing)
59690
59860
  return;
59691
- this.append({ kind: "run", row: { ...existing, ...patch, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } });
59861
+ const updated = {
59862
+ ...existing,
59863
+ ...patch,
59864
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
59865
+ };
59866
+ this.cache.runs.set(id, updated);
59867
+ this.append({ kind: "run", row: updated });
59692
59868
  }
59693
59869
  async getRun(id) {
59694
- const { runs } = this.snapshot();
59695
- return runs.get(id) ?? null;
59870
+ return this.cache.runs.get(id) ?? null;
59696
59871
  }
59697
59872
  async insertStep(step) {
59873
+ this.cache.steps.set(step.id, { ...step });
59698
59874
  this.append({ kind: "step", row: step });
59699
59875
  }
59700
59876
  async updateStep(id, patch) {
59701
- const { steps } = this.snapshot();
59702
- const existing = steps.get(id);
59877
+ const existing = this.cache.steps.get(id);
59703
59878
  if (!existing)
59704
59879
  return;
59705
- this.append({ kind: "step", row: { ...existing, ...patch, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } });
59880
+ const updated = {
59881
+ ...existing,
59882
+ ...patch,
59883
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
59884
+ };
59885
+ this.cache.steps.set(id, updated);
59886
+ this.append({ kind: "step", row: updated });
59706
59887
  }
59707
59888
  async getStepsByRunId(runId) {
59708
- const { steps } = this.snapshot();
59709
- return Array.from(steps.values()).filter((s3) => s3.runId === runId);
59889
+ return Array.from(this.cache.steps.values()).filter((s3) => s3.runId === runId);
59710
59890
  }
59711
59891
  };
59712
59892
 
@@ -62090,13 +62270,13 @@ function getRepoFullNameFromPath(workingDirectory) {
62090
62270
  var import_node_fs25 = __toESM(require("node:fs"), 1);
62091
62271
  var import_node_path33 = __toESM(require("node:path"), 1);
62092
62272
  var import_node_https2 = __toESM(require("node:https"), 1);
62093
- var import_node_os10 = __toESM(require("node:os"), 1);
62273
+ var import_node_os11 = __toESM(require("node:os"), 1);
62094
62274
  var import_compare_versions = __toESM(require_umd(), 1);
62095
62275
  var PACKAGE_NAME = "agent-relay";
62096
62276
  var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
62097
62277
  var NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
62098
62278
  function getCachePath() {
62099
- const cacheDir = import_node_path33.default.join(import_node_os10.default.homedir(), ".agent-relay");
62279
+ const cacheDir = import_node_path33.default.join(import_node_os11.default.homedir(), ".agent-relay");
62100
62280
  return import_node_path33.default.join(cacheDir, "update-cache.json");
62101
62281
  }
62102
62282
  function readCache() {
@@ -62397,7 +62577,7 @@ function validateModelForCli(cli, model) {
62397
62577
 
62398
62578
  // packages/utils/dist/relay-pty-path.js
62399
62579
  var import_node_fs26 = __toESM(require("node:fs"), 1);
62400
- var import_node_os11 = __toESM(require("node:os"), 1);
62580
+ var import_node_os12 = __toESM(require("node:os"), 1);
62401
62581
  var import_node_path34 = __toESM(require("node:path"), 1);
62402
62582
  var SUPPORTED_PLATFORMS = {
62403
62583
  darwin: {
@@ -62410,20 +62590,20 @@ var SUPPORTED_PLATFORMS = {
62410
62590
  }
62411
62591
  };
62412
62592
  function getPlatformBinaryName() {
62413
- const platform2 = import_node_os11.default.platform();
62414
- const arch = import_node_os11.default.arch();
62593
+ const platform2 = import_node_os12.default.platform();
62594
+ const arch = import_node_os12.default.arch();
62415
62595
  return SUPPORTED_PLATFORMS[platform2]?.[arch] ?? null;
62416
62596
  }
62417
62597
  function isPlatformSupported() {
62418
- const platform2 = import_node_os11.default.platform();
62419
- const arch = import_node_os11.default.arch();
62598
+ const platform2 = import_node_os12.default.platform();
62599
+ const arch = import_node_os12.default.arch();
62420
62600
  return SUPPORTED_PLATFORMS[platform2]?.[arch] !== void 0;
62421
62601
  }
62422
62602
  function getSupportedPlatforms() {
62423
62603
  const platforms = [];
62424
- for (const [os11, archs] of Object.entries(SUPPORTED_PLATFORMS)) {
62604
+ for (const [os12, archs] of Object.entries(SUPPORTED_PLATFORMS)) {
62425
62605
  for (const arch of Object.keys(archs)) {
62426
- platforms.push(`${os11}-${arch}`);
62606
+ platforms.push(`${os12}-${arch}`);
62427
62607
  }
62428
62608
  }
62429
62609
  return platforms.join(", ");
@@ -62536,7 +62716,7 @@ function isPlatformCompatibleBinary(filePath) {
62536
62716
  return false;
62537
62717
  }
62538
62718
  const magic = header.readUInt32BE(0);
62539
- const platform2 = import_node_os11.default.platform();
62719
+ const platform2 = import_node_os12.default.platform();
62540
62720
  if (platform2 === "darwin") {
62541
62721
  return isMachOBinary(magic);
62542
62722
  }
@@ -63171,7 +63351,7 @@ var import_node_child_process10 = require("node:child_process");
63171
63351
  var import_node_crypto15 = __toESM(require("node:crypto"), 1);
63172
63352
  var import_node_path35 = __toESM(require("node:path"), 1);
63173
63353
  var import_node_fs27 = __toESM(require("node:fs"), 1);
63174
- var import_node_os12 = __toESM(require("node:os"), 1);
63354
+ var import_node_os13 = __toESM(require("node:os"), 1);
63175
63355
  function getGlobalBaseDir2() {
63176
63356
  if (process.env.AGENT_RELAY_DATA_DIR) {
63177
63357
  return process.env.AGENT_RELAY_DATA_DIR;
@@ -63180,7 +63360,7 @@ function getGlobalBaseDir2() {
63180
63360
  if (xdgDataHome) {
63181
63361
  return import_node_path35.default.join(xdgDataHome, "agent-relay");
63182
63362
  }
63183
- return import_node_path35.default.join(import_node_os12.default.homedir(), ".agent-relay");
63363
+ return import_node_path35.default.join(import_node_os13.default.homedir(), ".agent-relay");
63184
63364
  }
63185
63365
  var GLOBAL_BASE_DIR2 = getGlobalBaseDir2();
63186
63366
  var PROJECT_DATA_DIR = ".agent-relay";
@@ -63223,10 +63403,10 @@ function getProjectPaths2(projectRoot) {
63223
63403
  // packages/config/dist/trajectory-config.js
63224
63404
  var import_node_fs28 = require("node:fs");
63225
63405
  var import_node_path36 = require("node:path");
63226
- var import_node_os13 = require("node:os");
63406
+ var import_node_os14 = require("node:os");
63227
63407
  var import_node_crypto16 = require("node:crypto");
63228
63408
  function getAgentRelayConfigDir() {
63229
- return process.env.AGENT_RELAY_CONFIG_DIR ?? (0, import_node_path36.join)((0, import_node_os13.homedir)(), ".config", "agent-relay");
63409
+ return process.env.AGENT_RELAY_CONFIG_DIR ?? (0, import_node_path36.join)((0, import_node_os14.homedir)(), ".config", "agent-relay");
63230
63410
  }
63231
63411
  var configCache = null;
63232
63412
  function getRelayConfigPath(_projectRoot) {
@@ -63270,7 +63450,7 @@ function getProjectHash(projectRoot) {
63270
63450
  }
63271
63451
  function getUserTrajectoriesDir(projectRoot) {
63272
63452
  const projectHash = getProjectHash(projectRoot);
63273
- const configDir = process.env.XDG_CONFIG_HOME || (0, import_node_path36.join)((0, import_node_os13.homedir)(), ".config");
63453
+ const configDir = process.env.XDG_CONFIG_HOME || (0, import_node_path36.join)((0, import_node_os14.homedir)(), ".config");
63274
63454
  return (0, import_node_path36.join)(configDir, "agent-relay", "trajectories", projectHash);
63275
63455
  }
63276
63456
  function getRepoTrajectoriesDir(projectRoot) {