@desplega.ai/agent-swarm 1.166.0 → 1.167.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-zpvy6321.js +34 -0
- package/dist/{actions-qz3m692w.js → actions-fq2zrwtf.js} +25 -25
- package/dist/{amp-adapter-j1xbmsqz.js → amp-adapter-5gbk7501.js} +4 -4
- package/dist/{anthropic-messages-hst62ws9.js → anthropic-messages-13yn502s.js} +4 -4
- package/dist/{app-43vrdmv8.js → app-nctetn1e.js} +10 -9
- package/dist/{assistant-ertffmka.js → assistant-0aq8gjvj.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-1ze5853n.js} +9 -8
- package/dist/{boot-reembed-s7k7c6v2.js → boot-reembed-fmp5ww69.js} +9 -8
- package/dist/{boot-scrub-sweep-nepsk4t1.js → boot-scrub-sweep-cbp8xd4e.js} +10 -9
- package/dist/{boot-seeds-vvzs1zhk.js → boot-seeds-22tx8a53.js} +12 -11
- package/dist/{claude-adapter-2zvmekrp.js → claude-adapter-0jhgeh1d.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-wh77rh83.js} +22 -22
- package/dist/{cli-zsh093hk.js → cli-014vns2y.js} +63 -1
- package/dist/{cli-qvfk83fy.js → cli-13xwcqvj.js} +2 -2
- package/dist/{cli-dw2q9f7g.js → cli-1yrcfa5s.js} +4 -4
- package/dist/{cli-jvj6a0cv.js → cli-577bxkf6.js} +27 -17
- 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-cpfmqz3n.js → cli-6qxmjpem.js} +5 -5
- package/dist/{cli-aqcey741.js → cli-6vfz44sr.js} +1 -1
- 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-a35hzdve.js +33 -0
- package/dist/{cli-x3x0qwky.js → cli-bxqez1p0.js} +51 -23
- package/dist/{cli-gt8azyet.js → cli-c2tpw9ck.js} +1 -1
- package/dist/{cli-ecknp7p1.js → cli-c8r99akr.js} +10 -10
- package/dist/{cli-3qn4r334.js → cli-cexctgn5.js} +20 -14
- package/dist/{cli-vzc73wet.js → cli-cf2vgn9d.js} +87 -69
- package/dist/{cli-ng97fjq7.js → cli-cmxkbzzs.js} +33 -7
- package/dist/{cli-nexwh8zg.js → cli-g7k7zbcz.js} +12 -5
- 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-j2jbr8af.js → cli-kw0jcfje.js} +1 -1
- package/dist/{cli-8t229cmr.js → cli-m7vmeepg.js} +30 -17
- package/dist/{cli-yshaazs1.js → cli-mkdsy1nq.js} +62 -20
- package/dist/{cli-b0f70z24.js → cli-mn8qkd8v.js} +1 -1
- package/dist/{cli-0qjcsxgz.js → cli-mxry91sa.js} +30 -9
- package/dist/cli-nkqjj42q.js +104 -0
- package/dist/{cli-rggdq8wq.js → cli-p8rt8spp.js} +3 -3
- package/dist/{cli-v2a8x45d.js → cli-pkj1w46r.js} +10 -5
- package/dist/cli-q1vnz8wv.js +96 -0
- package/dist/{cli-fj86xr3c.js → cli-qd97v6z2.js} +2 -2
- package/dist/{cli-66zh26sp.js → cli-qzmzwegq.js} +57 -17
- package/dist/{cli-p4ztb80h.js → cli-r7eeddkq.js} +13 -8
- package/dist/{cli-8ssjez7e.js → cli-rhy7z1rp.js} +22 -11
- package/dist/{cli-4mevd1hf.js → cli-s9y81s7j.js} +5 -5
- package/dist/{cli-h3x613ze.js → cli-tc5zec7v.js} +6 -6
- package/dist/{cli-ttbsse3f.js → cli-tmhsxhb8.js} +1 -1
- package/dist/{cli-0nhdwxd5.js → cli-tx2zvn23.js} +3 -3
- package/dist/{cli-mwegs4af.js → cli-ty4bzkqr.js} +3 -3
- package/dist/{cli-ysnyhws9.js → cli-v1pwxreq.js} +54 -51
- 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-df56tqdw.js → cli-wydz3feg.js} +108 -57
- package/dist/{cli-krqm5f11.js → cli-xezn9nkh.js} +16 -13
- package/dist/{cli-8kt0bmgx.js → cli-xf713zz0.js} +2 -2
- package/dist/{cli-x7kpr72a.js → cli-y0kjpfm9.js} +2 -2
- package/dist/{cli-6zcfw0x7.js → cli-y195hv1a.js} +1 -1
- package/dist/{cli-fn697bnt.js → cli-ykt8f7va.js} +21 -8
- package/dist/{cli-4r1sjfc4.js → cli-ymmc1zxg.js} +8 -8
- package/dist/{cli-8kgvmkak.js → cli-ypgba1a8.js} +1 -1
- package/dist/{cli-rsy933yz.js → cli-z1dqhc9y.js} +30 -19
- package/dist/{cli-qbksc292.js → cli-zy39d433.js} +2 -0
- package/dist/cli.js +26 -26
- 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-cgesnjkr.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-8kd7ddhr.js} +18 -18
- package/dist/{commands-mhxam6z2.js → commands-h6zaaxym.js} +9 -8
- package/dist/{cursor-adapter-2qda3st7.js → cursor-adapter-v8mm6bp5.js} +5 -5
- package/dist/{db-sjks418k.js → db-qg3myn53.js} +9 -8
- package/dist/{dispatcher-1es759rn.js → dispatcher-7vnwj9qw.js} +24 -24
- package/dist/{dsh-adapter-bek4cyw9.js → dsh-adapter-tz6hfp5r.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-jdt2dz2s.js} +18 -8
- package/dist/{handlers-1gkbhktr.js → handlers-2qtkpncr.js} +27 -27
- package/dist/{hook-ds2zxq9v.js → hook-51yfcgsv.js} +42 -31
- package/dist/{hook-vxa3tcsy.js → hook-qnbdgwvd.js} +14 -14
- package/dist/{http-3h21z9md.js → http-jsmtag08.js} +320 -98
- package/dist/{index-9b65j1m5.js → index-2t9kesn1.js} +9 -8
- package/dist/{index-dkfxpkmm.js → index-bt8wkv1w.js} +25 -25
- package/dist/{index-f8xnqrye.js → index-cx1sb9bq.js} +33 -24
- package/dist/{index-bn6cy8ps.js → index-ekywyv2v.js} +24 -24
- package/dist/{index-n99fycq7.js → index-t4g06w93.js} +24 -24
- package/dist/{keepalive-3xspa9jw.js → keepalive-4aezx4bj.js} +11 -10
- package/dist/{lead-6qphc124.js → lead-r44bkpm5.js} +47 -47
- package/dist/{llama-cpp-classify-tgj35k8d.js → llama-cpp-classify-6erb7wwv.js} +3 -1
- package/dist/{maintenance-0teem1bb.js → maintenance-grz5jrzh.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-wm4ctjfj.js} +10 -9
- package/dist/{onboard-54qmnqxe.js → onboard-v60zgqf0.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-ghh4dyf8.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-mjrqvnvw.js} +11 -10
- package/dist/{rbac-roles-j78wdksm.js → rbac-roles-axv4d74x.js} +10 -9
- package/dist/{rbac-roles-9pjphh9q.js → rbac-roles-fd5tskj9.js} +9 -8
- package/dist/{render-v2-pxjs49fx.js → render-v2-k50j33qd.js} +10 -9
- package/dist/{runtime-v2t1r79e.js → runtime-h9ha1mq6.js} +4 -4
- package/dist/{setup-ymej0xtx.js → setup-4syh0pd2.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-jcdbg8rr.js} +27 -27
- package/dist/{worker-qa9fkz5s.js → worker-x8j8c9sx.js} +47 -47
- package/openapi.json +1 -1
- package/package.json +8 -8
- 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/seed-pricing.ts +84 -53
- package/src/be/swarm-config-guard.ts +13 -0
- package/src/commands/provider-credentials.ts +28 -5
- package/src/commands/runner.ts +7 -12
- 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/providers/acp-targets.ts +9 -4
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +26 -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 +10 -1
- 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/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-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/context-window.test.ts +2 -2
- package/src/tests/credential-check.test.ts +51 -1
- package/src/tests/dsh-adapter.test.ts +23 -1
- package/src/tests/enabled-tools.test.ts +269 -0
- package/src/tests/entrypoint-codex-oauth-seed.test.ts +12 -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/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/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/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/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
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
} from "./cli-2pdaysab.js";
|
|
24
24
|
import {
|
|
25
25
|
reasoningCapability
|
|
26
|
-
} from "./cli-
|
|
26
|
+
} from "./cli-tmhsxhb8.js";
|
|
27
27
|
import {
|
|
28
28
|
ensureAgentFsCredentialsForAgent,
|
|
29
29
|
inviteEmailToSharedOrg
|
|
30
|
-
} from "./cli-
|
|
30
|
+
} from "./cli-c2tpw9ck.js";
|
|
31
31
|
import {
|
|
32
32
|
DEFAULT_CONNECTOR_CODE_LABEL,
|
|
33
33
|
checkHeartbeatChecklist,
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
exchangeConnectorCode,
|
|
36
36
|
runHeartbeatSweep,
|
|
37
37
|
stopHeartbeat
|
|
38
|
-
} from "./cli-
|
|
38
|
+
} from "./cli-qzmzwegq.js";
|
|
39
39
|
import {
|
|
40
40
|
Anthropic
|
|
41
|
-
} from "./cli-
|
|
41
|
+
} from "./cli-5qkcdv8c.js";
|
|
42
42
|
import {
|
|
43
43
|
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
44
44
|
ALL_CAPABILITIES,
|
|
@@ -335,7 +335,7 @@ import {
|
|
|
335
335
|
workflowModelErrors,
|
|
336
336
|
workflowSaveWarnings,
|
|
337
337
|
writeUnhandledError
|
|
338
|
-
} from "./cli-
|
|
338
|
+
} from "./cli-wydz3feg.js";
|
|
339
339
|
import"./cli-xvc3q9br.js";
|
|
340
340
|
import {
|
|
341
341
|
AMP_ESTIMATE_MODELS,
|
|
@@ -350,16 +350,16 @@ import {
|
|
|
350
350
|
import {
|
|
351
351
|
isMultiRuntimeEnabled
|
|
352
352
|
} from "./cli-re8z5p8p.js";
|
|
353
|
-
import"./cli-
|
|
353
|
+
import"./cli-tx2zvn23.js";
|
|
354
354
|
import {
|
|
355
355
|
deleteModelCatalogOverlay,
|
|
356
356
|
loadModelsCatalog,
|
|
357
357
|
requestModelCatalogRefresh,
|
|
358
358
|
upsertModelCatalogOverlay
|
|
359
|
-
} from "./cli-
|
|
359
|
+
} from "./cli-p8rt8spp.js";
|
|
360
360
|
import {
|
|
361
361
|
normalizeModelKey
|
|
362
|
-
} from "./cli-
|
|
362
|
+
} from "./cli-v1pwxreq.js";
|
|
363
363
|
import {
|
|
364
364
|
ConnectionAuthInputSchema,
|
|
365
365
|
MAX_SCRIPT_WALL_CLOCK_MS,
|
|
@@ -436,19 +436,12 @@ import {
|
|
|
436
436
|
upsertMcpOAuthToken,
|
|
437
437
|
upsertScriptConnection,
|
|
438
438
|
validateDefinition
|
|
439
|
-
} from "./cli-
|
|
439
|
+
} from "./cli-577bxkf6.js";
|
|
440
440
|
import"./cli-epan13p1.js";
|
|
441
441
|
import {
|
|
442
442
|
getApiKey
|
|
443
443
|
} from "./cli-f14fvzag.js";
|
|
444
|
-
import
|
|
445
|
-
detachedProcessGroup,
|
|
446
|
-
forceTerminateProcessGroup,
|
|
447
|
-
registerProcessGroup,
|
|
448
|
-
signalProcessGroup,
|
|
449
|
-
terminateProcessGroup
|
|
450
|
-
} from "./cli-zt3w1cn1.js";
|
|
451
|
-
import"./cli-f2n17zhp.js";
|
|
444
|
+
import"./cli-7mhy3ths.js";
|
|
452
445
|
import {
|
|
453
446
|
CLIENT_ID,
|
|
454
447
|
MAX_CODEX_OAUTH_SLOT,
|
|
@@ -459,11 +452,24 @@ import {
|
|
|
459
452
|
getAccountId,
|
|
460
453
|
getValidCodexOAuth,
|
|
461
454
|
loadAllCodexOAuthSlots
|
|
462
|
-
} from "./cli-
|
|
463
|
-
import
|
|
464
|
-
|
|
465
|
-
|
|
455
|
+
} from "./cli-v1w7pbd8.js";
|
|
456
|
+
import {
|
|
457
|
+
detachedProcessGroup,
|
|
458
|
+
forceTerminateProcessGroup,
|
|
459
|
+
registerProcessGroup,
|
|
460
|
+
signalProcessGroup,
|
|
461
|
+
terminateProcessGroup
|
|
462
|
+
} from "./cli-zt3w1cn1.js";
|
|
463
|
+
import"./cli-km4x66j0.js";
|
|
466
464
|
import"./cli-rb9m6rpe.js";
|
|
465
|
+
import"./cli-2x0e561b.js";
|
|
466
|
+
import {
|
|
467
|
+
buildAuthorizationUrl,
|
|
468
|
+
exchangeAuthorizationCode,
|
|
469
|
+
forceRefreshAuthorizationOrThrow,
|
|
470
|
+
forceRefreshTokenOrThrow,
|
|
471
|
+
oauthAppRowToProviderConfig
|
|
472
|
+
} from "./cli-kw0jcfje.js";
|
|
467
473
|
import {
|
|
468
474
|
AgentFsProvider,
|
|
469
475
|
FilesError,
|
|
@@ -471,13 +477,6 @@ import {
|
|
|
471
477
|
getFileStorageProvider,
|
|
472
478
|
normalizeFilesError
|
|
473
479
|
} from "./cli-mzfth0bp.js";
|
|
474
|
-
import {
|
|
475
|
-
buildAuthorizationUrl,
|
|
476
|
-
exchangeAuthorizationCode,
|
|
477
|
-
forceRefreshAuthorizationOrThrow,
|
|
478
|
-
forceRefreshTokenOrThrow,
|
|
479
|
-
oauthAppRowToProviderConfig
|
|
480
|
-
} from "./cli-j2jbr8af.js";
|
|
481
480
|
import"./cli-fad8m16k.js";
|
|
482
481
|
import"./cli-bsakbbkm.js";
|
|
483
482
|
import"./cli-zxg80zs9.js";
|
|
@@ -496,33 +495,34 @@ import {
|
|
|
496
495
|
recordDbRetentionStatement,
|
|
497
496
|
recordDbRetentionSweep,
|
|
498
497
|
recordSessionCost,
|
|
498
|
+
require_content_type,
|
|
499
499
|
startSlackApp,
|
|
500
500
|
startSpan,
|
|
501
501
|
stopSlackApp,
|
|
502
502
|
withRemoteContext,
|
|
503
503
|
withSpan,
|
|
504
504
|
withSpanContext
|
|
505
|
-
} from "./cli-
|
|
505
|
+
} from "./cli-c8r99akr.js";
|
|
506
506
|
import"./cli-q51yprfq.js";
|
|
507
507
|
import"./cli-3er6gcsn.js";
|
|
508
508
|
import"./cli-yatxqynm.js";
|
|
509
509
|
import {
|
|
510
510
|
bedrockProviderModule
|
|
511
|
-
} from "./cli-
|
|
511
|
+
} from "./cli-cmxkbzzs.js";
|
|
512
512
|
import"./cli-yn0a417a.js";
|
|
513
513
|
import"./cli-cgj4hc12.js";
|
|
514
514
|
import"./cli-txgcknmy.js";
|
|
515
515
|
import"./cli-6map995v.js";
|
|
516
|
-
import"./cli-
|
|
516
|
+
import"./cli-xf713zz0.js";
|
|
517
517
|
import"./cli-y2apkfe2.js";
|
|
518
518
|
import"./cli-7kyk9jr3.js";
|
|
519
519
|
import {
|
|
520
520
|
setBedrockProviderModule
|
|
521
|
-
} from "./cli-
|
|
522
|
-
import"./cli-
|
|
521
|
+
} from "./cli-mn8qkd8v.js";
|
|
522
|
+
import"./cli-g7k7zbcz.js";
|
|
523
523
|
import"./cli-btbzvq95.js";
|
|
524
524
|
import"./cli-1m2e086m.js";
|
|
525
|
-
import"./cli-
|
|
525
|
+
import"./cli-wnb9b2g3.js";
|
|
526
526
|
import"./cli-bd957dgb.js";
|
|
527
527
|
import {
|
|
528
528
|
import_websocket,
|
|
@@ -532,7 +532,7 @@ import"./cli-pzxba7gw.js";
|
|
|
532
532
|
import {
|
|
533
533
|
getUserGrant,
|
|
534
534
|
init_rbac_roles
|
|
535
|
-
} from "./cli-
|
|
535
|
+
} from "./cli-ypgba1a8.js";
|
|
536
536
|
import {
|
|
537
537
|
LEGACY_RULES,
|
|
538
538
|
can,
|
|
@@ -925,7 +925,8 @@ import {
|
|
|
925
925
|
upsertSwarmConfig,
|
|
926
926
|
validateConfigValue,
|
|
927
927
|
withFavoriteFlags
|
|
928
|
-
} from "./cli-
|
|
928
|
+
} from "./cli-mkdsy1nq.js";
|
|
929
|
+
import"./cli-3qhyh31j.js";
|
|
929
930
|
import {
|
|
930
931
|
ActiveSessionSchema,
|
|
931
932
|
AgentAcpStatusSchema,
|
|
@@ -1053,12 +1054,11 @@ import {
|
|
|
1053
1054
|
isTerminalTaskStatus,
|
|
1054
1055
|
splitLegacyModelAlias
|
|
1055
1056
|
} from "./cli-xvdgasgy.js";
|
|
1056
|
-
import"./cli-3qhyh31j.js";
|
|
1057
1057
|
import {
|
|
1058
1058
|
IDENTITY_FIELD_BUDGETS,
|
|
1059
1059
|
IdentityFieldBudgetError,
|
|
1060
1060
|
init_identity_field_budget
|
|
1061
|
-
} from "./cli-
|
|
1061
|
+
} from "./cli-mxvnnv5q.js";
|
|
1062
1062
|
import {
|
|
1063
1063
|
init_steering_enabled,
|
|
1064
1064
|
isSteeringEnabled
|
|
@@ -1068,21 +1068,6 @@ import {
|
|
|
1068
1068
|
getSlackConfiguration,
|
|
1069
1069
|
init_config
|
|
1070
1070
|
} from "./cli-dmtrxqhg.js";
|
|
1071
|
-
import"./cli-tadfgd0t.js";
|
|
1072
|
-
import {
|
|
1073
|
-
MODEL_SCOPED_WINDOWS,
|
|
1074
|
-
activeModelBlocks,
|
|
1075
|
-
init_model_rate_limit_windows
|
|
1076
|
-
} from "./cli-ywybs5as.js";
|
|
1077
|
-
import {
|
|
1078
|
-
MAX_PROFILE_FILE_LENGTH,
|
|
1079
|
-
agentFsFileRoute,
|
|
1080
|
-
getAppUrl,
|
|
1081
|
-
getConfiguredAppUrls,
|
|
1082
|
-
getMcpBaseUrl,
|
|
1083
|
-
getPublicMcpBaseUrl,
|
|
1084
|
-
init_constants
|
|
1085
|
-
} from "./cli-gd4favx9.js";
|
|
1086
1071
|
import"./cli-agamgm0p.js";
|
|
1087
1072
|
import {
|
|
1088
1073
|
getAllTemplateDefinitions,
|
|
@@ -1099,7 +1084,26 @@ import {
|
|
|
1099
1084
|
init_subscription_plans,
|
|
1100
1085
|
isSubscriptionPlanId
|
|
1101
1086
|
} from "./cli-1a2j50m0.js";
|
|
1087
|
+
import"./cli-tadfgd0t.js";
|
|
1088
|
+
import {
|
|
1089
|
+
MODEL_SCOPED_WINDOWS,
|
|
1090
|
+
activeModelBlocks,
|
|
1091
|
+
init_model_rate_limit_windows
|
|
1092
|
+
} from "./cli-ywybs5as.js";
|
|
1102
1093
|
import"./cli-f9w1semm.js";
|
|
1094
|
+
import {
|
|
1095
|
+
getOpenRouterAttributionHeaders,
|
|
1096
|
+
init_openrouter_base_url
|
|
1097
|
+
} from "./cli-a35hzdve.js";
|
|
1098
|
+
import {
|
|
1099
|
+
MAX_PROFILE_FILE_LENGTH,
|
|
1100
|
+
agentFsFileRoute,
|
|
1101
|
+
getAppUrl,
|
|
1102
|
+
getConfiguredAppUrls,
|
|
1103
|
+
getMcpBaseUrl,
|
|
1104
|
+
getPublicMcpBaseUrl,
|
|
1105
|
+
init_constants
|
|
1106
|
+
} from "./cli-gd4favx9.js";
|
|
1103
1107
|
import {
|
|
1104
1108
|
init_env_flag,
|
|
1105
1109
|
isEnvFlagEnabled,
|
|
@@ -1108,7 +1112,7 @@ import {
|
|
|
1108
1112
|
import {
|
|
1109
1113
|
init_src,
|
|
1110
1114
|
isAlias
|
|
1111
|
-
} from "./cli-
|
|
1115
|
+
} from "./cli-014vns2y.js";
|
|
1112
1116
|
import {
|
|
1113
1117
|
exports_zod,
|
|
1114
1118
|
init_zod
|
|
@@ -1125,7 +1129,7 @@ import {
|
|
|
1125
1129
|
import {
|
|
1126
1130
|
init_package,
|
|
1127
1131
|
package_default
|
|
1128
|
-
} from "./cli-
|
|
1132
|
+
} from "./cli-ymmc1zxg.js";
|
|
1129
1133
|
import {
|
|
1130
1134
|
init_event_bus,
|
|
1131
1135
|
workflowEventBus
|
|
@@ -12959,6 +12963,85 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
12959
12963
|
};
|
|
12960
12964
|
};
|
|
12961
12965
|
|
|
12966
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
|
|
12967
|
+
var import_content_type = __toESM(require_content_type(), 1);
|
|
12968
|
+
function mediaTypeEssence(header2) {
|
|
12969
|
+
if (!header2) {
|
|
12970
|
+
return;
|
|
12971
|
+
}
|
|
12972
|
+
try {
|
|
12973
|
+
return import_content_type.default.parse(header2).type;
|
|
12974
|
+
} catch {
|
|
12975
|
+
const essence = (header2.split(";", 1)[0] ?? "").trim().toLowerCase();
|
|
12976
|
+
if (essence === "" || header2.slice(essence.length).includes(",")) {
|
|
12977
|
+
return;
|
|
12978
|
+
}
|
|
12979
|
+
return essence;
|
|
12980
|
+
}
|
|
12981
|
+
}
|
|
12982
|
+
function isJsonContentType(header2) {
|
|
12983
|
+
if (header2 === "application/json") {
|
|
12984
|
+
return true;
|
|
12985
|
+
}
|
|
12986
|
+
return mediaTypeEssence(header2) === "application/json";
|
|
12987
|
+
}
|
|
12988
|
+
|
|
12989
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.js
|
|
12990
|
+
var DEFAULT_MAX_REQUEST_BODY_SIZE = 4 * 1024 * 1024;
|
|
12991
|
+
var MAX_BATCH_SIZE2 = 100;
|
|
12992
|
+
function requestBodyTooLargeMessage(maxBytes) {
|
|
12993
|
+
return `Payload Too Large: Request body must not exceed ${maxBytes} bytes`;
|
|
12994
|
+
}
|
|
12995
|
+
function resolveMaxRequestBodySize(value) {
|
|
12996
|
+
if (value === undefined) {
|
|
12997
|
+
return DEFAULT_MAX_REQUEST_BODY_SIZE;
|
|
12998
|
+
}
|
|
12999
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
13000
|
+
throw new RangeError(`maxRequestBodySize must be a positive number of bytes, got ${String(value)}`);
|
|
13001
|
+
}
|
|
13002
|
+
return value;
|
|
13003
|
+
}
|
|
13004
|
+
async function readRequestBody(request, maxBytes = DEFAULT_MAX_REQUEST_BODY_SIZE) {
|
|
13005
|
+
if (Number(request.headers.get("content-length")) > maxBytes) {
|
|
13006
|
+
return { tooLarge: true };
|
|
13007
|
+
}
|
|
13008
|
+
if (request.body === null) {
|
|
13009
|
+
return { tooLarge: false, text: "" };
|
|
13010
|
+
}
|
|
13011
|
+
const reader = request.body.getReader();
|
|
13012
|
+
const decoder = new TextDecoder;
|
|
13013
|
+
let received = 0;
|
|
13014
|
+
let text = "";
|
|
13015
|
+
try {
|
|
13016
|
+
for (;; ) {
|
|
13017
|
+
const { done, value } = await reader.read();
|
|
13018
|
+
if (done) {
|
|
13019
|
+
break;
|
|
13020
|
+
}
|
|
13021
|
+
received += value.byteLength;
|
|
13022
|
+
if (received > maxBytes) {
|
|
13023
|
+
return { tooLarge: true };
|
|
13024
|
+
}
|
|
13025
|
+
text += decoder.decode(value, { stream: true });
|
|
13026
|
+
}
|
|
13027
|
+
} finally {
|
|
13028
|
+
reader.releaseLock();
|
|
13029
|
+
}
|
|
13030
|
+
return { tooLarge: false, text: text + decoder.decode() };
|
|
13031
|
+
}
|
|
13032
|
+
|
|
13033
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js
|
|
13034
|
+
var DEFAULT_SSE_KEEP_ALIVE_MS = 15000;
|
|
13035
|
+
var MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
|
|
13036
|
+
function armSseKeepAlive(intervalMs, onTick) {
|
|
13037
|
+
if (!Number.isFinite(intervalMs) || intervalMs < 1) {
|
|
13038
|
+
return;
|
|
13039
|
+
}
|
|
13040
|
+
const timer = setInterval(onTick, Math.min(intervalMs, MAX_TIMER_DELAY_MS));
|
|
13041
|
+
timer.unref?.();
|
|
13042
|
+
return timer;
|
|
13043
|
+
}
|
|
13044
|
+
|
|
12962
13045
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
|
|
12963
13046
|
class WebStandardStreamableHTTPServerTransport {
|
|
12964
13047
|
constructor(options = {}) {
|
|
@@ -12966,10 +13049,12 @@ class WebStandardStreamableHTTPServerTransport {
|
|
|
12966
13049
|
this._hasHandledRequest = false;
|
|
12967
13050
|
this._streamMapping = new Map;
|
|
12968
13051
|
this._requestToStreamMapping = new Map;
|
|
13052
|
+
this._resumableStreams = new Set;
|
|
12969
13053
|
this._requestResponseMap = new Map;
|
|
12970
13054
|
this._initialized = false;
|
|
12971
13055
|
this._enableJsonResponse = false;
|
|
12972
13056
|
this._standaloneSseStreamId = "_GET_stream";
|
|
13057
|
+
this._closed = false;
|
|
12973
13058
|
this.sessionIdGenerator = options.sessionIdGenerator;
|
|
12974
13059
|
this._enableJsonResponse = options.enableJsonResponse ?? false;
|
|
12975
13060
|
this._eventStore = options.eventStore;
|
|
@@ -12979,6 +13064,23 @@ class WebStandardStreamableHTTPServerTransport {
|
|
|
12979
13064
|
this._allowedOrigins = options.allowedOrigins;
|
|
12980
13065
|
this._enableDnsRebindingProtection = options.enableDnsRebindingProtection ?? false;
|
|
12981
13066
|
this._retryInterval = options.retryInterval;
|
|
13067
|
+
this._keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS;
|
|
13068
|
+
this._maxRequestBodySize = resolveMaxRequestBodySize(options.maxRequestBodySize);
|
|
13069
|
+
}
|
|
13070
|
+
startKeepAlive(controller, encoder) {
|
|
13071
|
+
if (this._closed)
|
|
13072
|
+
return;
|
|
13073
|
+
const timer = armSseKeepAlive(this._keepAliveMs, () => {
|
|
13074
|
+
try {
|
|
13075
|
+
controller.enqueue(encoder.encode(`: keepalive
|
|
13076
|
+
|
|
13077
|
+
`));
|
|
13078
|
+
} catch {
|
|
13079
|
+
if (timer !== undefined)
|
|
13080
|
+
clearInterval(timer);
|
|
13081
|
+
}
|
|
13082
|
+
});
|
|
13083
|
+
return timer;
|
|
12982
13084
|
}
|
|
12983
13085
|
async start() {
|
|
12984
13086
|
if (this._started) {
|
|
@@ -13026,6 +13128,9 @@ class WebStandardStreamableHTTPServerTransport {
|
|
|
13026
13128
|
return;
|
|
13027
13129
|
}
|
|
13028
13130
|
async handleRequest(req, options) {
|
|
13131
|
+
if (this._closed) {
|
|
13132
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
13133
|
+
}
|
|
13029
13134
|
if (!this.sessionIdGenerator && this._hasHandledRequest) {
|
|
13030
13135
|
throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");
|
|
13031
13136
|
}
|
|
@@ -13065,6 +13170,7 @@ data:
|
|
|
13065
13170
|
`;
|
|
13066
13171
|
}
|
|
13067
13172
|
controller.enqueue(encoder.encode(primingEvent));
|
|
13173
|
+
this._resumableStreams.add(streamId);
|
|
13068
13174
|
}
|
|
13069
13175
|
async handleGetRequest(req) {
|
|
13070
13176
|
const acceptHeader = req.headers.get("accept");
|
|
@@ -13092,18 +13198,25 @@ data:
|
|
|
13092
13198
|
}
|
|
13093
13199
|
const encoder = new TextEncoder;
|
|
13094
13200
|
let streamController;
|
|
13201
|
+
let keepAliveTimer = undefined;
|
|
13095
13202
|
const readable = new ReadableStream({
|
|
13096
13203
|
start: (controller) => {
|
|
13097
13204
|
streamController = controller;
|
|
13098
13205
|
},
|
|
13099
13206
|
cancel: () => {
|
|
13100
|
-
|
|
13207
|
+
if (keepAliveTimer !== undefined) {
|
|
13208
|
+
clearInterval(keepAliveTimer);
|
|
13209
|
+
}
|
|
13210
|
+
if (this._streamMapping.get(this._standaloneSseStreamId)?.controller === streamController) {
|
|
13211
|
+
this._streamMapping.delete(this._standaloneSseStreamId);
|
|
13212
|
+
}
|
|
13101
13213
|
}
|
|
13102
13214
|
});
|
|
13103
13215
|
const headers2 = {
|
|
13104
13216
|
"Content-Type": "text/event-stream",
|
|
13105
13217
|
"Cache-Control": "no-cache, no-transform",
|
|
13106
|
-
Connection: "keep-alive"
|
|
13218
|
+
Connection: "keep-alive",
|
|
13219
|
+
"X-Accel-Buffering": "no"
|
|
13107
13220
|
};
|
|
13108
13221
|
if (this.sessionId !== undefined) {
|
|
13109
13222
|
headers2["mcp-session-id"] = this.sessionId;
|
|
@@ -13112,12 +13225,16 @@ data:
|
|
|
13112
13225
|
controller: streamController,
|
|
13113
13226
|
encoder,
|
|
13114
13227
|
cleanup: () => {
|
|
13228
|
+
if (keepAliveTimer !== undefined) {
|
|
13229
|
+
clearInterval(keepAliveTimer);
|
|
13230
|
+
}
|
|
13115
13231
|
this._streamMapping.delete(this._standaloneSseStreamId);
|
|
13116
13232
|
try {
|
|
13117
13233
|
streamController.close();
|
|
13118
13234
|
} catch {}
|
|
13119
13235
|
}
|
|
13120
13236
|
});
|
|
13237
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
13121
13238
|
return new Response(readable, { headers: headers2 });
|
|
13122
13239
|
}
|
|
13123
13240
|
async replayEvents(lastEventId) {
|
|
@@ -13141,20 +13258,33 @@ data:
|
|
|
13141
13258
|
const headers2 = {
|
|
13142
13259
|
"Content-Type": "text/event-stream",
|
|
13143
13260
|
"Cache-Control": "no-cache, no-transform",
|
|
13144
|
-
Connection: "keep-alive"
|
|
13261
|
+
Connection: "keep-alive",
|
|
13262
|
+
"X-Accel-Buffering": "no"
|
|
13145
13263
|
};
|
|
13146
13264
|
if (this.sessionId !== undefined) {
|
|
13147
13265
|
headers2["mcp-session-id"] = this.sessionId;
|
|
13148
13266
|
}
|
|
13149
13267
|
const encoder = new TextEncoder;
|
|
13150
13268
|
let streamController;
|
|
13269
|
+
let keepAliveTimer = undefined;
|
|
13270
|
+
let replayedStreamId = undefined;
|
|
13271
|
+
let cancelled = false;
|
|
13151
13272
|
const readable = new ReadableStream({
|
|
13152
13273
|
start: (controller) => {
|
|
13153
13274
|
streamController = controller;
|
|
13154
13275
|
},
|
|
13155
|
-
cancel: () => {
|
|
13276
|
+
cancel: () => {
|
|
13277
|
+
cancelled = true;
|
|
13278
|
+
if (keepAliveTimer !== undefined) {
|
|
13279
|
+
clearInterval(keepAliveTimer);
|
|
13280
|
+
}
|
|
13281
|
+
if (replayedStreamId !== undefined && this._streamMapping.get(replayedStreamId)?.controller === streamController) {
|
|
13282
|
+
this._streamMapping.delete(replayedStreamId);
|
|
13283
|
+
}
|
|
13284
|
+
}
|
|
13156
13285
|
});
|
|
13157
|
-
const
|
|
13286
|
+
const replayedEventIds = new Set;
|
|
13287
|
+
replayedStreamId = await this._eventStore.replayEventsAfter(lastEventId, {
|
|
13158
13288
|
send: async (eventId, message) => {
|
|
13159
13289
|
const success = this.writeSSEEvent(streamController, encoder, message, eventId);
|
|
13160
13290
|
if (!success) {
|
|
@@ -13162,19 +13292,34 @@ data:
|
|
|
13162
13292
|
try {
|
|
13163
13293
|
streamController.close();
|
|
13164
13294
|
} catch {}
|
|
13295
|
+
} else {
|
|
13296
|
+
replayedEventIds.add(eventId);
|
|
13165
13297
|
}
|
|
13166
13298
|
}
|
|
13167
13299
|
});
|
|
13300
|
+
if (this._closed || cancelled) {
|
|
13301
|
+
try {
|
|
13302
|
+
streamController.close();
|
|
13303
|
+
} catch {}
|
|
13304
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
13305
|
+
}
|
|
13306
|
+
this._streamMapping.get(replayedStreamId)?.cleanup();
|
|
13168
13307
|
this._streamMapping.set(replayedStreamId, {
|
|
13169
13308
|
controller: streamController,
|
|
13170
13309
|
encoder,
|
|
13310
|
+
replayedEventIds,
|
|
13171
13311
|
cleanup: () => {
|
|
13312
|
+
if (keepAliveTimer !== undefined) {
|
|
13313
|
+
clearInterval(keepAliveTimer);
|
|
13314
|
+
}
|
|
13172
13315
|
this._streamMapping.delete(replayedStreamId);
|
|
13173
13316
|
try {
|
|
13174
13317
|
streamController.close();
|
|
13175
13318
|
} catch {}
|
|
13176
13319
|
}
|
|
13177
13320
|
});
|
|
13321
|
+
this._resumableStreams.add(replayedStreamId);
|
|
13322
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
13178
13323
|
return new Response(readable, { headers: headers2 });
|
|
13179
13324
|
} catch (error) {
|
|
13180
13325
|
this.onerror?.(error);
|
|
@@ -13224,7 +13369,7 @@ data:
|
|
|
13224
13369
|
return this.createJsonErrorResponse(406, -32000, "Not Acceptable: Client must accept both application/json and text/event-stream");
|
|
13225
13370
|
}
|
|
13226
13371
|
const ct = req.headers.get("content-type");
|
|
13227
|
-
if (!ct
|
|
13372
|
+
if (!isJsonContentType(ct)) {
|
|
13228
13373
|
this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json"));
|
|
13229
13374
|
return this.createJsonErrorResponse(415, -32000, "Unsupported Media Type: Content-Type must be application/json");
|
|
13230
13375
|
}
|
|
@@ -13237,12 +13382,22 @@ data:
|
|
|
13237
13382
|
rawMessage = options.parsedBody;
|
|
13238
13383
|
} else {
|
|
13239
13384
|
try {
|
|
13240
|
-
|
|
13385
|
+
const body = await readRequestBody(req, this._maxRequestBodySize);
|
|
13386
|
+
if (body.tooLarge) {
|
|
13387
|
+
const message = requestBodyTooLargeMessage(this._maxRequestBodySize);
|
|
13388
|
+
this.onerror?.(new Error(message));
|
|
13389
|
+
return this.createJsonErrorResponse(413, -32000, message);
|
|
13390
|
+
}
|
|
13391
|
+
rawMessage = JSON.parse(body.text);
|
|
13241
13392
|
} catch {
|
|
13242
13393
|
this.onerror?.(new Error("Parse error: Invalid JSON"));
|
|
13243
13394
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON");
|
|
13244
13395
|
}
|
|
13245
13396
|
}
|
|
13397
|
+
if (Array.isArray(rawMessage) && rawMessage.length > MAX_BATCH_SIZE2) {
|
|
13398
|
+
this.onerror?.(new Error(`Invalid Request: Batch must not exceed ${MAX_BATCH_SIZE2} messages`));
|
|
13399
|
+
return this.createJsonErrorResponse(400, -32600, `Invalid Request: Batch must not exceed ${MAX_BATCH_SIZE2} messages`);
|
|
13400
|
+
}
|
|
13246
13401
|
let messages;
|
|
13247
13402
|
try {
|
|
13248
13403
|
if (Array.isArray(rawMessage)) {
|
|
@@ -13254,6 +13409,9 @@ data:
|
|
|
13254
13409
|
this.onerror?.(new Error("Parse error: Invalid JSON-RPC message"));
|
|
13255
13410
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON-RPC message");
|
|
13256
13411
|
}
|
|
13412
|
+
if (this._closed) {
|
|
13413
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
13414
|
+
}
|
|
13257
13415
|
const isInitializationRequest = messages.some(isInitializeRequest);
|
|
13258
13416
|
if (isInitializationRequest) {
|
|
13259
13417
|
if (this._initialized && this.sessionId !== undefined) {
|
|
@@ -13280,6 +13438,9 @@ data:
|
|
|
13280
13438
|
return protocolError2;
|
|
13281
13439
|
}
|
|
13282
13440
|
}
|
|
13441
|
+
if (this._closed) {
|
|
13442
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
13443
|
+
}
|
|
13283
13444
|
const hasRequests = messages.some(isJSONRPCRequest);
|
|
13284
13445
|
if (!hasRequests) {
|
|
13285
13446
|
for (const message of messages) {
|
|
@@ -13310,18 +13471,25 @@ data:
|
|
|
13310
13471
|
}
|
|
13311
13472
|
const encoder = new TextEncoder;
|
|
13312
13473
|
let streamController;
|
|
13474
|
+
let keepAliveTimer = undefined;
|
|
13313
13475
|
const readable = new ReadableStream({
|
|
13314
13476
|
start: (controller) => {
|
|
13315
13477
|
streamController = controller;
|
|
13316
13478
|
},
|
|
13317
13479
|
cancel: () => {
|
|
13318
|
-
|
|
13480
|
+
if (keepAliveTimer !== undefined) {
|
|
13481
|
+
clearInterval(keepAliveTimer);
|
|
13482
|
+
}
|
|
13483
|
+
if (this._streamMapping.get(streamId)?.controller === streamController) {
|
|
13484
|
+
this._streamMapping.delete(streamId);
|
|
13485
|
+
}
|
|
13319
13486
|
}
|
|
13320
13487
|
});
|
|
13321
13488
|
const headers2 = {
|
|
13322
13489
|
"Content-Type": "text/event-stream",
|
|
13323
|
-
"Cache-Control": "no-cache",
|
|
13324
|
-
Connection: "keep-alive"
|
|
13490
|
+
"Cache-Control": "no-cache, no-transform",
|
|
13491
|
+
Connection: "keep-alive",
|
|
13492
|
+
"X-Accel-Buffering": "no"
|
|
13325
13493
|
};
|
|
13326
13494
|
if (this.sessionId !== undefined) {
|
|
13327
13495
|
headers2["mcp-session-id"] = this.sessionId;
|
|
@@ -13332,6 +13500,9 @@ data:
|
|
|
13332
13500
|
controller: streamController,
|
|
13333
13501
|
encoder,
|
|
13334
13502
|
cleanup: () => {
|
|
13503
|
+
if (keepAliveTimer !== undefined) {
|
|
13504
|
+
clearInterval(keepAliveTimer);
|
|
13505
|
+
}
|
|
13335
13506
|
this._streamMapping.delete(streamId);
|
|
13336
13507
|
try {
|
|
13337
13508
|
streamController.close();
|
|
@@ -13341,19 +13512,33 @@ data:
|
|
|
13341
13512
|
this._requestToStreamMapping.set(message.id, streamId);
|
|
13342
13513
|
}
|
|
13343
13514
|
}
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13515
|
+
try {
|
|
13516
|
+
await this.writePrimingEvent(streamController, encoder, streamId, clientProtocolVersion);
|
|
13517
|
+
for (const message of messages) {
|
|
13518
|
+
let closeSSEStream;
|
|
13519
|
+
let closeStandaloneSSEStream;
|
|
13520
|
+
if (isJSONRPCRequest(message) && this._eventStore && clientProtocolVersion >= "2025-11-25") {
|
|
13521
|
+
closeSSEStream = () => {
|
|
13522
|
+
this.closeSSEStream(message.id);
|
|
13523
|
+
};
|
|
13524
|
+
closeStandaloneSSEStream = () => {
|
|
13525
|
+
this.closeStandaloneSSEStream();
|
|
13526
|
+
};
|
|
13527
|
+
}
|
|
13528
|
+
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo, closeSSEStream, closeStandaloneSSEStream });
|
|
13355
13529
|
}
|
|
13356
|
-
|
|
13530
|
+
} catch (error) {
|
|
13531
|
+
this._streamMapping.get(streamId)?.cleanup();
|
|
13532
|
+
this._resumableStreams.delete(streamId);
|
|
13533
|
+
for (const message of messages) {
|
|
13534
|
+
if (isJSONRPCRequest(message)) {
|
|
13535
|
+
this._requestToStreamMapping.delete(message.id);
|
|
13536
|
+
}
|
|
13537
|
+
}
|
|
13538
|
+
throw error;
|
|
13539
|
+
}
|
|
13540
|
+
if (this._streamMapping.get(streamId)?.controller === streamController) {
|
|
13541
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
13357
13542
|
}
|
|
13358
13543
|
return new Response(readable, { status: 200, headers: headers2 });
|
|
13359
13544
|
} catch (error) {
|
|
@@ -13370,9 +13555,12 @@ data:
|
|
|
13370
13555
|
if (protocolError2) {
|
|
13371
13556
|
return protocolError2;
|
|
13372
13557
|
}
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13558
|
+
try {
|
|
13559
|
+
await Promise.resolve(this._onsessionclosed?.(this.sessionId));
|
|
13560
|
+
return new Response(null, { status: 200 });
|
|
13561
|
+
} finally {
|
|
13562
|
+
await this.close();
|
|
13563
|
+
}
|
|
13376
13564
|
}
|
|
13377
13565
|
validateSession(req) {
|
|
13378
13566
|
if (this.sessionIdGenerator === undefined) {
|
|
@@ -13402,11 +13590,16 @@ data:
|
|
|
13402
13590
|
return;
|
|
13403
13591
|
}
|
|
13404
13592
|
async close() {
|
|
13593
|
+
if (this._closed) {
|
|
13594
|
+
return;
|
|
13595
|
+
}
|
|
13596
|
+
this._closed = true;
|
|
13405
13597
|
this._streamMapping.forEach(({ cleanup }) => {
|
|
13406
13598
|
cleanup();
|
|
13407
13599
|
});
|
|
13408
13600
|
this._streamMapping.clear();
|
|
13409
13601
|
this._requestResponseMap.clear();
|
|
13602
|
+
this._resumableStreams.clear();
|
|
13410
13603
|
this.onclose?.();
|
|
13411
13604
|
}
|
|
13412
13605
|
closeSSEStream(requestId) {
|
|
@@ -13441,7 +13634,7 @@ data:
|
|
|
13441
13634
|
if (standaloneSse === undefined) {
|
|
13442
13635
|
return;
|
|
13443
13636
|
}
|
|
13444
|
-
if (standaloneSse.controller && standaloneSse.encoder) {
|
|
13637
|
+
if (standaloneSse.controller && standaloneSse.encoder && (eventId === undefined || !standaloneSse.replayedEventIds?.has(eventId))) {
|
|
13445
13638
|
this.writeSSEEvent(standaloneSse.controller, standaloneSse.encoder, message, eventId);
|
|
13446
13639
|
}
|
|
13447
13640
|
return;
|
|
@@ -13450,13 +13643,19 @@ data:
|
|
|
13450
13643
|
if (!streamId) {
|
|
13451
13644
|
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
|
13452
13645
|
}
|
|
13453
|
-
|
|
13454
|
-
if (!this._enableJsonResponse
|
|
13646
|
+
let stream = this._streamMapping.get(streamId);
|
|
13647
|
+
if (!this._enableJsonResponse) {
|
|
13455
13648
|
let eventId;
|
|
13456
13649
|
if (this._eventStore) {
|
|
13457
13650
|
eventId = await this._eventStore.storeEvent(streamId, message);
|
|
13651
|
+
stream = this._streamMapping.get(streamId);
|
|
13652
|
+
}
|
|
13653
|
+
if (stream?.controller && stream?.encoder && (eventId === undefined || !stream.replayedEventIds?.has(eventId))) {
|
|
13654
|
+
const written = this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
|
13655
|
+
if (written && eventId !== undefined) {
|
|
13656
|
+
this._resumableStreams.add(streamId);
|
|
13657
|
+
}
|
|
13458
13658
|
}
|
|
13459
|
-
this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
|
13460
13659
|
}
|
|
13461
13660
|
if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {
|
|
13462
13661
|
this._requestResponseMap.set(requestId, message);
|
|
@@ -13464,6 +13663,25 @@ data:
|
|
|
13464
13663
|
const allResponsesReady = relatedIds.every((id) => this._requestResponseMap.has(id));
|
|
13465
13664
|
if (allResponsesReady) {
|
|
13466
13665
|
if (!stream) {
|
|
13666
|
+
if (this._closed) {
|
|
13667
|
+
for (const id of relatedIds) {
|
|
13668
|
+
this._requestResponseMap.delete(id);
|
|
13669
|
+
this._requestToStreamMapping.delete(id);
|
|
13670
|
+
}
|
|
13671
|
+
return;
|
|
13672
|
+
}
|
|
13673
|
+
if (!this._enableJsonResponse && this._eventStore && this._resumableStreams.has(streamId)) {
|
|
13674
|
+
for (const id of relatedIds) {
|
|
13675
|
+
this._requestResponseMap.delete(id);
|
|
13676
|
+
this._requestToStreamMapping.delete(id);
|
|
13677
|
+
}
|
|
13678
|
+
this._resumableStreams.delete(streamId);
|
|
13679
|
+
return;
|
|
13680
|
+
}
|
|
13681
|
+
for (const id of relatedIds) {
|
|
13682
|
+
this._requestResponseMap.delete(id);
|
|
13683
|
+
this._requestToStreamMapping.delete(id);
|
|
13684
|
+
}
|
|
13467
13685
|
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
|
13468
13686
|
}
|
|
13469
13687
|
if (this._enableJsonResponse && stream.resolveJson) {
|
|
@@ -13486,6 +13704,7 @@ data:
|
|
|
13486
13704
|
this._requestResponseMap.delete(id);
|
|
13487
13705
|
this._requestToStreamMapping.delete(id);
|
|
13488
13706
|
}
|
|
13707
|
+
this._resumableStreams.delete(streamId);
|
|
13489
13708
|
}
|
|
13490
13709
|
}
|
|
13491
13710
|
}
|
|
@@ -13720,6 +13939,7 @@ async function handleMcp(req, res, transports, sessionActivity = {}, sessionAgen
|
|
|
13720
13939
|
}
|
|
13721
13940
|
const server = await createServer({
|
|
13722
13941
|
preloadedTools,
|
|
13942
|
+
enabledTools: configs.find((config) => config.key === "SWARM_ENABLED_TOOLS")?.value ?? process.env.SWARM_ENABLED_TOOLS,
|
|
13723
13943
|
scriptsOnly: resolveScriptsOnlyMode({
|
|
13724
13944
|
env: process.env.SCRIPTS_ONLY_MCP,
|
|
13725
13945
|
configValue
|
|
@@ -17984,6 +18204,7 @@ init_db2();
|
|
|
17984
18204
|
init_memory();
|
|
17985
18205
|
init_constants2();
|
|
17986
18206
|
init_types();
|
|
18207
|
+
init_openrouter_base_url();
|
|
17987
18208
|
|
|
17988
18209
|
// src/http/status.ts
|
|
17989
18210
|
init_zod();
|
|
@@ -18707,6 +18928,7 @@ async function handleMemoryProbe(body) {
|
|
|
18707
18928
|
const client = new OpenAI({
|
|
18708
18929
|
baseURL: endpoint.toString(),
|
|
18709
18930
|
apiKey,
|
|
18931
|
+
defaultHeaders: getOpenRouterAttributionHeaders(endpoint.toString()),
|
|
18710
18932
|
timeout: 15000,
|
|
18711
18933
|
maxRetries: 0,
|
|
18712
18934
|
fetchOptions: { redirect: "manual" }
|
|
@@ -32848,7 +33070,7 @@ async function shutdown() {
|
|
|
32848
33070
|
sessionsProcessed: getServerSessionsProcessed()
|
|
32849
33071
|
});
|
|
32850
33072
|
if (hasCapability("scheduling")) {
|
|
32851
|
-
const { stopScheduler } = await import("./index-
|
|
33073
|
+
const { stopScheduler } = await import("./index-ekywyv2v.js");
|
|
32852
33074
|
stopScheduler();
|
|
32853
33075
|
}
|
|
32854
33076
|
stopHeartbeat();
|
|
@@ -32857,7 +33079,7 @@ async function shutdown() {
|
|
|
32857
33079
|
await stopScriptRunSupervisor();
|
|
32858
33080
|
await stopSlackApp();
|
|
32859
33081
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
32860
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
33082
|
+
const { stopOAuthKeepalive } = await import("./keepalive-4aezx4bj.js");
|
|
32861
33083
|
await stopOAuthKeepalive();
|
|
32862
33084
|
}
|
|
32863
33085
|
stopOAuthPendingGc();
|
|
@@ -32932,15 +33154,15 @@ try {
|
|
|
32932
33154
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
32933
33155
|
}
|
|
32934
33156
|
try {
|
|
32935
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
33157
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-22tx8a53.js");
|
|
32936
33158
|
ensurePricingSeeded();
|
|
32937
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
33159
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-mjrqvnvw.js");
|
|
32938
33160
|
startPricingRefreshLoop();
|
|
32939
33161
|
} catch (err) {
|
|
32940
33162
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
32941
33163
|
}
|
|
32942
33164
|
try {
|
|
32943
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
33165
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-22tx8a53.js");
|
|
32944
33166
|
ensureRbacSeeded();
|
|
32945
33167
|
} catch (err) {
|
|
32946
33168
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -32948,7 +33170,7 @@ try {
|
|
|
32948
33170
|
throw err;
|
|
32949
33171
|
}
|
|
32950
33172
|
try {
|
|
32951
|
-
const { runAllSeeders } = await import("./index-
|
|
33173
|
+
const { runAllSeeders } = await import("./index-cx1sb9bq.js");
|
|
32952
33174
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
32953
33175
|
} catch (err) {
|
|
32954
33176
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
@@ -33008,37 +33230,37 @@ httpServer.listen(port, async () => {
|
|
|
33008
33230
|
await initWorkflows();
|
|
33009
33231
|
await startScriptRunSupervisor(getMcpBaseUrl());
|
|
33010
33232
|
if (hasCapability("scheduling")) {
|
|
33011
|
-
const { startScheduler } = await import("./index-
|
|
33012
|
-
const { getExecutorRegistry: getExecutorRegistry2 } = await import("./index-
|
|
33233
|
+
const { startScheduler } = await import("./index-ekywyv2v.js");
|
|
33234
|
+
const { getExecutorRegistry: getExecutorRegistry2 } = await import("./index-t4g06w93.js");
|
|
33013
33235
|
const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
|
|
33014
33236
|
startScheduler(getExecutorRegistry2(), intervalMs, {
|
|
33015
33237
|
runId: globalState.__runId
|
|
33016
33238
|
});
|
|
33017
33239
|
}
|
|
33018
33240
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
33019
|
-
const { startHeartbeat } = await import("./index-
|
|
33241
|
+
const { startHeartbeat } = await import("./index-bt8wkv1w.js");
|
|
33020
33242
|
const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
|
|
33021
33243
|
startHeartbeat(heartbeatMs);
|
|
33022
33244
|
}
|
|
33023
33245
|
if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
|
|
33024
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
33246
|
+
const { startOAuthKeepalive } = await import("./keepalive-4aezx4bj.js");
|
|
33025
33247
|
startOAuthKeepalive();
|
|
33026
33248
|
}
|
|
33027
33249
|
if (process.env.OAUTH_REFRESH_SWEEP_DISABLE !== "true") {
|
|
33028
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
33250
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-wm4ctjfj.js");
|
|
33029
33251
|
startOAuthRefreshSweep();
|
|
33030
33252
|
}
|
|
33031
33253
|
startOAuthPendingGc();
|
|
33032
33254
|
await startMemoryGc();
|
|
33033
33255
|
await startDbRetention();
|
|
33034
33256
|
startHumanFreeDrain();
|
|
33035
|
-
import("./boot-reembed-
|
|
33257
|
+
import("./boot-reembed-fmp5ww69.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
|
|
33036
33258
|
console.error("[boot-reembed] startup backfill failed (non-fatal):", err);
|
|
33037
33259
|
});
|
|
33038
|
-
import("./boot-reembed-
|
|
33260
|
+
import("./boot-reembed-1ze5853n.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
|
|
33039
33261
|
console.error("[boot-reembed-scripts] startup backfill failed (non-fatal):", err);
|
|
33040
33262
|
});
|
|
33041
|
-
import("./boot-scrub-sweep-
|
|
33263
|
+
import("./boot-scrub-sweep-cbp8xd4e.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
33042
33264
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
33043
33265
|
});
|
|
33044
33266
|
}).on("error", (err) => {
|