@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bedrockProviderModule
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-8y43jx2r.js";
|
|
4
4
|
import {
|
|
5
5
|
auditAssetKeys,
|
|
6
6
|
init_asset_key_audit,
|
|
@@ -99,6 +99,9 @@ import {
|
|
|
99
99
|
isApiOnlyConfigKey,
|
|
100
100
|
isInternalConfigKey,
|
|
101
101
|
internalConfigKeyError,
|
|
102
|
+
isHumanOnlyConfigKey,
|
|
103
|
+
humanOnlyConfigKeyError,
|
|
104
|
+
humanOnlyConfigKeyPageError,
|
|
102
105
|
MAX_DB_RETENTION_DAYS,
|
|
103
106
|
DB_RETENTION_TUNING_BOUNDS,
|
|
104
107
|
CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS,
|
|
@@ -160,6 +163,9 @@ import {
|
|
|
160
163
|
init_key_paths,
|
|
161
164
|
rerank,
|
|
162
165
|
init_reranker,
|
|
166
|
+
isReviewTaskId,
|
|
167
|
+
dropReviewTaskCompletions,
|
|
168
|
+
init_review_recall_filter,
|
|
163
169
|
searchMemoryCandidates,
|
|
164
170
|
init_search_candidates,
|
|
165
171
|
getEmbeddingProvider2,
|
|
@@ -211,8 +217,6 @@ import {
|
|
|
211
217
|
init_vcs_repo_match,
|
|
212
218
|
taskModelPin,
|
|
213
219
|
init_model_pin,
|
|
214
|
-
normalizeModelKey,
|
|
215
|
-
init_pricing_normalize,
|
|
216
220
|
upsertModelCatalogOverlay,
|
|
217
221
|
deleteModelCatalogOverlay,
|
|
218
222
|
loadModelsCatalog,
|
|
@@ -259,6 +263,7 @@ import {
|
|
|
259
263
|
updateModelProfile,
|
|
260
264
|
modelProfileReferences,
|
|
261
265
|
modelProfileRefError,
|
|
266
|
+
isModelNameTakenError,
|
|
262
267
|
deleteModelProfile,
|
|
263
268
|
MAX_MODEL_PROFILE_FALLBACKS,
|
|
264
269
|
modelProfileFallbacksError,
|
|
@@ -485,7 +490,6 @@ import {
|
|
|
485
490
|
getAllUsers2,
|
|
486
491
|
createUser2,
|
|
487
492
|
updateUser2,
|
|
488
|
-
deleteUser2,
|
|
489
493
|
listInboxState2,
|
|
490
494
|
upsertInboxState2,
|
|
491
495
|
listFavorites2,
|
|
@@ -538,7 +542,7 @@ import {
|
|
|
538
542
|
countScriptRunJournalSteps2,
|
|
539
543
|
countScriptRunJournalAgentTaskSteps2,
|
|
540
544
|
init_db4
|
|
541
|
-
} from "./cli-
|
|
545
|
+
} from "./cli-wwp1bd3n.js";
|
|
542
546
|
import {
|
|
543
547
|
PRIMARY_ROLE_NAMES2,
|
|
544
548
|
OperatorGrantedTargetError2,
|
|
@@ -552,17 +556,26 @@ import {
|
|
|
552
556
|
assertNotLastAdmin2,
|
|
553
557
|
setUserRoles2,
|
|
554
558
|
init_rbac_roles
|
|
555
|
-
} from "./cli-
|
|
556
|
-
import
|
|
559
|
+
} from "./cli-vfqvrd82.js";
|
|
560
|
+
import {
|
|
561
|
+
MAX_MODEL_GROUP_MEMBERS,
|
|
562
|
+
listModelGroups,
|
|
563
|
+
getModelGroupByName,
|
|
564
|
+
createModelGroup,
|
|
565
|
+
updateModelGroup,
|
|
566
|
+
modelGroupReferences,
|
|
567
|
+
deleteModelGroup,
|
|
568
|
+
init_model_groups
|
|
569
|
+
} from "./cli-mys27d03.js";
|
|
557
570
|
import {
|
|
558
571
|
requestModelCatalogRefresh2,
|
|
559
572
|
init_pricing_refresh
|
|
560
|
-
} from "./cli-
|
|
573
|
+
} from "./cli-th1dkc2v.js";
|
|
561
574
|
import {
|
|
562
575
|
workflowEventBus2,
|
|
563
576
|
init_event_bus
|
|
564
577
|
} from "./cli-q2d3e1k1.js";
|
|
565
|
-
import"./cli-
|
|
578
|
+
import"./cli-mk7c5ac4.js";
|
|
566
579
|
import"./cli-9w8712tq.js";
|
|
567
580
|
import"./cli-47hz21se.js";
|
|
568
581
|
import {
|
|
@@ -600,7 +613,7 @@ import {
|
|
|
600
613
|
startSlackApp2,
|
|
601
614
|
stopSlackApp2,
|
|
602
615
|
init_app3
|
|
603
|
-
} from "./cli-
|
|
616
|
+
} from "./cli-539h29es.js";
|
|
604
617
|
import {
|
|
605
618
|
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
606
619
|
reconcileAgentMaxTasksPolicy,
|
|
@@ -628,12 +641,12 @@ import {
|
|
|
628
641
|
dispatchApprovalNotifications2,
|
|
629
642
|
createApprovalFollowUpTask2,
|
|
630
643
|
init_approval_notifications
|
|
631
|
-
} from "./cli-
|
|
644
|
+
} from "./cli-cc93xzes.js";
|
|
632
645
|
import {
|
|
633
646
|
retryFailedRun2,
|
|
634
647
|
cancelWorkflowRun2,
|
|
635
648
|
init_resume
|
|
636
|
-
} from "./cli-
|
|
649
|
+
} from "./cli-7r162fxe.js";
|
|
637
650
|
import {
|
|
638
651
|
DEFAULT_NEGOTIATED_PROTOCOL_VERSION,
|
|
639
652
|
SUPPORTED_PROTOCOL_VERSIONS,
|
|
@@ -717,6 +730,9 @@ import {
|
|
|
717
730
|
loadEnabledExtensions,
|
|
718
731
|
stopExtensionRuntime,
|
|
719
732
|
init_lifecycle,
|
|
733
|
+
dispatchPre2,
|
|
734
|
+
dispatchPost2,
|
|
735
|
+
init_dispatcher,
|
|
720
736
|
resolveIdentity,
|
|
721
737
|
renderIdentity,
|
|
722
738
|
init_identity,
|
|
@@ -731,13 +747,6 @@ import {
|
|
|
731
747
|
init_transcription,
|
|
732
748
|
isAgentOnDemand,
|
|
733
749
|
init_reachability,
|
|
734
|
-
nextFallback2,
|
|
735
|
-
createWorkerTaskFollowUp2,
|
|
736
|
-
createResumeFollowUp2,
|
|
737
|
-
init_worker_follow_up,
|
|
738
|
-
isGitHubEnabled,
|
|
739
|
-
initGitHub,
|
|
740
|
-
verifyWebhookSignature,
|
|
741
750
|
isAgentMailEnabled,
|
|
742
751
|
initAgentMail,
|
|
743
752
|
verifyAgentMailWebhook,
|
|
@@ -785,6 +794,9 @@ import {
|
|
|
785
794
|
handlePullRequestCommentCreated,
|
|
786
795
|
handlePullRequestClosed,
|
|
787
796
|
init_bitbucket,
|
|
797
|
+
isGitHubEnabled,
|
|
798
|
+
initGitHub,
|
|
799
|
+
verifyWebhookSignature,
|
|
788
800
|
handlePullRequest,
|
|
789
801
|
handleIssue,
|
|
790
802
|
handleComment,
|
|
@@ -860,12 +872,16 @@ import {
|
|
|
860
872
|
init_page_session,
|
|
861
873
|
resolveHttpRequestAuth,
|
|
862
874
|
init_auth,
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
875
|
+
getDeploymentEnvValue2,
|
|
876
|
+
loadGlobalConfigsIntoEnv2,
|
|
877
|
+
reloadGlobalConfigsAndIntegrations2,
|
|
878
|
+
scheduleIntegrationsReload2,
|
|
879
|
+
handleCore2,
|
|
868
880
|
init_core,
|
|
881
|
+
nextFallback2,
|
|
882
|
+
createWorkerTaskFollowUp2,
|
|
883
|
+
createResumeFollowUp2,
|
|
884
|
+
init_worker_follow_up,
|
|
869
885
|
MCP_MAX_TOOL_INPUT_ELEMENTS,
|
|
870
886
|
MCP_MAX_REQUEST_BODY_BYTES,
|
|
871
887
|
init_mcp_limits,
|
|
@@ -962,6 +978,8 @@ import {
|
|
|
962
978
|
init_access,
|
|
963
979
|
getLinksForMemory,
|
|
964
980
|
init_links_store,
|
|
981
|
+
attachDemotionEvidence,
|
|
982
|
+
init_demotion_evidence,
|
|
965
983
|
expandCandidatesWithGraph,
|
|
966
984
|
init_graph_expansion,
|
|
967
985
|
isApiDraining,
|
|
@@ -1044,6 +1062,8 @@ import {
|
|
|
1044
1062
|
discardImprovement,
|
|
1045
1063
|
improvementLeakHints,
|
|
1046
1064
|
init_improvements,
|
|
1065
|
+
recomputeSessionCost,
|
|
1066
|
+
init_session_cost_recompute,
|
|
1047
1067
|
canClaim,
|
|
1048
1068
|
init_budget_admission,
|
|
1049
1069
|
emitBudgetRefusalSideEffects,
|
|
@@ -1063,7 +1083,7 @@ import {
|
|
|
1063
1083
|
getEnabledCapabilities,
|
|
1064
1084
|
createServer,
|
|
1065
1085
|
init_server
|
|
1066
|
-
} from "./cli-
|
|
1086
|
+
} from "./cli-p0n7b5rz.js";
|
|
1067
1087
|
import {
|
|
1068
1088
|
FilesError,
|
|
1069
1089
|
normalizeFilesError,
|
|
@@ -1095,7 +1115,7 @@ import {
|
|
|
1095
1115
|
resolvePoolDelivery2,
|
|
1096
1116
|
createPoolAgent2,
|
|
1097
1117
|
init_db2
|
|
1098
|
-
} from "./cli-
|
|
1118
|
+
} from "./cli-s1zqk1aj.js";
|
|
1099
1119
|
import {
|
|
1100
1120
|
duplicateGuardedQueryKey,
|
|
1101
1121
|
warnIfCorsAllowsAnyOrigin,
|
|
@@ -1152,7 +1172,7 @@ import {
|
|
|
1152
1172
|
describeRequestRoute,
|
|
1153
1173
|
route,
|
|
1154
1174
|
init_route_def
|
|
1155
|
-
} from "./cli-
|
|
1175
|
+
} from "./cli-nstkanmx.js";
|
|
1156
1176
|
import {
|
|
1157
1177
|
startPoolRouting,
|
|
1158
1178
|
stopPoolRouting,
|
|
@@ -1165,17 +1185,17 @@ import {
|
|
|
1165
1185
|
checkHeartbeatChecklist2,
|
|
1166
1186
|
runHeartbeatSweep2,
|
|
1167
1187
|
stopHeartbeat2
|
|
1168
|
-
} from "./cli-
|
|
1169
|
-
import"./cli-
|
|
1188
|
+
} from "./cli-9fjr27ez.js";
|
|
1189
|
+
import"./cli-43evxwj4.js";
|
|
1170
1190
|
import {
|
|
1171
1191
|
runtimeSupervisorStatus,
|
|
1172
1192
|
startRuntimeSupervisor,
|
|
1173
1193
|
stopRuntimeSupervisor
|
|
1174
|
-
} from "./cli-
|
|
1194
|
+
} from "./cli-8st34zhr.js";
|
|
1175
1195
|
import {
|
|
1176
1196
|
TASK_TITLE_TIMEOUT_MS,
|
|
1177
1197
|
generateTaskTitle
|
|
1178
|
-
} from "./cli-
|
|
1198
|
+
} from "./cli-fcfbct2j.js";
|
|
1179
1199
|
import"./cli-ns59dc6r.js";
|
|
1180
1200
|
import {
|
|
1181
1201
|
ACP_TARGET_IDS
|
|
@@ -1196,7 +1216,7 @@ import {
|
|
|
1196
1216
|
isUnknownModelError,
|
|
1197
1217
|
checkProviderPoolKey,
|
|
1198
1218
|
writeSkillsToFilesystem
|
|
1199
|
-
} from "./cli-
|
|
1219
|
+
} from "./cli-sb4426be.js";
|
|
1200
1220
|
import {
|
|
1201
1221
|
AgentFsRequestError2,
|
|
1202
1222
|
resolveAgentFsSharedContext2,
|
|
@@ -1206,10 +1226,20 @@ import {
|
|
|
1206
1226
|
roleRank2,
|
|
1207
1227
|
agentFsRequest2,
|
|
1208
1228
|
resolveApiUrl2
|
|
1209
|
-
} from "./cli-
|
|
1229
|
+
} from "./cli-vq2eg24x.js";
|
|
1210
1230
|
import {
|
|
1211
1231
|
Anthropic
|
|
1212
1232
|
} from "./cli-t9ga4qmb.js";
|
|
1233
|
+
import"./cli-had1p04a.js";
|
|
1234
|
+
import {
|
|
1235
|
+
createUserMergeJob2,
|
|
1236
|
+
getUserMergeJob2,
|
|
1237
|
+
listUserMergeJobs2,
|
|
1238
|
+
findActiveUserMergeJob2,
|
|
1239
|
+
findFailedUserMergeJob2,
|
|
1240
|
+
requeueUserMergeJob2,
|
|
1241
|
+
runUserMergeJobs2
|
|
1242
|
+
} from "./cli-kbtzfrxj.js";
|
|
1213
1243
|
import {
|
|
1214
1244
|
isCodexOAuthConfigKey
|
|
1215
1245
|
} from "./cli-j4bwnpkm.js";
|
|
@@ -1220,7 +1250,7 @@ import {
|
|
|
1220
1250
|
import {
|
|
1221
1251
|
runTaskUiAction,
|
|
1222
1252
|
init_actions
|
|
1223
|
-
} from "./cli-
|
|
1253
|
+
} from "./cli-aw83sr40.js";
|
|
1224
1254
|
import {
|
|
1225
1255
|
RATING_MODEL_MAX_LENGTH,
|
|
1226
1256
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
@@ -1315,7 +1345,7 @@ import {
|
|
|
1315
1345
|
init_typecheck,
|
|
1316
1346
|
parseSkillContent,
|
|
1317
1347
|
init_skill_parser
|
|
1318
|
-
} from "./cli-
|
|
1348
|
+
} from "./cli-w1q68d8x.js";
|
|
1319
1349
|
import {
|
|
1320
1350
|
signalProcessGroup,
|
|
1321
1351
|
detachedProcessGroup,
|
|
@@ -1332,8 +1362,8 @@ import {
|
|
|
1332
1362
|
forceRefreshAuthorizationOrThrow,
|
|
1333
1363
|
forceRefreshTokenOrThrow,
|
|
1334
1364
|
init_ensure_token
|
|
1335
|
-
} from "./cli-
|
|
1336
|
-
import"./cli-
|
|
1365
|
+
} from "./cli-2rnd5j3t.js";
|
|
1366
|
+
import"./cli-jrbq4djp.js";
|
|
1337
1367
|
import {
|
|
1338
1368
|
automationIntegrationFixUrl,
|
|
1339
1369
|
preflightAutomation,
|
|
@@ -1352,7 +1382,7 @@ import {
|
|
|
1352
1382
|
definitionNodeIds,
|
|
1353
1383
|
validateDefinition,
|
|
1354
1384
|
init_definition2
|
|
1355
|
-
} from "./cli-
|
|
1385
|
+
} from "./cli-q5srsxq2.js";
|
|
1356
1386
|
import {
|
|
1357
1387
|
_fetchHolder,
|
|
1358
1388
|
CLIENT_ID,
|
|
@@ -1380,7 +1410,7 @@ import {
|
|
|
1380
1410
|
import {
|
|
1381
1411
|
createRuntimeProvider,
|
|
1382
1412
|
init_runtime_providers
|
|
1383
|
-
} from "./cli-
|
|
1413
|
+
} from "./cli-tvgqesec.js";
|
|
1384
1414
|
import {
|
|
1385
1415
|
require_content_type
|
|
1386
1416
|
} from "./cli-1jx0srjt.js";
|
|
@@ -1402,7 +1432,7 @@ import {
|
|
|
1402
1432
|
revokeMcpToken,
|
|
1403
1433
|
computeExpiresAt,
|
|
1404
1434
|
init_mcp_wrapper
|
|
1405
|
-
} from "./cli-
|
|
1435
|
+
} from "./cli-2v2zdm0a.js";
|
|
1406
1436
|
import"./cli-v41kn3cd.js";
|
|
1407
1437
|
import {
|
|
1408
1438
|
setBedrockProviderModule,
|
|
@@ -1427,6 +1457,7 @@ import {
|
|
|
1427
1457
|
unlinkIdentity,
|
|
1428
1458
|
mintToken,
|
|
1429
1459
|
revokeToken,
|
|
1460
|
+
revokeAllUserCredentials,
|
|
1430
1461
|
resolveUserByToken,
|
|
1431
1462
|
InvalidRuntimeTokenError,
|
|
1432
1463
|
mintSessionToken,
|
|
@@ -1439,13 +1470,11 @@ import {
|
|
|
1439
1470
|
revokeAgentTokens,
|
|
1440
1471
|
fingerprintApiKey,
|
|
1441
1472
|
init_users
|
|
1442
|
-
} from "./cli-
|
|
1473
|
+
} from "./cli-vsw91x06.js";
|
|
1443
1474
|
import {
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
init_amp_models
|
|
1448
|
-
} from "./cli-mjw0yf82.js";
|
|
1475
|
+
resolveGitHubHost,
|
|
1476
|
+
init_github_host
|
|
1477
|
+
} from "./cli-9ttx00s3.js";
|
|
1449
1478
|
import {
|
|
1450
1479
|
MAX_PROVIDER_QUOTA_ENTRIES,
|
|
1451
1480
|
ProviderQuotaCapacityError,
|
|
@@ -1495,6 +1524,7 @@ import {
|
|
|
1495
1524
|
ModelProfileNameSchema,
|
|
1496
1525
|
ModelProfileCredentialsSchema,
|
|
1497
1526
|
ModelProfileSchema,
|
|
1527
|
+
ModelGroupSchema,
|
|
1498
1528
|
ProviderErrorClassSchema,
|
|
1499
1529
|
ProfileCheckResultSchema,
|
|
1500
1530
|
SessionAccessSchema,
|
|
@@ -1510,6 +1540,8 @@ import {
|
|
|
1510
1540
|
AgentTaskSchema,
|
|
1511
1541
|
TaskAttachmentSchema,
|
|
1512
1542
|
UserSchema,
|
|
1543
|
+
UserMergeJobStatusSchema,
|
|
1544
|
+
UserMergeJobSchema,
|
|
1513
1545
|
RbacRoleSchema,
|
|
1514
1546
|
UserRbacRolesSchema,
|
|
1515
1547
|
UserCommsPrefsSchema,
|
|
@@ -1627,34 +1659,26 @@ import {
|
|
|
1627
1659
|
KvKeySchema,
|
|
1628
1660
|
KvEntrySchema,
|
|
1629
1661
|
init_types5
|
|
1630
|
-
} from "./cli-
|
|
1631
|
-
import {
|
|
1632
|
-
resolveGitHubHost,
|
|
1633
|
-
init_github_host
|
|
1634
|
-
} from "./cli-9ttx00s3.js";
|
|
1662
|
+
} from "./cli-y4ccxtz5.js";
|
|
1635
1663
|
import {
|
|
1636
1664
|
IDENTITY_FIELD_BUDGETS,
|
|
1637
1665
|
IdentityFieldBudgetError,
|
|
1638
1666
|
init_identity_field_budget
|
|
1639
|
-
} from "./cli-
|
|
1640
|
-
import {
|
|
1641
|
-
getSlackConfiguration,
|
|
1642
|
-
init_config4
|
|
1643
|
-
} from "./cli-eetzmsy5.js";
|
|
1667
|
+
} from "./cli-3aaeb78m.js";
|
|
1644
1668
|
import {
|
|
1645
1669
|
isSteeringEnabled2,
|
|
1646
1670
|
init_steering_enabled
|
|
1647
1671
|
} from "./cli-4sydckyj.js";
|
|
1672
|
+
import {
|
|
1673
|
+
getSlackConfiguration,
|
|
1674
|
+
init_config4
|
|
1675
|
+
} from "./cli-eetzmsy5.js";
|
|
1648
1676
|
import {
|
|
1649
1677
|
SUBSCRIPTION_PLANS_CHECKED_AT,
|
|
1650
1678
|
SUBSCRIPTION_PLANS,
|
|
1651
1679
|
isSubscriptionPlanId,
|
|
1652
1680
|
init_subscription_plans
|
|
1653
1681
|
} from "./cli-nh7x3133.js";
|
|
1654
|
-
import {
|
|
1655
|
-
getOpenRouterAttributionHeaders,
|
|
1656
|
-
init_openrouter_base_url
|
|
1657
|
-
} from "./cli-dfyv0jdy.js";
|
|
1658
1682
|
import {
|
|
1659
1683
|
MODEL_SCOPED_WINDOWS,
|
|
1660
1684
|
KEY_WIDE_WINDOWS,
|
|
@@ -1669,6 +1693,10 @@ import {
|
|
|
1669
1693
|
selectCredential,
|
|
1670
1694
|
init_credentials2
|
|
1671
1695
|
} from "./cli-psffsanb.js";
|
|
1696
|
+
import {
|
|
1697
|
+
getOpenRouterAttributionHeaders,
|
|
1698
|
+
init_openrouter_base_url
|
|
1699
|
+
} from "./cli-dfyv0jdy.js";
|
|
1672
1700
|
import {
|
|
1673
1701
|
interpolate,
|
|
1674
1702
|
init_template2,
|
|
@@ -1731,7 +1759,7 @@ import {
|
|
|
1731
1759
|
import {
|
|
1732
1760
|
init_package,
|
|
1733
1761
|
package_default
|
|
1734
|
-
} from "./cli-
|
|
1762
|
+
} from "./cli-3f8zbtqa.js";
|
|
1735
1763
|
import {
|
|
1736
1764
|
realtimeBus,
|
|
1737
1765
|
init_bus
|
|
@@ -8090,6 +8118,7 @@ var KEY_WINDOW_USAGE_SQL = `
|
|
|
8090
8118
|
SELECT NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, 0, 0, '', NULL, 0, sc.createdAt, NULL
|
|
8091
8119
|
FROM session_costs sc
|
|
8092
8120
|
WHERE (sc.credentialKeyType IS NULL OR sc.credentialKeySuffix IS NULL)
|
|
8121
|
+
AND sc.kind = 'harness'
|
|
8093
8122
|
AND sc.createdAt >= ? AND sc.createdAt < ?
|
|
8094
8123
|
LIMIT ${MAX_USAGE_ROWS + 1}`;
|
|
8095
8124
|
var emptyTokens = () => Object.fromEntries(["uncachedInput", "output", "cacheRead", "cacheWrite", "reasoning", "thinking"].map((name) => [
|
|
@@ -9298,7 +9327,7 @@ async function handleUsedBy(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
9298
9327
|
});
|
|
9299
9328
|
}
|
|
9300
9329
|
});
|
|
9301
|
-
|
|
9330
|
+
scheduleIntegrationsReload2();
|
|
9302
9331
|
const owner = await resolveHttpFavoriteOwner(req, myAgentId);
|
|
9303
9332
|
trackRelayed("used_by.consent_changed", {
|
|
9304
9333
|
granted,
|
|
@@ -9545,7 +9574,7 @@ async function handleRanking(req, res, pathSegments, queryParams) {
|
|
|
9545
9574
|
return true;
|
|
9546
9575
|
}
|
|
9547
9576
|
const { listing } = built;
|
|
9548
|
-
|
|
9577
|
+
scheduleIntegrationsReload2();
|
|
9549
9578
|
optIn.respond(res, 200, {
|
|
9550
9579
|
domain: listing.domain,
|
|
9551
9580
|
listing,
|
|
@@ -9563,7 +9592,7 @@ async function handleRanking(req, res, pathSegments, queryParams) {
|
|
|
9563
9592
|
await setEnabled(false);
|
|
9564
9593
|
if (listing)
|
|
9565
9594
|
emitOptedOut(listing.domain);
|
|
9566
|
-
|
|
9595
|
+
scheduleIntegrationsReload2();
|
|
9567
9596
|
optOut.respond(res, 200, { enabled: false });
|
|
9568
9597
|
return true;
|
|
9569
9598
|
}
|
|
@@ -9646,13 +9675,27 @@ async function maskConfigRead(req, configs, includeSecrets) {
|
|
|
9646
9675
|
async function ensureConfigAdmin(req, res, verb) {
|
|
9647
9676
|
return ensureHttpPermission(req, res, verb, verb === "config.write.any" ? "Writing swarm config requires the lead agent" : "Deleting swarm config requires the lead agent");
|
|
9648
9677
|
}
|
|
9678
|
+
async function ensureHumanOnlyConfigWrite(req, res, key) {
|
|
9679
|
+
if (!isHumanOnlyConfigKey(key))
|
|
9680
|
+
return true;
|
|
9681
|
+
const auth = getRequestAuth(req);
|
|
9682
|
+
if (auth?.page) {
|
|
9683
|
+
jsonError(res, humanOnlyConfigKeyPageError(key), 403);
|
|
9684
|
+
return false;
|
|
9685
|
+
}
|
|
9686
|
+
const userId = authUserId(auth);
|
|
9687
|
+
if (userId && (!isRbacEnabled() || (await getUserGrant2(userId)).grantsAll))
|
|
9688
|
+
return true;
|
|
9689
|
+
jsonError(res, humanOnlyConfigKeyError(key), 403);
|
|
9690
|
+
return false;
|
|
9691
|
+
}
|
|
9649
9692
|
async function runConfigWriteSideEffects(scope, key, value) {
|
|
9650
9693
|
if (scope !== "global")
|
|
9651
9694
|
return;
|
|
9652
9695
|
if (key === "SWARM_ORG_WEBSITE")
|
|
9653
9696
|
await fillOrgLogoFromWebsite(value);
|
|
9654
9697
|
await syncRankingAfterConfigChange(key, value);
|
|
9655
|
-
|
|
9698
|
+
scheduleIntegrationsReload2();
|
|
9656
9699
|
}
|
|
9657
9700
|
async function ensureHttpPermission(req, res, verb, forbiddenMessage, callerAgentId) {
|
|
9658
9701
|
const principal = await requestPrincipal(req, callerAgentId ?? singleHeader(req, "x-agent-id"), {
|
|
@@ -9867,7 +9910,7 @@ async function handleConfig(req, res, pathSegments, queryParams) {
|
|
|
9867
9910
|
}
|
|
9868
9911
|
if (reloadConfigRoute.match(req.method, pathSegments)) {
|
|
9869
9912
|
try {
|
|
9870
|
-
const result = await
|
|
9913
|
+
const result = await reloadGlobalConfigsAndIntegrations2();
|
|
9871
9914
|
console.log(`[reload-config] Loaded ${result.configsLoaded} config(s), re-initialized: ${result.integrationsReinitialized.join(", ") || "none"}`);
|
|
9872
9915
|
reloadConfigRoute.respond(res, 200, { success: true, ...result });
|
|
9873
9916
|
} catch (e) {
|
|
@@ -9918,6 +9961,8 @@ async function handleConfig(req, res, pathSegments, queryParams) {
|
|
|
9918
9961
|
if (!await ensureConfigAdmin(req, res, "config.write.any"))
|
|
9919
9962
|
return true;
|
|
9920
9963
|
const { scope, scopeId, key, value, isSecret, envPath, description, exportToEnv } = parsed.body;
|
|
9964
|
+
if (!await ensureHumanOnlyConfigWrite(req, res, key))
|
|
9965
|
+
return true;
|
|
9921
9966
|
const validationError = validateConfigEntry({ scope, scopeId, key, value, exportToEnv });
|
|
9922
9967
|
if (validationError) {
|
|
9923
9968
|
jsonError(res, validationError, 400);
|
|
@@ -9962,6 +10007,8 @@ async function handleConfig(req, res, pathSegments, queryParams) {
|
|
|
9962
10007
|
jsonError(res, internalConfigKeyError(existing.key).message, 400);
|
|
9963
10008
|
return true;
|
|
9964
10009
|
}
|
|
10010
|
+
if (!await ensureHumanOnlyConfigWrite(req, res, existing.key))
|
|
10011
|
+
return true;
|
|
9965
10012
|
const deleted = await deleteSwarmConfig2(parsed.params.id);
|
|
9966
10013
|
if (!deleted) {
|
|
9967
10014
|
jsonError(res, "Config not found", 404);
|
|
@@ -9969,7 +10016,7 @@ async function handleConfig(req, res, pathSegments, queryParams) {
|
|
|
9969
10016
|
}
|
|
9970
10017
|
if (existing.scope === "global") {
|
|
9971
10018
|
await syncRankingAfterConfigChange(existing.key, null);
|
|
9972
|
-
|
|
10019
|
+
scheduleIntegrationsReload2();
|
|
9973
10020
|
}
|
|
9974
10021
|
if (existing.scope === "agent" && existing.scopeId && existing.key === AGENT_MAX_TASKS_CONFIG_KEY) {
|
|
9975
10022
|
await resetAgentMaxTasksMirror(existing.scopeId);
|
|
@@ -10407,6 +10454,12 @@ async function handleApprovalRequests(req, res, pathSegments, queryParams) {
|
|
|
10407
10454
|
if ([...configAnswers.values()].some(({ answer }) => answer.action === "set")) {
|
|
10408
10455
|
if (!await ensureConfigAdmin(req, res, "config.write.any"))
|
|
10409
10456
|
return true;
|
|
10457
|
+
for (const { question, answer } of configAnswers.values()) {
|
|
10458
|
+
if (answer.action !== "set")
|
|
10459
|
+
continue;
|
|
10460
|
+
if (!await ensureHumanOnlyConfigWrite(req, res, question.config.key))
|
|
10461
|
+
return true;
|
|
10462
|
+
}
|
|
10410
10463
|
const userId = authUserId(getRequestAuth(req));
|
|
10411
10464
|
if (userId && isRbacEnabled()) {
|
|
10412
10465
|
const grant = await getUserGrant2(userId);
|
|
@@ -14261,7 +14314,8 @@ declare module "swarm-extension" {
|
|
|
14261
14314
|
runtimeInstanceId: string | undefined;
|
|
14262
14315
|
sourceTaskId: string | undefined;
|
|
14263
14316
|
contextKey: string | undefined;
|
|
14264
|
-
callOrigin: "mcp" | "extension" | "script-sdk";
|
|
14317
|
+
callOrigin: "mcp" | "native" | "extension" | "script-sdk";
|
|
14318
|
+
harness?: string | undefined;
|
|
14265
14319
|
};
|
|
14266
14320
|
|
|
14267
14321
|
import type { SwarmSdk } from "swarm-sdk";
|
|
@@ -14303,7 +14357,11 @@ declare module "swarm-extension" {
|
|
|
14303
14357
|
};
|
|
14304
14358
|
homepage?: string;
|
|
14305
14359
|
author?: string;
|
|
14360
|
+
/** Tool-call sources this extension's tool handlers receive. Default \`["mcp"]\`. */
|
|
14361
|
+
toolSources?: readonly ToolSource[];
|
|
14306
14362
|
}
|
|
14363
|
+
/** \`mcp\`: swarm MCP tools. \`native\`: harness built-ins reported by a worker shim. */
|
|
14364
|
+
export type ToolSource = "mcp" | "native";
|
|
14307
14365
|
export interface HooksModule {
|
|
14308
14366
|
default: SwarmExtension;
|
|
14309
14367
|
config?: z.ZodTypeAny;
|
|
@@ -14575,8 +14633,16 @@ declare module "swarm-extension" {
|
|
|
14575
14633
|
}
|
|
14576
14634
|
export interface ToolCallEvent {
|
|
14577
14635
|
tool: string;
|
|
14636
|
+
/** Secret-scrubbed on native calls: a secret reads as \`[REDACTED:<name>]\`. */
|
|
14578
14637
|
args: unknown;
|
|
14579
14638
|
requestInfo: RequestInfo;
|
|
14639
|
+
/** Native calls only: the harness's own tool name, such as \`Bash\`. */
|
|
14640
|
+
nativeTool?: string;
|
|
14641
|
+
/** Native calls only: the harness's own argument shape, secret-scrubbed. */
|
|
14642
|
+
rawArgs?: unknown;
|
|
14643
|
+
/** Native calls only: the harness's call id, and its parent for a nested call. */
|
|
14644
|
+
toolCallId?: string;
|
|
14645
|
+
parentToolCallId?: string;
|
|
14580
14646
|
}
|
|
14581
14647
|
export interface ToolCallModify {
|
|
14582
14648
|
args: unknown;
|
|
@@ -14706,6 +14772,8 @@ declare module "swarm-extension" {
|
|
|
14706
14772
|
export interface ToolCallCompletedEvent extends ToolCallEvent {
|
|
14707
14773
|
result: unknown;
|
|
14708
14774
|
durationMs: number;
|
|
14775
|
+
/** Native calls only: the harness reported the call as failed. */
|
|
14776
|
+
isError?: boolean;
|
|
14709
14777
|
}
|
|
14710
14778
|
export interface SwarmEventMap {
|
|
14711
14779
|
"pre.task.create": {
|
|
@@ -23647,6 +23715,7 @@ init_event_loop_lag();
|
|
|
23647
23715
|
init_memory();
|
|
23648
23716
|
init_access();
|
|
23649
23717
|
init_constants2();
|
|
23718
|
+
init_demotion_evidence();
|
|
23650
23719
|
|
|
23651
23720
|
// src/be/memory/edges-store.ts
|
|
23652
23721
|
init_db4();
|
|
@@ -23737,6 +23806,7 @@ async function hasRetrievalForTask(taskId, memoryId) {
|
|
|
23737
23806
|
}
|
|
23738
23807
|
|
|
23739
23808
|
// src/http/memory.ts
|
|
23809
|
+
init_review_recall_filter();
|
|
23740
23810
|
init_search_candidates();
|
|
23741
23811
|
|
|
23742
23812
|
// src/be/memory/usefulness-stats.ts
|
|
@@ -24573,6 +24643,9 @@ async function handleMemory(req, res, pathSegments, callerAgentId) {
|
|
|
24573
24643
|
const provider = getEmbeddingProvider2();
|
|
24574
24644
|
const store = getMemoryStore2();
|
|
24575
24645
|
const queryEmbedding = await provider.embed(query, { kind: "query" });
|
|
24646
|
+
const sourceTaskIdHeader = req.headers["x-source-task-id"];
|
|
24647
|
+
const sourceTaskId = Array.isArray(sourceTaskIdHeader) ? sourceTaskIdHeader[0] : sourceTaskIdHeader;
|
|
24648
|
+
const excludeReviewTaskCompletions = await isReviewTaskId(sourceTaskId);
|
|
24576
24649
|
const candidateLimit = Math.min(limit, 20) * CANDIDATE_SET_MULTIPLIER;
|
|
24577
24650
|
const candidates = await searchMemoryCandidates(store, queryEmbedding ?? new Float32Array(0), myAgentId, {
|
|
24578
24651
|
scope,
|
|
@@ -24580,18 +24653,18 @@ async function handleMemory(req, res, pathSegments, callerAgentId) {
|
|
|
24580
24653
|
source,
|
|
24581
24654
|
isLead: false,
|
|
24582
24655
|
queryText: query,
|
|
24583
|
-
keyPrefix
|
|
24656
|
+
keyPrefix,
|
|
24657
|
+
excludeReviewTaskCompletions
|
|
24584
24658
|
});
|
|
24585
|
-
const
|
|
24659
|
+
const graphExpanded = await expandCandidatesWithGraph(candidates, myAgentId, {
|
|
24586
24660
|
scope,
|
|
24587
24661
|
source,
|
|
24588
24662
|
keyPrefix,
|
|
24589
24663
|
isLead: false
|
|
24590
24664
|
});
|
|
24665
|
+
const expanded = await attachDemotionEvidence(excludeReviewTaskCompletions ? await dropReviewTaskCompletions(graphExpanded) : graphExpanded);
|
|
24591
24666
|
const resultLimit = Math.min(limit, 20);
|
|
24592
24667
|
const ranked = consumptionMode === "prompt" ? rerank(expanded, { limit: expanded.length }).map((r) => ({ r, eligible: memoryRelevance(r) > SIMILARITY_THRESHOLD })).sort((a, b) => Number(b.eligible) - Number(a.eligible)).slice(0, resultLimit).map(({ r }) => r) : rerank(expanded, { limit: resultLimit });
|
|
24593
|
-
const sourceTaskIdHeader = req.headers["x-source-task-id"];
|
|
24594
|
-
const sourceTaskId = Array.isArray(sourceTaskIdHeader) ? sourceTaskIdHeader[0] : sourceTaskIdHeader;
|
|
24595
24668
|
const contextKeyHeader = req.headers["x-context-key"];
|
|
24596
24669
|
const contextKey = Array.isArray(contextKeyHeader) ? contextKeyHeader[0] : contextKeyHeader;
|
|
24597
24670
|
if (sourceTaskId && intent) {
|
|
@@ -24668,7 +24741,9 @@ async function handleMemory(req, res, pathSegments, callerAgentId) {
|
|
|
24668
24741
|
if (pathNeedle) {
|
|
24669
24742
|
candidates = candidates.filter((c) => matchesPath(c.sourcePath));
|
|
24670
24743
|
}
|
|
24671
|
-
const ranked = rerank(candidates, {
|
|
24744
|
+
const ranked = rerank(await attachDemotionEvidence(candidates), {
|
|
24745
|
+
limit: candidates.length
|
|
24746
|
+
});
|
|
24672
24747
|
const page = ranked.slice(offset, offset + pageLimit);
|
|
24673
24748
|
listMemory.respond(res, 200, {
|
|
24674
24749
|
results: page.map((r) => ({
|
|
@@ -25612,6 +25687,224 @@ async function handleMetrics(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
25612
25687
|
return false;
|
|
25613
25688
|
}
|
|
25614
25689
|
|
|
25690
|
+
// src/http/model-groups.ts
|
|
25691
|
+
init_zod();
|
|
25692
|
+
init_audit_user();
|
|
25693
|
+
init_model_groups();
|
|
25694
|
+
init_rbac();
|
|
25695
|
+
init_types5();
|
|
25696
|
+
init_request_principal();
|
|
25697
|
+
init_route_def();
|
|
25698
|
+
init_utils2();
|
|
25699
|
+
var MembersSchema = array2(ModelProfileNameSchema).min(1).max(MAX_MODEL_GROUP_MEMBERS).describe("Profile names in preference order, first preferred. Any harness; no repeats.");
|
|
25700
|
+
var listGroups = route({
|
|
25701
|
+
method: "get",
|
|
25702
|
+
path: "/api/model-groups",
|
|
25703
|
+
pattern: ["api", "model-groups"],
|
|
25704
|
+
summary: "List model groups",
|
|
25705
|
+
description: "Every model group with its member profiles in order, by name.",
|
|
25706
|
+
tags: ["Models"],
|
|
25707
|
+
responses: {
|
|
25708
|
+
200: { description: "Model groups", schema: object2({ groups: array2(ModelGroupSchema) }) }
|
|
25709
|
+
}
|
|
25710
|
+
});
|
|
25711
|
+
var getGroup = route({
|
|
25712
|
+
method: "get",
|
|
25713
|
+
path: "/api/model-groups/{name}",
|
|
25714
|
+
pattern: ["api", "model-groups", null],
|
|
25715
|
+
summary: "Get one model group",
|
|
25716
|
+
tags: ["Models"],
|
|
25717
|
+
params: object2({ name: string2() }),
|
|
25718
|
+
responses: {
|
|
25719
|
+
200: { description: "The model group", schema: ModelGroupSchema },
|
|
25720
|
+
404: { description: "No group with that name" }
|
|
25721
|
+
}
|
|
25722
|
+
});
|
|
25723
|
+
var createGroup = route({
|
|
25724
|
+
method: "post",
|
|
25725
|
+
path: "/api/model-groups",
|
|
25726
|
+
pattern: ["api", "model-groups"],
|
|
25727
|
+
summary: "Create a model group",
|
|
25728
|
+
description: "A group is an ordered list of model profiles that may span harnesses. Every member must be an existing profile, listed once. The name may not be a model profile's (groups and profiles share one name space; 409). Lead, operator or dashboard user.",
|
|
25729
|
+
tags: ["Models"],
|
|
25730
|
+
rbac: { permission: "models.groups.write" },
|
|
25731
|
+
body: object2({
|
|
25732
|
+
name: ModelProfileNameSchema,
|
|
25733
|
+
description: string2().trim().max(500).nullable().optional(),
|
|
25734
|
+
members: MembersSchema
|
|
25735
|
+
}),
|
|
25736
|
+
responses: {
|
|
25737
|
+
201: { description: "Group created", schema: ModelGroupSchema },
|
|
25738
|
+
400: { description: "Validation error" },
|
|
25739
|
+
403: { description: "Forbidden" },
|
|
25740
|
+
409: { description: "A group or profile with that name exists" }
|
|
25741
|
+
}
|
|
25742
|
+
});
|
|
25743
|
+
var updateGroup = route({
|
|
25744
|
+
method: "patch",
|
|
25745
|
+
path: "/api/model-groups/{name}",
|
|
25746
|
+
pattern: ["api", "model-groups", null],
|
|
25747
|
+
summary: "Update a model group",
|
|
25748
|
+
description: "Changes the description (`null` clears it). The name is fixed; reorder or replace members with `PUT /api/model-groups/{name}/members`. Lead, operator or dashboard user.",
|
|
25749
|
+
tags: ["Models"],
|
|
25750
|
+
rbac: { permission: "models.groups.write" },
|
|
25751
|
+
params: object2({ name: string2() }),
|
|
25752
|
+
body: object2({ description: string2().trim().max(500).nullable() }),
|
|
25753
|
+
responses: {
|
|
25754
|
+
200: { description: "Group updated", schema: ModelGroupSchema },
|
|
25755
|
+
400: { description: "Validation error" },
|
|
25756
|
+
403: { description: "Forbidden" },
|
|
25757
|
+
404: { description: "No group with that name" }
|
|
25758
|
+
}
|
|
25759
|
+
});
|
|
25760
|
+
var setMembers = route({
|
|
25761
|
+
method: "put",
|
|
25762
|
+
path: "/api/model-groups/{name}/members",
|
|
25763
|
+
pattern: ["api", "model-groups", null, "members"],
|
|
25764
|
+
summary: "Replace a model group's members",
|
|
25765
|
+
description: "Replaces the whole ordered member list in one transaction; send the full list to reorder. Every member must be an existing profile, listed once. Lead, operator or dashboard user.",
|
|
25766
|
+
tags: ["Models"],
|
|
25767
|
+
rbac: { permission: "models.groups.write" },
|
|
25768
|
+
params: object2({ name: string2() }),
|
|
25769
|
+
body: object2({ members: MembersSchema }),
|
|
25770
|
+
responses: {
|
|
25771
|
+
200: { description: "Members replaced", schema: ModelGroupSchema },
|
|
25772
|
+
400: { description: "Validation error" },
|
|
25773
|
+
403: { description: "Forbidden" },
|
|
25774
|
+
404: { description: "No group with that name" }
|
|
25775
|
+
}
|
|
25776
|
+
});
|
|
25777
|
+
var deleteGroup = route({
|
|
25778
|
+
method: "delete",
|
|
25779
|
+
path: "/api/model-groups/{name}",
|
|
25780
|
+
pattern: ["api", "model-groups", null],
|
|
25781
|
+
summary: "Delete a model group",
|
|
25782
|
+
description: "Refused (409) for a shipped tier group (`smol`, `regular`, `smart`, `ultra`; edit it instead, it would come back at the next boot), and while a schedule names the group or a task holds it (unfinished, or superseded and still owed its resume). Lead, operator or dashboard user.",
|
|
25783
|
+
tags: ["Models"],
|
|
25784
|
+
rbac: { permission: "models.groups.write" },
|
|
25785
|
+
params: object2({ name: string2() }),
|
|
25786
|
+
responses: {
|
|
25787
|
+
200: { description: "Group deleted", schema: object2({ deleted: literal2(true) }) },
|
|
25788
|
+
403: { description: "Forbidden" },
|
|
25789
|
+
404: { description: "No group with that name" },
|
|
25790
|
+
409: { description: "The group is a seed or still in use" }
|
|
25791
|
+
}
|
|
25792
|
+
});
|
|
25793
|
+
async function canWriteGroups(req, res, myAgentId) {
|
|
25794
|
+
const decision = can({
|
|
25795
|
+
principal: await agentFirstPrincipal(req, myAgentId),
|
|
25796
|
+
verb: "models.groups.write",
|
|
25797
|
+
resource: { kind: "none" },
|
|
25798
|
+
source: "http"
|
|
25799
|
+
});
|
|
25800
|
+
if (!decision.allow) {
|
|
25801
|
+
jsonError(res, "Writing model groups requires the lead, the operator or a dashboard user", 403);
|
|
25802
|
+
return false;
|
|
25803
|
+
}
|
|
25804
|
+
return true;
|
|
25805
|
+
}
|
|
25806
|
+
var WRITE_FAILURE_STATUS = { invalid: 400, exists: 409, "name-taken": 409, missing: 404 };
|
|
25807
|
+
function writeFailed(res, result) {
|
|
25808
|
+
if (result.ok)
|
|
25809
|
+
return false;
|
|
25810
|
+
jsonError(res, result.error, WRITE_FAILURE_STATUS[result.reason]);
|
|
25811
|
+
return true;
|
|
25812
|
+
}
|
|
25813
|
+
async function handleModelGroups(req, res, pathSegments, queryParams, myAgentId) {
|
|
25814
|
+
if (listGroups.match(req.method, pathSegments)) {
|
|
25815
|
+
const parsed = await listGroups.parse(req, res, pathSegments, queryParams);
|
|
25816
|
+
if (!parsed)
|
|
25817
|
+
return true;
|
|
25818
|
+
listGroups.respond(res, 200, { groups: await listModelGroups() });
|
|
25819
|
+
return true;
|
|
25820
|
+
}
|
|
25821
|
+
if (getGroup.match(req.method, pathSegments)) {
|
|
25822
|
+
const parsed = await getGroup.parse(req, res, pathSegments, queryParams);
|
|
25823
|
+
if (!parsed)
|
|
25824
|
+
return true;
|
|
25825
|
+
const group = await getModelGroupByName(parsed.params.name);
|
|
25826
|
+
if (!group) {
|
|
25827
|
+
jsonError(res, "Model group not found", 404);
|
|
25828
|
+
return true;
|
|
25829
|
+
}
|
|
25830
|
+
getGroup.respond(res, 200, group);
|
|
25831
|
+
return true;
|
|
25832
|
+
}
|
|
25833
|
+
if (createGroup.match(req.method, pathSegments)) {
|
|
25834
|
+
const parsed = await createGroup.parse(req, res, pathSegments, queryParams);
|
|
25835
|
+
if (!parsed)
|
|
25836
|
+
return true;
|
|
25837
|
+
if (!await canWriteGroups(req, res, myAgentId))
|
|
25838
|
+
return true;
|
|
25839
|
+
const userId = await resolveHttpAuditUserId(req, myAgentId);
|
|
25840
|
+
const result = await createModelGroup(parsed.body, { userId });
|
|
25841
|
+
if (writeFailed(res, result))
|
|
25842
|
+
return true;
|
|
25843
|
+
createGroup.respond(res, 201, result.group);
|
|
25844
|
+
return true;
|
|
25845
|
+
}
|
|
25846
|
+
if (updateGroup.match(req.method, pathSegments)) {
|
|
25847
|
+
const parsed = await updateGroup.parse(req, res, pathSegments, queryParams);
|
|
25848
|
+
if (!parsed)
|
|
25849
|
+
return true;
|
|
25850
|
+
if (!await canWriteGroups(req, res, myAgentId))
|
|
25851
|
+
return true;
|
|
25852
|
+
const userId = await resolveHttpAuditUserId(req, myAgentId);
|
|
25853
|
+
const result = await updateModelGroup(parsed.params.name, { description: parsed.body.description }, { userId });
|
|
25854
|
+
if (writeFailed(res, result))
|
|
25855
|
+
return true;
|
|
25856
|
+
updateGroup.respond(res, 200, result.group);
|
|
25857
|
+
return true;
|
|
25858
|
+
}
|
|
25859
|
+
if (setMembers.match(req.method, pathSegments)) {
|
|
25860
|
+
const parsed = await setMembers.parse(req, res, pathSegments, queryParams);
|
|
25861
|
+
if (!parsed)
|
|
25862
|
+
return true;
|
|
25863
|
+
if (!await canWriteGroups(req, res, myAgentId))
|
|
25864
|
+
return true;
|
|
25865
|
+
const userId = await resolveHttpAuditUserId(req, myAgentId);
|
|
25866
|
+
const result = await updateModelGroup(parsed.params.name, { members: parsed.body.members }, { userId });
|
|
25867
|
+
if (writeFailed(res, result))
|
|
25868
|
+
return true;
|
|
25869
|
+
setMembers.respond(res, 200, result.group);
|
|
25870
|
+
return true;
|
|
25871
|
+
}
|
|
25872
|
+
if (deleteGroup.match(req.method, pathSegments)) {
|
|
25873
|
+
const parsed = await deleteGroup.parse(req, res, pathSegments, queryParams);
|
|
25874
|
+
if (!parsed)
|
|
25875
|
+
return true;
|
|
25876
|
+
if (!await canWriteGroups(req, res, myAgentId))
|
|
25877
|
+
return true;
|
|
25878
|
+
const current = await getModelGroupByName(parsed.params.name);
|
|
25879
|
+
if (!current) {
|
|
25880
|
+
jsonError(res, "Model group not found", 404);
|
|
25881
|
+
return true;
|
|
25882
|
+
}
|
|
25883
|
+
if (current.seededFrom?.startsWith("tier:")) {
|
|
25884
|
+
jsonError(res, `"${current.name}" is a shipped tier group and comes back at the next boot; edit it instead.`, 409);
|
|
25885
|
+
return true;
|
|
25886
|
+
}
|
|
25887
|
+
const refs = await modelGroupReferences(current.name);
|
|
25888
|
+
if (refs.openTaskCount > 0 || refs.scheduleIds.length > 0) {
|
|
25889
|
+
const schedules = refs.scheduleIds.length > 0 ? ` (${refs.scheduleIds.join(", ")})` : "";
|
|
25890
|
+
jsonError(res, `"${current.name}" is in use: held by ${refs.openTaskCount} unfinished or awaiting-resume task(s), named by ${refs.scheduleIds.length} schedule(s)${schedules}.`, 409);
|
|
25891
|
+
return true;
|
|
25892
|
+
}
|
|
25893
|
+
const outcome = await deleteModelGroup(current.name);
|
|
25894
|
+
if (outcome === "in-use") {
|
|
25895
|
+
jsonError(res, `"${current.name}" is in use by a task or a schedule written just now.`, 409);
|
|
25896
|
+
return true;
|
|
25897
|
+
}
|
|
25898
|
+
if (outcome === "missing") {
|
|
25899
|
+
jsonError(res, "Model group not found", 404);
|
|
25900
|
+
return true;
|
|
25901
|
+
}
|
|
25902
|
+
deleteGroup.respond(res, 200, { deleted: true });
|
|
25903
|
+
return true;
|
|
25904
|
+
}
|
|
25905
|
+
return false;
|
|
25906
|
+
}
|
|
25907
|
+
|
|
25615
25908
|
// src/http/model-profiles.ts
|
|
25616
25909
|
init_src2();
|
|
25617
25910
|
init_zod();
|
|
@@ -25657,7 +25950,7 @@ var createProfile = route({
|
|
|
25657
25950
|
path: "/api/model-profiles",
|
|
25658
25951
|
pattern: ["api", "model-profiles"],
|
|
25659
25952
|
summary: "Create a model profile",
|
|
25660
|
-
description: "A profile runs on one harness. `model` must run on that harness and be in the model catalog unless `allowCustomModel` is true (a gateway id, a fresh launch); a `latest:` alias is accepted and resolves at claim. `effort` must be a level the harness and model support. `credentials` pins which pooled keys the profile uses: per credential var of the harness, the last 5 characters of each allowed key (`CODEX_OAUTH` is not supported). `fallbacks` lists profiles on the same harness, in order, that a task on this profile hops to when a provider error (rate limit, seat, overload, auth, empty key pool) ends it; no repeats, no self, no cycle. Operator only (the shared API key).",
|
|
25953
|
+
description: "A profile runs on one harness. `model` must run on that harness and be in the model catalog unless `allowCustomModel` is true (a gateway id, a fresh launch); a `latest:` alias is accepted and resolves at claim. `effort` must be a level the harness and model support. `credentials` pins which pooled keys the profile uses: per credential var of the harness, the last 5 characters of each allowed key (`CODEX_OAUTH` is not supported). `fallbacks` lists profiles on the same harness, in order, that a task on this profile hops to when a provider error (rate limit, seat, overload, auth, empty key pool) ends it; no repeats, no self, no cycle. The name may not be a model group's (one name space; 409). Operator only (the shared API key).",
|
|
25661
25954
|
tags: ["Models"],
|
|
25662
25955
|
rbac: { permission: "models.profiles.write" },
|
|
25663
25956
|
body: object2({
|
|
@@ -25674,7 +25967,7 @@ var createProfile = route({
|
|
|
25674
25967
|
201: { description: "Profile created", schema: ModelProfileSchema },
|
|
25675
25968
|
400: { description: "Validation error" },
|
|
25676
25969
|
403: { description: "Forbidden" },
|
|
25677
|
-
409: { description: "A profile with that name exists" }
|
|
25970
|
+
409: { description: "A profile or model group with that name exists" }
|
|
25678
25971
|
}
|
|
25679
25972
|
});
|
|
25680
25973
|
var updateProfile = route({
|
|
@@ -25706,7 +25999,7 @@ var deleteProfile = route({
|
|
|
25706
25999
|
path: "/api/model-profiles/{name}",
|
|
25707
26000
|
pattern: ["api", "model-profiles", null],
|
|
25708
26001
|
summary: "Delete a model profile",
|
|
25709
|
-
description: "Refused (409) for a shipped `<harness>-<tier>` seed (edit it instead; it would come back at the next boot), and while an agent has the profile as its default, a schedule names it, another profile lists it as a fallback, or a task holds it (unfinished, or superseded and still owed its resume). Operator only (the shared API key).",
|
|
26002
|
+
description: "Refused (409) for a shipped `<harness>-<tier>` seed (edit it instead; it would come back at the next boot), and while an agent has the profile as its default, a schedule names it, another profile lists it as a fallback, a model group lists it as a member, or a task holds it (unfinished, or superseded and still owed its resume). Operator only (the shared API key).",
|
|
25710
26003
|
tags: ["Models"],
|
|
25711
26004
|
rbac: { permission: "models.profiles.write" },
|
|
25712
26005
|
params: object2({ name: string2() }),
|
|
@@ -25805,7 +26098,15 @@ async function handleModelProfiles(req, res, pathSegments, queryParams, myAgentI
|
|
|
25805
26098
|
if (fallbackError)
|
|
25806
26099
|
return { error: fallbackError };
|
|
25807
26100
|
return { created: await createModelProfile(body, { userId }) };
|
|
26101
|
+
}).catch((error) => {
|
|
26102
|
+
if (isModelNameTakenError(error))
|
|
26103
|
+
return { nameTaken: true };
|
|
26104
|
+
throw error;
|
|
25808
26105
|
});
|
|
26106
|
+
if ("nameTaken" in outcome) {
|
|
26107
|
+
jsonError(res, `"${body.name}" is a model group; profiles and groups share one name space.`, 409);
|
|
26108
|
+
return true;
|
|
26109
|
+
}
|
|
25809
26110
|
if (typeof outcome.error === "string") {
|
|
25810
26111
|
jsonError(res, outcome.error, 400);
|
|
25811
26112
|
return true;
|
|
@@ -25876,15 +26177,16 @@ async function handleModelProfiles(req, res, pathSegments, queryParams, myAgentI
|
|
|
25876
26177
|
return true;
|
|
25877
26178
|
}
|
|
25878
26179
|
const refs = await modelProfileReferences(current.name);
|
|
25879
|
-
if (refs.agentIds.length > 0 || refs.openTaskCount > 0 || refs.scheduleIds.length > 0 || refs.fallbackOf.length > 0) {
|
|
26180
|
+
if (refs.agentIds.length > 0 || refs.openTaskCount > 0 || refs.scheduleIds.length > 0 || refs.fallbackOf.length > 0 || refs.groups.length > 0) {
|
|
25880
26181
|
const schedules = refs.scheduleIds.length > 0 ? ` (${refs.scheduleIds.join(", ")})` : "";
|
|
25881
26182
|
const fallbackOf = refs.fallbackOf.length > 0 ? ` (${refs.fallbackOf.join(", ")})` : "";
|
|
25882
|
-
|
|
26183
|
+
const groups = refs.groups.length > 0 ? ` (${refs.groups.join(", ")})` : "";
|
|
26184
|
+
jsonError(res, `"${current.name}" is in use: default of ${refs.agentIds.length} agent(s), held by ${refs.openTaskCount} unfinished or awaiting-resume task(s), named by ${refs.scheduleIds.length} schedule(s)${schedules}, a fallback of ${refs.fallbackOf.length} profile(s)${fallbackOf}, a member of ${refs.groups.length} model group(s)${groups}.`, 409);
|
|
25883
26185
|
return true;
|
|
25884
26186
|
}
|
|
25885
26187
|
const outcome = await deleteModelProfile(current.name);
|
|
25886
26188
|
if (outcome === "in-use") {
|
|
25887
|
-
jsonError(res, `"${current.name}" is in use by a task, a schedule, an agent default
|
|
26189
|
+
jsonError(res, `"${current.name}" is in use by a task, a schedule, an agent default, a fallback list or a model group written just now.`, 409);
|
|
25888
26190
|
return true;
|
|
25889
26191
|
}
|
|
25890
26192
|
if (outcome === "missing") {
|
|
@@ -27430,9 +27732,9 @@ function embeddingsProvider(baseUrl) {
|
|
|
27430
27732
|
}
|
|
27431
27733
|
function deploymentEmbeddings() {
|
|
27432
27734
|
return {
|
|
27433
|
-
baseUrl:
|
|
27434
|
-
model:
|
|
27435
|
-
apiKey:
|
|
27735
|
+
baseUrl: getDeploymentEnvValue2("EMBEDDING_API_BASE_URL"),
|
|
27736
|
+
model: getDeploymentEnvValue2("EMBEDDING_MODEL") ?? "text-embedding-3-small",
|
|
27737
|
+
apiKey: getDeploymentEnvValue2("EMBEDDING_API_KEY") ?? process.env.OPENAI_API_KEY
|
|
27436
27738
|
};
|
|
27437
27739
|
}
|
|
27438
27740
|
function localDefault() {
|
|
@@ -27580,14 +27882,14 @@ async function updateMemoryState(preset, result, change) {
|
|
|
27580
27882
|
if (!configChanged)
|
|
27581
27883
|
return;
|
|
27582
27884
|
if (change?.kind === "restore") {
|
|
27583
|
-
await
|
|
27885
|
+
await loadGlobalConfigsIntoEnv2(true);
|
|
27584
27886
|
resetEmbeddingProvider2();
|
|
27585
27887
|
}
|
|
27586
|
-
|
|
27888
|
+
scheduleIntegrationsReload2();
|
|
27587
27889
|
}
|
|
27588
27890
|
function prefixChanges(model) {
|
|
27589
|
-
const sameModel = model ===
|
|
27590
|
-
return EMBEDDING_PREFIX_KEYS.filter((key) =>
|
|
27891
|
+
const sameModel = model === getDeploymentEnvValue2("EMBEDDING_MODEL");
|
|
27892
|
+
return EMBEDDING_PREFIX_KEYS.filter((key) => getDeploymentEnvValue2(key)).map((key) => ({
|
|
27591
27893
|
key,
|
|
27592
27894
|
value: sameModel ? null : ""
|
|
27593
27895
|
}));
|
|
@@ -27599,7 +27901,7 @@ async function handleMemoryProbe(body) {
|
|
|
27599
27901
|
const deployment = restore ? deploymentEmbeddings() : null;
|
|
27600
27902
|
const baseUrl = body.preset === "existing" ? deployment ? deployment.baseUrl : process.env.EMBEDDING_API_BASE_URL : body.baseUrl ?? preset?.baseUrl ?? process.env.EMBEDDING_API_BASE_URL ?? "https://api.openai.com/v1";
|
|
27601
27903
|
const model = body.preset === "existing" ? deployment?.model ?? process.env.EMBEDDING_MODEL ?? "text-embedding-3-small" : body.model ?? preset?.model ?? process.env.EMBEDDING_MODEL ?? "text-embedding-3-small";
|
|
27602
|
-
const configuredEndpoint = body.preset === "existing" && !!baseUrl && baseUrl ===
|
|
27904
|
+
const configuredEndpoint = body.preset === "existing" && !!baseUrl && baseUrl === getDeploymentEnvValue2("EMBEDDING_API_BASE_URL");
|
|
27603
27905
|
let endpoint;
|
|
27604
27906
|
try {
|
|
27605
27907
|
endpoint = configuredEndpoint ? new URL(baseUrl ?? "") : assertUrlSafe(baseUrl ?? "", publicEndpointSsrfOptions());
|
|
@@ -28648,20 +28950,29 @@ var runTaskUiActionRoute = route({
|
|
|
28648
28950
|
session: { taskParam: "id" },
|
|
28649
28951
|
rbac: { permission: "task.action.own" },
|
|
28650
28952
|
summary: "Run the action a task card Button declares",
|
|
28651
|
-
description: "Runs
|
|
28953
|
+
description: "Runs a task card action. Only the task requester may run it: a user token, or the operator key with the requester in `X-Swarm-User-Id`. Agent callers, and operator calls with no picked user, get 403. Needs UI_SPEC_ACTIONS_ENABLED=true. A `follow_up` action runs once per task and action. A `script` action re-runs its allowlisted script (UI_SPEC_SCRIPT_ACTIONS) and returns the new card; it can run again after a 30 s cooldown.",
|
|
28652
28954
|
tags: ["Tasks"],
|
|
28653
28955
|
params: object2({ id: string2(), actionId: string2() }),
|
|
28654
28956
|
responses: {
|
|
28655
28957
|
200: {
|
|
28656
|
-
description: "The
|
|
28958
|
+
description: "The follow-up started or already ran, or the script action replaced the card (`refreshed`, with the new `uiSpec`)",
|
|
28657
28959
|
schema: object2({
|
|
28658
|
-
status: _enum2(["started", "already_done"]),
|
|
28659
|
-
taskId: string2().optional()
|
|
28960
|
+
status: _enum2(["started", "already_done", "refreshed"]),
|
|
28961
|
+
taskId: string2().optional(),
|
|
28962
|
+
uiSpec: TaskUiSpecSchema.optional()
|
|
28660
28963
|
})
|
|
28661
28964
|
},
|
|
28662
|
-
403: {
|
|
28965
|
+
403: {
|
|
28966
|
+
description: "Only the task requester may run the action, or the action's script is not allowlisted or changed since it was allowlisted"
|
|
28967
|
+
},
|
|
28663
28968
|
404: { description: "Task or action not found" },
|
|
28664
|
-
409: {
|
|
28969
|
+
409: {
|
|
28970
|
+
description: "Card actions are turned off (UI_SPEC_ACTIONS_ENABLED), or the script action is already running (with `Retry-After`)"
|
|
28971
|
+
},
|
|
28972
|
+
422: { description: "The script failed or returned an invalid card; the old card stays" },
|
|
28973
|
+
429: {
|
|
28974
|
+
description: "The script action ran recently; `Retry-After` says when it can run again"
|
|
28975
|
+
}
|
|
28665
28976
|
}
|
|
28666
28977
|
});
|
|
28667
28978
|
var supersedeTaskRoute = route({
|
|
@@ -28670,7 +28981,7 @@ var supersedeTaskRoute = route({
|
|
|
28670
28981
|
pattern: ["api", "tasks", null, "supersede"],
|
|
28671
28982
|
session: { taskParam: "id" },
|
|
28672
28983
|
summary: "Supersede an in-progress task (terminate + spawn resume follow-up)",
|
|
28673
|
-
description: "Marks the original task `superseded` (terminal) and creates a fresh `taskType=\"resume\"` follow-up so a worker can pick up the work in a new provider session. Workflow-step tasks (those with `workflowRunStepId`) are carved out: the original is marked `failed` with reason `superseded_workflow_task` and no follow-up is created — the workflow engine's retry/failure policy applies, and the task moves to `superseded` once the engine queues the step's retry. With `reason: provider_fallback` (and its `errorClass`), the resume runs on the same agent with the next fallback profile that passes the profile check; when none is left, or the task is a workflow step, nothing changes and `kind: noFallback` tells the worker to fail the task itself, led by `failureReason` when set.",
|
|
28984
|
+
description: "Marks the original task `superseded` (terminal) and creates a fresh `taskType=\"resume\"` follow-up so a worker can pick up the work in a new provider session. Workflow-step tasks (those with `workflowRunStepId`) are carved out: the original is marked `failed` with reason `superseded_workflow_task` and no follow-up is created — the workflow engine's retry/failure policy applies, and the task moves to `superseded` once the engine queues the step's retry or the step ends without failing. With `reason: provider_fallback` (and its `errorClass`), the resume runs on the same agent with the next fallback profile that passes the profile check; when none is left, or the task is a workflow step, nothing changes and `kind: noFallback` tells the worker to fail the task itself, led by `failureReason` when set.",
|
|
28674
28985
|
tags: ["Tasks"],
|
|
28675
28986
|
params: object2({ id: string2() }),
|
|
28676
28987
|
body: object2({ reason: ResumeReasonSchema, errorClass: ProviderErrorClassSchema.optional() }).refine((body) => body.reason === "provider_fallback" === (body.errorClass !== undefined), {
|
|
@@ -29725,8 +30036,27 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29725
30036
|
runTaskUiActionRoute.respond(res, 200, { status: "already_done" });
|
|
29726
30037
|
return true;
|
|
29727
30038
|
case "started":
|
|
30039
|
+
case "refreshed":
|
|
29728
30040
|
runTaskUiActionRoute.respond(res, 200, result);
|
|
29729
30041
|
return true;
|
|
30042
|
+
case "not_allowlisted":
|
|
30043
|
+
jsonError(res, "This action's script is not allowlisted (UI_SPEC_SCRIPT_ACTIONS)", 403);
|
|
30044
|
+
return true;
|
|
30045
|
+
case "script_changed":
|
|
30046
|
+
jsonError(res, "This action's script changed since it was allowlisted; an admin must re-pin it in UI_SPEC_SCRIPT_ACTIONS", 403);
|
|
30047
|
+
return true;
|
|
30048
|
+
case "running":
|
|
30049
|
+
res.setHeader("Retry-After", String(result.retryAfterSec));
|
|
30050
|
+
jsonError(res, "This action is already running", 409);
|
|
30051
|
+
return true;
|
|
30052
|
+
case "rate_limited":
|
|
30053
|
+
res.setHeader("Retry-After", String(result.retryAfterSec));
|
|
30054
|
+
jsonError(res, `This action ran recently; try again in ${result.retryAfterSec}s`, 429);
|
|
30055
|
+
return true;
|
|
30056
|
+
case "script_failed":
|
|
30057
|
+
case "invalid_output":
|
|
30058
|
+
jsonError(res, `Refresh failed: ${result.error}`, 422);
|
|
30059
|
+
return true;
|
|
29730
30060
|
}
|
|
29731
30061
|
}
|
|
29732
30062
|
if (resumeTaskRoute.match(req.method, pathSegments)) {
|
|
@@ -33898,7 +34228,7 @@ var deletePoolKey = route({
|
|
|
33898
34228
|
var ENV_POOL_ERROR = "These keys come from the deployment env. Change them there.";
|
|
33899
34229
|
async function readPool(key) {
|
|
33900
34230
|
const [row] = await getSwarmConfigs2({ scope: "global", key });
|
|
33901
|
-
const envValue =
|
|
34231
|
+
const envValue = getDeploymentEnvValue2(key);
|
|
33902
34232
|
const source = row ? "stored" : envValue ? "env" : "none";
|
|
33903
34233
|
const value = row?.value ?? envValue ?? "";
|
|
33904
34234
|
registerEnvSecrets({ [key]: value });
|
|
@@ -41950,151 +42280,7 @@ init_request_auth_context();
|
|
|
41950
42280
|
init_secret_scrubber();
|
|
41951
42281
|
init_route_def();
|
|
41952
42282
|
init_session_access();
|
|
41953
|
-
|
|
41954
|
-
// src/http/session-cost-recompute.ts
|
|
41955
|
-
init_pricing_normalize();
|
|
41956
|
-
init_amp_models();
|
|
41957
|
-
var PER_MILLION = 1e6;
|
|
41958
|
-
var INCLUSIVE_INPUT_PROVIDERS = new Set(["codex"]);
|
|
41959
|
-
function cacheWriteSplit(input) {
|
|
41960
|
-
if (input.cacheWrite5mTokens == null || input.cacheWrite1hTokens == null)
|
|
41961
|
-
return null;
|
|
41962
|
-
const total = input.cacheWrite5mTokens + input.cacheWrite1hTokens;
|
|
41963
|
-
if (total === 0)
|
|
41964
|
-
return null;
|
|
41965
|
-
return {
|
|
41966
|
-
fiveMinuteRatio: input.cacheWrite5mTokens / total,
|
|
41967
|
-
oneHourRatio: input.cacheWrite1hTokens / total
|
|
41968
|
-
};
|
|
41969
|
-
}
|
|
41970
|
-
async function priceModel(provider, usage, split, atEpochMs, lookupRate) {
|
|
41971
|
-
const lookupModel = normalizeModelKey(provider, usage.model);
|
|
41972
|
-
const inputRate = await lookupRate(provider, lookupModel, "input", atEpochMs);
|
|
41973
|
-
const outputRate = await lookupRate(provider, lookupModel, "output", atEpochMs);
|
|
41974
|
-
if (inputRate == null || outputRate == null)
|
|
41975
|
-
return null;
|
|
41976
|
-
const cacheReadRate = await lookupRate(provider, lookupModel, "cached_input", atEpochMs) ?? 0;
|
|
41977
|
-
const uncachedInputTokens = INCLUSIVE_INPUT_PROVIDERS.has(provider) ? Math.max(0, usage.inputTokens - usage.cacheReadTokens) : usage.inputTokens;
|
|
41978
|
-
let cacheWriteCostUnits = 0;
|
|
41979
|
-
if (split) {
|
|
41980
|
-
const fiveMinuteTokens = usage.cacheWriteTokens * split.fiveMinuteRatio;
|
|
41981
|
-
const oneHourTokens = usage.cacheWriteTokens * split.oneHourRatio;
|
|
41982
|
-
const fiveMinuteRate = await lookupRate(provider, lookupModel, "cache_write", atEpochMs) ?? 0;
|
|
41983
|
-
const oneHourRate = await lookupRate(provider, lookupModel, "cache_write_1h", atEpochMs);
|
|
41984
|
-
if (oneHourTokens > 0 && oneHourRate == null)
|
|
41985
|
-
return null;
|
|
41986
|
-
cacheWriteCostUnits = fiveMinuteTokens * fiveMinuteRate + oneHourTokens * (oneHourRate ?? 0);
|
|
41987
|
-
} else {
|
|
41988
|
-
const cacheWriteRate = await lookupRate(provider, lookupModel, "cache_write", atEpochMs) ?? 0;
|
|
41989
|
-
cacheWriteCostUnits = usage.cacheWriteTokens * cacheWriteRate;
|
|
41990
|
-
}
|
|
41991
|
-
return (uncachedInputTokens * inputRate + usage.cacheReadTokens * cacheReadRate + cacheWriteCostUnits + usage.outputTokens * outputRate) / PER_MILLION;
|
|
41992
|
-
}
|
|
41993
|
-
function unpricedResult(input, modelBreakdown) {
|
|
41994
|
-
return {
|
|
41995
|
-
totalCostUsd: input.harnessCostUsd,
|
|
41996
|
-
costSource: "unpriced",
|
|
41997
|
-
modelBreakdown
|
|
41998
|
-
};
|
|
41999
|
-
}
|
|
42000
|
-
async function estimateAmpCost(input, lookupRate) {
|
|
42001
|
-
let selection;
|
|
42002
|
-
try {
|
|
42003
|
-
selection = resolveAmpModel(input.model);
|
|
42004
|
-
} catch {
|
|
42005
|
-
selection = undefined;
|
|
42006
|
-
}
|
|
42007
|
-
const candidates = [
|
|
42008
|
-
...new Set([
|
|
42009
|
-
selection?.pin,
|
|
42010
|
-
selection ? AMP_ESTIMATE_MODELS[selection.baseMode] : undefined,
|
|
42011
|
-
AMP_ESTIMATE_MODELS.medium
|
|
42012
|
-
])
|
|
42013
|
-
].filter((model) => !!model);
|
|
42014
|
-
for (const model of candidates) {
|
|
42015
|
-
const writes = ampBillsCacheWrites(model);
|
|
42016
|
-
const costUsd = await priceModel("amp", {
|
|
42017
|
-
model,
|
|
42018
|
-
inputTokens: input.inputTokens + (writes ? 0 : input.cacheWriteTokens),
|
|
42019
|
-
outputTokens: input.outputTokens,
|
|
42020
|
-
cacheReadTokens: input.cacheReadTokens,
|
|
42021
|
-
cacheWriteTokens: writes ? input.cacheWriteTokens : 0
|
|
42022
|
-
}, null, input.atEpochMs, lookupRate);
|
|
42023
|
-
if (costUsd != null)
|
|
42024
|
-
return { totalCostUsd: costUsd, costSource: "estimated", modelBreakdown: undefined };
|
|
42025
|
-
}
|
|
42026
|
-
return unpricedResult(input, undefined);
|
|
42027
|
-
}
|
|
42028
|
-
async function recomputeSessionCost(input, lookupRate) {
|
|
42029
|
-
const modelUsageEntries = input.models?.length ? input.models : undefined;
|
|
42030
|
-
const modelBreakdown = modelUsageEntries?.map((model) => ({ ...model }));
|
|
42031
|
-
if (!input.provider) {
|
|
42032
|
-
return {
|
|
42033
|
-
totalCostUsd: input.harnessCostUsd,
|
|
42034
|
-
costSource: "harness",
|
|
42035
|
-
modelBreakdown
|
|
42036
|
-
};
|
|
42037
|
-
}
|
|
42038
|
-
if ((input.provider === "amp" || input.provider === "grok" || input.harnessCostBilled) && input.harnessCostUsd > 0) {
|
|
42039
|
-
const priced = await recomputeSessionCost({ ...input, harnessCostUsd: 0, harnessCostBilled: false }, lookupRate);
|
|
42040
|
-
return {
|
|
42041
|
-
totalCostUsd: input.harnessCostUsd,
|
|
42042
|
-
costSource: "harness",
|
|
42043
|
-
modelBreakdown: priced.modelBreakdown
|
|
42044
|
-
};
|
|
42045
|
-
}
|
|
42046
|
-
if (input.provider === "acp" && input.harnessCostUsd > 0) {
|
|
42047
|
-
return { totalCostUsd: input.harnessCostUsd, costSource: "harness", modelBreakdown };
|
|
42048
|
-
}
|
|
42049
|
-
if (input.provider === "amp" && !modelUsageEntries)
|
|
42050
|
-
return estimateAmpCost(input, lookupRate);
|
|
42051
|
-
const split = cacheWriteSplit(input);
|
|
42052
|
-
const usages = modelUsageEntries ? modelUsageEntries : input.model ? [
|
|
42053
|
-
{
|
|
42054
|
-
model: input.model,
|
|
42055
|
-
inputTokens: input.inputTokens,
|
|
42056
|
-
outputTokens: input.outputTokens,
|
|
42057
|
-
cacheReadTokens: input.cacheReadTokens,
|
|
42058
|
-
cacheWriteTokens: input.cacheWriteTokens
|
|
42059
|
-
}
|
|
42060
|
-
] : [];
|
|
42061
|
-
if (usages.length === 0) {
|
|
42062
|
-
return {
|
|
42063
|
-
totalCostUsd: input.harnessCostUsd,
|
|
42064
|
-
costSource: "harness",
|
|
42065
|
-
modelBreakdown
|
|
42066
|
-
};
|
|
42067
|
-
}
|
|
42068
|
-
const pricedModels = [];
|
|
42069
|
-
let pricedCostUsd = 0;
|
|
42070
|
-
const hasWebSearchRequests = usages.some((usage) => (usage.webSearchRequests ?? 0) > 0);
|
|
42071
|
-
const webSearchRate = hasWebSearchRequests ? await lookupRate(input.provider, "*", "web_search", input.atEpochMs) : null;
|
|
42072
|
-
for (const usage of usages) {
|
|
42073
|
-
const tokenCostUsd = await priceModel(input.provider, usage, split, input.atEpochMs, lookupRate);
|
|
42074
|
-
if (tokenCostUsd == null)
|
|
42075
|
-
return unpricedResult(input, modelBreakdown);
|
|
42076
|
-
const webSearchCostUsd = (usage.webSearchRequests ?? 0) * (webSearchRate ?? 0) / PER_MILLION;
|
|
42077
|
-
const costUsd = tokenCostUsd + webSearchCostUsd;
|
|
42078
|
-
pricedCostUsd += costUsd;
|
|
42079
|
-
if (modelUsageEntries)
|
|
42080
|
-
pricedModels.push({ ...usage, costUsd });
|
|
42081
|
-
}
|
|
42082
|
-
let sessionFeesUsd = 0;
|
|
42083
|
-
const durationMs = input.durationMs ?? 0;
|
|
42084
|
-
if (input.provider === "claude-managed" && durationMs > 0) {
|
|
42085
|
-
const runtimeRate = await lookupRate(input.provider, "*", "runtime_hour", input.atEpochMs);
|
|
42086
|
-
if (runtimeRate == null)
|
|
42087
|
-
return unpricedResult(input, modelBreakdown);
|
|
42088
|
-
sessionFeesUsd += durationMs / 3600000 * (runtimeRate / PER_MILLION);
|
|
42089
|
-
}
|
|
42090
|
-
return {
|
|
42091
|
-
totalCostUsd: pricedCostUsd + sessionFeesUsd,
|
|
42092
|
-
costSource: "pricing-table",
|
|
42093
|
-
modelBreakdown: modelUsageEntries ? pricedModels : undefined
|
|
42094
|
-
};
|
|
42095
|
-
}
|
|
42096
|
-
|
|
42097
|
-
// src/http/session-data.ts
|
|
42283
|
+
init_session_cost_recompute();
|
|
42098
42284
|
init_utils2();
|
|
42099
42285
|
var SessionCostSummaryTotalsSchema = object2({
|
|
42100
42286
|
totalCostUsd: number2(),
|
|
@@ -45385,7 +45571,7 @@ async function handleTelemetryUi(req, res, pathSegments, queryParams, myAgentId)
|
|
|
45385
45571
|
await upsertSwarmConfig2({ scope: "global", key: "ANONYMIZED_TELEMETRY", value: "true" });
|
|
45386
45572
|
process.env.ANONYMIZED_TELEMETRY = "true";
|
|
45387
45573
|
await syncTelemetryEnabled(parsed.body.via);
|
|
45388
|
-
|
|
45574
|
+
scheduleIntegrationsReload2();
|
|
45389
45575
|
enableTelemetry.respond(res, 200, { enabled: isTelemetryEnabled() });
|
|
45390
45576
|
return true;
|
|
45391
45577
|
}
|
|
@@ -45414,6 +45600,116 @@ async function handleTelemetryUi(req, res, pathSegments, queryParams, myAgentId)
|
|
|
45414
45600
|
return true;
|
|
45415
45601
|
}
|
|
45416
45602
|
|
|
45603
|
+
// src/http/tool-hooks.ts
|
|
45604
|
+
init_zod();
|
|
45605
|
+
init_dispatcher();
|
|
45606
|
+
init_secret_scrubber();
|
|
45607
|
+
init_route_def();
|
|
45608
|
+
init_utils2();
|
|
45609
|
+
var REDACTION_MARKER = "[REDACTED:";
|
|
45610
|
+
var toolCallFields = {
|
|
45611
|
+
harness: string2().min(1).max(64).describe("Worker harness, such as `claude` or `pi`."),
|
|
45612
|
+
tool: string2().min(1).max(256).describe("Canonical tool name, such as `bash` or `edit`."),
|
|
45613
|
+
nativeTool: string2().min(1).max(256).optional().describe("The harness's own tool name."),
|
|
45614
|
+
args: unknown().describe("Canonical tool arguments."),
|
|
45615
|
+
rawArgs: unknown().optional().describe("The harness's own argument shape."),
|
|
45616
|
+
toolCallId: string2().max(256).optional(),
|
|
45617
|
+
parentToolCallId: string2().max(256).optional()
|
|
45618
|
+
};
|
|
45619
|
+
var toolHookBody = discriminatedUnion("phase", [
|
|
45620
|
+
object2({ phase: literal2("pre"), ...toolCallFields }),
|
|
45621
|
+
object2({
|
|
45622
|
+
phase: literal2("post"),
|
|
45623
|
+
...toolCallFields,
|
|
45624
|
+
result: unknown(),
|
|
45625
|
+
isError: boolean().optional(),
|
|
45626
|
+
durationMs: number2().nonnegative()
|
|
45627
|
+
})
|
|
45628
|
+
]);
|
|
45629
|
+
var toolHookDecision = discriminatedUnion("action", [
|
|
45630
|
+
object2({ action: literal2("continue") }),
|
|
45631
|
+
object2({ action: literal2("modify"), args: unknown() }),
|
|
45632
|
+
object2({ action: literal2("block"), reason: string2() })
|
|
45633
|
+
]);
|
|
45634
|
+
var toolHookRoute = route({
|
|
45635
|
+
method: "post",
|
|
45636
|
+
path: "/api/tool-hooks",
|
|
45637
|
+
pattern: ["api", "tool-hooks"],
|
|
45638
|
+
summary: "Run extension tool hooks for a harness-native tool call",
|
|
45639
|
+
description: "A worker shim reports a harness built-in tool call (bash, read, write, edit). `phase: pre` " + "runs `pre.tool.call` with `callOrigin: native` and returns the decision. `phase: post` runs " + "`post.tool.call` observe-only and returns 202 at once. Only extensions whose manifest " + '`toolSources` includes `"native"` receive these calls. The server runs the secret scrubber ' + "over the body before any handler sees it, so handlers read `[REDACTED:<name>]` in place of " + "a secret. A `modify` whose args still carry that marker is rejected and the call continues " + "unchanged. Shims must also scrub worker-side before sending.",
|
|
45640
|
+
tags: ["Extensions"],
|
|
45641
|
+
auth: { apiKey: true, agentId: true },
|
|
45642
|
+
body: toolHookBody,
|
|
45643
|
+
maxBodyBytes: 2 * 1024 * 1024,
|
|
45644
|
+
rbac: { ungated: "self-scoped: an agent reports its own harness tool calls" },
|
|
45645
|
+
responses: {
|
|
45646
|
+
200: { description: "Pre-call decision", schema: toolHookDecision },
|
|
45647
|
+
202: {
|
|
45648
|
+
description: "Post-call event accepted",
|
|
45649
|
+
schema: object2({ accepted: literal2(true) })
|
|
45650
|
+
},
|
|
45651
|
+
400: { description: "Invalid body or missing X-Agent-ID header" }
|
|
45652
|
+
}
|
|
45653
|
+
});
|
|
45654
|
+
function header3(req, name) {
|
|
45655
|
+
const raw = req.headers[name];
|
|
45656
|
+
return Array.isArray(raw) ? raw[0] : raw;
|
|
45657
|
+
}
|
|
45658
|
+
async function handleToolHooks(req, res, pathSegments, queryParams, myAgentId) {
|
|
45659
|
+
if (!toolHookRoute.match(req.method, pathSegments))
|
|
45660
|
+
return false;
|
|
45661
|
+
if (!myAgentId) {
|
|
45662
|
+
jsonError(res, "Missing X-Agent-ID header", 400);
|
|
45663
|
+
return true;
|
|
45664
|
+
}
|
|
45665
|
+
const parsed = await toolHookRoute.parse(req, res, pathSegments, queryParams);
|
|
45666
|
+
if (!parsed)
|
|
45667
|
+
return true;
|
|
45668
|
+
const body = scrubObject(parsed.body);
|
|
45669
|
+
const requestInfo = {
|
|
45670
|
+
sessionId: undefined,
|
|
45671
|
+
agentId: myAgentId,
|
|
45672
|
+
runtimeInstanceId: header3(req, "x-runtime-instance-id"),
|
|
45673
|
+
sourceTaskId: header3(req, "x-source-task-id"),
|
|
45674
|
+
contextKey: header3(req, "x-context-key"),
|
|
45675
|
+
callOrigin: "native",
|
|
45676
|
+
harness: body.harness
|
|
45677
|
+
};
|
|
45678
|
+
const event = {
|
|
45679
|
+
tool: body.tool,
|
|
45680
|
+
args: body.args,
|
|
45681
|
+
requestInfo,
|
|
45682
|
+
nativeTool: body.nativeTool,
|
|
45683
|
+
rawArgs: body.rawArgs,
|
|
45684
|
+
toolCallId: body.toolCallId,
|
|
45685
|
+
parentToolCallId: body.parentToolCallId
|
|
45686
|
+
};
|
|
45687
|
+
if (body.phase === "post") {
|
|
45688
|
+
toolHookRoute.respond(res, 202, { accepted: true });
|
|
45689
|
+
dispatchPost2("post.tool.call", {
|
|
45690
|
+
...event,
|
|
45691
|
+
result: body.result,
|
|
45692
|
+
isError: body.isError,
|
|
45693
|
+
durationMs: body.durationMs
|
|
45694
|
+
});
|
|
45695
|
+
return true;
|
|
45696
|
+
}
|
|
45697
|
+
const result = await dispatchPre2("pre.tool.call", event, {
|
|
45698
|
+
validateModify: (data) => JSON.stringify(data.args ?? null).includes(REDACTION_MARKER) ? {
|
|
45699
|
+
success: false,
|
|
45700
|
+
error: new Error(`Modified arguments for native tool "${body.tool}" contain a redaction marker`)
|
|
45701
|
+
} : { success: true, data }
|
|
45702
|
+
});
|
|
45703
|
+
if (result.action === "block") {
|
|
45704
|
+
toolHookRoute.respond(res, 200, { action: "block", reason: result.reason });
|
|
45705
|
+
} else if (result.action === "modify") {
|
|
45706
|
+
toolHookRoute.respond(res, 200, { action: "modify", args: result.data.args });
|
|
45707
|
+
} else {
|
|
45708
|
+
toolHookRoute.respond(res, 200, { action: "continue" });
|
|
45709
|
+
}
|
|
45710
|
+
return true;
|
|
45711
|
+
}
|
|
45712
|
+
|
|
45417
45713
|
// src/http/trackers/jira.ts
|
|
45418
45714
|
init_zod();
|
|
45419
45715
|
init_oauth();
|
|
@@ -46779,14 +47075,15 @@ var mergeUsersRoute = route({
|
|
|
46779
47075
|
method: "post",
|
|
46780
47076
|
path: "/api/users/{id}/merge",
|
|
46781
47077
|
pattern: ["api", "users", null, "merge"],
|
|
46782
|
-
summary: "Merge another user into this one
|
|
47078
|
+
summary: "Merge another user into this one: moves identities + email aliases, queues the rest",
|
|
47079
|
+
description: "Moves the source's identities and email aliases to the target, revokes the source's credentials and records a manual_merge event, all in one short transaction. The attribution rewrite across every table and the deletion of the source run as a background job; poll GET /api/users/merge-jobs/{jobId} until its status is done or failed. While the job runs, the source cannot authenticate and identity lookups resolve to the target.",
|
|
46783
47080
|
tags: ["Users"],
|
|
46784
47081
|
params: object2({ id: string2() }),
|
|
46785
47082
|
body: object2({ sourceUserId: string2().min(1) }),
|
|
46786
47083
|
responses: {
|
|
46787
|
-
|
|
46788
|
-
description: "
|
|
46789
|
-
schema: object2({
|
|
47084
|
+
202: {
|
|
47085
|
+
description: "The queued merge job",
|
|
47086
|
+
schema: object2({ job: UserMergeJobSchema })
|
|
46790
47087
|
},
|
|
46791
47088
|
400: { description: "Validation error (e.g. target == source)" },
|
|
46792
47089
|
401: { description: "Unauthorized" },
|
|
@@ -46794,7 +47091,45 @@ var mergeUsersRoute = route({
|
|
|
46794
47091
|
description: "Target holds an operator-granted role (auditor) and the caller is not the operator key"
|
|
46795
47092
|
},
|
|
46796
47093
|
404: { description: "Target or source user not found" },
|
|
46797
|
-
409: {
|
|
47094
|
+
409: {
|
|
47095
|
+
description: "Source is the last active admin (last_admin), or a merge job for the source or target is still running (merge_in_progress)"
|
|
47096
|
+
}
|
|
47097
|
+
},
|
|
47098
|
+
auth: { apiKey: true }
|
|
47099
|
+
});
|
|
47100
|
+
var listMergeJobsRoute = route({
|
|
47101
|
+
method: "get",
|
|
47102
|
+
path: "/api/users/merge-jobs",
|
|
47103
|
+
pattern: ["api", "users", "merge-jobs"],
|
|
47104
|
+
summary: "List background user merge jobs, newest first",
|
|
47105
|
+
tags: ["Users"],
|
|
47106
|
+
query: object2({
|
|
47107
|
+
status: UserMergeJobStatusSchema.optional(),
|
|
47108
|
+
limit: exports_coerce.number().int().min(1).max(200).optional()
|
|
47109
|
+
}),
|
|
47110
|
+
responses: {
|
|
47111
|
+
200: {
|
|
47112
|
+
description: "Merge jobs",
|
|
47113
|
+
schema: object2({ jobs: array2(UserMergeJobSchema) })
|
|
47114
|
+
},
|
|
47115
|
+
401: { description: "Unauthorized" }
|
|
47116
|
+
},
|
|
47117
|
+
auth: { apiKey: true }
|
|
47118
|
+
});
|
|
47119
|
+
var getMergeJobRoute = route({
|
|
47120
|
+
method: "get",
|
|
47121
|
+
path: "/api/users/merge-jobs/{jobId}",
|
|
47122
|
+
pattern: ["api", "users", "merge-jobs", null],
|
|
47123
|
+
summary: "A background user merge job (poll until status is done or failed)",
|
|
47124
|
+
tags: ["Users"],
|
|
47125
|
+
params: object2({ jobId: string2() }),
|
|
47126
|
+
responses: {
|
|
47127
|
+
200: {
|
|
47128
|
+
description: "The merge job",
|
|
47129
|
+
schema: object2({ job: UserMergeJobSchema })
|
|
47130
|
+
},
|
|
47131
|
+
401: { description: "Unauthorized" },
|
|
47132
|
+
404: { description: "Job not found" }
|
|
46798
47133
|
},
|
|
46799
47134
|
auth: { apiKey: true }
|
|
46800
47135
|
});
|
|
@@ -47416,6 +47751,29 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
47416
47751
|
}
|
|
47417
47752
|
return true;
|
|
47418
47753
|
}
|
|
47754
|
+
if (listMergeJobsRoute.match(req.method, pathSegments)) {
|
|
47755
|
+
const parsed = await listMergeJobsRoute.parse(req, res, pathSegments, queryParams);
|
|
47756
|
+
if (!parsed)
|
|
47757
|
+
return true;
|
|
47758
|
+
const jobs = await listUserMergeJobs2({
|
|
47759
|
+
status: parsed.query.status,
|
|
47760
|
+
limit: parsed.query.limit
|
|
47761
|
+
});
|
|
47762
|
+
listMergeJobsRoute.respond(res, 200, { jobs });
|
|
47763
|
+
return true;
|
|
47764
|
+
}
|
|
47765
|
+
if (getMergeJobRoute.match(req.method, pathSegments)) {
|
|
47766
|
+
const parsed = await getMergeJobRoute.parse(req, res, pathSegments, queryParams);
|
|
47767
|
+
if (!parsed)
|
|
47768
|
+
return true;
|
|
47769
|
+
const job = await getUserMergeJob2(parsed.params.jobId);
|
|
47770
|
+
if (!job) {
|
|
47771
|
+
jsonError(res, "Merge job not found", 404);
|
|
47772
|
+
return true;
|
|
47773
|
+
}
|
|
47774
|
+
getMergeJobRoute.respond(res, 200, { job });
|
|
47775
|
+
return true;
|
|
47776
|
+
}
|
|
47419
47777
|
if (mergeUsersRoute.match(req.method, pathSegments)) {
|
|
47420
47778
|
const parsed = await mergeUsersRoute.parse(req, res, pathSegments, queryParams);
|
|
47421
47779
|
if (!parsed)
|
|
@@ -47439,8 +47797,23 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
47439
47797
|
jsonError(res, "Source user not found", 404);
|
|
47440
47798
|
return true;
|
|
47441
47799
|
}
|
|
47800
|
+
if (targetBefore.mergedIntoUserId || await findActiveUserMergeJob2(sourceId) || await findActiveUserMergeJob2(targetId)) {
|
|
47801
|
+
jsonError(res, "merge_in_progress", 409);
|
|
47802
|
+
return true;
|
|
47803
|
+
}
|
|
47804
|
+
if (sourceBefore.mergedIntoUserId) {
|
|
47805
|
+
const failed = await findFailedUserMergeJob2(sourceId, targetId);
|
|
47806
|
+
if (failed) {
|
|
47807
|
+
const requeued = await requeueUserMergeJob2(failed.id);
|
|
47808
|
+
if (requeued) {
|
|
47809
|
+
runUserMergeJobs2();
|
|
47810
|
+
mergeUsersRoute.respond(res, 202, { job: requeued });
|
|
47811
|
+
return true;
|
|
47812
|
+
}
|
|
47813
|
+
}
|
|
47814
|
+
}
|
|
47442
47815
|
try {
|
|
47443
|
-
const
|
|
47816
|
+
const job = await getDbClient2().transaction(async () => {
|
|
47444
47817
|
await assertMayActOnOperatorGrantedTarget2(actor, targetId);
|
|
47445
47818
|
for (const ident of sourceBefore.identities) {
|
|
47446
47819
|
await unlinkIdentity(sourceId, ident.kind, ident.externalId, actor);
|
|
@@ -47469,7 +47842,8 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
47469
47842
|
}
|
|
47470
47843
|
}
|
|
47471
47844
|
await assertNotLastAdmin2(sourceId);
|
|
47472
|
-
await
|
|
47845
|
+
await revokeAllUserCredentials(sourceId, actor);
|
|
47846
|
+
await getDbClient2().run("UPDATE users SET mergedIntoUserId = ?, lastUpdatedAt = ? WHERE id = ?", [targetId, new Date().toISOString(), sourceId]);
|
|
47473
47847
|
const targetAfter = await composeUser(targetId);
|
|
47474
47848
|
await recordIdentityEvent(targetId, "manual_merge", actor, targetBefore, {
|
|
47475
47849
|
...targetAfter,
|
|
@@ -47479,9 +47853,17 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
47479
47853
|
email: sourceBefore.email
|
|
47480
47854
|
}
|
|
47481
47855
|
});
|
|
47482
|
-
|
|
47856
|
+
const queued = await createUserMergeJob2({
|
|
47857
|
+
sourceUserId: sourceId,
|
|
47858
|
+
targetUserId: targetId,
|
|
47859
|
+
createdBy: authUser(getRequestAuth(req))?.id ?? null
|
|
47860
|
+
});
|
|
47861
|
+
getDbClient2().afterCommit(() => {
|
|
47862
|
+
runUserMergeJobs2();
|
|
47863
|
+
});
|
|
47864
|
+
return queued;
|
|
47483
47865
|
});
|
|
47484
|
-
mergeUsersRoute.respond(res,
|
|
47866
|
+
mergeUsersRoute.respond(res, 202, { job });
|
|
47485
47867
|
} catch (err) {
|
|
47486
47868
|
if (respondOperatorGrantedRefusal(res, err))
|
|
47487
47869
|
return true;
|
|
@@ -49148,6 +49530,14 @@ var webhookTriggerRoute = route({
|
|
|
49148
49530
|
params: object2({ workflowId: string2() }),
|
|
49149
49531
|
auth: { apiKey: false },
|
|
49150
49532
|
responses: {
|
|
49533
|
+
200: {
|
|
49534
|
+
description: "Delivery skipped: its event is not in the trigger's `events` allowlist. No run was created.",
|
|
49535
|
+
schema: object2({
|
|
49536
|
+
skipped: literal2(true),
|
|
49537
|
+
reason: literal2("event-not-allowed"),
|
|
49538
|
+
event: string2().nullable()
|
|
49539
|
+
})
|
|
49540
|
+
},
|
|
49151
49541
|
201: { description: "Webhook processed", schema: object2({ runId: string2() }) },
|
|
49152
49542
|
401: { description: "Invalid signature" },
|
|
49153
49543
|
404: { description: "Workflow not found" }
|
|
@@ -49219,7 +49609,15 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
49219
49609
|
}
|
|
49220
49610
|
return true;
|
|
49221
49611
|
}
|
|
49222
|
-
|
|
49612
|
+
if (result.skipped) {
|
|
49613
|
+
webhookTriggerRoute.respond(res, 200, {
|
|
49614
|
+
skipped: true,
|
|
49615
|
+
reason: result.reason,
|
|
49616
|
+
event: result.event
|
|
49617
|
+
});
|
|
49618
|
+
} else {
|
|
49619
|
+
webhookTriggerRoute.respond(res, 201, { runId: result.runId });
|
|
49620
|
+
}
|
|
49223
49621
|
return true;
|
|
49224
49622
|
}
|
|
49225
49623
|
if (getWorkflowVersionRoute.match(req.method, pathSegments)) {
|
|
@@ -50084,6 +50482,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
50084
50482
|
() => handleMetrics(req, res, pathSegments, queryParams, myAgentId),
|
|
50085
50483
|
() => handleModelsCatalog(req, res, pathSegments, queryParams),
|
|
50086
50484
|
() => handleModelProfiles(req, res, pathSegments, queryParams, myAgentId),
|
|
50485
|
+
() => handleModelGroups(req, res, pathSegments, queryParams, myAgentId),
|
|
50087
50486
|
() => handleRepos(req, res, pathSegments, queryParams, myAgentId),
|
|
50088
50487
|
() => handleSkills(req, res, pathSegments, queryParams, myAgentId),
|
|
50089
50488
|
() => handleScriptConnections(req, res, pathSegments, queryParams, myAgentId),
|
|
@@ -50107,6 +50506,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
50107
50506
|
() => handleEvents(req, res, pathSegments, queryParams, myAgentId),
|
|
50108
50507
|
() => handleRuntimePools(req, res, pathSegments, queryParams, myAgentId),
|
|
50109
50508
|
() => handleExtensions(req, res, pathSegments, queryParams, myAgentId),
|
|
50509
|
+
() => handleToolHooks(req, res, pathSegments, queryParams, myAgentId),
|
|
50110
50510
|
() => handleChecklist(req, res, pathSegments, queryParams, myAgentId),
|
|
50111
50511
|
() => handleFavorites(req, res, pathSegments, queryParams, myAgentId),
|
|
50112
50512
|
() => handleUserRoles(req, res, pathSegments, queryParams),
|
|
@@ -50125,7 +50525,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
50125
50525
|
() => handleMcpUser(req, res, transportsUser, sessionUsers, transportActivityUser)
|
|
50126
50526
|
];
|
|
50127
50527
|
try {
|
|
50128
|
-
if (await
|
|
50528
|
+
if (await handleCore2(req, res, myAgentId, apiKey))
|
|
50129
50529
|
return;
|
|
50130
50530
|
myAgentId = req.headers["x-agent-id"];
|
|
50131
50531
|
for (const handler of handlers) {
|
|
@@ -50146,7 +50546,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
50146
50546
|
});
|
|
50147
50547
|
});
|
|
50148
50548
|
var detachRealtime = attachRealtimeTransport(httpServer);
|
|
50149
|
-
var { attachControllerTransport } = await import("./controllers-connect-
|
|
50549
|
+
var { attachControllerTransport } = await import("./controllers-connect-5v7qx04j.js");
|
|
50150
50550
|
var detachControllers = attachControllerTransport(httpServer);
|
|
50151
50551
|
var stopWorkerNudges = startWorkerNudgeListener();
|
|
50152
50552
|
var taskAutoTitles = startTaskAutoTitleListener();
|
|
@@ -50177,7 +50577,7 @@ async function shutdown() {
|
|
|
50177
50577
|
sessionsProcessed: getServerSessionsProcessed()
|
|
50178
50578
|
});
|
|
50179
50579
|
if (hasCapability("scheduling")) {
|
|
50180
|
-
const { stopScheduler } = await import("./index-
|
|
50580
|
+
const { stopScheduler } = await import("./index-rkvaambe.js");
|
|
50181
50581
|
stopScheduler();
|
|
50182
50582
|
}
|
|
50183
50583
|
stopHeartbeat2();
|
|
@@ -50189,7 +50589,7 @@ async function shutdown() {
|
|
|
50189
50589
|
await stopSlackApp2();
|
|
50190
50590
|
await stopChatSdk();
|
|
50191
50591
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
50192
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
50592
|
+
const { stopOAuthKeepalive } = await import("./keepalive-7yxg8z4c.js");
|
|
50193
50593
|
await stopOAuthKeepalive();
|
|
50194
50594
|
}
|
|
50195
50595
|
stopOAuthPendingGc();
|
|
@@ -50250,7 +50650,7 @@ startApiGcInterval();
|
|
|
50250
50650
|
startEventLoopLagProbe();
|
|
50251
50651
|
var startupConfigsInjected = [];
|
|
50252
50652
|
try {
|
|
50253
|
-
startupConfigsInjected = await
|
|
50653
|
+
startupConfigsInjected = await loadGlobalConfigsIntoEnv2(true);
|
|
50254
50654
|
} catch (err) {
|
|
50255
50655
|
console.error("[startup] Failed to load global swarm configs before listen:", err);
|
|
50256
50656
|
process.exitCode = 1;
|
|
@@ -50274,21 +50674,21 @@ try {
|
|
|
50274
50674
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
50275
50675
|
}
|
|
50276
50676
|
try {
|
|
50277
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
50677
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-nj9za0vk.js");
|
|
50278
50678
|
ensurePricingSeeded();
|
|
50279
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
50679
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-fzxvk2zf.js");
|
|
50280
50680
|
startPricingRefreshLoop();
|
|
50281
50681
|
} catch (err) {
|
|
50282
50682
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
50283
50683
|
}
|
|
50284
50684
|
try {
|
|
50285
|
-
const { ensureModelProfilesSeeded } = await import("./boot-seeds-
|
|
50685
|
+
const { ensureModelProfilesSeeded } = await import("./boot-seeds-nj9za0vk.js");
|
|
50286
50686
|
await ensureModelProfilesSeeded();
|
|
50287
50687
|
} catch (err) {
|
|
50288
50688
|
console.error("[startup] Failed to seed model profiles:", err);
|
|
50289
50689
|
}
|
|
50290
50690
|
try {
|
|
50291
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
50691
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-nj9za0vk.js");
|
|
50292
50692
|
ensureRbacSeeded();
|
|
50293
50693
|
} catch (err) {
|
|
50294
50694
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -50296,13 +50696,13 @@ try {
|
|
|
50296
50696
|
throw err;
|
|
50297
50697
|
}
|
|
50298
50698
|
try {
|
|
50299
|
-
const { runAllSeeders } = await import("./index-
|
|
50699
|
+
const { runAllSeeders } = await import("./index-ny60jcat.js");
|
|
50300
50700
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
50301
50701
|
} catch (err) {
|
|
50302
50702
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
50303
50703
|
}
|
|
50304
50704
|
try {
|
|
50305
|
-
const { runImports } = await import("./index-
|
|
50705
|
+
const { runImports } = await import("./index-p46tvwtx.js");
|
|
50306
50706
|
await runImports();
|
|
50307
50707
|
} catch (err) {
|
|
50308
50708
|
console.error("[startup] File import failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
@@ -50353,7 +50753,7 @@ httpServer.listen(port, async () => {
|
|
|
50353
50753
|
startChatSdk().catch((err) => {
|
|
50354
50754
|
console.error("[chat-sdk] Failed to start, continuing without Chat SDK:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
50355
50755
|
});
|
|
50356
|
-
import("./agent-fs-provision-
|
|
50756
|
+
import("./agent-fs-provision-tpj7sktd.js").then(({ syncAgentFsOrgSwarmUrl }) => syncAgentFsOrgSwarmUrl(getConfiguredAppUrls()[0])).catch((err) => {
|
|
50357
50757
|
console.warn("[agent-fs] Failed to set the org swarm URL:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
50358
50758
|
});
|
|
50359
50759
|
startQueueStallAlarm();
|
|
@@ -50368,25 +50768,25 @@ httpServer.listen(port, async () => {
|
|
|
50368
50768
|
await initWorkflows2();
|
|
50369
50769
|
await startScriptRunSupervisor(getMcpBaseUrl());
|
|
50370
50770
|
if (hasCapability("scheduling")) {
|
|
50371
|
-
const { startScheduler } = await import("./index-
|
|
50372
|
-
const { getExecutorRegistry } = await import("./index-
|
|
50771
|
+
const { startScheduler } = await import("./index-rkvaambe.js");
|
|
50772
|
+
const { getExecutorRegistry } = await import("./index-xj1mq27m.js");
|
|
50373
50773
|
const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
|
|
50374
50774
|
startScheduler(getExecutorRegistry(), intervalMs, {
|
|
50375
50775
|
runId: globalState.__runId
|
|
50376
50776
|
});
|
|
50377
50777
|
}
|
|
50378
50778
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
50379
|
-
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-
|
|
50779
|
+
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-48qzcqzj.js");
|
|
50380
50780
|
startHeartbeat(parseHeartbeatIntervalMs(process.env.HEARTBEAT_INTERVAL_MS));
|
|
50381
50781
|
}
|
|
50382
50782
|
startPoolRouting();
|
|
50383
50783
|
startRuntimeSupervisor();
|
|
50384
50784
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
50385
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
50785
|
+
const { startOAuthKeepalive } = await import("./keepalive-7yxg8z4c.js");
|
|
50386
50786
|
startOAuthKeepalive();
|
|
50387
50787
|
}
|
|
50388
50788
|
if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
|
|
50389
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
50789
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-70cavc3a.js");
|
|
50390
50790
|
startOAuthRefreshSweep();
|
|
50391
50791
|
}
|
|
50392
50792
|
startOAuthPendingGc();
|
|
@@ -50396,19 +50796,22 @@ httpServer.listen(port, async () => {
|
|
|
50396
50796
|
startSavingsRollup(savingsRollupSql);
|
|
50397
50797
|
startHumanFreeDrain();
|
|
50398
50798
|
startTaskSearchBackfill();
|
|
50399
|
-
import("./embedding-space-
|
|
50400
|
-
setDeploymentEnvReader(
|
|
50799
|
+
import("./embedding-space-e48xchqa.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
|
|
50800
|
+
setDeploymentEnvReader(getDeploymentEnvValue2);
|
|
50401
50801
|
return runEmbeddingMaintenance({ backfill: true });
|
|
50402
50802
|
}).catch((err) => {
|
|
50403
50803
|
console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
|
|
50404
50804
|
});
|
|
50405
|
-
import("./boot-args-schema-
|
|
50805
|
+
import("./boot-args-schema-qxmd59sr.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
|
|
50406
50806
|
console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
|
|
50407
50807
|
});
|
|
50408
|
-
import("./boot-scrub-sweep-
|
|
50808
|
+
import("./boot-scrub-sweep-25bxhnw4.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
50409
50809
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
50410
50810
|
});
|
|
50411
|
-
import("./
|
|
50811
|
+
import("./user-merge-jobs-bx6bf7db.js").then(({ resumeUserMergeJobs }) => resumeUserMergeJobs()).catch((err) => {
|
|
50812
|
+
console.error("[user-merge] startup resume failed (non-fatal):", err);
|
|
50813
|
+
});
|
|
50814
|
+
import("./session-source-backfill-82qe7fqq.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
|
|
50412
50815
|
console.error("[session-source-backfill] startup run failed (non-fatal):", err);
|
|
50413
50816
|
});
|
|
50414
50817
|
}).on("error", (err) => {
|