@desplega.ai/agent-swarm 1.120.0 → 1.121.1

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 (149) hide show
  1. package/README.md +2 -2
  2. package/dist/{actions-rym7jyg2.js → actions-99h2dh5e.js} +6 -6
  3. package/dist/{anthropic-messages-qjxzsabf.js → anthropic-messages-4gn944cn.js} +29 -13
  4. package/dist/{app-ss3a0nfj.js → app-9gfdk9me.js} +4 -4
  5. package/dist/{assistant-8sd2b21b.js → assistant-mabq9kz7.js} +13 -13
  6. package/dist/{azure-openai-responses-ntfd05zd.js → azure-openai-responses-79zc0wyy.js} +28 -13
  7. package/dist/{boot-reembed-7bs0d0sj.js → boot-reembed-3vr2amzp.js} +5 -5
  8. package/dist/{boot-reembed-eh18r04f.js → boot-reembed-ya33nge3.js} +4 -4
  9. package/dist/{boot-scrub-logs-v8ch000n.js → boot-scrub-logs-2nmz7fzw.js} +4 -4
  10. package/dist/{claude-adapter-9n3nzt65.js → claude-adapter-vxvcym3r.js} +3 -3
  11. package/dist/{claude-managed-adapter-pv2nbqy4.js → claude-managed-adapter-g807894s.js} +2 -2
  12. package/dist/{cli-sbh0b9r1.js → cli-02m8v96c.js} +5 -4
  13. package/dist/{cli-branks1w.js → cli-16dv125e.js} +28 -3
  14. package/dist/{cli-383wyw2f.js → cli-2846g99z.js} +61 -17
  15. package/dist/cli-3dpj7atn.js +11 -0
  16. package/dist/{cli-w6rhc30s.js → cli-3jrdwnn9.js} +20 -5
  17. package/dist/{cli-kyfx7z3d.js → cli-3t4nvx1x.js} +4 -4
  18. package/dist/{cli-2r7s8jhp.js → cli-5c4327dx.js} +7 -1
  19. package/dist/{cli-84j2vp67.js → cli-5jd04m23.js} +1 -1
  20. package/dist/{cli-d2eyq90a.js → cli-7bk7s2sx.js} +1 -1
  21. package/dist/{cli-qs7nb3zn.js → cli-8wrympd7.js} +27 -1
  22. package/dist/{cli-0ap79nha.js → cli-9hewdgzb.js} +5 -5
  23. package/dist/{cli-wr706gez.js → cli-av2s7my4.js} +167 -66
  24. package/dist/{cli-zxnp21rf.js → cli-avxs2rp9.js} +18 -15
  25. package/dist/{cli-1arw00dp.js → cli-ccjwgarc.js} +12 -3
  26. package/dist/{cli-pscrc6tw.js → cli-ch7t5v7n.js} +5 -0
  27. package/dist/{cli-tghre7g6.js → cli-cw70hymf.js} +1 -0
  28. package/dist/{cli-gq12jc1m.js → cli-dn5ycmtw.js} +7 -5
  29. package/dist/{cli-kyqs14qe.js → cli-dwqakg2b.js} +5 -5
  30. package/dist/{cli-py8z9bjq.js → cli-e0zbndab.js} +9 -9
  31. package/dist/{cli-zxeb2qe3.js → cli-fxdhzkqx.js} +1 -1
  32. package/dist/{cli-f6c6y7fw.js → cli-gahmct71.js} +2 -2
  33. package/dist/{cli-n745f8e5.js → cli-kwjx3f1v.js} +1 -1
  34. package/dist/{cli-0kkggfr9.js → cli-kx7vsvg0.js} +2 -2
  35. package/dist/{cli-t91zbm2s.js → cli-msyrqt1f.js} +59 -22
  36. package/dist/{cli-shdvvj0n.js → cli-ng0gr9rz.js} +2 -2
  37. package/dist/{cli-th08nm8p.js → cli-p8qcm631.js} +1 -1
  38. package/dist/{cli-gad984jj.js → cli-qfh6pmvm.js} +1 -1
  39. package/dist/{cli-v65h59hn.js → cli-rjn06qph.js} +1 -1
  40. package/dist/{cli-xeatwfbe.js → cli-ry656xem.js} +24 -17
  41. package/dist/cli-s8s499xy.js +81 -0
  42. package/dist/{cli-n61x2aph.js → cli-vh3h1grg.js} +826 -1336
  43. package/dist/{cli-vmhqfnp1.js → cli-w4crd8gx.js} +2 -2
  44. package/dist/{cli-mg280wsv.js → cli-we156bmz.js} +1 -1
  45. package/dist/{cli-e0y603nn.js → cli-x0e0yvnq.js} +101 -1
  46. package/dist/{cli-mw3xpgwb.js → cli-x4apc9t3.js} +4 -4
  47. package/dist/{cli-dnx98dwa.js → cli-yhwn2vjm.js} +38185 -38141
  48. package/dist/{cli-j59bj3vs.js → cli-yy9sm7c1.js} +8 -8
  49. package/dist/{cli-4cb3p8pj.js → cli-yyqpn0gc.js} +2 -2
  50. package/dist/{cli-w5em21am.js → cli-zm78xp1y.js} +3 -3
  51. package/dist/{cli-da3x3btq.js → cli-zweca3q3.js} +4 -3
  52. package/dist/cli.js +23 -21
  53. package/dist/{codex-adapter-6j2b38tg.js → codex-adapter-0kv2meed.js} +9 -9
  54. package/dist/{codex-session-runner-vz215wgw.js → codex-session-runner-m1e1v4r0.js} +9 -9
  55. package/dist/{commands-w1swgcgg.js → commands-hty4156r.js} +3 -3
  56. package/dist/{db-yv6y0fxw.js → db-kyeq3t7h.js} +5 -3
  57. package/dist/{google-generative-ai-n1d3xt4n.js → google-generative-ai-wwa2ked5.js} +14 -18
  58. package/dist/{google-vertex-mxst23gy.js → google-vertex-71xmdd7n.js} +14 -18
  59. package/dist/{handlers-yjyafdwk.js → handlers-fxvqnp6s.js} +13 -13
  60. package/dist/{hook-6nvc6p19.js → hook-j4ksm2fy.js} +8 -8
  61. package/dist/{http-g6j8rc6h.js → http-m7fq6kbc.js} +143 -64
  62. package/dist/{index-7betnvg6.js → index-62g7ym5y.js} +9 -9
  63. package/dist/{index-b2rarbkn.js → index-mbaa4yn7.js} +12 -11
  64. package/dist/{index-64th6eqs.js → index-r2tmg4ts.js} +11 -10
  65. package/dist/{index-cbknx39k.js → index-rqxt0515.js} +13 -12
  66. package/dist/{keepalive-j8c99r3m.js → keepalive-acgfgbk8.js} +6 -6
  67. package/dist/{lead-8xe71m3s.js → lead-r3pnbky3.js} +31 -31
  68. package/dist/{maintenance-eqnmrwb2.js → maintenance-4tqr6va0.js} +5 -5
  69. package/dist/{mistral-conversations-ykcg66za.js → mistral-conversations-26ya4yah.js} +17 -13
  70. package/dist/{oauth-refresh-sweep-c5dy1653.js → oauth-refresh-sweep-5714hq77.js} +6 -6
  71. package/dist/{onboard-4avg01c1.js → onboard-s5x8zjqd.js} +2 -2
  72. package/dist/{openai-codex-responses-zy0907j9.js → openai-codex-responses-6rr2ye0s.js} +78 -38
  73. package/dist/{openai-completions-xk4p56n9.js → openai-completions-zfa9nkvt.js} +130 -33
  74. package/dist/{openai-responses-4gv3ca5d.js → openai-responses-9wmdks0g.js} +38 -14
  75. package/dist/{opencode-adapter-5bwzvbwj.js → opencode-adapter-s3nhtp9m.js} +5 -2
  76. package/dist/{openrouter-images-4fsrrzes.js → openrouter-images-dgq98729.js} +10 -3
  77. package/dist/{otel-impl-z4cwkp40.js → otel-impl-8g0741yr.js} +4 -4
  78. package/dist/{pi-messages-zb8v76wx.js → pi-messages-nzjbbz47.js} +4 -6
  79. package/dist/{pi-mono-adapter-9sg69kg3.js → pi-mono-adapter-k3z6e5fn.js} +5666 -4521
  80. package/dist/{pricing-refresh-dts9429d.js → pricing-refresh-09ty42xr.js} +5 -5
  81. package/dist/{rbac-roles-4f64wch6.js → rbac-roles-2hjvj3q0.js} +4 -4
  82. package/dist/{rbac-roles-24cvsejy.js → rbac-roles-q38w8rne.js} +3 -3
  83. package/dist/{seed-pricing-74ph9wap.js → seed-pricing-wzx03625.js} +4 -4
  84. package/dist/{setup-9q0n8rvd.js → setup-4hmnc9fz.js} +2 -2
  85. package/dist/{worker-x7g344z8.js → worker-efef96pc.js} +31 -31
  86. package/openapi.json +169 -85
  87. package/package.json +7 -5
  88. package/plugin/commands/swarm-chat.md +2 -0
  89. package/plugin/pi-skills/swarm-chat/SKILL.md +2 -0
  90. package/src/be/db.ts +61 -5
  91. package/src/be/memory/constants.ts +7 -6
  92. package/src/be/memory/graph-expansion.ts +3 -3
  93. package/src/be/memory/raters/llm-summarizer.ts +10 -2
  94. package/src/be/migrations/119_agent_avatar.sql +7 -0
  95. package/src/be/migrations/120_task_title.sql +3 -0
  96. package/src/be/scripts/typecheck.ts +3 -2
  97. package/src/be/seed-capabilities.ts +62 -0
  98. package/src/be/seed-pricing.ts +1 -1
  99. package/src/be/seed-scripts/catalog/ops-catalog-audit.inline.ts +1 -1
  100. package/src/be/seed-scripts/catalog/ops-catalog-audit.ts +1 -1
  101. package/src/commands/provider-credentials.ts +2 -1
  102. package/src/commands/runner.ts +69 -6
  103. package/src/http/agents.ts +23 -5
  104. package/src/http/core.ts +8 -5
  105. package/src/http/index.ts +11 -0
  106. package/src/http/mcp-bridge.ts +5 -2
  107. package/src/http/memory.ts +2 -1
  108. package/src/http/poll.ts +5 -1
  109. package/src/http/sessions.ts +1 -1
  110. package/src/http/tasks.ts +35 -0
  111. package/src/prompts/base-prompt.ts +48 -4
  112. package/src/prompts/session-templates.ts +13 -1
  113. package/src/providers/claude-managed-models.ts +8 -0
  114. package/src/providers/codex-adapter.ts +3 -0
  115. package/src/providers/opencode-adapter.ts +40 -0
  116. package/src/providers/pi-mono-adapter.ts +179 -1
  117. package/src/providers/pi-mono-extension.ts +9 -0
  118. package/src/scripts-runtime/types/stdlib.d.ts +11 -0
  119. package/src/server.ts +230 -126
  120. package/src/tests/agent-avatar-resolution.test.ts +293 -0
  121. package/src/tests/agents-list-model-display.test.ts +10 -0
  122. package/src/tests/base-prompt.test.ts +72 -0
  123. package/src/tests/claude-managed-adapter.test.ts +6 -0
  124. package/src/tests/context-window.test.ts +1 -0
  125. package/src/tests/list-endpoint-slimming.test.ts +45 -0
  126. package/src/tests/memory-feature-flags.test.ts +45 -0
  127. package/src/tests/memory-rater-llm-summarizer.test.ts +24 -0
  128. package/src/tests/opencode-plugin.test.ts +43 -0
  129. package/src/tests/openrouter-base-url.test.ts +256 -0
  130. package/src/tests/pi-mono-adapter.test.ts +90 -0
  131. package/src/tests/prompt-template-session.test.ts +6 -5
  132. package/src/tests/script-connections.test.ts +1 -0
  133. package/src/tests/sdk-allowlist.test.ts +4 -1
  134. package/src/tests/seed-capabilities.test.ts +92 -0
  135. package/src/tests/session-costs-model-key-normalize.test.ts +1 -0
  136. package/src/tests/sessions.test.ts +46 -0
  137. package/src/tests/task-title-route.test.ts +106 -0
  138. package/src/tests/tool-annotations.test.ts +6 -3
  139. package/src/tools/memory-search.ts +2 -1
  140. package/src/tools/update-profile.ts +15 -5
  141. package/src/types.ts +29 -0
  142. package/src/utils/context-window.ts +1 -0
  143. package/src/utils/internal-ai/complete-structured.ts +19 -1
  144. package/src/utils/internal-ai/summarize-session.ts +7 -0
  145. package/src/utils/openrouter-base-url.ts +28 -0
  146. package/src/workflows/executors/raw-llm.ts +2 -1
  147. package/src/workflows/executors/validate.ts +2 -1
  148. package/dist/cli-z9gzq07x.js +0 -27
  149. package/dist/{otel-g299k41b.js → otel-63jr5v38.js} +1 -1
package/README.md CHANGED
@@ -142,7 +142,7 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
142
142
  - **Config-driven metrics dashboards** — define read-only SQL widgets, version them, and render them in the dashboard without shipping custom frontend code. [Metrics API →](https://docs.agent-swarm.dev/docs/api-reference/stats)
143
143
  - **DB-backed pages** — agents publish HTML or JSON pages (reports, dashboards, action specs) via `create_page`, remove stale pages with `delete-page`, and share them with public / authed / password modes, version history, view counters, diff helpers, and PDF export. [MCP tools → Pages](https://docs.agent-swarm.dev/docs/reference/mcp-tools#pages-tools)
144
144
  - **KV store** — Redis-like namespaced key/value store with auto-scoped context (Slack thread / PR / Linear issue / page). [MCP tools → KV](https://docs.agent-swarm.dev/docs/reference/mcp-tools#kv-tools)
145
- - **Real-time dashboard + task attachments** — monitor agents, tasks, and inter-agent chat, filter Pages, Approval Requests, and workflow definitions with URL-backed search/facets, create tasks with uploaded files from the sessions composer, and preview task attachments inline above session prompts. [app.agent-swarm.dev →](https://app.agent-swarm.dev)
145
+ - **Real-time dashboard + task attachments** — monitor agents, tasks, and inter-agent chat; rename sessions inline; customize each agent's icon and color; filter Pages, Approval Requests, and workflow definitions with URL-backed search/facets; create tasks with uploaded files from the sessions composer; and preview task attachments inline above session prompts. [app.agent-swarm.dev →](https://app.agent-swarm.dev)
146
146
 
147
147
  ## Quick Start
148
148
 
@@ -217,7 +217,7 @@ Missing one? Ask the swarm to build it.
217
217
 
218
218
  ## Dashboard
219
219
 
220
- Real-time monitoring of agents, tasks, and inter-agent chat. Use the hosted version at [app.agent-swarm.dev](https://app.agent-swarm.dev), or run locally:
220
+ Real-time monitoring of agents, tasks, and inter-agent chat. Session titles can be renamed inline, and agent profiles can use a custom Lucide icon and color while retaining deterministic defaults. Use the hosted version at [app.agent-swarm.dev](https://app.agent-swarm.dev), or run locally:
221
221
 
222
222
  ```bash
223
223
  cd apps/ui && bun install && bun run dev
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  resolveSlackUserId
3
- } from "./cli-f6c6y7fw.js";
4
- import"./cli-d2eyq90a.js";
3
+ } from "./cli-gahmct71.js";
4
+ import"./cli-7bk7s2sx.js";
5
5
  import {
6
6
  createTaskWithSiblingAwareness
7
- } from "./cli-th08nm8p.js";
7
+ } from "./cli-p8qcm631.js";
8
8
  import {
9
9
  buildCancelledBlocks,
10
10
  getTaskLink
@@ -19,12 +19,12 @@ import {
19
19
  init_context_key,
20
20
  init_db,
21
21
  slackContextKey
22
- } from "./cli-383wyw2f.js";
22
+ } from "./cli-2846g99z.js";
23
23
  import"./cli-z2zcxes1.js";
24
+ import"./cli-dn5ycmtw.js";
25
+ import"./cli-4j2mrzag.js";
24
26
  import"./cli-bw80ck94.js";
25
27
  import"./cli-xz9aq0rf.js";
26
- import"./cli-gq12jc1m.js";
27
- import"./cli-4j2mrzag.js";
28
28
  import"./cli-p9swy5t3.js";
29
29
 
30
30
  // src/slack/actions.ts
@@ -5,6 +5,9 @@ import {
5
5
  buildCopilotDynamicHeaders,
6
6
  hasCopilotVisionInput
7
7
  } from "./cli-67bad0ze.js";
8
+ import {
9
+ retryProviderRequest
10
+ } from "./cli-s8s499xy.js";
8
11
  import {
9
12
  parseJsonWithRepair,
10
13
  parseStreamingJson
@@ -16,8 +19,9 @@ import {
16
19
  adjustMaxTokensForThinking,
17
20
  buildBaseOptions,
18
21
  clampMaxTokensToContext,
22
+ resolveJsonSchemaStrictSampling,
19
23
  transformMessages
20
- } from "./cli-e0y603nn.js";
24
+ } from "./cli-x0e0yvnq.js";
21
25
  import {
22
26
  sanitizeSurrogates
23
27
  } from "./cli-y2apkfe2.js";
@@ -26,10 +30,10 @@ import {
26
30
  } from "./cli-vapyk8sw.js";
27
31
  import {
28
32
  calculateCost
29
- } from "./cli-1arw00dp.js";
33
+ } from "./cli-ccjwgarc.js";
30
34
  import {
31
35
  AssistantMessageEventStream
32
- } from "./cli-qs7nb3zn.js";
36
+ } from "./cli-8wrympd7.js";
33
37
  import"./cli-p9swy5t3.js";
34
38
 
35
39
  // node_modules/@earendil-works/pi-ai/node_modules/@anthropic-ai/sdk/internal/tslib.mjs
@@ -4919,6 +4923,7 @@ function getAnthropicCompat(model) {
4919
4923
  supportsCacheControlOnTools: model.compat?.supportsCacheControlOnTools ?? true,
4920
4924
  supportsTemperature: model.compat?.supportsTemperature ?? true,
4921
4925
  allowEmptySignature: model.compat?.allowEmptySignature ?? false,
4926
+ supportsStrictTools: model.compat?.supportsStrictTools ?? false,
4922
4927
  supportsToolReferences: model.compat?.supportsToolReferences ?? defaultSupportsToolReferences(model)
4923
4928
  };
4924
4929
  }
@@ -5160,9 +5165,13 @@ var stream = (model, context, options) => {
5160
5165
  const requestOptions = {
5161
5166
  ...options?.signal ? { signal: options.signal } : {},
5162
5167
  ...options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {},
5163
- maxRetries: options?.maxRetries ?? 0
5168
+ maxRetries: 0
5164
5169
  };
5165
- const response = await client.messages.create({ ...params, stream: true }, requestOptions).asResponse();
5170
+ const response = await retryProviderRequest(() => client.messages.create({ ...params, stream: true }, requestOptions).asResponse(), {
5171
+ maxRetries: options?.maxRetries,
5172
+ maxRetryDelayMs: options?.maxRetryDelayMs,
5173
+ signal: options?.signal
5174
+ });
5166
5175
  await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
5167
5176
  stream2.push({ type: "start", partial: output });
5168
5177
  const blocks = output.content;
@@ -5487,8 +5496,8 @@ function buildParams(model, context, isOAuthToken2, options) {
5487
5496
  }
5488
5497
  if (immediateTools.length > 0 || deferredTools.length > 0) {
5489
5498
  params.tools = [
5490
- ...convertTools(immediateTools, isOAuthToken2, compat.supportsEagerToolInputStreaming, compat.supportsCacheControlOnTools ? cacheControl : undefined),
5491
- ...convertTools(deferredTools, isOAuthToken2, compat.supportsEagerToolInputStreaming, undefined, true)
5499
+ ...convertTools(immediateTools, isOAuthToken2, compat.supportsEagerToolInputStreaming, compat.supportsStrictTools, compat.supportsCacheControlOnTools ? cacheControl : undefined),
5500
+ ...convertTools(deferredTools, isOAuthToken2, compat.supportsEagerToolInputStreaming, compat.supportsStrictTools, undefined, true)
5492
5501
  ];
5493
5502
  }
5494
5503
  if (model.reasoning) {
@@ -5689,20 +5698,27 @@ function convertMessages(transformedMessages, isOAuthToken2, cacheControl, allow
5689
5698
  function shouldUseFineGrainedToolStreamingBeta(model, context) {
5690
5699
  return !!context.tools?.length && !getAnthropicCompat(model).supportsEagerToolInputStreaming;
5691
5700
  }
5692
- function convertTools(tools, isOAuthToken2, supportsEagerToolInputStreaming, cacheControl, deferLoading = false) {
5701
+ function convertTools(tools, isOAuthToken2, supportsEagerToolInputStreaming, supportsStrictTools, cacheControl, deferLoading = false) {
5693
5702
  if (!tools)
5694
5703
  return [];
5695
5704
  return tools.map((tool, index) => {
5705
+ const strict = resolveJsonSchemaStrictSampling(tool, supportsStrictTools);
5696
5706
  const schema = tool.parameters;
5707
+ const legacyInputSchema = {
5708
+ type: "object",
5709
+ properties: schema.properties ?? {},
5710
+ required: schema.required ?? []
5711
+ };
5712
+ const inputSchema = strict === true ? {
5713
+ ...tool.parameters,
5714
+ ...legacyInputSchema
5715
+ } : legacyInputSchema;
5697
5716
  return {
5698
5717
  name: isOAuthToken2 ? toClaudeCodeName(tool.name) : tool.name,
5699
5718
  description: tool.description,
5700
5719
  ...supportsEagerToolInputStreaming ? { eager_input_streaming: true } : {},
5701
- input_schema: {
5702
- type: "object",
5703
- properties: schema.properties ?? {},
5704
- required: schema.required ?? []
5705
- },
5720
+ ...strict === true ? { strict: true } : {},
5721
+ input_schema: inputSchema,
5706
5722
  ...deferLoading ? { defer_loading: true } : {},
5707
5723
  ...cacheControl && index === tools.length - 1 ? { cache_control: cacheControl } : {}
5708
5724
  };
@@ -3,18 +3,18 @@ import {
3
3
  initSlackApp,
4
4
  startSlackApp,
5
5
  stopSlackApp
6
- } from "./cli-kyqs14qe.js";
6
+ } from "./cli-dwqakg2b.js";
7
7
  import"./cli-rkndnn90.js";
8
8
  import"./cli-b0p7rfnd.js";
9
9
  import"./cli-ma04faw5.js";
10
10
  import"./cli-wspgs9bt.js";
11
11
  import"./cli-dh55d5fg.js";
12
- import"./cli-383wyw2f.js";
12
+ import"./cli-2846g99z.js";
13
13
  import"./cli-z2zcxes1.js";
14
+ import"./cli-dn5ycmtw.js";
15
+ import"./cli-4j2mrzag.js";
14
16
  import"./cli-bw80ck94.js";
15
17
  import"./cli-xz9aq0rf.js";
16
- import"./cli-gq12jc1m.js";
17
- import"./cli-4j2mrzag.js";
18
18
  import"./cli-e15jhafb.js";
19
19
  import"./cli-7wmybrt5.js";
20
20
  import"./cli-p9swy5t3.js";
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  bufferThreadMessage,
3
3
  wasEventSeen
4
- } from "./cli-j59bj3vs.js";
4
+ } from "./cli-yy9sm7c1.js";
5
5
  import {
6
6
  hasOtherUserMention
7
- } from "./cli-0kkggfr9.js";
8
- import {
9
- require_dist
10
- } from "./cli-kyqs14qe.js";
11
- import"./cli-rkndnn90.js";
12
- import"./cli-b0p7rfnd.js";
7
+ } from "./cli-kx7vsvg0.js";
13
8
  import {
14
9
  resolveSlackUserId,
15
10
  rewriteSlackMentions
16
- } from "./cli-f6c6y7fw.js";
17
- import"./cli-d2eyq90a.js";
11
+ } from "./cli-gahmct71.js";
12
+ import"./cli-7bk7s2sx.js";
18
13
  import {
19
14
  createTaskWithSiblingAwareness
20
- } from "./cli-th08nm8p.js";
15
+ } from "./cli-p8qcm631.js";
16
+ import {
17
+ require_dist
18
+ } from "./cli-dwqakg2b.js";
19
+ import"./cli-rkndnn90.js";
20
+ import"./cli-b0p7rfnd.js";
21
21
  import"./cli-ma04faw5.js";
22
22
  import"./cli-wspgs9bt.js";
23
23
  import"./cli-dh55d5fg.js";
@@ -30,12 +30,12 @@ import {
30
30
  init_resolver,
31
31
  resolveTemplate,
32
32
  slackContextKey
33
- } from "./cli-383wyw2f.js";
33
+ } from "./cli-2846g99z.js";
34
34
  import"./cli-z2zcxes1.js";
35
+ import"./cli-dn5ycmtw.js";
36
+ import"./cli-4j2mrzag.js";
35
37
  import"./cli-bw80ck94.js";
36
38
  import"./cli-xz9aq0rf.js";
37
- import"./cli-gq12jc1m.js";
38
- import"./cli-4j2mrzag.js";
39
39
  import"./cli-e15jhafb.js";
40
40
  import"./cli-7wmybrt5.js";
41
41
  import {
@@ -2,7 +2,7 @@ import {
2
2
  convertResponsesMessages,
3
3
  convertResponsesTools,
4
4
  processResponsesStream
5
- } from "./cli-wr706gez.js";
5
+ } from "./cli-av2s7my4.js";
6
6
  import {
7
7
  clampOpenAIPromptCacheKey
8
8
  } from "./cli-mrptpp86.js";
@@ -10,6 +10,9 @@ import"./cli-5m9j2spm.js";
10
10
  import {
11
11
  AzureOpenAI
12
12
  } from "./cli-sajgpkqg.js";
13
+ import {
14
+ retryProviderRequest
15
+ } from "./cli-s8s499xy.js";
13
16
  import"./cli-zyxs93y9.js";
14
17
  import {
15
18
  getProviderEnvValue
@@ -17,20 +20,21 @@ import {
17
20
  import {
18
21
  formatProviderError,
19
22
  normalizeProviderError
20
- } from "./cli-pscrc6tw.js";
23
+ } from "./cli-ch7t5v7n.js";
21
24
  import {
22
- buildBaseOptions
23
- } from "./cli-e0y603nn.js";
25
+ buildBaseOptions,
26
+ createGrammarToolInputProperties
27
+ } from "./cli-x0e0yvnq.js";
24
28
  import"./cli-y2apkfe2.js";
25
29
  import {
26
30
  headersToRecord
27
31
  } from "./cli-vapyk8sw.js";
28
32
  import {
29
33
  clampThinkingLevel
30
- } from "./cli-1arw00dp.js";
34
+ } from "./cli-ccjwgarc.js";
31
35
  import {
32
36
  AssistantMessageEventStream
33
- } from "./cli-qs7nb3zn.js";
37
+ } from "./cli-8wrympd7.js";
34
38
  import"./cli-p9swy5t3.js";
35
39
 
36
40
  // node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js
@@ -89,7 +93,8 @@ var stream = (model, context, options) => {
89
93
  throw new Error(`No API key for provider: ${model.provider}`);
90
94
  }
91
95
  const client = createClient(model, apiKey, options);
92
- let params = buildParams(model, context, options, deploymentName);
96
+ const grammarToolInputProperties = createGrammarToolInputProperties(context.tools, model.compat?.supportsOpenAIGrammarTools ?? false);
97
+ let params = buildParams(model, context, options, deploymentName, grammarToolInputProperties);
93
98
  const nextParams = await options?.onPayload?.(params, model);
94
99
  if (nextParams !== undefined) {
95
100
  params = nextParams;
@@ -97,12 +102,16 @@ var stream = (model, context, options) => {
97
102
  const requestOptions = {
98
103
  ...options?.signal ? { signal: options.signal } : {},
99
104
  ...options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {},
100
- maxRetries: options?.maxRetries ?? 0
105
+ maxRetries: 0
101
106
  };
102
- const { data: openaiStream, response } = await client.responses.create(params, requestOptions).withResponse();
107
+ const { data: openaiStream, response } = await retryProviderRequest(() => client.responses.create(params, requestOptions).withResponse(), {
108
+ maxRetries: options?.maxRetries,
109
+ maxRetryDelayMs: options?.maxRetryDelayMs,
110
+ signal: options?.signal
111
+ });
103
112
  await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
104
113
  stream2.push({ type: "start", partial: output });
105
- await processResponsesStream(openaiStream, output, stream2, model);
114
+ await processResponsesStream(openaiStream, output, stream2, model, { grammarToolInputProperties });
106
115
  if (options?.signal?.aborted) {
107
116
  throw new Error("Request was aborted");
108
117
  }
@@ -115,6 +124,7 @@ var stream = (model, context, options) => {
115
124
  for (const block of output.content) {
116
125
  delete block.index;
117
126
  delete block.partialJson;
127
+ delete block.customInput;
118
128
  }
119
129
  output.stopReason = options?.signal?.aborted ? "aborted" : "error";
120
130
  output.errorMessage = formatAzureOpenAIError(error);
@@ -189,8 +199,10 @@ function createClient(model, apiKey, options) {
189
199
  baseURL: baseUrl
190
200
  });
191
201
  }
192
- function buildParams(model, context, options, deploymentName) {
193
- const messages = convertResponsesMessages(model, context, AZURE_TOOL_CALL_PROVIDERS);
202
+ function buildParams(model, context, options, deploymentName, grammarToolInputProperties = createGrammarToolInputProperties(context.tools, model.compat?.supportsOpenAIGrammarTools ?? false)) {
203
+ const messages = convertResponsesMessages(model, context, AZURE_TOOL_CALL_PROVIDERS, {
204
+ grammarToolInputProperties
205
+ });
194
206
  const params = {
195
207
  model: deploymentName,
196
208
  input: messages,
@@ -205,7 +217,10 @@ function buildParams(model, context, options, deploymentName) {
205
217
  params.temperature = options?.temperature;
206
218
  }
207
219
  if (context.tools && context.tools.length > 0) {
208
- params.tools = convertResponsesTools(context.tools);
220
+ params.tools = convertResponsesTools(context.tools, {
221
+ supportsStrictMode: model.compat?.supportsStrictMode ?? true,
222
+ supportsOpenAIGrammarTools: model.compat?.supportsOpenAIGrammarTools ?? false
223
+ });
209
224
  }
210
225
  if (model.reasoning) {
211
226
  if (options?.reasoningEffort || options?.reasoningSummary) {
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  embedScript,
3
3
  embeddingProvider
4
- } from "./cli-4cb3p8pj.js";
5
- import"./cli-0ap79nha.js";
4
+ } from "./cli-yyqpn0gc.js";
5
+ import"./cli-9hewdgzb.js";
6
6
  import"./cli-q25ejbyn.js";
7
7
  import {
8
8
  getDb,
9
9
  init_db
10
- } from "./cli-383wyw2f.js";
10
+ } from "./cli-2846g99z.js";
11
11
  import"./cli-z2zcxes1.js";
12
+ import"./cli-dn5ycmtw.js";
13
+ import"./cli-4j2mrzag.js";
12
14
  import"./cli-bw80ck94.js";
13
15
  import"./cli-xz9aq0rf.js";
14
- import"./cli-gq12jc1m.js";
15
- import"./cli-4j2mrzag.js";
16
16
  import"./cli-p9swy5t3.js";
17
17
 
18
18
  // src/be/scripts/boot-reembed.ts
@@ -3,17 +3,17 @@ import {
3
3
  getEmbeddingProvider,
4
4
  getMemoryStore,
5
5
  init_constants
6
- } from "./cli-0ap79nha.js";
6
+ } from "./cli-9hewdgzb.js";
7
7
  import"./cli-q25ejbyn.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-383wyw2f.js";
11
+ } from "./cli-2846g99z.js";
12
12
  import"./cli-z2zcxes1.js";
13
+ import"./cli-dn5ycmtw.js";
14
+ import"./cli-4j2mrzag.js";
13
15
  import"./cli-bw80ck94.js";
14
16
  import"./cli-xz9aq0rf.js";
15
- import"./cli-gq12jc1m.js";
16
- import"./cli-4j2mrzag.js";
17
17
  import"./cli-p9swy5t3.js";
18
18
 
19
19
  // src/be/memory/boot-reembed.ts
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-383wyw2f.js";
4
+ } from "./cli-2846g99z.js";
5
5
  import"./cli-z2zcxes1.js";
6
- import"./cli-bw80ck94.js";
7
- import"./cli-xz9aq0rf.js";
8
- import"./cli-gq12jc1m.js";
6
+ import"./cli-dn5ycmtw.js";
9
7
  import {
10
8
  init_secret_scrubber,
11
9
  scrubSecrets
12
10
  } from "./cli-4j2mrzag.js";
11
+ import"./cli-bw80ck94.js";
12
+ import"./cli-xz9aq0rf.js";
13
13
  import"./cli-p9swy5t3.js";
14
14
 
15
15
  // src/be/boot-scrub-logs.ts
@@ -12,15 +12,15 @@ import {
12
12
  resolveClaudeBinary,
13
13
  resolveClaudeBinaryArgv,
14
14
  resolveClaudeBridgeEnabled
15
- } from "./cli-mw3xpgwb.js";
15
+ } from "./cli-x4apc9t3.js";
16
16
  import"./cli-psrqtw2m.js";
17
17
  import"./cli-tng3131n.js";
18
18
  import"./cli-zm7njwzd.js";
19
- import"./cli-tghre7g6.js";
19
+ import"./cli-cw70hymf.js";
20
20
  import"./cli-e61fs2hp.js";
21
+ import"./cli-7zd05xb4.js";
21
22
  import"./cli-z2zcxes1.js";
22
23
  import"./cli-4j2mrzag.js";
23
- import"./cli-7zd05xb4.js";
24
24
  import"./cli-p9swy5t3.js";
25
25
  export {
26
26
  resolveClaudeBridgeEnabled,
@@ -3,12 +3,12 @@ import {
3
3
  checkClaudeManagedCredentials,
4
4
  composeManagedUserMessage,
5
5
  normalizeRepoUrl
6
- } from "./cli-2r7s8jhp.js";
6
+ } from "./cli-5c4327dx.js";
7
7
  import"./cli-07er7wrs.js";
8
8
  import"./cli-yv9dttkh.js";
9
9
  import"./cli-d6n0thxw.js";
10
10
  import"./cli-gz9sbyk3.js";
11
- import"./cli-tghre7g6.js";
11
+ import"./cli-cw70hymf.js";
12
12
  import"./cli-4j2mrzag.js";
13
13
  import"./cli-p9swy5t3.js";
14
14
  export {
@@ -2,7 +2,7 @@ import {
2
2
  getScriptApiTypes,
3
3
  getScriptMcpTypes,
4
4
  require_typescript
5
- } from "./cli-py8z9bjq.js";
5
+ } from "./cli-e0zbndab.js";
6
6
  import {
7
7
  deleteSwarmConfigByKey,
8
8
  getAgentById,
@@ -11,7 +11,7 @@ import {
11
11
  getSwarmConfigs,
12
12
  init_db,
13
13
  upsertSwarmConfig
14
- } from "./cli-383wyw2f.js";
14
+ } from "./cli-2846g99z.js";
15
15
  import {
16
16
  init_secret_scrubber,
17
17
  scrubSecrets
@@ -431,7 +431,7 @@ export interface SwarmSdk {
431
431
  // --- repos ---
432
432
  repo_list(args?: Record<string, unknown>): Promise<unknown>;
433
433
  // --- schedules ---
434
- schedule_list(args?: Record<string, unknown>): Promise<unknown>;
434
+ schedule_list(args?: { enabled?: boolean; name?: string; scheduleType?: "recurring" | "one_time"; targetType?: "agent-task" | "workflow" | "script"; workflowId?: string; scriptName?: string; hideCompleted?: boolean; consecutiveErrorsMin?: number; lastRunStatus?: "failed" | "succeeded" }): Promise<unknown>;
435
435
  // --- scripts ---
436
436
  script_search(args: { query?: string; scope?: ScriptScope; limit?: number }): Promise<unknown>;
437
437
  script_run(args: { name?: string; source?: string; args?: unknown; intent?: string; scope?: ScriptScope; fsMode?: ScriptFsMode; idempotencyKey?: string }): Promise<unknown>;
@@ -455,7 +455,7 @@ export interface SwarmSdk {
455
455
  context_history(args?: { agentId?: string; field?: "soulMd" | "identityMd" | "toolsMd" | "claudeMd" | "setupScript"; limit?: number }): Promise<unknown>;
456
456
  context_diff(args: { versionId: string; compareToVersionId?: string }): Promise<unknown>;
457
457
  // --- workflows ---
458
- workflow_list(args?: { enabled?: boolean; includeFull?: boolean }): Promise<unknown>;
458
+ workflow_list(args?: { enabled?: boolean; includeFull?: boolean; consecutiveErrorsMin?: number; lastRunStatus?: "running" | "waiting" | "completed" | "failed" | "skipped" | "cancelled" }): Promise<unknown>;
459
459
  workflow_get(args: { id: string }): Promise<unknown>;
460
460
  workflow_listRuns(args: { workflowId: string; status?: "running" | "waiting" | "completed" | "failed" | "skipped" | "cancelled" }): Promise<unknown>;
461
461
  workflow_getRun(args: { id: string }): Promise<unknown>;
@@ -516,6 +516,7 @@ export interface SwarmSdk {
516
516
  // --- write: schedules ---
517
517
  schedule_create(args: Record<string, unknown>): Promise<unknown>;
518
518
  schedule_update(args: Record<string, unknown>): Promise<unknown>;
519
+ schedule_patch(args: Record<string, unknown>): Promise<unknown>;
519
520
  schedule_delete(args: { id: string }): Promise<unknown>;
520
521
  schedule_runNow(args: { id: string }): Promise<unknown>;
521
522
 
@@ -17,10 +17,14 @@ import {
17
17
  CONTEXT_FORMULA,
18
18
  clampContextPercent,
19
19
  getContextWindowSize
20
- } from "./cli-tghre7g6.js";
20
+ } from "./cli-cw70hymf.js";
21
21
  import {
22
22
  applyReasoningEffort
23
23
  } from "./cli-e61fs2hp.js";
24
+ import {
25
+ DEFAULT_OPENROUTER_BASE_URL,
26
+ getOpenRouterBaseUrl
27
+ } from "./cli-3dpj7atn.js";
24
28
  import {
25
29
  init_credentials,
26
30
  validateOpencodeCredentials
@@ -1646,6 +1650,21 @@ async function readSpawnOutput(stream) {
1646
1650
  function formatUnknownError(err) {
1647
1651
  return err instanceof Error ? err.message : String(err);
1648
1652
  }
1653
+ function applyOpenRouterBaseUrlOverride(opencodeConfig, env = process.env) {
1654
+ const openRouterBaseUrl = getOpenRouterBaseUrl(env);
1655
+ if (openRouterBaseUrl === DEFAULT_OPENROUTER_BASE_URL)
1656
+ return;
1657
+ opencodeConfig.provider = {
1658
+ ...opencodeConfig.provider,
1659
+ openrouter: {
1660
+ ...opencodeConfig.provider?.openrouter,
1661
+ options: {
1662
+ ...opencodeConfig.provider?.openrouter?.options,
1663
+ baseURL: openRouterBaseUrl
1664
+ }
1665
+ }
1666
+ };
1667
+ }
1649
1668
  async function refreshOpenRouterModelCache(opencodeConfig, configFilePath, dataHomePath) {
1650
1669
  const binary = process.env.OPENCODE_BINARY || "opencode";
1651
1670
  const proc = Bun.spawn([binary, "models", "--refresh", "openrouter"], {
@@ -2072,6 +2091,7 @@ class OpencodeAdapter {
2072
2091
  }
2073
2092
  };
2074
2093
  }
2094
+ applyOpenRouterBaseUrlOverride(opencodeConfig, config.env ?? process.env);
2075
2095
  try {
2076
2096
  await Bun.write(configFilePath, JSON.stringify(opencodeConfig, null, 2));
2077
2097
  } catch {}
@@ -2081,13 +2101,18 @@ class OpencodeAdapter {
2081
2101
  SWARM_API_KEY: process.env.SWARM_API_KEY,
2082
2102
  SWARM_AGENT_ID: process.env.SWARM_AGENT_ID,
2083
2103
  SWARM_TASK_ID: process.env.SWARM_TASK_ID,
2084
- SWARM_IS_LEAD: process.env.SWARM_IS_LEAD
2104
+ SWARM_IS_LEAD: process.env.SWARM_IS_LEAD,
2105
+ OPENROUTER_BASE_URL: process.env.OPENROUTER_BASE_URL
2085
2106
  };
2086
2107
  process.env.SWARM_API_URL = config.apiUrl;
2087
2108
  process.env.SWARM_API_KEY = config.apiKey;
2088
2109
  process.env.SWARM_AGENT_ID = config.agentId;
2089
2110
  process.env.SWARM_TASK_ID = config.taskId;
2090
2111
  process.env.SWARM_IS_LEAD = config.role === "lead" ? "true" : "false";
2112
+ const spawnOpenRouterBaseUrl = getOpenRouterBaseUrl(config.env ?? process.env);
2113
+ if (spawnOpenRouterBaseUrl !== DEFAULT_OPENROUTER_BASE_URL) {
2114
+ process.env.OPENROUTER_BASE_URL = spawnOpenRouterBaseUrl;
2115
+ }
2091
2116
  process.env.CONTEXT_MODE_EXTERNAL_MCP_NUDGE_EVERY = CTX_MODE_NUDGE_EVERY;
2092
2117
  const prevOpencodeConfig = process.env.OPENCODE_CONFIG;
2093
2118
  process.env.OPENCODE_CONFIG = configFilePath;
@@ -2198,4 +2223,4 @@ class OpencodeAdapter {
2198
2223
  }
2199
2224
  }
2200
2225
 
2201
- export { checkOpencodeCredentials, _setOpenRouterModelCacheRefreshForTests, resolveContextModePluginPath, OpencodeSession, OpencodeAdapter };
2226
+ export { checkOpencodeCredentials, applyOpenRouterBaseUrlOverride, _setOpenRouterModelCacheRefreshForTests, resolveContextModePluginPath, OpencodeSession, OpencodeAdapter };