@desplega.ai/agent-swarm 2.13.1 → 2.13.2

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 (183) hide show
  1. package/README.md +1 -1
  2. package/dist/{acp-adapter-xtj40wd8.js → acp-adapter-x1qqgzwx.js} +5 -5
  3. package/dist/{acp-targets-n7vm5atw.js → acp-targets-mz8c5dnt.js} +4 -4
  4. package/dist/{actions-hq6wp9xv.js → actions-5ft3qp5a.js} +25 -25
  5. package/dist/{agent-fs-provision-y0qc1rdd.js → agent-fs-provision-6fgz7wvz.js} +4 -4
  6. package/dist/{amp-adapter-1qqs6h91.js → amp-adapter-nthn8ezm.js} +1 -1
  7. package/dist/{app-7m4z44rv.js → app-535m78qw.js} +8 -8
  8. package/dist/{approval-notifications-8sr41gjx.js → approval-notifications-dewbk403.js} +9 -9
  9. package/dist/{assistant-hkczwfv6.js → assistant-39zyabv2.js} +25 -25
  10. package/dist/{boot-args-schema-8025snev.js → boot-args-schema-bqv5bf77.js} +1 -1
  11. package/dist/{boot-reembed-4bbpxjh1.js → boot-reembed-157c0gcz.js} +1 -1
  12. package/dist/{boot-reembed-15m87nr1.js → boot-reembed-fas7z3zn.js} +1 -1
  13. package/dist/{boot-scrub-sweep-eajr97e9.js → boot-scrub-sweep-tmec0be2.js} +2 -2
  14. package/dist/{boot-seeds-9cwy39jx.js → boot-seeds-32zm50x2.js} +4 -4
  15. package/dist/{claude-adapter-g61wa4rt.js → claude-adapter-gwq7x2nj.js} +2 -2
  16. package/dist/{claude-managed-adapter-znkk0prm.js → claude-managed-adapter-rkvw6fvq.js} +2 -2
  17. package/dist/{claude-managed-setup-f1wndkr2.js → claude-managed-setup-0vgz4d1j.js} +4 -4
  18. package/dist/{claude-sdk-session-687xzf21.js → claude-sdk-session-5wbwxy8c.js} +11964 -11769
  19. package/dist/{cli-snypfjgj.js → cli-0f7n3td3.js} +1 -1
  20. package/dist/{cli-0m77n7ej.js → cli-1f48qdnb.js} +54 -12
  21. package/dist/{cli-04103ryh.js → cli-1gevjrc1.js} +1 -1
  22. package/dist/{cli-a8ts6x1n.js → cli-2wde56gv.js} +5 -5
  23. package/dist/{cli-aebswqmz.js → cli-31vt7baf.js} +14 -14
  24. package/dist/{cli-cn6fpa1p.js → cli-4djg31jh.js} +1 -1
  25. package/dist/{cli-bjmq14k9.js → cli-5k1hvycs.js} +3 -3
  26. package/dist/{cli-mmw2sjaf.js → cli-62fjschk.js} +1 -1
  27. package/dist/{cli-t90k0phh.js → cli-69eq6gdk.js} +15 -15
  28. package/dist/{cli-dd57p1gd.js → cli-6rmryz03.js} +2 -2
  29. package/dist/{cli-byxsctca.js → cli-7m6bbtab.js} +6 -6
  30. package/dist/{cli-c8kqmzzf.js → cli-8a4qg44m.js} +1 -1
  31. package/dist/{cli-8rbkw18r.js → cli-8qvte9hn.js} +2 -2
  32. package/dist/{cli-h03j6je3.js → cli-a6rzw649.js} +2 -2
  33. package/dist/{cli-w41bvvms.js → cli-b0kqw55g.js} +1 -1
  34. package/dist/{cli-84xtgbn6.js → cli-b0m3bg0f.js} +100 -2
  35. package/dist/{cli-zaate0rd.js → cli-c9bwawf9.js} +2 -2
  36. package/dist/{cli-4mj5g29m.js → cli-cs26ed89.js} +6 -6
  37. package/dist/{cli-yeh3g1q6.js → cli-d0jb2qnt.js} +23 -23
  38. package/dist/{cli-cp0m07wb.js → cli-d528acsw.js} +1 -1
  39. package/dist/{cli-fn8aj7gb.js → cli-dnvmwsvc.js} +95 -68
  40. package/dist/{cli-w6c6dj91.js → cli-e87fg3en.js} +1 -1
  41. package/dist/{cli-h9bejmkf.js → cli-erh1rgh4.js} +49 -26
  42. package/dist/{cli-9xx36trj.js → cli-ewb028rs.js} +2 -2
  43. package/dist/{cli-hs3mqswp.js → cli-f1sdh8ca.js} +4 -4
  44. package/dist/{cli-zvpkrgsc.js → cli-fcwrd7bh.js} +3 -3
  45. package/dist/{cli-sfajkbd7.js → cli-fgm2mad9.js} +2 -2
  46. package/dist/{cli-32xndx6b.js → cli-g0b3ma7r.js} +1 -1
  47. package/dist/{cli-nk8swfpx.js → cli-gc7jkf4a.js} +3 -3
  48. package/dist/{cli-z6m6xzxt.js → cli-getrvmtx.js} +26 -5
  49. package/dist/{cli-y6qqbpwc.js → cli-j2ybkdk2.js} +1 -1
  50. package/dist/{cli-1dr5at77.js → cli-jkkcm72j.js} +10 -10
  51. package/dist/{cli-cqxwjb93.js → cli-ka13xx6b.js} +1 -1
  52. package/dist/{cli-4h90xaet.js → cli-m1wddksc.js} +1 -1
  53. package/dist/{cli-qx1dwrr5.js → cli-n14r8h4n.js} +2 -2
  54. package/dist/{cli-jhtvt7gn.js → cli-n46d87mj.js} +3 -3
  55. package/dist/{cli-13t0smbk.js → cli-nkfv398a.js} +185 -58
  56. package/dist/{cli-p7g7wd9n.js → cli-nvqq3232.js} +7 -7
  57. package/dist/{cli-0a336ze7.js → cli-r4fphq38.js} +3 -3
  58. package/dist/{cli-4tbvndmm.js → cli-r8ddn0hf.js} +1 -1
  59. package/dist/{cli-3m8vqehw.js → cli-rvhaahfv.js} +2 -2
  60. package/dist/{cli-cd9acnvd.js → cli-s08zsqva.js} +2 -2
  61. package/dist/{cli-w24f3j49.js → cli-sjk85d7v.js} +6 -5
  62. package/dist/{cli-grcc2h2g.js → cli-t9nxq30h.js} +6 -6
  63. package/dist/{cli-6r1dwegd.js → cli-tbdw3f92.js} +2 -2
  64. package/dist/{cli-0fx95c06.js → cli-tceqvv6h.js} +2 -2
  65. package/dist/{cli-tzzas8rb.js → cli-tgmate57.js} +2 -2
  66. package/dist/{cli-3zyme1wt.js → cli-wdtqkqnq.js} +3 -3
  67. package/dist/{cli-8cmjkbvj.js → cli-x7aqhxj5.js} +1 -1
  68. package/dist/{cli-7ewre3dm.js → cli-xerdrnqs.js} +2 -2
  69. package/dist/{cli-c0tyzt73.js → cli-xysy1g8x.js} +1 -1
  70. package/dist/{cli-1b5axkt1.js → cli-zm6bkx3e.js} +2 -2
  71. package/dist/{cli-1carhg8g.js → cli-zqy28rwx.js} +2 -2
  72. package/dist/cli.js +17 -16
  73. package/dist/{codex-adapter-ysfg6ty3.js → codex-adapter-x25xfbnh.js} +2 -2
  74. package/dist/{codex-session-runner-823scr6g.js → codex-session-runner-kn5xnrvp.js} +2 -2
  75. package/dist/{commands-5rbm07fz.js → commands-8n59gxmy.js} +3 -3
  76. package/dist/{controllers-connect-34jzhfft.js → controllers-connect-09gvkrhc.js} +24 -24
  77. package/dist/core-2b8bv6ny.js +42 -0
  78. package/dist/{db-6bkgbfwk.js → db-e71keqxk.js} +3 -3
  79. package/dist/{db-hcj16x7z.js → db-spg81qtr.js} +1 -1
  80. package/dist/{dispatcher-jgjqrfzv.js → dispatcher-fr4vawwb.js} +23 -23
  81. package/dist/{easter-egg-3d-w17nsny6.js → easter-egg-3d-ac9tv9a6.js} +1 -1
  82. package/dist/{embedding-space-v06fwy7b.js → embedding-space-an77f45k.js} +6 -6
  83. package/dist/{embeddings-g50dxea4.js → embeddings-jkrehejr.js} +1 -1
  84. package/dist/{execute-1n36haw1.js → execute-3mys4nta.js} +1 -1
  85. package/dist/{external-channel-43tv8pg6.js → external-channel-s6zxpts9.js} +2 -2
  86. package/dist/{fx-adapter-bvh05t4a.js → fx-adapter-4yet1c4f.js} +6 -6
  87. package/dist/{grok-adapter-my5j8mdf.js → grok-adapter-8ge6tw7m.js} +6 -6
  88. package/dist/handlers-0r9evrdj.js +41 -0
  89. package/dist/{heartbeat-sf3nk937.js → heartbeat-jjpb44e5.js} +25 -25
  90. package/dist/{hook-m1m9dm6w.js → hook-68gbs87k.js} +1 -1
  91. package/dist/{hook-dqph1e05.js → hook-y6n23zzj.js} +1 -1
  92. package/dist/{http-w0th1cz9.js → http-8c6y008s.js} +297 -97
  93. package/dist/{index-ffba0z8q.js → index-0vthtbc2.js} +20 -18
  94. package/dist/index-1v23363p.js +39 -0
  95. package/dist/index-30qw6vyw.js +44 -0
  96. package/dist/index-6bm3w6cn.js +40 -0
  97. package/dist/{index-gkpfgpg7.js → index-6h3r0vpe.js} +1 -1
  98. package/dist/{index-e8pz8qdg.js → index-7dgxveck.js} +2 -2
  99. package/dist/{index-k8ajc0g0.js → index-maddg9ys.js} +1 -1
  100. package/dist/{index-y4vd4mhn.js → index-mbpxhc4w.js} +1 -1
  101. package/dist/index-rz8ve510.js +569 -0
  102. package/dist/{index-c0e8en64.js → index-we3nd2t0.js} +1 -1
  103. package/dist/{index-pb03vans.js → index-xcw7hjt5.js} +25 -25
  104. package/dist/{index-ez823q84.js → index-ym9fgxad.js} +1 -1
  105. package/dist/{keepalive-2v06q2e8.js → keepalive-7e9r5dvp.js} +4 -4
  106. package/dist/lead-3jpc7kcr.js +79 -0
  107. package/dist/{maintenance-vx7vjhhy.js → maintenance-d3erjvcg.js} +1 -1
  108. package/dist/{oauth-refresh-sweep-g06k4bza.js → oauth-refresh-sweep-0qh70988.js} +3 -3
  109. package/dist/{object-webhooks-3dzdq4fm.js → object-webhooks-ac7v2q5p.js} +7 -7
  110. package/dist/{onboard-232pazny.js → onboard-5yphtken.js} +3 -3
  111. package/dist/{opencode-adapter-t0paqbh8.js → opencode-adapter-0xvyba4m.js} +3 -3
  112. package/dist/{otel-impl-kmpkyp4y.js → otel-impl-svqp691q.js} +1 -1
  113. package/dist/{pending-x0z3vx1x.js → pending-bn4xe5br.js} +24 -24
  114. package/dist/{pi-mono-adapter-7pmypn6d.js → pi-mono-adapter-763s8a3w.js} +6 -6
  115. package/dist/{pricing-refresh-ytjmtyd7.js → pricing-refresh-kfc215mf.js} +2 -2
  116. package/dist/{rbac-roles-fgm5mxr2.js → rbac-roles-3bznvkpt.js} +3 -3
  117. package/dist/{rbac-roles-xyaxekh3.js → rbac-roles-6r4h2ghj.js} +2 -2
  118. package/dist/{render-v2-ws972g4r.js → render-v2-f3qedbpy.js} +8 -8
  119. package/dist/{resume-m6mjzhkp.js → resume-vcag4ann.js} +11 -11
  120. package/dist/{runtime-zzpc0c8a.js → runtime-x0s55z2t.js} +1 -1
  121. package/dist/{session-access-vp35xs91.js → session-access-nwzve8q2.js} +5 -5
  122. package/dist/{session-source-backfill-p73e8zbe.js → session-source-backfill-jpqfzmgz.js} +1 -1
  123. package/dist/{setup-r4kd7rxg.js → setup-d2smwaem.js} +1 -1
  124. package/dist/thread-buffer-8fc703jc.js +42 -0
  125. package/dist/{tree-visibility-07h2tbs2.js → tree-visibility-dwzc8en0.js} +2 -2
  126. package/dist/{user-merge-jobs-96vg9rpe.js → user-merge-jobs-4ce7kma2.js} +3 -3
  127. package/dist/{virtual-modules-vgn3f2x4.js → virtual-modules-78a6yw71.js} +1 -1
  128. package/dist/{work-objects-74hbcx3e.js → work-objects-m0w1e7q8.js} +26 -26
  129. package/dist/worker-3p2vq107.js +79 -0
  130. package/dist/{worker-follow-up-ezavwn5d.js → worker-follow-up-e3t6f895.js} +23 -23
  131. package/openapi.json +3 -2
  132. package/package.json +6 -5
  133. package/src/be/migrations/341_user_token_expiry.sql +4 -0
  134. package/src/be/scripts/run-credential.ts +55 -1
  135. package/src/be/scripts/typecheck.ts +4 -4
  136. package/src/be/scripts/user-code-mode.ts +160 -0
  137. package/src/be/users.ts +48 -7
  138. package/src/commands/onboard/agent-fs-version.ts +1 -1
  139. package/src/http/script-connection-proxy.ts +18 -6
  140. package/src/http/scripts.ts +2 -11
  141. package/src/http/users.ts +1 -0
  142. package/src/integrations/chat-sdk/adapters.ts +29 -0
  143. package/src/integrations/chat-sdk/limits.ts +3 -0
  144. package/src/integrations/chat-sdk/rocketchat/README.md +8 -0
  145. package/src/integrations/chat-sdk/rocketchat/index.ts +790 -0
  146. package/src/integrations/chat-sdk/rocketchat/markdown.ts +210 -0
  147. package/src/integrations/chat-sdk/rocketchat/types.ts +249 -0
  148. package/src/integrations/chat-sdk/runtime.ts +11 -5
  149. package/src/integrations/chat-sdk/schema.ts +37 -3
  150. package/src/integrations/chat-sdk/status.ts +9 -0
  151. package/src/providers/amp-adapter.ts +1 -1
  152. package/src/rbac/legacy-policy.ts +1 -0
  153. package/src/rbac/permissions.ts +4 -0
  154. package/src/scripts-runtime/executors/native.ts +225 -67
  155. package/src/scripts-runtime/mcp-client.ts +2 -1
  156. package/src/scripts-runtime/swarm-sdk.ts +2 -1
  157. package/src/scripts-runtime/types/stdlib.d.ts +4 -4
  158. package/src/scripts-runtime/types/swarm-sdk.d.ts +4 -4
  159. package/src/server-user.ts +98 -0
  160. package/src/tests/chat-sdk-rocketchat-vendored.test.ts +67 -0
  161. package/src/tests/chat-sdk-status-route.test.ts +13 -1
  162. package/src/tests/codex-app-server.test.ts +4 -6
  163. package/src/tests/mcp-user-route.test.ts +10 -1
  164. package/src/tests/script-connections-mcp.test.ts +14 -10
  165. package/src/tests/script-connections-sql.test.ts +6 -2
  166. package/src/tests/script-connections.test.ts +2 -0
  167. package/src/tools/script-common.ts +37 -22
  168. package/src/tools/script-query-types.ts +1 -1
  169. package/src/tools/script-run.ts +1 -1
  170. package/src/tools/script-search.ts +12 -10
  171. package/src/tools/utils.ts +7 -1
  172. package/templates/skills/chat-sdk/content.md +2 -2
  173. package/templates/skills/swarm-docs/content.md +2 -0
  174. package/dist/core-kdehq26g.js +0 -42
  175. package/dist/handlers-wyymeeqh.js +0 -41
  176. package/dist/index-22khdtby.js +0 -44
  177. package/dist/index-np0582ac.js +0 -40
  178. package/dist/index-vgkrj1jt.js +0 -39
  179. package/dist/lead-55z813ng.js +0 -79
  180. package/dist/thread-buffer-cm2nzq6t.js +0 -42
  181. package/dist/worker-5pn2vzx6.js +0 -79
  182. package/dist/{cli-5v6b2am8.js → cli-bp2rt28p.js} +4 -4
  183. /package/dist/{cli-m4ejz4nj.js → cli-cah298e5.js} +0 -0
@@ -287,7 +287,16 @@ describe("/mcp-user auth and tool surface", () => {
287
287
  };
288
288
  const names = result.result.tools.map((tool) => tool.name).sort();
289
289
  expect(names).toEqual(
290
- ["cancel-task", "get-task-details", "get-tasks", "send-task", "steer-task"].sort(),
290
+ [
291
+ "cancel-task",
292
+ "get-task-details",
293
+ "get-tasks",
294
+ "script-get-types",
295
+ "script-run",
296
+ "script-search",
297
+ "send-task",
298
+ "steer-task",
299
+ ].sort(),
291
300
  );
292
301
  const sendTask = result.result.tools.find((tool) => tool.name === "send-task");
293
302
  expect(Object.keys(sendTask?.inputSchema.properties ?? {}).sort()).toEqual(
@@ -565,7 +565,7 @@ describe("script MCP connections", () => {
565
565
  }
566
566
  });
567
567
 
568
- test("proxy route allows repo-scoped MCP connections after descriptor-time gating", async () => {
568
+ test("proxy route allows repo-scoped MCP connections for a lead only", async () => {
569
569
  const fake = startFakeMcpServer();
570
570
  try {
571
571
  const lead = await createAgent({ name: "mcp-repo-lead", isLead: true, status: "idle" });
@@ -579,17 +579,21 @@ describe("script MCP connections", () => {
579
579
  mcpServerId: mcpServer.id,
580
580
  agentId: lead.id,
581
581
  });
582
+ const call = (agentId: string) =>
583
+ dispatchProxyApi(`/api/script-connections/${connection.id}/mcp-call`, {
584
+ method: "POST",
585
+ headers: {
586
+ Authorization: `Bearer ${API_KEY}`,
587
+ "X-Agent-ID": agentId,
588
+ "Content-Type": "application/json",
589
+ },
590
+ body: JSON.stringify({ tool: "echo-tool", arguments: { message: "repo" } }),
591
+ });
582
592
 
583
- const response = await dispatchProxyApi(`/api/script-connections/${connection.id}/mcp-call`, {
584
- method: "POST",
585
- headers: {
586
- Authorization: `Bearer ${API_KEY}`,
587
- "X-Agent-ID": worker.id,
588
- "Content-Type": "application/json",
589
- },
590
- body: JSON.stringify({ tool: "echo-tool", arguments: { message: "repo" } }),
591
- });
593
+ expect((await call(worker.id)).status).toBe(403);
594
+ expect(fake.requests.filter((request) => request.method === "tools/call")).toHaveLength(0);
592
595
 
596
+ const response = await call(lead.id);
593
597
  expect(response.status).toBe(200);
594
598
  expect(((await response.json()) as { ok: boolean }).ok).toBe(true);
595
599
  } finally {
@@ -373,13 +373,17 @@ describe("sql-query route", () => {
373
373
  expect(executorCalls).toHaveLength(0);
374
374
  });
375
375
 
376
- test("repo-scoped connections resolve the repo-scope secret", async () => {
376
+ test("repo-scoped connections resolve the repo-scope secret for a lead only", async () => {
377
377
  const repoId = crypto.randomUUID();
378
378
  const connection = await createSql({ scope: "repo", scopeId: repoId });
379
379
  expect(await configRows("connection.analytics.secret")).toEqual([
380
380
  expect.objectContaining({ scope: "repo", scopeId: repoId }),
381
381
  ]);
382
- const response = await sqlQuery(connection.id, workerId, { sql: "select 1" });
382
+ expect((await sqlQuery(connection.id, workerId, { sql: "select 1" })).status).toBe(403);
383
+ expect((await sqlQuery(connection.id, "workflow", { sql: "select 1" })).status).toBe(403);
384
+ expect(executorCalls).toHaveLength(0);
385
+
386
+ const response = await sqlQuery(connection.id, leadId, { sql: "select 1" });
383
387
  expect(response.json()).toMatchObject({ ok: true });
384
388
  expect(executorCalls[0]?.dsn).toBe(DSN);
385
389
  });
@@ -726,6 +726,8 @@ describe("script connections", () => {
726
726
  markMigrationApplied(database, "338_audit_agent_columns.sql");
727
727
  // 340 alters api_key_status, which this migration-112-only fixture does not create.
728
728
  markMigrationApplied(database, "340_api_key_spend_cap.sql");
729
+ // 341 alters user_tokens, which this fixture does not create.
730
+ markMigrationApplied(database, "341_user_token_expiry.sql");
729
731
 
730
732
  const id = crypto.randomUUID();
731
733
  const now = new Date().toISOString();
@@ -142,11 +142,7 @@ function describeScriptFailure(
142
142
  return undefined;
143
143
  }
144
144
 
145
- export async function proxyScriptsApi(args: {
146
- method: "GET" | "POST" | "PATCH" | "DELETE";
147
- path: string;
148
- body?: unknown;
149
- requestInfo: RequestInfo;
145
+ type ScriptToolRendering = {
150
146
  successMessage: (data: unknown) => string;
151
147
  /** Optional model-facing rendering of the success payload (appended to the text channel). */
152
148
  successDetails?: (data: unknown) => string | undefined;
@@ -162,26 +158,45 @@ export async function proxyScriptsApi(args: {
162
158
  * no pagination) — everything else stays capped.
163
159
  */
164
160
  uncappedDetails?: boolean;
165
- }): Promise<SwarmToolResult> {
161
+ };
162
+
163
+ /**
164
+ * Turn a scripts API response into the tool result. Shared by the agent
165
+ * tools (over HTTP) and the user MCP code-mode tools (in process).
166
+ */
167
+ export function scriptsApiToolResult(
168
+ data: unknown,
169
+ res: { ok: boolean; status: number },
170
+ args: ScriptToolRendering,
171
+ ): SwarmToolResult {
172
+ const toolData = { status: res.status, data };
173
+ const failure = describeScriptFailure(res.ok, res.status, data);
174
+ if (failure) {
175
+ return toolErr(failure.message, {
176
+ details: failure.details ?? capDetails(args.failureDetails?.(data)),
177
+ data: toolData,
178
+ });
179
+ }
180
+
181
+ const successDetails = args.successDetails?.(data);
182
+ return toolOk(args.successMessage(data), {
183
+ details: args.uncappedDetails ? successDetails : capDetails(successDetails),
184
+ data: toolData,
185
+ });
186
+ }
187
+
188
+ export async function proxyScriptsApi(
189
+ args: {
190
+ method: "GET" | "POST" | "PATCH" | "DELETE";
191
+ path: string;
192
+ body?: unknown;
193
+ requestInfo: RequestInfo;
194
+ } & ScriptToolRendering,
195
+ ): Promise<SwarmToolResult> {
166
196
  return proxySwarmApi({
167
197
  ...args,
168
198
  transportError: SCRIPT_TRANSPORT_ERROR,
169
- respond: (data, res) => {
170
- const toolData = { status: res.status, data };
171
- const failure = describeScriptFailure(res.ok, res.status, data);
172
- if (failure) {
173
- return toolErr(failure.message, {
174
- details: failure.details ?? capDetails(args.failureDetails?.(data)),
175
- data: toolData,
176
- });
177
- }
178
-
179
- const successDetails = args.successDetails?.(data);
180
- return toolOk(args.successMessage(data), {
181
- details: args.uncappedDetails ? successDetails : capDetails(successDetails),
182
- data: toolData,
183
- });
184
- },
199
+ respond: (data, res) => scriptsApiToolResult(data, res, args),
185
200
  });
186
201
  }
187
202
 
@@ -11,7 +11,7 @@ import {
11
11
  export const SCRIPT_QUERY_TYPES_DESCRIPTION =
12
12
  "Fetch the auto-generated `swarm-sdk.d.ts` (derived from the live MCP tool registry) + the `stdlib.d.ts` blobs — for IDE-style introspection before authoring or running a script. Pass `name` to also get that script's signature; omit it for the swarm-wide type surface. The same types are used by `script-upsert`'s typecheck pass, so they are authoritative.";
13
13
 
14
- function renderTypeBlobs(data: unknown): string | undefined {
14
+ export function renderTypeBlobs(data: unknown): string | undefined {
15
15
  if (typeof data !== "object" || data === null) return undefined;
16
16
  const body = data as {
17
17
  signature?: unknown;
@@ -13,7 +13,7 @@ import {
13
13
  export const SCRIPT_RUN_DESCRIPTION =
14
14
  "Run a named swarm-shared script (callable across agents and from workflow `swarm-script` nodes), OR inline source (auto-saved as scratch to the catalog). Inline source executes without the `script-upsert` compile-time typecheck. Use for swarm-visible, durable scripts. For local-only throwaway TS, use code-mode `run`. The run ends when the script's default export resolves: a call it did not await gets 2 s more, then is stopped (native) or aborted at once (quickjs), so await every write that must land. A `Promise.race` deadline therefore bounds the run; a nested `script_run` that lost the race keeps running on the server under its own wall.";
15
15
 
16
- function renderRunOutput(data: unknown): string | undefined {
16
+ export function renderRunOutput(data: unknown): string | undefined {
17
17
  if (typeof data !== "object" || data === null) return undefined;
18
18
  const body = data as {
19
19
  result?: unknown;
@@ -6,7 +6,7 @@ import { proxyScriptsApi, scriptScopeSchema, scriptToolOutputSchema } from "./sc
6
6
  export const SCRIPT_SEARCH_DESCRIPTION =
7
7
  "Semantic search over swarm-shared TypeScript scripts (catalog persisted in the agent-swarm DB; callable from agents and workflows). For ephemeral throwaway TS on your local machine, use code-mode instead.";
8
8
 
9
- function renderSearchResults(data: unknown): string | undefined {
9
+ export function renderSearchResults(data: unknown): string | undefined {
10
10
  if (typeof data !== "object" || data === null) return undefined;
11
11
  const results = (data as { results?: unknown[] }).results;
12
12
  if (!Array.isArray(results) || results.length === 0) return undefined;
@@ -20,6 +20,16 @@ function renderSearchResults(data: unknown): string | undefined {
20
20
  .join("\n");
21
21
  }
22
22
 
23
+ export function searchSuccessMessage(data: unknown): string {
24
+ const results =
25
+ typeof data === "object" &&
26
+ data !== null &&
27
+ Array.isArray((data as { results?: unknown[] }).results)
28
+ ? (data as { results: unknown[] }).results
29
+ : [];
30
+ return `Found ${results.length} script(s).`;
31
+ }
32
+
23
33
  export const registerScriptSearchTool = (server: McpServer) => {
24
34
  createToolRegistrar(server)(
25
35
  "script-search",
@@ -40,15 +50,7 @@ export const registerScriptSearchTool = (server: McpServer) => {
40
50
  path: "/api/scripts/search",
41
51
  body: args,
42
52
  requestInfo,
43
- successMessage: (data) => {
44
- const results =
45
- typeof data === "object" &&
46
- data !== null &&
47
- Array.isArray((data as { results?: unknown[] }).results)
48
- ? (data as { results: unknown[] }).results
49
- : [];
50
- return `Found ${results.length} script(s).`;
51
- },
53
+ successMessage: searchSuccessMessage,
52
54
  successDetails: renderSearchResults,
53
55
  }),
54
56
  );
@@ -701,8 +701,14 @@ function canonicalOverflowPayload(toolName: string, result: SwarmToolResult): st
701
701
  * and the full value could never leave the store over MCP. Its oversized
702
702
  * results go out whole; the harness applies its own truncation and the
703
703
  * kv-get nudge steers big-value processing toward scripts.
704
+ *
705
+ * script-get-types is the user MCP's type surface (src/server-user.ts): a user
706
+ * has no kv to read a spill back from, and the declarations only help whole.
704
707
  */
705
- export const CTX_CONTROL_EXEMPT_TOOLS: ReadonlySet<string> = new Set(["kv-get"]);
708
+ export const CTX_CONTROL_EXEMPT_TOOLS: ReadonlySet<string> = new Set([
709
+ "kv-get",
710
+ "script-get-types",
711
+ ]);
706
712
 
707
713
  type ArrayTarget = {
708
714
  path: string;
@@ -1,6 +1,6 @@
1
1
  # Chat SDK
2
2
 
3
- The swarm receives messages from Telegram, Slack, Discord, and Microsoft Teams through the Chat SDK channel. A person mentions the bot or sends it a direct message, and the swarm creates a task for it. This skill tells you how to work on such a task.
3
+ The swarm receives messages from Telegram, Slack, Discord, Microsoft Teams, and Rocket.Chat through the Chat SDK channel. A person mentions the bot or sends it a direct message, and the swarm creates a task for it. This skill tells you how to work on such a task.
4
4
 
5
5
  ## How you know you are on a chat task
6
6
 
@@ -62,7 +62,7 @@ The upload limit is 50 MB per file on Telegram and 10 MB on Discord. A larger fi
62
62
 
63
63
  ## `chat-read-thread` limits per platform
64
64
 
65
- `chat-read-thread { threadId, limit? }` returns the most recent messages of a thread, oldest first. The thread id is the adapter name plus the URI-decoded remainder of the contextKey. Telegram ids have no escaping, so `telegram:555001` stays as it is. Slack, Discord, and Teams ids contain `%3A` in the contextKey, so do not build the id by hand. `chat-reply` resolves the thread itself. For `chat-read-thread`, use the thread id returned by `chat-reply`, `chat-post`, or `chat-open-dm`. You can read the thread of your current task. Any other thread needs lead privileges.
65
+ `chat-read-thread { threadId, limit? }` returns the most recent messages of a thread, oldest first. The thread id is the adapter name plus the URI-decoded remainder of the contextKey. Telegram ids have no escaping, so `telegram:555001` stays as it is. Slack, Discord, Teams, and Rocket.Chat ids contain `%3A` in the contextKey, so do not build the id by hand. `chat-reply` resolves the thread itself. For `chat-read-thread`, use the thread id returned by `chat-reply`, `chat-post`, or `chat-open-dm`. You can read the thread of your current task. Any other thread needs lead privileges.
66
66
 
67
67
  - Telegram has no history API. The SDK keeps the Telegram thread history it saw in the swarm database, capped at 100 messages and 7 days.
68
68
  - Teams needs the `Chat.Read.*` Graph permission on the bot. Without it, the call fails.
@@ -69,12 +69,14 @@ Fetch the page as markdown: `curl -fsSL https://docs.agent-swarm.dev/llms.mdx/do
69
69
  - [Reviewing marketplace partner payout discrepancies with AI agents](https://docs.agent-swarm.dev/docs/guides/marketplace-payout-exception-review). Reference.
70
70
  - [Preparing marketplace moderation appeals for human review with AI agents](https://docs.agent-swarm.dev/docs/guides/marketplace-moderation-appeals). Reference.
71
71
  - [Reviewing customer billing disputes with AI agents](https://docs.agent-swarm.dev/docs/guides/customer-billing-dispute-review). Reference.
72
+ - [Reviewing a proposed customer pricing change with AI agents](https://docs.agent-swarm.dev/docs/guides/customer-pricing-change-review). Reference.
72
73
  - [Escalating a customer support issue to engineering with AI agents](https://docs.agent-swarm.dev/docs/guides/ai-support-escalation-handoff). Reference.
73
74
  - [Reviewing inconsistent product listings across sales channels with AI agents](https://docs.agent-swarm.dev/docs/guides/marketplace-catalog-discrepancy-review). Reference.
74
75
  - [Handing off inventory discrepancies from operations to purchasing with AI agents](https://docs.agent-swarm.dev/docs/guides/ai-inventory-exception-handoff). Reference.
75
76
  - [Handing off unresolved operational work between shifts with AI agents](https://docs.agent-swarm.dev/docs/guides/ai-operations-shift-handoff). Reference.
76
77
  - [Preparing a disputed product return for a human decision with AI agents](https://docs.agent-swarm.dev/docs/guides/ai-returns-exception-handoff). Reference.
77
78
  - [Reviewing a supplier's security evidence before onboarding with AI agents](https://docs.agent-swarm.dev/docs/guides/supplier-security-evidence-review). Reference.
79
+ - [Coordinating a customer data access request across support, privacy and engineering with AI agents](https://docs.agent-swarm.dev/docs/guides/privacy-data-request-handoff). Reference.
78
80
  - [Reviewing supplier performance across delivery, quality and service records with AI agents](https://docs.agent-swarm.dev/docs/guides/supplier-performance-review). Reference.
79
81
  - [Deployment Guide](https://docs.agent-swarm.dev/docs/guides/deployment). When: Someone wants to run Agent Swarm on their own server with Docker Compose.
80
82
  - [One-click deploy](https://docs.agent-swarm.dev/docs/guides/one-click-deploy). When: Someone has no server yet and wants Agent Swarm running in the cloud with HTTPS.
@@ -1,42 +0,0 @@
1
- import {
2
- getDeploymentEnvValue2,
3
- loadGlobalConfigsIntoEnv2,
4
- reloadGlobalConfigsAndIntegrations2,
5
- scheduleIntegrationsReload2,
6
- handleCore2,
7
- init_core
8
- } from "./cli-fn8aj7gb.js";
9
- import"./cli-8rbkw18r.js";
10
- import"./cli-4h90xaet.js";
11
- import"./cli-13t0smbk.js";
12
- import"./cli-7ewre3dm.js";
13
- import"./cli-3zyme1wt.js";
14
- import"./cli-y6qqbpwc.js";
15
- import"./cli-y260hgep.js";
16
- import"./cli-cn6fpa1p.js";
17
- import"./cli-zvpkrgsc.js";
18
- import"./cli-1dr5at77.js";
19
- import"./cli-hs3mqswp.js";
20
- import"./cli-a8ts6x1n.js";
21
- import"./cli-0fx95c06.js";
22
- import"./cli-t90k0phh.js";
23
- import"./cli-cqxwjb93.js";
24
- import"./cli-4tbvndmm.js";
25
- import"./cli-84xtgbn6.js";
26
- import"./cli-vr4eyq6p.js";
27
- import"./cli-w6c6dj91.js";
28
- import"./cli-w41bvvms.js";
29
- import"./cli-vx9acp12.js";
30
- import"./cli-c0tyzt73.js";
31
- import"./cli-qx1dwrr5.js";
32
- import"./cli-z6m6xzxt.js";
33
- import"./cli-h9bejmkf.js";
34
- init_core();
35
-
36
- export {
37
- getDeploymentEnvValue2 as getDeploymentEnvValue,
38
- handleCore2 as handleCore,
39
- loadGlobalConfigsIntoEnv2 as loadGlobalConfigsIntoEnv,
40
- reloadGlobalConfigsAndIntegrations2 as reloadGlobalConfigsAndIntegrations,
41
- scheduleIntegrationsReload2 as scheduleIntegrationsReload
42
- };
@@ -1,41 +0,0 @@
1
- import {
2
- LOOKUP_USER_TEAM2,
3
- isUserAllowed2,
4
- registerMessageHandler2,
5
- init_handlers
6
- } from "./cli-p7g7wd9n.js";
7
- import"./cli-4mj5g29m.js";
8
- import"./cli-nk8swfpx.js";
9
- import"./cli-fn8aj7gb.js";
10
- import"./cli-8rbkw18r.js";
11
- import"./cli-4h90xaet.js";
12
- import"./cli-13t0smbk.js";
13
- import"./cli-7ewre3dm.js";
14
- import"./cli-3zyme1wt.js";
15
- import"./cli-y6qqbpwc.js";
16
- import"./cli-y260hgep.js";
17
- import"./cli-cn6fpa1p.js";
18
- import"./cli-zvpkrgsc.js";
19
- import"./cli-1dr5at77.js";
20
- import"./cli-hs3mqswp.js";
21
- import"./cli-a8ts6x1n.js";
22
- import"./cli-0fx95c06.js";
23
- import"./cli-t90k0phh.js";
24
- import"./cli-cqxwjb93.js";
25
- import"./cli-4tbvndmm.js";
26
- import"./cli-84xtgbn6.js";
27
- import"./cli-vr4eyq6p.js";
28
- import"./cli-w6c6dj91.js";
29
- import"./cli-w41bvvms.js";
30
- import"./cli-vx9acp12.js";
31
- import"./cli-c0tyzt73.js";
32
- import"./cli-qx1dwrr5.js";
33
- import"./cli-z6m6xzxt.js";
34
- import"./cli-h9bejmkf.js";
35
- init_handlers();
36
-
37
- export {
38
- LOOKUP_USER_TEAM2 as LOOKUP_USER_TEAM,
39
- isUserAllowed2 as isUserAllowed,
40
- registerMessageHandler2 as registerMessageHandler
41
- };
@@ -1,44 +0,0 @@
1
- import {
2
- getExecutorRegistry2,
3
- initWorkflows2,
4
- init_workflows
5
- } from "./cli-fn8aj7gb.js";
6
- import"./cli-8rbkw18r.js";
7
- import"./cli-4h90xaet.js";
8
- import"./cli-13t0smbk.js";
9
- import"./cli-7ewre3dm.js";
10
- import"./cli-3zyme1wt.js";
11
- import"./cli-y6qqbpwc.js";
12
- import"./cli-y260hgep.js";
13
- import"./cli-cn6fpa1p.js";
14
- import {
15
- retryFailedRun2,
16
- cancelWorkflowRun2
17
- } from "./cli-zvpkrgsc.js";
18
- import {
19
- startWorkflowExecution2
20
- } from "./cli-1dr5at77.js";
21
- import"./cli-hs3mqswp.js";
22
- import"./cli-a8ts6x1n.js";
23
- import"./cli-0fx95c06.js";
24
- import"./cli-t90k0phh.js";
25
- import"./cli-cqxwjb93.js";
26
- import"./cli-4tbvndmm.js";
27
- import"./cli-84xtgbn6.js";
28
- import"./cli-vr4eyq6p.js";
29
- import"./cli-w6c6dj91.js";
30
- import"./cli-w41bvvms.js";
31
- import"./cli-vx9acp12.js";
32
- import"./cli-c0tyzt73.js";
33
- import"./cli-qx1dwrr5.js";
34
- import"./cli-z6m6xzxt.js";
35
- import"./cli-h9bejmkf.js";
36
- init_workflows();
37
-
38
- export {
39
- cancelWorkflowRun2 as cancelWorkflowRun,
40
- getExecutorRegistry2 as getExecutorRegistry,
41
- initWorkflows2 as initWorkflows,
42
- retryFailedRun2 as retryFailedRun,
43
- startWorkflowExecution2 as startWorkflowExecution
44
- };
@@ -1,40 +0,0 @@
1
- import {
2
- calculateNextRun2,
3
- startScheduler2,
4
- stopScheduler2,
5
- runScheduleNow2,
6
- init_scheduler2
7
- } from "./cli-fn8aj7gb.js";
8
- import"./cli-8rbkw18r.js";
9
- import"./cli-4h90xaet.js";
10
- import"./cli-13t0smbk.js";
11
- import"./cli-7ewre3dm.js";
12
- import"./cli-3zyme1wt.js";
13
- import"./cli-y6qqbpwc.js";
14
- import"./cli-y260hgep.js";
15
- import"./cli-cn6fpa1p.js";
16
- import"./cli-zvpkrgsc.js";
17
- import"./cli-1dr5at77.js";
18
- import"./cli-hs3mqswp.js";
19
- import"./cli-a8ts6x1n.js";
20
- import"./cli-0fx95c06.js";
21
- import"./cli-t90k0phh.js";
22
- import"./cli-cqxwjb93.js";
23
- import"./cli-4tbvndmm.js";
24
- import"./cli-84xtgbn6.js";
25
- import"./cli-vr4eyq6p.js";
26
- import"./cli-w6c6dj91.js";
27
- import"./cli-w41bvvms.js";
28
- import"./cli-vx9acp12.js";
29
- import"./cli-c0tyzt73.js";
30
- import"./cli-qx1dwrr5.js";
31
- import"./cli-z6m6xzxt.js";
32
- import"./cli-h9bejmkf.js";
33
- init_scheduler2();
34
-
35
- export {
36
- calculateNextRun2 as calculateNextRun,
37
- runScheduleNow2 as runScheduleNow,
38
- startScheduler2 as startScheduler,
39
- stopScheduler2 as stopScheduler
40
- };
@@ -1,39 +0,0 @@
1
- import"./cli-ns59dc6r.js";
2
- import {
3
- parseHeartbeatIntervalMs2,
4
- startHeartbeat2,
5
- stopHeartbeat2
6
- } from "./cli-aebswqmz.js";
7
- import"./cli-byxsctca.js";
8
- import"./cli-50whymxq.js";
9
- import"./cli-fn8aj7gb.js";
10
- import"./cli-8rbkw18r.js";
11
- import"./cli-4h90xaet.js";
12
- import"./cli-13t0smbk.js";
13
- import"./cli-7ewre3dm.js";
14
- import"./cli-3zyme1wt.js";
15
- import"./cli-y6qqbpwc.js";
16
- import"./cli-y260hgep.js";
17
- import"./cli-cn6fpa1p.js";
18
- import"./cli-zvpkrgsc.js";
19
- import"./cli-1dr5at77.js";
20
- import"./cli-hs3mqswp.js";
21
- import"./cli-a8ts6x1n.js";
22
- import"./cli-0fx95c06.js";
23
- import"./cli-t90k0phh.js";
24
- import"./cli-cqxwjb93.js";
25
- import"./cli-4tbvndmm.js";
26
- import"./cli-84xtgbn6.js";
27
- import"./cli-vr4eyq6p.js";
28
- import"./cli-w6c6dj91.js";
29
- import"./cli-w41bvvms.js";
30
- import"./cli-vx9acp12.js";
31
- import"./cli-c0tyzt73.js";
32
- import"./cli-qx1dwrr5.js";
33
- import"./cli-z6m6xzxt.js";
34
- import"./cli-h9bejmkf.js";
35
- export {
36
- parseHeartbeatIntervalMs2 as parseHeartbeatIntervalMs,
37
- startHeartbeat2 as startHeartbeat,
38
- stopHeartbeat2 as stopHeartbeat
39
- };
@@ -1,79 +0,0 @@
1
- import"./cli-h9bejmkf.js";
2
- import"./cli-qx1dwrr5.js";
3
- import"./cli-8rbkw18r.js";
4
- import"./cli-4h90xaet.js";
5
- import"./cli-vx9acp12.js";
6
- import"./cli-cqxwjb93.js";
7
- import"./cli-w6c6dj91.js";
8
- import"./cli-vr4eyq6p.js";
9
- import"./cli-4tbvndmm.js";
10
- import"./cli-t90k0phh.js";
11
- import"./cli-hs3mqswp.js";
12
- import"./cli-zvpkrgsc.js";
13
- import {
14
- getEnabledCapabilities,
15
- init_server
16
- } from "./cli-fn8aj7gb.js";
17
- import"./cli-y260hgep.js";
18
- import"./cli-0fx95c06.js";
19
- import"./cli-a8ts6x1n.js";
20
- import"./cli-tzzas8rb.js";
21
- import"./cli-qn79645p.js";
22
- import {
23
- runAgent
24
- } from "./cli-yeh3g1q6.js";
25
- import"./cli-vdfngx2g.js";
26
- import"./cli-1b5axkt1.js";
27
- import"./cli-77cd6gy8.js";
28
- import"./cli-zkbz8m2q.js";
29
- import"./cli-hv3820ez.js";
30
- import"./cli-0xwb7zpt.js";
31
- import"./cli-c8kqmzzf.js";
32
- import"./cli-x5yb8zc8.js";
33
- import"./cli-cmgdptmx.js";
34
- import"./cli-gq6qhmrr.js";
35
- import"./cli-2v4xxnx2.js";
36
- import"./cli-d82btycs.js";
37
- import"./cli-0726awxw.js";
38
- import"./cli-mmw2sjaf.js";
39
- import"./cli-cd9acnvd.js";
40
- import"./cli-snxhtehz.js";
41
- import"./cli-m4ejz4nj.js";
42
- import"./cli-32xndx6b.js";
43
- import"./cli-at67kvnp.js";
44
- import"./cli-kr5tjjtz.js";
45
- import"./cli-dd57p1gd.js";
46
- import"./cli-gedf48yw.js";
47
- import"./cli-je587f74.js";
48
- import"./cli-t25rq8mg.js";
49
- import"./cli-cp0m07wb.js";
50
- import"./cli-0m77n7ej.js";
51
- import"./cli-5v6b2am8.js";
52
- import"./cli-3m8vqehw.js";
53
- import"./cli-9xx36trj.js";
54
- import"./cli-zaate0rd.js";
55
- import"./cli-13t0smbk.js";
56
- import"./cli-7ewre3dm.js";
57
- import"./cli-3zyme1wt.js";
58
- import"./cli-y6qqbpwc.js";
59
- import"./cli-cn6fpa1p.js";
60
- import"./cli-1dr5at77.js";
61
- import"./cli-84xtgbn6.js";
62
- import"./cli-w41bvvms.js";
63
- import"./cli-c0tyzt73.js";
64
- import"./cli-z6m6xzxt.js";
65
-
66
- // src/commands/lead.ts
67
- init_server();
68
- var leadConfig = {
69
- role: "lead",
70
- defaultPrompt: "/start-leader",
71
- metadataType: "lead_metadata",
72
- capabilities: getEnabledCapabilities()
73
- };
74
- async function runLead(opts) {
75
- return runAgent(leadConfig, opts);
76
- }
77
- export {
78
- runLead
79
- };
@@ -1,42 +0,0 @@
1
- import {
2
- bufferThreadMessage2,
3
- restoreBufferedSlackMessages2,
4
- getBufferMessageCount2,
5
- instantFlush2,
6
- init_thread_buffer
7
- } from "./cli-4mj5g29m.js";
8
- import"./cli-nk8swfpx.js";
9
- import"./cli-fn8aj7gb.js";
10
- import"./cli-8rbkw18r.js";
11
- import"./cli-4h90xaet.js";
12
- import"./cli-13t0smbk.js";
13
- import"./cli-7ewre3dm.js";
14
- import"./cli-3zyme1wt.js";
15
- import"./cli-y6qqbpwc.js";
16
- import"./cli-y260hgep.js";
17
- import"./cli-cn6fpa1p.js";
18
- import"./cli-zvpkrgsc.js";
19
- import"./cli-1dr5at77.js";
20
- import"./cli-hs3mqswp.js";
21
- import"./cli-a8ts6x1n.js";
22
- import"./cli-0fx95c06.js";
23
- import"./cli-t90k0phh.js";
24
- import"./cli-cqxwjb93.js";
25
- import"./cli-4tbvndmm.js";
26
- import"./cli-84xtgbn6.js";
27
- import"./cli-vr4eyq6p.js";
28
- import"./cli-w6c6dj91.js";
29
- import"./cli-w41bvvms.js";
30
- import"./cli-vx9acp12.js";
31
- import"./cli-c0tyzt73.js";
32
- import"./cli-qx1dwrr5.js";
33
- import"./cli-z6m6xzxt.js";
34
- import"./cli-h9bejmkf.js";
35
- init_thread_buffer();
36
-
37
- export {
38
- bufferThreadMessage2 as bufferThreadMessage,
39
- getBufferMessageCount2 as getBufferMessageCount,
40
- instantFlush2 as instantFlush,
41
- restoreBufferedSlackMessages2 as restoreBufferedSlackMessages
42
- };