@desplega.ai/agent-swarm 1.158.0 → 1.159.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-xaq4n6pc.js → acp-adapter-qhch0n2v.js} +1 -1
- package/dist/{actions-p9hz5yat.js → actions-dtsh1mfb.js} +33 -29
- package/dist/{anthropic-messages-51pz26qe.js → anthropic-messages-f2h06k64.js} +8 -3
- package/dist/{app-g26wdcz6.js → app-y1b9srva.js} +10 -9
- package/dist/{assistant-wydfqkb3.js → assistant-31hwy5xj.js} +34 -30
- package/dist/{azure-openai-responses-8gksqtmz.js → azure-openai-responses-0k1mfax5.js} +12 -13
- package/dist/{boot-reembed-se8zmdcp.js → boot-reembed-48d2qpkt.js} +11 -11
- package/dist/{boot-reembed-g5ckg9yb.js → boot-reembed-w0bryhkr.js} +12 -12
- package/dist/{boot-scrub-logs-wfxqan61.js → boot-scrub-logs-t65wbrn7.js} +9 -8
- package/dist/{boot-seeds-s3q01xj3.js → boot-seeds-h7c32hvm.js} +12 -11
- package/dist/{claude-adapter-tv2x4f36.js → claude-adapter-1t6611ne.js} +26 -21
- package/dist/{claude-managed-adapter-41b2s7fd.js → claude-managed-adapter-werp659j.js} +4 -2
- package/dist/{claude-managed-setup-60g8aazx.js → claude-managed-setup-y6rdgbc1.js} +11 -2
- package/dist/claude-sdk-session-zhkyk8yw.js +29319 -0
- package/dist/{cli-vj6h9kc2.js → cli-0m7wct0d.js} +59 -1
- package/dist/{cli-wscdvcqz.js → cli-0n2e4x49.js} +1 -1
- package/dist/cli-0xqde53b.js +176 -0
- package/dist/{cli-xberxa1r.js → cli-10ym38qc.js} +2 -2
- package/dist/{cli-5b6b62tz.js → cli-13hw4z91.js} +1 -1
- package/dist/{cli-rqz8qbw7.js → cli-20035trh.js} +50 -18
- package/dist/{cli-k0g1sjzm.js → cli-31nkw3g3.js} +3 -3
- package/dist/cli-3gvrr8vj.js +1422 -0
- package/dist/{cli-c07r9a2m.js → cli-48527fpw.js} +9 -8
- package/dist/{cli-24k806sc.js → cli-4aj25szq.js} +2 -2
- package/dist/{cli-7gtvvpbh.js → cli-4tvgz99m.js} +7 -7
- package/dist/cli-503ya656.js +455 -0
- package/dist/{cli-cw9zck8j.js → cli-5f2hq128.js} +8 -4
- package/dist/{cli-s8eet254.js → cli-68bmme5p.js} +11078 -27833
- package/dist/{cli-ftfvggzx.js → cli-79aq9cgb.js} +794 -563
- package/dist/cli-7cxw8b60.js +14910 -0
- package/dist/cli-7kyk9jr3.js +22 -0
- package/dist/cli-7zttzetj.js +324 -0
- package/dist/{cli-y95wp3tg.js → cli-96qd5psa.js} +1 -1
- package/dist/{cli-g8djp6qe.js → cli-9yg65c1j.js} +22 -0
- package/dist/{cli-3gmcwfyx.js → cli-ardpzhjm.js} +5 -5
- package/dist/{cli-7s3syk22.js → cli-b6thtzac.js} +5 -5
- package/dist/{cli-00w2c66p.js → cli-bgv70kym.js} +13 -2
- package/dist/{cli-j55n64b6.js → cli-bv0a38v9.js} +163 -44
- package/dist/cli-ca2w7zv7.js +115 -0
- package/dist/cli-cpvsaqsw.js +333 -0
- package/dist/cli-cygyqj3b.js +754 -0
- package/dist/{cli-x24pshtq.js → cli-dvjpkkjd.js} +6 -6
- package/dist/{cli-5d10vd2m.js → cli-e0ndxhtk.js} +4 -4
- package/dist/{cli-4198qc9v.js → cli-e4xnc0qp.js} +15 -3
- package/dist/{cli-rjehvrts.js → cli-eg7cdg68.js} +8 -8
- package/dist/cli-ejpygnqz.js +3815 -0
- package/dist/{cli-fgqxwrpv.js → cli-fjtp3463.js} +1631 -127
- package/dist/{cli-zt1227k1.js → cli-fkqhbg8g.js} +5 -3
- package/dist/{cli-47m6dkd3.js → cli-g9df2m37.js} +409 -168
- package/dist/cli-gzyh0j0g.js +8455 -0
- package/dist/cli-hgqfttfc.js +183 -0
- package/dist/cli-hj65wsts.js +17755 -0
- package/dist/cli-j9z8mfx3.js +476 -0
- package/dist/{cli-aehm1rbq.js → cli-kc3dp84d.js} +1135 -61
- package/dist/{cli-h38x0qhg.js → cli-kdnehe0t.js} +4 -3
- package/dist/{cli-20cj37vt.js → cli-m4excttz.js} +136 -2216
- package/dist/{cli-8qmme6vd.js → cli-mg24hkt4.js} +2 -2
- package/dist/{cli-xhaeg2nc.js → cli-mzkqpxee.js} +1 -1
- package/dist/{cli-q67y4wzm.js → cli-phsaj4xq.js} +24 -2
- package/dist/{cli-pw9rj5t9.js → cli-pqetb83f.js} +1 -176
- package/dist/{cli-rj19hc34.js → cli-qjxy52w7.js} +1 -1
- package/dist/{cli-53sz8gkz.js → cli-qv4jv8bx.js} +1 -1
- package/dist/cli-qvnnx4ct.js +1051 -0
- package/dist/cli-rb9m6rpe.js +4980 -0
- package/dist/{cli-tt9k8r35.js → cli-rfezr056.js} +476 -909
- package/dist/{cli-ggm92wcn.js → cli-rgjprct3.js} +1 -0
- package/dist/{cli-9httdpyq.js → cli-rrqmqr1s.js} +1 -1
- package/dist/cli-rykfmgwg.js +102 -0
- package/dist/{cli-eetrvv91.js → cli-t3p77qk1.js} +1 -1
- package/dist/{cli-68w09sjw.js → cli-vn0qv9cj.js} +25 -88
- package/dist/{cli-987hg0aa.js → cli-vwbbaecp.js} +2 -2
- package/dist/cli-wd9hz40d.js +69 -0
- package/dist/{cli-j57qkrpq.js → cli-wgjx0q33.js} +13 -13
- package/dist/cli-xgpf00sk.js +2149 -0
- package/dist/{cli-mcnhgnn1.js → cli-ykk5jaax.js} +184 -26
- package/dist/{cli-aky8tctm.js → cli-z9x0sh1t.js} +3 -3
- package/dist/{cli-1hkrch3k.js → cli-zw65mab6.js} +5 -5
- package/dist/cli.js +38 -29
- package/dist/cloudflare-workers-ai-system-one-1sg586qv.js +46 -0
- package/dist/{codex-adapter-cnm8wk11.js → codex-adapter-jqfqqa21.js} +21 -14
- package/dist/{codex-hook-9hptmdhj.js → codex-hook-5eys3dya.js} +2 -2
- package/dist/{codex-session-runner-gfg547zj.js → codex-session-runner-zd341dsm.js} +21 -14
- package/dist/{commands-e3bn0p75.js → commands-vfsysz4s.js} +9 -8
- package/dist/{db-03v9kzr2.js → db-s3znhvbn.js} +15 -10
- package/dist/{dispatcher-nrmg8yht.js → dispatcher-5xn0c7rf.js} +32 -28
- package/dist/{dsh-adapter-k03nfqa6.js → dsh-adapter-894mgfvs.js} +3 -3
- package/dist/{e2b-93x1k0j5.js → e2b-ez07znam.js} +4 -3
- package/dist/execute-71ysgv35.js +965 -0
- package/dist/{google-generative-ai-bxmv50nc.js → google-generative-ai-1nfcdphp.js} +5 -4
- package/dist/{google-vertex-809af514.js → google-vertex-1tqcd7b1.js} +5 -4
- package/dist/{handlers-aqcedbyb.js → handlers-5w4jwycr.js} +35 -31
- package/dist/{hook-7vkskkre.js → hook-853bxrr6.js} +16 -13
- package/dist/{hook-ybvmrmhq.js → hook-z0hbxj85.js} +16 -13
- package/dist/{http-2eqa8t24.js → http-akc3wy3m.js} +600 -123
- package/dist/{index-f6cryxwe.js → index-4a5njnm1.js} +2 -59
- package/dist/{index-a3vn96n8.js → index-5sz16ksh.js} +187 -47
- package/dist/{index-c6zsv1bd.js → index-bjmjh9h4.js} +11 -11
- package/dist/{index-chgdkq36.js → index-cd151qkq.js} +32 -28
- package/dist/{index-x71bvq0p.js → index-k661dzzr.js} +33 -29
- package/dist/{index-1yks3qcr.js → index-ttpbhnjg.js} +32 -28
- package/dist/{keepalive-vtkf5n99.js → keepalive-8p9rpvz5.js} +11 -10
- package/dist/{lead-h3sp357x.js → lead-jp69z5h3.js} +49 -45
- package/dist/llama-cpp-classify-t2tccams.js +335 -0
- package/dist/{maintenance-jzeqtk3q.js → maintenance-fwx4ev0k.js} +12 -12
- package/dist/{mistral-conversations-zx0kn554.js → mistral-conversations-bhvwqcnk.js} +14 -17
- package/dist/{oauth-refresh-sweep-qp3dzmdp.js → oauth-refresh-sweep-cwcq1ctx.js} +10 -9
- package/dist/{onboard-tmsp0qbz.js → onboard-2b4q0t84.js} +6 -5
- package/dist/{openai-codex-responses-4vjqzvjp.js → openai-codex-responses-nekthgks.js} +21 -8
- package/dist/{openai-completions-9hjrqbw8.js → openai-completions-hxtzwj0s.js} +8 -11
- package/dist/{openai-responses-7b1pn0xt.js → openai-responses-w4r118w7.js} +22 -17
- package/dist/{opencode-adapter-x6x2da1z.js → opencode-adapter-zz7xvjj6.js} +6 -4
- package/dist/{openrouter-images-9f9ek4rw.js → openrouter-images-b6sqqjgn.js} +4 -6
- package/dist/{otel-impl-9mz73q65.js → otel-impl-g8rs4vwr.js} +1 -1
- package/dist/{pi-messages-txpjj39q.js → pi-messages-vxdt8v7j.js} +2 -1
- package/dist/{pi-mono-adapter-m6dvv0dz.js → pi-mono-adapter-n0me28wt.js} +29 -17
- package/dist/pricing-refresh-0v77385v.js +39 -0
- package/dist/{rbac-roles-c9wqz83x.js → rbac-roles-krjyazbj.js} +10 -9
- package/dist/{render-v2-gryrh9h8.js → render-v2-3wjsp9aw.js} +10 -9
- package/dist/runtime-ktjysacx.js +24 -0
- package/dist/{setup-q9720bt6.js → setup-yeqryke6.js} +6 -5
- package/dist/typesafe-system-one-96960jxp.js +27 -0
- package/dist/{virtual-modules-3htpgn8x.js → virtual-modules-dzdeq1sf.js} +21 -13
- package/dist/{work-objects-b76x7deb.js → work-objects-3pakpkw0.js} +35 -31
- package/dist/{worker-6vrxbv41.js → worker-85testgj.js} +49 -45
- package/openapi.json +863 -14
- package/package.json +9 -8
- package/src/be/db/agents.ts +20 -0
- package/src/be/db/tasks/human-free.ts +442 -0
- package/src/be/db/tasks/read.ts +56 -1
- package/src/be/db/tasks/write.ts +107 -11
- package/src/be/db.ts +89 -165
- package/src/be/harness-model-support.ts +182 -0
- package/src/be/human-free-drain.ts +67 -0
- package/src/be/migrations/182_task_human_free_flag.sql +63 -0
- package/src/be/migrations/183_human_free_reclassify_queue.sql +25 -0
- package/src/be/migrations/184_model_catalog.sql +120 -0
- package/src/be/model-catalog-store.ts +644 -0
- package/src/be/model-tier-keys.ts +31 -0
- package/src/be/model-tier-resolution.ts +489 -0
- package/src/be/model-validation.ts +112 -0
- package/src/be/models-catalog.ts +61 -7
- package/src/be/modelsdev-cache.json +82 -0
- package/src/be/modelsdev-cache.ts +2 -0
- package/src/be/pricing-refresh.ts +154 -12
- package/src/be/scripts/typecheck.ts +15 -0
- package/src/be/seed-scripts/catalog/task-failure-audit.ts +61 -9
- package/src/be/swarm-config-guard.ts +6 -0
- package/src/cli.tsx +10 -0
- package/src/commands/claude-managed-setup.ts +3 -1
- package/src/commands/runner.ts +76 -2
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/heartbeat/heartbeat.ts +64 -15
- package/src/heartbeat/templates.ts +2 -2
- package/src/http/agents.ts +49 -1
- package/src/http/index.ts +8 -0
- package/src/http/models-catalog.ts +357 -8
- package/src/http/poll.ts +45 -2
- package/src/http/schedules.ts +36 -6
- package/src/http/session-data.ts +2 -5
- package/src/http/stats.ts +6 -8
- package/src/http/tasks.ts +26 -1
- package/src/http/usage-cache.ts +56 -15
- package/src/http/workflows.ts +35 -8
- package/src/prompts/session-templates.ts +1 -0
- package/src/providers/claude-managed-models.ts +47 -161
- package/src/providers/codex-adapter.ts +4 -4
- package/src/providers/codex-models.ts +65 -198
- package/src/providers/reasoning-effort.ts +44 -140
- package/src/rbac/legacy-policy.ts +25 -0
- package/src/rbac/permissions.ts +10 -0
- package/src/scripts-runtime/sdk-allowlist.ts +4 -0
- package/src/scripts-runtime/types/stdlib.d.ts +15 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +3 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +15 -0
- package/src/server.ts +6 -0
- package/src/slack/message-text.ts +56 -2
- package/src/slack/thread-buffer.ts +10 -2
- package/src/tests/agents-list-model-display.test.ts +4 -6
- package/src/tests/base-prompt.test.ts +3 -0
- package/src/tests/claude-adapter.test.ts +10 -0
- package/src/tests/claude-managed-adapter.test.ts +12 -18
- package/src/tests/codex-adapter.test.ts +2 -1
- package/src/tests/codex-gpt6-release.test.ts +66 -5
- package/src/tests/context-window.test.ts +7 -5
- package/src/tests/db-extraction-contract.test.ts +1 -0
- package/src/tests/db-task-read-contract.test.ts +5 -1
- package/src/tests/db-task-write-contract.test.ts +4 -1
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/explicit-model-validation.test.ts +332 -0
- package/src/tests/harness-model-support.test.ts +374 -0
- package/src/tests/heartbeat-checklist-config.test.ts +71 -0
- package/src/tests/heartbeat-checklist.test.ts +4 -2
- package/src/tests/heartbeat-orphan-resume.test.ts +48 -0
- package/src/tests/human-free-flag.test.ts +279 -0
- package/src/tests/human-free-oracle.ts +57 -0
- package/src/tests/human-free-reclassify.test.ts +669 -0
- package/src/tests/migration-046-budgets.test.ts +3 -3
- package/src/tests/model-catalog-migration.test.ts +134 -0
- package/src/tests/model-catalog-table.test.ts +249 -0
- package/src/tests/model-catalog-write-access.test.ts +387 -0
- package/src/tests/model-tier-resolution.test.ts +519 -0
- package/src/tests/models-catalog.test.ts +1 -1
- package/src/tests/multi-runtime-enabled-stats.test.ts +65 -1
- package/src/tests/package-publish.test.ts +137 -36
- package/src/tests/pricing-routes.test.ts +2 -2
- package/src/tests/rbac-engine.test.ts +42 -2
- package/src/tests/reasoning-effort.test.ts +109 -0
- package/src/tests/refresh-modelsdev-carryforward.test.ts +5 -5
- package/src/tests/runtime-model-catalog.test.ts +86 -0
- package/src/tests/script-connections.test.ts +5 -0
- package/src/tests/seed-scripts.test.ts +89 -0
- package/src/tests/session-costs.test.ts +14 -11
- package/src/tests/slack-message-text.test.ts +101 -0
- package/src/tests/slack-thread-buffer-context.test.ts +93 -0
- package/src/tests/task-cascade-fail.test.ts +148 -2
- package/src/tests/tool-annotations.test.ts +1 -1
- package/src/tests/usage-cache.test.ts +166 -0
- package/src/tests/workflow-executors.test.ts +5 -2
- package/src/tests/workflow-system-one-decision-review.test.ts +1021 -0
- package/src/tests/workflow-system-one-decision-save-warnings.test.ts +365 -0
- package/src/tests/workflow-system-one-decision.test.ts +2063 -0
- package/src/tools/model-catalog/index.ts +137 -0
- package/src/tools/schedules/create-schedule.ts +16 -1
- package/src/tools/schedules/patch-schedule.ts +17 -0
- package/src/tools/schedules/update-schedule.ts +17 -0
- package/src/tools/send-task.ts +14 -0
- package/src/tools/task-action.ts +12 -0
- package/src/tools/tool-config.ts +3 -1
- package/src/tools/workflows/create-workflow.ts +9 -2
- package/src/tools/workflows/patch-workflow-node.ts +17 -7
- package/src/tools/workflows/patch-workflow.ts +9 -2
- package/src/tools/workflows/update-workflow.ts +9 -2
- package/src/types.ts +30 -1
- package/src/utils/context-window.ts +47 -53
- package/src/utils/harness-cli-version.ts +115 -0
- package/src/utils/harness-model-error.ts +33 -0
- package/src/utils/runtime-model-catalog.ts +137 -0
- package/src/workflows/approval-resolution.ts +39 -0
- package/src/workflows/definition.ts +7 -0
- package/src/workflows/engine.ts +69 -1
- package/src/workflows/executors/agent-task.ts +9 -0
- package/src/workflows/executors/base.ts +53 -0
- package/src/workflows/executors/human-in-the-loop.ts +8 -8
- package/src/workflows/executors/index.ts +1 -0
- package/src/workflows/executors/registry.ts +2 -0
- package/src/workflows/executors/system-one-decision.ts +1232 -0
- package/src/workflows/executors/system-one-providers.ts +301 -0
- package/src/workflows/executors/workflow-llm.ts +13 -1
- package/src/workflows/readiness.ts +86 -0
- package/src/workflows/recovery.ts +12 -12
- package/src/workflows/resume.ts +23 -9
- package/templates/schedules/daily-blocker-digest/content.md +4 -5
- package/templates/skills/agent-browser/SKILL.md +6 -5
- package/templates/skills/agent-browser/content.md +6 -5
- package/templates/skills/heartbeat-runbook/config.json +1 -1
- package/templates/skills/heartbeat-runbook/content.md +2 -2
- package/templates/skills/swarm-scripts/SKILL.md +1 -1
- package/templates/skills/swarm-scripts/content.md +1 -1
- package/templates/skills/workflow-iterate/content.md +81 -1
- package/templates/workflows/claude-code-changelog-watch/content.md +2 -0
- package/templates/workflows/pr-review-status-sweep/content.md +2 -0
- package/dist/claude-sdk-session-t442qz6f.js +0 -39108
- package/dist/cli-0xjkj1j7.js +0 -61
- package/dist/cli-65hjmev5.js +0 -1141
- package/dist/cli-aw1jwp1r.js +0 -14075
- package/dist/cli-h967nb6r.js +0 -6603
- package/dist/cli-vapyk8sw.js +0 -20
- package/dist/cli-ws6rqycm.js +0 -247
- package/dist/pricing-refresh-v1cbr9te.js +0 -27
- package/src/providers/modelsdev-reasoning.json +0 -6453
- package/dist/{codex-login-x3jk4etn.js → codex-login-he9vrn90.js} +3 -3
- package/dist/{index-f24115ge.js → index-2wsdsnmm.js} +3 -3
|
@@ -7,7 +7,7 @@ var package_default;
|
|
|
7
7
|
var init_package = __esm(() => {
|
|
8
8
|
package_default = {
|
|
9
9
|
name: "@desplega.ai/agent-swarm",
|
|
10
|
-
version: "1.
|
|
10
|
+
version: "1.159.0",
|
|
11
11
|
description: "agent-swarm.dev — an open-source operating system for AI work: a lead agent breaks goals into tasks, routes them to specialized workers such as Claude Code or Codex, runs each worker in an isolated container, and preserves shared memory, tools, schedules, and review gates so delegated work compounds across sessions.",
|
|
12
12
|
keywords: [
|
|
13
13
|
"agent-swarm.dev",
|
|
@@ -176,8 +176,9 @@ var init_package = __esm(() => {
|
|
|
176
176
|
devDependencies: {
|
|
177
177
|
"@biomejs/biome": "^2.3.10",
|
|
178
178
|
"@desplega.ai/slack-mock": "^0.4.0",
|
|
179
|
+
"@desplega/model-catalog": "workspace:*",
|
|
179
180
|
"@faker-js/faker": "^10.4.0",
|
|
180
|
-
"@opencode-ai/plugin": "1.
|
|
181
|
+
"@opencode-ai/plugin": "1.18.33",
|
|
181
182
|
"@types/bun": "latest",
|
|
182
183
|
"dependency-cruiser": "^18.0.0",
|
|
183
184
|
konsistent: "1.0.0-beta.1",
|
|
@@ -194,20 +195,20 @@ var init_package = __esm(() => {
|
|
|
194
195
|
dependencies: {
|
|
195
196
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
196
197
|
"@ai-sdk/openai": "^3.0.41",
|
|
197
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
198
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.285",
|
|
198
199
|
"@anthropic-ai/sdk": "^0.93.0",
|
|
199
200
|
"@asteasolutions/zod-to-openapi": "^8.0.0",
|
|
200
201
|
"@aws-sdk/client-bedrock": "3.1048.0",
|
|
201
202
|
"@desplega.ai/business-use": "^0.4.2",
|
|
202
203
|
"@desplega.ai/localtunnel": "^2.2.0",
|
|
203
|
-
"@earendil-works/pi-agent-core": "^0.
|
|
204
|
-
"@earendil-works/pi-ai": "^0.
|
|
205
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
204
|
+
"@earendil-works/pi-agent-core": "^0.99.1",
|
|
205
|
+
"@earendil-works/pi-ai": "^0.99.1",
|
|
206
|
+
"@earendil-works/pi-coding-agent": "^0.99.1",
|
|
206
207
|
"@inkjs/ui": "^2.0.0",
|
|
207
208
|
"@linear/sdk": "^77.0.0",
|
|
208
209
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
209
|
-
"@openai/codex": "0.
|
|
210
|
-
"@opencode-ai/sdk": "^1.18.
|
|
210
|
+
"@openai/codex": "0.159.1",
|
|
211
|
+
"@opencode-ai/sdk": "^1.18.33",
|
|
211
212
|
"@openfort/openfort-node": "^0.9.1",
|
|
212
213
|
"@opentelemetry/api": "^1.9.1",
|
|
213
214
|
"@opentelemetry/api-logs": "^0.218.0",
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getJsonSchemaToolParameters,
|
|
11
11
|
resolveJsonSchemaStrictSampling,
|
|
12
12
|
transformMessages
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-31nkw3g3.js";
|
|
14
14
|
import {
|
|
15
15
|
sanitizeSurrogates
|
|
16
16
|
} from "./cli-y2apkfe2.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
clampThinkingLevel,
|
|
19
19
|
collapseSystemMessages,
|
|
20
20
|
withoutInitialSystemMessage
|
|
21
|
-
} from "./cli-
|
|
21
|
+
} from "./cli-ykk5jaax.js";
|
|
22
22
|
import {
|
|
23
23
|
import_websocket
|
|
24
24
|
} from "./cli-76yrvwsa.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runStopHookSessionSummarySubprocess
|
|
3
|
-
} from "./cli-
|
|
4
|
-
import {
|
|
5
|
-
fetchInstalledMcpServers
|
|
6
|
-
} from "./cli-tng3131n.js";
|
|
3
|
+
} from "./cli-b6thtzac.js";
|
|
7
4
|
import {
|
|
8
5
|
buildOtelTraceparentEnv,
|
|
9
6
|
isHarnessOtelEnabled
|
|
10
7
|
} from "./cli-q2j38vre.js";
|
|
8
|
+
import {
|
|
9
|
+
fetchInstalledMcpServers
|
|
10
|
+
} from "./cli-tng3131n.js";
|
|
11
11
|
import {
|
|
12
12
|
CTX_MODE_NUDGE_EVERY
|
|
13
13
|
} from "./cli-zm7njwzd.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
clampContextPercent,
|
|
17
17
|
computeContextUsedUnified,
|
|
18
18
|
getContextWindowSize
|
|
19
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-wd9hz40d.js";
|
|
20
20
|
import {
|
|
21
21
|
isClaudeBridgeEffective,
|
|
22
22
|
resolveClaudeTransport
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "./cli-npssxgaz.js";
|
|
29
29
|
import {
|
|
30
30
|
applyReasoningEffort
|
|
31
|
-
} from "./cli-
|
|
31
|
+
} from "./cli-ca2w7zv7.js";
|
|
32
32
|
import {
|
|
33
33
|
swarmRuntimeInstanceId
|
|
34
34
|
} from "./cli-re8z5p8p.js";
|
|
@@ -822,7 +822,7 @@ class ClaudeAdapter {
|
|
|
822
822
|
if (transport === "sdk" && isClaudeBridgeEffective(sourceEnv)) {
|
|
823
823
|
throw new Error("CLAUDE_TRANSPORT=sdk cannot run with an effective Claude Bridge configuration. Select CLI transport or disable the bridge.");
|
|
824
824
|
}
|
|
825
|
-
const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-
|
|
825
|
+
const claudeSdk = transport === "sdk" ? await import("./claude-sdk-session-zhkyk8yw.js") : undefined;
|
|
826
826
|
claudeSdk?.validateClaudeSdkAdditionalArgs([
|
|
827
827
|
...claudeBinaryArgv.slice(1),
|
|
828
828
|
...config.additionalArgs ?? []
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_proper_lockfile
|
|
3
|
+
} from "./cli-ejpygnqz.js";
|
|
4
|
+
import {
|
|
5
|
+
CONFIG_DIR_NAME,
|
|
6
|
+
canonicalizePath,
|
|
7
|
+
resolvePath,
|
|
8
|
+
stripBom
|
|
9
|
+
} from "./cli-hj65wsts.js";
|
|
10
|
+
import {
|
|
11
|
+
__toESM
|
|
12
|
+
} from "./cli-bc05qbss.js";
|
|
13
|
+
|
|
14
|
+
// node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.js
|
|
15
|
+
var MCP_EXPOSURES = [
|
|
16
|
+
"codemode",
|
|
17
|
+
"codemode-deferred",
|
|
18
|
+
"deferred",
|
|
19
|
+
"direct",
|
|
20
|
+
"hidden"
|
|
21
|
+
];
|
|
22
|
+
var LOOPBACK_HOSTS = ["localhost", "127.0.0.1", "[::1]"];
|
|
23
|
+
function isLoopbackRedirectUri(value) {
|
|
24
|
+
if (!URL.canParse(value))
|
|
25
|
+
return false;
|
|
26
|
+
const url = new URL(value);
|
|
27
|
+
return url.protocol === "http:" && LOOPBACK_HOSTS.includes(url.hostname) && url.search === "" && url.hash === "";
|
|
28
|
+
}
|
|
29
|
+
var SERVER_NAME = /^[A-Za-z0-9_-]+$/;
|
|
30
|
+
function isRecord(value) {
|
|
31
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32
|
+
}
|
|
33
|
+
function isStringRecord(value) {
|
|
34
|
+
return isRecord(value) && Object.values(value).every((entry) => typeof entry === "string");
|
|
35
|
+
}
|
|
36
|
+
function validateOAuth(value) {
|
|
37
|
+
if (value === undefined)
|
|
38
|
+
return;
|
|
39
|
+
if (!isRecord(value))
|
|
40
|
+
return "oauth must be an object";
|
|
41
|
+
if (value.clientId !== undefined && typeof value.clientId !== "string")
|
|
42
|
+
return "oauth.clientId must be a string";
|
|
43
|
+
if (value.clientSecret !== undefined && typeof value.clientSecret !== "string") {
|
|
44
|
+
return "oauth.clientSecret must be a string";
|
|
45
|
+
}
|
|
46
|
+
const port = value.callbackPort;
|
|
47
|
+
if (port !== undefined && (typeof port !== "number" || !Number.isInteger(port) || port < 1 || port > 65535)) {
|
|
48
|
+
return "oauth.callbackPort must be a port number";
|
|
49
|
+
}
|
|
50
|
+
if (value.callbackUrl !== undefined) {
|
|
51
|
+
if (typeof value.callbackUrl !== "string" || !isLoopbackRedirectUri(value.callbackUrl)) {
|
|
52
|
+
return "oauth.callbackUrl must be an http URI on localhost, 127.0.0.1, or [::1] without query or fragment";
|
|
53
|
+
}
|
|
54
|
+
const urlPort = new URL(value.callbackUrl).port;
|
|
55
|
+
if (urlPort && port !== undefined && Number(urlPort) !== port) {
|
|
56
|
+
return "oauth.callbackUrl and oauth.callbackPort name different ports";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (value.scope !== undefined && typeof value.scope !== "string")
|
|
60
|
+
return "oauth.scope must be a string";
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
function isExposure(value) {
|
|
64
|
+
return typeof value === "string" && MCP_EXPOSURES.includes(value);
|
|
65
|
+
}
|
|
66
|
+
function toolPatternRegExp(pattern) {
|
|
67
|
+
const source = pattern.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join(".*");
|
|
68
|
+
return new RegExp(`^${source}$`);
|
|
69
|
+
}
|
|
70
|
+
function getMcpToolExposure(config, toolName) {
|
|
71
|
+
const overrides = config.toolExposure ?? {};
|
|
72
|
+
const exact = overrides[toolName];
|
|
73
|
+
if (exact !== undefined)
|
|
74
|
+
return exact;
|
|
75
|
+
for (const [pattern, exposure] of Object.entries(overrides)) {
|
|
76
|
+
if (pattern.includes("*") && toolPatternRegExp(pattern).test(toolName))
|
|
77
|
+
return exposure;
|
|
78
|
+
}
|
|
79
|
+
return config.exposure ?? "codemode";
|
|
80
|
+
}
|
|
81
|
+
function validateMcpServerConfig(name, value) {
|
|
82
|
+
if (!SERVER_NAME.test(name))
|
|
83
|
+
return `invalid server name "${name}" (use letters, digits, "_" and "-")`;
|
|
84
|
+
if (!isRecord(value))
|
|
85
|
+
return `server "${name}" must be an object`;
|
|
86
|
+
const { type, exposure, enabled, timeout, toolExposure } = value;
|
|
87
|
+
const exposures = MCP_EXPOSURES.map((value2) => `"${value2}"`).join(", ");
|
|
88
|
+
if (exposure !== undefined && !isExposure(exposure)) {
|
|
89
|
+
return `server "${name}": exposure must be one of ${exposures}`;
|
|
90
|
+
}
|
|
91
|
+
if (toolExposure !== undefined) {
|
|
92
|
+
if (!isRecord(toolExposure))
|
|
93
|
+
return `server "${name}": toolExposure must map tool names to exposures`;
|
|
94
|
+
for (const [tool, value2] of Object.entries(toolExposure)) {
|
|
95
|
+
if (!isExposure(value2))
|
|
96
|
+
return `server "${name}": toolExposure "${tool}" must be one of ${exposures}`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (enabled !== undefined && typeof enabled !== "boolean")
|
|
100
|
+
return `server "${name}": enabled must be a boolean`;
|
|
101
|
+
if (timeout !== undefined && (typeof timeout !== "number" || !(timeout > 0))) {
|
|
102
|
+
return `server "${name}": timeout must be a positive number of seconds`;
|
|
103
|
+
}
|
|
104
|
+
if (type === "sse")
|
|
105
|
+
return `server "${name}": legacy SSE transport is not supported; use the streamable HTTP URL`;
|
|
106
|
+
if (typeof value.url === "string" && (type === undefined || type === "http" || type === "streamable-http")) {
|
|
107
|
+
if (!URL.canParse(value.url) || !/^https?:$/.test(new URL(value.url).protocol)) {
|
|
108
|
+
return `server "${name}": url must be an http or https URL`;
|
|
109
|
+
}
|
|
110
|
+
if (value.headers !== undefined && !isStringRecord(value.headers)) {
|
|
111
|
+
return `server "${name}": headers must map names to strings`;
|
|
112
|
+
}
|
|
113
|
+
const oauthError = validateOAuth(value.oauth);
|
|
114
|
+
if (oauthError)
|
|
115
|
+
return `server "${name}": ${oauthError}`;
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
if (typeof value.command === "string" && (type === undefined || type === "stdio")) {
|
|
119
|
+
if (value.args !== undefined && !(Array.isArray(value.args) && value.args.every((arg) => typeof arg === "string"))) {
|
|
120
|
+
return `server "${name}": args must be an array of strings`;
|
|
121
|
+
}
|
|
122
|
+
if (value.env !== undefined && !isStringRecord(value.env))
|
|
123
|
+
return `server "${name}": env must map names to strings`;
|
|
124
|
+
if (value.cwd !== undefined && typeof value.cwd !== "string")
|
|
125
|
+
return `server "${name}": cwd must be a string`;
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
128
|
+
return `server "${name}" needs either "command" (stdio) or "url" (streamable HTTP)`;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
class McpServerRegistry {
|
|
132
|
+
servers = new Map;
|
|
133
|
+
changeListener;
|
|
134
|
+
register(server) {
|
|
135
|
+
this.servers.set(server.name, server);
|
|
136
|
+
this.changeListener?.();
|
|
137
|
+
}
|
|
138
|
+
unregister(name, extensionPath) {
|
|
139
|
+
if (this.servers.get(name)?.extensionPath !== extensionPath)
|
|
140
|
+
return;
|
|
141
|
+
this.servers.delete(name);
|
|
142
|
+
this.changeListener?.();
|
|
143
|
+
}
|
|
144
|
+
get(name) {
|
|
145
|
+
return this.servers.get(name);
|
|
146
|
+
}
|
|
147
|
+
list() {
|
|
148
|
+
return [...this.servers.values()].map((server) => ({ ...server, config: structuredClone(server.config) }));
|
|
149
|
+
}
|
|
150
|
+
setChangeListener(listener) {
|
|
151
|
+
this.changeListener = listener;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// node_modules/@earendil-works/pi-coding-agent/dist/core/trust-manager.js
|
|
156
|
+
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
157
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
158
|
+
import { homedir } from "node:os";
|
|
159
|
+
import { dirname, join } from "node:path";
|
|
160
|
+
var TRUST_REQUIRING_PROJECT_CONFIG_RESOURCES = [
|
|
161
|
+
"settings.json",
|
|
162
|
+
"mcp.json",
|
|
163
|
+
"extensions",
|
|
164
|
+
"skills",
|
|
165
|
+
"prompts",
|
|
166
|
+
"themes",
|
|
167
|
+
"SYSTEM.md",
|
|
168
|
+
"APPEND_SYSTEM.md"
|
|
169
|
+
];
|
|
170
|
+
function normalizeCwd(cwd) {
|
|
171
|
+
return canonicalizePath(resolvePath(cwd));
|
|
172
|
+
}
|
|
173
|
+
function findNearestTrustEntry(data, cwd) {
|
|
174
|
+
let currentDir = normalizeCwd(cwd);
|
|
175
|
+
while (true) {
|
|
176
|
+
const value = data[currentDir];
|
|
177
|
+
if (value === true || value === false) {
|
|
178
|
+
return { path: currentDir, decision: value };
|
|
179
|
+
}
|
|
180
|
+
const parentDir = dirname(currentDir);
|
|
181
|
+
if (parentDir === currentDir) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
currentDir = parentDir;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function getProjectTrustParentPath(cwd) {
|
|
188
|
+
const trustPath = normalizeCwd(cwd);
|
|
189
|
+
const parentDir = dirname(trustPath);
|
|
190
|
+
return parentDir === trustPath ? undefined : parentDir;
|
|
191
|
+
}
|
|
192
|
+
function getProjectTrustOptions(cwd, options) {
|
|
193
|
+
const trustPath = normalizeCwd(cwd);
|
|
194
|
+
const trustOptions = [
|
|
195
|
+
{ label: "Trust", trusted: true, updates: [{ path: trustPath, decision: true }], savedPath: trustPath }
|
|
196
|
+
];
|
|
197
|
+
const parentPath = getProjectTrustParentPath(cwd);
|
|
198
|
+
if (parentPath !== undefined) {
|
|
199
|
+
trustOptions.push({
|
|
200
|
+
label: `Trust parent folder (${parentPath})`,
|
|
201
|
+
trusted: true,
|
|
202
|
+
updates: [
|
|
203
|
+
{ path: parentPath, decision: true },
|
|
204
|
+
{ path: trustPath, decision: null }
|
|
205
|
+
],
|
|
206
|
+
savedPath: parentPath
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
if (options?.includeSessionOnly) {
|
|
210
|
+
trustOptions.push({ label: "Trust (this session only)", trusted: true, updates: [] });
|
|
211
|
+
}
|
|
212
|
+
trustOptions.push({
|
|
213
|
+
label: "Do not trust",
|
|
214
|
+
trusted: false,
|
|
215
|
+
updates: [{ path: trustPath, decision: false }],
|
|
216
|
+
savedPath: trustPath
|
|
217
|
+
});
|
|
218
|
+
if (options?.includeSessionOnly) {
|
|
219
|
+
trustOptions.push({ label: "Do not trust (this session only)", trusted: false, updates: [] });
|
|
220
|
+
}
|
|
221
|
+
return trustOptions;
|
|
222
|
+
}
|
|
223
|
+
function readTrustFile(path) {
|
|
224
|
+
if (!existsSync(path)) {
|
|
225
|
+
return {};
|
|
226
|
+
}
|
|
227
|
+
let parsed;
|
|
228
|
+
try {
|
|
229
|
+
parsed = JSON.parse(stripBom(readFileSync(path, "utf-8")));
|
|
230
|
+
} catch (error) {
|
|
231
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
232
|
+
throw new Error(`Failed to read trust store ${path}: ${message}`);
|
|
233
|
+
}
|
|
234
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
235
|
+
throw new Error(`Invalid trust store ${path}: expected an object`);
|
|
236
|
+
}
|
|
237
|
+
const data = {};
|
|
238
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
239
|
+
if (value !== true && value !== false && value !== null) {
|
|
240
|
+
throw new Error(`Invalid trust store ${path}: value for ${JSON.stringify(key)} must be true, false, or null`);
|
|
241
|
+
}
|
|
242
|
+
data[key] = value;
|
|
243
|
+
}
|
|
244
|
+
return data;
|
|
245
|
+
}
|
|
246
|
+
function writeTrustFile(path, data) {
|
|
247
|
+
const sorted = {};
|
|
248
|
+
for (const key of Object.keys(data).sort()) {
|
|
249
|
+
const value = data[key];
|
|
250
|
+
if (value === true || value === false || value === null) {
|
|
251
|
+
sorted[key] = value;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
255
|
+
writeFileSync(path, `${JSON.stringify(sorted, null, 2)}
|
|
256
|
+
`, "utf-8");
|
|
257
|
+
}
|
|
258
|
+
function acquireTrustLockSync(path) {
|
|
259
|
+
const trustDir = dirname(path);
|
|
260
|
+
mkdirSync(trustDir, { recursive: true });
|
|
261
|
+
const maxAttempts = 10;
|
|
262
|
+
const delayMs = 20;
|
|
263
|
+
let lastError;
|
|
264
|
+
for (let attempt = 1;attempt <= maxAttempts; attempt++) {
|
|
265
|
+
try {
|
|
266
|
+
return import_proper_lockfile.default.lockSync(trustDir, { realpath: false, lockfilePath: `${path}.lock` });
|
|
267
|
+
} catch (error) {
|
|
268
|
+
const code = typeof error === "object" && error !== null && "code" in error ? String(error.code) : undefined;
|
|
269
|
+
if (code !== "ELOCKED" || attempt === maxAttempts) {
|
|
270
|
+
throw error;
|
|
271
|
+
}
|
|
272
|
+
lastError = error;
|
|
273
|
+
const start = Date.now();
|
|
274
|
+
while (Date.now() - start < delayMs) {}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (lastError instanceof Error) {
|
|
278
|
+
throw lastError;
|
|
279
|
+
}
|
|
280
|
+
throw new Error("Failed to acquire trust store lock");
|
|
281
|
+
}
|
|
282
|
+
function withTrustFileLock(path, fn) {
|
|
283
|
+
const release = acquireTrustLockSync(path);
|
|
284
|
+
try {
|
|
285
|
+
return fn();
|
|
286
|
+
} finally {
|
|
287
|
+
release();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function hasTrustRequiringProjectResources(cwd) {
|
|
291
|
+
const homeDir = canonicalizePath(resolvePath(process.env.HOME || homedir()));
|
|
292
|
+
const userAgentsSkillsDir = join(homeDir, ".agents", "skills");
|
|
293
|
+
let currentDir = canonicalizePath(resolvePath(cwd));
|
|
294
|
+
const configDir = join(currentDir, CONFIG_DIR_NAME);
|
|
295
|
+
if (TRUST_REQUIRING_PROJECT_CONFIG_RESOURCES.some((entry) => existsSync(join(configDir, entry)))) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
while (true) {
|
|
299
|
+
const agentsSkillsDir = join(currentDir, ".agents", "skills");
|
|
300
|
+
if (agentsSkillsDir !== userAgentsSkillsDir && existsSync(agentsSkillsDir)) {
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
const parentDir = dirname(currentDir);
|
|
304
|
+
if (parentDir === currentDir) {
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
currentDir = parentDir;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
class ProjectTrustStore {
|
|
312
|
+
trustPath;
|
|
313
|
+
constructor(agentDir) {
|
|
314
|
+
this.trustPath = join(resolvePath(agentDir), "trust.json");
|
|
315
|
+
}
|
|
316
|
+
get(cwd) {
|
|
317
|
+
return this.getEntry(cwd)?.decision ?? null;
|
|
318
|
+
}
|
|
319
|
+
getEntry(cwd) {
|
|
320
|
+
return withTrustFileLock(this.trustPath, () => {
|
|
321
|
+
const data = readTrustFile(this.trustPath);
|
|
322
|
+
return findNearestTrustEntry(data, cwd);
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
set(cwd, decision) {
|
|
326
|
+
this.setMany([{ path: cwd, decision }]);
|
|
327
|
+
}
|
|
328
|
+
setMany(decisions) {
|
|
329
|
+
withTrustFileLock(this.trustPath, () => {
|
|
330
|
+
const data = readTrustFile(this.trustPath);
|
|
331
|
+
for (const { path, decision } of decisions) {
|
|
332
|
+
const key = normalizeCwd(path);
|
|
333
|
+
if (decision === null) {
|
|
334
|
+
delete data[key];
|
|
335
|
+
} else {
|
|
336
|
+
data[key] = decision;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
writeTrustFile(this.trustPath, data);
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// node_modules/@earendil-works/pi-coding-agent/dist/utils/open-browser.js
|
|
345
|
+
import { spawn } from "node:child_process";
|
|
346
|
+
function openBrowser(target) {
|
|
347
|
+
const [cmd, args] = process.platform === "darwin" ? ["open", [target]] : process.platform === "win32" ? ["rundll32", ["url.dll,FileProtocolHandler", target]] : ["xdg-open", [target]];
|
|
348
|
+
spawn(cmd, args, { stdio: "ignore", detached: true }).on("error", () => {}).unref();
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/config.js
|
|
352
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
353
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
354
|
+
function isRecord2(value) {
|
|
355
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
356
|
+
}
|
|
357
|
+
function readConfigFile(path, scope, state) {
|
|
358
|
+
const { servers, errors } = state;
|
|
359
|
+
if (!existsSync2(path))
|
|
360
|
+
return;
|
|
361
|
+
let parsed;
|
|
362
|
+
try {
|
|
363
|
+
parsed = JSON.parse(readFileSync2(path, "utf8"));
|
|
364
|
+
} catch (error) {
|
|
365
|
+
errors.push(`${path}: ${error instanceof Error ? error.message : String(error)}`);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (!isRecord2(parsed) || parsed.mcpServers !== undefined && !isRecord2(parsed.mcpServers)) {
|
|
369
|
+
errors.push(`${path}: expected an object with an "mcpServers" object`);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (typeof parsed.autoEnableCodemode === "boolean")
|
|
373
|
+
state.autoEnableCodemode = parsed.autoEnableCodemode;
|
|
374
|
+
else if (parsed.autoEnableCodemode !== undefined)
|
|
375
|
+
errors.push(`${path}: autoEnableCodemode must be a boolean`);
|
|
376
|
+
for (const [name, value] of Object.entries(parsed.mcpServers ?? {})) {
|
|
377
|
+
const config = validateMcpServerConfig(name, value);
|
|
378
|
+
if (typeof config === "string") {
|
|
379
|
+
errors.push(`${path}: ${config}`);
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
servers.set(name, { name, config, source: path, scope });
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function loadMcpConfig(options) {
|
|
386
|
+
const state = { servers: new Map, errors: [] };
|
|
387
|
+
readConfigFile(join2(options.agentDir, "mcp.json"), "global", state);
|
|
388
|
+
if (options.projectTrusted)
|
|
389
|
+
readConfigFile(join2(options.cwd, CONFIG_DIR_NAME, "mcp.json"), "project", state);
|
|
390
|
+
return {
|
|
391
|
+
servers: [...state.servers.values()],
|
|
392
|
+
...state.autoEnableCodemode === undefined ? {} : { autoEnableCodemode: state.autoEnableCodemode },
|
|
393
|
+
errors: state.errors
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
function updateMcpServerConfig(path, name, patch) {
|
|
397
|
+
editMcpServers(path, (servers) => {
|
|
398
|
+
const server = servers?.[name];
|
|
399
|
+
if (!isRecord2(server))
|
|
400
|
+
throw new Error(`${path} does not define MCP server "${name}"`);
|
|
401
|
+
if (patch.enabled !== undefined) {
|
|
402
|
+
if (patch.enabled)
|
|
403
|
+
delete server.enabled;
|
|
404
|
+
else
|
|
405
|
+
server.enabled = false;
|
|
406
|
+
}
|
|
407
|
+
if (patch.exposure !== undefined) {
|
|
408
|
+
if (patch.exposure === "codemode")
|
|
409
|
+
delete server.exposure;
|
|
410
|
+
else
|
|
411
|
+
server.exposure = patch.exposure;
|
|
412
|
+
}
|
|
413
|
+
return true;
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
function addMcpServerConfig(path, name, config) {
|
|
417
|
+
let replaced = false;
|
|
418
|
+
editMcpServers(path, (servers, parsed) => {
|
|
419
|
+
const target = servers ?? {};
|
|
420
|
+
replaced = target[name] !== undefined;
|
|
421
|
+
target[name] = config;
|
|
422
|
+
parsed.mcpServers = target;
|
|
423
|
+
return true;
|
|
424
|
+
});
|
|
425
|
+
return replaced;
|
|
426
|
+
}
|
|
427
|
+
function removeMcpServerConfig(path, name) {
|
|
428
|
+
if (!existsSync2(path))
|
|
429
|
+
return false;
|
|
430
|
+
let removed = false;
|
|
431
|
+
editMcpServers(path, (servers) => {
|
|
432
|
+
if (!servers || servers[name] === undefined)
|
|
433
|
+
return false;
|
|
434
|
+
delete servers[name];
|
|
435
|
+
removed = true;
|
|
436
|
+
return true;
|
|
437
|
+
});
|
|
438
|
+
return removed;
|
|
439
|
+
}
|
|
440
|
+
function editMcpServers(path, edit) {
|
|
441
|
+
const text = existsSync2(path) ? readFileSync2(path, "utf8") : undefined;
|
|
442
|
+
const parsed = text === undefined ? {} : JSON.parse(text);
|
|
443
|
+
if (!isRecord2(parsed) || parsed.mcpServers !== undefined && !isRecord2(parsed.mcpServers)) {
|
|
444
|
+
throw new Error(`${path}: expected an object with an "mcpServers" object`);
|
|
445
|
+
}
|
|
446
|
+
const servers = isRecord2(parsed.mcpServers) ? parsed.mcpServers : undefined;
|
|
447
|
+
if (!edit(servers, parsed))
|
|
448
|
+
return;
|
|
449
|
+
const indent = text && /^([ \t]+)\S/m.exec(text)?.[1] || " ";
|
|
450
|
+
mkdirSync2(dirname2(path), { recursive: true });
|
|
451
|
+
writeFileSync2(path, `${JSON.stringify(parsed, null, indent)}
|
|
452
|
+
`);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export { getMcpToolExposure, validateMcpServerConfig, McpServerRegistry, getProjectTrustOptions, hasTrustRequiringProjectResources, ProjectTrustStore, openBrowser, loadMcpConfig, updateMcpServerConfig, addMcpServerConfig, removeMcpServerConfig };
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BASE_SUMMARIZE_PROMPT,
|
|
3
3
|
SummaryWithRatingsSchema,
|
|
4
|
-
buildSummaryWithRatingsPrompt
|
|
4
|
+
buildSummaryWithRatingsPrompt
|
|
5
|
+
} from "./cli-cpvsaqsw.js";
|
|
6
|
+
import {
|
|
5
7
|
parseModelStr,
|
|
6
8
|
resolveCredential
|
|
7
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-rfezr056.js";
|
|
8
10
|
import {
|
|
9
11
|
DEFAULT_OPENROUTER_BASE_URL,
|
|
10
12
|
getOpenRouterBaseUrl
|
|
11
13
|
} from "./cli-3dpj7atn.js";
|
|
12
14
|
import {
|
|
13
15
|
complete,
|
|
14
|
-
exports_typebox,
|
|
15
16
|
getBuiltinModel
|
|
16
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-gzyh0j0g.js";
|
|
18
|
+
import {
|
|
19
|
+
exports_typebox
|
|
20
|
+
} from "./cli-rb9m6rpe.js";
|
|
17
21
|
import {
|
|
18
22
|
init_zod
|
|
19
23
|
} from "./cli-sd0mxa3c.js";
|