@frontmcp/sdk 1.10.9-rc.1 → 1.10.9-rc.2
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/browser/agent/agent.registry.mjs +1 -1
- package/browser/app/instances/app.esm.instance.mjs +4 -4
- package/browser/app/instances/app.remote.instance.mjs +6 -6
- package/browser/auth/auth-ui/auth-ui.registry.mjs +6 -6
- package/browser/auth/flows/oauth.authorize.flow.mjs +5 -5
- package/browser/auth/flows/oauth.callback.flow.mjs +11 -11
- package/browser/auth/flows/oauth.connect.flow.mjs +1 -1
- package/browser/auth/flows/oauth.register.flow.mjs +1 -1
- package/browser/auth/flows/oauth.token.flow.mjs +1 -1
- package/browser/auth/flows/well-known.oauth-authorization-server.flow.mjs +5 -5
- package/browser/auth/instances/instance.local-primary-auth.mjs +10 -10
- package/browser/auth/session/utils/session-id.utils.mjs +1 -1
- package/browser/common/entries/skill.entry.mjs +2 -2
- package/browser/common/entries/tool.entry.mjs +3 -3
- package/browser/common/interfaces/channel.interface.mjs +1 -1
- package/browser/common/interfaces/execution-context.interface.mjs +4 -4
- package/browser/common/interfaces/internal/primary-auth-provider.interface.mjs +2 -2
- package/browser/common/metadata/app.metadata.mjs +1 -1
- package/browser/common/metadata/front-mcp.metadata.mjs +5 -5
- package/browser/common/tokens/app.tokens.mjs +1 -1
- package/browser/common/tokens/front-mcp.tokens.mjs +1 -1
- package/browser/common/types/options/http/schema.mjs +4 -4
- package/browser/common/types/options/redis/schema.mjs +1 -1
- package/browser/common/types/options/sqlite/schema.mjs +3 -3
- package/browser/common/types/options/transport/schema.mjs +4 -4
- package/browser/common/utils/decide-request-intent.utils.mjs +10 -10
- package/browser/context/frontmcp-context.mjs +1 -1
- package/browser/direct/direct-client.mjs +29 -29
- package/browser/direct/direct-server.mjs +14 -14
- package/browser/errors/job.errors.mjs +1 -1
- package/browser/errors/mcp.error.mjs +4 -4
- package/browser/errors/plugin.errors.mjs +1 -1
- package/browser/errors/task.error.mjs +1 -1
- package/browser/errors/tool-credentials-required.error.mjs +2 -2
- package/browser/esm-loader/esm-module-loader.mjs +1 -7
- package/browser/esm-loader/import-computed.mjs +11 -0
- package/browser/esm-loader/semver.utils.mjs +17 -11
- package/browser/flows/flow.instance.mjs +1 -1
- package/browser/front-mcp/front-mcp.mjs +10 -14
- package/browser/ha/ha-manager.mjs +1 -1
- package/browser/ha/notification-relay.mjs +1 -1
- package/browser/index.cjs +1210 -1438
- package/browser/index.mjs +4 -4
- package/browser/job/store/job-definition-store.factory.mjs +1 -1
- package/browser/job/store/redis-job-definition.store.mjs +2 -2
- package/browser/job/tools/get-job-status.tool.mjs +1 -1
- package/browser/logger/logger.registry.mjs +1 -1
- package/browser/metrics/metrics.service.mjs +3 -3
- package/browser/prompt/prompt.registry.mjs +1 -1
- package/browser/provider/provider.registry.mjs +4 -4
- package/browser/remote-mcp/mcp-client.service.mjs +19 -19
- package/browser/remote-mcp/resilience/circuit-breaker.mjs +2 -2
- package/browser/resource/resource.registry.mjs +2 -2
- package/browser/scope/flows/http.request.flow.mjs +3 -3
- package/browser/scope/scope.instance.mjs +4 -4
- package/browser/scope/scope.utils.mjs +1 -1
- package/browser/skill/providers/memory-skill.provider.mjs +2 -2
- package/browser/skill/skill.registry.mjs +10 -10
- package/browser/task/flows/tasks-result.flow.mjs +2 -2
- package/browser/task/task.registry.mjs +5 -5
- package/browser/tool/flows/call-tool.flow.mjs +4 -4
- package/browser/tool/tool.instance.mjs +4 -4
- package/browser/tool/tool.registry.mjs +4 -4
- package/browser/tool/ui/ui-shared.mjs +1 -1
- package/browser/transport/adapters/transport.local.adapter.mjs +2 -2
- package/browser/transport/adapters/transport.streamable-http.adapter.mjs +13 -4
- package/browser/transport/event-stores/redis.event-store.mjs +1 -1
- package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +1 -1
- package/browser/transport/mcp-20260728/request-notifications.mjs +1 -1
- package/browser/transport/transport.registry.mjs +15 -9
- package/browser/transport/web-response.renderer.mjs +2 -2
- package/browser/utils/lineage.utils.mjs +1 -1
- package/browser/workflow/tools/get-workflow-status.tool.mjs +1 -1
- package/esm/esm-loader/import-computed.mjs +10 -0
- package/esm/index.mjs +136 -77113
- package/esm-loader/esm-module-loader.d.ts.map +1 -1
- package/esm-loader/import-computed.d.ts +21 -0
- package/esm-loader/import-computed.d.ts.map +1 -0
- package/esm-loader/import-computed.js +34 -0
- package/esm-loader/semver.utils.d.ts.map +1 -1
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/index.d.ts +9 -8
- package/index.d.ts.map +1 -1
- package/index.js +140 -77769
- package/package.json +14 -10
- package/transport/adapters/transport.streamable-http.adapter.d.ts +2 -1
- package/transport/adapters/transport.streamable-http.adapter.d.ts.map +1 -1
- package/transport/transport.registry.d.ts +1 -0
- package/transport/transport.registry.d.ts.map +1 -1
- package/browser/transport/index.mjs +0 -32
package/browser/index.cjs
CHANGED
|
@@ -277,7 +277,7 @@ var init_mcp_error = __esm({
|
|
|
277
277
|
entryName;
|
|
278
278
|
availability;
|
|
279
279
|
runtimeContext;
|
|
280
|
-
/** Issue #417
|
|
280
|
+
/** Issue #417 \u2014 axes that failed to match (e.g. ['surface', 'provider']). */
|
|
281
281
|
missingAxes;
|
|
282
282
|
constructor(entryType, entryName, availability, runtimeContext, missingAxes = []) {
|
|
283
283
|
const safeStringify = (v) => {
|
|
@@ -304,7 +304,7 @@ var init_mcp_error = __esm({
|
|
|
304
304
|
/**
|
|
305
305
|
* Convert to JSON-RPC error format per MCP specification.
|
|
306
306
|
*
|
|
307
|
-
* Issue #417
|
|
307
|
+
* Issue #417 \u2014 `data` now exposes `{tool, missingAxes, constraint, context}`
|
|
308
308
|
* so MCP clients can react structurally without parsing prose.
|
|
309
309
|
*/
|
|
310
310
|
toJsonRpcError() {
|
|
@@ -387,7 +387,7 @@ Details: ${JSON.stringify(this.validationErrors, null, 2)}`;
|
|
|
387
387
|
};
|
|
388
388
|
InvalidOutputError = class extends InternalMcpError {
|
|
389
389
|
hasCustomErrorId;
|
|
390
|
-
/** Optional structured context
|
|
390
|
+
/** Optional structured context \u2014 path/value/reason \u2014 for diagnostics. */
|
|
391
391
|
details;
|
|
392
392
|
constructor(errorIdOrDetails, maybeDetails) {
|
|
393
393
|
const errorId = typeof errorIdOrDetails === "string" ? errorIdOrDetails : void 0;
|
|
@@ -595,7 +595,7 @@ ${this.originalError.stack}`;
|
|
|
595
595
|
}
|
|
596
596
|
};
|
|
597
597
|
GuardLimitMcpError = class extends PublicMcpError {
|
|
598
|
-
/** The guard's own message
|
|
598
|
+
/** The guard's own message \u2014 what the server logs. */
|
|
599
599
|
detail;
|
|
600
600
|
constructor(error) {
|
|
601
601
|
super(publicGuardMessage(error), error.code, error.statusCode);
|
|
@@ -1327,7 +1327,7 @@ var init_app_metadata = __esm({
|
|
|
1327
1327
|
frontMcpLocalAppMetadataSchema = import_lazy_zod5.z.looseObject({
|
|
1328
1328
|
id: import_lazy_zod5.z.string().optional(),
|
|
1329
1329
|
name: import_lazy_zod5.z.string().min(1),
|
|
1330
|
-
// Captured call-site dir (#469
|
|
1330
|
+
// Captured call-site dir (#469 \u2014 anchors auth.ui relative paths for splitByApp).
|
|
1331
1331
|
__sourceDir: import_lazy_zod5.z.string().optional(),
|
|
1332
1332
|
description: import_lazy_zod5.z.string().optional(),
|
|
1333
1333
|
providers: import_lazy_zod5.z.array(import_lazy_zod5.z.lazy(() => annotatedFrontMcpProvidersSchema)).optional().default([]),
|
|
@@ -1510,7 +1510,7 @@ var init_front_mcp_tokens = __esm({
|
|
|
1510
1510
|
FrontMcpTokens = {
|
|
1511
1511
|
type: tokenFactory.type("root"),
|
|
1512
1512
|
info: tokenFactory.meta("info"),
|
|
1513
|
-
// Captured call-site dir (#469)
|
|
1513
|
+
// Captured call-site dir (#469) \u2014 anchors auth.ui relative paths.
|
|
1514
1514
|
__sourceDir: tokenFactory.meta("__sourceDir"),
|
|
1515
1515
|
instructions: tokenFactory.meta("instructions"),
|
|
1516
1516
|
apps: tokenFactory.meta("apps"),
|
|
@@ -1660,7 +1660,7 @@ var init_app_tokens = __esm({
|
|
|
1660
1660
|
// tool UI defaults (`ui.servingMode`) for the app's tools (#720)
|
|
1661
1661
|
ui: tokenFactory.meta("ui"),
|
|
1662
1662
|
standalone: tokenFactory.meta("standalone"),
|
|
1663
|
-
// Captured call-site dir (#469)
|
|
1663
|
+
// Captured call-site dir (#469) \u2014 anchors auth.ui relative paths for splitByApp.
|
|
1664
1664
|
__sourceDir: tokenFactory.meta("__sourceDir")
|
|
1665
1665
|
};
|
|
1666
1666
|
FrontMcpRemoteAppTokens = {
|
|
@@ -2970,7 +2970,7 @@ var init_schema3 = __esm({
|
|
|
2970
2970
|
port: import_lazy_zod16.z.number().optional().default(defaultHttpPort),
|
|
2971
2971
|
// `FRONTMCP_HTTP_ENTRY_PATH` lets `frontmcp dev` propagate the configured
|
|
2972
2972
|
// `transport.http.path` to the spawned server so the MCP endpoint is mounted
|
|
2973
|
-
// where the generated client URL points (#446)
|
|
2973
|
+
// where the generated client URL points (#446) \u2014 mirrors how `port` reads
|
|
2974
2974
|
// `PORT` above. The function default reads the env at parse time. An explicit
|
|
2975
2975
|
// `entryPath` in `@FrontMcp({ http })` still wins (the default applies only
|
|
2976
2976
|
// when the field is omitted).
|
|
@@ -2986,7 +2986,7 @@ var init_schema3 = __esm({
|
|
|
2986
2986
|
socketPath: import_lazy_zod16.z.string().optional(),
|
|
2987
2987
|
/**
|
|
2988
2988
|
* CORS configuration.
|
|
2989
|
-
* - undefined (default): NO CORS headers
|
|
2989
|
+
* - undefined (default): NO CORS headers \u2014 same-origin only. A browser will not let another
|
|
2990
2990
|
* origin read the response. Set `{ origin: true }` for the old permissive behaviour.
|
|
2991
2991
|
* - false: CORS disabled (same effect as the default; kept for explicitness)
|
|
2992
2992
|
* - CorsOptions object: custom CORS config
|
|
@@ -2996,9 +2996,9 @@ var init_schema3 = __esm({
|
|
|
2996
2996
|
* Security configuration for transport hardening.
|
|
2997
2997
|
*
|
|
2998
2998
|
* The defaults are the SAFE choice: the server binds loopback and sends no CORS headers. Reaching
|
|
2999
|
-
* it from another host or another origin is something you opt into
|
|
2999
|
+
* it from another host or another origin is something you opt into \u2014 `bindAddress: 'all'`, the
|
|
3000
3000
|
* `FRONTMCP_BIND_ADDRESS=all` env var (no rebuild; the right fit for a Dockerfile), or a
|
|
3001
|
-
* distributed build
|
|
3001
|
+
* distributed build \u2014 and an explicit `cors` config.
|
|
3002
3002
|
*/
|
|
3003
3003
|
security: import_lazy_zod16.z.object({
|
|
3004
3004
|
strict: import_lazy_zod16.z.boolean().optional(),
|
|
@@ -3240,7 +3240,7 @@ var init_schema5 = __esm({
|
|
|
3240
3240
|
}));
|
|
3241
3241
|
redisUrlSchema = import_lazy_zod18.z.object({
|
|
3242
3242
|
/**
|
|
3243
|
-
* Storage provider type
|
|
3243
|
+
* Storage provider type \u2014 optional, a `url` already says Redis.
|
|
3244
3244
|
*/
|
|
3245
3245
|
provider: import_lazy_zod18.z.literal("redis").optional(),
|
|
3246
3246
|
/**
|
|
@@ -3297,11 +3297,11 @@ var init_schema6 = __esm({
|
|
|
3297
3297
|
import_lazy_zod19 = require("@frontmcp/lazy-zod");
|
|
3298
3298
|
sqliteOptionsSchema = import_lazy_zod19.z.object({
|
|
3299
3299
|
/**
|
|
3300
|
-
* Path to the .sqlite database file. **Optional**
|
|
3300
|
+
* Path to the .sqlite database file. **Optional** \u2014 when omitted the SDK
|
|
3301
3301
|
* resolves a default at startup (see `resolveDefaultSqlitePath` in
|
|
3302
3302
|
* `./resolve.ts`):
|
|
3303
|
-
* - dev + node + non-CLI
|
|
3304
|
-
* - prod OR CLI mode
|
|
3303
|
+
* - dev + node + non-CLI \u2192 `<projectRoot>/dist/sessions.sqlite`
|
|
3304
|
+
* - prod OR CLI mode \u2192 `~/.{info.name}/sessions.sqlite`
|
|
3305
3305
|
* Set this explicitly to override either default.
|
|
3306
3306
|
*/
|
|
3307
3307
|
path: import_lazy_zod19.z.string().min(1).optional(),
|
|
@@ -3550,7 +3550,7 @@ var init_schema7 = __esm({
|
|
|
3550
3550
|
// Session Lifecycle
|
|
3551
3551
|
// ============================================
|
|
3552
3552
|
/**
|
|
3553
|
-
* @deprecated Ignored
|
|
3553
|
+
* @deprecated Ignored \u2014 sessions follow `protocol` (`'stateless-api'` serves without them). A value
|
|
3554
3554
|
* other than `'stateful'` logs a startup warning (`warnIfSessionModeIgnored`). Removed in the next
|
|
3555
3555
|
* major (#702).
|
|
3556
3556
|
*/
|
|
@@ -3563,13 +3563,13 @@ var init_schema7 = __esm({
|
|
|
3563
3563
|
/**
|
|
3564
3564
|
* Which MCP revision to serve a request that does not identify its own.
|
|
3565
3565
|
*
|
|
3566
|
-
* A client that names a revision always gets that revision
|
|
3566
|
+
* A client that names a revision always gets that revision \u2014 this only
|
|
3567
3567
|
* decides the fallback for a bare JSON-RPC call carrying no `initialize`, no
|
|
3568
3568
|
* `Mcp-Session-Id`, and no `MCP-Protocol-Version`.
|
|
3569
3569
|
*
|
|
3570
|
-
* - `'2026-07-28'`
|
|
3570
|
+
* - `'2026-07-28'` \u2014 serve it statelessly. No session is minted, so the
|
|
3571
3571
|
* deployment needs no session storage (on Cloudflare, no Durable Object).
|
|
3572
|
-
* - `'legacy'`
|
|
3572
|
+
* - `'legacy'` \u2014 the session/`initialize` pipeline, as before.
|
|
3573
3573
|
*
|
|
3574
3574
|
* Defaults to `'2026-07-28'` on V8-isolate runtimes (Cloudflare Workers and
|
|
3575
3575
|
* friends), where statelessness is the natural fit and sessions cost a
|
|
@@ -4256,7 +4256,7 @@ var init_front_mcp_metadata = __esm({
|
|
|
4256
4256
|
init_ui_serving_mode();
|
|
4257
4257
|
frontMcpBaseSchema = import_lazy_zod31.z.object({
|
|
4258
4258
|
info: serverInfoOptionsSchema,
|
|
4259
|
-
// Captured call-site dir (#469
|
|
4259
|
+
// Captured call-site dir (#469 \u2014 anchors auth.ui relative paths). Passthrough
|
|
4260
4260
|
// so it survives the strict-object parse and reaches the scope metadata.
|
|
4261
4261
|
__sourceDir: import_lazy_zod31.z.string().optional(),
|
|
4262
4262
|
instructions: import_lazy_zod31.z.string().optional(),
|
|
@@ -4289,7 +4289,7 @@ var init_front_mcp_metadata = __esm({
|
|
|
4289
4289
|
/**
|
|
4290
4290
|
* Output-validation policy applied after entry-level Zod parsing succeeds.
|
|
4291
4291
|
* `allowNonFinite: true` lets `Infinity`, `-Infinity`, and `NaN` reach JSON
|
|
4292
|
-
* serialization (where they become `null`). Default is `false`
|
|
4292
|
+
* serialization (where they become `null`). Default is `false` \u2014 non-finite
|
|
4293
4293
|
* numeric output throws `InvalidOutputError`.
|
|
4294
4294
|
*/
|
|
4295
4295
|
output: outputPolicySchema.optional(),
|
|
@@ -4358,7 +4358,7 @@ var init_front_mcp_metadata = __esm({
|
|
|
4358
4358
|
frontMcpMetadataSchema = frontMcpMultiAppSchema.or(frontMcpSplitByAppSchema).transform(applyAutoTransportPersistence);
|
|
4359
4359
|
frontMcpLiteSchema = import_lazy_zod31.z.object({
|
|
4360
4360
|
info: serverInfoOptionsSchema,
|
|
4361
|
-
// Captured call-site dir (#469)
|
|
4361
|
+
// Captured call-site dir (#469) \u2014 round-trip through the lite parser too.
|
|
4362
4362
|
__sourceDir: import_lazy_zod31.z.string().optional(),
|
|
4363
4363
|
// Server-level instructions injected into the MCP `initialize` response.
|
|
4364
4364
|
// Must round-trip through the lite parser so CLI/MCPB builds preserve it.
|
|
@@ -4376,7 +4376,7 @@ var init_front_mcp_metadata = __esm({
|
|
|
4376
4376
|
logging: loggingOptionsSchema.optional(),
|
|
4377
4377
|
skillsConfig: skillsConfigOptionsSchema.optional(),
|
|
4378
4378
|
loader: packageLoaderSchema.optional(),
|
|
4379
|
-
// Pass through without deep validation
|
|
4379
|
+
// Pass through without deep validation \u2014 not used in CLI mode
|
|
4380
4380
|
http: import_lazy_zod31.z.any().optional(),
|
|
4381
4381
|
redis: import_lazy_zod31.z.any().optional(),
|
|
4382
4382
|
pubsub: import_lazy_zod31.z.any().optional(),
|
|
@@ -4391,7 +4391,7 @@ var init_front_mcp_metadata = __esm({
|
|
|
4391
4391
|
throttle: import_lazy_zod31.z.any().optional(),
|
|
4392
4392
|
health: import_lazy_zod31.z.any().optional(),
|
|
4393
4393
|
metrics: import_lazy_zod31.z.any().optional(),
|
|
4394
|
-
// Required by Scope.validateAuthoritiesConfig
|
|
4394
|
+
// Required by Scope.validateAuthoritiesConfig \u2014 when entries declare
|
|
4395
4395
|
// `authorities` metadata the engine still needs the top-level config
|
|
4396
4396
|
// to instantiate. Pass-through (`z.any()`) so CLI/MCPB builds work
|
|
4397
4397
|
// without forcing the full base-schema validation pipeline.
|
|
@@ -5543,8 +5543,8 @@ var init_tool_credentials_required_error = __esm({
|
|
|
5543
5543
|
* "data": {
|
|
5544
5544
|
* "tool": "deploy_app",
|
|
5545
5545
|
* "providers": ["github"],
|
|
5546
|
-
* "authUrl": "https://.../oauth/connect?token
|
|
5547
|
-
* "auth_url": "https://.../oauth/connect?token
|
|
5546
|
+
* "authUrl": "https://.../oauth/connect?token=\u2026",
|
|
5547
|
+
* "auth_url": "https://.../oauth/connect?token=\u2026"
|
|
5548
5548
|
* }
|
|
5549
5549
|
* }
|
|
5550
5550
|
*/
|
|
@@ -6089,7 +6089,7 @@ var init_frontmcp_context = __esm({
|
|
|
6089
6089
|
* Attach the request's MRTR exchange.
|
|
6090
6090
|
*
|
|
6091
6091
|
* Set by the 2026-07-28 dispatcher before running a request. Its presence is
|
|
6092
|
-
* what switches `elicit()` from the inline server
|
|
6092
|
+
* what switches `elicit()` from the inline server\u2192client round trip (removed
|
|
6093
6093
|
* in this revision) to the `InputRequiredResult` round trip.
|
|
6094
6094
|
*
|
|
6095
6095
|
* @internal
|
|
@@ -7212,7 +7212,7 @@ var init_task_error = __esm({
|
|
|
7212
7212
|
}
|
|
7213
7213
|
};
|
|
7214
7214
|
TaskAugmentationRequiredError = class extends PublicMcpError {
|
|
7215
|
-
// Per MCP 2025-11-25
|
|
7215
|
+
// Per MCP 2025-11-25 \u00a7Tool-Level Negotiation: tool-level `taskSupport: "required"`
|
|
7216
7216
|
// without task augmentation MUST return -32601 (Method not found).
|
|
7217
7217
|
mcpErrorCode = MCP_ERROR_CODES.METHOD_NOT_FOUND;
|
|
7218
7218
|
constructor(toolName) {
|
|
@@ -7929,7 +7929,7 @@ var init_job_errors = __esm({
|
|
|
7929
7929
|
"use strict";
|
|
7930
7930
|
init_mcp_error();
|
|
7931
7931
|
JobNotAuthorizedError = class extends PublicMcpError {
|
|
7932
|
-
/** The requested name, for internal logs only
|
|
7932
|
+
/** The requested name, for internal logs only \u2014 never surfaced publicly. */
|
|
7933
7933
|
requestedName;
|
|
7934
7934
|
constructor(requestedName) {
|
|
7935
7935
|
super(`Job or workflow "${requestedName}" not found or not permitted`, "JOB_NOT_AUTHORIZED", 403);
|
|
@@ -7955,7 +7955,7 @@ var init_plugin_errors = __esm({
|
|
|
7955
7955
|
"use strict";
|
|
7956
7956
|
init_mcp_error();
|
|
7957
7957
|
UnenforcedMetadataError = class extends PublicMcpError {
|
|
7958
|
-
/** One line per entry and field, e.g. `Tool "wipe_disk" declares 'approval' (enforced by
|
|
7958
|
+
/** One line per entry and field, e.g. `Tool "wipe_disk" declares 'approval' (enforced by \u2026)`. */
|
|
7959
7959
|
errors;
|
|
7960
7960
|
suggestion;
|
|
7961
7961
|
constructor(problems) {
|
|
@@ -9973,7 +9973,7 @@ function isValidSessionPayload(dec, sig) {
|
|
|
9973
9973
|
function isValidPublicSessionPayload(dec, expectedAuthSig = "public") {
|
|
9974
9974
|
if (typeof dec !== "object" || dec === null) return false;
|
|
9975
9975
|
const d = dec;
|
|
9976
|
-
return typeof d["nodeId"] === "string" && d["authSig"] === expectedAuthSig && typeof d["uuid"] === "string" && typeof d["iat"] === "number" && // `isPublic` is set only for public mode, so it must track the signature
|
|
9976
|
+
return typeof d["nodeId"] === "string" && d["authSig"] === expectedAuthSig && typeof d["uuid"] === "string" && typeof d["iat"] === "number" && // `isPublic` is set only for public mode, so it must track the signature \u2014
|
|
9977
9977
|
// a static-mode session must never decrypt as a public one.
|
|
9978
9978
|
d["isPublic"] === (expectedAuthSig === "public");
|
|
9979
9979
|
}
|
|
@@ -10851,7 +10851,7 @@ __export(in_memory_server_exports, {
|
|
|
10851
10851
|
createInMemoryServer: () => createInMemoryServer
|
|
10852
10852
|
});
|
|
10853
10853
|
async function createInMemoryServer(scope, options) {
|
|
10854
|
-
const { ElicitResultSchema: ElicitResultSchema3, ErrorCode, InMemoryTransport, McpError: McpError4, McpServer:
|
|
10854
|
+
const { ElicitResultSchema: ElicitResultSchema3, ErrorCode, InMemoryTransport, McpError: McpError4, McpServer: McpServer3 } = await importWithRequireFallback(
|
|
10855
10855
|
() => import("@frontmcp/protocol"),
|
|
10856
10856
|
() => require("@frontmcp/protocol")
|
|
10857
10857
|
);
|
|
@@ -10892,7 +10892,7 @@ async function createInMemoryServer(scope, options) {
|
|
|
10892
10892
|
}
|
|
10893
10893
|
};
|
|
10894
10894
|
const serverOptions = buildScopedServerOptions(scope);
|
|
10895
|
-
const mcpServer = new
|
|
10895
|
+
const mcpServer = new McpServer3(scope.metadata.info, serverOptions);
|
|
10896
10896
|
const composeInstructions = (caller) => composeCallerInstructions(scope, { ctx: caller, skillUriHints: true });
|
|
10897
10897
|
const handlers = createMcpHandlers2({ scope, serverOptions, composeInstructions });
|
|
10898
10898
|
for (const handler of handlers) {
|
|
@@ -11149,9 +11149,9 @@ var init_direct_client = __esm({
|
|
|
11149
11149
|
}
|
|
11150
11150
|
return { action: "decline" };
|
|
11151
11151
|
}
|
|
11152
|
-
//
|
|
11152
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11153
11153
|
// Tool Operations (platform-formatted)
|
|
11154
|
-
//
|
|
11154
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11155
11155
|
async listTools() {
|
|
11156
11156
|
const tools = await listAllPages("tools/list", async (cursor) => {
|
|
11157
11157
|
const result = await this.mcpClient.listTools(cursor ? { cursor } : void 0);
|
|
@@ -11168,9 +11168,9 @@ var init_direct_client = __esm({
|
|
|
11168
11168
|
if (result.isError && this.platform !== "raw") throw new ToolCallError(name48, result);
|
|
11169
11169
|
return formatResultForPlatform(result, this.platform);
|
|
11170
11170
|
}
|
|
11171
|
-
//
|
|
11171
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11172
11172
|
// Resource Operations (raw format)
|
|
11173
|
-
//
|
|
11173
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11174
11174
|
async listResources() {
|
|
11175
11175
|
const resources = await listAllPages("resources/list", async (cursor) => {
|
|
11176
11176
|
const result = await this.mcpClient.listResources(cursor ? { cursor } : void 0);
|
|
@@ -11191,9 +11191,9 @@ var init_direct_client = __esm({
|
|
|
11191
11191
|
);
|
|
11192
11192
|
return { resourceTemplates };
|
|
11193
11193
|
}
|
|
11194
|
-
//
|
|
11194
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11195
11195
|
// Prompt Operations (raw format)
|
|
11196
|
-
//
|
|
11196
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11197
11197
|
async listPrompts() {
|
|
11198
11198
|
const prompts = await listAllPages("prompts/list", async (cursor) => {
|
|
11199
11199
|
const result = await this.mcpClient.listPrompts(cursor ? { cursor } : void 0);
|
|
@@ -11207,9 +11207,9 @@ var init_direct_client = __esm({
|
|
|
11207
11207
|
arguments: args
|
|
11208
11208
|
});
|
|
11209
11209
|
}
|
|
11210
|
-
//
|
|
11210
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11211
11211
|
// Info
|
|
11212
|
-
//
|
|
11212
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11213
11213
|
getSessionId() {
|
|
11214
11214
|
return this.sessionId;
|
|
11215
11215
|
}
|
|
@@ -11225,9 +11225,9 @@ var init_direct_client = __esm({
|
|
|
11225
11225
|
getDetectedPlatform() {
|
|
11226
11226
|
return this.platform;
|
|
11227
11227
|
}
|
|
11228
|
-
//
|
|
11228
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11229
11229
|
// Lifecycle
|
|
11230
|
-
//
|
|
11230
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11231
11231
|
async close() {
|
|
11232
11232
|
try {
|
|
11233
11233
|
await this.mcpClient.close();
|
|
@@ -11241,7 +11241,7 @@ var init_direct_client = __esm({
|
|
|
11241
11241
|
}
|
|
11242
11242
|
}
|
|
11243
11243
|
}
|
|
11244
|
-
//
|
|
11244
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11245
11245
|
// Skills Operations
|
|
11246
11246
|
//
|
|
11247
11247
|
// NOTE: Skills methods use `{} as any` for the response schema parameter because:
|
|
@@ -11250,7 +11250,7 @@ var init_direct_client = __esm({
|
|
|
11250
11250
|
// SkillsLoadResultSchema, and SkillsListResultSchema
|
|
11251
11251
|
// 3. The MCP SDK's client.request() validates responses using these schemas
|
|
11252
11252
|
// 4. Schemas are shared between client and server
|
|
11253
|
-
//
|
|
11253
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11254
11254
|
/**
|
|
11255
11255
|
* Search for skills matching a query.
|
|
11256
11256
|
*
|
|
@@ -11314,12 +11314,12 @@ var init_direct_client = __esm({
|
|
|
11314
11314
|
);
|
|
11315
11315
|
}
|
|
11316
11316
|
/**
|
|
11317
|
-
* SEP-2640 convenience wrapper
|
|
11317
|
+
* SEP-2640 convenience wrapper \u2014 see `DirectClient.listSep2640Skills`.
|
|
11318
11318
|
*
|
|
11319
11319
|
* Reads `skill://index.json` via `resources/read`, validates the
|
|
11320
11320
|
* agentskills.io v0.2.0 schema URI, and returns the parsed entries.
|
|
11321
11321
|
* Returns `[]` (with a console.warn) when the resource isn't present,
|
|
11322
|
-
* per SEP
|
|
11322
|
+
* per SEP \u00a7Discovery: hosts MUST NOT treat absence as proof of zero
|
|
11323
11323
|
* skills, but the convenience helper degrades gracefully.
|
|
11324
11324
|
*/
|
|
11325
11325
|
async listSep2640Skills() {
|
|
@@ -11358,7 +11358,7 @@ var init_direct_client = __esm({
|
|
|
11358
11358
|
});
|
|
11359
11359
|
}
|
|
11360
11360
|
/**
|
|
11361
|
-
* SEP-2640 convenience wrapper
|
|
11361
|
+
* SEP-2640 convenience wrapper \u2014 see `DirectClient.readSkillUri`.
|
|
11362
11362
|
*
|
|
11363
11363
|
* Performs `resources/read` on a `skill://` URI and returns the body
|
|
11364
11364
|
* text directly. Throws when given a non-`skill://` URI to keep
|
|
@@ -11380,9 +11380,9 @@ var init_direct_client = __esm({
|
|
|
11380
11380
|
}
|
|
11381
11381
|
return text;
|
|
11382
11382
|
}
|
|
11383
|
-
//
|
|
11383
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11384
11384
|
// Elicitation Operations
|
|
11385
|
-
//
|
|
11385
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11386
11386
|
onElicitation(handler) {
|
|
11387
11387
|
this.elicitationHandler = handler;
|
|
11388
11388
|
return () => {
|
|
@@ -11392,15 +11392,15 @@ var init_direct_client = __esm({
|
|
|
11392
11392
|
async submitElicitationResult(elicitId, response) {
|
|
11393
11393
|
return this.callTool("sendElicitationResult", { elicitId, ...response });
|
|
11394
11394
|
}
|
|
11395
|
-
//
|
|
11395
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11396
11396
|
// Completion Operations
|
|
11397
|
-
//
|
|
11397
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11398
11398
|
async complete(options) {
|
|
11399
11399
|
return this.mcpClient.complete(options);
|
|
11400
11400
|
}
|
|
11401
|
-
//
|
|
11401
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11402
11402
|
// Resource Subscription Operations
|
|
11403
|
-
//
|
|
11403
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11404
11404
|
async subscribeResource(uri) {
|
|
11405
11405
|
await this.mcpClient.subscribeResource({ uri });
|
|
11406
11406
|
}
|
|
@@ -11419,15 +11419,15 @@ var init_direct_client = __esm({
|
|
|
11419
11419
|
this.notificationHandlers.delete(handler);
|
|
11420
11420
|
};
|
|
11421
11421
|
}
|
|
11422
|
-
//
|
|
11422
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11423
11423
|
// Logging Operations
|
|
11424
|
-
//
|
|
11424
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11425
11425
|
async setLogLevel(level) {
|
|
11426
11426
|
await this.mcpClient.setLoggingLevel(level);
|
|
11427
11427
|
}
|
|
11428
|
-
//
|
|
11428
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11429
11429
|
// Job Operations (via MCP tools)
|
|
11430
|
-
//
|
|
11430
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11431
11431
|
async callToolAndParseJson(toolName, args) {
|
|
11432
11432
|
const result = await this.mcpClient.callTool({ name: toolName, arguments: args });
|
|
11433
11433
|
const textContent = result.content?.find((c) => c.type === "text");
|
|
@@ -11449,9 +11449,9 @@ var init_direct_client = __esm({
|
|
|
11449
11449
|
async getJobStatus(runId) {
|
|
11450
11450
|
return this.callToolAndParseJson("get_job_status", { runId });
|
|
11451
11451
|
}
|
|
11452
|
-
//
|
|
11452
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11453
11453
|
// Workflow Operations (via MCP tools)
|
|
11454
|
-
//
|
|
11454
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11455
11455
|
async listWorkflows(options) {
|
|
11456
11456
|
return this.callToolAndParseJson("list_workflows", { ...options });
|
|
11457
11457
|
}
|
|
@@ -11465,9 +11465,9 @@ var init_direct_client = __esm({
|
|
|
11465
11465
|
async getWorkflowStatus(runId) {
|
|
11466
11466
|
return this.callToolAndParseJson("get_workflow_status", { runId });
|
|
11467
11467
|
}
|
|
11468
|
-
//
|
|
11468
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11469
11469
|
// Build-Time Asset Collection
|
|
11470
|
-
//
|
|
11470
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
11471
11471
|
async collectSkillAssets() {
|
|
11472
11472
|
const scope = this.scopeRef;
|
|
11473
11473
|
if (!scope?.skills) return { entries: [] };
|
|
@@ -12732,7 +12732,7 @@ var init_lineage_utils = __esm({
|
|
|
12732
12732
|
if (!this.lineages.has(row.instance)) this.lineages.set(row.instance, row.lineage);
|
|
12733
12733
|
}
|
|
12734
12734
|
}
|
|
12735
|
-
/** Owner lineage (root
|
|
12735
|
+
/** Owner lineage (root \u2192 leaf) of an entry, or undefined when no row holds it. */
|
|
12736
12736
|
lineageOf(entry) {
|
|
12737
12737
|
return this.lineages.get(entry);
|
|
12738
12738
|
}
|
|
@@ -12962,7 +12962,7 @@ var init_ui_shared = __esm({
|
|
|
12962
12962
|
}
|
|
12963
12963
|
/**
|
|
12964
12964
|
* Per-tool resource metadata for the `ui://widget/{tool}.html` content read.
|
|
12965
|
-
* Returns `undefined` when nothing was configured
|
|
12965
|
+
* Returns `undefined` when nothing was configured \u2014 the handler should
|
|
12966
12966
|
* omit `_meta` entirely in that case so MCP clients don't see an empty
|
|
12967
12967
|
* object.
|
|
12968
12968
|
*/
|
|
@@ -13239,7 +13239,7 @@ var init_call_tool_flow = __esm({
|
|
|
13239
13239
|
// A timed-out execute() that is still running; its concurrency slot is released when it settles
|
|
13240
13240
|
abandonedExecution: import_lazy_zod46.z.instanceof(Promise).optional(),
|
|
13241
13241
|
// Task augmentation request (MCP 2025-11-25 tasks spec). Present when the
|
|
13242
|
-
// client sent `params.task`. `ttl` MUST be positive
|
|
13242
|
+
// client sent `params.task`. `ttl` MUST be positive \u2014 0 or negative values
|
|
13243
13243
|
// create a task that expires the instant it's persisted, which looks to the
|
|
13244
13244
|
// client like a silent drop. Reject them at the validation boundary so the
|
|
13245
13245
|
// client gets an InvalidInputError instead.
|
|
@@ -13264,8 +13264,8 @@ var init_call_tool_flow = __esm({
|
|
|
13264
13264
|
"createTaskIfRequested",
|
|
13265
13265
|
"createToolCallContext",
|
|
13266
13266
|
// Credential gate runs AFTER the tool context is built (so the
|
|
13267
|
-
// CONTEXT-scoped credential accessors
|
|
13268
|
-
// this.credentials
|
|
13267
|
+
// CONTEXT-scoped credential accessors \u2014 this.authProviders /
|
|
13268
|
+
// this.credentials \u2014 are resolvable) but BEFORE quota/semaphore and the
|
|
13269
13269
|
// execute stage, so a missing required credential aborts before execute().
|
|
13270
13270
|
"checkToolCredentials",
|
|
13271
13271
|
"acquireQuota",
|
|
@@ -13584,7 +13584,7 @@ var init_call_tool_flow = __esm({
|
|
|
13584
13584
|
* for display and are re-read from the signed payload server-side.
|
|
13585
13585
|
*
|
|
13586
13586
|
* When no verified subject or signing secret is available the URL is emitted
|
|
13587
|
-
* WITHOUT a ticket
|
|
13587
|
+
* WITHOUT a ticket \u2014 the user then completes an ordinary login, which is the
|
|
13588
13588
|
* correct fail-closed outcome rather than a credential-free shortcut.
|
|
13589
13589
|
*/
|
|
13590
13590
|
buildProgressiveAuthUrl(appId, toolId, authInfo, priorAppIds) {
|
|
@@ -14793,10 +14793,10 @@ var init_tool_instance = __esm({
|
|
|
14793
14793
|
* - `structuredContent`: sanitized JSON when outputSchema is "json-like"
|
|
14794
14794
|
*
|
|
14795
14795
|
* Rules:
|
|
14796
|
-
* - If outputSchema is a JS array
|
|
14797
|
-
* - Primitive
|
|
14798
|
-
* - image/audio/resource/resource_link
|
|
14799
|
-
* - JSON / structured
|
|
14796
|
+
* - If outputSchema is a JS array \u2192 multiple content items, each with its own type.
|
|
14797
|
+
* - Primitive \u2192 stringifies into a TextContent block.
|
|
14798
|
+
* - image/audio/resource/resource_link \u2192 passed through as-is.
|
|
14799
|
+
* - JSON / structured \u2192 JSON.stringify for text, and full sanitized JSON in structuredContent.
|
|
14800
14800
|
*/
|
|
14801
14801
|
parseOutput(raw) {
|
|
14802
14802
|
const descriptor = this.outputSchema;
|
|
@@ -15028,9 +15028,9 @@ var init_direct_server = __esm({
|
|
|
15028
15028
|
throw failure;
|
|
15029
15029
|
}
|
|
15030
15030
|
}
|
|
15031
|
-
//
|
|
15031
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15032
15032
|
// Tool Operations
|
|
15033
|
-
//
|
|
15033
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15034
15034
|
/**
|
|
15035
15035
|
* Run a list flow: the one page `options` asks for, or every page joined into one result (#678).
|
|
15036
15036
|
* Every page is read with the same call options, so with the same caller and session.
|
|
@@ -15063,9 +15063,9 @@ var init_direct_server = __esm({
|
|
|
15063
15063
|
}
|
|
15064
15064
|
return registerRuntimeTool(this.scope, definition);
|
|
15065
15065
|
}
|
|
15066
|
-
//
|
|
15066
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15067
15067
|
// Resource Operations
|
|
15068
|
-
//
|
|
15068
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15069
15069
|
async listResources(options) {
|
|
15070
15070
|
return this.runListFlow(
|
|
15071
15071
|
"resources:list-resources",
|
|
@@ -15089,9 +15089,9 @@ var init_direct_server = __esm({
|
|
|
15089
15089
|
options
|
|
15090
15090
|
);
|
|
15091
15091
|
}
|
|
15092
|
-
//
|
|
15092
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15093
15093
|
// Prompt Operations
|
|
15094
|
-
//
|
|
15094
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15095
15095
|
async listPrompts(options) {
|
|
15096
15096
|
return this.runListFlow("prompts:list-prompts", "prompts/list", "prompts", options);
|
|
15097
15097
|
}
|
|
@@ -15102,9 +15102,9 @@ var init_direct_server = __esm({
|
|
|
15102
15102
|
options
|
|
15103
15103
|
);
|
|
15104
15104
|
}
|
|
15105
|
-
//
|
|
15105
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15106
15106
|
// Job Operations - delegate to MCP tools
|
|
15107
|
-
//
|
|
15107
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15108
15108
|
async listJobs(options) {
|
|
15109
15109
|
return this.callTool("list_jobs", {}, options);
|
|
15110
15110
|
}
|
|
@@ -15118,9 +15118,9 @@ var init_direct_server = __esm({
|
|
|
15118
15118
|
async getJobStatus(runId, options) {
|
|
15119
15119
|
return this.callTool("get_job_status", { runId }, options);
|
|
15120
15120
|
}
|
|
15121
|
-
//
|
|
15121
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15122
15122
|
// Workflow Operations - delegate to MCP tools
|
|
15123
|
-
//
|
|
15123
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15124
15124
|
async listWorkflows(options) {
|
|
15125
15125
|
return this.callTool("list_workflows", {}, options);
|
|
15126
15126
|
}
|
|
@@ -15134,9 +15134,9 @@ var init_direct_server = __esm({
|
|
|
15134
15134
|
async getWorkflowStatus(runId, options) {
|
|
15135
15135
|
return this.callTool("get_workflow_status", { runId }, options);
|
|
15136
15136
|
}
|
|
15137
|
-
//
|
|
15137
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15138
15138
|
// Client Connections
|
|
15139
|
-
//
|
|
15139
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15140
15140
|
async connect(sessionIdOrOptions) {
|
|
15141
15141
|
if (this._isDisposed) {
|
|
15142
15142
|
throw new InternalMcpError("DirectMcpServer has been disposed");
|
|
@@ -15147,9 +15147,9 @@ var init_direct_server = __esm({
|
|
|
15147
15147
|
const { DirectClientImpl: DirectClientImpl2 } = await Promise.resolve().then(() => (init_direct_client(), direct_client_exports));
|
|
15148
15148
|
return DirectClientImpl2.create(this.scope, options);
|
|
15149
15149
|
}
|
|
15150
|
-
//
|
|
15150
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15151
15151
|
// Lifecycle
|
|
15152
|
-
//
|
|
15152
|
+
// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
15153
15153
|
async dispose() {
|
|
15154
15154
|
if (this._isDisposed) return;
|
|
15155
15155
|
this._isDisposed = true;
|
|
@@ -15692,7 +15692,7 @@ var init_logger_registry = __esm({
|
|
|
15692
15692
|
}
|
|
15693
15693
|
this.bindLogger();
|
|
15694
15694
|
}
|
|
15695
|
-
/** The mutable transports array
|
|
15695
|
+
/** The mutable transports array \u2014 shared by all loggers via getTransports closure. */
|
|
15696
15696
|
_transports = [];
|
|
15697
15697
|
bindLogger() {
|
|
15698
15698
|
const consoleTransport = this.instances.get(ConsoleLogTransportInstance);
|
|
@@ -17526,37 +17526,43 @@ var init_esm_auth_types = __esm({
|
|
|
17526
17526
|
|
|
17527
17527
|
// libs/sdk/src/esm-loader/semver.utils.ts
|
|
17528
17528
|
function isDistTag(range) {
|
|
17529
|
-
return /^[a-zA-Z][a-zA-Z0-9]*$/.test(range) &&
|
|
17529
|
+
return /^[a-zA-Z][a-zA-Z0-9]*$/.test(range) && (0, import_valid2.default)(range) === null;
|
|
17530
17530
|
}
|
|
17531
17531
|
function satisfiesRange(version, range) {
|
|
17532
17532
|
if (range === "latest" || isDistTag(range)) return true;
|
|
17533
|
-
return
|
|
17533
|
+
return (0, import_satisfies.default)(version, range);
|
|
17534
17534
|
}
|
|
17535
|
-
function
|
|
17535
|
+
function maxSatisfying(versions, range) {
|
|
17536
17536
|
if (range === "latest" || isDistTag(range)) {
|
|
17537
|
-
const sorted = versions.filter((v) =>
|
|
17537
|
+
const sorted = versions.filter((v) => (0, import_valid.default)(v)).sort(import_rcompare.default);
|
|
17538
17538
|
return sorted[0] ?? null;
|
|
17539
17539
|
}
|
|
17540
|
-
return
|
|
17540
|
+
return (0, import_max_satisfying.default)(versions, range);
|
|
17541
17541
|
}
|
|
17542
17542
|
function isValidRange(range) {
|
|
17543
17543
|
if (range === "latest" || isDistTag(range)) return true;
|
|
17544
|
-
return
|
|
17544
|
+
return (0, import_valid2.default)(range) !== null;
|
|
17545
17545
|
}
|
|
17546
17546
|
function isValidVersion(version) {
|
|
17547
|
-
return
|
|
17547
|
+
return (0, import_valid.default)(version) !== null;
|
|
17548
17548
|
}
|
|
17549
17549
|
function compareVersions(v1, v2) {
|
|
17550
|
-
return
|
|
17550
|
+
return (0, import_compare.default)(v1, v2);
|
|
17551
17551
|
}
|
|
17552
17552
|
function isNewerVersion(v1, v2) {
|
|
17553
|
-
return
|
|
17553
|
+
return (0, import_gt.default)(v1, v2);
|
|
17554
17554
|
}
|
|
17555
|
-
var
|
|
17555
|
+
var import_compare, import_gt, import_rcompare, import_satisfies, import_valid, import_max_satisfying, import_valid2;
|
|
17556
17556
|
var init_semver_utils = __esm({
|
|
17557
17557
|
"libs/sdk/src/esm-loader/semver.utils.ts"() {
|
|
17558
17558
|
"use strict";
|
|
17559
|
-
|
|
17559
|
+
import_compare = __toESM(require("semver/functions/compare.js"));
|
|
17560
|
+
import_gt = __toESM(require("semver/functions/gt.js"));
|
|
17561
|
+
import_rcompare = __toESM(require("semver/functions/rcompare.js"));
|
|
17562
|
+
import_satisfies = __toESM(require("semver/functions/satisfies.js"));
|
|
17563
|
+
import_valid = __toESM(require("semver/functions/valid.js"));
|
|
17564
|
+
import_max_satisfying = __toESM(require("semver/ranges/max-satisfying.js"));
|
|
17565
|
+
import_valid2 = __toESM(require("semver/ranges/valid.js"));
|
|
17560
17566
|
}
|
|
17561
17567
|
});
|
|
17562
17568
|
|
|
@@ -17664,7 +17670,7 @@ var init_version_resolver = __esm({
|
|
|
17664
17670
|
};
|
|
17665
17671
|
}
|
|
17666
17672
|
}
|
|
17667
|
-
const resolved =
|
|
17673
|
+
const resolved = maxSatisfying(versions, specifier.range);
|
|
17668
17674
|
if (!resolved) {
|
|
17669
17675
|
throw new Error(
|
|
17670
17676
|
`No version of "${specifier.fullName}" satisfies range "${specifier.range}". Available versions: ${versions.slice(-5).join(", ")}${versions.length > 5 ? "..." : ""}`
|
|
@@ -17681,18 +17687,12 @@ var init_version_resolver = __esm({
|
|
|
17681
17687
|
});
|
|
17682
17688
|
|
|
17683
17689
|
// libs/sdk/src/esm-loader/esm-module-loader.ts
|
|
17684
|
-
|
|
17685
|
-
return import(
|
|
17686
|
-
/* webpackIgnore: true */
|
|
17687
|
-
/* @vite-ignore */
|
|
17688
|
-
specifier
|
|
17689
|
-
);
|
|
17690
|
-
}
|
|
17691
|
-
var import_utils47, EsmModuleLoader;
|
|
17690
|
+
var import_utils47, import_import_computed, EsmModuleLoader;
|
|
17692
17691
|
var init_esm_module_loader = __esm({
|
|
17693
17692
|
"libs/sdk/src/esm-loader/esm-module-loader.ts"() {
|
|
17694
17693
|
"use strict";
|
|
17695
17694
|
import_utils47 = require("@frontmcp/utils");
|
|
17695
|
+
import_import_computed = require("#import-computed");
|
|
17696
17696
|
init_esm_errors();
|
|
17697
17697
|
init_esm_manifest();
|
|
17698
17698
|
init_package_specifier();
|
|
@@ -17848,7 +17848,7 @@ var init_esm_module_loader = __esm({
|
|
|
17848
17848
|
*/
|
|
17849
17849
|
async importFromPath(filePath) {
|
|
17850
17850
|
const { pathToFileURL } = require("node:url");
|
|
17851
|
-
return importComputed(pathToFileURL(filePath).href);
|
|
17851
|
+
return (0, import_import_computed.importComputed)(pathToFileURL(filePath).href);
|
|
17852
17852
|
}
|
|
17853
17853
|
/**
|
|
17854
17854
|
* Import a bundle from its source text.
|
|
@@ -17877,7 +17877,7 @@ var init_esm_module_loader = __esm({
|
|
|
17877
17877
|
const blob = new Blob([bundleContent], { type: "text/javascript" });
|
|
17878
17878
|
const url = URL.createObjectURL(blob);
|
|
17879
17879
|
try {
|
|
17880
|
-
return await importComputed(url);
|
|
17880
|
+
return await (0, import_import_computed.importComputed)(url);
|
|
17881
17881
|
} finally {
|
|
17882
17882
|
URL.revokeObjectURL(url);
|
|
17883
17883
|
}
|
|
@@ -17892,7 +17892,7 @@ var init_esm_module_loader = __esm({
|
|
|
17892
17892
|
if (!await fileExists7(tempPath)) {
|
|
17893
17893
|
await writeFile(tempPath, bundleContent);
|
|
17894
17894
|
}
|
|
17895
|
-
return importComputed(pathToFileURL(tempPath).href);
|
|
17895
|
+
return (0, import_import_computed.importComputed)(pathToFileURL(tempPath).href);
|
|
17896
17896
|
}
|
|
17897
17897
|
};
|
|
17898
17898
|
}
|
|
@@ -18617,7 +18617,7 @@ var init_request_notifications = __esm({
|
|
|
18617
18617
|
/**
|
|
18618
18618
|
* Queue a log message.
|
|
18619
18619
|
*
|
|
18620
|
-
* Dropped outright when the client did not set `logLevel`
|
|
18620
|
+
* Dropped outright when the client did not set `logLevel` \u2014 the spec makes
|
|
18621
18621
|
* that a MUST NOT, not a preference.
|
|
18622
18622
|
*/
|
|
18623
18623
|
log(level, logger, data) {
|
|
@@ -19742,7 +19742,7 @@ var init_mcp_stateless_client = __esm({
|
|
|
19742
19742
|
* Poll a task handle to a terminal state, answering mid-flight input requests.
|
|
19743
19743
|
*
|
|
19744
19744
|
* Honours the server's `pollIntervalMs` hint rather than picking our own
|
|
19745
|
-
* cadence
|
|
19745
|
+
* cadence \u2014 the server knows how long its work takes.
|
|
19746
19746
|
*/
|
|
19747
19747
|
async awaitTask(task) {
|
|
19748
19748
|
const taskId = String(task["taskId"]);
|
|
@@ -20270,9 +20270,9 @@ var init_circuit_breaker = __esm({
|
|
|
20270
20270
|
nextAttemptTime: this.nextAttemptTime
|
|
20271
20271
|
};
|
|
20272
20272
|
}
|
|
20273
|
-
//
|
|
20273
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
20274
20274
|
// PRIVATE HELPERS
|
|
20275
|
-
//
|
|
20275
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
20276
20276
|
transitionTo(newState) {
|
|
20277
20277
|
if (this.state === newState) return;
|
|
20278
20278
|
const previousState = this.state;
|
|
@@ -20669,9 +20669,9 @@ var init_mcp_client_service = __esm({
|
|
|
20669
20669
|
}
|
|
20670
20670
|
});
|
|
20671
20671
|
}
|
|
20672
|
-
//
|
|
20672
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
20673
20673
|
// CONNECTION MANAGEMENT
|
|
20674
|
-
//
|
|
20674
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
20675
20675
|
/**
|
|
20676
20676
|
* Connect to a remote MCP server
|
|
20677
20677
|
*/
|
|
@@ -20810,9 +20810,9 @@ var init_mcp_client_service = __esm({
|
|
|
20810
20810
|
const connection = this.connections.get(appId);
|
|
20811
20811
|
return connection?.status === "connected";
|
|
20812
20812
|
}
|
|
20813
|
-
//
|
|
20813
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
20814
20814
|
// CAPABILITY DISCOVERY
|
|
20815
|
-
//
|
|
20815
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
20816
20816
|
/**
|
|
20817
20817
|
* Discover capabilities from a remote server
|
|
20818
20818
|
*/
|
|
@@ -20896,9 +20896,9 @@ var init_mcp_client_service = __esm({
|
|
|
20896
20896
|
const capabilities = await this.discoverCapabilities(appId);
|
|
20897
20897
|
return capabilities.prompts;
|
|
20898
20898
|
}
|
|
20899
|
-
//
|
|
20899
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
20900
20900
|
// PROXY EXECUTION
|
|
20901
|
-
//
|
|
20901
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
20902
20902
|
/**
|
|
20903
20903
|
* Call a tool on a remote server with self-healing
|
|
20904
20904
|
*/
|
|
@@ -21023,9 +21023,9 @@ var init_mcp_client_service = __esm({
|
|
|
21023
21023
|
throw this.authFailureOf(appId, error) ?? new RemotePromptGetError(appId, promptName, error);
|
|
21024
21024
|
}
|
|
21025
21025
|
}
|
|
21026
|
-
//
|
|
21026
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21027
21027
|
// EVENT SUBSCRIPTIONS
|
|
21028
|
-
//
|
|
21028
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21029
21029
|
/**
|
|
21030
21030
|
* Subscribe to capability change events
|
|
21031
21031
|
*/
|
|
@@ -21044,9 +21044,9 @@ var init_mcp_client_service = __esm({
|
|
|
21044
21044
|
this.connectionChangeCallbacks.delete(callback);
|
|
21045
21045
|
};
|
|
21046
21046
|
}
|
|
21047
|
-
//
|
|
21047
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21048
21048
|
// AUTH RESOLUTION
|
|
21049
|
-
//
|
|
21049
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21050
21050
|
/**
|
|
21051
21051
|
* Resolve authentication headers for a remote request
|
|
21052
21052
|
*/
|
|
@@ -21079,9 +21079,9 @@ var init_mcp_client_service = __esm({
|
|
|
21079
21079
|
return {};
|
|
21080
21080
|
}
|
|
21081
21081
|
}
|
|
21082
|
-
//
|
|
21082
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21083
21083
|
// CLEANUP
|
|
21084
|
-
//
|
|
21084
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21085
21085
|
/**
|
|
21086
21086
|
* Disconnect from all remote servers and clean up
|
|
21087
21087
|
*/
|
|
@@ -21104,9 +21104,9 @@ var init_mcp_client_service = __esm({
|
|
|
21104
21104
|
this.connectionChangeCallbacks.clear();
|
|
21105
21105
|
this.logger.info("McpClientService disposed");
|
|
21106
21106
|
}
|
|
21107
|
-
//
|
|
21107
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21108
21108
|
// PRIVATE HELPERS
|
|
21109
|
-
//
|
|
21109
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21110
21110
|
/** A call whose `remoteAuth` mapper failed, or whose credentials the remote refused (HTTP 401), fails with `RemoteAuthError`. */
|
|
21111
21111
|
authFailureOf(appId, error) {
|
|
21112
21112
|
if (error instanceof RemoteAuthError) return error;
|
|
@@ -21151,7 +21151,7 @@ var init_mcp_client_service = __esm({
|
|
|
21151
21151
|
* Build a 2026-07-28 connection when the remote is on that revision.
|
|
21152
21152
|
*
|
|
21153
21153
|
* Returns `undefined` for every other case so the legacy path below runs
|
|
21154
|
-
* completely untouched
|
|
21154
|
+
* completely untouched \u2014 the default for an unconfigured remote.
|
|
21155
21155
|
*/
|
|
21156
21156
|
async tryConnect2026(request, headers) {
|
|
21157
21157
|
const httpOptions = request.transportOptions;
|
|
@@ -21361,9 +21361,9 @@ var init_mcp_client_service = __esm({
|
|
|
21361
21361
|
return {};
|
|
21362
21362
|
}
|
|
21363
21363
|
}
|
|
21364
|
-
//
|
|
21364
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21365
21365
|
// SELF-HEALING HELPERS
|
|
21366
|
-
//
|
|
21366
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21367
21367
|
/**
|
|
21368
21368
|
* Schedule an auto-reconnect attempt for an app
|
|
21369
21369
|
*/
|
|
@@ -21443,9 +21443,9 @@ var init_mcp_client_service = __esm({
|
|
|
21443
21443
|
stopHealthCheck(appId) {
|
|
21444
21444
|
this.healthCheckManager.removeChecker(appId);
|
|
21445
21445
|
}
|
|
21446
|
-
//
|
|
21446
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21447
21447
|
// RESILIENCE STATUS
|
|
21448
|
-
//
|
|
21448
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
21449
21449
|
/**
|
|
21450
21450
|
* Get circuit breaker status for an app
|
|
21451
21451
|
*/
|
|
@@ -21860,7 +21860,7 @@ var init_prompt_registry = __esm({
|
|
|
21860
21860
|
listAllInstances() {
|
|
21861
21861
|
return this.listAllIndexed().map((r) => r.instance);
|
|
21862
21862
|
}
|
|
21863
|
-
/** Owner lineage (root
|
|
21863
|
+
/** Owner lineage (root \u2192 leaf) of a prompt this registry holds, or undefined when it holds none. */
|
|
21864
21864
|
lineageOf(entry) {
|
|
21865
21865
|
return this.lineages.lineageOf(entry);
|
|
21866
21866
|
}
|
|
@@ -23880,7 +23880,7 @@ var init_resource_registry = __esm({
|
|
|
23880
23880
|
listAllInstances() {
|
|
23881
23881
|
return this.listAllIndexed().map((r) => r.instance);
|
|
23882
23882
|
}
|
|
23883
|
-
/** Owner lineage (root
|
|
23883
|
+
/** Owner lineage (root \u2192 leaf) of a resource this registry holds, or undefined when it holds none. */
|
|
23884
23884
|
lineageOf(entry) {
|
|
23885
23885
|
return this.lineages.lineageOf(entry);
|
|
23886
23886
|
}
|
|
@@ -24138,7 +24138,7 @@ var init_resource_registry = __esm({
|
|
|
24138
24138
|
getCapabilities() {
|
|
24139
24139
|
return {
|
|
24140
24140
|
resources: {
|
|
24141
|
-
// Subscription support per MCP 2025-11-25 spec
|
|
24141
|
+
// Subscription support per MCP 2025-11-25 spec \u2014 only meaningful when
|
|
24142
24142
|
// there are registered resources.
|
|
24143
24143
|
subscribe: this.hasAny(),
|
|
24144
24144
|
listChanged: this.hasAny()
|
|
@@ -25031,7 +25031,7 @@ var init_tool_registry = __esm({
|
|
|
25031
25031
|
//
|
|
25032
25032
|
// AVAILABILITY FILTERING (registry-level, not HTTP/flow-level):
|
|
25033
25033
|
// `availableWhen` is evaluated against the process's RuntimeContext (OS, runtime, env).
|
|
25034
|
-
// This is a hard constraint
|
|
25034
|
+
// This is a hard constraint \u2014 unlike hideFromDiscovery (soft listing hide) or
|
|
25035
25035
|
// authorization (per-request in HTTP flows). Filtered entries cannot be listed or called.
|
|
25036
25036
|
getTools(includeHidden = false) {
|
|
25037
25037
|
const ctx = (0, import_utils59.getRuntimeContext)();
|
|
@@ -25108,7 +25108,7 @@ var init_tool_registry = __esm({
|
|
|
25108
25108
|
listAllInstances() {
|
|
25109
25109
|
return this.listAllIndexed().map((r) => r.instance);
|
|
25110
25110
|
}
|
|
25111
|
-
/** Owner lineage (root
|
|
25111
|
+
/** Owner lineage (root \u2192 leaf) of a tool this registry holds, or undefined when it holds none. */
|
|
25112
25112
|
lineageOf(entry) {
|
|
25113
25113
|
return this.lineages.lineageOf(entry);
|
|
25114
25114
|
}
|
|
@@ -25121,7 +25121,7 @@ var init_tool_registry = __esm({
|
|
|
25121
25121
|
* Produce unique, MCP-valid exported names.
|
|
25122
25122
|
* - Base (standardized) = metadata.name cased (snake/camel/kebab/dot)
|
|
25123
25123
|
* - If conflicting:
|
|
25124
|
-
* - Locals keep bare base (unless >1 locals conflict
|
|
25124
|
+
* - Locals keep bare base (unless >1 locals conflict \u2192 they get owner prefixes)
|
|
25125
25125
|
* - Children with same base get prefixed by providerId (or owner path)
|
|
25126
25126
|
*/
|
|
25127
25127
|
exportResolvedNames(opts) {
|
|
@@ -25389,7 +25389,7 @@ var init_tool_registry = __esm({
|
|
|
25389
25389
|
*
|
|
25390
25390
|
* Issue #407: we always advertise the `tools` capability so the MCP SDK
|
|
25391
25391
|
* accepts the always-registered `tools/list` handler (see
|
|
25392
|
-
* `createMcpHandlers`
|
|
25392
|
+
* `createMcpHandlers` \u2014 registering a handler without the matching
|
|
25393
25393
|
* capability throws `Server does not support tools (required for tools/list)`).
|
|
25394
25394
|
* `listChanged` still reflects whether anything is actually registered.
|
|
25395
25395
|
*/
|
|
@@ -28761,7 +28761,7 @@ var init_flow_instance = __esm({
|
|
|
28761
28761
|
* no-op so flows never mount as routes). It mirrors how Express dispatches:
|
|
28762
28762
|
* method + `middleware.path` (mounted as a prefix) + `canActivate`.
|
|
28763
28763
|
*
|
|
28764
|
-
* Only flows with a SPECIFIC matcher qualify
|
|
28764
|
+
* Only flows with a SPECIFIC matcher qualify \u2014 a `middleware.path` (e.g.
|
|
28765
28765
|
* `/oauth/token`) and/or a `canActivate` (static class method or
|
|
28766
28766
|
* `middleware.canActivate`, e.g. the well-known PRM path set). A bare
|
|
28767
28767
|
* `{ method }` middleware is too broad to safely claim an arbitrary request,
|
|
@@ -29745,7 +29745,7 @@ var init_execution_context_interface = __esm({
|
|
|
29745
29745
|
* blocks `tools/call` for tools with `metadata.visibility === 'internal'`.
|
|
29746
29746
|
* Public and hidden tools are reachable through this helper too.
|
|
29747
29747
|
*
|
|
29748
|
-
* Authority/authorization checks still run
|
|
29748
|
+
* Authority/authorization checks still run \u2014 an internal call carries the
|
|
29749
29749
|
* same `authInfo` as the surrounding request, so ABAC/RBAC guards apply.
|
|
29750
29750
|
*
|
|
29751
29751
|
* `availableWhen.surface`: the call carries {@link callToolSurface}. From a tool, resource or
|
|
@@ -29754,7 +29754,7 @@ var init_execution_context_interface = __esm({
|
|
|
29754
29754
|
* leaves that caller out answers as an unknown tool.
|
|
29755
29755
|
*
|
|
29756
29756
|
* @param name Tool name, or one qualified with its app's id: `owner:name` or `owner.name`.
|
|
29757
|
-
* @param args Tool arguments
|
|
29757
|
+
* @param args Tool arguments \u2014 validated by the tool's input schema.
|
|
29758
29758
|
* @param opts Optional progress token / abort signal forwarded into `_meta`.
|
|
29759
29759
|
* @returns The tool's `CallToolResult`.
|
|
29760
29760
|
*/
|
|
@@ -29875,13 +29875,13 @@ var init_execution_context_interface = __esm({
|
|
|
29875
29875
|
}
|
|
29876
29876
|
// ---- Platform bindings ----
|
|
29877
29877
|
/**
|
|
29878
|
-
* The hosting platform's bindings for the current request
|
|
29878
|
+
* The hosting platform's bindings for the current request \u2014 on a Cloudflare Worker, the `env`
|
|
29879
29879
|
* object holding KV namespaces, D1 databases, R2 buckets, Durable Object namespaces, `[vars]`
|
|
29880
29880
|
* and secrets. `undefined` where the request carries no such object: Node/Express and stdio.
|
|
29881
29881
|
*
|
|
29882
29882
|
* A direct server (`create()`, `FrontMcpInstance.createDirect()`, `connect()`) has the bindings
|
|
29883
29883
|
* its caller passes: `DirectCallOptions.workerEnv` for one call, `ConnectOptions.workerEnv` for a
|
|
29884
|
-
* client, or the server-wide default `create({ workerEnv })`
|
|
29884
|
+
* client, or the server-wide default `create({ workerEnv })` \u2014 so a server embedded in a Durable
|
|
29885
29885
|
* Object, queue consumer or custom route reaches its KV, D1 and R2. `undefined` when none is passed.
|
|
29886
29886
|
*
|
|
29887
29887
|
* The SDK never writes `process.env`. The Worker entry that `frontmcp build --target cloudflare`
|
|
@@ -31352,7 +31352,7 @@ var init_memory_skill_provider = __esm({
|
|
|
31352
31352
|
return new TFIDFVectoria(dbConfig);
|
|
31353
31353
|
}
|
|
31354
31354
|
/**
|
|
31355
|
-
* Attach (or replace) the snapshot cache after construction
|
|
31355
|
+
* Attach (or replace) the snapshot cache after construction \u2014 useful when the
|
|
31356
31356
|
* cache binding only exists at request time (e.g. a Cloudflare KV namespace on
|
|
31357
31357
|
* `env`). Marks the index stale so the next search consults the new cache.
|
|
31358
31358
|
*/
|
|
@@ -31374,7 +31374,7 @@ var init_memory_skill_provider = __esm({
|
|
|
31374
31374
|
* vector DB supports snapshots, a content-hash hit restores the index without
|
|
31375
31375
|
* recomputing IDF/embeddings (the cold-start fast path); a miss rebuilds and
|
|
31376
31376
|
* persists the snapshot for next time. Cache failures degrade to a local
|
|
31377
|
-
* rebuild
|
|
31377
|
+
* rebuild \u2014 they never block search.
|
|
31378
31378
|
*/
|
|
31379
31379
|
async ensureIndexed() {
|
|
31380
31380
|
if (this.indexReady) return;
|
|
@@ -31871,11 +31871,11 @@ var init_skill_registry = __esm({
|
|
|
31871
31871
|
scope;
|
|
31872
31872
|
/** Registry-level options for validation behavior */
|
|
31873
31873
|
options;
|
|
31874
|
-
/** SEP-2640
|
|
31874
|
+
/** SEP-2640 \u00a7Discovery \u2014 additional `mcp-resource-template` index entries. */
|
|
31875
31875
|
sep2640IndexTemplates = [];
|
|
31876
|
-
/** SEP-2640 ADR
|
|
31876
|
+
/** SEP-2640 ADR \u2014 additional `archive` index entries. */
|
|
31877
31877
|
sep2640IndexArchives = [];
|
|
31878
|
-
/** SEP-2640
|
|
31878
|
+
/** SEP-2640 \u00a7Discovery \u2014 extra `skill://` URIs to surface in server `instructions`. */
|
|
31879
31879
|
sep2640InstructionUris = [];
|
|
31880
31880
|
constructor(providers, list, owner, options) {
|
|
31881
31881
|
super("SkillRegistry", providers, list, false);
|
|
@@ -32088,7 +32088,7 @@ var init_skill_registry = __esm({
|
|
|
32088
32088
|
return skills;
|
|
32089
32089
|
}
|
|
32090
32090
|
/**
|
|
32091
|
-
* Get the "executable" subset
|
|
32091
|
+
* Get the "executable" subset \u2014 skills that declare at least one tool OR
|
|
32092
32092
|
* at least one referenced openapi operation. These are the skills
|
|
32093
32093
|
* `codecall:searchSkills` ranks. Honours hidden-filtering + availability
|
|
32094
32094
|
* gating like {@link getSkills}.
|
|
@@ -32097,7 +32097,7 @@ var init_skill_registry = __esm({
|
|
|
32097
32097
|
return this.getSkills(opts).filter((s) => s.isExecutable());
|
|
32098
32098
|
}
|
|
32099
32099
|
/**
|
|
32100
|
-
* Get the "knowledge-only" subset
|
|
32100
|
+
* Get the "knowledge-only" subset \u2014 skills with no tools and no
|
|
32101
32101
|
* referenced openapi operations. These are the skills
|
|
32102
32102
|
* `codecall:searchKnowledge` ranks. Honours hidden-filtering + availability
|
|
32103
32103
|
* gating like {@link getSkills}.
|
|
@@ -32129,13 +32129,13 @@ var init_skill_registry = __esm({
|
|
|
32129
32129
|
* Always merges the dynamic-skill overlay on top of the storage provider's
|
|
32130
32130
|
* results. For ids present in `dynamicContents`, the provider's score and
|
|
32131
32131
|
* ranking are preserved, but the metadata is replaced with the dynamic
|
|
32132
|
-
* projection
|
|
32132
|
+
* projection \u2014 otherwise a stale provider row (from a re-registration whose
|
|
32133
32133
|
* provider update lagged or failed) would mask the newer dynamic content.
|
|
32134
32134
|
* Provider-only rows pass through unchanged; overlay-only rows are appended.
|
|
32135
32135
|
*/
|
|
32136
32136
|
/**
|
|
32137
32137
|
* Attach (or replace) the snapshot cache used to persist/restore the search
|
|
32138
|
-
* index
|
|
32138
|
+
* index \u2014 for runtimes where the cache binding only exists at request time
|
|
32139
32139
|
* (e.g. a Cloudflare KV namespace on `env`). No-op if the storage provider
|
|
32140
32140
|
* doesn't support index caching. Pair with {@link warmIndex} to build/restore
|
|
32141
32141
|
* the index off the first request's critical path.
|
|
@@ -32323,7 +32323,7 @@ var init_skill_registry = __esm({
|
|
|
32323
32323
|
}
|
|
32324
32324
|
}
|
|
32325
32325
|
/**
|
|
32326
|
-
* Owner lineage (root
|
|
32326
|
+
* Owner lineage (root \u2192 leaf) of a skill, or undefined when no row holds it. A skill a plugin
|
|
32327
32327
|
* contributes is owned by the plugin; its lineage names the app the plugin is installed on.
|
|
32328
32328
|
*/
|
|
32329
32329
|
lineageOf(entry) {
|
|
@@ -32505,7 +32505,7 @@ var init_skill_registry = __esm({
|
|
|
32505
32505
|
};
|
|
32506
32506
|
}
|
|
32507
32507
|
/**
|
|
32508
|
-
* SEP-2640
|
|
32508
|
+
* SEP-2640 \u00a7Discovery: extra resource-template entries to include in
|
|
32509
32509
|
* `skill://index.json` for parameterised skill namespaces. Default is
|
|
32510
32510
|
* empty; hosts populate this via {@link addSep2640IndexTemplate}.
|
|
32511
32511
|
*/
|
|
@@ -32538,7 +32538,7 @@ var init_skill_registry = __esm({
|
|
|
32538
32538
|
this.bump("reset");
|
|
32539
32539
|
}
|
|
32540
32540
|
/**
|
|
32541
|
-
* SEP-2640
|
|
32541
|
+
* SEP-2640 \u00a7Discovery \u2014 opt-in pointer to skill URIs from the server's
|
|
32542
32542
|
* `instructions` field. When non-empty, the transport adapter prepends a
|
|
32543
32543
|
* "Available skills:" block listing the URIs.
|
|
32544
32544
|
*/
|
|
@@ -35471,7 +35471,7 @@ var init_agent_registry = __esm({
|
|
|
35471
35471
|
return [...this.localRows, ...[...this.adopted.values()].flat()];
|
|
35472
35472
|
}
|
|
35473
35473
|
/**
|
|
35474
|
-
* List all instances (locals + adopted)
|
|
35474
|
+
* List all instances (locals + adopted) \u2014 unfiltered.
|
|
35475
35475
|
*/
|
|
35476
35476
|
listAllInstances() {
|
|
35477
35477
|
return this.listAllIndexed().map((r) => r.instance);
|
|
@@ -36199,9 +36199,9 @@ var init_app_esm_instance = __esm({
|
|
|
36199
36199
|
throw error;
|
|
36200
36200
|
}
|
|
36201
36201
|
}
|
|
36202
|
-
//
|
|
36202
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
36203
36203
|
// PUBLIC API
|
|
36204
|
-
//
|
|
36204
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
36205
36205
|
get providers() {
|
|
36206
36206
|
return this.scopeProviders;
|
|
36207
36207
|
}
|
|
@@ -36253,9 +36253,9 @@ var init_app_esm_instance = __esm({
|
|
|
36253
36253
|
async dispose() {
|
|
36254
36254
|
this.poller?.stop();
|
|
36255
36255
|
}
|
|
36256
|
-
//
|
|
36256
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
36257
36257
|
// PRIVATE METHODS
|
|
36258
|
-
//
|
|
36258
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
36259
36259
|
/**
|
|
36260
36260
|
* Register primitives from a loaded package manifest into standard registries.
|
|
36261
36261
|
*/
|
|
@@ -36689,9 +36689,9 @@ var init_app_remote_instance = __esm({
|
|
|
36689
36689
|
throw error;
|
|
36690
36690
|
}
|
|
36691
36691
|
}
|
|
36692
|
-
//
|
|
36692
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
36693
36693
|
// LAZY CAPABILITY LOADING
|
|
36694
|
-
//
|
|
36694
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
36695
36695
|
/**
|
|
36696
36696
|
* Ensure capabilities are loaded, using cache if available.
|
|
36697
36697
|
* This is called lazily when tools/resources/prompts are accessed.
|
|
@@ -36719,9 +36719,9 @@ var init_app_remote_instance = __esm({
|
|
|
36719
36719
|
this.capabilitiesLoaded = false;
|
|
36720
36720
|
await this.ensureCapabilitiesLoaded();
|
|
36721
36721
|
}
|
|
36722
|
-
//
|
|
36722
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
36723
36723
|
// PUBLIC API
|
|
36724
|
-
//
|
|
36724
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
36725
36725
|
get providers() {
|
|
36726
36726
|
return this.scopeProviders;
|
|
36727
36727
|
}
|
|
@@ -36791,9 +36791,9 @@ var init_app_remote_instance = __esm({
|
|
|
36791
36791
|
this.capabilitiesLoaded = false;
|
|
36792
36792
|
this.capabilityCache.invalidate(this.id);
|
|
36793
36793
|
}
|
|
36794
|
-
//
|
|
36794
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
36795
36795
|
// PRIVATE METHODS
|
|
36796
|
-
//
|
|
36796
|
+
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
36797
36797
|
/**
|
|
36798
36798
|
* Map urlType to transport type
|
|
36799
36799
|
*/
|
|
@@ -42140,7 +42140,7 @@ var init_channel_interface = __esm({
|
|
|
42140
42140
|
}
|
|
42141
42141
|
/**
|
|
42142
42142
|
* Push an incoming event from a service connection into the notification pipeline.
|
|
42143
|
-
* This triggers `onEvent()`
|
|
42143
|
+
* This triggers `onEvent()` \u2192 notification push to all capable Claude Code sessions.
|
|
42144
42144
|
*
|
|
42145
42145
|
* Use this inside `onConnect()` when you receive events from persistent connections
|
|
42146
42146
|
* (WebSocket messages, polling results, etc.).
|
|
@@ -42331,7 +42331,7 @@ var init_decide_request_intent_utils = __esm({
|
|
|
42331
42331
|
import_lazy_zod71.z.literal("delete-session"),
|
|
42332
42332
|
// Protocol 2026-07-28: stateless, sessionless, per-request version negotiation.
|
|
42333
42333
|
// Decided by the router from the request's headers/`_meta`, not by the bitmap
|
|
42334
|
-
// rules below
|
|
42334
|
+
// rules below \u2014 those describe the session-oriented transports only.
|
|
42335
42335
|
import_lazy_zod71.z.literal("mcp-20260728"),
|
|
42336
42336
|
import_lazy_zod71.z.literal("unknown")
|
|
42337
42337
|
]);
|
|
@@ -42371,7 +42371,7 @@ var init_decide_request_intent_utils = __esm({
|
|
|
42371
42371
|
wantsJSON = (accept) => (accept ?? "").toLowerCase().includes("application/json");
|
|
42372
42372
|
isInitialize = (body) => !!body && typeof body === "object" && body.method === "initialize";
|
|
42373
42373
|
RULES = [
|
|
42374
|
-
// A) Legacy SSE via GET /sse path (without session)
|
|
42374
|
+
// A) Legacy SSE via GET /sse path (without session) \u2192 requires legacy enabled
|
|
42375
42375
|
{
|
|
42376
42376
|
care: CH_MASK | B_HAS_SESSION | B_LEGACY_EN,
|
|
42377
42377
|
match: CH_GET_SSE_PATH | B_LEGACY_EN,
|
|
@@ -42387,7 +42387,7 @@ var init_decide_request_intent_utils = __esm({
|
|
|
42387
42387
|
recommendation: { httpStatus: 405, message: "Legacy SSE disabled" }
|
|
42388
42388
|
}
|
|
42389
42389
|
},
|
|
42390
|
-
// A2) GET / + SSE (not /sse path) with session ID
|
|
42390
|
+
// A2) GET / + SSE (not /sse path) with session ID \u2192 SSE listener for streamable-http
|
|
42391
42391
|
// Per MCP 2025-11-25 spec, clients can open SSE stream via GET with session ID
|
|
42392
42392
|
{
|
|
42393
42393
|
care: CH_MASK | B_HAS_SESSION | B_SSE_LISTENER_EN | B_STREAMABLE_EN,
|
|
@@ -42404,7 +42404,7 @@ var init_decide_request_intent_utils = __esm({
|
|
|
42404
42404
|
recommendation: { httpStatus: 405, message: "SSE listener disabled" }
|
|
42405
42405
|
}
|
|
42406
42406
|
},
|
|
42407
|
-
// A2c) GET / + SSE without session
|
|
42407
|
+
// A2c) GET / + SSE without session \u2192 forward to next middleware
|
|
42408
42408
|
{
|
|
42409
42409
|
care: CH_MASK | B_HAS_SESSION,
|
|
42410
42410
|
match: CH_GET_SSE,
|
|
@@ -42428,7 +42428,7 @@ var init_decide_request_intent_utils = __esm({
|
|
|
42428
42428
|
recommendation: { httpStatus: 405, message: "Legacy SSE disabled" }
|
|
42429
42429
|
}
|
|
42430
42430
|
},
|
|
42431
|
-
// C) Modern SSE (GET /sse with session)
|
|
42431
|
+
// C) Modern SSE (GET /sse with session) \u2192 requires SSE listener enabled
|
|
42432
42432
|
{
|
|
42433
42433
|
care: CH_MASK | B_SSE_LISTENER_EN | B_HAS_SESSION,
|
|
42434
42434
|
match: CH_GET_SSE_PATH | B_HAS_SESSION,
|
|
@@ -42443,10 +42443,10 @@ var init_decide_request_intent_utils = __esm({
|
|
|
42443
42443
|
match: CH_GET_SSE_PATH | B_SSE_LISTENER_EN | B_HAS_SESSION,
|
|
42444
42444
|
outcome: { intent: "sse", reason: "GET /sse with Mcp-Session-Id." }
|
|
42445
42445
|
},
|
|
42446
|
-
// D) Initialize (POST
|
|
42446
|
+
// D) Initialize (POST \u2192 SSE)
|
|
42447
42447
|
// D1) Stateless initialize (no session, stateless enabled, streamable NOT enabled)
|
|
42448
42448
|
// When streamable is also enabled, prefer streamable-http (which creates a session).
|
|
42449
|
-
// Per MCP spec, first initialize naturally has no session
|
|
42449
|
+
// Per MCP spec, first initialize naturally has no session \u2014 stateless should only
|
|
42450
42450
|
// match when it's the sole enabled protocol.
|
|
42451
42451
|
{
|
|
42452
42452
|
care: CH_MASK | B_HAS_SESSION | B_STATELESS_EN | B_STREAMABLE_EN,
|
|
@@ -42467,7 +42467,7 @@ var init_decide_request_intent_utils = __esm({
|
|
|
42467
42467
|
match: CH_POST_INIT_SSE | B_STREAMABLE_EN,
|
|
42468
42468
|
outcome: { intent: "streamable-http", reason: "Initialize with SSE." }
|
|
42469
42469
|
},
|
|
42470
|
-
// E) Initialize (POST
|
|
42470
|
+
// E) Initialize (POST \u2192 JSON)
|
|
42471
42471
|
// E1) Stateless initialize JSON (no session, stateless enabled, streamable NOT enabled)
|
|
42472
42472
|
{
|
|
42473
42473
|
care: CH_MASK | B_HAS_SESSION | B_STATELESS_EN | B_STREAMABLE_EN,
|
|
@@ -42488,7 +42488,7 @@ var init_decide_request_intent_utils = __esm({
|
|
|
42488
42488
|
match: CH_POST_INIT_JSON | B_STREAMABLE_EN,
|
|
42489
42489
|
outcome: { intent: "stateful-http", reason: "Initialize with JSON." }
|
|
42490
42490
|
},
|
|
42491
|
-
// F) POST non-init
|
|
42491
|
+
// F) POST non-init \u2192 SSE
|
|
42492
42492
|
{
|
|
42493
42493
|
care: CH_MASK | B_REQ_SESSION | B_HAS_SESSION | B_STATELESS_EN,
|
|
42494
42494
|
match: CH_POST_SSE | B_REQ_SESSION,
|
|
@@ -42518,7 +42518,7 @@ var init_decide_request_intent_utils = __esm({
|
|
|
42518
42518
|
match: CH_POST_SSE,
|
|
42519
42519
|
outcome: { intent: "streamable-http", reason: "Short-lived SSE for this request." }
|
|
42520
42520
|
},
|
|
42521
|
-
// G) POST non-init
|
|
42521
|
+
// G) POST non-init \u2192 JSON
|
|
42522
42522
|
{
|
|
42523
42523
|
care: CH_MASK | B_REQ_SESSION | B_HAS_SESSION | B_STATELESS_EN,
|
|
42524
42524
|
match: CH_POST_JSON | B_REQ_SESSION,
|
|
@@ -42780,13 +42780,13 @@ var init_primary_auth_provider_interface = __esm({
|
|
|
42780
42780
|
}
|
|
42781
42781
|
/**
|
|
42782
42782
|
* Cryptographically verify a gateway-issued access token (public/local/remote
|
|
42783
|
-
* "gateway" modes
|
|
42783
|
+
* "gateway" modes \u2014 i.e. NOT transparent). Gateway tokens are signed by this
|
|
42784
42784
|
* instance, so the instance is the only place that holds the verification key.
|
|
42785
42785
|
*
|
|
42786
42786
|
* The base implementation rejects everything: only auth instances that
|
|
42787
42787
|
* actually mint gateway tokens (i.e. {@link LocalPrimaryAuth}) override this
|
|
42788
42788
|
* with a real signature + expiration check. Transparent mode never calls this
|
|
42789
|
-
*
|
|
42789
|
+
* \u2014 it verifies against the upstream provider's JWKS instead.
|
|
42790
42790
|
*
|
|
42791
42791
|
* @param _token The raw bearer token (already confirmed to be a JWT).
|
|
42792
42792
|
* @param _requestBaseUrl The request-derived base URL, for context / logging.
|
|
@@ -43895,12 +43895,12 @@ __export(web_standard_mcp_exports, {
|
|
|
43895
43895
|
runWebStandardMcp: () => runWebStandardMcp
|
|
43896
43896
|
});
|
|
43897
43897
|
async function wireServer(scope, serverOptions, sessionId, sessionIdGenerator, enableJsonResponse) {
|
|
43898
|
-
const { McpServer:
|
|
43898
|
+
const { McpServer: McpServer3, WebStandardStreamableHTTPServerTransport: WebStandardStreamableHTTPServerTransport2 } = await importWithRequireFallback(
|
|
43899
43899
|
() => import("@frontmcp/protocol"),
|
|
43900
43900
|
() => require("@frontmcp/protocol")
|
|
43901
43901
|
);
|
|
43902
43902
|
const { createMcpHandlers: createMcpHandlers2 } = await Promise.resolve().then(() => (init_mcp_handlers(), mcp_handlers_exports));
|
|
43903
|
-
const mcpServer = new
|
|
43903
|
+
const mcpServer = new McpServer3(scope.metadata.info, serverOptions);
|
|
43904
43904
|
const composeInstructions = (caller) => composeCallerInstructions(scope, { ctx: caller, skillUriHints: true });
|
|
43905
43905
|
for (const handler of createMcpHandlers2({ scope, serverOptions, composeInstructions })) {
|
|
43906
43906
|
const originalHandler = handler.handler;
|
|
@@ -44004,7 +44004,7 @@ var init_http_request_flow = __esm({
|
|
|
44004
44004
|
// it: anyone else presenting its id is answered as an unknown session. First,
|
|
44005
44005
|
// before every protocol handler (2026-07-28 included), so none can serve it.
|
|
44006
44006
|
"checkPersistentSessionOwner",
|
|
44007
|
-
// Protocol 2026-07-28. Runs before EVERY session-era handler
|
|
44007
|
+
// Protocol 2026-07-28. Runs before EVERY session-era handler \u2014 including
|
|
44008
44008
|
// `handleWebFetch`, which answers any request carrying a Web `Request`
|
|
44009
44009
|
// regardless of intent and would otherwise swallow 2026 traffic on a
|
|
44010
44010
|
// Cloudflare Worker. Its output (`json` / `text` / `sse`) renders on both
|
|
@@ -44204,12 +44204,12 @@ var init_http_request_flow = __esm({
|
|
|
44204
44204
|
* and register it under {@link ORCHESTRATED_AUTH_ACCESSOR} so tools can read
|
|
44205
44205
|
* upstream provider tokens via `this.orchestration.getToken(id)`.
|
|
44206
44206
|
*
|
|
44207
|
-
* `session:verify` returns a lightweight authorization (`{ token, user,
|
|
44207
|
+
* `session:verify` returns a lightweight authorization (`{ token, user, \u2026 }`)
|
|
44208
44208
|
* rather than a full OrchestratedAuthorization, so we reconstruct one here from
|
|
44209
44209
|
* the verified JWT + the primary auth's encrypted token store (the same store
|
|
44210
44210
|
* the federated provider-callback flow wrote upstream tokens into, keyed by
|
|
44211
44211
|
* `deriveAuthorizationId(token)`). No-op unless the scope is in orchestrated
|
|
44212
|
-
* mode with a token store and a non-empty bearer token
|
|
44212
|
+
* mode with a token store and a non-empty bearer token \u2014 so public/transparent
|
|
44213
44213
|
* and anonymous requests are unaffected.
|
|
44214
44214
|
*
|
|
44215
44215
|
* Security: tokens stay server-side and AES-GCM-encrypted at rest; only the
|
|
@@ -44840,43 +44840,23 @@ var require_dist = __commonJS({
|
|
|
44840
44840
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
44841
44841
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
44842
44842
|
var __export2 = (target, all) => {
|
|
44843
|
-
for (var name48 in all)
|
|
44844
|
-
__defProp2(target, name48, { get: all[name48], enumerable: true });
|
|
44843
|
+
for (var name48 in all) __defProp2(target, name48, { get: all[name48], enumerable: true });
|
|
44845
44844
|
};
|
|
44846
44845
|
var __copyProps2 = (to, from, except, desc) => {
|
|
44847
44846
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
44848
|
-
for (let key of __getOwnPropNames2(from))
|
|
44849
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
44850
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
44847
|
+
for (let key of __getOwnPropNames2(from)) if (!__hasOwnProp2.call(to, key) && key !== except) __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
44851
44848
|
}
|
|
44852
44849
|
return to;
|
|
44853
44850
|
};
|
|
44854
44851
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
44855
44852
|
var index_exports2 = {};
|
|
44856
|
-
__export2(index_exports2, {
|
|
44857
|
-
SqliteDecryptionError: () => SqliteDecryptionError,
|
|
44858
|
-
SqliteElicitationStore: () => SqliteElicitationStore,
|
|
44859
|
-
SqliteEventStore: () => SqliteEventStore,
|
|
44860
|
-
SqliteKvStore: () => SqliteKvStore,
|
|
44861
|
-
SqliteSessionStore: () => SqliteSessionStore,
|
|
44862
|
-
SqliteStorageAdapter: () => SqliteStorageAdapter,
|
|
44863
|
-
SqliteTaskStore: () => SqliteTaskStore,
|
|
44864
|
-
decryptValue: () => decryptValue,
|
|
44865
|
-
deriveEncryptionKey: () => deriveEncryptionKey,
|
|
44866
|
-
encryptValue: () => encryptValue,
|
|
44867
|
-
loadBetterSqlite3: () => loadBetterSqlite3,
|
|
44868
|
-
openDatabase: () => openDatabase,
|
|
44869
|
-
sqliteStorageOptionsSchema: () => sqliteStorageOptionsSchema,
|
|
44870
|
-
withBusyRetry: () => withBusyRetry
|
|
44871
|
-
});
|
|
44853
|
+
__export2(index_exports2, { SqliteDecryptionError: () => SqliteDecryptionError, SqliteElicitationStore: () => SqliteElicitationStore, SqliteEventStore: () => SqliteEventStore, SqliteKvStore: () => SqliteKvStore, SqliteSessionStore: () => SqliteSessionStore, SqliteStorageAdapter: () => SqliteStorageAdapter, SqliteTaskStore: () => SqliteTaskStore, decryptValue: () => decryptValue, deriveEncryptionKey: () => deriveEncryptionKey, encryptValue: () => encryptValue, loadBetterSqlite3: () => loadBetterSqlite3, openDatabase: () => openDatabase, sqliteStorageOptionsSchema: () => sqliteStorageOptionsSchema, withBusyRetry: () => withBusyRetry });
|
|
44872
44854
|
module2.exports = __toCommonJS2(index_exports2);
|
|
44873
44855
|
var import_utils144 = require("@frontmcp/utils");
|
|
44874
44856
|
var SqliteDecryptionError = class extends Error {
|
|
44875
44857
|
code = "SQLITE_DECRYPTION_FAILED";
|
|
44876
44858
|
constructor() {
|
|
44877
|
-
super(
|
|
44878
|
-
"SqliteKvStore: failed to decrypt a stored value. The encryption secret differs from the one the database was written with (or the value is corrupted). Restore the original secret, or delete the database file to start empty."
|
|
44879
|
-
);
|
|
44859
|
+
super("SqliteKvStore: failed to decrypt a stored value. The encryption secret differs from the one the database was written with (or the value is corrupted). Restore the original secret, or delete the database file to start empty.");
|
|
44880
44860
|
this.name = "SqliteDecryptionError";
|
|
44881
44861
|
}
|
|
44882
44862
|
};
|
|
@@ -44948,9 +44928,7 @@ var require_dist = __commonJS({
|
|
|
44948
44928
|
(0, import_utils210.ensureDirSync)(dir);
|
|
44949
44929
|
} catch (err) {
|
|
44950
44930
|
const message = err instanceof Error ? err.message : String(err);
|
|
44951
|
-
throw new Error(`${storeName}: failed to create directory "${dir}" for database "${path}": ${message}`, {
|
|
44952
|
-
cause: err
|
|
44953
|
-
});
|
|
44931
|
+
throw new Error(`${storeName}: failed to create directory "${dir}" for database "${path}": ${message}`, { cause: err });
|
|
44954
44932
|
}
|
|
44955
44933
|
}
|
|
44956
44934
|
}
|
|
@@ -44977,10 +44955,7 @@ var require_dist = __commonJS({
|
|
|
44977
44955
|
cleanupTimer = null;
|
|
44978
44956
|
stmts = null;
|
|
44979
44957
|
constructor(options) {
|
|
44980
|
-
this.db = openDatabase(options.path, "SqliteKvStore", {
|
|
44981
|
-
busyTimeoutMs: options.busyTimeoutMs,
|
|
44982
|
-
walMode: options.walMode !== false
|
|
44983
|
-
});
|
|
44958
|
+
this.db = openDatabase(options.path, "SqliteKvStore", { busyTimeoutMs: options.busyTimeoutMs, walMode: options.walMode !== false });
|
|
44984
44959
|
if (options.encryption?.secret) {
|
|
44985
44960
|
this.encryptionKey = deriveEncryptionKey(options.encryption.secret);
|
|
44986
44961
|
}
|
|
@@ -45005,35 +44980,14 @@ var require_dist = __commonJS({
|
|
|
45005
44980
|
`);
|
|
45006
44981
|
}
|
|
45007
44982
|
prepareStatements() {
|
|
45008
|
-
this.stmts = {
|
|
45009
|
-
get: this.db.prepare("SELECT value, expires_at FROM kv WHERE key = ?"),
|
|
45010
|
-
set: this.db.prepare("INSERT OR REPLACE INTO kv (key, value, expires_at) VALUES (?, ?, ?)"),
|
|
45011
|
-
del: this.db.prepare("DELETE FROM kv WHERE key = ?"),
|
|
45012
|
-
has: this.db.prepare("SELECT 1 FROM kv WHERE key = ? AND (expires_at IS NULL OR expires_at > ?)"),
|
|
45013
|
-
keys: this.db.prepare("SELECT key FROM kv WHERE (expires_at IS NULL OR expires_at > ?)"),
|
|
45014
|
-
keysPattern: this.db.prepare(
|
|
45015
|
-
// ESCAPE '\' lets callers (e.g. SqliteStorageAdapter.keys) escape literal
|
|
45016
|
-
// `%`/`_` as `\%`/`\_`; without it SQLite treats the backslash literally.
|
|
45017
|
-
"SELECT key FROM kv WHERE key LIKE ? ESCAPE '\\' AND (expires_at IS NULL OR expires_at > ?)"
|
|
45018
|
-
),
|
|
45019
|
-
cleanup: this.db.prepare("DELETE FROM kv WHERE expires_at IS NOT NULL AND expires_at <= ?"),
|
|
45020
|
-
ttl: this.db.prepare("SELECT expires_at FROM kv WHERE key = ?"),
|
|
45021
|
-
expire: this.db.prepare("UPDATE kv SET expires_at = ? WHERE key = ?")
|
|
45022
|
-
};
|
|
44983
|
+
this.stmts = { get: this.db.prepare("SELECT value, expires_at FROM kv WHERE key = ?"), set: this.db.prepare("INSERT OR REPLACE INTO kv (key, value, expires_at) VALUES (?, ?, ?)"), del: this.db.prepare("DELETE FROM kv WHERE key = ?"), has: this.db.prepare("SELECT 1 FROM kv WHERE key = ? AND (expires_at IS NULL OR expires_at > ?)"), keys: this.db.prepare("SELECT key FROM kv WHERE (expires_at IS NULL OR expires_at > ?)"), keysPattern: this.db.prepare("SELECT key FROM kv WHERE key LIKE ? ESCAPE '\\' AND (expires_at IS NULL OR expires_at > ?)"), cleanup: this.db.prepare("DELETE FROM kv WHERE expires_at IS NOT NULL AND expires_at <= ?"), ttl: this.db.prepare("SELECT expires_at FROM kv WHERE key = ?"), expire: this.db.prepare("UPDATE kv SET expires_at = ? WHERE key = ?") };
|
|
45023
44984
|
}
|
|
45024
|
-
/**
|
|
45025
|
-
* Return prepared statements, throwing if not yet initialized.
|
|
45026
|
-
*/
|
|
45027
44985
|
prepared() {
|
|
45028
44986
|
if (!this.stmts) {
|
|
45029
44987
|
throw new Error("SqliteKvStore: prepared statements not initialized. Was prepareStatements() called?");
|
|
45030
44988
|
}
|
|
45031
44989
|
return this.stmts;
|
|
45032
44990
|
}
|
|
45033
|
-
/**
|
|
45034
|
-
* Get a value by key.
|
|
45035
|
-
* Returns null if key doesn't exist or is expired.
|
|
45036
|
-
*/
|
|
45037
44991
|
get(key) {
|
|
45038
44992
|
const stmts = this.prepared();
|
|
45039
44993
|
const row = stmts.get.get(key);
|
|
@@ -45047,9 +45001,6 @@ var require_dist = __commonJS({
|
|
|
45047
45001
|
}
|
|
45048
45002
|
return row.value;
|
|
45049
45003
|
}
|
|
45050
|
-
/**
|
|
45051
|
-
* Get a value and parse it as JSON.
|
|
45052
|
-
*/
|
|
45053
45004
|
getJSON(key) {
|
|
45054
45005
|
const value = this.get(key);
|
|
45055
45006
|
if (value === null) return null;
|
|
@@ -45059,44 +45010,21 @@ var require_dist = __commonJS({
|
|
|
45059
45010
|
return null;
|
|
45060
45011
|
}
|
|
45061
45012
|
}
|
|
45062
|
-
/**
|
|
45063
|
-
* Set a key-value pair with optional TTL.
|
|
45064
|
-
*
|
|
45065
|
-
* @param key - The key
|
|
45066
|
-
* @param value - The value to store
|
|
45067
|
-
* @param ttlMs - Time to live in milliseconds (optional)
|
|
45068
|
-
*/
|
|
45069
45013
|
set(key, value, ttlMs) {
|
|
45070
45014
|
const expiresAt = ttlMs !== void 0 ? Date.now() + ttlMs : null;
|
|
45071
45015
|
const storedValue = this.encryptionKey ? encryptValue(this.encryptionKey, value) : value;
|
|
45072
45016
|
this.prepared().set.run(key, storedValue, expiresAt);
|
|
45073
45017
|
}
|
|
45074
|
-
/**
|
|
45075
|
-
* Set a key-value pair with JSON serialization and optional TTL.
|
|
45076
|
-
*/
|
|
45077
45018
|
setJSON(key, value, ttlMs) {
|
|
45078
45019
|
this.set(key, JSON.stringify(value), ttlMs);
|
|
45079
45020
|
}
|
|
45080
|
-
/**
|
|
45081
|
-
* Delete a key.
|
|
45082
|
-
*/
|
|
45083
45021
|
del(key) {
|
|
45084
45022
|
this.prepared().del.run(key);
|
|
45085
45023
|
}
|
|
45086
|
-
/**
|
|
45087
|
-
* Check if a key exists (and is not expired).
|
|
45088
|
-
*/
|
|
45089
45024
|
has(key) {
|
|
45090
45025
|
const row = this.prepared().has.get(key, Date.now());
|
|
45091
45026
|
return row !== void 0;
|
|
45092
45027
|
}
|
|
45093
|
-
/**
|
|
45094
|
-
* List keys matching an optional glob-like pattern.
|
|
45095
|
-
* Pattern uses SQL LIKE syntax: `%` for any characters, `_` for single character.
|
|
45096
|
-
*
|
|
45097
|
-
* @param pattern - Optional pattern (uses SQL LIKE). Without pattern, returns all keys.
|
|
45098
|
-
* @returns Array of matching key strings
|
|
45099
|
-
*/
|
|
45100
45028
|
keys(pattern) {
|
|
45101
45029
|
const stmts = this.prepared();
|
|
45102
45030
|
const now = Date.now();
|
|
@@ -45108,23 +45036,11 @@ var require_dist = __commonJS({
|
|
|
45108
45036
|
}
|
|
45109
45037
|
return rows.map((r) => r.key);
|
|
45110
45038
|
}
|
|
45111
|
-
/**
|
|
45112
|
-
* Set TTL on an existing key.
|
|
45113
|
-
*
|
|
45114
|
-
* @param key - The key to set expiry on
|
|
45115
|
-
* @param ttlMs - Time to live in milliseconds
|
|
45116
|
-
* @returns true if key exists and TTL was set, false if key doesn't exist
|
|
45117
|
-
*/
|
|
45118
45039
|
expire(key, ttlMs) {
|
|
45119
45040
|
const expiresAt = Date.now() + ttlMs;
|
|
45120
45041
|
const result = this.prepared().expire.run(expiresAt, key);
|
|
45121
45042
|
return result.changes > 0;
|
|
45122
45043
|
}
|
|
45123
|
-
/**
|
|
45124
|
-
* Get remaining TTL for a key in milliseconds.
|
|
45125
|
-
*
|
|
45126
|
-
* @returns TTL in ms, -1 if no expiry, -2 if key doesn't exist
|
|
45127
|
-
*/
|
|
45128
45044
|
ttl(key) {
|
|
45129
45045
|
const stmts = this.prepared();
|
|
45130
45046
|
const row = stmts.ttl.get(key);
|
|
@@ -45137,17 +45053,10 @@ var require_dist = __commonJS({
|
|
|
45137
45053
|
}
|
|
45138
45054
|
return remaining;
|
|
45139
45055
|
}
|
|
45140
|
-
/**
|
|
45141
|
-
* Purge all expired keys.
|
|
45142
|
-
* Called periodically by the cleanup timer.
|
|
45143
|
-
*/
|
|
45144
45056
|
purgeExpired() {
|
|
45145
45057
|
const result = this.prepared().cleanup.run(Date.now());
|
|
45146
45058
|
return result.changes;
|
|
45147
45059
|
}
|
|
45148
|
-
/**
|
|
45149
|
-
* Close the database connection and stop cleanup timer.
|
|
45150
|
-
*/
|
|
45151
45060
|
close() {
|
|
45152
45061
|
if (this.cleanupTimer) {
|
|
45153
45062
|
clearInterval(this.cleanupTimer);
|
|
@@ -45155,9 +45064,6 @@ var require_dist = __commonJS({
|
|
|
45155
45064
|
}
|
|
45156
45065
|
this.db.close();
|
|
45157
45066
|
}
|
|
45158
|
-
/**
|
|
45159
|
-
* Get the underlying database instance (for advanced use cases / testing).
|
|
45160
|
-
*/
|
|
45161
45067
|
getDatabase() {
|
|
45162
45068
|
return this.db;
|
|
45163
45069
|
}
|
|
@@ -45166,20 +45072,12 @@ var require_dist = __commonJS({
|
|
|
45166
45072
|
var SqliteStorageAdapter = class extends import_utils310.BaseStorageAdapter {
|
|
45167
45073
|
backendName = "sqlite";
|
|
45168
45074
|
kv;
|
|
45169
|
-
/**
|
|
45170
|
-
* Whether this adapter created (and therefore owns the lifecycle of) `kv`.
|
|
45171
|
-
* When the store is passed in by the caller, closing it is the caller's
|
|
45172
|
-
* responsibility — `disconnect()` must not pull the rug out from under it.
|
|
45173
|
-
*/
|
|
45174
45075
|
ownsKvStore;
|
|
45175
45076
|
constructor(options) {
|
|
45176
45077
|
super();
|
|
45177
45078
|
this.ownsKvStore = !(options instanceof SqliteKvStore);
|
|
45178
45079
|
this.kv = options instanceof SqliteKvStore ? options : new SqliteKvStore(options);
|
|
45179
45080
|
}
|
|
45180
|
-
// ============================================
|
|
45181
|
-
// Connection Lifecycle
|
|
45182
|
-
// ============================================
|
|
45183
45081
|
async connect() {
|
|
45184
45082
|
this.connected = true;
|
|
45185
45083
|
}
|
|
@@ -45199,9 +45097,6 @@ var require_dist = __commonJS({
|
|
|
45199
45097
|
return false;
|
|
45200
45098
|
}
|
|
45201
45099
|
}
|
|
45202
|
-
// ============================================
|
|
45203
|
-
// Core Operations
|
|
45204
|
-
// ============================================
|
|
45205
45100
|
async get(key) {
|
|
45206
45101
|
this.ensureConnected();
|
|
45207
45102
|
return this.kv.get(key);
|
|
@@ -45226,9 +45121,6 @@ var require_dist = __commonJS({
|
|
|
45226
45121
|
this.ensureConnected();
|
|
45227
45122
|
return this.kv.has(key);
|
|
45228
45123
|
}
|
|
45229
|
-
// ============================================
|
|
45230
|
-
// TTL Operations
|
|
45231
|
-
// ============================================
|
|
45232
45124
|
async expire(key, ttlSeconds) {
|
|
45233
45125
|
this.ensureConnected();
|
|
45234
45126
|
return this.kv.expire(key, ttlSeconds * 1e3);
|
|
@@ -45240,9 +45132,6 @@ var require_dist = __commonJS({
|
|
|
45240
45132
|
if (ms === -1) return -1;
|
|
45241
45133
|
return Math.max(0, Math.ceil(ms / 1e3));
|
|
45242
45134
|
}
|
|
45243
|
-
// ============================================
|
|
45244
|
-
// Key Enumeration
|
|
45245
|
-
// ============================================
|
|
45246
45135
|
async keys(pattern = "*") {
|
|
45247
45136
|
this.ensureConnected();
|
|
45248
45137
|
if (pattern === "*" || pattern === void 0) {
|
|
@@ -45251,9 +45140,6 @@ var require_dist = __commonJS({
|
|
|
45251
45140
|
const like = pattern.replace(/[%_]/g, (c) => `\\${c}`).replace(/\*/g, "%").replace(/\?/g, "_");
|
|
45252
45141
|
return this.kv.keys(like);
|
|
45253
45142
|
}
|
|
45254
|
-
// ============================================
|
|
45255
|
-
// Atomic Operations (read-modify-write; single-process local file)
|
|
45256
|
-
// ============================================
|
|
45257
45143
|
async incr(key) {
|
|
45258
45144
|
return this.incrBy(key, 1);
|
|
45259
45145
|
}
|
|
@@ -45276,9 +45162,6 @@ var require_dist = __commonJS({
|
|
|
45276
45162
|
this.kv.set(key, String(next), remainingMs > 0 ? remainingMs : void 0);
|
|
45277
45163
|
return next;
|
|
45278
45164
|
}
|
|
45279
|
-
/**
|
|
45280
|
-
* Expose the underlying KV store (advanced use / tests).
|
|
45281
|
-
*/
|
|
45282
45165
|
getKvStore() {
|
|
45283
45166
|
return this.kv;
|
|
45284
45167
|
}
|
|
@@ -45314,15 +45197,9 @@ var require_dist = __commonJS({
|
|
|
45314
45197
|
allocId() {
|
|
45315
45198
|
return (0, import_utils410.randomUUID)();
|
|
45316
45199
|
}
|
|
45317
|
-
/**
|
|
45318
|
-
* Close the underlying SQLite connection.
|
|
45319
|
-
*/
|
|
45320
45200
|
close() {
|
|
45321
45201
|
this.kv.close();
|
|
45322
45202
|
}
|
|
45323
|
-
/**
|
|
45324
|
-
* Get the underlying KV store (for testing/advanced use).
|
|
45325
|
-
*/
|
|
45326
45203
|
getKvStore() {
|
|
45327
45204
|
return this.kv;
|
|
45328
45205
|
}
|
|
@@ -45411,9 +45288,6 @@ var require_dist = __commonJS({
|
|
|
45411
45288
|
this.emitter.removeAllListeners();
|
|
45412
45289
|
this.kv.close();
|
|
45413
45290
|
}
|
|
45414
|
-
/**
|
|
45415
|
-
* Get the underlying KV store (for testing/advanced use).
|
|
45416
|
-
*/
|
|
45417
45291
|
getKvStore() {
|
|
45418
45292
|
return this.kv;
|
|
45419
45293
|
}
|
|
@@ -45435,19 +45309,10 @@ var require_dist = __commonJS({
|
|
|
45435
45309
|
logger;
|
|
45436
45310
|
liveness;
|
|
45437
45311
|
cleanupTimer;
|
|
45438
|
-
/**
|
|
45439
|
-
* AES-256-GCM key derived from `options.encryption.secret`, applied to the
|
|
45440
|
-
* `record_json` column on write and reversed on read. Other columns
|
|
45441
|
-
* (`task_id`, `session_id`, `status`, `expires_at`, `executor_pid`) are kept
|
|
45442
|
-
* in plaintext so the indexes remain usable.
|
|
45443
|
-
*/
|
|
45444
45312
|
encryptionKey = null;
|
|
45445
45313
|
stmts = null;
|
|
45446
45314
|
constructor(options) {
|
|
45447
|
-
this.db = openDatabase(options.path, "SqliteTaskStore", {
|
|
45448
|
-
busyTimeoutMs: options.busyTimeoutMs,
|
|
45449
|
-
walMode: options.walMode !== false
|
|
45450
|
-
});
|
|
45315
|
+
this.db = openDatabase(options.path, "SqliteTaskStore", { busyTimeoutMs: options.busyTimeoutMs, walMode: options.walMode !== false });
|
|
45451
45316
|
this.logger = options.logger;
|
|
45452
45317
|
this.liveness = options.livenessProbe ?? defaultLivenessProbe;
|
|
45453
45318
|
if (options.encryption?.secret) {
|
|
@@ -45482,34 +45347,12 @@ var require_dist = __commonJS({
|
|
|
45482
45347
|
`);
|
|
45483
45348
|
}
|
|
45484
45349
|
prepareStatements() {
|
|
45485
|
-
this.stmts = {
|
|
45486
|
-
insert: this.db.prepare(
|
|
45487
|
-
"INSERT INTO mcp_tasks (task_id, session_id, status, expires_at, created_at, updated_at, executor_pid, record_json) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
|
45488
|
-
),
|
|
45489
|
-
// One statement, so the count and the insert are atomic across every process sharing the file.
|
|
45490
|
-
insertWithinLimit: this.db.prepare(
|
|
45491
|
-
"INSERT INTO mcp_tasks (task_id, session_id, status, expires_at, created_at, updated_at, executor_pid, record_json) SELECT ?, ?, ?, ?, ?, ?, ?, ? WHERE (SELECT COUNT(*) FROM mcp_tasks WHERE session_id = ? AND status IN ('working', 'input_required') AND expires_at > ?) < ?"
|
|
45492
|
-
),
|
|
45493
|
-
unfinishedWithWorker: this.db.prepare(
|
|
45494
|
-
"SELECT * FROM mcp_tasks WHERE session_id = ? AND status IN ('working', 'input_required') AND expires_at > ? AND executor_pid IS NOT NULL"
|
|
45495
|
-
),
|
|
45496
|
-
get: this.db.prepare("SELECT * FROM mcp_tasks WHERE task_id = ? AND session_id = ?"),
|
|
45497
|
-
update: this.db.prepare(
|
|
45498
|
-
"UPDATE mcp_tasks SET status = ?, expires_at = ?, updated_at = ?, executor_pid = ?, record_json = ? WHERE task_id = ? AND session_id = ?"
|
|
45499
|
-
),
|
|
45500
|
-
del: this.db.prepare("DELETE FROM mcp_tasks WHERE task_id = ? AND session_id = ?"),
|
|
45501
|
-
listBySession: this.db.prepare(
|
|
45502
|
-
"SELECT * FROM mcp_tasks WHERE session_id = ? AND expires_at > ? ORDER BY created_at ASC, task_id ASC LIMIT ? OFFSET ?"
|
|
45503
|
-
),
|
|
45504
|
-
countBySession: this.db.prepare("SELECT COUNT(*) as n FROM mcp_tasks WHERE session_id = ? AND expires_at > ?"),
|
|
45505
|
-
cleanup: this.db.prepare("DELETE FROM mcp_tasks WHERE expires_at <= ?")
|
|
45506
|
-
};
|
|
45350
|
+
this.stmts = { insert: this.db.prepare("INSERT INTO mcp_tasks (task_id, session_id, status, expires_at, created_at, updated_at, executor_pid, record_json) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"), insertWithinLimit: this.db.prepare("INSERT INTO mcp_tasks (task_id, session_id, status, expires_at, created_at, updated_at, executor_pid, record_json) SELECT ?, ?, ?, ?, ?, ?, ?, ? WHERE (SELECT COUNT(*) FROM mcp_tasks WHERE session_id = ? AND status IN ('working', 'input_required') AND expires_at > ?) < ?"), unfinishedWithWorker: this.db.prepare("SELECT * FROM mcp_tasks WHERE session_id = ? AND status IN ('working', 'input_required') AND expires_at > ? AND executor_pid IS NOT NULL"), get: this.db.prepare("SELECT * FROM mcp_tasks WHERE task_id = ? AND session_id = ?"), update: this.db.prepare("UPDATE mcp_tasks SET status = ?, expires_at = ?, updated_at = ?, executor_pid = ?, record_json = ? WHERE task_id = ? AND session_id = ?"), del: this.db.prepare("DELETE FROM mcp_tasks WHERE task_id = ? AND session_id = ?"), listBySession: this.db.prepare("SELECT * FROM mcp_tasks WHERE session_id = ? AND expires_at > ? ORDER BY created_at ASC, task_id ASC LIMIT ? OFFSET ?"), countBySession: this.db.prepare("SELECT COUNT(*) as n FROM mcp_tasks WHERE session_id = ? AND expires_at > ?"), cleanup: this.db.prepare("DELETE FROM mcp_tasks WHERE expires_at <= ?") };
|
|
45507
45351
|
}
|
|
45508
45352
|
prepared() {
|
|
45509
45353
|
if (!this.stmts) throw new Error("SqliteTaskStore: prepared statements not initialized");
|
|
45510
45354
|
return this.stmts;
|
|
45511
45355
|
}
|
|
45512
|
-
// ───────────────────── CRUD ─────────────────────
|
|
45513
45356
|
async create(record) {
|
|
45514
45357
|
if (record.expiresAt <= Date.now()) {
|
|
45515
45358
|
this.logger?.warn?.("[SqliteTaskStore] create: record already expired", { taskId: record.taskId });
|
|
@@ -45517,7 +45360,6 @@ var require_dist = __commonJS({
|
|
|
45517
45360
|
}
|
|
45518
45361
|
this.prepared().insert.run(...this.rowValues(record));
|
|
45519
45362
|
}
|
|
45520
|
-
/** Insert unless the owner has `maxActive` unfinished rows, after failing the ones whose CLI worker died. */
|
|
45521
45363
|
async createWithinLimit(record, maxActive) {
|
|
45522
45364
|
if (record.expiresAt <= Date.now()) {
|
|
45523
45365
|
await this.create(record);
|
|
@@ -45549,27 +45391,12 @@ var require_dist = __commonJS({
|
|
|
45549
45391
|
return null;
|
|
45550
45392
|
}
|
|
45551
45393
|
const existing = this.rowToRecord(row);
|
|
45552
|
-
const merged = {
|
|
45553
|
-
...existing,
|
|
45554
|
-
...patch,
|
|
45555
|
-
taskId: existing.taskId,
|
|
45556
|
-
sessionId: existing.sessionId,
|
|
45557
|
-
createdAt: existing.createdAt,
|
|
45558
|
-
lastUpdatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
45559
|
-
};
|
|
45394
|
+
const merged = { ...existing, ...patch, taskId: existing.taskId, sessionId: existing.sessionId, createdAt: existing.createdAt, lastUpdatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
45560
45395
|
if (merged.expiresAt <= Date.now()) {
|
|
45561
45396
|
this.prepared().del.run(taskId, sessionId);
|
|
45562
45397
|
return null;
|
|
45563
45398
|
}
|
|
45564
|
-
this.prepared().update.run(
|
|
45565
|
-
merged.status,
|
|
45566
|
-
merged.expiresAt,
|
|
45567
|
-
new Date(merged.lastUpdatedAt).getTime(),
|
|
45568
|
-
merged.executor?.pid ?? null,
|
|
45569
|
-
this.serializeRecord(merged),
|
|
45570
|
-
taskId,
|
|
45571
|
-
sessionId
|
|
45572
|
-
);
|
|
45399
|
+
this.prepared().update.run(merged.status, merged.expiresAt, new Date(merged.lastUpdatedAt).getTime(), merged.executor?.pid ?? null, this.serializeRecord(merged), taskId, sessionId);
|
|
45573
45400
|
return merged;
|
|
45574
45401
|
}
|
|
45575
45402
|
async delete(taskId, sessionId) {
|
|
@@ -45592,7 +45419,6 @@ var require_dist = __commonJS({
|
|
|
45592
45419
|
}
|
|
45593
45420
|
return page;
|
|
45594
45421
|
}
|
|
45595
|
-
// ───────────────────── Pub/Sub (in-process) ─────────────────────
|
|
45596
45422
|
async subscribeTerminal(taskId, _sessionId, cb) {
|
|
45597
45423
|
const channel2 = `terminal:${taskId}`;
|
|
45598
45424
|
const handler = (record) => cb(record);
|
|
@@ -45615,7 +45441,6 @@ var require_dist = __commonJS({
|
|
|
45615
45441
|
async publishCancel(taskId, _sessionId) {
|
|
45616
45442
|
this.emitter.emit(`cancel:${taskId}`);
|
|
45617
45443
|
}
|
|
45618
|
-
// ───────────────────── Misc ─────────────────────
|
|
45619
45444
|
async destroy() {
|
|
45620
45445
|
if (this.cleanupTimer) clearInterval(this.cleanupTimer);
|
|
45621
45446
|
this.emitter.removeAllListeners();
|
|
@@ -45629,9 +45454,7 @@ var require_dist = __commonJS({
|
|
|
45629
45454
|
const res = this.prepared().cleanup.run(Date.now());
|
|
45630
45455
|
return res.changes;
|
|
45631
45456
|
} catch (err) {
|
|
45632
|
-
this.logger?.warn?.("[SqliteTaskStore] purgeExpired failed", {
|
|
45633
|
-
error: err instanceof Error ? err.message : String(err)
|
|
45634
|
-
});
|
|
45457
|
+
this.logger?.warn?.("[SqliteTaskStore] purgeExpired failed", { error: err instanceof Error ? err.message : String(err) });
|
|
45635
45458
|
return 0;
|
|
45636
45459
|
}
|
|
45637
45460
|
}
|
|
@@ -45639,15 +45462,9 @@ var require_dist = __commonJS({
|
|
|
45639
45462
|
return this.db;
|
|
45640
45463
|
}
|
|
45641
45464
|
insertWithinLimit(record, maxActive) {
|
|
45642
|
-
const inserted = this.prepared().insertWithinLimit.run(
|
|
45643
|
-
...this.rowValues(record),
|
|
45644
|
-
record.sessionId,
|
|
45645
|
-
Date.now(),
|
|
45646
|
-
maxActive
|
|
45647
|
-
);
|
|
45465
|
+
const inserted = this.prepared().insertWithinLimit.run(...this.rowValues(record), record.sessionId, Date.now(), maxActive);
|
|
45648
45466
|
return inserted.changes === 1;
|
|
45649
45467
|
}
|
|
45650
|
-
/** Mark the owner's tasks whose CLI worker died as failed. Returns whether any were. */
|
|
45651
45468
|
async failOrphanedTasks(sessionId) {
|
|
45652
45469
|
const rows = this.prepared().unfinishedWithWorker.all(sessionId, Date.now());
|
|
45653
45470
|
let failedAny = false;
|
|
@@ -45657,39 +45474,21 @@ var require_dist = __commonJS({
|
|
|
45657
45474
|
}
|
|
45658
45475
|
return failedAny;
|
|
45659
45476
|
}
|
|
45660
|
-
/** A worker on another host is never probed: its PID means nothing here. A record naming no host is probed. */
|
|
45661
45477
|
isOrphaned(record) {
|
|
45662
45478
|
return (record.status === "working" || record.status === "input_required") && record.executor?.host === "cli" && typeof record.executor.pid === "number" && (record.executor.hostname === void 0 || record.executor.hostname === (0, import_utils510.getHostname)()) && !this.liveness(record.executor.pid);
|
|
45663
45479
|
}
|
|
45664
|
-
/** Publishes the terminal event so `tasks/result` waiters blocked on `subscribeTerminal` wake up now. */
|
|
45665
45480
|
async failOrphan(record) {
|
|
45666
|
-
const failed = await this.update(record.taskId, record.sessionId, {
|
|
45667
|
-
status: "failed",
|
|
45668
|
-
statusMessage: "Task runner exited before completing the task"
|
|
45669
|
-
});
|
|
45481
|
+
const failed = await this.update(record.taskId, record.sessionId, { status: "failed", statusMessage: "Task runner exited before completing the task" });
|
|
45670
45482
|
if (failed) await this.publishTerminal(failed);
|
|
45671
45483
|
return failed;
|
|
45672
45484
|
}
|
|
45673
45485
|
rowValues(record) {
|
|
45674
|
-
return [
|
|
45675
|
-
record.taskId,
|
|
45676
|
-
record.sessionId,
|
|
45677
|
-
record.status,
|
|
45678
|
-
record.expiresAt,
|
|
45679
|
-
new Date(record.createdAt).getTime(),
|
|
45680
|
-
new Date(record.lastUpdatedAt).getTime(),
|
|
45681
|
-
record.executor?.pid ?? null,
|
|
45682
|
-
this.serializeRecord(record)
|
|
45683
|
-
];
|
|
45486
|
+
return [record.taskId, record.sessionId, record.status, record.expiresAt, new Date(record.createdAt).getTime(), new Date(record.lastUpdatedAt).getTime(), record.executor?.pid ?? null, this.serializeRecord(record)];
|
|
45684
45487
|
}
|
|
45685
45488
|
rowToRecord(row) {
|
|
45686
45489
|
const plaintext = this.encryptionKey ? decryptValue(this.encryptionKey, row.record_json) : row.record_json;
|
|
45687
45490
|
return JSON.parse(plaintext);
|
|
45688
45491
|
}
|
|
45689
|
-
/**
|
|
45690
|
-
* Serialize + optionally encrypt a TaskRecord before it lands in the DB.
|
|
45691
|
-
* Only the `record_json` column is encrypted; indexed columns stay plaintext.
|
|
45692
|
-
*/
|
|
45693
45492
|
serializeRecord(record) {
|
|
45694
45493
|
const json = JSON.stringify(record);
|
|
45695
45494
|
return this.encryptionKey ? encryptValue(this.encryptionKey, json) : json;
|
|
@@ -45728,10 +45527,7 @@ var require_dist = __commonJS({
|
|
|
45728
45527
|
cleanupTimer = null;
|
|
45729
45528
|
stmts = null;
|
|
45730
45529
|
constructor(options) {
|
|
45731
|
-
this.db = openDatabase(options.path, "SqliteEventStore", {
|
|
45732
|
-
busyTimeoutMs: options.busyTimeoutMs,
|
|
45733
|
-
walMode: options.walMode !== false
|
|
45734
|
-
});
|
|
45530
|
+
this.db = openDatabase(options.path, "SqliteEventStore", { busyTimeoutMs: options.busyTimeoutMs, walMode: options.walMode !== false });
|
|
45735
45531
|
this.maxEvents = options.maxEvents ?? 1e4;
|
|
45736
45532
|
this.ttlMs = options.ttlMs ?? 3e5;
|
|
45737
45533
|
withBusyRetry(() => this.initSchema());
|
|
@@ -45757,32 +45553,14 @@ var require_dist = __commonJS({
|
|
|
45757
45553
|
`);
|
|
45758
45554
|
}
|
|
45759
45555
|
prepareStatements() {
|
|
45760
|
-
this.stmts = {
|
|
45761
|
-
insert: this.db.prepare("INSERT INTO events (id, stream_id, message, created_at) VALUES (?, ?, ?, ?)"),
|
|
45762
|
-
getAfter: this.db.prepare(
|
|
45763
|
-
"SELECT id, message, created_at FROM events WHERE stream_id = ? AND rowid > (SELECT rowid FROM events WHERE id = ?) AND created_at > ? ORDER BY rowid ASC"
|
|
45764
|
-
),
|
|
45765
|
-
getStreamId: this.db.prepare("SELECT stream_id FROM events WHERE id = ?"),
|
|
45766
|
-
count: this.db.prepare("SELECT COUNT(*) as count FROM events"),
|
|
45767
|
-
evictOldest: this.db.prepare(
|
|
45768
|
-
"DELETE FROM events WHERE id IN (SELECT id FROM events ORDER BY created_at ASC LIMIT ?)"
|
|
45769
|
-
),
|
|
45770
|
-
evictExpired: this.db.prepare("DELETE FROM events WHERE created_at <= ?"),
|
|
45771
|
-
getLastId: this.db.prepare("SELECT id FROM events WHERE stream_id = ? ORDER BY rowid DESC LIMIT 1")
|
|
45772
|
-
};
|
|
45556
|
+
this.stmts = { insert: this.db.prepare("INSERT INTO events (id, stream_id, message, created_at) VALUES (?, ?, ?, ?)"), getAfter: this.db.prepare("SELECT id, message, created_at FROM events WHERE stream_id = ? AND rowid > (SELECT rowid FROM events WHERE id = ?) AND created_at > ? ORDER BY rowid ASC"), getStreamId: this.db.prepare("SELECT stream_id FROM events WHERE id = ?"), count: this.db.prepare("SELECT COUNT(*) as count FROM events"), evictOldest: this.db.prepare("DELETE FROM events WHERE id IN (SELECT id FROM events ORDER BY created_at ASC LIMIT ?)"), evictExpired: this.db.prepare("DELETE FROM events WHERE created_at <= ?"), getLastId: this.db.prepare("SELECT id FROM events WHERE stream_id = ? ORDER BY rowid DESC LIMIT 1") };
|
|
45773
45557
|
}
|
|
45774
|
-
/**
|
|
45775
|
-
* Return prepared statements, throwing if not yet initialized.
|
|
45776
|
-
*/
|
|
45777
45558
|
prepared() {
|
|
45778
45559
|
if (!this.stmts) {
|
|
45779
45560
|
throw new Error("SqliteEventStore: prepared statements not initialized. Was prepareStatements() called?");
|
|
45780
45561
|
}
|
|
45781
45562
|
return this.stmts;
|
|
45782
45563
|
}
|
|
45783
|
-
/**
|
|
45784
|
-
* Get the next counter value for a stream, rehydrating from SQLite on first use.
|
|
45785
|
-
*/
|
|
45786
45564
|
getNextCounter(streamId) {
|
|
45787
45565
|
let counter = this.counters.get(streamId);
|
|
45788
45566
|
if (counter === void 0) {
|
|
@@ -45837,9 +45615,6 @@ var require_dist = __commonJS({
|
|
|
45837
45615
|
const cutoff = Date.now() - this.ttlMs;
|
|
45838
45616
|
stmts.evictExpired.run(cutoff);
|
|
45839
45617
|
}
|
|
45840
|
-
/**
|
|
45841
|
-
* Close the database connection and stop cleanup timer.
|
|
45842
|
-
*/
|
|
45843
45618
|
close() {
|
|
45844
45619
|
if (this.cleanupTimer) {
|
|
45845
45620
|
clearInterval(this.cleanupTimer);
|
|
@@ -45847,15 +45622,9 @@ var require_dist = __commonJS({
|
|
|
45847
45622
|
}
|
|
45848
45623
|
this.db.close();
|
|
45849
45624
|
}
|
|
45850
|
-
/**
|
|
45851
|
-
* Get the underlying database instance.
|
|
45852
|
-
*/
|
|
45853
45625
|
getDatabase() {
|
|
45854
45626
|
return this.db;
|
|
45855
45627
|
}
|
|
45856
|
-
/**
|
|
45857
|
-
* Get the current number of stored events.
|
|
45858
|
-
*/
|
|
45859
45628
|
get size() {
|
|
45860
45629
|
const stmts = this.prepared();
|
|
45861
45630
|
const row = stmts.count.get();
|
|
@@ -45863,15 +45632,7 @@ var require_dist = __commonJS({
|
|
|
45863
45632
|
}
|
|
45864
45633
|
};
|
|
45865
45634
|
var import_lazy_zod120 = require("@frontmcp/lazy-zod");
|
|
45866
|
-
var sqliteStorageOptionsSchema = import_lazy_zod120.z.object({
|
|
45867
|
-
path: import_lazy_zod120.z.string().min(1),
|
|
45868
|
-
encryption: import_lazy_zod120.z.object({
|
|
45869
|
-
secret: import_lazy_zod120.z.string().min(1)
|
|
45870
|
-
}).optional(),
|
|
45871
|
-
ttlCleanupIntervalMs: import_lazy_zod120.z.number().int().nonnegative().optional().default(6e4),
|
|
45872
|
-
walMode: import_lazy_zod120.z.boolean().optional().default(true),
|
|
45873
|
-
busyTimeoutMs: import_lazy_zod120.z.number().int().nonnegative().optional().default(5e3)
|
|
45874
|
-
});
|
|
45635
|
+
var sqliteStorageOptionsSchema = import_lazy_zod120.z.object({ path: import_lazy_zod120.z.string().min(1), encryption: import_lazy_zod120.z.object({ secret: import_lazy_zod120.z.string().min(1) }).optional(), ttlCleanupIntervalMs: import_lazy_zod120.z.number().int().nonnegative().optional().default(6e4), walMode: import_lazy_zod120.z.boolean().optional().default(true), busyTimeoutMs: import_lazy_zod120.z.number().int().nonnegative().optional().default(5e3) });
|
|
45875
45636
|
}
|
|
45876
45637
|
});
|
|
45877
45638
|
|
|
@@ -45936,6 +45697,831 @@ var init_session_store_factory = __esm({
|
|
|
45936
45697
|
}
|
|
45937
45698
|
});
|
|
45938
45699
|
|
|
45700
|
+
// libs/sdk/src/transport/event-stores/session-scoped.event-store.ts
|
|
45701
|
+
function createSessionScopedEventStore(store, sessionId) {
|
|
45702
|
+
const prefix = `${sessionId}${SCOPE_SEPARATOR}`;
|
|
45703
|
+
const scope = (streamId) => `${prefix}${streamId}`;
|
|
45704
|
+
const unscope = (streamId) => {
|
|
45705
|
+
const value = String(streamId);
|
|
45706
|
+
return value.startsWith(prefix) ? value.slice(prefix.length) : value;
|
|
45707
|
+
};
|
|
45708
|
+
const resolveOwnedStream = async (eventId) => {
|
|
45709
|
+
const lookup = store.getStreamIdForEventId;
|
|
45710
|
+
if (lookup) {
|
|
45711
|
+
const resolved = await lookup.call(store, eventId);
|
|
45712
|
+
return resolved !== void 0 && String(resolved).startsWith(prefix) ? resolved : void 0;
|
|
45713
|
+
}
|
|
45714
|
+
if (!String(eventId).startsWith(prefix)) return void 0;
|
|
45715
|
+
const value = String(eventId);
|
|
45716
|
+
const lastColon = value.lastIndexOf(":");
|
|
45717
|
+
return lastColon === -1 ? void 0 : value.slice(0, lastColon);
|
|
45718
|
+
};
|
|
45719
|
+
return {
|
|
45720
|
+
async storeEvent(streamId, message) {
|
|
45721
|
+
return store.storeEvent(scope(streamId), message);
|
|
45722
|
+
},
|
|
45723
|
+
async getStreamIdForEventId(eventId) {
|
|
45724
|
+
const owned = await resolveOwnedStream(eventId);
|
|
45725
|
+
return owned === void 0 ? void 0 : unscope(owned);
|
|
45726
|
+
},
|
|
45727
|
+
async replayEventsAfter(lastEventId, options) {
|
|
45728
|
+
const owned = await resolveOwnedStream(lastEventId);
|
|
45729
|
+
if (owned === void 0) {
|
|
45730
|
+
return "default-stream";
|
|
45731
|
+
}
|
|
45732
|
+
return unscope(await store.replayEventsAfter(lastEventId, options));
|
|
45733
|
+
}
|
|
45734
|
+
};
|
|
45735
|
+
}
|
|
45736
|
+
var SCOPE_SEPARATOR;
|
|
45737
|
+
var init_session_scoped_event_store = __esm({
|
|
45738
|
+
"libs/sdk/src/transport/event-stores/session-scoped.event-store.ts"() {
|
|
45739
|
+
"use strict";
|
|
45740
|
+
SCOPE_SEPARATOR = " ";
|
|
45741
|
+
}
|
|
45742
|
+
});
|
|
45743
|
+
|
|
45744
|
+
// libs/sdk/src/transport/transport.error.ts
|
|
45745
|
+
var import_utils92, JSON_RPC2, rpcError, rpcRequest;
|
|
45746
|
+
var init_transport_error = __esm({
|
|
45747
|
+
"libs/sdk/src/transport/transport.error.ts"() {
|
|
45748
|
+
"use strict";
|
|
45749
|
+
import_utils92 = require("@frontmcp/utils");
|
|
45750
|
+
JSON_RPC2 = "2.0";
|
|
45751
|
+
rpcError = (message, requestId) => ({
|
|
45752
|
+
jsonrpc: JSON_RPC2,
|
|
45753
|
+
error: { code: -32e3, message },
|
|
45754
|
+
id: requestId ?? (0, import_utils92.randomUUID)()
|
|
45755
|
+
// change it to request id + random
|
|
45756
|
+
});
|
|
45757
|
+
rpcRequest = (requestId, method, params) => ({
|
|
45758
|
+
jsonrpc: JSON_RPC2,
|
|
45759
|
+
id: requestId ?? (0, import_utils92.randomUUID)(),
|
|
45760
|
+
method,
|
|
45761
|
+
...params !== void 0 && { params }
|
|
45762
|
+
});
|
|
45763
|
+
}
|
|
45764
|
+
});
|
|
45765
|
+
|
|
45766
|
+
// libs/sdk/src/transport/adapters/transport.local.adapter.ts
|
|
45767
|
+
function mergeExperimental(fragments) {
|
|
45768
|
+
const out = {};
|
|
45769
|
+
const experimental = {};
|
|
45770
|
+
const extensions = {};
|
|
45771
|
+
let sawExperimental = false;
|
|
45772
|
+
let sawExtensions = false;
|
|
45773
|
+
for (const frag of fragments) {
|
|
45774
|
+
if (!frag) continue;
|
|
45775
|
+
for (const [key, value] of Object.entries(frag)) {
|
|
45776
|
+
if (key === "experimental" && value && typeof value === "object") {
|
|
45777
|
+
Object.assign(experimental, value);
|
|
45778
|
+
sawExperimental = true;
|
|
45779
|
+
} else if (key === "extensions" && value && typeof value === "object") {
|
|
45780
|
+
Object.assign(extensions, value);
|
|
45781
|
+
sawExtensions = true;
|
|
45782
|
+
} else {
|
|
45783
|
+
out[key] = value;
|
|
45784
|
+
}
|
|
45785
|
+
}
|
|
45786
|
+
}
|
|
45787
|
+
if (sawExperimental) out["experimental"] = experimental;
|
|
45788
|
+
if (sawExtensions) out["extensions"] = extensions;
|
|
45789
|
+
return out;
|
|
45790
|
+
}
|
|
45791
|
+
var import_protocol50, LocalTransportAdapter;
|
|
45792
|
+
var init_transport_local_adapter = __esm({
|
|
45793
|
+
"libs/sdk/src/transport/adapters/transport.local.adapter.ts"() {
|
|
45794
|
+
"use strict";
|
|
45795
|
+
import_protocol50 = require("@frontmcp/protocol");
|
|
45796
|
+
init_common();
|
|
45797
|
+
init_errors();
|
|
45798
|
+
init_skill_instructions_helper();
|
|
45799
|
+
init_task_scope_helper();
|
|
45800
|
+
init_mcp_handlers();
|
|
45801
|
+
LocalTransportAdapter = class {
|
|
45802
|
+
constructor(scope, key, onDispose, res) {
|
|
45803
|
+
this.scope = scope;
|
|
45804
|
+
this.key = key;
|
|
45805
|
+
this.onDispose = onDispose;
|
|
45806
|
+
this.logger = scope.logger.child("LocalTransportAdapter");
|
|
45807
|
+
this.transport = this.createTransport(key.sessionId, res);
|
|
45808
|
+
this.ready = this.connectServer();
|
|
45809
|
+
}
|
|
45810
|
+
scope;
|
|
45811
|
+
key;
|
|
45812
|
+
onDispose;
|
|
45813
|
+
logger;
|
|
45814
|
+
transport;
|
|
45815
|
+
/**
|
|
45816
|
+
* Pending elicitation request. Only one elicit per session is allowed.
|
|
45817
|
+
* New elicit requests will cancel any pending one.
|
|
45818
|
+
*/
|
|
45819
|
+
pendingElicit;
|
|
45820
|
+
/**
|
|
45821
|
+
* Session payload fields set during MCP initialize.
|
|
45822
|
+
* Stored on the adapter instance so they survive across requests in SSE mode
|
|
45823
|
+
* (where each POST creates a fresh anonymous HTTP session) and are available
|
|
45824
|
+
* in distributed environments without relying on local in-memory caches.
|
|
45825
|
+
*/
|
|
45826
|
+
initSessionPayload;
|
|
45827
|
+
/**
|
|
45828
|
+
* Called by the initialize request handler to persist initialization data
|
|
45829
|
+
* on the transport adapter instance. This data is merged into the session
|
|
45830
|
+
* payload on every subsequent request via ensureAuthInfo().
|
|
45831
|
+
*/
|
|
45832
|
+
setInitSessionPayload(payload) {
|
|
45833
|
+
this.initSessionPayload = payload;
|
|
45834
|
+
}
|
|
45835
|
+
#requestId = 1;
|
|
45836
|
+
ready;
|
|
45837
|
+
server;
|
|
45838
|
+
/**
|
|
45839
|
+
* Whether this transport has already been initialized via the MCP initialize handshake.
|
|
45840
|
+
* Override in subclasses that track initialization state.
|
|
45841
|
+
*/
|
|
45842
|
+
get isInitialized() {
|
|
45843
|
+
return false;
|
|
45844
|
+
}
|
|
45845
|
+
/**
|
|
45846
|
+
* Marks this transport as pre-initialized for session recreation.
|
|
45847
|
+
* Override in subclasses that need to set the MCP SDK's _initialized flag.
|
|
45848
|
+
*/
|
|
45849
|
+
markAsInitialized() {
|
|
45850
|
+
}
|
|
45851
|
+
/**
|
|
45852
|
+
* Resets initialization state to allow re-initialization.
|
|
45853
|
+
* Override in subclasses that support session re-initialization.
|
|
45854
|
+
*/
|
|
45855
|
+
resetForReinitialization() {
|
|
45856
|
+
}
|
|
45857
|
+
/**
|
|
45858
|
+
* Re-register the MCP server with the notification service.
|
|
45859
|
+
* Called after resetForReinitialization() to restore the server mapping
|
|
45860
|
+
* that was removed by terminateSession \u2192 unregisterServer.
|
|
45861
|
+
*/
|
|
45862
|
+
reregisterServer() {
|
|
45863
|
+
if (this.server) {
|
|
45864
|
+
this.scope.notifications.registerServer(this.key.sessionId, this.server);
|
|
45865
|
+
}
|
|
45866
|
+
}
|
|
45867
|
+
connectServer() {
|
|
45868
|
+
const { info, apps } = this.scope.metadata;
|
|
45869
|
+
const hasRemoteApps = apps?.some((app) => this.isRemoteApp(app)) ?? false;
|
|
45870
|
+
const hasPrompts = this.scope.prompts.hasAny() || hasRemoteApps;
|
|
45871
|
+
const hasResources = this.scope.resources.hasAny() || hasRemoteApps;
|
|
45872
|
+
const hasTools = this.scope.tools.hasAny() || hasRemoteApps;
|
|
45873
|
+
const hasAgents = this.scope.agents.hasAny();
|
|
45874
|
+
const completionsCapability = hasPrompts || hasResources ? { completions: {} } : {};
|
|
45875
|
+
const remoteCapabilities = hasRemoteApps ? this.buildRemoteCapabilities() : {};
|
|
45876
|
+
const elicitationCapability = this.scope.metadata.elicitation?.enabled ? { elicitation: {} } : {};
|
|
45877
|
+
const channelCapabilities = this.scope.channels?.getCapabilities() ?? {};
|
|
45878
|
+
const skillsCapabilities = this.scope.skills?.getCapabilities() ?? {};
|
|
45879
|
+
const composeInstructions = (caller) => composeCallerInstructions(this.scope, { ctx: caller, skillUriHints: true });
|
|
45880
|
+
const instructions = "";
|
|
45881
|
+
const mergedCapabilities = mergeExperimental([
|
|
45882
|
+
remoteCapabilities,
|
|
45883
|
+
// Pre-advertise for remote apps (may be overwritten by local)
|
|
45884
|
+
this.scope.tools.getCapabilities(),
|
|
45885
|
+
this.scope.resources.getCapabilities(),
|
|
45886
|
+
this.scope.prompts.getCapabilities(),
|
|
45887
|
+
this.scope.agents.getCapabilities(),
|
|
45888
|
+
// Include agent capabilities (agents as tools)
|
|
45889
|
+
channelCapabilities,
|
|
45890
|
+
// Channel capabilities (claude/channel extension)
|
|
45891
|
+
skillsCapabilities,
|
|
45892
|
+
// SEP-2640 extension declaration
|
|
45893
|
+
completionsCapability,
|
|
45894
|
+
computeTaskCapabilities(this.scope),
|
|
45895
|
+
// MCP logging protocol support - allows clients to set log level via logging/setLevel
|
|
45896
|
+
{ logging: {} },
|
|
45897
|
+
elicitationCapability
|
|
45898
|
+
]);
|
|
45899
|
+
const serverOptions = {
|
|
45900
|
+
instructions,
|
|
45901
|
+
capabilities: mergedCapabilities,
|
|
45902
|
+
serverInfo: info
|
|
45903
|
+
};
|
|
45904
|
+
this.logger.verbose("connectServer: advertising capabilities", {
|
|
45905
|
+
hasTools: hasTools || hasAgents,
|
|
45906
|
+
// Agents expose themselves as tools
|
|
45907
|
+
hasResources,
|
|
45908
|
+
hasPrompts,
|
|
45909
|
+
hasAgents,
|
|
45910
|
+
hasRemoteApps,
|
|
45911
|
+
capabilities: JSON.stringify(serverOptions.capabilities),
|
|
45912
|
+
serverInfo: JSON.stringify(serverOptions.serverInfo)
|
|
45913
|
+
});
|
|
45914
|
+
this.server = new import_protocol50.McpServer(info, serverOptions);
|
|
45915
|
+
const handlers = createMcpHandlers({
|
|
45916
|
+
scope: this.scope,
|
|
45917
|
+
serverOptions,
|
|
45918
|
+
composeInstructions
|
|
45919
|
+
});
|
|
45920
|
+
for (const handler of handlers) {
|
|
45921
|
+
this.server.setRequestHandler(handler.requestSchema, handler.handler);
|
|
45922
|
+
}
|
|
45923
|
+
this.scope.notifications.registerServer(this.key.sessionId, this.server);
|
|
45924
|
+
return this.server.connect(this.transport);
|
|
45925
|
+
}
|
|
45926
|
+
get newRequestId() {
|
|
45927
|
+
return this.#requestId++;
|
|
45928
|
+
}
|
|
45929
|
+
/**
|
|
45930
|
+
* Get the transport type (sse, streamable-http, etc.).
|
|
45931
|
+
* Used for transport-specific behavior detection.
|
|
45932
|
+
*/
|
|
45933
|
+
get type() {
|
|
45934
|
+
return this.key.type;
|
|
45935
|
+
}
|
|
45936
|
+
async destroy(reason) {
|
|
45937
|
+
this.logger.verbose("destroying transporter", { reason });
|
|
45938
|
+
this.scope.notifications.unregisterServer(this.key.sessionId);
|
|
45939
|
+
try {
|
|
45940
|
+
} catch {
|
|
45941
|
+
}
|
|
45942
|
+
if (reason) {
|
|
45943
|
+
console.warn(`Destroying transporter: ${reason}`);
|
|
45944
|
+
} else {
|
|
45945
|
+
try {
|
|
45946
|
+
this.onDispose?.();
|
|
45947
|
+
} catch {
|
|
45948
|
+
}
|
|
45949
|
+
}
|
|
45950
|
+
}
|
|
45951
|
+
/**
|
|
45952
|
+
* Ping the connected client for this transport.
|
|
45953
|
+
* Returns true on success, false on timeout/error.
|
|
45954
|
+
*/
|
|
45955
|
+
async ping(timeoutMs = 1e4) {
|
|
45956
|
+
try {
|
|
45957
|
+
await this.ready;
|
|
45958
|
+
await this.server.request({ method: "ping" }, import_protocol50.EmptyResultSchema, { timeout: timeoutMs });
|
|
45959
|
+
return true;
|
|
45960
|
+
} catch {
|
|
45961
|
+
return false;
|
|
45962
|
+
}
|
|
45963
|
+
}
|
|
45964
|
+
ensureAuthInfo(req, transport) {
|
|
45965
|
+
const { token, user, session, scopes, claims } = req[ServerRequestTokens.auth];
|
|
45966
|
+
if (!session?.id) {
|
|
45967
|
+
throw new UnauthorizedError(
|
|
45968
|
+
"Session could not be reconstructed for the provided token. Re-authenticate to start a new session.",
|
|
45969
|
+
"Bearer"
|
|
45970
|
+
);
|
|
45971
|
+
}
|
|
45972
|
+
const sessionId = session.id;
|
|
45973
|
+
const sessionPayload = session.payload ?? { protocol: "streamable-http" };
|
|
45974
|
+
if (this.initSessionPayload) {
|
|
45975
|
+
const init = this.initSessionPayload;
|
|
45976
|
+
if (init.supportsElicitation !== void 0 && sessionPayload.supportsElicitation === void 0) {
|
|
45977
|
+
sessionPayload.supportsElicitation = init.supportsElicitation;
|
|
45978
|
+
}
|
|
45979
|
+
if (init.platformType !== void 0 && sessionPayload.platformType === void 0) {
|
|
45980
|
+
sessionPayload["platformType"] = init.platformType;
|
|
45981
|
+
}
|
|
45982
|
+
if (init.clientName !== void 0 && sessionPayload.clientName === void 0) {
|
|
45983
|
+
sessionPayload.clientName = init.clientName;
|
|
45984
|
+
}
|
|
45985
|
+
if (init.clientVersion !== void 0 && sessionPayload.clientVersion === void 0) {
|
|
45986
|
+
sessionPayload.clientVersion = init.clientVersion;
|
|
45987
|
+
}
|
|
45988
|
+
}
|
|
45989
|
+
const authInfo = {
|
|
45990
|
+
token,
|
|
45991
|
+
user,
|
|
45992
|
+
sessionId,
|
|
45993
|
+
sessionIdPayload: sessionPayload,
|
|
45994
|
+
// Carry the scopes and claims the verified Authorization actually holds.
|
|
45995
|
+
// These used to be dropped (`scopes: []`, no claims), which left every
|
|
45996
|
+
// scope- or claim-based check downstream inert.
|
|
45997
|
+
//
|
|
45998
|
+
// Both are COPIED, not aliased. Tool code receives this object, and a
|
|
45999
|
+
// nested mutation (`authInfo.claims.roles.push('admin')`) on a shared
|
|
46000
|
+
// reference would rewrite the request's own verified authorization \u2014 which
|
|
46001
|
+
// the job/workflow permission guard then reads.
|
|
46002
|
+
scopes: Array.isArray(scopes) ? [...scopes] : [],
|
|
46003
|
+
...claims ? { claims: structuredClone(claims) } : {},
|
|
46004
|
+
clientId: user.sub ?? "",
|
|
46005
|
+
transport
|
|
46006
|
+
};
|
|
46007
|
+
req.auth = authInfo;
|
|
46008
|
+
return req.auth;
|
|
46009
|
+
}
|
|
46010
|
+
/**
|
|
46011
|
+
* Get the elicitation store for distributed elicitation support.
|
|
46012
|
+
* Uses Redis in distributed mode, in-memory for single-node.
|
|
46013
|
+
*/
|
|
46014
|
+
get elicitStore() {
|
|
46015
|
+
return this.scope.elicitationStore;
|
|
46016
|
+
}
|
|
46017
|
+
/**
|
|
46018
|
+
* Get the elicitation store, throwing if not initialized.
|
|
46019
|
+
* Use in contexts where elicitation is required (sendElicitRequest, cancelPendingElicit).
|
|
46020
|
+
*/
|
|
46021
|
+
requireElicitStore() {
|
|
46022
|
+
const store = this.elicitStore;
|
|
46023
|
+
if (!store) {
|
|
46024
|
+
throw new Error("Elicitation store not initialized");
|
|
46025
|
+
}
|
|
46026
|
+
return store;
|
|
46027
|
+
}
|
|
46028
|
+
/**
|
|
46029
|
+
* Cancel any pending elicitation request.
|
|
46030
|
+
* Called before sending a new elicit to enforce single-elicit-per-session.
|
|
46031
|
+
*
|
|
46032
|
+
* This cancels both the local pending elicit (for timeout handling)
|
|
46033
|
+
* and publishes cancel to the store (for distributed mode).
|
|
46034
|
+
*
|
|
46035
|
+
* Note: The local promise is resolved immediately for responsiveness,
|
|
46036
|
+
* then distributed state cleanup follows asynchronously. This non-atomic
|
|
46037
|
+
* sequence is intentional - the worst case is publishing a cancel for
|
|
46038
|
+
* an already-processed elicitation, which is harmless.
|
|
46039
|
+
*/
|
|
46040
|
+
async cancelPendingElicit() {
|
|
46041
|
+
if (this.pendingElicit) {
|
|
46042
|
+
clearTimeout(this.pendingElicit.timeoutHandle);
|
|
46043
|
+
this.pendingElicit.resolve({ status: "cancel" });
|
|
46044
|
+
const sessionId = this.key.sessionId;
|
|
46045
|
+
const store = this.elicitStore;
|
|
46046
|
+
if (store) {
|
|
46047
|
+
const pending = await store.getPending(sessionId);
|
|
46048
|
+
if (pending) {
|
|
46049
|
+
await store.publishResult(pending.elicitId, sessionId, { status: "cancel" });
|
|
46050
|
+
}
|
|
46051
|
+
}
|
|
46052
|
+
this.pendingElicit = void 0;
|
|
46053
|
+
this.logger.info("Cancelled previous pending elicit");
|
|
46054
|
+
}
|
|
46055
|
+
}
|
|
46056
|
+
/**
|
|
46057
|
+
* Handle an incoming elicitation result from the client.
|
|
46058
|
+
* Returns true if the request was an elicit result and was handled.
|
|
46059
|
+
*
|
|
46060
|
+
* Uses ElicitationResultFlow for processing (with hook support).
|
|
46061
|
+
* In distributed mode, this publishes the result via the elicitation store,
|
|
46062
|
+
* which routes it to the correct node that's waiting for it.
|
|
46063
|
+
*/
|
|
46064
|
+
handleIfElicitResult(req) {
|
|
46065
|
+
this.logger.verbose("[handleIfElicitResult] checking request", {
|
|
46066
|
+
hasPendingElicit: !!this.pendingElicit,
|
|
46067
|
+
bodyKeys: req.body ? Object.keys(req.body) : [],
|
|
46068
|
+
hasResult: !!req.body?.result
|
|
46069
|
+
});
|
|
46070
|
+
if (this.pendingElicit && req.body.error) {
|
|
46071
|
+
const { code, message } = req.body.error;
|
|
46072
|
+
if (code === -32600 && message === "Elicitation not supported") {
|
|
46073
|
+
clearTimeout(this.pendingElicit.timeoutHandle);
|
|
46074
|
+
this.pendingElicit.reject(new ElicitationNotSupportedError());
|
|
46075
|
+
this.pendingElicit = void 0;
|
|
46076
|
+
return true;
|
|
46077
|
+
}
|
|
46078
|
+
}
|
|
46079
|
+
const parsed = import_protocol50.ElicitResultSchema.safeParse(req.body?.result);
|
|
46080
|
+
if (!parsed.success) {
|
|
46081
|
+
return false;
|
|
46082
|
+
}
|
|
46083
|
+
const sessionId = this.key.sessionId;
|
|
46084
|
+
void this.handleElicitResultAsync(sessionId, parsed.data);
|
|
46085
|
+
const action = parsed.data.action;
|
|
46086
|
+
const result = {
|
|
46087
|
+
status: action,
|
|
46088
|
+
...action === "accept" && parsed.data.content !== void 0 && { content: parsed.data.content }
|
|
46089
|
+
};
|
|
46090
|
+
if (this.pendingElicit) {
|
|
46091
|
+
clearTimeout(this.pendingElicit.timeoutHandle);
|
|
46092
|
+
this.pendingElicit.resolve(result);
|
|
46093
|
+
this.pendingElicit = void 0;
|
|
46094
|
+
}
|
|
46095
|
+
return true;
|
|
46096
|
+
}
|
|
46097
|
+
/**
|
|
46098
|
+
* Async handler for elicit result - uses ElicitationResultFlow for processing.
|
|
46099
|
+
* Called from handleIfElicitResult without awaiting to avoid blocking the response.
|
|
46100
|
+
*/
|
|
46101
|
+
async handleElicitResultAsync(sessionId, mcpResult) {
|
|
46102
|
+
try {
|
|
46103
|
+
const output = await this.scope.runFlow("elicitation:result", {
|
|
46104
|
+
sessionId,
|
|
46105
|
+
result: mcpResult
|
|
46106
|
+
});
|
|
46107
|
+
if (output?.handled) {
|
|
46108
|
+
this.logger.verbose("ElicitationResultFlow handled result", {
|
|
46109
|
+
elicitId: output.elicitId,
|
|
46110
|
+
sessionId: sessionId.slice(0, 20),
|
|
46111
|
+
status: output.result?.status
|
|
46112
|
+
});
|
|
46113
|
+
}
|
|
46114
|
+
} catch (error) {
|
|
46115
|
+
this.logger.warn("Failed to run ElicitationResultFlow", {
|
|
46116
|
+
sessionId: sessionId.slice(0, 20),
|
|
46117
|
+
error: error.message
|
|
46118
|
+
});
|
|
46119
|
+
}
|
|
46120
|
+
}
|
|
46121
|
+
/**
|
|
46122
|
+
* Type predicate to check if an app configuration represents a remote MCP app.
|
|
46123
|
+
* Remote apps have a 'urlType' property and are not standalone.
|
|
46124
|
+
*/
|
|
46125
|
+
isRemoteApp(app) {
|
|
46126
|
+
if (app === null || typeof app !== "object") return false;
|
|
46127
|
+
const appObj = app;
|
|
46128
|
+
return "urlType" in appObj && appObj["standalone"] !== true;
|
|
46129
|
+
}
|
|
46130
|
+
/**
|
|
46131
|
+
* Build capabilities that should be pre-advertised for remote apps.
|
|
46132
|
+
* Remote apps load their tools/resources/prompts asynchronously after connection,
|
|
46133
|
+
* so we need to pre-advertise listChanged capabilities for proper notification support.
|
|
46134
|
+
*/
|
|
46135
|
+
buildRemoteCapabilities() {
|
|
46136
|
+
return {
|
|
46137
|
+
tools: { listChanged: true },
|
|
46138
|
+
resources: { subscribe: true, listChanged: true },
|
|
46139
|
+
prompts: { listChanged: true }
|
|
46140
|
+
};
|
|
46141
|
+
}
|
|
46142
|
+
};
|
|
46143
|
+
}
|
|
46144
|
+
});
|
|
46145
|
+
|
|
46146
|
+
// libs/sdk/src/transport/adapters/streamable-http-transport.ts
|
|
46147
|
+
var streamable_http_transport_exports = {};
|
|
46148
|
+
__export(streamable_http_transport_exports, {
|
|
46149
|
+
RecreateableStreamableHTTPServerTransport: () => RecreateableStreamableHTTPServerTransport
|
|
46150
|
+
});
|
|
46151
|
+
var import_protocol51, RecreateableStreamableHTTPServerTransport;
|
|
46152
|
+
var init_streamable_http_transport = __esm({
|
|
46153
|
+
"libs/sdk/src/transport/adapters/streamable-http-transport.ts"() {
|
|
46154
|
+
"use strict";
|
|
46155
|
+
import_protocol51 = require("@frontmcp/protocol");
|
|
46156
|
+
init_transport_errors();
|
|
46157
|
+
RecreateableStreamableHTTPServerTransport = class extends import_protocol51.StreamableHTTPServerTransport {
|
|
46158
|
+
/**
|
|
46159
|
+
* Stores pending initialization state when setInitializationState is called
|
|
46160
|
+
* before _webStandardTransport is ready. Applied on first handleRequest.
|
|
46161
|
+
*/
|
|
46162
|
+
_pendingInitState;
|
|
46163
|
+
/**
|
|
46164
|
+
* Stored constructor options for recreating internal transports.
|
|
46165
|
+
* MCP SDK 1.26.0 enforces single-use for stateless transports,
|
|
46166
|
+
* so we need to create fresh instances for each request.
|
|
46167
|
+
*/
|
|
46168
|
+
_constructorOptions;
|
|
46169
|
+
/**
|
|
46170
|
+
* When true, the transport recreates the internal transport for each request.
|
|
46171
|
+
* Decoupled from sessionIdGenerator so stateless transports can still
|
|
46172
|
+
* provide a session ID (e.g., '__stateless__') in the response header.
|
|
46173
|
+
*/
|
|
46174
|
+
_isStateless;
|
|
46175
|
+
constructor(options = {}) {
|
|
46176
|
+
super(options);
|
|
46177
|
+
this._constructorOptions = options;
|
|
46178
|
+
this._isStateless = options.isStateless ?? false;
|
|
46179
|
+
}
|
|
46180
|
+
/**
|
|
46181
|
+
* Returns whether the transport has been initialized.
|
|
46182
|
+
*/
|
|
46183
|
+
get isInitialized() {
|
|
46184
|
+
return this._webStandardTransport?._initialized ?? false;
|
|
46185
|
+
}
|
|
46186
|
+
/**
|
|
46187
|
+
* Returns whether there's a pending initialization state waiting to be applied.
|
|
46188
|
+
* This is true when setInitializationState was called before _webStandardTransport existed.
|
|
46189
|
+
*/
|
|
46190
|
+
get hasPendingInitState() {
|
|
46191
|
+
return this._pendingInitState !== void 0;
|
|
46192
|
+
}
|
|
46193
|
+
/**
|
|
46194
|
+
* Sets the transport to an initialized state with the given session ID.
|
|
46195
|
+
* Use this when recreating a transport from a stored session.
|
|
46196
|
+
*
|
|
46197
|
+
* This method allows you to "restore" a session without replaying the
|
|
46198
|
+
* initialization handshake. After calling this method, the transport
|
|
46199
|
+
* will accept requests with the given session ID.
|
|
46200
|
+
*
|
|
46201
|
+
* If the internal transport is not ready yet (common in serverless cold starts),
|
|
46202
|
+
* the state is stored and applied on the first handleRequest call.
|
|
46203
|
+
*
|
|
46204
|
+
* @param sessionId - The session ID that was previously assigned to this session
|
|
46205
|
+
* @throws Error if sessionId is empty or invalid
|
|
46206
|
+
*/
|
|
46207
|
+
setInitializationState(sessionId) {
|
|
46208
|
+
if (!sessionId || typeof sessionId !== "string" || sessionId.trim() === "") {
|
|
46209
|
+
throw new InvalidTransportSessionError("[RecreateableStreamableHTTPServerTransport] sessionId cannot be empty");
|
|
46210
|
+
}
|
|
46211
|
+
const webTransport = this._webStandardTransport;
|
|
46212
|
+
if (!webTransport) {
|
|
46213
|
+
this._pendingInitState = sessionId;
|
|
46214
|
+
return;
|
|
46215
|
+
}
|
|
46216
|
+
this._applyInitState(webTransport, sessionId);
|
|
46217
|
+
}
|
|
46218
|
+
/**
|
|
46219
|
+
* Resets the transport's initialization state to allow re-initialization.
|
|
46220
|
+
*
|
|
46221
|
+
* This is needed when a client reconnects after terminating its session:
|
|
46222
|
+
* the cached transport is still marked as initialized, but the client
|
|
46223
|
+
* needs to re-initialize. Resetting _initialized and sessionId allows
|
|
46224
|
+
* the MCP SDK to process a fresh initialize request.
|
|
46225
|
+
*
|
|
46226
|
+
* This is the inverse of setInitializationState().
|
|
46227
|
+
*/
|
|
46228
|
+
resetForReinitialization() {
|
|
46229
|
+
const webTransport = this._webStandardTransport;
|
|
46230
|
+
if (!webTransport) {
|
|
46231
|
+
this._pendingInitState = void 0;
|
|
46232
|
+
return;
|
|
46233
|
+
}
|
|
46234
|
+
if (!("_initialized" in webTransport)) {
|
|
46235
|
+
throw new InvalidTransportSessionError(
|
|
46236
|
+
"[RecreateableStreamableHTTPServerTransport] Expected _initialized field not found on internal transport. This may indicate an incompatible MCP SDK version."
|
|
46237
|
+
);
|
|
46238
|
+
}
|
|
46239
|
+
webTransport._initialized = false;
|
|
46240
|
+
webTransport.sessionId = void 0;
|
|
46241
|
+
this._pendingInitState = void 0;
|
|
46242
|
+
}
|
|
46243
|
+
/**
|
|
46244
|
+
* Applies initialization state to the internal transport.
|
|
46245
|
+
* @param webTransport - The internal _webStandardTransport object
|
|
46246
|
+
* @param sessionId - The session ID to set
|
|
46247
|
+
* @throws Error if the MCP SDK version is incompatible
|
|
46248
|
+
*/
|
|
46249
|
+
_applyInitState(webTransport, sessionId) {
|
|
46250
|
+
if (!("_initialized" in webTransport)) {
|
|
46251
|
+
throw new InvalidTransportSessionError(
|
|
46252
|
+
"[RecreateableStreamableHTTPServerTransport] Expected _initialized field not found on internal transport. This may indicate an incompatible MCP SDK version."
|
|
46253
|
+
);
|
|
46254
|
+
}
|
|
46255
|
+
webTransport._initialized = true;
|
|
46256
|
+
webTransport.sessionId = sessionId;
|
|
46257
|
+
}
|
|
46258
|
+
/**
|
|
46259
|
+
* Override handleRequest to:
|
|
46260
|
+
* 1. Recreate the internal transport for stateless mode (MCP SDK 1.26.0 single-use guard)
|
|
46261
|
+
* 2. Apply any pending initialization state before processing
|
|
46262
|
+
*/
|
|
46263
|
+
async handleRequest(req, res, body) {
|
|
46264
|
+
const oldWebTransport = this._webStandardTransport;
|
|
46265
|
+
if (oldWebTransport && this._isStateless && oldWebTransport._hasHandledRequest) {
|
|
46266
|
+
const fresh = new import_protocol51.WebStandardStreamableHTTPServerTransport(this._constructorOptions);
|
|
46267
|
+
fresh.onmessage = oldWebTransport.onmessage;
|
|
46268
|
+
fresh.onclose = oldWebTransport.onclose;
|
|
46269
|
+
fresh.onerror = oldWebTransport.onerror;
|
|
46270
|
+
await fresh.start();
|
|
46271
|
+
this._webStandardTransport = fresh;
|
|
46272
|
+
}
|
|
46273
|
+
if (this._pendingInitState) {
|
|
46274
|
+
const webTransport = this._webStandardTransport;
|
|
46275
|
+
if (webTransport) {
|
|
46276
|
+
this._applyInitState(webTransport, this._pendingInitState);
|
|
46277
|
+
this._pendingInitState = void 0;
|
|
46278
|
+
}
|
|
46279
|
+
}
|
|
46280
|
+
if (!res.headersSent) res.removeHeader?.("Content-Type");
|
|
46281
|
+
return super.handleRequest(req, res, body);
|
|
46282
|
+
}
|
|
46283
|
+
};
|
|
46284
|
+
}
|
|
46285
|
+
});
|
|
46286
|
+
|
|
46287
|
+
// libs/sdk/src/transport/adapters/transport.streamable-http.adapter.ts
|
|
46288
|
+
async function loadStreamableHttpTransport() {
|
|
46289
|
+
RecreateableTransport ??= (await Promise.resolve().then(() => (init_streamable_http_transport(), streamable_http_transport_exports))).RecreateableStreamableHTTPServerTransport;
|
|
46290
|
+
}
|
|
46291
|
+
var import_lazy_zod74, RecreateableTransport, resolveSessionIdGenerator, TransportStreamableHttpAdapter;
|
|
46292
|
+
var init_transport_streamable_http_adapter = __esm({
|
|
46293
|
+
"libs/sdk/src/transport/adapters/transport.streamable-http.adapter.ts"() {
|
|
46294
|
+
"use strict";
|
|
46295
|
+
import_lazy_zod74 = require("@frontmcp/lazy-zod");
|
|
46296
|
+
init_errors();
|
|
46297
|
+
init_session_scoped_event_store();
|
|
46298
|
+
init_transport_error();
|
|
46299
|
+
init_transport_types();
|
|
46300
|
+
init_transport_local_adapter();
|
|
46301
|
+
resolveSessionIdGenerator = (transportType, sessionId) => {
|
|
46302
|
+
return transportType === "stateless-http" ? () => STATELESS_SESSION_ID : () => sessionId;
|
|
46303
|
+
};
|
|
46304
|
+
TransportStreamableHttpAdapter = class extends LocalTransportAdapter {
|
|
46305
|
+
createTransport(sessionId, response) {
|
|
46306
|
+
const sessionIdGenerator = resolveSessionIdGenerator(this.key.type, sessionId);
|
|
46307
|
+
const sharedEventStore = this.scope.eventStore;
|
|
46308
|
+
const eventStore = sharedEventStore ? createSessionScopedEventStore(sharedEventStore, sessionId) : void 0;
|
|
46309
|
+
const isStateless = this.key.type === "stateless-http";
|
|
46310
|
+
if (!RecreateableTransport) {
|
|
46311
|
+
throw new InternalMcpError(
|
|
46312
|
+
"The Streamable HTTP transport was used before loadStreamableHttpTransport() loaded it"
|
|
46313
|
+
);
|
|
46314
|
+
}
|
|
46315
|
+
return new RecreateableTransport({
|
|
46316
|
+
sessionIdGenerator,
|
|
46317
|
+
isStateless,
|
|
46318
|
+
onsessionclosed: () => {
|
|
46319
|
+
},
|
|
46320
|
+
onsessioninitialized: (sessionId2) => {
|
|
46321
|
+
if (sessionId2) {
|
|
46322
|
+
this.logger.verbose("[StreamableHttpAdapter] session initialized", { sessionId: sessionId2.slice(0, 40) });
|
|
46323
|
+
} else {
|
|
46324
|
+
this.logger.verbose("[StreamableHttpAdapter] stateless session initialized");
|
|
46325
|
+
}
|
|
46326
|
+
},
|
|
46327
|
+
// Pass EventStore from scope config (or undefined to disable resumability)
|
|
46328
|
+
// When undefined: disabled to prevent priming events - Claude.ai's client doesn't handle them
|
|
46329
|
+
// The priming event has empty data with no `event:` type, which violates MCP spec
|
|
46330
|
+
// ("Event types MUST be message") and confuses some clients
|
|
46331
|
+
eventStore
|
|
46332
|
+
});
|
|
46333
|
+
}
|
|
46334
|
+
async initialize(req, res) {
|
|
46335
|
+
this.ensureAuthInfo(req, this);
|
|
46336
|
+
this.logger.verbose("[StreamableHttpAdapter] initialize() called", {
|
|
46337
|
+
method: req.method,
|
|
46338
|
+
sessionId: this.key.sessionId.slice(0, 30),
|
|
46339
|
+
bodyMethod: req.body?.method,
|
|
46340
|
+
bodyJsonrpc: req.body?.jsonrpc,
|
|
46341
|
+
bodyId: req.body?.id,
|
|
46342
|
+
bodyType: typeof req.body,
|
|
46343
|
+
bodyKeys: req.body && typeof req.body === "object" ? Object.keys(req.body) : []
|
|
46344
|
+
});
|
|
46345
|
+
await this.ready;
|
|
46346
|
+
this.logger.verbose("[StreamableHttpAdapter] transport state before handleRequest", {
|
|
46347
|
+
isRecreatable: RecreateableTransport !== void 0 && this.transport instanceof RecreateableTransport,
|
|
46348
|
+
hasWebTransport: !!this.transport._webStandardTransport,
|
|
46349
|
+
webTransportInitialized: this.transport._webStandardTransport?._initialized,
|
|
46350
|
+
webTransportStarted: this.transport._webStandardTransport?._started,
|
|
46351
|
+
hasSessionIdGenerator: this.transport._webStandardTransport?.sessionIdGenerator !== void 0
|
|
46352
|
+
});
|
|
46353
|
+
const originalWrite = res.write.bind(res);
|
|
46354
|
+
const originalEnd = res.end.bind(res);
|
|
46355
|
+
let responseBody = "";
|
|
46356
|
+
res.write = function(chunk, encodingOrCb, cb) {
|
|
46357
|
+
if (chunk) {
|
|
46358
|
+
responseBody += typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString() : String(chunk);
|
|
46359
|
+
}
|
|
46360
|
+
return originalWrite.call(this, chunk, encodingOrCb, cb);
|
|
46361
|
+
};
|
|
46362
|
+
const adapter = this;
|
|
46363
|
+
res.end = function(chunk, encodingOrCb, cb) {
|
|
46364
|
+
if (chunk) {
|
|
46365
|
+
responseBody += typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString() : String(chunk);
|
|
46366
|
+
}
|
|
46367
|
+
adapter.logger.verbose("[StreamableHttpAdapter] initialize response", {
|
|
46368
|
+
statusCode: res.statusCode,
|
|
46369
|
+
headers: res.getHeaders?.() ?? {},
|
|
46370
|
+
bodyLength: responseBody.length
|
|
46371
|
+
});
|
|
46372
|
+
return originalEnd.call(this, chunk, encodingOrCb, cb);
|
|
46373
|
+
};
|
|
46374
|
+
return this.transport.handleRequest(req, res, req.body);
|
|
46375
|
+
}
|
|
46376
|
+
async handleRequest(req, res) {
|
|
46377
|
+
this.ensureAuthInfo(req, this);
|
|
46378
|
+
if (req.method === "GET") {
|
|
46379
|
+
return this.transport.handleRequest(req, res);
|
|
46380
|
+
} else {
|
|
46381
|
+
if (this.handleIfElicitResult(req)) {
|
|
46382
|
+
return;
|
|
46383
|
+
}
|
|
46384
|
+
return this.transport.handleRequest(req, res, req.body);
|
|
46385
|
+
}
|
|
46386
|
+
}
|
|
46387
|
+
/**
|
|
46388
|
+
* Send an elicitation request to the client.
|
|
46389
|
+
*
|
|
46390
|
+
* Only one elicit per session is allowed. A new elicit will cancel any pending one.
|
|
46391
|
+
* On timeout, an ElicitationTimeoutError is thrown to kill tool execution.
|
|
46392
|
+
*
|
|
46393
|
+
* Uses the ElicitationRequestFlow for preparation (validation, ID generation,
|
|
46394
|
+
* storing pending record, building params) with hook support for middleware.
|
|
46395
|
+
*
|
|
46396
|
+
* In distributed mode, the pending elicitation is stored in Redis and results
|
|
46397
|
+
* are routed via pub/sub, allowing the response to be received by any node.
|
|
46398
|
+
*
|
|
46399
|
+
* @param relatedRequestId - The request ID that triggered this elicit
|
|
46400
|
+
* @param message - Message to display to the user
|
|
46401
|
+
* @param requestedSchema - Zod schema for the expected response
|
|
46402
|
+
* @param options - Elicit options (mode, ttl, elicitationId)
|
|
46403
|
+
* @returns ElicitResult with status and typed content
|
|
46404
|
+
*/
|
|
46405
|
+
async sendElicitRequest(relatedRequestId, message, requestedSchema, options) {
|
|
46406
|
+
await this.cancelPendingElicit();
|
|
46407
|
+
const store = this.requireElicitStore();
|
|
46408
|
+
const sessionId = this.key.sessionId;
|
|
46409
|
+
const flowOutput = await this.scope.runFlowForOutput("elicitation:request", {
|
|
46410
|
+
relatedRequestId,
|
|
46411
|
+
sessionId,
|
|
46412
|
+
message,
|
|
46413
|
+
requestedSchema: (0, import_lazy_zod74.toJSONSchema)(requestedSchema),
|
|
46414
|
+
options
|
|
46415
|
+
});
|
|
46416
|
+
const { elicitId, expiresAt, requestParams, pendingRecord } = flowOutput;
|
|
46417
|
+
const ttl = expiresAt - Date.now();
|
|
46418
|
+
this.logger.verbose("[StreamableHttpAdapter] sendElicitRequest: sending elicitation/create", {
|
|
46419
|
+
relatedRequestId,
|
|
46420
|
+
elicitId,
|
|
46421
|
+
mode: pendingRecord.mode,
|
|
46422
|
+
message: message.slice(0, 100)
|
|
46423
|
+
});
|
|
46424
|
+
try {
|
|
46425
|
+
await this.transport.send(rpcRequest(this.newRequestId, "elicitation/create", requestParams), {
|
|
46426
|
+
relatedRequestId
|
|
46427
|
+
});
|
|
46428
|
+
this.logger.verbose("[StreamableHttpAdapter] sendElicitRequest: transport.send() completed");
|
|
46429
|
+
} catch (error) {
|
|
46430
|
+
this.logger.error("[StreamableHttpAdapter] sendElicitRequest: transport.send() failed", error);
|
|
46431
|
+
try {
|
|
46432
|
+
await store.deletePending(sessionId);
|
|
46433
|
+
this.logger.verbose("[StreamableHttpAdapter] sendElicitRequest: cleaned up pending record after send failure");
|
|
46434
|
+
} catch (cleanupError) {
|
|
46435
|
+
this.logger.warn("[StreamableHttpAdapter] sendElicitRequest: failed to clean up pending record", cleanupError);
|
|
46436
|
+
}
|
|
46437
|
+
throw error;
|
|
46438
|
+
}
|
|
46439
|
+
return new Promise((resolve, reject) => {
|
|
46440
|
+
let settled = false;
|
|
46441
|
+
let unsubscribe;
|
|
46442
|
+
const cleanup = () => {
|
|
46443
|
+
clearTimeout(timeoutHandle);
|
|
46444
|
+
this.pendingElicit = void 0;
|
|
46445
|
+
void unsubscribe?.();
|
|
46446
|
+
};
|
|
46447
|
+
const safeResolve = (result) => {
|
|
46448
|
+
if (settled) return;
|
|
46449
|
+
settled = true;
|
|
46450
|
+
cleanup();
|
|
46451
|
+
resolve(result);
|
|
46452
|
+
};
|
|
46453
|
+
const safeReject = (err) => {
|
|
46454
|
+
if (settled) return;
|
|
46455
|
+
settled = true;
|
|
46456
|
+
cleanup();
|
|
46457
|
+
reject(err);
|
|
46458
|
+
};
|
|
46459
|
+
const timeoutHandle = setTimeout(async () => {
|
|
46460
|
+
if (settled) return;
|
|
46461
|
+
settled = true;
|
|
46462
|
+
this.pendingElicit = void 0;
|
|
46463
|
+
await unsubscribe?.();
|
|
46464
|
+
await store.deletePending(sessionId);
|
|
46465
|
+
reject(new ElicitationTimeoutError(elicitId, ttl));
|
|
46466
|
+
}, ttl);
|
|
46467
|
+
store.subscribeResult(
|
|
46468
|
+
elicitId,
|
|
46469
|
+
(result) => {
|
|
46470
|
+
safeResolve(result);
|
|
46471
|
+
},
|
|
46472
|
+
sessionId
|
|
46473
|
+
).then((unsub) => {
|
|
46474
|
+
unsubscribe = unsub;
|
|
46475
|
+
}).catch(async (err) => {
|
|
46476
|
+
if (settled) return;
|
|
46477
|
+
settled = true;
|
|
46478
|
+
clearTimeout(timeoutHandle);
|
|
46479
|
+
this.pendingElicit = void 0;
|
|
46480
|
+
await unsubscribe?.();
|
|
46481
|
+
await store.deletePending(sessionId);
|
|
46482
|
+
reject(err);
|
|
46483
|
+
});
|
|
46484
|
+
this.pendingElicit = {
|
|
46485
|
+
elicitId,
|
|
46486
|
+
timeoutHandle,
|
|
46487
|
+
resolve: safeResolve,
|
|
46488
|
+
reject: safeReject
|
|
46489
|
+
};
|
|
46490
|
+
});
|
|
46491
|
+
}
|
|
46492
|
+
get isInitialized() {
|
|
46493
|
+
return this.transport.isInitialized || this.transport.hasPendingInitState;
|
|
46494
|
+
}
|
|
46495
|
+
/**
|
|
46496
|
+
* Resets the transport's initialization state to allow re-initialization.
|
|
46497
|
+
* Used when a client retries initialize on an already-initialized session
|
|
46498
|
+
* (e.g., after reconnect following session termination).
|
|
46499
|
+
*/
|
|
46500
|
+
resetForReinitialization() {
|
|
46501
|
+
this.transport.resetForReinitialization();
|
|
46502
|
+
this.logger.info("[StreamableHttpAdapter] Reset transport for re-initialization", {
|
|
46503
|
+
sessionId: this.key.sessionId?.slice(0, 20)
|
|
46504
|
+
});
|
|
46505
|
+
}
|
|
46506
|
+
/**
|
|
46507
|
+
* Marks this transport as pre-initialized for session recreation.
|
|
46508
|
+
* This is needed when recreating a transport from Redis because the
|
|
46509
|
+
* original initialize request was processed by a different transport instance.
|
|
46510
|
+
*
|
|
46511
|
+
* Uses the RecreateableStreamableHTTPServerTransport's public API to set
|
|
46512
|
+
* initialization state, avoiding access to private properties.
|
|
46513
|
+
*/
|
|
46514
|
+
markAsInitialized() {
|
|
46515
|
+
this.transport.setInitializationState(this.key.sessionId);
|
|
46516
|
+
this.logger.info("[StreamableHttpAdapter] Marked transport as pre-initialized for session recreation", {
|
|
46517
|
+
sessionId: this.key.sessionId?.slice(0, 20),
|
|
46518
|
+
isInitialized: this.transport.isInitialized
|
|
46519
|
+
});
|
|
46520
|
+
}
|
|
46521
|
+
};
|
|
46522
|
+
}
|
|
46523
|
+
});
|
|
46524
|
+
|
|
45939
46525
|
// libs/sdk/src/transport/flows/handle.mcp-20260728.flow.ts
|
|
45940
46526
|
function frame2(message) {
|
|
45941
46527
|
return encoder3.encode(`event: message
|
|
@@ -46006,14 +46592,14 @@ function toClientInfo(value) {
|
|
|
46006
46592
|
const { name: name48, version } = value;
|
|
46007
46593
|
return typeof name48 === "string" && typeof version === "string" ? { name: name48, version } : void 0;
|
|
46008
46594
|
}
|
|
46009
|
-
var import_auth44,
|
|
46595
|
+
var import_auth44, import_lazy_zod75, import_protocol52, import_utils93, plan22, subscriptionParamsSchema, requestIdSchema, stateSchema20, name22, Stage22, encoder3, TRACE_META_KEYS, HandleMcp20260728Flow;
|
|
46010
46596
|
var init_handle_mcp_20260728_flow = __esm({
|
|
46011
46597
|
"libs/sdk/src/transport/flows/handle.mcp-20260728.flow.ts"() {
|
|
46012
46598
|
"use strict";
|
|
46013
46599
|
import_auth44 = require("@frontmcp/auth");
|
|
46014
|
-
|
|
46015
|
-
|
|
46016
|
-
|
|
46600
|
+
import_lazy_zod75 = require("@frontmcp/lazy-zod");
|
|
46601
|
+
import_protocol52 = require("@frontmcp/protocol");
|
|
46602
|
+
import_utils93 = require("@frontmcp/utils");
|
|
46017
46603
|
init_common();
|
|
46018
46604
|
init_tool_lookup_utils();
|
|
46019
46605
|
init_context();
|
|
@@ -46026,22 +46612,22 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46026
46612
|
post: [],
|
|
46027
46613
|
finalize: ["cleanup"]
|
|
46028
46614
|
};
|
|
46029
|
-
subscriptionParamsSchema =
|
|
46030
|
-
notifications:
|
|
46031
|
-
toolsListChanged:
|
|
46032
|
-
promptsListChanged:
|
|
46033
|
-
resourcesListChanged:
|
|
46034
|
-
resourceSubscriptions:
|
|
46615
|
+
subscriptionParamsSchema = import_lazy_zod75.z.object({
|
|
46616
|
+
notifications: import_lazy_zod75.z.object({
|
|
46617
|
+
toolsListChanged: import_lazy_zod75.z.boolean().optional(),
|
|
46618
|
+
promptsListChanged: import_lazy_zod75.z.boolean().optional(),
|
|
46619
|
+
resourcesListChanged: import_lazy_zod75.z.boolean().optional(),
|
|
46620
|
+
resourceSubscriptions: import_lazy_zod75.z.array(import_lazy_zod75.z.string()).optional()
|
|
46035
46621
|
}).default({})
|
|
46036
46622
|
});
|
|
46037
|
-
requestIdSchema =
|
|
46038
|
-
stateSchema20 =
|
|
46623
|
+
requestIdSchema = import_lazy_zod75.z.union([import_lazy_zod75.z.string(), import_lazy_zod75.z.number()]);
|
|
46624
|
+
stateSchema20 = import_lazy_zod75.z.object({
|
|
46039
46625
|
/** Negotiated protocol version for this request. */
|
|
46040
|
-
version:
|
|
46041
|
-
requestType:
|
|
46042
|
-
isAnonymous:
|
|
46626
|
+
version: import_lazy_zod75.z.string().optional(),
|
|
46627
|
+
requestType: import_lazy_zod75.z.enum(["notification", "subscriptions", "message"]).optional(),
|
|
46628
|
+
isAnonymous: import_lazy_zod75.z.boolean().default(true),
|
|
46043
46629
|
/** Whether the client declared this revision itself (not served under it by default). */
|
|
46044
|
-
clientDeclaredRevision:
|
|
46630
|
+
clientDeclaredRevision: import_lazy_zod75.z.boolean().optional()
|
|
46045
46631
|
});
|
|
46046
46632
|
name22 = "handle:mcp-202607280728";
|
|
46047
46633
|
({ Stage: Stage22 } = FlowHooksOf(name22));
|
|
@@ -46108,7 +46694,7 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46108
46694
|
if (!context) return (fn) => fn();
|
|
46109
46695
|
const storage = this.scope.providers.get(FrontMcpContextStorage);
|
|
46110
46696
|
return async (fn) => {
|
|
46111
|
-
await (0,
|
|
46697
|
+
await (0, import_utils93.runRequestExclusive)(() => storage.runWithContext(context, fn));
|
|
46112
46698
|
};
|
|
46113
46699
|
}
|
|
46114
46700
|
/**
|
|
@@ -46185,7 +46771,7 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46185
46771
|
* session that initializes with that capability is subscribed to.
|
|
46186
46772
|
*/
|
|
46187
46773
|
async listenedChannels(meta) {
|
|
46188
|
-
const capabilities = meta?.[
|
|
46774
|
+
const capabilities = meta?.[import_protocol52.MCP_20260728_META.clientCapabilities];
|
|
46189
46775
|
if (!supportsChannels(capabilities) || !this.scope.channels) return [];
|
|
46190
46776
|
const listed = await this.scope.runFlowForOutput("channels:list", {});
|
|
46191
46777
|
return listed.channels.map((channel2) => channel2.name);
|
|
@@ -46197,12 +46783,12 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46197
46783
|
const meta = params["_meta"] ?? {};
|
|
46198
46784
|
const auth = request[ServerRequestTokens.auth];
|
|
46199
46785
|
const stdio = this.stdioOrigin;
|
|
46200
|
-
const clientCapabilities = meta[
|
|
46201
|
-
const logLevel = typeof meta[
|
|
46786
|
+
const clientCapabilities = meta[import_protocol52.MCP_20260728_META.clientCapabilities] ?? {};
|
|
46787
|
+
const logLevel = typeof meta[import_protocol52.MCP_20260728_META.logLevel] === "string" ? meta[import_protocol52.MCP_20260728_META.logLevel] : void 0;
|
|
46202
46788
|
const rawProgressToken = meta["progressToken"];
|
|
46203
46789
|
const progressToken = typeof rawProgressToken === "string" || typeof rawProgressToken === "number" ? rawProgressToken : void 0;
|
|
46204
46790
|
const sink = new RequestNotificationSink(logLevel, progressToken);
|
|
46205
|
-
const clientInfo = toClientInfo(meta[
|
|
46791
|
+
const clientInfo = toClientInfo(meta[import_protocol52.MCP_20260728_META.clientInfo]);
|
|
46206
46792
|
if (clientInfo) {
|
|
46207
46793
|
const platformType = resolvePlatformType(
|
|
46208
46794
|
clientInfo,
|
|
@@ -46347,11 +46933,11 @@ function resolveLegacySseSession(params) {
|
|
|
46347
46933
|
}
|
|
46348
46934
|
return { session: createSession(), createdNew: true, responded404: false };
|
|
46349
46935
|
}
|
|
46350
|
-
var
|
|
46936
|
+
var import_lazy_zod76, plan23, stateSessionSchema, stateSchema21, name23, Stage23, HandleSseFlow;
|
|
46351
46937
|
var init_handle_sse_flow = __esm({
|
|
46352
46938
|
"libs/sdk/src/transport/flows/handle.sse.flow.ts"() {
|
|
46353
46939
|
"use strict";
|
|
46354
|
-
|
|
46940
|
+
import_lazy_zod76 = require("@frontmcp/lazy-zod");
|
|
46355
46941
|
init_session_id_utils();
|
|
46356
46942
|
init_common();
|
|
46357
46943
|
init_errors();
|
|
@@ -46363,22 +46949,22 @@ var init_handle_sse_flow = __esm({
|
|
|
46363
46949
|
post: [],
|
|
46364
46950
|
finalize: ["cleanup"]
|
|
46365
46951
|
};
|
|
46366
|
-
stateSessionSchema =
|
|
46367
|
-
id:
|
|
46368
|
-
payload:
|
|
46369
|
-
nodeId:
|
|
46370
|
-
authSig:
|
|
46371
|
-
uuid:
|
|
46372
|
-
iat:
|
|
46373
|
-
protocol:
|
|
46374
|
-
isPublic:
|
|
46375
|
-
platformType:
|
|
46952
|
+
stateSessionSchema = import_lazy_zod76.z.object({
|
|
46953
|
+
id: import_lazy_zod76.z.string(),
|
|
46954
|
+
payload: import_lazy_zod76.z.object({
|
|
46955
|
+
nodeId: import_lazy_zod76.z.string(),
|
|
46956
|
+
authSig: import_lazy_zod76.z.string(),
|
|
46957
|
+
uuid: import_lazy_zod76.z.string().uuid(),
|
|
46958
|
+
iat: import_lazy_zod76.z.number(),
|
|
46959
|
+
protocol: import_lazy_zod76.z.enum(["legacy-sse", "sse", "streamable-http", "stateful-http", "stateless-http"]).optional(),
|
|
46960
|
+
isPublic: import_lazy_zod76.z.boolean().optional(),
|
|
46961
|
+
platformType: import_lazy_zod76.z.enum(["openai", "claude", "gemini", "cursor", "continue", "cody", "generic-mcp", "ext-apps", "unknown"]).optional()
|
|
46376
46962
|
}).optional()
|
|
46377
46963
|
});
|
|
46378
|
-
stateSchema21 =
|
|
46379
|
-
token:
|
|
46964
|
+
stateSchema21 = import_lazy_zod76.z.object({
|
|
46965
|
+
token: import_lazy_zod76.z.string(),
|
|
46380
46966
|
session: stateSessionSchema,
|
|
46381
|
-
requestType:
|
|
46967
|
+
requestType: import_lazy_zod76.z.enum(["initialize", "message", "elicitResult"]).optional()
|
|
46382
46968
|
});
|
|
46383
46969
|
name23 = "handle:legacy-sse";
|
|
46384
46970
|
({ Stage: Stage23 } = FlowHooksOf(name23));
|
|
@@ -46508,12 +47094,12 @@ var init_handle_sse_flow = __esm({
|
|
|
46508
47094
|
});
|
|
46509
47095
|
|
|
46510
47096
|
// libs/sdk/src/transport/flows/handle.stateless-http.flow.ts
|
|
46511
|
-
var
|
|
47097
|
+
var import_lazy_zod77, import_protocol53, plan24, stateSchema22, name24, Stage24, HandleStatelessHttpFlow;
|
|
46512
47098
|
var init_handle_stateless_http_flow = __esm({
|
|
46513
47099
|
"libs/sdk/src/transport/flows/handle.stateless-http.flow.ts"() {
|
|
46514
47100
|
"use strict";
|
|
46515
|
-
|
|
46516
|
-
|
|
47101
|
+
import_lazy_zod77 = require("@frontmcp/lazy-zod");
|
|
47102
|
+
import_protocol53 = require("@frontmcp/protocol");
|
|
46517
47103
|
init_common();
|
|
46518
47104
|
init_errors();
|
|
46519
47105
|
init_ha_headers();
|
|
@@ -46524,10 +47110,10 @@ var init_handle_stateless_http_flow = __esm({
|
|
|
46524
47110
|
post: [],
|
|
46525
47111
|
finalize: ["cleanup"]
|
|
46526
47112
|
};
|
|
46527
|
-
stateSchema22 =
|
|
46528
|
-
token:
|
|
46529
|
-
isAuthenticated:
|
|
46530
|
-
requestType:
|
|
47113
|
+
stateSchema22 = import_lazy_zod77.z.object({
|
|
47114
|
+
token: import_lazy_zod77.z.string().optional(),
|
|
47115
|
+
isAuthenticated: import_lazy_zod77.z.boolean(),
|
|
47116
|
+
requestType: import_lazy_zod77.z.enum(["initialize", "message"]).optional()
|
|
46531
47117
|
});
|
|
46532
47118
|
name24 = "handle:stateless-http";
|
|
46533
47119
|
({ Stage: Stage24 } = FlowHooksOf(name24));
|
|
@@ -46558,7 +47144,7 @@ var init_handle_stateless_http_flow = __esm({
|
|
|
46558
47144
|
if (method === "initialize") {
|
|
46559
47145
|
this.state.set("requestType", "initialize");
|
|
46560
47146
|
logger.verbose("router: requestType=initialize, method=POST");
|
|
46561
|
-
} else if (method &&
|
|
47147
|
+
} else if (method && import_protocol53.RequestSchema.safeParse(request.body).success) {
|
|
46562
47148
|
this.state.set("requestType", "message");
|
|
46563
47149
|
logger.verbose(`router: requestType=message, method=${method}`);
|
|
46564
47150
|
} else {
|
|
@@ -46654,11 +47240,11 @@ var init_ext_apps_types = __esm({
|
|
|
46654
47240
|
function createExtAppsMessageHandler(options) {
|
|
46655
47241
|
return new ExtAppsMessageHandler(options);
|
|
46656
47242
|
}
|
|
46657
|
-
var
|
|
47243
|
+
var import_utils94, MCP_LOG_LEVELS, ExtAppsMessageHandler, ExtAppsError, ExtAppsMethodNotFoundError, ExtAppsInvalidParamsError, ExtAppsNotSupportedError, ExtAppsToolNotFoundError;
|
|
46658
47244
|
var init_ext_apps_handler = __esm({
|
|
46659
47245
|
"libs/sdk/src/ext-apps/ext-apps.handler.ts"() {
|
|
46660
47246
|
"use strict";
|
|
46661
|
-
|
|
47247
|
+
import_utils94 = require("@frontmcp/utils");
|
|
46662
47248
|
init_ext_apps_types();
|
|
46663
47249
|
MCP_LOG_LEVELS = {
|
|
46664
47250
|
debug: "debug",
|
|
@@ -46712,7 +47298,7 @@ var init_ext_apps_handler = __esm({
|
|
|
46712
47298
|
code: errorCode,
|
|
46713
47299
|
message: errorMessage2,
|
|
46714
47300
|
// Only include stack traces in development to avoid leaking internals in production
|
|
46715
|
-
data: (0,
|
|
47301
|
+
data: (0, import_utils94.isDevelopment)() && error instanceof Error ? { stack: error.stack } : void 0
|
|
46716
47302
|
}
|
|
46717
47303
|
};
|
|
46718
47304
|
}
|
|
@@ -47088,10 +47674,10 @@ function classifyStreamableHttpRequest(params) {
|
|
|
47088
47674
|
if (typeof jsonRpcMethod === "string" && (jsonRpcMethod.startsWith("ui/") || jsonRpcMethod === "notifications/message")) {
|
|
47089
47675
|
return { requestType: "extApps" };
|
|
47090
47676
|
}
|
|
47091
|
-
if (
|
|
47677
|
+
if (import_protocol54.ElicitResultSchema.safeParse(body?.result).success) {
|
|
47092
47678
|
return { requestType: "elicitResult" };
|
|
47093
47679
|
}
|
|
47094
|
-
if (jsonRpcMethod &&
|
|
47680
|
+
if (jsonRpcMethod && import_protocol54.RequestSchema.safeParse(body).success) {
|
|
47095
47681
|
return { requestType: "message" };
|
|
47096
47682
|
}
|
|
47097
47683
|
return { error: "Invalid Request" };
|
|
@@ -47145,12 +47731,12 @@ async function lookupStreamableHttpTransport(params) {
|
|
|
47145
47731
|
}
|
|
47146
47732
|
return { kind: "session-not-initialized", recreationError };
|
|
47147
47733
|
}
|
|
47148
|
-
var
|
|
47734
|
+
var import_lazy_zod78, import_protocol54, plan25, stateSessionSchema2, stateSchema23, name25, Stage25, HandleStreamableHttpFlow;
|
|
47149
47735
|
var init_handle_streamable_http_flow = __esm({
|
|
47150
47736
|
"libs/sdk/src/transport/flows/handle.streamable-http.flow.ts"() {
|
|
47151
47737
|
"use strict";
|
|
47152
|
-
|
|
47153
|
-
|
|
47738
|
+
import_lazy_zod78 = require("@frontmcp/lazy-zod");
|
|
47739
|
+
import_protocol54 = require("@frontmcp/protocol");
|
|
47154
47740
|
init_session_id_utils();
|
|
47155
47741
|
init_common();
|
|
47156
47742
|
init_errors();
|
|
@@ -47164,22 +47750,22 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
47164
47750
|
post: [],
|
|
47165
47751
|
finalize: ["cleanup"]
|
|
47166
47752
|
};
|
|
47167
|
-
stateSessionSchema2 =
|
|
47168
|
-
id:
|
|
47169
|
-
payload:
|
|
47170
|
-
nodeId:
|
|
47171
|
-
authSig:
|
|
47172
|
-
uuid:
|
|
47173
|
-
iat:
|
|
47174
|
-
protocol:
|
|
47175
|
-
isPublic:
|
|
47176
|
-
platformType:
|
|
47753
|
+
stateSessionSchema2 = import_lazy_zod78.z.object({
|
|
47754
|
+
id: import_lazy_zod78.z.string(),
|
|
47755
|
+
payload: import_lazy_zod78.z.object({
|
|
47756
|
+
nodeId: import_lazy_zod78.z.string(),
|
|
47757
|
+
authSig: import_lazy_zod78.z.string(),
|
|
47758
|
+
uuid: import_lazy_zod78.z.string().uuid(),
|
|
47759
|
+
iat: import_lazy_zod78.z.number(),
|
|
47760
|
+
protocol: import_lazy_zod78.z.enum(["legacy-sse", "sse", "streamable-http", "stateful-http", "stateless-http"]).optional(),
|
|
47761
|
+
isPublic: import_lazy_zod78.z.boolean().optional(),
|
|
47762
|
+
platformType: import_lazy_zod78.z.enum(["openai", "claude", "gemini", "cursor", "continue", "cody", "generic-mcp", "ext-apps", "unknown"]).optional()
|
|
47177
47763
|
}).optional()
|
|
47178
47764
|
});
|
|
47179
|
-
stateSchema23 =
|
|
47180
|
-
token:
|
|
47765
|
+
stateSchema23 = import_lazy_zod78.z.object({
|
|
47766
|
+
token: import_lazy_zod78.z.string(),
|
|
47181
47767
|
session: stateSessionSchema2,
|
|
47182
|
-
requestType:
|
|
47768
|
+
requestType: import_lazy_zod78.z.enum(["initialize", "message", "elicitResult", "sseListener", "extApps"]).optional()
|
|
47183
47769
|
});
|
|
47184
47770
|
name25 = "handle:streamable-http";
|
|
47185
47771
|
({ Stage: Stage25 } = FlowHooksOf(name25));
|
|
@@ -47575,7 +48161,7 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
47575
48161
|
_skipUI: true
|
|
47576
48162
|
}
|
|
47577
48163
|
});
|
|
47578
|
-
const parsed =
|
|
48164
|
+
const parsed = import_protocol54.CallToolResultSchema.safeParse(result);
|
|
47579
48165
|
if (parsed.success) {
|
|
47580
48166
|
return parsed.data;
|
|
47581
48167
|
}
|
|
@@ -47743,7 +48329,7 @@ function encodeBytes(bytes) {
|
|
|
47743
48329
|
try {
|
|
47744
48330
|
return { data: utf8Decoder.decode(bytes), encoding: "utf8" };
|
|
47745
48331
|
} catch {
|
|
47746
|
-
return { data: (0,
|
|
48332
|
+
return { data: (0, import_utils95.base64Encode)(bytes), encoding: "base64" };
|
|
47747
48333
|
}
|
|
47748
48334
|
}
|
|
47749
48335
|
function encodeRelayChunk(chunk, encoding) {
|
|
@@ -47759,16 +48345,16 @@ function encodeRelayChunk(chunk, encoding) {
|
|
|
47759
48345
|
return text.length > 0 ? { data: text, encoding: "utf8" } : void 0;
|
|
47760
48346
|
}
|
|
47761
48347
|
function decodeRelayChunk(chunk) {
|
|
47762
|
-
return chunk.encoding === "base64" ? (0,
|
|
48348
|
+
return chunk.encoding === "base64" ? (0, import_utils95.base64Decode)(chunk.data) : chunk.data;
|
|
47763
48349
|
}
|
|
47764
48350
|
function isFlatHeaderList(headers) {
|
|
47765
48351
|
return Array.isArray(headers);
|
|
47766
48352
|
}
|
|
47767
|
-
var
|
|
48353
|
+
var import_utils95, RelayEmitter, utf8Decoder, HOP_BY_HOP_HEADERS, RelayServerResponse;
|
|
47768
48354
|
var init_relay_http = __esm({
|
|
47769
48355
|
"libs/sdk/src/transport/relay/relay-http.ts"() {
|
|
47770
48356
|
"use strict";
|
|
47771
|
-
|
|
48357
|
+
import_utils95 = require("@frontmcp/utils");
|
|
47772
48358
|
init_common();
|
|
47773
48359
|
RelayEmitter = class {
|
|
47774
48360
|
listeners = /* @__PURE__ */ new Map();
|
|
@@ -47984,28 +48570,6 @@ var init_relay_http = __esm({
|
|
|
47984
48570
|
}
|
|
47985
48571
|
});
|
|
47986
48572
|
|
|
47987
|
-
// libs/sdk/src/transport/transport.error.ts
|
|
47988
|
-
var import_utils95, JSON_RPC2, rpcError, rpcRequest;
|
|
47989
|
-
var init_transport_error = __esm({
|
|
47990
|
-
"libs/sdk/src/transport/transport.error.ts"() {
|
|
47991
|
-
"use strict";
|
|
47992
|
-
import_utils95 = require("@frontmcp/utils");
|
|
47993
|
-
JSON_RPC2 = "2.0";
|
|
47994
|
-
rpcError = (message, requestId) => ({
|
|
47995
|
-
jsonrpc: JSON_RPC2,
|
|
47996
|
-
error: { code: -32e3, message },
|
|
47997
|
-
id: requestId ?? (0, import_utils95.randomUUID)()
|
|
47998
|
-
// change it to request id + random
|
|
47999
|
-
});
|
|
48000
|
-
rpcRequest = (requestId, method, params) => ({
|
|
48001
|
-
jsonrpc: JSON_RPC2,
|
|
48002
|
-
id: requestId ?? (0, import_utils95.randomUUID)(),
|
|
48003
|
-
method,
|
|
48004
|
-
...params !== void 0 && { params }
|
|
48005
|
-
});
|
|
48006
|
-
}
|
|
48007
|
-
});
|
|
48008
|
-
|
|
48009
48573
|
// libs/sdk/src/transport/adapters/polyfills/browser-sse-transport.ts
|
|
48010
48574
|
var SSEServerTransport;
|
|
48011
48575
|
var init_browser_sse_transport = __esm({
|
|
@@ -48093,392 +48657,12 @@ var init_sse_transport = __esm({
|
|
|
48093
48657
|
}
|
|
48094
48658
|
});
|
|
48095
48659
|
|
|
48096
|
-
// libs/sdk/src/transport/adapters/transport.local.adapter.ts
|
|
48097
|
-
function mergeExperimental(fragments) {
|
|
48098
|
-
const out = {};
|
|
48099
|
-
const experimental = {};
|
|
48100
|
-
const extensions = {};
|
|
48101
|
-
let sawExperimental = false;
|
|
48102
|
-
let sawExtensions = false;
|
|
48103
|
-
for (const frag of fragments) {
|
|
48104
|
-
if (!frag) continue;
|
|
48105
|
-
for (const [key, value] of Object.entries(frag)) {
|
|
48106
|
-
if (key === "experimental" && value && typeof value === "object") {
|
|
48107
|
-
Object.assign(experimental, value);
|
|
48108
|
-
sawExperimental = true;
|
|
48109
|
-
} else if (key === "extensions" && value && typeof value === "object") {
|
|
48110
|
-
Object.assign(extensions, value);
|
|
48111
|
-
sawExtensions = true;
|
|
48112
|
-
} else {
|
|
48113
|
-
out[key] = value;
|
|
48114
|
-
}
|
|
48115
|
-
}
|
|
48116
|
-
}
|
|
48117
|
-
if (sawExperimental) out["experimental"] = experimental;
|
|
48118
|
-
if (sawExtensions) out["extensions"] = extensions;
|
|
48119
|
-
return out;
|
|
48120
|
-
}
|
|
48121
|
-
var import_protocol53, LocalTransportAdapter;
|
|
48122
|
-
var init_transport_local_adapter = __esm({
|
|
48123
|
-
"libs/sdk/src/transport/adapters/transport.local.adapter.ts"() {
|
|
48124
|
-
"use strict";
|
|
48125
|
-
import_protocol53 = require("@frontmcp/protocol");
|
|
48126
|
-
init_common();
|
|
48127
|
-
init_errors();
|
|
48128
|
-
init_skill_instructions_helper();
|
|
48129
|
-
init_task_scope_helper();
|
|
48130
|
-
init_mcp_handlers();
|
|
48131
|
-
LocalTransportAdapter = class {
|
|
48132
|
-
constructor(scope, key, onDispose, res) {
|
|
48133
|
-
this.scope = scope;
|
|
48134
|
-
this.key = key;
|
|
48135
|
-
this.onDispose = onDispose;
|
|
48136
|
-
this.logger = scope.logger.child("LocalTransportAdapter");
|
|
48137
|
-
this.transport = this.createTransport(key.sessionId, res);
|
|
48138
|
-
this.ready = this.connectServer();
|
|
48139
|
-
}
|
|
48140
|
-
scope;
|
|
48141
|
-
key;
|
|
48142
|
-
onDispose;
|
|
48143
|
-
logger;
|
|
48144
|
-
transport;
|
|
48145
|
-
/**
|
|
48146
|
-
* Pending elicitation request. Only one elicit per session is allowed.
|
|
48147
|
-
* New elicit requests will cancel any pending one.
|
|
48148
|
-
*/
|
|
48149
|
-
pendingElicit;
|
|
48150
|
-
/**
|
|
48151
|
-
* Session payload fields set during MCP initialize.
|
|
48152
|
-
* Stored on the adapter instance so they survive across requests in SSE mode
|
|
48153
|
-
* (where each POST creates a fresh anonymous HTTP session) and are available
|
|
48154
|
-
* in distributed environments without relying on local in-memory caches.
|
|
48155
|
-
*/
|
|
48156
|
-
initSessionPayload;
|
|
48157
|
-
/**
|
|
48158
|
-
* Called by the initialize request handler to persist initialization data
|
|
48159
|
-
* on the transport adapter instance. This data is merged into the session
|
|
48160
|
-
* payload on every subsequent request via ensureAuthInfo().
|
|
48161
|
-
*/
|
|
48162
|
-
setInitSessionPayload(payload) {
|
|
48163
|
-
this.initSessionPayload = payload;
|
|
48164
|
-
}
|
|
48165
|
-
#requestId = 1;
|
|
48166
|
-
ready;
|
|
48167
|
-
server;
|
|
48168
|
-
/**
|
|
48169
|
-
* Whether this transport has already been initialized via the MCP initialize handshake.
|
|
48170
|
-
* Override in subclasses that track initialization state.
|
|
48171
|
-
*/
|
|
48172
|
-
get isInitialized() {
|
|
48173
|
-
return false;
|
|
48174
|
-
}
|
|
48175
|
-
/**
|
|
48176
|
-
* Marks this transport as pre-initialized for session recreation.
|
|
48177
|
-
* Override in subclasses that need to set the MCP SDK's _initialized flag.
|
|
48178
|
-
*/
|
|
48179
|
-
markAsInitialized() {
|
|
48180
|
-
}
|
|
48181
|
-
/**
|
|
48182
|
-
* Resets initialization state to allow re-initialization.
|
|
48183
|
-
* Override in subclasses that support session re-initialization.
|
|
48184
|
-
*/
|
|
48185
|
-
resetForReinitialization() {
|
|
48186
|
-
}
|
|
48187
|
-
/**
|
|
48188
|
-
* Re-register the MCP server with the notification service.
|
|
48189
|
-
* Called after resetForReinitialization() to restore the server mapping
|
|
48190
|
-
* that was removed by terminateSession → unregisterServer.
|
|
48191
|
-
*/
|
|
48192
|
-
reregisterServer() {
|
|
48193
|
-
if (this.server) {
|
|
48194
|
-
this.scope.notifications.registerServer(this.key.sessionId, this.server);
|
|
48195
|
-
}
|
|
48196
|
-
}
|
|
48197
|
-
connectServer() {
|
|
48198
|
-
const { info, apps } = this.scope.metadata;
|
|
48199
|
-
const hasRemoteApps = apps?.some((app) => this.isRemoteApp(app)) ?? false;
|
|
48200
|
-
const hasPrompts = this.scope.prompts.hasAny() || hasRemoteApps;
|
|
48201
|
-
const hasResources = this.scope.resources.hasAny() || hasRemoteApps;
|
|
48202
|
-
const hasTools = this.scope.tools.hasAny() || hasRemoteApps;
|
|
48203
|
-
const hasAgents = this.scope.agents.hasAny();
|
|
48204
|
-
const completionsCapability = hasPrompts || hasResources ? { completions: {} } : {};
|
|
48205
|
-
const remoteCapabilities = hasRemoteApps ? this.buildRemoteCapabilities() : {};
|
|
48206
|
-
const elicitationCapability = this.scope.metadata.elicitation?.enabled ? { elicitation: {} } : {};
|
|
48207
|
-
const channelCapabilities = this.scope.channels?.getCapabilities() ?? {};
|
|
48208
|
-
const skillsCapabilities = this.scope.skills?.getCapabilities() ?? {};
|
|
48209
|
-
const composeInstructions = (caller) => composeCallerInstructions(this.scope, { ctx: caller, skillUriHints: true });
|
|
48210
|
-
const instructions = "";
|
|
48211
|
-
const mergedCapabilities = mergeExperimental([
|
|
48212
|
-
remoteCapabilities,
|
|
48213
|
-
// Pre-advertise for remote apps (may be overwritten by local)
|
|
48214
|
-
this.scope.tools.getCapabilities(),
|
|
48215
|
-
this.scope.resources.getCapabilities(),
|
|
48216
|
-
this.scope.prompts.getCapabilities(),
|
|
48217
|
-
this.scope.agents.getCapabilities(),
|
|
48218
|
-
// Include agent capabilities (agents as tools)
|
|
48219
|
-
channelCapabilities,
|
|
48220
|
-
// Channel capabilities (claude/channel extension)
|
|
48221
|
-
skillsCapabilities,
|
|
48222
|
-
// SEP-2640 extension declaration
|
|
48223
|
-
completionsCapability,
|
|
48224
|
-
computeTaskCapabilities(this.scope),
|
|
48225
|
-
// MCP logging protocol support - allows clients to set log level via logging/setLevel
|
|
48226
|
-
{ logging: {} },
|
|
48227
|
-
elicitationCapability
|
|
48228
|
-
]);
|
|
48229
|
-
const serverOptions = {
|
|
48230
|
-
instructions,
|
|
48231
|
-
capabilities: mergedCapabilities,
|
|
48232
|
-
serverInfo: info
|
|
48233
|
-
};
|
|
48234
|
-
this.logger.verbose("connectServer: advertising capabilities", {
|
|
48235
|
-
hasTools: hasTools || hasAgents,
|
|
48236
|
-
// Agents expose themselves as tools
|
|
48237
|
-
hasResources,
|
|
48238
|
-
hasPrompts,
|
|
48239
|
-
hasAgents,
|
|
48240
|
-
hasRemoteApps,
|
|
48241
|
-
capabilities: JSON.stringify(serverOptions.capabilities),
|
|
48242
|
-
serverInfo: JSON.stringify(serverOptions.serverInfo)
|
|
48243
|
-
});
|
|
48244
|
-
this.server = new import_protocol53.McpServer(info, serverOptions);
|
|
48245
|
-
const handlers = createMcpHandlers({
|
|
48246
|
-
scope: this.scope,
|
|
48247
|
-
serverOptions,
|
|
48248
|
-
composeInstructions
|
|
48249
|
-
});
|
|
48250
|
-
for (const handler of handlers) {
|
|
48251
|
-
this.server.setRequestHandler(handler.requestSchema, handler.handler);
|
|
48252
|
-
}
|
|
48253
|
-
this.scope.notifications.registerServer(this.key.sessionId, this.server);
|
|
48254
|
-
return this.server.connect(this.transport);
|
|
48255
|
-
}
|
|
48256
|
-
get newRequestId() {
|
|
48257
|
-
return this.#requestId++;
|
|
48258
|
-
}
|
|
48259
|
-
/**
|
|
48260
|
-
* Get the transport type (sse, streamable-http, etc.).
|
|
48261
|
-
* Used for transport-specific behavior detection.
|
|
48262
|
-
*/
|
|
48263
|
-
get type() {
|
|
48264
|
-
return this.key.type;
|
|
48265
|
-
}
|
|
48266
|
-
async destroy(reason) {
|
|
48267
|
-
this.logger.verbose("destroying transporter", { reason });
|
|
48268
|
-
this.scope.notifications.unregisterServer(this.key.sessionId);
|
|
48269
|
-
try {
|
|
48270
|
-
} catch {
|
|
48271
|
-
}
|
|
48272
|
-
if (reason) {
|
|
48273
|
-
console.warn(`Destroying transporter: ${reason}`);
|
|
48274
|
-
} else {
|
|
48275
|
-
try {
|
|
48276
|
-
this.onDispose?.();
|
|
48277
|
-
} catch {
|
|
48278
|
-
}
|
|
48279
|
-
}
|
|
48280
|
-
}
|
|
48281
|
-
/**
|
|
48282
|
-
* Ping the connected client for this transport.
|
|
48283
|
-
* Returns true on success, false on timeout/error.
|
|
48284
|
-
*/
|
|
48285
|
-
async ping(timeoutMs = 1e4) {
|
|
48286
|
-
try {
|
|
48287
|
-
await this.ready;
|
|
48288
|
-
await this.server.request({ method: "ping" }, import_protocol53.EmptyResultSchema, { timeout: timeoutMs });
|
|
48289
|
-
return true;
|
|
48290
|
-
} catch {
|
|
48291
|
-
return false;
|
|
48292
|
-
}
|
|
48293
|
-
}
|
|
48294
|
-
ensureAuthInfo(req, transport) {
|
|
48295
|
-
const { token, user, session, scopes, claims } = req[ServerRequestTokens.auth];
|
|
48296
|
-
if (!session?.id) {
|
|
48297
|
-
throw new UnauthorizedError(
|
|
48298
|
-
"Session could not be reconstructed for the provided token. Re-authenticate to start a new session.",
|
|
48299
|
-
"Bearer"
|
|
48300
|
-
);
|
|
48301
|
-
}
|
|
48302
|
-
const sessionId = session.id;
|
|
48303
|
-
const sessionPayload = session.payload ?? { protocol: "streamable-http" };
|
|
48304
|
-
if (this.initSessionPayload) {
|
|
48305
|
-
const init = this.initSessionPayload;
|
|
48306
|
-
if (init.supportsElicitation !== void 0 && sessionPayload.supportsElicitation === void 0) {
|
|
48307
|
-
sessionPayload.supportsElicitation = init.supportsElicitation;
|
|
48308
|
-
}
|
|
48309
|
-
if (init.platformType !== void 0 && sessionPayload.platformType === void 0) {
|
|
48310
|
-
sessionPayload["platformType"] = init.platformType;
|
|
48311
|
-
}
|
|
48312
|
-
if (init.clientName !== void 0 && sessionPayload.clientName === void 0) {
|
|
48313
|
-
sessionPayload.clientName = init.clientName;
|
|
48314
|
-
}
|
|
48315
|
-
if (init.clientVersion !== void 0 && sessionPayload.clientVersion === void 0) {
|
|
48316
|
-
sessionPayload.clientVersion = init.clientVersion;
|
|
48317
|
-
}
|
|
48318
|
-
}
|
|
48319
|
-
const authInfo = {
|
|
48320
|
-
token,
|
|
48321
|
-
user,
|
|
48322
|
-
sessionId,
|
|
48323
|
-
sessionIdPayload: sessionPayload,
|
|
48324
|
-
// Carry the scopes and claims the verified Authorization actually holds.
|
|
48325
|
-
// These used to be dropped (`scopes: []`, no claims), which left every
|
|
48326
|
-
// scope- or claim-based check downstream inert.
|
|
48327
|
-
//
|
|
48328
|
-
// Both are COPIED, not aliased. Tool code receives this object, and a
|
|
48329
|
-
// nested mutation (`authInfo.claims.roles.push('admin')`) on a shared
|
|
48330
|
-
// reference would rewrite the request's own verified authorization — which
|
|
48331
|
-
// the job/workflow permission guard then reads.
|
|
48332
|
-
scopes: Array.isArray(scopes) ? [...scopes] : [],
|
|
48333
|
-
...claims ? { claims: structuredClone(claims) } : {},
|
|
48334
|
-
clientId: user.sub ?? "",
|
|
48335
|
-
transport
|
|
48336
|
-
};
|
|
48337
|
-
req.auth = authInfo;
|
|
48338
|
-
return req.auth;
|
|
48339
|
-
}
|
|
48340
|
-
/**
|
|
48341
|
-
* Get the elicitation store for distributed elicitation support.
|
|
48342
|
-
* Uses Redis in distributed mode, in-memory for single-node.
|
|
48343
|
-
*/
|
|
48344
|
-
get elicitStore() {
|
|
48345
|
-
return this.scope.elicitationStore;
|
|
48346
|
-
}
|
|
48347
|
-
/**
|
|
48348
|
-
* Get the elicitation store, throwing if not initialized.
|
|
48349
|
-
* Use in contexts where elicitation is required (sendElicitRequest, cancelPendingElicit).
|
|
48350
|
-
*/
|
|
48351
|
-
requireElicitStore() {
|
|
48352
|
-
const store = this.elicitStore;
|
|
48353
|
-
if (!store) {
|
|
48354
|
-
throw new Error("Elicitation store not initialized");
|
|
48355
|
-
}
|
|
48356
|
-
return store;
|
|
48357
|
-
}
|
|
48358
|
-
/**
|
|
48359
|
-
* Cancel any pending elicitation request.
|
|
48360
|
-
* Called before sending a new elicit to enforce single-elicit-per-session.
|
|
48361
|
-
*
|
|
48362
|
-
* This cancels both the local pending elicit (for timeout handling)
|
|
48363
|
-
* and publishes cancel to the store (for distributed mode).
|
|
48364
|
-
*
|
|
48365
|
-
* Note: The local promise is resolved immediately for responsiveness,
|
|
48366
|
-
* then distributed state cleanup follows asynchronously. This non-atomic
|
|
48367
|
-
* sequence is intentional - the worst case is publishing a cancel for
|
|
48368
|
-
* an already-processed elicitation, which is harmless.
|
|
48369
|
-
*/
|
|
48370
|
-
async cancelPendingElicit() {
|
|
48371
|
-
if (this.pendingElicit) {
|
|
48372
|
-
clearTimeout(this.pendingElicit.timeoutHandle);
|
|
48373
|
-
this.pendingElicit.resolve({ status: "cancel" });
|
|
48374
|
-
const sessionId = this.key.sessionId;
|
|
48375
|
-
const store = this.elicitStore;
|
|
48376
|
-
if (store) {
|
|
48377
|
-
const pending = await store.getPending(sessionId);
|
|
48378
|
-
if (pending) {
|
|
48379
|
-
await store.publishResult(pending.elicitId, sessionId, { status: "cancel" });
|
|
48380
|
-
}
|
|
48381
|
-
}
|
|
48382
|
-
this.pendingElicit = void 0;
|
|
48383
|
-
this.logger.info("Cancelled previous pending elicit");
|
|
48384
|
-
}
|
|
48385
|
-
}
|
|
48386
|
-
/**
|
|
48387
|
-
* Handle an incoming elicitation result from the client.
|
|
48388
|
-
* Returns true if the request was an elicit result and was handled.
|
|
48389
|
-
*
|
|
48390
|
-
* Uses ElicitationResultFlow for processing (with hook support).
|
|
48391
|
-
* In distributed mode, this publishes the result via the elicitation store,
|
|
48392
|
-
* which routes it to the correct node that's waiting for it.
|
|
48393
|
-
*/
|
|
48394
|
-
handleIfElicitResult(req) {
|
|
48395
|
-
this.logger.verbose("[handleIfElicitResult] checking request", {
|
|
48396
|
-
hasPendingElicit: !!this.pendingElicit,
|
|
48397
|
-
bodyKeys: req.body ? Object.keys(req.body) : [],
|
|
48398
|
-
hasResult: !!req.body?.result
|
|
48399
|
-
});
|
|
48400
|
-
if (this.pendingElicit && req.body.error) {
|
|
48401
|
-
const { code, message } = req.body.error;
|
|
48402
|
-
if (code === -32600 && message === "Elicitation not supported") {
|
|
48403
|
-
clearTimeout(this.pendingElicit.timeoutHandle);
|
|
48404
|
-
this.pendingElicit.reject(new ElicitationNotSupportedError());
|
|
48405
|
-
this.pendingElicit = void 0;
|
|
48406
|
-
return true;
|
|
48407
|
-
}
|
|
48408
|
-
}
|
|
48409
|
-
const parsed = import_protocol53.ElicitResultSchema.safeParse(req.body?.result);
|
|
48410
|
-
if (!parsed.success) {
|
|
48411
|
-
return false;
|
|
48412
|
-
}
|
|
48413
|
-
const sessionId = this.key.sessionId;
|
|
48414
|
-
void this.handleElicitResultAsync(sessionId, parsed.data);
|
|
48415
|
-
const action = parsed.data.action;
|
|
48416
|
-
const result = {
|
|
48417
|
-
status: action,
|
|
48418
|
-
...action === "accept" && parsed.data.content !== void 0 && { content: parsed.data.content }
|
|
48419
|
-
};
|
|
48420
|
-
if (this.pendingElicit) {
|
|
48421
|
-
clearTimeout(this.pendingElicit.timeoutHandle);
|
|
48422
|
-
this.pendingElicit.resolve(result);
|
|
48423
|
-
this.pendingElicit = void 0;
|
|
48424
|
-
}
|
|
48425
|
-
return true;
|
|
48426
|
-
}
|
|
48427
|
-
/**
|
|
48428
|
-
* Async handler for elicit result - uses ElicitationResultFlow for processing.
|
|
48429
|
-
* Called from handleIfElicitResult without awaiting to avoid blocking the response.
|
|
48430
|
-
*/
|
|
48431
|
-
async handleElicitResultAsync(sessionId, mcpResult) {
|
|
48432
|
-
try {
|
|
48433
|
-
const output = await this.scope.runFlow("elicitation:result", {
|
|
48434
|
-
sessionId,
|
|
48435
|
-
result: mcpResult
|
|
48436
|
-
});
|
|
48437
|
-
if (output?.handled) {
|
|
48438
|
-
this.logger.verbose("ElicitationResultFlow handled result", {
|
|
48439
|
-
elicitId: output.elicitId,
|
|
48440
|
-
sessionId: sessionId.slice(0, 20),
|
|
48441
|
-
status: output.result?.status
|
|
48442
|
-
});
|
|
48443
|
-
}
|
|
48444
|
-
} catch (error) {
|
|
48445
|
-
this.logger.warn("Failed to run ElicitationResultFlow", {
|
|
48446
|
-
sessionId: sessionId.slice(0, 20),
|
|
48447
|
-
error: error.message
|
|
48448
|
-
});
|
|
48449
|
-
}
|
|
48450
|
-
}
|
|
48451
|
-
/**
|
|
48452
|
-
* Type predicate to check if an app configuration represents a remote MCP app.
|
|
48453
|
-
* Remote apps have a 'urlType' property and are not standalone.
|
|
48454
|
-
*/
|
|
48455
|
-
isRemoteApp(app) {
|
|
48456
|
-
if (app === null || typeof app !== "object") return false;
|
|
48457
|
-
const appObj = app;
|
|
48458
|
-
return "urlType" in appObj && appObj["standalone"] !== true;
|
|
48459
|
-
}
|
|
48460
|
-
/**
|
|
48461
|
-
* Build capabilities that should be pre-advertised for remote apps.
|
|
48462
|
-
* Remote apps load their tools/resources/prompts asynchronously after connection,
|
|
48463
|
-
* so we need to pre-advertise listChanged capabilities for proper notification support.
|
|
48464
|
-
*/
|
|
48465
|
-
buildRemoteCapabilities() {
|
|
48466
|
-
return {
|
|
48467
|
-
tools: { listChanged: true },
|
|
48468
|
-
resources: { subscribe: true, listChanged: true },
|
|
48469
|
-
prompts: { listChanged: true }
|
|
48470
|
-
};
|
|
48471
|
-
}
|
|
48472
|
-
};
|
|
48473
|
-
}
|
|
48474
|
-
});
|
|
48475
|
-
|
|
48476
48660
|
// libs/sdk/src/transport/adapters/transport.sse.adapter.ts
|
|
48477
|
-
var
|
|
48661
|
+
var import_lazy_zod79, TransportSSEAdapter;
|
|
48478
48662
|
var init_transport_sse_adapter = __esm({
|
|
48479
48663
|
"libs/sdk/src/transport/adapters/transport.sse.adapter.ts"() {
|
|
48480
48664
|
"use strict";
|
|
48481
|
-
|
|
48665
|
+
import_lazy_zod79 = require("@frontmcp/lazy-zod");
|
|
48482
48666
|
init_elicitation_types();
|
|
48483
48667
|
init_errors();
|
|
48484
48668
|
init_transport_error();
|
|
@@ -48579,7 +48763,7 @@ var init_transport_sse_adapter = __esm({
|
|
|
48579
48763
|
const params = {
|
|
48580
48764
|
mode,
|
|
48581
48765
|
message,
|
|
48582
|
-
requestedSchema: (0,
|
|
48766
|
+
requestedSchema: (0, import_lazy_zod79.toJSONSchema)(requestedSchema)
|
|
48583
48767
|
};
|
|
48584
48768
|
if (mode === "url") {
|
|
48585
48769
|
params["elicitationId"] = elicitId;
|
|
@@ -48644,418 +48828,6 @@ var init_transport_sse_adapter = __esm({
|
|
|
48644
48828
|
}
|
|
48645
48829
|
});
|
|
48646
48830
|
|
|
48647
|
-
// libs/sdk/src/transport/event-stores/session-scoped.event-store.ts
|
|
48648
|
-
function createSessionScopedEventStore(store, sessionId) {
|
|
48649
|
-
const prefix = `${sessionId}${SCOPE_SEPARATOR}`;
|
|
48650
|
-
const scope = (streamId) => `${prefix}${streamId}`;
|
|
48651
|
-
const unscope = (streamId) => {
|
|
48652
|
-
const value = String(streamId);
|
|
48653
|
-
return value.startsWith(prefix) ? value.slice(prefix.length) : value;
|
|
48654
|
-
};
|
|
48655
|
-
const resolveOwnedStream = async (eventId) => {
|
|
48656
|
-
const lookup = store.getStreamIdForEventId;
|
|
48657
|
-
if (lookup) {
|
|
48658
|
-
const resolved = await lookup.call(store, eventId);
|
|
48659
|
-
return resolved !== void 0 && String(resolved).startsWith(prefix) ? resolved : void 0;
|
|
48660
|
-
}
|
|
48661
|
-
if (!String(eventId).startsWith(prefix)) return void 0;
|
|
48662
|
-
const value = String(eventId);
|
|
48663
|
-
const lastColon = value.lastIndexOf(":");
|
|
48664
|
-
return lastColon === -1 ? void 0 : value.slice(0, lastColon);
|
|
48665
|
-
};
|
|
48666
|
-
return {
|
|
48667
|
-
async storeEvent(streamId, message) {
|
|
48668
|
-
return store.storeEvent(scope(streamId), message);
|
|
48669
|
-
},
|
|
48670
|
-
async getStreamIdForEventId(eventId) {
|
|
48671
|
-
const owned = await resolveOwnedStream(eventId);
|
|
48672
|
-
return owned === void 0 ? void 0 : unscope(owned);
|
|
48673
|
-
},
|
|
48674
|
-
async replayEventsAfter(lastEventId, options) {
|
|
48675
|
-
const owned = await resolveOwnedStream(lastEventId);
|
|
48676
|
-
if (owned === void 0) {
|
|
48677
|
-
return "default-stream";
|
|
48678
|
-
}
|
|
48679
|
-
return unscope(await store.replayEventsAfter(lastEventId, options));
|
|
48680
|
-
}
|
|
48681
|
-
};
|
|
48682
|
-
}
|
|
48683
|
-
var SCOPE_SEPARATOR;
|
|
48684
|
-
var init_session_scoped_event_store = __esm({
|
|
48685
|
-
"libs/sdk/src/transport/event-stores/session-scoped.event-store.ts"() {
|
|
48686
|
-
"use strict";
|
|
48687
|
-
SCOPE_SEPARATOR = " ";
|
|
48688
|
-
}
|
|
48689
|
-
});
|
|
48690
|
-
|
|
48691
|
-
// libs/sdk/src/transport/adapters/streamable-http-transport.ts
|
|
48692
|
-
var import_protocol54, RecreateableStreamableHTTPServerTransport;
|
|
48693
|
-
var init_streamable_http_transport = __esm({
|
|
48694
|
-
"libs/sdk/src/transport/adapters/streamable-http-transport.ts"() {
|
|
48695
|
-
"use strict";
|
|
48696
|
-
import_protocol54 = require("@frontmcp/protocol");
|
|
48697
|
-
init_transport_errors();
|
|
48698
|
-
RecreateableStreamableHTTPServerTransport = class extends import_protocol54.StreamableHTTPServerTransport {
|
|
48699
|
-
/**
|
|
48700
|
-
* Stores pending initialization state when setInitializationState is called
|
|
48701
|
-
* before _webStandardTransport is ready. Applied on first handleRequest.
|
|
48702
|
-
*/
|
|
48703
|
-
_pendingInitState;
|
|
48704
|
-
/**
|
|
48705
|
-
* Stored constructor options for recreating internal transports.
|
|
48706
|
-
* MCP SDK 1.26.0 enforces single-use for stateless transports,
|
|
48707
|
-
* so we need to create fresh instances for each request.
|
|
48708
|
-
*/
|
|
48709
|
-
_constructorOptions;
|
|
48710
|
-
/**
|
|
48711
|
-
* When true, the transport recreates the internal transport for each request.
|
|
48712
|
-
* Decoupled from sessionIdGenerator so stateless transports can still
|
|
48713
|
-
* provide a session ID (e.g., '__stateless__') in the response header.
|
|
48714
|
-
*/
|
|
48715
|
-
_isStateless;
|
|
48716
|
-
constructor(options = {}) {
|
|
48717
|
-
super(options);
|
|
48718
|
-
this._constructorOptions = options;
|
|
48719
|
-
this._isStateless = options.isStateless ?? false;
|
|
48720
|
-
}
|
|
48721
|
-
/**
|
|
48722
|
-
* Returns whether the transport has been initialized.
|
|
48723
|
-
*/
|
|
48724
|
-
get isInitialized() {
|
|
48725
|
-
return this._webStandardTransport?._initialized ?? false;
|
|
48726
|
-
}
|
|
48727
|
-
/**
|
|
48728
|
-
* Returns whether there's a pending initialization state waiting to be applied.
|
|
48729
|
-
* This is true when setInitializationState was called before _webStandardTransport existed.
|
|
48730
|
-
*/
|
|
48731
|
-
get hasPendingInitState() {
|
|
48732
|
-
return this._pendingInitState !== void 0;
|
|
48733
|
-
}
|
|
48734
|
-
/**
|
|
48735
|
-
* Sets the transport to an initialized state with the given session ID.
|
|
48736
|
-
* Use this when recreating a transport from a stored session.
|
|
48737
|
-
*
|
|
48738
|
-
* This method allows you to "restore" a session without replaying the
|
|
48739
|
-
* initialization handshake. After calling this method, the transport
|
|
48740
|
-
* will accept requests with the given session ID.
|
|
48741
|
-
*
|
|
48742
|
-
* If the internal transport is not ready yet (common in serverless cold starts),
|
|
48743
|
-
* the state is stored and applied on the first handleRequest call.
|
|
48744
|
-
*
|
|
48745
|
-
* @param sessionId - The session ID that was previously assigned to this session
|
|
48746
|
-
* @throws Error if sessionId is empty or invalid
|
|
48747
|
-
*/
|
|
48748
|
-
setInitializationState(sessionId) {
|
|
48749
|
-
if (!sessionId || typeof sessionId !== "string" || sessionId.trim() === "") {
|
|
48750
|
-
throw new InvalidTransportSessionError("[RecreateableStreamableHTTPServerTransport] sessionId cannot be empty");
|
|
48751
|
-
}
|
|
48752
|
-
const webTransport = this._webStandardTransport;
|
|
48753
|
-
if (!webTransport) {
|
|
48754
|
-
this._pendingInitState = sessionId;
|
|
48755
|
-
return;
|
|
48756
|
-
}
|
|
48757
|
-
this._applyInitState(webTransport, sessionId);
|
|
48758
|
-
}
|
|
48759
|
-
/**
|
|
48760
|
-
* Resets the transport's initialization state to allow re-initialization.
|
|
48761
|
-
*
|
|
48762
|
-
* This is needed when a client reconnects after terminating its session:
|
|
48763
|
-
* the cached transport is still marked as initialized, but the client
|
|
48764
|
-
* needs to re-initialize. Resetting _initialized and sessionId allows
|
|
48765
|
-
* the MCP SDK to process a fresh initialize request.
|
|
48766
|
-
*
|
|
48767
|
-
* This is the inverse of setInitializationState().
|
|
48768
|
-
*/
|
|
48769
|
-
resetForReinitialization() {
|
|
48770
|
-
const webTransport = this._webStandardTransport;
|
|
48771
|
-
if (!webTransport) {
|
|
48772
|
-
this._pendingInitState = void 0;
|
|
48773
|
-
return;
|
|
48774
|
-
}
|
|
48775
|
-
if (!("_initialized" in webTransport)) {
|
|
48776
|
-
throw new InvalidTransportSessionError(
|
|
48777
|
-
"[RecreateableStreamableHTTPServerTransport] Expected _initialized field not found on internal transport. This may indicate an incompatible MCP SDK version."
|
|
48778
|
-
);
|
|
48779
|
-
}
|
|
48780
|
-
webTransport._initialized = false;
|
|
48781
|
-
webTransport.sessionId = void 0;
|
|
48782
|
-
this._pendingInitState = void 0;
|
|
48783
|
-
}
|
|
48784
|
-
/**
|
|
48785
|
-
* Applies initialization state to the internal transport.
|
|
48786
|
-
* @param webTransport - The internal _webStandardTransport object
|
|
48787
|
-
* @param sessionId - The session ID to set
|
|
48788
|
-
* @throws Error if the MCP SDK version is incompatible
|
|
48789
|
-
*/
|
|
48790
|
-
_applyInitState(webTransport, sessionId) {
|
|
48791
|
-
if (!("_initialized" in webTransport)) {
|
|
48792
|
-
throw new InvalidTransportSessionError(
|
|
48793
|
-
"[RecreateableStreamableHTTPServerTransport] Expected _initialized field not found on internal transport. This may indicate an incompatible MCP SDK version."
|
|
48794
|
-
);
|
|
48795
|
-
}
|
|
48796
|
-
webTransport._initialized = true;
|
|
48797
|
-
webTransport.sessionId = sessionId;
|
|
48798
|
-
}
|
|
48799
|
-
/**
|
|
48800
|
-
* Override handleRequest to:
|
|
48801
|
-
* 1. Recreate the internal transport for stateless mode (MCP SDK 1.26.0 single-use guard)
|
|
48802
|
-
* 2. Apply any pending initialization state before processing
|
|
48803
|
-
*/
|
|
48804
|
-
async handleRequest(req, res, body) {
|
|
48805
|
-
const oldWebTransport = this._webStandardTransport;
|
|
48806
|
-
if (oldWebTransport && this._isStateless && oldWebTransport._hasHandledRequest) {
|
|
48807
|
-
const fresh = new import_protocol54.WebStandardStreamableHTTPServerTransport(this._constructorOptions);
|
|
48808
|
-
fresh.onmessage = oldWebTransport.onmessage;
|
|
48809
|
-
fresh.onclose = oldWebTransport.onclose;
|
|
48810
|
-
fresh.onerror = oldWebTransport.onerror;
|
|
48811
|
-
await fresh.start();
|
|
48812
|
-
this._webStandardTransport = fresh;
|
|
48813
|
-
}
|
|
48814
|
-
if (this._pendingInitState) {
|
|
48815
|
-
const webTransport = this._webStandardTransport;
|
|
48816
|
-
if (webTransport) {
|
|
48817
|
-
this._applyInitState(webTransport, this._pendingInitState);
|
|
48818
|
-
this._pendingInitState = void 0;
|
|
48819
|
-
}
|
|
48820
|
-
}
|
|
48821
|
-
if (!res.headersSent) res.removeHeader?.("Content-Type");
|
|
48822
|
-
return super.handleRequest(req, res, body);
|
|
48823
|
-
}
|
|
48824
|
-
};
|
|
48825
|
-
}
|
|
48826
|
-
});
|
|
48827
|
-
|
|
48828
|
-
// libs/sdk/src/transport/adapters/transport.streamable-http.adapter.ts
|
|
48829
|
-
var import_lazy_zod79, resolveSessionIdGenerator, TransportStreamableHttpAdapter;
|
|
48830
|
-
var init_transport_streamable_http_adapter = __esm({
|
|
48831
|
-
"libs/sdk/src/transport/adapters/transport.streamable-http.adapter.ts"() {
|
|
48832
|
-
"use strict";
|
|
48833
|
-
import_lazy_zod79 = require("@frontmcp/lazy-zod");
|
|
48834
|
-
init_errors();
|
|
48835
|
-
init_session_scoped_event_store();
|
|
48836
|
-
init_transport_error();
|
|
48837
|
-
init_transport_types();
|
|
48838
|
-
init_streamable_http_transport();
|
|
48839
|
-
init_transport_local_adapter();
|
|
48840
|
-
resolveSessionIdGenerator = (transportType, sessionId) => {
|
|
48841
|
-
return transportType === "stateless-http" ? () => STATELESS_SESSION_ID : () => sessionId;
|
|
48842
|
-
};
|
|
48843
|
-
TransportStreamableHttpAdapter = class extends LocalTransportAdapter {
|
|
48844
|
-
createTransport(sessionId, response) {
|
|
48845
|
-
const sessionIdGenerator = resolveSessionIdGenerator(this.key.type, sessionId);
|
|
48846
|
-
const sharedEventStore = this.scope.eventStore;
|
|
48847
|
-
const eventStore = sharedEventStore ? createSessionScopedEventStore(sharedEventStore, sessionId) : void 0;
|
|
48848
|
-
const isStateless = this.key.type === "stateless-http";
|
|
48849
|
-
return new RecreateableStreamableHTTPServerTransport({
|
|
48850
|
-
sessionIdGenerator,
|
|
48851
|
-
isStateless,
|
|
48852
|
-
onsessionclosed: () => {
|
|
48853
|
-
},
|
|
48854
|
-
onsessioninitialized: (sessionId2) => {
|
|
48855
|
-
if (sessionId2) {
|
|
48856
|
-
this.logger.verbose("[StreamableHttpAdapter] session initialized", { sessionId: sessionId2.slice(0, 40) });
|
|
48857
|
-
} else {
|
|
48858
|
-
this.logger.verbose("[StreamableHttpAdapter] stateless session initialized");
|
|
48859
|
-
}
|
|
48860
|
-
},
|
|
48861
|
-
// Pass EventStore from scope config (or undefined to disable resumability)
|
|
48862
|
-
// When undefined: disabled to prevent priming events - Claude.ai's client doesn't handle them
|
|
48863
|
-
// The priming event has empty data with no `event:` type, which violates MCP spec
|
|
48864
|
-
// ("Event types MUST be message") and confuses some clients
|
|
48865
|
-
eventStore
|
|
48866
|
-
});
|
|
48867
|
-
}
|
|
48868
|
-
async initialize(req, res) {
|
|
48869
|
-
this.ensureAuthInfo(req, this);
|
|
48870
|
-
this.logger.verbose("[StreamableHttpAdapter] initialize() called", {
|
|
48871
|
-
method: req.method,
|
|
48872
|
-
sessionId: this.key.sessionId.slice(0, 30),
|
|
48873
|
-
bodyMethod: req.body?.method,
|
|
48874
|
-
bodyJsonrpc: req.body?.jsonrpc,
|
|
48875
|
-
bodyId: req.body?.id,
|
|
48876
|
-
bodyType: typeof req.body,
|
|
48877
|
-
bodyKeys: req.body && typeof req.body === "object" ? Object.keys(req.body) : []
|
|
48878
|
-
});
|
|
48879
|
-
await this.ready;
|
|
48880
|
-
this.logger.verbose("[StreamableHttpAdapter] transport state before handleRequest", {
|
|
48881
|
-
isRecreatable: this.transport instanceof RecreateableStreamableHTTPServerTransport,
|
|
48882
|
-
hasWebTransport: !!this.transport._webStandardTransport,
|
|
48883
|
-
webTransportInitialized: this.transport._webStandardTransport?._initialized,
|
|
48884
|
-
webTransportStarted: this.transport._webStandardTransport?._started,
|
|
48885
|
-
hasSessionIdGenerator: this.transport._webStandardTransport?.sessionIdGenerator !== void 0
|
|
48886
|
-
});
|
|
48887
|
-
const originalWrite = res.write.bind(res);
|
|
48888
|
-
const originalEnd = res.end.bind(res);
|
|
48889
|
-
let responseBody = "";
|
|
48890
|
-
res.write = function(chunk, encodingOrCb, cb) {
|
|
48891
|
-
if (chunk) {
|
|
48892
|
-
responseBody += typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString() : String(chunk);
|
|
48893
|
-
}
|
|
48894
|
-
return originalWrite.call(this, chunk, encodingOrCb, cb);
|
|
48895
|
-
};
|
|
48896
|
-
const adapter = this;
|
|
48897
|
-
res.end = function(chunk, encodingOrCb, cb) {
|
|
48898
|
-
if (chunk) {
|
|
48899
|
-
responseBody += typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString() : String(chunk);
|
|
48900
|
-
}
|
|
48901
|
-
adapter.logger.verbose("[StreamableHttpAdapter] initialize response", {
|
|
48902
|
-
statusCode: res.statusCode,
|
|
48903
|
-
headers: res.getHeaders?.() ?? {},
|
|
48904
|
-
bodyLength: responseBody.length
|
|
48905
|
-
});
|
|
48906
|
-
return originalEnd.call(this, chunk, encodingOrCb, cb);
|
|
48907
|
-
};
|
|
48908
|
-
return this.transport.handleRequest(req, res, req.body);
|
|
48909
|
-
}
|
|
48910
|
-
async handleRequest(req, res) {
|
|
48911
|
-
this.ensureAuthInfo(req, this);
|
|
48912
|
-
if (req.method === "GET") {
|
|
48913
|
-
return this.transport.handleRequest(req, res);
|
|
48914
|
-
} else {
|
|
48915
|
-
if (this.handleIfElicitResult(req)) {
|
|
48916
|
-
return;
|
|
48917
|
-
}
|
|
48918
|
-
return this.transport.handleRequest(req, res, req.body);
|
|
48919
|
-
}
|
|
48920
|
-
}
|
|
48921
|
-
/**
|
|
48922
|
-
* Send an elicitation request to the client.
|
|
48923
|
-
*
|
|
48924
|
-
* Only one elicit per session is allowed. A new elicit will cancel any pending one.
|
|
48925
|
-
* On timeout, an ElicitationTimeoutError is thrown to kill tool execution.
|
|
48926
|
-
*
|
|
48927
|
-
* Uses the ElicitationRequestFlow for preparation (validation, ID generation,
|
|
48928
|
-
* storing pending record, building params) with hook support for middleware.
|
|
48929
|
-
*
|
|
48930
|
-
* In distributed mode, the pending elicitation is stored in Redis and results
|
|
48931
|
-
* are routed via pub/sub, allowing the response to be received by any node.
|
|
48932
|
-
*
|
|
48933
|
-
* @param relatedRequestId - The request ID that triggered this elicit
|
|
48934
|
-
* @param message - Message to display to the user
|
|
48935
|
-
* @param requestedSchema - Zod schema for the expected response
|
|
48936
|
-
* @param options - Elicit options (mode, ttl, elicitationId)
|
|
48937
|
-
* @returns ElicitResult with status and typed content
|
|
48938
|
-
*/
|
|
48939
|
-
async sendElicitRequest(relatedRequestId, message, requestedSchema, options) {
|
|
48940
|
-
await this.cancelPendingElicit();
|
|
48941
|
-
const store = this.requireElicitStore();
|
|
48942
|
-
const sessionId = this.key.sessionId;
|
|
48943
|
-
const flowOutput = await this.scope.runFlowForOutput("elicitation:request", {
|
|
48944
|
-
relatedRequestId,
|
|
48945
|
-
sessionId,
|
|
48946
|
-
message,
|
|
48947
|
-
requestedSchema: (0, import_lazy_zod79.toJSONSchema)(requestedSchema),
|
|
48948
|
-
options
|
|
48949
|
-
});
|
|
48950
|
-
const { elicitId, expiresAt, requestParams, pendingRecord } = flowOutput;
|
|
48951
|
-
const ttl = expiresAt - Date.now();
|
|
48952
|
-
this.logger.verbose("[StreamableHttpAdapter] sendElicitRequest: sending elicitation/create", {
|
|
48953
|
-
relatedRequestId,
|
|
48954
|
-
elicitId,
|
|
48955
|
-
mode: pendingRecord.mode,
|
|
48956
|
-
message: message.slice(0, 100)
|
|
48957
|
-
});
|
|
48958
|
-
try {
|
|
48959
|
-
await this.transport.send(rpcRequest(this.newRequestId, "elicitation/create", requestParams), {
|
|
48960
|
-
relatedRequestId
|
|
48961
|
-
});
|
|
48962
|
-
this.logger.verbose("[StreamableHttpAdapter] sendElicitRequest: transport.send() completed");
|
|
48963
|
-
} catch (error) {
|
|
48964
|
-
this.logger.error("[StreamableHttpAdapter] sendElicitRequest: transport.send() failed", error);
|
|
48965
|
-
try {
|
|
48966
|
-
await store.deletePending(sessionId);
|
|
48967
|
-
this.logger.verbose("[StreamableHttpAdapter] sendElicitRequest: cleaned up pending record after send failure");
|
|
48968
|
-
} catch (cleanupError) {
|
|
48969
|
-
this.logger.warn("[StreamableHttpAdapter] sendElicitRequest: failed to clean up pending record", cleanupError);
|
|
48970
|
-
}
|
|
48971
|
-
throw error;
|
|
48972
|
-
}
|
|
48973
|
-
return new Promise((resolve, reject) => {
|
|
48974
|
-
let settled = false;
|
|
48975
|
-
let unsubscribe;
|
|
48976
|
-
const cleanup = () => {
|
|
48977
|
-
clearTimeout(timeoutHandle);
|
|
48978
|
-
this.pendingElicit = void 0;
|
|
48979
|
-
void unsubscribe?.();
|
|
48980
|
-
};
|
|
48981
|
-
const safeResolve = (result) => {
|
|
48982
|
-
if (settled) return;
|
|
48983
|
-
settled = true;
|
|
48984
|
-
cleanup();
|
|
48985
|
-
resolve(result);
|
|
48986
|
-
};
|
|
48987
|
-
const safeReject = (err) => {
|
|
48988
|
-
if (settled) return;
|
|
48989
|
-
settled = true;
|
|
48990
|
-
cleanup();
|
|
48991
|
-
reject(err);
|
|
48992
|
-
};
|
|
48993
|
-
const timeoutHandle = setTimeout(async () => {
|
|
48994
|
-
if (settled) return;
|
|
48995
|
-
settled = true;
|
|
48996
|
-
this.pendingElicit = void 0;
|
|
48997
|
-
await unsubscribe?.();
|
|
48998
|
-
await store.deletePending(sessionId);
|
|
48999
|
-
reject(new ElicitationTimeoutError(elicitId, ttl));
|
|
49000
|
-
}, ttl);
|
|
49001
|
-
store.subscribeResult(
|
|
49002
|
-
elicitId,
|
|
49003
|
-
(result) => {
|
|
49004
|
-
safeResolve(result);
|
|
49005
|
-
},
|
|
49006
|
-
sessionId
|
|
49007
|
-
).then((unsub) => {
|
|
49008
|
-
unsubscribe = unsub;
|
|
49009
|
-
}).catch(async (err) => {
|
|
49010
|
-
if (settled) return;
|
|
49011
|
-
settled = true;
|
|
49012
|
-
clearTimeout(timeoutHandle);
|
|
49013
|
-
this.pendingElicit = void 0;
|
|
49014
|
-
await unsubscribe?.();
|
|
49015
|
-
await store.deletePending(sessionId);
|
|
49016
|
-
reject(err);
|
|
49017
|
-
});
|
|
49018
|
-
this.pendingElicit = {
|
|
49019
|
-
elicitId,
|
|
49020
|
-
timeoutHandle,
|
|
49021
|
-
resolve: safeResolve,
|
|
49022
|
-
reject: safeReject
|
|
49023
|
-
};
|
|
49024
|
-
});
|
|
49025
|
-
}
|
|
49026
|
-
get isInitialized() {
|
|
49027
|
-
return this.transport.isInitialized || this.transport.hasPendingInitState;
|
|
49028
|
-
}
|
|
49029
|
-
/**
|
|
49030
|
-
* Resets the transport's initialization state to allow re-initialization.
|
|
49031
|
-
* Used when a client retries initialize on an already-initialized session
|
|
49032
|
-
* (e.g., after reconnect following session termination).
|
|
49033
|
-
*/
|
|
49034
|
-
resetForReinitialization() {
|
|
49035
|
-
this.transport.resetForReinitialization();
|
|
49036
|
-
this.logger.info("[StreamableHttpAdapter] Reset transport for re-initialization", {
|
|
49037
|
-
sessionId: this.key.sessionId?.slice(0, 20)
|
|
49038
|
-
});
|
|
49039
|
-
}
|
|
49040
|
-
/**
|
|
49041
|
-
* Marks this transport as pre-initialized for session recreation.
|
|
49042
|
-
* This is needed when recreating a transport from Redis because the
|
|
49043
|
-
* original initialize request was processed by a different transport instance.
|
|
49044
|
-
*
|
|
49045
|
-
* Uses the RecreateableStreamableHTTPServerTransport's public API to set
|
|
49046
|
-
* initialization state, avoiding access to private properties.
|
|
49047
|
-
*/
|
|
49048
|
-
markAsInitialized() {
|
|
49049
|
-
this.transport.setInitializationState(this.key.sessionId);
|
|
49050
|
-
this.logger.info("[StreamableHttpAdapter] Marked transport as pre-initialized for session recreation", {
|
|
49051
|
-
sessionId: this.key.sessionId?.slice(0, 20),
|
|
49052
|
-
isInitialized: this.transport.isInitialized
|
|
49053
|
-
});
|
|
49054
|
-
}
|
|
49055
|
-
};
|
|
49056
|
-
}
|
|
49057
|
-
});
|
|
49058
|
-
|
|
49059
48831
|
// libs/sdk/src/transport/transport.local.ts
|
|
49060
48832
|
var LocalTransporter;
|
|
49061
48833
|
var init_transport_local = __esm({
|
|
@@ -49211,6 +48983,7 @@ var init_transport_registry = __esm({
|
|
|
49211
48983
|
init_session_id_utils();
|
|
49212
48984
|
init_auth_info_utils();
|
|
49213
48985
|
init_transport_errors();
|
|
48986
|
+
init_transport_streamable_http_adapter();
|
|
49214
48987
|
init_handle_mcp_20260728_flow();
|
|
49215
48988
|
init_handle_sse_flow();
|
|
49216
48989
|
init_handle_stateless_http_flow();
|
|
@@ -49255,7 +49028,7 @@ var init_transport_registry = __esm({
|
|
|
49255
49028
|
persistenceConfig;
|
|
49256
49029
|
/**
|
|
49257
49030
|
* Pending store configuration for async initialization. Either a Redis/Vercel KV
|
|
49258
|
-
* shape or a `{ sqlite: ... }` shape
|
|
49031
|
+
* shape or a `{ sqlite: ... }` shape \u2014 discriminated in `createSessionStore`.
|
|
49259
49032
|
*/
|
|
49260
49033
|
pendingStoreConfig;
|
|
49261
49034
|
/** Set when the configured backend is SQLite. Used for telemetry-only branching. */
|
|
@@ -49276,6 +49049,13 @@ var init_transport_registry = __esm({
|
|
|
49276
49049
|
* Key: JSON-encoded {t: type, h: tokenHash, s: sessionId}, Value: Promise that resolves when creation completes
|
|
49277
49050
|
*/
|
|
49278
49051
|
creationMutex = /* @__PURE__ */ new Map();
|
|
49052
|
+
// The Streamable HTTP transport class loads with the first session that uses it, so stdio and SSE servers never load it.
|
|
49053
|
+
async newLocalTransporter(key, res, onDispose) {
|
|
49054
|
+
if (key.type === "streamable-http" || key.type === "stateless-http") {
|
|
49055
|
+
await loadStreamableHttpTransport();
|
|
49056
|
+
}
|
|
49057
|
+
return new LocalTransporter(this.scope, key, res, onDispose);
|
|
49058
|
+
}
|
|
49279
49059
|
/**
|
|
49280
49060
|
* Get the default TTL for session persistence.
|
|
49281
49061
|
* Returns undefined if persistence is disabled or not configured.
|
|
@@ -49483,7 +49263,7 @@ var init_transport_registry = __esm({
|
|
|
49483
49263
|
/** True when a backend (Redis / Vercel KV / SQLite) was wired at construction.
|
|
49484
49264
|
* Note: this reflects construction-time intent, not live connection state.
|
|
49485
49265
|
* A `false` here means no backend was configured at all; a `true` does NOT
|
|
49486
|
-
* guarantee the store is currently reachable
|
|
49266
|
+
* guarantee the store is currently reachable \u2014 use `pingSessionStore()` for
|
|
49487
49267
|
* that signal. */
|
|
49488
49268
|
isSessionStoreConfigured() {
|
|
49489
49269
|
return this.sessionStoreConfigured;
|
|
@@ -49553,7 +49333,7 @@ var init_transport_registry = __esm({
|
|
|
49553
49333
|
* owns the session it presents. `undefined` means "serve it here": the session is local,
|
|
49554
49334
|
* unknown, owned by this node, or owned by a node that stopped (this node takes it over).
|
|
49555
49335
|
*
|
|
49556
|
-
* Runs before authentication
|
|
49336
|
+
* Runs before authentication \u2014 it only decides where the request is served; the owner
|
|
49557
49337
|
* authenticates it. Only session ids this deployment minted cost a Redis lookup.
|
|
49558
49338
|
*/
|
|
49559
49339
|
async findRemoteSessionOwner(request) {
|
|
@@ -49864,8 +49644,7 @@ var init_transport_registry = __esm({
|
|
|
49864
49644
|
this.sessionHistory.set(historyKey, storedSession.createdAt);
|
|
49865
49645
|
const sessionStore = this.sessionStore;
|
|
49866
49646
|
const defaultTtlMs = this.getDefaultTtlMs();
|
|
49867
|
-
const transporter =
|
|
49868
|
-
this.scope,
|
|
49647
|
+
const transporter = await this.newLocalTransporter(
|
|
49869
49648
|
key,
|
|
49870
49649
|
res,
|
|
49871
49650
|
() => this.onSessionTransportDisposed(key, sessionId, sessionStore)
|
|
@@ -49925,8 +49704,7 @@ var init_transport_registry = __esm({
|
|
|
49925
49704
|
if (existing) return existing;
|
|
49926
49705
|
const sessionStore = this.sessionStore;
|
|
49927
49706
|
const defaultTtlMs = this.getDefaultTtlMs();
|
|
49928
|
-
const transporter =
|
|
49929
|
-
this.scope,
|
|
49707
|
+
const transporter = await this.newLocalTransporter(
|
|
49930
49708
|
key,
|
|
49931
49709
|
res,
|
|
49932
49710
|
() => this.onSessionTransportDisposed(key, sessionId, sessionStore)
|
|
@@ -50052,7 +49830,7 @@ var init_transport_registry = __esm({
|
|
|
50052
49830
|
const key = this.keyOf(type, "__anonymous__", STATELESS_SESSION_ID);
|
|
50053
49831
|
const existing = this.lookupLocal(key);
|
|
50054
49832
|
if (existing) return existing;
|
|
50055
|
-
const transporter =
|
|
49833
|
+
const transporter = await this.newLocalTransporter(key, res, () => {
|
|
50056
49834
|
this.evictLocal(key);
|
|
50057
49835
|
if (this.distributed && this.bus) {
|
|
50058
49836
|
this.bus.revoke(key).catch(() => void 0);
|
|
@@ -50073,7 +49851,7 @@ var init_transport_registry = __esm({
|
|
|
50073
49851
|
const key = this.keyOf(type, token, STATELESS_SESSION_ID);
|
|
50074
49852
|
const existing = this.lookupLocal(key);
|
|
50075
49853
|
if (existing) return existing;
|
|
50076
|
-
const transporter =
|
|
49854
|
+
const transporter = await this.newLocalTransporter(key, res, () => {
|
|
50077
49855
|
this.evictLocal(key);
|
|
50078
49856
|
if (this.distributed && this.bus) {
|
|
50079
49857
|
this.bus.revoke(key).catch(() => void 0);
|
|
@@ -50875,7 +50653,7 @@ var init_notification_relay = __esm({
|
|
|
50875
50653
|
}
|
|
50876
50654
|
/**
|
|
50877
50655
|
* Publish any relay message to a target pod's channel.
|
|
50878
|
-
* @returns How many subscribers received it
|
|
50656
|
+
* @returns How many subscribers received it \u2014 0 when nothing listens on that pod's channel.
|
|
50879
50657
|
*/
|
|
50880
50658
|
async send(targetNodeId, message) {
|
|
50881
50659
|
return this.publisher.publish(this.channelOf(targetNodeId), JSON.stringify(message));
|
|
@@ -51081,7 +50859,7 @@ var init_ha_manager = __esm({
|
|
|
51081
50859
|
}
|
|
51082
50860
|
/**
|
|
51083
50861
|
* Publish a message to another pod's relay channel.
|
|
51084
|
-
* @returns How many subscribers received it
|
|
50862
|
+
* @returns How many subscribers received it \u2014 0 when that pod does not listen, or when
|
|
51085
50863
|
* pub/sub is not configured on this pod.
|
|
51086
50864
|
*/
|
|
51087
50865
|
async publishToNode(nodeId, message) {
|
|
@@ -51654,7 +51432,7 @@ var init_redis_event_store = __esm({
|
|
|
51654
51432
|
* rather than data.
|
|
51655
51433
|
*
|
|
51656
51434
|
* The stream-id half is NOT character-filtered. `xadd`/`xrange` take the key
|
|
51657
|
-
* as an exact argument
|
|
51435
|
+
* as an exact argument \u2014 Redis applies no glob matching there \u2014 and ioredis
|
|
51658
51436
|
* length-prefixes it, so no character is special. Filtering here would also
|
|
51659
51437
|
* make `storeEvent`, which accepts any `StreamId`, able to mint ids this
|
|
51660
51438
|
* function then refuses, silently breaking replay for that stream. Ownership
|
|
@@ -53512,13 +53290,13 @@ var init_task_registry = __esm({
|
|
|
53512
53290
|
}
|
|
53513
53291
|
/**
|
|
53514
53292
|
* Compute the MCP server capabilities contribution for tasks per
|
|
53515
|
-
* 2025-11-25
|
|
53293
|
+
* 2025-11-25 \u00a7Capabilities.
|
|
53516
53294
|
*
|
|
53517
53295
|
* Advertises:
|
|
53518
|
-
* - `tasks.requests.tools.call`
|
|
53519
|
-
* - `tasks.cancel`
|
|
53520
|
-
* - `tasks.list`
|
|
53521
|
-
* listing would leak task metadata per spec
|
|
53296
|
+
* - `tasks.requests.tools.call` \u2014 when any tool declares taskSupport.
|
|
53297
|
+
* - `tasks.cancel` \u2014 always, when the feature is enabled.
|
|
53298
|
+
* - `tasks.list` \u2014 only when requestors can be identified (otherwise
|
|
53299
|
+
* listing would leak task metadata per spec \u00a7Security).
|
|
53522
53300
|
*/
|
|
53523
53301
|
getCapabilities(inputs) {
|
|
53524
53302
|
if (this.config.enabled === false) return {};
|
|
@@ -53982,9 +53760,9 @@ var init_tasks_result_flow = __esm({
|
|
|
53982
53760
|
* Block until the task reaches a terminal state.
|
|
53983
53761
|
*
|
|
53984
53762
|
* Two wake-up paths:
|
|
53985
|
-
* 1. `subscribeTerminal`
|
|
53763
|
+
* 1. `subscribeTerminal` \u2014 instant for backends whose pub/sub reaches this
|
|
53986
53764
|
* process (memory, Redis/Upstash, SQLite within the same process).
|
|
53987
|
-
* 2. Periodic `store.get` polling
|
|
53765
|
+
* 2. Periodic `store.get` polling \u2014 the only path that works for the
|
|
53988
53766
|
* SQLite backend when the caller and the runner live in different
|
|
53989
53767
|
* processes (CLI runner + future stdio invocation). Without this, those
|
|
53990
53768
|
* callers would block forever since the child's EventEmitter never
|
|
@@ -55522,7 +55300,7 @@ var init_get_workflow_status_tool = __esm({
|
|
|
55522
55300
|
*
|
|
55523
55301
|
* A record carrying NEITHER identity is refused. Such a run cannot be
|
|
55524
55302
|
* attributed to anyone, and its inputs and results are exactly what this check
|
|
55525
|
-
* exists to protect
|
|
55303
|
+
* exists to protect \u2014 anyone holding the id would otherwise be able to read
|
|
55526
55304
|
* it. Internal callers that must read unattributed runs should go through the
|
|
55527
55305
|
* execution manager directly rather than this tool.
|
|
55528
55306
|
*/
|
|
@@ -57482,7 +57260,7 @@ var init_redis_job_definition_store = __esm({
|
|
|
57482
57260
|
}
|
|
57483
57261
|
/**
|
|
57484
57262
|
* Parse a Redis JSON payload, returning null on malformed input. Stale or
|
|
57485
|
-
* truncated values must not crash the caller
|
|
57263
|
+
* truncated values must not crash the caller \u2014 log + treat as missing so
|
|
57486
57264
|
* the surrounding flow can recover.
|
|
57487
57265
|
*/
|
|
57488
57266
|
safeParse(raw, jobId, kind) {
|
|
@@ -57502,7 +57280,7 @@ var init_redis_job_definition_store = __esm({
|
|
|
57502
57280
|
workflowKey(wfId) {
|
|
57503
57281
|
return `${this.keyPrefix}wf:${wfId}`;
|
|
57504
57282
|
}
|
|
57505
|
-
// Note: saveDefinition is not atomic
|
|
57283
|
+
// Note: saveDefinition is not atomic \u2014 the SET and SADD are separate commands.
|
|
57506
57284
|
// If the process crashes between them, the index set may be inconsistent.
|
|
57507
57285
|
// Adding pipeline/multi support would require extending RedisDefinitionStoreLike.
|
|
57508
57286
|
async saveDefinition(record) {
|
|
@@ -57583,7 +57361,7 @@ function createJobDefinitionStore(options, logger) {
|
|
|
57583
57361
|
});
|
|
57584
57362
|
return {
|
|
57585
57363
|
// Factory-created client lifetime is bound to the store, so the store
|
|
57586
|
-
// must close it on dispose()
|
|
57364
|
+
// must close it on dispose() \u2014 pass ownsClient: true.
|
|
57587
57365
|
store: new RedisJobDefinitionStore(client, effectiveLogger, keyPrefix, { ownsClient: true }),
|
|
57588
57366
|
type: "redis"
|
|
57589
57367
|
};
|
|
@@ -57900,7 +57678,7 @@ var init_get_job_status_tool = __esm({
|
|
|
57900
57678
|
*
|
|
57901
57679
|
* A record carrying NEITHER identity is refused. Such a run cannot be
|
|
57902
57680
|
* attributed to anyone, and its inputs and results are exactly what this check
|
|
57903
|
-
* exists to protect
|
|
57681
|
+
* exists to protect \u2014 anyone holding the id would otherwise be able to read
|
|
57904
57682
|
* it. Internal callers that must read unattributed runs should go through the
|
|
57905
57683
|
* execution manager directly rather than this tool.
|
|
57906
57684
|
*/
|
|
@@ -60791,7 +60569,7 @@ var init_auth_ui_registry = __esm({
|
|
|
60791
60569
|
this.logger = logger?.child("AuthUiRegistry");
|
|
60792
60570
|
}
|
|
60793
60571
|
/**
|
|
60794
|
-
* Register the `auth.ui` slot
|
|
60572
|
+
* Register the `auth.ui` slot\u2192file map. Each relative path is resolved against
|
|
60795
60573
|
* `sourceDir` (the declaring `@FrontMcp`/`@App` directory); absolute paths pass
|
|
60796
60574
|
* through. Later registrations for the same slot win (so a scope can override a
|
|
60797
60575
|
* server-level default).
|
|
@@ -60810,7 +60588,7 @@ var init_auth_ui_registry = __esm({
|
|
|
60810
60588
|
}
|
|
60811
60589
|
}
|
|
60812
60590
|
/**
|
|
60813
|
-
* Register the `auth.extras` name
|
|
60591
|
+
* Register the `auth.extras` name\u2192handler map. Each value must be a function
|
|
60814
60592
|
* `(input, ctx) => AuthExtraResult | Promise<AuthExtraResult>`.
|
|
60815
60593
|
*/
|
|
60816
60594
|
registerAuthExtrasMap(map) {
|
|
@@ -60861,7 +60639,7 @@ var init_auth_ui_registry = __esm({
|
|
|
60861
60639
|
return { file: entry.file };
|
|
60862
60640
|
}
|
|
60863
60641
|
/**
|
|
60864
|
-
* Whether a slot can be rendered
|
|
60642
|
+
* Whether a slot can be rendered \u2014 i.e. a file is registered for it (and it
|
|
60865
60643
|
* hasn't recorded a build error). Used by the page assembler to decide between
|
|
60866
60644
|
* the custom page and the built-in fallback.
|
|
60867
60645
|
*/
|
|
@@ -60924,7 +60702,7 @@ var init_auth_ui_registry = __esm({
|
|
|
60924
60702
|
// ============================================
|
|
60925
60703
|
/**
|
|
60926
60704
|
* Current accumulators for a pending-auth id (empty when none yet). Returns a
|
|
60927
|
-
* DEEP copy
|
|
60705
|
+
* DEEP copy \u2014 each array is cloned \u2014 so callers (e.g. an extra handler reading
|
|
60928
60706
|
* `ctx.current`) can never mutate the internal accumulator by reference.
|
|
60929
60707
|
*/
|
|
60930
60708
|
getAddedItems(pendingAuthId) {
|
|
@@ -60969,7 +60747,7 @@ var init_auth_ui_registry = __esm({
|
|
|
60969
60747
|
* Returns `{ ok:false }` when no handler is registered for `name`.
|
|
60970
60748
|
*
|
|
60971
60749
|
* Note: the returned `addedItems` is the FULL accumulator MAP (keyed by extra
|
|
60972
|
-
* name)
|
|
60750
|
+
* name) \u2014 the client `AuthExtraResult` shape \u2014 not the handler's per-call
|
|
60973
60751
|
* `addedItems` (which is the list of NEW items).
|
|
60974
60752
|
*/
|
|
60975
60753
|
async runExtra(name48, pendingAuthId, input) {
|
|
@@ -61012,7 +60790,7 @@ var init_auth_ui_registry = __esm({
|
|
|
61012
60790
|
* `compileUIWidgets`): a missing / non-`.tsx` file is caught lazily at first
|
|
61013
60791
|
* render and cached as an error so the slot falls back to the built-in page
|
|
61014
60792
|
* instead of failing the request. This is just a cheap preflight log; it never
|
|
61015
|
-
* throws
|
|
60793
|
+
* throws \u2014 a broken component must not take the server down.
|
|
61016
60794
|
*/
|
|
61017
60795
|
async warmup() {
|
|
61018
60796
|
if (!this.hasAny()) return;
|
|
@@ -61481,7 +61259,7 @@ var init_oauth_authorize_flow = __esm({
|
|
|
61481
61259
|
* The issuer identifier to advertise on an authorization response (RFC 9207).
|
|
61482
61260
|
*
|
|
61483
61261
|
* Returns `undefined` when the configured auth instance has no issuer, so the
|
|
61484
|
-
* parameter is simply omitted rather than emitted empty
|
|
61262
|
+
* parameter is simply omitted rather than emitted empty \u2014 a client validating
|
|
61485
61263
|
* `iss` treats absence as "not supported" and proceeds.
|
|
61486
61264
|
*
|
|
61487
61265
|
* With `request`, the issuer the tokens redeemed for this request name
|
|
@@ -61742,7 +61520,7 @@ var init_oauth_authorize_flow = __esm({
|
|
|
61742
61520
|
*
|
|
61743
61521
|
* Returns the verified payload, or `undefined` when the parameter is absent,
|
|
61744
61522
|
* malformed, expired, or not signed by this server. Verification is
|
|
61745
|
-
* side-effect free
|
|
61523
|
+
* side-effect free \u2014 the ticket is CLAIMED (single use) later, in
|
|
61746
61524
|
* {@link prepareAuthorizationRequest}, so a request that fails OAuth
|
|
61747
61525
|
* validation does not burn the user's ticket.
|
|
61748
61526
|
*/
|
|
@@ -62093,7 +61871,7 @@ var init_oauth_authorize_flow = __esm({
|
|
|
62093
61871
|
* upstream IdP's authorization endpoint. This reuses the exact federated
|
|
62094
61872
|
* machinery the multi-provider local path uses (`/oauth/provider/:id/callback`
|
|
62095
61873
|
* then completes the exchange, stores upstream tokens, and mints the FrontMCP
|
|
62096
|
-
* session token whose identity comes from the upstream user)
|
|
61874
|
+
* session token whose identity comes from the upstream user) \u2014 but skips the
|
|
62097
61875
|
* in-tree login page and the provider-selection page entirely.
|
|
62098
61876
|
*
|
|
62099
61877
|
* No identity is collected in-tree: the federated session is created with an
|
|
@@ -62165,7 +61943,7 @@ var init_oauth_authorize_flow = __esm({
|
|
|
62165
61943
|
* for ALL clients (CIMD or not) as an open-redirect / lateral-movement guard.
|
|
62166
61944
|
* Returns a human-readable rejection reason, or `undefined` when the
|
|
62167
61945
|
* redirect_uri is allowed (including when no allowlist is configured, or the
|
|
62168
|
-
* auth instance does not expose a DCR registry
|
|
61946
|
+
* auth instance does not expose a DCR registry \u2014 e.g. non-local modes).
|
|
62169
61947
|
*/
|
|
62170
61948
|
checkDcrRedirectAllowlist(redirectUri) {
|
|
62171
61949
|
const registry = this.scope.auth?.dcrClientRegistry;
|
|
@@ -62200,7 +61978,7 @@ var init_oauth_authorize_flow = __esm({
|
|
|
62200
61978
|
* Respond with OAuth error - redirect if possible, otherwise show error page.
|
|
62201
61979
|
*
|
|
62202
61980
|
* @param redirectUri A redirect_uri validated for the client; omit it for an error page.
|
|
62203
|
-
* @param error The RFC 6749
|
|
61981
|
+
* @param error The RFC 6749 \u00a74.1.2.1 error code. Default `invalid_request`.
|
|
62204
61982
|
*/
|
|
62205
61983
|
respondWithError(errors, redirectUri, state, error = "invalid_request") {
|
|
62206
61984
|
const errorDescription = errors.join("; ");
|
|
@@ -62424,12 +62202,12 @@ var init_oauth_callback_flow = __esm({
|
|
|
62424
62202
|
// Generated
|
|
62425
62203
|
authorizationCode: import_lazy_zod106.z.string().optional(),
|
|
62426
62204
|
userSub: import_lazy_zod106.z.string().optional(),
|
|
62427
|
-
// Checkpoint 3a
|
|
62205
|
+
// Checkpoint 3a \u2014 custom verification (authenticate()) results.
|
|
62428
62206
|
// Submitted login fields (built-in email/name + any custom `login.fields`).
|
|
62429
62207
|
loginFields: import_lazy_zod106.z.record(import_lazy_zod106.z.string(), import_lazy_zod106.z.string()).optional(),
|
|
62430
62208
|
// Custom claims returned by authenticate(), embedded (namespaced) in the token.
|
|
62431
62209
|
customClaims: import_lazy_zod106.z.record(import_lazy_zod106.z.string(), import_lazy_zod106.z.unknown()).optional(),
|
|
62432
|
-
// Checkpoint 3b
|
|
62210
|
+
// Checkpoint 3b \u2014 credentials returned by authenticate(), persisted into the
|
|
62433
62211
|
// per-session credential vault keyed by the minted userSub at code-mint time.
|
|
62434
62212
|
credentials: import_lazy_zod106.z.array(
|
|
62435
62213
|
import_lazy_zod106.z.object({
|
|
@@ -62483,7 +62261,7 @@ var init_oauth_callback_flow = __esm({
|
|
|
62483
62261
|
* The issuer identifier to advertise on an authorization response (RFC 9207).
|
|
62484
62262
|
*
|
|
62485
62263
|
* Returns `undefined` when the configured auth instance has no issuer, so the
|
|
62486
|
-
* parameter is simply omitted rather than emitted empty
|
|
62264
|
+
* parameter is simply omitted rather than emitted empty \u2014 a client validating
|
|
62487
62265
|
* `iss` treats absence as "not supported" and proceeds.
|
|
62488
62266
|
*
|
|
62489
62267
|
* With `request`, the issuer the tokens redeemed for this request name
|
|
@@ -62781,7 +62559,7 @@ var init_oauth_callback_flow = __esm({
|
|
|
62781
62559
|
originalState: pendingAuth.state,
|
|
62782
62560
|
resource: pendingAuth.resource,
|
|
62783
62561
|
userSub,
|
|
62784
|
-
// Progressive/Incremental Authorization
|
|
62562
|
+
// Progressive/Incremental Authorization \u2014 from the pending record ONLY.
|
|
62785
62563
|
// `isIncremental` was derived above from the record plus its proven
|
|
62786
62564
|
// subject; OR-ing a client-supplied flag in here is what let a caller
|
|
62787
62565
|
// override the server's `false` (GHSA-2c4g-9c8x-6m8g).
|
|
@@ -62950,9 +62728,9 @@ var init_oauth_callback_flow = __esm({
|
|
|
62950
62728
|
skippedProviders,
|
|
62951
62729
|
// Progressive/Incremental authorization grant (computed in handleIncrementalAuth)
|
|
62952
62730
|
authorizedAppIds,
|
|
62953
|
-
// Checkpoint 3a
|
|
62731
|
+
// Checkpoint 3a \u2014 custom claims from authenticate()
|
|
62954
62732
|
customClaims,
|
|
62955
|
-
// Checkpoint 3b
|
|
62733
|
+
// Checkpoint 3b \u2014 credentials from authenticate()
|
|
62956
62734
|
credentials
|
|
62957
62735
|
} = this.state;
|
|
62958
62736
|
if (!clientId || !redirectUri || !codeChallenge || !userSub) {
|
|
@@ -62988,11 +62766,11 @@ var init_oauth_callback_flow = __esm({
|
|
|
62988
62766
|
skippedProviderIds: skippedProviders,
|
|
62989
62767
|
consentEnabled,
|
|
62990
62768
|
federatedLoginUsed: isFederated,
|
|
62991
|
-
// Progressive/Incremental authorization: granted app-id set
|
|
62769
|
+
// Progressive/Incremental authorization: granted app-id set \u2192 minted as
|
|
62992
62770
|
// the token's `authorized_apps` claim. Only set when incremental auth is
|
|
62993
62771
|
// enabled (see handleIncrementalAuth); undefined otherwise (no claim).
|
|
62994
62772
|
authorizedAppIds,
|
|
62995
|
-
// Checkpoint 3a
|
|
62773
|
+
// Checkpoint 3a \u2014 custom claims to embed (namespaced) in the access token.
|
|
62996
62774
|
customClaims
|
|
62997
62775
|
});
|
|
62998
62776
|
this.logger.info(
|
|
@@ -63086,12 +62864,12 @@ var init_oauth_callback_flow = __esm({
|
|
|
63086
62864
|
* Same-origin (CSRF) check for a state-changing login/consent submission.
|
|
63087
62865
|
*
|
|
63088
62866
|
* Returns true when the request carries an `Origin` or `Referer` header whose
|
|
63089
|
-
* host does NOT match the request's own host
|
|
62867
|
+
* host does NOT match the request's own host \u2014 the signature of a cross-site
|
|
63090
62868
|
* login-CSRF/fixation. `Origin`/`Referer` are set by the browser and cannot
|
|
63091
62869
|
* be forged by a malicious page, so this reliably distinguishes a legitimate
|
|
63092
62870
|
* same-origin submission (the built-in form is served by THIS server) from a
|
|
63093
62871
|
* cross-site one. Returns false (do NOT block) when neither header is present
|
|
63094
|
-
* or the request's own host cannot be determined
|
|
62872
|
+
* or the request's own host cannot be determined \u2014 defense-in-depth, not a
|
|
63095
62873
|
* hard gate, so header-stripped GET navigations and existing flows keep working.
|
|
63096
62874
|
*/
|
|
63097
62875
|
isCrossOriginSubmission() {
|
|
@@ -63185,7 +62963,7 @@ var init_oauth_callback_flow = __esm({
|
|
|
63185
62963
|
* Derive a subject from the configured login subject strategy.
|
|
63186
62964
|
*
|
|
63187
62965
|
* - `per-account`: hash the value of `login.subject.fromField` into a stable
|
|
63188
|
-
* subject (same account
|
|
62966
|
+
* subject (same account \u2192 same `sub`).
|
|
63189
62967
|
* - otherwise (`per-session` / unset): return undefined so the caller falls
|
|
63190
62968
|
* back to the anonymous subject.
|
|
63191
62969
|
*/
|
|
@@ -63759,7 +63537,7 @@ var init_oauth_connect_flow = __esm({
|
|
|
63759
63537
|
outputSchema: outputSchema33,
|
|
63760
63538
|
access: "public",
|
|
63761
63539
|
middleware: {
|
|
63762
|
-
// No `method`
|
|
63540
|
+
// No `method` \u2192 matches both GET (render) and POST (submit).
|
|
63763
63541
|
path: "/oauth/connect"
|
|
63764
63542
|
}
|
|
63765
63543
|
})
|
|
@@ -64585,7 +64363,7 @@ var init_oauth_register_flow = __esm({
|
|
|
64585
64363
|
*
|
|
64586
64364
|
* MCP 2026-07-28 requires clients to state this during Dynamic Client
|
|
64587
64365
|
* Registration, because an OIDC authorization server applies different
|
|
64588
|
-
* redirect-URI rules per type
|
|
64366
|
+
* redirect-URI rules per type \u2014 a `native` client registering without it
|
|
64589
64367
|
* can be handed `web` rules and have its loopback/custom-scheme redirect
|
|
64590
64368
|
* rejected. Defaults to `web`, matching the OIDC registration default, so
|
|
64591
64369
|
* pre-2026 clients keep working unchanged.
|
|
@@ -65230,7 +65008,7 @@ var init_oauth_token_flow = __esm({
|
|
|
65230
65008
|
middleware: {
|
|
65231
65009
|
method: "POST",
|
|
65232
65010
|
path: "/oauth/token",
|
|
65233
|
-
// Never cached, errors included (RFC 6749
|
|
65011
|
+
// Never cached, errors included (RFC 6749 \u00a75.1, \u00a75.2)
|
|
65234
65012
|
responseHeaders: NO_STORE_HEADERS
|
|
65235
65013
|
}
|
|
65236
65014
|
})
|
|
@@ -65491,10 +65269,10 @@ var init_well_known_oauth_authorization_server_flow = __esm({
|
|
|
65491
65269
|
// one on its authorization responses and tokens. Without it, `baseUrl`.
|
|
65492
65270
|
issuer: import_lazy_zod113.z.string().min(1).optional(),
|
|
65493
65271
|
// Root origin (proto://host WITHOUT the entryPath prefix). The OAuth
|
|
65494
|
-
// endpoints (/oauth/authorize, /oauth/token, /oauth/register,
|
|
65272
|
+
// endpoints (/oauth/authorize, /oauth/token, /oauth/register, \u2026) are
|
|
65495
65273
|
// registered at literal root paths by their flows, NOT under entryPath, so
|
|
65496
65274
|
// they must be advertised relative to this root rather than `baseUrl`
|
|
65497
|
-
// (which carries the entryPath)
|
|
65275
|
+
// (which carries the entryPath) \u2014 see #467.
|
|
65498
65276
|
oauthBaseUrl: import_lazy_zod113.z.string().min(1),
|
|
65499
65277
|
scopesSupported: import_lazy_zod113.z.array(import_lazy_zod113.z.string()).default(["openid", "profile", "email"]),
|
|
65500
65278
|
tokenEndpointAuthMethods: import_lazy_zod113.z.array(import_lazy_zod113.z.enum(["client_secret_basic", "client_secret_post", "private_key_jwt"])).default(["client_secret_basic", "client_secret_post"]),
|
|
@@ -65541,7 +65319,7 @@ var init_well_known_oauth_authorization_server_flow = __esm({
|
|
|
65541
65319
|
// entries; a `*` glob names no scope a client could ask for.
|
|
65542
65320
|
scopesSupported: metadata.auth && (0, import_auth13.isOrchestratedMode)(metadata.auth) ? (0, import_auth56.advertisedScopes)(metadata.auth.allowedScopes) : [],
|
|
65543
65321
|
tokenEndpointAuthMethods: [],
|
|
65544
|
-
// #462
|
|
65322
|
+
// #462 \u2014 advertise registration_endpoint only when local-AS DCR is
|
|
65545
65323
|
// actually active (explicit auth.dcr.enabled, else dev/prod default).
|
|
65546
65324
|
dcrEnabled: resolveDcrEnabled(metadata.auth),
|
|
65547
65325
|
isOrchestrated: metadata.auth ? (0, import_auth13.isOrchestratedMode)(metadata.auth) : false,
|
|
@@ -65576,7 +65354,7 @@ var init_well_known_oauth_authorization_server_flow = __esm({
|
|
|
65576
65354
|
token_endpoint: `${oauthBaseUrl}/oauth/token`,
|
|
65577
65355
|
userinfo_endpoint: `${oauthBaseUrl}/oauth/userinfo`,
|
|
65578
65356
|
jwks_uri: `${baseIssuer}/.well-known/jwks.json`,
|
|
65579
|
-
// #462
|
|
65357
|
+
// #462 \u2014 only advertise registration when DCR is active. When it is
|
|
65580
65358
|
// disabled, omitting the endpoint signals "no DCR" to clients.
|
|
65581
65359
|
// Dynamic Client Registration is DEPRECATED as of MCP 2026-07-28 in
|
|
65582
65360
|
// favour of Client ID Metadata Documents (PR #2858). It stays
|
|
@@ -65588,7 +65366,7 @@ var init_well_known_oauth_authorization_server_flow = __esm({
|
|
|
65588
65366
|
grant_types_supported: ["authorization_code", "refresh_token"],
|
|
65589
65367
|
scopes_supported: scopesSupported,
|
|
65590
65368
|
code_challenge_methods_supported: ["S256"],
|
|
65591
|
-
// Every authorization response, error responses included, carries `iss` (RFC 9207
|
|
65369
|
+
// Every authorization response, error responses included, carries `iss` (RFC 9207 \u00a72, \u00a73).
|
|
65592
65370
|
authorization_response_iss_parameter_supported: true,
|
|
65593
65371
|
// CIMD support advertisement per draft-ietf-oauth-client-id-metadata-document-00
|
|
65594
65372
|
client_id_metadata_document_supported: cimdEnabled
|
|
@@ -66008,8 +65786,8 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66008
65786
|
cimdService;
|
|
66009
65787
|
/**
|
|
66010
65788
|
* Token storage backend selected from `options.tokenStorage`.
|
|
66011
|
-
* - `'memory'` / undefined
|
|
66012
|
-
* - `{ redis }` / `{ sqlite }`
|
|
65789
|
+
* - `'memory'` / undefined \u2192 in-memory stores (default; lost on restart).
|
|
65790
|
+
* - `{ redis }` / `{ sqlite }` \u2192 adapter-backed stores that survive restart.
|
|
66013
65791
|
*
|
|
66014
65792
|
* The three stores below are constructed in-memory synchronously in the
|
|
66015
65793
|
* constructor (preserving the exact legacy default behavior). When a
|
|
@@ -66145,8 +65923,8 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66145
65923
|
* `FRONTMCP_PUBLIC_HOST` overrides only the HOST portion of the boot-time
|
|
66146
65924
|
* issuer (see `this.host` in the constructor); the scheme stays `http` and
|
|
66147
65925
|
* the port stays `this.port`. To override the scheme and/or port (e.g.
|
|
66148
|
-
* advertise `https
|
|
66149
|
-
* explicit `local.issuer`
|
|
65926
|
+
* advertise `https://\u2026` with no explicit port behind a TLS proxy), set an
|
|
65927
|
+
* explicit `local.issuer` \u2014 that is the supported way to make the boot-time
|
|
66150
65928
|
* issuer match what discovery advertises. JWT verification accepts an issuer
|
|
66151
65929
|
* array, so tokens minted under a different scheme/port are still tolerated
|
|
66152
65930
|
* when running behind a TLS-terminating proxy, but `local.issuer` is the
|
|
@@ -66388,11 +66166,11 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66388
66166
|
*
|
|
66389
66167
|
* Skipped in pure public mode (no authenticated subject / no session-bound
|
|
66390
66168
|
* secrets there). The backing comes from `auth.secureStore`:
|
|
66391
|
-
* - unset / `'memory'`
|
|
66392
|
-
* - `{ sqlite }` / `{ redis }`
|
|
66169
|
+
* - unset / `'memory'` \u2192 in-memory, AES-256-GCM-encrypted store (default);
|
|
66170
|
+
* - `{ sqlite }` / `{ redis }` \u2192 persistent encrypted store. When the chosen
|
|
66393
66171
|
* persistent backing matches the configured `tokenStorage`, the SAME
|
|
66394
66172
|
* StorageAdapter is reused (one connection);
|
|
66395
|
-
* - `{ backend }`
|
|
66173
|
+
* - `{ backend }` \u2192 a custom backing used as-is (e.g. an OS keychain) \u2014 the
|
|
66396
66174
|
* framework bundles NO native dependency for this path.
|
|
66397
66175
|
*
|
|
66398
66176
|
* The HKDF pepper for the built-in encrypted backings derives from the server
|
|
@@ -66479,8 +66257,8 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66479
66257
|
}
|
|
66480
66258
|
/**
|
|
66481
66259
|
* Cryptographically verify a gateway-issued access token (public/local/remote
|
|
66482
|
-
* "gateway" modes). Gateway tokens
|
|
66483
|
-
* ({@link signAccessToken}) and anonymous tokens ({@link signAnonymousJwt})
|
|
66260
|
+
* "gateway" modes). Gateway tokens \u2014 both authenticated access tokens
|
|
66261
|
+
* ({@link signAccessToken}) and anonymous tokens ({@link signAnonymousJwt}) \u2014
|
|
66484
66262
|
* are HS256-signed with `this.secret`.
|
|
66485
66263
|
*
|
|
66486
66264
|
* The secret alone doesn't make a token this server's: every server started
|
|
@@ -66979,7 +66757,7 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66979
66757
|
* `userInfoEndpoint`/`jwksUri`) are mapped onto an {@link UpstreamProviderConfig}.
|
|
66980
66758
|
* Endpoints not explicitly overridden are derived from the `provider` base URL
|
|
66981
66759
|
* using the standard OIDC paths (`/authorize`, `/token`, `/userinfo`,
|
|
66982
|
-
* `/.well-known/jwks.json`)
|
|
66760
|
+
* `/.well-known/jwks.json`) \u2014 the same convention `transparent` mode uses for
|
|
66983
66761
|
* discovery. The provider id comes from `providerConfig.id` when set, else it
|
|
66984
66762
|
* is derived from the provider hostname (mirroring `deriveProviderId`).
|
|
66985
66763
|
*
|
|
@@ -67925,7 +67703,7 @@ var init_scope_instance = __esm({
|
|
|
67925
67703
|
_channelTeardown;
|
|
67926
67704
|
/** Health service for liveness and readiness probes (optional) */
|
|
67927
67705
|
_healthService;
|
|
67928
|
-
/** CLI mode flag
|
|
67706
|
+
/** CLI mode flag \u2014 skips non-essential initialization for faster startup */
|
|
67929
67707
|
cliMode;
|
|
67930
67708
|
/** Served in process only (`createDirect()`, `connect()`): no HTTP transport, routes, health checks or OAuth flows */
|
|
67931
67709
|
directOnly;
|
|
@@ -68527,7 +68305,7 @@ var init_scope_instance = __esm({
|
|
|
68527
68305
|
* when the user provided the block without one (issue #401). Also
|
|
68528
68306
|
* ensures the parent directory exists so better-sqlite3 doesn't fail
|
|
68529
68307
|
* to open. Returns `undefined` if the user didn't set the block at
|
|
68530
|
-
* all. The returned object is a SHALLOW COPY
|
|
68308
|
+
* all. The returned object is a SHALLOW COPY \u2014 never mutate the
|
|
68531
68309
|
* caller's metadata.
|
|
68532
68310
|
*/
|
|
68533
68311
|
async resolveTopLevelSqlite() {
|
|
@@ -68994,7 +68772,7 @@ var init_scope_instance = __esm({
|
|
|
68994
68772
|
}
|
|
68995
68773
|
/**
|
|
68996
68774
|
* Initialize authorities engine from @FrontMcp({ authorities: { ... } }) config.
|
|
68997
|
-
* Built-in integration
|
|
68775
|
+
* Built-in integration \u2014 no plugin required.
|
|
68998
68776
|
* @internal
|
|
68999
68777
|
*/
|
|
69000
68778
|
async initAuthoritiesFromConfig() {
|
|
@@ -69174,7 +68952,7 @@ var init_scope_instance = __esm({
|
|
|
69174
68952
|
* `middleware.path` + `canActivate`), excluding `http:request` (which the
|
|
69175
68953
|
* web-fetch handler runs directly for the MCP entry path). Lets the
|
|
69176
68954
|
* Worker/web-fetch adapter dispatch auth/well-known/oauth flows the same way
|
|
69177
|
-
* the Express host routes them
|
|
68955
|
+
* the Express host routes them \u2014 without a middleware server.
|
|
69178
68956
|
*/
|
|
69179
68957
|
async findHttpFlowName(request) {
|
|
69180
68958
|
return this.scopeFlows.findHttpFlowName(request, SCOPE_NON_DISPATCHABLE_FLOWS);
|
|
@@ -69504,8 +69282,8 @@ var init_provider_registry = __esm({
|
|
|
69504
69282
|
/**
|
|
69505
69283
|
* Normalize deprecated scopes to their modern equivalents.
|
|
69506
69284
|
*
|
|
69507
|
-
* - SESSION
|
|
69508
|
-
* - REQUEST
|
|
69285
|
+
* - SESSION \u2192 CONTEXT (deprecated)
|
|
69286
|
+
* - REQUEST \u2192 CONTEXT (deprecated)
|
|
69509
69287
|
*
|
|
69510
69288
|
* This enables backwards compatibility while unifying the scope model.
|
|
69511
69289
|
*/
|
|
@@ -70194,7 +69972,7 @@ var init_provider_registry = __esm({
|
|
|
70194
69972
|
}
|
|
70195
69973
|
}
|
|
70196
69974
|
/**
|
|
70197
|
-
* Resolve a dependency from the available views (context
|
|
69975
|
+
* Resolve a dependency from the available views (context \u2192 global).
|
|
70198
69976
|
*/
|
|
70199
69977
|
async resolveFromViews(token, contextStore, globalStore, scopeKey) {
|
|
70200
69978
|
if (contextStore.has(token)) return contextStore.get(token);
|
|
@@ -70231,7 +70009,7 @@ var init_provider_registry = __esm({
|
|
|
70231
70009
|
throw new ProviderDependencyError(`Cannot resolve dependency ${(0, import_di42.tokenName)(token)} from views`);
|
|
70232
70010
|
}
|
|
70233
70011
|
/**
|
|
70234
|
-
* Get a provider from the given views, checking context
|
|
70012
|
+
* Get a provider from the given views, checking context \u2192 global.
|
|
70235
70013
|
*
|
|
70236
70014
|
* @param token - The provider token to look up
|
|
70237
70015
|
* @param views - The provider views to search
|
|
@@ -70267,7 +70045,7 @@ function normalizeAppScope(appItem, metadata) {
|
|
|
70267
70045
|
apps: [appItem],
|
|
70268
70046
|
// An app that declares no `auth` INHERITS the server's policy. Writing
|
|
70269
70047
|
// `appMetadata.auth` unconditionally set the key to `undefined`, which
|
|
70270
|
-
// overrode the spread above and dropped the server's auth entirely
|
|
70048
|
+
// overrode the spread above and dropped the server's auth entirely \u2014 so a
|
|
70271
70049
|
// standalone app silently became public (GHSA-rgxj-434m-vxh3, where the
|
|
70272
70050
|
// dashboard's own scope was the case in point). Declaring
|
|
70273
70051
|
// `auth: { mode: 'public' }` explicitly is still honoured.
|
|
@@ -70577,9 +70355,9 @@ var init_metrics_service = __esm({
|
|
|
70577
70355
|
/**
|
|
70578
70356
|
* Check the supplied `Authorization` header against the configured auth
|
|
70579
70357
|
* policy. Returns the HTTP status the route should respond with:
|
|
70580
|
-
* - 200
|
|
70581
|
-
* - 401
|
|
70582
|
-
* - 403
|
|
70358
|
+
* - 200 \u2014 the request is allowed to read metrics
|
|
70359
|
+
* - 401 \u2014 missing credentials when token auth is configured
|
|
70360
|
+
* - 403 \u2014 wrong credentials
|
|
70583
70361
|
*/
|
|
70584
70362
|
authorize(authorizationHeader) {
|
|
70585
70363
|
const auth = this.config.auth ?? "public";
|
|
@@ -71345,10 +71123,10 @@ function buildHeaders(out, contentType) {
|
|
|
71345
71123
|
function renderHttpOutputToWebResponse(output) {
|
|
71346
71124
|
const out = output;
|
|
71347
71125
|
switch (out.kind) {
|
|
71348
|
-
// Already a Web Response (the MCP execute stage on a worker)
|
|
71126
|
+
// Already a Web Response (the MCP execute stage on a worker) \u2014 return verbatim.
|
|
71349
71127
|
case "web-response":
|
|
71350
71128
|
return out.response;
|
|
71351
|
-
// "no response"
|
|
71129
|
+
// "no response" \u2014 let the adapter fall through (404 / next middleware).
|
|
71352
71130
|
case "next":
|
|
71353
71131
|
case "consumed":
|
|
71354
71132
|
return void 0;
|
|
@@ -72276,10 +72054,11 @@ function resolveConfigInput(optionsOrClass) {
|
|
|
72276
72054
|
}
|
|
72277
72055
|
return optionsOrClass;
|
|
72278
72056
|
}
|
|
72279
|
-
var import_utils136, stdioServing, FrontMcpInstance;
|
|
72057
|
+
var import_protocol60, import_utils136, stdioServing, FrontMcpInstance;
|
|
72280
72058
|
var init_front_mcp = __esm({
|
|
72281
72059
|
"libs/sdk/src/front-mcp/front-mcp.ts"() {
|
|
72282
72060
|
"use strict";
|
|
72061
|
+
import_protocol60 = require("@frontmcp/protocol");
|
|
72283
72062
|
import_utils136 = require("@frontmcp/utils");
|
|
72284
72063
|
init_common();
|
|
72285
72064
|
init_direct();
|
|
@@ -72290,7 +72069,6 @@ var init_front_mcp = __esm({
|
|
|
72290
72069
|
init_scope_registry();
|
|
72291
72070
|
init_skill_instructions_helper();
|
|
72292
72071
|
init_task_scope_helper();
|
|
72293
|
-
init_dynamic_import_utils();
|
|
72294
72072
|
init_direct_only_flag();
|
|
72295
72073
|
init_front_mcp_providers();
|
|
72296
72074
|
init_shutdown_signals();
|
|
@@ -72467,9 +72245,9 @@ var init_front_mcp = __esm({
|
|
|
72467
72245
|
/**
|
|
72468
72246
|
* Wire the `/metrics` service into the server instance (issue #397).
|
|
72469
72247
|
*
|
|
72470
|
-
* Off by default
|
|
72248
|
+
* Off by default \u2014 `metrics.enabled` must be set to `true` explicitly.
|
|
72471
72249
|
* The `MetricsService` is instantiated here (not in scope construction)
|
|
72472
|
-
* because the endpoint is server-wide, not per-app
|
|
72250
|
+
* because the endpoint is server-wide, not per-app \u2014 counters and process
|
|
72473
72251
|
* stats are process-global.
|
|
72474
72252
|
*/
|
|
72475
72253
|
async wireMetricsService(server) {
|
|
@@ -72546,7 +72324,7 @@ var init_front_mcp = __esm({
|
|
|
72546
72324
|
}
|
|
72547
72325
|
/**
|
|
72548
72326
|
* Creates and initializes a FrontMCP instance and returns a Web-standard
|
|
72549
|
-
* `fetch` handler
|
|
72327
|
+
* `fetch` handler \u2014 `(request: Request) => Promise<Response>` \u2014 backed by the
|
|
72550
72328
|
* MCP WebStandard transport. Unlike {@link createHandler} this needs no
|
|
72551
72329
|
* Express / Node `req`/`res` and runs on V8-isolate targets (Cloudflare
|
|
72552
72330
|
* Workers, Deno Deploy, Bun).
|
|
@@ -72724,7 +72502,7 @@ var init_front_mcp = __esm({
|
|
|
72724
72502
|
* elicitation, sessions) works unchanged over Unix sockets.
|
|
72725
72503
|
*
|
|
72726
72504
|
* Pass the same config object you give to `@FrontMcp()` (not the decorated
|
|
72727
|
-
* class
|
|
72505
|
+
* class \u2014 spreading a class yields no config) plus the socket path.
|
|
72728
72506
|
*
|
|
72729
72507
|
* SIGTERM and SIGINT run the graceful {@link shutdown} and exit, as `bootstrap()` does for
|
|
72730
72508
|
* the TCP server; `close()` runs the same shutdown without exiting.
|
|
@@ -72771,27 +72549,27 @@ var init_front_mcp = __esm({
|
|
|
72771
72549
|
* Runs the FrontMCP server over **stdio** (stdin/stdout JSON-RPC) for local
|
|
72772
72550
|
* MCP clients such as Claude Desktop, Claude Code, and Cursor. Connects the
|
|
72773
72551
|
* transport and returns only when the connection closes. **No TCP port is
|
|
72774
|
-
* bound**
|
|
72552
|
+
* bound** \u2014 the HTTP server is disabled for this entry point (#451).
|
|
72775
72553
|
*
|
|
72776
72554
|
* One connection serves every revision: `initialize` opens a session, a 2026-07-28 request is served statelessly.
|
|
72777
72555
|
*
|
|
72778
72556
|
* Accepts either a `@FrontMcp`-decorated class or the same config object you
|
|
72779
72557
|
* pass to `@FrontMcp()` (#450).
|
|
72780
72558
|
*
|
|
72781
|
-
* IMPORTANT
|
|
72559
|
+
* IMPORTANT \u2014 importing a `@FrontMcp`-decorated class starts an HTTP server at
|
|
72782
72560
|
* import time unless `FRONTMCP_STDIO=1` is set *before* the import. Two safe
|
|
72783
72561
|
* patterns avoid that:
|
|
72784
72562
|
*
|
|
72785
|
-
* 1. Built bundles
|
|
72563
|
+
* 1. Built bundles \u2014 `frontmcp build --target node`, then run the emitted
|
|
72786
72564
|
* runner with `--stdio` (it sets `FRONTMCP_STDIO=1` for you, so the
|
|
72787
72565
|
* decorator serves over stdio). A `--target cli` binary supports
|
|
72788
72566
|
* `<bin> --stdio` the same way.
|
|
72789
|
-
* 2. Hand-written entry
|
|
72567
|
+
* 2. Hand-written entry \u2014 keep the config object in its own module (no
|
|
72790
72568
|
* decorated class in the import graph) and pass it directly, as below.
|
|
72791
72569
|
*
|
|
72792
72570
|
* @example Hand-written stdio entry (config kept separate from the class)
|
|
72793
72571
|
* ```typescript
|
|
72794
|
-
* // server-config.ts
|
|
72572
|
+
* // server-config.ts \u2014 a plain object, no @FrontMcp decorator here
|
|
72795
72573
|
* export const serverConfig = { info: { name: 'my-server', version: '0.1.0' }, apps: [MyApp] };
|
|
72796
72574
|
*
|
|
72797
72575
|
* // stdio.ts
|
|
@@ -72832,10 +72610,6 @@ var init_front_mcp = __esm({
|
|
|
72832
72610
|
let startupSucceeded = false;
|
|
72833
72611
|
const startupCleanups = [];
|
|
72834
72612
|
try {
|
|
72835
|
-
const { StdioServerTransport, McpServer: McpServer2 } = await importWithRequireFallback(
|
|
72836
|
-
() => import("@frontmcp/protocol"),
|
|
72837
|
-
() => require("@frontmcp/protocol")
|
|
72838
|
-
);
|
|
72839
72613
|
const parsedConfig = frontMcpMetadataSchema.parse({
|
|
72840
72614
|
...options,
|
|
72841
72615
|
http: void 0,
|
|
@@ -72894,7 +72668,7 @@ var init_front_mcp = __esm({
|
|
|
72894
72668
|
},
|
|
72895
72669
|
serverInfo: scope.metadata.info
|
|
72896
72670
|
};
|
|
72897
|
-
const mcpServer = new
|
|
72671
|
+
const mcpServer = new import_protocol60.McpServer(scope.metadata.info, serverOptions);
|
|
72898
72672
|
startupCleanups.push(() => mcpServer.close());
|
|
72899
72673
|
const sessionId = `stdio:${(0, import_utils136.randomUUID)()}`;
|
|
72900
72674
|
const handlers = createMcpHandlers2({ scope, serverOptions, composeInstructions });
|
|
@@ -72912,7 +72686,7 @@ var init_front_mcp = __esm({
|
|
|
72912
72686
|
}
|
|
72913
72687
|
const { IpcServerTransport: IpcServerTransport2, isIpcStdioRequested: isIpcStdioRequested2 } = await Promise.resolve().then(() => (init_ipc_server_transport(), ipc_server_transport_exports));
|
|
72914
72688
|
const { StdioRevisionRouter: StdioRevisionRouter2 } = await Promise.resolve().then(() => (init_stdio_revision_router(), stdio_revision_router_exports));
|
|
72915
|
-
const stdioTransport = isIpcStdioRequested2() ? new IpcServerTransport2() : new StdioServerTransport();
|
|
72689
|
+
const stdioTransport = isIpcStdioRequested2() ? new IpcServerTransport2() : new import_protocol60.StdioServerTransport();
|
|
72916
72690
|
const transport = new StdioRevisionRouter2(stdioTransport, { scope, principal: sessionId });
|
|
72917
72691
|
startupCleanups.push(() => transport.close());
|
|
72918
72692
|
await mcpServer.connect(transport);
|
|
@@ -74173,10 +73947,10 @@ var init_tool_entry = __esm({
|
|
|
74173
73947
|
*
|
|
74174
73948
|
* Prefers an explicit `rawOutputSchema` (the JSON Schema set by the OpenAPI adapter /
|
|
74175
73949
|
* remote tools); otherwise converts a Zod-shape or `z.object()` `outputSchema` to JSON
|
|
74176
|
-
* Schema
|
|
73950
|
+
* Schema \u2014 symmetric with {@link getInputJsonSchema}. Returns `null` for output forms
|
|
74177
73951
|
* that have no object-typed schema to advertise: primitive / media string literals
|
|
74178
|
-
* (`'string'`, `'image'`,
|
|
74179
|
-
* schema that does not serialize to a top-level `type: 'object'` (e.g. a union)
|
|
73952
|
+
* (`'string'`, `'image'`, \u2026), multi-content arrays (`['string', 'image']`), and any
|
|
73953
|
+
* schema that does not serialize to a top-level `type: 'object'` (e.g. a union) \u2014 those
|
|
74180
73954
|
* flow through `content`, not `structuredContent`, per the MCP spec.
|
|
74181
73955
|
*
|
|
74182
73956
|
* @returns JSON Schema object, or null if there is no advertisable output schema.
|
|
@@ -74391,7 +74165,7 @@ var init_skill_entry = __esm({
|
|
|
74391
74165
|
return this.metadata.hideFromDiscovery === true;
|
|
74392
74166
|
}
|
|
74393
74167
|
/**
|
|
74394
|
-
* Check if this skill is always loaded
|
|
74168
|
+
* Check if this skill is always loaded \u2014 bindings derived from this skill
|
|
74395
74169
|
* are merged into every codecall:execute call regardless of the skills the
|
|
74396
74170
|
* agent passed. See SkillMetadata.alwaysLoad for guidance on when to set this.
|
|
74397
74171
|
*/
|
|
@@ -74407,7 +74181,7 @@ var init_skill_entry = __esm({
|
|
|
74407
74181
|
return this.metadata.referencedOperations ?? [];
|
|
74408
74182
|
}
|
|
74409
74183
|
/**
|
|
74410
|
-
* Whether this skill is "executable"
|
|
74184
|
+
* Whether this skill is "executable" \u2014 has at least one declared tool
|
|
74411
74185
|
* OR at least one referenced openapi operation. Skills with neither are
|
|
74412
74186
|
* pure-knowledge: discoverable via searchKnowledge, callable via execute()
|
|
74413
74187
|
* but with no tool bindings (the agentscript can only do pure computation).
|
|
@@ -75151,7 +74925,7 @@ __export(index_exports, {
|
|
|
75151
74925
|
OrchestratorJwksNotAvailableError: () => import_auth15.OrchestratorJwksNotAvailableError,
|
|
75152
74926
|
PLATFORM_CLIENT_INFO: () => PLATFORM_CLIENT_INFO,
|
|
75153
74927
|
PRIMITIVE_FILTER_KEYS: () => PRIMITIVE_FILTER_KEYS,
|
|
75154
|
-
PROTOCOL_2026_07_28: () =>
|
|
74928
|
+
PROTOCOL_2026_07_28: () => import_protocol61.PROTOCOL_2026_07_28,
|
|
75155
74929
|
PROTOCOL_PRESETS: () => PROTOCOL_PRESETS,
|
|
75156
74930
|
PayloadTooLargeError: () => PayloadTooLargeError,
|
|
75157
74931
|
Plugin: () => FrontMcpPlugin,
|
|
@@ -75612,7 +75386,7 @@ __export(index_exports, {
|
|
|
75612
75386
|
loginConfigSchema: () => import_auth10.loginConfigSchema,
|
|
75613
75387
|
makeWellKnownPaths: () => makeWellKnownPaths,
|
|
75614
75388
|
mapEnvToNestedConfig: () => mapEnvToNestedConfig,
|
|
75615
|
-
maxSatisfying: () =>
|
|
75389
|
+
maxSatisfying: () => maxSatisfying,
|
|
75616
75390
|
mcpRegistryOptionsSchema: () => mcpRegistryOptionsSchema,
|
|
75617
75391
|
mcpRegistryRepositorySchema: () => mcpRegistryRepositorySchema,
|
|
75618
75392
|
mcpSessionHeaderSchema: () => mcpSessionHeaderSchema,
|
|
@@ -76514,18 +76288,16 @@ init_common();
|
|
|
76514
76288
|
var HostServerAdapter = class extends FrontMcpServer {
|
|
76515
76289
|
};
|
|
76516
76290
|
|
|
76517
|
-
// libs/sdk/src/
|
|
76518
|
-
init_transport_types();
|
|
76291
|
+
// libs/sdk/src/index.ts
|
|
76519
76292
|
init_in_memory_server();
|
|
76520
76293
|
init_web_fetch_handler();
|
|
76521
|
-
init_web_standard_mcp();
|
|
76522
|
-
|
|
76523
|
-
// libs/sdk/src/index.ts
|
|
76524
76294
|
init_mcp_20260728();
|
|
76525
76295
|
init_mcp_20260728();
|
|
76526
76296
|
init_mcp_20260728();
|
|
76527
76297
|
init_mcp_stateless_client_adapter();
|
|
76528
|
-
var
|
|
76298
|
+
var import_protocol61 = require("@frontmcp/protocol");
|
|
76299
|
+
init_web_standard_mcp();
|
|
76300
|
+
init_transport_types();
|
|
76529
76301
|
init_ext_apps2();
|
|
76530
76302
|
var import_auth67 = require("@frontmcp/auth");
|
|
76531
76303
|
var import_auth68 = require("@frontmcp/auth");
|