@desplega.ai/agent-swarm 2.7.8 → 2.7.10
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-srfhs1s9.js +16 -0
- package/dist/{actions-4m1ct4nh.js → actions-b8aqhrsg.js} +20 -19
- package/dist/{amp-adapter-txqh7eqj.js → amp-adapter-4c165vgn.js} +3 -3
- package/dist/{anthropic-messages-xey2skwx.js → anthropic-messages-jkva0zps.js} +68 -78
- package/dist/app-m9khefrh.js +20 -0
- package/dist/{assistant-gd08kr9e.js → assistant-rh4v3ntz.js} +22 -21
- package/dist/{azure-openai-responses-26t7j9ra.js → azure-openai-responses-wgtqkbr3.js} +5 -10
- package/dist/{boot-args-schema-tjrkpbvm.js → boot-args-schema-hwkc8bzv.js} +1 -1
- package/dist/{boot-reembed-21hbck22.js → boot-reembed-5y6yw9sj.js} +1 -1
- package/dist/{boot-reembed-mdxd3wgp.js → boot-reembed-fdyk55h4.js} +1 -1
- package/dist/{boot-scrub-sweep-qy0zr9t2.js → boot-scrub-sweep-r5r8kqsn.js} +4 -4
- package/dist/{boot-seeds-n46eaxdv.js → boot-seeds-8f9zt5cm.js} +5 -4
- package/dist/{boxd-nv507va8.js → boxd-qbkxy6ap.js} +1 -1
- package/dist/{claude-adapter-j37w2eds.js → claude-adapter-s5df247c.js} +8 -8
- package/dist/{claude-managed-adapter-8jvcma9a.js → claude-managed-adapter-h74d06yz.js} +4 -4
- package/dist/{claude-managed-setup-rzkjmgc1.js → claude-managed-setup-9gsmwzyx.js} +4 -4
- package/dist/{claude-sdk-session-4k7w73t0.js → claude-sdk-session-dq1j4nz9.js} +7901 -7718
- package/dist/{cli-s4ss5g59.js → cli-0m7rtm11.js} +5 -5
- package/dist/{cli-fzachfnf.js → cli-16phend6.js} +5 -5
- package/dist/{cli-yqefz277.js → cli-18qt3few.js} +1 -1
- package/dist/{cli-snpj5zbj.js → cli-1z4qggfe.js} +9 -36
- package/dist/{cli-s0qnd4wv.js → cli-28fq781p.js} +1 -1
- package/dist/{cli-1p89xny0.js → cli-2r0jcc3k.js} +1 -1
- package/dist/{cli-66ww7fer.js → cli-2tsfpc70.js} +1 -1
- package/dist/{cli-rvtm68yy.js → cli-2xv18ywz.js} +2 -2
- package/dist/{cli-kyr67fgx.js → cli-36wdfzgn.js} +18608 -9089
- package/dist/{cli-t60ajbbp.js → cli-38yww4e9.js} +20 -20
- package/dist/{cli-5xaqj21p.js → cli-3kd08rej.js} +1 -1
- package/dist/{cli-ae7mrdf9.js → cli-3vjhs18n.js} +4 -6
- package/dist/{cli-ssnjfg5p.js → cli-3xcwp3z8.js} +8 -10
- package/dist/{cli-rjknb2ae.js → cli-3xddv0rk.js} +6 -6
- package/dist/{cli-az48n0nr.js → cli-4caa1x7d.js} +67 -64
- package/dist/cli-4vwxp550.js +9321 -0
- package/dist/{cli-pz4rk021.js → cli-54vrpgm0.js} +1 -1
- package/dist/{cli-gvx71kqv.js → cli-55bkx8hh.js} +3 -3
- package/dist/{cli-r9jqcehk.js → cli-5mpy301f.js} +38 -2
- package/dist/{cli-bb0mmdk8.js → cli-5wfz00be.js} +35 -12
- package/dist/{cli-btfsp3mv.js → cli-5xcb8gxq.js} +9 -11
- package/dist/{cli-4t50yq3j.js → cli-6m6b4bep.js} +29 -12
- package/dist/cli-6pzk82fd.js +778 -0
- package/dist/{cli-8sdejs1f.js → cli-7wz05bx3.js} +797 -255
- package/dist/{cli-mkk9rnzz.js → cli-8bpgbr8k.js} +54 -7
- package/dist/{cli-fyhr5h4s.js → cli-8ewkreqd.js} +17 -13
- package/dist/{cli-p3vsj0d3.js → cli-an1knn2k.js} +15 -10
- package/dist/{cli-0ykgn1h5.js → cli-bxz823sz.js} +2 -2
- package/dist/{cli-jdv6ypxs.js → cli-bzvs88tv.js} +2 -2
- package/dist/{cli-bshb7jas.js → cli-cr14kftt.js} +3 -3
- package/dist/{cli-njwac61j.js → cli-cyn9v8zr.js} +12 -2
- package/dist/{cli-a22h291q.js → cli-d6521kb5.js} +1 -1
- package/dist/{cli-1b7btd38.js → cli-d84byzn8.js} +869 -5
- package/dist/{cli-84rj785g.js → cli-eb2azq8n.js} +9 -9
- package/dist/{cli-1cxrbkk6.js → cli-ed6yqpf1.js} +7 -9
- package/dist/{cli-wx3rhnm0.js → cli-eddnyg3t.js} +1 -1
- package/dist/{cli-ga786dzg.js → cli-eqk5p56g.js} +18 -17
- package/dist/{cli-mthwvjre.js → cli-f2zenhja.js} +1 -1
- package/dist/{cli-ferkkrg9.js → cli-fjggej24.js} +2 -2
- package/dist/{cli-g7s47cc5.js → cli-fsgttth8.js} +123 -102
- package/dist/{cli-269q28a1.js → cli-g1px1g2e.js} +27 -6
- package/dist/{cli-sq4n7af4.js → cli-h49ejvmc.js} +4 -6
- package/dist/{cli-5j0m12ns.js → cli-hfkwwy1h.js} +51 -15
- package/dist/{cli-agfm16v9.js → cli-hg42n3hx.js} +12 -12
- package/dist/{cli-yndmfxb3.js → cli-hxpyc9sn.js} +3 -3
- package/dist/{cli-w4xnbm46.js → cli-j7d73g1y.js} +414 -145
- package/dist/{cli-gazw7kpa.js → cli-jg24scat.js} +8 -10
- package/dist/{cli-5ja3b75e.js → cli-jrp1dt73.js} +1 -1
- package/dist/{cli-98rw5dt5.js → cli-jrzkw01m.js} +2 -2
- package/dist/{cli-583frbyr.js → cli-kchjb7qy.js} +1 -1
- package/dist/{cli-xr8908my.js → cli-kx4c8j05.js} +32 -17
- package/dist/{cli-fmjd0t1y.js → cli-m0cy2vyf.js} +2 -2
- package/dist/{cli-c0kqky8y.js → cli-m5akxq8q.js} +1 -1
- package/dist/{cli-ycscb2ar.js → cli-m88rpzkh.js} +2 -2
- package/dist/{cli-ppjxh6ah.js → cli-mp9aa8g5.js} +10 -12
- package/dist/{cli-xq9r2wtt.js → cli-mr97t7cc.js} +679 -247
- package/dist/{cli-z75yxkjh.js → cli-n07eecjs.js} +3 -3
- package/dist/{cli-7cx2m6t2.js → cli-n515ex5z.js} +16 -16
- package/dist/{cli-fy6x31ps.js → cli-n5yexkdg.js} +1 -0
- package/dist/{cli-bbw9wj9m.js → cli-n9abj89w.js} +17 -16
- package/dist/{cli-ypff1qwp.js → cli-n9ftpys4.js} +7 -7
- package/dist/{cli-32m9eda8.js → cli-nj3x45rw.js} +111 -109
- package/dist/{cli-6vcp76qk.js → cli-p74md7t8.js} +42 -23
- package/dist/{cli-rjcbm574.js → cli-pr0eze3x.js} +2 -2
- package/dist/{cli-dq8x79v8.js → cli-pyrxt9gw.js} +198 -3
- package/dist/{cli-m0hmeqma.js → cli-q581b386.js} +5 -5
- package/dist/{cli-8rpcng8j.js → cli-rjyghzg4.js} +8 -10
- package/dist/cli-rkc97c6a.js +39 -0
- package/dist/{cli-msg9m2ny.js → cli-rt0ag4x1.js} +9 -11
- package/dist/{cli-qd57hhhh.js → cli-rvhdmjvt.js} +6 -10
- package/dist/{cli-318r69gq.js → cli-t73cas91.js} +440 -9
- package/dist/{cli-q4ebh7h7.js → cli-td33w98c.js} +6 -6
- package/dist/{cli-zkky4t5g.js → cli-tmft5dz2.js} +2 -2
- package/dist/{cli-q26b9wre.js → cli-tph5wt3y.js} +4 -4
- package/dist/{cli-3e4snnzf.js → cli-ttbqe3q4.js} +1 -1
- package/dist/{cli-wemma3jd.js → cli-v2fwbnsk.js} +7 -7
- package/dist/cli-w3bk0dgv.js +5266 -0
- package/dist/{cli-8h0ayw8c.js → cli-x9exydey.js} +6 -6
- package/dist/{cli-85gzce7b.js → cli-xbtq4d6s.js} +287 -75
- package/dist/{cli-eyg1pa00.js → cli-xd5ebp64.js} +7 -7
- package/dist/{cli-g83s9ewh.js → cli-xfjrc279.js} +1 -1
- package/dist/{cli-7axf41jq.js → cli-xncjscpm.js} +40 -42
- package/dist/{cli-9m8hdawy.js → cli-xvymtmv4.js} +4 -4
- package/dist/{cli-81p9jd57.js → cli-yab6sh8p.js} +9 -3
- package/dist/{cli-srye3vdt.js → cli-ybjdc978.js} +1 -1
- package/dist/{cli-z1srzaf6.js → cli-yz7v0sh4.js} +70 -5
- package/dist/{cli-nbsf8yvn.js → cli-z9cs5m0w.js} +9 -9
- package/dist/{cli-k5671be5.js → cli-zcfpsfzf.js} +5 -5
- package/dist/{cli-vf078p3e.js → cli-zfqg6fzn.js} +1 -1
- package/dist/{cli-tpksw2nr.js → cli-zjphdj1a.js} +461 -108
- package/dist/cli.js +32 -52
- package/dist/{cloudflare-workers-ai-system-one-ef2a980q.js → cloudflare-workers-ai-system-one-9y1zx3pt.js} +2 -2
- package/dist/{codex-adapter-88z6psm4.js → codex-adapter-yr60sme6.js} +7 -7
- package/dist/{codex-login-74wa4hmq.js → codex-login-bcda78ge.js} +2 -2
- package/dist/{codex-session-runner-zwbcwzvx.js → codex-session-runner-pch8x584.js} +8 -8
- package/dist/{commands-7amxs716.js → commands-phjfbkv0.js} +3 -3
- package/dist/{controller-5rkkc37m.js → controller-jkx994pz.js} +4 -4
- package/dist/{controllers-connect-m7d4vxxb.js → controllers-connect-c4448kwa.js} +25 -24
- package/dist/{cursor-adapter-x1q18693.js → cursor-adapter-ndebqnm8.js} +2 -2
- package/dist/{db-athc68zt.js → db-ef32tbfc.js} +6 -2
- package/dist/{db-h2fsfve3.js → db-ez6egt6v.js} +3 -3
- package/dist/{devin-adapter-r9phbnc9.js → devin-adapter-z46ep5ph.js} +1 -1
- package/dist/{dispatcher-b1yz2bnn.js → dispatcher-g3tt9hs9.js} +19 -18
- package/dist/{docker-c1a3gqmf.js → docker-866qpzt9.js} +2 -2
- package/dist/{dsh-adapter-e33bkxq9.js → dsh-adapter-tcyn3099.js} +2 -2
- package/dist/{e2b-fr12yccx.js → e2b-jkwfhbcv.js} +2 -2
- package/dist/{e2b-x6ywzak3.js → e2b-s16txnpx.js} +2 -3
- package/dist/{easter-egg-3d-pv5qnzc8.js → easter-egg-3d-e36hk5td.js} +1 -1
- package/dist/{embedding-space-b4txbwrk.js → embedding-space-4kyh5qqj.js} +6 -6
- package/dist/{embeddings-m6zn6tad.js → embeddings-6a8v4a6t.js} +1 -1
- package/dist/{event-bus-g0ka3pbw.js → event-bus-e66gh7cc.js} +1 -1
- package/dist/{execute-68nwny8m.js → execute-3cbg0twf.js} +1 -1
- package/dist/{external-channel-gkckmhzh.js → external-channel-se646snz.js} +2 -2
- package/dist/fx-adapter-yw795hqq.js +19 -0
- package/dist/{google-generative-ai-v94hr7h0.js → google-generative-ai-h7s3e9kk.js} +7 -12
- package/dist/{google-vertex-g7vr6cf8.js → google-vertex-fhxaafzw.js} +7 -12
- package/dist/grok-adapter-ttmcss2j.js +19 -0
- package/dist/handlers-17wha3ze.js +33 -0
- package/dist/heartbeat-gwewgdms.js +42 -0
- package/dist/{hook-q5fv0jy2.js → hook-g3nhexsy.js} +16 -11
- package/dist/{hook-w0q2wcrv.js → hook-hq93y5ej.js} +5 -5
- package/dist/{http-bxat8dg3.js → http-5a9p4h6y.js} +808 -285
- package/dist/{index-pxn30mse.js → index-0eny15vj.js} +8 -8
- package/dist/{index-6cxzwfen.js → index-0rvk3vd4.js} +71 -71
- package/dist/{index-fvzke5kx.js → index-1qw6f2dc.js} +10 -10
- package/dist/{index-cqhqpgrv.js → index-3c5pxbge.js} +1 -1
- package/dist/{index-k7fj52d3.js → index-6haqt3v5.js} +12302 -11048
- package/dist/index-8arwq8mw.js +34 -0
- package/dist/{index-h7f61sy9.js → index-e5pfbsys.js} +3 -3
- package/dist/{index-bxrexmfy.js → index-hgn3c961.js} +14 -13
- package/dist/{index-h39zbx67.js → index-m5gx1xd6.js} +68 -68
- package/dist/{index-5fx3b3kw.js → index-rvccek1w.js} +9 -9
- package/dist/{index-fm0czesf.js → index-s72rqgsx.js} +1 -1
- package/dist/index-tpw054az.js +38 -0
- package/dist/{index-514d9pf6.js → index-w7em4ktq.js} +8 -8
- package/dist/index-waq75j2j.js +31 -0
- package/dist/{keepalive-qnt21cv0.js → keepalive-1j4n4dmk.js} +4 -4
- package/dist/lead-re73kdgc.js +72 -0
- package/dist/{llama-cpp-classify-s5c47rwh.js → llama-cpp-classify-nfgswa1m.js} +2 -2
- package/dist/{maintenance-btdr68y4.js → maintenance-dmghacy5.js} +1 -1
- package/dist/{mistral-conversations-3gjpdb4b.js → mistral-conversations-a45tx39a.js} +29 -51
- package/dist/{oauth-refresh-sweep-vczabeh4.js → oauth-refresh-sweep-yy06c03c.js} +3 -3
- package/dist/{onboard-k33ezyq8.js → onboard-52f9t5dm.js} +68 -16
- package/dist/{openai-codex-responses-8pbxq9h5.js → openai-codex-responses-k9gapdze.js} +7 -11
- package/dist/{openai-completions-rm00s912.js → openai-completions-xd579js7.js} +50 -58
- package/dist/{openai-decisions-8v957r2r.js → openai-decisions-q3hh60wr.js} +2 -2
- package/dist/{openai-responses-agxpf96k.js → openai-responses-4d5dx3c7.js} +5 -10
- package/dist/{opencode-adapter-3dst2ka7.js → opencode-adapter-krnh9jkn.js} +6 -6
- package/dist/{openrouter-images-3ecegv0d.js → openrouter-images-xr9gme9x.js} +4 -3
- package/dist/{otel-impl-13am7a65.js → otel-impl-xjqz6wjj.js} +2 -2
- package/dist/{pi-messages-pchtw4he.js → pi-messages-hjbv8v10.js} +28 -12
- package/dist/{pi-mono-adapter-c53de1gd.js → pi-mono-adapter-dbxyp0qv.js} +23 -26
- package/dist/{pricing-refresh-9fcbnq3f.js → pricing-refresh-ctdr74pd.js} +3 -3
- package/dist/{rbac-roles-66j5h4y5.js → rbac-roles-ehv8s10n.js} +12 -3
- package/dist/{rbac-roles-gw0p9h3j.js → rbac-roles-q0gr8eyj.js} +16 -2
- package/dist/{render-v2-fg8bmdn4.js → render-v2-5b6chvcq.js} +9 -4
- package/dist/{resume-1c8kr3nh.js → resume-5a5d2845.js} +7 -7
- package/dist/{runtime-tzf9j7tc.js → runtime-khxszyfp.js} +1 -1
- package/dist/{session-access-d0atq10j.js → session-access-gj0bjhqg.js} +4 -4
- package/dist/{session-source-backfill-0vscqmsa.js → session-source-backfill-2sy0krfk.js} +3 -3
- package/dist/{setup-tvfa7rwe.js → setup-7ssfakk1.js} +1 -1
- package/dist/{typesafe-system-one-0bmqcxfg.js → typesafe-system-one-f2en2knd.js} +2 -2
- package/dist/virtual-modules-pjj0knwf.js +362 -0
- package/dist/{work-objects-ks71xqeb.js → work-objects-bf3syvhq.js} +22 -21
- package/dist/{worker-follow-up-bfx0h9hg.js → worker-follow-up-38xevga6.js} +19 -18
- package/dist/worker-r8mz7a65.js +72 -0
- package/dist/{x-vmmye1kb.js → x-2fyrt5pp.js} +2 -2
- package/openapi.json +1169 -257
- package/package.json +9 -11
- package/src/apps/catalog.generated.json +354 -82
- package/src/apps/page-validator.ts +134 -2
- package/src/assets/key.ts +77 -4
- package/src/be/connector-codes.ts +21 -6
- package/src/be/db/session-labels.ts +57 -0
- package/src/be/db/session-tree.ts +51 -7
- package/src/be/db/slack-trees.ts +146 -0
- package/src/be/db/tasks/read.ts +124 -7
- package/src/be/db-client.ts +8 -2
- package/src/be/db.ts +99 -86
- package/src/be/event-loop-lag.ts +146 -0
- package/src/be/improvements.ts +416 -0
- package/src/be/mcp-overflow-sweep.ts +2 -1
- package/src/be/memory/providers/sqlite-store.ts +39 -8
- package/src/be/migrations/274_improvements.sql +27 -0
- package/src/be/migrations/275_task_dispatched_by.sql +8 -0
- package/src/be/migrations/278_slack_render_v2_reconcile.sql +108 -0
- package/src/be/rbac-roles.ts +123 -1
- package/src/be/swarm-config-guard.ts +3 -0
- package/src/be/users.ts +58 -1
- package/src/cli.tsx +5 -25
- package/src/commands/codex-login.ts +1 -1
- package/src/commands/context-preamble.ts +258 -0
- package/src/commands/e2b.ts +0 -1
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/compose-generator.ts +0 -1
- package/src/commands/onboard/dashboard-url.ts +31 -0
- package/src/commands/onboard/steps/generate.tsx +17 -1
- package/src/commands/onboard/steps/post-dashboard.tsx +9 -3
- package/src/commands/onboard.tsx +19 -6
- package/src/commands/runner.ts +117 -96
- package/src/extensions/catalog.generated.json +3 -3
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/heartbeat/heartbeat.ts +5 -4
- package/src/hooks/hook.ts +13 -5
- package/src/http/all-routes.ts +1 -0
- package/src/http/approval-requests.ts +2 -44
- package/src/http/auth.ts +5 -4
- package/src/http/codex-oauth-accounts.ts +31 -23
- package/src/http/codex-oauth-device.ts +1 -1
- package/src/http/codex-oauth-keep-warm.ts +1 -1
- package/src/http/core.ts +9 -3
- package/src/http/improvements.ts +317 -0
- package/src/http/index.ts +12 -6
- package/src/http/memory.ts +9 -4
- package/src/http/operator-actor.ts +2 -1
- package/src/http/person-responder.ts +66 -0
- package/src/http/sessions.ts +65 -10
- package/src/http/tasks.ts +1 -1
- package/src/http/user-roles.ts +11 -2
- package/src/http/users.ts +194 -104
- package/src/http/utils.ts +18 -0
- package/src/http/webhooks.ts +48 -0
- package/src/integrations/chat-sdk/commands.ts +167 -31
- package/src/integrations/chat-sdk/inbound.ts +10 -8
- package/src/integrations/chat-sdk/message-text.ts +117 -0
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/codex-adapter.ts +8 -1
- package/src/providers/codex-models.ts +4 -3
- package/src/providers/codex-oauth/auth-json.ts +14 -18
- package/src/providers/codex-oauth/storage.ts +2 -2
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/rbac/legacy-policy.ts +2 -0
- package/src/rbac/permissions.ts +10 -0
- package/src/scheduler/scheduler.ts +4 -1
- package/src/scripts-runtime/executors/quickjs-runner.ts +2 -0
- package/src/scripts-runtime/executors/quickjs-structured-clone.ts +180 -0
- package/src/scripts-runtime/quickjs-compat.ts +0 -1
- package/src/scripts-runtime/types/swarm-extension.d.ts +2 -0
- package/src/server.ts +2 -0
- package/src/slack/ack.ts +20 -14
- package/src/slack/app.ts +332 -10
- package/src/slack/handlers.ts +9 -2
- package/src/slack/index.ts +7 -1
- package/src/slack/lifecycle-lock.ts +29 -0
- package/src/slack/render-v2.ts +466 -229
- package/src/slack/socket-fence.ts +64 -0
- package/src/slack/watcher.ts +42 -8
- package/src/tests/api-drain-worker-e2e.test.ts +69 -2
- package/src/tests/apps-catalog-drift.test.ts +35 -0
- package/src/tests/apps-catalog-table.test.ts +203 -0
- package/src/tests/apps-element-assembly.test.ts +28 -0
- package/src/tests/apps-schema-form.test.ts +151 -0
- package/src/tests/apps-smart-links.test.ts +151 -0
- package/src/tests/apps-table-filters-migration.test.ts +96 -0
- package/src/tests/apps-table-selection-migration.test.ts +95 -0
- package/src/tests/chat-sdk-commands.test.ts +359 -2
- package/src/tests/chat-sdk-inbound.test.ts +20 -0
- package/src/tests/chat-sdk-slack.test.ts +189 -1
- package/src/tests/chatgpt-subscription-session-bench.test.ts +2 -2
- package/src/tests/claude-worker-parity.test.ts +2 -2
- package/src/tests/codex-adapter.test.ts +30 -0
- package/src/tests/codex-login.test.ts +2 -2
- package/src/tests/codex-oauth-accounts.test.ts +48 -12
- package/src/tests/codex-oauth-credential-info.test.ts +77 -1
- package/src/tests/codex-oauth-device.test.ts +1 -1
- package/src/tests/codex-oauth-keep-warm.test.ts +2 -2
- package/src/tests/codex-oauth.test.ts +25 -4
- package/src/tests/codex-pool.test.ts +2 -2
- package/src/tests/db-client-busy-retry.test.ts +69 -18
- package/src/tests/db-client.test.ts +26 -1
- package/src/tests/db-task-read-contract.test.ts +4 -0
- package/src/tests/db-task-write-contract.test.ts +2 -0
- package/src/tests/deploy-one-box.test.ts +39 -1
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/event-loop-lag.test.ts +184 -0
- package/src/tests/extensions-example-comms-adherence-gate.test.ts +115 -0
- package/src/tests/fixtures/onboard/content.compose.yml.txt +0 -4
- package/src/tests/fixtures/onboard/dev.compose.yml.txt +0 -3
- package/src/tests/fixtures/onboard/full-all.compose.yml.txt +0 -11
- package/src/tests/fixtures/onboard/full.compose.yml.txt +0 -11
- package/src/tests/fixtures/onboard/research.compose.yml.txt +0 -3
- package/src/tests/fixtures/onboard/solo.compose.yml.txt +0 -1
- package/src/tests/fixtures/prs-app-definition.json.txt +784 -0
- package/src/tests/fixtures/prs-filters-migration.patch.json.txt +318 -0
- package/src/tests/fixtures/prs-selection-migration.patch.json.txt +373 -0
- package/src/tests/fixtures/runner-identity-refresh.ts +3 -0
- package/src/tests/fixtures/runner-legacy-resume-prompt.ts +3 -0
- package/src/tests/fixtures/runner-task-start-reads.ts +140 -0
- package/src/tests/github-webhook-early-ack.test.ts +144 -0
- package/src/tests/hook-ping-me-order.test.ts +85 -0
- package/src/tests/http-api-integration.test.ts +2 -0
- package/src/tests/http-log-scrubbing.test.ts +68 -2
- package/src/tests/improvements-payload.test.ts +200 -0
- package/src/tests/improvements-route.test.ts +419 -0
- package/src/tests/install-sh-setup-url.test.ts +190 -0
- package/src/tests/kv-storage.test.ts +92 -1
- package/src/tests/memory-key-paths.test.ts +57 -0
- package/src/tests/memory-retrieval-purge.test.ts +19 -0
- package/src/tests/onboard-dashboard-output.test.ts +109 -0
- package/src/tests/onboard-dashboard-url.test.ts +83 -0
- package/src/tests/operator-granted-credentials.test.ts +561 -0
- package/src/tests/operator-granted-role-wire.test.ts +222 -0
- package/src/tests/quickjs-compat.test.ts +1 -1
- package/src/tests/rbac-engine.test.ts +2 -0
- package/src/tests/runner-context-preamble.test.ts +552 -0
- package/src/tests/runner-context-usage.test.ts +0 -1
- package/src/tests/runner-legacy-options.test.ts +55 -0
- package/src/tests/runner-slot-reconcile.test.ts +38 -0
- package/src/tests/runner-task-start-reads.test.ts +58 -0
- package/src/tests/script-connections.test.ts +3 -0
- package/src/tests/script-executor-conformance.test.ts +188 -0
- package/src/tests/send-task-dispatched-by.test.ts +129 -0
- package/src/tests/session-dispatched-tasks.test.ts +115 -0
- package/src/tests/session-sharing.test.ts +198 -9
- package/src/tests/sessions-tree.test.ts +133 -2
- package/src/tests/slack-app-icon.test.ts +4 -0
- package/src/tests/slack-dm-implicit-mention.test.ts +236 -0
- package/src/tests/slack-file-tools-attachments.test.ts +96 -3
- package/src/tests/slack-reaction-config.test.ts +39 -0
- package/src/tests/slack-read-boundaries.test.ts +4 -3
- package/src/tests/slack-render-v2-query-plans.test.ts +262 -3
- package/src/tests/slack-render-v2-reconcile.test.ts +201 -0
- package/src/tests/slack-render-v2.test.ts +47 -0
- package/src/tests/slack-socket-watchdog.test.ts +748 -0
- package/src/tests/submit-improvement-tool.test.ts +82 -0
- package/src/tests/tool-annotations.test.ts +1 -1
- package/src/tests/vcs-identity-inheritance.test.ts +85 -0
- package/src/tools/manage-user.ts +88 -58
- package/src/tools/send-task.ts +3 -0
- package/src/tools/slack-read.ts +61 -33
- package/src/tools/submit-improvement.ts +68 -0
- package/src/tools/tool-config.ts +3 -0
- package/src/tools/utils.ts +16 -7
- package/src/types.ts +5 -0
- package/src/utils/request-auth-context.ts +6 -1
- package/templates/extensions/comms-adherence-gate/README.md +25 -0
- package/templates/extensions/comms-adherence-gate/hooks.ts +100 -11
- package/templates/extensions/comms-adherence-gate/manifest.json +1 -1
- package/templates/skills/apps/SKILL.md +29 -11
- package/templates/skills/apps/content.md +29 -11
- package/templates/skills/swarm-scripts/SKILL.md +1 -1
- package/templates/skills/swarm-scripts/content.md +1 -1
- package/templates/skills/work-on-task/SKILL.md +1 -1
- package/templates/skills/work-on-task/content.md +1 -1
- package/dist/acp-adapter-vg5hqkvj.js +0 -16
- package/dist/app-e00m45gn.js +0 -17
- package/dist/cli-5c4hjzne.js +0 -873
- package/dist/cli-ae0dnfee.js +0 -20222
- package/dist/cli-nn3ysbqk.js +0 -428
- package/dist/cli-pc5znp64.js +0 -364
- package/dist/fx-adapter-m5jbgd5q.js +0 -19
- package/dist/grok-adapter-csvv7sac.js +0 -19
- package/dist/handlers-8x5gfbzx.js +0 -32
- package/dist/heartbeat-6c2y3267.js +0 -41
- package/dist/index-hpfte8jd.js +0 -33
- package/dist/index-ncf7yb5s.js +0 -30
- package/dist/index-vte6dyeh.js +0 -37
- package/dist/lead-4bvftzm6.js +0 -71
- package/dist/virtual-modules-efxcp740.js +0 -59
- package/dist/worker-e7v2bvm9.js +0 -71
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bedrockProviderModule
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-fsgttth8.js";
|
|
4
4
|
import {
|
|
5
5
|
chatThreadOfContextKey,
|
|
6
6
|
agentContextKey,
|
|
@@ -52,6 +52,10 @@ import {
|
|
|
52
52
|
decryptSecret,
|
|
53
53
|
getEncryptionKey,
|
|
54
54
|
init_crypto,
|
|
55
|
+
withLoopPath,
|
|
56
|
+
startEventLoopLagProbe,
|
|
57
|
+
stopEventLoopLagProbe,
|
|
58
|
+
init_event_loop_lag,
|
|
55
59
|
getPromptTemplateDefaultDrift,
|
|
56
60
|
init_default_drift,
|
|
57
61
|
init_templates2,
|
|
@@ -60,6 +64,32 @@ import {
|
|
|
60
64
|
closeDb2,
|
|
61
65
|
getDbClient2,
|
|
62
66
|
init_runtime2,
|
|
67
|
+
CHAT_SDK_ADAPTER_NAMES,
|
|
68
|
+
isAdapterEntryEnabled,
|
|
69
|
+
init_schema,
|
|
70
|
+
TELEMETRY_RANKING_KEY,
|
|
71
|
+
PUBLIC_RANKING_ENABLED_KEY,
|
|
72
|
+
RANKING_CATEGORIES,
|
|
73
|
+
readTelemetryRanking,
|
|
74
|
+
rankingFormSchema,
|
|
75
|
+
buildListing,
|
|
76
|
+
init_telemetry_ranking,
|
|
77
|
+
API_DRAINING_HEADER,
|
|
78
|
+
init_api_drain2,
|
|
79
|
+
parseTaskToolManifest,
|
|
80
|
+
CHAT_TASK_ONLY_TOOLS,
|
|
81
|
+
isChatSdkTask,
|
|
82
|
+
selectTaskTools,
|
|
83
|
+
init_task_tool_manifest,
|
|
84
|
+
isApiOnlyConfigKey,
|
|
85
|
+
isInternalConfigKey,
|
|
86
|
+
internalConfigKeyError,
|
|
87
|
+
MAX_DB_RETENTION_DAYS,
|
|
88
|
+
DB_RETENTION_TUNING_BOUNDS,
|
|
89
|
+
CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS,
|
|
90
|
+
validateConfigValue,
|
|
91
|
+
validateConfigEntry,
|
|
92
|
+
init_swarm_config_guard,
|
|
63
93
|
cachedUserRole,
|
|
64
94
|
cachedUserFunction,
|
|
65
95
|
configureOrgDomainPersistence,
|
|
@@ -110,6 +140,7 @@ import {
|
|
|
110
140
|
getTaskById2,
|
|
111
141
|
TASK_LINEAGE_LIMITS2,
|
|
112
142
|
getTaskLineage2,
|
|
143
|
+
getTasksDispatchedFrom2,
|
|
113
144
|
getAllTasks2,
|
|
114
145
|
getTasksCount2,
|
|
115
146
|
getTaskStats2,
|
|
@@ -147,32 +178,6 @@ import {
|
|
|
147
178
|
init_channels,
|
|
148
179
|
publishWorkerNudge,
|
|
149
180
|
init_worker_nudges,
|
|
150
|
-
CHAT_SDK_ADAPTER_NAMES,
|
|
151
|
-
isAdapterEntryEnabled,
|
|
152
|
-
init_schema,
|
|
153
|
-
TELEMETRY_RANKING_KEY,
|
|
154
|
-
PUBLIC_RANKING_ENABLED_KEY,
|
|
155
|
-
RANKING_CATEGORIES,
|
|
156
|
-
readTelemetryRanking,
|
|
157
|
-
rankingFormSchema,
|
|
158
|
-
buildListing,
|
|
159
|
-
init_telemetry_ranking,
|
|
160
|
-
API_DRAINING_HEADER,
|
|
161
|
-
init_api_drain2,
|
|
162
|
-
parseTaskToolManifest,
|
|
163
|
-
CHAT_TASK_ONLY_TOOLS,
|
|
164
|
-
isChatSdkTask,
|
|
165
|
-
selectTaskTools,
|
|
166
|
-
init_task_tool_manifest,
|
|
167
|
-
isApiOnlyConfigKey,
|
|
168
|
-
isInternalConfigKey,
|
|
169
|
-
internalConfigKeyError,
|
|
170
|
-
MAX_DB_RETENTION_DAYS,
|
|
171
|
-
DB_RETENTION_TUNING_BOUNDS,
|
|
172
|
-
CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS,
|
|
173
|
-
validateConfigValue,
|
|
174
|
-
validateConfigEntry,
|
|
175
|
-
init_swarm_config_guard,
|
|
176
181
|
getDefaultAuthorizationIdForProvider,
|
|
177
182
|
getOAuthApp,
|
|
178
183
|
getOAuthAppById,
|
|
@@ -479,19 +484,22 @@ import {
|
|
|
479
484
|
countScriptRunJournalSteps2,
|
|
480
485
|
countScriptRunJournalAgentTaskSteps2,
|
|
481
486
|
init_db4
|
|
482
|
-
} from "./cli-
|
|
487
|
+
} from "./cli-j7d73g1y.js";
|
|
483
488
|
import {
|
|
484
489
|
PRIMARY_ROLE_NAMES2,
|
|
490
|
+
OperatorGrantedTargetError2,
|
|
491
|
+
assertMayActOnOperatorGrantedTarget2,
|
|
485
492
|
getUserGrant2,
|
|
486
493
|
listUserRoles2,
|
|
487
494
|
listRbacRoles2,
|
|
488
495
|
InvalidRoleSetError2,
|
|
496
|
+
OperatorGrantedRoleError2,
|
|
489
497
|
LastAdminError2,
|
|
490
498
|
assertNotLastAdmin2,
|
|
491
499
|
setUserRoles2,
|
|
492
500
|
init_rbac_roles
|
|
493
|
-
} from "./cli-
|
|
494
|
-
import"./cli-
|
|
501
|
+
} from "./cli-yz7v0sh4.js";
|
|
502
|
+
import"./cli-3xddv0rk.js";
|
|
495
503
|
import {
|
|
496
504
|
upsertModelCatalogOverlay,
|
|
497
505
|
deleteModelCatalogOverlay,
|
|
@@ -499,12 +507,12 @@ import {
|
|
|
499
507
|
init_model_catalog_store,
|
|
500
508
|
requestModelCatalogRefresh2,
|
|
501
509
|
init_pricing_refresh
|
|
502
|
-
} from "./cli-
|
|
510
|
+
} from "./cli-ed6yqpf1.js";
|
|
503
511
|
import {
|
|
504
512
|
workflowEventBus2,
|
|
505
513
|
init_event_bus
|
|
506
|
-
} from "./cli-
|
|
507
|
-
import"./cli-
|
|
514
|
+
} from "./cli-eddnyg3t.js";
|
|
515
|
+
import"./cli-bxz823sz.js";
|
|
508
516
|
import {
|
|
509
517
|
require_dist4,
|
|
510
518
|
getSlackConnectionState,
|
|
@@ -535,12 +543,12 @@ import {
|
|
|
535
543
|
startSlackApp2,
|
|
536
544
|
stopSlackApp2,
|
|
537
545
|
init_app3
|
|
538
|
-
} from "./cli-
|
|
546
|
+
} from "./cli-mr97t7cc.js";
|
|
539
547
|
import {
|
|
540
548
|
retryFailedRun2,
|
|
541
549
|
cancelWorkflowRun2,
|
|
542
550
|
init_resume
|
|
543
|
-
} from "./cli-
|
|
551
|
+
} from "./cli-z9cs5m0w.js";
|
|
544
552
|
import {
|
|
545
553
|
DEFAULT_NEGOTIATED_PROTOCOL_VERSION,
|
|
546
554
|
SUPPORTED_PROTOCOL_VERSIONS,
|
|
@@ -740,6 +748,7 @@ import {
|
|
|
740
748
|
init_teams_origin,
|
|
741
749
|
getSessionLabels,
|
|
742
750
|
rememberSessionLabel,
|
|
751
|
+
getResourceSessionLabels,
|
|
743
752
|
init_session_labels,
|
|
744
753
|
isChatSdkStopping,
|
|
745
754
|
startChatSdk,
|
|
@@ -945,6 +954,18 @@ import {
|
|
|
945
954
|
skipReasonFrom,
|
|
946
955
|
finalizeSkippedTaskReaction,
|
|
947
956
|
init_task_skip,
|
|
957
|
+
IMPROVEMENT_TEXT_MAX,
|
|
958
|
+
IMPROVEMENT_STATUSES,
|
|
959
|
+
IMPROVEMENT_SOURCES,
|
|
960
|
+
ImprovementError,
|
|
961
|
+
isImprovementsEnabled,
|
|
962
|
+
getImprovement,
|
|
963
|
+
listImprovements,
|
|
964
|
+
createImprovement,
|
|
965
|
+
approveAndSend,
|
|
966
|
+
discardImprovement,
|
|
967
|
+
improvementLeakHints,
|
|
968
|
+
init_improvements,
|
|
948
969
|
canClaim,
|
|
949
970
|
init_budget_admission,
|
|
950
971
|
emitBudgetRefusalSideEffects,
|
|
@@ -964,7 +985,7 @@ import {
|
|
|
964
985
|
getEnabledCapabilities,
|
|
965
986
|
createServer,
|
|
966
987
|
init_server
|
|
967
|
-
} from "./cli-
|
|
988
|
+
} from "./cli-7wz05bx3.js";
|
|
968
989
|
import {
|
|
969
990
|
FilesError,
|
|
970
991
|
normalizeFilesError,
|
|
@@ -975,6 +996,7 @@ import {
|
|
|
975
996
|
getFileStorageProvider2,
|
|
976
997
|
init_registry2
|
|
977
998
|
} from "./cli-3xj33nrx.js";
|
|
999
|
+
import"./cli-n9ftpys4.js";
|
|
978
1000
|
import {
|
|
979
1001
|
RuntimePoolError2,
|
|
980
1002
|
mintControllerToken,
|
|
@@ -996,7 +1018,7 @@ import {
|
|
|
996
1018
|
resolvePoolDelivery2,
|
|
997
1019
|
createPoolAgent2,
|
|
998
1020
|
init_db2
|
|
999
|
-
} from "./cli-
|
|
1021
|
+
} from "./cli-xd5ebp64.js";
|
|
1000
1022
|
import {
|
|
1001
1023
|
duplicateGuardedQueryKey,
|
|
1002
1024
|
warnIfCorsAllowsAnyOrigin,
|
|
@@ -1007,6 +1029,7 @@ import {
|
|
|
1007
1029
|
getPathSegments,
|
|
1008
1030
|
wireHttpSpanLifecycle,
|
|
1009
1031
|
redactShareTokenInPath,
|
|
1032
|
+
loopPathForRequest,
|
|
1010
1033
|
safeRequestUrlForLog,
|
|
1011
1034
|
agentWithCapacity,
|
|
1012
1035
|
RequestBodyTooLargeError,
|
|
@@ -1022,6 +1045,7 @@ import {
|
|
|
1022
1045
|
init_utils2,
|
|
1023
1046
|
hasSessionAccess,
|
|
1024
1047
|
getSessionRoot,
|
|
1048
|
+
getSessionRoots,
|
|
1025
1049
|
sessionAccessForRoot,
|
|
1026
1050
|
listActiveSessionShares,
|
|
1027
1051
|
toSessionSharesState,
|
|
@@ -1051,7 +1075,7 @@ import {
|
|
|
1051
1075
|
describeRequestRoute,
|
|
1052
1076
|
route,
|
|
1053
1077
|
init_route_def
|
|
1054
|
-
} from "./cli-
|
|
1078
|
+
} from "./cli-8ewkreqd.js";
|
|
1055
1079
|
import {
|
|
1056
1080
|
startPoolRouting,
|
|
1057
1081
|
stopPoolRouting,
|
|
@@ -1064,28 +1088,28 @@ import {
|
|
|
1064
1088
|
checkHeartbeatChecklist2,
|
|
1065
1089
|
runHeartbeatSweep2,
|
|
1066
1090
|
stopHeartbeat2
|
|
1067
|
-
} from "./cli-
|
|
1068
|
-
import"./cli-
|
|
1091
|
+
} from "./cli-kx4c8j05.js";
|
|
1092
|
+
import"./cli-x9exydey.js";
|
|
1069
1093
|
import {
|
|
1070
1094
|
runtimeSupervisorStatus,
|
|
1071
1095
|
startRuntimeSupervisor,
|
|
1072
1096
|
stopRuntimeSupervisor
|
|
1073
|
-
} from "./cli-
|
|
1097
|
+
} from "./cli-38yww4e9.js";
|
|
1074
1098
|
import {
|
|
1075
1099
|
TASK_TITLE_TIMEOUT_MS,
|
|
1076
1100
|
generateTaskTitle
|
|
1077
|
-
} from "./cli-
|
|
1101
|
+
} from "./cli-w3bk0dgv.js";
|
|
1078
1102
|
import"./cli-ns59dc6r.js";
|
|
1079
1103
|
import {
|
|
1080
1104
|
ACP_TARGET_IDS
|
|
1081
|
-
} from "./cli-
|
|
1105
|
+
} from "./cli-d6521kb5.js";
|
|
1082
1106
|
import {
|
|
1083
1107
|
reasoningCapability,
|
|
1084
1108
|
supportedReasoningLevels
|
|
1085
|
-
} from "./cli-
|
|
1109
|
+
} from "./cli-jrzkw01m.js";
|
|
1086
1110
|
import {
|
|
1087
1111
|
MAX_RATE_LIMIT_RESET_MS
|
|
1088
|
-
} from "./cli-
|
|
1112
|
+
} from "./cli-f2zenhja.js";
|
|
1089
1113
|
import {
|
|
1090
1114
|
isLeadChannelMonitoringEnabled,
|
|
1091
1115
|
ORG_IDENTITY_KEYS,
|
|
@@ -1095,14 +1119,14 @@ import {
|
|
|
1095
1119
|
isUnknownModelError,
|
|
1096
1120
|
checkProviderPoolKey,
|
|
1097
1121
|
writeSkillsToFilesystem
|
|
1098
|
-
} from "./cli-
|
|
1122
|
+
} from "./cli-jg24scat.js";
|
|
1099
1123
|
import {
|
|
1100
1124
|
inviteEmailToSharedOrg,
|
|
1101
1125
|
ensureAgentFsCredentialsForAgent
|
|
1102
|
-
} from "./cli-
|
|
1126
|
+
} from "./cli-cr14kftt.js";
|
|
1103
1127
|
import {
|
|
1104
1128
|
Anthropic
|
|
1105
|
-
} from "./cli-
|
|
1129
|
+
} from "./cli-t73cas91.js";
|
|
1106
1130
|
import {
|
|
1107
1131
|
isCodexOAuthConfigKey
|
|
1108
1132
|
} from "./cli-j4bwnpkm.js";
|
|
@@ -1115,17 +1139,17 @@ import {
|
|
|
1115
1139
|
ampBillsCacheWrites,
|
|
1116
1140
|
resolveAmpModel,
|
|
1117
1141
|
init_amp_models
|
|
1118
|
-
} from "./cli-
|
|
1142
|
+
} from "./cli-ttbqe3q4.js";
|
|
1119
1143
|
import {
|
|
1120
1144
|
RATING_MODEL_MAX_LENGTH,
|
|
1121
1145
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
1122
1146
|
sanitizeReferencesSource,
|
|
1123
1147
|
init_types2
|
|
1124
|
-
} from "./cli-
|
|
1148
|
+
} from "./cli-2xv18ywz.js";
|
|
1125
1149
|
import {
|
|
1126
1150
|
normalizeModelKey,
|
|
1127
1151
|
init_pricing_normalize
|
|
1128
|
-
} from "./cli-
|
|
1152
|
+
} from "./cli-bzvs88tv.js";
|
|
1129
1153
|
import {
|
|
1130
1154
|
require_dist2,
|
|
1131
1155
|
getMcpOAuthToken,
|
|
@@ -1214,7 +1238,7 @@ import {
|
|
|
1214
1238
|
init_typecheck,
|
|
1215
1239
|
parseSkillContent,
|
|
1216
1240
|
init_skill_parser
|
|
1217
|
-
} from "./cli-
|
|
1241
|
+
} from "./cli-zjphdj1a.js";
|
|
1218
1242
|
import {
|
|
1219
1243
|
signalProcessGroup,
|
|
1220
1244
|
detachedProcessGroup,
|
|
@@ -1231,7 +1255,7 @@ import {
|
|
|
1231
1255
|
forceRefreshAuthorizationOrThrow,
|
|
1232
1256
|
forceRefreshTokenOrThrow,
|
|
1233
1257
|
init_ensure_token
|
|
1234
|
-
} from "./cli-
|
|
1258
|
+
} from "./cli-16phend6.js";
|
|
1235
1259
|
import {
|
|
1236
1260
|
automationIntegrationFixUrl,
|
|
1237
1261
|
preflightAutomation,
|
|
@@ -1275,7 +1299,7 @@ import {
|
|
|
1275
1299
|
definitionNodeIds,
|
|
1276
1300
|
validateDefinition,
|
|
1277
1301
|
init_definition2
|
|
1278
|
-
} from "./cli-
|
|
1302
|
+
} from "./cli-xncjscpm.js";
|
|
1279
1303
|
import {
|
|
1280
1304
|
_fetchHolder,
|
|
1281
1305
|
CLIENT_ID,
|
|
@@ -1291,7 +1315,7 @@ import {
|
|
|
1291
1315
|
loadAllCodexOAuthSlots,
|
|
1292
1316
|
getValidCodexOAuth,
|
|
1293
1317
|
init_storage
|
|
1294
|
-
} from "./cli-
|
|
1318
|
+
} from "./cli-rvhdmjvt.js";
|
|
1295
1319
|
import {
|
|
1296
1320
|
isMultiRuntimeEnabled,
|
|
1297
1321
|
init_multi_runtime2
|
|
@@ -1299,7 +1323,7 @@ import {
|
|
|
1299
1323
|
import {
|
|
1300
1324
|
require_content_type
|
|
1301
1325
|
} from "./cli-yjdgea32.js";
|
|
1302
|
-
import"./cli-
|
|
1326
|
+
import"./cli-2tsfpc70.js";
|
|
1303
1327
|
import {
|
|
1304
1328
|
isInvalidClientError,
|
|
1305
1329
|
publicEndpointSsrfOptions,
|
|
@@ -1317,11 +1341,30 @@ import {
|
|
|
1317
1341
|
revokeMcpToken,
|
|
1318
1342
|
computeExpiresAt,
|
|
1319
1343
|
init_mcp_wrapper
|
|
1320
|
-
} from "./cli-
|
|
1344
|
+
} from "./cli-0m7rtm11.js";
|
|
1321
1345
|
import {
|
|
1322
1346
|
createRuntimeProvider,
|
|
1323
1347
|
init_runtime_providers
|
|
1324
|
-
} from "./cli-
|
|
1348
|
+
} from "./cli-hxpyc9sn.js";
|
|
1349
|
+
import"./cli-v41kn3cd.js";
|
|
1350
|
+
import {
|
|
1351
|
+
setBedrockProviderModule,
|
|
1352
|
+
init_bedrock_converse_stream_lazy
|
|
1353
|
+
} from "./cli-54vrpgm0.js";
|
|
1354
|
+
import {
|
|
1355
|
+
import_websocket,
|
|
1356
|
+
import_websocket_server,
|
|
1357
|
+
init_wrapper2
|
|
1358
|
+
} from "./cli-69szn7w7.js";
|
|
1359
|
+
import {
|
|
1360
|
+
isRbacEnabled,
|
|
1361
|
+
decideToolAdmission,
|
|
1362
|
+
LEGACY_RULES,
|
|
1363
|
+
setAuditSink,
|
|
1364
|
+
clearAuditSink,
|
|
1365
|
+
can,
|
|
1366
|
+
init_rbac
|
|
1367
|
+
} from "./cli-cyn9v8zr.js";
|
|
1325
1368
|
import {
|
|
1326
1369
|
registerSessionTokenConnection,
|
|
1327
1370
|
init_session_token_connections,
|
|
@@ -1348,30 +1391,13 @@ import {
|
|
|
1348
1391
|
revokeAgentTokens,
|
|
1349
1392
|
fingerprintApiKey,
|
|
1350
1393
|
init_users
|
|
1351
|
-
} from "./cli-
|
|
1352
|
-
import"./cli-v41kn3cd.js";
|
|
1353
|
-
import {
|
|
1354
|
-
setBedrockProviderModule,
|
|
1355
|
-
init_bedrock_converse_stream_lazy
|
|
1356
|
-
} from "./cli-pz4rk021.js";
|
|
1357
|
-
import {
|
|
1358
|
-
import_websocket,
|
|
1359
|
-
import_websocket_server,
|
|
1360
|
-
init_wrapper2
|
|
1361
|
-
} from "./cli-69szn7w7.js";
|
|
1362
|
-
import {
|
|
1363
|
-
isRbacEnabled,
|
|
1364
|
-
decideToolAdmission,
|
|
1365
|
-
LEGACY_RULES,
|
|
1366
|
-
setAuditSink,
|
|
1367
|
-
clearAuditSink,
|
|
1368
|
-
can,
|
|
1369
|
-
init_rbac
|
|
1370
|
-
} from "./cli-njwac61j.js";
|
|
1394
|
+
} from "./cli-g1px1g2e.js";
|
|
1371
1395
|
import {
|
|
1372
1396
|
ASSET_KEY_MAX_LENGTH,
|
|
1373
1397
|
normalizeAssetKey,
|
|
1374
1398
|
defaultAssetKey,
|
|
1399
|
+
isResourceGroupPrefix,
|
|
1400
|
+
RESOURCE_GROUPS_READ_ONLY,
|
|
1375
1401
|
parseAssetKey,
|
|
1376
1402
|
init_key,
|
|
1377
1403
|
isSafeBundlePath,
|
|
@@ -1525,7 +1551,7 @@ import {
|
|
|
1525
1551
|
KvKeySchema,
|
|
1526
1552
|
KvEntrySchema,
|
|
1527
1553
|
init_types4
|
|
1528
|
-
} from "./cli-
|
|
1554
|
+
} from "./cli-hfkwwy1h.js";
|
|
1529
1555
|
import {
|
|
1530
1556
|
CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
|
|
1531
1557
|
CODEX_AUTH_WATCH_NAMESPACE,
|
|
@@ -1536,7 +1562,7 @@ import {
|
|
|
1536
1562
|
IDENTITY_FIELD_BUDGETS,
|
|
1537
1563
|
IdentityFieldBudgetError,
|
|
1538
1564
|
init_identity_field_budget
|
|
1539
|
-
} from "./cli-
|
|
1565
|
+
} from "./cli-pyrxt9gw.js";
|
|
1540
1566
|
import {
|
|
1541
1567
|
getSlackConfiguration,
|
|
1542
1568
|
init_config4
|
|
@@ -1563,7 +1589,7 @@ import {
|
|
|
1563
1589
|
splitCredentialPool,
|
|
1564
1590
|
selectCredential,
|
|
1565
1591
|
init_credentials2
|
|
1566
|
-
} from "./cli-
|
|
1592
|
+
} from "./cli-xfjrc279.js";
|
|
1567
1593
|
import {
|
|
1568
1594
|
interpolate,
|
|
1569
1595
|
init_template2,
|
|
@@ -1576,7 +1602,7 @@ import {
|
|
|
1576
1602
|
} from "./cli-kf3pxxdg.js";
|
|
1577
1603
|
import {
|
|
1578
1604
|
init_zod
|
|
1579
|
-
} from "./cli-
|
|
1605
|
+
} from "./cli-zcfpsfzf.js";
|
|
1580
1606
|
import {
|
|
1581
1607
|
NEVER,
|
|
1582
1608
|
toJSONSchema,
|
|
@@ -1591,7 +1617,7 @@ import {
|
|
|
1591
1617
|
array2,
|
|
1592
1618
|
object2,
|
|
1593
1619
|
looseObject,
|
|
1594
|
-
|
|
1620
|
+
union3,
|
|
1595
1621
|
discriminatedUnion,
|
|
1596
1622
|
record2,
|
|
1597
1623
|
partialRecord,
|
|
@@ -1601,11 +1627,11 @@ import {
|
|
|
1601
1627
|
preprocess,
|
|
1602
1628
|
ZodIssueCode,
|
|
1603
1629
|
exports_coerce
|
|
1604
|
-
} from "./cli-
|
|
1630
|
+
} from "./cli-hg42n3hx.js";
|
|
1605
1631
|
import {
|
|
1606
1632
|
init_package,
|
|
1607
1633
|
package_default
|
|
1608
|
-
} from "./cli-
|
|
1634
|
+
} from "./cli-rt0ag4x1.js";
|
|
1609
1635
|
import {
|
|
1610
1636
|
realtimeBus,
|
|
1611
1637
|
init_bus
|
|
@@ -1633,19 +1659,17 @@ import {
|
|
|
1633
1659
|
init_api_key
|
|
1634
1660
|
} from "./cli-pax9q4ff.js";
|
|
1635
1661
|
import {
|
|
1662
|
+
isAlias,
|
|
1663
|
+
baseUrlEnvVar,
|
|
1664
|
+
providerForKeyVar,
|
|
1665
|
+
init_src2,
|
|
1636
1666
|
scrubSecrets,
|
|
1637
1667
|
findSecretsIn,
|
|
1638
1668
|
scrubObject,
|
|
1639
1669
|
registerVolatileSecret,
|
|
1640
1670
|
registerEnvSecrets,
|
|
1641
1671
|
init_secret_scrubber
|
|
1642
|
-
} from "./cli-
|
|
1643
|
-
import {
|
|
1644
|
-
isAlias,
|
|
1645
|
-
baseUrlEnvVar,
|
|
1646
|
-
providerForKeyVar,
|
|
1647
|
-
init_src2
|
|
1648
|
-
} from "./cli-5c4hjzne.js";
|
|
1672
|
+
} from "./cli-d84byzn8.js";
|
|
1649
1673
|
import {
|
|
1650
1674
|
__toESM
|
|
1651
1675
|
} from "./cli-242037k3.js";
|
|
@@ -2233,6 +2257,9 @@ async function stopDbRetention() {
|
|
|
2233
2257
|
await retentionTickPromise;
|
|
2234
2258
|
}
|
|
2235
2259
|
|
|
2260
|
+
// src/http/index.ts
|
|
2261
|
+
init_event_loop_lag();
|
|
2262
|
+
|
|
2236
2263
|
// src/be/human-free-drain.ts
|
|
2237
2264
|
init_human_free();
|
|
2238
2265
|
var YIELD_MS2 = 25;
|
|
@@ -2292,6 +2319,7 @@ function stopHumanFreeDrain() {
|
|
|
2292
2319
|
// src/be/mcp-overflow-sweep.ts
|
|
2293
2320
|
init_kv_overflow();
|
|
2294
2321
|
init_db4();
|
|
2322
|
+
init_event_loop_lag();
|
|
2295
2323
|
var MCP_OVERFLOW_SWEEP_INTERVAL_MS = 10 * 60 * 1000;
|
|
2296
2324
|
var sweepTimer = null;
|
|
2297
2325
|
async function runMcpOverflowSweep(now = Date.now()) {
|
|
@@ -2310,7 +2338,7 @@ function startMcpOverflowSweep(intervalMs = MCP_OVERFLOW_SWEEP_INTERVAL_MS) {
|
|
|
2310
2338
|
if (sweepTimer)
|
|
2311
2339
|
return;
|
|
2312
2340
|
sweepTimer = setInterval(() => {
|
|
2313
|
-
runMcpOverflowSweep();
|
|
2341
|
+
withLoopPath("mcp-overflow.sweep", () => runMcpOverflowSweep());
|
|
2314
2342
|
}, intervalMs);
|
|
2315
2343
|
if (typeof sweepTimer?.unref === "function")
|
|
2316
2344
|
sweepTimer.unref();
|
|
@@ -5168,7 +5196,7 @@ var AcpRuntimeConfigSchema = object2({
|
|
|
5168
5196
|
args: array2(string2()).optional(),
|
|
5169
5197
|
envKeys: array2(string2().regex(/^[A-Za-z_][A-Za-z0-9_]*$/)).optional(),
|
|
5170
5198
|
modelEnvKey: string2().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).nullable().optional(),
|
|
5171
|
-
options: record2(string2(),
|
|
5199
|
+
options: record2(string2(), union3([string2(), boolean()])).optional()
|
|
5172
5200
|
}).superRefine((value, ctx) => {
|
|
5173
5201
|
if (value.target === "custom" && !value.command) {
|
|
5174
5202
|
ctx.addIssue({
|
|
@@ -7803,6 +7831,44 @@ async function handleConfig(req, res, pathSegments, queryParams) {
|
|
|
7803
7831
|
return false;
|
|
7804
7832
|
}
|
|
7805
7833
|
|
|
7834
|
+
// src/http/person-responder.ts
|
|
7835
|
+
init_rbac_roles();
|
|
7836
|
+
init_rbac();
|
|
7837
|
+
init_request_auth_context();
|
|
7838
|
+
init_request_principal();
|
|
7839
|
+
var AGENT_RESPONSE_REFUSED = "Agents cannot answer approval requests. A person must respond with a user token or the dashboard.";
|
|
7840
|
+
async function approvalResponder(req, options) {
|
|
7841
|
+
const auth = getRequestAuth(req);
|
|
7842
|
+
const rawAgentId = req.headers["x-agent-id"];
|
|
7843
|
+
const headerAgentId = Array.isArray(rawAgentId) ? rawAgentId[0] : rawAgentId;
|
|
7844
|
+
const principal = await agentFirstPrincipal(req, headerAgentId);
|
|
7845
|
+
if (principal.kind !== "user" && principal.kind !== "agent" && auth?.page) {
|
|
7846
|
+
return {
|
|
7847
|
+
ok: false,
|
|
7848
|
+
message: options?.pageMessage ?? "A page session without a signed-in user cannot answer approval requests."
|
|
7849
|
+
};
|
|
7850
|
+
}
|
|
7851
|
+
const user = authUser(auth);
|
|
7852
|
+
const responder = principal.kind === "user" && user ? { kind: "user", user } : principal.kind === "operator" ? { kind: "operator" } : null;
|
|
7853
|
+
const verb = options?.verb ?? "approval.respond";
|
|
7854
|
+
const refused = {
|
|
7855
|
+
ok: false,
|
|
7856
|
+
message: options?.refusedMessage ?? AGENT_RESPONSE_REFUSED
|
|
7857
|
+
};
|
|
7858
|
+
const decision = can({ principal, verb, source: "http" });
|
|
7859
|
+
if (!decision.allow || !responder)
|
|
7860
|
+
return refused;
|
|
7861
|
+
if (responder.kind === "user" && isRbacEnabled()) {
|
|
7862
|
+
const grant = await getUserGrant2(responder.user.id);
|
|
7863
|
+
if (!grant.grantsAll && !grant.verbs.has(verb))
|
|
7864
|
+
return refused;
|
|
7865
|
+
}
|
|
7866
|
+
return { ok: true, responder };
|
|
7867
|
+
}
|
|
7868
|
+
function responderKey(responder) {
|
|
7869
|
+
return responder.kind === "user" ? responder.user.id : "operator";
|
|
7870
|
+
}
|
|
7871
|
+
|
|
7806
7872
|
// src/http/approval-requests.ts
|
|
7807
7873
|
init_request_principal();
|
|
7808
7874
|
init_route_def();
|
|
@@ -7832,7 +7898,7 @@ var QuestionInputSchema = QuestionSchema.extend({
|
|
|
7832
7898
|
var ApproversSchema = object2({
|
|
7833
7899
|
users: array2(string2()).optional(),
|
|
7834
7900
|
roles: array2(string2()).optional(),
|
|
7835
|
-
policy:
|
|
7901
|
+
policy: union3([literal2("any"), literal2("all"), object2({ min: number2().int().min(1) })])
|
|
7836
7902
|
});
|
|
7837
7903
|
var NotificationChannelSchema = object2({
|
|
7838
7904
|
channel: _enum2(["slack", "email"]),
|
|
@@ -8000,7 +8066,7 @@ var createRoute = route({
|
|
|
8000
8066
|
approvers: object2({
|
|
8001
8067
|
users: array2(string2()).optional(),
|
|
8002
8068
|
roles: array2(string2()).optional(),
|
|
8003
|
-
policy:
|
|
8069
|
+
policy: union3([
|
|
8004
8070
|
literal2("any"),
|
|
8005
8071
|
literal2("all"),
|
|
8006
8072
|
object2({ min: number2().int().min(1) })
|
|
@@ -8110,7 +8176,7 @@ var listRoute = route({
|
|
|
8110
8176
|
200: {
|
|
8111
8177
|
description: "List of approval requests",
|
|
8112
8178
|
schema: object2({
|
|
8113
|
-
approvalRequests:
|
|
8179
|
+
approvalRequests: union3([
|
|
8114
8180
|
array2(ApprovalRequestSchema),
|
|
8115
8181
|
array2(ApprovalRequestSummarySchema)
|
|
8116
8182
|
])
|
|
@@ -8418,28 +8484,6 @@ async function approvalCallerPrincipal(req) {
|
|
|
8418
8484
|
const resolvedBy = principal.kind === "user" ? principal.userId : principal.kind === "agent" ? principal.agentId : principal.kind === "operator" ? "operator" : null;
|
|
8419
8485
|
return { principal, resolvedBy };
|
|
8420
8486
|
}
|
|
8421
|
-
var AGENT_RESPONSE_REFUSED = "Agents cannot answer approval requests. A person must respond with a user token or the dashboard.";
|
|
8422
|
-
async function approvalResponder(req) {
|
|
8423
|
-
const auth = getRequestAuth(req);
|
|
8424
|
-
const rawAgentId = req.headers["x-agent-id"];
|
|
8425
|
-
const headerAgentId = Array.isArray(rawAgentId) ? rawAgentId[0] : rawAgentId;
|
|
8426
|
-
const principal = await agentFirstPrincipal(req, headerAgentId);
|
|
8427
|
-
if (principal.kind !== "user" && principal.kind !== "agent" && auth?.page) {
|
|
8428
|
-
return {
|
|
8429
|
-
ok: false,
|
|
8430
|
-
message: "A page session without a signed-in user cannot answer approval requests."
|
|
8431
|
-
};
|
|
8432
|
-
}
|
|
8433
|
-
const user = authUser(auth);
|
|
8434
|
-
const responder = principal.kind === "user" && user ? { kind: "user", user } : principal.kind === "operator" ? { kind: "operator" } : null;
|
|
8435
|
-
const decision = can({ principal, verb: "approval.respond", source: "http" });
|
|
8436
|
-
if (!decision.allow || !responder)
|
|
8437
|
-
return { ok: false, message: AGENT_RESPONSE_REFUSED };
|
|
8438
|
-
return { ok: true, responder };
|
|
8439
|
-
}
|
|
8440
|
-
function responderKey(responder) {
|
|
8441
|
-
return responder.kind === "user" ? responder.user.id : "operator";
|
|
8442
|
-
}
|
|
8443
8487
|
function userMatchesListed(user, listed) {
|
|
8444
8488
|
if (listed === user.id)
|
|
8445
8489
|
return true;
|
|
@@ -8995,7 +9039,6 @@ async function handleBudgets(req, res, pathSegments, queryParams, _myAgentId) {
|
|
|
8995
9039
|
init_zod();
|
|
8996
9040
|
init_crypto();
|
|
8997
9041
|
init_db4();
|
|
8998
|
-
init_api_keys();
|
|
8999
9042
|
init_auth_json();
|
|
9000
9043
|
init_flow();
|
|
9001
9044
|
init_storage();
|
|
@@ -9065,10 +9108,6 @@ function readCredentials(row) {
|
|
|
9065
9108
|
return null;
|
|
9066
9109
|
}
|
|
9067
9110
|
}
|
|
9068
|
-
function accountSuffix(row) {
|
|
9069
|
-
const credentials = readCredentials(row);
|
|
9070
|
-
return credentials ? deriveCodexKeySuffix(credentials.access, credentials.accountId) : null;
|
|
9071
|
-
}
|
|
9072
9111
|
async function accountsResponse() {
|
|
9073
9112
|
const rows = await accountRows();
|
|
9074
9113
|
const statuses = await getKeyStatuses2("CODEX_OAUTH", "global", null);
|
|
@@ -9088,15 +9127,16 @@ async function accountsResponse() {
|
|
|
9088
9127
|
accounts.push(account);
|
|
9089
9128
|
continue;
|
|
9090
9129
|
}
|
|
9091
|
-
account.suffix = deriveCodexKeySuffix(credentials.access, credentials.accountId);
|
|
9130
|
+
account.suffix = deriveCodexKeySuffix(credentials.access, credentials.accountId, row.slot);
|
|
9092
9131
|
account.plan = extractChatgptPlanType(credentials.access);
|
|
9093
9132
|
const profile = decodeJwt(credentials.access)?.["https://api.openai.com/profile"];
|
|
9094
9133
|
if (profile && typeof profile === "object" && "email" in profile) {
|
|
9095
9134
|
account.email = typeof profile.email === "string" && profile.email ? profile.email : null;
|
|
9096
9135
|
}
|
|
9097
|
-
const
|
|
9136
|
+
const slotStatuses = statuses.filter((entry) => entry.keySuffix === account.suffix || entry.keyIndex === row.slot);
|
|
9137
|
+
const status = slotStatuses.find((entry) => entry.keySuffix === account.suffix);
|
|
9098
9138
|
const marker = await getKv2(CODEX_AUTH_WATCH_NAMESPACE, codexAuthBenchMarkerKey(account.suffix));
|
|
9099
|
-
const statusBenched =
|
|
9139
|
+
const statusBenched = slotStatuses.some((entry) => entry.consecutiveAuthFailures >= CODEX_AUTH_FAILURE_BENCH_THRESHOLD && entry.status === "rate_limited");
|
|
9100
9140
|
account.status = marker || statusBenched ? "needs_login" : status ? "ok" : "unchecked";
|
|
9101
9141
|
accounts.push(account);
|
|
9102
9142
|
}
|
|
@@ -9131,16 +9171,17 @@ async function handleCodexOAuthAccounts(req, res, pathSegments, queryParams) {
|
|
|
9131
9171
|
const account = rows.find((row) => row.slot === parsed.params.slot);
|
|
9132
9172
|
if (!account || !await deleteSwarmConfigByKey2("global", null, account.key))
|
|
9133
9173
|
return null;
|
|
9134
|
-
const
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9174
|
+
const credentials = readCredentials(account);
|
|
9175
|
+
const suffix = credentials ? deriveCodexKeySuffix(credentials.access, credentials.accountId, account.slot) : null;
|
|
9176
|
+
const retired = await getDbClient2().query(`DELETE FROM api_key_status
|
|
9177
|
+
WHERE keyType = 'CODEX_OAUTH' AND scope = 'global' AND scopeId = ''
|
|
9178
|
+
AND (keyIndex = ? OR keySuffix = ?)
|
|
9179
|
+
RETURNING keySuffix`, [account.slot, suffix]);
|
|
9180
|
+
for (const keySuffix of new Set([
|
|
9181
|
+
...suffix ? [suffix] : [],
|
|
9182
|
+
...retired.map((r) => r.keySuffix)
|
|
9183
|
+
])) {
|
|
9184
|
+
await deleteKv2(CODEX_AUTH_WATCH_NAMESPACE, codexAuthBenchMarkerKey(keySuffix));
|
|
9144
9185
|
}
|
|
9145
9186
|
return account.key;
|
|
9146
9187
|
});
|
|
@@ -9252,7 +9293,7 @@ var OnboardingIntegrationMethodSchema = _enum2([
|
|
|
9252
9293
|
]);
|
|
9253
9294
|
var OnboardingFilesMethodSchema = _enum2(["created", "connected"]);
|
|
9254
9295
|
var OnboardingFirstTaskMethodSchema = _enum2(["suggestion", "free_form"]);
|
|
9255
|
-
var OnboardingStepMethodSchema =
|
|
9296
|
+
var OnboardingStepMethodSchema = union3([
|
|
9256
9297
|
OnboardingConnectMethodSchema,
|
|
9257
9298
|
OnboardingNameMethodSchema,
|
|
9258
9299
|
OnboardingAiMethodSchema,
|
|
@@ -9339,7 +9380,7 @@ var OnboardingResponseSchema = object2({
|
|
|
9339
9380
|
state: OnboardingStateSchema,
|
|
9340
9381
|
signals: OnboardingSignalsSchema
|
|
9341
9382
|
});
|
|
9342
|
-
var OnboardingActionSchema =
|
|
9383
|
+
var OnboardingActionSchema = union3([
|
|
9343
9384
|
object2({ action: literal2("view"), step: OnboardingStepIdSchema }).strict(),
|
|
9344
9385
|
object2({
|
|
9345
9386
|
action: literal2("complete"),
|
|
@@ -10066,7 +10107,7 @@ async function completeFlow(flowId, credentials) {
|
|
|
10066
10107
|
isSecret: true,
|
|
10067
10108
|
description: `Codex ChatGPT OAuth credentials slot ${slot} (stored by dashboard device login)`
|
|
10068
10109
|
});
|
|
10069
|
-
const keySuffix = deriveCodexKeySuffix(credentials.access, credentials.accountId);
|
|
10110
|
+
const keySuffix = deriveCodexKeySuffix(credentials.access, credentials.accountId, slot);
|
|
10070
10111
|
const checked = [{ keyIndex: slot, keySuffix, ok: true }];
|
|
10071
10112
|
await recordKeyValidation2("CODEX_OAUTH", checked, "global", null, { retireAbsent: false });
|
|
10072
10113
|
await updateOnboardingAiFromCodexDevice({ status: "complete" });
|
|
@@ -10246,7 +10287,7 @@ async function handleCodexOAuthKeepWarm(req, res, pathSegments) {
|
|
|
10246
10287
|
const slots = await loadAllCodexOAuthSlots(apiUrl, apiKey);
|
|
10247
10288
|
const results = [];
|
|
10248
10289
|
for (const { slot, creds } of slots) {
|
|
10249
|
-
const keySuffix = deriveCodexKeySuffix(creds.access, creds.accountId);
|
|
10290
|
+
const keySuffix = deriveCodexKeySuffix(creds.access, creds.accountId, slot);
|
|
10250
10291
|
if (await getKv2(CODEX_AUTH_WATCH_NAMESPACE, codexAuthBenchMarkerKey(keySuffix))) {
|
|
10251
10292
|
results.push({ slot, keySuffix, outcome: "skipped-benched" });
|
|
10252
10293
|
continue;
|
|
@@ -11188,6 +11229,7 @@ declare module "swarm-extension" {
|
|
|
11188
11229
|
workflowRunId?: string | undefined;
|
|
11189
11230
|
workflowRunStepId?: string | undefined;
|
|
11190
11231
|
sourceTaskId?: string | undefined;
|
|
11232
|
+
dispatchedByTaskId?: string | undefined;
|
|
11191
11233
|
outputSchema?: Record<string, unknown> | undefined;
|
|
11192
11234
|
inheritParentOutputSchema?: boolean | undefined;
|
|
11193
11235
|
inheritParentRequester?: boolean | undefined;
|
|
@@ -11314,6 +11356,7 @@ declare module "swarm-extension" {
|
|
|
11314
11356
|
mentionChannelId?: string | undefined;
|
|
11315
11357
|
dir?: string | undefined;
|
|
11316
11358
|
parentTaskId?: string | undefined;
|
|
11359
|
+
dispatchedByTaskId?: string | undefined;
|
|
11317
11360
|
claudeSessionId?: string | undefined;
|
|
11318
11361
|
model?: string | undefined;
|
|
11319
11362
|
modelTier?: "smol" | "regular" | "smart" | "ultra" | undefined;
|
|
@@ -12095,7 +12138,7 @@ var catalog_generated_default = {
|
|
|
12095
12138
|
$schema: "../manifest.schema.json",
|
|
12096
12139
|
name: "comms-adherence-gate",
|
|
12097
12140
|
description: "Judges every Slack-facing store-progress completion and agent Slack post against the comms preferences of the requester, or of the person it @-mentions, their latest request and a plain-language rubric with Jev (TypeSafe or OpenRouter), and in enforce blocks a failing call once per task",
|
|
12098
|
-
version: "1.
|
|
12141
|
+
version: "1.8.0",
|
|
12099
12142
|
runtime: "api",
|
|
12100
12143
|
assets: {
|
|
12101
12144
|
hooks: "hooks.ts"
|
|
@@ -12158,6 +12201,12 @@ export const config = z.object({
|
|
|
12158
12201
|
openrouterModel: z.string().default("typesafe/jev-1.13"),
|
|
12159
12202
|
/** Explicit TypeSafe key; otherwise TYPESAFE_API_KEY from the API process env. */
|
|
12160
12203
|
apiKey: z.string().optional(),
|
|
12204
|
+
/**
|
|
12205
|
+
* Fixed text the operator's own templates mandate, judged by the self-test and
|
|
12206
|
+
* expected to pass. Kept loose here and parsed per entry by \`fixturesOf\`, so one
|
|
12207
|
+
* bad entry cannot fail the whole config and drop \`mode\` back to its default.
|
|
12208
|
+
*/
|
|
12209
|
+
fixtures: z.unknown().optional(),
|
|
12161
12210
|
});
|
|
12162
12211
|
|
|
12163
12212
|
type Cfg = z.infer<typeof config>;
|
|
@@ -12358,6 +12407,27 @@ export const resolveTransport = (cfg: Cfg): JevTransport => {
|
|
|
12358
12407
|
);
|
|
12359
12408
|
};
|
|
12360
12409
|
|
|
12410
|
+
/**
|
|
12411
|
+
* The judge input for one message. The live gate and the self-test fixtures build it
|
|
12412
|
+
* here, so a fixture is judged exactly like real traffic.
|
|
12413
|
+
*/
|
|
12414
|
+
export const gateState = (s: {
|
|
12415
|
+
requester: string;
|
|
12416
|
+
prefs: Prefs;
|
|
12417
|
+
ask: string;
|
|
12418
|
+
threadOpening: string;
|
|
12419
|
+
text: string;
|
|
12420
|
+
}): Record<string, unknown> => ({
|
|
12421
|
+
role: "You audit an AI agent's message to the human who requested the work.",
|
|
12422
|
+
requester: s.requester,
|
|
12423
|
+
requester_preferences: s.prefs,
|
|
12424
|
+
latest_request: s.ask,
|
|
12425
|
+
thread_opening: s.threadOpening,
|
|
12426
|
+
judging_rules: JUDGING_RULES,
|
|
12427
|
+
plain_language_rules: PLAIN_RULES,
|
|
12428
|
+
agent_message: s.text,
|
|
12429
|
+
});
|
|
12430
|
+
|
|
12361
12431
|
/** One Jev call; returns the \`noul\` score per question. Throws on any failure. */
|
|
12362
12432
|
export const askJev = async (
|
|
12363
12433
|
state: Record<string, unknown>,
|
|
@@ -12414,6 +12484,72 @@ const SELFTEST_PLAIN_GOOD =
|
|
|
12414
12484
|
const below = (bad: unknown, good: unknown, threshold: number): boolean =>
|
|
12415
12485
|
typeof bad === "number" && typeof good === "number" && bad < threshold && good >= threshold;
|
|
12416
12486
|
|
|
12487
|
+
/** Fixtures judged per self-test run: one Jev call each, inside the 5 s handler budget. */
|
|
12488
|
+
export const MAX_FIXTURES = 8;
|
|
12489
|
+
const fixture = z.object({
|
|
12490
|
+
name: z.string().min(1).max(80),
|
|
12491
|
+
/** The fixed text as it will be posted, placeholders filled with sample values. */
|
|
12492
|
+
text: z.string().min(1).max(4000),
|
|
12493
|
+
/** Audience preferences; omit to judge \`plain\` only. */
|
|
12494
|
+
prefs: z
|
|
12495
|
+
.object({
|
|
12496
|
+
verbosity: z.string().optional(),
|
|
12497
|
+
tone: z.string().optional(),
|
|
12498
|
+
language: z.string().optional(),
|
|
12499
|
+
})
|
|
12500
|
+
.optional(),
|
|
12501
|
+
/** The request the text answers, as \`latest_request\`. */
|
|
12502
|
+
request: z.string().max(900).optional(),
|
|
12503
|
+
});
|
|
12504
|
+
export type Fixture = z.infer<typeof fixture>;
|
|
12505
|
+
|
|
12506
|
+
/** Valid fixture entries, in order, capped at MAX_FIXTURES; invalid entries are skipped. */
|
|
12507
|
+
export const fixturesOf = (raw: unknown): Fixture[] =>
|
|
12508
|
+
(Array.isArray(raw) ? raw : [])
|
|
12509
|
+
.map((f) => fixture.safeParse(f))
|
|
12510
|
+
.filter((r) => r.success)
|
|
12511
|
+
.map((r) => r.data)
|
|
12512
|
+
.slice(0, MAX_FIXTURES);
|
|
12513
|
+
|
|
12514
|
+
/**
|
|
12515
|
+
* Judge each fixture with the live gate's questions and state. A fixture is fixed
|
|
12516
|
+
* text the operator expects to pass, so any dimension below its threshold fails it.
|
|
12517
|
+
*/
|
|
12518
|
+
const judgeFixtures = async (
|
|
12519
|
+
fixtures: Fixture[],
|
|
12520
|
+
transport: JevTransport,
|
|
12521
|
+
cfg: Cfg,
|
|
12522
|
+
signal?: AbortSignal,
|
|
12523
|
+
) =>
|
|
12524
|
+
Promise.all(
|
|
12525
|
+
fixtures.map(async (f) => {
|
|
12526
|
+
const prefs: Prefs = f.prefs ?? {};
|
|
12527
|
+
const questions = { ...buildQuestions(prefs), plain: PLAIN_QUESTION };
|
|
12528
|
+
try {
|
|
12529
|
+
const { scores } = await askJev(
|
|
12530
|
+
gateState({
|
|
12531
|
+
requester: "the requester",
|
|
12532
|
+
prefs,
|
|
12533
|
+
ask: f.request ?? "",
|
|
12534
|
+
threadOpening: "",
|
|
12535
|
+
text: f.text,
|
|
12536
|
+
}),
|
|
12537
|
+
questions,
|
|
12538
|
+
transport,
|
|
12539
|
+
cfg,
|
|
12540
|
+
signal,
|
|
12541
|
+
);
|
|
12542
|
+
const failed = Object.keys(questions).filter((dim) => {
|
|
12543
|
+
const s = scores[dim];
|
|
12544
|
+
return typeof s !== "number" || s < (dim === "plain" ? cfg.plainThreshold : cfg.threshold);
|
|
12545
|
+
});
|
|
12546
|
+
return { name: f.name, scores, failed, pass: failed.length === 0 };
|
|
12547
|
+
} catch (err) {
|
|
12548
|
+
return { name: f.name, error: String(err).slice(0, 200), pass: false };
|
|
12549
|
+
}
|
|
12550
|
+
}),
|
|
12551
|
+
);
|
|
12552
|
+
|
|
12417
12553
|
/**
|
|
12418
12554
|
* Run the judge on known-bad (positive control, must score below threshold) and
|
|
12419
12555
|
* known-good (negative control, must score at or above it) messages and record
|
|
@@ -12434,11 +12570,13 @@ const selfTest = async (swarm: Swarm, cfg: Cfg, signal?: AbortSignal): Promise<v
|
|
|
12434
12570
|
cfg,
|
|
12435
12571
|
signal,
|
|
12436
12572
|
).then((r) => r.scores[dim] ?? null);
|
|
12437
|
-
const
|
|
12573
|
+
const fixtures = fixturesOf(cfg.fixtures);
|
|
12574
|
+
const [bad, good, plainBad, plainGood, fixtureResults] = await Promise.all([
|
|
12438
12575
|
judge(SELFTEST_BAD, "verbosity"),
|
|
12439
12576
|
judge(SELFTEST_GOOD, "verbosity"),
|
|
12440
12577
|
judge(SELFTEST_PLAIN_BAD, "plain"),
|
|
12441
12578
|
judge(SELFTEST_PLAIN_GOOD, "plain"),
|
|
12579
|
+
judgeFixtures(fixtures, transport, cfg, signal),
|
|
12442
12580
|
]);
|
|
12443
12581
|
await swarm.kv_set({
|
|
12444
12582
|
namespace: NS,
|
|
@@ -12454,6 +12592,9 @@ const selfTest = async (swarm: Swarm, cfg: Cfg, signal?: AbortSignal): Promise<v
|
|
|
12454
12592
|
plainPositiveControlBadScore: plainBad,
|
|
12455
12593
|
plainNegativeControlGoodScore: plainGood,
|
|
12456
12594
|
plainControlsOk: below(plainBad, plainGood, cfg.plainThreshold),
|
|
12595
|
+
fixtures: fixtureResults,
|
|
12596
|
+
// null when none are configured: zero fixtures is not a pass.
|
|
12597
|
+
fixturesOk: fixtureResults.length === 0 ? null : fixtureResults.every((f) => f.pass),
|
|
12457
12598
|
latencyMs: Date.now() - started,
|
|
12458
12599
|
},
|
|
12459
12600
|
});
|
|
@@ -12665,16 +12806,7 @@ const extension: SwarmExtension = (api) => {
|
|
|
12665
12806
|
|
|
12666
12807
|
const transport = resolveTransport(cfg);
|
|
12667
12808
|
const { scores, latencyMs } = await askJev(
|
|
12668
|
-
{
|
|
12669
|
-
role: "You audit an AI agent's message to the human who requested the work.",
|
|
12670
|
-
requester: audienceName,
|
|
12671
|
-
requester_preferences: prefs,
|
|
12672
|
-
latest_request: ask,
|
|
12673
|
-
thread_opening: threadOpening,
|
|
12674
|
-
judging_rules: JUDGING_RULES,
|
|
12675
|
-
plain_language_rules: PLAIN_RULES,
|
|
12676
|
-
agent_message: text,
|
|
12677
|
-
},
|
|
12809
|
+
gateState({ requester: audienceName, prefs, ask, threadOpening, text }),
|
|
12678
12810
|
questions,
|
|
12679
12811
|
transport,
|
|
12680
12812
|
cfg,
|
|
@@ -12796,7 +12928,7 @@ const extension: SwarmExtension = (api) => {
|
|
|
12796
12928
|
export default extension;
|
|
12797
12929
|
`
|
|
12798
12930
|
},
|
|
12799
|
-
readme: '# comms-adherence-gate\n\nAgents finish Slack tasks with a final message a human reads, and post to Slack threads directly. This extension judges that text with Jev, [TypeSafe](https://typesafe.ai)\'s decision model: against the requester\'s stated comms preferences and their latest request, and against a plain-language rubric that applies to every message. In `enforce` it blocks a failing call once and tells the agent what to fix. A `plain` failure points the agent at the `comms` skill.\n\nInstall config:\n\n```json\n{ "mode": "shadow", "plainMode": "shadow" }\n```\n\nStart in `shadow`, read the verdicts in KV for a few days, then switch to `enforce`. `mode` and `plainMode` move independently.\n\n## Modes\n\n| `mode` | Effect |\n|---|---|\n| `off` | Never evaluates. |\n| `shadow` (default) | Asks Jev and records the verdict. Never blocks. |\n| `enforce` | Asks Jev, records the verdict, and blocks the call when a dimension fails, at most `maxBlocksPerTask` times per task. The agent gets the failed dimensions, their scores and the stated preference, and calls again. |\n\n`mode` governs the preference dimensions (`verbosity`, `tone`, `language`). `plainMode` governs `plain`. A dimension blocks only when its own mode is `enforce`. Both share one block budget per task, across every gated tool.\n\n## What it gates\n\nHook: `pre.tool.call` on:\n\n- `store-progress` with `status: "completed"` and a non-empty `output`, on a task that came from Slack (`source = "slack"` or a `slackThreadTs`). Other completions pass without a Jev call.\n- `slack-reply`, `slack-post`, `slack-start-thread` and `slack-update`, judged on `message`. The task is `slack-reply`\'s `taskId`, else the caller\'s task context. A post with no task context passes.\n\nOnly a call the tool itself accepts is judged, so no other task\'s text reaches Jev. For `store-progress` the caller must own the task, the task must be unassigned, or the caller must be a lead. For the Slack tools the caller must be the task\'s assignee or its creator, the rule `slack-reply` enforces. Calls made by extensions are skipped. Script SDK calls never reach `pre.tool.call` (the tool registrar dispatches it only for MCP calls); if one ever does, the gate records it and never blocks.\n\nA requester with no stated preferences in `users.metadata.comms` still gets the `plain` question. Set preferences with the `manage-user` tool.\n\nIn a thread with several people, the requester is the person whose message created the task. A message that @-mentions someone (`<@U123>`) is judged against the first mentioned person with stored preferences, resolved through their Slack identity in `user_external_ids`; otherwise against the requester. The lookup is one SQL read, only when the text mentions someone and `mode` is not `off`. The verdict records who was judged in `judgedFor` (`mention` or `requester`) and `audience`.\n\n## Decision\n\nThe gate reads the task row and asks one `noul` question per stated preference it knows: `verbosity`, `tone`, `language`. Any other key in `comms` is context only.\n\nJev sees the preferences, the requester\'s latest message (the text after the last `</thread_context>`, from the last 1,400 characters of the task), the first 400 characters of the task, and the output. Its judging rules say an explicit request outranks the stored default. A requested long answer, story or document is not a verbosity failure.\n\nIt also asks `plain` on every message unless `plainMode` is `off` or the text is a JSON document (structured output for an `outputSchema`). The rubric comes from the `comms` skill: everyday words, one idea per sentence, every number with a unit and a direction word, and no unexplained shorthand (n, median, p90, cohort, baseline, delta, `±X at 95%`). Code identifiers, task ids, PR numbers, links and versions are fine. Jev gets contrasting plain and dense examples in `plain_language_rules`; a prose-only rubric scored plain rewrites as low as the dense originals.\n\nAll questions go in one Jev request. A preference dimension fails below `threshold`; `plain` fails below `plainThreshold`. Any failed dimension fails the message.\n\n### Calibration of `plain`\n\nJev scores dense status text near 0 and plain text near 0.8 to 0.9, with a wide middle of compact but readable engineering notes. Measured on 400 Slack-facing completions over 7 days, at `threshold` 0.75 for preferences:\n\n| `plainThreshold` | Newly blocked (of messages that pass today) |\n|---|---|\n| 0.75 | 81% to 83% |\n| 0.3 | 9% to 13% |\n| 0.25 (default) | 5% to 7% |\n\nAt 0.25 the dense prompt-cache-monitor post scores about 0.15 and its plain rewrite about 0.81.\n\n## Jev transport\n\nJev is reachable two ways. Both take the same request and return the same answer.\n\n| `provider` | Endpoint | Key | Model |\n|---|---|---|---|\n| `typesafe` | `POST https://api.typesafe.ai/v1/systemone` | `TYPESAFE_API_KEY` (or `apiKey`) | `model`, default `jev-latest` |\n| `openrouter` | `POST https://openrouter.ai/api/alpha/decisions` | `OPENROUTER_API_KEY` | `openrouterModel`, default `typesafe/jev-1.13` |\n| `auto` (default) | TypeSafe when its key is set, else OpenRouter | | |\n\nEach verdict row records the `provider` that answered.\n\n## Fail open\n\nEvery error lets the completion through: a missing key, an HTTP error, a network error, a timeout, a malformed answer, or a failed DB read. The handler never throws, so an outage cannot auto-disable the extension. Each failure bumps the `error` counter and overwrites `error:last`.\n\n## Self-test\n\nCall `store-progress` with a non-completed status and `progress` starting with `comms-gate-selftest`. The gate judges a known-bad and a known-good message against a terse preference, and a dense and a plain message on `plain`, then writes `selftest:last`: every score, both thresholds, the provider, `controlsOk` (verbosity: bad below `threshold`, good at or above it) and `plainControlsOk` (the same against `plainThreshold`). Real traffic is untouched.\n\n## Config\n\n| Key | Default | Notes |\n|---|---|---|\n| `mode` | `shadow` | `off`, `shadow`, or `enforce` |\n| `threshold` | `0.5` | A preference dimension scoring below this fails |\n| `plainMode` | `shadow` | `off`, `shadow`, or `enforce` for the `plain` dimension |\n| `plainThreshold` | `0.25` | `plain` scoring below this fails. See [Calibration](#calibration-of-plain) |\n| `timeoutMs` | `4000` | Jev call timeout, capped at 4000 (the dispatcher cancels a handler at 5 s) |\n| `maxBlocksPerTask` | `1` | Blocks per task in `enforce`; after that the gate records and lets it through |\n| `provider` | `auto` | `auto`, `typesafe`, or `openrouter`. See [Jev transport](#jev-transport) |\n| `model` | `jev-latest` | Jev model on TypeSafe |\n| `openrouterModel` | `typesafe/jev-1.13` | Jev model on OpenRouter |\n| `apiKey` | unset | Explicit TypeSafe key. Prefer the `TYPESAFE_API_KEY` secret below |\n\n## Required secrets\n\nRead from the API process environment at call time. Set them as global `swarm_config` secrets: the API process loads global rows into `process.env` at boot and on config reload.\n\n- `TYPESAFE_API_KEY` or `OPENROUTER_API_KEY`: one is required for any evaluation. Under `auto`, TypeSafe wins when both are set. Without either, every completion fails open.\n\nNo key is written to config, KV, logs, or a block reason.\n\n## KV namespace `ext:comms-gate`\n\n- `last`: the latest verdict, with `tool`, `scores`, `failed`, `mode`, `plainMode`, `provider`, `latencyMs`, the preferences, a 400-character `askPreview` and a 700-character `outputPreview`.\n- `fail:<epochMs>:<taskId>`: one row per failed verdict, with `action` (`blocked` or `recorded`).\n- `blocks:<taskId>`: blocks issued for that task.\n- `error:last`, `selftest:last`.\n- Counters: `total`, `pass`, `fail`, `blocked`, `escaped` (a blocking dimension failed, block budget spent), `shadowed` (only non-blocking dimensions failed), `error`, and `dim:<dimension>`.\n\n## Known limits\n\n- Only the last 1,400 characters of the task are searched for the latest request. A very long final message is cut to its last 900 characters.\n- The block budget is per task, so a retried call after a block goes through once the budget is spent, even if it still fails.\n- Each gated Slack post waits for one Jev call (about 0.2 s measured, capped by `timeoutMs`).\n'
|
|
12931
|
+
readme: '# comms-adherence-gate\n\nAgents finish Slack tasks with a final message a human reads, and post to Slack threads directly. This extension judges that text with Jev, [TypeSafe](https://typesafe.ai)\'s decision model: against the requester\'s stated comms preferences and their latest request, and against a plain-language rubric that applies to every message. In `enforce` it blocks a failing call once and tells the agent what to fix. A `plain` failure points the agent at the `comms` skill.\n\nInstall config:\n\n```json\n{ "mode": "shadow", "plainMode": "shadow" }\n```\n\nStart in `shadow`, read the verdicts in KV for a few days, then switch to `enforce`. `mode` and `plainMode` move independently.\n\n## Modes\n\n| `mode` | Effect |\n|---|---|\n| `off` | Never evaluates. |\n| `shadow` (default) | Asks Jev and records the verdict. Never blocks. |\n| `enforce` | Asks Jev, records the verdict, and blocks the call when a dimension fails, at most `maxBlocksPerTask` times per task. The agent gets the failed dimensions, their scores and the stated preference, and calls again. |\n\n`mode` governs the preference dimensions (`verbosity`, `tone`, `language`). `plainMode` governs `plain`. A dimension blocks only when its own mode is `enforce`. Both share one block budget per task, across every gated tool.\n\n## What it gates\n\nHook: `pre.tool.call` on:\n\n- `store-progress` with `status: "completed"` and a non-empty `output`, on a task that came from Slack (`source = "slack"` or a `slackThreadTs`). Other completions pass without a Jev call.\n- `slack-reply`, `slack-post`, `slack-start-thread` and `slack-update`, judged on `message`. The task is `slack-reply`\'s `taskId`, else the caller\'s task context. A post with no task context passes.\n\nOnly a call the tool itself accepts is judged, so no other task\'s text reaches Jev. For `store-progress` the caller must own the task, the task must be unassigned, or the caller must be a lead. For the Slack tools the caller must be the task\'s assignee or its creator, the rule `slack-reply` enforces. Calls made by extensions are skipped. Script SDK calls never reach `pre.tool.call` (the tool registrar dispatches it only for MCP calls); if one ever does, the gate records it and never blocks.\n\nA requester with no stated preferences in `users.metadata.comms` still gets the `plain` question. Set preferences with the `manage-user` tool.\n\nIn a thread with several people, the requester is the person whose message created the task. A message that @-mentions someone (`<@U123>`) is judged against the first mentioned person with stored preferences, resolved through their Slack identity in `user_external_ids`; otherwise against the requester. The lookup is one SQL read, only when the text mentions someone and `mode` is not `off`. The verdict records who was judged in `judgedFor` (`mention` or `requester`) and `audience`.\n\n## Decision\n\nThe gate reads the task row and asks one `noul` question per stated preference it knows: `verbosity`, `tone`, `language`. Any other key in `comms` is context only.\n\nJev sees the preferences, the requester\'s latest message (the text after the last `</thread_context>`, from the last 1,400 characters of the task), the first 400 characters of the task, and the output. Its judging rules say an explicit request outranks the stored default. A requested long answer, story or document is not a verbosity failure.\n\nIt also asks `plain` on every message unless `plainMode` is `off` or the text is a JSON document (structured output for an `outputSchema`). The rubric comes from the `comms` skill: everyday words, one idea per sentence, every number with a unit and a direction word, and no unexplained shorthand (n, median, p90, cohort, baseline, delta, `±X at 95%`). Code identifiers, task ids, PR numbers, links and versions are fine. Jev gets contrasting plain and dense examples in `plain_language_rules`; a prose-only rubric scored plain rewrites as low as the dense originals.\n\nAll questions go in one Jev request. A preference dimension fails below `threshold`; `plain` fails below `plainThreshold`. Any failed dimension fails the message.\n\n### Calibration of `plain`\n\nJev scores dense status text near 0 and plain text near 0.8 to 0.9, with a wide middle of compact but readable engineering notes. Measured on 400 Slack-facing completions over 7 days, at `threshold` 0.75 for preferences:\n\n| `plainThreshold` | Newly blocked (of messages that pass today) |\n|---|---|\n| 0.75 | 81% to 83% |\n| 0.3 | 9% to 13% |\n| 0.25 (default) | 5% to 7% |\n\nAt 0.25 the dense prompt-cache-monitor post scores about 0.15 and its plain rewrite about 0.81.\n\n## Jev transport\n\nJev is reachable two ways. Both take the same request and return the same answer.\n\n| `provider` | Endpoint | Key | Model |\n|---|---|---|---|\n| `typesafe` | `POST https://api.typesafe.ai/v1/systemone` | `TYPESAFE_API_KEY` (or `apiKey`) | `model`, default `jev-latest` |\n| `openrouter` | `POST https://openrouter.ai/api/alpha/decisions` | `OPENROUTER_API_KEY` | `openrouterModel`, default `typesafe/jev-1.13` |\n| `auto` (default) | TypeSafe when its key is set, else OpenRouter | | |\n\nEach verdict row records the `provider` that answered.\n\n## Fail open\n\nEvery error lets the completion through: a missing key, an HTTP error, a network error, a timeout, a malformed answer, or a failed DB read. The handler never throws, so an outage cannot auto-disable the extension. Each failure bumps the `error` counter and overwrites `error:last`.\n\n## Self-test\n\nCall `store-progress` with a non-completed status and `progress` starting with `comms-gate-selftest`. The gate judges a known-bad and a known-good message against a terse preference, and a dense and a plain message on `plain`, then writes `selftest:last`: every score, both thresholds, the provider, `controlsOk` (verbosity: bad below `threshold`, good at or above it) and `plainControlsOk` (the same against `plainThreshold`). Real traffic is untouched.\n\n### Fixtures\n\nFixed text that your own templates tell an agent to post (a daily report\'s all-clear line, a standard reply) should pass the gate. List it under `fixtures` and the self-test judges each entry with the same state and questions as real traffic, then records `fixtures` (per entry: `name`, `scores`, `failed`, `pass`) and `fixturesOk` in `selftest:last`. A failing fixture means the template line or the gate needs a fix before a quiet day forces an ad-hoc rewrite.\n\n```json\n{\n "fixtures": [\n { "name": "daily-report-all-clear", "text": "📊 11-03: all clear, nothing for you. 56 of 73 workflows are turned on." },\n {\n "name": "short-reply",\n "text": "Went with option B: it keeps the migration reversible. PR #123.",\n "prefs": { "verbosity": "very terse, ~400 chars max" },\n "request": "which option did you pick?"\n }\n ]\n}\n```\n\nFill placeholders with realistic sample values. `prefs` adds the preference dimensions it names; without it only `plain` is judged. At most 8 entries run; an invalid entry is skipped, never fatal to the rest of the config.\n\n`fixturesOk` is `true` only when at least one entry ran and every entry passed. It is `null` when no valid entry ran: `fixtures` unset, an explicit `fixtures: []`, or every entry invalid. `null` means nothing was checked, so never read it as a pass. A skipped entry is missing from `fixtures` in `selftest:last`, so compare that list with your config.\n\nUnit tests mock Jev, so they cannot show that a line passes. Only the self-test, which calls the live judge, can.\n\n## Config\n\n| Key | Default | Notes |\n|---|---|---|\n| `mode` | `shadow` | `off`, `shadow`, or `enforce` |\n| `threshold` | `0.5` | A preference dimension scoring below this fails |\n| `plainMode` | `shadow` | `off`, `shadow`, or `enforce` for the `plain` dimension |\n| `plainThreshold` | `0.25` | `plain` scoring below this fails. See [Calibration](#calibration-of-plain) |\n| `timeoutMs` | `4000` | Jev call timeout, capped at 4000 (the dispatcher cancels a handler at 5 s) |\n| `maxBlocksPerTask` | `1` | Blocks per task in `enforce`; after that the gate records and lets it through |\n| `provider` | `auto` | `auto`, `typesafe`, or `openrouter`. See [Jev transport](#jev-transport) |\n| `model` | `jev-latest` | Jev model on TypeSafe |\n| `openrouterModel` | `typesafe/jev-1.13` | Jev model on OpenRouter |\n| `apiKey` | unset | Explicit TypeSafe key. Prefer the `TYPESAFE_API_KEY` secret below |\n| `fixtures` | unset | Fixed template text the self-test expects to pass. See [Fixtures](#fixtures) |\n\n## Required secrets\n\nRead from the API process environment at call time. Set them as global `swarm_config` secrets: the API process loads global rows into `process.env` at boot and on config reload.\n\n- `TYPESAFE_API_KEY` or `OPENROUTER_API_KEY`: one is required for any evaluation. Under `auto`, TypeSafe wins when both are set. Without either, every completion fails open.\n\nNo key is written to config, KV, logs, or a block reason.\n\n## KV namespace `ext:comms-gate`\n\n- `last`: the latest verdict, with `tool`, `scores`, `failed`, `mode`, `plainMode`, `provider`, `latencyMs`, the preferences, a 400-character `askPreview` and a 700-character `outputPreview`.\n- `fail:<epochMs>:<taskId>`: one row per failed verdict, with `action` (`blocked` or `recorded`).\n- `blocks:<taskId>`: blocks issued for that task.\n- `error:last`, `selftest:last`.\n- Counters: `total`, `pass`, `fail`, `blocked`, `escaped` (a blocking dimension failed, block budget spent), `shadowed` (only non-blocking dimensions failed), `error`, and `dim:<dimension>`.\n\n## Known limits\n\n- Only the last 1,400 characters of the task are searched for the latest request. A very long final message is cut to its last 900 characters.\n- The block budget is per task, so a retried call after a block goes through once the budget is spent, even if it still fails.\n- Each gated Slack post waits for one Jev call (about 0.2 s measured, capped by `timeoutMs`).\n'
|
|
12800
12932
|
},
|
|
12801
12933
|
"deploy-awareness": {
|
|
12802
12934
|
manifestFile: "manifest.json",
|
|
@@ -15668,6 +15800,268 @@ async function handleHeartbeat(req, res, pathSegments) {
|
|
|
15668
15800
|
return false;
|
|
15669
15801
|
}
|
|
15670
15802
|
|
|
15803
|
+
// src/http/improvements.ts
|
|
15804
|
+
init_zod();
|
|
15805
|
+
init_improvements();
|
|
15806
|
+
init_rbac();
|
|
15807
|
+
init_request_principal();
|
|
15808
|
+
init_route_def();
|
|
15809
|
+
init_utils2();
|
|
15810
|
+
var ImprovementSchema = object2({
|
|
15811
|
+
id: string2(),
|
|
15812
|
+
text: string2(),
|
|
15813
|
+
email: string2().nullable(),
|
|
15814
|
+
status: _enum2(IMPROVEMENT_STATUSES),
|
|
15815
|
+
source: _enum2(IMPROVEMENT_SOURCES),
|
|
15816
|
+
requestedByAgentId: string2().nullable(),
|
|
15817
|
+
approvedBy: string2().nullable(),
|
|
15818
|
+
approvedAt: string2().nullable(),
|
|
15819
|
+
sentAt: string2().nullable(),
|
|
15820
|
+
proxyStatus: number2().nullable(),
|
|
15821
|
+
proxyId: string2().nullable(),
|
|
15822
|
+
proxyError: string2().nullable(),
|
|
15823
|
+
createdAt: string2(),
|
|
15824
|
+
updatedAt: string2(),
|
|
15825
|
+
leakHints: array2(string2()).optional().describe("Substrings that look install-specific (agent, repo, host, org or user email). Pending and failed rows only. They warn; they never block.")
|
|
15826
|
+
});
|
|
15827
|
+
var EmailSchema = string2().max(320, "Email must be at most 320 characters").email("Email must be a valid email address");
|
|
15828
|
+
var PERSON_REFUSED = "Agents cannot approve improvements. A person must approve with a user token or the dashboard.";
|
|
15829
|
+
var listRoute3 = route({
|
|
15830
|
+
method: "get",
|
|
15831
|
+
path: "/api/improvements",
|
|
15832
|
+
pattern: ["api", "improvements"],
|
|
15833
|
+
summary: "List product improvements",
|
|
15834
|
+
description: "Lists improvements newest first, with `enabled` for the `IMPROVEMENTS_ENABLED` switch: every pending and failed row, plus the newest 100 other rows. Pending and failed rows carry `leakHints` for the approver.",
|
|
15835
|
+
tags: ["Improvements"],
|
|
15836
|
+
responses: {
|
|
15837
|
+
200: {
|
|
15838
|
+
description: "Improvements and the switch state",
|
|
15839
|
+
schema: object2({ enabled: boolean(), improvements: array2(ImprovementSchema) })
|
|
15840
|
+
}
|
|
15841
|
+
},
|
|
15842
|
+
auth: { apiKey: true }
|
|
15843
|
+
});
|
|
15844
|
+
var createRoute2 = route({
|
|
15845
|
+
method: "post",
|
|
15846
|
+
path: "/api/improvements",
|
|
15847
|
+
pattern: ["api", "improvements"],
|
|
15848
|
+
summary: "Draft a product improvement, or send one as a person",
|
|
15849
|
+
description: "Stores the text, scrubbed of known secrets, as `pending_approval`. An agent caller always gets a pending draft. A person (user token, or the shared key with no agent identity) may pass `sendNow: true` to approve and send in one call, unless scrubbing changed the text: then it stays pending so they can review it. `sendNow` needs a valid `email` (400 without one); a draft does not. Only `install_id` (always), `text` and `email` are sent to desplega.",
|
|
15850
|
+
tags: ["Improvements"],
|
|
15851
|
+
body: object2({
|
|
15852
|
+
text: string2().max(IMPROVEMENT_TEXT_MAX * 2),
|
|
15853
|
+
email: EmailSchema.optional(),
|
|
15854
|
+
sendNow: boolean().optional(),
|
|
15855
|
+
source: _enum2(["ui", "api"]).optional()
|
|
15856
|
+
}),
|
|
15857
|
+
responses: {
|
|
15858
|
+
200: {
|
|
15859
|
+
description: "A person's `sendNow` was approved and sent (see `status`)",
|
|
15860
|
+
schema: object2({ improvement: ImprovementSchema })
|
|
15861
|
+
},
|
|
15862
|
+
201: {
|
|
15863
|
+
description: "Draft stored as `pending_approval`",
|
|
15864
|
+
schema: object2({ improvement: ImprovementSchema })
|
|
15865
|
+
},
|
|
15866
|
+
400: { description: "Invalid text or email, or `sendNow` without an email" },
|
|
15867
|
+
403: { description: "The caller may not draft improvements" },
|
|
15868
|
+
409: { description: "Improvements are turned off" }
|
|
15869
|
+
},
|
|
15870
|
+
auth: { apiKey: true },
|
|
15871
|
+
rbac: { permission: "improvement.submit" }
|
|
15872
|
+
});
|
|
15873
|
+
var approveRoute = route({
|
|
15874
|
+
method: "post",
|
|
15875
|
+
path: "/api/improvements/{id}/approve",
|
|
15876
|
+
pattern: ["api", "improvements", null, "approve"],
|
|
15877
|
+
summary: "Approve and send a drafted improvement",
|
|
15878
|
+
description: "Only a person may approve: a user token, or the shared key with no agent identity (recorded as `operator`). `approvedBy` is taken from the credential, never the body. `email` is required and is sent with the text and the install id. The stored text is sent as is; to change it, discard and draft again. A failed send can be approved again. There is no automatic retry.",
|
|
15879
|
+
tags: ["Improvements"],
|
|
15880
|
+
params: object2({ id: string2().uuid() }),
|
|
15881
|
+
body: object2({ email: EmailSchema.describe("The approver's email, sent with the text.") }),
|
|
15882
|
+
responses: {
|
|
15883
|
+
200: {
|
|
15884
|
+
description: "Approved. `status` is `sent`, or `failed` with the proxy status and error.",
|
|
15885
|
+
schema: object2({ improvement: ImprovementSchema })
|
|
15886
|
+
},
|
|
15887
|
+
400: { description: "Missing or invalid email" },
|
|
15888
|
+
403: { description: "Caller is an agent" },
|
|
15889
|
+
404: { description: "Not found" },
|
|
15890
|
+
409: { description: "Already sent, sending or discarded, or improvements are turned off" }
|
|
15891
|
+
},
|
|
15892
|
+
auth: { apiKey: true },
|
|
15893
|
+
rbac: { permission: "improvement.approve" }
|
|
15894
|
+
});
|
|
15895
|
+
var discardRoute = route({
|
|
15896
|
+
method: "post",
|
|
15897
|
+
path: "/api/improvements/{id}/discard",
|
|
15898
|
+
pattern: ["api", "improvements", null, "discard"],
|
|
15899
|
+
summary: "Discard a drafted improvement",
|
|
15900
|
+
description: "A person may discard any pending or failed improvement. An agent may discard only a draft it requested.",
|
|
15901
|
+
tags: ["Improvements"],
|
|
15902
|
+
params: object2({ id: string2().uuid() }),
|
|
15903
|
+
responses: {
|
|
15904
|
+
200: {
|
|
15905
|
+
description: "Discarded",
|
|
15906
|
+
schema: object2({ improvement: ImprovementSchema })
|
|
15907
|
+
},
|
|
15908
|
+
403: { description: "Caller is an agent that did not request this draft" },
|
|
15909
|
+
404: { description: "Not found" },
|
|
15910
|
+
409: { description: "Already sent or discarded, or improvements are turned off" }
|
|
15911
|
+
},
|
|
15912
|
+
auth: { apiKey: true },
|
|
15913
|
+
rbac: { permission: "improvement.submit" }
|
|
15914
|
+
});
|
|
15915
|
+
function headerAgentId(req) {
|
|
15916
|
+
const raw = req.headers["x-agent-id"];
|
|
15917
|
+
return Array.isArray(raw) ? raw[0] : raw;
|
|
15918
|
+
}
|
|
15919
|
+
function writeImprovementError(res, error) {
|
|
15920
|
+
if (!(error instanceof ImprovementError))
|
|
15921
|
+
return false;
|
|
15922
|
+
const status = error.code === "invalid_text" || error.code === "invalid_email" ? 400 : error.code === "not_found" ? 404 : 409;
|
|
15923
|
+
if (error.code === "improvements_disabled") {
|
|
15924
|
+
res.writeHead(409, { "Content-Type": "application/json" });
|
|
15925
|
+
res.end(JSON.stringify({ error: error.message, code: error.code }));
|
|
15926
|
+
return true;
|
|
15927
|
+
}
|
|
15928
|
+
jsonError(res, error.message, status);
|
|
15929
|
+
return true;
|
|
15930
|
+
}
|
|
15931
|
+
async function withLeakHints(improvement) {
|
|
15932
|
+
if (improvement.status !== "pending_approval" && improvement.status !== "failed") {
|
|
15933
|
+
return improvement;
|
|
15934
|
+
}
|
|
15935
|
+
return { ...improvement, leakHints: await improvementLeakHints(improvement.text) };
|
|
15936
|
+
}
|
|
15937
|
+
async function improvementsEndpoint() {
|
|
15938
|
+
return telemetryProxyEndpoint("/v1/improvements");
|
|
15939
|
+
}
|
|
15940
|
+
async function handleImprovements(req, res, pathSegments, queryParams) {
|
|
15941
|
+
if (listRoute3.match(req.method, pathSegments)) {
|
|
15942
|
+
const parsed = await listRoute3.parse(req, res, pathSegments, queryParams);
|
|
15943
|
+
if (!parsed)
|
|
15944
|
+
return true;
|
|
15945
|
+
const rows = await listImprovements();
|
|
15946
|
+
listRoute3.respond(res, 200, {
|
|
15947
|
+
enabled: await isImprovementsEnabled(),
|
|
15948
|
+
improvements: await Promise.all(rows.map(withLeakHints))
|
|
15949
|
+
});
|
|
15950
|
+
return true;
|
|
15951
|
+
}
|
|
15952
|
+
if (createRoute2.match(req.method, pathSegments)) {
|
|
15953
|
+
const parsed = await createRoute2.parse(req, res, pathSegments, queryParams);
|
|
15954
|
+
if (!parsed)
|
|
15955
|
+
return true;
|
|
15956
|
+
const { text, email, sendNow, source } = parsed.body;
|
|
15957
|
+
if (sendNow && !email) {
|
|
15958
|
+
jsonError(res, "sendNow needs a valid email.", 400);
|
|
15959
|
+
return true;
|
|
15960
|
+
}
|
|
15961
|
+
const principal = await agentFirstPrincipal(req, headerAgentId(req));
|
|
15962
|
+
const decision = can({ principal, verb: "improvement.submit", source: "http" });
|
|
15963
|
+
if (!decision.allow) {
|
|
15964
|
+
jsonError(res, decision.reason, 403);
|
|
15965
|
+
return true;
|
|
15966
|
+
}
|
|
15967
|
+
const agentId = principal.kind === "agent" ? principal.agentId || null : null;
|
|
15968
|
+
const userId = principal.kind === "user" ? principal.userId : null;
|
|
15969
|
+
try {
|
|
15970
|
+
const { improvement, scrubChanged } = await createImprovement({
|
|
15971
|
+
text,
|
|
15972
|
+
source: source ?? "api",
|
|
15973
|
+
requestedByAgentId: agentId,
|
|
15974
|
+
createdBy: userId
|
|
15975
|
+
});
|
|
15976
|
+
if (sendNow && email && !scrubChanged) {
|
|
15977
|
+
const person = await approvalResponder(req, {
|
|
15978
|
+
verb: "improvement.approve",
|
|
15979
|
+
refusedMessage: PERSON_REFUSED
|
|
15980
|
+
});
|
|
15981
|
+
if (person.ok) {
|
|
15982
|
+
const sent = await approveAndSend(improvement.id, {
|
|
15983
|
+
approvedBy: responderKey(person.responder),
|
|
15984
|
+
email,
|
|
15985
|
+
endpoint: await improvementsEndpoint(),
|
|
15986
|
+
updatedBy: person.responder.kind === "user" ? person.responder.user.id : null
|
|
15987
|
+
});
|
|
15988
|
+
createRoute2.respond(res, 200, { improvement: sent });
|
|
15989
|
+
return true;
|
|
15990
|
+
}
|
|
15991
|
+
}
|
|
15992
|
+
createRoute2.respond(res, 201, { improvement: await withLeakHints(improvement) });
|
|
15993
|
+
} catch (error) {
|
|
15994
|
+
if (!writeImprovementError(res, error))
|
|
15995
|
+
throw error;
|
|
15996
|
+
}
|
|
15997
|
+
return true;
|
|
15998
|
+
}
|
|
15999
|
+
if (approveRoute.match(req.method, pathSegments)) {
|
|
16000
|
+
const parsed = await approveRoute.parse(req, res, pathSegments, queryParams);
|
|
16001
|
+
if (!parsed)
|
|
16002
|
+
return true;
|
|
16003
|
+
const person = await approvalResponder(req, {
|
|
16004
|
+
verb: "improvement.approve",
|
|
16005
|
+
refusedMessage: PERSON_REFUSED,
|
|
16006
|
+
pageMessage: "A page session without a signed-in user cannot approve improvements."
|
|
16007
|
+
});
|
|
16008
|
+
if (!person.ok) {
|
|
16009
|
+
jsonError(res, person.message, 403);
|
|
16010
|
+
return true;
|
|
16011
|
+
}
|
|
16012
|
+
try {
|
|
16013
|
+
const improvement = await approveAndSend(parsed.params.id, {
|
|
16014
|
+
approvedBy: responderKey(person.responder),
|
|
16015
|
+
email: parsed.body.email,
|
|
16016
|
+
endpoint: await improvementsEndpoint(),
|
|
16017
|
+
updatedBy: person.responder.kind === "user" ? person.responder.user.id : null
|
|
16018
|
+
});
|
|
16019
|
+
approveRoute.respond(res, 200, { improvement });
|
|
16020
|
+
} catch (error) {
|
|
16021
|
+
if (!writeImprovementError(res, error))
|
|
16022
|
+
throw error;
|
|
16023
|
+
}
|
|
16024
|
+
return true;
|
|
16025
|
+
}
|
|
16026
|
+
if (discardRoute.match(req.method, pathSegments)) {
|
|
16027
|
+
const parsed = await discardRoute.parse(req, res, pathSegments, queryParams);
|
|
16028
|
+
if (!parsed)
|
|
16029
|
+
return true;
|
|
16030
|
+
const existing = await getImprovement(parsed.params.id);
|
|
16031
|
+
if (!existing) {
|
|
16032
|
+
jsonError(res, "Improvement not found", 404);
|
|
16033
|
+
return true;
|
|
16034
|
+
}
|
|
16035
|
+
const principal = await agentFirstPrincipal(req, headerAgentId(req));
|
|
16036
|
+
let updatedBy = null;
|
|
16037
|
+
if (principal.kind === "agent") {
|
|
16038
|
+
if (!principal.agentId || principal.agentId !== existing.requestedByAgentId) {
|
|
16039
|
+
jsonError(res, "An agent may discard only an improvement it drafted.", 403);
|
|
16040
|
+
return true;
|
|
16041
|
+
}
|
|
16042
|
+
} else {
|
|
16043
|
+
const person = await approvalResponder(req, {
|
|
16044
|
+
verb: "improvement.approve",
|
|
16045
|
+
refusedMessage: "Only a person or the drafting agent may discard this improvement."
|
|
16046
|
+
});
|
|
16047
|
+
if (!person.ok) {
|
|
16048
|
+
jsonError(res, person.message, 403);
|
|
16049
|
+
return true;
|
|
16050
|
+
}
|
|
16051
|
+
updatedBy = person.responder.kind === "user" ? person.responder.user.id : null;
|
|
16052
|
+
}
|
|
16053
|
+
try {
|
|
16054
|
+
const improvement = await discardImprovement(parsed.params.id, { updatedBy });
|
|
16055
|
+
discardRoute.respond(res, 200, { improvement });
|
|
16056
|
+
} catch (error) {
|
|
16057
|
+
if (!writeImprovementError(res, error))
|
|
16058
|
+
throw error;
|
|
16059
|
+
}
|
|
16060
|
+
return true;
|
|
16061
|
+
}
|
|
16062
|
+
return false;
|
|
16063
|
+
}
|
|
16064
|
+
|
|
15671
16065
|
// src/http/inbox-state.ts
|
|
15672
16066
|
init_zod();
|
|
15673
16067
|
init_db4();
|
|
@@ -16226,7 +16620,7 @@ async function resolveAppUrl() {
|
|
|
16226
16620
|
// src/http/integrations.ts
|
|
16227
16621
|
init_route_def();
|
|
16228
16622
|
init_utils2();
|
|
16229
|
-
var ClaudeManagedTestResultSchema =
|
|
16623
|
+
var ClaudeManagedTestResultSchema = union3([
|
|
16230
16624
|
object2({
|
|
16231
16625
|
ok: literal2(true),
|
|
16232
16626
|
agentName: string2().nullable(),
|
|
@@ -18649,7 +19043,7 @@ var DiscoveryResultSchema = object2({
|
|
|
18649
19043
|
bearerMethodsSupported: array2(string2()).nullable(),
|
|
18650
19044
|
tokenEndpointAuthMethodsSupported: array2(string2()).nullable()
|
|
18651
19045
|
});
|
|
18652
|
-
var MetadataResponseSchema =
|
|
19046
|
+
var MetadataResponseSchema = union3([
|
|
18653
19047
|
object2({ requiresOAuth: literal2(false) }),
|
|
18654
19048
|
DiscoveryResultSchema
|
|
18655
19049
|
]);
|
|
@@ -20082,6 +20476,7 @@ function closeIdleMcpUserTransports(transports, sessionUsers, sessionActivity, o
|
|
|
20082
20476
|
// src/http/memory.ts
|
|
20083
20477
|
init_zod();
|
|
20084
20478
|
init_db4();
|
|
20479
|
+
init_event_loop_lag();
|
|
20085
20480
|
init_memory();
|
|
20086
20481
|
init_access();
|
|
20087
20482
|
init_constants2();
|
|
@@ -21531,7 +21926,7 @@ async function handleMemory(req, res, pathSegments, callerAgentId) {
|
|
|
21531
21926
|
var MEMORY_GC_INTERVAL_MS = 60 * 60 * 1000;
|
|
21532
21927
|
var memoryGcTimer = null;
|
|
21533
21928
|
var SEARCH_RETRIEVAL_TTL_DAYS = 90;
|
|
21534
|
-
var SEARCH_RETRIEVAL_PURGE_BATCH =
|
|
21929
|
+
var SEARCH_RETRIEVAL_PURGE_BATCH = 500;
|
|
21535
21930
|
async function purgeStaleSearchRetrievals(batchSize = SEARCH_RETRIEVAL_PURGE_BATCH) {
|
|
21536
21931
|
try {
|
|
21537
21932
|
const cutoff = new Date(Date.now() - SEARCH_RETRIEVAL_TTL_DAYS * 24 * 60 * 60 * 1000).toISOString();
|
|
@@ -21571,12 +21966,12 @@ async function startMemoryGc(intervalMs = MEMORY_GC_INTERVAL_MS, initialDelayMs
|
|
|
21571
21966
|
return;
|
|
21572
21967
|
memoryGcInitialTimer = setTimeout(() => {
|
|
21573
21968
|
memoryGcInitialTimer = null;
|
|
21574
|
-
runMemoryGcTick("Initial");
|
|
21969
|
+
withLoopPath("memory-gc.tick", () => runMemoryGcTick("Initial"));
|
|
21575
21970
|
}, initialDelayMs);
|
|
21576
21971
|
if (typeof memoryGcInitialTimer?.unref === "function")
|
|
21577
21972
|
memoryGcInitialTimer.unref();
|
|
21578
21973
|
memoryGcTimer = setInterval(() => {
|
|
21579
|
-
runMemoryGcTick("Periodic");
|
|
21974
|
+
withLoopPath("memory-gc.tick", () => runMemoryGcTick("Periodic"));
|
|
21580
21975
|
}, intervalMs);
|
|
21581
21976
|
if (typeof memoryGcTimer?.unref === "function")
|
|
21582
21977
|
memoryGcTimer.unref();
|
|
@@ -21604,7 +21999,7 @@ var DEFAULT_METRIC_MAX_ROWS = 100;
|
|
|
21604
21999
|
var HARD_METRIC_MAX_ROWS = 500;
|
|
21605
22000
|
var VARIABLE_TOKEN_RE = /^\{\{([a-zA-Z][a-zA-Z0-9_]*)\}\}$/;
|
|
21606
22001
|
var MetricRunBodySchema = object2({
|
|
21607
|
-
variables: record2(string2(),
|
|
22002
|
+
variables: record2(string2(), union3([string2(), number2(), boolean(), _null()])).optional()
|
|
21608
22003
|
}).optional();
|
|
21609
22004
|
function slugify(input) {
|
|
21610
22005
|
const slug = input.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -21765,7 +22160,7 @@ var listMetricsRoute = route({
|
|
|
21765
22160
|
200: {
|
|
21766
22161
|
description: "Metric definitions",
|
|
21767
22162
|
schema: object2({
|
|
21768
|
-
metrics: array2(
|
|
22163
|
+
metrics: array2(union3([MetricSchema, metricSummarySchema])),
|
|
21769
22164
|
total: number2(),
|
|
21770
22165
|
limit: number2(),
|
|
21771
22166
|
offset: number2()
|
|
@@ -21820,7 +22215,7 @@ var metricRunWidgetResultSchema = object2({
|
|
|
21820
22215
|
});
|
|
21821
22216
|
var metricRunResultSchema = object2({
|
|
21822
22217
|
metric: MetricSchema,
|
|
21823
|
-
variables: record2(string2(),
|
|
22218
|
+
variables: record2(string2(), union3([string2(), number2(), boolean(), _null()])),
|
|
21824
22219
|
widgets: array2(object2({
|
|
21825
22220
|
widget: MetricWidgetSchema,
|
|
21826
22221
|
result: metricRunWidgetResultSchema
|
|
@@ -24542,13 +24937,13 @@ var listTasks = route({
|
|
|
24542
24937
|
offset: exports_coerce.number().int().optional(),
|
|
24543
24938
|
fields: _enum2(["full", "slim", "timeline"]).optional(),
|
|
24544
24939
|
includeTotal: _enum2(["true", "false"]).optional(),
|
|
24545
|
-
scope: _enum2(["all"]).optional().describe("all: every user's tasks, read-only, for a user
|
|
24940
|
+
scope: _enum2(["all"]).optional().describe("all: every user's tasks, read-only, for a user whose role lists session.read.all (the built-in auditor role; the grant-all admin role alone does not count); ignored for anyone else. The X-Swarm-Session-Scope: all header opts in the same way.")
|
|
24546
24941
|
}),
|
|
24547
24942
|
responses: {
|
|
24548
24943
|
200: {
|
|
24549
24944
|
description: "Paginated task list",
|
|
24550
24945
|
schema: object2({
|
|
24551
|
-
tasks:
|
|
24946
|
+
tasks: union3([
|
|
24552
24947
|
array2(AgentTaskSchema),
|
|
24553
24948
|
array2(AgentTaskSummarySchema),
|
|
24554
24949
|
array2(AgentTaskTimelineItemSchema)
|
|
@@ -24640,7 +25035,7 @@ var updateSession = route({
|
|
|
24640
25035
|
summary: "Update provider session ID and harness metadata for a task",
|
|
24641
25036
|
tags: ["Tasks"],
|
|
24642
25037
|
params: object2({ id: string2() }),
|
|
24643
|
-
body:
|
|
25038
|
+
body: union3([
|
|
24644
25039
|
object2({
|
|
24645
25040
|
claudeSessionId: string2().min(1),
|
|
24646
25041
|
provider: literal2("devin"),
|
|
@@ -30409,7 +30804,7 @@ var ResolveResultSchema = object2({
|
|
|
30409
30804
|
skipped: boolean(),
|
|
30410
30805
|
unresolved: array2(string2())
|
|
30411
30806
|
});
|
|
30412
|
-
var DbResolveResultSchema =
|
|
30807
|
+
var DbResolveResultSchema = union3([
|
|
30413
30808
|
object2({ template: PromptTemplateResponseSchema }),
|
|
30414
30809
|
object2({ skip: literal2(true) })
|
|
30415
30810
|
]).nullable();
|
|
@@ -30559,7 +30954,7 @@ var deleteByIdRoute = route({
|
|
|
30559
30954
|
},
|
|
30560
30955
|
auth: { apiKey: true }
|
|
30561
30956
|
});
|
|
30562
|
-
var
|
|
30957
|
+
var listRoute4 = route({
|
|
30563
30958
|
method: "get",
|
|
30564
30959
|
path: "/api/prompt-templates",
|
|
30565
30960
|
pattern: ["api", "prompt-templates"],
|
|
@@ -30739,8 +31134,8 @@ ${templateBody}` : templateBody;
|
|
|
30739
31134
|
}
|
|
30740
31135
|
return true;
|
|
30741
31136
|
}
|
|
30742
|
-
if (
|
|
30743
|
-
const parsed = await
|
|
31137
|
+
if (listRoute4.match(req.method, pathSegments)) {
|
|
31138
|
+
const parsed = await listRoute4.parse(req, res, pathSegments, queryParams);
|
|
30744
31139
|
if (!parsed)
|
|
30745
31140
|
return true;
|
|
30746
31141
|
const templates = getPromptTemplates2({
|
|
@@ -30749,7 +31144,7 @@ ${templateBody}` : templateBody;
|
|
|
30749
31144
|
scopeId: parsed.query.scopeId || undefined,
|
|
30750
31145
|
isDefault: parsed.query.isDefault ? parsed.query.isDefault === "true" : undefined
|
|
30751
31146
|
});
|
|
30752
|
-
|
|
31147
|
+
listRoute4.respond(res, 200, { templates: templates.map(toPromptTemplateResponse) });
|
|
30753
31148
|
return true;
|
|
30754
31149
|
}
|
|
30755
31150
|
if (upsertRoute.match(req.method, pathSegments)) {
|
|
@@ -31925,7 +32320,7 @@ var listSchedules = route({
|
|
|
31925
32320
|
200: {
|
|
31926
32321
|
description: "List of schedules",
|
|
31927
32322
|
schema: object2({
|
|
31928
|
-
schedules:
|
|
32323
|
+
schedules: union3([
|
|
31929
32324
|
array2(scheduleSummaryWithFavoriteSchema),
|
|
31930
32325
|
array2(scheduleWithFavoriteSchema)
|
|
31931
32326
|
]),
|
|
@@ -32427,9 +32822,9 @@ var McpJsonRpcErrorSchema = object2({
|
|
|
32427
32822
|
message: string2().optional(),
|
|
32428
32823
|
data: unknown().optional()
|
|
32429
32824
|
});
|
|
32430
|
-
var McpToolCallEnvelopeSchema =
|
|
32825
|
+
var McpToolCallEnvelopeSchema = union3([
|
|
32431
32826
|
object2({ ok: literal2(true), result: McpToolCallResultSchema }),
|
|
32432
|
-
object2({ ok: literal2(false), error:
|
|
32827
|
+
object2({ ok: literal2(false), error: union3([McpJsonRpcErrorSchema, string2()]) })
|
|
32433
32828
|
]);
|
|
32434
32829
|
var mcpCallRoute = route({
|
|
32435
32830
|
method: "post",
|
|
@@ -32451,7 +32846,7 @@ var mcpCallRoute = route({
|
|
|
32451
32846
|
404: { description: "Script connection or agent not found" }
|
|
32452
32847
|
}
|
|
32453
32848
|
});
|
|
32454
|
-
var SqlQueryEnvelopeSchema =
|
|
32849
|
+
var SqlQueryEnvelopeSchema = union3([
|
|
32455
32850
|
object2({
|
|
32456
32851
|
ok: literal2(true),
|
|
32457
32852
|
rows: array2(record2(string2(), unknown())),
|
|
@@ -33255,7 +33650,7 @@ var disconnectOAuthAppRoute = route({
|
|
|
33255
33650
|
responses: {
|
|
33256
33651
|
200: {
|
|
33257
33652
|
description: "Disconnect result",
|
|
33258
|
-
schema:
|
|
33653
|
+
schema: union3([
|
|
33259
33654
|
object2({ disconnected: literal2(false), message: string2() }),
|
|
33260
33655
|
object2({ disconnected: literal2(true), revocationAttempted: boolean() })
|
|
33261
33656
|
])
|
|
@@ -35599,7 +35994,7 @@ var patchScriptApiRoute = route({
|
|
|
35599
35994
|
responses: {
|
|
35600
35995
|
200: {
|
|
35601
35996
|
description: "Updated endpoint",
|
|
35602
|
-
schema:
|
|
35997
|
+
schema: union3([ScriptApiRecordSchema, _null()])
|
|
35603
35998
|
},
|
|
35604
35999
|
404: { description: "Endpoint not found" }
|
|
35605
36000
|
},
|
|
@@ -36834,7 +37229,7 @@ var AgentTaskSummarySchema2 = AgentTaskSchema.pick({
|
|
|
36834
37229
|
totalCostUsd: true
|
|
36835
37230
|
});
|
|
36836
37231
|
var SessionListItemSchema = object2({
|
|
36837
|
-
root:
|
|
37232
|
+
root: union3([AgentTaskSchema, AgentTaskSummarySchema2]),
|
|
36838
37233
|
chainTaskCount: number2().int(),
|
|
36839
37234
|
lastActivityAt: string2(),
|
|
36840
37235
|
latestStatus: AgentTaskStatusSchema,
|
|
@@ -37152,7 +37547,7 @@ var listSessions = route({
|
|
|
37152
37547
|
status: _enum2(["running", "failed", "needs"]).optional(),
|
|
37153
37548
|
withUserId: string2().min(1).optional(),
|
|
37154
37549
|
fields: _enum2(["full", "slim"]).optional(),
|
|
37155
|
-
scope: _enum2(["mine", "shared", "tree", "all"]).optional().describe("mine: owned sessions. shared: sessions shared with me. tree: Sessions that GET /api/session-tree counts: mine plus shared with me, no ownerless roots. A bypass actor sees every root with tree scope. all: every user's sessions, read-only, for a user
|
|
37550
|
+
scope: _enum2(["mine", "shared", "tree", "all"]).optional().describe("mine: owned sessions. shared: sessions shared with me. tree: Sessions that GET /api/session-tree counts: mine plus shared with me, no ownerless roots. A bypass actor sees every root with tree scope. all: every user's sessions, read-only, for a user whose role lists session.read.all (the built-in auditor role; the grant-all admin role alone does not count); ignored for anyone else. The X-Swarm-Session-Scope: all header opts in the same way, also for tree."),
|
|
37156
37551
|
show: SessionShowSchema,
|
|
37157
37552
|
hideSource: SessionHideSourceSchema,
|
|
37158
37553
|
showSource: SessionShowSourceSchema
|
|
@@ -37312,6 +37707,29 @@ async function checkSessionMove(rootTaskId, actor, req, myAgentId, options = {})
|
|
|
37312
37707
|
}
|
|
37313
37708
|
return { taskIds: tasks.map((task) => task.id) };
|
|
37314
37709
|
}
|
|
37710
|
+
async function withDispatchedTasks(chain, sessionRootId, actor) {
|
|
37711
|
+
const dispatched = await getTasksDispatchedFrom2(chain.map((task) => task.id));
|
|
37712
|
+
if (dispatched.length === 0)
|
|
37713
|
+
return chain;
|
|
37714
|
+
const roots = await getSessionRoots(dispatched.map((task) => task.id));
|
|
37715
|
+
const foreignRoots = new Map;
|
|
37716
|
+
for (const root of roots.values()) {
|
|
37717
|
+
if (root.id !== sessionRootId)
|
|
37718
|
+
foreignRoots.set(root.id, root);
|
|
37719
|
+
}
|
|
37720
|
+
const readable = new Set([sessionRootId]);
|
|
37721
|
+
await Promise.all([...foreignRoots.values()].map(async (root) => {
|
|
37722
|
+
if (await accessForRoot(actor, root) !== "none")
|
|
37723
|
+
readable.add(root.id);
|
|
37724
|
+
}));
|
|
37725
|
+
const visible = dispatched.filter((task) => {
|
|
37726
|
+
const root = roots.get(task.id);
|
|
37727
|
+
return root !== undefined && readable.has(root.id);
|
|
37728
|
+
});
|
|
37729
|
+
if (visible.length === 0)
|
|
37730
|
+
return chain;
|
|
37731
|
+
return [...chain, ...visible].sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
37732
|
+
}
|
|
37315
37733
|
var getSession = route({
|
|
37316
37734
|
method: "get",
|
|
37317
37735
|
path: "/api/sessions/{rootTaskId}",
|
|
@@ -37322,7 +37740,7 @@ var getSession = route({
|
|
|
37322
37740
|
params: object2({ rootTaskId: string2() }),
|
|
37323
37741
|
responses: {
|
|
37324
37742
|
200: {
|
|
37325
|
-
description: "Root task + chain (ordered by createdAt), plus the caller's `access` and the session `owner`",
|
|
37743
|
+
description: "Root task + chain (ordered by createdAt), plus the caller's `access` and the session `owner`. The chain also holds tasks a chain task dispatched (`dispatchedByTaskId`) that sit elsewhere: in the same session, or in another session the caller can read.",
|
|
37326
37744
|
schema: object2({
|
|
37327
37745
|
root: TaskWithSteeringSchema,
|
|
37328
37746
|
chain: array2(TaskWithSteeringSchema),
|
|
@@ -37523,8 +37941,12 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
37523
37941
|
hideSource: parsed.query.hideSource,
|
|
37524
37942
|
showSource: parsed.query.showSource
|
|
37525
37943
|
});
|
|
37526
|
-
const { sourceGroups, slackChannels, threadLabels, ...counts } = tree;
|
|
37527
|
-
const
|
|
37944
|
+
const { sourceGroups, slackChannels, threadLabels, resourceGroups, ...counts } = tree;
|
|
37945
|
+
const [sourceLabels, resourceLabels] = await Promise.all([
|
|
37946
|
+
getSessionLabels(sourceGroups),
|
|
37947
|
+
getResourceSessionLabels(resourceGroups)
|
|
37948
|
+
]);
|
|
37949
|
+
const labels = { ...threadLabels, ...sourceLabels, ...resourceLabels };
|
|
37528
37950
|
warmSlackChannelLabels(slackChannels.map((id) => `shared/slack/${id}/`).filter((key) => labels[key] === undefined));
|
|
37529
37951
|
sessionTree.respond(res, 200, { ...counts, labels });
|
|
37530
37952
|
return true;
|
|
@@ -37578,6 +38000,10 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
37578
38000
|
jsonError(res, SOURCE_GROUPS_READ_ONLY, 400);
|
|
37579
38001
|
return true;
|
|
37580
38002
|
}
|
|
38003
|
+
if (isResourceGroupPrefix(from) || parsed.body.to && isResourceGroupPrefix(normalizeAssetKey(parsed.body.to))) {
|
|
38004
|
+
jsonError(res, RESOURCE_GROUPS_READ_ONLY, 400);
|
|
38005
|
+
return true;
|
|
38006
|
+
}
|
|
37581
38007
|
if (parseAssetKey(from).relativeSegments.length === 0) {
|
|
37582
38008
|
jsonError(res, "Cannot move a namespace root", 400);
|
|
37583
38009
|
return true;
|
|
@@ -37660,7 +38086,7 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
37660
38086
|
id: sessionRoot.requestedByUserId,
|
|
37661
38087
|
name: ownerUser?.name ?? sessionRoot.requestedByUserId
|
|
37662
38088
|
} : null;
|
|
37663
|
-
const chain = await getRootTaskChain2(parsed.params.rootTaskId);
|
|
38089
|
+
const chain = await withDispatchedTasks(await getRootTaskChain2(parsed.params.rootTaskId), sessionRoot.id, actor);
|
|
37664
38090
|
const tasks = [root, ...chain];
|
|
37665
38091
|
const [steering, citations, approvals, read, groupKey] = await Promise.all([
|
|
37666
38092
|
getTaskSteeringFieldsForTasks(tasks),
|
|
@@ -39165,7 +39591,7 @@ var listScheduledTasks = route({
|
|
|
39165
39591
|
200: {
|
|
39166
39592
|
description: "Scheduled tasks list",
|
|
39167
39593
|
schema: object2({
|
|
39168
|
-
scheduledTasks:
|
|
39594
|
+
scheduledTasks: union3([
|
|
39169
39595
|
array2(ScheduledTaskSchema),
|
|
39170
39596
|
array2(scheduleSummaryWithFavoriteSchema)
|
|
39171
39597
|
])
|
|
@@ -39495,7 +39921,7 @@ var JiraStatusPayloadSchema = object2({
|
|
|
39495
39921
|
webhookIds: array2(JiraWebhookIdEntrySchema),
|
|
39496
39922
|
manualWebhookInstructions: string2().optional()
|
|
39497
39923
|
});
|
|
39498
|
-
var JiraWebhookEventResultSchema =
|
|
39924
|
+
var JiraWebhookEventResultSchema = union3([
|
|
39499
39925
|
object2({ status: literal2("accepted") }),
|
|
39500
39926
|
object2({ status: literal2("duplicate") }),
|
|
39501
39927
|
object2({ status: literal2("ignored"), reason: literal2("invalid-json") })
|
|
@@ -40191,7 +40617,8 @@ function getOperatorActor(req, res) {
|
|
|
40191
40617
|
const auth = getRequestAuth(req);
|
|
40192
40618
|
const userId = authUserId(auth);
|
|
40193
40619
|
if (userId) {
|
|
40194
|
-
|
|
40620
|
+
const tokenId = auth?.kind === "user" ? auth.tokenId : undefined;
|
|
40621
|
+
return tokenId ? { kind: "user", id: userId, tokenId } : { kind: "user", id: userId };
|
|
40195
40622
|
}
|
|
40196
40623
|
if (isOperatorAuth(auth)) {
|
|
40197
40624
|
return { kind: "operator", id: auth.fingerprint };
|
|
@@ -40242,14 +40669,16 @@ var setUserRolesRoute = route({
|
|
|
40242
40669
|
pattern: ["api", "users", null, "roles"],
|
|
40243
40670
|
operationId: "users_setRbacRoles",
|
|
40244
40671
|
summary: "Set a user's RBAC roles",
|
|
40245
|
-
description: `Replaces the user's roles. The set holds exactly one of ${PRIMARY_ROLE_NAMES2.join(", ")} plus any extra roles. Demoting a user below admin removes the ability to answer approval requests, even when the user is listed as an approver. Fails with 409 when it would leave no active admin.`,
|
|
40672
|
+
description: `Replaces the user's roles. The set holds exactly one of ${PRIMARY_ROLE_NAMES2.join(", ")} plus any extra roles. Demoting a user below admin removes the ability to answer approval requests, even when the user is listed as an approver. Fails with 409 when it would leave no active admin. Adding a role that grants session.read.all (the built-in auditor role) requires the operator key: every new user is a grant-all admin, so a user token could grant it to itself. Adding such a role revokes the user's MCP tokens and spends its unused connector and invite codes.`,
|
|
40246
40673
|
tags: ["Users"],
|
|
40247
40674
|
params: object2({ id: string2().min(1) }),
|
|
40248
40675
|
body: object2({ roles: array2(string2().min(1)).min(1) }).strict(),
|
|
40249
40676
|
responses: {
|
|
40250
40677
|
200: { description: "The user's roles after the change", schema: UserRbacRolesSchema },
|
|
40251
40678
|
400: { description: "Invalid role set" },
|
|
40252
|
-
403: {
|
|
40679
|
+
403: {
|
|
40680
|
+
description: "Not allowed to change roles, or adding an operator-only role with a user token"
|
|
40681
|
+
},
|
|
40253
40682
|
404: { description: "User not found" },
|
|
40254
40683
|
409: { description: "Would leave no active admin" }
|
|
40255
40684
|
},
|
|
@@ -40330,6 +40759,10 @@ async function handleUserRoles(req, res, pathSegments, queryParams) {
|
|
|
40330
40759
|
jsonError(res, err.message, 400);
|
|
40331
40760
|
return true;
|
|
40332
40761
|
}
|
|
40762
|
+
if (err instanceof OperatorGrantedRoleError2) {
|
|
40763
|
+
jsonError(res, err.message, 403);
|
|
40764
|
+
return true;
|
|
40765
|
+
}
|
|
40333
40766
|
throw err;
|
|
40334
40767
|
}
|
|
40335
40768
|
setUserRolesRoute.respond(res, 200, await composeRoles(userId));
|
|
@@ -40422,7 +40855,7 @@ var whoamiRoute = route({
|
|
|
40422
40855
|
description: "Authenticated principal",
|
|
40423
40856
|
schema: object2({
|
|
40424
40857
|
kind: _enum2(["operator", "user"]),
|
|
40425
|
-
user:
|
|
40858
|
+
user: union3([UserSchema, _null()]),
|
|
40426
40859
|
grants: object2({
|
|
40427
40860
|
grantsAll: boolean(),
|
|
40428
40861
|
verbs: array2(string2()),
|
|
@@ -40509,7 +40942,7 @@ var resolveUnmapped = route({
|
|
|
40509
40942
|
summary: "Resolve an unmapped identity — link to an existing user or create a new one",
|
|
40510
40943
|
tags: ["Users"],
|
|
40511
40944
|
params: object2({ kind: string2(), externalId: string2() }),
|
|
40512
|
-
body:
|
|
40945
|
+
body: union3([
|
|
40513
40946
|
object2({ userId: string2().min(1) }),
|
|
40514
40947
|
object2({
|
|
40515
40948
|
name: string2().min(1),
|
|
@@ -40524,6 +40957,9 @@ var resolveUnmapped = route({
|
|
|
40524
40957
|
},
|
|
40525
40958
|
400: { description: "Validation error" },
|
|
40526
40959
|
401: { description: "Unauthorized" },
|
|
40960
|
+
403: {
|
|
40961
|
+
description: "Target holds an operator-granted role (auditor) and the caller is not the operator key"
|
|
40962
|
+
},
|
|
40527
40963
|
404: { description: "Target user not found" }
|
|
40528
40964
|
},
|
|
40529
40965
|
auth: { apiKey: true }
|
|
@@ -40578,6 +41014,9 @@ var updateUserRoute = route({
|
|
|
40578
41014
|
},
|
|
40579
41015
|
400: { description: "Validation error or empty body" },
|
|
40580
41016
|
401: { description: "Unauthorized" },
|
|
41017
|
+
403: {
|
|
41018
|
+
description: "Target holds an operator-granted role (auditor) and the caller is not the operator key"
|
|
41019
|
+
},
|
|
40581
41020
|
404: { description: "User not found" }
|
|
40582
41021
|
},
|
|
40583
41022
|
auth: { apiKey: true }
|
|
@@ -40603,6 +41042,9 @@ var mintUserMcpTokenRoute = route({
|
|
|
40603
41042
|
})
|
|
40604
41043
|
},
|
|
40605
41044
|
401: { description: "Unauthorized" },
|
|
41045
|
+
403: {
|
|
41046
|
+
description: "Target holds an operator-granted role (auditor) and the caller is not the operator key"
|
|
41047
|
+
},
|
|
40606
41048
|
404: { description: "User not found" }
|
|
40607
41049
|
},
|
|
40608
41050
|
auth: { apiKey: true }
|
|
@@ -40646,6 +41088,9 @@ var createConnectorCodeRoute = route({
|
|
|
40646
41088
|
},
|
|
40647
41089
|
400: { description: "The public API origin or CONNECTOR_CONNECT_URL is not HTTPS" },
|
|
40648
41090
|
401: { description: "Unauthorized" },
|
|
41091
|
+
403: {
|
|
41092
|
+
description: "Target holds an operator-granted role (auditor) and the caller is not the operator key"
|
|
41093
|
+
},
|
|
40649
41094
|
404: { description: "User not found" }
|
|
40650
41095
|
},
|
|
40651
41096
|
auth: { apiKey: true },
|
|
@@ -40778,6 +41223,9 @@ var mergeUsersRoute = route({
|
|
|
40778
41223
|
},
|
|
40779
41224
|
400: { description: "Validation error (e.g. target == source)" },
|
|
40780
41225
|
401: { description: "Unauthorized" },
|
|
41226
|
+
403: {
|
|
41227
|
+
description: "Target holds an operator-granted role (auditor) and the caller is not the operator key"
|
|
41228
|
+
},
|
|
40781
41229
|
404: { description: "Target or source user not found" },
|
|
40782
41230
|
409: { description: "Source is the last active admin (last_admin)" }
|
|
40783
41231
|
},
|
|
@@ -40819,6 +41267,9 @@ var addIdentityRoute = route({
|
|
|
40819
41267
|
},
|
|
40820
41268
|
400: { description: "Validation error" },
|
|
40821
41269
|
401: { description: "Unauthorized" },
|
|
41270
|
+
403: {
|
|
41271
|
+
description: "Target holds an operator-granted role (auditor) and the caller is not the operator key"
|
|
41272
|
+
},
|
|
40822
41273
|
404: { description: "User not found" },
|
|
40823
41274
|
409: { description: "The (kind, externalId) identity is already linked (identity_taken)" }
|
|
40824
41275
|
},
|
|
@@ -40841,6 +41292,18 @@ var deleteIdentityRoute = route({
|
|
|
40841
41292
|
},
|
|
40842
41293
|
auth: { apiKey: true }
|
|
40843
41294
|
});
|
|
41295
|
+
function writeGuarded(actor, targetUserId, write) {
|
|
41296
|
+
return getDbClient2().transaction(async () => {
|
|
41297
|
+
await assertMayActOnOperatorGrantedTarget2(actor, targetUserId);
|
|
41298
|
+
return await write();
|
|
41299
|
+
});
|
|
41300
|
+
}
|
|
41301
|
+
function respondOperatorGrantedRefusal(res, err) {
|
|
41302
|
+
if (!(err instanceof OperatorGrantedTargetError2))
|
|
41303
|
+
return false;
|
|
41304
|
+
jsonError(res, err.message, 403);
|
|
41305
|
+
return true;
|
|
41306
|
+
}
|
|
40844
41307
|
function isUniqueViolation(err, target) {
|
|
40845
41308
|
return err instanceof Error && err.message.includes("UNIQUE constraint") && err.message.includes(target);
|
|
40846
41309
|
}
|
|
@@ -40998,16 +41461,19 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
40998
41461
|
return true;
|
|
40999
41462
|
try {
|
|
41000
41463
|
const { identities, ...userFields } = parsed.body;
|
|
41001
|
-
const user = await
|
|
41002
|
-
|
|
41003
|
-
|
|
41004
|
-
|
|
41005
|
-
|
|
41006
|
-
|
|
41007
|
-
|
|
41008
|
-
|
|
41009
|
-
|
|
41010
|
-
|
|
41464
|
+
const user = await getDbClient2().transaction(async () => {
|
|
41465
|
+
const created = await createUser2(userFields);
|
|
41466
|
+
await syncUserBudgetMirror(created.id, userFields.dailyBudgetUsd);
|
|
41467
|
+
for (const ident of identities ?? []) {
|
|
41468
|
+
await linkIdentity(created.id, ident.kind, ident.externalId, actor);
|
|
41469
|
+
}
|
|
41470
|
+
if (userFields.dailyBudgetUsd !== undefined) {
|
|
41471
|
+
await recordIdentityEvent(created.id, "budget_changed", actor, null, {
|
|
41472
|
+
dailyBudgetUsd: userFields.dailyBudgetUsd
|
|
41473
|
+
});
|
|
41474
|
+
}
|
|
41475
|
+
return created;
|
|
41476
|
+
});
|
|
41011
41477
|
const composed = await composeUser(user.id);
|
|
41012
41478
|
createUserRoute.respond(res, 200, { user: composed });
|
|
41013
41479
|
} catch (err) {
|
|
@@ -41054,21 +41520,27 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
41054
41520
|
return true;
|
|
41055
41521
|
}
|
|
41056
41522
|
targetUserId = existing.id;
|
|
41523
|
+
await writeGuarded(actor, targetUserId, () => linkIdentity(targetUserId, kind, externalId, actor));
|
|
41057
41524
|
} else {
|
|
41058
|
-
const
|
|
41059
|
-
|
|
41060
|
-
|
|
41061
|
-
|
|
41525
|
+
const body = parsed.body;
|
|
41526
|
+
targetUserId = await getDbClient2().transaction(async () => {
|
|
41527
|
+
const created = await createUser2({
|
|
41528
|
+
name: body.name,
|
|
41529
|
+
email: body.email,
|
|
41530
|
+
notes: body.notes
|
|
41531
|
+
});
|
|
41532
|
+
await linkIdentity(created.id, kind, externalId, actor);
|
|
41533
|
+
return created.id;
|
|
41062
41534
|
});
|
|
41063
|
-
targetUserId = created.id;
|
|
41064
41535
|
}
|
|
41065
|
-
await linkIdentity(targetUserId, kind, externalId, actor);
|
|
41066
41536
|
const ns = `integration:unmapped:${kind}`;
|
|
41067
41537
|
await deleteKv2(ns, `${externalId}:meta`);
|
|
41068
41538
|
await deleteKv2(ns, `${externalId}:count`);
|
|
41069
41539
|
const user = await composeUser(targetUserId);
|
|
41070
41540
|
resolveUnmapped.respond(res, 200, { user });
|
|
41071
41541
|
} catch (err) {
|
|
41542
|
+
if (respondOperatorGrantedRefusal(res, err))
|
|
41543
|
+
return true;
|
|
41072
41544
|
jsonError(res, err instanceof Error ? err.message : "Failed to resolve unmapped", 500);
|
|
41073
41545
|
}
|
|
41074
41546
|
return true;
|
|
@@ -41100,7 +41572,7 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
41100
41572
|
return true;
|
|
41101
41573
|
}
|
|
41102
41574
|
try {
|
|
41103
|
-
const { tokenId, plaintext } = await mintToken(parsed.params.id, parsed.body.label ?? null, actor);
|
|
41575
|
+
const { tokenId, plaintext } = await writeGuarded(actor, parsed.params.id, () => mintToken(parsed.params.id, parsed.body.label ?? null, actor));
|
|
41104
41576
|
const token = (await listUserTokens(parsed.params.id)).find((t) => t.id === tokenId);
|
|
41105
41577
|
mintUserMcpTokenRoute.respond(res, 200, {
|
|
41106
41578
|
plaintext,
|
|
@@ -41108,6 +41580,8 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
41108
41580
|
user: await composeUser(parsed.params.id)
|
|
41109
41581
|
});
|
|
41110
41582
|
} catch (err) {
|
|
41583
|
+
if (respondOperatorGrantedRefusal(res, err))
|
|
41584
|
+
return true;
|
|
41111
41585
|
jsonError(res, err instanceof Error ? err.message : "Failed to mint token", 500);
|
|
41112
41586
|
}
|
|
41113
41587
|
return true;
|
|
@@ -41140,6 +41614,8 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
41140
41614
|
const connectUrl = connect.toString();
|
|
41141
41615
|
createConnectorCodeRoute.respond(res, 201, { code, expiresAt, connectUrl });
|
|
41142
41616
|
} catch (err) {
|
|
41617
|
+
if (respondOperatorGrantedRefusal(res, err))
|
|
41618
|
+
return true;
|
|
41143
41619
|
jsonError(res, err instanceof Error ? err.message : "Failed to create connector code", 500);
|
|
41144
41620
|
}
|
|
41145
41621
|
return true;
|
|
@@ -41328,11 +41804,13 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
41328
41804
|
return true;
|
|
41329
41805
|
}
|
|
41330
41806
|
try {
|
|
41331
|
-
await linkIdentity(parsed.params.id, parsed.body.kind, parsed.body.externalId, actor);
|
|
41807
|
+
await writeGuarded(actor, parsed.params.id, () => linkIdentity(parsed.params.id, parsed.body.kind, parsed.body.externalId, actor));
|
|
41332
41808
|
addIdentityRoute.respond(res, 200, {
|
|
41333
41809
|
identities: await getUserIdentities(parsed.params.id)
|
|
41334
41810
|
});
|
|
41335
41811
|
} catch (err) {
|
|
41812
|
+
if (respondOperatorGrantedRefusal(res, err))
|
|
41813
|
+
return true;
|
|
41336
41814
|
if (isUniqueViolation(err, "user_external_ids")) {
|
|
41337
41815
|
jsonError(res, "identity_taken", 409);
|
|
41338
41816
|
return true;
|
|
@@ -41389,6 +41867,7 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
41389
41867
|
}
|
|
41390
41868
|
try {
|
|
41391
41869
|
const mergedUser = await getDbClient2().transaction(async () => {
|
|
41870
|
+
await assertMayActOnOperatorGrantedTarget2(actor, targetId);
|
|
41392
41871
|
for (const ident of sourceBefore.identities) {
|
|
41393
41872
|
await unlinkIdentity(sourceId, ident.kind, ident.externalId, actor);
|
|
41394
41873
|
await linkIdentity(targetId, ident.kind, ident.externalId, actor);
|
|
@@ -41430,6 +41909,8 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
41430
41909
|
});
|
|
41431
41910
|
mergeUsersRoute.respond(res, 200, { user: mergedUser });
|
|
41432
41911
|
} catch (err) {
|
|
41912
|
+
if (respondOperatorGrantedRefusal(res, err))
|
|
41913
|
+
return true;
|
|
41433
41914
|
if (err instanceof LastAdminError2) {
|
|
41434
41915
|
jsonError(res, "last_admin", 409);
|
|
41435
41916
|
return true;
|
|
@@ -41462,6 +41943,8 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
41462
41943
|
jsonError(res, "User not found", 404);
|
|
41463
41944
|
return true;
|
|
41464
41945
|
}
|
|
41946
|
+
const { identities: newIdentities, email: newEmail, emailAliases: newAliases } = parsed.body;
|
|
41947
|
+
const bindsIdentity = newIdentities !== undefined || newEmail !== undefined || newAliases !== undefined;
|
|
41465
41948
|
try {
|
|
41466
41949
|
const { identities, metadata, comms, ...rest } = parsed.body;
|
|
41467
41950
|
const update = { ...rest };
|
|
@@ -41478,68 +41961,77 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
41478
41961
|
} else if (metadata !== undefined) {
|
|
41479
41962
|
update.metadata = metadata;
|
|
41480
41963
|
}
|
|
41481
|
-
const
|
|
41482
|
-
|
|
41483
|
-
|
|
41484
|
-
|
|
41485
|
-
|
|
41486
|
-
|
|
41487
|
-
|
|
41488
|
-
|
|
41489
|
-
|
|
41490
|
-
if (parsed.body.status !== undefined && before.status !== parsed.body.status) {
|
|
41491
|
-
await recordIdentityEvent(parsed.params.id, "status_changed", actor, { status: before.status }, { status: parsed.body.status });
|
|
41492
|
-
}
|
|
41493
|
-
if (parsed.body.emailAliases !== undefined) {
|
|
41494
|
-
const beforeSet = new Set((before.emailAliases ?? []).map((a) => a.toLowerCase()));
|
|
41495
|
-
const afterSet = new Set(parsed.body.emailAliases.map((a) => a.toLowerCase()));
|
|
41496
|
-
for (const a of parsed.body.emailAliases) {
|
|
41497
|
-
if (!beforeSet.has(a.toLowerCase())) {
|
|
41498
|
-
await recordIdentityEvent(parsed.params.id, "email_added", actor, null, { email: a });
|
|
41499
|
-
}
|
|
41964
|
+
const found = await getDbClient2().transaction(async () => {
|
|
41965
|
+
if (bindsIdentity)
|
|
41966
|
+
await assertMayActOnOperatorGrantedTarget2(actor, parsed.params.id);
|
|
41967
|
+
const updated = await updateUser2(parsed.params.id, update);
|
|
41968
|
+
if (!updated)
|
|
41969
|
+
return false;
|
|
41970
|
+
await syncUserBudgetMirror(parsed.params.id, parsed.body.dailyBudgetUsd);
|
|
41971
|
+
if (parsed.body.dailyBudgetUsd !== undefined && (before.dailyBudgetUsd ?? null) !== (parsed.body.dailyBudgetUsd ?? null)) {
|
|
41972
|
+
await recordIdentityEvent(parsed.params.id, "budget_changed", actor, { dailyBudgetUsd: before.dailyBudgetUsd ?? null }, { dailyBudgetUsd: parsed.body.dailyBudgetUsd ?? null });
|
|
41500
41973
|
}
|
|
41501
|
-
|
|
41502
|
-
|
|
41503
|
-
await recordIdentityEvent(parsed.params.id, "email_removed", actor, { email: a }, null);
|
|
41504
|
-
}
|
|
41974
|
+
if (parsed.body.status !== undefined && before.status !== parsed.body.status) {
|
|
41975
|
+
await recordIdentityEvent(parsed.params.id, "status_changed", actor, { status: before.status }, { status: parsed.body.status });
|
|
41505
41976
|
}
|
|
41506
|
-
|
|
41507
|
-
|
|
41508
|
-
|
|
41509
|
-
|
|
41510
|
-
|
|
41511
|
-
|
|
41512
|
-
|
|
41513
|
-
|
|
41514
|
-
|
|
41515
|
-
|
|
41516
|
-
|
|
41517
|
-
|
|
41518
|
-
continue;
|
|
41519
|
-
const beforeVal = before[field] ?? null;
|
|
41520
|
-
const afterVal = parsed.body[field] ?? null;
|
|
41521
|
-
if (JSON.stringify(beforeVal) === JSON.stringify(afterVal))
|
|
41522
|
-
continue;
|
|
41523
|
-
await recordIdentityEvent(parsed.params.id, "profile_changed", actor, { [field]: beforeVal }, { [field]: afterVal });
|
|
41524
|
-
}
|
|
41525
|
-
if (identities !== undefined) {
|
|
41526
|
-
const beforeIds = await getUserIdentities(parsed.params.id);
|
|
41527
|
-
const beforeKeys = new Set(beforeIds.map((i) => `${i.kind}:${i.externalId}`));
|
|
41528
|
-
const afterKeys = new Set(identities.map((i) => `${i.kind}:${i.externalId}`));
|
|
41529
|
-
for (const i of identities) {
|
|
41530
|
-
if (!beforeKeys.has(`${i.kind}:${i.externalId}`)) {
|
|
41531
|
-
await linkIdentity(parsed.params.id, i.kind, i.externalId, actor);
|
|
41977
|
+
if (parsed.body.emailAliases !== undefined) {
|
|
41978
|
+
const beforeSet = new Set((before.emailAliases ?? []).map((a) => a.toLowerCase()));
|
|
41979
|
+
const afterSet = new Set(parsed.body.emailAliases.map((a) => a.toLowerCase()));
|
|
41980
|
+
for (const a of parsed.body.emailAliases) {
|
|
41981
|
+
if (!beforeSet.has(a.toLowerCase())) {
|
|
41982
|
+
await recordIdentityEvent(parsed.params.id, "email_added", actor, null, { email: a });
|
|
41983
|
+
}
|
|
41984
|
+
}
|
|
41985
|
+
for (const a of before.emailAliases ?? []) {
|
|
41986
|
+
if (!afterSet.has(a.toLowerCase())) {
|
|
41987
|
+
await recordIdentityEvent(parsed.params.id, "email_removed", actor, { email: a }, null);
|
|
41988
|
+
}
|
|
41532
41989
|
}
|
|
41533
41990
|
}
|
|
41534
|
-
|
|
41535
|
-
|
|
41536
|
-
|
|
41991
|
+
const PROFILE_FIELDS = [
|
|
41992
|
+
"name",
|
|
41993
|
+
"email",
|
|
41994
|
+
"role",
|
|
41995
|
+
"timezone",
|
|
41996
|
+
"preferredChannel",
|
|
41997
|
+
"notes",
|
|
41998
|
+
"metadata"
|
|
41999
|
+
];
|
|
42000
|
+
for (const field of PROFILE_FIELDS) {
|
|
42001
|
+
if (parsed.body[field] === undefined)
|
|
42002
|
+
continue;
|
|
42003
|
+
const beforeVal = before[field] ?? null;
|
|
42004
|
+
const afterVal = parsed.body[field] ?? null;
|
|
42005
|
+
if (JSON.stringify(beforeVal) === JSON.stringify(afterVal))
|
|
42006
|
+
continue;
|
|
42007
|
+
await recordIdentityEvent(parsed.params.id, "profile_changed", actor, { [field]: beforeVal }, { [field]: afterVal });
|
|
42008
|
+
}
|
|
42009
|
+
if (identities !== undefined) {
|
|
42010
|
+
const beforeIds = await getUserIdentities(parsed.params.id);
|
|
42011
|
+
const beforeKeys = new Set(beforeIds.map((i) => `${i.kind}:${i.externalId}`));
|
|
42012
|
+
const afterKeys = new Set(identities.map((i) => `${i.kind}:${i.externalId}`));
|
|
42013
|
+
for (const i of identities) {
|
|
42014
|
+
if (!beforeKeys.has(`${i.kind}:${i.externalId}`)) {
|
|
42015
|
+
await linkIdentity(parsed.params.id, i.kind, i.externalId, actor);
|
|
42016
|
+
}
|
|
42017
|
+
}
|
|
42018
|
+
for (const i of beforeIds) {
|
|
42019
|
+
if (!afterKeys.has(`${i.kind}:${i.externalId}`)) {
|
|
42020
|
+
await unlinkIdentity(parsed.params.id, i.kind, i.externalId, actor);
|
|
42021
|
+
}
|
|
41537
42022
|
}
|
|
41538
42023
|
}
|
|
42024
|
+
return true;
|
|
42025
|
+
});
|
|
42026
|
+
if (!found) {
|
|
42027
|
+
jsonError(res, "User not found", 404);
|
|
42028
|
+
return true;
|
|
41539
42029
|
}
|
|
41540
42030
|
const composed = await composeUser(parsed.params.id);
|
|
41541
42031
|
updateUserRoute.respond(res, 200, { user: composed });
|
|
41542
42032
|
} catch (err) {
|
|
42033
|
+
if (respondOperatorGrantedRefusal(res, err))
|
|
42034
|
+
return true;
|
|
41543
42035
|
jsonError(res, err instanceof Error ? err.message : "Failed to update user", 500);
|
|
41544
42036
|
}
|
|
41545
42037
|
return true;
|
|
@@ -41770,6 +42262,32 @@ async function runBlockableHandler(source, handler) {
|
|
|
41770
42262
|
return { created: false, skipped: true, reason: err.reason, extension: err.extension };
|
|
41771
42263
|
}
|
|
41772
42264
|
}
|
|
42265
|
+
var GITHUB_VERIFIED_EVENTS = new Set([
|
|
42266
|
+
"ping",
|
|
42267
|
+
"pull_request",
|
|
42268
|
+
"issues",
|
|
42269
|
+
"issue_comment",
|
|
42270
|
+
"pull_request_review_comment",
|
|
42271
|
+
"pull_request_review"
|
|
42272
|
+
]);
|
|
42273
|
+
var GITHUB_IGNORED_SUMMARY_MS = 60000;
|
|
42274
|
+
var githubIgnoredCounts = new Map;
|
|
42275
|
+
var githubIgnoredTimer = null;
|
|
42276
|
+
function flushGithubIgnoredCounts() {
|
|
42277
|
+
if (githubIgnoredCounts.size === 0)
|
|
42278
|
+
return;
|
|
42279
|
+
const parts = [...githubIgnoredCounts.entries()].map(([name, n]) => `${name}=${n}`);
|
|
42280
|
+
githubIgnoredCounts.clear();
|
|
42281
|
+
console.log(`[GitHub] ignored events last ${GITHUB_IGNORED_SUMMARY_MS / 1000}s: ${parts.join(" ")}`);
|
|
42282
|
+
}
|
|
42283
|
+
function countGithubIgnoredEvent(eventType) {
|
|
42284
|
+
const key = githubIgnoredCounts.has(eventType) || githubIgnoredCounts.size < 50 ? eventType : "other";
|
|
42285
|
+
githubIgnoredCounts.set(key, (githubIgnoredCounts.get(key) ?? 0) + 1);
|
|
42286
|
+
if (!githubIgnoredTimer) {
|
|
42287
|
+
githubIgnoredTimer = setInterval(flushGithubIgnoredCounts, GITHUB_IGNORED_SUMMARY_MS);
|
|
42288
|
+
githubIgnoredTimer.unref();
|
|
42289
|
+
}
|
|
42290
|
+
}
|
|
41773
42291
|
var githubWebhook = route({
|
|
41774
42292
|
method: "post",
|
|
41775
42293
|
path: "/api/github/webhook",
|
|
@@ -41780,7 +42298,7 @@ var githubWebhook = route({
|
|
|
41780
42298
|
responses: {
|
|
41781
42299
|
200: {
|
|
41782
42300
|
description: "Event processed",
|
|
41783
|
-
schema:
|
|
42301
|
+
schema: union3([object2({ message: literal2("pong") }), WebhookDispatchResultSchema])
|
|
41784
42302
|
},
|
|
41785
42303
|
401: { description: "Invalid signature" },
|
|
41786
42304
|
503: { description: "GitHub integration not configured" }
|
|
@@ -41974,6 +42492,12 @@ async function handleWebhooks(req, res, pathSegments) {
|
|
|
41974
42492
|
}
|
|
41975
42493
|
const eventType = req.headers["x-github-event"];
|
|
41976
42494
|
const signature = req.headers["x-hub-signature-256"];
|
|
42495
|
+
if (typeof eventType === "string" && eventType && !GITHUB_VERIFIED_EVENTS.has(eventType)) {
|
|
42496
|
+
countGithubIgnoredEvent(eventType);
|
|
42497
|
+
githubWebhook.respond(res, 200, { created: false });
|
|
42498
|
+
req.resume();
|
|
42499
|
+
return true;
|
|
42500
|
+
}
|
|
41977
42501
|
const chunks = [];
|
|
41978
42502
|
for await (const chunk of req) {
|
|
41979
42503
|
chunks.push(chunk);
|
|
@@ -42749,7 +43273,7 @@ var listWorkflowsRoute = route({
|
|
|
42749
43273
|
responses: {
|
|
42750
43274
|
200: {
|
|
42751
43275
|
description: "Workflow list",
|
|
42752
|
-
schema:
|
|
43276
|
+
schema: union3([array2(WorkflowSummarySchema), array2(WorkflowWithFavoriteSchema)])
|
|
42753
43277
|
}
|
|
42754
43278
|
}
|
|
42755
43279
|
});
|
|
@@ -42952,7 +43476,7 @@ var getWorkflowRunRoute = route({
|
|
|
42952
43476
|
responses: {
|
|
42953
43477
|
200: {
|
|
42954
43478
|
description: "Workflow run details with steps including retry info",
|
|
42955
|
-
schema:
|
|
43479
|
+
schema: union3([
|
|
42956
43480
|
object2({
|
|
42957
43481
|
run: WorkflowRunSchema,
|
|
42958
43482
|
steps: array2(WorkflowRunStepSchema),
|
|
@@ -43857,7 +44381,7 @@ function startApiGcInterval() {
|
|
|
43857
44381
|
console.log("[HTTP] Explicit GC unavailable; idle MCP transport sweeps remain enabled");
|
|
43858
44382
|
}
|
|
43859
44383
|
const interval = setInterval(() => {
|
|
43860
|
-
sweepRooms().catch((error) => console.error("[rooms] Sweep failed:", scrubSecrets(String(error))));
|
|
44384
|
+
withLoopPath("http.gc-interval", () => sweepRooms()).catch((error) => console.error("[rooms] Sweep failed:", scrubSecrets(String(error))));
|
|
43861
44385
|
const closedOwnerTransports = closeIdleMcpTransports(transports, transportActivity, {
|
|
43862
44386
|
idleTimeoutMs: MCP_TRANSPORT_IDLE_TIMEOUT_MS,
|
|
43863
44387
|
label: "MCP",
|
|
@@ -44000,6 +44524,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
44000
44524
|
() => handleInboxState(req, res, pathSegments, queryParams),
|
|
44001
44525
|
() => handleTelemetryUi(req, res, pathSegments, queryParams, myAgentId),
|
|
44002
44526
|
() => handleUsedBy(req, res, pathSegments, queryParams, myAgentId),
|
|
44527
|
+
() => handleImprovements(req, res, pathSegments, queryParams),
|
|
44003
44528
|
() => handleRanking(req, res, pathSegments, queryParams),
|
|
44004
44529
|
() => handleFleetBenchmark(req, res, pathSegments, queryParams),
|
|
44005
44530
|
() => handleTaskTemplates(req, res, pathSegments, queryParams),
|
|
@@ -44024,15 +44549,11 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
44024
44549
|
writeUnhandledError(res, err, req);
|
|
44025
44550
|
}
|
|
44026
44551
|
};
|
|
44027
|
-
|
|
44028
|
-
await withSpanContext2(span, handleRequest);
|
|
44029
|
-
} else {
|
|
44030
|
-
await handleRequest();
|
|
44031
|
-
}
|
|
44552
|
+
await withLoopPath(loopPathForRequest(req.method, pathSegments), () => span ? withSpanContext2(span, handleRequest) : handleRequest());
|
|
44032
44553
|
});
|
|
44033
44554
|
});
|
|
44034
44555
|
var detachRealtime = attachRealtimeTransport(httpServer);
|
|
44035
|
-
var { attachControllerTransport } = await import("./controllers-connect-
|
|
44556
|
+
var { attachControllerTransport } = await import("./controllers-connect-c4448kwa.js");
|
|
44036
44557
|
var detachControllers = attachControllerTransport(httpServer);
|
|
44037
44558
|
var stopWorkerNudges = startWorkerNudgeListener();
|
|
44038
44559
|
var taskAutoTitles = startTaskAutoTitleListener();
|
|
@@ -44063,7 +44584,7 @@ async function shutdown() {
|
|
|
44063
44584
|
sessionsProcessed: getServerSessionsProcessed()
|
|
44064
44585
|
});
|
|
44065
44586
|
if (hasCapability("scheduling")) {
|
|
44066
|
-
const { stopScheduler } = await import("./index-
|
|
44587
|
+
const { stopScheduler } = await import("./index-8arwq8mw.js");
|
|
44067
44588
|
stopScheduler();
|
|
44068
44589
|
}
|
|
44069
44590
|
stopHeartbeat2();
|
|
@@ -44075,7 +44596,7 @@ async function shutdown() {
|
|
|
44075
44596
|
await stopSlackApp2();
|
|
44076
44597
|
await stopChatSdk();
|
|
44077
44598
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
44078
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
44599
|
+
const { stopOAuthKeepalive } = await import("./keepalive-1j4n4dmk.js");
|
|
44079
44600
|
await stopOAuthKeepalive();
|
|
44080
44601
|
}
|
|
44081
44602
|
stopOAuthPendingGc();
|
|
@@ -44094,6 +44615,7 @@ async function shutdown() {
|
|
|
44094
44615
|
clearInterval(globalState.__apiGcInterval);
|
|
44095
44616
|
delete globalState.__apiGcInterval;
|
|
44096
44617
|
}
|
|
44618
|
+
stopEventLoopLagProbe();
|
|
44097
44619
|
for (const [id, transport] of Object.entries(transports)) {
|
|
44098
44620
|
console.log(`[HTTP] Closing transport ${id}`);
|
|
44099
44621
|
transport.close();
|
|
@@ -44131,6 +44653,7 @@ if (!globalState.__runId) {
|
|
|
44131
44653
|
globalState.__runId = `run_${Date.now()}`;
|
|
44132
44654
|
}
|
|
44133
44655
|
startApiGcInterval();
|
|
44656
|
+
startEventLoopLagProbe();
|
|
44134
44657
|
var startupConfigsInjected = [];
|
|
44135
44658
|
try {
|
|
44136
44659
|
startupConfigsInjected = await loadGlobalConfigsIntoEnv(true);
|
|
@@ -44157,21 +44680,21 @@ try {
|
|
|
44157
44680
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
44158
44681
|
}
|
|
44159
44682
|
try {
|
|
44160
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
44683
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-8f9zt5cm.js");
|
|
44161
44684
|
ensurePricingSeeded();
|
|
44162
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
44685
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-ctdr74pd.js");
|
|
44163
44686
|
startPricingRefreshLoop();
|
|
44164
44687
|
} catch (err) {
|
|
44165
44688
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
44166
44689
|
}
|
|
44167
44690
|
try {
|
|
44168
|
-
const { ensureModelProfilesSeeded } = await import("./boot-seeds-
|
|
44691
|
+
const { ensureModelProfilesSeeded } = await import("./boot-seeds-8f9zt5cm.js");
|
|
44169
44692
|
await ensureModelProfilesSeeded();
|
|
44170
44693
|
} catch (err) {
|
|
44171
44694
|
console.error("[startup] Failed to seed model profiles:", err);
|
|
44172
44695
|
}
|
|
44173
44696
|
try {
|
|
44174
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
44697
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-8f9zt5cm.js");
|
|
44175
44698
|
ensureRbacSeeded();
|
|
44176
44699
|
} catch (err) {
|
|
44177
44700
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -44179,7 +44702,7 @@ try {
|
|
|
44179
44702
|
throw err;
|
|
44180
44703
|
}
|
|
44181
44704
|
try {
|
|
44182
|
-
const { runAllSeeders } = await import("./index-
|
|
44705
|
+
const { runAllSeeders } = await import("./index-hgn3c961.js");
|
|
44183
44706
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
44184
44707
|
} catch (err) {
|
|
44185
44708
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
@@ -44242,26 +44765,26 @@ httpServer.listen(port, async () => {
|
|
|
44242
44765
|
await initWorkflows2();
|
|
44243
44766
|
await startScriptRunSupervisor(getMcpBaseUrl());
|
|
44244
44767
|
if (hasCapability("scheduling")) {
|
|
44245
|
-
const { startScheduler } = await import("./index-
|
|
44246
|
-
const { getExecutorRegistry } = await import("./index-
|
|
44768
|
+
const { startScheduler } = await import("./index-8arwq8mw.js");
|
|
44769
|
+
const { getExecutorRegistry } = await import("./index-tpw054az.js");
|
|
44247
44770
|
const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
|
|
44248
44771
|
startScheduler(getExecutorRegistry(), intervalMs, {
|
|
44249
44772
|
runId: globalState.__runId
|
|
44250
44773
|
});
|
|
44251
44774
|
}
|
|
44252
44775
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
44253
|
-
const { startHeartbeat } = await import("./index-
|
|
44776
|
+
const { startHeartbeat } = await import("./index-waq75j2j.js");
|
|
44254
44777
|
const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
|
|
44255
44778
|
startHeartbeat(heartbeatMs);
|
|
44256
44779
|
}
|
|
44257
44780
|
startPoolRouting();
|
|
44258
44781
|
startRuntimeSupervisor();
|
|
44259
44782
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
44260
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
44783
|
+
const { startOAuthKeepalive } = await import("./keepalive-1j4n4dmk.js");
|
|
44261
44784
|
startOAuthKeepalive();
|
|
44262
44785
|
}
|
|
44263
44786
|
if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
|
|
44264
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
44787
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-yy06c03c.js");
|
|
44265
44788
|
startOAuthRefreshSweep();
|
|
44266
44789
|
}
|
|
44267
44790
|
startOAuthPendingGc();
|
|
@@ -44270,19 +44793,19 @@ httpServer.listen(port, async () => {
|
|
|
44270
44793
|
await startDbRetention();
|
|
44271
44794
|
startHumanFreeDrain();
|
|
44272
44795
|
startTaskSearchBackfill();
|
|
44273
|
-
import("./embedding-space-
|
|
44796
|
+
import("./embedding-space-4kyh5qqj.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
|
|
44274
44797
|
setDeploymentEnvReader(getDeploymentEnvValue);
|
|
44275
44798
|
return runEmbeddingMaintenance({ backfill: true });
|
|
44276
44799
|
}).catch((err) => {
|
|
44277
44800
|
console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
|
|
44278
44801
|
});
|
|
44279
|
-
import("./boot-args-schema-
|
|
44802
|
+
import("./boot-args-schema-hwkc8bzv.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
|
|
44280
44803
|
console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
|
|
44281
44804
|
});
|
|
44282
|
-
import("./boot-scrub-sweep-
|
|
44805
|
+
import("./boot-scrub-sweep-r5r8kqsn.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
44283
44806
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
44284
44807
|
});
|
|
44285
|
-
import("./session-source-backfill-
|
|
44808
|
+
import("./session-source-backfill-2sy0krfk.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
|
|
44286
44809
|
console.error("[session-source-backfill] startup run failed (non-fatal):", err);
|
|
44287
44810
|
});
|
|
44288
44811
|
}).on("error", (err) => {
|