@desplega.ai/agent-swarm 2.12.0 → 2.13.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-cn53011z.js +17 -0
- package/dist/{acp-targets-311gcyvw.js → acp-targets-86f0sh6g.js} +9 -8
- package/dist/{actions-c4chgxp6.js → actions-zv8vcxvr.js} +24 -23
- package/dist/{agent-fs-provision-0b9awm5n.js → agent-fs-provision-jqshb33y.js} +4 -4
- package/dist/{amp-adapter-r0veq6x5.js → amp-adapter-gt503ywc.js} +2 -2
- package/dist/{app-hn5fftf5.js → app-6t4k5rh1.js} +6 -4
- package/dist/{approval-notifications-3g6yc8nv.js → approval-notifications-fcfw063h.js} +7 -6
- package/dist/{assistant-cpjgpjvp.js → assistant-9dzybh12.js} +25 -24
- package/dist/{boot-args-schema-hce1av1h.js → boot-args-schema-xzfp2feg.js} +1 -1
- package/dist/{boot-reembed-d7xcym0j.js → boot-reembed-3jz0p2jk.js} +1 -1
- package/dist/{boot-reembed-bztbxc4z.js → boot-reembed-r88wngfg.js} +5 -2
- package/dist/{boot-scrub-sweep-mkmm16gk.js → boot-scrub-sweep-scrqhw48.js} +2 -2
- package/dist/{boot-seeds-arrkbe8t.js → boot-seeds-vb2dcrrb.js} +4 -4
- package/dist/{claude-adapter-ykpyr5p8.js → claude-adapter-h3mp9hgs.js} +7 -6
- package/dist/{claude-managed-adapter-ssg6z4bt.js → claude-managed-adapter-kpbyj2vb.js} +3 -3
- package/dist/{claude-managed-setup-trd59v7b.js → claude-managed-setup-0efr3wkg.js} +5 -5
- package/dist/{claude-sdk-session-yjcze0j1.js → claude-sdk-session-03dw669q.js} +7 -6
- package/dist/{cli-e3ahxq5y.js → cli-0b655smz.js} +4 -4
- package/dist/{cli-mcymtvwn.js → cli-0dg7ytxm.js} +89 -11
- package/dist/cli-0jkenasr.js +148 -0
- package/dist/{cli-c7j31hq9.js → cli-0pazkmd4.js} +3 -3
- package/dist/{cli-5tg94mdw.js → cli-117g15t4.js} +8 -11
- package/dist/{cli-r14ac1y0.js → cli-1dbv9mj9.js} +1 -1
- package/dist/{cli-q8tc22bj.js → cli-1v82d2w6.js} +3 -3
- package/dist/{cli-pe3yxedk.js → cli-2jk4s7z1.js} +2 -2
- package/dist/{cli-0pp1yjg2.js → cli-2skf1mdf.js} +8 -8
- package/dist/{cli-2tw284hj.js → cli-48nvk6sb.js} +1 -1
- package/dist/{cli-en6dmkxd.js → cli-49f5jyhh.js} +2 -2
- package/dist/{cli-2z2c4k6q.js → cli-50w82h6m.js} +21 -0
- package/dist/{cli-dd2k2mcd.js → cli-6a40p4kv.js} +1 -1
- package/dist/{cli-yegz2g06.js → cli-6h88mn9q.js} +3 -3
- package/dist/{cli-52nfye5j.js → cli-7dbhnsj9.js} +23 -15
- package/dist/{cli-04zc3f7b.js → cli-9fsagra4.js} +1 -1
- package/dist/{cli-nja15knq.js → cli-9m9kyw77.js} +3 -3
- package/dist/{cli-k5jx8jya.js → cli-ajjvqhf3.js} +1 -1
- package/dist/{cli-hbvgzjq4.js → cli-avqkr20b.js} +2 -2
- package/dist/{cli-yfpc6qy9.js → cli-avxh26pd.js} +46 -15
- package/dist/{cli-q2dywc8h.js → cli-b2jh3dyb.js} +4 -4
- package/dist/{cli-m5qtmrbc.js → cli-c8v2yvej.js} +2 -2
- package/dist/{cli-gfy6hbd9.js → cli-ct8sz3np.js} +17 -10
- package/dist/{cli-bz97ff9n.js → cli-dka73bak.js} +1 -1
- package/dist/{cli-dkvtfgn4.js → cli-dkejt425.js} +75 -16
- package/dist/{cli-sv2r3bw8.js → cli-dnh64e8e.js} +2 -2
- package/dist/{cli-kwr5qv5g.js → cli-eb279wn3.js} +2 -2
- package/dist/{cli-hhc47ack.js → cli-f1952kjy.js} +2 -2
- package/dist/{cli-5z0g0e8v.js → cli-f8rcvf2x.js} +49 -13
- package/dist/{cli-eq4kew31.js → cli-fhvk2nvp.js} +24 -11
- package/dist/{cli-xf4z5bdn.js → cli-fz9pcjsw.js} +2 -2
- package/dist/{cli-fxd1mwtr.js → cli-g6j6ac3h.js} +1 -1
- package/dist/{cli-ya3kf4gs.js → cli-gfcv679k.js} +1 -1
- package/dist/{cli-55tc8cj4.js → cli-hbq0kwxz.js} +4 -4
- package/dist/{cli-39qm0rtm.js → cli-hc6e4tac.js} +28 -149
- package/dist/{cli-j5gtytvg.js → cli-hgsxnjyg.js} +13 -10
- package/dist/{cli-h70a2mxy.js → cli-hpb9x72z.js} +48 -8
- package/dist/{cli-7yn42w6m.js → cli-j53hpbsm.js} +1 -1
- package/dist/{cli-12vek61e.js → cli-jj3c5nyb.js} +471 -119
- package/dist/{cli-fy4gb74g.js → cli-kde4ky90.js} +1 -1
- package/dist/{cli-9qe5y107.js → cli-kspxjftk.js} +1 -1
- package/dist/{cli-bp6k9acz.js → cli-mh7pdxe0.js} +16 -16
- package/dist/{cli-v9ya390t.js → cli-mz34pxbk.js} +8 -8
- package/dist/{cli-ma9ys8rt.js → cli-nc6a8b5b.js} +7 -4
- package/dist/{cli-1htmtqc2.js → cli-prf7kz78.js} +49 -49
- package/dist/{cli-01tvvtad.js → cli-qec9bynj.js} +3 -3
- package/dist/{cli-t75xngj1.js → cli-qhhb30e8.js} +7 -7
- package/dist/{cli-73q4g5nx.js → cli-qm3ntjqs.js} +12 -12
- package/dist/{cli-tm60vtax.js → cli-rfejbpe1.js} +1 -1
- package/dist/{cli-agjbj5x0.js → cli-sdh61g52.js} +37 -19
- package/dist/{cli-9y4tgrkf.js → cli-skd2c4ej.js} +2 -1
- package/dist/{cli-5x03v6en.js → cli-sq913bh1.js} +8 -8
- package/dist/{cli-b93d81yg.js → cli-t35hx078.js} +1 -1
- package/dist/{cli-r0mz92by.js → cli-tn91wc6e.js} +1 -1
- package/dist/{cli-wvjqaqcp.js → cli-tstj6e8e.js} +1113 -227
- package/dist/{cli-xm34qj8m.js → cli-w14j2z4k.js} +2 -2
- package/dist/{cli-eqq0hwvx.js → cli-wndegmns.js} +1 -1
- package/dist/{cli-0k1a0sde.js → cli-wrhbym01.js} +6 -6
- package/dist/{cli-fyaq4zdv.js → cli-wv20kbr3.js} +6 -6
- package/dist/{cli-mq2fbgva.js → cli-wxwv3t11.js} +2 -2
- package/dist/{cli-krbcr00p.js → cli-xfjn2kyq.js} +58 -4
- package/dist/{cli-5r95eqbh.js → cli-y260hgep.js} +1 -1
- package/dist/{cli-cjqyse9q.js → cli-y4a4458j.js} +3 -3
- package/dist/{cli-2amwhyv2.js → cli-y518qkjg.js} +5 -3
- package/dist/{cli-0vcqcwfn.js → cli-yfvhvw8m.js} +2 -0
- package/dist/cli-yn4kt85g.js +148 -0
- package/dist/{cli-n8f0fs3c.js → cli-ytc7fpza.js} +8 -8
- package/dist/{cli-e8n0hdzd.js → cli-z64t9pe6.js} +1 -1
- package/dist/{cli-72yms3ey.js → cli-zqmmy073.js} +198 -18
- package/dist/cli.js +18 -16
- package/dist/{codex-adapter-wc6e4wct.js → codex-adapter-f3yp0kaj.js} +5 -5
- package/dist/{codex-hook-aqtj17yr.js → codex-hook-262cekfp.js} +73 -2
- package/dist/{codex-session-runner-ppfgjd97.js → codex-session-runner-ns4mv70p.js} +5 -5
- package/dist/{commands-tsv2vx5b.js → commands-5bzf2tfw.js} +3 -3
- package/dist/{controller-ye4sdwsy.js → controller-5xt7kvfm.js} +2 -2
- package/dist/{controllers-connect-zn4dg69h.js → controllers-connect-0gg13mzp.js} +24 -23
- package/dist/core-0fqtbrxa.js +42 -0
- package/dist/{cursor-adapter-q2g9vwts.js → cursor-adapter-p0c5zv6r.js} +1 -1
- package/dist/{db-g111qn9j.js → db-2s68ycq7.js} +3 -3
- package/dist/{db-3r1fyr2n.js → db-q7q639k5.js} +4 -2
- package/dist/{dispatcher-4q8s0mx8.js → dispatcher-j2y1q7ae.js} +24 -21
- package/dist/{dsh-adapter-mmcw1z5s.js → dsh-adapter-pgnkf4st.js} +1 -1
- package/dist/{easter-egg-3d-04ke6hcp.js → easter-egg-3d-0kea97jf.js} +1 -1
- package/dist/{embedding-space-kcdn52vz.js → embedding-space-3n6mhhmy.js} +6 -6
- package/dist/{embeddings-jnzcd91a.js → embeddings-jfmj6yme.js} +1 -1
- package/dist/{execute-74amghty.js → execute-tjrej979.js} +1 -1
- package/dist/{external-channel-v9zgxnxz.js → external-channel-jy8w2gg3.js} +2 -2
- package/dist/fx-adapter-k6w3jvz9.js +20 -0
- package/dist/grok-adapter-4q5tssw0.js +20 -0
- package/dist/handlers-qxgfvvsf.js +41 -0
- package/dist/{heartbeat-p8pk1msj.js → heartbeat-6tr2w2da.js} +25 -24
- package/dist/{hook-p5reemds.js → hook-bpnncsec.js} +76 -17
- package/dist/{hook-k1h73zd7.js → hook-fv1jwrv7.js} +6 -5
- package/dist/{http-ms1z5xxy.js → http-bpa26czn.js} +785 -181
- package/dist/index-0mcxjdsa.js +44 -0
- package/dist/{index-kn63q1gr.js → index-52tgbhrw.js} +29 -28
- package/dist/index-dz4q23ag.js +40 -0
- package/dist/{index-76zzxtzf.js → index-mpj0z9e0.js} +1 -1
- package/dist/index-s175jckx.js +39 -0
- package/dist/{index-gjn6qfgn.js → index-s8re7mvq.js} +1 -1
- package/dist/{index-fbkqhvvj.js → index-w216g9y9.js} +198 -160
- package/dist/{keepalive-031js8jz.js → keepalive-d6z12s04.js} +3 -3
- package/dist/lead-p3hx7h35.js +79 -0
- package/dist/{maintenance-sq9v3qx9.js → maintenance-7kac6g2g.js} +1 -1
- package/dist/{oauth-refresh-sweep-zqmnyvs8.js → oauth-refresh-sweep-t1xjetbh.js} +2 -2
- package/dist/{object-webhooks-r24wwb5y.js → object-webhooks-6rdagg0r.js} +7 -7
- package/dist/{onboard-p25yhh7t.js → onboard-32y1cfxy.js} +3 -3
- package/dist/{opencode-adapter-wcjc4zdk.js → opencode-adapter-enp3v31n.js} +7 -6
- package/dist/{otel-impl-ff1gf20m.js → otel-impl-k0tm5ptj.js} +1 -1
- package/dist/{pending-hxj5yatb.js → pending-24zebgvs.js} +23 -22
- package/dist/{pi-mono-adapter-vkp4zz7p.js → pi-mono-adapter-yj72xxxe.js} +85 -16
- package/dist/{pricing-refresh-9w7gx41w.js → pricing-refresh-cf25x38j.js} +2 -2
- package/dist/{rbac-roles-84aw10nz.js → rbac-roles-0wydd22m.js} +3 -3
- package/dist/{rbac-roles-hz74vckp.js → rbac-roles-at6crb3r.js} +7 -4
- package/dist/{registry-eeyx1201.js → registry-zv0zvxsx.js} +1 -1
- package/dist/{render-v2-nrdkg9gf.js → render-v2-nvcw0jd7.js} +8 -4
- package/dist/{resume-s6ey36rh.js → resume-y4w0k5v3.js} +9 -8
- package/dist/{runtime-x0b4pyam.js → runtime-vpe43hx0.js} +1 -1
- package/dist/{session-access-xv49tk14.js → session-access-gkyvnfye.js} +5 -4
- package/dist/{session-source-backfill-r5j988ah.js → session-source-backfill-3w2st4m2.js} +2 -2
- package/dist/{setup-mj0krk1p.js → setup-axxvqtys.js} +1 -1
- package/dist/thread-buffer-rwa7d4dx.js +42 -0
- package/dist/{tree-visibility-cbrsfaar.js → tree-visibility-y4fqvab5.js} +2 -2
- package/dist/{user-merge-jobs-f9d8nwnw.js → user-merge-jobs-kcmwvrc6.js} +3 -3
- package/dist/{virtual-modules-ns0ryw05.js → virtual-modules-7d92dct1.js} +3 -3
- package/dist/{work-objects-pydhzast.js → work-objects-f708e069.js} +27 -25
- package/dist/worker-8rg9gz74.js +79 -0
- package/dist/{worker-follow-up-9z2xec5e.js → worker-follow-up-0by8wztc.js} +22 -21
- package/dist/xlsx-9acfmxr1.js +31534 -0
- package/openapi.json +1385 -204
- package/package.json +5 -3
- package/src/agentmail/handlers.ts +26 -19
- package/src/apps/catalog.generated.json +31 -0
- package/src/apps/row-store.ts +37 -14
- package/src/azure-devops/handlers.ts +2 -0
- package/src/be/audit-user.ts +46 -6
- package/src/be/db/kv-windows.ts +22 -0
- package/src/be/db/session-moves.ts +3 -3
- package/src/be/db/session-tree.ts +52 -5
- package/src/be/db/skill-audit.ts +17 -0
- package/src/be/db/tasks/write.ts +18 -3
- package/src/be/db.ts +114 -23
- package/src/be/extensions/assets.ts +11 -7
- package/src/be/memory/demotion-evidence.ts +2 -2
- package/src/be/memory/providers/sqlite-store.ts +151 -18
- package/src/be/memory/search-read-worker.ts +60 -0
- package/src/be/memory/search-reader.ts +223 -0
- package/src/be/migrations/337_favorites_session_hidden_key.sql +39 -0
- package/src/be/migrations/338_audit_agent_columns.sql +30 -0
- package/src/be/migrations/339_deferred_event_waits.sql +26 -0
- package/src/be/model-tier-resolution.ts +18 -1
- package/src/be/multi-runtime.ts +17 -0
- package/src/be/primitives/object-embed.ts +250 -0
- package/src/be/primitives/objects.ts +29 -9
- package/src/be/primitives/sheets/service.ts +138 -6
- package/src/be/primitives/sheets/xlsx.ts +367 -0
- package/src/be/rbac-roles.ts +3 -0
- package/src/be/repo-checked-update.ts +4 -4
- package/src/be/repo-merge-policy.ts +26 -9
- package/src/be/scripts/boot-reembed.ts +6 -0
- package/src/be/scripts/db.ts +17 -5
- package/src/be/scripts/embeddings.ts +6 -0
- package/src/be/scripts/typecheck.ts +43 -2
- package/src/be/seed/schedules-seeder.ts +9 -1
- package/src/be/seed/workflows-seeder.ts +9 -1
- package/src/be/seed-scripts/index.ts +2 -0
- package/src/be/seed-skills/index.ts +12 -0
- package/src/be/swarm-config-guard.ts +1 -0
- package/src/be/unmapped-identities.ts +95 -1
- package/src/bitbucket/handlers.ts +2 -0
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/event-waits/github.ts +43 -0
- package/src/event-waits/index.ts +29 -0
- package/src/event-waits/types.ts +51 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/dispatcher.ts +9 -0
- package/src/fs/agent-fs-provider.ts +4 -1
- package/src/github/handlers.ts +3 -1
- package/src/github/pull-request-state.ts +34 -0
- package/src/gitlab/handlers.ts +12 -7
- package/src/hooks/codex-hook.ts +99 -1
- package/src/hooks/hook.ts +85 -11
- package/src/hooks/native-tool-hooks.ts +245 -0
- package/src/http/all-routes.ts +1 -0
- package/src/http/assets.ts +4 -3
- package/src/http/comb.ts +2 -2
- package/src/http/favorite-owner.ts +2 -2
- package/src/http/favorites.ts +3 -2
- package/src/http/fs.ts +13 -4
- package/src/http/index.ts +2 -0
- package/src/http/mcp-bridge.ts +4 -0
- package/src/http/objects.ts +265 -0
- package/src/http/pages.ts +3 -3
- package/src/http/poll.ts +43 -12
- package/src/http/repos.ts +7 -6
- package/src/http/schedules.ts +10 -6
- package/src/http/script-connections.ts +2 -2
- package/src/http/scripts.ts +9 -0
- package/src/http/sessions.ts +30 -12
- package/src/http/skills.ts +17 -0
- package/src/http/task-requester.ts +2 -2
- package/src/http/tasks.ts +13 -3
- package/src/http/tool-hooks.ts +24 -2
- package/src/http/trackers/authorize-gate.ts +2 -2
- package/src/http/users.ts +136 -1
- package/src/http/workflow-events.ts +13 -0
- package/src/http/workflows.ts +21 -11
- package/src/linear/sync.ts +3 -1
- package/src/prompts/base-prompt.ts +35 -13
- package/src/prompts/session-templates.ts +25 -0
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +1 -0
- package/src/providers/opencode-swarm-plugin.ts +50 -1
- package/src/providers/pi-mono-adapter.ts +139 -9
- package/src/providers/pi-mono-extension.ts +69 -0
- package/src/providers/runtime-dependencies.ts +1 -1
- package/src/rbac/legacy-policy.ts +3 -0
- package/src/rbac/permissions.ts +11 -1
- package/src/scheduler/deferred-task-waits.ts +170 -13
- package/src/scripts-runtime/executors/types.ts +5 -0
- package/src/scripts-runtime/loader.ts +8 -0
- package/src/scripts-runtime/mcp-client.ts +4 -0
- package/src/scripts-runtime/sdk-allowlist.ts +14 -1
- package/src/scripts-runtime/swarm-config.ts +8 -0
- package/src/scripts-runtime/swarm-sdk.ts +4 -0
- package/src/scripts-runtime/types/stdlib.d.ts +47 -4
- package/src/scripts-runtime/types/swarm-extension.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +47 -4
- package/src/server.ts +4 -0
- package/src/slack/enrich.ts +81 -21
- package/src/slack/handlers.test.ts +55 -2
- package/src/slack/handlers.ts +38 -3
- package/src/slack/render-v2.ts +19 -0
- package/src/slack/session-mirror.ts +208 -0
- package/src/slack/thread-participants.ts +0 -5
- package/src/slack/watcher.ts +3 -0
- package/src/slack/work-objects.test.ts +2 -1
- package/src/slack/work-objects.ts +7 -2
- package/src/tests/agentmail-filters.test.ts +4 -3
- package/src/tests/audit-agent-person.test.ts +825 -0
- package/src/tests/audit-updated-by.test.ts +19 -12
- package/src/tests/claude-hook-output.test.ts +107 -2
- package/src/tests/claude-managed-setup.test.ts +1 -1
- package/src/tests/codex-adapter.test.ts +6 -6
- package/src/tests/codex-gpt6-release.test.ts +4 -4
- package/src/tests/db-task-read-contract.test.ts +1 -0
- package/src/tests/db-task-write-contract.test.ts +1 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/extensions-catalog.test.ts +33 -25
- package/src/tests/fixtures/sheets/eocd-count-mismatch.xlsx +0 -0
- package/src/tests/fixtures/sheets/rich-budget.xlsx +0 -0
- package/src/tests/fixtures/sheets/tracker-export.xlsx +0 -0
- package/src/tests/kv-storage.test.ts +3 -0
- package/src/tests/memory-search-reader.test.ts +258 -0
- package/src/tests/memory-search-stall.test.ts +197 -20
- package/src/tests/model-control.test.ts +4 -4
- package/src/tests/model-tier-resolution.test.ts +2 -2
- package/src/tests/multi-runtime-registration.test.ts +8 -2
- package/src/tests/native-tool-hooks.test.ts +188 -0
- package/src/tests/opencode-swarm-plugin.test.ts +6 -1
- package/src/tests/pi-provider-runtime-keys.test.ts +163 -0
- package/src/tests/poll-probe-readonly.test.ts +108 -0
- package/src/tests/primitives-sheets-xlsx.test.ts +549 -0
- package/src/tests/prompt-template-session.test.ts +3 -2
- package/src/tests/rbac-roles.test.ts +3 -0
- package/src/tests/script-connections.test.ts +4 -0
- package/src/tests/seed-model-profiles.test.ts +1 -1
- package/src/tests/sessions-tree.test.ts +10 -2
- package/src/tests/slack-thread-participants.test.ts +66 -4
- package/src/tests/tool-registrar-no-input.test.ts +1 -0
- package/src/tools/defer-task.ts +154 -12
- package/src/tools/objects.ts +10 -5
- package/src/tools/repos/update-repo.ts +6 -6
- package/src/tools/schedules/create-schedule.ts +1 -0
- package/src/tools/schedules/list-schedules.ts +3 -0
- package/src/tools/schedules/patch-schedule.ts +12 -3
- package/src/tools/schedules/update-schedule.ts +12 -3
- package/src/tools/sheets.ts +66 -0
- package/src/tools/skills/skill-create.ts +6 -0
- package/src/tools/skills/skill-install-remote.ts +6 -0
- package/src/tools/skills/skill-sync-remote.ts +9 -0
- package/src/tools/skills/skill-update.ts +9 -1
- package/src/tools/tool-config.ts +3 -1
- package/src/tools/utils.ts +15 -0
- package/src/tools/workflows/create-workflow.ts +9 -4
- package/src/tools/workflows/patch-workflow-node.ts +1 -1
- package/src/tools/workflows/patch-workflow.ts +5 -2
- package/src/tools/workflows/update-workflow.ts +13 -7
- package/src/types.ts +96 -12
- package/src/workflows/input.ts +12 -5
- package/src/workflows/patch-definition.ts +13 -5
- package/src/workflows/triggers.ts +11 -6
- package/src/workflows/version.ts +7 -1
- package/templates/skills/boards-and-sheets/config.json +14 -0
- package/templates/skills/boards-and-sheets/content.md +163 -0
- package/templates/skills/swarm-docs/content.md +9 -0
- package/dist/acp-adapter-11m13kx4.js +0 -16
- package/dist/core-dxcy02sc.js +0 -41
- package/dist/fx-adapter-0ar6pqm3.js +0 -19
- package/dist/grok-adapter-t6m74fb1.js +0 -19
- package/dist/handlers-9kwcrc4k.js +0 -38
- package/dist/index-23cdfzr6.js +0 -39
- package/dist/index-g7kkjs5b.js +0 -38
- package/dist/index-stk36pa5.js +0 -43
- package/dist/lead-mfggjtfk.js +0 -77
- package/dist/thread-buffer-temgaqsy.js +0 -41
- package/dist/worker-efcemc22.js +0 -77
- /package/dist/{cli-cah298e5.js → cli-m4ejz4nj.js} +0 -0
|
@@ -237,6 +237,7 @@ import {
|
|
|
237
237
|
init_harness_model_support,
|
|
238
238
|
sanitizeModelTierOverrides,
|
|
239
239
|
parseModelTierOverridesHeader,
|
|
240
|
+
modelTierOverridesDiffer,
|
|
240
241
|
setAgentModelTierOverrides,
|
|
241
242
|
previewModelTiers,
|
|
242
243
|
recordClaimModelResolution,
|
|
@@ -350,6 +351,7 @@ import {
|
|
|
350
351
|
getScriptRunExecutionArgs2,
|
|
351
352
|
getScriptRunFollowUpGuard2,
|
|
352
353
|
setScriptRunFollowUpGuard2,
|
|
354
|
+
setSkillUpdatedBy2,
|
|
353
355
|
updateTaskVcs2,
|
|
354
356
|
upsertAssetKeyMapping2,
|
|
355
357
|
listAssetSummaries2,
|
|
@@ -554,7 +556,7 @@ import {
|
|
|
554
556
|
countScriptRunJournalSteps2,
|
|
555
557
|
countScriptRunJournalAgentTaskSteps2,
|
|
556
558
|
init_db4
|
|
557
|
-
} from "./cli-
|
|
559
|
+
} from "./cli-jj3c5nyb.js";
|
|
558
560
|
import {
|
|
559
561
|
PRIMARY_ROLE_NAMES2,
|
|
560
562
|
OperatorGrantedTargetError2,
|
|
@@ -568,7 +570,7 @@ import {
|
|
|
568
570
|
assertNotLastAdmin2,
|
|
569
571
|
setUserRoles2,
|
|
570
572
|
init_rbac_roles
|
|
571
|
-
} from "./cli-
|
|
573
|
+
} from "./cli-nc6a8b5b.js";
|
|
572
574
|
import {
|
|
573
575
|
MAX_MODEL_GROUP_MEMBERS,
|
|
574
576
|
listModelGroups,
|
|
@@ -578,17 +580,17 @@ import {
|
|
|
578
580
|
modelGroupReferences,
|
|
579
581
|
deleteModelGroup,
|
|
580
582
|
init_model_groups
|
|
581
|
-
} from "./cli-
|
|
583
|
+
} from "./cli-9m9kyw77.js";
|
|
582
584
|
import {
|
|
583
585
|
requestModelCatalogRefresh2,
|
|
584
586
|
init_pricing_refresh
|
|
585
|
-
} from "./cli-
|
|
587
|
+
} from "./cli-t35hx078.js";
|
|
586
588
|
import {
|
|
587
589
|
workflowEventBus2,
|
|
588
590
|
init_event_bus
|
|
589
591
|
} from "./cli-z4f346g5.js";
|
|
590
|
-
import"./cli-
|
|
591
|
-
import"./cli-
|
|
592
|
+
import"./cli-g6j6ac3h.js";
|
|
593
|
+
import"./cli-9fsagra4.js";
|
|
592
594
|
import"./cli-9w8712tq.js";
|
|
593
595
|
import"./cli-47hz21se.js";
|
|
594
596
|
import {
|
|
@@ -621,12 +623,14 @@ import {
|
|
|
621
623
|
callSlackWithRetry2,
|
|
622
624
|
slackErrorCode2,
|
|
623
625
|
init_render_v2,
|
|
626
|
+
mirrorSessionPrompt,
|
|
627
|
+
init_session_mirror,
|
|
624
628
|
getSlackApp2,
|
|
625
629
|
getSlackHttpReceiver2,
|
|
626
630
|
startSlackApp2,
|
|
627
631
|
stopSlackApp2,
|
|
628
632
|
init_app4
|
|
629
|
-
} from "./cli-
|
|
633
|
+
} from "./cli-zqmmy073.js";
|
|
630
634
|
import {
|
|
631
635
|
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
632
636
|
reconcileAgentMaxTasksPolicy,
|
|
@@ -636,6 +640,7 @@ import {
|
|
|
636
640
|
upsertRuntimeInstance,
|
|
637
641
|
getRuntimeInstanceById,
|
|
638
642
|
touchRuntimeInstance,
|
|
643
|
+
isRuntimeInstanceFresh,
|
|
639
644
|
listRuntimeInstancesForAgent,
|
|
640
645
|
setRuntimeCredentialReady,
|
|
641
646
|
reconcileAgentStatusFromRuntimes,
|
|
@@ -654,12 +659,12 @@ import {
|
|
|
654
659
|
dispatchApprovalNotifications2,
|
|
655
660
|
createApprovalFollowUpTask2,
|
|
656
661
|
init_approval_notifications
|
|
657
|
-
} from "./cli-
|
|
662
|
+
} from "./cli-ct8sz3np.js";
|
|
658
663
|
import {
|
|
659
664
|
retryFailedRun2,
|
|
660
665
|
cancelWorkflowRun2,
|
|
661
666
|
init_resume
|
|
662
|
-
} from "./cli-
|
|
667
|
+
} from "./cli-0b655smz.js";
|
|
663
668
|
import {
|
|
664
669
|
safeParse,
|
|
665
670
|
getObjectShape,
|
|
@@ -725,6 +730,13 @@ import {
|
|
|
725
730
|
getExecutorRegistry2,
|
|
726
731
|
initWorkflows2,
|
|
727
732
|
init_workflows,
|
|
733
|
+
isGitHubEnabled,
|
|
734
|
+
initGitHub,
|
|
735
|
+
verifyWebhookSignature,
|
|
736
|
+
getWorkerInstallationToken,
|
|
737
|
+
init_app,
|
|
738
|
+
isReservedProviderEvent,
|
|
739
|
+
init_event_waits,
|
|
728
740
|
stripSiblingBlock,
|
|
729
741
|
init_sibling_block,
|
|
730
742
|
createTaskWithSiblingAwareness,
|
|
@@ -781,12 +793,16 @@ import {
|
|
|
781
793
|
loadEnabledExtensions,
|
|
782
794
|
stopExtensionRuntime,
|
|
783
795
|
init_lifecycle,
|
|
796
|
+
hasNativeToolHandlers2,
|
|
784
797
|
dispatchPre2,
|
|
785
798
|
dispatchPost2,
|
|
786
799
|
init_dispatcher,
|
|
787
800
|
resolveIdentity,
|
|
788
801
|
renderIdentity,
|
|
789
802
|
init_identity,
|
|
803
|
+
dismissedNamespace,
|
|
804
|
+
dismissUnmappedIdentity,
|
|
805
|
+
restoreUnmappedIdentity,
|
|
790
806
|
recordUnmappedIdentity,
|
|
791
807
|
init_unmapped_identities,
|
|
792
808
|
MAX_TASK_ATTACHMENT_BYTES,
|
|
@@ -845,11 +861,6 @@ import {
|
|
|
845
861
|
handlePullRequestCommentCreated,
|
|
846
862
|
handlePullRequestClosed,
|
|
847
863
|
init_bitbucket,
|
|
848
|
-
isGitHubEnabled,
|
|
849
|
-
initGitHub,
|
|
850
|
-
verifyWebhookSignature,
|
|
851
|
-
getWorkerInstallationToken,
|
|
852
|
-
init_app,
|
|
853
864
|
handlePullRequest,
|
|
854
865
|
handleIssue,
|
|
855
866
|
handleComment,
|
|
@@ -950,6 +961,10 @@ import {
|
|
|
950
961
|
init_task_requester,
|
|
951
962
|
handleApps,
|
|
952
963
|
init_apps,
|
|
964
|
+
parseScene,
|
|
965
|
+
init_elements,
|
|
966
|
+
MAX_OBJECT_BYTES,
|
|
967
|
+
init_write_object,
|
|
953
968
|
cancelApprovalRequest,
|
|
954
969
|
init_approval_cancel,
|
|
955
970
|
getUserCommsPrefs,
|
|
@@ -1045,7 +1060,7 @@ import {
|
|
|
1045
1060
|
getKapsoNumberMapping,
|
|
1046
1061
|
markKapsoMessageSeen,
|
|
1047
1062
|
init_config2,
|
|
1048
|
-
|
|
1063
|
+
changesMergePolicy,
|
|
1049
1064
|
init_repo_merge_policy,
|
|
1050
1065
|
updateSwarmRepoChecked,
|
|
1051
1066
|
init_repo_checked_update,
|
|
@@ -1096,6 +1111,10 @@ import {
|
|
|
1096
1111
|
sendTaskOutputSchema,
|
|
1097
1112
|
sendTaskHandler,
|
|
1098
1113
|
init_send_task,
|
|
1114
|
+
setSheetRange,
|
|
1115
|
+
appendSheetRows,
|
|
1116
|
+
clearSheetRange,
|
|
1117
|
+
init_service,
|
|
1099
1118
|
steerTaskUserInputSchema,
|
|
1100
1119
|
steerTaskOutputSchema,
|
|
1101
1120
|
steerTaskHandler,
|
|
@@ -1136,11 +1155,11 @@ import {
|
|
|
1136
1155
|
getEnabledCapabilities,
|
|
1137
1156
|
createServer,
|
|
1138
1157
|
init_server
|
|
1139
|
-
} from "./cli-
|
|
1158
|
+
} from "./cli-tstj6e8e.js";
|
|
1140
1159
|
import {
|
|
1141
1160
|
getFileStorageProvider2,
|
|
1142
1161
|
init_registry2
|
|
1143
|
-
} from "./cli-
|
|
1162
|
+
} from "./cli-y260hgep.js";
|
|
1144
1163
|
import {
|
|
1145
1164
|
RuntimePoolError2,
|
|
1146
1165
|
mintControllerToken,
|
|
@@ -1162,7 +1181,7 @@ import {
|
|
|
1162
1181
|
resolvePoolDelivery2,
|
|
1163
1182
|
createPoolAgent2,
|
|
1164
1183
|
init_db2
|
|
1165
|
-
} from "./cli-
|
|
1184
|
+
} from "./cli-1v82d2w6.js";
|
|
1166
1185
|
import {
|
|
1167
1186
|
duplicateGuardedQueryKey,
|
|
1168
1187
|
warnIfCorsAllowsAnyOrigin,
|
|
@@ -1187,16 +1206,10 @@ import {
|
|
|
1187
1206
|
deriveApiBaseUrl,
|
|
1188
1207
|
httpServerSemconvAttributes,
|
|
1189
1208
|
init_utils2,
|
|
1190
|
-
hasSessionAccess,
|
|
1191
|
-
getSessionRoot,
|
|
1192
|
-
getSessionRoots,
|
|
1193
|
-
sessionAccessForRoot,
|
|
1194
|
-
listActiveSessionShares,
|
|
1195
|
-
toSessionSharesState,
|
|
1196
|
-
setSessionShares,
|
|
1197
|
-
init_session_shares,
|
|
1198
1209
|
resolveTaskAuditUserId,
|
|
1210
|
+
resolveHttpRequesterUserId,
|
|
1199
1211
|
resolveHttpAuditUserId,
|
|
1212
|
+
resolveHttpAuditActor,
|
|
1200
1213
|
init_audit_user,
|
|
1201
1214
|
dashboardUserIdHeader,
|
|
1202
1215
|
resolveHttpFavoriteOwner,
|
|
@@ -1219,7 +1232,7 @@ import {
|
|
|
1219
1232
|
describeRequestRoute,
|
|
1220
1233
|
route,
|
|
1221
1234
|
init_route_def
|
|
1222
|
-
} from "./cli-
|
|
1235
|
+
} from "./cli-hc6e4tac.js";
|
|
1223
1236
|
import {
|
|
1224
1237
|
startPoolRouting,
|
|
1225
1238
|
stopPoolRouting,
|
|
@@ -1232,17 +1245,17 @@ import {
|
|
|
1232
1245
|
checkHeartbeatChecklist2,
|
|
1233
1246
|
runHeartbeatSweep2,
|
|
1234
1247
|
stopHeartbeat2
|
|
1235
|
-
} from "./cli-
|
|
1236
|
-
import"./cli-
|
|
1248
|
+
} from "./cli-mh7pdxe0.js";
|
|
1249
|
+
import"./cli-tn91wc6e.js";
|
|
1237
1250
|
import {
|
|
1238
1251
|
runtimeSupervisorStatus,
|
|
1239
1252
|
startRuntimeSupervisor,
|
|
1240
1253
|
stopRuntimeSupervisor
|
|
1241
|
-
} from "./cli-
|
|
1254
|
+
} from "./cli-mz34pxbk.js";
|
|
1242
1255
|
import {
|
|
1243
1256
|
TASK_TITLE_TIMEOUT_MS,
|
|
1244
1257
|
generateTaskTitle
|
|
1245
|
-
} from "./cli-
|
|
1258
|
+
} from "./cli-wndegmns.js";
|
|
1246
1259
|
import"./cli-ns59dc6r.js";
|
|
1247
1260
|
import {
|
|
1248
1261
|
ACP_TARGET_IDS
|
|
@@ -1263,7 +1276,7 @@ import {
|
|
|
1263
1276
|
isUnknownModelError,
|
|
1264
1277
|
checkProviderPoolKey,
|
|
1265
1278
|
writeSkillsToFilesystem
|
|
1266
|
-
} from "./cli-
|
|
1279
|
+
} from "./cli-fz9pcjsw.js";
|
|
1267
1280
|
import {
|
|
1268
1281
|
AgentFsRequestError2,
|
|
1269
1282
|
resolveAgentFsSharedContext2,
|
|
@@ -1274,16 +1287,16 @@ import {
|
|
|
1274
1287
|
agentFsRequest2,
|
|
1275
1288
|
resolveApiUrl2,
|
|
1276
1289
|
init_agent_fs_provision
|
|
1277
|
-
} from "./cli-
|
|
1290
|
+
} from "./cli-qec9bynj.js";
|
|
1278
1291
|
import {
|
|
1279
1292
|
Anthropic
|
|
1280
|
-
} from "./cli-
|
|
1293
|
+
} from "./cli-m4ejz4nj.js";
|
|
1281
1294
|
import {
|
|
1282
1295
|
objectWebhookSecret2,
|
|
1283
1296
|
handleObjectWebhookEvent2,
|
|
1284
1297
|
init_object_webhooks
|
|
1285
|
-
} from "./cli-
|
|
1286
|
-
import"./cli-
|
|
1298
|
+
} from "./cli-hbq0kwxz.js";
|
|
1299
|
+
import"./cli-6h88mn9q.js";
|
|
1287
1300
|
import {
|
|
1288
1301
|
createUserMergeJob2,
|
|
1289
1302
|
getUserMergeJob2,
|
|
@@ -1292,7 +1305,7 @@ import {
|
|
|
1292
1305
|
findFailedUserMergeJob2,
|
|
1293
1306
|
requeueUserMergeJob2,
|
|
1294
1307
|
runUserMergeJobs2
|
|
1295
|
-
} from "./cli-
|
|
1308
|
+
} from "./cli-49f5jyhh.js";
|
|
1296
1309
|
import {
|
|
1297
1310
|
isCodexOAuthConfigKey
|
|
1298
1311
|
} from "./cli-j4bwnpkm.js";
|
|
@@ -1303,7 +1316,7 @@ import {
|
|
|
1303
1316
|
import {
|
|
1304
1317
|
runTaskUiAction,
|
|
1305
1318
|
init_actions
|
|
1306
|
-
} from "./cli-
|
|
1319
|
+
} from "./cli-y4a4458j.js";
|
|
1307
1320
|
import {
|
|
1308
1321
|
RATING_MODEL_MAX_LENGTH,
|
|
1309
1322
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
@@ -1398,7 +1411,7 @@ import {
|
|
|
1398
1411
|
init_typecheck,
|
|
1399
1412
|
parseSkillContent,
|
|
1400
1413
|
init_skill_parser
|
|
1401
|
-
} from "./cli-
|
|
1414
|
+
} from "./cli-0dg7ytxm.js";
|
|
1402
1415
|
import {
|
|
1403
1416
|
signalProcessGroup,
|
|
1404
1417
|
detachedProcessGroup,
|
|
@@ -1415,9 +1428,17 @@ import {
|
|
|
1415
1428
|
forceRefreshAuthorizationOrThrow,
|
|
1416
1429
|
forceRefreshTokenOrThrow,
|
|
1417
1430
|
init_ensure_token
|
|
1418
|
-
} from "./cli-
|
|
1419
|
-
import
|
|
1420
|
-
|
|
1431
|
+
} from "./cli-kspxjftk.js";
|
|
1432
|
+
import {
|
|
1433
|
+
PRIMITIVE_KINDS,
|
|
1434
|
+
ObjectsError,
|
|
1435
|
+
recordObjectVersion,
|
|
1436
|
+
init_objects
|
|
1437
|
+
} from "./cli-7dbhnsj9.js";
|
|
1438
|
+
import {
|
|
1439
|
+
agentFsClientFor,
|
|
1440
|
+
init_agent_fs_identity
|
|
1441
|
+
} from "./cli-avqkr20b.js";
|
|
1421
1442
|
import {
|
|
1422
1443
|
FilesError,
|
|
1423
1444
|
normalizeFilesError,
|
|
@@ -1425,8 +1446,8 @@ import {
|
|
|
1425
1446
|
agentFsRequestTimeoutMs,
|
|
1426
1447
|
AgentFsProvider,
|
|
1427
1448
|
init_agent_fs_provider
|
|
1428
|
-
} from "./cli-
|
|
1429
|
-
import"./cli-
|
|
1449
|
+
} from "./cli-skd2c4ej.js";
|
|
1450
|
+
import"./cli-1dbv9mj9.js";
|
|
1430
1451
|
import {
|
|
1431
1452
|
automationIntegrationFixUrl,
|
|
1432
1453
|
preflightAutomation,
|
|
@@ -1448,7 +1469,7 @@ import {
|
|
|
1448
1469
|
definitionNodeIds,
|
|
1449
1470
|
validateDefinition,
|
|
1450
1471
|
init_definition2
|
|
1451
|
-
} from "./cli-
|
|
1472
|
+
} from "./cli-hgsxnjyg.js";
|
|
1452
1473
|
import {
|
|
1453
1474
|
_fetchHolder,
|
|
1454
1475
|
CLIENT_ID,
|
|
@@ -1481,6 +1502,16 @@ import {
|
|
|
1481
1502
|
require_content_type
|
|
1482
1503
|
} from "./cli-1jx0srjt.js";
|
|
1483
1504
|
import"./cli-n3qe7tyr.js";
|
|
1505
|
+
import {
|
|
1506
|
+
hasSessionAccess,
|
|
1507
|
+
getSessionRoot,
|
|
1508
|
+
getSessionRoots,
|
|
1509
|
+
sessionAccessForRoot,
|
|
1510
|
+
listActiveSessionShares,
|
|
1511
|
+
toSessionSharesState,
|
|
1512
|
+
setSessionShares,
|
|
1513
|
+
init_session_shares
|
|
1514
|
+
} from "./cli-yn4kt85g.js";
|
|
1484
1515
|
import {
|
|
1485
1516
|
isInvalidClientError,
|
|
1486
1517
|
publicEndpointSsrfOptions,
|
|
@@ -1498,7 +1529,7 @@ import {
|
|
|
1498
1529
|
revokeMcpToken,
|
|
1499
1530
|
computeExpiresAt,
|
|
1500
1531
|
init_mcp_wrapper
|
|
1501
|
-
} from "./cli-
|
|
1532
|
+
} from "./cli-dka73bak.js";
|
|
1502
1533
|
import"./cli-v41kn3cd.js";
|
|
1503
1534
|
import {
|
|
1504
1535
|
setBedrockProviderModule,
|
|
@@ -1538,7 +1569,11 @@ import {
|
|
|
1538
1569
|
revokeAllAgentSessionTokens,
|
|
1539
1570
|
fingerprintApiKey,
|
|
1540
1571
|
init_users
|
|
1541
|
-
} from "./cli-
|
|
1572
|
+
} from "./cli-ajjvqhf3.js";
|
|
1573
|
+
import {
|
|
1574
|
+
CORE_TOOLS,
|
|
1575
|
+
init_tool_config
|
|
1576
|
+
} from "./cli-yfvhvw8m.js";
|
|
1542
1577
|
import {
|
|
1543
1578
|
MAX_PROVIDER_QUOTA_ENTRIES,
|
|
1544
1579
|
ProviderQuotaCapacityError,
|
|
@@ -1548,10 +1583,63 @@ import {
|
|
|
1548
1583
|
rateLimitReplacementSchema,
|
|
1549
1584
|
init_provider_account_telemetry
|
|
1550
1585
|
} from "./cli-7wy8gbwb.js";
|
|
1586
|
+
import {
|
|
1587
|
+
CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
|
|
1588
|
+
CODEX_AUTH_WATCH_NAMESPACE,
|
|
1589
|
+
codexAuthBenchMarkerKey,
|
|
1590
|
+
init_codex_auth_failure
|
|
1591
|
+
} from "./cli-fw2w0kva.js";
|
|
1551
1592
|
import {
|
|
1552
1593
|
resolveGitHubHost,
|
|
1553
1594
|
init_github_host
|
|
1554
1595
|
} from "./cli-9ttx00s3.js";
|
|
1596
|
+
import {
|
|
1597
|
+
IDENTITY_FIELD_BUDGETS,
|
|
1598
|
+
IdentityFieldBudgetError,
|
|
1599
|
+
init_identity_field_budget
|
|
1600
|
+
} from "./cli-sdh61g52.js";
|
|
1601
|
+
import {
|
|
1602
|
+
getSlackConfiguration,
|
|
1603
|
+
init_config4
|
|
1604
|
+
} from "./cli-eetzmsy5.js";
|
|
1605
|
+
import {
|
|
1606
|
+
isSteeringEnabled2,
|
|
1607
|
+
init_steering_enabled
|
|
1608
|
+
} from "./cli-4sydckyj.js";
|
|
1609
|
+
import {
|
|
1610
|
+
SUBSCRIPTION_PLANS_CHECKED_AT,
|
|
1611
|
+
SUBSCRIPTION_PLANS,
|
|
1612
|
+
isSubscriptionPlanId,
|
|
1613
|
+
init_subscription_plans
|
|
1614
|
+
} from "./cli-nh7x3133.js";
|
|
1615
|
+
import {
|
|
1616
|
+
MODEL_SCOPED_WINDOWS,
|
|
1617
|
+
KEY_WIDE_WINDOWS,
|
|
1618
|
+
modelFamilyOf,
|
|
1619
|
+
isModelScopedWindow,
|
|
1620
|
+
activeModelBlocks,
|
|
1621
|
+
init_model_rate_limit_windows,
|
|
1622
|
+
CREDENTIAL_POOL_VARS,
|
|
1623
|
+
PROVIDER_CREDENTIAL_VARS,
|
|
1624
|
+
getModelAwareCredentialVars,
|
|
1625
|
+
splitCredentialPool,
|
|
1626
|
+
selectCredential,
|
|
1627
|
+
init_credentials2
|
|
1628
|
+
} from "./cli-js10kdk7.js";
|
|
1629
|
+
import {
|
|
1630
|
+
getOpenRouterAttributionHeaders,
|
|
1631
|
+
init_openrouter_base_url
|
|
1632
|
+
} from "./cli-dfyv0jdy.js";
|
|
1633
|
+
import {
|
|
1634
|
+
interpolate,
|
|
1635
|
+
init_template2,
|
|
1636
|
+
getTemplateDefinition,
|
|
1637
|
+
getAllTemplateDefinitions,
|
|
1638
|
+
init_registry3,
|
|
1639
|
+
resolveTemplate,
|
|
1640
|
+
init_resolver,
|
|
1641
|
+
init_session_templates
|
|
1642
|
+
} from "./cli-50w82h6m.js";
|
|
1555
1643
|
import {
|
|
1556
1644
|
ASSET_KEY_MAX_LENGTH,
|
|
1557
1645
|
AssetKeyError,
|
|
@@ -1725,64 +1813,7 @@ import {
|
|
|
1725
1813
|
KvKeySchema,
|
|
1726
1814
|
KvEntrySchema,
|
|
1727
1815
|
init_types5
|
|
1728
|
-
} from "./cli-
|
|
1729
|
-
import {
|
|
1730
|
-
CORE_TOOLS,
|
|
1731
|
-
init_tool_config
|
|
1732
|
-
} from "./cli-0vcqcwfn.js";
|
|
1733
|
-
import {
|
|
1734
|
-
CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
|
|
1735
|
-
CODEX_AUTH_WATCH_NAMESPACE,
|
|
1736
|
-
codexAuthBenchMarkerKey,
|
|
1737
|
-
init_codex_auth_failure
|
|
1738
|
-
} from "./cli-fw2w0kva.js";
|
|
1739
|
-
import {
|
|
1740
|
-
IDENTITY_FIELD_BUDGETS,
|
|
1741
|
-
IdentityFieldBudgetError,
|
|
1742
|
-
init_identity_field_budget
|
|
1743
|
-
} from "./cli-agjbj5x0.js";
|
|
1744
|
-
import {
|
|
1745
|
-
isSteeringEnabled2,
|
|
1746
|
-
init_steering_enabled
|
|
1747
|
-
} from "./cli-4sydckyj.js";
|
|
1748
|
-
import {
|
|
1749
|
-
getSlackConfiguration,
|
|
1750
|
-
init_config4
|
|
1751
|
-
} from "./cli-eetzmsy5.js";
|
|
1752
|
-
import {
|
|
1753
|
-
SUBSCRIPTION_PLANS_CHECKED_AT,
|
|
1754
|
-
SUBSCRIPTION_PLANS,
|
|
1755
|
-
isSubscriptionPlanId,
|
|
1756
|
-
init_subscription_plans
|
|
1757
|
-
} from "./cli-nh7x3133.js";
|
|
1758
|
-
import {
|
|
1759
|
-
MODEL_SCOPED_WINDOWS,
|
|
1760
|
-
KEY_WIDE_WINDOWS,
|
|
1761
|
-
modelFamilyOf,
|
|
1762
|
-
isModelScopedWindow,
|
|
1763
|
-
activeModelBlocks,
|
|
1764
|
-
init_model_rate_limit_windows,
|
|
1765
|
-
CREDENTIAL_POOL_VARS,
|
|
1766
|
-
PROVIDER_CREDENTIAL_VARS,
|
|
1767
|
-
getModelAwareCredentialVars,
|
|
1768
|
-
splitCredentialPool,
|
|
1769
|
-
selectCredential,
|
|
1770
|
-
init_credentials2
|
|
1771
|
-
} from "./cli-js10kdk7.js";
|
|
1772
|
-
import {
|
|
1773
|
-
getOpenRouterAttributionHeaders,
|
|
1774
|
-
init_openrouter_base_url
|
|
1775
|
-
} from "./cli-dfyv0jdy.js";
|
|
1776
|
-
import {
|
|
1777
|
-
interpolate,
|
|
1778
|
-
init_template2,
|
|
1779
|
-
getTemplateDefinition,
|
|
1780
|
-
getAllTemplateDefinitions,
|
|
1781
|
-
init_registry3,
|
|
1782
|
-
resolveTemplate,
|
|
1783
|
-
init_resolver,
|
|
1784
|
-
init_session_templates
|
|
1785
|
-
} from "./cli-2z2c4k6q.js";
|
|
1816
|
+
} from "./cli-f8rcvf2x.js";
|
|
1786
1817
|
import {
|
|
1787
1818
|
init_zod
|
|
1788
1819
|
} from "./cli-96234j5w.js";
|
|
@@ -1823,6 +1854,7 @@ import {
|
|
|
1823
1854
|
getPublicMcpBaseUrl,
|
|
1824
1855
|
getAgentFsLiveUrl,
|
|
1825
1856
|
agentFsFileRoute,
|
|
1857
|
+
buildAgentFsLiveUrl,
|
|
1826
1858
|
isCombEnabled,
|
|
1827
1859
|
isAgentFsProxyEnabled,
|
|
1828
1860
|
init_constants3
|
|
@@ -1835,7 +1867,7 @@ import {
|
|
|
1835
1867
|
import {
|
|
1836
1868
|
init_package,
|
|
1837
1869
|
package_default
|
|
1838
|
-
} from "./cli-
|
|
1870
|
+
} from "./cli-y518qkjg.js";
|
|
1839
1871
|
import {
|
|
1840
1872
|
realtimeBus,
|
|
1841
1873
|
init_bus
|
|
@@ -11966,7 +11998,7 @@ async function handleAssets(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
11966
11998
|
if (!ensureOperator(req, res))
|
|
11967
11999
|
return true;
|
|
11968
12000
|
try {
|
|
11969
|
-
const actor = await
|
|
12001
|
+
const actor = await resolveHttpRequesterUserId(req, myAgentId);
|
|
11970
12002
|
const key = parsed.body.key ? await authorizeAssetKeyWrite(parsed.body.key, actor) : undefined;
|
|
11971
12003
|
const mapping = await upsertAssetKeyMapping2({
|
|
11972
12004
|
providerId: parsed.body.providerId,
|
|
@@ -12049,13 +12081,14 @@ async function handleAssets(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
12049
12081
|
}
|
|
12050
12082
|
}
|
|
12051
12083
|
try {
|
|
12052
|
-
const actor = await
|
|
12084
|
+
const actor = await resolveHttpRequesterUserId(req, myAgentId);
|
|
12053
12085
|
const key = await authorizeAssetKeyWrite(parsed.body.key, actor);
|
|
12054
12086
|
const moved = await moveAssetKey2({
|
|
12055
12087
|
entityType: parsed.params.entityType,
|
|
12056
12088
|
id: parsed.params.id,
|
|
12057
12089
|
key,
|
|
12058
12090
|
changedBy: actor ?? undefined,
|
|
12091
|
+
changedByAgentId: myAgentId,
|
|
12059
12092
|
descendantTaskIds
|
|
12060
12093
|
});
|
|
12061
12094
|
if (!moved) {
|
|
@@ -14612,7 +14645,7 @@ async function handleComb(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
14612
14645
|
try {
|
|
14613
14646
|
const result = await sendReviewBatch({
|
|
14614
14647
|
...parsed.body,
|
|
14615
|
-
requestedByUserId: await
|
|
14648
|
+
requestedByUserId: await resolveHttpRequesterUserId(req, myAgentId)
|
|
14616
14649
|
});
|
|
14617
14650
|
reviewBatchRoute.respond(res, result.taskId === null ? 200 : 201, result);
|
|
14618
14651
|
} catch (error) {
|
|
@@ -15314,6 +15347,7 @@ declare module "swarm-extension" {
|
|
|
15314
15347
|
agentId: string | undefined;
|
|
15315
15348
|
runtimeInstanceId: string | undefined;
|
|
15316
15349
|
sourceTaskId: string | undefined;
|
|
15350
|
+
auditSourceTaskId: string | undefined;
|
|
15317
15351
|
contextKey: string | undefined;
|
|
15318
15352
|
callOrigin: "mcp" | "native" | "extension" | "script-sdk";
|
|
15319
15353
|
harness?: string | undefined;
|
|
@@ -18842,7 +18876,7 @@ var putFavorite = route({
|
|
|
18842
18876
|
row: UserFavoriteSchema.nullable()
|
|
18843
18877
|
})
|
|
18844
18878
|
},
|
|
18845
|
-
400: { description: "Invalid asset key for a key favorite" },
|
|
18879
|
+
400: { description: "Invalid asset key for a key or hidden-key favorite" },
|
|
18846
18880
|
401: { description: "No authenticated principal context" }
|
|
18847
18881
|
}
|
|
18848
18882
|
});
|
|
@@ -18878,7 +18912,7 @@ async function handleFavorites(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
18878
18912
|
return true;
|
|
18879
18913
|
}
|
|
18880
18914
|
let itemId = parsed.body.itemId;
|
|
18881
|
-
if (parsed.body.itemType === "key") {
|
|
18915
|
+
if (parsed.body.itemType === "key" || parsed.body.itemType === "hidden-key") {
|
|
18882
18916
|
try {
|
|
18883
18917
|
itemId = normalizeAssetKey(itemId);
|
|
18884
18918
|
} catch (error) {
|
|
@@ -19571,7 +19605,9 @@ var inviteMemberRoute = route({
|
|
|
19571
19605
|
schema: agentFsInviteStateSchema
|
|
19572
19606
|
},
|
|
19573
19607
|
400: { description: "Invalid body" },
|
|
19574
|
-
403: {
|
|
19608
|
+
403: {
|
|
19609
|
+
description: "The caller is not the operator key or a user, or a non-admin user token named an email other than its own"
|
|
19610
|
+
},
|
|
19575
19611
|
500: { description: "Provisioning or invite failed" }
|
|
19576
19612
|
},
|
|
19577
19613
|
auth: { apiKey: true },
|
|
@@ -19675,8 +19711,13 @@ var deleteTaskFileRoute = route({
|
|
|
19675
19711
|
rbac: { permission: "task.fs.mutate" }
|
|
19676
19712
|
});
|
|
19677
19713
|
async function resolveInvite(req, body) {
|
|
19678
|
-
const
|
|
19679
|
-
if (
|
|
19714
|
+
const auth = getRequestAuth(req);
|
|
19715
|
+
if (auth?.kind === "operator")
|
|
19716
|
+
return body;
|
|
19717
|
+
const user = authUser(auth);
|
|
19718
|
+
if (!user)
|
|
19719
|
+
return { denied: "Only the operator key or a user token can invite to the shared drive" };
|
|
19720
|
+
if (!isRbacEnabled())
|
|
19680
19721
|
return body;
|
|
19681
19722
|
const grant = await getUserGrant2(user.id);
|
|
19682
19723
|
if (grant.grantsAll)
|
|
@@ -28411,6 +28452,382 @@ async function handleObjectWebhooks(req, res, pathSegments) {
|
|
|
28411
28452
|
return true;
|
|
28412
28453
|
}
|
|
28413
28454
|
|
|
28455
|
+
// src/http/objects.ts
|
|
28456
|
+
init_zod();
|
|
28457
|
+
|
|
28458
|
+
// src/be/primitives/object-embed.ts
|
|
28459
|
+
init_provider();
|
|
28460
|
+
init_constants3();
|
|
28461
|
+
init_agent_fs_identity();
|
|
28462
|
+
init_db4();
|
|
28463
|
+
init_elements();
|
|
28464
|
+
init_objects();
|
|
28465
|
+
init_service();
|
|
28466
|
+
init_write_object();
|
|
28467
|
+
|
|
28468
|
+
class ObjectEmbedError extends Error {
|
|
28469
|
+
status;
|
|
28470
|
+
version;
|
|
28471
|
+
constructor(status, message, version) {
|
|
28472
|
+
super(message);
|
|
28473
|
+
this.status = status;
|
|
28474
|
+
this.version = version;
|
|
28475
|
+
}
|
|
28476
|
+
}
|
|
28477
|
+
var versionOf = (value) => value && Number.isFinite(Number(value)) ? Number(value) : null;
|
|
28478
|
+
async function sharedDrive() {
|
|
28479
|
+
const value = async (key) => (await getSwarmConfigs2({ scope: "global", key }))[0]?.value?.trim() || process.env[key]?.trim();
|
|
28480
|
+
const orgId = await value("AGENT_FS_DEFAULT_ORG_ID") || await value("AGENT_FS_SHARED_ORG_ID");
|
|
28481
|
+
const driveId = await value("AGENT_FS_DEFAULT_DRIVE_ID");
|
|
28482
|
+
return orgId && driveId ? { orgId, driveId } : null;
|
|
28483
|
+
}
|
|
28484
|
+
async function open(id) {
|
|
28485
|
+
const row = await getDbClient2().get("SELECT * FROM primitive_objects WHERE id = ?", [id]);
|
|
28486
|
+
if (!row)
|
|
28487
|
+
throw new ObjectEmbedError(404, `no object with id '${id}'`);
|
|
28488
|
+
const shared = await sharedDrive();
|
|
28489
|
+
if (!shared || shared.orgId !== row.orgId || shared.driveId !== row.driveId) {
|
|
28490
|
+
throw new ObjectEmbedError(403, "this object is not on the swarm's shared agent-fs drive");
|
|
28491
|
+
}
|
|
28492
|
+
if (row.deletedAt)
|
|
28493
|
+
throw new ObjectEmbedError(404, `object '${id}' was deleted on agent-fs`);
|
|
28494
|
+
const client = row.ownerAgentId ? await agentFsClientFor(row.ownerAgentId) : undefined;
|
|
28495
|
+
if (!client || !row.ownerAgentId) {
|
|
28496
|
+
throw new ObjectEmbedError(503, "owner agent has no agent-fs key");
|
|
28497
|
+
}
|
|
28498
|
+
if (client.identity.orgId !== row.orgId || client.identity.driveId !== row.driveId) {
|
|
28499
|
+
throw new ObjectEmbedError(503, "owner agent's default agent-fs drive is not the object's drive");
|
|
28500
|
+
}
|
|
28501
|
+
const scope = { taskId: "", name: "", key: row.path, orgId: row.orgId, driveId: row.driveId };
|
|
28502
|
+
return { row, owner: row.ownerAgentId, provider: client.provider, scope };
|
|
28503
|
+
}
|
|
28504
|
+
var withLink = (row) => ({ ...row, link: buildAgentFsLiveUrl(row) });
|
|
28505
|
+
async function driveWatched(orgId, driveId) {
|
|
28506
|
+
const hook = await getDbClient2().get("SELECT status FROM agent_fs_object_webhooks WHERE orgId = ? AND driveId = ?", [orgId, driveId]);
|
|
28507
|
+
return hook?.status === "active";
|
|
28508
|
+
}
|
|
28509
|
+
async function recordEditor(id, userId) {
|
|
28510
|
+
await getDbClient2().run("UPDATE primitive_objects SET updated_by = ? WHERE id = ?", [userId, id]);
|
|
28511
|
+
}
|
|
28512
|
+
function asEmbedError(error) {
|
|
28513
|
+
if (!(error instanceof ObjectsError))
|
|
28514
|
+
return error;
|
|
28515
|
+
const status = error.message.startsWith("concurrent writers") ? 409 : 400;
|
|
28516
|
+
return new ObjectEmbedError(status, error.message);
|
|
28517
|
+
}
|
|
28518
|
+
async function readObject(id, knownVersion) {
|
|
28519
|
+
const { row, provider, scope } = await open(id);
|
|
28520
|
+
if (knownVersion !== undefined) {
|
|
28521
|
+
if (row.fileVersion === knownVersion && await driveWatched(row.orgId, row.driveId)) {
|
|
28522
|
+
return { object: withLink(row), version: knownVersion, unchanged: true };
|
|
28523
|
+
}
|
|
28524
|
+
let current = null;
|
|
28525
|
+
try {
|
|
28526
|
+
current = await provider.currentVersion(scope);
|
|
28527
|
+
} catch (error) {
|
|
28528
|
+
if (error instanceof FilesError && error.code === "Unauthorized")
|
|
28529
|
+
throw error;
|
|
28530
|
+
}
|
|
28531
|
+
if (current !== null && current === knownVersion) {
|
|
28532
|
+
return { object: withLink(row), version: current, unchanged: true };
|
|
28533
|
+
}
|
|
28534
|
+
}
|
|
28535
|
+
let response;
|
|
28536
|
+
try {
|
|
28537
|
+
response = await provider.download(scope);
|
|
28538
|
+
} catch (error) {
|
|
28539
|
+
if (error instanceof FilesError && error.code === "NotFound") {
|
|
28540
|
+
throw new ObjectEmbedError(404, `the file for object '${id}' is missing on agent-fs`);
|
|
28541
|
+
}
|
|
28542
|
+
throw error;
|
|
28543
|
+
}
|
|
28544
|
+
const version = versionOf(response.headers.get("x-agent-fs-version")) ?? row.fileVersion;
|
|
28545
|
+
const text = await response.text();
|
|
28546
|
+
let content = text;
|
|
28547
|
+
try {
|
|
28548
|
+
content = JSON.parse(text);
|
|
28549
|
+
} catch {}
|
|
28550
|
+
return { object: withLink({ ...row, fileVersion: version }), version, unchanged: false, content };
|
|
28551
|
+
}
|
|
28552
|
+
async function saveBoardContent(input) {
|
|
28553
|
+
const { row, provider, scope } = await open(input.id);
|
|
28554
|
+
if (row.kind !== "board") {
|
|
28555
|
+
throw new ObjectEmbedError(400, `object ${row.id} is a ${row.kind}; only a board takes a full save`);
|
|
28556
|
+
}
|
|
28557
|
+
let scene;
|
|
28558
|
+
try {
|
|
28559
|
+
scene = parseScene(input.content, row.path);
|
|
28560
|
+
} catch (error) {
|
|
28561
|
+
throw asEmbedError(error);
|
|
28562
|
+
}
|
|
28563
|
+
if (scene.type !== undefined && scene.type !== "excalidraw") {
|
|
28564
|
+
throw new ObjectEmbedError(400, "content is not an Excalidraw scene (type must be 'excalidraw')");
|
|
28565
|
+
}
|
|
28566
|
+
const doc = PRIMITIVE_KINDS.board?.withId(scene, row.id) ?? scene;
|
|
28567
|
+
const swarm = doc.swarm;
|
|
28568
|
+
if (swarm.title === undefined && row.title)
|
|
28569
|
+
swarm.title = row.title;
|
|
28570
|
+
const body = JSON.stringify(doc, null, 2);
|
|
28571
|
+
if (Buffer.byteLength(body) > MAX_OBJECT_BYTES) {
|
|
28572
|
+
throw new ObjectEmbedError(413, `the board would exceed ${MAX_OBJECT_BYTES} bytes; nothing written`);
|
|
28573
|
+
}
|
|
28574
|
+
let written;
|
|
28575
|
+
try {
|
|
28576
|
+
written = await provider.upload(scope, body, {
|
|
28577
|
+
contentType: "application/json",
|
|
28578
|
+
ifMatch: String(input.ifMatch),
|
|
28579
|
+
message: `edit via ${input.actor.via} by ${input.actor.name ?? "operator"}`
|
|
28580
|
+
});
|
|
28581
|
+
} catch (error) {
|
|
28582
|
+
if (!(error instanceof FilesError && error.code === "Conflict"))
|
|
28583
|
+
throw error;
|
|
28584
|
+
const current = await provider.currentVersion(scope).catch(() => null);
|
|
28585
|
+
throw new ObjectEmbedError(409, `the board changed on agent-fs since version ${input.ifMatch}; reload it`, current);
|
|
28586
|
+
}
|
|
28587
|
+
const version = versionOf(written.version);
|
|
28588
|
+
await recordObjectVersion(row.id, version);
|
|
28589
|
+
await recordEditor(row.id, input.actor.userId);
|
|
28590
|
+
return { object: withLink({ ...row, fileVersion: version }), version };
|
|
28591
|
+
}
|
|
28592
|
+
async function applySheetOp(input) {
|
|
28593
|
+
const { row, owner } = await open(input.id);
|
|
28594
|
+
if (row.kind !== "sheet") {
|
|
28595
|
+
throw new ObjectEmbedError(400, `object ${row.id} is a ${row.kind}, not a sheet`);
|
|
28596
|
+
}
|
|
28597
|
+
const target = { agentId: owner, id: row.id };
|
|
28598
|
+
const { op } = input;
|
|
28599
|
+
let result;
|
|
28600
|
+
try {
|
|
28601
|
+
if (op.op === "setRange") {
|
|
28602
|
+
result = await setSheetRange({ ...target, range: op.range, values: op.values });
|
|
28603
|
+
} else if (op.op === "clearRange") {
|
|
28604
|
+
result = await clearSheetRange({ ...target, range: op.range });
|
|
28605
|
+
} else {
|
|
28606
|
+
result = await appendSheetRows({ ...target, tab: op.tab, rows: op.rows });
|
|
28607
|
+
}
|
|
28608
|
+
} catch (error) {
|
|
28609
|
+
throw asEmbedError(error);
|
|
28610
|
+
}
|
|
28611
|
+
await recordEditor(row.id, input.actor.userId);
|
|
28612
|
+
return { op: op.op, ...result };
|
|
28613
|
+
}
|
|
28614
|
+
|
|
28615
|
+
// src/http/objects.ts
|
|
28616
|
+
init_write_object();
|
|
28617
|
+
init_users();
|
|
28618
|
+
init_rbac();
|
|
28619
|
+
init_request_auth_context();
|
|
28620
|
+
init_favorite_owner();
|
|
28621
|
+
init_request_principal();
|
|
28622
|
+
init_route_def();
|
|
28623
|
+
init_utils2();
|
|
28624
|
+
var ObjectSchema = object2({
|
|
28625
|
+
id: string2(),
|
|
28626
|
+
kind: string2(),
|
|
28627
|
+
orgId: string2(),
|
|
28628
|
+
driveId: string2(),
|
|
28629
|
+
path: string2(),
|
|
28630
|
+
title: string2().nullable(),
|
|
28631
|
+
fileVersion: number2().nullable(),
|
|
28632
|
+
ownerAgentId: string2().nullable(),
|
|
28633
|
+
createdAt: string2(),
|
|
28634
|
+
updatedAt: string2(),
|
|
28635
|
+
link: string2().nullable()
|
|
28636
|
+
});
|
|
28637
|
+
var params2 = object2({ id: string2().uuid().describe("Object id (`swarm.id` in the file)") });
|
|
28638
|
+
var CellSchema = union3([number2(), string2(), boolean(), _null()]);
|
|
28639
|
+
var CellRowsSchema = array2(array2(CellSchema));
|
|
28640
|
+
var objectErrors = {
|
|
28641
|
+
400: { description: "Invalid input, or the object is not the kind this route edits" },
|
|
28642
|
+
403: {
|
|
28643
|
+
description: "Permission denied, a page guest, a read-only page session, or an object off the shared drive"
|
|
28644
|
+
},
|
|
28645
|
+
404: { description: "No such object, or its file is gone" },
|
|
28646
|
+
503: { description: "The owner agent has no agent-fs key on the object's drive" }
|
|
28647
|
+
};
|
|
28648
|
+
var getObjectRoute = route({
|
|
28649
|
+
method: "get",
|
|
28650
|
+
path: "/api/objects/{id}",
|
|
28651
|
+
pattern: ["api", "objects", null],
|
|
28652
|
+
summary: "Read a board or sheet on the shared drive, or confirm it is unchanged",
|
|
28653
|
+
tags: ["Objects"],
|
|
28654
|
+
params: params2,
|
|
28655
|
+
query: object2({
|
|
28656
|
+
knownVersion: exports_coerce.number().int().min(0).optional().describe("The version the caller holds. A match answers `unchanged: true` with no content")
|
|
28657
|
+
}),
|
|
28658
|
+
rbac: { permission: "objects.read" },
|
|
28659
|
+
responses: {
|
|
28660
|
+
200: {
|
|
28661
|
+
description: "The object with its content, or `unchanged: true` with no content",
|
|
28662
|
+
schema: object2({
|
|
28663
|
+
object: ObjectSchema,
|
|
28664
|
+
version: number2().nullable(),
|
|
28665
|
+
unchanged: boolean(),
|
|
28666
|
+
content: unknown().optional()
|
|
28667
|
+
})
|
|
28668
|
+
},
|
|
28669
|
+
...objectErrors
|
|
28670
|
+
}
|
|
28671
|
+
});
|
|
28672
|
+
var putContentRoute = route({
|
|
28673
|
+
method: "put",
|
|
28674
|
+
path: "/api/objects/{id}/content",
|
|
28675
|
+
pattern: ["api", "objects", null, "content"],
|
|
28676
|
+
summary: "Save a board's full Excalidraw scene, guarded by its agent-fs version",
|
|
28677
|
+
tags: ["Objects"],
|
|
28678
|
+
params: params2,
|
|
28679
|
+
body: object2({
|
|
28680
|
+
content: record2(string2(), unknown()).describe("The Excalidraw scene"),
|
|
28681
|
+
ifMatch: number2().int().min(0).describe("The version the scene was edited from")
|
|
28682
|
+
}),
|
|
28683
|
+
maxBodyBytes: MAX_OBJECT_BYTES + 256 * 1024,
|
|
28684
|
+
rbac: { permission: "objects.write" },
|
|
28685
|
+
responses: {
|
|
28686
|
+
200: {
|
|
28687
|
+
description: "Saved",
|
|
28688
|
+
schema: object2({ object: ObjectSchema, version: number2().nullable() })
|
|
28689
|
+
},
|
|
28690
|
+
...objectErrors,
|
|
28691
|
+
409: { description: "The board changed since `ifMatch`; the body carries its `version`" },
|
|
28692
|
+
413: { description: "The scene exceeds 5 MiB" }
|
|
28693
|
+
}
|
|
28694
|
+
});
|
|
28695
|
+
var sheetOpsRoute = route({
|
|
28696
|
+
method: "post",
|
|
28697
|
+
path: "/api/objects/{id}/sheet-ops",
|
|
28698
|
+
pattern: ["api", "objects", null, "sheet-ops"],
|
|
28699
|
+
summary: "Patch sheet cells; the server recalculates and merges concurrent edits",
|
|
28700
|
+
tags: ["Objects"],
|
|
28701
|
+
params: params2,
|
|
28702
|
+
body: discriminatedUnion("op", [
|
|
28703
|
+
object2({ op: literal2("setRange"), range: string2().min(1), values: CellRowsSchema }),
|
|
28704
|
+
object2({ op: literal2("clearRange"), range: string2().min(1) }),
|
|
28705
|
+
object2({ op: literal2("appendRows"), tab: string2().min(1), rows: CellRowsSchema })
|
|
28706
|
+
]),
|
|
28707
|
+
maxBodyBytes: 2 * 1024 * 1024,
|
|
28708
|
+
rbac: { permission: "objects.write" },
|
|
28709
|
+
responses: {
|
|
28710
|
+
200: {
|
|
28711
|
+
description: "Applied: the range written and the new version",
|
|
28712
|
+
schema: object2({
|
|
28713
|
+
op: _enum2(["setRange", "clearRange", "appendRows"]),
|
|
28714
|
+
range: string2(),
|
|
28715
|
+
version: number2(),
|
|
28716
|
+
changed: number2().optional(),
|
|
28717
|
+
recalculated: number2().optional(),
|
|
28718
|
+
cleared: number2().optional()
|
|
28719
|
+
})
|
|
28720
|
+
},
|
|
28721
|
+
...objectErrors,
|
|
28722
|
+
409: { description: "Other writers changed the sheet on every retry; try again" }
|
|
28723
|
+
}
|
|
28724
|
+
});
|
|
28725
|
+
var publicObject = (o) => ({
|
|
28726
|
+
id: o.id,
|
|
28727
|
+
kind: o.kind,
|
|
28728
|
+
orgId: o.orgId,
|
|
28729
|
+
driveId: o.driveId,
|
|
28730
|
+
path: o.path,
|
|
28731
|
+
title: o.title,
|
|
28732
|
+
fileVersion: o.fileVersion,
|
|
28733
|
+
ownerAgentId: o.ownerAgentId,
|
|
28734
|
+
createdAt: o.createdAt,
|
|
28735
|
+
updatedAt: o.updatedAt,
|
|
28736
|
+
link: o.link
|
|
28737
|
+
});
|
|
28738
|
+
async function authorize(req, res, myAgentId, verb) {
|
|
28739
|
+
const auth = getRequestAuth(req);
|
|
28740
|
+
if (auth?.kind === "guest" || auth?.kind === "controller") {
|
|
28741
|
+
jsonError(res, "sign in to the swarm to view this object", 403);
|
|
28742
|
+
return null;
|
|
28743
|
+
}
|
|
28744
|
+
const principal = await resolveRequestPrincipal(req, myAgentId, {
|
|
28745
|
+
unauthenticatedFallback: "operator"
|
|
28746
|
+
});
|
|
28747
|
+
const decision = principal ? can({ principal, verb, resource: { kind: "none" }, source: "http" }) : { allow: false, reason: "no authenticated principal" };
|
|
28748
|
+
if (!decision.allow) {
|
|
28749
|
+
jsonError(res, decision.reason, 403);
|
|
28750
|
+
return null;
|
|
28751
|
+
}
|
|
28752
|
+
const via = auth?.page ? "page" : "app";
|
|
28753
|
+
if (verb === "objects.write" && auth?.page && principal?.kind !== "user") {
|
|
28754
|
+
jsonError(res, "this page session is read-only; sign in to the swarm to edit", 403);
|
|
28755
|
+
return null;
|
|
28756
|
+
}
|
|
28757
|
+
let user = principal?.kind === "user" ? authUser(auth) : undefined;
|
|
28758
|
+
if (!user && isOperatorAuth(auth) && !auth.page && !myAgentId) {
|
|
28759
|
+
const pickedId = dashboardUserIdHeader(req);
|
|
28760
|
+
const picked = pickedId ? await findUserById(pickedId) : null;
|
|
28761
|
+
if (picked?.status === "active" && !picked.mergedIntoUserId)
|
|
28762
|
+
user = picked;
|
|
28763
|
+
}
|
|
28764
|
+
return { via, userId: user?.id ?? null, name: user?.name ?? null };
|
|
28765
|
+
}
|
|
28766
|
+
function respondError(res, error) {
|
|
28767
|
+
if (!(error instanceof ObjectEmbedError))
|
|
28768
|
+
return false;
|
|
28769
|
+
if (error.status === 409 && error.version !== undefined) {
|
|
28770
|
+
json(res, { error: error.message, version: error.version }, 409);
|
|
28771
|
+
} else {
|
|
28772
|
+
jsonError(res, error.message, error.status);
|
|
28773
|
+
}
|
|
28774
|
+
return true;
|
|
28775
|
+
}
|
|
28776
|
+
async function handleObjects(req, res, pathSegments, queryParams, myAgentId) {
|
|
28777
|
+
if (getObjectRoute.match(req.method, pathSegments)) {
|
|
28778
|
+
const parsed = await getObjectRoute.parse(req, res, pathSegments, queryParams);
|
|
28779
|
+
if (!parsed)
|
|
28780
|
+
return true;
|
|
28781
|
+
if (!await authorize(req, res, myAgentId, "objects.read"))
|
|
28782
|
+
return true;
|
|
28783
|
+
try {
|
|
28784
|
+
const read = await readObject(parsed.params.id, parsed.query.knownVersion);
|
|
28785
|
+
getObjectRoute.respond(res, 200, { ...read, object: publicObject(read.object) });
|
|
28786
|
+
} catch (error) {
|
|
28787
|
+
if (!respondError(res, error))
|
|
28788
|
+
throw error;
|
|
28789
|
+
}
|
|
28790
|
+
return true;
|
|
28791
|
+
}
|
|
28792
|
+
if (putContentRoute.match(req.method, pathSegments)) {
|
|
28793
|
+
const parsed = await putContentRoute.parse(req, res, pathSegments, queryParams);
|
|
28794
|
+
if (!parsed)
|
|
28795
|
+
return true;
|
|
28796
|
+
const actor = await authorize(req, res, myAgentId, "objects.write");
|
|
28797
|
+
if (!actor)
|
|
28798
|
+
return true;
|
|
28799
|
+
try {
|
|
28800
|
+
const saved = await saveBoardContent({
|
|
28801
|
+
id: parsed.params.id,
|
|
28802
|
+
content: parsed.body.content,
|
|
28803
|
+
ifMatch: parsed.body.ifMatch,
|
|
28804
|
+
actor
|
|
28805
|
+
});
|
|
28806
|
+
putContentRoute.respond(res, 200, { ...saved, object: publicObject(saved.object) });
|
|
28807
|
+
} catch (error) {
|
|
28808
|
+
if (!respondError(res, error))
|
|
28809
|
+
throw error;
|
|
28810
|
+
}
|
|
28811
|
+
return true;
|
|
28812
|
+
}
|
|
28813
|
+
if (sheetOpsRoute.match(req.method, pathSegments)) {
|
|
28814
|
+
const parsed = await sheetOpsRoute.parse(req, res, pathSegments, queryParams);
|
|
28815
|
+
if (!parsed)
|
|
28816
|
+
return true;
|
|
28817
|
+
const actor = await authorize(req, res, myAgentId, "objects.write");
|
|
28818
|
+
if (!actor)
|
|
28819
|
+
return true;
|
|
28820
|
+
try {
|
|
28821
|
+
sheetOpsRoute.respond(res, 200, await applySheetOp({ id: parsed.params.id, op: parsed.body, actor }));
|
|
28822
|
+
} catch (error) {
|
|
28823
|
+
if (!respondError(res, error))
|
|
28824
|
+
throw error;
|
|
28825
|
+
}
|
|
28826
|
+
return true;
|
|
28827
|
+
}
|
|
28828
|
+
return false;
|
|
28829
|
+
}
|
|
28830
|
+
|
|
28414
28831
|
// src/http/onboarding.ts
|
|
28415
28832
|
init_openai2();
|
|
28416
28833
|
init_automation_preflight();
|
|
@@ -29606,6 +30023,7 @@ init_task_citations2();
|
|
|
29606
30023
|
init_task_ui_spec();
|
|
29607
30024
|
init_users();
|
|
29608
30025
|
init_rbac();
|
|
30026
|
+
init_session_mirror();
|
|
29609
30027
|
init_context_key();
|
|
29610
30028
|
init_errors2();
|
|
29611
30029
|
init_sibling_awareness();
|
|
@@ -30541,7 +30959,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
30541
30959
|
const parsed = await createTask.parse(req, res, pathSegments, queryParams);
|
|
30542
30960
|
if (!parsed)
|
|
30543
30961
|
return true;
|
|
30544
|
-
const trustedUserId = await
|
|
30962
|
+
const trustedUserId = await resolveHttpRequesterUserId(req, myAgentId);
|
|
30545
30963
|
const requestedByUserId = await resolveTaskRequester(req, myAgentId, parsed.body.requestedByUserId, trustedUserId);
|
|
30546
30964
|
let defaultAgentId = parsed.body.agentId || undefined;
|
|
30547
30965
|
if (!defaultAgentId) {
|
|
@@ -30652,6 +31070,9 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
30652
31070
|
parentTaskId: task.parentTaskId
|
|
30653
31071
|
}
|
|
30654
31072
|
});
|
|
31073
|
+
if (principal.kind === "user" || principal.kind === "operator") {
|
|
31074
|
+
getDbClient2().afterCommit(() => mirrorSessionPrompt(task));
|
|
31075
|
+
}
|
|
30655
31076
|
createTask.respond(res, 201, task);
|
|
30656
31077
|
} catch (error) {
|
|
30657
31078
|
if (error instanceof TaskRoutingAuthorizationError) {
|
|
@@ -30700,6 +31121,9 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
30700
31121
|
jsonError(res, "Task not found", 404);
|
|
30701
31122
|
return true;
|
|
30702
31123
|
}
|
|
31124
|
+
if (existingTask.status === "draft") {
|
|
31125
|
+
getDbClient2().afterCommit(() => mirrorSessionPrompt(promoted));
|
|
31126
|
+
}
|
|
30703
31127
|
promoteDraftTaskRoute.respond(res, 200, promoted);
|
|
30704
31128
|
return true;
|
|
30705
31129
|
}
|
|
@@ -30817,7 +31241,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
30817
31241
|
jsonError(res, "Forbidden: caller cannot steer this task", 403);
|
|
30818
31242
|
return true;
|
|
30819
31243
|
}
|
|
30820
|
-
const trustedUserId = await await
|
|
31244
|
+
const trustedUserId = await await resolveHttpRequesterUserId(req, myAgentId);
|
|
30821
31245
|
let requestedByUserId = trustedUserId ?? undefined;
|
|
30822
31246
|
if (process.env.TRUST_BODY_REQUESTED_BY_USER_ID !== "false" && !requestedByUserId && parsed.body.requestedByUserId) {
|
|
30823
31247
|
requestedByUserId = (await findUserById(parsed.body.requestedByUserId))?.id;
|
|
@@ -31940,7 +32364,7 @@ async function handlePages(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
31940
32364
|
passwordHash = await Bun.password.hash(parsed.body.password, "bcrypt");
|
|
31941
32365
|
}
|
|
31942
32366
|
try {
|
|
31943
|
-
const key = parsed.body.key ? await authorizeAssetKeyWrite(parsed.body.key, await
|
|
32367
|
+
const key = parsed.body.key ? await authorizeAssetKeyWrite(parsed.body.key, await resolveHttpRequesterUserId(req, myAgentId)) : undefined;
|
|
31944
32368
|
const page = await createPage2({
|
|
31945
32369
|
key,
|
|
31946
32370
|
agentId: myAgentId,
|
|
@@ -32144,7 +32568,7 @@ async function handlePages(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
32144
32568
|
let key;
|
|
32145
32569
|
if (parsed.body.key !== undefined) {
|
|
32146
32570
|
try {
|
|
32147
|
-
key = await authorizeAssetKeyWrite(parsed.body.key, await
|
|
32571
|
+
key = await authorizeAssetKeyWrite(parsed.body.key, await resolveHttpRequesterUserId(req, myAgentId));
|
|
32148
32572
|
} catch (error) {
|
|
32149
32573
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
32150
32574
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -35065,6 +35489,7 @@ var pollTriggers = route({
|
|
|
35065
35489
|
404: { description: "Agent not found" }
|
|
35066
35490
|
}
|
|
35067
35491
|
});
|
|
35492
|
+
var NEEDS_WRITE = Symbol("poll-needs-write");
|
|
35068
35493
|
var CHANNEL_ACTIVITY_INTERVAL_MS = 60000;
|
|
35069
35494
|
var lastChannelActivityCheckAt = 0;
|
|
35070
35495
|
async function attachmentsForTrigger(taskId) {
|
|
@@ -35177,19 +35602,29 @@ async function handlePoll(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35177
35602
|
let runtimeDraining = false;
|
|
35178
35603
|
let result;
|
|
35179
35604
|
try {
|
|
35180
|
-
|
|
35605
|
+
const pollBody = async (probe) => {
|
|
35181
35606
|
const agent = await getAgentById2(myAgentId);
|
|
35182
35607
|
if (!agent) {
|
|
35183
35608
|
return { error: "Agent not found", status: 404 };
|
|
35184
35609
|
}
|
|
35185
35610
|
if (modelTierOverrides) {
|
|
35186
|
-
|
|
35611
|
+
if (!probe)
|
|
35612
|
+
await setAgentModelTierOverrides(agent.id, modelTierOverrides);
|
|
35613
|
+
else if (await modelTierOverridesDiffer(agent.id, modelTierOverrides))
|
|
35614
|
+
return NEEDS_WRITE;
|
|
35187
35615
|
}
|
|
35188
35616
|
if (isExtensionAgent2(agent)) {
|
|
35189
35617
|
return { trigger: null };
|
|
35190
35618
|
}
|
|
35191
|
-
if (isMultiRuntimeEnabled()
|
|
35192
|
-
|
|
35619
|
+
if (isMultiRuntimeEnabled()) {
|
|
35620
|
+
if (!runtimeInstanceId)
|
|
35621
|
+
return { trigger: null };
|
|
35622
|
+
if (probe) {
|
|
35623
|
+
if (!await isRuntimeInstanceFresh(runtimeInstanceId, agent.id))
|
|
35624
|
+
return NEEDS_WRITE;
|
|
35625
|
+
} else if (!await touchRuntimeInstance(runtimeInstanceId, agent.id)) {
|
|
35626
|
+
return { trigger: null };
|
|
35627
|
+
}
|
|
35193
35628
|
}
|
|
35194
35629
|
if (isMultiRuntimeEnabled() && runtimeInstanceId && (await getRuntimeInstanceById(runtimeInstanceId))?.draining) {
|
|
35195
35630
|
runtimeDraining = true;
|
|
@@ -35201,6 +35636,8 @@ async function handlePoll(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35201
35636
|
const offeredTasks = await hasCapacity2(myAgentId) ? await getOfferedTasksForAgent2(myAgentId) : [];
|
|
35202
35637
|
const firstOfferedTask = offeredTasks[0];
|
|
35203
35638
|
if (firstOfferedTask) {
|
|
35639
|
+
if (probe)
|
|
35640
|
+
return NEEDS_WRITE;
|
|
35204
35641
|
const claimedTask = await claimOfferedTask2(firstOfferedTask.id, myAgentId);
|
|
35205
35642
|
if (claimedTask) {
|
|
35206
35643
|
await recordRuntimeTask(claimedTask.id);
|
|
@@ -35218,7 +35655,10 @@ async function handlePoll(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35218
35655
|
}
|
|
35219
35656
|
}
|
|
35220
35657
|
if (await hasCapacity2(myAgentId)) {
|
|
35221
|
-
const
|
|
35658
|
+
const pendingProbe = probe ? { skipLogDue: false } : undefined;
|
|
35659
|
+
const pendingTask = await getPendingTaskForAgent2(myAgentId, pendingProbe);
|
|
35660
|
+
if (pendingProbe && (pendingTask || pendingProbe.skipLogDue))
|
|
35661
|
+
return NEEDS_WRITE;
|
|
35222
35662
|
if (pendingTask) {
|
|
35223
35663
|
const admission = await canClaim(myAgentId, new Date, pendingTask.requestedByUserId);
|
|
35224
35664
|
if (!admission.allowed) {
|
|
@@ -35308,8 +35748,10 @@ async function handlePoll(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35308
35748
|
};
|
|
35309
35749
|
}
|
|
35310
35750
|
}
|
|
35311
|
-
const claimedChannels = hasCapability("messaging") ? await claimMentions2(myAgentId) : [];
|
|
35751
|
+
const claimedChannels = hasCapability("messaging") ? await claimMentions2(myAgentId, { dryRun: probe }) : [];
|
|
35312
35752
|
if (claimedChannels.length > 0) {
|
|
35753
|
+
if (probe)
|
|
35754
|
+
return NEEDS_WRITE;
|
|
35313
35755
|
return {
|
|
35314
35756
|
trigger: {
|
|
35315
35757
|
type: "unread_mentions",
|
|
@@ -35339,6 +35781,8 @@ async function handlePoll(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35339
35781
|
};
|
|
35340
35782
|
const unassignedIds = await getUnassignedTaskIdsForAgent2(myAgentId, 5, async (task) => await poolTaskRunsOnHarness(task, harness) && (!task.profile || await passesProfileCheck(task.profile, task.vcsRepo)));
|
|
35341
35783
|
if (unassignedIds.length > 0) {
|
|
35784
|
+
if (probe)
|
|
35785
|
+
return NEEDS_WRITE;
|
|
35342
35786
|
const candidateId = unassignedIds[0];
|
|
35343
35787
|
const candidateTask = await getTaskById2(candidateId);
|
|
35344
35788
|
const admission = await canClaim(myAgentId, new Date, candidateTask?.requestedByUserId);
|
|
@@ -35418,7 +35862,9 @@ async function handlePoll(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
35418
35862
|
}
|
|
35419
35863
|
}
|
|
35420
35864
|
return { trigger: null };
|
|
35421
|
-
}
|
|
35865
|
+
};
|
|
35866
|
+
const probed = await getDbClient2().transaction(() => pollBody(true), { readOnly: true });
|
|
35867
|
+
result = probed === NEEDS_WRITE ? await getDbClient2().transaction(() => pollBody(false)) : probed;
|
|
35422
35868
|
} catch (error) {
|
|
35423
35869
|
console.error("[/api/poll] Database error:", error);
|
|
35424
35870
|
jsonError(res, `Database error occurred while polling for triggers: ${error instanceof Error ? error.message : String(error)}`, 500);
|
|
@@ -36510,7 +36956,7 @@ var createRepo = route({
|
|
|
36510
36956
|
201: { description: "Repo created", schema: SwarmRepoSchema },
|
|
36511
36957
|
400: { description: "Validation error", schema: object2({ error: string2() }) },
|
|
36512
36958
|
403: {
|
|
36513
|
-
description: "Only the lead, the operator or a user can turn allowMerge on",
|
|
36959
|
+
description: "Only the lead, the operator or a user can turn allowMerge on or set a mergePolicy",
|
|
36514
36960
|
schema: object2({ error: string2() })
|
|
36515
36961
|
},
|
|
36516
36962
|
409: { description: "Duplicate repo", schema: object2({ error: string2() }) }
|
|
@@ -36536,7 +36982,7 @@ var updateRepo = route({
|
|
|
36536
36982
|
responses: {
|
|
36537
36983
|
200: { description: "Repo updated", schema: SwarmRepoSchema },
|
|
36538
36984
|
403: {
|
|
36539
|
-
description: "Only the lead, the operator or a user can change allowMerge",
|
|
36985
|
+
description: "Only the lead, the operator or a user can change allowMerge or mergePolicy",
|
|
36540
36986
|
schema: object2({ error: string2() })
|
|
36541
36987
|
},
|
|
36542
36988
|
404: { description: "Repo not found", schema: object2({ error: string2() }) },
|
|
@@ -36595,7 +37041,7 @@ async function handleRepos(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
36595
37041
|
const parsed = await createRepo.parse(req, res, pathSegments, queryParams);
|
|
36596
37042
|
if (!parsed)
|
|
36597
37043
|
return true;
|
|
36598
|
-
if (
|
|
37044
|
+
if (changesMergePolicy(null, parsed.body.guidelines)) {
|
|
36599
37045
|
const refusal = await allowMergeRefusal(req, myAgentId);
|
|
36600
37046
|
if (refusal) {
|
|
36601
37047
|
jsonError(res, refusal, 403);
|
|
@@ -40507,7 +40953,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40507
40953
|
return true;
|
|
40508
40954
|
}
|
|
40509
40955
|
try {
|
|
40510
|
-
const trustedUserId = await
|
|
40956
|
+
const trustedUserId = await resolveHttpRequesterUserId(req, myAgentId);
|
|
40511
40957
|
let key;
|
|
40512
40958
|
try {
|
|
40513
40959
|
key = body.key ? await authorizeAssetKeyWrite(body.key, trustedUserId) : undefined;
|
|
@@ -40557,7 +41003,8 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40557
41003
|
params: body.params,
|
|
40558
41004
|
requiredParams: body.requiredParams,
|
|
40559
41005
|
requires: body.requires,
|
|
40560
|
-
|
|
41006
|
+
createdByAgentId: myAgentId,
|
|
41007
|
+
createdBy: trustedUserId ?? undefined
|
|
40561
41008
|
});
|
|
40562
41009
|
createSchedule.respond(res, 201, schedule);
|
|
40563
41010
|
} catch (error) {
|
|
@@ -40630,7 +41077,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40630
41077
|
const body = parsed.body;
|
|
40631
41078
|
if (parsed.body.key !== undefined) {
|
|
40632
41079
|
try {
|
|
40633
|
-
body.key = await authorizeAssetKeyWrite(parsed.body.key, await
|
|
41080
|
+
body.key = await authorizeAssetKeyWrite(parsed.body.key, await resolveHttpRequesterUserId(req, myAgentId));
|
|
40634
41081
|
} catch (error) {
|
|
40635
41082
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
40636
41083
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -40788,9 +41235,8 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
40788
41235
|
}
|
|
40789
41236
|
}
|
|
40790
41237
|
}
|
|
40791
|
-
|
|
40792
|
-
|
|
40793
|
-
body.updatedBy = updatedBy;
|
|
41238
|
+
body.updatedBy = await resolveHttpAuditUserId(req, myAgentId);
|
|
41239
|
+
body.updatedByAgentId = myAgentId ?? null;
|
|
40794
41240
|
let schedule;
|
|
40795
41241
|
try {
|
|
40796
41242
|
schedule = await updateScheduledTask2(parsed.params.id, body);
|
|
@@ -42697,7 +43143,7 @@ async function handleScriptConnections(req, res, pathSegments, queryParams, agen
|
|
|
42697
43143
|
label,
|
|
42698
43144
|
flow: "generic",
|
|
42699
43145
|
...parsed.body?.finalRedirect ? { finalRedirect: parsed.body.finalRedirect } : {},
|
|
42700
|
-
userId: await
|
|
43146
|
+
userId: await resolveHttpRequesterUserId(req, agentId)
|
|
42701
43147
|
});
|
|
42702
43148
|
authorizeUrlRoute2.respond(res, 200, {
|
|
42703
43149
|
authorizeUrl: result.url,
|
|
@@ -44191,6 +44637,7 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
44191
44637
|
if (!agent)
|
|
44192
44638
|
return true;
|
|
44193
44639
|
const runtimeInstanceId = ((h) => Array.isArray(h) ? h[0] : h)(req.headers["x-runtime-instance-id"]);
|
|
44640
|
+
const sourceTaskId = ((h) => Array.isArray(h) ? h[0] : h)(req.headers["x-source-task-id"]);
|
|
44194
44641
|
const secretRefusal = parsed.body.source ? refuseSourceWithSecrets(parsed.body.source) : null;
|
|
44195
44642
|
if (secretRefusal) {
|
|
44196
44643
|
json(res, secretRefusal, 400);
|
|
@@ -44231,6 +44678,7 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
44231
44678
|
executor,
|
|
44232
44679
|
agentId: agent.id,
|
|
44233
44680
|
runtimeInstanceId,
|
|
44681
|
+
sourceTaskId,
|
|
44234
44682
|
egressSecrets: credentials.egressSecrets,
|
|
44235
44683
|
failedBindings: credentials.failedBindings,
|
|
44236
44684
|
userConfig: credentials.userConfig,
|
|
@@ -44281,7 +44729,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
44281
44729
|
agentId: agent.id,
|
|
44282
44730
|
isScratch: true,
|
|
44283
44731
|
typeChecked: false,
|
|
44284
|
-
changeReason: "Auto-saved successful inline run"
|
|
44732
|
+
changeReason: "Auto-saved successful inline run",
|
|
44733
|
+
createdBy: await resolveHttpAuditUserId(req, agent.id)
|
|
44285
44734
|
});
|
|
44286
44735
|
autoSaved = { slug, reason: "successful_inline_run" };
|
|
44287
44736
|
}
|
|
@@ -44362,6 +44811,9 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
|
|
|
44362
44811
|
fsMode: script.fsMode,
|
|
44363
44812
|
executor: script.executor,
|
|
44364
44813
|
createdByAgentId: script.createdByAgentId,
|
|
44814
|
+
updatedByAgentId: script.updatedByAgentId,
|
|
44815
|
+
createdBy: script.createdBy,
|
|
44816
|
+
updatedBy: script.updatedBy,
|
|
44365
44817
|
createdAt: script.createdAt,
|
|
44366
44818
|
updatedAt: script.updatedAt
|
|
44367
44819
|
}));
|
|
@@ -45177,6 +45629,7 @@ var SessionTreeResponseSchema = object2({
|
|
|
45177
45629
|
labels: record2(string2(), string2()).optional(),
|
|
45178
45630
|
groups: array2(SessionTreeGroupSchema),
|
|
45179
45631
|
inbox: SessionSectionCountsSchema,
|
|
45632
|
+
working: SessionSectionCountsSchema.describe("Inbox sessions with a task running and nothing for the person to answer. They list under Working, not Inbox."),
|
|
45180
45633
|
later: SessionSectionCountsSchema,
|
|
45181
45634
|
done: SessionSectionCountsSchema,
|
|
45182
45635
|
noGroup: SessionSectionCountsSchema,
|
|
@@ -45466,8 +45919,9 @@ var listSessions = route({
|
|
|
45466
45919
|
contextKeyPrefix: string2().min(1).optional(),
|
|
45467
45920
|
keyPrefix: SessionKeyFilterSchema.optional(),
|
|
45468
45921
|
groupKey: SessionKeyFilterSchema.optional(),
|
|
45922
|
+
ids: string2().optional(),
|
|
45469
45923
|
noGroup: _enum2(["true", "false"]).transform((v) => v === "true").optional(),
|
|
45470
|
-
triage: _enum2(["inbox", "later", "done", "unread"]).optional(),
|
|
45924
|
+
triage: _enum2(["inbox", "working", "later", "done", "unread"]).optional(),
|
|
45471
45925
|
status: _enum2(["running", "failed", "needs"]).optional(),
|
|
45472
45926
|
withUserId: string2().min(1).optional(),
|
|
45473
45927
|
fields: _enum2(["full", "slim"]).optional(),
|
|
@@ -45512,19 +45966,21 @@ var triageSessionListRoute = route({
|
|
|
45512
45966
|
path: "/api/session-triage",
|
|
45513
45967
|
pattern: ["api", "session-triage"],
|
|
45514
45968
|
summary: "Triage every session of one sidebar list",
|
|
45515
|
-
description: "The bulk bar's 'Select all N': Done, back to the Inbox, read, or unread for every session that one sessions v2 list shows the caller (the `GET /api/sessions?scope=tree` filters)
|
|
45969
|
+
description: "The bulk bar's 'Select all N': Done, back to the Inbox, read, or unread for every session that one sessions v2 list shows the caller (the `GET /api/sessions?scope=tree` filters), minus `exceptIds`. Needs a picked user.",
|
|
45516
45970
|
tags: ["Sessions"],
|
|
45517
45971
|
body: object2({
|
|
45518
45972
|
action: _enum2(["done", "inbox", "read", "unread"]),
|
|
45519
|
-
triage: _enum2(["inbox", "later", "done"]).optional(),
|
|
45973
|
+
triage: _enum2(["inbox", "working", "later", "done"]).optional(),
|
|
45520
45974
|
noGroup: boolean().optional(),
|
|
45521
45975
|
groupKey: SessionKeyFilterSchema.optional(),
|
|
45976
|
+
keyPrefix: SessionKeyFilterSchema.refine((key) => sourceOfKey(key) !== null, {
|
|
45977
|
+
message: "keyPrefix must be a source group"
|
|
45978
|
+
}).optional(),
|
|
45522
45979
|
show: SessionShowSchema,
|
|
45523
45980
|
hideSource: array2(string2().min(1)).max(32).optional(),
|
|
45524
|
-
showSource: array2(string2().min(1)).max(32).optional()
|
|
45525
|
-
|
|
45526
|
-
|
|
45527
|
-
}),
|
|
45981
|
+
showSource: array2(string2().min(1)).max(32).optional(),
|
|
45982
|
+
exceptIds: array2(string2().min(1)).max(500).optional()
|
|
45983
|
+
}).refine((body) => [body.triage, body.noGroup, body.groupKey, body.keyPrefix].filter(Boolean).length === 1, { message: "Name exactly one list: triage, noGroup, groupKey, or keyPrefix" }),
|
|
45528
45984
|
responses: {
|
|
45529
45985
|
200: {
|
|
45530
45986
|
description: "The number of sessions written",
|
|
@@ -45586,7 +46042,7 @@ var moveSessionPrefix = route({
|
|
|
45586
46042
|
});
|
|
45587
46043
|
async function withSessionMove(req, res, myAgentId, destination, run) {
|
|
45588
46044
|
try {
|
|
45589
|
-
const changedBy = await
|
|
46045
|
+
const changedBy = await resolveHttpRequesterUserId(req, myAgentId);
|
|
45590
46046
|
const actor = await resolveSessionActor2(req, myAgentId);
|
|
45591
46047
|
const key = destination === null ? null : await authorizeAssetKeyWrite(destination, changedBy);
|
|
45592
46048
|
await assertAssetKeyMovesAllowed2();
|
|
@@ -45824,6 +46280,7 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
45824
46280
|
contextKeyPrefix: parsed.query.contextKeyPrefix,
|
|
45825
46281
|
keyPrefix: parsed.query.keyPrefix,
|
|
45826
46282
|
groupKey: parsed.query.groupKey,
|
|
46283
|
+
rootIds: parsed.query.ids?.split(",").map((id) => id.trim()).filter(Boolean).slice(0, 200),
|
|
45827
46284
|
noGroup: parsed.query.noGroup,
|
|
45828
46285
|
triage: parsed.query.triage,
|
|
45829
46286
|
status: parsed.query.status,
|
|
@@ -45884,8 +46341,8 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
45884
46341
|
jsonError(res, "Pick a user to triage sessions", 400);
|
|
45885
46342
|
return true;
|
|
45886
46343
|
}
|
|
45887
|
-
const { action, show, ...list } = parsed.body;
|
|
45888
|
-
const updated = await triageSessionList(actor.userId, { ...list, mine: show !== "all" }, action, actor.readAll);
|
|
46344
|
+
const { action, show, exceptIds, ...list } = parsed.body;
|
|
46345
|
+
const updated = await triageSessionList(actor.userId, { ...list, exceptRootIds: exceptIds, mine: show !== "all" }, action, actor.readAll);
|
|
45889
46346
|
triageSessionListRoute.respond(res, 200, { updated });
|
|
45890
46347
|
return true;
|
|
45891
46348
|
}
|
|
@@ -46103,6 +46560,7 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46103
46560
|
|
|
46104
46561
|
// src/http/skills.ts
|
|
46105
46562
|
init_zod();
|
|
46563
|
+
init_audit_user();
|
|
46106
46564
|
init_db4();
|
|
46107
46565
|
init_skill_parser();
|
|
46108
46566
|
|
|
@@ -46922,7 +47380,9 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46922
47380
|
sourceRepo: parsed.body.sourceRepo,
|
|
46923
47381
|
sourcePath: parsed.body.sourcePath,
|
|
46924
47382
|
sourceBranch: branch,
|
|
46925
|
-
isComplex: parsed.body.isComplex ?? false
|
|
47383
|
+
isComplex: parsed.body.isComplex ?? false,
|
|
47384
|
+
createdByAgentId: myAgentId ?? null,
|
|
47385
|
+
createdBy: await resolveHttpAuditUserId(req, myAgentId)
|
|
46926
47386
|
});
|
|
46927
47387
|
installRemoteRoute.respond(res, 201, { skill });
|
|
46928
47388
|
} catch (err) {
|
|
@@ -46940,6 +47400,7 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46940
47400
|
})() : await listSkills2({ type: "remote" });
|
|
46941
47401
|
let updated = 0;
|
|
46942
47402
|
const errors = [];
|
|
47403
|
+
const actor = await resolveHttpAuditActor(req, myAgentId);
|
|
46943
47404
|
for (const skill of remoteSkills) {
|
|
46944
47405
|
if (skill.isComplex || !skill.sourceRepo)
|
|
46945
47406
|
continue;
|
|
@@ -46968,7 +47429,9 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
46968
47429
|
disableModelInvocation: pm.disableModelInvocation,
|
|
46969
47430
|
userInvocable: pm.userInvocable,
|
|
46970
47431
|
sourceHash: newHash,
|
|
46971
|
-
lastFetchedAt: now
|
|
47432
|
+
lastFetchedAt: now,
|
|
47433
|
+
updatedBy: actor.userId,
|
|
47434
|
+
updatedByAgentId: actor.agentId
|
|
46972
47435
|
});
|
|
46973
47436
|
updated++;
|
|
46974
47437
|
} else {
|
|
@@ -47085,6 +47548,7 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
47085
47548
|
}
|
|
47086
47549
|
try {
|
|
47087
47550
|
const files = await upsertSkillFiles2(parsed.params.id, parsed.body.files);
|
|
47551
|
+
await setSkillUpdatedBy2(parsed.params.id, await resolveHttpAuditActor(req, myAgentId));
|
|
47088
47552
|
const updatedSkill = await getSkillById2(parsed.params.id);
|
|
47089
47553
|
bulkUpsertSkillFilesRoute.respond(res, 200, {
|
|
47090
47554
|
files,
|
|
@@ -47135,6 +47599,7 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
47135
47599
|
path: decodeSkillFilePath(pathSegments),
|
|
47136
47600
|
...parsed.body
|
|
47137
47601
|
});
|
|
47602
|
+
await setSkillUpdatedBy2(parsed.params.id, await resolveHttpAuditActor(req, myAgentId));
|
|
47138
47603
|
const updatedSkill = await getSkillById2(parsed.params.id);
|
|
47139
47604
|
upsertSkillFileRoute.respond(res, 200, { file, skill: updatedSkill });
|
|
47140
47605
|
} catch (err) {
|
|
@@ -47161,6 +47626,7 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
47161
47626
|
jsonError(res, "Skill file not found", 404);
|
|
47162
47627
|
return true;
|
|
47163
47628
|
}
|
|
47629
|
+
await setSkillUpdatedBy2(parsed.params.id, await resolveHttpAuditActor(req, myAgentId));
|
|
47164
47630
|
const updatedSkill = await getSkillById2(parsed.params.id);
|
|
47165
47631
|
deleteSkillFileRoute.respond(res, 200, { success: true, skill: updatedSkill });
|
|
47166
47632
|
} catch (err) {
|
|
@@ -47200,7 +47666,9 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
47200
47666
|
agent: pm.agent,
|
|
47201
47667
|
disableModelInvocation: pm.disableModelInvocation,
|
|
47202
47668
|
userInvocable: pm.userInvocable,
|
|
47203
|
-
systemDefault: parsed.body.systemDefault
|
|
47669
|
+
systemDefault: parsed.body.systemDefault,
|
|
47670
|
+
createdByAgentId: myAgentId ?? null,
|
|
47671
|
+
createdBy: await resolveHttpAuditUserId(req, myAgentId)
|
|
47204
47672
|
});
|
|
47205
47673
|
createSkillRoute.respond(res, 201, { skill });
|
|
47206
47674
|
} catch (err) {
|
|
@@ -47259,6 +47727,9 @@ async function handleSkills(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
47259
47727
|
updates.disableModelInvocation = pm.disableModelInvocation;
|
|
47260
47728
|
updates.userInvocable = pm.userInvocable;
|
|
47261
47729
|
}
|
|
47730
|
+
const actor = await resolveHttpAuditActor(req, myAgentId);
|
|
47731
|
+
updates.updatedBy = actor.userId;
|
|
47732
|
+
updates.updatedByAgentId = actor.agentId;
|
|
47262
47733
|
const skill = await updateSkill2(parsed.params.id, updates);
|
|
47263
47734
|
if (!skill) {
|
|
47264
47735
|
jsonError(res, "Skill not found", 404);
|
|
@@ -47959,11 +48430,27 @@ var toolHookRoute = route({
|
|
|
47959
48430
|
400: { description: "Invalid body or missing X-Agent-ID header" }
|
|
47960
48431
|
}
|
|
47961
48432
|
});
|
|
48433
|
+
var toolHookStatusRoute = route({
|
|
48434
|
+
method: "get",
|
|
48435
|
+
path: "/api/tool-hooks/status",
|
|
48436
|
+
pattern: ["api", "tool-hooks", "status"],
|
|
48437
|
+
summary: "Whether any enabled extension takes harness-native tool calls",
|
|
48438
|
+
description: "Worker shims read this before each native tool call and skip `POST /api/tool-hooks` while " + "`native` is false, so a swarm with no native-tool extension pays no per-call round trip. " + "Shims cache the answer for a short time.",
|
|
48439
|
+
tags: ["Extensions"],
|
|
48440
|
+
auth: { apiKey: true },
|
|
48441
|
+
responses: {
|
|
48442
|
+
200: { description: "Native tool hook status", schema: object2({ native: boolean() }) }
|
|
48443
|
+
}
|
|
48444
|
+
});
|
|
47962
48445
|
function header4(req, name) {
|
|
47963
48446
|
const raw = req.headers[name];
|
|
47964
48447
|
return Array.isArray(raw) ? raw[0] : raw;
|
|
47965
48448
|
}
|
|
47966
48449
|
async function handleToolHooks(req, res, pathSegments, queryParams, myAgentId) {
|
|
48450
|
+
if (toolHookStatusRoute.match(req.method, pathSegments)) {
|
|
48451
|
+
toolHookStatusRoute.respond(res, 200, { native: hasNativeToolHandlers2() });
|
|
48452
|
+
return true;
|
|
48453
|
+
}
|
|
47967
48454
|
if (!toolHookRoute.match(req.method, pathSegments))
|
|
47968
48455
|
return false;
|
|
47969
48456
|
if (!myAgentId) {
|
|
@@ -47974,11 +48461,13 @@ async function handleToolHooks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
47974
48461
|
if (!parsed)
|
|
47975
48462
|
return true;
|
|
47976
48463
|
const body = scrubObject(parsed.body);
|
|
48464
|
+
const sourceTaskId = header4(req, "x-source-task-id");
|
|
47977
48465
|
const requestInfo = {
|
|
47978
48466
|
sessionId: undefined,
|
|
47979
48467
|
agentId: myAgentId,
|
|
47980
48468
|
runtimeInstanceId: header4(req, "x-runtime-instance-id"),
|
|
47981
|
-
sourceTaskId
|
|
48469
|
+
sourceTaskId,
|
|
48470
|
+
auditSourceTaskId: sourceTaskId ?? header4(req, "x-audit-source-task-id"),
|
|
47982
48471
|
contextKey: header4(req, "x-context-key"),
|
|
47983
48472
|
callOrigin: "native",
|
|
47984
48473
|
harness: body.harness
|
|
@@ -48043,7 +48532,7 @@ async function ensureTrackerAuthorizeAdmin(req, res, providerName) {
|
|
|
48043
48532
|
const allowed = await ensureHttpPermission(req, res, "oauth-authorization.manage", `Only the lead can start the ${providerName} OAuth flow.`, agentId);
|
|
48044
48533
|
if (!allowed)
|
|
48045
48534
|
return null;
|
|
48046
|
-
return { userId: await
|
|
48535
|
+
return { userId: await resolveHttpRequesterUserId(req, agentId) };
|
|
48047
48536
|
}
|
|
48048
48537
|
|
|
48049
48538
|
// src/http/trackers/jira.ts
|
|
@@ -48906,6 +49395,7 @@ async function handleUserRoles(req, res, pathSegments, queryParams) {
|
|
|
48906
49395
|
init_zod();
|
|
48907
49396
|
init_db4();
|
|
48908
49397
|
init_rbac_roles();
|
|
49398
|
+
init_unmapped_identities();
|
|
48909
49399
|
init_users();
|
|
48910
49400
|
init_rbac();
|
|
48911
49401
|
init_types5();
|
|
@@ -48974,7 +49464,12 @@ var UnmappedIdentitySchema = object2({
|
|
|
48974
49464
|
lastSeenAt: string2().nullable(),
|
|
48975
49465
|
count: number2(),
|
|
48976
49466
|
sampleEventType: string2().nullable(),
|
|
48977
|
-
sampleContext: unknown().nullable()
|
|
49467
|
+
sampleContext: unknown().nullable(),
|
|
49468
|
+
dismissedAt: string2().optional(),
|
|
49469
|
+
dismissedBy: string2().optional()
|
|
49470
|
+
});
|
|
49471
|
+
var UnmappedIdentityRefsSchema = object2({
|
|
49472
|
+
identities: array2(object2({ kind: string2().min(1), externalId: string2().min(1) })).min(1).max(500)
|
|
48978
49473
|
});
|
|
48979
49474
|
var whoamiRoute = route({
|
|
48980
49475
|
method: "get",
|
|
@@ -49056,7 +49551,9 @@ var listUnmapped = route({
|
|
|
49056
49551
|
tags: ["Users"],
|
|
49057
49552
|
query: object2({
|
|
49058
49553
|
kind: string2().optional(),
|
|
49059
|
-
limit: exports_coerce.number().int().min(1).max(1000).optional()
|
|
49554
|
+
limit: exports_coerce.number().int().min(1).max(1000).optional(),
|
|
49555
|
+
dismissed: _enum2(["true", "false"]).optional(),
|
|
49556
|
+
includeBots: _enum2(["true", "false"]).optional()
|
|
49060
49557
|
}),
|
|
49061
49558
|
responses: {
|
|
49062
49559
|
200: {
|
|
@@ -49096,6 +49593,45 @@ var resolveUnmapped = route({
|
|
|
49096
49593
|
},
|
|
49097
49594
|
auth: { apiKey: true }
|
|
49098
49595
|
});
|
|
49596
|
+
var DISMISS_RBAC = {
|
|
49597
|
+
ungated: "same posture as POST /api/users/unmapped/{kind}/{externalId}/resolve: bearer auth, guests rejected; it links and trusts nothing"
|
|
49598
|
+
};
|
|
49599
|
+
var dismissUnmapped = route({
|
|
49600
|
+
method: "post",
|
|
49601
|
+
path: "/api/users/unmapped/dismiss",
|
|
49602
|
+
pattern: ["api", "users", "unmapped", "dismiss"],
|
|
49603
|
+
summary: "Dismiss unmapped identities: hide them from triage and stop recording them. Links nothing.",
|
|
49604
|
+
tags: ["Users"],
|
|
49605
|
+
body: UnmappedIdentityRefsSchema,
|
|
49606
|
+
responses: {
|
|
49607
|
+
200: {
|
|
49608
|
+
description: "Identities moved to the ignore list",
|
|
49609
|
+
schema: object2({ dismissed: number2() })
|
|
49610
|
+
},
|
|
49611
|
+
400: { description: "Validation error" },
|
|
49612
|
+
401: { description: "Unauthorized" }
|
|
49613
|
+
},
|
|
49614
|
+
auth: { apiKey: true },
|
|
49615
|
+
rbac: DISMISS_RBAC
|
|
49616
|
+
});
|
|
49617
|
+
var restoreUnmapped = route({
|
|
49618
|
+
method: "post",
|
|
49619
|
+
path: "/api/users/unmapped/restore",
|
|
49620
|
+
pattern: ["api", "users", "unmapped", "restore"],
|
|
49621
|
+
summary: "Undo a dismissal: return identities to the triage queue",
|
|
49622
|
+
tags: ["Users"],
|
|
49623
|
+
body: UnmappedIdentityRefsSchema,
|
|
49624
|
+
responses: {
|
|
49625
|
+
200: {
|
|
49626
|
+
description: "Count of identities taken off the ignore list",
|
|
49627
|
+
schema: object2({ restored: number2() })
|
|
49628
|
+
},
|
|
49629
|
+
400: { description: "Validation error" },
|
|
49630
|
+
401: { description: "Unauthorized" }
|
|
49631
|
+
},
|
|
49632
|
+
auth: { apiKey: true },
|
|
49633
|
+
rbac: DISMISS_RBAC
|
|
49634
|
+
});
|
|
49099
49635
|
var getUserRoute = route({
|
|
49100
49636
|
method: "get",
|
|
49101
49637
|
path: "/api/users/{id}",
|
|
@@ -49538,6 +50074,30 @@ async function collectUnmappedForKind(kind, limit) {
|
|
|
49538
50074
|
}
|
|
49539
50075
|
return Array.from(byId.values());
|
|
49540
50076
|
}
|
|
50077
|
+
async function collectDismissedForKind(kind, limit) {
|
|
50078
|
+
const rows = await listKv2(dismissedNamespace(kind), { limit, offset: 0 });
|
|
50079
|
+
return rows.map((row) => {
|
|
50080
|
+
const saved = row.value ?? {};
|
|
50081
|
+
const meta = saved.meta ?? {};
|
|
50082
|
+
return {
|
|
50083
|
+
kind,
|
|
50084
|
+
externalId: row.key,
|
|
50085
|
+
lastSeenAt: typeof meta.lastSeenAt === "string" ? meta.lastSeenAt : null,
|
|
50086
|
+
count: Number(saved.count ?? 0),
|
|
50087
|
+
sampleEventType: typeof meta.sampleEventType === "string" ? meta.sampleEventType : null,
|
|
50088
|
+
sampleContext: meta.sampleContext ?? null,
|
|
50089
|
+
dismissedAt: saved.dismissedAt,
|
|
50090
|
+
dismissedBy: saved.dismissedBy
|
|
50091
|
+
};
|
|
50092
|
+
});
|
|
50093
|
+
}
|
|
50094
|
+
function uniqueIdentities(identities) {
|
|
50095
|
+
const seen = new Map;
|
|
50096
|
+
for (const identity of identities) {
|
|
50097
|
+
seen.set(`${identity.kind}\x00${identity.externalId}`, identity);
|
|
50098
|
+
}
|
|
50099
|
+
return [...seen.values()];
|
|
50100
|
+
}
|
|
49541
50101
|
var DEFAULT_CONNECTOR_CONNECT_URL = "https://mcp.agent-swarm.dev/connections";
|
|
49542
50102
|
function getConnectorConnectUrl() {
|
|
49543
50103
|
const raw = process.env.CONNECTOR_CONNECT_URL?.trim() || DEFAULT_CONNECTOR_CONNECT_URL;
|
|
@@ -49662,7 +50222,10 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
49662
50222
|
return true;
|
|
49663
50223
|
const limit = parsed.query.limit ?? 100;
|
|
49664
50224
|
const kinds = parsed.query.kind ? [parsed.query.kind] : UNMAPPED_KINDS;
|
|
49665
|
-
const
|
|
50225
|
+
const collect = parsed.query.dismissed === "true" ? collectDismissedForKind : collectUnmappedForKind;
|
|
50226
|
+
const includeBots = parsed.query.includeBots === "true";
|
|
50227
|
+
const dismissedKeys = parsed.query.dismissed === "true" ? new Set : new Set((await Promise.all(kinds.map((k) => collectDismissedForKind(k, 1000)))).flat().map((row) => `${row.kind}\x00${row.externalId}`));
|
|
50228
|
+
const rows = (await Promise.all(kinds.map((k) => collect(k, limit)))).flat().filter((row) => includeBots || !row.externalId.endsWith("[bot]")).filter((row) => !dismissedKeys.has(`${row.kind}\x00${row.externalId}`));
|
|
49666
50229
|
rows.sort((a, b) => {
|
|
49667
50230
|
if (b.count !== a.count)
|
|
49668
50231
|
return b.count - a.count;
|
|
@@ -49673,6 +50236,34 @@ async function handleUsers(req, res, pathSegments, queryParams) {
|
|
|
49673
50236
|
listUnmapped.respond(res, 200, { unmapped: rows.slice(0, limit) });
|
|
49674
50237
|
return true;
|
|
49675
50238
|
}
|
|
50239
|
+
if (dismissUnmapped.match(req.method, pathSegments)) {
|
|
50240
|
+
const parsed = await dismissUnmapped.parse(req, res, pathSegments, queryParams);
|
|
50241
|
+
if (!parsed)
|
|
50242
|
+
return true;
|
|
50243
|
+
const actor = getOperatorActor(req, res);
|
|
50244
|
+
if (!actor)
|
|
50245
|
+
return true;
|
|
50246
|
+
const identities = uniqueIdentities(parsed.body.identities);
|
|
50247
|
+
for (const { kind, externalId } of identities) {
|
|
50248
|
+
await dismissUnmappedIdentity(kind, externalId, `${actor.kind}:${actor.id}`);
|
|
50249
|
+
}
|
|
50250
|
+
dismissUnmapped.respond(res, 200, { dismissed: identities.length });
|
|
50251
|
+
return true;
|
|
50252
|
+
}
|
|
50253
|
+
if (restoreUnmapped.match(req.method, pathSegments)) {
|
|
50254
|
+
const parsed = await restoreUnmapped.parse(req, res, pathSegments, queryParams);
|
|
50255
|
+
if (!parsed)
|
|
50256
|
+
return true;
|
|
50257
|
+
if (!getOperatorActor(req, res))
|
|
50258
|
+
return true;
|
|
50259
|
+
let restored = 0;
|
|
50260
|
+
for (const { kind, externalId } of uniqueIdentities(parsed.body.identities)) {
|
|
50261
|
+
if (await restoreUnmappedIdentity(kind, externalId))
|
|
50262
|
+
restored++;
|
|
50263
|
+
}
|
|
50264
|
+
restoreUnmapped.respond(res, 200, { restored });
|
|
50265
|
+
return true;
|
|
50266
|
+
}
|
|
49676
50267
|
if (resolveUnmapped.match(req.method, pathSegments)) {
|
|
49677
50268
|
const parsed = await resolveUnmapped.parse(req, res, pathSegments, queryParams);
|
|
49678
50269
|
if (!parsed)
|
|
@@ -51342,6 +51933,7 @@ async function handleWebhooks(req, res, pathSegments) {
|
|
|
51342
51933
|
// src/http/workflow-events.ts
|
|
51343
51934
|
init_zod();
|
|
51344
51935
|
init_db4();
|
|
51936
|
+
init_event_waits();
|
|
51345
51937
|
init_event_bus();
|
|
51346
51938
|
init_route_def();
|
|
51347
51939
|
init_utils2();
|
|
@@ -51367,6 +51959,7 @@ var runScopedSignalRoute = route({
|
|
|
51367
51959
|
})
|
|
51368
51960
|
},
|
|
51369
51961
|
404: { description: "Workflow run not found" },
|
|
51962
|
+
403: { description: "Event name is reserved for provider webhooks" },
|
|
51370
51963
|
400: { description: "Validation error" }
|
|
51371
51964
|
},
|
|
51372
51965
|
auth: { apiKey: true }
|
|
@@ -51390,15 +51983,21 @@ var globalSignalRoute = route({
|
|
|
51390
51983
|
name: string2()
|
|
51391
51984
|
})
|
|
51392
51985
|
},
|
|
51986
|
+
403: { description: "Event name is reserved for provider webhooks" },
|
|
51393
51987
|
400: { description: "Validation error" }
|
|
51394
51988
|
},
|
|
51395
51989
|
auth: { apiKey: true }
|
|
51396
51990
|
});
|
|
51991
|
+
var RESERVED_EVENT_MESSAGE = "Event name is reserved for provider webhooks";
|
|
51397
51992
|
async function handleWorkflowEvents(req, res, pathSegments, queryParams) {
|
|
51398
51993
|
if (runScopedSignalRoute.match(req.method, pathSegments)) {
|
|
51399
51994
|
const parsed = await runScopedSignalRoute.parse(req, res, pathSegments, queryParams);
|
|
51400
51995
|
if (!parsed)
|
|
51401
51996
|
return true;
|
|
51997
|
+
if (isReservedProviderEvent(parsed.body.name)) {
|
|
51998
|
+
jsonError(res, RESERVED_EVENT_MESSAGE, 403);
|
|
51999
|
+
return true;
|
|
52000
|
+
}
|
|
51402
52001
|
const run = await getWorkflowRun2(parsed.params.runId);
|
|
51403
52002
|
if (!run) {
|
|
51404
52003
|
jsonError(res, "Workflow run not found", 404);
|
|
@@ -51417,6 +52016,10 @@ async function handleWorkflowEvents(req, res, pathSegments, queryParams) {
|
|
|
51417
52016
|
const parsed = await globalSignalRoute.parse(req, res, pathSegments, queryParams);
|
|
51418
52017
|
if (!parsed)
|
|
51419
52018
|
return true;
|
|
52019
|
+
if (isReservedProviderEvent(parsed.body.name)) {
|
|
52020
|
+
jsonError(res, RESERVED_EVENT_MESSAGE, 403);
|
|
52021
|
+
return true;
|
|
52022
|
+
}
|
|
51420
52023
|
workflowEventBus2.emit(parsed.body.name, parsed.body.payload ?? {});
|
|
51421
52024
|
globalSignalRoute.respond(res, 200, { ok: true, name: parsed.body.name });
|
|
51422
52025
|
return true;
|
|
@@ -51994,12 +52597,12 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
51994
52597
|
jsonError(res, `Invalid definition: ${modelErrors.join("; ")}`, 400);
|
|
51995
52598
|
return true;
|
|
51996
52599
|
}
|
|
51997
|
-
const refKeys = serverRefInputKeys(parsed.body.input);
|
|
52600
|
+
const refKeys = serverRefInputKeys(parsed.body.input, parsed.body.params);
|
|
51998
52601
|
if (refKeys.length > 0 && await requestSecretReadScope(req) !== "all") {
|
|
51999
52602
|
jsonError(res, serverRefInputDeniedMessage(refKeys), 403);
|
|
52000
52603
|
return true;
|
|
52001
52604
|
}
|
|
52002
|
-
const trustedUserId = await
|
|
52605
|
+
const trustedUserId = await resolveHttpRequesterUserId(req, myAgentId);
|
|
52003
52606
|
let key;
|
|
52004
52607
|
try {
|
|
52005
52608
|
key = parsed.body.key ? await authorizeAssetKeyWrite(parsed.body.key, trustedUserId) : undefined;
|
|
@@ -52119,7 +52722,7 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
52119
52722
|
const updateArgs = {};
|
|
52120
52723
|
if (parsed.body.key !== undefined) {
|
|
52121
52724
|
try {
|
|
52122
|
-
updateArgs.key = await authorizeAssetKeyWrite(parsed.body.key,
|
|
52725
|
+
updateArgs.key = await authorizeAssetKeyWrite(parsed.body.key, await resolveHttpRequesterUserId(req, myAgentId));
|
|
52123
52726
|
} catch (error) {
|
|
52124
52727
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
52125
52728
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -52198,7 +52801,7 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
52198
52801
|
return true;
|
|
52199
52802
|
}
|
|
52200
52803
|
}
|
|
52201
|
-
const refKeys = serverRefInputKeys(body.input !== undefined ? body.input : body.
|
|
52804
|
+
const refKeys = body.input !== undefined || body.params !== undefined || body.definition ? serverRefInputKeys(body.input !== undefined ? body.input : existing.input, body.params !== undefined ? body.params : existing.params) : [];
|
|
52202
52805
|
if (refKeys.length > 0 && await requestSecretReadScope(req) !== "all") {
|
|
52203
52806
|
jsonError(res, serverRefInputDeniedMessage(refKeys), 403);
|
|
52204
52807
|
return true;
|
|
@@ -52207,7 +52810,7 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
52207
52810
|
let key;
|
|
52208
52811
|
if (body.key !== undefined) {
|
|
52209
52812
|
try {
|
|
52210
|
-
key = await authorizeAssetKeyWrite(body.key,
|
|
52813
|
+
key = await authorizeAssetKeyWrite(body.key, await resolveHttpRequesterUserId(req, myAgentId));
|
|
52211
52814
|
} catch (error) {
|
|
52212
52815
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
52213
52816
|
jsonError(res, error.message, error.statusCode);
|
|
@@ -52317,7 +52920,7 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
52317
52920
|
runId = await startWorkflowExecution2(workflow, body, getExecutorRegistry2(), {
|
|
52318
52921
|
triggerType: "api",
|
|
52319
52922
|
triggeredByAgentId: myAgentId,
|
|
52320
|
-
requestedByUserId: await
|
|
52923
|
+
requestedByUserId: await resolveHttpRequesterUserId(req, myAgentId) ?? undefined,
|
|
52321
52924
|
detach: parsed.query.wait === "false",
|
|
52322
52925
|
accept: claim ? async (run) => {
|
|
52323
52926
|
const response = { runId: run.runId, skipped: run.skipped };
|
|
@@ -52761,6 +53364,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
52761
53364
|
() => handleTrackers(req, res, pathSegments),
|
|
52762
53365
|
() => handleWebhooks(req, res, pathSegments),
|
|
52763
53366
|
() => handleObjectWebhooks(req, res, pathSegments),
|
|
53367
|
+
() => handleObjects(req, res, pathSegments, queryParams, myAgentId),
|
|
52764
53368
|
() => handleAgentLifecycle(req, res, pathSegments, queryParams, myAgentId),
|
|
52765
53369
|
() => handleAgentsRest(req, res, pathSegments, queryParams, myAgentId),
|
|
52766
53370
|
() => handleBudgets(req, res, pathSegments, queryParams, myAgentId),
|
|
@@ -52862,7 +53466,7 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
52862
53466
|
});
|
|
52863
53467
|
});
|
|
52864
53468
|
var detachRealtime = attachRealtimeTransport(httpServer);
|
|
52865
|
-
var { attachControllerTransport } = await import("./controllers-connect-
|
|
53469
|
+
var { attachControllerTransport } = await import("./controllers-connect-0gg13mzp.js");
|
|
52866
53470
|
var detachControllers = attachControllerTransport(httpServer);
|
|
52867
53471
|
var stopWorkerNudges = startWorkerNudgeListener();
|
|
52868
53472
|
var taskAutoTitles = startTaskAutoTitleListener();
|
|
@@ -52893,7 +53497,7 @@ async function shutdown() {
|
|
|
52893
53497
|
sessionsProcessed: getServerSessionsProcessed()
|
|
52894
53498
|
});
|
|
52895
53499
|
if (hasCapability("scheduling")) {
|
|
52896
|
-
const { stopScheduler } = await import("./index-
|
|
53500
|
+
const { stopScheduler } = await import("./index-dz4q23ag.js");
|
|
52897
53501
|
stopScheduler();
|
|
52898
53502
|
}
|
|
52899
53503
|
stopHeartbeat2();
|
|
@@ -52905,7 +53509,7 @@ async function shutdown() {
|
|
|
52905
53509
|
await stopSlackApp2();
|
|
52906
53510
|
await stopChatSdk();
|
|
52907
53511
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
52908
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
53512
|
+
const { stopOAuthKeepalive } = await import("./keepalive-d6z12s04.js");
|
|
52909
53513
|
await stopOAuthKeepalive();
|
|
52910
53514
|
}
|
|
52911
53515
|
stopOAuthPendingGc();
|
|
@@ -52995,21 +53599,21 @@ try {
|
|
|
52995
53599
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
52996
53600
|
}
|
|
52997
53601
|
try {
|
|
52998
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
53602
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-vb2dcrrb.js");
|
|
52999
53603
|
ensurePricingSeeded();
|
|
53000
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
53604
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-cf25x38j.js");
|
|
53001
53605
|
startPricingRefreshLoop();
|
|
53002
53606
|
} catch (err) {
|
|
53003
53607
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
53004
53608
|
}
|
|
53005
53609
|
try {
|
|
53006
|
-
const { ensureModelProfilesSeeded } = await import("./boot-seeds-
|
|
53610
|
+
const { ensureModelProfilesSeeded } = await import("./boot-seeds-vb2dcrrb.js");
|
|
53007
53611
|
await ensureModelProfilesSeeded();
|
|
53008
53612
|
} catch (err) {
|
|
53009
53613
|
console.error("[startup] Failed to seed model profiles:", err);
|
|
53010
53614
|
}
|
|
53011
53615
|
try {
|
|
53012
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
53616
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-vb2dcrrb.js");
|
|
53013
53617
|
ensureRbacSeeded();
|
|
53014
53618
|
} catch (err) {
|
|
53015
53619
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -53017,13 +53621,13 @@ try {
|
|
|
53017
53621
|
throw err;
|
|
53018
53622
|
}
|
|
53019
53623
|
try {
|
|
53020
|
-
const { runAllSeeders } = await import("./index-
|
|
53624
|
+
const { runAllSeeders } = await import("./index-w216g9y9.js");
|
|
53021
53625
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
53022
53626
|
} catch (err) {
|
|
53023
53627
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
53024
53628
|
}
|
|
53025
53629
|
try {
|
|
53026
|
-
const { runImports } = await import("./index-
|
|
53630
|
+
const { runImports } = await import("./index-52tgbhrw.js");
|
|
53027
53631
|
await runImports();
|
|
53028
53632
|
} catch (err) {
|
|
53029
53633
|
console.error("[startup] File import failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
@@ -53074,10 +53678,10 @@ httpServer.listen(port, async () => {
|
|
|
53074
53678
|
startChatSdk().catch((err) => {
|
|
53075
53679
|
console.error("[chat-sdk] Failed to start, continuing without Chat SDK:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
53076
53680
|
});
|
|
53077
|
-
import("./agent-fs-provision-
|
|
53681
|
+
import("./agent-fs-provision-jqshb33y.js").then(({ syncAgentFsOrgSwarmUrl }) => syncAgentFsOrgSwarmUrl(getConfiguredAppUrls()[0])).catch((err) => {
|
|
53078
53682
|
console.warn("[agent-fs] Failed to set the org swarm URL:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
53079
53683
|
});
|
|
53080
|
-
import("./object-webhooks-
|
|
53684
|
+
import("./object-webhooks-6rdagg0r.js").then(({ ensureObjectWebhooksForKnownDrives }) => ensureObjectWebhooksForKnownDrives()).catch((err) => {
|
|
53081
53685
|
console.warn("[objects] agent-fs webhook boot check failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
|
|
53082
53686
|
});
|
|
53083
53687
|
startQueueStallAlarm();
|
|
@@ -53093,25 +53697,25 @@ httpServer.listen(port, async () => {
|
|
|
53093
53697
|
await initWorkflows2();
|
|
53094
53698
|
await startScriptRunSupervisor(getMcpBaseUrl());
|
|
53095
53699
|
if (hasCapability("scheduling")) {
|
|
53096
|
-
const { startScheduler } = await import("./index-
|
|
53097
|
-
const { getExecutorRegistry } = await import("./index-
|
|
53700
|
+
const { startScheduler } = await import("./index-dz4q23ag.js");
|
|
53701
|
+
const { getExecutorRegistry } = await import("./index-0mcxjdsa.js");
|
|
53098
53702
|
const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
|
|
53099
53703
|
startScheduler(getExecutorRegistry(), intervalMs, {
|
|
53100
53704
|
runId: globalState.__runId
|
|
53101
53705
|
});
|
|
53102
53706
|
}
|
|
53103
53707
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
53104
|
-
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-
|
|
53708
|
+
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-s175jckx.js");
|
|
53105
53709
|
startHeartbeat(parseHeartbeatIntervalMs(process.env.HEARTBEAT_INTERVAL_MS));
|
|
53106
53710
|
}
|
|
53107
53711
|
startPoolRouting();
|
|
53108
53712
|
startRuntimeSupervisor();
|
|
53109
53713
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
53110
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
53714
|
+
const { startOAuthKeepalive } = await import("./keepalive-d6z12s04.js");
|
|
53111
53715
|
startOAuthKeepalive();
|
|
53112
53716
|
}
|
|
53113
53717
|
if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
|
|
53114
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
53718
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-t1xjetbh.js");
|
|
53115
53719
|
startOAuthRefreshSweep();
|
|
53116
53720
|
}
|
|
53117
53721
|
startOAuthPendingGc();
|
|
@@ -53121,22 +53725,22 @@ httpServer.listen(port, async () => {
|
|
|
53121
53725
|
startSavingsRollup(savingsRollupSql);
|
|
53122
53726
|
startHumanFreeDrain();
|
|
53123
53727
|
startTaskSearchBackfill();
|
|
53124
|
-
import("./embedding-space-
|
|
53728
|
+
import("./embedding-space-3n6mhhmy.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
|
|
53125
53729
|
setDeploymentEnvReader(getDeploymentEnvValue2);
|
|
53126
53730
|
return runEmbeddingMaintenance({ backfill: true });
|
|
53127
53731
|
}).catch((err) => {
|
|
53128
53732
|
console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
|
|
53129
53733
|
});
|
|
53130
|
-
import("./boot-args-schema-
|
|
53734
|
+
import("./boot-args-schema-xzfp2feg.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
|
|
53131
53735
|
console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
|
|
53132
53736
|
});
|
|
53133
|
-
import("./boot-scrub-sweep-
|
|
53737
|
+
import("./boot-scrub-sweep-scrqhw48.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
53134
53738
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
53135
53739
|
});
|
|
53136
|
-
import("./user-merge-jobs-
|
|
53740
|
+
import("./user-merge-jobs-kcmwvrc6.js").then(({ resumeUserMergeJobs }) => resumeUserMergeJobs()).catch((err) => {
|
|
53137
53741
|
console.error("[user-merge] startup resume failed (non-fatal):", err);
|
|
53138
53742
|
});
|
|
53139
|
-
import("./session-source-backfill-
|
|
53743
|
+
import("./session-source-backfill-3w2st4m2.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
|
|
53140
53744
|
console.error("[session-source-backfill] startup run failed (non-fatal):", err);
|
|
53141
53745
|
});
|
|
53142
53746
|
}).on("error", (err) => {
|