@desplega.ai/agent-swarm 2.7.4 → 2.7.6
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-bp91d37f.js +15 -0
- package/dist/{actions-gfrr9vb7.js → actions-yj0eeaqh.js} +19 -18
- package/dist/{amp-adapter-0s58gm46.js → amp-adapter-4pg9h34q.js} +3 -3
- package/dist/{app-stvq692g.js → app-909e97cr.js} +3 -3
- package/dist/{assistant-5s37fr9n.js → assistant-qdyb5fyy.js} +32 -23
- package/dist/{boot-reembed-yzy1841n.js → boot-reembed-fk0s9z18.js} +1 -1
- package/dist/{boot-reembed-cv82gz7y.js → boot-reembed-gs1rzrnh.js} +1 -1
- package/dist/{boot-scrub-sweep-8k4q95ap.js → boot-scrub-sweep-4qfd4kfx.js} +4 -4
- package/dist/{boot-seeds-ftt9htah.js → boot-seeds-yr00k13d.js} +4 -4
- package/dist/{boxd-515v1t8z.js → boxd-vdmfssd9.js} +5 -5
- package/dist/{claude-adapter-t00wrzeh.js → claude-adapter-qta1f1xn.js} +7 -7
- package/dist/{claude-managed-adapter-g6vmjccb.js → claude-managed-adapter-dvs2xw5n.js} +2 -2
- package/dist/{claude-managed-setup-afpa82f7.js → claude-managed-setup-sc6j4dm0.js} +3 -3
- package/dist/{claude-sdk-session-vj0c2azx.js → claude-sdk-session-zgrz6yvc.js} +9175 -9076
- package/dist/{cli-gjr2y2xk.js → cli-0agcv1v5.js} +4 -1
- package/dist/{cli-edmm9d9y.js → cli-0at8w34w.js} +7 -7
- package/dist/{cli-a81qevyg.js → cli-0qatpy8q.js} +20 -36
- package/dist/{cli-bcz074zx.js → cli-0yv5z2pg.js} +1 -1
- package/dist/{cli-a4btqqft.js → cli-1b7btd38.js} +1 -1
- package/dist/{cli-a2jw6ee5.js → cli-1p89xny0.js} +1 -1
- package/dist/{cli-v726afdm.js → cli-2pnswgh8.js} +1 -1
- package/dist/{cli-jkt52mgt.js → cli-386tyxxg.js} +2 -2
- package/dist/{cli-az0bpf8p.js → cli-3ypk9vk1.js} +3 -3
- package/dist/{cli-wk9md5px.js → cli-436532ck.js} +4 -4
- package/dist/{cli-7n5sbw0z.js → cli-4necwtsv.js} +5 -5
- package/dist/cli-54t00gt8.js +151 -0
- package/dist/{cli-655xm9ms.js → cli-583frbyr.js} +1 -1
- package/dist/{cli-4r12t6w6.js → cli-5c4hjzne.js} +101 -4
- package/dist/{cli-hf6zt5m6.js → cli-69szn7w7.js} +17 -1
- package/dist/{cli-rtk9g7av.js → cli-73jzwksr.js} +6 -2
- package/dist/{cli-jg0nfda6.js → cli-75gkpjvw.js} +52 -21
- package/dist/{cli-wcmnan2g.js → cli-89knwags.js} +5 -5
- package/dist/{cli-pwyevs29.js → cli-8bc1w0tw.js} +22 -21
- package/dist/{cli-t282jgab.js → cli-8snvgs5r.js} +41 -16
- package/dist/{cli-vqgnyh76.js → cli-98rw5dt5.js} +15 -3
- package/dist/{cli-9cctx1tn.js → cli-a22h291q.js} +1 -1
- package/dist/{cli-ycm6180s.js → cli-a7v854rf.js} +5 -3
- package/dist/{cli-98pke4vk.js → cli-ae7mrdf9.js} +2 -2
- package/dist/{cli-je8yeyc5.js → cli-bjb3z51z.js} +5 -5
- package/dist/{cli-mc97xy2s.js → cli-c60vetmm.js} +16 -4
- package/dist/{cli-j4kw3rsx.js → cli-cm5yqn35.js} +18 -0
- package/dist/{cli-wndv9p7g.js → cli-decfb6v8.js} +6 -6
- package/dist/{cli-h55y2bjc.js → cli-dhar9qay.js} +2 -2
- package/dist/{cli-8yy525ad.js → cli-drr5v6av.js} +2 -2
- package/dist/{cli-5gr1g711.js → cli-dxae2yg7.js} +2 -2
- package/dist/{cli-pe09p6dv.js → cli-e3r2neck.js} +8 -7
- package/dist/{cli-13jvmew3.js → cli-ekwks2vs.js} +7 -7
- package/dist/{cli-jg4p5t36.js → cli-es6va8jk.js} +121 -51
- package/dist/{cli-j4kt1mpb.js → cli-faxe6thg.js} +3 -3
- package/dist/{cli-tzrpv5sc.js → cli-ftyxyspd.js} +1 -1
- package/dist/cli-fw2w0kva.js +47 -0
- package/dist/{cli-2dfbv8qr.js → cli-fy6x31ps.js} +1 -0
- package/dist/{cli-aq58fk5m.js → cli-g83s9ewh.js} +7 -1
- package/dist/cli-gdhpcbhf.js +55 -0
- package/dist/{cli-82jg7fp9.js → cli-he5nxaa8.js} +1 -1
- package/dist/{cli-8veytvbh.js → cli-he9wchme.js} +1 -1
- package/dist/{cli-k76tgq03.js → cli-hgaazk69.js} +2 -2
- package/dist/{cli-d2pzqej1.js → cli-hr2e2fft.js} +741 -7
- package/dist/{cli-dae4sbgy.js → cli-jm2vfpfd.js} +2 -2
- package/dist/{cli-1s1dqn1j.js → cli-k2gzwsj2.js} +297 -140
- package/dist/{cli-b1afgtj3.js → cli-kqdg1bsb.js} +3 -3
- package/dist/cli-m2z8jagn.js +12078 -0
- package/dist/{cli-mvckssyq.js → cli-m48g6p95.js} +5 -5
- package/dist/{cli-bwty35gx.js → cli-mthwvjre.js} +1 -1
- package/dist/{cli-41z8xwj0.js → cli-nhrvpaj7.js} +34 -8
- package/dist/{cli-ahd90bwt.js → cli-nwj0ee2w.js} +6 -6
- package/dist/{cli-kvtc7aez.js → cli-p5gp8pcx.js} +44 -14
- package/dist/{cli-avgcz4ra.js → cli-pd7vagab.js} +436 -171
- package/dist/{cli-zn15c46z.js → cli-q0k1w5zd.js} +1 -1
- package/dist/{cli-bq2pcphn.js → cli-rmmmrjkd.js} +1 -1
- package/dist/{cli-2qpvmmkw.js → cli-s0qnd4wv.js} +1 -1
- package/dist/{cli-kg8hchyg.js → cli-sa02jsqt.js} +1 -1
- package/dist/{cli-1yekbyqm.js → cli-shpbx5ee.js} +283 -82
- package/dist/{cli-9y354g3j.js → cli-srye3vdt.js} +1 -1
- package/dist/{cli-byqfbnjw.js → cli-svj5090z.js} +9 -9
- package/dist/{cli-gcbdjt47.js → cli-vfym7wmz.js} +6 -6
- package/dist/{cli-v1yw3wha.js → cli-vvpx3gsx.js} +4 -4
- package/dist/{cli-a1fhj4n9.js → cli-w6dt9ged.js} +2 -2
- package/dist/{cli-1gm8jcyr.js → cli-waqbxg08.js} +5232 -68
- package/dist/{cli-5hjced2v.js → cli-wp9sp1qb.js} +6 -6
- package/dist/{cli-eny54typ.js → cli-wx3rhnm0.js} +1 -1
- package/dist/{cli-s0exq74r.js → cli-xbbndvjy.js} +3 -3
- package/dist/{cli-f255yaqn.js → cli-xds5f77d.js} +3 -3
- package/dist/{cli-0sbkss7h.js → cli-xnqgpshy.js} +2 -2
- package/dist/{cli-0fgr1w9b.js → cli-xnrwazav.js} +20 -3
- package/dist/{cli-gf5hbmdr.js → cli-yjdgea32.js} +3 -3
- package/dist/{cli-cq1pf336.js → cli-yn4kxs06.js} +124 -11
- package/dist/{cli-224epwwf.js → cli-yx4kfngt.js} +3 -3
- package/dist/{cli-eqx6k993.js → cli-yy3rhsdw.js} +47 -13
- package/dist/{cli-36g23z21.js → cli-zbbwez0r.js} +4 -4
- package/dist/{cli-ktmvb20s.js → cli-zm72anhg.js} +12 -12
- package/dist/cli.js +26 -25
- package/dist/{codex-adapter-g0gctw29.js → codex-adapter-ayd1fb6h.js} +5 -5
- package/dist/{codex-hook-vrzz2xhr.js → codex-hook-9efm2x1m.js} +1 -1
- package/dist/{codex-login-0gg46ygn.js → codex-login-y0pmff1c.js} +1 -1
- package/dist/{codex-session-runner-dr2cxe1c.js → codex-session-runner-jesa32xc.js} +6 -6
- package/dist/{commands-1p07cvff.js → commands-hanewgf2.js} +9 -3
- package/dist/{controller-z0s7sv6r.js → controller-dt1n3c1q.js} +9 -4
- package/dist/{controllers-connect-x9kvvhyk.js → controllers-connect-xx8x64n5.js} +22 -21
- package/dist/{cursor-adapter-m5b98pvk.js → cursor-adapter-9s4dwwdw.js} +2 -2
- package/dist/{db-capk2raj.js → db-3vttcbv4.js} +3 -3
- package/dist/{db-rsh04kh3.js → db-9dv0g1ab.js} +12 -4
- package/dist/{devin-adapter-yxm87fe9.js → devin-adapter-r9phbnc9.js} +1 -1
- package/dist/{devtools-82fzqra8.js → devtools-qxfgbsqz.js} +1 -1
- package/dist/{dispatcher-304q6fwa.js → dispatcher-tx9hd1sv.js} +18 -17
- package/dist/{docker-7rxt0rry.js → docker-c1a3gqmf.js} +91 -24
- package/dist/{dsh-adapter-btewem0y.js → dsh-adapter-007y4ejs.js} +2 -2
- package/dist/{e2b-renc0k8q.js → e2b-a19d28rz.js} +4 -4
- package/dist/{e2b-7fc9b9bd.js → e2b-we6hs6q5.js} +6 -6
- package/dist/{easter-egg-3d-fm1p3n4d.js → easter-egg-3d-rgbrqb8s.js} +1 -1
- package/dist/{embedding-space-s68v49ct.js → embedding-space-ny1e2940.js} +6 -6
- package/dist/{embeddings-4ms3604w.js → embeddings-2t386t13.js} +1 -1
- package/dist/{event-bus-dfjx2qdh.js → event-bus-g0ka3pbw.js} +1 -1
- package/dist/{execute-mcdgccjs.js → execute-pksh0ceh.js} +1 -1
- package/dist/{external-channel-9dxwfztn.js → external-channel-phgmhmd7.js} +2 -2
- package/dist/fx-adapter-fy8rr921.js +18 -0
- package/dist/{google-generative-ai-yvmdxyxa.js → google-generative-ai-8y3m3k4b.js} +1 -1
- package/dist/{google-vertex-jrtdh9gs.js → google-vertex-w3v98n7b.js} +1 -1
- package/dist/{grok-adapter-05ecv4h0.js → grok-adapter-q0abvpaj.js} +8 -8
- package/dist/handlers-by3sfxyx.js +32 -0
- package/dist/{heartbeat-3n94heh3.js → heartbeat-kadyek8p.js} +21 -20
- package/dist/{hook-aadrn69x.js → hook-5zs3msf6.js} +6 -6
- package/dist/{hook-zxwje86c.js → hook-9k551xnj.js} +4 -4
- package/dist/{http-xzxk9mst.js → http-mhz9vw1f.js} +272 -103
- package/dist/index-4f2pvxae.js +37 -0
- package/dist/index-98gz7tmp.js +30 -0
- package/dist/{index-5rk6rfzr.js → index-fvzke5kx.js} +1 -1
- package/dist/index-k08z2cak.js +33 -0
- package/dist/{index-yqhz88yy.js → index-pxn30mse.js} +8 -8
- package/dist/{index-d34f6r87.js → index-q361cg2f.js} +1 -1
- package/dist/{index-9j4zwcht.js → index-rvr00sg7.js} +168 -675
- package/dist/{index-qeb82z37.js → index-vdygbq10.js} +1 -1
- package/dist/{keepalive-w4aakbyk.js → keepalive-w56f32cg.js} +4 -4
- package/dist/lead-enq35nqp.js +70 -0
- package/dist/{maintenance-hbptpk6p.js → maintenance-7mdgxcea.js} +1 -1
- package/dist/{oauth-refresh-sweep-217semrv.js → oauth-refresh-sweep-29txy9vk.js} +3 -3
- package/dist/{onboard-vz2s5df3.js → onboard-kpsrkarj.js} +5 -5
- package/dist/{opencode-adapter-gtfd7d7v.js → opencode-adapter-j25vm3rr.js} +5 -5
- package/dist/{otel-impl-aefave37.js → otel-impl-6kkct7a8.js} +2 -2
- package/dist/{pi-mono-adapter-f8h5yseh.js → pi-mono-adapter-exhkzhn2.js} +117 -23
- package/dist/{pricing-refresh-m1yhh9ya.js → pricing-refresh-n2x7jh6k.js} +3 -3
- package/dist/{rbac-roles-rrw8twdz.js → rbac-roles-81ypx6es.js} +1 -1
- package/dist/{rbac-roles-svj72cdf.js → rbac-roles-b5htkjby.js} +2 -2
- package/dist/{render-v2-amwbnfxh.js → render-v2-qn6jmpk4.js} +3 -3
- package/dist/{resume-9cd6wf6z.js → resume-wd30wx23.js} +7 -7
- package/dist/{runtime-fp4vrx7m.js → runtime-4hsg7h60.js} +1 -1
- package/dist/{session-access-21t6yjyg.js → session-access-5qvfevhk.js} +4 -4
- package/dist/{session-source-backfill-pxbzcsc6.js → session-source-backfill-n1czavbr.js} +3 -3
- package/dist/{setup-4592tqz4.js → setup-dnb56qy5.js} +3 -3
- package/dist/{virtual-modules-gzfnpmnz.js → virtual-modules-76xxv9fs.js} +2 -2
- package/dist/{work-objects-t9tcf174.js → work-objects-4n21tfkm.js} +21 -20
- package/dist/{worker-follow-up-q32jh4yk.js → worker-follow-up-77hvzxww.js} +18 -17
- package/dist/worker-gg1576j3.js +70 -0
- package/dist/{x-b6wxntdt.js → x-vmmye1kb.js} +2 -2
- package/openapi.json +189 -32
- package/package.json +8 -7
- package/src/be/db/script-runs.ts +23 -0
- package/src/be/db/session-summaries.ts +8 -2
- package/src/be/db/session-tree.ts +174 -61
- package/src/be/db/session-visibility.ts +5 -4
- package/src/be/db/tasks/read.ts +122 -3
- package/src/be/db-client.ts +8 -5
- package/src/be/db.ts +23 -8
- package/src/be/memory/providers/sqlite-store.ts +49 -12
- package/src/be/migrations/259_session_summaries_open_tasks.sql +111 -0
- package/src/be/migrations/260_runtime_pool_cache.sql +20 -0
- package/src/be/migrations/262_session_visibility_indexes.sql +18 -0
- package/src/be/migrations/263_task_list_filter_index.sql +11 -0
- package/src/be/migrations/264_slack_thread_cover_index.sql +9 -0
- package/src/be/migrations/266_script_runs_source_task.sql +11 -0
- package/src/be/model-validation.ts +5 -1
- package/src/be/pricing-normalize.ts +7 -2
- package/src/be/runtime-pools/cache-cleanup.ts +109 -0
- package/src/be/runtime-pools/db.ts +65 -6
- package/src/be/runtime-pools/remote-controller.ts +5 -0
- package/src/be/runtime-pools/supervisor.ts +33 -2
- package/src/be/scripts/typecheck.ts +23 -0
- package/src/be/seed/schedules-seeder.ts +135 -9
- package/src/be/seed/workflows-seeder.ts +65 -1
- package/src/be/seed-pricing.ts +23 -0
- package/src/be/seed-scripts/catalog/task-failure-audit.ts +5 -1
- package/src/be/steering.ts +50 -3
- package/src/be/swarm-config-guard.ts +1 -0
- package/src/commands/controller.ts +4 -0
- package/src/commands/entrypoint-api-readiness.ts +74 -0
- package/src/commands/provider-credentials.ts +29 -2
- package/src/commands/runner.ts +86 -5
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/contract.ts +27 -1
- package/src/extensions/dispatcher.ts +4 -0
- package/src/http/agents.ts +1 -0
- package/src/http/index.ts +1 -1
- package/src/http/list-total-cache.ts +14 -7
- package/src/http/mcp-bridge.ts +4 -0
- package/src/http/memory.ts +38 -9
- package/src/http/script-runs.ts +174 -5
- package/src/http/status.ts +10 -2
- package/src/http/tasks.ts +4 -2
- package/src/integrations/chat-sdk/inbound.ts +15 -5
- package/src/integrations/chat-sdk/steering.ts +3 -1
- package/src/kv-reserved-namespaces.ts +2 -0
- package/src/prompts/base-prompt.ts +4 -1
- package/src/prompts/session-templates.ts +26 -0
- package/src/providers/acp-adapter.ts +190 -26
- package/src/providers/acp-targets.ts +306 -6
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/codex-adapter.ts +9 -44
- package/src/providers/codex-oauth/flow.ts +24 -3
- package/src/providers/codex-oauth/storage.ts +56 -17
- package/src/providers/codex-oauth/subscription.ts +67 -0
- package/src/providers/fx-adapter.ts +211 -0
- package/src/providers/index.ts +5 -1
- package/src/providers/mcp-loopback-proxy.ts +94 -0
- package/src/providers/pi-mono-adapter.ts +98 -13
- package/src/providers/pricing-sources.md +8 -0
- package/src/providers/reasoning-effort.ts +17 -1
- package/src/providers/types.ts +2 -1
- package/src/runtime-providers/controller-protocol.ts +14 -1
- package/src/runtime-providers/controller.ts +5 -0
- package/src/runtime-providers/docker.ts +108 -23
- package/src/runtime-providers/types.ts +16 -0
- package/src/scheduler/scheduler.ts +36 -3
- package/src/script-workflows/workflow-ctx.ts +8 -0
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/types/stdlib.d.ts +27 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +33 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +27 -0
- package/src/server-user.ts +1 -0
- package/src/server.ts +7 -0
- package/src/slack/assistant.ts +17 -1
- package/src/slack/commands.ts +5 -1
- package/src/slack/handlers.ts +53 -5
- package/src/slack/left-threads.ts +88 -0
- package/src/slack/steering.ts +3 -0
- package/src/slack/thread-buffer.ts +40 -16
- package/src/tasks/follow-up-redelegation-guard.ts +155 -0
- package/src/tests/acp-adapter.test.ts +79 -0
- package/src/tests/base-prompt.test.ts +12 -0
- package/src/tests/chat-sdk-inbound.test.ts +30 -0
- package/src/tests/chatgpt-subscription-model-groups.test.ts +62 -0
- package/src/tests/chatgpt-subscription-pi.test.ts +170 -0
- package/src/tests/chatgpt-subscription-session-bench.test.ts +198 -0
- package/src/tests/claude-artifacts-read-script.test.ts +209 -0
- package/src/tests/codex-oauth-credential-info.test.ts +40 -0
- package/src/tests/codex-oauth-refresh-egress.test.ts +194 -0
- package/src/tests/context-window.test.ts +7 -0
- package/src/tests/db-client.test.ts +21 -0
- package/src/tests/db-task-read-contract.test.ts +8 -2
- package/src/tests/db-task-write-contract.test.ts +5 -1
- package/src/tests/entrypoint-api-readiness.test.ts +416 -210
- package/src/tests/explicit-model-validation.test.ts +113 -8
- package/src/tests/extensions-run-context.test.ts +11 -0
- package/src/tests/extensions-steering.test.ts +353 -0
- package/src/tests/extensions-validate.test.ts +5 -0
- package/src/tests/fixtures/extensions/steering-policy/hooks.ts +39 -0
- package/src/tests/fixtures/extensions/steering-policy/manifest.json +7 -0
- package/src/tests/fixtures/fake-fx.ts +167 -0
- package/src/tests/fixtures/fx/acp-responses-recorded.json +157 -0
- package/src/tests/fixtures/fx/acp-updates-recorded.jsonl +15 -0
- package/src/tests/follow-up-redelivery-guard.test.ts +432 -202
- package/src/tests/fx-adapter.test.ts +771 -0
- package/src/tests/grok-adapter.test.ts +36 -0
- package/src/tests/list-total-cache.test.ts +27 -2
- package/src/tests/mcp-loopback-proxy.test.ts +193 -0
- package/src/tests/memory-fts-populate.test.ts +11 -9
- package/src/tests/memory-retrieval-purge.test.ts +80 -0
- package/src/tests/migration-260-runtime-pool-cache.test.ts +118 -0
- package/src/tests/model-tier-resolution.test.ts +3 -3
- package/src/tests/pricing-refresh.test.ts +5 -5
- package/src/tests/prompt-template-session.test.ts +5 -3
- package/src/tests/provider-registration.test.ts +2 -1
- package/src/tests/query-audit-plans.test.ts +30 -2
- package/src/tests/runtime-cache-cleanup.test.ts +367 -0
- package/src/tests/runtime-e2b-pools.test.ts +41 -0
- package/src/tests/runtime-pools-db.test.ts +98 -0
- package/src/tests/runtime-pools-http.test.ts +29 -0
- package/src/tests/runtime-providers-docker.test.ts +253 -0
- package/src/tests/runtime-remote-controller.test.ts +66 -2
- package/src/tests/runtime-supervisor.test.ts +66 -2
- package/src/tests/script-connections.test.ts +13 -0
- package/src/tests/script-runs-http.test.ts +684 -2
- package/src/tests/seed-model-profiles.test.ts +2 -2
- package/src/tests/seed-schedules.test.ts +138 -0
- package/src/tests/seed-scripts.test.ts +26 -0
- package/src/tests/session-cost-recompute-unit.test.ts +39 -0
- package/src/tests/session-costs-golden.test.ts +26 -0
- package/src/tests/session-summaries-plans.test.ts +120 -0
- package/src/tests/session-summaries.test.ts +72 -12
- package/src/tests/sessions-tree.test.ts +11 -3
- package/src/tests/slack-leave-thread.test.ts +571 -0
- package/src/tests/slack-render-v2-query-plans.test.ts +24 -2
- package/src/tests/status.test.ts +11 -0
- package/src/tests/tasks-readable-row.test.ts +155 -0
- package/src/tests/tool-annotations.test.ts +2 -1
- package/src/tests/workflow-engine-v2.test.ts +42 -0
- package/src/tests/workflow-script-principal.test.ts +207 -7
- package/src/tools/send-task.ts +35 -47
- package/src/tools/slack-leave-thread.ts +104 -0
- package/src/tools/steer-task.ts +3 -2
- package/src/tools/task-dedup.ts +45 -21
- package/src/tools/tool-config.ts +2 -1
- package/src/types.ts +57 -0
- package/src/utils/codex-auth-failure.ts +30 -0
- package/src/utils/context-window.ts +4 -1
- package/src/utils/credentials.ts +7 -0
- package/src/utils/fx-models.ts +43 -0
- package/src/workflows/cooldown.ts +3 -2
- package/src/workflows/engine.ts +24 -9
- package/templates/schedules/dreaming-daily/config.json +1 -1
- package/templates/schedules/dreaming-daily/content.md +6 -14
- package/templates/skills/composio-google-docs/content.md +10 -0
- package/templates/skills/script-workflows/content.md +19 -1
- package/templates/skills/swarm-docs/content.md +2 -0
- package/templates/skills/swarm-scripts/SKILL.md +2 -0
- package/templates/skills/swarm-scripts/content.md +2 -0
- package/templates/workflows/dreaming/content.md +5 -1
- package/dist/acp-adapter-96dc64m2.js +0 -15
- package/dist/cli-dznrgaep.js +0 -30
- package/dist/cli-w3hcrxht.js +0 -6985
- package/dist/handlers-jg7v74ty.js +0 -31
- package/dist/index-8c1zbz59.js +0 -29
- package/dist/index-8k8tmfxd.js +0 -32
- package/dist/index-hq617xdj.js +0 -36
- package/dist/lead-567kw7x3.js +0 -68
- package/dist/worker-fjdqra6q.js +0 -68
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
} from "./cli-242037k3.js";
|
|
4
4
|
|
|
5
5
|
// src/runtime-providers/types.ts
|
|
6
|
+
function poolCacheKey(poolId, generation) {
|
|
7
|
+
return `swarm-cache-${poolId}${generation ? `-${generation}` : ""}`;
|
|
8
|
+
}
|
|
6
9
|
var RUNTIME_LABELS;
|
|
7
10
|
var init_types5 = __esm(() => {
|
|
8
11
|
RUNTIME_LABELS = {
|
|
@@ -13,4 +16,4 @@ var init_types5 = __esm(() => {
|
|
|
13
16
|
};
|
|
14
17
|
});
|
|
15
18
|
|
|
16
|
-
export { RUNTIME_LABELS, init_types5 };
|
|
19
|
+
export { poolCacheKey, RUNTIME_LABELS, init_types5 };
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
streamSimple2,
|
|
50
50
|
completeSimple,
|
|
51
51
|
init_compat
|
|
52
|
-
} from "./cli-
|
|
52
|
+
} from "./cli-436532ck.js";
|
|
53
53
|
import {
|
|
54
54
|
cleanupSessionResources,
|
|
55
55
|
uuidv7
|
|
@@ -55322,7 +55322,7 @@ function loadAllHighlightLanguages() {
|
|
|
55322
55322
|
if (!allLanguagesPromise) {
|
|
55323
55323
|
allLanguagesPromise = new Promise((resolve) => {
|
|
55324
55324
|
setImmediate(() => {
|
|
55325
|
-
import("./index-
|
|
55325
|
+
import("./index-q361cg2f.js").then((m)=>__toESM(m.default,1)).then(() => resolve(), () => {
|
|
55326
55326
|
resolve();
|
|
55327
55327
|
});
|
|
55328
55328
|
});
|
|
@@ -61474,7 +61474,7 @@ function getCreateJiti() {
|
|
|
61474
61474
|
}
|
|
61475
61475
|
var virtualModulesPromise;
|
|
61476
61476
|
function getVirtualModules() {
|
|
61477
|
-
virtualModulesPromise ??= import("./virtual-modules-
|
|
61477
|
+
virtualModulesPromise ??= import("./virtual-modules-76xxv9fs.js").then((module) => module.VIRTUAL_MODULES);
|
|
61478
61478
|
return virtualModulesPromise;
|
|
61479
61479
|
}
|
|
61480
61480
|
var _aliases = null;
|
|
@@ -80380,7 +80380,7 @@ function parseCodemodeSource(input) {
|
|
|
80380
80380
|
init_build();
|
|
80381
80381
|
|
|
80382
80382
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.lazy.js
|
|
80383
|
-
var loadCodemodeExecutor = () => import("./execute-
|
|
80383
|
+
var loadCodemodeExecutor = () => import("./execute-pksh0ceh.js");
|
|
80384
80384
|
|
|
80385
80385
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.js
|
|
80386
80386
|
var CODE_PREVIEW_LINES = 10;
|
|
@@ -81537,7 +81537,7 @@ function createMcpResourceToolDefinitions(options) {
|
|
|
81537
81537
|
}
|
|
81538
81538
|
|
|
81539
81539
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.lazy.js
|
|
81540
|
-
var loadMcpRuntime = () => import("./runtime-
|
|
81540
|
+
var loadMcpRuntime = () => import("./runtime-4hsg7h60.js");
|
|
81541
81541
|
|
|
81542
81542
|
// node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.js
|
|
81543
81543
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
@@ -86666,7 +86666,7 @@ var builtInExtensions = [
|
|
|
86666
86666
|
];
|
|
86667
86667
|
|
|
86668
86668
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.lazy.js
|
|
86669
|
-
var loadMcpCommand = () => import("./cli-
|
|
86669
|
+
var loadMcpCommand = () => import("./cli-386tyxxg.js");
|
|
86670
86670
|
|
|
86671
86671
|
// node_modules/@earendil-works/pi-coding-agent/dist/migrations.js
|
|
86672
86672
|
import { existsSync as existsSync22, mkdirSync as mkdirSync11, readdirSync as readdirSync10, readFileSync as readFileSync17, renameSync as renameSync2, rmSync as rmSync3, writeFileSync as writeFileSync11 } from "fs";
|
|
@@ -89196,7 +89196,7 @@ function playEasterEgg3d(tui, egg) {
|
|
|
89196
89196
|
if (tui.hasOverlay())
|
|
89197
89197
|
return true;
|
|
89198
89198
|
const screen = tui.getScreenLines();
|
|
89199
|
-
import("./easter-egg-3d-
|
|
89199
|
+
import("./easter-egg-3d-rgbrqb8s.js").then((module) => module.playEasterEgg3d(tui, screen, egg), () => {});
|
|
89200
89200
|
return true;
|
|
89201
89201
|
}
|
|
89202
89202
|
function playPiLogo3d(tui, column, row) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
contextBoundNoteThreshold,
|
|
3
3
|
createContextBoundNote
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-dhar9qay.js";
|
|
5
5
|
import {
|
|
6
6
|
SessionErrorTracker
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-mthwvjre.js";
|
|
8
8
|
import {
|
|
9
9
|
summarizeSession
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-faxe6thg.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveCodexPrompt
|
|
13
13
|
} from "./cli-jc1g9ndz.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./cli-98rwmcyc.js";
|
|
23
23
|
import {
|
|
24
24
|
applyReasoningEffort
|
|
25
|
-
} from "./cli-
|
|
25
|
+
} from "./cli-98rw5dt5.js";
|
|
26
26
|
import {
|
|
27
27
|
createSwarmEventHandler
|
|
28
28
|
} from "./cli-4zsenjhy.js";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
computeContextUsedUnified,
|
|
35
35
|
clampContextPercent,
|
|
36
36
|
init_context_window
|
|
37
|
-
} from "./cli-
|
|
37
|
+
} from "./cli-73jzwksr.js";
|
|
38
38
|
import {
|
|
39
39
|
getMemoryRaterNames,
|
|
40
40
|
init_memory_raters,
|
|
@@ -52,10 +52,10 @@ import {
|
|
|
52
52
|
import {
|
|
53
53
|
credentialsToAuthJson,
|
|
54
54
|
init_auth_json,
|
|
55
|
-
|
|
55
|
+
buildPoolRevalidationFailureReason,
|
|
56
56
|
getValidCodexOAuth,
|
|
57
57
|
init_storage
|
|
58
|
-
} from "./cli-
|
|
58
|
+
} from "./cli-75gkpjvw.js";
|
|
59
59
|
import {
|
|
60
60
|
swarmRuntimeInstanceId,
|
|
61
61
|
init_multi_runtime2
|
|
@@ -63,7 +63,11 @@ import {
|
|
|
63
63
|
import {
|
|
64
64
|
DEFAULT_MODEL_TIER_MAP,
|
|
65
65
|
init_types4
|
|
66
|
-
} from "./cli-
|
|
66
|
+
} from "./cli-nhrvpaj7.js";
|
|
67
|
+
import {
|
|
68
|
+
isCodexRejectedAccessError,
|
|
69
|
+
init_codex_auth_failure
|
|
70
|
+
} from "./cli-fw2w0kva.js";
|
|
67
71
|
import {
|
|
68
72
|
routeCredentialStatus,
|
|
69
73
|
CODEX_GATEWAY_API_KEY,
|
|
@@ -72,15 +76,15 @@ import {
|
|
|
72
76
|
init_src,
|
|
73
77
|
selectCredential,
|
|
74
78
|
init_credentials2
|
|
75
|
-
} from "./cli-
|
|
79
|
+
} from "./cli-g83s9ewh.js";
|
|
76
80
|
import {
|
|
77
81
|
runtimeCatalogModel,
|
|
78
82
|
init_runtime_model_catalog
|
|
79
|
-
} from "./cli-
|
|
83
|
+
} from "./cli-1p89xny0.js";
|
|
80
84
|
import {
|
|
81
85
|
init_package,
|
|
82
86
|
package_default
|
|
83
|
-
} from "./cli-
|
|
87
|
+
} from "./cli-e3r2neck.js";
|
|
84
88
|
import {
|
|
85
89
|
isEnvFlagEnabled,
|
|
86
90
|
isSessionSummarySkipped,
|
|
@@ -93,10 +97,10 @@ import {
|
|
|
93
97
|
import {
|
|
94
98
|
scrubSecrets,
|
|
95
99
|
init_secret_scrubber
|
|
96
|
-
} from "./cli-
|
|
100
|
+
} from "./cli-1b7btd38.js";
|
|
97
101
|
import {
|
|
98
102
|
init_src2
|
|
99
|
-
} from "./cli-
|
|
103
|
+
} from "./cli-5c4hjzne.js";
|
|
100
104
|
|
|
101
105
|
// src/providers/codex-oauth/home.ts
|
|
102
106
|
import os from "node:os";
|
|
@@ -110,6 +114,7 @@ init_llm();
|
|
|
110
114
|
import { existsSync as nodeExistsSync } from "node:fs";
|
|
111
115
|
import { join as join3 } from "node:path";
|
|
112
116
|
init_api_key();
|
|
117
|
+
init_codex_auth_failure();
|
|
113
118
|
init_context_window();
|
|
114
119
|
init_credentials2();
|
|
115
120
|
init_env_flag();
|
|
@@ -588,6 +593,7 @@ function createCodexSwarmEventHandler(opts) {
|
|
|
588
593
|
}
|
|
589
594
|
|
|
590
595
|
// src/providers/codex-adapter.ts
|
|
596
|
+
init_storage();
|
|
591
597
|
var CODEX_GATEWAY_PROVIDER_ID = "swarm-gateway";
|
|
592
598
|
function codexGatewayConfig(route) {
|
|
593
599
|
return {
|
|
@@ -703,16 +709,6 @@ async function resolveCodexAuthMode(config, emit, deps = {}) {
|
|
|
703
709
|
}
|
|
704
710
|
return currentMode;
|
|
705
711
|
}
|
|
706
|
-
function buildPoolRevalidationFailureReason(err, slot) {
|
|
707
|
-
if (err instanceof CodexOAuthRefreshError) {
|
|
708
|
-
if (err.reason === "lock_timeout") {
|
|
709
|
-
return `[auth-error] Codex pool slot ${slot} [...${err.keySuffix}] revalidation failed: timed out waiting for the refresh lock — transient, will retry on next task.`;
|
|
710
|
-
}
|
|
711
|
-
return `[auth-error] Codex pool slot ${slot} [...${err.keySuffix}] revalidation failed: refresh rejected (${err.status ?? "unknown status"} ${err.body ?? ""}) — credential likely revoked; re-run codex-login for this slot.`;
|
|
712
|
-
}
|
|
713
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
714
|
-
return `[auth-error] Codex pool slot ${slot} revalidation failed (not a confirmed auth rejection, transient): ${message}`;
|
|
715
|
-
}
|
|
716
712
|
async function buildCodexConfig(config, model, emit) {
|
|
717
713
|
const mcpServers = {};
|
|
718
714
|
const runtimeInstanceId = swarmRuntimeInstanceId();
|
|
@@ -1535,19 +1531,7 @@ class CodexSession {
|
|
|
1535
1531
|
category: "rate_limit"
|
|
1536
1532
|
};
|
|
1537
1533
|
}
|
|
1538
|
-
|
|
1539
|
-
"unauthorized",
|
|
1540
|
-
"http 401",
|
|
1541
|
-
" 401 ",
|
|
1542
|
-
"invalid api key",
|
|
1543
|
-
"invalid_api_key",
|
|
1544
|
-
"missing api key",
|
|
1545
|
-
"no api key",
|
|
1546
|
-
"authentication failed",
|
|
1547
|
-
"failed to refresh token",
|
|
1548
|
-
"invalid 'refresh_token'"
|
|
1549
|
-
];
|
|
1550
|
-
if (authPatterns.some((p) => normalized.includes(p))) {
|
|
1534
|
+
if (isCodexRejectedAccessError(normalized)) {
|
|
1551
1535
|
const slot = this.config.codexSlot;
|
|
1552
1536
|
const guidance = slot === undefined ? "Codex authentication failed — check OPENAI_API_KEY or ChatGPT login." : `Codex pool slot ${slot} authentication failed — re-run agent-swarm codex-login --slot ${slot}.`;
|
|
1553
1537
|
return {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
loadMcpConfig,
|
|
10
10
|
addMcpServerConfig,
|
|
11
11
|
removeMcpServerConfig
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-0at8w34w.js";
|
|
13
13
|
import {
|
|
14
14
|
McpOAuthCredentialStore2,
|
|
15
15
|
McpSignInCancelledError2,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
McpServerLog2,
|
|
18
18
|
createDefaultTransport2,
|
|
19
19
|
McpServerConnection2
|
|
20
|
-
} from "./cli-
|
|
20
|
+
} from "./cli-dxae2yg7.js";
|
|
21
21
|
|
|
22
22
|
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.js
|
|
23
23
|
import { existsSync } from "node:fs";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
isGrokOpenRouterModel,
|
|
3
3
|
grokTargetProfile,
|
|
4
4
|
ACPAdapter2
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-pd7vagab.js";
|
|
6
6
|
import {
|
|
7
7
|
getOpenRouterBaseUrl,
|
|
8
8
|
getOpenRouterAttributionHeaders,
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
registerVolatileSecret,
|
|
13
13
|
init_secret_scrubber
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-1b7btd38.js";
|
|
15
15
|
import {
|
|
16
16
|
normalizeGrokModel,
|
|
17
17
|
init_src2
|
|
18
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-5c4hjzne.js";
|
|
19
19
|
|
|
20
20
|
// src/providers/grok-adapter.ts
|
|
21
21
|
init_src2();
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
persistCodexOAuth,
|
|
3
3
|
getValidCodexOAuth,
|
|
4
4
|
init_storage
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-75gkpjvw.js";
|
|
6
6
|
import {
|
|
7
7
|
registerSessionResourceCleanup,
|
|
8
8
|
cleanupSessionResources,
|
|
@@ -118,7 +118,7 @@ import {
|
|
|
118
118
|
init_src,
|
|
119
119
|
selectCredential,
|
|
120
120
|
init_credentials2
|
|
121
|
-
} from "./cli-
|
|
121
|
+
} from "./cli-g83s9ewh.js";
|
|
122
122
|
import {
|
|
123
123
|
__export,
|
|
124
124
|
__esm
|
|
@@ -17088,13 +17088,13 @@ var init_azure_openai_responses_lazy = __esm(() => {
|
|
|
17088
17088
|
});
|
|
17089
17089
|
|
|
17090
17090
|
// node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.js
|
|
17091
|
-
var googleGenerativeAIApi = () => lazyApi(() => import("./google-generative-ai-
|
|
17091
|
+
var googleGenerativeAIApi = () => lazyApi(() => import("./google-generative-ai-8y3m3k4b.js"));
|
|
17092
17092
|
var init_google_generative_ai_lazy = __esm(() => {
|
|
17093
17093
|
init_lazy();
|
|
17094
17094
|
});
|
|
17095
17095
|
|
|
17096
17096
|
// node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.js
|
|
17097
|
-
var googleVertexApi = () => lazyApi(() => import("./google-vertex-
|
|
17097
|
+
var googleVertexApi = () => lazyApi(() => import("./google-vertex-w3v98n7b.js"));
|
|
17098
17098
|
var init_google_vertex_lazy = __esm(() => {
|
|
17099
17099
|
init_lazy();
|
|
17100
17100
|
});
|
|
@@ -11,16 +11,16 @@ import {
|
|
|
11
11
|
init_active_sessions,
|
|
12
12
|
getSteeringMessageById2,
|
|
13
13
|
init_db4
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-k2gzwsj2.js";
|
|
15
15
|
import {
|
|
16
16
|
getUserGrant2,
|
|
17
17
|
init_rbac_roles
|
|
18
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-rmmmrjkd.js";
|
|
19
19
|
import {
|
|
20
20
|
findUserById,
|
|
21
21
|
findUserByExternalId,
|
|
22
22
|
init_users
|
|
23
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-drr5v6av.js";
|
|
24
24
|
import {
|
|
25
25
|
isRbacEnabled,
|
|
26
26
|
can,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
import {
|
|
46
46
|
scrubSecrets,
|
|
47
47
|
init_secret_scrubber
|
|
48
|
-
} from "./cli-
|
|
48
|
+
} from "./cli-1b7btd38.js";
|
|
49
49
|
import {
|
|
50
50
|
__esm
|
|
51
51
|
} from "./cli-242037k3.js";
|
|
@@ -499,7 +499,7 @@ function route(def) {
|
|
|
499
499
|
try {
|
|
500
500
|
const rawBody = def.body ? await parseBody(req, def.maxBodyBytes) : undefined;
|
|
501
501
|
if (def.session && "bodyTaskIds" in def.session) {
|
|
502
|
-
const { bodySessionDenial } = await import("./session-access-
|
|
502
|
+
const { bodySessionDenial } = await import("./session-access-5qvfevhk.js");
|
|
503
503
|
const denial = await bodySessionDenial(req, def.session.bodyTaskIds(rawBody));
|
|
504
504
|
if (denial) {
|
|
505
505
|
jsonError(res, denial, 403);
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FX_ROUTE_KEY_VARS,
|
|
3
|
+
requireFxRoute,
|
|
4
|
+
fxSessionExists,
|
|
5
|
+
fxTargetProfile,
|
|
6
|
+
ACPAdapter2
|
|
7
|
+
} from "./cli-pd7vagab.js";
|
|
8
|
+
import {
|
|
9
|
+
getKnownContextWindowSize,
|
|
10
|
+
init_context_window
|
|
11
|
+
} from "./cli-73jzwksr.js";
|
|
12
|
+
import {
|
|
13
|
+
getOpenRouterBaseUrl,
|
|
14
|
+
init_openrouter_base_url
|
|
15
|
+
} from "./cli-dfyv0jdy.js";
|
|
16
|
+
import {
|
|
17
|
+
registerVolatileSecret,
|
|
18
|
+
init_secret_scrubber
|
|
19
|
+
} from "./cli-1b7btd38.js";
|
|
20
|
+
|
|
21
|
+
// src/providers/fx-adapter.ts
|
|
22
|
+
init_context_window();
|
|
23
|
+
import { randomUUID } from "node:crypto";
|
|
24
|
+
import { chmod, mkdir, rename, rm } from "node:fs/promises";
|
|
25
|
+
import { dirname, join } from "node:path";
|
|
26
|
+
init_openrouter_base_url();
|
|
27
|
+
init_secret_scrubber();
|
|
28
|
+
var FX_OPENAI_BASE_URL = "https://api.openai.com/v1";
|
|
29
|
+
function checkFxCredentials2(env) {
|
|
30
|
+
return FX_ROUTE_KEY_VARS.some((name) => env[name]?.trim()) ? { ready: true, missing: [], satisfiedBy: "env" } : {
|
|
31
|
+
ready: false,
|
|
32
|
+
missing: [...FX_ROUTE_KEY_VARS],
|
|
33
|
+
hint: "Set OPENROUTER_API_KEY (openrouter/<vendor>/<id>), OPENAI_API_KEY (bare OpenAI ids) or AI_GATEWAY_API_KEY (vercel/<vendor>/<id>) for fx."
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function isJsonObject(value) {
|
|
37
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
38
|
+
}
|
|
39
|
+
function connection(baseUrl, keyVar) {
|
|
40
|
+
return {
|
|
41
|
+
protocol: "openai-chat-completions",
|
|
42
|
+
base_url: baseUrl,
|
|
43
|
+
auth: { type: "bearer", env: keyVar }
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function mergeFxSettings(current, input) {
|
|
47
|
+
const next = structuredClone(current);
|
|
48
|
+
const providers = isJsonObject(next.providers) ? next.providers : {};
|
|
49
|
+
const owned = {
|
|
50
|
+
openrouter: connection(input.openRouterBaseUrl, "OPENROUTER_API_KEY"),
|
|
51
|
+
openai: connection(FX_OPENAI_BASE_URL, "OPENAI_API_KEY")
|
|
52
|
+
};
|
|
53
|
+
for (const [name, fields] of Object.entries(owned)) {
|
|
54
|
+
const existing = isJsonObject(providers[name]) ? providers[name] : {};
|
|
55
|
+
providers[name] = { ...existing, ...fields };
|
|
56
|
+
}
|
|
57
|
+
const { fxProvider, fxModel } = input.route;
|
|
58
|
+
const target = fxProvider === "gateway" ? undefined : providers[fxProvider];
|
|
59
|
+
if (target && input.contextWindow && input.contextWindow > 0) {
|
|
60
|
+
const metadata = isJsonObject(target.model_metadata) ? target.model_metadata : {};
|
|
61
|
+
if (!isJsonObject(metadata[fxModel])) {
|
|
62
|
+
metadata[fxModel] = { context_window: input.contextWindow };
|
|
63
|
+
}
|
|
64
|
+
target.model_metadata = metadata;
|
|
65
|
+
}
|
|
66
|
+
next.providers = providers;
|
|
67
|
+
next.auto_upgrade = false;
|
|
68
|
+
next.session_titles = false;
|
|
69
|
+
return next;
|
|
70
|
+
}
|
|
71
|
+
async function ensureFxSettings(input) {
|
|
72
|
+
const path = join(input.home, ".fx", "settings.json");
|
|
73
|
+
const file = Bun.file(path);
|
|
74
|
+
let current = {};
|
|
75
|
+
if (await file.exists()) {
|
|
76
|
+
const text = await file.text();
|
|
77
|
+
if (text.trim()) {
|
|
78
|
+
let parsed;
|
|
79
|
+
try {
|
|
80
|
+
parsed = JSON.parse(text);
|
|
81
|
+
} catch {
|
|
82
|
+
throw new Error(`${path} is not valid JSON; fix or remove it before running fx`);
|
|
83
|
+
}
|
|
84
|
+
if (!isJsonObject(parsed)) {
|
|
85
|
+
throw new Error(`${path} is not a JSON object; fix or remove it before running fx`);
|
|
86
|
+
}
|
|
87
|
+
current = parsed;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const next = mergeFxSettings(current, input);
|
|
91
|
+
if (JSON.stringify(next) === JSON.stringify(current))
|
|
92
|
+
return { path, changed: false };
|
|
93
|
+
await mkdir(dirname(path), { recursive: true, mode: 448 });
|
|
94
|
+
const tmp = `${path}.swarm-${process.pid}-${randomUUID()}.tmp`;
|
|
95
|
+
try {
|
|
96
|
+
await Bun.write(tmp, `${JSON.stringify(next, null, 2)}
|
|
97
|
+
`);
|
|
98
|
+
await chmod(tmp, 384);
|
|
99
|
+
await rename(tmp, path);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
await rm(tmp, { force: true });
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
return { path, changed: true };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
class FxAdapter2 {
|
|
108
|
+
options;
|
|
109
|
+
name = "fx";
|
|
110
|
+
traits = {
|
|
111
|
+
hasMcp: true,
|
|
112
|
+
hasToolSearch: false,
|
|
113
|
+
nativeSkillDiscovery: true,
|
|
114
|
+
hasLocalEnvironment: true,
|
|
115
|
+
steerModes: ["steer"]
|
|
116
|
+
};
|
|
117
|
+
acp = new ACPAdapter2({ providerName: "fx", target: fxTargetProfile });
|
|
118
|
+
constructor(options = {}) {
|
|
119
|
+
this.options = options;
|
|
120
|
+
}
|
|
121
|
+
async createSession(sessionConfig) {
|
|
122
|
+
const route = requireFxRoute(sessionConfig.model);
|
|
123
|
+
const env = { ...process.env, ...sessionConfig.env };
|
|
124
|
+
const apiKey = env[route.keyVar]?.trim();
|
|
125
|
+
if (!apiKey)
|
|
126
|
+
throw new Error(`fx requires ${route.keyVar} for ${route.model}`);
|
|
127
|
+
registerVolatileSecret(apiKey, route.keyVar);
|
|
128
|
+
const home = this.options.home ?? env.HOME;
|
|
129
|
+
if (!home)
|
|
130
|
+
throw new Error("fx requires HOME: it keeps its settings and sessions in ~/.fx");
|
|
131
|
+
await ensureFxSettings({
|
|
132
|
+
home,
|
|
133
|
+
route,
|
|
134
|
+
contextWindow: route.fxProvider === "gateway" ? undefined : getKnownContextWindowSize(route.model),
|
|
135
|
+
openRouterBaseUrl: getOpenRouterBaseUrl(env)
|
|
136
|
+
});
|
|
137
|
+
return this.acp.createSession({
|
|
138
|
+
...sessionConfig,
|
|
139
|
+
model: route.model,
|
|
140
|
+
env: { ...sessionConfig.env, [route.keyVar]: apiKey, HOME: home }
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
async canResume(sessionId) {
|
|
144
|
+
return fxSessionExists(sessionId, this.options.home ?? process.env.HOME);
|
|
145
|
+
}
|
|
146
|
+
formatCommand(commandName) {
|
|
147
|
+
return `/${commandName}`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export { checkFxCredentials2, FxAdapter2 };
|