@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
package/src/workflows/engine.ts
CHANGED
|
@@ -59,6 +59,7 @@ import { validateJsonSchema } from "./json-schema-validator";
|
|
|
59
59
|
import { getMaxWorkflowStepsPerRun } from "./limits";
|
|
60
60
|
import { runWithNodeDeadline } from "./node-timeout";
|
|
61
61
|
import { findWorkflowReadinessProblems, formatReadinessRunError } from "./readiness";
|
|
62
|
+
import { decideWorkflowRunPrincipal } from "./run-principal";
|
|
62
63
|
import {
|
|
63
64
|
hasOwedSuccessors,
|
|
64
65
|
holdSuccessorRouting,
|
|
@@ -367,6 +368,9 @@ async function createRunWithInitialState(
|
|
|
367
368
|
? { status: "skipped", error: "cooldown", finishedAt: new Date().toISOString() }
|
|
368
369
|
: initial;
|
|
369
370
|
const definitionHash = await pinWorkflowDefinition(pinSource);
|
|
371
|
+
// Decided from the same read as the pin, so a re-save while the run is in
|
|
372
|
+
// flight cannot lend the creator's identity to a definition another agent wrote.
|
|
373
|
+
const principal = await decideWorkflowRunPrincipal(pinSource, options.triggeredByAgentId);
|
|
370
374
|
await createWorkflowRun({
|
|
371
375
|
id: runId,
|
|
372
376
|
workflowId: workflow.id,
|
|
@@ -377,6 +381,7 @@ async function createRunWithInitialState(
|
|
|
377
381
|
parentStepAttempt: parentStepId ? attempt : undefined,
|
|
378
382
|
triggeredByAgentId: options.triggeredByAgentId,
|
|
379
383
|
definitionHash,
|
|
384
|
+
principal: JSON.stringify(principal),
|
|
380
385
|
});
|
|
381
386
|
await updateWorkflowRun(
|
|
382
387
|
runId,
|
|
@@ -1089,7 +1094,7 @@ async function runClaimedStep(
|
|
|
1089
1094
|
const executionCtx: Record<string, unknown> = { ...ctx, ...interpolationCtx };
|
|
1090
1095
|
|
|
1091
1096
|
if (scriptBodyUnresolved && scriptBodyUnresolved.length > 0) {
|
|
1092
|
-
const errorMsg = scriptBodyInterpolationError(node.id, scriptBodyUnresolved);
|
|
1097
|
+
const errorMsg = scriptBodyInterpolationError(node.id, scriptBodyUnresolved, node.type);
|
|
1093
1098
|
await checkpointStepFailure(runId, stepId, errorMsg, 0, undefined, { fence });
|
|
1094
1099
|
return { outcome: "failed", successors: [] };
|
|
1095
1100
|
}
|
|
@@ -1386,6 +1391,17 @@ export function buildNodeInterpolationCtx(
|
|
|
1386
1391
|
*/
|
|
1387
1392
|
const SCRIPT_BODY_ALLOWED_SOURCES = new Set(["input", "workflow", "swarm", "run"]);
|
|
1388
1393
|
|
|
1394
|
+
/**
|
|
1395
|
+
* Config field, per node type, whose string value is executable source and so
|
|
1396
|
+
* interpolates only from SCRIPT_BODY_ALLOWED_SOURCES. A wait filter is source
|
|
1397
|
+
* only in its string form; the object form is matched as data.
|
|
1398
|
+
*/
|
|
1399
|
+
const EXECUTABLE_SOURCE_FIELDS = new Map<string, string>([
|
|
1400
|
+
["script", "script"],
|
|
1401
|
+
["code-match", "code"],
|
|
1402
|
+
["wait", "filter"],
|
|
1403
|
+
]);
|
|
1404
|
+
|
|
1389
1405
|
/**
|
|
1390
1406
|
* Project `interpolationCtx` down to the sources a script body is allowed to
|
|
1391
1407
|
* read. Aliases are classified by the ROOT of their declared source path, not
|
|
@@ -1484,14 +1500,17 @@ export function interpolateNodeConfig(
|
|
|
1484
1500
|
};
|
|
1485
1501
|
}
|
|
1486
1502
|
|
|
1487
|
-
|
|
1488
|
-
|
|
1503
|
+
const sourceField = EXECUTABLE_SOURCE_FIELDS.get(node.type);
|
|
1504
|
+
if (sourceField !== undefined && typeof node.config[sourceField] === "string") {
|
|
1505
|
+
const { [sourceField]: script, ...configWithoutScript } = node.config;
|
|
1489
1506
|
const restResult = deepInterpolate(configWithoutScript, interpolationCtx);
|
|
1490
1507
|
|
|
1491
1508
|
// The interpolated script body is handed straight to `bash -c` / `bun -e` /
|
|
1492
|
-
// `python3 -c` (ScriptExecutor.runScript),
|
|
1493
|
-
//
|
|
1494
|
-
//
|
|
1509
|
+
// `python3 -c` (ScriptExecutor.runScript), and code-match code and string
|
|
1510
|
+
// wait filters run as JavaScript in the QuickJS predicate sandbox, so
|
|
1511
|
+
// string-substituting untrusted text into them is a direct code injection
|
|
1512
|
+
// vector. Restrict the source to an ALLOWLIST of operator/system-authored
|
|
1513
|
+
// sources rather than blocking
|
|
1495
1514
|
// `trigger` alone: excluding only the literal `trigger` key would still let
|
|
1496
1515
|
// a declared alias (`inputs: { payload: "trigger.payload" }` used as
|
|
1497
1516
|
// `{{payload}}`) carry webhook data into the body, and upstream node outputs
|
|
@@ -1507,7 +1526,7 @@ export function interpolateNodeConfig(
|
|
|
1507
1526
|
return {
|
|
1508
1527
|
value: {
|
|
1509
1528
|
...(restResult.value as Record<string, unknown>),
|
|
1510
|
-
|
|
1529
|
+
[sourceField]: scriptResult.unresolved.length > 0 ? script : scriptResult.value,
|
|
1511
1530
|
},
|
|
1512
1531
|
unresolved: [...restResult.unresolved, ...scriptResult.unresolved],
|
|
1513
1532
|
scriptBodyUnresolved: scriptResult.unresolved,
|
|
@@ -1531,8 +1550,22 @@ export function interpolateNodeConfig(
|
|
|
1531
1550
|
};
|
|
1532
1551
|
}
|
|
1533
1552
|
|
|
1534
|
-
export function scriptBodyInterpolationError(
|
|
1553
|
+
export function scriptBodyInterpolationError(
|
|
1554
|
+
nodeId: string,
|
|
1555
|
+
tokens: string[],
|
|
1556
|
+
nodeType = "script",
|
|
1557
|
+
): string {
|
|
1535
1558
|
const renderedTokens = [...new Set(tokens)].map((token) => `{{${token}}}`).join(", ");
|
|
1559
|
+
const field = EXECUTABLE_SOURCE_FIELDS.get(nodeType);
|
|
1560
|
+
if (nodeType !== "script" && field !== undefined) {
|
|
1561
|
+
return (
|
|
1562
|
+
`Executable source interpolation failed for node "${nodeId}" (config.${field}): unresolved or disallowed token(s): ${renderedTokens}. ` +
|
|
1563
|
+
"Executable source may interpolate only input, workflow, swarm, or run values. " +
|
|
1564
|
+
(nodeType === "wait"
|
|
1565
|
+
? "Match trigger or upstream values with the object form of config.filter, whose values interpolate as data."
|
|
1566
|
+
: "Read trigger, alias, item, or upstream values at runtime from the function's input argument.")
|
|
1567
|
+
);
|
|
1568
|
+
}
|
|
1536
1569
|
return (
|
|
1537
1570
|
`Script body interpolation failed for node "${nodeId}": unresolved or disallowed token(s): ${renderedTokens}. ` +
|
|
1538
1571
|
"Executable source may interpolate only input, workflow, swarm, or run values. " +
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
modelGroupRefError,
|
|
4
|
+
modelProfileRefError,
|
|
5
|
+
taskProfileError,
|
|
6
|
+
} from "../../be/db/model-profiles";
|
|
3
7
|
import { explicitModelErrorForAgent } from "../../be/model-validation";
|
|
4
8
|
import { applyPreTaskCreate } from "../../extensions/apply-task-create";
|
|
5
9
|
import { workflowContextKey } from "../../tasks/context-key";
|
|
@@ -37,6 +41,8 @@ export const AgentTaskConfigSchema = z.object({
|
|
|
37
41
|
effort: ReasoningEffortSchema.optional(),
|
|
38
42
|
/** Model profile name (see list-model-profiles). Exclusive with model/modelTier; checked against `agentId` at run. */
|
|
39
43
|
profile: z.string().min(1).optional(),
|
|
44
|
+
/** Model group name (GET /api/model-groups). Exclusive with model/modelTier/profile; with `agentId`, a member must run there. */
|
|
45
|
+
modelGroup: z.string().min(1).optional(),
|
|
40
46
|
parentTaskId: z.string().uuid().optional(),
|
|
41
47
|
requestedByUserId: z.string().optional(),
|
|
42
48
|
outputSchema: z.record(z.string(), z.unknown()).optional(),
|
|
@@ -114,6 +120,7 @@ export class AgentTaskExecutor extends BaseExecutor<
|
|
|
114
120
|
profile: config.profile,
|
|
115
121
|
model: config.model,
|
|
116
122
|
modelTier: config.modelTier,
|
|
123
|
+
modelGroup: config.modelGroup,
|
|
117
124
|
agentId: config.agentId,
|
|
118
125
|
vcsRepo: effectiveVcsRepo,
|
|
119
126
|
});
|
|
@@ -142,6 +149,7 @@ export class AgentTaskExecutor extends BaseExecutor<
|
|
|
142
149
|
...splitLegacyModelAlias({ model: config.model, modelTier: config.modelTier }),
|
|
143
150
|
effort: config.effort,
|
|
144
151
|
profile: config.profile?.trim() || undefined,
|
|
152
|
+
modelGroup: config.modelGroup?.trim() || undefined,
|
|
145
153
|
parentTaskId: config.parentTaskId,
|
|
146
154
|
requestedByUserId: config.requestedByUserId ?? meta.requestedByUserId,
|
|
147
155
|
outputSchema: config.outputSchema,
|
|
@@ -163,7 +171,10 @@ export class AgentTaskExecutor extends BaseExecutor<
|
|
|
163
171
|
try {
|
|
164
172
|
task = await db.createTaskExtended(preCreate.description, preCreate.options);
|
|
165
173
|
} catch (error) {
|
|
166
|
-
// The profile was deleted between taskProfileError and the insert.
|
|
174
|
+
// The profile or group was deleted between taskProfileError and the insert.
|
|
175
|
+
if (modelGroupRefError(error)) {
|
|
176
|
+
return { status: "failed", error: `Unknown model group "${config.modelGroup}".` };
|
|
177
|
+
}
|
|
167
178
|
if (modelProfileRefError(error) !== "missing") throw error;
|
|
168
179
|
return { status: "failed", error: `Unknown model profile "${config.profile}".` };
|
|
169
180
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ExecutorMeta } from "../../types";
|
|
3
|
+
import { evaluatePredicate } from "../predicate-sandbox";
|
|
3
4
|
import { BaseExecutor, type ExecutorResult } from "./base";
|
|
4
5
|
|
|
5
6
|
// ─── Schemas ────────────────────────────────────────────────
|
|
@@ -16,18 +17,8 @@ export const CodeMatchOutputSchema = z.object({
|
|
|
16
17
|
|
|
17
18
|
// ─── Executor ───────────────────────────────────────────────
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"process",
|
|
22
|
-
"Bun",
|
|
23
|
-
"globalThis",
|
|
24
|
-
"global",
|
|
25
|
-
"fetch",
|
|
26
|
-
"setTimeout",
|
|
27
|
-
"setInterval",
|
|
28
|
-
] as const;
|
|
29
|
-
|
|
30
|
-
const SANDBOX_VALUES = SANDBOX_KEYS.map(() => undefined);
|
|
20
|
+
// CPU budget for one predicate. It runs synchronously on the API thread.
|
|
21
|
+
const CODE_MATCH_TIMEOUT_MS = 1_000;
|
|
31
22
|
|
|
32
23
|
export class CodeMatchExecutor extends BaseExecutor<
|
|
33
24
|
typeof CodeMatchConfigSchema,
|
|
@@ -44,26 +35,15 @@ export class CodeMatchExecutor extends BaseExecutor<
|
|
|
44
35
|
_meta: ExecutorMeta,
|
|
45
36
|
): Promise<ExecutorResult<z.infer<typeof CodeMatchOutputSchema>>> {
|
|
46
37
|
try {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
`"use strict"; return (${config.code})(input);`,
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const rawResult = fn(...SANDBOX_VALUES, context);
|
|
57
|
-
|
|
58
|
-
// Map result to port name
|
|
59
|
-
let port: string;
|
|
60
|
-
if (typeof rawResult === "boolean") {
|
|
61
|
-
port = rawResult ? "true" : "false";
|
|
62
|
-
} else if (typeof rawResult === "string") {
|
|
63
|
-
port = rawResult;
|
|
64
|
-
} else {
|
|
65
|
-
port = String(rawResult);
|
|
38
|
+
const result = await evaluatePredicate(config.code, context, "port", {
|
|
39
|
+
timeoutMs: CODE_MATCH_TIMEOUT_MS,
|
|
40
|
+
strict: true,
|
|
41
|
+
});
|
|
42
|
+
if (!result.ok) {
|
|
43
|
+
return { status: "failed", error: `code-match execution error: ${result.error}` };
|
|
66
44
|
}
|
|
45
|
+
// The guest maps the return value to a port string (see predicate-sandbox).
|
|
46
|
+
const { port, raw: rawResult } = result.value;
|
|
67
47
|
|
|
68
48
|
// Validate port is in the declared outputPorts
|
|
69
49
|
if (!config.outputPorts.includes(port)) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { isExecutorAllowedByDeployment } from "../../scripts-runtime/executors/registry";
|
|
2
3
|
import { MAX_SCRIPT_WALL_CLOCK_MS } from "../../scripts-runtime/executors/types";
|
|
3
4
|
import type { ExecutorMeta } from "../../types";
|
|
4
5
|
import {
|
|
@@ -135,6 +136,9 @@ export const ScriptOutputSchema = z.object({
|
|
|
135
136
|
|
|
136
137
|
const DEFAULT_TIMEOUT = 30_000;
|
|
137
138
|
|
|
139
|
+
export const WORKFLOW_SCRIPT_NATIVE_REFUSED =
|
|
140
|
+
'Workflow script nodes run as a native subprocess, which is not permitted when deployment SCRIPT_EXECUTOR="quickjs"';
|
|
141
|
+
|
|
138
142
|
export class ScriptExecutor extends BaseExecutor<
|
|
139
143
|
typeof ScriptConfigSchema,
|
|
140
144
|
typeof ScriptOutputSchema
|
|
@@ -151,6 +155,15 @@ export class ScriptExecutor extends BaseExecutor<
|
|
|
151
155
|
): Promise<ExecutorResult<z.infer<typeof ScriptOutputSchema>>> {
|
|
152
156
|
const timeoutMs = config.timeout ?? DEFAULT_TIMEOUT;
|
|
153
157
|
|
|
158
|
+
// Same deployment ceiling as inline and durable script runs; checked per run because the setting can change after the workflow was saved.
|
|
159
|
+
if (!isExecutorAllowedByDeployment("native")) {
|
|
160
|
+
return {
|
|
161
|
+
status: "failed",
|
|
162
|
+
error: WORKFLOW_SCRIPT_NATIVE_REFUSED,
|
|
163
|
+
output: { exitCode: -1, stdout: "", stderr: WORKFLOW_SCRIPT_NATIVE_REFUSED },
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
154
167
|
try {
|
|
155
168
|
// The timeout lives INSIDE runScript so it can actually SIGKILL the child.
|
|
156
169
|
// Racing the timeout against the spawn promise out here (the previous
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
getChildWorkflowRunId,
|
|
4
|
-
getWorkflowRunLineage,
|
|
5
|
-
getWorkflowRunTriggeredByAgentId,
|
|
6
|
-
} from "../../be/db/workflow-runs";
|
|
2
|
+
import { getChildWorkflowRunId, getWorkflowRunLineage } from "../../be/db/workflow-runs";
|
|
7
3
|
import type { ExecutorMeta, WorkflowRun } from "../../types";
|
|
8
4
|
import { ParentStepNotCurrentError, startWorkflowExecution } from "../engine";
|
|
5
|
+
import { resolveWorkflowRunPrincipal } from "../run-principal";
|
|
9
6
|
import type { ExecutorDependencies, ExecutorResult } from "./base";
|
|
10
7
|
import { BaseExecutor } from "./base";
|
|
11
8
|
import type { ExecutorRegistry } from "./registry";
|
|
@@ -126,8 +123,9 @@ export class SubWorkflowExecutor extends BaseExecutor<
|
|
|
126
123
|
// `config.inputs`: the parent's author writes those, so a creator-less
|
|
127
124
|
// child would otherwise run as any agent the author names.
|
|
128
125
|
const parent = await db.getRunWorkflow({ id: meta.runId, workflowId: meta.workflowId });
|
|
129
|
-
const
|
|
130
|
-
|
|
126
|
+
const principal = await resolveWorkflowRunPrincipal(parent, meta.runId);
|
|
127
|
+
if (!principal.ok) return { status: "failed", error: `sub-workflow: ${principal.error}` };
|
|
128
|
+
const triggeredByAgentId = principal.agentId;
|
|
131
129
|
|
|
132
130
|
// Returns once the child run exists; the child walks on its own. A child
|
|
133
131
|
// that already ended (cooldown, readiness, input failure) settles here,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { getWorkflowRunTriggeredByAgentId } from "../../be/db/workflow-runs";
|
|
3
2
|
import {
|
|
4
3
|
getScriptApiConnectionDescriptors,
|
|
5
4
|
getScriptMcpConnectionDescriptors,
|
|
@@ -19,6 +18,7 @@ import {
|
|
|
19
18
|
} from "../../scripts-runtime/executors/types";
|
|
20
19
|
import type { ExecutorMeta } from "../../types";
|
|
21
20
|
import { findInterpolationTokens } from "../../utils/template";
|
|
21
|
+
import { resolveWorkflowRunPrincipal } from "../run-principal";
|
|
22
22
|
import { BaseExecutor, type ExecutorResult } from "./base";
|
|
23
23
|
|
|
24
24
|
export const SWARM_SCRIPT_DEFAULT_TIMEOUT_MS = DEFAULT_SCRIPT_RESOURCES.wallClockMs;
|
|
@@ -95,10 +95,9 @@ export class SwarmScriptExecutor extends BaseExecutor<
|
|
|
95
95
|
// Never `trigger.agentId`: trigger data is caller-supplied, so reading the
|
|
96
96
|
// principal from it let any agent run a creator-less workflow's scripts as
|
|
97
97
|
// the lead. The run row carries the server-stamped starting agent.
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
undefined;
|
|
98
|
+
const principal = await resolveWorkflowRunPrincipal(workflow, meta.runId);
|
|
99
|
+
if (!principal.ok) return { status: "failed", error: `swarm-script: ${principal.error}` };
|
|
100
|
+
const agentId = principal.agentId;
|
|
102
101
|
const resolved = await resolveScriptSource(config, agentId);
|
|
103
102
|
|
|
104
103
|
if (!resolved.ok) {
|
|
@@ -348,8 +348,8 @@ export const SystemOneExtractionAnswerSchema = z.strictObject({
|
|
|
348
348
|
confidence: UnitInterval.optional(),
|
|
349
349
|
/** `[start, end)` character offsets of the answer in `state`. */
|
|
350
350
|
span: Span.optional(),
|
|
351
|
-
/** One span per list item
|
|
352
|
-
spans: z.array(Span).optional(),
|
|
351
|
+
/** One span per list item; null for an item the model could not locate in `state`. */
|
|
352
|
+
spans: z.array(Span.nullable()).optional(),
|
|
353
353
|
unit: z.string().optional(),
|
|
354
354
|
mean: z.union([Point, z.array(Point)]).optional(),
|
|
355
355
|
median: z.union([Point, z.array(Point)]).optional(),
|
|
@@ -591,11 +591,12 @@ function validateAnswer(
|
|
|
591
591
|
);
|
|
592
592
|
if (!ok)
|
|
593
593
|
fail(`${at}.value items must all be ${field.items === "number" ? "numbers" : "strings"}`);
|
|
594
|
-
|
|
595
|
-
|
|
594
|
+
// clairic-27b sends `null` for an item it could not locate in the state.
|
|
595
|
+
if (raw.spans !== undefined && raw.spans !== null) {
|
|
596
|
+
if (!Array.isArray(raw.spans) || !raw.spans.every((s) => s === null || isSpan(s))) {
|
|
596
597
|
fail(`${at}.spans must be a list of [start, end] offsets`);
|
|
597
598
|
}
|
|
598
|
-
answer.spans = raw.spans as [number, number][];
|
|
599
|
+
answer.spans = raw.spans as ([number, number] | null)[];
|
|
599
600
|
}
|
|
600
601
|
break;
|
|
601
602
|
}
|
|
@@ -630,7 +631,9 @@ function validateAnswer(
|
|
|
630
631
|
}
|
|
631
632
|
default:
|
|
632
633
|
checkScalar(at, field, raw.value);
|
|
633
|
-
|
|
634
|
+
// clairic-27b sends `span: null` when it could not locate the answer in the state,
|
|
635
|
+
// which includes every null value. The span is then left out.
|
|
636
|
+
if (raw.span !== undefined && raw.span !== null) {
|
|
634
637
|
if (!isSpan(raw.span)) fail(`${at}.span must be [start, end] offsets`);
|
|
635
638
|
answer.span = raw.span;
|
|
636
639
|
}
|
|
@@ -122,7 +122,7 @@ export class WaitExecutor extends BaseExecutor<typeof WaitConfigSchema, typeof W
|
|
|
122
122
|
if (typeof config.filter === "string") {
|
|
123
123
|
// Throws on parse error — caught by BaseExecutor.run wrapper and surfaced
|
|
124
124
|
// as a `failed` ExecutorResult.
|
|
125
|
-
compileStringFilter(config.filter);
|
|
125
|
+
await compileStringFilter(config.filter);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
const waitId = crypto.randomUUID();
|
|
@@ -492,7 +492,11 @@ async function startChild(input: {
|
|
|
492
492
|
if (interpolation.scriptBodyUnresolved && interpolation.scriptBodyUnresolved.length > 0) {
|
|
493
493
|
return {
|
|
494
494
|
status: "failed",
|
|
495
|
-
error: scriptBodyInterpolationError(
|
|
495
|
+
error: scriptBodyInterpolationError(
|
|
496
|
+
child.nodeId,
|
|
497
|
+
interpolation.scriptBodyUnresolved,
|
|
498
|
+
bodyNode.type,
|
|
499
|
+
),
|
|
496
500
|
};
|
|
497
501
|
}
|
|
498
502
|
if (interpolation.strictUnresolved && interpolation.strictUnresolved.length > 0) {
|
|
@@ -29,7 +29,8 @@ function asString(value: unknown): string | undefined {
|
|
|
29
29
|
* Errors for agent-task nodes (and foreach bodies) that pin a model or a
|
|
30
30
|
* profile their `agentId` cannot run. A static `profile` must exist, must not
|
|
31
31
|
* sit beside `model`/`modelTier`, and must pass the profile check when
|
|
32
|
-
* `agentId` is static too.
|
|
32
|
+
* `agentId` is static too. A static `modelGroup` is judged the same way
|
|
33
|
+
* (exclusive with all three; with a static `agentId` a member must run there).
|
|
33
34
|
*/
|
|
34
35
|
export async function workflowModelErrors(
|
|
35
36
|
def: WorkflowDefinition,
|
|
@@ -56,6 +57,17 @@ export async function workflowModelErrors(
|
|
|
56
57
|
});
|
|
57
58
|
if (error) errors.push(`Node "${node.id}" ${path}.profile: ${error}`);
|
|
58
59
|
}
|
|
60
|
+
if (isStatic(config.modelGroup)) {
|
|
61
|
+
const error = await taskProfileError({
|
|
62
|
+
modelGroup: config.modelGroup,
|
|
63
|
+
profile: asString(config.profile),
|
|
64
|
+
model: asString(config.model),
|
|
65
|
+
modelTier: asString(config.modelTier),
|
|
66
|
+
agentId: isStatic(config.agentId) ? config.agentId : undefined,
|
|
67
|
+
vcsRepo: config.vcsRepo === undefined ? vcsRepo : asString(config.vcsRepo),
|
|
68
|
+
});
|
|
69
|
+
if (error) errors.push(`Node "${node.id}" ${path}.modelGroup: ${error}`);
|
|
70
|
+
}
|
|
59
71
|
if (!isStatic(config.model) || !isStatic(config.agentId)) continue;
|
|
60
72
|
const modelTier = typeof config.modelTier === "string" ? config.modelTier : undefined;
|
|
61
73
|
const error = await explicitModelErrorForAgent({
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluates workflow-author JavaScript predicates (code-match nodes, string
|
|
3
|
+
* wait filters) in a fresh QuickJS runtime. The guest realm has no host
|
|
4
|
+
* globals, so a predicate sees only JSON-copied input. The interrupt handler
|
|
5
|
+
* stops CPU-bound code at the deadline, and the runtime has memory and stack
|
|
6
|
+
* limits.
|
|
7
|
+
*/
|
|
8
|
+
import variant from "@jitl/quickjs-singlefile-mjs-release-sync";
|
|
9
|
+
import {
|
|
10
|
+
newQuickJSWASMModuleFromVariant,
|
|
11
|
+
type QuickJSContext,
|
|
12
|
+
type QuickJSWASMModule,
|
|
13
|
+
shouldInterruptAfterDeadline,
|
|
14
|
+
} from "quickjs-emscripten-core";
|
|
15
|
+
|
|
16
|
+
const MEMORY_LIMIT_BYTES = 64 * 1024 * 1024;
|
|
17
|
+
const MAX_STACK_BYTES = 1024 * 1024;
|
|
18
|
+
|
|
19
|
+
let modulePromise: Promise<QuickJSWASMModule> | undefined;
|
|
20
|
+
|
|
21
|
+
function loadQuickJS(): Promise<QuickJSWASMModule> {
|
|
22
|
+
modulePromise ??= newQuickJSWASMModuleFromVariant(variant);
|
|
23
|
+
return modulePromise;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type PredicateResult<T> = { ok: true; value: T } | { ok: false; error: string };
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* How the guest turns the predicate's return value into a host result. Both
|
|
30
|
+
* reproduce the pre-QuickJS host evaluator:
|
|
31
|
+
* - `filter`: `!!value`; a thenable return is an error (filters are sync).
|
|
32
|
+
* - `port`: code-match's mapping. Booleans become "true"/"false", strings pass
|
|
33
|
+
* through, anything else goes through `String()` (custom `toString`, and
|
|
34
|
+
* "[object Promise]" for an async predicate). `raw` is the value after a JSON
|
|
35
|
+
* round trip, which is what the step output used to persist.
|
|
36
|
+
*/
|
|
37
|
+
export type PredicateMode = "filter" | "port";
|
|
38
|
+
|
|
39
|
+
export type PortValue = { port: string; raw?: unknown };
|
|
40
|
+
|
|
41
|
+
type EvalOptions = { timeoutMs: number; strict?: boolean };
|
|
42
|
+
|
|
43
|
+
async function withContext<T>(timeoutMs: number, fn: (ctx: QuickJSContext) => T): Promise<T> {
|
|
44
|
+
const QuickJS = await loadQuickJS();
|
|
45
|
+
const runtime = QuickJS.newRuntime();
|
|
46
|
+
runtime.setMemoryLimit(MEMORY_LIMIT_BYTES);
|
|
47
|
+
runtime.setMaxStackSize(MAX_STACK_BYTES);
|
|
48
|
+
runtime.setInterruptHandler(shouldInterruptAfterDeadline(Date.now() + timeoutMs));
|
|
49
|
+
const ctx = runtime.newContext();
|
|
50
|
+
try {
|
|
51
|
+
return fn(ctx);
|
|
52
|
+
} finally {
|
|
53
|
+
ctx.dispose();
|
|
54
|
+
runtime.dispose();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Bun gave predicates a `console`; keep calls working as no-ops.
|
|
59
|
+
const PRELUDE = `globalThis.console = Object.freeze({ log() {}, info() {}, warn() {}, error() {}, debug() {}, trace() {} });`;
|
|
60
|
+
|
|
61
|
+
const MAP_RESULT: Record<PredicateMode, string> = {
|
|
62
|
+
filter: `if (__r !== null && typeof __r === "object" && typeof __r.then === "function") {
|
|
63
|
+
return JSON.stringify({ ok: false, error: "predicate must be synchronous" });
|
|
64
|
+
}
|
|
65
|
+
return JSON.stringify({ ok: true, value: !!__r });`,
|
|
66
|
+
port: `const __port = typeof __r === "boolean" ? (__r ? "true" : "false") : typeof __r === "string" ? __r : String(__r);
|
|
67
|
+
return JSON.stringify({ ok: true, value: { port: __port, raw: __r } });`,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The guest returns one JSON string, so the host never dumps a guest object.
|
|
72
|
+
* Dumping a Promise leaks a handle and aborts the WASM runtime on dispose.
|
|
73
|
+
* Throws are caught in the guest and reported as the old host did:
|
|
74
|
+
* `err instanceof Error ? err.message : String(err)`.
|
|
75
|
+
*/
|
|
76
|
+
function wrap(source: string, strict: boolean, mode: PredicateMode): string {
|
|
77
|
+
// A plain function call, not an arrow, so a strict predicate sees
|
|
78
|
+
// `this === undefined`, as it did under `new Function`.
|
|
79
|
+
return `${strict ? '"use strict";' : ""}(function () {
|
|
80
|
+
try {
|
|
81
|
+
const __r = (${source})(__input === undefined ? undefined : JSON.parse(__input));
|
|
82
|
+
${MAP_RESULT[mode]}
|
|
83
|
+
} catch (__e) {
|
|
84
|
+
let __m;
|
|
85
|
+
try { __m = __e instanceof Error ? __e.message : String(__e); } catch (_) { __m = "unprintable error"; }
|
|
86
|
+
return JSON.stringify({ ok: false, error: String(__m) });
|
|
87
|
+
}
|
|
88
|
+
})()`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Throws with the guest's SyntaxError message when `source` does not parse. */
|
|
92
|
+
export async function checkPredicateSyntax(source: string): Promise<void> {
|
|
93
|
+
await withContext(1_000, (ctx) => {
|
|
94
|
+
const result = ctx.evalCode(wrap(source, false, "filter"), "predicate.js", {
|
|
95
|
+
compileOnly: true,
|
|
96
|
+
});
|
|
97
|
+
if (result.error) {
|
|
98
|
+
const err = ctx.dump(result.error);
|
|
99
|
+
result.error.dispose();
|
|
100
|
+
throw new Error(errorText(err));
|
|
101
|
+
}
|
|
102
|
+
result.value.dispose();
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Calls `(source)(input)` in the sandbox. `input` crosses as JSON, so the
|
|
108
|
+
* caller's objects are never shared with the predicate. Returns the mapped
|
|
109
|
+
* result (see `PredicateMode`), or the guest error (throw, syntax error,
|
|
110
|
+
* timeout, memory limit).
|
|
111
|
+
*/
|
|
112
|
+
export async function evaluatePredicate(
|
|
113
|
+
source: string,
|
|
114
|
+
input: unknown,
|
|
115
|
+
mode: "filter",
|
|
116
|
+
options: EvalOptions,
|
|
117
|
+
): Promise<PredicateResult<boolean>>;
|
|
118
|
+
export async function evaluatePredicate(
|
|
119
|
+
source: string,
|
|
120
|
+
input: unknown,
|
|
121
|
+
mode: "port",
|
|
122
|
+
options: EvalOptions,
|
|
123
|
+
): Promise<PredicateResult<PortValue>>;
|
|
124
|
+
export async function evaluatePredicate(
|
|
125
|
+
source: string,
|
|
126
|
+
input: unknown,
|
|
127
|
+
mode: PredicateMode,
|
|
128
|
+
{ timeoutMs, strict = false }: EvalOptions,
|
|
129
|
+
): Promise<PredicateResult<unknown>> {
|
|
130
|
+
let inputJson: string | undefined;
|
|
131
|
+
try {
|
|
132
|
+
inputJson = JSON.stringify(input);
|
|
133
|
+
} catch (err) {
|
|
134
|
+
return { ok: false, error: `input is not JSON-serializable: ${(err as Error).message}` };
|
|
135
|
+
}
|
|
136
|
+
return withContext(timeoutMs, (ctx): PredicateResult<unknown> => {
|
|
137
|
+
if (inputJson !== undefined) {
|
|
138
|
+
const handle = ctx.newString(inputJson);
|
|
139
|
+
ctx.setProp(ctx.global, "__input", handle);
|
|
140
|
+
handle.dispose();
|
|
141
|
+
} else {
|
|
142
|
+
ctx.setProp(ctx.global, "__input", ctx.undefined);
|
|
143
|
+
}
|
|
144
|
+
const prelude = ctx.evalCode(PRELUDE, "prelude.js");
|
|
145
|
+
if (prelude.error) {
|
|
146
|
+
prelude.error.dispose();
|
|
147
|
+
return { ok: false, error: "predicate sandbox prelude failed" };
|
|
148
|
+
}
|
|
149
|
+
prelude.value.dispose();
|
|
150
|
+
const result = ctx.evalCode(wrap(source, strict, mode), "predicate.js");
|
|
151
|
+
if (result.error) {
|
|
152
|
+
// Uncatchable guest errors: interrupt (timeout), out of memory.
|
|
153
|
+
const err = ctx.dump(result.error);
|
|
154
|
+
result.error.dispose();
|
|
155
|
+
return { ok: false, error: errorText(err) };
|
|
156
|
+
}
|
|
157
|
+
const text = ctx.typeof(result.value) === "string" ? ctx.getString(result.value) : undefined;
|
|
158
|
+
result.value.dispose();
|
|
159
|
+
if (text === undefined) return { ok: false, error: "predicate wrapper returned no result" };
|
|
160
|
+
return JSON.parse(text) as PredicateResult<unknown>;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// A dumped guest Error is `{ name, message, stack }`.
|
|
165
|
+
function errorText(err: unknown): string {
|
|
166
|
+
if (err !== null && typeof err === "object") {
|
|
167
|
+
const message = (err as { message?: unknown }).message;
|
|
168
|
+
if (typeof message === "string") return message;
|
|
169
|
+
}
|
|
170
|
+
return String(err);
|
|
171
|
+
}
|
package/src/workflows/resume.ts
CHANGED
|
@@ -889,7 +889,7 @@ export async function cancelWorkflowRunStep(
|
|
|
889
889
|
/**
|
|
890
890
|
* Resume a workflow after a linked approval request is resolved.
|
|
891
891
|
*
|
|
892
|
-
* 1. Verify run and step are in "waiting" state
|
|
892
|
+
* 1. Verify run and step are in "waiting" state and the stored request is resolved
|
|
893
893
|
* 2. Checkpoint step completion with approval response data
|
|
894
894
|
* 3. Route to the appropriate port (approved/rejected/timeout)
|
|
895
895
|
* 4. Continue the graph walk
|
|
@@ -916,12 +916,25 @@ async function resumeFromApprovalResolutionUnguarded(
|
|
|
916
916
|
const workflow = await getRunWorkflow(run);
|
|
917
917
|
if (!workflow) return;
|
|
918
918
|
|
|
919
|
-
|
|
919
|
+
// Route on the stored request bound to this step, as the recovery sweep does.
|
|
920
|
+
// The event payload is a notification, not the source of the answer.
|
|
921
|
+
const approval = await getApprovalRequestById(event.requestId);
|
|
922
|
+
if (!approval || approval.workflowRunId !== run.id || approval.workflowRunStepId !== step.id) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
if (approval.status === "cancelled") {
|
|
920
926
|
console.warn(
|
|
921
|
-
`[workflows] approval ${
|
|
927
|
+
`[workflows] approval ${approval.id} is cancelled; step ${step.id} stays waiting for the run cancel path`,
|
|
922
928
|
);
|
|
923
929
|
return;
|
|
924
930
|
}
|
|
931
|
+
if (
|
|
932
|
+
approval.status !== "approved" &&
|
|
933
|
+
approval.status !== "rejected" &&
|
|
934
|
+
approval.status !== "timeout"
|
|
935
|
+
) {
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
925
938
|
|
|
926
939
|
// Opens the sealed replay context: after the cancelled bail-out, which leaves
|
|
927
940
|
// the step to the run cancel path.
|
|
@@ -934,7 +947,11 @@ async function resumeFromApprovalResolutionUnguarded(
|
|
|
934
947
|
workflow.definition,
|
|
935
948
|
step.nodeId,
|
|
936
949
|
step.output,
|
|
937
|
-
{
|
|
950
|
+
{
|
|
951
|
+
requestId: approval.id,
|
|
952
|
+
status: approval.status,
|
|
953
|
+
responses: (approval.responses ?? null) as Record<string, unknown> | null,
|
|
954
|
+
},
|
|
938
955
|
);
|
|
939
956
|
|
|
940
957
|
// Use port-based routing to determine the correct successors.
|
|
@@ -104,7 +104,7 @@ export function startRetryPoller(registry: ExecutorRegistry, intervalMs = 5000):
|
|
|
104
104
|
await checkpointStepFailure(
|
|
105
105
|
run.id,
|
|
106
106
|
step.id,
|
|
107
|
-
scriptBodyInterpolationError(node.id, scriptBodyUnresolved),
|
|
107
|
+
scriptBodyInterpolationError(node.id, scriptBodyUnresolved, node.type),
|
|
108
108
|
step.retryCount,
|
|
109
109
|
undefined,
|
|
110
110
|
{ fence },
|