@desplega.ai/agent-swarm 2.7.9 → 2.7.10

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 (212) hide show
  1. package/dist/{acp-adapter-dn4gdsgr.js → acp-adapter-srfhs1s9.js} +5 -5
  2. package/dist/{actions-g563mbn2.js → actions-b8aqhrsg.js} +19 -18
  3. package/dist/{amp-adapter-q61w05eb.js → amp-adapter-4c165vgn.js} +1 -1
  4. package/dist/app-m9khefrh.js +20 -0
  5. package/dist/{assistant-p477rjwj.js → assistant-rh4v3ntz.js} +21 -20
  6. package/dist/{boot-args-schema-h4qj462e.js → boot-args-schema-hwkc8bzv.js} +1 -1
  7. package/dist/{boot-reembed-n1ehfbsw.js → boot-reembed-5y6yw9sj.js} +1 -1
  8. package/dist/{boot-reembed-qw4mc0pt.js → boot-reembed-fdyk55h4.js} +1 -1
  9. package/dist/{boot-scrub-sweep-9w9jp4sm.js → boot-scrub-sweep-r5r8kqsn.js} +3 -3
  10. package/dist/{boot-seeds-qdaf3sdy.js → boot-seeds-8f9zt5cm.js} +5 -5
  11. package/dist/{claude-adapter-348p5hx9.js → claude-adapter-s5df247c.js} +5 -5
  12. package/dist/{claude-managed-setup-7787fxtp.js → claude-managed-setup-9gsmwzyx.js} +1 -1
  13. package/dist/{claude-sdk-session-hbszbt8a.js → claude-sdk-session-dq1j4nz9.js} +5 -5
  14. package/dist/{cli-btf6fw39.js → cli-0m7rtm11.js} +1 -1
  15. package/dist/{cli-cseh6f8w.js → cli-16phend6.js} +1 -1
  16. package/dist/{cli-ms5m5r1y.js → cli-18qt3few.js} +1 -1
  17. package/dist/{cli-sgs5k6yd.js → cli-2tsfpc70.js} +1 -1
  18. package/dist/{cli-rwymrnaz.js → cli-36wdfzgn.js} +8 -8
  19. package/dist/{cli-qzt90yze.js → cli-38yww4e9.js} +8 -8
  20. package/dist/{cli-2a8py3sx.js → cli-3xddv0rk.js} +4 -4
  21. package/dist/{cli-p0m0p34z.js → cli-4vwxp550.js} +2 -2
  22. package/dist/{cli-bc779n4v.js → cli-55bkx8hh.js} +1 -1
  23. package/dist/{cli-21159vea.js → cli-5wfz00be.js} +2 -2
  24. package/dist/{cli-9aezs55w.js → cli-5xcb8gxq.js} +4 -4
  25. package/dist/{cli-12xyjhws.js → cli-6m6b4bep.js} +2 -2
  26. package/dist/{cli-fayav105.js → cli-7wz05bx3.js} +292 -83
  27. package/dist/{cli-y8nbefpb.js → cli-8ewkreqd.js} +9 -5
  28. package/dist/{cli-0whpms1z.js → cli-an1knn2k.js} +4 -4
  29. package/dist/{cli-qmd3mse0.js → cli-bxz823sz.js} +1 -1
  30. package/dist/{cli-a0657jmf.js → cli-bzvs88tv.js} +1 -1
  31. package/dist/{cli-agyaeef4.js → cli-cr14kftt.js} +2 -2
  32. package/dist/{cli-715t1gx6.js → cli-eb2azq8n.js} +3 -3
  33. package/dist/{cli-530hkwdy.js → cli-ed6yqpf1.js} +2 -2
  34. package/dist/{cli-k70e3x9e.js → cli-eqk5p56g.js} +3 -3
  35. package/dist/{cli-4t0fmf3z.js → cli-g1px1g2e.js} +1 -1
  36. package/dist/{cli-09kmfkmq.js → cli-h49ejvmc.js} +1 -1
  37. package/dist/{cli-cvs2r2vq.js → cli-hfkwwy1h.js} +39 -5
  38. package/dist/{cli-neyag5p6.js → cli-j7d73g1y.js} +371 -116
  39. package/dist/{cli-p17970qv.js → cli-jg24scat.js} +2 -2
  40. package/dist/{cli-varqt4d1.js → cli-kx4c8j05.js} +16 -13
  41. package/dist/{cli-jfx48xrj.js → cli-mp9aa8g5.js} +1 -1
  42. package/dist/{cli-605nn699.js → cli-mr97t7cc.js} +644 -225
  43. package/dist/{cli-v3cf1ts9.js → cli-n07eecjs.js} +3 -3
  44. package/dist/{cli-y5rbvxhc.js → cli-n515ex5z.js} +14 -14
  45. package/dist/{cli-3tqcamp6.js → cli-n9abj89w.js} +13 -12
  46. package/dist/{cli-ypff1qwp.js → cli-n9ftpys4.js} +7 -7
  47. package/dist/{cli-xk879m3k.js → cli-nj3x45rw.js} +27 -27
  48. package/dist/{cli-9r5gtwjr.js → cli-pyrxt9gw.js} +196 -1
  49. package/dist/{cli-mnrkgg60.js → cli-q581b386.js} +2 -2
  50. package/dist/{cli-hwprv9e4.js → cli-rjyghzg4.js} +2 -2
  51. package/dist/{cli-650zv9q9.js → cli-rt0ag4x1.js} +3 -3
  52. package/dist/{cli-vxh6acp7.js → cli-td33w98c.js} +2 -2
  53. package/dist/{cli-tqq0hspb.js → cli-tmft5dz2.js} +1 -1
  54. package/dist/{cli-q26b9wre.js → cli-tph5wt3y.js} +4 -4
  55. package/dist/{cli-qkdmz8c8.js → cli-ttbqe3q4.js} +1 -1
  56. package/dist/{cli-zgv8gxgs.js → cli-v2fwbnsk.js} +6 -6
  57. package/dist/{cli-b932gexn.js → cli-w3bk0dgv.js} +1 -1
  58. package/dist/{cli-serm8zrx.js → cli-x9exydey.js} +1 -1
  59. package/dist/{cli-hae9j8sv.js → cli-xbtq4d6s.js} +3 -3
  60. package/dist/{cli-587857ys.js → cli-xd5ebp64.js} +3 -3
  61. package/dist/{cli-ejkvvqbe.js → cli-xncjscpm.js} +10 -10
  62. package/dist/{cli-gce09r66.js → cli-xvymtmv4.js} +2 -2
  63. package/dist/{cli-btc9cb4c.js → cli-yz7v0sh4.js} +2 -2
  64. package/dist/{cli-sya22y84.js → cli-z9cs5m0w.js} +3 -3
  65. package/dist/{cli-2ccpqyyf.js → cli-zjphdj1a.js} +71 -10
  66. package/dist/cli.js +15 -15
  67. package/dist/{codex-adapter-ysq6bzha.js → codex-adapter-yr60sme6.js} +3 -3
  68. package/dist/{codex-session-runner-qakzfx93.js → codex-session-runner-pch8x584.js} +3 -3
  69. package/dist/{commands-rs7hkv9r.js → commands-phjfbkv0.js} +3 -3
  70. package/dist/{controller-r5x9bg6e.js → controller-jkx994pz.js} +2 -2
  71. package/dist/{controllers-connect-498hrxvk.js → controllers-connect-c4448kwa.js} +20 -19
  72. package/dist/{cursor-adapter-d46qszer.js → cursor-adapter-ndebqnm8.js} +1 -1
  73. package/dist/{db-pm96nhdb.js → db-ef32tbfc.js} +4 -2
  74. package/dist/{db-s13dqhr6.js → db-ez6egt6v.js} +3 -3
  75. package/dist/{dispatcher-j3h81t7m.js → dispatcher-g3tt9hs9.js} +18 -17
  76. package/dist/{dsh-adapter-rw0d5rc4.js → dsh-adapter-tcyn3099.js} +1 -1
  77. package/dist/{easter-egg-3d-qtgfxgze.js → easter-egg-3d-e36hk5td.js} +1 -1
  78. package/dist/{embedding-space-xh8p4q4x.js → embedding-space-4kyh5qqj.js} +6 -6
  79. package/dist/{embeddings-wp745m91.js → embeddings-6a8v4a6t.js} +1 -1
  80. package/dist/{execute-2fzb9z74.js → execute-3cbg0twf.js} +1 -1
  81. package/dist/{external-channel-ys21h3sy.js → external-channel-se646snz.js} +2 -2
  82. package/dist/{fx-adapter-vz0b9z3g.js → fx-adapter-yw795hqq.js} +6 -6
  83. package/dist/{google-generative-ai-ytpgncx9.js → google-generative-ai-h7s3e9kk.js} +1 -1
  84. package/dist/{google-vertex-tqhze5j7.js → google-vertex-fhxaafzw.js} +1 -1
  85. package/dist/{grok-adapter-spea7zkj.js → grok-adapter-ttmcss2j.js} +6 -6
  86. package/dist/handlers-17wha3ze.js +33 -0
  87. package/dist/{heartbeat-8phn1kdq.js → heartbeat-gwewgdms.js} +21 -20
  88. package/dist/{hook-amcj4s10.js → hook-g3nhexsy.js} +5 -5
  89. package/dist/{hook-bc6n49qn.js → hook-hq93y5ej.js} +4 -4
  90. package/dist/{http-7374brv5.js → http-5a9p4h6y.js} +210 -69
  91. package/dist/{index-pxn30mse.js → index-0eny15vj.js} +8 -8
  92. package/dist/{index-5a9jtqde.js → index-0rvk3vd4.js} +46 -46
  93. package/dist/{index-fvzke5kx.js → index-1qw6f2dc.js} +10 -10
  94. package/dist/{index-p4hjwbvw.js → index-3c5pxbge.js} +1 -1
  95. package/dist/{index-q5cmtbz5.js → index-6haqt3v5.js} +12296 -11042
  96. package/dist/index-8arwq8mw.js +34 -0
  97. package/dist/{index-h7f61sy9.js → index-e5pfbsys.js} +3 -3
  98. package/dist/{index-c9y31ytf.js → index-hgn3c961.js} +12 -11
  99. package/dist/{index-hsad2t3r.js → index-m5gx1xd6.js} +38 -38
  100. package/dist/{index-5fx3b3kw.js → index-rvccek1w.js} +9 -9
  101. package/dist/{index-w4m9z29z.js → index-s72rqgsx.js} +1 -1
  102. package/dist/index-tpw054az.js +38 -0
  103. package/dist/{index-514d9pf6.js → index-w7em4ktq.js} +8 -8
  104. package/dist/index-waq75j2j.js +31 -0
  105. package/dist/{keepalive-wy29kbrg.js → keepalive-1j4n4dmk.js} +3 -3
  106. package/dist/lead-re73kdgc.js +72 -0
  107. package/dist/{maintenance-h2ds9w6c.js → maintenance-dmghacy5.js} +1 -1
  108. package/dist/{oauth-refresh-sweep-q7mtbyp3.js → oauth-refresh-sweep-yy06c03c.js} +2 -2
  109. package/dist/{onboard-vw8r2fdw.js → onboard-52f9t5dm.js} +3 -3
  110. package/dist/{opencode-adapter-mtb0953j.js → opencode-adapter-krnh9jkn.js} +4 -4
  111. package/dist/{otel-impl-j42czw3r.js → otel-impl-xjqz6wjj.js} +1 -1
  112. package/dist/{pi-mono-adapter-zk8pg9jr.js → pi-mono-adapter-dbxyp0qv.js} +6 -6
  113. package/dist/{pricing-refresh-x7nhv23d.js → pricing-refresh-ctdr74pd.js} +3 -3
  114. package/dist/{rbac-roles-bzvee6cf.js → rbac-roles-ehv8s10n.js} +3 -3
  115. package/dist/{rbac-roles-9044425x.js → rbac-roles-q0gr8eyj.js} +2 -2
  116. package/dist/{render-v2-t7bn4skz.js → render-v2-5b6chvcq.js} +9 -4
  117. package/dist/{resume-x94gemep.js → resume-5a5d2845.js} +6 -6
  118. package/dist/{runtime-breq6fmv.js → runtime-khxszyfp.js} +1 -1
  119. package/dist/{session-access-q7dmqjvt.js → session-access-gj0bjhqg.js} +4 -4
  120. package/dist/{session-source-backfill-440ysamr.js → session-source-backfill-2sy0krfk.js} +2 -2
  121. package/dist/{setup-07n4727s.js → setup-7ssfakk1.js} +1 -1
  122. package/dist/{virtual-modules-z5h6mcyf.js → virtual-modules-pjj0knwf.js} +3 -3
  123. package/dist/{work-objects-pnq5y534.js → work-objects-bf3syvhq.js} +22 -21
  124. package/dist/{worker-follow-up-7z1gfkr8.js → worker-follow-up-38xevga6.js} +18 -17
  125. package/dist/worker-r8mz7a65.js +72 -0
  126. package/openapi.json +1 -1
  127. package/package.json +3 -3
  128. package/src/apps/catalog.generated.json +55 -0
  129. package/src/apps/page-validator.ts +19 -0
  130. package/src/assets/key.ts +77 -4
  131. package/src/be/db/session-labels.ts +57 -0
  132. package/src/be/db/session-tree.ts +51 -7
  133. package/src/be/db/slack-trees.ts +146 -0
  134. package/src/be/db/tasks/read.ts +102 -7
  135. package/src/be/db-client.ts +8 -2
  136. package/src/be/db.ts +95 -84
  137. package/src/be/event-loop-lag.ts +146 -0
  138. package/src/be/mcp-overflow-sweep.ts +2 -1
  139. package/src/be/memory/providers/sqlite-store.ts +39 -8
  140. package/src/be/migrations/278_slack_render_v2_reconcile.sql +108 -0
  141. package/src/be/swarm-config-guard.ts +2 -0
  142. package/src/commands/context-preamble.ts +258 -0
  143. package/src/commands/onboard/agent-fs-version.ts +1 -1
  144. package/src/extensions/catalog.generated.json +3 -3
  145. package/src/heartbeat/heartbeat.ts +5 -4
  146. package/src/http/core.ts +9 -3
  147. package/src/http/index.ts +10 -6
  148. package/src/http/memory.ts +9 -4
  149. package/src/http/sessions.ts +16 -3
  150. package/src/http/utils.ts +18 -0
  151. package/src/http/webhooks.ts +48 -0
  152. package/src/integrations/chat-sdk/commands.ts +167 -31
  153. package/src/integrations/chat-sdk/inbound.ts +10 -8
  154. package/src/integrations/chat-sdk/message-text.ts +117 -0
  155. package/src/providers/amp-adapter.ts +1 -1
  156. package/src/providers/cursor-adapter.ts +1 -1
  157. package/src/providers/dsh-adapter.ts +1 -1
  158. package/src/scheduler/scheduler.ts +4 -1
  159. package/src/scripts-runtime/executors/quickjs-runner.ts +2 -0
  160. package/src/scripts-runtime/executors/quickjs-structured-clone.ts +180 -0
  161. package/src/scripts-runtime/quickjs-compat.ts +0 -1
  162. package/src/slack/app.ts +332 -10
  163. package/src/slack/handlers.ts +9 -2
  164. package/src/slack/index.ts +7 -1
  165. package/src/slack/lifecycle-lock.ts +29 -0
  166. package/src/slack/render-v2.ts +424 -212
  167. package/src/slack/socket-fence.ts +64 -0
  168. package/src/slack/watcher.ts +42 -8
  169. package/src/tests/apps-schema-form.test.ts +151 -0
  170. package/src/tests/chat-sdk-commands.test.ts +359 -2
  171. package/src/tests/chat-sdk-inbound.test.ts +20 -0
  172. package/src/tests/chat-sdk-slack.test.ts +189 -1
  173. package/src/tests/db-client-busy-retry.test.ts +69 -18
  174. package/src/tests/db-client.test.ts +26 -1
  175. package/src/tests/db-task-read-contract.test.ts +2 -0
  176. package/src/tests/db-task-write-contract.test.ts +1 -0
  177. package/src/tests/dsh-adapter.test.ts +1 -1
  178. package/src/tests/event-loop-lag.test.ts +184 -0
  179. package/src/tests/extensions-example-comms-adherence-gate.test.ts +115 -0
  180. package/src/tests/github-webhook-early-ack.test.ts +144 -0
  181. package/src/tests/http-api-integration.test.ts +2 -0
  182. package/src/tests/http-log-scrubbing.test.ts +68 -2
  183. package/src/tests/kv-storage.test.ts +92 -1
  184. package/src/tests/memory-key-paths.test.ts +57 -0
  185. package/src/tests/memory-retrieval-purge.test.ts +19 -0
  186. package/src/tests/quickjs-compat.test.ts +1 -1
  187. package/src/tests/runner-context-preamble.test.ts +552 -0
  188. package/src/tests/script-connections.test.ts +3 -0
  189. package/src/tests/script-executor-conformance.test.ts +188 -0
  190. package/src/tests/sessions-tree.test.ts +133 -2
  191. package/src/tests/slack-app-icon.test.ts +4 -0
  192. package/src/tests/slack-dm-implicit-mention.test.ts +236 -0
  193. package/src/tests/slack-file-tools-attachments.test.ts +1 -0
  194. package/src/tests/slack-read-boundaries.test.ts +4 -3
  195. package/src/tests/slack-render-v2-query-plans.test.ts +262 -3
  196. package/src/tests/slack-render-v2-reconcile.test.ts +201 -0
  197. package/src/tests/slack-socket-watchdog.test.ts +748 -0
  198. package/src/tests/vcs-identity-inheritance.test.ts +85 -0
  199. package/src/tools/utils.ts +16 -7
  200. package/templates/extensions/comms-adherence-gate/README.md +25 -0
  201. package/templates/extensions/comms-adherence-gate/hooks.ts +100 -11
  202. package/templates/extensions/comms-adherence-gate/manifest.json +1 -1
  203. package/templates/skills/apps/SKILL.md +7 -0
  204. package/templates/skills/apps/content.md +7 -0
  205. package/dist/app-a66ssc4k.js +0 -17
  206. package/dist/handlers-crckt5dq.js +0 -32
  207. package/dist/index-4x08sjtk.js +0 -30
  208. package/dist/index-8ybffts4.js +0 -37
  209. package/dist/index-nfy4kkg5.js +0 -33
  210. package/dist/lead-zdqxsvjn.js +0 -71
  211. package/dist/worker-y62rvvq3.js +0 -71
  212. package/dist/{cli-gxy8y1dt.js → cli-8bpgbr8k.js} +3 -3
@@ -4,12 +4,12 @@ import {
4
4
  exports_value,
5
5
  exports_compile,
6
6
  exports_dist3
7
- } from "./cli-rwymrnaz.js";
7
+ } from "./cli-36wdfzgn.js";
8
8
  import {
9
9
  Unsafe,
10
10
  exports_typebox,
11
11
  exports_build
12
- } from "./cli-b932gexn.js";
12
+ } from "./cli-w3bk0dgv.js";
13
13
  import {
14
14
  envApiKeyAuth,
15
15
  lazyOAuth,
@@ -78,7 +78,7 @@ import {
78
78
  streamSimple2,
79
79
  completeSimple,
80
80
  init_compat
81
- } from "./cli-p0m0p34z.js";
81
+ } from "./cli-4vwxp550.js";
82
82
  import {
83
83
  registerSessionResourceCleanup,
84
84
  cleanupSessionResources,
@@ -2,11 +2,12 @@ import {
2
2
  getAgentById2,
3
3
  getTaskById2,
4
4
  init_db4
5
- } from "./cli-neyag5p6.js";
5
+ } from "./cli-j7d73g1y.js";
6
6
  import {
7
7
  shouldBlockChannel2,
8
8
  init_external_channel
9
- } from "./cli-qmd3mse0.js";
9
+ } from "./cli-bxz823sz.js";
10
+ import"./cli-eddnyg3t.js";
10
11
  import {
11
12
  isAdmittedSlackDelivery,
12
13
  init_inbound_dispatch,
@@ -14,32 +15,32 @@ import {
14
15
  init_task_output,
15
16
  getTaskUrl,
16
17
  init_blocks
17
- } from "./cli-605nn699.js";
18
- import"./cli-eddnyg3t.js";
19
- import"./cli-sya22y84.js";
20
- import"./cli-fayav105.js";
21
- import"./cli-btc9cb4c.js";
22
- import"./cli-2a8py3sx.js";
23
- import"./cli-530hkwdy.js";
18
+ } from "./cli-mr97t7cc.js";
19
+ import"./cli-z9cs5m0w.js";
20
+ import"./cli-7wz05bx3.js";
21
+ import"./cli-yz7v0sh4.js";
22
+ import"./cli-3xddv0rk.js";
23
+ import"./cli-ed6yqpf1.js";
24
24
  import"./cli-3xj33nrx.js";
25
- import"./cli-587857ys.js";
26
- import"./cli-y8nbefpb.js";
25
+ import"./cli-n9ftpys4.js";
26
+ import"./cli-xd5ebp64.js";
27
+ import"./cli-8ewkreqd.js";
27
28
  import {
28
29
  isUserAllowed2,
29
30
  init_handlers
30
- } from "./cli-3tqcamp6.js";
31
+ } from "./cli-n9abj89w.js";
31
32
  import {
32
33
  wasEventSeen,
33
34
  init_event_dedup
34
- } from "./cli-zgv8gxgs.js";
35
- import"./cli-v3cf1ts9.js";
36
- import"./cli-a0657jmf.js";
37
- import"./cli-2ccpqyyf.js";
38
- import"./cli-cseh6f8w.js";
39
- import"./cli-ejkvvqbe.js";
40
- import"./cli-sgs5k6yd.js";
41
- import"./cli-btf6fw39.js";
42
- import"./cli-4t0fmf3z.js";
35
+ } from "./cli-v2fwbnsk.js";
36
+ import"./cli-n07eecjs.js";
37
+ import"./cli-bzvs88tv.js";
38
+ import"./cli-zjphdj1a.js";
39
+ import"./cli-16phend6.js";
40
+ import"./cli-xncjscpm.js";
41
+ import"./cli-2tsfpc70.js";
42
+ import"./cli-0m7rtm11.js";
43
+ import"./cli-g1px1g2e.js";
43
44
  import {
44
45
  isEnvFlagEnabled,
45
46
  init_env_flag
@@ -10,24 +10,25 @@ import {
10
10
  createRerouteDecisionTask2,
11
11
  createPoolStarvationDecisionTask2,
12
12
  init_worker_follow_up
13
- } from "./cli-fayav105.js";
14
- import"./cli-2a8py3sx.js";
15
- import"./cli-530hkwdy.js";
16
- import"./cli-a0657jmf.js";
17
- import"./cli-2ccpqyyf.js";
18
- import"./cli-cseh6f8w.js";
13
+ } from "./cli-7wz05bx3.js";
14
+ import"./cli-3xddv0rk.js";
15
+ import"./cli-ed6yqpf1.js";
16
+ import"./cli-bzvs88tv.js";
17
+ import"./cli-zjphdj1a.js";
18
+ import"./cli-16phend6.js";
19
19
  import"./cli-3xj33nrx.js";
20
- import"./cli-y8nbefpb.js";
21
- import"./cli-sya22y84.js";
22
- import"./cli-ejkvvqbe.js";
23
- import"./cli-605nn699.js";
24
- import"./cli-sgs5k6yd.js";
25
- import"./cli-qmd3mse0.js";
26
- import"./cli-btf6fw39.js";
27
- import"./cli-587857ys.js";
28
- import"./cli-btc9cb4c.js";
29
- import"./cli-4t0fmf3z.js";
30
- import"./cli-neyag5p6.js";
20
+ import"./cli-8ewkreqd.js";
21
+ import"./cli-n9ftpys4.js";
22
+ import"./cli-z9cs5m0w.js";
23
+ import"./cli-xncjscpm.js";
24
+ import"./cli-mr97t7cc.js";
25
+ import"./cli-2tsfpc70.js";
26
+ import"./cli-bxz823sz.js";
27
+ import"./cli-0m7rtm11.js";
28
+ import"./cli-xd5ebp64.js";
29
+ import"./cli-yz7v0sh4.js";
30
+ import"./cli-g1px1g2e.js";
31
+ import"./cli-j7d73g1y.js";
31
32
  import"./cli-eddnyg3t.js";
32
33
  init_worker_follow_up();
33
34
 
@@ -0,0 +1,72 @@
1
+ import"./cli-j7d73g1y.js";
2
+ import"./cli-yz7v0sh4.js";
3
+ import"./cli-3xddv0rk.js";
4
+ import"./cli-ed6yqpf1.js";
5
+ import"./cli-eddnyg3t.js";
6
+ import"./cli-bxz823sz.js";
7
+ import"./cli-mr97t7cc.js";
8
+ import"./cli-z9cs5m0w.js";
9
+ import {
10
+ getEnabledCapabilities,
11
+ init_server
12
+ } from "./cli-7wz05bx3.js";
13
+ import"./cli-3xj33nrx.js";
14
+ import"./cli-n9ftpys4.js";
15
+ import"./cli-xd5ebp64.js";
16
+ import"./cli-8ewkreqd.js";
17
+ import"./cli-jg24scat.js";
18
+ import"./cli-eqtfgfr6.js";
19
+ import {
20
+ runAgent
21
+ } from "./cli-nj3x45rw.js";
22
+ import"./cli-jrzkw01m.js";
23
+ import"./cli-77cd6gy8.js";
24
+ import"./cli-f2zenhja.js";
25
+ import"./cli-d6521kb5.js";
26
+ import"./cli-jrp1dt73.js";
27
+ import"./cli-jc1g9ndz.js";
28
+ import"./cli-td33w98c.js";
29
+ import"./cli-tmft5dz2.js";
30
+ import"./cli-w3bk0dgv.js";
31
+ import"./cli-rjyghzg4.js";
32
+ import"./cli-d82btycs.js";
33
+ import"./cli-0726awxw.js";
34
+ import"./cli-an1knn2k.js";
35
+ import"./cli-eb2azq8n.js";
36
+ import"./cli-4bd1rck6.js";
37
+ import"./cli-98rwmcyc.js";
38
+ import"./cli-t73cas91.js";
39
+ import"./cli-3xcwp3z8.js";
40
+ import"./cli-m5akxq8q.js";
41
+ import"./cli-kr5tjjtz.js";
42
+ import"./cli-eqk5p56g.js";
43
+ import"./cli-5xcb8gxq.js";
44
+ import"./cli-ybjdc978.js";
45
+ import"./cli-q581b386.js";
46
+ import"./cli-xbtq4d6s.js";
47
+ import"./cli-xvymtmv4.js";
48
+ import"./cli-mp9aa8g5.js";
49
+ import"./cli-55bkx8hh.js";
50
+ import"./cli-h49ejvmc.js";
51
+ import"./cli-bzvs88tv.js";
52
+ import"./cli-zjphdj1a.js";
53
+ import"./cli-16phend6.js";
54
+ import"./cli-xncjscpm.js";
55
+ import"./cli-2tsfpc70.js";
56
+ import"./cli-0m7rtm11.js";
57
+ import"./cli-g1px1g2e.js";
58
+
59
+ // src/commands/worker.ts
60
+ init_server();
61
+ var workerConfig = {
62
+ role: "worker",
63
+ defaultPrompt: "/start-worker",
64
+ metadataType: "worker_metadata",
65
+ capabilities: getEnabledCapabilities()
66
+ };
67
+ async function runWorker(opts) {
68
+ return runAgent(workerConfig, opts);
69
+ }
70
+ export {
71
+ runWorker
72
+ };
package/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Agent Swarm API",
5
- "version": "2.7.9",
5
+ "version": "2.7.10",
6
6
  "description": "Multi-agent orchestration API for Claude Code, Codex, and Gemini CLI. Enables task distribution, agent communication, and service discovery.\n\nMCP tools are documented separately in [MCP.md](./MCP.md)."
7
7
  },
8
8
  "servers": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desplega.ai/agent-swarm",
3
- "version": "2.7.9",
3
+ "version": "2.7.10",
4
4
  "description": "agent-swarm.dev — an open-source operating system for AI work: a lead agent breaks goals into tasks, routes them to specialized workers such as Claude Code or Codex, runs each worker in an isolated container, and preserves shared memory, tools, schedules, and review gates so delegated work compounds across sessions.",
5
5
  "keywords": [
6
6
  "agent-swarm.dev",
@@ -213,8 +213,8 @@
213
213
  "@chat-adapter/slack": "4.41.1",
214
214
  "@chat-adapter/teams": "4.41.1",
215
215
  "@chat-adapter/telegram": "4.41.1",
216
- "@cursor/sdk": "1.2.0",
217
- "@desplega.ai/agent-fs-just-bash": "0.18.15",
216
+ "@cursor/sdk": "1.3.0",
217
+ "@desplega.ai/agent-fs-just-bash": "0.18.16",
218
218
  "@desplega.ai/business-use": "^0.4.2",
219
219
  "@earendil-works/pi-agent-core": "^1.5.0",
220
220
  "@earendil-works/pi-ai": "^1.5.0",
@@ -37,6 +37,7 @@
37
37
  "Calendar",
38
38
  "ContributionGraph",
39
39
  "Tree",
40
+ "SchemaForm",
40
41
  "ElementRef",
41
42
  "ElementSlot"
42
43
  ],
@@ -2706,6 +2707,60 @@
2706
2707
  "additionalProperties": false
2707
2708
  }
2708
2709
  },
2710
+ "SchemaForm": {
2711
+ "description": "Schema-driven props panel. Walks `schema.properties` and renders one control per property — text input (or a select when `enum` is present), number input, or switch — labelled by key with the property `description` as tooltip. Each field seeds from `value?.[key] ?? property.default`. On every field commit the draft object is written to `/ui/<id>/value` and the `onChange` chain is dispatched with `$form` = the current values and `{ \"$value\": true }` = the value just written (the whole merged doc when `baseDoc` is set; never read `/ui/<id>/value` with `$state` in `onChange`, the renderer resolves it before the commit and it is one edit stale). The draft rebuilds whenever the bound `schema` identity changes. With `baseDoc` (a `{ root, elements }` doc) and `nodeKey`, it edits `baseDoc.elements[nodeKey].props` and `/ui/<id>/value` holds the whole doc with the edit merged in, ready for one `app.mutate` (pass it as `{ \"$value\": true }`). At most 100 fields and 200 enum options render, and a `baseDoc` over 5,000 elements is refused. `fill: true` grows the field list to fill a `fill`-aware parent and scrolls internally instead of sizing to content — pair it with a `fill` sibling (e.g. Tree) in the same column Stack to split the available height evenly between them.",
2712
+ "props": {
2713
+ "$schema": "http://json-schema.org/draft-07/schema#",
2714
+ "type": "object",
2715
+ "properties": {
2716
+ "id": {
2717
+ "type": "string"
2718
+ },
2719
+ "schema": {
2720
+ "description": "JSON Schema (object with `properties`) held in state — usually a {$state} binding to a prop schema held in state"
2721
+ },
2722
+ "value": {
2723
+ "description": "Current values object (bound) — seeds the draft; each key falls back to its default. Ignored in nested document editing (baseDoc + nodeKey), where the draft seeds from baseDoc.elements[nodeKey].props"
2724
+ },
2725
+ "baseDoc": {
2726
+ "description": "Nested document editing: the full json-render doc ({ root, elements }) the edited props belong to — usually a {$state} binding to a query row's json column. When present with nodeKey, `/ui/<id>/value` receives the FULL doc with the draft merged into elements[nodeKey].props (a synchronous, parent-side merge), instead of the bare draft."
2727
+ },
2728
+ "nodeKey": {
2729
+ "description": "Nested document editing: the element key inside baseDoc whose props this form edits — usually a {$state} binding to the selected node (e.g. a Tree's /ui/<id>/value).",
2730
+ "type": "string"
2731
+ },
2732
+ "submitLabel": {
2733
+ "type": "string"
2734
+ },
2735
+ "onChange": {
2736
+ "description": "Action chain dispatched on every field commit. $form = the current draft values; with `baseDoc` + `nodeKey` read the merged doc from /ui/<id>/value.",
2737
+ "type": "array",
2738
+ "items": {
2739
+ "type": "object",
2740
+ "properties": {
2741
+ "action": {
2742
+ "type": "string"
2743
+ },
2744
+ "params": {
2745
+ "type": "object",
2746
+ "propertyNames": {
2747
+ "type": "string"
2748
+ },
2749
+ "additionalProperties": {}
2750
+ }
2751
+ },
2752
+ "required": ["action"],
2753
+ "additionalProperties": false
2754
+ }
2755
+ },
2756
+ "fill": {
2757
+ "type": "boolean"
2758
+ }
2759
+ },
2760
+ "required": ["id", "schema"],
2761
+ "additionalProperties": false
2762
+ }
2763
+ },
2709
2764
  "ElementRef": {
2710
2765
  "description": "Reference a reusable element from this app or an exported element from another app. Consumer children are inserted at the target's ElementSlot.",
2711
2766
  "slots": ["default"],
@@ -53,9 +53,14 @@ const UI_STATE_COMPONENTS = new Set([
53
53
  "Tabs",
54
54
  "Chips",
55
55
  "Tree",
56
+ "SchemaForm",
56
57
  "Table",
57
58
  ]);
58
59
 
60
+ // A SchemaForm id is spliced into `/ui/<id>/value`, so it must be a plain token.
61
+ const SCHEMA_FORM_ID = /^[A-Za-z0-9_-]+$/;
62
+ const RESERVED_UI_IDS = new Set(["__proto__", "constructor", "prototype"]);
63
+
59
64
  /**
60
65
  * Props that hold a plain action chain (an array of `{ action, params }`),
61
66
  * keyed by component type. Chains nested one level deeper (an array prop
@@ -67,6 +72,7 @@ const PROP_ACTION_CHAINS: Record<string, readonly string[]> = {
67
72
  Kanban: ["onMove", "onCardClick"],
68
73
  Calendar: ["onSelect"],
69
74
  CardGrid: ["onClick"],
75
+ SchemaForm: ["onChange"],
70
76
  };
71
77
 
72
78
  /**
@@ -1411,6 +1417,19 @@ export function validatePage(
1411
1417
  ) {
1412
1418
  formIds.add(rawElement.props.id);
1413
1419
  }
1420
+ if (
1421
+ type === "SchemaForm" &&
1422
+ isPlainObject(rawElement.props) &&
1423
+ typeof rawElement.props.id === "string" &&
1424
+ (!SCHEMA_FORM_ID.test(rawElement.props.id) || RESERVED_UI_IDS.has(rawElement.props.id))
1425
+ ) {
1426
+ issues.push(
1427
+ issue(
1428
+ `${propsPath}.id`,
1429
+ "SchemaForm id must match ^[A-Za-z0-9_-]+$ and not be __proto__, constructor, or prototype",
1430
+ ),
1431
+ );
1432
+ }
1414
1433
  if (
1415
1434
  typeof type === "string" &&
1416
1435
  UI_STATE_COMPONENTS.has(type) &&
package/src/assets/key.ts CHANGED
@@ -89,15 +89,88 @@ export function keyPrefixRange(prefix: string): { lo: string; hi: string } {
89
89
  return { lo, hi: `${lo.slice(0, -1)}${String.fromCharCode(lo.charCodeAt(lo.length - 1) + 1)}` };
90
90
  }
91
91
 
92
- export const SESSION_LEAF_KINDS = ["task", "thread", "schedule", "workflow"] as const;
93
- const sessionLeafPattern = new RegExp(`/(?:${SESSION_LEAF_KINDS.join("|")}):[^/]+/$`);
92
+ /**
93
+ * Resource kinds whose default key (`defaultAssetKey`) names a session group
94
+ * of its own. At a namespace root (`shared/<kind>:<id>/`,
95
+ * `personal/<me>/<kind>:<id>/`) the leaf is the group, shown under a section
96
+ * per kind (Pages, Workflows, ...). Below a user group it is a plain leaf.
97
+ */
98
+ export const SESSION_RESOURCE_KINDS = [
99
+ "page",
100
+ "workflow",
101
+ "schedule",
102
+ "app",
103
+ "script",
104
+ "fs",
105
+ ] as const;
106
+ export type SessionResourceKind = (typeof SESSION_RESOURCE_KINDS)[number];
107
+
108
+ /** Leaves that file a session into the group above them. */
109
+ export const SESSION_LEAF_KINDS = ["task", "thread", ...SESSION_RESOURCE_KINDS] as const;
110
+ /** The leaves a namespace root (`shared/`, `personal/<me>/`) holds as No group. */
111
+ export const NO_GROUP_LEAF_KINDS = ["task", "thread"] as const;
112
+ const sessionLeafPattern = new RegExp(`/(${SESSION_LEAF_KINDS.join("|")}):[^/]+/$`);
113
+ const resourceGroupPattern = new RegExp(
114
+ `^(shared/|personal/[^/]+/)((${SESSION_RESOURCE_KINDS.join("|")}):([^/]+))/(?:(action:[^/]+)/)?`,
115
+ );
116
+
117
+ const resourcePrefixPattern = new RegExp(
118
+ `^(?:shared/|personal/[^/]+/)(?:${SESSION_RESOURCE_KINDS.join("|")}):`,
119
+ );
120
+
121
+ /** Whether a key sits under a resource group (`shared/<kind>:...`), which is read-only. */
122
+ export function isResourceGroupPrefix(key: string): boolean {
123
+ return resourcePrefixPattern.test(key);
124
+ }
94
125
 
95
- /** Remove only a resource leaf, preserving user groups that contain a colon. */
126
+ export const RESOURCE_GROUPS_READ_ONLY = "Resource groups are read-only.";
127
+
128
+ /** The resource a session group belongs to, from `sessionGroupKey`. */
129
+ export interface SessionResourceGroup {
130
+ kind: SessionResourceKind;
131
+ /** The resource id (`fs` ids keep their provider: `agent-fs:<id>`). */
132
+ id: string;
133
+ /** The namespace root: `shared/` or `personal/<user>/`. */
134
+ base: string;
135
+ /** The group of the resource itself: `<base><kind>:<id>/`. */
136
+ resourceKey: string;
137
+ /** An app action below the app (`shared/app:<id>/action:<name>/`). */
138
+ action?: string;
139
+ }
140
+
141
+ /**
142
+ * The resource of a session group key, or null. Only exact resource groups
143
+ * match: `<base><kind>:<id>/`, or `<base>app:<id>/action:<name>/`. The UI
144
+ * mirrors this in `apps/ui/src/lib/session-groups.ts` (pinned by a test).
145
+ */
146
+ export function sessionResourceGroupOf(groupKey: string): SessionResourceGroup | null {
147
+ const match = resourceGroupPattern.exec(groupKey);
148
+ if (!match || match[0] !== groupKey) return null;
149
+ const kind = match[3] as SessionResourceKind;
150
+ if (match[5] && kind !== "app") return null;
151
+ return {
152
+ kind,
153
+ id: match[4]!,
154
+ base: match[1]!,
155
+ resourceKey: `${match[1]}${match[2]}/`,
156
+ ...(match[5] ? { action: match[5].slice("action:".length) } : {}),
157
+ };
158
+ }
159
+
160
+ /**
161
+ * A root key's session group: the key without its trailing `<kind>:<id>/`
162
+ * leaf, preserving user groups that contain a colon. A resource leaf right at
163
+ * a namespace root stays: it is the resource's group (`shared/page:<id>/`).
164
+ */
96
165
  export function sessionGroupKey(key: string): string {
97
166
  const normalized = normalizeAssetKey(key);
98
167
  const namespace = parseAssetKey(normalized);
99
168
  if (namespace.relativeSegments.length === 0) return normalized;
100
- return normalized.replace(sessionLeafPattern, "/");
169
+ const leaf = sessionLeafPattern.exec(normalized);
170
+ if (!leaf) return normalized;
171
+ const group = normalized.slice(0, leaf.index + 1);
172
+ const resource = (SESSION_RESOURCE_KINDS as readonly string[]).includes(leaf[1]!);
173
+ return resource && parseAssetKey(group).relativeSegments.length === 0 ? normalized : group;
101
174
  }
102
175
 
103
176
  export function parseAssetKey(input: string): AssetNamespace {
@@ -1,3 +1,9 @@
1
+ import {
2
+ SESSION_RESOURCE_KINDS,
3
+ type SessionResourceGroup,
4
+ type SessionResourceKind,
5
+ sessionResourceGroupOf,
6
+ } from "../../assets/key";
1
7
  import { getDbClient, upsertKv } from "../db";
2
8
 
3
9
  const NAMESPACE = "session-labels";
@@ -26,3 +32,54 @@ export async function rememberSessionLabel(
26
32
  expiresAt: ttlMs === undefined ? null : Date.now() + ttlMs,
27
33
  });
28
34
  }
35
+
36
+ /** The table and name column of each resource kind a session group can name. */
37
+ const RESOURCE_NAMES: Record<SessionResourceKind, { table: string; column: string }> = {
38
+ page: { table: "pages", column: "title" },
39
+ workflow: { table: "workflows", column: "name" },
40
+ schedule: { table: "scheduled_tasks", column: "name" },
41
+ app: { table: "apps", column: "name" },
42
+ script: { table: "scripts", column: "name" },
43
+ fs: { table: "asset_key_mappings", column: "provider_key" },
44
+ };
45
+
46
+ /**
47
+ * Labels of resource session groups (`sessionResourceGroupOf`), one query per
48
+ * kind: the resource's name, and an app action's name. A deleted resource
49
+ * gets no label; the UI falls back to "<Kind> · <short id>".
50
+ */
51
+ export async function getResourceSessionLabels(keys: string[]): Promise<Record<string, string>> {
52
+ const groups = keys.flatMap((key) => {
53
+ const resource = sessionResourceGroupOf(key);
54
+ return resource ? [{ key, resource }] : [];
55
+ });
56
+ const labels: Record<string, string> = {};
57
+ for (const { key, resource } of groups) {
58
+ if (resource.action) labels[key] = resource.action;
59
+ }
60
+ // An `fs` id keeps its provider (`agent-fs:<id>`): the mapping id is the last part.
61
+ const rowId = (resource: SessionResourceGroup) =>
62
+ resource.kind === "fs" ? resource.id.slice(resource.id.lastIndexOf(":") + 1) : resource.id;
63
+ await Promise.all(
64
+ SESSION_RESOURCE_KINDS.map(async (kind) => {
65
+ const wanted = groups.filter(({ resource }) => resource.kind === kind && !resource.action);
66
+ if (wanted.length === 0) return;
67
+ const ids = [...new Set(wanted.map(({ resource }) => rowId(resource)))];
68
+ const { table, column } = RESOURCE_NAMES[kind];
69
+ const rows = await getDbClient().query<{ id: string; name: string | null }>(
70
+ // Keys are lower case, and so are generated ids: `id IN` keeps the primary key index.
71
+ `SELECT lower(id) AS id, NULLIF(trim(${column}), '') AS name FROM ${table}
72
+ WHERE id IN (${ids.map(() => "?").join(", ")})`,
73
+ ids,
74
+ );
75
+ const names = new Map(rows.map((row) => [row.id, row.name]));
76
+ for (const { key, resource } of wanted) {
77
+ const name = names.get(rowId(resource));
78
+ if (!name) continue;
79
+ // A file reads as its last path segment.
80
+ labels[key] = kind === "fs" ? name.replace(/\/+$/, "").split("/").pop() || name : name;
81
+ }
82
+ }),
83
+ );
84
+ return labels;
85
+ }
@@ -1,8 +1,12 @@
1
1
  import {
2
2
  keyPrefixRange,
3
+ NO_GROUP_LEAF_KINDS,
3
4
  normalizeAssetKey,
5
+ parseAssetKey,
4
6
  SESSION_LEAF_KINDS,
7
+ SESSION_RESOURCE_KINDS,
5
8
  sessionGroupKey,
9
+ sessionResourceGroupOf,
6
10
  } from "../../assets/key";
7
11
  import {
8
12
  effectiveSource,
@@ -188,6 +192,9 @@ export async function getSessionGroupKey(task: { id: string; key: string }): Pro
188
192
  */
189
193
  function groupCondition(group: string, scan = false): SqlFragment {
190
194
  const { lo, hi } = keyPrefixRange(group);
195
+ // A namespace root keeps resource leaves out: they are resource groups (`sessionGroupKey`).
196
+ const kinds =
197
+ parseAssetKey(group).relativeSegments.length === 0 ? NO_GROUP_LEAF_KINDS : SESSION_LEAF_KINDS;
191
198
  // The remaining key must be one resource leaf, with no nested path.
192
199
  // SQLite substr/length count code points, so count them here too (not UTF-16 units).
193
200
  const start = [...lo].length + 1;
@@ -195,7 +202,7 @@ function groupCondition(group: string, scan = false): SqlFragment {
195
202
  return {
196
203
  sql: `(${scan ? "+" : ""}r."key" >= ? AND ${scan ? "+" : ""}r."key" < ? AND (r."key" = ? OR (
197
204
  instr(substr(r."key", ?, length(r."key") - ?), '/') = 0 AND
198
- (${SESSION_LEAF_KINDS.map(() => 'substr(r."key", ?) GLOB ?').join(" OR ")}) AND
205
+ (${kinds.map(() => 'substr(r."key", ?) GLOB ?').join(" OR ")}) AND
199
206
  ${threadRoots.sql} < ?
200
207
  )))`,
201
208
  params: [
@@ -204,7 +211,7 @@ function groupCondition(group: string, scan = false): SqlFragment {
204
211
  lo,
205
212
  start,
206
213
  start,
207
- ...SESSION_LEAF_KINDS.flatMap((kind) => [start, `${kind}:?*/`]),
214
+ ...kinds.flatMap((kind) => [start, `${kind}:?*/`]),
208
215
  ...threadRoots.params,
209
216
  NESTED_THREAD_MIN_ROOTS,
210
217
  ],
@@ -221,13 +228,39 @@ function noGroupCondition(userId: string | null | undefined): SqlFragment {
221
228
  };
222
229
  }
223
230
 
231
+ /** The namespace roots whose resource groups the Inbox holds: `shared/` and the viewer's own. */
232
+ function resourceBases(userId: string | null | undefined): string[] {
233
+ return userId ? ["shared/", `personal/${userId}/`] : ["shared/"];
234
+ }
235
+
224
236
  /**
225
- * Roots the Inbox holds: No group and the source sections (Slack, Telegram,
226
- * Discord), which file sessions on their own. A session that a person filed
227
- * into a group (My groups, Shared with me) shows under that group only.
237
+ * Whether a root key sits in a resource section (Pages, Workflows, ...) of
238
+ * the viewer: `inboxScopeCondition`'s resource ranges, in JS.
239
+ */
240
+ export function inResourceScope(key: string, userId: string | null | undefined): boolean {
241
+ return resourceBases(userId).some((base) =>
242
+ SESSION_RESOURCE_KINDS.some((kind) => key.startsWith(`${base}${kind}:`)),
243
+ );
244
+ }
245
+
246
+ /** Key ranges of every `<base><kind>:` prefix ({@link inResourceScope}). */
247
+ function resourceKeyRanges(userId: string | null | undefined) {
248
+ return resourceBases(userId).flatMap((base) =>
249
+ SESSION_RESOURCE_KINDS.map((kind) => {
250
+ const lo = normalizeAssetKey(`${base}${kind}:`).slice(0, -1);
251
+ return { lo, hi: `${lo.slice(0, -1)};` };
252
+ }),
253
+ );
254
+ }
255
+
256
+ /**
257
+ * Roots the Inbox holds: No group, the source sections (Slack, Telegram,
258
+ * Discord), and the resource sections (Pages, Workflows, ...), which file
259
+ * sessions on their own. A session that a person filed into a group (My
260
+ * groups, Shared with me) shows under that group only.
228
261
  */
229
262
  function inboxScopeCondition(userId: string | null | undefined): SqlFragment {
230
- const ranges = sourceKeyRanges();
263
+ const ranges = [...sourceKeyRanges(), ...resourceKeyRanges(userId)];
231
264
  const noGroup = noGroupCondition(userId);
232
265
  return {
233
266
  sql: `(${ranges.map(() => '(+r."key" >= ? AND +r."key" < ?)').join(" OR ")} OR ${noGroup.sql})`,
@@ -627,6 +660,11 @@ export interface SessionTree {
627
660
  sourceGroups: string[];
628
661
  /** Slack channel ids backed by visible roots with matching Slack fields, including hidden sources. */
629
662
  slackChannels: string[];
663
+ /**
664
+ * Every resource group key in this view and the key of its resource
665
+ * (`shared/app:<id>/` for an action group), hidden sources included, for labels.
666
+ */
667
+ resourceGroups: string[];
630
668
  /**
631
669
  * The oldest visible root of each nested source thread, including hidden
632
670
  * sources: its title, else a preview of its prompt without the thread context.
@@ -705,6 +743,7 @@ export async function getSessionTree(
705
743
  sources: [],
706
744
  sourceGroups: [],
707
745
  slackChannels: [],
746
+ resourceGroups: [],
708
747
  threadLabels: {},
709
748
  };
710
749
  const hidden = new Set(opts.hideSource);
@@ -712,6 +751,7 @@ export async function getSessionTree(
712
751
  const sources = new Map<string, number>();
713
752
  const sourceGroups = new Set<string>();
714
753
  const slackChannels = new Set<string>();
754
+ const resourceGroups = new Set<string>();
715
755
  const threadRootIds: string[] = [];
716
756
  const groups = new Map<string, SessionTreeGroup>();
717
757
  const add = (section: SessionSectionCounts, row: (typeof rows)[number]) => {
@@ -735,6 +775,8 @@ export async function getSessionTree(
735
775
  sourceGroups.add(sourceGroupKey);
736
776
  }
737
777
  if (sourceOfKey(key)) sourceGroups.add(key);
778
+ const resource = sessionResourceGroupOf(key);
779
+ if (resource) resourceGroups.add(key).add(resource.resourceKey);
738
780
  if (hidden.has(source) || (shown && !shown.has(source))) continue;
739
781
  const noGroup =
740
782
  key === "shared/" || (actor.kind === "user" && key === `personal/${actor.userId}/`);
@@ -750,7 +792,8 @@ export async function getSessionTree(
750
792
  if (row.readState === "later" || row.readState === "done") add(result[row.readState], row);
751
793
  else {
752
794
  // A session filed into a group shows under it only (`inboxScopeCondition`).
753
- if (noGroup || sourceOfKey(key)) add(result.inbox, row);
795
+ const viewer = actor.kind === "user" ? actor.userId : null;
796
+ if (noGroup || sourceOfKey(key) || inResourceScope(row.key, viewer)) add(result.inbox, row);
754
797
  if (noGroup) add(result.noGroup, row);
755
798
  else if (group) add(group, row);
756
799
  }
@@ -761,6 +804,7 @@ export async function getSessionTree(
761
804
  .sort((a, b) => b.total - a.total || a.source.localeCompare(b.source));
762
805
  result.sourceGroups = [...sourceGroups].sort();
763
806
  result.slackChannels = [...slackChannels].sort();
807
+ result.resourceGroups = [...resourceGroups].sort();
764
808
  if (threadRootIds.length) {
765
809
  // A missing or empty title falls back to a preview of the prompt without its thread context.
766
810
  const labels = await getDbClient().query<{ key: string; title: string | null; prompt: string }>(