@desplega.ai/agent-swarm 1.166.0 → 1.168.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-zhejfecx.js +34 -0
- package/dist/{actions-qz3m692w.js → actions-7jg840nr.js} +25 -25
- package/dist/{amp-adapter-j1xbmsqz.js → amp-adapter-ye6rnetm.js} +4 -4
- package/dist/{anthropic-messages-hst62ws9.js → anthropic-messages-13yn502s.js} +4 -4
- package/dist/{app-43vrdmv8.js → app-ffes2kyf.js} +10 -9
- package/dist/{assistant-ertffmka.js → assistant-fhm5smyz.js} +26 -26
- package/dist/{azure-openai-responses-mh8tvf78.js → azure-openai-responses-9st34pfz.js} +5 -5
- package/dist/{boot-reembed-998jtpdg.js → boot-reembed-20q3nzvg.js} +9 -8
- package/dist/{boot-reembed-s7k7c6v2.js → boot-reembed-jvfadhsk.js} +9 -8
- package/dist/{boot-scrub-sweep-nepsk4t1.js → boot-scrub-sweep-jtfajzve.js} +10 -9
- package/dist/{boot-seeds-vvzs1zhk.js → boot-seeds-9qt0j8j2.js} +12 -11
- package/dist/{claude-adapter-2zvmekrp.js → claude-adapter-a8znhthz.js} +24 -22
- package/dist/{claude-managed-adapter-s49wbk8t.js → claude-managed-adapter-tzwxy803.js} +4 -4
- package/dist/{claude-managed-setup-cvhqq8qn.js → claude-managed-setup-nrhfx5b0.js} +3 -3
- package/dist/{claude-sdk-session-kkbxtw5q.js → claude-sdk-session-7x7chdrs.js} +7608 -7596
- package/dist/{cli-zsh093hk.js → cli-014vns2y.js} +63 -1
- package/dist/{cli-8kgvmkak.js → cli-0jngabtb.js} +1 -1
- package/dist/{cli-qvfk83fy.js → cli-13xwcqvj.js} +2 -2
- package/dist/{cli-0nhdwxd5.js → cli-43jg9xdw.js} +3 -3
- package/dist/{cli-cpfmqz3n.js → cli-47zfzshm.js} +5 -5
- package/dist/{cli-zy7vwsne.js → cli-5qkcdv8c.js} +16 -9
- package/dist/{cli-cwxhbf43.js → cli-5t5my0h8.js} +85 -2
- package/dist/{cli-y59h2pk9.js → cli-69egj654.js} +1 -1
- package/dist/{cli-68r1j4sg.js → cli-6bpvv8h4.js} +3 -3
- package/dist/{cli-yshaazs1.js → cli-74ez9b66.js} +63 -20
- package/dist/{cli-32bca7nr.js → cli-7avy4v8w.js} +1 -1
- package/dist/{cli-f2n17zhp.js → cli-7mhy3ths.js} +21 -18
- package/dist/{cli-q38n4bq0.js → cli-95zs84qw.js} +3 -3
- package/dist/{cli-fn697bnt.js → cli-9q0bh411.js} +21 -8
- package/dist/{cli-rggdq8wq.js → cli-9q24yyvs.js} +3 -3
- package/dist/cli-a35hzdve.js +33 -0
- package/dist/{cli-3qn4r334.js → cli-aj1e0h0d.js} +20 -14
- package/dist/{cli-rsy933yz.js → cli-bcspch6h.js} +30 -19
- package/dist/{cli-x3x0qwky.js → cli-bxqez1p0.js} +51 -23
- package/dist/{cli-ng97fjq7.js → cli-cmxkbzzs.js} +33 -7
- package/dist/{cli-df56tqdw.js → cli-ee0402n1.js} +198 -70
- package/dist/{cli-mwegs4af.js → cli-ew0c3a1j.js} +3 -3
- package/dist/{cli-ysnyhws9.js → cli-ewhwpyrb.js} +54 -51
- package/dist/{cli-j2jbr8af.js → cli-fhj4y16f.js} +1 -1
- package/dist/{cli-8t229cmr.js → cli-fqq06kkb.js} +30 -17
- package/dist/{cli-jvj6a0cv.js → cli-g6gx2dn1.js} +54 -19
- package/dist/{cli-nexwh8zg.js → cli-g7k7zbcz.js} +12 -5
- package/dist/{cli-ecknp7p1.js → cli-j05x7pnb.js} +10 -10
- package/dist/{cli-gt8azyet.js → cli-jb931ba2.js} +1 -1
- package/dist/{cli-nvvfd8bq.js → cli-jbzbr36n.js} +4091 -3793
- package/dist/{cli-3ddybbbx.js → cli-jvmtxqtc.js} +26 -14
- package/dist/{cli-pkke6geq.js → cli-km4x66j0.js} +83 -65
- package/dist/{cli-b0f70z24.js → cli-mn8qkd8v.js} +1 -1
- package/dist/{cli-0qjcsxgz.js → cli-nctfv2yy.js} +99 -9
- package/dist/{cli-4r1sjfc4.js → cli-ng1pmdx6.js} +10 -10
- package/dist/cli-nkqjj42q.js +104 -0
- package/dist/{cli-aqcey741.js → cli-p5jqk8fr.js} +1 -1
- package/dist/{cli-66zh26sp.js → cli-pgehz8e1.js} +57 -17
- package/dist/cli-q1vnz8wv.js +96 -0
- package/dist/{cli-fj86xr3c.js → cli-qd97v6z2.js} +2 -2
- package/dist/{cli-p4ztb80h.js → cli-r7eeddkq.js} +13 -8
- package/dist/{cli-8ssjez7e.js → cli-rhy7z1rp.js} +22 -11
- package/dist/{cli-vzc73wet.js → cli-rr5z1j4p.js} +87 -69
- package/dist/{cli-4mevd1hf.js → cli-s9y81s7j.js} +5 -5
- package/dist/{cli-dw2q9f7g.js → cli-svah6b6w.js} +4 -4
- package/dist/{cli-h3x613ze.js → cli-tc5zec7v.js} +6 -6
- package/dist/{cli-ttbsse3f.js → cli-tmhsxhb8.js} +1 -1
- package/dist/{cli-feh3dkah.js → cli-v1w7pbd8.js} +2 -1
- package/dist/{cli-10zmp1p7.js → cli-vr5avem2.js} +27 -32
- package/dist/{cli-bzr0ftht.js → cli-wnb9b2g3.js} +19 -0
- package/dist/{cli-krqm5f11.js → cli-xezn9nkh.js} +16 -13
- package/dist/{cli-8kt0bmgx.js → cli-xf713zz0.js} +2 -2
- package/dist/{cli-6zcfw0x7.js → cli-y195hv1a.js} +1 -1
- package/dist/{cli-x7kpr72a.js → cli-ytmmyj7f.js} +2 -2
- package/dist/{cli-v2a8x45d.js → cli-z48ggfyq.js} +11 -6
- package/dist/{cli-qbksc292.js → cli-zy39d433.js} +2 -0
- package/dist/cli.js +28 -28
- package/dist/{cloudflare-workers-ai-system-one-tt484t61.js → cloudflare-workers-ai-system-one-sta45jf9.js} +7 -5
- package/dist/{codex-adapter-dw1wxqt8.js → codex-adapter-n63k33d3.js} +18 -18
- package/dist/{codex-login-terbdsqq.js → codex-login-g1cyt5zm.js} +1 -1
- package/dist/{codex-session-runner-3cgb8y1g.js → codex-session-runner-xkxfd81a.js} +18 -18
- package/dist/{commands-mhxam6z2.js → commands-q4mfhn51.js} +9 -8
- package/dist/{cursor-adapter-2qda3st7.js → cursor-adapter-v8mm6bp5.js} +5 -5
- package/dist/{db-sjks418k.js → db-1t0bj3pc.js} +9 -8
- package/dist/{dispatcher-1es759rn.js → dispatcher-k1fhavcf.js} +24 -24
- package/dist/{dsh-adapter-bek4cyw9.js → dsh-adapter-5423p70m.js} +5 -5
- package/dist/{easter-egg-3d-mtpnw06s.js → easter-egg-3d-66zxervv.js} +2 -2
- package/dist/{execute-s4ccjq3n.js → execute-h4jgevyw.js} +61 -11
- package/dist/{google-generative-ai-d6nphg3q.js → google-generative-ai-b8zxrpax.js} +5 -5
- package/dist/{google-vertex-cpshkref.js → google-vertex-nrdd697t.js} +5 -5
- package/dist/{grok-adapter-ar9cw9jg.js → grok-adapter-phrndeb8.js} +18 -8
- package/dist/{handlers-1gkbhktr.js → handlers-59ywqwzh.js} +27 -27
- package/dist/{hook-vxa3tcsy.js → hook-atj0swc2.js} +14 -14
- package/dist/{hook-ds2zxq9v.js → hook-mew1chq9.js} +42 -31
- package/dist/{http-3h21z9md.js → http-ef2fnn9v.js} +953 -98
- package/dist/{index-n99fycq7.js → index-48pb9erw.js} +24 -24
- package/dist/{index-bn6cy8ps.js → index-9fc2h7ww.js} +24 -24
- package/dist/{index-9b65j1m5.js → index-gr69c43q.js} +9 -8
- package/dist/{index-f8xnqrye.js → index-h26wjcfy.js} +43 -24
- package/dist/{index-dkfxpkmm.js → index-w2yhye23.js} +25 -25
- package/dist/{keepalive-3xspa9jw.js → keepalive-qhcqz56v.js} +11 -10
- package/dist/{lead-6qphc124.js → lead-hpk5r3b1.js} +47 -47
- package/dist/{llama-cpp-classify-tgj35k8d.js → llama-cpp-classify-6erb7wwv.js} +3 -1
- package/dist/{maintenance-0teem1bb.js → maintenance-nvkyp2xe.js} +9 -8
- package/dist/{mistral-conversations-8445ddjn.js → mistral-conversations-059y51zt.js} +4 -4
- package/dist/{node-9sg7ajby.js → node-qm9eb6z0.js} +1 -1
- package/dist/{oauth-refresh-sweep-sh9q25xp.js → oauth-refresh-sweep-ngskthwh.js} +10 -9
- package/dist/{onboard-54qmnqxe.js → onboard-yfnkqhxc.js} +2 -2
- package/dist/{openai-codex-responses-9ynm88zy.js → openai-codex-responses-jzxkta9b.js} +8 -7
- package/dist/{openai-completions-nhqwjmaw.js → openai-completions-663yncfq.js} +4 -4
- package/dist/openai-decisions-vj9nkpf8.js +162 -0
- package/dist/{openai-responses-xx1c4kgm.js → openai-responses-m3g43rrt.js} +5 -5
- package/dist/{opencode-adapter-wjfa2wvd.js → opencode-adapter-yjyqynzf.js} +7 -7
- package/dist/{openrouter-images-8yx3487g.js → openrouter-images-kr60n6b9.js} +1 -1
- package/dist/{otel-impl-ycqzp2a1.js → otel-impl-hhm64r6m.js} +1 -1
- package/dist/{pi-messages-vxdt8v7j.js → pi-messages-xszk613n.js} +1 -1
- package/dist/{pi-mono-adapter-e77e9zst.js → pi-mono-adapter-0eg8kw2c.js} +68 -51
- package/dist/{pricing-refresh-atnkngqs.js → pricing-refresh-35f91nx2.js} +11 -10
- package/dist/{rbac-roles-j78wdksm.js → rbac-roles-97w370qj.js} +10 -9
- package/dist/{rbac-roles-9pjphh9q.js → rbac-roles-z6sje3gy.js} +9 -8
- package/dist/{render-v2-pxjs49fx.js → render-v2-n4v66bj3.js} +10 -9
- package/dist/{runtime-v2t1r79e.js → runtime-h9ha1mq6.js} +4 -4
- package/dist/{setup-ymej0xtx.js → setup-m3hhyv5f.js} +2 -2
- package/dist/{typesafe-system-one-datfr82p.js → typesafe-system-one-e988vty7.js} +7 -5
- package/dist/{virtual-modules-wm8mxdxx.js → virtual-modules-ftr9kwe8.js} +11 -11
- package/dist/{work-objects-3nh4ymzb.js → work-objects-mxf2c842.js} +27 -27
- package/dist/{worker-qa9fkz5s.js → worker-9t07z1gq.js} +47 -47
- package/openapi.json +72 -1
- package/package.json +10 -10
- package/src/be/memory/providers/openai-embedding.ts +7 -2
- package/src/be/memory/raters/llm-summarizer.ts +7 -2
- package/src/be/modelsdev-cache.json +61 -0
- package/src/be/script-connections.ts +40 -6
- package/src/be/seed-pricing.ts +84 -53
- package/src/be/swarm-config-guard.ts +14 -0
- package/src/commands/provider-credentials.ts +28 -5
- package/src/commands/runner.ts +7 -12
- package/src/extensions/catalog.generated.json +17 -0
- package/src/heartbeat/heartbeat.ts +91 -19
- package/src/hooks/hook.ts +72 -27
- package/src/http/mcp.ts +5 -0
- package/src/http/onboarding.ts +2 -0
- package/src/http/script-connections.ts +35 -0
- package/src/providers/acp-targets.ts +10 -5
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +32 -0
- package/src/providers/claude-background-keepalive.ts +100 -0
- package/src/providers/claude-sdk-session.ts +6 -0
- package/src/providers/codex-adapter.ts +30 -3
- package/src/providers/codex-oauth/auth-json.ts +21 -4
- package/src/providers/codex-oauth/types.ts +2 -0
- package/src/providers/dsh-adapter.ts +11 -2
- package/src/providers/grok-adapter.ts +18 -2
- package/src/providers/opencode-adapter.ts +21 -5
- package/src/providers/pi-mono-extension.ts +56 -25
- package/src/providers/pricing-sources.md +2 -0
- package/src/scheduler/scheduler.ts +82 -13
- package/src/scripts-runtime/executors/registry.ts +1 -1
- package/src/server.ts +63 -3
- package/src/tests/acp-adapter.test.ts +152 -12
- package/src/tests/ci-unit-test-report.test.ts +73 -0
- package/src/tests/claude-background-keepalive-wiring.test.ts +220 -0
- package/src/tests/claude-background-keepalive.fixture.ts +162 -0
- package/src/tests/claude-background-keepalive.test.ts +139 -0
- package/src/tests/claude-default-route.test.ts +75 -0
- package/src/tests/claude-hook-output.test.ts +233 -0
- package/src/tests/codex-adapter-pool-auth-revalidate.test.ts +4 -2
- package/src/tests/codex-adapter.test.ts +166 -26
- package/src/tests/codex-oauth-auth-timestamps.test.ts +76 -0
- package/src/tests/codex-oauth.test.ts +4 -1
- package/src/tests/connection-embedded-auth.test.ts +51 -0
- package/src/tests/context-window.test.ts +2 -2
- package/src/tests/credential-check.test.ts +51 -1
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dsh-adapter.test.ts +24 -2
- package/src/tests/enabled-tools.test.ts +269 -0
- package/src/tests/entrypoint-codex-oauth-seed.test.ts +12 -0
- package/src/tests/extensions-catalog.test.ts +1 -0
- package/src/tests/extensions-example-slack-reply-gate.test.ts +756 -0
- package/src/tests/grok-adapter.test.ts +13 -0
- package/src/tests/haiku-5-5-pricing.test.ts +38 -0
- package/src/tests/heartbeat-checklist.test.ts +158 -1
- package/src/tests/onboarding.test.ts +44 -0
- package/src/tests/opencode-adapter.test.ts +66 -3
- package/src/tests/opencode-plugin.test.ts +37 -0
- package/src/tests/openrouter-attribution-call-sites.test.ts +204 -0
- package/src/tests/openrouter-base-url.test.ts +30 -39
- package/src/tests/pi-mono-extension.test.ts +161 -2
- package/src/tests/pricing-refresh.test.ts +70 -1
- package/src/tests/reasoning-effort.test.ts +3 -1
- package/src/tests/schedule-target-type.test.ts +136 -0
- package/src/tests/script-connections-http.test.ts +45 -0
- package/src/tests/script-connections-mcp.test.ts +41 -0
- package/src/tests/script-executor-registry.test.ts +18 -0
- package/src/tests/send-task-self-send.test.ts +107 -0
- package/src/tests/telemetry-trigger.test.ts +12 -1
- package/src/tests/workflow-llm.test.ts +14 -0
- package/src/tests/workflow-system-one-decision-providers.test.ts +33 -0
- package/src/tools/request-human-input.ts +7 -2
- package/src/tools/script-connections/tool.ts +35 -3
- package/src/tools/send-task.ts +9 -1
- package/src/utils/enabled-tools.ts +27 -0
- package/src/utils/internal-ai/complete-structured.ts +11 -3
- package/src/utils/openrouter-base-url.ts +23 -0
- package/src/workflows/executors/raw-llm.ts +1 -0
- package/src/workflows/executors/system-one-decision.ts +2 -0
- package/src/workflows/executors/validate.ts +1 -0
- package/src/workflows/executors/workflow-llm.ts +9 -2
- package/templates/extensions/README.md +1 -0
- package/templates/extensions/slack-reply-gate/README.md +98 -0
- package/templates/extensions/slack-reply-gate/hooks.ts +582 -0
- package/templates/extensions/slack-reply-gate/manifest.json +8 -0
- package/templates/skills/agent-browser/SKILL.md +2 -0
- package/templates/skills/agent-browser/content.md +2 -0
- package/templates/skills/code-quality/content.md +1 -0
- package/templates/skills/heartbeat-runbook/content.md +1 -1
- package/templates/skills/swarm-scripts/SKILL.md +10 -0
- package/templates/skills/swarm-scripts/content.md +10 -0
- package/templates/skills/work-on-task/SKILL.md +4 -0
- package/templates/skills/work-on-task/content.md +4 -0
- package/templates/skills/workflow-iterate/content.md +9 -0
- package/dist/acp-adapter-yzfxn8vj.js +0 -23
- package/dist/cli-3dpj7atn.js +0 -11
- package/dist/cli-gvcgmx69.js +0 -183
- package/dist/{cli-jhm6hzjn.js → cli-mxvnnv5q.js} +7 -7
- package/dist/{codex-hook-d2rkvf39.js → codex-hook-15dgc4cb.js} +1 -1
|
@@ -15,12 +15,12 @@ import {
|
|
|
15
15
|
require_proper_lockfile,
|
|
16
16
|
resolveConfigValueOrThrow,
|
|
17
17
|
resolveHeadersOrThrow
|
|
18
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-xezn9nkh.js";
|
|
19
19
|
import {
|
|
20
20
|
APP_NAME,
|
|
21
21
|
VERSION,
|
|
22
22
|
getAgentDir
|
|
23
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-5t5my0h8.js";
|
|
24
24
|
import {
|
|
25
25
|
oauthErrorHtml,
|
|
26
26
|
oauthSuccessHtml
|
|
@@ -328,19 +328,20 @@ function parseWwwAuthenticate(header) {
|
|
|
328
328
|
errorDescription: field(header, "error_description")
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
|
-
async function fetchMetadata(url, fetch, protocolVersion) {
|
|
331
|
+
async function fetchMetadata(url, fetch, protocolVersion, signal) {
|
|
332
332
|
return fetch(url, {
|
|
333
|
-
headers: { Accept: "application/json", "MCP-Protocol-Version": protocolVersion }
|
|
333
|
+
headers: { Accept: "application/json", "MCP-Protocol-Version": protocolVersion },
|
|
334
|
+
signal
|
|
334
335
|
});
|
|
335
336
|
}
|
|
336
337
|
async function discoverProtectedResourceMetadata(serverUrl, options = {}) {
|
|
337
338
|
const server = new URL(serverUrl);
|
|
338
339
|
const fetch = options.fetch ?? globalThis.fetch;
|
|
339
340
|
const version = options.protocolVersion ?? LATEST_PROTOCOL_VERSION;
|
|
340
|
-
let response = await fetchMetadata(options.resourceMetadataUrl ? new URL(options.resourceMetadataUrl) : new URL(`/.well-known/oauth-protected-resource${pathSuffix(server.pathname)}`, server.origin), fetch, version);
|
|
341
|
+
let response = await fetchMetadata(options.resourceMetadataUrl ? new URL(options.resourceMetadataUrl) : new URL(`/.well-known/oauth-protected-resource${pathSuffix(server.pathname)}`, server.origin), fetch, version, options.signal);
|
|
341
342
|
if (!options.resourceMetadataUrl && server.pathname !== "/" && isDiscoveryMiss(response.status)) {
|
|
342
343
|
discard(response);
|
|
343
|
-
response = await fetchMetadata(new URL("/.well-known/oauth-protected-resource", server.origin), fetch, version);
|
|
344
|
+
response = await fetchMetadata(new URL("/.well-known/oauth-protected-resource", server.origin), fetch, version, options.signal);
|
|
344
345
|
}
|
|
345
346
|
if (!response.ok) {
|
|
346
347
|
discard(response);
|
|
@@ -362,7 +363,7 @@ function buildAuthorizationServerDiscoveryUrls(authorizationServerUrl) {
|
|
|
362
363
|
async function discoverAuthorizationServerMetadata(authorizationServerUrl, options = {}) {
|
|
363
364
|
const fetch = options.fetch ?? globalThis.fetch;
|
|
364
365
|
for (const { url } of buildAuthorizationServerDiscoveryUrls(authorizationServerUrl)) {
|
|
365
|
-
const response = await fetchMetadata(url, fetch, options.protocolVersion ?? LATEST_PROTOCOL_VERSION);
|
|
366
|
+
const response = await fetchMetadata(url, fetch, options.protocolVersion ?? LATEST_PROTOCOL_VERSION, options.signal);
|
|
366
367
|
if (!response.ok) {
|
|
367
368
|
discard(response);
|
|
368
369
|
if (isDiscoveryMiss(response.status))
|
|
@@ -385,7 +386,8 @@ async function discoverOAuthServerInfo(serverUrl, options = {}) {
|
|
|
385
386
|
try {
|
|
386
387
|
resourceMetadata = await discoverProtectedResourceMetadata(serverUrl, {
|
|
387
388
|
resourceMetadataUrl: options.resourceMetadataUrl,
|
|
388
|
-
fetch: options.fetch
|
|
389
|
+
fetch: options.fetch,
|
|
390
|
+
signal: options.signal
|
|
389
391
|
});
|
|
390
392
|
} catch (error) {
|
|
391
393
|
if (error instanceof TypeError)
|
|
@@ -393,7 +395,7 @@ async function discoverOAuthServerInfo(serverUrl, options = {}) {
|
|
|
393
395
|
}
|
|
394
396
|
if (options.authorizationServerMetadataUrl) {
|
|
395
397
|
const url = options.authorizationServerMetadataUrl;
|
|
396
|
-
const response = await fetchMetadata(url, options.fetch ?? globalThis.fetch, LATEST_PROTOCOL_VERSION);
|
|
398
|
+
const response = await fetchMetadata(url, options.fetch ?? globalThis.fetch, LATEST_PROTOCOL_VERSION, options.signal);
|
|
397
399
|
if (!response.ok) {
|
|
398
400
|
discard(response);
|
|
399
401
|
throw new Error(`HTTP ${response.status} loading authorization server metadata from ${url}`);
|
|
@@ -406,7 +408,8 @@ async function discoverOAuthServerInfo(serverUrl, options = {}) {
|
|
|
406
408
|
authorizationServerUrl,
|
|
407
409
|
authorizationServerMetadata: await discoverAuthorizationServerMetadata(authorizationServerUrl, {
|
|
408
410
|
fetch: options.fetch,
|
|
409
|
-
skipIssuerValidation: options.skipIssuerValidation
|
|
411
|
+
skipIssuerValidation: options.skipIssuerValidation,
|
|
412
|
+
signal: options.signal
|
|
410
413
|
}),
|
|
411
414
|
resourceMetadata
|
|
412
415
|
};
|
|
@@ -517,7 +520,12 @@ async function tokenRequest(authorizationServerUrl, options, params) {
|
|
|
517
520
|
} else {
|
|
518
521
|
applyClientAuthentication(selectClientAuthMethod(options.clientInformation, options.metadata?.token_endpoint_auth_methods_supported ?? []), options.clientInformation, headers, params);
|
|
519
522
|
}
|
|
520
|
-
const response = await (options.fetch ?? globalThis.fetch)(url, {
|
|
523
|
+
const response = await (options.fetch ?? globalThis.fetch)(url, {
|
|
524
|
+
method: "POST",
|
|
525
|
+
headers,
|
|
526
|
+
body: params,
|
|
527
|
+
signal: options.signal
|
|
528
|
+
});
|
|
521
529
|
const text = await response.text();
|
|
522
530
|
let value;
|
|
523
531
|
try {
|
|
@@ -541,7 +549,8 @@ async function registerClient(authorizationServerUrl, options) {
|
|
|
541
549
|
...options.clientMetadata,
|
|
542
550
|
application_type: options.clientMetadata.application_type ?? applicationType(options.clientMetadata.redirect_uris),
|
|
543
551
|
...options.scope ? { scope: options.scope } : {}
|
|
544
|
-
})
|
|
552
|
+
}),
|
|
553
|
+
signal: options.signal
|
|
545
554
|
});
|
|
546
555
|
if (!response.ok)
|
|
547
556
|
throw new OAuthRegistrationError(response.status, await response.text());
|
|
@@ -575,14 +584,16 @@ async function runFlow(provider, options) {
|
|
|
575
584
|
authorizationServerUrl: cached.authorizationServerUrl,
|
|
576
585
|
authorizationServerMetadata: cached.authorizationServerMetadata ?? await discoverAuthorizationServerMetadata(cached.authorizationServerUrl, {
|
|
577
586
|
fetch: options.fetch,
|
|
578
|
-
skipIssuerValidation: options.skipIssuerValidation
|
|
587
|
+
skipIssuerValidation: options.skipIssuerValidation,
|
|
588
|
+
signal: options.signal
|
|
579
589
|
}),
|
|
580
590
|
resourceMetadata: cached.resourceMetadata
|
|
581
591
|
} : await discoverOAuthServerInfo(options.serverUrl, {
|
|
582
592
|
resourceMetadataUrl: options.resourceMetadataUrl,
|
|
583
593
|
authorizationServerMetadataUrl: metadataUrl,
|
|
584
594
|
fetch: options.fetch,
|
|
585
|
-
skipIssuerValidation: options.skipIssuerValidation
|
|
595
|
+
skipIssuerValidation: options.skipIssuerValidation,
|
|
596
|
+
signal: options.signal
|
|
586
597
|
});
|
|
587
598
|
if (!metadataUrl) {
|
|
588
599
|
await provider.saveDiscoveryState?.({
|
|
@@ -610,7 +621,8 @@ async function runFlow(provider, options) {
|
|
|
610
621
|
metadata,
|
|
611
622
|
clientMetadata: provider.clientMetadata,
|
|
612
623
|
scope,
|
|
613
|
-
fetch: options.fetch
|
|
624
|
+
fetch: options.fetch,
|
|
625
|
+
signal: options.signal
|
|
614
626
|
});
|
|
615
627
|
await provider.saveClientInformation(client);
|
|
616
628
|
}
|
|
@@ -620,7 +632,8 @@ async function runFlow(provider, options) {
|
|
|
620
632
|
clientInformation: client,
|
|
621
633
|
resource,
|
|
622
634
|
addClientAuthentication: provider.addClientAuthentication,
|
|
623
|
-
fetch: options.fetch
|
|
635
|
+
fetch: options.fetch,
|
|
636
|
+
signal: options.signal
|
|
624
637
|
};
|
|
625
638
|
if (options.authorizationCode) {
|
|
626
639
|
const iss = options.iss;
|
|
@@ -647,7 +660,7 @@ async function runFlow(provider, options) {
|
|
|
647
660
|
await provider.saveTokens(withScope(tokens, existing.scope));
|
|
648
661
|
return "AUTHORIZED";
|
|
649
662
|
} catch (error) {
|
|
650
|
-
if (error instanceof OAuthInsecureEndpointError)
|
|
663
|
+
if (options.signal?.aborted || error instanceof OAuthInsecureEndpointError)
|
|
651
664
|
throw error;
|
|
652
665
|
if (error instanceof OAuthError && error.code !== "server_error")
|
|
653
666
|
throw error;
|
|
@@ -806,7 +819,7 @@ var CALLBACK_PATH = "/callback";
|
|
|
806
819
|
var CLIENT_METADATA_BASE_URL = "https://pi.dev/oauth";
|
|
807
820
|
var FALLBACK_REDIRECT_URL = `http://${CALLBACK_HOST}${CALLBACK_PATH}`;
|
|
808
821
|
var REFRESH_SKEW_MS = 30000;
|
|
809
|
-
var
|
|
822
|
+
var OAUTH_REQUEST_TIMEOUT_MS = 15000;
|
|
810
823
|
var REFRESH_LOCK_STALE_MS = 20000;
|
|
811
824
|
var REFRESH_LOCK_WAIT_MS = 25000;
|
|
812
825
|
var REFRESH_LOCK_RETRY_MS = 100;
|
|
@@ -920,6 +933,12 @@ class McpOAuthCredentialStore {
|
|
|
920
933
|
});
|
|
921
934
|
}
|
|
922
935
|
}
|
|
936
|
+
function timedFetch(fetch = globalThis.fetch) {
|
|
937
|
+
return (input, init) => {
|
|
938
|
+
const timeout = AbortSignal.timeout(OAUTH_REQUEST_TIMEOUT_MS);
|
|
939
|
+
return fetch(input, { ...init, signal: init?.signal ? AbortSignal.any([init.signal, timeout]) : timeout });
|
|
940
|
+
};
|
|
941
|
+
}
|
|
923
942
|
function registeredRedirectUrls(client) {
|
|
924
943
|
return client && "redirect_uris" in client ? client.redirect_uris : [];
|
|
925
944
|
}
|
|
@@ -970,7 +989,7 @@ function createMcpAuthProvider(options) {
|
|
|
970
989
|
resourceMetadataUrl: challenge?.resourceMetadataUrl,
|
|
971
990
|
authorizationServerMetadataUrl: settings.authServerMetadataUrl,
|
|
972
991
|
scope: challenge?.scope,
|
|
973
|
-
fetch: (
|
|
992
|
+
fetch: timedFetch(fetch)
|
|
974
993
|
});
|
|
975
994
|
if (result === "REDIRECT")
|
|
976
995
|
throw new McpOAuthAuthorizationRequiredError;
|
|
@@ -1035,10 +1054,11 @@ function responseFromRedirectUrl(input, state, redirectUrl) {
|
|
|
1035
1054
|
throw new Error("The redirect URL does not contain an authorization code");
|
|
1036
1055
|
return { code, iss: url.searchParams.get("iss") ?? undefined };
|
|
1037
1056
|
}
|
|
1038
|
-
async function waitForAuthorizationResponse(callback, state, redirectUrl, prompt) {
|
|
1057
|
+
async function waitForAuthorizationResponse(callback, state, redirectUrl, prompt, signal) {
|
|
1039
1058
|
const controller = new AbortController;
|
|
1059
|
+
const promptSignal = signal ? AbortSignal.any([controller.signal, signal]) : controller.signal;
|
|
1040
1060
|
const fromBrowser = callback.waitForCallback(state, redirectUrl.pathname);
|
|
1041
|
-
const fromUser = prompt.promptForRedirectUrl(
|
|
1061
|
+
const fromUser = prompt.promptForRedirectUrl(promptSignal).then((input) => {
|
|
1042
1062
|
if (!input?.trim())
|
|
1043
1063
|
throw new McpSignInCancelledError;
|
|
1044
1064
|
return responseFromRedirectUrl(input, state, redirectUrl);
|
|
@@ -1072,7 +1092,9 @@ async function listenForCallback(settings, extraPaths, port, required) {
|
|
|
1072
1092
|
}
|
|
1073
1093
|
}
|
|
1074
1094
|
async function signInMcpServer(options) {
|
|
1075
|
-
const { serverUrl, store, settings } = options;
|
|
1095
|
+
const { serverUrl, store, settings, signal } = options;
|
|
1096
|
+
if (signal?.aborted)
|
|
1097
|
+
throw new McpSignInCancelledError;
|
|
1076
1098
|
const stored = await store.load();
|
|
1077
1099
|
const stepUp = options.challenge?.error === "insufficient_scope";
|
|
1078
1100
|
const callbackOptions = callbackSettings(settings);
|
|
@@ -1099,6 +1121,8 @@ async function signInMcpServer(options) {
|
|
|
1099
1121
|
});
|
|
1100
1122
|
const flow = {
|
|
1101
1123
|
serverUrl,
|
|
1124
|
+
fetch: timedFetch(),
|
|
1125
|
+
signal,
|
|
1102
1126
|
resourceMetadataUrl: options.challenge?.resourceMetadataUrl,
|
|
1103
1127
|
authorizationServerMetadataUrl: settings.authServerMetadataUrl,
|
|
1104
1128
|
scope: mergeScopes(settings.scope, stepUp ? stepUpScope(stored?.tokens?.scope, options.challenge?.scope) : options.challenge?.scope)
|
|
@@ -1111,8 +1135,12 @@ async function signInMcpServer(options) {
|
|
|
1111
1135
|
const state = await provider.state();
|
|
1112
1136
|
const authorizationRedirectUrl = new URL(authorizationUrl.searchParams.get("redirect_uri") ?? redirectUrl);
|
|
1113
1137
|
options.prompt.showAuthorizationUrl(authorizationUrl);
|
|
1114
|
-
const { code, iss } = await waitForAuthorizationResponse(callback, state, authorizationRedirectUrl, options.prompt);
|
|
1138
|
+
const { code, iss } = await waitForAuthorizationResponse(callback, state, authorizationRedirectUrl, options.prompt, signal);
|
|
1115
1139
|
await authorizeMcp(provider, { ...flow, authorizationCode: code, iss });
|
|
1140
|
+
} catch (error) {
|
|
1141
|
+
if (signal?.aborted)
|
|
1142
|
+
throw new McpSignInCancelledError;
|
|
1143
|
+
throw error;
|
|
1116
1144
|
} finally {
|
|
1117
1145
|
await callback.close();
|
|
1118
1146
|
}
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
getJsonSchemaToolParameters,
|
|
33
33
|
resolveJsonSchemaStrictSampling,
|
|
34
34
|
transformMessages
|
|
35
|
-
} from "./cli-
|
|
35
|
+
} from "./cli-xf713zz0.js";
|
|
36
36
|
import {
|
|
37
37
|
sanitizeSurrogates
|
|
38
38
|
} from "./cli-y2apkfe2.js";
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
getInitialSystemMessage,
|
|
47
47
|
getSystemMessageText,
|
|
48
48
|
withoutInitialSystemMessage
|
|
49
|
-
} from "./cli-
|
|
49
|
+
} from "./cli-g7k7zbcz.js";
|
|
50
50
|
import {
|
|
51
51
|
getProviderEnvValue
|
|
52
52
|
} from "./cli-btbzvq95.js";
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
import {
|
|
57
57
|
AssistantMessageEventStream,
|
|
58
58
|
appendAssistantMessageDiagnostic
|
|
59
|
-
} from "./cli-
|
|
59
|
+
} from "./cli-wnb9b2g3.js";
|
|
60
60
|
import {
|
|
61
61
|
exports_supports_color,
|
|
62
62
|
init_supports_color
|
|
@@ -6489,15 +6489,15 @@ function getModelMatchCandidates(modelId, modelName) {
|
|
|
6489
6489
|
}
|
|
6490
6490
|
function supportsAdaptiveThinking(modelId, modelName) {
|
|
6491
6491
|
const candidates = getModelMatchCandidates(modelId, modelName);
|
|
6492
|
-
return candidates.some((s) => s.includes("opus-4-6") || s.includes("opus-4-7") || s.includes("opus-4-8") || s.includes("opus-5") || s.includes("sonnet-4-6") || s.includes("sonnet-5") || s.includes("fable-5"));
|
|
6492
|
+
return candidates.some((s) => s.includes("opus-4-6") || s.includes("opus-4-7") || s.includes("opus-4-8") || s.includes("opus-5") || s.includes("sonnet-4-6") || s.includes("sonnet-5") || s.includes("haiku-5") || s.includes("fable-5"));
|
|
6493
6493
|
}
|
|
6494
6494
|
function supportsNativeXhighEffort(model) {
|
|
6495
6495
|
const candidates = getModelMatchCandidates(model.id, model.name);
|
|
6496
|
-
return candidates.some((s) => s.includes("opus-4-7") || s.includes("opus-4-8") || s.includes("opus-5") || s.includes("sonnet-5") || s.includes("fable-5"));
|
|
6496
|
+
return candidates.some((s) => s.includes("opus-4-7") || s.includes("opus-4-8") || s.includes("opus-5") || s.includes("sonnet-5") || s.includes("haiku-5") || s.includes("fable-5"));
|
|
6497
6497
|
}
|
|
6498
6498
|
function supportsThinkingBlockBinding(model) {
|
|
6499
6499
|
const candidates = getModelMatchCandidates(model.id, model.name);
|
|
6500
|
-
return candidates.some((s) => s.includes("opus-4-7") || s.includes("opus-4-8") || s.includes("opus-5") || s.includes("sonnet-5") || s.includes("fable-5"));
|
|
6500
|
+
return candidates.some((s) => s.includes("opus-4-7") || s.includes("opus-4-8") || s.includes("opus-5") || s.includes("sonnet-5") || s.includes("haiku-5") || s.includes("fable-5"));
|
|
6501
6501
|
}
|
|
6502
6502
|
function mapThinkingLevelToEffort(model, level) {
|
|
6503
6503
|
if (level === "xhigh" && supportsNativeXhighEffort(model))
|
|
@@ -6539,7 +6539,7 @@ function supportsPromptCaching(model, env) {
|
|
|
6539
6539
|
return true;
|
|
6540
6540
|
return false;
|
|
6541
6541
|
}
|
|
6542
|
-
if (candidates.some((s) => s.includes("fable-5") || s.includes("opus-5") || s.includes("sonnet-5")))
|
|
6542
|
+
if (candidates.some((s) => s.includes("fable-5") || s.includes("opus-5") || s.includes("sonnet-5") || s.includes("haiku-5")))
|
|
6543
6543
|
return true;
|
|
6544
6544
|
if (candidates.some((s) => s.includes("-4-")))
|
|
6545
6545
|
return true;
|
|
@@ -6865,8 +6865,34 @@ function buildAdditionalModelRequestFields(model, options) {
|
|
|
6865
6865
|
}
|
|
6866
6866
|
return result;
|
|
6867
6867
|
}
|
|
6868
|
+
const candidates = getModelMatchCandidates(model.id, model.name);
|
|
6869
|
+
if (candidates.some((s) => s.includes("gpt-oss"))) {
|
|
6870
|
+
return { reasoning_effort: OPENAI_GPT_OSS_EFFORT[options.reasoning] };
|
|
6871
|
+
}
|
|
6872
|
+
if (candidates.some((s) => s.includes("gpt-"))) {
|
|
6873
|
+
const mapped = model.thinkingLevelMap?.[options.reasoning];
|
|
6874
|
+
return {
|
|
6875
|
+
reasoning: { effort: typeof mapped === "string" ? mapped : OPENAI_GPT_EFFORT[options.reasoning] }
|
|
6876
|
+
};
|
|
6877
|
+
}
|
|
6868
6878
|
return;
|
|
6869
6879
|
}
|
|
6880
|
+
var OPENAI_GPT_EFFORT = {
|
|
6881
|
+
minimal: "low",
|
|
6882
|
+
low: "low",
|
|
6883
|
+
medium: "medium",
|
|
6884
|
+
high: "high",
|
|
6885
|
+
xhigh: "xhigh",
|
|
6886
|
+
max: "max"
|
|
6887
|
+
};
|
|
6888
|
+
var OPENAI_GPT_OSS_EFFORT = {
|
|
6889
|
+
minimal: "low",
|
|
6890
|
+
low: "low",
|
|
6891
|
+
medium: "medium",
|
|
6892
|
+
high: "high",
|
|
6893
|
+
xhigh: "high",
|
|
6894
|
+
max: "high"
|
|
6895
|
+
};
|
|
6870
6896
|
function createImageBlock(mimeType, data) {
|
|
6871
6897
|
let format;
|
|
6872
6898
|
switch (mimeType) {
|