@desplega.ai/agent-swarm 2.14.1 → 2.14.2
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-7jv7w8jh.js → acp-adapter-q1vz4hh2.js} +8 -8
- package/dist/{acp-targets-0ebmg3et.js → acp-targets-d44eerh4.js} +7 -7
- package/dist/{actions-0ds9dx6c.js → actions-z4k4bvss.js} +27 -27
- package/dist/{agent-fs-provision-zpbxa9jc.js → agent-fs-provision-aan1cgpx.js} +4 -4
- package/dist/{amp-adapter-awh5nn7a.js → amp-adapter-wac3py0p.js} +1 -1
- package/dist/{anthropic-messages-gtgp9r85.js → anthropic-messages-njt2r5m4.js} +16 -15
- package/dist/{app-nzejkvpp.js → app-wax6qz5e.js} +9 -9
- package/dist/{approval-notifications-hbqtb2w3.js → approval-notifications-6fvkhnma.js} +10 -10
- package/dist/{assistant-1paft129.js → assistant-e8fe08zx.js} +25 -25
- package/dist/{azure-openai-responses-e76k86gf.js → azure-openai-responses-6ewf9rwp.js} +9 -9
- package/dist/{boot-args-schema-zs435mfx.js → boot-args-schema-rv97cmnt.js} +1 -1
- package/dist/{boot-reembed-91qrd4mz.js → boot-reembed-bcn7frk9.js} +1 -1
- package/dist/{boot-reembed-7xq2qgg4.js → boot-reembed-xakrdy6y.js} +1 -1
- package/dist/{boot-scrub-sweep-3h5xscw6.js → boot-scrub-sweep-20t8akhf.js} +2 -2
- package/dist/{boot-seeds-xkxqa8zc.js → boot-seeds-48rr6r29.js} +4 -4
- package/dist/{boxd-464x3w4m.js → boxd-tjpxwecx.js} +2 -2
- package/dist/{claude-adapter-6d8eyf2f.js → claude-adapter-0wzwntrj.js} +8 -8
- package/dist/{claude-managed-adapter-jzxcaf9m.js → claude-managed-adapter-4xcgt46w.js} +2 -2
- package/dist/{claude-managed-setup-5fcx0qh3.js → claude-managed-setup-91cyktw7.js} +5 -5
- package/dist/{claude-sdk-session-11vhz1hc.js → claude-sdk-session-ngj4dce5.js} +9658 -9634
- package/dist/{cli-hamdfjtx.js → cli-021hrewp.js} +1 -1
- package/dist/{cli-pgdqhdkw.js → cli-0kyjrbaa.js} +2 -2
- package/dist/{cli-132h67ps.js → cli-0nz04gqv.js} +48 -48
- package/dist/{cli-6a77m17n.js → cli-0rrft7s3.js} +2 -2
- package/dist/{cli-z0effej1.js → cli-1d9q7qrn.js} +5 -5
- package/dist/{cli-tdd9dvw6.js → cli-1t5vhrpv.js} +1 -1
- package/dist/{cli-zyf288rw.js → cli-2ja7eadd.js} +1 -1
- package/dist/{cli-k9m8fckz.js → cli-3ffzr65w.js} +4 -4
- package/dist/{cli-02ba8qx5.js → cli-3kdgm393.js} +4 -4
- package/dist/{cli-hh5m39pt.js → cli-3vc518cw.js} +1 -1
- package/dist/{cli-5pyes68e.js → cli-5188hq0a.js} +8 -8
- package/dist/{cli-zcghfsdg.js → cli-53gt8wfv.js} +1 -1
- package/dist/{cli-5t00r6c9.js → cli-5njmmmer.js} +2 -2
- package/dist/{cli-etykr11s.js → cli-5rw7nt99.js} +1 -1
- package/dist/{cli-6c61yjwy.js → cli-5xx353cy.js} +7554 -1534
- package/dist/{cli-by7s3n4p.js → cli-65k149j5.js} +2 -2
- package/dist/{cli-1e13gvfn.js → cli-6zpn5hmp.js} +11 -11
- package/dist/{cli-rb1z91g8.js → cli-7dpdq7yh.js} +1230 -540
- package/dist/{cli-3bagv8rt.js → cli-7wwewkf4.js} +1 -1
- package/dist/{cli-288k5ep1.js → cli-83hynhes.js} +15 -11
- package/dist/{cli-v84kb7af.js → cli-8ee7xt75.js} +11 -11
- package/dist/{cli-v3jxx8dv.js → cli-8ef94zm2.js} +2 -2
- package/dist/{cli-9fvk9mv8.js → cli-8gr1bg9t.js} +1 -1
- package/dist/{cli-vrb8pvrf.js → cli-9j1qcs0b.js} +6 -6
- package/dist/{cli-0dkpdvnn.js → cli-9mvfvggt.js} +5 -5
- package/dist/{cli-3bcsc3m7.js → cli-an8bpy60.js} +1 -1
- package/dist/{cli-6yhjqd6k.js → cli-azptj8xe.js} +810 -184
- package/dist/{cli-3a3hm1z8.js → cli-c0rt16vk.js} +2 -2
- package/dist/{cli-byzq8xht.js → cli-c6vhcknq.js} +6 -6
- package/dist/{cli-eaqxkeq0.js → cli-cczffwak.js} +8 -8
- package/dist/{cli-83kf2y60.js → cli-cgmka83w.js} +6 -6
- package/dist/{cli-5xjdft4s.js → cli-d13qgcct.js} +207 -142
- package/dist/{cli-k3facve0.js → cli-d5nvy1jy.js} +1 -1
- package/dist/{cli-zvsy4abb.js → cli-dev6f0px.js} +3 -3
- package/dist/{cli-e1wprqnd.js → cli-dzhht0vq.js} +2 -2
- package/dist/{cli-zdkcp8p0.js → cli-e13kbyq0.js} +1 -1
- package/dist/{cli-f07sgaax.js → cli-e2k0ej0d.js} +2 -2
- package/dist/{cli-dt931hb8.js → cli-ek8b88kv.js} +21 -21
- package/dist/{cli-20mkgwev.js → cli-ertcjw6z.js} +249 -19
- package/dist/{cli-0qyfna7a.js → cli-f3ta4e67.js} +4 -4
- package/dist/{cli-6xrbpj5j.js → cli-f4xv7s0t.js} +4 -4
- package/dist/{cli-d1zkys4j.js → cli-fdam1t9b.js} +29 -13
- package/dist/{cli-spfz393q.js → cli-feh37wgs.js} +598 -219
- package/dist/{cli-ebqx630g.js → cli-fjzjtqna.js} +35 -18
- package/dist/{cli-zgsd2w2k.js → cli-fs9t2m2k.js} +16 -16
- package/dist/{cli-trvtxwzt.js → cli-g03x26q6.js} +2 -2
- package/dist/{cli-0mq8kxfx.js → cli-gnkzh8ed.js} +3 -3
- package/dist/{cli-phantfg3.js → cli-gy0r7gb8.js} +40 -15
- package/dist/{cli-wsh5vfa7.js → cli-h364asjc.js} +2 -2
- package/dist/{cli-3ktfe5jx.js → cli-h3xcfp4c.js} +22 -7
- package/dist/{cli-976m0zcw.js → cli-h8k5801a.js} +49 -13
- package/dist/{cli-727sq1f9.js → cli-h96yp7xv.js} +2 -2
- package/dist/{cli-ytgtqsy9.js → cli-hab0bvrh.js} +1 -1
- package/dist/{cli-7dwsn9y5.js → cli-j3wqt73b.js} +4 -4
- package/dist/{cli-8kemtj1r.js → cli-jfgaz10x.js} +7 -7
- package/dist/{cli-wtwe8vng.js → cli-jrhvywah.js} +25 -24
- package/dist/{cli-tjrrabez.js → cli-jrxt5j0n.js} +3 -3
- package/dist/{cli-7b7rxz22.js → cli-jw7n9pct.js} +5 -2
- package/dist/{cli-k791mabe.js → cli-k9kfck3s.js} +5 -5
- package/dist/{cli-44r66df2.js → cli-kkwq5b12.js} +1 -1
- package/dist/{cli-e9p9h14n.js → cli-nc842kc9.js} +4 -4
- package/dist/{cli-3179w2rz.js → cli-nmj4phcg.js} +1 -1
- package/dist/{cli-ny8f5g7t.js → cli-praaw1wh.js} +1 -1
- package/dist/{cli-j8fmn3wv.js → cli-q44p4869.js} +7 -7
- package/dist/{cli-sq32dgfe.js → cli-q58qt9dw.js} +237 -57
- package/dist/{cli-2n7qdqfv.js → cli-qqz5z36e.js} +2 -2
- package/dist/{cli-b70cpf8f.js → cli-r7rpy2xz.js} +1 -1
- package/dist/{cli-1hj68b3h.js → cli-rcqgr0hs.js} +1 -1
- package/dist/{cli-ph95yejc.js → cli-rjc464jg.js} +2 -2
- package/dist/{cli-967jrz7j.js → cli-rw3m83j4.js} +15 -15
- package/dist/{cli-0vxbrxr3.js → cli-rwcj6wt3.js} +304 -19
- package/dist/{cli-yvnnyjxm.js → cli-ryn4y478.js} +1 -1
- package/dist/{cli-3g0vbq46.js → cli-s48k2rzx.js} +3 -3
- package/dist/{cli-98sea4d9.js → cli-s90wcbk9.js} +2 -2
- package/dist/{cli-e2wzzw17.js → cli-svcy72s5.js} +1 -1
- package/dist/{cli-643skca1.js → cli-swtwbg85.js} +17 -17
- package/dist/{cli-4y2bekkn.js → cli-t1bqpzgz.js} +2 -2
- package/dist/{cli-zmfs06hg.js → cli-t5jbjq61.js} +3 -3
- package/dist/{cli-mz7ycqn8.js → cli-td2h8zej.js} +6 -6
- package/dist/{cli-9t7syepg.js → cli-ttatvwn6.js} +1 -1
- package/dist/{cli-v1rhq77v.js → cli-txxcf9s1.js} +6 -6
- package/dist/{cli-q4z9s6zs.js → cli-v7az4d1g.js} +2 -2
- package/dist/cli-vqt44168.js +14 -0
- package/dist/{cli-tkrp183j.js → cli-vs9h3vw2.js} +5 -5
- package/dist/{cli-7abeph0b.js → cli-w2fg8kjc.js} +3 -3
- package/dist/{cli-sf5kp73f.js → cli-wz7qj1jy.js} +12 -12
- package/dist/{cli-ww8wxfzx.js → cli-x5t54ytt.js} +2 -2
- package/dist/{cli-nmdy8bzf.js → cli-xphbv66z.js} +1 -1
- package/dist/{cli-redtbppc.js → cli-xxgqn93n.js} +3753 -1186
- package/dist/{cli-s7bfz1ye.js → cli-z209g721.js} +109 -85
- package/dist/{cli-vp2ksaq9.js → cli-z5andw8k.js} +1 -1
- package/dist/{cli-xmc2nrtv.js → cli-zr2sc5tr.js} +1 -1
- package/dist/{cli-z0c98h7h.js → cli-zrm0610v.js} +61 -54
- package/dist/cli.js +41 -40
- package/dist/{cloudflare-workers-ai-system-one-w3m0fbf8.js → cloudflare-workers-ai-system-one-kb0tq22h.js} +2 -2
- package/dist/{codex-adapter-seht4h9t.js → codex-adapter-0c1ynrmt.js} +5 -5
- package/dist/{codex-session-runner-tq95x3gq.js → codex-session-runner-z4t9z7yy.js} +5 -5
- package/dist/{commands-0awwqxq5.js → commands-h0jxqdhk.js} +3 -3
- package/dist/{controller-hgjx521c.js → controller-4ygy66hv.js} +3 -3
- package/dist/{controllers-connect-j4kdmhfj.js → controllers-connect-ynbvv8pv.js} +26 -26
- package/dist/core-mj9fzrcm.js +41 -0
- package/dist/{cursor-adapter-0rg8wk6j.js → cursor-adapter-9e4d6658.js} +1 -1
- package/dist/{db-8xs2js3s.js → db-bg0hxjq1.js} +3 -3
- package/dist/{db-dd6hj211.js → db-q12gmpns.js} +2 -2
- package/dist/{devtools-b8qts77k.js → devtools-t8my9az6.js} +1 -1
- package/dist/{dispatcher-v7drd034.js → dispatcher-v5dbfscq.js} +23 -23
- package/dist/{dsh-adapter-ah8npj2x.js → dsh-adapter-z3fneea1.js} +1 -1
- package/dist/{e2b-z1g7vpz6.js → e2b-k3kb8b52.js} +3 -3
- package/dist/{e2b-hg80w0qr.js → e2b-p269awh6.js} +4 -4
- package/dist/{easter-egg-3d-8n4w3s9k.js → easter-egg-3d-y49v5z90.js} +1 -1
- package/dist/{embedding-space-0p921zt3.js → embedding-space-mjt5ksq0.js} +5 -5
- package/dist/{embeddings-9s7kbrc6.js → embeddings-td9hgnc5.js} +1 -1
- package/dist/{execute-x0fy9j0m.js → execute-z8nc8bba.js} +1 -1
- package/dist/{external-channel-ktfvn29c.js → external-channel-pjenc2ag.js} +2 -2
- package/dist/{fx-adapter-15vjxvgm.js → fx-adapter-pjeztp0n.js} +9 -9
- package/dist/getMachineId-bsd-hjs2tbdp.js +36 -0
- package/dist/getMachineId-darwin-kzbvr8s3.js +40 -0
- package/dist/getMachineId-linux-embmcq2c.js +26 -0
- package/dist/getMachineId-unsupported-jvznc6d4.js +20 -0
- package/dist/getMachineId-win-qr8z0b13.js +36 -0
- package/dist/{google-generative-ai-nzndg246.js → google-generative-ai-tf3w7557.js} +11 -16
- package/dist/{google-vertex-ragh3nnw.js → google-vertex-9pj87bd8.js} +15 -17
- package/dist/{grok-adapter-77httan0.js → grok-adapter-davbhx8t.js} +9 -9
- package/dist/handlers-rf130hnp.js +39 -0
- package/dist/{heartbeat-5yaj6dym.js → heartbeat-9hmvqxk0.js} +26 -26
- package/dist/{hook-c99nycyh.js → hook-0b1jqs2t.js} +6 -6
- package/dist/{hook-2jttae8s.js → hook-1n0sjv8p.js} +7 -7
- package/dist/{http-7y9dbfrr.js → http-vykejyjx.js} +412 -183
- package/dist/{index-tcegcysh.js → index-07d66kdm.js} +5 -5
- package/dist/{index-fqf82sbk.js → index-0hgjxqz8.js} +1 -1
- package/dist/{index-t274qhhs.js → index-0nt39qwy.js} +6 -6
- package/dist/{index-8p03vx1h.js → index-2xbxq71g.js} +8 -8
- package/dist/{index-jvfp0j47.js → index-3j8hffkb.js} +12038 -7667
- package/dist/index-8w09aggw.js +43 -0
- package/dist/{index-xhp7yp3t.js → index-b3wy4jzs.js} +1 -1
- package/dist/{index-6g9rdcrj.js → index-dt9vr7tb.js} +162 -57
- package/dist/{index-cw8nxnba.js → index-ezfas4jj.js} +1912 -346
- package/dist/index-g2jntx15.js +38 -0
- package/dist/{index-h9xnzfhx.js → index-j6sqtb83.js} +101 -72
- package/dist/{index-m6g8q65g.js → index-na0tczq0.js} +9268 -10220
- package/dist/{index-tn1m3q9b.js → index-p9dkwhwe.js} +3 -3
- package/dist/{index-g7rthzrv.js → index-pe2etczf.js} +8 -8
- package/dist/index-qffex5k4.js +41 -0
- package/dist/index-qrp11tp9.js +4 -0
- package/dist/{index-t4n9z755.js → index-ryyrg0d8.js} +406 -317
- package/dist/{index-t17p395x.js → index-sf06w57a.js} +13 -13
- package/dist/{index-qxcfv8vq.js → index-vybnwd5v.js} +1 -1
- package/dist/{index-dm7c6hw5.js → index-wsf1f5pe.js} +27 -27
- package/dist/{keepalive-7eyb8y4t.js → keepalive-86z0tzzf.js} +3 -3
- package/dist/lead-edmwagkn.js +81 -0
- package/dist/{llama-cpp-classify-yvb8vh7w.js → llama-cpp-classify-wd7htn1x.js} +2 -2
- package/dist/{maintenance-tdrd8nwv.js → maintenance-19h6tfwz.js} +1 -1
- package/dist/{mistral-conversations-w4bncwbt.js → mistral-conversations-txjmc64f.js} +7 -7
- package/dist/{module-ES6BEMUI-6htewwha.js → module-ES6BEMUI-44w9s1dx.js} +4 -4
- package/dist/{multipart-parser-xevcstye.js → multipart-parser-xqbgwrav.js} +1 -1
- package/dist/{oauth-refresh-sweep-f4c7g37h.js → oauth-refresh-sweep-6nmyrv32.js} +2 -2
- package/dist/{object-webhooks-p190rdxp.js → object-webhooks-2kynmdf8.js} +7 -7
- package/dist/{onboard-56h4sks6.js → onboard-zbpm96mn.js} +5 -5
- package/dist/{openai-codex-responses-z2h941b8.js → openai-codex-responses-6ckhys6r.js} +31 -25
- package/dist/{openai-completions-5bxdkeg9.js → openai-completions-c9dsq9jh.js} +17 -17
- package/dist/{openai-decisions-fyq1p9f9.js → openai-decisions-9vzvv10c.js} +2 -2
- package/dist/{openai-responses-dzf3e8r5.js → openai-responses-bhfmt9sa.js} +9 -9
- package/dist/{opencode-adapter-xg3yxfr0.js → opencode-adapter-fyqcbdra.js} +5 -5
- package/dist/{openrouter-images-0jj12a2q.js → openrouter-images-hkk5p580.js} +3 -3
- package/dist/otel-impl-txa20w1h.js +11178 -0
- package/dist/{pending-xgv316w0.js → pending-4rxawq8y.js} +24 -24
- package/dist/{pi-messages-zk3g4esn.js → pi-messages-py3f96p7.js} +5 -5
- package/dist/{pi-mono-adapter-txe0syzb.js → pi-mono-adapter-rnsed1xa.js} +14 -14
- package/dist/{pricing-refresh-041zpyhf.js → pricing-refresh-4314hwtw.js} +2 -2
- package/dist/{rbac-roles-8f3jbcaf.js → rbac-roles-fztcm8ky.js} +2 -2
- package/dist/{rbac-roles-cw7rrw5b.js → rbac-roles-msqt7a3k.js} +3 -3
- package/dist/{render-v2-2ezw4mzt.js → render-v2-w49wtecg.js} +9 -9
- package/dist/{resume-p14wdx8m.js → resume-gwgtp4m3.js} +12 -12
- package/dist/{runtime-he7c9g1r.js → runtime-kkebz8yq.js} +1 -1
- package/dist/{session-access-8jvq86fj.js → session-access-kjb19m2w.js} +5 -5
- package/dist/{session-source-backfill-6fe3hcgb.js → session-source-backfill-805p4wqr.js} +2 -2
- package/dist/{setup-6v0bn4r1.js → setup-q8y168c8.js} +3 -3
- package/dist/thread-buffer-yqbffd0t.js +40 -0
- package/dist/{tree-visibility-g1a8ff4r.js → tree-visibility-qj323994.js} +2 -2
- package/dist/{typesafe-system-one-qkvkgrcz.js → typesafe-system-one-avrdb4zm.js} +2 -2
- package/dist/{user-merge-jobs-vjsps179.js → user-merge-jobs-qfp40f2s.js} +3 -3
- package/dist/{virtual-modules-mreda4fp.js → virtual-modules-nzxegw0a.js} +7 -7
- package/dist/{work-objects-hfw15e35.js → work-objects-hs089w60.js} +25 -25
- package/dist/{worker-follow-up-gbaz2ydz.js → worker-follow-up-zwgg20sr.js} +23 -23
- package/dist/worker-kg4g7rnx.js +81 -0
- package/openapi.json +3 -3
- package/package.json +25 -24
- package/plugin/commands/create-pr.md +5 -2
- package/plugin/pi-skills/create-pr/SKILL.md +5 -2
- package/src/apps/sync.ts +7 -2
- package/src/be/db/workflow-runs.ts +12 -8
- package/src/be/db.ts +4 -1
- package/src/be/migrations/367_workflow_run_principal.sql +5 -0
- package/src/be/swarm-config-guard.ts +3 -0
- package/src/be/task-auto-title-listener.ts +2 -2
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/extensions/post-bridge.ts +27 -28
- package/src/http/active-sessions.ts +7 -0
- package/src/http/agents.ts +7 -0
- package/src/http/api-keys.ts +7 -0
- package/src/http/approval-requests.ts +4 -0
- package/src/http/budgets.ts +2 -0
- package/src/http/codex-oauth-keep-warm.ts +6 -2
- package/src/http/config.ts +1 -0
- package/src/http/context.ts +4 -0
- package/src/http/db-query.ts +3 -0
- package/src/http/events.ts +2 -0
- package/src/http/fs.ts +1 -0
- package/src/http/integrations.ts +4 -0
- package/src/http/mcp-bridge.ts +1 -0
- package/src/http/memory.ts +3 -0
- package/src/http/metrics.ts +16 -0
- package/src/http/oauth-locks.ts +8 -0
- package/src/http/page-proxy.ts +16 -0
- package/src/http/pages.ts +9 -0
- package/src/http/poll.ts +1 -0
- package/src/http/pricing.ts +2 -0
- package/src/http/prompt-templates.ts +34 -0
- package/src/http/schedules.ts +10 -0
- package/src/http/script-runs.ts +24 -0
- package/src/http/scripts.ts +1 -0
- package/src/http/session-data.ts +2 -0
- package/src/http/status.ts +1 -0
- package/src/http/tasks.ts +17 -0
- package/src/http/trackers/jira.ts +2 -0
- package/src/http/trackers/linear.ts +4 -0
- package/src/http/users.ts +18 -0
- package/src/http/webhooks.ts +12 -0
- package/src/http/workflow-events.ts +26 -6
- package/src/http/workflows.ts +40 -0
- package/src/http/x.ts +4 -0
- package/src/linear/app.ts +3 -2
- package/src/linear/client.ts +5 -1
- package/src/linear/host.ts +40 -0
- package/src/linear/oauth.ts +3 -2
- package/src/linear/sync.ts +4 -3
- package/src/otel-impl.ts +8 -5
- package/src/providers/amp-adapter.ts +1 -1
- package/src/rbac/legacy-policy.ts +2 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/scripts-runtime/quickjs-compat.ts +44 -10
- package/src/slack/render-v2.ts +50 -23
- package/src/slack/reviewed-deliverables.ts +251 -0
- package/src/tests/check-pr-body.test.ts +408 -93
- package/src/tests/compose-dev-object-store.test.ts +13 -0
- package/src/tests/compose-example-object-store.test.ts +67 -0
- package/src/tests/db-query.test.ts +8 -4
- package/src/tests/e2b-dispatch.test.ts +7 -1
- package/src/tests/otel-event-loop-and-logs.test.ts +1 -1
- package/src/tests/quickjs-compat.test.ts +40 -4
- package/src/tests/rbac-route-verbs-e2e.test.ts +142 -0
- package/src/tests/script-connections.test.ts +2 -0
- package/src/tests/slack-render-v2.test.ts +52 -8
- package/src/tests/workflow-definition-pinning.test.ts +2 -0
- package/src/tests/workflow-hitl-routing.test.ts +67 -5
- package/src/tests/workflow-replay.test.ts +13 -1
- package/src/tests/x402-client.test.ts +82 -0
- package/src/tools/memory-rate.ts +2 -2
- package/src/tools/prompt-templates/delete.ts +22 -1
- package/src/tools/prompt-templates/set.ts +15 -1
- package/src/utils/constants.ts +5 -4
- package/src/utils/task-citations.ts +11 -0
- package/src/workflows/engine.ts +5 -0
- package/src/workflows/executors/sub-workflow.ts +5 -7
- package/src/workflows/executors/swarm-script.ts +4 -5
- package/src/workflows/resume.ts +21 -4
- package/src/workflows/run-principal.ts +51 -0
- package/src/x402/client.ts +38 -17
- package/templates/skills/code-quality/content.md +1 -1
- package/templates/skills/pages/content.md +36 -12
- package/templates/skills/swarm-docs/content.md +46 -41
- package/templates/skills/swarm-scripts/SKILL.md +1 -1
- package/templates/skills/swarm-scripts/content.md +1 -1
- package/dist/cli-547fsc36.js +0 -15
- package/dist/cli-dr6x9qdk.js +0 -15
- package/dist/cli-h5cveb69.js +0 -15
- package/dist/cli-jngvszex.js +0 -1514
- package/dist/cli-p0g0erm9.js +0 -15
- package/dist/cli-ph1jce1b.js +0 -16
- package/dist/cli-vxxdf2ma.js +0 -15
- package/dist/cli-x80zagf5.js +0 -15
- package/dist/core-8fw1gwg7.js +0 -41
- package/dist/getMachineId-bsd-2rd3pnz7.js +0 -36
- package/dist/getMachineId-bsd-3p48mkt1.js +0 -36
- package/dist/getMachineId-bsd-bk6tmeen.js +0 -36
- package/dist/getMachineId-bsd-pssqgwmm.js +0 -37
- package/dist/getMachineId-bsd-v218x3xd.js +0 -36
- package/dist/getMachineId-bsd-wbxcazef.js +0 -36
- package/dist/getMachineId-bsd-x0942pbz.js +0 -36
- package/dist/getMachineId-darwin-5qsy4qcg.js +0 -36
- package/dist/getMachineId-darwin-6v7zsshx.js +0 -37
- package/dist/getMachineId-darwin-fcc3fjag.js +0 -36
- package/dist/getMachineId-darwin-pg84hftj.js +0 -36
- package/dist/getMachineId-darwin-tyyevt26.js +0 -36
- package/dist/getMachineId-darwin-wagmbf0d.js +0 -36
- package/dist/getMachineId-darwin-zvkmwr3y.js +0 -36
- package/dist/getMachineId-linux-2ncg1epd.js +0 -29
- package/dist/getMachineId-linux-2tmt2ptc.js +0 -29
- package/dist/getMachineId-linux-empwyp2y.js +0 -29
- package/dist/getMachineId-linux-fanqd45b.js +0 -29
- package/dist/getMachineId-linux-h6fyga0x.js +0 -29
- package/dist/getMachineId-linux-tbhgz1k9.js +0 -29
- package/dist/getMachineId-linux-zrbyw7dt.js +0 -29
- package/dist/getMachineId-unsupported-29g9dkgv.js +0 -19
- package/dist/getMachineId-unsupported-8xfq8djv.js +0 -19
- package/dist/getMachineId-unsupported-8y9cag1p.js +0 -19
- package/dist/getMachineId-unsupported-a6sjrm02.js +0 -19
- package/dist/getMachineId-unsupported-bp3w7ds0.js +0 -19
- package/dist/getMachineId-unsupported-sj6fk8sw.js +0 -19
- package/dist/getMachineId-unsupported-v0p5gdxp.js +0 -19
- package/dist/getMachineId-win-hc996p0x.js +0 -38
- package/dist/getMachineId-win-msq9ad87.js +0 -38
- package/dist/getMachineId-win-tajyqwd6.js +0 -38
- package/dist/getMachineId-win-tzc163da.js +0 -38
- package/dist/getMachineId-win-xdaa0mgq.js +0 -38
- package/dist/getMachineId-win-xk6p98m5.js +0 -38
- package/dist/getMachineId-win-xtk658fm.js +0 -38
- package/dist/handlers-c1jp5b6h.js +0 -39
- package/dist/index-7dwh9kxh.js +0 -41
- package/dist/index-wp9tarbt.js +0 -43
- package/dist/index-z6np2405.js +0 -38
- package/dist/lead-50cgn8s1.js +0 -81
- package/dist/otel-impl-kepzgm4n.js +0 -55386
- package/dist/thread-buffer-8860v1ta.js +0 -40
- package/dist/worker-hkm8ftqp.js +0 -81
- /package/dist/{node-gbx1t3pa.js → node-q4628t0b.js} +0 -0
package/src/slack/render-v2.ts
CHANGED
|
@@ -46,13 +46,17 @@ import {
|
|
|
46
46
|
import { getTaskCitations } from "../be/task-citations";
|
|
47
47
|
import { getTaskUiSpec } from "../be/task-ui-spec";
|
|
48
48
|
import { slackContextKey } from "../tasks/context-key";
|
|
49
|
-
import type { AgentTask
|
|
49
|
+
import type { AgentTask } from "../types";
|
|
50
50
|
import { taskUiSpecSlackBlocks } from "../ui-spec/slack";
|
|
51
51
|
import { ensure } from "../utils/business-use";
|
|
52
52
|
import { isEnvFlagEnabled } from "../utils/env-flag";
|
|
53
53
|
import { scrubSecrets } from "../utils/secret-scrubber";
|
|
54
54
|
import { taskAttachmentDisplayUrl } from "../utils/task-attachment-links";
|
|
55
|
-
import {
|
|
55
|
+
import {
|
|
56
|
+
renderTaskCitations,
|
|
57
|
+
taskCitationSourceGroups,
|
|
58
|
+
taskCitationUrls,
|
|
59
|
+
} from "../utils/task-citations";
|
|
56
60
|
import { TASK_UI_SPEC_UPDATED_EVENT } from "../utils/task-ui-spec";
|
|
57
61
|
import { workflowEventBus } from "../workflows/event-bus";
|
|
58
62
|
import {
|
|
@@ -81,6 +85,14 @@ import {
|
|
|
81
85
|
type SlackReactionEvent,
|
|
82
86
|
} from "./reaction-shortcode";
|
|
83
87
|
import { getAgentDisplayName, getAgentSlackIcon } from "./responses";
|
|
88
|
+
import {
|
|
89
|
+
describeLink,
|
|
90
|
+
linkifyBareUrls,
|
|
91
|
+
linkKey,
|
|
92
|
+
outputLinks,
|
|
93
|
+
reviewedTaskDeliverables,
|
|
94
|
+
slackLink,
|
|
95
|
+
} from "./reviewed-deliverables";
|
|
84
96
|
import {
|
|
85
97
|
_resetSlackSessionStatusForTests,
|
|
86
98
|
beginSlackStatusTick,
|
|
@@ -1501,20 +1513,8 @@ async function recordSlackDelivery(
|
|
|
1501
1513
|
});
|
|
1502
1514
|
}
|
|
1503
1515
|
|
|
1504
|
-
function
|
|
1505
|
-
|
|
1506
|
-
if (!attachment) return undefined;
|
|
1507
|
-
const url = taskAttachmentDisplayUrl(attachment);
|
|
1508
|
-
if (!/^https?:\/\//.test(url)) return undefined;
|
|
1509
|
-
const label = attachment.name
|
|
1510
|
-
.replace(/\s+/g, " ")
|
|
1511
|
-
.trim()
|
|
1512
|
-
.replace(/&/g, "&")
|
|
1513
|
-
.replace(/</g, "<")
|
|
1514
|
-
.replace(/>/g, ">");
|
|
1515
|
-
// Keep the mrkdwn link destination intact without changing existing URL escapes.
|
|
1516
|
-
const destination = url.replace(/[\s\\<>|]/g, encodeURIComponent);
|
|
1517
|
-
return `📎 <${destination}|${label}>`;
|
|
1516
|
+
function linkCaption(url: string, name: string, icon: string): string | undefined {
|
|
1517
|
+
return /^https?:\/\//.test(url) ? `${icon} ${slackLink(url, name)}` : undefined;
|
|
1518
1518
|
}
|
|
1519
1519
|
|
|
1520
1520
|
/** The task's own card: its Slack blocks and the text that stands in for them. */
|
|
@@ -1572,17 +1572,44 @@ function withUiSpecFallbackText(
|
|
|
1572
1572
|
|
|
1573
1573
|
/**
|
|
1574
1574
|
* Secondary metadata for an outcome card, as captions (`context` blocks)
|
|
1575
|
-
* under the answer: cited sources, general sources, then the
|
|
1576
|
-
* attachment
|
|
1577
|
-
* markers decide which sources
|
|
1575
|
+
* under the answer: cited sources, general sources, then "Links:" with the
|
|
1576
|
+
* primary attachment and a Lead review's worker deliverables. `content` is
|
|
1577
|
+
* the unrendered answer, whose `[citation:N]` markers decide which sources
|
|
1578
|
+
* count as cited. A URL shows once: a link in the answer or in a source is
|
|
1579
|
+
* not listed under "Links:" again.
|
|
1578
1580
|
*/
|
|
1579
1581
|
async function outcomeCaptionBlocks(task: AgentTask, content: string): Promise<unknown[]> {
|
|
1580
1582
|
const moreUrl = getTaskUrl(task.id);
|
|
1581
|
-
const
|
|
1583
|
+
const citations = await getTaskCitations(task.id);
|
|
1584
|
+
const sources = taskCitationSourceGroups(content, citations).map((group) =>
|
|
1582
1585
|
buildCaptionBlock(group.items, { heading: group.heading, moreUrl }),
|
|
1583
1586
|
);
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1587
|
+
const seen = [...outputLinks(content), ...taskCitationUrls(citations)];
|
|
1588
|
+
const attachments = await getSlackOutputAttachments(task.id);
|
|
1589
|
+
const primary = attachments.find((item) => item.isPrimary) ?? attachments[0];
|
|
1590
|
+
const ownUrl = primary ? taskAttachmentDisplayUrl(primary) : undefined;
|
|
1591
|
+
const ownShown = !!ownUrl && !new Set(seen.map(linkKey)).has(linkKey(ownUrl));
|
|
1592
|
+
// A Lead review card also lists the reviewed worker's deliverables.
|
|
1593
|
+
const reviewed = await reviewedTaskDeliverables(
|
|
1594
|
+
task,
|
|
1595
|
+
ownUrl ? [...seen, ownUrl] : seen,
|
|
1596
|
+
getSlackApp()?.client,
|
|
1597
|
+
);
|
|
1598
|
+
const links = [
|
|
1599
|
+
...(primary && ownUrl && ownShown ? [{ url: ownUrl, ...describeLink(ownUrl, primary) }] : []),
|
|
1600
|
+
...reviewed.links,
|
|
1601
|
+
];
|
|
1602
|
+
const items = links
|
|
1603
|
+
.map((link) => linkCaption(link.url, link.label, link.icon))
|
|
1604
|
+
.filter((item): item is string => !!item);
|
|
1605
|
+
if (reviewed.omitted > 0) {
|
|
1606
|
+
const more = `+${reviewed.omitted} more`;
|
|
1607
|
+
items.push(reviewed.moreUrl ? `<${reviewed.moreUrl}|${more}>` : more);
|
|
1608
|
+
}
|
|
1609
|
+
return [
|
|
1610
|
+
...sources,
|
|
1611
|
+
items.length > 0 ? buildCaptionBlock(items, { heading: "Links" }) : undefined,
|
|
1612
|
+
].filter(Boolean);
|
|
1586
1613
|
}
|
|
1587
1614
|
|
|
1588
1615
|
type MarkdownFence = { character: "`" | "~"; length: number };
|
|
@@ -1636,7 +1663,7 @@ function safeMarkdownBoundary(markdown: string, maxLength: number): number {
|
|
|
1636
1663
|
/** The answer as Markdown, with citation markers resolved and no sources appended. */
|
|
1637
1664
|
async function outcomePresentation(task: AgentTask, content: string): Promise<string> {
|
|
1638
1665
|
const body = normalizeV2Text(
|
|
1639
|
-
renderTaskCitations(content, await getTaskCitations(task.id), "slack", false),
|
|
1666
|
+
renderTaskCitations(linkifyBareUrls(content), await getTaskCitations(task.id), "slack", false),
|
|
1640
1667
|
);
|
|
1641
1668
|
if (body.length <= MAX_OUTCOME_MARKDOWN_LENGTH) return body;
|
|
1642
1669
|
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import type { WebClient } from "@slack/web-api";
|
|
2
|
+
import { getAgentById, getTaskById } from "../be/db";
|
|
3
|
+
import type { AgentTask, TaskAttachment } from "../types";
|
|
4
|
+
import {
|
|
5
|
+
getAgentFsLiveUrl,
|
|
6
|
+
getAppUrl,
|
|
7
|
+
getPublicMcpBaseUrl,
|
|
8
|
+
isAgentFsProxyEnabled,
|
|
9
|
+
} from "../utils/constants";
|
|
10
|
+
import { taskAttachmentDisplayUrl } from "../utils/task-attachment-links";
|
|
11
|
+
import { getTaskUrl } from "./blocks";
|
|
12
|
+
import { getChannelExternality } from "./external-channel";
|
|
13
|
+
import { getSlackOutputAttachments } from "./task-attachments";
|
|
14
|
+
|
|
15
|
+
/** Most links one card lists; the rest are counted under "+N more". */
|
|
16
|
+
const MAX_DELIVERABLE_LINKS = 6;
|
|
17
|
+
const MAX_LINK_LABEL_LENGTH = 40;
|
|
18
|
+
const OUTPUT_URL_PATTERN = /https?:\/\/[^\s<>()[\]{}"'`|]+/g;
|
|
19
|
+
// An agent-fs public share page (`/share/<token>`) or shared folder site
|
|
20
|
+
// (`/site/<token>/`), on the agent-fs host or the API's proxy of it.
|
|
21
|
+
const PUBLIC_SHARE_PATH = /^\/(?:share|site)\/[^/]+/;
|
|
22
|
+
|
|
23
|
+
const VIDEO_EXTENSION = /\.(?:mp4|mov|webm|m4v|mkv)$/i;
|
|
24
|
+
const VIDEO_HOSTS = new Set(["youtube.com", "youtu.be", "loom.com", "vimeo.com"]);
|
|
25
|
+
|
|
26
|
+
/** `icon` is a Unicode emoji, which Slack renders in mrkdwn. */
|
|
27
|
+
export type DeliverableLink = { url: string; label: string; icon: string };
|
|
28
|
+
|
|
29
|
+
function urlOrigin(url: string | undefined): string | undefined {
|
|
30
|
+
if (!url?.trim()) return undefined;
|
|
31
|
+
try {
|
|
32
|
+
return new URL(url.trim()).origin;
|
|
33
|
+
} catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The origins that serve agent-fs public shares: the live host, the public
|
|
40
|
+
* agent-fs API when set, and the API itself when it proxies `/share` and
|
|
41
|
+
* `/site`. Read per call, so a config change applies without a restart.
|
|
42
|
+
*/
|
|
43
|
+
function publicShareOrigins(): Set<string> {
|
|
44
|
+
const origins = [getAgentFsLiveUrl(), process.env.AGENT_FS_PUBLIC_URL];
|
|
45
|
+
if (isAgentFsProxyEnabled()) origins.push(getPublicMcpBaseUrl());
|
|
46
|
+
return new Set(origins.map(urlOrigin).filter((origin): origin is string => !!origin));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* True for an agent-fs public share link: anyone with it can open it without
|
|
51
|
+
* a login. Both the origin and the path must match: worker output is free
|
|
52
|
+
* text, so a `/share/` path on any other host proves nothing.
|
|
53
|
+
*/
|
|
54
|
+
export function isPublicShareUrl(url: string): boolean {
|
|
55
|
+
try {
|
|
56
|
+
const parsed = new URL(url);
|
|
57
|
+
return publicShareOrigins().has(parsed.origin) && PUBLIC_SHARE_PATH.test(parsed.pathname);
|
|
58
|
+
} catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The http(s) links in free text, without the punctuation that ends a sentence. */
|
|
64
|
+
export function outputLinks(text: string): string[] {
|
|
65
|
+
return [...text.matchAll(OUTPUT_URL_PATTERN)].map((match) =>
|
|
66
|
+
match[0].replace(/[.,;:!?*_~]+$/, ""),
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function truncate(label: string): string {
|
|
71
|
+
return label.length <= MAX_LINK_LABEL_LENGTH
|
|
72
|
+
? label
|
|
73
|
+
: `${label.slice(0, MAX_LINK_LABEL_LENGTH - 1)}…`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function decoded(segment: string): string {
|
|
77
|
+
try {
|
|
78
|
+
return decodeURIComponent(segment);
|
|
79
|
+
} catch {
|
|
80
|
+
return segment;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** `host/last-segment`, with `…` for the segments between. */
|
|
85
|
+
function shortUrlLabel(parsed: URL): string {
|
|
86
|
+
const host = parsed.hostname.replace(/^www\./, "");
|
|
87
|
+
const segments = parsed.pathname.split("/").filter(Boolean).map(decoded);
|
|
88
|
+
if (segments.length === 0) return host;
|
|
89
|
+
return `${host}/${segments.length > 1 ? "…/" : ""}${segments.at(-1)}`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* A short label and a type icon for a deliverable: an attachment keeps its
|
|
94
|
+
* own name, a bare link gets one from its URL (a file name, `Page`). A GitHub
|
|
95
|
+
* PR or issue is always `PR #12` / `Issue #12`.
|
|
96
|
+
*/
|
|
97
|
+
export function describeLink(
|
|
98
|
+
url: string,
|
|
99
|
+
attachment?: TaskAttachment,
|
|
100
|
+
): Omit<DeliverableLink, "url"> {
|
|
101
|
+
const name = attachment?.name.replace(/\s+/g, " ").trim();
|
|
102
|
+
const labelled = (icon: string, fallback: string) => ({
|
|
103
|
+
icon,
|
|
104
|
+
label: truncate(name || fallback),
|
|
105
|
+
});
|
|
106
|
+
let parsed: URL;
|
|
107
|
+
try {
|
|
108
|
+
parsed = new URL(url);
|
|
109
|
+
} catch {
|
|
110
|
+
return labelled("🔗", url);
|
|
111
|
+
}
|
|
112
|
+
const host = parsed.hostname.replace(/^www\./, "");
|
|
113
|
+
const path = parsed.pathname;
|
|
114
|
+
const fileName = decoded(path.split("/").filter(Boolean).at(-1) ?? "") || shortUrlLabel(parsed);
|
|
115
|
+
const github = host === "github.com" ? path.match(/^\/[^/]+\/[^/]+\/(pull|issues)\/(\d+)/) : null;
|
|
116
|
+
// The server names its own PR attachments "GitHub pull request #N": always use the short form.
|
|
117
|
+
if (github) {
|
|
118
|
+
const pull = github[1] === "pull";
|
|
119
|
+
return { icon: pull ? "🔀" : "🎫", label: `${pull ? "PR" : "Issue"} #${github[2]}` };
|
|
120
|
+
}
|
|
121
|
+
if (attachment?.mimeType?.startsWith("video/") || VIDEO_EXTENSION.test(path)) {
|
|
122
|
+
return labelled("🎬", fileName);
|
|
123
|
+
}
|
|
124
|
+
if (VIDEO_HOSTS.has(host)) return labelled("🎬", "Video");
|
|
125
|
+
if (isPublicShareUrl(url)) {
|
|
126
|
+
return labelled("🔗", path.startsWith("/site/") ? "Shared site" : "Shared file");
|
|
127
|
+
}
|
|
128
|
+
const appPage = parsed.origin === urlOrigin(getAppUrl()) && /^\/pages\/[^/]+\/?$/.test(path);
|
|
129
|
+
if (attachment?.kind === "page" || appPage) return labelled("📃", "Page");
|
|
130
|
+
if (
|
|
131
|
+
attachment?.kind === "agent-fs" ||
|
|
132
|
+
attachment?.kind === "shared-fs" ||
|
|
133
|
+
attachment?.providerId === "agent-fs" ||
|
|
134
|
+
path.includes("/file/~/")
|
|
135
|
+
) {
|
|
136
|
+
return labelled("📄", fileName);
|
|
137
|
+
}
|
|
138
|
+
return labelled("🌐", shortUrlLabel(parsed));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** A URL compared by target: `www.`, host case and trailing slashes do not count. */
|
|
142
|
+
export function linkKey(url: string): string {
|
|
143
|
+
try {
|
|
144
|
+
const parsed = new URL(url);
|
|
145
|
+
parsed.hostname = parsed.hostname.replace(/^www\./, "");
|
|
146
|
+
return parsed.href.replace(/\/+(?=$|[?#])/, "");
|
|
147
|
+
} catch {
|
|
148
|
+
return url.replace(/\/+$/, "");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** A Slack `<url|label>` link: the label is escaped, the destination keeps its own escapes. */
|
|
153
|
+
export function slackLink(url: string, name: string): string {
|
|
154
|
+
const label = name
|
|
155
|
+
.replace(/\s+/g, " ")
|
|
156
|
+
.trim()
|
|
157
|
+
.replace(/&/g, "&")
|
|
158
|
+
.replace(/</g, "<")
|
|
159
|
+
.replace(/>/g, ">");
|
|
160
|
+
return `<${url.replace(/[\s\\<>|]/g, encodeURIComponent)}|${label}>`;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Escapes, code, and text that is already a link come first, so a URL inside
|
|
164
|
+
// them is never matched on its own. Group 2 is a bare URL.
|
|
165
|
+
const LINKIFY_PATTERN = new RegExp(
|
|
166
|
+
[
|
|
167
|
+
String.raw`\\[\s\S]`,
|
|
168
|
+
"```[\\s\\S]*?(?:```|$)",
|
|
169
|
+
"~~~[\\s\\S]*?(?:~~~|$)",
|
|
170
|
+
String.raw`(?<!\`)(\`+)(?!\`)(?:(?!\r?\n[ \t]*\r?\n)[\s\S])*?(?<!\`)\1(?!\`)`,
|
|
171
|
+
String.raw`<https?:\/\/[^<>\s]*(?:\|[^<>\n]*)?>`,
|
|
172
|
+
String.raw`!?\[[^\]]*\]\([^)\s]*(?:\s+"[^"]*")?\)`,
|
|
173
|
+
`(${OUTPUT_URL_PATTERN.source})`,
|
|
174
|
+
].join("|"),
|
|
175
|
+
"g",
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Bare http(s) URLs in Markdown as Slack `<url|label>` links, labelled like
|
|
180
|
+
* the "Links:" caption. Code, `<url|label>` and `[label](url)` stay as written.
|
|
181
|
+
*/
|
|
182
|
+
export function linkifyBareUrls(text: string): string {
|
|
183
|
+
return text.replace(
|
|
184
|
+
LINKIFY_PATTERN,
|
|
185
|
+
(match, _code, url: string | undefined, offset: number, whole: string) => {
|
|
186
|
+
// A URL that runs on into a bracket (a `[REDACTED]` marker, a query in
|
|
187
|
+
// braces) has no known end: leave it bare rather than link half of it.
|
|
188
|
+
if (!url || /[[({<`]/.test(whole[offset + match.length] ?? "")) return match;
|
|
189
|
+
const href = url.replace(/[.,;:!?*_~]+$/, "");
|
|
190
|
+
return `${slackLink(href, describeLink(href).label)}${url.slice(href.length)}`;
|
|
191
|
+
},
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The deliverables of the worker task a Lead follow-up reviews: its output
|
|
197
|
+
* attachments, then the http(s) links in its output. Worker cards do not post
|
|
198
|
+
* while delegation is off, so the follow-up card is the only place a person
|
|
199
|
+
* sees them. Links in `seen` (the card's answer, sources and own
|
|
200
|
+
* attachment) are skipped. In a channel Slack does not confirm as internal (Slack
|
|
201
|
+
* Connect, or a failed lookup), only public share links the worker already
|
|
202
|
+
* made are kept: an app or agent-fs file link needs a login the other
|
|
203
|
+
* organization does not have, and would disclose an internal path.
|
|
204
|
+
*/
|
|
205
|
+
export async function reviewedTaskDeliverables(
|
|
206
|
+
task: AgentTask,
|
|
207
|
+
seen: readonly string[],
|
|
208
|
+
client: WebClient | undefined,
|
|
209
|
+
): Promise<{ links: DeliverableLink[]; omitted: number; moreUrl?: string }> {
|
|
210
|
+
const none = { links: [], omitted: 0 };
|
|
211
|
+
if (
|
|
212
|
+
task.source !== "system" ||
|
|
213
|
+
task.taskType !== "follow-up" ||
|
|
214
|
+
!task.parentTaskId ||
|
|
215
|
+
!task.slackChannelId ||
|
|
216
|
+
!task.agentId ||
|
|
217
|
+
!(await getAgentById(task.agentId))?.isLead
|
|
218
|
+
) {
|
|
219
|
+
return none;
|
|
220
|
+
}
|
|
221
|
+
const reviewed = await getTaskById(task.parentTaskId);
|
|
222
|
+
if (!reviewed) return none;
|
|
223
|
+
|
|
224
|
+
const candidates: DeliverableLink[] = [];
|
|
225
|
+
for (const attachment of await getSlackOutputAttachments(reviewed.id)) {
|
|
226
|
+
const url = taskAttachmentDisplayUrl(attachment);
|
|
227
|
+
candidates.push({ url, ...describeLink(url, attachment) });
|
|
228
|
+
}
|
|
229
|
+
for (const url of outputLinks(reviewed.output ?? "")) {
|
|
230
|
+
candidates.push({ url, ...describeLink(url) });
|
|
231
|
+
}
|
|
232
|
+
if (candidates.length === 0) return none;
|
|
233
|
+
|
|
234
|
+
const internal =
|
|
235
|
+
!!client && (await getChannelExternality(client, task.slackChannelId)) === "internal";
|
|
236
|
+
const skip = new Set(seen.map(linkKey));
|
|
237
|
+
const links: DeliverableLink[] = [];
|
|
238
|
+
for (const candidate of candidates) {
|
|
239
|
+
const key = linkKey(candidate.url);
|
|
240
|
+
if (!/^https?:\/\//.test(candidate.url) || skip.has(key)) continue;
|
|
241
|
+
if (!internal && !isPublicShareUrl(candidate.url)) continue;
|
|
242
|
+
skip.add(key);
|
|
243
|
+
links.push(candidate);
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
links: links.slice(0, MAX_DELIVERABLE_LINKS),
|
|
247
|
+
omitted: Math.max(0, links.length - MAX_DELIVERABLE_LINKS),
|
|
248
|
+
// The task page needs a swarm login: only an internal channel links to it.
|
|
249
|
+
moreUrl: internal ? getTaskUrl(reviewed.id) : undefined,
|
|
250
|
+
};
|
|
251
|
+
}
|