@desplega.ai/agent-swarm 2.6.0 → 2.7.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/README.md +2 -0
- package/dist/{acp-adapter-dgfakfpw.js → acp-adapter-8dn5tq56.js} +6 -6
- package/dist/{actions-fbqma8aa.js → actions-3r6gw7dy.js} +18 -18
- package/dist/{amp-adapter-en0jy6hs.js → amp-adapter-wjtq413p.js} +3 -3
- package/dist/{anthropic-messages-txs190dd.js → anthropic-messages-n4cby1rz.js} +4 -4
- package/dist/{app-k8a5cgpp.js → app-d53yhykk.js} +3 -3
- package/dist/{assistant-a16433gr.js → assistant-ksrawj3k.js} +20 -20
- package/dist/{boot-reembed-6c1sjfnr.js → boot-reembed-fxfw17m2.js} +11 -3
- package/dist/{boot-reembed-f4nn561n.js → boot-reembed-k5y5xbj0.js} +15 -8
- package/dist/{boot-scrub-sweep-d4w9gajf.js → boot-scrub-sweep-se41j9fd.js} +3 -3
- package/dist/{boot-seeds-9bmkspyw.js → boot-seeds-r3kwwv8b.js} +4 -4
- package/dist/{claude-adapter-nys1kjxa.js → claude-adapter-ahmyf231.js} +8 -8
- package/dist/{claude-managed-adapter-55207973.js → claude-managed-adapter-5knamegc.js} +3 -3
- package/dist/{claude-managed-setup-3cm35gey.js → claude-managed-setup-mdc7dy6b.js} +3 -3
- package/dist/{claude-sdk-session-nw5yd8cp.js → claude-sdk-session-n5wen9zk.js} +8729 -8600
- package/dist/{cli-683y0b3a.js → cli-0dqtv2jg.js} +2 -2
- package/dist/{cli-a34pr3w1.js → cli-0tww7dnz.js} +2 -2
- package/dist/{cli-w2656ka1.js → cli-0w4e4v58.js} +7 -7
- package/dist/{cli-5sckpqcx.js → cli-2sjm3t4r.js} +1 -1
- package/dist/{cli-gf2850q7.js → cli-3cywb44q.js} +18 -1
- package/dist/{cli-8wkb09q5.js → cli-3k9jej0c.js} +2 -2
- package/dist/{cli-3aqd4jaa.js → cli-3v2cyqb8.js} +3 -3
- package/dist/{cli-emhjcj2y.js → cli-5qt9vzmq.js} +89 -20
- package/dist/{cli-abkm71vr.js → cli-5rp1w4cr.js} +1 -1
- package/dist/{cli-gf95q3bm.js → cli-6vwjsetx.js} +4 -4
- package/dist/{cli-k21gx5ht.js → cli-6w2yrrc0.js} +10 -10
- package/dist/{cli-m70bajzr.js → cli-75tdydgv.js} +1 -1
- package/dist/{cli-5rj83bam.js → cli-8feswf2v.js} +47 -36
- package/dist/{cli-sxgtf5fw.js → cli-8wd3mbyj.js} +1 -1
- package/dist/{cli-ca6banwz.js → cli-9csfthbw.js} +10 -8
- package/dist/{cli-dqygeeh5.js → cli-b41p764a.js} +31 -3
- package/dist/{cli-m5a9m0ak.js → cli-c1t533hh.js} +3 -3
- package/dist/{cli-2sjhpsns.js → cli-c28jxpcv.js} +1 -1
- package/dist/{cli-bqztfyve.js → cli-cb50g9cd.js} +1 -1
- package/dist/{cli-ag2yrnt5.js → cli-d8gaphtr.js} +2 -2
- package/dist/{cli-9abdgn5t.js → cli-dgtfysne.js} +3 -3
- package/dist/{cli-nq677csy.js → cli-dscnhn18.js} +1 -1
- package/dist/{cli-3fwqy71j.js → cli-dv11pgpv.js} +39 -32
- package/dist/{cli-v49fkghp.js → cli-ekptgk2m.js} +6 -6
- package/dist/{cli-c2habvsf.js → cli-f3mzy662.js} +17 -17
- package/dist/{cli-zqne1qcj.js → cli-fk7k8s9x.js} +2 -2
- package/dist/{cli-1tem6ns9.js → cli-gt4h8cxw.js} +3 -2
- package/dist/{cli-vbhgkw9h.js → cli-h3e7bhvn.js} +3 -3
- package/dist/{cli-ffvsj2qw.js → cli-hkxqdmnb.js} +3 -3
- package/dist/{cli-a2rr0fmg.js → cli-hpkvgdad.js} +7 -4
- package/dist/{cli-art7c1zh.js → cli-hq2v4rr5.js} +37 -9
- package/dist/{cli-sqma6vw1.js → cli-k1zb7raw.js} +5 -5
- package/dist/{cli-4rvr7zfx.js → cli-k4awgvzm.js} +5 -0
- package/dist/{cli-3ndmpxxv.js → cli-k7d3hvya.js} +2 -2
- package/dist/{cli-3gfvmzht.js → cli-kbtdftbw.js} +74 -26
- package/dist/{cli-hfeb68z4.js → cli-kj69b9tw.js} +34 -6
- package/dist/{cli-az25fn5f.js → cli-kk9jy4nm.js} +2 -2
- package/dist/{cli-39aet655.js → cli-m52t4cta.js} +1 -1
- package/dist/{cli-cz37jqss.js → cli-mdadewqp.js} +5 -5
- package/dist/{cli-esakngh8.js → cli-nf6k60sn.js} +1 -1
- package/dist/{cli-j6rktc91.js → cli-nzdf09js.js} +1 -1
- package/dist/{cli-rr7zx19j.js → cli-prcyzecg.js} +12 -12
- package/dist/{cli-4hxrf0p4.js → cli-pzafyqtk.js} +393 -62
- package/dist/{cli-g8ka5j4j.js → cli-qvaa1gjp.js} +173 -52
- package/dist/{cli-d2dpf95n.js → cli-rg4b2g6j.js} +1 -1
- package/dist/{cli-kf4jree9.js → cli-rm66vqdz.js} +1 -1
- package/dist/{cli-4rf0f5vg.js → cli-s504c3w7.js} +5 -3
- package/dist/{cli-nn6vx2mq.js → cli-swkx9jm2.js} +7 -5
- package/dist/{cli-g20jjwt4.js → cli-thsaq4pd.js} +16 -16
- package/dist/{cli-aj8djyqt.js → cli-twjnyvs8.js} +2 -2
- package/dist/{cli-03gg9pd1.js → cli-typdpe8g.js} +4 -4
- package/dist/{cli-mtnj4fwa.js → cli-vg8pwmsd.js} +6 -6
- package/dist/{cli-gnsb1zxa.js → cli-vhpckzvp.js} +1 -1
- package/dist/{cli-7enjwya9.js → cli-vz78s5wm.js} +1 -1
- package/dist/{cli-dv97kdzv.js → cli-wdxgsdz5.js} +2 -2
- package/dist/{cli-7a6p4e65.js → cli-wtjg6je3.js} +1 -1
- package/dist/{cli-6y51ryva.js → cli-x3cngb1h.js} +44 -12
- package/dist/{cli-n7asmce6.js → cli-xbz6mcg4.js} +3 -3
- package/dist/{cli-24j1jeeb.js → cli-y4tdxsqb.js} +3 -3
- package/dist/{cli-mvjz5an3.js → cli-yqrsp3ny.js} +7 -7
- package/dist/cli.js +31 -21
- package/dist/{codex-adapter-d95q4qsn.js → codex-adapter-7wepzq15.js} +6 -6
- package/dist/{codex-hook-brpnycn5.js → codex-hook-pbdh4xhx.js} +2 -2
- package/dist/{codex-session-runner-gdwd8h0c.js → codex-session-runner-02sb49e4.js} +6 -6
- package/dist/{commands-jqmgk54b.js → commands-3rcspxct.js} +2 -2
- package/dist/{controller-z3jq589f.js → controller-8ar4avd6.js} +3 -3
- package/dist/{controllers-connect-r2za39ef.js → controllers-connect-ajvh9h0v.js} +19 -19
- package/dist/{cursor-adapter-4mr4jgkw.js → cursor-adapter-gd0sa7bh.js} +1 -1
- package/dist/{db-w36wwb5g.js → db-dv9j7ts5.js} +2 -2
- package/dist/{db-ppv2tze7.js → db-z26vgdvj.js} +3 -3
- package/dist/{dispatcher-pv5h77vf.js → dispatcher-8m0htjq8.js} +17 -17
- package/dist/{dsh-adapter-d4pdpb3r.js → dsh-adapter-y8gyk130.js} +1 -1
- package/dist/{e2b-fn3zacvt.js → e2b-74vg9b7e.js} +1 -1
- package/dist/{e2b-222hsajc.js → e2b-jyay8wzn.js} +1 -1
- package/dist/{easter-egg-3d-4sp4dvmc.js → easter-egg-3d-28f880xx.js} +1 -1
- package/dist/{execute-jev839y1.js → execute-9seb79vh.js} +1 -1
- package/dist/{external-channel-y6nkzhnn.js → external-channel-smz7jyth.js} +2 -2
- package/dist/{getMachineId-bsd-brn0xym3.js → getMachineId-bsd-whfre6gr.js} +3 -3
- package/dist/{getMachineId-darwin-t339sfxm.js → getMachineId-darwin-5zjynb19.js} +3 -3
- package/dist/{getMachineId-linux-5eq95d8b.js → getMachineId-linux-8mksrrsq.js} +3 -3
- package/dist/{getMachineId-unsupported-qavrtc7j.js → getMachineId-unsupported-fxtqsdt2.js} +3 -3
- package/dist/{getMachineId-win-q7fe1wx7.js → getMachineId-win-nzfmz857.js} +3 -3
- package/dist/{grok-adapter-t08b9ntm.js → grok-adapter-z0nnvtbn.js} +7 -7
- package/dist/handlers-pspryh6g.js +41 -0
- package/dist/{heartbeat-vn31xwdk.js → heartbeat-f928aqyp.js} +20 -20
- package/dist/{hook-cpjs8q51.js → hook-d7c605r4.js} +7 -7
- package/dist/{hook-6d0zbvvt.js → hook-q9hv5xf9.js} +5 -5
- package/dist/{http-9c6medda.js → http-q6j4k989.js} +1000 -251
- package/dist/{index-k0yt1tvq.js → index-5nb266jr.js} +17 -17
- package/dist/{index-ysd45kgc.js → index-8fxt5eah.js} +10 -10
- package/dist/{index-zgvqzjsw.js → index-cekzwhez.js} +5 -5
- package/dist/{index-38t35h0n.js → index-ch0c1xff.js} +17 -17
- package/dist/{index-pkma1yf8.js → index-ebnjhxh1.js} +1 -1
- package/dist/{index-yqgbfgaj.js → index-ed8dy8rn.js} +20 -20
- package/dist/{index-qhjf2htm.js → index-ejqdkkqx.js} +262 -96
- package/dist/{index-dr94zbnh.js → index-farm1zsn.js} +32661 -29443
- package/dist/{index-g6k9tctj.js → index-yn1yxg85.js} +1 -1
- package/dist/{keepalive-em0117bp.js → keepalive-zzc3hks1.js} +3 -3
- package/dist/lead-c0pjcaw4.js +79 -0
- package/dist/{maintenance-kbme3qy9.js → maintenance-kqsxzpzx.js} +1 -1
- package/dist/{oauth-refresh-sweep-xysj4yse.js → oauth-refresh-sweep-7qt0g55z.js} +8 -3
- package/dist/{onboard-p6q0vz97.js → onboard-k7x13fqg.js} +121 -8
- package/dist/{opencode-adapter-esv3k9yn.js → opencode-adapter-tqvrtter.js} +5 -5
- package/dist/{otel-impl-54qhqh1z.js → otel-impl-sqkf6k3b.js} +97 -97
- package/dist/{pi-mono-adapter-mymbwhj0.js → pi-mono-adapter-m2qnafxm.js} +89 -14
- package/dist/{pricing-refresh-yb75wv33.js → pricing-refresh-wkpwhgvs.js} +3 -3
- package/dist/{rbac-roles-dexhc9x8.js → rbac-roles-dpn0c0wj.js} +7 -4
- package/dist/{rbac-roles-1vp2mw4p.js → rbac-roles-wk7xd6a6.js} +2 -2
- package/dist/{render-v2-tjay5hhf.js → render-v2-ex2m4g2k.js} +3 -3
- package/dist/{resume-8ayf37g5.js → resume-725g9b0b.js} +7 -7
- package/dist/{runtime-hqe5cqcd.js → runtime-kajas15g.js} +1 -1
- package/dist/{session-access-fdhp987s.js → session-access-0j2ezjje.js} +8 -4
- package/dist/{session-source-backfill-qgtc86z1.js → session-source-backfill-62202awe.js} +2 -2
- package/dist/{setup-4rrmqcq3.js → setup-9sj11ax6.js} +1 -1
- package/dist/{virtual-modules-52km00d6.js → virtual-modules-c6fcq6zr.js} +2 -2
- package/dist/{work-objects-p28fgd70.js → work-objects-0y07495y.js} +20 -20
- package/dist/worker-d4q9sqbc.js +79 -0
- package/openapi.json +1536 -407
- package/package.json +7 -5
- package/src/be/automation-preflight.ts +2 -0
- package/src/be/connector-codes.ts +65 -22
- package/src/be/db/api-keys.ts +9 -0
- package/src/be/db/workflow-runs.ts +36 -5
- package/src/be/db.ts +80 -22
- package/src/be/memory/boot-reembed.ts +4 -1
- package/src/be/memory/constants.ts +6 -0
- package/src/be/memory/embedding-recovery.ts +48 -0
- package/src/be/memory/index-content.ts +5 -2
- package/src/be/memory/providers/openai-embedding.ts +65 -14
- package/src/be/memory/task-learning.ts +257 -0
- package/src/be/memory/types.ts +13 -2
- package/src/be/migrations/245_script_executor.sql +3 -0
- package/src/be/migrations/246_connector_code_kind.sql +11 -0
- package/src/be/oauth-refresh-sweep.ts +2 -1
- package/src/be/onboarding.ts +125 -15
- package/src/be/rbac-roles.ts +4 -1
- package/src/be/scripts/boot-reembed.ts +2 -0
- package/src/be/scripts/db.ts +14 -4
- package/src/be/scripts/embeddings.ts +4 -2
- package/src/be/scripts/run-saved.ts +1 -0
- package/src/be/scripts/typecheck.ts +9 -3
- package/src/be/seed/agent-fs-provision.ts +75 -14
- package/src/be/seed-skills/index.ts +7 -0
- package/src/be/swarm-config-guard.ts +3 -0
- package/src/cli.tsx +9 -0
- package/src/comb/config.ts +6 -1
- package/src/commands/onboard/agent-fs-version.ts +5 -0
- package/src/commands/onboard/compose-generator.ts +117 -4
- package/src/commands/onboard/env-generator.ts +9 -0
- package/src/commands/onboard/tei-image.ts +12 -0
- package/src/commands/onboard/types.ts +7 -0
- package/src/commands/onboard.tsx +11 -1
- package/src/commands/provider-credentials.ts +2 -1
- package/src/commands/runner.ts +14 -1
- package/src/heartbeat/heartbeat.ts +14 -1
- package/src/heartbeat/script-runner-probe.ts +47 -0
- package/src/http/agentfs-proxy.ts +369 -0
- package/src/http/all-routes.ts +1 -0
- package/src/http/api-keys.ts +24 -9
- package/src/http/codex-oauth-device.ts +8 -1
- package/src/http/fs.ts +64 -10
- package/src/http/idempotency-key.ts +1 -1
- package/src/http/inbox-state.ts +27 -1
- package/src/http/index.ts +7 -4
- package/src/http/memory.ts +7 -4
- package/src/http/onboarding.ts +139 -11
- package/src/http/pages-public.ts +38 -5
- package/src/http/scripts.ts +27 -0
- package/src/http/session-access.ts +24 -0
- package/src/http/sessions.ts +10 -6
- package/src/http/tasks.ts +85 -11
- package/src/http/telemetry-ui.ts +1 -1
- package/src/http/user-roles.ts +4 -1
- package/src/http/users.ts +272 -3
- package/src/http/utils.ts +22 -3
- package/src/http/workflows.ts +10 -0
- package/src/http/x.ts +5 -0
- package/src/prompts/base-prompt.ts +45 -10
- package/src/prompts/session-templates.ts +43 -5
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/codex-adapter.ts +6 -1
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/providers/pi-mono-adapter.ts +99 -14
- package/src/rbac/legacy-policy.ts +1 -0
- package/src/rbac/permissions.ts +4 -0
- package/src/scheduler/scheduler.ts +2 -1
- package/src/scripts-runtime/eval-harness.ts +8 -1
- package/src/scripts-runtime/executors/native.ts +22 -16
- package/src/scripts-runtime/executors/quickjs-prelude.ts +103 -1
- package/src/scripts-runtime/executors/quickjs-runner.ts +2 -1
- package/src/scripts-runtime/executors/quickjs.ts +7 -0
- package/src/scripts-runtime/executors/registry.ts +32 -0
- package/src/scripts-runtime/executors/types.ts +7 -0
- package/src/scripts-runtime/host-validated-args.ts +133 -0
- package/src/scripts-runtime/loader.ts +30 -3
- package/src/scripts-runtime/swarm-sdk.ts +9 -2
- package/src/scripts-runtime/types/stdlib.d.ts +9 -1
- package/src/scripts-runtime/types/swarm-sdk.d.ts +9 -1
- package/src/tests/agent-fs-provision-seeder.test.ts +261 -92
- package/src/tests/agentfs-proxy.test.ts +1106 -0
- package/src/tests/api-key-status-by-suffix.test.ts +242 -0
- package/src/tests/base-prompt.test.ts +139 -4
- package/src/tests/codex-adapter.test.ts +46 -8
- package/src/tests/codex-oauth-device.test.ts +12 -1
- package/src/tests/comb-config-guard.test.ts +20 -0
- package/src/tests/comb-links.test.ts +79 -1
- package/src/tests/comb-status.test.ts +44 -0
- package/src/tests/community-linear-delivery-loop.test.ts +2099 -0
- package/src/tests/credential-check.test.ts +4 -2
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/docs-index.test.ts +135 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/fetch-resolved-env.test.ts +16 -2
- package/src/tests/fixtures/onboard/baseline-states.ts +68 -0
- package/src/tests/fixtures/onboard/content.compose.yml.txt +190 -0
- package/src/tests/fixtures/onboard/content.env.txt +29 -0
- package/src/tests/fixtures/onboard/dev.compose.yml.txt +155 -0
- package/src/tests/fixtures/onboard/dev.env.txt +28 -0
- package/src/tests/fixtures/onboard/full-all.compose.yml.txt +582 -0
- package/src/tests/fixtures/onboard/full-all.env.txt +59 -0
- package/src/tests/fixtures/onboard/full.compose.yml.txt +435 -0
- package/src/tests/fixtures/onboard/full.env.txt +36 -0
- package/src/tests/fixtures/onboard/research.compose.yml.txt +155 -0
- package/src/tests/fixtures/onboard/research.env.txt +28 -0
- package/src/tests/fixtures/onboard/solo.compose.yml.txt +85 -0
- package/src/tests/fixtures/onboard/solo.env.txt +26 -0
- package/src/tests/heartbeat-checklist.test.ts +89 -0
- package/src/tests/heartbeat-script-runner-probe.test.ts +83 -0
- package/src/tests/http-log-scrubbing.test.ts +34 -1
- package/src/tests/http-task-write-ownership.test.ts +5 -1
- package/src/tests/invites-http.test.ts +464 -0
- package/src/tests/memory-embedding-input-cap.test.ts +122 -1
- package/src/tests/memory-embedding-recovery.test.ts +137 -0
- package/src/tests/oauth-refresh-sweep.test.ts +34 -1
- package/src/tests/onboard-compose.test.ts +162 -0
- package/src/tests/onboard-env.test.ts +24 -0
- package/src/tests/onboard-non-interactive.test.ts +29 -0
- package/src/tests/onboard-tei-image.test.ts +36 -0
- package/src/tests/onboarding.test.ts +451 -4
- package/src/tests/openai-embedding-provider.test.ts +105 -2
- package/src/tests/opencode-adapter.test.ts +2 -1
- package/src/tests/pages-frame-ancestors.test.ts +162 -0
- package/src/tests/pi-codemode.test.ts +2 -1
- package/src/tests/pi-mono-adapter.test.ts +54 -0
- package/src/tests/pi-mono-session-cost-on-abort.test.ts +270 -0
- package/src/tests/pi-native-mcp.test.ts +13 -1
- package/src/tests/pi-tool-exposure.test.ts +8 -8
- package/src/tests/preload-env.test.ts +4 -0
- package/src/tests/preload.ts +4 -0
- package/src/tests/probe-tool-schema-tokens.test.ts +144 -0
- package/src/tests/prompt-template-session.test.ts +20 -3
- package/src/tests/rbac-admission-e2e.test.ts +22 -6
- package/src/tests/rbac-admission.test.ts +342 -4
- package/src/tests/rbac-engine.test.ts +1 -0
- package/src/tests/rbac-roles.test.ts +9 -1
- package/src/tests/request-composition-derive.test.ts +329 -0
- package/src/tests/script-connections.test.ts +2 -0
- package/src/tests/script-executor-conformance.test.ts +36 -1
- package/src/tests/script-executor-quickjs-pool.test.ts +50 -0
- package/src/tests/script-executor-quickjs.test.ts +140 -0
- package/src/tests/script-host-validated-args-native.test.ts +196 -0
- package/src/tests/script-per-script-executor.test.ts +415 -0
- package/src/tests/scripts-external-api.test.ts +45 -0
- package/src/tests/sdk-allowlist.test.ts +3 -2
- package/src/tests/self-improvement.test.ts +4 -4
- package/src/tests/send-task-requester-gate.test.ts +64 -3
- package/src/tests/sessions-move.test.ts +39 -1
- package/src/tests/store-progress-learning.test.ts +381 -0
- package/src/tests/ui-logs-parser.test.ts +180 -0
- package/src/tests/whoami-route.test.ts +41 -0
- package/src/tests/workflow-engine-v2.test.ts +116 -1
- package/src/tests/workflow-mcp-trigger-schema.test.ts +209 -0
- package/src/tests/workflow-run-finished-event.test.ts +263 -0
- package/src/tests/workflow-swarm-script.test.ts +34 -0
- package/src/tools/inject-learning.ts +1 -1
- package/src/tools/memory-edit.ts +1 -1
- package/src/tools/memory-search.ts +1 -1
- package/src/tools/script-common.ts +1 -0
- package/src/tools/script-run.ts +7 -0
- package/src/tools/script-upsert.ts +7 -0
- package/src/tools/store-progress.ts +71 -1
- package/src/tools/utils.ts +12 -1
- package/src/tools/workflows/trigger-workflow.ts +104 -10
- package/src/types.ts +12 -1
- package/src/utils/constants.ts +39 -0
- package/src/utils/credentials.ts +5 -2
- package/src/utils/task-attachment-links.ts +15 -3
- package/src/workflows/engine.ts +18 -16
- package/src/workflows/executors/swarm-script.ts +5 -0
- package/src/workflows/foreach-driver.ts +5 -11
- package/src/workflows/node-timeout.ts +30 -0
- package/templates/community/linear-delivery-loop/PLAYBOOK.md +323 -0
- package/templates/community/linear-delivery-loop/README.md +38 -0
- package/templates/community/linear-delivery-loop/config.example.json +31 -0
- package/templates/community/linear-delivery-loop/lead-prompt.md +34 -0
- package/templates/community/linear-delivery-loop/schedule.json +10 -0
- package/templates/community/linear-delivery-loop/scripts/linear-delivery-setup.ts +148 -0
- package/templates/community/linear-delivery-loop/scripts/linear-delivery-tick.ts +1781 -0
- package/templates/skills/swarm-docs/config.json +14 -0
- package/templates/skills/swarm-docs/content.md +144 -0
- package/dist/handlers-eqsnmv95.js +0 -41
- package/dist/lead-23e7z59t.js +0 -79
- package/dist/worker-e3w7vye1.js +0 -79
- package/dist/{azure-openai-responses-9kfwhmn7.js → azure-openai-responses-43asa23s.js} +0 -0
- package/dist/{node-vxx896fa.js → node-t28cc56b.js} +0 -0
- package/dist/{openai-codex-responses-79s8xnbh.js → openai-codex-responses-jhr3sjtm.js} +3 -3
- package/dist/{openai-completions-tdbyts0x.js → openai-completions-gs6yn37k.js} +3 -3
- /package/dist/{openai-responses-dm3t5vqp.js → openai-responses-jqm9vwwk.js} +0 -0
package/src/be/onboarding.ts
CHANGED
|
@@ -2,7 +2,13 @@ import { telemetry } from "../telemetry";
|
|
|
2
2
|
import { ProviderNameSchema } from "../types";
|
|
3
3
|
import { getCurrentRequestUserId } from "../utils/request-auth-context";
|
|
4
4
|
import { z } from "../utils/zod-openapi";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
deleteSwarmConfigByKey,
|
|
7
|
+
getDbClient,
|
|
8
|
+
getSwarmConfigs,
|
|
9
|
+
getTaskById,
|
|
10
|
+
upsertSwarmConfig,
|
|
11
|
+
} from "./db";
|
|
6
12
|
import { validateConfigValue } from "./swarm-config-guard";
|
|
7
13
|
|
|
8
14
|
const ONBOARDING_CONFIG_KEY = "onboarding_state";
|
|
@@ -14,6 +20,7 @@ export const OnboardingStepIdSchema = z.enum([
|
|
|
14
20
|
"agents",
|
|
15
21
|
"memory",
|
|
16
22
|
"integrations",
|
|
23
|
+
"files",
|
|
17
24
|
"first_task",
|
|
18
25
|
]);
|
|
19
26
|
export type OnboardingStepId = z.infer<typeof OnboardingStepIdSchema>;
|
|
@@ -54,6 +61,19 @@ export const OnboardingMemoryPresetSchema = z.enum([
|
|
|
54
61
|
"custom",
|
|
55
62
|
"existing",
|
|
56
63
|
]);
|
|
64
|
+
/**
|
|
65
|
+
* Where the embeddings endpoint runs: `local` (this server or its private
|
|
66
|
+
* network), the hosted preset whose host it calls, or `custom` (another host).
|
|
67
|
+
*/
|
|
68
|
+
export const OnboardingMemoryProviderSchema = z.enum([
|
|
69
|
+
"local",
|
|
70
|
+
"openai",
|
|
71
|
+
"openrouter",
|
|
72
|
+
"vercel",
|
|
73
|
+
"azure",
|
|
74
|
+
"custom",
|
|
75
|
+
]);
|
|
76
|
+
export type OnboardingMemoryProvider = z.infer<typeof OnboardingMemoryProviderSchema>;
|
|
57
77
|
export const OnboardingIntegrationMethodSchema = z.enum([
|
|
58
78
|
"slack",
|
|
59
79
|
"github",
|
|
@@ -62,6 +82,8 @@ export const OnboardingIntegrationMethodSchema = z.enum([
|
|
|
62
82
|
"linear_oauth",
|
|
63
83
|
"jira_oauth",
|
|
64
84
|
]);
|
|
85
|
+
/** `created`: the Files step registered a new agent-fs account. `connected`: it reused one. */
|
|
86
|
+
export const OnboardingFilesMethodSchema = z.enum(["created", "connected"]);
|
|
65
87
|
export const OnboardingFirstTaskMethodSchema = z.enum(["suggestion", "free_form"]);
|
|
66
88
|
export const OnboardingStepMethodSchema = z.union([
|
|
67
89
|
OnboardingConnectMethodSchema,
|
|
@@ -70,6 +92,7 @@ export const OnboardingStepMethodSchema = z.union([
|
|
|
70
92
|
OnboardingAgentsMethodSchema,
|
|
71
93
|
OnboardingMemoryPresetSchema,
|
|
72
94
|
OnboardingIntegrationMethodSchema,
|
|
95
|
+
OnboardingFilesMethodSchema,
|
|
73
96
|
OnboardingFirstTaskMethodSchema,
|
|
74
97
|
]);
|
|
75
98
|
export type OnboardingStepMethod = z.infer<typeof OnboardingStepMethodSchema>;
|
|
@@ -98,6 +121,7 @@ const OnboardingMemoryStepStateSchema = onboardingStepStateSchema(OnboardingMemo
|
|
|
98
121
|
const OnboardingIntegrationStepStateSchema = onboardingStepStateSchema(
|
|
99
122
|
OnboardingIntegrationMethodSchema,
|
|
100
123
|
);
|
|
124
|
+
const OnboardingFilesStepStateSchema = onboardingStepStateSchema(OnboardingFilesMethodSchema);
|
|
101
125
|
const OnboardingFirstTaskStepStateSchema = onboardingStepStateSchema(
|
|
102
126
|
OnboardingFirstTaskMethodSchema,
|
|
103
127
|
);
|
|
@@ -118,6 +142,7 @@ export const OnboardingStateSchema = z.object({
|
|
|
118
142
|
agents: OnboardingAgentsStepStateSchema,
|
|
119
143
|
memory: OnboardingMemoryStepStateSchema,
|
|
120
144
|
integrations: OnboardingIntegrationStepStateSchema,
|
|
145
|
+
files: OnboardingFilesStepStateSchema,
|
|
121
146
|
first_task: OnboardingFirstTaskStepStateSchema,
|
|
122
147
|
}),
|
|
123
148
|
});
|
|
@@ -139,6 +164,21 @@ export const OnboardingSignalsSchema = z.object({
|
|
|
139
164
|
embeddings: z.object({
|
|
140
165
|
configured: z.boolean(),
|
|
141
166
|
dimensions: z.number().int().positive(),
|
|
167
|
+
/** The embedding model memory search uses. Null while it is off. */
|
|
168
|
+
model: z.string().nullable(),
|
|
169
|
+
/**
|
|
170
|
+
* The endpoint runs on this server or its private network (loopback, a
|
|
171
|
+
* private address, or a single-label host such as `tei`). False while off.
|
|
172
|
+
*/
|
|
173
|
+
local: z.boolean(),
|
|
174
|
+
/** Where the endpoint runs, from its host only (never the URL). Null while off. */
|
|
175
|
+
provider: OnboardingMemoryProviderSchema.nullable(),
|
|
176
|
+
/**
|
|
177
|
+
* The local setup of the deployment environment, also while a stored
|
|
178
|
+
* hosted setup replaces it, so `/setup` can offer it again: the model of
|
|
179
|
+
* its local endpoint. Null when the environment has no local endpoint.
|
|
180
|
+
*/
|
|
181
|
+
localDefault: z.object({ model: z.string() }).nullable(),
|
|
142
182
|
}),
|
|
143
183
|
integrations: z.object({
|
|
144
184
|
slack: z.boolean(),
|
|
@@ -153,6 +193,8 @@ export const OnboardingSignalsSchema = z.object({
|
|
|
153
193
|
workersOnline: z.number().int().nonnegative(),
|
|
154
194
|
}),
|
|
155
195
|
firstTask: z.object({ id: z.string(), status: z.string() }).nullable(),
|
|
196
|
+
/** The Files step applies: Comb is on, so the browser can create an agent-fs account. */
|
|
197
|
+
files: z.object({ enabled: z.boolean() }),
|
|
156
198
|
});
|
|
157
199
|
export type OnboardingSignals = z.infer<typeof OnboardingSignalsSchema>;
|
|
158
200
|
|
|
@@ -198,10 +240,17 @@ export const OnboardingActionSchema = z.union([
|
|
|
198
240
|
method: OnboardingIntegrationMethodSchema,
|
|
199
241
|
})
|
|
200
242
|
.strict(),
|
|
243
|
+
z
|
|
244
|
+
.object({
|
|
245
|
+
action: z.literal("complete"),
|
|
246
|
+
step: z.literal("files"),
|
|
247
|
+
method: OnboardingFilesMethodSchema,
|
|
248
|
+
})
|
|
249
|
+
.strict(),
|
|
201
250
|
z
|
|
202
251
|
.object({
|
|
203
252
|
action: z.literal("skip"),
|
|
204
|
-
step: z.enum(["name", "ai", "agents", "memory", "integrations", "first_task"]),
|
|
253
|
+
step: z.enum(["name", "ai", "agents", "memory", "integrations", "files", "first_task"]),
|
|
205
254
|
})
|
|
206
255
|
.strict(),
|
|
207
256
|
z
|
|
@@ -243,8 +292,18 @@ export const OnboardingMemoryRequestSchema = z
|
|
|
243
292
|
model: z.string().trim().min(1).optional(),
|
|
244
293
|
apiKey: z.string().min(1).optional(),
|
|
245
294
|
reuseKey: z.enum(["OPENAI_API_KEY", "OPENROUTER_API_KEY"]).optional(),
|
|
295
|
+
/**
|
|
296
|
+
* With preset `existing`: test the setup of the deployment environment,
|
|
297
|
+
* and when it works, delete the stored embeddings config so that setup
|
|
298
|
+
* applies again. A failed test changes no config.
|
|
299
|
+
*/
|
|
300
|
+
restoreDefault: z.boolean().optional(),
|
|
246
301
|
})
|
|
247
|
-
.strict()
|
|
302
|
+
.strict()
|
|
303
|
+
.refine((body) => !body.restoreDefault || body.preset === "existing", {
|
|
304
|
+
message: "restoreDefault needs preset existing",
|
|
305
|
+
path: ["restoreDefault"],
|
|
306
|
+
});
|
|
248
307
|
export type OnboardingMemoryRequest = z.infer<typeof OnboardingMemoryRequestSchema>;
|
|
249
308
|
|
|
250
309
|
export const OnboardingMemoryResponseSchema = z.object({
|
|
@@ -320,6 +379,7 @@ function freshState(now: string, autoCompleted: boolean): OnboardingState {
|
|
|
320
379
|
agents: emptyStep(),
|
|
321
380
|
memory: emptyStep(),
|
|
322
381
|
integrations: emptyStep(),
|
|
382
|
+
files: emptyStep(),
|
|
323
383
|
first_task: emptyStep(),
|
|
324
384
|
},
|
|
325
385
|
};
|
|
@@ -535,6 +595,20 @@ function deriveState(
|
|
|
535
595
|
return changed;
|
|
536
596
|
}
|
|
537
597
|
|
|
598
|
+
/**
|
|
599
|
+
* The response view of the state. Without Comb the Files step cannot run, so a
|
|
600
|
+
* stored `todo` reads as `skipped`. Response only: never persisted and never a
|
|
601
|
+
* `step_skipped` event, so installs without Comb send no funnel noise and the
|
|
602
|
+
* step comes back as `todo` once Comb is turned on.
|
|
603
|
+
*/
|
|
604
|
+
function presentState(state: OnboardingState, signals: OnboardingSignals): OnboardingState {
|
|
605
|
+
if (signals.files.enabled || state.steps.files.status !== "todo") return state;
|
|
606
|
+
return {
|
|
607
|
+
...state,
|
|
608
|
+
steps: { ...state.steps, files: { ...state.steps.files, status: "skipped" } },
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
|
|
538
612
|
export class OnboardingTaskNotFoundError extends Error {}
|
|
539
613
|
|
|
540
614
|
async function applyAction(
|
|
@@ -612,7 +686,8 @@ export async function readOrUpdateOnboarding(
|
|
|
612
686
|
const read = await client.transaction(async () => await loadAndDerive(loadSignals, []), {
|
|
613
687
|
readOnly: true,
|
|
614
688
|
});
|
|
615
|
-
if (!read.dirty)
|
|
689
|
+
if (!read.dirty)
|
|
690
|
+
return { state: presentState(read.state, read.signals), signals: read.signals };
|
|
616
691
|
}
|
|
617
692
|
|
|
618
693
|
return await client.transaction(async () => {
|
|
@@ -627,14 +702,43 @@ export async function readOrUpdateOnboarding(
|
|
|
627
702
|
}
|
|
628
703
|
if (dirty) await persistState(state);
|
|
629
704
|
queueTelemetry(events);
|
|
630
|
-
return { state, signals };
|
|
705
|
+
return { state: presentState(state, signals), signals };
|
|
631
706
|
});
|
|
632
707
|
}
|
|
633
708
|
|
|
709
|
+
/** The embeddings rows a memory probe writes or deletes. */
|
|
710
|
+
export const EMBEDDING_PREFIX_KEYS = [
|
|
711
|
+
"EMBEDDING_QUERY_PREFIX",
|
|
712
|
+
"EMBEDDING_DOCUMENT_PREFIX",
|
|
713
|
+
] as const;
|
|
714
|
+
export const EMBEDDING_CONFIG_KEYS = [
|
|
715
|
+
"EMBEDDING_API_BASE_URL",
|
|
716
|
+
"EMBEDDING_MODEL",
|
|
717
|
+
"EMBEDDING_API_KEY",
|
|
718
|
+
...EMBEDDING_PREFIX_KEYS,
|
|
719
|
+
] as const;
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* The config change of a passed memory probe:
|
|
723
|
+
* - `save`: store the tested endpoint. `prefixes` sets a task prefix to an
|
|
724
|
+
* empty value (`""`), or deletes its stored row (`null`).
|
|
725
|
+
* - `restore`: delete the stored embeddings rows, so the deployment
|
|
726
|
+
* environment applies again.
|
|
727
|
+
*/
|
|
728
|
+
export type MemoryConfigChange =
|
|
729
|
+
| {
|
|
730
|
+
kind: "save";
|
|
731
|
+
baseUrl: string;
|
|
732
|
+
model: string;
|
|
733
|
+
apiKey?: string;
|
|
734
|
+
prefixes: ReadonlyArray<{ key: (typeof EMBEDDING_PREFIX_KEYS)[number]; value: "" | null }>;
|
|
735
|
+
}
|
|
736
|
+
| { kind: "restore" };
|
|
737
|
+
|
|
634
738
|
export async function updateOnboardingMemory(
|
|
635
739
|
preset: OnboardingMemoryPreset,
|
|
636
740
|
result: { ok: true } | { ok: false; errorClass: OnboardingErrorClass },
|
|
637
|
-
|
|
741
|
+
change?: MemoryConfigChange,
|
|
638
742
|
): Promise<boolean> {
|
|
639
743
|
return await getDbClient().transaction(async () => {
|
|
640
744
|
const events: PendingTelemetry[] = [];
|
|
@@ -642,11 +746,11 @@ export async function updateOnboardingMemory(
|
|
|
642
746
|
let dirty = loaded.dirty;
|
|
643
747
|
const eventsForState = loaded.state.autoCompleted ? [] : events;
|
|
644
748
|
|
|
645
|
-
if (
|
|
749
|
+
if (change?.kind === "save") {
|
|
646
750
|
const configValues = [
|
|
647
|
-
["EMBEDDING_API_BASE_URL",
|
|
648
|
-
["EMBEDDING_MODEL",
|
|
649
|
-
...(
|
|
751
|
+
["EMBEDDING_API_BASE_URL", change.baseUrl],
|
|
752
|
+
["EMBEDDING_MODEL", change.model],
|
|
753
|
+
...(change.apiKey ? [["EMBEDDING_API_KEY", change.apiKey]] : []),
|
|
650
754
|
] as const;
|
|
651
755
|
for (const [key, value] of configValues) {
|
|
652
756
|
const validationError = validateConfigValue(key, value);
|
|
@@ -655,17 +759,23 @@ export async function updateOnboardingMemory(
|
|
|
655
759
|
await upsertSwarmConfig({
|
|
656
760
|
scope: "global",
|
|
657
761
|
key: "EMBEDDING_API_BASE_URL",
|
|
658
|
-
value:
|
|
762
|
+
value: change.baseUrl,
|
|
659
763
|
});
|
|
660
|
-
await upsertSwarmConfig({ scope: "global", key: "EMBEDDING_MODEL", value:
|
|
661
|
-
if (
|
|
764
|
+
await upsertSwarmConfig({ scope: "global", key: "EMBEDDING_MODEL", value: change.model });
|
|
765
|
+
if (change.apiKey) {
|
|
662
766
|
await upsertSwarmConfig({
|
|
663
767
|
scope: "global",
|
|
664
768
|
key: "EMBEDDING_API_KEY",
|
|
665
|
-
value:
|
|
769
|
+
value: change.apiKey,
|
|
666
770
|
isSecret: true,
|
|
667
771
|
});
|
|
668
772
|
}
|
|
773
|
+
for (const { key, value } of change.prefixes) {
|
|
774
|
+
if (value === null) await deleteSwarmConfigByKey("global", null, key);
|
|
775
|
+
else await upsertSwarmConfig({ scope: "global", key, value });
|
|
776
|
+
}
|
|
777
|
+
} else if (change?.kind === "restore") {
|
|
778
|
+
for (const key of EMBEDDING_CONFIG_KEYS) await deleteSwarmConfigByKey("global", null, key);
|
|
669
779
|
}
|
|
670
780
|
|
|
671
781
|
if (result.ok) {
|
|
@@ -676,7 +786,7 @@ export async function updateOnboardingMemory(
|
|
|
676
786
|
|
|
677
787
|
if (dirty) await persistState(loaded.state);
|
|
678
788
|
queueTelemetry(events);
|
|
679
|
-
return
|
|
789
|
+
return change !== undefined;
|
|
680
790
|
});
|
|
681
791
|
}
|
|
682
792
|
|
package/src/be/rbac-roles.ts
CHANGED
|
@@ -38,6 +38,9 @@ export const BUILTIN_ROLES = [
|
|
|
38
38
|
"favorite.write.own",
|
|
39
39
|
"session.share",
|
|
40
40
|
"session.presence",
|
|
41
|
+
"task.steer.own",
|
|
42
|
+
"comb.presence",
|
|
43
|
+
"fs.join.own",
|
|
41
44
|
],
|
|
42
45
|
},
|
|
43
46
|
{
|
|
@@ -46,7 +49,7 @@ export const BUILTIN_ROLES = [
|
|
|
46
49
|
description: "Read-only: no task, approval or script writes.",
|
|
47
50
|
isBuiltin: true,
|
|
48
51
|
grantsAll: false,
|
|
49
|
-
verbs: ["favorite.write.own", "session.presence"],
|
|
52
|
+
verbs: ["favorite.write.own", "session.presence", "comb.presence", "fs.join.own"],
|
|
50
53
|
},
|
|
51
54
|
] satisfies (BuiltinRoleDefinition & { isBuiltin: true })[];
|
|
52
55
|
|
|
@@ -26,6 +26,7 @@ type ScriptRow = {
|
|
|
26
26
|
isScratch: number;
|
|
27
27
|
typeChecked: number;
|
|
28
28
|
fsMode: "none" | "workspace-rw";
|
|
29
|
+
executor: "native" | "quickjs" | null;
|
|
29
30
|
createdByAgentId: string | null;
|
|
30
31
|
createdAt: string;
|
|
31
32
|
updatedAt: string;
|
|
@@ -37,6 +38,7 @@ function toScriptRecord(row: ScriptRow) {
|
|
|
37
38
|
scopeId: row.scopeId ?? null,
|
|
38
39
|
isScratch: row.isScratch === 1,
|
|
39
40
|
typeChecked: row.typeChecked === 1,
|
|
41
|
+
executor: row.executor ?? null,
|
|
40
42
|
createdByAgentId: row.createdByAgentId ?? null,
|
|
41
43
|
};
|
|
42
44
|
}
|
package/src/be/scripts/db.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
ScriptApiAuthMode,
|
|
4
4
|
ScriptApiRecord,
|
|
5
5
|
ScriptApiWithSecret,
|
|
6
|
+
ScriptExecutorName,
|
|
6
7
|
ScriptFsMode,
|
|
7
8
|
ScriptRecord,
|
|
8
9
|
ScriptScope,
|
|
@@ -36,6 +37,7 @@ type ScriptWriteArgs = ScriptIdentity & {
|
|
|
36
37
|
isScratch?: boolean;
|
|
37
38
|
typeChecked?: boolean;
|
|
38
39
|
fsMode?: ScriptFsMode;
|
|
40
|
+
executor?: ScriptExecutorName | null;
|
|
39
41
|
agentId?: string | null;
|
|
40
42
|
changeReason?: string | null;
|
|
41
43
|
embeddingMode?: "sync" | "skip";
|
|
@@ -62,6 +64,7 @@ function rowToScript(row: ScriptRow): ScriptRecord {
|
|
|
62
64
|
scopeId: row.scopeId ?? null,
|
|
63
65
|
isScratch: row.isScratch === 1,
|
|
64
66
|
typeChecked: row.typeChecked === 1,
|
|
67
|
+
executor: row.executor ?? null,
|
|
65
68
|
createdByAgentId: row.createdByAgentId ?? null,
|
|
66
69
|
};
|
|
67
70
|
}
|
|
@@ -113,6 +116,7 @@ export async function insertScript(args: ScriptWriteArgs): Promise<ScriptRecord>
|
|
|
113
116
|
const scopeId = normalizeScopeId(args.scope, args.scopeId);
|
|
114
117
|
const contentHash = computeContentHash(args.source);
|
|
115
118
|
const fsMode = args.fsMode ?? "none";
|
|
119
|
+
const executor = args.executor ?? null;
|
|
116
120
|
const isScratch = args.isScratch ? 1 : 0;
|
|
117
121
|
const typeChecked = args.typeChecked ? 1 : 0;
|
|
118
122
|
|
|
@@ -120,10 +124,10 @@ export async function insertScript(args: ScriptWriteArgs): Promise<ScriptRecord>
|
|
|
120
124
|
const row = await tx.get<ScriptRow>(
|
|
121
125
|
`INSERT INTO scripts (
|
|
122
126
|
id, "key", name, scope, scopeId, source, description, intent, signatureJson,
|
|
123
|
-
argsJsonSchema, contentHash, isScratch, typeChecked, fsMode, createdByAgentId, createdAt, updatedAt,
|
|
127
|
+
argsJsonSchema, contentHash, isScratch, typeChecked, fsMode, executor, createdByAgentId, createdAt, updatedAt,
|
|
124
128
|
created_by, updated_by
|
|
125
129
|
)
|
|
126
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
130
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
127
131
|
RETURNING *`,
|
|
128
132
|
[
|
|
129
133
|
id,
|
|
@@ -140,6 +144,7 @@ export async function insertScript(args: ScriptWriteArgs): Promise<ScriptRecord>
|
|
|
140
144
|
isScratch,
|
|
141
145
|
typeChecked,
|
|
142
146
|
fsMode,
|
|
147
|
+
executor,
|
|
143
148
|
args.agentId ?? null,
|
|
144
149
|
now,
|
|
145
150
|
now,
|
|
@@ -189,6 +194,7 @@ export async function upsertScriptByName(args: ScriptWriteArgs): Promise<UpsertS
|
|
|
189
194
|
const contentHash = computeContentHash(args.source);
|
|
190
195
|
if (existing.contentHash === contentHash) {
|
|
191
196
|
const fsMode = args.fsMode ?? existing.fsMode;
|
|
197
|
+
const executor = args.executor !== undefined ? args.executor : existing.executor;
|
|
192
198
|
const isScratch = args.isScratch ?? existing.isScratch;
|
|
193
199
|
const typeChecked = args.typeChecked ?? existing.typeChecked;
|
|
194
200
|
const argsJsonSchema =
|
|
@@ -206,6 +212,7 @@ export async function upsertScriptByName(args: ScriptWriteArgs): Promise<UpsertS
|
|
|
206
212
|
isScratch;
|
|
207
213
|
if (
|
|
208
214
|
fsMode !== existing.fsMode ||
|
|
215
|
+
executor !== existing.executor ||
|
|
209
216
|
isScratch !== existing.isScratch ||
|
|
210
217
|
typeChecked !== existing.typeChecked ||
|
|
211
218
|
trackedMetadataChanged ||
|
|
@@ -214,7 +221,7 @@ export async function upsertScriptByName(args: ScriptWriteArgs): Promise<UpsertS
|
|
|
214
221
|
const row = await getDbClient().get<ScriptRow>(
|
|
215
222
|
`UPDATE scripts
|
|
216
223
|
SET description = ?, intent = ?, signatureJson = ?, argsJsonSchema = ?,
|
|
217
|
-
isScratch = ?, typeChecked = ?, fsMode = ?, updatedAt = ?, updated_by = ?
|
|
224
|
+
isScratch = ?, typeChecked = ?, fsMode = ?, executor = ?, updatedAt = ?, updated_by = ?
|
|
218
225
|
WHERE id = ?
|
|
219
226
|
RETURNING *`,
|
|
220
227
|
[
|
|
@@ -225,6 +232,7 @@ export async function upsertScriptByName(args: ScriptWriteArgs): Promise<UpsertS
|
|
|
225
232
|
isScratch ? 1 : 0,
|
|
226
233
|
typeChecked ? 1 : 0,
|
|
227
234
|
fsMode,
|
|
235
|
+
executor ?? null,
|
|
228
236
|
new Date().toISOString(),
|
|
229
237
|
args.createdBy ?? null,
|
|
230
238
|
existing.id,
|
|
@@ -253,6 +261,7 @@ export async function upsertScriptByName(args: ScriptWriteArgs): Promise<UpsertS
|
|
|
253
261
|
const now = new Date().toISOString();
|
|
254
262
|
const newVersion = existing.version + 1;
|
|
255
263
|
const fsMode = args.fsMode ?? existing.fsMode;
|
|
264
|
+
const executor = args.executor !== undefined ? args.executor : existing.executor;
|
|
256
265
|
const isScratch = args.isScratch ?? existing.isScratch;
|
|
257
266
|
const typeChecked = args.typeChecked ?? existing.typeChecked;
|
|
258
267
|
const argsJsonSchema =
|
|
@@ -262,7 +271,7 @@ export async function upsertScriptByName(args: ScriptWriteArgs): Promise<UpsertS
|
|
|
262
271
|
const row = await tx.get<ScriptRow>(
|
|
263
272
|
`UPDATE scripts
|
|
264
273
|
SET source = ?, description = ?, intent = ?, signatureJson = ?, argsJsonSchema = ?,
|
|
265
|
-
contentHash = ?, version = ?, isScratch = ?, typeChecked = ?, fsMode = ?, updatedAt = ?, updated_by = ?
|
|
274
|
+
contentHash = ?, version = ?, isScratch = ?, typeChecked = ?, fsMode = ?, executor = ?, updatedAt = ?, updated_by = ?
|
|
266
275
|
WHERE id = ?
|
|
267
276
|
RETURNING *`,
|
|
268
277
|
[
|
|
@@ -276,6 +285,7 @@ export async function upsertScriptByName(args: ScriptWriteArgs): Promise<UpsertS
|
|
|
276
285
|
isScratch ? 1 : 0,
|
|
277
286
|
typeChecked ? 1 : 0,
|
|
278
287
|
fsMode,
|
|
288
|
+
executor ?? null,
|
|
279
289
|
now,
|
|
280
290
|
args.createdBy ?? null,
|
|
281
291
|
existing.id,
|
|
@@ -28,6 +28,7 @@ type ScriptEmbeddingCandidateRow = ScriptEmbeddingRow & {
|
|
|
28
28
|
isScratch: number;
|
|
29
29
|
typeChecked: number;
|
|
30
30
|
fsMode: "none" | "workspace-rw";
|
|
31
|
+
executor: "native" | "quickjs" | null;
|
|
31
32
|
createdByAgentId: string | null;
|
|
32
33
|
createdAt: string;
|
|
33
34
|
updatedAt: string;
|
|
@@ -70,6 +71,7 @@ function rowToScript(row: ScriptEmbeddingCandidateRow): ScriptRecord {
|
|
|
70
71
|
isScratch: row.isScratch === 1,
|
|
71
72
|
typeChecked: row.typeChecked === 1,
|
|
72
73
|
fsMode: row.fsMode,
|
|
74
|
+
executor: row.executor ?? null,
|
|
73
75
|
createdByAgentId: row.createdByAgentId ?? null,
|
|
74
76
|
createdAt: row.createdAt,
|
|
75
77
|
updatedAt: row.updatedAt,
|
|
@@ -79,7 +81,7 @@ function rowToScript(row: ScriptEmbeddingCandidateRow): ScriptRecord {
|
|
|
79
81
|
export async function embedScript(script: ScriptRecord): Promise<void> {
|
|
80
82
|
const text = scriptEmbeddingText(script);
|
|
81
83
|
const provider = embeddingProvider();
|
|
82
|
-
const embedding = await provider.embed(text);
|
|
84
|
+
const embedding = await provider.embed(text, { kind: "document" });
|
|
83
85
|
if (!embedding) return;
|
|
84
86
|
|
|
85
87
|
if (embedding.length !== provider.dimensions) {
|
|
@@ -205,7 +207,7 @@ export async function searchScripts(args: {
|
|
|
205
207
|
limit?: number;
|
|
206
208
|
}): Promise<ScriptSearchResult[]> {
|
|
207
209
|
const provider = embeddingProvider();
|
|
208
|
-
const queryEmbedding = await provider.embed(args.query);
|
|
210
|
+
const queryEmbedding = await provider.embed(args.query, { kind: "query" });
|
|
209
211
|
if (!queryEmbedding) return lexicalFallback(args);
|
|
210
212
|
|
|
211
213
|
const candidates = await candidateRows(args.scope, args.scopeId);
|
|
@@ -50,6 +50,7 @@ export async function runSavedScriptAsAgent(
|
|
|
50
50
|
source: args.script.source,
|
|
51
51
|
args: args.input,
|
|
52
52
|
fsMode: args.script.fsMode,
|
|
53
|
+
executor: args.script.executor,
|
|
53
54
|
agentId: args.agentId,
|
|
54
55
|
egressSecrets: credentials.egressSecrets,
|
|
55
56
|
failedBindings: credentials.failedBindings,
|
|
@@ -33,6 +33,7 @@ export const SCRIPT_SDK_TYPES = `
|
|
|
33
33
|
export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };
|
|
34
34
|
export type ScriptScope = "agent" | "global";
|
|
35
35
|
export type ScriptFsMode = "none" | "workspace-rw";
|
|
36
|
+
export type ScriptExecutorName = "native" | "quickjs";
|
|
36
37
|
export type ScriptApiRawOptions = { raw: true };
|
|
37
38
|
export type ScriptApiDefaultOptions = { raw?: false };
|
|
38
39
|
export type RoutingReason = "skill" | "continuity" | "overflow" | "human_pinned" | "reroute_fault";
|
|
@@ -224,7 +225,7 @@ export interface SwarmSdk {
|
|
|
224
225
|
schedule_list(args?: { enabled?: boolean; name?: string; scheduleType?: "recurring" | "one_time"; targetType?: "agent-task" | "workflow" | "script"; workflowId?: string; scriptName?: string; hideCompleted?: boolean; consecutiveErrorsMin?: number; lastRunStatus?: "failed" | "succeeded"; includeFull?: boolean }): Promise<unknown>;
|
|
225
226
|
// --- scripts ---
|
|
226
227
|
script_search(args: { query?: string; scope?: ScriptScope; limit?: number }): Promise<unknown>;
|
|
227
|
-
script_run(args: { name?: string; source?: string; args?: unknown; intent?: string; scope?: ScriptScope; fsMode?: ScriptFsMode; idempotencyKey?: string }): Promise<unknown>;
|
|
228
|
+
script_run(args: { name?: string; source?: string; args?: unknown; intent?: string; scope?: ScriptScope; fsMode?: ScriptFsMode; executor?: ScriptExecutorName | null; idempotencyKey?: string }): Promise<unknown>;
|
|
228
229
|
// --- swarm / agent ---
|
|
229
230
|
swarm_get(args?: { includeFull?: boolean }): Promise<unknown>;
|
|
230
231
|
agent_info(args?: Record<string, unknown>): Promise<unknown>;
|
|
@@ -341,7 +342,12 @@ export interface SwarmSdk {
|
|
|
341
342
|
workflow_patch(args: Record<string, unknown>): Promise<unknown>;
|
|
342
343
|
workflow_patchNode(args: Record<string, unknown>): Promise<unknown>;
|
|
343
344
|
workflow_delete(args: { id: string }): Promise<unknown>;
|
|
344
|
-
workflow_trigger(args: {
|
|
345
|
+
workflow_trigger(args: {
|
|
346
|
+
id: string;
|
|
347
|
+
triggerData?: Record<string, unknown>;
|
|
348
|
+
wait?: boolean;
|
|
349
|
+
idempotencyKey?: string;
|
|
350
|
+
}): Promise<unknown>;
|
|
345
351
|
workflow_retryRun(args: { id: string }): Promise<unknown>;
|
|
346
352
|
workflow_cancelRun(args: { id: string }): Promise<unknown>;
|
|
347
353
|
|
|
@@ -351,7 +357,7 @@ export interface SwarmSdk {
|
|
|
351
357
|
prompt_preview(args: Record<string, unknown>): Promise<unknown>;
|
|
352
358
|
|
|
353
359
|
// --- write: scripts ---
|
|
354
|
-
script_upsert(args: { name: string; source: string; description?: string; intent?: string; scope?: ScriptScope; fsMode?: ScriptFsMode }): Promise<unknown>;
|
|
360
|
+
script_upsert(args: { name: string; source: string; description?: string; intent?: string; scope?: ScriptScope; fsMode?: ScriptFsMode; executor?: ScriptExecutorName | null }): Promise<unknown>;
|
|
355
361
|
script_delete(args: { name: string; scope?: ScriptScope }): Promise<unknown>;
|
|
356
362
|
script_queryTypes(args: { name: string; scope?: ScriptScope }): Promise<unknown>;
|
|
357
363
|
script_launchRun(args: { source: string; args?: unknown; idempotencyKey?: string; scriptName?: string; requestedByUserId?: string }): Promise<unknown>;
|