@desplega.ai/agent-swarm 2.10.0 → 2.12.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-11m13kx4.js +16 -0
- package/dist/{acp-targets-arrwv4f0.js → acp-targets-311gcyvw.js} +9 -9
- package/dist/{actions-y0d2n1c2.js → actions-c4chgxp6.js} +27 -24
- package/dist/{agent-fs-provision-tpj7sktd.js → agent-fs-provision-0b9awm5n.js} +10 -5
- package/dist/{amp-adapter-vmmnmw8d.js → amp-adapter-r0veq6x5.js} +3 -3
- package/dist/{anthropic-messages-zdca3gv1.js → anthropic-messages-88b7s3n9.js} +177 -25
- package/dist/{app-wb7w45dq.js → app-hn5fftf5.js} +7 -6
- package/dist/{approval-notifications-7mqr6vbd.js → approval-notifications-3g6yc8nv.js} +7 -6
- package/dist/{assistant-gf60454p.js → assistant-cpjgpjvp.js} +29 -26
- package/dist/{azure-openai-responses-b3y7fz36.js → azure-openai-responses-jeaas6x0.js} +10 -10
- package/dist/{boot-args-schema-qxmd59sr.js → boot-args-schema-hce1av1h.js} +1 -1
- package/dist/{boot-reembed-5tmeskj2.js → boot-reembed-bztbxc4z.js} +1 -1
- package/dist/{boot-reembed-wb44vc3s.js → boot-reembed-d7xcym0j.js} +1 -1
- package/dist/{boot-scrub-sweep-25bxhnw4.js → boot-scrub-sweep-mkmm16gk.js} +2 -2
- package/dist/{boot-seeds-nj9za0vk.js → boot-seeds-arrkbe8t.js} +4 -4
- package/dist/{boxd-wn235q80.js → boxd-68n75y1s.js} +2 -2
- package/dist/{claude-adapter-d3krpdyb.js → claude-adapter-ykpyr5p8.js} +8 -8
- package/dist/{claude-managed-adapter-t8nfgcgz.js → claude-managed-adapter-ssg6z4bt.js} +4 -4
- package/dist/{claude-managed-setup-7y4pwd81.js → claude-managed-setup-trd59v7b.js} +4 -4
- package/dist/{claude-sdk-session-d138zy0e.js → claude-sdk-session-yjcze0j1.js} +10941 -10412
- package/dist/{cli-vq2eg24x.js → cli-01tvvtad.js} +63 -60
- package/dist/cli-04zc3f7b.js +68 -0
- package/dist/{cli-01k6wpr9.js → cli-0k1a0sde.js} +7 -7
- package/dist/{cli-j6te8keb.js → cli-0pp1yjg2.js} +8 -8
- package/dist/{cli-0b4zam62.js → cli-0vcqcwfn.js} +18 -0
- package/dist/{cli-wwp1bd3n.js → cli-12vek61e.js} +564 -97
- package/dist/{cli-rqx70rcz.js → cli-17qzb39j.js} +5 -2
- package/dist/{cli-124ntmf0.js → cli-1htmtqc2.js} +143 -63
- package/dist/{cli-3f8zbtqa.js → cli-2amwhyv2.js} +15 -11
- package/dist/{cli-7sf9sb0w.js → cli-2m6yaq6b.js} +1 -1
- package/dist/{cli-6cwr32fe.js → cli-2tw284hj.js} +422 -140
- package/dist/{cli-6ehs4mta.js → cli-2z2c4k6q.js} +18 -4
- package/dist/{cli-nstkanmx.js → cli-39qm0rtm.js} +8 -8
- package/dist/{cli-hnamkvnc.js → cli-3p288654.js} +2 -2
- package/dist/{cli-4ymxrwg5.js → cli-4dyzzkfb.js} +2 -2
- package/dist/{cli-3kd08rej.js → cli-4jjrhy48.js} +1 -1
- package/dist/{cli-kxn3747f.js → cli-4se3x6qm.js} +1 -26
- package/dist/cli-52nfye5j.js +673 -0
- package/dist/cli-55tc8cj4.js +252 -0
- package/dist/cli-5r95eqbh.js +186 -0
- package/dist/{cli-6037prsx.js → cli-5tg94mdw.js} +13 -13
- package/dist/{cli-2spnz7ye.js → cli-5x03v6en.js} +11137 -8332
- package/dist/{cli-y4ccxtz5.js → cli-5z0g0e8v.js} +153 -6
- package/dist/{cli-8y43jx2r.js → cli-6p8p2e6r.js} +16 -9
- package/dist/{cli-539h29es.js → cli-72yms3ey.js} +224 -189
- package/dist/{cli-y8p78ekx.js → cli-73q4g5nx.js} +21 -21
- package/dist/{cli-p74md7t8.js → cli-7b7rxz22.js} +13 -15
- package/dist/{cli-43ms35q9.js → cli-7wy8gbwb.js} +3 -3
- package/dist/{cli-7mv4h3sn.js → cli-7yn42w6m.js} +2 -2
- package/dist/{cli-gabsjg8x.js → cli-8hp56wat.js} +3 -2
- package/dist/cli-8mfdbdhe.js +43 -0
- package/dist/{cli-zcfpsfzf.js → cli-96234j5w.js} +3 -3
- package/dist/{cli-1z4qggfe.js → cli-9fvk9mv8.js} +30 -21
- package/dist/{cli-2rnd5j3t.js → cli-9qe5y107.js} +2 -2
- package/dist/{cli-5mpy301f.js → cli-9t7syepg.js} +1 -1
- package/dist/{cli-7cp6aa1q.js → cli-9y4tgrkf.js} +23 -177
- package/dist/{cli-7evph51z.js → cli-a49frv85.js} +2 -2
- package/dist/{cli-3aaeb78m.js → cli-agjbj5x0.js} +95 -10
- package/dist/{cli-th1dkc2v.js → cli-b93d81yg.js} +2 -2
- package/dist/{cli-qj39vrc6.js → cli-bhgrhedp.js} +1 -1
- package/dist/{cli-2xv18ywz.js → cli-bmqp0ser.js} +2 -2
- package/dist/{cli-9fjr27ez.js → cli-bp6k9acz.js} +18 -22
- package/dist/{cli-5a6pqy45.js → cli-bpje8n65.js} +31 -4
- package/dist/{cli-2v2zdm0a.js → cli-bz97ff9n.js} +2 -2
- package/dist/{cli-3caf7pmg.js → cli-c7j31hq9.js} +3 -3
- package/dist/{cli-t9ga4qmb.js → cli-cah298e5.js} +40 -33
- package/dist/{cli-aw83sr40.js → cli-cjqyse9q.js} +3 -3
- package/dist/{cli-b6px1k1q.js → cli-dd2k2mcd.js} +1 -1
- package/dist/{cli-nv4xsvmk.js → cli-dkvtfgn4.js} +7 -7
- package/dist/{cli-7r162fxe.js → cli-e3ahxq5y.js} +23 -17
- package/dist/{cli-3et6fmfe.js → cli-e8n0hdzd.js} +1 -1
- package/dist/{cli-tsa40663.js → cli-ebqx630g.js} +3 -3
- package/dist/{cli-kbtzfrxj.js → cli-en6dmkxd.js} +3 -3
- package/dist/{cli-m9cvf7vs.js → cli-eq4kew31.js} +14 -14
- package/dist/{cli-fcfbct2j.js → cli-eqq0hwvx.js} +5 -5
- package/dist/{cli-7zm3b3f5.js → cli-ercwc8xn.js} +1 -1
- package/dist/{cli-vs9vdpy0.js → cli-ex1y88j3.js} +1 -1
- package/dist/{cli-mk7c5ac4.js → cli-fxd1mwtr.js} +2 -2
- package/dist/{cli-91pkxres.js → cli-fy4gb74g.js} +2 -2
- package/dist/{cli-fq2rr3jb.js → cli-fyaq4zdv.js} +6 -6
- package/dist/{cli-cc93xzes.js → cli-gfy6hbd9.js} +28 -17
- package/dist/{cli-s1khw52h.js → cli-h70a2mxy.js} +71 -17
- package/dist/cli-hbvgzjq4.js +69 -0
- package/dist/{cli-qx4f057j.js → cli-hhc47ack.js} +4 -4
- package/dist/{cli-q5srsxq2.js → cli-j5gtytvg.js} +154 -41
- package/dist/{cli-psffsanb.js → cli-js10kdk7.js} +6 -1
- package/dist/{cli-54vrpgm0.js → cli-k3facve0.js} +8 -5
- package/dist/{cli-vsw91x06.js → cli-k5jx8jya.js} +10 -6
- package/dist/{cli-tr27kwyg.js → cli-krbcr00p.js} +261 -6
- package/dist/{cli-5qhfv9rw.js → cli-kwr5qv5g.js} +44 -17
- package/dist/{cli-md50mj0r.js → cli-m5qtmrbc.js} +3 -3
- package/dist/{cli-vfqvrd82.js → cli-ma9ys8rt.js} +2 -2
- package/dist/{cli-w16kwbzw.js → cli-mbwmqb5w.js} +1 -1
- package/dist/{cli-w1q68d8x.js → cli-mcymtvwn.js} +322 -72
- package/dist/{cli-k3q2va86.js → cli-mq2fbgva.js} +66 -5
- package/dist/{cli-xqdz5cqm.js → cli-mz7ycqn8.js} +1 -0
- package/dist/{cli-kpgcm7xy.js → cli-n85m2wkq.js} +1 -1
- package/dist/{cli-v8z0yga9.js → cli-n8f0fs3c.js} +4 -4
- package/dist/{cli-mys27d03.js → cli-nja15knq.js} +3 -3
- package/dist/{cli-zk7v5s89.js → cli-pe3yxedk.js} +3 -3
- package/dist/{cli-v46zsvqk.js → cli-ph95yejc.js} +2 -2
- package/dist/{cli-6237rnyr.js → cli-pqfecppn.js} +1 -1
- package/dist/{cli-qrta34nb.js → cli-q2dywc8h.js} +4 -4
- package/dist/{cli-k6nejceb.js → cli-q4z9s6zs.js} +2 -2
- package/dist/{cli-s1zqk1aj.js → cli-q8tc22bj.js} +15 -9
- package/dist/{cli-hg42n3hx.js → cli-qrzq3hvg.js} +8 -8
- package/dist/{cli-43evxwj4.js → cli-r0mz92by.js} +9 -4
- package/dist/{cli-jrbq4djp.js → cli-r14ac1y0.js} +1 -1
- package/dist/{cli-5gpqgs8b.js → cli-rtmqzat7.js} +2 -2
- package/dist/{cli-tvgqesec.js → cli-s6zk31gr.js} +4 -4
- package/dist/{cli-6ym4jhzp.js → cli-sv2r3bw8.js} +7 -7
- package/dist/{cli-wafmk3fn.js → cli-t75xngj1.js} +12 -12
- package/dist/{cli-x40a0w9j.js → cli-tdk7jtka.js} +1 -1
- package/dist/{cli-zeh2mhkg.js → cli-tm60vtax.js} +1 -1
- package/dist/cli-tsfkcd4v.js +30 -0
- package/dist/{cli-8st34zhr.js → cli-v9ya390t.js} +57 -19
- package/dist/{cli-zfqg6fzn.js → cli-vbppqvte.js} +3 -3
- package/dist/{cli-p0n7b5rz.js → cli-wvjqaqcp.js} +2907 -151
- package/dist/{cli-sb4426be.js → cli-xf4z5bdn.js} +5 -5
- package/dist/{cli-p0c3vtch.js → cli-xm34qj8m.js} +772 -515
- package/dist/{cli-z0m452jr.js → cli-ya3kf4gs.js} +1 -1
- package/dist/{cli-had1p04a.js → cli-yegz2g06.js} +4 -4
- package/dist/{cli-k5yewqgd.js → cli-yfpc6qy9.js} +3 -3
- package/dist/{cli-q2d3e1k1.js → cli-z4f346g5.js} +1 -1
- package/dist/{cli-yab6sh8p.js → cli-zcghfsdg.js} +23 -4
- package/dist/cli.js +34 -30
- package/dist/{cloudflare-workers-ai-system-one-4aysy6rh.js → cloudflare-workers-ai-system-one-w3m0fbf8.js} +2 -2
- package/dist/{codex-adapter-exfdbj73.js → codex-adapter-wc6e4wct.js} +8 -8
- package/dist/{codex-hook-59atdwd8.js → codex-hook-aqtj17yr.js} +1 -1
- package/dist/{codex-login-a239g1ah.js → codex-login-1ven7yje.js} +1 -1
- package/dist/{codex-session-runner-xhznc4g3.js → codex-session-runner-ppfgjd97.js} +9 -9
- package/dist/{commands-d8g349v4.js → commands-tsv2vx5b.js} +3 -3
- package/dist/{controller-mwgdmb8y.js → controller-ye4sdwsy.js} +4 -4
- package/dist/{controllers-connect-5v7qx04j.js → controllers-connect-zn4dg69h.js} +25 -22
- package/dist/core-dxcy02sc.js +41 -0
- package/dist/{cursor-adapter-p2q5h35d.js → cursor-adapter-q2g9vwts.js} +2 -2
- package/dist/{db-wcw0b2j8.js → db-3r1fyr2n.js} +6 -2
- package/dist/{db-qpganbeb.js → db-g111qn9j.js} +3 -3
- package/dist/{devin-adapter-zp4tqq53.js → devin-adapter-t8d86q9x.js} +1 -1
- package/dist/{dispatcher-8d8s49yz.js → dispatcher-4q8s0mx8.js} +22 -19
- package/dist/{docker-09tkkg0n.js → docker-1b41eysj.js} +51 -14
- package/dist/{dsh-adapter-me0twn13.js → dsh-adapter-mmcw1z5s.js} +2 -2
- package/dist/{e2b-3v1e745x.js → e2b-ew8c5j5v.js} +3 -3
- package/dist/{e2b-sm28k0k3.js → e2b-xm60c8ad.js} +6 -6
- package/dist/{easter-egg-3d-wv7w5ty6.js → easter-egg-3d-04ke6hcp.js} +1 -1
- package/dist/{embedding-space-e48xchqa.js → embedding-space-kcdn52vz.js} +6 -6
- package/dist/{embeddings-tgq2afbq.js → embeddings-jnzcd91a.js} +1 -1
- package/dist/{event-bus-xr83x566.js → event-bus-v4ywhc2p.js} +1 -1
- package/dist/{execute-8rhwrk7f.js → execute-74amghty.js} +8 -4
- package/dist/{external-channel-8bt3j2pm.js → external-channel-v9zgxnxz.js} +2 -2
- package/dist/fx-adapter-0ar6pqm3.js +19 -0
- package/dist/{google-generative-ai-bh0djqjp.js → google-generative-ai-sw77egmr.js} +9 -9
- package/dist/{google-vertex-prjbw8dj.js → google-vertex-rrw93g8h.js} +9 -9
- package/dist/grok-adapter-t6m74fb1.js +19 -0
- package/dist/handlers-9kwcrc4k.js +38 -0
- package/dist/{heartbeat-x0056ra5.js → heartbeat-p8pk1msj.js} +25 -22
- package/dist/{hook-a7vmn2st.js → hook-k1h73zd7.js} +5 -5
- package/dist/{hook-mrd2ayxv.js → hook-p5reemds.js} +8 -8
- package/dist/{http-ym9c5svp.js → http-ms1z5xxy.js} +2549 -224
- package/dist/index-23cdfzr6.js +39 -0
- package/dist/{index-01ns1pkw.js → index-76zzxtzf.js} +1 -1
- package/dist/{index-ny60jcat.js → index-fbkqhvvj.js} +40 -18
- package/dist/index-g7kkjs5b.js +38 -0
- package/dist/{index-x6azjwm8.js → index-gjn6qfgn.js} +1 -1
- package/dist/{index-b5wgnm78.js → index-kdmkfjt7.js} +4 -4
- package/dist/{index-p46tvwtx.js → index-kn63q1gr.js} +28 -25
- package/dist/{index-9myfj74s.js → index-kzdqn3dd.js} +3 -3
- package/dist/{index-4a0670yh.js → index-p2f5xg64.js} +6 -6
- package/dist/index-stk36pa5.js +43 -0
- package/dist/{k8s-m56sw868.js → k8s-fy8hbhkg.js} +73 -14
- package/dist/{keepalive-7yxg8z4c.js → keepalive-031js8jz.js} +4 -4
- package/dist/lead-mfggjtfk.js +77 -0
- package/dist/{llama-cpp-classify-nfgswa1m.js → llama-cpp-classify-yvb8vh7w.js} +2 -2
- package/dist/{maintenance-6tefxmk1.js → maintenance-sq9v3qx9.js} +1 -1
- package/dist/{mistral-conversations-tm2vd4gc.js → mistral-conversations-w4bncwbt.js} +7 -7
- package/dist/{node-7qsx5kvm.js → node-z67yjre7.js} +19 -13
- package/dist/{oauth-refresh-sweep-70cavc3a.js → oauth-refresh-sweep-zqmnyvs8.js} +3 -3
- package/dist/object-webhooks-r24wwb5y.js +21 -0
- package/dist/{onboard-fja65z08.js → onboard-p25yhh7t.js} +5 -5
- package/dist/{openai-codex-responses-sxjv60xx.js → openai-codex-responses-70g39cgz.js} +20 -14
- package/dist/{openai-completions-0c7qnhsx.js → openai-completions-cv3hp4h5.js} +18 -11
- package/dist/{openai-decisions-ytp6w6xh.js → openai-decisions-fyq1p9f9.js} +2 -2
- package/dist/{openai-responses-a7h29chp.js → openai-responses-trsvnks6.js} +13 -11
- package/dist/{opencode-adapter-hakkm7yh.js → opencode-adapter-wcjc4zdk.js} +7 -7
- package/dist/{openrouter-images-xr9gme9x.js → openrouter-images-0jj12a2q.js} +6 -6
- package/dist/{otel-impl-7zhnt6gj.js → otel-impl-ff1gf20m.js} +2 -2
- package/dist/{pending-h01yzpx4.js → pending-hxj5yatb.js} +23 -20
- package/dist/{pi-messages-2j0fpqwq.js → pi-messages-zk3g4esn.js} +1 -1
- package/dist/{pi-mono-adapter-f52hz743.js → pi-mono-adapter-vkp4zz7p.js} +19 -18
- package/dist/{pricing-refresh-fzxvk2zf.js → pricing-refresh-9w7gx41w.js} +2 -2
- package/dist/{rbac-roles-9v6vhgbs.js → rbac-roles-84aw10nz.js} +3 -3
- package/dist/{rbac-roles-hfgh8sba.js → rbac-roles-hz74vckp.js} +2 -2
- package/dist/{registry-32b1mft6.js → registry-eeyx1201.js} +1 -1
- package/dist/{render-v2-1rgspxzf.js → render-v2-nrdkg9gf.js} +7 -6
- package/dist/{resume-tqy61x24.js → resume-s6ey36rh.js} +9 -8
- package/dist/{runtime-exkxyx5f.js → runtime-x0b4pyam.js} +2 -2
- package/dist/{session-access-3act7vt4.js → session-access-xv49tk14.js} +4 -4
- package/dist/{session-source-backfill-82qe7fqq.js → session-source-backfill-r5j988ah.js} +3 -3
- package/dist/{setup-ry1vfdef.js → setup-mj0krk1p.js} +1 -1
- package/dist/thread-buffer-temgaqsy.js +41 -0
- package/dist/tree-visibility-cbrsfaar.js +24 -0
- package/dist/{typesafe-system-one-vcfj2ak8.js → typesafe-system-one-qkvkgrcz.js} +2 -2
- package/dist/{user-merge-jobs-bx6bf7db.js → user-merge-jobs-f9d8nwnw.js} +3 -3
- package/dist/{virtual-modules-s0rjzcqq.js → virtual-modules-ns0ryw05.js} +32 -10
- package/dist/{work-objects-z2e5tv03.js → work-objects-pydhzast.js} +25 -22
- package/dist/worker-efcemc22.js +77 -0
- package/dist/{worker-follow-up-y3xeg89w.js → worker-follow-up-9z2xec5e.js} +22 -19
- package/dist/{x-wg164ss9.js → x-3dtaf2r9.js} +2 -2
- package/openapi.json +2040 -559
- package/package.json +15 -11
- package/src/azure-devops/auth.ts +2 -3
- package/src/be/agent-fs-identity.ts +46 -0
- package/src/be/agent-history.ts +215 -0
- package/src/be/db/agents.ts +34 -12
- package/src/be/db/request-composition.ts +190 -0
- package/src/be/db/runtime.ts +15 -0
- package/src/be/db/slack-trees.ts +220 -10
- package/src/be/db/tasks/human-free.ts +3 -2
- package/src/be/db/tasks/write.ts +2 -2
- package/src/be/db/workflow-run-retention.ts +101 -0
- package/src/be/db-client.ts +23 -1
- package/src/be/db-retention-defaults.ts +46 -0
- package/src/be/db-retention.ts +55 -6
- package/src/be/db.ts +2 -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/providers/sqlite-store.ts +110 -24
- package/src/be/memory/review-recall-filter.ts +22 -0
- package/src/be/memory/search-candidates.ts +5 -7
- package/src/be/memory/types.ts +5 -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/migrations/332_primitive_objects.sql +31 -0
- package/src/be/migrations/334_agent_history.sql +23 -0
- package/src/be/migrations/335_primitive_object_webhooks.sql +36 -0
- package/src/be/model-profile-check.ts +1 -1
- package/src/be/multi-runtime.ts +32 -4
- package/src/be/primitives/boards/elements.ts +717 -0
- package/src/be/primitives/boards/excalifont-metrics.json +516 -0
- package/src/be/primitives/boards/service.ts +121 -0
- package/src/be/primitives/object-webhooks.ts +348 -0
- package/src/be/primitives/objects.ts +686 -0
- package/src/be/primitives/sheets/a1.ts +136 -0
- package/src/be/primitives/sheets/engine-worker.ts +194 -0
- package/src/be/primitives/sheets/engine.ts +199 -0
- package/src/be/primitives/sheets/format.ts +106 -0
- package/src/be/primitives/sheets/service.ts +415 -0
- package/src/be/primitives/write-object.ts +83 -0
- package/src/be/runtime-pools/controllers.ts +18 -3
- package/src/be/runtime-pools/db.ts +15 -4
- package/src/be/runtime-pools/supervisor.ts +42 -2
- package/src/be/script-credential-broker.ts +8 -27
- package/src/be/scripts/typecheck.ts +216 -0
- package/src/be/seed/agent-fs-provision.ts +18 -0
- package/src/be/swarm-config-guard.ts +10 -2
- package/src/be/users.ts +19 -0
- 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/steps/harness.tsx +1 -1
- package/src/commands/provider-credentials.ts +1 -0
- package/src/commands/runner.ts +116 -12
- package/src/e2b/env.ts +3 -1
- package/src/extensions/catalog.generated.json +1 -1
- package/src/fs/agent-fs-provider.ts +33 -2
- package/src/github/app.ts +59 -14
- package/src/gitlab/auth.ts +3 -4
- package/src/heartbeat/heartbeat.ts +11 -11
- package/src/http/agent-lifecycle.ts +152 -0
- package/src/http/agents.ts +12 -0
- package/src/http/all-routes.ts +4 -0
- package/src/http/auth.ts +2 -1
- package/src/http/config.ts +2 -1
- package/src/http/core.ts +2 -0
- package/src/http/github-token.ts +66 -0
- package/src/http/index.ts +36 -0
- package/src/http/mcp-user.ts +11 -8
- package/src/http/mcp.ts +58 -42
- package/src/http/object-webhooks.ts +101 -0
- package/src/http/operator-actor.ts +2 -1
- package/src/http/prompt-templates.ts +1 -0
- package/src/http/request-composition.ts +310 -0
- package/src/http/sessions.ts +7 -0
- package/src/http/tasks.ts +6 -1
- package/src/http/tool-schema-estimate.ts +95 -0
- package/src/http/workflows.ts +61 -11
- package/src/integrations/chat-sdk/inbound.ts +2 -2
- package/src/integrations/chat-sdk/outbound-files.ts +3 -2
- 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 +76 -2
- 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 +4 -0
- package/src/providers/request-composition-hook.ts +312 -0
- package/src/providers/types.ts +5 -0
- package/src/rbac/legacy-policy.ts +2 -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/k8s.ts +111 -6
- package/src/runtime-providers/types.ts +17 -0
- package/src/scheduler/scheduler.ts +1 -1
- package/src/script-workflows/guest-ctx.ts +32 -0
- package/src/script-workflows/workflow-ctx.ts +2 -0
- package/src/scripts-runtime/ctx.ts +9 -1
- package/src/scripts-runtime/executors/native.ts +106 -21
- package/src/scripts-runtime/executors/quickjs-prelude.ts +9 -2
- package/src/scripts-runtime/executors/quickjs-runner.ts +12 -1
- package/src/scripts-runtime/sdk-allowlist.ts +88 -0
- package/src/scripts-runtime/swarm-sdk.ts +51 -3
- package/src/scripts-runtime/types/stdlib.d.ts +267 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +267 -0
- package/src/server-user.ts +16 -1
- package/src/server.ts +48 -0
- package/src/slack/ack.ts +10 -5
- package/src/slack/actions.ts +3 -3
- package/src/slack/app.ts +2 -0
- package/src/slack/assistant.ts +4 -4
- package/src/slack/blocks.ts +3 -3
- package/src/slack/handlers.ts +3 -3
- package/src/slack/reaction-shortcode.ts +23 -2
- package/src/slack/render-v2.ts +297 -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/agent-history.test.ts +313 -0
- package/src/tests/azure-devops-auth.test.ts +6 -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-outbound-files.test.ts +3 -1
- package/src/tests/check-playwright-version.test.ts +33 -0
- package/src/tests/check-unit-test-allowlist.test.ts +193 -0
- package/src/tests/context-preamble-budget.test.ts +65 -0
- package/src/tests/credential-check.test.ts +12 -0
- package/src/tests/credential-outcome-report.test.ts +81 -1
- package/src/tests/db-client.test.ts +22 -0
- package/src/tests/db-retention-defaults.test.ts +244 -0
- package/src/tests/db-retention.test.ts +2 -1
- package/src/tests/db-task-read-contract.test.ts +2 -0
- package/src/tests/db-task-write-contract.test.ts +2 -0
- package/src/tests/deploy-release-dispatch.test.ts +332 -0
- package/src/tests/e2b-stack-wizard.test.tsx +156 -0
- package/src/tests/e2e-coverage-contract.test.ts +6 -2
- package/src/tests/e2e-diff-coverage.test.ts +154 -0
- package/src/tests/e2e-rerun-quarantine.test.ts +180 -0
- package/src/tests/e2e-shards.test.ts +137 -0
- package/src/tests/e2e-tracker-ingest.test.ts +266 -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 +12 -18
- package/src/tests/extensions-example-slack-reply-gate.test.ts +15 -0
- package/src/tests/extensions-heartbeat.test.ts +34 -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/github-app-worker-auth-helper.test.ts +325 -0
- package/src/tests/github-installation-token-route.test.ts +199 -0
- package/src/tests/gitlab-auth.test.ts +10 -0
- package/src/tests/heartbeat.test.ts +38 -0
- package/src/tests/http-api-integration.test.ts +0 -6
- package/src/tests/mcp-user-events.test.ts +708 -0
- package/src/tests/memory-key-paths.test.ts +4 -1
- package/src/tests/memory-search-stall.test.ts +421 -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-profile-fallbacks.test.ts +236 -2
- package/src/tests/opencode-adapter.test.ts +97 -0
- 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/primitives-boards.test.ts +686 -0
- package/src/tests/primitives-object-webhooks.test.ts +642 -0
- package/src/tests/primitives-objects.test.ts +248 -0
- package/src/tests/prompt-template-resolver.test.ts +85 -0
- package/src/tests/reasoning-kind-ui-parity.test.ts +112 -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-pools-db.test.ts +80 -0
- package/src/tests/runtime-provider-registration.test.ts +8 -0
- package/src/tests/runtime-providers-docker.test.ts +192 -1
- package/src/tests/runtime-providers-k8s.test.ts +127 -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 +8 -0
- package/src/tests/script-native-sandbox-identity.test.ts +264 -0
- package/src/tests/scripts-namespaces.test.ts +211 -0
- package/src/tests/secret-scrub-gate.test.ts +1 -0
- package/src/tests/secret-scrubber-convex.test.ts +168 -0
- package/src/tests/secret-scrubber.test.ts +1 -1
- package/src/tests/session-tokens.test.ts +27 -0
- package/src/tests/sheet-engine.test.ts +58 -0
- package/src/tests/slack-blocks.test.ts +18 -0
- package/src/tests/slack-empty-icon-config.test.ts +113 -0
- package/src/tests/slack-file-tools-attachments.test.ts +74 -6
- package/src/tests/slack-reaction-config.test.ts +38 -2
- package/src/tests/slack-read-boundaries.test.ts +4 -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 +683 -11
- package/src/tests/swarm-config-reserved-keys.test.ts +1 -0
- package/src/tests/task-session-prompts.test.ts +37 -0
- package/src/tests/task-start-after-commit.test.ts +82 -0
- package/src/tests/ui-logs-parser.test.ts +67 -0
- package/src/tests/user-delete-perf.test.ts +36 -9
- package/src/tests/webhook-filter.test.ts +327 -0
- package/src/tests/workflow-async-v2.test.ts +19 -16
- package/src/tests/workflow-e2e.test.ts +1 -9
- package/src/tests/workflow-finalization-races.test.ts +553 -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 +105 -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-retry-v2.test.ts +158 -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 +36 -2
- package/src/tests/workflow-triggers-v2.test.ts +201 -0
- package/src/tests/workflow-wait-builtin-events.test.ts +3 -1
- package/src/tests/workflow-wait-event.test.ts +28 -2
- 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.ts +44 -0
- package/src/tools/boards.ts +260 -0
- package/src/tools/objects.ts +191 -0
- package/src/tools/sheets.ts +312 -0
- package/src/tools/slack-read.ts +10 -3
- package/src/tools/tool-config.ts +23 -0
- package/src/tools/workflows/create-workflow.ts +18 -4
- package/src/tools/workflows/patch-workflow-node.ts +4 -0
- package/src/tools/workflows/patch-workflow.ts +4 -0
- package/src/tools/workflows/update-workflow.ts +24 -3
- package/src/types.ts +216 -2
- package/src/utils/credentials.ts +7 -0
- package/src/utils/sandboxed-process.ts +47 -2
- package/src/utils/secret-scrubber.ts +61 -6
- package/src/workflows/checkpoint.ts +18 -0
- package/src/workflows/engine.ts +73 -31
- package/src/workflows/foreach-driver.ts +42 -4
- package/src/workflows/input.ts +29 -1
- package/src/workflows/patch-definition.ts +15 -1
- package/src/workflows/recovery.ts +6 -1
- package/src/workflows/resume.ts +11 -3
- package/src/workflows/retry-poller.ts +32 -6
- package/src/workflows/successor-routing.ts +108 -0
- package/src/workflows/task-step-routing.ts +5 -2
- package/src/workflows/triggers.ts +21 -36
- package/src/workflows/validation.ts +10 -0
- package/src/workflows/wait-poller.ts +6 -2
- package/src/workflows/webhook-filter.ts +203 -0
- package/templates/ai-toolbox.manifest.json +1 -1
- package/templates/extensions/slack-reply-gate/hooks.ts +8 -4
- package/templates/skills/agent-browser/SKILL.md +1 -0
- package/templates/skills/agent-browser/content.md +1 -0
- package/templates/skills/pages/content.md +5 -0
- package/templates/skills/swarm-docs/content.md +8 -1
- package/templates/skills/swarm-scripts/SKILL.md +1 -0
- package/templates/skills/swarm-scripts/content.md +1 -0
- package/templates/skills/tdd-planning/content.md +5 -2
- package/dist/acp-adapter-bht22g3k.js +0 -16
- package/dist/core-sxy4epp2.js +0 -38
- package/dist/fx-adapter-adtdb3jb.js +0 -19
- package/dist/grok-adapter-accnn9km.js +0 -19
- package/dist/handlers-1x77561e.js +0 -35
- package/dist/index-48qzcqzj.js +0 -35
- package/dist/index-rkvaambe.js +0 -36
- package/dist/index-xj1mq27m.js +0 -40
- package/dist/lead-enzn86bz.js +0 -74
- package/dist/thread-buffer-3x93yexa.js +0 -38
- package/dist/worker-zfcv2wbf.js +0 -74
- package/src/slack/socket-mode-guard.test.ts +0 -25
- package/src/tests/agent-activity.test.ts +0 -247
- package/src/tests/agent-fs-live-url.test.ts +0 -55
- package/src/tests/agentmail-inbox-mapping.test.ts +0 -73
- package/src/tests/approval-sweeps-config.test.ts +0 -47
- package/src/tests/cards.test.ts +0 -169
- package/src/tests/chat-sdk-facts.test.ts +0 -23
- package/src/tests/config-env-export-chat-sdk.test.ts +0 -11
- package/src/tests/core-auth.test.ts +0 -156
- package/src/tests/date-utils.test.ts +0 -48
- package/src/tests/db-context-versions.test.ts +0 -37
- package/src/tests/db-runtime.test.ts +0 -131
- package/src/tests/enabled-capabilities.test.ts +0 -20
- package/src/tests/extensions-example-mcp-install.test.ts +0 -67
- package/src/tests/extensions-lead-equivalence.test.ts +0 -70
- package/src/tests/get-workflow-run-tool.test.ts +0 -98
- package/src/tests/github-event-labels.test.ts +0 -24
- package/src/tests/haiku-5-5-pricing.test.ts +0 -38
- package/src/tests/http-log-scrubbing.test.ts +0 -123
- package/src/tests/http-semconv-attributes.test.ts +0 -92
- package/src/tests/identity.test.ts +0 -117
- package/src/tests/inbox-state.test.ts +0 -167
- package/src/tests/internal-ai/models.test.ts +0 -54
- package/src/tests/launch-password-rejection.test.ts +0 -140
- package/src/tests/list-total-cache.test.ts +0 -88
- package/src/tests/match-route.test.ts +0 -187
- package/src/tests/memory-feature-flags.test.ts +0 -45
- package/src/tests/memory-get-tool.test.ts +0 -269
- package/src/tests/memory-health-endpoint.test.ts +0 -78
- package/src/tests/memory-http-access.test.ts +0 -221
- package/src/tests/memory-retrieval-purge.test.ts +0 -99
- package/src/tests/multi-runtime-enabled-stats.test.ts +0 -229
- package/src/tests/openai-embedding-provider.test.ts +0 -159
- package/src/tests/org-identity.test.ts +0 -44
- package/src/tests/pages-actions-endpoint.test.ts +0 -103
- package/src/tests/pages-browser-sdk.test.ts +0 -76
- package/src/tests/pages-feedback-keys.test.ts +0 -121
- package/src/tests/pages-frame-ancestors.test.ts +0 -189
- package/src/tests/pages-list-endpoint.test.ts +0 -148
- package/src/tests/pages-password-mode.test.ts +0 -266
- package/src/tests/pages-public-authed-401.test.ts +0 -103
- package/src/tests/pages-public-html.test.ts +0 -297
- package/src/tests/pages-public-json-redirect.test.ts +0 -122
- package/src/tests/pages-view-count.test.ts +0 -245
- package/src/tests/prompt-templates-db.test.ts +0 -616
- package/src/tests/rbac-engine.test.ts +0 -742
- package/src/tests/repo-allow-merge-gate.test.ts +0 -389
- package/src/tests/route-def-find-route.test.ts +0 -192
- package/src/tests/runtime-stale-threshold.test.ts +0 -40
- package/src/tests/schedule-validation-helper.test.ts +0 -51
- package/src/tests/scheduled-tasks-api.test.ts +0 -355
- package/src/tests/scheduler-backoff.test.ts +0 -166
- package/src/tests/script-run-token.test.ts +0 -75
- package/src/tests/scripts-extract-signature.test.ts +0 -47
- package/src/tests/scripts-sdk-bridge-tool-failure.test.ts +0 -141
- package/src/tests/seed-workflow-dreaming.test.ts +0 -117
- package/src/tests/short-id.test.ts +0 -23
- package/src/tests/skill-files-http.test.ts +0 -222
- package/src/tests/skill-get-file-tool.test.ts +0 -110
- package/src/tests/skill-script-refs.test.ts +0 -63
- package/src/tests/skill-update-scope.test.ts +0 -252
- package/src/tests/skills-bundle.test.ts +0 -99
- package/src/tests/slack-app-icon.test.ts +0 -94
- package/src/tests/slack-assistant-comention.test.ts +0 -139
- package/src/tests/slack-delete.test.ts +0 -157
- package/src/tests/slack-inbound-diagnostics-auth.test.ts +0 -93
- package/src/tests/slack-manifest.test.ts +0 -23
- package/src/tests/slack-task-output.test.ts +0 -90
- package/src/tests/store-progress-output-guidance.test.ts +0 -34
- package/src/tests/swarm-diff.test.ts +0 -728
- package/src/tests/task-lifecycle-events.test.ts +0 -53
- package/src/tests/template-asset-config.test.ts +0 -18
- package/src/tests/template-fetch.test.ts +0 -490
- package/src/tests/themes-page-theme.test.ts +0 -155
- package/src/tests/tool-annotations.test.ts +0 -442
- package/src/tests/tool-output-agent-id.test.ts +0 -202
- package/src/tests/update-profile-agentid.test.ts +0 -248
- package/src/tests/whoami-route.test.ts +0 -162
- package/src/tests/workflow-definition-telemetry.test.ts +0 -134
- package/src/tests/workflow-patch.test.ts +0 -169
- package/src/tests/workflow-run-steps-index.test.ts +0 -65
- package/src/tests/workflow-schedule-trigger.test.ts +0 -104
- package/src/tests/workflow-step-claims.test.ts +0 -152
- package/src/tests/workflow-step-order.test.ts +0 -92
- package/src/tests/workflow-trigger-schema.test.ts +0 -359
- package/src/tests/workflow-versions.test.ts +0 -240
|
@@ -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-12vek61e.js";
|
|
62
65
|
import {
|
|
63
66
|
getChannelBlockReason2,
|
|
64
67
|
init_external_channel
|
|
65
|
-
} from "./cli-
|
|
68
|
+
} from "./cli-fxd1mwtr.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-04zc3f7b.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-z4f346g5.js";
|
|
82
96
|
import {
|
|
83
97
|
require_jsonwebtoken,
|
|
84
98
|
require_dist9,
|
|
@@ -99,18 +113,18 @@ import {
|
|
|
99
113
|
import {
|
|
100
114
|
isTerminalTaskStatus,
|
|
101
115
|
init_types5
|
|
102
|
-
} from "./cli-
|
|
116
|
+
} from "./cli-5z0g0e8v.js";
|
|
103
117
|
import {
|
|
104
118
|
taskAttachmentDisplayUrl,
|
|
105
119
|
init_task_attachment_links
|
|
106
|
-
} from "./cli-
|
|
120
|
+
} from "./cli-agjbj5x0.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,
|
|
@@ -127,7 +141,7 @@ import {
|
|
|
127
141
|
_enum2,
|
|
128
142
|
literal2,
|
|
129
143
|
lazy
|
|
130
|
-
} from "./cli-
|
|
144
|
+
} from "./cli-qrzq3hvg.js";
|
|
131
145
|
import {
|
|
132
146
|
getAppUrl,
|
|
133
147
|
init_constants3
|
|
@@ -144,7 +158,7 @@ import {
|
|
|
144
158
|
scrubSecrets,
|
|
145
159
|
scrubObject,
|
|
146
160
|
init_secret_scrubber
|
|
147
|
-
} from "./cli-
|
|
161
|
+
} from "./cli-bpje8n65.js";
|
|
148
162
|
import {
|
|
149
163
|
__toESM,
|
|
150
164
|
__commonJS,
|
|
@@ -12384,7 +12398,7 @@ async function initOtel(serviceRole = process.env.AGENT_ROLE || "api") {
|
|
|
12384
12398
|
return;
|
|
12385
12399
|
initialized = true;
|
|
12386
12400
|
try {
|
|
12387
|
-
const impl = await import("./otel-impl-
|
|
12401
|
+
const impl = await import("./otel-impl-ff1gf20m.js");
|
|
12388
12402
|
await impl.boot(serviceRole, {
|
|
12389
12403
|
exportConsoleLogs: serviceRole === "api" && isApiLogExportEnabled()
|
|
12390
12404
|
});
|
|
@@ -12510,6 +12524,8 @@ function slackErrorCode(error) {
|
|
|
12510
12524
|
return typeof data.error === "string" ? data.error : undefined;
|
|
12511
12525
|
}
|
|
12512
12526
|
async function addReaction(client, channel, timestamp, name, event) {
|
|
12527
|
+
if (!name)
|
|
12528
|
+
return;
|
|
12513
12529
|
try {
|
|
12514
12530
|
await client.reactions.add({ channel, name, timestamp });
|
|
12515
12531
|
} catch (error) {
|
|
@@ -12534,7 +12550,7 @@ async function ackSlackMessage(client, channel, timestamp, name, event) {
|
|
|
12534
12550
|
await addReaction(client, channel, timestamp, name, event);
|
|
12535
12551
|
}
|
|
12536
12552
|
async function finalizeSlackMessageReaction(client, channel, timestamp, outcome, event) {
|
|
12537
|
-
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));
|
|
12538
12554
|
await Promise.all(Array.from(names, async (name) => {
|
|
12539
12555
|
try {
|
|
12540
12556
|
await client.reactions.remove({ channel, name, timestamp });
|
|
@@ -12632,7 +12648,7 @@ var init_ack = __esm(() => {
|
|
|
12632
12648
|
init_otel();
|
|
12633
12649
|
init_types5();
|
|
12634
12650
|
init_secret_scrubber();
|
|
12635
|
-
|
|
12651
|
+
init_app4();
|
|
12636
12652
|
init_reaction_shortcode();
|
|
12637
12653
|
init_task_output();
|
|
12638
12654
|
init_reaction_shortcode();
|
|
@@ -12792,7 +12808,7 @@ function formatDuration(start, end) {
|
|
|
12792
12808
|
}
|
|
12793
12809
|
function buildCompletedBlocks(opts) {
|
|
12794
12810
|
const taskLink = getTaskLink(opts.taskId);
|
|
12795
|
-
let line = `${completedStatusIcon()}
|
|
12811
|
+
let line = `${iconPrefix(completedStatusIcon())}*${opts.agentName}* (${taskLink})`;
|
|
12796
12812
|
if (opts.duration)
|
|
12797
12813
|
line += ` · ${opts.duration}`;
|
|
12798
12814
|
const blocks = [sectionBlock(line)];
|
|
@@ -12875,7 +12891,7 @@ function isTreeOutputTruncated(text) {
|
|
|
12875
12891
|
function renderNodeLine(node) {
|
|
12876
12892
|
const icon = node.status === "completed" ? completedStatusIcon() : STATUS_ICON[node.status] ?? "•";
|
|
12877
12893
|
const taskLink = getTaskLink(node.taskId);
|
|
12878
|
-
let line = `${icon}
|
|
12894
|
+
let line = `${iconPrefix(icon)}*${node.agentName}* (${taskLink})`;
|
|
12879
12895
|
if (node.duration)
|
|
12880
12896
|
line += ` · ${node.duration}`;
|
|
12881
12897
|
if (node.steered)
|
|
@@ -15948,7 +15964,7 @@ function shouldPostInlineCompletionOutput(task) {
|
|
|
15948
15964
|
return !!output && isTreeOutputTruncated(markdownToSlack(output));
|
|
15949
15965
|
}
|
|
15950
15966
|
function formatInlineCompletionOutputChunks(opts) {
|
|
15951
|
-
const header = `${completedStatusIcon()}
|
|
15967
|
+
const header = `${iconPrefix(completedStatusIcon())}*${opts.agentName}* completed with output (${getTaskLink(opts.taskId)}):
|
|
15952
15968
|
|
|
15953
15969
|
`;
|
|
15954
15970
|
const slackOutput = markdownToSlack(opts.output.trim());
|
|
@@ -16030,7 +16046,7 @@ async function sendTaskResponse(task) {
|
|
|
16030
16046
|
await sendWithPersona(client, {
|
|
16031
16047
|
channel: task.slackChannelId,
|
|
16032
16048
|
thread_ts: task.slackThreadTs,
|
|
16033
|
-
text: task.slackReplySent || i > 0 ? `${completedStatusIcon()}
|
|
16049
|
+
text: task.slackReplySent || i > 0 ? `${iconPrefix(completedStatusIcon())}${agentName} completed${i > 0 ? ` (continued ${i + 1}/${blockBatches.length})` : ""}` : body,
|
|
16034
16050
|
username: getAgentDisplayName(agent),
|
|
16035
16051
|
icon: getAgentSlackIcon(agent),
|
|
16036
16052
|
blocks: blockBatches[i]
|
|
@@ -16146,7 +16162,7 @@ async function updateToFinal(task, messageTs) {
|
|
|
16146
16162
|
};
|
|
16147
16163
|
completionBlockBatches = buildCompletedBlockBatches(completionOpts);
|
|
16148
16164
|
blocks = completionBlockBatches[0] ?? buildCompletedBlocks(completionOpts);
|
|
16149
|
-
text = task.slackReplySent ? `${completedStatusIcon()}
|
|
16165
|
+
text = task.slackReplySent ? `${iconPrefix(completedStatusIcon())}${agentName} completed` : body;
|
|
16150
16166
|
} else if (task.status === "cancelled") {
|
|
16151
16167
|
blocks = buildCancelledBlocks({ agentName, taskId: task.id });
|
|
16152
16168
|
text = "Task cancelled";
|
|
@@ -16170,7 +16186,7 @@ async function updateToFinal(task, messageTs) {
|
|
|
16170
16186
|
await sendWithPersona(app.client, {
|
|
16171
16187
|
channel: task.slackChannelId,
|
|
16172
16188
|
thread_ts: task.slackThreadTs ?? messageTs,
|
|
16173
|
-
text: `${completedStatusIcon()}
|
|
16189
|
+
text: `${iconPrefix(completedStatusIcon())}${agentName} completed (continued ${i + 1}/${completionBlockBatches.length})`,
|
|
16174
16190
|
username: getAgentDisplayName(agent),
|
|
16175
16191
|
icon: getAgentSlackIcon(agent),
|
|
16176
16192
|
blocks: completionBlockBatches[i]
|
|
@@ -16258,7 +16274,7 @@ var isDev, MAX_INLINE_OUTPUT_BLOCKS_PER_MESSAGE = 10;
|
|
|
16258
16274
|
var init_responses = __esm(() => {
|
|
16259
16275
|
init_db4();
|
|
16260
16276
|
init_fallback();
|
|
16261
|
-
|
|
16277
|
+
init_app4();
|
|
16262
16278
|
init_blocks();
|
|
16263
16279
|
init_reaction_shortcode();
|
|
16264
16280
|
init_task_attachments();
|
|
@@ -16537,7 +16553,7 @@ var init_session_status = __esm(() => {
|
|
|
16537
16553
|
init_db4();
|
|
16538
16554
|
init_types5();
|
|
16539
16555
|
init_secret_scrubber();
|
|
16540
|
-
|
|
16556
|
+
init_app4();
|
|
16541
16557
|
import_bolt5 = __toESM(require_dist5(), 1);
|
|
16542
16558
|
REFRESH_MS = 30 * 60000;
|
|
16543
16559
|
callTimeoutMs = DEFAULT_CALL_TIMEOUT_MS;
|
|
@@ -16601,8 +16617,9 @@ function retryDelayMs(error, attempt) {
|
|
|
16601
16617
|
const seconds = candidate.retryAfter ?? candidate.data?.retry_after ?? 2 ** attempt;
|
|
16602
16618
|
return Math.min(Math.max(seconds * 1000, 0), MAX_RETRY_DELAY_MS);
|
|
16603
16619
|
}
|
|
16604
|
-
async function callSlackWithRetry2(client, method, payload) {
|
|
16620
|
+
async function callSlackWithRetry2(client, method, payload, beforeAttempt) {
|
|
16605
16621
|
for (let attempt = 0;; attempt++) {
|
|
16622
|
+
beforeAttempt?.();
|
|
16606
16623
|
try {
|
|
16607
16624
|
return await client.apiCall(method, payload);
|
|
16608
16625
|
} catch (error) {
|
|
@@ -16641,7 +16658,7 @@ async function checkOutcomeDeliveryGate(task, card, statusBudget) {
|
|
|
16641
16658
|
function noteOutcomeDeliverySuccess(taskId) {
|
|
16642
16659
|
outcomeDeliveryNextAttemptAt.delete(taskId);
|
|
16643
16660
|
}
|
|
16644
|
-
async function noteOutcomeDeliveryFailure(task,
|
|
16661
|
+
async function noteOutcomeDeliveryFailure(task, error, statusBudget) {
|
|
16645
16662
|
const detail = describeSlackError(error);
|
|
16646
16663
|
const summary = scrubSecrets(slackErrorSummary(error));
|
|
16647
16664
|
if (!task.slackChannelId || !task.slackThreadTs) {
|
|
@@ -16650,7 +16667,7 @@ async function noteOutcomeDeliveryFailure(task, tree, error, statusBudget) {
|
|
|
16650
16667
|
}
|
|
16651
16668
|
if (!await getSlackOutcomeMessage2(task.id)) {
|
|
16652
16669
|
await reserveSlackMessage2({
|
|
16653
|
-
contextKey: task.contextKey ??
|
|
16670
|
+
contextKey: task.contextKey ?? slackContextKey({ channelId: task.slackChannelId, threadTs: task.slackThreadTs }),
|
|
16654
16671
|
channelId: task.slackChannelId,
|
|
16655
16672
|
threadTs: task.slackThreadTs,
|
|
16656
16673
|
kind: "outcome",
|
|
@@ -16734,7 +16751,7 @@ async function taskStateGlyph(task, now, threadTasks = []) {
|
|
|
16734
16751
|
case "superseded":
|
|
16735
16752
|
return "↪️";
|
|
16736
16753
|
case "skipped":
|
|
16737
|
-
return
|
|
16754
|
+
return reactionStatusIcon("skipped");
|
|
16738
16755
|
default:
|
|
16739
16756
|
return "\uD83D\uDD52";
|
|
16740
16757
|
}
|
|
@@ -16811,7 +16828,7 @@ async function renderNodeLines(node, depth, now, isAsk, threadTasks) {
|
|
|
16811
16828
|
const duration = formatV2Duration(new Date(node.task.createdAt), terminalEnd(node.task, now));
|
|
16812
16829
|
const indent = FIGURE_SPACE.repeat(TREE_INDENT.topLevel + Math.max(0, depth - 1) * TREE_INDENT.levelStep);
|
|
16813
16830
|
const boundedPrefix = indent.length > MAX_TREE_PREFIX_LENGTH ? `${indent.slice(0, MAX_TREE_PREFIX_LENGTH - 1)}…` : indent;
|
|
16814
|
-
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)}`;
|
|
16815
16832
|
const detail = node.task.status === "skipped" ? renderSkipReason(node.task.failureReason) : isTerminalTreeStatus(node.task.status) ? undefined : renderProgress(node.task.progress);
|
|
16816
16833
|
const suffix = detail ? ` · ${detail}` : "";
|
|
16817
16834
|
if (suffix && line.length + suffix.length <= MAX_TREE_NODE_LINE_LENGTH) {
|
|
@@ -16845,7 +16862,7 @@ function threadHeaderText(tasks, now, duration) {
|
|
|
16845
16862
|
if (tasks.some((task) => isAwaitingWake(task, tasks)))
|
|
16846
16863
|
return `\uD83E\uDDF5 ⏳ waiting — ${duration}`;
|
|
16847
16864
|
const hasFailure = tasks.some((task) => task.status === "failed");
|
|
16848
|
-
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}`;
|
|
16849
16866
|
}
|
|
16850
16867
|
async function renderThreadTree(tasks, _outcomeLinks = new Map, now = new Date, _triggerLinks = new Map) {
|
|
16851
16868
|
if (tasks.length === 0)
|
|
@@ -16902,10 +16919,16 @@ async function resolvePermalink(client, channelId, ts) {
|
|
|
16902
16919
|
}
|
|
16903
16920
|
return result.permalink;
|
|
16904
16921
|
}
|
|
16905
|
-
async function ensureTreePermalink(client, tree) {
|
|
16922
|
+
async function ensureTreePermalink(client, tree, generation = slackTreeGeneration2()) {
|
|
16906
16923
|
if (tree.permalink)
|
|
16907
16924
|
return tree;
|
|
16908
|
-
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");
|
|
16909
16932
|
return await updateSlackMessageRecord2(tree.id, { permalink, touchUpdatedAt: false }) ?? tree;
|
|
16910
16933
|
}
|
|
16911
16934
|
function physicalThreadKey(channelId, threadTs) {
|
|
@@ -16914,7 +16937,7 @@ function physicalThreadKey(channelId, threadTs) {
|
|
|
16914
16937
|
function isSlackMessageNotFound(error) {
|
|
16915
16938
|
return slackErrorCode2(error) === "message_not_found";
|
|
16916
16939
|
}
|
|
16917
|
-
async function findReservedSlackMessage(client, reservation, outcomeMarker) {
|
|
16940
|
+
async function findReservedSlackMessage(client, reservation, outcomeMarker, beforeAttempt) {
|
|
16918
16941
|
let cursor;
|
|
16919
16942
|
const oldest = Math.max(0, new Date(reservation.createdAt).getTime() / 1000 - 5);
|
|
16920
16943
|
do {
|
|
@@ -16926,7 +16949,7 @@ async function findReservedSlackMessage(client, reservation, outcomeMarker) {
|
|
|
16926
16949
|
inclusive: true,
|
|
16927
16950
|
limit: 100,
|
|
16928
16951
|
...cursor ? { cursor } : {}
|
|
16929
|
-
});
|
|
16952
|
+
}, beforeAttempt);
|
|
16930
16953
|
const messages = Array.isArray(response.messages) ? response.messages : [];
|
|
16931
16954
|
const found = messages.find((message) => {
|
|
16932
16955
|
if (!message.ts)
|
|
@@ -16954,7 +16977,9 @@ async function discardTreeRecord(tree) {
|
|
|
16954
16977
|
async function findThreadTree(contextKey, channelId, threadTs) {
|
|
16955
16978
|
return await getSlackTreeMessage2(contextKey) ?? await getSlackTreeMessageByThread2(channelId, threadTs);
|
|
16956
16979
|
}
|
|
16957
|
-
async function createThreadTree(task) {
|
|
16980
|
+
async function createThreadTree(task, generation) {
|
|
16981
|
+
const guard = () => assertSlackTreeCurrent2(generation);
|
|
16982
|
+
guard();
|
|
16958
16983
|
const app = getSlackApp2();
|
|
16959
16984
|
if (!app || !task.slackChannelId || !task.slackThreadTs)
|
|
16960
16985
|
return null;
|
|
@@ -16969,6 +16994,7 @@ async function createThreadTree(task) {
|
|
|
16969
16994
|
const tasks = await getSlackTasksInThread2(task.slackChannelId, task.slackThreadTs);
|
|
16970
16995
|
const agent = task.agentId ? await getAgentById2(task.agentId) : undefined;
|
|
16971
16996
|
const text = await renderThreadTree(tasks);
|
|
16997
|
+
guard();
|
|
16972
16998
|
const reserved = existing ? { record: existing, created: false } : await reserveSlackMessage2({
|
|
16973
16999
|
contextKey,
|
|
16974
17000
|
channelId: task.slackChannelId,
|
|
@@ -16977,7 +17003,7 @@ async function createThreadTree(task) {
|
|
|
16977
17003
|
taskId: task.id
|
|
16978
17004
|
});
|
|
16979
17005
|
const reservation = reserved.record;
|
|
16980
|
-
const reconciled = reserved.created ? undefined : await findReservedSlackMessage(app.client, reservation);
|
|
17006
|
+
const reconciled = reserved.created ? undefined : await findReservedSlackMessage(app.client, reservation, undefined, guard);
|
|
16981
17007
|
let remote = reconciled;
|
|
16982
17008
|
if (!remote) {
|
|
16983
17009
|
remote = await callSlackWithRetry2(app.client, "chat.postMessage", {
|
|
@@ -16992,21 +17018,11 @@ async function createThreadTree(task) {
|
|
|
16992
17018
|
event_type: SLACK_RENDER_METADATA_EVENT,
|
|
16993
17019
|
event_payload: { message_id: reservation.id, kind: "tree" }
|
|
16994
17020
|
}
|
|
16995
|
-
});
|
|
17021
|
+
}, guard);
|
|
16996
17022
|
}
|
|
16997
17023
|
if (typeof remote.ts !== "string" || !remote.ts) {
|
|
16998
17024
|
throw new Error("Slack did not return a timestamp for the thread tree");
|
|
16999
17025
|
}
|
|
17000
|
-
if (reconciled) {
|
|
17001
|
-
await callSlackWithRetry2(app.client, "chat.update", {
|
|
17002
|
-
channel: task.slackChannelId,
|
|
17003
|
-
ts: remote.ts,
|
|
17004
|
-
text,
|
|
17005
|
-
blocks: treeBlocks(text),
|
|
17006
|
-
unfurl_links: false,
|
|
17007
|
-
unfurl_media: false
|
|
17008
|
-
});
|
|
17009
|
-
}
|
|
17010
17026
|
let record = await bindSlackMessageTimestamp2(reservation.id, remote.ts, {
|
|
17011
17027
|
renderedThrough
|
|
17012
17028
|
});
|
|
@@ -17016,62 +17032,106 @@ async function createThreadTree(task) {
|
|
|
17016
17032
|
if (!record || isPendingSlackMessage2(record)) {
|
|
17017
17033
|
throw new Error("Failed to persist the thread tree timestamp");
|
|
17018
17034
|
}
|
|
17019
|
-
|
|
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);
|
|
17020
17047
|
lastTreeText.set(record.id, text);
|
|
17021
17048
|
lastTreeUpdateAt.set(record.id, Date.now());
|
|
17022
17049
|
return record;
|
|
17023
17050
|
}
|
|
17024
|
-
async function
|
|
17051
|
+
async function ensureSlackThreadPresentation2(taskIds, statusBudget) {
|
|
17025
17052
|
const task = (await Promise.all(taskIds.map(getTaskById2))).find((candidate) => !!candidate);
|
|
17026
17053
|
if (!task?.slackChannelId || !task.slackThreadTs)
|
|
17027
17054
|
return null;
|
|
17028
17055
|
const [tree] = await Promise.allSettled([
|
|
17029
|
-
|
|
17056
|
+
presentThreadTree(task, taskIds, statusBudget),
|
|
17030
17057
|
reconcileSlackSessionStatus({
|
|
17031
17058
|
channelId: task.slackChannelId,
|
|
17032
17059
|
threadTs: task.slackThreadTs,
|
|
17033
17060
|
budget: statusBudget
|
|
17034
17061
|
})
|
|
17035
17062
|
]);
|
|
17036
|
-
if (tree.status === "rejected")
|
|
17063
|
+
if (tree.status === "rejected") {
|
|
17064
|
+
if (tree.reason instanceof SlackTreeSuppressed2)
|
|
17065
|
+
return null;
|
|
17037
17066
|
throw tree.reason;
|
|
17067
|
+
}
|
|
17038
17068
|
return tree.value;
|
|
17039
17069
|
}
|
|
17040
|
-
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);
|
|
17041
17092
|
const contextKey = task.contextKey ?? slackContextKey({
|
|
17042
17093
|
channelId,
|
|
17043
17094
|
threadTs
|
|
17044
17095
|
});
|
|
17045
17096
|
const existing = await findThreadTree(contextKey, channelId, threadTs);
|
|
17097
|
+
assertSlackTreeCurrent2(generation);
|
|
17046
17098
|
if (existing && !isPendingSlackMessage2(existing)) {
|
|
17047
17099
|
const app = getSlackApp2();
|
|
17048
17100
|
try {
|
|
17049
|
-
const resolved = app ? await ensureTreePermalink(app.client, existing) : existing;
|
|
17101
|
+
const resolved = app ? await ensureTreePermalink(app.client, existing, generation) : existing;
|
|
17050
17102
|
scheduleSlackTreeUpdate(resolved);
|
|
17051
17103
|
return resolved;
|
|
17052
17104
|
} catch (error) {
|
|
17053
17105
|
if (!isSlackMessageNotFound(error))
|
|
17054
17106
|
throw error;
|
|
17107
|
+
assertSlackTreeCurrent2(generation);
|
|
17055
17108
|
await discardTreeRecord(existing);
|
|
17056
|
-
return
|
|
17109
|
+
return ensureSlackThreadTree(taskIds, statusBudget);
|
|
17057
17110
|
}
|
|
17058
17111
|
}
|
|
17059
17112
|
const creationKey = physicalThreadKey(channelId, threadTs);
|
|
17060
17113
|
const inFlight = treeCreationPromises.get(creationKey);
|
|
17061
17114
|
if (inFlight)
|
|
17062
17115
|
return inFlight;
|
|
17063
|
-
const creation = createThreadTree(task).finally(() => treeCreationPromises.delete(creationKey));
|
|
17116
|
+
const creation = createThreadTree(task, generation).finally(() => treeCreationPromises.delete(creationKey));
|
|
17064
17117
|
treeCreationPromises.set(creationKey, creation);
|
|
17065
17118
|
return creation;
|
|
17066
17119
|
}
|
|
17067
17120
|
function scheduleSlackTreeUpdate(tree, delayMs = TREE_UPDATE_DEBOUNCE_MS) {
|
|
17121
|
+
if (!isSlackTaskTreeEnabled2())
|
|
17122
|
+
return;
|
|
17123
|
+
const generation = slackTreeGeneration2();
|
|
17068
17124
|
const existing = pendingTreeUpdates.get(tree.id);
|
|
17069
17125
|
if (existing)
|
|
17070
17126
|
clearTimeout(existing);
|
|
17071
17127
|
pendingTreeUpdates.set(tree.id, setTimeout(() => {
|
|
17072
17128
|
pendingTreeUpdates.delete(tree.id);
|
|
17129
|
+
if (generation !== slackTreeGeneration2() || !isSlackTaskTreeEnabled2())
|
|
17130
|
+
return;
|
|
17073
17131
|
updateThreadTree(tree).catch((error) => {
|
|
17074
|
-
|
|
17132
|
+
if (error instanceof SlackTreeSuppressed2)
|
|
17133
|
+
return;
|
|
17134
|
+
console.error(`[Slack] Failed to run debounced v2 tree update ${tree.id}:`, scrubSecrets(String(error)));
|
|
17075
17135
|
});
|
|
17076
17136
|
}, Math.max(0, delayMs)));
|
|
17077
17137
|
}
|
|
@@ -17091,10 +17151,13 @@ async function withTreeUpdateLock(channelId, threadTs, work) {
|
|
|
17091
17151
|
async function replaceMissingTree(tree, statusBudget) {
|
|
17092
17152
|
await discardTreeRecord(tree);
|
|
17093
17153
|
const taskIds = (await getSlackTasksInThread2(tree.channelId, tree.threadTs)).map((task) => task.id);
|
|
17094
|
-
return taskIds.length > 0 ?
|
|
17154
|
+
return taskIds.length > 0 ? ensureSlackThreadTree(taskIds, statusBudget) : null;
|
|
17095
17155
|
}
|
|
17096
17156
|
async function updateThreadTree(tree, bypassThrottle = false, statusBudget) {
|
|
17157
|
+
const generation = slackTreeGeneration2();
|
|
17097
17158
|
const result = await withTreeUpdateLock(tree.channelId, tree.threadTs, async () => {
|
|
17159
|
+
assertSlackTreeCurrent2(generation);
|
|
17160
|
+
const cutoff = await syncSlackTreeVisibility2();
|
|
17098
17161
|
const app = getSlackApp2();
|
|
17099
17162
|
if (!app)
|
|
17100
17163
|
return "unchanged";
|
|
@@ -17105,9 +17168,10 @@ async function updateThreadTree(tree, bypassThrottle = false, statusBudget) {
|
|
|
17105
17168
|
return "pending";
|
|
17106
17169
|
const renderedThrough = new Date().toISOString();
|
|
17107
17170
|
const tasks = await getSlackTasksInThread2(current.channelId, current.threadTs);
|
|
17108
|
-
if (tasks.length === 0)
|
|
17171
|
+
if (tasks.length === 0 || !canPresentSlackTree2(tasks, cutoff))
|
|
17109
17172
|
return "unchanged";
|
|
17110
17173
|
const text = await renderThreadTree(tasks);
|
|
17174
|
+
assertSlackTreeCurrent2(generation);
|
|
17111
17175
|
const lastText = lastTreeText.get(current.id);
|
|
17112
17176
|
const lastUpdate = lastTreeUpdateAt.get(current.id) ?? 0;
|
|
17113
17177
|
if (text === lastText) {
|
|
@@ -17127,7 +17191,7 @@ async function updateThreadTree(tree, bypassThrottle = false, statusBudget) {
|
|
|
17127
17191
|
blocks: treeBlocks(text),
|
|
17128
17192
|
unfurl_links: false,
|
|
17129
17193
|
unfurl_media: false
|
|
17130
|
-
});
|
|
17194
|
+
}, () => assertSlackTreeCurrent2(generation));
|
|
17131
17195
|
} catch (error) {
|
|
17132
17196
|
if (isSlackMessageNotFound(error))
|
|
17133
17197
|
return "missing";
|
|
@@ -17139,6 +17203,7 @@ async function updateThreadTree(tree, bypassThrottle = false, statusBudget) {
|
|
|
17139
17203
|
return "updated";
|
|
17140
17204
|
});
|
|
17141
17205
|
if (result === "missing") {
|
|
17206
|
+
assertSlackTreeCurrent2(generation);
|
|
17142
17207
|
await replaceMissingTree(tree, statusBudget);
|
|
17143
17208
|
return false;
|
|
17144
17209
|
}
|
|
@@ -17154,6 +17219,8 @@ function outcomeText(value, fallback) {
|
|
|
17154
17219
|
return value?.trim() ? value : fallback;
|
|
17155
17220
|
}
|
|
17156
17221
|
function withStatusLead(lead, body) {
|
|
17222
|
+
if (!lead)
|
|
17223
|
+
return body;
|
|
17157
17224
|
const text = body.replace(/^(?:[ \t]*\r?\n)+/, "");
|
|
17158
17225
|
if (LINE_START_BLOCK.test(text))
|
|
17159
17226
|
return `${lead}
|
|
@@ -17169,12 +17236,12 @@ async function outcomeContent(task, slackReplySent) {
|
|
|
17169
17236
|
return withStatusLead("\uD83D\uDEAB **Cancelled:**", outcomeText(task.failureReason, "Task was cancelled."));
|
|
17170
17237
|
}
|
|
17171
17238
|
if (task.status === "skipped") {
|
|
17172
|
-
return withStatusLead(
|
|
17239
|
+
return withStatusLead(`${iconPrefix(reactionStatusIcon("skipped"))}**Skipped:**`, outcomeText(task.failureReason, "Task was skipped."));
|
|
17173
17240
|
}
|
|
17174
17241
|
const isDeferred = isDeferredTask(task);
|
|
17175
17242
|
if (slackReplySent && task.status === "completed" && !isDeferred) {
|
|
17176
17243
|
const agentName = task.agentId ? (await getAgentById2(task.agentId))?.name ?? "Agent" : "Agent";
|
|
17177
|
-
return `${completedStatusIcon()}
|
|
17244
|
+
return `${iconPrefix(completedStatusIcon())}${agentName} completed`;
|
|
17178
17245
|
}
|
|
17179
17246
|
if (isDeferred) {
|
|
17180
17247
|
return withStatusLead("⏳", outcomeText(slackTaskOutput(task), "Deferred."));
|
|
@@ -17190,12 +17257,12 @@ async function childOutcomeContent(task, slackReplySent) {
|
|
|
17190
17257
|
return withStatusLead(`↳ ❌ ${agentName} — failed:`, outcomeText(task.failureReason, "Task failed."));
|
|
17191
17258
|
}
|
|
17192
17259
|
if (slackReplySent && !isDeferredTask(task)) {
|
|
17193
|
-
return `↳ ${completedStatusIcon()}
|
|
17260
|
+
return `↳ ${iconPrefix(completedStatusIcon())}${agentName} completed`;
|
|
17194
17261
|
}
|
|
17195
17262
|
if (isDeferredTask(task)) {
|
|
17196
17263
|
return withStatusLead(`↳ ⏳ ${agentName} — deferred:`, outcomeText(slackTaskOutput(task), "Deferred."));
|
|
17197
17264
|
}
|
|
17198
|
-
return withStatusLead(`↳ ${completedStatusIcon()}
|
|
17265
|
+
return withStatusLead(`↳ ${iconPrefix(completedStatusIcon())}${agentName} — result:`, outcomeText(slackTaskOutput(task), "Task completed."));
|
|
17199
17266
|
}
|
|
17200
17267
|
async function isSlackContinuation(task) {
|
|
17201
17268
|
return task.source === "schedule" && task.taskType === "deferred" && !!task.slackChannelId && !!task.slackThreadTs && !!task.agentId && !!(await getAgentById2(task.agentId))?.isLead;
|
|
@@ -17217,14 +17284,14 @@ async function conclusionResultsLines(closure) {
|
|
|
17217
17284
|
const agentName = await agentDisplayNameFor(member);
|
|
17218
17285
|
const card = await getSlackOutcomeMessage2(member.id);
|
|
17219
17286
|
if (card?.permalink) {
|
|
17220
|
-
lines.push(`↳ ${glyph}
|
|
17287
|
+
lines.push(`↳ ${iconPrefix(glyph)}${agentName} — [result](${card.permalink})`);
|
|
17221
17288
|
continue;
|
|
17222
17289
|
}
|
|
17223
17290
|
const raw = outcomeText(member.status === "failed" ? member.failureReason : slackTaskOutput(member), "");
|
|
17224
17291
|
const digest = raw.length > CONCLUSION_DIGEST_LENGTH ? `${raw.slice(0, CONCLUSION_DIGEST_LENGTH).trimEnd()}…` : raw;
|
|
17225
17292
|
const citedDigest = renderTaskCitations(digest, await getTaskCitations(member.id), "slack", false);
|
|
17226
17293
|
const label = digest ? `${agentName} — ${citedDigest}` : agentName;
|
|
17227
|
-
lines.push(`↳ ${glyph}
|
|
17294
|
+
lines.push(`↳ ${iconPrefix(glyph)}${label} ${getTaskLink(member.id)}`);
|
|
17228
17295
|
}
|
|
17229
17296
|
return lines;
|
|
17230
17297
|
}
|
|
@@ -17234,7 +17301,7 @@ async function conclusionTimeoutLines(ask, closure) {
|
|
|
17234
17301
|
if (isTerminalTreeStatus(member.status))
|
|
17235
17302
|
continue;
|
|
17236
17303
|
const glyph = await taskStateGlyph(member, new Date);
|
|
17237
|
-
lines.push(`↳ ${glyph}
|
|
17304
|
+
lines.push(`↳ ${iconPrefix(glyph)}${getTaskLink(member.id)}`);
|
|
17238
17305
|
}
|
|
17239
17306
|
return lines;
|
|
17240
17307
|
}
|
|
@@ -17413,7 +17480,7 @@ async function outcomeFooter(task, tasks, duration) {
|
|
|
17413
17480
|
return [];
|
|
17414
17481
|
return [{ type: "context", elements: [{ type: "mrkdwn", text: parts.join(" · ") }] }];
|
|
17415
17482
|
}
|
|
17416
|
-
async function streamOutcomeCard(task,
|
|
17483
|
+
async function streamOutcomeCard(task, options) {
|
|
17417
17484
|
const app = getSlackApp2();
|
|
17418
17485
|
const allowInProgress = options?.conclusionKind === "timeout";
|
|
17419
17486
|
if (!app || !task.slackChannelId || !task.slackThreadTs || !isOutcomeStatus(task.status) && !(allowInProgress && task.status === "in_progress"))
|
|
@@ -17421,8 +17488,6 @@ async function streamOutcomeCard(task, tree, options) {
|
|
|
17421
17488
|
const existing = await getSlackOutcomeMessage2(task.id);
|
|
17422
17489
|
if (existing && isSettledSlackMessage2(existing))
|
|
17423
17490
|
return existing?.finalizedAt ? existing : null;
|
|
17424
|
-
if (!tree.permalink)
|
|
17425
|
-
throw new Error(`Tree ${tree.id} has no permalink`);
|
|
17426
17491
|
const tasks = await getSlackTasksInThread2(task.slackChannelId, task.slackThreadTs);
|
|
17427
17492
|
const duration = formatV2Duration(new Date(task.createdAt), terminalEnd(task, new Date));
|
|
17428
17493
|
const slackReplySent = (await getTaskById2(task.id))?.slackReplySent ?? task.slackReplySent;
|
|
@@ -17455,7 +17520,7 @@ async function streamOutcomeCard(task, tree, options) {
|
|
|
17455
17520
|
let reservationWasCreated = false;
|
|
17456
17521
|
if (!outcome) {
|
|
17457
17522
|
const reserved = await reserveSlackMessage2({
|
|
17458
|
-
contextKey: task.contextKey ??
|
|
17523
|
+
contextKey: task.contextKey ?? slackContextKey({ channelId: task.slackChannelId, threadTs: task.slackThreadTs }),
|
|
17459
17524
|
channelId: task.slackChannelId,
|
|
17460
17525
|
threadTs: task.slackThreadTs,
|
|
17461
17526
|
kind: "outcome",
|
|
@@ -17673,71 +17738,38 @@ async function refreshResolvedDeferralCards() {
|
|
|
17673
17738
|
}
|
|
17674
17739
|
}
|
|
17675
17740
|
}
|
|
17676
|
-
|
|
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
|
+
}) {
|
|
17677
17767
|
if (!isSlackRenderV2Enabled2())
|
|
17678
17768
|
return "stop";
|
|
17679
|
-
|
|
17680
|
-
const
|
|
17681
|
-
if (
|
|
17682
|
-
|
|
17683
|
-
const recovered = await ensureSlackThreadTree2(initialTasks.map((task) => task.id), statusTick.budget);
|
|
17684
|
-
if (!recovered)
|
|
17685
|
-
return "skipped";
|
|
17686
|
-
tree = recovered;
|
|
17687
|
-
} catch (error) {
|
|
17688
|
-
console.error(`[Slack] Failed to recover pending v2 tree ${tree.id}:`, error);
|
|
17689
|
-
return "skipped";
|
|
17690
|
-
}
|
|
17691
|
-
}
|
|
17692
|
-
const app = getSlackApp2();
|
|
17693
|
-
if (app && !tree.permalink) {
|
|
17694
|
-
try {
|
|
17695
|
-
tree = await ensureTreePermalink(app.client, tree);
|
|
17696
|
-
} catch (error) {
|
|
17697
|
-
if (isSlackMessageNotFound(error)) {
|
|
17698
|
-
try {
|
|
17699
|
-
await replaceMissingTree(tree, statusTick.budget);
|
|
17700
|
-
} catch (replacementError) {
|
|
17701
|
-
console.error(`[Slack] Failed to replace missing v2 tree ${tree.id}:`, replacementError);
|
|
17702
|
-
}
|
|
17703
|
-
return "skipped";
|
|
17704
|
-
}
|
|
17705
|
-
console.error(`[Slack] Failed to resolve v2 tree permalink ${tree.id}:`, error);
|
|
17706
|
-
return "skipped";
|
|
17707
|
-
}
|
|
17708
|
-
}
|
|
17709
|
-
let tasks = await getSlackTasksInThread2(tree.channelId, tree.threadTs);
|
|
17710
|
-
let needsOutcome = false;
|
|
17711
|
-
for (const task of tasks) {
|
|
17712
|
-
const card = await getSlackOutcomeMessage2(task.id);
|
|
17713
|
-
if (card && isSettledSlackMessage2(card))
|
|
17714
|
-
continue;
|
|
17715
|
-
const isDirectCandidate = await taskNeedsDirectOutcome(task, activatedAt) && isOutcomeStatus(task.status) && !await isAnsweredByDeferralCard(task, tasks);
|
|
17716
|
-
const isChildCandidate = delegationEnabled && delegationActivatedAt !== null && isChildCardCandidate(task, delegationActivatedAt) && !task.slackReplySent;
|
|
17717
|
-
if (isDirectCandidate || isChildCandidate) {
|
|
17718
|
-
needsOutcome = true;
|
|
17719
|
-
break;
|
|
17720
|
-
}
|
|
17721
|
-
}
|
|
17722
|
-
if (needsOutcome && app) {
|
|
17723
|
-
try {
|
|
17724
|
-
await resolvePermalink(app.client, tree.channelId, tree.ts);
|
|
17725
|
-
} catch (error) {
|
|
17726
|
-
if (!isSlackMessageNotFound(error)) {
|
|
17727
|
-
console.error(`[Slack] Failed to verify v2 tree ${tree.id}:`, error);
|
|
17728
|
-
return "skipped";
|
|
17729
|
-
}
|
|
17730
|
-
try {
|
|
17731
|
-
const replacement = await replaceMissingTree(tree, statusTick.budget);
|
|
17732
|
-
if (!replacement)
|
|
17733
|
-
return "skipped";
|
|
17734
|
-
tree = replacement;
|
|
17735
|
-
tasks = await getSlackTasksInThread2(tree.channelId, tree.threadTs);
|
|
17736
|
-
} catch (replacementError) {
|
|
17737
|
-
console.error(`[Slack] Failed to replace missing v2 tree ${tree.id}:`, replacementError);
|
|
17738
|
-
return "skipped";
|
|
17739
|
-
}
|
|
17740
|
-
}
|
|
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";
|
|
17741
17773
|
}
|
|
17742
17774
|
const settleSec = Number(process.env.SLACK_CONCLUSION_SETTLE_SEC) || 10;
|
|
17743
17775
|
const timeoutMin = Number(process.env.SLACK_CONCLUSION_TIMEOUT_MIN) || 240;
|
|
@@ -17777,6 +17809,8 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17777
17809
|
const card = await getSlackOutcomeMessage2(task.id);
|
|
17778
17810
|
if (card && isSettledSlackMessage2(card))
|
|
17779
17811
|
continue;
|
|
17812
|
+
if (!card && endedBefore(task, outcomeWindow.finishedAfter))
|
|
17813
|
+
continue;
|
|
17780
17814
|
if (!delegationEnabled || delegationActivatedAt === null)
|
|
17781
17815
|
continue;
|
|
17782
17816
|
if (!isChildCardCandidate(task, delegationActivatedAt) || task.slackReplySent)
|
|
@@ -17792,7 +17826,7 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17792
17826
|
if (!await checkOutcomeDeliveryGate(task, card, statusTick.budget))
|
|
17793
17827
|
continue;
|
|
17794
17828
|
try {
|
|
17795
|
-
const outcome = await streamOutcomeCard(task,
|
|
17829
|
+
const outcome = await streamOutcomeCard(task, {
|
|
17796
17830
|
buildContent: childOutcomeContent,
|
|
17797
17831
|
statusBudget: statusTick.budget
|
|
17798
17832
|
});
|
|
@@ -17805,7 +17839,7 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17805
17839
|
}
|
|
17806
17840
|
outcomeCreated ||= !!outcome;
|
|
17807
17841
|
} catch (error) {
|
|
17808
|
-
await noteOutcomeDeliveryFailure(task,
|
|
17842
|
+
await noteOutcomeDeliveryFailure(task, error, statusTick.budget);
|
|
17809
17843
|
}
|
|
17810
17844
|
}
|
|
17811
17845
|
for (const task of tasks) {
|
|
@@ -17820,21 +17854,30 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17820
17854
|
continue;
|
|
17821
17855
|
const deferByClosure = task.source === "slack" && delegationEnabled && delegationActivatedAt !== null && task.createdAt >= delegationActivatedAt;
|
|
17822
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;
|
|
17823
17863
|
if (!await checkOutcomeDeliveryGate(task, card, statusTick.budget))
|
|
17824
17864
|
continue;
|
|
17825
17865
|
try {
|
|
17826
|
-
const outcome = await streamOutcomeCard(task,
|
|
17866
|
+
const outcome = await streamOutcomeCard(task, { statusBudget: statusTick.budget });
|
|
17827
17867
|
if (outcome) {
|
|
17828
17868
|
noteOutcomeDeliverySuccess(task.id);
|
|
17829
17869
|
await finalizeTerminalSlackReactions([task]);
|
|
17830
17870
|
}
|
|
17831
17871
|
outcomeCreated ||= !!outcome;
|
|
17832
17872
|
} catch (error) {
|
|
17833
|
-
await noteOutcomeDeliveryFailure(task,
|
|
17873
|
+
await noteOutcomeDeliveryFailure(task, error, statusTick.budget);
|
|
17834
17874
|
}
|
|
17835
17875
|
continue;
|
|
17836
17876
|
}
|
|
17837
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;
|
|
17838
17881
|
let childCardPending = false;
|
|
17839
17882
|
const existingChildCards = await childCardCountFor(task.id);
|
|
17840
17883
|
for (const member of closure) {
|
|
@@ -17843,6 +17886,8 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17843
17886
|
if (existingChildCards >= CHILD_CARDS_PER_ASK)
|
|
17844
17887
|
break;
|
|
17845
17888
|
const memberCard = await getSlackOutcomeMessage2(member.id);
|
|
17889
|
+
if (!memberCard && endedBefore(member, outcomeWindow.finishedAfter))
|
|
17890
|
+
continue;
|
|
17846
17891
|
if (!memberCard || !isSettledSlackMessage2(memberCard)) {
|
|
17847
17892
|
childCardPending = true;
|
|
17848
17893
|
break;
|
|
@@ -17856,7 +17901,7 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17856
17901
|
if (!await checkOutcomeDeliveryGate(task, card, statusTick.budget))
|
|
17857
17902
|
continue;
|
|
17858
17903
|
try {
|
|
17859
|
-
const outcome = await streamOutcomeCard(task,
|
|
17904
|
+
const outcome = await streamOutcomeCard(task, {
|
|
17860
17905
|
buildContent: (_t, slackReplySent) => askConclusionContent(task, closure, state, slackReplySent),
|
|
17861
17906
|
conclusionKind: state === "timedOut" ? "timeout" : "complete",
|
|
17862
17907
|
statusBudget: statusTick.budget
|
|
@@ -17873,22 +17918,22 @@ async function renderStoredTree(storedTree, { activatedAt, delegationEnabled, de
|
|
|
17873
17918
|
}
|
|
17874
17919
|
outcomeCreated ||= !!outcome;
|
|
17875
17920
|
} catch (error) {
|
|
17876
|
-
await noteOutcomeDeliveryFailure(task,
|
|
17921
|
+
await noteOutcomeDeliveryFailure(task, error, statusTick.budget);
|
|
17877
17922
|
}
|
|
17878
17923
|
}
|
|
17879
17924
|
try {
|
|
17880
|
-
await
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
try {
|
|
17886
|
-
if (await closeSlackTreeIfSettled(tree.id))
|
|
17887
|
-
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
|
+
}
|
|
17888
17930
|
} catch (error) {
|
|
17889
|
-
|
|
17931
|
+
if (!(error instanceof SlackTreeSuppressed2)) {
|
|
17932
|
+
console.error("[Slack] Failed to present v2 tree:", scrubSecrets(String(error)));
|
|
17933
|
+
}
|
|
17890
17934
|
}
|
|
17891
|
-
|
|
17935
|
+
await statusTick.reconcile(thread.channelId, thread.threadTs);
|
|
17936
|
+
return await slackThreadHasOutcomeWork(thread, outcomeWindow) ? "open" : "closed";
|
|
17892
17937
|
}
|
|
17893
17938
|
function yieldToEventLoop() {
|
|
17894
17939
|
return new Promise((resolve) => setImmediate(resolve));
|
|
@@ -17929,6 +17974,7 @@ function startSlackRenderV2Events2() {
|
|
|
17929
17974
|
renderEventsSubscribed = true;
|
|
17930
17975
|
}
|
|
17931
17976
|
function stopSlackRenderV2Events2() {
|
|
17977
|
+
invalidateSlackTreeOperations2();
|
|
17932
17978
|
if (!renderEventsSubscribed)
|
|
17933
17979
|
return;
|
|
17934
17980
|
for (const event of SLACK_RENDER_TASK_EVENTS)
|
|
@@ -17953,6 +17999,7 @@ function runExclusive(work) {
|
|
|
17953
17999
|
return run;
|
|
17954
18000
|
}
|
|
17955
18001
|
async function beginRenderPass() {
|
|
18002
|
+
await syncSlackTreeVisibility2();
|
|
17956
18003
|
const activatedAt = await ensureSlackRenderV2Activation2();
|
|
17957
18004
|
const delegationEnabled = isSlackDelegationEnabled();
|
|
17958
18005
|
const delegationActivatedAt = delegationEnabled ? await ensureSlackDelegationActivation2() : null;
|
|
@@ -17960,6 +18007,7 @@ async function beginRenderPass() {
|
|
|
17960
18007
|
activatedAt,
|
|
17961
18008
|
delegationEnabled,
|
|
17962
18009
|
delegationActivatedAt,
|
|
18010
|
+
outcomeWindow: slackOutcomeWindow(delegationEnabled),
|
|
17963
18011
|
statusTick: beginSlackStatusTick()
|
|
17964
18012
|
};
|
|
17965
18013
|
}
|
|
@@ -17979,23 +18027,10 @@ function processSlackRenderV22() {
|
|
|
17979
18027
|
return runExclusive(reconcileAllThreads);
|
|
17980
18028
|
}
|
|
17981
18029
|
async function reconcileAllThreads() {
|
|
17982
|
-
dirtyTaskIds.clear();
|
|
17983
|
-
dirtyThreads.clear();
|
|
17984
18030
|
const context = await beginRenderPass();
|
|
17985
|
-
|
|
17986
|
-
|
|
17987
|
-
|
|
17988
|
-
if (!task.slackChannelId || !task.slackThreadTs)
|
|
17989
|
-
continue;
|
|
17990
|
-
try {
|
|
17991
|
-
await ensureSlackThreadTree2([task.id], context.statusTick.budget);
|
|
17992
|
-
} catch (error) {
|
|
17993
|
-
console.error(`[Slack] Failed to create v2 tree for task ${task.id}:`, error);
|
|
17994
|
-
}
|
|
17995
|
-
}
|
|
17996
|
-
await yieldToEventLoop();
|
|
17997
|
-
for (const storedTree of await getSlackTreeMessages2()) {
|
|
17998
|
-
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")
|
|
17999
18034
|
return;
|
|
18000
18035
|
await yieldToEventLoop();
|
|
18001
18036
|
}
|
|
@@ -18018,27 +18053,18 @@ async function renderDirtyThreads() {
|
|
|
18018
18053
|
for (const thread of threads.values()) {
|
|
18019
18054
|
if (!isSlackRenderV2Enabled2())
|
|
18020
18055
|
return;
|
|
18021
|
-
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
}
|
|
18027
|
-
}
|
|
18028
|
-
for (const storedTree of await getSlackTreeMessages2({ thread })) {
|
|
18029
|
-
const result = await renderStoredTree(storedTree, context);
|
|
18030
|
-
if (result === "stop")
|
|
18031
|
-
return;
|
|
18032
|
-
if (result !== "closed" && await slackThreadHasOutcomeWork(thread)) {
|
|
18033
|
-
markSlackThreadDirty(thread.channelId, thread.threadTs, DIRTY_REVISIT_MS);
|
|
18034
|
-
}
|
|
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);
|
|
18035
18061
|
}
|
|
18036
18062
|
await yieldToEventLoop();
|
|
18037
18063
|
}
|
|
18038
18064
|
if (touched.wakeTouched)
|
|
18039
18065
|
await refreshResolvedDeferralCards();
|
|
18040
18066
|
}
|
|
18041
|
-
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;
|
|
18042
18068
|
var init_render_v2 = __esm(() => {
|
|
18043
18069
|
init_db4();
|
|
18044
18070
|
init_slack_trees();
|
|
@@ -18054,7 +18080,7 @@ var init_render_v2 = __esm(() => {
|
|
|
18054
18080
|
init_task_ui_spec2();
|
|
18055
18081
|
init_event_bus();
|
|
18056
18082
|
init_ack();
|
|
18057
|
-
|
|
18083
|
+
init_app4();
|
|
18058
18084
|
init_blocks();
|
|
18059
18085
|
init_closure();
|
|
18060
18086
|
init_reaction_shortcode();
|
|
@@ -18062,15 +18088,22 @@ var init_render_v2 = __esm(() => {
|
|
|
18062
18088
|
init_session_status();
|
|
18063
18089
|
init_task_attachments();
|
|
18064
18090
|
init_task_output();
|
|
18091
|
+
init_tree_visibility();
|
|
18065
18092
|
TREE_INDENT = { topLevel: 1, levelStep: 3 };
|
|
18066
18093
|
treeCreationPromises = new Map;
|
|
18067
18094
|
pendingTreeUpdates = new Map;
|
|
18068
18095
|
treeUpdateTails = new Map;
|
|
18069
18096
|
lastTreeText = new Map;
|
|
18070
18097
|
lastTreeUpdateAt = new Map;
|
|
18098
|
+
onSlackTreeInvalidated2(() => {
|
|
18099
|
+
for (const timer of pendingTreeUpdates.values())
|
|
18100
|
+
clearTimeout(timer);
|
|
18101
|
+
pendingTreeUpdates.clear();
|
|
18102
|
+
});
|
|
18071
18103
|
OUTCOME_DELIVERY_MAX_DELAY_MS = 30 * 60000;
|
|
18072
18104
|
outcomeDeliveryNextAttemptAt = new Map;
|
|
18073
18105
|
outcomeReservedWithoutAttempt = new Set;
|
|
18106
|
+
ensureSlackThreadTree = ensureSlackThreadPresentation2;
|
|
18074
18107
|
LINE_START_BLOCK = /^(?:`{3}|~{3}|[-*+]\s|\d+[.)]\s|>|#{1,6}\s|\||(?:-{3,}|\*{3,}|_{3,})[ \t]*(?:\r?\n|$)|(?: {4}|\t))/;
|
|
18075
18108
|
UI_SPEC_BLOCK_REJECTION_CODES = new Set([
|
|
18076
18109
|
"invalid_blocks",
|
|
@@ -18668,7 +18701,7 @@ var init_watcher = __esm(() => {
|
|
|
18668
18701
|
init_db4();
|
|
18669
18702
|
init_event_loop_lag();
|
|
18670
18703
|
init_ack();
|
|
18671
|
-
|
|
18704
|
+
init_app4();
|
|
18672
18705
|
init_blocks();
|
|
18673
18706
|
init_render_v2();
|
|
18674
18707
|
init_responses();
|
|
@@ -18889,17 +18922,17 @@ async function initSlackApp2() {
|
|
|
18889
18922
|
created.use(slackInboundOutcomeMiddleware(config.mode === "http" ? "http" : "socket"));
|
|
18890
18923
|
if (config.mode === "http")
|
|
18891
18924
|
created.use(ignoreSelfAsIgnored);
|
|
18892
|
-
const { registerMessageHandler } = await import("./handlers-
|
|
18893
|
-
const { registerCommandHandler } = await import("./commands-
|
|
18894
|
-
const { registerActionHandlers } = await import("./actions-
|
|
18895
|
-
const { registerWorkObjectHandlers } = await import("./work-objects-
|
|
18925
|
+
const { registerMessageHandler } = await import("./handlers-9kwcrc4k.js");
|
|
18926
|
+
const { registerCommandHandler } = await import("./commands-tsv2vx5b.js");
|
|
18927
|
+
const { registerActionHandlers } = await import("./actions-c4chgxp6.js");
|
|
18928
|
+
const { registerWorkObjectHandlers } = await import("./work-objects-pydhzast.js");
|
|
18896
18929
|
registerMessageHandler(created);
|
|
18897
18930
|
registerCommandHandler(created);
|
|
18898
18931
|
registerActionHandlers(created);
|
|
18899
18932
|
registerWorkObjectHandlers(created);
|
|
18900
|
-
const { createAssistant } = await import("./assistant-
|
|
18933
|
+
const { createAssistant } = await import("./assistant-cpjgpjvp.js");
|
|
18901
18934
|
created.assistant(createAssistant());
|
|
18902
|
-
const { isBlockExternalEnabled, scanExternalChannelsOnBoot } = await import("./external-channel-
|
|
18935
|
+
const { isBlockExternalEnabled, scanExternalChannelsOnBoot } = await import("./external-channel-v9zgxnxz.js");
|
|
18903
18936
|
if (isBlockExternalEnabled()) {
|
|
18904
18937
|
scanExternalChannelsOnBoot(created.client).catch((error) => {
|
|
18905
18938
|
console.error("[Slack] External channel boot scan failed:", error);
|
|
@@ -18927,7 +18960,7 @@ async function startSlackApp2() {
|
|
|
18927
18960
|
startRetryAttempt = 0;
|
|
18928
18961
|
if (!httpReceiver)
|
|
18929
18962
|
startSocketWatchdog();
|
|
18930
|
-
const { isSlackRenderV2Enabled } = await import("./render-v2-
|
|
18963
|
+
const { isSlackRenderV2Enabled } = await import("./render-v2-nrdkg9gf.js");
|
|
18931
18964
|
if (isSlackRenderV2Enabled())
|
|
18932
18965
|
await ensureSlackRenderV2Activation2();
|
|
18933
18966
|
await recoverSlackInboundAfterRestart();
|
|
@@ -18943,7 +18976,7 @@ async function startSlackApp2() {
|
|
|
18943
18976
|
} else {
|
|
18944
18977
|
console.log("[Slack] Bot connected via Socket Mode");
|
|
18945
18978
|
}
|
|
18946
|
-
const { restoreBufferedSlackMessages } = await import("./thread-buffer-
|
|
18979
|
+
const { restoreBufferedSlackMessages } = await import("./thread-buffer-temgaqsy.js");
|
|
18947
18980
|
await restoreBufferedSlackMessages().catch((error) => {
|
|
18948
18981
|
console.error("[Slack] Failed to restore buffered thread messages:", error);
|
|
18949
18982
|
});
|
|
@@ -19018,6 +19051,7 @@ async function stopSlackAppUnderLifecycleLock2() {
|
|
|
19018
19051
|
await teardownSlackApp();
|
|
19019
19052
|
}
|
|
19020
19053
|
async function teardownSlackApp() {
|
|
19054
|
+
invalidateSlackTreeOperations2();
|
|
19021
19055
|
const stopping = detachSlackApp();
|
|
19022
19056
|
if (stopping) {
|
|
19023
19057
|
await stopping.stop();
|
|
@@ -19052,7 +19086,7 @@ function detachSlackApp() {
|
|
|
19052
19086
|
return detached;
|
|
19053
19087
|
}
|
|
19054
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;
|
|
19055
|
-
var
|
|
19089
|
+
var init_app4 = __esm(() => {
|
|
19056
19090
|
init_db4();
|
|
19057
19091
|
init_node_env();
|
|
19058
19092
|
init_secret_scrubber();
|
|
@@ -19066,6 +19100,7 @@ var init_app3 = __esm(() => {
|
|
|
19066
19100
|
init_socket_ack();
|
|
19067
19101
|
init_socket_fence();
|
|
19068
19102
|
init_socket_mode_guard();
|
|
19103
|
+
init_tree_visibility();
|
|
19069
19104
|
init_watcher();
|
|
19070
19105
|
init_workspace_guard();
|
|
19071
19106
|
import_bolt6 = __toESM(require_dist5(), 1);
|
|
@@ -19090,4 +19125,4 @@ var init_app3 = __esm(() => {
|
|
|
19090
19125
|
watchdogOptions = SLACK_SOCKET_WATCHDOG_DEFAULTS;
|
|
19091
19126
|
});
|
|
19092
19127
|
|
|
19093
|
-
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,
|
|
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 };
|