@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
|
@@ -2,7 +2,12 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { deleteSwarmConfig, getAgentById, getSwarmConfigLookupById } from "@/be/db";
|
|
4
4
|
import { AGENT_MAX_TASKS_CONFIG_KEY, resetAgentMaxTasksMirror } from "@/be/multi-runtime";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
humanOnlyConfigKeyError,
|
|
7
|
+
internalConfigKeyError,
|
|
8
|
+
isHumanOnlyConfigKey,
|
|
9
|
+
isInternalConfigKey,
|
|
10
|
+
} from "@/be/swarm-config-guard";
|
|
6
11
|
import { scheduleIntegrationsReload } from "@/http/core";
|
|
7
12
|
import { can } from "@/rbac";
|
|
8
13
|
import { createToolRegistrar, swarmToolOutputSchema, toolErr, toolOk } from "@/tools/utils";
|
|
@@ -56,6 +61,12 @@ export const registerDeleteConfigTool = (server: McpServer) => {
|
|
|
56
61
|
data: { yourAgentId: requestInfo.agentId },
|
|
57
62
|
});
|
|
58
63
|
}
|
|
64
|
+
if (isHumanOnlyConfigKey(existing.key)) {
|
|
65
|
+
return toolErr(humanOnlyConfigKeyError(existing.key), {
|
|
66
|
+
data: { yourAgentId: requestInfo.agentId },
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
59
70
|
if (isInternalConfigKey(existing.key)) {
|
|
60
71
|
return toolErr(internalConfigKeyError(existing.key).message, {
|
|
61
72
|
data: { yourAgentId: requestInfo.agentId },
|
|
@@ -3,7 +3,9 @@ import * as z from "zod";
|
|
|
3
3
|
import { getAgentById, maskSecrets } from "@/be/db";
|
|
4
4
|
import { upsertSwarmConfigWithPolicyMirror } from "@/be/multi-runtime";
|
|
5
5
|
import {
|
|
6
|
+
humanOnlyConfigKeyError,
|
|
6
7
|
internalConfigKeyError,
|
|
8
|
+
isHumanOnlyConfigKey,
|
|
7
9
|
isInternalConfigKey,
|
|
8
10
|
isReservedConfigKey,
|
|
9
11
|
reservedKeyError,
|
|
@@ -98,6 +100,12 @@ export const registerSetConfigTool = (server: McpServer) => {
|
|
|
98
100
|
return toolErr(message, { data: { yourAgentId: requestInfo.agentId } });
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
if (isHumanOnlyConfigKey(key)) {
|
|
104
|
+
return toolErr(humanOnlyConfigKeyError(key), {
|
|
105
|
+
data: { yourAgentId: requestInfo.agentId },
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
101
109
|
if (isInternalConfigKey(key)) {
|
|
102
110
|
return toolErr(internalConfigKeyError(key).message, {
|
|
103
111
|
data: { yourAgentId: requestInfo.agentId },
|
|
@@ -1,13 +1,88 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
import {
|
|
3
|
+
import { getActivePricingRow, getTaskById, insertSessionCost } from "@/be/db";
|
|
4
|
+
import { recomputeSessionCost } from "@/http/session-cost-recompute";
|
|
5
|
+
import {
|
|
6
|
+
createToolRegistrar,
|
|
7
|
+
type RequestInfo,
|
|
8
|
+
swarmToolOutputSchema,
|
|
9
|
+
toolErr,
|
|
10
|
+
toolOk,
|
|
11
|
+
} from "@/tools/utils";
|
|
12
|
+
import type { AgentTask } from "@/types";
|
|
4
13
|
import { getExecutorRegistry } from "@/workflows";
|
|
5
14
|
import {
|
|
6
15
|
SYSTEM_ONE_DECISION_NODE_TYPE,
|
|
7
16
|
SystemOneDecisionConfigSchema,
|
|
8
17
|
SystemOneDecisionExecutor,
|
|
9
18
|
} from "@/workflows/executors/system-one-decision";
|
|
10
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
SYSTEM_ONE_PROVIDER_IDS,
|
|
21
|
+
type SystemOneProviderId,
|
|
22
|
+
} from "@/workflows/executors/system-one-providers";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The task a decision's cost lands on: the explicit `taskId`, else the caller's
|
|
26
|
+
* X-Source-Task-Id. A caller may charge only its own task; an extension (its
|
|
27
|
+
* origin is token-verified) may charge the task whose event it is handling.
|
|
28
|
+
*/
|
|
29
|
+
async function costTask(
|
|
30
|
+
taskId: string | undefined,
|
|
31
|
+
requestInfo: RequestInfo,
|
|
32
|
+
): Promise<{ task?: AgentTask; error?: string }> {
|
|
33
|
+
const id = taskId ?? requestInfo.sourceTaskId;
|
|
34
|
+
if (!id) return {};
|
|
35
|
+
const task = await getTaskById(id);
|
|
36
|
+
const allowed =
|
|
37
|
+
!!task && (requestInfo.callOrigin === "extension" || task.agentId === requestInfo.agentId);
|
|
38
|
+
if (allowed) return { task };
|
|
39
|
+
// A header-derived id with no matching task (a taskless trigger) records nothing.
|
|
40
|
+
return taskId ? { error: `taskId ${taskId} is not a task this caller can charge` } : {};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* One `session_costs` row of kind `system-one` on the task, priced from the
|
|
45
|
+
* `pricing` table under provider `system-one`, model `<host>/<model>`. With no
|
|
46
|
+
* rate row it is recorded `unpriced` at $0, tokens kept.
|
|
47
|
+
*/
|
|
48
|
+
async function recordDecisionCost(
|
|
49
|
+
task: AgentTask,
|
|
50
|
+
callerAgentId: string,
|
|
51
|
+
provider: SystemOneProviderId,
|
|
52
|
+
output: { model: string; usage: { input_tokens: number; output_tokens: number } },
|
|
53
|
+
durationMs: number,
|
|
54
|
+
) {
|
|
55
|
+
const model = `${provider}/${output.model}`;
|
|
56
|
+
const priced = await recomputeSessionCost(
|
|
57
|
+
{
|
|
58
|
+
provider: "system-one",
|
|
59
|
+
model,
|
|
60
|
+
harnessCostUsd: 0,
|
|
61
|
+
inputTokens: output.usage.input_tokens,
|
|
62
|
+
outputTokens: output.usage.output_tokens,
|
|
63
|
+
cacheReadTokens: 0,
|
|
64
|
+
cacheWriteTokens: 0,
|
|
65
|
+
atEpochMs: Date.now(),
|
|
66
|
+
},
|
|
67
|
+
async (pricingProvider, lookupModel, tokenClass, atEpochMs) =>
|
|
68
|
+
(await getActivePricingRow(pricingProvider, lookupModel, tokenClass, atEpochMs))
|
|
69
|
+
?.pricePerMillionUsd ?? null,
|
|
70
|
+
);
|
|
71
|
+
const { cost } = await insertSessionCost({
|
|
72
|
+
sessionId: `system-one:${crypto.randomUUID()}`,
|
|
73
|
+
taskId: task.id,
|
|
74
|
+
agentId: task.agentId ?? callerAgentId,
|
|
75
|
+
totalCostUsd: priced.totalCostUsd,
|
|
76
|
+
inputTokens: output.usage.input_tokens,
|
|
77
|
+
outputTokens: output.usage.output_tokens,
|
|
78
|
+
durationMs,
|
|
79
|
+
numTurns: null,
|
|
80
|
+
model,
|
|
81
|
+
costSource: priced.costSource,
|
|
82
|
+
kind: "system-one",
|
|
83
|
+
});
|
|
84
|
+
return { taskId: task.id, costUsd: cost.totalCostUsd, costSource: cost.costSource };
|
|
85
|
+
}
|
|
11
86
|
|
|
12
87
|
/**
|
|
13
88
|
* One typed decision (Jev, Clef and the other SystemOne hosts) made in the API
|
|
@@ -51,12 +126,26 @@ export const registerSystemOneDecideTool = (server: McpServer) => {
|
|
|
51
126
|
.int()
|
|
52
127
|
.optional()
|
|
53
128
|
.describe("Retries on transient failures inside the time budget (default 2)"),
|
|
129
|
+
taskId: z
|
|
130
|
+
.uuid()
|
|
131
|
+
.optional()
|
|
132
|
+
.describe(
|
|
133
|
+
"Task this decision serves; its cost is recorded on that task's session costs (default: the caller's X-Source-Task-Id). Must be the caller's own task, or, from an extension, the task of the event it handles",
|
|
134
|
+
),
|
|
54
135
|
}),
|
|
55
136
|
outputSchema: swarmToolOutputSchema({
|
|
56
137
|
model: z.string().optional(),
|
|
57
138
|
answers: z.record(z.string(), z.unknown()).optional(),
|
|
58
139
|
usage: z.record(z.string(), z.unknown()).optional(),
|
|
59
140
|
requestId: z.string().optional(),
|
|
141
|
+
cost: z
|
|
142
|
+
.looseObject({
|
|
143
|
+
taskId: z.string().optional(),
|
|
144
|
+
costUsd: z.number().optional(),
|
|
145
|
+
costSource: z.string().optional(),
|
|
146
|
+
})
|
|
147
|
+
.optional()
|
|
148
|
+
.describe("The session-cost row recorded on the task, when a task was in scope"),
|
|
60
149
|
providerUnavailable: z
|
|
61
150
|
.boolean()
|
|
62
151
|
.optional()
|
|
@@ -65,10 +154,12 @@ export const registerSystemOneDecideTool = (server: McpServer) => {
|
|
|
65
154
|
),
|
|
66
155
|
}),
|
|
67
156
|
},
|
|
68
|
-
async ({ provider, model, state, questions, timeoutMs, maxRetries }, requestInfo) => {
|
|
157
|
+
async ({ provider, model, state, questions, timeoutMs, maxRetries, taskId }, requestInfo) => {
|
|
69
158
|
if (!requestInfo.agentId) {
|
|
70
159
|
return toolErr('Agent ID not found. The MCP client should define the "X-Agent-ID" header.');
|
|
71
160
|
}
|
|
161
|
+
const scope = await costTask(taskId, requestInfo);
|
|
162
|
+
if (scope.error) return toolErr(scope.error);
|
|
72
163
|
|
|
73
164
|
// `returns` mirrors the questions: the caller reads answers directly, so
|
|
74
165
|
// there is no downstream port to declare.
|
|
@@ -95,6 +186,7 @@ export const registerSystemOneDecideTool = (server: McpServer) => {
|
|
|
95
186
|
if (!(executor instanceof SystemOneDecisionExecutor)) {
|
|
96
187
|
return toolErr("The system-one-decision executor is not available");
|
|
97
188
|
}
|
|
189
|
+
const startedAt = Date.now();
|
|
98
190
|
const decided = await executor.decide(parsed.data);
|
|
99
191
|
if (!decided.ok) {
|
|
100
192
|
return toolErr(
|
|
@@ -104,12 +196,30 @@ export const registerSystemOneDecideTool = (server: McpServer) => {
|
|
|
104
196
|
}
|
|
105
197
|
|
|
106
198
|
const { output } = decided;
|
|
199
|
+
let cost: Awaited<ReturnType<typeof recordDecisionCost>> | undefined;
|
|
200
|
+
if (scope.task) {
|
|
201
|
+
try {
|
|
202
|
+
cost = await recordDecisionCost(
|
|
203
|
+
scope.task,
|
|
204
|
+
requestInfo.agentId,
|
|
205
|
+
decided.provider,
|
|
206
|
+
output,
|
|
207
|
+
Date.now() - startedAt,
|
|
208
|
+
);
|
|
209
|
+
} catch (err) {
|
|
210
|
+
// The decision was made and paid for; a failed cost write must not hide it.
|
|
211
|
+
console.warn(
|
|
212
|
+
`[system-one-decide] cost not recorded on task ${scope.task.id}: ${err instanceof Error ? err.message : String(err)}`,
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
107
216
|
return toolOk(`Decision from ${output.model}`, {
|
|
108
217
|
data: {
|
|
109
218
|
model: output.model,
|
|
110
219
|
answers: output.answers,
|
|
111
220
|
usage: output.usage,
|
|
112
221
|
requestId: output.requestId,
|
|
222
|
+
...(cost ? { cost } : {}),
|
|
113
223
|
},
|
|
114
224
|
});
|
|
115
225
|
},
|
package/src/tools/utils.ts
CHANGED
|
@@ -51,7 +51,10 @@ export type RequestInfo = {
|
|
|
51
51
|
runtimeInstanceId: string | undefined;
|
|
52
52
|
sourceTaskId: string | undefined;
|
|
53
53
|
contextKey: string | undefined;
|
|
54
|
-
|
|
54
|
+
/** `native`: a harness built-in tool call reported through `POST /api/tool-hooks`. */
|
|
55
|
+
callOrigin: "mcp" | "script-sdk" | "extension" | "native";
|
|
56
|
+
/** The worker harness (`claude`, `codex`, `opencode`, `pi`); set on native calls. */
|
|
57
|
+
harness?: string;
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
export const getRequestInfo = (req: Meta): RequestInfo => {
|
|
@@ -57,6 +57,8 @@ export const registerCreateWorkflowTool = (server: McpServer) => {
|
|
|
57
57
|
"{ format: 'token-equality', header }, or { format: 'standard-webhooks', toleranceSeconds? } " +
|
|
58
58
|
"(standardwebhooks.com: webhook-id/webhook-timestamp/webhook-signature headers, hmacSecret is the whsec_ signing secret). Example: { type: 'webhook', hmacSecret: 'secret.SUPERAGENT_WEBHOOK_SECRET', " +
|
|
59
59
|
"verification: { format: 'timestamped-hmac-sha256', header: 'X-Superagent-Signature', toleranceSeconds: 300 } }.\n" +
|
|
60
|
+
"- WEBHOOK EVENT FILTER: optional events: ['pull_request'] on a webhook trigger drops other deliveries after signature verification, " +
|
|
61
|
+
"before any run is saved (2xx skipped reply). The event is read from eventHeader (default X-GitHub-Event).\n" +
|
|
60
62
|
"- WAIT NODE: type 'wait' pauses a workflow for a duration or until a named workflowEventBus event arrives. " +
|
|
61
63
|
"See runbooks/workflows.md#wait-nodes for config shapes, ordering caveats, and built-in event names.",
|
|
62
64
|
inputSchema: z.object({
|
|
@@ -39,7 +39,9 @@ export const registerUpdateWorkflowTool = (server: McpServer) => {
|
|
|
39
39
|
"Omit verification for legacy HMAC-SHA256 over the raw body with fallback header scanning; " +
|
|
40
40
|
"or set verification to { format: 'hmac-sha256', header }, { format: 'timestamped-hmac-sha256', header, toleranceSeconds? }, " +
|
|
41
41
|
"{ format: 'token-equality', header }, or { format: 'standard-webhooks', toleranceSeconds? } " +
|
|
42
|
-
"(standardwebhooks.com: webhook-id/webhook-timestamp/webhook-signature headers, hmacSecret is the whsec_ signing secret)."
|
|
42
|
+
"(standardwebhooks.com: webhook-id/webhook-timestamp/webhook-signature headers, hmacSecret is the whsec_ signing secret). " +
|
|
43
|
+
"WEBHOOK EVENT FILTER: optional events: ['pull_request'] on a webhook trigger drops other deliveries after signature verification, " +
|
|
44
|
+
"before any run is saved (2xx skipped reply). The event is read from eventHeader (default X-GitHub-Event).",
|
|
43
45
|
inputSchema: z.object({
|
|
44
46
|
id: z.string().uuid().describe("Workflow ID to update"),
|
|
45
47
|
key: AssetKeySchema.optional().describe("Move to a logical namespace."),
|
package/src/types.ts
CHANGED
|
@@ -499,6 +499,24 @@ export const ModelProfileSchema = z.object({
|
|
|
499
499
|
});
|
|
500
500
|
export type ModelProfile = z.infer<typeof ModelProfileSchema>;
|
|
501
501
|
|
|
502
|
+
/**
|
|
503
|
+
* A model group: a named, ordered list of profiles that may span harnesses
|
|
504
|
+
* (runbooks/model-tiers.md § Model groups). Groups and profiles share one name
|
|
505
|
+
* space.
|
|
506
|
+
*/
|
|
507
|
+
export const ModelGroupSchema = z.object({
|
|
508
|
+
id: z.string(),
|
|
509
|
+
name: z.string(),
|
|
510
|
+
description: z.string().nullable(),
|
|
511
|
+
/** `tier:<tier>` for a boot seed, null otherwise. */
|
|
512
|
+
seededFrom: z.string().nullable(),
|
|
513
|
+
/** Profile names, first preferred. */
|
|
514
|
+
members: z.array(z.string()),
|
|
515
|
+
createdAt: z.string(),
|
|
516
|
+
lastUpdatedAt: z.string(),
|
|
517
|
+
});
|
|
518
|
+
export type ModelGroup = z.infer<typeof ModelGroupSchema>;
|
|
519
|
+
|
|
502
520
|
/**
|
|
503
521
|
* Why a provider session ended in a way another profile may survive. Set by
|
|
504
522
|
* the worker's classifier (`src/commands/provider-error-class.ts`); never a
|
|
@@ -1231,6 +1249,10 @@ export const UserSchema = z
|
|
|
1231
1249
|
dailyBudgetUsd: z.number().nullable().optional(),
|
|
1232
1250
|
// Lifecycle (Phase 064). CHECK constraint enforces these three values.
|
|
1233
1251
|
status: z.enum(["invited", "active", "suspended"]).default("active"),
|
|
1252
|
+
// Set while a merge job (POST /api/users/{id}/merge) still rewrites this
|
|
1253
|
+
// user's rows into the target. Such a user cannot authenticate, and
|
|
1254
|
+
// identity lookups resolve to the target. Absent once the job deletes it.
|
|
1255
|
+
mergedIntoUserId: z.string().nullable().optional(),
|
|
1234
1256
|
createdAt: z.iso.datetime(),
|
|
1235
1257
|
lastUpdatedAt: z.iso.datetime(),
|
|
1236
1258
|
})
|
|
@@ -1238,6 +1260,37 @@ export const UserSchema = z
|
|
|
1238
1260
|
|
|
1239
1261
|
export type User = z.infer<typeof UserSchema>;
|
|
1240
1262
|
|
|
1263
|
+
export const UserMergeJobStatusSchema = z.enum(["pending", "running", "done", "failed"]);
|
|
1264
|
+
export type UserMergeJobStatus = z.infer<typeof UserMergeJobStatusSchema>;
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Background merge of one user into another (`user_merge_jobs`). The route
|
|
1268
|
+
* moves identities and aliases synchronously and queues the attribution
|
|
1269
|
+
* rewrite; `src/be/user-merge-jobs.ts` runs it in batches and deletes the
|
|
1270
|
+
* source when done. `progress` counts rewritten rows per step, keyed like
|
|
1271
|
+
* `phase` (`workflow-context`, `<table>.<column>`, `delete-user`). A failed
|
|
1272
|
+
* attempt keeps the job `pending` with `error` set and `nextAttemptAt` in the
|
|
1273
|
+
* future until the attempt cap, then the job is `failed`.
|
|
1274
|
+
*/
|
|
1275
|
+
export const UserMergeJobSchema = z
|
|
1276
|
+
.object({
|
|
1277
|
+
id: z.string(),
|
|
1278
|
+
sourceUserId: z.string(),
|
|
1279
|
+
targetUserId: z.string(),
|
|
1280
|
+
status: UserMergeJobStatusSchema,
|
|
1281
|
+
phase: z.string().nullable(),
|
|
1282
|
+
progress: z.record(z.string(), z.number()),
|
|
1283
|
+
error: z.string().nullable(),
|
|
1284
|
+
attempts: z.number(),
|
|
1285
|
+
nextAttemptAt: z.string().nullable(),
|
|
1286
|
+
createdAt: z.string(),
|
|
1287
|
+
startedAt: z.string().nullable(),
|
|
1288
|
+
finishedAt: z.string().nullable(),
|
|
1289
|
+
})
|
|
1290
|
+
.openapi("UserMergeJob");
|
|
1291
|
+
|
|
1292
|
+
export type UserMergeJob = z.infer<typeof UserMergeJobSchema>;
|
|
1293
|
+
|
|
1241
1294
|
export const RbacRoleSchema = z
|
|
1242
1295
|
.object({
|
|
1243
1296
|
id: z.string(),
|
|
@@ -1918,6 +1971,8 @@ export const AgentLogEventTypeSchema = z.enum([
|
|
|
1918
1971
|
"task_citation_check_refused",
|
|
1919
1972
|
// store-progress refused a completion once because its uiSpec was invalid
|
|
1920
1973
|
"task_ui_spec_check_refused",
|
|
1974
|
+
// A card `script` action ran and failed; the old card stays
|
|
1975
|
+
"task_ui_script_action_failed",
|
|
1921
1976
|
"channel_message",
|
|
1922
1977
|
// Service registry events
|
|
1923
1978
|
"service_registered",
|
|
@@ -1989,6 +2044,11 @@ export const SessionCostSourceSchema = z.enum([
|
|
|
1989
2044
|
]);
|
|
1990
2045
|
export type SessionCostSource = z.infer<typeof SessionCostSourceSchema>;
|
|
1991
2046
|
|
|
2047
|
+
// Migration 320: what incurred the row. 'harness' is a worker session;
|
|
2048
|
+
// 'system-one' is one SystemOne decision (Jev, Clef) made for the task.
|
|
2049
|
+
export const SessionCostKindSchema = z.enum(["harness", "system-one"]);
|
|
2050
|
+
export type SessionCostKind = z.infer<typeof SessionCostKindSchema>;
|
|
2051
|
+
|
|
1992
2052
|
export const SessionCostModelBreakdownSchema = z
|
|
1993
2053
|
.object({
|
|
1994
2054
|
model: z.string(),
|
|
@@ -2036,6 +2096,7 @@ export const SessionCostSchema = z
|
|
|
2036
2096
|
// 'estimated' — the API priced fallback token counts at an assumed
|
|
2037
2097
|
// model (amp with a failed thread export).
|
|
2038
2098
|
costSource: SessionCostSourceSchema.default("harness"),
|
|
2099
|
+
kind: SessionCostKindSchema.default("harness"),
|
|
2039
2100
|
// Migration 128: adapter-reported amount retained for reconciliation only.
|
|
2040
2101
|
harnessCostUsd: z.number().nullable().optional(),
|
|
2041
2102
|
cacheWrite5mTokens: z.number().int().nullable().optional(),
|
|
@@ -2395,8 +2456,7 @@ export type WorkerNudge = z.infer<typeof WorkerNudgeSchema>;
|
|
|
2395
2456
|
export const RuntimeInstanceStatusSchema = z.enum(["active", "offline", "provisioning"]);
|
|
2396
2457
|
|
|
2397
2458
|
/**
|
|
2398
|
-
* Infrastructure kind a runtime pool provisions on.
|
|
2399
|
-
* paths reject it until its adapter exists.
|
|
2459
|
+
* Infrastructure kind a runtime pool provisions on.
|
|
2400
2460
|
*/
|
|
2401
2461
|
export const RuntimeProviderKindSchema = z.enum(["static", "docker", "e2b", "boxd", "k8s"]);
|
|
2402
2462
|
export type RuntimeProviderKind = z.infer<typeof RuntimeProviderKindSchema>;
|
|
@@ -2852,6 +2912,19 @@ export const TriggerConfigSchema = z
|
|
|
2852
2912
|
verification: WebhookVerificationSchema.optional().describe(
|
|
2853
2913
|
"Optional webhook verification format. Omit to keep legacy HMAC-SHA256 behavior with fallback header scanning.",
|
|
2854
2914
|
),
|
|
2915
|
+
events: z
|
|
2916
|
+
.array(z.string().min(1))
|
|
2917
|
+
.optional()
|
|
2918
|
+
.describe(
|
|
2919
|
+
"Optional event allowlist, matched exactly against the eventHeader value after signature verification. A delivery whose event is not listed (or that has no event header) gets a 2xx `skipped` reply and creates no run. Omit or leave empty to accept every event.",
|
|
2920
|
+
),
|
|
2921
|
+
eventHeader: z
|
|
2922
|
+
.string()
|
|
2923
|
+
.min(1)
|
|
2924
|
+
.optional()
|
|
2925
|
+
.describe(
|
|
2926
|
+
"Request header holding the event name for `events` (case-insensitive lookup). Defaults to X-GitHub-Event.",
|
|
2927
|
+
),
|
|
2855
2928
|
}),
|
|
2856
2929
|
z.object({
|
|
2857
2930
|
type: z.literal("schedule"),
|
|
@@ -3730,6 +3803,14 @@ export const ExtensionManifestSchema = z
|
|
|
3730
3803
|
.strict(),
|
|
3731
3804
|
homepage: z.string().url().optional(),
|
|
3732
3805
|
author: z.string().min(1).optional(),
|
|
3806
|
+
toolSources: z
|
|
3807
|
+
.array(z.enum(["mcp", "native"]))
|
|
3808
|
+
.min(1)
|
|
3809
|
+
.readonly()
|
|
3810
|
+
.optional()
|
|
3811
|
+
.describe(
|
|
3812
|
+
'Which tool calls reach this extension\'s `pre.tool.call` and `post.tool.call` handlers: `"mcp"` for swarm MCP tools, `"native"` for harness built-ins (bash, read, write, edit) reported through `POST /api/tool-hooks`. Default `["mcp"]`.',
|
|
3813
|
+
),
|
|
3733
3814
|
})
|
|
3734
3815
|
.strict()
|
|
3735
3816
|
.superRefine((manifest, ctx) => {
|
|
@@ -4165,6 +4246,9 @@ export const PricingProviderSchema = z.enum([
|
|
|
4165
4246
|
"cursor",
|
|
4166
4247
|
"grok",
|
|
4167
4248
|
"fx",
|
|
4249
|
+
// SystemOne decisions recorded on a task; model keys are `<host>/<model>`
|
|
4250
|
+
// (e.g. `cloudflare/clef`). No seeded rows: unpriced until an operator adds one.
|
|
4251
|
+
"system-one",
|
|
4168
4252
|
]);
|
|
4169
4253
|
export type PricingProvider = z.infer<typeof PricingProviderSchema>;
|
|
4170
4254
|
|
package/src/ui-spec/actions.ts
CHANGED
|
@@ -9,14 +9,28 @@ import {
|
|
|
9
9
|
import { slackContextKey } from "../tasks/context-key";
|
|
10
10
|
import { createTaskWithSiblingAwareness } from "../tasks/sibling-awareness";
|
|
11
11
|
import { isEnvFlagEnabled } from "../utils/env-flag";
|
|
12
|
+
import type { TaskUiSpec } from "../utils/task-ui-spec";
|
|
13
|
+
import { runTaskUiScriptAction } from "./script-actions";
|
|
12
14
|
|
|
13
15
|
export type TaskUiActionResult =
|
|
14
16
|
| { status: "started"; taskId: string }
|
|
15
|
-
| { status: "
|
|
17
|
+
| { status: "refreshed"; uiSpec: TaskUiSpec }
|
|
18
|
+
| { status: "running" | "rate_limited"; retryAfterSec: number }
|
|
19
|
+
| { status: "script_failed" | "invalid_output"; error: string }
|
|
20
|
+
| {
|
|
21
|
+
status:
|
|
22
|
+
| "already_done"
|
|
23
|
+
| "disabled"
|
|
24
|
+
| "unknown_action"
|
|
25
|
+
| "forbidden"
|
|
26
|
+
| "not_allowlisted"
|
|
27
|
+
| "script_changed";
|
|
28
|
+
};
|
|
16
29
|
|
|
17
30
|
/**
|
|
18
|
-
* Runs the action a spec Button names
|
|
19
|
-
*
|
|
31
|
+
* Runs the action a spec Button names. The Slack click and the web route both
|
|
32
|
+
* call it. Only the task requester may run it. A `follow_up` runs once per
|
|
33
|
+
* task and action; a `script` action can run again after its cooldown.
|
|
20
34
|
*/
|
|
21
35
|
export async function runTaskUiAction({
|
|
22
36
|
taskId,
|
|
@@ -39,10 +53,22 @@ export async function runTaskUiAction({
|
|
|
39
53
|
stored?.actions && Object.hasOwn(stored.actions, actionId)
|
|
40
54
|
? stored.actions[actionId]
|
|
41
55
|
: undefined;
|
|
42
|
-
if (!task || !action) return { status: "unknown_action" };
|
|
56
|
+
if (!task || !stored || !action) return { status: "unknown_action" };
|
|
43
57
|
|
|
44
58
|
if (!actorUserId || actorUserId !== task.requestedByUserId) return { status: "forbidden" };
|
|
45
59
|
|
|
60
|
+
if (action.kind === "script") {
|
|
61
|
+
return await runTaskUiScriptAction({
|
|
62
|
+
task,
|
|
63
|
+
actionId,
|
|
64
|
+
action,
|
|
65
|
+
stored,
|
|
66
|
+
surface,
|
|
67
|
+
actorUserId,
|
|
68
|
+
slackUserId,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
46
72
|
const reserved = await reserveTaskUiActionRun({
|
|
47
73
|
taskId,
|
|
48
74
|
actionId,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { UI_SPEC_ACTION_ID, UI_SPEC_MAX_ACTIONS } from "../utils/task-ui-spec";
|
|
3
|
+
|
|
4
|
+
/** One declared card action, as an agent or a script sends it. */
|
|
5
|
+
export const TaskUiSpecActionInputSchema = z.discriminatedUnion("kind", [
|
|
6
|
+
z.object({ kind: z.literal("follow_up"), prompt: z.string().min(1).max(4000) }),
|
|
7
|
+
z.object({
|
|
8
|
+
kind: z.literal("script"),
|
|
9
|
+
script: z.string().min(1).max(200).describe("A global script named in UI_SPEC_SCRIPT_ACTIONS."),
|
|
10
|
+
args: z
|
|
11
|
+
.record(z.string(), z.unknown())
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Frozen script input, at most 4 KB of JSON. A click sends no input."),
|
|
14
|
+
}),
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The uiSpec an agent sends on store-progress, and the result a `script`
|
|
19
|
+
* action returns. Both paths share this schema.
|
|
20
|
+
*/
|
|
21
|
+
export const TaskUiSpecInputSchema = z.object({
|
|
22
|
+
spec: z
|
|
23
|
+
.object({
|
|
24
|
+
root: z.string().min(1),
|
|
25
|
+
elements: z.record(z.string(), z.unknown()),
|
|
26
|
+
state: z.record(z.string(), z.unknown()).optional(),
|
|
27
|
+
})
|
|
28
|
+
.describe("A json-render spec for the chat catalog. Root must be a Card."),
|
|
29
|
+
actions: z
|
|
30
|
+
.record(z.string().regex(UI_SPEC_ACTION_ID), TaskUiSpecActionInputSchema)
|
|
31
|
+
.refine((actions) => Object.keys(actions).length <= UI_SPEC_MAX_ACTIONS, {
|
|
32
|
+
message: `At most ${UI_SPEC_MAX_ACTIONS} actions.`,
|
|
33
|
+
})
|
|
34
|
+
.optional()
|
|
35
|
+
.describe(
|
|
36
|
+
`Actions that Button ids name, at most ${UI_SPEC_MAX_ACTIONS}. Needs UI_SPEC_ACTIONS_ENABLED=true. A \`script\` action also needs its script pinned in UI_SPEC_SCRIPT_ACTIONS.`,
|
|
37
|
+
),
|
|
38
|
+
});
|