@desplega.ai/agent-swarm 1.166.0 → 1.168.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 (221) hide show
  1. package/dist/acp-adapter-zhejfecx.js +34 -0
  2. package/dist/{actions-qz3m692w.js → actions-7jg840nr.js} +25 -25
  3. package/dist/{amp-adapter-j1xbmsqz.js → amp-adapter-ye6rnetm.js} +4 -4
  4. package/dist/{anthropic-messages-hst62ws9.js → anthropic-messages-13yn502s.js} +4 -4
  5. package/dist/{app-43vrdmv8.js → app-ffes2kyf.js} +10 -9
  6. package/dist/{assistant-ertffmka.js → assistant-fhm5smyz.js} +26 -26
  7. package/dist/{azure-openai-responses-mh8tvf78.js → azure-openai-responses-9st34pfz.js} +5 -5
  8. package/dist/{boot-reembed-998jtpdg.js → boot-reembed-20q3nzvg.js} +9 -8
  9. package/dist/{boot-reembed-s7k7c6v2.js → boot-reembed-jvfadhsk.js} +9 -8
  10. package/dist/{boot-scrub-sweep-nepsk4t1.js → boot-scrub-sweep-jtfajzve.js} +10 -9
  11. package/dist/{boot-seeds-vvzs1zhk.js → boot-seeds-9qt0j8j2.js} +12 -11
  12. package/dist/{claude-adapter-2zvmekrp.js → claude-adapter-a8znhthz.js} +24 -22
  13. package/dist/{claude-managed-adapter-s49wbk8t.js → claude-managed-adapter-tzwxy803.js} +4 -4
  14. package/dist/{claude-managed-setup-cvhqq8qn.js → claude-managed-setup-nrhfx5b0.js} +3 -3
  15. package/dist/{claude-sdk-session-kkbxtw5q.js → claude-sdk-session-7x7chdrs.js} +7608 -7596
  16. package/dist/{cli-zsh093hk.js → cli-014vns2y.js} +63 -1
  17. package/dist/{cli-8kgvmkak.js → cli-0jngabtb.js} +1 -1
  18. package/dist/{cli-qvfk83fy.js → cli-13xwcqvj.js} +2 -2
  19. package/dist/{cli-0nhdwxd5.js → cli-43jg9xdw.js} +3 -3
  20. package/dist/{cli-cpfmqz3n.js → cli-47zfzshm.js} +5 -5
  21. package/dist/{cli-zy7vwsne.js → cli-5qkcdv8c.js} +16 -9
  22. package/dist/{cli-cwxhbf43.js → cli-5t5my0h8.js} +85 -2
  23. package/dist/{cli-y59h2pk9.js → cli-69egj654.js} +1 -1
  24. package/dist/{cli-68r1j4sg.js → cli-6bpvv8h4.js} +3 -3
  25. package/dist/{cli-yshaazs1.js → cli-74ez9b66.js} +63 -20
  26. package/dist/{cli-32bca7nr.js → cli-7avy4v8w.js} +1 -1
  27. package/dist/{cli-f2n17zhp.js → cli-7mhy3ths.js} +21 -18
  28. package/dist/{cli-q38n4bq0.js → cli-95zs84qw.js} +3 -3
  29. package/dist/{cli-fn697bnt.js → cli-9q0bh411.js} +21 -8
  30. package/dist/{cli-rggdq8wq.js → cli-9q24yyvs.js} +3 -3
  31. package/dist/cli-a35hzdve.js +33 -0
  32. package/dist/{cli-3qn4r334.js → cli-aj1e0h0d.js} +20 -14
  33. package/dist/{cli-rsy933yz.js → cli-bcspch6h.js} +30 -19
  34. package/dist/{cli-x3x0qwky.js → cli-bxqez1p0.js} +51 -23
  35. package/dist/{cli-ng97fjq7.js → cli-cmxkbzzs.js} +33 -7
  36. package/dist/{cli-df56tqdw.js → cli-ee0402n1.js} +198 -70
  37. package/dist/{cli-mwegs4af.js → cli-ew0c3a1j.js} +3 -3
  38. package/dist/{cli-ysnyhws9.js → cli-ewhwpyrb.js} +54 -51
  39. package/dist/{cli-j2jbr8af.js → cli-fhj4y16f.js} +1 -1
  40. package/dist/{cli-8t229cmr.js → cli-fqq06kkb.js} +30 -17
  41. package/dist/{cli-jvj6a0cv.js → cli-g6gx2dn1.js} +54 -19
  42. package/dist/{cli-nexwh8zg.js → cli-g7k7zbcz.js} +12 -5
  43. package/dist/{cli-ecknp7p1.js → cli-j05x7pnb.js} +10 -10
  44. package/dist/{cli-gt8azyet.js → cli-jb931ba2.js} +1 -1
  45. package/dist/{cli-nvvfd8bq.js → cli-jbzbr36n.js} +4091 -3793
  46. package/dist/{cli-3ddybbbx.js → cli-jvmtxqtc.js} +26 -14
  47. package/dist/{cli-pkke6geq.js → cli-km4x66j0.js} +83 -65
  48. package/dist/{cli-b0f70z24.js → cli-mn8qkd8v.js} +1 -1
  49. package/dist/{cli-0qjcsxgz.js → cli-nctfv2yy.js} +99 -9
  50. package/dist/{cli-4r1sjfc4.js → cli-ng1pmdx6.js} +10 -10
  51. package/dist/cli-nkqjj42q.js +104 -0
  52. package/dist/{cli-aqcey741.js → cli-p5jqk8fr.js} +1 -1
  53. package/dist/{cli-66zh26sp.js → cli-pgehz8e1.js} +57 -17
  54. package/dist/cli-q1vnz8wv.js +96 -0
  55. package/dist/{cli-fj86xr3c.js → cli-qd97v6z2.js} +2 -2
  56. package/dist/{cli-p4ztb80h.js → cli-r7eeddkq.js} +13 -8
  57. package/dist/{cli-8ssjez7e.js → cli-rhy7z1rp.js} +22 -11
  58. package/dist/{cli-vzc73wet.js → cli-rr5z1j4p.js} +87 -69
  59. package/dist/{cli-4mevd1hf.js → cli-s9y81s7j.js} +5 -5
  60. package/dist/{cli-dw2q9f7g.js → cli-svah6b6w.js} +4 -4
  61. package/dist/{cli-h3x613ze.js → cli-tc5zec7v.js} +6 -6
  62. package/dist/{cli-ttbsse3f.js → cli-tmhsxhb8.js} +1 -1
  63. package/dist/{cli-feh3dkah.js → cli-v1w7pbd8.js} +2 -1
  64. package/dist/{cli-10zmp1p7.js → cli-vr5avem2.js} +27 -32
  65. package/dist/{cli-bzr0ftht.js → cli-wnb9b2g3.js} +19 -0
  66. package/dist/{cli-krqm5f11.js → cli-xezn9nkh.js} +16 -13
  67. package/dist/{cli-8kt0bmgx.js → cli-xf713zz0.js} +2 -2
  68. package/dist/{cli-6zcfw0x7.js → cli-y195hv1a.js} +1 -1
  69. package/dist/{cli-x7kpr72a.js → cli-ytmmyj7f.js} +2 -2
  70. package/dist/{cli-v2a8x45d.js → cli-z48ggfyq.js} +11 -6
  71. package/dist/{cli-qbksc292.js → cli-zy39d433.js} +2 -0
  72. package/dist/cli.js +28 -28
  73. package/dist/{cloudflare-workers-ai-system-one-tt484t61.js → cloudflare-workers-ai-system-one-sta45jf9.js} +7 -5
  74. package/dist/{codex-adapter-dw1wxqt8.js → codex-adapter-n63k33d3.js} +18 -18
  75. package/dist/{codex-login-terbdsqq.js → codex-login-g1cyt5zm.js} +1 -1
  76. package/dist/{codex-session-runner-3cgb8y1g.js → codex-session-runner-xkxfd81a.js} +18 -18
  77. package/dist/{commands-mhxam6z2.js → commands-q4mfhn51.js} +9 -8
  78. package/dist/{cursor-adapter-2qda3st7.js → cursor-adapter-v8mm6bp5.js} +5 -5
  79. package/dist/{db-sjks418k.js → db-1t0bj3pc.js} +9 -8
  80. package/dist/{dispatcher-1es759rn.js → dispatcher-k1fhavcf.js} +24 -24
  81. package/dist/{dsh-adapter-bek4cyw9.js → dsh-adapter-5423p70m.js} +5 -5
  82. package/dist/{easter-egg-3d-mtpnw06s.js → easter-egg-3d-66zxervv.js} +2 -2
  83. package/dist/{execute-s4ccjq3n.js → execute-h4jgevyw.js} +61 -11
  84. package/dist/{google-generative-ai-d6nphg3q.js → google-generative-ai-b8zxrpax.js} +5 -5
  85. package/dist/{google-vertex-cpshkref.js → google-vertex-nrdd697t.js} +5 -5
  86. package/dist/{grok-adapter-ar9cw9jg.js → grok-adapter-phrndeb8.js} +18 -8
  87. package/dist/{handlers-1gkbhktr.js → handlers-59ywqwzh.js} +27 -27
  88. package/dist/{hook-vxa3tcsy.js → hook-atj0swc2.js} +14 -14
  89. package/dist/{hook-ds2zxq9v.js → hook-mew1chq9.js} +42 -31
  90. package/dist/{http-3h21z9md.js → http-ef2fnn9v.js} +953 -98
  91. package/dist/{index-n99fycq7.js → index-48pb9erw.js} +24 -24
  92. package/dist/{index-bn6cy8ps.js → index-9fc2h7ww.js} +24 -24
  93. package/dist/{index-9b65j1m5.js → index-gr69c43q.js} +9 -8
  94. package/dist/{index-f8xnqrye.js → index-h26wjcfy.js} +43 -24
  95. package/dist/{index-dkfxpkmm.js → index-w2yhye23.js} +25 -25
  96. package/dist/{keepalive-3xspa9jw.js → keepalive-qhcqz56v.js} +11 -10
  97. package/dist/{lead-6qphc124.js → lead-hpk5r3b1.js} +47 -47
  98. package/dist/{llama-cpp-classify-tgj35k8d.js → llama-cpp-classify-6erb7wwv.js} +3 -1
  99. package/dist/{maintenance-0teem1bb.js → maintenance-nvkyp2xe.js} +9 -8
  100. package/dist/{mistral-conversations-8445ddjn.js → mistral-conversations-059y51zt.js} +4 -4
  101. package/dist/{node-9sg7ajby.js → node-qm9eb6z0.js} +1 -1
  102. package/dist/{oauth-refresh-sweep-sh9q25xp.js → oauth-refresh-sweep-ngskthwh.js} +10 -9
  103. package/dist/{onboard-54qmnqxe.js → onboard-yfnkqhxc.js} +2 -2
  104. package/dist/{openai-codex-responses-9ynm88zy.js → openai-codex-responses-jzxkta9b.js} +8 -7
  105. package/dist/{openai-completions-nhqwjmaw.js → openai-completions-663yncfq.js} +4 -4
  106. package/dist/openai-decisions-vj9nkpf8.js +162 -0
  107. package/dist/{openai-responses-xx1c4kgm.js → openai-responses-m3g43rrt.js} +5 -5
  108. package/dist/{opencode-adapter-wjfa2wvd.js → opencode-adapter-yjyqynzf.js} +7 -7
  109. package/dist/{openrouter-images-8yx3487g.js → openrouter-images-kr60n6b9.js} +1 -1
  110. package/dist/{otel-impl-ycqzp2a1.js → otel-impl-hhm64r6m.js} +1 -1
  111. package/dist/{pi-messages-vxdt8v7j.js → pi-messages-xszk613n.js} +1 -1
  112. package/dist/{pi-mono-adapter-e77e9zst.js → pi-mono-adapter-0eg8kw2c.js} +68 -51
  113. package/dist/{pricing-refresh-atnkngqs.js → pricing-refresh-35f91nx2.js} +11 -10
  114. package/dist/{rbac-roles-j78wdksm.js → rbac-roles-97w370qj.js} +10 -9
  115. package/dist/{rbac-roles-9pjphh9q.js → rbac-roles-z6sje3gy.js} +9 -8
  116. package/dist/{render-v2-pxjs49fx.js → render-v2-n4v66bj3.js} +10 -9
  117. package/dist/{runtime-v2t1r79e.js → runtime-h9ha1mq6.js} +4 -4
  118. package/dist/{setup-ymej0xtx.js → setup-m3hhyv5f.js} +2 -2
  119. package/dist/{typesafe-system-one-datfr82p.js → typesafe-system-one-e988vty7.js} +7 -5
  120. package/dist/{virtual-modules-wm8mxdxx.js → virtual-modules-ftr9kwe8.js} +11 -11
  121. package/dist/{work-objects-3nh4ymzb.js → work-objects-mxf2c842.js} +27 -27
  122. package/dist/{worker-qa9fkz5s.js → worker-9t07z1gq.js} +47 -47
  123. package/openapi.json +72 -1
  124. package/package.json +10 -10
  125. package/src/be/memory/providers/openai-embedding.ts +7 -2
  126. package/src/be/memory/raters/llm-summarizer.ts +7 -2
  127. package/src/be/modelsdev-cache.json +61 -0
  128. package/src/be/script-connections.ts +40 -6
  129. package/src/be/seed-pricing.ts +84 -53
  130. package/src/be/swarm-config-guard.ts +14 -0
  131. package/src/commands/provider-credentials.ts +28 -5
  132. package/src/commands/runner.ts +7 -12
  133. package/src/extensions/catalog.generated.json +17 -0
  134. package/src/heartbeat/heartbeat.ts +91 -19
  135. package/src/hooks/hook.ts +72 -27
  136. package/src/http/mcp.ts +5 -0
  137. package/src/http/onboarding.ts +2 -0
  138. package/src/http/script-connections.ts +35 -0
  139. package/src/providers/acp-targets.ts +10 -5
  140. package/src/providers/amp-adapter.ts +1 -1
  141. package/src/providers/claude-adapter.ts +32 -0
  142. package/src/providers/claude-background-keepalive.ts +100 -0
  143. package/src/providers/claude-sdk-session.ts +6 -0
  144. package/src/providers/codex-adapter.ts +30 -3
  145. package/src/providers/codex-oauth/auth-json.ts +21 -4
  146. package/src/providers/codex-oauth/types.ts +2 -0
  147. package/src/providers/dsh-adapter.ts +11 -2
  148. package/src/providers/grok-adapter.ts +18 -2
  149. package/src/providers/opencode-adapter.ts +21 -5
  150. package/src/providers/pi-mono-extension.ts +56 -25
  151. package/src/providers/pricing-sources.md +2 -0
  152. package/src/scheduler/scheduler.ts +82 -13
  153. package/src/scripts-runtime/executors/registry.ts +1 -1
  154. package/src/server.ts +63 -3
  155. package/src/tests/acp-adapter.test.ts +152 -12
  156. package/src/tests/ci-unit-test-report.test.ts +73 -0
  157. package/src/tests/claude-background-keepalive-wiring.test.ts +220 -0
  158. package/src/tests/claude-background-keepalive.fixture.ts +162 -0
  159. package/src/tests/claude-background-keepalive.test.ts +139 -0
  160. package/src/tests/claude-default-route.test.ts +75 -0
  161. package/src/tests/claude-hook-output.test.ts +233 -0
  162. package/src/tests/codex-adapter-pool-auth-revalidate.test.ts +4 -2
  163. package/src/tests/codex-adapter.test.ts +166 -26
  164. package/src/tests/codex-oauth-auth-timestamps.test.ts +76 -0
  165. package/src/tests/codex-oauth.test.ts +4 -1
  166. package/src/tests/connection-embedded-auth.test.ts +51 -0
  167. package/src/tests/context-window.test.ts +2 -2
  168. package/src/tests/credential-check.test.ts +51 -1
  169. package/src/tests/docs-index-footprint.test.js +3 -3
  170. package/src/tests/dsh-adapter.test.ts +24 -2
  171. package/src/tests/enabled-tools.test.ts +269 -0
  172. package/src/tests/entrypoint-codex-oauth-seed.test.ts +12 -0
  173. package/src/tests/extensions-catalog.test.ts +1 -0
  174. package/src/tests/extensions-example-slack-reply-gate.test.ts +756 -0
  175. package/src/tests/grok-adapter.test.ts +13 -0
  176. package/src/tests/haiku-5-5-pricing.test.ts +38 -0
  177. package/src/tests/heartbeat-checklist.test.ts +158 -1
  178. package/src/tests/onboarding.test.ts +44 -0
  179. package/src/tests/opencode-adapter.test.ts +66 -3
  180. package/src/tests/opencode-plugin.test.ts +37 -0
  181. package/src/tests/openrouter-attribution-call-sites.test.ts +204 -0
  182. package/src/tests/openrouter-base-url.test.ts +30 -39
  183. package/src/tests/pi-mono-extension.test.ts +161 -2
  184. package/src/tests/pricing-refresh.test.ts +70 -1
  185. package/src/tests/reasoning-effort.test.ts +3 -1
  186. package/src/tests/schedule-target-type.test.ts +136 -0
  187. package/src/tests/script-connections-http.test.ts +45 -0
  188. package/src/tests/script-connections-mcp.test.ts +41 -0
  189. package/src/tests/script-executor-registry.test.ts +18 -0
  190. package/src/tests/send-task-self-send.test.ts +107 -0
  191. package/src/tests/telemetry-trigger.test.ts +12 -1
  192. package/src/tests/workflow-llm.test.ts +14 -0
  193. package/src/tests/workflow-system-one-decision-providers.test.ts +33 -0
  194. package/src/tools/request-human-input.ts +7 -2
  195. package/src/tools/script-connections/tool.ts +35 -3
  196. package/src/tools/send-task.ts +9 -1
  197. package/src/utils/enabled-tools.ts +27 -0
  198. package/src/utils/internal-ai/complete-structured.ts +11 -3
  199. package/src/utils/openrouter-base-url.ts +23 -0
  200. package/src/workflows/executors/raw-llm.ts +1 -0
  201. package/src/workflows/executors/system-one-decision.ts +2 -0
  202. package/src/workflows/executors/validate.ts +1 -0
  203. package/src/workflows/executors/workflow-llm.ts +9 -2
  204. package/templates/extensions/README.md +1 -0
  205. package/templates/extensions/slack-reply-gate/README.md +98 -0
  206. package/templates/extensions/slack-reply-gate/hooks.ts +582 -0
  207. package/templates/extensions/slack-reply-gate/manifest.json +8 -0
  208. package/templates/skills/agent-browser/SKILL.md +2 -0
  209. package/templates/skills/agent-browser/content.md +2 -0
  210. package/templates/skills/code-quality/content.md +1 -0
  211. package/templates/skills/heartbeat-runbook/content.md +1 -1
  212. package/templates/skills/swarm-scripts/SKILL.md +10 -0
  213. package/templates/skills/swarm-scripts/content.md +10 -0
  214. package/templates/skills/work-on-task/SKILL.md +4 -0
  215. package/templates/skills/work-on-task/content.md +4 -0
  216. package/templates/skills/workflow-iterate/content.md +9 -0
  217. package/dist/acp-adapter-yzfxn8vj.js +0 -23
  218. package/dist/cli-3dpj7atn.js +0 -11
  219. package/dist/cli-gvcgmx69.js +0 -183
  220. package/dist/{cli-jhm6hzjn.js → cli-mxvnnv5q.js} +7 -7
  221. package/dist/{codex-hook-d2rkvf39.js → codex-hook-15dgc4cb.js} +1 -1
@@ -4,7 +4,7 @@ import {
4
4
  init_src,
5
5
  runtimeCatalogModel,
6
6
  runtimeCatalogSection
7
- } from "./cli-zsh093hk.js";
7
+ } from "./cli-014vns2y.js";
8
8
 
9
9
  // src/utils/context-window.ts
10
10
  init_src();
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  getValidCodexOAuth,
3
3
  persistCodexOAuth
4
- } from "./cli-feh3dkah.js";
5
- import {
6
- oauthErrorHtml,
7
- oauthSuccessHtml
8
- } from "./cli-2x0e561b.js";
4
+ } from "./cli-v1w7pbd8.js";
9
5
  import {
10
6
  GITHUB_COPILOT_MODELS,
11
7
  builtinModels,
12
8
  normalizeRadiusGatewayUrl,
13
9
  registerBundledOAuthFlowLoaders
14
- } from "./cli-pkke6geq.js";
10
+ } from "./cli-km4x66j0.js";
11
+ import {
12
+ oauthErrorHtml,
13
+ oauthSuccessHtml
14
+ } from "./cli-2x0e561b.js";
15
15
  import {
16
16
  getEnvApiKey
17
17
  } from "./cli-zxg80zs9.js";
18
18
  import {
19
19
  InMemoryCredentialStore
20
- } from "./cli-nexwh8zg.js";
20
+ } from "./cli-g7k7zbcz.js";
21
21
  import {
22
22
  getProviderEnvValue
23
23
  } from "./cli-btbzvq95.js";
@@ -307,23 +307,26 @@ async function exchangeAuthorizationCode(code, state, verifier, redirectUri, sig
307
307
  }
308
308
  async function loginAnthropic(interaction) {
309
309
  const { verifier, challenge } = await generatePKCE();
310
- const callback = await startOAuthCallbackServer({
310
+ const startCallbackServer = (port) => startOAuthCallbackServer({
311
311
  providerName: "Anthropic",
312
312
  host: CALLBACK_HOST,
313
- port: CALLBACK_PORT,
313
+ port,
314
314
  path: CALLBACK_PATH,
315
+ redirectHost: "localhost",
315
316
  state: verifier,
316
317
  complete: async (code) => code,
317
318
  signal: interaction.signal
318
- }).catch(() => {
319
+ });
320
+ const callback = await startCallbackServer(CALLBACK_PORT).catch(() => startCallbackServer(0)).catch(() => {
319
321
  return;
320
322
  });
323
+ const redirectUri = callback?.redirectUri ?? REDIRECT_URI;
321
324
  try {
322
325
  const authParams = new URLSearchParams({
323
326
  code: "true",
324
327
  client_id: CLIENT_ID,
325
328
  response_type: "code",
326
- redirect_uri: REDIRECT_URI,
329
+ redirect_uri: redirectUri,
327
330
  scope: SCOPES,
328
331
  code_challenge: challenge,
329
332
  code_challenge_method: "S256",
@@ -336,7 +339,7 @@ async function loginAnthropic(interaction) {
336
339
  });
337
340
  const result = await waitForCallbackOrManualInput(interaction, callback, {
338
341
  message: "Complete login in your browser, or paste the authorization code / redirect URL here:",
339
- placeholder: REDIRECT_URI
342
+ placeholder: redirectUri
340
343
  });
341
344
  let code;
342
345
  let state = verifier;
@@ -352,7 +355,7 @@ async function loginAnthropic(interaction) {
352
355
  if (!code)
353
356
  throw new Error("Missing authorization code");
354
357
  interaction.notify({ type: "progress", message: "Exchanging authorization code for tokens..." });
355
- return await exchangeAuthorizationCode(code, state, verifier, REDIRECT_URI, interaction.signal);
358
+ return await exchangeAuthorizationCode(code, state, verifier, redirectUri, interaction.signal);
356
359
  } finally {
357
360
  callback?.close();
358
361
  }
@@ -1431,7 +1434,7 @@ async function loginOpenAIChatGPT(interaction, options) {
1431
1434
  const authorizationUrl = new URL(AUTHORIZE_URL2);
1432
1435
  authorizationUrl.search = new URLSearchParams({
1433
1436
  client_id: DYNAMIC_CLIENT_ID,
1434
- agent_name_hint: AGENT_NAME_HINT,
1437
+ agent_name_hint: options?.agentName ?? AGENT_NAME_HINT,
1435
1438
  ext_agent_host_id: hostId,
1436
1439
  response_type: "code",
1437
1440
  redirect_uri: REDIRECT_URI2,
@@ -1732,8 +1735,8 @@ async function loginOpenAICodexDeviceCode(interaction) {
1732
1735
  const code = await pollOpenAICodexDeviceAuth(device, interaction.signal);
1733
1736
  return exchangeAuthorizationCodeForCredentials(code.authorizationCode, code.codeVerifier, DEVICE_REDIRECT_URI, interaction.signal);
1734
1737
  }
1735
- async function loginOpenAICodex(interaction) {
1736
- const { verifier, state, url } = await createAuthorizationFlow();
1738
+ async function loginOpenAICodex(interaction, options) {
1739
+ const { verifier, state, url } = await createAuthorizationFlow(options?.agentName);
1737
1740
  const callback = await startOAuthCallbackServer({
1738
1741
  providerName: "OpenAI",
1739
1742
  host: getCallbackHost(),
@@ -1777,7 +1780,7 @@ async function refreshOpenAICodexToken(refreshToken2, signal) {
1777
1780
  var openaiCodexOAuth = {
1778
1781
  name: "OpenAI (ChatGPT Plus/Pro)",
1779
1782
  isSubscription: true,
1780
- async login(interaction) {
1783
+ async login(interaction, options) {
1781
1784
  const method = await interaction.prompt({
1782
1785
  type: "select",
1783
1786
  message: "Select OpenAI Codex login method:",
@@ -1792,7 +1795,7 @@ var openaiCodexOAuth = {
1792
1795
  if (method !== OPENAI_CODEX_BROWSER_LOGIN_METHOD) {
1793
1796
  throw new Error(`Unknown OpenAI Codex login method: ${method}`);
1794
1797
  }
1795
- return loginOpenAICodex(interaction);
1798
+ return loginOpenAICodex(interaction, options);
1796
1799
  },
1797
1800
  refresh: (credential, signal) => refreshOpenAICodexToken(credential.refresh, signal),
1798
1801
  async toAuth(credential) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  retryProviderRequest
3
- } from "./cli-qbksc292.js";
3
+ } from "./cli-zy39d433.js";
4
4
  import {
5
5
  require_ecdsa_sig_formatter,
6
6
  require_jws,
@@ -10,7 +10,7 @@ import {
10
10
  getJsonSchemaToolParameters,
11
11
  resolveJsonSchemaStrictSampling,
12
12
  transformMessages
13
- } from "./cli-8kt0bmgx.js";
13
+ } from "./cli-xf713zz0.js";
14
14
  import {
15
15
  sanitizeSurrogates
16
16
  } from "./cli-y2apkfe2.js";
@@ -18,7 +18,7 @@ import {
18
18
  clampThinkingLevel,
19
19
  collapseSystemMessages,
20
20
  withoutInitialSystemMessage
21
- } from "./cli-nexwh8zg.js";
21
+ } from "./cli-g7k7zbcz.js";
22
22
  import {
23
23
  import_websocket
24
24
  } from "./cli-76yrvwsa.js";
@@ -2,14 +2,16 @@ import {
2
2
  ACPAdapter,
3
3
  grokTargetProfile,
4
4
  isGrokOpenRouterModel
5
- } from "./cli-3qn4r334.js";
5
+ } from "./cli-aj1e0h0d.js";
6
6
  import {
7
- getOpenRouterBaseUrl
8
- } from "./cli-3dpj7atn.js";
7
+ getOpenRouterAttributionHeaders,
8
+ getOpenRouterBaseUrl,
9
+ init_openrouter_base_url
10
+ } from "./cli-a35hzdve.js";
9
11
  import {
10
12
  init_src,
11
13
  normalizeGrokModel
12
- } from "./cli-zsh093hk.js";
14
+ } from "./cli-014vns2y.js";
13
15
  import {
14
16
  init_secret_scrubber,
15
17
  registerVolatileSecret
@@ -17,10 +19,11 @@ import {
17
19
 
18
20
  // src/providers/grok-adapter.ts
19
21
  init_src();
22
+ init_openrouter_base_url();
23
+ init_secret_scrubber();
20
24
  import { mkdtemp, rm } from "node:fs/promises";
21
25
  import { tmpdir } from "node:os";
22
26
  import { join } from "node:path";
23
- init_secret_scrubber();
24
27
  function checkGrokCredentials(env) {
25
28
  return env.XAI_API_KEY?.trim() || env.OPENROUTER_API_KEY?.trim() ? { ready: true, missing: [], satisfiedBy: "env" } : {
26
29
  ready: false,
@@ -43,13 +46,22 @@ function grokOpenRouterModel(model, env) {
43
46
  const id = model.trim();
44
47
  if (!isGrokOpenRouterModel(id))
45
48
  return null;
49
+ const baseUrl = getOpenRouterBaseUrl(env);
46
50
  return {
47
51
  id,
48
52
  model: id.slice("openrouter/".length),
49
- baseUrl: getOpenRouterBaseUrl(env),
50
- envKey: "OPENROUTER_API_KEY"
53
+ baseUrl,
54
+ envKey: "OPENROUTER_API_KEY",
55
+ headers: getOpenRouterAttributionHeaders(baseUrl, env)
51
56
  };
52
57
  }
58
+ function tomlInlineTable(key, entries) {
59
+ const pairs = Object.entries(entries ?? {});
60
+ if (pairs.length === 0)
61
+ return [];
62
+ const body = pairs.map(([k, v]) => `${JSON.stringify(k)} = ${JSON.stringify(v)}`).join(", ");
63
+ return [`${key} = { ${body} }`];
64
+ }
53
65
  function buildGrokConfigToml(disabledPlugins, customModel = null) {
54
66
  const list = disabledPlugins.map((name) => JSON.stringify(name)).join(", ");
55
67
  const modelBlock = customModel ? [
@@ -58,7 +70,8 @@ function buildGrokConfigToml(disabledPlugins, customModel = null) {
58
70
  `model = ${JSON.stringify(customModel.model)}`,
59
71
  `base_url = ${JSON.stringify(customModel.baseUrl)}`,
60
72
  `env_key = ${JSON.stringify(customModel.envKey)}`,
61
- `api_backend = "chat_completions"`
73
+ `api_backend = "chat_completions"`,
74
+ ...tomlInlineTable("extra_headers", customModel.headers)
62
75
  ] : [];
63
76
  return [
64
77
  "[cli]",
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  buildModelsDevSeedRows,
3
3
  loadModelsDevCache
4
- } from "./cli-ysnyhws9.js";
4
+ } from "./cli-ewhwpyrb.js";
5
5
  import {
6
6
  createLogEntry,
7
7
  getActivePricingRow,
8
8
  getDbClient,
9
9
  init_db1 as init_db,
10
10
  insertPricingRow
11
- } from "./cli-yshaazs1.js";
11
+ } from "./cli-74ez9b66.js";
12
12
  import {
13
13
  init_runtime_model_catalog,
14
14
  setRuntimeModelCatalog
15
- } from "./cli-zsh093hk.js";
15
+ } from "./cli-014vns2y.js";
16
16
  import {
17
17
  init_secret_scrubber,
18
18
  scrubSecrets
@@ -0,0 +1,33 @@
1
+ import {
2
+ __esm
3
+ } from "./cli-bc05qbss.js";
4
+
5
+ // src/utils/openrouter-base-url.ts
6
+ function getOpenRouterBaseUrl(env = process.env) {
7
+ const raw = env.OPENROUTER_BASE_URL;
8
+ if (typeof raw === "string" && raw.trim().length > 0) {
9
+ return raw.trim().replace(/\/+$/, "");
10
+ }
11
+ return DEFAULT_OPENROUTER_BASE_URL;
12
+ }
13
+ function getOpenRouterAttributionHeaders(url, env = process.env) {
14
+ const enabled = env.OPENROUTER_APP_ATTRIBUTION?.toLowerCase();
15
+ if (enabled === "false" || enabled === "0")
16
+ return {};
17
+ try {
18
+ const host = new URL(url).hostname;
19
+ return host === "openrouter.ai" || host.endsWith(".openrouter.ai") ? { ...OPENROUTER_APP_ATTRIBUTION_HEADERS } : {};
20
+ } catch {
21
+ return {};
22
+ }
23
+ }
24
+ var DEFAULT_OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1", OPENROUTER_APP_ATTRIBUTION_HEADERS;
25
+ var init_openrouter_base_url = __esm(() => {
26
+ OPENROUTER_APP_ATTRIBUTION_HEADERS = {
27
+ "HTTP-Referer": "https://agent-swarm.dev",
28
+ "X-OpenRouter-Title": "Agent Swarm",
29
+ "X-OpenRouter-Categories": "personal-agent,cloud-agent"
30
+ };
31
+ });
32
+
33
+ export { DEFAULT_OPENROUTER_BASE_URL, getOpenRouterBaseUrl, getOpenRouterAttributionHeaders, init_openrouter_base_url };
@@ -1,18 +1,21 @@
1
1
  import {
2
- clampContextPercent,
3
- getContextWindowSize
4
- } from "./cli-32bca7nr.js";
5
- import {
6
- fetchInstalledMcpServers
7
- } from "./cli-tng3131n.js";
2
+ applyOpenRouterBaseUrlOverride
3
+ } from "./cli-jvmtxqtc.js";
8
4
  import {
9
5
  ACP_TARGET_IDS,
10
6
  getAcpTargetCatalogEntry,
11
7
  isAcpTarget
12
8
  } from "./cli-zp67qg5x.js";
9
+ import {
10
+ fetchInstalledMcpServers
11
+ } from "./cli-tng3131n.js";
12
+ import {
13
+ clampContextPercent,
14
+ getContextWindowSize
15
+ } from "./cli-7avy4v8w.js";
13
16
  import {
14
17
  applyReasoningEffort
15
- } from "./cli-ttbsse3f.js";
18
+ } from "./cli-tmhsxhb8.js";
16
19
  import {
17
20
  detachedProcessGroup,
18
21
  registerProcessGroup,
@@ -21,7 +24,7 @@ import {
21
24
  import {
22
25
  init_src,
23
26
  normalizeGrokModel
24
- } from "./cli-zsh093hk.js";
27
+ } from "./cli-014vns2y.js";
25
28
  import {
26
29
  array,
27
30
  boolean,
@@ -41,7 +44,7 @@ import {
41
44
  import {
42
45
  init_package,
43
46
  package_default
44
- } from "./cli-4r1sjfc4.js";
47
+ } from "./cli-ng1pmdx6.js";
45
48
  import {
46
49
  init_secret_scrubber,
47
50
  scrubSecrets
@@ -4800,9 +4803,8 @@ function configuredOptions(config) {
4800
4803
  options.model = config.model.trim();
4801
4804
  return options;
4802
4805
  }
4803
- function withModelInJsonEnv(env, key, model) {
4804
- if (!model.trim())
4805
- return;
4806
+ function withOpencodeConfig(env, model) {
4807
+ const key = "OPENCODE_CONFIG_CONTENT";
4806
4808
  let value = {};
4807
4809
  const existing = env[key];
4808
4810
  if (existing) {
@@ -4815,7 +4817,10 @@ function withModelInJsonEnv(env, key, model) {
4815
4817
  console.warn(`\x1B[33m[acp]\x1B[0m Replacing invalid ${key} JSON for model fallback`);
4816
4818
  }
4817
4819
  }
4818
- env[key] = JSON.stringify({ ...value, model: model.trim() });
4820
+ if (model.trim())
4821
+ value.model = model.trim();
4822
+ applyOpenRouterBaseUrlOverride(value, env);
4823
+ env[key] = JSON.stringify(value);
4819
4824
  }
4820
4825
  function parseCommand(command, args) {
4821
4826
  const trimmed = command.trim();
@@ -4870,7 +4875,8 @@ var opencodeTargetProfile = {
4870
4875
  const env = baseTargetEnv(config);
4871
4876
  const entry = getAcpTargetCatalogEntry("opencode");
4872
4877
  copyEnvKeys(config, env, entry.envKeys);
4873
- withModelInJsonEnv(env, "OPENCODE_CONFIG_CONTENT", config.model);
4878
+ copyEnvKeys(config, env, ["OPENROUTER_APP_ATTRIBUTION"]);
4879
+ withOpencodeConfig(env, config.model);
4874
4880
  return env;
4875
4881
  },
4876
4882
  configuredOptions,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  materializeClaudeMd,
3
3
  stopClaudeMd
4
- } from "./cli-y59h2pk9.js";
4
+ } from "./cli-69egj654.js";
5
5
  import {
6
6
  guardGhPrBody
7
7
  } from "./cli-v6vv7dy8.js";
8
8
  import {
9
9
  summarizeSession
10
- } from "./cli-p4ztb80h.js";
10
+ } from "./cli-r7eeddkq.js";
11
11
  import {
12
12
  checkToolLoop,
13
13
  clearToolHistory
@@ -29,7 +29,7 @@ import {
29
29
  init_profile_sync,
30
30
  readIdentityBaselines,
31
31
  warnProfileFileTooLarge
32
- } from "./cli-jhm6hzjn.js";
32
+ } from "./cli-mxvnnv5q.js";
33
33
  import {
34
34
  MAX_PROFILE_FILE_LENGTH,
35
35
  getMcpBaseUrl,
@@ -38,7 +38,7 @@ import {
38
38
  import {
39
39
  init_package,
40
40
  package_default
41
- } from "./cli-4r1sjfc4.js";
41
+ } from "./cli-ng1pmdx6.js";
42
42
  import {
43
43
  init_secret_scrubber,
44
44
  scrubSecrets
@@ -511,9 +511,18 @@ async function handleHook() {
511
511
  }
512
512
  };
513
513
  const outputBlockResponse = (reason) => {
514
+ const response = msg.hook_event_name === "PreToolUse" ? {
515
+ hookSpecificOutput: {
516
+ hookEventName: "PreToolUse",
517
+ permissionDecision: "deny",
518
+ permissionDecisionReason: reason
519
+ }
520
+ } : { decision: "block", reason };
521
+ console.log(JSON.stringify(response));
522
+ };
523
+ const outputToolContext = (hookEventName, additionalContext) => {
514
524
  const response = {
515
- decision: "block",
516
- reason
525
+ hookSpecificOutput: { hookEventName, additionalContext }
517
526
  };
518
527
  console.log(JSON.stringify(response));
519
528
  };
@@ -597,7 +606,13 @@ async function handleHook() {
597
606
  };
598
607
  await ping();
599
608
  const agentInfo = await getAgentInfo();
600
- if (agentInfo) {
609
+ if (msg.hook_event_name === "UserPromptSubmit" && agentInfo && !agentInfo.isLead && agentInfo.status === "busy") {
610
+ if (await checkAndBlockIfCancelled(true)) {
611
+ return;
612
+ }
613
+ }
614
+ const isToolEvent = msg.hook_event_name === "PreToolUse" || msg.hook_event_name === "PostToolUse";
615
+ if (agentInfo && !isToolEvent) {
601
616
  console.log(`You are registered as ${agentInfo.isLead ? "lead" : "worker"} agent "${agentInfo.name}" (ID: ${agentInfo.id}, status: ${agentInfo.status}).`);
602
617
  if (agentInfo.inbox) {
603
618
  const tray = formatSystemTray(agentInfo.inbox);
@@ -606,7 +621,7 @@ async function handleHook() {
606
621
  }
607
622
  }
608
623
  } else if (shouldShowRegistrationNudge({
609
- agentInfoPresent: false,
624
+ agentInfoPresent: Boolean(agentInfo),
610
625
  eventType: msg.hook_event_name,
611
626
  hasAgentIdHeader: hasAgentIdHeader()
612
627
  })) {
@@ -715,6 +730,7 @@ You do not have a pre-defined agent ID, you will receive one when you join the s
715
730
  return;
716
731
  }
717
732
  }
733
+ let loopWarning;
718
734
  if (agentInfo && !agentInfo.isLead && agentInfo.status === "busy") {
719
735
  const loopTaskFile = await readTaskFile();
720
736
  if (loopTaskFile?.taskId && msg.tool_name && msg.tool_input) {
@@ -724,7 +740,7 @@ You do not have a pre-defined agent ID, you will receive one when you join the s
724
740
  return;
725
741
  }
726
742
  if (loopResult.severity === "warning" && loopResult.reason) {
727
- console.log(`Warning: ${loopResult.reason}`);
743
+ loopWarning = `Warning: ${loopResult.reason}`;
728
744
  }
729
745
  }
730
746
  }
@@ -735,6 +751,9 @@ You do not have a pre-defined agent ID, you will receive one when you join the s
735
751
  return;
736
752
  }
737
753
  }
754
+ if (loopWarning) {
755
+ outputToolContext("PreToolUse", loopWarning);
756
+ }
738
757
  break;
739
758
  }
740
759
  case "PostToolUse":
@@ -752,7 +771,7 @@ You do not have a pre-defined agent ID, you will receive one when you join the s
752
771
  method: "PUT",
753
772
  headers: mcpConfig.headers
754
773
  }).catch((e) => {
755
- console.debug("Failed to update agent activity timestamp:", e);
774
+ console.error("Failed to update agent activity timestamp:", e);
756
775
  });
757
776
  }
758
777
  if (agentInfo) {
@@ -797,19 +816,11 @@ You do not have a pre-defined agent ID, you will receive one when you join the s
797
816
  if (agentInfo.isLead) {
798
817
  if (msg.tool_name?.endsWith("send-task")) {
799
818
  const maybeTaskId = msg.tool_response?.task?.id;
800
- console.log(`Task sent successfully.${maybeTaskId ? ` Task ID: ${maybeTaskId}.` : ""} Monitor progress using the get-task-details tool periodically.`);
819
+ outputToolContext("PostToolUse", `Task sent successfully.${maybeTaskId ? ` Task ID: ${maybeTaskId}.` : ""} Monitor progress using the get-task-details tool periodically.`);
801
820
  }
802
821
  }
803
822
  }
804
823
  break;
805
- case "UserPromptSubmit": {
806
- if (agentInfo && !agentInfo.isLead && agentInfo.status === "busy") {
807
- if (await checkAndBlockIfCancelled(true)) {
808
- return;
809
- }
810
- }
811
- break;
812
- }
813
824
  case "Stop":
814
825
  try {
815
826
  const pm2ListOutput = await Bun.$`pm2 jlist 2>/dev/null || echo "[]"`.text();