@desplega.ai/agent-swarm 2.9.1 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-bht22g3k.js +16 -0
- package/dist/{acp-targets-ny75x1qy.js → acp-targets-arrwv4f0.js} +6 -6
- package/dist/{actions-b9qgrmeq.js → actions-y0d2n1c2.js} +49 -28
- package/dist/{agent-fs-provision-b5dhdsbd.js → agent-fs-provision-tpj7sktd.js} +4 -4
- package/dist/{amp-adapter-vtax2c9s.js → amp-adapter-vmmnmw8d.js} +1 -1
- package/dist/{anthropic-messages-r5xf5hqw.js → anthropic-messages-zdca3gv1.js} +13 -13
- package/dist/{app-g2z15hax.js → app-wb7w45dq.js} +3 -3
- package/dist/{approval-notifications-yt13wp8r.js → approval-notifications-7mqr6vbd.js} +5 -5
- package/dist/{assistant-2cgfxsgk.js → assistant-gf60454p.js} +19 -19
- package/dist/{boot-args-schema-3gwy0f60.js → boot-args-schema-qxmd59sr.js} +1 -1
- package/dist/{boot-reembed-mywmyp4s.js → boot-reembed-5tmeskj2.js} +1 -1
- package/dist/{boot-reembed-92g7s5zp.js → boot-reembed-wb44vc3s.js} +1 -1
- package/dist/boot-scrub-sweep-25bxhnw4.js +9 -0
- package/dist/{boot-seeds-ce7rvgq1.js → boot-seeds-nj9za0vk.js} +4 -4
- package/dist/{claude-adapter-3m4q7735.js → claude-adapter-d3krpdyb.js} +5 -5
- package/dist/{claude-managed-setup-c217draw.js → claude-managed-setup-7y4pwd81.js} +1 -1
- package/dist/{claude-sdk-session-7fbqm51z.js → claude-sdk-session-d138zy0e.js} +5 -5
- package/dist/{cli-tvc4jag9.js → cli-01k6wpr9.js} +3 -3
- package/dist/{cli-2xs8tsf7.js → cli-124ntmf0.js} +42 -36
- package/dist/{cli-jm0hvmz2.js → cli-2rnd5j3t.js} +1 -1
- package/dist/{cli-32djehja.js → cli-2spnz7ye.js} +8 -8
- package/dist/{cli-2dq9yv8p.js → cli-2v2zdm0a.js} +1 -1
- package/dist/{cli-fkef327x.js → cli-3caf7pmg.js} +2 -2
- package/dist/{cli-mw620q3n.js → cli-3et6fmfe.js} +1 -1
- package/dist/{cli-h9yqfzx9.js → cli-3f8zbtqa.js} +3 -3
- package/dist/{cli-mhapr559.js → cli-43evxwj4.js} +1 -1
- package/dist/{cli-pyjn0qhk.js → cli-539h29es.js} +138 -21
- package/dist/{cli-bnqncekd.js → cli-5qhfv9rw.js} +2 -2
- package/dist/{cli-p4kckx1z.js → cli-6037prsx.js} +6 -6
- package/dist/{cli-zr6qy15y.js → cli-6cwr32fe.js} +17 -17
- package/dist/{cli-1jykg0py.js → cli-7r162fxe.js} +22 -15
- package/dist/{cli-sn650d7x.js → cli-8st34zhr.js} +20 -10
- package/dist/{cli-rq5rpv6k.js → cli-91pkxres.js} +1 -1
- package/dist/{cli-m7zvgt57.js → cli-9fjr27ez.js} +10 -10
- package/dist/{cli-f8x9drqr.js → cli-aw83sr40.js} +19 -5
- package/dist/{cli-jkw6ptfw.js → cli-cc93xzes.js} +5 -5
- package/dist/{cli-gfy38pvt.js → cli-fcfbct2j.js} +5 -5
- package/dist/{cli-nafvvsp8.js → cli-fq2rr3jb.js} +5 -5
- package/dist/{boot-scrub-sweep-7dkdzqxx.js → cli-had1p04a.js} +8 -9
- package/dist/{cli-bg63qmsx.js → cli-j6te8keb.js} +4 -4
- package/dist/{cli-br0924pw.js → cli-jrbq4djp.js} +1 -1
- package/dist/{cli-kxx4k2jw.js → cli-k3q2va86.js} +2 -2
- package/dist/{cli-jaw5v1sy.js → cli-k5yewqgd.js} +3 -3
- package/dist/cli-kbtzfrxj.js +404 -0
- package/dist/{cli-td9tb872.js → cli-m9cvf7vs.js} +7 -7
- package/dist/{cli-f3jyzq4g.js → cli-md50mj0r.js} +2 -2
- package/dist/{cli-xag7btpe.js → cli-mk7c5ac4.js} +1 -1
- package/dist/cli-mys27d03.js +321 -0
- package/dist/{cli-nbt14he0.js → cli-nstkanmx.js} +5 -5
- package/dist/{cli-wn13hhdt.js → cli-nv4xsvmk.js} +4 -4
- package/dist/{cli-vyff45ve.js → cli-p0c3vtch.js} +2 -2
- package/dist/{cli-2czxfnvj.js → cli-p0n7b5rz.js} +662 -93
- package/dist/{cli-j7svy295.js → cli-q5srsxq2.js} +12 -12
- package/dist/{cli-vt89089n.js → cli-qrta34nb.js} +4 -4
- package/dist/{cli-ysvspf5e.js → cli-qx4f057j.js} +2 -2
- package/dist/{cli-zh0e5x7p.js → cli-s1khw52h.js} +11 -11
- package/dist/{cli-mkwkwq81.js → cli-s1zqk1aj.js} +18 -11
- package/dist/{cli-f9gz2vyj.js → cli-sb4426be.js} +7 -7
- package/dist/{cli-dgs10ttj.js → cli-th1dkc2v.js} +1 -1
- package/dist/{cli-3j873zxq.js → cli-tr27kwyg.js} +2 -2
- package/dist/{cli-6945ywhr.js → cli-tvgqesec.js} +6 -4
- package/dist/{cli-fjggej24.js → cli-v46zsvqk.js} +1 -1
- package/dist/{cli-67mwzr35.js → cli-v8z0yga9.js} +4 -4
- package/dist/{cli-pb2ay3sh.js → cli-vfqvrd82.js} +5 -5
- package/dist/{cli-fh97xn30.js → cli-vq2eg24x.js} +2 -2
- package/dist/{cli-v57d7fmm.js → cli-vsw91x06.js} +23 -22
- package/dist/{cli-2yjj3e31.js → cli-w1q68d8x.js} +9 -7
- package/dist/{cli-y2ewxhth.js → cli-wafmk3fn.js} +10 -10
- package/dist/{cli-ctx0b85j.js → cli-wwp1bd3n.js} +257 -101
- package/dist/{cli-bkjdknnp.js → cli-y4ccxtz5.js} +37 -5
- package/dist/{cli-w4n323t3.js → cli-y8p78ekx.js} +7 -7
- package/dist/{cli-8zh9nrew.js → cli-z0m452jr.js} +1 -1
- package/dist/{cli-mjw0yf82.js → cli-zeh2mhkg.js} +1 -1
- package/dist/{cli-jwampxxq.js → cli-zk7v5s89.js} +2 -2
- package/dist/cli.js +16 -16
- package/dist/{cloudflare-workers-ai-system-one-9y1zx3pt.js → cloudflare-workers-ai-system-one-4aysy6rh.js} +2 -2
- package/dist/{codex-adapter-n656pvb8.js → codex-adapter-exfdbj73.js} +4 -4
- package/dist/{codex-session-runner-p0fbv5y9.js → codex-session-runner-xhznc4g3.js} +4 -4
- package/dist/{commands-gwea8z5p.js → commands-d8g349v4.js} +3 -3
- package/dist/{controller-t67c3grh.js → controller-mwgdmb8y.js} +3 -3
- package/dist/{controllers-connect-ks155r0h.js → controllers-connect-5v7qx04j.js} +19 -19
- package/dist/core-sxy4epp2.js +38 -0
- package/dist/{cursor-adapter-ygwrtmkv.js → cursor-adapter-p2q5h35d.js} +1 -1
- package/dist/{db-rb2xqdb1.js → db-qpganbeb.js} +3 -3
- package/dist/{db-kpmx06s9.js → db-wcw0b2j8.js} +2 -2
- package/dist/{dispatcher-31sm0ej2.js → dispatcher-8d8s49yz.js} +17 -17
- package/dist/{dsh-adapter-qyxh0w31.js → dsh-adapter-me0twn13.js} +1 -1
- package/dist/{easter-egg-3d-00wjscn6.js → easter-egg-3d-wv7w5ty6.js} +1 -1
- package/dist/{embedding-space-qhw4g68n.js → embedding-space-e48xchqa.js} +6 -6
- package/dist/{embeddings-zdv9ke6x.js → embeddings-tgq2afbq.js} +1 -1
- package/dist/{execute-zna8wwr7.js → execute-8rhwrk7f.js} +1 -1
- package/dist/{external-channel-1ac6t56s.js → external-channel-8bt3j2pm.js} +2 -2
- package/dist/{fx-adapter-sk7n0fzc.js → fx-adapter-adtdb3jb.js} +8 -8
- package/dist/{grok-adapter-sjbcm5ew.js → grok-adapter-accnn9km.js} +8 -8
- package/dist/handlers-1x77561e.js +35 -0
- package/dist/{heartbeat-2f6z4kdx.js → heartbeat-x0056ra5.js} +20 -20
- package/dist/{hook-w1skzaqc.js → hook-a7vmn2st.js} +4 -4
- package/dist/{hook-8y0gvtp1.js → hook-mrd2ayxv.js} +5 -5
- package/dist/{http-wghxvpef.js → http-ym9c5svp.js} +676 -273
- package/dist/{index-s71ez27v.js → index-01ns1pkw.js} +1 -1
- package/dist/index-48qzcqzj.js +35 -0
- package/dist/{index-9zkchs9t.js → index-ny60jcat.js} +186 -14
- package/dist/{index-rv89fvzf.js → index-p46tvwtx.js} +21 -21
- package/dist/index-rkvaambe.js +36 -0
- package/dist/{index-8zn8nxn5.js → index-x6azjwm8.js} +1 -1
- package/dist/{index-25pvya7q.js → index-xj1mq27m.js} +17 -17
- package/dist/k8s-m56sw868.js +217 -0
- package/dist/{keepalive-sh02349h.js → keepalive-7yxg8z4c.js} +3 -3
- package/dist/lead-enzn86bz.js +74 -0
- package/dist/{maintenance-yj0dcjja.js → maintenance-6tefxmk1.js} +1 -1
- package/dist/{oauth-refresh-sweep-d9xedk66.js → oauth-refresh-sweep-70cavc3a.js} +2 -2
- package/dist/{onboard-dpgjn03r.js → onboard-fja65z08.js} +5 -5
- package/dist/{openai-decisions-q3hh60wr.js → openai-decisions-ytp6w6xh.js} +1 -1
- package/dist/{opencode-adapter-2d31cpjc.js → opencode-adapter-hakkm7yh.js} +5 -5
- package/dist/{otel-impl-1skarpfq.js → otel-impl-7zhnt6gj.js} +1 -1
- package/dist/{pending-bfmxtx0g.js → pending-h01yzpx4.js} +18 -18
- package/dist/{pi-mono-adapter-gvppnasy.js → pi-mono-adapter-f52hz743.js} +6 -6
- package/dist/{pricing-refresh-c6b325mk.js → pricing-refresh-fzxvk2zf.js} +2 -2
- package/dist/{rbac-roles-h80qbdbs.js → rbac-roles-9v6vhgbs.js} +3 -3
- package/dist/{rbac-roles-zfcx68tx.js → rbac-roles-hfgh8sba.js} +2 -2
- package/dist/{render-v2-nx20t3rb.js → render-v2-1rgspxzf.js} +3 -3
- package/dist/{resume-5ep8agan.js → resume-tqy61x24.js} +7 -7
- package/dist/{runtime-r3pj4mce.js → runtime-exkxyx5f.js} +1 -1
- package/dist/{session-access-n7p3m15b.js → session-access-3act7vt4.js} +4 -4
- package/dist/{session-source-backfill-v8mt0zwn.js → session-source-backfill-82qe7fqq.js} +2 -2
- package/dist/{setup-z1psaqhe.js → setup-ry1vfdef.js} +1 -1
- package/dist/thread-buffer-3x93yexa.js +38 -0
- package/dist/{typesafe-system-one-f2en2knd.js → typesafe-system-one-vcfj2ak8.js} +2 -2
- package/dist/user-merge-jobs-bx6bf7db.js +22 -0
- package/dist/{virtual-modules-rrbjdpxn.js → virtual-modules-s0rjzcqq.js} +3 -3
- package/dist/{work-objects-4aghh73z.js → work-objects-z2e5tv03.js} +20 -20
- package/dist/{worker-follow-up-166zmex1.js → worker-follow-up-y3xeg89w.js} +17 -17
- package/dist/worker-zfcv2wbf.js +74 -0
- package/openapi.json +1630 -388
- package/package.json +3 -3
- package/src/be/boot-seeds.ts +7 -1
- package/src/be/db/model-groups.ts +238 -0
- package/src/be/db/model-profiles.ts +26 -8
- package/src/be/db/session-costs.ts +8 -2
- package/src/be/db/tasks/read.ts +3 -2
- package/src/be/db/tasks/write.ts +2 -1
- package/src/be/db/user-references.ts +75 -0
- package/src/be/db/users/references.ts +185 -0
- package/src/be/db-client.ts +70 -19
- package/src/be/db.ts +32 -57
- package/src/be/key-window-usage.ts +1 -0
- package/src/be/memory/demotion-evidence.ts +34 -0
- package/src/be/memory/reranker.ts +34 -12
- package/src/be/memory/review-recall-filter.ts +83 -0
- package/src/be/memory/search-candidates.ts +19 -6
- package/src/be/memory/types.ts +11 -0
- package/src/be/migrations/312_task_ui_action_runs_repeatable.sql +6 -0
- package/src/be/migrations/314_model_groups.sql +85 -0
- package/src/be/migrations/318_superseded_workflow_cut_backfill.sql +22 -0
- package/src/be/migrations/319_user_fk_indexes.sql +153 -0
- package/src/be/migrations/320_session_costs_kind.sql +4 -0
- package/src/be/migrations/321_user_merge_jobs.sql +52 -0
- package/src/be/pricing-normalize.ts +2 -0
- package/src/be/rbac-roles.ts +6 -4
- package/src/be/runtime-pools/db.ts +20 -5
- package/src/be/runtime-pools/supervisor.ts +15 -1
- package/src/be/scripts/db.ts +11 -0
- package/src/be/scripts/typecheck.ts +2 -0
- package/src/be/seed-model-groups.ts +86 -0
- package/src/be/seed-model-profiles.ts +20 -13
- package/src/be/seed-scripts/catalog/dreaming-gather.ts +165 -1
- package/src/be/swarm-config-guard.ts +34 -0
- package/src/be/task-ui-spec.ts +102 -1
- package/src/be/user-merge-jobs.ts +564 -0
- package/src/be/users.ts +41 -23
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/compose-generator.ts +1 -1
- package/src/commands/onboard/env-generator.ts +1 -1
- package/src/commands/provider-credentials.ts +1 -1
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/contract.ts +15 -0
- package/src/extensions/dispatcher.ts +14 -4
- package/src/github/handlers.ts +57 -0
- package/src/github/types.ts +4 -0
- package/src/http/all-routes.ts +2 -0
- package/src/http/approval-requests.ts +5 -1
- package/src/http/auth.ts +3 -1
- package/src/http/config.ts +34 -1
- package/src/http/index.ts +13 -0
- package/src/http/memory.ts +19 -6
- package/src/http/model-groups.ts +277 -0
- package/src/http/model-profiles.ts +30 -13
- package/src/http/tasks.ts +41 -6
- package/src/http/tool-hooks.ts +140 -0
- package/src/http/users.ts +142 -19
- package/src/http/workflows.ts +19 -1
- package/src/integrations/chat-sdk/inbound.ts +8 -2
- package/src/integrations/chat-sdk/limits.ts +8 -3
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/pricing-sources.md +9 -0
- package/src/rbac/legacy-policy.ts +1 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/runtime-providers/index.ts +7 -5
- package/src/runtime-providers/k8s.ts +250 -0
- package/src/scripts-runtime/types/stdlib.d.ts +2 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +16 -1
- package/src/scripts-runtime/types/swarm-sdk.d.ts +2 -0
- package/src/slack/actions.ts +33 -10
- package/src/slack/blocks.ts +23 -2
- package/src/slack/render-v2.ts +47 -0
- package/src/tests/acp-adapter.test.ts +26 -0
- package/src/tests/chat-sdk-relay.test.ts +21 -1
- package/src/tests/check-pr-body.test.ts +43 -0
- package/src/tests/credential-check.test.ts +14 -6
- package/src/tests/db-client.test.ts +146 -0
- package/src/tests/deploy-guard.test.ts +7 -7
- package/src/tests/deploy-select.test.ts +83 -0
- package/src/tests/dreaming-gather-corrections.test.ts +467 -0
- package/src/tests/event-loop-lag.test.ts +9 -7
- package/src/tests/fixtures/extensions/native-tool-recorder/hooks.ts +26 -0
- package/src/tests/fixtures/extensions/native-tool-recorder/manifest.json +10 -0
- package/src/tests/fixtures/onboard/content.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/content.env.txt +1 -1
- package/src/tests/fixtures/onboard/dev.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/dev.env.txt +1 -1
- package/src/tests/fixtures/onboard/full-all.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/full-all.env.txt +1 -1
- package/src/tests/fixtures/onboard/full.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/full.env.txt +1 -1
- package/src/tests/fixtures/onboard/research.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/research.env.txt +1 -1
- package/src/tests/fixtures/onboard/solo.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/solo.env.txt +1 -1
- package/src/tests/github-event-filter.test.ts +8 -0
- package/src/tests/github-handlers-inline-comments.test.ts +2 -0
- package/src/tests/github-handlers-reactions.test.ts +4 -0
- package/src/tests/github-handlers.test.ts +3 -0
- package/src/tests/github-sender-trust.test.ts +223 -0
- package/src/tests/http-users.test.ts +142 -41
- package/src/tests/k8s-pool-smoke.test.ts +190 -0
- package/src/tests/key-window-usage.test.ts +15 -0
- package/src/tests/memory-rater-store.test.ts +35 -1
- package/src/tests/memory-reranker.test.ts +39 -4
- package/src/tests/memory-review-recall-filter.test.ts +205 -0
- package/src/tests/migration-318-superseded-workflow-cut-backfill.test.ts +74 -0
- package/src/tests/model-groups-api.test.ts +415 -0
- package/src/tests/model-profiles-api.test.ts +1 -0
- package/src/tests/operator-granted-credentials.test.ts +7 -2
- package/src/tests/operator-granted-role-wire.test.ts +2 -1
- package/src/tests/rbac-engine.test.ts +1 -0
- package/src/tests/runtime-k8s-pools.test.ts +142 -0
- package/src/tests/runtime-pools-db.test.ts +42 -2
- package/src/tests/runtime-pools-http.test.ts +47 -2
- package/src/tests/runtime-provider-registration.test.ts +5 -14
- package/src/tests/runtime-providers-k8s.test.ts +303 -0
- package/src/tests/script-connections.test.ts +13 -1
- package/src/tests/short-id.test.ts +23 -0
- package/src/tests/slack-blocks.test.ts +69 -0
- package/src/tests/slack-render-v2.test.ts +54 -0
- package/src/tests/spec-base-url.test.ts +13 -1
- package/src/tests/system-one-decide-session-cost.test.ts +196 -0
- package/src/tests/task-ui-action-route.test.ts +59 -1
- package/src/tests/task-ui-script-actions.test.ts +517 -0
- package/src/tests/tool-hooks-http.test.ts +187 -0
- package/src/tests/ui-spec-script-actions-config.test.ts +196 -0
- package/src/tests/user-delete-perf.test.ts +321 -0
- package/src/tests/user-merge-jobs.test.ts +680 -0
- package/src/tests/vcs-provider.test.ts +25 -5
- package/src/tests/vendored-openapi.test.ts +13 -1
- package/src/tests/workflow-agent-task-retry.test.ts +62 -0
- package/src/tests/workflow-foreach-supersede-retry.test.ts +10 -0
- package/src/tests/workflow-http-v2.test.ts +27 -0
- package/src/tests/workflow-replay.test.ts +10 -1
- package/src/tests/workflow-triggers-v2.test.ts +128 -0
- package/src/tests/workflow-wait-event.test.ts +109 -1
- package/src/tools/memory-search.ts +14 -3
- package/src/tools/store-progress.ts +26 -26
- package/src/tools/swarm-config/delete-config.ts +12 -1
- package/src/tools/swarm-config/set-config.ts +8 -0
- package/src/tools/system-one-decide.ts +113 -3
- package/src/tools/utils.ts +4 -1
- package/src/tools/workflows/create-workflow.ts +2 -0
- package/src/tools/workflows/update-workflow.ts +3 -1
- package/src/types.ts +86 -2
- package/src/ui-spec/actions.ts +30 -4
- package/src/ui-spec/schema.ts +38 -0
- package/src/ui-spec/script-actions.ts +340 -0
- package/src/ui-spec/script-allowlist.ts +48 -0
- package/src/utils/short-id.ts +20 -14
- package/src/utils/task-ui-spec.ts +16 -4
- package/src/vcs/index.ts +12 -2
- package/src/workflows/executors/system-one-decision.ts +2 -2
- package/src/workflows/resume.ts +3 -2
- package/src/workflows/task-step-routing.ts +30 -10
- package/src/workflows/triggers.ts +35 -3
- package/templates/extensions/manifest.schema.json +13 -0
- package/templates/skills/swarm-docs/content.md +2 -0
- package/templates/skills/ui-spec/content.md +7 -1
- package/templates/workflows/dreaming/content.md +1 -1
- package/dist/acp-adapter-g909b5hw.js +0 -16
- package/dist/cli-b91nz213.js +0 -93
- package/dist/handlers-yzy0c87x.js +0 -35
- package/dist/index-2t4859r5.js +0 -35
- package/dist/index-cxca2t8y.js +0 -36
- package/dist/lead-gk4h5eg7.js +0 -74
- package/dist/thread-buffer-a1re2r9r.js +0 -38
- package/dist/worker-3dyyb8ev.js +0 -74
- package/dist/{azure-openai-responses-590s1eea.js → azure-openai-responses-b3y7fz36.js} +8 -8
- package/dist/{cli-m7c2380k.js → cli-3aaeb78m.js} +4 -4
- package/dist/{cli-g0vv9dg4.js → cli-8y43jx2r.js} +8 -8
- package/dist/{cli-m0cy2vyf.js → cli-k6nejceb.js} +4 -4
- package/dist/{google-generative-ai-maq6c9bf.js → google-generative-ai-bh0djqjp.js} +4 -4
- package/dist/{google-vertex-2jgsw2nb.js → google-vertex-prjbw8dj.js} +8 -8
- package/dist/{mistral-conversations-0c30em7t.js → mistral-conversations-tm2vd4gc.js} +8 -8
- package/dist/{node-dqm4xgxw.js → node-2wfcey7d.js} +0 -0
- package/dist/{openai-codex-responses-bkcd8pjj.js → openai-codex-responses-sxjv60xx.js} +4 -4
- package/dist/{openai-completions-f3n69rep.js → openai-completions-0c7qnhsx.js} +20 -20
- package/dist/{openai-responses-gbh0wfqe.js → openai-responses-a7h29chp.js} +15 -15
- package/dist/{pi-messages-zebyt7gb.js → pi-messages-2j0fpqwq.js} +5 -5
|
@@ -36,18 +36,18 @@ import {
|
|
|
36
36
|
getLatestStepForNode2,
|
|
37
37
|
getCurrentStepForNode2,
|
|
38
38
|
init_db4
|
|
39
|
-
} from "./cli-
|
|
39
|
+
} from "./cli-wwp1bd3n.js";
|
|
40
40
|
import {
|
|
41
41
|
ConfigQuestionSettingsSchema,
|
|
42
42
|
normalizeApprovalQuestions,
|
|
43
43
|
init_approval_config_question,
|
|
44
44
|
dispatchApprovalNotifications2,
|
|
45
45
|
init_approval_notifications
|
|
46
|
-
} from "./cli-
|
|
46
|
+
} from "./cli-cc93xzes.js";
|
|
47
47
|
import {
|
|
48
48
|
resolveCredential,
|
|
49
49
|
init_credentials
|
|
50
|
-
} from "./cli-
|
|
50
|
+
} from "./cli-6cwr32fe.js";
|
|
51
51
|
import {
|
|
52
52
|
isSlackConfigured,
|
|
53
53
|
init_config4
|
|
@@ -55,16 +55,16 @@ import {
|
|
|
55
55
|
import {
|
|
56
56
|
DEFAULT_MODEL
|
|
57
57
|
} from "./cli-82j36f2m.js";
|
|
58
|
+
import {
|
|
59
|
+
selectCredential,
|
|
60
|
+
init_credentials2
|
|
61
|
+
} from "./cli-psffsanb.js";
|
|
58
62
|
import {
|
|
59
63
|
DEFAULT_OPENROUTER_BASE_URL,
|
|
60
64
|
getOpenRouterBaseUrl,
|
|
61
65
|
getOpenRouterAttributionHeaders,
|
|
62
66
|
init_openrouter_base_url
|
|
63
67
|
} from "./cli-dfyv0jdy.js";
|
|
64
|
-
import {
|
|
65
|
-
selectCredential,
|
|
66
|
-
init_credentials2
|
|
67
|
-
} from "./cli-psffsanb.js";
|
|
68
68
|
import {
|
|
69
69
|
deepInterpolate,
|
|
70
70
|
init_template2
|
|
@@ -117,7 +117,7 @@ async function notifyAutomationPreflightFailure(preflight) {
|
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
try {
|
|
120
|
-
const { getSlackApp } = await import("./app-
|
|
120
|
+
const { getSlackApp } = await import("./app-wb7w45dq.js");
|
|
121
121
|
const app = getSlackApp();
|
|
122
122
|
if (!app) {
|
|
123
123
|
console.warn("[Automation Preflight] Slack not available, cannot send notification");
|
|
@@ -2670,7 +2670,7 @@ var init_system_one_decision = __esm(() => {
|
|
|
2670
2670
|
}
|
|
2671
2671
|
throw err;
|
|
2672
2672
|
}
|
|
2673
|
-
return { ok: true, output: decision };
|
|
2673
|
+
return { ok: true, output: decision, provider: providerId };
|
|
2674
2674
|
}
|
|
2675
2675
|
async reviewDecision(config, review, decision, context, meta) {
|
|
2676
2676
|
const questions = {};
|
|
@@ -3838,7 +3838,7 @@ async function runClaimedStep(def, runId, ctx, node, registry, existingStep, ste
|
|
|
3838
3838
|
}
|
|
3839
3839
|
const waiting = await checkpointStepWaiting(runId, stepId, ctx);
|
|
3840
3840
|
if (waiting && result.waitFor === "workflow.child.finished") {
|
|
3841
|
-
const { resumeFromChildRun } = await import("./resume-
|
|
3841
|
+
const { resumeFromChildRun } = await import("./resume-tqy61x24.js");
|
|
3842
3842
|
await resumeFromChildRun(stepId, registry);
|
|
3843
3843
|
}
|
|
3844
3844
|
return { outcome: waiting ? "waiting" : "completed", successors: [] };
|
|
@@ -4346,7 +4346,7 @@ async function runForeachDrive(runId, parentNodeId, registry) {
|
|
|
4346
4346
|
if (drive.successors.length > 0) {
|
|
4347
4347
|
await walkGraph(workflow.definition, runId, ctx, drive.successors, registry, workflow.id, getSecretInputKeys(workflow.input));
|
|
4348
4348
|
} else {
|
|
4349
|
-
const { finalizeOrWait } = await import("./resume-
|
|
4349
|
+
const { finalizeOrWait } = await import("./resume-tqy61x24.js");
|
|
4350
4350
|
await finalizeOrWait(runId);
|
|
4351
4351
|
}
|
|
4352
4352
|
return drive;
|
|
@@ -4489,7 +4489,7 @@ async function startChild(input) {
|
|
|
4489
4489
|
const parked = await getDbClient2().get("UPDATE workflow_run_steps SET status = 'waiting' WHERE id = ? AND status = 'running' RETURNING id", [child.id]);
|
|
4490
4490
|
if (parked && result.waitFor === "workflow.child.finished") {
|
|
4491
4491
|
ownedChildren.delete(child.id);
|
|
4492
|
-
const { resumeFromChildRun } = await import("./resume-
|
|
4492
|
+
const { resumeFromChildRun } = await import("./resume-tqy61x24.js");
|
|
4493
4493
|
await resumeFromChildRun(child.id, registry);
|
|
4494
4494
|
}
|
|
4495
4495
|
return null;
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
deleteSkillFile2,
|
|
18
18
|
getSkillById2,
|
|
19
19
|
init_db4
|
|
20
|
-
} from "./cli-
|
|
20
|
+
} from "./cli-wwp1bd3n.js";
|
|
21
21
|
import {
|
|
22
22
|
snapshotAndUpdateWorkflow,
|
|
23
23
|
init_version,
|
|
@@ -28,15 +28,15 @@ import {
|
|
|
28
28
|
liveSkillSpec,
|
|
29
29
|
skillHash,
|
|
30
30
|
init_assets
|
|
31
|
-
} from "./cli-
|
|
31
|
+
} from "./cli-p0n7b5rz.js";
|
|
32
32
|
import {
|
|
33
33
|
getSeedState,
|
|
34
34
|
init_state_db
|
|
35
|
-
} from "./cli-
|
|
35
|
+
} from "./cli-w1q68d8x.js";
|
|
36
36
|
import {
|
|
37
37
|
matchesDefaultIdentityMd,
|
|
38
38
|
init_defaults
|
|
39
|
-
} from "./cli-
|
|
39
|
+
} from "./cli-3aaeb78m.js";
|
|
40
40
|
import {
|
|
41
41
|
__esm
|
|
42
42
|
} from "./cli-242037k3.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
requireFxRoute,
|
|
4
4
|
fxSessionExists2,
|
|
5
5
|
fxTargetProfile2
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-01k6wpr9.js";
|
|
7
7
|
import {
|
|
8
8
|
ACPAdapter2
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-k3q2va86.js";
|
|
10
10
|
import {
|
|
11
11
|
getKnownContextWindowSize,
|
|
12
12
|
init_context_window
|
|
@@ -13,41 +13,41 @@ import {
|
|
|
13
13
|
autoIndexMemoryFile,
|
|
14
14
|
fetchConcurrentContext,
|
|
15
15
|
summarizeTranscript
|
|
16
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-tr27kwyg.js";
|
|
17
17
|
import {
|
|
18
18
|
applyReasoningEffort
|
|
19
19
|
} from "./cli-5gpqgs8b.js";
|
|
20
20
|
import {
|
|
21
21
|
resolveOpencodeSdkSpecifier
|
|
22
|
-
} from "./cli-
|
|
22
|
+
} from "./cli-3caf7pmg.js";
|
|
23
23
|
import {
|
|
24
24
|
fetchInstalledMcpServers
|
|
25
25
|
} from "./cli-5y2fvw4z.js";
|
|
26
|
+
import {
|
|
27
|
+
resolveSlashSkillPrompt
|
|
28
|
+
} from "./cli-5j88qqa8.js";
|
|
26
29
|
import {
|
|
27
30
|
CONTEXT_FORMULA,
|
|
28
31
|
getContextWindowSize,
|
|
29
32
|
clampContextPercent,
|
|
30
33
|
init_context_window
|
|
31
34
|
} from "./cli-hnamkvnc.js";
|
|
32
|
-
import {
|
|
33
|
-
resolveSlashSkillPrompt
|
|
34
|
-
} from "./cli-5j88qqa8.js";
|
|
35
35
|
import {
|
|
36
36
|
swarmRuntimeInstanceId,
|
|
37
37
|
init_multi_runtime2
|
|
38
38
|
} from "./cli-mdb054w3.js";
|
|
39
|
-
import {
|
|
40
|
-
DEFAULT_OPENROUTER_BASE_URL,
|
|
41
|
-
getOpenRouterBaseUrl,
|
|
42
|
-
getOpenRouterAttributionHeaders,
|
|
43
|
-
init_openrouter_base_url
|
|
44
|
-
} from "./cli-dfyv0jdy.js";
|
|
45
39
|
import {
|
|
46
40
|
splitCredentialPool,
|
|
47
41
|
openAICompatibleKeyLabels,
|
|
48
42
|
validateOpencodeCredentials,
|
|
49
43
|
init_credentials2
|
|
50
44
|
} from "./cli-psffsanb.js";
|
|
45
|
+
import {
|
|
46
|
+
DEFAULT_OPENROUTER_BASE_URL,
|
|
47
|
+
getOpenRouterBaseUrl,
|
|
48
|
+
getOpenRouterAttributionHeaders,
|
|
49
|
+
init_openrouter_base_url
|
|
50
|
+
} from "./cli-dfyv0jdy.js";
|
|
51
51
|
import {
|
|
52
52
|
snapshotCatalogRows,
|
|
53
53
|
init_runtime_model_catalog
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
getSwarmConfigs2,
|
|
17
17
|
upsertSwarmConfig2,
|
|
18
18
|
init_db4
|
|
19
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-wwp1bd3n.js";
|
|
20
20
|
import {
|
|
21
21
|
createRuntimeProvider,
|
|
22
22
|
init_runtime_providers
|
|
23
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-tvgqesec.js";
|
|
24
24
|
import {
|
|
25
25
|
poolCacheKey,
|
|
26
26
|
init_types4
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
init_session_token_connections,
|
|
31
31
|
insertSessionToken,
|
|
32
32
|
init_users
|
|
33
|
-
} from "./cli-
|
|
33
|
+
} from "./cli-vsw91x06.js";
|
|
34
34
|
import {
|
|
35
35
|
RuntimeControllerCreateSchema,
|
|
36
36
|
RuntimeControllerUpdateSchema,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
RuntimePoolUpdateSchema,
|
|
39
39
|
RuntimePoolCreateAgentSchema,
|
|
40
40
|
init_types5
|
|
41
|
-
} from "./cli-
|
|
41
|
+
} from "./cli-y4ccxtz5.js";
|
|
42
42
|
import {
|
|
43
43
|
scrubSecrets,
|
|
44
44
|
registerVolatileSecret,
|
|
@@ -208,9 +208,16 @@ function parseInput(schema, input) {
|
|
|
208
208
|
throw new RuntimePoolError2(result.error.issues.map((issue) => issue.message).join(". "));
|
|
209
209
|
return result.data;
|
|
210
210
|
}
|
|
211
|
-
function
|
|
212
|
-
if (kind
|
|
213
|
-
|
|
211
|
+
function validateRuntimeController(controller) {
|
|
212
|
+
if (controller.kind !== "k8s")
|
|
213
|
+
return;
|
|
214
|
+
if (controller.placement !== "builtin")
|
|
215
|
+
throw new RuntimePoolError2("Kubernetes controllers require builtin placement");
|
|
216
|
+
for (const key of ["K8S_TOKEN_FILE", "K8S_CA_FILE"])
|
|
217
|
+
if (key in controller.config || typeof controller.secretConfig?.[key] === "string")
|
|
218
|
+
throw new RuntimePoolError2("Kubernetes controller file paths are not supported.");
|
|
219
|
+
if ("KUBERNETES_SERVICE_HOST" in controller.config || typeof controller.secretConfig?.KUBERNETES_SERVICE_HOST === "string")
|
|
220
|
+
throw new RuntimePoolError2("Kubernetes deployment detection overrides are not supported.");
|
|
214
221
|
}
|
|
215
222
|
async function listRuntimeControllers2() {
|
|
216
223
|
return (await getDbClient2().query(`SELECT ${controllerColumns} FROM runtime_controllers ORDER BY name`)).map(rowToController);
|
|
@@ -250,7 +257,8 @@ async function getRuntimeControllerTarget2(controller, env = process.env) {
|
|
|
250
257
|
BOXD_TEARDOWN_TIMEOUT_SEC: env.BOXD_TEARDOWN_TIMEOUT_SEC
|
|
251
258
|
} : {},
|
|
252
259
|
...controller.config,
|
|
253
|
-
...secrets
|
|
260
|
+
...secrets,
|
|
261
|
+
KUBERNETES_SERVICE_HOST: env.KUBERNETES_SERVICE_HOST
|
|
254
262
|
};
|
|
255
263
|
}
|
|
256
264
|
async function checkE2bControllerConfig2(controller, target, env = process.env) {
|
|
@@ -290,7 +298,7 @@ async function checkE2bControllerConfig2(controller, target, env = process.env)
|
|
|
290
298
|
}
|
|
291
299
|
async function createRuntimeController2(input, actor = null, id = crypto.randomUUID()) {
|
|
292
300
|
const data = parseInput(RuntimeControllerCreateSchema, input);
|
|
293
|
-
|
|
301
|
+
validateRuntimeController(data);
|
|
294
302
|
return await getDbClient2().transaction(async (tx) => {
|
|
295
303
|
if (await tx.get("SELECT id FROM runtime_controllers WHERE name = ? OR id = ?", [data.name, id]))
|
|
296
304
|
throw new RuntimePoolError2("Controller already exists", 409);
|
|
@@ -320,7 +328,7 @@ async function updateRuntimeController2(id, input, actor = null) {
|
|
|
320
328
|
if (!row)
|
|
321
329
|
throw new RuntimePoolError2("Controller not found", 404);
|
|
322
330
|
const data = { ...rowToController(row), ...patch };
|
|
323
|
-
|
|
331
|
+
validateRuntimeController(data);
|
|
324
332
|
if (await tx.get("SELECT id FROM runtime_controllers WHERE name = ? AND id != ?", [data.name, id]))
|
|
325
333
|
throw new RuntimePoolError2("Controller name already exists", 409);
|
|
326
334
|
const pools = await listRuntimePools2();
|
|
@@ -381,7 +389,6 @@ async function getRuntimePool2(id) {
|
|
|
381
389
|
return row ? rowToPool(row) : null;
|
|
382
390
|
}
|
|
383
391
|
async function validatePool(data) {
|
|
384
|
-
supportedKind(data.kind);
|
|
385
392
|
if (data.cache && !(await createRuntimeProvider(data.kind)).traits.persistentCache) {
|
|
386
393
|
throw new RuntimePoolError2(`${data.kind} does not support persistent pool caches`);
|
|
387
394
|
}
|
|
@@ -5,23 +5,23 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
publicEndpointSsrfOptions,
|
|
7
7
|
init_mcp_wrapper
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-2v2zdm0a.js";
|
|
9
9
|
import {
|
|
10
10
|
assertUrlSafe,
|
|
11
11
|
normalizeOrgWebsite,
|
|
12
12
|
init_org_website
|
|
13
|
-
} from "./cli-
|
|
14
|
-
import {
|
|
15
|
-
getOpenRouterBaseUrl,
|
|
16
|
-
getOpenRouterAttributionHeaders,
|
|
17
|
-
init_openrouter_base_url
|
|
18
|
-
} from "./cli-dfyv0jdy.js";
|
|
13
|
+
} from "./cli-wwp1bd3n.js";
|
|
19
14
|
import {
|
|
20
15
|
getRouteProvider,
|
|
21
16
|
createScopedFetch,
|
|
22
17
|
deriveDefaultRoute,
|
|
23
18
|
init_src
|
|
24
19
|
} from "./cli-psffsanb.js";
|
|
20
|
+
import {
|
|
21
|
+
getOpenRouterBaseUrl,
|
|
22
|
+
getOpenRouterAttributionHeaders,
|
|
23
|
+
init_openrouter_base_url
|
|
24
|
+
} from "./cli-dfyv0jdy.js";
|
|
25
25
|
import {
|
|
26
26
|
providerBaseUrl,
|
|
27
27
|
providerForKeyVar,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./cli-0726awxw.js";
|
|
5
5
|
import {
|
|
6
6
|
summarizeSession
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-md50mj0r.js";
|
|
8
8
|
import {
|
|
9
9
|
getMemoryRaterNames,
|
|
10
10
|
init_memory_raters,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
readIdentityBaselines,
|
|
20
20
|
advanceIdentityBaselines,
|
|
21
21
|
init_profile_sync
|
|
22
|
-
} from "./cli-
|
|
22
|
+
} from "./cli-3aaeb78m.js";
|
|
23
23
|
import {
|
|
24
24
|
getOpenRouterAttributionHeaders,
|
|
25
25
|
init_openrouter_base_url
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// src/runtime-providers/index.ts
|
|
6
6
|
function canProvisionKind(kind) {
|
|
7
|
-
return kind === "docker" || kind === "e2b" || kind === "boxd";
|
|
7
|
+
return kind === "docker" || kind === "e2b" || kind === "boxd" || kind === "k8s";
|
|
8
8
|
}
|
|
9
9
|
async function createRuntimeProvider(kind, target = {}) {
|
|
10
10
|
switch (kind) {
|
|
@@ -24,10 +24,12 @@ async function createRuntimeProvider(kind, target = {}) {
|
|
|
24
24
|
const { BoxdRuntimeProvider } = await import("./boxd-wn235q80.js");
|
|
25
25
|
return new BoxdRuntimeProvider;
|
|
26
26
|
}
|
|
27
|
-
case "k8s":
|
|
28
|
-
|
|
27
|
+
case "k8s": {
|
|
28
|
+
const { KubernetesRuntimeProvider } = await import("./k8s-m56sw868.js");
|
|
29
|
+
return new KubernetesRuntimeProvider;
|
|
30
|
+
}
|
|
29
31
|
default:
|
|
30
|
-
throw new Error(`Unknown runtime provider: "${kind}". Supported: static, docker, e2b, boxd`);
|
|
32
|
+
throw new Error(`Unknown runtime provider: "${kind}". Supported: static, docker, e2b, boxd, k8s`);
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
var init_runtime_providers = () => {};
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
reasoningCapability,
|
|
3
3
|
applyReasoningEffort
|
|
4
4
|
} from "./cli-5gpqgs8b.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveSlashSkillPrompt
|
|
7
|
+
} from "./cli-5j88qqa8.js";
|
|
5
8
|
import {
|
|
6
9
|
CONTEXT_FORMULA,
|
|
7
10
|
getContextWindowSize,
|
|
8
11
|
clampContextPercent,
|
|
9
12
|
init_context_window
|
|
10
13
|
} from "./cli-hnamkvnc.js";
|
|
11
|
-
import {
|
|
12
|
-
resolveSlashSkillPrompt
|
|
13
|
-
} from "./cli-5j88qqa8.js";
|
|
14
14
|
import {
|
|
15
15
|
detachedProcessGroup,
|
|
16
16
|
registerProcessGroup,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import {
|
|
25
25
|
DEFAULT_MODEL_TIER_MAP,
|
|
26
26
|
init_types5
|
|
27
|
-
} from "./cli-
|
|
27
|
+
} from "./cli-y4ccxtz5.js";
|
|
28
28
|
import {
|
|
29
29
|
getOpenRouterBaseUrl,
|
|
30
30
|
getOpenRouterAttributionHeaders,
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
invalidateTelemetryUserRole,
|
|
9
9
|
init_telemetry_identity,
|
|
10
10
|
init_db4
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-wwp1bd3n.js";
|
|
12
12
|
import {
|
|
13
13
|
revokeAllUserCredentials,
|
|
14
14
|
isLiveUserToken,
|
|
15
15
|
init_users
|
|
16
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-vsw91x06.js";
|
|
17
17
|
import {
|
|
18
18
|
init_env_flag
|
|
19
19
|
} from "./cli-cebvbc9t.js";
|
|
@@ -140,14 +140,14 @@ async function assertNotLastAdmin2(userId) {
|
|
|
140
140
|
FROM users u
|
|
141
141
|
JOIN principal_roles pr ON pr.principalType = 'user' AND pr.principalId = u.id
|
|
142
142
|
JOIN roles r ON r.id = pr.roleId AND r.grantsAll = 1
|
|
143
|
-
WHERE u.status = 'active' AND u.id = ?`, [userId]);
|
|
143
|
+
WHERE u.status = 'active' AND u.mergedIntoUserId IS NULL AND u.id = ?`, [userId]);
|
|
144
144
|
if ((self?.n ?? 0) === 0)
|
|
145
145
|
return;
|
|
146
146
|
const others = await client.get(`SELECT COUNT(DISTINCT u.id) AS n
|
|
147
147
|
FROM users u
|
|
148
148
|
JOIN principal_roles pr ON pr.principalType = 'user' AND pr.principalId = u.id
|
|
149
149
|
JOIN roles r ON r.id = pr.roleId AND r.grantsAll = 1
|
|
150
|
-
WHERE u.status = 'active' AND u.id <> ?`, [userId]);
|
|
150
|
+
WHERE u.status = 'active' AND u.mergedIntoUserId IS NULL AND u.id <> ?`, [userId]);
|
|
151
151
|
if ((others?.n ?? 0) === 0)
|
|
152
152
|
throw new LastAdminError2;
|
|
153
153
|
}
|
|
@@ -188,7 +188,7 @@ async function setUserRoles2(userId, roleNames, actorUserId) {
|
|
|
188
188
|
FROM users u
|
|
189
189
|
JOIN principal_roles pr ON pr.principalType = 'user' AND pr.principalId = u.id
|
|
190
190
|
JOIN roles r ON r.id = pr.roleId AND r.grantsAll = 1
|
|
191
|
-
WHERE u.status = 'active' AND u.id <> ?`, [userId]);
|
|
191
|
+
WHERE u.status = 'active' AND u.mergedIntoUserId IS NULL AND u.id <> ?`, [userId]);
|
|
192
192
|
if ((others?.n ?? 0) === 0)
|
|
193
193
|
throw new LastAdminError2;
|
|
194
194
|
}
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
getResolvedConfig2,
|
|
7
7
|
getAllUsers2,
|
|
8
8
|
init_db4
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-wwp1bd3n.js";
|
|
10
10
|
import {
|
|
11
11
|
getUserGrant2,
|
|
12
12
|
init_rbac_roles
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-vfqvrd82.js";
|
|
14
14
|
import {
|
|
15
15
|
scrubSecrets,
|
|
16
16
|
init_secret_scrubber
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDbClient2,
|
|
3
|
+
randomChars,
|
|
4
|
+
init_short_id,
|
|
3
5
|
validateRuntimeTokenTtlHours,
|
|
4
6
|
init_swarm_config_guard,
|
|
5
7
|
scheduleOrgDomainRecompute,
|
|
6
8
|
init_telemetry_identity,
|
|
7
9
|
init_db4
|
|
8
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-wwp1bd3n.js";
|
|
9
11
|
import {
|
|
10
12
|
registerVolatileSecret,
|
|
11
13
|
unregisterVolatileSecret,
|
|
@@ -41,7 +43,7 @@ var init_session_token_connections = __esm(() => {
|
|
|
41
43
|
});
|
|
42
44
|
|
|
43
45
|
// src/be/users.ts
|
|
44
|
-
import { createHash,
|
|
46
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
45
47
|
function actorString(actor) {
|
|
46
48
|
return `${actor.kind}:${actor.id}`;
|
|
47
49
|
}
|
|
@@ -58,6 +60,7 @@ function rowToUser(row) {
|
|
|
58
60
|
metadata: row.metadata ? JSON.parse(row.metadata) : undefined,
|
|
59
61
|
dailyBudgetUsd: row.dailyBudgetUsd ?? null,
|
|
60
62
|
status: row.status ?? "active",
|
|
63
|
+
...row.mergedIntoUserId ? { mergedIntoUserId: row.mergedIntoUserId } : {},
|
|
61
64
|
createdAt: row.createdAt,
|
|
62
65
|
lastUpdatedAt: row.lastUpdatedAt
|
|
63
66
|
};
|
|
@@ -66,21 +69,28 @@ async function findUserById(id) {
|
|
|
66
69
|
const row = await getDbClient2().get("SELECT * FROM users WHERE id = ?", [id]);
|
|
67
70
|
return row ? rowToUser(row) : null;
|
|
68
71
|
}
|
|
72
|
+
async function followMergedUser(row) {
|
|
73
|
+
if (!row.mergedIntoUserId)
|
|
74
|
+
return rowToUser(row);
|
|
75
|
+
const target = await getDbClient2().get("SELECT * FROM users WHERE id = ?", [
|
|
76
|
+
row.mergedIntoUserId
|
|
77
|
+
]);
|
|
78
|
+
return target ? rowToUser(target) : null;
|
|
79
|
+
}
|
|
69
80
|
async function findUserByExternalId(kind, externalId) {
|
|
70
81
|
const row = await getDbClient2().get(`SELECT u.* FROM users u
|
|
71
82
|
INNER JOIN user_external_ids x ON x.userId = u.id
|
|
72
83
|
WHERE x.kind = ? AND x.externalId = ?`, [kind, externalId]);
|
|
73
|
-
return row ?
|
|
84
|
+
return row ? followMergedUser(row) : null;
|
|
74
85
|
}
|
|
75
86
|
async function findUserByEmail(email) {
|
|
76
87
|
const lower = email.toLowerCase();
|
|
77
88
|
const db = getDbClient2();
|
|
78
|
-
const primary = await db.get("SELECT * FROM users WHERE LOWER(email) = LOWER(?)", [
|
|
79
|
-
email
|
|
80
|
-
]);
|
|
89
|
+
const primary = await db.get("SELECT * FROM users WHERE LOWER(email) = LOWER(?) AND mergedIntoUserId IS NULL", [email]);
|
|
81
90
|
if (primary)
|
|
82
91
|
return rowToUser(primary);
|
|
83
|
-
const aliasRows = await db.query(
|
|
92
|
+
const aliasRows = await db.query(`SELECT * FROM users
|
|
93
|
+
WHERE emailAliases IS NOT NULL AND emailAliases != '[]' AND mergedIntoUserId IS NULL`);
|
|
84
94
|
for (const r of aliasRows) {
|
|
85
95
|
const aliases = r.emailAliases ? JSON.parse(r.emailAliases) : [];
|
|
86
96
|
if (aliases.some((a) => a.toLowerCase() === lower)) {
|
|
@@ -94,13 +104,11 @@ async function findUsersByName(name) {
|
|
|
94
104
|
if (!trimmed)
|
|
95
105
|
return [];
|
|
96
106
|
const client = getDbClient2();
|
|
97
|
-
const exact = await client.query("SELECT * FROM users WHERE LOWER(name) = LOWER(?)", [
|
|
98
|
-
trimmed
|
|
99
|
-
]);
|
|
107
|
+
const exact = await client.query("SELECT * FROM users WHERE LOWER(name) = LOWER(?) AND mergedIntoUserId IS NULL", [trimmed]);
|
|
100
108
|
if (exact.length > 0)
|
|
101
109
|
return exact.map(rowToUser);
|
|
102
110
|
const firstToken = trimmed.split(/\s+/)[0] ?? trimmed;
|
|
103
|
-
const prefixed = await client.query("SELECT * FROM users WHERE LOWER(name) LIKE LOWER(?) || '%'", [firstToken]);
|
|
111
|
+
const prefixed = await client.query("SELECT * FROM users WHERE LOWER(name) LIKE LOWER(?) || '%' AND mergedIntoUserId IS NULL", [firstToken]);
|
|
104
112
|
return prefixed.map(rowToUser);
|
|
105
113
|
}
|
|
106
114
|
async function getUserIdentities(userId) {
|
|
@@ -208,19 +216,11 @@ async function unlinkIdentity(userId, kind, externalId, actor) {
|
|
|
208
216
|
await recordIdentityEvent(userId, "identity_removed", actor, { kind, externalId }, null);
|
|
209
217
|
});
|
|
210
218
|
}
|
|
211
|
-
function base62(bytes) {
|
|
212
|
-
const alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
213
|
-
let out = "";
|
|
214
|
-
for (const b of bytes) {
|
|
215
|
-
out += alphabet[b % 62];
|
|
216
|
-
}
|
|
217
|
-
return out;
|
|
218
|
-
}
|
|
219
219
|
function sha256Hex(input) {
|
|
220
220
|
return createHash("sha256").update(input).digest("hex");
|
|
221
221
|
}
|
|
222
222
|
async function mintToken(userId, label, actor, options = {}) {
|
|
223
|
-
const plaintext = `${TOKEN_PREFIX}${
|
|
223
|
+
const plaintext = `${TOKEN_PREFIX}${randomChars(TOKEN_ALPHABET, 24)}`;
|
|
224
224
|
const tokenId = randomUUID().replace(/-/g, "");
|
|
225
225
|
const hash = sha256Hex(plaintext);
|
|
226
226
|
const preview = plaintext.slice(-4);
|
|
@@ -317,7 +317,7 @@ async function isScriptRunToken(tokenId) {
|
|
|
317
317
|
return row?.scriptRun === 1;
|
|
318
318
|
}
|
|
319
319
|
async function insertSessionToken(agentId, taskId, runtimeId, ttlMs, parentRuntimeId = null, expiresAtCeiling, controllerId = null, parentTokenId = null, scriptRun = false) {
|
|
320
|
-
const plaintext = `${SESSION_TOKEN_PREFIX}${
|
|
320
|
+
const plaintext = `${SESSION_TOKEN_PREFIX}${randomChars(TOKEN_ALPHABET, 24)}`;
|
|
321
321
|
const tokenId = randomUUID().replace(/-/g, "");
|
|
322
322
|
const hash = sha256Hex(plaintext);
|
|
323
323
|
const preview = plaintext.slice(-4);
|
|
@@ -462,11 +462,12 @@ async function resolveSessionToken(plaintext, options = {}) {
|
|
|
462
462
|
function fingerprintApiKey(rawKey) {
|
|
463
463
|
return `op:${sha256Hex(rawKey).slice(0, 16)}`;
|
|
464
464
|
}
|
|
465
|
-
var TOKEN_PREFIX = "aswt_", SESSION_TOKEN_PREFIX = "aseph_", InvalidRuntimeTokenError, AGENT_TOKEN_BINDING = "taskId IS NULL AND runtimeId IS NULL AND controllerId IS NULL AND parentRuntimeId IS NULL AND scriptRun = 0", AGENT_TOKEN_NO_EXPIRY = "9999-12-31T23:59:59.999Z", AGENT_TOKEN_DEFAULT_TTL_MS = null, AgentTokenExistsError;
|
|
465
|
+
var TOKEN_PREFIX = "aswt_", TOKEN_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", SESSION_TOKEN_PREFIX = "aseph_", InvalidRuntimeTokenError, AGENT_TOKEN_BINDING = "taskId IS NULL AND runtimeId IS NULL AND controllerId IS NULL AND parentRuntimeId IS NULL AND scriptRun = 0", AGENT_TOKEN_NO_EXPIRY = "9999-12-31T23:59:59.999Z", AGENT_TOKEN_DEFAULT_TTL_MS = null, AgentTokenExistsError;
|
|
466
466
|
var init_users = __esm(() => {
|
|
467
467
|
init_telemetry_identity();
|
|
468
468
|
init_secret_scrubber();
|
|
469
469
|
init_session_token_connections();
|
|
470
|
+
init_short_id();
|
|
470
471
|
init_db4();
|
|
471
472
|
init_swarm_config_guard();
|
|
472
473
|
InvalidRuntimeTokenError = class InvalidRuntimeTokenError extends Error {
|