@desplega.ai/agent-swarm 2.12.0 → 2.13.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 (417) hide show
  1. package/dist/acp-adapter-xtj40wd8.js +17 -0
  2. package/dist/{acp-targets-311gcyvw.js → acp-targets-n7vm5atw.js} +10 -9
  3. package/dist/{actions-c4chgxp6.js → actions-hq6wp9xv.js} +28 -27
  4. package/dist/{agent-fs-provision-0b9awm5n.js → agent-fs-provision-y0qc1rdd.js} +4 -4
  5. package/dist/{amp-adapter-r0veq6x5.js → amp-adapter-1qqs6h91.js} +3 -3
  6. package/dist/{app-hn5fftf5.js → app-7m4z44rv.js} +10 -8
  7. package/dist/{approval-notifications-3g6yc8nv.js → approval-notifications-8sr41gjx.js} +11 -10
  8. package/dist/{assistant-cpjgpjvp.js → assistant-hkczwfv6.js} +29 -28
  9. package/dist/{boot-args-schema-hce1av1h.js → boot-args-schema-8025snev.js} +1 -1
  10. package/dist/{boot-reembed-bztbxc4z.js → boot-reembed-15m87nr1.js} +5 -2
  11. package/dist/{boot-reembed-d7xcym0j.js → boot-reembed-4bbpxjh1.js} +1 -1
  12. package/dist/{boot-scrub-sweep-mkmm16gk.js → boot-scrub-sweep-eajr97e9.js} +2 -2
  13. package/dist/{boot-seeds-arrkbe8t.js → boot-seeds-9cwy39jx.js} +4 -4
  14. package/dist/{boxd-68n75y1s.js → boxd-hr8rsxzq.js} +1 -1
  15. package/dist/{claude-adapter-ykpyr5p8.js → claude-adapter-g61wa4rt.js} +9 -8
  16. package/dist/{claude-managed-adapter-ssg6z4bt.js → claude-managed-adapter-znkk0prm.js} +4 -4
  17. package/dist/{claude-managed-setup-trd59v7b.js → claude-managed-setup-f1wndkr2.js} +7 -7
  18. package/dist/{claude-sdk-session-yjcze0j1.js → claude-sdk-session-687xzf21.js} +20763 -19380
  19. package/dist/{cli-ya3kf4gs.js → cli-04103ryh.js} +1 -1
  20. package/dist/{cli-55tc8cj4.js → cli-0a336ze7.js} +5 -5
  21. package/dist/{cli-q8tc22bj.js → cli-0fx95c06.js} +5 -5
  22. package/dist/{cli-mq2fbgva.js → cli-0m77n7ej.js} +3 -3
  23. package/dist/{cli-7yn42w6m.js → cli-0xwb7zpt.js} +2 -2
  24. package/dist/{cli-mcymtvwn.js → cli-13t0smbk.js} +1000 -28
  25. package/dist/{cli-c7j31hq9.js → cli-1b5axkt1.js} +4 -4
  26. package/dist/{cli-yegz2g06.js → cli-1carhg8g.js} +4 -4
  27. package/dist/{cli-j5gtytvg.js → cli-1dr5at77.js} +15 -12
  28. package/dist/cli-2v4xxnx2.js +148 -0
  29. package/dist/{cli-sv2r3bw8.js → cli-32xndx6b.js} +7 -7
  30. package/dist/{cli-h70a2mxy.js → cli-3m8vqehw.js} +53 -13
  31. package/dist/{cli-ercwc8xn.js → cli-3mf04tkh.js} +1 -1
  32. package/dist/{cli-52nfye5j.js → cli-3zyme1wt.js} +24 -16
  33. package/dist/{cli-s6zk31gr.js → cli-43dsqhcp.js} +4 -4
  34. package/dist/{cli-b93d81yg.js → cli-4h90xaet.js} +2 -2
  35. package/dist/{cli-5tg94mdw.js → cli-4mj5g29m.js} +9 -12
  36. package/dist/{cli-47hz21se.js → cli-4tbvndmm.js} +4 -5
  37. package/dist/{cli-r0mz92by.js → cli-50whymxq.js} +2 -2
  38. package/dist/{cli-js10kdk7.js → cli-5basv0e7.js} +19 -5
  39. package/dist/{cli-krbcr00p.js → cli-5v6b2am8.js} +59 -5
  40. package/dist/{cli-en6dmkxd.js → cli-6r1dwegd.js} +3 -3
  41. package/dist/{cli-9qe5y107.js → cli-7ewre3dm.js} +15 -6
  42. package/dist/{cli-n3qe7tyr.js → cli-84xtgbn6.js} +35 -2
  43. package/dist/{cli-xm34qj8m.js → cli-8cmjkbvj.js} +2 -2
  44. package/dist/{cli-2m6yaq6b.js → cli-8fj8yfmk.js} +1 -1
  45. package/dist/{cli-nja15knq.js → cli-8rbkw18r.js} +3 -3
  46. package/dist/{cli-x05p2d05.js → cli-9tevdxyf.js} +1 -1
  47. package/dist/{cli-hhc47ack.js → cli-9xx36trj.js} +4 -4
  48. package/dist/{cli-39qm0rtm.js → cli-a8ts6x1n.js} +29 -150
  49. package/dist/{cli-bp6k9acz.js → cli-aebswqmz.js} +18 -18
  50. package/dist/{cli-ex1y88j3.js → cli-at67kvnp.js} +1 -1
  51. package/dist/{cli-q2dywc8h.js → cli-bjmq14k9.js} +4 -4
  52. package/dist/{cli-v9ya390t.js → cli-byxsctca.js} +12 -12
  53. package/dist/{cli-bz97ff9n.js → cli-c0tyzt73.js} +152 -12
  54. package/dist/{cli-fyaq4zdv.js → cli-c8kqmzzf.js} +9 -9
  55. package/dist/{cli-t75xngj1.js → cli-cd9acnvd.js} +12 -12
  56. package/dist/{cli-eqq0hwvx.js → cli-cmgdptmx.js} +3 -3
  57. package/dist/{cli-r14ac1y0.js → cli-cn6fpa1p.js} +1 -1
  58. package/dist/{cli-0k1a0sde.js → cli-cp0m07wb.js} +10 -10
  59. package/dist/{cli-3p288654.js → cli-cpkxh68d.js} +2 -2
  60. package/dist/{cli-fxd1mwtr.js → cli-cqxwjb93.js} +2 -2
  61. package/dist/{cli-8hp56wat.js → cli-d2epqm0y.js} +1 -1
  62. package/dist/{cli-73q4g5nx.js → cli-dd57p1gd.js} +21 -21
  63. package/dist/{cli-5z0g0e8v.js → cli-f8rcvf2x.js} +49 -13
  64. package/dist/{cli-wvjqaqcp.js → cli-fn8aj7gb.js} +1330 -249
  65. package/dist/{cli-bpje8n65.js → cli-fp65jdp2.js} +31 -6
  66. package/dist/{cli-0pp1yjg2.js → cli-gedf48yw.js} +11 -11
  67. package/dist/{cli-m5qtmrbc.js → cli-gq6qhmrr.js} +2 -2
  68. package/dist/{cli-5x03v6en.js → cli-grcc2h2g.js} +8 -8
  69. package/dist/{cli-01tvvtad.js → cli-h03j6je3.js} +4 -4
  70. package/dist/{cli-mbwmqb5w.js → cli-h0ewec3d.js} +1 -1
  71. package/dist/{cli-12vek61e.js → cli-h9bejmkf.js} +535 -146
  72. package/dist/{cli-gfy6hbd9.js → cli-hs3mqswp.js} +18 -11
  73. package/dist/{cli-tdk7jtka.js → cli-hv3820ez.js} +1 -1
  74. package/dist/{cli-pqfecppn.js → cli-je587f74.js} +1 -1
  75. package/dist/{cli-cjqyse9q.js → cli-jhtvt7gn.js} +3 -3
  76. package/dist/{cli-dkvtfgn4.js → cli-mmw2sjaf.js} +76 -17
  77. package/dist/{cli-2z2c4k6q.js → cli-mwxez0pz.js} +22 -0
  78. package/dist/{cli-yfpc6qy9.js → cli-nk8swfpx.js} +47 -16
  79. package/dist/{cli-eq4kew31.js → cli-p7g7wd9n.js} +26 -13
  80. package/dist/{cli-bhgrhedp.js → cli-q8aq48v1.js} +1 -1
  81. package/dist/{cli-dd2k2mcd.js → cli-qn79645p.js} +1 -1
  82. package/dist/{cli-ma9ys8rt.js → cli-qx1dwrr5.js} +7 -4
  83. package/dist/{cli-tm60vtax.js → cli-rfejbpe1.js} +1 -1
  84. package/dist/{cli-agjbj5x0.js → cli-s6fhqbz1.js} +38 -20
  85. package/dist/{cli-kwr5qv5g.js → cli-sfajkbd7.js} +2 -2
  86. package/dist/{cli-9y4tgrkf.js → cli-skd2c4ej.js} +2 -1
  87. package/dist/{cli-e8n0hdzd.js → cli-snypfjgj.js} +1 -1
  88. package/dist/{cli-n8f0fs3c.js → cli-t25rq8mg.js} +11 -11
  89. package/dist/{cli-72yms3ey.js → cli-t90k0phh.js} +201 -21
  90. package/dist/{cli-xf4z5bdn.js → cli-tzzas8rb.js} +4 -4
  91. package/dist/{cli-rtmqzat7.js → cli-vdfngx2g.js} +2 -2
  92. package/dist/{cli-9w8712tq.js → cli-vr4eyq6p.js} +43 -14
  93. package/dist/{cli-z4f346g5.js → cli-vx9acp12.js} +1 -1
  94. package/dist/{cli-2amwhyv2.js → cli-w24f3j49.js} +13 -11
  95. package/dist/cli-w41bvvms.js +148 -0
  96. package/dist/{cli-04zc3f7b.js → cli-w6c6dj91.js} +1 -1
  97. package/dist/{cli-fy4gb74g.js → cli-x5yb8zc8.js} +2 -2
  98. package/dist/{cli-2tw284hj.js → cli-xhkek467.js} +3 -3
  99. package/dist/{cli-5r95eqbh.js → cli-y260hgep.js} +1 -1
  100. package/dist/{cli-hbvgzjq4.js → cli-y6qqbpwc.js} +3 -3
  101. package/dist/{cli-7wy8gbwb.js → cli-ya1cj689.js} +1 -1
  102. package/dist/{cli-1htmtqc2.js → cli-yeh3g1q6.js} +620 -95
  103. package/dist/{cli-0vcqcwfn.js → cli-yfvhvw8m.js} +2 -0
  104. package/dist/{cli-k5jx8jya.js → cli-z6m6xzxt.js} +2 -2
  105. package/dist/{cli-pe3yxedk.js → cli-zaate0rd.js} +3 -3
  106. package/dist/{cli-n85m2wkq.js → cli-zkbz8m2q.js} +3 -2
  107. package/dist/{cli-e3ahxq5y.js → cli-zvpkrgsc.js} +6 -6
  108. package/dist/cli.js +30 -28
  109. package/dist/{codex-adapter-wc6e4wct.js → codex-adapter-ysfg6ty3.js} +8 -8
  110. package/dist/{codex-hook-aqtj17yr.js → codex-hook-c0nvm30r.js} +73 -2
  111. package/dist/{codex-login-1ven7yje.js → codex-login-ven5cz5j.js} +1 -1
  112. package/dist/{codex-session-runner-ppfgjd97.js → codex-session-runner-823scr6g.js} +9 -9
  113. package/dist/{commands-tsv2vx5b.js → commands-5rbm07fz.js} +3 -3
  114. package/dist/{controller-ye4sdwsy.js → controller-wn3vd217.js} +4 -4
  115. package/dist/{controllers-connect-zn4dg69h.js → controllers-connect-34jzhfft.js} +29 -28
  116. package/dist/core-kdehq26g.js +42 -0
  117. package/dist/{cursor-adapter-q2g9vwts.js → cursor-adapter-w1681kp1.js} +2 -2
  118. package/dist/{db-g111qn9j.js → db-6bkgbfwk.js} +3 -3
  119. package/dist/{db-3r1fyr2n.js → db-hcj16x7z.js} +4 -2
  120. package/dist/{devin-adapter-t8d86q9x.js → devin-adapter-fs90ab4v.js} +1 -1
  121. package/dist/{dispatcher-4q8s0mx8.js → dispatcher-jgjqrfzv.js} +28 -25
  122. package/dist/{docker-1b41eysj.js → docker-1h33jvh9.js} +2 -2
  123. package/dist/{dsh-adapter-mmcw1z5s.js → dsh-adapter-g9yqv09y.js} +2 -2
  124. package/dist/{e2b-xm60c8ad.js → e2b-jnk0yeva.js} +2 -2
  125. package/dist/{e2b-ew8c5j5v.js → e2b-y7e5kmzf.js} +2 -2
  126. package/dist/{easter-egg-3d-04ke6hcp.js → easter-egg-3d-w17nsny6.js} +1 -1
  127. package/dist/{embedding-space-kcdn52vz.js → embedding-space-v06fwy7b.js} +6 -6
  128. package/dist/{embeddings-jnzcd91a.js → embeddings-g50dxea4.js} +1 -1
  129. package/dist/{event-bus-v4ywhc2p.js → event-bus-08t2b4y2.js} +1 -1
  130. package/dist/{execute-74amghty.js → execute-1n36haw1.js} +1 -1
  131. package/dist/{external-channel-v9zgxnxz.js → external-channel-43tv8pg6.js} +2 -2
  132. package/dist/fx-adapter-bvh05t4a.js +20 -0
  133. package/dist/grok-adapter-my5j8mdf.js +20 -0
  134. package/dist/handlers-wyymeeqh.js +41 -0
  135. package/dist/heartbeat-sf3nk937.js +50 -0
  136. package/dist/{hook-p5reemds.js → hook-dqph1e05.js} +77 -18
  137. package/dist/{hook-k1h73zd7.js → hook-m1m9dm6w.js} +6 -5
  138. package/dist/{http-ms1z5xxy.js → http-w0th1cz9.js} +888 -226
  139. package/dist/index-22khdtby.js +44 -0
  140. package/dist/{index-76zzxtzf.js → index-c0e8en64.js} +1 -1
  141. package/dist/{index-620y7jzq.js → index-e8pz8qdg.js} +3 -3
  142. package/dist/{index-8p0j4h4j.js → index-ez823q84.js} +94 -89
  143. package/dist/{index-fbkqhvvj.js → index-ffba0z8q.js} +217 -165
  144. package/dist/{index-gjn6qfgn.js → index-gkpfgpg7.js} +1 -1
  145. package/dist/{index-4k7m5dgj.js → index-k8ajc0g0.js} +143 -103
  146. package/dist/index-np0582ac.js +40 -0
  147. package/dist/{index-kn63q1gr.js → index-pb03vans.js} +33 -32
  148. package/dist/index-vgkrj1jt.js +39 -0
  149. package/dist/{index-pe3d8jfy.js → index-whysn1wf.js} +1 -1
  150. package/dist/{index-0h6qd4p1.js → index-y4vd4mhn.js} +3 -4
  151. package/dist/{k8s-fy8hbhkg.js → k8s-8326q0rq.js} +2 -2
  152. package/dist/{keepalive-031js8jz.js → keepalive-2v06q2e8.js} +5 -4
  153. package/dist/lead-55z813ng.js +79 -0
  154. package/dist/{maintenance-sq9v3qx9.js → maintenance-vx7vjhhy.js} +1 -1
  155. package/dist/{oauth-refresh-sweep-zqmnyvs8.js → oauth-refresh-sweep-g06k4bza.js} +4 -3
  156. package/dist/{object-webhooks-r24wwb5y.js → object-webhooks-3dzdq4fm.js} +7 -7
  157. package/dist/{onboard-p25yhh7t.js → onboard-232pazny.js} +4 -4
  158. package/dist/{opencode-adapter-wcjc4zdk.js → opencode-adapter-t0paqbh8.js} +8 -7
  159. package/dist/{otel-impl-ff1gf20m.js → otel-impl-kmpkyp4y.js} +2 -2
  160. package/dist/{pending-hxj5yatb.js → pending-x0z3vx1x.js} +27 -26
  161. package/dist/{pi-mono-adapter-vkp4zz7p.js → pi-mono-adapter-7pmypn6d.js} +93 -22
  162. package/dist/{pricing-refresh-9w7gx41w.js → pricing-refresh-ytjmtyd7.js} +2 -2
  163. package/dist/{rbac-roles-84aw10nz.js → rbac-roles-fgm5mxr2.js} +3 -3
  164. package/dist/{rbac-roles-hz74vckp.js → rbac-roles-xyaxekh3.js} +7 -4
  165. package/dist/{registry-eeyx1201.js → registry-zv0zvxsx.js} +1 -1
  166. package/dist/{render-v2-nrdkg9gf.js → render-v2-ws972g4r.js} +12 -8
  167. package/dist/{resume-s6ey36rh.js → resume-m6mjzhkp.js} +13 -12
  168. package/dist/{runtime-x0b4pyam.js → runtime-zzpc0c8a.js} +1 -1
  169. package/dist/{session-access-xv49tk14.js → session-access-vp35xs91.js} +5 -4
  170. package/dist/{session-source-backfill-r5j988ah.js → session-source-backfill-p73e8zbe.js} +3 -3
  171. package/dist/{setup-mj0krk1p.js → setup-r4kd7rxg.js} +1 -1
  172. package/dist/thread-buffer-cm2nzq6t.js +42 -0
  173. package/dist/{tree-visibility-cbrsfaar.js → tree-visibility-07h2tbs2.js} +2 -2
  174. package/dist/{user-merge-jobs-f9d8nwnw.js → user-merge-jobs-96vg9rpe.js} +3 -3
  175. package/dist/{virtual-modules-ns0ryw05.js → virtual-modules-vgn3f2x4.js} +3 -3
  176. package/dist/{work-objects-pydhzast.js → work-objects-74hbcx3e.js} +31 -29
  177. package/dist/worker-5pn2vzx6.js +79 -0
  178. package/dist/{worker-follow-up-9z2xec5e.js → worker-follow-up-ezavwn5d.js} +26 -25
  179. package/dist/{x-3dtaf2r9.js → x-asbrnafg.js} +2 -2
  180. package/dist/xlsx-9acfmxr1.js +31534 -0
  181. package/openapi.json +2816 -1464
  182. package/package.json +13 -11
  183. package/src/agentmail/handlers.ts +26 -19
  184. package/src/apps/catalog.generated.json +757 -0
  185. package/src/apps/definition.ts +24 -7
  186. package/src/apps/page-validator.ts +225 -3
  187. package/src/apps/row-store.ts +37 -14
  188. package/src/azure-devops/handlers.ts +2 -0
  189. package/src/be/audit-user.ts +46 -6
  190. package/src/be/db/kv-windows.ts +22 -0
  191. package/src/be/db/session-moves.ts +3 -3
  192. package/src/be/db/session-tree.ts +52 -5
  193. package/src/be/db/skill-audit.ts +17 -0
  194. package/src/be/db/tasks/write.ts +18 -3
  195. package/src/be/db.ts +152 -33
  196. package/src/be/extensions/assets.ts +11 -7
  197. package/src/be/mcp-proxy.ts +5 -4
  198. package/src/be/memory/demotion-evidence.ts +2 -2
  199. package/src/be/memory/providers/sqlite-store.ts +151 -18
  200. package/src/be/memory/search-read-worker.ts +60 -0
  201. package/src/be/memory/search-reader.ts +223 -0
  202. package/src/be/migrations/337_favorites_session_hidden_key.sql +39 -0
  203. package/src/be/migrations/338_audit_agent_columns.sql +30 -0
  204. package/src/be/migrations/339_deferred_event_waits.sql +26 -0
  205. package/src/be/migrations/340_api_key_spend_cap.sql +5 -0
  206. package/src/be/model-tier-resolution.ts +18 -1
  207. package/src/be/multi-runtime.ts +17 -0
  208. package/src/be/primitives/object-embed.ts +250 -0
  209. package/src/be/primitives/objects.ts +29 -9
  210. package/src/be/primitives/sheets/service.ts +138 -6
  211. package/src/be/primitives/sheets/xlsx.ts +367 -0
  212. package/src/be/rbac-roles.ts +3 -0
  213. package/src/be/repo-checked-update.ts +4 -4
  214. package/src/be/repo-merge-policy.ts +26 -9
  215. package/src/be/schedules/validate.ts +26 -0
  216. package/src/be/scripts/boot-reembed.ts +6 -0
  217. package/src/be/scripts/db.ts +17 -5
  218. package/src/be/scripts/embeddings.ts +6 -0
  219. package/src/be/scripts/typecheck.ts +43 -2
  220. package/src/be/seed/schedules-seeder.ts +9 -1
  221. package/src/be/seed/workflows-seeder.ts +9 -1
  222. package/src/be/seed-scripts/index.ts +2 -0
  223. package/src/be/seed-skills/index.ts +12 -0
  224. package/src/be/swarm-config-guard.ts +5 -0
  225. package/src/be/unmapped-identities.ts +95 -1
  226. package/src/bitbucket/handlers.ts +2 -0
  227. package/src/commands/credential-outcome-report.ts +5 -2
  228. package/src/commands/onboard/agent-fs-version.ts +1 -1
  229. package/src/commands/provider-credentials.ts +19 -0
  230. package/src/commands/provider-error-class.ts +4 -1
  231. package/src/commands/rate-limit-outcome.ts +48 -3
  232. package/src/commands/runner.ts +113 -55
  233. package/src/commands/worktree-reaper.ts +600 -0
  234. package/src/event-waits/github.ts +43 -0
  235. package/src/event-waits/index.ts +29 -0
  236. package/src/event-waits/types.ts +51 -0
  237. package/src/extensions/contract-types.generated.ts +1 -1
  238. package/src/extensions/dispatcher.ts +9 -0
  239. package/src/fs/agent-fs-provider.ts +4 -1
  240. package/src/github/handlers.ts +3 -1
  241. package/src/github/pull-request-state.ts +34 -0
  242. package/src/gitlab/handlers.ts +12 -7
  243. package/src/hooks/codex-hook.ts +99 -1
  244. package/src/hooks/hook.ts +85 -11
  245. package/src/hooks/native-tool-hooks.ts +245 -0
  246. package/src/http/agents.ts +4 -0
  247. package/src/http/all-routes.ts +1 -0
  248. package/src/http/api-keys.ts +27 -3
  249. package/src/http/assets.ts +4 -3
  250. package/src/http/comb.ts +2 -2
  251. package/src/http/favorite-owner.ts +2 -2
  252. package/src/http/favorites.ts +3 -2
  253. package/src/http/fs.ts +13 -4
  254. package/src/http/index.ts +2 -0
  255. package/src/http/mcp-bridge.ts +4 -0
  256. package/src/http/objects.ts +265 -0
  257. package/src/http/pages-public.ts +40 -4
  258. package/src/http/pages.ts +3 -3
  259. package/src/http/poll.ts +43 -12
  260. package/src/http/pool-keys.ts +21 -2
  261. package/src/http/repos.ts +7 -6
  262. package/src/http/schedules.ts +38 -9
  263. package/src/http/script-connections.ts +14 -6
  264. package/src/http/script-runs.ts +12 -3
  265. package/src/http/scripts.ts +9 -0
  266. package/src/http/sessions.ts +30 -12
  267. package/src/http/skills.ts +17 -0
  268. package/src/http/task-requester.ts +2 -2
  269. package/src/http/tasks.ts +18 -12
  270. package/src/http/tool-hooks.ts +24 -2
  271. package/src/http/trackers/authorize-gate.ts +2 -2
  272. package/src/http/users.ts +136 -1
  273. package/src/http/workflow-events.ts +13 -0
  274. package/src/http/workflows.ts +21 -11
  275. package/src/linear/sync.ts +3 -1
  276. package/src/mcp-client/http-client.ts +3 -1
  277. package/src/oauth/identity-capture.ts +6 -1
  278. package/src/oauth/mcp-wrapper.ts +10 -3
  279. package/src/oauth/wrapper.ts +15 -3
  280. package/src/prompts/base-prompt.ts +35 -13
  281. package/src/prompts/session-templates.ts +26 -0
  282. package/src/providers/acp-targets.ts +2 -2
  283. package/src/providers/amp-adapter.ts +1 -1
  284. package/src/providers/dsh-adapter.ts +1 -1
  285. package/src/providers/opencode-adapter.ts +1 -0
  286. package/src/providers/opencode-swarm-plugin.ts +50 -1
  287. package/src/providers/pi-mono-adapter.ts +143 -11
  288. package/src/providers/pi-mono-extension.ts +69 -0
  289. package/src/providers/runtime-dependencies.ts +1 -1
  290. package/src/rbac/legacy-policy.ts +5 -0
  291. package/src/rbac/permissions.ts +16 -1
  292. package/src/scheduler/deferred-task-waits.ts +170 -13
  293. package/src/scripts-runtime/executors/types.ts +5 -0
  294. package/src/scripts-runtime/loader.ts +8 -0
  295. package/src/scripts-runtime/mcp-client.ts +4 -0
  296. package/src/scripts-runtime/sdk-allowlist.ts +14 -1
  297. package/src/scripts-runtime/swarm-config.ts +8 -0
  298. package/src/scripts-runtime/swarm-sdk.ts +4 -0
  299. package/src/scripts-runtime/types/stdlib.d.ts +47 -4
  300. package/src/scripts-runtime/types/swarm-extension.d.ts +8 -7
  301. package/src/scripts-runtime/types/swarm-sdk.d.ts +47 -4
  302. package/src/server.ts +4 -0
  303. package/src/slack/enrich.ts +94 -31
  304. package/src/slack/handlers.test.ts +55 -2
  305. package/src/slack/handlers.ts +38 -3
  306. package/src/slack/render-v2.ts +19 -0
  307. package/src/slack/session-mirror.ts +208 -0
  308. package/src/slack/thread-participants.ts +0 -5
  309. package/src/slack/watcher.ts +3 -0
  310. package/src/slack/work-objects.test.ts +2 -1
  311. package/src/slack/work-objects.ts +7 -2
  312. package/src/tests/agentmail-filters.test.ts +4 -3
  313. package/src/tests/agents-list-model-display.test.ts +23 -0
  314. package/src/tests/apps-spike2.test.ts +35 -0
  315. package/src/tests/audit-agent-person.test.ts +825 -0
  316. package/src/tests/audit-updated-by.test.ts +19 -12
  317. package/src/tests/base-prompt.test.ts +1 -0
  318. package/src/tests/claude-hook-output.test.ts +107 -2
  319. package/src/tests/claude-managed-setup.test.ts +1 -1
  320. package/src/tests/codex-adapter.test.ts +6 -6
  321. package/src/tests/codex-gpt6-release.test.ts +4 -4
  322. package/src/tests/db-task-read-contract.test.ts +1 -0
  323. package/src/tests/db-task-write-contract.test.ts +1 -0
  324. package/src/tests/deploy-guard.test.ts +24 -0
  325. package/src/tests/dsh-adapter.test.ts +1 -1
  326. package/src/tests/ensure-token.test.ts +2 -2
  327. package/src/tests/entrypoint-repo-autoclone-args.test.ts +202 -0
  328. package/src/tests/extensions-catalog.test.ts +33 -25
  329. package/src/tests/fake-dns.ts +47 -0
  330. package/src/tests/fixtures/base-prompt-baseline.json +12 -12
  331. package/src/tests/fixtures/sheets/eocd-count-mismatch.xlsx +0 -0
  332. package/src/tests/fixtures/sheets/rich-budget.xlsx +0 -0
  333. package/src/tests/fixtures/sheets/tracker-export.xlsx +0 -0
  334. package/src/tests/kv-storage.test.ts +3 -0
  335. package/src/tests/latest-model-report.test.ts +138 -0
  336. package/src/tests/mcp-oauth-dcr-reuse.test.ts +5 -2
  337. package/src/tests/mcp-oauth-ensure-token.test.ts +3 -2
  338. package/src/tests/mcp-oauth-manual-client.test.ts +6 -1
  339. package/src/tests/mcp-oauth-wrapper.test.ts +20 -4
  340. package/src/tests/mcp-outbound-fetch-guard.test.ts +169 -0
  341. package/src/tests/mcp-server-ssrf.test.ts +2 -0
  342. package/src/tests/memory-search-reader.test.ts +258 -0
  343. package/src/tests/memory-search-stall.test.ts +202 -20
  344. package/src/tests/model-control.test.ts +4 -4
  345. package/src/tests/model-tier-resolution.test.ts +2 -2
  346. package/src/tests/multi-runtime-registration.test.ts +8 -2
  347. package/src/tests/native-tool-hooks.test.ts +188 -0
  348. package/src/tests/oauth-connection-fetch-guard.test.ts +162 -0
  349. package/src/tests/oauth-token-endpoint-fetch-guard.test.ts +121 -0
  350. package/src/tests/oauth-wrapper.test.ts +1 -2
  351. package/src/tests/opencode-swarm-plugin.test.ts +6 -1
  352. package/src/tests/pages-head-v2.test.ts +2 -1
  353. package/src/tests/pi-provider-runtime-keys.test.ts +163 -0
  354. package/src/tests/poll-probe-readonly.test.ts +108 -0
  355. package/src/tests/primitives-sheets-xlsx.test.ts +549 -0
  356. package/src/tests/prompt-template-session.test.ts +3 -2
  357. package/src/tests/rbac-roles.test.ts +3 -0
  358. package/src/tests/script-connections-http.test.ts +8 -3
  359. package/src/tests/script-connections.test.ts +6 -0
  360. package/src/tests/seed-model-profiles.test.ts +1 -1
  361. package/src/tests/sessions-tree.test.ts +10 -2
  362. package/src/tests/slack-thread-participants.test.ts +77 -4
  363. package/src/tests/spend-cap-credentials.test.ts +34 -0
  364. package/src/tests/spend-cap-outcome.test.ts +67 -0
  365. package/src/tests/subscription-first.test.ts +119 -0
  366. package/src/tests/tool-registrar-no-input.test.ts +1 -0
  367. package/src/tests/worktree-reaper.test.ts +424 -0
  368. package/src/tools/defer-task.ts +154 -12
  369. package/src/tools/get-task-details.ts +247 -5
  370. package/src/tools/objects.ts +10 -5
  371. package/src/tools/repos/update-repo.ts +6 -6
  372. package/src/tools/schedules/create-schedule.ts +1 -0
  373. package/src/tools/schedules/list-schedules.ts +3 -0
  374. package/src/tools/schedules/patch-schedule.ts +38 -4
  375. package/src/tools/schedules/update-schedule.ts +40 -5
  376. package/src/tools/sheets.ts +66 -0
  377. package/src/tools/skills/skill-create.ts +6 -0
  378. package/src/tools/skills/skill-install-remote.ts +6 -0
  379. package/src/tools/skills/skill-sync-remote.ts +9 -0
  380. package/src/tools/skills/skill-update.ts +9 -1
  381. package/src/tools/tool-config.ts +3 -1
  382. package/src/tools/utils.ts +15 -0
  383. package/src/tools/workflows/create-workflow.ts +9 -4
  384. package/src/tools/workflows/patch-workflow-node.ts +1 -1
  385. package/src/tools/workflows/patch-workflow.ts +5 -2
  386. package/src/tools/workflows/update-workflow.ts +13 -7
  387. package/src/types.ts +96 -12
  388. package/src/utils/credentials.ts +36 -1
  389. package/src/utils/egress-guard.ts +40 -10
  390. package/src/utils/error-tracker.ts +17 -0
  391. package/src/workflows/input.ts +12 -5
  392. package/src/workflows/patch-definition.ts +13 -5
  393. package/src/workflows/triggers.ts +11 -6
  394. package/src/workflows/version.ts +7 -1
  395. package/templates/skills/apps/SKILL.md +191 -2
  396. package/templates/skills/apps/content.md +191 -2
  397. package/templates/skills/boards-and-sheets/config.json +14 -0
  398. package/templates/skills/boards-and-sheets/content.md +174 -0
  399. package/templates/skills/pages/content.md +11 -0
  400. package/templates/skills/swarm-docs/content.md +11 -0
  401. package/templates/skills/swarm-scripts/SKILL.md +1 -0
  402. package/templates/skills/swarm-scripts/content.md +1 -0
  403. package/templates/workflows/ralph-loop/content.md +6 -6
  404. package/dist/acp-adapter-11m13kx4.js +0 -16
  405. package/dist/cli-pr0eze3x.js +0 -149
  406. package/dist/core-dxcy02sc.js +0 -41
  407. package/dist/fx-adapter-0ar6pqm3.js +0 -19
  408. package/dist/grok-adapter-t6m74fb1.js +0 -19
  409. package/dist/handlers-9kwcrc4k.js +0 -38
  410. package/dist/heartbeat-p8pk1msj.js +0 -49
  411. package/dist/index-23cdfzr6.js +0 -39
  412. package/dist/index-g7kkjs5b.js +0 -38
  413. package/dist/index-stk36pa5.js +0 -43
  414. package/dist/lead-mfggjtfk.js +0 -77
  415. package/dist/thread-buffer-temgaqsy.js +0 -41
  416. package/dist/worker-efcemc22.js +0 -77
  417. /package/dist/{cli-cah298e5.js → cli-m4ejz4nj.js} +0 -0
@@ -3,6 +3,7 @@ import {
3
3
  CredentialBroker,
4
4
  defaultCredentialBindings,
5
5
  assertUrlSafe,
6
+ createSsrfGuardedFetch,
6
7
  parseEgressAllowlist,
7
8
  init_egress_guard,
8
9
  init_credential_broker,
@@ -45,11 +46,11 @@ import {
45
46
  getWorkflowVersions2,
46
47
  getMcpServerById2,
47
48
  init_db4
48
- } from "./cli-12vek61e.js";
49
+ } from "./cli-h9bejmkf.js";
49
50
  import {
50
51
  McpHttpClient,
51
52
  init_http_client
52
- } from "./cli-x05p2d05.js";
53
+ } from "./cli-9tevdxyf.js";
53
54
  import {
54
55
  detachedProcessGroup,
55
56
  registerProcessGroup,
@@ -60,17 +61,17 @@ import {
60
61
  oauthAppRowToProviderConfig,
61
62
  ensureAuthorizationTokenOrThrow,
62
63
  init_ensure_token
63
- } from "./cli-9qe5y107.js";
64
+ } from "./cli-7ewre3dm.js";
64
65
  import {
65
66
  AGENT_FS_API_KEY_CONFIG,
66
67
  init_script_fs,
67
68
  resolveAgentFsIdentity,
68
69
  init_agent_fs_identity
69
- } from "./cli-hbvgzjq4.js";
70
+ } from "./cli-y6qqbpwc.js";
70
71
  import {
71
72
  validateDefinition,
72
73
  init_definition2
73
- } from "./cli-j5gtytvg.js";
74
+ } from "./cli-1dr5at77.js";
74
75
  import {
75
76
  getApiKey,
76
77
  init_api_key
@@ -82,18 +83,18 @@ import {
82
83
  refreshMcpToken,
83
84
  computeExpiresAt,
84
85
  init_mcp_wrapper
85
- } from "./cli-bz97ff9n.js";
86
+ } from "./cli-c0tyzt73.js";
86
87
  import {
87
88
  mintScriptRunToken,
88
89
  revokeSessionToken,
89
90
  init_users
90
- } from "./cli-k5jx8jya.js";
91
+ } from "./cli-z6m6xzxt.js";
91
92
  import {
92
93
  defaultAssetKey,
93
94
  init_key,
94
95
  AppIconSchema,
95
96
  init_types5
96
- } from "./cli-5z0g0e8v.js";
97
+ } from "./cli-f8rcvf2x.js";
97
98
  import {
98
99
  init_zod
99
100
  } from "./cli-96234j5w.js";
@@ -126,7 +127,7 @@ import {
126
127
  refreshSecretScrubberCache,
127
128
  registerVolatileSecret,
128
129
  init_secret_scrubber
129
- } from "./cli-bpje8n65.js";
130
+ } from "./cli-fp65jdp2.js";
130
131
  import {
131
132
  __toESM,
132
133
  __commonJS,
@@ -7073,7 +7074,7 @@ async function createMcpServerClient(serverId, context = {}) {
7073
7074
  clientInfo: { name: "agent-swarm-script-mcp-proxy", version: "1.0.0" },
7074
7075
  omitEmptyAuthHeaders: true,
7075
7076
  timeoutMs: context.timeoutMs ?? MCP_PROXY_TIMEOUT_MS,
7076
- validateUrl: (url) => assertUrlSafe(url, publicEndpointSsrfOptions())
7077
+ fetch: createSsrfGuardedFetch(publicEndpointSsrfOptions())
7077
7078
  });
7078
7079
  client.useRawUrl = true;
7079
7080
  client.customHeaders = await resolveMcpHeaders(server2, context);
@@ -7095,6 +7096,7 @@ var init_mcp_proxy = __esm(() => {
7095
7096
  init_http_client();
7096
7097
  init_ensure_mcp_token();
7097
7098
  init_mcp_wrapper();
7099
+ init_egress_guard();
7098
7100
  init_secret_scrubber();
7099
7101
  });
7100
7102
 
@@ -178217,7 +178219,8 @@ async function buildConfigPayload(input) {
178217
178219
  value: input.mcpBaseUrl ?? getMcpBaseUrl(),
178218
178220
  isSecret: false
178219
178221
  },
178220
- ...input.runtimeInstanceId ? { runtimeInstanceId: { value: input.runtimeInstanceId, isSecret: false } } : {}
178222
+ ...input.runtimeInstanceId ? { runtimeInstanceId: { value: input.runtimeInstanceId, isSecret: false } } : {},
178223
+ ...input.sourceTaskId ? { auditSourceTaskId: { value: input.sourceTaskId, isSecret: false } } : {}
178221
178224
  },
178222
178225
  user: input.userConfig ?? {},
178223
178226
  egressSecrets: input.egressSecrets ?? await buildEgressSecrets(),
@@ -178768,7 +178771,7 @@ var content_default11 = `# Iterative Review Loop
178768
178771
 
178769
178772
  Template parameter: {{REPO_URL}}
178770
178773
 
178771
- A bounded implement → review loop. A coder agent implements the task and reports the diff; a reviewer agent checks it and returns PASS or a blocking fix list. Use this when you want automated quality control with a clear exit condition rather than open-ended implementation.
178774
+ A single implement → review pass. A coder agent implements the task and reports the diff; a reviewer agent checks it and returns PASS or a blocking fix list. Use this when you want automated quality control with a clear exit condition rather than open-ended implementation.
178772
178775
 
178773
178776
  ## Configuration
178774
178777
 
@@ -178778,15 +178781,15 @@ A bounded implement → review loop. A coder agent implements the task and repor
178778
178781
 
178779
178782
  ## What It Does
178780
178783
 
178781
- A two-node implement → review loop:
178784
+ A two-node implement → review pass:
178782
178785
 
178783
178786
  1. **Implement node (coder):** Takes the \`task\` description and \`repoUrl\`, produces a working implementation, runs focused checks (lint, types, relevant tests), and reports the diff.
178784
178787
 
178785
178788
  2. **Review node (reviewer):** Reads the implementation output, checks correctness and quality, and returns either \`PASS\` (implementation is accepted) or a list of blocking fixes only (no nitpicks — only what must change before this can ship).
178786
178789
 
178787
- The \`maxIterations\` parameter is declarative: the reviewer signals PASS when done. The workflow engine handles the iteration ceiling.
178790
+ The trigger’s \`maxIterations\` is only a hint to the agents, not an engine-enforced ceiling. The global engine limits are \`WORKFLOW_MAX_ITERATIONS\` (default 100 node executions per graph walk, reset on resume) and \`WORKFLOW_MAX_STEPS_PER_RUN\` (default 500 total steps per run).
178788
178791
 
178789
- **Note:** In the current workflow schema, looping back is not native — the review node does not automatically re-trigger the implement node. To iterate, re-trigger the workflow with the reviewer's feedback as the new \`task\` input, or extend with a \`workflow-iterate\` skill pattern.
178792
+ **Note:** The shipped definition has no back-edge, so it runs once. The engine supports native loops through port back-edges: add a separate entry node before \`implement\`, then a \`property-match\` node after review whose \`false\` port routes back to \`implement\` when the verdict is FAIL.
178790
178793
 
178791
178794
  ## When to Use
178792
178795
 
@@ -178797,14 +178800,14 @@ The \`maxIterations\` parameter is declarative: the reviewer signals PASS when d
178797
178800
 
178798
178801
  ## Customization Notes
178799
178802
 
178800
- - **\`maxIterations\`** is passed in but not natively enforced by the two-node shape. It's a hint to the agents — include it in the implement node's task prompt if you want the coder to self-limit attempts.
178803
+ - **\`maxIterations\`** is declared in the trigger schema but is not enforced by the engine. It's a hint to the agents — include it in the implement node's task prompt if you want the coder to self-limit attempts.
178801
178804
  - **Pin \`agentId\`** on the implement node to a coder-capable agent with repo access. Pin the review node to a reviewer-capable agent that can reason about code quality.
178802
178805
  - **Add a PR creation node:** Extend with a third agent-task node that takes the reviewer's PASS output and creates a pull request via \`gh pr create\`.
178803
178806
  - **Add structured output to the review node:** Use \`outputSchema: { "type": "object", "properties": { "verdict": { "type": "string", "enum": ["PASS", "FAIL"] }, "fixes": { "type": "array" } } }\` to make the verdict machine-readable for downstream automation.
178804
178807
 
178805
178808
  ## Trade-offs
178806
178809
 
178807
- **No native loop:** This workflow is a single implement → review pass. True multi-iteration requires re-triggering or a more complex DAG. Use the \`workflow-iterate\` skill if you need the lead agent to drive multiple rounds based on reviewer feedback.
178810
+ **Single pass as shipped:** Native iteration requires adding a port back-edge and an explicit budget check if you want to enforce the trigger’s \`maxIterations\`. The global engine limits are safety backstops, not a review-round budget.
178808
178811
 
178809
178812
  **Reviewer quality matters:** The review node's output is only as good as the reviewer agent's judgment. For high-stakes code, add a second reviewer node or route to a human-in-the-loop step before the PASS verdict is accepted.
178810
178813
 
@@ -179014,7 +179017,12 @@ function createWorkflowsSeeder(sources = BUILT_IN_WORKFLOW_SOURCES) {
179014
179017
  return;
179015
179018
  }
179016
179019
  const input = workflow.input || existing.input ? { ...workflow.input, ...existing.input } : undefined;
179017
- await updateWorkflow2(existing.id, { ...executable, input });
179020
+ await updateWorkflow2(existing.id, {
179021
+ ...executable,
179022
+ input,
179023
+ updatedBy: null,
179024
+ updatedByAgentId: null
179025
+ });
179018
179026
  }
179019
179027
  };
179020
179028
  }
@@ -179541,6 +179549,7 @@ var init_catalog_generated = __esm(() => {
179541
179549
  "SearchInput",
179542
179550
  "Select",
179543
179551
  "NumberInput",
179552
+ "Input",
179544
179553
  "Button",
179545
179554
  "Metric",
179546
179555
  "Chart",
@@ -179569,18 +179578,28 @@ var init_catalog_generated = __esm(() => {
179569
179578
  "Tree",
179570
179579
  "Files",
179571
179580
  "File",
179581
+ "ObjectEmbed",
179572
179582
  "DateRange",
179573
179583
  "Timeline",
179574
179584
  "SchemaForm",
179575
179585
  "SessionThread",
179576
179586
  "PageFrame",
179577
179587
  "ElementRef",
179588
+ "Svg",
179589
+ "Rect",
179590
+ "Line",
179591
+ "Path",
179592
+ "Circle",
179593
+ "SvgText",
179578
179594
  "ElementSlot"
179579
179595
  ],
179580
179596
  actionTypes: [
179581
179597
  "swarm.sdk",
179582
179598
  "swarm.call",
179583
179599
  "ui.toast",
179600
+ "ui.set",
179601
+ "ui.focus",
179602
+ "ui.when",
179584
179603
  "app.mutate",
179585
179604
  "app.refresh",
179586
179605
  "app.action",
@@ -180157,6 +180176,315 @@ var init_catalog_generated = __esm(() => {
180157
180176
  additionalProperties: false
180158
180177
  }
180159
180178
  },
180179
+ Input: {
180180
+ description: 'Low-level text field. `value` binds two-way to page-local state: `{ "$bindState": "/local/<name>/..." }`, or `{ "$bindItem": "" }` inside a `repeat` over a `/local` list. `onInput` runs after every edit (`{ "$chain": "value" }` is the new text); `onPaste` replaces the browser paste (`{ "$chain": "text" }` is the clipboard text); `onKeyDown:<Key>` (Backspace, Delete, Enter, Escape, Tab, ArrowLeft, ArrowRight, ArrowUp, ArrowDown, Home, End) replaces that key\'s default. `id` is what `ui.focus` targets. `size: "cell"` is a square one-character box; `selectOnFocus` selects the value so typing replaces it.',
180181
+ props: {
180182
+ $schema: "http://json-schema.org/draft-07/schema#",
180183
+ type: "object",
180184
+ properties: {
180185
+ id: {
180186
+ type: "string"
180187
+ },
180188
+ value: {
180189
+ type: "string"
180190
+ },
180191
+ label: {
180192
+ type: "string"
180193
+ },
180194
+ placeholder: {
180195
+ type: "string"
180196
+ },
180197
+ type: {
180198
+ type: "string",
180199
+ enum: ["text", "password"]
180200
+ },
180201
+ inputMode: {
180202
+ type: "string",
180203
+ enum: ["text", "numeric", "tel", "email", "url", "search"]
180204
+ },
180205
+ autoComplete: {
180206
+ type: "string",
180207
+ enum: ["off", "one-time-code"]
180208
+ },
180209
+ maxLength: {
180210
+ type: "integer",
180211
+ minimum: 1,
180212
+ maximum: 1e4
180213
+ },
180214
+ size: {
180215
+ type: "string",
180216
+ enum: ["default", "cell"]
180217
+ },
180218
+ selectOnFocus: {
180219
+ type: "boolean"
180220
+ },
180221
+ disabled: {
180222
+ type: "boolean"
180223
+ },
180224
+ onInput: {
180225
+ type: "array",
180226
+ items: {
180227
+ type: "object",
180228
+ properties: {
180229
+ action: {
180230
+ type: "string"
180231
+ },
180232
+ params: {
180233
+ type: "object",
180234
+ propertyNames: {
180235
+ type: "string"
180236
+ },
180237
+ additionalProperties: {}
180238
+ }
180239
+ },
180240
+ required: ["action"],
180241
+ additionalProperties: false
180242
+ }
180243
+ },
180244
+ onPaste: {
180245
+ type: "array",
180246
+ items: {
180247
+ type: "object",
180248
+ properties: {
180249
+ action: {
180250
+ type: "string"
180251
+ },
180252
+ params: {
180253
+ type: "object",
180254
+ propertyNames: {
180255
+ type: "string"
180256
+ },
180257
+ additionalProperties: {}
180258
+ }
180259
+ },
180260
+ required: ["action"],
180261
+ additionalProperties: false
180262
+ }
180263
+ },
180264
+ "onKeyDown:Backspace": {
180265
+ type: "array",
180266
+ items: {
180267
+ type: "object",
180268
+ properties: {
180269
+ action: {
180270
+ type: "string"
180271
+ },
180272
+ params: {
180273
+ type: "object",
180274
+ propertyNames: {
180275
+ type: "string"
180276
+ },
180277
+ additionalProperties: {}
180278
+ }
180279
+ },
180280
+ required: ["action"],
180281
+ additionalProperties: false
180282
+ }
180283
+ },
180284
+ "onKeyDown:Delete": {
180285
+ type: "array",
180286
+ items: {
180287
+ type: "object",
180288
+ properties: {
180289
+ action: {
180290
+ type: "string"
180291
+ },
180292
+ params: {
180293
+ type: "object",
180294
+ propertyNames: {
180295
+ type: "string"
180296
+ },
180297
+ additionalProperties: {}
180298
+ }
180299
+ },
180300
+ required: ["action"],
180301
+ additionalProperties: false
180302
+ }
180303
+ },
180304
+ "onKeyDown:Enter": {
180305
+ type: "array",
180306
+ items: {
180307
+ type: "object",
180308
+ properties: {
180309
+ action: {
180310
+ type: "string"
180311
+ },
180312
+ params: {
180313
+ type: "object",
180314
+ propertyNames: {
180315
+ type: "string"
180316
+ },
180317
+ additionalProperties: {}
180318
+ }
180319
+ },
180320
+ required: ["action"],
180321
+ additionalProperties: false
180322
+ }
180323
+ },
180324
+ "onKeyDown:Escape": {
180325
+ type: "array",
180326
+ items: {
180327
+ type: "object",
180328
+ properties: {
180329
+ action: {
180330
+ type: "string"
180331
+ },
180332
+ params: {
180333
+ type: "object",
180334
+ propertyNames: {
180335
+ type: "string"
180336
+ },
180337
+ additionalProperties: {}
180338
+ }
180339
+ },
180340
+ required: ["action"],
180341
+ additionalProperties: false
180342
+ }
180343
+ },
180344
+ "onKeyDown:Tab": {
180345
+ type: "array",
180346
+ items: {
180347
+ type: "object",
180348
+ properties: {
180349
+ action: {
180350
+ type: "string"
180351
+ },
180352
+ params: {
180353
+ type: "object",
180354
+ propertyNames: {
180355
+ type: "string"
180356
+ },
180357
+ additionalProperties: {}
180358
+ }
180359
+ },
180360
+ required: ["action"],
180361
+ additionalProperties: false
180362
+ }
180363
+ },
180364
+ "onKeyDown:ArrowLeft": {
180365
+ type: "array",
180366
+ items: {
180367
+ type: "object",
180368
+ properties: {
180369
+ action: {
180370
+ type: "string"
180371
+ },
180372
+ params: {
180373
+ type: "object",
180374
+ propertyNames: {
180375
+ type: "string"
180376
+ },
180377
+ additionalProperties: {}
180378
+ }
180379
+ },
180380
+ required: ["action"],
180381
+ additionalProperties: false
180382
+ }
180383
+ },
180384
+ "onKeyDown:ArrowRight": {
180385
+ type: "array",
180386
+ items: {
180387
+ type: "object",
180388
+ properties: {
180389
+ action: {
180390
+ type: "string"
180391
+ },
180392
+ params: {
180393
+ type: "object",
180394
+ propertyNames: {
180395
+ type: "string"
180396
+ },
180397
+ additionalProperties: {}
180398
+ }
180399
+ },
180400
+ required: ["action"],
180401
+ additionalProperties: false
180402
+ }
180403
+ },
180404
+ "onKeyDown:ArrowUp": {
180405
+ type: "array",
180406
+ items: {
180407
+ type: "object",
180408
+ properties: {
180409
+ action: {
180410
+ type: "string"
180411
+ },
180412
+ params: {
180413
+ type: "object",
180414
+ propertyNames: {
180415
+ type: "string"
180416
+ },
180417
+ additionalProperties: {}
180418
+ }
180419
+ },
180420
+ required: ["action"],
180421
+ additionalProperties: false
180422
+ }
180423
+ },
180424
+ "onKeyDown:ArrowDown": {
180425
+ type: "array",
180426
+ items: {
180427
+ type: "object",
180428
+ properties: {
180429
+ action: {
180430
+ type: "string"
180431
+ },
180432
+ params: {
180433
+ type: "object",
180434
+ propertyNames: {
180435
+ type: "string"
180436
+ },
180437
+ additionalProperties: {}
180438
+ }
180439
+ },
180440
+ required: ["action"],
180441
+ additionalProperties: false
180442
+ }
180443
+ },
180444
+ "onKeyDown:Home": {
180445
+ type: "array",
180446
+ items: {
180447
+ type: "object",
180448
+ properties: {
180449
+ action: {
180450
+ type: "string"
180451
+ },
180452
+ params: {
180453
+ type: "object",
180454
+ propertyNames: {
180455
+ type: "string"
180456
+ },
180457
+ additionalProperties: {}
180458
+ }
180459
+ },
180460
+ required: ["action"],
180461
+ additionalProperties: false
180462
+ }
180463
+ },
180464
+ "onKeyDown:End": {
180465
+ type: "array",
180466
+ items: {
180467
+ type: "object",
180468
+ properties: {
180469
+ action: {
180470
+ type: "string"
180471
+ },
180472
+ params: {
180473
+ type: "object",
180474
+ propertyNames: {
180475
+ type: "string"
180476
+ },
180477
+ additionalProperties: {}
180478
+ }
180479
+ },
180480
+ required: ["action"],
180481
+ additionalProperties: false
180482
+ }
180483
+ }
180484
+ },
180485
+ additionalProperties: false
180486
+ }
180487
+ },
180160
180488
  Button: {
180161
180489
  description: 'Interactive button. Wire to actions via `on.press`. `variant: "destructive-outline"` is the canonical red-outlined destructive look (standalone deletes should use it, not solid red). `disabled` accepts a constant or a bound boolean; `busyWith: "<actionName>"` swaps the label for a spinner (presses ignored) while that custom action is running, then shows a check plus `successLabel` for ~1.5s when it finishes ok. `icon` + `iconPosition` (start|end) add an icon from the curated set; `size` sm|default|lg. `shortcut` (one key, e.g. `"n"`) shows a keycap inside the button and presses it from anywhere on the page (not while typing in a field, not with Ctrl/Cmd/Alt). `hint` is a hover tooltip.',
180162
180490
  props: {
@@ -182760,6 +183088,36 @@ var init_catalog_generated = __esm(() => {
182760
183088
  additionalProperties: false
182761
183089
  }
182762
183090
  },
183091
+ ObjectEmbed: {
183092
+ description: "One board (Excalidraw) or sheet (formula grid) by `objectId`, editable in place by the viewer. Create the object with `ctx.boards.create` / `ctx.sheets.create` (or the board-* / sheet-* tools) on the swarm's shared drive and put its id here. Sheet edits and TSV pastes go to the server, which recalculates formulas; a formula cell shows its result and edits as its formula. A board autosaves 1.5 s after the last edit, and when someone else saved first it offers Keep mine / Take theirs. Both views poll every 4 s, so agent writes show up. `height` 160-1200 px (default 480); `readOnly` disables edits; `tab` opens a sheet tab; `range` (e.g. `Tasks!B2:F20`) shows only that window. A missing object, or one off the shared drive, shows an error with a copy-id button.",
183093
+ props: {
183094
+ $schema: "http://json-schema.org/draft-07/schema#",
183095
+ type: "object",
183096
+ properties: {
183097
+ objectId: {
183098
+ type: "string",
183099
+ format: "uuid",
183100
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
183101
+ },
183102
+ height: {
183103
+ type: "integer",
183104
+ minimum: 160,
183105
+ maximum: 1200
183106
+ },
183107
+ readOnly: {
183108
+ type: "boolean"
183109
+ },
183110
+ tab: {
183111
+ type: "string"
183112
+ },
183113
+ range: {
183114
+ type: "string"
183115
+ }
183116
+ },
183117
+ required: ["objectId"],
183118
+ additionalProperties: false
183119
+ }
183120
+ },
182763
183121
  DateRange: {
182764
183122
  description: 'Date range filter: preset buttons (`7d`, `30d`, `90d`, `mtd` month to date, `custom`) that write `/ui/<id>/from` and `/ui/<id>/to` as inclusive `YYYY-MM-DD` dates ending today. Bind query params to them with `{ "$state": "/ui/<id>/from" }`, so the query refetches when the range changes. `presets` picks and orders the buttons (default all five); `defaultPreset` is written on first load (default the first preset). `custom` opens two date inputs in a popover and applies when from is not after to.',
182765
183123
  props: {
@@ -183068,6 +183426,364 @@ var init_catalog_generated = __esm(() => {
183068
183426
  additionalProperties: false
183069
183427
  }
183070
183428
  },
183429
+ Svg: {
183430
+ description: 'Vector drawing, `width` x `height` user units, scaled to its container width. Children are Rect, Line, Path, Circle, SvgText or a nested Svg (a group: put `repeat` on it to draw one set of shapes per item, offset by `x`/`y`). Every numeric attribute accepts an expression, e.g. a Gantt bar `x: { "$mul": [{ "$item": "start" }, 20] }`. Colors are palette tokens only.',
183431
+ slots: ["default"],
183432
+ props: {
183433
+ $schema: "http://json-schema.org/draft-07/schema#",
183434
+ type: "object",
183435
+ properties: {
183436
+ width: {
183437
+ type: "number",
183438
+ exclusiveMinimum: 0,
183439
+ maximum: 1e4
183440
+ },
183441
+ height: {
183442
+ type: "number",
183443
+ exclusiveMinimum: 0,
183444
+ maximum: 1e4
183445
+ },
183446
+ x: {
183447
+ type: "number"
183448
+ },
183449
+ y: {
183450
+ type: "number"
183451
+ },
183452
+ label: {
183453
+ type: "string"
183454
+ }
183455
+ },
183456
+ additionalProperties: false
183457
+ }
183458
+ },
183459
+ Rect: {
183460
+ description: "Rectangle inside an Svg. `rx` rounds corners; `title` is a hover tooltip.",
183461
+ props: {
183462
+ $schema: "http://json-schema.org/draft-07/schema#",
183463
+ type: "object",
183464
+ properties: {
183465
+ x: {
183466
+ type: "number"
183467
+ },
183468
+ y: {
183469
+ type: "number"
183470
+ },
183471
+ width: {
183472
+ type: "number"
183473
+ },
183474
+ height: {
183475
+ type: "number"
183476
+ },
183477
+ rx: {
183478
+ type: "number",
183479
+ minimum: 0
183480
+ },
183481
+ fill: {
183482
+ type: "string",
183483
+ enum: [
183484
+ "chart-1",
183485
+ "chart-2",
183486
+ "chart-3",
183487
+ "chart-4",
183488
+ "chart-5",
183489
+ "primary",
183490
+ "success",
183491
+ "warning",
183492
+ "error",
183493
+ "info",
183494
+ "muted",
183495
+ "foreground",
183496
+ "background",
183497
+ "border",
183498
+ "none"
183499
+ ]
183500
+ },
183501
+ stroke: {
183502
+ type: "string",
183503
+ enum: [
183504
+ "chart-1",
183505
+ "chart-2",
183506
+ "chart-3",
183507
+ "chart-4",
183508
+ "chart-5",
183509
+ "primary",
183510
+ "success",
183511
+ "warning",
183512
+ "error",
183513
+ "info",
183514
+ "muted",
183515
+ "foreground",
183516
+ "background",
183517
+ "border",
183518
+ "none"
183519
+ ]
183520
+ },
183521
+ strokeWidth: {
183522
+ type: "number",
183523
+ minimum: 0,
183524
+ maximum: 100
183525
+ },
183526
+ opacity: {
183527
+ type: "number",
183528
+ minimum: 0,
183529
+ maximum: 1
183530
+ },
183531
+ title: {
183532
+ type: "string"
183533
+ }
183534
+ },
183535
+ required: ["x", "y", "width", "height"],
183536
+ additionalProperties: false
183537
+ }
183538
+ },
183539
+ Line: {
183540
+ description: "Line inside an Svg, from (x1, y1) to (x2, y2). `dashed` draws it dashed.",
183541
+ props: {
183542
+ $schema: "http://json-schema.org/draft-07/schema#",
183543
+ type: "object",
183544
+ properties: {
183545
+ x1: {
183546
+ type: "number"
183547
+ },
183548
+ y1: {
183549
+ type: "number"
183550
+ },
183551
+ x2: {
183552
+ type: "number"
183553
+ },
183554
+ y2: {
183555
+ type: "number"
183556
+ },
183557
+ dashed: {
183558
+ type: "boolean"
183559
+ },
183560
+ stroke: {
183561
+ type: "string",
183562
+ enum: [
183563
+ "chart-1",
183564
+ "chart-2",
183565
+ "chart-3",
183566
+ "chart-4",
183567
+ "chart-5",
183568
+ "primary",
183569
+ "success",
183570
+ "warning",
183571
+ "error",
183572
+ "info",
183573
+ "muted",
183574
+ "foreground",
183575
+ "background",
183576
+ "border",
183577
+ "none"
183578
+ ]
183579
+ },
183580
+ strokeWidth: {
183581
+ type: "number",
183582
+ minimum: 0,
183583
+ maximum: 100
183584
+ },
183585
+ opacity: {
183586
+ type: "number",
183587
+ minimum: 0,
183588
+ maximum: 1
183589
+ }
183590
+ },
183591
+ required: ["x1", "y1", "x2", "y2"],
183592
+ additionalProperties: false
183593
+ }
183594
+ },
183595
+ Path: {
183596
+ description: "SVG path inside an Svg. `d` holds path commands and numbers only.",
183597
+ props: {
183598
+ $schema: "http://json-schema.org/draft-07/schema#",
183599
+ type: "object",
183600
+ properties: {
183601
+ d: {
183602
+ type: "string",
183603
+ maxLength: 1e4
183604
+ },
183605
+ fill: {
183606
+ type: "string",
183607
+ enum: [
183608
+ "chart-1",
183609
+ "chart-2",
183610
+ "chart-3",
183611
+ "chart-4",
183612
+ "chart-5",
183613
+ "primary",
183614
+ "success",
183615
+ "warning",
183616
+ "error",
183617
+ "info",
183618
+ "muted",
183619
+ "foreground",
183620
+ "background",
183621
+ "border",
183622
+ "none"
183623
+ ]
183624
+ },
183625
+ stroke: {
183626
+ type: "string",
183627
+ enum: [
183628
+ "chart-1",
183629
+ "chart-2",
183630
+ "chart-3",
183631
+ "chart-4",
183632
+ "chart-5",
183633
+ "primary",
183634
+ "success",
183635
+ "warning",
183636
+ "error",
183637
+ "info",
183638
+ "muted",
183639
+ "foreground",
183640
+ "background",
183641
+ "border",
183642
+ "none"
183643
+ ]
183644
+ },
183645
+ strokeWidth: {
183646
+ type: "number",
183647
+ minimum: 0,
183648
+ maximum: 100
183649
+ },
183650
+ opacity: {
183651
+ type: "number",
183652
+ minimum: 0,
183653
+ maximum: 1
183654
+ }
183655
+ },
183656
+ required: ["d"],
183657
+ additionalProperties: false
183658
+ }
183659
+ },
183660
+ Circle: {
183661
+ description: "Circle inside an Svg, centered at (cx, cy) with radius `r`.",
183662
+ props: {
183663
+ $schema: "http://json-schema.org/draft-07/schema#",
183664
+ type: "object",
183665
+ properties: {
183666
+ cx: {
183667
+ type: "number"
183668
+ },
183669
+ cy: {
183670
+ type: "number"
183671
+ },
183672
+ r: {
183673
+ type: "number",
183674
+ minimum: 0
183675
+ },
183676
+ fill: {
183677
+ type: "string",
183678
+ enum: [
183679
+ "chart-1",
183680
+ "chart-2",
183681
+ "chart-3",
183682
+ "chart-4",
183683
+ "chart-5",
183684
+ "primary",
183685
+ "success",
183686
+ "warning",
183687
+ "error",
183688
+ "info",
183689
+ "muted",
183690
+ "foreground",
183691
+ "background",
183692
+ "border",
183693
+ "none"
183694
+ ]
183695
+ },
183696
+ stroke: {
183697
+ type: "string",
183698
+ enum: [
183699
+ "chart-1",
183700
+ "chart-2",
183701
+ "chart-3",
183702
+ "chart-4",
183703
+ "chart-5",
183704
+ "primary",
183705
+ "success",
183706
+ "warning",
183707
+ "error",
183708
+ "info",
183709
+ "muted",
183710
+ "foreground",
183711
+ "background",
183712
+ "border",
183713
+ "none"
183714
+ ]
183715
+ },
183716
+ strokeWidth: {
183717
+ type: "number",
183718
+ minimum: 0,
183719
+ maximum: 100
183720
+ },
183721
+ opacity: {
183722
+ type: "number",
183723
+ minimum: 0,
183724
+ maximum: 1
183725
+ },
183726
+ title: {
183727
+ type: "string"
183728
+ }
183729
+ },
183730
+ required: ["cx", "cy", "r"],
183731
+ additionalProperties: false
183732
+ }
183733
+ },
183734
+ SvgText: {
183735
+ description: "Text label inside an Svg at (x, y). `anchor` start|middle|end aligns it horizontally; `size` is the font size in user units.",
183736
+ props: {
183737
+ $schema: "http://json-schema.org/draft-07/schema#",
183738
+ type: "object",
183739
+ properties: {
183740
+ x: {
183741
+ type: "number"
183742
+ },
183743
+ y: {
183744
+ type: "number"
183745
+ },
183746
+ text: {
183747
+ type: "string"
183748
+ },
183749
+ anchor: {
183750
+ type: "string",
183751
+ enum: ["start", "middle", "end"]
183752
+ },
183753
+ size: {
183754
+ type: "number",
183755
+ minimum: 6,
183756
+ maximum: 96
183757
+ },
183758
+ weight: {
183759
+ type: "string",
183760
+ enum: ["normal", "bold"]
183761
+ },
183762
+ fill: {
183763
+ type: "string",
183764
+ enum: [
183765
+ "chart-1",
183766
+ "chart-2",
183767
+ "chart-3",
183768
+ "chart-4",
183769
+ "chart-5",
183770
+ "primary",
183771
+ "success",
183772
+ "warning",
183773
+ "error",
183774
+ "info",
183775
+ "muted",
183776
+ "foreground",
183777
+ "background",
183778
+ "border",
183779
+ "none"
183780
+ ]
183781
+ }
183782
+ },
183783
+ required: ["x", "y", "text"],
183784
+ additionalProperties: false
183785
+ }
183786
+ },
183071
183787
  ElementSlot: {
183072
183788
  description: "Leaf insertion point for children supplied by an ElementRef consumer.",
183073
183789
  props: {
@@ -183211,6 +183927,55 @@ var init_catalog_generated = __esm(() => {
183211
183927
  additionalProperties: false
183212
183928
  }
183213
183929
  },
183930
+ "ui.set": {
183931
+ description: 'Write `value` to a page-local state path (`/local/<name>/...`, declared in the page `state`). `path` may be an expression, e.g. `{ "$join": [["/local/otp", { "$index": true }], "/"] }`.',
183932
+ params: {
183933
+ $schema: "http://json-schema.org/draft-07/schema#",
183934
+ type: "object",
183935
+ properties: {
183936
+ path: {
183937
+ type: "string"
183938
+ },
183939
+ value: {}
183940
+ },
183941
+ required: ["path", "value"],
183942
+ additionalProperties: false
183943
+ }
183944
+ },
183945
+ "ui.focus": {
183946
+ description: 'Focus the Input whose `id` matches. Inside a `repeat`, pass the item `index` (an expression such as `{ "$add": [{ "$index": true }, 1] }` moves to the next cell); a missing target is a no-op.',
183947
+ params: {
183948
+ $schema: "http://json-schema.org/draft-07/schema#",
183949
+ type: "object",
183950
+ properties: {
183951
+ id: {
183952
+ type: "string"
183953
+ },
183954
+ index: {
183955
+ type: "integer",
183956
+ minimum: -9007199254740991,
183957
+ maximum: 9007199254740991
183958
+ }
183959
+ },
183960
+ required: ["id"],
183961
+ additionalProperties: false
183962
+ }
183963
+ },
183964
+ "ui.when": {
183965
+ description: "Guard: the chain continues only when `value` equals `eq` (or is truthy when `eq` is omitted); otherwise the rest of the chain is skipped quietly.",
183966
+ params: {
183967
+ $schema: "http://json-schema.org/draft-07/schema#",
183968
+ type: "object",
183969
+ properties: {
183970
+ value: {},
183971
+ eq: {
183972
+ type: ["string", "number", "boolean", "null"]
183973
+ }
183974
+ },
183975
+ required: ["value"],
183976
+ additionalProperties: false
183977
+ }
183978
+ },
183214
183979
  "app.mutate": {
183215
183980
  description: "Create / update / delete a swarm-app row, then refetch every named query on the same model.",
183216
183981
  params: {
@@ -183424,6 +184189,18 @@ function collectRepeatBindingPaths(value, path, paths) {
183424
184189
  collectRepeatBindingPaths(child, appendPath(path, key), paths);
183425
184190
  }
183426
184191
  }
184192
+ function expressionOp(value) {
184193
+ if (!isPlainObject(value))
184194
+ return null;
184195
+ const keys = Object.keys(value);
184196
+ return keys.length === 1 && Object.hasOwn(EXPRESSION_ARITY, keys[0]) ? keys[0] : null;
184197
+ }
184198
+ function isBindStateBinding(value) {
184199
+ return isPlainObject(value) && Object.keys(value).length === 1 && typeof value.$bindState === "string";
184200
+ }
184201
+ function isBindItemBinding(value) {
184202
+ return isPlainObject(value) && Object.keys(value).length === 1 && typeof value.$bindItem === "string";
184203
+ }
183427
184204
  function isActionSentinel(value) {
183428
184205
  if (!isPlainObject(value) || Object.keys(value).length !== 1)
183429
184206
  return false;
@@ -183485,6 +184262,31 @@ function validateSchema(value, schema, path, allowActionSentinels, skipPath) {
183485
184262
  }
183486
184263
  if (isRepeatBinding(value))
183487
184264
  return { issues: [], stateRefs: [] };
184265
+ if (isBindStateBinding(value) || isBindItemBinding(value)) {
184266
+ return {
184267
+ issues: [issue(path, "$bindState and $bindItem are only allowed on Input.value")],
184268
+ stateRefs: []
184269
+ };
184270
+ }
184271
+ const op = expressionOp(value);
184272
+ if (op) {
184273
+ const operands = value[op];
184274
+ const [min, max] = EXPRESSION_ARITY[op];
184275
+ if (!Array.isArray(operands) || operands.length < min || operands.length > max) {
184276
+ const count = min === max ? `${min}` : max === Infinity ? `at least ${min}` : `${min}-${max}`;
184277
+ return {
184278
+ issues: [issue(appendPath(path, op), `must be an array of ${count} operand(s)`)],
184279
+ stateRefs: []
184280
+ };
184281
+ }
184282
+ const result = { issues: [], stateRefs: [] };
184283
+ for (const [index, operand] of operands.entries()) {
184284
+ const operandResult = validateSchema(operand, {}, appendPath(appendPath(path, op), index), allowActionSentinels);
184285
+ result.issues.push(...operandResult.issues);
184286
+ result.stateRefs.push(...operandResult.stateRefs);
184287
+ }
184288
+ return result;
184289
+ }
183488
184290
  if (isActionSentinel(value)) {
183489
184291
  return allowActionSentinels ? { issues: [], stateRefs: [] } : {
183490
184292
  issues: [
@@ -183647,6 +184449,16 @@ function actionParams(step, path, definition, catalog, validateNavigation = fals
183647
184449
  result.issues.push(issue(appendPath(sessionPath, "scope"), 'scope "shared" is not supported yet'));
183648
184450
  }
183649
184451
  }
184452
+ } else if (step.action === "ui.set") {
184453
+ if (typeof params.path === "string") {
184454
+ result.stateRefs.push({
184455
+ path: appendPath(paramsPath, "path"),
184456
+ value: params.path,
184457
+ write: true
184458
+ });
184459
+ } else if (!expressionOp(params.path)) {
184460
+ result.issues.push(issue(appendPath(paramsPath, "path"), "must be a /local/<name> path or an expression"));
184461
+ }
183650
184462
  } else if (step.action === "ui.toast") {
183651
184463
  const undo = toastUndoChain(step);
183652
184464
  if (Array.isArray(undo)) {
@@ -183690,7 +184502,18 @@ function validateActionMap(value, path, definition, catalog, allowSingle) {
183690
184502
  }
183691
184503
  return result;
183692
184504
  }
183693
- function validateStateRef(ref, definition, formIds, uiIds, pageParams) {
184505
+ function validateStateRef(ref, definition, formIds, uiIds, pageParams, pageState) {
184506
+ const localMatch = /^\/local\/([^/]+)(?:\/.*)?$/.exec(ref.value);
184507
+ if (localMatch) {
184508
+ const name = localMatch[1];
184509
+ if (!Object.hasOwn(pageState, name)) {
184510
+ return issue(ref.path, `state reference targets undeclared page state "${name}"; declare it in the page's \`state\``);
184511
+ }
184512
+ return ref.value.split("/").some((segment) => RESERVED_UI_IDS.has(segment)) ? issue(ref.path, `invalid state reference "${ref.value}"`) : null;
184513
+ }
184514
+ if (ref.write) {
184515
+ return issue(ref.path, `only page-local /local/<name> state is writable (got "${ref.value}")`);
184516
+ }
183694
184517
  if (ref.value === "/route/page")
183695
184518
  return null;
183696
184519
  const routeParam = /^\/route\/params\/([^/]+)$/.exec(ref.value);
@@ -184351,6 +185174,9 @@ function validatePage(definition, catalog, target) {
184351
185174
  const page = options?.tree ?? definition.pages[pageName];
184352
185175
  const pagePath = options?.path ?? appendPath("pages", pageName);
184353
185176
  const pageParams = pageName ? definition.pages[pageName]?.params ?? {} : {};
185177
+ const pageState = pageName ? definition.pages[pageName]?.state ?? {} : {};
185178
+ const inputIds = new Set;
185179
+ const bindItemPaths = [];
184354
185180
  const elementsPath = appendPath(pagePath, "elements");
184355
185181
  const root = page.root;
184356
185182
  const elements = page.elements;
@@ -184396,7 +185222,17 @@ function validatePage(definition, catalog, target) {
184396
185222
  if (component) {
184397
185223
  const propsPath = appendPath(elementPath, "props");
184398
185224
  const itemChainPaths = new Set(isPlainObject(rawElement.props) ? itemActionChains(type, rawElement.props, propsPath).map(({ path }) => path) : []);
184399
- const actionChainPath = (path) => (PROP_ACTION_CHAINS[String(type)] ?? []).some((prop) => path === `${propsPath}.${prop}`) || itemChainPaths.has(path);
185225
+ const inputValue = type === "Input" && isPlainObject(rawElement.props) ? rawElement.props.value : undefined;
185226
+ const boundInputValue = isBindStateBinding(inputValue) || isBindItemBinding(inputValue);
185227
+ const actionChainPath = (path) => (PROP_ACTION_CHAINS[String(type)] ?? []).some((prop) => path === `${propsPath}.${prop}`) || itemChainPaths.has(path) || boundInputValue && path === `${propsPath}.value`;
185228
+ if (isBindStateBinding(inputValue)) {
185229
+ stateRefs.push({ path: `${propsPath}.value`, value: inputValue.$bindState, write: true });
185230
+ } else if (isBindItemBinding(inputValue)) {
185231
+ bindItemPaths.push({ elementId, path: `${propsPath}.value` });
185232
+ }
185233
+ if (type === "Input" && isPlainObject(rawElement.props) && typeof rawElement.props.id === "string") {
185234
+ inputIds.add(rawElement.props.id);
185235
+ }
184400
185236
  const propsResult = validateSchema(Object.hasOwn(rawElement, "props") ? rawElement.props : {}, component.props, propsPath, false, actionChainPath);
184401
185237
  issues.push(...propsResult.issues);
184402
185238
  stateRefs.push(...propsResult.stateRefs);
@@ -184651,6 +185487,64 @@ function validatePage(definition, catalog, target) {
184651
185487
  }
184652
185488
  }
184653
185489
  }
185490
+ for (const { elementId, path } of bindItemPaths) {
185491
+ let parentId = parentByChild.get(elementId);
185492
+ const seen = new Set;
185493
+ let repeatPath;
185494
+ while (parentId && !seen.has(parentId)) {
185495
+ seen.add(parentId);
185496
+ const parent = elements[parentId];
185497
+ if (isPlainObject(parent) && isPlainObject(parent.repeat)) {
185498
+ repeatPath = parent.repeat.statePath;
185499
+ break;
185500
+ }
185501
+ parentId = parentByChild.get(parentId);
185502
+ }
185503
+ if (typeof repeatPath !== "string") {
185504
+ issues.push(issue(path, "$bindItem is only allowed inside a repeated element"));
185505
+ } else {
185506
+ stateRefs.push({ path, value: repeatPath, write: true });
185507
+ }
185508
+ }
185509
+ for (const [elementId, rawElement] of elementEntries) {
185510
+ if (!isPlainObject(rawElement))
185511
+ continue;
185512
+ const elementPath = `${elementsPath}.${elementId}`;
185513
+ const parent = elements[parentByChild.get(elementId) ?? ""];
185514
+ const parentType = isPlainObject(parent) ? parent.type : undefined;
185515
+ if (typeof rawElement.type === "string" && SVG_SHAPES.has(rawElement.type)) {
185516
+ if (parentType !== "Svg") {
185517
+ issues.push(issue(appendPath(elementPath, "type"), `${rawElement.type} must be a child of an Svg`));
185518
+ }
185519
+ }
185520
+ if (rawElement.type === "Svg" && parentType !== "Svg") {
185521
+ const props = isPlainObject(rawElement.props) ? rawElement.props : {};
185522
+ for (const key of ["width", "height"]) {
185523
+ if (props[key] === undefined) {
185524
+ issues.push(issue(`${elementPath}.props.${key}`, "is required on an outer Svg"));
185525
+ }
185526
+ }
185527
+ }
185528
+ if (rawElement.type === "Svg" && Array.isArray(rawElement.children)) {
185529
+ for (const [index, child] of rawElement.children.entries()) {
185530
+ const childType = isPlainObject(elements[String(child)]) ? elements[String(child)].type : undefined;
185531
+ if (typeof childType === "string" && childType !== "Svg" && !SVG_SHAPES.has(childType)) {
185532
+ issues.push(issue(`${elementPath}.children.${index}`, `Svg children must be Rect, Line, Path, Circle, SvgText or Svg (got ${childType})`));
185533
+ }
185534
+ }
185535
+ }
185536
+ if (rawElement.type === "Path" && isPlainObject(rawElement.props) && typeof rawElement.props.d === "string" && !SVG_PATH_DATA.test(rawElement.props.d)) {
185537
+ issues.push(issue(`${elementPath}.props.d`, "must hold SVG path commands and numbers only"));
185538
+ }
185539
+ }
185540
+ visitPageActionSteps(page, pagePath, (step, path) => {
185541
+ if (step.action !== "ui.focus" || !isPlainObject(step.params))
185542
+ return;
185543
+ const id = step.params.id;
185544
+ if (typeof id === "string" && !inputIds.has(id)) {
185545
+ issues.push(issue(`${path}.params.id`, `no Input with id "${id}" on this page`));
185546
+ }
185547
+ });
184654
185548
  const visited = new Set;
184655
185549
  const visiting = new Set;
184656
185550
  const visit = (elementId) => {
@@ -184709,21 +185603,23 @@ function validatePage(definition, catalog, target) {
184709
185603
  const propMatch = /^\/props\/([^/]+)(?:\/.*)?$/.exec(ref.value);
184710
185604
  const userConfigRef = ref.value === "/user" || ref.value.startsWith("/user/");
184711
185605
  let stateIssue;
184712
- if (options?.elementMode && userConfigRef) {
185606
+ if (options?.elementMode && ref.write) {
185607
+ stateIssue = issue(ref.path, `${options.elementMode} elements cannot write state; bind page-local state at page level`);
185608
+ } else if (options?.elementMode && userConfigRef) {
184713
185609
  stateIssue = issue(ref.path, `${options.elementMode} elements cannot read /user state; read userConfig via a prop or bind it at page level`);
184714
185610
  } else if (options?.elementMode && propMatch) {
184715
185611
  stateIssue = Object.hasOwn(options.elementProps ?? {}, propMatch[1]) ? null : issue(ref.path, `state reference targets unknown element prop "${propMatch[1]}"`);
184716
185612
  } else if (options?.elementMode === "pure") {
184717
185613
  stateIssue = issue(ref.path, `pure element state reference "${ref.value}" escapes /props/<declared>; use a declared prop or switch the element to bound mode`);
184718
185614
  } else {
184719
- stateIssue = validateStateRef(ref, definition, formIds, uiIds, pageParams);
185615
+ stateIssue = validateStateRef(ref, definition, formIds, uiIds, pageParams, pageState);
184720
185616
  }
184721
185617
  if (stateIssue)
184722
185618
  issues.push(stateIssue);
184723
185619
  }
184724
185620
  return dedupeIssues(issues);
184725
185621
  }
184726
- var ELEMENT_KEYS, UI_STATE_COMPONENTS, SCHEMA_FORM_ID, PLAIN_TOKEN_ID_COMPONENTS, SESSION_KEY, RESERVED_UI_IDS, PROP_ACTION_CHAINS, ITEM_ACTION_CHAINS, ROUTE_PANEL_TYPES, APPROVAL_CHAIN_KEYS, DATA_FIELD_PROPS, CONDITION_KEYS, COMPARISON_KEYS, POPOVER_MAX_FIELDS = 12, LINK_FIELD_PROPS, MAX_ELEMENT_REF_DEPTH = 5, MAX_ELEMENT_REF_EXPANSION_WORK = 100, MAX_ELEMENT_REF_EXPANSION_ISSUES = 100, CHART_MAX_SERIES = 8, CURRENCY_CODE, FILE_ROW_FIELDS, PAGE_FRAME_ID;
185622
+ var ELEMENT_KEYS, UI_STATE_COMPONENTS, SCHEMA_FORM_ID, PLAIN_TOKEN_ID_COMPONENTS, SESSION_KEY, RESERVED_UI_IDS, INPUT_KEYS, PROP_ACTION_CHAINS, ITEM_ACTION_CHAINS, ROUTE_PANEL_TYPES, APPROVAL_CHAIN_KEYS, DATA_FIELD_PROPS, CONDITION_KEYS, EXPRESSION_ARITY, SVG_SHAPES, SVG_PATH_DATA, COMPARISON_KEYS, POPOVER_MAX_FIELDS = 12, LINK_FIELD_PROPS, MAX_ELEMENT_REF_DEPTH = 5, MAX_ELEMENT_REF_EXPANSION_WORK = 100, MAX_ELEMENT_REF_EXPANSION_ISSUES = 100, CHART_MAX_SERIES = 8, CURRENCY_CODE, FILE_ROW_FIELDS, PAGE_FRAME_ID;
184727
185623
  var init_page_validator = __esm(() => {
184728
185624
  init_definition();
184729
185625
  ELEMENT_KEYS = new Set([
@@ -184752,7 +185648,21 @@ var init_page_validator = __esm(() => {
184752
185648
  PLAIN_TOKEN_ID_COMPONENTS = new Set(["SchemaForm", "SessionThread"]);
184753
185649
  SESSION_KEY = /^[A-Za-z0-9_-]{1,128}$/;
184754
185650
  RESERVED_UI_IDS = new Set(["__proto__", "constructor", "prototype"]);
185651
+ INPUT_KEYS = [
185652
+ "Backspace",
185653
+ "Delete",
185654
+ "Enter",
185655
+ "Escape",
185656
+ "Tab",
185657
+ "ArrowLeft",
185658
+ "ArrowRight",
185659
+ "ArrowUp",
185660
+ "ArrowDown",
185661
+ "Home",
185662
+ "End"
185663
+ ];
184755
185664
  PROP_ACTION_CHAINS = {
185665
+ Input: ["onInput", "onPaste", ...INPUT_KEYS.map((key) => `onKeyDown:${key}`)],
184756
185666
  Table: ["onRowClick", "onRetry"],
184757
185667
  Form: ["onSubmit"],
184758
185668
  Kanban: ["onMove", "onCardClick"],
@@ -184782,6 +185692,19 @@ var init_page_validator = __esm(() => {
184782
185692
  Chart: ["x"]
184783
185693
  };
184784
185694
  CONDITION_KEYS = new Set(["eq", "neq", "gt", "gte", "lt", "lte", "not"]);
185695
+ EXPRESSION_ARITY = {
185696
+ $add: [1, Infinity],
185697
+ $sub: [2, 2],
185698
+ $mul: [1, Infinity],
185699
+ $div: [2, 2],
185700
+ $min: [1, Infinity],
185701
+ $max: [1, Infinity],
185702
+ $split: [1, 3],
185703
+ $join: [1, 2],
185704
+ $length: [1, 1]
185705
+ };
185706
+ SVG_SHAPES = new Set(["Rect", "Line", "Path", "Circle", "SvgText"]);
185707
+ SVG_PATH_DATA = /^[MmLlHhVvCcSsQqTtAaZz0-9eE.,\s+-]*$/;
184785
185708
  COMPARISON_KEYS = ["eq", "neq", "gt", "gte", "lt", "lte"];
184786
185709
  LINK_FIELD_PROPS = {
184787
185710
  Table: "columns",
@@ -185145,11 +186068,18 @@ async function parseAppDefinition(input, elementContext = {}) {
185145
186068
  });
185146
186069
  continue;
185147
186070
  }
185148
- if (foreignScriptForWriter(elementContext, script) && grandfatheredScriptRefs.get(`actions.${name}`) !== scriptRefKey(action.scriptId, action.args, undefined)) {
186071
+ const grandfatheredRef = grandfatheredScriptRefs.get(`actions.${name}`) === scriptRefKey(action.scriptId, action.args, undefined);
186072
+ const owner = getSavedScriptOwnerAgentId(script);
186073
+ if (foreignScriptForWriter(elementContext, script) && !grandfatheredRef) {
185149
186074
  issues.push({
185150
186075
  path: `actions.${name}.scriptId`,
185151
186076
  message: `script "${action.scriptId}" is agent-scoped to another agent — reference a script you own or a global script`
185152
186077
  });
186078
+ } else if (script.scope !== "agent" && owner !== null && (elementContext.writerIsUser === true || typeof elementContext.writerAgentId === "string") && elementContext.writerAgentId !== owner && !grandfatheredRef) {
186079
+ issues.push({
186080
+ path: `actions.${name}.scriptId`,
186081
+ message: `script "${action.scriptId}" runs with agent "${owner}"'s credentials — only that agent or the operator may wire or alter this action`
186082
+ });
185153
186083
  }
185154
186084
  }
185155
186085
  if (issues.length > 0)
@@ -185233,7 +186163,7 @@ function applyMergePatch(target, patch, path) {
185233
186163
  if (!isMergePatchObject(patch))
185234
186164
  return patch;
185235
186165
  const result = isMergePatchObject(target) ? { ...target } : {};
185236
- const entriesAreAtomic = path.length === 1 && path[0] === "actions" || path.length === 1 && path[0] === "elements" || path.length === 1 && path[0] === "userConfig" || path.length === 3 && path[0] === "models" && path[2] === "columns" || path.length === 3 && path[0] === "models" && path[2] === "sources" || path.length === 3 && path[0] === "elements" && path[2] === "elements" || path.length === 3 && path[0] === "pages" && (path[2] === "elements" || path[2] === "params");
186166
+ const entriesAreAtomic = path.length === 1 && path[0] === "actions" || path.length === 1 && path[0] === "elements" || path.length === 1 && path[0] === "userConfig" || path.length === 3 && path[0] === "models" && path[2] === "columns" || path.length === 3 && path[0] === "models" && path[2] === "sources" || path.length === 3 && path[0] === "elements" && path[2] === "elements" || path.length === 3 && path[0] === "pages" && (path[2] === "elements" || path[2] === "params" || path[2] === "state");
185237
186167
  for (const [key, value] of Object.entries(patch)) {
185238
186168
  if (value === null) {
185239
186169
  delete result[key];
@@ -185467,7 +186397,8 @@ var init_definition = __esm(() => {
185467
186397
  icon: string2().optional(),
185468
186398
  description: string2().max(280).optional(),
185469
186399
  headerActions: string2().optional(),
185470
- nav: boolean().optional()
186400
+ nav: boolean().optional(),
186401
+ state: record2(AppNameSchema, unknown()).optional()
185471
186402
  }).strict();
185472
186403
  ElementPropDefSchema = object2({
185473
186404
  kind: ScalarColumnKindSchema,
@@ -186514,8 +187445,13 @@ export interface PrimitiveReindexReport {
186514
187445
  truncated: boolean;
186515
187446
  /** Which limit cut this call short; null when the pass finished. */
186516
187447
  cutBy: "files" | "reads" | "time" | "bytes" | null;
187448
+ /** True when nothing was written: \`adopted\` and \`restored\` list what a real run would change. */
187449
+ dryRun: boolean;
186517
187450
  }
186518
187451
 
187452
+ /** \`prefix\`: only paths that start with it (as in \`list\`); without it every id-less file on the drive gets an id. \`dryRun\`: report, write nothing. */
187453
+ export type PrimitiveReindexArgs = { kind?: PrimitiveObjectKind; prefix?: string; dryRun?: boolean };
187454
+
186519
187455
  /**
186520
187456
  * Primitive objects: agent-fs files on your default drive with a stable id.
186521
187457
  * Calls run as your own agent-fs identity. Each method throws on a refusal.
@@ -186526,7 +187462,7 @@ export interface ObjectsNamespace {
186526
187462
  get(args: { id?: string; path?: string; includeContent?: boolean }): Promise<{ message: string; object: PrimitiveObject; missing: boolean; content?: unknown }>;
186527
187463
  list(args?: { kind?: PrimitiveObjectKind; prefix?: string; limit?: number; offset?: number }): Promise<{ message: string; objects: PrimitiveObject[]; total: number }>;
186528
187464
  /** Rebuild the index from the drive. Ids survive; rows whose file is gone are reported, not deleted. */
186529
- reindex(args?: { kind?: PrimitiveObjectKind }): Promise<{ message: string } & PrimitiveReindexReport>;
187465
+ reindex(args?: PrimitiveReindexArgs): Promise<{ message: string } & PrimitiveReindexReport>;
186530
187466
  }
186531
187467
 
186532
187468
  /** A spreadsheet cell value. A string starting with \`=\` is a formula; null clears the cell. */
@@ -186557,6 +187493,36 @@ export interface SheetTabSummary {
186557
187493
  freezeRows: number;
186558
187494
  }
186559
187495
 
187496
+ export interface SheetImportXlsxArgs {
187497
+ /** An \`.xlsx\` on the drive. */
187498
+ sourcePath: string;
187499
+ /** The new sheet; must end in \`.sheet.json\`. */
187500
+ path: string;
187501
+ title?: string;
187502
+ }
187503
+
187504
+ export interface SheetImportXlsxResult {
187505
+ message: string;
187506
+ object: PrimitiveObject;
187507
+ link: string | null;
187508
+ /** What the file had that a sheet cannot hold. */
187509
+ dropped: string[];
187510
+ }
187511
+
187512
+ export interface SheetExportXlsxArgs extends SheetRef {
187513
+ targetPath: string;
187514
+ /** Replace \`targetPath\` when it exists. */
187515
+ overwrite?: boolean;
187516
+ }
187517
+
187518
+ export interface SheetExportXlsxResult {
187519
+ message: string;
187520
+ path: string;
187521
+ link: string | null;
187522
+ /** What the sheet had that xlsx cannot carry. */
187523
+ dropped: string[];
187524
+ }
187525
+
186560
187526
  export interface SheetResult {
186561
187527
  message: string;
186562
187528
  /** agent-fs version after the call. */
@@ -186578,6 +187544,10 @@ export interface SheetsNamespace {
186578
187544
  appendRows(args: SheetRef & { tab: string; rows: SheetCellInput[][] }): Promise<SheetResult & { range: string }>;
186579
187545
  clearRange(args: SheetRangeArgs): Promise<SheetResult & { range: string; cleared: number }>;
186580
187546
  addTab(args: SheetRef & { name: string; after?: string }): Promise<SheetResult & { tabs: string[] }>;
187547
+ /** Create-only. Reads an \`.xlsx\` on the drive. \`dropped\` names what a sheet cannot hold (styles, charts, comments, frozen panes, ...). Limits: 5 MiB, 20 tabs, 50,000 cells. */
187548
+ importXlsx(args: SheetImportXlsxArgs): Promise<SheetImportXlsxResult>;
187549
+ /** Create-only unless \`overwrite\`. \`targetPath\` must end in \`.xlsx\`. \`dropped\` names what xlsx cannot carry (frozen panes, spilled array cells). */
187550
+ exportXlsx(args: SheetExportXlsxArgs): Promise<SheetExportXlsxResult>;
186581
187551
  }
186582
187552
 
186583
187553
  /** Palette names (Excalidraw's open-color) or a #rrggbb background. */
@@ -186707,7 +187677,7 @@ export interface SwarmSdk {
186707
187677
  objects_create(args: { kind: PrimitiveObjectKind; path: string; title?: string }): Promise<unknown>;
186708
187678
  objects_get(args: { id?: string; path?: string; includeContent?: boolean }): Promise<unknown>;
186709
187679
  objects_list(args?: { kind?: PrimitiveObjectKind; prefix?: string; limit?: number; offset?: number }): Promise<unknown>;
186710
- objects_reindex(args?: { kind?: PrimitiveObjectKind }): Promise<unknown>;
187680
+ objects_reindex(args?: PrimitiveReindexArgs): Promise<unknown>;
186711
187681
  // --- sheets (prefer ctx.sheets.*, which unwraps and throws) ---
186712
187682
  sheets_create(args: SheetCreateArgs): Promise<unknown>;
186713
187683
  sheets_get(args: SheetRef): Promise<unknown>;
@@ -186717,6 +187687,8 @@ export interface SwarmSdk {
186717
187687
  sheets_appendRows(args: SheetRef & { tab: string; rows: SheetCellInput[][] }): Promise<unknown>;
186718
187688
  sheets_clearRange(args: SheetRangeArgs): Promise<unknown>;
186719
187689
  sheets_addTab(args: SheetRef & { name: string; after?: string }): Promise<unknown>;
187690
+ sheets_importXlsx(args: SheetImportXlsxArgs): Promise<unknown>;
187691
+ sheets_exportXlsx(args: SheetExportXlsxArgs): Promise<unknown>;
186720
187692
  // --- boards (prefer ctx.boards.*, which unwraps and throws) ---
186721
187693
  boards_create(args: BoardCreateArgs): Promise<unknown>;
186722
187694
  boards_get(args: BoardRef & { detail?: "summary" | "full" }): Promise<unknown>;