@desplega.ai/agent-swarm 1.143.0 → 1.145.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 (303) hide show
  1. package/README.md +2 -0
  2. package/dist/{acp-adapter-qhzzpz4b.js → acp-adapter-580t41c0.js} +5 -5
  3. package/dist/{actions-6s03jvk8.js → actions-m662tjng.js} +20 -19
  4. package/dist/{anthropic-messages-jc89gynp.js → anthropic-messages-vs2rabzp.js} +5 -5
  5. package/dist/app-zb3rndm8.js +28 -0
  6. package/dist/{artifact-wpy087er.js → artifact-gj9arwrr.js} +5 -5
  7. package/dist/{assistant-42xa0m4e.js → assistant-0qt42nzg.js} +22 -21
  8. package/dist/{azure-openai-responses-5qwmjys3.js → azure-openai-responses-cqar64rc.js} +5 -5
  9. package/dist/{boot-reembed-vx4fkhgd.js → boot-reembed-072x00vn.js} +15 -14
  10. package/dist/{boot-reembed-we49a2kr.js → boot-reembed-65zz2smt.js} +16 -15
  11. package/dist/{boot-scrub-logs-zefgmq2b.js → boot-scrub-logs-yz0ams04.js} +12 -11
  12. package/dist/{claude-adapter-nm0essg1.js → claude-adapter-paj270y2.js} +36 -25
  13. package/dist/{claude-wqn3dtca.js → claude-k04qfvsv.js} +1 -1
  14. package/dist/{claude-managed-adapter-vtseey1x.js → claude-managed-adapter-sactwn31.js} +5 -5
  15. package/dist/{claude-managed-setup-3zqp51cr.js → claude-managed-setup-w619jncn.js} +2 -2
  16. package/dist/claude-sdk-session-swt80j9z.js +39101 -0
  17. package/dist/{cli-qh4sqfws.js → cli-07jd68a1.js} +1 -1
  18. package/dist/{cli-9zjf3ahs.js → cli-123q2get.js} +56 -21
  19. package/dist/{cli-dcn5dc6j.js → cli-1ebpar1q.js} +14 -14
  20. package/dist/{cli-s9y6zv37.js → cli-1fj0chdk.js} +5 -5
  21. package/dist/{cli-7jcc9y1r.js → cli-1m2e086m.js} +1 -1
  22. package/dist/{cli-ppwm8c6e.js → cli-2daksqps.js} +4 -1
  23. package/dist/{cli-f64gdfxc.js → cli-2djtr51b.js} +1 -1
  24. package/dist/{cli-a4ajmfvp.js → cli-3aqnbv8r.js} +2 -2
  25. package/dist/{cli-mez7x2z0.js → cli-4j8k1m4w.js} +4 -4
  26. package/dist/{cli-vjkzg867.js → cli-4xz3pmrq.js} +13 -13
  27. package/dist/{cli-nkn0ka5p.js → cli-51tf7ac3.js} +1 -1
  28. package/dist/{cli-gy07xk4s.js → cli-53rm0rrz.js} +1 -1
  29. package/dist/{cli-787ph852.js → cli-55qrx3q8.js} +3 -3
  30. package/dist/{cli-sshnjch3.js → cli-59ej1c07.js} +10 -448
  31. package/dist/{cli-f3s9dry0.js → cli-5bfdm1ah.js} +1 -1
  32. package/dist/{cli-zxrec1gh.js → cli-65vqzz3v.js} +64 -41
  33. package/dist/{cli-9w49enmh.js → cli-76yrvwsa.js} +9 -3
  34. package/dist/{cli-87zrjxdb.js → cli-7fnkj1hj.js} +2 -2
  35. package/dist/{cli-dwwz52tw.js → cli-7nxes1hs.js} +1 -1
  36. package/dist/{cli-w2jy8x2r.js → cli-81r683bv.js} +5 -5
  37. package/dist/{cli-rnyttbh0.js → cli-87rg4p7x.js} +1 -1
  38. package/dist/{cli-mnm7w46e.js → cli-8fc8de14.js} +1 -1
  39. package/dist/{cli-56anwfxj.js → cli-9xvdm3bx.js} +12 -12
  40. package/dist/{cli-63erbyda.js → cli-a0g1gbt5.js} +3 -3
  41. package/dist/{cli-vsap7a8d.js → cli-aehm1rbq.js} +1 -1
  42. package/dist/{cli-cppy3dz4.js → cli-anktweqr.js} +6 -6
  43. package/dist/{cli-jmkqrhpm.js → cli-axs8e6d4.js} +1 -1
  44. package/dist/{cli-a3pkfpqs.js → cli-b5b30yzk.js} +2 -2
  45. package/dist/{cli-pq2ee5ja.js → cli-bc05qbss.js} +38 -1
  46. package/dist/{cli-497b685t.js → cli-bd957dgb.js} +1 -1
  47. package/dist/{cli-00w4hbam.js → cli-btbzvq95.js} +1 -1
  48. package/dist/{cli-8e1r79yq.js → cli-bxdhw615.js} +6 -6
  49. package/dist/{cli-xbyjkasx.js → cli-c2mk1kgf.js} +1 -1
  50. package/dist/{cli-35h7kw0d.js → cli-c71mg51n.js} +1 -1
  51. package/dist/{cli-gpt9kf01.js → cli-cg4vnyh4.js} +13 -13
  52. package/dist/{cli-s9yg23fg.js → cli-cmp8g3sw.js} +8 -3
  53. package/dist/{cli-d62cd9qs.js → cli-cn6mmc7f.js} +3 -3
  54. package/dist/{cli-srjj750f.js → cli-ct0et58h.js} +9 -9
  55. package/dist/{cli-ewvk4ceg.js → cli-dc9k2ba9.js} +10 -4
  56. package/dist/{cli-rx5cxzn2.js → cli-dpvkp2et.js} +1 -1
  57. package/dist/{cli-tdtmw1r5.js → cli-dt553ktb.js} +1 -1
  58. package/dist/{cli-a1rrkrb4.js → cli-e29gmdmw.js} +1 -1
  59. package/dist/{cli-nanaxrz6.js → cli-ej6gbxfb.js} +1 -1
  60. package/dist/cli-eree7rnv.js +25 -0
  61. package/dist/{cli-wtyyc7ev.js → cli-f567d5c1.js} +60 -22
  62. package/dist/cli-f7kvq46p.js +32 -0
  63. package/dist/{cli-b4g3p5y2.js → cli-fs1kkqgr.js} +5 -5
  64. package/dist/{cli-2z3qhdg0.js → cli-gh8y8f36.js} +1 -1
  65. package/dist/{cli-vr2nfxtt.js → cli-gxnzc6wh.js} +11 -11
  66. package/dist/{cli-4kj5adw0.js → cli-gzky0gkr.js} +4 -4
  67. package/dist/{cli-jepmgn7r.js → cli-j490egb5.js} +1 -1
  68. package/dist/{cli-7pnwg2vx.js → cli-jmb7g47h.js} +918 -174
  69. package/dist/{cli-wrfhh2qz.js → cli-jnf5zghe.js} +2 -2
  70. package/dist/{cli-q6d0vvey.js → cli-jyetr64j.js} +3 -3
  71. package/dist/{cli-whrvct19.js → cli-knd276ed.js} +1 -1
  72. package/dist/{cli-r3bxcgrj.js → cli-kpev657q.js} +2 -2
  73. package/dist/{cli-6garengg.js → cli-m1xa8be7.js} +6 -6
  74. package/dist/{cli-mjf432kq.js → cli-m4j6trn4.js} +3 -3
  75. package/dist/{cli-rzhcrw2p.js → cli-n011tws7.js} +1 -1
  76. package/dist/{cli-tkf8n6cw.js → cli-pdz9qde4.js} +2 -2
  77. package/dist/{cli-9y5b02vr.js → cli-pp9ax9pa.js} +1 -1
  78. package/dist/{cli-pmz8qr82.js → cli-pw9rj5t9.js} +1 -1
  79. package/dist/{cli-qntkxysp.js → cli-pzxba7gw.js} +209 -165
  80. package/dist/{cli-m4dadbv4.js → cli-q34a0e10.js} +2 -2
  81. package/dist/{cli-qf9kpsve.js → cli-q51yprfq.js} +2 -2
  82. package/dist/{cli-c5ddbdfj.js → cli-qa66qaf0.js} +2 -2
  83. package/dist/{cli-g814jbst.js → cli-qghpvca2.js} +1 -1
  84. package/dist/{cli-wvdvxjep.js → cli-qgm2pfpq.js} +1 -1
  85. package/dist/{cli-dx3dz0ms.js → cli-rembwgt8.js} +2 -2
  86. package/dist/{cli-mvsztzgn.js → cli-rs6ec3b9.js} +13 -14
  87. package/dist/{cli-hgkw1x1k.js → cli-rvqz34y5.js} +6 -6
  88. package/dist/{cli-qe636hdh.js → cli-s2f20r5w.js} +4 -4
  89. package/dist/{cli-6t2fgxpv.js → cli-s2qjdd6z.js} +2 -2
  90. package/dist/{cli-s35981d0.js → cli-sd0mxa3c.js} +2 -2
  91. package/dist/{cli-1cwhyvta.js → cli-sxbwep7h.js} +1 -1
  92. package/dist/{cli-65d93ves.js → cli-tcvj7j2r.js} +3 -3
  93. package/dist/{cli-tpa83vxb.js → cli-tqtvj5pt.js} +1 -1
  94. package/dist/{cli-6hy7hej2.js → cli-txgcknmy.js} +1 -1
  95. package/dist/{cli-qjwdtyxn.js → cli-v0asr5yv.js} +279 -200
  96. package/dist/{cli-0v7jxbvz.js → cli-vj6h9kc2.js} +1 -1
  97. package/dist/{cli-3cgfyfzm.js → cli-w1d1bgkk.js} +3 -3
  98. package/dist/{cli-pqv5gvyf.js → cli-w5e1d1vv.js} +1 -1
  99. package/dist/{cli-vn8s7wtf.js → cli-wvp6bvy4.js} +2 -2
  100. package/dist/{cli-mkq1rk7b.js → cli-xqcq9y5e.js} +1 -1
  101. package/dist/{cli-8p37s71j.js → cli-xvkmedgn.js} +2 -2
  102. package/dist/{cli-jdtvfcyw.js → cli-xytwff7f.js} +2 -2
  103. package/dist/{cli-g2p9bd1z.js → cli-yatxqynm.js} +1 -1
  104. package/dist/{cli-z6nsjrh1.js → cli-ygbjp3z8.js} +41 -6
  105. package/dist/{cli-9bnajfes.js → cli-z96t0thj.js} +1 -1
  106. package/dist/{cli-bdyxycq6.js → cli-z9fprcrf.js} +7829 -1008
  107. package/dist/cli-zf8jjwex.js +34 -0
  108. package/dist/cli.js +44 -38
  109. package/dist/{codex-adapter-zvh2pgah.js → codex-adapter-k98vaw2r.js} +17 -17
  110. package/dist/{codex-hook-79p3xs7j.js → codex-hook-9pf19cks.js} +5 -5
  111. package/dist/{codex-login-x7603481.js → codex-login-vx7ghkzj.js} +1 -1
  112. package/dist/{codex-session-runner-bs8tsjx5.js → codex-session-runner-tngtphx7.js} +17 -17
  113. package/dist/{commands-c73m6m2j.js → commands-y8nbr3fv.js} +12 -11
  114. package/dist/{db-n2bgwkr3.js → db-30p4h2t1.js} +16 -11
  115. package/dist/{devin-adapter-8qmhqpy3.js → devin-adapter-8vgkwh29.js} +1 -1
  116. package/dist/{devtools-j2rnj8w7.js → devtools-qpc3j21w.js} +3 -3
  117. package/dist/{e2b-b7jt70fc.js → e2b-6hb103d8.js} +11 -11
  118. package/dist/{es5-fmqrjzy3.js → es5-tj3tn4jj.js} +1 -1
  119. package/dist/{event-bus-n8sb35pw.js → event-bus-sfx8dx3t.js} +3 -2
  120. package/dist/{getMachineId-bsd-wpzbhkm6.js → getMachineId-bsd-xj3bn2fv.js} +3 -3
  121. package/dist/{getMachineId-darwin-45zabjy0.js → getMachineId-darwin-07jzjcx6.js} +3 -3
  122. package/dist/{getMachineId-linux-warnp5pd.js → getMachineId-linux-ahngynxd.js} +2 -2
  123. package/dist/{getMachineId-unsupported-5spent2a.js → getMachineId-unsupported-vy43b44z.js} +2 -2
  124. package/dist/{getMachineId-win-v4bvcw7a.js → getMachineId-win-8x66cynz.js} +3 -3
  125. package/dist/{google-generative-ai-nnw57f3t.js → google-generative-ai-tsskx7te.js} +5 -5
  126. package/dist/{google-vertex-rxwnws1y.js → google-vertex-ppw8ydpa.js} +6 -6
  127. package/dist/{handlers-s768yzzt.js → handlers-yfp1qn81.js} +23 -22
  128. package/dist/{hook-m950r3r8.js → hook-21jexvfx.js} +15 -15
  129. package/dist/hook-dcw4jfbj.js +35 -0
  130. package/dist/{http-5rqpbf9g.js → http-r4kq5g8d.js} +1241 -431
  131. package/dist/{index-shne41sd.js → index-1kq5hw2p.js} +12 -12
  132. package/dist/index-1p8wdstt.js +7 -0
  133. package/dist/{index-e19s2m8k.js → index-2sp0384z.js} +8 -8
  134. package/dist/{index-qgvkk4mz.js → index-53zyht4z.js} +589 -29
  135. package/dist/{index-t36q2v4t.js → index-66xz5e9j.js} +2 -2
  136. package/dist/{index-emvxcy98.js → index-8bn5jm6d.js} +3 -3
  137. package/dist/{index-ns5kksc1.js → index-8fdjzb2f.js} +4 -4
  138. package/dist/{index-1nsdwvn5.js → index-aa3sa6s8.js} +8 -8
  139. package/dist/{index-yqweff5n.js → index-bxmwzbgw.js} +2 -2
  140. package/dist/{index-g9tttwkm.js → index-f6cryxwe.js} +2 -2
  141. package/dist/{index-d9f3yqc5.js → index-gay66b9w.js} +30 -29
  142. package/dist/{index-agykc6k2.js → index-n5t1gzfb.js} +4 -4
  143. package/dist/index-nqvf26za.js +53 -0
  144. package/dist/index-nzerxd5z.js +7 -0
  145. package/dist/{index-3e03k6e4.js → index-pyymnzat.js} +5 -5
  146. package/dist/index-q3qja6ta.js +54 -0
  147. package/dist/{index-pdxc8kfh.js → index-qv6atbab.js} +5 -5
  148. package/dist/{index-ptcqm8bc.js → index-rja32qa7.js} +5 -5
  149. package/dist/{index-gqnmr60d.js → index-tzg5srfp.js} +5 -5
  150. package/dist/{index-20xqmn3v.js → index-vhncw983.js} +3 -3
  151. package/dist/{index-7m8yxkw5.js → index-xk036zsk.js} +7 -7
  152. package/dist/index-zyazbzcb.js +6 -0
  153. package/dist/{keepalive-sc7pvszh.js → keepalive-xs8fa55y.js} +14 -13
  154. package/dist/lead-d9m2t4s0.js +95 -0
  155. package/dist/maintenance-3zh82g6z.js +30 -0
  156. package/dist/{mistral-conversations-gnnamk9c.js → mistral-conversations-4ryk7h83.js} +2 -2
  157. package/dist/{multipart-parser-6gftesw0.js → multipart-parser-c33er1yp.js} +2 -2
  158. package/dist/{node-0zgg64ps.js → node-agg3zs4s.js} +1 -1
  159. package/dist/{node-nxwyzp1j.js → node-x1g4v0pq.js} +3 -3
  160. package/dist/{oauth-refresh-sweep-xrydav2q.js → oauth-refresh-sweep-03snsye5.js} +13 -12
  161. package/dist/{onboard-972xcrsh.js → onboard-0cg1925x.js} +7 -7
  162. package/dist/{openai-codex-responses-y1qgyvmt.js → openai-codex-responses-g7w48y30.js} +5 -5
  163. package/dist/{openai-completions-ccrxm4b6.js → openai-completions-0bqmsajw.js} +4 -4
  164. package/dist/{openai-responses-6r5d4z8y.js → openai-responses-nmeyptke.js} +5 -5
  165. package/dist/{opencode-adapter-krfzs6pd.js → opencode-adapter-fef1mrn2.js} +9 -9
  166. package/dist/{openrouter-images-71hthwh9.js → openrouter-images-qx18fyp8.js} +2 -2
  167. package/dist/{otel-impl-q0mt4sy8.js → otel-impl-0ab95z27.js} +11 -11
  168. package/dist/{photon_rs-8dwt2pzy.js → photon_rs-q3vet37k.js} +1 -1
  169. package/dist/{pi-messages-kmr52r41.js → pi-messages-79jvzz1d.js} +3 -3
  170. package/dist/{pi-mono-adapter-9tb0c3jh.js → pi-mono-adapter-dtkz4e7j.js} +37 -37
  171. package/dist/pricing-refresh-e5jhzz4j.js +23 -0
  172. package/dist/{rbac-roles-vxy05wcn.js → rbac-roles-2w3cmrkc.js} +13 -12
  173. package/dist/rbac-roles-p1mf40z3.js +33 -0
  174. package/dist/{registry-6nvn6bj0.js → registry-9kdck5ye.js} +1 -1
  175. package/dist/render-v2-xhawry3k.js +40 -0
  176. package/dist/seed-pricing-t223sw91.js +20 -0
  177. package/dist/{setup-frgenxn8.js → setup-zcs0rce7.js} +7 -7
  178. package/dist/{token-xg5711x5.js → token-78fepns5.js} +3 -3
  179. package/dist/token-util-0rrc1ybd.js +6 -0
  180. package/dist/worker-qnp2ka62.js +95 -0
  181. package/dist/{x-xkfh0w0v.js → x-n2phr5vm.js} +3 -3
  182. package/openapi.json +962 -4
  183. package/package.json +9 -3
  184. package/src/artifact-sdk/browser-sdk.ts +7 -3
  185. package/src/be/db.ts +41 -3
  186. package/src/be/migrations/145_slack_render_v2_delegation.sql +12 -0
  187. package/src/be/scripts/typecheck.ts +35 -0
  188. package/src/be/seed-skills/bundled-files.generated.json +4 -0
  189. package/src/be/swarm-config-guard.ts +9 -0
  190. package/src/commands/runner.ts +54 -7
  191. package/src/http/agents.ts +267 -91
  192. package/src/http/all-routes.ts +2 -0
  193. package/src/http/auth.ts +25 -1
  194. package/src/http/db-query-shared.ts +43 -22
  195. package/src/http/index.ts +30 -6
  196. package/src/http/kv.ts +16 -1
  197. package/src/http/memory.ts +37 -3
  198. package/src/http/page-proxy.ts +8 -5
  199. package/src/http/pages-public.ts +7 -6
  200. package/src/http/pages.ts +16 -3
  201. package/src/http/realtime.ts +28 -0
  202. package/src/http/rooms.ts +314 -0
  203. package/src/http/route-def.ts +8 -2
  204. package/src/http/tasks.ts +1 -1
  205. package/src/http/utils.ts +104 -7
  206. package/src/kv-reserved-namespaces.ts +6 -0
  207. package/src/providers/claude-adapter.ts +120 -309
  208. package/src/providers/claude-sdk-session.ts +586 -0
  209. package/src/providers/claude-session-events.ts +247 -0
  210. package/src/rbac/legacy-policy.ts +1 -0
  211. package/src/rbac/permissions.ts +4 -0
  212. package/src/realtime/auth.ts +130 -0
  213. package/src/realtime/browser.generated.txt +69 -0
  214. package/src/realtime/browser.ts +382 -0
  215. package/src/realtime/bus.ts +33 -0
  216. package/src/realtime/document.ts +529 -0
  217. package/src/realtime/rooms.ts +575 -0
  218. package/src/realtime/transport.ts +406 -0
  219. package/src/realtime/tsconfig.browser.json +14 -0
  220. package/src/scripts-runtime/ctx.ts +1 -2
  221. package/src/scripts-runtime/sdk-allowlist.ts +6 -0
  222. package/src/scripts-runtime/swarm-sdk.ts +35 -7
  223. package/src/scripts-runtime/types/stdlib.d.ts +65 -0
  224. package/src/scripts-runtime/types/swarm-sdk.d.ts +65 -0
  225. package/src/server-user.ts +28 -16
  226. package/src/server.ts +10 -0
  227. package/src/slack/ack.ts +39 -19
  228. package/src/slack/closure.ts +66 -0
  229. package/src/slack/render-v2.ts +404 -36
  230. package/src/tasks/terminal-result-guard.ts +14 -1
  231. package/src/tests/agents-harness-provider.test.ts +254 -0
  232. package/src/tests/artifact-sdk.test.ts +12 -2
  233. package/src/tests/claude-hook-credentials.test.ts +84 -0
  234. package/src/tests/claude-sdk-lifecycle.test.ts +262 -0
  235. package/src/tests/claude-sdk-live-lifecycle.test.ts +272 -0
  236. package/src/tests/claude-sdk-process.fixture.ts +223 -0
  237. package/src/tests/claude-sdk-transport.test.ts +289 -0
  238. package/src/tests/claude-worker-parity.test.ts +574 -0
  239. package/src/tests/db-query.test.ts +73 -0
  240. package/src/tests/db-retention.test.ts +2 -1
  241. package/src/tests/docs-index-footprint.test.js +4 -3
  242. package/src/tests/e2e-claude-transport.test.ts +204 -0
  243. package/src/tests/e2e-nightly-report.test.ts +41 -4
  244. package/src/tests/fetch-resolved-env.test.ts +126 -0
  245. package/src/tests/harness-provider-resolution.test.ts +7 -0
  246. package/src/tests/internal-ai/complete-structured.test.ts +2 -0
  247. package/src/tests/memory-edit-authorization.test.ts +295 -0
  248. package/src/tests/page-proxy.test.ts +223 -27
  249. package/src/tests/page-session.test.ts +32 -0
  250. package/src/tests/page-viewer-auth.test.ts +182 -0
  251. package/src/tests/pages-public-html.test.ts +3 -0
  252. package/src/tests/rbac-engine.test.ts +1 -0
  253. package/src/tests/realtime-room-auth.test.ts +68 -0
  254. package/src/tests/realtime-room-surfaces.test.ts +329 -0
  255. package/src/tests/realtime-rooms.test.ts +343 -0
  256. package/src/tests/realtime-transport.test.ts +551 -0
  257. package/src/tests/runner-session-outcome.test.ts +28 -0
  258. package/src/tests/sandboxed-process.test.ts +20 -8
  259. package/src/tests/seed-skills-bundled-files.test.ts +1 -0
  260. package/src/tests/send-task-output-schema.test.ts +247 -0
  261. package/src/tests/slack-closure.test.ts +183 -0
  262. package/src/tests/slack-relay-obligations.test.ts +10 -0
  263. package/src/tests/slack-render-v2-delegation.test.ts +373 -0
  264. package/src/tests/slack-render-v2.test.ts +1107 -5
  265. package/src/tests/spec-base-url.test.ts +2 -1
  266. package/src/tests/structured-output.test.ts +31 -0
  267. package/src/tests/tool-annotations.test.ts +41 -6
  268. package/src/tools/kv/kv-delete.ts +5 -1
  269. package/src/tools/kv/kv-incr.ts +5 -1
  270. package/src/tools/kv/kv-set.ts +5 -1
  271. package/src/tools/kv/kv-write-auth.ts +6 -1
  272. package/src/tools/memory-edit.ts +37 -2
  273. package/src/tools/rooms.ts +171 -0
  274. package/src/tools/send-task.ts +29 -0
  275. package/src/tools/tool-config.ts +26 -22
  276. package/src/types.ts +3 -1
  277. package/src/utils/claude-transport.ts +36 -0
  278. package/src/utils/internal-ai/complete-structured.ts +2 -1
  279. package/src/utils/page-session.ts +21 -28
  280. package/src/utils/request-auth-context.ts +6 -2
  281. package/src/utils/sandboxed-process.ts +31 -22
  282. package/src/workflows/event-bus.ts +6 -10
  283. package/src/workflows/executors/swarm-script.ts +2 -0
  284. package/src/workflows/json-schema-validator.ts +52 -0
  285. package/templates/skills/pages/content.md +147 -8
  286. package/templates/skills/pages/files/examples/multiplayer-board.html +416 -0
  287. package/tsconfig.json +1 -0
  288. package/dist/app-zej2afh5.js +0 -27
  289. package/dist/cli-95m51ztz.js +0 -28
  290. package/dist/hook-xn3pevet.js +0 -35
  291. package/dist/index-1qthq7vc.js +0 -6
  292. package/dist/index-ag4bxqkp.js +0 -53
  293. package/dist/index-tcnvv8w6.js +0 -7
  294. package/dist/index-vb4b1nts.js +0 -52
  295. package/dist/index-w91qbfv1.js +0 -7
  296. package/dist/lead-5zcqts8e.js +0 -93
  297. package/dist/maintenance-45j327y6.js +0 -29
  298. package/dist/pricing-refresh-s7n1nec8.js +0 -22
  299. package/dist/rbac-roles-hpph0s5w.js +0 -32
  300. package/dist/render-v2-8vk0y1js.js +0 -35
  301. package/dist/seed-pricing-an8qdaxz.js +0 -19
  302. package/dist/token-util-zy908s1a.js +0 -6
  303. package/dist/worker-0w9fdwds.js +0 -93
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  require_dist
3
- } from "./cli-wvdvxjep.js";
3
+ } from "./cli-qgm2pfpq.js";
4
4
  import {
5
5
  getAutomationSetupStates,
6
6
  getExecutorRegistry,
@@ -11,17 +11,20 @@ import {
11
11
  renderAutomationTokens,
12
12
  schedulePreflightInput,
13
13
  startWorkflowExecution
14
- } from "./cli-9zjf3ahs.js";
14
+ } from "./cli-123q2get.js";
15
15
  import {
16
16
  buildScriptCredentialBindings,
17
17
  getScript,
18
18
  getScriptApiConnectionDescriptors,
19
19
  getScriptMcpConnectionDescriptors,
20
20
  runScript
21
- } from "./cli-mvsztzgn.js";
21
+ } from "./cli-rs6ec3b9.js";
22
22
  import {
23
23
  createTaskWithSiblingAwareness
24
- } from "./cli-jmkqrhpm.js";
24
+ } from "./cli-axs8e6d4.js";
25
+ import {
26
+ ensure
27
+ } from "./cli-jmb7g47h.js";
25
28
  import {
26
29
  getDbClient,
27
30
  getDueScheduledTasks,
@@ -35,451 +38,10 @@ import {
35
38
  scheduleContextKey,
36
39
  telemetry,
37
40
  updateScheduledTask
38
- } from "./cli-wtyyc7ev.js";
41
+ } from "./cli-f567d5c1.js";
39
42
  import {
40
43
  __toESM
41
- } from "./cli-pq2ee5ja.js";
42
-
43
- // node_modules/@desplega.ai/business-use/dist/index.js
44
- var log = {
45
- debug: (msg) => console.log(`[business-use] [${(/* @__PURE__ */ new Date()).toISOString()}] [DEBUG] ${msg}`),
46
- info: (msg) => console.log(`[business-use] [${(/* @__PURE__ */ new Date()).toISOString()}] [INFO] ${msg}`),
47
- warn: (msg) => console.warn(`[business-use] [${(/* @__PURE__ */ new Date()).toISOString()}] [WARNING] ${msg}`),
48
- error: (msg) => console.error(`[business-use] [${(/* @__PURE__ */ new Date()).toISOString()}] [ERROR] ${msg}`)
49
- };
50
- var BatchProcessor = class {
51
- _apiKey;
52
- _baseUrl;
53
- _batchSize;
54
- _batchInterval;
55
- _maxQueueSize;
56
- _queue = [];
57
- _timer = null;
58
- _isShuttingDown = false;
59
- constructor(options) {
60
- this._apiKey = options.apiKey;
61
- this._baseUrl = options.baseUrl.replace(/\/$/, "");
62
- this._batchSize = options.batchSize;
63
- this._batchInterval = options.batchInterval;
64
- this._maxQueueSize = options.maxQueueSize;
65
- this._maybeStartTimer();
66
- log.debug("Batch processor started");
67
- }
68
- enqueue(event) {
69
- try {
70
- if (this._queue.length >= this._maxQueueSize) {
71
- this._queue.shift();
72
- log.warn("Queue overflow: Dropped oldest event");
73
- }
74
- this._queue.push(event);
75
- if (this._queue.length >= this._batchSize) {
76
- this._flushBatch();
77
- } else {
78
- this._maybeStartTimer();
79
- }
80
- } catch (error) {
81
- log.error(`Failed to enqueue event: ${error}`);
82
- }
83
- }
84
- async shutdown(timeout = 5000) {
85
- log.debug("Shutting down batch processor");
86
- this._isShuttingDown = true;
87
- if (this._timer) {
88
- clearTimeout(this._timer);
89
- this._timer = null;
90
- }
91
- try {
92
- await this._flushAllWithTimeout(timeout);
93
- log.debug("Batch processor shutdown complete");
94
- } catch (error) {
95
- log.warn(`Batch processor shutdown timed out: ${error}`);
96
- }
97
- }
98
- _maybeStartTimer() {
99
- if (this._timer === null && this._queue.length > 0 && this._queue.length < this._batchSize && !this._isShuttingDown) {
100
- this._timer = setTimeout(() => {
101
- this._timer = null;
102
- this._flushBatch();
103
- this._maybeStartTimer();
104
- }, this._batchInterval);
105
- if (typeof this._timer.unref === "function") {
106
- this._timer.unref();
107
- }
108
- }
109
- }
110
- async _flushBatch() {
111
- if (this._timer) {
112
- clearTimeout(this._timer);
113
- this._timer = null;
114
- }
115
- const eventsToProcess = this._queue.splice(0, this._batchSize);
116
- if (eventsToProcess.length === 0) {
117
- return;
118
- }
119
- try {
120
- await this._sendBatch(eventsToProcess);
121
- } catch (error) {
122
- log.error(`Failed to send batch: ${error}`);
123
- }
124
- }
125
- async _flushAllWithTimeout(timeout) {
126
- const startTime = Date.now();
127
- while (this._queue.length > 0) {
128
- if (Date.now() - startTime >= timeout) {
129
- log.warn(`Flush timeout reached, ${this._queue.length} events remaining`);
130
- break;
131
- }
132
- await this._flushBatch();
133
- }
134
- }
135
- async _sendBatch(batch) {
136
- try {
137
- const items = [];
138
- for (const event of batch) {
139
- try {
140
- const runId = typeof event.run_id === "function" ? event.run_id() : event.run_id;
141
- const depIds = event.dep_ids !== undefined ? typeof event.dep_ids === "function" ? event.dep_ids() : event.dep_ids : undefined;
142
- const conditions = event.conditions !== undefined ? typeof event.conditions === "function" ? event.conditions() : event.conditions : undefined;
143
- const filterExpr = event.filter !== undefined && typeof event.filter === "function" ? this._serializeFunction(event.filter) : undefined;
144
- const validatorExpr = event.validator !== undefined ? this._serializeFunction(event.validator) : undefined;
145
- const item = {
146
- flow: event.flow,
147
- id: event.id,
148
- run_id: runId,
149
- type: event.type,
150
- data: event.data,
151
- ts: this._getTimestampNs(),
152
- description: event.description,
153
- dep_ids: depIds,
154
- filter: filterExpr,
155
- validator: validatorExpr,
156
- conditions,
157
- additional_meta: event.additional_meta
158
- };
159
- items.push(item);
160
- } catch (error) {
161
- log.error(`Failed to process event ${event.id}: ${error}`);
162
- continue;
163
- }
164
- }
165
- if (items.length === 0) {
166
- log.debug("No events to send after filtering");
167
- return;
168
- }
169
- await this._postBatch(items);
170
- } catch (error) {
171
- log.error(`Failed to send batch: ${error}`);
172
- }
173
- }
174
- async _postBatch(items) {
175
- try {
176
- const payload = items.map((item) => {
177
- const cleaned = {};
178
- for (const [key, value] of Object.entries(item)) {
179
- if (value !== undefined) {
180
- cleaned[key] = value;
181
- }
182
- }
183
- return cleaned;
184
- });
185
- const response = await fetch(`${this._baseUrl}/v1/events-batch`, {
186
- method: "POST",
187
- headers: {
188
- "Content-Type": "application/json",
189
- "X-Api-Key": this._apiKey
190
- },
191
- body: JSON.stringify(payload)
192
- });
193
- if (response.ok) {
194
- log.debug(`Batch sent successfully: ${items.length} events`);
195
- } else {
196
- const text = await response.text();
197
- log.error(`Batch send failed: HTTP ${response.status} - ${text}`);
198
- }
199
- } catch (error) {
200
- if (error instanceof Error) {
201
- if (error.name === "AbortError") {
202
- log.error("Batch send timed out");
203
- } else {
204
- log.error(`Network error sending batch: ${error.message}`);
205
- }
206
- } else {
207
- log.error(`Unexpected error sending batch: ${error}`);
208
- }
209
- }
210
- }
211
- _serializeFunction(fn) {
212
- try {
213
- const source = fn.toString().trim();
214
- if (source.includes("=>")) {
215
- let arrowIndex = -1;
216
- let inString = false;
217
- let stringChar = null;
218
- for (let i = 0;i < source.length - 1; i++) {
219
- const char = source[i];
220
- const nextChar = source[i + 1];
221
- if ((char === '"' || char === "'" || char === "`") && (i === 0 || source[i - 1] !== "\\")) {
222
- if (!inString) {
223
- inString = true;
224
- stringChar = char;
225
- } else if (char === stringChar) {
226
- inString = false;
227
- stringChar = null;
228
- }
229
- continue;
230
- }
231
- if (inString) {
232
- continue;
233
- }
234
- if (char === "=" && nextChar === ">") {
235
- arrowIndex = i;
236
- break;
237
- }
238
- }
239
- if (arrowIndex === -1) {
240
- return { engine: "js", script: source };
241
- }
242
- let body = source.substring(arrowIndex + 2).trim();
243
- if (body.startsWith("{") && body.endsWith("}")) {
244
- body = body.substring(1, body.length - 1).trim();
245
- }
246
- if (body.startsWith("return ")) {
247
- body = body.substring(7).trim();
248
- }
249
- body = body.replace(/;$/, "");
250
- if (body.startsWith("(") && body.endsWith(")")) {
251
- let depth = 0;
252
- inString = false;
253
- stringChar = null;
254
- let wrapsEntire = true;
255
- for (let i = 0;i < body.length; i++) {
256
- const char = body[i];
257
- if ((char === '"' || char === "'" || char === "`") && (i === 0 || body[i - 1] !== "\\")) {
258
- if (!inString) {
259
- inString = true;
260
- stringChar = char;
261
- } else if (char === stringChar) {
262
- inString = false;
263
- stringChar = null;
264
- }
265
- continue;
266
- }
267
- if (inString) {
268
- continue;
269
- }
270
- if (char === "(") {
271
- depth++;
272
- } else if (char === ")") {
273
- depth--;
274
- if (depth === 0 && i < body.length - 1) {
275
- wrapsEntire = false;
276
- break;
277
- }
278
- }
279
- }
280
- if (wrapsEntire && depth === 0) {
281
- body = body.substring(1, body.length - 1).trim();
282
- }
283
- }
284
- return { engine: "js", script: body };
285
- }
286
- return { engine: "js", script: source };
287
- } catch (error) {
288
- log.error(`Failed to serialize function: ${error}`);
289
- return { engine: "js", script: fn.toString() };
290
- }
291
- }
292
- _getTimestampNs() {
293
- return Date.now() * 1e6;
294
- }
295
- };
296
- var log2 = {
297
- debug: (msg) => console.log(`[business-use] [${(/* @__PURE__ */ new Date()).toISOString()}] [DEBUG] ${msg}`),
298
- info: (msg) => console.log(`[business-use] [${(/* @__PURE__ */ new Date()).toISOString()}] [INFO] ${msg}`),
299
- warn: (msg) => console.warn(`[business-use] [${(/* @__PURE__ */ new Date()).toISOString()}] [WARNING] ${msg}`),
300
- error: (msg) => console.error(`[business-use] [${(/* @__PURE__ */ new Date()).toISOString()}] [ERROR] ${msg}`)
301
- };
302
- var SDKState = class {
303
- initialized = false;
304
- batchProcessor = null;
305
- };
306
- var _state = new SDKState;
307
- function initialize(options) {
308
- if (_state.initialized) {
309
- log2.warn("SDK already initialized");
310
- return;
311
- }
312
- try {
313
- const finalApiKey = options?.apiKey ?? process.env.BUSINESS_USE_API_KEY;
314
- if (!finalApiKey) {
315
- log2.error("API key not provided. Set apiKey parameter or BUSINESS_USE_API_KEY environment variable");
316
- return;
317
- }
318
- const finalUrl = options?.url ?? process.env.BUSINESS_USE_URL ?? "http://localhost:13370";
319
- const baseUrl = finalUrl.replace(/\/$/, "");
320
- const batchSize = options?.batchSize ?? 100;
321
- const batchInterval = options?.batchInterval ?? 5000;
322
- const maxQueueSize = options?.maxQueueSize ?? batchSize * 10;
323
- if (!_checkConnection(finalApiKey, baseUrl)) {
324
- log2.error("Connection check failed - SDK entering no-op mode");
325
- return;
326
- }
327
- _state.batchProcessor = new BatchProcessor({
328
- apiKey: finalApiKey,
329
- baseUrl,
330
- batchSize,
331
- batchInterval,
332
- maxQueueSize
333
- });
334
- _state.initialized = true;
335
- log2.info("Business-Use SDK initialized successfully");
336
- } catch (error) {
337
- log2.error(`Failed to initialize SDK: ${error}`);
338
- _state.initialized = false;
339
- }
340
- }
341
- function ensure(options) {
342
- _enqueueEvent({
343
- type: options.validator ? "assert" : "act",
344
- id: options.id,
345
- flow: options.flow,
346
- runId: options.runId,
347
- data: options.data,
348
- filter: options.filter,
349
- depIds: options.depIds,
350
- description: options.description,
351
- validator: options.validator,
352
- conditions: options.conditions,
353
- additional_meta: options.additional_meta
354
- });
355
- }
356
- function _enqueueEvent(options) {
357
- if (!_state.initialized || !_state.batchProcessor) {
358
- return;
359
- }
360
- try {
361
- if (typeof options.runId === "function" && isAsyncFunction(options.runId)) {
362
- log2.error(`Event ${options.id}: runId cannot be an async function`);
363
- return;
364
- }
365
- if (options.filter !== undefined && typeof options.filter === "function" && isAsyncFunction(options.filter)) {
366
- log2.error(`Event ${options.id}: filter cannot be an async function`);
367
- return;
368
- }
369
- if (options.depIds !== undefined && typeof options.depIds === "function" && isAsyncFunction(options.depIds)) {
370
- log2.error(`Event ${options.id}: depIds cannot be an async function`);
371
- return;
372
- }
373
- if (options.validator !== undefined && isAsyncFunction(options.validator)) {
374
- log2.error(`Event ${options.id}: validator cannot be an async function`);
375
- return;
376
- }
377
- if (options.conditions !== undefined && typeof options.conditions === "function" && isAsyncFunction(options.conditions)) {
378
- log2.error(`Event ${options.id}: conditions cannot be an async function`);
379
- return;
380
- }
381
- const event = {
382
- type: options.type,
383
- id: options.id,
384
- flow: options.flow,
385
- run_id: options.runId,
386
- data: options.data,
387
- filter: options.filter,
388
- dep_ids: options.depIds,
389
- description: options.description,
390
- validator: options.validator,
391
- conditions: options.conditions,
392
- additional_meta: options.additional_meta
393
- };
394
- _state.batchProcessor.enqueue(event);
395
- } catch (error) {
396
- log2.error(`Failed to enqueue event ${options.id}: ${error}`);
397
- }
398
- }
399
- function _checkConnection(_apiKey, _baseUrl) {
400
- try {
401
- log2.info("Connection check successful (deferred to first batch)");
402
- return true;
403
- } catch (error) {
404
- log2.error(`Connection check failed: ${error}`);
405
- return false;
406
- }
407
- }
408
- function isAsyncFunction(fn) {
409
- return fn.constructor.name === "AsyncFunction";
410
- }
411
- var package_default = {
412
- name: "@desplega.ai/business-use",
413
- version: "0.4.2",
414
- description: "Lightweight JavaScript/TypeScript SDK for Business-Use event tracking and assertions",
415
- type: "module",
416
- main: "./dist/index.cjs",
417
- module: "./dist/index.js",
418
- types: "./dist/index.d.ts",
419
- exports: {
420
- ".": {
421
- types: "./dist/index.d.ts",
422
- import: "./dist/index.js",
423
- require: "./dist/index.cjs"
424
- }
425
- },
426
- files: [
427
- "dist"
428
- ],
429
- scripts: {
430
- build: "tsup src/index.ts --format cjs,esm --dts --clean",
431
- dev: "tsup src/index.ts --format cjs,esm --dts --watch",
432
- test: "vitest",
433
- "test:ui": "vitest --ui",
434
- "test:run": "vitest run",
435
- example: "tsx example.ts",
436
- typecheck: "tsc --noEmit",
437
- lint: "eslint src/**/*.ts",
438
- "lint:fix": "eslint src/**/*.ts --fix",
439
- format: 'prettier --write "src/**/*.{ts,tsx,json,md}"',
440
- "format:check": 'prettier --check "src/**/*.{ts,tsx,json,md}"'
441
- },
442
- keywords: [
443
- "workflow",
444
- "automation",
445
- "testing",
446
- "event-driven",
447
- "observability",
448
- "typescript",
449
- "business-logic"
450
- ],
451
- author: "Desplega AI <contact@desplega.ai>",
452
- license: "MIT",
453
- repository: {
454
- type: "git",
455
- url: "https://github.com/desplega-ai/business-use"
456
- },
457
- homepage: "https://github.com/desplega-ai/business-use#readme",
458
- bugs: {
459
- url: "https://github.com/desplega-ai/business-use/issues"
460
- },
461
- dependencies: {
462
- zod: "^3.24.1"
463
- },
464
- devDependencies: {
465
- "@eslint/js": "^9.38.0",
466
- "@types/node": "^22.10.2",
467
- "@typescript-eslint/eslint-plugin": "^8.0.0",
468
- "@typescript-eslint/parser": "^8.0.0",
469
- "@vitest/ui": "^2.1.8",
470
- eslint: "^9.0.0",
471
- "eslint-config-prettier": "^10.1.8",
472
- prettier: "^3.0.0",
473
- tsup: "^8.3.5",
474
- tsx: "^4.19.2",
475
- typescript: "^5.7.2",
476
- vitest: "^2.1.8"
477
- },
478
- engines: {
479
- node: ">=18.0.0"
480
- }
481
- };
482
- var version = package_default.version;
44
+ } from "./cli-bc05qbss.js";
483
45
 
484
46
  // src/scheduler/scheduler.ts
485
47
  var import_cron_parser = __toESM(require_dist(), 1);
@@ -885,4 +447,4 @@ async function runScheduleNow(scheduleId) {
885
447
  console.log(`[Scheduler] Manually executed schedule "${schedule.name}"`);
886
448
  }
887
449
  }
888
- export { initialize, ensure, dispatchScheduleTarget, calculateNextRun, startScheduler, stopScheduler, runScheduleNow };
450
+ export { dispatchScheduleTarget, calculateNextRun, startScheduler, stopScheduler, runScheduleNow };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __commonJS,
3
3
  __require
4
- } from "./cli-pq2ee5ja.js";
4
+ } from "./cli-bc05qbss.js";
5
5
 
6
6
  // node_modules/isexe/windows.js
7
7
  var require_windows = __commonJS(function(exports, module) {