@desplega.ai/agent-swarm 2.13.4 → 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-zrk9k0n7.js → acp-targets-23exz4z4.js} +10 -10
- package/dist/{actions-acqqj9jn.js → actions-zcr25x27.js} +61 -40
- package/dist/{agent-fs-provision-zmaykqnd.js → agent-fs-provision-7fa9e12e.js} +4 -4
- package/dist/{amp-adapter-a7ts8tmw.js → amp-adapter-s7ytmv6b.js} +3 -3
- package/dist/{anthropic-messages-88b7s3n9.js → anthropic-messages-vdd1zmha.js} +10 -10
- package/dist/{app-tmwa442h.js → app-5d3sz1hy.js} +7 -7
- package/dist/{approval-notifications-6psaaaye.js → approval-notifications-7qgkzkzx.js} +8 -8
- package/dist/{assistant-564v6emv.js → assistant-p2yvhc3j.js} +37 -32
- package/dist/{boot-args-schema-n099e0f2.js → boot-args-schema-ry6cb0p7.js} +1 -1
- package/dist/{boot-reembed-epvg4fp9.js → boot-reembed-2hkm3vz2.js} +1 -1
- package/dist/{boot-reembed-chx66qfk.js → boot-reembed-c9643ms3.js} +1 -1
- package/dist/{boot-scrub-sweep-dhkfp0a7.js → boot-scrub-sweep-3ycxr51t.js} +2 -2
- package/dist/{boot-seeds-m74fc07r.js → boot-seeds-2hzvvzg0.js} +4 -4
- package/dist/{boxd-451q55ys.js → boxd-9py3x0jb.js} +2 -2
- package/dist/{claude-adapter-hw63yj3j.js → claude-adapter-dnkww93e.js} +9 -9
- package/dist/{claude-managed-adapter-z5s7fx6p.js → claude-managed-adapter-yk0cr5x6.js} +4 -4
- package/dist/{claude-managed-setup-wee1762m.js → claude-managed-setup-4byxpp47.js} +5 -5
- package/dist/{claude-sdk-session-cktyqkpk.js → claude-sdk-session-4wf3dbvs.js} +13163 -12195
- package/dist/{cli-5rxsb3wq.js → cli-096aftq6.js} +12 -7
- package/dist/{cli-5rgm8p39.js → cli-0e914dp9.js} +3 -3
- package/dist/{cli-bzcwwebm.js → cli-0h6m6z5g.js} +1 -1
- package/dist/{cli-cah298e5.js → cli-0k7ppk9k.js} +231 -124
- package/dist/{cli-ja450998.js → cli-1nfabrt4.js} +8 -8
- package/dist/{cli-jzerrzgc.js → cli-2414h5r9.js} +8 -8
- package/dist/{cli-b768ek79.js → cli-24wervhz.js} +38 -0
- package/dist/{cli-93n305hm.js → cli-2ayk9gn8.js} +2 -2
- package/dist/{cli-kr0jpw9c.js → cli-2ckwgs7q.js} +1 -1
- package/dist/{cli-d5pc8ep0.js → cli-2savn6mm.js} +11 -100
- package/dist/{cli-jbrc98qb.js → cli-2zjxake1.js} +4 -4
- package/dist/{cli-4q2c8rxw.js → cli-37p61fcg.js} +15 -9
- package/dist/{cli-2vp0z049.js → cli-39t9d248.js} +1 -1
- package/dist/{cli-sa02jsqt.js → cli-3mhdmcd4.js} +1 -1
- package/dist/{cli-x2cem5vy.js → cli-3wsabyt0.js} +2 -2
- package/dist/{cli-dqgnbnxs.js → cli-466jjrwe.js} +16 -2
- package/dist/{cli-zhwjdhjr.js → cli-6ajyhxh7.js} +2 -2
- package/dist/{cli-3bxrrh53.js → cli-6yy4fepf.js} +4 -4
- package/dist/{cli-hhtbandk.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-m1sns1da.js → cli-7w1fs01q.js} +2 -2
- package/dist/{cli-xwsm6xkr.js → cli-84wxwt3z.js} +1 -1
- package/dist/{cli-qzz6tz8s.js → cli-84xn7bgz.js} +1 -1
- package/dist/{cli-49aq3cyn.js → cli-879txsac.js} +5 -5
- package/dist/{cli-bv4vvnmg.js → cli-8vbxjzk0.js} +3 -3
- package/dist/{cli-7by7vp6m.js → cli-91amj3md.js} +3 -3
- package/dist/{cli-60dwk8tx.js → cli-930zbczq.js} +3 -3
- package/dist/{cli-7g3fg4gf.js → cli-9fwznq4p.js} +10 -10
- package/dist/{cli-4pbwg7sn.js → cli-9j1t3kf6.js} +2 -2
- package/dist/{cli-tzw1jr2t.js → cli-9j47sgzy.js} +2 -2
- package/dist/{cli-0fgvnb0x.js → cli-ad00h1st.js} +7 -7
- package/dist/{cli-kj84fqxz.js → cli-adzmmcvf.js} +19 -7
- package/dist/{cli-3tzmh38q.js → cli-ayxxkk3p.js} +68 -25
- package/dist/{cli-4vynxtrb.js → cli-bqfx72e6.js} +10 -3
- package/dist/{cli-8cas2xvp.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-jg5txpm6.js → cli-dy754erz.js} +83 -1
- package/dist/{cli-tsc3pdfd.js → cli-edxfzgah.js} +4 -4
- package/dist/{cli-hyqksecw.js → cli-ejnhs815.js} +15 -15
- package/dist/{cli-k0nebh10.js → cli-enavhq6r.js} +1 -1
- package/dist/{cli-ea7nz50q.js → cli-f2rwt43y.js} +14 -14
- package/dist/{cli-zjdhrzm0.js → cli-f9g96z28.js} +8 -8
- package/dist/{cli-rmgvwcmy.js → cli-fww016hh.js} +534 -70
- package/dist/{cli-rv3y60bt.js → cli-g6a696c0.js} +4 -4
- package/dist/{cli-z1vam71h.js → cli-gc6b94tj.js} +2 -2
- package/dist/{cli-p436yrzp.js → cli-gcyws2bp.js} +2 -2
- package/dist/{cli-srktrbby.js → cli-hzhv7yac.js} +1 -1
- package/dist/{cli-0p76my9q.js → cli-jcnc5ret.js} +44 -32
- package/dist/{cli-tr19nyn9.js → cli-jgq9xptq.js} +7 -7
- package/dist/{cli-pz1dp12c.js → cli-jwnac23b.js} +1 -1
- package/dist/{cli-904wk98s.js → cli-kc7vd07m.js} +917 -350
- package/dist/{cli-t0jmkcah.js → cli-kg63yp1r.js} +14 -14
- package/dist/{cli-ts5yv7dn.js → cli-krk8y8c7.js} +835 -157
- package/dist/{cli-jyhbvdga.js → cli-m0ea8ggd.js} +8 -10
- package/dist/{cli-944w9wb4.js → cli-md4tn21h.js} +20 -15
- package/dist/{cli-zexwhj3f.js → cli-mv8ft7b0.js} +10 -9
- package/dist/{cli-phdzn699.js → cli-mw1tmn3x.js} +217 -27
- package/dist/{cli-5ashycw3.js → cli-njvpngc6.js} +3 -3
- package/dist/{cli-9ah37a8a.js → cli-phe2vcw5.js} +10 -7
- package/dist/{cli-eds5xnsz.js → cli-phmy14hb.js} +2 -2
- package/dist/{cli-n1kjs58m.js → cli-pq0kv31y.js} +5 -5
- package/dist/{cli-pz1nq5xm.js → cli-q457ga28.js} +6 -6
- package/dist/{cli-s33bzmk0.js → cli-q5n3deaf.js} +1 -1
- package/dist/{cli-4fpa0zns.js → cli-qkbevqer.js} +3 -3
- package/dist/{cli-29h5239w.js → cli-qrwjk4xy.js} +5 -5
- package/dist/{cli-kezzteka.js → cli-r04ve9xw.js} +1 -1
- package/dist/{cli-3xqad83h.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-fkpnx3vf.js → cli-rs1rzwp4.js} +3 -2
- package/dist/{cli-h9d3sdnc.js → cli-rzbsh6bw.js} +1 -1
- package/dist/{cli-94gx6ze9.js → cli-s4pccby1.js} +1 -1
- package/dist/{cli-cq4am6vg.js → cli-shyhb4t5.js} +10 -10
- package/dist/{cli-gtj12v95.js → cli-srq69pn1.js} +1 -1
- package/dist/{cli-azj9t1f9.js → cli-tc165vrb.js} +48 -5
- package/dist/{cli-gse7bp3z.js → cli-v4z5v3jd.js} +300 -81
- package/dist/{cli-p3knvk62.js → cli-vxmmttmt.js} +132 -53
- package/dist/{cli-404am6f3.js → cli-w4bvtxet.js} +7 -7
- package/dist/{cli-gkv0r2hq.js → cli-wd7b5hgc.js} +71 -9
- package/dist/{cli-akm6y2a8.js → cli-wvbaq052.js} +1 -1
- package/dist/{cli-ywy8yz6t.js → cli-wvgg7r4j.js} +2 -2
- package/dist/{cli-ka48vpev.js → cli-wym6rxgt.js} +165 -6
- package/dist/{cli-nc4pbwmp.js → cli-yd7e590v.js} +12 -12
- package/dist/{cli-3zrwrnz7.js → cli-yjb3cddd.js} +1 -1
- package/dist/{cli-7gbff32z.js → cli-z8t4485r.js} +2 -2
- package/dist/{cli-hdhpdrka.js → cli-ze1ndjs4.js} +4 -6
- package/dist/{cli-50wa8k4h.js → cli-zy9bb22b.js} +1 -2
- package/dist/cli.js +28 -28
- package/dist/{codex-adapter-2fs2c0n6.js → codex-adapter-eq61radw.js} +8 -8
- package/dist/{codex-hook-jxjv6dy5.js → codex-hook-8nmepvz6.js} +3 -3
- package/dist/{codex-login-ktfg1cxk.js → codex-login-vbd9707w.js} +1 -1
- package/dist/{codex-session-runner-r55tmx4c.js → codex-session-runner-rfx355h4.js} +9 -9
- package/dist/{commands-0mxdy9x8.js → commands-d1z0sx62.js} +3 -3
- package/dist/{controller-g3vkfhr4.js → controller-9hz6d8x3.js} +4 -4
- package/dist/{controllers-connect-4wdmncqt.js → controllers-connect-tz07d2xr.js} +24 -25
- package/dist/core-dynsv289.js +41 -0
- package/dist/{cursor-adapter-t9qb96q2.js → cursor-adapter-ef22ze3j.js} +2 -2
- package/dist/{db-487vvyv9.js → db-gd81d68c.js} +3 -3
- package/dist/{db-76p7w3gr.js → db-vrckks6q.js} +4 -2
- package/dist/{devin-adapter-3bp6rape.js → devin-adapter-kdt6a2bh.js} +1 -1
- package/dist/{dispatcher-64rp6w67.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-dc8f6ctq.js → e2b-05kn3kpq.js} +16 -5
- package/dist/{e2b-3ykbe805.js → e2b-dm9r8hpy.js} +3 -3
- package/dist/{easter-egg-3d-jrrwyf55.js → easter-egg-3d-sg21j15g.js} +1 -1
- package/dist/{embedding-space-001hhhpk.js → embedding-space-zsdw37bb.js} +13 -23
- package/dist/{embeddings-esj19cnw.js → embeddings-p4e3e1m6.js} +1 -1
- package/dist/{event-bus-7gbsr0g4.js → event-bus-tvf2grf4.js} +1 -1
- package/dist/{execute-301hkxqg.js → execute-nztd0af0.js} +1 -1
- package/dist/{external-channel-w10e2j05.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-tbrj7vhq.js → heartbeat-vfb1gy84.js} +24 -25
- package/dist/{hook-tx917rqw.js → hook-ctz0xmp3.js} +11 -11
- package/dist/{hook-3am1sq68.js → hook-eh52p7yd.js} +6 -6
- package/dist/{http-3rmemtqy.js → http-zregegrx.js} +902 -198
- package/dist/{index-s7xtvc0f.js → index-5kx15d19.js} +1 -1
- package/dist/index-7w8p6em0.js +41 -0
- package/dist/index-evay0xyk.js +17 -0
- package/dist/{index-2jw11t8s.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-gfnq66t1.js → index-x9qf8dg7.js} +294 -29
- package/dist/index-y3s0xp2v.js +43 -0
- package/dist/{k8s-36gfn847.js → k8s-ejkk0aw7.js} +2 -2
- package/dist/{keepalive-9px3t7qj.js → keepalive-zdqay870.js} +4 -5
- package/dist/lead-6cscw8a5.js +82 -0
- package/dist/{maintenance-vwqjwst6.js → maintenance-t5ndg11m.js} +1 -1
- package/dist/{node-2wfcey7d.js → node-0as4n1ef.js} +3 -3
- package/dist/{node-zd6shky9.js → node-dhxbt01p.js} +3 -3
- package/dist/{node-z67yjre7.js → node-jkdd5w7m.js} +290 -70
- package/dist/{node-hjn5n1yp.js → node-t0ct2zpw.js} +3 -5
- package/dist/{oauth-refresh-sweep-yqry3wn4.js → oauth-refresh-sweep-y9zyd7t6.js} +3 -4
- package/dist/{object-webhooks-8s1wtths.js → object-webhooks-mkca91s0.js} +7 -7
- package/dist/{onboard-hb8czx0p.js → onboard-ss995244.js} +11 -9
- package/dist/{opencode-adapter-djd6m6dk.js → opencode-adapter-mwpz0278.js} +8 -8
- package/dist/{otel-impl-2ymwyczz.js → otel-impl-6n6vva3x.js} +2 -2
- package/dist/{pending-nxavtvx7.js → pending-2sxh1t6j.js} +22 -23
- package/dist/{pi-mono-adapter-d2cpmcy4.js → pi-mono-adapter-sfb7zy43.js} +13 -13
- package/dist/{pricing-refresh-1yz8jkqv.js → pricing-refresh-h79bg4cf.js} +2 -2
- package/dist/{rbac-roles-7s6m31xw.js → rbac-roles-ckq0czp4.js} +2 -2
- package/dist/{rbac-roles-dbpx0x9v.js → rbac-roles-jg2e260w.js} +3 -3
- package/dist/{render-v2-7y20rjrn.js → render-v2-ymbshmn0.js} +7 -7
- package/dist/{resume-wz546x47.js → resume-jdhnt4jk.js} +10 -10
- package/dist/{runtime-cb5bd9tz.js → runtime-y28jhhnf.js} +1 -1
- package/dist/{session-access-4vcft8kq.js → session-access-k4ta5hvp.js} +5 -5
- package/dist/{session-source-backfill-57b50tpw.js → session-source-backfill-528j4s8j.js} +3 -3
- package/dist/{setup-e1tevjyj.js → setup-d6pj82fr.js} +15 -6
- package/dist/thread-buffer-9w6x5zec.js +40 -0
- package/dist/{tree-visibility-07wf1nct.js → tree-visibility-kjxv3nxk.js} +2 -2
- package/dist/{user-merge-jobs-n20qpv6s.js → user-merge-jobs-rabbncf6.js} +3 -3
- package/dist/{virtual-modules-6fxmn1yv.js → virtual-modules-22k51txd.js} +3 -3
- package/dist/{work-objects-eg7y48pe.js → work-objects-xtjbar3r.js} +26 -30
- package/dist/{worker-follow-up-jnvnnf2b.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 +633 -25
- 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/apps/sync.ts +20 -5
- package/src/azure-devops/boards-sync.ts +1 -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 +38 -1
- package/src/be/db/task-idempotency.ts +63 -0
- package/src/be/db/tasks/read.ts +27 -1
- package/src/be/db/tasks/write.ts +51 -14
- package/src/be/db/users/avatar.ts +12 -0
- package/src/be/db/workflow-idempotency.ts +6 -1
- package/src/be/db/workflows/read.ts +79 -0
- package/src/be/db.ts +129 -152
- 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/344_user_avatar.sql +4 -0
- package/src/be/migrations/345_task_status_kind.sql +6 -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/primitives/object-embed.ts +2 -2
- package/src/be/primitives/objects.ts +2 -2
- package/src/be/repo-checked-update.ts +58 -5
- package/src/be/requester-timezone.ts +10 -0
- package/src/be/runtime-pools/supervisor.ts +1 -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 +33 -8
- 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 +91 -7
- package/src/be/users.ts +33 -12
- package/src/bitbucket/handlers.ts +1 -1
- package/src/comb/review-batch.ts +16 -5
- package/src/commands/context-preamble.ts +237 -0
- package/src/commands/credential-outcome-report.ts +96 -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 +72 -10
- package/src/commands/setup.tsx +17 -3
- package/src/event-waits/github.ts +39 -6
- package/src/event-waits/index.ts +4 -2
- package/src/event-waits/types.ts +10 -3
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/github/app.ts +177 -13
- package/src/github/handlers.ts +7 -2
- package/src/github/pull-request-state.ts +100 -11
- package/src/gitlab/handlers.ts +2 -2
- package/src/heartbeat/heartbeat.ts +6 -1
- package/src/hooks/hook.ts +8 -2
- package/src/hooks/native-tool-hooks.ts +4 -2
- package/src/http/api-keys.ts +26 -0
- package/src/http/apps.ts +82 -42
- package/src/http/asset-key-write.ts +45 -0
- package/src/http/assets.ts +4 -3
- package/src/http/comb.ts +21 -5
- package/src/http/config.ts +8 -4
- package/src/http/github-token.ts +27 -6
- 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/pages.ts +4 -10
- package/src/http/repos.ts +27 -11
- package/src/http/request-principal.ts +27 -1
- package/src/http/schedules.ts +42 -14
- 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/sessions.ts +7 -2
- package/src/http/skills.ts +70 -0
- package/src/http/status.ts +2 -0
- package/src/http/tasks.ts +115 -19
- package/src/http/trackers/jira.ts +18 -3
- package/src/http/trackers/linear.ts +3 -0
- package/src/http/users.ts +5 -0
- package/src/http/webhooks.ts +19 -1
- package/src/http/workflows.ts +5 -10
- package/src/integrations/chat-sdk/commands.ts +3 -1
- package/src/jira/sync.ts +1 -1
- package/src/kv-limits.ts +2 -0
- package/src/kv-reserved-namespaces.ts +25 -2
- package/src/linear/sync.ts +5 -3
- package/src/prompts/session-templates.ts +50 -0
- package/src/prompts/session-turns.ts +30 -0
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +5 -0
- package/src/providers/claude-managed-adapter.ts +14 -0
- package/src/providers/claude-sdk-session.ts +19 -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/deferred-task-waits.ts +74 -13
- 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 +12 -2
- package/src/scripts-runtime/types/stdlib.d.ts +27 -1
- package/src/scripts-runtime/types/swarm-extension.d.ts +20 -2
- package/src/scripts-runtime/types/swarm-sdk.d.ts +27 -1
- package/src/slack/actions.ts +25 -1
- 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 +403 -17
- 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/api-drain-worker-e2e.test.ts +0 -2
- package/src/tests/approval-auto-cancellation-migration.test.ts +8 -19
- package/src/tests/approval-card-resolution.test.ts +2 -17
- package/src/tests/approval-requests-notifications.test.ts +41 -27
- package/src/tests/approval-requests.test.ts +137 -369
- package/src/tests/apps-script-types.test.ts +63 -16
- package/src/tests/apps-sort-order.test.ts +87 -0
- package/src/tests/apps-sync-engine.test.ts +5 -3
- package/src/tests/apps-table-filters-migration.test.ts +44 -25
- package/src/tests/bedrock-model-groups.test.ts +4 -0
- package/src/tests/bitbucket-handlers.test.ts +2 -0
- package/src/tests/channel-activity.test.ts +9 -0
- package/src/tests/chat-sdk-commands.test.ts +1 -0
- package/src/tests/chatgpt-subscription-model-groups.test.ts +4 -0
- package/src/tests/claude-adapter.test.ts +35 -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-adapter.test.ts +3 -92
- package/src/tests/codex-gpt6-release.test.ts +4 -9
- package/src/tests/codex-oauth-credential-info.test.ts +35 -18
- package/src/tests/codex-oauth.test.ts +0 -6
- package/src/tests/codex-pool.test.ts +5 -214
- package/src/tests/codex-rate-limit-parse.test.ts +0 -7
- package/src/tests/codex-swarm-events.test.ts +11 -54
- package/src/tests/comb-review-batch.test.ts +17 -4
- package/src/tests/comb-status.test.ts +1 -0
- package/src/tests/db-client-busy-retry.test.ts +49 -16
- 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 +24 -1
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/e2b-dispatch.test.ts +13 -1
- package/src/tests/e2e-shards.test.ts +9 -9
- package/src/tests/enabled-tools.test.ts +0 -2
- package/src/tests/entrypoint-mcp-config.test.ts +642 -0
- package/src/tests/fixtures/base-prompt-baseline.json +6 -6
- 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/github-app-worker-auth-helper.test.ts +147 -1
- package/src/tests/gitlab-handlers.test.ts +2 -0
- package/src/tests/heartbeat-jev-gate.test.ts +9 -241
- package/src/tests/heartbeat-reroute-decision.test.ts +2 -0
- package/src/tests/heartbeat-supersede-resume.test.ts +2 -0
- package/src/tests/heartbeat.test.ts +1 -0
- 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/key-usage-selection.test.ts +302 -0
- package/src/tests/memory-e2e.test.ts +34 -103
- package/src/tests/memory-key-paths.test.ts +5 -0
- package/src/tests/memory-rater-llm.test.ts +33 -149
- package/src/tests/memory-store.test.ts +24 -125
- package/src/tests/memory.test.ts +31 -100
- package/src/tests/merge-gate-detect-changes.test.ts +108 -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/otel-service-name.test.ts +0 -9
- package/src/tests/otel-session-cost-metrics.test.ts +1 -38
- package/src/tests/pool-session-logs.test.ts +8 -42
- package/src/tests/pre-push-affected-tests.test.ts +106 -0
- package/src/tests/prompt-template-session.test.ts +3 -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-api-drain.test.ts +2 -17
- package/src/tests/runner-context-preamble.test.ts +202 -0
- package/src/tests/runner-repo-clone-args.test.ts +116 -0
- package/src/tests/runner-terminal-window-report.test.ts +132 -0
- package/src/tests/runtime-supervisor-failures.test.ts +1 -0
- package/src/tests/sandboxed-process.test.ts +26 -21
- package/src/tests/schedule-http-triage-tools.test.ts +12 -9
- package/src/tests/scheduled-tasks.test.ts +14 -51
- 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/script-executor-conformance.test.ts +4 -48
- package/src/tests/script-executor-quickjs-pool.test.ts +9 -7
- package/src/tests/script-native-startup.test.ts +21 -25
- package/src/tests/scripts-namespaces.test.ts +3 -1
- package/src/tests/secret-rules.test.ts +4 -2
- 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-logs.test.ts +1 -260
- 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 +14 -152
- 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/task-cascade-fail.test.ts +1 -0
- package/src/tests/task-supersede-resume.test.ts +1 -0
- package/src/tests/test-proc.ts +5 -2
- package/src/tests/ui-spec-script-actions-config.test.ts +7 -3
- package/src/tests/window-stream-reporter.test.ts +122 -0
- package/src/tests/workflow-agent-task-retry.test.ts +1 -3
- package/src/tests/workflow-cascade-cancel.test.ts +1 -0
- package/src/tests/workflow-retry-v2.test.ts +34 -43
- package/src/tests/workflow-retry-validation.test.ts +8 -48
- package/src/tests/workflow-triggers-v2.test.ts +35 -11
- package/src/tests/worktree-reaper.test.ts +2 -2
- package/src/tools/app-patch.ts +6 -2
- package/src/tools/app-upsert.ts +8 -4
- package/src/tools/cancel-task.ts +2 -2
- package/src/tools/defer-task.ts +24 -79
- package/src/tools/get-task-details.ts +8 -4
- package/src/tools/get-tasks.ts +13 -2
- 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/manage-user.ts +9 -0
- 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/store-progress.ts +5 -3
- 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 +101 -2
- package/src/utils/constants.ts +32 -0
- package/src/utils/credentials.ts +42 -5
- package/src/utils/deferral-time.ts +61 -0
- package/src/utils/error-tracker.ts +6 -0
- package/src/utils/key-usage.ts +114 -0
- package/src/utils/request-auth-context.ts +15 -16
- package/src/utils/sandboxed-process.ts +1 -0
- 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/resume.ts +5 -2
- 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 +6 -2
- package/templates/skills/apps/content.md +6 -2
- package/templates/skills/boards-and-sheets/content.md +4 -2
- package/templates/skills/code-quality/content.md +4 -4
- package/templates/skills/pages/content.md +7 -0
- 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 +8 -0
- package/templates/skills/swarm-scripts/SKILL.md +45 -0
- package/templates/skills/swarm-scripts/content.md +45 -0
- package/dist/acp-adapter-mr4temec.js +0 -17
- package/dist/cli-1vmhnncj.js +0 -173
- package/dist/cli-kj0hyr43.js +0 -51
- package/dist/cli-ysv0k1we.js +0 -459
- package/dist/core-gsvj5f3z.js +0 -42
- package/dist/dsh-adapter-8abzqk5c.js +0 -9
- package/dist/fx-adapter-4sjrbdne.js +0 -20
- package/dist/grok-adapter-3a0ezfee.js +0 -20
- package/dist/handlers-ef3k11hb.js +0 -41
- package/dist/index-aetfyx6p.js +0 -13
- package/dist/index-e6bq0exk.js +0 -42
- package/dist/index-hf2k1vge.js +0 -39
- package/dist/index-taxmejj3.js +0 -44
- package/dist/lead-5vt6f174.js +0 -83
- package/dist/thread-buffer-686pa1p1.js +0 -42
- package/dist/worker-4vp616ms.js +0 -83
- package/src/tests/apps-table-selection-migration.test.ts +0 -95
- package/src/tests/extensions-example-heartbeat-remediate.test.ts +0 -69
- package/src/tests/extensions-example-rewrite-and-suppress.test.ts +0 -70
|
@@ -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,8 +715,11 @@ import {
|
|
|
691
715
|
init_event_waits,
|
|
692
716
|
stripSiblingBlock,
|
|
693
717
|
init_sibling_block,
|
|
718
|
+
prepareTaskWithSiblingAwareness,
|
|
694
719
|
createTaskWithSiblingAwareness,
|
|
695
720
|
init_sibling_awareness,
|
|
721
|
+
hasPendingEventWait,
|
|
722
|
+
init_deferred_task_waits,
|
|
696
723
|
dispatchScheduleTarget,
|
|
697
724
|
calculateNextRun2,
|
|
698
725
|
init_scheduler,
|
|
@@ -898,6 +925,7 @@ import {
|
|
|
898
925
|
agentFirstPrincipal,
|
|
899
926
|
requireAuthKind,
|
|
900
927
|
rejectGuest,
|
|
928
|
+
refuseAgentTokenWithout,
|
|
901
929
|
init_request_principal,
|
|
902
930
|
nextFallback2,
|
|
903
931
|
createWorkerTaskFollowUp2,
|
|
@@ -997,7 +1025,10 @@ import {
|
|
|
997
1025
|
reservedNamespaceError,
|
|
998
1026
|
privateNamespaceError,
|
|
999
1027
|
reservedRoomKeyError,
|
|
1028
|
+
scrubReservedRead,
|
|
1000
1029
|
init_kv_reserved_namespaces,
|
|
1030
|
+
MAX_KV_BODY_BYTES,
|
|
1031
|
+
init_kv_limits,
|
|
1001
1032
|
updateMcpServerChecked,
|
|
1002
1033
|
init_mcp_server_checked_update,
|
|
1003
1034
|
updateTouchesStdioExecution,
|
|
@@ -1022,6 +1053,7 @@ import {
|
|
|
1022
1053
|
init_config3,
|
|
1023
1054
|
changesMergePolicy,
|
|
1024
1055
|
init_repo_merge_policy,
|
|
1056
|
+
execConfigRefusal,
|
|
1025
1057
|
updateSwarmRepoChecked,
|
|
1026
1058
|
init_repo_checked_update,
|
|
1027
1059
|
getCombConfig,
|
|
@@ -1112,6 +1144,7 @@ import {
|
|
|
1112
1144
|
init_model_validation,
|
|
1113
1145
|
patchWorkflowDefinition,
|
|
1114
1146
|
init_patch_definition,
|
|
1147
|
+
IDEMPOTENT_REPLAYED_HEADER,
|
|
1115
1148
|
idempotencyKeyHeader,
|
|
1116
1149
|
readIdempotencyKey,
|
|
1117
1150
|
replayAcceptedOperation,
|
|
@@ -1123,7 +1156,7 @@ import {
|
|
|
1123
1156
|
getEnabledCapabilities,
|
|
1124
1157
|
createServer,
|
|
1125
1158
|
init_server
|
|
1126
|
-
} from "./cli-
|
|
1159
|
+
} from "./cli-kc7vd07m.js";
|
|
1127
1160
|
import {
|
|
1128
1161
|
getFileStorageProvider2,
|
|
1129
1162
|
init_registry2
|
|
@@ -1149,7 +1182,7 @@ import {
|
|
|
1149
1182
|
resolvePoolDelivery2,
|
|
1150
1183
|
createPoolAgent2,
|
|
1151
1184
|
init_db2
|
|
1152
|
-
} from "./cli-
|
|
1185
|
+
} from "./cli-qrwjk4xy.js";
|
|
1153
1186
|
import {
|
|
1154
1187
|
warnIfCorsAllowsAnyOrigin,
|
|
1155
1188
|
isOriginAllowedForCredentials,
|
|
@@ -1198,7 +1231,7 @@ import {
|
|
|
1198
1231
|
describeRequestRoute,
|
|
1199
1232
|
route,
|
|
1200
1233
|
init_route_def
|
|
1201
|
-
} from "./cli-
|
|
1234
|
+
} from "./cli-w4bvtxet.js";
|
|
1202
1235
|
import {
|
|
1203
1236
|
startPoolRouting,
|
|
1204
1237
|
stopPoolRouting,
|
|
@@ -1211,29 +1244,29 @@ import {
|
|
|
1211
1244
|
checkHeartbeatChecklist2,
|
|
1212
1245
|
runHeartbeatSweep2,
|
|
1213
1246
|
stopHeartbeat2
|
|
1214
|
-
} from "./cli-
|
|
1215
|
-
import"./cli-
|
|
1247
|
+
} from "./cli-md4tn21h.js";
|
|
1248
|
+
import"./cli-gcyws2bp.js";
|
|
1216
1249
|
import {
|
|
1217
1250
|
runtimeSupervisorStatus,
|
|
1218
1251
|
startRuntimeSupervisor,
|
|
1219
1252
|
stopRuntimeSupervisor
|
|
1220
|
-
} from "./cli-
|
|
1253
|
+
} from "./cli-f2rwt43y.js";
|
|
1221
1254
|
import {
|
|
1222
1255
|
TASK_TITLE_TIMEOUT_MS,
|
|
1223
1256
|
generateTaskTitle
|
|
1224
|
-
} from "./cli-
|
|
1257
|
+
} from "./cli-8vbxjzk0.js";
|
|
1225
1258
|
import"./cli-ns59dc6r.js";
|
|
1226
1259
|
import {
|
|
1227
1260
|
ACP_TARGET_IDS
|
|
1228
|
-
} from "./cli-
|
|
1261
|
+
} from "./cli-enavhq6r.js";
|
|
1229
1262
|
import {
|
|
1230
1263
|
reasoningCapability,
|
|
1231
1264
|
supportedReasoningLevels
|
|
1232
|
-
} from "./cli-
|
|
1265
|
+
} from "./cli-wvgg7r4j.js";
|
|
1233
1266
|
import {
|
|
1234
1267
|
MAX_RATE_LIMIT_RESET_MS,
|
|
1235
1268
|
MAX_SPEND_CAP_HOLD_MS
|
|
1236
|
-
} from "./cli-
|
|
1269
|
+
} from "./cli-rs1rzwp4.js";
|
|
1237
1270
|
import {
|
|
1238
1271
|
AgentFsRequestError2,
|
|
1239
1272
|
resolveAgentFsSharedContext2,
|
|
@@ -1244,10 +1277,10 @@ import {
|
|
|
1244
1277
|
agentFsRequest2,
|
|
1245
1278
|
resolveApiUrl2,
|
|
1246
1279
|
init_agent_fs_provision
|
|
1247
|
-
} from "./cli-
|
|
1280
|
+
} from "./cli-930zbczq.js";
|
|
1248
1281
|
import {
|
|
1249
1282
|
Anthropic
|
|
1250
|
-
} from "./cli-
|
|
1283
|
+
} from "./cli-0k7ppk9k.js";
|
|
1251
1284
|
import {
|
|
1252
1285
|
isLeadChannelMonitoringEnabled,
|
|
1253
1286
|
SIMILARITY_THRESHOLD,
|
|
@@ -1255,13 +1288,19 @@ import {
|
|
|
1255
1288
|
isUnknownModelError,
|
|
1256
1289
|
checkProviderPoolKey,
|
|
1257
1290
|
writeSkillsToFilesystem
|
|
1258
|
-
} from "./cli-
|
|
1291
|
+
} from "./cli-ze1ndjs4.js";
|
|
1259
1292
|
import {
|
|
1260
1293
|
objectWebhookSecret2,
|
|
1261
1294
|
handleObjectWebhookEvent2,
|
|
1262
1295
|
init_object_webhooks
|
|
1263
|
-
} from "./cli-
|
|
1264
|
-
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";
|
|
1265
1304
|
import {
|
|
1266
1305
|
createUserMergeJob2,
|
|
1267
1306
|
getUserMergeJob2,
|
|
@@ -1270,7 +1309,7 @@ import {
|
|
|
1270
1309
|
findFailedUserMergeJob2,
|
|
1271
1310
|
requeueUserMergeJob2,
|
|
1272
1311
|
runUserMergeJobs2
|
|
1273
|
-
} from "./cli-
|
|
1312
|
+
} from "./cli-njvpngc6.js";
|
|
1274
1313
|
import {
|
|
1275
1314
|
isCodexOAuthConfigKey
|
|
1276
1315
|
} from "./cli-j4bwnpkm.js";
|
|
@@ -1300,8 +1339,8 @@ import {
|
|
|
1300
1339
|
init_person_responder,
|
|
1301
1340
|
handleApprovalRequests,
|
|
1302
1341
|
init_approval_requests
|
|
1303
|
-
} from "./cli-
|
|
1304
|
-
import"./cli-
|
|
1342
|
+
} from "./cli-ejnhs815.js";
|
|
1343
|
+
import"./cli-q5n3deaf.js";
|
|
1305
1344
|
import {
|
|
1306
1345
|
RATING_MODEL_MAX_LENGTH,
|
|
1307
1346
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
@@ -1357,14 +1396,19 @@ import {
|
|
|
1357
1396
|
init_oauth_credential_bindings,
|
|
1358
1397
|
buildScriptCredentialBindingsWithFailures,
|
|
1359
1398
|
init_script_credential_broker,
|
|
1399
|
+
DEFAULT_SANDBOX_LIMITS,
|
|
1400
|
+
resolveSandboxIdentity,
|
|
1360
1401
|
buildSandboxedCommand,
|
|
1361
1402
|
sandboxSpawnEnv,
|
|
1362
1403
|
readStreamCapped,
|
|
1363
1404
|
init_sandboxed_process,
|
|
1405
|
+
readRunDirFile,
|
|
1406
|
+
init_native,
|
|
1364
1407
|
isExecutorAllowedByDeployment,
|
|
1365
1408
|
init_registry,
|
|
1366
1409
|
MIN_SCRIPT_WALL_CLOCK_MS,
|
|
1367
1410
|
MAX_SCRIPT_WALL_CLOCK_MS,
|
|
1411
|
+
DEFAULT_SCRIPT_RESOURCES,
|
|
1368
1412
|
init_types3,
|
|
1369
1413
|
HOST_VALIDATED_ARGS,
|
|
1370
1414
|
init_host_validated_args,
|
|
@@ -1397,7 +1441,7 @@ import {
|
|
|
1397
1441
|
init_typecheck,
|
|
1398
1442
|
parseSkillContent,
|
|
1399
1443
|
init_skill_parser
|
|
1400
|
-
} from "./cli-
|
|
1444
|
+
} from "./cli-v4z5v3jd.js";
|
|
1401
1445
|
import {
|
|
1402
1446
|
signalProcessGroup,
|
|
1403
1447
|
detachedProcessGroup,
|
|
@@ -1414,17 +1458,17 @@ import {
|
|
|
1414
1458
|
forceRefreshAuthorizationOrThrow,
|
|
1415
1459
|
forceRefreshTokenOrThrow,
|
|
1416
1460
|
init_ensure_token
|
|
1417
|
-
} from "./cli-
|
|
1461
|
+
} from "./cli-m0ea8ggd.js";
|
|
1418
1462
|
import {
|
|
1419
1463
|
PRIMITIVE_KINDS,
|
|
1420
1464
|
ObjectsError,
|
|
1421
1465
|
recordObjectVersion,
|
|
1422
1466
|
init_objects
|
|
1423
|
-
} from "./cli-
|
|
1467
|
+
} from "./cli-jgq9xptq.js";
|
|
1424
1468
|
import {
|
|
1425
1469
|
agentFsClientFor,
|
|
1426
1470
|
init_agent_fs_identity
|
|
1427
|
-
} from "./cli-
|
|
1471
|
+
} from "./cli-6ajyhxh7.js";
|
|
1428
1472
|
import {
|
|
1429
1473
|
FilesError,
|
|
1430
1474
|
normalizeFilesError,
|
|
@@ -1433,7 +1477,7 @@ import {
|
|
|
1433
1477
|
AgentFsProvider,
|
|
1434
1478
|
init_agent_fs_provider
|
|
1435
1479
|
} from "./cli-skd2c4ej.js";
|
|
1436
|
-
import"./cli-
|
|
1480
|
+
import"./cli-srq69pn1.js";
|
|
1437
1481
|
import {
|
|
1438
1482
|
automationIntegrationFixUrl,
|
|
1439
1483
|
preflightAutomation,
|
|
@@ -1455,7 +1499,7 @@ import {
|
|
|
1455
1499
|
definitionNodeIds,
|
|
1456
1500
|
validateDefinition,
|
|
1457
1501
|
init_definition2
|
|
1458
|
-
} from "./cli-
|
|
1502
|
+
} from "./cli-jcnc5ret.js";
|
|
1459
1503
|
import {
|
|
1460
1504
|
_fetchHolder,
|
|
1461
1505
|
CLIENT_ID,
|
|
@@ -1471,7 +1515,7 @@ import {
|
|
|
1471
1515
|
loadAllCodexOAuthSlots,
|
|
1472
1516
|
getValidCodexOAuth,
|
|
1473
1517
|
init_storage
|
|
1474
|
-
} from "./cli-
|
|
1518
|
+
} from "./cli-39t9d248.js";
|
|
1475
1519
|
import {
|
|
1476
1520
|
isMultiRuntimeEnabled,
|
|
1477
1521
|
init_multi_runtime2
|
|
@@ -1483,7 +1527,7 @@ import {
|
|
|
1483
1527
|
import {
|
|
1484
1528
|
createRuntimeProvider,
|
|
1485
1529
|
init_runtime_providers
|
|
1486
|
-
} from "./cli-
|
|
1530
|
+
} from "./cli-2zjxake1.js";
|
|
1487
1531
|
import {
|
|
1488
1532
|
require_content_type
|
|
1489
1533
|
} from "./cli-1jx0srjt.js";
|
|
@@ -1497,25 +1541,7 @@ import {
|
|
|
1497
1541
|
toSessionSharesState,
|
|
1498
1542
|
setSessionShares,
|
|
1499
1543
|
init_session_shares
|
|
1500
|
-
} from "./cli-
|
|
1501
|
-
import {
|
|
1502
|
-
isInvalidClientError,
|
|
1503
|
-
publicEndpointSsrfOptions,
|
|
1504
|
-
mcpOAuthSsrfOptions,
|
|
1505
|
-
discoverProtectedResourceMetadata,
|
|
1506
|
-
discoverAuthorizationServerMetadata,
|
|
1507
|
-
normalizeTokenEndpointAuthMethod,
|
|
1508
|
-
resolveAdvertisedTokenEndpointAuthMethod,
|
|
1509
|
-
authMethodForStoredClient,
|
|
1510
|
-
selectDcrTokenEndpointAuthMethod,
|
|
1511
|
-
registerClient,
|
|
1512
|
-
buildAuthorizeUrl,
|
|
1513
|
-
exchangeCodeForTokens,
|
|
1514
|
-
refreshMcpToken,
|
|
1515
|
-
revokeMcpToken,
|
|
1516
|
-
computeExpiresAt,
|
|
1517
|
-
init_mcp_wrapper
|
|
1518
|
-
} from "./cli-ysv0k1we.js";
|
|
1544
|
+
} from "./cli-jwnac23b.js";
|
|
1519
1545
|
import"./cli-v41kn3cd.js";
|
|
1520
1546
|
import {
|
|
1521
1547
|
import_websocket,
|
|
@@ -1551,7 +1577,7 @@ import {
|
|
|
1551
1577
|
revokeAllAgentSessionTokens,
|
|
1552
1578
|
fingerprintApiKey,
|
|
1553
1579
|
init_users
|
|
1554
|
-
} from "./cli-
|
|
1580
|
+
} from "./cli-adzmmcvf.js";
|
|
1555
1581
|
import {
|
|
1556
1582
|
CORE_TOOLS,
|
|
1557
1583
|
init_tool_config
|
|
@@ -1564,7 +1590,7 @@ import {
|
|
|
1564
1590
|
providerAccountTelemetrySchema,
|
|
1565
1591
|
rateLimitReplacementSchema,
|
|
1566
1592
|
init_provider_account_telemetry
|
|
1567
|
-
} from "./cli-
|
|
1593
|
+
} from "./cli-cg1q8ymp.js";
|
|
1568
1594
|
import {
|
|
1569
1595
|
CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
|
|
1570
1596
|
CODEX_AUTH_WATCH_NAMESPACE,
|
|
@@ -1579,7 +1605,7 @@ import {
|
|
|
1579
1605
|
IDENTITY_FIELD_BUDGETS,
|
|
1580
1606
|
IdentityFieldBudgetError,
|
|
1581
1607
|
init_identity_field_budget
|
|
1582
|
-
} from "./cli-
|
|
1608
|
+
} from "./cli-wym6rxgt.js";
|
|
1583
1609
|
import {
|
|
1584
1610
|
getSlackConfiguration,
|
|
1585
1611
|
init_config5
|
|
@@ -1601,13 +1627,16 @@ import {
|
|
|
1601
1627
|
isModelScopedWindow,
|
|
1602
1628
|
activeModelBlocks,
|
|
1603
1629
|
init_model_rate_limit_windows,
|
|
1630
|
+
CREDENTIAL_SELECTION_STRATEGIES,
|
|
1631
|
+
credentialSelectionStrategy,
|
|
1632
|
+
init_key_usage,
|
|
1604
1633
|
CREDENTIAL_POOL_VARS,
|
|
1605
1634
|
PROVIDER_CREDENTIAL_VARS,
|
|
1606
1635
|
getModelAwareCredentialVars,
|
|
1607
1636
|
splitCredentialPool,
|
|
1608
1637
|
selectCredential,
|
|
1609
1638
|
init_credentials2
|
|
1610
|
-
} from "./cli-
|
|
1639
|
+
} from "./cli-wd7b5hgc.js";
|
|
1611
1640
|
import {
|
|
1612
1641
|
interpolate,
|
|
1613
1642
|
init_template2,
|
|
@@ -1617,7 +1646,7 @@ import {
|
|
|
1617
1646
|
resolveTemplate,
|
|
1618
1647
|
init_resolver,
|
|
1619
1648
|
init_session_templates
|
|
1620
|
-
} from "./cli-
|
|
1649
|
+
} from "./cli-24wervhz.js";
|
|
1621
1650
|
import {
|
|
1622
1651
|
getOpenRouterAttributionHeaders,
|
|
1623
1652
|
init_openrouter_base_url
|
|
@@ -1650,6 +1679,7 @@ import {
|
|
|
1650
1679
|
AgentTaskStatusSchema,
|
|
1651
1680
|
TERMINAL_TASK_STATUSES,
|
|
1652
1681
|
isTerminalTaskStatus,
|
|
1682
|
+
TaskStatusKindSchema,
|
|
1653
1683
|
AgentTaskSourceSchema,
|
|
1654
1684
|
RoutingReasonSchema,
|
|
1655
1685
|
ProviderNameSchema,
|
|
@@ -1687,6 +1717,7 @@ import {
|
|
|
1687
1717
|
TaskTemplateSchema,
|
|
1688
1718
|
AgentStatusSchema,
|
|
1689
1719
|
AgentAvatarSchema,
|
|
1720
|
+
UserAvatarSchema,
|
|
1690
1721
|
AgentSlackIconSchema,
|
|
1691
1722
|
AgentSchema,
|
|
1692
1723
|
AgentHistoryEventSchema,
|
|
@@ -1796,7 +1827,7 @@ import {
|
|
|
1796
1827
|
KvKeySchema,
|
|
1797
1828
|
KvEntrySchema,
|
|
1798
1829
|
init_types5
|
|
1799
|
-
} from "./cli-
|
|
1830
|
+
} from "./cli-tc165vrb.js";
|
|
1800
1831
|
import {
|
|
1801
1832
|
init_zod
|
|
1802
1833
|
} from "./cli-96234j5w.js";
|
|
@@ -1833,14 +1864,16 @@ import {
|
|
|
1833
1864
|
getAppUrl,
|
|
1834
1865
|
getLocalDevAppOrigins,
|
|
1835
1866
|
getMcpBaseUrl,
|
|
1867
|
+
setApiLoopbackBaseUrl,
|
|
1868
|
+
getScriptApiBaseUrl,
|
|
1836
1869
|
getPublicMcpBaseUrl,
|
|
1837
1870
|
getAgentFsLiveUrl,
|
|
1838
1871
|
agentFsFileRoute,
|
|
1839
|
-
|
|
1872
|
+
buildAgentFsFileLink,
|
|
1840
1873
|
isCombEnabled,
|
|
1841
1874
|
isAgentFsProxyEnabled,
|
|
1842
1875
|
init_constants3
|
|
1843
|
-
} from "./cli-
|
|
1876
|
+
} from "./cli-466jjrwe.js";
|
|
1844
1877
|
import {
|
|
1845
1878
|
parseEnvFlag,
|
|
1846
1879
|
isEnvFlagEnabled,
|
|
@@ -1849,7 +1882,7 @@ import {
|
|
|
1849
1882
|
import {
|
|
1850
1883
|
init_package,
|
|
1851
1884
|
package_default
|
|
1852
|
-
} from "./cli-
|
|
1885
|
+
} from "./cli-shyhb4t5.js";
|
|
1853
1886
|
import {
|
|
1854
1887
|
realtimeBus,
|
|
1855
1888
|
init_bus
|
|
@@ -1865,7 +1898,7 @@ import {
|
|
|
1865
1898
|
registerVolatileSecret,
|
|
1866
1899
|
registerEnvSecrets,
|
|
1867
1900
|
init_secret_scrubber
|
|
1868
|
-
} from "./cli-
|
|
1901
|
+
} from "./cli-r9d2tya0.js";
|
|
1869
1902
|
import {
|
|
1870
1903
|
__toESM
|
|
1871
1904
|
} from "./cli-242037k3.js";
|
|
@@ -3145,6 +3178,7 @@ function stopMcpOverflowSweep() {
|
|
|
3145
3178
|
}
|
|
3146
3179
|
|
|
3147
3180
|
// src/http/index.ts
|
|
3181
|
+
init_memory();
|
|
3148
3182
|
init_rbac_audit();
|
|
3149
3183
|
|
|
3150
3184
|
// src/be/runtime-pools/seed.ts
|
|
@@ -5736,16 +5770,18 @@ function connect(ws, auth, runtimeId) {
|
|
|
5736
5770
|
|
|
5737
5771
|
// src/script-workflows/supervisor.ts
|
|
5738
5772
|
init_db4();
|
|
5773
|
+
init_registry();
|
|
5739
5774
|
init_api_key();
|
|
5740
5775
|
init_secret_scrubber();
|
|
5741
5776
|
|
|
5742
5777
|
// src/script-workflows/executor.ts
|
|
5778
|
+
init_native();
|
|
5743
5779
|
init_response_limit();
|
|
5744
5780
|
init_process_group();
|
|
5745
5781
|
init_sandboxed_process();
|
|
5746
5782
|
import { randomUUID } from "node:crypto";
|
|
5747
5783
|
import { existsSync } from "node:fs";
|
|
5748
|
-
import { mkdtemp, rm } from "node:fs/promises";
|
|
5784
|
+
import { chown, mkdtemp, rm } from "node:fs/promises";
|
|
5749
5785
|
import { createServer as createServer2 } from "node:net";
|
|
5750
5786
|
import { join, resolve } from "node:path";
|
|
5751
5787
|
import { fileURLToPath } from "node:url";
|
|
@@ -6347,6 +6383,7 @@ class LocalProcessScriptExecutor {
|
|
|
6347
6383
|
const { run, apiKey } = input;
|
|
6348
6384
|
const baseUrl = input.baseUrl.replace(/\/$/, "");
|
|
6349
6385
|
const harnessPath = getScriptWorkflowHarnessPath();
|
|
6386
|
+
const runAs = resolveSandboxIdentity();
|
|
6350
6387
|
const tmpdir = await mkdtemp(join(process.env.TMPDIR ?? "/tmp", `script-workflow-${run.id}-`));
|
|
6351
6388
|
const sourceFile = `${tmpdir}/source.ts`;
|
|
6352
6389
|
const argsFile = `${tmpdir}/args.json`;
|
|
@@ -6522,7 +6559,7 @@ class LocalProcessScriptExecutor {
|
|
|
6522
6559
|
}
|
|
6523
6560
|
const harnessEnv = {
|
|
6524
6561
|
PATH: process.env.PATH ?? "/usr/bin:/bin",
|
|
6525
|
-
HOME: process.env.HOME ?? "/tmp",
|
|
6562
|
+
HOME: runAs ? tmpdir : process.env.HOME ?? "/tmp",
|
|
6526
6563
|
LANG: process.env.LANG ?? "C.UTF-8",
|
|
6527
6564
|
LC_ALL: process.env.LC_ALL ?? "C.UTF-8",
|
|
6528
6565
|
TMPDIR: tmpdir,
|
|
@@ -6537,7 +6574,11 @@ class LocalProcessScriptExecutor {
|
|
|
6537
6574
|
SCRIPT_RUN_CAPABILITY_TOKEN: capabilityToken
|
|
6538
6575
|
};
|
|
6539
6576
|
try {
|
|
6540
|
-
|
|
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, {
|
|
6541
6582
|
cwd: tmpdir,
|
|
6542
6583
|
detached: detachedProcessGroup,
|
|
6543
6584
|
env: sandboxSpawnEnv(harnessEnv),
|
|
@@ -6562,6 +6603,10 @@ class LocalProcessScriptExecutor {
|
|
|
6562
6603
|
const stderrPromise = readStreamCapped(proc.stderr, MAX_STDERR_BYTES).then(({ text, truncated }) => truncated ? `${text}
|
|
6563
6604
|
…[stderr truncated]` : text, () => "");
|
|
6564
6605
|
const spawned = proc;
|
|
6606
|
+
const runDirCheck = {
|
|
6607
|
+
maxBytes: DEFAULT_SANDBOX_LIMITS.maxFileKb * 1024,
|
|
6608
|
+
...runAs ? { ownerUid: runAs.uid } : {}
|
|
6609
|
+
};
|
|
6565
6610
|
const exited = spawned.exited.then(async (processExitCode) => {
|
|
6566
6611
|
clearInterval(heartbeat);
|
|
6567
6612
|
await terminateProcessGroup(spawned.pid);
|
|
@@ -6572,12 +6617,15 @@ class LocalProcessScriptExecutor {
|
|
|
6572
6617
|
if (protocolFailure)
|
|
6573
6618
|
throw protocolFailure;
|
|
6574
6619
|
if (processExitCode !== 0) {
|
|
6575
|
-
const
|
|
6576
|
-
const failure =
|
|
6620
|
+
const errorText = await readRunDirFile(errorFile, runDirCheck);
|
|
6621
|
+
const failure = errorText === undefined ? undefined : JSON.parse(errorText);
|
|
6577
6622
|
const message = typeof failure?.message === "string" ? failure.message : `guest exited with ${processExitCode}`;
|
|
6578
6623
|
throw new Error(message);
|
|
6579
6624
|
}
|
|
6580
|
-
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);
|
|
6581
6629
|
await postStatus(run, baseUrl, apiKey, { status: "completed", output });
|
|
6582
6630
|
return { exitCode: 0, stderr };
|
|
6583
6631
|
} catch (error) {
|
|
@@ -6646,11 +6694,17 @@ var scriptExecutor = localProcessScriptExecutor;
|
|
|
6646
6694
|
function supervisorDisabled() {
|
|
6647
6695
|
return process.env.SCRIPT_RUN_SUPERVISOR_DISABLE === "true";
|
|
6648
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
|
+
}
|
|
6649
6701
|
async function startScriptRunProcess(run, baseUrl, apiKeyOverride) {
|
|
6650
6702
|
if (supervisorDisabled())
|
|
6651
6703
|
return;
|
|
6652
6704
|
if (managed.has(run.id))
|
|
6653
6705
|
return;
|
|
6706
|
+
if (!durableScriptRunsAllowed())
|
|
6707
|
+
throw new Error(DURABLE_RUNS_NATIVE_REFUSED);
|
|
6654
6708
|
const apiKey = apiKeyOverride ?? getApiKey();
|
|
6655
6709
|
if (!apiKey)
|
|
6656
6710
|
throw new Error("AGENT_SWARM_API_KEY is required to spawn script runs");
|
|
@@ -9295,6 +9349,7 @@ async function aggregateKeyWindowUsage(windows, through) {
|
|
|
9295
9349
|
}
|
|
9296
9350
|
|
|
9297
9351
|
// src/http/api-keys.ts
|
|
9352
|
+
init_key_usage();
|
|
9298
9353
|
init_model_rate_limit_windows();
|
|
9299
9354
|
init_provider_account_telemetry();
|
|
9300
9355
|
init_subscription_plans();
|
|
@@ -9617,7 +9672,11 @@ var getAvailable = route({
|
|
|
9617
9672
|
earliestModelResetAt: string2().nullable().optional(),
|
|
9618
9673
|
seatBlockedIndices: array2(number2().int()).optional(),
|
|
9619
9674
|
spendCappedIndices: array2(number2().int()),
|
|
9620
|
-
authFailureFence: number2().int()
|
|
9675
|
+
authFailureFence: number2().int(),
|
|
9676
|
+
keyUsage: array2(number2()),
|
|
9677
|
+
keyPace: array2(number2()),
|
|
9678
|
+
selectionStrategy: _enum2(CREDENTIAL_SELECTION_STRATEGIES),
|
|
9679
|
+
activeSessions: array2(number2().int().min(0))
|
|
9621
9680
|
})
|
|
9622
9681
|
},
|
|
9623
9682
|
400: { description: "Validation error" },
|
|
@@ -9987,6 +10046,10 @@ async function handleApiKeys(req, res, pathSegments, queryParams) {
|
|
|
9987
10046
|
spendCappedIndices: result.spendCappedIndices,
|
|
9988
10047
|
totalKeys,
|
|
9989
10048
|
authFailureFence: result.authFailureFence,
|
|
10049
|
+
keyUsage: result.keyUsage,
|
|
10050
|
+
keyPace: result.keyPace,
|
|
10051
|
+
selectionStrategy: credentialSelectionStrategy(process.env.CREDENTIAL_SELECTION_STRATEGY),
|
|
10052
|
+
activeSessions: result.activeSessions,
|
|
9990
10053
|
...model !== undefined ? {
|
|
9991
10054
|
modelBlockedIndices: result.modelBlockedIndices,
|
|
9992
10055
|
earliestModelResetAt: result.earliestModelResetAt,
|
|
@@ -10167,6 +10230,27 @@ init_db3();
|
|
|
10167
10230
|
init_session_shares();
|
|
10168
10231
|
init_rbac();
|
|
10169
10232
|
init_types5();
|
|
10233
|
+
|
|
10234
|
+
// src/http/asset-key-write.ts
|
|
10235
|
+
init_asset_key_auth();
|
|
10236
|
+
init_audit_user();
|
|
10237
|
+
init_users();
|
|
10238
|
+
init_request_auth_context();
|
|
10239
|
+
init_favorite_owner();
|
|
10240
|
+
async function resolveDashboardUserId(req, callerAgentId) {
|
|
10241
|
+
const auth = getRequestAuth(req);
|
|
10242
|
+
if (!isOperatorAuth(auth) || auth.page || callerAgentId || req.headers["x-agent-id"])
|
|
10243
|
+
return null;
|
|
10244
|
+
const picked = dashboardUserIdHeader(req);
|
|
10245
|
+
const user = picked ? await findUserById(picked) : null;
|
|
10246
|
+
return user?.status === "active" ? user.id : null;
|
|
10247
|
+
}
|
|
10248
|
+
async function authorizeHttpAssetKeyWrite(req, callerAgentId, key, trustedUserId) {
|
|
10249
|
+
const requester = trustedUserId === undefined ? await resolveHttpRequesterUserId(req, callerAgentId) : trustedUserId;
|
|
10250
|
+
return authorizeAssetKeyWrite(key, requester ?? await resolveDashboardUserId(req, callerAgentId));
|
|
10251
|
+
}
|
|
10252
|
+
|
|
10253
|
+
// src/http/assets.ts
|
|
10170
10254
|
init_request_principal();
|
|
10171
10255
|
init_route_def();
|
|
10172
10256
|
init_session_access();
|
|
@@ -10380,7 +10464,7 @@ async function handleAssets(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
10380
10464
|
return true;
|
|
10381
10465
|
try {
|
|
10382
10466
|
const actor = await resolveHttpRequesterUserId(req, myAgentId);
|
|
10383
|
-
const key = parsed.body.key ? await
|
|
10467
|
+
const key = parsed.body.key ? await authorizeHttpAssetKeyWrite(req, myAgentId, parsed.body.key, actor) : undefined;
|
|
10384
10468
|
const mapping = await upsertAssetKeyMapping2({
|
|
10385
10469
|
providerId: parsed.body.providerId,
|
|
10386
10470
|
providerOrgId: parsed.body.orgId,
|
|
@@ -10463,7 +10547,7 @@ async function handleAssets(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
10463
10547
|
}
|
|
10464
10548
|
try {
|
|
10465
10549
|
const actor = await resolveHttpRequesterUserId(req, myAgentId);
|
|
10466
|
-
const key = await
|
|
10550
|
+
const key = await authorizeHttpAssetKeyWrite(req, myAgentId, parsed.body.key, actor);
|
|
10467
10551
|
const moved = await moveAssetKey2({
|
|
10468
10552
|
entityType: parsed.params.entityType,
|
|
10469
10553
|
id: parsed.params.id,
|
|
@@ -12537,6 +12621,7 @@ async function handleCodexOAuthKeepWarm(req, res, pathSegments) {
|
|
|
12537
12621
|
// src/http/comb.ts
|
|
12538
12622
|
init_zod();
|
|
12539
12623
|
init_audit_user();
|
|
12624
|
+
init_db4();
|
|
12540
12625
|
init_config4();
|
|
12541
12626
|
|
|
12542
12627
|
// src/comb/review-batch.ts
|
|
@@ -12719,12 +12804,16 @@ async function sendReviewBatch(input, deps = {}) {
|
|
|
12719
12804
|
...repairs.map((repair) => alreadySent(repair.id, repair.taskId))
|
|
12720
12805
|
]);
|
|
12721
12806
|
}
|
|
12722
|
-
const
|
|
12807
|
+
const parent = input.parent;
|
|
12808
|
+
const lead = parent?.agentId ? null : await getLeadAgent2();
|
|
12723
12809
|
leadState = !lead ? "none" : lead.status === "offline" ? "offline" : "online";
|
|
12724
12810
|
const task = await createTask(text, {
|
|
12725
|
-
agentId: lead?.id
|
|
12726
|
-
|
|
12727
|
-
|
|
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,
|
|
12728
12817
|
source: "comb",
|
|
12729
12818
|
taskType: "comb-review",
|
|
12730
12819
|
tags: ["comb"],
|
|
@@ -12757,7 +12846,13 @@ async function sendReviewBatch(input, deps = {}) {
|
|
|
12757
12846
|
if (taskId === null && repaired.length === 0) {
|
|
12758
12847
|
throw new ReviewBatchError(409, "Nothing to send", skipped);
|
|
12759
12848
|
}
|
|
12760
|
-
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
|
+
};
|
|
12761
12856
|
}
|
|
12762
12857
|
async function mapLimited(items, limit, fn) {
|
|
12763
12858
|
const results = new Array(items.length);
|
|
@@ -12961,6 +13056,7 @@ init_errors2();
|
|
|
12961
13056
|
init_secret_scrubber();
|
|
12962
13057
|
init_request_principal();
|
|
12963
13058
|
init_route_def();
|
|
13059
|
+
init_session_access();
|
|
12964
13060
|
init_utils2();
|
|
12965
13061
|
var skippedSchema = object2({
|
|
12966
13062
|
id: string2(),
|
|
@@ -12982,10 +13078,11 @@ var reviewBatchRoute = route({
|
|
|
12982
13078
|
method: "post",
|
|
12983
13079
|
path: "/api/comb/review-batches",
|
|
12984
13080
|
pattern: ["api", "comb", "review-batches"],
|
|
12985
|
-
summary: "Send agent-fs comments to the swarm as one
|
|
12986
|
-
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.",
|
|
12987
13083
|
tags: ["Comb"],
|
|
12988
13084
|
body: object2({
|
|
13085
|
+
parentTaskId: uuid().optional(),
|
|
12989
13086
|
orgId: string2().min(1),
|
|
12990
13087
|
driveId: string2().min(1),
|
|
12991
13088
|
commentIds: array2(uuid()).min(1).max(REVIEW_BATCH_MAX),
|
|
@@ -13012,6 +13109,7 @@ var reviewBatchRoute = route({
|
|
|
13012
13109
|
schema: batchErrorSchema
|
|
13013
13110
|
}
|
|
13014
13111
|
},
|
|
13112
|
+
session: bodyTask("parentTaskId"),
|
|
13015
13113
|
rbac: { permission: "task.create.own" }
|
|
13016
13114
|
});
|
|
13017
13115
|
async function handleComb(req, res, pathSegments, queryParams, myAgentId) {
|
|
@@ -13030,8 +13128,18 @@ async function handleComb(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
13030
13128
|
return true;
|
|
13031
13129
|
}
|
|
13032
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;
|
|
13033
13140
|
const result = await sendReviewBatch({
|
|
13034
|
-
...
|
|
13141
|
+
...batch,
|
|
13142
|
+
parent: parent ? { id: parent.id, agentId: parent.agentId, agentCaller: sender?.kind === "agent" } : undefined,
|
|
13035
13143
|
requestedByUserId: await resolveHttpRequesterUserId(req, myAgentId)
|
|
13036
13144
|
});
|
|
13037
13145
|
reviewBatchRoute.respond(res, result.taskId === null ? 200 : 201, result);
|
|
@@ -13483,6 +13591,7 @@ declare module "swarm-extension" {
|
|
|
13483
13591
|
| "chat"
|
|
13484
13592
|
| "workflow"
|
|
13485
13593
|
| "schedule"
|
|
13594
|
+
| "system"
|
|
13486
13595
|
| "slack"
|
|
13487
13596
|
| "agentmail"
|
|
13488
13597
|
| "mcp"
|
|
@@ -13492,7 +13601,6 @@ declare module "swarm-extension" {
|
|
|
13492
13601
|
| "gitlab"
|
|
13493
13602
|
| "azure-devops"
|
|
13494
13603
|
| "bitbucket"
|
|
13495
|
-
| "system"
|
|
13496
13604
|
| "linear"
|
|
13497
13605
|
| "jira"
|
|
13498
13606
|
| "comb"
|
|
@@ -13634,6 +13742,7 @@ declare module "swarm-extension" {
|
|
|
13634
13742
|
| "chat"
|
|
13635
13743
|
| "workflow"
|
|
13636
13744
|
| "schedule"
|
|
13745
|
+
| "system"
|
|
13637
13746
|
| "slack"
|
|
13638
13747
|
| "agentmail"
|
|
13639
13748
|
| "mcp"
|
|
@@ -13643,7 +13752,6 @@ declare module "swarm-extension" {
|
|
|
13643
13752
|
| "gitlab"
|
|
13644
13753
|
| "azure-devops"
|
|
13645
13754
|
| "bitbucket"
|
|
13646
|
-
| "system"
|
|
13647
13755
|
| "linear"
|
|
13648
13756
|
| "jira"
|
|
13649
13757
|
| "comb";
|
|
@@ -13673,6 +13781,23 @@ declare module "swarm-extension" {
|
|
|
13673
13781
|
rejectionReason?: string | undefined;
|
|
13674
13782
|
finishedAt?: string | undefined;
|
|
13675
13783
|
notifiedAt?: string | undefined;
|
|
13784
|
+
statusKind?:
|
|
13785
|
+
| "error"
|
|
13786
|
+
| "workflow"
|
|
13787
|
+
| "external"
|
|
13788
|
+
| "agent"
|
|
13789
|
+
| "runner"
|
|
13790
|
+
| "deferred"
|
|
13791
|
+
| "cascade"
|
|
13792
|
+
| "user"
|
|
13793
|
+
| "system"
|
|
13794
|
+
| "graceful_shutdown"
|
|
13795
|
+
| "context_limits"
|
|
13796
|
+
| "manual_supersede"
|
|
13797
|
+
| "crash_recovery"
|
|
13798
|
+
| "provider_fallback"
|
|
13799
|
+
| "workflow_retry"
|
|
13800
|
+
| undefined;
|
|
13676
13801
|
failureReason?: string | undefined;
|
|
13677
13802
|
output?: string | undefined;
|
|
13678
13803
|
progress?: string | undefined;
|
|
@@ -13752,6 +13877,7 @@ declare module "swarm-extension" {
|
|
|
13752
13877
|
}
|
|
13753
13878
|
| undefined;
|
|
13754
13879
|
deferredAt?: string | undefined;
|
|
13880
|
+
deferredUntil?: string | undefined;
|
|
13755
13881
|
compactionCount?: number | undefined;
|
|
13756
13882
|
peakContextPercent?: number | undefined;
|
|
13757
13883
|
peakContextTokens?: number | undefined;
|
|
@@ -18680,21 +18806,27 @@ var installationTokenRoute = route({
|
|
|
18680
18806
|
path: "/api/github/installation-token",
|
|
18681
18807
|
pattern: ["api", "github", "installation-token"],
|
|
18682
18808
|
summary: "Mint a GitHub App installation token for worker git and gh",
|
|
18683
|
-
description: "Internal worker endpoint. Returns a short-lived installation token for
|
|
18809
|
+
description: "Internal worker endpoint. Returns a short-lived installation token for worker `git` and `gh`. With a `repo` (`owner/name`) whose owner is listed in the deployment env `GITHUB_APP_REPO_OWNERS`, the API resolves that repository's App installation with the App JWT and mints for it; the repository must also be registered in `swarm_repos` on the configured GitHub host (403 otherwise). Any other call mints for the installation in `GITHUB_APP_INSTALLATION_ID`, so single-installation deployments are unchanged and a caller never picks an installation the operator did not list. Only a registered agent (swarm API key plus X-Agent-ID, or an agent or runtime token) may call it; user, guest and ACP task tokens are refused. 404 when the App is not configured, so workers fall back to `GITHUB_TOKEN`.",
|
|
18684
18810
|
tags: ["GitHub"],
|
|
18685
|
-
body: object2({
|
|
18811
|
+
body: object2({
|
|
18812
|
+
repo: string2().max(200).regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/, "repo must be `owner/name` (letters, digits, dot, dash, underscore)").optional()
|
|
18813
|
+
}).optional(),
|
|
18686
18814
|
responses: {
|
|
18687
18815
|
200: {
|
|
18688
18816
|
description: "Installation token and its expiry (ISO 8601)",
|
|
18689
18817
|
schema: object2({ token: string2(), expiresAt: string2() })
|
|
18690
18818
|
},
|
|
18691
|
-
403: {
|
|
18819
|
+
403: {
|
|
18820
|
+
description: "Caller is not a registered agent, or the repo of a listed owner is not registered in the swarm"
|
|
18821
|
+
},
|
|
18692
18822
|
404: { description: "GitHub App worker auth is not configured" },
|
|
18693
|
-
502: {
|
|
18823
|
+
502: {
|
|
18824
|
+
description: "GitHub refused or failed to mint the token, or the repo has no App installation"
|
|
18825
|
+
}
|
|
18694
18826
|
},
|
|
18695
18827
|
auth: { apiKey: true, agentId: true },
|
|
18696
18828
|
rbac: {
|
|
18697
|
-
ungated: "the handler admits only registered agent principals and mints for
|
|
18829
|
+
ungated: "the handler admits only registered agent principals and mints only for the fixed installation or the installation of a registered repo whose owner the deployment env lists"
|
|
18698
18830
|
}
|
|
18699
18831
|
});
|
|
18700
18832
|
async function handleGitHubToken(req, res, pathSegments, myAgentId) {
|
|
@@ -18713,11 +18845,15 @@ async function handleGitHubToken(req, res, pathSegments, myAgentId) {
|
|
|
18713
18845
|
jsonError(res, "Only a registered agent may mint a GitHub installation token", 403);
|
|
18714
18846
|
return true;
|
|
18715
18847
|
}
|
|
18716
|
-
const result = await getWorkerInstallationToken();
|
|
18848
|
+
const result = await getWorkerInstallationToken(parsed.body?.repo);
|
|
18717
18849
|
if (result.status === "unconfigured") {
|
|
18718
18850
|
jsonError(res, "GitHub App worker auth is not configured", 404);
|
|
18719
18851
|
return true;
|
|
18720
18852
|
}
|
|
18853
|
+
if (result.status === "forbidden") {
|
|
18854
|
+
jsonError(res, "The repo is not registered in the swarm", 403);
|
|
18855
|
+
return true;
|
|
18856
|
+
}
|
|
18721
18857
|
if (result.status === "error") {
|
|
18722
18858
|
jsonError(res, "GitHub did not mint an installation token", 502);
|
|
18723
18859
|
return true;
|
|
@@ -18729,6 +18865,7 @@ async function handleGitHubToken(req, res, pathSegments, myAgentId) {
|
|
|
18729
18865
|
|
|
18730
18866
|
// src/http/heartbeat.ts
|
|
18731
18867
|
init_zod();
|
|
18868
|
+
init_request_principal();
|
|
18732
18869
|
init_route_def();
|
|
18733
18870
|
init_utils2();
|
|
18734
18871
|
var HeartbeatActionResultSchema = object2({
|
|
@@ -18745,7 +18882,8 @@ var triggerSweep = route({
|
|
|
18745
18882
|
200: { description: "Sweep completed successfully", schema: HeartbeatActionResultSchema },
|
|
18746
18883
|
401: { description: "Unauthorized" }
|
|
18747
18884
|
},
|
|
18748
|
-
auth: { apiKey: true }
|
|
18885
|
+
auth: { apiKey: true },
|
|
18886
|
+
rbac: { permission: "heartbeat.trigger" }
|
|
18749
18887
|
});
|
|
18750
18888
|
var triggerChecklist = route({
|
|
18751
18889
|
method: "post",
|
|
@@ -18760,13 +18898,16 @@ var triggerChecklist = route({
|
|
|
18760
18898
|
},
|
|
18761
18899
|
401: { description: "Unauthorized" }
|
|
18762
18900
|
},
|
|
18763
|
-
auth: { apiKey: true }
|
|
18901
|
+
auth: { apiKey: true },
|
|
18902
|
+
rbac: { permission: "heartbeat.trigger" }
|
|
18764
18903
|
});
|
|
18765
18904
|
async function handleHeartbeat(req, res, pathSegments) {
|
|
18766
18905
|
if (triggerSweep.match(req.method, pathSegments)) {
|
|
18767
18906
|
const parsed = await triggerSweep.parse(req, res, pathSegments, new URLSearchParams);
|
|
18768
18907
|
if (!parsed)
|
|
18769
18908
|
return true;
|
|
18909
|
+
if (await refuseAgentTokenWithout(req, res, "heartbeat.trigger"))
|
|
18910
|
+
return true;
|
|
18770
18911
|
try {
|
|
18771
18912
|
await runHeartbeatSweep2();
|
|
18772
18913
|
triggerSweep.respond(res, 200, { success: true, message: "Heartbeat sweep completed" });
|
|
@@ -18780,6 +18921,8 @@ async function handleHeartbeat(req, res, pathSegments) {
|
|
|
18780
18921
|
const parsed = await triggerChecklist.parse(req, res, pathSegments, new URLSearchParams);
|
|
18781
18922
|
if (!parsed)
|
|
18782
18923
|
return true;
|
|
18924
|
+
if (await refuseAgentTokenWithout(req, res, "heartbeat.trigger"))
|
|
18925
|
+
return true;
|
|
18783
18926
|
try {
|
|
18784
18927
|
await checkHeartbeatChecklist2();
|
|
18785
18928
|
triggerChecklist.respond(res, 200, {
|
|
@@ -19600,6 +19743,7 @@ var handleIntegrations = createIntegrationsHandler();
|
|
|
19600
19743
|
// src/http/kv.ts
|
|
19601
19744
|
init_zod();
|
|
19602
19745
|
init_db4();
|
|
19746
|
+
init_kv_limits();
|
|
19603
19747
|
init_kv_overflow();
|
|
19604
19748
|
init_kv_reserved_namespaces();
|
|
19605
19749
|
init_kv_view();
|
|
@@ -19608,7 +19752,6 @@ init_context_key();
|
|
|
19608
19752
|
init_types5();
|
|
19609
19753
|
init_route_def();
|
|
19610
19754
|
init_utils2();
|
|
19611
|
-
var MAX_KV_BODY_BYTES = 2 * 1024 * 1024;
|
|
19612
19755
|
var MAX_KV_LIST_LIMIT = 1000;
|
|
19613
19756
|
var kvSetBodySchema = object2({
|
|
19614
19757
|
value: unknown(),
|
|
@@ -20100,6 +20243,7 @@ async function sendGet(req, res, namespace, key, query, respond) {
|
|
|
20100
20243
|
jsonError(res, "not found", 404);
|
|
20101
20244
|
return true;
|
|
20102
20245
|
}
|
|
20246
|
+
entry.value = scrubReservedRead(namespace, entry.value);
|
|
20103
20247
|
if (hasKvViewArgs(query)) {
|
|
20104
20248
|
const view = resolveKvView(entry.value, query);
|
|
20105
20249
|
if (!view.ok) {
|
|
@@ -20176,7 +20320,10 @@ async function sendList(req, res, namespace, query, respond) {
|
|
|
20176
20320
|
const limit = Math.min(query.limit ?? 100, MAX_KV_LIST_LIMIT);
|
|
20177
20321
|
const offset = query.offset ?? 0;
|
|
20178
20322
|
const prefix = query.prefix && query.prefix.length > 0 ? query.prefix : undefined;
|
|
20179
|
-
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
|
+
}));
|
|
20180
20327
|
const total = await countKv2(namespace, { prefix });
|
|
20181
20328
|
respond(res, 200, { entries, total, namespace });
|
|
20182
20329
|
return true;
|
|
@@ -21824,6 +21971,7 @@ init_ensure_mcp_token();
|
|
|
21824
21971
|
init_mcp_wrapper();
|
|
21825
21972
|
init_types5();
|
|
21826
21973
|
init_constants3();
|
|
21974
|
+
init_request_principal();
|
|
21827
21975
|
init_route_def();
|
|
21828
21976
|
init_utils2();
|
|
21829
21977
|
function callbackRedirectUri() {
|
|
@@ -21915,6 +22063,15 @@ async function discoverForMcp(resourceUrl) {
|
|
|
21915
22063
|
if (!issuer)
|
|
21916
22064
|
return null;
|
|
21917
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
|
+
}
|
|
21918
22075
|
return {
|
|
21919
22076
|
resourceUrl: prmd.resource ?? resourceUrl,
|
|
21920
22077
|
authorizationServerIssuer: as.issuer,
|
|
@@ -22048,6 +22205,7 @@ var refreshRoute = route({
|
|
|
22048
22205
|
tags: ["MCP OAuth"],
|
|
22049
22206
|
auth: { apiKey: true },
|
|
22050
22207
|
params: object2({ mcpServerId: string2() }),
|
|
22208
|
+
rbac: { permission: "mcp-oauth.manage" },
|
|
22051
22209
|
body: object2({
|
|
22052
22210
|
userId: string2().optional()
|
|
22053
22211
|
}).optional(),
|
|
@@ -22066,6 +22224,7 @@ var disconnectRoute = route({
|
|
|
22066
22224
|
tags: ["MCP OAuth"],
|
|
22067
22225
|
auth: { apiKey: true },
|
|
22068
22226
|
params: object2({ mcpServerId: string2() }),
|
|
22227
|
+
rbac: { permission: "mcp-oauth.manage" },
|
|
22069
22228
|
query: object2({ userId: string2().optional() }),
|
|
22070
22229
|
responses: {
|
|
22071
22230
|
200: { description: "Token revoked/deleted", schema: OkResponseSchema },
|
|
@@ -22080,6 +22239,7 @@ var manualClientRoute = route({
|
|
|
22080
22239
|
tags: ["MCP OAuth"],
|
|
22081
22240
|
auth: { apiKey: true },
|
|
22082
22241
|
params: object2({ mcpServerId: string2() }),
|
|
22242
|
+
rbac: { permission: "mcp-oauth.manage" },
|
|
22083
22243
|
body: object2({
|
|
22084
22244
|
clientId: string2().min(1),
|
|
22085
22245
|
clientSecret: string2().optional(),
|
|
@@ -22426,6 +22586,8 @@ async function handleMcpOAuth(req, res, pathSegments, queryParams) {
|
|
|
22426
22586
|
const parsed = await refreshRoute.parse(req, res, pathSegments, queryParams);
|
|
22427
22587
|
if (!parsed)
|
|
22428
22588
|
return true;
|
|
22589
|
+
if (await refuseAgentTokenWithout(req, res, "mcp-oauth.manage"))
|
|
22590
|
+
return true;
|
|
22429
22591
|
const userId = parsed.body?.userId ?? null;
|
|
22430
22592
|
const existing = await getMcpOAuthToken(parsed.params.mcpServerId, userId);
|
|
22431
22593
|
if (!existing || !existing.refreshToken) {
|
|
@@ -22467,6 +22629,8 @@ async function handleMcpOAuth(req, res, pathSegments, queryParams) {
|
|
|
22467
22629
|
const parsed = await disconnectRoute.parse(req, res, pathSegments, queryParams);
|
|
22468
22630
|
if (!parsed)
|
|
22469
22631
|
return true;
|
|
22632
|
+
if (await refuseAgentTokenWithout(req, res, "mcp-oauth.manage"))
|
|
22633
|
+
return true;
|
|
22470
22634
|
const userId = parsed.query.userId ?? null;
|
|
22471
22635
|
const token = await getMcpOAuthToken(parsed.params.mcpServerId, userId);
|
|
22472
22636
|
if (!token) {
|
|
@@ -22496,6 +22660,8 @@ async function handleMcpOAuth(req, res, pathSegments, queryParams) {
|
|
|
22496
22660
|
const parsed = await manualClientRoute.parse(req, res, pathSegments, queryParams);
|
|
22497
22661
|
if (!parsed)
|
|
22498
22662
|
return true;
|
|
22663
|
+
if (await refuseAgentTokenWithout(req, res, "mcp-oauth.manage"))
|
|
22664
|
+
return true;
|
|
22499
22665
|
const server = await getMcpOrError(res, parsed.params.mcpServerId);
|
|
22500
22666
|
if (!server)
|
|
22501
22667
|
return true;
|
|
@@ -22579,6 +22745,7 @@ init_mcp_server_checked_update();
|
|
|
22579
22745
|
init_mcp_server_stdio_gate();
|
|
22580
22746
|
init_rbac_audit();
|
|
22581
22747
|
init_rbac_roles();
|
|
22748
|
+
init_swarm_config_guard();
|
|
22582
22749
|
init_ensure_mcp_token();
|
|
22583
22750
|
init_mcp_wrapper();
|
|
22584
22751
|
init_rbac();
|
|
@@ -22753,7 +22920,10 @@ var getAgentMcpServersRoute = route({
|
|
|
22753
22920
|
}
|
|
22754
22921
|
});
|
|
22755
22922
|
async function canResolveMcpSecretsForHttpUser(req) {
|
|
22756
|
-
const
|
|
22923
|
+
const auth = getRequestAuth(req);
|
|
22924
|
+
if (auth?.kind === "agent" && auth.tokenKind === "task")
|
|
22925
|
+
return false;
|
|
22926
|
+
const userId = authUserId(auth);
|
|
22757
22927
|
if (!userId)
|
|
22758
22928
|
return true;
|
|
22759
22929
|
if (!isRbacEnabled())
|
|
@@ -22813,7 +22983,7 @@ async function handleMcpServers(req, res, pathSegments, queryParams) {
|
|
|
22813
22983
|
jsonError(res, "Forbidden: admission: missing permission 'mcp-server.read.secrets'", 403);
|
|
22814
22984
|
return true;
|
|
22815
22985
|
}
|
|
22816
|
-
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));
|
|
22817
22987
|
const configMap = new Map(configs.map((c) => [c.key, c.value]));
|
|
22818
22988
|
const serversWithSecrets = await Promise.all(servers.map(async (server) => {
|
|
22819
22989
|
const resolvedEnv = {};
|
|
@@ -22902,6 +23072,12 @@ async function handleMcpServers(req, res, pathSegments, queryParams) {
|
|
|
22902
23072
|
jsonError(res, "MCP server not found", 404);
|
|
22903
23073
|
return true;
|
|
22904
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
|
+
}
|
|
22905
23081
|
try {
|
|
22906
23082
|
const agentMcpServer = await installMcpServer2(parsed.body.agentId, parsed.params.id);
|
|
22907
23083
|
installMcpServerRoute.respond(res, 200, { agentMcpServer });
|
|
@@ -22914,6 +23090,12 @@ async function handleMcpServers(req, res, pathSegments, queryParams) {
|
|
|
22914
23090
|
const parsed = await uninstallMcpServerRoute.parse(req, res, pathSegments, queryParams);
|
|
22915
23091
|
if (!parsed)
|
|
22916
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
|
+
}
|
|
22917
23099
|
const removed = await uninstallMcpServer2(parsed.params.agentId, parsed.params.id);
|
|
22918
23100
|
uninstallMcpServerRoute.respond(res, 200, { success: removed });
|
|
22919
23101
|
return true;
|
|
@@ -23043,6 +23225,13 @@ async function handleMcpServers(req, res, pathSegments, queryParams) {
|
|
|
23043
23225
|
const parsed = await deleteMcpServerRoute.parse(req, res, pathSegments, queryParams);
|
|
23044
23226
|
if (!parsed)
|
|
23045
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
|
+
}
|
|
23046
23235
|
const result = await deleteMcpServer2(parsed.params.id);
|
|
23047
23236
|
if (!result.deleted) {
|
|
23048
23237
|
jsonError(res, "MCP server not found", 404);
|
|
@@ -24576,6 +24765,16 @@ async function handleMemory(req, res, pathSegments, callerAgentId) {
|
|
|
24576
24765
|
contextKey
|
|
24577
24766
|
} = parsed.body;
|
|
24578
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
|
+
}
|
|
24579
24778
|
if (source === "session_summary" && sourceTaskId) {
|
|
24580
24779
|
const sourceTask = await getTaskById2(sourceTaskId);
|
|
24581
24780
|
if (sourceTask && !shouldPersistAutomaticTaskMemory(sourceTask, persistMemory)) {
|
|
@@ -25007,6 +25206,15 @@ async function handleMemory(req, res, pathSegments, callerAgentId) {
|
|
|
25007
25206
|
const parsed = await reEmbedMemory.parse(req, res, pathSegments, new URLSearchParams);
|
|
25008
25207
|
if (!parsed)
|
|
25009
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
|
+
}
|
|
25010
25218
|
const { agentId, batchSize } = parsed.body;
|
|
25011
25219
|
const store = getMemoryStore2();
|
|
25012
25220
|
const provider = getEmbeddingProvider2();
|
|
@@ -25229,6 +25437,7 @@ init_zod();
|
|
|
25229
25437
|
init_db4();
|
|
25230
25438
|
init_version2();
|
|
25231
25439
|
init_types5();
|
|
25440
|
+
init_secret_scrubber();
|
|
25232
25441
|
init_db_query();
|
|
25233
25442
|
init_route_def();
|
|
25234
25443
|
init_utils2();
|
|
@@ -25278,7 +25487,7 @@ function resolveVariableOptions(metric) {
|
|
|
25278
25487
|
}
|
|
25279
25488
|
const options = resolveVariableOptionValues(variable);
|
|
25280
25489
|
optionsByKey[variable.key] = options;
|
|
25281
|
-
return { ...variable, options };
|
|
25490
|
+
return { ...variable, options: scrubObject(options) };
|
|
25282
25491
|
});
|
|
25283
25492
|
return { variables, optionsByKey };
|
|
25284
25493
|
}
|
|
@@ -25337,7 +25546,7 @@ function runMetricWidget(widget, variables) {
|
|
|
25337
25546
|
widget,
|
|
25338
25547
|
result: {
|
|
25339
25548
|
...result,
|
|
25340
|
-
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]])))),
|
|
25341
25550
|
truncated: result.total > result.rows.length,
|
|
25342
25551
|
maxRows
|
|
25343
25552
|
}
|
|
@@ -25352,7 +25561,7 @@ function runMetric(metric, providedVariables = {}) {
|
|
|
25352
25561
|
...metric,
|
|
25353
25562
|
definition: { ...metric.definition, variables: resolved.variables }
|
|
25354
25563
|
},
|
|
25355
|
-
variables,
|
|
25564
|
+
variables: scrubObject(variables),
|
|
25356
25565
|
widgets,
|
|
25357
25566
|
result: widgets[0]?.result
|
|
25358
25567
|
};
|
|
@@ -27192,7 +27401,7 @@ async function open(id) {
|
|
|
27192
27401
|
const scope = { taskId: "", name: "", key: row.path, orgId: row.orgId, driveId: row.driveId };
|
|
27193
27402
|
return { row, owner: row.ownerAgentId, provider: client.provider, scope };
|
|
27194
27403
|
}
|
|
27195
|
-
var withLink = (row) => ({ ...row, link:
|
|
27404
|
+
var withLink = (row) => ({ ...row, link: buildAgentFsFileLink(row) });
|
|
27196
27405
|
async function driveWatched(orgId, driveId) {
|
|
27197
27406
|
const hook = await getDbClient2().get("SELECT status FROM agent_fs_object_webhooks WHERE orgId = ? AND driveId = ?", [orgId, driveId]);
|
|
27198
27407
|
return hook?.status === "active";
|
|
@@ -27619,6 +27828,7 @@ var StatusCombSchema = object2({
|
|
|
27619
27828
|
live_url: string2(),
|
|
27620
27829
|
org_id: string2().nullable(),
|
|
27621
27830
|
drive_id: string2().nullable(),
|
|
27831
|
+
review_follow_ups: boolean(),
|
|
27622
27832
|
service_user_id: string2().nullable()
|
|
27623
27833
|
});
|
|
27624
27834
|
var StatusTelemetrySchema = object2({
|
|
@@ -28057,6 +28267,7 @@ function getCombStatus(serviceUserId) {
|
|
|
28057
28267
|
live_url: comb.liveUrl,
|
|
28058
28268
|
org_id: comb.orgId,
|
|
28059
28269
|
drive_id: comb.driveId,
|
|
28270
|
+
review_follow_ups: comb.enabled,
|
|
28060
28271
|
service_user_id: comb.enabled ? serviceUserId : null
|
|
28061
28272
|
};
|
|
28062
28273
|
}
|
|
@@ -28389,7 +28600,8 @@ async function handleMemoryProbe(body) {
|
|
|
28389
28600
|
defaultHeaders: getOpenRouterAttributionHeaders(endpoint.toString()),
|
|
28390
28601
|
timeout: 15000,
|
|
28391
28602
|
maxRetries: 0,
|
|
28392
|
-
fetchOptions: { redirect: "manual" }
|
|
28603
|
+
fetchOptions: { redirect: "manual" },
|
|
28604
|
+
fetch: configuredEndpoint ? undefined : createSsrfGuardedFetch(publicEndpointSsrfOptions())
|
|
28393
28605
|
});
|
|
28394
28606
|
const response = await client.embeddings.create({
|
|
28395
28607
|
model,
|
|
@@ -28418,6 +28630,14 @@ async function handleMemoryProbe(body) {
|
|
|
28418
28630
|
});
|
|
28419
28631
|
return { ok: true, dimensions, latencyMs };
|
|
28420
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
|
+
}
|
|
28421
28641
|
const errorClass = classifyMemoryError(error);
|
|
28422
28642
|
const latencyMs = Math.max(0, Math.round(performance.now() - started));
|
|
28423
28643
|
const message = memoryErrorMessage(errorClass, memoryErrorStatus(error));
|
|
@@ -28684,11 +28904,11 @@ async function handlePageProxy(req, res) {
|
|
|
28684
28904
|
// src/http/pages.ts
|
|
28685
28905
|
init_zod();
|
|
28686
28906
|
init_asset_key_auth();
|
|
28687
|
-
init_audit_user();
|
|
28688
28907
|
init_db4();
|
|
28689
28908
|
init_page_versions();
|
|
28690
28909
|
init_version3();
|
|
28691
28910
|
init_resolver();
|
|
28911
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
28692
28912
|
init_session_templates();
|
|
28693
28913
|
init_rbac();
|
|
28694
28914
|
init_sibling_awareness();
|
|
@@ -28701,7 +28921,6 @@ init_request_auth_context();
|
|
|
28701
28921
|
init_favorite_owner();
|
|
28702
28922
|
init_request_principal();
|
|
28703
28923
|
init_route_def();
|
|
28704
|
-
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
28705
28924
|
|
|
28706
28925
|
// src/http/tasks.ts
|
|
28707
28926
|
init_zod();
|
|
@@ -28709,12 +28928,46 @@ init_asset_key_auth();
|
|
|
28709
28928
|
init_audit_user();
|
|
28710
28929
|
init_db4();
|
|
28711
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();
|
|
28712
28965
|
init_model_validation2();
|
|
28713
28966
|
init_rbac_roles();
|
|
28714
28967
|
init_session_shares();
|
|
28715
28968
|
init_steering2();
|
|
28716
28969
|
init_task_citations2();
|
|
28717
|
-
|
|
28970
|
+
init_task_ui_spec2();
|
|
28718
28971
|
init_rbac();
|
|
28719
28972
|
init_session_mirror();
|
|
28720
28973
|
init_context_key();
|
|
@@ -28730,6 +28983,7 @@ init_request_auth_context();
|
|
|
28730
28983
|
init_secret_scrubber();
|
|
28731
28984
|
init_vcs_repo_match();
|
|
28732
28985
|
init_config();
|
|
28986
|
+
init_idempotency_key();
|
|
28733
28987
|
|
|
28734
28988
|
// src/http/list-total-cache.ts
|
|
28735
28989
|
var LIST_TOTAL_TTL_MS = 30000;
|
|
@@ -28906,6 +29160,7 @@ var AgentTaskSummarySchema = AgentTaskSchema.pick({
|
|
|
28906
29160
|
createdAt: true,
|
|
28907
29161
|
lastUpdatedAt: true,
|
|
28908
29162
|
finishedAt: true,
|
|
29163
|
+
statusKind: true,
|
|
28909
29164
|
peakContextPercent: true,
|
|
28910
29165
|
totalCostUsd: true
|
|
28911
29166
|
});
|
|
@@ -28974,6 +29229,7 @@ var listTasks = route({
|
|
|
28974
29229
|
tags: ["Tasks"],
|
|
28975
29230
|
query: object2({
|
|
28976
29231
|
status: string2().optional(),
|
|
29232
|
+
statusKind: TaskStatusKindSchema.optional().describe("Why the task ended, e.g. `status=failed&statusKind=error` (crash, rate limit, exit code) vs `statusKind=agent` (the agent chose to fail). Valid kinds per status: TASK_STATUS_KINDS in src/types.ts."),
|
|
28977
29233
|
agentId: string2().optional(),
|
|
28978
29234
|
scheduleId: string2().optional(),
|
|
28979
29235
|
workflowRunId: string2().uuid().optional(),
|
|
@@ -29015,6 +29271,7 @@ var createTask = route({
|
|
|
29015
29271
|
rbac: { permission: "task.create.own" },
|
|
29016
29272
|
summary: "Create a new task",
|
|
29017
29273
|
tags: ["Tasks"],
|
|
29274
|
+
headers: idempotencyKeyHeader("creates one task (a replay returns that task as it is now)"),
|
|
29018
29275
|
body: object2({
|
|
29019
29276
|
task: string2().min(1),
|
|
29020
29277
|
agentId: string2().optional(),
|
|
@@ -29051,10 +29308,12 @@ var createTask = route({
|
|
|
29051
29308
|
responses: {
|
|
29052
29309
|
201: { description: "Task created", schema: AgentTaskSchema },
|
|
29053
29310
|
400: {
|
|
29054
|
-
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"
|
|
29055
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" },
|
|
29056
29315
|
403: {
|
|
29057
|
-
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"
|
|
29058
29317
|
},
|
|
29059
29318
|
422: {
|
|
29060
29319
|
description: "Task creation blocked by an extension",
|
|
@@ -29622,6 +29881,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29622
29881
|
});
|
|
29623
29882
|
const filters = {
|
|
29624
29883
|
status,
|
|
29884
|
+
statusKind: parsed.query.statusKind,
|
|
29625
29885
|
agentId: parsed.query.agentId || undefined,
|
|
29626
29886
|
scheduleId: parsed.query.scheduleId || undefined,
|
|
29627
29887
|
workflowRunId: parsed.query.workflowRunId,
|
|
@@ -29650,9 +29910,35 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29650
29910
|
return true;
|
|
29651
29911
|
}
|
|
29652
29912
|
if (createTask.match(req.method, pathSegments)) {
|
|
29913
|
+
const idempotency = readIdempotencyKey(req, res, myAgentId);
|
|
29914
|
+
if (idempotency === null)
|
|
29915
|
+
return true;
|
|
29653
29916
|
const parsed = await createTask.parse(req, res, pathSegments, queryParams);
|
|
29654
29917
|
if (!parsed)
|
|
29655
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;
|
|
29656
29942
|
const trustedUserId = await resolveHttpRequesterUserId(req, myAgentId);
|
|
29657
29943
|
const requestedByUserId = await resolveTaskRequester(req, myAgentId, parsed.body.requestedByUserId, trustedUserId);
|
|
29658
29944
|
let defaultAgentId = parsed.body.agentId || undefined;
|
|
@@ -29711,7 +29997,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29711
29997
|
try {
|
|
29712
29998
|
const inheritedKey = parentTask?.key;
|
|
29713
29999
|
const requestedKey = parsed.body.key ?? inheritedKey;
|
|
29714
|
-
assetKey = requestedKey ? await
|
|
30000
|
+
assetKey = requestedKey ? await authorizeHttpAssetKeyWrite(req, myAgentId, requestedKey, trustedUserId) : undefined;
|
|
29715
30001
|
} catch (error) {
|
|
29716
30002
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
29717
30003
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -29720,7 +30006,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29720
30006
|
throw error;
|
|
29721
30007
|
}
|
|
29722
30008
|
try {
|
|
29723
|
-
const
|
|
30009
|
+
const prepared = await prepareTaskWithSiblingAwareness(parsed.body.task, {
|
|
29724
30010
|
key: assetKey,
|
|
29725
30011
|
agentId: defaultAgentId,
|
|
29726
30012
|
routingReason: parsed.body.routingReason ?? (defaultAgentId ? parentTask?.agentId === defaultAgentId ? "continuity" : "skill" : undefined),
|
|
@@ -29749,6 +30035,13 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29749
30035
|
effort: parsed.body.effort,
|
|
29750
30036
|
profile: parsed.body.profile
|
|
29751
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);
|
|
29752
30045
|
ensure({
|
|
29753
30046
|
id: "created",
|
|
29754
30047
|
flow: "task",
|
|
@@ -29769,6 +30062,8 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29769
30062
|
}
|
|
29770
30063
|
createTask.respond(res, 201, task);
|
|
29771
30064
|
} catch (error) {
|
|
30065
|
+
if (error instanceof IdempotencyKeyTakenError && await replayCreate())
|
|
30066
|
+
return true;
|
|
29772
30067
|
if (error instanceof TaskRoutingAuthorizationError) {
|
|
29773
30068
|
console.warn("[HTTP] Task assignment rejected:", scrubSecrets(JSON.stringify({
|
|
29774
30069
|
parentTaskId: parsed.body.parentTaskId,
|
|
@@ -29825,7 +30120,25 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29825
30120
|
const parsed = await updateSession.parse(req, res, pathSegments, queryParams);
|
|
29826
30121
|
if (!parsed)
|
|
29827
30122
|
return true;
|
|
29828
|
-
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
|
+
}
|
|
29829
30142
|
if (!task) {
|
|
29830
30143
|
jsonError(res, "Task not found", 404);
|
|
29831
30144
|
return true;
|
|
@@ -29872,7 +30185,9 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
29872
30185
|
reason = body.reason;
|
|
29873
30186
|
} catch {}
|
|
29874
30187
|
}
|
|
29875
|
-
const cancelledTask = await cancelTask2(parsed.params.id, reason
|
|
30188
|
+
const cancelledTask = await cancelTask2(parsed.params.id, reason, {
|
|
30189
|
+
statusKind: principal.kind === "agent" ? "agent" : "user"
|
|
30190
|
+
});
|
|
29876
30191
|
if (!cancelledTask) {
|
|
29877
30192
|
jsonError(res, "Failed to cancel task", 500);
|
|
29878
30193
|
return true;
|
|
@@ -30246,19 +30561,19 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
30246
30561
|
}
|
|
30247
30562
|
let updatedTask;
|
|
30248
30563
|
if (parsed.body.status === "completed") {
|
|
30249
|
-
const result = await completeTask2(parsed.params.id, parsed.body.output || "Completed by runner wrapper (no explicit output)");
|
|
30564
|
+
const result = await completeTask2(parsed.params.id, parsed.body.output || "Completed by runner wrapper (no explicit output)", { statusKind: "runner" });
|
|
30250
30565
|
if (!result) {
|
|
30251
30566
|
return { error: "Failed to complete task", status: 500 };
|
|
30252
30567
|
}
|
|
30253
30568
|
updatedTask = result;
|
|
30254
30569
|
} else if (parsed.body.status === "skipped") {
|
|
30255
|
-
const result = await skipTask2(parsed.params.id, skipReason);
|
|
30570
|
+
const result = await skipTask2(parsed.params.id, skipReason, { statusKind: "runner" });
|
|
30256
30571
|
if (!result) {
|
|
30257
30572
|
return { error: "Failed to mark task as skipped", status: 500 };
|
|
30258
30573
|
}
|
|
30259
30574
|
updatedTask = result;
|
|
30260
30575
|
} else {
|
|
30261
|
-
const result = await failTask2(parsed.params.id, parsed.body.failureReason || "Process exited without explicit completion");
|
|
30576
|
+
const result = await failTask2(parsed.params.id, parsed.body.failureReason || "Process exited without explicit completion", { statusKind: "error" });
|
|
30262
30577
|
if (!result) {
|
|
30263
30578
|
return { error: "Failed to mark task as failed", status: 500 };
|
|
30264
30579
|
}
|
|
@@ -30609,7 +30924,9 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
30609
30924
|
}
|
|
30610
30925
|
}
|
|
30611
30926
|
if (task.workflowRunStepId != null) {
|
|
30612
|
-
const failed = await failTask2(parsed.params.id, SUPERSEDED_WORKFLOW_TASK_REASON
|
|
30927
|
+
const failed = await failTask2(parsed.params.id, SUPERSEDED_WORKFLOW_TASK_REASON, {
|
|
30928
|
+
statusKind: "error"
|
|
30929
|
+
});
|
|
30613
30930
|
if (task.agentId) {
|
|
30614
30931
|
await updateAgentStatusFromCapacity2(task.agentId);
|
|
30615
30932
|
}
|
|
@@ -31056,7 +31373,7 @@ async function handlePages(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
31056
31373
|
passwordHash = await Bun.password.hash(parsed.body.password, "bcrypt");
|
|
31057
31374
|
}
|
|
31058
31375
|
try {
|
|
31059
|
-
const key = parsed.body.key ? await
|
|
31376
|
+
const key = parsed.body.key ? await authorizeHttpAssetKeyWrite(req, myAgentId, parsed.body.key) : undefined;
|
|
31060
31377
|
const page = await createPage2({
|
|
31061
31378
|
key,
|
|
31062
31379
|
agentId: myAgentId,
|
|
@@ -31260,7 +31577,7 @@ async function handlePages(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
31260
31577
|
let key;
|
|
31261
31578
|
if (parsed.body.key !== undefined) {
|
|
31262
31579
|
try {
|
|
31263
|
-
key = await
|
|
31580
|
+
key = await authorizeHttpAssetKeyWrite(req, myAgentId, parsed.body.key);
|
|
31264
31581
|
} catch (error) {
|
|
31265
31582
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
31266
31583
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -34018,6 +34335,8 @@ init_server();
|
|
|
34018
34335
|
|
|
34019
34336
|
// src/slack/channel-activity.ts
|
|
34020
34337
|
init_app4();
|
|
34338
|
+
init_external_channel();
|
|
34339
|
+
init_handlers();
|
|
34021
34340
|
var cachedBotUserId = null;
|
|
34022
34341
|
var channelCache = null;
|
|
34023
34342
|
var CHANNEL_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
@@ -34048,6 +34367,8 @@ async function fetchChannelActivity(cursors, allowedChannelIds, limit = 10) {
|
|
|
34048
34367
|
const channelId = channel.id;
|
|
34049
34368
|
const cursor = cursors.get(channelId);
|
|
34050
34369
|
try {
|
|
34370
|
+
if (await shouldBlockChannel2(client, channelId))
|
|
34371
|
+
continue;
|
|
34051
34372
|
if (!cursor) {
|
|
34052
34373
|
const seedResult = await client.conversations.history({
|
|
34053
34374
|
channel: channelId,
|
|
@@ -34075,6 +34396,8 @@ async function fetchChannelActivity(cursors, allowedChannelIds, limit = 10) {
|
|
|
34075
34396
|
continue;
|
|
34076
34397
|
if (msg.thread_ts && msg.thread_ts !== msg.ts)
|
|
34077
34398
|
continue;
|
|
34399
|
+
if (!await isUserAllowed2(client, msg.user, LOOKUP_USER_TEAM2))
|
|
34400
|
+
continue;
|
|
34078
34401
|
messages.push({
|
|
34079
34402
|
channelId,
|
|
34080
34403
|
channelName: channel.name,
|
|
@@ -35660,9 +35983,11 @@ init_repo_merge_policy();
|
|
|
35660
35983
|
init_rbac();
|
|
35661
35984
|
init_telemetry();
|
|
35662
35985
|
init_types5();
|
|
35986
|
+
init_request_auth_context();
|
|
35663
35987
|
init_request_principal();
|
|
35664
35988
|
init_route_def();
|
|
35665
35989
|
init_utils2();
|
|
35990
|
+
var notOptionLike = (schema, field) => schema.refine((value) => !value.startsWith("-"), `${field} must not start with "-"`);
|
|
35666
35991
|
var getRepo = route({
|
|
35667
35992
|
method: "get",
|
|
35668
35993
|
path: "/api/repos/{id}",
|
|
@@ -35696,10 +36021,10 @@ var createRepo = route({
|
|
|
35696
36021
|
summary: "Create a new repo",
|
|
35697
36022
|
tags: ["Repos"],
|
|
35698
36023
|
body: object2({
|
|
35699
|
-
url: string2().min(1),
|
|
36024
|
+
url: notOptionLike(string2().min(1), "url"),
|
|
35700
36025
|
name: string2().min(1),
|
|
35701
|
-
clonePath: string2().optional(),
|
|
35702
|
-
defaultBranch: string2().optional(),
|
|
36026
|
+
clonePath: notOptionLike(string2(), "clonePath").optional(),
|
|
36027
|
+
defaultBranch: notOptionLike(string2(), "defaultBranch").optional(),
|
|
35703
36028
|
autoClone: boolean().optional(),
|
|
35704
36029
|
hooks: RepoHooksSchema.optional(),
|
|
35705
36030
|
guidelines: RepoGuidelinesInputSchema.nullable().optional()
|
|
@@ -35708,7 +36033,7 @@ var createRepo = route({
|
|
|
35708
36033
|
201: { description: "Repo created", schema: SwarmRepoSchema },
|
|
35709
36034
|
400: { description: "Validation error", schema: object2({ error: string2() }) },
|
|
35710
36035
|
403: {
|
|
35711
|
-
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",
|
|
35712
36037
|
schema: object2({ error: string2() })
|
|
35713
36038
|
},
|
|
35714
36039
|
409: { description: "Duplicate repo", schema: object2({ error: string2() }) }
|
|
@@ -35723,10 +36048,10 @@ var updateRepo = route({
|
|
|
35723
36048
|
tags: ["Repos"],
|
|
35724
36049
|
params: object2({ id: string2().uuid() }),
|
|
35725
36050
|
body: object2({
|
|
35726
|
-
url: string2().optional(),
|
|
36051
|
+
url: notOptionLike(string2(), "url").optional(),
|
|
35727
36052
|
name: string2().optional(),
|
|
35728
|
-
clonePath: string2().optional(),
|
|
35729
|
-
defaultBranch: string2().optional(),
|
|
36053
|
+
clonePath: notOptionLike(string2(), "clonePath").optional(),
|
|
36054
|
+
defaultBranch: notOptionLike(string2(), "defaultBranch").optional(),
|
|
35730
36055
|
autoClone: boolean().optional(),
|
|
35731
36056
|
hooks: RepoHooksSchema.nullable().optional(),
|
|
35732
36057
|
guidelines: RepoGuidelinesInputSchema.nullable().optional()
|
|
@@ -35734,7 +36059,7 @@ var updateRepo = route({
|
|
|
35734
36059
|
responses: {
|
|
35735
36060
|
200: { description: "Repo updated", schema: SwarmRepoSchema },
|
|
35736
36061
|
403: {
|
|
35737
|
-
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",
|
|
35738
36063
|
schema: object2({ error: string2() })
|
|
35739
36064
|
},
|
|
35740
36065
|
404: { description: "Repo not found", schema: object2({ error: string2() }) },
|
|
@@ -35752,7 +36077,8 @@ var deleteRepo = route({
|
|
|
35752
36077
|
responses: {
|
|
35753
36078
|
200: { description: "Repo deleted", schema: object2({ success: boolean() }) },
|
|
35754
36079
|
404: { description: "Repo not found", schema: object2({ error: string2() }) }
|
|
35755
|
-
}
|
|
36080
|
+
},
|
|
36081
|
+
rbac: { permission: "repo.delete" }
|
|
35756
36082
|
});
|
|
35757
36083
|
async function allowMergeRefusal(req, myAgentId) {
|
|
35758
36084
|
const decision = can({
|
|
@@ -35800,6 +36126,11 @@ async function handleRepos(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35800
36126
|
return true;
|
|
35801
36127
|
}
|
|
35802
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
|
+
}
|
|
35803
36134
|
try {
|
|
35804
36135
|
const repo = await createSwarmRepo2({
|
|
35805
36136
|
url: parsed.body.url,
|
|
@@ -35807,7 +36138,7 @@ async function handleRepos(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35807
36138
|
clonePath: parsed.body.clonePath,
|
|
35808
36139
|
defaultBranch: parsed.body.defaultBranch,
|
|
35809
36140
|
autoClone: parsed.body.autoClone,
|
|
35810
|
-
hooks: parsed.body.hooks,
|
|
36141
|
+
hooks: parsed.body.hooks ?? (execRefusal ? { enabled: false } : undefined),
|
|
35811
36142
|
guidelines: parsed.body.guidelines
|
|
35812
36143
|
});
|
|
35813
36144
|
try {
|
|
@@ -35837,7 +36168,7 @@ async function handleRepos(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35837
36168
|
autoClone: parsed.body.autoClone,
|
|
35838
36169
|
hooks: parsed.body.hooks,
|
|
35839
36170
|
guidelines: parsed.body.guidelines
|
|
35840
|
-
}, () => allowMergeRefusal(req, myAgentId));
|
|
36171
|
+
}, () => allowMergeRefusal(req, myAgentId), () => execConfigRefusal(getRequestAuth(req), "http"));
|
|
35841
36172
|
if (result.kind === "refused") {
|
|
35842
36173
|
jsonError(res, result.refusal, 403);
|
|
35843
36174
|
return true;
|
|
@@ -35861,6 +36192,8 @@ async function handleRepos(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35861
36192
|
const parsed = await deleteRepo.parse(req, res, pathSegments, queryParams);
|
|
35862
36193
|
if (!parsed)
|
|
35863
36194
|
return true;
|
|
36195
|
+
if (await refuseAgentTokenWithout(req, res, "repo.delete"))
|
|
36196
|
+
return true;
|
|
35864
36197
|
const deleted = await deleteSwarmRepo2(parsed.params.id);
|
|
35865
36198
|
if (!deleted) {
|
|
35866
36199
|
jsonError(res, "Repo not found", 404);
|
|
@@ -39379,11 +39712,12 @@ init_db3();
|
|
|
39379
39712
|
init_rbac();
|
|
39380
39713
|
init_scheduler();
|
|
39381
39714
|
init_types5();
|
|
39715
|
+
init_request_auth_context();
|
|
39716
|
+
var import_cron_parser = __toESM(require_dist(), 1);
|
|
39382
39717
|
init_favorite_owner();
|
|
39383
39718
|
init_request_principal();
|
|
39384
39719
|
init_route_def();
|
|
39385
39720
|
init_utils2();
|
|
39386
|
-
var import_cron_parser = __toESM(require_dist(), 1);
|
|
39387
39721
|
var scheduleUpdateBodySchema = object2({
|
|
39388
39722
|
key: AssetKeySchema.optional(),
|
|
39389
39723
|
name: string2().optional(),
|
|
@@ -39709,7 +40043,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39709
40043
|
const trustedUserId = await resolveHttpRequesterUserId(req, myAgentId);
|
|
39710
40044
|
let key;
|
|
39711
40045
|
try {
|
|
39712
|
-
key = body.key ? await
|
|
40046
|
+
key = body.key ? await authorizeHttpAssetKeyWrite(req, myAgentId, body.key, trustedUserId) : undefined;
|
|
39713
40047
|
} catch (error) {
|
|
39714
40048
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
39715
40049
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -39778,6 +40112,15 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39778
40112
|
jsonError(res, "Schedule not found", 404);
|
|
39779
40113
|
return true;
|
|
39780
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
|
+
}
|
|
39781
40124
|
if (!schedule.enabled) {
|
|
39782
40125
|
jsonError(res, "Schedule is disabled", 400);
|
|
39783
40126
|
return true;
|
|
@@ -39830,7 +40173,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39830
40173
|
const body = parsed.body;
|
|
39831
40174
|
if (parsed.body.key !== undefined) {
|
|
39832
40175
|
try {
|
|
39833
|
-
body.key = await
|
|
40176
|
+
body.key = await authorizeHttpAssetKeyWrite(req, myAgentId, parsed.body.key);
|
|
39834
40177
|
} catch (error) {
|
|
39835
40178
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
39836
40179
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -39978,6 +40321,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39978
40321
|
}
|
|
39979
40322
|
}
|
|
39980
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;
|
|
39981
40325
|
if (existing.scheduleType === "one_time") {
|
|
39982
40326
|
if (!newEnabled) {
|
|
39983
40327
|
body.nextRunAt = null;
|
|
@@ -39985,18 +40329,23 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
39985
40329
|
} else {
|
|
39986
40330
|
if (!newEnabled) {
|
|
39987
40331
|
body.nextRunAt = null;
|
|
39988
|
-
} 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) {
|
|
39989
40333
|
const timing = mergeScheduleTiming({
|
|
39990
40334
|
cronExpression: existing.cronExpression ?? null,
|
|
39991
40335
|
intervalMs: existing.intervalMs ?? null
|
|
39992
40336
|
}, { cronExpression: parsed.body.cronExpression, intervalMs: parsed.body.intervalMs });
|
|
39993
|
-
const mergedTimezone = parsed.body.timezone !== undefined ? parsed.body.timezone : existing.timezone;
|
|
39994
40337
|
if (timing.mergedCron || timing.mergedInterval) {
|
|
39995
|
-
|
|
39996
|
-
|
|
39997
|
-
|
|
39998
|
-
|
|
39999
|
-
|
|
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
|
+
}
|
|
40000
40349
|
}
|
|
40001
40350
|
}
|
|
40002
40351
|
}
|
|
@@ -40185,7 +40534,7 @@ async function handleScriptConnectionProxy(req, res, pathSegments, queryParams,
|
|
|
40185
40534
|
} catch (err) {
|
|
40186
40535
|
mcpCallRoute.respond(res, 200, {
|
|
40187
40536
|
ok: false,
|
|
40188
|
-
error: err instanceof Error ? err.message : String(err)
|
|
40537
|
+
error: scrubSecrets(err instanceof Error ? err.message : String(err))
|
|
40189
40538
|
});
|
|
40190
40539
|
}
|
|
40191
40540
|
return true;
|
|
@@ -42193,6 +42542,8 @@ var listScriptRunsQuerySchema = object2({
|
|
|
42193
42542
|
status: ScriptRunStatusSchema.optional(),
|
|
42194
42543
|
agentId: string2().optional(),
|
|
42195
42544
|
scriptName: string2().optional(),
|
|
42545
|
+
objectScriptId: string2().optional(),
|
|
42546
|
+
objectId: string2().optional(),
|
|
42196
42547
|
limit: exports_coerce.number().int().min(1).max(500).optional(),
|
|
42197
42548
|
offset: exports_coerce.number().int().min(0).optional()
|
|
42198
42549
|
});
|
|
@@ -42485,6 +42836,10 @@ async function handleScriptRuns(req, res, pathSegments, queryParams, agentId) {
|
|
|
42485
42836
|
const agent = await requireAgent(res, agentId);
|
|
42486
42837
|
if (!agent)
|
|
42487
42838
|
return true;
|
|
42839
|
+
if (!durableScriptRunsAllowed()) {
|
|
42840
|
+
jsonError(res, DURABLE_RUNS_NATIVE_REFUSED, 400);
|
|
42841
|
+
return true;
|
|
42842
|
+
}
|
|
42488
42843
|
const secretRefusal = refuseSourceWithSecrets(parsed.body.source);
|
|
42489
42844
|
if (secretRefusal) {
|
|
42490
42845
|
json(res, secretRefusal, 400);
|
|
@@ -42530,7 +42885,7 @@ async function handleScriptRuns(req, res, pathSegments, queryParams, agentId) {
|
|
|
42530
42885
|
}
|
|
42531
42886
|
const { run, existing } = creation;
|
|
42532
42887
|
if (!existing && parsed.body.background) {
|
|
42533
|
-
startScriptRunProcess(run,
|
|
42888
|
+
startScriptRunProcess(run, getScriptApiBaseUrl(), bearerToken(req)).catch(async (err) => {
|
|
42534
42889
|
await updateScriptRun2(run.id, {
|
|
42535
42890
|
status: "failed",
|
|
42536
42891
|
pid: null,
|
|
@@ -42558,20 +42913,20 @@ async function handleScriptRuns(req, res, pathSegments, queryParams, agentId) {
|
|
|
42558
42913
|
const parsed = await listScriptRunsRoute.parse(req, res, pathSegments, queryParams);
|
|
42559
42914
|
if (!parsed)
|
|
42560
42915
|
return true;
|
|
42561
|
-
const
|
|
42916
|
+
const filter = {
|
|
42562
42917
|
status: parsed.query.status,
|
|
42563
42918
|
agentId: parsed.query.agentId,
|
|
42564
42919
|
scriptName: parsed.query.scriptName,
|
|
42565
|
-
|
|
42566
|
-
|
|
42920
|
+
objectScriptId: parsed.query.objectScriptId,
|
|
42921
|
+
objectId: parsed.query.objectId
|
|
42567
42922
|
};
|
|
42568
42923
|
listScriptRunsRoute.respond(res, 200, {
|
|
42569
|
-
runs: await listScriptRuns2(
|
|
42570
|
-
|
|
42571
|
-
|
|
42572
|
-
|
|
42573
|
-
|
|
42574
|
-
|
|
42924
|
+
runs: await listScriptRuns2({
|
|
42925
|
+
...filter,
|
|
42926
|
+
limit: parsed.query.limit ?? 50,
|
|
42927
|
+
offset: parsed.query.offset ?? 0
|
|
42928
|
+
}),
|
|
42929
|
+
total: await countScriptRuns2(filter)
|
|
42575
42930
|
});
|
|
42576
42931
|
return true;
|
|
42577
42932
|
}
|
|
@@ -42854,10 +43209,157 @@ init_events();
|
|
|
42854
43209
|
init_script_connections();
|
|
42855
43210
|
init_script_credential_broker();
|
|
42856
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
|
|
42857
43358
|
init_embeddings();
|
|
42858
43359
|
init_extract_schema();
|
|
42859
43360
|
init_run_credential();
|
|
42860
43361
|
init_typecheck();
|
|
43362
|
+
init_users();
|
|
42861
43363
|
init_rbac();
|
|
42862
43364
|
init_registry();
|
|
42863
43365
|
init_extract_signature();
|
|
@@ -42865,6 +43367,7 @@ init_quickjs_compat();
|
|
|
42865
43367
|
init_types5();
|
|
42866
43368
|
init_request_auth_context();
|
|
42867
43369
|
init_secret_scrubber();
|
|
43370
|
+
init_request_principal();
|
|
42868
43371
|
init_route_def();
|
|
42869
43372
|
init_utils2();
|
|
42870
43373
|
var scriptNameSchema2 = string2().min(1).max(200);
|
|
@@ -42880,6 +43383,7 @@ var upsertBodySchema = object2({
|
|
|
42880
43383
|
var runBodySchema = object2({
|
|
42881
43384
|
name: scriptNameSchema2.optional(),
|
|
42882
43385
|
source: string2().min(1).optional(),
|
|
43386
|
+
object: object2({ id: string2().min(1).max(256), method: string2().min(1).max(128) }).optional(),
|
|
42883
43387
|
args: unknown().optional(),
|
|
42884
43388
|
intent: string2().default(""),
|
|
42885
43389
|
scope: ScriptScopeSchema.optional(),
|
|
@@ -42888,6 +43392,8 @@ var runBodySchema = object2({
|
|
|
42888
43392
|
idempotencyKey: string2().max(200).optional()
|
|
42889
43393
|
}).refine((body) => Boolean(body.name) !== Boolean(body.source), {
|
|
42890
43394
|
message: "Provide exactly one of name or source"
|
|
43395
|
+
}).refine((body) => !body.object || Boolean(body.name), {
|
|
43396
|
+
message: "object requires name"
|
|
42891
43397
|
});
|
|
42892
43398
|
var searchBodySchema = object2({
|
|
42893
43399
|
query: string2().default(""),
|
|
@@ -42903,6 +43409,8 @@ var listScriptsQuerySchema = object2({
|
|
|
42903
43409
|
includeScratch: _enum2(["true", "false"]).optional()
|
|
42904
43410
|
});
|
|
42905
43411
|
var scriptSignatureSchema = object2({
|
|
43412
|
+
kind: literal2("durable").optional(),
|
|
43413
|
+
methods: record2(string2(), object2({ argsType: string2(), resultType: string2(), description: string2() })).optional(),
|
|
42906
43414
|
argsType: string2(),
|
|
42907
43415
|
resultType: string2(),
|
|
42908
43416
|
description: string2()
|
|
@@ -42912,11 +43420,20 @@ var rowAuditColumnsShape = {
|
|
|
42912
43420
|
created_by: string2().nullable().optional(),
|
|
42913
43421
|
updated_by: string2().nullable().optional()
|
|
42914
43422
|
};
|
|
43423
|
+
function scriptKind(signatureJson) {
|
|
43424
|
+
try {
|
|
43425
|
+
return JSON.parse(signatureJson)?.kind === "durable" ? "durable" : "function";
|
|
43426
|
+
} catch {
|
|
43427
|
+
return "function";
|
|
43428
|
+
}
|
|
43429
|
+
}
|
|
42915
43430
|
var scriptListItemSchema = ScriptRecordSchema.omit({
|
|
42916
43431
|
source: true,
|
|
42917
43432
|
signatureJson: true,
|
|
42918
43433
|
argsJsonSchema: true,
|
|
42919
43434
|
contentHash: true
|
|
43435
|
+
}).extend({
|
|
43436
|
+
kind: _enum2(["function", "durable"])
|
|
42920
43437
|
});
|
|
42921
43438
|
var scriptDetailSchema = ScriptRecordSchema.omit({ argsJsonSchema: true }).extend({
|
|
42922
43439
|
signature: scriptSignatureSchema,
|
|
@@ -42928,6 +43445,7 @@ var scriptApiWithSecretSchema = ScriptApiRecordSchema.extend({
|
|
|
42928
43445
|
});
|
|
42929
43446
|
var scriptRunResponseSchema = object2({
|
|
42930
43447
|
result: unknown().optional(),
|
|
43448
|
+
object: object2({ id: string2(), stateVersion: number2(), destroyed: boolean() }).optional(),
|
|
42931
43449
|
autoSaved: object2({ slug: string2(), reason: string2() }).optional(),
|
|
42932
43450
|
kvSaved: object2({ namespace: string2(), key: string2() }).optional(),
|
|
42933
43451
|
truncated: object2({ stdout: boolean(), stderr: boolean() }),
|
|
@@ -42996,7 +43514,7 @@ var upsertRoute2 = route({
|
|
|
42996
43514
|
name: string2(),
|
|
42997
43515
|
version: number2(),
|
|
42998
43516
|
contentDeduped: boolean(),
|
|
42999
|
-
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.")
|
|
43000
43518
|
})
|
|
43001
43519
|
},
|
|
43002
43520
|
400: { description: "Validation or typecheck failure" },
|
|
@@ -43021,6 +43539,7 @@ var runRoute = route({
|
|
|
43021
43539
|
200: { description: "Script run completed", schema: scriptRunResponseSchema },
|
|
43022
43540
|
400: { description: "Validation error" },
|
|
43023
43541
|
404: { description: "Script not found" },
|
|
43542
|
+
409: { description: "Object busy, re-entry, or lease lost" },
|
|
43024
43543
|
501: { description: "workspace-rw scripts are not supported in v1" }
|
|
43025
43544
|
}
|
|
43026
43545
|
});
|
|
@@ -43342,6 +43861,10 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43342
43861
|
json(res, secretRefusal, 400);
|
|
43343
43862
|
return true;
|
|
43344
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
|
+
}
|
|
43345
43868
|
const typecheck = await typecheckScript(parsed.body.source, { agentId: agent.id });
|
|
43346
43869
|
if (!typecheck.ok) {
|
|
43347
43870
|
json(res, {
|
|
@@ -43378,7 +43901,10 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43378
43901
|
isPromotion: Boolean(existingAgentScript)
|
|
43379
43902
|
});
|
|
43380
43903
|
}
|
|
43381
|
-
const warnings =
|
|
43904
|
+
const warnings = [
|
|
43905
|
+
...quickJSCompatWarnings(checkQuickJSCompat(parsed.body.source, { fsMode: parsed.body.fsMode })),
|
|
43906
|
+
...typecheck.warnings ?? []
|
|
43907
|
+
];
|
|
43382
43908
|
upsertRoute2.respond(res, 200, {
|
|
43383
43909
|
name: result.script.name,
|
|
43384
43910
|
version: result.script.version,
|
|
@@ -43394,6 +43920,12 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43394
43920
|
const agent = await requireAgent2(res, agentId);
|
|
43395
43921
|
if (!agent)
|
|
43396
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
|
+
}
|
|
43397
43929
|
const runtimeInstanceId = ((h) => Array.isArray(h) ? h[0] : h)(req.headers["x-runtime-instance-id"]);
|
|
43398
43930
|
const sourceTaskId = ((h) => Array.isArray(h) ? h[0] : h)(req.headers["x-source-task-id"]);
|
|
43399
43931
|
const secretRefusal = parsed.body.source ? refuseSourceWithSecrets(parsed.body.source) : null;
|
|
@@ -43401,6 +43933,10 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43401
43933
|
json(res, secretRefusal, 400);
|
|
43402
43934
|
return true;
|
|
43403
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
|
+
}
|
|
43404
43940
|
let source = parsed.body.source;
|
|
43405
43941
|
let fsMode = parsed.body.fsMode;
|
|
43406
43942
|
let executor = parsed.body.executor ?? null;
|
|
@@ -43416,6 +43952,20 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43416
43952
|
fsMode = script.fsMode;
|
|
43417
43953
|
executor = parsed.body.executor !== undefined ? parsed.body.executor : script.executor;
|
|
43418
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
|
+
}
|
|
43419
43969
|
if (fsMode === "workspace-rw") {
|
|
43420
43970
|
jsonError(res, "workspace-rw scripts are not supported by /api/scripts/run in v1", 501);
|
|
43421
43971
|
return true;
|
|
@@ -43426,14 +43976,13 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43426
43976
|
}
|
|
43427
43977
|
const startedAt = new Date().toISOString();
|
|
43428
43978
|
const runStartTouch = namedScript?.isScratch ? await touchScratchScriptLastUsed(namedScript.id) : null;
|
|
43429
|
-
const credentials = await buildScriptCredentialBindingsWithFailures({ agentId: agent.id });
|
|
43430
43979
|
const runId = crypto.randomUUID();
|
|
43431
|
-
const
|
|
43432
|
-
|
|
43433
|
-
|
|
43434
|
-
|
|
43435
|
-
|
|
43436
|
-
|
|
43980
|
+
const provenance = {
|
|
43981
|
+
...callerProvenance,
|
|
43982
|
+
sourceScriptRunId: runId
|
|
43983
|
+
};
|
|
43984
|
+
const credentials = await buildScriptCredentialBindingsWithFailures({ agentId: agent.id });
|
|
43985
|
+
const runContext = {
|
|
43437
43986
|
agentId: agent.id,
|
|
43438
43987
|
runtimeInstanceId,
|
|
43439
43988
|
sourceTaskId,
|
|
@@ -43443,10 +43992,55 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43443
43992
|
agentFs: credentials.agentFs,
|
|
43444
43993
|
apiConnections: getScriptApiConnectionDescriptors({ agentId: agent.id }),
|
|
43445
43994
|
mcpConnections: getScriptMcpConnectionDescriptors({ agentId: agent.id })
|
|
43446
|
-
}
|
|
43447
|
-
|
|
43448
|
-
|
|
43449
|
-
|
|
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
|
+
}
|
|
43450
44044
|
const ok = output.exitCode === 0 && !output.error && !output.runtimeError;
|
|
43451
44045
|
if (namedScript?.isScratch && ok) {
|
|
43452
44046
|
await touchScratchScriptLastUsed(namedScript.id);
|
|
@@ -43504,6 +44098,9 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43504
44098
|
source,
|
|
43505
44099
|
args: scrubObject(parsed.body.args ?? null),
|
|
43506
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,
|
|
43507
44104
|
status: ok ? "completed" : "failed",
|
|
43508
44105
|
output: scrubObject(output.result),
|
|
43509
44106
|
error: runError,
|
|
@@ -43513,6 +44110,7 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43513
44110
|
} catch {}
|
|
43514
44111
|
runRoute.respond(res, 200, scrubObject({
|
|
43515
44112
|
result: output.result,
|
|
44113
|
+
object,
|
|
43516
44114
|
autoSaved,
|
|
43517
44115
|
kvSaved,
|
|
43518
44116
|
truncated: output.truncated,
|
|
@@ -43565,7 +44163,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43565
44163
|
createdBy: script.createdBy,
|
|
43566
44164
|
updatedBy: script.updatedBy,
|
|
43567
44165
|
createdAt: script.createdAt,
|
|
43568
|
-
updatedAt: script.updatedAt
|
|
44166
|
+
updatedAt: script.updatedAt,
|
|
44167
|
+
kind: scriptKind(script.signatureJson)
|
|
43569
44168
|
}));
|
|
43570
44169
|
listScriptsRoute.respond(res, 200, { scripts });
|
|
43571
44170
|
return true;
|
|
@@ -43685,6 +44284,23 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43685
44284
|
jsonError(res, "agentId is required: this script has no owning agent to run as", 400);
|
|
43686
44285
|
return true;
|
|
43687
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
|
+
}
|
|
43688
44304
|
const endpoint = await createScriptApi({
|
|
43689
44305
|
scriptId: script.id,
|
|
43690
44306
|
agentId: runAsAgentId,
|
|
@@ -43716,6 +44332,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43716
44332
|
const parsed = await revealScriptApiSecretRoute.parse(req, res, pathSegments, queryParams);
|
|
43717
44333
|
if (!parsed)
|
|
43718
44334
|
return true;
|
|
44335
|
+
if (await refuseAgentTokenWithout(req, res, "script.api.read.secrets"))
|
|
44336
|
+
return true;
|
|
43719
44337
|
const endpoint = await getScriptApiById(parsed.params.endpointId);
|
|
43720
44338
|
if (!endpoint || endpoint.scriptId !== parsed.params.id) {
|
|
43721
44339
|
jsonError(res, "Endpoint not found", 404);
|
|
@@ -43728,6 +44346,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43728
44346
|
const parsed = await rotateScriptApiRoute.parse(req, res, pathSegments, queryParams);
|
|
43729
44347
|
if (!parsed)
|
|
43730
44348
|
return true;
|
|
44349
|
+
if (await refuseAgentTokenWithout(req, res, "script.api.rotate"))
|
|
44350
|
+
return true;
|
|
43731
44351
|
const endpoint = await getScriptApiById(parsed.params.endpointId);
|
|
43732
44352
|
if (!endpoint || endpoint.scriptId !== parsed.params.id) {
|
|
43733
44353
|
jsonError(res, "Endpoint not found", 404);
|
|
@@ -43745,6 +44365,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43745
44365
|
const parsed = await patchScriptApiRoute.parse(req, res, pathSegments, queryParams);
|
|
43746
44366
|
if (!parsed)
|
|
43747
44367
|
return true;
|
|
44368
|
+
if (await refuseAgentTokenWithout(req, res, "script.api.update"))
|
|
44369
|
+
return true;
|
|
43748
44370
|
const endpoint = await getScriptApiById(parsed.params.endpointId);
|
|
43749
44371
|
if (!endpoint || endpoint.scriptId !== parsed.params.id) {
|
|
43750
44372
|
jsonError(res, "Endpoint not found", 404);
|
|
@@ -43762,6 +44384,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
43762
44384
|
const parsed = await deleteScriptApiRoute.parse(req, res, pathSegments, queryParams);
|
|
43763
44385
|
if (!parsed)
|
|
43764
44386
|
return true;
|
|
44387
|
+
if (await refuseAgentTokenWithout(req, res, "script.api.delete"))
|
|
44388
|
+
return true;
|
|
43765
44389
|
const endpoint = await getScriptApiById(parsed.params.endpointId);
|
|
43766
44390
|
if (!endpoint || endpoint.scriptId !== parsed.params.id) {
|
|
43767
44391
|
jsonError(res, "Endpoint not found", 404);
|
|
@@ -44235,7 +44859,7 @@ init_rbac_roles();
|
|
|
44235
44859
|
init_session_shares();
|
|
44236
44860
|
init_steering2();
|
|
44237
44861
|
init_task_citations2();
|
|
44238
|
-
|
|
44862
|
+
init_task_ui_spec2();
|
|
44239
44863
|
init_users();
|
|
44240
44864
|
init_rbac();
|
|
44241
44865
|
init_auth2();
|
|
@@ -44345,6 +44969,7 @@ var AgentTaskSummarySchema2 = AgentTaskSchema.pick({
|
|
|
44345
44969
|
createdAt: true,
|
|
44346
44970
|
lastUpdatedAt: true,
|
|
44347
44971
|
finishedAt: true,
|
|
44972
|
+
statusKind: true,
|
|
44348
44973
|
peakContextPercent: true,
|
|
44349
44974
|
totalCostUsd: true
|
|
44350
44975
|
});
|
|
@@ -44796,7 +45421,7 @@ async function withSessionMove(req, res, myAgentId, destination, run) {
|
|
|
44796
45421
|
try {
|
|
44797
45422
|
const changedBy = await resolveHttpRequesterUserId(req, myAgentId);
|
|
44798
45423
|
const actor = await resolveSessionActor2(req, myAgentId);
|
|
44799
|
-
const key = destination === null ? null : await
|
|
45424
|
+
const key = destination === null ? null : await authorizeHttpAssetKeyWrite(req, myAgentId, destination, changedBy);
|
|
44800
45425
|
await assertAssetKeyMovesAllowed2();
|
|
44801
45426
|
await run({ actor, changedBy: changedBy ?? undefined, key });
|
|
44802
45427
|
} catch (error) {
|
|
@@ -45596,6 +46221,7 @@ async function getSkillUsageDetail(skillId, window, tzOffsetMinutes = 0, now = D
|
|
|
45596
46221
|
|
|
45597
46222
|
// src/http/skills.ts
|
|
45598
46223
|
init_types5();
|
|
46224
|
+
init_request_principal();
|
|
45599
46225
|
init_route_def();
|
|
45600
46226
|
init_utils2();
|
|
45601
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.";
|
|
@@ -46099,6 +46725,8 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46099
46725
|
const parsed = await installRemoteRoute.parse(req, res, pathSegments, queryParams);
|
|
46100
46726
|
if (!parsed)
|
|
46101
46727
|
return true;
|
|
46728
|
+
if (await refuseAgentTokenWithout(req, res, "skill.install.global"))
|
|
46729
|
+
return true;
|
|
46102
46730
|
try {
|
|
46103
46731
|
const branch = "main";
|
|
46104
46732
|
const filePath = parsed.body.sourcePath ? `${parsed.body.sourcePath}/SKILL.md` : "SKILL.md";
|
|
@@ -46220,6 +46848,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46220
46848
|
jsonError(res, "Skill not found", 404);
|
|
46221
46849
|
return true;
|
|
46222
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
|
+
}
|
|
46223
46857
|
try {
|
|
46224
46858
|
const agentSkill = await installSkill2(parsed.body.agentId, parsed.params.id);
|
|
46225
46859
|
installSkillRoute.respond(res, 200, { agentSkill });
|
|
@@ -46232,6 +46866,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46232
46866
|
const parsed = await uninstallSkillRoute.parse(req, res, pathSegments, queryParams);
|
|
46233
46867
|
if (!parsed)
|
|
46234
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
|
+
}
|
|
46235
46875
|
const removed = await uninstallSkill2(parsed.params.agentId, parsed.params.id);
|
|
46236
46876
|
uninstallSkillRoute.respond(res, 200, { success: removed });
|
|
46237
46877
|
return true;
|
|
@@ -46294,6 +46934,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46294
46934
|
jsonError(res, "Skill not found", 404);
|
|
46295
46935
|
return true;
|
|
46296
46936
|
}
|
|
46937
|
+
if (await refuseAgentTokenWithout(req, res, "skill.update.any", {
|
|
46938
|
+
kind: "owned",
|
|
46939
|
+
ownerAgentId: skill.ownerAgentId
|
|
46940
|
+
})) {
|
|
46941
|
+
return true;
|
|
46942
|
+
}
|
|
46297
46943
|
if (skill.systemDefault) {
|
|
46298
46944
|
jsonError(res, SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE, 403);
|
|
46299
46945
|
return true;
|
|
@@ -46342,6 +46988,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46342
46988
|
jsonError(res, "Skill not found", 404);
|
|
46343
46989
|
return true;
|
|
46344
46990
|
}
|
|
46991
|
+
if (await refuseAgentTokenWithout(req, res, "skill.update.any", {
|
|
46992
|
+
kind: "owned",
|
|
46993
|
+
ownerAgentId: skill.ownerAgentId
|
|
46994
|
+
})) {
|
|
46995
|
+
return true;
|
|
46996
|
+
}
|
|
46345
46997
|
if (skill.systemDefault) {
|
|
46346
46998
|
jsonError(res, SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE, 403);
|
|
46347
46999
|
return true;
|
|
@@ -46368,6 +47020,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46368
47020
|
jsonError(res, "Skill not found", 404);
|
|
46369
47021
|
return true;
|
|
46370
47022
|
}
|
|
47023
|
+
if (await refuseAgentTokenWithout(req, res, "skill.update.any", {
|
|
47024
|
+
kind: "owned",
|
|
47025
|
+
ownerAgentId: skill.ownerAgentId
|
|
47026
|
+
})) {
|
|
47027
|
+
return true;
|
|
47028
|
+
}
|
|
46371
47029
|
if (skill.systemDefault) {
|
|
46372
47030
|
jsonError(res, SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE, 403);
|
|
46373
47031
|
return true;
|
|
@@ -46402,6 +47060,9 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46402
47060
|
const parsed = await createSkillRoute.parse(req, res, pathSegments, queryParams);
|
|
46403
47061
|
if (!parsed)
|
|
46404
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
|
+
}
|
|
46405
47066
|
try {
|
|
46406
47067
|
const pm = parseSkillContent(parsed.body.content);
|
|
46407
47068
|
const skill = await createSkill2({
|
|
@@ -46437,6 +47098,13 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46437
47098
|
jsonError(res, "Skill not found", 404);
|
|
46438
47099
|
return true;
|
|
46439
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
|
+
}
|
|
46440
47108
|
const protectedSystemDefaultFields = [
|
|
46441
47109
|
"content",
|
|
46442
47110
|
"name",
|
|
@@ -46499,6 +47167,12 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46499
47167
|
jsonError(res, "Skill not found", 404);
|
|
46500
47168
|
return true;
|
|
46501
47169
|
}
|
|
47170
|
+
if (await refuseAgentTokenWithout(req, res, "skill.delete.any", {
|
|
47171
|
+
kind: "owned",
|
|
47172
|
+
ownerAgentId: existing.ownerAgentId
|
|
47173
|
+
})) {
|
|
47174
|
+
return true;
|
|
47175
|
+
}
|
|
46502
47176
|
if (existing.systemDefault) {
|
|
46503
47177
|
jsonError(res, SYSTEM_DEFAULT_SKILL_LOCKED_MESSAGE, 403);
|
|
46504
47178
|
return true;
|
|
@@ -47268,6 +47942,8 @@ init_metadata();
|
|
|
47268
47942
|
init_webhook();
|
|
47269
47943
|
init_webhook_lifecycle();
|
|
47270
47944
|
init_ensure_token();
|
|
47945
|
+
init_config();
|
|
47946
|
+
init_request_principal();
|
|
47271
47947
|
init_route_def();
|
|
47272
47948
|
init_utils2();
|
|
47273
47949
|
|
|
@@ -47420,6 +48096,7 @@ var jiraWebhookRegister = route({
|
|
|
47420
48096
|
body: object2({
|
|
47421
48097
|
jqlFilter: string2().min(1)
|
|
47422
48098
|
}),
|
|
48099
|
+
rbac: { permission: "oauth-authorization.manage" },
|
|
47423
48100
|
responses: {
|
|
47424
48101
|
200: { description: "Webhook registered", schema: JiraWebhookRegisteredSchema },
|
|
47425
48102
|
400: { description: "Invalid jqlFilter" },
|
|
@@ -47435,6 +48112,7 @@ var jiraWebhookDelete = route({
|
|
|
47435
48112
|
params: object2({
|
|
47436
48113
|
id: exports_coerce.number().int().positive()
|
|
47437
48114
|
}),
|
|
48115
|
+
rbac: { permission: "oauth-authorization.manage" },
|
|
47438
48116
|
responses: {
|
|
47439
48117
|
200: { description: "Webhook deleted", schema: JiraWebhookDeletedSchema },
|
|
47440
48118
|
400: { description: "Invalid webhook id" },
|
|
@@ -47447,13 +48125,15 @@ var jiraDisconnect = route({
|
|
|
47447
48125
|
pattern: ["api", "trackers", "jira", "disconnect"],
|
|
47448
48126
|
summary: "Fully disconnect Jira: delete all webhooks, drop tokens, clear metadata",
|
|
47449
48127
|
tags: ["Trackers"],
|
|
48128
|
+
rbac: { permission: "oauth-authorization.manage" },
|
|
47450
48129
|
responses: {
|
|
47451
48130
|
200: { description: "Disconnected", schema: JiraDisconnectResultSchema },
|
|
47452
48131
|
503: { description: "Jira not configured" }
|
|
47453
48132
|
}
|
|
47454
48133
|
});
|
|
47455
|
-
function getWebhookUrl(req) {
|
|
47456
|
-
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>";
|
|
47457
48137
|
return `${deriveApiBaseUrl(req)}/api/trackers/jira/webhook/${token}`;
|
|
47458
48138
|
}
|
|
47459
48139
|
function getRedirectUri(req) {
|
|
@@ -47477,7 +48157,7 @@ async function buildJiraStatusPayload(req) {
|
|
|
47477
48157
|
scope,
|
|
47478
48158
|
hasManageWebhookScope,
|
|
47479
48159
|
webhookTokenConfigured: Boolean(process.env.JIRA_WEBHOOK_TOKEN),
|
|
47480
|
-
webhookUrl: getWebhookUrl(req),
|
|
48160
|
+
webhookUrl: await getWebhookUrl(req),
|
|
47481
48161
|
redirectUri: getRedirectUri(req),
|
|
47482
48162
|
webhookIds: meta.webhookIds ?? []
|
|
47483
48163
|
};
|
|
@@ -47594,6 +48274,8 @@ async function handleJiraTracker(req, res, pathSegments) {
|
|
|
47594
48274
|
return true;
|
|
47595
48275
|
}
|
|
47596
48276
|
if (jiraWebhookRegister.match(req.method, pathSegments)) {
|
|
48277
|
+
if (await refuseAgentTokenWithout(req, res, "oauth-authorization.manage"))
|
|
48278
|
+
return true;
|
|
47597
48279
|
if (!isJiraEnabled()) {
|
|
47598
48280
|
res.writeHead(503, { "Content-Type": "application/json" });
|
|
47599
48281
|
res.end(JSON.stringify({ error: "Jira integration not configured" }));
|
|
@@ -47620,6 +48302,8 @@ async function handleJiraTracker(req, res, pathSegments) {
|
|
|
47620
48302
|
return true;
|
|
47621
48303
|
}
|
|
47622
48304
|
if (jiraWebhookDelete.match(req.method, pathSegments)) {
|
|
48305
|
+
if (await refuseAgentTokenWithout(req, res, "oauth-authorization.manage"))
|
|
48306
|
+
return true;
|
|
47623
48307
|
if (!isJiraEnabled()) {
|
|
47624
48308
|
res.writeHead(503, { "Content-Type": "application/json" });
|
|
47625
48309
|
res.end(JSON.stringify({ error: "Jira integration not configured" }));
|
|
@@ -47641,6 +48325,8 @@ async function handleJiraTracker(req, res, pathSegments) {
|
|
|
47641
48325
|
return true;
|
|
47642
48326
|
}
|
|
47643
48327
|
if (jiraDisconnect.match(req.method, pathSegments)) {
|
|
48328
|
+
if (await refuseAgentTokenWithout(req, res, "oauth-authorization.manage"))
|
|
48329
|
+
return true;
|
|
47644
48330
|
if (!isJiraEnabled()) {
|
|
47645
48331
|
res.writeHead(503, { "Content-Type": "application/json" });
|
|
47646
48332
|
res.end(JSON.stringify({ error: "Jira integration not configured" }));
|
|
@@ -47749,6 +48435,7 @@ async function handleLinearWebhook(rawBody, headers) {
|
|
|
47749
48435
|
|
|
47750
48436
|
// src/http/trackers/linear.ts
|
|
47751
48437
|
init_ensure_token();
|
|
48438
|
+
init_request_principal();
|
|
47752
48439
|
init_route_def();
|
|
47753
48440
|
init_utils2();
|
|
47754
48441
|
var LinearStatusSchema = object2({
|
|
@@ -47851,6 +48538,7 @@ var linearDisconnect = route({
|
|
|
47851
48538
|
pattern: ["api", "trackers", "linear", "disconnect"],
|
|
47852
48539
|
summary: "Fully disconnect Linear: revoke OAuth grant + drop tokens",
|
|
47853
48540
|
tags: ["Trackers"],
|
|
48541
|
+
rbac: { permission: "oauth-authorization.manage" },
|
|
47854
48542
|
responses: {
|
|
47855
48543
|
200: { description: "Disconnected", schema: LinearDisconnectSchema },
|
|
47856
48544
|
503: { description: "Linear not configured" }
|
|
@@ -47972,6 +48660,8 @@ async function handleLinearTracker(req, res, pathSegments) {
|
|
|
47972
48660
|
return true;
|
|
47973
48661
|
}
|
|
47974
48662
|
if (linearDisconnect.match(req.method, pathSegments)) {
|
|
48663
|
+
if (await refuseAgentTokenWithout(req, res, "oauth-authorization.manage"))
|
|
48664
|
+
return true;
|
|
47975
48665
|
if (!isLinearEnabled()) {
|
|
47976
48666
|
res.writeHead(503, { "Content-Type": "application/json" });
|
|
47977
48667
|
res.end(JSON.stringify({ error: "Linear integration not configured" }));
|
|
@@ -48287,6 +48977,7 @@ var createUserRoute = route({
|
|
|
48287
48977
|
metadata: record2(string2(), unknown()).optional(),
|
|
48288
48978
|
dailyBudgetUsd: number2().nullable().optional(),
|
|
48289
48979
|
status: _enum2(["invited", "active", "suspended"]).optional(),
|
|
48980
|
+
avatar: UserAvatarSchema.nullable().optional(),
|
|
48290
48981
|
identities: array2(object2({ kind: string2().min(1), externalId: string2().min(1) })).optional()
|
|
48291
48982
|
}),
|
|
48292
48983
|
responses: {
|
|
@@ -48428,6 +49119,7 @@ var updateUserRoute = route({
|
|
|
48428
49119
|
comms: UserCommsPrefsSchema.nullable().optional().describe("Merges into metadata.comms without touching sibling metadata keys; null removes only the comms key. When metadata is also provided, it is applied first and replaces the whole blob."),
|
|
48429
49120
|
dailyBudgetUsd: number2().nullable().optional(),
|
|
48430
49121
|
status: _enum2(["invited", "active", "suspended"]).optional(),
|
|
49122
|
+
avatar: UserAvatarSchema.nullable().optional(),
|
|
48431
49123
|
identities: array2(object2({ kind: string2().min(1), externalId: string2().min(1) })).optional()
|
|
48432
49124
|
}).refine((v) => Object.keys(v).length > 0, {
|
|
48433
49125
|
message: "At least one field must be provided"
|
|
@@ -49569,7 +50261,8 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
49569
50261
|
"timezone",
|
|
49570
50262
|
"preferredChannel",
|
|
49571
50263
|
"notes",
|
|
49572
|
-
"metadata"
|
|
50264
|
+
"metadata",
|
|
50265
|
+
"avatar"
|
|
49573
50266
|
];
|
|
49574
50267
|
for (const field of PROFILE_FIELDS) {
|
|
49575
50268
|
if (parsed.body[field] === undefined)
|
|
@@ -49810,6 +50503,7 @@ async function routeKapsoInbound(payload) {
|
|
|
49810
50503
|
}
|
|
49811
50504
|
|
|
49812
50505
|
// src/http/webhooks.ts
|
|
50506
|
+
init_deferred_task_waits();
|
|
49813
50507
|
init_errors2();
|
|
49814
50508
|
init_constants3();
|
|
49815
50509
|
init_github_host();
|
|
@@ -50067,7 +50761,7 @@ async function handleWebhooks(req, res, pathSegments) {
|
|
|
50067
50761
|
}
|
|
50068
50762
|
const eventType = req.headers["x-github-event"];
|
|
50069
50763
|
const signature = req.headers["x-hub-signature-256"];
|
|
50070
|
-
if (typeof eventType === "string" && eventType && !GITHUB_VERIFIED_EVENTS.has(eventType)) {
|
|
50764
|
+
if (typeof eventType === "string" && eventType && !GITHUB_VERIFIED_EVENTS.has(eventType) && !(eventType === "check_run" && await hasPendingEventWait("github", "vcs.pr.checks_done"))) {
|
|
50071
50765
|
countGithubIgnoredEvent(eventType);
|
|
50072
50766
|
githubWebhook.respond(res, 200, { created: false });
|
|
50073
50767
|
req.resume();
|
|
@@ -50165,6 +50859,17 @@ async function handleWebhooks(req, res, pathSegments) {
|
|
|
50165
50859
|
});
|
|
50166
50860
|
break;
|
|
50167
50861
|
}
|
|
50862
|
+
case "check_run": {
|
|
50863
|
+
const cr = body;
|
|
50864
|
+
workflowEventBus2.emit(`github.check_run.${cr.action}`, {
|
|
50865
|
+
repo: cr.repository.full_name,
|
|
50866
|
+
name: cr.check_run.name,
|
|
50867
|
+
headSha: cr.check_run.check_suite?.head_sha,
|
|
50868
|
+
conclusion: cr.check_run.conclusion,
|
|
50869
|
+
pullRequests: (cr.check_run.pull_requests ?? []).map((pr) => pr.number)
|
|
50870
|
+
});
|
|
50871
|
+
break;
|
|
50872
|
+
}
|
|
50168
50873
|
case "pull_request_review": {
|
|
50169
50874
|
const prr = body;
|
|
50170
50875
|
workflowEventBus2.emit("github.pull_request_review.submitted", {
|
|
@@ -51364,7 +52069,7 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
51364
52069
|
const trustedUserId = await resolveHttpRequesterUserId(req, myAgentId);
|
|
51365
52070
|
let key;
|
|
51366
52071
|
try {
|
|
51367
|
-
key = parsed.body.key ? await
|
|
52072
|
+
key = parsed.body.key ? await authorizeHttpAssetKeyWrite(req, myAgentId, parsed.body.key, trustedUserId) : undefined;
|
|
51368
52073
|
} catch (error) {
|
|
51369
52074
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
51370
52075
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -51481,7 +52186,7 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
51481
52186
|
const updateArgs = {};
|
|
51482
52187
|
if (parsed.body.key !== undefined) {
|
|
51483
52188
|
try {
|
|
51484
|
-
updateArgs.key = await
|
|
52189
|
+
updateArgs.key = await authorizeHttpAssetKeyWrite(req, myAgentId, parsed.body.key);
|
|
51485
52190
|
} catch (error) {
|
|
51486
52191
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
51487
52192
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -51569,7 +52274,7 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
51569
52274
|
let key;
|
|
51570
52275
|
if (body.key !== undefined) {
|
|
51571
52276
|
try {
|
|
51572
|
-
key = await
|
|
52277
|
+
key = await authorizeHttpAssetKeyWrite(req, myAgentId, body.key);
|
|
51573
52278
|
} catch (error) {
|
|
51574
52279
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
51575
52280
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -52226,7 +52931,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
52226
52931
|
});
|
|
52227
52932
|
});
|
|
52228
52933
|
var detachRealtime = attachRealtimeTransport(httpServer);
|
|
52229
|
-
var { attachControllerTransport } = await import("./controllers-connect-
|
|
52934
|
+
var { attachControllerTransport } = await import("./controllers-connect-tz07d2xr.js");
|
|
52230
52935
|
var detachControllers = attachControllerTransport(httpServer);
|
|
52231
52936
|
var stopWorkerNudges = startWorkerNudgeListener();
|
|
52232
52937
|
var taskAutoTitles = startTaskAutoTitleListener();
|
|
@@ -52257,7 +52962,7 @@ async function shutdown() {
|
|
|
52257
52962
|
sessionsProcessed: getServerSessionsProcessed()
|
|
52258
52963
|
});
|
|
52259
52964
|
if (hasCapability("scheduling")) {
|
|
52260
|
-
const { stopScheduler } = await import("./index-
|
|
52965
|
+
const { stopScheduler } = await import("./index-7w8p6em0.js");
|
|
52261
52966
|
stopScheduler();
|
|
52262
52967
|
}
|
|
52263
52968
|
stopHeartbeat2();
|
|
@@ -52269,7 +52974,7 @@ async function shutdown() {
|
|
|
52269
52974
|
await stopSlackApp2();
|
|
52270
52975
|
await stopChatSdk();
|
|
52271
52976
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
52272
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
52977
|
+
const { stopOAuthKeepalive } = await import("./keepalive-zdqay870.js");
|
|
52273
52978
|
await stopOAuthKeepalive();
|
|
52274
52979
|
}
|
|
52275
52980
|
stopOAuthPendingGc();
|
|
@@ -52342,6 +53047,7 @@ try {
|
|
|
52342
53047
|
throw err;
|
|
52343
53048
|
}
|
|
52344
53049
|
warnIfCorsAllowsAnyOrigin();
|
|
53050
|
+
setDeploymentEnvReader2(getDeploymentEnvValue2);
|
|
52345
53051
|
try {
|
|
52346
53052
|
const loaded = await loadSecretRegistry();
|
|
52347
53053
|
console.log(`[secret-registry] registered config=${loaded.config} oauth=${loaded.oauth} scriptApi=${loaded.scriptApi} runtimeController=${loaded.runtimeController} failed=${loaded.failed}`);
|
|
@@ -52359,21 +53065,21 @@ try {
|
|
|
52359
53065
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
52360
53066
|
}
|
|
52361
53067
|
try {
|
|
52362
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
53068
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-2hzvvzg0.js");
|
|
52363
53069
|
ensurePricingSeeded();
|
|
52364
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
53070
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-h79bg4cf.js");
|
|
52365
53071
|
startPricingRefreshLoop();
|
|
52366
53072
|
} catch (err) {
|
|
52367
53073
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
52368
53074
|
}
|
|
52369
53075
|
try {
|
|
52370
|
-
const { ensureModelProfilesSeeded } = await import("./boot-seeds-
|
|
53076
|
+
const { ensureModelProfilesSeeded } = await import("./boot-seeds-2hzvvzg0.js");
|
|
52371
53077
|
await ensureModelProfilesSeeded();
|
|
52372
53078
|
} catch (err) {
|
|
52373
53079
|
console.error("[startup] Failed to seed model profiles:", err);
|
|
52374
53080
|
}
|
|
52375
53081
|
try {
|
|
52376
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
53082
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-2hzvvzg0.js");
|
|
52377
53083
|
ensureRbacSeeded();
|
|
52378
53084
|
} catch (err) {
|
|
52379
53085
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -52381,13 +53087,13 @@ try {
|
|
|
52381
53087
|
throw err;
|
|
52382
53088
|
}
|
|
52383
53089
|
try {
|
|
52384
|
-
const { runAllSeeders } = await import("./index-
|
|
53090
|
+
const { runAllSeeders } = await import("./index-x9qf8dg7.js");
|
|
52385
53091
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
52386
53092
|
} catch (err) {
|
|
52387
53093
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
52388
53094
|
}
|
|
52389
53095
|
try {
|
|
52390
|
-
const { runImports } = await import("./index-
|
|
53096
|
+
const { runImports } = await import("./index-fdym6ryb.js");
|
|
52391
53097
|
await runImports();
|
|
52392
53098
|
} catch (err) {
|
|
52393
53099
|
console.error("[startup] File import failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
@@ -52407,6 +53113,7 @@ httpServer.listen(port, async () => {
|
|
|
52407
53113
|
const boundAddress = httpServer.address();
|
|
52408
53114
|
if (boundAddress && typeof boundAddress === "object") {
|
|
52409
53115
|
setExtensionLoopbackBaseUrl(`http://127.0.0.1:${boundAddress.port}`);
|
|
53116
|
+
setApiLoopbackBaseUrl(`http://127.0.0.1:${boundAddress.port}`);
|
|
52410
53117
|
}
|
|
52411
53118
|
console.log(`MCP HTTP server running on http://localhost:${port}/mcp`);
|
|
52412
53119
|
ensure({
|
|
@@ -52438,10 +53145,10 @@ httpServer.listen(port, async () => {
|
|
|
52438
53145
|
startChatSdk().catch((err) => {
|
|
52439
53146
|
console.error("[chat-sdk] Failed to start, continuing without Chat SDK:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
52440
53147
|
});
|
|
52441
|
-
import("./agent-fs-provision-
|
|
53148
|
+
import("./agent-fs-provision-7fa9e12e.js").then(({ syncAgentFsOrgSwarmUrl }) => syncAgentFsOrgSwarmUrl(getConfiguredAppUrls()[0])).catch((err) => {
|
|
52442
53149
|
console.warn("[agent-fs] Failed to set the org swarm URL:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
52443
53150
|
});
|
|
52444
|
-
import("./object-webhooks-
|
|
53151
|
+
import("./object-webhooks-mkca91s0.js").then(({ ensureObjectWebhooksForKnownDrives }) => ensureObjectWebhooksForKnownDrives()).catch((err) => {
|
|
52445
53152
|
console.warn("[objects] agent-fs webhook boot check failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
52446
53153
|
});
|
|
52447
53154
|
startQueueStallAlarm();
|
|
@@ -52455,24 +53162,24 @@ httpServer.listen(port, async () => {
|
|
|
52455
53162
|
await initLinear();
|
|
52456
53163
|
await initJira();
|
|
52457
53164
|
await initWorkflows2();
|
|
52458
|
-
await startScriptRunSupervisor(
|
|
53165
|
+
await startScriptRunSupervisor(getScriptApiBaseUrl());
|
|
52459
53166
|
if (hasCapability("scheduling")) {
|
|
52460
|
-
const { parseSchedulerIntervalMs, startScheduler } = await import("./index-
|
|
52461
|
-
const { getExecutorRegistry } = await import("./index-
|
|
53167
|
+
const { parseSchedulerIntervalMs, startScheduler } = await import("./index-7w8p6em0.js");
|
|
53168
|
+
const { getExecutorRegistry } = await import("./index-y3s0xp2v.js");
|
|
52462
53169
|
startScheduler(getExecutorRegistry(), parseSchedulerIntervalMs(process.env.SCHEDULER_INTERVAL_MS), { runId: globalState.__runId });
|
|
52463
53170
|
}
|
|
52464
53171
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
52465
|
-
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-
|
|
53172
|
+
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-vz4semsx.js");
|
|
52466
53173
|
startHeartbeat(parseHeartbeatIntervalMs(process.env.HEARTBEAT_INTERVAL_MS));
|
|
52467
53174
|
}
|
|
52468
53175
|
startPoolRouting();
|
|
52469
53176
|
startRuntimeSupervisor();
|
|
52470
53177
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
52471
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
53178
|
+
const { startOAuthKeepalive } = await import("./keepalive-zdqay870.js");
|
|
52472
53179
|
startOAuthKeepalive();
|
|
52473
53180
|
}
|
|
52474
53181
|
if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
|
|
52475
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
53182
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-y9zyd7t6.js");
|
|
52476
53183
|
startOAuthRefreshSweep();
|
|
52477
53184
|
}
|
|
52478
53185
|
startOAuthPendingGc();
|
|
@@ -52482,22 +53189,19 @@ httpServer.listen(port, async () => {
|
|
|
52482
53189
|
startSavingsRollup(savingsRollupSql);
|
|
52483
53190
|
startHumanFreeDrain();
|
|
52484
53191
|
startTaskSearchBackfill();
|
|
52485
|
-
import("./embedding-space-
|
|
52486
|
-
setDeploymentEnvReader(getDeploymentEnvValue2);
|
|
52487
|
-
return runEmbeddingMaintenance({ backfill: true });
|
|
52488
|
-
}).catch((err) => {
|
|
53192
|
+
import("./embedding-space-zsdw37bb.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch((err) => {
|
|
52489
53193
|
console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
|
|
52490
53194
|
});
|
|
52491
|
-
import("./boot-args-schema-
|
|
53195
|
+
import("./boot-args-schema-ry6cb0p7.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
|
|
52492
53196
|
console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
|
|
52493
53197
|
});
|
|
52494
|
-
import("./boot-scrub-sweep-
|
|
53198
|
+
import("./boot-scrub-sweep-3ycxr51t.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
52495
53199
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
52496
53200
|
});
|
|
52497
|
-
import("./user-merge-jobs-
|
|
53201
|
+
import("./user-merge-jobs-rabbncf6.js").then(({ resumeUserMergeJobs }) => resumeUserMergeJobs()).catch((err) => {
|
|
52498
53202
|
console.error("[user-merge] startup resume failed (non-fatal):", err);
|
|
52499
53203
|
});
|
|
52500
|
-
import("./session-source-backfill-
|
|
53204
|
+
import("./session-source-backfill-528j4s8j.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
|
|
52501
53205
|
console.error("[session-source-backfill] startup run failed (non-fatal):", err);
|
|
52502
53206
|
});
|
|
52503
53207
|
}).on("error", (err) => {
|