agent-relay 4.0.29 → 4.0.31

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 (142) 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 +99 -54
  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/dist/workflows/file-db.d.ts +62 -12
  52. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.d.ts.map +1 -1
  53. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.js +137 -47
  54. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.js.map +1 -1
  55. package/node_modules/@agent-relay/sdk/package.json +22 -2
  56. package/node_modules/@agent-relay/telemetry/dist/client.d.ts +14 -2
  57. package/node_modules/@agent-relay/telemetry/dist/client.d.ts.map +1 -1
  58. package/node_modules/@agent-relay/telemetry/dist/client.js +22 -4
  59. package/node_modules/@agent-relay/telemetry/dist/client.js.map +1 -1
  60. package/node_modules/@agent-relay/telemetry/dist/events.d.ts +217 -10
  61. package/node_modules/@agent-relay/telemetry/dist/events.d.ts.map +1 -1
  62. package/node_modules/@agent-relay/telemetry/dist/events.js +11 -0
  63. package/node_modules/@agent-relay/telemetry/dist/events.js.map +1 -1
  64. package/node_modules/@agent-relay/telemetry/dist/index.d.ts +2 -2
  65. package/node_modules/@agent-relay/telemetry/dist/index.d.ts.map +1 -1
  66. package/node_modules/@agent-relay/telemetry/dist/index.js.map +1 -1
  67. package/node_modules/@agent-relay/telemetry/package.json +2 -2
  68. package/node_modules/@agent-relay/trajectory/package.json +2 -2
  69. package/node_modules/@agent-relay/user-directory/package.json +2 -2
  70. package/node_modules/@agent-relay/utils/package.json +2 -2
  71. package/node_modules/@relaycast/sdk/dist/version.d.ts +1 -1
  72. package/node_modules/@relaycast/sdk/dist/version.js +1 -1
  73. package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/package.json +1 -1
  74. package/node_modules/@relaycast/sdk/package.json +2 -2
  75. package/node_modules/axios/CHANGELOG.md +166 -0
  76. package/node_modules/axios/README.md +210 -204
  77. package/node_modules/axios/dist/axios.js +92 -63
  78. package/node_modules/axios/dist/axios.js.map +1 -1
  79. package/node_modules/axios/dist/axios.min.js +2 -2
  80. package/node_modules/axios/dist/axios.min.js.map +1 -1
  81. package/node_modules/axios/dist/browser/axios.cjs +140 -101
  82. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  83. package/node_modules/axios/dist/esm/axios.js +140 -101
  84. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  85. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  86. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  87. package/node_modules/axios/dist/node/axios.cjs +199 -75
  88. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  89. package/node_modules/axios/index.d.cts +14 -28
  90. package/node_modules/axios/index.d.ts +132 -226
  91. package/node_modules/axios/lib/adapters/fetch.js +21 -6
  92. package/node_modules/axios/lib/adapters/http.js +88 -6
  93. package/node_modules/axios/lib/core/AxiosError.js +34 -33
  94. package/node_modules/axios/lib/core/AxiosHeaders.js +24 -25
  95. package/node_modules/axios/lib/core/buildFullPath.js +1 -1
  96. package/node_modules/axios/lib/core/mergeConfig.js +5 -3
  97. package/node_modules/axios/lib/defaults/index.js +13 -8
  98. package/node_modules/axios/lib/env/data.js +1 -1
  99. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -2
  100. package/node_modules/axios/lib/helpers/formDataToJSON.js +3 -1
  101. package/node_modules/axios/lib/helpers/formDataToStream.js +2 -1
  102. package/node_modules/axios/lib/helpers/progressEventReducer.js +5 -5
  103. package/node_modules/axios/lib/helpers/resolveConfig.js +11 -3
  104. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +48 -1
  105. package/node_modules/axios/lib/helpers/toFormData.js +10 -2
  106. package/node_modules/axios/lib/utils.js +10 -10
  107. package/node_modules/axios/package.json +4 -4
  108. package/node_modules/hasown/CHANGELOG.md +11 -0
  109. package/node_modules/hasown/eslint.config.mjs +6 -0
  110. package/node_modules/hasown/index.d.ts +1 -0
  111. package/node_modules/hasown/package.json +14 -14
  112. package/package.json +9 -9
  113. package/packages/cloud/package.json +2 -2
  114. package/packages/config/package.json +1 -1
  115. package/packages/hooks/package.json +4 -4
  116. package/packages/sdk/dist/workflows/file-db.d.ts +62 -12
  117. package/packages/sdk/dist/workflows/file-db.d.ts.map +1 -1
  118. package/packages/sdk/dist/workflows/file-db.js +137 -47
  119. package/packages/sdk/dist/workflows/file-db.js.map +1 -1
  120. package/packages/sdk/package.json +22 -2
  121. package/packages/telemetry/dist/client.d.ts +14 -2
  122. package/packages/telemetry/dist/client.d.ts.map +1 -1
  123. package/packages/telemetry/dist/client.js +22 -4
  124. package/packages/telemetry/dist/client.js.map +1 -1
  125. package/packages/telemetry/dist/events.d.ts +217 -10
  126. package/packages/telemetry/dist/events.d.ts.map +1 -1
  127. package/packages/telemetry/dist/events.js +11 -0
  128. package/packages/telemetry/dist/events.js.map +1 -1
  129. package/packages/telemetry/dist/index.d.ts +2 -2
  130. package/packages/telemetry/dist/index.d.ts.map +1 -1
  131. package/packages/telemetry/dist/index.js.map +1 -1
  132. package/packages/telemetry/package.json +2 -2
  133. package/packages/trajectory/package.json +2 -2
  134. package/packages/user-directory/package.json +2 -2
  135. package/packages/utils/package.json +2 -2
  136. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/index.d.ts +0 -12
  137. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/index.js +0 -17
  138. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/license +0 -9
  139. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/package.json +0 -43
  140. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/readme.md +0 -35
  141. package/node_modules/color-convert/CHANGELOG.md +0 -54
  142. package/node_modules/hasown/.eslintrc +0 -5
package/README.md CHANGED
@@ -1,11 +1,24 @@
1
- # agent-relay
1
+ ![Agent Relay](./readme-banner.png)
2
2
 
3
- > Real-time messaging between AI agents.
3
+ <div align="center">
4
+ <a href="https://www.npmjs.com/package/@agent-relay/sdk"><img alt="npm" src="https://img.shields.io/npm/v/@agent-relay/sdk"></a>
5
+ <a href="https://github.com/AgentWorkforce/relay/actions/workflows/test.yml"><img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/AgentWorkforce/relay/test.yml?branch=main&label=tests"></a>
6
+ <a href="./LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-blue.svg"></a>
4
7
 
5
- [![npm](https://img.shields.io/npm/v/@agent-relay/sdk)](https://www.npmjs.com/package/@agent-relay/sdk)
6
- [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
7
8
 
8
- ---
9
+ Agent Relay is real-time communication infrastructure for agent-to-agent work. Spawn agents from code, give them shared channels, direct messages, threads, reactions, and presence, and let them coordinate in the same workspace.
10
+
11
+ It is not a framework or a harness. Your agents keep running however they already run. Agent Relay is the communication layer that helps them talk to each other and take action together.
12
+
13
+ **Website:** [agentrelay.com](https://agentrelay.com) · **Docs:** [agentrelay.com/docs](https://agentrelay.com/docs)
14
+ </div>
15
+
16
+ ## Why Agent Relay
17
+
18
+ - **Built for real-time coordination**: channels, messages, inboxes, reactions, and presence for agents that need to collaborate.
19
+ - **Works with terminal-native agents**: use Claude Code, Codex, Gemini CLI, OpenCode, and other supported runtimes without changing how they run.
20
+ - **SDK-first**: spawn agents programmatically, route work, wait for readiness, and manage lifecycles from TypeScript or Python.
21
+ - **Useful from both code and tools**: wire Relay into apps, scripts, plugins, and local workflows.
9
22
 
10
23
  ## Install
11
24
 
@@ -23,90 +36,123 @@ bun add @agent-relay/sdk
23
36
  pip install agent-relay-sdk
24
37
  ```
25
38
 
26
- See the [Python SDK](./packages/sdk-py) for full documentation.
27
-
28
- ## Documentation
39
+ See the [Python SDK](./packages/sdk-py) for Python usage and adapters.
29
40
 
30
- - **Web:** [agentrelay.com/docs](https://agentrelay.com/docs)
31
- - **Markdown:** [agentrelay.com/docs/markdown](https://agentrelay.com/docs/markdown) — plain-text docs for LLMs and terminal use
32
-
33
- ## Usage
41
+ ## Quick example
34
42
 
35
43
  ```typescript
36
44
  import { AgentRelay, Models } from '@agent-relay/sdk';
37
45
 
38
46
  const relay = new AgentRelay();
39
47
 
40
- relay.onMessageReceived = (msg) => console.log(`[${msg.from} → ${msg.to}]: ${msg.text}`);
48
+ relay.onMessageReceived = (msg) => {
49
+ console.log(`[${msg.from} → ${msg.to}]: ${msg.text}`);
50
+ };
41
51
 
42
- const channel = ['tic-tac-toe'];
52
+ const channels = ['tic-tac-toe'];
43
53
 
44
54
  const x = await relay.claude.spawn({
45
55
  name: 'PlayerX',
46
56
  model: Models.Claude.SONNET,
47
- channels: channel,
57
+ channels,
48
58
  task: 'Play tic-tac-toe as X against PlayerO. You go first.',
49
59
  });
60
+
50
61
  const o = await relay.codex.spawn({
51
62
  name: 'PlayerO',
52
63
  model: Models.Codex.GPT_5_3_CODEX_SPARK,
53
- channels: channel,
64
+ channels,
54
65
  task: 'Play tic-tac-toe as O against PlayerX.',
55
66
  });
56
67
 
57
- console.log('Waiting for agents to be ready...');
58
- await Promise.all([relay.waitForAgentReady('PlayerX'), relay.waitForAgentReady('PlayerO')]);
59
- console.log('Both ready. Starting game.');
68
+ await Promise.all([
69
+ relay.waitForAgentReady('PlayerX'),
70
+ relay.waitForAgentReady('PlayerO'),
71
+ ]);
60
72
 
61
73
  relay.system().sendMessage({ to: 'PlayerX', text: 'Start.' });
62
74
 
63
- const FIVE_MINUTES = 5 * 60 * 1000;
64
- await AgentRelay.waitForAny([x, o], FIVE_MINUTES);
75
+ await AgentRelay.waitForAny([x, o], 5 * 60 * 1000);
65
76
  await relay.shutdown();
66
77
  ```
67
78
 
68
- ## Claude Code Plugin
79
+ Want more than a toy example? Start with:
69
80
 
70
- Use Agent Relay directly inside Claude Code — no SDK required. The plugin adds multi-agent coordination via slash commands or natural language.
81
+ - [Introduction](./docs/introduction.md)
82
+ - [CLI on the Relay](./docs/cli-on-the-relay.md)
83
+ - [Examples](./examples/README.md)
84
+ - [TypeScript SDK README](./packages/sdk/README.md)
85
+ - [Python SDK README](./packages/sdk-py/README.md)
71
86
 
72
- ```
87
+ ## What you can build
88
+
89
+ - Multi-agent coding flows with shared channels and worker handoffs
90
+ - Agent inboxes for status updates, blockers, and review loops
91
+ - Tooling that lets existing agents communicate without rewriting their runtime
92
+ - Local or remote coordination patterns where multiple agents need shared context
93
+
94
+ ## Claude Code plugin
95
+
96
+ Use Agent Relay directly inside Claude Code, no SDK required. The plugin adds multi-agent coordination via slash commands or natural language.
97
+
98
+ ```text
73
99
  /plugin marketplace add Agentworkforce/skills
74
100
  /plugin install claude-relay-plugin
75
101
  ```
76
102
 
77
- Once installed, coordinate agents with built-in skills:
103
+ Once installed, you can coordinate teams of agents with built-in skills:
78
104
 
79
- ```
80
- > /relay-team Refactor the auth module split the middleware, update tests, and update docs
105
+ ```text
106
+ > /relay-team Refactor the auth module, split the middleware, update tests, and update docs
81
107
  > /relay-fanout Run linting fixes across all packages in the monorepo
82
- > /relay-pipeline Analyze the API logs, then generate a summary report, then draft an email
108
+ > /relay-pipeline Analyze the API logs, generate a summary report, then draft an email
83
109
  ```
84
110
 
85
111
  Or just describe what you want in plain language:
86
112
 
87
- ```
113
+ ```text
88
114
  > Use relay fan-out to lint all packages in parallel
89
- > Split the migration into three relay workers one for the schema, one for the API, one for the frontend
115
+ > Split the migration into three relay workers, one for the schema, one for the API, and one for the frontend
116
+ ```
117
+
118
+ See [docs/plugin-claude-code.md](./docs/plugin-claude-code.md) and the [plugin README](https://github.com/AgentWorkforce/skills/tree/main/plugins/claude-relay-plugin) for more.
119
+
120
+ ## Agent Relay CLI
121
+
122
+ Install the CLI with:
123
+
124
+ ```bash
125
+ curl -fsSL https://raw.githubusercontent.com/AgentWorkforce/relay/main/install.sh | bash
90
126
  ```
91
127
 
92
- See the [plugin README](https://github.com/AgentWorkforce/skills/tree/main/plugins/claude-relay-plugin) for full details.
128
+ Then use Agent Relay to bring agents into a shared workspace and route work between them.
93
129
 
94
- ## Supported CLI’s
130
+ ## Supported agents and runtimes
95
131
 
96
- - Claude
97
- - Codex
98
- - Gemini
99
- - Opencode
132
+ Agent Relay is designed for terminal-native agents and SDK-driven workflows. This repo currently includes first-class support for:
100
133
 
101
- ---
134
+ - Claude Code
135
+ - Codex CLI
136
+ - Gemini CLI
137
+ - OpenCode
102
138
 
103
- ## Agent Relay CLI
139
+ The broader SDK and workflow surface also includes additional integrations in the codebase. See the package docs for details.
104
140
 
105
- Install via
141
+ ## Development
106
142
 
143
+ If you want to work on the repo itself:
144
+
145
+ ```bash
146
+ npm install
147
+ npm run build
148
+ npm test
107
149
  ```
108
- curl -fsSL https://raw.githubusercontent.com/AgentWorkforce/relay/main/install.sh | bash
109
- ```
150
+
151
+ Useful references:
152
+
153
+ - [ARCHITECTURE.md](./ARCHITECTURE.md)
154
+ - [CHANGELOG.md](./CHANGELOG.md)
155
+ - [GitHub Issues](https://github.com/AgentWorkforce/relay/issues)
110
156
 
111
157
  ## License
112
158
 
@@ -114,10 +160,4 @@ Apache-2.0 — Copyright 2026 Agent Workforce Incorporated
114
160
 
115
161
  ---
116
162
 
117
- **Links:** [Documentation](https://agentrelay.com/docs) · [Docs (Markdown)](https://agentrelay.com/docs/markdown.md) · [Issues](https://github.com/AgentWorkforce/relay/issues) · [Discord](https://discord.gg/6E6CTxM8um)
118
-
119
- > **Plain-text docs:** Every docs page is available as generated Markdown from the website, backed by the same MDX source as the rendered docs:
120
- >
121
- > ```bash
122
- > curl https://agentrelay.com/docs/markdown/introduction.md
123
- > ```
163
+ **Links:** [Website](https://agentrelay.com) · [Documentation](https://agentrelay.com/docs) · [Docs (Markdown)](https://agentrelay.com/docs/markdown) · [Discord](https://discord.gg/6E6CTxM8um)
Binary file
Binary file
Binary file
Binary file
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) {
@@ -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 = {};
@@ -59612,26 +59612,38 @@ ${preview}
59612
59612
 
59613
59613
  // packages/sdk/dist/workflows/file-db.js
59614
59614
  var import_node_fs21 = require("node:fs");
59615
+ var import_node_os9 = __toESM(require("node:os"), 1);
59615
59616
  var import_node_path29 = __toESM(require("node:path"), 1);
59616
- var JsonFileWorkflowDb = class {
59617
+ var JsonFileWorkflowDb = class _JsonFileWorkflowDb {
59617
59618
  filePath;
59618
- /** Whether the storage directory is writable. False = silent no-op mode. */
59619
+ /** Whether persistence is active. False = in-memory-only mode. */
59619
59620
  writable;
59620
59621
  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
- }
59622
+ onWriteFailure;
59623
+ /**
59624
+ * Authoritative in-memory mirror. Every mutation updates this; reads
59625
+ * return from here. The jsonl file is only consulted at construction
59626
+ * (to replay prior state for `--resume`) and is otherwise write-only.
59627
+ */
59628
+ cache;
59629
+ constructor(filePathOrOptions) {
59630
+ const options = typeof filePathOrOptions === "string" ? { filePath: filePathOrOptions } : filePathOrOptions;
59631
+ this.onWriteFailure = options.onWriteFailure;
59632
+ const requestedPath = options.filePath ?? import_node_path29.default.join(".agent-relay", "workflow-runs.jsonl");
59633
+ const homeFallback = options.homeFallback ?? false;
59634
+ const { resolvedPath, writable } = _JsonFileWorkflowDb.resolveStoragePath(requestedPath, homeFallback);
59635
+ this.filePath = resolvedPath;
59629
59636
  this.writable = writable;
59637
+ this.cache = _JsonFileWorkflowDb.loadSnapshot(this.filePath);
59630
59638
  }
59631
- /** Returns false if the storage directory could not be created (permission error). */
59639
+ /** Returns false if persistence is not active (in-memory-only mode). */
59632
59640
  isWritable() {
59633
59641
  return this.writable;
59634
59642
  }
59643
+ /** Resolved path on disk. For tests + diagnostics. */
59644
+ getStoragePath() {
59645
+ return this.filePath;
59646
+ }
59635
59647
  hasStepOutputs(runId) {
59636
59648
  try {
59637
59649
  const dir = import_node_path29.default.join(import_node_path29.default.dirname(this.filePath), "step-outputs", runId);
@@ -59641,25 +59653,35 @@ var JsonFileWorkflowDb = class {
59641
59653
  }
59642
59654
  }
59643
59655
  // ── 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)));
59656
+ static resolveStoragePath(requestedPath, homeFallback) {
59657
+ const candidates = [requestedPath];
59658
+ if (homeFallback) {
59659
+ const base = import_node_path29.default.basename(requestedPath) || "workflow-runs.jsonl";
59660
+ candidates.push(import_node_path29.default.join(import_node_os9.default.homedir(), ".agent-relay", `workflow-runs-${base}`));
59661
+ }
59662
+ for (let i = 0; i < candidates.length; i++) {
59663
+ const candidate = candidates[i];
59664
+ const isLastCandidate = i === candidates.length - 1;
59665
+ try {
59666
+ (0, import_node_fs21.mkdirSync)(import_node_path29.default.dirname(candidate), { recursive: true });
59667
+ if (!isLastCandidate) {
59668
+ (0, import_node_fs21.accessSync)(import_node_path29.default.dirname(candidate), import_node_fs21.constants.W_OK);
59669
+ if ((0, import_node_fs21.existsSync)(candidate)) {
59670
+ (0, import_node_fs21.accessSync)(candidate, import_node_fs21.constants.W_OK);
59671
+ }
59672
+ }
59673
+ return { resolvedPath: candidate, writable: true };
59674
+ } catch {
59653
59675
  }
59654
59676
  }
59677
+ return { resolvedPath: requestedPath, writable: false };
59655
59678
  }
59656
- /** Read all lines and build the latest snapshot for each ID. */
59657
- snapshot() {
59679
+ static loadSnapshot(filePath) {
59658
59680
  const runs = /* @__PURE__ */ new Map();
59659
59681
  const steps = /* @__PURE__ */ new Map();
59660
59682
  let raw = "";
59661
59683
  try {
59662
- raw = (0, import_node_fs21.readFileSync)(this.filePath, "utf8");
59684
+ raw = (0, import_node_fs21.readFileSync)(filePath, "utf8");
59663
59685
  } catch {
59664
59686
  return { runs, steps };
59665
59687
  }
@@ -59679,34 +59701,57 @@ var JsonFileWorkflowDb = class {
59679
59701
  }
59680
59702
  return { runs, steps };
59681
59703
  }
59704
+ append(entry) {
59705
+ if (!this.writable)
59706
+ return;
59707
+ try {
59708
+ (0, import_node_fs21.appendFileSync)(this.filePath, JSON.stringify(entry) + "\n", "utf8");
59709
+ } catch (err) {
59710
+ this.onWriteFailure?.(err, this.filePath);
59711
+ if (!this.appendFailedOnce) {
59712
+ this.appendFailedOnce = true;
59713
+ 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)));
59714
+ }
59715
+ }
59716
+ }
59682
59717
  // ── WorkflowDb interface ─────────────────────────────────────────────────
59683
59718
  async insertRun(run) {
59719
+ this.cache.runs.set(run.id, { ...run });
59684
59720
  this.append({ kind: "run", row: run });
59685
59721
  }
59686
59722
  async updateRun(id, patch) {
59687
- const { runs } = this.snapshot();
59688
- const existing = runs.get(id);
59723
+ const existing = this.cache.runs.get(id);
59689
59724
  if (!existing)
59690
59725
  return;
59691
- this.append({ kind: "run", row: { ...existing, ...patch, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } });
59726
+ const updated = {
59727
+ ...existing,
59728
+ ...patch,
59729
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
59730
+ };
59731
+ this.cache.runs.set(id, updated);
59732
+ this.append({ kind: "run", row: updated });
59692
59733
  }
59693
59734
  async getRun(id) {
59694
- const { runs } = this.snapshot();
59695
- return runs.get(id) ?? null;
59735
+ return this.cache.runs.get(id) ?? null;
59696
59736
  }
59697
59737
  async insertStep(step) {
59738
+ this.cache.steps.set(step.id, { ...step });
59698
59739
  this.append({ kind: "step", row: step });
59699
59740
  }
59700
59741
  async updateStep(id, patch) {
59701
- const { steps } = this.snapshot();
59702
- const existing = steps.get(id);
59742
+ const existing = this.cache.steps.get(id);
59703
59743
  if (!existing)
59704
59744
  return;
59705
- this.append({ kind: "step", row: { ...existing, ...patch, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } });
59745
+ const updated = {
59746
+ ...existing,
59747
+ ...patch,
59748
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
59749
+ };
59750
+ this.cache.steps.set(id, updated);
59751
+ this.append({ kind: "step", row: updated });
59706
59752
  }
59707
59753
  async getStepsByRunId(runId) {
59708
- const { steps } = this.snapshot();
59709
- return Array.from(steps.values()).filter((s3) => s3.runId === runId);
59754
+ return Array.from(this.cache.steps.values()).filter((s3) => s3.runId === runId);
59710
59755
  }
59711
59756
  };
59712
59757
 
@@ -62090,13 +62135,13 @@ function getRepoFullNameFromPath(workingDirectory) {
62090
62135
  var import_node_fs25 = __toESM(require("node:fs"), 1);
62091
62136
  var import_node_path33 = __toESM(require("node:path"), 1);
62092
62137
  var import_node_https2 = __toESM(require("node:https"), 1);
62093
- var import_node_os10 = __toESM(require("node:os"), 1);
62138
+ var import_node_os11 = __toESM(require("node:os"), 1);
62094
62139
  var import_compare_versions = __toESM(require_umd(), 1);
62095
62140
  var PACKAGE_NAME = "agent-relay";
62096
62141
  var CHECK_INTERVAL_MS = 60 * 60 * 1e3;
62097
62142
  var NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
62098
62143
  function getCachePath() {
62099
- const cacheDir = import_node_path33.default.join(import_node_os10.default.homedir(), ".agent-relay");
62144
+ const cacheDir = import_node_path33.default.join(import_node_os11.default.homedir(), ".agent-relay");
62100
62145
  return import_node_path33.default.join(cacheDir, "update-cache.json");
62101
62146
  }
62102
62147
  function readCache() {
@@ -62397,7 +62442,7 @@ function validateModelForCli(cli, model) {
62397
62442
 
62398
62443
  // packages/utils/dist/relay-pty-path.js
62399
62444
  var import_node_fs26 = __toESM(require("node:fs"), 1);
62400
- var import_node_os11 = __toESM(require("node:os"), 1);
62445
+ var import_node_os12 = __toESM(require("node:os"), 1);
62401
62446
  var import_node_path34 = __toESM(require("node:path"), 1);
62402
62447
  var SUPPORTED_PLATFORMS = {
62403
62448
  darwin: {
@@ -62410,20 +62455,20 @@ var SUPPORTED_PLATFORMS = {
62410
62455
  }
62411
62456
  };
62412
62457
  function getPlatformBinaryName() {
62413
- const platform2 = import_node_os11.default.platform();
62414
- const arch = import_node_os11.default.arch();
62458
+ const platform2 = import_node_os12.default.platform();
62459
+ const arch = import_node_os12.default.arch();
62415
62460
  return SUPPORTED_PLATFORMS[platform2]?.[arch] ?? null;
62416
62461
  }
62417
62462
  function isPlatformSupported() {
62418
- const platform2 = import_node_os11.default.platform();
62419
- const arch = import_node_os11.default.arch();
62463
+ const platform2 = import_node_os12.default.platform();
62464
+ const arch = import_node_os12.default.arch();
62420
62465
  return SUPPORTED_PLATFORMS[platform2]?.[arch] !== void 0;
62421
62466
  }
62422
62467
  function getSupportedPlatforms() {
62423
62468
  const platforms = [];
62424
- for (const [os11, archs] of Object.entries(SUPPORTED_PLATFORMS)) {
62469
+ for (const [os12, archs] of Object.entries(SUPPORTED_PLATFORMS)) {
62425
62470
  for (const arch of Object.keys(archs)) {
62426
- platforms.push(`${os11}-${arch}`);
62471
+ platforms.push(`${os12}-${arch}`);
62427
62472
  }
62428
62473
  }
62429
62474
  return platforms.join(", ");
@@ -62536,7 +62581,7 @@ function isPlatformCompatibleBinary(filePath) {
62536
62581
  return false;
62537
62582
  }
62538
62583
  const magic = header.readUInt32BE(0);
62539
- const platform2 = import_node_os11.default.platform();
62584
+ const platform2 = import_node_os12.default.platform();
62540
62585
  if (platform2 === "darwin") {
62541
62586
  return isMachOBinary(magic);
62542
62587
  }
@@ -63171,7 +63216,7 @@ var import_node_child_process10 = require("node:child_process");
63171
63216
  var import_node_crypto15 = __toESM(require("node:crypto"), 1);
63172
63217
  var import_node_path35 = __toESM(require("node:path"), 1);
63173
63218
  var import_node_fs27 = __toESM(require("node:fs"), 1);
63174
- var import_node_os12 = __toESM(require("node:os"), 1);
63219
+ var import_node_os13 = __toESM(require("node:os"), 1);
63175
63220
  function getGlobalBaseDir2() {
63176
63221
  if (process.env.AGENT_RELAY_DATA_DIR) {
63177
63222
  return process.env.AGENT_RELAY_DATA_DIR;
@@ -63180,7 +63225,7 @@ function getGlobalBaseDir2() {
63180
63225
  if (xdgDataHome) {
63181
63226
  return import_node_path35.default.join(xdgDataHome, "agent-relay");
63182
63227
  }
63183
- return import_node_path35.default.join(import_node_os12.default.homedir(), ".agent-relay");
63228
+ return import_node_path35.default.join(import_node_os13.default.homedir(), ".agent-relay");
63184
63229
  }
63185
63230
  var GLOBAL_BASE_DIR2 = getGlobalBaseDir2();
63186
63231
  var PROJECT_DATA_DIR = ".agent-relay";
@@ -63223,10 +63268,10 @@ function getProjectPaths2(projectRoot) {
63223
63268
  // packages/config/dist/trajectory-config.js
63224
63269
  var import_node_fs28 = require("node:fs");
63225
63270
  var import_node_path36 = require("node:path");
63226
- var import_node_os13 = require("node:os");
63271
+ var import_node_os14 = require("node:os");
63227
63272
  var import_node_crypto16 = require("node:crypto");
63228
63273
  function getAgentRelayConfigDir() {
63229
- return process.env.AGENT_RELAY_CONFIG_DIR ?? (0, import_node_path36.join)((0, import_node_os13.homedir)(), ".config", "agent-relay");
63274
+ return process.env.AGENT_RELAY_CONFIG_DIR ?? (0, import_node_path36.join)((0, import_node_os14.homedir)(), ".config", "agent-relay");
63230
63275
  }
63231
63276
  var configCache = null;
63232
63277
  function getRelayConfigPath(_projectRoot) {
@@ -63270,7 +63315,7 @@ function getProjectHash(projectRoot) {
63270
63315
  }
63271
63316
  function getUserTrajectoriesDir(projectRoot) {
63272
63317
  const projectHash = getProjectHash(projectRoot);
63273
- const configDir = process.env.XDG_CONFIG_HOME || (0, import_node_path36.join)((0, import_node_os13.homedir)(), ".config");
63318
+ const configDir = process.env.XDG_CONFIG_HOME || (0, import_node_path36.join)((0, import_node_os14.homedir)(), ".config");
63274
63319
  return (0, import_node_path36.join)(configDir, "agent-relay", "trajectories", projectHash);
63275
63320
  }
63276
63321
  function getRepoTrajectoriesDir(projectRoot) {
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
3
  export declare const VERSION: string;
4
+ export declare const SDK_VERSION: string | undefined;
4
5
  export declare function createProgram(): Command;
5
- export declare function runCli(argv?: string[]): Command;
6
+ export declare function runCli(argv?: string[]): Promise<Command>;
6
7
  //# sourceMappingURL=bootstrap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/cli/bootstrap.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoDpC,eAAO,MAAM,OAAO,QAAsB,CAAC;AAiC3C,wBAAgB,aAAa,IAAI,OAAO,CAoBvC;AAED,wBAAgB,MAAM,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAK7D"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/cli/bootstrap.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsDpC,eAAO,MAAM,OAAO,QAAsB,CAAC;AAkB3C,eAAO,MAAM,WAAW,oBAAsB,CAAC;AA0K/C,wBAAgB,aAAa,IAAI,OAAO,CAoBvC;AAaD,wBAAsB,MAAM,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAiE5E"}