@desplega.ai/agent-swarm 1.119.6 → 1.121.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 (207) hide show
  1. package/README.md +2 -2
  2. package/dist/{actions-qe5zjcbr.js → actions-mwshtkf7.js} +6 -6
  3. package/dist/{anthropic-messages-qjxzsabf.js → anthropic-messages-4gn944cn.js} +29 -13
  4. package/dist/{app-31x7k3vj.js → app-skbty91x.js} +4 -4
  5. package/dist/{assistant-4crt9dve.js → assistant-tg7dhfj8.js} +13 -13
  6. package/dist/{azure-openai-responses-ntfd05zd.js → azure-openai-responses-79zc0wyy.js} +28 -13
  7. package/dist/{boot-reembed-8g69ttz4.js → boot-reembed-ntjmeyh2.js} +4 -4
  8. package/dist/{boot-reembed-q648j733.js → boot-reembed-q5x0xpcp.js} +5 -5
  9. package/dist/{boot-scrub-logs-sfmzd2hj.js → boot-scrub-logs-5gznsfbe.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-bpvgs2y6.js → cli-072t49hf.js} +2123 -1533
  13. package/dist/{cli-g6qz2kts.js → cli-0df2g86x.js} +336 -18
  14. package/dist/cli-1728qh70.js +791 -0
  15. package/dist/{cli-vg1jxfqz.js → cli-3b1ayz83.js} +5 -5
  16. package/dist/{cli-r93nz80j.js → cli-3fxqwfh3.js} +1 -1
  17. package/dist/{cli-w6rhc30s.js → cli-3jrdwnn9.js} +20 -5
  18. package/dist/{cli-pasyk3vc.js → cli-46etyprn.js} +10 -5
  19. package/dist/{cli-433c0f4b.js → cli-4pfweq4x.js} +8 -8
  20. package/dist/{cli-2r7s8jhp.js → cli-5c4327dx.js} +7 -1
  21. package/dist/{cli-4s84mw72.js → cli-5hpvd15x.js} +2 -2
  22. package/dist/{cli-branks1w.js → cli-6s3ytc5x.js} +1 -1
  23. package/dist/{cli-da3x3btq.js → cli-7pt9sc83.js} +2 -2
  24. package/dist/{cli-2gv8ygwr.js → cli-7pzae66m.js} +2 -2
  25. package/dist/{cli-qs7nb3zn.js → cli-8wrympd7.js} +27 -1
  26. package/dist/{cli-qw1ccvxm.js → cli-95rbe11h.js} +70 -51
  27. package/dist/{cli-6rvm3jkk.js → cli-agdrxyex.js} +1 -1
  28. package/dist/{cli-wr706gez.js → cli-av2s7my4.js} +167 -66
  29. package/dist/{cli-59jy217p.js → cli-avw9ev3x.js} +55 -21
  30. package/dist/{cli-fkxxh5d4.js → cli-b2mqkg1h.js} +2 -2
  31. package/dist/{cli-1arw00dp.js → cli-ccjwgarc.js} +12 -3
  32. package/dist/{cli-pscrc6tw.js → cli-ch7t5v7n.js} +5 -0
  33. package/dist/{cli-tghre7g6.js → cli-cw70hymf.js} +1 -0
  34. package/dist/{cli-n61x2aph.js → cli-dmzv0986.js} +816 -1335
  35. package/dist/{cli-d1reabed.js → cli-g9vva2qh.js} +2 -2
  36. package/dist/{cli-ner6af7m.js → cli-gdpx70nc.js} +24048 -23715
  37. package/dist/{cli-96feg24n.js → cli-ghq3v4c9.js} +2 -2
  38. package/dist/{cli-wxbnjgce.js → cli-ky8esb8t.js} +3 -3
  39. package/dist/{cli-gdqdkr3j.js → cli-nf7sadev.js} +2 -2
  40. package/dist/{cli-h6cf69x5.js → cli-p9w7kb3h.js} +1 -1
  41. package/dist/{cli-xeatwfbe.js → cli-ry656xem.js} +24 -17
  42. package/dist/{cli-q8dway4w.js → cli-s8bdcke2.js} +1 -1
  43. package/dist/cli-s8s499xy.js +81 -0
  44. package/dist/{cli-sbkwvn5e.js → cli-srjqn7fd.js} +1 -1
  45. package/dist/cli-tv7vekye.js +367 -0
  46. package/dist/{cli-gg5bd32n.js → cli-vg3zrw6h.js} +4 -4
  47. package/dist/{cli-vx0y68jv.js → cli-vp9r4ap4.js} +5 -4
  48. package/dist/{cli-mg280wsv.js → cli-we156bmz.js} +1 -1
  49. package/dist/{cli-86fdnerz.js → cli-wwsaj97q.js} +9 -4
  50. package/dist/{cli-e0y603nn.js → cli-x0e0yvnq.js} +101 -1
  51. package/dist/{cli-mw3xpgwb.js → cli-x4apc9t3.js} +4 -4
  52. package/dist/cli.js +26 -21
  53. package/dist/{codex-adapter-6j2b38tg.js → codex-adapter-mmy741zd.js} +8 -9
  54. package/dist/{codex-session-runner-vz215wgw.js → codex-session-runner-sazmx9zt.js} +8 -9
  55. package/dist/{commands-6xr20jbe.js → commands-cxxye5e4.js} +3 -3
  56. package/dist/{db-1mmvk1z4.js → db-ab1954b7.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-xvrknk8w.js → handlers-fmfe2343.js} +13 -13
  60. package/dist/{hook-qm7he8wn.js → hook-ygnw3cvt.js} +7 -8
  61. package/dist/{http-hj08zq67.js → http-kactcc0z.js} +1128 -536
  62. package/dist/{index-688jph6a.js → index-6erq0wvk.js} +11 -11
  63. package/dist/{index-gze4fg2w.js → index-g86j2yt5.js} +9 -9
  64. package/dist/{index-etz7d8md.js → index-gmzs6a2q.js} +10 -10
  65. package/dist/{index-wj8dfpwh.js → index-hmp82wn0.js} +12 -12
  66. package/dist/{keepalive-94wn9yxw.js → keepalive-3cvt26dw.js} +18 -14
  67. package/dist/{lead-rvcqkp11.js → lead-ysf26cjr.js} +31 -32
  68. package/dist/{maintenance-qhfc4dnp.js → maintenance-9npwptbb.js} +5 -5
  69. package/dist/{mistral-conversations-ykcg66za.js → mistral-conversations-26ya4yah.js} +17 -13
  70. package/dist/{oauth-refresh-sweep-rj8wgvsw.js → oauth-refresh-sweep-0r2v76vw.js} +23 -17
  71. package/dist/{onboard-8bv8q1wc.js → onboard-ddb1674a.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-h6rkxwrk.js} +2 -2
  76. package/dist/{openrouter-images-4fsrrzes.js → openrouter-images-dgq98729.js} +10 -3
  77. package/dist/{otel-impl-1kf6fr2m.js → otel-impl-b43bkq8e.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-ke789738.js} +2328 -1281
  80. package/dist/{pricing-refresh-e84tar2s.js → pricing-refresh-2rqf114z.js} +5 -5
  81. package/dist/{rbac-roles-atytq5ch.js → rbac-roles-5wkhc8xv.js} +5 -5
  82. package/dist/{rbac-roles-pg0zvnwn.js → rbac-roles-6vtafvzb.js} +4 -4
  83. package/dist/{seed-pricing-xd6nxq7k.js → seed-pricing-23wrb873.js} +4 -4
  84. package/dist/{setup-4z389yk0.js → setup-6rny4fk6.js} +2 -2
  85. package/dist/{worker-m61r0t7m.js → worker-yapewe14.js} +31 -32
  86. package/openapi.json +2671 -1811
  87. package/package.json +10 -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/connection-bindings-blob-migration.ts +123 -0
  91. package/src/be/db-queries/mcp-oauth.ts +409 -247
  92. package/src/be/db-queries/oauth.ts +813 -131
  93. package/src/be/db.ts +97 -6
  94. package/src/be/migrations/117_unified_oauth.sql +624 -0
  95. package/src/be/migrations/119_agent_avatar.sql +7 -0
  96. package/src/be/migrations/120_task_title.sql +3 -0
  97. package/src/be/oauth-credential-bindings.ts +48 -14
  98. package/src/be/oauth-encryption-backfill.ts +84 -0
  99. package/src/be/oauth-refresh-sweep.ts +38 -23
  100. package/src/be/script-connections.ts +1130 -163
  101. package/src/be/script-credential-broker.ts +37 -27
  102. package/src/be/scripts/typecheck.ts +3 -2
  103. package/src/be/seed-capabilities.ts +62 -0
  104. package/src/be/seed-pricing.ts +1 -1
  105. package/src/be/seed-scripts/catalog/ops-catalog-audit.inline.ts +1 -1
  106. package/src/be/seed-scripts/catalog/ops-catalog-audit.ts +1 -1
  107. package/src/be/vendored-openapi.ts +98 -0
  108. package/src/commands/runner.ts +69 -6
  109. package/src/http/agents.ts +23 -5
  110. package/src/http/all-routes.ts +1 -0
  111. package/src/http/core.ts +8 -5
  112. package/src/http/index.ts +18 -5
  113. package/src/http/mcp-bridge.ts +5 -2
  114. package/src/http/mcp-oauth.ts +103 -101
  115. package/src/http/oauth-callback.ts +332 -0
  116. package/src/http/oauth-generic.ts +14 -54
  117. package/src/http/poll.ts +5 -1
  118. package/src/http/script-connections.ts +651 -170
  119. package/src/http/scripts.ts +4 -2
  120. package/src/http/sessions.ts +1 -1
  121. package/src/http/tasks.ts +35 -0
  122. package/src/http/trackers/jira.ts +22 -34
  123. package/src/http/trackers/linear.ts +21 -36
  124. package/src/http/x.ts +6 -2
  125. package/src/jira/app.ts +12 -6
  126. package/src/jira/oauth.ts +48 -48
  127. package/src/linear/app.ts +44 -2
  128. package/src/linear/oauth.ts +12 -37
  129. package/src/oauth/app-validation.ts +27 -9
  130. package/src/oauth/ensure-mcp-token.ts +1 -0
  131. package/src/oauth/ensure-token.ts +331 -108
  132. package/src/oauth/identity-capture.ts +103 -0
  133. package/src/oauth/keepalive.ts +14 -9
  134. package/src/oauth/presets.ts +242 -0
  135. package/src/oauth/wrapper.ts +197 -76
  136. package/src/prompts/base-prompt.ts +48 -4
  137. package/src/prompts/session-templates.ts +13 -1
  138. package/src/providers/claude-managed-models.ts +8 -0
  139. package/src/rbac/legacy-policy.ts +2 -1
  140. package/src/rbac/permissions.ts +7 -3
  141. package/src/scripts-runtime/credential-broker/broker.ts +51 -8
  142. package/src/scripts-runtime/credential-broker/fetch-patch.ts +30 -3
  143. package/src/scripts-runtime/credential-broker/index.ts +1 -1
  144. package/src/scripts-runtime/credential-broker/types.ts +55 -8
  145. package/src/scripts-runtime/egress-secrets.ts +6 -2
  146. package/src/scripts-runtime/eval-harness.ts +2 -2
  147. package/src/scripts-runtime/executors/types.ts +2 -1
  148. package/src/scripts-runtime/loader.ts +3 -0
  149. package/src/scripts-runtime/types/stdlib.d.ts +11 -0
  150. package/src/server.ts +230 -126
  151. package/src/tests/agent-avatar-resolution.test.ts +123 -0
  152. package/src/tests/agents-list-model-display.test.ts +10 -0
  153. package/src/tests/base-prompt.test.ts +72 -0
  154. package/src/tests/claude-managed-adapter.test.ts +6 -0
  155. package/src/tests/connection-embedded-auth.test.ts +709 -0
  156. package/src/tests/context-window.test.ts +1 -0
  157. package/src/tests/credential-broker.test.ts +123 -125
  158. package/src/tests/db-queries-oauth.test.ts +126 -1
  159. package/src/tests/ensure-token.test.ts +44 -2
  160. package/src/tests/list-endpoint-slimming.test.ts +45 -0
  161. package/src/tests/mcp-oauth-manual-client.test.ts +20 -1
  162. package/src/tests/mcp-oauth-queries.test.ts +154 -8
  163. package/src/tests/oauth-access-token-tool.test.ts +37 -1
  164. package/src/tests/oauth-callback-flow.test.ts +534 -0
  165. package/src/tests/oauth-credential-bindings.test.ts +50 -22
  166. package/src/tests/oauth-presets.test.ts +275 -0
  167. package/src/tests/oauth-refresh-failure.test.ts +263 -0
  168. package/src/tests/oauth-refresh-sweep.test.ts +83 -3
  169. package/src/tests/oauth-wrapper.test.ts +77 -55
  170. package/src/tests/prompt-template-session.test.ts +6 -5
  171. package/src/tests/rbac-charact-misc-tools.test.ts +60 -0
  172. package/src/tests/rbac-engine.test.ts +2 -1
  173. package/src/tests/script-connections-http.test.ts +356 -11
  174. package/src/tests/script-connections.test.ts +102 -0
  175. package/src/tests/sdk-allowlist.test.ts +4 -1
  176. package/src/tests/seed-capabilities.test.ts +92 -0
  177. package/src/tests/session-costs-model-key-normalize.test.ts +1 -0
  178. package/src/tests/sessions.test.ts +46 -0
  179. package/src/tests/spec-base-url.test.ts +266 -0
  180. package/src/tests/status.test.ts +3 -4
  181. package/src/tests/swarm-config-reserved-keys.test.ts +4 -2
  182. package/src/tests/task-title-route.test.ts +106 -0
  183. package/src/tests/tool-annotations.test.ts +6 -3
  184. package/src/tests/tracker-fold.test.ts +412 -0
  185. package/src/tests/unified-oauth-migration.test.ts +455 -0
  186. package/src/tests/vendored-openapi.test.ts +263 -0
  187. package/src/tools/credential-bindings/tool.ts +232 -77
  188. package/src/tools/oauth-access-token.ts +55 -6
  189. package/src/tools/script-connections/tool.ts +73 -53
  190. package/src/tools/swarm-config/set-config.ts +24 -50
  191. package/src/tools/update-profile.ts +15 -5
  192. package/src/tracker/types.ts +12 -0
  193. package/src/types.ts +29 -0
  194. package/src/utils/context-window.ts +1 -0
  195. package/src/workflows/executors/swarm-script.ts +6 -2
  196. package/vendored-openapi/README.md +22 -0
  197. package/vendored-openapi/github.json +7759 -0
  198. package/vendored-openapi/gmail.json +393 -0
  199. package/vendored-openapi/jira.json +3396 -0
  200. package/vendored-openapi/linear.json +252 -0
  201. package/vendored-openapi/manifest.json +128 -0
  202. package/vendored-openapi/slack.json +2895 -0
  203. package/dist/cli-0pygq9r1.js +0 -429
  204. package/dist/cli-8hhms4hp.js +0 -393
  205. package/dist/cli-z9gzq07x.js +0 -27
  206. package/src/scripts-runtime/credential-broker/store.ts +0 -72
  207. package/dist/{otel-g299k41b.js → otel-63jr5v38.js} +1 -1
@@ -27,7 +27,7 @@ import {
27
27
  getTaskById,
28
28
  init_db,
29
29
  setSlackMessageTracking
30
- } from "./cli-g6qz2kts.js";
30
+ } from "./cli-0df2g86x.js";
31
31
  import {
32
32
  require_receiver,
33
33
  require_sender,
@@ -55073,13 +55073,13 @@ async function initSlackApp() {
55073
55073
  socketMode: true,
55074
55074
  logLevel: import_bolt.LogLevel.DEBUG
55075
55075
  });
55076
- const { registerMessageHandler } = await import("./handlers-xvrknk8w.js");
55077
- const { registerCommandHandler } = await import("./commands-6xr20jbe.js");
55078
- const { registerActionHandlers } = await import("./actions-qe5zjcbr.js");
55076
+ const { registerMessageHandler } = await import("./handlers-fmfe2343.js");
55077
+ const { registerCommandHandler } = await import("./commands-cxxye5e4.js");
55078
+ const { registerActionHandlers } = await import("./actions-mwshtkf7.js");
55079
55079
  registerMessageHandler(app);
55080
55080
  registerCommandHandler(app);
55081
55081
  registerActionHandlers(app);
55082
- const { createAssistant } = await import("./assistant-4crt9dve.js");
55082
+ const { createAssistant } = await import("./assistant-tg7dhfj8.js");
55083
55083
  app.assistant(createAssistant());
55084
55084
  return app;
55085
55085
  }
@@ -6,7 +6,7 @@ import {
6
6
  getDb,
7
7
  init_db,
8
8
  isSqliteVecAvailable
9
- } from "./cli-g6qz2kts.js";
9
+ } from "./cli-0df2g86x.js";
10
10
  import {
11
11
  __esm,
12
12
  __export,
@@ -1,14 +1,15 @@
1
+ import {
2
+ import_websocket
3
+ } from "./cli-4w4fmq9x.js";
1
4
  import {
2
5
  require_ecdsa_sig_formatter,
3
6
  require_jws,
4
7
  require_p_retry
5
8
  } from "./cli-b0p7rfnd.js";
6
9
  import {
7
- import_websocket
8
- } from "./cli-4w4fmq9x.js";
9
- import {
10
+ resolveJsonSchemaStrictSampling,
10
11
  transformMessages
11
- } from "./cli-e0y603nn.js";
12
+ } from "./cli-x0e0yvnq.js";
12
13
  import {
13
14
  sanitizeSurrogates
14
15
  } from "./cli-y2apkfe2.js";
@@ -25227,6 +25228,10 @@ function convertTools(tools, useParameters = false) {
25227
25228
  }
25228
25229
  ];
25229
25230
  }
25231
+ function supportsGoogleStrictToolSampling(modelId) {
25232
+ const majorVersion = getGeminiMajorVersion(modelId);
25233
+ return majorVersion !== undefined && majorVersion >= 3;
25234
+ }
25230
25235
  function mapToolChoice(choice) {
25231
25236
  switch (choice) {
25232
25237
  case "auto":
@@ -25239,6 +25244,16 @@ function mapToolChoice(choice) {
25239
25244
  return FunctionCallingConfigMode.AUTO;
25240
25245
  }
25241
25246
  }
25247
+ function resolveGoogleFunctionCallingMode(tools, toolChoice, supportsStrictMode) {
25248
+ const useStrictMode = tools.some((tool) => resolveJsonSchemaStrictSampling(tool, supportsStrictMode) === true);
25249
+ if (toolChoice === "none" || toolChoice === "any") {
25250
+ return mapToolChoice(toolChoice);
25251
+ }
25252
+ if (useStrictMode) {
25253
+ return FunctionCallingConfigMode.VALIDATED;
25254
+ }
25255
+ return toolChoice ? mapToolChoice(toolChoice) : undefined;
25256
+ }
25242
25257
  function mapStopReason(reason) {
25243
25258
  switch (reason) {
25244
25259
  case FinishReason.STOP:
@@ -25268,4 +25283,4 @@ function mapStopReason(reason) {
25268
25283
  }
25269
25284
  }
25270
25285
 
25271
- export { ThinkingLevel, ResourceScope, GoogleGenAI, isThinkingPart, retainThoughtSignature, convertMessages, convertTools, mapToolChoice, mapStopReason };
25286
+ export { ThinkingLevel, ResourceScope, GoogleGenAI, isThinkingPart, retainThoughtSignature, convertMessages, convertTools, supportsGoogleStrictToolSampling, resolveGoogleFunctionCallingMode, mapStopReason };
@@ -7,7 +7,7 @@ var package_default;
7
7
  var init_package = __esm(() => {
8
8
  package_default = {
9
9
  name: "@desplega.ai/agent-swarm",
10
- version: "1.119.6",
10
+ version: "1.121.0",
11
11
  description: "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
12
12
  license: "MIT",
13
13
  author: "desplega.sh <contact@desplega.sh>",
@@ -37,6 +37,7 @@ var init_package = __esm(() => {
37
37
  "plugin/skills/",
38
38
  "plugin/pi-skills/",
39
39
  "templates/",
40
+ "vendored-openapi/",
40
41
  "openapi.json"
41
42
  ],
42
43
  module: "src/http.ts",
@@ -65,6 +66,7 @@ var init_package = __esm(() => {
65
66
  ],
66
67
  scripts: {
67
68
  "build:pi-skills": "bun run plugin/build-pi-skills.ts",
69
+ "build:script-types": "bun scripts/bundle-script-types.ts",
68
70
  "build:cli": "bun run scripts/build-cli.ts",
69
71
  "mono:build": "turbo run build",
70
72
  "mono:test": "turbo run test",
@@ -75,10 +77,13 @@ var init_package = __esm(() => {
75
77
  "check:db-boundary": "bash scripts/check-db-boundary.sh",
76
78
  "check:dep-graph": "depcruise src plugin/opencode-plugins --config .dependency-cruiser.cjs",
77
79
  "check:api-key-boundary": "bash scripts/check-api-key-boundary.sh",
80
+ "check:vendored-openapi": "bun scripts/check-vendored-openapi.ts",
78
81
  "check:rbac-coverage": "bun scripts/check-rbac-coverage.ts",
82
+ "check:script-types": "bash scripts/check-script-types-freshness.sh",
79
83
  "check:audit-columns": "bash scripts/check-audit-columns.sh",
80
84
  "lint:structure": "konsistent check",
81
85
  "prepare-release": "bun scripts/prepare-release.ts",
86
+ "refresh:vendored-openapi": "bun scripts/refresh-vendored-openapi.ts",
82
87
  "sync-chart-version": "bun scripts/sync-chart-version.ts",
83
88
  "check-chart-version": "bun scripts/sync-chart-version.ts --check-if-package-version-changed",
84
89
  cli: "bun src/cli.tsx",
@@ -147,14 +152,14 @@ var init_package = __esm(() => {
147
152
  "@aws-sdk/client-bedrock": "3.1048.0",
148
153
  "@desplega.ai/business-use": "^0.4.2",
149
154
  "@desplega.ai/localtunnel": "^2.2.0",
150
- "@earendil-works/pi-agent-core": "^0.81.1",
151
- "@earendil-works/pi-ai": "^0.81.1",
152
- "@earendil-works/pi-coding-agent": "^0.81.1",
155
+ "@earendil-works/pi-agent-core": "^0.82.1",
156
+ "@earendil-works/pi-ai": "^0.82.1",
157
+ "@earendil-works/pi-coding-agent": "^0.82.1",
153
158
  "@inkjs/ui": "^2.0.0",
154
159
  "@linear/sdk": "^77.0.0",
155
160
  "@modelcontextprotocol/sdk": "^1.25.1",
156
161
  "@openai/codex-sdk": "^0.145.0",
157
- "@opencode-ai/sdk": "^1.18.4",
162
+ "@opencode-ai/sdk": "^1.18.5",
158
163
  "@openfort/openfort-node": "^0.9.1",
159
164
  "@opentelemetry/api": "^1.9.1",
160
165
  "@opentelemetry/exporter-metrics-otlp-http": "^0.218.0",
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  createAdditiveBuffer,
3
3
  extractSlackMessageText
4
- } from "./cli-d1reabed.js";
5
- import {
6
- getSlackApp,
7
- registerTreeMessage
8
- } from "./cli-vg1jxfqz.js";
4
+ } from "./cli-g9vva2qh.js";
9
5
  import {
10
6
  rewriteSlackMentions
11
- } from "./cli-gdqdkr3j.js";
7
+ } from "./cli-nf7sadev.js";
12
8
  import {
13
9
  createTaskWithSiblingAwareness
14
- } from "./cli-q8dway4w.js";
10
+ } from "./cli-s8bdcke2.js";
11
+ import {
12
+ getSlackApp,
13
+ registerTreeMessage
14
+ } from "./cli-3b1ayz83.js";
15
15
  import {
16
16
  buildBufferFlushBlocks
17
17
  } from "./cli-ma04faw5.js";
@@ -24,7 +24,7 @@ import {
24
24
  init_registry,
25
25
  registerTemplate,
26
26
  slackContextKey
27
- } from "./cli-g6qz2kts.js";
27
+ } from "./cli-0df2g86x.js";
28
28
 
29
29
  // src/slack/event-dedup.ts
30
30
  var DEFAULT_TTL_MS = 300000;
@@ -15,7 +15,7 @@ import {
15
15
  clampContextPercent,
16
16
  computeContextUsedUnified,
17
17
  getContextWindowSize
18
- } from "./cli-tghre7g6.js";
18
+ } from "./cli-cw70hymf.js";
19
19
  import {
20
20
  init_secret_scrubber,
21
21
  scrubSecrets
@@ -26,6 +26,12 @@ init_secret_scrubber();
26
26
 
27
27
  // src/providers/claude-managed-models.ts
28
28
  var CLAUDE_MANAGED_MODEL_PRICING = {
29
+ "claude-opus-5": {
30
+ inputPerMillion: 5,
31
+ outputPerMillion: 25,
32
+ cacheReadPerMillion: 0.5,
33
+ cacheWritePerMillion: 6.25
34
+ },
29
35
  "claude-fable-5": {
30
36
  inputPerMillion: 10,
31
37
  outputPerMillion: 50,
@@ -4,11 +4,11 @@ import {
4
4
  getEmbeddingProvider,
5
5
  init_embedding,
6
6
  serializeEmbedding
7
- } from "./cli-r93nz80j.js";
7
+ } from "./cli-3fxqwfh3.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-g6qz2kts.js";
11
+ } from "./cli-0df2g86x.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets
@@ -17,7 +17,7 @@ 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";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./cli-r94z9p1z.js";
7
7
  import {
8
8
  summarizeSession
9
- } from "./cli-n61x2aph.js";
9
+ } from "./cli-dmzv0986.js";
10
10
  import {
11
11
  readPkgVersion
12
12
  } from "./cli-d6n0thxw.js";
@@ -31,7 +31,7 @@ import {
31
31
  CONTEXT_FORMULA,
32
32
  clampContextPercent,
33
33
  computeContextUsedUnified
34
- } from "./cli-tghre7g6.js";
34
+ } from "./cli-cw70hymf.js";
35
35
  import {
36
36
  applyReasoningEffort
37
37
  } from "./cli-e61fs2hp.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  PermissionVerbSchema
3
- } from "./cli-86fdnerz.js";
3
+ } from "./cli-wwsaj97q.js";
4
4
  import {
5
5
  getDb,
6
6
  init_db
7
- } from "./cli-g6qz2kts.js";
7
+ } from "./cli-0df2g86x.js";
8
8
 
9
9
  // src/be/rbac-roles.ts
10
10
  init_db();
@@ -73,4 +73,30 @@ function createAssistantMessageEventStream() {
73
73
  return new AssistantMessageEventStream;
74
74
  }
75
75
 
76
- export { EventStream, AssistantMessageEventStream, createAssistantMessageEventStream };
76
+ // node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js
77
+ function formatThrownValue(value) {
78
+ if (value instanceof Error)
79
+ return value.message || value.name;
80
+ if (typeof value === "string")
81
+ return value;
82
+ return String(value);
83
+ }
84
+ function extractDiagnosticError(error) {
85
+ if (!(error instanceof Error))
86
+ return { name: "ThrownValue", message: formatThrownValue(error) };
87
+ const code = error.code;
88
+ return {
89
+ name: error.name || undefined,
90
+ message: error.message || error.name,
91
+ stack: error.stack,
92
+ code: typeof code === "string" || typeof code === "number" ? code : undefined
93
+ };
94
+ }
95
+ function createAssistantMessageDiagnostic(type, error, details) {
96
+ return { type, timestamp: Date.now(), error: extractDiagnosticError(error), details };
97
+ }
98
+ function appendAssistantMessageDiagnostic(message, diagnostic) {
99
+ message.diagnostics = [...message.diagnostics ?? [], diagnostic];
100
+ }
101
+
102
+ export { EventStream, AssistantMessageEventStream, createAssistantMessageEventStream, formatThrownValue, extractDiagnosticError, createAssistantMessageDiagnostic, appendAssistantMessageDiagnostic };
@@ -2,30 +2,31 @@ import {
2
2
  getApiKey
3
3
  } from "./cli-f14fvzag.js";
4
4
  import {
5
- ensureTokenOrThrow,
6
- getOAuthApp,
7
- getOAuthTokens,
8
- isTokenExpiringSoon,
5
+ ensureAuthorizationTokenOrThrow,
9
6
  oauthAppRowToProviderConfig
10
- } from "./cli-8hhms4hp.js";
7
+ } from "./cli-tv7vekye.js";
11
8
  import {
12
- CredentialBroker,
13
- DEFAULT_CREDENTIAL_BINDINGS,
14
- SwarmConfigCredentialBindingStore,
15
9
  getScript,
16
10
  getScriptApiConnectionDescriptors,
17
11
  getScriptMcpConnectionDescriptors,
18
12
  getScriptVersion,
19
13
  listRelationalCredentialBindings,
20
14
  validateScriptImports
21
- } from "./cli-bpvgs2y6.js";
15
+ } from "./cli-072t49hf.js";
16
+ import {
17
+ getAuthorizationById,
18
+ getOAuthApp,
19
+ getOAuthAppById
20
+ } from "./cli-1728qh70.js";
22
21
  import {
23
22
  withSiblingAwareness
24
- } from "./cli-q8dway4w.js";
23
+ } from "./cli-s8bdcke2.js";
25
24
  import {
26
25
  getAppUrl
27
26
  } from "./cli-dh55d5fg.js";
28
27
  import {
28
+ CredentialBroker,
29
+ DEFAULT_CREDENTIAL_BINDINGS,
29
30
  FollowUpConfigSchema,
30
31
  ModelTierSchema,
31
32
  ReasoningEffortSchema,
@@ -60,6 +61,7 @@ import {
60
61
  getWorkflowVersions,
61
62
  getWorkflowsByScheduleId,
62
63
  init_context_key,
64
+ init_credential_broker,
63
65
  init_db,
64
66
  init_telemetry,
65
67
  init_template,
@@ -72,13 +74,7 @@ import {
72
74
  updateWorkflowRun,
73
75
  updateWorkflowRunStep,
74
76
  workflowContextKey
75
- } from "./cli-g6qz2kts.js";
76
- import {
77
- init_zod
78
- } from "./cli-bw80ck94.js";
79
- import {
80
- exports_external
81
- } from "./cli-xz9aq0rf.js";
77
+ } from "./cli-0df2g86x.js";
82
78
  import {
83
79
  init_secret_scrubber,
84
80
  isSensitiveKey,
@@ -86,6 +82,12 @@ import {
86
82
  scrubObject,
87
83
  scrubSecrets
88
84
  } from "./cli-4j2mrzag.js";
85
+ import {
86
+ init_zod
87
+ } from "./cli-bw80ck94.js";
88
+ import {
89
+ exports_external
90
+ } from "./cli-xz9aq0rf.js";
89
91
  import {
90
92
  init_event_bus,
91
93
  workflowEventBus
@@ -2618,7 +2620,7 @@ class HumanInTheLoopExecutor extends BaseExecutor {
2618
2620
  }
2619
2621
  if (notification.channel === "slack") {
2620
2622
  try {
2621
- const { getSlackApp } = await import("./app-31x7k3vj.js");
2623
+ const { getSlackApp } = await import("./app-skbty91x.js");
2622
2624
  const slackApp = getSlackApp();
2623
2625
  if (!slackApp) {
2624
2626
  console.warn("[HITL] Slack not initialized — cannot send notification");
@@ -2732,7 +2734,7 @@ class NotifyExecutor extends BaseExecutor {
2732
2734
  }
2733
2735
  }
2734
2736
  case "slack": {
2735
- const { getSlackApp } = await import("./app-31x7k3vj.js");
2737
+ const { getSlackApp } = await import("./app-skbty91x.js");
2736
2738
  const app = getSlackApp();
2737
2739
  if (!app) {
2738
2740
  return {
@@ -3027,60 +3029,71 @@ class ScriptExecutor extends BaseExecutor {
3027
3029
  init_zod();
3028
3030
 
3029
3031
  // src/be/script-credential-broker.ts
3032
+ init_credential_broker();
3030
3033
  init_secret_scrubber();
3031
3034
  init_db();
3032
3035
 
3033
3036
  // src/be/oauth-credential-bindings.ts
3034
3037
  var OAUTH_BINDING_REFRESH_BUFFER_MS = 5 * 60 * 1000;
3038
+ function oauthAppToProviderConfig(app) {
3039
+ return oauthAppRowToProviderConfig(app);
3040
+ }
3035
3041
  function getOAuthProviderConfig(provider) {
3036
3042
  const app = getOAuthApp(provider);
3037
3043
  return app ? oauthAppRowToProviderConfig(app) : null;
3038
3044
  }
3039
- function getOAuthBindingTokenStatus(provider) {
3040
- if (!getOAuthApp(provider))
3041
- return "missing";
3042
- if (!getOAuthTokens(provider))
3045
+ function getOAuthBindingTokenStatus(oauthAuthorizationId) {
3046
+ const authorization = getAuthorizationById(oauthAuthorizationId);
3047
+ const app = authorization ? getOAuthAppById(authorization.appId) : null;
3048
+ if (!authorization || !app || app.mcpServerId !== null) {
3043
3049
  return "missing";
3044
- return isTokenExpiringSoon(provider, OAUTH_BINDING_REFRESH_BUFFER_MS) ? "expiring" : "ok";
3045
- }
3046
- async function resolveOAuthBindingToken(provider) {
3047
- if (!getOAuthApp(provider))
3050
+ }
3051
+ if (authorization.status === "revoked")
3052
+ return "revoked";
3053
+ if (authorization.status === "refresh-failed")
3054
+ return "refresh-failed";
3055
+ if (!authorization.expiresAt)
3056
+ return "ok";
3057
+ const expiresAt = new Date(authorization.expiresAt).getTime();
3058
+ return Number.isNaN(expiresAt) || expiresAt - Date.now() < OAUTH_BINDING_REFRESH_BUFFER_MS ? "expiring" : "ok";
3059
+ }
3060
+ async function resolveOAuthBindingToken(oauthAuthorizationId) {
3061
+ const initial = getAuthorizationById(oauthAuthorizationId);
3062
+ if (!initial)
3048
3063
  return;
3049
- const initialTokens = getOAuthTokens(provider);
3050
- if (!initialTokens)
3064
+ const app = getOAuthAppById(initial.appId);
3065
+ if (!app || app.mcpServerId !== null)
3051
3066
  return;
3052
- if (isTokenExpiringSoon(provider, OAUTH_BINDING_REFRESH_BUFFER_MS)) {
3053
- await ensureTokenOrThrow(provider, OAUTH_BINDING_REFRESH_BUFFER_MS);
3067
+ if (initial.status === "revoked")
3068
+ return;
3069
+ const status = getOAuthBindingTokenStatus(oauthAuthorizationId);
3070
+ if (status === "expiring" || status === "refresh-failed") {
3071
+ await ensureAuthorizationTokenOrThrow(oauthAuthorizationId, OAUTH_BINDING_REFRESH_BUFFER_MS);
3054
3072
  }
3055
- return getOAuthTokens(provider)?.accessToken;
3073
+ return getAuthorizationById(oauthAuthorizationId)?.accessToken;
3056
3074
  }
3057
3075
 
3058
3076
  // src/be/script-credential-broker.ts
3059
- class RelationalCredentialBindingStore extends SwarmConfigCredentialBindingStore {
3077
+ class RelationalCredentialBindingStore {
3060
3078
  listActiveBindings(context) {
3061
- const relational = listRelationalCredentialBindings(context);
3062
- if (relational.length > 0)
3063
- return relational;
3064
- return super.listActiveBindings(context);
3079
+ return listRelationalCredentialBindings(context);
3065
3080
  }
3066
3081
  }
3067
- async function buildScriptCredentialBindings(input) {
3082
+ async function buildScriptCredentialBindingsWithFailures(input) {
3068
3083
  const resolvedConfigs = getResolvedConfig(input.agentId, input.repoId);
3069
3084
  const configMap = new Map(resolvedConfigs.map((config) => [config.key, config.value]));
3070
- const broker = new CredentialBroker(new RelationalCredentialBindingStore((filters) => getSwarmConfigs(filters)), (configKey) => configMap.get(configKey) ?? process.env[configKey], DEFAULT_CREDENTIAL_BINDINGS, async (provider) => {
3071
- try {
3072
- return await resolveOAuthBindingToken(provider);
3073
- } catch (err) {
3074
- const message = err instanceof Error ? err.message : String(err);
3075
- console.warn(`[script-credential-broker] skipping OAuth provider ${provider}: ${scrubSecrets(message)}`);
3076
- return;
3077
- }
3085
+ const broker = new CredentialBroker(new RelationalCredentialBindingStore, (configKey) => configMap.get(configKey) ?? process.env[configKey], DEFAULT_CREDENTIAL_BINDINGS, (oauthAuthorizationId) => resolveOAuthBindingToken(oauthAuthorizationId));
3086
+ const { resolved, failed } = await broker.resolveBindingsWithFailures({
3087
+ agentId: input.agentId,
3088
+ repoId: input.repoId
3078
3089
  });
3079
- const bindings = await broker.resolveBindings({ agentId: input.agentId, repoId: input.repoId });
3080
- for (const binding of bindings) {
3090
+ for (const binding of resolved) {
3081
3091
  registerVolatileSecret(binding.value, binding.configKey);
3082
3092
  }
3083
- return bindings;
3093
+ return { egressSecrets: resolved, failedBindings: failed };
3094
+ }
3095
+ async function buildScriptCredentialBindings(input) {
3096
+ return (await buildScriptCredentialBindingsWithFailures(input)).egressSecrets;
3084
3097
  }
3085
3098
 
3086
3099
  // src/scripts-runtime/executors/types.ts
@@ -3098,6 +3111,7 @@ var DEFAULT_SCRIPT_RESOURCES = {
3098
3111
  init_secret_scrubber();
3099
3112
 
3100
3113
  // src/scripts-runtime/egress-secrets.ts
3114
+ init_credential_broker();
3101
3115
  async function buildEgressSecrets() {
3102
3116
  const broker = new CredentialBroker({ listActiveBindings: () => [] }, (configKey) => process.env[configKey], DEFAULT_CREDENTIAL_BINDINGS);
3103
3117
  return await broker.resolveBindings({});
@@ -3349,6 +3363,7 @@ async function buildConfigPayload(input) {
3349
3363
  },
3350
3364
  user: input.userConfig ?? {},
3351
3365
  egressSecrets: input.egressSecrets ?? await buildEgressSecrets(),
3366
+ failedBindings: input.failedBindings ?? [],
3352
3367
  apiConnections: input.apiConnections ?? [],
3353
3368
  mcpConnections: input.mcpConnections ?? []
3354
3369
  };
@@ -3441,12 +3456,16 @@ class SwarmScriptExecutor extends BaseExecutor {
3441
3456
  if (!resolved.ok) {
3442
3457
  return { status: "failed", error: resolved.error };
3443
3458
  }
3459
+ const credentials = await buildScriptCredentialBindingsWithFailures({
3460
+ agentId: agentId ?? undefined
3461
+ });
3444
3462
  const output = await runScript({
3445
3463
  source: resolved.source,
3446
3464
  args: config.args,
3447
3465
  fsMode: "none",
3448
3466
  agentId: agentId ?? "workflow",
3449
- egressSecrets: await buildScriptCredentialBindings({ agentId: agentId ?? undefined }),
3467
+ egressSecrets: credentials.egressSecrets,
3468
+ failedBindings: credentials.failedBindings,
3450
3469
  apiConnections: getScriptApiConnectionDescriptors({ agentId: agentId ?? undefined }),
3451
3470
  mcpConnections: getScriptMcpConnectionDescriptors({ agentId: agentId ?? undefined }),
3452
3471
  timeoutMs: config.timeoutMs
@@ -3806,4 +3825,4 @@ function initWorkflows() {
3806
3825
  initWaitBusSubscriptions(_registry);
3807
3826
  }
3808
3827
 
3809
- export { getOAuthProviderConfig, getOAuthBindingTokenStatus, buildScriptCredentialBindings, runScript, generateEdges, findEntryNodes, getSuccessors, validateDefinition, applyDefinitionPatch, validateJsonSchema, TriggerSchemaError, startWorkflowExecution, setupWorkflowResumeListener, retryFailedRun, cancelWorkflowRun, resumeWaitState, initWaitBusSubscriptions, subscribeWaitToBus, recoverIncompleteRuns, startRetryPoller, stopRetryPoller, validateTemplateVariables, instantiateTemplate, handleWebhookTrigger, handleScheduleTrigger, verifyHmacSignature, WebhookError, snapshotWorkflow, startWaitPoller, stopWaitPoller, RawLlmConfigSchema, executeRawLlm, getExecutorRegistry, initWorkflows };
3828
+ export { oauthAppToProviderConfig, getOAuthProviderConfig, getOAuthBindingTokenStatus, buildScriptCredentialBindingsWithFailures, buildScriptCredentialBindings, runScript, generateEdges, findEntryNodes, getSuccessors, validateDefinition, applyDefinitionPatch, validateJsonSchema, TriggerSchemaError, startWorkflowExecution, setupWorkflowResumeListener, retryFailedRun, cancelWorkflowRun, resumeWaitState, initWaitBusSubscriptions, subscribeWaitToBus, recoverIncompleteRuns, startRetryPoller, stopRetryPoller, validateTemplateVariables, instantiateTemplate, handleWebhookTrigger, handleScheduleTrigger, verifyHmacSignature, WebhookError, snapshotWorkflow, startWaitPoller, stopWaitPoller, RawLlmConfigSchema, executeRawLlm, getExecutorRegistry, initWorkflows };
@@ -18,7 +18,7 @@ import {
18
18
  init_templates1 as init_templates,
19
19
  normalizeDateRequired,
20
20
  resolveTemplate
21
- } from "./cli-g6qz2kts.js";
21
+ } from "./cli-0df2g86x.js";
22
22
 
23
23
  // src/be/db-queries/tracker.ts
24
24
  init_date_utils();