@desplega.ai/agent-swarm 2.13.1 → 2.13.2
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/README.md +1 -1
- package/dist/{acp-adapter-xtj40wd8.js → acp-adapter-x1qqgzwx.js} +5 -5
- package/dist/{acp-targets-n7vm5atw.js → acp-targets-mz8c5dnt.js} +4 -4
- package/dist/{actions-hq6wp9xv.js → actions-5ft3qp5a.js} +25 -25
- package/dist/{agent-fs-provision-y0qc1rdd.js → agent-fs-provision-6fgz7wvz.js} +4 -4
- package/dist/{amp-adapter-1qqs6h91.js → amp-adapter-nthn8ezm.js} +1 -1
- package/dist/{app-7m4z44rv.js → app-535m78qw.js} +8 -8
- package/dist/{approval-notifications-8sr41gjx.js → approval-notifications-dewbk403.js} +9 -9
- package/dist/{assistant-hkczwfv6.js → assistant-39zyabv2.js} +25 -25
- package/dist/{boot-args-schema-8025snev.js → boot-args-schema-bqv5bf77.js} +1 -1
- package/dist/{boot-reembed-4bbpxjh1.js → boot-reembed-157c0gcz.js} +1 -1
- package/dist/{boot-reembed-15m87nr1.js → boot-reembed-fas7z3zn.js} +1 -1
- package/dist/{boot-scrub-sweep-eajr97e9.js → boot-scrub-sweep-tmec0be2.js} +2 -2
- package/dist/{boot-seeds-9cwy39jx.js → boot-seeds-32zm50x2.js} +4 -4
- package/dist/{claude-adapter-g61wa4rt.js → claude-adapter-gwq7x2nj.js} +2 -2
- package/dist/{claude-managed-adapter-znkk0prm.js → claude-managed-adapter-rkvw6fvq.js} +2 -2
- package/dist/{claude-managed-setup-f1wndkr2.js → claude-managed-setup-0vgz4d1j.js} +4 -4
- package/dist/{claude-sdk-session-687xzf21.js → claude-sdk-session-5wbwxy8c.js} +11964 -11769
- package/dist/{cli-snypfjgj.js → cli-0f7n3td3.js} +1 -1
- package/dist/{cli-0m77n7ej.js → cli-1f48qdnb.js} +54 -12
- package/dist/{cli-04103ryh.js → cli-1gevjrc1.js} +1 -1
- package/dist/{cli-a8ts6x1n.js → cli-2wde56gv.js} +5 -5
- package/dist/{cli-aebswqmz.js → cli-31vt7baf.js} +14 -14
- package/dist/{cli-cn6fpa1p.js → cli-4djg31jh.js} +1 -1
- package/dist/{cli-bjmq14k9.js → cli-5k1hvycs.js} +3 -3
- package/dist/{cli-mmw2sjaf.js → cli-62fjschk.js} +1 -1
- package/dist/{cli-t90k0phh.js → cli-69eq6gdk.js} +15 -15
- package/dist/{cli-dd57p1gd.js → cli-6rmryz03.js} +2 -2
- package/dist/{cli-byxsctca.js → cli-7m6bbtab.js} +6 -6
- package/dist/{cli-c8kqmzzf.js → cli-8a4qg44m.js} +1 -1
- package/dist/{cli-8rbkw18r.js → cli-8qvte9hn.js} +2 -2
- package/dist/{cli-h03j6je3.js → cli-a6rzw649.js} +2 -2
- package/dist/{cli-w41bvvms.js → cli-b0kqw55g.js} +1 -1
- package/dist/{cli-84xtgbn6.js → cli-b0m3bg0f.js} +100 -2
- package/dist/{cli-zaate0rd.js → cli-c9bwawf9.js} +2 -2
- package/dist/{cli-4mj5g29m.js → cli-cs26ed89.js} +6 -6
- package/dist/{cli-yeh3g1q6.js → cli-d0jb2qnt.js} +23 -23
- package/dist/{cli-cp0m07wb.js → cli-d528acsw.js} +1 -1
- package/dist/{cli-fn8aj7gb.js → cli-dnvmwsvc.js} +95 -68
- package/dist/{cli-w6c6dj91.js → cli-e87fg3en.js} +1 -1
- package/dist/{cli-h9bejmkf.js → cli-erh1rgh4.js} +49 -26
- package/dist/{cli-9xx36trj.js → cli-ewb028rs.js} +2 -2
- package/dist/{cli-hs3mqswp.js → cli-f1sdh8ca.js} +4 -4
- package/dist/{cli-zvpkrgsc.js → cli-fcwrd7bh.js} +3 -3
- package/dist/{cli-sfajkbd7.js → cli-fgm2mad9.js} +2 -2
- package/dist/{cli-32xndx6b.js → cli-g0b3ma7r.js} +1 -1
- package/dist/{cli-nk8swfpx.js → cli-gc7jkf4a.js} +3 -3
- package/dist/{cli-z6m6xzxt.js → cli-getrvmtx.js} +26 -5
- package/dist/{cli-y6qqbpwc.js → cli-j2ybkdk2.js} +1 -1
- package/dist/{cli-1dr5at77.js → cli-jkkcm72j.js} +10 -10
- package/dist/{cli-cqxwjb93.js → cli-ka13xx6b.js} +1 -1
- package/dist/{cli-4h90xaet.js → cli-m1wddksc.js} +1 -1
- package/dist/{cli-qx1dwrr5.js → cli-n14r8h4n.js} +2 -2
- package/dist/{cli-jhtvt7gn.js → cli-n46d87mj.js} +3 -3
- package/dist/{cli-13t0smbk.js → cli-nkfv398a.js} +185 -58
- package/dist/{cli-p7g7wd9n.js → cli-nvqq3232.js} +7 -7
- package/dist/{cli-0a336ze7.js → cli-r4fphq38.js} +3 -3
- package/dist/{cli-4tbvndmm.js → cli-r8ddn0hf.js} +1 -1
- package/dist/{cli-3m8vqehw.js → cli-rvhaahfv.js} +2 -2
- package/dist/{cli-cd9acnvd.js → cli-s08zsqva.js} +2 -2
- package/dist/{cli-w24f3j49.js → cli-sjk85d7v.js} +6 -5
- package/dist/{cli-grcc2h2g.js → cli-t9nxq30h.js} +6 -6
- package/dist/{cli-6r1dwegd.js → cli-tbdw3f92.js} +2 -2
- package/dist/{cli-0fx95c06.js → cli-tceqvv6h.js} +2 -2
- package/dist/{cli-tzzas8rb.js → cli-tgmate57.js} +2 -2
- package/dist/{cli-3zyme1wt.js → cli-wdtqkqnq.js} +3 -3
- package/dist/{cli-8cmjkbvj.js → cli-x7aqhxj5.js} +1 -1
- package/dist/{cli-7ewre3dm.js → cli-xerdrnqs.js} +2 -2
- package/dist/{cli-c0tyzt73.js → cli-xysy1g8x.js} +1 -1
- package/dist/{cli-1b5axkt1.js → cli-zm6bkx3e.js} +2 -2
- package/dist/{cli-1carhg8g.js → cli-zqy28rwx.js} +2 -2
- package/dist/cli.js +17 -16
- package/dist/{codex-adapter-ysfg6ty3.js → codex-adapter-x25xfbnh.js} +2 -2
- package/dist/{codex-session-runner-823scr6g.js → codex-session-runner-kn5xnrvp.js} +2 -2
- package/dist/{commands-5rbm07fz.js → commands-8n59gxmy.js} +3 -3
- package/dist/{controllers-connect-34jzhfft.js → controllers-connect-09gvkrhc.js} +24 -24
- package/dist/core-2b8bv6ny.js +42 -0
- package/dist/{db-6bkgbfwk.js → db-e71keqxk.js} +3 -3
- package/dist/{db-hcj16x7z.js → db-spg81qtr.js} +1 -1
- package/dist/{dispatcher-jgjqrfzv.js → dispatcher-fr4vawwb.js} +23 -23
- package/dist/{easter-egg-3d-w17nsny6.js → easter-egg-3d-ac9tv9a6.js} +1 -1
- package/dist/{embedding-space-v06fwy7b.js → embedding-space-an77f45k.js} +6 -6
- package/dist/{embeddings-g50dxea4.js → embeddings-jkrehejr.js} +1 -1
- package/dist/{execute-1n36haw1.js → execute-3mys4nta.js} +1 -1
- package/dist/{external-channel-43tv8pg6.js → external-channel-s6zxpts9.js} +2 -2
- package/dist/{fx-adapter-bvh05t4a.js → fx-adapter-4yet1c4f.js} +6 -6
- package/dist/{grok-adapter-my5j8mdf.js → grok-adapter-8ge6tw7m.js} +6 -6
- package/dist/handlers-0r9evrdj.js +41 -0
- package/dist/{heartbeat-sf3nk937.js → heartbeat-jjpb44e5.js} +25 -25
- package/dist/{hook-m1m9dm6w.js → hook-68gbs87k.js} +1 -1
- package/dist/{hook-dqph1e05.js → hook-y6n23zzj.js} +1 -1
- package/dist/{http-w0th1cz9.js → http-8c6y008s.js} +297 -97
- package/dist/{index-ffba0z8q.js → index-0vthtbc2.js} +20 -18
- package/dist/index-1v23363p.js +39 -0
- package/dist/index-30qw6vyw.js +44 -0
- package/dist/index-6bm3w6cn.js +40 -0
- package/dist/{index-gkpfgpg7.js → index-6h3r0vpe.js} +1 -1
- package/dist/{index-e8pz8qdg.js → index-7dgxveck.js} +2 -2
- package/dist/{index-k8ajc0g0.js → index-maddg9ys.js} +1 -1
- package/dist/{index-y4vd4mhn.js → index-mbpxhc4w.js} +1 -1
- package/dist/index-rz8ve510.js +569 -0
- package/dist/{index-c0e8en64.js → index-we3nd2t0.js} +1 -1
- package/dist/{index-pb03vans.js → index-xcw7hjt5.js} +25 -25
- package/dist/{index-ez823q84.js → index-ym9fgxad.js} +1 -1
- package/dist/{keepalive-2v06q2e8.js → keepalive-7e9r5dvp.js} +4 -4
- package/dist/lead-3jpc7kcr.js +79 -0
- package/dist/{maintenance-vx7vjhhy.js → maintenance-d3erjvcg.js} +1 -1
- package/dist/{oauth-refresh-sweep-g06k4bza.js → oauth-refresh-sweep-0qh70988.js} +3 -3
- package/dist/{object-webhooks-3dzdq4fm.js → object-webhooks-ac7v2q5p.js} +7 -7
- package/dist/{onboard-232pazny.js → onboard-5yphtken.js} +3 -3
- package/dist/{opencode-adapter-t0paqbh8.js → opencode-adapter-0xvyba4m.js} +3 -3
- package/dist/{otel-impl-kmpkyp4y.js → otel-impl-svqp691q.js} +1 -1
- package/dist/{pending-x0z3vx1x.js → pending-bn4xe5br.js} +24 -24
- package/dist/{pi-mono-adapter-7pmypn6d.js → pi-mono-adapter-763s8a3w.js} +6 -6
- package/dist/{pricing-refresh-ytjmtyd7.js → pricing-refresh-kfc215mf.js} +2 -2
- package/dist/{rbac-roles-fgm5mxr2.js → rbac-roles-3bznvkpt.js} +3 -3
- package/dist/{rbac-roles-xyaxekh3.js → rbac-roles-6r4h2ghj.js} +2 -2
- package/dist/{render-v2-ws972g4r.js → render-v2-f3qedbpy.js} +8 -8
- package/dist/{resume-m6mjzhkp.js → resume-vcag4ann.js} +11 -11
- package/dist/{runtime-zzpc0c8a.js → runtime-x0s55z2t.js} +1 -1
- package/dist/{session-access-vp35xs91.js → session-access-nwzve8q2.js} +5 -5
- package/dist/{session-source-backfill-p73e8zbe.js → session-source-backfill-jpqfzmgz.js} +1 -1
- package/dist/{setup-r4kd7rxg.js → setup-d2smwaem.js} +1 -1
- package/dist/thread-buffer-8fc703jc.js +42 -0
- package/dist/{tree-visibility-07h2tbs2.js → tree-visibility-dwzc8en0.js} +2 -2
- package/dist/{user-merge-jobs-96vg9rpe.js → user-merge-jobs-4ce7kma2.js} +3 -3
- package/dist/{virtual-modules-vgn3f2x4.js → virtual-modules-78a6yw71.js} +1 -1
- package/dist/{work-objects-74hbcx3e.js → work-objects-m0w1e7q8.js} +26 -26
- package/dist/worker-3p2vq107.js +79 -0
- package/dist/{worker-follow-up-ezavwn5d.js → worker-follow-up-e3t6f895.js} +23 -23
- package/openapi.json +3 -2
- package/package.json +6 -5
- package/src/be/migrations/341_user_token_expiry.sql +4 -0
- package/src/be/scripts/run-credential.ts +55 -1
- package/src/be/scripts/typecheck.ts +4 -4
- package/src/be/scripts/user-code-mode.ts +160 -0
- package/src/be/users.ts +48 -7
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/http/script-connection-proxy.ts +18 -6
- package/src/http/scripts.ts +2 -11
- package/src/http/users.ts +1 -0
- package/src/integrations/chat-sdk/adapters.ts +29 -0
- package/src/integrations/chat-sdk/limits.ts +3 -0
- package/src/integrations/chat-sdk/rocketchat/README.md +8 -0
- package/src/integrations/chat-sdk/rocketchat/index.ts +790 -0
- package/src/integrations/chat-sdk/rocketchat/markdown.ts +210 -0
- package/src/integrations/chat-sdk/rocketchat/types.ts +249 -0
- package/src/integrations/chat-sdk/runtime.ts +11 -5
- package/src/integrations/chat-sdk/schema.ts +37 -3
- package/src/integrations/chat-sdk/status.ts +9 -0
- package/src/providers/amp-adapter.ts +1 -1
- package/src/rbac/legacy-policy.ts +1 -0
- package/src/rbac/permissions.ts +4 -0
- package/src/scripts-runtime/executors/native.ts +225 -67
- package/src/scripts-runtime/mcp-client.ts +2 -1
- package/src/scripts-runtime/swarm-sdk.ts +2 -1
- package/src/scripts-runtime/types/stdlib.d.ts +4 -4
- package/src/scripts-runtime/types/swarm-sdk.d.ts +4 -4
- package/src/server-user.ts +98 -0
- package/src/tests/chat-sdk-rocketchat-vendored.test.ts +67 -0
- package/src/tests/chat-sdk-status-route.test.ts +13 -1
- package/src/tests/codex-app-server.test.ts +4 -6
- package/src/tests/mcp-user-route.test.ts +10 -1
- package/src/tests/script-connections-mcp.test.ts +14 -10
- package/src/tests/script-connections-sql.test.ts +6 -2
- package/src/tests/script-connections.test.ts +2 -0
- package/src/tools/script-common.ts +37 -22
- package/src/tools/script-query-types.ts +1 -1
- package/src/tools/script-run.ts +1 -1
- package/src/tools/script-search.ts +12 -10
- package/src/tools/utils.ts +7 -1
- package/templates/skills/chat-sdk/content.md +2 -2
- package/templates/skills/swarm-docs/content.md +2 -0
- package/dist/core-kdehq26g.js +0 -42
- package/dist/handlers-wyymeeqh.js +0 -41
- package/dist/index-22khdtby.js +0 -44
- package/dist/index-np0582ac.js +0 -40
- package/dist/index-vgkrj1jt.js +0 -39
- package/dist/lead-55z813ng.js +0 -79
- package/dist/thread-buffer-cm2nzq6t.js +0 -42
- package/dist/worker-5pn2vzx6.js +0 -79
- package/dist/{cli-5v6b2am8.js → cli-bp2rt28p.js} +4 -4
- /package/dist/{cli-m4ejz4nj.js → cli-cah298e5.js} +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import"./cli-erh1rgh4.js";
|
|
2
|
+
import"./cli-n14r8h4n.js";
|
|
3
|
+
import"./cli-8qvte9hn.js";
|
|
4
|
+
import"./cli-m1wddksc.js";
|
|
5
|
+
import"./cli-vx9acp12.js";
|
|
6
|
+
import"./cli-ka13xx6b.js";
|
|
7
|
+
import"./cli-e87fg3en.js";
|
|
8
|
+
import"./cli-vr4eyq6p.js";
|
|
9
|
+
import"./cli-r8ddn0hf.js";
|
|
10
|
+
import"./cli-69eq6gdk.js";
|
|
11
|
+
import"./cli-f1sdh8ca.js";
|
|
12
|
+
import"./cli-fcwrd7bh.js";
|
|
13
|
+
import {
|
|
14
|
+
getEnabledCapabilities,
|
|
15
|
+
init_server
|
|
16
|
+
} from "./cli-dnvmwsvc.js";
|
|
17
|
+
import"./cli-y260hgep.js";
|
|
18
|
+
import"./cli-tceqvv6h.js";
|
|
19
|
+
import"./cli-2wde56gv.js";
|
|
20
|
+
import"./cli-tgmate57.js";
|
|
21
|
+
import"./cli-qn79645p.js";
|
|
22
|
+
import {
|
|
23
|
+
runAgent
|
|
24
|
+
} from "./cli-d0jb2qnt.js";
|
|
25
|
+
import"./cli-vdfngx2g.js";
|
|
26
|
+
import"./cli-zm6bkx3e.js";
|
|
27
|
+
import"./cli-77cd6gy8.js";
|
|
28
|
+
import"./cli-zkbz8m2q.js";
|
|
29
|
+
import"./cli-hv3820ez.js";
|
|
30
|
+
import"./cli-0xwb7zpt.js";
|
|
31
|
+
import"./cli-8a4qg44m.js";
|
|
32
|
+
import"./cli-x5yb8zc8.js";
|
|
33
|
+
import"./cli-cmgdptmx.js";
|
|
34
|
+
import"./cli-gq6qhmrr.js";
|
|
35
|
+
import"./cli-2v4xxnx2.js";
|
|
36
|
+
import"./cli-d82btycs.js";
|
|
37
|
+
import"./cli-0726awxw.js";
|
|
38
|
+
import"./cli-62fjschk.js";
|
|
39
|
+
import"./cli-s08zsqva.js";
|
|
40
|
+
import"./cli-snxhtehz.js";
|
|
41
|
+
import"./cli-cah298e5.js";
|
|
42
|
+
import"./cli-g0b3ma7r.js";
|
|
43
|
+
import"./cli-at67kvnp.js";
|
|
44
|
+
import"./cli-kr5tjjtz.js";
|
|
45
|
+
import"./cli-6rmryz03.js";
|
|
46
|
+
import"./cli-gedf48yw.js";
|
|
47
|
+
import"./cli-je587f74.js";
|
|
48
|
+
import"./cli-t25rq8mg.js";
|
|
49
|
+
import"./cli-d528acsw.js";
|
|
50
|
+
import"./cli-1f48qdnb.js";
|
|
51
|
+
import"./cli-bp2rt28p.js";
|
|
52
|
+
import"./cli-rvhaahfv.js";
|
|
53
|
+
import"./cli-ewb028rs.js";
|
|
54
|
+
import"./cli-c9bwawf9.js";
|
|
55
|
+
import"./cli-nkfv398a.js";
|
|
56
|
+
import"./cli-xerdrnqs.js";
|
|
57
|
+
import"./cli-wdtqkqnq.js";
|
|
58
|
+
import"./cli-j2ybkdk2.js";
|
|
59
|
+
import"./cli-4djg31jh.js";
|
|
60
|
+
import"./cli-jkkcm72j.js";
|
|
61
|
+
import"./cli-b0m3bg0f.js";
|
|
62
|
+
import"./cli-b0kqw55g.js";
|
|
63
|
+
import"./cli-xysy1g8x.js";
|
|
64
|
+
import"./cli-getrvmtx.js";
|
|
65
|
+
|
|
66
|
+
// src/commands/worker.ts
|
|
67
|
+
init_server();
|
|
68
|
+
var workerConfig = {
|
|
69
|
+
role: "worker",
|
|
70
|
+
defaultPrompt: "/start-worker",
|
|
71
|
+
metadataType: "worker_metadata",
|
|
72
|
+
capabilities: getEnabledCapabilities()
|
|
73
|
+
};
|
|
74
|
+
async function runWorker(opts) {
|
|
75
|
+
return runAgent(workerConfig, opts);
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
runWorker
|
|
79
|
+
};
|
|
@@ -11,32 +11,32 @@ import {
|
|
|
11
11
|
createRerouteDecisionTask2,
|
|
12
12
|
createPoolStarvationDecisionTask2,
|
|
13
13
|
init_worker_follow_up
|
|
14
|
-
} from "./cli-
|
|
15
|
-
import"./cli-
|
|
16
|
-
import"./cli-
|
|
17
|
-
import"./cli-
|
|
18
|
-
import"./cli-
|
|
19
|
-
import"./cli-
|
|
20
|
-
import"./cli-
|
|
14
|
+
} from "./cli-dnvmwsvc.js";
|
|
15
|
+
import"./cli-8qvte9hn.js";
|
|
16
|
+
import"./cli-m1wddksc.js";
|
|
17
|
+
import"./cli-nkfv398a.js";
|
|
18
|
+
import"./cli-xerdrnqs.js";
|
|
19
|
+
import"./cli-wdtqkqnq.js";
|
|
20
|
+
import"./cli-j2ybkdk2.js";
|
|
21
21
|
import"./cli-y260hgep.js";
|
|
22
|
-
import"./cli-
|
|
23
|
-
import"./cli-
|
|
24
|
-
import"./cli-
|
|
25
|
-
import"./cli-
|
|
26
|
-
import"./cli-
|
|
27
|
-
import"./cli-
|
|
28
|
-
import"./cli-
|
|
29
|
-
import"./cli-
|
|
30
|
-
import"./cli-
|
|
31
|
-
import"./cli-
|
|
22
|
+
import"./cli-4djg31jh.js";
|
|
23
|
+
import"./cli-fcwrd7bh.js";
|
|
24
|
+
import"./cli-jkkcm72j.js";
|
|
25
|
+
import"./cli-f1sdh8ca.js";
|
|
26
|
+
import"./cli-2wde56gv.js";
|
|
27
|
+
import"./cli-tceqvv6h.js";
|
|
28
|
+
import"./cli-69eq6gdk.js";
|
|
29
|
+
import"./cli-e87fg3en.js";
|
|
30
|
+
import"./cli-ka13xx6b.js";
|
|
31
|
+
import"./cli-r8ddn0hf.js";
|
|
32
|
+
import"./cli-b0m3bg0f.js";
|
|
32
33
|
import"./cli-vr4eyq6p.js";
|
|
33
|
-
import"./cli-
|
|
34
|
-
import"./cli-w41bvvms.js";
|
|
34
|
+
import"./cli-b0kqw55g.js";
|
|
35
35
|
import"./cli-vx9acp12.js";
|
|
36
|
-
import"./cli-
|
|
37
|
-
import"./cli-
|
|
38
|
-
import"./cli-
|
|
39
|
-
import"./cli-
|
|
36
|
+
import"./cli-xysy1g8x.js";
|
|
37
|
+
import"./cli-n14r8h4n.js";
|
|
38
|
+
import"./cli-getrvmtx.js";
|
|
39
|
+
import"./cli-erh1rgh4.js";
|
|
40
40
|
init_worker_follow_up();
|
|
41
41
|
|
|
42
42
|
export {
|
package/openapi.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"openapi": "3.1.0",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Agent Swarm API",
|
|
5
|
-
"version": "2.13.
|
|
5
|
+
"version": "2.13.2",
|
|
6
6
|
"description": "Multi-agent orchestration API for Claude Code, Codex, and Gemini CLI. Enables task distribution, agent communication, and service discovery.\n\nMCP tools are documented separately in [MCP.md](./MCP.md)."
|
|
7
7
|
},
|
|
8
8
|
"servers": [
|
|
@@ -27402,7 +27402,8 @@
|
|
|
27402
27402
|
"telegram",
|
|
27403
27403
|
"slack",
|
|
27404
27404
|
"discord",
|
|
27405
|
-
"teams"
|
|
27405
|
+
"teams",
|
|
27406
|
+
"rocketchat"
|
|
27406
27407
|
]
|
|
27407
27408
|
},
|
|
27408
27409
|
"configured": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@desplega.ai/agent-swarm",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.2",
|
|
4
4
|
"description": "agent-swarm.dev — an open-source operating system for AI work: a lead agent breaks goals into tasks, routes them to specialized workers such as Claude Code or Codex, runs each worker in an isolated container, and preserves shared memory, tools, schedules, and review gates so delegated work compounds across sessions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-swarm.dev",
|
|
@@ -207,19 +207,20 @@
|
|
|
207
207
|
"bun": ">=1.3.12"
|
|
208
208
|
},
|
|
209
209
|
"dependencies": {
|
|
210
|
-
"@agentclientprotocol/sdk": "2.
|
|
210
|
+
"@agentclientprotocol/sdk": "2.7.0",
|
|
211
211
|
"@ai-sdk/openai": "^3.0.41",
|
|
212
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
212
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.325",
|
|
213
213
|
"@anthropic-ai/sdk": "^1.8.0",
|
|
214
214
|
"@asteasolutions/zod-to-openapi": "^8.0.0",
|
|
215
215
|
"@aws-sdk/client-bedrock": "3.1048.0",
|
|
216
216
|
"@boxd-sh/sdk": "0.2.20",
|
|
217
217
|
"@chat-adapter/discord": "4.45.0",
|
|
218
|
+
"@chat-adapter/shared": "4.45.0",
|
|
218
219
|
"@chat-adapter/slack": "4.45.0",
|
|
219
220
|
"@chat-adapter/teams": "4.45.0",
|
|
220
221
|
"@chat-adapter/telegram": "4.45.0",
|
|
221
222
|
"@cursor/sdk": "1.3.1",
|
|
222
|
-
"@desplega.ai/agent-fs-just-bash": "0.18.
|
|
223
|
+
"@desplega.ai/agent-fs-just-bash": "0.18.28",
|
|
223
224
|
"@desplega.ai/business-use": "^0.4.2",
|
|
224
225
|
"@earendil-works/pi-agent-core": "^1.5.2",
|
|
225
226
|
"@earendil-works/pi-ai": "^1.5.2",
|
|
@@ -231,7 +232,7 @@
|
|
|
231
232
|
"@json-render/core": "0.22.0",
|
|
232
233
|
"@linear/sdk": "^77.0.0",
|
|
233
234
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
234
|
-
"@openai/codex": "0.
|
|
235
|
+
"@openai/codex": "0.169.0",
|
|
235
236
|
"@openfort/openfort-node": "^0.9.1",
|
|
236
237
|
"@opentelemetry/api": "^1.9.1",
|
|
237
238
|
"@opentelemetry/api-logs": "^0.218.0",
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type RunScriptInput, type RunScriptOutput, runScript } from "../../scripts-runtime/loader";
|
|
2
2
|
import { getAgentById } from "../db";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
mintScriptRunToken,
|
|
5
|
+
mintUserScriptRunToken,
|
|
6
|
+
revokeSessionToken,
|
|
7
|
+
revokeUserScriptRunToken,
|
|
8
|
+
} from "../users";
|
|
4
9
|
|
|
5
10
|
/**
|
|
6
11
|
* Backstop lifetime of a script run's api credential. The run revokes its
|
|
@@ -10,6 +15,16 @@ import { mintScriptRunToken, revokeSessionToken } from "../users";
|
|
|
10
15
|
*/
|
|
11
16
|
const SCRIPT_RUN_TOKEN_TTL_MS = 15 * 60 * 1000;
|
|
12
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Lifetime of a user MCP run's token. `SCRIPT_RUN_USER_TOKEN_TTL_MS` is a test
|
|
20
|
+
* seam (the e2e suite sets it so a run can watch its own token expire); it can
|
|
21
|
+
* only shorten the backstop, never extend it.
|
|
22
|
+
*/
|
|
23
|
+
function userScriptRunTokenTtlMs(): number {
|
|
24
|
+
const override = Number(process.env.SCRIPT_RUN_USER_TOKEN_TTL_MS);
|
|
25
|
+
return override > 0 && override < SCRIPT_RUN_TOKEN_TTL_MS ? override : SCRIPT_RUN_TOKEN_TTL_MS;
|
|
26
|
+
}
|
|
27
|
+
|
|
13
28
|
export type ScriptApiCredential = {
|
|
14
29
|
/**
|
|
15
30
|
* The bearer the script's `ctx.swarm` SDK calls present to the api, or
|
|
@@ -74,3 +89,42 @@ export async function runScriptWithRunCredential(
|
|
|
74
89
|
await credential.release();
|
|
75
90
|
}
|
|
76
91
|
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Run a script for a user, with no executing agent: its `ctx.swarm` calls
|
|
95
|
+
* present a short-lived token bound to `userId`, so the api applies that
|
|
96
|
+
* user's permissions, and the run gets no agent's credentials, connections or
|
|
97
|
+
* deployment egress secrets. The token is revoked when the run ends.
|
|
98
|
+
*/
|
|
99
|
+
export async function runScriptAsUserWithRunCredential(
|
|
100
|
+
input: Omit<
|
|
101
|
+
RunScriptInput,
|
|
102
|
+
| "apiKey"
|
|
103
|
+
| "agentId"
|
|
104
|
+
| "egressSecrets"
|
|
105
|
+
| "failedBindings"
|
|
106
|
+
| "userConfig"
|
|
107
|
+
| "apiConnections"
|
|
108
|
+
| "mcpConnections"
|
|
109
|
+
| "agentFs"
|
|
110
|
+
>,
|
|
111
|
+
userId: string,
|
|
112
|
+
): Promise<RunScriptOutput> {
|
|
113
|
+
const token = await mintUserScriptRunToken(userId, userScriptRunTokenTtlMs());
|
|
114
|
+
try {
|
|
115
|
+
return await runScript({
|
|
116
|
+
...input,
|
|
117
|
+
apiKey: token.plaintext,
|
|
118
|
+
// Empty: the SDK then sends no X-Agent-ID, which the api refuses on a user token.
|
|
119
|
+
agentId: "",
|
|
120
|
+
// Explicit empties: omitted, the loader falls back to deployment-wide bindings.
|
|
121
|
+
egressSecrets: [],
|
|
122
|
+
failedBindings: [],
|
|
123
|
+
userConfig: {},
|
|
124
|
+
apiConnections: [],
|
|
125
|
+
mcpConnections: [],
|
|
126
|
+
});
|
|
127
|
+
} finally {
|
|
128
|
+
await revokeUserScriptRunToken(token.tokenId);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -577,10 +577,10 @@ export interface SwarmSdk {
|
|
|
577
577
|
|
|
578
578
|
// --- write: chat sdk ---
|
|
579
579
|
chat_reply(args: { text?: string; card?: unknown }): Promise<unknown>;
|
|
580
|
-
chat_post(args: { adapter: "telegram" | "slack" | "discord" | "teams"; threadId?: string; channelId?: string; text?: string; card?: unknown }): Promise<unknown>;
|
|
581
|
-
chat_openDm(args: { adapter: "telegram" | "slack" | "discord" | "teams"; userId: string }): Promise<unknown>;
|
|
582
|
-
chat_registerChannel(args: { adapter: "telegram" | "slack" | "discord" | "teams"; channelId: string; agentId?: string; workflowId?: string; name?: string }): Promise<unknown>;
|
|
583
|
-
chat_unregisterChannel(args: { adapter: "telegram" | "slack" | "discord" | "teams"; channelId: string }): Promise<unknown>;
|
|
580
|
+
chat_post(args: { adapter: "telegram" | "slack" | "discord" | "teams" | "rocketchat"; threadId?: string; channelId?: string; text?: string; card?: unknown }): Promise<unknown>;
|
|
581
|
+
chat_openDm(args: { adapter: "telegram" | "slack" | "discord" | "teams" | "rocketchat"; userId: string }): Promise<unknown>;
|
|
582
|
+
chat_registerChannel(args: { adapter: "telegram" | "slack" | "discord" | "teams" | "rocketchat"; channelId: string; agentId?: string; workflowId?: string; name?: string }): Promise<unknown>;
|
|
583
|
+
chat_unregisterChannel(args: { adapter: "telegram" | "slack" | "discord" | "teams" | "rocketchat"; channelId: string }): Promise<unknown>;
|
|
584
584
|
|
|
585
585
|
// --- write: messaging (internal) ---
|
|
586
586
|
message_post(args: { channel?: string; content: string; to?: string }): Promise<unknown>;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { isExecutorAllowedByDeployment } from "../../scripts-runtime/executors/registry";
|
|
2
|
+
import type { ScriptRecord } from "../../types";
|
|
3
|
+
import { scrubObject, scrubSecrets } from "../../utils/secret-scrubber";
|
|
4
|
+
import { recordInlineScriptRun } from "../db";
|
|
5
|
+
import { getScript } from "./db";
|
|
6
|
+
import { type ScriptSearchResult, searchScripts } from "./embeddings";
|
|
7
|
+
import { runScriptAsUserWithRunCredential } from "./run-credential";
|
|
8
|
+
import { refuseSourceWithSecrets } from "./source-secrets";
|
|
9
|
+
import { scriptStdlibTypesWithGeneratedApis } from "./typecheck";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Code mode on the user MCP: search, type and run scripts as a person, with no
|
|
13
|
+
* agent and no task. A user has no agent scope, so only global scripts are
|
|
14
|
+
* visible. Results mirror the `/api/scripts/*` bodies so the tools render them
|
|
15
|
+
* the same way the agent-side tools do.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** `script_runs.agentId` for a user MCP run, which has no agent (like "schedule"). */
|
|
19
|
+
export const USER_SCRIPT_RUN_AGENT_ID = "user-mcp";
|
|
20
|
+
|
|
21
|
+
export type UserCodeModeResponse = { status: number; body: unknown };
|
|
22
|
+
|
|
23
|
+
/** The `/api/scripts/search` result rows, shared with that route. */
|
|
24
|
+
export function toScriptSearchResults(matches: ScriptSearchResult[]) {
|
|
25
|
+
return matches.map(({ script, score }) => ({
|
|
26
|
+
name: script.name,
|
|
27
|
+
signature: JSON.parse(script.signatureJson),
|
|
28
|
+
argsJsonSchema: script.argsJsonSchema
|
|
29
|
+
? (JSON.parse(script.argsJsonSchema) as Record<string, unknown>)
|
|
30
|
+
: null,
|
|
31
|
+
description: script.description,
|
|
32
|
+
score,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function searchScriptsForUser(args: {
|
|
37
|
+
query: string;
|
|
38
|
+
limit?: number;
|
|
39
|
+
}): Promise<UserCodeModeResponse> {
|
|
40
|
+
const matches = await searchScripts({ query: args.query, scope: "global", limit: args.limit });
|
|
41
|
+
return { status: 200, body: { results: toScriptSearchResults(matches) } };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// A user run gets no agent connections or apps, so its types carry none.
|
|
45
|
+
const EMPTY_API_TYPES = "export interface ScriptApiRegistry {}\n";
|
|
46
|
+
const EMPTY_MCP_TYPES = "export interface ScriptMcpRegistry {}\n";
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* `stdlibTypes` is the whole authoring surface: the `stdlib` module plus the
|
|
50
|
+
* full `swarm-sdk` module, so it alone is enough to write a script.
|
|
51
|
+
*/
|
|
52
|
+
export async function scriptTypesForUser(name?: string): Promise<UserCodeModeResponse> {
|
|
53
|
+
let script: ScriptRecord | null = null;
|
|
54
|
+
if (name) {
|
|
55
|
+
script = await getScript({ name, scope: "global" });
|
|
56
|
+
if (!script) return { status: 404, body: { error: "Script not found" } };
|
|
57
|
+
}
|
|
58
|
+
const stdlibTypes = await scriptStdlibTypesWithGeneratedApis(
|
|
59
|
+
EMPTY_API_TYPES,
|
|
60
|
+
EMPTY_MCP_TYPES,
|
|
61
|
+
"",
|
|
62
|
+
);
|
|
63
|
+
if (!script) return { status: 200, body: { stdlibTypes } };
|
|
64
|
+
return {
|
|
65
|
+
status: 200,
|
|
66
|
+
body: {
|
|
67
|
+
signature: JSON.parse(script.signatureJson),
|
|
68
|
+
argsJsonSchema: script.argsJsonSchema
|
|
69
|
+
? (JSON.parse(script.argsJsonSchema) as Record<string, unknown>)
|
|
70
|
+
: null,
|
|
71
|
+
stdlibTypes,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function runScriptForUser(args: {
|
|
77
|
+
userId: string;
|
|
78
|
+
name?: string;
|
|
79
|
+
source?: string;
|
|
80
|
+
args?: unknown;
|
|
81
|
+
}): Promise<UserCodeModeResponse> {
|
|
82
|
+
if (!args.name === !args.source) {
|
|
83
|
+
return { status: 400, body: { error: "Pass exactly one of name or source" } };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let source = args.source as string;
|
|
87
|
+
let fsMode: ScriptRecord["fsMode"] = "none";
|
|
88
|
+
let executor: ScriptRecord["executor"] = null;
|
|
89
|
+
if (args.name) {
|
|
90
|
+
const script = await getScript({ name: args.name, scope: "global" });
|
|
91
|
+
if (!script) return { status: 404, body: { error: "Script not found" } };
|
|
92
|
+
({ source, fsMode, executor } = script);
|
|
93
|
+
} else {
|
|
94
|
+
// The run row records the source: refuse an embedded secret before it runs or persists.
|
|
95
|
+
const refusal = refuseSourceWithSecrets(source);
|
|
96
|
+
if (refusal) return { status: 400, body: refusal };
|
|
97
|
+
}
|
|
98
|
+
if (fsMode === "workspace-rw") {
|
|
99
|
+
return { status: 501, body: { error: "workspace-rw scripts are not supported in v1" } };
|
|
100
|
+
}
|
|
101
|
+
if (executor && !isExecutorAllowedByDeployment(executor)) {
|
|
102
|
+
return {
|
|
103
|
+
status: 400,
|
|
104
|
+
body: {
|
|
105
|
+
error: 'Executor "native" is not permitted when deployment SCRIPT_EXECUTOR="quickjs"',
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const startedAt = new Date().toISOString();
|
|
111
|
+
const output = await runScriptAsUserWithRunCredential(
|
|
112
|
+
{ source, args: args.args, fsMode, executor },
|
|
113
|
+
args.userId,
|
|
114
|
+
);
|
|
115
|
+
const ok = output.exitCode === 0 && !output.error && !output.runtimeError;
|
|
116
|
+
try {
|
|
117
|
+
await recordInlineScriptRun({
|
|
118
|
+
id: crypto.randomUUID(),
|
|
119
|
+
agentId: USER_SCRIPT_RUN_AGENT_ID,
|
|
120
|
+
requestedByUserId: args.userId,
|
|
121
|
+
createdBy: args.userId,
|
|
122
|
+
source,
|
|
123
|
+
args: scrubObject(args.args ?? null),
|
|
124
|
+
scriptName: args.name ?? "(inline source)",
|
|
125
|
+
status: ok ? "completed" : "failed",
|
|
126
|
+
output: scrubObject(output.result),
|
|
127
|
+
error: ok
|
|
128
|
+
? undefined
|
|
129
|
+
: scrubSecrets(
|
|
130
|
+
[
|
|
131
|
+
output.error,
|
|
132
|
+
output.stderr || undefined,
|
|
133
|
+
output.runtimeError
|
|
134
|
+
? `${output.runtimeError.name}: ${output.runtimeError.message}`
|
|
135
|
+
: undefined,
|
|
136
|
+
]
|
|
137
|
+
.filter(Boolean)
|
|
138
|
+
.join(" — ") || `Script exited with code ${output.exitCode}`,
|
|
139
|
+
),
|
|
140
|
+
startedAt,
|
|
141
|
+
finishedAt: new Date().toISOString(),
|
|
142
|
+
});
|
|
143
|
+
} catch {
|
|
144
|
+
// The run already executed; the row is observability only.
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return {
|
|
148
|
+
status: 200,
|
|
149
|
+
body: scrubObject({
|
|
150
|
+
result: output.result,
|
|
151
|
+
truncated: output.truncated,
|
|
152
|
+
durationMs: output.durationMs,
|
|
153
|
+
stdout: output.stdout,
|
|
154
|
+
stderr: output.stderr,
|
|
155
|
+
exitCode: output.exitCode,
|
|
156
|
+
error: output.error,
|
|
157
|
+
runtimeError: output.runtimeError,
|
|
158
|
+
}),
|
|
159
|
+
};
|
|
160
|
+
}
|
package/src/be/users.ts
CHANGED
|
@@ -304,7 +304,7 @@ export async function listUserTokens(userId: string): Promise<UserTokenSummary[]
|
|
|
304
304
|
return getDbClient().query<UserTokenRow>(
|
|
305
305
|
`SELECT id, userId, label, tokenPreview, createdAt, lastUsedAt, revokedAt
|
|
306
306
|
FROM user_tokens
|
|
307
|
-
WHERE userId = ?
|
|
307
|
+
WHERE userId = ? AND expiresAt IS NULL
|
|
308
308
|
ORDER BY createdAt DESC`,
|
|
309
309
|
[userId],
|
|
310
310
|
);
|
|
@@ -511,6 +511,43 @@ export async function mintToken(
|
|
|
511
511
|
return { tokenId, plaintext };
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
+
/**
|
|
515
|
+
* Mint the short-lived `aswt_` token a user MCP script run presents on its
|
|
516
|
+
* `ctx.swarm` calls, so the script can do only what the requesting user's own
|
|
517
|
+
* token can. It expires at `now + ttlMs` (the backstop for a run that dies
|
|
518
|
+
* without revoking) and stays off the People page token list. No identity
|
|
519
|
+
* event: one per run would flood the audit log, like `mintScriptRunToken`.
|
|
520
|
+
*/
|
|
521
|
+
export async function mintUserScriptRunToken(
|
|
522
|
+
userId: string,
|
|
523
|
+
ttlMs: number,
|
|
524
|
+
): Promise<{ tokenId: string; plaintext: string }> {
|
|
525
|
+
const plaintext = `${TOKEN_PREFIX}${randomChars(TOKEN_ALPHABET, 24)}`;
|
|
526
|
+
const tokenId = randomUUID().replace(/-/g, "");
|
|
527
|
+
const now = new Date();
|
|
528
|
+
await getDbClient().run(
|
|
529
|
+
`INSERT INTO user_tokens (id, userId, label, tokenHash, tokenPreview, createdAt, expiresAt)
|
|
530
|
+
VALUES (?, ?, 'script-run', ?, ?, ?, ?)`,
|
|
531
|
+
[
|
|
532
|
+
tokenId,
|
|
533
|
+
userId,
|
|
534
|
+
sha256Hex(plaintext),
|
|
535
|
+
plaintext.slice(-4),
|
|
536
|
+
now.toISOString(),
|
|
537
|
+
new Date(now.getTime() + ttlMs).toISOString(),
|
|
538
|
+
],
|
|
539
|
+
);
|
|
540
|
+
return { tokenId, plaintext };
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/** Revoke a token minted by `mintUserScriptRunToken`. No-op if already revoked. */
|
|
544
|
+
export async function revokeUserScriptRunToken(tokenId: string): Promise<void> {
|
|
545
|
+
await getDbClient().run(
|
|
546
|
+
"UPDATE user_tokens SET revokedAt = ? WHERE id = ? AND expiresAt IS NOT NULL AND revokedAt IS NULL",
|
|
547
|
+
[new Date().toISOString(), tokenId],
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
|
|
514
551
|
/**
|
|
515
552
|
* Revoke a previously-minted token. Sets `revokedAt = now` and emits
|
|
516
553
|
* `token_revoked`. Subsequent `resolveUserByToken(plaintext)` returns null.
|
|
@@ -586,11 +623,14 @@ export async function resolveUserToken(
|
|
|
586
623
|
const hash = sha256Hex(plaintext);
|
|
587
624
|
const client = getDbClient();
|
|
588
625
|
|
|
589
|
-
const row = await client.get<{
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
626
|
+
const row = await client.get<{
|
|
627
|
+
id: string;
|
|
628
|
+
userId: string;
|
|
629
|
+
revokedAt: string | null;
|
|
630
|
+
expiresAt: string | null;
|
|
631
|
+
}>("SELECT id, userId, revokedAt, expiresAt FROM user_tokens WHERE tokenHash = ?", [hash]);
|
|
593
632
|
if (!row || row.revokedAt !== null) return null;
|
|
633
|
+
if (row.expiresAt !== null && Date.parse(row.expiresAt) <= Date.now()) return null;
|
|
594
634
|
|
|
595
635
|
// Best-effort lastUsedAt update — never let a failure here leak to the
|
|
596
636
|
// caller and block a successful token resolution.
|
|
@@ -613,8 +653,9 @@ export async function resolveUserToken(
|
|
|
613
653
|
*/
|
|
614
654
|
export async function isLiveUserToken(tokenId: string, userId: string): Promise<boolean> {
|
|
615
655
|
const row = await getDbClient().get<{ found: number }>(
|
|
616
|
-
|
|
617
|
-
|
|
656
|
+
`SELECT 1 AS found FROM user_tokens
|
|
657
|
+
WHERE id = ? AND userId = ? AND revokedAt IS NULL AND (expiresAt IS NULL OR expiresAt > ?)`,
|
|
658
|
+
[tokenId, userId, new Date().toISOString()],
|
|
618
659
|
);
|
|
619
660
|
return row != null;
|
|
620
661
|
}
|
|
@@ -4,7 +4,7 @@ import { getAgentById } from "@/be/db";
|
|
|
4
4
|
import { callMcpServerTool } from "@/be/mcp-proxy";
|
|
5
5
|
import { getScriptConnectionById } from "@/be/script-connections";
|
|
6
6
|
import { resolveSqlDsn, runReadOnlyQuery } from "@/be/sql-connections";
|
|
7
|
-
import { can } from "@/rbac";
|
|
7
|
+
import { can, type RbacPrincipal } from "@/rbac";
|
|
8
8
|
import { scrubSecrets } from "@/utils/secret-scrubber";
|
|
9
9
|
import { route } from "./route-def";
|
|
10
10
|
import { jsonError } from "./utils";
|
|
@@ -88,12 +88,23 @@ function connectionScopeMatches(
|
|
|
88
88
|
connection: { scope: string; scopeId: string | null },
|
|
89
89
|
agentId: string,
|
|
90
90
|
syntheticPrincipal: boolean,
|
|
91
|
+
principal: RbacPrincipal,
|
|
91
92
|
): boolean {
|
|
92
93
|
if (connection.scope === "global") return true;
|
|
93
94
|
if (connection.scope === "agent") return !syntheticPrincipal && connection.scopeId === agentId;
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
if (connection.scope === "repo")
|
|
95
|
+
// The proxy has no repo context to compare with scopeId, and a repo-scoped connection resolves
|
|
96
|
+
// repo secret rows. Require the same grant that reads those rows on /api/config/resolved.
|
|
97
|
+
if (connection.scope === "repo") {
|
|
98
|
+
return (
|
|
99
|
+
!syntheticPrincipal &&
|
|
100
|
+
can({
|
|
101
|
+
principal,
|
|
102
|
+
verb: "config.read.secrets",
|
|
103
|
+
resource: { kind: "none" },
|
|
104
|
+
source: "http",
|
|
105
|
+
}).allow
|
|
106
|
+
);
|
|
107
|
+
}
|
|
97
108
|
return false;
|
|
98
109
|
}
|
|
99
110
|
|
|
@@ -127,8 +138,9 @@ export async function handleScriptConnectionProxy(
|
|
|
127
138
|
return true;
|
|
128
139
|
}
|
|
129
140
|
|
|
141
|
+
const principal: RbacPrincipal = { kind: "agent", agentId, isLead: agent?.isLead ?? false };
|
|
130
142
|
const decision = can({
|
|
131
|
-
principal
|
|
143
|
+
principal,
|
|
132
144
|
verb: "script-connection.invoke",
|
|
133
145
|
resource: { kind: "none" },
|
|
134
146
|
source: "http",
|
|
@@ -151,7 +163,7 @@ export async function handleScriptConnectionProxy(
|
|
|
151
163
|
jsonError(res, `Script connection is not ${isSql ? "a SQL" : "an MCP"} connection`, 400);
|
|
152
164
|
return true;
|
|
153
165
|
}
|
|
154
|
-
if (!connectionScopeMatches(connection, agentId, syntheticPrincipal)) {
|
|
166
|
+
if (!connectionScopeMatches(connection, agentId, syntheticPrincipal, principal)) {
|
|
155
167
|
jsonError(res, "Script connection is not available to this agent", 403);
|
|
156
168
|
return true;
|
|
157
169
|
}
|
package/src/http/scripts.ts
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
scriptStdlibTypesWithGeneratedApis,
|
|
40
40
|
typecheckScript,
|
|
41
41
|
} from "../be/scripts/typecheck";
|
|
42
|
+
import { toScriptSearchResults } from "../be/scripts/user-code-mode";
|
|
42
43
|
import { can } from "../rbac";
|
|
43
44
|
import { isExecutorAllowedByDeployment } from "../scripts-runtime/executors/registry";
|
|
44
45
|
import { extractScriptSignature, type ScriptSignature } from "../scripts-runtime/extract-signature";
|
|
@@ -962,17 +963,7 @@ export async function handleScripts(
|
|
|
962
963
|
limit: parsed.body.limit,
|
|
963
964
|
});
|
|
964
965
|
|
|
965
|
-
searchRoute.respond(res, 200, {
|
|
966
|
-
results: matches.map(({ script, score }) => ({
|
|
967
|
-
name: script.name,
|
|
968
|
-
signature: JSON.parse(script.signatureJson),
|
|
969
|
-
argsJsonSchema: script.argsJsonSchema
|
|
970
|
-
? (JSON.parse(script.argsJsonSchema) as Record<string, unknown>)
|
|
971
|
-
: null,
|
|
972
|
-
description: script.description,
|
|
973
|
-
score,
|
|
974
|
-
})),
|
|
975
|
-
});
|
|
966
|
+
searchRoute.respond(res, 200, { results: toScriptSearchResults(matches) });
|
|
976
967
|
return true;
|
|
977
968
|
}
|
|
978
969
|
|