@desplega.ai/agent-swarm 2.9.1 → 2.10.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-bht22g3k.js +16 -0
- package/dist/{acp-targets-ny75x1qy.js → acp-targets-arrwv4f0.js} +6 -6
- package/dist/{actions-b9qgrmeq.js → actions-y0d2n1c2.js} +49 -28
- package/dist/{agent-fs-provision-b5dhdsbd.js → agent-fs-provision-tpj7sktd.js} +4 -4
- package/dist/{amp-adapter-vtax2c9s.js → amp-adapter-vmmnmw8d.js} +1 -1
- package/dist/{anthropic-messages-r5xf5hqw.js → anthropic-messages-zdca3gv1.js} +13 -13
- package/dist/{app-g2z15hax.js → app-wb7w45dq.js} +3 -3
- package/dist/{approval-notifications-yt13wp8r.js → approval-notifications-7mqr6vbd.js} +5 -5
- package/dist/{assistant-2cgfxsgk.js → assistant-gf60454p.js} +19 -19
- package/dist/{boot-args-schema-3gwy0f60.js → boot-args-schema-qxmd59sr.js} +1 -1
- package/dist/{boot-reembed-mywmyp4s.js → boot-reembed-5tmeskj2.js} +1 -1
- package/dist/{boot-reembed-92g7s5zp.js → boot-reembed-wb44vc3s.js} +1 -1
- package/dist/boot-scrub-sweep-25bxhnw4.js +9 -0
- package/dist/{boot-seeds-ce7rvgq1.js → boot-seeds-nj9za0vk.js} +4 -4
- package/dist/{claude-adapter-3m4q7735.js → claude-adapter-d3krpdyb.js} +5 -5
- package/dist/{claude-managed-setup-c217draw.js → claude-managed-setup-7y4pwd81.js} +1 -1
- package/dist/{claude-sdk-session-7fbqm51z.js → claude-sdk-session-d138zy0e.js} +5 -5
- package/dist/{cli-tvc4jag9.js → cli-01k6wpr9.js} +3 -3
- package/dist/{cli-2xs8tsf7.js → cli-124ntmf0.js} +42 -36
- package/dist/{cli-jm0hvmz2.js → cli-2rnd5j3t.js} +1 -1
- package/dist/{cli-32djehja.js → cli-2spnz7ye.js} +8 -8
- package/dist/{cli-2dq9yv8p.js → cli-2v2zdm0a.js} +1 -1
- package/dist/{cli-fkef327x.js → cli-3caf7pmg.js} +2 -2
- package/dist/{cli-mw620q3n.js → cli-3et6fmfe.js} +1 -1
- package/dist/{cli-h9yqfzx9.js → cli-3f8zbtqa.js} +3 -3
- package/dist/{cli-mhapr559.js → cli-43evxwj4.js} +1 -1
- package/dist/{cli-pyjn0qhk.js → cli-539h29es.js} +138 -21
- package/dist/{cli-bnqncekd.js → cli-5qhfv9rw.js} +2 -2
- package/dist/{cli-p4kckx1z.js → cli-6037prsx.js} +6 -6
- package/dist/{cli-zr6qy15y.js → cli-6cwr32fe.js} +17 -17
- package/dist/{cli-1jykg0py.js → cli-7r162fxe.js} +22 -15
- package/dist/{cli-sn650d7x.js → cli-8st34zhr.js} +20 -10
- package/dist/{cli-rq5rpv6k.js → cli-91pkxres.js} +1 -1
- package/dist/{cli-m7zvgt57.js → cli-9fjr27ez.js} +10 -10
- package/dist/{cli-f8x9drqr.js → cli-aw83sr40.js} +19 -5
- package/dist/{cli-jkw6ptfw.js → cli-cc93xzes.js} +5 -5
- package/dist/{cli-gfy38pvt.js → cli-fcfbct2j.js} +5 -5
- package/dist/{cli-nafvvsp8.js → cli-fq2rr3jb.js} +5 -5
- package/dist/{boot-scrub-sweep-7dkdzqxx.js → cli-had1p04a.js} +8 -9
- package/dist/{cli-bg63qmsx.js → cli-j6te8keb.js} +4 -4
- package/dist/{cli-br0924pw.js → cli-jrbq4djp.js} +1 -1
- package/dist/{cli-kxx4k2jw.js → cli-k3q2va86.js} +2 -2
- package/dist/{cli-jaw5v1sy.js → cli-k5yewqgd.js} +3 -3
- package/dist/cli-kbtzfrxj.js +404 -0
- package/dist/{cli-td9tb872.js → cli-m9cvf7vs.js} +7 -7
- package/dist/{cli-f3jyzq4g.js → cli-md50mj0r.js} +2 -2
- package/dist/{cli-xag7btpe.js → cli-mk7c5ac4.js} +1 -1
- package/dist/cli-mys27d03.js +321 -0
- package/dist/{cli-nbt14he0.js → cli-nstkanmx.js} +5 -5
- package/dist/{cli-wn13hhdt.js → cli-nv4xsvmk.js} +4 -4
- package/dist/{cli-vyff45ve.js → cli-p0c3vtch.js} +2 -2
- package/dist/{cli-2czxfnvj.js → cli-p0n7b5rz.js} +662 -93
- package/dist/{cli-j7svy295.js → cli-q5srsxq2.js} +12 -12
- package/dist/{cli-vt89089n.js → cli-qrta34nb.js} +4 -4
- package/dist/{cli-ysvspf5e.js → cli-qx4f057j.js} +2 -2
- package/dist/{cli-zh0e5x7p.js → cli-s1khw52h.js} +11 -11
- package/dist/{cli-mkwkwq81.js → cli-s1zqk1aj.js} +18 -11
- package/dist/{cli-f9gz2vyj.js → cli-sb4426be.js} +7 -7
- package/dist/{cli-dgs10ttj.js → cli-th1dkc2v.js} +1 -1
- package/dist/{cli-3j873zxq.js → cli-tr27kwyg.js} +2 -2
- package/dist/{cli-6945ywhr.js → cli-tvgqesec.js} +6 -4
- package/dist/{cli-fjggej24.js → cli-v46zsvqk.js} +1 -1
- package/dist/{cli-67mwzr35.js → cli-v8z0yga9.js} +4 -4
- package/dist/{cli-pb2ay3sh.js → cli-vfqvrd82.js} +5 -5
- package/dist/{cli-fh97xn30.js → cli-vq2eg24x.js} +2 -2
- package/dist/{cli-v57d7fmm.js → cli-vsw91x06.js} +23 -22
- package/dist/{cli-2yjj3e31.js → cli-w1q68d8x.js} +9 -7
- package/dist/{cli-y2ewxhth.js → cli-wafmk3fn.js} +10 -10
- package/dist/{cli-ctx0b85j.js → cli-wwp1bd3n.js} +257 -101
- package/dist/{cli-bkjdknnp.js → cli-y4ccxtz5.js} +37 -5
- package/dist/{cli-w4n323t3.js → cli-y8p78ekx.js} +7 -7
- package/dist/{cli-8zh9nrew.js → cli-z0m452jr.js} +1 -1
- package/dist/{cli-mjw0yf82.js → cli-zeh2mhkg.js} +1 -1
- package/dist/{cli-jwampxxq.js → cli-zk7v5s89.js} +2 -2
- package/dist/cli.js +16 -16
- package/dist/{cloudflare-workers-ai-system-one-9y1zx3pt.js → cloudflare-workers-ai-system-one-4aysy6rh.js} +2 -2
- package/dist/{codex-adapter-n656pvb8.js → codex-adapter-exfdbj73.js} +4 -4
- package/dist/{codex-session-runner-p0fbv5y9.js → codex-session-runner-xhznc4g3.js} +4 -4
- package/dist/{commands-gwea8z5p.js → commands-d8g349v4.js} +3 -3
- package/dist/{controller-t67c3grh.js → controller-mwgdmb8y.js} +3 -3
- package/dist/{controllers-connect-ks155r0h.js → controllers-connect-5v7qx04j.js} +19 -19
- package/dist/core-sxy4epp2.js +38 -0
- package/dist/{cursor-adapter-ygwrtmkv.js → cursor-adapter-p2q5h35d.js} +1 -1
- package/dist/{db-rb2xqdb1.js → db-qpganbeb.js} +3 -3
- package/dist/{db-kpmx06s9.js → db-wcw0b2j8.js} +2 -2
- package/dist/{dispatcher-31sm0ej2.js → dispatcher-8d8s49yz.js} +17 -17
- package/dist/{dsh-adapter-qyxh0w31.js → dsh-adapter-me0twn13.js} +1 -1
- package/dist/{easter-egg-3d-00wjscn6.js → easter-egg-3d-wv7w5ty6.js} +1 -1
- package/dist/{embedding-space-qhw4g68n.js → embedding-space-e48xchqa.js} +6 -6
- package/dist/{embeddings-zdv9ke6x.js → embeddings-tgq2afbq.js} +1 -1
- package/dist/{execute-zna8wwr7.js → execute-8rhwrk7f.js} +1 -1
- package/dist/{external-channel-1ac6t56s.js → external-channel-8bt3j2pm.js} +2 -2
- package/dist/{fx-adapter-sk7n0fzc.js → fx-adapter-adtdb3jb.js} +8 -8
- package/dist/{grok-adapter-sjbcm5ew.js → grok-adapter-accnn9km.js} +8 -8
- package/dist/handlers-1x77561e.js +35 -0
- package/dist/{heartbeat-2f6z4kdx.js → heartbeat-x0056ra5.js} +20 -20
- package/dist/{hook-w1skzaqc.js → hook-a7vmn2st.js} +4 -4
- package/dist/{hook-8y0gvtp1.js → hook-mrd2ayxv.js} +5 -5
- package/dist/{http-wghxvpef.js → http-ym9c5svp.js} +676 -273
- package/dist/{index-s71ez27v.js → index-01ns1pkw.js} +1 -1
- package/dist/index-48qzcqzj.js +35 -0
- package/dist/{index-9zkchs9t.js → index-ny60jcat.js} +186 -14
- package/dist/{index-rv89fvzf.js → index-p46tvwtx.js} +21 -21
- package/dist/index-rkvaambe.js +36 -0
- package/dist/{index-8zn8nxn5.js → index-x6azjwm8.js} +1 -1
- package/dist/{index-25pvya7q.js → index-xj1mq27m.js} +17 -17
- package/dist/k8s-m56sw868.js +217 -0
- package/dist/{keepalive-sh02349h.js → keepalive-7yxg8z4c.js} +3 -3
- package/dist/lead-enzn86bz.js +74 -0
- package/dist/{maintenance-yj0dcjja.js → maintenance-6tefxmk1.js} +1 -1
- package/dist/{oauth-refresh-sweep-d9xedk66.js → oauth-refresh-sweep-70cavc3a.js} +2 -2
- package/dist/{onboard-dpgjn03r.js → onboard-fja65z08.js} +5 -5
- package/dist/{openai-decisions-q3hh60wr.js → openai-decisions-ytp6w6xh.js} +1 -1
- package/dist/{opencode-adapter-2d31cpjc.js → opencode-adapter-hakkm7yh.js} +5 -5
- package/dist/{otel-impl-1skarpfq.js → otel-impl-7zhnt6gj.js} +1 -1
- package/dist/{pending-bfmxtx0g.js → pending-h01yzpx4.js} +18 -18
- package/dist/{pi-mono-adapter-gvppnasy.js → pi-mono-adapter-f52hz743.js} +6 -6
- package/dist/{pricing-refresh-c6b325mk.js → pricing-refresh-fzxvk2zf.js} +2 -2
- package/dist/{rbac-roles-h80qbdbs.js → rbac-roles-9v6vhgbs.js} +3 -3
- package/dist/{rbac-roles-zfcx68tx.js → rbac-roles-hfgh8sba.js} +2 -2
- package/dist/{render-v2-nx20t3rb.js → render-v2-1rgspxzf.js} +3 -3
- package/dist/{resume-5ep8agan.js → resume-tqy61x24.js} +7 -7
- package/dist/{runtime-r3pj4mce.js → runtime-exkxyx5f.js} +1 -1
- package/dist/{session-access-n7p3m15b.js → session-access-3act7vt4.js} +4 -4
- package/dist/{session-source-backfill-v8mt0zwn.js → session-source-backfill-82qe7fqq.js} +2 -2
- package/dist/{setup-z1psaqhe.js → setup-ry1vfdef.js} +1 -1
- package/dist/thread-buffer-3x93yexa.js +38 -0
- package/dist/{typesafe-system-one-f2en2knd.js → typesafe-system-one-vcfj2ak8.js} +2 -2
- package/dist/user-merge-jobs-bx6bf7db.js +22 -0
- package/dist/{virtual-modules-rrbjdpxn.js → virtual-modules-s0rjzcqq.js} +3 -3
- package/dist/{work-objects-4aghh73z.js → work-objects-z2e5tv03.js} +20 -20
- package/dist/{worker-follow-up-166zmex1.js → worker-follow-up-y3xeg89w.js} +17 -17
- package/dist/worker-zfcv2wbf.js +74 -0
- package/openapi.json +1630 -388
- package/package.json +3 -3
- package/src/be/boot-seeds.ts +7 -1
- package/src/be/db/model-groups.ts +238 -0
- package/src/be/db/model-profiles.ts +26 -8
- package/src/be/db/session-costs.ts +8 -2
- package/src/be/db/tasks/read.ts +3 -2
- package/src/be/db/tasks/write.ts +2 -1
- package/src/be/db/user-references.ts +75 -0
- package/src/be/db/users/references.ts +185 -0
- package/src/be/db-client.ts +70 -19
- package/src/be/db.ts +32 -57
- package/src/be/key-window-usage.ts +1 -0
- package/src/be/memory/demotion-evidence.ts +34 -0
- package/src/be/memory/reranker.ts +34 -12
- package/src/be/memory/review-recall-filter.ts +83 -0
- package/src/be/memory/search-candidates.ts +19 -6
- package/src/be/memory/types.ts +11 -0
- package/src/be/migrations/312_task_ui_action_runs_repeatable.sql +6 -0
- package/src/be/migrations/314_model_groups.sql +85 -0
- package/src/be/migrations/318_superseded_workflow_cut_backfill.sql +22 -0
- package/src/be/migrations/319_user_fk_indexes.sql +153 -0
- package/src/be/migrations/320_session_costs_kind.sql +4 -0
- package/src/be/migrations/321_user_merge_jobs.sql +52 -0
- package/src/be/pricing-normalize.ts +2 -0
- package/src/be/rbac-roles.ts +6 -4
- package/src/be/runtime-pools/db.ts +20 -5
- package/src/be/runtime-pools/supervisor.ts +15 -1
- package/src/be/scripts/db.ts +11 -0
- package/src/be/scripts/typecheck.ts +2 -0
- package/src/be/seed-model-groups.ts +86 -0
- package/src/be/seed-model-profiles.ts +20 -13
- package/src/be/seed-scripts/catalog/dreaming-gather.ts +165 -1
- package/src/be/swarm-config-guard.ts +34 -0
- package/src/be/task-ui-spec.ts +102 -1
- package/src/be/user-merge-jobs.ts +564 -0
- package/src/be/users.ts +41 -23
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/compose-generator.ts +1 -1
- package/src/commands/onboard/env-generator.ts +1 -1
- package/src/commands/provider-credentials.ts +1 -1
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/contract.ts +15 -0
- package/src/extensions/dispatcher.ts +14 -4
- package/src/github/handlers.ts +57 -0
- package/src/github/types.ts +4 -0
- package/src/http/all-routes.ts +2 -0
- package/src/http/approval-requests.ts +5 -1
- package/src/http/auth.ts +3 -1
- package/src/http/config.ts +34 -1
- package/src/http/index.ts +13 -0
- package/src/http/memory.ts +19 -6
- package/src/http/model-groups.ts +277 -0
- package/src/http/model-profiles.ts +30 -13
- package/src/http/tasks.ts +41 -6
- package/src/http/tool-hooks.ts +140 -0
- package/src/http/users.ts +142 -19
- package/src/http/workflows.ts +19 -1
- package/src/integrations/chat-sdk/inbound.ts +8 -2
- package/src/integrations/chat-sdk/limits.ts +8 -3
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/pricing-sources.md +9 -0
- package/src/rbac/legacy-policy.ts +1 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/runtime-providers/index.ts +7 -5
- package/src/runtime-providers/k8s.ts +250 -0
- package/src/scripts-runtime/types/stdlib.d.ts +2 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +16 -1
- package/src/scripts-runtime/types/swarm-sdk.d.ts +2 -0
- package/src/slack/actions.ts +33 -10
- package/src/slack/blocks.ts +23 -2
- package/src/slack/render-v2.ts +47 -0
- package/src/tests/acp-adapter.test.ts +26 -0
- package/src/tests/chat-sdk-relay.test.ts +21 -1
- package/src/tests/check-pr-body.test.ts +43 -0
- package/src/tests/credential-check.test.ts +14 -6
- package/src/tests/db-client.test.ts +146 -0
- package/src/tests/deploy-guard.test.ts +7 -7
- package/src/tests/deploy-select.test.ts +83 -0
- package/src/tests/dreaming-gather-corrections.test.ts +467 -0
- package/src/tests/event-loop-lag.test.ts +9 -7
- package/src/tests/fixtures/extensions/native-tool-recorder/hooks.ts +26 -0
- package/src/tests/fixtures/extensions/native-tool-recorder/manifest.json +10 -0
- package/src/tests/fixtures/onboard/content.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/content.env.txt +1 -1
- package/src/tests/fixtures/onboard/dev.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/dev.env.txt +1 -1
- package/src/tests/fixtures/onboard/full-all.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/full-all.env.txt +1 -1
- package/src/tests/fixtures/onboard/full.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/full.env.txt +1 -1
- package/src/tests/fixtures/onboard/research.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/research.env.txt +1 -1
- package/src/tests/fixtures/onboard/solo.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/solo.env.txt +1 -1
- package/src/tests/github-event-filter.test.ts +8 -0
- package/src/tests/github-handlers-inline-comments.test.ts +2 -0
- package/src/tests/github-handlers-reactions.test.ts +4 -0
- package/src/tests/github-handlers.test.ts +3 -0
- package/src/tests/github-sender-trust.test.ts +223 -0
- package/src/tests/http-users.test.ts +142 -41
- package/src/tests/k8s-pool-smoke.test.ts +190 -0
- package/src/tests/key-window-usage.test.ts +15 -0
- package/src/tests/memory-rater-store.test.ts +35 -1
- package/src/tests/memory-reranker.test.ts +39 -4
- package/src/tests/memory-review-recall-filter.test.ts +205 -0
- package/src/tests/migration-318-superseded-workflow-cut-backfill.test.ts +74 -0
- package/src/tests/model-groups-api.test.ts +415 -0
- package/src/tests/model-profiles-api.test.ts +1 -0
- package/src/tests/operator-granted-credentials.test.ts +7 -2
- package/src/tests/operator-granted-role-wire.test.ts +2 -1
- package/src/tests/rbac-engine.test.ts +1 -0
- package/src/tests/runtime-k8s-pools.test.ts +142 -0
- package/src/tests/runtime-pools-db.test.ts +42 -2
- package/src/tests/runtime-pools-http.test.ts +47 -2
- package/src/tests/runtime-provider-registration.test.ts +5 -14
- package/src/tests/runtime-providers-k8s.test.ts +303 -0
- package/src/tests/script-connections.test.ts +13 -1
- package/src/tests/short-id.test.ts +23 -0
- package/src/tests/slack-blocks.test.ts +69 -0
- package/src/tests/slack-render-v2.test.ts +54 -0
- package/src/tests/spec-base-url.test.ts +13 -1
- package/src/tests/system-one-decide-session-cost.test.ts +196 -0
- package/src/tests/task-ui-action-route.test.ts +59 -1
- package/src/tests/task-ui-script-actions.test.ts +517 -0
- package/src/tests/tool-hooks-http.test.ts +187 -0
- package/src/tests/ui-spec-script-actions-config.test.ts +196 -0
- package/src/tests/user-delete-perf.test.ts +321 -0
- package/src/tests/user-merge-jobs.test.ts +680 -0
- package/src/tests/vcs-provider.test.ts +25 -5
- package/src/tests/vendored-openapi.test.ts +13 -1
- package/src/tests/workflow-agent-task-retry.test.ts +62 -0
- package/src/tests/workflow-foreach-supersede-retry.test.ts +10 -0
- package/src/tests/workflow-http-v2.test.ts +27 -0
- package/src/tests/workflow-replay.test.ts +10 -1
- package/src/tests/workflow-triggers-v2.test.ts +128 -0
- package/src/tests/workflow-wait-event.test.ts +109 -1
- package/src/tools/memory-search.ts +14 -3
- package/src/tools/store-progress.ts +26 -26
- package/src/tools/swarm-config/delete-config.ts +12 -1
- package/src/tools/swarm-config/set-config.ts +8 -0
- package/src/tools/system-one-decide.ts +113 -3
- package/src/tools/utils.ts +4 -1
- package/src/tools/workflows/create-workflow.ts +2 -0
- package/src/tools/workflows/update-workflow.ts +3 -1
- package/src/types.ts +86 -2
- package/src/ui-spec/actions.ts +30 -4
- package/src/ui-spec/schema.ts +38 -0
- package/src/ui-spec/script-actions.ts +340 -0
- package/src/ui-spec/script-allowlist.ts +48 -0
- package/src/utils/short-id.ts +20 -14
- package/src/utils/task-ui-spec.ts +16 -4
- package/src/vcs/index.ts +12 -2
- package/src/workflows/executors/system-one-decision.ts +2 -2
- package/src/workflows/resume.ts +3 -2
- package/src/workflows/task-step-routing.ts +30 -10
- package/src/workflows/triggers.ts +35 -3
- package/templates/extensions/manifest.schema.json +13 -0
- package/templates/skills/swarm-docs/content.md +2 -0
- package/templates/skills/ui-spec/content.md +7 -1
- package/templates/workflows/dreaming/content.md +1 -1
- package/dist/acp-adapter-g909b5hw.js +0 -16
- package/dist/cli-b91nz213.js +0 -93
- package/dist/handlers-yzy0c87x.js +0 -35
- package/dist/index-2t4859r5.js +0 -35
- package/dist/index-cxca2t8y.js +0 -36
- package/dist/lead-gk4h5eg7.js +0 -74
- package/dist/thread-buffer-a1re2r9r.js +0 -38
- package/dist/worker-3dyyb8ev.js +0 -74
- package/dist/{azure-openai-responses-590s1eea.js → azure-openai-responses-b3y7fz36.js} +8 -8
- package/dist/{cli-m7c2380k.js → cli-3aaeb78m.js} +4 -4
- package/dist/{cli-g0vv9dg4.js → cli-8y43jx2r.js} +8 -8
- package/dist/{cli-m0cy2vyf.js → cli-k6nejceb.js} +4 -4
- package/dist/{google-generative-ai-maq6c9bf.js → google-generative-ai-bh0djqjp.js} +4 -4
- package/dist/{google-vertex-2jgsw2nb.js → google-vertex-prjbw8dj.js} +8 -8
- package/dist/{mistral-conversations-0c30em7t.js → mistral-conversations-tm2vd4gc.js} +8 -8
- package/dist/{node-dqm4xgxw.js → node-2wfcey7d.js} +0 -0
- package/dist/{openai-codex-responses-bkcd8pjj.js → openai-codex-responses-sxjv60xx.js} +4 -4
- package/dist/{openai-completions-f3n69rep.js → openai-completions-0c7qnhsx.js} +20 -20
- package/dist/{openai-responses-gbh0wfqe.js → openai-responses-a7h29chp.js} +15 -15
- package/dist/{pi-messages-zebyt7gb.js → pi-messages-2j0fpqwq.js} +5 -5
|
@@ -11,13 +11,33 @@ describe("detectVcsProvider", () => {
|
|
|
11
11
|
expect(detectVcsProvider("desplega-ai/agent-swarm")).toBe("github");
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
test
|
|
15
|
-
|
|
14
|
+
test.each([
|
|
15
|
+
["https://github.com/acme/gitlab.client", "github"],
|
|
16
|
+
["git@github.com:acme/gitlab.client.git", "github"],
|
|
17
|
+
["acme/gitlab.js", "github"],
|
|
18
|
+
["gitlab.team/widgets", "github"],
|
|
19
|
+
["https://example.com/acme/gitlab.client", null],
|
|
20
|
+
["git@example.com:acme/gitlab.client.git", null],
|
|
21
|
+
["https://gitlab.com@example.com/acme/widgets", null],
|
|
22
|
+
["https://example.com/acme/widgets?mirror=gitlab.com", null],
|
|
23
|
+
["https://example.com/acme/widgets#gitlab.com", null],
|
|
24
|
+
["https://notgitlab.com/acme/widgets", null],
|
|
25
|
+
["https://code.gitlab.example.com/acme/widgets", null],
|
|
26
|
+
] as const)("does not classify GitLab text outside the host prefix: %s", (url, expected) => {
|
|
27
|
+
expect(detectVcsProvider(url)).toBe(expected);
|
|
16
28
|
});
|
|
17
29
|
|
|
18
|
-
test(
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
test.each([
|
|
31
|
+
"https://gitlab.com/group/project",
|
|
32
|
+
"https://gitlab.example.com/group/project",
|
|
33
|
+
"https://gitlab.internal/group/project",
|
|
34
|
+
"https://gitlab.example.com:8443/group/project.git",
|
|
35
|
+
"git@gitlab.com:acme/widgets.git",
|
|
36
|
+
"git@gitlab.example.com:group/project.git",
|
|
37
|
+
"ssh://git@gitlab.com/group/project.git",
|
|
38
|
+
"ssh://git@GITLAB.example.com:2222/group/project.git",
|
|
39
|
+
])("detects GitLab hosts in HTTPS and SSH remotes: %s", (url) => {
|
|
40
|
+
expect(detectVcsProvider(url)).toBe("gitlab");
|
|
21
41
|
});
|
|
22
42
|
|
|
23
43
|
test("detects bitbucket.org URLs in https, ssh and .git forms", () => {
|
|
@@ -270,13 +270,25 @@ describe("vendored OpenAPI", () => {
|
|
|
270
270
|
new Date().toISOString(),
|
|
271
271
|
new Bun.CryptoHasher("sha256").update(migration213).digest("hex"),
|
|
272
272
|
);
|
|
273
|
+
// 319 indexes the oauth tables that 117 creates, so it must wait for 117 too.
|
|
274
|
+
const migration319 = readFileSync("src/be/migrations/319_user_fk_indexes.sql", "utf-8");
|
|
275
|
+
database
|
|
276
|
+
.prepare(
|
|
277
|
+
"INSERT INTO _migrations (version, name, applied_at, checksum) VALUES (?, ?, ?, ?)",
|
|
278
|
+
)
|
|
279
|
+
.run(
|
|
280
|
+
319,
|
|
281
|
+
"319_user_fk_indexes",
|
|
282
|
+
new Date().toISOString(),
|
|
283
|
+
new Bun.CryptoHasher("sha256").update(migration319).digest("hex"),
|
|
284
|
+
);
|
|
273
285
|
runMigrations(database);
|
|
274
286
|
database
|
|
275
287
|
.query(
|
|
276
288
|
"INSERT INTO script_connections (id, slug, kind, openapi_spec_json) VALUES (?, ?, ?, ?)",
|
|
277
289
|
)
|
|
278
290
|
.run("legacy-row", "legacy", "openapi", "{}");
|
|
279
|
-
database.run("DELETE FROM _migrations WHERE version IN (117, 213)");
|
|
291
|
+
database.run("DELETE FROM _migrations WHERE version IN (117, 213, 319)");
|
|
280
292
|
runMigrations(database);
|
|
281
293
|
expect(
|
|
282
294
|
database.query<{ id: string }, []>("SELECT id FROM script_connections").get()?.id,
|
|
@@ -239,6 +239,10 @@ describe("agent-task node.retry on task failure", () => {
|
|
|
239
239
|
expect(JSON.stringify(finalStep.output)).toContain("[FAILED:");
|
|
240
240
|
// No third task was ever created.
|
|
241
241
|
expect((await getTaskByWorkflowRunStepId(step.id))!.id).toBe(second.id);
|
|
242
|
+
// The run went on without the step: the last cut is not a real failure.
|
|
243
|
+
const lastCut = (await getTaskById(second.id))!;
|
|
244
|
+
expect(lastCut.status).toBe("superseded");
|
|
245
|
+
expect(lastCut.failureReason).toBe("superseded_workflow_task");
|
|
242
246
|
});
|
|
243
247
|
|
|
244
248
|
test("a node without retry fails the run exactly as before on a non-supersede failure", async () => {
|
|
@@ -440,6 +444,64 @@ describe("implicit retry for a superseded task on a node without retry", () => {
|
|
|
440
444
|
});
|
|
441
445
|
});
|
|
442
446
|
|
|
447
|
+
describe("a cut the workflow carries on without", () => {
|
|
448
|
+
const NO_RETRY = { ...RETRY_ONCE, maxRetries: 0 };
|
|
449
|
+
|
|
450
|
+
test("onNodeFailure:continue moves the cut to superseded and keeps it bound", async () => {
|
|
451
|
+
const runId = await startRun({ retry: NO_RETRY, onNodeFailure: "continue" });
|
|
452
|
+
const step = await synthesizeStep(runId);
|
|
453
|
+
const cut = (await getTaskByWorkflowRunStepId(step.id))!;
|
|
454
|
+
|
|
455
|
+
await failTask(cut.id, SUPERSEDED_WORKFLOW_TASK_REASON);
|
|
456
|
+
await waitFor(async () => {
|
|
457
|
+
const r = await getWorkflowRun(runId);
|
|
458
|
+
return r?.status === "completed" ? r : null;
|
|
459
|
+
}, "run completed via onNodeFailure:continue");
|
|
460
|
+
expect((await synthesizeStep(runId)).status).toBe("completed");
|
|
461
|
+
const task = (await getTaskById(cut.id))!;
|
|
462
|
+
expect(task.status).toBe("superseded");
|
|
463
|
+
expect(task.failureReason).toBe(SUPERSEDED_WORKFLOW_TASK_REASON);
|
|
464
|
+
expect(task.workflowRunStepId).toBe(step.id);
|
|
465
|
+
// A bound cut gets no resume either.
|
|
466
|
+
const orphans = await getSupersededTasksWithoutResume(
|
|
467
|
+
new Date(Date.now() + 60_000).toISOString(),
|
|
468
|
+
new Date(0).toISOString(),
|
|
469
|
+
);
|
|
470
|
+
expect(orphans.map((t) => t.id)).not.toContain(cut.id);
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
test("the recovery sweep applies the same rule", async () => {
|
|
474
|
+
const runId = await startRun({ retry: NO_RETRY, onNodeFailure: "continue" });
|
|
475
|
+
const step = await synthesizeStep(runId);
|
|
476
|
+
const cut = (await getTaskByWorkflowRunStepId(step.id))!;
|
|
477
|
+
|
|
478
|
+
teardownResumeListener?.();
|
|
479
|
+
try {
|
|
480
|
+
await failTask(cut.id, SUPERSEDED_WORKFLOW_TASK_REASON);
|
|
481
|
+
await new Promise((r) => setTimeout(r, 20));
|
|
482
|
+
await recoverIncompleteRuns(registry);
|
|
483
|
+
} finally {
|
|
484
|
+
teardownResumeListener = setupWorkflowResumeListener(workflowEventBus, registry);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
expect((await synthesizeStep(runId)).status).toBe("completed");
|
|
488
|
+
expect((await getTaskById(cut.id))!.status).toBe("superseded");
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
test("a real failure the workflow carries on without stays failed", async () => {
|
|
492
|
+
const runId = await startRun({ onNodeFailure: "continue" });
|
|
493
|
+
const step = await synthesizeStep(runId);
|
|
494
|
+
const task = (await getTaskByWorkflowRunStepId(step.id))!;
|
|
495
|
+
|
|
496
|
+
await failTask(task.id, "agent crashed");
|
|
497
|
+
await waitFor(async () => {
|
|
498
|
+
const r = await getWorkflowRun(runId);
|
|
499
|
+
return r?.status === "completed" ? r : null;
|
|
500
|
+
}, "run completed via onNodeFailure:continue");
|
|
501
|
+
expect((await getTaskById(task.id))!.status).toBe("failed");
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
|
|
443
505
|
describe("recovery sweep holding a stale failed-task snapshot", () => {
|
|
444
506
|
/**
|
|
445
507
|
* Recovery snapshots task A as failed, then pauses. Meanwhile the live
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
createAgent,
|
|
8
8
|
createWorkflow,
|
|
9
9
|
failTask,
|
|
10
|
+
getTaskById,
|
|
10
11
|
getTaskByWorkflowRunStepId,
|
|
11
12
|
getWorkflowRun,
|
|
12
13
|
getWorkflowRunStep,
|
|
@@ -112,6 +113,13 @@ describe("supersede retry for a foreach agent-task child", () => {
|
|
|
112
113
|
expect(settled.retryCount).toBe(1);
|
|
113
114
|
expect(settled.nextRetryAt).toBeFalsy();
|
|
114
115
|
expect((await getTaskByWorkflowRunStepId(settled.id))!.id).toBe(retried.id);
|
|
116
|
+
// The fan-out carries on without the item, so neither cut is a real
|
|
117
|
+
// failure: the retried one and the last one both end superseded.
|
|
118
|
+
for (const id of [cut.id, retried.id]) {
|
|
119
|
+
const task = (await getTaskById(id))!;
|
|
120
|
+
expect(task.status).toBe("superseded");
|
|
121
|
+
expect(task.failureReason).toBe(SUPERSEDED_WORKFLOW_TASK_REASON);
|
|
122
|
+
}
|
|
115
123
|
|
|
116
124
|
await completeTask((await boundTask(runId, "fan#i1")).id, "i1 done");
|
|
117
125
|
const run = await waitForRun(runId, (r) => r.status === "completed");
|
|
@@ -146,6 +154,8 @@ describe("supersede retry for a foreach agent-task child", () => {
|
|
|
146
154
|
expect(failed.retryCount).toBe(0);
|
|
147
155
|
expect(failed.nextRetryAt).toBeFalsy();
|
|
148
156
|
expect((await getTaskByWorkflowRunStepId(failed.id))!.id).toBe(task.id);
|
|
157
|
+
// Fail-fast: the item's step failed the run, so the cut stays failed.
|
|
158
|
+
expect((await getTaskById(task.id))!.status).toBe("failed");
|
|
149
159
|
});
|
|
150
160
|
|
|
151
161
|
test("a queued item keeps its concurrency slot until the retry starts it", async () => {
|
|
@@ -1181,6 +1181,33 @@ describe("Workflow HTTP API v2", () => {
|
|
|
1181
1181
|
});
|
|
1182
1182
|
expect(res.status).toBe(401);
|
|
1183
1183
|
});
|
|
1184
|
+
|
|
1185
|
+
test("event not in the trigger's events allowlist returns 200 skipped", async () => {
|
|
1186
|
+
const workflow = await createTestWorkflow({
|
|
1187
|
+
triggers: [
|
|
1188
|
+
{ type: "webhook", hmacSecret: "example-test-secret", events: ["pull_request"] },
|
|
1189
|
+
],
|
|
1190
|
+
});
|
|
1191
|
+
|
|
1192
|
+
const body = '{"zen":"ok"}';
|
|
1193
|
+
const sig = `sha256=${crypto.createHmac("sha256", "example-test-secret").update(body).digest("hex")}`;
|
|
1194
|
+
|
|
1195
|
+
const res = await fetch(`${baseUrl}/api/webhooks/${workflow.id}`, {
|
|
1196
|
+
method: "POST",
|
|
1197
|
+
headers: {
|
|
1198
|
+
"Content-Type": "application/json",
|
|
1199
|
+
"X-Hub-Signature-256": sig,
|
|
1200
|
+
"X-GitHub-Event": "ping",
|
|
1201
|
+
},
|
|
1202
|
+
body,
|
|
1203
|
+
});
|
|
1204
|
+
expect(res.status).toBe(200);
|
|
1205
|
+
expect(await res.json()).toEqual({
|
|
1206
|
+
skipped: true,
|
|
1207
|
+
reason: "event-not-allowed",
|
|
1208
|
+
event: "ping",
|
|
1209
|
+
});
|
|
1210
|
+
});
|
|
1184
1211
|
});
|
|
1185
1212
|
|
|
1186
1213
|
// ─── VERSION HISTORY ──────────────────────────────────────
|
|
@@ -477,8 +477,17 @@ describe("writers that rewrite replay state", () => {
|
|
|
477
477
|
const workflow = await newWorkflow();
|
|
478
478
|
const user = await createUser({ name: "replay requester" });
|
|
479
479
|
const replacement = await createUser({ name: "replay replacement" });
|
|
480
|
-
|
|
480
|
+
// The engine writes created_by and context.swarm.requestedByUserId from
|
|
481
|
+
// the same requester; deleteUser narrows its JSON pass by created_by.
|
|
482
|
+
const runId = crypto.randomUUID();
|
|
483
|
+
await createWorkflowRun({
|
|
484
|
+
id: runId,
|
|
485
|
+
workflowId: workflow.id,
|
|
486
|
+
triggerType: "manual",
|
|
487
|
+
createdBy: user.id,
|
|
488
|
+
});
|
|
481
489
|
await updateWorkflowRun(runId, {
|
|
490
|
+
status: "running",
|
|
482
491
|
context: { swarm: { requestedByUserId: user.id }, input: { key: secret.value } },
|
|
483
492
|
});
|
|
484
493
|
expect(await deleteUser(user.id, replacement.id)).toBe(true);
|
|
@@ -4,7 +4,9 @@ import { unlink } from "node:fs/promises";
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import {
|
|
6
6
|
closeDb,
|
|
7
|
+
countWorkflowRuns,
|
|
7
8
|
createWorkflow,
|
|
9
|
+
getDb,
|
|
8
10
|
getWorkflowRun,
|
|
9
11
|
initDb,
|
|
10
12
|
updateWorkflow,
|
|
@@ -661,6 +663,132 @@ describe("handleWebhookTrigger — custom hmacHeader", () => {
|
|
|
661
663
|
});
|
|
662
664
|
});
|
|
663
665
|
|
|
666
|
+
describe("handleWebhookTrigger — events allowlist", () => {
|
|
667
|
+
const secret = "example-github-org-secret";
|
|
668
|
+
const body = '{"action":"opened"}';
|
|
669
|
+
const sig = `sha256=${crypto.createHmac("sha256", secret).update(body).digest("hex")}`;
|
|
670
|
+
|
|
671
|
+
function countStepRows(): number {
|
|
672
|
+
return (getDb().prepare("SELECT COUNT(*) AS n FROM workflow_run_steps").get() as { n: number })
|
|
673
|
+
.n;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
test("allowed event starts a run", async () => {
|
|
677
|
+
const workflow = await makeWorkflow({
|
|
678
|
+
triggers: [{ type: "webhook", hmacSecret: secret, events: ["pull_request"] }],
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
const result = await handleWebhookTrigger(
|
|
682
|
+
workflow.id,
|
|
683
|
+
body,
|
|
684
|
+
{ "x-hub-signature-256": sig, "X-GitHub-Event": "pull_request" },
|
|
685
|
+
registry,
|
|
686
|
+
);
|
|
687
|
+
|
|
688
|
+
expect(result.skipped).toBeUndefined();
|
|
689
|
+
expect(await getWorkflowRun(result.runId!)).not.toBeNull();
|
|
690
|
+
expect(await countWorkflowRuns(workflow.id)).toBe(1);
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
test("non-allowed event returns skipped and writes no run or step rows", async () => {
|
|
694
|
+
const workflow = await makeWorkflow({
|
|
695
|
+
triggers: [{ type: "webhook", hmacSecret: secret, events: ["pull_request"] }],
|
|
696
|
+
});
|
|
697
|
+
const stepsBefore = countStepRows();
|
|
698
|
+
|
|
699
|
+
const result = await handleWebhookTrigger(
|
|
700
|
+
workflow.id,
|
|
701
|
+
body,
|
|
702
|
+
{ "x-hub-signature-256": sig, "x-github-event": "workflow_job" },
|
|
703
|
+
registry,
|
|
704
|
+
);
|
|
705
|
+
|
|
706
|
+
expect(result).toEqual({ skipped: true, reason: "event-not-allowed", event: "workflow_job" });
|
|
707
|
+
expect(await countWorkflowRuns(workflow.id)).toBe(0);
|
|
708
|
+
expect(countStepRows()).toBe(stepsBefore);
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
test("missing event header is dropped when events is set", async () => {
|
|
712
|
+
const workflow = await makeWorkflow({
|
|
713
|
+
triggers: [{ type: "webhook", hmacSecret: secret, events: ["pull_request"] }],
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
const result = await handleWebhookTrigger(
|
|
717
|
+
workflow.id,
|
|
718
|
+
body,
|
|
719
|
+
{ "x-hub-signature-256": sig },
|
|
720
|
+
registry,
|
|
721
|
+
);
|
|
722
|
+
|
|
723
|
+
expect(result).toEqual({ skipped: true, reason: "event-not-allowed", event: null });
|
|
724
|
+
expect(await countWorkflowRuns(workflow.id)).toBe(0);
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
test("no events field (or an empty one) keeps every event", async () => {
|
|
728
|
+
for (const trigger of [
|
|
729
|
+
{ type: "webhook" as const, hmacSecret: secret },
|
|
730
|
+
{ type: "webhook" as const, hmacSecret: secret, events: [] },
|
|
731
|
+
]) {
|
|
732
|
+
const workflow = await makeWorkflow({ triggers: [trigger] });
|
|
733
|
+
const result = await handleWebhookTrigger(
|
|
734
|
+
workflow.id,
|
|
735
|
+
body,
|
|
736
|
+
{ "x-hub-signature-256": sig, "x-github-event": "workflow_job" },
|
|
737
|
+
registry,
|
|
738
|
+
);
|
|
739
|
+
expect(result.skipped).toBeUndefined();
|
|
740
|
+
expect(await countWorkflowRuns(workflow.id)).toBe(1);
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
test("custom eventHeader is read case-insensitively", async () => {
|
|
745
|
+
const workflow = await makeWorkflow({
|
|
746
|
+
triggers: [
|
|
747
|
+
{
|
|
748
|
+
type: "webhook",
|
|
749
|
+
hmacSecret: secret,
|
|
750
|
+
events: ["Merge Request Hook"],
|
|
751
|
+
eventHeader: "X-Gitlab-Event",
|
|
752
|
+
},
|
|
753
|
+
],
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
const allowed = await handleWebhookTrigger(
|
|
757
|
+
workflow.id,
|
|
758
|
+
body,
|
|
759
|
+
{ "x-hub-signature-256": sig, "x-gitlab-event": "Merge Request Hook" },
|
|
760
|
+
registry,
|
|
761
|
+
);
|
|
762
|
+
expect(allowed.skipped).toBeUndefined();
|
|
763
|
+
|
|
764
|
+
// The default GitHub header is not consulted once eventHeader is set.
|
|
765
|
+
const dropped = await handleWebhookTrigger(
|
|
766
|
+
workflow.id,
|
|
767
|
+
body,
|
|
768
|
+
{ "x-hub-signature-256": sig, "x-github-event": "Merge Request Hook" },
|
|
769
|
+
registry,
|
|
770
|
+
);
|
|
771
|
+
expect(dropped.skipped).toBe(true);
|
|
772
|
+
});
|
|
773
|
+
|
|
774
|
+
test("bad signature on a non-allowed event is still 401", async () => {
|
|
775
|
+
const workflow = await makeWorkflow({
|
|
776
|
+
triggers: [{ type: "webhook", hmacSecret: secret, events: ["pull_request"] }],
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
const err = await handleWebhookTrigger(
|
|
780
|
+
workflow.id,
|
|
781
|
+
body,
|
|
782
|
+
{ "x-hub-signature-256": "sha256=invalid", "x-github-event": "workflow_job" },
|
|
783
|
+
registry,
|
|
784
|
+
).catch((e: unknown) => e);
|
|
785
|
+
|
|
786
|
+
expect(err).toBeInstanceOf(WebhookError);
|
|
787
|
+
expect((err as WebhookError).statusCode).toBe(401);
|
|
788
|
+
expect(await countWorkflowRuns(workflow.id)).toBe(0);
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
|
|
664
792
|
describe("handleWebhookTrigger — verification formats", () => {
|
|
665
793
|
function signTimestamped(secret: string, body: string, timestamp: number): string {
|
|
666
794
|
return crypto.createHmac("sha256", secret).update(`${timestamp}.${body}`).digest("hex");
|
|
@@ -11,8 +11,9 @@ import {
|
|
|
11
11
|
getWorkflowRunStepsByRunId,
|
|
12
12
|
initDb,
|
|
13
13
|
} from "../be/db";
|
|
14
|
+
import { realtimeBus } from "../realtime/bus";
|
|
14
15
|
import type { Workflow, WorkflowDefinition } from "../types";
|
|
15
|
-
import { startWorkflowExecution } from "../workflows/engine";
|
|
16
|
+
import { isWorkflowRunActive, startWorkflowExecution } from "../workflows/engine";
|
|
16
17
|
import { workflowEventBus } from "../workflows/event-bus";
|
|
17
18
|
import type { ExecutorDependencies } from "../workflows/executors/base";
|
|
18
19
|
import { createExecutorRegistry } from "../workflows/executors/registry";
|
|
@@ -136,6 +137,113 @@ describe("WaitExecutor — event mode end-to-end", () => {
|
|
|
136
137
|
expect(doneStep?.status).toBe("completed");
|
|
137
138
|
});
|
|
138
139
|
|
|
140
|
+
test("looped event wait keeps its subscription across successive signals", async () => {
|
|
141
|
+
const registry = createExecutorRegistry(deps);
|
|
142
|
+
const eventName = "loop.signal";
|
|
143
|
+
const wf = await makeWorkflow("wait-event-loop", {
|
|
144
|
+
nodes: [
|
|
145
|
+
{
|
|
146
|
+
id: "start",
|
|
147
|
+
type: "notify",
|
|
148
|
+
config: { channel: "swarm", template: "start" },
|
|
149
|
+
next: "wait",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "wait",
|
|
153
|
+
type: "wait",
|
|
154
|
+
config: { mode: "event", eventName, scope: "global" },
|
|
155
|
+
next: { event: "check" },
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: "check",
|
|
159
|
+
type: "property-match",
|
|
160
|
+
config: { conditions: [{ field: "wait.payload.done", op: "eq", value: true }] },
|
|
161
|
+
next: { true: "done", false: "wait" },
|
|
162
|
+
},
|
|
163
|
+
{ id: "done", type: "notify", config: { channel: "swarm", template: "done" } },
|
|
164
|
+
],
|
|
165
|
+
});
|
|
166
|
+
const runId = await startWorkflowExecution(wf, {}, registry);
|
|
167
|
+
await initWaitBusSubscriptions(registry);
|
|
168
|
+
|
|
169
|
+
for (let sequence = 1; sequence <= 3; sequence++) {
|
|
170
|
+
const steps = await getWorkflowRunStepsByRunId(runId);
|
|
171
|
+
const waiting = steps.filter((s) => s.nodeId === "wait" && s.status === "waiting");
|
|
172
|
+
expect(waiting).toHaveLength(1);
|
|
173
|
+
expect((await getWaitStateByStepId(waiting[0]!.id))?.status).toBe("pending");
|
|
174
|
+
|
|
175
|
+
const payload = { sequence, done: sequence === 3 };
|
|
176
|
+
workflowEventBus.emit(eventName, payload);
|
|
177
|
+
await waitFor(async () => {
|
|
178
|
+
const current = await getWorkflowRunStepsByRunId(runId);
|
|
179
|
+
return (
|
|
180
|
+
current.filter((s) => s.nodeId === "wait" && s.status === "completed").length ===
|
|
181
|
+
sequence && !isWorkflowRunActive(runId)
|
|
182
|
+
);
|
|
183
|
+
});
|
|
184
|
+
// Let the fire-and-forget bus handler finish its cleanup after walkGraph returns.
|
|
185
|
+
await new Promise<void>((resolve) => setImmediate(resolve));
|
|
186
|
+
|
|
187
|
+
const fired = await getWaitStateByStepId(waiting[0]!.id);
|
|
188
|
+
expect(fired?.status).toBe("fired");
|
|
189
|
+
expect(fired?.firedPayload).toEqual(payload);
|
|
190
|
+
expect((await getWorkflowRun(runId))?.status).toBe(sequence === 3 ? "completed" : "waiting");
|
|
191
|
+
expect(realtimeBus.subscriberCount(`workflow:${eventName}`)).toBe(sequence === 3 ? 0 : 1);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test("consecutive waits for the same event each receive a separate signal", async () => {
|
|
196
|
+
const registry = createExecutorRegistry(deps);
|
|
197
|
+
const eventName = "consecutive.signal";
|
|
198
|
+
const wf = await makeWorkflow("wait-event-consecutive", {
|
|
199
|
+
nodes: [
|
|
200
|
+
{
|
|
201
|
+
id: "first",
|
|
202
|
+
type: "wait",
|
|
203
|
+
config: { mode: "event", eventName },
|
|
204
|
+
next: { event: "second" },
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
id: "second",
|
|
208
|
+
type: "wait",
|
|
209
|
+
config: { mode: "event", eventName },
|
|
210
|
+
next: { event: "done" },
|
|
211
|
+
},
|
|
212
|
+
{ id: "done", type: "notify", config: { channel: "swarm", template: "done" } },
|
|
213
|
+
],
|
|
214
|
+
});
|
|
215
|
+
const runId = await startWorkflowExecution(wf, {}, registry);
|
|
216
|
+
await initWaitBusSubscriptions(registry);
|
|
217
|
+
|
|
218
|
+
workflowEventBus.emit(eventName, { _runId: runId, sequence: 1 });
|
|
219
|
+
await waitFor(async () => {
|
|
220
|
+
const steps = await getWorkflowRunStepsByRunId(runId);
|
|
221
|
+
return (
|
|
222
|
+
steps.some((s) => s.nodeId === "second" && s.status === "waiting") &&
|
|
223
|
+
!isWorkflowRunActive(runId)
|
|
224
|
+
);
|
|
225
|
+
});
|
|
226
|
+
await new Promise<void>((resolve) => setImmediate(resolve));
|
|
227
|
+
|
|
228
|
+
const steps = await getWorkflowRunStepsByRunId(runId);
|
|
229
|
+
const first = steps.find((s) => s.nodeId === "first")!;
|
|
230
|
+
const second = steps.find((s) => s.nodeId === "second")!;
|
|
231
|
+
expect((await getWaitStateByStepId(first.id))?.firedPayload).toEqual({
|
|
232
|
+
_runId: runId,
|
|
233
|
+
sequence: 1,
|
|
234
|
+
});
|
|
235
|
+
expect((await getWaitStateByStepId(second.id))?.status).toBe("pending");
|
|
236
|
+
expect(realtimeBus.subscriberCount(`workflow:${eventName}`)).toBe(1);
|
|
237
|
+
|
|
238
|
+
workflowEventBus.emit(eventName, { _runId: runId, sequence: 2 });
|
|
239
|
+
await waitFor(async () => (await getWorkflowRun(runId))?.status === "completed");
|
|
240
|
+
expect((await getWaitStateByStepId(second.id))?.firedPayload).toEqual({
|
|
241
|
+
_runId: runId,
|
|
242
|
+
sequence: 2,
|
|
243
|
+
});
|
|
244
|
+
expect(realtimeBus.subscriberCount(`workflow:${eventName}`)).toBe(0);
|
|
245
|
+
});
|
|
246
|
+
|
|
139
247
|
test("scope='run': mismatched _runId payload does NOT resolve the wait", async () => {
|
|
140
248
|
const registry = createExecutorRegistry(deps);
|
|
141
249
|
|
|
@@ -3,6 +3,7 @@ import * as z from "zod";
|
|
|
3
3
|
import { getAgentById } from "@/be/db";
|
|
4
4
|
import { getEmbeddingProvider, getMemoryStore } from "@/be/memory";
|
|
5
5
|
import { CANDIDATE_SET_MULTIPLIER } from "@/be/memory/constants";
|
|
6
|
+
import { attachDemotionEvidence } from "@/be/memory/demotion-evidence";
|
|
6
7
|
import { expandCandidatesWithGraph } from "@/be/memory/graph-expansion";
|
|
7
8
|
import { MEMORY_KEY_MAX_LENGTH } from "@/be/memory/key-paths";
|
|
8
9
|
import {
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
recordRetrievals,
|
|
12
13
|
} from "@/be/memory/raters/retrieval";
|
|
13
14
|
import { rerank } from "@/be/memory/reranker";
|
|
15
|
+
import { dropReviewTaskCompletions, isReviewTaskId } from "@/be/memory/review-recall-filter";
|
|
14
16
|
import { searchMemoryCandidates } from "@/be/memory/search-candidates";
|
|
15
17
|
import { createToolRegistrar, swarmToolOutputSchema, toolErr, toolOk } from "@/tools/utils";
|
|
16
18
|
import type { AgentMemorySource } from "@/types";
|
|
@@ -123,6 +125,8 @@ export const registerMemorySearchTool = (server: McpServer) => {
|
|
|
123
125
|
const queryEmbedding = await provider.embed(query, { kind: "query" });
|
|
124
126
|
|
|
125
127
|
const candidateLimit = limit * CANDIDATE_SET_MULTIPLIER;
|
|
128
|
+
// A review task never recalls other review tasks' task_completion rows.
|
|
129
|
+
const excludeReviewTaskCompletions = await isReviewTaskId(requestInfo.sourceTaskId);
|
|
126
130
|
const candidates = await searchMemoryCandidates(
|
|
127
131
|
store,
|
|
128
132
|
queryEmbedding ?? new Float32Array(0),
|
|
@@ -134,18 +138,22 @@ export const registerMemorySearchTool = (server: McpServer) => {
|
|
|
134
138
|
isLead,
|
|
135
139
|
queryText: query,
|
|
136
140
|
keyPrefix,
|
|
141
|
+
excludeReviewTaskCompletions,
|
|
137
142
|
},
|
|
138
143
|
);
|
|
139
144
|
// Default-on 1-hop memory_link neighbor expansion (disable with
|
|
140
145
|
// MEMORY_GRAPH_EXPANSION=0|false).
|
|
141
|
-
const
|
|
146
|
+
const graphExpanded = await expandCandidatesWithGraph(candidates, requestInfo.agentId, {
|
|
142
147
|
scope: scope as "agent" | "swarm" | "all",
|
|
143
148
|
source,
|
|
144
149
|
keyPrefix,
|
|
145
150
|
isLead,
|
|
146
151
|
});
|
|
152
|
+
const expanded = excludeReviewTaskCompletions
|
|
153
|
+
? await dropReviewTaskCompletions(graphExpanded)
|
|
154
|
+
: graphExpanded;
|
|
147
155
|
if (expanded.length > 0) {
|
|
148
|
-
const ranked = rerank(expanded, { limit });
|
|
156
|
+
const ranked = rerank(await attachDemotionEvidence(expanded), { limit });
|
|
149
157
|
|
|
150
158
|
// Retrieval bridge — when called inside a task scope, log one
|
|
151
159
|
// `memory_retrieval` row per returned memory so server-side raters
|
|
@@ -204,13 +212,16 @@ export const registerMemorySearchTool = (server: McpServer) => {
|
|
|
204
212
|
}
|
|
205
213
|
|
|
206
214
|
// Fallback: list recent memories (no OPENAI_API_KEY and no FTS hit)
|
|
207
|
-
const
|
|
215
|
+
const listed = await store.list(requestInfo.agentId, {
|
|
208
216
|
scope: scope as "agent" | "swarm" | "all",
|
|
209
217
|
limit,
|
|
210
218
|
isLead,
|
|
211
219
|
source,
|
|
212
220
|
keyPrefix,
|
|
213
221
|
});
|
|
222
|
+
const recent = excludeReviewTaskCompletions
|
|
223
|
+
? await dropReviewTaskCompletions(listed)
|
|
224
|
+
: listed;
|
|
214
225
|
|
|
215
226
|
const consumedIds = dedupeMemoryDocumentIds(recent);
|
|
216
227
|
try {
|
|
@@ -39,11 +39,12 @@ import {
|
|
|
39
39
|
} from "@/tasks/terminal-result-guard";
|
|
40
40
|
import { createToolRegistrar, swarmToolOutputSchema, toolErr, toolOk } from "@/tools/utils";
|
|
41
41
|
import { AgentTaskStatusSchema, AttachmentInputSchema, isTerminalTaskStatus } from "@/types";
|
|
42
|
+
import { TaskUiSpecInputSchema } from "@/ui-spec/schema";
|
|
43
|
+
import { scriptActionIssues, scriptActionPinIssues } from "@/ui-spec/script-actions";
|
|
42
44
|
import { validateTaskUiSpec } from "@/ui-spec/validate";
|
|
43
45
|
import { isEnvFlagEnabled } from "@/utils/env-flag";
|
|
44
46
|
import { scrubSecrets } from "@/utils/secret-scrubber";
|
|
45
47
|
import { taskCitationIssues, taskCitationWarnings } from "@/utils/task-citations";
|
|
46
|
-
import { UI_SPEC_ACTION_ID } from "@/utils/task-ui-spec";
|
|
47
48
|
import { ensure } from "../utils/business-use";
|
|
48
49
|
|
|
49
50
|
// Phase 11: the `cost` / `costData` field was removed from this tool's input
|
|
@@ -203,27 +204,9 @@ export const registerStoreProgressTool = (server: McpServer) => {
|
|
|
203
204
|
.describe(
|
|
204
205
|
'Claim sources, upserted by index across calls. Use only for factual claims the reader cannot already see in the thread or task tree, 1-2 sources; none on delegation, routing, acks, or status replies. Reference each one in output with [citation:N], or set general: true for a source that backs the whole answer (it renders under "General sources"). ref per kind: task = task UUID; memory = memory UUID (optional quote must appear verbatim in it); github = owner/repo#N, owner/repo@<sha>, or a github.com pull, issues, or commit URL; slack = permalink or channel/ts; agent-fs = file path; page = page id; script-run = script run id; url = http(s) URL. The first completing call is refused, and the task stays in progress, if a marker has no entry, a citation fails validation, or a non-general citation is unreferenced; the response lists each problem. After one refusal, completion proceeds and those markers and sources are dropped from rendered output. At most 50 citations per call/task, refs up to 2048 characters, labels up to 200. Invalid or oversized batches are ignored; existing indices can still be updated at capacity.',
|
|
205
206
|
),
|
|
206
|
-
uiSpec:
|
|
207
|
-
.
|
|
208
|
-
|
|
209
|
-
.object({
|
|
210
|
-
root: z.string().min(1),
|
|
211
|
-
elements: z.record(z.string(), z.unknown()),
|
|
212
|
-
state: z.record(z.string(), z.unknown()).optional(),
|
|
213
|
-
})
|
|
214
|
-
.describe("A json-render spec for the chat catalog. Root must be a Card."),
|
|
215
|
-
actions: z
|
|
216
|
-
.record(
|
|
217
|
-
z.string().regex(UI_SPEC_ACTION_ID),
|
|
218
|
-
z.object({ kind: z.literal("follow_up"), prompt: z.string().min(1).max(4000) }),
|
|
219
|
-
)
|
|
220
|
-
.optional()
|
|
221
|
-
.describe("Actions that Button ids name. Needs UI_SPEC_ACTIONS_ENABLED=true."),
|
|
222
|
-
})
|
|
223
|
-
.optional()
|
|
224
|
-
.describe(
|
|
225
|
-
"Optional rich card for this result, rendered in the Slack outcome card, the session view and Chat SDK channels. `output` stays the prose answer. A Slack card shows only the spec of its own task. See the ui-spec skill.",
|
|
226
|
-
),
|
|
207
|
+
uiSpec: TaskUiSpecInputSchema.optional().describe(
|
|
208
|
+
"Optional rich card for this result, rendered in the Slack outcome card, the session view and Chat SDK channels. `output` stays the prose answer. A Slack card shows only the spec of its own task. See the ui-spec skill.",
|
|
209
|
+
),
|
|
227
210
|
learning: z
|
|
228
211
|
.union([
|
|
229
212
|
z.string(),
|
|
@@ -424,6 +407,15 @@ export const registerStoreProgressTool = (server: McpServer) => {
|
|
|
424
407
|
}
|
|
425
408
|
|
|
426
409
|
let learningWrite: Promise<TaskLearningResult> | undefined;
|
|
410
|
+
// The full script-action checks (allowlist, scripts, args schemas) run
|
|
411
|
+
// here, before the BEGIN IMMEDIATE below, so they never hold the write
|
|
412
|
+
// lock. The transaction re-checks only the pins, with bounded work, so a
|
|
413
|
+
// pin removed in between refuses the card instead of storing it.
|
|
414
|
+
const uiSpecScriptIssues =
|
|
415
|
+
uiSpec && status === "completed" && isEnvFlagEnabled("UI_SPEC_ENABLED", false)
|
|
416
|
+
? await scriptActionIssues(uiSpec.actions)
|
|
417
|
+
: [];
|
|
418
|
+
|
|
427
419
|
// A sentence about the uiSpec, appended to a successful result message.
|
|
428
420
|
let uiSpecNote: string | undefined;
|
|
429
421
|
const result = await getDbClient().transaction(async () => {
|
|
@@ -642,10 +634,18 @@ export const registerStoreProgressTool = (server: McpServer) => {
|
|
|
642
634
|
} else if (uiSpec && status !== "completed") {
|
|
643
635
|
uiSpecNote = 'uiSpec is stored only with status "completed".';
|
|
644
636
|
} else if (uiSpec) {
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
637
|
+
// Script actions are checked first, so a bad one uses the same single refusal.
|
|
638
|
+
const scriptIssues =
|
|
639
|
+
uiSpecScriptIssues.length > 0
|
|
640
|
+
? uiSpecScriptIssues
|
|
641
|
+
: await scriptActionPinIssues(uiSpec.actions);
|
|
642
|
+
const validation =
|
|
643
|
+
scriptIssues.length > 0
|
|
644
|
+
? { ok: false as const, issues: scriptIssues }
|
|
645
|
+
: validateTaskUiSpec(uiSpec, {
|
|
646
|
+
taskId,
|
|
647
|
+
actionsEnabled: isEnvFlagEnabled("UI_SPEC_ACTIONS_ENABLED", false),
|
|
648
|
+
});
|
|
649
649
|
if (validation.ok) {
|
|
650
650
|
uiSpecToStore = {
|
|
651
651
|
spec: validation.spec,
|