@desplega.ai/agent-swarm 2.9.1 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-weaaxey3.js +16 -0
- package/dist/{acp-targets-ny75x1qy.js → acp-targets-5wyy2b9m.js} +9 -9
- package/dist/{actions-b9qgrmeq.js → actions-4nxq386s.js} +54 -32
- package/dist/{agent-fs-provision-b5dhdsbd.js → agent-fs-provision-v6enh76w.js} +4 -4
- package/dist/{amp-adapter-vtax2c9s.js → amp-adapter-ze3x22qn.js} +3 -3
- package/dist/{anthropic-messages-r5xf5hqw.js → anthropic-messages-88b7s3n9.js} +189 -37
- package/dist/{app-g2z15hax.js → app-kyqt8ehw.js} +7 -6
- package/dist/{approval-notifications-yt13wp8r.js → approval-notifications-a0db0esw.js} +7 -6
- package/dist/{assistant-2cgfxsgk.js → assistant-9g5jzq25.js} +26 -25
- package/dist/{azure-openai-responses-590s1eea.js → azure-openai-responses-jeaas6x0.js} +18 -18
- package/dist/{boot-args-schema-3gwy0f60.js → boot-args-schema-d7fme4q1.js} +1 -1
- package/dist/{boot-reembed-92g7s5zp.js → boot-reembed-6wpazmpw.js} +1 -1
- package/dist/{boot-reembed-mywmyp4s.js → boot-reembed-jrwxeye2.js} +1 -1
- package/dist/boot-scrub-sweep-52h7yntp.js +9 -0
- package/dist/{boot-seeds-ce7rvgq1.js → boot-seeds-kb3dxjex.js} +4 -4
- package/dist/{boxd-wn235q80.js → boxd-jrrmkv3w.js} +2 -2
- package/dist/{claude-adapter-3m4q7735.js → claude-adapter-0c0y8fqp.js} +8 -8
- package/dist/{claude-managed-adapter-t8nfgcgz.js → claude-managed-adapter-w2es07qq.js} +4 -4
- package/dist/{claude-managed-setup-c217draw.js → claude-managed-setup-9ssb7ct4.js} +4 -4
- package/dist/{claude-sdk-session-7fbqm51z.js → claude-sdk-session-p6t0gyse.js} +10941 -10412
- package/dist/{cli-2czxfnvj.js → cli-075ccjh6.js} +961 -178
- package/dist/{cli-fkef327x.js → cli-0bgj4rh5.js} +3 -3
- package/dist/{cli-1jykg0py.js → cli-14xdms9a.js} +41 -28
- package/dist/{cli-rqx70rcz.js → cli-17qzb39j.js} +5 -2
- package/dist/{cli-bkjdknnp.js → cli-1h4njv9y.js} +177 -7
- package/dist/{cli-6ym4jhzp.js → cli-27fat7st.js} +7 -7
- package/dist/{cli-kxx4k2jw.js → cli-2aacfdcn.js} +5 -5
- package/dist/{cli-fh97xn30.js → cli-2gvdvsxj.js} +3 -3
- package/dist/{cli-f9gz2vyj.js → cli-2jtfm8kh.js} +10 -10
- package/dist/{cli-6ehs4mta.js → cli-2z2c4k6q.js} +18 -4
- package/dist/{cli-6237rnyr.js → cli-3bpr3wks.js} +1 -1
- package/dist/{cli-bnqncekd.js → cli-453497a0.js} +44 -17
- package/dist/{cli-jm0hvmz2.js → cli-4aswccje.js} +2 -2
- package/dist/{cli-4ymxrwg5.js → cli-4dyzzkfb.js} +2 -2
- package/dist/{cli-vyff45ve.js → cli-4g323fjh.js} +772 -515
- package/dist/{cli-3kd08rej.js → cli-4jjrhy48.js} +1 -1
- package/dist/{cli-gfy38pvt.js → cli-4kzp7r0q.js} +8 -8
- package/dist/{cli-kxn3747f.js → cli-4se3x6qm.js} +1 -26
- package/dist/{cli-mjw0yf82.js → cli-5ptj757f.js} +1 -1
- package/dist/{cli-pyjn0qhk.js → cli-6a3j25xd.js} +348 -196
- package/dist/{cli-hnamkvnc.js → cli-6c9ve77f.js} +2 -2
- package/dist/{cli-mw620q3n.js → cli-6n7y5ypy.js} +1 -1
- package/dist/{cli-g0vv9dg4.js → cli-6p8p2e6r.js} +19 -12
- package/dist/{cli-jwampxxq.js → cli-6tvh1fwq.js} +3 -3
- package/dist/{cli-p74md7t8.js → cli-7b7rxz22.js} +13 -15
- package/dist/{cli-5a6pqy45.js → cli-7e8sxqv5.js} +1 -1
- package/dist/{cli-p4kckx1z.js → cli-892y3vfp.js} +13 -13
- package/dist/cli-8mfdbdhe.js +43 -0
- package/dist/{cli-mkwkwq81.js → cli-8zmpwe79.js} +29 -16
- package/dist/{cli-zcfpsfzf.js → cli-96234j5w.js} +3 -3
- package/dist/{cli-1z4qggfe.js → cli-9fvk9mv8.js} +30 -21
- package/dist/{cli-7mv4h3sn.js → cli-9g12h1aq.js} +2 -2
- package/dist/{cli-f8x9drqr.js → cli-9knhkkgr.js} +19 -5
- package/dist/{cli-5mpy301f.js → cli-9t7syepg.js} +1 -1
- package/dist/{cli-qj39vrc6.js → cli-9yjhshah.js} +1 -1
- package/dist/{cli-zr6qy15y.js → cli-a02habn6.js} +427 -145
- package/dist/{cli-7evph51z.js → cli-a49frv85.js} +2 -2
- package/dist/{cli-h9yqfzx9.js → cli-a6q6x15h.js} +11 -10
- package/dist/{cli-bg63qmsx.js → cli-atm0hkes.js} +11 -11
- package/dist/{cli-m7zvgt57.js → cli-b82a13ga.js} +13 -13
- package/dist/{cli-7zm3b3f5.js → cli-bf0t77nf.js} +1 -1
- package/dist/{cli-2xv18ywz.js → cli-bmqp0ser.js} +2 -2
- package/dist/{cli-xag7btpe.js → cli-bq97k63w.js} +2 -2
- package/dist/{cli-pb2ay3sh.js → cli-cstggwq7.js} +5 -5
- package/dist/{cli-f3jyzq4g.js → cli-czvvnfr9.js} +3 -3
- package/dist/{cli-b6px1k1q.js → cli-dd2k2mcd.js} +1 -1
- package/dist/{cli-nafvvsp8.js → cli-djt6wmrc.js} +9 -9
- package/dist/{cli-tsa40663.js → cli-ebqx630g.js} +3 -3
- package/dist/{cli-8zh9nrew.js → cli-f7dhm7hh.js} +1 -1
- package/dist/cli-f8yhybxr.js +321 -0
- package/dist/{cli-5gpqgs8b.js → cli-fwjwkw66.js} +2 -2
- package/dist/{cli-gabsjg8x.js → cli-g56fxddf.js} +1 -1
- package/dist/{cli-w4n323t3.js → cli-h2qtafm4.js} +19 -19
- package/dist/{cli-psffsanb.js → cli-ha4ek2nb.js} +6 -1
- package/dist/{cli-dgs10ttj.js → cli-hnh8erra.js} +2 -2
- package/dist/{cli-w16kwbzw.js → cli-htymm48w.js} +1 -1
- package/dist/{cli-2xs8tsf7.js → cli-j2r1apqm.js} +152 -67
- package/dist/{cli-43ms35q9.js → cli-k3c13za2.js} +3 -3
- package/dist/{cli-54vrpgm0.js → cli-k3facve0.js} +8 -5
- package/dist/{cli-67mwzr35.js → cli-k4r5sfaj.js} +7 -7
- package/dist/{cli-rq5rpv6k.js → cli-kbm659dk.js} +2 -2
- package/dist/{cli-j7svy295.js → cli-m00c47q6.js} +114 -31
- package/dist/{cli-m7c2380k.js → cli-mhrr4d5b.js} +99 -14
- package/dist/{cli-xqdz5cqm.js → cli-mz7ycqn8.js} +1 -0
- package/dist/{cli-vt89089n.js → cli-n6ygvrrm.js} +4 -4
- package/dist/{cli-jaw5v1sy.js → cli-nbakg5xh.js} +3 -3
- package/dist/{cli-nbt14he0.js → cli-nc39ym5q.js} +8 -8
- package/dist/{cli-tvc4jag9.js → cli-p1a4khta.js} +8 -8
- package/dist/{cli-t9ga4qmb.js → cli-p8zqbbt1.js} +40 -33
- package/dist/{cli-fjggej24.js → cli-ph95yejc.js} +2 -2
- package/dist/{cli-m0cy2vyf.js → cli-q4z9s6zs.js} +5 -5
- package/dist/cli-q71g5q39.js +404 -0
- package/dist/{cli-vs9vdpy0.js → cli-qncx2r0s.js} +1 -1
- package/dist/{cli-hg42n3hx.js → cli-qrzq3hvg.js} +8 -8
- package/dist/{cli-x40a0w9j.js → cli-r813c7rb.js} +1 -1
- package/dist/{cli-kpgcm7xy.js → cli-ramn8jae.js} +1 -1
- package/dist/{cli-jkw6ptfw.js → cli-raqw9fw9.js} +28 -17
- package/dist/cli-rhsc2zyx.js +68 -0
- package/dist/{cli-sn650d7x.js → cli-rpmw4fsv.js} +68 -20
- package/dist/{boot-scrub-sweep-7dkdzqxx.js → cli-rwgwen5v.js} +9 -10
- package/dist/{cli-3j873zxq.js → cli-rytq7dm2.js} +261 -6
- package/dist/{cli-zh0e5x7p.js → cli-s9twe4x0.js} +71 -22
- package/dist/{cli-2dq9yv8p.js → cli-t2s7j5cy.js} +2 -2
- package/dist/{cli-wn13hhdt.js → cli-tb4j757d.js} +7 -7
- package/dist/{cli-q2d3e1k1.js → cli-thd3005a.js} +1 -1
- package/dist/cli-tsfkcd4v.js +30 -0
- package/dist/{cli-br0924pw.js → cli-v3zcnr8g.js} +1 -1
- package/dist/{cli-zfqg6fzn.js → cli-vbppqvte.js} +3 -3
- package/dist/{cli-ysvspf5e.js → cli-vy3fn0mz.js} +4 -4
- package/dist/{cli-7sf9sb0w.js → cli-w5dar1bk.js} +1 -1
- package/dist/{cli-2yjj3e31.js → cli-wz4e5am2.js} +12 -10
- package/dist/{cli-td9tb872.js → cli-xqbqwpxr.js} +14 -14
- package/dist/{cli-32djehja.js → cli-ynph3b70.js} +11137 -8332
- package/dist/{cli-mhapr559.js → cli-yvzxbztc.js} +9 -4
- package/dist/{cli-v57d7fmm.js → cli-yzxqwcvq.js} +25 -27
- package/dist/{cli-y2ewxhth.js → cli-zb1hff00.js} +16 -16
- package/dist/{cli-yab6sh8p.js → cli-zcghfsdg.js} +23 -4
- package/dist/{cli-ctx0b85j.js → cli-zhn4r1rz.js} +757 -157
- package/dist/{cli-6945ywhr.js → cli-zqq57pgx.js} +9 -7
- package/dist/cli.js +30 -29
- package/dist/{cloudflare-workers-ai-system-one-9y1zx3pt.js → cloudflare-workers-ai-system-one-w3m0fbf8.js} +2 -2
- package/dist/{codex-adapter-n656pvb8.js → codex-adapter-ssahg4h4.js} +8 -8
- package/dist/{codex-hook-59atdwd8.js → codex-hook-aqtj17yr.js} +1 -1
- package/dist/{codex-login-a239g1ah.js → codex-login-9c7aggxe.js} +1 -1
- package/dist/{codex-session-runner-p0fbv5y9.js → codex-session-runner-xn63q3h7.js} +9 -9
- package/dist/{commands-gwea8z5p.js → commands-ctey7tr5.js} +3 -3
- package/dist/{controller-t67c3grh.js → controller-rqhbppg9.js} +4 -4
- package/dist/{controllers-connect-ks155r0h.js → controllers-connect-w3qbpbt1.js} +22 -21
- package/dist/core-df1n049h.js +39 -0
- package/dist/{cursor-adapter-ygwrtmkv.js → cursor-adapter-r819hf1a.js} +2 -2
- package/dist/{db-kpmx06s9.js → db-2ah39cyx.js} +2 -2
- package/dist/{db-rb2xqdb1.js → db-p5drc1d1.js} +3 -3
- package/dist/{devin-adapter-zp4tqq53.js → devin-adapter-bc6g0x29.js} +1 -1
- package/dist/{dispatcher-31sm0ej2.js → dispatcher-x6w14pde.js} +19 -18
- package/dist/{docker-09tkkg0n.js → docker-6c4reetq.js} +51 -14
- package/dist/{dsh-adapter-qyxh0w31.js → dsh-adapter-h8qn14n4.js} +2 -2
- package/dist/{e2b-sm28k0k3.js → e2b-jg7kyyef.js} +6 -6
- package/dist/{e2b-3v1e745x.js → e2b-z4ec0qve.js} +3 -3
- package/dist/{easter-egg-3d-00wjscn6.js → easter-egg-3d-1y6r9gxy.js} +1 -1
- package/dist/{embedding-space-qhw4g68n.js → embedding-space-z6ptw3jk.js} +6 -6
- package/dist/{embeddings-zdv9ke6x.js → embeddings-0sxb1d2h.js} +1 -1
- package/dist/{event-bus-xr83x566.js → event-bus-swr88jg5.js} +1 -1
- package/dist/{execute-zna8wwr7.js → execute-6m1ex8ce.js} +8 -4
- package/dist/{external-channel-1ac6t56s.js → external-channel-ezer7pk0.js} +2 -2
- package/dist/fx-adapter-zwmps9re.js +19 -0
- package/dist/{google-generative-ai-maq6c9bf.js → google-generative-ai-sw77egmr.js} +13 -13
- package/dist/{google-vertex-2jgsw2nb.js → google-vertex-rrw93g8h.js} +13 -13
- package/dist/grok-adapter-q0avf919.js +19 -0
- package/dist/handlers-g5jq0e4q.js +36 -0
- package/dist/{heartbeat-2f6z4kdx.js → heartbeat-6c4fr49t.js} +22 -21
- package/dist/{hook-8y0gvtp1.js → hook-02rt5tvq.js} +8 -8
- package/dist/{hook-w1skzaqc.js → hook-t1c5avbv.js} +5 -5
- package/dist/{http-wghxvpef.js → http-qa3h32a1.js} +2659 -355
- package/dist/index-1f6m47mq.js +37 -0
- package/dist/index-1p1mpqda.js +36 -0
- package/dist/{index-rv89fvzf.js → index-akbgsdhh.js} +25 -24
- package/dist/{index-9zkchs9t.js → index-e42j998x.js} +190 -15
- package/dist/{index-b5wgnm78.js → index-kdmkfjt7.js} +4 -4
- package/dist/{index-s71ez27v.js → index-kqv9ebfj.js} +1 -1
- package/dist/{index-9myfj74s.js → index-kzdqn3dd.js} +3 -3
- package/dist/{index-4a0670yh.js → index-p2f5xg64.js} +6 -6
- package/dist/{index-8zn8nxn5.js → index-qpjk2hxk.js} +1 -1
- package/dist/index-tnkd410q.js +41 -0
- package/dist/k8s-7jrh5va2.js +276 -0
- package/dist/{keepalive-sh02349h.js → keepalive-jmf6pn8c.js} +4 -4
- package/dist/lead-m5e7xt93.js +75 -0
- package/dist/{llama-cpp-classify-nfgswa1m.js → llama-cpp-classify-yvb8vh7w.js} +2 -2
- package/dist/{maintenance-yj0dcjja.js → maintenance-g7v15tj1.js} +1 -1
- package/dist/{mistral-conversations-0c30em7t.js → mistral-conversations-w4bncwbt.js} +11 -11
- package/dist/{node-7qsx5kvm.js → node-z67yjre7.js} +19 -13
- package/dist/{oauth-refresh-sweep-d9xedk66.js → oauth-refresh-sweep-ywgf8tbr.js} +3 -3
- package/dist/{onboard-dpgjn03r.js → onboard-m3fedypq.js} +6 -6
- package/dist/{openai-codex-responses-bkcd8pjj.js → openai-codex-responses-70g39cgz.js} +24 -18
- package/dist/{openai-completions-f3n69rep.js → openai-completions-cv3hp4h5.js} +33 -26
- package/dist/{openai-decisions-q3hh60wr.js → openai-decisions-fyq1p9f9.js} +2 -2
- package/dist/{openai-responses-gbh0wfqe.js → openai-responses-trsvnks6.js} +24 -22
- package/dist/{opencode-adapter-2d31cpjc.js → opencode-adapter-19ktcbb9.js} +7 -7
- package/dist/{openrouter-images-xr9gme9x.js → openrouter-images-0jj12a2q.js} +6 -6
- package/dist/{otel-impl-1skarpfq.js → otel-impl-3ehm1hgc.js} +2 -2
- package/dist/{pending-bfmxtx0g.js → pending-fwj2fatd.js} +20 -19
- package/dist/{pi-messages-zebyt7gb.js → pi-messages-zk3g4esn.js} +6 -6
- package/dist/{pi-mono-adapter-gvppnasy.js → pi-mono-adapter-xdeesvc4.js} +18 -17
- package/dist/{pricing-refresh-c6b325mk.js → pricing-refresh-4j8dzvxg.js} +2 -2
- package/dist/{rbac-roles-h80qbdbs.js → rbac-roles-8msjr07m.js} +3 -3
- package/dist/{rbac-roles-zfcx68tx.js → rbac-roles-n7t2acv8.js} +2 -2
- package/dist/{render-v2-nx20t3rb.js → render-v2-j7qggj8h.js} +7 -6
- package/dist/{resume-5ep8agan.js → resume-hj1mn65y.js} +9 -8
- package/dist/{runtime-r3pj4mce.js → runtime-z31mdsgv.js} +2 -2
- package/dist/{session-access-n7p3m15b.js → session-access-w38fh09a.js} +4 -4
- package/dist/{session-source-backfill-v8mt0zwn.js → session-source-backfill-ax6qxv20.js} +3 -3
- package/dist/{setup-z1psaqhe.js → setup-dsqmpfcr.js} +1 -1
- package/dist/thread-buffer-nf55vwx3.js +39 -0
- package/dist/tree-visibility-6vqmnr71.js +24 -0
- package/dist/{typesafe-system-one-f2en2knd.js → typesafe-system-one-qkvkgrcz.js} +2 -2
- package/dist/user-merge-jobs-mvheb3ed.js +22 -0
- package/dist/{virtual-modules-rrbjdpxn.js → virtual-modules-w2qk2wew.js} +32 -10
- package/dist/{work-objects-4aghh73z.js → work-objects-4ahy5es5.js} +22 -21
- package/dist/worker-ews1nyhw.js +75 -0
- package/dist/{worker-follow-up-166zmex1.js → worker-follow-up-1gs4aw7y.js} +19 -18
- package/dist/{x-wg164ss9.js → x-3wr8c5sh.js} +2 -2
- package/openapi.json +2576 -388
- package/package.json +11 -10
- package/src/be/boot-seeds.ts +7 -1
- package/src/be/db/model-groups.ts +238 -0
- package/src/be/db/model-profiles.ts +26 -8
- package/src/be/db/request-composition.ts +190 -0
- package/src/be/db/runtime.ts +15 -0
- package/src/be/db/session-costs.ts +8 -2
- package/src/be/db/slack-trees.ts +220 -10
- package/src/be/db/tasks/human-free.ts +3 -2
- package/src/be/db/tasks/read.ts +3 -2
- package/src/be/db/tasks/write.ts +2 -1
- package/src/be/db/user-references.ts +75 -0
- package/src/be/db/users/references.ts +185 -0
- package/src/be/db/workflow-run-retention.ts +101 -0
- package/src/be/db-client.ts +93 -20
- package/src/be/db-retention-defaults.ts +46 -0
- package/src/be/db-retention.ts +55 -6
- package/src/be/db.ts +32 -57
- package/src/be/key-window-usage.ts +1 -0
- package/src/be/mcp-events/catalog.ts +108 -0
- package/src/be/mcp-events/dispatcher.ts +202 -0
- package/src/be/mcp-events/protocol.ts +296 -0
- package/src/be/mcp-events/store.ts +231 -0
- package/src/be/mcp-events/webhook.ts +226 -0
- package/src/be/memory/demotion-evidence.ts +34 -0
- package/src/be/memory/providers/sqlite-store.ts +110 -24
- package/src/be/memory/reranker.ts +34 -12
- package/src/be/memory/review-recall-filter.ts +105 -0
- package/src/be/memory/search-candidates.ts +16 -5
- package/src/be/memory/types.ts +16 -0
- package/src/be/migrations/312_task_ui_action_runs_repeatable.sql +6 -0
- package/src/be/migrations/314_model_groups.sql +85 -0
- package/src/be/migrations/318_superseded_workflow_cut_backfill.sql +22 -0
- package/src/be/migrations/319_user_fk_indexes.sql +153 -0
- package/src/be/migrations/320_session_costs_kind.sql +4 -0
- package/src/be/migrations/321_user_merge_jobs.sql +52 -0
- package/src/be/migrations/322_runtime_pool_workspace.sql +8 -0
- package/src/be/migrations/323_slack_task_tree_visibility.sql +9 -0
- package/src/be/migrations/326_slack_reconcile_pages.sql +13 -0
- package/src/be/migrations/327_mcp_event_subscriptions.sql +57 -0
- package/src/be/migrations/329_workflow_run_retention.sql +9 -0
- package/src/be/migrations/330_request_composition.sql +22 -0
- package/src/be/model-profile-check.ts +1 -1
- package/src/be/multi-runtime.ts +32 -4
- package/src/be/pricing-normalize.ts +2 -0
- package/src/be/rbac-roles.ts +6 -4
- package/src/be/runtime-pools/controllers.ts +18 -3
- package/src/be/runtime-pools/db.ts +35 -9
- package/src/be/runtime-pools/supervisor.ts +57 -3
- package/src/be/scripts/db.ts +11 -0
- package/src/be/scripts/typecheck.ts +2 -0
- package/src/be/seed-model-groups.ts +86 -0
- package/src/be/seed-model-profiles.ts +20 -13
- package/src/be/seed-scripts/catalog/dreaming-gather.ts +165 -1
- package/src/be/swarm-config-guard.ts +44 -2
- package/src/be/task-ui-spec.ts +102 -1
- package/src/be/user-merge-jobs.ts +564 -0
- package/src/be/users.ts +41 -23
- package/src/commands/context-preamble.ts +11 -4
- package/src/commands/credential-outcome-report.ts +33 -9
- package/src/commands/e2b-stack-wizard.tsx +12 -6
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/compose-generator.ts +1 -1
- package/src/commands/onboard/env-generator.ts +1 -1
- package/src/commands/provider-credentials.ts +1 -1
- package/src/commands/runner.ts +116 -12
- package/src/extensions/catalog.generated.json +1 -1
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/contract.ts +15 -0
- package/src/extensions/dispatcher.ts +14 -4
- package/src/github/app.ts +59 -14
- package/src/github/handlers.ts +57 -0
- package/src/github/types.ts +4 -0
- package/src/http/all-routes.ts +4 -0
- package/src/http/approval-requests.ts +5 -1
- package/src/http/auth.ts +3 -1
- package/src/http/config.ts +36 -2
- package/src/http/core.ts +2 -0
- package/src/http/github-token.ts +66 -0
- package/src/http/index.ts +34 -0
- package/src/http/mcp-user.ts +11 -8
- package/src/http/mcp.ts +58 -42
- package/src/http/memory.ts +19 -6
- package/src/http/model-groups.ts +277 -0
- package/src/http/model-profiles.ts +30 -13
- package/src/http/prompt-templates.ts +1 -0
- package/src/http/request-composition.ts +310 -0
- package/src/http/tasks.ts +46 -6
- package/src/http/tool-hooks.ts +140 -0
- package/src/http/tool-schema-estimate.ts +95 -0
- package/src/http/users.ts +142 -19
- package/src/http/workflows.ts +37 -1
- package/src/integrations/chat-sdk/inbound.ts +8 -2
- package/src/integrations/chat-sdk/limits.ts +8 -3
- package/src/prompts/base-prompt.ts +133 -7
- package/src/prompts/resolver.ts +41 -2
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +72 -1
- package/src/providers/opencode-swarm-plugin.ts +22 -3
- package/src/providers/pi-mono-adapter.ts +1 -0
- package/src/providers/pi-mono-extension.ts +71 -0
- package/src/providers/pricing-sources.md +13 -0
- package/src/providers/request-composition-hook.ts +312 -0
- package/src/providers/types.ts +5 -0
- package/src/rbac/legacy-policy.ts +1 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/runtime-providers/controller-protocol.ts +7 -0
- package/src/runtime-providers/docker.ts +80 -12
- package/src/runtime-providers/index.ts +7 -5
- package/src/runtime-providers/k8s.ts +355 -0
- package/src/runtime-providers/types.ts +17 -0
- package/src/scheduler/scheduler.ts +1 -1
- package/src/scripts-runtime/types/stdlib.d.ts +2 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +16 -1
- package/src/scripts-runtime/types/swarm-sdk.d.ts +2 -0
- package/src/server-user.ts +16 -1
- package/src/slack/ack.ts +10 -5
- package/src/slack/actions.ts +36 -13
- package/src/slack/app.ts +2 -0
- package/src/slack/assistant.ts +4 -4
- package/src/slack/blocks.ts +26 -5
- package/src/slack/handlers.ts +3 -3
- package/src/slack/reaction-shortcode.ts +23 -2
- package/src/slack/render-v2.ts +344 -200
- package/src/slack/responses.ts +7 -5
- package/src/slack/thread-buffer.ts +3 -3
- package/src/slack/tree-visibility.ts +64 -0
- package/src/tasks/worker-follow-up.ts +127 -17
- package/src/tests/acp-adapter.test.ts +26 -0
- package/src/tests/azure-devops-outbound.test.ts +47 -14
- package/src/tests/base-prompt.test.ts +149 -1
- package/src/tests/chat-sdk-relay.test.ts +21 -1
- package/src/tests/check-playwright-version.test.ts +33 -0
- package/src/tests/check-pr-body.test.ts +43 -0
- package/src/tests/context-preamble-budget.test.ts +65 -0
- package/src/tests/credential-check.test.ts +14 -6
- package/src/tests/credential-outcome-report.test.ts +81 -1
- package/src/tests/db-client.test.ts +168 -0
- package/src/tests/db-retention-defaults.test.ts +244 -0
- package/src/tests/db-retention.test.ts +2 -1
- package/src/tests/db-runtime.test.ts +2 -1
- package/src/tests/deploy-guard.test.ts +7 -7
- package/src/tests/deploy-release-dispatch.test.ts +332 -0
- package/src/tests/deploy-select.test.ts +83 -0
- package/src/tests/dreaming-gather-corrections.test.ts +467 -0
- package/src/tests/e2b-stack-wizard.test.tsx +156 -0
- package/src/tests/entrypoint-chown-no-follow.test.ts +69 -0
- package/src/tests/entrypoint-repo-clone-target.test.ts +112 -0
- package/src/tests/env-flag.test.ts +4 -2
- package/src/tests/event-loop-lag.test.ts +16 -20
- package/src/tests/extensions-example-slack-reply-gate.test.ts +15 -0
- package/src/tests/fixtures/base-prompt-baseline-cases.ts +78 -0
- package/src/tests/fixtures/base-prompt-baseline.json +18 -0
- package/src/tests/fixtures/extensions/native-tool-recorder/hooks.ts +26 -0
- package/src/tests/fixtures/extensions/native-tool-recorder/manifest.json +10 -0
- package/src/tests/fixtures/onboard/content.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/content.env.txt +1 -1
- package/src/tests/fixtures/onboard/dev.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/dev.env.txt +1 -1
- package/src/tests/fixtures/onboard/full-all.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/full-all.env.txt +1 -1
- package/src/tests/fixtures/onboard/full.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/full.env.txt +1 -1
- package/src/tests/fixtures/onboard/research.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/research.env.txt +1 -1
- package/src/tests/fixtures/onboard/solo.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/solo.env.txt +1 -1
- package/src/tests/github-app-worker-auth-helper.test.ts +325 -0
- package/src/tests/github-event-filter.test.ts +8 -0
- package/src/tests/github-handlers-inline-comments.test.ts +2 -0
- package/src/tests/github-handlers-reactions.test.ts +4 -0
- package/src/tests/github-handlers.test.ts +3 -0
- package/src/tests/github-installation-token-route.test.ts +199 -0
- package/src/tests/github-sender-trust.test.ts +223 -0
- package/src/tests/http-users.test.ts +142 -41
- package/src/tests/k8s-pool-smoke.test.ts +190 -0
- package/src/tests/key-window-usage.test.ts +15 -0
- package/src/tests/mcp-user-events.test.ts +708 -0
- package/src/tests/memory-key-paths.test.ts +4 -1
- package/src/tests/memory-rater-store.test.ts +35 -1
- package/src/tests/memory-reranker.test.ts +39 -4
- package/src/tests/memory-review-recall-filter.test.ts +205 -0
- package/src/tests/memory-search-stall.test.ts +421 -0
- package/src/tests/migration-318-superseded-workflow-cut-backfill.test.ts +74 -0
- package/src/tests/migration-322-runtime-pool-workspace.test.ts +116 -0
- package/src/tests/migration-329-workflow-run-retention.test.ts +32 -0
- package/src/tests/model-groups-api.test.ts +415 -0
- package/src/tests/model-profile-fallbacks.test.ts +236 -2
- package/src/tests/model-profiles-api.test.ts +1 -0
- package/src/tests/opencode-adapter.test.ts +86 -0
- package/src/tests/operator-granted-credentials.test.ts +7 -2
- package/src/tests/operator-granted-role-wire.test.ts +2 -1
- package/src/tests/pi-mono-extension.test.ts +168 -0
- package/src/tests/preload-env.test.ts +61 -1
- package/src/tests/preload.ts +22 -0
- package/src/tests/prompt-template-resolver.test.ts +85 -0
- package/src/tests/rbac-engine.test.ts +1 -0
- package/src/tests/reload-config.test.ts +45 -0
- package/src/tests/request-composition.test.ts +447 -0
- package/src/tests/runner-max-concurrent.test.ts +86 -0
- package/src/tests/runtime-k8s-pools.test.ts +142 -0
- package/src/tests/runtime-pools-db.test.ts +122 -2
- package/src/tests/runtime-pools-http.test.ts +47 -2
- package/src/tests/runtime-provider-registration.test.ts +13 -14
- package/src/tests/runtime-providers-docker.test.ts +192 -1
- package/src/tests/runtime-providers-k8s.test.ts +430 -0
- package/src/tests/runtime-remote-controller.test.ts +64 -1
- package/src/tests/runtime-supervisor.test.ts +101 -0
- package/src/tests/script-connections.test.ts +21 -1
- package/src/tests/short-id.test.ts +23 -0
- package/src/tests/slack-blocks.test.ts +87 -0
- package/src/tests/slack-empty-icon-config.test.ts +113 -0
- package/src/tests/slack-reaction-config.test.ts +38 -2
- package/src/tests/slack-render-v2-query-plans.test.ts +100 -1
- package/src/tests/slack-render-v2-reconcile.test.ts +75 -4
- package/src/tests/slack-render-v2.test.ts +737 -11
- package/src/tests/spec-base-url.test.ts +13 -1
- package/src/tests/swarm-config-reserved-keys.test.ts +1 -0
- package/src/tests/system-one-decide-session-cost.test.ts +196 -0
- package/src/tests/task-session-prompts.test.ts +37 -0
- package/src/tests/task-ui-action-route.test.ts +59 -1
- package/src/tests/task-ui-script-actions.test.ts +517 -0
- package/src/tests/tool-hooks-http.test.ts +187 -0
- package/src/tests/ui-spec-script-actions-config.test.ts +196 -0
- package/src/tests/user-delete-perf.test.ts +348 -0
- package/src/tests/user-merge-jobs.test.ts +680 -0
- package/src/tests/vcs-provider.test.ts +25 -5
- package/src/tests/vendored-openapi.test.ts +13 -1
- package/src/tests/webhook-filter.test.ts +327 -0
- package/src/tests/workflow-agent-task-retry.test.ts +62 -0
- package/src/tests/workflow-async-v2.test.ts +19 -16
- package/src/tests/workflow-definition-telemetry.test.ts +15 -5
- package/src/tests/workflow-e2e.test.ts +1 -9
- package/src/tests/workflow-finalization-races.test.ts +553 -0
- package/src/tests/workflow-foreach-supersede-retry.test.ts +10 -0
- package/src/tests/workflow-foreach.test.ts +2 -0
- package/src/tests/workflow-hitl-routing.test.ts +26 -20
- package/src/tests/workflow-http-v2.test.ts +132 -2
- package/src/tests/workflow-idempotency.test.ts +41 -0
- package/src/tests/workflow-mcp-webhook-filter.test.ts +214 -0
- package/src/tests/workflow-parallel-park.test.ts +297 -0
- package/src/tests/workflow-replay.test.ts +10 -1
- package/src/tests/workflow-retry-v2.test.ts +57 -21
- package/src/tests/workflow-retry-validation.test.ts +13 -13
- package/src/tests/workflow-runs-retention.test.ts +533 -0
- package/src/tests/workflow-script-principal.test.ts +7 -2
- package/src/tests/workflow-tla-races.test.ts +7 -2
- package/src/tests/workflow-triggers-v2.test.ts +329 -0
- package/src/tests/workflow-wait-builtin-events.test.ts +3 -1
- package/src/tests/workflow-wait-event.test.ts +137 -3
- package/src/tests/workflow-wait-poller.test.ts +94 -0
- package/src/tests/workflow-wait-time.test.ts +7 -3
- package/src/tests/workflow-wait.test.ts +26 -0
- package/src/tests/workflow-wait.ts +44 -0
- package/src/tools/memory-search.ts +14 -3
- package/src/tools/store-progress.ts +26 -26
- package/src/tools/swarm-config/delete-config.ts +12 -1
- package/src/tools/swarm-config/set-config.ts +8 -0
- package/src/tools/system-one-decide.ts +113 -3
- package/src/tools/utils.ts +4 -1
- package/src/tools/workflows/create-workflow.ts +7 -1
- package/src/tools/workflows/update-workflow.ts +8 -2
- package/src/types.ts +284 -2
- package/src/ui-spec/actions.ts +30 -4
- package/src/ui-spec/schema.ts +38 -0
- package/src/ui-spec/script-actions.ts +340 -0
- package/src/ui-spec/script-allowlist.ts +48 -0
- package/src/utils/credentials.ts +7 -0
- package/src/utils/short-id.ts +20 -14
- package/src/utils/task-ui-spec.ts +16 -4
- package/src/vcs/index.ts +12 -2
- package/src/workflows/checkpoint.ts +18 -0
- package/src/workflows/engine.ts +38 -10
- package/src/workflows/executors/system-one-decision.ts +2 -2
- package/src/workflows/foreach-driver.ts +42 -4
- package/src/workflows/recovery.ts +6 -1
- package/src/workflows/resume.ts +14 -5
- package/src/workflows/retry-poller.ts +17 -4
- package/src/workflows/successor-routing.ts +108 -0
- package/src/workflows/task-step-routing.ts +35 -12
- package/src/workflows/triggers.ts +25 -8
- package/src/workflows/wait-poller.ts +6 -2
- package/src/workflows/webhook-filter.ts +203 -0
- package/templates/extensions/manifest.schema.json +13 -0
- package/templates/extensions/slack-reply-gate/hooks.ts +8 -4
- package/templates/skills/swarm-docs/content.md +4 -0
- package/templates/skills/ui-spec/content.md +7 -1
- package/templates/workflows/dreaming/content.md +1 -1
- package/dist/acp-adapter-g909b5hw.js +0 -16
- package/dist/cli-b91nz213.js +0 -93
- package/dist/fx-adapter-sk7n0fzc.js +0 -19
- package/dist/grok-adapter-sjbcm5ew.js +0 -19
- package/dist/handlers-yzy0c87x.js +0 -35
- package/dist/index-25pvya7q.js +0 -40
- package/dist/index-2t4859r5.js +0 -35
- package/dist/index-cxca2t8y.js +0 -36
- package/dist/lead-gk4h5eg7.js +0 -74
- package/dist/thread-buffer-a1re2r9r.js +0 -38
- package/dist/worker-3dyyb8ev.js +0 -74
- /package/dist/{node-dqm4xgxw.js → node-2wfcey7d.js} +0 -0
|
@@ -13,12 +13,16 @@ import {
|
|
|
13
13
|
SLACK_REACTION_DEFAULTS,
|
|
14
14
|
SLACK_REACTION_CONFIG_KEYS,
|
|
15
15
|
reactionName,
|
|
16
|
+
reactionStatusIcon,
|
|
17
|
+
iconPrefix,
|
|
16
18
|
completedStatusIcon,
|
|
17
19
|
init_reaction_shortcode,
|
|
18
20
|
getAgentById2,
|
|
19
21
|
closeSlackTreeIfSettled,
|
|
20
22
|
getSlackThreadsOfTasks,
|
|
23
|
+
slackThreadHasBotReplySince,
|
|
21
24
|
slackThreadHasOutcomeWork,
|
|
25
|
+
getSlackProcessingThreads,
|
|
22
26
|
init_slack_trees,
|
|
23
27
|
getTaskById2,
|
|
24
28
|
getChildTasks2,
|
|
@@ -27,7 +31,7 @@ import {
|
|
|
27
31
|
markSlackRelayDelivered2,
|
|
28
32
|
markFinalizedSlackRelaysDelivered2,
|
|
29
33
|
getInProgressSlackTasks2,
|
|
30
|
-
|
|
34
|
+
getSlackRenderV2ActivatedAt2,
|
|
31
35
|
ensureSlackRenderV2Activation2,
|
|
32
36
|
ensureSlackDelegationActivation2,
|
|
33
37
|
isPendingSlackMessage2,
|
|
@@ -44,7 +48,6 @@ import {
|
|
|
44
48
|
markSlackDeferralResolved2,
|
|
45
49
|
noteSlackOutcomeDeliveryFailure2,
|
|
46
50
|
abandonSlackOutcomeDelivery2,
|
|
47
|
-
getSlackTreeMessages2,
|
|
48
51
|
getSlackMessageByChannelTs2,
|
|
49
52
|
getSlackTasksInThread2,
|
|
50
53
|
listSlackThreadsAwaitingHuman2,
|
|
@@ -58,11 +61,22 @@ import {
|
|
|
58
61
|
checkDependencies2,
|
|
59
62
|
emitBuiltInIntegrationConnectedOnce2,
|
|
60
63
|
init_db4
|
|
61
|
-
} from "./cli-
|
|
64
|
+
} from "./cli-zhn4r1rz.js";
|
|
62
65
|
import {
|
|
63
66
|
getChannelBlockReason2,
|
|
64
67
|
init_external_channel
|
|
65
|
-
} from "./cli-
|
|
68
|
+
} from "./cli-bq97k63w.js";
|
|
69
|
+
import {
|
|
70
|
+
isSlackTaskTreeEnabled2,
|
|
71
|
+
invalidateSlackTreeOperations2,
|
|
72
|
+
onSlackTreeInvalidated2,
|
|
73
|
+
syncSlackTreeVisibility2,
|
|
74
|
+
slackTreeGeneration2,
|
|
75
|
+
SlackTreeSuppressed2,
|
|
76
|
+
assertSlackTreeCurrent2,
|
|
77
|
+
canPresentSlackTree2,
|
|
78
|
+
init_tree_visibility
|
|
79
|
+
} from "./cli-rhsc2zyx.js";
|
|
66
80
|
import {
|
|
67
81
|
require_dist6,
|
|
68
82
|
require_is_electron,
|
|
@@ -78,7 +92,7 @@ import {
|
|
|
78
92
|
import {
|
|
79
93
|
workflowEventBus2,
|
|
80
94
|
init_event_bus
|
|
81
|
-
} from "./cli-
|
|
95
|
+
} from "./cli-thd3005a.js";
|
|
82
96
|
import {
|
|
83
97
|
require_jsonwebtoken,
|
|
84
98
|
require_dist9,
|
|
@@ -92,25 +106,25 @@ import {
|
|
|
92
106
|
import {
|
|
93
107
|
require_p_retry
|
|
94
108
|
} from "./cli-952zgdwp.js";
|
|
95
|
-
import {
|
|
96
|
-
isTerminalTaskStatus,
|
|
97
|
-
init_types5
|
|
98
|
-
} from "./cli-bkjdknnp.js";
|
|
99
109
|
import {
|
|
100
110
|
getGitHubLinkConfig,
|
|
101
111
|
init_github_host
|
|
102
112
|
} from "./cli-9ttx00s3.js";
|
|
113
|
+
import {
|
|
114
|
+
isTerminalTaskStatus,
|
|
115
|
+
init_types5
|
|
116
|
+
} from "./cli-1h4njv9y.js";
|
|
103
117
|
import {
|
|
104
118
|
taskAttachmentDisplayUrl,
|
|
105
119
|
init_task_attachment_links
|
|
106
|
-
} from "./cli-
|
|
120
|
+
} from "./cli-mhrr4d5b.js";
|
|
107
121
|
import {
|
|
108
122
|
getSlackConfiguration,
|
|
109
123
|
init_config4
|
|
110
124
|
} from "./cli-eetzmsy5.js";
|
|
111
125
|
import {
|
|
112
126
|
init_zod
|
|
113
|
-
} from "./cli-
|
|
127
|
+
} from "./cli-96234j5w.js";
|
|
114
128
|
import {
|
|
115
129
|
string2,
|
|
116
130
|
number2,
|
|
@@ -122,11 +136,12 @@ import {
|
|
|
122
136
|
object2,
|
|
123
137
|
strictObject2,
|
|
124
138
|
union3,
|
|
139
|
+
discriminatedUnion,
|
|
125
140
|
record2,
|
|
126
141
|
_enum2,
|
|
127
142
|
literal2,
|
|
128
143
|
lazy
|
|
129
|
-
} from "./cli-
|
|
144
|
+
} from "./cli-qrzq3hvg.js";
|
|
130
145
|
import {
|
|
131
146
|
getAppUrl,
|
|
132
147
|
init_constants3
|
|
@@ -143,7 +158,7 @@ import {
|
|
|
143
158
|
scrubSecrets,
|
|
144
159
|
scrubObject,
|
|
145
160
|
init_secret_scrubber
|
|
146
|
-
} from "./cli-
|
|
161
|
+
} from "./cli-7e8sxqv5.js";
|
|
147
162
|
import {
|
|
148
163
|
__toESM,
|
|
149
164
|
__commonJS,
|
|
@@ -12383,7 +12398,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
|
|
|
12383
12398
|
return;
|
|
12384
12399
|
initialized = true;
|
|
12385
12400
|
try {
|
|
12386
|
-
const impl = await import("./otel-impl-
|
|
12401
|
+
const impl = await import("./otel-impl-3ehm1hgc.js");
|
|
12387
12402
|
await impl.boot(serviceRole, {
|
|
12388
12403
|
exportConsoleLogs: serviceRole === "api" && isApiLogExportEnabled()
|
|
12389
12404
|
});
|
|
@@ -12509,6 +12524,8 @@ function slackErrorCode(error) {
|
|
|
12509
12524
|
return typeof data.error === "string" ? data.error : undefined;
|
|
12510
12525
|
}
|
|
12511
12526
|
async function addReaction(client, channel, timestamp, name, event) {
|
|
12527
|
+
if (!name)
|
|
12528
|
+
return;
|
|
12512
12529
|
try {
|
|
12513
12530
|
await client.reactions.add({ channel, name, timestamp });
|
|
12514
12531
|
} catch (error) {
|
|
@@ -12533,7 +12550,7 @@ async function ackSlackMessage(client, channel, timestamp, name, event) {
|
|
|
12533
12550
|
await addReaction(client, channel, timestamp, name, event);
|
|
12534
12551
|
}
|
|
12535
12552
|
async function finalizeSlackMessageReaction(client, channel, timestamp, outcome, event) {
|
|
12536
|
-
const names = new Set(ACCEPTANCE_EVENTS.map((acceptanceEvent) => reactionName(acceptanceEvent)));
|
|
12553
|
+
const names = new Set(ACCEPTANCE_EVENTS.map((acceptanceEvent) => reactionName(acceptanceEvent)).filter((name) => name !== null));
|
|
12537
12554
|
await Promise.all(Array.from(names, async (name) => {
|
|
12538
12555
|
try {
|
|
12539
12556
|
await client.reactions.remove({ channel, name, timestamp });
|
|
@@ -12631,7 +12648,7 @@ var init_ack = __esm(() => {
|
|
|
12631
12648
|
init_otel();
|
|
12632
12649
|
init_types5();
|
|
12633
12650
|
init_secret_scrubber();
|
|
12634
|
-
|
|
12651
|
+
init_app4();
|
|
12635
12652
|
init_reaction_shortcode();
|
|
12636
12653
|
init_task_output();
|
|
12637
12654
|
init_reaction_shortcode();
|
|
@@ -12647,9 +12664,21 @@ function getTaskUrl(taskId) {
|
|
|
12647
12664
|
return `${getAppUrl()}/tasks/${taskId}`;
|
|
12648
12665
|
}
|
|
12649
12666
|
function markdownToSlack(text) {
|
|
12650
|
-
|
|
12667
|
+
const code = [];
|
|
12668
|
+
const usedMarkers = new Set(Array.from(text.matchAll(/\uE002(\d+)(?=\uE002)/g), (match) => match[1]));
|
|
12669
|
+
let markerIndex = 0;
|
|
12670
|
+
while (usedMarkers.has(String(markerIndex)))
|
|
12671
|
+
markerIndex++;
|
|
12672
|
+
const codeMarker = `${markerIndex}`;
|
|
12673
|
+
const protectedText = text.replace(/\\[\s\S]|```[\s\S]*?(?:```|$)|(?<!`)(`+)(?!`)(?:(?!\r?\n[ \t]*\r?\n)[\s\S])*?(?<!`)\1(?!`)/g, (match) => {
|
|
12674
|
+
if (match.startsWith("\\"))
|
|
12675
|
+
return match;
|
|
12676
|
+
code.push(match);
|
|
12677
|
+
return `${codeMarker}${code.length - 1}`;
|
|
12678
|
+
});
|
|
12679
|
+
return protectedText.replace(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g, (_match, alt, url) => alt ? `${alt} (${url})` : url).replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g, "$1 ($2)").replace(/^#{1,6}\s+(.+)$/gm, "$1").replace(/\*\*(.+?)\*\*/g, "$1").replace(/__(.+?)__/g, "$1").replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, "_$1_").replace(/\uE000(.+?)\uE001/g, "*$1*").replace(/~~(.+?)~~/g, "~$1~").replace(/\n{3,}/g, `
|
|
12651
12680
|
|
|
12652
|
-
`);
|
|
12681
|
+
`).replace(new RegExp(`${codeMarker}(\\d+)\\uE003`, "g"), (_match, index) => code[Number(index)]);
|
|
12653
12682
|
}
|
|
12654
12683
|
function splitSlackSectionText(text) {
|
|
12655
12684
|
if (text.length <= MAX_SECTION_LENGTH)
|
|
@@ -12779,7 +12808,7 @@ function formatDuration(start, end) {
|
|
|
12779
12808
|
}
|
|
12780
12809
|
function buildCompletedBlocks(opts) {
|
|
12781
12810
|
const taskLink = getTaskLink(opts.taskId);
|
|
12782
|
-
let line = `${completedStatusIcon()}
|
|
12811
|
+
let line = `${iconPrefix(completedStatusIcon())}*${opts.agentName}* (${taskLink})`;
|
|
12783
12812
|
if (opts.duration)
|
|
12784
12813
|
line += ` · ${opts.duration}`;
|
|
12785
12814
|
const blocks = [sectionBlock(line)];
|
|
@@ -12862,7 +12891,7 @@ function isTreeOutputTruncated(text) {
|
|
|
12862
12891
|
function renderNodeLine(node) {
|
|
12863
12892
|
const icon = node.status === "completed" ? completedStatusIcon() : STATUS_ICON[node.status] ?? "•";
|
|
12864
12893
|
const taskLink = getTaskLink(node.taskId);
|
|
12865
|
-
let line = `${icon}
|
|
12894
|
+
let line = `${iconPrefix(icon)}*${node.agentName}* (${taskLink})`;
|
|
12866
12895
|
if (node.duration)
|
|
12867
12896
|
line += ` · ${node.duration}`;
|
|
12868
12897
|
if (node.steered)
|
|
@@ -13286,6 +13315,61 @@ async function setTaskUiActionResult(taskId, actionId, resultTaskId) {
|
|
|
13286
13315
|
updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
|
|
13287
13316
|
WHERE task_id = ? AND action_id = ?`, [resultTaskId, taskId, actionId]);
|
|
13288
13317
|
}
|
|
13318
|
+
async function acquireTaskUiScriptActionRun({
|
|
13319
|
+
taskId,
|
|
13320
|
+
actionId,
|
|
13321
|
+
surface,
|
|
13322
|
+
slackUserId,
|
|
13323
|
+
userId,
|
|
13324
|
+
leaseMs,
|
|
13325
|
+
cooldownMs,
|
|
13326
|
+
nowMs = Date.now()
|
|
13327
|
+
}) {
|
|
13328
|
+
const now = new Date(nowMs).toISOString();
|
|
13329
|
+
const lockedUntil = new Date(nowMs + leaseMs).toISOString();
|
|
13330
|
+
const cooldownCutoff = new Date(nowMs - cooldownMs).toISOString();
|
|
13331
|
+
const { changes } = await getDbClient2().run(`INSERT INTO task_ui_action_runs
|
|
13332
|
+
(task_id, action_id, surface, slack_user_id, created_by, updated_by, locked_until)
|
|
13333
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
13334
|
+
ON CONFLICT(task_id, action_id) DO UPDATE SET
|
|
13335
|
+
locked_until = excluded.locked_until, surface = excluded.surface,
|
|
13336
|
+
slack_user_id = excluded.slack_user_id, updated_by = excluded.updated_by, updated_at = ?
|
|
13337
|
+
WHERE task_ui_action_runs.result_task_id IS NULL
|
|
13338
|
+
AND (task_ui_action_runs.locked_until IS NULL OR task_ui_action_runs.locked_until < ?)
|
|
13339
|
+
AND (task_ui_action_runs.last_run_at IS NULL OR task_ui_action_runs.last_run_at < ?)`, [
|
|
13340
|
+
taskId,
|
|
13341
|
+
actionId,
|
|
13342
|
+
surface,
|
|
13343
|
+
slackUserId ?? null,
|
|
13344
|
+
userId ?? null,
|
|
13345
|
+
userId ?? null,
|
|
13346
|
+
lockedUntil,
|
|
13347
|
+
now,
|
|
13348
|
+
now,
|
|
13349
|
+
cooldownCutoff
|
|
13350
|
+
]);
|
|
13351
|
+
if (changes === 1)
|
|
13352
|
+
return { status: "acquired" };
|
|
13353
|
+
const row = await getDbClient2().get(`SELECT locked_until AS lockedUntil, last_run_at AS lastRunAt
|
|
13354
|
+
FROM task_ui_action_runs WHERE task_id = ? AND action_id = ?`, [taskId, actionId]);
|
|
13355
|
+
const secondsUntil = (ms) => Math.max(1, Math.ceil((ms - nowMs) / 1000));
|
|
13356
|
+
if (row?.lockedUntil && row.lockedUntil >= now) {
|
|
13357
|
+
return { status: "running", retryAfterSec: secondsUntil(Date.parse(row.lockedUntil)) };
|
|
13358
|
+
}
|
|
13359
|
+
if (row?.lastRunAt && row.lastRunAt >= cooldownCutoff) {
|
|
13360
|
+
return {
|
|
13361
|
+
status: "rate_limited",
|
|
13362
|
+
retryAfterSec: secondsUntil(Date.parse(row.lastRunAt) + cooldownMs)
|
|
13363
|
+
};
|
|
13364
|
+
}
|
|
13365
|
+
return { status: "running", retryAfterSec: 1 };
|
|
13366
|
+
}
|
|
13367
|
+
async function finishTaskUiScriptActionRun(taskId, actionId, error) {
|
|
13368
|
+
const now = new Date().toISOString();
|
|
13369
|
+
await getDbClient2().run(`UPDATE task_ui_action_runs SET locked_until = NULL, last_run_at = ?,
|
|
13370
|
+
run_count = run_count + 1, last_error = ?, updated_at = ?
|
|
13371
|
+
WHERE task_id = ? AND action_id = ?`, [now, error === null ? null : scrubSecrets(error), now, taskId, actionId]);
|
|
13372
|
+
}
|
|
13289
13373
|
async function hasTaskUiSpecCheckRefusal(taskId) {
|
|
13290
13374
|
return Boolean(await getDbClient2().get("SELECT id FROM agent_log WHERE taskId = ? AND eventType = 'task_ui_spec_check_refused' LIMIT 1", [taskId]));
|
|
13291
13375
|
}
|
|
@@ -13301,7 +13385,14 @@ var init_task_ui_spec = __esm(() => {
|
|
|
13301
13385
|
elements: record2(string2(), unknown()),
|
|
13302
13386
|
state: record2(string2(), unknown()).optional()
|
|
13303
13387
|
}),
|
|
13304
|
-
actions: record2(string2(),
|
|
13388
|
+
actions: record2(string2(), discriminatedUnion("kind", [
|
|
13389
|
+
object2({ kind: literal2("follow_up"), prompt: string2() }),
|
|
13390
|
+
object2({
|
|
13391
|
+
kind: literal2("script"),
|
|
13392
|
+
script: string2(),
|
|
13393
|
+
args: record2(string2(), unknown()).optional()
|
|
13394
|
+
})
|
|
13395
|
+
])).optional(),
|
|
13305
13396
|
fallbackText: string2()
|
|
13306
13397
|
});
|
|
13307
13398
|
});
|
|
@@ -15204,7 +15295,7 @@ var init_dist5 = __esm(() => {
|
|
|
15204
15295
|
});
|
|
15205
15296
|
|
|
15206
15297
|
// src/utils/task-ui-spec.ts
|
|
15207
|
-
var UI_SPEC_MAX_BYTES = 32768, UI_SPEC_MAX_BLOCKS = 45, UI_SPEC_MAX_ACTIONS_ROW_ELEMENTS = 25, UI_SPEC_ACTION_PREFIX = "swarm_ui:", UI_SPEC_ACTION_ID, UI_SPEC_CARD_LIMITS;
|
|
15298
|
+
var UI_SPEC_MAX_BYTES = 32768, UI_SPEC_MAX_BLOCKS = 45, UI_SPEC_MAX_ACTIONS_ROW_ELEMENTS = 25, UI_SPEC_MAX_ACTIONS = 25, UI_SPEC_ACTION_PREFIX = "swarm_ui:", TASK_UI_SPEC_UPDATED_EVENT = "task.ui_spec_updated", UI_SPEC_ACTION_ID, UI_SPEC_CARD_LIMITS, UI_SPEC_SCRIPT_ARGS_MAX_BYTES = 4096;
|
|
15208
15299
|
var init_task_ui_spec2 = __esm(() => {
|
|
15209
15300
|
UI_SPEC_ACTION_ID = /^[a-z][a-z0-9_]{0,39}$/;
|
|
15210
15301
|
UI_SPEC_CARD_LIMITS = {
|
|
@@ -15873,7 +15964,7 @@ function shouldPostInlineCompletionOutput(task) {
|
|
|
15873
15964
|
return !!output && isTreeOutputTruncated(markdownToSlack(output));
|
|
15874
15965
|
}
|
|
15875
15966
|
function formatInlineCompletionOutputChunks(opts) {
|
|
15876
|
-
const header = `${completedStatusIcon()}
|
|
15967
|
+
const header = `${iconPrefix(completedStatusIcon())}*${opts.agentName}* completed with output (${getTaskLink(opts.taskId)}):
|
|
15877
15968
|
|
|
15878
15969
|
`;
|
|
15879
15970
|
const slackOutput = markdownToSlack(opts.output.trim());
|
|
@@ -15955,7 +16046,7 @@ async function sendTaskResponse(task) {
|
|
|
15955
16046
|
await sendWithPersona(client, {
|
|
15956
16047
|
channel: task.slackChannelId,
|
|
15957
16048
|
thread_ts: task.slackThreadTs,
|
|
15958
|
-
text: task.slackReplySent || i > 0 ? `${completedStatusIcon()}
|
|
16049
|
+
text: task.slackReplySent || i > 0 ? `${iconPrefix(completedStatusIcon())}${agentName} completed${i > 0 ? ` (continued ${i + 1}/${blockBatches.length})` : ""}` : body,
|
|
15959
16050
|
username: getAgentDisplayName(agent),
|
|
15960
16051
|
icon: getAgentSlackIcon(agent),
|
|
15961
16052
|
blocks: blockBatches[i]
|
|
@@ -16071,7 +16162,7 @@ async function updateToFinal(task, messageTs) {
|
|
|
16071
16162
|
};
|
|
16072
16163
|
completionBlockBatches = buildCompletedBlockBatches(completionOpts);
|
|
16073
16164
|
blocks = completionBlockBatches[0] ?? buildCompletedBlocks(completionOpts);
|
|
16074
|
-
text = task.slackReplySent ? `${completedStatusIcon()}
|
|
16165
|
+
text = task.slackReplySent ? `${iconPrefix(completedStatusIcon())}${agentName} completed` : body;
|
|
16075
16166
|
} else if (task.status === "cancelled") {
|
|
16076
16167
|
blocks = buildCancelledBlocks({ agentName, taskId: task.id });
|
|
16077
16168
|
text = "Task cancelled";
|
|
@@ -16095,7 +16186,7 @@ async function updateToFinal(task, messageTs) {
|
|
|
16095
16186
|
await sendWithPersona(app.client, {
|
|
16096
16187
|
channel: task.slackChannelId,
|
|
16097
16188
|
thread_ts: task.slackThreadTs ?? messageTs,
|
|
16098
|
-
text: `${completedStatusIcon()}
|
|
16189
|
+
text: `${iconPrefix(completedStatusIcon())}${agentName} completed (continued ${i + 1}/${completionBlockBatches.length})`,
|
|
16099
16190
|
username: getAgentDisplayName(agent),
|
|
16100
16191
|
icon: getAgentSlackIcon(agent),
|
|
16101
16192
|
blocks: completionBlockBatches[i]
|
|
@@ -16183,7 +16274,7 @@ var isDev, MAX_INLINE_OUTPUT_BLOCKS_PER_MESSAGE = 10;
|
|
|
16183
16274
|
var init_responses = __esm(() => {
|
|
16184
16275
|
init_db4();
|
|
16185
16276
|
init_fallback();
|
|
16186
|
-
|
|
16277
|
+
init_app4();
|
|
16187
16278
|
init_blocks();
|
|
16188
16279
|
init_reaction_shortcode();
|
|
16189
16280
|
init_task_attachments();
|
|
@@ -16462,7 +16553,7 @@ var init_session_status = __esm(() => {
|
|
|
16462
16553
|
init_db4();
|
|
16463
16554
|
init_types5();
|
|
16464
16555
|
init_secret_scrubber();
|
|
16465
|
-
|
|
16556
|
+
init_app4();
|
|
16466
16557
|
import_bolt5 = __toESM(require_dist5(), 1);
|
|
16467
16558
|
REFRESH_MS = 30 * 60000;
|
|
16468
16559
|
callTimeoutMs = DEFAULT_CALL_TIMEOUT_MS;
|
|
@@ -16526,8 +16617,9 @@ function retryDelayMs(error, attempt) {
|
|
|
16526
16617
|
const seconds = candidate.retryAfter ?? candidate.data?.retry_after ?? 2 ** attempt;
|
|
16527
16618
|
return Math.min(Math.max(seconds * 1000, 0), MAX_RETRY_DELAY_MS);
|
|
16528
16619
|
}
|
|
16529
|
-
async function callSlackWithRetry2(client, method, payload) {
|
|
16620
|
+
async function callSlackWithRetry2(client, method, payload, beforeAttempt) {
|
|
16530
16621
|
for (let attempt = 0;; attempt++) {
|
|
16622
|
+
beforeAttempt?.();
|
|
16531
16623
|
try {
|
|
16532
16624
|
return await client.apiCall(method, payload);
|
|
16533
16625
|
} catch (error) {
|
|
@@ -16566,7 +16658,7 @@ async function checkOutcomeDeliveryGate(task, card, statusBudget) {
|
|
|
16566
16658
|
function noteOutcomeDeliverySuccess(taskId) {
|
|
16567
16659
|
outcomeDeliveryNextAttemptAt.delete(taskId);
|
|
16568
16660
|
}
|
|
16569
|
-
async function noteOutcomeDeliveryFailure(task,
|
|
16661
|
+
async function noteOutcomeDeliveryFailure(task, error, statusBudget) {
|
|
16570
16662
|
const detail = describeSlackError(error);
|
|
16571
16663
|
const summary = scrubSecrets(slackErrorSummary(error));
|
|
16572
16664
|
if (!task.slackChannelId || !task.slackThreadTs) {
|
|
@@ -16575,7 +16667,7 @@ async function noteOutcomeDeliveryFailure(task, tree, error, statusBudget) {
|
|
|
16575
16667
|
}
|
|
16576
16668
|
if (!await getSlackOutcomeMessage2(task.id)) {
|
|
16577
16669
|
await reserveSlackMessage2({
|
|
16578
|
-
contextKey: task.contextKey ??
|
|
16670
|
+
contextKey: task.contextKey ?? slackContextKey({ channelId: task.slackChannelId, threadTs: task.slackThreadTs }),
|
|
16579
16671
|
channelId: task.slackChannelId,
|
|
16580
16672
|
threadTs: task.slackThreadTs,
|
|
16581
16673
|
kind: "outcome",
|
|
@@ -16659,7 +16751,7 @@ async function taskStateGlyph(task, now, threadTasks = []) {
|
|
|
16659
16751
|
case "superseded":
|
|
16660
16752
|
return "↪️";
|
|
16661
16753
|
case "skipped":
|
|
16662
|
-
return
|
|
16754
|
+
return reactionStatusIcon("skipped");
|
|
16663
16755
|
default:
|
|
16664
16756
|
return "\uD83D\uDD52";
|
|
16665
16757
|
}
|
|
@@ -16736,7 +16828,7 @@ async function renderNodeLines(node, depth, now, isAsk, threadTasks) {
|
|
|
16736
16828
|
const duration = formatV2Duration(new Date(node.task.createdAt), terminalEnd(node.task, now));
|
|
16737
16829
|
const indent = FIGURE_SPACE.repeat(TREE_INDENT.topLevel + Math.max(0, depth - 1) * TREE_INDENT.levelStep);
|
|
16738
16830
|
const boundedPrefix = indent.length > MAX_TREE_PREFIX_LENGTH ? `${indent.slice(0, MAX_TREE_PREFIX_LENGTH - 1)}…` : indent;
|
|
16739
|
-
let line = `${boundedPrefix}↳ ${await taskStateGlyph(node.task, now, threadTasks)}
|
|
16831
|
+
let line = `${boundedPrefix}↳ ${iconPrefix(await taskStateGlyph(node.task, now, threadTasks))}${await renderNodeLabel(node, isAsk)} · ${duration} · ${getTaskLink(node.task.id)}`;
|
|
16740
16832
|
const detail = node.task.status === "skipped" ? renderSkipReason(node.task.failureReason) : isTerminalTreeStatus(node.task.status) ? undefined : renderProgress(node.task.progress);
|
|
16741
16833
|
const suffix = detail ? ` · ${detail}` : "";
|
|
16742
16834
|
if (suffix && line.length + suffix.length <= MAX_TREE_NODE_LINE_LENGTH) {
|
|
@@ -16770,7 +16862,7 @@ function threadHeaderText(tasks, now, duration) {
|
|
|
16770
16862
|
if (tasks.some((task) => isAwaitingWake(task, tasks)))
|
|
16771
16863
|
return `\uD83E\uDDF5 ⏳ waiting — ${duration}`;
|
|
16772
16864
|
const hasFailure = tasks.some((task) => task.status === "failed");
|
|
16773
|
-
return hasFailure ? `\uD83E\uDDF5 ❌ done with failures — ${duration}` : `\uD83E\uDDF5 ${completedStatusIcon()}
|
|
16865
|
+
return hasFailure ? `\uD83E\uDDF5 ❌ done with failures — ${duration}` : `\uD83E\uDDF5 ${iconPrefix(completedStatusIcon())}done — ${duration}`;
|
|
16774
16866
|
}
|
|
16775
16867
|
async function renderThreadTree(tasks, _outcomeLinks = new Map, now = new Date, _triggerLinks = new Map) {
|
|
16776
16868
|
if (tasks.length === 0)
|
|
@@ -16827,10 +16919,16 @@ async function resolvePermalink(client, channelId, ts) {
|
|
|
16827
16919
|
}
|
|
16828
16920
|
return result.permalink;
|
|
16829
16921
|
}
|
|
16830
|
-
async function ensureTreePermalink(client, tree) {
|
|
16922
|
+
async function ensureTreePermalink(client, tree, generation = slackTreeGeneration2()) {
|
|
16831
16923
|
if (tree.permalink)
|
|
16832
16924
|
return tree;
|
|
16833
|
-
const
|
|
16925
|
+
const result = await callSlackWithRetry2(client, "chat.getPermalink", {
|
|
16926
|
+
channel: tree.channelId,
|
|
16927
|
+
message_ts: tree.ts
|
|
16928
|
+
}, () => assertSlackTreeCurrent2(generation));
|
|
16929
|
+
const permalink = result.permalink;
|
|
16930
|
+
if (typeof permalink !== "string" || !permalink)
|
|
16931
|
+
throw new Error("Missing tree permalink");
|
|
16834
16932
|
return await updateSlackMessageRecord2(tree.id, { permalink, touchUpdatedAt: false }) ?? tree;
|
|
16835
16933
|
}
|
|
16836
16934
|
function physicalThreadKey(channelId, threadTs) {
|
|
@@ -16839,7 +16937,7 @@ function physicalThreadKey(channelId, threadTs) {
|
|
|
16839
16937
|
function isSlackMessageNotFound(error) {
|
|
16840
16938
|
return slackErrorCode2(error) === "message_not_found";
|
|
16841
16939
|
}
|
|
16842
|
-
async function findReservedSlackMessage(client, reservation, outcomeMarker) {
|
|
16940
|
+
async function findReservedSlackMessage(client, reservation, outcomeMarker, beforeAttempt) {
|
|
16843
16941
|
let cursor;
|
|
16844
16942
|
const oldest = Math.max(0, new Date(reservation.createdAt).getTime() / 1000 - 5);
|
|
16845
16943
|
do {
|
|
@@ -16851,7 +16949,7 @@ async function findReservedSlackMessage(client, reservation, outcomeMarker) {
|
|
|
16851
16949
|
inclusive: true,
|
|
16852
16950
|
limit: 100,
|
|
16853
16951
|
...cursor ? { cursor } : {}
|
|
16854
|
-
});
|
|
16952
|
+
}, beforeAttempt);
|
|
16855
16953
|
const messages = Array.isArray(response.messages) ? response.messages : [];
|
|
16856
16954
|
const found = messages.find((message) => {
|
|
16857
16955
|
if (!message.ts)
|
|
@@ -16879,7 +16977,9 @@ async function discardTreeRecord(tree) {
|
|
|
16879
16977
|
async function findThreadTree(contextKey, channelId, threadTs) {
|
|
16880
16978
|
return await getSlackTreeMessage2(contextKey) ?? await getSlackTreeMessageByThread2(channelId, threadTs);
|
|
16881
16979
|
}
|
|
16882
|
-
async function createThreadTree(task) {
|
|
16980
|
+
async function createThreadTree(task, generation) {
|
|
16981
|
+
const guard = () => assertSlackTreeCurrent2(generation);
|
|
16982
|
+
guard();
|
|
16883
16983
|
const app = getSlackApp2();
|
|
16884
16984
|
if (!app || !task.slackChannelId || !task.slackThreadTs)
|
|
16885
16985
|
return null;
|
|
@@ -16894,6 +16994,7 @@ async function createThreadTree(task) {
|
|
|
16894
16994
|
const tasks = await getSlackTasksInThread2(task.slackChannelId, task.slackThreadTs);
|
|
16895
16995
|
const agent = task.agentId ? await getAgentById2(task.agentId) : undefined;
|
|
16896
16996
|
const text = await renderThreadTree(tasks);
|
|
16997
|
+
guard();
|
|
16897
16998
|
const reserved = existing ? { record: existing, created: false } : await reserveSlackMessage2({
|
|
16898
16999
|
contextKey,
|
|
16899
17000
|
channelId: task.slackChannelId,
|
|
@@ -16902,7 +17003,7 @@ async function createThreadTree(task) {
|
|
|
16902
17003
|
taskId: task.id
|
|
16903
17004
|
});
|
|
16904
17005
|
const reservation = reserved.record;
|
|
16905
|
-
const reconciled = reserved.created ? undefined : await findReservedSlackMessage(app.client, reservation);
|
|
17006
|
+
const reconciled = reserved.created ? undefined : await findReservedSlackMessage(app.client, reservation, undefined, guard);
|
|
16906
17007
|
let remote = reconciled;
|
|
16907
17008
|
if (!remote) {
|
|
16908
17009
|
remote = await callSlackWithRetry2(app.client, "chat.postMessage", {
|
|
@@ -16917,21 +17018,11 @@ async function createThreadTree(task) {
|
|
|
16917
17018
|
event_type: SLACK_RENDER_METADATA_EVENT,
|
|
16918
17019
|
event_payload: { message_id: reservation.id, kind: "tree" }
|
|
16919
17020
|
}
|
|
16920
|
-
});
|
|
17021
|
+
}, guard);
|
|
16921
17022
|
}
|
|
16922
17023
|
if (typeof remote.ts !== "string" || !remote.ts) {
|
|
16923
17024
|
throw new Error("Slack did not return a timestamp for the thread tree");
|
|
16924
17025
|
}
|
|
16925
|
-
if (reconciled) {
|
|
16926
|
-
await callSlackWithRetry2(app.client, "chat.update", {
|
|
16927
|
-
channel: task.slackChannelId,
|
|
16928
|
-
ts: remote.ts,
|
|
16929
|
-
text,
|
|
16930
|
-
blocks: treeBlocks(text),
|
|
16931
|
-
unfurl_links: false,
|
|
16932
|
-
unfurl_media: false
|
|
16933
|
-
});
|
|
16934
|
-
}
|
|
16935
17026
|
let record = await bindSlackMessageTimestamp2(reservation.id, remote.ts, {
|
|
16936
17027
|
renderedThrough
|
|
16937
17028
|
});
|
|
@@ -16941,62 +17032,106 @@ async function createThreadTree(task) {
|
|
|
16941
17032
|
if (!record || isPendingSlackMessage2(record)) {
|
|
16942
17033
|
throw new Error("Failed to persist the thread tree timestamp");
|
|
16943
17034
|
}
|
|
16944
|
-
|
|
17035
|
+
guard();
|
|
17036
|
+
if (reconciled) {
|
|
17037
|
+
await callSlackWithRetry2(app.client, "chat.update", {
|
|
17038
|
+
channel: task.slackChannelId,
|
|
17039
|
+
ts: remote.ts,
|
|
17040
|
+
text,
|
|
17041
|
+
blocks: treeBlocks(text),
|
|
17042
|
+
unfurl_links: false,
|
|
17043
|
+
unfurl_media: false
|
|
17044
|
+
}, guard);
|
|
17045
|
+
}
|
|
17046
|
+
record = await ensureTreePermalink(app.client, record, generation);
|
|
16945
17047
|
lastTreeText.set(record.id, text);
|
|
16946
17048
|
lastTreeUpdateAt.set(record.id, Date.now());
|
|
16947
17049
|
return record;
|
|
16948
17050
|
}
|
|
16949
|
-
async function
|
|
17051
|
+
async function ensureSlackThreadPresentation2(taskIds, statusBudget) {
|
|
16950
17052
|
const task = (await Promise.all(taskIds.map(getTaskById2))).find((candidate) => !!candidate);
|
|
16951
17053
|
if (!task?.slackChannelId || !task.slackThreadTs)
|
|
16952
17054
|
return null;
|
|
16953
17055
|
const [tree] = await Promise.allSettled([
|
|
16954
|
-
|
|
17056
|
+
presentThreadTree(task, taskIds, statusBudget),
|
|
16955
17057
|
reconcileSlackSessionStatus({
|
|
16956
17058
|
channelId: task.slackChannelId,
|
|
16957
17059
|
threadTs: task.slackThreadTs,
|
|
16958
17060
|
budget: statusBudget
|
|
16959
17061
|
})
|
|
16960
17062
|
]);
|
|
16961
|
-
if (tree.status === "rejected")
|
|
17063
|
+
if (tree.status === "rejected") {
|
|
17064
|
+
if (tree.reason instanceof SlackTreeSuppressed2)
|
|
17065
|
+
return null;
|
|
16962
17066
|
throw tree.reason;
|
|
17067
|
+
}
|
|
16963
17068
|
return tree.value;
|
|
16964
17069
|
}
|
|
16965
|
-
async function
|
|
17070
|
+
async function presentThreadTree(task, taskIds, statusBudget) {
|
|
17071
|
+
const visibility = syncSlackTreeVisibility2();
|
|
17072
|
+
const generation = slackTreeGeneration2();
|
|
17073
|
+
const cutoff = await visibility;
|
|
17074
|
+
if (!task.slackChannelId || !task.slackThreadTs)
|
|
17075
|
+
return null;
|
|
17076
|
+
const tasks = await getSlackTasksInThread2(task.slackChannelId, task.slackThreadTs);
|
|
17077
|
+
if (isSlackTaskTreeEnabled2())
|
|
17078
|
+
assertSlackTreeCurrent2(generation);
|
|
17079
|
+
const activatedAt = await getSlackRenderV2ActivatedAt2();
|
|
17080
|
+
if (activatedAt && tasks.some((candidate) => candidate.source === "slack" && candidate.createdAt < activatedAt) && !await getSlackTreeMessageByThread2(task.slackChannelId, task.slackThreadTs))
|
|
17081
|
+
return null;
|
|
17082
|
+
if (!canPresentSlackTree2(tasks, cutoff)) {
|
|
17083
|
+
const tree = await getSlackTreeMessageByThread2(task.slackChannelId, task.slackThreadTs);
|
|
17084
|
+
if (tree)
|
|
17085
|
+
await closeSlackTreeIfSettled(tree.id);
|
|
17086
|
+
return null;
|
|
17087
|
+
}
|
|
17088
|
+
return findOrCreateThreadTree(task, task.slackChannelId, task.slackThreadTs, taskIds, statusBudget, generation);
|
|
17089
|
+
}
|
|
17090
|
+
async function findOrCreateThreadTree(task, channelId, threadTs, taskIds, statusBudget, generation) {
|
|
17091
|
+
assertSlackTreeCurrent2(generation);
|
|
16966
17092
|
const contextKey = task.contextKey ?? slackContextKey({
|
|
16967
17093
|
channelId,
|
|
16968
17094
|
threadTs
|
|
16969
17095
|
});
|
|
16970
17096
|
const existing = await findThreadTree(contextKey, channelId, threadTs);
|
|
17097
|
+
assertSlackTreeCurrent2(generation);
|
|
16971
17098
|
if (existing && !isPendingSlackMessage2(existing)) {
|
|
16972
17099
|
const app = getSlackApp2();
|
|
16973
17100
|
try {
|
|
16974
|
-
const resolved = app ? await ensureTreePermalink(app.client, existing) : existing;
|
|
17101
|
+
const resolved = app ? await ensureTreePermalink(app.client, existing, generation) : existing;
|
|
16975
17102
|
scheduleSlackTreeUpdate(resolved);
|
|
16976
17103
|
return resolved;
|
|
16977
17104
|
} catch (error) {
|
|
16978
17105
|
if (!isSlackMessageNotFound(error))
|
|
16979
17106
|
throw error;
|
|
17107
|
+
assertSlackTreeCurrent2(generation);
|
|
16980
17108
|
await discardTreeRecord(existing);
|
|
16981
|
-
return
|
|
17109
|
+
return ensureSlackThreadTree(taskIds, statusBudget);
|
|
16982
17110
|
}
|
|
16983
17111
|
}
|
|
16984
17112
|
const creationKey = physicalThreadKey(channelId, threadTs);
|
|
16985
17113
|
const inFlight = treeCreationPromises.get(creationKey);
|
|
16986
17114
|
if (inFlight)
|
|
16987
17115
|
return inFlight;
|
|
16988
|
-
const creation = createThreadTree(task).finally(() => treeCreationPromises.delete(creationKey));
|
|
17116
|
+
const creation = createThreadTree(task, generation).finally(() => treeCreationPromises.delete(creationKey));
|
|
16989
17117
|
treeCreationPromises.set(creationKey, creation);
|
|
16990
17118
|
return creation;
|
|
16991
17119
|
}
|
|
16992
17120
|
function scheduleSlackTreeUpdate(tree, delayMs = TREE_UPDATE_DEBOUNCE_MS) {
|
|
17121
|
+
if (!isSlackTaskTreeEnabled2())
|
|
17122
|
+
return;
|
|
17123
|
+
const generation = slackTreeGeneration2();
|
|
16993
17124
|
const existing = pendingTreeUpdates.get(tree.id);
|
|
16994
17125
|
if (existing)
|
|
16995
17126
|
clearTimeout(existing);
|
|
16996
17127
|
pendingTreeUpdates.set(tree.id, setTimeout(() => {
|
|
16997
17128
|
pendingTreeUpdates.delete(tree.id);
|
|
17129
|
+
if (generation !== slackTreeGeneration2() || !isSlackTaskTreeEnabled2())
|
|
17130
|
+
return;
|
|
16998
17131
|
updateThreadTree(tree).catch((error) => {
|
|
16999
|
-
|
|
17132
|
+
if (error instanceof SlackTreeSuppressed2)
|
|
17133
|
+
return;
|
|
17134
|
+
console.error(`[Slack] Failed to run debounced v2 tree update ${tree.id}:`, scrubSecrets(String(error)));
|
|
17000
17135
|
});
|
|
17001
17136
|
}, Math.max(0, delayMs)));
|
|
17002
17137
|
}
|
|
@@ -17016,10 +17151,13 @@ async function withTreeUpdateLock(channelId, threadTs, work) {
|
|
|
17016
17151
|
async function replaceMissingTree(tree, statusBudget) {
|
|
17017
17152
|
await discardTreeRecord(tree);
|
|
17018
17153
|
const taskIds = (await getSlackTasksInThread2(tree.channelId, tree.threadTs)).map((task) => task.id);
|
|
17019
|
-
return taskIds.length > 0 ?
|
|
17154
|
+
return taskIds.length > 0 ? ensureSlackThreadTree(taskIds, statusBudget) : null;
|
|
17020
17155
|
}
|
|
17021
17156
|
async function updateThreadTree(tree, bypassThrottle = false, statusBudget) {
|
|
17157
|
+
const generation = slackTreeGeneration2();
|
|
17022
17158
|
const result = await withTreeUpdateLock(tree.channelId, tree.threadTs, async () => {
|
|
17159
|
+
assertSlackTreeCurrent2(generation);
|
|
17160
|
+
const cutoff = await syncSlackTreeVisibility2();
|
|
17023
17161
|
const app = getSlackApp2();
|
|
17024
17162
|
if (!app)
|
|
17025
17163
|
return "unchanged";
|
|
@@ -17030,9 +17168,10 @@ async function updateThreadTree(tree, bypassThrottle = false, statusBudget) {
|
|
|
17030
17168
|
return "pending";
|
|
17031
17169
|
const renderedThrough = new Date().toISOString();
|
|
17032
17170
|
const tasks = await getSlackTasksInThread2(current.channelId, current.threadTs);
|
|
17033
|
-
if (tasks.length === 0)
|
|
17171
|
+
if (tasks.length === 0 || !canPresentSlackTree2(tasks, cutoff))
|
|
17034
17172
|
return "unchanged";
|
|
17035
17173
|
const text = await renderThreadTree(tasks);
|
|
17174
|
+
assertSlackTreeCurrent2(generation);
|
|
17036
17175
|
const lastText = lastTreeText.get(current.id);
|
|
17037
17176
|
const lastUpdate = lastTreeUpdateAt.get(current.id) ?? 0;
|
|
17038
17177
|
if (text === lastText) {
|
|
@@ -17052,7 +17191,7 @@ async function updateThreadTree(tree, bypassThrottle = false, statusBudget) {
|
|
|
17052
17191
|
blocks: treeBlocks(text),
|
|
17053
17192
|
unfurl_links: false,
|
|
17054
17193
|
unfurl_media: false
|
|
17055
|
-
});
|
|
17194
|
+
}, () => assertSlackTreeCurrent2(generation));
|
|
17056
17195
|
} catch (error) {
|
|
17057
17196
|
if (isSlackMessageNotFound(error))
|
|
17058
17197
|
return "missing";
|
|
@@ -17064,6 +17203,7 @@ async function updateThreadTree(tree, bypassThrottle = false, statusBudget) {
|
|
|
17064
17203
|
return "updated";
|
|
17065
17204
|
});
|
|
17066
17205
|
if (result === "missing") {
|
|
17206
|
+
assertSlackTreeCurrent2(generation);
|
|
17067
17207
|
await replaceMissingTree(tree, statusBudget);
|
|
17068
17208
|
return false;
|
|
17069
17209
|
}
|
|
@@ -17079,6 +17219,8 @@ function outcomeText(value, fallback) {
|
|
|
17079
17219
|
return value?.trim() ? value : fallback;
|
|
17080
17220
|
}
|
|
17081
17221
|
function withStatusLead(lead, body) {
|
|
17222
|
+
if (!lead)
|
|
17223
|
+
return body;
|
|
17082
17224
|
const text = body.replace(/^(?:[ \t]*\r?\n)+/, "");
|
|
17083
17225
|
if (LINE_START_BLOCK.test(text))
|
|
17084
17226
|
return `${lead}
|
|
@@ -17094,12 +17236,12 @@ async function outcomeContent(task, slackReplySent) {
|
|
|
17094
17236
|
return withStatusLead("\uD83D\uDEAB **Cancelled:**", outcomeText(task.failureReason, "Task was cancelled."));
|
|
17095
17237
|
}
|
|
17096
17238
|
if (task.status === "skipped") {
|
|
17097
|
-
return withStatusLead(
|
|
17239
|
+
return withStatusLead(`${iconPrefix(reactionStatusIcon("skipped"))}**Skipped:**`, outcomeText(task.failureReason, "Task was skipped."));
|
|
17098
17240
|
}
|
|
17099
17241
|
const isDeferred = isDeferredTask(task);
|
|
17100
17242
|
if (slackReplySent && task.status === "completed" && !isDeferred) {
|
|
17101
17243
|
const agentName = task.agentId ? (await getAgentById2(task.agentId))?.name ?? "Agent" : "Agent";
|
|
17102
|
-
return `${completedStatusIcon()}
|
|
17244
|
+
return `${iconPrefix(completedStatusIcon())}${agentName} completed`;
|
|
17103
17245
|
}
|
|
17104
17246
|
if (isDeferred) {
|
|
17105
17247
|
return withStatusLead("⏳", outcomeText(slackTaskOutput(task), "Deferred."));
|
|
@@ -17115,12 +17257,12 @@ async function childOutcomeContent(task, slackReplySent) {
|
|
|
17115
17257
|
return withStatusLead(`↳ ❌ ${agentName} — failed:`, outcomeText(task.failureReason, "Task failed."));
|
|
17116
17258
|
}
|
|
17117
17259
|
if (slackReplySent && !isDeferredTask(task)) {
|
|
17118
|
-
return `↳ ${completedStatusIcon()}
|
|
17260
|
+
return `↳ ${iconPrefix(completedStatusIcon())}${agentName} completed`;
|
|
17119
17261
|
}
|
|
17120
17262
|
if (isDeferredTask(task)) {
|
|
17121
17263
|
return withStatusLead(`↳ ⏳ ${agentName} — deferred:`, outcomeText(slackTaskOutput(task), "Deferred."));
|
|
17122
17264
|
}
|
|
17123
|
-
return withStatusLead(`↳ ${completedStatusIcon()}
|
|
17265
|
+
return withStatusLead(`↳ ${iconPrefix(completedStatusIcon())}${agentName} — result:`, outcomeText(slackTaskOutput(task), "Task completed."));
|
|
17124
17266
|
}
|
|
17125
17267
|
async function isSlackContinuation(task) {
|
|
17126
17268
|
return task.source === "schedule" && task.taskType === "deferred" && !!task.slackChannelId && !!task.slackThreadTs && !!task.agentId && !!(await getAgentById2(task.agentId))?.isLead;
|
|
@@ -17142,14 +17284,14 @@ async function conclusionResultsLines(closure) {
|
|
|
17142
17284
|
const agentName = await agentDisplayNameFor(member);
|
|
17143
17285
|
const card = await getSlackOutcomeMessage2(member.id);
|
|
17144
17286
|
if (card?.permalink) {
|
|
17145
|
-
lines.push(`↳ ${glyph}
|
|
17287
|
+
lines.push(`↳ ${iconPrefix(glyph)}${agentName} — [result](${card.permalink})`);
|
|
17146
17288
|
continue;
|
|
17147
17289
|
}
|
|
17148
17290
|
const raw = outcomeText(member.status === "failed" ? member.failureReason : slackTaskOutput(member), "");
|
|
17149
17291
|
const digest = raw.length > CONCLUSION_DIGEST_LENGTH ? `${raw.slice(0, CONCLUSION_DIGEST_LENGTH).trimEnd()}…` : raw;
|
|
17150
17292
|
const citedDigest = renderTaskCitations(digest, await getTaskCitations(member.id), "slack", false);
|
|
17151
17293
|
const label = digest ? `${agentName} — ${citedDigest}` : agentName;
|
|
17152
|
-
lines.push(`↳ ${glyph}
|
|
17294
|
+
lines.push(`↳ ${iconPrefix(glyph)}${label} ${getTaskLink(member.id)}`);
|
|
17153
17295
|
}
|
|
17154
17296
|
return lines;
|
|
17155
17297
|
}
|
|
@@ -17159,7 +17301,7 @@ async function conclusionTimeoutLines(ask, closure) {
|
|
|
17159
17301
|
if (isTerminalTreeStatus(member.status))
|
|
17160
17302
|
continue;
|
|
17161
17303
|
const glyph = await taskStateGlyph(member, new Date);
|
|
17162
|
-
lines.push(`↳ ${glyph}
|
|
17304
|
+
lines.push(`↳ ${iconPrefix(glyph)}${getTaskLink(member.id)}`);
|
|
17163
17305
|
}
|
|
17164
17306
|
return lines;
|
|
17165
17307
|
}
|
|
@@ -17338,7 +17480,7 @@ async function outcomeFooter(task, tasks, duration) {
|
|
|
17338
17480
|
return [];
|
|
17339
17481
|
return [{ type: "context", elements: [{ type: "mrkdwn", text: parts.join(" · ") }] }];
|
|
17340
17482
|
}
|
|
17341
|
-
async function streamOutcomeCard(task,
|
|
17483
|
+
async function streamOutcomeCard(task, options) {
|
|
17342
17484
|
const app = getSlackApp2();
|
|
17343
17485
|
const allowInProgress = options?.conclusionKind === "timeout";
|
|
17344
17486
|
if (!app || !task.slackChannelId || !task.slackThreadTs || !isOutcomeStatus(task.status) && !(allowInProgress && task.status === "in_progress"))
|
|
@@ -17346,8 +17488,6 @@ async function streamOutcomeCard(task, tree, options) {
|
|
|
17346
17488
|
const existing = await getSlackOutcomeMessage2(task.id);
|
|
17347
17489
|
if (existing && isSettledSlackMessage2(existing))
|
|
17348
17490
|
return existing?.finalizedAt ? existing : null;
|
|
17349
|
-
if (!tree.permalink)
|
|
17350
|
-
throw new Error(`Tree ${tree.id} has no permalink`);
|
|
17351
17491
|
const tasks = await getSlackTasksInThread2(task.slackChannelId, task.slackThreadTs);
|
|
17352
17492
|
const duration = formatV2Duration(new Date(task.createdAt), terminalEnd(task, new Date));
|
|
17353
17493
|
const slackReplySent = (await getTaskById2(task.id))?.slackReplySent ?? task.slackReplySent;
|
|
@@ -17380,7 +17520,7 @@ async function streamOutcomeCard(task, tree, options) {
|
|
|
17380
17520
|
let reservationWasCreated = false;
|
|
17381
17521
|
if (!outcome) {
|
|
17382
17522
|
const reserved = await reserveSlackMessage2({
|
|
17383
|
-
contextKey: task.contextKey ??
|
|
17523
|
+
contextKey: task.contextKey ?? slackContextKey({ channelId: task.slackChannelId, threadTs: task.slackThreadTs }),
|
|
17384
17524
|
channelId: task.slackChannelId,
|
|
17385
17525
|
threadTs: task.slackThreadTs,
|
|
17386
17526
|
kind: "outcome",
|
|
@@ -17468,6 +17608,45 @@ ${uiSpec.fallbackText}` } : {},
|
|
|
17468
17608
|
conclusionKind: options?.conclusionKind
|
|
17469
17609
|
});
|
|
17470
17610
|
}
|
|
17611
|
+
async function refreshSlackOutcomeCard(taskId) {
|
|
17612
|
+
const app = getSlackApp2();
|
|
17613
|
+
if (!app)
|
|
17614
|
+
return false;
|
|
17615
|
+
const task = await getTaskById2(taskId);
|
|
17616
|
+
if (!task?.slackChannelId || !task.slackThreadTs)
|
|
17617
|
+
return false;
|
|
17618
|
+
const card = await getSlackOutcomeMessage2(task.id);
|
|
17619
|
+
if (!card?.ts || !card.finalizedAt || !isSettledSlackMessage2(card))
|
|
17620
|
+
return false;
|
|
17621
|
+
const tasks = await getSlackTasksInThread2(task.slackChannelId, task.slackThreadTs);
|
|
17622
|
+
const duration = formatV2Duration(new Date(task.createdAt), terminalEnd(task, new Date));
|
|
17623
|
+
const content = await outcomeContent(task, task.slackReplySent);
|
|
17624
|
+
const presentation = await outcomePresentation(task, content);
|
|
17625
|
+
if (!presentation)
|
|
17626
|
+
return false;
|
|
17627
|
+
const captions = [
|
|
17628
|
+
...await outcomeCaptionBlocks(task, content),
|
|
17629
|
+
...await outcomeFooter(task, tasks, duration)
|
|
17630
|
+
];
|
|
17631
|
+
const uiSpec = await outcomeUiSpec(task);
|
|
17632
|
+
await withUiSpecBlockFallback(uiSpec, task.id, (withCard) => {
|
|
17633
|
+
const text = withUiSpecFallbackText(presentation, uiSpec, withCard);
|
|
17634
|
+
const cardBlocks = withCard && uiSpec ? uiSpec.blocks : [];
|
|
17635
|
+
return callSlackWithRetry2(app.client, "chat.update", {
|
|
17636
|
+
channel: task.slackChannelId,
|
|
17637
|
+
ts: card.ts,
|
|
17638
|
+
text,
|
|
17639
|
+
blocks: [{ type: "markdown", text }, ...cardBlocks, ...captions]
|
|
17640
|
+
});
|
|
17641
|
+
});
|
|
17642
|
+
return true;
|
|
17643
|
+
}
|
|
17644
|
+
function onTaskUiSpecUpdated(data) {
|
|
17645
|
+
const taskId = data?.taskId;
|
|
17646
|
+
if (typeof taskId !== "string")
|
|
17647
|
+
return;
|
|
17648
|
+
refreshSlackOutcomeCard(taskId).catch((error) => console.error(`[Slack] Failed to refresh the card of task ${taskId}:`, error));
|
|
17649
|
+
}
|
|
17471
17650
|
async function resolvedDeferralContent(wake) {
|
|
17472
17651
|
const content = await outcomeContent(wake, wake.slackReplySent);
|
|
17473
17652
|
const presentation = await outcomePresentation(wake, content);
|
|
@@ -17559,71 +17738,38 @@ async function refreshResolvedDeferralCards() {
|
|
|
17559
17738
|
}
|
|
17560
17739
|
}
|
|
17561
17740
|
}
|
|
17562
|
-
|
|
17741
|
+
function slackOutcomeWindow(delegationEnabled, now = Date.now()) {
|
|
17742
|
+
const timeoutMs = (Number(process.env.SLACK_CONCLUSION_TIMEOUT_MIN) || 240) * 60000;
|
|
17743
|
+
const windowMs = Math.max(timeoutMs, 60 * 60000);
|
|
17744
|
+
return {
|
|
17745
|
+
finishedAfter: new Date(now - windowMs).toISOString(),
|
|
17746
|
+
closureActiveAfter: new Date(now - timeoutMs - windowMs).toISOString(),
|
|
17747
|
+
delegationEnabled
|
|
17748
|
+
};
|
|
17749
|
+
}
|
|
17750
|
+
function endedBefore(task, cutoff) {
|
|
17751
|
+
return Date.parse(task.finishedAt ?? task.lastUpdatedAt) < Date.parse(cutoff);
|
|
17752
|
+
}
|
|
17753
|
+
async function isWakeAnsweredByReply(task) {
|
|
17754
|
+
if (!task.slackChannelId || !task.slackThreadTs)
|
|
17755
|
+
return false;
|
|
17756
|
+
if ((await getTaskById2(task.id))?.slackReplySent)
|
|
17757
|
+
return true;
|
|
17758
|
+
return slackThreadHasBotReplySince(task.slackChannelId, task.slackThreadTs, task.createdAt, task.id);
|
|
17759
|
+
}
|
|
17760
|
+
async function processSlackThread(thread, {
|
|
17761
|
+
activatedAt,
|
|
17762
|
+
delegationEnabled,
|
|
17763
|
+
delegationActivatedAt,
|
|
17764
|
+
outcomeWindow,
|
|
17765
|
+
statusTick
|
|
17766
|
+
}) {
|
|
17563
17767
|
if (!isSlackRenderV2Enabled2())
|
|
17564
17768
|
return "stop";
|
|
17565
|
-
|
|
17566
|
-
const
|
|
17567
|
-
if (
|
|
17568
|
-
|
|
17569
|
-
const recovered = await ensureSlackThreadTree2(initialTasks.map((task) => task.id), statusTick.budget);
|
|
17570
|
-
if (!recovered)
|
|
17571
|
-
return "skipped";
|
|
17572
|
-
tree = recovered;
|
|
17573
|
-
} catch (error) {
|
|
17574
|
-
console.error(`[Slack] Failed to recover pending v2 tree ${tree.id}:`, error);
|
|
17575
|
-
return "skipped";
|
|
17576
|
-
}
|
|
17577
|
-
}
|
|
17578
|
-
const app = getSlackApp2();
|
|
17579
|
-
if (app && !tree.permalink) {
|
|
17580
|
-
try {
|
|
17581
|
-
tree = await ensureTreePermalink(app.client, tree);
|
|
17582
|
-
} catch (error) {
|
|
17583
|
-
if (isSlackMessageNotFound(error)) {
|
|
17584
|
-
try {
|
|
17585
|
-
await replaceMissingTree(tree, statusTick.budget);
|
|
17586
|
-
} catch (replacementError) {
|
|
17587
|
-
console.error(`[Slack] Failed to replace missing v2 tree ${tree.id}:`, replacementError);
|
|
17588
|
-
}
|
|
17589
|
-
return "skipped";
|
|
17590
|
-
}
|
|
17591
|
-
console.error(`[Slack] Failed to resolve v2 tree permalink ${tree.id}:`, error);
|
|
17592
|
-
return "skipped";
|
|
17593
|
-
}
|
|
17594
|
-
}
|
|
17595
|
-
let tasks = await getSlackTasksInThread2(tree.channelId, tree.threadTs);
|
|
17596
|
-
let needsOutcome = false;
|
|
17597
|
-
for (const task of tasks) {
|
|
17598
|
-
const card = await getSlackOutcomeMessage2(task.id);
|
|
17599
|
-
if (card && isSettledSlackMessage2(card))
|
|
17600
|
-
continue;
|
|
17601
|
-
const isDirectCandidate = await taskNeedsDirectOutcome(task, activatedAt) && isOutcomeStatus(task.status) && !await isAnsweredByDeferralCard(task, tasks);
|
|
17602
|
-
const isChildCandidate = delegationEnabled && delegationActivatedAt !== null && isChildCardCandidate(task, delegationActivatedAt) && !task.slackReplySent;
|
|
17603
|
-
if (isDirectCandidate || isChildCandidate) {
|
|
17604
|
-
needsOutcome = true;
|
|
17605
|
-
break;
|
|
17606
|
-
}
|
|
17607
|
-
}
|
|
17608
|
-
if (needsOutcome && app) {
|
|
17609
|
-
try {
|
|
17610
|
-
await resolvePermalink(app.client, tree.channelId, tree.ts);
|
|
17611
|
-
} catch (error) {
|
|
17612
|
-
if (!isSlackMessageNotFound(error)) {
|
|
17613
|
-
console.error(`[Slack] Failed to verify v2 tree ${tree.id}:`, error);
|
|
17614
|
-
return "skipped";
|
|
17615
|
-
}
|
|
17616
|
-
try {
|
|
17617
|
-
const replacement = await replaceMissingTree(tree, statusTick.budget);
|
|
17618
|
-
if (!replacement)
|
|
17619
|
-
return "skipped";
|
|
17620
|
-
tree = replacement;
|
|
17621
|
-
tasks = await getSlackTasksInThread2(tree.channelId, tree.threadTs);
|
|
17622
|
-
} catch (replacementError) {
|
|
17623
|
-
console.error(`[Slack] Failed to replace missing v2 tree ${tree.id}:`, replacementError);
|
|
17624
|
-
return "skipped";
|
|
17625
|
-
}
|
|
17626
|
-
}
|
|
17769
|
+
const tasks = await getSlackTasksInThread2(thread.channelId, thread.threadTs);
|
|
17770
|
+
const existingTree = await getSlackTreeMessageByThread2(thread.channelId, thread.threadTs);
|
|
17771
|
+
if (!existingTree && !tasks.some((task) => task.source === "slack" && task.createdAt >= activatedAt && !["backlog", "unassigned", "superseded"].includes(task.status))) {
|
|
17772
|
+
return "closed";
|
|
17627
17773
|
}
|
|
17628
17774
|
const settleSec = Number(process.env.SLACK_CONCLUSION_SETTLE_SEC) || 10;
|
|
17629
17775
|
const timeoutMin = Number(process.env.SLACK_CONCLUSION_TIMEOUT_MIN) || 240;
|
|
@@ -17663,6 +17809,8 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17663
17809
|
const card = await getSlackOutcomeMessage2(task.id);
|
|
17664
17810
|
if (card && isSettledSlackMessage2(card))
|
|
17665
17811
|
continue;
|
|
17812
|
+
if (!card && endedBefore(task, outcomeWindow.finishedAfter))
|
|
17813
|
+
continue;
|
|
17666
17814
|
if (!delegationEnabled || delegationActivatedAt === null)
|
|
17667
17815
|
continue;
|
|
17668
17816
|
if (!isChildCardCandidate(task, delegationActivatedAt) || task.slackReplySent)
|
|
@@ -17678,7 +17826,7 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17678
17826
|
if (!await checkOutcomeDeliveryGate(task, card, statusTick.budget))
|
|
17679
17827
|
continue;
|
|
17680
17828
|
try {
|
|
17681
|
-
const outcome = await streamOutcomeCard(task,
|
|
17829
|
+
const outcome = await streamOutcomeCard(task, {
|
|
17682
17830
|
buildContent: childOutcomeContent,
|
|
17683
17831
|
statusBudget: statusTick.budget
|
|
17684
17832
|
});
|
|
@@ -17691,7 +17839,7 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17691
17839
|
}
|
|
17692
17840
|
outcomeCreated ||= !!outcome;
|
|
17693
17841
|
} catch (error) {
|
|
17694
|
-
await noteOutcomeDeliveryFailure(task,
|
|
17842
|
+
await noteOutcomeDeliveryFailure(task, error, statusTick.budget);
|
|
17695
17843
|
}
|
|
17696
17844
|
}
|
|
17697
17845
|
for (const task of tasks) {
|
|
@@ -17706,21 +17854,30 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17706
17854
|
continue;
|
|
17707
17855
|
const deferByClosure = task.source === "slack" && delegationEnabled && delegationActivatedAt !== null && task.createdAt >= delegationActivatedAt;
|
|
17708
17856
|
if (!deferByClosure) {
|
|
17857
|
+
if (!card && await isSlackContinuation(task) && await isWakeAnsweredByReply(task)) {
|
|
17858
|
+
await finalizeTerminalSlackReactions([task]);
|
|
17859
|
+
continue;
|
|
17860
|
+
}
|
|
17861
|
+
if (!card && endedBefore(task, outcomeWindow.finishedAfter))
|
|
17862
|
+
continue;
|
|
17709
17863
|
if (!await checkOutcomeDeliveryGate(task, card, statusTick.budget))
|
|
17710
17864
|
continue;
|
|
17711
17865
|
try {
|
|
17712
|
-
const outcome = await streamOutcomeCard(task,
|
|
17866
|
+
const outcome = await streamOutcomeCard(task, { statusBudget: statusTick.budget });
|
|
17713
17867
|
if (outcome) {
|
|
17714
17868
|
noteOutcomeDeliverySuccess(task.id);
|
|
17715
17869
|
await finalizeTerminalSlackReactions([task]);
|
|
17716
17870
|
}
|
|
17717
17871
|
outcomeCreated ||= !!outcome;
|
|
17718
17872
|
} catch (error) {
|
|
17719
|
-
await noteOutcomeDeliveryFailure(task,
|
|
17873
|
+
await noteOutcomeDeliveryFailure(task, error, statusTick.budget);
|
|
17720
17874
|
}
|
|
17721
17875
|
continue;
|
|
17722
17876
|
}
|
|
17723
17877
|
const closure = closuresByAskId.get(task.id) ?? buildAskClosure(task, tasks);
|
|
17878
|
+
const quietSince = Math.max(...[task, ...closure].map((m) => Date.parse(m.lastUpdatedAt)));
|
|
17879
|
+
if (!card && quietSince < Date.parse(outcomeWindow.closureActiveAfter))
|
|
17880
|
+
continue;
|
|
17724
17881
|
let childCardPending = false;
|
|
17725
17882
|
const existingChildCards = await childCardCountFor(task.id);
|
|
17726
17883
|
for (const member of closure) {
|
|
@@ -17729,6 +17886,8 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17729
17886
|
if (existingChildCards >= CHILD_CARDS_PER_ASK)
|
|
17730
17887
|
break;
|
|
17731
17888
|
const memberCard = await getSlackOutcomeMessage2(member.id);
|
|
17889
|
+
if (!memberCard && endedBefore(member, outcomeWindow.finishedAfter))
|
|
17890
|
+
continue;
|
|
17732
17891
|
if (!memberCard || !isSettledSlackMessage2(memberCard)) {
|
|
17733
17892
|
childCardPending = true;
|
|
17734
17893
|
break;
|
|
@@ -17742,7 +17901,7 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17742
17901
|
if (!await checkOutcomeDeliveryGate(task, card, statusTick.budget))
|
|
17743
17902
|
continue;
|
|
17744
17903
|
try {
|
|
17745
|
-
const outcome = await streamOutcomeCard(task,
|
|
17904
|
+
const outcome = await streamOutcomeCard(task, {
|
|
17746
17905
|
buildContent: (_t, slackReplySent) => askConclusionContent(task, closure, state, slackReplySent),
|
|
17747
17906
|
conclusionKind: state === "timedOut" ? "timeout" : "complete",
|
|
17748
17907
|
statusBudget: statusTick.budget
|
|
@@ -17759,22 +17918,22 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17759
17918
|
}
|
|
17760
17919
|
outcomeCreated ||= !!outcome;
|
|
17761
17920
|
} catch (error) {
|
|
17762
|
-
await noteOutcomeDeliveryFailure(task,
|
|
17921
|
+
await noteOutcomeDeliveryFailure(task, error, statusTick.budget);
|
|
17763
17922
|
}
|
|
17764
17923
|
}
|
|
17765
17924
|
try {
|
|
17766
|
-
await
|
|
17767
|
-
|
|
17768
|
-
|
|
17769
|
-
|
|
17770
|
-
|
|
17771
|
-
try {
|
|
17772
|
-
if (await closeSlackTreeIfSettled(tree.id))
|
|
17773
|
-
return "closed";
|
|
17925
|
+
const tree = await ensureSlackThreadPresentation2(tasks.map((task) => task.id), statusTick.budget);
|
|
17926
|
+
if (tree) {
|
|
17927
|
+
await updateThreadTree(tree, outcomeCreated, statusTick.budget);
|
|
17928
|
+
await closeSlackTreeIfSettled(tree.id);
|
|
17929
|
+
}
|
|
17774
17930
|
} catch (error) {
|
|
17775
|
-
|
|
17931
|
+
if (!(error instanceof SlackTreeSuppressed2)) {
|
|
17932
|
+
console.error("[Slack] Failed to present v2 tree:", scrubSecrets(String(error)));
|
|
17933
|
+
}
|
|
17776
17934
|
}
|
|
17777
|
-
|
|
17935
|
+
await statusTick.reconcile(thread.channelId, thread.threadTs);
|
|
17936
|
+
return await slackThreadHasOutcomeWork(thread, outcomeWindow) ? "open" : "closed";
|
|
17778
17937
|
}
|
|
17779
17938
|
function yieldToEventLoop() {
|
|
17780
17939
|
return new Promise((resolve) => setImmediate(resolve));
|
|
@@ -17811,13 +17970,16 @@ function startSlackRenderV2Events2() {
|
|
|
17811
17970
|
return;
|
|
17812
17971
|
for (const event of SLACK_RENDER_TASK_EVENTS)
|
|
17813
17972
|
workflowEventBus2.on(event, onSlackRenderTaskEvent);
|
|
17973
|
+
workflowEventBus2.on(TASK_UI_SPEC_UPDATED_EVENT, onTaskUiSpecUpdated);
|
|
17814
17974
|
renderEventsSubscribed = true;
|
|
17815
17975
|
}
|
|
17816
17976
|
function stopSlackRenderV2Events2() {
|
|
17977
|
+
invalidateSlackTreeOperations2();
|
|
17817
17978
|
if (!renderEventsSubscribed)
|
|
17818
17979
|
return;
|
|
17819
17980
|
for (const event of SLACK_RENDER_TASK_EVENTS)
|
|
17820
17981
|
workflowEventBus2.off(event, onSlackRenderTaskEvent);
|
|
17982
|
+
workflowEventBus2.off(TASK_UI_SPEC_UPDATED_EVENT, onTaskUiSpecUpdated);
|
|
17821
17983
|
renderEventsSubscribed = false;
|
|
17822
17984
|
if (dirtyFlushTimer)
|
|
17823
17985
|
clearTimeout(dirtyFlushTimer);
|
|
@@ -17837,6 +17999,7 @@ function runExclusive(work) {
|
|
|
17837
17999
|
return run;
|
|
17838
18000
|
}
|
|
17839
18001
|
async function beginRenderPass() {
|
|
18002
|
+
await syncSlackTreeVisibility2();
|
|
17840
18003
|
const activatedAt = await ensureSlackRenderV2Activation2();
|
|
17841
18004
|
const delegationEnabled = isSlackDelegationEnabled();
|
|
17842
18005
|
const delegationActivatedAt = delegationEnabled ? await ensureSlackDelegationActivation2() : null;
|
|
@@ -17844,6 +18007,7 @@ async function beginRenderPass() {
|
|
|
17844
18007
|
activatedAt,
|
|
17845
18008
|
delegationEnabled,
|
|
17846
18009
|
delegationActivatedAt,
|
|
18010
|
+
outcomeWindow: slackOutcomeWindow(delegationEnabled),
|
|
17847
18011
|
statusTick: beginSlackStatusTick()
|
|
17848
18012
|
};
|
|
17849
18013
|
}
|
|
@@ -17863,23 +18027,10 @@ function processSlackRenderV22() {
|
|
|
17863
18027
|
return runExclusive(reconcileAllThreads);
|
|
17864
18028
|
}
|
|
17865
18029
|
async function reconcileAllThreads() {
|
|
17866
|
-
dirtyTaskIds.clear();
|
|
17867
|
-
dirtyThreads.clear();
|
|
17868
18030
|
const context = await beginRenderPass();
|
|
17869
|
-
|
|
17870
|
-
|
|
17871
|
-
|
|
17872
|
-
if (!task.slackChannelId || !task.slackThreadTs)
|
|
17873
|
-
continue;
|
|
17874
|
-
try {
|
|
17875
|
-
await ensureSlackThreadTree2([task.id], context.statusTick.budget);
|
|
17876
|
-
} catch (error) {
|
|
17877
|
-
console.error(`[Slack] Failed to create v2 tree for task ${task.id}:`, error);
|
|
17878
|
-
}
|
|
17879
|
-
}
|
|
17880
|
-
await yieldToEventLoop();
|
|
17881
|
-
for (const storedTree of await getSlackTreeMessages2()) {
|
|
17882
|
-
if (await renderStoredTree(storedTree, context) === "stop")
|
|
18031
|
+
const threads = await getSlackProcessingThreads(context.delegationEnabled, isSlackTaskTreeEnabled2(), context.outcomeWindow);
|
|
18032
|
+
for (const thread of threads) {
|
|
18033
|
+
if (await processSlackThread(thread, context) === "stop")
|
|
17883
18034
|
return;
|
|
17884
18035
|
await yieldToEventLoop();
|
|
17885
18036
|
}
|
|
@@ -17902,27 +18053,18 @@ async function renderDirtyThreads() {
|
|
|
17902
18053
|
for (const thread of threads.values()) {
|
|
17903
18054
|
if (!isSlackRenderV2Enabled2())
|
|
17904
18055
|
return;
|
|
17905
|
-
|
|
17906
|
-
|
|
17907
|
-
|
|
17908
|
-
|
|
17909
|
-
|
|
17910
|
-
}
|
|
17911
|
-
}
|
|
17912
|
-
for (const storedTree of await getSlackTreeMessages2({ thread })) {
|
|
17913
|
-
const result = await renderStoredTree(storedTree, context);
|
|
17914
|
-
if (result === "stop")
|
|
17915
|
-
return;
|
|
17916
|
-
if (result !== "closed" && await slackThreadHasOutcomeWork(thread)) {
|
|
17917
|
-
markSlackThreadDirty(thread.channelId, thread.threadTs, DIRTY_REVISIT_MS);
|
|
17918
|
-
}
|
|
18056
|
+
const result = await processSlackThread(thread, context);
|
|
18057
|
+
if (result === "stop")
|
|
18058
|
+
return;
|
|
18059
|
+
if (result === "open") {
|
|
18060
|
+
markSlackThreadDirty(thread.channelId, thread.threadTs, DIRTY_REVISIT_MS);
|
|
17919
18061
|
}
|
|
17920
18062
|
await yieldToEventLoop();
|
|
17921
18063
|
}
|
|
17922
18064
|
if (touched.wakeTouched)
|
|
17923
18065
|
await refreshResolvedDeferralCards();
|
|
17924
18066
|
}
|
|
17925
|
-
var TREE_UPDATE_DEBOUNCE_MS = 500, TREE_UPDATE_MIN_INTERVAL_MS = 3000, MAX_SLACK_RETRIES = 3, MAX_RETRY_DELAY_MS = 30000, MAX_TITLE_LENGTH = 72, MAX_OUTCOME_MARKDOWN_LENGTH = 12000, MAX_TREE_NODE_LINE_LENGTH = 1000, MAX_TREE_PREFIX_LENGTH = 120, MAX_TREE_PROGRESS_LENGTH = 60, CHILD_CARDS_PER_TICK = 3, CHILD_CARDS_PER_ASK = 10, CONCLUSION_DIGEST_LENGTH = 300, TREE_INDENT, FIGURE_SPACE = " ", SLACK_RENDER_METADATA_EVENT = "agent_swarm_render_v2", treeCreationPromises, pendingTreeUpdates, treeUpdateTails, lastTreeText, lastTreeUpdateAt, cachedTeamId, OUTCOME_DELIVERY_MAX_ATTEMPTS = 5, OUTCOME_DELIVERY_BASE_DELAY_MS = 30000, OUTCOME_DELIVERY_MAX_DELAY_MS, outcomeDeliveryNextAttemptAt, outcomeReservedWithoutAttempt, LINE_START_BLOCK, UI_SPEC_BLOCK_REJECTION_CODES, TRANSIENT_SLACK_ERROR_CODES, DEFERRAL_REFRESH_MAX_ATTEMPTS = 5, deferralRefreshAttempts, SLACK_RENDER_TASK_EVENTS, DIRTY_FLUSH_DEBOUNCE_MS = 500, DIRTY_REVISIT_MS = 3000, dirtyTaskIds, dirtyThreads, renderInFlight = null, renderEventsSubscribed = false, dirtyFlushTimer = null, dirtyFlushAt = 0;
|
|
18067
|
+
var TREE_UPDATE_DEBOUNCE_MS = 500, TREE_UPDATE_MIN_INTERVAL_MS = 3000, MAX_SLACK_RETRIES = 3, MAX_RETRY_DELAY_MS = 30000, MAX_TITLE_LENGTH = 72, MAX_OUTCOME_MARKDOWN_LENGTH = 12000, MAX_TREE_NODE_LINE_LENGTH = 1000, MAX_TREE_PREFIX_LENGTH = 120, MAX_TREE_PROGRESS_LENGTH = 60, CHILD_CARDS_PER_TICK = 3, CHILD_CARDS_PER_ASK = 10, CONCLUSION_DIGEST_LENGTH = 300, TREE_INDENT, FIGURE_SPACE = " ", SLACK_RENDER_METADATA_EVENT = "agent_swarm_render_v2", treeCreationPromises, pendingTreeUpdates, treeUpdateTails, lastTreeText, lastTreeUpdateAt, cachedTeamId, OUTCOME_DELIVERY_MAX_ATTEMPTS = 5, OUTCOME_DELIVERY_BASE_DELAY_MS = 30000, OUTCOME_DELIVERY_MAX_DELAY_MS, outcomeDeliveryNextAttemptAt, outcomeReservedWithoutAttempt, ensureSlackThreadTree, LINE_START_BLOCK, UI_SPEC_BLOCK_REJECTION_CODES, TRANSIENT_SLACK_ERROR_CODES, DEFERRAL_REFRESH_MAX_ATTEMPTS = 5, deferralRefreshAttempts, SLACK_RENDER_TASK_EVENTS, DIRTY_FLUSH_DEBOUNCE_MS = 500, DIRTY_REVISIT_MS = 3000, dirtyTaskIds, dirtyThreads, renderInFlight = null, renderEventsSubscribed = false, dirtyFlushTimer = null, dirtyFlushAt = 0;
|
|
17926
18068
|
var init_render_v2 = __esm(() => {
|
|
17927
18069
|
init_db4();
|
|
17928
18070
|
init_slack_trees();
|
|
@@ -17935,9 +18077,10 @@ var init_render_v2 = __esm(() => {
|
|
|
17935
18077
|
init_secret_scrubber();
|
|
17936
18078
|
init_task_attachment_links();
|
|
17937
18079
|
init_task_citations();
|
|
18080
|
+
init_task_ui_spec2();
|
|
17938
18081
|
init_event_bus();
|
|
17939
18082
|
init_ack();
|
|
17940
|
-
|
|
18083
|
+
init_app4();
|
|
17941
18084
|
init_blocks();
|
|
17942
18085
|
init_closure();
|
|
17943
18086
|
init_reaction_shortcode();
|
|
@@ -17945,15 +18088,22 @@ var init_render_v2 = __esm(() => {
|
|
|
17945
18088
|
init_session_status();
|
|
17946
18089
|
init_task_attachments();
|
|
17947
18090
|
init_task_output();
|
|
18091
|
+
init_tree_visibility();
|
|
17948
18092
|
TREE_INDENT = { topLevel: 1, levelStep: 3 };
|
|
17949
18093
|
treeCreationPromises = new Map;
|
|
17950
18094
|
pendingTreeUpdates = new Map;
|
|
17951
18095
|
treeUpdateTails = new Map;
|
|
17952
18096
|
lastTreeText = new Map;
|
|
17953
18097
|
lastTreeUpdateAt = new Map;
|
|
18098
|
+
onSlackTreeInvalidated2(() => {
|
|
18099
|
+
for (const timer of pendingTreeUpdates.values())
|
|
18100
|
+
clearTimeout(timer);
|
|
18101
|
+
pendingTreeUpdates.clear();
|
|
18102
|
+
});
|
|
17954
18103
|
OUTCOME_DELIVERY_MAX_DELAY_MS = 30 * 60000;
|
|
17955
18104
|
outcomeDeliveryNextAttemptAt = new Map;
|
|
17956
18105
|
outcomeReservedWithoutAttempt = new Set;
|
|
18106
|
+
ensureSlackThreadTree = ensureSlackThreadPresentation2;
|
|
17957
18107
|
LINE_START_BLOCK = /^(?:`{3}|~{3}|[-*+]\s|\d+[.)]\s|>|#{1,6}\s|\||(?:-{3,}|\*{3,}|_{3,})[ \t]*(?:\r?\n|$)|(?: {4}|\t))/;
|
|
17958
18108
|
UI_SPEC_BLOCK_REJECTION_CODES = new Set([
|
|
17959
18109
|
"invalid_blocks",
|
|
@@ -18551,7 +18701,7 @@ var init_watcher = __esm(() => {
|
|
|
18551
18701
|
init_db4();
|
|
18552
18702
|
init_event_loop_lag();
|
|
18553
18703
|
init_ack();
|
|
18554
|
-
|
|
18704
|
+
init_app4();
|
|
18555
18705
|
init_blocks();
|
|
18556
18706
|
init_render_v2();
|
|
18557
18707
|
init_responses();
|
|
@@ -18772,17 +18922,17 @@ async function initSlackApp2() {
|
|
|
18772
18922
|
created.use(slackInboundOutcomeMiddleware(config.mode === "http" ? "http" : "socket"));
|
|
18773
18923
|
if (config.mode === "http")
|
|
18774
18924
|
created.use(ignoreSelfAsIgnored);
|
|
18775
|
-
const { registerMessageHandler } = await import("./handlers-
|
|
18776
|
-
const { registerCommandHandler } = await import("./commands-
|
|
18777
|
-
const { registerActionHandlers } = await import("./actions-
|
|
18778
|
-
const { registerWorkObjectHandlers } = await import("./work-objects-
|
|
18925
|
+
const { registerMessageHandler } = await import("./handlers-g5jq0e4q.js");
|
|
18926
|
+
const { registerCommandHandler } = await import("./commands-ctey7tr5.js");
|
|
18927
|
+
const { registerActionHandlers } = await import("./actions-4nxq386s.js");
|
|
18928
|
+
const { registerWorkObjectHandlers } = await import("./work-objects-4ahy5es5.js");
|
|
18779
18929
|
registerMessageHandler(created);
|
|
18780
18930
|
registerCommandHandler(created);
|
|
18781
18931
|
registerActionHandlers(created);
|
|
18782
18932
|
registerWorkObjectHandlers(created);
|
|
18783
|
-
const { createAssistant } = await import("./assistant-
|
|
18933
|
+
const { createAssistant } = await import("./assistant-9g5jzq25.js");
|
|
18784
18934
|
created.assistant(createAssistant());
|
|
18785
|
-
const { isBlockExternalEnabled, scanExternalChannelsOnBoot } = await import("./external-channel-
|
|
18935
|
+
const { isBlockExternalEnabled, scanExternalChannelsOnBoot } = await import("./external-channel-ezer7pk0.js");
|
|
18786
18936
|
if (isBlockExternalEnabled()) {
|
|
18787
18937
|
scanExternalChannelsOnBoot(created.client).catch((error) => {
|
|
18788
18938
|
console.error("[Slack] External channel boot scan failed:", error);
|
|
@@ -18810,7 +18960,7 @@ async function startSlackApp2() {
|
|
|
18810
18960
|
startRetryAttempt = 0;
|
|
18811
18961
|
if (!httpReceiver)
|
|
18812
18962
|
startSocketWatchdog();
|
|
18813
|
-
const { isSlackRenderV2Enabled } = await import("./render-v2-
|
|
18963
|
+
const { isSlackRenderV2Enabled } = await import("./render-v2-j7qggj8h.js");
|
|
18814
18964
|
if (isSlackRenderV2Enabled())
|
|
18815
18965
|
await ensureSlackRenderV2Activation2();
|
|
18816
18966
|
await recoverSlackInboundAfterRestart();
|
|
@@ -18826,7 +18976,7 @@ async function startSlackApp2() {
|
|
|
18826
18976
|
} else {
|
|
18827
18977
|
console.log("[Slack] Bot connected via Socket Mode");
|
|
18828
18978
|
}
|
|
18829
|
-
const { restoreBufferedSlackMessages } = await import("./thread-buffer-
|
|
18979
|
+
const { restoreBufferedSlackMessages } = await import("./thread-buffer-nf55vwx3.js");
|
|
18830
18980
|
await restoreBufferedSlackMessages().catch((error) => {
|
|
18831
18981
|
console.error("[Slack] Failed to restore buffered thread messages:", error);
|
|
18832
18982
|
});
|
|
@@ -18901,6 +19051,7 @@ async function stopSlackAppUnderLifecycleLock2() {
|
|
|
18901
19051
|
await teardownSlackApp();
|
|
18902
19052
|
}
|
|
18903
19053
|
async function teardownSlackApp() {
|
|
19054
|
+
invalidateSlackTreeOperations2();
|
|
18904
19055
|
const stopping = detachSlackApp();
|
|
18905
19056
|
if (stopping) {
|
|
18906
19057
|
await stopping.stop();
|
|
@@ -18935,7 +19086,7 @@ function detachSlackApp() {
|
|
|
18935
19086
|
return detached;
|
|
18936
19087
|
}
|
|
18937
19088
|
var import_bolt6, app = null, receiver = null, httpReceiver = null, initialized2 = false, inboundDrain = null, socketFence = null, lifecycleGeneration = 0, lastSocketActivityAt = null, DEFAULT_START_RETRY_DELAYS_MS, startRetryDelaysMs, startRetryTimer = null, startRetryAttempt = 0, boltInitializedApp = null, SOCKET_EVENT_STATES, SLACK_SOCKET_WATCHDOG_DEFAULTS, watchdogTimer = null, watchdogOptions;
|
|
18938
|
-
var
|
|
19089
|
+
var init_app4 = __esm(() => {
|
|
18939
19090
|
init_db4();
|
|
18940
19091
|
init_node_env();
|
|
18941
19092
|
init_secret_scrubber();
|
|
@@ -18949,6 +19100,7 @@ var init_app3 = __esm(() => {
|
|
|
18949
19100
|
init_socket_ack();
|
|
18950
19101
|
init_socket_fence();
|
|
18951
19102
|
init_socket_mode_guard();
|
|
19103
|
+
init_tree_visibility();
|
|
18952
19104
|
init_watcher();
|
|
18953
19105
|
init_workspace_guard();
|
|
18954
19106
|
import_bolt6 = __toESM(require_dist5(), 1);
|
|
@@ -18973,4 +19125,4 @@ var init_app3 = __esm(() => {
|
|
|
18973
19125
|
watchdogOptions = SLACK_SOCKET_WATCHDOG_DEFAULTS;
|
|
18974
19126
|
});
|
|
18975
19127
|
|
|
18976
|
-
export { require_dist4, require_dist5, getSlackConnectionState, init_connection_state, noteSlackInboundSideEffect, ignoreSlackInbound, reportSlackInboundFailure, isAdmittedSlackDelivery, getSlackInboundDiagnostics, init_inbound_dispatch, runSlackLifecycleExclusive, init_lifecycle_lock, terminalReactionEvent, init_reaction_events, isPollTracingEnabled, initOtel, withSpan2, startSpan2, withSpanContext2, withRemoteContext2, injectTraceContext2, recordSessionCost2, recordDbRetentionSweep2, recordDbRetentionStatement2, init_otel, slackTaskOutput, init_task_output, ackSlackMessage, skipSlackMessageReaction, finalizeTerminalSlackReactions, init_ack, getTaskLink, getTaskUrl, markdownToSlack, buildMrkdwnSectionBlocks, buildCaptionBlock, buildCancelledBlocks, buildBufferFlushBlocks, buildTreeBlocks, init_blocks, taskCitationIssues, stripInvalidTaskCitations, taskCitationSourceGroups, renderTaskCitations, taskCitationWarnings, init_task_citations, MAX_TASK_CITATIONS, CitationInputSchema, TaskCitationSchema, upsertTaskCitations, getTaskCitations, getTaskCitationsForTasks, hasTaskCitationCheckRefusal, init_task_citations2, TaskUiSpecSchema, getTaskUiSpec, getTaskUiSpecsForTasks, upsertTaskUiSpec, reserveTaskUiActionRun, releaseTaskUiActionRun, setTaskUiActionResult, hasTaskUiSpecCheckRefusal, init_task_ui_spec, standardComponentDefinitions, CardSpecError, toCard, init_dist5, UI_SPEC_ACTION_PREFIX, UI_SPEC_ACTION_ID, UI_SPEC_CARD_LIMITS, init_task_ui_spec2, validateTaskUiSpec, init_validate2, initialize, ensure, init_business_use, withUiSpecFallback, init_fallback, getAgentDisplayName, getAgentSlackIcon, init_responses, markSlackSessionProcessing, init_session_status, isSlackRenderV2Enabled2, callSlackWithRetry2,
|
|
19128
|
+
export { require_dist4, require_dist5, getSlackConnectionState, init_connection_state, noteSlackInboundSideEffect, ignoreSlackInbound, reportSlackInboundFailure, isAdmittedSlackDelivery, getSlackInboundDiagnostics, init_inbound_dispatch, runSlackLifecycleExclusive, init_lifecycle_lock, terminalReactionEvent, init_reaction_events, isPollTracingEnabled, initOtel, withSpan2, startSpan2, withSpanContext2, withRemoteContext2, injectTraceContext2, recordSessionCost2, recordDbRetentionSweep2, recordDbRetentionStatement2, init_otel, slackTaskOutput, init_task_output, ackSlackMessage, skipSlackMessageReaction, finalizeTerminalSlackReactions, init_ack, getTaskLink, getTaskUrl, markdownToSlack, buildMrkdwnSectionBlocks, buildCaptionBlock, buildCancelledBlocks, buildBufferFlushBlocks, buildTreeBlocks, init_blocks, taskCitationIssues, stripInvalidTaskCitations, taskCitationSourceGroups, renderTaskCitations, taskCitationWarnings, init_task_citations, MAX_TASK_CITATIONS, CitationInputSchema, TaskCitationSchema, upsertTaskCitations, getTaskCitations, getTaskCitationsForTasks, hasTaskCitationCheckRefusal, init_task_citations2, TaskUiSpecSchema, getTaskUiSpec, getTaskUiSpecsForTasks, upsertTaskUiSpec, reserveTaskUiActionRun, releaseTaskUiActionRun, setTaskUiActionResult, acquireTaskUiScriptActionRun, finishTaskUiScriptActionRun, hasTaskUiSpecCheckRefusal, init_task_ui_spec, standardComponentDefinitions, CardSpecError, toCard, init_dist5, UI_SPEC_MAX_ACTIONS, UI_SPEC_ACTION_PREFIX, TASK_UI_SPEC_UPDATED_EVENT, UI_SPEC_ACTION_ID, UI_SPEC_CARD_LIMITS, UI_SPEC_SCRIPT_ARGS_MAX_BYTES, init_task_ui_spec2, validateTaskUiSpec, init_validate2, initialize, ensure, init_business_use, withUiSpecFallback, init_fallback, getAgentDisplayName, getAgentSlackIcon, init_responses, markSlackSessionProcessing, init_session_status, isSlackRenderV2Enabled2, callSlackWithRetry2, ensureSlackThreadPresentation2, slackErrorCode2, startSlackRenderV2Events2, stopSlackRenderV2Events2, processSlackRenderV22, init_render_v2, registerTreeMessage, init_watcher, getSlackApp2, getSlackHttpReceiver2, initSlackApp2, startSlackApp2, stopSlackApp2, stopSlackAppUnderLifecycleLock2, init_app4 };
|