@desplega.ai/agent-swarm 2.14.0 → 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-q1vz4hh2.js +17 -0
- package/dist/{acp-targets-23exz4z4.js → acp-targets-d44eerh4.js} +10 -10
- package/dist/{actions-zcr25x27.js → actions-z4k4bvss.js} +28 -28
- package/dist/{agent-fs-provision-7fa9e12e.js → agent-fs-provision-aan1cgpx.js} +4 -4
- package/dist/{amp-adapter-s7ytmv6b.js → amp-adapter-wac3py0p.js} +3 -3
- package/dist/{anthropic-messages-vdd1zmha.js → anthropic-messages-njt2r5m4.js} +28 -27
- package/dist/{app-5d3sz1hy.js → app-wax6qz5e.js} +10 -10
- package/dist/{approval-notifications-7qgkzkzx.js → approval-notifications-6fvkhnma.js} +11 -11
- package/dist/{assistant-p2yvhc3j.js → assistant-e8fe08zx.js} +29 -29
- package/dist/{azure-openai-responses-jeaas6x0.js → azure-openai-responses-6ewf9rwp.js} +6 -6
- package/dist/{boot-args-schema-ry6cb0p7.js → boot-args-schema-rv97cmnt.js} +1 -1
- package/dist/{boot-reembed-c9643ms3.js → boot-reembed-bcn7frk9.js} +1 -1
- package/dist/{boot-reembed-2hkm3vz2.js → boot-reembed-xakrdy6y.js} +1 -1
- package/dist/{boot-scrub-sweep-3ycxr51t.js → boot-scrub-sweep-20t8akhf.js} +2 -2
- package/dist/{boot-seeds-2hzvvzg0.js → boot-seeds-48rr6r29.js} +4 -4
- package/dist/{boxd-9py3x0jb.js → boxd-tjpxwecx.js} +3 -3
- package/dist/{claude-adapter-dnkww93e.js → claude-adapter-0wzwntrj.js} +12 -13
- package/dist/{claude-managed-adapter-yk0cr5x6.js → claude-managed-adapter-4xcgt46w.js} +4 -4
- package/dist/{claude-managed-setup-4byxpp47.js → claude-managed-setup-91cyktw7.js} +7 -7
- package/dist/{claude-sdk-session-4wf3dbvs.js → claude-sdk-session-ngj4dce5.js} +11144 -12464
- package/dist/{cli-gcyws2bp.js → cli-021hrewp.js} +2 -2
- package/dist/{cli-wvgg7r4j.js → cli-08gfvs58.js} +2 -2
- package/dist/{cli-2zjxake1.js → cli-0kyjrbaa.js} +4 -4
- package/dist/{cli-rp1n2xpd.js → cli-0nvqg1hb.js} +1 -1
- package/dist/{cli-vxmmttmt.js → cli-0nz04gqv.js} +50 -50
- package/dist/{cli-vr4eyq6p.js → cli-0rrft7s3.js} +538 -410
- package/dist/{cli-mw1tmn3x.js → cli-1d9q7qrn.js} +7 -7
- package/dist/{cli-84xn7bgz.js → cli-1t5vhrpv.js} +1 -1
- package/dist/{cli-hzhv7yac.js → cli-1zbj28py.js} +1 -1
- package/dist/{cli-z8t4485r.js → cli-2ja7eadd.js} +2 -2
- package/dist/{cli-r04ve9xw.js → cli-2r62jy9s.js} +1 -1
- package/dist/{cli-9fwznq4p.js → cli-3ffzr65w.js} +7 -7
- package/dist/{cli-2ckwgs7q.js → cli-3kdgm393.js} +5 -5
- package/dist/{cli-jwnac23b.js → cli-3vc518cw.js} +1 -1
- package/dist/{cli-6p8p2e6r.js → cli-5188hq0a.js} +1286 -31
- package/dist/{cli-zcghfsdg.js → cli-53gt8wfv.js} +1 -1
- package/dist/{cli-930zbczq.js → cli-5njmmmer.js} +3 -3
- package/dist/{cli-dw9rtjm3.js → cli-5rw7nt99.js} +3061 -727
- package/dist/{cli-6c61yjwy.js → cli-5xx353cy.js} +7554 -1534
- package/dist/{cli-2ap1the6.js → cli-65k149j5.js} +2 -2
- package/dist/{cli-v41kn3cd.js → cli-6prwz0zn.js} +4427 -5566
- package/dist/{cli-yd7e590v.js → cli-6zpn5hmp.js} +12 -12
- package/dist/{cli-ty3gha1p.js → cli-7b9bwrfg.js} +2 -2
- package/dist/{cli-2414h5r9.js → cli-7dpdq7yh.js} +11428 -1914
- package/dist/{cli-r9d2tya0.js → cli-7qkbab03.js} +5 -5
- package/dist/{cli-7ca8hczj.js → cli-7svwhw1a.js} +1 -1
- package/dist/cli-7wwewkf4.js +37 -0
- package/dist/{cli-ejnhs815.js → cli-83hynhes.js} +17 -13
- package/dist/{cli-rs1rzwp4.js → cli-8crn0510.js} +1 -1
- package/dist/{cli-f2rwt43y.js → cli-8ee7xt75.js} +13 -13
- package/dist/{cli-9j47sgzy.js → cli-8ef94zm2.js} +2 -2
- package/dist/{cli-9fvk9mv8.js → cli-8gr1bg9t.js} +1 -1
- package/dist/{cli-b0m3bg0f.js → cli-9j1qcs0b.js} +1 -1
- package/dist/{cli-ad00h1st.js → cli-9mvfvggt.js} +7 -7
- package/dist/{cli-xh5fpmg8.js → cli-9txap41q.js} +101 -18
- package/dist/{cli-24wervhz.js → cli-aktk3qt6.js} +3 -3
- package/dist/{cli-6ajyhxh7.js → cli-an8bpy60.js} +2 -2
- package/dist/{cli-meydjstb.js → cli-azptj8xe.js} +5591 -69
- package/dist/cli-c0rt16vk.js +15 -0
- package/dist/{cli-w4bvtxet.js → cli-c6vhcknq.js} +7 -7
- package/dist/{cli-2savn6mm.js → cli-cczffwak.js} +7 -7
- package/dist/{cli-ze1ndjs4.js → cli-cgmka83w.js} +3 -3
- package/dist/{cli-kc7vd07m.js → cli-d13qgcct.js} +3699 -1733
- package/dist/{cli-k3facve0.js → cli-d5nvy1jy.js} +1 -1
- package/dist/{cli-edxfzgah.js → cli-dev6f0px.js} +4 -4
- package/dist/{cli-0e914dp9.js → cli-dzhht0vq.js} +3 -3
- package/dist/{cli-m0ea8ggd.js → cli-e13kbyq0.js} +2 -2
- package/dist/{cli-73rmgm45.js → cli-e2k0ej0d.js} +2 -2
- package/dist/cli-ek8b88kv.js +9740 -0
- package/dist/{cli-0k7ppk9k.js → cli-ertcjw6z.js} +281 -46
- package/dist/{cli-qrwjk4xy.js → cli-f3ta4e67.js} +5 -5
- package/dist/{cli-1nfabrt4.js → cli-f4xv7s0t.js} +7 -7
- package/dist/{cli-phe2vcw5.js → cli-fdam1t9b.js} +171 -104
- package/dist/{cli-gc6b94tj.js → cli-fe8he9cy.js} +2 -2
- package/dist/{cli-spfz393q.js → cli-feh37wgs.js} +598 -219
- package/dist/{cli-ebqx630g.js → cli-fjzjtqna.js} +35 -18
- package/dist/{cli-37p61fcg.js → cli-fs9t2m2k.js} +18 -20
- package/dist/{cli-7w1fs01q.js → cli-g03x26q6.js} +2 -2
- package/dist/{cli-879txsac.js → cli-gnkzh8ed.js} +4 -4
- package/dist/{cli-v4z5v3jd.js → cli-gy0r7gb8.js} +514 -337
- package/dist/{cli-s4pccby1.js → cli-h0edykd1.js} +1 -1
- package/dist/{cli-pq0kv31y.js → cli-h364asjc.js} +9 -9
- package/dist/{cli-69szn7w7.js → cli-h3xcfp4c.js} +93 -54
- package/dist/{cli-jcnc5ret.js → cli-h8k5801a.js} +73 -27
- package/dist/{cli-6yy4fepf.js → cli-h96yp7xv.js} +4 -4
- package/dist/{cli-q5n3deaf.js → cli-hab0bvrh.js} +1 -1
- package/dist/{cli-g6a696c0.js → cli-j3wqt73b.js} +4 -4
- package/dist/{cli-wym6rxgt.js → cli-jfgaz10x.js} +10 -15
- package/dist/{cli-shyhb4t5.js → cli-jrhvywah.js} +53 -52
- package/dist/{cli-qkbevqer.js → cli-jrxt5j0n.js} +3 -3
- package/dist/{cli-7b7rxz22.js → cli-jw7n9pct.js} +5 -2
- package/dist/{cli-8vbxjzk0.js → cli-k9kfck3s.js} +3 -3
- package/dist/{cli-yjb3cddd.js → cli-kkwq5b12.js} +1 -1
- package/dist/{cli-39t9d248.js → cli-kz8rar0g.js} +1 -1
- package/dist/{cli-rzbsh6bw.js → cli-n15fhd43.js} +1 -1
- package/dist/{cli-1jx0srjt.js → cli-nc842kc9.js} +1921 -80
- package/dist/{cli-9j1t3kf6.js → cli-nmj4phcg.js} +2 -2
- package/dist/{cli-t9pzz2eq.js → cli-ntmjzyte.js} +4 -1
- package/dist/{cli-adzmmcvf.js → cli-praaw1wh.js} +2 -2
- package/dist/{cli-f9g96z28.js → cli-q44p4869.js} +11 -11
- package/dist/{cli-fww016hh.js → cli-q58qt9dw.js} +1711 -7287
- package/dist/{cli-njvpngc6.js → cli-qqz5z36e.js} +3 -3
- package/dist/{cli-096aftq6.js → cli-r7rpy2xz.js} +7 -7
- package/dist/cli-rcqgr0hs.js +30 -0
- package/dist/{cli-ph95yejc.js → cli-rjc464jg.js} +2 -2
- package/dist/{cli-md4tn21h.js → cli-rw3m83j4.js} +40 -26
- package/dist/cli-rwcj6wt3.js +1291 -0
- package/dist/{cli-srq69pn1.js → cli-ryn4y478.js} +1 -1
- package/dist/{cli-jgq9xptq.js → cli-s48k2rzx.js} +4 -4
- package/dist/{cli-cbg0j1yt.js → cli-s90wcbk9.js} +3 -3
- package/dist/{cli-2ayk9gn8.js → cli-svcy72s5.js} +2 -2
- package/dist/{cli-4dyzzkfb.js → cli-swtwbg85.js} +944 -170
- package/dist/{cli-mv8ft7b0.js → cli-t1bqpzgz.js} +3 -3
- package/dist/{cli-tc165vrb.js → cli-t5jbjq61.js} +4 -3
- package/dist/{cli-enavhq6r.js → cli-tbrjvrrg.js} +1 -1
- package/dist/{cli-mz7ycqn8.js → cli-td2h8zej.js} +6 -6
- package/dist/{cli-9t7syepg.js → cli-ttatvwn6.js} +1 -1
- package/dist/{cli-ayxxkk3p.js → cli-txxcf9s1.js} +8 -8
- package/dist/{cli-q4z9s6zs.js → cli-v7az4d1g.js} +2 -2
- package/dist/cli-vqt44168.js +14 -0
- package/dist/{cli-q457ga28.js → cli-vs9h3vw2.js} +14 -14
- package/dist/{cli-snxhtehz.js → cli-w2fg8kjc.js} +7 -8
- package/dist/{cli-wd7b5hgc.js → cli-w81s97bn.js} +1 -1
- package/dist/{cli-bqfx72e6.js → cli-wkzrknpt.js} +1 -1
- package/dist/{cli-cg1q8ymp.js → cli-wqpvfq2m.js} +1 -1
- package/dist/{cli-kg63yp1r.js → cli-wz7qj1jy.js} +19 -19
- package/dist/{cli-3wsabyt0.js → cli-x5t54ytt.js} +2 -2
- package/dist/{cli-r495stwd.js → cli-xd6ntv7x.js} +2 -2
- package/dist/{cli-wvbaq052.js → cli-xphbv66z.js} +10 -3
- package/dist/{cli-a49frv85.js → cli-xxgqn93n.js} +3753 -1186
- package/dist/{cli-91amj3md.js → cli-z209g721.js} +111 -87
- package/dist/{cli-3mhdmcd4.js → cli-z5andw8k.js} +1 -1
- package/dist/{cli-7g5qj2ca.js → cli-zcb64xzv.js} +1 -1
- package/dist/{cli-0h6m6z5g.js → cli-zr2sc5tr.js} +1 -1
- package/dist/{cli-krk8y8c7.js → cli-zrm0610v.js} +1833 -518
- package/dist/cli.js +73 -73
- package/dist/{cloudflare-workers-ai-system-one-w3m0fbf8.js → cloudflare-workers-ai-system-one-kb0tq22h.js} +2 -2
- package/dist/{codex-adapter-eq61radw.js → codex-adapter-0c1ynrmt.js} +9 -9
- package/dist/{codex-hook-8nmepvz6.js → codex-hook-w5nmtrn2.js} +2 -2
- package/dist/{codex-login-vbd9707w.js → codex-login-67qarfcg.js} +1 -1
- package/dist/{codex-session-runner-rfx355h4.js → codex-session-runner-z4t9z7yy.js} +10 -10
- package/dist/{commands-d1z0sx62.js → commands-h0jxqdhk.js} +3 -3
- package/dist/{controller-9hz6d8x3.js → controller-4ygy66hv.js} +4 -4
- package/dist/{controllers-connect-tz07d2xr.js → controllers-connect-ynbvv8pv.js} +28 -28
- package/dist/core-mj9fzrcm.js +41 -0
- package/dist/{cursor-adapter-ef22ze3j.js → cursor-adapter-9e4d6658.js} +2 -2
- package/dist/{db-gd81d68c.js → db-bg0hxjq1.js} +3 -3
- package/dist/{db-vrckks6q.js → db-q12gmpns.js} +2 -2
- package/dist/{devin-adapter-kdt6a2bh.js → devin-adapter-tn1twrha.js} +1 -1
- package/dist/{devtools-qxfgbsqz.js → devtools-t8my9az6.js} +1 -1
- package/dist/{dispatcher-76as8w2t.js → dispatcher-v5dbfscq.js} +24 -24
- package/dist/{docker-51ta7jsh.js → docker-6007r2fj.js} +2 -2
- package/dist/{dsh-adapter-ypfvcdyz.js → dsh-adapter-z3fneea1.js} +2 -2
- package/dist/{e2b-05kn3kpq.js → e2b-k3kb8b52.js} +4 -4
- package/dist/{e2b-dm9r8hpy.js → e2b-p269awh6.js} +5 -5
- package/dist/{easter-egg-3d-sg21j15g.js → easter-egg-3d-y49v5z90.js} +1 -1
- package/dist/{embedding-space-zsdw37bb.js → embedding-space-mjt5ksq0.js} +5 -5
- package/dist/{embeddings-p4e3e1m6.js → embeddings-td9hgnc5.js} +1 -1
- package/dist/emscripten-module-Q67P5WYC-3sde6cre.js +2458 -0
- package/dist/{event-bus-tvf2grf4.js → event-bus-pawddp92.js} +1 -1
- package/dist/{execute-nztd0af0.js → execute-z8nc8bba.js} +1 -1
- package/dist/{external-channel-717yzn4d.js → external-channel-pjenc2ag.js} +2 -2
- package/dist/ffi-cbfmmtqk.js +85 -0
- package/dist/fx-adapter-pjeztp0n.js +20 -0
- 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-sw77egmr.js → google-generative-ai-tf3w7557.js} +11 -16
- package/dist/{google-vertex-rrw93g8h.js → google-vertex-9pj87bd8.js} +15 -17
- package/dist/grok-adapter-davbhx8t.js +20 -0
- package/dist/handlers-rf130hnp.js +39 -0
- package/dist/heartbeat-9hmvqxk0.js +49 -0
- package/dist/hook-0b1jqs2t.js +21 -0
- package/dist/{hook-ctz0xmp3.js → hook-1n0sjv8p.js} +10 -11
- package/dist/{http-zregegrx.js → http-vykejyjx.js} +432 -170
- package/dist/{index-7dgxveck.js → index-07d66kdm.js} +3 -3
- package/dist/index-0hgjxqz8.js +10584 -0
- package/dist/{index-rz8ve510.js → index-0nt39qwy.js} +2 -2
- package/dist/{index-ym9fgxad.js → index-2xbxq71g.js} +2 -2
- package/dist/{index-42jq9yy3.js → index-3j8hffkb.js} +12327 -7450
- package/dist/index-8w09aggw.js +43 -0
- package/dist/{index-5kx15d19.js → index-b3wy4jzs.js} +1 -1
- package/dist/{index-kzdqn3dd.js → index-dt9vr7tb.js} +3143 -760
- package/dist/{index-maddg9ys.js → index-ezfas4jj.js} +5858 -15337
- package/dist/index-g2jntx15.js +38 -0
- package/dist/{index-x9qf8dg7.js → index-j6sqtb83.js} +105 -75
- package/dist/{index-m6g8q65g.js → index-na0tczq0.js} +9268 -10220
- package/dist/{index-whysn1wf.js → index-p9dkwhwe.js} +1 -1
- package/dist/{index-126v2d0t.js → index-pe2etczf.js} +6 -2918
- package/dist/{index-mtnbhe12.js → index-q60mhcpd.js} +23631 -19921
- package/dist/index-qffex5k4.js +41 -0
- package/dist/index-qrp11tp9.js +4 -0
- package/dist/{index-kdmkfjt7.js → index-ryyrg0d8.js} +3426 -2333
- package/dist/{index-t17p395x.js → index-sf06w57a.js} +13 -13
- package/dist/{index-evay0xyk.js → index-vybnwd5v.js} +1 -1
- package/dist/{index-fdym6ryb.js → index-wsf1f5pe.js} +28 -28
- package/dist/{k8s-ejkk0aw7.js → k8s-mr1r12th.js} +2 -2
- package/dist/{keepalive-zdqay870.js → keepalive-86z0tzzf.js} +4 -4
- package/dist/lead-edmwagkn.js +81 -0
- package/dist/{llama-cpp-classify-yvb8vh7w.js → llama-cpp-classify-wd7htn1x.js} +2 -2
- package/dist/{maintenance-t5ndg11m.js → maintenance-19h6tfwz.js} +1 -1
- package/dist/{mistral-conversations-w4bncwbt.js → mistral-conversations-txjmc64f.js} +7 -7
- package/dist/module-ES6BEMUI-44w9s1dx.js +1210 -0
- package/dist/{multipart-parser-xevcstye.js → multipart-parser-xqbgwrav.js} +1 -1
- package/dist/{node-0as4n1ef.js → node-q4628t0b.js} +1 -1
- package/dist/{oauth-refresh-sweep-y9zyd7t6.js → oauth-refresh-sweep-6nmyrv32.js} +3 -3
- package/dist/{object-webhooks-mkca91s0.js → object-webhooks-2kynmdf8.js} +7 -7
- package/dist/{onboard-ss995244.js → onboard-zbpm96mn.js} +7 -7
- package/dist/{openai-codex-responses-70g39cgz.js → openai-codex-responses-6ckhys6r.js} +35 -29
- package/dist/{openai-completions-cv3hp4h5.js → openai-completions-c9dsq9jh.js} +15 -15
- package/dist/{openai-decisions-fyq1p9f9.js → openai-decisions-9vzvv10c.js} +2 -2
- package/dist/{openai-responses-trsvnks6.js → openai-responses-bhfmt9sa.js} +6 -6
- package/dist/{opencode-adapter-mwpz0278.js → opencode-adapter-fyqcbdra.js} +8 -8
- package/dist/{openrouter-images-0jj12a2q.js → openrouter-images-hkk5p580.js} +3 -3
- package/dist/otel-impl-txa20w1h.js +11178 -0
- package/dist/{pending-2sxh1t6j.js → pending-4rxawq8y.js} +25 -25
- package/dist/{pi-messages-zk3g4esn.js → pi-messages-py3f96p7.js} +5 -5
- package/dist/{pi-mono-adapter-sfb7zy43.js → pi-mono-adapter-rnsed1xa.js} +24 -27
- package/dist/{pricing-refresh-h79bg4cf.js → pricing-refresh-4314hwtw.js} +2 -2
- package/dist/{rbac-roles-ckq0czp4.js → rbac-roles-fztcm8ky.js} +2 -2
- package/dist/{rbac-roles-jg2e260w.js → rbac-roles-msqt7a3k.js} +3 -3
- package/dist/{render-v2-ymbshmn0.js → render-v2-w49wtecg.js} +10 -10
- package/dist/{resume-jdhnt4jk.js → resume-gwgtp4m3.js} +13 -13
- package/dist/{runtime-y28jhhnf.js → runtime-kkebz8yq.js} +1 -1
- package/dist/{session-access-k4ta5hvp.js → session-access-kjb19m2w.js} +5 -5
- package/dist/{session-source-backfill-528j4s8j.js → session-source-backfill-805p4wqr.js} +3 -3
- package/dist/{setup-d6pj82fr.js → setup-q8y168c8.js} +3 -3
- package/dist/thread-buffer-yqbffd0t.js +40 -0
- package/dist/{token-util-pjgekqxr.js → token-util-hnzceyn9.js} +1 -1
- package/dist/{token-pgr2w4s3.js → token-xnc02n6w.js} +21 -14
- package/dist/{tree-visibility-kjxv3nxk.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-rabbncf6.js → user-merge-jobs-qfp40f2s.js} +3 -3
- package/dist/{virtual-modules-22k51txd.js → virtual-modules-nzxegw0a.js} +7 -7
- package/dist/{work-objects-xtjbar3r.js → work-objects-hs089w60.js} +26 -26
- package/dist/{worker-follow-up-fg48vk6d.js → worker-follow-up-zwgg20sr.js} +24 -24
- package/dist/worker-kg4g7rnx.js +81 -0
- package/dist/{x-vfsqypht.js → x-k29vmskt.js} +2 -2
- package/openapi.json +59 -3
- package/package.json +53 -52
- 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/model-profiles.ts +103 -12
- package/src/be/db/tasks/read.ts +5 -0
- package/src/be/db/workflow-runs.ts +12 -8
- package/src/be/db.ts +18 -5
- package/src/be/migrations/367_workflow_run_principal.sql +5 -0
- package/src/be/model-group-resolution.ts +134 -0
- package/src/be/model-tier-resolution.ts +120 -17
- package/src/be/model-validation.ts +9 -1
- package/src/be/runtime-pools/routing.ts +22 -8
- package/src/be/scripts/extract-schema.ts +7 -0
- package/src/be/swarm-config-guard.ts +20 -7
- package/src/be/task-auto-title-listener.ts +2 -2
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/extensions/contract-types.generated.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 +11 -2
- 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/operator-actor.ts +3 -8
- package/src/http/page-proxy.ts +16 -0
- package/src/http/pages.ts +9 -0
- package/src/http/poll.ts +21 -1
- package/src/http/pricing.ts +2 -0
- package/src/http/prompt-templates.ts +34 -0
- package/src/http/repos.ts +3 -1
- package/src/http/schedules.ts +33 -3
- 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 +28 -1
- 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/prompts/base-prompt.ts +10 -6
- package/src/prompts/session-templates.ts +3 -3
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +11 -9
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/rbac/legacy-policy.ts +2 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/realtime/browser.generated.txt +1 -1
- package/src/scheduler/schedule-task.ts +1 -0
- package/src/scripts-runtime/quickjs-compat.ts +44 -10
- package/src/scripts-runtime/types/swarm-extension.d.ts +2 -0
- package/src/slack/config.ts +4 -0
- package/src/slack/render-v2.ts +52 -24
- package/src/slack/responses.ts +2 -1
- package/src/slack/reviewed-deliverables.ts +251 -0
- package/src/tasks/follow-up-gate.ts +142 -38
- package/src/tasks/worker-follow-up.ts +126 -37
- package/src/tests/amp-adapter.test.ts +57 -9
- package/src/tests/base-prompt.test.ts +36 -2
- 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/db-retention-defaults.test.ts +28 -3
- package/src/tests/e2b-dispatch.test.ts +7 -1
- package/src/tests/entrypoint-repo-autoclone-args.test.ts +10 -0
- package/src/tests/follow-up-gate-shadow.test.ts +268 -10
- package/src/tests/linear-outbound-sync.test.ts +59 -25
- package/src/tests/operator-actor-keyless.test.ts +103 -0
- package/src/tests/otel-event-loop-and-logs.test.ts +1 -1
- package/src/tests/profile-tier-alias.test.ts +9 -3
- package/src/tests/quickjs-compat.test.ts +40 -4
- package/src/tests/rbac-route-verbs-e2e.test.ts +142 -0
- package/src/tests/runner-repo-clone-args.test.ts +15 -6
- 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/workflow-system-one-extraction.test.ts +21 -0
- package/src/tests/workflow-wait-filter.test.ts +7 -7
- package/src/tests/worktree-reaper.test.ts +15 -4
- 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/tools/schedules/create-schedule.ts +20 -3
- package/src/tools/schedules/patch-schedule.ts +30 -4
- package/src/tools/schedules/update-schedule.ts +30 -4
- package/src/tools/send-task.ts +17 -3
- package/src/tools/slack-post.ts +7 -2
- package/src/tools/slack-reply.ts +6 -2
- package/src/tools/task-action.ts +16 -3
- package/src/tools/utils.ts +1 -1
- package/src/types.ts +10 -0
- package/src/utils/amp-models.ts +20 -4
- package/src/utils/constants.ts +5 -4
- package/src/utils/secret-scrubber.ts +6 -4
- package/src/utils/task-citations.ts +11 -0
- package/src/workflows/engine.ts +41 -8
- package/src/workflows/executors/agent-task.ts +13 -2
- package/src/workflows/executors/code-match.ts +11 -31
- package/src/workflows/executors/script.ts +13 -0
- package/src/workflows/executors/sub-workflow.ts +5 -7
- package/src/workflows/executors/swarm-script.ts +4 -5
- package/src/workflows/executors/system-one-extraction.ts +9 -6
- package/src/workflows/executors/wait.ts +1 -1
- package/src/workflows/foreach-driver.ts +5 -1
- package/src/workflows/model-validation.ts +13 -1
- package/src/workflows/predicate-sandbox.ts +171 -0
- package/src/workflows/resume.ts +21 -4
- package/src/workflows/retry-poller.ts +1 -1
- package/src/workflows/run-principal.ts +51 -0
- package/src/workflows/wait-filter.ts +14 -192
- package/src/x402/client.ts +38 -17
- package/templates/skills/code-quality/content.md +1 -1
- package/templates/skills/heartbeat-runbook/content.md +1 -0
- package/templates/skills/pages/content.md +36 -12
- package/templates/skills/slack-interaction/content.md +4 -0
- package/templates/skills/swarm-docs/content.md +47 -41
- package/templates/skills/swarm-scripts/SKILL.md +1 -1
- package/templates/skills/swarm-scripts/content.md +1 -1
- package/dist/acp-adapter-99n6z9ky.js +0 -17
- package/dist/cli-5ss6qqt9.js +0 -45
- package/dist/cli-dzzh58sy.js +0 -6996
- package/dist/cli-e8trbfx1.js +0 -15
- package/dist/cli-j9ccfveb.js +0 -1849
- package/dist/cli-mna6pmfx.js +0 -1485
- package/dist/cli-r8ddn0hf.js +0 -25583
- package/dist/core-dynsv289.js +0 -41
- package/dist/fx-adapter-9k0hptnz.js +0 -20
- package/dist/getMachineId-bsd-637a7rbk.js +0 -36
- package/dist/getMachineId-darwin-9vytrcnn.js +0 -36
- package/dist/getMachineId-linux-mkzsvyyz.js +0 -29
- package/dist/getMachineId-unsupported-4cfs2n11.js +0 -19
- package/dist/getMachineId-win-154s3qma.js +0 -38
- package/dist/grok-adapter-skdj2pce.js +0 -20
- package/dist/handlers-5btjqkz6.js +0 -39
- package/dist/heartbeat-vfb1gy84.js +0 -49
- package/dist/hook-eh52p7yd.js +0 -22
- package/dist/index-7w8p6em0.js +0 -41
- package/dist/index-t56y945n.js +0 -4
- package/dist/index-vfemrwwk.js +0 -10002
- package/dist/index-vz4semsx.js +0 -38
- package/dist/index-y3s0xp2v.js +0 -43
- package/dist/lead-6cscw8a5.js +0 -82
- package/dist/otel-impl-6n6vva3x.js +0 -28205
- package/dist/thread-buffer-9w6x5zec.js +0 -40
- package/dist/worker-g4aj93dt.js +0 -82
|
@@ -9,17 +9,23 @@ import {
|
|
|
9
9
|
import { scrubSecrets } from "../utils/secret-scrubber";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Follow-up gate
|
|
13
|
-
* created, a configured verifier script checks the run after commit and the
|
|
12
|
+
* Follow-up gate. In shadow mode, when a gated scheduled run's Lead follow-up
|
|
13
|
+
* is created, a configured verifier script checks the run after commit and the
|
|
14
14
|
* server records whether the follow-up could have been skipped. Shadow mode
|
|
15
15
|
* never skips or delays a follow-up.
|
|
16
|
+
*
|
|
17
|
+
* Enforce mode keeps shadow for `FOLLOW_UP_GATE_SCHEDULE_IDS`. For a schedule
|
|
18
|
+
* in `FOLLOW_UP_GATE_ENFORCE_SCHEDULE_IDS`, the follow-up waits for the
|
|
19
|
+
* verifier: `would_skip` skips it, any other outcome creates it (fail open).
|
|
16
20
|
*/
|
|
17
21
|
|
|
18
22
|
export const FOLLOW_UP_GATE_SHADOW_EVENT = "task_follow_up_gate_shadow" as const;
|
|
19
23
|
|
|
20
24
|
export type FollowUpGateConfig = {
|
|
21
|
-
mode: "off" | "shadow";
|
|
25
|
+
mode: "off" | "shadow" | "enforce";
|
|
22
26
|
scheduleIds: ReadonlySet<string>;
|
|
27
|
+
/** Empty unless mode is `enforce`. */
|
|
28
|
+
enforceScheduleIds: ReadonlySet<string>;
|
|
23
29
|
verifierScript: string;
|
|
24
30
|
};
|
|
25
31
|
|
|
@@ -28,20 +34,32 @@ export type GateIneligibleReason =
|
|
|
28
34
|
| "not_scheduled"
|
|
29
35
|
| "schedule_not_gated"
|
|
30
36
|
| "status_failed"
|
|
31
|
-
| "follow_up_instructions"
|
|
37
|
+
| "follow_up_instructions"
|
|
38
|
+
| "chain_rejected";
|
|
39
|
+
|
|
40
|
+
function scheduleIdSet(raw: string | undefined): Set<string> {
|
|
41
|
+
return new Set(
|
|
42
|
+
parseFollowUpGateScheduleIds(raw)
|
|
43
|
+
.filter(isFollowUpGateScheduleId)
|
|
44
|
+
.map((id) => id.toLowerCase()),
|
|
45
|
+
);
|
|
46
|
+
}
|
|
32
47
|
|
|
33
48
|
/**
|
|
34
49
|
* Read the gate config on every call so a `swarm_config` reload applies. Any
|
|
35
|
-
* mode other than `shadow` reads as `off`, and malformed ids are
|
|
50
|
+
* mode other than `shadow` or `enforce` reads as `off`, and malformed ids are
|
|
51
|
+
* ignored.
|
|
36
52
|
*/
|
|
37
53
|
export function readFollowUpGateConfig(env: NodeJS.ProcessEnv = process.env): FollowUpGateConfig {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
const raw = env.FOLLOW_UP_GATE_MODE?.trim().toLowerCase();
|
|
55
|
+
const mode = raw === "shadow" || raw === "enforce" ? raw : "off";
|
|
56
|
+
return {
|
|
57
|
+
mode,
|
|
58
|
+
scheduleIds: scheduleIdSet(env.FOLLOW_UP_GATE_SCHEDULE_IDS),
|
|
59
|
+
enforceScheduleIds:
|
|
60
|
+
mode === "enforce" ? scheduleIdSet(env.FOLLOW_UP_GATE_ENFORCE_SCHEDULE_IDS) : new Set(),
|
|
61
|
+
verifierScript: env.FOLLOW_UP_GATE_VERIFIER_SCRIPT?.trim() ?? "",
|
|
62
|
+
};
|
|
45
63
|
}
|
|
46
64
|
|
|
47
65
|
/** Pure decision on whether a follow-up's worker task may be verified. */
|
|
@@ -49,20 +67,33 @@ export function classifyFollowUpGate(input: {
|
|
|
49
67
|
task: Pick<AgentTask, "scheduleId" | "followUpConfig">;
|
|
50
68
|
status: "completed" | "failed";
|
|
51
69
|
config: FollowUpGateConfig;
|
|
70
|
+
/** The completion named a `chainedTaskId` that was rejected. */
|
|
71
|
+
chainRejected?: boolean;
|
|
52
72
|
}): { eligible: true } | { eligible: false; reason: GateIneligibleReason } {
|
|
53
73
|
const { task, status, config } = input;
|
|
54
74
|
if (config.mode === "off") return { eligible: false, reason: "mode_off" };
|
|
55
75
|
if (!task.scheduleId) return { eligible: false, reason: "not_scheduled" };
|
|
56
|
-
|
|
76
|
+
const scheduleId = task.scheduleId.toLowerCase();
|
|
77
|
+
if (!config.scheduleIds.has(scheduleId) && !config.enforceScheduleIds.has(scheduleId)) {
|
|
57
78
|
return { eligible: false, reason: "schedule_not_gated" };
|
|
58
79
|
}
|
|
59
80
|
if (status === "failed") return { eligible: false, reason: "status_failed" };
|
|
60
81
|
if (task.followUpConfig?.onCompleted?.trim() || task.followUpConfig?.onFailed?.trim()) {
|
|
61
82
|
return { eligible: false, reason: "follow_up_instructions" };
|
|
62
83
|
}
|
|
84
|
+
// The rejected-handoff warning lives only in the follow-up, so keep it.
|
|
85
|
+
if (input.chainRejected) return { eligible: false, reason: "chain_rejected" };
|
|
63
86
|
return { eligible: true };
|
|
64
87
|
}
|
|
65
88
|
|
|
89
|
+
/** Whether this run's follow-up waits for the verifier and is skipped on `would_skip`. */
|
|
90
|
+
export function isFollowUpGateEnforced(input: Parameters<typeof classifyFollowUpGate>[0]): boolean {
|
|
91
|
+
return (
|
|
92
|
+
classifyFollowUpGate(input).eligible &&
|
|
93
|
+
input.config.enforceScheduleIds.has(input.task.scheduleId?.toLowerCase() ?? "")
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
66
97
|
type VerifierScript = Pick<ScriptRecord, "name" | "version" | "contentHash">;
|
|
67
98
|
|
|
68
99
|
export type FollowUpGateDeps = {
|
|
@@ -118,7 +149,7 @@ export function setFollowUpGateTimeoutMsForTests(ms: number | null): void {
|
|
|
118
149
|
timeoutMs = ms ?? FOLLOW_UP_GATE_TIMEOUT_MS;
|
|
119
150
|
}
|
|
120
151
|
|
|
121
|
-
/** Wait until every scheduled shadow hook has written its row. */
|
|
152
|
+
/** Wait until every scheduled shadow or enforce hook has written its row. */
|
|
122
153
|
export async function drainFollowUpGateShadowForTest(): Promise<void> {
|
|
123
154
|
// Hooks run in FIFO order behind the client lock, so once this marker runs,
|
|
124
155
|
// every earlier hook has started and registered its promise.
|
|
@@ -126,13 +157,26 @@ export async function drainFollowUpGateShadowForTest(): Promise<void> {
|
|
|
126
157
|
while (pending.size > 0) await Promise.allSettled([...pending]);
|
|
127
158
|
}
|
|
128
159
|
|
|
129
|
-
type
|
|
160
|
+
type GateArgs = {
|
|
130
161
|
task: Pick<AgentTask, "id" | "scheduleId" | "followUpConfig">;
|
|
131
162
|
status: "completed" | "failed";
|
|
132
|
-
followUpTaskId: string;
|
|
133
163
|
leadAgentId: string;
|
|
164
|
+
chainRejected?: boolean;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
type ShadowArgs = GateArgs & { followUpTaskId: string };
|
|
168
|
+
|
|
169
|
+
type EnforceArgs = GateArgs & {
|
|
170
|
+
config: FollowUpGateConfig;
|
|
171
|
+
/** Create the Lead follow-up; called unless the verdict is `would_skip`. */
|
|
172
|
+
createFollowUp: () => Promise<AgentTask | null>;
|
|
134
173
|
};
|
|
135
174
|
|
|
175
|
+
/** Where the follow-up stands when the row is written. */
|
|
176
|
+
type GateOutcome =
|
|
177
|
+
| { mode: "shadow"; followUpTaskId: string }
|
|
178
|
+
| { mode: "enforce"; followUpTaskId: string | null; skipped: boolean };
|
|
179
|
+
|
|
136
180
|
type ShadowRecord = {
|
|
137
181
|
decision: "would_skip" | "would_keep" | "error" | "ineligible";
|
|
138
182
|
reason: string | null;
|
|
@@ -150,7 +194,12 @@ type ShadowRecord = {
|
|
|
150
194
|
*/
|
|
151
195
|
export function scheduleFollowUpGateShadow(args: ShadowArgs): void {
|
|
152
196
|
const config = readFollowUpGateConfig();
|
|
153
|
-
const verdict = classifyFollowUpGate({
|
|
197
|
+
const verdict = classifyFollowUpGate({
|
|
198
|
+
task: args.task,
|
|
199
|
+
status: args.status,
|
|
200
|
+
config,
|
|
201
|
+
chainRejected: args.chainRejected,
|
|
202
|
+
});
|
|
154
203
|
if (
|
|
155
204
|
!verdict.eligible &&
|
|
156
205
|
(verdict.reason === "mode_off" ||
|
|
@@ -160,37 +209,87 @@ export function scheduleFollowUpGateShadow(args: ShadowArgs): void {
|
|
|
160
209
|
return;
|
|
161
210
|
}
|
|
162
211
|
const deps = depsForTests ?? defaultDeps;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
212
|
+
// An enforced schedule reaches here only when ineligible: its follow-up was created up front.
|
|
213
|
+
const outcome: GateOutcome = config.enforceScheduleIds.has(
|
|
214
|
+
args.task.scheduleId?.toLowerCase() ?? "",
|
|
215
|
+
)
|
|
216
|
+
? { mode: "enforce", followUpTaskId: args.followUpTaskId, skipped: false }
|
|
217
|
+
: { mode: "shadow", followUpTaskId: args.followUpTaskId };
|
|
218
|
+
getDbClient().afterCommit(() =>
|
|
219
|
+
track(
|
|
220
|
+
verdict.eligible
|
|
221
|
+
? verifyCapped(args, config, deps).then((record) => writeRecord(args, record, outcome))
|
|
222
|
+
: writeRecord(args, { decision: "ineligible", reason: verdict.reason }, outcome),
|
|
223
|
+
),
|
|
224
|
+
);
|
|
173
225
|
}
|
|
174
226
|
|
|
175
|
-
|
|
176
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Enforce the gate for a run that `isFollowUpGateEnforced` accepted. Returns
|
|
229
|
+
* synchronously; after commit the verifier runs, and the follow-up is created
|
|
230
|
+
* unless the verdict is `would_skip`. Errors, timeouts, the concurrency cap and
|
|
231
|
+
* a missing verifier all create it.
|
|
232
|
+
*
|
|
233
|
+
* shortcut: a server restart while the verifier runs (up to 60s) drops the
|
|
234
|
+
* follow-up; add a boot sweep for unrecorded enforced runs if that shows up.
|
|
235
|
+
*/
|
|
236
|
+
export function scheduleFollowUpGateEnforce(args: EnforceArgs): void {
|
|
237
|
+
const deps = depsForTests ?? defaultDeps;
|
|
238
|
+
getDbClient().afterCommit(() => track(runEnforce(args, deps)));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
async function runEnforce(args: EnforceArgs, deps: FollowUpGateDeps): Promise<void> {
|
|
242
|
+
const record = await verifyCapped(args, args.config, deps);
|
|
243
|
+
if (record.decision === "would_skip") {
|
|
244
|
+
await writeRecord(args, record, { mode: "enforce", followUpTaskId: null, skipped: true });
|
|
245
|
+
try {
|
|
246
|
+
await createLogEntry({
|
|
247
|
+
eventType: "task_follow_up_suppressed",
|
|
248
|
+
taskId: args.task.id,
|
|
249
|
+
agentId: args.leadAgentId,
|
|
250
|
+
metadata: { reason: "follow_up_gate", status: args.status },
|
|
251
|
+
});
|
|
252
|
+
} catch {}
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
let followUpTaskId: string | null = null;
|
|
256
|
+
try {
|
|
257
|
+
followUpTaskId = (await args.createFollowUp())?.id ?? null;
|
|
258
|
+
} catch (err) {
|
|
259
|
+
console.warn(
|
|
260
|
+
`[follow-up-gate] Could not create follow-up for task ${args.task.id.slice(0, 8)}:`,
|
|
261
|
+
scrubSecrets(err instanceof Error ? err.message : String(err)),
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
await writeRecord(args, record, { mode: "enforce", followUpTaskId, skipped: false });
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function track(run: Promise<void>): void {
|
|
268
|
+
pending.add(run);
|
|
269
|
+
const settle = () => {
|
|
270
|
+
pending.delete(run);
|
|
271
|
+
};
|
|
272
|
+
void run.then(settle, settle);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
async function verifyCapped(
|
|
276
|
+
args: GateArgs,
|
|
177
277
|
config: FollowUpGateConfig,
|
|
178
278
|
deps: FollowUpGateDeps,
|
|
179
|
-
): Promise<
|
|
279
|
+
): Promise<ShadowRecord> {
|
|
180
280
|
if (inFlight >= FOLLOW_UP_GATE_MAX_IN_FLIGHT) {
|
|
181
|
-
|
|
182
|
-
return;
|
|
281
|
+
return { decision: "error", reason: "concurrency_cap" };
|
|
183
282
|
}
|
|
184
283
|
inFlight++;
|
|
185
284
|
try {
|
|
186
|
-
|
|
285
|
+
return await verify(args, config, deps);
|
|
187
286
|
} finally {
|
|
188
287
|
inFlight--;
|
|
189
288
|
}
|
|
190
289
|
}
|
|
191
290
|
|
|
192
291
|
async function verify(
|
|
193
|
-
args:
|
|
292
|
+
args: GateArgs,
|
|
194
293
|
config: FollowUpGateConfig,
|
|
195
294
|
deps: FollowUpGateDeps,
|
|
196
295
|
): Promise<ShadowRecord> {
|
|
@@ -288,7 +387,11 @@ function clip(text: string): string {
|
|
|
288
387
|
return scrubSecrets(text).slice(0, TEXT_LIMIT);
|
|
289
388
|
}
|
|
290
389
|
|
|
291
|
-
async function writeRecord(
|
|
390
|
+
async function writeRecord(
|
|
391
|
+
args: GateArgs,
|
|
392
|
+
record: ShadowRecord,
|
|
393
|
+
outcome: GateOutcome,
|
|
394
|
+
): Promise<void> {
|
|
292
395
|
try {
|
|
293
396
|
await createLogEntry({
|
|
294
397
|
eventType: FOLLOW_UP_GATE_SHADOW_EVENT,
|
|
@@ -296,8 +399,9 @@ async function writeRecord(args: ShadowArgs, record: ShadowRecord): Promise<void
|
|
|
296
399
|
agentId: args.leadAgentId,
|
|
297
400
|
metadata: {
|
|
298
401
|
v: 1,
|
|
299
|
-
mode:
|
|
300
|
-
followUpTaskId:
|
|
402
|
+
mode: outcome.mode,
|
|
403
|
+
followUpTaskId: outcome.followUpTaskId,
|
|
404
|
+
...(outcome.mode === "enforce" ? { skipped: outcome.skipped } : {}),
|
|
301
405
|
scheduleId: args.task.scheduleId ?? null,
|
|
302
406
|
status: args.status,
|
|
303
407
|
decision: record.decision,
|
|
@@ -311,7 +415,7 @@ async function writeRecord(args: ShadowArgs, record: ShadowRecord): Promise<void
|
|
|
311
415
|
});
|
|
312
416
|
} catch (err) {
|
|
313
417
|
console.warn(
|
|
314
|
-
`[follow-up-gate] Could not record
|
|
418
|
+
`[follow-up-gate] Could not record ${outcome.mode} decision for task ${args.task.id.slice(0, 8)}:`,
|
|
315
419
|
scrubSecrets(err instanceof Error ? err.message : String(err)),
|
|
316
420
|
);
|
|
317
421
|
}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from "../be/db";
|
|
17
17
|
import { getModelProfileByName, hasUnreadableCredentialAllowlist } from "../be/db/model-profiles";
|
|
18
18
|
import { repointTrackerSyncBySwarmId } from "../be/db-queries/tracker";
|
|
19
|
+
import { firstFailingCheck, resolveGroupForAgent } from "../be/model-group-resolution";
|
|
19
20
|
import { checkProfileForAgent, configPools } from "../be/model-profile-check";
|
|
20
21
|
import { isAgentReachable } from "../be/runtime-pools/reachability";
|
|
21
22
|
import { carryUnhandledSteering } from "../be/steering";
|
|
@@ -32,6 +33,7 @@ import {
|
|
|
32
33
|
CreateTaskOptionsSchema,
|
|
33
34
|
type FallbackHop,
|
|
34
35
|
type ProviderErrorClass,
|
|
36
|
+
parseModelTier,
|
|
35
37
|
type ResumeReason,
|
|
36
38
|
type RoutingAffinity,
|
|
37
39
|
type TaskAttachment,
|
|
@@ -41,7 +43,12 @@ import { isEnvFlagEnabled } from "../utils/env-flag";
|
|
|
41
43
|
import { modelFamilyOf, windowForModelFamily } from "../utils/model-rate-limit-windows";
|
|
42
44
|
import { taskAttachmentDisplayUrl } from "../utils/task-attachment-links";
|
|
43
45
|
import { chatThreadOfContextKey } from "./context-key";
|
|
44
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
isFollowUpGateEnforced,
|
|
48
|
+
readFollowUpGateConfig,
|
|
49
|
+
scheduleFollowUpGateEnforce,
|
|
50
|
+
scheduleFollowUpGateShadow,
|
|
51
|
+
} from "./follow-up-gate";
|
|
45
52
|
import { taskModelPin } from "./model-pin";
|
|
46
53
|
import { createTaskWithSiblingAwareness } from "./sibling-awareness";
|
|
47
54
|
// Side-effect import: registers task lifecycle templates in the in-memory registry.
|
|
@@ -196,15 +203,17 @@ export function inheritedModelSelection(
|
|
|
196
203
|
| "resolvedModel"
|
|
197
204
|
| "claudeSessionId"
|
|
198
205
|
| "profile"
|
|
206
|
+
| "modelGroup"
|
|
199
207
|
>,
|
|
200
|
-
): Pick<CreateTaskOptions, "model" | "modelTier" | "profile"> {
|
|
208
|
+
): Pick<CreateTaskOptions, "model" | "modelTier" | "profile" | "modelGroup"> {
|
|
201
209
|
const model = taskModelPin(parent);
|
|
202
|
-
// The task's own profile
|
|
203
|
-
// (`resolvedProfile` only) is re-resolved by the child's claim.
|
|
210
|
+
// The task's own profile and group travel like its tier; an agent-default
|
|
211
|
+
// profile (`resolvedProfile` only) is re-resolved by the child's claim.
|
|
204
212
|
return {
|
|
205
213
|
...(model ? { model } : {}),
|
|
206
214
|
...(parent.modelTier ? { modelTier: parent.modelTier } : {}),
|
|
207
215
|
...(parent.profile ? { profile: parent.profile } : {}),
|
|
216
|
+
...(parent.modelGroup ? { modelGroup: parent.modelGroup } : {}),
|
|
208
217
|
};
|
|
209
218
|
}
|
|
210
219
|
|
|
@@ -228,6 +237,9 @@ type FallbackParent = Pick<
|
|
|
228
237
|
| "agentId"
|
|
229
238
|
| "resolvedProfile"
|
|
230
239
|
| "resolvedModel"
|
|
240
|
+
| "modelGroup"
|
|
241
|
+
| "modelSource"
|
|
242
|
+
| "modelTier"
|
|
231
243
|
| "fallbackHops"
|
|
232
244
|
| "vcsRepo"
|
|
233
245
|
| "routingAffinity"
|
|
@@ -236,6 +248,21 @@ type FallbackParent = Pick<
|
|
|
236
248
|
| "credentialKeySuffix"
|
|
237
249
|
>;
|
|
238
250
|
|
|
251
|
+
/**
|
|
252
|
+
* The group whose order a provider-error hop walks: the task's own
|
|
253
|
+
* `modelGroup` (a group task, or the resume of a group hop), else the group
|
|
254
|
+
* named after the tier when claim resolved the tier through it
|
|
255
|
+
* (`modelSource = profile:group`). A worker-env, tier-config or seeded
|
|
256
|
+
* tier-alias claim records another source, so it never hops through a group.
|
|
257
|
+
*/
|
|
258
|
+
export function fallbackGroupOf(
|
|
259
|
+
task: Pick<AgentTask, "modelGroup" | "modelSource" | "modelTier">,
|
|
260
|
+
): string | undefined {
|
|
261
|
+
if (task.modelGroup) return task.modelGroup;
|
|
262
|
+
if (task.modelSource !== "profile:group") return undefined;
|
|
263
|
+
return parseModelTier(task.modelTier) ?? undefined;
|
|
264
|
+
}
|
|
265
|
+
|
|
239
266
|
/**
|
|
240
267
|
* The key pool the failed run drew from, as the worker's next claim will see
|
|
241
268
|
* it: `size` keys the profile may use, `free` of them not benched and not the
|
|
@@ -303,6 +330,12 @@ async function keyPoolOf(
|
|
|
303
330
|
* profile to the visited set and the saved fallback graph is acyclic, so the
|
|
304
331
|
* walk ends once every reachable profile has run.
|
|
305
332
|
*
|
|
333
|
+
* On a model group task (or a tier task its group resolved,
|
|
334
|
+
* `fallbackGroupOf`) the group order is the chain instead: the members
|
|
335
|
+
* after the current one that run on this agent's harness, minus the profiles
|
|
336
|
+
* the work already ran on. Member fallbacks are ignored, so the one order the
|
|
337
|
+
* group shows decides every hop.
|
|
338
|
+
*
|
|
306
339
|
* The pick is judged against this agent only, so the resume is always pinned
|
|
307
340
|
* to it (`createResumeFollowUp`). Lead-only work on an agent that cannot hold
|
|
308
341
|
* a lead-only pin would be rerouted to another agent, so it never hops.
|
|
@@ -327,10 +360,14 @@ export async function nextFallback(
|
|
|
327
360
|
const judged = new Set<string>();
|
|
328
361
|
let configured = profileHops.length > 0;
|
|
329
362
|
|
|
363
|
+
const group = fallbackGroupOf(parent);
|
|
364
|
+
|
|
330
365
|
if (parent.routingAffinity?.leadOnly) {
|
|
331
366
|
const agent = await getAgentById(parent.agentId);
|
|
332
367
|
if (!agent?.isLead || !isAgentEligibleForTask(agent, parent)) {
|
|
333
|
-
const listsFallbacks =
|
|
368
|
+
const listsFallbacks = group
|
|
369
|
+
? 1
|
|
370
|
+
: ((await getModelProfileByName(current))?.fallbacks.length ?? 0);
|
|
334
371
|
if (!configured && listsFallbacks === 0) return { kind: "none", message: null };
|
|
335
372
|
return {
|
|
336
373
|
kind: "none",
|
|
@@ -359,7 +396,33 @@ export async function nextFallback(
|
|
|
359
396
|
}
|
|
360
397
|
}
|
|
361
398
|
|
|
362
|
-
|
|
399
|
+
if (group) {
|
|
400
|
+
const resolution = await resolveGroupForAgent(group, parent.agentId, {
|
|
401
|
+
vcsRepo: parent.vcsRepo,
|
|
402
|
+
includeRepoSecrets: options.includeRepoSecrets,
|
|
403
|
+
skip: visited,
|
|
404
|
+
startAfter: current,
|
|
405
|
+
sameHarnessOnly: true,
|
|
406
|
+
});
|
|
407
|
+
if (resolution.kind === "resolved") {
|
|
408
|
+
return {
|
|
409
|
+
kind: "picked",
|
|
410
|
+
profile: resolution.member,
|
|
411
|
+
hop: {
|
|
412
|
+
from: current,
|
|
413
|
+
profile: resolution.member,
|
|
414
|
+
errorClass,
|
|
415
|
+
at: new Date().toISOString(),
|
|
416
|
+
...(resolution.skipped.length > 0 ? { skipped: resolution.skipped } : {}),
|
|
417
|
+
},
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
if (resolution.kind === "none" && resolution.skipped.length > 0) {
|
|
421
|
+
configured = true;
|
|
422
|
+
skipped.push(...resolution.skipped);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
for (let i = path.length - 1; !group && i >= 0; i--) {
|
|
363
426
|
const profile = await getModelProfileByName(path[i]!);
|
|
364
427
|
for (const name of profile?.fallbacks ?? []) {
|
|
365
428
|
configured = true;
|
|
@@ -383,7 +446,7 @@ export async function nextFallback(
|
|
|
383
446
|
},
|
|
384
447
|
};
|
|
385
448
|
}
|
|
386
|
-
skipped.push({ profile: name, reason: result ?
|
|
449
|
+
skipped.push({ profile: name, reason: result ? firstFailingCheck(result) : "not found" });
|
|
387
450
|
}
|
|
388
451
|
}
|
|
389
452
|
if (!configured) {
|
|
@@ -404,13 +467,6 @@ export async function nextFallback(
|
|
|
404
467
|
};
|
|
405
468
|
}
|
|
406
469
|
|
|
407
|
-
/** "check: detail" of the primary's first failing row. */
|
|
408
|
-
function firstFailingRow(result: NonNullable<Awaited<ReturnType<typeof checkProfileForAgent>>>) {
|
|
409
|
-
const row = result.profiles[0]?.checks.find((check) => check.state === "fail");
|
|
410
|
-
if (!row) return "failed the profile check";
|
|
411
|
-
return row.detail ? `${row.check}: ${row.detail}` : row.check;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
470
|
function attachmentPointer(a: TaskAttachment): string {
|
|
415
471
|
return taskAttachmentDisplayUrl(a);
|
|
416
472
|
}
|
|
@@ -476,6 +532,10 @@ async function findDeferredWakeFor(taskId: string, agentId: string): Promise<Def
|
|
|
476
532
|
*
|
|
477
533
|
* With `FOLLOW_UP_GATE_MODE=shadow`, a gated scheduled run also records a
|
|
478
534
|
* verifier's would-skip decision after commit; the follow-up is never skipped.
|
|
535
|
+
* With `enforce`, a completed run of a schedule in
|
|
536
|
+
* `FOLLOW_UP_GATE_ENFORCE_SCHEDULE_IDS` returns null here: its follow-up is
|
|
537
|
+
* created after commit unless the verifier says `would_skip`. Follow-up
|
|
538
|
+
* instructions or a rejected `chainedTaskId` keep the follow-up up front.
|
|
479
539
|
*/
|
|
480
540
|
export async function createWorkerTaskFollowUp(args: {
|
|
481
541
|
task: AgentTask;
|
|
@@ -655,27 +715,50 @@ export async function createWorkerTaskFollowUp(args: {
|
|
|
655
715
|
);
|
|
656
716
|
return null;
|
|
657
717
|
}
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
718
|
+
const createFollowUp = async () =>
|
|
719
|
+
createTaskWithSiblingAwareness(
|
|
720
|
+
changes.description ?? followUpDescription,
|
|
721
|
+
{
|
|
722
|
+
agentId: followUpAgentId,
|
|
723
|
+
routingReason: followUpAgentId ? "skill" : undefined,
|
|
724
|
+
routingSource: followUpAgentId ? "engine_default" : undefined,
|
|
725
|
+
source: "system",
|
|
726
|
+
taskType: "follow-up",
|
|
727
|
+
priority: changes.priority,
|
|
728
|
+
parentTaskId: task.id,
|
|
729
|
+
contextKey: await deferredWorkChatContextKey(task),
|
|
730
|
+
slackChannelId: task.slackChannelId,
|
|
731
|
+
slackThreadTs: task.slackThreadTs,
|
|
732
|
+
slackUserId: task.slackUserId,
|
|
733
|
+
followUpConfig: changes.followUpConfig,
|
|
734
|
+
// The Lead reviews the worker's result here; it is not producing the
|
|
735
|
+
// worker's structured output, so it must not inherit that contract.
|
|
736
|
+
inheritParentOutputSchema: false,
|
|
737
|
+
},
|
|
738
|
+
{ origin: "followUp" },
|
|
739
|
+
);
|
|
740
|
+
const gateConfig = readFollowUpGateConfig();
|
|
741
|
+
const chainRejected = chainRejection !== null;
|
|
742
|
+
if (isFollowUpGateEnforced({ task, status, config: gateConfig, chainRejected })) {
|
|
743
|
+
try {
|
|
744
|
+
// The verifier reads the committed run, so the follow-up waits for it after commit.
|
|
745
|
+
scheduleFollowUpGateEnforce({
|
|
746
|
+
task,
|
|
747
|
+
status,
|
|
748
|
+
leadAgentId: leadAgent.id,
|
|
749
|
+
config: gateConfig,
|
|
750
|
+
createFollowUp,
|
|
751
|
+
});
|
|
752
|
+
return null;
|
|
753
|
+
} catch (err) {
|
|
754
|
+
// Fail open: create the follow-up now.
|
|
755
|
+
console.warn(
|
|
756
|
+
`[worker-follow-up] Follow-up gate enforce failed for task ${task.id.slice(0, 8)}:`,
|
|
757
|
+
err instanceof Error ? err.message : String(err),
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
const followUp = await createFollowUp();
|
|
679
762
|
if (followUp) {
|
|
680
763
|
try {
|
|
681
764
|
scheduleFollowUpGateShadow({
|
|
@@ -683,6 +766,7 @@ export async function createWorkerTaskFollowUp(args: {
|
|
|
683
766
|
status,
|
|
684
767
|
followUpTaskId: followUp.id,
|
|
685
768
|
leadAgentId: leadAgent.id,
|
|
769
|
+
chainRejected,
|
|
686
770
|
});
|
|
687
771
|
} catch (err) {
|
|
688
772
|
console.warn(
|
|
@@ -1028,9 +1112,14 @@ export async function createResumeFollowUp(args: {
|
|
|
1028
1112
|
function resumeModelSelection(
|
|
1029
1113
|
parent: AgentTask,
|
|
1030
1114
|
fallback: { profile: string; hop: FallbackHop } | undefined,
|
|
1031
|
-
): Pick<CreateTaskOptions, "model" | "modelTier" | "profile" | "fallbackHops"> {
|
|
1115
|
+
): Pick<CreateTaskOptions, "model" | "modelTier" | "profile" | "modelGroup" | "fallbackHops"> {
|
|
1032
1116
|
const hops = [...(parent.fallbackHops ?? []), ...(fallback ? [fallback.hop] : [])];
|
|
1033
|
-
|
|
1117
|
+
// A group task, or a tier task its group resolved, keeps the group, so its
|
|
1118
|
+
// next hop or key retry walks the same order.
|
|
1119
|
+
const group = fallback ? fallbackGroupOf(parent) : undefined;
|
|
1120
|
+
const selection = fallback
|
|
1121
|
+
? { profile: fallback.profile, ...(group ? { modelGroup: group } : {}) }
|
|
1122
|
+
: inheritedModelSelection(parent);
|
|
1034
1123
|
return { ...selection, ...(hops.length > 0 ? { fallbackHops: hops } : {}) };
|
|
1035
1124
|
}
|
|
1036
1125
|
|
|
@@ -232,19 +232,69 @@ describe("amp registration and model selection", () => {
|
|
|
232
232
|
});
|
|
233
233
|
|
|
234
234
|
describe("amp plugin", () => {
|
|
235
|
-
test("the plugin carries the prompt as data, so no prompt text can become code", () => {
|
|
235
|
+
test("the plugin carries the prompt as data, so no prompt text can become code", async () => {
|
|
236
236
|
// biome-ignore lint/suspicious/noTemplateCurlyInString: a literal placeholder must stay text
|
|
237
237
|
const hostile = 'a"; process.exit(1); //\n`${x}` */ \u2028 \\';
|
|
238
238
|
const source = buildAmpPlugin({ baseMode: "low", instructions: hostile });
|
|
239
239
|
expect(source.startsWith("// @amp-agent-mode key=agent-swarm label=Agent Swarm\n")).toBe(true);
|
|
240
240
|
expect(pluginConfig(source)).toEqual({
|
|
241
|
-
baseMode: "low",
|
|
242
241
|
instructions: hostile,
|
|
243
|
-
model:
|
|
244
|
-
reasoningEffort:
|
|
242
|
+
model: "zhipuai/glm-5.3-flash",
|
|
243
|
+
reasoningEffort: "low",
|
|
245
244
|
steeringInbox: null,
|
|
246
245
|
});
|
|
247
246
|
expect(source.split("\n").filter((line) => line.includes("process.exit"))).toHaveLength(1);
|
|
247
|
+
|
|
248
|
+
// The mode loads as a custom agent on a concrete model. Amp rejects `extends`
|
|
249
|
+
// and built-in agents in a plugin mode; the CLI then sends the bare mode key
|
|
250
|
+
// and thread creation fails with HTTP 400 on agentMode.
|
|
251
|
+
const dir = await mkdtemp(join(tmpdir(), "amp-plugin-"));
|
|
252
|
+
try {
|
|
253
|
+
const registered: unknown[] = [];
|
|
254
|
+
const amp = {
|
|
255
|
+
on() {},
|
|
256
|
+
createAgent(config: Record<string, unknown>) {
|
|
257
|
+
if ("extends" in config || typeof config.model !== "string") {
|
|
258
|
+
throw new Error("createAgent no longer supports extends");
|
|
259
|
+
}
|
|
260
|
+
return { definition: { kind: "agent-definition", ...config } };
|
|
261
|
+
},
|
|
262
|
+
registerAgentMode(mode: unknown) {
|
|
263
|
+
registered.push(mode);
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
for (const [name, options] of [
|
|
267
|
+
["mode", { baseMode: "medium", instructions: "be brief" }],
|
|
268
|
+
["pin", { baseMode: "medium", instructions: "", pin: "openai/gpt-5-nano" }],
|
|
269
|
+
] as const) {
|
|
270
|
+
const path = join(dir, `${name}.ts`);
|
|
271
|
+
await Bun.write(path, buildAmpPlugin(options));
|
|
272
|
+
(await import(path)).default(amp);
|
|
273
|
+
}
|
|
274
|
+
expect(registered).toEqual([
|
|
275
|
+
{
|
|
276
|
+
key: "agent-swarm",
|
|
277
|
+
label: "Agent Swarm",
|
|
278
|
+
agent: {
|
|
279
|
+
kind: "agent-definition",
|
|
280
|
+
model: "anthropic/claude-opus-5-5",
|
|
281
|
+
instructions: "be brief",
|
|
282
|
+
display: { label: "Agent Swarm" },
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
key: "agent-swarm",
|
|
287
|
+
label: "Agent Swarm",
|
|
288
|
+
agent: {
|
|
289
|
+
kind: "agent-definition",
|
|
290
|
+
model: "openai/gpt-5-nano",
|
|
291
|
+
display: { label: "Agent Swarm" },
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
]);
|
|
295
|
+
} finally {
|
|
296
|
+
await rm(dir, { recursive: true, force: true });
|
|
297
|
+
}
|
|
248
298
|
});
|
|
249
299
|
});
|
|
250
300
|
|
|
@@ -385,13 +435,12 @@ describe("amp session", () => {
|
|
|
385
435
|
},
|
|
386
436
|
},
|
|
387
437
|
});
|
|
388
|
-
// The system prompt rides on the plugin mode; a mode (low)
|
|
438
|
+
// The system prompt rides on the plugin mode; a mode (low) runs its model.
|
|
389
439
|
expect(run.plugin).toContain("// @amp-agent-mode key=agent-swarm label=Agent Swarm");
|
|
390
440
|
expect(pluginConfig(run.plugin)).toEqual({
|
|
391
|
-
baseMode: "low",
|
|
392
441
|
instructions: config.systemPrompt,
|
|
393
|
-
model:
|
|
394
|
-
reasoningEffort:
|
|
442
|
+
model: "zhipuai/glm-5.3-flash",
|
|
443
|
+
reasoningEffort: "low",
|
|
395
444
|
// Steering queues inside the per-task tree, next to the config.
|
|
396
445
|
steeringInbox: join(dirname(run.env.XDG_CONFIG_HOME), "steering"),
|
|
397
446
|
});
|
|
@@ -414,7 +463,6 @@ describe("amp session", () => {
|
|
|
414
463
|
expect(result.appliedReasoningEffort).toBe("high");
|
|
415
464
|
const run = await invocation(dir);
|
|
416
465
|
expect(pluginConfig(run.plugin)).toMatchObject({
|
|
417
|
-
baseMode: "medium",
|
|
418
466
|
model: "openai/gpt-5-nano",
|
|
419
467
|
reasoningEffort: "high",
|
|
420
468
|
});
|