@desplega.ai/agent-swarm 2.13.5 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-99n6z9ky.js +17 -0
- package/dist/{acp-targets-w8dbs4nr.js → acp-targets-23exz4z4.js} +10 -10
- package/dist/{actions-8zrcbjrx.js → actions-zcr25x27.js} +60 -39
- package/dist/{agent-fs-provision-cbt2ttds.js → agent-fs-provision-7fa9e12e.js} +4 -4
- package/dist/{amp-adapter-8x6zp8w4.js → amp-adapter-s7ytmv6b.js} +3 -3
- package/dist/{app-zfa9dwjw.js → app-5d3sz1hy.js} +7 -7
- package/dist/{approval-notifications-rv92zmza.js → approval-notifications-7qgkzkzx.js} +8 -8
- package/dist/{assistant-q7s7rm1q.js → assistant-p2yvhc3j.js} +37 -32
- package/dist/{boot-args-schema-g27kpzr1.js → boot-args-schema-ry6cb0p7.js} +1 -1
- package/dist/{boot-reembed-1mjs52nt.js → boot-reembed-2hkm3vz2.js} +1 -1
- package/dist/{boot-reembed-m62dpdkg.js → boot-reembed-c9643ms3.js} +1 -1
- package/dist/{boot-scrub-sweep-ss1vcamw.js → boot-scrub-sweep-3ycxr51t.js} +2 -2
- package/dist/{boot-seeds-hwnvgbb3.js → boot-seeds-2hzvvzg0.js} +4 -4
- package/dist/{boxd-y0szhp0g.js → boxd-9py3x0jb.js} +2 -2
- package/dist/{claude-adapter-0rjmbhjk.js → claude-adapter-dnkww93e.js} +9 -9
- package/dist/{claude-managed-adapter-6k032agg.js → claude-managed-adapter-yk0cr5x6.js} +4 -4
- package/dist/{claude-managed-setup-6czvve8q.js → claude-managed-setup-4byxpp47.js} +5 -5
- package/dist/{claude-sdk-session-pr0znb81.js → claude-sdk-session-4wf3dbvs.js} +12467 -12285
- package/dist/{cli-t0n9svkb.js → cli-096aftq6.js} +12 -7
- package/dist/{cli-2wzkvfgm.js → cli-0e914dp9.js} +3 -3
- package/dist/{cli-vcpyttcw.js → cli-0h6m6z5g.js} +1 -1
- package/dist/{cli-q41qar56.js → cli-0k7ppk9k.js} +130 -8
- package/dist/{cli-ks06cd0n.js → cli-1nfabrt4.js} +8 -8
- package/dist/{cli-ebpq3c5z.js → cli-2414h5r9.js} +8 -8
- package/dist/{cli-nrt048ys.js → cli-24wervhz.js} +37 -0
- package/dist/{cli-pedm2kht.js → cli-2ayk9gn8.js} +2 -2
- package/dist/{cli-kr0jpw9c.js → cli-2ckwgs7q.js} +1 -1
- package/dist/{cli-evy3egte.js → cli-2savn6mm.js} +11 -100
- package/dist/{cli-n79j1vxc.js → cli-2zjxake1.js} +4 -4
- package/dist/{cli-z3x7h79n.js → cli-37p61fcg.js} +9 -9
- package/dist/{cli-2vp0z049.js → cli-39t9d248.js} +1 -1
- package/dist/{cli-sa02jsqt.js → cli-3mhdmcd4.js} +1 -1
- package/dist/{cli-34fygf87.js → cli-3wsabyt0.js} +2 -2
- package/dist/{cli-grbngev5.js → cli-466jjrwe.js} +11 -2
- package/dist/{cli-zxa1vmx7.js → cli-6ajyhxh7.js} +2 -2
- package/dist/{cli-bvamr9g0.js → cli-6yy4fepf.js} +4 -4
- package/dist/{cli-3vw6dd4g.js → cli-73rmgm45.js} +2 -2
- package/dist/{cli-8b4rpnwj.js → cli-7ca8hczj.js} +1 -1
- package/dist/{cli-0h8skzss.js → cli-7g5qj2ca.js} +4 -3
- package/dist/{cli-srre41gb.js → cli-7w1fs01q.js} +2 -2
- package/dist/{cli-tgc1kgg3.js → cli-84wxwt3z.js} +1 -1
- package/dist/{cli-4gaf3tx5.js → cli-84xn7bgz.js} +1 -1
- package/dist/{cli-s8dhq7rj.js → cli-879txsac.js} +5 -5
- package/dist/{cli-9n6g14vs.js → cli-8vbxjzk0.js} +3 -3
- package/dist/{cli-cmbb2t8a.js → cli-91amj3md.js} +2 -2
- package/dist/{cli-ewk3sg68.js → cli-930zbczq.js} +3 -3
- package/dist/{cli-6msnpj1z.js → cli-9fwznq4p.js} +10 -10
- package/dist/{cli-qmx8bnt4.js → cli-9j1t3kf6.js} +2 -2
- package/dist/{cli-t879ww0y.js → cli-9j47sgzy.js} +2 -2
- package/dist/{cli-0qt3epg4.js → cli-ad00h1st.js} +7 -7
- package/dist/{cli-avax5mp9.js → cli-adzmmcvf.js} +19 -7
- package/dist/{cli-ffn0a515.js → cli-ayxxkk3p.js} +68 -25
- package/dist/{cli-4vynxtrb.js → cli-bqfx72e6.js} +10 -3
- package/dist/{cli-887vhew6.js → cli-cbg0j1yt.js} +2716 -2643
- package/dist/{cli-fw67mnyc.js → cli-cg1q8ymp.js} +1 -1
- package/dist/{cli-he5nxaa8.js → cli-dw9rtjm3.js} +1 -1
- package/dist/{cli-emdfd8fh.js → cli-dy754erz.js} +9 -1
- package/dist/{cli-3860pmrq.js → cli-edxfzgah.js} +4 -4
- package/dist/{cli-v09eza21.js → cli-ejnhs815.js} +15 -15
- package/dist/{cli-k0nebh10.js → cli-enavhq6r.js} +1 -1
- package/dist/{cli-b42yfn17.js → cli-f2rwt43y.js} +13 -13
- package/dist/{cli-tvyt8w6n.js → cli-f9g96z28.js} +8 -8
- package/dist/{cli-zbbtp02a.js → cli-fww016hh.js} +457 -70
- package/dist/{cli-vbge4rsp.js → cli-g6a696c0.js} +4 -4
- package/dist/{cli-z1vam71h.js → cli-gc6b94tj.js} +2 -2
- package/dist/{cli-5tq15aa7.js → cli-gcyws2bp.js} +2 -2
- package/dist/{cli-srktrbby.js → cli-hzhv7yac.js} +1 -1
- package/dist/{cli-cp163xga.js → cli-jcnc5ret.js} +44 -32
- package/dist/{cli-j69pzrrz.js → cli-jgq9xptq.js} +5 -5
- package/dist/{cli-kwj3131p.js → cli-jwnac23b.js} +1 -1
- package/dist/{cli-wzecestt.js → cli-kc7vd07m.js} +616 -289
- package/dist/{cli-8pd1t17c.js → cli-kg63yp1r.js} +14 -14
- package/dist/{cli-zzq96q57.js → cli-krk8y8c7.js} +727 -139
- package/dist/{cli-5web09sb.js → cli-m0ea8ggd.js} +8 -10
- package/dist/{cli-qrvk9nka.js → cli-md4tn21h.js} +13 -13
- package/dist/{cli-1jq2em7b.js → cli-mv8ft7b0.js} +10 -9
- package/dist/{cli-ryem5cfq.js → cli-mw1tmn3x.js} +217 -27
- package/dist/{cli-abby987g.js → cli-njvpngc6.js} +3 -3
- package/dist/{cli-55h8m1x3.js → cli-phe2vcw5.js} +6 -6
- package/dist/{cli-prz1p3ft.js → cli-pq0kv31y.js} +5 -5
- package/dist/{cli-q1h041y8.js → cli-q457ga28.js} +6 -6
- package/dist/{cli-z40t85ms.js → cli-q5n3deaf.js} +1 -1
- package/dist/{cli-7ypg8hka.js → cli-qkbevqer.js} +3 -3
- package/dist/{cli-f9xw9pr4.js → cli-qrwjk4xy.js} +5 -5
- package/dist/{cli-kezzteka.js → cli-r04ve9xw.js} +1 -1
- package/dist/{cli-zntvmqmm.js → cli-r495stwd.js} +2 -2
- package/dist/{cli-1kvcsd2f.js → cli-r9d2tya0.js} +71 -3
- package/dist/{cli-ybte1fqc.js → cli-rp1n2xpd.js} +1 -1
- package/dist/{cli-sejvnjvw.js → cli-rs1rzwp4.js} +1 -1
- package/dist/{cli-94mxerrp.js → cli-rzbsh6bw.js} +1 -1
- package/dist/{cli-94gx6ze9.js → cli-s4pccby1.js} +1 -1
- package/dist/{cli-hd5bm1e1.js → cli-shyhb4t5.js} +10 -10
- package/dist/{cli-r3dxpmyt.js → cli-srq69pn1.js} +1 -1
- package/dist/{cli-7r9tvk8v.js → cli-tc165vrb.js} +8 -3
- package/dist/{cli-ced4azn1.js → cli-v4z5v3jd.js} +298 -80
- package/dist/{cli-ehg90jd1.js → cli-vxmmttmt.js} +55 -50
- package/dist/{cli-tt7dkwjj.js → cli-w4bvtxet.js} +7 -7
- package/dist/{cli-x2adbg4j.js → cli-wd7b5hgc.js} +1 -1
- package/dist/{cli-htb5bpz2.js → cli-wvbaq052.js} +1 -1
- package/dist/{cli-ywy8yz6t.js → cli-wvgg7r4j.js} +2 -2
- package/dist/{cli-19d6v8er.js → cli-wym6rxgt.js} +165 -6
- package/dist/{cli-f7b9nyvk.js → cli-yd7e590v.js} +12 -12
- package/dist/{cli-69zzpjgh.js → cli-yjb3cddd.js} +1 -1
- package/dist/{cli-5n9w2xzx.js → cli-z8t4485r.js} +2 -2
- package/dist/{cli-jdq3jmny.js → cli-ze1ndjs4.js} +4 -6
- package/dist/cli.js +28 -28
- package/dist/{codex-adapter-bn7eaxk5.js → codex-adapter-eq61radw.js} +8 -8
- package/dist/{codex-hook-nnmezjg9.js → codex-hook-8nmepvz6.js} +3 -3
- package/dist/{codex-login-ktfg1cxk.js → codex-login-vbd9707w.js} +1 -1
- package/dist/{codex-session-runner-j1e9hffc.js → codex-session-runner-rfx355h4.js} +9 -9
- package/dist/{commands-amhpafrr.js → commands-d1z0sx62.js} +3 -3
- package/dist/{controller-tw7g10j2.js → controller-9hz6d8x3.js} +4 -4
- package/dist/{controllers-connect-2ssqz7f4.js → controllers-connect-tz07d2xr.js} +24 -25
- package/dist/core-dynsv289.js +41 -0
- package/dist/{cursor-adapter-d6knjmwa.js → cursor-adapter-ef22ze3j.js} +2 -2
- package/dist/{db-fd6xxm77.js → db-gd81d68c.js} +3 -3
- package/dist/{db-sc59379z.js → db-vrckks6q.js} +4 -2
- package/dist/{devin-adapter-3bp6rape.js → devin-adapter-kdt6a2bh.js} +1 -1
- package/dist/{dispatcher-a2gdqz8c.js → dispatcher-76as8w2t.js} +21 -22
- package/dist/{docker-a59g3ebm.js → docker-51ta7jsh.js} +2 -2
- package/dist/dsh-adapter-ypfvcdyz.js +11 -0
- package/dist/{e2b-cn7cvjqy.js → e2b-05kn3kpq.js} +16 -5
- package/dist/{e2b-qnxyfea6.js → e2b-dm9r8hpy.js} +3 -3
- package/dist/{easter-egg-3d-a0pphy71.js → easter-egg-3d-sg21j15g.js} +1 -1
- package/dist/{embedding-space-qepzrach.js → embedding-space-zsdw37bb.js} +13 -23
- package/dist/{embeddings-d7vr881x.js → embeddings-p4e3e1m6.js} +1 -1
- package/dist/{event-bus-7gbsr0g4.js → event-bus-tvf2grf4.js} +1 -1
- package/dist/{execute-6afts2bn.js → execute-nztd0af0.js} +1 -1
- package/dist/{external-channel-881zq1x4.js → external-channel-717yzn4d.js} +2 -2
- package/dist/fx-adapter-9k0hptnz.js +20 -0
- package/dist/grok-adapter-skdj2pce.js +20 -0
- package/dist/handlers-5btjqkz6.js +39 -0
- package/dist/{heartbeat-4c022m6a.js → heartbeat-vfb1gy84.js} +24 -25
- package/dist/{hook-a7eh6zty.js → hook-ctz0xmp3.js} +11 -11
- package/dist/{hook-4k84x499.js → hook-eh52p7yd.js} +6 -6
- package/dist/{http-6aw5wanc.js → http-zregegrx.js} +784 -166
- package/dist/{index-xhad0n8m.js → index-5kx15d19.js} +1 -1
- package/dist/index-7w8p6em0.js +41 -0
- package/dist/index-evay0xyk.js +17 -0
- package/dist/{index-yq9hhhhy.js → index-fdym6ryb.js} +25 -26
- package/dist/{index-3j803vnb.js → index-mtnbhe12.js} +20533 -19786
- package/dist/index-vz4semsx.js +38 -0
- package/dist/{index-z2g9469g.js → index-x9qf8dg7.js} +108 -28
- package/dist/index-y3s0xp2v.js +43 -0
- package/dist/{k8s-36gfn847.js → k8s-ejkk0aw7.js} +2 -2
- package/dist/{keepalive-zhbmztqw.js → keepalive-zdqay870.js} +4 -5
- package/dist/lead-6cscw8a5.js +82 -0
- package/dist/{maintenance-rsp0591h.js → maintenance-t5ndg11m.js} +1 -1
- package/dist/{node-rxte5hc6.js → node-jkdd5w7m.js} +1 -1
- package/dist/{oauth-refresh-sweep-w3cqmxq7.js → oauth-refresh-sweep-y9zyd7t6.js} +3 -4
- package/dist/{object-webhooks-331hay92.js → object-webhooks-mkca91s0.js} +7 -7
- package/dist/{onboard-n2w80m2n.js → onboard-ss995244.js} +11 -9
- package/dist/{opencode-adapter-z98127cz.js → opencode-adapter-mwpz0278.js} +8 -8
- package/dist/{otel-impl-xsk35tvf.js → otel-impl-6n6vva3x.js} +2 -2
- package/dist/{pending-2e6trkxd.js → pending-2sxh1t6j.js} +22 -23
- package/dist/{pi-mono-adapter-wh6yndtm.js → pi-mono-adapter-sfb7zy43.js} +13 -13
- package/dist/{pricing-refresh-9355dj1t.js → pricing-refresh-h79bg4cf.js} +2 -2
- package/dist/{rbac-roles-8eajw4s6.js → rbac-roles-ckq0czp4.js} +2 -2
- package/dist/{rbac-roles-58y3m912.js → rbac-roles-jg2e260w.js} +3 -3
- package/dist/{render-v2-7gskkmd4.js → render-v2-ymbshmn0.js} +7 -7
- package/dist/{resume-0drnmpja.js → resume-jdhnt4jk.js} +10 -10
- package/dist/{runtime-d2tcmqte.js → runtime-y28jhhnf.js} +1 -1
- package/dist/{session-access-0ztys6bd.js → session-access-k4ta5hvp.js} +5 -5
- package/dist/{session-source-backfill-cdm5s046.js → session-source-backfill-528j4s8j.js} +3 -3
- package/dist/{setup-pqwb9tcc.js → setup-d6pj82fr.js} +15 -6
- package/dist/thread-buffer-9w6x5zec.js +40 -0
- package/dist/{tree-visibility-rwz67mje.js → tree-visibility-kjxv3nxk.js} +2 -2
- package/dist/{user-merge-jobs-mxrhamwt.js → user-merge-jobs-rabbncf6.js} +3 -3
- package/dist/{virtual-modules-71y1gsmg.js → virtual-modules-22k51txd.js} +3 -3
- package/dist/{work-objects-3k4ykt9j.js → work-objects-xtjbar3r.js} +26 -30
- package/dist/{worker-follow-up-y0h64xpr.js → worker-follow-up-fg48vk6d.js} +21 -22
- package/dist/worker-g4aj93dt.js +82 -0
- package/dist/{x-d27jj7z7.js → x-vfsqypht.js} +2 -2
- package/openapi.json +247 -20
- package/package.json +10 -10
- package/src/apps/definition.ts +76 -24
- package/src/apps/row-store.ts +67 -0
- package/src/apps/script-types.ts +131 -21
- package/src/apps/store.ts +4 -1
- package/src/be/db/script-runs.ts +33 -0
- package/src/be/db/slack-card-groups.ts +147 -0
- package/src/be/db/slack-trees.ts +26 -0
- package/src/be/db/task-idempotency.ts +63 -0
- package/src/be/db/tasks/read.ts +2 -0
- package/src/be/db/tasks/write.ts +4 -2
- package/src/be/db/workflow-idempotency.ts +6 -1
- package/src/be/db/workflows/read.ts +79 -0
- package/src/be/db.ts +51 -147
- package/src/be/improvements.ts +24 -2
- package/src/be/mcp-proxy.ts +45 -11
- package/src/be/memory/embedding-space.ts +10 -20
- package/src/be/memory/index.ts +35 -0
- package/src/be/memory/providers/openai-embedding.ts +10 -0
- package/src/be/migrations/348_task_deferred_until.sql +4 -0
- package/src/be/migrations/354_durable_objects.sql +9 -0
- package/src/be/migrations/356_slack_outcome_card_groups.sql +14 -0
- package/src/be/migrations/357_task_idempotency_keys.sql +27 -0
- package/src/be/migrations/362_favorites_app.sql +36 -0
- package/src/be/repo-checked-update.ts +58 -5
- package/src/be/requester-timezone.ts +10 -0
- package/src/be/script-connections.ts +5 -1
- package/src/be/script-credential-broker.ts +29 -2
- package/src/be/scripts/durable.ts +204 -0
- package/src/be/scripts/extract-schema.ts +29 -4
- package/src/be/scripts/run-credential.ts +1 -8
- package/src/be/scripts/typecheck.ts +32 -7
- package/src/be/seed-scripts/catalog/memory-eval.ts +11 -2
- package/src/be/seed-scripts/catalog/tool-usage.ts +27 -8
- package/src/be/swarm-config-guard.ts +87 -7
- package/src/be/users.ts +33 -12
- package/src/comb/review-batch.ts +16 -5
- package/src/commands/context-preamble.ts +237 -0
- package/src/commands/e2b.ts +14 -0
- package/src/commands/entrypoint-mcp-config.ts +231 -0
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/compose-generator.ts +2 -1
- package/src/commands/onboard/env-generator.ts +16 -7
- package/src/commands/runner.ts +23 -7
- package/src/commands/setup.tsx +17 -3
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/hooks/hook.ts +8 -2
- package/src/hooks/native-tool-hooks.ts +4 -2
- package/src/http/apps.ts +82 -42
- package/src/http/comb.ts +21 -5
- package/src/http/config.ts +8 -4
- package/src/http/heartbeat.ts +5 -0
- package/src/http/index.ts +12 -6
- package/src/http/kv.ts +7 -5
- package/src/http/mcp-oauth.ts +16 -0
- package/src/http/mcp-servers.ts +43 -3
- package/src/http/memory.ts +28 -1
- package/src/http/metrics.ts +11 -4
- package/src/http/onboarding.ts +12 -1
- package/src/http/repos.ts +27 -11
- package/src/http/request-principal.ts +27 -1
- package/src/http/schedules.ts +36 -8
- package/src/http/script-connection-proxy.ts +3 -1
- package/src/http/script-runs.ts +21 -10
- package/src/http/scripts.ts +177 -26
- package/src/http/session-cost-recompute.ts +9 -4
- package/src/http/skills.ts +70 -0
- package/src/http/status.ts +2 -0
- package/src/http/tasks.ts +92 -14
- package/src/http/trackers/jira.ts +18 -3
- package/src/http/trackers/linear.ts +3 -0
- package/src/kv-limits.ts +2 -0
- package/src/kv-reserved-namespaces.ts +25 -2
- package/src/prompts/session-templates.ts +49 -0
- package/src/prompts/session-turns.ts +30 -0
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-managed-adapter.ts +14 -0
- package/src/providers/claude-sdk-session.ts +14 -1
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +3 -5
- package/src/providers/runtime-dependencies.ts +11 -8
- package/src/rbac/legacy-policy.ts +7 -0
- package/src/rbac/permissions.ts +27 -0
- package/src/scheduler/scheduler.ts +36 -18
- package/src/script-workflows/executor.ts +37 -8
- package/src/script-workflows/supervisor.ts +14 -0
- package/src/scripts-runtime/ctx.ts +5 -1
- package/src/scripts-runtime/durable-object-base.ts +19 -0
- package/src/scripts-runtime/eval-harness.ts +46 -1
- package/src/scripts-runtime/executors/native.ts +13 -1
- package/src/scripts-runtime/executors/quickjs-bundle.ts +20 -1
- package/src/scripts-runtime/executors/quickjs-prelude.ts +40 -1
- package/src/scripts-runtime/executors/quickjs-runner.ts +26 -3
- package/src/scripts-runtime/executors/quickjs-worker.ts +2 -1
- package/src/scripts-runtime/executors/types.ts +26 -0
- package/src/scripts-runtime/extract-signature.ts +96 -1
- package/src/scripts-runtime/loader.ts +11 -5
- package/src/scripts-runtime/mcp-client.ts +1 -1
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/swarm-config.ts +7 -0
- package/src/scripts-runtime/swarm-sdk.ts +4 -1
- package/src/scripts-runtime/types/stdlib.d.ts +19 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +19 -0
- package/src/slack/actions.ts +24 -0
- package/src/slack/assistant.ts +8 -0
- package/src/slack/blocks.ts +35 -0
- package/src/slack/channel-activity.ts +7 -0
- package/src/slack/enrich.ts +46 -54
- package/src/slack/files.ts +173 -23
- package/src/slack/handlers.test.ts +17 -19
- package/src/slack/handlers.ts +15 -14
- package/src/slack/render-v2.ts +264 -19
- package/src/slack/responses.ts +61 -5
- package/src/slack/session-mirror.ts +10 -5
- package/src/slack/task-output.ts +25 -14
- package/src/slack/templates.ts +9 -0
- package/src/slack/thread-participants.ts +64 -24
- package/src/slack/watcher.ts +4 -4
- package/src/slack/work-objects.ts +1 -1
- package/src/stdio.ts +5 -0
- package/src/tests/agents-list-model-display.test.ts +4 -0
- package/src/tests/apps-script-types.test.ts +63 -16
- package/src/tests/apps-sort-order.test.ts +87 -0
- package/src/tests/bedrock-model-groups.test.ts +4 -0
- package/src/tests/channel-activity.test.ts +9 -0
- package/src/tests/chatgpt-subscription-model-groups.test.ts +4 -0
- package/src/tests/claude-hook-output.test.ts +2 -0
- package/src/tests/claude-managed-adapter.test.ts +15 -3
- package/src/tests/claude-sdk-stderr.test.ts +28 -0
- package/src/tests/codex-gpt6-release.test.ts +4 -0
- package/src/tests/comb-review-batch.test.ts +17 -4
- package/src/tests/comb-status.test.ts +1 -0
- package/src/tests/db-client.test.ts +11 -5
- package/src/tests/db-task-read-contract.test.ts +1 -0
- package/src/tests/db-task-write-contract.test.ts +2 -2
- package/src/tests/defer-task.test.ts +23 -1
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/e2b-dispatch.test.ts +13 -1
- package/src/tests/entrypoint-mcp-config.test.ts +642 -0
- package/src/tests/fixtures/onboard/content.env.txt +2 -2
- package/src/tests/fixtures/onboard/dev.env.txt +2 -2
- package/src/tests/fixtures/onboard/full-all.env.txt +2 -2
- package/src/tests/fixtures/onboard/full.env.txt +2 -2
- package/src/tests/fixtures/onboard/research.env.txt +2 -2
- package/src/tests/fixtures/onboard/solo.env.txt +2 -2
- package/src/tests/fixtures/runner-missing-dependency.ts +2 -1
- package/src/tests/fx-adapter.test.ts +4 -5
- package/src/tests/hook-mcp-config-precedence.test.ts +59 -0
- package/src/tests/hook-ping-me-order.test.ts +1 -0
- package/src/tests/hook-runtime-close.test.ts +1 -0
- package/src/tests/improvements-payload.test.ts +2 -2
- package/src/tests/model-groups-live-catalog.test.ts +4 -0
- package/src/tests/oauth-credential-bindings.test.ts +8 -3
- package/src/tests/oauth-refresh-failure.test.ts +15 -3
- package/src/tests/onboard-env.test.ts +1 -1
- package/src/tests/openai-compatible-providers.test.ts +5 -0
- package/src/tests/openapi-route-headers.test.ts +2 -1
- package/src/tests/opus-5-5-registry.test.ts +4 -0
- package/src/tests/provider-runtime-dependencies.test.ts +26 -15
- package/src/tests/routing-affinity-inventory.test.ts +11 -0
- package/src/tests/runner-context-preamble.test.ts +202 -0
- package/src/tests/runner-repo-clone-args.test.ts +116 -0
- package/src/tests/scheduler-occurrence.test.ts +60 -9
- package/src/tests/script-connections-mcp.test.ts +6 -3
- package/src/tests/script-connections.test.ts +4 -0
- package/src/tests/scripts-namespaces.test.ts +3 -1
- package/src/tests/secret-scrubber.test.ts +8 -2
- package/src/tests/session-cost-recompute-unit.test.ts +39 -0
- package/src/tests/session-costs-recompute-all-providers.test.ts +6 -3
- package/src/tests/session-route-posture.test.ts +7 -1
- package/src/tests/slack-file-tools-attachments.test.ts +14 -9
- package/src/tests/slack-identity-resolution.test.ts +10 -3
- package/src/tests/slack-inline-output.test.ts +10 -8
- package/src/tests/slack-render-v2.test.ts +9 -4
- package/src/tests/slack-steering.test.ts +8 -2
- package/src/tests/slack-thread-participants.test.ts +11 -1
- package/src/tests/sonnet-5-5-registry.test.ts +4 -0
- package/src/tests/swarm-config-encryption.test.ts +5 -8
- package/src/tests/ui-spec-script-actions-config.test.ts +7 -3
- package/src/tests/workflow-triggers-v2.test.ts +35 -11
- package/src/tools/app-patch.ts +6 -2
- package/src/tools/app-upsert.ts +8 -4
- package/src/tools/defer-task.ts +17 -77
- package/src/tools/kv/kv-get.ts +2 -0
- package/src/tools/kv/kv-list.ts +11 -5
- package/src/tools/kv/kv-set.ts +1 -3
- package/src/tools/repos/update-repo.ts +37 -19
- package/src/tools/schedules/run-schedule-now.ts +21 -1
- package/src/tools/script-apis.ts +9 -4
- package/src/tools/script-common.ts +2 -2
- package/src/tools/script-run.ts +8 -0
- package/src/tools/script-upsert.ts +1 -1
- package/src/tools/slack-download-file.ts +15 -12
- package/src/tools/slack-post.ts +7 -1
- package/src/tools/slack-read.ts +3 -1
- package/src/tools/slack-reply.ts +16 -0
- package/src/tools/slack-start-thread.ts +8 -1
- package/src/tools/slack-upload-file.ts +99 -96
- package/src/tools/swarm-config/set-config.ts +3 -1
- package/src/tools/swarm-x.ts +0 -2
- package/src/tools/utils.ts +3 -0
- package/src/types.ts +8 -2
- package/src/utils/constants.ts +20 -0
- package/src/utils/deferral-time.ts +61 -0
- package/src/utils/request-auth-context.ts +15 -16
- package/src/utils/secret-scrubber.ts +1 -1
- package/src/workflows/engine.ts +6 -11
- package/src/workflows/executors/swarm-script.ts +0 -2
- package/src/workflows/foreach-driver.ts +6 -12
- package/src/workflows/input.ts +24 -1
- package/src/workflows/node-timeout.ts +18 -0
- package/src/workflows/retry-poller.ts +2 -1
- package/src/workflows/triggers.ts +21 -11
- package/src/x/composio.ts +10 -1
- package/templates/skills/apps/SKILL.md +4 -2
- package/templates/skills/apps/content.md +4 -2
- package/templates/skills/code-quality/content.md +4 -4
- package/templates/skills/scheduled-task-resilience/SKILL.md +2 -0
- package/templates/skills/scheduled-task-resilience/content.md +2 -0
- package/templates/skills/swarm-docs/content.md +7 -0
- package/templates/skills/swarm-scripts/SKILL.md +44 -0
- package/templates/skills/swarm-scripts/content.md +44 -0
- package/dist/acp-adapter-tbt61zkm.js +0 -17
- package/dist/cli-b9ygp1kz.js +0 -459
- package/dist/cli-kj0hyr43.js +0 -51
- package/dist/cli-m8f4379k.js +0 -173
- package/dist/core-bwp98v4w.js +0 -42
- package/dist/dsh-adapter-43ygwqn7.js +0 -9
- package/dist/fx-adapter-cr2hq17y.js +0 -20
- package/dist/grok-adapter-ayddnbsc.js +0 -20
- package/dist/handlers-7ghs84x2.js +0 -41
- package/dist/index-dtt0d634.js +0 -44
- package/dist/index-hmszyqkk.js +0 -42
- package/dist/index-j6rm1rtn.js +0 -39
- package/dist/index-rwwhsmjg.js +0 -13
- package/dist/lead-g2j4q39z.js +0 -83
- package/dist/thread-buffer-epx3san4.js +0 -42
- package/dist/worker-09gqn9xy.js +0 -83
|
@@ -87,6 +87,8 @@ import {
|
|
|
87
87
|
isChatSdkTask,
|
|
88
88
|
selectTaskTools,
|
|
89
89
|
init_task_tool_manifest,
|
|
90
|
+
isApiOnlyConfigKey,
|
|
91
|
+
isInternalConfigKey,
|
|
90
92
|
MAX_DB_RETENTION_DAYS,
|
|
91
93
|
DB_RETENTION_TUNING_BOUNDS,
|
|
92
94
|
CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS,
|
|
@@ -144,6 +146,22 @@ import {
|
|
|
144
146
|
init_workflow_runs,
|
|
145
147
|
OpenAI2,
|
|
146
148
|
init_openai2,
|
|
149
|
+
isInvalidClientError,
|
|
150
|
+
publicEndpointSsrfOptions,
|
|
151
|
+
mcpOAuthSsrfOptions,
|
|
152
|
+
discoverProtectedResourceMetadata,
|
|
153
|
+
discoverAuthorizationServerMetadata,
|
|
154
|
+
normalizeTokenEndpointAuthMethod,
|
|
155
|
+
resolveAdvertisedTokenEndpointAuthMethod,
|
|
156
|
+
authMethodForStoredClient,
|
|
157
|
+
selectDcrTokenEndpointAuthMethod,
|
|
158
|
+
registerClient,
|
|
159
|
+
buildAuthorizeUrl,
|
|
160
|
+
exchangeCodeForTokens,
|
|
161
|
+
refreshMcpToken,
|
|
162
|
+
revokeMcpToken,
|
|
163
|
+
computeExpiresAt,
|
|
164
|
+
init_mcp_wrapper,
|
|
147
165
|
CANDIDATE_SET_MULTIPLIER,
|
|
148
166
|
EMBEDDING_DIMENSIONS,
|
|
149
167
|
init_constants2,
|
|
@@ -159,6 +177,7 @@ import {
|
|
|
159
177
|
getEmbeddingProvider2,
|
|
160
178
|
resetEmbeddingProvider2,
|
|
161
179
|
getMemoryStore2,
|
|
180
|
+
setDeploymentEnvReader2,
|
|
162
181
|
init_memory,
|
|
163
182
|
searchScripts2,
|
|
164
183
|
init_embeddings,
|
|
@@ -314,7 +333,9 @@ import {
|
|
|
314
333
|
updateTaskProgress2,
|
|
315
334
|
init_write,
|
|
316
335
|
IdempotencyKeyTakenError,
|
|
336
|
+
sha256,
|
|
317
337
|
workflowRequestFingerprint,
|
|
338
|
+
requestFingerprint,
|
|
318
339
|
assertWorkflowIdempotencyKeyUnused,
|
|
319
340
|
recordAcceptedWorkflowOperation,
|
|
320
341
|
init_workflow_idempotency,
|
|
@@ -523,7 +544,7 @@ import {
|
|
|
523
544
|
countScriptRunJournalSteps2,
|
|
524
545
|
countScriptRunJournalAgentTaskSteps2,
|
|
525
546
|
init_db4
|
|
526
|
-
} from "./cli-
|
|
547
|
+
} from "./cli-krk8y8c7.js";
|
|
527
548
|
import {
|
|
528
549
|
PRIMARY_ROLE_NAMES2,
|
|
529
550
|
OperatorGrantedTargetError2,
|
|
@@ -537,7 +558,7 @@ import {
|
|
|
537
558
|
assertNotLastAdmin2,
|
|
538
559
|
setUserRoles2,
|
|
539
560
|
init_rbac_roles
|
|
540
|
-
} from "./cli-
|
|
561
|
+
} from "./cli-3wsabyt0.js";
|
|
541
562
|
import {
|
|
542
563
|
MAX_MODEL_GROUP_MEMBERS,
|
|
543
564
|
listModelGroups,
|
|
@@ -547,17 +568,20 @@ import {
|
|
|
547
568
|
modelGroupReferences,
|
|
548
569
|
deleteModelGroup,
|
|
549
570
|
init_model_groups
|
|
550
|
-
} from "./cli-
|
|
571
|
+
} from "./cli-qkbevqer.js";
|
|
551
572
|
import {
|
|
552
573
|
requestModelCatalogRefresh2,
|
|
553
574
|
init_pricing_refresh
|
|
554
|
-
} from "./cli-
|
|
575
|
+
} from "./cli-2ayk9gn8.js";
|
|
555
576
|
import {
|
|
556
577
|
workflowEventBus2,
|
|
557
578
|
init_event_bus
|
|
558
|
-
} from "./cli-
|
|
559
|
-
import
|
|
560
|
-
|
|
579
|
+
} from "./cli-rp1n2xpd.js";
|
|
580
|
+
import {
|
|
581
|
+
shouldBlockChannel2,
|
|
582
|
+
init_external_channel
|
|
583
|
+
} from "./cli-z8t4485r.js";
|
|
584
|
+
import"./cli-84xn7bgz.js";
|
|
561
585
|
import"./cli-vr4eyq6p.js";
|
|
562
586
|
import"./cli-r8ddn0hf.js";
|
|
563
587
|
import {
|
|
@@ -583,7 +607,7 @@ import {
|
|
|
583
607
|
TaskUiSpecSchema,
|
|
584
608
|
getTaskUiSpec,
|
|
585
609
|
getTaskUiSpecsForTasks,
|
|
586
|
-
|
|
610
|
+
init_task_ui_spec2,
|
|
587
611
|
initialize,
|
|
588
612
|
ensure,
|
|
589
613
|
init_business_use,
|
|
@@ -597,7 +621,7 @@ import {
|
|
|
597
621
|
startSlackApp2,
|
|
598
622
|
stopSlackApp2,
|
|
599
623
|
init_app4
|
|
600
|
-
} from "./cli-
|
|
624
|
+
} from "./cli-fww016hh.js";
|
|
601
625
|
import {
|
|
602
626
|
reconcileAgentMaxTasksPolicy,
|
|
603
627
|
upsertSwarmConfigWithPolicyMirror,
|
|
@@ -611,12 +635,12 @@ import {
|
|
|
611
635
|
reconcileAgentStatusFromRuntimes,
|
|
612
636
|
listRuntimeInstancesForPool,
|
|
613
637
|
init_multi_runtime
|
|
614
|
-
} from "./cli-
|
|
638
|
+
} from "./cli-2savn6mm.js";
|
|
615
639
|
import {
|
|
616
640
|
retryFailedRun2,
|
|
617
641
|
cancelWorkflowRun2,
|
|
618
642
|
init_resume
|
|
619
|
-
} from "./cli-
|
|
643
|
+
} from "./cli-phe2vcw5.js";
|
|
620
644
|
import {
|
|
621
645
|
safeParse,
|
|
622
646
|
getObjectShape,
|
|
@@ -691,6 +715,7 @@ import {
|
|
|
691
715
|
init_event_waits,
|
|
692
716
|
stripSiblingBlock,
|
|
693
717
|
init_sibling_block,
|
|
718
|
+
prepareTaskWithSiblingAwareness,
|
|
694
719
|
createTaskWithSiblingAwareness,
|
|
695
720
|
init_sibling_awareness,
|
|
696
721
|
hasPendingEventWait,
|
|
@@ -900,6 +925,7 @@ import {
|
|
|
900
925
|
agentFirstPrincipal,
|
|
901
926
|
requireAuthKind,
|
|
902
927
|
rejectGuest,
|
|
928
|
+
refuseAgentTokenWithout,
|
|
903
929
|
init_request_principal,
|
|
904
930
|
nextFallback2,
|
|
905
931
|
createWorkerTaskFollowUp2,
|
|
@@ -999,7 +1025,10 @@ import {
|
|
|
999
1025
|
reservedNamespaceError,
|
|
1000
1026
|
privateNamespaceError,
|
|
1001
1027
|
reservedRoomKeyError,
|
|
1028
|
+
scrubReservedRead,
|
|
1002
1029
|
init_kv_reserved_namespaces,
|
|
1030
|
+
MAX_KV_BODY_BYTES,
|
|
1031
|
+
init_kv_limits,
|
|
1003
1032
|
updateMcpServerChecked,
|
|
1004
1033
|
init_mcp_server_checked_update,
|
|
1005
1034
|
updateTouchesStdioExecution,
|
|
@@ -1024,6 +1053,7 @@ import {
|
|
|
1024
1053
|
init_config3,
|
|
1025
1054
|
changesMergePolicy,
|
|
1026
1055
|
init_repo_merge_policy,
|
|
1056
|
+
execConfigRefusal,
|
|
1027
1057
|
updateSwarmRepoChecked,
|
|
1028
1058
|
init_repo_checked_update,
|
|
1029
1059
|
getCombConfig,
|
|
@@ -1114,6 +1144,7 @@ import {
|
|
|
1114
1144
|
init_model_validation,
|
|
1115
1145
|
patchWorkflowDefinition,
|
|
1116
1146
|
init_patch_definition,
|
|
1147
|
+
IDEMPOTENT_REPLAYED_HEADER,
|
|
1117
1148
|
idempotencyKeyHeader,
|
|
1118
1149
|
readIdempotencyKey,
|
|
1119
1150
|
replayAcceptedOperation,
|
|
@@ -1125,7 +1156,7 @@ import {
|
|
|
1125
1156
|
getEnabledCapabilities,
|
|
1126
1157
|
createServer,
|
|
1127
1158
|
init_server
|
|
1128
|
-
} from "./cli-
|
|
1159
|
+
} from "./cli-kc7vd07m.js";
|
|
1129
1160
|
import {
|
|
1130
1161
|
getFileStorageProvider2,
|
|
1131
1162
|
init_registry2
|
|
@@ -1151,7 +1182,7 @@ import {
|
|
|
1151
1182
|
resolvePoolDelivery2,
|
|
1152
1183
|
createPoolAgent2,
|
|
1153
1184
|
init_db2
|
|
1154
|
-
} from "./cli-
|
|
1185
|
+
} from "./cli-qrwjk4xy.js";
|
|
1155
1186
|
import {
|
|
1156
1187
|
warnIfCorsAllowsAnyOrigin,
|
|
1157
1188
|
isOriginAllowedForCredentials,
|
|
@@ -1200,7 +1231,7 @@ import {
|
|
|
1200
1231
|
describeRequestRoute,
|
|
1201
1232
|
route,
|
|
1202
1233
|
init_route_def
|
|
1203
|
-
} from "./cli-
|
|
1234
|
+
} from "./cli-w4bvtxet.js";
|
|
1204
1235
|
import {
|
|
1205
1236
|
startPoolRouting,
|
|
1206
1237
|
stopPoolRouting,
|
|
@@ -1213,29 +1244,29 @@ import {
|
|
|
1213
1244
|
checkHeartbeatChecklist2,
|
|
1214
1245
|
runHeartbeatSweep2,
|
|
1215
1246
|
stopHeartbeat2
|
|
1216
|
-
} from "./cli-
|
|
1217
|
-
import"./cli-
|
|
1247
|
+
} from "./cli-md4tn21h.js";
|
|
1248
|
+
import"./cli-gcyws2bp.js";
|
|
1218
1249
|
import {
|
|
1219
1250
|
runtimeSupervisorStatus,
|
|
1220
1251
|
startRuntimeSupervisor,
|
|
1221
1252
|
stopRuntimeSupervisor
|
|
1222
|
-
} from "./cli-
|
|
1253
|
+
} from "./cli-f2rwt43y.js";
|
|
1223
1254
|
import {
|
|
1224
1255
|
TASK_TITLE_TIMEOUT_MS,
|
|
1225
1256
|
generateTaskTitle
|
|
1226
|
-
} from "./cli-
|
|
1257
|
+
} from "./cli-8vbxjzk0.js";
|
|
1227
1258
|
import"./cli-ns59dc6r.js";
|
|
1228
1259
|
import {
|
|
1229
1260
|
ACP_TARGET_IDS
|
|
1230
|
-
} from "./cli-
|
|
1261
|
+
} from "./cli-enavhq6r.js";
|
|
1231
1262
|
import {
|
|
1232
1263
|
reasoningCapability,
|
|
1233
1264
|
supportedReasoningLevels
|
|
1234
|
-
} from "./cli-
|
|
1265
|
+
} from "./cli-wvgg7r4j.js";
|
|
1235
1266
|
import {
|
|
1236
1267
|
MAX_RATE_LIMIT_RESET_MS,
|
|
1237
1268
|
MAX_SPEND_CAP_HOLD_MS
|
|
1238
|
-
} from "./cli-
|
|
1269
|
+
} from "./cli-rs1rzwp4.js";
|
|
1239
1270
|
import {
|
|
1240
1271
|
AgentFsRequestError2,
|
|
1241
1272
|
resolveAgentFsSharedContext2,
|
|
@@ -1246,10 +1277,10 @@ import {
|
|
|
1246
1277
|
agentFsRequest2,
|
|
1247
1278
|
resolveApiUrl2,
|
|
1248
1279
|
init_agent_fs_provision
|
|
1249
|
-
} from "./cli-
|
|
1280
|
+
} from "./cli-930zbczq.js";
|
|
1250
1281
|
import {
|
|
1251
1282
|
Anthropic
|
|
1252
|
-
} from "./cli-
|
|
1283
|
+
} from "./cli-0k7ppk9k.js";
|
|
1253
1284
|
import {
|
|
1254
1285
|
isLeadChannelMonitoringEnabled,
|
|
1255
1286
|
SIMILARITY_THRESHOLD,
|
|
@@ -1257,13 +1288,19 @@ import {
|
|
|
1257
1288
|
isUnknownModelError,
|
|
1258
1289
|
checkProviderPoolKey,
|
|
1259
1290
|
writeSkillsToFilesystem
|
|
1260
|
-
} from "./cli-
|
|
1291
|
+
} from "./cli-ze1ndjs4.js";
|
|
1261
1292
|
import {
|
|
1262
1293
|
objectWebhookSecret2,
|
|
1263
1294
|
handleObjectWebhookEvent2,
|
|
1264
1295
|
init_object_webhooks
|
|
1265
|
-
} from "./cli-
|
|
1266
|
-
import"./cli-
|
|
1296
|
+
} from "./cli-879txsac.js";
|
|
1297
|
+
import"./cli-mw1tmn3x.js";
|
|
1298
|
+
import {
|
|
1299
|
+
LOOKUP_USER_TEAM2,
|
|
1300
|
+
isUserAllowed2,
|
|
1301
|
+
init_handlers
|
|
1302
|
+
} from "./cli-ayxxkk3p.js";
|
|
1303
|
+
import"./cli-edxfzgah.js";
|
|
1267
1304
|
import {
|
|
1268
1305
|
createUserMergeJob2,
|
|
1269
1306
|
getUserMergeJob2,
|
|
@@ -1272,7 +1309,7 @@ import {
|
|
|
1272
1309
|
findFailedUserMergeJob2,
|
|
1273
1310
|
requeueUserMergeJob2,
|
|
1274
1311
|
runUserMergeJobs2
|
|
1275
|
-
} from "./cli-
|
|
1312
|
+
} from "./cli-njvpngc6.js";
|
|
1276
1313
|
import {
|
|
1277
1314
|
isCodexOAuthConfigKey
|
|
1278
1315
|
} from "./cli-j4bwnpkm.js";
|
|
@@ -1302,8 +1339,8 @@ import {
|
|
|
1302
1339
|
init_person_responder,
|
|
1303
1340
|
handleApprovalRequests,
|
|
1304
1341
|
init_approval_requests
|
|
1305
|
-
} from "./cli-
|
|
1306
|
-
import"./cli-
|
|
1342
|
+
} from "./cli-ejnhs815.js";
|
|
1343
|
+
import"./cli-q5n3deaf.js";
|
|
1307
1344
|
import {
|
|
1308
1345
|
RATING_MODEL_MAX_LENGTH,
|
|
1309
1346
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
@@ -1359,14 +1396,19 @@ import {
|
|
|
1359
1396
|
init_oauth_credential_bindings,
|
|
1360
1397
|
buildScriptCredentialBindingsWithFailures,
|
|
1361
1398
|
init_script_credential_broker,
|
|
1399
|
+
DEFAULT_SANDBOX_LIMITS,
|
|
1400
|
+
resolveSandboxIdentity,
|
|
1362
1401
|
buildSandboxedCommand,
|
|
1363
1402
|
sandboxSpawnEnv,
|
|
1364
1403
|
readStreamCapped,
|
|
1365
1404
|
init_sandboxed_process,
|
|
1405
|
+
readRunDirFile,
|
|
1406
|
+
init_native,
|
|
1366
1407
|
isExecutorAllowedByDeployment,
|
|
1367
1408
|
init_registry,
|
|
1368
1409
|
MIN_SCRIPT_WALL_CLOCK_MS,
|
|
1369
1410
|
MAX_SCRIPT_WALL_CLOCK_MS,
|
|
1411
|
+
DEFAULT_SCRIPT_RESOURCES,
|
|
1370
1412
|
init_types3,
|
|
1371
1413
|
HOST_VALIDATED_ARGS,
|
|
1372
1414
|
init_host_validated_args,
|
|
@@ -1399,7 +1441,7 @@ import {
|
|
|
1399
1441
|
init_typecheck,
|
|
1400
1442
|
parseSkillContent,
|
|
1401
1443
|
init_skill_parser
|
|
1402
|
-
} from "./cli-
|
|
1444
|
+
} from "./cli-v4z5v3jd.js";
|
|
1403
1445
|
import {
|
|
1404
1446
|
signalProcessGroup,
|
|
1405
1447
|
detachedProcessGroup,
|
|
@@ -1416,17 +1458,17 @@ import {
|
|
|
1416
1458
|
forceRefreshAuthorizationOrThrow,
|
|
1417
1459
|
forceRefreshTokenOrThrow,
|
|
1418
1460
|
init_ensure_token
|
|
1419
|
-
} from "./cli-
|
|
1461
|
+
} from "./cli-m0ea8ggd.js";
|
|
1420
1462
|
import {
|
|
1421
1463
|
PRIMITIVE_KINDS,
|
|
1422
1464
|
ObjectsError,
|
|
1423
1465
|
recordObjectVersion,
|
|
1424
1466
|
init_objects
|
|
1425
|
-
} from "./cli-
|
|
1467
|
+
} from "./cli-jgq9xptq.js";
|
|
1426
1468
|
import {
|
|
1427
1469
|
agentFsClientFor,
|
|
1428
1470
|
init_agent_fs_identity
|
|
1429
|
-
} from "./cli-
|
|
1471
|
+
} from "./cli-6ajyhxh7.js";
|
|
1430
1472
|
import {
|
|
1431
1473
|
FilesError,
|
|
1432
1474
|
normalizeFilesError,
|
|
@@ -1435,7 +1477,7 @@ import {
|
|
|
1435
1477
|
AgentFsProvider,
|
|
1436
1478
|
init_agent_fs_provider
|
|
1437
1479
|
} from "./cli-skd2c4ej.js";
|
|
1438
|
-
import"./cli-
|
|
1480
|
+
import"./cli-srq69pn1.js";
|
|
1439
1481
|
import {
|
|
1440
1482
|
automationIntegrationFixUrl,
|
|
1441
1483
|
preflightAutomation,
|
|
@@ -1457,7 +1499,7 @@ import {
|
|
|
1457
1499
|
definitionNodeIds,
|
|
1458
1500
|
validateDefinition,
|
|
1459
1501
|
init_definition2
|
|
1460
|
-
} from "./cli-
|
|
1502
|
+
} from "./cli-jcnc5ret.js";
|
|
1461
1503
|
import {
|
|
1462
1504
|
_fetchHolder,
|
|
1463
1505
|
CLIENT_ID,
|
|
@@ -1473,7 +1515,7 @@ import {
|
|
|
1473
1515
|
loadAllCodexOAuthSlots,
|
|
1474
1516
|
getValidCodexOAuth,
|
|
1475
1517
|
init_storage
|
|
1476
|
-
} from "./cli-
|
|
1518
|
+
} from "./cli-39t9d248.js";
|
|
1477
1519
|
import {
|
|
1478
1520
|
isMultiRuntimeEnabled,
|
|
1479
1521
|
init_multi_runtime2
|
|
@@ -1485,7 +1527,7 @@ import {
|
|
|
1485
1527
|
import {
|
|
1486
1528
|
createRuntimeProvider,
|
|
1487
1529
|
init_runtime_providers
|
|
1488
|
-
} from "./cli-
|
|
1530
|
+
} from "./cli-2zjxake1.js";
|
|
1489
1531
|
import {
|
|
1490
1532
|
require_content_type
|
|
1491
1533
|
} from "./cli-1jx0srjt.js";
|
|
@@ -1499,25 +1541,7 @@ import {
|
|
|
1499
1541
|
toSessionSharesState,
|
|
1500
1542
|
setSessionShares,
|
|
1501
1543
|
init_session_shares
|
|
1502
|
-
} from "./cli-
|
|
1503
|
-
import {
|
|
1504
|
-
isInvalidClientError,
|
|
1505
|
-
publicEndpointSsrfOptions,
|
|
1506
|
-
mcpOAuthSsrfOptions,
|
|
1507
|
-
discoverProtectedResourceMetadata,
|
|
1508
|
-
discoverAuthorizationServerMetadata,
|
|
1509
|
-
normalizeTokenEndpointAuthMethod,
|
|
1510
|
-
resolveAdvertisedTokenEndpointAuthMethod,
|
|
1511
|
-
authMethodForStoredClient,
|
|
1512
|
-
selectDcrTokenEndpointAuthMethod,
|
|
1513
|
-
registerClient,
|
|
1514
|
-
buildAuthorizeUrl,
|
|
1515
|
-
exchangeCodeForTokens,
|
|
1516
|
-
refreshMcpToken,
|
|
1517
|
-
revokeMcpToken,
|
|
1518
|
-
computeExpiresAt,
|
|
1519
|
-
init_mcp_wrapper
|
|
1520
|
-
} from "./cli-b9ygp1kz.js";
|
|
1544
|
+
} from "./cli-jwnac23b.js";
|
|
1521
1545
|
import"./cli-v41kn3cd.js";
|
|
1522
1546
|
import {
|
|
1523
1547
|
import_websocket,
|
|
@@ -1553,7 +1577,7 @@ import {
|
|
|
1553
1577
|
revokeAllAgentSessionTokens,
|
|
1554
1578
|
fingerprintApiKey,
|
|
1555
1579
|
init_users
|
|
1556
|
-
} from "./cli-
|
|
1580
|
+
} from "./cli-adzmmcvf.js";
|
|
1557
1581
|
import {
|
|
1558
1582
|
CORE_TOOLS,
|
|
1559
1583
|
init_tool_config
|
|
@@ -1566,7 +1590,7 @@ import {
|
|
|
1566
1590
|
providerAccountTelemetrySchema,
|
|
1567
1591
|
rateLimitReplacementSchema,
|
|
1568
1592
|
init_provider_account_telemetry
|
|
1569
|
-
} from "./cli-
|
|
1593
|
+
} from "./cli-cg1q8ymp.js";
|
|
1570
1594
|
import {
|
|
1571
1595
|
CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
|
|
1572
1596
|
CODEX_AUTH_WATCH_NAMESPACE,
|
|
@@ -1581,7 +1605,7 @@ import {
|
|
|
1581
1605
|
IDENTITY_FIELD_BUDGETS,
|
|
1582
1606
|
IdentityFieldBudgetError,
|
|
1583
1607
|
init_identity_field_budget
|
|
1584
|
-
} from "./cli-
|
|
1608
|
+
} from "./cli-wym6rxgt.js";
|
|
1585
1609
|
import {
|
|
1586
1610
|
getSlackConfiguration,
|
|
1587
1611
|
init_config5
|
|
@@ -1612,7 +1636,7 @@ import {
|
|
|
1612
1636
|
splitCredentialPool,
|
|
1613
1637
|
selectCredential,
|
|
1614
1638
|
init_credentials2
|
|
1615
|
-
} from "./cli-
|
|
1639
|
+
} from "./cli-wd7b5hgc.js";
|
|
1616
1640
|
import {
|
|
1617
1641
|
interpolate,
|
|
1618
1642
|
init_template2,
|
|
@@ -1622,7 +1646,7 @@ import {
|
|
|
1622
1646
|
resolveTemplate,
|
|
1623
1647
|
init_resolver,
|
|
1624
1648
|
init_session_templates
|
|
1625
|
-
} from "./cli-
|
|
1649
|
+
} from "./cli-24wervhz.js";
|
|
1626
1650
|
import {
|
|
1627
1651
|
getOpenRouterAttributionHeaders,
|
|
1628
1652
|
init_openrouter_base_url
|
|
@@ -1803,7 +1827,7 @@ import {
|
|
|
1803
1827
|
KvKeySchema,
|
|
1804
1828
|
KvEntrySchema,
|
|
1805
1829
|
init_types5
|
|
1806
|
-
} from "./cli-
|
|
1830
|
+
} from "./cli-tc165vrb.js";
|
|
1807
1831
|
import {
|
|
1808
1832
|
init_zod
|
|
1809
1833
|
} from "./cli-96234j5w.js";
|
|
@@ -1840,6 +1864,8 @@ import {
|
|
|
1840
1864
|
getAppUrl,
|
|
1841
1865
|
getLocalDevAppOrigins,
|
|
1842
1866
|
getMcpBaseUrl,
|
|
1867
|
+
setApiLoopbackBaseUrl,
|
|
1868
|
+
getScriptApiBaseUrl,
|
|
1843
1869
|
getPublicMcpBaseUrl,
|
|
1844
1870
|
getAgentFsLiveUrl,
|
|
1845
1871
|
agentFsFileRoute,
|
|
@@ -1847,7 +1873,7 @@ import {
|
|
|
1847
1873
|
isCombEnabled,
|
|
1848
1874
|
isAgentFsProxyEnabled,
|
|
1849
1875
|
init_constants3
|
|
1850
|
-
} from "./cli-
|
|
1876
|
+
} from "./cli-466jjrwe.js";
|
|
1851
1877
|
import {
|
|
1852
1878
|
parseEnvFlag,
|
|
1853
1879
|
isEnvFlagEnabled,
|
|
@@ -1856,7 +1882,7 @@ import {
|
|
|
1856
1882
|
import {
|
|
1857
1883
|
init_package,
|
|
1858
1884
|
package_default
|
|
1859
|
-
} from "./cli-
|
|
1885
|
+
} from "./cli-shyhb4t5.js";
|
|
1860
1886
|
import {
|
|
1861
1887
|
realtimeBus,
|
|
1862
1888
|
init_bus
|
|
@@ -1872,7 +1898,7 @@ import {
|
|
|
1872
1898
|
registerVolatileSecret,
|
|
1873
1899
|
registerEnvSecrets,
|
|
1874
1900
|
init_secret_scrubber
|
|
1875
|
-
} from "./cli-
|
|
1901
|
+
} from "./cli-r9d2tya0.js";
|
|
1876
1902
|
import {
|
|
1877
1903
|
__toESM
|
|
1878
1904
|
} from "./cli-242037k3.js";
|
|
@@ -3152,6 +3178,7 @@ function stopMcpOverflowSweep() {
|
|
|
3152
3178
|
}
|
|
3153
3179
|
|
|
3154
3180
|
// src/http/index.ts
|
|
3181
|
+
init_memory();
|
|
3155
3182
|
init_rbac_audit();
|
|
3156
3183
|
|
|
3157
3184
|
// src/be/runtime-pools/seed.ts
|
|
@@ -5743,16 +5770,18 @@ function connect(ws, auth, runtimeId) {
|
|
|
5743
5770
|
|
|
5744
5771
|
// src/script-workflows/supervisor.ts
|
|
5745
5772
|
init_db4();
|
|
5773
|
+
init_registry();
|
|
5746
5774
|
init_api_key();
|
|
5747
5775
|
init_secret_scrubber();
|
|
5748
5776
|
|
|
5749
5777
|
// src/script-workflows/executor.ts
|
|
5778
|
+
init_native();
|
|
5750
5779
|
init_response_limit();
|
|
5751
5780
|
init_process_group();
|
|
5752
5781
|
init_sandboxed_process();
|
|
5753
5782
|
import { randomUUID } from "node:crypto";
|
|
5754
5783
|
import { existsSync } from "node:fs";
|
|
5755
|
-
import { mkdtemp, rm } from "node:fs/promises";
|
|
5784
|
+
import { chown, mkdtemp, rm } from "node:fs/promises";
|
|
5756
5785
|
import { createServer as createServer2 } from "node:net";
|
|
5757
5786
|
import { join, resolve } from "node:path";
|
|
5758
5787
|
import { fileURLToPath } from "node:url";
|
|
@@ -6354,6 +6383,7 @@ class LocalProcessScriptExecutor {
|
|
|
6354
6383
|
const { run, apiKey } = input;
|
|
6355
6384
|
const baseUrl = input.baseUrl.replace(/\/$/, "");
|
|
6356
6385
|
const harnessPath = getScriptWorkflowHarnessPath();
|
|
6386
|
+
const runAs = resolveSandboxIdentity();
|
|
6357
6387
|
const tmpdir = await mkdtemp(join(process.env.TMPDIR ?? "/tmp", `script-workflow-${run.id}-`));
|
|
6358
6388
|
const sourceFile = `${tmpdir}/source.ts`;
|
|
6359
6389
|
const argsFile = `${tmpdir}/args.json`;
|
|
@@ -6529,7 +6559,7 @@ class LocalProcessScriptExecutor {
|
|
|
6529
6559
|
}
|
|
6530
6560
|
const harnessEnv = {
|
|
6531
6561
|
PATH: process.env.PATH ?? "/usr/bin:/bin",
|
|
6532
|
-
HOME: process.env.HOME ?? "/tmp",
|
|
6562
|
+
HOME: runAs ? tmpdir : process.env.HOME ?? "/tmp",
|
|
6533
6563
|
LANG: process.env.LANG ?? "C.UTF-8",
|
|
6534
6564
|
LC_ALL: process.env.LC_ALL ?? "C.UTF-8",
|
|
6535
6565
|
TMPDIR: tmpdir,
|
|
@@ -6544,7 +6574,11 @@ class LocalProcessScriptExecutor {
|
|
|
6544
6574
|
SCRIPT_RUN_CAPABILITY_TOKEN: capabilityToken
|
|
6545
6575
|
};
|
|
6546
6576
|
try {
|
|
6547
|
-
|
|
6577
|
+
if (runAs) {
|
|
6578
|
+
await Promise.all([tmpdir, sourceFile, argsFile, socketPath].map((path) => chown(path, runAs.uid, runAs.gid)));
|
|
6579
|
+
}
|
|
6580
|
+
const command = buildSandboxedCommand(["bun", "run", harnessPath], harnessEnv, DEFAULT_SANDBOX_LIMITS, "inline", runAs);
|
|
6581
|
+
proc = registerProcessGroup(Bun.spawn(command, {
|
|
6548
6582
|
cwd: tmpdir,
|
|
6549
6583
|
detached: detachedProcessGroup,
|
|
6550
6584
|
env: sandboxSpawnEnv(harnessEnv),
|
|
@@ -6569,6 +6603,10 @@ class LocalProcessScriptExecutor {
|
|
|
6569
6603
|
const stderrPromise = readStreamCapped(proc.stderr, MAX_STDERR_BYTES).then(({ text, truncated }) => truncated ? `${text}
|
|
6570
6604
|
…[stderr truncated]` : text, () => "");
|
|
6571
6605
|
const spawned = proc;
|
|
6606
|
+
const runDirCheck = {
|
|
6607
|
+
maxBytes: DEFAULT_SANDBOX_LIMITS.maxFileKb * 1024,
|
|
6608
|
+
...runAs ? { ownerUid: runAs.uid } : {}
|
|
6609
|
+
};
|
|
6572
6610
|
const exited = spawned.exited.then(async (processExitCode) => {
|
|
6573
6611
|
clearInterval(heartbeat);
|
|
6574
6612
|
await terminateProcessGroup(spawned.pid);
|
|
@@ -6579,12 +6617,15 @@ class LocalProcessScriptExecutor {
|
|
|
6579
6617
|
if (protocolFailure)
|
|
6580
6618
|
throw protocolFailure;
|
|
6581
6619
|
if (processExitCode !== 0) {
|
|
6582
|
-
const
|
|
6583
|
-
const failure =
|
|
6620
|
+
const errorText = await readRunDirFile(errorFile, runDirCheck);
|
|
6621
|
+
const failure = errorText === undefined ? undefined : JSON.parse(errorText);
|
|
6584
6622
|
const message = typeof failure?.message === "string" ? failure.message : `guest exited with ${processExitCode}`;
|
|
6585
6623
|
throw new Error(message);
|
|
6586
6624
|
}
|
|
6587
|
-
const
|
|
6625
|
+
const resultText = await readRunDirFile(resultFile, runDirCheck);
|
|
6626
|
+
if (resultText === undefined)
|
|
6627
|
+
throw new Error("guest wrote no readable result file");
|
|
6628
|
+
const output = JSON.parse(resultText);
|
|
6588
6629
|
await postStatus(run, baseUrl, apiKey, { status: "completed", output });
|
|
6589
6630
|
return { exitCode: 0, stderr };
|
|
6590
6631
|
} catch (error) {
|
|
@@ -6653,11 +6694,17 @@ var scriptExecutor = localProcessScriptExecutor;
|
|
|
6653
6694
|
function supervisorDisabled() {
|
|
6654
6695
|
return process.env.SCRIPT_RUN_SUPERVISOR_DISABLE === "true";
|
|
6655
6696
|
}
|
|
6697
|
+
var DURABLE_RUNS_NATIVE_REFUSED = 'Durable script runs use the native executor, which is not permitted when deployment SCRIPT_EXECUTOR="quickjs"';
|
|
6698
|
+
function durableScriptRunsAllowed() {
|
|
6699
|
+
return isExecutorAllowedByDeployment("native");
|
|
6700
|
+
}
|
|
6656
6701
|
async function startScriptRunProcess(run, baseUrl, apiKeyOverride) {
|
|
6657
6702
|
if (supervisorDisabled())
|
|
6658
6703
|
return;
|
|
6659
6704
|
if (managed.has(run.id))
|
|
6660
6705
|
return;
|
|
6706
|
+
if (!durableScriptRunsAllowed())
|
|
6707
|
+
throw new Error(DURABLE_RUNS_NATIVE_REFUSED);
|
|
6661
6708
|
const apiKey = apiKeyOverride ?? getApiKey();
|
|
6662
6709
|
if (!apiKey)
|
|
6663
6710
|
throw new Error("AGENT_SWARM_API_KEY is required to spawn script runs");
|
|
@@ -12574,6 +12621,7 @@ async function handleCodexOAuthKeepWarm(req, res, pathSegments) {
|
|
|
12574
12621
|
// src/http/comb.ts
|
|
12575
12622
|
init_zod();
|
|
12576
12623
|
init_audit_user();
|
|
12624
|
+
init_db4();
|
|
12577
12625
|
init_config4();
|
|
12578
12626
|
|
|
12579
12627
|
// src/comb/review-batch.ts
|
|
@@ -12756,12 +12804,16 @@ async function sendReviewBatch(input, deps = {}) {
|
|
|
12756
12804
|
...repairs.map((repair) => alreadySent(repair.id, repair.taskId))
|
|
12757
12805
|
]);
|
|
12758
12806
|
}
|
|
12759
|
-
const
|
|
12807
|
+
const parent = input.parent;
|
|
12808
|
+
const lead = parent?.agentId ? null : await getLeadAgent2();
|
|
12760
12809
|
leadState = !lead ? "none" : lead.status === "offline" ? "offline" : "online";
|
|
12761
12810
|
const task = await createTask(text, {
|
|
12762
|
-
agentId: lead?.id
|
|
12763
|
-
|
|
12764
|
-
|
|
12811
|
+
agentId: parent?.agentId || lead?.id || "",
|
|
12812
|
+
parentTaskId: parent?.id,
|
|
12813
|
+
inheritParentOutputSchema: parent?.agentCaller,
|
|
12814
|
+
routingAffinity: parent && !parent.agentCaller ? { capabilities: [] } : undefined,
|
|
12815
|
+
routingReason: parent?.agentId ? "continuity" : lead ? "skill" : undefined,
|
|
12816
|
+
routingSource: parent?.agentId || lead ? "engine_default" : undefined,
|
|
12765
12817
|
source: "comb",
|
|
12766
12818
|
taskType: "comb-review",
|
|
12767
12819
|
tags: ["comb"],
|
|
@@ -12794,7 +12846,13 @@ async function sendReviewBatch(input, deps = {}) {
|
|
|
12794
12846
|
if (taskId === null && repaired.length === 0) {
|
|
12795
12847
|
throw new ReviewBatchError(409, "Nothing to send", skipped);
|
|
12796
12848
|
}
|
|
12797
|
-
return taskId === null ? { taskId, sent: wonIds, skipped, repaired } : {
|
|
12849
|
+
return taskId === null ? { taskId, sent: wonIds, skipped, repaired } : {
|
|
12850
|
+
taskId,
|
|
12851
|
+
sent: wonIds,
|
|
12852
|
+
skipped,
|
|
12853
|
+
repaired,
|
|
12854
|
+
lead: input.parent?.agentId ? undefined : leadState
|
|
12855
|
+
};
|
|
12798
12856
|
}
|
|
12799
12857
|
async function mapLimited(items, limit, fn) {
|
|
12800
12858
|
const results = new Array(items.length);
|
|
@@ -12998,6 +13056,7 @@ init_errors2();
|
|
|
12998
13056
|
init_secret_scrubber();
|
|
12999
13057
|
init_request_principal();
|
|
13000
13058
|
init_route_def();
|
|
13059
|
+
init_session_access();
|
|
13001
13060
|
init_utils2();
|
|
13002
13061
|
var skippedSchema = object2({
|
|
13003
13062
|
id: string2(),
|
|
@@ -13019,10 +13078,11 @@ var reviewBatchRoute = route({
|
|
|
13019
13078
|
method: "post",
|
|
13020
13079
|
path: "/api/comb/review-batches",
|
|
13021
13080
|
pattern: ["api", "comb", "review-batches"],
|
|
13022
|
-
summary: "Send agent-fs comments to the swarm as one
|
|
13023
|
-
description: "Comb's 'Send to swarm'. The server reads each comment again from agent-fs with its bootstrap key, skips replies, resolved comments, and comments already sent, and creates
|
|
13081
|
+
summary: "Send agent-fs comments to the swarm as one task",
|
|
13082
|
+
description: "Comb's 'Send to swarm'. The server reads each comment again from agent-fs with its bootstrap key, skips replies, resolved comments, and comments already sent, and creates one task. An optional parentTaskId attaches it as a follow-up for the parent’s agent. Without a parent assignee it routes to the lead. Each sent comment gets a `[comb:sent task=<id>]` reply from the swarm service account. A comment is sent at most once. An optional `note` from the sender goes into the task text. When an earlier send lost its reply, the batch posts that reply again (`repaired`). Answers 404 while COMB_ENABLED is off.",
|
|
13024
13083
|
tags: ["Comb"],
|
|
13025
13084
|
body: object2({
|
|
13085
|
+
parentTaskId: uuid().optional(),
|
|
13026
13086
|
orgId: string2().min(1),
|
|
13027
13087
|
driveId: string2().min(1),
|
|
13028
13088
|
commentIds: array2(uuid()).min(1).max(REVIEW_BATCH_MAX),
|
|
@@ -13049,6 +13109,7 @@ var reviewBatchRoute = route({
|
|
|
13049
13109
|
schema: batchErrorSchema
|
|
13050
13110
|
}
|
|
13051
13111
|
},
|
|
13112
|
+
session: bodyTask("parentTaskId"),
|
|
13052
13113
|
rbac: { permission: "task.create.own" }
|
|
13053
13114
|
});
|
|
13054
13115
|
async function handleComb(req, res, pathSegments, queryParams, myAgentId) {
|
|
@@ -13067,8 +13128,18 @@ async function handleComb(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
13067
13128
|
return true;
|
|
13068
13129
|
}
|
|
13069
13130
|
try {
|
|
13131
|
+
const { parentTaskId, ...batch } = parsed.body;
|
|
13132
|
+
const parent = parentTaskId ? await getTaskById2(parentTaskId) : null;
|
|
13133
|
+
if (parentTaskId && !parent) {
|
|
13134
|
+
jsonError(res, "Parent task not found", 404);
|
|
13135
|
+
return true;
|
|
13136
|
+
}
|
|
13137
|
+
const sender = parent ? await agentFirstPrincipal(req, myAgentId) : null;
|
|
13138
|
+
if (parent && sender && await denyParentAttach2(req, res, myAgentId, parent, sender))
|
|
13139
|
+
return true;
|
|
13070
13140
|
const result = await sendReviewBatch({
|
|
13071
|
-
...
|
|
13141
|
+
...batch,
|
|
13142
|
+
parent: parent ? { id: parent.id, agentId: parent.agentId, agentCaller: sender?.kind === "agent" } : undefined,
|
|
13072
13143
|
requestedByUserId: await resolveHttpRequesterUserId(req, myAgentId)
|
|
13073
13144
|
});
|
|
13074
13145
|
reviewBatchRoute.respond(res, result.taskId === null ? 200 : 201, result);
|
|
@@ -13806,6 +13877,7 @@ declare module "swarm-extension" {
|
|
|
13806
13877
|
}
|
|
13807
13878
|
| undefined;
|
|
13808
13879
|
deferredAt?: string | undefined;
|
|
13880
|
+
deferredUntil?: string | undefined;
|
|
13809
13881
|
compactionCount?: number | undefined;
|
|
13810
13882
|
peakContextPercent?: number | undefined;
|
|
13811
13883
|
peakContextTokens?: number | undefined;
|
|
@@ -18793,6 +18865,7 @@ async function handleGitHubToken(req, res, pathSegments, myAgentId) {
|
|
|
18793
18865
|
|
|
18794
18866
|
// src/http/heartbeat.ts
|
|
18795
18867
|
init_zod();
|
|
18868
|
+
init_request_principal();
|
|
18796
18869
|
init_route_def();
|
|
18797
18870
|
init_utils2();
|
|
18798
18871
|
var HeartbeatActionResultSchema = object2({
|
|
@@ -18809,7 +18882,8 @@ var triggerSweep = route({
|
|
|
18809
18882
|
200: { description: "Sweep completed successfully", schema: HeartbeatActionResultSchema },
|
|
18810
18883
|
401: { description: "Unauthorized" }
|
|
18811
18884
|
},
|
|
18812
|
-
auth: { apiKey: true }
|
|
18885
|
+
auth: { apiKey: true },
|
|
18886
|
+
rbac: { permission: "heartbeat.trigger" }
|
|
18813
18887
|
});
|
|
18814
18888
|
var triggerChecklist = route({
|
|
18815
18889
|
method: "post",
|
|
@@ -18824,13 +18898,16 @@ var triggerChecklist = route({
|
|
|
18824
18898
|
},
|
|
18825
18899
|
401: { description: "Unauthorized" }
|
|
18826
18900
|
},
|
|
18827
|
-
auth: { apiKey: true }
|
|
18901
|
+
auth: { apiKey: true },
|
|
18902
|
+
rbac: { permission: "heartbeat.trigger" }
|
|
18828
18903
|
});
|
|
18829
18904
|
async function handleHeartbeat(req, res, pathSegments) {
|
|
18830
18905
|
if (triggerSweep.match(req.method, pathSegments)) {
|
|
18831
18906
|
const parsed = await triggerSweep.parse(req, res, pathSegments, new URLSearchParams);
|
|
18832
18907
|
if (!parsed)
|
|
18833
18908
|
return true;
|
|
18909
|
+
if (await refuseAgentTokenWithout(req, res, "heartbeat.trigger"))
|
|
18910
|
+
return true;
|
|
18834
18911
|
try {
|
|
18835
18912
|
await runHeartbeatSweep2();
|
|
18836
18913
|
triggerSweep.respond(res, 200, { success: true, message: "Heartbeat sweep completed" });
|
|
@@ -18844,6 +18921,8 @@ async function handleHeartbeat(req, res, pathSegments) {
|
|
|
18844
18921
|
const parsed = await triggerChecklist.parse(req, res, pathSegments, new URLSearchParams);
|
|
18845
18922
|
if (!parsed)
|
|
18846
18923
|
return true;
|
|
18924
|
+
if (await refuseAgentTokenWithout(req, res, "heartbeat.trigger"))
|
|
18925
|
+
return true;
|
|
18847
18926
|
try {
|
|
18848
18927
|
await checkHeartbeatChecklist2();
|
|
18849
18928
|
triggerChecklist.respond(res, 200, {
|
|
@@ -19664,6 +19743,7 @@ var handleIntegrations = createIntegrationsHandler();
|
|
|
19664
19743
|
// src/http/kv.ts
|
|
19665
19744
|
init_zod();
|
|
19666
19745
|
init_db4();
|
|
19746
|
+
init_kv_limits();
|
|
19667
19747
|
init_kv_overflow();
|
|
19668
19748
|
init_kv_reserved_namespaces();
|
|
19669
19749
|
init_kv_view();
|
|
@@ -19672,7 +19752,6 @@ init_context_key();
|
|
|
19672
19752
|
init_types5();
|
|
19673
19753
|
init_route_def();
|
|
19674
19754
|
init_utils2();
|
|
19675
|
-
var MAX_KV_BODY_BYTES = 2 * 1024 * 1024;
|
|
19676
19755
|
var MAX_KV_LIST_LIMIT = 1000;
|
|
19677
19756
|
var kvSetBodySchema = object2({
|
|
19678
19757
|
value: unknown(),
|
|
@@ -20164,6 +20243,7 @@ async function sendGet(req, res, namespace, key, query, respond) {
|
|
|
20164
20243
|
jsonError(res, "not found", 404);
|
|
20165
20244
|
return true;
|
|
20166
20245
|
}
|
|
20246
|
+
entry.value = scrubReservedRead(namespace, entry.value);
|
|
20167
20247
|
if (hasKvViewArgs(query)) {
|
|
20168
20248
|
const view = resolveKvView(entry.value, query);
|
|
20169
20249
|
if (!view.ok) {
|
|
@@ -20240,7 +20320,10 @@ async function sendList(req, res, namespace, query, respond) {
|
|
|
20240
20320
|
const limit = Math.min(query.limit ?? 100, MAX_KV_LIST_LIMIT);
|
|
20241
20321
|
const offset = query.offset ?? 0;
|
|
20242
20322
|
const prefix = query.prefix && query.prefix.length > 0 ? query.prefix : undefined;
|
|
20243
|
-
const entries = await listKv2(namespace, { prefix, limit, offset })
|
|
20323
|
+
const entries = (await listKv2(namespace, { prefix, limit, offset })).map((entry) => ({
|
|
20324
|
+
...entry,
|
|
20325
|
+
value: scrubReservedRead(namespace, entry.value)
|
|
20326
|
+
}));
|
|
20244
20327
|
const total = await countKv2(namespace, { prefix });
|
|
20245
20328
|
respond(res, 200, { entries, total, namespace });
|
|
20246
20329
|
return true;
|
|
@@ -21888,6 +21971,7 @@ init_ensure_mcp_token();
|
|
|
21888
21971
|
init_mcp_wrapper();
|
|
21889
21972
|
init_types5();
|
|
21890
21973
|
init_constants3();
|
|
21974
|
+
init_request_principal();
|
|
21891
21975
|
init_route_def();
|
|
21892
21976
|
init_utils2();
|
|
21893
21977
|
function callbackRedirectUri() {
|
|
@@ -21979,6 +22063,15 @@ async function discoverForMcp(resourceUrl) {
|
|
|
21979
22063
|
if (!issuer)
|
|
21980
22064
|
return null;
|
|
21981
22065
|
const as = await discoverAuthorizationServerMetadata(issuer);
|
|
22066
|
+
for (const endpoint of [
|
|
22067
|
+
as.authorization_endpoint,
|
|
22068
|
+
as.token_endpoint,
|
|
22069
|
+
as.registration_endpoint,
|
|
22070
|
+
as.revocation_endpoint
|
|
22071
|
+
]) {
|
|
22072
|
+
if (endpoint)
|
|
22073
|
+
assertUrlSafe(endpoint, mcpOAuthSsrfOptions());
|
|
22074
|
+
}
|
|
21982
22075
|
return {
|
|
21983
22076
|
resourceUrl: prmd.resource ?? resourceUrl,
|
|
21984
22077
|
authorizationServerIssuer: as.issuer,
|
|
@@ -22112,6 +22205,7 @@ var refreshRoute = route({
|
|
|
22112
22205
|
tags: ["MCP OAuth"],
|
|
22113
22206
|
auth: { apiKey: true },
|
|
22114
22207
|
params: object2({ mcpServerId: string2() }),
|
|
22208
|
+
rbac: { permission: "mcp-oauth.manage" },
|
|
22115
22209
|
body: object2({
|
|
22116
22210
|
userId: string2().optional()
|
|
22117
22211
|
}).optional(),
|
|
@@ -22130,6 +22224,7 @@ var disconnectRoute = route({
|
|
|
22130
22224
|
tags: ["MCP OAuth"],
|
|
22131
22225
|
auth: { apiKey: true },
|
|
22132
22226
|
params: object2({ mcpServerId: string2() }),
|
|
22227
|
+
rbac: { permission: "mcp-oauth.manage" },
|
|
22133
22228
|
query: object2({ userId: string2().optional() }),
|
|
22134
22229
|
responses: {
|
|
22135
22230
|
200: { description: "Token revoked/deleted", schema: OkResponseSchema },
|
|
@@ -22144,6 +22239,7 @@ var manualClientRoute = route({
|
|
|
22144
22239
|
tags: ["MCP OAuth"],
|
|
22145
22240
|
auth: { apiKey: true },
|
|
22146
22241
|
params: object2({ mcpServerId: string2() }),
|
|
22242
|
+
rbac: { permission: "mcp-oauth.manage" },
|
|
22147
22243
|
body: object2({
|
|
22148
22244
|
clientId: string2().min(1),
|
|
22149
22245
|
clientSecret: string2().optional(),
|
|
@@ -22490,6 +22586,8 @@ async function handleMcpOAuth(req, res, pathSegments, queryParams) {
|
|
|
22490
22586
|
const parsed = await refreshRoute.parse(req, res, pathSegments, queryParams);
|
|
22491
22587
|
if (!parsed)
|
|
22492
22588
|
return true;
|
|
22589
|
+
if (await refuseAgentTokenWithout(req, res, "mcp-oauth.manage"))
|
|
22590
|
+
return true;
|
|
22493
22591
|
const userId = parsed.body?.userId ?? null;
|
|
22494
22592
|
const existing = await getMcpOAuthToken(parsed.params.mcpServerId, userId);
|
|
22495
22593
|
if (!existing || !existing.refreshToken) {
|
|
@@ -22531,6 +22629,8 @@ async function handleMcpOAuth(req, res, pathSegments, queryParams) {
|
|
|
22531
22629
|
const parsed = await disconnectRoute.parse(req, res, pathSegments, queryParams);
|
|
22532
22630
|
if (!parsed)
|
|
22533
22631
|
return true;
|
|
22632
|
+
if (await refuseAgentTokenWithout(req, res, "mcp-oauth.manage"))
|
|
22633
|
+
return true;
|
|
22534
22634
|
const userId = parsed.query.userId ?? null;
|
|
22535
22635
|
const token = await getMcpOAuthToken(parsed.params.mcpServerId, userId);
|
|
22536
22636
|
if (!token) {
|
|
@@ -22560,6 +22660,8 @@ async function handleMcpOAuth(req, res, pathSegments, queryParams) {
|
|
|
22560
22660
|
const parsed = await manualClientRoute.parse(req, res, pathSegments, queryParams);
|
|
22561
22661
|
if (!parsed)
|
|
22562
22662
|
return true;
|
|
22663
|
+
if (await refuseAgentTokenWithout(req, res, "mcp-oauth.manage"))
|
|
22664
|
+
return true;
|
|
22563
22665
|
const server = await getMcpOrError(res, parsed.params.mcpServerId);
|
|
22564
22666
|
if (!server)
|
|
22565
22667
|
return true;
|
|
@@ -22643,6 +22745,7 @@ init_mcp_server_checked_update();
|
|
|
22643
22745
|
init_mcp_server_stdio_gate();
|
|
22644
22746
|
init_rbac_audit();
|
|
22645
22747
|
init_rbac_roles();
|
|
22748
|
+
init_swarm_config_guard();
|
|
22646
22749
|
init_ensure_mcp_token();
|
|
22647
22750
|
init_mcp_wrapper();
|
|
22648
22751
|
init_rbac();
|
|
@@ -22817,7 +22920,10 @@ var getAgentMcpServersRoute = route({
|
|
|
22817
22920
|
}
|
|
22818
22921
|
});
|
|
22819
22922
|
async function canResolveMcpSecretsForHttpUser(req) {
|
|
22820
|
-
const
|
|
22923
|
+
const auth = getRequestAuth(req);
|
|
22924
|
+
if (auth?.kind === "agent" && auth.tokenKind === "task")
|
|
22925
|
+
return false;
|
|
22926
|
+
const userId = authUserId(auth);
|
|
22821
22927
|
if (!userId)
|
|
22822
22928
|
return true;
|
|
22823
22929
|
if (!isRbacEnabled())
|
|
@@ -22877,7 +22983,7 @@ async function handleMcpServers(req, res, pathSegments, queryParams) {
|
|
|
22877
22983
|
jsonError(res, "Forbidden: admission: missing permission 'mcp-server.read.secrets'", 403);
|
|
22878
22984
|
return true;
|
|
22879
22985
|
}
|
|
22880
|
-
const configs = await getResolvedConfig2(parsed.params.id);
|
|
22986
|
+
const configs = (await getResolvedConfig2(parsed.params.id)).filter((c) => !isApiOnlyConfigKey(c.key) && !isInternalConfigKey(c.key) && !isCodexOAuthConfigKey(c.key));
|
|
22881
22987
|
const configMap = new Map(configs.map((c) => [c.key, c.value]));
|
|
22882
22988
|
const serversWithSecrets = await Promise.all(servers.map(async (server) => {
|
|
22883
22989
|
const resolvedEnv = {};
|
|
@@ -22966,6 +23072,12 @@ async function handleMcpServers(req, res, pathSegments, queryParams) {
|
|
|
22966
23072
|
jsonError(res, "MCP server not found", 404);
|
|
22967
23073
|
return true;
|
|
22968
23074
|
}
|
|
23075
|
+
if (parsed.body.agentId !== singleHeader3(req, "x-agent-id") && await refuseAgentTokenWithout(req, res, "mcp-server.install.any", {
|
|
23076
|
+
kind: "agent",
|
|
23077
|
+
agentId: parsed.body.agentId
|
|
23078
|
+
})) {
|
|
23079
|
+
return true;
|
|
23080
|
+
}
|
|
22969
23081
|
try {
|
|
22970
23082
|
const agentMcpServer = await installMcpServer2(parsed.body.agentId, parsed.params.id);
|
|
22971
23083
|
installMcpServerRoute.respond(res, 200, { agentMcpServer });
|
|
@@ -22978,6 +23090,12 @@ async function handleMcpServers(req, res, pathSegments, queryParams) {
|
|
|
22978
23090
|
const parsed = await uninstallMcpServerRoute.parse(req, res, pathSegments, queryParams);
|
|
22979
23091
|
if (!parsed)
|
|
22980
23092
|
return true;
|
|
23093
|
+
if (parsed.params.agentId !== singleHeader3(req, "x-agent-id") && await refuseAgentTokenWithout(req, res, "mcp-server.uninstall.any", {
|
|
23094
|
+
kind: "agent",
|
|
23095
|
+
agentId: parsed.params.agentId
|
|
23096
|
+
})) {
|
|
23097
|
+
return true;
|
|
23098
|
+
}
|
|
22981
23099
|
const removed = await uninstallMcpServer2(parsed.params.agentId, parsed.params.id);
|
|
22982
23100
|
uninstallMcpServerRoute.respond(res, 200, { success: removed });
|
|
22983
23101
|
return true;
|
|
@@ -23107,6 +23225,13 @@ async function handleMcpServers(req, res, pathSegments, queryParams) {
|
|
|
23107
23225
|
const parsed = await deleteMcpServerRoute.parse(req, res, pathSegments, queryParams);
|
|
23108
23226
|
if (!parsed)
|
|
23109
23227
|
return true;
|
|
23228
|
+
const existing = await getMcpServerById2(parsed.params.id);
|
|
23229
|
+
if (existing && await refuseAgentTokenWithout(req, res, "mcp-server.delete.any", {
|
|
23230
|
+
kind: "owned",
|
|
23231
|
+
ownerAgentId: existing.ownerAgentId
|
|
23232
|
+
})) {
|
|
23233
|
+
return true;
|
|
23234
|
+
}
|
|
23110
23235
|
const result = await deleteMcpServer2(parsed.params.id);
|
|
23111
23236
|
if (!result.deleted) {
|
|
23112
23237
|
jsonError(res, "MCP server not found", 404);
|
|
@@ -24640,6 +24765,16 @@ async function handleMemory(req, res, pathSegments, callerAgentId) {
|
|
|
24640
24765
|
contextKey
|
|
24641
24766
|
} = parsed.body;
|
|
24642
24767
|
const memoryAgentId = agentId ?? (scope === "agent" ? myAgentId : undefined);
|
|
24768
|
+
const auth = getRequestAuth(req);
|
|
24769
|
+
if (auth?.kind === "agent" && memoryAgentId !== undefined && memoryAgentId !== auth.agentId && !can({
|
|
24770
|
+
principal: await ingestPrincipal(req, myAgentId),
|
|
24771
|
+
verb: "memory.edit.any",
|
|
24772
|
+
resource: { kind: "owned", ownerAgentId: memoryAgentId },
|
|
24773
|
+
source: "http"
|
|
24774
|
+
}).allow) {
|
|
24775
|
+
jsonError(res, "An agent token can index memory only for its own agent", 403);
|
|
24776
|
+
return true;
|
|
24777
|
+
}
|
|
24643
24778
|
if (source === "session_summary" && sourceTaskId) {
|
|
24644
24779
|
const sourceTask = await getTaskById2(sourceTaskId);
|
|
24645
24780
|
if (sourceTask && !shouldPersistAutomaticTaskMemory(sourceTask, persistMemory)) {
|
|
@@ -25071,6 +25206,15 @@ async function handleMemory(req, res, pathSegments, callerAgentId) {
|
|
|
25071
25206
|
const parsed = await reEmbedMemory.parse(req, res, pathSegments, new URLSearchParams);
|
|
25072
25207
|
if (!parsed)
|
|
25073
25208
|
return true;
|
|
25209
|
+
const reembedDecision = can({
|
|
25210
|
+
principal: await requestPrincipal(req, myAgentId, { unauthenticatedFallback: "operator" }),
|
|
25211
|
+
verb: "memory.reembed",
|
|
25212
|
+
source: "http"
|
|
25213
|
+
});
|
|
25214
|
+
if (!reembedDecision.allow) {
|
|
25215
|
+
jsonError(res, `Forbidden: ${reembedDecision.reason}`, 403);
|
|
25216
|
+
return true;
|
|
25217
|
+
}
|
|
25074
25218
|
const { agentId, batchSize } = parsed.body;
|
|
25075
25219
|
const store = getMemoryStore2();
|
|
25076
25220
|
const provider = getEmbeddingProvider2();
|
|
@@ -25293,6 +25437,7 @@ init_zod();
|
|
|
25293
25437
|
init_db4();
|
|
25294
25438
|
init_version2();
|
|
25295
25439
|
init_types5();
|
|
25440
|
+
init_secret_scrubber();
|
|
25296
25441
|
init_db_query();
|
|
25297
25442
|
init_route_def();
|
|
25298
25443
|
init_utils2();
|
|
@@ -25342,7 +25487,7 @@ function resolveVariableOptions(metric) {
|
|
|
25342
25487
|
}
|
|
25343
25488
|
const options = resolveVariableOptionValues(variable);
|
|
25344
25489
|
optionsByKey[variable.key] = options;
|
|
25345
|
-
return { ...variable, options };
|
|
25490
|
+
return { ...variable, options: scrubObject(options) };
|
|
25346
25491
|
});
|
|
25347
25492
|
return { variables, optionsByKey };
|
|
25348
25493
|
}
|
|
@@ -25401,7 +25546,7 @@ function runMetricWidget(widget, variables) {
|
|
|
25401
25546
|
widget,
|
|
25402
25547
|
result: {
|
|
25403
25548
|
...result,
|
|
25404
|
-
rows: result.rows.map((row) => Object.fromEntries(result.columns.map((column, index) => [column, row[index]]))),
|
|
25549
|
+
rows: scrubObject(result.rows.map((row) => Object.fromEntries(result.columns.map((column, index) => [column, row[index]])))),
|
|
25405
25550
|
truncated: result.total > result.rows.length,
|
|
25406
25551
|
maxRows
|
|
25407
25552
|
}
|
|
@@ -25416,7 +25561,7 @@ function runMetric(metric, providedVariables = {}) {
|
|
|
25416
25561
|
...metric,
|
|
25417
25562
|
definition: { ...metric.definition, variables: resolved.variables }
|
|
25418
25563
|
},
|
|
25419
|
-
variables,
|
|
25564
|
+
variables: scrubObject(variables),
|
|
25420
25565
|
widgets,
|
|
25421
25566
|
result: widgets[0]?.result
|
|
25422
25567
|
};
|
|
@@ -27683,6 +27828,7 @@ var StatusCombSchema = object2({
|
|
|
27683
27828
|
live_url: string2(),
|
|
27684
27829
|
org_id: string2().nullable(),
|
|
27685
27830
|
drive_id: string2().nullable(),
|
|
27831
|
+
review_follow_ups: boolean(),
|
|
27686
27832
|
service_user_id: string2().nullable()
|
|
27687
27833
|
});
|
|
27688
27834
|
var StatusTelemetrySchema = object2({
|
|
@@ -28121,6 +28267,7 @@ function getCombStatus(serviceUserId) {
|
|
|
28121
28267
|
live_url: comb.liveUrl,
|
|
28122
28268
|
org_id: comb.orgId,
|
|
28123
28269
|
drive_id: comb.driveId,
|
|
28270
|
+
review_follow_ups: comb.enabled,
|
|
28124
28271
|
service_user_id: comb.enabled ? serviceUserId : null
|
|
28125
28272
|
};
|
|
28126
28273
|
}
|
|
@@ -28453,7 +28600,8 @@ async function handleMemoryProbe(body) {
|
|
|
28453
28600
|
defaultHeaders: getOpenRouterAttributionHeaders(endpoint.toString()),
|
|
28454
28601
|
timeout: 15000,
|
|
28455
28602
|
maxRetries: 0,
|
|
28456
|
-
fetchOptions: { redirect: "manual" }
|
|
28603
|
+
fetchOptions: { redirect: "manual" },
|
|
28604
|
+
fetch: configuredEndpoint ? undefined : createSsrfGuardedFetch(publicEndpointSsrfOptions())
|
|
28457
28605
|
});
|
|
28458
28606
|
const response = await client.embeddings.create({
|
|
28459
28607
|
model,
|
|
@@ -28482,6 +28630,14 @@ async function handleMemoryProbe(body) {
|
|
|
28482
28630
|
});
|
|
28483
28631
|
return { ok: true, dimensions, latencyMs };
|
|
28484
28632
|
} catch (error) {
|
|
28633
|
+
if (error instanceof Error && error.cause instanceof EgressDeniedError) {
|
|
28634
|
+
return {
|
|
28635
|
+
ok: false,
|
|
28636
|
+
latencyMs: 0,
|
|
28637
|
+
error: "The endpoint URL is not allowed.",
|
|
28638
|
+
errorClass: "network"
|
|
28639
|
+
};
|
|
28640
|
+
}
|
|
28485
28641
|
const errorClass = classifyMemoryError(error);
|
|
28486
28642
|
const latencyMs = Math.max(0, Math.round(performance.now() - started));
|
|
28487
28643
|
const message = memoryErrorMessage(errorClass, memoryErrorStatus(error));
|
|
@@ -28772,12 +28928,46 @@ init_asset_key_auth();
|
|
|
28772
28928
|
init_audit_user();
|
|
28773
28929
|
init_db4();
|
|
28774
28930
|
init_model_profiles();
|
|
28931
|
+
|
|
28932
|
+
// src/be/db/task-idempotency.ts
|
|
28933
|
+
init_request_auth_context();
|
|
28934
|
+
init_runtime2();
|
|
28935
|
+
init_workflow_idempotency();
|
|
28936
|
+
async function findAcceptedTaskCreate(claim) {
|
|
28937
|
+
const row = await getDbClient2().get("SELECT requestFingerprint, taskId FROM task_idempotency_keys WHERE principal = ? AND keyHash = ?", [claim.principal, sha256(claim.key)]);
|
|
28938
|
+
return row ? { fingerprint: row.requestFingerprint, taskId: row.taskId } : null;
|
|
28939
|
+
}
|
|
28940
|
+
async function recordAcceptedTaskCreate(claim, taskId) {
|
|
28941
|
+
const actor = getCurrentRequestUserId() ?? null;
|
|
28942
|
+
try {
|
|
28943
|
+
await getDbClient2().run(`INSERT INTO task_idempotency_keys
|
|
28944
|
+
(id, principal, keyHash, requestFingerprint, taskId, createdAt, created_by, updated_by)
|
|
28945
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
28946
|
+
crypto.randomUUID(),
|
|
28947
|
+
claim.principal,
|
|
28948
|
+
sha256(claim.key),
|
|
28949
|
+
claim.fingerprint,
|
|
28950
|
+
taskId,
|
|
28951
|
+
new Date().toISOString(),
|
|
28952
|
+
actor,
|
|
28953
|
+
actor
|
|
28954
|
+
]);
|
|
28955
|
+
} catch (err) {
|
|
28956
|
+
if (err instanceof Error && err.message.includes("UNIQUE constraint failed")) {
|
|
28957
|
+
throw new IdempotencyKeyTakenError;
|
|
28958
|
+
}
|
|
28959
|
+
throw err;
|
|
28960
|
+
}
|
|
28961
|
+
}
|
|
28962
|
+
|
|
28963
|
+
// src/http/tasks.ts
|
|
28964
|
+
init_workflow_idempotency();
|
|
28775
28965
|
init_model_validation2();
|
|
28776
28966
|
init_rbac_roles();
|
|
28777
28967
|
init_session_shares();
|
|
28778
28968
|
init_steering2();
|
|
28779
28969
|
init_task_citations2();
|
|
28780
|
-
|
|
28970
|
+
init_task_ui_spec2();
|
|
28781
28971
|
init_rbac();
|
|
28782
28972
|
init_session_mirror();
|
|
28783
28973
|
init_context_key();
|
|
@@ -28793,6 +28983,7 @@ init_request_auth_context();
|
|
|
28793
28983
|
init_secret_scrubber();
|
|
28794
28984
|
init_vcs_repo_match();
|
|
28795
28985
|
init_config();
|
|
28986
|
+
init_idempotency_key();
|
|
28796
28987
|
|
|
28797
28988
|
// src/http/list-total-cache.ts
|
|
28798
28989
|
var LIST_TOTAL_TTL_MS = 30000;
|
|
@@ -29080,6 +29271,7 @@ var createTask = route({
|
|
|
29080
29271
|
rbac: { permission: "task.create.own" },
|
|
29081
29272
|
summary: "Create a new task",
|
|
29082
29273
|
tags: ["Tasks"],
|
|
29274
|
+
headers: idempotencyKeyHeader("creates one task (a replay returns that task as it is now)"),
|
|
29083
29275
|
body: object2({
|
|
29084
29276
|
task: string2().min(1),
|
|
29085
29277
|
agentId: string2().optional(),
|
|
@@ -29116,10 +29308,12 @@ var createTask = route({
|
|
|
29116
29308
|
responses: {
|
|
29117
29309
|
201: { description: "Task created", schema: AgentTaskSchema },
|
|
29118
29310
|
400: {
|
|
29119
|
-
description: "Validation error, an unknown `model` (set `allowCustomModel` to store a custom id), a `vcsRepo` that is not exactly one registered repo,
|
|
29311
|
+
description: "Validation error, an unknown `model` (set `allowCustomModel` to store a custom id), a `vcsRepo` that is not exactly one registered repo, agentId/offeredTo targets an extension identity, or a malformed Idempotency-Key"
|
|
29120
29312
|
},
|
|
29313
|
+
409: { description: "Idempotency-Key was already used for a different request" },
|
|
29314
|
+
410: { description: "The task created under this Idempotency-Key was deleted" },
|
|
29121
29315
|
403: {
|
|
29122
|
-
description: "Parent/session access denied, unauthorized chat-thread binding,
|
|
29316
|
+
description: "Parent/session access denied, unauthorized chat-thread binding, routing requirements reject the assignment, or an Idempotency-Key replay of a task whose session the caller can no longer read"
|
|
29123
29317
|
},
|
|
29124
29318
|
422: {
|
|
29125
29319
|
description: "Task creation blocked by an extension",
|
|
@@ -29716,9 +29910,35 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29716
29910
|
return true;
|
|
29717
29911
|
}
|
|
29718
29912
|
if (createTask.match(req.method, pathSegments)) {
|
|
29913
|
+
const idempotency = readIdempotencyKey(req, res, myAgentId);
|
|
29914
|
+
if (idempotency === null)
|
|
29915
|
+
return true;
|
|
29719
29916
|
const parsed = await createTask.parse(req, res, pathSegments, queryParams);
|
|
29720
29917
|
if (!parsed)
|
|
29721
29918
|
return true;
|
|
29919
|
+
const claim = idempotency && {
|
|
29920
|
+
...idempotency,
|
|
29921
|
+
fingerprint: requestFingerprint("task.create", parsed.body)
|
|
29922
|
+
};
|
|
29923
|
+
const replayCreate = async () => {
|
|
29924
|
+
const accepted = claim && await findAcceptedTaskCreate(claim);
|
|
29925
|
+
if (!accepted)
|
|
29926
|
+
return false;
|
|
29927
|
+
const task = accepted.fingerprint === claim.fingerprint ? await getTaskById2(accepted.taskId) : null;
|
|
29928
|
+
if (accepted.fingerprint !== claim.fingerprint) {
|
|
29929
|
+
jsonError(res, "Idempotency-Key was already used for a different request", 409);
|
|
29930
|
+
} else if (!task) {
|
|
29931
|
+
jsonError(res, "The task this Idempotency-Key created was deleted", 410);
|
|
29932
|
+
} else if (!await canReadSession2(req, myAgentId, task.id)) {
|
|
29933
|
+
jsonError(res, SESSION_READ_DENIED2, 403);
|
|
29934
|
+
} else {
|
|
29935
|
+
res.setHeader(IDEMPOTENT_REPLAYED_HEADER, "true");
|
|
29936
|
+
createTask.respond(res, 201, task);
|
|
29937
|
+
}
|
|
29938
|
+
return true;
|
|
29939
|
+
};
|
|
29940
|
+
if (await replayCreate())
|
|
29941
|
+
return true;
|
|
29722
29942
|
const trustedUserId = await resolveHttpRequesterUserId(req, myAgentId);
|
|
29723
29943
|
const requestedByUserId = await resolveTaskRequester(req, myAgentId, parsed.body.requestedByUserId, trustedUserId);
|
|
29724
29944
|
let defaultAgentId = parsed.body.agentId || undefined;
|
|
@@ -29786,7 +30006,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29786
30006
|
throw error;
|
|
29787
30007
|
}
|
|
29788
30008
|
try {
|
|
29789
|
-
const
|
|
30009
|
+
const prepared = await prepareTaskWithSiblingAwareness(parsed.body.task, {
|
|
29790
30010
|
key: assetKey,
|
|
29791
30011
|
agentId: defaultAgentId,
|
|
29792
30012
|
routingReason: parsed.body.routingReason ?? (defaultAgentId ? parentTask?.agentId === defaultAgentId ? "continuity" : "skill" : undefined),
|
|
@@ -29815,6 +30035,13 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29815
30035
|
effort: parsed.body.effort,
|
|
29816
30036
|
profile: parsed.body.profile
|
|
29817
30037
|
}, { origin: "rest", allowCustomModel: parsed.body.allowCustomModel });
|
|
30038
|
+
const task = claim ? await getDbClient2().transaction(async () => {
|
|
30039
|
+
if (await findAcceptedTaskCreate(claim))
|
|
30040
|
+
throw new IdempotencyKeyTakenError;
|
|
30041
|
+
const created = await createTaskExtended2(prepared.description, prepared.options);
|
|
30042
|
+
await recordAcceptedTaskCreate(claim, created.id);
|
|
30043
|
+
return created;
|
|
30044
|
+
}) : await createTaskExtended2(prepared.description, prepared.options);
|
|
29818
30045
|
ensure({
|
|
29819
30046
|
id: "created",
|
|
29820
30047
|
flow: "task",
|
|
@@ -29835,6 +30062,8 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29835
30062
|
}
|
|
29836
30063
|
createTask.respond(res, 201, task);
|
|
29837
30064
|
} catch (error) {
|
|
30065
|
+
if (error instanceof IdempotencyKeyTakenError && await replayCreate())
|
|
30066
|
+
return true;
|
|
29838
30067
|
if (error instanceof TaskRoutingAuthorizationError) {
|
|
29839
30068
|
console.warn("[HTTP] Task assignment rejected:", scrubSecrets(JSON.stringify({
|
|
29840
30069
|
parentTaskId: parsed.body.parentTaskId,
|
|
@@ -29891,7 +30120,25 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29891
30120
|
const parsed = await updateSession.parse(req, res, pathSegments, queryParams);
|
|
29892
30121
|
if (!parsed)
|
|
29893
30122
|
return true;
|
|
29894
|
-
const
|
|
30123
|
+
const auth = getRequestAuth(req);
|
|
30124
|
+
const task = await getDbClient2().transaction(async () => {
|
|
30125
|
+
if (auth?.kind === "agent") {
|
|
30126
|
+
if (auth.taskId !== null && auth.taskId !== parsed.params.id)
|
|
30127
|
+
return "forbidden";
|
|
30128
|
+
const existing = await getTaskById2(parsed.params.id);
|
|
30129
|
+
if (!existing)
|
|
30130
|
+
return null;
|
|
30131
|
+
const offerOpen = existing.status === "offered" || existing.status === "reviewing";
|
|
30132
|
+
const holder = offerOpen ? existing.offeredTo : existing.agentId;
|
|
30133
|
+
if (holder !== auth.agentId)
|
|
30134
|
+
return "forbidden";
|
|
30135
|
+
}
|
|
30136
|
+
return await updateTaskClaudeSessionId2(parsed.params.id, parsed.body.claudeSessionId, parsed.body.provider, parsed.body.providerMeta, parsed.body.model, "harnessVariant" in parsed.body ? parsed.body.harnessVariant : undefined, "harnessVariantMeta" in parsed.body ? parsed.body.harnessVariantMeta : undefined, "effort" in parsed.body ? parsed.body.effort : undefined);
|
|
30137
|
+
});
|
|
30138
|
+
if (task === "forbidden") {
|
|
30139
|
+
jsonError(res, "Task belongs to another token agent", 403);
|
|
30140
|
+
return true;
|
|
30141
|
+
}
|
|
29895
30142
|
if (!task) {
|
|
29896
30143
|
jsonError(res, "Task not found", 404);
|
|
29897
30144
|
return true;
|
|
@@ -34088,6 +34335,8 @@ init_server();
|
|
|
34088
34335
|
|
|
34089
34336
|
// src/slack/channel-activity.ts
|
|
34090
34337
|
init_app4();
|
|
34338
|
+
init_external_channel();
|
|
34339
|
+
init_handlers();
|
|
34091
34340
|
var cachedBotUserId = null;
|
|
34092
34341
|
var channelCache = null;
|
|
34093
34342
|
var CHANNEL_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
@@ -34118,6 +34367,8 @@ async function fetchChannelActivity(cursors, allowedChannelIds, limit = 10) {
|
|
|
34118
34367
|
const channelId = channel.id;
|
|
34119
34368
|
const cursor = cursors.get(channelId);
|
|
34120
34369
|
try {
|
|
34370
|
+
if (await shouldBlockChannel2(client, channelId))
|
|
34371
|
+
continue;
|
|
34121
34372
|
if (!cursor) {
|
|
34122
34373
|
const seedResult = await client.conversations.history({
|
|
34123
34374
|
channel: channelId,
|
|
@@ -34145,6 +34396,8 @@ async function fetchChannelActivity(cursors, allowedChannelIds, limit = 10) {
|
|
|
34145
34396
|
continue;
|
|
34146
34397
|
if (msg.thread_ts && msg.thread_ts !== msg.ts)
|
|
34147
34398
|
continue;
|
|
34399
|
+
if (!await isUserAllowed2(client, msg.user, LOOKUP_USER_TEAM2))
|
|
34400
|
+
continue;
|
|
34148
34401
|
messages.push({
|
|
34149
34402
|
channelId,
|
|
34150
34403
|
channelName: channel.name,
|
|
@@ -35730,9 +35983,11 @@ init_repo_merge_policy();
|
|
|
35730
35983
|
init_rbac();
|
|
35731
35984
|
init_telemetry();
|
|
35732
35985
|
init_types5();
|
|
35986
|
+
init_request_auth_context();
|
|
35733
35987
|
init_request_principal();
|
|
35734
35988
|
init_route_def();
|
|
35735
35989
|
init_utils2();
|
|
35990
|
+
var notOptionLike = (schema, field) => schema.refine((value) => !value.startsWith("-"), `${field} must not start with "-"`);
|
|
35736
35991
|
var getRepo = route({
|
|
35737
35992
|
method: "get",
|
|
35738
35993
|
path: "/api/repos/{id}",
|
|
@@ -35766,10 +36021,10 @@ var createRepo = route({
|
|
|
35766
36021
|
summary: "Create a new repo",
|
|
35767
36022
|
tags: ["Repos"],
|
|
35768
36023
|
body: object2({
|
|
35769
|
-
url: string2().min(1),
|
|
36024
|
+
url: notOptionLike(string2().min(1), "url"),
|
|
35770
36025
|
name: string2().min(1),
|
|
35771
|
-
clonePath: string2().optional(),
|
|
35772
|
-
defaultBranch: string2().optional(),
|
|
36026
|
+
clonePath: notOptionLike(string2(), "clonePath").optional(),
|
|
36027
|
+
defaultBranch: notOptionLike(string2(), "defaultBranch").optional(),
|
|
35773
36028
|
autoClone: boolean().optional(),
|
|
35774
36029
|
hooks: RepoHooksSchema.optional(),
|
|
35775
36030
|
guidelines: RepoGuidelinesInputSchema.nullable().optional()
|
|
@@ -35778,7 +36033,7 @@ var createRepo = route({
|
|
|
35778
36033
|
201: { description: "Repo created", schema: SwarmRepoSchema },
|
|
35779
36034
|
400: { description: "Validation error", schema: object2({ error: string2() }) },
|
|
35780
36035
|
403: {
|
|
35781
|
-
description: "Only the lead, the operator or a user can turn allowMerge on
|
|
36036
|
+
description: "Only the lead, the operator or a user can turn allowMerge on, set a mergePolicy or enable hooks",
|
|
35782
36037
|
schema: object2({ error: string2() })
|
|
35783
36038
|
},
|
|
35784
36039
|
409: { description: "Duplicate repo", schema: object2({ error: string2() }) }
|
|
@@ -35793,10 +36048,10 @@ var updateRepo = route({
|
|
|
35793
36048
|
tags: ["Repos"],
|
|
35794
36049
|
params: object2({ id: string2().uuid() }),
|
|
35795
36050
|
body: object2({
|
|
35796
|
-
url: string2().optional(),
|
|
36051
|
+
url: notOptionLike(string2(), "url").optional(),
|
|
35797
36052
|
name: string2().optional(),
|
|
35798
|
-
clonePath: string2().optional(),
|
|
35799
|
-
defaultBranch: string2().optional(),
|
|
36053
|
+
clonePath: notOptionLike(string2(), "clonePath").optional(),
|
|
36054
|
+
defaultBranch: notOptionLike(string2(), "defaultBranch").optional(),
|
|
35800
36055
|
autoClone: boolean().optional(),
|
|
35801
36056
|
hooks: RepoHooksSchema.nullable().optional(),
|
|
35802
36057
|
guidelines: RepoGuidelinesInputSchema.nullable().optional()
|
|
@@ -35804,7 +36059,7 @@ var updateRepo = route({
|
|
|
35804
36059
|
responses: {
|
|
35805
36060
|
200: { description: "Repo updated", schema: SwarmRepoSchema },
|
|
35806
36061
|
403: {
|
|
35807
|
-
description: "Only the lead, the operator or a user can change allowMerge or
|
|
36062
|
+
description: "Only the lead, the operator or a user can change allowMerge, mergePolicy, url, clonePath or hooks",
|
|
35808
36063
|
schema: object2({ error: string2() })
|
|
35809
36064
|
},
|
|
35810
36065
|
404: { description: "Repo not found", schema: object2({ error: string2() }) },
|
|
@@ -35822,7 +36077,8 @@ var deleteRepo = route({
|
|
|
35822
36077
|
responses: {
|
|
35823
36078
|
200: { description: "Repo deleted", schema: object2({ success: boolean() }) },
|
|
35824
36079
|
404: { description: "Repo not found", schema: object2({ error: string2() }) }
|
|
35825
|
-
}
|
|
36080
|
+
},
|
|
36081
|
+
rbac: { permission: "repo.delete" }
|
|
35826
36082
|
});
|
|
35827
36083
|
async function allowMergeRefusal(req, myAgentId) {
|
|
35828
36084
|
const decision = can({
|
|
@@ -35870,6 +36126,11 @@ async function handleRepos(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35870
36126
|
return true;
|
|
35871
36127
|
}
|
|
35872
36128
|
}
|
|
36129
|
+
const execRefusal = await execConfigRefusal(getRequestAuth(req), "http");
|
|
36130
|
+
if (execRefusal && parsed.body.hooks?.enabled === true) {
|
|
36131
|
+
jsonError(res, execRefusal, 403);
|
|
36132
|
+
return true;
|
|
36133
|
+
}
|
|
35873
36134
|
try {
|
|
35874
36135
|
const repo = await createSwarmRepo2({
|
|
35875
36136
|
url: parsed.body.url,
|
|
@@ -35877,7 +36138,7 @@ async function handleRepos(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35877
36138
|
clonePath: parsed.body.clonePath,
|
|
35878
36139
|
defaultBranch: parsed.body.defaultBranch,
|
|
35879
36140
|
autoClone: parsed.body.autoClone,
|
|
35880
|
-
hooks: parsed.body.hooks,
|
|
36141
|
+
hooks: parsed.body.hooks ?? (execRefusal ? { enabled: false } : undefined),
|
|
35881
36142
|
guidelines: parsed.body.guidelines
|
|
35882
36143
|
});
|
|
35883
36144
|
try {
|
|
@@ -35907,7 +36168,7 @@ async function handleRepos(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35907
36168
|
autoClone: parsed.body.autoClone,
|
|
35908
36169
|
hooks: parsed.body.hooks,
|
|
35909
36170
|
guidelines: parsed.body.guidelines
|
|
35910
|
-
}, () => allowMergeRefusal(req, myAgentId));
|
|
36171
|
+
}, () => allowMergeRefusal(req, myAgentId), () => execConfigRefusal(getRequestAuth(req), "http"));
|
|
35911
36172
|
if (result.kind === "refused") {
|
|
35912
36173
|
jsonError(res, result.refusal, 403);
|
|
35913
36174
|
return true;
|
|
@@ -35931,6 +36192,8 @@ async function handleRepos(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35931
36192
|
const parsed = await deleteRepo.parse(req, res, pathSegments, queryParams);
|
|
35932
36193
|
if (!parsed)
|
|
35933
36194
|
return true;
|
|
36195
|
+
if (await refuseAgentTokenWithout(req, res, "repo.delete"))
|
|
36196
|
+
return true;
|
|
35934
36197
|
const deleted = await deleteSwarmRepo2(parsed.params.id);
|
|
35935
36198
|
if (!deleted) {
|
|
35936
36199
|
jsonError(res, "Repo not found", 404);
|
|
@@ -39449,6 +39712,7 @@ init_db3();
|
|
|
39449
39712
|
init_rbac();
|
|
39450
39713
|
init_scheduler();
|
|
39451
39714
|
init_types5();
|
|
39715
|
+
init_request_auth_context();
|
|
39452
39716
|
var import_cron_parser = __toESM(require_dist(), 1);
|
|
39453
39717
|
init_favorite_owner();
|
|
39454
39718
|
init_request_principal();
|
|
@@ -39848,6 +40112,15 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39848
40112
|
jsonError(res, "Schedule not found", 404);
|
|
39849
40113
|
return true;
|
|
39850
40114
|
}
|
|
40115
|
+
if (getRequestAuth(req)?.kind === "agent" && !can({
|
|
40116
|
+
principal: await agentFirstPrincipal(req, myAgentId),
|
|
40117
|
+
verb: "schedule.run.any",
|
|
40118
|
+
resource: { kind: "owned", ownerAgentId: schedule.createdByAgentId },
|
|
40119
|
+
source: "http"
|
|
40120
|
+
}).allow) {
|
|
40121
|
+
jsonError(res, `Schedule "${schedule.name}" runs as the agent that created it. Only that agent or a lead can run it.`, 403);
|
|
40122
|
+
return true;
|
|
40123
|
+
}
|
|
39851
40124
|
if (!schedule.enabled) {
|
|
39852
40125
|
jsonError(res, "Schedule is disabled", 400);
|
|
39853
40126
|
return true;
|
|
@@ -40048,6 +40321,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40048
40321
|
}
|
|
40049
40322
|
}
|
|
40050
40323
|
const newEnabled = parsed.body.enabled !== undefined ? parsed.body.enabled : existing.enabled;
|
|
40324
|
+
const cronTimezoneChanged = Boolean(existing.cronExpression) && parsed.body.timezone !== undefined && parsed.body.timezone !== existing.timezone;
|
|
40051
40325
|
if (existing.scheduleType === "one_time") {
|
|
40052
40326
|
if (!newEnabled) {
|
|
40053
40327
|
body.nextRunAt = null;
|
|
@@ -40055,18 +40329,23 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40055
40329
|
} else {
|
|
40056
40330
|
if (!newEnabled) {
|
|
40057
40331
|
body.nextRunAt = null;
|
|
40058
|
-
} else if (parsed.body.cronExpression !== undefined || parsed.body.intervalMs !== undefined || parsed.body.enabled === true && !existing.enabled) {
|
|
40332
|
+
} else if (parsed.body.cronExpression !== undefined || parsed.body.intervalMs !== undefined || cronTimezoneChanged || parsed.body.enabled === true && !existing.enabled) {
|
|
40059
40333
|
const timing = mergeScheduleTiming({
|
|
40060
40334
|
cronExpression: existing.cronExpression ?? null,
|
|
40061
40335
|
intervalMs: existing.intervalMs ?? null
|
|
40062
40336
|
}, { cronExpression: parsed.body.cronExpression, intervalMs: parsed.body.intervalMs });
|
|
40063
|
-
const mergedTimezone = parsed.body.timezone !== undefined ? parsed.body.timezone : existing.timezone;
|
|
40064
40337
|
if (timing.mergedCron || timing.mergedInterval) {
|
|
40065
|
-
|
|
40066
|
-
|
|
40067
|
-
|
|
40068
|
-
|
|
40069
|
-
|
|
40338
|
+
try {
|
|
40339
|
+
body.nextRunAt = calculateNextRun2({
|
|
40340
|
+
...existing,
|
|
40341
|
+
cronExpression: timing.mergedCron ?? undefined,
|
|
40342
|
+
intervalMs: timing.mergedInterval ?? undefined,
|
|
40343
|
+
timezone: parsed.body.timezone ?? existing.timezone
|
|
40344
|
+
});
|
|
40345
|
+
} catch {
|
|
40346
|
+
jsonError(res, "Cannot calculate the next run for this schedule.", 400);
|
|
40347
|
+
return true;
|
|
40348
|
+
}
|
|
40070
40349
|
}
|
|
40071
40350
|
}
|
|
40072
40351
|
}
|
|
@@ -40255,7 +40534,7 @@ async function handleScriptConnectionProxy(req, res, pathSegments, queryParams,
|
|
|
40255
40534
|
} catch (err) {
|
|
40256
40535
|
mcpCallRoute.respond(res, 200, {
|
|
40257
40536
|
ok: false,
|
|
40258
|
-
error: err instanceof Error ? err.message : String(err)
|
|
40537
|
+
error: scrubSecrets(err instanceof Error ? err.message : String(err))
|
|
40259
40538
|
});
|
|
40260
40539
|
}
|
|
40261
40540
|
return true;
|
|
@@ -42263,6 +42542,8 @@ var listScriptRunsQuerySchema = object2({
|
|
|
42263
42542
|
status: ScriptRunStatusSchema.optional(),
|
|
42264
42543
|
agentId: string2().optional(),
|
|
42265
42544
|
scriptName: string2().optional(),
|
|
42545
|
+
objectScriptId: string2().optional(),
|
|
42546
|
+
objectId: string2().optional(),
|
|
42266
42547
|
limit: exports_coerce.number().int().min(1).max(500).optional(),
|
|
42267
42548
|
offset: exports_coerce.number().int().min(0).optional()
|
|
42268
42549
|
});
|
|
@@ -42555,6 +42836,10 @@ async function handleScriptRuns(req, res, pathSegments, queryParams, agentId) {
|
|
|
42555
42836
|
const agent = await requireAgent(res, agentId);
|
|
42556
42837
|
if (!agent)
|
|
42557
42838
|
return true;
|
|
42839
|
+
if (!durableScriptRunsAllowed()) {
|
|
42840
|
+
jsonError(res, DURABLE_RUNS_NATIVE_REFUSED, 400);
|
|
42841
|
+
return true;
|
|
42842
|
+
}
|
|
42558
42843
|
const secretRefusal = refuseSourceWithSecrets(parsed.body.source);
|
|
42559
42844
|
if (secretRefusal) {
|
|
42560
42845
|
json(res, secretRefusal, 400);
|
|
@@ -42600,7 +42885,7 @@ async function handleScriptRuns(req, res, pathSegments, queryParams, agentId) {
|
|
|
42600
42885
|
}
|
|
42601
42886
|
const { run, existing } = creation;
|
|
42602
42887
|
if (!existing && parsed.body.background) {
|
|
42603
|
-
startScriptRunProcess(run,
|
|
42888
|
+
startScriptRunProcess(run, getScriptApiBaseUrl(), bearerToken(req)).catch(async (err) => {
|
|
42604
42889
|
await updateScriptRun2(run.id, {
|
|
42605
42890
|
status: "failed",
|
|
42606
42891
|
pid: null,
|
|
@@ -42628,20 +42913,20 @@ async function handleScriptRuns(req, res, pathSegments, queryParams, agentId) {
|
|
|
42628
42913
|
const parsed = await listScriptRunsRoute.parse(req, res, pathSegments, queryParams);
|
|
42629
42914
|
if (!parsed)
|
|
42630
42915
|
return true;
|
|
42631
|
-
const
|
|
42916
|
+
const filter = {
|
|
42632
42917
|
status: parsed.query.status,
|
|
42633
42918
|
agentId: parsed.query.agentId,
|
|
42634
42919
|
scriptName: parsed.query.scriptName,
|
|
42635
|
-
|
|
42636
|
-
|
|
42920
|
+
objectScriptId: parsed.query.objectScriptId,
|
|
42921
|
+
objectId: parsed.query.objectId
|
|
42637
42922
|
};
|
|
42638
42923
|
listScriptRunsRoute.respond(res, 200, {
|
|
42639
|
-
runs: await listScriptRuns2(
|
|
42640
|
-
|
|
42641
|
-
|
|
42642
|
-
|
|
42643
|
-
|
|
42644
|
-
|
|
42924
|
+
runs: await listScriptRuns2({
|
|
42925
|
+
...filter,
|
|
42926
|
+
limit: parsed.query.limit ?? 50,
|
|
42927
|
+
offset: parsed.query.offset ?? 0
|
|
42928
|
+
}),
|
|
42929
|
+
total: await countScriptRuns2(filter)
|
|
42645
42930
|
});
|
|
42646
42931
|
return true;
|
|
42647
42932
|
}
|
|
@@ -42924,10 +43209,157 @@ init_events();
|
|
|
42924
43209
|
init_script_connections();
|
|
42925
43210
|
init_script_credential_broker();
|
|
42926
43211
|
init_db3();
|
|
43212
|
+
|
|
43213
|
+
// src/be/scripts/durable.ts
|
|
43214
|
+
init_kv_limits();
|
|
43215
|
+
init_types3();
|
|
43216
|
+
init_secret_scrubber();
|
|
43217
|
+
init_db4();
|
|
43218
|
+
init_run_credential();
|
|
43219
|
+
async function callDurableObject({
|
|
43220
|
+
script,
|
|
43221
|
+
objectId,
|
|
43222
|
+
method,
|
|
43223
|
+
args,
|
|
43224
|
+
agentId,
|
|
43225
|
+
caller,
|
|
43226
|
+
provenance = {},
|
|
43227
|
+
executor,
|
|
43228
|
+
fsMode,
|
|
43229
|
+
nested = false,
|
|
43230
|
+
...runContext
|
|
43231
|
+
}) {
|
|
43232
|
+
let signature;
|
|
43233
|
+
try {
|
|
43234
|
+
signature = JSON.parse(script.signatureJson);
|
|
43235
|
+
} catch {
|
|
43236
|
+
return { ok: false, code: "not_callable", message: "not callable" };
|
|
43237
|
+
}
|
|
43238
|
+
if (signature?.kind !== "durable" || !signature.methods || !Object.hasOwn(signature.methods, method)) {
|
|
43239
|
+
return { ok: false, code: "not_callable", message: "not callable" };
|
|
43240
|
+
}
|
|
43241
|
+
const identity = `${script.id}:${objectId}`;
|
|
43242
|
+
const objectChain = provenance.objectChain ?? [];
|
|
43243
|
+
if (objectChain.includes(identity)) {
|
|
43244
|
+
return { ok: false, code: "reentry", message: "already in this call chain" };
|
|
43245
|
+
}
|
|
43246
|
+
const namespace = `durable:${script.id}`;
|
|
43247
|
+
const leaseKey = `lease/${objectId}`;
|
|
43248
|
+
const stateKey = `state/${objectId}`;
|
|
43249
|
+
const token = crypto.randomUUID();
|
|
43250
|
+
const deadline = Date.now() + (nested ? 5000 : 30000);
|
|
43251
|
+
for (;; ) {
|
|
43252
|
+
if (await claimKv2({
|
|
43253
|
+
namespace,
|
|
43254
|
+
key: leaseKey,
|
|
43255
|
+
value: { token },
|
|
43256
|
+
valueType: "json",
|
|
43257
|
+
expiresAt: Date.now() + DEFAULT_SCRIPT_RESOURCES.wallClockMs + 1e4
|
|
43258
|
+
}))
|
|
43259
|
+
break;
|
|
43260
|
+
const remaining = deadline - Date.now();
|
|
43261
|
+
if (remaining <= 0)
|
|
43262
|
+
return { ok: false, code: "busy", message: "object busy" };
|
|
43263
|
+
await Bun.sleep(Math.min(remaining, 50 + Math.floor(Math.random() * 351)));
|
|
43264
|
+
if (Date.now() >= deadline)
|
|
43265
|
+
return { ok: false, code: "busy", message: "object busy" };
|
|
43266
|
+
}
|
|
43267
|
+
const client = getDbClient2();
|
|
43268
|
+
const release = async () => {
|
|
43269
|
+
await client.transaction(async () => {
|
|
43270
|
+
const lease = await getKv2(namespace, leaseKey);
|
|
43271
|
+
if (lease?.value?.token === token) {
|
|
43272
|
+
await deleteKv2(namespace, leaseKey);
|
|
43273
|
+
}
|
|
43274
|
+
});
|
|
43275
|
+
};
|
|
43276
|
+
let output;
|
|
43277
|
+
try {
|
|
43278
|
+
const entry = await getKv2(namespace, stateKey);
|
|
43279
|
+
const stored = entry?.value;
|
|
43280
|
+
output = await runScriptWithRunCredential({
|
|
43281
|
+
...runContext,
|
|
43282
|
+
source: script.source,
|
|
43283
|
+
args,
|
|
43284
|
+
agentId,
|
|
43285
|
+
executor: executor === undefined ? script.executor : executor,
|
|
43286
|
+
fsMode: fsMode ?? script.fsMode,
|
|
43287
|
+
signal: AbortSignal.timeout(DEFAULT_SCRIPT_RESOURCES.wallClockMs),
|
|
43288
|
+
durable: {
|
|
43289
|
+
id: objectId,
|
|
43290
|
+
method,
|
|
43291
|
+
state: stored?.state,
|
|
43292
|
+
codeVersion: script.version,
|
|
43293
|
+
storedCodeVersion: stored?.codeVersion ?? script.version,
|
|
43294
|
+
caller
|
|
43295
|
+
}
|
|
43296
|
+
}, {
|
|
43297
|
+
...provenance,
|
|
43298
|
+
objectChain: [...objectChain, identity],
|
|
43299
|
+
depth: (provenance.depth ?? 0) + 1
|
|
43300
|
+
});
|
|
43301
|
+
if (output.error || output.exitCode !== 0 || !output.durable) {
|
|
43302
|
+
await release();
|
|
43303
|
+
return { ok: false, code: "run_failed", message: "object run failed", output };
|
|
43304
|
+
}
|
|
43305
|
+
const { state, destroyed } = output.durable;
|
|
43306
|
+
const ttl = output.durable.idleTtlSec;
|
|
43307
|
+
const idleTtlSec = typeof ttl === "number" && Number.isFinite(ttl) && ttl > 0 ? ttl : null;
|
|
43308
|
+
const encoded = JSON.stringify(state);
|
|
43309
|
+
if (encoded === undefined) {
|
|
43310
|
+
await release();
|
|
43311
|
+
return { ok: false, code: "run_failed", message: "state must be JSON-serializable" };
|
|
43312
|
+
}
|
|
43313
|
+
if (Buffer.byteLength(encoded, "utf8") > MAX_KV_BODY_BYTES) {
|
|
43314
|
+
await release();
|
|
43315
|
+
return { ok: false, code: "too_large", message: "state too large" };
|
|
43316
|
+
}
|
|
43317
|
+
const changed = !stored || stored.codeVersion !== script.version || encoded !== JSON.stringify(stored.state);
|
|
43318
|
+
const stateVersion = (stored?.stateVersion ?? 0) + (!destroyed && changed ? 1 : 0);
|
|
43319
|
+
const committed = await client.transaction(async () => {
|
|
43320
|
+
const lease = await getKv2(namespace, leaseKey);
|
|
43321
|
+
if (lease?.value?.token !== token)
|
|
43322
|
+
return false;
|
|
43323
|
+
if (destroyed) {
|
|
43324
|
+
await deleteKv2(namespace, stateKey);
|
|
43325
|
+
} else if (changed) {
|
|
43326
|
+
await upsertKv2({
|
|
43327
|
+
namespace,
|
|
43328
|
+
key: stateKey,
|
|
43329
|
+
value: { codeVersion: script.version, stateVersion, state },
|
|
43330
|
+
valueType: "json",
|
|
43331
|
+
expiresAt: idleTtlSec !== null ? Date.now() + idleTtlSec * 1000 : null
|
|
43332
|
+
});
|
|
43333
|
+
} else if (idleTtlSec !== null) {
|
|
43334
|
+
const expiresAt = Date.now() + idleTtlSec * 1000;
|
|
43335
|
+
const refreshed = await client.run("UPDATE kv_entries SET expires_at = ? WHERE namespace = ? AND key = ?", [expiresAt, namespace, stateKey]);
|
|
43336
|
+
if (refreshed.changes === 0) {
|
|
43337
|
+
await upsertKv2({ namespace, key: stateKey, value: stored, valueType: "json", expiresAt });
|
|
43338
|
+
}
|
|
43339
|
+
}
|
|
43340
|
+
await deleteKv2(namespace, leaseKey);
|
|
43341
|
+
return true;
|
|
43342
|
+
});
|
|
43343
|
+
if (!committed)
|
|
43344
|
+
return { ok: false, code: "lease_lost", message: "lease lost" };
|
|
43345
|
+
return { ok: true, output, object: { id: objectId, stateVersion, destroyed } };
|
|
43346
|
+
} catch (error) {
|
|
43347
|
+
await release();
|
|
43348
|
+
return {
|
|
43349
|
+
ok: false,
|
|
43350
|
+
code: "run_failed",
|
|
43351
|
+
message: scrubSecrets(error instanceof Error ? error.message : "object run failed"),
|
|
43352
|
+
output
|
|
43353
|
+
};
|
|
43354
|
+
}
|
|
43355
|
+
}
|
|
43356
|
+
|
|
43357
|
+
// src/http/scripts.ts
|
|
42927
43358
|
init_embeddings();
|
|
42928
43359
|
init_extract_schema();
|
|
42929
43360
|
init_run_credential();
|
|
42930
43361
|
init_typecheck();
|
|
43362
|
+
init_users();
|
|
42931
43363
|
init_rbac();
|
|
42932
43364
|
init_registry();
|
|
42933
43365
|
init_extract_signature();
|
|
@@ -42935,6 +43367,7 @@ init_quickjs_compat();
|
|
|
42935
43367
|
init_types5();
|
|
42936
43368
|
init_request_auth_context();
|
|
42937
43369
|
init_secret_scrubber();
|
|
43370
|
+
init_request_principal();
|
|
42938
43371
|
init_route_def();
|
|
42939
43372
|
init_utils2();
|
|
42940
43373
|
var scriptNameSchema2 = string2().min(1).max(200);
|
|
@@ -42950,6 +43383,7 @@ var upsertBodySchema = object2({
|
|
|
42950
43383
|
var runBodySchema = object2({
|
|
42951
43384
|
name: scriptNameSchema2.optional(),
|
|
42952
43385
|
source: string2().min(1).optional(),
|
|
43386
|
+
object: object2({ id: string2().min(1).max(256), method: string2().min(1).max(128) }).optional(),
|
|
42953
43387
|
args: unknown().optional(),
|
|
42954
43388
|
intent: string2().default(""),
|
|
42955
43389
|
scope: ScriptScopeSchema.optional(),
|
|
@@ -42958,6 +43392,8 @@ var runBodySchema = object2({
|
|
|
42958
43392
|
idempotencyKey: string2().max(200).optional()
|
|
42959
43393
|
}).refine((body) => Boolean(body.name) !== Boolean(body.source), {
|
|
42960
43394
|
message: "Provide exactly one of name or source"
|
|
43395
|
+
}).refine((body) => !body.object || Boolean(body.name), {
|
|
43396
|
+
message: "object requires name"
|
|
42961
43397
|
});
|
|
42962
43398
|
var searchBodySchema = object2({
|
|
42963
43399
|
query: string2().default(""),
|
|
@@ -42973,6 +43409,8 @@ var listScriptsQuerySchema = object2({
|
|
|
42973
43409
|
includeScratch: _enum2(["true", "false"]).optional()
|
|
42974
43410
|
});
|
|
42975
43411
|
var scriptSignatureSchema = object2({
|
|
43412
|
+
kind: literal2("durable").optional(),
|
|
43413
|
+
methods: record2(string2(), object2({ argsType: string2(), resultType: string2(), description: string2() })).optional(),
|
|
42976
43414
|
argsType: string2(),
|
|
42977
43415
|
resultType: string2(),
|
|
42978
43416
|
description: string2()
|
|
@@ -42982,11 +43420,20 @@ var rowAuditColumnsShape = {
|
|
|
42982
43420
|
created_by: string2().nullable().optional(),
|
|
42983
43421
|
updated_by: string2().nullable().optional()
|
|
42984
43422
|
};
|
|
43423
|
+
function scriptKind(signatureJson) {
|
|
43424
|
+
try {
|
|
43425
|
+
return JSON.parse(signatureJson)?.kind === "durable" ? "durable" : "function";
|
|
43426
|
+
} catch {
|
|
43427
|
+
return "function";
|
|
43428
|
+
}
|
|
43429
|
+
}
|
|
42985
43430
|
var scriptListItemSchema = ScriptRecordSchema.omit({
|
|
42986
43431
|
source: true,
|
|
42987
43432
|
signatureJson: true,
|
|
42988
43433
|
argsJsonSchema: true,
|
|
42989
43434
|
contentHash: true
|
|
43435
|
+
}).extend({
|
|
43436
|
+
kind: _enum2(["function", "durable"])
|
|
42990
43437
|
});
|
|
42991
43438
|
var scriptDetailSchema = ScriptRecordSchema.omit({ argsJsonSchema: true }).extend({
|
|
42992
43439
|
signature: scriptSignatureSchema,
|
|
@@ -42998,6 +43445,7 @@ var scriptApiWithSecretSchema = ScriptApiRecordSchema.extend({
|
|
|
42998
43445
|
});
|
|
42999
43446
|
var scriptRunResponseSchema = object2({
|
|
43000
43447
|
result: unknown().optional(),
|
|
43448
|
+
object: object2({ id: string2(), stateVersion: number2(), destroyed: boolean() }).optional(),
|
|
43001
43449
|
autoSaved: object2({ slug: string2(), reason: string2() }).optional(),
|
|
43002
43450
|
kvSaved: object2({ namespace: string2(), key: string2() }).optional(),
|
|
43003
43451
|
truncated: object2({ stdout: boolean(), stderr: boolean() }),
|
|
@@ -43066,7 +43514,7 @@ var upsertRoute2 = route({
|
|
|
43066
43514
|
name: string2(),
|
|
43067
43515
|
version: number2(),
|
|
43068
43516
|
contentDeduped: boolean(),
|
|
43069
|
-
warnings: array2(string2()).optional().describe("Advisory quickjs-executor compatibility
|
|
43517
|
+
warnings: array2(string2()).optional().describe("Advisory findings: quickjs-executor compatibility, and apps the script names that have no generated script types. Never blocks the save.")
|
|
43070
43518
|
})
|
|
43071
43519
|
},
|
|
43072
43520
|
400: { description: "Validation or typecheck failure" },
|
|
@@ -43091,6 +43539,7 @@ var runRoute = route({
|
|
|
43091
43539
|
200: { description: "Script run completed", schema: scriptRunResponseSchema },
|
|
43092
43540
|
400: { description: "Validation error" },
|
|
43093
43541
|
404: { description: "Script not found" },
|
|
43542
|
+
409: { description: "Object busy, re-entry, or lease lost" },
|
|
43094
43543
|
501: { description: "workspace-rw scripts are not supported in v1" }
|
|
43095
43544
|
}
|
|
43096
43545
|
});
|
|
@@ -43412,6 +43861,10 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43412
43861
|
json(res, secretRefusal, 400);
|
|
43413
43862
|
return true;
|
|
43414
43863
|
}
|
|
43864
|
+
if (parsed.body.scope !== "global" && extractScriptSignature(parsed.body.source).kind === "durable") {
|
|
43865
|
+
jsonError(res, "DurableObject scripts must be global scope", 400);
|
|
43866
|
+
return true;
|
|
43867
|
+
}
|
|
43415
43868
|
const typecheck = await typecheckScript(parsed.body.source, { agentId: agent.id });
|
|
43416
43869
|
if (!typecheck.ok) {
|
|
43417
43870
|
json(res, {
|
|
@@ -43448,7 +43901,10 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43448
43901
|
isPromotion: Boolean(existingAgentScript)
|
|
43449
43902
|
});
|
|
43450
43903
|
}
|
|
43451
|
-
const warnings =
|
|
43904
|
+
const warnings = [
|
|
43905
|
+
...quickJSCompatWarnings(checkQuickJSCompat(parsed.body.source, { fsMode: parsed.body.fsMode })),
|
|
43906
|
+
...typecheck.warnings ?? []
|
|
43907
|
+
];
|
|
43452
43908
|
upsertRoute2.respond(res, 200, {
|
|
43453
43909
|
name: result.script.name,
|
|
43454
43910
|
version: result.script.version,
|
|
@@ -43464,6 +43920,12 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43464
43920
|
const agent = await requireAgent2(res, agentId);
|
|
43465
43921
|
if (!agent)
|
|
43466
43922
|
return true;
|
|
43923
|
+
const callerProvenance = getCurrentRunProvenance();
|
|
43924
|
+
const depth = callerProvenance?.depth ?? 0;
|
|
43925
|
+
if (depth >= 16) {
|
|
43926
|
+
jsonError(res, "call depth exceeds 16", 400);
|
|
43927
|
+
return true;
|
|
43928
|
+
}
|
|
43467
43929
|
const runtimeInstanceId = ((h) => Array.isArray(h) ? h[0] : h)(req.headers["x-runtime-instance-id"]);
|
|
43468
43930
|
const sourceTaskId = ((h) => Array.isArray(h) ? h[0] : h)(req.headers["x-source-task-id"]);
|
|
43469
43931
|
const secretRefusal = parsed.body.source ? refuseSourceWithSecrets(parsed.body.source) : null;
|
|
@@ -43471,6 +43933,10 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43471
43933
|
json(res, secretRefusal, 400);
|
|
43472
43934
|
return true;
|
|
43473
43935
|
}
|
|
43936
|
+
if (parsed.body.source && extractScriptSignature(parsed.body.source).kind === "durable") {
|
|
43937
|
+
jsonError(res, "DurableObject scripts must be saved globally and called by name", 400);
|
|
43938
|
+
return true;
|
|
43939
|
+
}
|
|
43474
43940
|
let source = parsed.body.source;
|
|
43475
43941
|
let fsMode = parsed.body.fsMode;
|
|
43476
43942
|
let executor = parsed.body.executor ?? null;
|
|
@@ -43486,6 +43952,20 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43486
43952
|
fsMode = script.fsMode;
|
|
43487
43953
|
executor = parsed.body.executor !== undefined ? parsed.body.executor : script.executor;
|
|
43488
43954
|
}
|
|
43955
|
+
const isDurable = namedScript && JSON.parse(namedScript.signatureJson).kind === "durable";
|
|
43956
|
+
if (isDurable && namedScript) {
|
|
43957
|
+
if (namedScript.scope !== "global") {
|
|
43958
|
+
jsonError(res, "DurableObject scripts must be global scope", 400);
|
|
43959
|
+
return true;
|
|
43960
|
+
}
|
|
43961
|
+
if (!parsed.body.object) {
|
|
43962
|
+
jsonError(res, "DurableObject scripts require object: { id, method }", 400);
|
|
43963
|
+
return true;
|
|
43964
|
+
}
|
|
43965
|
+
} else if (parsed.body.object) {
|
|
43966
|
+
jsonError(res, "not a DurableObject", 400);
|
|
43967
|
+
return true;
|
|
43968
|
+
}
|
|
43489
43969
|
if (fsMode === "workspace-rw") {
|
|
43490
43970
|
jsonError(res, "workspace-rw scripts are not supported by /api/scripts/run in v1", 501);
|
|
43491
43971
|
return true;
|
|
@@ -43496,14 +43976,13 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43496
43976
|
}
|
|
43497
43977
|
const startedAt = new Date().toISOString();
|
|
43498
43978
|
const runStartTouch = namedScript?.isScratch ? await touchScratchScriptLastUsed(namedScript.id) : null;
|
|
43499
|
-
const credentials = await buildScriptCredentialBindingsWithFailures({ agentId: agent.id });
|
|
43500
43979
|
const runId = crypto.randomUUID();
|
|
43501
|
-
const
|
|
43502
|
-
|
|
43503
|
-
|
|
43504
|
-
|
|
43505
|
-
|
|
43506
|
-
|
|
43980
|
+
const provenance = {
|
|
43981
|
+
...callerProvenance,
|
|
43982
|
+
sourceScriptRunId: runId
|
|
43983
|
+
};
|
|
43984
|
+
const credentials = await buildScriptCredentialBindingsWithFailures({ agentId: agent.id });
|
|
43985
|
+
const runContext = {
|
|
43507
43986
|
agentId: agent.id,
|
|
43508
43987
|
runtimeInstanceId,
|
|
43509
43988
|
sourceTaskId,
|
|
@@ -43513,10 +43992,55 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43513
43992
|
agentFs: credentials.agentFs,
|
|
43514
43993
|
apiConnections: getScriptApiConnectionDescriptors({ agentId: agent.id }),
|
|
43515
43994
|
mcpConnections: getScriptMcpConnectionDescriptors({ agentId: agent.id })
|
|
43516
|
-
}
|
|
43517
|
-
|
|
43518
|
-
|
|
43519
|
-
|
|
43995
|
+
};
|
|
43996
|
+
let output;
|
|
43997
|
+
let object;
|
|
43998
|
+
if (isDurable && namedScript && parsed.body.object) {
|
|
43999
|
+
const auth = getRequestAuth(req);
|
|
44000
|
+
const caller = auth?.kind === "agent" && await isScriptRunToken(auth.tokenId) ? { kind: "script", agentId: agent.id } : { kind: "agent", agentId: agent.id };
|
|
44001
|
+
const result = await callDurableObject({
|
|
44002
|
+
...runContext,
|
|
44003
|
+
script: namedScript,
|
|
44004
|
+
objectId: parsed.body.object.id,
|
|
44005
|
+
method: parsed.body.object.method,
|
|
44006
|
+
args: parsed.body.args,
|
|
44007
|
+
caller,
|
|
44008
|
+
provenance,
|
|
44009
|
+
executor,
|
|
44010
|
+
fsMode,
|
|
44011
|
+
nested: callerProvenance !== null
|
|
44012
|
+
});
|
|
44013
|
+
if (!result.ok && result.code !== "run_failed") {
|
|
44014
|
+
const status = ["busy", "reentry", "lease_lost"].includes(result.code) ? 409 : 400;
|
|
44015
|
+
jsonError(res, result.message, status);
|
|
44016
|
+
return true;
|
|
44017
|
+
}
|
|
44018
|
+
if (result.ok) {
|
|
44019
|
+
output = result.output;
|
|
44020
|
+
object = result.object;
|
|
44021
|
+
} else {
|
|
44022
|
+
output = result.output ?? {
|
|
44023
|
+
result: undefined,
|
|
44024
|
+
stdout: "",
|
|
44025
|
+
stderr: result.message,
|
|
44026
|
+
truncated: { stdout: false, stderr: false },
|
|
44027
|
+
durationMs: 0,
|
|
44028
|
+
exitCode: 1,
|
|
44029
|
+
error: "executor_error"
|
|
44030
|
+
};
|
|
44031
|
+
if (output.exitCode === 0 && !output.error && !output.runtimeError) {
|
|
44032
|
+
output = { ...output, exitCode: 1, error: "executor_error", stderr: result.message };
|
|
44033
|
+
}
|
|
44034
|
+
}
|
|
44035
|
+
} else {
|
|
44036
|
+
output = await runScriptWithRunCredential({
|
|
44037
|
+
...runContext,
|
|
44038
|
+
source,
|
|
44039
|
+
args: parsed.body.args,
|
|
44040
|
+
fsMode,
|
|
44041
|
+
executor
|
|
44042
|
+
}, { ...provenance, depth: depth + 1 });
|
|
44043
|
+
}
|
|
43520
44044
|
const ok = output.exitCode === 0 && !output.error && !output.runtimeError;
|
|
43521
44045
|
if (namedScript?.isScratch && ok) {
|
|
43522
44046
|
await touchScratchScriptLastUsed(namedScript.id);
|
|
@@ -43574,6 +44098,9 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43574
44098
|
source,
|
|
43575
44099
|
args: scrubObject(parsed.body.args ?? null),
|
|
43576
44100
|
scriptName: parsed.body.name ?? "(inline source)",
|
|
44101
|
+
objectScriptId: isDurable ? namedScript?.id : undefined,
|
|
44102
|
+
objectId: parsed.body.object?.id,
|
|
44103
|
+
objectMethod: parsed.body.object?.method,
|
|
43577
44104
|
status: ok ? "completed" : "failed",
|
|
43578
44105
|
output: scrubObject(output.result),
|
|
43579
44106
|
error: runError,
|
|
@@ -43583,6 +44110,7 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43583
44110
|
} catch {}
|
|
43584
44111
|
runRoute.respond(res, 200, scrubObject({
|
|
43585
44112
|
result: output.result,
|
|
44113
|
+
object,
|
|
43586
44114
|
autoSaved,
|
|
43587
44115
|
kvSaved,
|
|
43588
44116
|
truncated: output.truncated,
|
|
@@ -43635,7 +44163,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43635
44163
|
createdBy: script.createdBy,
|
|
43636
44164
|
updatedBy: script.updatedBy,
|
|
43637
44165
|
createdAt: script.createdAt,
|
|
43638
|
-
updatedAt: script.updatedAt
|
|
44166
|
+
updatedAt: script.updatedAt,
|
|
44167
|
+
kind: scriptKind(script.signatureJson)
|
|
43639
44168
|
}));
|
|
43640
44169
|
listScriptsRoute.respond(res, 200, { scripts });
|
|
43641
44170
|
return true;
|
|
@@ -43755,6 +44284,23 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43755
44284
|
jsonError(res, "agentId is required: this script has no owning agent to run as", 400);
|
|
43756
44285
|
return true;
|
|
43757
44286
|
}
|
|
44287
|
+
const auth = getRequestAuth(req);
|
|
44288
|
+
if (auth?.kind === "agent") {
|
|
44289
|
+
const caller = await getAgentById2(auth.agentId);
|
|
44290
|
+
const decision = can({
|
|
44291
|
+
principal: { kind: "agent", agentId: auth.agentId, isLead: caller?.isLead === true },
|
|
44292
|
+
verb: "script.api.create",
|
|
44293
|
+
source: "http"
|
|
44294
|
+
});
|
|
44295
|
+
if (!decision.allow) {
|
|
44296
|
+
jsonError(res, `Forbidden: ${decision.reason}`, 403);
|
|
44297
|
+
return true;
|
|
44298
|
+
}
|
|
44299
|
+
if (!await getAgentById2(runAsAgentId)) {
|
|
44300
|
+
jsonError(res, `agentId "${runAsAgentId}" is not a registered agent`, 400);
|
|
44301
|
+
return true;
|
|
44302
|
+
}
|
|
44303
|
+
}
|
|
43758
44304
|
const endpoint = await createScriptApi({
|
|
43759
44305
|
scriptId: script.id,
|
|
43760
44306
|
agentId: runAsAgentId,
|
|
@@ -43786,6 +44332,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43786
44332
|
const parsed = await revealScriptApiSecretRoute.parse(req, res, pathSegments, queryParams);
|
|
43787
44333
|
if (!parsed)
|
|
43788
44334
|
return true;
|
|
44335
|
+
if (await refuseAgentTokenWithout(req, res, "script.api.read.secrets"))
|
|
44336
|
+
return true;
|
|
43789
44337
|
const endpoint = await getScriptApiById(parsed.params.endpointId);
|
|
43790
44338
|
if (!endpoint || endpoint.scriptId !== parsed.params.id) {
|
|
43791
44339
|
jsonError(res, "Endpoint not found", 404);
|
|
@@ -43798,6 +44346,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43798
44346
|
const parsed = await rotateScriptApiRoute.parse(req, res, pathSegments, queryParams);
|
|
43799
44347
|
if (!parsed)
|
|
43800
44348
|
return true;
|
|
44349
|
+
if (await refuseAgentTokenWithout(req, res, "script.api.rotate"))
|
|
44350
|
+
return true;
|
|
43801
44351
|
const endpoint = await getScriptApiById(parsed.params.endpointId);
|
|
43802
44352
|
if (!endpoint || endpoint.scriptId !== parsed.params.id) {
|
|
43803
44353
|
jsonError(res, "Endpoint not found", 404);
|
|
@@ -43815,6 +44365,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43815
44365
|
const parsed = await patchScriptApiRoute.parse(req, res, pathSegments, queryParams);
|
|
43816
44366
|
if (!parsed)
|
|
43817
44367
|
return true;
|
|
44368
|
+
if (await refuseAgentTokenWithout(req, res, "script.api.update"))
|
|
44369
|
+
return true;
|
|
43818
44370
|
const endpoint = await getScriptApiById(parsed.params.endpointId);
|
|
43819
44371
|
if (!endpoint || endpoint.scriptId !== parsed.params.id) {
|
|
43820
44372
|
jsonError(res, "Endpoint not found", 404);
|
|
@@ -43832,6 +44384,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43832
44384
|
const parsed = await deleteScriptApiRoute.parse(req, res, pathSegments, queryParams);
|
|
43833
44385
|
if (!parsed)
|
|
43834
44386
|
return true;
|
|
44387
|
+
if (await refuseAgentTokenWithout(req, res, "script.api.delete"))
|
|
44388
|
+
return true;
|
|
43835
44389
|
const endpoint = await getScriptApiById(parsed.params.endpointId);
|
|
43836
44390
|
if (!endpoint || endpoint.scriptId !== parsed.params.id) {
|
|
43837
44391
|
jsonError(res, "Endpoint not found", 404);
|
|
@@ -44305,7 +44859,7 @@ init_rbac_roles();
|
|
|
44305
44859
|
init_session_shares();
|
|
44306
44860
|
init_steering2();
|
|
44307
44861
|
init_task_citations2();
|
|
44308
|
-
|
|
44862
|
+
init_task_ui_spec2();
|
|
44309
44863
|
init_users();
|
|
44310
44864
|
init_rbac();
|
|
44311
44865
|
init_auth2();
|
|
@@ -45667,6 +46221,7 @@ async function getSkillUsageDetail(skillId, window, tzOffsetMinutes = 0, now = D
|
|
|
45667
46221
|
|
|
45668
46222
|
// src/http/skills.ts
|
|
45669
46223
|
init_types5();
|
|
46224
|
+
init_request_principal();
|
|
45670
46225
|
init_route_def();
|
|
45671
46226
|
init_utils2();
|
|
45672
46227
|
var SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE = "This skill is system-managed and cannot be edited from the UI; it is re-seeded on each start. Fork it under a new name to customize.";
|
|
@@ -46170,6 +46725,8 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46170
46725
|
const parsed = await installRemoteRoute.parse(req, res, pathSegments, queryParams);
|
|
46171
46726
|
if (!parsed)
|
|
46172
46727
|
return true;
|
|
46728
|
+
if (await refuseAgentTokenWithout(req, res, "skill.install.global"))
|
|
46729
|
+
return true;
|
|
46173
46730
|
try {
|
|
46174
46731
|
const branch = "main";
|
|
46175
46732
|
const filePath = parsed.body.sourcePath ? `${parsed.body.sourcePath}/SKILL.md` : "SKILL.md";
|
|
@@ -46291,6 +46848,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46291
46848
|
jsonError(res, "Skill not found", 404);
|
|
46292
46849
|
return true;
|
|
46293
46850
|
}
|
|
46851
|
+
if (parsed.body.agentId !== myAgentId && await refuseAgentTokenWithout(req, res, "skill.install.any", {
|
|
46852
|
+
kind: "agent",
|
|
46853
|
+
agentId: parsed.body.agentId
|
|
46854
|
+
})) {
|
|
46855
|
+
return true;
|
|
46856
|
+
}
|
|
46294
46857
|
try {
|
|
46295
46858
|
const agentSkill = await installSkill2(parsed.body.agentId, parsed.params.id);
|
|
46296
46859
|
installSkillRoute.respond(res, 200, { agentSkill });
|
|
@@ -46303,6 +46866,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46303
46866
|
const parsed = await uninstallSkillRoute.parse(req, res, pathSegments, queryParams);
|
|
46304
46867
|
if (!parsed)
|
|
46305
46868
|
return true;
|
|
46869
|
+
if (parsed.params.agentId !== myAgentId && await refuseAgentTokenWithout(req, res, "skill.uninstall.any", {
|
|
46870
|
+
kind: "agent",
|
|
46871
|
+
agentId: parsed.params.agentId
|
|
46872
|
+
})) {
|
|
46873
|
+
return true;
|
|
46874
|
+
}
|
|
46306
46875
|
const removed = await uninstallSkill2(parsed.params.agentId, parsed.params.id);
|
|
46307
46876
|
uninstallSkillRoute.respond(res, 200, { success: removed });
|
|
46308
46877
|
return true;
|
|
@@ -46365,6 +46934,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46365
46934
|
jsonError(res, "Skill not found", 404);
|
|
46366
46935
|
return true;
|
|
46367
46936
|
}
|
|
46937
|
+
if (await refuseAgentTokenWithout(req, res, "skill.update.any", {
|
|
46938
|
+
kind: "owned",
|
|
46939
|
+
ownerAgentId: skill.ownerAgentId
|
|
46940
|
+
})) {
|
|
46941
|
+
return true;
|
|
46942
|
+
}
|
|
46368
46943
|
if (skill.systemDefault) {
|
|
46369
46944
|
jsonError(res, SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE, 403);
|
|
46370
46945
|
return true;
|
|
@@ -46413,6 +46988,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46413
46988
|
jsonError(res, "Skill not found", 404);
|
|
46414
46989
|
return true;
|
|
46415
46990
|
}
|
|
46991
|
+
if (await refuseAgentTokenWithout(req, res, "skill.update.any", {
|
|
46992
|
+
kind: "owned",
|
|
46993
|
+
ownerAgentId: skill.ownerAgentId
|
|
46994
|
+
})) {
|
|
46995
|
+
return true;
|
|
46996
|
+
}
|
|
46416
46997
|
if (skill.systemDefault) {
|
|
46417
46998
|
jsonError(res, SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE, 403);
|
|
46418
46999
|
return true;
|
|
@@ -46439,6 +47020,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46439
47020
|
jsonError(res, "Skill not found", 404);
|
|
46440
47021
|
return true;
|
|
46441
47022
|
}
|
|
47023
|
+
if (await refuseAgentTokenWithout(req, res, "skill.update.any", {
|
|
47024
|
+
kind: "owned",
|
|
47025
|
+
ownerAgentId: skill.ownerAgentId
|
|
47026
|
+
})) {
|
|
47027
|
+
return true;
|
|
47028
|
+
}
|
|
46442
47029
|
if (skill.systemDefault) {
|
|
46443
47030
|
jsonError(res, SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE, 403);
|
|
46444
47031
|
return true;
|
|
@@ -46473,6 +47060,9 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46473
47060
|
const parsed = await createSkillRoute.parse(req, res, pathSegments, queryParams);
|
|
46474
47061
|
if (!parsed)
|
|
46475
47062
|
return true;
|
|
47063
|
+
if (((parsed.body.scope ?? "agent") !== "agent" || parsed.body.systemDefault === true) && await refuseAgentTokenWithout(req, res, "skill.create.swarm")) {
|
|
47064
|
+
return true;
|
|
47065
|
+
}
|
|
46476
47066
|
try {
|
|
46477
47067
|
const pm = parseSkillContent(parsed.body.content);
|
|
46478
47068
|
const skill = await createSkill2({
|
|
@@ -46508,6 +47098,13 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46508
47098
|
jsonError(res, "Skill not found", 404);
|
|
46509
47099
|
return true;
|
|
46510
47100
|
}
|
|
47101
|
+
const owned = { kind: "owned", ownerAgentId: existing.ownerAgentId };
|
|
47102
|
+
if (await refuseAgentTokenWithout(req, res, "skill.update.any", owned))
|
|
47103
|
+
return true;
|
|
47104
|
+
const { scope, systemDefault, ownerAgentId } = parsed.body;
|
|
47105
|
+
if ((scope !== undefined && scope !== existing.scope && scope !== "agent" || systemDefault === true || Object.hasOwn(parsed.body, "ownerAgentId") && ownerAgentId !== existing.ownerAgentId) && await refuseAgentTokenWithout(req, res, "skill.promote.swarm", owned)) {
|
|
47106
|
+
return true;
|
|
47107
|
+
}
|
|
46511
47108
|
const protectedSystemDefaultFields = [
|
|
46512
47109
|
"content",
|
|
46513
47110
|
"name",
|
|
@@ -46570,6 +47167,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46570
47167
|
jsonError(res, "Skill not found", 404);
|
|
46571
47168
|
return true;
|
|
46572
47169
|
}
|
|
47170
|
+
if (await refuseAgentTokenWithout(req, res, "skill.delete.any", {
|
|
47171
|
+
kind: "owned",
|
|
47172
|
+
ownerAgentId: existing.ownerAgentId
|
|
47173
|
+
})) {
|
|
47174
|
+
return true;
|
|
47175
|
+
}
|
|
46573
47176
|
if (existing.systemDefault) {
|
|
46574
47177
|
jsonError(res, SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE, 403);
|
|
46575
47178
|
return true;
|
|
@@ -47339,6 +47942,8 @@ init_metadata();
|
|
|
47339
47942
|
init_webhook();
|
|
47340
47943
|
init_webhook_lifecycle();
|
|
47341
47944
|
init_ensure_token();
|
|
47945
|
+
init_config();
|
|
47946
|
+
init_request_principal();
|
|
47342
47947
|
init_route_def();
|
|
47343
47948
|
init_utils2();
|
|
47344
47949
|
|
|
@@ -47491,6 +48096,7 @@ var jiraWebhookRegister = route({
|
|
|
47491
48096
|
body: object2({
|
|
47492
48097
|
jqlFilter: string2().min(1)
|
|
47493
48098
|
}),
|
|
48099
|
+
rbac: { permission: "oauth-authorization.manage" },
|
|
47494
48100
|
responses: {
|
|
47495
48101
|
200: { description: "Webhook registered", schema: JiraWebhookRegisteredSchema },
|
|
47496
48102
|
400: { description: "Invalid jqlFilter" },
|
|
@@ -47506,6 +48112,7 @@ var jiraWebhookDelete = route({
|
|
|
47506
48112
|
params: object2({
|
|
47507
48113
|
id: exports_coerce.number().int().positive()
|
|
47508
48114
|
}),
|
|
48115
|
+
rbac: { permission: "oauth-authorization.manage" },
|
|
47509
48116
|
responses: {
|
|
47510
48117
|
200: { description: "Webhook deleted", schema: JiraWebhookDeletedSchema },
|
|
47511
48118
|
400: { description: "Invalid webhook id" },
|
|
@@ -47518,13 +48125,15 @@ var jiraDisconnect = route({
|
|
|
47518
48125
|
pattern: ["api", "trackers", "jira", "disconnect"],
|
|
47519
48126
|
summary: "Fully disconnect Jira: delete all webhooks, drop tokens, clear metadata",
|
|
47520
48127
|
tags: ["Trackers"],
|
|
48128
|
+
rbac: { permission: "oauth-authorization.manage" },
|
|
47521
48129
|
responses: {
|
|
47522
48130
|
200: { description: "Disconnected", schema: JiraDisconnectResultSchema },
|
|
47523
48131
|
503: { description: "Jira not configured" }
|
|
47524
48132
|
}
|
|
47525
48133
|
});
|
|
47526
|
-
function getWebhookUrl(req) {
|
|
47527
|
-
const
|
|
48134
|
+
async function getWebhookUrl(req) {
|
|
48135
|
+
const configured = process.env.JIRA_WEBHOOK_TOKEN;
|
|
48136
|
+
const token = !configured ? "<unset>" : await requestSecretReadScope(req) === "all" ? configured : "<redacted>";
|
|
47528
48137
|
return `${deriveApiBaseUrl(req)}/api/trackers/jira/webhook/${token}`;
|
|
47529
48138
|
}
|
|
47530
48139
|
function getRedirectUri(req) {
|
|
@@ -47548,7 +48157,7 @@ async function buildJiraStatusPayload(req) {
|
|
|
47548
48157
|
scope,
|
|
47549
48158
|
hasManageWebhookScope,
|
|
47550
48159
|
webhookTokenConfigured: Boolean(process.env.JIRA_WEBHOOK_TOKEN),
|
|
47551
|
-
webhookUrl: getWebhookUrl(req),
|
|
48160
|
+
webhookUrl: await getWebhookUrl(req),
|
|
47552
48161
|
redirectUri: getRedirectUri(req),
|
|
47553
48162
|
webhookIds: meta.webhookIds ?? []
|
|
47554
48163
|
};
|
|
@@ -47665,6 +48274,8 @@ async function handleJiraTracker(req, res, pathSegments) {
|
|
|
47665
48274
|
return true;
|
|
47666
48275
|
}
|
|
47667
48276
|
if (jiraWebhookRegister.match(req.method, pathSegments)) {
|
|
48277
|
+
if (await refuseAgentTokenWithout(req, res, "oauth-authorization.manage"))
|
|
48278
|
+
return true;
|
|
47668
48279
|
if (!isJiraEnabled()) {
|
|
47669
48280
|
res.writeHead(503, { "Content-Type": "application/json" });
|
|
47670
48281
|
res.end(JSON.stringify({ error: "Jira integration not configured" }));
|
|
@@ -47691,6 +48302,8 @@ async function handleJiraTracker(req, res, pathSegments) {
|
|
|
47691
48302
|
return true;
|
|
47692
48303
|
}
|
|
47693
48304
|
if (jiraWebhookDelete.match(req.method, pathSegments)) {
|
|
48305
|
+
if (await refuseAgentTokenWithout(req, res, "oauth-authorization.manage"))
|
|
48306
|
+
return true;
|
|
47694
48307
|
if (!isJiraEnabled()) {
|
|
47695
48308
|
res.writeHead(503, { "Content-Type": "application/json" });
|
|
47696
48309
|
res.end(JSON.stringify({ error: "Jira integration not configured" }));
|
|
@@ -47712,6 +48325,8 @@ async function handleJiraTracker(req, res, pathSegments) {
|
|
|
47712
48325
|
return true;
|
|
47713
48326
|
}
|
|
47714
48327
|
if (jiraDisconnect.match(req.method, pathSegments)) {
|
|
48328
|
+
if (await refuseAgentTokenWithout(req, res, "oauth-authorization.manage"))
|
|
48329
|
+
return true;
|
|
47715
48330
|
if (!isJiraEnabled()) {
|
|
47716
48331
|
res.writeHead(503, { "Content-Type": "application/json" });
|
|
47717
48332
|
res.end(JSON.stringify({ error: "Jira integration not configured" }));
|
|
@@ -47820,6 +48435,7 @@ async function handleLinearWebhook(rawBody, headers) {
|
|
|
47820
48435
|
|
|
47821
48436
|
// src/http/trackers/linear.ts
|
|
47822
48437
|
init_ensure_token();
|
|
48438
|
+
init_request_principal();
|
|
47823
48439
|
init_route_def();
|
|
47824
48440
|
init_utils2();
|
|
47825
48441
|
var LinearStatusSchema = object2({
|
|
@@ -47922,6 +48538,7 @@ var linearDisconnect = route({
|
|
|
47922
48538
|
pattern: ["api", "trackers", "linear", "disconnect"],
|
|
47923
48539
|
summary: "Fully disconnect Linear: revoke OAuth grant + drop tokens",
|
|
47924
48540
|
tags: ["Trackers"],
|
|
48541
|
+
rbac: { permission: "oauth-authorization.manage" },
|
|
47925
48542
|
responses: {
|
|
47926
48543
|
200: { description: "Disconnected", schema: LinearDisconnectSchema },
|
|
47927
48544
|
503: { description: "Linear not configured" }
|
|
@@ -48043,6 +48660,8 @@ async function handleLinearTracker(req, res, pathSegments) {
|
|
|
48043
48660
|
return true;
|
|
48044
48661
|
}
|
|
48045
48662
|
if (linearDisconnect.match(req.method, pathSegments)) {
|
|
48663
|
+
if (await refuseAgentTokenWithout(req, res, "oauth-authorization.manage"))
|
|
48664
|
+
return true;
|
|
48046
48665
|
if (!isLinearEnabled()) {
|
|
48047
48666
|
res.writeHead(503, { "Content-Type": "application/json" });
|
|
48048
48667
|
res.end(JSON.stringify({ error: "Linear integration not configured" }));
|
|
@@ -52312,7 +52931,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
52312
52931
|
});
|
|
52313
52932
|
});
|
|
52314
52933
|
var detachRealtime = attachRealtimeTransport(httpServer);
|
|
52315
|
-
var { attachControllerTransport } = await import("./controllers-connect-
|
|
52934
|
+
var { attachControllerTransport } = await import("./controllers-connect-tz07d2xr.js");
|
|
52316
52935
|
var detachControllers = attachControllerTransport(httpServer);
|
|
52317
52936
|
var stopWorkerNudges = startWorkerNudgeListener();
|
|
52318
52937
|
var taskAutoTitles = startTaskAutoTitleListener();
|
|
@@ -52343,7 +52962,7 @@ async function shutdown() {
|
|
|
52343
52962
|
sessionsProcessed: getServerSessionsProcessed()
|
|
52344
52963
|
});
|
|
52345
52964
|
if (hasCapability("scheduling")) {
|
|
52346
|
-
const { stopScheduler } = await import("./index-
|
|
52965
|
+
const { stopScheduler } = await import("./index-7w8p6em0.js");
|
|
52347
52966
|
stopScheduler();
|
|
52348
52967
|
}
|
|
52349
52968
|
stopHeartbeat2();
|
|
@@ -52355,7 +52974,7 @@ async function shutdown() {
|
|
|
52355
52974
|
await stopSlackApp2();
|
|
52356
52975
|
await stopChatSdk();
|
|
52357
52976
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
52358
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
52977
|
+
const { stopOAuthKeepalive } = await import("./keepalive-zdqay870.js");
|
|
52359
52978
|
await stopOAuthKeepalive();
|
|
52360
52979
|
}
|
|
52361
52980
|
stopOAuthPendingGc();
|
|
@@ -52428,6 +53047,7 @@ try {
|
|
|
52428
53047
|
throw err;
|
|
52429
53048
|
}
|
|
52430
53049
|
warnIfCorsAllowsAnyOrigin();
|
|
53050
|
+
setDeploymentEnvReader2(getDeploymentEnvValue2);
|
|
52431
53051
|
try {
|
|
52432
53052
|
const loaded = await loadSecretRegistry();
|
|
52433
53053
|
console.log(`[secret-registry] registered config=${loaded.config} oauth=${loaded.oauth} scriptApi=${loaded.scriptApi} runtimeController=${loaded.runtimeController} failed=${loaded.failed}`);
|
|
@@ -52445,21 +53065,21 @@ try {
|
|
|
52445
53065
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
52446
53066
|
}
|
|
52447
53067
|
try {
|
|
52448
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
53068
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-2hzvvzg0.js");
|
|
52449
53069
|
ensurePricingSeeded();
|
|
52450
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
53070
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-h79bg4cf.js");
|
|
52451
53071
|
startPricingRefreshLoop();
|
|
52452
53072
|
} catch (err) {
|
|
52453
53073
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
52454
53074
|
}
|
|
52455
53075
|
try {
|
|
52456
|
-
const { ensureModelProfilesSeeded } = await import("./boot-seeds-
|
|
53076
|
+
const { ensureModelProfilesSeeded } = await import("./boot-seeds-2hzvvzg0.js");
|
|
52457
53077
|
await ensureModelProfilesSeeded();
|
|
52458
53078
|
} catch (err) {
|
|
52459
53079
|
console.error("[startup] Failed to seed model profiles:", err);
|
|
52460
53080
|
}
|
|
52461
53081
|
try {
|
|
52462
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
53082
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-2hzvvzg0.js");
|
|
52463
53083
|
ensureRbacSeeded();
|
|
52464
53084
|
} catch (err) {
|
|
52465
53085
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -52467,13 +53087,13 @@ try {
|
|
|
52467
53087
|
throw err;
|
|
52468
53088
|
}
|
|
52469
53089
|
try {
|
|
52470
|
-
const { runAllSeeders } = await import("./index-
|
|
53090
|
+
const { runAllSeeders } = await import("./index-x9qf8dg7.js");
|
|
52471
53091
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
52472
53092
|
} catch (err) {
|
|
52473
53093
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
52474
53094
|
}
|
|
52475
53095
|
try {
|
|
52476
|
-
const { runImports } = await import("./index-
|
|
53096
|
+
const { runImports } = await import("./index-fdym6ryb.js");
|
|
52477
53097
|
await runImports();
|
|
52478
53098
|
} catch (err) {
|
|
52479
53099
|
console.error("[startup] File import failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
@@ -52493,6 +53113,7 @@ httpServer.listen(port, async () => {
|
|
|
52493
53113
|
const boundAddress = httpServer.address();
|
|
52494
53114
|
if (boundAddress && typeof boundAddress === "object") {
|
|
52495
53115
|
setExtensionLoopbackBaseUrl(`http://127.0.0.1:${boundAddress.port}`);
|
|
53116
|
+
setApiLoopbackBaseUrl(`http://127.0.0.1:${boundAddress.port}`);
|
|
52496
53117
|
}
|
|
52497
53118
|
console.log(`MCP HTTP server running on http://localhost:${port}/mcp`);
|
|
52498
53119
|
ensure({
|
|
@@ -52524,10 +53145,10 @@ httpServer.listen(port, async () => {
|
|
|
52524
53145
|
startChatSdk().catch((err) => {
|
|
52525
53146
|
console.error("[chat-sdk] Failed to start, continuing without Chat SDK:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
52526
53147
|
});
|
|
52527
|
-
import("./agent-fs-provision-
|
|
53148
|
+
import("./agent-fs-provision-7fa9e12e.js").then(({ syncAgentFsOrgSwarmUrl }) => syncAgentFsOrgSwarmUrl(getConfiguredAppUrls()[0])).catch((err) => {
|
|
52528
53149
|
console.warn("[agent-fs] Failed to set the org swarm URL:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
52529
53150
|
});
|
|
52530
|
-
import("./object-webhooks-
|
|
53151
|
+
import("./object-webhooks-mkca91s0.js").then(({ ensureObjectWebhooksForKnownDrives }) => ensureObjectWebhooksForKnownDrives()).catch((err) => {
|
|
52531
53152
|
console.warn("[objects] agent-fs webhook boot check failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
52532
53153
|
});
|
|
52533
53154
|
startQueueStallAlarm();
|
|
@@ -52541,24 +53162,24 @@ httpServer.listen(port, async () => {
|
|
|
52541
53162
|
await initLinear();
|
|
52542
53163
|
await initJira();
|
|
52543
53164
|
await initWorkflows2();
|
|
52544
|
-
await startScriptRunSupervisor(
|
|
53165
|
+
await startScriptRunSupervisor(getScriptApiBaseUrl());
|
|
52545
53166
|
if (hasCapability("scheduling")) {
|
|
52546
|
-
const { parseSchedulerIntervalMs, startScheduler } = await import("./index-
|
|
52547
|
-
const { getExecutorRegistry } = await import("./index-
|
|
53167
|
+
const { parseSchedulerIntervalMs, startScheduler } = await import("./index-7w8p6em0.js");
|
|
53168
|
+
const { getExecutorRegistry } = await import("./index-y3s0xp2v.js");
|
|
52548
53169
|
startScheduler(getExecutorRegistry(), parseSchedulerIntervalMs(process.env.SCHEDULER_INTERVAL_MS), { runId: globalState.__runId });
|
|
52549
53170
|
}
|
|
52550
53171
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
52551
|
-
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-
|
|
53172
|
+
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-vz4semsx.js");
|
|
52552
53173
|
startHeartbeat(parseHeartbeatIntervalMs(process.env.HEARTBEAT_INTERVAL_MS));
|
|
52553
53174
|
}
|
|
52554
53175
|
startPoolRouting();
|
|
52555
53176
|
startRuntimeSupervisor();
|
|
52556
53177
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
52557
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
53178
|
+
const { startOAuthKeepalive } = await import("./keepalive-zdqay870.js");
|
|
52558
53179
|
startOAuthKeepalive();
|
|
52559
53180
|
}
|
|
52560
53181
|
if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
|
|
52561
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
53182
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-y9zyd7t6.js");
|
|
52562
53183
|
startOAuthRefreshSweep();
|
|
52563
53184
|
}
|
|
52564
53185
|
startOAuthPendingGc();
|
|
@@ -52568,22 +53189,19 @@ httpServer.listen(port, async () => {
|
|
|
52568
53189
|
startSavingsRollup(savingsRollupSql);
|
|
52569
53190
|
startHumanFreeDrain();
|
|
52570
53191
|
startTaskSearchBackfill();
|
|
52571
|
-
import("./embedding-space-
|
|
52572
|
-
setDeploymentEnvReader(getDeploymentEnvValue2);
|
|
52573
|
-
return runEmbeddingMaintenance({ backfill: true });
|
|
52574
|
-
}).catch((err) => {
|
|
53192
|
+
import("./embedding-space-zsdw37bb.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch((err) => {
|
|
52575
53193
|
console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
|
|
52576
53194
|
});
|
|
52577
|
-
import("./boot-args-schema-
|
|
53195
|
+
import("./boot-args-schema-ry6cb0p7.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
|
|
52578
53196
|
console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
|
|
52579
53197
|
});
|
|
52580
|
-
import("./boot-scrub-sweep-
|
|
53198
|
+
import("./boot-scrub-sweep-3ycxr51t.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
52581
53199
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
52582
53200
|
});
|
|
52583
|
-
import("./user-merge-jobs-
|
|
53201
|
+
import("./user-merge-jobs-rabbncf6.js").then(({ resumeUserMergeJobs }) => resumeUserMergeJobs()).catch((err) => {
|
|
52584
53202
|
console.error("[user-merge] startup resume failed (non-fatal):", err);
|
|
52585
53203
|
});
|
|
52586
|
-
import("./session-source-backfill-
|
|
53204
|
+
import("./session-source-backfill-528j4s8j.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
|
|
52587
53205
|
console.error("[session-source-backfill] startup run failed (non-fatal):", err);
|
|
52588
53206
|
});
|
|
52589
53207
|
}).on("error", (err) => {
|