@desplega.ai/agent-swarm 2.12.0 → 2.13.1
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-xtj40wd8.js +17 -0
- package/dist/{acp-targets-311gcyvw.js → acp-targets-n7vm5atw.js} +10 -9
- package/dist/{actions-c4chgxp6.js → actions-hq6wp9xv.js} +28 -27
- package/dist/{agent-fs-provision-0b9awm5n.js → agent-fs-provision-y0qc1rdd.js} +4 -4
- package/dist/{amp-adapter-r0veq6x5.js → amp-adapter-1qqs6h91.js} +3 -3
- package/dist/{app-hn5fftf5.js → app-7m4z44rv.js} +10 -8
- package/dist/{approval-notifications-3g6yc8nv.js → approval-notifications-8sr41gjx.js} +11 -10
- package/dist/{assistant-cpjgpjvp.js → assistant-hkczwfv6.js} +29 -28
- package/dist/{boot-args-schema-hce1av1h.js → boot-args-schema-8025snev.js} +1 -1
- package/dist/{boot-reembed-bztbxc4z.js → boot-reembed-15m87nr1.js} +5 -2
- package/dist/{boot-reembed-d7xcym0j.js → boot-reembed-4bbpxjh1.js} +1 -1
- package/dist/{boot-scrub-sweep-mkmm16gk.js → boot-scrub-sweep-eajr97e9.js} +2 -2
- package/dist/{boot-seeds-arrkbe8t.js → boot-seeds-9cwy39jx.js} +4 -4
- package/dist/{boxd-68n75y1s.js → boxd-hr8rsxzq.js} +1 -1
- package/dist/{claude-adapter-ykpyr5p8.js → claude-adapter-g61wa4rt.js} +9 -8
- package/dist/{claude-managed-adapter-ssg6z4bt.js → claude-managed-adapter-znkk0prm.js} +4 -4
- package/dist/{claude-managed-setup-trd59v7b.js → claude-managed-setup-f1wndkr2.js} +7 -7
- package/dist/{claude-sdk-session-yjcze0j1.js → claude-sdk-session-687xzf21.js} +20763 -19380
- package/dist/{cli-ya3kf4gs.js → cli-04103ryh.js} +1 -1
- package/dist/{cli-55tc8cj4.js → cli-0a336ze7.js} +5 -5
- package/dist/{cli-q8tc22bj.js → cli-0fx95c06.js} +5 -5
- package/dist/{cli-mq2fbgva.js → cli-0m77n7ej.js} +3 -3
- package/dist/{cli-7yn42w6m.js → cli-0xwb7zpt.js} +2 -2
- package/dist/{cli-mcymtvwn.js → cli-13t0smbk.js} +1000 -28
- package/dist/{cli-c7j31hq9.js → cli-1b5axkt1.js} +4 -4
- package/dist/{cli-yegz2g06.js → cli-1carhg8g.js} +4 -4
- package/dist/{cli-j5gtytvg.js → cli-1dr5at77.js} +15 -12
- package/dist/cli-2v4xxnx2.js +148 -0
- package/dist/{cli-sv2r3bw8.js → cli-32xndx6b.js} +7 -7
- package/dist/{cli-h70a2mxy.js → cli-3m8vqehw.js} +53 -13
- package/dist/{cli-ercwc8xn.js → cli-3mf04tkh.js} +1 -1
- package/dist/{cli-52nfye5j.js → cli-3zyme1wt.js} +24 -16
- package/dist/{cli-s6zk31gr.js → cli-43dsqhcp.js} +4 -4
- package/dist/{cli-b93d81yg.js → cli-4h90xaet.js} +2 -2
- package/dist/{cli-5tg94mdw.js → cli-4mj5g29m.js} +9 -12
- package/dist/{cli-47hz21se.js → cli-4tbvndmm.js} +4 -5
- package/dist/{cli-r0mz92by.js → cli-50whymxq.js} +2 -2
- package/dist/{cli-js10kdk7.js → cli-5basv0e7.js} +19 -5
- package/dist/{cli-krbcr00p.js → cli-5v6b2am8.js} +59 -5
- package/dist/{cli-en6dmkxd.js → cli-6r1dwegd.js} +3 -3
- package/dist/{cli-9qe5y107.js → cli-7ewre3dm.js} +15 -6
- package/dist/{cli-n3qe7tyr.js → cli-84xtgbn6.js} +35 -2
- package/dist/{cli-xm34qj8m.js → cli-8cmjkbvj.js} +2 -2
- package/dist/{cli-2m6yaq6b.js → cli-8fj8yfmk.js} +1 -1
- package/dist/{cli-nja15knq.js → cli-8rbkw18r.js} +3 -3
- package/dist/{cli-x05p2d05.js → cli-9tevdxyf.js} +1 -1
- package/dist/{cli-hhc47ack.js → cli-9xx36trj.js} +4 -4
- package/dist/{cli-39qm0rtm.js → cli-a8ts6x1n.js} +29 -150
- package/dist/{cli-bp6k9acz.js → cli-aebswqmz.js} +18 -18
- package/dist/{cli-ex1y88j3.js → cli-at67kvnp.js} +1 -1
- package/dist/{cli-q2dywc8h.js → cli-bjmq14k9.js} +4 -4
- package/dist/{cli-v9ya390t.js → cli-byxsctca.js} +12 -12
- package/dist/{cli-bz97ff9n.js → cli-c0tyzt73.js} +152 -12
- package/dist/{cli-fyaq4zdv.js → cli-c8kqmzzf.js} +9 -9
- package/dist/{cli-t75xngj1.js → cli-cd9acnvd.js} +12 -12
- package/dist/{cli-eqq0hwvx.js → cli-cmgdptmx.js} +3 -3
- package/dist/{cli-r14ac1y0.js → cli-cn6fpa1p.js} +1 -1
- package/dist/{cli-0k1a0sde.js → cli-cp0m07wb.js} +10 -10
- package/dist/{cli-3p288654.js → cli-cpkxh68d.js} +2 -2
- package/dist/{cli-fxd1mwtr.js → cli-cqxwjb93.js} +2 -2
- package/dist/{cli-8hp56wat.js → cli-d2epqm0y.js} +1 -1
- package/dist/{cli-73q4g5nx.js → cli-dd57p1gd.js} +21 -21
- package/dist/{cli-5z0g0e8v.js → cli-f8rcvf2x.js} +49 -13
- package/dist/{cli-wvjqaqcp.js → cli-fn8aj7gb.js} +1330 -249
- package/dist/{cli-bpje8n65.js → cli-fp65jdp2.js} +31 -6
- package/dist/{cli-0pp1yjg2.js → cli-gedf48yw.js} +11 -11
- package/dist/{cli-m5qtmrbc.js → cli-gq6qhmrr.js} +2 -2
- package/dist/{cli-5x03v6en.js → cli-grcc2h2g.js} +8 -8
- package/dist/{cli-01tvvtad.js → cli-h03j6je3.js} +4 -4
- package/dist/{cli-mbwmqb5w.js → cli-h0ewec3d.js} +1 -1
- package/dist/{cli-12vek61e.js → cli-h9bejmkf.js} +535 -146
- package/dist/{cli-gfy6hbd9.js → cli-hs3mqswp.js} +18 -11
- package/dist/{cli-tdk7jtka.js → cli-hv3820ez.js} +1 -1
- package/dist/{cli-pqfecppn.js → cli-je587f74.js} +1 -1
- package/dist/{cli-cjqyse9q.js → cli-jhtvt7gn.js} +3 -3
- package/dist/{cli-dkvtfgn4.js → cli-mmw2sjaf.js} +76 -17
- package/dist/{cli-2z2c4k6q.js → cli-mwxez0pz.js} +22 -0
- package/dist/{cli-yfpc6qy9.js → cli-nk8swfpx.js} +47 -16
- package/dist/{cli-eq4kew31.js → cli-p7g7wd9n.js} +26 -13
- package/dist/{cli-bhgrhedp.js → cli-q8aq48v1.js} +1 -1
- package/dist/{cli-dd2k2mcd.js → cli-qn79645p.js} +1 -1
- package/dist/{cli-ma9ys8rt.js → cli-qx1dwrr5.js} +7 -4
- package/dist/{cli-tm60vtax.js → cli-rfejbpe1.js} +1 -1
- package/dist/{cli-agjbj5x0.js → cli-s6fhqbz1.js} +38 -20
- package/dist/{cli-kwr5qv5g.js → cli-sfajkbd7.js} +2 -2
- package/dist/{cli-9y4tgrkf.js → cli-skd2c4ej.js} +2 -1
- package/dist/{cli-e8n0hdzd.js → cli-snypfjgj.js} +1 -1
- package/dist/{cli-n8f0fs3c.js → cli-t25rq8mg.js} +11 -11
- package/dist/{cli-72yms3ey.js → cli-t90k0phh.js} +201 -21
- package/dist/{cli-xf4z5bdn.js → cli-tzzas8rb.js} +4 -4
- package/dist/{cli-rtmqzat7.js → cli-vdfngx2g.js} +2 -2
- package/dist/{cli-9w8712tq.js → cli-vr4eyq6p.js} +43 -14
- package/dist/{cli-z4f346g5.js → cli-vx9acp12.js} +1 -1
- package/dist/{cli-2amwhyv2.js → cli-w24f3j49.js} +13 -11
- package/dist/cli-w41bvvms.js +148 -0
- package/dist/{cli-04zc3f7b.js → cli-w6c6dj91.js} +1 -1
- package/dist/{cli-fy4gb74g.js → cli-x5yb8zc8.js} +2 -2
- package/dist/{cli-2tw284hj.js → cli-xhkek467.js} +3 -3
- package/dist/{cli-5r95eqbh.js → cli-y260hgep.js} +1 -1
- package/dist/{cli-hbvgzjq4.js → cli-y6qqbpwc.js} +3 -3
- package/dist/{cli-7wy8gbwb.js → cli-ya1cj689.js} +1 -1
- package/dist/{cli-1htmtqc2.js → cli-yeh3g1q6.js} +620 -95
- package/dist/{cli-0vcqcwfn.js → cli-yfvhvw8m.js} +2 -0
- package/dist/{cli-k5jx8jya.js → cli-z6m6xzxt.js} +2 -2
- package/dist/{cli-pe3yxedk.js → cli-zaate0rd.js} +3 -3
- package/dist/{cli-n85m2wkq.js → cli-zkbz8m2q.js} +3 -2
- package/dist/{cli-e3ahxq5y.js → cli-zvpkrgsc.js} +6 -6
- package/dist/cli.js +30 -28
- package/dist/{codex-adapter-wc6e4wct.js → codex-adapter-ysfg6ty3.js} +8 -8
- package/dist/{codex-hook-aqtj17yr.js → codex-hook-c0nvm30r.js} +73 -2
- package/dist/{codex-login-1ven7yje.js → codex-login-ven5cz5j.js} +1 -1
- package/dist/{codex-session-runner-ppfgjd97.js → codex-session-runner-823scr6g.js} +9 -9
- package/dist/{commands-tsv2vx5b.js → commands-5rbm07fz.js} +3 -3
- package/dist/{controller-ye4sdwsy.js → controller-wn3vd217.js} +4 -4
- package/dist/{controllers-connect-zn4dg69h.js → controllers-connect-34jzhfft.js} +29 -28
- package/dist/core-kdehq26g.js +42 -0
- package/dist/{cursor-adapter-q2g9vwts.js → cursor-adapter-w1681kp1.js} +2 -2
- package/dist/{db-g111qn9j.js → db-6bkgbfwk.js} +3 -3
- package/dist/{db-3r1fyr2n.js → db-hcj16x7z.js} +4 -2
- package/dist/{devin-adapter-t8d86q9x.js → devin-adapter-fs90ab4v.js} +1 -1
- package/dist/{dispatcher-4q8s0mx8.js → dispatcher-jgjqrfzv.js} +28 -25
- package/dist/{docker-1b41eysj.js → docker-1h33jvh9.js} +2 -2
- package/dist/{dsh-adapter-mmcw1z5s.js → dsh-adapter-g9yqv09y.js} +2 -2
- package/dist/{e2b-xm60c8ad.js → e2b-jnk0yeva.js} +2 -2
- package/dist/{e2b-ew8c5j5v.js → e2b-y7e5kmzf.js} +2 -2
- package/dist/{easter-egg-3d-04ke6hcp.js → easter-egg-3d-w17nsny6.js} +1 -1
- package/dist/{embedding-space-kcdn52vz.js → embedding-space-v06fwy7b.js} +6 -6
- package/dist/{embeddings-jnzcd91a.js → embeddings-g50dxea4.js} +1 -1
- package/dist/{event-bus-v4ywhc2p.js → event-bus-08t2b4y2.js} +1 -1
- package/dist/{execute-74amghty.js → execute-1n36haw1.js} +1 -1
- package/dist/{external-channel-v9zgxnxz.js → external-channel-43tv8pg6.js} +2 -2
- package/dist/fx-adapter-bvh05t4a.js +20 -0
- package/dist/grok-adapter-my5j8mdf.js +20 -0
- package/dist/handlers-wyymeeqh.js +41 -0
- package/dist/heartbeat-sf3nk937.js +50 -0
- package/dist/{hook-p5reemds.js → hook-dqph1e05.js} +77 -18
- package/dist/{hook-k1h73zd7.js → hook-m1m9dm6w.js} +6 -5
- package/dist/{http-ms1z5xxy.js → http-w0th1cz9.js} +888 -226
- package/dist/index-22khdtby.js +44 -0
- package/dist/{index-76zzxtzf.js → index-c0e8en64.js} +1 -1
- package/dist/{index-620y7jzq.js → index-e8pz8qdg.js} +3 -3
- package/dist/{index-8p0j4h4j.js → index-ez823q84.js} +94 -89
- package/dist/{index-fbkqhvvj.js → index-ffba0z8q.js} +217 -165
- package/dist/{index-gjn6qfgn.js → index-gkpfgpg7.js} +1 -1
- package/dist/{index-4k7m5dgj.js → index-k8ajc0g0.js} +143 -103
- package/dist/index-np0582ac.js +40 -0
- package/dist/{index-kn63q1gr.js → index-pb03vans.js} +33 -32
- package/dist/index-vgkrj1jt.js +39 -0
- package/dist/{index-pe3d8jfy.js → index-whysn1wf.js} +1 -1
- package/dist/{index-0h6qd4p1.js → index-y4vd4mhn.js} +3 -4
- package/dist/{k8s-fy8hbhkg.js → k8s-8326q0rq.js} +2 -2
- package/dist/{keepalive-031js8jz.js → keepalive-2v06q2e8.js} +5 -4
- package/dist/lead-55z813ng.js +79 -0
- package/dist/{maintenance-sq9v3qx9.js → maintenance-vx7vjhhy.js} +1 -1
- package/dist/{oauth-refresh-sweep-zqmnyvs8.js → oauth-refresh-sweep-g06k4bza.js} +4 -3
- package/dist/{object-webhooks-r24wwb5y.js → object-webhooks-3dzdq4fm.js} +7 -7
- package/dist/{onboard-p25yhh7t.js → onboard-232pazny.js} +4 -4
- package/dist/{opencode-adapter-wcjc4zdk.js → opencode-adapter-t0paqbh8.js} +8 -7
- package/dist/{otel-impl-ff1gf20m.js → otel-impl-kmpkyp4y.js} +2 -2
- package/dist/{pending-hxj5yatb.js → pending-x0z3vx1x.js} +27 -26
- package/dist/{pi-mono-adapter-vkp4zz7p.js → pi-mono-adapter-7pmypn6d.js} +93 -22
- package/dist/{pricing-refresh-9w7gx41w.js → pricing-refresh-ytjmtyd7.js} +2 -2
- package/dist/{rbac-roles-84aw10nz.js → rbac-roles-fgm5mxr2.js} +3 -3
- package/dist/{rbac-roles-hz74vckp.js → rbac-roles-xyaxekh3.js} +7 -4
- package/dist/{registry-eeyx1201.js → registry-zv0zvxsx.js} +1 -1
- package/dist/{render-v2-nrdkg9gf.js → render-v2-ws972g4r.js} +12 -8
- package/dist/{resume-s6ey36rh.js → resume-m6mjzhkp.js} +13 -12
- package/dist/{runtime-x0b4pyam.js → runtime-zzpc0c8a.js} +1 -1
- package/dist/{session-access-xv49tk14.js → session-access-vp35xs91.js} +5 -4
- package/dist/{session-source-backfill-r5j988ah.js → session-source-backfill-p73e8zbe.js} +3 -3
- package/dist/{setup-mj0krk1p.js → setup-r4kd7rxg.js} +1 -1
- package/dist/thread-buffer-cm2nzq6t.js +42 -0
- package/dist/{tree-visibility-cbrsfaar.js → tree-visibility-07h2tbs2.js} +2 -2
- package/dist/{user-merge-jobs-f9d8nwnw.js → user-merge-jobs-96vg9rpe.js} +3 -3
- package/dist/{virtual-modules-ns0ryw05.js → virtual-modules-vgn3f2x4.js} +3 -3
- package/dist/{work-objects-pydhzast.js → work-objects-74hbcx3e.js} +31 -29
- package/dist/worker-5pn2vzx6.js +79 -0
- package/dist/{worker-follow-up-9z2xec5e.js → worker-follow-up-ezavwn5d.js} +26 -25
- package/dist/{x-3dtaf2r9.js → x-asbrnafg.js} +2 -2
- package/dist/xlsx-9acfmxr1.js +31534 -0
- package/openapi.json +2816 -1464
- package/package.json +13 -11
- package/src/agentmail/handlers.ts +26 -19
- package/src/apps/catalog.generated.json +757 -0
- package/src/apps/definition.ts +24 -7
- package/src/apps/page-validator.ts +225 -3
- 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 +152 -33
- package/src/be/extensions/assets.ts +11 -7
- package/src/be/mcp-proxy.ts +5 -4
- 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/migrations/340_api_key_spend_cap.sql +5 -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/schedules/validate.ts +26 -0
- 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 +5 -0
- package/src/be/unmapped-identities.ts +95 -1
- package/src/bitbucket/handlers.ts +2 -0
- package/src/commands/credential-outcome-report.ts +5 -2
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/provider-credentials.ts +19 -0
- package/src/commands/provider-error-class.ts +4 -1
- package/src/commands/rate-limit-outcome.ts +48 -3
- package/src/commands/runner.ts +113 -55
- package/src/commands/worktree-reaper.ts +600 -0
- 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/agents.ts +4 -0
- package/src/http/all-routes.ts +1 -0
- package/src/http/api-keys.ts +27 -3
- 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-public.ts +40 -4
- package/src/http/pages.ts +3 -3
- package/src/http/poll.ts +43 -12
- package/src/http/pool-keys.ts +21 -2
- package/src/http/repos.ts +7 -6
- package/src/http/schedules.ts +38 -9
- package/src/http/script-connections.ts +14 -6
- package/src/http/script-runs.ts +12 -3
- 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 +18 -12
- 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/mcp-client/http-client.ts +3 -1
- package/src/oauth/identity-capture.ts +6 -1
- package/src/oauth/mcp-wrapper.ts +10 -3
- package/src/oauth/wrapper.ts +15 -3
- package/src/prompts/base-prompt.ts +35 -13
- package/src/prompts/session-templates.ts +26 -0
- package/src/providers/acp-targets.ts +2 -2
- 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 +143 -11
- package/src/providers/pi-mono-extension.ts +69 -0
- package/src/providers/runtime-dependencies.ts +1 -1
- package/src/rbac/legacy-policy.ts +5 -0
- package/src/rbac/permissions.ts +16 -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 +8 -7
- package/src/scripts-runtime/types/swarm-sdk.d.ts +47 -4
- package/src/server.ts +4 -0
- package/src/slack/enrich.ts +94 -31
- 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/agents-list-model-display.test.ts +23 -0
- package/src/tests/apps-spike2.test.ts +35 -0
- package/src/tests/audit-agent-person.test.ts +825 -0
- package/src/tests/audit-updated-by.test.ts +19 -12
- package/src/tests/base-prompt.test.ts +1 -0
- 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/deploy-guard.test.ts +24 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/ensure-token.test.ts +2 -2
- package/src/tests/entrypoint-repo-autoclone-args.test.ts +202 -0
- package/src/tests/extensions-catalog.test.ts +33 -25
- package/src/tests/fake-dns.ts +47 -0
- package/src/tests/fixtures/base-prompt-baseline.json +12 -12
- 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/latest-model-report.test.ts +138 -0
- package/src/tests/mcp-oauth-dcr-reuse.test.ts +5 -2
- package/src/tests/mcp-oauth-ensure-token.test.ts +3 -2
- package/src/tests/mcp-oauth-manual-client.test.ts +6 -1
- package/src/tests/mcp-oauth-wrapper.test.ts +20 -4
- package/src/tests/mcp-outbound-fetch-guard.test.ts +169 -0
- package/src/tests/mcp-server-ssrf.test.ts +2 -0
- package/src/tests/memory-search-reader.test.ts +258 -0
- package/src/tests/memory-search-stall.test.ts +202 -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/oauth-connection-fetch-guard.test.ts +162 -0
- package/src/tests/oauth-token-endpoint-fetch-guard.test.ts +121 -0
- package/src/tests/oauth-wrapper.test.ts +1 -2
- package/src/tests/opencode-swarm-plugin.test.ts +6 -1
- package/src/tests/pages-head-v2.test.ts +2 -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-http.test.ts +8 -3
- package/src/tests/script-connections.test.ts +6 -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 +77 -4
- package/src/tests/spend-cap-credentials.test.ts +34 -0
- package/src/tests/spend-cap-outcome.test.ts +67 -0
- package/src/tests/subscription-first.test.ts +119 -0
- package/src/tests/tool-registrar-no-input.test.ts +1 -0
- package/src/tests/worktree-reaper.test.ts +424 -0
- package/src/tools/defer-task.ts +154 -12
- package/src/tools/get-task-details.ts +247 -5
- 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 +38 -4
- package/src/tools/schedules/update-schedule.ts +40 -5
- 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/utils/credentials.ts +36 -1
- package/src/utils/egress-guard.ts +40 -10
- package/src/utils/error-tracker.ts +17 -0
- 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/apps/SKILL.md +191 -2
- package/templates/skills/apps/content.md +191 -2
- package/templates/skills/boards-and-sheets/config.json +14 -0
- package/templates/skills/boards-and-sheets/content.md +174 -0
- package/templates/skills/pages/content.md +11 -0
- package/templates/skills/swarm-docs/content.md +11 -0
- package/templates/skills/swarm-scripts/SKILL.md +1 -0
- package/templates/skills/swarm-scripts/content.md +1 -0
- package/templates/workflows/ralph-loop/content.md +6 -6
- package/dist/acp-adapter-11m13kx4.js +0 -16
- package/dist/cli-pr0eze3x.js +0 -149
- 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/heartbeat-p8pk1msj.js +0 -49
- 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
package/src/http/schedules.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { IncomingMessage, ServerResponse } from "node:http";
|
|
|
2
2
|
import { CronExpressionParser } from "cron-parser";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { AssetKeyAuthorizationError, authorizeAssetKeyWrite } from "../be/asset-key-auth";
|
|
5
|
-
import { resolveHttpAuditUserId } from "../be/audit-user";
|
|
5
|
+
import { resolveHttpAuditUserId, resolveHttpRequesterUserId } from "../be/audit-user";
|
|
6
6
|
import {
|
|
7
7
|
createScheduledTask,
|
|
8
8
|
deleteScheduledTask,
|
|
@@ -22,7 +22,11 @@ import {
|
|
|
22
22
|
taskProfileError,
|
|
23
23
|
} from "../be/db/model-profiles";
|
|
24
24
|
import { explicitModelErrorForAgent } from "../be/model-validation";
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
changesScheduleTarget,
|
|
27
|
+
mergeScheduleTiming,
|
|
28
|
+
validateRecurringTiming,
|
|
29
|
+
} from "../be/schedules/validate";
|
|
26
30
|
import { getScript } from "../be/scripts/db";
|
|
27
31
|
import { can } from "../rbac";
|
|
28
32
|
import { calculateNextRun, dispatchScheduleTarget } from "../scheduler/scheduler";
|
|
@@ -230,7 +234,7 @@ const updateSchedule = route({
|
|
|
230
234
|
responses: {
|
|
231
235
|
200: { description: "Schedule updated", schema: ScheduledTaskSchema.nullable() },
|
|
232
236
|
400: { description: "Validation error" },
|
|
233
|
-
403: { description: "Deferral owned by another agent" },
|
|
237
|
+
403: { description: "Deferral or target owned by another agent" },
|
|
234
238
|
404: { description: "Schedule not found" },
|
|
235
239
|
409: { description: "Duplicate name" },
|
|
236
240
|
},
|
|
@@ -249,7 +253,7 @@ const patchSchedule = route({
|
|
|
249
253
|
responses: {
|
|
250
254
|
200: { description: "Schedule patched", schema: ScheduledTaskSchema.nullable() },
|
|
251
255
|
400: { description: "Validation error" },
|
|
252
|
-
403: { description: "Deferral owned by another agent" },
|
|
256
|
+
403: { description: "Deferral or target owned by another agent" },
|
|
253
257
|
404: { description: "Schedule not found" },
|
|
254
258
|
409: { description: "Duplicate name" },
|
|
255
259
|
},
|
|
@@ -432,7 +436,7 @@ export async function handleSchedules(
|
|
|
432
436
|
}
|
|
433
437
|
|
|
434
438
|
try {
|
|
435
|
-
const trustedUserId = await
|
|
439
|
+
const trustedUserId = await resolveHttpRequesterUserId(req, myAgentId);
|
|
436
440
|
let key: string | undefined;
|
|
437
441
|
try {
|
|
438
442
|
key = body.key ? await authorizeAssetKeyWrite(body.key, trustedUserId) : undefined;
|
|
@@ -484,7 +488,9 @@ export async function handleSchedules(
|
|
|
484
488
|
params: body.params,
|
|
485
489
|
requiredParams: body.requiredParams,
|
|
486
490
|
requires: body.requires,
|
|
487
|
-
|
|
491
|
+
createdByAgentId: myAgentId,
|
|
492
|
+
// Not the audit header: a schedule fires its tasks as requested by created_by.
|
|
493
|
+
createdBy: trustedUserId ?? undefined,
|
|
488
494
|
});
|
|
489
495
|
|
|
490
496
|
createSchedule.respond(res, 201, schedule);
|
|
@@ -573,7 +579,7 @@ export async function handleSchedules(
|
|
|
573
579
|
try {
|
|
574
580
|
body.key = await authorizeAssetKeyWrite(
|
|
575
581
|
parsed.body.key,
|
|
576
|
-
await
|
|
582
|
+
await resolveHttpRequesterUserId(req, myAgentId),
|
|
577
583
|
);
|
|
578
584
|
} catch (error) {
|
|
579
585
|
if (error instanceof AssetKeyAuthorizationError) {
|
|
@@ -614,6 +620,27 @@ export async function handleSchedules(
|
|
|
614
620
|
return true;
|
|
615
621
|
}
|
|
616
622
|
}
|
|
623
|
+
// A schedule fires as its creator. An agent may change what it runs only
|
|
624
|
+
// as its creator or a lead, as in the patch-schedule and update-schedule tools.
|
|
625
|
+
if (changesScheduleTarget(existing, parsed.body)) {
|
|
626
|
+
const principal = await agentFirstPrincipal(req, myAgentId);
|
|
627
|
+
if (
|
|
628
|
+
principal.kind === "agent" &&
|
|
629
|
+
!can({
|
|
630
|
+
principal,
|
|
631
|
+
verb: "schedule.target.update.any",
|
|
632
|
+
resource: { kind: "owned", ownerAgentId: existing.createdByAgentId },
|
|
633
|
+
source: "http",
|
|
634
|
+
}).allow
|
|
635
|
+
) {
|
|
636
|
+
jsonError(
|
|
637
|
+
res,
|
|
638
|
+
`Schedule "${existing.name}" runs as the agent that created it. Only that agent or a lead can change its targetType, taskTemplate, workflowId, scriptName, scriptArgs or params.`,
|
|
639
|
+
403,
|
|
640
|
+
);
|
|
641
|
+
return true;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
617
644
|
// A move to another agent re-judges the stored model against the new harness.
|
|
618
645
|
const agentChanged =
|
|
619
646
|
parsed.body.targetAgentId !== undefined &&
|
|
@@ -779,8 +806,10 @@ export async function handleSchedules(
|
|
|
779
806
|
}
|
|
780
807
|
}
|
|
781
808
|
|
|
782
|
-
|
|
783
|
-
|
|
809
|
+
// The audit pair describes this write: the person is null when unknown,
|
|
810
|
+
// never left over from an earlier writer.
|
|
811
|
+
body.updatedBy = await resolveHttpAuditUserId(req, myAgentId);
|
|
812
|
+
body.updatedByAgentId = myAgentId ?? null;
|
|
784
813
|
let schedule: Awaited<ReturnType<typeof updateScheduledTask>>;
|
|
785
814
|
try {
|
|
786
815
|
schedule = await updateScheduledTask(parsed.params.id, body);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { resolveHttpAuditUserId } from "@/be/audit-user";
|
|
3
|
+
import { resolveHttpAuditUserId, resolveHttpRequesterUserId } from "@/be/audit-user";
|
|
4
4
|
import { normalizeDate } from "@/be/date-utils";
|
|
5
5
|
import { getDbClient } from "@/be/db";
|
|
6
6
|
import {
|
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
type IntegrationType,
|
|
67
67
|
} from "@/telemetry";
|
|
68
68
|
import type { OAuthApp } from "@/tracker/types";
|
|
69
|
+
import { createSsrfGuardedFetch, EgressDeniedError } from "@/utils/egress-guard";
|
|
69
70
|
import { resolveScopedResourceId, scopedResourceScopeIdSchema } from "@/utils/scoped-resource";
|
|
70
71
|
import { registerVolatileSecret, scrubSecrets } from "@/utils/secret-scrubber";
|
|
71
72
|
import { ensureHttpPermission } from "./config";
|
|
@@ -1456,7 +1457,10 @@ async function listOAuthApps() {
|
|
|
1456
1457
|
* request was attempted (a revocationUrl is configured), false otherwise.
|
|
1457
1458
|
* Network/HTTP failures are logged (scrubbed) and never fail the caller.
|
|
1458
1459
|
*/
|
|
1459
|
-
async function attemptRemoteRevocation(
|
|
1460
|
+
export async function attemptRemoteRevocation(
|
|
1461
|
+
app: OAuthApp,
|
|
1462
|
+
accessToken: string,
|
|
1463
|
+
): Promise<boolean> {
|
|
1460
1464
|
const revocationUrl = app.revocationUrl ?? undefined;
|
|
1461
1465
|
if (!revocationUrl) return false;
|
|
1462
1466
|
|
|
@@ -1492,7 +1496,8 @@ async function attemptRemoteRevocation(app: OAuthApp, accessToken: string): Prom
|
|
|
1492
1496
|
const controller = new AbortController();
|
|
1493
1497
|
const timeout = setTimeout(() => controller.abort(), 5_000);
|
|
1494
1498
|
try {
|
|
1495
|
-
|
|
1499
|
+
// Guarded: a public name that resolves to a private address is refused too.
|
|
1500
|
+
await createSsrfGuardedFetch(publicEndpointSsrfOptions())(revocationUrl, {
|
|
1496
1501
|
method: "POST",
|
|
1497
1502
|
headers,
|
|
1498
1503
|
body: body.toString(),
|
|
@@ -1527,9 +1532,11 @@ function oauthDiscoveryUrls(inputUrl: string): string[] {
|
|
|
1527
1532
|
|
|
1528
1533
|
async function fetchJsonMetadata(url: string, signal: AbortSignal): Promise<unknown> {
|
|
1529
1534
|
let current = assertUrlSafe(url, publicEndpointSsrfOptions());
|
|
1535
|
+
// Checks each hop's resolved address; the loop below still owns redirects.
|
|
1536
|
+
const guardedFetch = createSsrfGuardedFetch(publicEndpointSsrfOptions());
|
|
1530
1537
|
let response: Response | null = null;
|
|
1531
1538
|
for (let hop = 0; hop <= 5; hop += 1) {
|
|
1532
|
-
response = await
|
|
1539
|
+
response = await guardedFetch(current, {
|
|
1533
1540
|
headers: { accept: "application/json" },
|
|
1534
1541
|
signal,
|
|
1535
1542
|
redirect: "manual",
|
|
@@ -1573,7 +1580,7 @@ function extractOAuthDiscovery(metadata: unknown) {
|
|
|
1573
1580
|
};
|
|
1574
1581
|
}
|
|
1575
1582
|
|
|
1576
|
-
async function discoverOAuthApp(url: string) {
|
|
1583
|
+
export async function discoverOAuthApp(url: string) {
|
|
1577
1584
|
const controller = new AbortController();
|
|
1578
1585
|
const timeout = setTimeout(() => controller.abort(), DISCOVERY_TIMEOUT_MS);
|
|
1579
1586
|
const failures: string[] = [];
|
|
@@ -1604,6 +1611,7 @@ async function discoverOAuthApp(url: string) {
|
|
|
1604
1611
|
function isUrlSafetyError(error: unknown): boolean {
|
|
1605
1612
|
if (!(error instanceof Error)) return false;
|
|
1606
1613
|
return (
|
|
1614
|
+
error instanceof EgressDeniedError ||
|
|
1607
1615
|
error.message.startsWith("Refusing ") ||
|
|
1608
1616
|
error.message.startsWith("Invalid URL:") ||
|
|
1609
1617
|
error.message.startsWith("Missing hostname:")
|
|
@@ -2384,7 +2392,7 @@ export async function handleScriptConnections(
|
|
|
2384
2392
|
label,
|
|
2385
2393
|
flow: "generic",
|
|
2386
2394
|
...(parsed.body?.finalRedirect ? { finalRedirect: parsed.body.finalRedirect } : {}),
|
|
2387
|
-
userId: await
|
|
2395
|
+
userId: await resolveHttpRequesterUserId(req, agentId),
|
|
2388
2396
|
});
|
|
2389
2397
|
authorizeUrlRoute.respond(res, 200, {
|
|
2390
2398
|
authorizeUrl: result.url,
|
package/src/http/script-runs.ts
CHANGED
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
RawLlmOutputSchema,
|
|
58
58
|
} from "../workflows/executors/raw-llm";
|
|
59
59
|
import { bodyTask, route } from "./route-def";
|
|
60
|
+
import { resolveTaskRequester } from "./task-requester";
|
|
60
61
|
import { json, jsonError } from "./utils";
|
|
61
62
|
|
|
62
63
|
const DEFAULT_SCRIPT_RUN_CONCURRENCY_CAP = 10;
|
|
@@ -482,6 +483,10 @@ export async function handleScriptRuns(
|
|
|
482
483
|
// read cap-1 active runs and all insert, exceeding the cap.
|
|
483
484
|
const cap = scriptRunConcurrencyCap();
|
|
484
485
|
const sourceTaskId = await resolveRunSourceTaskId(req, agent.id);
|
|
486
|
+
// Same rules as POST /api/tasks: a non-lead agent cannot name another user.
|
|
487
|
+
const requestedByUserId = parsed.body.requestedByUserId
|
|
488
|
+
? await resolveTaskRequester(req, agent.id, parsed.body.requestedByUserId)
|
|
489
|
+
: undefined;
|
|
485
490
|
const creation = await getDbClient().transaction(async () => {
|
|
486
491
|
if ((await countActiveScriptRuns()) >= cap) return null;
|
|
487
492
|
return await createScriptRun({
|
|
@@ -491,9 +496,9 @@ export async function handleScriptRuns(
|
|
|
491
496
|
args: parsed.body.args ?? null,
|
|
492
497
|
scriptName: parsed.body.scriptName,
|
|
493
498
|
idempotencyKey: parsed.body.idempotencyKey,
|
|
494
|
-
requestedByUserId
|
|
499
|
+
requestedByUserId,
|
|
495
500
|
sourceTaskId,
|
|
496
|
-
createdBy:
|
|
501
|
+
createdBy: requestedByUserId,
|
|
497
502
|
});
|
|
498
503
|
});
|
|
499
504
|
if (!creation) {
|
|
@@ -737,6 +742,10 @@ export async function handleScriptRuns(
|
|
|
737
742
|
return true;
|
|
738
743
|
}
|
|
739
744
|
const followUpThread = await followUpThreadForSourceTask(run.sourceTaskId);
|
|
745
|
+
// A step may name its own requester only when its agent may assign one; else the run's.
|
|
746
|
+
const stepRequester = parsed.body.requestedByUserId
|
|
747
|
+
? await resolveTaskRequester(req, agentId, parsed.body.requestedByUserId, null)
|
|
748
|
+
: undefined;
|
|
740
749
|
// The replay lookup, the guard decision and the insert share one write
|
|
741
750
|
// transaction. It serializes this step against the run's other steps,
|
|
742
751
|
// other runs and send-task dispatches into the same thread.
|
|
@@ -810,7 +819,7 @@ export async function handleScriptRuns(
|
|
|
810
819
|
vcsRepo: parsed.body.vcsRepo,
|
|
811
820
|
model: parsed.body.model,
|
|
812
821
|
parentTaskId: parsed.body.parentTaskId,
|
|
813
|
-
requestedByUserId:
|
|
822
|
+
requestedByUserId: stepRequester ?? run.requestedByUserId,
|
|
814
823
|
outputSchema: parsed.body.outputSchema,
|
|
815
824
|
contextKey,
|
|
816
825
|
});
|
package/src/http/scripts.ts
CHANGED
|
@@ -762,6 +762,10 @@ export async function handleScripts(
|
|
|
762
762
|
const runtimeInstanceId = ((h) => (Array.isArray(h) ? h[0] : h))(
|
|
763
763
|
req.headers["x-runtime-instance-id"],
|
|
764
764
|
);
|
|
765
|
+
// Forwarded to the run's `ctx.swarm` calls so their writes resolve the same
|
|
766
|
+
// audit person. Not trusted as-is: every resolver re-checks that the task
|
|
767
|
+
// belongs to the calling agent.
|
|
768
|
+
const sourceTaskId = ((h) => (Array.isArray(h) ? h[0] : h))(req.headers["x-source-task-id"]);
|
|
765
769
|
|
|
766
770
|
// Inline source is saved as a scratch script and recorded on the run row:
|
|
767
771
|
// refuse an embedded secret before it executes or persists.
|
|
@@ -820,6 +824,7 @@ export async function handleScripts(
|
|
|
820
824
|
executor,
|
|
821
825
|
agentId: agent.id,
|
|
822
826
|
runtimeInstanceId,
|
|
827
|
+
sourceTaskId,
|
|
823
828
|
egressSecrets: credentials.egressSecrets,
|
|
824
829
|
failedBindings: credentials.failedBindings,
|
|
825
830
|
userConfig: credentials.userConfig,
|
|
@@ -884,6 +889,7 @@ export async function handleScripts(
|
|
|
884
889
|
isScratch: true,
|
|
885
890
|
typeChecked: false,
|
|
886
891
|
changeReason: "Auto-saved successful inline run",
|
|
892
|
+
createdBy: await resolveHttpAuditUserId(req, agent.id),
|
|
887
893
|
});
|
|
888
894
|
autoSaved = { slug, reason: "successful_inline_run" };
|
|
889
895
|
}
|
|
@@ -993,6 +999,9 @@ export async function handleScripts(
|
|
|
993
999
|
fsMode: script.fsMode,
|
|
994
1000
|
executor: script.executor,
|
|
995
1001
|
createdByAgentId: script.createdByAgentId,
|
|
1002
|
+
updatedByAgentId: script.updatedByAgentId,
|
|
1003
|
+
createdBy: script.createdBy,
|
|
1004
|
+
updatedBy: script.updatedBy,
|
|
996
1005
|
createdAt: script.createdAt,
|
|
997
1006
|
updatedAt: script.updatedAt,
|
|
998
1007
|
}));
|
package/src/http/sessions.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "../assets/key";
|
|
11
11
|
import { SOURCE_GROUPS_READ_ONLY, sourceMoveError, sourceOfKey } from "../assets/source-key";
|
|
12
12
|
import { AssetKeyAuthorizationError, authorizeAssetKeyWrite } from "../be/asset-key-auth";
|
|
13
|
-
import {
|
|
13
|
+
import { resolveHttpRequesterUserId } from "../be/audit-user";
|
|
14
14
|
import {
|
|
15
15
|
AgentDeletedError,
|
|
16
16
|
AssetKeyMovesBlockedError,
|
|
@@ -180,6 +180,9 @@ const SessionTreeResponseSchema = z.object({
|
|
|
180
180
|
labels: z.record(z.string(), z.string()).optional(),
|
|
181
181
|
groups: z.array(SessionTreeGroupSchema),
|
|
182
182
|
inbox: SessionSectionCountsSchema,
|
|
183
|
+
working: SessionSectionCountsSchema.describe(
|
|
184
|
+
"Inbox sessions with a task running and nothing for the person to answer. They list under Working, not Inbox.",
|
|
185
|
+
),
|
|
183
186
|
later: SessionSectionCountsSchema,
|
|
184
187
|
done: SessionSectionCountsSchema,
|
|
185
188
|
noGroup: SessionSectionCountsSchema,
|
|
@@ -589,13 +592,15 @@ const listSessions = route({
|
|
|
589
592
|
keyPrefix: SessionKeyFilterSchema.optional(),
|
|
590
593
|
/** Exact asset group, including direct resource leaves. */
|
|
591
594
|
groupKey: SessionKeyFilterSchema.optional(),
|
|
595
|
+
/** Comma-separated root task ids (the first 200 count): only these sessions, in any read state. */
|
|
596
|
+
ids: z.string().optional(),
|
|
592
597
|
/** Shared and viewer-personal namespace roots and direct resource leaves. */
|
|
593
598
|
noGroup: z
|
|
594
599
|
.enum(["true", "false"])
|
|
595
600
|
.transform((v) => v === "true")
|
|
596
601
|
.optional(),
|
|
597
|
-
/** Chain-wide read state or Inbox section. */
|
|
598
|
-
triage: z.enum(["inbox", "later", "done", "unread"]).optional(),
|
|
602
|
+
/** Chain-wide read state, or the Inbox or Working section. */
|
|
603
|
+
triage: z.enum(["inbox", "working", "later", "done", "unread"]).optional(),
|
|
599
604
|
/** Latest chain status or pending human attention. */
|
|
600
605
|
status: z.enum(["running", "failed", "needs"]).optional(),
|
|
601
606
|
/** Requester anywhere in the chain or active share recipient. */
|
|
@@ -668,23 +673,31 @@ const triageSessionListRoute = route({
|
|
|
668
673
|
pattern: ["api", "session-triage"],
|
|
669
674
|
summary: "Triage every session of one sidebar list",
|
|
670
675
|
description:
|
|
671
|
-
"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)
|
|
676
|
+
"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.",
|
|
672
677
|
tags: ["Sessions"],
|
|
673
678
|
body: z
|
|
674
679
|
.object({
|
|
675
680
|
action: z.enum(["done", "inbox", "read", "unread"]),
|
|
676
|
-
/** The list: one of Inbox, Later, Done, No group, or a group. */
|
|
677
|
-
triage: z.enum(["inbox", "later", "done"]).optional(),
|
|
681
|
+
/** The list: one of Inbox, Later, Done, No group, a group, or a source group with its threads. */
|
|
682
|
+
triage: z.enum(["inbox", "working", "later", "done"]).optional(),
|
|
678
683
|
noGroup: z.boolean().optional(),
|
|
679
684
|
groupKey: SessionKeyFilterSchema.optional(),
|
|
685
|
+
/** A source group (`shared/slack/<channel>/`) with its nested threads, as the sidebar lists it. */
|
|
686
|
+
keyPrefix: SessionKeyFilterSchema.refine((key) => sourceOfKey(key) !== null, {
|
|
687
|
+
message: "keyPrefix must be a source group",
|
|
688
|
+
}).optional(),
|
|
680
689
|
show: SessionShowSchema,
|
|
681
690
|
hideSource: z.array(z.string().min(1)).max(32).optional(),
|
|
682
691
|
/** Root sources to keep; an empty array keeps none. */
|
|
683
692
|
showSource: z.array(z.string().min(1)).max(32).optional(),
|
|
693
|
+
/** Root task ids to leave out: rows unchecked after 'Select all N'. */
|
|
694
|
+
exceptIds: z.array(z.string().min(1)).max(500).optional(),
|
|
684
695
|
})
|
|
685
|
-
.refine(
|
|
686
|
-
|
|
687
|
-
|
|
696
|
+
.refine(
|
|
697
|
+
(body) =>
|
|
698
|
+
[body.triage, body.noGroup, body.groupKey, body.keyPrefix].filter(Boolean).length === 1,
|
|
699
|
+
{ message: "Name exactly one list: triage, noGroup, groupKey, or keyPrefix" },
|
|
700
|
+
),
|
|
688
701
|
responses: {
|
|
689
702
|
200: {
|
|
690
703
|
description: "The number of sessions written",
|
|
@@ -757,7 +770,7 @@ async function withSessionMove(
|
|
|
757
770
|
run: (context: { actor: SessionActor; changedBy?: string; key: string | null }) => Promise<void>,
|
|
758
771
|
): Promise<void> {
|
|
759
772
|
try {
|
|
760
|
-
const changedBy = await
|
|
773
|
+
const changedBy = await resolveHttpRequesterUserId(req, myAgentId);
|
|
761
774
|
const actor = await resolveSessionActor(req, myAgentId);
|
|
762
775
|
const key = destination === null ? null : await authorizeAssetKeyWrite(destination, changedBy);
|
|
763
776
|
await assertAssetKeyMovesAllowed();
|
|
@@ -1055,6 +1068,11 @@ export async function handleSessions(
|
|
|
1055
1068
|
contextKeyPrefix: parsed.query.contextKeyPrefix,
|
|
1056
1069
|
keyPrefix: parsed.query.keyPrefix,
|
|
1057
1070
|
groupKey: parsed.query.groupKey,
|
|
1071
|
+
rootIds: parsed.query.ids
|
|
1072
|
+
?.split(",")
|
|
1073
|
+
.map((id) => id.trim())
|
|
1074
|
+
.filter(Boolean)
|
|
1075
|
+
.slice(0, 200),
|
|
1058
1076
|
noGroup: parsed.query.noGroup,
|
|
1059
1077
|
triage: parsed.query.triage,
|
|
1060
1078
|
status: parsed.query.status,
|
|
@@ -1132,10 +1150,10 @@ export async function handleSessions(
|
|
|
1132
1150
|
jsonError(res, "Pick a user to triage sessions", 400);
|
|
1133
1151
|
return true;
|
|
1134
1152
|
}
|
|
1135
|
-
const { action, show, ...list } = parsed.body;
|
|
1153
|
+
const { action, show, exceptIds, ...list } = parsed.body;
|
|
1136
1154
|
const updated = await triageSessionList(
|
|
1137
1155
|
actor.userId,
|
|
1138
|
-
{ ...list, mine: show !== "all" },
|
|
1156
|
+
{ ...list, exceptRootIds: exceptIds, mine: show !== "all" },
|
|
1139
1157
|
action,
|
|
1140
1158
|
actor.readAll,
|
|
1141
1159
|
);
|
package/src/http/skills.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { resolveHttpAuditActor, resolveHttpAuditUserId } from "../be/audit-user";
|
|
3
4
|
import {
|
|
4
5
|
createSkill,
|
|
5
6
|
deleteSkill,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
listSkillFileManifest,
|
|
13
14
|
listSkills,
|
|
14
15
|
searchSkills,
|
|
16
|
+
setSkillUpdatedBy,
|
|
15
17
|
uninstallSkill,
|
|
16
18
|
updateSkill,
|
|
17
19
|
upsertSkillFile,
|
|
@@ -664,6 +666,8 @@ export async function handleSkills(
|
|
|
664
666
|
sourcePath: parsed.body.sourcePath,
|
|
665
667
|
sourceBranch: branch,
|
|
666
668
|
isComplex: parsed.body.isComplex ?? false,
|
|
669
|
+
createdByAgentId: myAgentId ?? null,
|
|
670
|
+
createdBy: await resolveHttpAuditUserId(req, myAgentId),
|
|
667
671
|
});
|
|
668
672
|
|
|
669
673
|
installRemoteRoute.respond(res, 201, { skill });
|
|
@@ -687,6 +691,9 @@ export async function handleSkills(
|
|
|
687
691
|
|
|
688
692
|
let updated = 0;
|
|
689
693
|
const errors: string[] = [];
|
|
694
|
+
// A content change is attributed to the caller; a lastFetchedAt-only
|
|
695
|
+
// touch is a fetch, not an edit, and leaves the audit pair alone.
|
|
696
|
+
const actor = await resolveHttpAuditActor(req, myAgentId);
|
|
690
697
|
|
|
691
698
|
for (const skill of remoteSkills) {
|
|
692
699
|
if (skill.isComplex || !skill.sourceRepo) continue;
|
|
@@ -717,6 +724,8 @@ export async function handleSkills(
|
|
|
717
724
|
userInvocable: pm.userInvocable,
|
|
718
725
|
sourceHash: newHash,
|
|
719
726
|
lastFetchedAt: now,
|
|
727
|
+
updatedBy: actor.userId,
|
|
728
|
+
updatedByAgentId: actor.agentId,
|
|
720
729
|
});
|
|
721
730
|
updated++;
|
|
722
731
|
} else {
|
|
@@ -866,6 +875,7 @@ export async function handleSkills(
|
|
|
866
875
|
|
|
867
876
|
try {
|
|
868
877
|
const files = await upsertSkillFiles(parsed.params.id, parsed.body.files);
|
|
878
|
+
await setSkillUpdatedBy(parsed.params.id, await resolveHttpAuditActor(req, myAgentId));
|
|
869
879
|
const updatedSkill = await getSkillById(parsed.params.id);
|
|
870
880
|
bulkUpsertSkillFilesRoute.respond(res, 200, {
|
|
871
881
|
files,
|
|
@@ -922,6 +932,7 @@ export async function handleSkills(
|
|
|
922
932
|
path: decodeSkillFilePath(pathSegments),
|
|
923
933
|
...parsed.body,
|
|
924
934
|
});
|
|
935
|
+
await setSkillUpdatedBy(parsed.params.id, await resolveHttpAuditActor(req, myAgentId));
|
|
925
936
|
const updatedSkill = await getSkillById(parsed.params.id);
|
|
926
937
|
upsertSkillFileRoute.respond(res, 200, { file, skill: updatedSkill });
|
|
927
938
|
} catch (err) {
|
|
@@ -951,6 +962,7 @@ export async function handleSkills(
|
|
|
951
962
|
jsonError(res, "Skill file not found", 404);
|
|
952
963
|
return true;
|
|
953
964
|
}
|
|
965
|
+
await setSkillUpdatedBy(parsed.params.id, await resolveHttpAuditActor(req, myAgentId));
|
|
954
966
|
const updatedSkill = await getSkillById(parsed.params.id);
|
|
955
967
|
deleteSkillFileRoute.respond(res, 200, { success: true, skill: updatedSkill });
|
|
956
968
|
} catch (err) {
|
|
@@ -995,6 +1007,8 @@ export async function handleSkills(
|
|
|
995
1007
|
disableModelInvocation: pm.disableModelInvocation,
|
|
996
1008
|
userInvocable: pm.userInvocable,
|
|
997
1009
|
systemDefault: parsed.body.systemDefault,
|
|
1010
|
+
createdByAgentId: myAgentId ?? null,
|
|
1011
|
+
createdBy: await resolveHttpAuditUserId(req, myAgentId),
|
|
998
1012
|
});
|
|
999
1013
|
createSkillRoute.respond(res, 201, { skill });
|
|
1000
1014
|
} catch (err) {
|
|
@@ -1062,6 +1076,9 @@ export async function handleSkills(
|
|
|
1062
1076
|
updates.disableModelInvocation = pm.disableModelInvocation;
|
|
1063
1077
|
updates.userInvocable = pm.userInvocable;
|
|
1064
1078
|
}
|
|
1079
|
+
const actor = await resolveHttpAuditActor(req, myAgentId);
|
|
1080
|
+
updates.updatedBy = actor.userId;
|
|
1081
|
+
updates.updatedByAgentId = actor.agentId;
|
|
1065
1082
|
|
|
1066
1083
|
const skill = await updateSkill(parsed.params.id, updates as Parameters<typeof updateSkill>[1]);
|
|
1067
1084
|
if (!skill) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IncomingMessage } from "node:http";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveHttpRequesterUserId } from "../be/audit-user";
|
|
3
3
|
import { findUserById } from "../be/users";
|
|
4
4
|
import { can } from "../rbac";
|
|
5
5
|
import { agentFirstPrincipal } from "./request-principal";
|
|
@@ -31,7 +31,7 @@ export async function resolveTaskRequester(
|
|
|
31
31
|
trustedUserId?: string | null,
|
|
32
32
|
): Promise<string | undefined> {
|
|
33
33
|
const trusted =
|
|
34
|
-
trustedUserId === undefined ? await
|
|
34
|
+
trustedUserId === undefined ? await resolveHttpRequesterUserId(req, myAgentId) : trustedUserId;
|
|
35
35
|
if (trusted) return trusted;
|
|
36
36
|
if (process.env.TRUST_BODY_REQUESTED_BY_USER_ID === "false" || !bodyUserId) return undefined;
|
|
37
37
|
// A worker on the shared key is not the operator: its X-Agent-ID names it, so the body
|
package/src/http/tasks.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { AssetKeyAuthorizationError, authorizeAssetKeyWrite } from "../be/asset-key-auth";
|
|
4
|
-
import {
|
|
4
|
+
import { resolveHttpRequesterUserId } from "../be/audit-user";
|
|
5
5
|
import {
|
|
6
6
|
backfillSupersedeTaskResumeTaskId,
|
|
7
7
|
cancelTask,
|
|
@@ -59,8 +59,8 @@ import {
|
|
|
59
59
|
} from "../be/steering";
|
|
60
60
|
import { getTaskCitations, TaskCitationSchema } from "../be/task-citations";
|
|
61
61
|
import { getTaskUiSpec, TaskUiSpecSchema } from "../be/task-ui-spec";
|
|
62
|
-
import { findUserById } from "../be/users";
|
|
63
62
|
import { can, isRbacEnabled, type RbacPrincipal, type RbacResource } from "../rbac";
|
|
63
|
+
import { mirrorSessionPrompt } from "../slack/session-mirror";
|
|
64
64
|
import { chatThreadOfContextKey } from "../tasks/context-key";
|
|
65
65
|
import { TaskCreationBlockedError, TaskRoutingAuthorizationError } from "../tasks/errors";
|
|
66
66
|
import { createTaskWithSiblingAwareness } from "../tasks/sibling-awareness";
|
|
@@ -1140,7 +1140,7 @@ export async function handleTasks(
|
|
|
1140
1140
|
if (!parsed) return true;
|
|
1141
1141
|
|
|
1142
1142
|
// Trusted identity first, then the body hint; see resolveTaskRequester.
|
|
1143
|
-
const trustedUserId = await
|
|
1143
|
+
const trustedUserId = await resolveHttpRequesterUserId(req, myAgentId);
|
|
1144
1144
|
const requestedByUserId = await resolveTaskRequester(
|
|
1145
1145
|
req,
|
|
1146
1146
|
myAgentId,
|
|
@@ -1317,6 +1317,11 @@ export async function handleTasks(
|
|
|
1317
1317
|
},
|
|
1318
1318
|
});
|
|
1319
1319
|
|
|
1320
|
+
// A person's Sessions follow-up shows up in the session's Slack thread too.
|
|
1321
|
+
if (principal.kind === "user" || principal.kind === "operator") {
|
|
1322
|
+
getDbClient().afterCommit(() => mirrorSessionPrompt(task));
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1320
1325
|
createTask.respond(res, 201, task);
|
|
1321
1326
|
} catch (error) {
|
|
1322
1327
|
if (error instanceof TaskRoutingAuthorizationError) {
|
|
@@ -1378,6 +1383,10 @@ export async function handleTasks(
|
|
|
1378
1383
|
jsonError(res, "Task not found", 404);
|
|
1379
1384
|
return true;
|
|
1380
1385
|
}
|
|
1386
|
+
// A draft holds back its mirror until its uploads settle, like its claim.
|
|
1387
|
+
if (existingTask.status === "draft") {
|
|
1388
|
+
getDbClient().afterCommit(() => mirrorSessionPrompt(promoted));
|
|
1389
|
+
}
|
|
1381
1390
|
|
|
1382
1391
|
promoteDraftTaskRoute.respond(res, 200, promoted);
|
|
1383
1392
|
return true;
|
|
@@ -1533,15 +1542,12 @@ export async function handleTasks(
|
|
|
1533
1542
|
return true;
|
|
1534
1543
|
}
|
|
1535
1544
|
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
) {
|
|
1543
|
-
requestedByUserId = (await findUserById(parsed.body.requestedByUserId))?.id;
|
|
1544
|
-
}
|
|
1545
|
+
// Same rules as POST /api/tasks: a non-lead agent cannot name another user.
|
|
1546
|
+
const requestedByUserId = await resolveTaskRequester(
|
|
1547
|
+
req,
|
|
1548
|
+
myAgentId,
|
|
1549
|
+
parsed.body.requestedByUserId,
|
|
1550
|
+
);
|
|
1545
1551
|
|
|
1546
1552
|
try {
|
|
1547
1553
|
const auth = getRequestAuth(req);
|
package/src/http/tool-hooks.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import type { ToolCallEvent } from "../extensions/contract";
|
|
4
|
-
import { dispatchPost, dispatchPre } from "../extensions/dispatcher";
|
|
4
|
+
import { dispatchPost, dispatchPre, hasNativeToolHandlers } from "../extensions/dispatcher";
|
|
5
5
|
import type { RequestInfo } from "../tools/utils";
|
|
6
6
|
import { scrubObject } from "../utils/secret-scrubber";
|
|
7
7
|
import { route } from "./route-def";
|
|
@@ -64,6 +64,22 @@ const toolHookRoute = route({
|
|
|
64
64
|
},
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
+
const toolHookStatusRoute = route({
|
|
68
|
+
method: "get",
|
|
69
|
+
path: "/api/tool-hooks/status",
|
|
70
|
+
pattern: ["api", "tool-hooks", "status"],
|
|
71
|
+
summary: "Whether any enabled extension takes harness-native tool calls",
|
|
72
|
+
description:
|
|
73
|
+
"Worker shims read this before each native tool call and skip `POST /api/tool-hooks` while " +
|
|
74
|
+
"`native` is false, so a swarm with no native-tool extension pays no per-call round trip. " +
|
|
75
|
+
"Shims cache the answer for a short time.",
|
|
76
|
+
tags: ["Extensions"],
|
|
77
|
+
auth: { apiKey: true },
|
|
78
|
+
responses: {
|
|
79
|
+
200: { description: "Native tool hook status", schema: z.object({ native: z.boolean() }) },
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
67
83
|
function header(req: IncomingMessage, name: string): string | undefined {
|
|
68
84
|
const raw = req.headers[name];
|
|
69
85
|
return Array.isArray(raw) ? raw[0] : raw;
|
|
@@ -76,6 +92,10 @@ export async function handleToolHooks(
|
|
|
76
92
|
queryParams: URLSearchParams,
|
|
77
93
|
myAgentId: string | undefined,
|
|
78
94
|
): Promise<boolean> {
|
|
95
|
+
if (toolHookStatusRoute.match(req.method, pathSegments)) {
|
|
96
|
+
toolHookStatusRoute.respond(res, 200, { native: hasNativeToolHandlers() });
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
79
99
|
if (!toolHookRoute.match(req.method, pathSegments)) return false;
|
|
80
100
|
if (!myAgentId) {
|
|
81
101
|
jsonError(res, "Missing X-Agent-ID header", 400);
|
|
@@ -86,11 +106,13 @@ export async function handleToolHooks(
|
|
|
86
106
|
|
|
87
107
|
// Scrub at entry: handlers, extension_runs rows and logs only ever see the scrubbed body.
|
|
88
108
|
const body = scrubObject(parsed.body);
|
|
109
|
+
const sourceTaskId = header(req, "x-source-task-id");
|
|
89
110
|
const requestInfo: RequestInfo = {
|
|
90
111
|
sessionId: undefined,
|
|
91
112
|
agentId: myAgentId,
|
|
92
113
|
runtimeInstanceId: header(req, "x-runtime-instance-id"),
|
|
93
|
-
sourceTaskId
|
|
114
|
+
sourceTaskId,
|
|
115
|
+
auditSourceTaskId: sourceTaskId ?? header(req, "x-audit-source-task-id"),
|
|
94
116
|
contextKey: header(req, "x-context-key"),
|
|
95
117
|
callOrigin: "native",
|
|
96
118
|
harness: body.harness,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveHttpRequesterUserId } from "../../be/audit-user";
|
|
4
4
|
import { ensureHttpPermission } from "../config";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -37,5 +37,5 @@ export async function ensureTrackerAuthorizeAdmin(
|
|
|
37
37
|
agentId,
|
|
38
38
|
);
|
|
39
39
|
if (!allowed) return null;
|
|
40
|
-
return { userId: await
|
|
40
|
+
return { userId: await resolveHttpRequesterUserId(req, agentId) };
|
|
41
41
|
}
|