@desplega.ai/agent-swarm 2.3.0 → 2.4.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 (332) hide show
  1. package/README.md +1 -0
  2. package/dist/{acp-adapter-v85a2bqy.js → acp-adapter-zvzr538d.js} +9 -9
  3. package/dist/{actions-zgcxfspj.js → actions-jhtqdw69.js} +21 -19
  4. package/dist/{amp-adapter-jw9xfz42.js → amp-adapter-bd84rhs2.js} +4 -4
  5. package/dist/{app-4e1s4675.js → app-kreq1gwg.js} +3 -3
  6. package/dist/{assistant-v238n9dk.js → assistant-3k22sbsq.js} +23 -21
  7. package/dist/{boot-reembed-p666cw5n.js → boot-reembed-e53x6b9v.js} +1 -1
  8. package/dist/{boot-reembed-w6pm64j4.js → boot-reembed-f6z923ny.js} +1 -1
  9. package/dist/{boot-scrub-sweep-jcyjagn3.js → boot-scrub-sweep-0538vsb7.js} +4 -4
  10. package/dist/{boot-seeds-gbedmamp.js → boot-seeds-6wxqkfk2.js} +4 -4
  11. package/dist/{claude-adapter-q7wspzt8.js → claude-adapter-gfts5044.js} +9 -9
  12. package/dist/{claude-managed-adapter-n7ahjyx6.js → claude-managed-adapter-h2y889ge.js} +3 -3
  13. package/dist/{claude-managed-setup-wza784fb.js → claude-managed-setup-h00hsgtz.js} +2 -2
  14. package/dist/{claude-sdk-session-yf400ptr.js → claude-sdk-session-56besmfz.js} +13 -13
  15. package/dist/{cli-65q70v2v.js → cli-0bh477zn.js} +33 -6
  16. package/dist/{cli-4ync7m60.js → cli-0ebey9hg.js} +1 -1
  17. package/dist/{cli-665j3feb.js → cli-0xk505e8.js} +1 -1
  18. package/dist/{cli-7gh7020n.js → cli-1dmcq2eh.js} +1 -1
  19. package/dist/{cli-gzvb3d4a.js → cli-1jx0srjt.js} +3 -3
  20. package/dist/{cli-zj4d6afs.js → cli-1pa3rz69.js} +21 -6
  21. package/dist/{cli-7ayprxp7.js → cli-2dfbv8qr.js} +8 -0
  22. package/dist/{cli-30m5q8mc.js → cli-3kh4kpqy.js} +6 -6
  23. package/dist/{cli-qrwp40st.js → cli-3p8fqcnh.js} +2 -2
  24. package/dist/{cli-y3dvz6ge.js → cli-3r448dqn.js} +3 -3
  25. package/dist/{cli-a17tzmn0.js → cli-3tnpj2bh.js} +7 -7
  26. package/dist/{cli-ea7chd26.js → cli-471qk6s2.js} +93 -46
  27. package/dist/{cli-a49vpbf3.js → cli-5kqnemen.js} +1 -1
  28. package/dist/{cli-0rh20bp3.js → cli-6ncjvx55.js} +3 -3
  29. package/dist/{cli-fb6t92v8.js → cli-6x9ma5w5.js} +1 -1
  30. package/dist/{cli-k28p6xh7.js → cli-7225gwj7.js} +2 -2
  31. package/dist/{cli-8cvvytad.js → cli-8nyhf7za.js} +3 -3
  32. package/dist/{cli-e09hj50q.js → cli-8wkb09q5.js} +11 -11
  33. package/dist/{cli-j0v75y13.js → cli-a0kcty51.js} +4 -4
  34. package/dist/{cli-zes4tsbb.js → cli-a4gvwttf.js} +4 -4
  35. package/dist/{cli-jhp7w1fy.js → cli-a5ebc95n.js} +2 -2
  36. package/dist/{cli-5d1m1qca.js → cli-ash6xxk7.js} +2 -2
  37. package/dist/{cli-fp4xbw07.js → cli-axh29tyr.js} +14 -12
  38. package/dist/{cli-p22zdvnt.js → cli-bn0rewsy.js} +3 -3
  39. package/dist/{cli-hz64bcnj.js → cli-bn5kevnf.js} +11 -373
  40. package/dist/{cli-8jtrekpy.js → cli-d2mb5s8a.js} +7 -7
  41. package/dist/{cli-c5sbmw1v.js → cli-d82btycs.js} +94 -15
  42. package/dist/{cli-vjfpshn3.js → cli-ejs3m1sx.js} +1 -1
  43. package/dist/{cli-yv0vgscc.js → cli-fpmsqq59.js} +18 -2
  44. package/dist/cli-fz9kewbh.js +382 -0
  45. package/dist/{cli-4s1kqrqg.js → cli-g0hgtz4p.js} +6 -6
  46. package/dist/{cli-hn3pftj2.js → cli-gf0kfg81.js} +7 -7
  47. package/dist/{cli-d43xqzbe.js → cli-hqhzg1qq.js} +2 -2
  48. package/dist/{cli-azs9bhc5.js → cli-j4rqdf2n.js} +2 -2
  49. package/dist/{cli-wtg6edvd.js → cli-jh0qcrga.js} +1 -1
  50. package/dist/{cli-kqypty34.js → cli-k9z4zd4p.js} +6 -5
  51. package/dist/{cli-jhmjwqcg.js → cli-kmqgmcnb.js} +47 -14
  52. package/dist/{cli-8qsx817b.js → cli-kr2pmfqx.js} +583 -769
  53. package/dist/{cli-4g629sgr.js → cli-m2qgh5sv.js} +20 -1
  54. package/dist/{cli-9e9kjqsj.js → cli-mfe7f7b5.js} +2 -2
  55. package/dist/{cli-x3en6ct3.js → cli-nwyw3zhg.js} +1 -1
  56. package/dist/{cli-6vcyw6v7.js → cli-nx462e4v.js} +5 -3
  57. package/dist/{cli-tr24eeny.js → cli-p0rakbrk.js} +9 -9
  58. package/dist/{cli-4hmaheb6.js → cli-p6argxh9.js} +9 -9
  59. package/dist/{cli-3avfh5az.js → cli-pemywhfq.js} +2 -2
  60. package/dist/{cli-etvn5ej2.js → cli-pnp2j5zg.js} +2 -2
  61. package/dist/{cli-wk8ccrz6.js → cli-pw7v69vp.js} +2 -2
  62. package/dist/{cli-ka01m5rb.js → cli-rdq7tzwm.js} +17 -14
  63. package/dist/{cli-re4wkbzx.js → cli-rqqsfz30.js} +677 -104
  64. package/dist/{cli-xgn4rwyv.js → cli-s48yvzb8.js} +4 -4
  65. package/dist/{cli-zv4vy2b0.js → cli-s95dknxh.js} +1 -1
  66. package/dist/{cli-g6p7c2my.js → cli-sjyetj21.js} +2 -2
  67. package/dist/{cli-rdr166ht.js → cli-smvcw9z5.js} +1 -1
  68. package/dist/{cli-fhvqt2fp.js → cli-sv5gb0yb.js} +1 -1
  69. package/dist/{cli-yv3n83x8.js → cli-syhq378v.js} +2 -2
  70. package/dist/{cli-q1812jbw.js → cli-tbhwrxpt.js} +9 -9
  71. package/dist/{cli-w7z94e6c.js → cli-tx00c0h6.js} +4 -2
  72. package/dist/{cli-dxwh4j32.js → cli-vy0fay6k.js} +46 -37
  73. package/dist/{cli-ptkpaqfy.js → cli-wt645v7q.js} +1 -1
  74. package/dist/{cli-ppapy34w.js → cli-wxbn3yfx.js} +2 -2
  75. package/dist/{cli-cby329ny.js → cli-x5mq1fyq.js} +3 -3
  76. package/dist/{cli-rc3r0bnh.js → cli-xbzvet96.js} +6 -6
  77. package/dist/{cli-4mkvwgzr.js → cli-xf234ws8.js} +1 -1
  78. package/dist/{cli-6p7ddg72.js → cli-xftrvxag.js} +5 -5
  79. package/dist/cli-z071fb95.js +848 -0
  80. package/dist/{cli-1v8w782f.js → cli-z1ew8vbq.js} +14 -7
  81. package/dist/{cli-9td5ss65.js → cli-zfg9enh9.js} +3 -3
  82. package/dist/{cli-yxqag76b.js → cli-zw88zjba.js} +1 -1
  83. package/dist/cli.js +19 -19
  84. package/dist/{codex-adapter-nhjj2veb.js → codex-adapter-p6rmm7vv.js} +6 -6
  85. package/dist/{codex-hook-x6tm6y5m.js → codex-hook-x7nejyrr.js} +8 -5
  86. package/dist/{codex-login-35p4sk85.js → codex-login-m819c41r.js} +1 -1
  87. package/dist/{codex-session-runner-6hggrjbx.js → codex-session-runner-8vd5t9t0.js} +7 -7
  88. package/dist/{commands-mrw1ph2w.js → commands-7ems2p13.js} +2 -2
  89. package/dist/{controller-pt1zam5w.js → controller-m263fg43.js} +4 -4
  90. package/dist/{controllers-connect-ymw5541d.js → controllers-connect-bg33ae53.js} +28 -24
  91. package/dist/{cursor-adapter-cf4zh5x0.js → cursor-adapter-cz6nm6mj.js} +3 -3
  92. package/dist/{db-hy80219q.js → db-w505dwa8.js} +2 -2
  93. package/dist/{db-hhpy6m4x.js → db-ys2rbdft.js} +3 -2
  94. package/dist/{devin-adapter-7egzmt0k.js → devin-adapter-zgqadvnm.js} +1 -1
  95. package/dist/{dispatcher-6pdjtkr1.js → dispatcher-0s0mckqr.js} +20 -18
  96. package/dist/{docker-njavd3fb.js → docker-fkgtr75t.js} +2 -2
  97. package/dist/{dsh-adapter-fbx06re2.js → dsh-adapter-3n3net33.js} +3 -3
  98. package/dist/{e2b-5r6a5jeb.js → e2b-7am6tmq6.js} +2 -2
  99. package/dist/{e2b-pw1nvtmh.js → e2b-thdcxtjd.js} +2 -2
  100. package/dist/{easter-egg-3d-6hg2r942.js → easter-egg-3d-5cgynaja.js} +1 -1
  101. package/dist/{event-bus-101fenkh.js → event-bus-9vpk8gmq.js} +1 -1
  102. package/dist/{execute-bcqc69a5.js → execute-t4e6m3rw.js} +1 -1
  103. package/dist/{external-channel-j6vb6ya1.js → external-channel-5b23fv8z.js} +2 -2
  104. package/dist/{google-generative-ai-phpmwxvg.js → google-generative-ai-bmq8gkf3.js} +1 -1
  105. package/dist/{google-vertex-es9ybgdy.js → google-vertex-b1rvp52s.js} +1 -1
  106. package/dist/{grok-adapter-1193sprp.js → grok-adapter-q9fghe5q.js} +10 -10
  107. package/dist/handlers-mqrym347.js +39 -0
  108. package/dist/{heartbeat-h1w1ktce.js → heartbeat-tww6yx1w.js} +23 -21
  109. package/dist/{hook-ejja4bpe.js → hook-dx0pkvar.js} +16 -9
  110. package/dist/{hook-skrbja18.js → hook-pvmh9b6m.js} +6 -6
  111. package/dist/{http-mzh41mfj.js → http-k2ejbt05.js} +975 -292
  112. package/dist/{index-6rmnn89d.js → index-2z710v4x.js} +10 -10
  113. package/dist/{index-xmmkyx82.js → index-dgz61nff.js} +20 -18
  114. package/dist/{index-wgsw9xcz.js → index-g6tbb6ve.js} +1 -1
  115. package/dist/index-h2ek08d6.js +40 -0
  116. package/dist/index-pqfwh9nn.js +41 -0
  117. package/dist/{index-epr2gnbw.js → index-x5aktmp8.js} +1 -1
  118. package/dist/{index-x0q2a4f9.js → index-ysd45kgc.js} +1 -1
  119. package/dist/{index-g909y089.js → index-zgvqzjsw.js} +8 -8
  120. package/dist/{keepalive-4djvbm2j.js → keepalive-nhvpw10z.js} +4 -4
  121. package/dist/lead-jb6sf69z.js +78 -0
  122. package/dist/{maintenance-f3xhnjsm.js → maintenance-agakc519.js} +1 -1
  123. package/dist/{oauth-refresh-sweep-fpd6x6rw.js → oauth-refresh-sweep-4dcbhtn0.js} +3 -3
  124. package/dist/{onboard-196tjgyn.js → onboard-4n2kwa4v.js} +3 -3
  125. package/dist/{opencode-adapter-eeesgfqk.js → opencode-adapter-3s7ax02e.js} +7 -7
  126. package/dist/{otel-impl-g8fh4c21.js → otel-impl-tfa12080.js} +2 -2
  127. package/dist/{pi-mono-adapter-zasp3ze3.js → pi-mono-adapter-ytp7gz8b.js} +24 -13
  128. package/dist/{pricing-refresh-sdcf5yaz.js → pricing-refresh-3cqx3f3x.js} +3 -3
  129. package/dist/{rbac-roles-bsp5657v.js → rbac-roles-9fae5rnv.js} +5 -3
  130. package/dist/{rbac-roles-2x4g1wb5.js → rbac-roles-y6zbfzve.js} +2 -2
  131. package/dist/{render-v2-0pyb39bb.js → render-v2-emawjvc4.js} +3 -3
  132. package/dist/{resume-a86tkj6r.js → resume-zhgts7h7.js} +10 -8
  133. package/dist/{runtime-ar8310ba.js → runtime-xe3aqy4x.js} +1 -1
  134. package/dist/session-access-cm823e06.js +25 -0
  135. package/dist/{setup-ypbzcapd.js → setup-tkp99w1e.js} +1 -1
  136. package/dist/{virtual-modules-wzk6jf3a.js → virtual-modules-4r3zkc20.js} +2 -2
  137. package/dist/{work-objects-yjp8de12.js → work-objects-f722h263.js} +23 -21
  138. package/dist/worker-p7f336rq.js +78 -0
  139. package/dist/{x-8ewt8gxn.js → x-y45mthwn.js} +2 -2
  140. package/openapi.json +1086 -305
  141. package/package.json +2 -2
  142. package/src/apps/action-caller.ts +6 -0
  143. package/src/apps/action-runner.ts +146 -0
  144. package/src/apps/row-store.ts +4 -2
  145. package/src/apps/script-types.ts +17 -4
  146. package/src/be/db/active-sessions.ts +5 -0
  147. package/src/be/db/session-visibility.ts +29 -0
  148. package/src/be/db/tasks/read.ts +61 -3
  149. package/src/be/db/tasks/write.ts +15 -6
  150. package/src/be/db.ts +106 -37
  151. package/src/be/events.ts +11 -0
  152. package/src/be/fleet-benchmark-stats.ts +10 -5
  153. package/src/be/migrations/230_session_shares.sql +23 -0
  154. package/src/be/models-catalog.ts +4 -0
  155. package/src/be/onboarding.ts +6 -0
  156. package/src/be/rbac-roles.ts +2 -0
  157. package/src/be/scripts/typecheck.ts +13 -0
  158. package/src/be/session-shares.ts +244 -0
  159. package/src/be/swarm-config-guard.ts +33 -3
  160. package/src/be/telemetry-enable.ts +1 -1
  161. package/src/commands/provider-credentials.ts +12 -2
  162. package/src/commands/runner.ts +14 -0
  163. package/src/heartbeat/heartbeat.ts +2 -2
  164. package/src/hooks/codex-hook.ts +6 -2
  165. package/src/hooks/hook.ts +7 -0
  166. package/src/hooks/pr-body-guard.ts +38 -11
  167. package/src/hooks/pr-room-guard.ts +88 -0
  168. package/src/http/active-sessions.ts +13 -2
  169. package/src/http/agents.ts +11 -3
  170. package/src/http/all-routes.ts +1 -0
  171. package/src/http/api-keys.ts +3 -1
  172. package/src/http/approval-requests.ts +2 -1
  173. package/src/http/apps.ts +118 -190
  174. package/src/http/config.ts +3 -0
  175. package/src/http/context.ts +2 -0
  176. package/src/http/core.ts +39 -2
  177. package/src/http/events.ts +6 -2
  178. package/src/http/favorite-owner.ts +1 -1
  179. package/src/http/fleet-benchmark.ts +79 -30
  180. package/src/http/fs.ts +38 -3
  181. package/src/http/global-config.ts +7 -0
  182. package/src/http/index.ts +3 -1
  183. package/src/http/memory.ts +3 -1
  184. package/src/http/ranking.ts +351 -0
  185. package/src/http/realtime.ts +26 -21
  186. package/src/http/route-def.ts +77 -11
  187. package/src/http/script-runs.ts +2 -1
  188. package/src/http/scripts.ts +8 -0
  189. package/src/http/session-access.ts +179 -0
  190. package/src/http/session-data.ts +10 -2
  191. package/src/http/sessions.ts +212 -12
  192. package/src/http/stats.ts +7 -3
  193. package/src/http/tasks.ts +85 -8
  194. package/src/http/telemetry-ui.ts +1 -1
  195. package/src/http/used-by.ts +64 -20
  196. package/src/http/users.ts +2 -2
  197. package/src/prompts/session-templates.ts +3 -1
  198. package/src/providers/amp-adapter.ts +1 -1
  199. package/src/providers/pi-mono-adapter.ts +15 -0
  200. package/src/providers/reasoning-effort.ts +2 -1
  201. package/src/providers/types.ts +2 -0
  202. package/src/ranking/telemetry-ranking.ts +119 -0
  203. package/src/ranking/usage.ts +57 -0
  204. package/src/rbac/admission.ts +22 -7
  205. package/src/rbac/legacy-policy.ts +2 -0
  206. package/src/rbac/permissions.ts +9 -0
  207. package/src/realtime/auth.ts +69 -0
  208. package/src/realtime/tickets.ts +4 -1
  209. package/src/realtime/transport.ts +77 -9
  210. package/src/scripts-runtime/sdk-allowlist.ts +7 -0
  211. package/src/scripts-runtime/types/stdlib.d.ts +31 -0
  212. package/src/scripts-runtime/types/swarm-sdk.d.ts +31 -0
  213. package/src/server.ts +4 -0
  214. package/src/slack/blocks.ts +18 -0
  215. package/src/slack/dm.ts +29 -0
  216. package/src/telemetry-context.ts +19 -1
  217. package/src/telemetry-contract/EVENTS.md +45 -8
  218. package/src/telemetry-contract/SOURCE.json +38 -4
  219. package/src/telemetry-contract/catalog.json +294 -5
  220. package/src/telemetry-contract/ranking/fixtures/expected.json +30 -0
  221. package/src/telemetry-contract/ranking/fixtures/invalid/bad-category.json +11 -0
  222. package/src/telemetry-contract/ranking/fixtures/invalid/bad-claim.json +11 -0
  223. package/src/telemetry-contract/ranking/fixtures/invalid/blank-description.json +11 -0
  224. package/src/telemetry-contract/ranking/fixtures/invalid/blank-name.json +11 -0
  225. package/src/telemetry-contract/ranking/fixtures/invalid/description-too-long.json +11 -0
  226. package/src/telemetry-contract/ranking/fixtures/invalid/domain-uppercase.json +11 -0
  227. package/src/telemetry-contract/ranking/fixtures/invalid/domain-with-scheme.json +11 -0
  228. package/src/telemetry-contract/ranking/fixtures/invalid/domain-with-www.json +11 -0
  229. package/src/telemetry-contract/ranking/fixtures/invalid/http-source-url.json +11 -0
  230. package/src/telemetry-contract/ranking/fixtures/invalid/missing-description.json +10 -0
  231. package/src/telemetry-contract/ranking/fixtures/invalid/missing-version.json +10 -0
  232. package/src/telemetry-contract/ranking/fixtures/invalid/name-not-string.json +11 -0
  233. package/src/telemetry-contract/ranking/fixtures/invalid/name-too-long.json +11 -0
  234. package/src/telemetry-contract/ranking/fixtures/invalid/not-object.json +1 -0
  235. package/src/telemetry-contract/ranking/fixtures/invalid/null.json +1 -0
  236. package/src/telemetry-contract/ranking/fixtures/invalid/other-with-subcategory.json +11 -0
  237. package/src/telemetry-contract/ranking/fixtures/invalid/oversize.json +1 -0
  238. package/src/telemetry-contract/ranking/fixtures/invalid/short-claim.json +11 -0
  239. package/src/telemetry-contract/ranking/fixtures/invalid/subcategory-other-category.json +11 -0
  240. package/src/telemetry-contract/ranking/fixtures/invalid/trailing-data.json +1 -0
  241. package/src/telemetry-contract/ranking/fixtures/invalid/unknown-field.json +12 -0
  242. package/src/telemetry-contract/ranking/fixtures/invalid/unsupported-version.json +11 -0
  243. package/src/telemetry-contract/ranking/fixtures/invalid/updated-at-not-date.json +11 -0
  244. package/src/telemetry-contract/ranking/fixtures/invalid/updated-at-offset.json +11 -0
  245. package/src/telemetry-contract/ranking/fixtures/invalid/wrong-case-field.json +11 -0
  246. package/src/telemetry-contract/ranking/fixtures/valid/category-without-subcategory.json +11 -0
  247. package/src/telemetry-contract/ranking/fixtures/valid/full.json +11 -0
  248. package/src/telemetry-contract/ranking/fixtures/valid/minimal.json +11 -0
  249. package/src/telemetry-contract/ranking/fixtures/valid/no-claim.json +10 -0
  250. package/src/telemetry-contract/ranking/fixtures/valid/padded-text.json +11 -0
  251. package/src/telemetry-contract/ranking/fixtures/valid/unicode-name.json +11 -0
  252. package/src/telemetry-contract/ranking/listing.v1.schema.json +61 -0
  253. package/src/telemetry-contract/ranking/taxonomy.json +8 -0
  254. package/src/telemetry-contract/ranking-taxonomy.gen.ts +11 -0
  255. package/src/telemetry-contract/types.gen.ts +963 -58
  256. package/src/telemetry-identity.ts +47 -9
  257. package/src/telemetry-snapshot.ts +9 -1
  258. package/src/telemetry-ui-events.ts +9 -2
  259. package/src/telemetry.ts +40 -5
  260. package/src/tests/app-action-run-tool.test.ts +178 -0
  261. package/src/tests/app-row-tools.test.ts +360 -0
  262. package/src/tests/apps-rbac.test.ts +189 -2
  263. package/src/tests/apps-script-types.test.ts +16 -3
  264. package/src/tests/credential-check.test.ts +38 -0
  265. package/src/tests/db-extraction-contract.test.ts +1 -0
  266. package/src/tests/db-task-read-contract.test.ts +1 -0
  267. package/src/tests/docs-index-footprint.test.js +2 -2
  268. package/src/tests/fleet-benchmark.test.ts +122 -2
  269. package/src/tests/http-users.test.ts +62 -1
  270. package/src/tests/model-catalog-table.test.ts +63 -0
  271. package/src/tests/model-profiles-api.test.ts +19 -7
  272. package/src/tests/models-catalog.test.ts +50 -0
  273. package/src/tests/onboarding.test.ts +21 -0
  274. package/src/tests/org-identity.test.ts +44 -0
  275. package/src/tests/org-website.test.ts +62 -0
  276. package/src/tests/pi-mono-adapter.test.ts +23 -0
  277. package/src/tests/pr-body-leaks.test.ts +4 -0
  278. package/src/tests/pr-room-guard.test.ts +242 -0
  279. package/src/tests/ranking-listing.test.ts +97 -0
  280. package/src/tests/ranking-route.test.ts +321 -0
  281. package/src/tests/ranking-usage.test.ts +50 -0
  282. package/src/tests/rbac-admission-e2e.test.ts +8 -0
  283. package/src/tests/rbac-admission.test.ts +38 -0
  284. package/src/tests/rbac-charact-http.test.ts +4 -3
  285. package/src/tests/rbac-engine.test.ts +2 -0
  286. package/src/tests/rbac-roles.test.ts +2 -0
  287. package/src/tests/realtime-room-surfaces.test.ts +3 -1
  288. package/src/tests/realtime-session-join-race.test.ts +142 -0
  289. package/src/tests/realtime-tickets.test.ts +24 -17
  290. package/src/tests/realtime-transport.test.ts +91 -0
  291. package/src/tests/reasoning-effort.test.ts +39 -3
  292. package/src/tests/runner-harness-telemetry-env.test.ts +56 -1
  293. package/src/tests/session-route-posture.test.ts +639 -0
  294. package/src/tests/session-sharing-routes.test.ts +282 -0
  295. package/src/tests/session-sharing.test.ts +526 -0
  296. package/src/tests/sessions-detail-batch.test.ts +7 -1
  297. package/src/tests/slack-tool-blocks.test.ts +101 -0
  298. package/src/tests/slack-update.test.ts +55 -0
  299. package/src/tests/slack-user-dm.test.ts +177 -0
  300. package/src/tests/swarm-tool-result-gate.test.ts +2 -4
  301. package/src/tests/telemetry-context.test.ts +128 -2
  302. package/src/tests/telemetry-ui-route.test.ts +123 -0
  303. package/src/tests/tool-annotations.test.ts +3 -2
  304. package/src/tests/used-by-route.test.ts +153 -9
  305. package/src/tests/workflow-agent-task-retry.test.ts +130 -4
  306. package/src/tests/workflow-wait-recovery.test.ts +116 -4
  307. package/src/tools/app-action-run.ts +63 -0
  308. package/src/tools/app-rows.ts +234 -0
  309. package/src/tools/model-catalog/index.ts +1 -1
  310. package/src/tools/slack-post.ts +18 -12
  311. package/src/tools/slack-read.ts +13 -1
  312. package/src/tools/slack-reply.ts +7 -10
  313. package/src/tools/slack-start-thread.ts +18 -11
  314. package/src/tools/slack-update.ts +2 -9
  315. package/src/tools/tool-config.ts +8 -0
  316. package/src/tools/utils.ts +1 -1
  317. package/src/tools/workflows/retry-workflow-run.ts +1 -1
  318. package/src/types.ts +52 -0
  319. package/src/utils/company-profile.ts +24 -0
  320. package/src/utils/org-identity.ts +33 -0
  321. package/src/utils/org-website.ts +58 -21
  322. package/src/workflows/recovery.ts +10 -22
  323. package/src/workflows/resume.ts +16 -0
  324. package/src/workflows/task-step-routing.ts +47 -7
  325. package/templates/skills/apps/SKILL.md +58 -2
  326. package/templates/skills/apps/content.md +58 -2
  327. package/dist/handlers-tb3xgjnm.js +0 -37
  328. package/dist/index-nyfcdpky.js +0 -39
  329. package/dist/index-vjn3wbzf.js +0 -38
  330. package/dist/lead-61kqp604.js +0 -76
  331. package/dist/worker-4ptnn1ge.js +0 -76
  332. package/dist/{cli-n5mrsg0f.js → cli-60cgh1rv.js} +3 -3
@@ -71,34 +71,71 @@ export function isFilledOrgLogoUrl(
71
71
  }
72
72
  }
73
73
 
74
+ /**
75
+ * Free-mail providers with regional domains, matched on the label before the
76
+ * public suffix: hotmail.es, yahoo.co.uk, gmx.net and yandex.com.tr all count.
77
+ */
78
+ const FREE_MAIL_FAMILIES = new Set([
79
+ "aol",
80
+ "fastmail",
81
+ "gmail",
82
+ "gmx",
83
+ "googlemail",
84
+ "hotmail",
85
+ "icloud",
86
+ "live",
87
+ "msn",
88
+ "outlook",
89
+ "protonmail",
90
+ "rocketmail",
91
+ "yahoo",
92
+ "yandex",
93
+ "ymail",
94
+ "zoho",
95
+ ]);
96
+
97
+ /** Free-mail providers on one domain only, where the label alone is too generic. */
74
98
  const FREE_MAIL_DOMAINS = new Set([
75
- "gmail.com",
76
- "googlemail.com",
77
- "outlook.com",
78
- "hotmail.com",
79
- "live.com",
80
- "msn.com",
81
- "yahoo.com",
82
- "icloud.com",
83
- "me.com",
99
+ "126.com",
100
+ "163.com",
101
+ "comcast.net",
102
+ "daum.net",
103
+ "free.fr",
104
+ "hanmail.net",
105
+ "hey.com",
106
+ "libero.it",
84
107
  "mac.com",
85
- "aol.com",
86
- "proton.me",
87
- "protonmail.com",
88
- "gmx.com",
89
- "gmx.de",
90
- "yandex.com",
91
- "yandex.ru",
92
108
  "mail.com",
93
- "zoho.com",
109
+ "mail.ru",
110
+ "me.com",
111
+ "naver.com",
112
+ "orange.fr",
113
+ "pm.me",
114
+ "proton.me",
94
115
  "qq.com",
95
- "163.com",
96
- "hey.com",
97
- "fastmail.com",
116
+ "rediffmail.com",
117
+ "sina.com",
118
+ "t-online.de",
119
+ "tutanota.com",
120
+ "web.de",
98
121
  ]);
99
122
 
123
+ /** Second-level labels of a country code suffix (acme.co.uk, acme.com.br). */
124
+ const SECOND_LEVEL_LABELS = new Set(["ac", "co", "com", "edu", "gov", "ne", "net", "or", "org"]);
125
+
126
+ /** Whether `host` (a normalized hostname) belongs to a public free-mail provider. */
127
+ function isFreeMailHost(host: string): boolean {
128
+ const labels = host.split(".");
129
+ const suffixLength = labels.length > 2 && SECOND_LEVEL_LABELS.has(labels.at(-2) ?? "") ? 2 : 1;
130
+ // mail.yahoo.co.uk becomes yahoo.co.uk.
131
+ const registrable = labels.slice(-(suffixLength + 1));
132
+ return (
133
+ FREE_MAIL_FAMILIES.has(registrable[0] ?? "") || FREE_MAIL_DOMAINS.has(registrable.join("."))
134
+ );
135
+ }
136
+
100
137
  /** The admin's email domain as a website suggestion, or null for free-mail domains. */
101
138
  export function websiteSuggestion(orgDomain: string | null | undefined): string | null {
102
139
  const host = normalizeOrgWebsite(orgDomain);
103
- return host && !FREE_MAIL_DOMAINS.has(host) ? host : null;
140
+ return host && !isFreeMailHost(host) ? host : null;
104
141
  }
@@ -25,7 +25,12 @@ import {
25
25
  } from "./engine";
26
26
  import type { ExecutorRegistry } from "./executors/registry";
27
27
  import { getSecretInputKeys } from "./input";
28
- import { finalizeOrWait, resumeFromChildRun, resumeWaitState } from "./resume";
28
+ import {
29
+ finalizeOrWait,
30
+ recoverResolvedWaitState,
31
+ resumeFromChildRun,
32
+ resumeWaitState,
33
+ } from "./resume";
29
34
  import {
30
35
  checkpointPortStepAndResolveSuccessors,
31
36
  completeTaskStepAndResolveSuccessors,
@@ -392,21 +397,12 @@ async function recoverWaitStates(registry: ExecutorRegistry): Promise<number> {
392
397
 
393
398
  for (const stuck of stuckRuns) {
394
399
  try {
395
- // Decide what status to (re)apply.
396
- let resumeStatus: "fired" | "timeout";
397
- let payload: unknown;
398
-
399
- if (stuck.waitStatus === "fired") {
400
- resumeStatus = "fired";
401
- payload = stuck.firedPayload != null ? safeJsonParse(stuck.firedPayload) : undefined;
402
- } else if (stuck.waitStatus === "timeout") {
403
- resumeStatus = "timeout";
400
+ if (stuck.waitStatus === "pending") {
401
+ const status = stuck.waitMode === "time" ? "fired" : "timeout";
402
+ await resumeWaitState(stuck.waitId, status, undefined, registry);
404
403
  } else {
405
- // pending + overdue
406
- resumeStatus = stuck.waitMode === "time" ? "fired" : "timeout";
404
+ await recoverResolvedWaitState(stuck.waitId, registry);
407
405
  }
408
-
409
- await resumeWaitState(stuck.waitId, resumeStatus, payload, registry);
410
406
  recovered++;
411
407
  } catch (err) {
412
408
  if (await failRunOnUnreadableReplay(stuck.runId, err)) continue;
@@ -417,14 +413,6 @@ async function recoverWaitStates(registry: ExecutorRegistry): Promise<number> {
417
413
  return recovered;
418
414
  }
419
415
 
420
- function safeJsonParse(s: string): unknown {
421
- try {
422
- return JSON.parse(s);
423
- } catch {
424
- return s;
425
- }
426
- }
427
-
428
416
  /**
429
417
  * Get run IDs by status. Simple query since there's no dedicated function for this.
430
418
  */
@@ -711,6 +711,22 @@ export async function resumeWaitState(
711
711
  );
712
712
  }
713
713
 
714
+ /** Finish a wait resolution that committed before its step was checkpointed. */
715
+ export async function recoverResolvedWaitState(
716
+ waitId: string,
717
+ registry: ExecutorRegistry,
718
+ ): Promise<void> {
719
+ const waitRow = await getWaitStateById(waitId);
720
+ if (!waitRow) return;
721
+ const status = waitRow.status;
722
+ if (status !== "fired" && status !== "timeout") return;
723
+
724
+ // Replay the durable result; the step checkpoint arbitrates concurrent resumes.
725
+ await failClosedOnUnreadableReplay(waitRow.workflowRunId, waitRow.workflowRunStepId, () =>
726
+ resumeClaimedWait(waitRow, status, waitRow.firedPayload, registry),
727
+ );
728
+ }
729
+
714
730
  async function resumeClaimedWait(
715
731
  waitRow: WaitStateRow,
716
732
  status: "fired" | "timeout",
@@ -2,12 +2,15 @@ import {
2
2
  detachTaskFromWorkflowRunStep,
3
3
  getDbClient,
4
4
  getTaskById,
5
+ getWorkflowRun,
5
6
  getWorkflowRunStep,
6
7
  updateWorkflowRun,
7
8
  updateWorkflowRunStep,
8
9
  } from "../be/db";
9
10
  import {
11
+ type RetryPolicy,
10
12
  RetryPolicySchema,
13
+ SUPERSEDED_WORKFLOW_TASK_REASON,
11
14
  type WorkflowDefinition,
12
15
  type WorkflowNode,
13
16
  type WorkflowRunStep,
@@ -17,7 +20,7 @@ import { getSuccessors } from "./definition";
17
20
  import { joinForeach, resolveForeachParent } from "./foreach-join";
18
21
 
19
22
  export interface PortStepRoutingResult {
20
- /** False when another handler already moved the step out of `waiting`. */
23
+ /** False when the step was already claimed or its run is terminal. */
21
24
  claimed: boolean;
22
25
  successors: WorkflowNode[];
23
26
  }
@@ -85,6 +88,10 @@ export async function checkpointPortStepAndResolveSuccessors(
85
88
  return await getDbClient().transaction(async (): Promise<PortStepRoutingResult> => {
86
89
  const current = await getWorkflowRunStep(stepId);
87
90
  if (!current || current.status !== "waiting") return { claimed: false, successors: [] };
91
+ const run = await getWorkflowRun(runId);
92
+ if (!run || (run.status !== "waiting" && run.status !== "running")) {
93
+ return { claimed: false, successors: [] };
94
+ }
88
95
  await checkpointStep(runId, stepId, nodeId, { output, nextPort }, ctx);
89
96
  await updateWorkflowRun(runId, { status: "running" });
90
97
  return { claimed: true, successors: getSuccessors(def, nodeId, nextPort) };
@@ -97,15 +104,33 @@ export async function checkpointPortStepAndResolveSuccessors(
97
104
  * - `not-claimed`: another handler already moved the step out of `waiting`,
98
105
  * or the failed task is no longer the one bound to the step (it was
99
106
  * already retried and a fresh task now owns it); the caller stops.
100
- * - `not-eligible`: no retry applies (no `node.retry`, not an agent-task node,
101
- * or retries exhausted); the caller applies `onNodeFailure` as before.
107
+ * - `not-eligible`: no retry applies (no `node.retry` and not a supersede
108
+ * cut, not an agent-task node, or retries exhausted); the caller applies
109
+ * `onNodeFailure` as before.
102
110
  */
103
111
  export type TaskStepRetryOutcome = "scheduled" | "not-claimed" | "not-eligible";
104
112
 
113
+ /**
114
+ * Retry applied to an agent-task step whose task was cut by a supersede
115
+ * (deploy drain, heartbeat remediation) when the node declares no `retry`.
116
+ * The cut is not the task's fault, so the step gets one fresh attempt after
117
+ * the restart settles. An explicit `node.retry` always wins; `retry:
118
+ * { maxRetries: 0 }` opts a node with external side effects out.
119
+ */
120
+ export const SUPERSEDE_RETRY_POLICY: RetryPolicy = {
121
+ maxRetries: 1,
122
+ strategy: "static",
123
+ baseDelayMs: 30_000,
124
+ maxDelayMs: 30_000,
125
+ };
126
+
105
127
  /**
106
128
  * Apply a node's `retry` policy to a FAILED agent-task step task. The sync
107
129
  * executor path does this in `executeStep`; an async agent-task step only
108
130
  * learns about the failure here, from `task.failed` or the recovery sweep.
131
+ * A node without `retry` gets `SUPERSEDE_RETRY_POLICY` when the task was
132
+ * failed with `SUPERSEDED_WORKFLOW_TASK_REASON`. The task row is checked as
133
+ * well as `reason`, because the recovery sweep passes its own reason text.
109
134
  *
110
135
  * In one transaction: re-claim the step while it is still `waiting` AND still
111
136
  * bound to the failed task, detach that task (the executor reuses any task
@@ -114,6 +139,9 @@ export type TaskStepRetryOutcome = "scheduled" | "not-claimed" | "not-eligible";
114
139
  * task. Bounded by `maxRetries` via the step's persisted `retryCount`, read
115
140
  * only after ownership is confirmed: a stale caller's step snapshot may carry
116
141
  * the counter of a newer attempt.
142
+ *
143
+ * Foreach children (`<foreachId>#<key>`) are not matched here: the retry
144
+ * poller resolves nodes by exact id and cannot re-dispatch a child yet.
117
145
  */
118
146
  export async function scheduleTaskStepRetry(
119
147
  def: WorkflowDefinition,
@@ -123,10 +151,16 @@ export async function scheduleTaskStepRetry(
123
151
  reason: string,
124
152
  ): Promise<TaskStepRetryOutcome> {
125
153
  const node = def.nodes.find((n) => n.id === step.nodeId);
126
- if (!node || node.type !== "agent-task" || !node.retry) return "not-eligible";
127
- const parsed = RetryPolicySchema.safeParse(node.retry);
128
- if (!parsed.success) return "not-eligible";
129
- const policy = parsed.data;
154
+ if (!node || node.type !== "agent-task") return "not-eligible";
155
+ let policy: RetryPolicy;
156
+ if (node.retry) {
157
+ const parsed = RetryPolicySchema.safeParse(node.retry);
158
+ if (!parsed.success) return "not-eligible";
159
+ policy = parsed.data;
160
+ } else {
161
+ if (!(await isSupersedeCut(taskId, reason))) return "not-eligible";
162
+ policy = SUPERSEDE_RETRY_POLICY;
163
+ }
130
164
 
131
165
  return await getDbClient().transaction(async (): Promise<TaskStepRetryOutcome> => {
132
166
  const current = await getWorkflowRunStep(step.id);
@@ -139,6 +173,12 @@ export async function scheduleTaskStepRetry(
139
173
  });
140
174
  }
141
175
 
176
+ async function isSupersedeCut(taskId: string, reason: string): Promise<boolean> {
177
+ if (reason === SUPERSEDED_WORKFLOW_TASK_REASON) return true;
178
+ const task = await getTaskById(taskId);
179
+ return task?.failureReason === SUPERSEDED_WORKFLOW_TASK_REASON;
180
+ }
181
+
142
182
  export interface TaskStepRoutingResult {
143
183
  /**
144
184
  * False when another handler already moved the step out of `waiting` — the
@@ -18,6 +18,14 @@ Swarm Apps are persistent, agent-authored internal applications: a schema-backed
18
18
  | `app-upsert` | Create an app, or replace an existing app's entire definition when you intentionally have the full desired state. |
19
19
  | `app-patch` | Make a focused change while preserving everything not mentioned in the patch. Prefer this for iteration. |
20
20
  | `app-query` | Run one declared named query and return its rows. Use this when an agent or saved script needs to consume app data rather than render the app UI. |
21
+ | `app-rows-list` | List rows with typed equality filters, sorting, and a limit. Returns `{ rows, total }`. |
22
+ | `app-row-get` | Read a row by `rowId`. Returns `{ row }`. |
23
+ | `app-row-create` | Create a row from `values`. Returns `{ row }`. |
24
+ | `app-rows-create` | Create 1 to 500 rows from a `rows: values[]` array, within 10 MiB. Returns `{ rows }`. |
25
+ | `app-row-patch` | Patch a row by `rowId` with `values`. Returns `{ row }`. |
26
+ | `app-row-delete` | Delete a row by `rowId`. Returns `{ ok: true }`. |
27
+ | `app-rows-delete` | Delete matching rows with a non-empty `equals` filter. Returns `{ deleted }`. |
28
+ | `app-action-run` | Run a declared script, task, or sync action with `{ appId, action, input? }`. Agents can invoke it through MCP only. |
21
29
  | `app-history` | List definition snapshots and their compact model/column digests before choosing a restore point. |
22
30
  | `app-diff` | Show a unified definition diff; defaults to newest snapshot → CURRENT. |
23
31
  | `app-rollback` | Restore a snapshot through the normal schema-migration engine. |
@@ -28,7 +36,41 @@ For every edit: `app-get` -> modify the smallest coherent subtree -> `app-patch`
28
36
 
29
37
  ### Reading an app's callable surface
30
38
 
31
- One `app-get` returns everything needed to drive an app you did not write: `definition.queries` are runnable with `app-query` (supply every `$param` the query references), and `definition.actions` are invocable with `POST /api/apps/<id>/actions/<name>` (a `script` action runs its script, a `task` action spawns a task, a `sync` action refreshes sources). Read a query's `$param` placeholders and an action's kind/args from the definition before calling — do not guess parameter names.
39
+ One `app-get` returns everything needed to drive an app you did not write: `definition.queries` are runnable with `app-query` (supply every `$param` the query references), and `definition.actions` are invocable with `app-action-run` or `POST /api/apps/<id>/actions/<name>` (a `script` action runs its script, a `task` action spawns a task, a `sync` action refreshes sources). Read the query parameters and action arguments from the definition before invocation. Do not guess parameter names.
40
+
41
+ ### Verified action caller
42
+
43
+ Script actions receive `caller` as a reserved, server-stamped argument. The server overwrites `caller` from definition defaults and request input.
44
+
45
+ ```typescript
46
+ type AppActionCaller = {
47
+ kind: "user" | "agent" | "operator" | "guest";
48
+ id: string | null;
49
+ name?: string;
50
+ pageId?: string;
51
+ };
52
+ ```
53
+
54
+ The caller identifies the authenticated user or agent. Operator and guest callers have `id: null`. A signed page session adds `pageId`.
55
+ With the swarm key, a registered `X-Agent-ID` produces an agent caller and `agent:<id>` row provenance. Missing or unknown agent IDs remain operator callers.
56
+ Task actions include the same caller as server-verified JSON in the task prompt. Script execution still uses the saved script owner's bindings.
57
+
58
+ ### Verified action caller
59
+
60
+ Script actions receive `caller` as a reserved, server-stamped argument. The server overwrites `caller` from definition defaults and request input.
61
+
62
+ ```typescript
63
+ type AppActionCaller = {
64
+ kind: "user" | "agent" | "operator" | "guest";
65
+ id: string | null;
66
+ name?: string;
67
+ pageId?: string;
68
+ };
69
+ ```
70
+
71
+ The caller identifies the authenticated user or agent. Operator and guest callers have `id: null`. A signed page session adds `pageId`.
72
+ With the swarm key, a registered `X-Agent-ID` produces an agent caller and `agent:<id>` row provenance. Missing or unknown agent IDs remain operator callers.
73
+ Task actions include the same caller as server-verified JSON in the task prompt. Script execution still uses the saved script owner's bindings.
32
74
 
33
75
  ## Safe schema evolution and rollback
34
76
 
@@ -355,7 +397,7 @@ Use a task action named Tackle when a person should hand one issue row to the sw
355
397
 
356
398
  For direct MCP calls, `app-query` accepts `{ appId, query, params? }` and returns rows from that declared named query; every supplied param must be referenced by a `$param` filter in that query. Use it when an agent needs to read app state without scraping the UI.
357
399
 
358
- Saved scripts use the generated SDK name `ctx.swarm.app_query({ appId, query, params? })`. Use `app_query` in scripts or workflows that turn current app rows into reports, digests, or follow-up work. Saved scripts also get generated per-app types automatically: each app contributes an `App_<Name>` namespace with one row interface per model (enum columns as literal unions) and a typed `app_query` overload per named query, all visible via `script-query-types`. Actions stay REST-only from scripts — there is no SDK method to invoke them.
400
+ Saved scripts use the generated SDK name `ctx.swarm.app_query({ appId, query, params? })`. Use `app_query` in scripts or workflows that turn current app rows into reports, digests, or follow-up work. Saved scripts also get generated per-app types automatically: each app contributes an `App_<Name>` namespace with one row interface per model (enum columns as literal unions) and a typed `app_query` overload per named query, all visible via `script-query-types`. Scripts can create, list, get, patch, and delete rows with the seven row tools. Actions remain REST/MCP-only and have no script SDK method.
359
401
 
360
402
  ### Pages, routes, and page trees
361
403
 
@@ -747,3 +789,17 @@ The tool returns `{ appId, url: "/apps/<id>" }`. Open that URL to verify the liv
747
789
  - Logged-in browser: a fresh dashboard has no connection and redirects to /setup. Seed the localStorage key `agent-swarm-connections` with `{connections:[{id,name,apiUrl,apiKey}],activeId}`. Build the value from an env var and pipe it to `agent-browser eval --stdin`, so the key never reaches a command line. Reload, then pick a user in the "Who are you?" dialog.
748
790
  - Apps scroll inside an inner canvas, so a full-page screenshot captures only the viewport. Scroll the canvas or raise the viewport height. For mobile, set a 375px-wide viewport before the screenshot.
749
791
  - App definitions: `GET /api/apps` and `GET /api/apps/<id>` with the API key as Bearer.
792
+
793
+
794
+ ### Rows from agents and scripts
795
+
796
+ Every row tool requires `appId` and `model`. Scripts use underscore names, such as `ctx.swarm.app_row_create` and `ctx.swarm.app_rows_list`.
797
+ Results use the usual `data` wrapper, so scripts read `res?.data ?? res`. Rows contain system fields and declared columns at the top level.
798
+ Writes record `agent:<agentId>` in `createdBy` and `updatedBy`. Source projections and join keys remain read-only. Each row input must fit within 1 MiB.
799
+
800
+ `app-rows-list` accepts `equals`, `sort: "<column>:asc|desc"`, and `limit` from 1 to 1000 (default 200).
801
+ Equality filters accept declared columns and system columns. Filter values must match the column kind and use strict equality.
802
+ `app-rows-delete` requires at least one equality filter and accepts a limit from 1 to 1000 (default 1000).
803
+
804
+ `app-action-run` returns the REST action body under `data`. Script actions run with the script owner's identity and receive the verified invoking agent as `caller`.
805
+ Scripts and extensions cannot invoke `app-action-run`.
@@ -13,6 +13,14 @@ Swarm Apps are persistent, agent-authored internal applications: a schema-backed
13
13
  | `app-upsert` | Create an app, or replace an existing app's entire definition when you intentionally have the full desired state. |
14
14
  | `app-patch` | Make a focused change while preserving everything not mentioned in the patch. Prefer this for iteration. |
15
15
  | `app-query` | Run one declared named query and return its rows. Use this when an agent or saved script needs to consume app data rather than render the app UI. |
16
+ | `app-rows-list` | List rows with typed equality filters, sorting, and a limit. Returns `{ rows, total }`. |
17
+ | `app-row-get` | Read a row by `rowId`. Returns `{ row }`. |
18
+ | `app-row-create` | Create a row from `values`. Returns `{ row }`. |
19
+ | `app-rows-create` | Create 1 to 500 rows from a `rows: values[]` array, within 10 MiB. Returns `{ rows }`. |
20
+ | `app-row-patch` | Patch a row by `rowId` with `values`. Returns `{ row }`. |
21
+ | `app-row-delete` | Delete a row by `rowId`. Returns `{ ok: true }`. |
22
+ | `app-rows-delete` | Delete matching rows with a non-empty `equals` filter. Returns `{ deleted }`. |
23
+ | `app-action-run` | Run a declared script, task, or sync action with `{ appId, action, input? }`. Agents can invoke it through MCP only. |
16
24
  | `app-history` | List definition snapshots and their compact model/column digests before choosing a restore point. |
17
25
  | `app-diff` | Show a unified definition diff; defaults to newest snapshot → CURRENT. |
18
26
  | `app-rollback` | Restore a snapshot through the normal schema-migration engine. |
@@ -23,7 +31,41 @@ For every edit: `app-get` -> modify the smallest coherent subtree -> `app-patch`
23
31
 
24
32
  ### Reading an app's callable surface
25
33
 
26
- One `app-get` returns everything needed to drive an app you did not write: `definition.queries` are runnable with `app-query` (supply every `$param` the query references), and `definition.actions` are invocable with `POST /api/apps/<id>/actions/<name>` (a `script` action runs its script, a `task` action spawns a task, a `sync` action refreshes sources). Read a query's `$param` placeholders and an action's kind/args from the definition before calling — do not guess parameter names.
34
+ One `app-get` returns everything needed to drive an app you did not write: `definition.queries` are runnable with `app-query` (supply every `$param` the query references), and `definition.actions` are invocable with `app-action-run` or `POST /api/apps/<id>/actions/<name>` (a `script` action runs its script, a `task` action spawns a task, a `sync` action refreshes sources). Read the query parameters and action arguments from the definition before invocation. Do not guess parameter names.
35
+
36
+ ### Verified action caller
37
+
38
+ Script actions receive `caller` as a reserved, server-stamped argument. The server overwrites `caller` from definition defaults and request input.
39
+
40
+ ```typescript
41
+ type AppActionCaller = {
42
+ kind: "user" | "agent" | "operator" | "guest";
43
+ id: string | null;
44
+ name?: string;
45
+ pageId?: string;
46
+ };
47
+ ```
48
+
49
+ The caller identifies the authenticated user or agent. Operator and guest callers have `id: null`. A signed page session adds `pageId`.
50
+ With the swarm key, a registered `X-Agent-ID` produces an agent caller and `agent:<id>` row provenance. Missing or unknown agent IDs remain operator callers.
51
+ Task actions include the same caller as server-verified JSON in the task prompt. Script execution still uses the saved script owner's bindings.
52
+
53
+ ### Verified action caller
54
+
55
+ Script actions receive `caller` as a reserved, server-stamped argument. The server overwrites `caller` from definition defaults and request input.
56
+
57
+ ```typescript
58
+ type AppActionCaller = {
59
+ kind: "user" | "agent" | "operator" | "guest";
60
+ id: string | null;
61
+ name?: string;
62
+ pageId?: string;
63
+ };
64
+ ```
65
+
66
+ The caller identifies the authenticated user or agent. Operator and guest callers have `id: null`. A signed page session adds `pageId`.
67
+ With the swarm key, a registered `X-Agent-ID` produces an agent caller and `agent:<id>` row provenance. Missing or unknown agent IDs remain operator callers.
68
+ Task actions include the same caller as server-verified JSON in the task prompt. Script execution still uses the saved script owner's bindings.
27
69
 
28
70
  ## Safe schema evolution and rollback
29
71
 
@@ -350,7 +392,7 @@ Use a task action named Tackle when a person should hand one issue row to the sw
350
392
 
351
393
  For direct MCP calls, `app-query` accepts `{ appId, query, params? }` and returns rows from that declared named query; every supplied param must be referenced by a `$param` filter in that query. Use it when an agent needs to read app state without scraping the UI.
352
394
 
353
- Saved scripts use the generated SDK name `ctx.swarm.app_query({ appId, query, params? })`. Use `app_query` in scripts or workflows that turn current app rows into reports, digests, or follow-up work. Saved scripts also get generated per-app types automatically: each app contributes an `App_<Name>` namespace with one row interface per model (enum columns as literal unions) and a typed `app_query` overload per named query, all visible via `script-query-types`. Actions stay REST-only from scripts — there is no SDK method to invoke them.
395
+ Saved scripts use the generated SDK name `ctx.swarm.app_query({ appId, query, params? })`. Use `app_query` in scripts or workflows that turn current app rows into reports, digests, or follow-up work. Saved scripts also get generated per-app types automatically: each app contributes an `App_<Name>` namespace with one row interface per model (enum columns as literal unions) and a typed `app_query` overload per named query, all visible via `script-query-types`. Scripts can create, list, get, patch, and delete rows with the seven row tools. Actions remain REST/MCP-only and have no script SDK method.
354
396
 
355
397
  ### Pages, routes, and page trees
356
398
 
@@ -742,3 +784,17 @@ The tool returns `{ appId, url: "/apps/<id>" }`. Open that URL to verify the liv
742
784
  - Logged-in browser: a fresh dashboard has no connection and redirects to /setup. Seed the localStorage key `agent-swarm-connections` with `{connections:[{id,name,apiUrl,apiKey}],activeId}`. Build the value from an env var and pipe it to `agent-browser eval --stdin`, so the key never reaches a command line. Reload, then pick a user in the "Who are you?" dialog.
743
785
  - Apps scroll inside an inner canvas, so a full-page screenshot captures only the viewport. Scroll the canvas or raise the viewport height. For mobile, set a 375px-wide viewport before the screenshot.
744
786
  - App definitions: `GET /api/apps` and `GET /api/apps/<id>` with the API key as Bearer.
787
+
788
+
789
+ ### Rows from agents and scripts
790
+
791
+ Every row tool requires `appId` and `model`. Scripts use underscore names, such as `ctx.swarm.app_row_create` and `ctx.swarm.app_rows_list`.
792
+ Results use the usual `data` wrapper, so scripts read `res?.data ?? res`. Rows contain system fields and declared columns at the top level.
793
+ Writes record `agent:<agentId>` in `createdBy` and `updatedBy`. Source projections and join keys remain read-only. Each row input must fit within 1 MiB.
794
+
795
+ `app-rows-list` accepts `equals`, `sort: "<column>:asc|desc"`, and `limit` from 1 to 1000 (default 200).
796
+ Equality filters accept declared columns and system columns. Filter values must match the column kind and use strict equality.
797
+ `app-rows-delete` requires at least one equality filter and accepts a limit from 1 to 1000 (default 1000).
798
+
799
+ `app-action-run` returns the REST action body under `data`. Script actions run with the script owner's identity and receive the verified invoking agent as `caller`.
800
+ Scripts and extensions cannot invoke `app-action-run`.
@@ -1,37 +0,0 @@
1
- import {
2
- isUserAllowed2,
3
- registerMessageHandler2
4
- } from "./cli-4hmaheb6.js";
5
- import"./cli-30m5q8mc.js";
6
- import"./cli-y3dvz6ge.js";
7
- import"./cli-8qsx817b.js";
8
- import"./cli-rdr166ht.js";
9
- import"./cli-fhvqt2fp.js";
10
- import"./cli-qz93y3x5.js";
11
- import"./cli-65q70v2v.js";
12
- import"./cli-3h26v7yj.js";
13
- import"./cli-7a91w22y.js";
14
- import"./cli-3ggwdtb0.js";
15
- import"./cli-g6p7c2my.js";
16
- import"./cli-xgn4rwyv.js";
17
- import"./cli-kqypty34.js";
18
- import"./cli-qrwp40st.js";
19
- import"./cli-qje9k2nh.js";
20
- import"./cli-jhmjwqcg.js";
21
- import"./cli-q1812jbw.js";
22
- import"./cli-8cvvytad.js";
23
- import"./cli-vjfpshn3.js";
24
- import"./cli-13p25grh.js";
25
- import"./cli-0adyhvq2.js";
26
- import"./cli-dxwh4j32.js";
27
- import"./cli-9e9kjqsj.js";
28
- import"./cli-hz64bcnj.js";
29
- import"./cli-445c1vp7.js";
30
- import"./cli-kvzgak7c.js";
31
- import"./cli-6vcyw6v7.js";
32
- import"./cli-re4wkbzx.js";
33
- import"./cli-ptkpaqfy.js";
34
- export {
35
- isUserAllowed2 as isUserAllowed,
36
- registerMessageHandler2 as registerMessageHandler
37
- };
@@ -1,39 +0,0 @@
1
- import"./cli-ns59dc6r.js";
2
- import {
3
- startHeartbeat2,
4
- stopHeartbeat2
5
- } from "./cli-ka01m5rb.js";
6
- import"./cli-fp4xbw07.js";
7
- import"./cli-d43xqzbe.js";
8
- import"./cli-8qsx817b.js";
9
- import"./cli-rdr166ht.js";
10
- import"./cli-fhvqt2fp.js";
11
- import"./cli-qz93y3x5.js";
12
- import"./cli-65q70v2v.js";
13
- import"./cli-3h26v7yj.js";
14
- import"./cli-7a91w22y.js";
15
- import"./cli-3ggwdtb0.js";
16
- import"./cli-g6p7c2my.js";
17
- import"./cli-xgn4rwyv.js";
18
- import"./cli-kqypty34.js";
19
- import"./cli-qrwp40st.js";
20
- import"./cli-qje9k2nh.js";
21
- import"./cli-jhmjwqcg.js";
22
- import"./cli-q1812jbw.js";
23
- import"./cli-8cvvytad.js";
24
- import"./cli-vjfpshn3.js";
25
- import"./cli-13p25grh.js";
26
- import"./cli-0adyhvq2.js";
27
- import"./cli-dxwh4j32.js";
28
- import"./cli-9e9kjqsj.js";
29
- import"./cli-hz64bcnj.js";
30
- import"./cli-445c1vp7.js";
31
- import"./cli-kvzgak7c.js";
32
- import"./cli-b2mz5mjc.js";
33
- import"./cli-6vcyw6v7.js";
34
- import"./cli-re4wkbzx.js";
35
- import"./cli-ptkpaqfy.js";
36
- export {
37
- startHeartbeat2 as startHeartbeat,
38
- stopHeartbeat2 as stopHeartbeat
39
- };
@@ -1,38 +0,0 @@
1
- import {
2
- calculateNextRun2,
3
- startScheduler2,
4
- stopScheduler2,
5
- runScheduleNow2
6
- } from "./cli-8qsx817b.js";
7
- import"./cli-rdr166ht.js";
8
- import"./cli-fhvqt2fp.js";
9
- import"./cli-qz93y3x5.js";
10
- import"./cli-65q70v2v.js";
11
- import"./cli-3h26v7yj.js";
12
- import"./cli-7a91w22y.js";
13
- import"./cli-3ggwdtb0.js";
14
- import"./cli-g6p7c2my.js";
15
- import"./cli-xgn4rwyv.js";
16
- import"./cli-kqypty34.js";
17
- import"./cli-qrwp40st.js";
18
- import"./cli-qje9k2nh.js";
19
- import"./cli-jhmjwqcg.js";
20
- import"./cli-q1812jbw.js";
21
- import"./cli-8cvvytad.js";
22
- import"./cli-vjfpshn3.js";
23
- import"./cli-13p25grh.js";
24
- import"./cli-0adyhvq2.js";
25
- import"./cli-dxwh4j32.js";
26
- import"./cli-9e9kjqsj.js";
27
- import"./cli-hz64bcnj.js";
28
- import"./cli-445c1vp7.js";
29
- import"./cli-kvzgak7c.js";
30
- import"./cli-6vcyw6v7.js";
31
- import"./cli-re4wkbzx.js";
32
- import"./cli-ptkpaqfy.js";
33
- export {
34
- calculateNextRun2 as calculateNextRun,
35
- runScheduleNow2 as runScheduleNow,
36
- startScheduler2 as startScheduler,
37
- stopScheduler2 as stopScheduler
38
- };
@@ -1,76 +0,0 @@
1
- import"./cli-qz93y3x5.js";
2
- import {
3
- getEnabledCapabilities
4
- } from "./cli-8qsx817b.js";
5
- import"./cli-v1sjhn52.js";
6
- import"./cli-re4wkbzx.js";
7
- import"./cli-6vcyw6v7.js";
8
- import"./cli-xgn4rwyv.js";
9
- import"./cli-qrwp40st.js";
10
- import"./cli-kqypty34.js";
11
- import"./cli-fhvqt2fp.js";
12
- import"./cli-jhmjwqcg.js";
13
- import"./cli-65q70v2v.js";
14
- import"./cli-g6p7c2my.js";
15
- import"./cli-3ggwdtb0.js";
16
- import"./cli-dxwh4j32.js";
17
- import"./cli-9e9kjqsj.js";
18
- import"./cli-q1812jbw.js";
19
- import"./cli-8cvvytad.js";
20
- import"./cli-kvzgak7c.js";
21
- import"./cli-445c1vp7.js";
22
- import"./cli-vjfpshn3.js";
23
- import"./cli-ptkpaqfy.js";
24
- import"./cli-7a91w22y.js";
25
- import"./cli-qje9k2nh.js";
26
- import"./cli-hz64bcnj.js";
27
- import"./cli-3h26v7yj.js";
28
- import"./cli-rdr166ht.js";
29
- import"./cli-665j3feb.js";
30
- import"./cli-p22zdvnt.js";
31
- import"./cli-77cd6gy8.js";
32
- import {
33
- runAgent
34
- } from "./cli-ea7chd26.js";
35
- import"./cli-jhp7w1fy.js";
36
- import"./cli-gx4rm0qx.js";
37
- import"./cli-a49vpbf3.js";
38
- import"./cli-jc1g9ndz.js";
39
- import"./cli-6p7ddg72.js";
40
- import"./cli-k28p6xh7.js";
41
- import"./cli-etvn5ej2.js";
42
- import"./cli-c5sbmw1v.js";
43
- import"./cli-0726awxw.js";
44
- import"./cli-1v8w782f.js";
45
- import"./cli-hn3pftj2.js";
46
- import"./cli-4bd1rck6.js";
47
- import"./cli-vbhgkw9h.js";
48
- import"./cli-er83cjbn.js";
49
- import"./cli-j0v75y13.js";
50
- import"./cli-kr5tjjtz.js";
51
- import"./cli-tr24eeny.js";
52
- import"./cli-4s1kqrqg.js";
53
- import"./cli-zv4vy2b0.js";
54
- import"./cli-zes4tsbb.js";
55
- import"./cli-a17tzmn0.js";
56
- import"./cli-9td5ss65.js";
57
- import"./cli-rc3r0bnh.js";
58
- import"./cli-0rh20bp3.js";
59
- import"./cli-4zsenjhy.js";
60
- import"./cli-4g629sgr.js";
61
- import"./cli-13p25grh.js";
62
- import"./cli-0adyhvq2.js";
63
-
64
- // src/commands/lead.ts
65
- var leadConfig = {
66
- role: "lead",
67
- defaultPrompt: "/start-leader",
68
- metadataType: "lead_metadata",
69
- capabilities: getEnabledCapabilities()
70
- };
71
- async function runLead(opts) {
72
- return runAgent(leadConfig, opts);
73
- }
74
- export {
75
- runLead
76
- };