agent-relay 17.2.1 → 18.0.0

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 (243) hide show
  1. package/README.md +45 -270
  2. package/dist/cli/agent-relay-mcp.d.ts.map +1 -1
  3. package/dist/cli/agent-relay-mcp.js +6 -5
  4. package/dist/cli/agent-relay-mcp.js.map +1 -1
  5. package/dist/cli/bootstrap.d.ts +1 -1
  6. package/dist/cli/bootstrap.d.ts.map +1 -1
  7. package/dist/cli/bootstrap.js +11 -29
  8. package/dist/cli/bootstrap.js.map +1 -1
  9. package/dist/cli/commands/agent.d.ts.map +1 -1
  10. package/dist/cli/commands/agent.js +3 -2
  11. package/dist/cli/commands/agent.js.map +1 -1
  12. package/dist/cli/commands/cloud-integration.d.ts.map +1 -1
  13. package/dist/cli/commands/cloud-integration.js +2 -1
  14. package/dist/cli/commands/cloud-integration.js.map +1 -1
  15. package/dist/cli/commands/cloud-room.d.ts.map +1 -1
  16. package/dist/cli/commands/cloud-room.js +2 -1
  17. package/dist/cli/commands/cloud-room.js.map +1 -1
  18. package/dist/cli/commands/cloud-v1-deprecations.d.ts +4 -6
  19. package/dist/cli/commands/cloud-v1-deprecations.d.ts.map +1 -1
  20. package/dist/cli/commands/cloud-v1-deprecations.js +4 -6
  21. package/dist/cli/commands/cloud-v1-deprecations.js.map +1 -1
  22. package/dist/cli/commands/cloud-worker.d.ts +1 -1
  23. package/dist/cli/commands/cloud-worker.d.ts.map +1 -1
  24. package/dist/cli/commands/cloud-worker.js +42 -31
  25. package/dist/cli/commands/cloud-worker.js.map +1 -1
  26. package/dist/cli/commands/cloud.d.ts.map +1 -1
  27. package/dist/cli/commands/cloud.js +6 -7
  28. package/dist/cli/commands/cloud.js.map +1 -1
  29. package/dist/cli/commands/core.d.ts +3 -91
  30. package/dist/cli/commands/core.d.ts.map +1 -1
  31. package/dist/cli/commands/core.js +5 -254
  32. package/dist/cli/commands/core.js.map +1 -1
  33. package/dist/cli/commands/fleet-agent.d.ts +9 -54
  34. package/dist/cli/commands/fleet-agent.d.ts.map +1 -1
  35. package/dist/cli/commands/fleet-agent.js +105 -314
  36. package/dist/cli/commands/fleet-agent.js.map +1 -1
  37. package/dist/cli/commands/fleet.d.ts +0 -3
  38. package/dist/cli/commands/fleet.d.ts.map +1 -1
  39. package/dist/cli/commands/fleet.js +48 -267
  40. package/dist/cli/commands/fleet.js.map +1 -1
  41. package/dist/cli/commands/init.js +1 -1
  42. package/dist/cli/commands/init.js.map +1 -1
  43. package/dist/cli/commands/integration-cleanup-journal.d.ts +6 -2
  44. package/dist/cli/commands/integration-cleanup-journal.d.ts.map +1 -1
  45. package/dist/cli/commands/integration-cleanup-journal.js +611 -134
  46. package/dist/cli/commands/integration-cleanup-journal.js.map +1 -1
  47. package/dist/cli/commands/integration-recipient.d.ts +0 -17
  48. package/dist/cli/commands/integration-recipient.d.ts.map +1 -1
  49. package/dist/cli/commands/integration-recipient.js +1 -104
  50. package/dist/cli/commands/integration-recipient.js.map +1 -1
  51. package/dist/cli/commands/integration.d.ts +7 -3
  52. package/dist/cli/commands/integration.d.ts.map +1 -1
  53. package/dist/cli/commands/integration.js +37 -82
  54. package/dist/cli/commands/integration.js.map +1 -1
  55. package/dist/cli/commands/local-workflow.d.ts +1 -1
  56. package/dist/cli/commands/local-workflow.d.ts.map +1 -1
  57. package/dist/cli/commands/local-workflow.js +20 -6
  58. package/dist/cli/commands/local-workflow.js.map +1 -1
  59. package/dist/cli/commands/node.d.ts +18 -20
  60. package/dist/cli/commands/node.d.ts.map +1 -1
  61. package/dist/cli/commands/node.js +42 -272
  62. package/dist/cli/commands/node.js.map +1 -1
  63. package/dist/cli/commands/product-surfaces.js +2 -2
  64. package/dist/cli/commands/session.d.ts.map +1 -1
  65. package/dist/cli/commands/session.js +2 -1
  66. package/dist/cli/commands/session.js.map +1 -1
  67. package/dist/cli/commands/skills.d.ts.map +1 -1
  68. package/dist/cli/commands/skills.js +2 -1
  69. package/dist/cli/commands/skills.js.map +1 -1
  70. package/dist/cli/commands/status.d.ts +1 -7
  71. package/dist/cli/commands/status.d.ts.map +1 -1
  72. package/dist/cli/commands/status.js +2 -28
  73. package/dist/cli/commands/status.js.map +1 -1
  74. package/dist/cli/commands/workspace.d.ts.map +1 -1
  75. package/dist/cli/commands/workspace.js +2 -2
  76. package/dist/cli/commands/workspace.js.map +1 -1
  77. package/dist/cli/index.d.ts.map +1 -1
  78. package/dist/cli/index.js +1 -3
  79. package/dist/cli/index.js.map +1 -1
  80. package/dist/cli/lib/agent-relay-cli-reentry.d.ts +37 -0
  81. package/dist/cli/lib/agent-relay-cli-reentry.d.ts.map +1 -0
  82. package/dist/cli/lib/agent-relay-cli-reentry.js +40 -0
  83. package/dist/cli/lib/agent-relay-cli-reentry.js.map +1 -0
  84. package/dist/cli/lib/agent-tools-mcp.d.ts.map +1 -1
  85. package/dist/cli/lib/agent-tools-mcp.js +3 -2
  86. package/dist/cli/lib/agent-tools-mcp.js.map +1 -1
  87. package/dist/cli/lib/core-maintenance.d.ts +2 -3
  88. package/dist/cli/lib/core-maintenance.d.ts.map +1 -1
  89. package/dist/cli/lib/core-maintenance.js +3 -37
  90. package/dist/cli/lib/core-maintenance.js.map +1 -1
  91. package/dist/cli/lib/desktop-presence.js +1 -1
  92. package/dist/cli/lib/desktop-presence.js.map +1 -1
  93. package/dist/cli/lib/install-paths.d.ts +100 -0
  94. package/dist/cli/lib/install-paths.d.ts.map +1 -0
  95. package/dist/cli/lib/install-paths.js +157 -0
  96. package/dist/cli/lib/install-paths.js.map +1 -0
  97. package/dist/cli/lib/product-surface-store.d.ts.map +1 -1
  98. package/dist/cli/lib/product-surface-store.js +4 -1
  99. package/dist/cli/lib/product-surface-store.js.map +1 -1
  100. package/dist/cli/lib/relay-node.d.ts +7 -34
  101. package/dist/cli/lib/relay-node.d.ts.map +1 -1
  102. package/dist/cli/lib/relay-node.js +7 -182
  103. package/dist/cli/lib/relay-node.js.map +1 -1
  104. package/dist/cli/lib/removed-broker-command.d.ts +7 -0
  105. package/dist/cli/lib/removed-broker-command.d.ts.map +1 -0
  106. package/dist/cli/lib/removed-broker-command.js +13 -0
  107. package/dist/cli/lib/removed-broker-command.js.map +1 -0
  108. package/dist/cli/lib/sdk-client.d.ts +4 -4
  109. package/dist/cli/lib/sdk-client.js +4 -4
  110. package/dist/cli/lib/self-update.d.ts +8 -19
  111. package/dist/cli/lib/self-update.d.ts.map +1 -1
  112. package/dist/cli/lib/self-update.js +14 -28
  113. package/dist/cli/lib/self-update.js.map +1 -1
  114. package/dist/cli/lib/skills-install.d.ts.map +1 -1
  115. package/dist/cli/lib/skills-install.js +3 -2
  116. package/dist/cli/lib/skills-install.js.map +1 -1
  117. package/dist/cli/telemetry/events.d.ts +4 -1
  118. package/dist/cli/telemetry/events.d.ts.map +1 -1
  119. package/package.json +9 -14
  120. package/dist/auto/classifier.d.ts +0 -29
  121. package/dist/auto/classifier.d.ts.map +0 -1
  122. package/dist/auto/classifier.js +0 -126
  123. package/dist/auto/classifier.js.map +0 -1
  124. package/dist/auto/composer.d.ts +0 -105
  125. package/dist/auto/composer.d.ts.map +0 -1
  126. package/dist/auto/composer.js +0 -454
  127. package/dist/auto/composer.js.map +0 -1
  128. package/dist/auto/director-prompt.d.ts +0 -25
  129. package/dist/auto/director-prompt.d.ts.map +0 -1
  130. package/dist/auto/director-prompt.js +0 -53
  131. package/dist/auto/director-prompt.js.map +0 -1
  132. package/dist/auto/index.d.ts +0 -15
  133. package/dist/auto/index.d.ts.map +0 -1
  134. package/dist/auto/index.js +0 -13
  135. package/dist/auto/index.js.map +0 -1
  136. package/dist/cli/commands/local-agent.d.ts +0 -74
  137. package/dist/cli/commands/local-agent.d.ts.map +0 -1
  138. package/dist/cli/commands/local-agent.js +0 -969
  139. package/dist/cli/commands/local-agent.js.map +0 -1
  140. package/dist/cli/lib/attach-broker.d.ts +0 -17
  141. package/dist/cli/lib/attach-broker.d.ts.map +0 -1
  142. package/dist/cli/lib/attach-broker.js +0 -27
  143. package/dist/cli/lib/attach-broker.js.map +0 -1
  144. package/dist/cli/lib/attach-drive.d.ts +0 -376
  145. package/dist/cli/lib/attach-drive.d.ts.map +0 -1
  146. package/dist/cli/lib/attach-drive.js +0 -1212
  147. package/dist/cli/lib/attach-drive.js.map +0 -1
  148. package/dist/cli/lib/attach-fleet-node.d.ts +0 -85
  149. package/dist/cli/lib/attach-fleet-node.d.ts.map +0 -1
  150. package/dist/cli/lib/attach-fleet-node.js +0 -1347
  151. package/dist/cli/lib/attach-fleet-node.js.map +0 -1
  152. package/dist/cli/lib/attach-input-recovery.d.ts +0 -190
  153. package/dist/cli/lib/attach-input-recovery.d.ts.map +0 -1
  154. package/dist/cli/lib/attach-input-recovery.js +0 -559
  155. package/dist/cli/lib/attach-input-recovery.js.map +0 -1
  156. package/dist/cli/lib/attach-mode.d.ts +0 -2
  157. package/dist/cli/lib/attach-mode.d.ts.map +0 -1
  158. package/dist/cli/lib/attach-mode.js +0 -2
  159. package/dist/cli/lib/attach-mode.js.map +0 -1
  160. package/dist/cli/lib/attach-native.d.ts +0 -27
  161. package/dist/cli/lib/attach-native.d.ts.map +0 -1
  162. package/dist/cli/lib/attach-native.js +0 -267
  163. package/dist/cli/lib/attach-native.js.map +0 -1
  164. package/dist/cli/lib/attach-passthrough.d.ts +0 -193
  165. package/dist/cli/lib/attach-passthrough.d.ts.map +0 -1
  166. package/dist/cli/lib/attach-passthrough.js +0 -778
  167. package/dist/cli/lib/attach-passthrough.js.map +0 -1
  168. package/dist/cli/lib/attach-remote-node.d.ts +0 -21
  169. package/dist/cli/lib/attach-remote-node.d.ts.map +0 -1
  170. package/dist/cli/lib/attach-remote-node.js +0 -133
  171. package/dist/cli/lib/attach-remote-node.js.map +0 -1
  172. package/dist/cli/lib/attach-view.d.ts +0 -177
  173. package/dist/cli/lib/attach-view.d.ts.map +0 -1
  174. package/dist/cli/lib/attach-view.js +0 -455
  175. package/dist/cli/lib/attach-view.js.map +0 -1
  176. package/dist/cli/lib/attach.d.ts +0 -555
  177. package/dist/cli/lib/attach.d.ts.map +0 -1
  178. package/dist/cli/lib/attach.js +0 -1180
  179. package/dist/cli/lib/attach.js.map +0 -1
  180. package/dist/cli/lib/broker-connection.d.ts +0 -65
  181. package/dist/cli/lib/broker-connection.d.ts.map +0 -1
  182. package/dist/cli/lib/broker-connection.js +0 -144
  183. package/dist/cli/lib/broker-connection.js.map +0 -1
  184. package/dist/cli/lib/broker-lifecycle.d.ts +0 -220
  185. package/dist/cli/lib/broker-lifecycle.d.ts.map +0 -1
  186. package/dist/cli/lib/broker-lifecycle.js +0 -2290
  187. package/dist/cli/lib/broker-lifecycle.js.map +0 -1
  188. package/dist/cli/lib/broker-process-identity.d.ts +0 -38
  189. package/dist/cli/lib/broker-process-identity.d.ts.map +0 -1
  190. package/dist/cli/lib/broker-process-identity.js +0 -304
  191. package/dist/cli/lib/broker-process-identity.js.map +0 -1
  192. package/dist/cli/lib/client-factory.d.ts +0 -44
  193. package/dist/cli/lib/client-factory.d.ts.map +0 -1
  194. package/dist/cli/lib/client-factory.js +0 -64
  195. package/dist/cli/lib/client-factory.js.map +0 -1
  196. package/dist/cli/lib/collect-with-retry.d.ts +0 -24
  197. package/dist/cli/lib/collect-with-retry.d.ts.map +0 -1
  198. package/dist/cli/lib/collect-with-retry.js +0 -33
  199. package/dist/cli/lib/collect-with-retry.js.map +0 -1
  200. package/dist/cli/lib/fleet-attach-target.d.ts +0 -18
  201. package/dist/cli/lib/fleet-attach-target.d.ts.map +0 -1
  202. package/dist/cli/lib/fleet-attach-target.js +0 -57
  203. package/dist/cli/lib/fleet-attach-target.js.map +0 -1
  204. package/dist/cli/lib/fleet-hint.d.ts +0 -49
  205. package/dist/cli/lib/fleet-hint.d.ts.map +0 -1
  206. package/dist/cli/lib/fleet-hint.js +0 -113
  207. package/dist/cli/lib/fleet-hint.js.map +0 -1
  208. package/dist/cli/lib/fleet-sidecar.d.ts +0 -43
  209. package/dist/cli/lib/fleet-sidecar.d.ts.map +0 -1
  210. package/dist/cli/lib/fleet-sidecar.js +0 -84
  211. package/dist/cli/lib/fleet-sidecar.js.map +0 -1
  212. package/dist/cli/lib/join-ticket.d.ts +0 -22
  213. package/dist/cli/lib/join-ticket.d.ts.map +0 -1
  214. package/dist/cli/lib/join-ticket.js +0 -96
  215. package/dist/cli/lib/join-ticket.js.map +0 -1
  216. package/dist/cli/lib/node-claim.d.ts +0 -468
  217. package/dist/cli/lib/node-claim.d.ts.map +0 -1
  218. package/dist/cli/lib/node-claim.js +0 -1349
  219. package/dist/cli/lib/node-claim.js.map +0 -1
  220. package/dist/cli/lib/node-definition-loader.d.ts +0 -19
  221. package/dist/cli/lib/node-definition-loader.d.ts.map +0 -1
  222. package/dist/cli/lib/node-definition-loader.js +0 -143
  223. package/dist/cli/lib/node-definition-loader.js.map +0 -1
  224. package/dist/cli/lib/node-provider-child.d.ts +0 -129
  225. package/dist/cli/lib/node-provider-child.d.ts.map +0 -1
  226. package/dist/cli/lib/node-provider-child.js +0 -755
  227. package/dist/cli/lib/node-provider-child.js.map +0 -1
  228. package/dist/cli/lib/predictive-echo-screen.d.ts +0 -48
  229. package/dist/cli/lib/predictive-echo-screen.d.ts.map +0 -1
  230. package/dist/cli/lib/predictive-echo-screen.js +0 -74
  231. package/dist/cli/lib/predictive-echo-screen.js.map +0 -1
  232. package/dist/cli/lib/project-broker-client.d.ts +0 -4
  233. package/dist/cli/lib/project-broker-client.d.ts.map +0 -1
  234. package/dist/cli/lib/project-broker-client.js +0 -12
  235. package/dist/cli/lib/project-broker-client.js.map +0 -1
  236. package/dist/cli/lib/reflex-capture.d.ts +0 -41
  237. package/dist/cli/lib/reflex-capture.d.ts.map +0 -1
  238. package/dist/cli/lib/reflex-capture.js +0 -128
  239. package/dist/cli/lib/reflex-capture.js.map +0 -1
  240. package/dist/cli/lib/workspace-env.d.ts +0 -8
  241. package/dist/cli/lib/workspace-env.d.ts.map +0 -1
  242. package/dist/cli/lib/workspace-env.js +0 -16
  243. package/dist/cli/lib/workspace-env.js.map +0 -1
@@ -1,64 +0,0 @@
1
- import { HarnessDriverClient } from '@agent-relay/harness-driver';
2
- import { createNativeHarnessLaunch, resolveHarnessRuntime, } from '@agent-relay/harnesses';
3
- const NATIVE_SIDECAR_COMMAND = '__ai-sdk-sidecar';
4
- /** Bun standalone executables must re-enter the bundled CLI to run embedded sidecar code. */
5
- export function nativeSidecarLaunch(argv = process.argv, execPath = process.execPath) {
6
- const bundledEntrypoint = argv[1] ?? '';
7
- if (argv[0] === 'bun' && bundledEntrypoint.startsWith('/$bunfs/root/')) {
8
- return { command: execPath, args: [NATIVE_SIDECAR_COMMAND] };
9
- }
10
- return undefined;
11
- }
12
- export function resolvedSpawnRuntime(options) {
13
- return resolveHarnessRuntime(options.cli, options.runtime);
14
- }
15
- export async function createRuntimeClient(options) {
16
- const { cwd, channels = ['general'], binaryPath = process.env.AGENT_RELAY_BIN, binaryArgs, brokerName, env = process.env, preferConnect = false, inheritFds, onSpawn, onStderr, onStep, } = options;
17
- if (preferConnect) {
18
- try {
19
- // Await so an async connect rejection is caught here, not leaked to the
20
- // caller — otherwise the fallback spawn below never runs.
21
- return await HarnessDriverClient.connect({ cwd });
22
- }
23
- catch {
24
- // Fall through to spawning a fresh broker.
25
- }
26
- }
27
- return HarnessDriverClient.spawn({
28
- binaryPath: binaryPath || undefined,
29
- binaryArgs,
30
- brokerName,
31
- channels,
32
- cwd,
33
- env: env,
34
- ...(inheritFds?.length ? { inheritFds } : {}),
35
- ...(onSpawn ? { onSpawn } : {}),
36
- onStderr,
37
- onStep,
38
- });
39
- }
40
- export async function spawnAgentWithClient(client, options) {
41
- const runtime = resolvedSpawnRuntime(options);
42
- if (runtime === 'pty') {
43
- const { runtime: _runtime, ...ptyOptions } = options;
44
- await client.spawnPty(ptyOptions);
45
- return;
46
- }
47
- if (options.spawnMode && options.spawnMode !== 'interactive') {
48
- throw new Error('Native harnesses currently support only interactive spawn mode');
49
- }
50
- if (options.exitAfterTask) {
51
- throw new Error('Native harnesses do not currently support --exit-after-task');
52
- }
53
- const launch = createNativeHarnessLaunch(options.cli, {
54
- runtime: 'native',
55
- name: options.name,
56
- channels: options.channels,
57
- task: options.task,
58
- model: options.model,
59
- cwd: options.cwd,
60
- }, nativeSidecarLaunch());
61
- const { transport: _transport, ...headlessInput } = launch;
62
- await client.spawnHeadless(headlessInput);
63
- }
64
- //# sourceMappingURL=client-factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-factory.js","sourceRoot":"","sources":["../../../src/cli/lib/client-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,6BAA6B,CAAC;AACvF,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GAGtB,MAAM,wBAAwB,CAAC;AAqChC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAElD,6FAA6F;AAC7F,MAAM,UAAU,mBAAmB,CACjC,OAA0B,OAAO,CAAC,IAAI,EACtC,QAAQ,GAAG,OAAO,CAAC,QAAQ;IAE3B,MAAM,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACxC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,iBAAiB,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACvE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,sBAAsB,CAAC,EAAE,CAAC;IAC/D,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,OAAoD;IAEpD,OAAO,qBAAqB,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAmC;IAC3E,MAAM,EACJ,GAAG,EACH,QAAQ,GAAG,CAAC,SAAS,CAAC,EACtB,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe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IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,MAAM,GAAG,yBAAyB,CACtC,OAAO,CAAC,GAAG,EACX;QACE,OAAO,EAAE,QAAQ;QACjB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,EACD,mBAAmB,EAAE,CACtB,CAAC;IACF,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC;IAC3D,MAAM,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;AAC5C,CAAC"}
@@ -1,24 +0,0 @@
1
- export interface CollectWithRetryOptions {
2
- retries?: number;
3
- baseDelayMs?: number;
4
- sleep?: (ms: number) => Promise<void>;
5
- /** Return false for terminal failures that must be surfaced immediately. */
6
- shouldRetry?: (error: unknown, attempt: number) => boolean;
7
- }
8
- /**
9
- * Run a bounded operation with the fleet CLI's small retry delay.
10
- *
11
- * The result records whether another attempt actually ran. Callers that need
12
- * richer failure metadata can retain the thrown value in their operation;
13
- * this helper deliberately keeps the existing fleet-list rendering contract.
14
- */
15
- export declare function collectWithRetry<T>(label: string, fn: () => Promise<T>, options?: CollectWithRetryOptions): Promise<{
16
- ok: true;
17
- value: T;
18
- retried: boolean;
19
- } | {
20
- ok: false;
21
- error: string;
22
- retried: boolean;
23
- }>;
24
- //# sourceMappingURL=collect-with-retry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collect-with-retry.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/collect-with-retry.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,4EAA4E;IAC5E,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5D;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAsBpG"}
@@ -1,33 +0,0 @@
1
- /**
2
- * Run a bounded operation with the fleet CLI's small retry delay.
3
- *
4
- * The result records whether another attempt actually ran. Callers that need
5
- * richer failure metadata can retain the thrown value in their operation;
6
- * this helper deliberately keeps the existing fleet-list rendering contract.
7
- */
8
- export async function collectWithRetry(label, fn, options) {
9
- const retries = options?.retries ?? 1;
10
- const baseDelay = options?.baseDelayMs ?? 500;
11
- const sleep = options?.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
12
- let lastError;
13
- let attempts = 0;
14
- for (let attempt = 0; attempt <= retries; attempt += 1) {
15
- attempts += 1;
16
- try {
17
- const value = await fn();
18
- return { ok: true, value, retried: attempt > 0 };
19
- }
20
- catch (error) {
21
- lastError = error;
22
- if (attempt >= retries || options?.shouldRetry?.(error, attempt + 1) === false)
23
- break;
24
- // Keep the established fleet-list delay shape while making later
25
- // attempts wait slightly longer, without introducing test randomness.
26
- const delay = baseDelay + Math.floor(baseDelay * (attempt / (retries + 1)));
27
- await sleep(delay);
28
- }
29
- }
30
- const message = lastError instanceof Error ? lastError.message : String(lastError);
31
- return { ok: false, error: `${label}: ${message}`, retried: attempts > 1 };
32
- }
33
- //# sourceMappingURL=collect-with-retry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collect-with-retry.js","sourceRoot":"","sources":["../../../src/cli/lib/collect-with-retry.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAa,EACb,EAAoB,EACpB,OAAiC;IAEjC,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,OAAO,EAAE,WAAW,IAAI,GAAG,CAAC;IAC9C,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5F,IAAI,SAAkB,CAAC;IACvB,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QACvD,QAAQ,IAAI,CAAC,CAAC;QACd,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,EAAE,EAAE,CAAC;YACzB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,EAAE,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,GAAG,KAAK,CAAC;YAClB,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,EAAE,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,KAAK;gBAAE,MAAM;YACtF,iEAAiE;YACjE,sEAAsE;YACtE,MAAM,KAAK,GAAG,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,OAAO,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5E,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAG,SAAS,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACnF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,KAAK,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,GAAG,CAAC,EAAE,CAAC;AAC7E,CAAC"}
@@ -1,18 +0,0 @@
1
- import type { AgentRelay } from '@agent-relay/sdk';
2
- import { resolveWorkspaceSelection } from './sdk-client.js';
3
- export interface FleetAttachTarget {
4
- node: string;
5
- baseUrl?: string;
6
- }
7
- export interface FleetAttachResolution {
8
- target?: FleetAttachTarget;
9
- error?: string;
10
- }
11
- export type CreateFleetRelay = () => AgentRelay;
12
- export type ResolveFleetTransport = () => {
13
- baseUrl?: string;
14
- };
15
- export type ResolveFleetSelection = typeof resolveWorkspaceSelection;
16
- /** Resolve a unique live fleet node for an agent name without exposing credentials. */
17
- export declare function resolveFleetAttachTarget(agentName: string, createRelay?: CreateFleetRelay, resolveTransport?: ResolveFleetTransport, readSelection?: ResolveFleetSelection): Promise<FleetAttachResolution>;
18
- //# sourceMappingURL=fleet-attach-target.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fleet-attach-target.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/fleet-attach-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AAI9D,OAAO,EAAwB,yBAAyB,EAA6B,MAAM,iBAAiB,CAAC;AAE7G,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC;AAChD,MAAM,MAAM,qBAAqB,GAAG,MAAM;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,MAAM,MAAM,qBAAqB,GAAG,OAAO,yBAAyB,CAAC;AAErE,uFAAuF;AACvF,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,MAAM,EACjB,WAAW,GAAE,gBAAuC,EACpD,gBAAgB,GAAE,qBAAiD,EACnE,aAAa,GAAE,qBAAiD,GAC/D,OAAO,CAAC,qBAAqB,CAAC,CAoDhC"}
@@ -1,57 +0,0 @@
1
- import { describeError } from './describe-error.js';
2
- import { isAvailableFleetNode, readRemoteLiveAgents } from './fleet-live-agents.js';
3
- import { createWorkspaceRelay, resolveWorkspaceSelection, resolveWorkspaceTransport } from './sdk-client.js';
4
- /** Resolve a unique live fleet node for an agent name without exposing credentials. */
5
- export async function resolveFleetAttachTarget(agentName, createRelay = createWorkspaceRelay, resolveTransport = resolveWorkspaceTransport, readSelection = resolveWorkspaceSelection) {
6
- let selection;
7
- try {
8
- selection = readSelection();
9
- }
10
- catch (error) {
11
- return {
12
- error: `Fleet attach routing could not read the persisted workspace session for '${agentName}'. ` +
13
- `Pass --node explicitly or repair the project session. (${describeError(error)})`,
14
- };
15
- }
16
- const knownRemoteSession = Boolean(selection?.relaycastRoute ||
17
- selection?.relaycastBaseUrl ||
18
- selection?.relaycastApiKey ||
19
- selection?.relaycastApiKeyRef);
20
- try {
21
- const relay = createRelay();
22
- const nodes = await relay.nodes.list();
23
- const matches = nodes.filter((node) => isAvailableFleetNode(node) &&
24
- readRemoteLiveAgents(node).agents.some((agent) => agent.name === agentName));
25
- if (matches.length === 0) {
26
- return knownRemoteSession
27
- ? { error: `Agent '${agentName}' has no live Fleet placement on the persisted remote session.` }
28
- : {};
29
- }
30
- if (matches.length > 1) {
31
- const labels = matches.map(nodeLabel).filter(Boolean).join(', ');
32
- return {
33
- error: `Agent '${agentName}' is running on multiple fleet nodes (${labels}). Pass --node to choose one.`,
34
- };
35
- }
36
- const node = matches[0];
37
- const label = nodeLabel(node);
38
- if (!label)
39
- return { error: `Agent '${agentName}' is on a fleet node without a usable node identity.` };
40
- const transport = resolveTransport();
41
- return { target: { node: label, ...(transport.baseUrl ? { baseUrl: transport.baseUrl } : {}) } };
42
- }
43
- catch (error) {
44
- // Automatic routing is opportunistic. A missing credential or unavailable
45
- // control plane must preserve the established local attach error path.
46
- return knownRemoteSession
47
- ? {
48
- error: `The persisted remote Fleet session could not resolve '${agentName}'. ` +
49
- `Check fleet liveness or pass --node explicitly. (${describeError(error)})`,
50
- }
51
- : {};
52
- }
53
- }
54
- function nodeLabel(node) {
55
- return [node.nodeId, node.id, node.name].find((candidate) => typeof candidate === 'string' && candidate.trim().length > 0);
56
- }
57
- //# sourceMappingURL=fleet-attach-target.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fleet-attach-target.js","sourceRoot":"","sources":["../../../src/cli/lib/fleet-attach-target.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAgB7G,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,SAAiB,EACjB,cAAgC,oBAAoB,EACpD,mBAA0C,yBAAyB,EACnE,gBAAuC,yBAAyB;IAEhE,IAAI,SAA4C,CAAC;IACjD,IAAI,CAAC;QACH,SAAS,GAAG,aAAa,EAAE,CAAC;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AAC,CAAC;QAC9B,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,UAAU,SAAS,sDAAsD,EAAE,CAAC;QACxG,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAC;QACrC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACnG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,0EAA0E;QAC1E,uEAAuE;QACvE,OAAO,kBAAkB;YACvB,CAAC,CAAC;gBACE,KAAK,EACH,yDAAyD,SAAS,KAAK;oBACvE,oDAAoD,aAAa,CAAC,KAAK,CAAC,GAAG;aAC9E;YACH,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAe;IAChC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAC3C,CAAC,SAAS,EAAuB,EAAE,CAAC,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CACjG,CAAC;AACJ,CAAC"}
@@ -1,49 +0,0 @@
1
- /**
2
- * Best-effort workspace registry lookup for improving "no agent named X"
3
- * error messages across attach-style verbs (view, drive, passthrough).
4
- *
5
- * When a local broker returns 404 for an agent name, that agent may still be
6
- * registered workspace-wide on a different fleet node. This helper probes the
7
- * workspace registry and returns a human-readable placement description so
8
- * attach verbs can emit:
9
- *
10
- * Error: agent 'X' is registered on node 'finn-mini'; cross-node attach is
11
- * not yet supported — run `agent-relay node agent attach X` on that machine
12
- *
13
- * instead of the indistinguishable "no agent named 'X'" a local-only lookup
14
- * produces.
15
- *
16
- * All errors are silently swallowed — the caller always falls back to the
17
- * original message on any failure (no credentials, network error, etc.).
18
- *
19
- * **Workspace-binding caveat:** This helper probes the workspace resolved from
20
- * ambient environment variables (the same workspace `agent-relay agent list`
21
- * uses). When attach is directed at a broker in a different workspace (via
22
- * `--broker-url` / `--api-key`), the workspace this lookup targets may differ
23
- * from the one the 404 came from. A same-named agent in the ambient workspace
24
- * can produce a false-positive cross-node hint, or a genuinely remote agent
25
- * (known only in the target broker's workspace) can be missed. For Phase 1
26
- * this is acceptable — the hint is informational only and cannot change attach
27
- * semantics. Phase 2's `--node` flag will make node resolution explicit.
28
- */
29
- import type { AgentRelay } from '@agent-relay/sdk';
30
- /**
31
- * Injectable factory — lets callers (and tests) substitute a workspace
32
- * client without hitting the network.
33
- */
34
- export type CreateRelayFn = () => AgentRelay;
35
- /**
36
- * Try to find where `agentName` is registered in the workspace and return a
37
- * human-readable description of its fleet placement, e.g.
38
- * `"on node 'finn-mini'"`. Returns `null` when:
39
- *
40
- * - The agent is not in the workspace registry (it truly doesn't exist).
41
- * - The agent is in the registry but has no fleet placement.
42
- * - Workspace credentials are not available in the environment.
43
- * - Any network or parse error occurs.
44
- *
45
- * This function is designed to be called on the error path only — it always
46
- * resolves, never rejects.
47
- */
48
- export declare function resolveFleetHint(agentName: string, createRelay?: CreateRelayFn): Promise<string | null>;
49
- //# sourceMappingURL=fleet-hint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fleet-hint.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/fleet-hint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKnD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,WAAW,GAAE,aAAoC,GAChD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkExB"}
@@ -1,113 +0,0 @@
1
- /**
2
- * Best-effort workspace registry lookup for improving "no agent named X"
3
- * error messages across attach-style verbs (view, drive, passthrough).
4
- *
5
- * When a local broker returns 404 for an agent name, that agent may still be
6
- * registered workspace-wide on a different fleet node. This helper probes the
7
- * workspace registry and returns a human-readable placement description so
8
- * attach verbs can emit:
9
- *
10
- * Error: agent 'X' is registered on node 'finn-mini'; cross-node attach is
11
- * not yet supported — run `agent-relay node agent attach X` on that machine
12
- *
13
- * instead of the indistinguishable "no agent named 'X'" a local-only lookup
14
- * produces.
15
- *
16
- * All errors are silently swallowed — the caller always falls back to the
17
- * original message on any failure (no credentials, network error, etc.).
18
- *
19
- * **Workspace-binding caveat:** This helper probes the workspace resolved from
20
- * ambient environment variables (the same workspace `agent-relay agent list`
21
- * uses). When attach is directed at a broker in a different workspace (via
22
- * `--broker-url` / `--api-key`), the workspace this lookup targets may differ
23
- * from the one the 404 came from. A same-named agent in the ambient workspace
24
- * can produce a false-positive cross-node hint, or a genuinely remote agent
25
- * (known only in the target broker's workspace) can be missed. For Phase 1
26
- * this is acceptable — the hint is informational only and cannot change attach
27
- * semantics. Phase 2's `--node` flag will make node resolution explicit.
28
- */
29
- import { createWorkspaceRelay } from './sdk-client.js';
30
- import { isAvailableFleetNode, readRemoteLiveAgents } from './fleet-live-agents.js';
31
- /**
32
- * Try to find where `agentName` is registered in the workspace and return a
33
- * human-readable description of its fleet placement, e.g.
34
- * `"on node 'finn-mini'"`. Returns `null` when:
35
- *
36
- * - The agent is not in the workspace registry (it truly doesn't exist).
37
- * - The agent is in the registry but has no fleet placement.
38
- * - Workspace credentials are not available in the environment.
39
- * - Any network or parse error occurs.
40
- *
41
- * This function is designed to be called on the error path only — it always
42
- * resolves, never rejects.
43
- */
44
- export async function resolveFleetHint(agentName, createRelay = createWorkspaceRelay) {
45
- try {
46
- let relay;
47
- try {
48
- relay = createRelay();
49
- }
50
- catch {
51
- // No workspace credentials in env — fall back to original message.
52
- return null;
53
- }
54
- let agent = null;
55
- try {
56
- agent = await relay.agents.get(agentName);
57
- }
58
- catch {
59
- // Not in the workspace agent registry (404), or we could not reach it.
60
- // This is the COMMON case for the agents this hint exists to describe:
61
- // a broker-spawned worker on a fleet node is not a workspace-registered
62
- // agent at all, so this lookup 404s for exactly the names an operator
63
- // most often mistypes into a cross-node attach. Fall through to the
64
- // roster scan below rather than giving up here (relay#1597).
65
- }
66
- const fleet = agent?.metadata?.fleet;
67
- const nodeId = typeof fleet === 'object' && fleet !== null ? fleet.nodeId : undefined;
68
- // Resolve the node's human-readable name by looking it up in the roster.
69
- // The same call also answers placement for a worker the agent registry
70
- // does not know about: every node advertises the set of workers it is
71
- // currently running on its heartbeat, so one `nodes.list()` covers both
72
- // paths with no extra round-trip.
73
- try {
74
- const nodes = await relay.nodes.list();
75
- if (typeof nodeId === 'string' && nodeId) {
76
- const node = nodes.find((n) => n.nodeId === nodeId || n.id === nodeId);
77
- if (node?.name)
78
- return `on node '${node.name}'`;
79
- // Registry knew the placement but the roster could not name the node.
80
- return `on node '${nodeId}'`;
81
- }
82
- for (const node of nodes) {
83
- // Only nodes that can currently host work. `nodes.list()` also returns
84
- // history, and an offline record still carries the live-agent names
85
- // from its last heartbeat — scanning those would point the operator at
86
- // a machine that stopped running the agent hours ago, or is not
87
- // running at all, which is worse than no hint.
88
- if (!isAvailableFleetNode(node))
89
- continue;
90
- if (!readRemoteLiveAgents(node).agents.some((live) => live.name === agentName))
91
- continue;
92
- // First NON-EMPTY identifier, not first non-nullish: `??` would select
93
- // an empty `name` and strand a node that has a perfectly good id.
94
- const label = [node.name, node.nodeId, node.id].find((candidate) => typeof candidate === 'string' && candidate.length > 0);
95
- // A node with no usable identifier at all is worse than no hint: "on
96
- // node 'undefined'" tells the operator nothing and looks like a bug.
97
- if (label)
98
- return `on node '${label}'`;
99
- }
100
- }
101
- catch {
102
- // Roster lookup failed — fall back to whatever the registry gave us.
103
- }
104
- if (typeof nodeId === 'string' && nodeId)
105
- return `on node '${nodeId}'`;
106
- return null;
107
- }
108
- catch {
109
- // Unexpected error in the outer try — never propagate.
110
- return null;
111
- }
112
- }
113
- //# sourceMappingURL=fleet-hint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fleet-hint.js","sourceRoot":"","sources":["../../../src/cli/lib/fleet-hint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAQpF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,SAAiB,EACjB,cAA6B,oBAAoB;IAEjD,IAAI,CAAC;QACH,IAAI,KAAiB,CAAC;QACtB,IAAI,CAAC;YACH,KAAK,GAAG,WAAW,EAAE,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,mEAAmE;YACnE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,KAAK,GAAkD,IAAI,CAAC;QAChE,IAAI,CAAC;YACH,KAAK,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC;YACP,uEAAuE;YACvE,uEAAuE;YACvE,wEAAwE;YACxE,sEAAsE;YACtE,oEAAoE;YACpE,6DAA6D;QAC/D,CAAC;QAED,MAAM,KAAK,GAAI,KAAK,EAAE,QAAgD,EAAE,KAAK,CAAC;QAC9E,MAAM,MAAM,GACV,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAE,KAAiC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QAEtG,yEAAyE;QACzE,uEAAuE;QACvE,sEAAsE;QACtE,wEAAwE;QACxE,kCAAkC;QAClC,IAAI,CAAC;Y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AAM;YAAE,OAAO,YAAY,MAAM,GAAG,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,uDAAuD;QACvD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1,43 +0,0 @@
1
- import { type FleetTriggerSyncClient } from '@agent-relay/fleet';
2
- import type { CoreTeamsConfig } from '../commands/core.js';
3
- /**
4
- * The minimum a node config has to expose to contribute to the broker's
5
- * advertised capacity: its capability names plus its agent cap. A full
6
- * {@link FleetNodeDefinition} satisfies this, and so does the descriptor
7
- * reported by a node definition served out-of-process (which the CLI never
8
- * loads in-process, so it has capability names but no handlers).
9
- */
10
- export type NodeCapacitySource = {
11
- capabilities: Readonly<Record<string, unknown>>;
12
- maxAgents?: number;
13
- };
14
- export declare function nodeCapacityHarnesses(teamsConfig: CoreTeamsConfig | null, definition?: NodeCapacitySource): string[];
15
- /**
16
- * Resolve the `AGENT_RELAY_NODE_HARNESSES` CSV the broker registers its capacity
17
- * from. A pre-set value is the operator's authoritative declaration of the node's
18
- * real capacity and is returned verbatim; otherwise it is computed from the project
19
- * via {@link nodeCapacityHarnesses}.
20
- */
21
- export declare function resolveNodeCapacityHarnesses(preset: string | undefined, teamsConfig: CoreTeamsConfig | null, definition?: NodeCapacitySource): string;
22
- /**
23
- * Resolve the `AGENT_RELAY_NODE_MAX_AGENTS` value the broker registers its
24
- * provider-level agent capacity from. A pre-set value is the operator's
25
- * authoritative declaration of the node's real capacity and is returned
26
- * verbatim; otherwise the node definition's `maxAgents` wins. Returns
27
- * `undefined` when neither declares a cap — or when the declared cap is
28
- * outside the shared range the broker can parse — so the broker keeps its
29
- * historically unbounded capacity instead of reporting a number it would
30
- * silently normalize to unlimited.
31
- */
32
- export declare function resolveNodeMaxAgents(preset: string | undefined, definition?: NodeCapacitySource): string | undefined;
33
- /**
34
- * Adapt the relay SDK triggers API to the fleet {@link FleetTriggerSyncClient}
35
- * contract so a served node can reconcile its declared triggers. The fleet
36
- * package never constructs a relay client itself (avoids a circular dependency),
37
- * so the CLI supplies this near-passthrough adapter.
38
- */
39
- export declare function createTriggerSyncClient({ workspaceKey, baseUrl, }: {
40
- workspaceKey: string;
41
- baseUrl?: string;
42
- }): FleetTriggerSyncClient;
43
- //# sourceMappingURL=fleet-sidecar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fleet-sidecar.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/fleet-sidecar.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAExF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAc3D;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,eAAe,GAAG,IAAI,EACnC,UAAU,CAAC,EAAE,kBAAkB,GAC9B,MAAM,EAAE,CAiBV;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,eAAe,GAAG,IAAI,EACnC,UAAU,CAAC,EAAE,kBAAkB,GAC9B,MAAM,CAMR;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,UAAU,CAAC,EAAE,kBAAkB,GAC9B,MAAM,GAAG,SAAS,CAepB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,YAAY,EACZ,OAAO,GACR,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,sBAAsB,CAQzB"}
@@ -1,84 +0,0 @@
1
- import { AgentRelay } from '@agent-relay/sdk';
2
- import { MAX_FLEET_NODE_AGENTS } from '@agent-relay/fleet';
3
- /**
4
- * The harnesses a `node up` broker advertises `spawn:<harness>` capacity for:
5
- * a built-in default set, the project's teams.json clis, and any `spawn:<harness>`
6
- * definitions in a discovered node config. The CLI passes this to the broker via
7
- * `AGENT_RELAY_NODE_HARNESSES` so its capacity manifest covers everything the
8
- * project can spawn.
9
- */
10
- // Mirrors the broker's built-in default (crates/broker init `DEFAULT_NODE_HARNESSES`);
11
- // the CLI overrides `AGENT_RELAY_NODE_HARNESSES`, so omitting one would drop the
12
- // broker's default capacity for it.
13
- const DEFAULT_HARNESSES = ['claude', 'codex', 'gemini', 'opencode', 'muse', 'devin'];
14
- export function nodeCapacityHarnesses(teamsConfig, definition) {
15
- const harnesses = new Set(DEFAULT_HARNESSES);
16
- for (const agent of teamsConfig?.agents ?? []) {
17
- const cli = agent.cli?.trim();
18
- if (cli) {
19
- harnesses.add(cli);
20
- }
21
- }
22
- for (const name of Object.keys(definition?.capabilities ?? {})) {
23
- if (name.startsWith('spawn:')) {
24
- const harness = name.slice('spawn:'.length).trim();
25
- if (harness) {
26
- harnesses.add(harness);
27
- }
28
- }
29
- }
30
- return [...harnesses];
31
- }
32
- /**
33
- * Resolve the `AGENT_RELAY_NODE_HARNESSES` CSV the broker registers its capacity
34
- * from. A pre-set value is the operator's authoritative declaration of the node's
35
- * real capacity and is returned verbatim; otherwise it is computed from the project
36
- * via {@link nodeCapacityHarnesses}.
37
- */
38
- export function resolveNodeCapacityHarnesses(preset, teamsConfig, definition) {
39
- const trimmed = preset?.trim();
40
- if (trimmed) {
41
- return trimmed;
42
- }
43
- return nodeCapacityHarnesses(teamsConfig, definition).join(',');
44
- }
45
- /**
46
- * Resolve the `AGENT_RELAY_NODE_MAX_AGENTS` value the broker registers its
47
- * provider-level agent capacity from. A pre-set value is the operator's
48
- * authoritative declaration of the node's real capacity and is returned
49
- * verbatim; otherwise the node definition's `maxAgents` wins. Returns
50
- * `undefined` when neither declares a cap — or when the declared cap is
51
- * outside the shared range the broker can parse — so the broker keeps its
52
- * historically unbounded capacity instead of reporting a number it would
53
- * silently normalize to unlimited.
54
- */
55
- export function resolveNodeMaxAgents(preset, definition) {
56
- const trimmed = preset?.trim();
57
- if (trimmed) {
58
- return trimmed;
59
- }
60
- const maxAgents = definition?.maxAgents;
61
- if (typeof maxAgents === 'number' &&
62
- Number.isInteger(maxAgents) &&
63
- maxAgents > 0 &&
64
- maxAgents <= MAX_FLEET_NODE_AGENTS) {
65
- return String(maxAgents);
66
- }
67
- return undefined;
68
- }
69
- /**
70
- * Adapt the relay SDK triggers API to the fleet {@link FleetTriggerSyncClient}
71
- * contract so a served node can reconcile its declared triggers. The fleet
72
- * package never constructs a relay client itself (avoids a circular dependency),
73
- * so the CLI supplies this near-passthrough adapter.
74
- */
75
- export function createTriggerSyncClient({ workspaceKey, baseUrl, }) {
76
- const relay = new AgentRelay({ workspaceKey, ...(baseUrl ? { baseUrl } : {}) });
77
- return {
78
- list: () => relay.triggers.list(),
79
- create: (input) => relay.triggers.create(input),
80
- update: (id, input) => relay.triggers.update(id, input),
81
- delete: (id) => relay.triggers.delete(id),
82
- };
83
- }
84
- //# sourceMappingURL=fleet-sidecar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fleet-sidecar.js","sourceRoot":"","sources":["../../../src/cli/lib/fleet-sidecar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAA+B,MAAM,oBAAoB,CAAC;AAIxF;;;;;;GAMG;AACH,uFAAuF;AACvF,iFAAiF;AACjF,oCAAoC;AACpC,MAAM,iBAAiB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAc9F,MAAM,UAAU,qBAAqB,CACnC,WAAmC,EACnC,UAA+B;IAE/B,MAAM,SAAS,GAA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AAU,EAAE,SAAS,CAAC;IACxC,IACE,OAAO,SAAS,KAAK,QAAQ;QAC7B,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC;QAC3B,SAAS,GAAG,CAAC;QACb,SAAS,IAAI,qBAAqB,EAClC,CAAC;QACD,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,EACtC,YAAY,EACZ,OAAO,GAIR;IACC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAChF,OAAO;QACL,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE;QACjC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC;QAC/C,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC;QACvD,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC"}
@@ -1,22 +0,0 @@
1
- import type { AttachMode } from './attach-mode.js';
2
- export interface RedeemJoinTicketOptions {
3
- ticket: string;
4
- node: string;
5
- agent: string;
6
- mode: AttachMode;
7
- env?: NodeJS.ProcessEnv;
8
- baseUrl?: string;
9
- fetch?: typeof globalThis.fetch;
10
- }
11
- export interface RedeemedJoinTicket {
12
- workspaceId: string;
13
- workspaceKey: string;
14
- }
15
- export declare class JoinTicketRedemptionError extends Error {
16
- readonly code?: string | undefined;
17
- readonly status?: number | undefined;
18
- constructor(message: string, code?: string | undefined, status?: number | undefined);
19
- }
20
- /** Redeem a scope-bound, single-use join ticket for a persistable workspace credential. */
21
- export declare function redeemJoinTicket(options: RedeemJoinTicketOptions): Promise<RedeemedJoinTicket>;
22
- //# sourceMappingURL=join-ticket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"join-ticket.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/join-ticket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA4BnD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAID,qBAAa,yBAA0B,SAAQ,KAAK;IAGhD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;gBAFxB,OAAO,EAAE,MAAM,EACN,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,MAAM,CAAC,EAAE,MAAM,YAAA;CAK3B;AA+FD,2FAA2F;AAC3F,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA+BpG"}