@desplega.ai/agent-swarm 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-weaaxey3.js +16 -0
- package/dist/{acp-targets-arrwv4f0.js → acp-targets-5wyy2b9m.js} +9 -9
- package/dist/{actions-y0d2n1c2.js → actions-4nxq386s.js} +24 -23
- package/dist/{agent-fs-provision-tpj7sktd.js → agent-fs-provision-v6enh76w.js} +4 -4
- package/dist/{amp-adapter-vmmnmw8d.js → amp-adapter-ze3x22qn.js} +3 -3
- package/dist/{anthropic-messages-zdca3gv1.js → anthropic-messages-88b7s3n9.js} +177 -25
- package/dist/{app-wb7w45dq.js → app-kyqt8ehw.js} +7 -6
- package/dist/{approval-notifications-7mqr6vbd.js → approval-notifications-a0db0esw.js} +7 -6
- package/dist/{assistant-gf60454p.js → assistant-9g5jzq25.js} +26 -25
- package/dist/{azure-openai-responses-b3y7fz36.js → azure-openai-responses-jeaas6x0.js} +10 -10
- package/dist/{boot-args-schema-qxmd59sr.js → boot-args-schema-d7fme4q1.js} +1 -1
- package/dist/{boot-reembed-wb44vc3s.js → boot-reembed-6wpazmpw.js} +1 -1
- package/dist/{boot-reembed-5tmeskj2.js → boot-reembed-jrwxeye2.js} +1 -1
- package/dist/{boot-scrub-sweep-25bxhnw4.js → boot-scrub-sweep-52h7yntp.js} +2 -2
- package/dist/{boot-seeds-nj9za0vk.js → boot-seeds-kb3dxjex.js} +4 -4
- package/dist/{boxd-wn235q80.js → boxd-jrrmkv3w.js} +2 -2
- package/dist/{claude-adapter-d3krpdyb.js → claude-adapter-0c0y8fqp.js} +8 -8
- package/dist/{claude-managed-adapter-t8nfgcgz.js → claude-managed-adapter-w2es07qq.js} +4 -4
- package/dist/{claude-managed-setup-7y4pwd81.js → claude-managed-setup-9ssb7ct4.js} +4 -4
- package/dist/{claude-sdk-session-d138zy0e.js → claude-sdk-session-p6t0gyse.js} +10941 -10412
- package/dist/{cli-p0n7b5rz.js → cli-075ccjh6.js} +344 -130
- package/dist/{cli-3caf7pmg.js → cli-0bgj4rh5.js} +3 -3
- package/dist/{cli-7r162fxe.js → cli-14xdms9a.js} +23 -17
- package/dist/{cli-rqx70rcz.js → cli-17qzb39j.js} +5 -2
- package/dist/{cli-y4ccxtz5.js → cli-1h4njv9y.js} +144 -6
- package/dist/{cli-6ym4jhzp.js → cli-27fat7st.js} +7 -7
- package/dist/{cli-k3q2va86.js → cli-2aacfdcn.js} +5 -5
- package/dist/{cli-vq2eg24x.js → cli-2gvdvsxj.js} +3 -3
- package/dist/{cli-sb4426be.js → cli-2jtfm8kh.js} +5 -5
- package/dist/{cli-6ehs4mta.js → cli-2z2c4k6q.js} +18 -4
- package/dist/{cli-6237rnyr.js → cli-3bpr3wks.js} +1 -1
- package/dist/{cli-5qhfv9rw.js → cli-453497a0.js} +44 -17
- package/dist/{cli-2rnd5j3t.js → cli-4aswccje.js} +2 -2
- package/dist/{cli-4ymxrwg5.js → cli-4dyzzkfb.js} +2 -2
- package/dist/{cli-p0c3vtch.js → cli-4g323fjh.js} +772 -515
- package/dist/{cli-3kd08rej.js → cli-4jjrhy48.js} +1 -1
- package/dist/{cli-fcfbct2j.js → cli-4kzp7r0q.js} +5 -5
- package/dist/{cli-kxn3747f.js → cli-4se3x6qm.js} +1 -26
- package/dist/{cli-zeh2mhkg.js → cli-5ptj757f.js} +1 -1
- package/dist/{cli-539h29es.js → cli-6a3j25xd.js} +224 -189
- package/dist/{cli-hnamkvnc.js → cli-6c9ve77f.js} +2 -2
- package/dist/{cli-3et6fmfe.js → cli-6n7y5ypy.js} +1 -1
- package/dist/{cli-8y43jx2r.js → cli-6p8p2e6r.js} +16 -9
- package/dist/{cli-zk7v5s89.js → cli-6tvh1fwq.js} +3 -3
- package/dist/{cli-p74md7t8.js → cli-7b7rxz22.js} +13 -15
- package/dist/{cli-5a6pqy45.js → cli-7e8sxqv5.js} +1 -1
- package/dist/{cli-6037prsx.js → cli-892y3vfp.js} +13 -13
- package/dist/cli-8mfdbdhe.js +43 -0
- package/dist/{cli-s1zqk1aj.js → cli-8zmpwe79.js} +15 -9
- package/dist/{cli-zcfpsfzf.js → cli-96234j5w.js} +3 -3
- package/dist/{cli-1z4qggfe.js → cli-9fvk9mv8.js} +30 -21
- package/dist/{cli-7mv4h3sn.js → cli-9g12h1aq.js} +2 -2
- package/dist/{cli-aw83sr40.js → cli-9knhkkgr.js} +3 -3
- package/dist/{cli-5mpy301f.js → cli-9t7syepg.js} +1 -1
- package/dist/{cli-qj39vrc6.js → cli-9yjhshah.js} +1 -1
- package/dist/{cli-6cwr32fe.js → cli-a02habn6.js} +422 -140
- package/dist/{cli-7evph51z.js → cli-a49frv85.js} +2 -2
- package/dist/{cli-3f8zbtqa.js → cli-a6q6x15h.js} +9 -8
- package/dist/{cli-j6te8keb.js → cli-atm0hkes.js} +8 -8
- package/dist/{cli-9fjr27ez.js → cli-b82a13ga.js} +13 -13
- package/dist/{cli-7zm3b3f5.js → cli-bf0t77nf.js} +1 -1
- package/dist/{cli-2xv18ywz.js → cli-bmqp0ser.js} +2 -2
- package/dist/{cli-mk7c5ac4.js → cli-bq97k63w.js} +2 -2
- package/dist/{cli-vfqvrd82.js → cli-cstggwq7.js} +2 -2
- package/dist/{cli-md50mj0r.js → cli-czvvnfr9.js} +3 -3
- package/dist/{cli-b6px1k1q.js → cli-dd2k2mcd.js} +1 -1
- package/dist/{cli-fq2rr3jb.js → cli-djt6wmrc.js} +6 -6
- package/dist/{cli-tsa40663.js → cli-ebqx630g.js} +3 -3
- package/dist/{cli-z0m452jr.js → cli-f7dhm7hh.js} +1 -1
- package/dist/{cli-mys27d03.js → cli-f8yhybxr.js} +3 -3
- package/dist/{cli-5gpqgs8b.js → cli-fwjwkw66.js} +2 -2
- package/dist/{cli-gabsjg8x.js → cli-g56fxddf.js} +1 -1
- package/dist/{cli-y8p78ekx.js → cli-h2qtafm4.js} +18 -18
- package/dist/{cli-psffsanb.js → cli-ha4ek2nb.js} +6 -1
- package/dist/{cli-th1dkc2v.js → cli-hnh8erra.js} +2 -2
- package/dist/{cli-w16kwbzw.js → cli-htymm48w.js} +1 -1
- package/dist/{cli-124ntmf0.js → cli-j2r1apqm.js} +138 -59
- package/dist/{cli-43ms35q9.js → cli-k3c13za2.js} +3 -3
- package/dist/{cli-54vrpgm0.js → cli-k3facve0.js} +8 -5
- package/dist/{cli-v8z0yga9.js → cli-k4r5sfaj.js} +4 -4
- package/dist/{cli-91pkxres.js → cli-kbm659dk.js} +2 -2
- package/dist/{cli-q5srsxq2.js → cli-m00c47q6.js} +110 -27
- package/dist/{cli-3aaeb78m.js → cli-mhrr4d5b.js} +95 -10
- package/dist/{cli-xqdz5cqm.js → cli-mz7ycqn8.js} +1 -0
- package/dist/{cli-qrta34nb.js → cli-n6ygvrrm.js} +4 -4
- package/dist/{cli-k5yewqgd.js → cli-nbakg5xh.js} +3 -3
- package/dist/{cli-nstkanmx.js → cli-nc39ym5q.js} +8 -8
- package/dist/{cli-01k6wpr9.js → cli-p1a4khta.js} +7 -7
- package/dist/{cli-t9ga4qmb.js → cli-p8zqbbt1.js} +40 -33
- package/dist/{cli-v46zsvqk.js → cli-ph95yejc.js} +2 -2
- package/dist/{cli-k6nejceb.js → cli-q4z9s6zs.js} +2 -2
- package/dist/{cli-kbtzfrxj.js → cli-q71g5q39.js} +3 -3
- package/dist/{cli-vs9vdpy0.js → cli-qncx2r0s.js} +1 -1
- package/dist/{cli-hg42n3hx.js → cli-qrzq3hvg.js} +8 -8
- package/dist/{cli-x40a0w9j.js → cli-r813c7rb.js} +1 -1
- package/dist/{cli-kpgcm7xy.js → cli-ramn8jae.js} +1 -1
- package/dist/{cli-cc93xzes.js → cli-raqw9fw9.js} +28 -17
- package/dist/cli-rhsc2zyx.js +68 -0
- package/dist/{cli-8st34zhr.js → cli-rpmw4fsv.js} +57 -19
- package/dist/{cli-had1p04a.js → cli-rwgwen5v.js} +4 -4
- package/dist/{cli-tr27kwyg.js → cli-rytq7dm2.js} +261 -6
- package/dist/{cli-s1khw52h.js → cli-s9twe4x0.js} +66 -17
- package/dist/{cli-2v2zdm0a.js → cli-t2s7j5cy.js} +2 -2
- package/dist/{cli-nv4xsvmk.js → cli-tb4j757d.js} +7 -7
- package/dist/{cli-q2d3e1k1.js → cli-thd3005a.js} +1 -1
- package/dist/cli-tsfkcd4v.js +30 -0
- package/dist/{cli-jrbq4djp.js → cli-v3zcnr8g.js} +1 -1
- package/dist/{cli-zfqg6fzn.js → cli-vbppqvte.js} +3 -3
- package/dist/{cli-qx4f057j.js → cli-vy3fn0mz.js} +4 -4
- package/dist/{cli-7sf9sb0w.js → cli-w5dar1bk.js} +1 -1
- package/dist/{cli-w1q68d8x.js → cli-wz4e5am2.js} +9 -9
- package/dist/{cli-m9cvf7vs.js → cli-xqbqwpxr.js} +14 -14
- package/dist/{cli-2spnz7ye.js → cli-ynph3b70.js} +11137 -8332
- package/dist/{cli-43evxwj4.js → cli-yvzxbztc.js} +9 -4
- package/dist/{cli-vsw91x06.js → cli-yzxqwcvq.js} +3 -6
- package/dist/{cli-wafmk3fn.js → cli-zb1hff00.js} +12 -12
- package/dist/{cli-yab6sh8p.js → cli-zcghfsdg.js} +23 -4
- package/dist/{cli-wwp1bd3n.js → cli-zhn4r1rz.js} +519 -75
- package/dist/{cli-tvgqesec.js → cli-zqq57pgx.js} +4 -4
- package/dist/cli.js +28 -27
- package/dist/{cloudflare-workers-ai-system-one-4aysy6rh.js → cloudflare-workers-ai-system-one-w3m0fbf8.js} +2 -2
- package/dist/{codex-adapter-exfdbj73.js → codex-adapter-ssahg4h4.js} +8 -8
- package/dist/{codex-hook-59atdwd8.js → codex-hook-aqtj17yr.js} +1 -1
- package/dist/{codex-login-a239g1ah.js → codex-login-9c7aggxe.js} +1 -1
- package/dist/{codex-session-runner-xhznc4g3.js → codex-session-runner-xn63q3h7.js} +9 -9
- package/dist/{commands-d8g349v4.js → commands-ctey7tr5.js} +3 -3
- package/dist/{controller-mwgdmb8y.js → controller-rqhbppg9.js} +4 -4
- package/dist/{controllers-connect-5v7qx04j.js → controllers-connect-w3qbpbt1.js} +22 -21
- package/dist/{core-sxy4epp2.js → core-df1n049h.js} +19 -18
- package/dist/{cursor-adapter-p2q5h35d.js → cursor-adapter-r819hf1a.js} +2 -2
- package/dist/{db-wcw0b2j8.js → db-2ah39cyx.js} +2 -2
- package/dist/{db-qpganbeb.js → db-p5drc1d1.js} +3 -3
- package/dist/{devin-adapter-zp4tqq53.js → devin-adapter-bc6g0x29.js} +1 -1
- package/dist/{dispatcher-8d8s49yz.js → dispatcher-x6w14pde.js} +19 -18
- package/dist/{docker-09tkkg0n.js → docker-6c4reetq.js} +51 -14
- package/dist/{dsh-adapter-me0twn13.js → dsh-adapter-h8qn14n4.js} +2 -2
- package/dist/{e2b-sm28k0k3.js → e2b-jg7kyyef.js} +6 -6
- package/dist/{e2b-3v1e745x.js → e2b-z4ec0qve.js} +3 -3
- package/dist/{easter-egg-3d-wv7w5ty6.js → easter-egg-3d-1y6r9gxy.js} +1 -1
- package/dist/{embedding-space-e48xchqa.js → embedding-space-z6ptw3jk.js} +6 -6
- package/dist/{embeddings-tgq2afbq.js → embeddings-0sxb1d2h.js} +1 -1
- package/dist/{event-bus-xr83x566.js → event-bus-swr88jg5.js} +1 -1
- package/dist/{execute-8rhwrk7f.js → execute-6m1ex8ce.js} +8 -4
- package/dist/{external-channel-8bt3j2pm.js → external-channel-ezer7pk0.js} +2 -2
- package/dist/fx-adapter-zwmps9re.js +19 -0
- package/dist/{google-generative-ai-bh0djqjp.js → google-generative-ai-sw77egmr.js} +9 -9
- package/dist/{google-vertex-prjbw8dj.js → google-vertex-rrw93g8h.js} +9 -9
- package/dist/grok-adapter-q0avf919.js +19 -0
- package/dist/handlers-g5jq0e4q.js +36 -0
- package/dist/{heartbeat-x0056ra5.js → heartbeat-6c4fr49t.js} +22 -21
- package/dist/{hook-mrd2ayxv.js → hook-02rt5tvq.js} +8 -8
- package/dist/{hook-a7vmn2st.js → hook-t1c5avbv.js} +5 -5
- package/dist/{http-ym9c5svp.js → http-qa3h32a1.js} +2049 -148
- package/dist/index-1f6m47mq.js +37 -0
- package/dist/index-1p1mpqda.js +36 -0
- package/dist/{index-p46tvwtx.js → index-akbgsdhh.js} +25 -24
- package/dist/{index-ny60jcat.js → index-e42j998x.js} +16 -13
- package/dist/{index-b5wgnm78.js → index-kdmkfjt7.js} +4 -4
- package/dist/{index-01ns1pkw.js → index-kqv9ebfj.js} +1 -1
- package/dist/{index-9myfj74s.js → index-kzdqn3dd.js} +3 -3
- package/dist/{index-4a0670yh.js → index-p2f5xg64.js} +6 -6
- package/dist/{index-x6azjwm8.js → index-qpjk2hxk.js} +1 -1
- package/dist/index-tnkd410q.js +41 -0
- package/dist/{k8s-m56sw868.js → k8s-7jrh5va2.js} +73 -14
- package/dist/{keepalive-7yxg8z4c.js → keepalive-jmf6pn8c.js} +4 -4
- package/dist/lead-m5e7xt93.js +75 -0
- package/dist/{llama-cpp-classify-nfgswa1m.js → llama-cpp-classify-yvb8vh7w.js} +2 -2
- package/dist/{maintenance-6tefxmk1.js → maintenance-g7v15tj1.js} +1 -1
- package/dist/{mistral-conversations-tm2vd4gc.js → mistral-conversations-w4bncwbt.js} +7 -7
- package/dist/{node-7qsx5kvm.js → node-z67yjre7.js} +19 -13
- package/dist/{oauth-refresh-sweep-70cavc3a.js → oauth-refresh-sweep-ywgf8tbr.js} +3 -3
- package/dist/{onboard-fja65z08.js → onboard-m3fedypq.js} +3 -3
- package/dist/{openai-codex-responses-sxjv60xx.js → openai-codex-responses-70g39cgz.js} +20 -14
- package/dist/{openai-completions-0c7qnhsx.js → openai-completions-cv3hp4h5.js} +18 -11
- package/dist/{openai-decisions-ytp6w6xh.js → openai-decisions-fyq1p9f9.js} +2 -2
- package/dist/{openai-responses-a7h29chp.js → openai-responses-trsvnks6.js} +13 -11
- package/dist/{opencode-adapter-hakkm7yh.js → opencode-adapter-19ktcbb9.js} +7 -7
- package/dist/{openrouter-images-xr9gme9x.js → openrouter-images-0jj12a2q.js} +6 -6
- package/dist/{otel-impl-7zhnt6gj.js → otel-impl-3ehm1hgc.js} +2 -2
- package/dist/{pending-h01yzpx4.js → pending-fwj2fatd.js} +20 -19
- package/dist/{pi-messages-2j0fpqwq.js → pi-messages-zk3g4esn.js} +1 -1
- package/dist/{pi-mono-adapter-f52hz743.js → pi-mono-adapter-xdeesvc4.js} +18 -17
- package/dist/{pricing-refresh-fzxvk2zf.js → pricing-refresh-4j8dzvxg.js} +2 -2
- package/dist/{rbac-roles-9v6vhgbs.js → rbac-roles-8msjr07m.js} +3 -3
- package/dist/{rbac-roles-hfgh8sba.js → rbac-roles-n7t2acv8.js} +2 -2
- package/dist/{render-v2-1rgspxzf.js → render-v2-j7qggj8h.js} +7 -6
- package/dist/{resume-tqy61x24.js → resume-hj1mn65y.js} +9 -8
- package/dist/{runtime-exkxyx5f.js → runtime-z31mdsgv.js} +2 -2
- package/dist/{session-access-3act7vt4.js → session-access-w38fh09a.js} +4 -4
- package/dist/{session-source-backfill-82qe7fqq.js → session-source-backfill-ax6qxv20.js} +3 -3
- package/dist/{setup-ry1vfdef.js → setup-dsqmpfcr.js} +1 -1
- package/dist/thread-buffer-nf55vwx3.js +39 -0
- package/dist/tree-visibility-6vqmnr71.js +24 -0
- package/dist/{typesafe-system-one-vcfj2ak8.js → typesafe-system-one-qkvkgrcz.js} +2 -2
- package/dist/{user-merge-jobs-bx6bf7db.js → user-merge-jobs-mvheb3ed.js} +3 -3
- package/dist/{virtual-modules-s0rjzcqq.js → virtual-modules-w2qk2wew.js} +32 -10
- package/dist/{work-objects-z2e5tv03.js → work-objects-4ahy5es5.js} +22 -21
- package/dist/worker-ews1nyhw.js +75 -0
- package/dist/{worker-follow-up-y3xeg89w.js → worker-follow-up-1gs4aw7y.js} +19 -18
- package/dist/{x-wg164ss9.js → x-3wr8c5sh.js} +2 -2
- package/openapi.json +995 -49
- package/package.json +9 -8
- package/src/be/db/request-composition.ts +190 -0
- package/src/be/db/runtime.ts +15 -0
- package/src/be/db/slack-trees.ts +220 -10
- package/src/be/db/tasks/human-free.ts +3 -2
- package/src/be/db/workflow-run-retention.ts +101 -0
- package/src/be/db-client.ts +23 -1
- package/src/be/db-retention-defaults.ts +46 -0
- package/src/be/db-retention.ts +55 -6
- package/src/be/mcp-events/catalog.ts +108 -0
- package/src/be/mcp-events/dispatcher.ts +202 -0
- package/src/be/mcp-events/protocol.ts +296 -0
- package/src/be/mcp-events/store.ts +231 -0
- package/src/be/mcp-events/webhook.ts +226 -0
- package/src/be/memory/providers/sqlite-store.ts +110 -24
- package/src/be/memory/review-recall-filter.ts +22 -0
- package/src/be/memory/search-candidates.ts +5 -7
- package/src/be/memory/types.ts +5 -0
- package/src/be/migrations/322_runtime_pool_workspace.sql +8 -0
- package/src/be/migrations/323_slack_task_tree_visibility.sql +9 -0
- package/src/be/migrations/326_slack_reconcile_pages.sql +13 -0
- package/src/be/migrations/327_mcp_event_subscriptions.sql +57 -0
- package/src/be/migrations/329_workflow_run_retention.sql +9 -0
- package/src/be/migrations/330_request_composition.sql +22 -0
- package/src/be/model-profile-check.ts +1 -1
- package/src/be/multi-runtime.ts +32 -4
- package/src/be/runtime-pools/controllers.ts +18 -3
- package/src/be/runtime-pools/db.ts +15 -4
- package/src/be/runtime-pools/supervisor.ts +42 -2
- package/src/be/swarm-config-guard.ts +10 -2
- package/src/commands/context-preamble.ts +11 -4
- package/src/commands/credential-outcome-report.ts +33 -9
- package/src/commands/e2b-stack-wizard.tsx +12 -6
- package/src/commands/runner.ts +116 -12
- package/src/extensions/catalog.generated.json +1 -1
- package/src/github/app.ts +59 -14
- package/src/http/all-routes.ts +2 -0
- package/src/http/config.ts +2 -1
- package/src/http/core.ts +2 -0
- package/src/http/github-token.ts +66 -0
- package/src/http/index.ts +21 -0
- package/src/http/mcp-user.ts +11 -8
- package/src/http/mcp.ts +58 -42
- package/src/http/prompt-templates.ts +1 -0
- package/src/http/request-composition.ts +310 -0
- package/src/http/tasks.ts +6 -1
- package/src/http/tool-schema-estimate.ts +95 -0
- package/src/http/workflows.ts +29 -11
- package/src/integrations/chat-sdk/inbound.ts +2 -2
- package/src/prompts/base-prompt.ts +133 -7
- package/src/prompts/resolver.ts +41 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +72 -1
- package/src/providers/opencode-swarm-plugin.ts +22 -3
- package/src/providers/pi-mono-adapter.ts +1 -0
- package/src/providers/pi-mono-extension.ts +71 -0
- package/src/providers/pricing-sources.md +4 -0
- package/src/providers/request-composition-hook.ts +312 -0
- package/src/providers/types.ts +5 -0
- package/src/runtime-providers/controller-protocol.ts +7 -0
- package/src/runtime-providers/docker.ts +80 -12
- package/src/runtime-providers/k8s.ts +111 -6
- package/src/runtime-providers/types.ts +17 -0
- package/src/scheduler/scheduler.ts +1 -1
- package/src/server-user.ts +16 -1
- package/src/slack/ack.ts +10 -5
- package/src/slack/actions.ts +3 -3
- package/src/slack/app.ts +2 -0
- package/src/slack/assistant.ts +4 -4
- package/src/slack/blocks.ts +3 -3
- package/src/slack/handlers.ts +3 -3
- package/src/slack/reaction-shortcode.ts +23 -2
- package/src/slack/render-v2.ts +297 -200
- package/src/slack/responses.ts +7 -5
- package/src/slack/thread-buffer.ts +3 -3
- package/src/slack/tree-visibility.ts +64 -0
- package/src/tasks/worker-follow-up.ts +127 -17
- package/src/tests/azure-devops-outbound.test.ts +47 -14
- package/src/tests/base-prompt.test.ts +149 -1
- package/src/tests/check-playwright-version.test.ts +33 -0
- package/src/tests/context-preamble-budget.test.ts +65 -0
- package/src/tests/credential-outcome-report.test.ts +81 -1
- package/src/tests/db-client.test.ts +22 -0
- package/src/tests/db-retention-defaults.test.ts +244 -0
- package/src/tests/db-retention.test.ts +2 -1
- package/src/tests/db-runtime.test.ts +2 -1
- package/src/tests/deploy-release-dispatch.test.ts +332 -0
- package/src/tests/e2b-stack-wizard.test.tsx +156 -0
- package/src/tests/entrypoint-chown-no-follow.test.ts +69 -0
- package/src/tests/entrypoint-repo-clone-target.test.ts +112 -0
- package/src/tests/env-flag.test.ts +4 -2
- package/src/tests/event-loop-lag.test.ts +12 -18
- package/src/tests/extensions-example-slack-reply-gate.test.ts +15 -0
- package/src/tests/fixtures/base-prompt-baseline-cases.ts +78 -0
- package/src/tests/fixtures/base-prompt-baseline.json +18 -0
- package/src/tests/github-app-worker-auth-helper.test.ts +325 -0
- package/src/tests/github-installation-token-route.test.ts +199 -0
- package/src/tests/mcp-user-events.test.ts +708 -0
- package/src/tests/memory-key-paths.test.ts +4 -1
- package/src/tests/memory-search-stall.test.ts +421 -0
- package/src/tests/migration-322-runtime-pool-workspace.test.ts +116 -0
- package/src/tests/migration-329-workflow-run-retention.test.ts +32 -0
- package/src/tests/model-profile-fallbacks.test.ts +236 -2
- package/src/tests/opencode-adapter.test.ts +86 -0
- package/src/tests/pi-mono-extension.test.ts +168 -0
- package/src/tests/preload-env.test.ts +61 -1
- package/src/tests/preload.ts +22 -0
- package/src/tests/prompt-template-resolver.test.ts +85 -0
- package/src/tests/reload-config.test.ts +45 -0
- package/src/tests/request-composition.test.ts +447 -0
- package/src/tests/runner-max-concurrent.test.ts +86 -0
- package/src/tests/runtime-pools-db.test.ts +80 -0
- package/src/tests/runtime-provider-registration.test.ts +8 -0
- package/src/tests/runtime-providers-docker.test.ts +192 -1
- package/src/tests/runtime-providers-k8s.test.ts +127 -0
- package/src/tests/runtime-remote-controller.test.ts +64 -1
- package/src/tests/runtime-supervisor.test.ts +101 -0
- package/src/tests/script-connections.test.ts +8 -0
- package/src/tests/slack-blocks.test.ts +18 -0
- package/src/tests/slack-empty-icon-config.test.ts +113 -0
- package/src/tests/slack-reaction-config.test.ts +38 -2
- package/src/tests/slack-render-v2-query-plans.test.ts +100 -1
- package/src/tests/slack-render-v2-reconcile.test.ts +75 -4
- package/src/tests/slack-render-v2.test.ts +683 -11
- package/src/tests/swarm-config-reserved-keys.test.ts +1 -0
- package/src/tests/task-session-prompts.test.ts +37 -0
- package/src/tests/user-delete-perf.test.ts +36 -9
- package/src/tests/webhook-filter.test.ts +327 -0
- package/src/tests/workflow-async-v2.test.ts +19 -16
- package/src/tests/workflow-definition-telemetry.test.ts +15 -5
- package/src/tests/workflow-e2e.test.ts +1 -9
- package/src/tests/workflow-finalization-races.test.ts +553 -0
- package/src/tests/workflow-foreach.test.ts +2 -0
- package/src/tests/workflow-hitl-routing.test.ts +26 -20
- package/src/tests/workflow-http-v2.test.ts +105 -2
- package/src/tests/workflow-idempotency.test.ts +41 -0
- package/src/tests/workflow-mcp-webhook-filter.test.ts +214 -0
- package/src/tests/workflow-parallel-park.test.ts +297 -0
- package/src/tests/workflow-retry-v2.test.ts +57 -21
- package/src/tests/workflow-retry-validation.test.ts +13 -13
- package/src/tests/workflow-runs-retention.test.ts +533 -0
- package/src/tests/workflow-script-principal.test.ts +7 -2
- package/src/tests/workflow-tla-races.test.ts +7 -2
- package/src/tests/workflow-triggers-v2.test.ts +201 -0
- package/src/tests/workflow-wait-builtin-events.test.ts +3 -1
- package/src/tests/workflow-wait-event.test.ts +28 -2
- package/src/tests/workflow-wait-poller.test.ts +94 -0
- package/src/tests/workflow-wait-time.test.ts +7 -3
- package/src/tests/workflow-wait.test.ts +26 -0
- package/src/tests/workflow-wait.ts +44 -0
- package/src/tools/workflows/create-workflow.ts +7 -3
- package/src/tools/workflows/update-workflow.ts +7 -3
- package/src/types.ts +200 -2
- package/src/utils/credentials.ts +7 -0
- package/src/workflows/checkpoint.ts +18 -0
- package/src/workflows/engine.ts +38 -10
- package/src/workflows/foreach-driver.ts +42 -4
- package/src/workflows/recovery.ts +6 -1
- package/src/workflows/resume.ts +11 -3
- package/src/workflows/retry-poller.ts +17 -4
- package/src/workflows/successor-routing.ts +108 -0
- package/src/workflows/task-step-routing.ts +5 -2
- package/src/workflows/triggers.ts +21 -36
- package/src/workflows/wait-poller.ts +6 -2
- package/src/workflows/webhook-filter.ts +203 -0
- package/templates/extensions/slack-reply-gate/hooks.ts +8 -4
- package/templates/skills/swarm-docs/content.md +2 -0
- package/dist/acp-adapter-bht22g3k.js +0 -16
- package/dist/fx-adapter-adtdb3jb.js +0 -19
- package/dist/grok-adapter-accnn9km.js +0 -19
- package/dist/handlers-1x77561e.js +0 -35
- package/dist/index-48qzcqzj.js +0 -35
- package/dist/index-rkvaambe.js +0 -36
- package/dist/index-xj1mq27m.js +0 -40
- package/dist/lead-enzn86bz.js +0 -74
- package/dist/thread-buffer-3x93yexa.js +0 -38
- package/dist/worker-zfcv2wbf.js +0 -74
|
@@ -8,7 +8,12 @@ import {
|
|
|
8
8
|
} from "../be/db";
|
|
9
9
|
import { disarmWorkflowTreeRetries, getRunLineageBlock } from "../be/db/workflow-runs";
|
|
10
10
|
import type { RetryPolicy } from "../types";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
adoptStoredContext,
|
|
13
|
+
checkpointStep,
|
|
14
|
+
checkpointStepFailure,
|
|
15
|
+
checkpointStepWaiting,
|
|
16
|
+
} from "./checkpoint";
|
|
12
17
|
import { getSuccessors, resolveValidationPort } from "./definition";
|
|
13
18
|
import {
|
|
14
19
|
failRunOnUnreadableReplay,
|
|
@@ -21,9 +26,12 @@ import type { ExecutorRegistry } from "./executors/registry";
|
|
|
21
26
|
import { FOREACH_ITEMS_WAIT_FOR, parkAndDriveForeach, runForeachDrive } from "./foreach-driver";
|
|
22
27
|
import { resolveForeachParent } from "./foreach-join";
|
|
23
28
|
import { rebuildNodeExecutionInput } from "./step-input";
|
|
29
|
+
import { hasOwedSuccessors } from "./successor-routing";
|
|
24
30
|
import { runStepValidation } from "./validation";
|
|
25
31
|
|
|
26
32
|
let pollerTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
33
|
+
/** Bumped by every stop, so a tick in flight can tell that its poller was stopped. */
|
|
34
|
+
let pollerGeneration = 0;
|
|
27
35
|
|
|
28
36
|
/**
|
|
29
37
|
* Start the retry poller.
|
|
@@ -33,6 +41,7 @@ let pollerTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
|
33
41
|
*/
|
|
34
42
|
export function startRetryPoller(registry: ExecutorRegistry, intervalMs = 5000): void {
|
|
35
43
|
if (pollerTimeout !== null) return; // Already running
|
|
44
|
+
const generation = pollerGeneration;
|
|
36
45
|
|
|
37
46
|
async function poll(): Promise<void> {
|
|
38
47
|
try {
|
|
@@ -160,6 +169,8 @@ export function startRetryPoller(registry: ExecutorRegistry, intervalMs = 5000):
|
|
|
160
169
|
drive.successors,
|
|
161
170
|
registry,
|
|
162
171
|
workflow.id,
|
|
172
|
+
undefined,
|
|
173
|
+
{ successorDebt: drive.successorDebt },
|
|
163
174
|
);
|
|
164
175
|
} else {
|
|
165
176
|
await completeRunIfSettled(run.id, ctx);
|
|
@@ -268,8 +279,8 @@ export function startRetryPoller(registry: ExecutorRegistry, intervalMs = 5000):
|
|
|
268
279
|
console.error("[workflows] Retry poller error:", err);
|
|
269
280
|
}
|
|
270
281
|
|
|
271
|
-
// Schedule next tick after completion
|
|
272
|
-
pollerTimeout = setTimeout(poll, intervalMs);
|
|
282
|
+
// Schedule next tick after completion, unless the poller was stopped mid-tick
|
|
283
|
+
if (generation === pollerGeneration) pollerTimeout = setTimeout(poll, intervalMs);
|
|
273
284
|
}
|
|
274
285
|
|
|
275
286
|
// Start the first tick
|
|
@@ -346,7 +357,8 @@ async function completeRunIfSettled(runId: string, ctx: Record<string, unknown>)
|
|
|
346
357
|
s.status === "waiting" ||
|
|
347
358
|
(s.status === "failed" && s.nextRetryAt != null),
|
|
348
359
|
);
|
|
349
|
-
if (live) return;
|
|
360
|
+
if (live || hasOwedSuccessors(runId)) return;
|
|
361
|
+
await adoptStoredContext(runId, ctx);
|
|
350
362
|
await updateWorkflowRun(runId, {
|
|
351
363
|
status: "completed",
|
|
352
364
|
context: ctx,
|
|
@@ -361,6 +373,7 @@ const RETRYABLE_RUN_STATUSES = new Set(["running", "waiting", "failed"]);
|
|
|
361
373
|
* Stop the retry poller (for clean shutdown).
|
|
362
374
|
*/
|
|
363
375
|
export function stopRetryPoller(): void {
|
|
376
|
+
pollerGeneration++;
|
|
364
377
|
if (pollerTimeout !== null) {
|
|
365
378
|
clearTimeout(pollerTimeout);
|
|
366
379
|
pollerTimeout = null;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Successor routing owed on a run, in this process.
|
|
3
|
+
*
|
|
4
|
+
* A step that completed has successors with no step row until a walk claims
|
|
5
|
+
* them, so step rows alone can read as "nothing left to do". Every run
|
|
6
|
+
* finalizer checks `hasOwedSuccessors` inside its transaction and leaves the
|
|
7
|
+
* run to the walk that owes them: that walk's own finalizer settles the run.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { getDbClient } from "../be/db";
|
|
11
|
+
import type { WorkflowNode } from "../types";
|
|
12
|
+
|
|
13
|
+
/** Open holds per run: claims waiting for their walk plus walks still routing. */
|
|
14
|
+
const owed = new Map<string, number>();
|
|
15
|
+
|
|
16
|
+
function add(runId: string, delta: number): void {
|
|
17
|
+
const next = (owed.get(runId) ?? 0) + delta;
|
|
18
|
+
if (next > 0) owed.set(runId, next);
|
|
19
|
+
else owed.delete(runId);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function hasOwedSuccessors(runId: string): boolean {
|
|
23
|
+
return owed.has(runId);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* One claim's hold on its run. Only the walk handed this object takes it over,
|
|
28
|
+
* so no other walk on the run can release it.
|
|
29
|
+
*/
|
|
30
|
+
export interface SuccessorWalkDebt {
|
|
31
|
+
readonly runId: string;
|
|
32
|
+
/** Drop the hold. Idempotent. */
|
|
33
|
+
release(): void;
|
|
34
|
+
/** True once a walk took the hold over. */
|
|
35
|
+
takenOver: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Hold the run for a walk the caller starts right after its transaction.
|
|
40
|
+
* Call it inside the transaction that completes the step, so no finalizer can
|
|
41
|
+
* read the completed row without also seeing the debt. The caller must then
|
|
42
|
+
* pass the debt to `walkGraph` (`options.successorDebt`), or release it: a
|
|
43
|
+
* claim that never walks keeps the run from finalizing.
|
|
44
|
+
*/
|
|
45
|
+
export function oweSuccessorWalk(runId: string): SuccessorWalkDebt {
|
|
46
|
+
add(runId, 1);
|
|
47
|
+
let released = false;
|
|
48
|
+
return {
|
|
49
|
+
runId,
|
|
50
|
+
takenOver: false,
|
|
51
|
+
release() {
|
|
52
|
+
if (released) return;
|
|
53
|
+
released = true;
|
|
54
|
+
add(runId, -1);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Hold the run while a walk routes successors. Takes over `debt`, the hold of
|
|
61
|
+
* the claim this walk routes, else takes a new one. The release is idempotent;
|
|
62
|
+
* run it before the holder's own finalizer.
|
|
63
|
+
*/
|
|
64
|
+
export function holdSuccessorRouting(runId: string, debt?: SuccessorWalkDebt): () => void {
|
|
65
|
+
if (debt && debt.runId === runId && !debt.takenOver) {
|
|
66
|
+
debt.takenOver = true;
|
|
67
|
+
return () => debt.release();
|
|
68
|
+
}
|
|
69
|
+
return oweSuccessorWalk(runId).release;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** The fields of a claim result that decide whether it owes a walk. */
|
|
73
|
+
interface SuccessorClaim {
|
|
74
|
+
claimed: boolean;
|
|
75
|
+
runFailed: boolean;
|
|
76
|
+
successors: WorkflowNode[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Run a claim that completes a step and hands its successors to the caller.
|
|
81
|
+
* The successors have no step row until the caller's walk claims them, so the
|
|
82
|
+
* claim holds the run against finalizers from inside its own transaction.
|
|
83
|
+
* Callers pass a claimed result with successors straight to `walkGraph`, with
|
|
84
|
+
* `successorDebt` in its options, or release the debt.
|
|
85
|
+
*/
|
|
86
|
+
export async function claimAndOweWalk<T extends SuccessorClaim>(
|
|
87
|
+
runId: string,
|
|
88
|
+
claim: () => Promise<T>,
|
|
89
|
+
): Promise<T & { successorDebt?: SuccessorWalkDebt }> {
|
|
90
|
+
let debt: SuccessorWalkDebt | undefined;
|
|
91
|
+
try {
|
|
92
|
+
return await getDbClient().transaction(async () => {
|
|
93
|
+
const result = await claim();
|
|
94
|
+
if (result.claimed && !result.runFailed && result.successors.length > 0) {
|
|
95
|
+
debt = oweSuccessorWalk(runId);
|
|
96
|
+
// Inside a caller's transaction the claim publishes only at its
|
|
97
|
+
// COMMIT; a rollback there (or a failed COMMIT) must drop the hold too.
|
|
98
|
+
getDbClient().afterRollback(debt.release);
|
|
99
|
+
return { ...result, successorDebt: debt };
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
});
|
|
103
|
+
} catch (err) {
|
|
104
|
+
// This claim's own savepoint rolled back while the outer transaction lives on.
|
|
105
|
+
debt?.release();
|
|
106
|
+
throw err;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -23,6 +23,7 @@ import { getSuccessors } from "./definition";
|
|
|
23
23
|
import type { ExecutorRegistry } from "./executors/registry";
|
|
24
24
|
import { resolveStepNode } from "./foreach-body";
|
|
25
25
|
import { type ForeachSettleResult, resolveForeachParent, settleForeachChild } from "./foreach-join";
|
|
26
|
+
import { claimAndOweWalk, type SuccessorWalkDebt } from "./successor-routing";
|
|
26
27
|
|
|
27
28
|
export interface TaskStepRoutingResult {
|
|
28
29
|
/**
|
|
@@ -37,6 +38,8 @@ export interface TaskStepRoutingResult {
|
|
|
37
38
|
successors: WorkflowNode[];
|
|
38
39
|
/** True when this call failed the run: nothing may route or re-park it. */
|
|
39
40
|
runFailed: boolean;
|
|
41
|
+
/** This claim's hold on the run; pass it to the `walkGraph` that routes `successors`. */
|
|
42
|
+
successorDebt?: SuccessorWalkDebt;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
const UNCLAIMED: TaskStepRoutingResult = {
|
|
@@ -143,7 +146,7 @@ export async function checkpointPortStepAndResolveSuccessors(
|
|
|
143
146
|
ctx: Record<string, unknown>,
|
|
144
147
|
registry?: ExecutorRegistry,
|
|
145
148
|
): Promise<PortStepRoutingResult> {
|
|
146
|
-
return await
|
|
149
|
+
return await claimAndOweWalk(runId, async () => {
|
|
147
150
|
const current = await getWorkflowRunStep(stepId);
|
|
148
151
|
if (!current || current.status !== "waiting") return UNCLAIMED;
|
|
149
152
|
const run = await getWorkflowRun(runId);
|
|
@@ -301,7 +304,7 @@ export async function completeTaskStepAndResolveSuccessors(
|
|
|
301
304
|
// The task step, optional foreach join checkpoint, workflow context, and
|
|
302
305
|
// running status must commit together. A crash after this transaction is
|
|
303
306
|
// recoverable through the running-run graph re-walk.
|
|
304
|
-
return await
|
|
307
|
+
return await claimAndOweWalk(runId, async () => {
|
|
305
308
|
// Re-read inside the transaction: callers checked `waiting` before their
|
|
306
309
|
// own awaits, so the claim is only authoritative here.
|
|
307
310
|
const current = await getWorkflowRunStep(step.id);
|
|
@@ -4,6 +4,7 @@ import type { ScheduledTask, TriggerConfig } from "../types";
|
|
|
4
4
|
import { startWorkflowExecution } from "./engine";
|
|
5
5
|
import type { ExecutorRegistry } from "./executors/registry";
|
|
6
6
|
import { resolveInputValue } from "./input";
|
|
7
|
+
import { decideWebhookDelivery, type WebhookDeliverySkip } from "./webhook-filter";
|
|
7
8
|
|
|
8
9
|
type WebhookTriggerConfig = Extract<TriggerConfig, { type: "webhook" }>;
|
|
9
10
|
|
|
@@ -13,9 +14,6 @@ const DEFAULT_HMAC_HEADER = "X-Hub-Signature-256";
|
|
|
13
14
|
/** Fallback header names checked (case-insensitive) after the trigger's configured header. */
|
|
14
15
|
const FALLBACK_HMAC_HEADERS = ["x-hub-signature-256", "x-signature", "x-webhook-signature"];
|
|
15
16
|
|
|
16
|
-
/** Header read for a webhook trigger's `events` allowlist when it configures no `eventHeader`. */
|
|
17
|
-
const DEFAULT_EVENT_HEADER = "X-GitHub-Event";
|
|
18
|
-
|
|
19
17
|
/** A bag of HTTP headers — values may be a string, a string array, or absent. */
|
|
20
18
|
export type HeaderBag = Record<string, string | string[] | undefined>;
|
|
21
19
|
|
|
@@ -155,24 +153,10 @@ export async function verifyWebhookRequest(
|
|
|
155
153
|
}
|
|
156
154
|
}
|
|
157
155
|
|
|
158
|
-
/**
|
|
159
|
-
* Event of a delivery a webhook trigger's `events` allowlist does not admit,
|
|
160
|
-
* or `undefined` when the delivery may start a run. A missing header counts
|
|
161
|
-
* as not admitted (`null`): an allowlist is a closed gate.
|
|
162
|
-
*/
|
|
163
|
-
function filteredWebhookEvent(
|
|
164
|
-
trigger: WebhookTriggerConfig,
|
|
165
|
-
headers: HeaderBag,
|
|
166
|
-
): string | null | undefined {
|
|
167
|
-
if (!trigger.events || trigger.events.length === 0) return undefined;
|
|
168
|
-
const event = getHeader(headers, trigger.eventHeader || DEFAULT_EVENT_HEADER) ?? null;
|
|
169
|
-
return event !== null && trigger.events.includes(event) ? undefined : event;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/** Outcome of a webhook delivery: a started run, or a delivery the trigger's `events` allowlist dropped. */
|
|
156
|
+
/** Outcome of a webhook delivery: a started run, or a delivery the trigger filter dropped. */
|
|
173
157
|
export type WebhookTriggerResult =
|
|
174
158
|
| { runId: string; skipped?: undefined }
|
|
175
|
-
| { runId?: undefined
|
|
159
|
+
| (WebhookDeliverySkip & { runId?: undefined });
|
|
176
160
|
|
|
177
161
|
export interface HandleWebhookTriggerOptions {
|
|
178
162
|
/**
|
|
@@ -196,13 +180,12 @@ export interface HandleWebhookTriggerOptions {
|
|
|
196
180
|
* trigger — being reachable over `/api/webhooks/:workflowId` is opt-in
|
|
197
181
|
* 3. If `hmacSecret` / `verification` is set, resolves the signature header +
|
|
198
182
|
* secret and verifies the signature against the raw body bytes
|
|
199
|
-
* 4.
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* 5.
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* `trigger-workflow` MCP tool.
|
|
183
|
+
* 4. Parses the raw body as JSON (falling back to the raw string when the
|
|
184
|
+
* body is non-JSON) so the delivery filter and downstream
|
|
185
|
+
* `{{trigger.deep.path}}` interpolation see the same value
|
|
186
|
+
* 5. Applies `filter` and the deprecated `events` allowlist. A miss returns
|
|
187
|
+
* a `skipped` result and does not persist a run. A trigger whose filter
|
|
188
|
+
* or preset is not the documented shape fails closed with 500
|
|
206
189
|
* 6. Starts the workflow execution with the parsed payload
|
|
207
190
|
*/
|
|
208
191
|
export async function handleWebhookTrigger(
|
|
@@ -246,19 +229,21 @@ export async function handleWebhookTrigger(
|
|
|
246
229
|
typeof payload === "string" ? payload : JSON.stringify(payload),
|
|
247
230
|
headers,
|
|
248
231
|
);
|
|
249
|
-
|
|
250
|
-
// After verification, so a bad signature is still a 401 for any event.
|
|
251
|
-
// Before the run is persisted, so a dropped delivery writes no rows.
|
|
252
|
-
const filtered = filteredWebhookEvent(webhookTrigger, headers);
|
|
253
|
-
if (filtered !== undefined) {
|
|
254
|
-
return { skipped: true, reason: "event-not-allowed", event: filtered };
|
|
255
|
-
}
|
|
256
232
|
}
|
|
257
233
|
|
|
258
|
-
// Parse
|
|
259
|
-
//
|
|
260
|
-
//
|
|
234
|
+
// Parse after verification. A non-JSON body stays a string: body clauses
|
|
235
|
+
// miss on it, and a delivery with no body clause still starts a run.
|
|
236
|
+
// Downstream `{{trigger.deep.path}}` uses this value.
|
|
261
237
|
const triggerData = parseTriggerPayload(payload);
|
|
238
|
+
if (webhookTrigger) {
|
|
239
|
+
// After verification, so a bad signature is still a 401. Before the run
|
|
240
|
+
// is persisted, so a dropped delivery writes no rows.
|
|
241
|
+
const decision = decideWebhookDelivery(webhookTrigger, headers, triggerData);
|
|
242
|
+
if (decision.action === "invalid") {
|
|
243
|
+
throw new WebhookError(decision.message, 500);
|
|
244
|
+
}
|
|
245
|
+
if (decision.action === "skip") return decision.skip;
|
|
246
|
+
}
|
|
262
247
|
|
|
263
248
|
const runId = await startWorkflowExecution(workflow, triggerData, registry, {
|
|
264
249
|
triggerType: "event",
|
|
@@ -3,6 +3,8 @@ import type { ExecutorRegistry } from "./executors/registry";
|
|
|
3
3
|
import { resumeWaitState } from "./resume";
|
|
4
4
|
|
|
5
5
|
let pollerTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
6
|
+
/** Bumped by every stop, so a tick in flight can tell that its poller was stopped. */
|
|
7
|
+
let pollerGeneration = 0;
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Start the wait-state poller.
|
|
@@ -24,6 +26,7 @@ let pollerTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
|
24
26
|
*/
|
|
25
27
|
export function startWaitPoller(registry: ExecutorRegistry, intervalMs = 5000): void {
|
|
26
28
|
if (pollerTimeout !== null) return; // Already running
|
|
29
|
+
const generation = pollerGeneration;
|
|
27
30
|
|
|
28
31
|
async function poll(): Promise<void> {
|
|
29
32
|
try {
|
|
@@ -46,8 +49,8 @@ export function startWaitPoller(registry: ExecutorRegistry, intervalMs = 5000):
|
|
|
46
49
|
console.error("[workflows] Wait poller tick error:", err);
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
// Schedule the next tick after this one completes.
|
|
50
|
-
pollerTimeout = setTimeout(poll, intervalMs);
|
|
52
|
+
// Schedule the next tick after this one completes, unless the poller was stopped mid-tick.
|
|
53
|
+
if (generation === pollerGeneration) pollerTimeout = setTimeout(poll, intervalMs);
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
// Start the first tick.
|
|
@@ -56,6 +59,7 @@ export function startWaitPoller(registry: ExecutorRegistry, intervalMs = 5000):
|
|
|
56
59
|
|
|
57
60
|
/** Stop the wait poller (clean shutdown). */
|
|
58
61
|
export function stopWaitPoller(): void {
|
|
62
|
+
pollerGeneration++;
|
|
59
63
|
if (pollerTimeout !== null) {
|
|
60
64
|
clearTimeout(pollerTimeout);
|
|
61
65
|
pollerTimeout = null;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { WEBHOOK_FILTER_PRESETS, WebhookDeliveryFilterSchema } from "../types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Delivery filter for a webhook trigger.
|
|
5
|
+
*
|
|
6
|
+
* Runs only after signature verification, and a miss must not persist a run.
|
|
7
|
+
* Clauses are AND-ed. `events` / `eventHeader` are a deprecated alias that
|
|
8
|
+
* compiles to one clause (a header, or JSON body `type` for the
|
|
9
|
+
* standard-webhooks preset). `filter` adds header and body clauses.
|
|
10
|
+
* The first miss is the skip reason.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export type WebhookHeaderBag = Record<string, string | string[] | undefined>;
|
|
14
|
+
|
|
15
|
+
export const WEBHOOK_FILTER_INVALID_MESSAGE = "Webhook trigger filter is invalid";
|
|
16
|
+
export const WEBHOOK_PRESET_INVALID_MESSAGE = "Webhook trigger preset is invalid";
|
|
17
|
+
export const WEBHOOK_EVENTS_INVALID_MESSAGE = "Webhook trigger events allowlist is invalid";
|
|
18
|
+
export const WEBHOOK_EVENT_HEADER_INVALID_MESSAGE = "Webhook trigger eventHeader is invalid";
|
|
19
|
+
|
|
20
|
+
type FilterScalar = string | number | boolean | null;
|
|
21
|
+
type PresetName = (typeof WEBHOOK_FILTER_PRESETS)[number];
|
|
22
|
+
|
|
23
|
+
type EventSource = { source: "header" | "body"; path: string };
|
|
24
|
+
|
|
25
|
+
const EVENT_SOURCES: Record<PresetName, EventSource> = {
|
|
26
|
+
github: { source: "header", path: "X-GitHub-Event" },
|
|
27
|
+
gitlab: { source: "header", path: "X-Gitlab-Event" },
|
|
28
|
+
"standard-webhooks": { source: "body", path: "type" },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type Clause = EventSource & {
|
|
32
|
+
allowed: readonly FilterScalar[];
|
|
33
|
+
origin: "events" | "filter";
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type WebhookDeliverySkip =
|
|
37
|
+
| { skipped: true; reason: "event-not-allowed"; event: string | null }
|
|
38
|
+
| {
|
|
39
|
+
skipped: true;
|
|
40
|
+
reason: "filter-not-matched";
|
|
41
|
+
match: { source: "header" | "body"; path: string };
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type WebhookDeliveryDecision =
|
|
45
|
+
| { action: "allow" }
|
|
46
|
+
| { action: "skip"; skip: WebhookDeliverySkip }
|
|
47
|
+
| { action: "invalid"; message: string };
|
|
48
|
+
|
|
49
|
+
type DeliveryTrigger = {
|
|
50
|
+
events?: unknown;
|
|
51
|
+
eventHeader?: unknown;
|
|
52
|
+
preset?: unknown;
|
|
53
|
+
filter?: unknown;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** Case-insensitive header name. The first value wins when a header is repeated. */
|
|
57
|
+
function headerValue(headers: WebhookHeaderBag, name: string): string | undefined {
|
|
58
|
+
const target = name.toLowerCase();
|
|
59
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
60
|
+
if (key.toLowerCase() !== target) continue;
|
|
61
|
+
const first = Array.isArray(value) ? value[0] : value;
|
|
62
|
+
return typeof first === "string" ? first : undefined;
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function isPreset(value: unknown): value is PresetName {
|
|
68
|
+
return typeof value === "string" && (WEBHOOK_FILTER_PRESETS as readonly string[]).includes(value);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function listed(value: FilterScalar | readonly FilterScalar[]): readonly FilterScalar[] {
|
|
72
|
+
if (
|
|
73
|
+
typeof value === "string" ||
|
|
74
|
+
typeof value === "number" ||
|
|
75
|
+
typeof value === "boolean" ||
|
|
76
|
+
value === null
|
|
77
|
+
) {
|
|
78
|
+
return [value];
|
|
79
|
+
}
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function valueAllowed(value: unknown, allowed: readonly FilterScalar[]): boolean {
|
|
84
|
+
return allowed.some((candidate) => Object.is(candidate, value));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Dot path. A numeric segment indexes an array (`commits.0.id`, no leading
|
|
89
|
+
* zeros) and is an ordinary key on an object. Inherited properties do not match.
|
|
90
|
+
*/
|
|
91
|
+
function readBodyPath(
|
|
92
|
+
body: unknown,
|
|
93
|
+
path: string,
|
|
94
|
+
): { found: true; value: unknown } | { found: false } {
|
|
95
|
+
let current: unknown = body;
|
|
96
|
+
for (const segment of path.split(".")) {
|
|
97
|
+
if (Array.isArray(current)) {
|
|
98
|
+
if (!/^(0|[1-9]\d*)$/.test(segment) || !Object.hasOwn(current, segment)) {
|
|
99
|
+
return { found: false };
|
|
100
|
+
}
|
|
101
|
+
current = current[Number(segment)];
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (current === null || typeof current !== "object") return { found: false };
|
|
105
|
+
if (!Object.hasOwn(current, segment)) return { found: false };
|
|
106
|
+
current = (current as Record<string, unknown>)[segment];
|
|
107
|
+
}
|
|
108
|
+
return { found: true, value: current };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function clauseMatches(clause: Clause, headers: WebhookHeaderBag, body: unknown): boolean {
|
|
112
|
+
if (clause.source === "header") {
|
|
113
|
+
return valueAllowed(headerValue(headers, clause.path), clause.allowed);
|
|
114
|
+
}
|
|
115
|
+
const read = readBodyPath(body, clause.path);
|
|
116
|
+
return read.found && valueAllowed(read.value, clause.allowed);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function observedEvent(clause: Clause, headers: WebhookHeaderBag, body: unknown): string | null {
|
|
120
|
+
if (clause.source === "header") return headerValue(headers, clause.path) ?? null;
|
|
121
|
+
const read = readBodyPath(body, clause.path);
|
|
122
|
+
return read.found && typeof read.value === "string" ? read.value : null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function invalid(message: string): WebhookDeliveryDecision {
|
|
126
|
+
return { action: "invalid", message };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Decide whether a verified delivery may start a run.
|
|
131
|
+
* `body` is the parsed JSON value, or the raw payload when it is not JSON.
|
|
132
|
+
*/
|
|
133
|
+
export function decideWebhookDelivery(
|
|
134
|
+
trigger: DeliveryTrigger,
|
|
135
|
+
headers: WebhookHeaderBag,
|
|
136
|
+
body: unknown,
|
|
137
|
+
): WebhookDeliveryDecision {
|
|
138
|
+
if (trigger.preset !== undefined && !isPreset(trigger.preset)) {
|
|
139
|
+
return invalid(WEBHOOK_PRESET_INVALID_MESSAGE);
|
|
140
|
+
}
|
|
141
|
+
if (
|
|
142
|
+
trigger.eventHeader !== undefined &&
|
|
143
|
+
(typeof trigger.eventHeader !== "string" || trigger.eventHeader.length === 0)
|
|
144
|
+
) {
|
|
145
|
+
return invalid(WEBHOOK_EVENT_HEADER_INVALID_MESSAGE);
|
|
146
|
+
}
|
|
147
|
+
if (trigger.events != null) {
|
|
148
|
+
if (
|
|
149
|
+
!Array.isArray(trigger.events) ||
|
|
150
|
+
trigger.events.some((event) => typeof event !== "string")
|
|
151
|
+
) {
|
|
152
|
+
return invalid(WEBHOOK_EVENTS_INVALID_MESSAGE);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const clauses: Clause[] = [];
|
|
157
|
+
const events = Array.isArray(trigger.events) ? (trigger.events as string[]) : [];
|
|
158
|
+
if (events.length > 0) {
|
|
159
|
+
const preset: PresetName = isPreset(trigger.preset) ? trigger.preset : "github";
|
|
160
|
+
const source: EventSource =
|
|
161
|
+
typeof trigger.eventHeader === "string"
|
|
162
|
+
? { source: "header", path: trigger.eventHeader }
|
|
163
|
+
: EVENT_SOURCES[preset];
|
|
164
|
+
clauses.push({ ...source, allowed: events, origin: "events" });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// `null` is a stored JSON value, not an omitted filter. Rows are loaded
|
|
168
|
+
// without re-validating the trigger, so a null filter must fail closed.
|
|
169
|
+
if (trigger.filter !== undefined) {
|
|
170
|
+
const parsed = WebhookDeliveryFilterSchema.safeParse(trigger.filter);
|
|
171
|
+
if (!parsed.success) return invalid(WEBHOOK_FILTER_INVALID_MESSAGE);
|
|
172
|
+
for (const [name, allowed] of Object.entries(parsed.data.headers ?? {})) {
|
|
173
|
+
clauses.push({ source: "header", path: name, allowed: listed(allowed), origin: "filter" });
|
|
174
|
+
}
|
|
175
|
+
for (const [path, allowed] of Object.entries(parsed.data.body ?? {})) {
|
|
176
|
+
clauses.push({ source: "body", path, allowed: listed(allowed), origin: "filter" });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
for (const clause of clauses) {
|
|
181
|
+
if (clauseMatches(clause, headers, body)) continue;
|
|
182
|
+
if (clause.origin === "events") {
|
|
183
|
+
return {
|
|
184
|
+
action: "skip",
|
|
185
|
+
skip: {
|
|
186
|
+
skipped: true,
|
|
187
|
+
reason: "event-not-allowed",
|
|
188
|
+
event: observedEvent(clause, headers, body),
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
action: "skip",
|
|
194
|
+
skip: {
|
|
195
|
+
skipped: true,
|
|
196
|
+
reason: "filter-not-matched",
|
|
197
|
+
match: { source: clause.source, path: clause.path },
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return { action: "allow" };
|
|
203
|
+
}
|
|
@@ -263,7 +263,13 @@ const shortcode = (raw: string): string | null => {
|
|
|
263
263
|
|
|
264
264
|
/** The acceptance reactions the engine may have put on the message, deduplicated. */
|
|
265
265
|
export const acceptanceReactions = (): string[] => [
|
|
266
|
-
...new Set(
|
|
266
|
+
...new Set(
|
|
267
|
+
ACCEPTANCE_REACTIONS.flatMap(([key, fallback]) => {
|
|
268
|
+
const raw = process.env[key];
|
|
269
|
+
if (raw !== undefined && raw.trim() === "") return [];
|
|
270
|
+
return [shortcode(raw ?? "") ?? fallback];
|
|
271
|
+
}),
|
|
272
|
+
),
|
|
267
273
|
];
|
|
268
274
|
|
|
269
275
|
const slackCall = async (
|
|
@@ -405,9 +411,7 @@ export const askModel = async (
|
|
|
405
411
|
} | null;
|
|
406
412
|
if (res?.success === false || body?.success === false) {
|
|
407
413
|
const why = `${target.provider}: ${String(body?.message ?? body?.error ?? `HTTP ${res?.status}`).slice(0, 200)}`;
|
|
408
|
-
throw body?.providerUnavailable === true
|
|
409
|
-
? new ProviderUnavailableError(why)
|
|
410
|
-
: new Error(why);
|
|
414
|
+
throw body?.providerUnavailable === true ? new ProviderUnavailableError(why) : new Error(why);
|
|
411
415
|
}
|
|
412
416
|
const answer = body?.answers?.reason;
|
|
413
417
|
const reason = typeof answer?.choice === "string" ? answer.choice : "";
|
|
@@ -63,6 +63,7 @@ Fetch the page as markdown: `curl -fsSL https://docs.agent-swarm.dev/llms.mdx/do
|
|
|
63
63
|
- [Choosing an AI operating model](https://docs.agent-swarm.dev/docs/guides/choosing-an-ai-operating-model). Reference.
|
|
64
64
|
- [Small tech team operating model](https://docs.agent-swarm.dev/docs/guides/small-tech-team-operating-model). Reference.
|
|
65
65
|
- [Customer renewal review](https://docs.agent-swarm.dev/docs/guides/customer-renewal-review). Reference.
|
|
66
|
+
- [Reviewing supplier invoice and purchase order discrepancies with AI agents](https://docs.agent-swarm.dev/docs/guides/ai-invoice-discrepancy-review). Reference.
|
|
66
67
|
- [Deployment Guide](https://docs.agent-swarm.dev/docs/guides/deployment). When: Someone wants to run Agent Swarm on their own server with Docker Compose.
|
|
67
68
|
- [One-click deploy](https://docs.agent-swarm.dev/docs/guides/one-click-deploy). When: Someone has no server yet and wants Agent Swarm running in the cloud with HTTPS.
|
|
68
69
|
- [Kubernetes and Helm](https://docs.agent-swarm.dev/docs/guides/kubernetes). When: Someone wants to install Agent Swarm on Kubernetes.
|
|
@@ -81,6 +82,7 @@ Fetch the page as markdown: `curl -fsSL https://docs.agent-swarm.dev/llms.mdx/do
|
|
|
81
82
|
- [Provider Capability Matrix](https://docs.agent-swarm.dev/docs/guides/provider-capability-matrix). Reference.
|
|
82
83
|
- [Adding a Harness Provider](https://docs.agent-swarm.dev/docs/guides/harness-providers). Reference.
|
|
83
84
|
- [Steer a Running Task](https://docs.agent-swarm.dev/docs/guides/task-steering). Reference.
|
|
85
|
+
- [MCP Events on the User MCP](https://docs.agent-swarm.dev/docs/guides/mcp-events). Reference.
|
|
84
86
|
- [Claude Code Mod](https://docs.agent-swarm.dev/docs/guides/claude-code-mod). Reference.
|
|
85
87
|
- [Observability with OpenTelemetry](https://docs.agent-swarm.dev/docs/guides/observability-opentelemetry). When: Someone wants swarm traces and metrics in SigNoz or another OpenTelemetry backend.
|
|
86
88
|
- [Host Requirements & Disk Cleanup](https://docs.agent-swarm.dev/docs/guides/host-requirements). When: Someone asks how big a host their self-hosted swarm needs, or their disk is filling up with Docker images.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ACPAdapter2
|
|
3
|
-
} from "./cli-k3q2va86.js";
|
|
4
|
-
import"./cli-01k6wpr9.js";
|
|
5
|
-
import"./cli-s1khw52h.js";
|
|
6
|
-
import"./cli-tr27kwyg.js";
|
|
7
|
-
import"./cli-3caf7pmg.js";
|
|
8
|
-
import"./cli-x40a0w9j.js";
|
|
9
|
-
import"./cli-md50mj0r.js";
|
|
10
|
-
import"./cli-0726awxw.js";
|
|
11
|
-
import"./cli-7mv4h3sn.js";
|
|
12
|
-
import"./cli-fcfbct2j.js";
|
|
13
|
-
import"./cli-5gpqgs8b.js";
|
|
14
|
-
export {
|
|
15
|
-
ACPAdapter2 as ACPAdapter
|
|
16
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
checkFxCredentials2,
|
|
3
|
-
FxAdapter2
|
|
4
|
-
} from "./cli-qx4f057j.js";
|
|
5
|
-
import"./cli-k3q2va86.js";
|
|
6
|
-
import"./cli-01k6wpr9.js";
|
|
7
|
-
import"./cli-s1khw52h.js";
|
|
8
|
-
import"./cli-tr27kwyg.js";
|
|
9
|
-
import"./cli-3caf7pmg.js";
|
|
10
|
-
import"./cli-x40a0w9j.js";
|
|
11
|
-
import"./cli-md50mj0r.js";
|
|
12
|
-
import"./cli-0726awxw.js";
|
|
13
|
-
import"./cli-7mv4h3sn.js";
|
|
14
|
-
import"./cli-fcfbct2j.js";
|
|
15
|
-
import"./cli-5gpqgs8b.js";
|
|
16
|
-
export {
|
|
17
|
-
FxAdapter2 as FxAdapter,
|
|
18
|
-
checkFxCredentials2 as checkFxCredentials
|
|
19
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
checkGrokCredentials2,
|
|
3
|
-
GrokAdapter2
|
|
4
|
-
} from "./cli-zk7v5s89.js";
|
|
5
|
-
import"./cli-k3q2va86.js";
|
|
6
|
-
import"./cli-01k6wpr9.js";
|
|
7
|
-
import"./cli-s1khw52h.js";
|
|
8
|
-
import"./cli-tr27kwyg.js";
|
|
9
|
-
import"./cli-3caf7pmg.js";
|
|
10
|
-
import"./cli-x40a0w9j.js";
|
|
11
|
-
import"./cli-md50mj0r.js";
|
|
12
|
-
import"./cli-0726awxw.js";
|
|
13
|
-
import"./cli-7mv4h3sn.js";
|
|
14
|
-
import"./cli-fcfbct2j.js";
|
|
15
|
-
import"./cli-5gpqgs8b.js";
|
|
16
|
-
export {
|
|
17
|
-
GrokAdapter2 as GrokAdapter,
|
|
18
|
-
checkGrokCredentials2 as checkGrokCredentials
|
|
19
|
-
};
|