@frontmcp/sdk 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/agent/agent.scope.d.ts +12 -0
  2. package/agent/agent.scope.d.ts.map +1 -1
  3. package/auth/auth.registry.d.ts.map +1 -1
  4. package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
  5. package/auth/flows/session.verify.flow.d.ts +19 -1
  6. package/auth/flows/session.verify.flow.d.ts.map +1 -1
  7. package/auth/instances/instance.local-primary-auth.d.ts +2 -2
  8. package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
  9. package/auth/session/utils/session-id.utils.d.ts +11 -4
  10. package/auth/session/utils/session-id.utils.d.ts.map +1 -1
  11. package/common/metadata/app.metadata.d.ts +24 -0
  12. package/common/metadata/app.metadata.d.ts.map +1 -1
  13. package/common/metadata/front-mcp.metadata.d.ts +105 -0
  14. package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
  15. package/common/tokens/server.tokens.d.ts +1 -0
  16. package/common/tokens/server.tokens.d.ts.map +1 -1
  17. package/common/types/options/auth/index.d.ts +4 -2
  18. package/common/types/options/auth/index.d.ts.map +1 -1
  19. package/common/utils/path.utils.d.ts +29 -0
  20. package/common/utils/path.utils.d.ts.map +1 -1
  21. package/context/frontmcp-context-storage.d.ts +3 -1
  22. package/context/frontmcp-context-storage.d.ts.map +1 -1
  23. package/context/metadata.utils.d.ts +29 -6
  24. package/context/metadata.utils.d.ts.map +1 -1
  25. package/errors/auth-internal.errors.d.ts +1 -1
  26. package/errors/auth-internal.errors.d.ts.map +1 -1
  27. package/errors/index.d.ts +1 -1
  28. package/errors/index.d.ts.map +1 -1
  29. package/esm/index.mjs +468 -170
  30. package/flows/flow.instance.d.ts.map +1 -1
  31. package/front-mcp/front-mcp.d.ts.map +1 -1
  32. package/front-mcp/front-mcp.providers.d.ts +52 -0
  33. package/front-mcp/front-mcp.providers.d.ts.map +1 -1
  34. package/index.js +882 -581
  35. package/job/execution/job-execution.manager.d.ts.map +1 -1
  36. package/package.json +10 -10
  37. package/scope/flows/http.request.flow.d.ts.map +1 -1
  38. package/scope/scope.instance.d.ts.map +1 -1
  39. package/server/adapters/express.host.adapter.d.ts.map +1 -1
  40. package/tool/ui/ui-shared.d.ts.map +1 -1
  41. package/transport/web-fetch-handler.d.ts +22 -1
  42. package/transport/web-fetch-handler.d.ts.map +1 -1
  43. package/workflow/engine/workflow-step.executor.d.ts +12 -4
  44. package/workflow/engine/workflow-step.executor.d.ts.map +1 -1
  45. package/workflow/engine/workflow.engine.d.ts +2 -4
  46. package/workflow/engine/workflow.engine.d.ts.map +1 -1
package/index.js CHANGED
@@ -683,6 +683,7 @@ var init_server_tokens = __esm({
683
683
  reinitialize: tokenFactory.meta("reinitialize"),
684
684
  webRequest: tokenFactory.meta("webRequest"),
685
685
  webCtx: tokenFactory.meta("webCtx"),
686
+ webEnv: tokenFactory.meta("webEnv"),
686
687
  webTransport: tokenFactory.meta("webTransport")
687
688
  };
688
689
  }
@@ -1915,7 +1916,7 @@ var init_http = __esm({
1915
1916
  });
1916
1917
 
1917
1918
  // libs/sdk/src/common/types/options/auth/index.ts
1918
- var import_auth4, import_auth5, import_auth6, import_auth7, import_auth8, import_auth9, import_auth10;
1919
+ var import_auth4, import_auth5, import_auth6, import_auth7, import_auth8, import_auth9, import_auth10, import_auth11;
1919
1920
  var init_auth2 = __esm({
1920
1921
  "libs/sdk/src/common/types/options/auth/index.ts"() {
1921
1922
  "use strict";
@@ -1926,6 +1927,7 @@ var init_auth2 = __esm({
1926
1927
  import_auth8 = require("@frontmcp/auth");
1927
1928
  import_auth9 = require("@frontmcp/auth");
1928
1929
  import_auth10 = require("@frontmcp/auth");
1930
+ import_auth11 = require("@frontmcp/auth");
1929
1931
  }
1930
1932
  });
1931
1933
 
@@ -2875,7 +2877,7 @@ var init_app_metadata = __esm({
2875
2877
  jobs: import_lazy_zod22.z.array(annotatedFrontMcpJobsSchema).optional(),
2876
2878
  workflows: import_lazy_zod22.z.array(annotatedFrontMcpWorkflowsSchema).optional(),
2877
2879
  channels: import_lazy_zod22.z.array(annotatedFrontMcpChannelsSchema).optional(),
2878
- auth: import_auth8.authOptionsSchema.optional(),
2880
+ auth: import_auth9.authOptionsSchema.optional(),
2879
2881
  output: outputPolicySchema.optional(),
2880
2882
  standalone: import_lazy_zod22.z.union([import_lazy_zod22.z.literal("includeInParent"), import_lazy_zod22.z.boolean()]).optional().default(false)
2881
2883
  });
@@ -2930,7 +2932,7 @@ var init_app_metadata = __esm({
2930
2932
  namespace: import_lazy_zod22.z.string().optional(),
2931
2933
  transportOptions: remoteTransportOptionsSchema.optional(),
2932
2934
  remoteAuth: remoteAuthConfigSchema.optional(),
2933
- auth: import_auth8.authOptionsSchema.optional(),
2935
+ auth: import_auth9.authOptionsSchema.optional(),
2934
2936
  refreshInterval: import_lazy_zod22.z.number().optional(),
2935
2937
  cacheTTL: import_lazy_zod22.z.number().optional(),
2936
2938
  packageConfig: packageConfigSchema.optional(),
@@ -3116,6 +3118,10 @@ var init_front_mcp_metadata = __esm({
3116
3118
  output: outputPolicySchema.optional(),
3117
3119
  jobs: import_lazy_zod24.z.object({
3118
3120
  enabled: import_lazy_zod24.z.boolean(),
3121
+ // Opt-in for `register_job` / `register_workflow` (GHSA-58v2-gpcc-jmqv).
3122
+ // Omitting it here would let Zod strip the flag before the scope reads
3123
+ // it, leaving the documented escape hatch permanently off.
3124
+ allowDynamicRegistration: import_lazy_zod24.z.boolean().optional(),
3119
3125
  store: import_lazy_zod24.z.object({
3120
3126
  redis: redisOptionsSchema.optional(),
3121
3127
  keyPrefix: import_lazy_zod24.z.string().optional()
@@ -3164,11 +3170,11 @@ var init_front_mcp_metadata = __esm({
3164
3170
  });
3165
3171
  frontMcpMultiAppSchema = frontMcpBaseSchema.extend({
3166
3172
  splitByApp: import_lazy_zod24.z.literal(false).default(false).describe("If true, each app gets its own scope & basePath."),
3167
- auth: import_auth8.authOptionsSchema.optional().describe("Configures the server's default authentication provider.")
3173
+ auth: import_auth9.authOptionsSchema.optional().describe("Configures the server's default authentication provider.")
3168
3174
  });
3169
3175
  frontMcpSplitByAppSchema = frontMcpBaseSchema.extend({
3170
3176
  splitByApp: import_lazy_zod24.z.literal(true).describe("If false, apps are grouped under the same scope & basePath."),
3171
- auth: import_auth8.authOptionsSchema.optional().describe("Configures the server's default authentication provider.")
3177
+ auth: import_auth9.authOptionsSchema.optional().describe("Configures the server's default authentication provider.")
3172
3178
  });
3173
3179
  frontMcpMetadataSchema = frontMcpMultiAppSchema.or(frontMcpSplitByAppSchema).transform(applyAutoTransportPersistence);
3174
3180
  frontMcpLiteSchema = import_lazy_zod24.z.object({
@@ -3186,7 +3192,7 @@ var init_front_mcp_metadata = __esm({
3186
3192
  apps: import_lazy_zod24.z.array(annotatedFrontMcpAppSchema),
3187
3193
  serve: import_lazy_zod24.z.boolean().optional().default(false),
3188
3194
  splitByApp: import_lazy_zod24.z.boolean().optional().default(false),
3189
- auth: import_auth8.authOptionsSchema.optional(),
3195
+ auth: import_auth9.authOptionsSchema.optional(),
3190
3196
  logging: loggingOptionsSchema.optional(),
3191
3197
  skillsConfig: skillsConfigOptionsSchema.optional(),
3192
3198
  loader: packageLoaderSchema.optional(),
@@ -5300,11 +5306,11 @@ var init_transport_errors = __esm({
5300
5306
  });
5301
5307
 
5302
5308
  // libs/sdk/src/errors/auth-internal.errors.ts
5303
- var import_auth11;
5309
+ var import_auth12;
5304
5310
  var init_auth_internal_errors = __esm({
5305
5311
  "libs/sdk/src/errors/auth-internal.errors.ts"() {
5306
5312
  "use strict";
5307
- import_auth11 = require("@frontmcp/auth");
5313
+ import_auth12 = require("@frontmcp/auth");
5308
5314
  }
5309
5315
  });
5310
5316
 
@@ -5621,11 +5627,11 @@ __export(errors_exports, {
5621
5627
  AgentToolNotFoundError: () => AgentToolNotFoundError,
5622
5628
  AgentVisibilityError: () => AgentVisibilityError,
5623
5629
  AuthConfigurationError: () => AuthConfigurationError,
5624
- AuthProvidersNotConfiguredError: () => import_auth11.AuthProvidersNotConfiguredError,
5630
+ AuthProvidersNotConfiguredError: () => import_auth12.AuthProvidersNotConfiguredError,
5625
5631
  AuthorizationRequiredError: () => AuthorizationRequiredError,
5626
5632
  ConfigNotFoundError: () => ConfigNotFoundError,
5627
5633
  ContextExtensionNotAvailableError: () => ContextExtensionNotAvailableError,
5628
- CredentialProviderAlreadyRegisteredError: () => import_auth11.CredentialProviderAlreadyRegisteredError,
5634
+ CredentialProviderAlreadyRegisteredError: () => import_auth12.CredentialProviderAlreadyRegisteredError,
5629
5635
  DependencyCycleError: () => DependencyCycleError,
5630
5636
  DependencyNotFoundError: () => DependencyNotFoundError,
5631
5637
  DynamicAdapterNameError: () => DynamicAdapterNameError,
@@ -5635,13 +5641,13 @@ __export(errors_exports, {
5635
5641
  ElicitationEncryptionError: () => ElicitationEncryptionError,
5636
5642
  ElicitationFallbackRequired: () => ElicitationFallbackRequired,
5637
5643
  ElicitationNotSupportedError: () => ElicitationNotSupportedError,
5638
- ElicitationSecretRequiredError: () => import_auth11.ElicitationSecretRequiredError,
5644
+ ElicitationSecretRequiredError: () => import_auth12.ElicitationSecretRequiredError,
5639
5645
  ElicitationStoreNotInitializedError: () => ElicitationStoreNotInitializedError,
5640
5646
  ElicitationSubscriptionError: () => ElicitationSubscriptionError,
5641
5647
  ElicitationTimeoutError: () => ElicitationTimeoutError,
5642
5648
  EnclaveExecutionError: () => EnclaveExecutionError,
5643
- EncryptionContextNotSetError: () => import_auth11.EncryptionContextNotSetError,
5644
- EncryptionKeyNotConfiguredError: () => import_auth11.EncryptionKeyNotConfiguredError,
5649
+ EncryptionContextNotSetError: () => import_auth12.EncryptionContextNotSetError,
5650
+ EncryptionKeyNotConfiguredError: () => import_auth12.EncryptionKeyNotConfiguredError,
5645
5651
  EntryUnavailableError: () => EntryUnavailableError,
5646
5652
  EntryValidationError: () => EntryValidationError,
5647
5653
  ErrorHandler: () => ErrorHandler,
@@ -5658,7 +5664,7 @@ __export(errors_exports, {
5658
5664
  GlobalConfigNotFoundError: () => GlobalConfigNotFoundError,
5659
5665
  HaConfigurationError: () => HaConfigurationError,
5660
5666
  HookTargetNotDefinedError: () => HookTargetNotDefinedError,
5661
- InMemoryStoreRequiredError: () => import_auth11.InMemoryStoreRequiredError,
5667
+ InMemoryStoreRequiredError: () => import_auth12.InMemoryStoreRequiredError,
5662
5668
  InputRequiredSignal: () => InputRequiredSignal,
5663
5669
  InternalMcpError: () => InternalMcpError,
5664
5670
  InvalidDecoratorMetadataError: () => InvalidDecoratorMetadataError,
@@ -5680,6 +5686,8 @@ __export(errors_exports, {
5680
5686
  InvalidUseValueError: () => InvalidUseValueError,
5681
5687
  InvokeStateMissingKeyError: () => InvokeStateMissingKeyError,
5682
5688
  JobNotAuthorizedError: () => JobNotAuthorizedError,
5689
+ JwtSecretRequiredError: () => import_auth12.JwtSecretRequiredError,
5690
+ JwtSecretWeakError: () => import_auth12.JwtSecretWeakError,
5683
5691
  MCP_ERROR_CODES: () => MCP_ERROR_CODES,
5684
5692
  McpError: () => McpError,
5685
5693
  MethodNotImplementedError: () => MethodNotImplementedError,
@@ -5687,9 +5695,9 @@ __export(errors_exports, {
5687
5695
  MissingPromptArgumentError: () => MissingPromptArgumentError,
5688
5696
  MissingProvideError: () => MissingProvideError,
5689
5697
  NameDisambiguationError: () => NameDisambiguationError,
5690
- NoProviderIdError: () => import_auth11.NoProviderIdError,
5691
- OrchestratedAuthNotAvailableError: () => import_auth11.OrchestratedAuthNotAvailableError,
5692
- OrchestratorJwksNotAvailableError: () => import_auth11.OrchestratorJwksNotAvailableError,
5698
+ NoProviderIdError: () => import_auth12.NoProviderIdError,
5699
+ OrchestratedAuthNotAvailableError: () => import_auth12.OrchestratedAuthNotAvailableError,
5700
+ OrchestratorJwksNotAvailableError: () => import_auth12.OrchestratorJwksNotAvailableError,
5693
5701
  PayloadTooLargeError: () => PayloadTooLargeError,
5694
5702
  PluginDependencyError: () => PluginDependencyError,
5695
5703
  PromptExecutionError: () => PromptExecutionError,
@@ -5731,13 +5739,13 @@ __export(errors_exports, {
5731
5739
  ResourceReadError: () => ResourceReadError,
5732
5740
  SamplingNotAvailableError: () => SamplingNotAvailableError,
5733
5741
  ScopeConfigurationError: () => ScopeConfigurationError,
5734
- ScopeDeniedError: () => import_auth11.ScopeDeniedError,
5742
+ ScopeDeniedError: () => import_auth12.ScopeDeniedError,
5735
5743
  ServerNotFoundError: () => ServerNotFoundError,
5736
5744
  ServerlessHandlerNotInitializedError: () => ServerlessHandlerNotInitializedError,
5737
5745
  SessionClaimConflictError: () => SessionClaimConflictError,
5738
- SessionIdEmptyError: () => import_auth11.SessionIdEmptyError,
5746
+ SessionIdEmptyError: () => import_auth12.SessionIdEmptyError,
5739
5747
  SessionMissingError: () => SessionMissingError,
5740
- SessionSecretRequiredError: () => import_auth11.SessionSecretRequiredError,
5748
+ SessionSecretRequiredError: () => import_auth12.SessionSecretRequiredError,
5741
5749
  SessionVerificationFailedError: () => SessionVerificationFailedError,
5742
5750
  SkillContextNotImplementedError: () => SkillContextNotImplementedError,
5743
5751
  SkillInstructionFetchError: () => SkillInstructionFetchError,
@@ -5747,9 +5755,9 @@ __export(errors_exports, {
5747
5755
  TaskAugmentationRequiredError: () => TaskAugmentationRequiredError,
5748
5756
  TaskNotFoundError: () => TaskNotFoundError,
5749
5757
  TaskStoreNotInitializedError: () => TaskStoreNotInitializedError,
5750
- TokenLeakDetectedError: () => import_auth11.TokenLeakDetectedError,
5751
- TokenNotAvailableError: () => import_auth11.TokenNotAvailableError,
5752
- TokenStoreRequiredError: () => import_auth11.TokenStoreRequiredError,
5758
+ TokenLeakDetectedError: () => import_auth12.TokenLeakDetectedError,
5759
+ TokenNotAvailableError: () => import_auth12.TokenNotAvailableError,
5760
+ TokenStoreRequiredError: () => import_auth12.TokenStoreRequiredError,
5753
5761
  ToolCredentialsRequiredError: () => ToolCredentialsRequiredError,
5754
5762
  ToolExecutionError: () => ToolExecutionError,
5755
5763
  ToolNotConsentedError: () => ToolNotConsentedError,
@@ -5763,8 +5771,8 @@ __export(errors_exports, {
5763
5771
  UnsupportedContentTypeError: () => UnsupportedContentTypeError,
5764
5772
  UnsupportedHookOwnerKindError: () => UnsupportedHookOwnerKindError,
5765
5773
  UnsupportedTransportTypeError: () => UnsupportedTransportTypeError,
5766
- VaultLoadError: () => import_auth11.VaultLoadError,
5767
- VaultNotFoundError: () => import_auth11.VaultNotFoundError,
5774
+ VaultLoadError: () => import_auth12.VaultLoadError,
5775
+ VaultNotFoundError: () => import_auth12.VaultNotFoundError,
5768
5776
  VercelKvAsyncInitRequiredError: () => VercelKvAsyncInitRequiredError,
5769
5777
  VercelKvNotSupportedError: () => VercelKvNotSupportedError,
5770
5778
  WorkflowDagValidationError: () => WorkflowDagValidationError,
@@ -9277,22 +9285,24 @@ function hasValidSessionStructure(dec) {
9277
9285
  function isValidSessionPayload(dec, sig) {
9278
9286
  return hasValidSessionStructure(dec) && dec.authSig === sig;
9279
9287
  }
9280
- function isValidPublicSessionPayload(dec) {
9288
+ function isValidPublicSessionPayload(dec, expectedAuthSig = "public") {
9281
9289
  if (typeof dec !== "object" || dec === null) return false;
9282
9290
  const d = dec;
9283
- return typeof d["nodeId"] === "string" && d["authSig"] === "public" && typeof d["uuid"] === "string" && typeof d["iat"] === "number" && d["isPublic"] === true;
9291
+ 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 —
9292
+ // a static-mode session must never decrypt as a public one.
9293
+ d["isPublic"] === (expectedAuthSig === "public");
9284
9294
  }
9285
9295
  function decryptSessionId(sessionId, sig) {
9286
- const dec = (0, import_auth12.safeDecrypt)(sessionId);
9296
+ const dec = (0, import_auth13.safeDecrypt)(sessionId);
9287
9297
  return isValidSessionPayload(dec, sig) ? dec : null;
9288
9298
  }
9289
- function decryptPublicSession(sessionId) {
9299
+ function decryptPublicSession(sessionId, expectedAuthSig = "public") {
9290
9300
  const cached = cache.get(sessionId);
9291
- if (cached && isValidPublicSessionPayload(cached)) {
9301
+ if (cached && isValidPublicSessionPayload(cached, expectedAuthSig)) {
9292
9302
  return cached;
9293
9303
  }
9294
- const dec = (0, import_auth12.safeDecrypt)(sessionId);
9295
- if (isValidPublicSessionPayload(dec)) {
9304
+ const dec = (0, import_auth13.safeDecrypt)(sessionId);
9305
+ if (isValidPublicSessionPayload(dec, expectedAuthSig)) {
9296
9306
  cache.set(sessionId, dec);
9297
9307
  return dec;
9298
9308
  }
@@ -9302,7 +9312,7 @@ function nowSec() {
9302
9312
  return Math.floor(Date.now() / 1e3);
9303
9313
  }
9304
9314
  function parseSessionHeader(sessionHeader, token) {
9305
- const currentAuthSig = (0, import_auth12.getTokenSignatureFingerprint)(token);
9315
+ const currentAuthSig = (0, import_auth13.getTokenSignatureFingerprint)(token);
9306
9316
  if (sessionHeader) {
9307
9317
  const cached = cache.get(sessionHeader);
9308
9318
  if (cached) {
@@ -9319,7 +9329,7 @@ function parseSessionHeader(sessionHeader, token) {
9319
9329
  return void 0;
9320
9330
  }
9321
9331
  function createSessionId(protocol, token, options) {
9322
- const authSig = (0, import_auth12.getTokenSignatureFingerprint)(token);
9332
+ const authSig = (0, import_auth13.getTokenSignatureFingerprint)(token);
9323
9333
  let platformType;
9324
9334
  if (options?.userAgent) {
9325
9335
  platformType = detectPlatformFromUserAgent(options.userAgent, options.platformDetectionConfig);
@@ -9337,7 +9347,7 @@ function createSessionId(protocol, token, options) {
9337
9347
  // Add skillsOnlyMode if provided
9338
9348
  ...options?.skillsOnlyMode && { skillsOnlyMode: true }
9339
9349
  };
9340
- const id = (0, import_auth12.encryptJson)(payload);
9350
+ const id = (0, import_auth13.encryptJson)(payload);
9341
9351
  cache.set(id, payload);
9342
9352
  return { id, payload };
9343
9353
  }
@@ -9347,26 +9357,26 @@ function updateSessionPayload(sessionId, updates) {
9347
9357
  if (existing) {
9348
9358
  payload = existing;
9349
9359
  } else {
9350
- const decrypted = (0, import_auth12.safeDecrypt)(sessionId);
9360
+ const decrypted = (0, import_auth13.safeDecrypt)(sessionId);
9351
9361
  if (hasValidSessionStructure(decrypted) || isValidPublicSessionPayload(decrypted)) {
9352
9362
  payload = decrypted;
9353
9363
  }
9354
9364
  }
9355
9365
  if (!payload) return null;
9356
9366
  Object.assign(payload, updates);
9357
- const newSessionId = (0, import_auth12.encryptJson)(payload);
9367
+ const newSessionId = (0, import_auth13.encryptJson)(payload);
9358
9368
  cache.set(sessionId, payload);
9359
9369
  cache.set(newSessionId, payload);
9360
9370
  return newSessionId;
9361
9371
  }
9362
- var import_auth12, import_utils18, cache;
9372
+ var import_auth13, import_utils18, cache;
9363
9373
  var init_session_id_utils = __esm({
9364
9374
  "libs/sdk/src/auth/session/utils/session-id.utils.ts"() {
9365
9375
  "use strict";
9366
- import_auth12 = require("@frontmcp/auth");
9376
+ import_auth13 = require("@frontmcp/auth");
9367
9377
  import_utils18 = require("@frontmcp/utils");
9368
9378
  init_notification_service();
9369
- cache = new import_auth12.TinyTtlCache(5e3);
9379
+ cache = new import_auth13.TinyTtlCache(5e3);
9370
9380
  }
9371
9381
  });
9372
9382
 
@@ -12999,11 +13009,11 @@ function validateSessionId(value) {
12999
13009
  );
13000
13010
  }
13001
13011
  }
13002
- var import_auth13, import_utils29, PRE_RESOLVED_ELICIT_KEY, MRTR_EXCHANGE_KEY, REQUEST_NOTIFICATION_SINK_KEY, SESSION_ID_MAX_LENGTH, SESSION_ID_VALID_PATTERN, FrontMcpContext;
13012
+ var import_auth14, import_utils29, PRE_RESOLVED_ELICIT_KEY, MRTR_EXCHANGE_KEY, REQUEST_NOTIFICATION_SINK_KEY, SESSION_ID_MAX_LENGTH, SESSION_ID_VALID_PATTERN, FrontMcpContext;
13003
13013
  var init_frontmcp_context = __esm({
13004
13014
  "libs/sdk/src/context/frontmcp-context.ts"() {
13005
13015
  "use strict";
13006
- import_auth13 = require("@frontmcp/auth");
13016
+ import_auth14 = require("@frontmcp/auth");
13007
13017
  import_utils29 = require("@frontmcp/utils");
13008
13018
  init_mcp_error();
13009
13019
  init_trace_context();
@@ -13418,7 +13428,7 @@ var init_frontmcp_context = __esm({
13418
13428
  let providerCredentialsUsed = false;
13419
13429
  if (init) {
13420
13430
  const creds = init.credentials;
13421
- if ((0, import_auth13.isFrontMcpCredentials)(creds)) {
13431
+ if ((0, import_auth14.isFrontMcpCredentials)(creds)) {
13422
13432
  providerCredentialsUsed = true;
13423
13433
  if (this._credentialMiddleware) {
13424
13434
  const result = await this._credentialMiddleware.applyCredentials(
@@ -18134,7 +18144,7 @@ function isUIResourceUri(uri) {
18134
18144
  return uri.startsWith("ui://");
18135
18145
  }
18136
18146
  function parseWidgetUri(uri) {
18137
- const match = uri.match(/^ui:\/\/widget\/([^.]+)\.(\w+)$/);
18147
+ const match = uri.match(WIDGET_URI_PATTERN);
18138
18148
  if (!match) return null;
18139
18149
  return { toolName: match[1], extension: match[2] };
18140
18150
  }
@@ -18143,7 +18153,7 @@ function getUIResourceMimeType(_platformOrUri) {
18143
18153
  if (_platformOrUri?.endsWith(".css")) return "text/css";
18144
18154
  return import_adapters.MCP_APPS_MIME_TYPE;
18145
18155
  }
18146
- var import_adapters, ToolUIRegistry;
18156
+ var import_adapters, ToolUIRegistry, WIDGET_URI_PATTERN;
18147
18157
  var init_ui_shared = __esm({
18148
18158
  "libs/sdk/src/tool/ui/ui-shared.ts"() {
18149
18159
  "use strict";
@@ -18269,6 +18279,7 @@ var init_ui_shared = __esm({
18269
18279
  return { meta: result.meta };
18270
18280
  }
18271
18281
  };
18282
+ WIDGET_URI_PATTERN = /^ui:\/\/widget\/([A-Za-z0-9_:@-]+)\.(html|js|css)$/;
18272
18283
  }
18273
18284
  });
18274
18285
 
@@ -20649,15 +20660,15 @@ function asAppIdList(value) {
20649
20660
  }
20650
20661
  function getAuthorizedAppIds(authInfo) {
20651
20662
  if (!authInfo) return void 0;
20652
- const list = asAppIdList(readAuthorizedApps(readUser(authInfo.extra))) ?? asAppIdList(readAuthorizedApps(authInfo.extra)) ?? asAppIdList(readAuthorizedApps(authInfo.user)) ?? asAppIdList((0, import_auth14.decodeJwtPayloadSafe)(authInfo.token)?.["authorized_apps"]);
20663
+ const list = asAppIdList(readAuthorizedApps(readUser(authInfo.extra))) ?? asAppIdList(readAuthorizedApps(authInfo.extra)) ?? asAppIdList(readAuthorizedApps(authInfo.user)) ?? asAppIdList((0, import_auth15.decodeJwtPayloadSafe)(authInfo.token)?.["authorized_apps"]);
20653
20664
  if (!list) return void 0;
20654
20665
  return new Set(list);
20655
20666
  }
20656
- var import_auth14;
20667
+ var import_auth15;
20657
20668
  var init_authorized_apps_utils = __esm({
20658
20669
  "libs/sdk/src/auth/authorized-apps.utils.ts"() {
20659
20670
  "use strict";
20660
- import_auth14 = require("@frontmcp/auth");
20671
+ import_auth15 = require("@frontmcp/auth");
20661
20672
  }
20662
20673
  });
20663
20674
 
@@ -20678,7 +20689,7 @@ function asConsentClaim(value) {
20678
20689
  }
20679
20690
  function getConsentedToolIds(authInfo) {
20680
20691
  if (!authInfo) return void 0;
20681
- const claim = asConsentClaim(readConsent(readUser2(authInfo.extra))) ?? asConsentClaim(readConsent(authInfo.extra)) ?? asConsentClaim(readConsent(authInfo.user)) ?? asConsentClaim((0, import_auth15.decodeJwtPayloadSafe)(authInfo.token)?.["consent"]);
20692
+ const claim = asConsentClaim(readConsent(readUser2(authInfo.extra))) ?? asConsentClaim(readConsent(authInfo.extra)) ?? asConsentClaim(readConsent(authInfo.user)) ?? asConsentClaim((0, import_auth16.decodeJwtPayloadSafe)(authInfo.token)?.["consent"]);
20682
20693
  if (!claim) return void 0;
20683
20694
  const selected = Array.isArray(claim.selectedTools) ? claim.selectedTools.filter((t) => typeof t === "string") : [];
20684
20695
  return new Set(selected);
@@ -20687,11 +20698,11 @@ function isToolConsented(consented, ...toolIds) {
20687
20698
  if (!consented) return true;
20688
20699
  return toolIds.some((id) => id !== void 0 && consented.has(id));
20689
20700
  }
20690
- var import_auth15;
20701
+ var import_auth16;
20691
20702
  var init_consent_utils = __esm({
20692
20703
  "libs/sdk/src/auth/consent.utils.ts"() {
20693
20704
  "use strict";
20694
- import_auth15 = require("@frontmcp/auth");
20705
+ import_auth16 = require("@frontmcp/auth");
20695
20706
  }
20696
20707
  });
20697
20708
 
@@ -20707,8 +20718,8 @@ async function evaluateToolCredentialGate(providers, tryGet) {
20707
20718
  if (required.length === 0) {
20708
20719
  return { evaluated: true, missing: [] };
20709
20720
  }
20710
- const authProviders = resolveAccessor(tryGet, import_auth16.AUTH_PROVIDERS_ACCESSOR, isAuthProvidersLike);
20711
- const credentials = resolveAccessor(tryGet, import_auth16.CREDENTIALS_ACCESSOR, isCredentialsLike);
20721
+ const authProviders = resolveAccessor(tryGet, import_auth17.AUTH_PROVIDERS_ACCESSOR, isAuthProvidersLike);
20722
+ const credentials = resolveAccessor(tryGet, import_auth17.CREDENTIALS_ACCESSOR, isCredentialsLike);
20712
20723
  if (!authProviders && !credentials) {
20713
20724
  return { evaluated: false, missing: [] };
20714
20725
  }
@@ -20748,20 +20759,20 @@ async function checkProvider(name42, authProviders, credentials) {
20748
20759
  }
20749
20760
  return { available: false };
20750
20761
  }
20751
- var import_auth16;
20762
+ var import_auth17;
20752
20763
  var init_tool_credentials_gate = __esm({
20753
20764
  "libs/sdk/src/tool/flows/tool-credentials.gate.ts"() {
20754
20765
  "use strict";
20755
- import_auth16 = require("@frontmcp/auth");
20766
+ import_auth17 = require("@frontmcp/auth");
20756
20767
  }
20757
20768
  });
20758
20769
 
20759
20770
  // libs/sdk/src/tool/flows/call-tool.flow.ts
20760
- var import_auth17, import_guard4, import_lazy_zod56, import_protocol38, import_adapters4, import_utils45, inputSchema13, outputSchema12, stateSchema12, plan12, name12, Stage12, CallToolFlow;
20771
+ var import_auth18, import_guard4, import_lazy_zod56, import_protocol38, import_adapters4, import_utils45, inputSchema13, outputSchema12, stateSchema12, plan12, name12, Stage12, CallToolFlow;
20761
20772
  var init_call_tool_flow = __esm({
20762
20773
  "libs/sdk/src/tool/flows/call-tool.flow.ts"() {
20763
20774
  "use strict";
20764
- import_auth17 = require("@frontmcp/auth");
20775
+ import_auth18 = require("@frontmcp/auth");
20765
20776
  import_guard4 = require("@frontmcp/guard");
20766
20777
  import_lazy_zod56 = require("@frontmcp/lazy-zod");
20767
20778
  import_protocol38 = require("@frontmcp/protocol");
@@ -21120,7 +21131,7 @@ var init_call_tool_flow = __esm({
21120
21131
  const app = apps.find((a) => a.metadata.id === appId);
21121
21132
  const authOptions = this.scope.auth?.options;
21122
21133
  let skippedBehavior = "anonymous";
21123
- if (authOptions && (0, import_auth10.isOrchestratedMode)(authOptions)) {
21134
+ if (authOptions && (0, import_auth11.isOrchestratedMode)(authOptions)) {
21124
21135
  const incrementalConfig = authOptions.incrementalAuth;
21125
21136
  if (incrementalConfig) {
21126
21137
  if (incrementalConfig.enabled === false) {
@@ -21182,7 +21193,7 @@ var init_call_tool_flow = __esm({
21182
21193
  if (!sub) return void 0;
21183
21194
  const secret = this.scope.auth?.signingSecret;
21184
21195
  if (!secret) return void 0;
21185
- return (0, import_auth17.signIncrementalAuthTicket)(
21196
+ return (0, import_auth18.signIncrementalAuthTicket)(
21186
21197
  {
21187
21198
  sub,
21188
21199
  appId,
@@ -23148,8 +23159,181 @@ var init_adapter_registry = __esm({
23148
23159
  }
23149
23160
  });
23150
23161
 
23162
+ // libs/sdk/src/common/utils/path.utils.ts
23163
+ function normalizeEntryPrefix(entryPath) {
23164
+ const t = (0, import_utils47.trimSlashes)(entryPath ?? "");
23165
+ return t ? `/${t}` : "";
23166
+ }
23167
+ function resolveEntryPath(entryPath) {
23168
+ if (entryPath !== void 0) return entryPath;
23169
+ return process.env["FRONTMCP_HTTP_ENTRY_PATH"] ?? "";
23170
+ }
23171
+ function normalizeScopeBase(scopeBase) {
23172
+ const t = (0, import_utils47.trimSlashes)(scopeBase ?? "");
23173
+ return t ? `/${t}` : "";
23174
+ }
23175
+ function readPublicUrlPin() {
23176
+ try {
23177
+ if (typeof process !== "undefined" && process.env) {
23178
+ const v = process.env["FRONTMCP_PUBLIC_URL"];
23179
+ if (typeof v === "string" && v.trim()) {
23180
+ return v.trim().replace(/\/+$/, "");
23181
+ }
23182
+ }
23183
+ } catch {
23184
+ }
23185
+ return void 0;
23186
+ }
23187
+ function isPublicUrlPinned() {
23188
+ return readPublicUrlPin() !== void 0;
23189
+ }
23190
+ function isProxyTrusted() {
23191
+ try {
23192
+ if (typeof process !== "undefined" && process.env) {
23193
+ const v = process.env["FRONTMCP_TRUST_PROXY"];
23194
+ return typeof v === "string" && /^(1|true|yes|on)$/i.test(v.trim());
23195
+ }
23196
+ } catch {
23197
+ }
23198
+ return false;
23199
+ }
23200
+ function getRequestBaseUrl(req, entryPath) {
23201
+ const pin = readPublicUrlPin();
23202
+ if (pin) {
23203
+ return `${pin}${entryPath ?? ""}`;
23204
+ }
23205
+ const trustProxy = isProxyTrusted();
23206
+ const fwdProto = trustProxy ? req.headers["x-forwarded-proto"] : void 0;
23207
+ const fwdHost = trustProxy ? req.headers["x-forwarded-host"] : void 0;
23208
+ const proto = fwdProto || req.protocol || "http";
23209
+ const host = fwdHost || req.headers["host"];
23210
+ return `${proto}://${host}${entryPath ?? ""}`;
23211
+ }
23212
+ function computeIssuer(req, entryPath, scopeBase) {
23213
+ const entryPrefix = normalizeEntryPrefix(entryPath);
23214
+ const scope = normalizeScopeBase(scopeBase);
23215
+ return `${getRequestBaseUrl(req)}${entryPrefix}${scope}`;
23216
+ }
23217
+ function computeResource(req, entryPath, scopeBase) {
23218
+ const entryPrefix = normalizeEntryPrefix(entryPath);
23219
+ const scope = normalizeScopeBase(scopeBase);
23220
+ return `${getRequestBaseUrl(req)}${entryPrefix}${scope}`;
23221
+ }
23222
+ function normalizeResourceUri(uri) {
23223
+ try {
23224
+ const url = new URL(uri);
23225
+ let normalized = `${url.protocol}//${url.hostname}`;
23226
+ const isDefaultPort = url.protocol === "https:" && url.port === "443" || url.protocol === "http:" && url.port === "80";
23227
+ if (url.port && !isDefaultPort) {
23228
+ normalized += `:${url.port}`;
23229
+ }
23230
+ let path3 = url.pathname;
23231
+ if (path3.length > 1 && path3.endsWith("/")) {
23232
+ path3 = path3.slice(0, -1);
23233
+ }
23234
+ normalized += path3;
23235
+ return normalized;
23236
+ } catch {
23237
+ return uri;
23238
+ }
23239
+ }
23240
+ function resourceUriMatches(provided, canonical) {
23241
+ return normalizeResourceUri(provided) === normalizeResourceUri(canonical);
23242
+ }
23243
+ function urlToSafeId(url) {
23244
+ const u = new URL(url);
23245
+ const raw = (u.host + (u.pathname && u.pathname !== "/" ? u.pathname : "")).replace(/\/+$/, "");
23246
+ return (0, import_utils47.trimSlashes)(raw).replace(/[^a-zA-Z0-9_-]/g, "-");
23247
+ }
23248
+ function makeWellKnownPaths(name42, entryPrefix, scopeBase = "") {
23249
+ const prefix = normalizeEntryPrefix(entryPrefix);
23250
+ const scope = normalizeScopeBase(scopeBase);
23251
+ const reversed = (0, import_utils47.joinPath)(".well-known", name42) + `${prefix}${scope}`;
23252
+ const inPrefixRoot = `${prefix}${(0, import_utils47.joinPath)(".well-known", name42)}${scope}`;
23253
+ const inPrefixScope = `${prefix}${scope}${(0, import_utils47.joinPath)(".well-known", name42)}`;
23254
+ return /* @__PURE__ */ new Set([reversed, inPrefixRoot, inPrefixScope]);
23255
+ }
23256
+ var import_utils47, import_utils48;
23257
+ var init_path_utils = __esm({
23258
+ "libs/sdk/src/common/utils/path.utils.ts"() {
23259
+ "use strict";
23260
+ import_utils47 = require("@frontmcp/utils");
23261
+ import_utils48 = require("@frontmcp/utils");
23262
+ }
23263
+ });
23264
+
23151
23265
  // libs/sdk/src/context/metadata.utils.ts
23152
- function extractMetadata(headers) {
23266
+ function isIpv4(value) {
23267
+ const match = IPV4_PATTERN.exec(value);
23268
+ if (!match) return false;
23269
+ return match.slice(1).every((octet) => {
23270
+ if (octet.length > 1 && octet.startsWith("0")) return false;
23271
+ return Number(octet) <= 255;
23272
+ });
23273
+ }
23274
+ function isIpv6(value) {
23275
+ const text = value.includes("%") ? value.slice(0, value.indexOf("%")) : value;
23276
+ if (text.length === 0) return false;
23277
+ let head = text;
23278
+ let embedded = 0;
23279
+ const lastColon = head.lastIndexOf(":");
23280
+ const tail = lastColon === -1 ? "" : head.slice(lastColon + 1);
23281
+ if (tail.includes(".")) {
23282
+ if (!isIpv4(tail)) return false;
23283
+ head = head.slice(0, lastColon + 1);
23284
+ embedded = 2;
23285
+ }
23286
+ const halves = head.split("::");
23287
+ if (halves.length > 2) return false;
23288
+ const countGroups = (part) => {
23289
+ if (part === "") return 0;
23290
+ const groups = part.split(":").filter((group, index, all) => !(group === "" && index === all.length - 1));
23291
+ for (const group of groups) {
23292
+ if (!/^[0-9A-Fa-f]{1,4}$/.test(group)) return null;
23293
+ }
23294
+ return groups.length;
23295
+ };
23296
+ const headCount = countGroups(halves[0]);
23297
+ if (headCount === null) return false;
23298
+ if (halves.length === 1) {
23299
+ return headCount + embedded === 8;
23300
+ }
23301
+ const tailCount = countGroups(halves[1]);
23302
+ if (tailCount === null) return false;
23303
+ return headCount + tailCount + embedded <= 7;
23304
+ }
23305
+ function isIpAddress(value) {
23306
+ const candidate = value.startsWith("[") && value.endsWith("]") ? value.slice(1, -1) : value;
23307
+ return candidate.includes(":") ? isIpv6(candidate) : isIpv4(candidate);
23308
+ }
23309
+ function normalizeIp(value) {
23310
+ if (typeof value !== "string") return void 0;
23311
+ const trimmed = value.trim();
23312
+ if (!trimmed) return void 0;
23313
+ return isIpAddress(trimmed) ? trimmed : void 0;
23314
+ }
23315
+ function readTrustedProxyDepth() {
23316
+ try {
23317
+ if (typeof process !== "undefined" && process.env) {
23318
+ const parsed = Number(process.env["FRONTMCP_TRUSTED_PROXY_DEPTH"]);
23319
+ if (Number.isInteger(parsed) && parsed > 0) return parsed;
23320
+ }
23321
+ } catch {
23322
+ }
23323
+ return 1;
23324
+ }
23325
+ function normalizeDepth(depth) {
23326
+ if (depth === void 0) return readTrustedProxyDepth();
23327
+ return Number.isInteger(depth) && depth > 0 ? depth : readTrustedProxyDepth();
23328
+ }
23329
+ function headerValues(header) {
23330
+ if (typeof header === "string") return header.split(",");
23331
+ if (Array.isArray(header)) {
23332
+ return header.filter((entry) => typeof entry === "string").flatMap((entry) => entry.split(","));
23333
+ }
23334
+ return [];
23335
+ }
23336
+ function extractMetadata(headers, options) {
23153
23337
  const customHeaders = {};
23154
23338
  for (const [key, value] of Object.entries(headers)) {
23155
23339
  if (key.toLowerCase().startsWith("x-frontmcp-") && typeof value === "string") {
@@ -23160,30 +23344,34 @@ function extractMetadata(headers) {
23160
23344
  userAgent: typeof headers["user-agent"] === "string" ? headers["user-agent"] : void 0,
23161
23345
  contentType: typeof headers["content-type"] === "string" ? headers["content-type"] : void 0,
23162
23346
  accept: typeof headers["accept"] === "string" ? headers["accept"] : void 0,
23163
- clientIp: extractClientIp(headers),
23347
+ clientIp: extractClientIp(headers, options),
23164
23348
  customHeaders
23165
23349
  };
23166
23350
  }
23167
- function extractClientIp(headers) {
23168
- const xff = headers["x-forwarded-for"];
23169
- if (typeof xff === "string") {
23170
- return xff.split(",")[0]?.trim();
23351
+ function extractClientIp(headers, options) {
23352
+ const peerIp = normalizeIp(options?.peerAddress);
23353
+ const trustProxy = options?.trustProxy ?? isProxyTrusted();
23354
+ if (!trustProxy) {
23355
+ return peerIp;
23171
23356
  }
23172
- if (Array.isArray(xff) && typeof xff[0] === "string") {
23173
- return xff[0].split(",")[0]?.trim();
23357
+ const depth = normalizeDepth(options?.trustedProxyDepth);
23358
+ const forwarded = headerValues(headers["x-forwarded-for"]).map((entry) => entry.trim()).filter((entry) => entry.length > 0);
23359
+ if (forwarded.length > 0) {
23360
+ if (forwarded.length < depth) return peerIp;
23361
+ return normalizeIp(forwarded[forwarded.length - depth]) ?? peerIp;
23174
23362
  }
23175
- const realIp = headers["x-real-ip"];
23176
- if (typeof realIp === "string") {
23177
- return realIp;
23363
+ if (depth === 1) {
23364
+ const realIp = normalizeIp(headerValues(headers["x-real-ip"])[0]);
23365
+ if (realIp) return realIp;
23178
23366
  }
23179
- if (Array.isArray(realIp) && typeof realIp[0] === "string") {
23180
- return realIp[0];
23181
- }
23182
- return void 0;
23367
+ return peerIp;
23183
23368
  }
23369
+ var IPV4_PATTERN;
23184
23370
  var init_metadata_utils = __esm({
23185
23371
  "libs/sdk/src/context/metadata.utils.ts"() {
23186
23372
  "use strict";
23373
+ init_path_utils();
23374
+ IPV4_PATTERN = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
23187
23375
  }
23188
23376
  });
23189
23377
 
@@ -23192,18 +23380,18 @@ var frontmcp_context_storage_exports = {};
23192
23380
  __export(frontmcp_context_storage_exports, {
23193
23381
  FrontMcpContextStorage: () => FrontMcpContextStorage
23194
23382
  });
23195
- var import_utils47, frontmcpContextStorage, FrontMcpContextStorage;
23383
+ var import_utils49, frontmcpContextStorage, FrontMcpContextStorage;
23196
23384
  var init_frontmcp_context_storage = __esm({
23197
23385
  "libs/sdk/src/context/frontmcp-context-storage.ts"() {
23198
23386
  "use strict";
23199
- import_utils47 = require("@frontmcp/utils");
23387
+ import_utils49 = require("@frontmcp/utils");
23200
23388
  init_decorators();
23201
23389
  init_metadata();
23202
23390
  init_mcp_error();
23203
23391
  init_frontmcp_context();
23204
23392
  init_metadata_utils();
23205
23393
  init_trace_context();
23206
- frontmcpContextStorage = new import_utils47.AsyncLocalStorage();
23394
+ frontmcpContextStorage = new import_utils49.AsyncLocalStorage();
23207
23395
  FrontMcpContextStorage = class {
23208
23396
  /**
23209
23397
  * Run a callback with a new FrontMcpContext.
@@ -23228,10 +23416,11 @@ var init_frontmcp_context_storage = __esm({
23228
23416
  * @returns Result of the callback
23229
23417
  */
23230
23418
  runFromHeaders(headers, args, fn) {
23419
+ const { peerAddress, ...contextArgs } = args;
23231
23420
  const traceContext = parseTraceContext(headers);
23232
- const metadata = extractMetadata(headers);
23421
+ const metadata = extractMetadata(headers, { peerAddress });
23233
23422
  const context = new FrontMcpContext({
23234
- ...args,
23423
+ ...contextArgs,
23235
23424
  traceContext,
23236
23425
  metadata
23237
23426
  });
@@ -23521,11 +23710,11 @@ var init_flow_interface = __esm({
23521
23710
  });
23522
23711
 
23523
23712
  // libs/sdk/src/common/interfaces/execution-context.interface.ts
23524
- var import_utils48, ExecutionContextBase;
23713
+ var import_utils50, ExecutionContextBase;
23525
23714
  var init_execution_context_interface = __esm({
23526
23715
  "libs/sdk/src/common/interfaces/execution-context.interface.ts"() {
23527
23716
  "use strict";
23528
- import_utils48 = require("@frontmcp/utils");
23717
+ import_utils50 = require("@frontmcp/utils");
23529
23718
  init_config_service();
23530
23719
  init_context();
23531
23720
  init_mcp_error();
@@ -23547,7 +23736,7 @@ var init_execution_context_interface = __esm({
23547
23736
  _authContext;
23548
23737
  constructor(args) {
23549
23738
  const { providers, logger, authInfo } = args;
23550
- this.runId = (0, import_utils48.randomUUID)();
23739
+ this.runId = (0, import_utils50.randomUUID)();
23551
23740
  this.providers = providers;
23552
23741
  this.logger = logger;
23553
23742
  this._authInfo = authInfo;
@@ -23767,7 +23956,7 @@ var init_execution_context_interface = __esm({
23767
23956
  * Get the current runtime context (platform, runtime, deployment, env).
23768
23957
  */
23769
23958
  get runtimeContext() {
23770
- return (0, import_utils48.getRuntimeContext)();
23959
+ return (0, import_utils50.getRuntimeContext)();
23771
23960
  }
23772
23961
  /**
23773
23962
  * Check if running on a specific OS platform.
@@ -23802,11 +23991,11 @@ var init_execution_context_interface = __esm({
23802
23991
  });
23803
23992
 
23804
23993
  // libs/sdk/src/common/interfaces/prompt.interface.ts
23805
- var import_utils49, PromptContext;
23994
+ var import_utils51, PromptContext;
23806
23995
  var init_prompt_interface = __esm({
23807
23996
  "libs/sdk/src/common/interfaces/prompt.interface.ts"() {
23808
23997
  "use strict";
23809
- import_utils49 = require("@frontmcp/utils");
23998
+ import_utils51 = require("@frontmcp/utils");
23810
23999
  init_flow_interface();
23811
24000
  PromptContext = class {
23812
24001
  providers;
@@ -23826,7 +24015,7 @@ var init_prompt_interface = __esm({
23826
24015
  _outputHistory = [];
23827
24016
  constructor(ctorArgs) {
23828
24017
  const { metadata, args, providers, logger, authInfo } = ctorArgs;
23829
- this.runId = (0, import_utils49.randomUUID)();
24018
+ this.runId = (0, import_utils51.randomUUID)();
23830
24019
  this.promptName = metadata.name;
23831
24020
  this.promptId = metadata.name;
23832
24021
  this.metadata = metadata;
@@ -23879,7 +24068,7 @@ var init_prompt_interface = __esm({
23879
24068
  // ---- Runtime context helpers ----
23880
24069
  /** Get the current runtime context (platform, runtime, deployment, env). */
23881
24070
  get runtimeContext() {
23882
- return (0, import_utils49.getRuntimeContext)();
24071
+ return (0, import_utils51.getRuntimeContext)();
23883
24072
  }
23884
24073
  /** Check if running on a specific OS platform. */
23885
24074
  isPlatform(platform) {
@@ -24000,7 +24189,7 @@ function stringToBytes(str, encoding) {
24000
24189
  return new TextEncoder().encode(str);
24001
24190
  }
24002
24191
  try {
24003
- return (0, import_utils50.base64Decode)(str);
24192
+ return (0, import_utils52.base64Decode)(str);
24004
24193
  } catch (err) {
24005
24194
  throw new Error(`Invalid base64 body: ${err instanceof Error ? err.message : String(err)}`);
24006
24195
  }
@@ -24138,11 +24327,11 @@ async function writeHttpResponse(res, value) {
24138
24327
  }
24139
24328
  }
24140
24329
  }
24141
- var import_utils50;
24330
+ var import_utils52;
24142
24331
  var init_server_validation = __esm({
24143
24332
  "libs/sdk/src/server/server.validation.ts"() {
24144
24333
  "use strict";
24145
- import_utils50 = require("@frontmcp/utils");
24334
+ import_utils52 = require("@frontmcp/utils");
24146
24335
  init_common();
24147
24336
  }
24148
24337
  });
@@ -24247,12 +24436,12 @@ function parseTypedKey(k) {
24247
24436
  return { base: k.slice(6, 7).toLowerCase() + k.slice(7), type: "around" };
24248
24437
  return { base: k };
24249
24438
  }
24250
- var import_reflect_metadata11, import_utils51, CAP, WILL, DID, AROUND, FlowInstance;
24439
+ var import_reflect_metadata11, import_utils53, CAP, WILL, DID, AROUND, FlowInstance;
24251
24440
  var init_flow_instance = __esm({
24252
24441
  "libs/sdk/src/flows/flow.instance.ts"() {
24253
24442
  "use strict";
24254
24443
  import_reflect_metadata11 = require("reflect-metadata");
24255
- import_utils51 = require("@frontmcp/utils");
24444
+ import_utils53 = require("@frontmcp/utils");
24256
24445
  init_common();
24257
24446
  init_context();
24258
24447
  init_errors();
@@ -24410,13 +24599,15 @@ var init_flow_instance = __esm({
24410
24599
  }
24411
24600
  const headers = request.headers ?? {};
24412
24601
  const headerSessionId = typeof headers["mcp-session-id"] === "string" ? headers["mcp-session-id"].trim() : "";
24413
- const sessionId = headerSessionId.length > 0 ? headerSessionId : `anon:${(0, import_utils51.randomUUID)()}`;
24602
+ const sessionId = headerSessionId.length > 0 ? headerSessionId : `anon:${(0, import_utils53.randomUUID)()}`;
24414
24603
  const scope = this.globalProviders.getActiveScope();
24604
+ const peerAddress = request.socket?.remoteAddress;
24415
24605
  return storage.runFromHeaders(
24416
24606
  headers,
24417
24607
  {
24418
24608
  sessionId,
24419
- scopeId: scope.id
24609
+ scopeId: scope.id,
24610
+ peerAddress
24420
24611
  },
24421
24612
  async () => {
24422
24613
  return this.run(input, deps);
@@ -24680,12 +24871,12 @@ var init_flow_utils2 = __esm({
24680
24871
  });
24681
24872
 
24682
24873
  // libs/sdk/src/flows/flow.registry.ts
24683
- var import_di18, import_utils52, FlowRegistry;
24874
+ var import_di18, import_utils54, FlowRegistry;
24684
24875
  var init_flow_registry = __esm({
24685
24876
  "libs/sdk/src/flows/flow.registry.ts"() {
24686
24877
  "use strict";
24687
24878
  import_di18 = require("@frontmcp/di");
24688
- import_utils52 = require("@frontmcp/utils");
24879
+ import_utils54 = require("@frontmcp/utils");
24689
24880
  init_common();
24690
24881
  init_context();
24691
24882
  init_errors();
@@ -24769,7 +24960,7 @@ var init_flow_registry = __esm({
24769
24960
  const mcpCtx = input?.ctx;
24770
24961
  const authInfo = mcpCtx?.authInfo;
24771
24962
  const rawSessionId = authInfo?.sessionId;
24772
- const sessionId = typeof rawSessionId === "string" && rawSessionId.trim().length > 0 ? rawSessionId.trim() : `anon:${(0, import_utils52.randomUUID)()}`;
24963
+ const sessionId = typeof rawSessionId === "string" && rawSessionId.trim().length > 0 ? rawSessionId.trim() : `anon:${(0, import_utils54.randomUUID)()}`;
24773
24964
  const scope = this.providers.getActiveScope();
24774
24965
  return Promise.resolve(
24775
24966
  contextStorage.run(
@@ -25427,11 +25618,11 @@ function isSnapshotCapable(db) {
25427
25618
  const d = db;
25428
25619
  return typeof d.toSnapshot === "function" && typeof d.loadSnapshot === "function";
25429
25620
  }
25430
- var import_utils53, STOP_WORDS, MemorySkillProvider;
25621
+ var import_utils55, STOP_WORDS, MemorySkillProvider;
25431
25622
  var init_memory_skill_provider = __esm({
25432
25623
  "libs/sdk/src/skill/providers/memory-skill.provider.ts"() {
25433
25624
  "use strict";
25434
- import_utils53 = require("@frontmcp/utils");
25625
+ import_utils55 = require("@frontmcp/utils");
25435
25626
  init_optional_dependency_util();
25436
25627
  STOP_WORDS = /* @__PURE__ */ new Set([
25437
25628
  // Articles & Determiners
@@ -25611,7 +25802,7 @@ var init_memory_skill_provider = __esm({
25611
25802
  async computeIndexKey() {
25612
25803
  const parts = Array.from(this.skills.values()).map((s) => `${s.id}\0${this.buildSearchableText(s)}`).sort();
25613
25804
  const canonical = `frontmcp-skill-index:v1|${this.scoring}|${this.skills.size}|${parts.join("")}`;
25614
- return (0, import_utils53.sha256Hex)(canonical);
25805
+ return (0, import_utils55.sha256Hex)(canonical);
25615
25806
  }
25616
25807
  /** Await the lazy vectoriadb load (throws the clear install hint if absent). */
25617
25808
  async db() {
@@ -26263,7 +26454,7 @@ function createSkillInstance(record, providers, owner) {
26263
26454
  }
26264
26455
  function getSkillManifestMainDir() {
26265
26456
  try {
26266
- const cwd = (0, import_utils54.getCwd)();
26457
+ const cwd = (0, import_utils56.getCwd)();
26267
26458
  return cwd && cwd.length > 0 ? cwd : void 0;
26268
26459
  } catch {
26269
26460
  return void 0;
@@ -26271,7 +26462,7 @@ function getSkillManifestMainDir() {
26271
26462
  }
26272
26463
  async function loadResourceWithManifestFallback(resourcePath, baseDir, skillName, resourceType, loader) {
26273
26464
  if (!resourcePath) return void 0;
26274
- let dir = resourcePath.startsWith("/") ? resourcePath : baseDir ? (0, import_utils54.pathResolve)(baseDir, resourcePath) : void 0;
26465
+ let dir = resourcePath.startsWith("/") ? resourcePath : baseDir ? (0, import_utils56.pathResolve)(baseDir, resourcePath) : void 0;
26275
26466
  if (dir) {
26276
26467
  try {
26277
26468
  return await loader(dir);
@@ -26295,9 +26486,9 @@ async function resolveFromSkillManifest(skillName) {
26295
26486
  return void 0;
26296
26487
  }
26297
26488
  try {
26298
- const manifestPath = (0, import_utils54.pathJoin)(mainDir2, "_skills", "manifest.json");
26299
- if (await (0, import_utils54.fileExists)(manifestPath)) {
26300
- skillManifestCache = await (0, import_utils54.readJSON)(manifestPath);
26489
+ const manifestPath = (0, import_utils56.pathJoin)(mainDir2, "_skills", "manifest.json");
26490
+ if (await (0, import_utils56.fileExists)(manifestPath)) {
26491
+ skillManifestCache = await (0, import_utils56.readJSON)(manifestPath);
26301
26492
  } else {
26302
26493
  skillManifestCache = null;
26303
26494
  return void 0;
@@ -26315,7 +26506,7 @@ async function resolveFromSkillManifest(skillName) {
26315
26506
  if (!entry?.instructions) return void 0;
26316
26507
  const mainDir = getSkillManifestMainDir();
26317
26508
  if (!mainDir) return void 0;
26318
- return (0, import_utils54.pathResolve)(mainDir, entry.instructions);
26509
+ return (0, import_utils56.pathResolve)(mainDir, entry.instructions);
26319
26510
  }
26320
26511
  async function resolveResourceFromManifest(skillName, resourceType) {
26321
26512
  await resolveFromSkillManifest(skillName);
@@ -26325,13 +26516,13 @@ async function resolveResourceFromManifest(skillName, resourceType) {
26325
26516
  if (!relPath) return void 0;
26326
26517
  const mainDir = getSkillManifestMainDir();
26327
26518
  if (!mainDir) return void 0;
26328
- return (0, import_utils54.pathResolve)(mainDir, relPath);
26519
+ return (0, import_utils56.pathResolve)(mainDir, relPath);
26329
26520
  }
26330
- var import_utils54, SkillInstance, skillManifestCache;
26521
+ var import_utils56, SkillInstance, skillManifestCache;
26331
26522
  var init_skill_instance = __esm({
26332
26523
  "libs/sdk/src/skill/skill.instance.ts"() {
26333
26524
  "use strict";
26334
- import_utils54 = require("@frontmcp/utils");
26525
+ import_utils56 = require("@frontmcp/utils");
26335
26526
  init_common();
26336
26527
  init_skill_utils();
26337
26528
  SkillInstance = class extends SkillEntry {
@@ -26414,7 +26605,7 @@ var init_skill_instance = __esm({
26414
26605
  */
26415
26606
  getBaseDir() {
26416
26607
  if (this.record.kind === "FILE" /* FILE */) {
26417
- return (0, import_utils54.dirname)(this.record.filePath) || void 0;
26608
+ return (0, import_utils56.dirname)(this.record.filePath) || void 0;
26418
26609
  }
26419
26610
  if ((this.record.kind === "VALUE" /* VALUE */ || this.record.kind === "CLASS_TOKEN" /* CLASS_TOKEN */) && this.record.callerDir) {
26420
26611
  return this.record.callerDir;
@@ -26517,12 +26708,12 @@ var init_skill_instance = __esm({
26517
26708
  });
26518
26709
 
26519
26710
  // libs/sdk/src/skill/skill.registry.ts
26520
- var import_di22, import_utils55, SkillRegistry;
26711
+ var import_di22, import_utils57, SkillRegistry;
26521
26712
  var init_skill_registry = __esm({
26522
26713
  "libs/sdk/src/skill/skill.registry.ts"() {
26523
26714
  "use strict";
26524
26715
  import_di22 = require("@frontmcp/di");
26525
- import_utils55 = require("@frontmcp/utils");
26716
+ import_utils57 = require("@frontmcp/utils");
26526
26717
  init_availability();
26527
26718
  init_errors();
26528
26719
  init_regsitry();
@@ -26727,8 +26918,8 @@ var init_skill_registry = __esm({
26727
26918
  return skillVis === visibility;
26728
26919
  });
26729
26920
  }
26730
- const ctx = (0, import_utils55.getRuntimeContext)();
26731
- skills = skills.filter((s) => (0, import_utils55.isEntryAvailable)(s.metadata.availableWhen, ctx));
26921
+ const ctx = (0, import_utils57.getRuntimeContext)();
26922
+ skills = skills.filter((s) => (0, import_utils57.isEntryAvailable)(s.metadata.availableWhen, ctx));
26732
26923
  return skills;
26733
26924
  }
26734
26925
  /**
@@ -26749,8 +26940,8 @@ var init_skill_registry = __esm({
26749
26940
  getAlwaysLoadedSkills() {
26750
26941
  let skills = this.listAllIndexed().map((r) => r.instance);
26751
26942
  skills = skills.filter((s) => s.isAlwaysLoaded());
26752
- const ctx = (0, import_utils55.getRuntimeContext)();
26753
- skills = skills.filter((s) => (0, import_utils55.isEntryAvailable)(s.metadata.availableWhen, ctx));
26943
+ const ctx = (0, import_utils57.getRuntimeContext)();
26944
+ skills = skills.filter((s) => (0, import_utils57.isEntryAvailable)(s.metadata.availableWhen, ctx));
26754
26945
  return skills;
26755
26946
  }
26756
26947
  /**
@@ -26874,8 +27065,8 @@ var init_skill_registry = __esm({
26874
27065
  }
26875
27066
  }
26876
27067
  if (localSkill) {
26877
- const ctx = (0, import_utils55.getRuntimeContext)();
26878
- if (!(0, import_utils55.isEntryAvailable)(localSkill.metadata.availableWhen, ctx)) {
27068
+ const ctx = (0, import_utils57.getRuntimeContext)();
27069
+ if (!(0, import_utils57.isEntryAvailable)(localSkill.metadata.availableWhen, ctx)) {
26879
27070
  return void 0;
26880
27071
  }
26881
27072
  const dynamicResolved = this.dynamicContents.get(localSkill.metadata.id ?? localSkill.metadata.name);
@@ -28801,12 +28992,12 @@ function dedupLineage4(l) {
28801
28992
  }
28802
28993
  return out;
28803
28994
  }
28804
- var import_di26, import_utils56, AgentRegistry;
28995
+ var import_di26, import_utils58, AgentRegistry;
28805
28996
  var init_agent_registry = __esm({
28806
28997
  "libs/sdk/src/agent/agent.registry.ts"() {
28807
28998
  "use strict";
28808
28999
  import_di26 = require("@frontmcp/di");
28809
- import_utils56 = require("@frontmcp/utils");
29000
+ import_utils58 = require("@frontmcp/utils");
28810
29001
  init_availability();
28811
29002
  init_mcp_error();
28812
29003
  init_regsitry();
@@ -29001,11 +29192,11 @@ var init_agent_registry = __esm({
29001
29192
  */
29002
29193
  // NOTE: `any` is intentional - heterogeneous agent collections
29003
29194
  getAgents(includeHidden = false) {
29004
- const ctx = (0, import_utils56.getRuntimeContext)();
29195
+ const ctx = (0, import_utils58.getRuntimeContext)();
29005
29196
  const local = [...this.localRows].map((a) => a.instance);
29006
29197
  const adopted = [...this.adopted.values()].flat().map((a) => a.instance);
29007
29198
  return [...local, ...adopted].filter((a) => {
29008
- if (!(0, import_utils56.isEntryAvailable)(a.metadata.availableWhen, ctx)) return false;
29199
+ if (!(0, import_utils58.isEntryAvailable)(a.metadata.availableWhen, ctx)) return false;
29009
29200
  if (!includeHidden && a.metadata.hideFromDiscovery === true) return false;
29010
29201
  return true;
29011
29202
  });
@@ -29034,8 +29225,8 @@ var init_agent_registry = __esm({
29034
29225
  * Used by discovery/listing APIs to enforce registry-level constraints.
29035
29226
  */
29036
29227
  getAvailableInstances() {
29037
- const ctx = (0, import_utils56.getRuntimeContext)();
29038
- return [...this.listAllInstances()].filter((a) => (0, import_utils56.isEntryAvailable)(a.metadata.availableWhen, ctx));
29228
+ const ctx = (0, import_utils58.getRuntimeContext)();
29229
+ return [...this.listAllInstances()].filter((a) => (0, import_utils58.isEntryAvailable)(a.metadata.availableWhen, ctx));
29039
29230
  }
29040
29231
  /**
29041
29232
  * Find an agent by ID.
@@ -29665,7 +29856,7 @@ function isRemoteAppConfig(item) {
29665
29856
  return true;
29666
29857
  }
29667
29858
  if (obj["urlType"] === "url" || obj["urlType"] === "worker") {
29668
- return (0, import_utils57.isValidMcpUri)(obj["url"]);
29859
+ return (0, import_utils59.isValidMcpUri)(obj["url"]);
29669
29860
  }
29670
29861
  return false;
29671
29862
  }
@@ -29713,23 +29904,23 @@ function appDiscoveryDeps(rec) {
29713
29904
  return (0, import_di27.depsOfClass)(rec.provide, "discovery");
29714
29905
  }
29715
29906
  }
29716
- var import_di27, import_utils57;
29907
+ var import_di27, import_utils59;
29717
29908
  var init_app_utils = __esm({
29718
29909
  "libs/sdk/src/app/app.utils.ts"() {
29719
29910
  "use strict";
29720
29911
  import_di27 = require("@frontmcp/di");
29721
- import_utils57 = require("@frontmcp/utils");
29912
+ import_utils59 = require("@frontmcp/utils");
29722
29913
  init_common();
29723
29914
  init_errors();
29724
29915
  }
29725
29916
  });
29726
29917
 
29727
29918
  // libs/sdk/src/app/instances/app.local.instance.ts
29728
- var import_utils58, AppLocalInstance;
29919
+ var import_utils60, AppLocalInstance;
29729
29920
  var init_app_local_instance = __esm({
29730
29921
  "libs/sdk/src/app/instances/app.local.instance.ts"() {
29731
29922
  "use strict";
29732
- import_utils58 = require("@frontmcp/utils");
29923
+ import_utils60 = require("@frontmcp/utils");
29733
29924
  init_adapter_registry();
29734
29925
  init_agent_registry();
29735
29926
  init_common();
@@ -29754,7 +29945,7 @@ var init_app_local_instance = __esm({
29754
29945
  constructor(record, scopeProviders) {
29755
29946
  super(record);
29756
29947
  this.scopeProviders = scopeProviders;
29757
- this.id = this.metadata.id ?? (0, import_utils58.idFromString)(this.metadata.name);
29948
+ this.id = this.metadata.id ?? (0, import_utils60.idFromString)(this.metadata.name);
29758
29949
  try {
29759
29950
  this.logger = scopeProviders.get(FrontMcpLogger)?.child("AppLocalInstance");
29760
29951
  } catch {
@@ -30132,7 +30323,7 @@ var init_request_validation = __esm({
30132
30323
  function getRequestStateKey() {
30133
30324
  if (cachedKey) return cachedKey;
30134
30325
  const secret = process.env["VAULT_SECRET"] ?? process.env["JWT_SECRET"];
30135
- cachedKey = secret ? encoder.encode(secret) : (0, import_utils59.randomBytes)(32);
30326
+ cachedKey = secret ? encoder.encode(secret) : (0, import_utils61.randomBytes)(32);
30136
30327
  return cachedKey;
30137
30328
  }
30138
30329
  function computeRequestBinding(method, params) {
@@ -30140,17 +30331,17 @@ function computeRequestBinding(method, params) {
30140
30331
  for (const key of ["name", "uri", "arguments"]) {
30141
30332
  if (params?.[key] !== void 0) salient[key] = params[key];
30142
30333
  }
30143
- return (0, import_utils59.sha256Hex)(`${method}\0${JSON.stringify(salient)}`);
30334
+ return (0, import_utils61.sha256Hex)(`${method}\0${JSON.stringify(salient)}`);
30144
30335
  }
30145
30336
  function base64urlEncodeJson(value) {
30146
- return (0, import_utils59.base64urlEncode)(encoder.encode(JSON.stringify(value)));
30337
+ return (0, import_utils61.base64urlEncode)(encoder.encode(JSON.stringify(value)));
30147
30338
  }
30148
30339
  function signaturesMatch(a, b) {
30149
30340
  if (a.length !== b.length) return false;
30150
- return (0, import_utils59.timingSafeEqual)(encoder.encode(a), encoder.encode(b));
30341
+ return (0, import_utils61.timingSafeEqual)(encoder.encode(a), encoder.encode(b));
30151
30342
  }
30152
30343
  function sign(body) {
30153
- return (0, import_utils59.base64urlEncode)((0, import_utils59.hmacSha256)(getRequestStateKey(), encoder.encode(body)));
30344
+ return (0, import_utils61.base64urlEncode)((0, import_utils61.hmacSha256)(getRequestStateKey(), encoder.encode(body)));
30154
30345
  }
30155
30346
  function encodeRequestState(responses, binding, ttlMs = DEFAULT_REQUEST_STATE_TTL_MS) {
30156
30347
  const payload = {
@@ -30172,7 +30363,7 @@ function decodeRequestState(state, expected) {
30172
30363
  if (!signaturesMatch(signature, sign(body))) return { ok: false, reason: "bad-signature" };
30173
30364
  let payload;
30174
30365
  try {
30175
- payload = JSON.parse(decoder.decode((0, import_utils59.base64urlDecode)(body)));
30366
+ payload = JSON.parse(decoder.decode((0, import_utils61.base64urlDecode)(body)));
30176
30367
  } catch {
30177
30368
  return { ok: false, reason: "malformed" };
30178
30369
  }
@@ -30184,11 +30375,11 @@ function decodeRequestState(state, expected) {
30184
30375
  if (payload.b !== expected.binding) return { ok: false, reason: "request-mismatch" };
30185
30376
  return { ok: true, responses: payload.r };
30186
30377
  }
30187
- var import_utils59, DEFAULT_REQUEST_STATE_TTL_MS, MAX_REQUEST_STATE_BYTES, cachedKey, encoder, decoder;
30378
+ var import_utils61, DEFAULT_REQUEST_STATE_TTL_MS, MAX_REQUEST_STATE_BYTES, cachedKey, encoder, decoder;
30188
30379
  var init_request_state = __esm({
30189
30380
  "libs/sdk/src/transport/mcp-20260728/request-state.ts"() {
30190
30381
  "use strict";
30191
- import_utils59 = require("@frontmcp/utils");
30382
+ import_utils61 = require("@frontmcp/utils");
30192
30383
  DEFAULT_REQUEST_STATE_TTL_MS = 10 * 60 * 1e3;
30193
30384
  MAX_REQUEST_STATE_BYTES = 256 * 1024;
30194
30385
  encoder = new TextEncoder();
@@ -30722,7 +30913,7 @@ function resolvePrincipal(authInfo) {
30722
30913
  const clientId = authInfo?.["clientId"];
30723
30914
  if (typeof clientId === "string" && clientId.length > 0) return clientId;
30724
30915
  const token = authInfo?.["token"];
30725
- if (typeof token === "string" && token.length > 0) return `tok:${(0, import_utils60.sha256Hex)(token)}`;
30916
+ if (typeof token === "string" && token.length > 0) return `tok:${(0, import_utils62.sha256Hex)(token)}`;
30726
30917
  return "anonymous";
30727
30918
  }
30728
30919
  function resolveTaskPrincipal(authInfo, isAnonymous = false) {
@@ -30930,12 +31121,12 @@ async function dispatch20260728(options) {
30930
31121
  return { kind: "error", status: mapped.status, error: mapped.error };
30931
31122
  }
30932
31123
  }
30933
- var import_protocol45, import_utils60, MRTR_CAPABLE_METHODS;
31124
+ var import_protocol45, import_utils62, MRTR_CAPABLE_METHODS;
30934
31125
  var init_dispatcher = __esm({
30935
31126
  "libs/sdk/src/transport/mcp-20260728/dispatcher.ts"() {
30936
31127
  "use strict";
30937
31128
  import_protocol45 = require("@frontmcp/protocol");
30938
- import_utils60 = require("@frontmcp/utils");
31129
+ import_utils62 = require("@frontmcp/utils");
30939
31130
  init_errors();
30940
31131
  init_build_scoped_server_options();
30941
31132
  init_mcp_handlers();
@@ -33115,11 +33306,11 @@ var init_remote_mcp = __esm({
33115
33306
  });
33116
33307
 
33117
33308
  // libs/sdk/src/app/instances/app.remote.instance.ts
33118
- var import_utils61, EmptyPluginRegistry, EmptyAdapterRegistry, EmptySkillRegistry, AppRemoteInstance;
33309
+ var import_utils63, EmptyPluginRegistry, EmptyAdapterRegistry, EmptySkillRegistry, AppRemoteInstance;
33119
33310
  var init_app_remote_instance = __esm({
33120
33311
  "libs/sdk/src/app/instances/app.remote.instance.ts"() {
33121
33312
  "use strict";
33122
- import_utils61 = require("@frontmcp/utils");
33313
+ import_utils63 = require("@frontmcp/utils");
33123
33314
  init_common();
33124
33315
  init_errors();
33125
33316
  init_prompt_registry();
@@ -33234,7 +33425,7 @@ var init_app_remote_instance = __esm({
33234
33425
  _unsubscribeCapability;
33235
33426
  constructor(record, scopeProviders) {
33236
33427
  super(record);
33237
- this.id = this.metadata.id ?? (0, import_utils61.idFromString)(this.metadata.name);
33428
+ this.id = this.metadata.id ?? (0, import_utils63.idFromString)(this.metadata.name);
33238
33429
  this.scopeProviders = scopeProviders;
33239
33430
  this.appOwner = {
33240
33431
  kind: "app",
@@ -33636,11 +33827,11 @@ function getDefaultCacheDir() {
33636
33827
  return "";
33637
33828
  }
33638
33829
  }
33639
- var import_utils62, DEFAULT_CACHE_DIR, DEFAULT_MAX_AGE_MS, DEFAULT_MAX_ENTRIES, EsmCacheManager;
33830
+ var import_utils64, DEFAULT_CACHE_DIR, DEFAULT_MAX_AGE_MS, DEFAULT_MAX_ENTRIES, EsmCacheManager;
33640
33831
  var init_esm_cache = __esm({
33641
33832
  "libs/sdk/src/esm-loader/esm-cache.ts"() {
33642
33833
  "use strict";
33643
- import_utils62 = require("@frontmcp/utils");
33834
+ import_utils64 = require("@frontmcp/utils");
33644
33835
  DEFAULT_CACHE_DIR = getDefaultCacheDir();
33645
33836
  DEFAULT_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
33646
33837
  DEFAULT_MAX_ENTRIES = 100;
@@ -33704,7 +33895,7 @@ var init_esm_cache = __esm({
33704
33895
  * Store an ESM bundle in the cache.
33705
33896
  */
33706
33897
  async put(packageName, version, bundleContent, packageUrl, etag) {
33707
- if (!(0, import_utils62.isValidMcpUri)(packageUrl)) {
33898
+ if (!(0, import_utils64.isValidMcpUri)(packageUrl)) {
33708
33899
  throw new Error("URI must have a valid scheme (e.g., file://, https://, custom://)");
33709
33900
  }
33710
33901
  const memKey = `${packageName}@${version}`;
@@ -33835,7 +34026,7 @@ var init_esm_cache = __esm({
33835
34026
  */
33836
34027
  getEntryDir(packageName, version) {
33837
34028
  const path3 = require("node:path");
33838
- const hash = (0, import_utils62.sha256Hex)(`${packageName}@${version}`);
34029
+ const hash = (0, import_utils64.sha256Hex)(`${packageName}@${version}`);
33839
34030
  return path3.join(this.cacheDir, hash);
33840
34031
  }
33841
34032
  };
@@ -33886,7 +34077,7 @@ function normalizeResourceFromEsmExport(raw) {
33886
34077
  const obj = raw;
33887
34078
  if (typeof obj["read"] === "function" && typeof obj["name"] === "string" && typeof obj["uri"] === "string") {
33888
34079
  const uri = obj["uri"];
33889
- if (!(0, import_utils63.isValidMcpUri)(uri)) return void 0;
34080
+ if (!(0, import_utils65.isValidMcpUri)(uri)) return void 0;
33890
34081
  const description = obj["description"];
33891
34082
  const mimeType = obj["mimeType"];
33892
34083
  return {
@@ -33914,12 +34105,12 @@ function normalizePromptFromEsmExport(raw) {
33914
34105
  }
33915
34106
  return void 0;
33916
34107
  }
33917
- var import_di28, import_utils63;
34108
+ var import_di28, import_utils65;
33918
34109
  var init_esm_normalize_utils = __esm({
33919
34110
  "libs/sdk/src/app/instances/esm-normalize.utils.ts"() {
33920
34111
  "use strict";
33921
34112
  import_di28 = require("@frontmcp/di");
33922
- import_utils63 = require("@frontmcp/utils");
34113
+ import_utils65 = require("@frontmcp/utils");
33923
34114
  init_tokens();
33924
34115
  }
33925
34116
  });
@@ -34360,13 +34551,13 @@ var init_esm_module_loader = __esm({
34360
34551
  URL.revokeObjectURL(url);
34361
34552
  }
34362
34553
  }
34363
- const { ensureDir, fileExists: fileExists9, sha256Hex: sha256Hex11, writeFile } = await import("@frontmcp/utils");
34554
+ const { ensureDir, fileExists: fileExists9, sha256Hex: sha256Hex12, writeFile } = await import("@frontmcp/utils");
34364
34555
  const nodePath = await import("node:path");
34365
34556
  const nodeOs = await import("node:os");
34366
34557
  const { pathToFileURL } = await import("node:url");
34367
34558
  const dir = nodePath.join(nodeOs.tmpdir(), "frontmcp-esm-modules");
34368
34559
  await ensureDir(dir);
34369
- const tempPath = nodePath.join(dir, `${sha256Hex11(bundleContent)}.mjs`);
34560
+ const tempPath = nodePath.join(dir, `${sha256Hex12(bundleContent)}.mjs`);
34370
34561
  if (!await fileExists9(tempPath)) {
34371
34562
  await writeFile(tempPath, bundleContent);
34372
34563
  }
@@ -34691,11 +34882,11 @@ var init_esm_loader = __esm({
34691
34882
  });
34692
34883
 
34693
34884
  // libs/sdk/src/app/instances/app.esm.instance.ts
34694
- var import_utils64, EmptyPluginRegistry2, EmptyAdapterRegistry2, EmptySkillRegistry2, AppEsmInstance;
34885
+ var import_utils66, EmptyPluginRegistry2, EmptyAdapterRegistry2, EmptySkillRegistry2, AppEsmInstance;
34695
34886
  var init_app_esm_instance = __esm({
34696
34887
  "libs/sdk/src/app/instances/app.esm.instance.ts"() {
34697
34888
  "use strict";
34698
- import_utils64 = require("@frontmcp/utils");
34889
+ import_utils66 = require("@frontmcp/utils");
34699
34890
  init_common();
34700
34891
  init_errors();
34701
34892
  init_esm_loader();
@@ -34810,7 +35001,7 @@ var init_app_esm_instance = __esm({
34810
35001
  _skills;
34811
35002
  constructor(record, scopeProviders) {
34812
35003
  super(record);
34813
- this.id = this.metadata.id ?? (0, import_utils64.idFromString)(this.metadata.name);
35004
+ this.id = this.metadata.id ?? (0, import_utils66.idFromString)(this.metadata.name);
34814
35005
  this.scopeProviders = scopeProviders;
34815
35006
  this.appOwner = {
34816
35007
  kind: "app",
@@ -35158,11 +35349,11 @@ function timingSafeEqualStr(a, b) {
35158
35349
  }
35159
35350
  return diff === 0;
35160
35351
  }
35161
- var import_utils65, ALL_SLOTS, PENDING_UI_TTL_MS, AuthUiRegistry;
35352
+ var import_utils67, ALL_SLOTS, PENDING_UI_TTL_MS, AuthUiRegistry;
35162
35353
  var init_auth_ui_registry = __esm({
35163
35354
  "libs/sdk/src/auth/auth-ui/auth-ui.registry.ts"() {
35164
35355
  "use strict";
35165
- import_utils65 = require("@frontmcp/utils");
35356
+ import_utils67 = require("@frontmcp/utils");
35166
35357
  ALL_SLOTS = ["login", "consent", "incremental", "federated", "error"];
35167
35358
  PENDING_UI_TTL_MS = 10 * 60 * 1e3;
35168
35359
  AuthUiRegistry = class {
@@ -35193,7 +35384,7 @@ var init_auth_ui_registry = __esm({
35193
35384
  throw new Error(`auth.ui slot "${slot}" is not one of: ${ALL_SLOTS.join(", ")}.`);
35194
35385
  }
35195
35386
  if (typeof rawPath !== "string" || rawPath.length === 0) continue;
35196
- const file = (0, import_utils65.isAbsolute)(rawPath) ? rawPath : (0, import_utils65.pathResolve)(sourceDir, rawPath);
35387
+ const file = (0, import_utils67.isAbsolute)(rawPath) ? rawPath : (0, import_utils67.pathResolve)(sourceDir, rawPath);
35197
35388
  this.slots.set(slot, { file });
35198
35389
  this.logger?.verbose(`Registered auth.ui slot "${slot}" \u2192 ${file}`);
35199
35390
  }
@@ -35279,7 +35470,7 @@ var init_auth_ui_registry = __esm({
35279
35470
  mintCsrf(pendingAuthId) {
35280
35471
  const existing = this.pending.get(pendingAuthId);
35281
35472
  if (existing) return existing.csrf;
35282
- const csrf = (0, import_utils65.sha256Hex)((0, import_utils65.randomBytes)(32)).slice(0, 43);
35473
+ const csrf = (0, import_utils67.sha256Hex)((0, import_utils67.randomBytes)(32)).slice(0, 43);
35283
35474
  this.pending.set(pendingAuthId, { csrf, addedItems: {}, createdAt: Date.now() });
35284
35475
  this.pruneExpired();
35285
35476
  return csrf;
@@ -35332,7 +35523,7 @@ var init_auth_ui_registry = __esm({
35332
35523
  ensurePending(pendingAuthId) {
35333
35524
  let state = this.pending.get(pendingAuthId);
35334
35525
  if (!state) {
35335
- state = { csrf: (0, import_utils65.sha256Hex)((0, import_utils65.randomBytes)(32)).slice(0, 43), addedItems: {}, createdAt: Date.now() };
35526
+ state = { csrf: (0, import_utils67.sha256Hex)((0, import_utils67.randomBytes)(32)).slice(0, 43), addedItems: {}, createdAt: Date.now() };
35336
35527
  this.pending.set(pendingAuthId, state);
35337
35528
  this.pruneExpired();
35338
35529
  }
@@ -35671,25 +35862,25 @@ var init_auth_utils = __esm({
35671
35862
  });
35672
35863
 
35673
35864
  // libs/sdk/src/auth/authorization/orchestrated.context-extension.ts
35674
- var import_auth18, orchestratedAuthContextExtension;
35865
+ var import_auth19, orchestratedAuthContextExtension;
35675
35866
  var init_orchestrated_context_extension = __esm({
35676
35867
  "libs/sdk/src/auth/authorization/orchestrated.context-extension.ts"() {
35677
35868
  "use strict";
35678
- import_auth18 = require("@frontmcp/auth");
35869
+ import_auth19 = require("@frontmcp/auth");
35679
35870
  orchestratedAuthContextExtension = {
35680
35871
  property: "orchestration",
35681
- token: import_auth18.ORCHESTRATED_AUTH_ACCESSOR,
35872
+ token: import_auth19.ORCHESTRATED_AUTH_ACCESSOR,
35682
35873
  errorMessage: "Orchestrated authorization not available. Ensure your server is configured with orchestrated mode and the user has completed authentication."
35683
35874
  };
35684
35875
  }
35685
35876
  });
35686
35877
 
35687
35878
  // libs/sdk/src/auth/cimd/index.ts
35688
- var import_auth19;
35879
+ var import_auth20;
35689
35880
  var init_cimd = __esm({
35690
35881
  "libs/sdk/src/auth/cimd/index.ts"() {
35691
35882
  "use strict";
35692
- import_auth19 = require("@frontmcp/auth");
35883
+ import_auth20 = require("@frontmcp/auth");
35693
35884
  }
35694
35885
  });
35695
35886
 
@@ -35711,9 +35902,9 @@ function createCredentialsProviders(opts) {
35711
35902
  name: "SessionCredentialVault"
35712
35903
  };
35713
35904
  const accessorProvider = {
35714
- provide: import_auth20.CREDENTIALS_ACCESSOR,
35905
+ provide: import_auth21.CREDENTIALS_ACCESSOR,
35715
35906
  inject: () => [FRONTMCP_CONTEXT, FrontMcpLogger],
35716
- useFactory: (ctx, logger) => new import_auth20.CredentialsAccessorImpl({
35907
+ useFactory: (ctx, logger) => new import_auth21.CredentialsAccessorImpl({
35717
35908
  vault,
35718
35909
  resolveSub: () => resolveRequestSub(ctx),
35719
35910
  signingSecret,
@@ -35726,11 +35917,11 @@ function createCredentialsProviders(opts) {
35726
35917
  };
35727
35918
  return [vaultProvider, accessorProvider];
35728
35919
  }
35729
- var import_auth20, import_di31, SESSION_CREDENTIAL_VAULT;
35920
+ var import_auth21, import_di31, SESSION_CREDENTIAL_VAULT;
35730
35921
  var init_credentials_providers = __esm({
35731
35922
  "libs/sdk/src/auth/credentials/credentials.providers.ts"() {
35732
35923
  "use strict";
35733
- import_auth20 = require("@frontmcp/auth");
35924
+ import_auth21 = require("@frontmcp/auth");
35734
35925
  import_di31 = require("@frontmcp/di");
35735
35926
  init_common();
35736
35927
  init_frontmcp_context_provider();
@@ -35741,14 +35932,14 @@ var init_credentials_providers = __esm({
35741
35932
  });
35742
35933
 
35743
35934
  // libs/sdk/src/auth/credentials/credentials.context-extension.ts
35744
- var import_auth21, credentialsContextExtension;
35935
+ var import_auth22, credentialsContextExtension;
35745
35936
  var init_credentials_context_extension = __esm({
35746
35937
  "libs/sdk/src/auth/credentials/credentials.context-extension.ts"() {
35747
35938
  "use strict";
35748
- import_auth21 = require("@frontmcp/auth");
35939
+ import_auth22 = require("@frontmcp/auth");
35749
35940
  credentialsContextExtension = {
35750
35941
  property: "credentials",
35751
- token: import_auth21.CREDENTIALS_ACCESSOR,
35942
+ token: import_auth22.CREDENTIALS_ACCESSOR,
35752
35943
  errorMessage: "Per-session credentials are not available. Ensure the server uses auth mode 'local' (or 'remote'); credentials are persisted by a local authenticate() verifier."
35753
35944
  };
35754
35945
  }
@@ -35917,13 +36108,13 @@ function getConfiguredProviders(auth) {
35917
36108
  function getConfiguredProviderIds(auth) {
35918
36109
  return getConfiguredProviders(auth).map((p) => p.id);
35919
36110
  }
35920
- var import_auth22, import_lazy_zod64, import_utils66, pkceChallengeSchema, codeChallengeMethodSchema, responseTypeSchema, safeRedirectUriSchema, oauthAuthorizeRequestSchema, anonymousAuthorizeRequestSchema, inputSchema16, stateSchema15, outputSchema15, plan15, name15, Stage15, OauthAuthorizeFlow;
36111
+ var import_auth23, import_lazy_zod64, import_utils68, pkceChallengeSchema, codeChallengeMethodSchema, responseTypeSchema, safeRedirectUriSchema, oauthAuthorizeRequestSchema, anonymousAuthorizeRequestSchema, inputSchema16, stateSchema15, outputSchema15, plan15, name15, Stage15, OauthAuthorizeFlow;
35921
36112
  var init_oauth_authorize_flow = __esm({
35922
36113
  "libs/sdk/src/auth/flows/oauth.authorize.flow.ts"() {
35923
36114
  "use strict";
35924
- import_auth22 = require("@frontmcp/auth");
36115
+ import_auth23 = require("@frontmcp/auth");
35925
36116
  import_lazy_zod64 = require("@frontmcp/lazy-zod");
35926
- import_utils66 = require("@frontmcp/utils");
36117
+ import_utils68 = require("@frontmcp/utils");
35927
36118
  init_common();
35928
36119
  init_auth_ui();
35929
36120
  init_cimd();
@@ -35999,7 +36190,7 @@ var init_oauth_authorize_flow = __esm({
35999
36190
  requiresConsent: import_lazy_zod64.z.boolean().default(false).describe("Whether consent flow is enabled"),
36000
36191
  // CIMD (Client ID Metadata Documents)
36001
36192
  isCimdClient: import_lazy_zod64.z.boolean().default(false).describe("Whether client_id is a CIMD URL"),
36002
- cimdMetadata: import_auth19.clientMetadataDocumentSchema.optional().describe("CIMD metadata document for the client")
36193
+ cimdMetadata: import_auth20.clientMetadataDocumentSchema.optional().describe("CIMD metadata document for the client")
36003
36194
  });
36004
36195
  outputSchema15 = import_lazy_zod64.z.union([
36005
36196
  HttpRedirectSchema,
@@ -36055,14 +36246,14 @@ var init_oauth_authorize_flow = __esm({
36055
36246
  const existingSessionId = request.query["session_id"];
36056
36247
  const isDefaultAuthProvider = !metadata.auth;
36057
36248
  let requiresFederatedLogin = false;
36058
- if (metadata.auth && (0, import_auth10.isOrchestratedMode)(metadata.auth)) {
36249
+ if (metadata.auth && (0, import_auth11.isOrchestratedMode)(metadata.auth)) {
36059
36250
  const configProviders = getConfiguredProviderIds(metadata.auth);
36060
36251
  const apps = this.scope.apps.getApps();
36061
36252
  const appsWithAuth = apps.filter((app) => app.metadata.auth);
36062
36253
  requiresFederatedLogin = configProviders.length > 0 || appsWithAuth.length > 0;
36063
36254
  }
36064
36255
  let requiresConsent = false;
36065
- if (metadata.auth && (0, import_auth10.isOrchestratedMode)(metadata.auth)) {
36256
+ if (metadata.auth && (0, import_auth11.isOrchestratedMode)(metadata.auth)) {
36066
36257
  const consentConfig = metadata.auth.consent;
36067
36258
  requiresConsent = consentConfig?.enabled === true;
36068
36259
  }
@@ -36150,7 +36341,7 @@ var init_oauth_authorize_flow = __esm({
36150
36341
  }
36151
36342
  }
36152
36343
  const { client_id, redirect_uri } = result.data;
36153
- const cimdService = this.get(import_auth19.CimdService);
36344
+ const cimdService = this.get(import_auth20.CimdService);
36154
36345
  const isCimdClientId2 = !!cimdService?.enabled && cimdService.isCimdClientId(client_id);
36155
36346
  const dcrError = this.checkDcrAllowlist(client_id, redirect_uri, isCimdClientId2);
36156
36347
  if (dcrError) {
@@ -36219,7 +36410,7 @@ var init_oauth_authorize_flow = __esm({
36219
36410
  const localAuth = this.scope.auth;
36220
36411
  const secret = localAuth?.signingSecret;
36221
36412
  if (!secret) return void 0;
36222
- const payload = (0, import_auth22.verifyIncrementalAuthTicket)(token, secret);
36413
+ const payload = (0, import_auth23.verifyIncrementalAuthTicket)(token, secret);
36223
36414
  if (!payload) {
36224
36415
  this.logger.warn("Incremental auth ticket failed verification \u2014 treating as an ordinary login");
36225
36416
  return void 0;
@@ -36252,6 +36443,7 @@ var init_oauth_authorize_flow = __esm({
36252
36443
  const localAuth = auth;
36253
36444
  const store = localAuth.authorizationStore;
36254
36445
  let effectiveIncremental = isIncrementalAuth;
36446
+ let effectivePriorAppIds = priorAuthorizedAppIds;
36255
36447
  if (incrementalTicket) {
36256
36448
  const claimed = await localAuth.claimIncrementalTicket(
36257
36449
  incrementalTicket.jti,
@@ -36260,7 +36452,13 @@ var init_oauth_authorize_flow = __esm({
36260
36452
  if (!claimed) {
36261
36453
  this.logger.warn("Incremental auth ticket already used \u2014 falling back to an ordinary login");
36262
36454
  effectiveIncremental = false;
36263
- this.state.set({ isIncrementalAuth: false, targetAppId: void 0, targetToolId: void 0 });
36455
+ effectivePriorAppIds = void 0;
36456
+ this.state.set({
36457
+ isIncrementalAuth: false,
36458
+ targetAppId: void 0,
36459
+ targetToolId: void 0,
36460
+ priorAuthorizedAppIds: void 0
36461
+ });
36264
36462
  }
36265
36463
  }
36266
36464
  let federatedLogin;
@@ -36272,7 +36470,7 @@ var init_oauth_authorize_flow = __esm({
36272
36470
  providerIds.push(id);
36273
36471
  }
36274
36472
  }
36275
- if (providerIds.length === 0 && metadata.auth && (0, import_auth10.isOrchestratedMode)(metadata.auth)) {
36473
+ if (providerIds.length === 0 && metadata.auth && (0, import_auth11.isOrchestratedMode)(metadata.auth)) {
36276
36474
  providerIds.push("__parent__");
36277
36475
  }
36278
36476
  for (const app of apps) {
@@ -36291,7 +36489,7 @@ var init_oauth_authorize_flow = __esm({
36291
36489
  }
36292
36490
  let consent;
36293
36491
  if (requiresConsent) {
36294
- const consentConfig = metadata.auth && (0, import_auth10.isOrchestratedMode)(metadata.auth) ? metadata.auth.consent : void 0;
36492
+ const consentConfig = metadata.auth && (0, import_auth11.isOrchestratedMode)(metadata.auth) ? metadata.auth.consent : void 0;
36295
36493
  const { availableToolIds } = projectConsentTools(this.scope, consentConfig?.excludedTools);
36296
36494
  consent = {
36297
36495
  enabled: true,
@@ -36319,7 +36517,7 @@ var init_oauth_authorize_flow = __esm({
36319
36517
  targetAppId: effectiveIncremental ? targetAppId : void 0,
36320
36518
  targetToolId: effectiveIncremental ? targetToolId : void 0,
36321
36519
  existingSessionId,
36322
- priorAuthorizedAppIds,
36520
+ priorAuthorizedAppIds: effectivePriorAppIds,
36323
36521
  // Federated Login State
36324
36522
  federatedLogin,
36325
36523
  // Consent State
@@ -36346,7 +36544,7 @@ var init_oauth_authorize_flow = __esm({
36346
36544
  return;
36347
36545
  }
36348
36546
  const { metadata } = this.scope;
36349
- if (metadata.auth && (0, import_auth10.isRemoteMode)(metadata.auth) && !isIncrementalAuth) {
36547
+ if (metadata.auth && (0, import_auth11.isRemoteMode)(metadata.auth) && !isIncrementalAuth) {
36350
36548
  await this.startRemoteFederation(pendingAuthId, validatedRequest);
36351
36549
  return;
36352
36550
  }
@@ -36394,7 +36592,7 @@ var init_oauth_authorize_flow = __esm({
36394
36592
  isParentProvider: false
36395
36593
  });
36396
36594
  }
36397
- if (!hasConfiguredProviders && metadata2.auth && (0, import_auth10.isOrchestratedMode)(metadata2.auth)) {
36595
+ if (!hasConfiguredProviders && metadata2.auth && (0, import_auth11.isOrchestratedMode)(metadata2.auth)) {
36398
36596
  providers.push({
36399
36597
  id: "__parent__",
36400
36598
  mode: metadata2.auth.mode,
@@ -36548,7 +36746,7 @@ var init_oauth_authorize_flow = __esm({
36548
36746
  );
36549
36747
  return;
36550
36748
  }
36551
- const session = (0, import_auth22.createFederatedAuthSession)({
36749
+ const session = (0, import_auth23.createFederatedAuthSession)({
36552
36750
  pendingAuthId,
36553
36751
  clientId: validatedRequest.client_id,
36554
36752
  redirectUri: validatedRequest.redirect_uri,
@@ -36559,11 +36757,11 @@ var init_oauth_authorize_flow = __esm({
36559
36757
  frontmcpPkce: { challenge: validatedRequest.code_challenge, method: "S256" },
36560
36758
  providerIds: [providerId]
36561
36759
  });
36562
- const verifier = (0, import_utils66.generateCodeVerifier)();
36563
- const challenge = (0, import_utils66.sha256Base64url)(verifier);
36760
+ const verifier = (0, import_utils68.generateCodeVerifier)();
36761
+ const challenge = (0, import_utils68.sha256Base64url)(verifier);
36564
36762
  const pkce = { verifier, challenge, method: "S256" };
36565
- const providerState = `federated:${session.id}:${(0, import_utils66.randomUUID)()}`;
36566
- (0, import_auth22.startNextProvider)(session, pkce, providerState);
36763
+ const providerState = `federated:${session.id}:${(0, import_utils68.randomUUID)()}`;
36764
+ (0, import_auth23.startNextProvider)(session, pkce, providerState);
36567
36765
  await localAuth.federatedSessionStore.store(session);
36568
36766
  const redirectUrl = await localAuth.buildProviderAuthorizeUrl(providerId, {
36569
36767
  state: providerState,
@@ -36664,7 +36862,7 @@ var init_oauth_authorize_flow = __esm({
36664
36862
  callbackPath,
36665
36863
  fields: login?.fields ?? {}
36666
36864
  };
36667
- return (0, import_auth22.renderLocalLoginPage)(login, ctx);
36865
+ return (0, import_auth23.renderLocalLoginPage)(login, ctx);
36668
36866
  }
36669
36867
  /**
36670
36868
  * Render incremental authorization page for a single app using HTMX templates
@@ -36677,7 +36875,7 @@ var init_oauth_authorize_flow = __esm({
36677
36875
  appName,
36678
36876
  description: appDescription
36679
36877
  };
36680
- return (0, import_auth22.buildIncrementalAuthPage)({
36878
+ return (0, import_auth23.buildIncrementalAuthPage)({
36681
36879
  app,
36682
36880
  toolId: toolId || "unknown tool",
36683
36881
  sessionHint: pendingAuthId,
@@ -36698,7 +36896,7 @@ var init_oauth_authorize_flow = __esm({
36698
36896
  appIds: provider.appIds.filter((id) => id !== "__parent__"),
36699
36897
  isPrimary: provider.isParentProvider
36700
36898
  }));
36701
- return (0, import_auth22.buildFederatedLoginPage)({
36899
+ return (0, import_auth23.buildFederatedLoginPage)({
36702
36900
  providers,
36703
36901
  clientName: clientId,
36704
36902
  pendingAuthId,
@@ -36743,8 +36941,8 @@ var init_oauth_authorize_flow = __esm({
36743
36941
  <div class="error-container">
36744
36942
  <div class="error-icon">\u26A0\uFE0F</div>
36745
36943
  <h1>Authorization Error</h1>
36746
- <p><span class="error-code">${(0, import_auth22.escapeHtml)(error)}</span></p>
36747
- <p>${(0, import_auth22.escapeHtml)(description)}</p>
36944
+ <p><span class="error-code">${(0, import_auth23.escapeHtml)(error)}</span></p>
36945
+ <p>${(0, import_auth23.escapeHtml)(description)}</p>
36748
36946
  </div>
36749
36947
  </body>
36750
36948
  </html>`;
@@ -36793,13 +36991,13 @@ function timingSafeEqualStr3(a, b) {
36793
36991
  }
36794
36992
  return diff === 0;
36795
36993
  }
36796
- var import_auth23, import_lazy_zod65, import_utils67, inputSchema17, stateSchema16, outputSchema16, plan16, name16, Stage16, OauthCallbackFlow;
36994
+ var import_auth24, import_lazy_zod65, import_utils69, inputSchema17, stateSchema16, outputSchema16, plan16, name16, Stage16, OauthCallbackFlow;
36797
36995
  var init_oauth_callback_flow = __esm({
36798
36996
  "libs/sdk/src/auth/flows/oauth.callback.flow.ts"() {
36799
36997
  "use strict";
36800
- import_auth23 = require("@frontmcp/auth");
36998
+ import_auth24 = require("@frontmcp/auth");
36801
36999
  import_lazy_zod65 = require("@frontmcp/lazy-zod");
36802
- import_utils67 = require("@frontmcp/utils");
37000
+ import_utils69 = require("@frontmcp/utils");
36803
37001
  init_common();
36804
37002
  init_auth_ui();
36805
37003
  init_consent_tools_helper();
@@ -37166,7 +37364,7 @@ var init_oauth_callback_flow = __esm({
37166
37364
  return;
37167
37365
  }
37168
37366
  const authOptions = this.scope.auth?.options;
37169
- if (!authOptions || !(0, import_auth10.isOrchestratedMode)(authOptions)) {
37367
+ if (!authOptions || !(0, import_auth11.isOrchestratedMode)(authOptions)) {
37170
37368
  return;
37171
37369
  }
37172
37370
  const incrementalConfig = authOptions.incrementalAuth;
@@ -37229,8 +37427,8 @@ var init_oauth_callback_flow = __esm({
37229
37427
  this.respond(httpRespond.html(this.renderErrorPage("server_error", "Authorization request incomplete"), 500));
37230
37428
  return;
37231
37429
  }
37232
- const federatedSession = (0, import_auth23.createFederatedAuthSession)({
37233
- pendingAuthId: this.state.required.pendingAuthId || (0, import_utils67.randomUUID)(),
37430
+ const federatedSession = (0, import_auth24.createFederatedAuthSession)({
37431
+ pendingAuthId: this.state.required.pendingAuthId || (0, import_utils69.randomUUID)(),
37234
37432
  clientId,
37235
37433
  redirectUri,
37236
37434
  scopes: scopes ?? [],
@@ -37250,15 +37448,15 @@ var init_oauth_callback_flow = __esm({
37250
37448
  await sessionStore.store(federatedSession);
37251
37449
  this.logger.info(`Created federated session: ${federatedSession.id}`);
37252
37450
  const firstProviderId = selectedProviders[0];
37253
- const verifier = (0, import_utils67.generateCodeVerifier)();
37254
- const challenge = (0, import_utils67.sha256Base64url)(verifier);
37451
+ const verifier = (0, import_utils69.generateCodeVerifier)();
37452
+ const challenge = (0, import_utils69.sha256Base64url)(verifier);
37255
37453
  const pkce = {
37256
37454
  verifier,
37257
37455
  challenge,
37258
37456
  method: "S256"
37259
37457
  };
37260
- const providerState = `federated:${federatedSession.id}:${(0, import_utils67.randomUUID)()}`;
37261
- (0, import_auth23.startNextProvider)(federatedSession, pkce, providerState);
37458
+ const providerState = `federated:${federatedSession.id}:${(0, import_utils69.randomUUID)()}`;
37459
+ (0, import_auth24.startNextProvider)(federatedSession, pkce, providerState);
37262
37460
  await sessionStore.update(federatedSession);
37263
37461
  const providerConfig = localAuth.getProviderConfig(firstProviderId);
37264
37462
  if (!providerConfig) {
@@ -37562,7 +37760,7 @@ var init_oauth_callback_flow = __esm({
37562
37760
  fields: login?.fields ?? {},
37563
37761
  error: failure.message
37564
37762
  };
37565
- return (0, import_auth23.renderLocalLoginPage)(login, ctx, fields);
37763
+ return (0, import_auth24.renderLocalLoginPage)(login, ctx, fields);
37566
37764
  }
37567
37765
  /**
37568
37766
  * Render a custom `@AuthUi({ slot: 'consent' })` page when one is registered.
@@ -37658,7 +37856,7 @@ var init_oauth_callback_flow = __esm({
37658
37856
  if (pendingAuth.authUiCsrf) {
37659
37857
  hiddenFields.push({ name: "csrf", value: pendingAuth.authUiCsrf });
37660
37858
  }
37661
- return (0, import_auth23.buildToolConsentPage)({
37859
+ return (0, import_auth24.buildToolConsentPage)({
37662
37860
  tools: toolCards,
37663
37861
  clientName: pendingAuth.clientId,
37664
37862
  pendingAuthId: pendingAuth.id,
@@ -37684,15 +37882,15 @@ var init_oauth_callback_flow = __esm({
37684
37882
  * In production, this would be the user's ID from the database
37685
37883
  */
37686
37884
  generateUserSub(email) {
37687
- const hash = (0, import_utils67.sha256Hex)(email.toLowerCase());
37885
+ const hash = (0, import_utils69.sha256Hex)(email.toLowerCase());
37688
37886
  return `${hash.slice(0, 8)}-${hash.slice(8, 12)}-${hash.slice(12, 16)}-${hash.slice(16, 20)}-${hash.slice(20, 32)}`;
37689
37887
  }
37690
37888
  /**
37691
37889
  * Render an error page
37692
37890
  */
37693
37891
  renderErrorPage(error, description) {
37694
- const safeError = (0, import_auth23.escapeHtml)(error);
37695
- const safeDescription = (0, import_auth23.escapeHtml)(description);
37892
+ const safeError = (0, import_auth24.escapeHtml)(error);
37893
+ const safeDescription = (0, import_auth24.escapeHtml)(description);
37696
37894
  return `<!DOCTYPE html>
37697
37895
  <html lang="en">
37698
37896
  <head>
@@ -37803,11 +38001,11 @@ var init_oauth_callback_flow = __esm({
37803
38001
  });
37804
38002
 
37805
38003
  // libs/sdk/src/auth/flows/oauth.connect.flow.ts
37806
- var import_auth24, import_lazy_zod66, inputSchema18, stateSchema17, outputSchema17, plan17, name17, Stage17, RESERVED_CONNECT_PARAMS, OauthConnectFlow;
38004
+ var import_auth25, import_lazy_zod66, inputSchema18, stateSchema17, outputSchema17, plan17, name17, Stage17, RESERVED_CONNECT_PARAMS, OauthConnectFlow;
37807
38005
  var init_oauth_connect_flow = __esm({
37808
38006
  "libs/sdk/src/auth/flows/oauth.connect.flow.ts"() {
37809
38007
  "use strict";
37810
- import_auth24 = require("@frontmcp/auth");
38008
+ import_auth25 = require("@frontmcp/auth");
37811
38009
  import_lazy_zod66 = require("@frontmcp/lazy-zod");
37812
38010
  init_common();
37813
38011
  inputSchema18 = httpInputSchema;
@@ -37917,7 +38115,7 @@ var init_oauth_connect_flow = __esm({
37917
38115
  }
37918
38116
  this.logger.info(`Connected ${stored} credential(s) mid-session for key "${payload.key}"`);
37919
38117
  this.notifyResourcesUpdated(payload.key);
37920
- this.respond(httpRespond.html((0, import_auth24.buildConnectSuccessPage)({ key: payload.key })));
38118
+ this.respond(httpRespond.html((0, import_auth25.buildConnectSuccessPage)({ key: payload.key })));
37921
38119
  }
37922
38120
  // ============================================
37923
38121
  // Helpers
@@ -37925,7 +38123,7 @@ var init_oauth_connect_flow = __esm({
37925
38123
  /** Verify the signed resume token against the server secret (constant-time + expiry). */
37926
38124
  verifyToken(token, localAuth) {
37927
38125
  const secret = new TextDecoder().decode(localAuth.secret);
37928
- return (0, import_auth24.verifyCredentialResumeToken)(token, secret);
38126
+ return (0, import_auth25.verifyCredentialResumeToken)(token, secret);
37929
38127
  }
37930
38128
  /** Resolve the single credential field to render from `login.fields` (first field), or a default. */
37931
38129
  resolveConnectField(login, key) {
@@ -37941,8 +38139,8 @@ var init_oauth_connect_flow = __esm({
37941
38139
  renderConnectPage(payload, login, token, error) {
37942
38140
  const { name: name42, def } = this.resolveConnectField(login, payload.key);
37943
38141
  const action = `${this.scope.fullPath}/oauth/connect`;
37944
- const [field] = (0, import_auth24.toLoginExtraFields)({ [name42]: def });
37945
- return (0, import_auth24.buildConnectPage)({
38142
+ const [field] = (0, import_auth25.toLoginExtraFields)({ [name42]: def });
38143
+ return (0, import_auth25.buildConnectPage)({
37946
38144
  token,
37947
38145
  field,
37948
38146
  action,
@@ -38041,8 +38239,8 @@ var init_oauth_connect_flow = __esm({
38041
38239
  return `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Connect Error</title></head>
38042
38240
  <body style="font-family:-apple-system,sans-serif;padding:40px;text-align:center">
38043
38241
  <h1 style="color:#e53e3e">Connect Error</h1>
38044
- <p><code>${(0, import_auth24.escapeHtml)(error)}</code></p>
38045
- <p>${(0, import_auth24.escapeHtml)(description)}</p>
38242
+ <p><code>${(0, import_auth25.escapeHtml)(error)}</code></p>
38243
+ <p>${(0, import_auth25.escapeHtml)(description)}</p>
38046
38244
  </body></html>`;
38047
38245
  }
38048
38246
  };
@@ -38069,13 +38267,13 @@ var init_oauth_connect_flow = __esm({
38069
38267
  });
38070
38268
 
38071
38269
  // libs/sdk/src/auth/flows/oauth.provider-callback.flow.ts
38072
- var import_auth25, import_lazy_zod67, import_utils68, inputSchema19, stateSchema18, outputSchema18, plan18, name18, Stage18, OauthProviderCallbackFlow;
38270
+ var import_auth26, import_lazy_zod67, import_utils70, inputSchema19, stateSchema18, outputSchema18, plan18, name18, Stage18, OauthProviderCallbackFlow;
38073
38271
  var init_oauth_provider_callback_flow = __esm({
38074
38272
  "libs/sdk/src/auth/flows/oauth.provider-callback.flow.ts"() {
38075
38273
  "use strict";
38076
- import_auth25 = require("@frontmcp/auth");
38274
+ import_auth26 = require("@frontmcp/auth");
38077
38275
  import_lazy_zod67 = require("@frontmcp/lazy-zod");
38078
- import_utils68 = require("@frontmcp/utils");
38276
+ import_utils70 = require("@frontmcp/utils");
38079
38277
  init_common();
38080
38278
  init_errors();
38081
38279
  init_consent_tools_helper();
@@ -38176,7 +38374,7 @@ var init_oauth_provider_callback_flow = __esm({
38176
38374
  );
38177
38375
  return;
38178
38376
  }
38179
- if (!(0, import_auth25.isSessionComplete)(session)) {
38377
+ if (!(0, import_auth26.isSessionComplete)(session)) {
38180
38378
  this.respond(
38181
38379
  httpRespond.html(this.renderErrorPage("invalid_request", "Authentication is still in progress."), 400)
38182
38380
  );
@@ -38375,7 +38573,7 @@ var init_oauth_provider_callback_flow = __esm({
38375
38573
  this.logger.info(`Stored tokens for provider ${providerId} (temp auth: ${tempAuthId})`);
38376
38574
  }
38377
38575
  if (tokens) {
38378
- (0, import_auth25.completeCurrentProvider)(session, tokens, userInfo);
38576
+ (0, import_auth26.completeCurrentProvider)(session, tokens, userInfo);
38379
38577
  if (userInfo) {
38380
38578
  if (!session.userInfo.sub && userInfo.sub) {
38381
38579
  session.userInfo.sub = userInfo.sub;
@@ -38408,23 +38606,23 @@ var init_oauth_provider_callback_flow = __esm({
38408
38606
  return;
38409
38607
  }
38410
38608
  const localAuth = this.getLocalAuth();
38411
- if ((0, import_auth25.isSessionComplete)(session)) {
38609
+ if ((0, import_auth26.isSessionComplete)(session)) {
38412
38610
  this.logger.info("All providers authenticated, completing federated auth flow");
38413
38611
  return this.completeFederatedAuth(session);
38414
38612
  }
38415
- const nextProviderId = (0, import_auth25.getNextProvider)(session);
38613
+ const nextProviderId = (0, import_auth26.getNextProvider)(session);
38416
38614
  if (!nextProviderId) {
38417
38615
  return this.completeFederatedAuth(session);
38418
38616
  }
38419
- const verifier = (0, import_utils68.generateCodeVerifier)();
38420
- const challenge = (0, import_utils68.sha256Base64url)(verifier);
38617
+ const verifier = (0, import_utils70.generateCodeVerifier)();
38618
+ const challenge = (0, import_utils70.sha256Base64url)(verifier);
38421
38619
  const pkce = {
38422
38620
  verifier,
38423
38621
  challenge,
38424
38622
  method: "S256"
38425
38623
  };
38426
- const providerState = `federated:${session.id}:${(0, import_utils68.randomUUID)()}`;
38427
- (0, import_auth25.startNextProvider)(session, pkce, providerState);
38624
+ const providerState = `federated:${session.id}:${(0, import_utils70.randomUUID)()}`;
38625
+ (0, import_auth26.startNextProvider)(session, pkce, providerState);
38428
38626
  const sessionStore = localAuth.federatedSessionStore;
38429
38627
  if (sessionStore) {
38430
38628
  await sessionStore.update(session);
@@ -38464,7 +38662,7 @@ var init_oauth_provider_callback_flow = __esm({
38464
38662
  const selectedProviderIds = Array.from(session.completedProviders.keys());
38465
38663
  const skippedProviderIds = session.skippedProviders;
38466
38664
  const metadataAuth = this.scope.metadata.auth;
38467
- const consentConfig = metadataAuth && (0, import_auth10.isOrchestratedMode)(metadataAuth) ? metadataAuth.consent : void 0;
38665
+ const consentConfig = metadataAuth && (0, import_auth11.isOrchestratedMode)(metadataAuth) ? metadataAuth.consent : void 0;
38468
38666
  const consentEnabled = consentConfig?.enabled === true;
38469
38667
  const rememberConsent = consentConfig?.rememberConsent ?? true;
38470
38668
  const consentUserSub = session.userInfo.sub || (session.userInfo.email ? this.generateUserSub(session.userInfo.email) : void 0);
@@ -38587,7 +38785,7 @@ var init_oauth_provider_callback_flow = __esm({
38587
38785
  renderConsentScreen(session, consentConfig, error, preSelectedTools) {
38588
38786
  const callbackPath = `${this.scope.fullPath}/oauth/provider/_consent/callback`;
38589
38787
  const { toolCards } = projectConsentTools(this.scope, consentConfig.excludedTools);
38590
- return (0, import_auth25.buildToolConsentPage)({
38788
+ return (0, import_auth26.buildToolConsentPage)({
38591
38789
  tools: toolCards,
38592
38790
  clientName: session.clientId,
38593
38791
  // The pending_auth_id input is unused on the federated round-trip (we key
@@ -38615,17 +38813,17 @@ var init_oauth_provider_callback_flow = __esm({
38615
38813
  */
38616
38814
  generateUserSub(email) {
38617
38815
  if (!email) {
38618
- return `anon:${(0, import_utils68.randomUUID)()}`;
38816
+ return `anon:${(0, import_utils70.randomUUID)()}`;
38619
38817
  }
38620
- const hash = (0, import_utils68.sha256Base64url)(email.toLowerCase());
38818
+ const hash = (0, import_utils70.sha256Base64url)(email.toLowerCase());
38621
38819
  return `user:${hash.substring(0, 16)}`;
38622
38820
  }
38623
38821
  /**
38624
38822
  * Render an error page
38625
38823
  */
38626
38824
  renderErrorPage(error, description) {
38627
- const safeError = (0, import_auth25.escapeHtml)(error);
38628
- const safeDescription = (0, import_auth25.escapeHtml)(description);
38825
+ const safeError = (0, import_auth26.escapeHtml)(error);
38826
+ const safeDescription = (0, import_auth26.escapeHtml)(description);
38629
38827
  return `<!DOCTYPE html>
38630
38828
  <html lang="en">
38631
38829
  <head>
@@ -38676,7 +38874,7 @@ var init_oauth_provider_callback_flow = __esm({
38676
38874
  }
38677
38875
  getStateValidation() {
38678
38876
  const authOptions = this.scope.auth?.options;
38679
- if (authOptions && (0, import_auth10.isOrchestratedMode)(authOptions)) {
38877
+ if (authOptions && (0, import_auth11.isOrchestratedMode)(authOptions)) {
38680
38878
  return authOptions.federatedAuth?.stateValidation ?? "strict";
38681
38879
  }
38682
38880
  return "strict";
@@ -38744,12 +38942,12 @@ function isLoopbackRedirectUri(uri) {
38744
38942
  }
38745
38943
  return false;
38746
38944
  }
38747
- var import_lazy_zod68, import_utils69, inputSchema20, outputSchema19, registrationRequestSchema, stateSchema19, plan19, name19, Stage19, OauthRegisterFlow;
38945
+ var import_lazy_zod68, import_utils71, inputSchema20, outputSchema19, registrationRequestSchema, stateSchema19, plan19, name19, Stage19, OauthRegisterFlow;
38748
38946
  var init_oauth_register_flow = __esm({
38749
38947
  "libs/sdk/src/auth/flows/oauth.register.flow.ts"() {
38750
38948
  "use strict";
38751
38949
  import_lazy_zod68 = require("@frontmcp/lazy-zod");
38752
- import_utils69 = require("@frontmcp/utils");
38950
+ import_utils71 = require("@frontmcp/utils");
38753
38951
  init_common();
38754
38952
  inputSchema20 = httpInputSchema;
38755
38953
  outputSchema19 = HttpJsonSchema;
@@ -38913,10 +39111,10 @@ var init_oauth_register_flow = __esm({
38913
39111
  async registerClient() {
38914
39112
  const now = Math.floor(Date.now() / 1e3);
38915
39113
  const { token_endpoint_auth_method, grant_types, response_types, redirect_uris, client_name, scope } = this.state.required.body;
38916
- const client_id = (0, import_utils69.randomUUID)();
39114
+ const client_id = (0, import_utils71.randomUUID)();
38917
39115
  let client_secret;
38918
39116
  if (token_endpoint_auth_method === "client_secret_post" || token_endpoint_auth_method === "client_secret_basic") {
38919
- client_secret = (0, import_utils69.base64urlEncode)((0, import_utils69.randomBytes)(24));
39117
+ client_secret = (0, import_utils71.base64urlEncode)((0, import_utils71.randomBytes)(24));
38920
39118
  }
38921
39119
  this.registered = {
38922
39120
  client_id,
@@ -39056,12 +39254,12 @@ function parseRawTokenBody(raw) {
39056
39254
  }
39057
39255
  return {};
39058
39256
  }
39059
- var import_lazy_zod69, import_utils70, inputSchema21, pkceVerifierRegex, authorizationCodeGrant, refreshTokenGrant, anonymousGrant, tokenRequestSchema, stateSchema20, outputSchema20, plan20, name20, Stage20, OauthTokenFlow;
39257
+ var import_lazy_zod69, import_utils72, inputSchema21, pkceVerifierRegex, authorizationCodeGrant, refreshTokenGrant, anonymousGrant, tokenRequestSchema, stateSchema20, outputSchema20, plan20, name20, Stage20, OauthTokenFlow;
39060
39258
  var init_oauth_token_flow = __esm({
39061
39259
  "libs/sdk/src/auth/flows/oauth.token.flow.ts"() {
39062
39260
  "use strict";
39063
39261
  import_lazy_zod69 = require("@frontmcp/lazy-zod");
39064
- import_utils70 = require("@frontmcp/utils");
39262
+ import_utils72 = require("@frontmcp/utils");
39065
39263
  init_common();
39066
39264
  inputSchema21 = httpInputSchema;
39067
39265
  pkceVerifierRegex = /^[A-Za-z0-9_.~-]{43,128}$/;
@@ -39176,14 +39374,14 @@ var init_oauth_token_flow = __esm({
39176
39374
  const { body, isDefaultAuthProvider } = this.state.required;
39177
39375
  if (body?.grant_type !== "authorization_code") return;
39178
39376
  const authOptions = this.scope.auth?.options;
39179
- if (isDefaultAuthProvider && body.code === "anonymous" && !!authOptions && (0, import_auth10.allowsPublicAccess)(authOptions)) {
39377
+ if (isDefaultAuthProvider && body.code === "anonymous" && !!authOptions && (0, import_auth11.allowsPublicAccess)(authOptions)) {
39180
39378
  const localAuth2 = this.scope.auth;
39181
39379
  const accessToken = await localAuth2.signAnonymousJwt();
39182
39380
  this.state.set("tokenResponse", {
39183
39381
  access_token: accessToken,
39184
39382
  token_type: "Bearer",
39185
39383
  expires_in: 86400,
39186
- refresh_token: (0, import_utils70.randomUUID)()
39384
+ refresh_token: (0, import_utils72.randomUUID)()
39187
39385
  });
39188
39386
  return;
39189
39387
  }
@@ -39221,7 +39419,7 @@ var init_oauth_token_flow = __esm({
39221
39419
  if (body?.grant_type !== "refresh_token") return;
39222
39420
  if (isDefaultAuthProvider) {
39223
39421
  const authOptions = this.scope.auth?.options;
39224
- if (!authOptions || !(0, import_auth10.allowsPublicAccess)(authOptions)) {
39422
+ if (!authOptions || !(0, import_auth11.allowsPublicAccess)(authOptions)) {
39225
39423
  this.respond(
39226
39424
  httpRespond.json(
39227
39425
  { error: "invalid_grant", error_description: "Refresh requires re-authentication on this server" },
@@ -39236,7 +39434,7 @@ var init_oauth_token_flow = __esm({
39236
39434
  access_token: accessToken,
39237
39435
  token_type: "Bearer",
39238
39436
  expires_in: 86400,
39239
- refresh_token: (0, import_utils70.randomUUID)()
39437
+ refresh_token: (0, import_utils72.randomUUID)()
39240
39438
  });
39241
39439
  return;
39242
39440
  }
@@ -39266,7 +39464,7 @@ var init_oauth_token_flow = __esm({
39266
39464
  async handleAnonymousGrant() {
39267
39465
  const { body } = this.state.required;
39268
39466
  const authOptions = this.scope.auth?.options;
39269
- if (!authOptions || !(0, import_auth10.allowsPublicAccess)(authOptions)) {
39467
+ if (!authOptions || !(0, import_auth11.allowsPublicAccess)(authOptions)) {
39270
39468
  this.respond(
39271
39469
  httpRespond.json(
39272
39470
  {
@@ -39301,7 +39499,7 @@ var init_oauth_token_flow = __esm({
39301
39499
  access_token: accessToken,
39302
39500
  token_type: "Bearer",
39303
39501
  expires_in: 86400,
39304
- refresh_token: (0, import_utils70.randomUUID)()
39502
+ refresh_token: (0, import_utils72.randomUUID)()
39305
39503
  });
39306
39504
  }
39307
39505
  async buildTokenResponse() {
@@ -39368,12 +39566,12 @@ var init_oauth_token_flow = __esm({
39368
39566
  });
39369
39567
 
39370
39568
  // libs/sdk/src/auth/flows/oauth.userinfo.flow.ts
39371
- var import_reflect_metadata16, import_auth26, import_lazy_zod70, inputSchema22, stateSchema21, outputSchema21, plan21, name21, Stage21, OauthUserInfoFlow;
39569
+ var import_reflect_metadata16, import_auth27, import_lazy_zod70, inputSchema22, stateSchema21, outputSchema21, plan21, name21, Stage21, OauthUserInfoFlow;
39372
39570
  var init_oauth_userinfo_flow = __esm({
39373
39571
  "libs/sdk/src/auth/flows/oauth.userinfo.flow.ts"() {
39374
39572
  "use strict";
39375
39573
  import_reflect_metadata16 = require("reflect-metadata");
39376
- import_auth26 = require("@frontmcp/auth");
39574
+ import_auth27 = require("@frontmcp/auth");
39377
39575
  import_lazy_zod70 = require("@frontmcp/lazy-zod");
39378
39576
  init_common();
39379
39577
  inputSchema22 = httpInputSchema;
@@ -39393,7 +39591,7 @@ var init_oauth_userinfo_flow = __esm({
39393
39591
  async parseInput() {
39394
39592
  const { request } = this.rawInput;
39395
39593
  const authorizationHeader = request.headers?.["authorization"] ?? void 0;
39396
- const token = (0, import_auth26.extractBearerToken)(authorizationHeader);
39594
+ const token = (0, import_auth27.extractBearerToken)(authorizationHeader);
39397
39595
  const baseUrl = getRequestBaseUrl(request, this.scope.entryPath);
39398
39596
  this.state.set({ token, baseUrl });
39399
39597
  }
@@ -39464,15 +39662,31 @@ var init_oauth_userinfo_flow = __esm({
39464
39662
  });
39465
39663
 
39466
39664
  // libs/sdk/src/auth/flows/session.verify.flow.ts
39467
- var import_reflect_metadata17, import_auth27, import_lazy_zod71, import_utils71, inputSchema23, stateSchema22, UnauthorizedSchema, AuthorizedSchema, ForbiddenSchema, sessionVerifyOutputSchema, plan22, name22, Stage22, warnedUnpinnedAudience, SessionVerifyFlow;
39665
+ function constantTimeEquals(a, b) {
39666
+ const encoder5 = new TextEncoder();
39667
+ return (0, import_utils73.timingSafeEqual)((0, import_utils73.sha256)(encoder5.encode(a)), (0, import_utils73.sha256)(encoder5.encode(b)));
39668
+ }
39669
+ function quoteHeaderParam(value) {
39670
+ return value.replace(/[^\x20-\x21\x23-\x7e]/g, "");
39671
+ }
39672
+ function buildStaticChallenge(options, description) {
39673
+ const scheme = options.scheme.trim();
39674
+ if (!scheme) return "";
39675
+ const parts = [`${quoteHeaderParam(scheme)} realm="${quoteHeaderParam(options.realm)}"`];
39676
+ if (description) {
39677
+ parts.push('error="invalid_token"', `error_description="${quoteHeaderParam(description)}"`);
39678
+ }
39679
+ return parts.join(", ");
39680
+ }
39681
+ var import_reflect_metadata17, import_auth28, import_lazy_zod71, import_utils73, inputSchema23, stateSchema22, UnauthorizedSchema, AuthorizedSchema, ForbiddenSchema, sessionVerifyOutputSchema, plan22, name22, Stage22, warnedUnpinnedAudience, SessionVerifyFlow;
39468
39682
  var init_session_verify_flow = __esm({
39469
39683
  "libs/sdk/src/auth/flows/session.verify.flow.ts"() {
39470
39684
  "use strict";
39471
39685
  init_common();
39472
39686
  import_reflect_metadata17 = require("reflect-metadata");
39473
- import_auth27 = require("@frontmcp/auth");
39687
+ import_auth28 = require("@frontmcp/auth");
39474
39688
  import_lazy_zod71 = require("@frontmcp/lazy-zod");
39475
- import_utils71 = require("@frontmcp/utils");
39689
+ import_utils73 = require("@frontmcp/utils");
39476
39690
  init_notification_service();
39477
39691
  init_session_id_utils();
39478
39692
  inputSchema23 = httpRequestInputSchema;
@@ -39508,7 +39722,14 @@ var init_session_verify_flow = __esm({
39508
39722
  }).describe("403 Forbidden \u2014 token valid but insufficient scope");
39509
39723
  sessionVerifyOutputSchema = import_lazy_zod71.z.union([UnauthorizedSchema, AuthorizedSchema, ForbiddenSchema]);
39510
39724
  plan22 = {
39511
- pre: ["parseInput", "handlePublicMode", "handleAnonymousFallback", "requireAuthorizationHeader", "verifyIfJwt"],
39725
+ pre: [
39726
+ "parseInput",
39727
+ "handleStaticToken",
39728
+ "handlePublicMode",
39729
+ "handleAnonymousFallback",
39730
+ "requireAuthorizationHeader",
39731
+ "verifyIfJwt"
39732
+ ],
39512
39733
  execute: ["deriveUser", "parseSessionHeader", "buildAuthorizedOutput"]
39513
39734
  };
39514
39735
  name22 = "session:verify";
@@ -39526,14 +39747,20 @@ var init_session_verify_flow = __esm({
39526
39747
  * Encapsulates the shared logic for session creation, payload encryption, and user derivation.
39527
39748
  */
39528
39749
  createAnonymousSession(options) {
39529
- const { authMode, issuer, scopes = ["anonymous"], sessionIdHeader } = options;
39750
+ const { authMode, issuer, scopes = ["anonymous"], subject, sessionIdHeader } = options;
39530
39751
  this.logger.verbose("createAnonymousSession", { authMode, hasExistingSession: !!sessionIdHeader });
39531
- const machineId = (0, import_utils71.getMachineId)();
39752
+ const machineId = (0, import_utils73.getMachineId)();
39753
+ const authSignature = subject ? `${authMode}:${subject}` : authMode;
39532
39754
  if (sessionIdHeader) {
39533
- const existingPayload = decryptPublicSession(sessionIdHeader);
39755
+ const existingPayload = decryptPublicSession(sessionIdHeader, authSignature);
39534
39756
  if (existingPayload && existingPayload.nodeId === machineId) {
39535
39757
  const anonId = existingPayload.uuid ?? `${existingPayload.iat * 1e3}`;
39536
- const user2 = { sub: `anon:${anonId}`, iss: issuer, name: "Anonymous", scope: scopes.join(" ") };
39758
+ const user2 = {
39759
+ sub: subject ?? `anon:${anonId}`,
39760
+ iss: issuer,
39761
+ name: subject ? "Static token" : "Anonymous",
39762
+ scope: scopes.join(" ")
39763
+ };
39537
39764
  this.respond({
39538
39765
  kind: "authorized",
39539
39766
  authorization: {
@@ -39548,24 +39775,24 @@ var init_session_verify_flow = __esm({
39548
39775
  }
39549
39776
  const now = Date.now();
39550
39777
  const user = {
39551
- sub: `anon:${(0, import_utils71.randomUUID)()}`,
39778
+ sub: subject ?? `anon:${(0, import_utils73.randomUUID)()}`,
39552
39779
  iss: issuer,
39553
- name: "Anonymous",
39780
+ name: subject ? "Static token" : "Anonymous",
39554
39781
  scope: scopes.join(" ")
39555
39782
  };
39556
- const uuid = (0, import_utils71.randomUUID)();
39783
+ const uuid = (0, import_utils73.randomUUID)();
39557
39784
  const platformDetectionConfig = this.scope.metadata.transport?.platformDetection;
39558
39785
  const platformType = detectPlatformFromUserAgent(this.state.userAgent, platformDetectionConfig);
39559
39786
  const payload = {
39560
39787
  uuid,
39561
39788
  nodeId: machineId,
39562
- authSig: authMode,
39789
+ authSig: authSignature,
39563
39790
  iat: Math.floor(now / 1e3),
39564
39791
  isPublic: authMode === "public",
39565
39792
  authMode,
39566
39793
  ...platformType !== "unknown" && { platformType }
39567
39794
  };
39568
- const sessionId = (0, import_auth27.encryptJson)(payload);
39795
+ const sessionId = (0, import_auth28.encryptJson)(payload);
39569
39796
  this.respond({
39570
39797
  kind: "authorized",
39571
39798
  authorization: {
@@ -39586,11 +39813,11 @@ var init_session_verify_flow = __esm({
39586
39813
  const sessionIdQuery = request.query["sessionId"];
39587
39814
  const sessionIdHeader = sessionIdRawHeader ?? sessionIdQuery ?? void 0;
39588
39815
  const sessionProtocol = httpTransportHeader ? "http" : sessionIdRawHeader ? "streamable-http" : sessionIdQuery ? "sse" : void 0;
39589
- const token = (0, import_auth27.extractBearerToken)(authorizationHeader);
39816
+ const token = (0, import_auth28.extractBearerToken)(authorizationHeader);
39590
39817
  const userAgent = request.headers?.["user-agent"] ?? void 0;
39591
39818
  const prmMetadataPath = `/.well-known/oauth-protected-resource${entryPath}${routeBase}`;
39592
39819
  const prmUrl = `${getRequestBaseUrl(request)}${prmMetadataPath}`;
39593
- const prmMetadataHeader = (0, import_auth27.buildUnauthorizedHeader)(prmUrl);
39820
+ const prmMetadataHeader = (0, import_auth28.buildUnauthorizedHeader)(prmUrl);
39594
39821
  this.logger.verbose("parseInput", {
39595
39822
  hasAuthHeader: !!authorizationHeader,
39596
39823
  hasToken: !!token,
@@ -39609,14 +39836,68 @@ var init_session_verify_flow = __esm({
39609
39836
  prmUrl
39610
39837
  });
39611
39838
  }
39839
+ async handleStaticToken() {
39840
+ const authOptions = this.scope.auth?.options;
39841
+ if (!authOptions || !(0, import_auth11.isStaticMode)(authOptions)) return;
39842
+ const options = authOptions;
39843
+ const presented = this.readStaticCredential(options);
39844
+ if (!presented) {
39845
+ this.logger.warn("handleStaticToken: no credential presented, returning 401");
39846
+ this.respond({
39847
+ kind: "unauthorized",
39848
+ prmMetadataHeader: buildStaticChallenge(options)
39849
+ });
39850
+ return;
39851
+ }
39852
+ const matched = options.tokens.reduce(
39853
+ (found, candidate) => constantTimeEquals(candidate, presented) ? candidate : found,
39854
+ void 0
39855
+ );
39856
+ if (!matched) {
39857
+ this.logger.warn("handleStaticToken: credential did not match, returning 401");
39858
+ this.respond({
39859
+ kind: "unauthorized",
39860
+ prmMetadataHeader: buildStaticChallenge(options, "The access token is invalid")
39861
+ });
39862
+ return;
39863
+ }
39864
+ this.logger.verbose("handleStaticToken: credential accepted");
39865
+ this.createAnonymousSession({
39866
+ authMode: "static",
39867
+ issuer: "static",
39868
+ scopes: options.scopes,
39869
+ subject: `static:${(0, import_utils73.sha256Hex)(matched).slice(0, 12)}`,
39870
+ sessionIdHeader: this.state.sessionIdHeader
39871
+ });
39872
+ }
39873
+ /**
39874
+ * Pull the credential out of the configured header, stripping the scheme
39875
+ * prefix when one is configured (case-insensitively, per RFC 7235).
39876
+ */
39877
+ readStaticCredential(options) {
39878
+ const headers = this.rawInput.request.headers ?? {};
39879
+ const raw = headers[options.header.toLowerCase()];
39880
+ const value = (Array.isArray(raw) ? raw[0] : raw)?.trim();
39881
+ if (!value) return void 0;
39882
+ const { scheme } = options;
39883
+ if (!scheme) return value;
39884
+ if (value.slice(0, scheme.length).toLowerCase() !== scheme.toLowerCase()) return void 0;
39885
+ if (value[scheme.length] !== " ") return void 0;
39886
+ return value.slice(scheme.length + 1).trim() || void 0;
39887
+ }
39612
39888
  async handlePublicMode() {
39613
39889
  const authOptions = this.scope.auth?.options;
39614
- if (!authOptions || !(0, import_auth10.isPublicMode)(authOptions)) {
39890
+ if (!authOptions || !(0, import_auth11.isPublicMode)(authOptions)) {
39615
39891
  return;
39616
39892
  }
39617
- if (this.state.token) {
39893
+ if (this.state.token && (0, import_auth28.isJwt)(this.state.token)) {
39618
39894
  return;
39619
39895
  }
39896
+ if (this.state.token) {
39897
+ this.logger.verbose(
39898
+ "handlePublicMode: ignoring non-JWT bearer token (public mode has nothing to verify it against)"
39899
+ );
39900
+ }
39620
39901
  this.logger.info("handlePublicMode: allowing anonymous access (public mode)");
39621
39902
  this.createAnonymousSession({
39622
39903
  authMode: "public",
@@ -39644,7 +39925,7 @@ var init_session_verify_flow = __esm({
39644
39925
  });
39645
39926
  }
39646
39927
  async verifyIfJwt() {
39647
- const jwks = this.get(import_auth27.JwksService);
39928
+ const jwks = this.get(import_auth28.JwksService);
39648
39929
  const token = this.state.token;
39649
39930
  if (!token) {
39650
39931
  this.logger.warn("verifyIfJwt: missing or empty bearer token, returning 401");
@@ -39654,11 +39935,11 @@ var init_session_verify_flow = __esm({
39654
39935
  });
39655
39936
  return;
39656
39937
  }
39657
- if (!(0, import_auth27.isJwt)(token)) {
39938
+ if (!(0, import_auth28.isJwt)(token)) {
39658
39939
  this.logger.warn("verifyIfJwt: token is not a JWT, returning 401");
39659
39940
  this.respond({
39660
39941
  kind: "unauthorized",
39661
- prmMetadataHeader: (0, import_auth27.buildInvalidTokenHeader)(this.state.required.prmUrl, "Token is not a valid JWT")
39942
+ prmMetadataHeader: (0, import_auth28.buildInvalidTokenHeader)(this.state.required.prmUrl, "Token is not a valid JWT")
39662
39943
  });
39663
39944
  return;
39664
39945
  }
@@ -39673,9 +39954,9 @@ var init_session_verify_flow = __esm({
39673
39954
  }
39674
39955
  let verify;
39675
39956
  const authOptions = auth.options;
39676
- const mode = (0, import_auth10.isTransparentMode)(authOptions) ? "transparent" : "gateway";
39957
+ const mode = (0, import_auth11.isTransparentMode)(authOptions) ? "transparent" : "gateway";
39677
39958
  this.logger.verbose(`verifyIfJwt: verifying using ${mode} mode`);
39678
- if ((0, import_auth10.isTransparentMode)(authOptions)) {
39959
+ if ((0, import_auth11.isTransparentMode)(authOptions)) {
39679
39960
  const primary = authOptions;
39680
39961
  const issuer = auth.issuer;
39681
39962
  const providerRefs = [
@@ -39695,7 +39976,7 @@ var init_session_verify_flow = __esm({
39695
39976
  const result = await verify;
39696
39977
  if (result.ok) {
39697
39978
  this.state.set({ jwtPayload: result.payload });
39698
- if ((0, import_auth10.isTransparentMode)(authOptions)) {
39979
+ if ((0, import_auth11.isTransparentMode)(authOptions)) {
39699
39980
  const configuredAudience = authOptions.expectedAudience;
39700
39981
  if (!configuredAudience && !isPublicUrlPinned() && !warnedUnpinnedAudience) {
39701
39982
  warnedUnpinnedAudience = true;
@@ -39703,8 +39984,8 @@ var init_session_verify_flow = __esm({
39703
39984
  "transparent audience validation is deriving the expected audience from the request Host: set auth.expectedAudience or FRONTMCP_PUBLIC_URL to bind tokens to a fixed resource. X-Forwarded-Host is ignored unless FRONTMCP_TRUST_PROXY is enabled."
39704
39985
  );
39705
39986
  }
39706
- const expectedAudiences = configuredAudience ? Array.isArray(configuredAudience) ? configuredAudience : [configuredAudience] : (0, import_auth27.deriveExpectedAudience)(this.state.required.baseUrl);
39707
- const audResult = (0, import_auth27.validateAudience)(result.payload?.["aud"], {
39987
+ const expectedAudiences = configuredAudience ? Array.isArray(configuredAudience) ? configuredAudience : [configuredAudience] : (0, import_auth28.deriveExpectedAudience)(this.state.required.baseUrl);
39988
+ const audResult = (0, import_auth28.validateAudience)(result.payload?.["aud"], {
39708
39989
  expectedAudiences,
39709
39990
  // By default accept tokens with no `aud` claim: many IdPs omit it, and
39710
39991
  // rejecting them here would break existing transparent deployments.
@@ -39718,7 +39999,7 @@ var init_session_verify_flow = __esm({
39718
39999
  this.logger.warn("verifyIfJwt: audience validation failed", { error: audResult.error });
39719
40000
  this.respond({
39720
40001
  kind: "unauthorized",
39721
- prmMetadataHeader: (0, import_auth27.buildInvalidTokenHeader)(
40002
+ prmMetadataHeader: (0, import_auth28.buildInvalidTokenHeader)(
39722
40003
  this.state.required.prmUrl,
39723
40004
  audResult.error ?? "Token audience is not valid for this resource"
39724
40005
  )
@@ -39738,7 +40019,7 @@ var init_session_verify_flow = __esm({
39738
40019
  });
39739
40020
  this.respond({
39740
40021
  kind: "forbidden",
39741
- prmMetadataHeader: (0, import_auth27.buildInsufficientScopeHeader)(this.state.required.prmUrl, requiredScopes)
40022
+ prmMetadataHeader: (0, import_auth28.buildInsufficientScopeHeader)(this.state.required.prmUrl, requiredScopes)
39742
40023
  });
39743
40024
  return;
39744
40025
  }
@@ -39748,14 +40029,14 @@ var init_session_verify_flow = __esm({
39748
40029
  this.logger.warn("verifyIfJwt: JWT verification failed", { error: result.error });
39749
40030
  this.respond({
39750
40031
  kind: "unauthorized",
39751
- prmMetadataHeader: (0, import_auth27.buildInvalidTokenHeader)(
40032
+ prmMetadataHeader: (0, import_auth28.buildInvalidTokenHeader)(
39752
40033
  this.state.required.prmUrl,
39753
40034
  result.error ?? "Token verification failed"
39754
40035
  )
39755
40036
  });
39756
40037
  }
39757
40038
  async deriveUser() {
39758
- this.state.set("user", (0, import_auth27.deriveTypedUser)(this.state.required.jwtPayload ?? {}));
40039
+ this.state.set("user", (0, import_auth28.deriveTypedUser)(this.state.required.jwtPayload ?? {}));
39759
40040
  }
39760
40041
  async parseSessionHeader() {
39761
40042
  const {
@@ -39790,6 +40071,14 @@ var init_session_verify_flow = __esm({
39790
40071
  __decorateClass([
39791
40072
  Stage22("parseInput")
39792
40073
  ], SessionVerifyFlow.prototype, "parseInput", 1);
40074
+ __decorateClass([
40075
+ Stage22("handleStaticToken", {
40076
+ filter: ({ scope }) => {
40077
+ const authOptions = scope.auth?.options;
40078
+ return !!authOptions && (0, import_auth11.isStaticMode)(authOptions);
40079
+ }
40080
+ })
40081
+ ], SessionVerifyFlow.prototype, "handleStaticToken", 1);
39793
40082
  __decorateClass([
39794
40083
  Stage22("handlePublicMode")
39795
40084
  ], SessionVerifyFlow.prototype, "handlePublicMode", 1);
@@ -39798,7 +40087,7 @@ var init_session_verify_flow = __esm({
39798
40087
  filter: ({ state, scope }) => {
39799
40088
  if (state.token) return false;
39800
40089
  const authOptions = scope.auth?.options;
39801
- if (!authOptions || !(0, import_auth10.isTransparentMode)(authOptions)) return false;
40090
+ if (!authOptions || !(0, import_auth11.isTransparentMode)(authOptions)) return false;
39802
40091
  return authOptions.allowAnonymous === true;
39803
40092
  }
39804
40093
  })
@@ -39808,8 +40097,8 @@ var init_session_verify_flow = __esm({
39808
40097
  filter: ({ state, scope }) => {
39809
40098
  if (state.authorizationHeader) return false;
39810
40099
  const authOptions = scope.auth?.options;
39811
- if (authOptions && (0, import_auth10.isPublicMode)(authOptions)) return false;
39812
- if (authOptions && (0, import_auth10.isTransparentMode)(authOptions)) {
40100
+ if (authOptions && (0, import_auth11.isPublicMode)(authOptions)) return false;
40101
+ if (authOptions && (0, import_auth11.isTransparentMode)(authOptions)) {
39813
40102
  if (authOptions.allowAnonymous === true) return false;
39814
40103
  }
39815
40104
  return true;
@@ -39841,13 +40130,13 @@ var init_session_verify_flow = __esm({
39841
40130
  });
39842
40131
 
39843
40132
  // libs/sdk/src/auth/flows/well-known.jwks.flow.ts
39844
- var import_reflect_metadata18, import_auth28, import_lazy_zod72, inputSchema24, stateSchema23, outputSchema22, plan23, name23, Stage23, WellKnownJwksFlow;
40133
+ var import_reflect_metadata18, import_auth29, import_lazy_zod72, inputSchema24, stateSchema23, outputSchema22, plan23, name23, Stage23, WellKnownJwksFlow;
39845
40134
  var init_well_known_jwks_flow = __esm({
39846
40135
  "libs/sdk/src/auth/flows/well-known.jwks.flow.ts"() {
39847
40136
  "use strict";
39848
40137
  init_common();
39849
40138
  import_reflect_metadata18 = require("reflect-metadata");
39850
- import_auth28 = require("@frontmcp/auth");
40139
+ import_auth29 = require("@frontmcp/auth");
39851
40140
  import_lazy_zod72 = require("@frontmcp/lazy-zod");
39852
40141
  init_auth_internal_errors();
39853
40142
  inputSchema24 = httpInputSchema;
@@ -39873,17 +40162,17 @@ var init_well_known_jwks_flow = __esm({
39873
40162
  }
39874
40163
  async collectData() {
39875
40164
  const { isOrchestrated } = this.state.required;
39876
- const jwksSvc = this.get(import_auth28.JwksService);
40165
+ const jwksSvc = this.get(import_auth29.JwksService);
39877
40166
  if (isOrchestrated) {
39878
40167
  const keysDoc = await jwksSvc.getPublicJwks();
39879
40168
  if (!keysDoc?.keys || !Array.isArray(keysDoc.keys)) {
39880
- throw new import_auth11.OrchestratorJwksNotAvailableError();
40169
+ throw new import_auth12.OrchestratorJwksNotAvailableError();
39881
40170
  }
39882
40171
  this.respond(httpRespond.json(keysDoc));
39883
40172
  return;
39884
40173
  }
39885
40174
  const options = this.scope.auth.options;
39886
- if (options && (0, import_auth10.isTransparentMode)(options)) {
40175
+ if (options && (0, import_auth11.isTransparentMode)(options)) {
39887
40176
  if (options.providerConfig?.jwks && options.providerConfig.jwks.keys.length) {
39888
40177
  this.respond(httpRespond.json(options.providerConfig.jwks));
39889
40178
  } else {
@@ -39923,21 +40212,21 @@ var init_well_known_jwks_flow = __esm({
39923
40212
 
39924
40213
  // libs/sdk/src/auth/flows/well-known.oauth-authorization-server.flow.ts
39925
40214
  function resolveDcrEnabled(auth) {
39926
- if (auth && (0, import_auth10.isLocalMode)(auth)) {
40215
+ if (auth && (0, import_auth11.isLocalMode)(auth)) {
39927
40216
  const dcr = auth.dcr;
39928
40217
  if (dcr && typeof dcr.enabled === "boolean") {
39929
40218
  return dcr.enabled;
39930
40219
  }
39931
40220
  }
39932
- return !(0, import_utils72.isProduction)();
40221
+ return !(0, import_utils74.isProduction)();
39933
40222
  }
39934
- var import_reflect_metadata19, import_lazy_zod73, import_utils72, inputSchema25, AuthServerMetadataSchema, outputSchema23, wellKnownAsStateSchema, wellKnownAsPlan, name24, Stage24, WellKnownAsFlow;
40223
+ var import_reflect_metadata19, import_lazy_zod73, import_utils74, inputSchema25, AuthServerMetadataSchema, outputSchema23, wellKnownAsStateSchema, wellKnownAsPlan, name24, Stage24, WellKnownAsFlow;
39935
40224
  var init_well_known_oauth_authorization_server_flow = __esm({
39936
40225
  "libs/sdk/src/auth/flows/well-known.oauth-authorization-server.flow.ts"() {
39937
40226
  "use strict";
39938
40227
  import_reflect_metadata19 = require("reflect-metadata");
39939
40228
  import_lazy_zod73 = require("@frontmcp/lazy-zod");
39940
- import_utils72 = require("@frontmcp/utils");
40229
+ import_utils74 = require("@frontmcp/utils");
39941
40230
  init_common();
39942
40231
  init_sdk_errors();
39943
40232
  inputSchema25 = httpInputSchema;
@@ -39997,7 +40286,7 @@ var init_well_known_oauth_authorization_server_flow = __esm({
39997
40286
  const baseUrl = getRequestBaseUrl(request, this.scope.entryPath);
39998
40287
  const oauthBaseUrl = getRequestBaseUrl(request);
39999
40288
  let cimdEnabled = true;
40000
- if (metadata.auth && (0, import_auth10.isOrchestratedMode)(metadata.auth)) {
40289
+ if (metadata.auth && (0, import_auth11.isOrchestratedMode)(metadata.auth)) {
40001
40290
  cimdEnabled = metadata.auth.cimd?.enabled ?? true;
40002
40291
  }
40003
40292
  this.state.set(
@@ -40009,7 +40298,7 @@ var init_well_known_oauth_authorization_server_flow = __esm({
40009
40298
  // #462 — advertise registration_endpoint only when local-AS DCR is
40010
40299
  // actually active (explicit auth.dcr.enabled, else dev/prod default).
40011
40300
  dcrEnabled: resolveDcrEnabled(metadata.auth),
40012
- isOrchestrated: metadata.auth ? (0, import_auth10.isOrchestratedMode)(metadata.auth) : false,
40301
+ isOrchestrated: metadata.auth ? (0, import_auth11.isOrchestratedMode)(metadata.auth) : false,
40013
40302
  cimdEnabled
40014
40303
  })
40015
40304
  );
@@ -40203,9 +40492,9 @@ function createSecureStoreProviders(opts) {
40203
40492
  name: "SecureStoreBackend"
40204
40493
  };
40205
40494
  const accessorProvider = {
40206
- provide: import_auth29.SECURE_STORE_ACCESSOR,
40495
+ provide: import_auth30.SECURE_STORE_ACCESSOR,
40207
40496
  inject: () => [FRONTMCP_CONTEXT, FrontMcpLogger],
40208
- useFactory: (ctx, logger) => new import_auth29.SecureStoreAccessorImpl({
40497
+ useFactory: (ctx, logger) => new import_auth30.SecureStoreAccessorImpl({
40209
40498
  backend,
40210
40499
  scope,
40211
40500
  resolveSub: () => resolveRequestSub(ctx),
@@ -40218,11 +40507,11 @@ function createSecureStoreProviders(opts) {
40218
40507
  };
40219
40508
  return [backendProvider, accessorProvider];
40220
40509
  }
40221
- var import_auth29, import_di32, SECURE_STORE_BACKEND;
40510
+ var import_auth30, import_di32, SECURE_STORE_BACKEND;
40222
40511
  var init_secure_store_providers = __esm({
40223
40512
  "libs/sdk/src/auth/secure-store/secure-store.providers.ts"() {
40224
40513
  "use strict";
40225
- import_auth29 = require("@frontmcp/auth");
40514
+ import_auth30 = require("@frontmcp/auth");
40226
40515
  import_di32 = require("@frontmcp/di");
40227
40516
  init_common();
40228
40517
  init_frontmcp_context_provider();
@@ -40232,14 +40521,14 @@ var init_secure_store_providers = __esm({
40232
40521
  });
40233
40522
 
40234
40523
  // libs/sdk/src/auth/secure-store/secure-store.context-extension.ts
40235
- var import_auth30, secureStoreContextExtension;
40524
+ var import_auth31, secureStoreContextExtension;
40236
40525
  var init_secure_store_context_extension = __esm({
40237
40526
  "libs/sdk/src/auth/secure-store/secure-store.context-extension.ts"() {
40238
40527
  "use strict";
40239
- import_auth30 = require("@frontmcp/auth");
40528
+ import_auth31 = require("@frontmcp/auth");
40240
40529
  secureStoreContextExtension = {
40241
40530
  property: "secureStore",
40242
- token: import_auth30.SECURE_STORE_ACCESSOR,
40531
+ token: import_auth31.SECURE_STORE_ACCESSOR,
40243
40532
  errorMessage: "The secure store is not available. Ensure the server uses auth mode 'local' (or 'remote'); the secure store is enabled automatically there."
40244
40533
  };
40245
40534
  }
@@ -40256,7 +40545,7 @@ var init_secure_store = __esm({
40256
40545
  // libs/sdk/src/auth/instances/instance.local-primary-auth.ts
40257
40546
  function getDefaultNoAuthSecret() {
40258
40547
  if (!defaultNoAuthSecret) {
40259
- defaultNoAuthSecret = (0, import_utils73.randomBytes)(32);
40548
+ defaultNoAuthSecret = (0, import_utils75.randomBytes)(32);
40260
40549
  }
40261
40550
  return defaultNoAuthSecret;
40262
40551
  }
@@ -40275,18 +40564,19 @@ function validateAuthorizationIssuer(received, expected) {
40275
40564
  return { ok: true };
40276
40565
  }
40277
40566
  function isUnsupportedOperation(error) {
40278
- return error instanceof import_utils73.StorageNotSupportedError;
40567
+ return error instanceof import_utils75.StorageNotSupportedError;
40279
40568
  }
40280
- var import_jose, import_auth31, import_utils73, defaultNoAuthSecret, RESERVED_JWT_CLAIMS, LocalPrimaryAuth;
40569
+ var import_jose, import_auth32, import_utils75, MIN_HS256_SECRET_BYTES, defaultNoAuthSecret, RESERVED_JWT_CLAIMS, LocalPrimaryAuth;
40281
40570
  var init_instance_local_primary_auth = __esm({
40282
40571
  "libs/sdk/src/auth/instances/instance.local-primary-auth.ts"() {
40283
40572
  "use strict";
40284
40573
  import_jose = require("jose");
40285
- import_auth31 = require("@frontmcp/auth");
40286
- import_utils73 = require("@frontmcp/utils");
40574
+ import_auth32 = require("@frontmcp/auth");
40575
+ import_utils75 = require("@frontmcp/utils");
40287
40576
  init_common();
40288
40577
  init_auth2();
40289
40578
  init_context_extension();
40579
+ init_errors();
40290
40580
  init_cimd();
40291
40581
  init_credentials();
40292
40582
  init_credentials_context_extension();
@@ -40304,6 +40594,7 @@ var init_instance_local_primary_auth = __esm({
40304
40594
  init_well_known_prm_flow();
40305
40595
  init_secure_store();
40306
40596
  init_secure_store_context_extension();
40597
+ MIN_HS256_SECRET_BYTES = 32;
40307
40598
  RESERVED_JWT_CLAIMS = /* @__PURE__ */ new Set([
40308
40599
  "sub",
40309
40600
  "iss",
@@ -40328,27 +40619,39 @@ var init_instance_local_primary_auth = __esm({
40328
40619
  this.providers = providers;
40329
40620
  this.logger = this.providers.getActiveScope().logger.child("LocalPrimaryAuth");
40330
40621
  this.port = this.providers.getActiveScope().metadata.http?.port ?? 3001;
40331
- this.host = (0, import_utils73.getEnv)("FRONTMCP_PUBLIC_HOST")?.trim() || "localhost";
40622
+ this.host = (0, import_utils75.getEnv)("FRONTMCP_PUBLIC_HOST")?.trim() || "localhost";
40332
40623
  this.issuer = this.deriveIssuer(options);
40333
- const jwtSecret = (0, import_utils73.getEnv)("JWT_SECRET");
40334
- if (jwtSecret) {
40335
- this.secret = new TextEncoder().encode(jwtSecret);
40624
+ const jwtSecret = (0, import_utils75.getEnv)("JWT_SECRET");
40625
+ const hasJwtSecret = !!jwtSecret?.trim();
40626
+ if (hasJwtSecret && jwtSecret) {
40627
+ const encoded = new TextEncoder().encode(jwtSecret);
40628
+ if (encoded.length < MIN_HS256_SECRET_BYTES) {
40629
+ if ((0, import_utils75.isProduction)()) throw new import_auth12.JwtSecretWeakError(encoded.length);
40630
+ this.logger.warn(
40631
+ `JWT_SECRET is ${encoded.length} bytes; HS256 wants at least ${MIN_HS256_SECRET_BYTES} (RFC 7518). This is refused in production \u2014 generate one with \`openssl rand -hex 32\`.`
40632
+ );
40633
+ }
40634
+ this.secret = encoded;
40635
+ } else if ((0, import_utils75.isProduction)() && (0, import_auth11.isOrchestratedMode)(options)) {
40636
+ throw new import_auth12.JwtSecretRequiredError(options.mode);
40336
40637
  } else {
40337
- this.logger.warn("JWT_SECRET is not set, using default secret");
40638
+ this.logger.warn(
40639
+ "JWT_SECRET is not set; signing with a random per-process secret. Tokens will not survive a restart and will not verify across instances. Set JWT_SECRET for any deployment that mints tokens."
40640
+ );
40338
40641
  this.secret = getDefaultNoAuthSecret();
40339
40642
  }
40340
40643
  this.tokenStorage = this.readTokenStorage(options);
40341
- this.authorizationStoreImpl = new import_auth31.InMemoryAuthorizationStore();
40342
- this.federatedSessionStoreImpl = new import_auth31.InMemoryFederatedAuthSessionStore();
40343
- this.orchestratedTokenStoreImpl = new import_auth31.InMemoryOrchestratedTokenStore({
40644
+ this.authorizationStoreImpl = new import_auth32.InMemoryAuthorizationStore();
40645
+ this.federatedSessionStoreImpl = new import_auth32.InMemoryFederatedAuthSessionStore();
40646
+ this.orchestratedTokenStoreImpl = new import_auth32.InMemoryOrchestratedTokenStore({
40344
40647
  encryptionKey: this.secret
40345
40648
  // Reuse JWT secret for token encryption
40346
40649
  });
40347
- this.consentStoreImpl = new import_auth31.InMemoryConsentStore();
40348
- this.dcrClientRegistryImpl = new import_auth31.DcrClientRegistry(this.getDcrConfig() ?? {});
40349
- if ((0, import_auth10.isOrchestratedMode)(options)) {
40650
+ this.consentStoreImpl = new import_auth32.InMemoryConsentStore();
40651
+ this.dcrClientRegistryImpl = new import_auth32.DcrClientRegistry(this.getDcrConfig() ?? {});
40652
+ if ((0, import_auth11.isOrchestratedMode)(options)) {
40350
40653
  const cimdConfig = options.cimd;
40351
- this.cimdService = new import_auth19.CimdService(this.logger, cimdConfig);
40654
+ this.cimdService = new import_auth20.CimdService(this.logger, cimdConfig);
40352
40655
  }
40353
40656
  this.ready = this.initialize();
40354
40657
  }
@@ -40360,7 +40663,7 @@ var init_instance_local_primary_auth = __esm({
40360
40663
  keys = [];
40361
40664
  secret;
40362
40665
  logger;
40363
- jwks = new import_auth31.JwksService();
40666
+ jwks = new import_auth32.JwksService();
40364
40667
  cimdService;
40365
40668
  /**
40366
40669
  * Token storage backend selected from `options.tokenStorage`.
@@ -40455,7 +40758,7 @@ var init_instance_local_primary_auth = __esm({
40455
40758
  * mode returns `undefined`, preserving the historical behavior exactly.
40456
40759
  */
40457
40760
  getDcrConfig() {
40458
- if ((0, import_auth10.isLocalMode)(this.options)) {
40761
+ if ((0, import_auth11.isLocalMode)(this.options)) {
40459
40762
  return this.options.dcr;
40460
40763
  }
40461
40764
  return void 0;
@@ -40470,7 +40773,7 @@ var init_instance_local_primary_auth = __esm({
40470
40773
  if (dcr && typeof dcr.enabled === "boolean") {
40471
40774
  return dcr.enabled;
40472
40775
  }
40473
- return !(0, import_utils73.isProduction)();
40776
+ return !(0, import_utils75.isProduction)();
40474
40777
  }
40475
40778
  /** Provider configurations (indexed by provider ID) */
40476
40779
  providerConfigs = /* @__PURE__ */ new Map();
@@ -40506,11 +40809,11 @@ var init_instance_local_primary_auth = __esm({
40506
40809
  */
40507
40810
  deriveIssuer(options) {
40508
40811
  const basePath = `http://${this.host}:${this.port}${this.scope.fullPath}`;
40509
- if ((0, import_auth10.isPublicMode)(options)) {
40812
+ if ((0, import_auth11.isPublicMode)(options)) {
40510
40813
  return options.issuer ?? basePath;
40511
40814
  }
40512
- if ((0, import_auth10.isOrchestratedMode)(options)) {
40513
- if ((0, import_auth10.isOrchestratedLocal)(options)) {
40815
+ if ((0, import_auth11.isOrchestratedMode)(options)) {
40816
+ if ((0, import_auth11.isOrchestratedLocal)(options)) {
40514
40817
  return options.local?.issuer ?? basePath;
40515
40818
  } else {
40516
40819
  return options.local?.issuer ?? basePath;
@@ -40539,19 +40842,19 @@ var init_instance_local_primary_auth = __esm({
40539
40842
  * key, so upstream provider tokens stay encrypted at rest in every backend.
40540
40843
  */
40541
40844
  async initializeStores() {
40542
- if (!(0, import_auth31.isPersistentTokenStorage)(this.tokenStorage)) {
40845
+ if (!(0, import_auth32.isPersistentTokenStorage)(this.tokenStorage)) {
40543
40846
  return;
40544
40847
  }
40545
40848
  try {
40546
- const adapter = await (0, import_auth31.createTokenStorageAdapter)(this.tokenStorage);
40849
+ const adapter = await (0, import_auth32.createTokenStorageAdapter)(this.tokenStorage);
40547
40850
  this.storageAdapter = adapter;
40548
- this.authorizationStoreImpl = new import_auth31.StorageAuthorizationStore(adapter);
40549
- this.federatedSessionStoreImpl = new import_auth31.StorageFederatedAuthSessionStore(adapter);
40550
- this.orchestratedTokenStoreImpl = new import_auth31.StorageOrchestratedTokenStore(adapter, {
40851
+ this.authorizationStoreImpl = new import_auth32.StorageAuthorizationStore(adapter);
40852
+ this.federatedSessionStoreImpl = new import_auth32.StorageFederatedAuthSessionStore(adapter);
40853
+ this.orchestratedTokenStoreImpl = new import_auth32.StorageOrchestratedTokenStore(adapter, {
40551
40854
  encryptionKey: this.secret
40552
40855
  });
40553
- this.consentStoreImpl = new import_auth31.StorageConsentStore(adapter);
40554
- const backend = (0, import_auth31.isSqliteTokenStorage)(this.tokenStorage) ? "sqlite" : (0, import_auth31.isRedisTokenStorage)(this.tokenStorage) ? "redis" : "unknown";
40856
+ this.consentStoreImpl = new import_auth32.StorageConsentStore(adapter);
40857
+ const backend = (0, import_auth32.isSqliteTokenStorage)(this.tokenStorage) ? "sqlite" : (0, import_auth32.isRedisTokenStorage)(this.tokenStorage) ? "redis" : "unknown";
40555
40858
  this.logger.info(`Token storage initialized with persistent backend: ${backend}`);
40556
40859
  } catch (err) {
40557
40860
  this.logger.error("Failed to initialize persistent token storage", err);
@@ -40593,7 +40896,7 @@ var init_instance_local_primary_auth = __esm({
40593
40896
  */
40594
40897
  async claimIncrementalTicket(jti, ttlMs) {
40595
40898
  const key = `incremental-ticket:${jti}`;
40596
- const nonce = (0, import_utils73.randomUUID)();
40899
+ const nonce = (0, import_utils75.randomUUID)();
40597
40900
  const ttlSeconds = Math.max(1, Math.ceil(ttlMs / 1e3));
40598
40901
  let storage = await this.getTicketReplayStorage();
40599
40902
  try {
@@ -40637,7 +40940,7 @@ var init_instance_local_primary_auth = __esm({
40637
40940
  /** Replace the replay guard with a fresh in-memory adapter, memoized. */
40638
40941
  useInMemoryTicketReplayStorage() {
40639
40942
  const pending = (async () => {
40640
- const memory = new import_utils73.MemoryStorageAdapter();
40943
+ const memory = new import_utils75.MemoryStorageAdapter();
40641
40944
  await memory.connect();
40642
40945
  return memory;
40643
40946
  })();
@@ -40645,19 +40948,19 @@ var init_instance_local_primary_auth = __esm({
40645
40948
  return pending;
40646
40949
  }
40647
40950
  async initializeCredentialVault() {
40648
- if ((0, import_auth10.isPublicMode)(this.options)) {
40951
+ if ((0, import_auth11.isPublicMode)(this.options)) {
40649
40952
  return;
40650
40953
  }
40651
40954
  let storage;
40652
40955
  if (this.storageAdapter) {
40653
40956
  storage = this.storageAdapter;
40654
40957
  } else {
40655
- const memory = new import_utils73.MemoryStorageAdapter();
40958
+ const memory = new import_utils75.MemoryStorageAdapter();
40656
40959
  await memory.connect();
40657
40960
  storage = memory;
40658
40961
  }
40659
- const pepper = (0, import_utils73.getEnv)("VAULT_SECRET") ?? (0, import_utils73.getEnv)("JWT_SECRET") ?? void 0;
40660
- this.credentialVaultImpl = new import_auth31.SessionCredentialVault({
40962
+ const pepper = (0, import_utils75.getEnv)("VAULT_SECRET") ?? (0, import_utils75.getEnv)("JWT_SECRET") ?? void 0;
40963
+ this.credentialVaultImpl = new import_auth32.SessionCredentialVault({
40661
40964
  storage,
40662
40965
  pepper,
40663
40966
  logger: this.logger.child("SessionCredentialVault")
@@ -40702,13 +41005,13 @@ var init_instance_local_primary_auth = __esm({
40702
41005
  * secrets share the same trust root as the access tokens.
40703
41006
  */
40704
41007
  async initializeSecureStore() {
40705
- if ((0, import_auth10.isPublicMode)(this.options)) {
41008
+ if ((0, import_auth11.isPublicMode)(this.options)) {
40706
41009
  return;
40707
41010
  }
40708
41011
  const config = this.readSecureStoreConfig();
40709
41012
  const reuseAdapter = this.storageAdapter && this.secureStoreSharesTokenStorage(config) ? this.storageAdapter : void 0;
40710
- const pepper = (0, import_utils73.getEnv)("VAULT_SECRET") ?? (0, import_utils73.getEnv)("JWT_SECRET") ?? new TextDecoder().decode(this.secret);
40711
- const resolved = await (0, import_auth31.createSecureStore)({
41013
+ const pepper = (0, import_utils75.getEnv)("VAULT_SECRET") ?? (0, import_utils75.getEnv)("JWT_SECRET") ?? new TextDecoder().decode(this.secret);
41014
+ const resolved = await (0, import_auth32.createSecureStore)({
40712
41015
  config,
40713
41016
  pepper,
40714
41017
  storage: reuseAdapter,
@@ -40735,12 +41038,12 @@ var init_instance_local_primary_auth = __esm({
40735
41038
  */
40736
41039
  secureStoreSharesTokenStorage(config) {
40737
41040
  if (typeof config !== "object" || config === null) return false;
40738
- if ("sqlite" in config && config.sqlite) return (0, import_auth31.isSqliteTokenStorage)(this.tokenStorage);
40739
- if ("redis" in config && config.redis) return (0, import_auth31.isRedisTokenStorage)(this.tokenStorage);
41041
+ if ("sqlite" in config && config.sqlite) return (0, import_auth32.isSqliteTokenStorage)(this.tokenStorage);
41042
+ if ("redis" in config && config.redis) return (0, import_auth32.isRedisTokenStorage)(this.tokenStorage);
40740
41043
  return false;
40741
41044
  }
40742
41045
  async signAnonymousJwt() {
40743
- const sub = (0, import_utils73.randomUUID)();
41046
+ const sub = (0, import_utils75.randomUUID)();
40744
41047
  return new import_jose.SignJWT({ sub, role: "user", anonymous: true }).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt().setIssuer(this.issuer).setExpirationTime("1d").sign(this.secret);
40745
41048
  }
40746
41049
  /**
@@ -40813,7 +41116,7 @@ var init_instance_local_primary_auth = __esm({
40813
41116
  }
40814
41117
  }
40815
41118
  }
40816
- const jwt = new import_jose.SignJWT(claims).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt().setIssuer(this.issuer).setExpirationTime(`${this.accessTokenTtlSeconds}s`).setJti((0, import_utils73.randomUUID)());
41119
+ const jwt = new import_jose.SignJWT(claims).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt().setIssuer(this.issuer).setExpirationTime(`${this.accessTokenTtlSeconds}s`).setJti((0, import_utils75.randomUUID)());
40817
41120
  if (audience) {
40818
41121
  jwt.setAudience(audience);
40819
41122
  }
@@ -40864,7 +41167,7 @@ var init_instance_local_primary_auth = __esm({
40864
41167
  error_description: "Redirect URI does not match"
40865
41168
  };
40866
41169
  }
40867
- if (!(0, import_auth31.verifyPkce)(codeVerifier, codeRecord.pkce)) {
41170
+ if (!(0, import_auth32.verifyPkce)(codeVerifier, codeRecord.pkce)) {
40868
41171
  this.logger.warn(`PKCE verification failed`);
40869
41172
  return {
40870
41173
  error: "invalid_grant",
@@ -40894,7 +41197,7 @@ var init_instance_local_primary_auth = __esm({
40894
41197
  const pendingAuthId = `pending:${codeRecord.pendingAuthId}`;
40895
41198
  const parts = accessToken.split(".");
40896
41199
  const signature = parts[2] || accessToken;
40897
- const newAuthId = (0, import_utils73.sha256Hex)(signature).substring(0, 16);
41200
+ const newAuthId = (0, import_utils75.sha256Hex)(signature).substring(0, 16);
40898
41201
  await this.orchestratedTokenStore.migrateTokens(pendingAuthId, newAuthId);
40899
41202
  this.logger.info(`Migrated tokens from ${pendingAuthId} to ${newAuthId}`);
40900
41203
  } catch (err) {
@@ -41035,7 +41338,7 @@ var init_instance_local_primary_auth = __esm({
41035
41338
  scope: import_di4.ProviderScope.GLOBAL,
41036
41339
  name: "auth:jwk-service"
41037
41340
  },
41038
- provide: import_auth31.JwksService
41341
+ provide: import_auth32.JwksService
41039
41342
  });
41040
41343
  if (this.cimdService) {
41041
41344
  this.providers.injectProvider({
@@ -41044,7 +41347,7 @@ var init_instance_local_primary_auth = __esm({
41044
41347
  scope: import_di4.ProviderScope.GLOBAL,
41045
41348
  name: "auth:cimd-service"
41046
41349
  },
41047
- provide: import_auth19.CimdService
41350
+ provide: import_auth20.CimdService
41048
41351
  });
41049
41352
  this.logger.debug("CIMD service registered");
41050
41353
  }
@@ -41130,7 +41433,7 @@ var init_instance_local_primary_auth = __esm({
41130
41433
  * kept in the provider config and never logged or exposed to the LLM.
41131
41434
  */
41132
41435
  registerConfiguredProviders() {
41133
- if (!(0, import_auth10.isLocalMode)(this.options)) {
41436
+ if (!(0, import_auth11.isLocalMode)(this.options)) {
41134
41437
  return;
41135
41438
  }
41136
41439
  const providers = this.options.providers;
@@ -41177,7 +41480,7 @@ var init_instance_local_primary_auth = __esm({
41177
41480
  * kept in the provider config and never logged or exposed to the LLM.
41178
41481
  */
41179
41482
  registerRemoteProvider() {
41180
- if (!(0, import_auth10.isRemoteMode)(this.options)) {
41483
+ if (!(0, import_auth11.isRemoteMode)(this.options)) {
41181
41484
  return;
41182
41485
  }
41183
41486
  const options = this.options;
@@ -41311,7 +41614,7 @@ var init_instance_local_primary_auth = __esm({
41311
41614
  if (idToken) {
41312
41615
  try {
41313
41616
  const [, payloadB64] = idToken.split(".");
41314
- const payload = JSON.parse(new TextDecoder().decode((0, import_utils73.base64urlDecode)(payloadB64)));
41617
+ const payload = JSON.parse(new TextDecoder().decode((0, import_utils75.base64urlDecode)(payloadB64)));
41315
41618
  const exp = typeof payload["exp"] === "number" ? payload["exp"] : void 0;
41316
41619
  if (exp !== void 0 && exp * 1e3 < Date.now()) {
41317
41620
  this.logger.warn(`ID token for ${providerId} is expired; falling back to userinfo`);
@@ -41410,11 +41713,11 @@ var init_instance_local_primary_auth = __esm({
41410
41713
  });
41411
41714
 
41412
41715
  // libs/sdk/src/auth/instances/instance.remote-primary-auth.ts
41413
- var import_auth33, RemotePrimaryAuth;
41716
+ var import_auth34, RemotePrimaryAuth;
41414
41717
  var init_instance_remote_primary_auth = __esm({
41415
41718
  "libs/sdk/src/auth/instances/instance.remote-primary-auth.ts"() {
41416
41719
  "use strict";
41417
- import_auth33 = require("@frontmcp/auth");
41720
+ import_auth34 = require("@frontmcp/auth");
41418
41721
  init_common();
41419
41722
  init_session_verify_flow();
41420
41723
  init_well_known_jwks_flow();
@@ -41430,7 +41733,7 @@ var init_instance_remote_primary_auth = __esm({
41430
41733
  scope;
41431
41734
  providers;
41432
41735
  ready;
41433
- jwks = new import_auth33.JwksService();
41736
+ jwks = new import_auth34.JwksService();
41434
41737
  fetch(input, init) {
41435
41738
  return fetch(input, init);
41436
41739
  }
@@ -41448,7 +41751,7 @@ var init_instance_remote_primary_auth = __esm({
41448
41751
  scope: import_di4.ProviderScope.GLOBAL,
41449
41752
  name: "auth:jwk-service"
41450
41753
  },
41451
- provide: import_auth33.JwksService
41754
+ provide: import_auth34.JwksService
41452
41755
  });
41453
41756
  await this.registerAuthFlows(scope);
41454
41757
  return Promise.resolve();
@@ -41466,12 +41769,12 @@ var init_instance_remote_primary_auth = __esm({
41466
41769
  });
41467
41770
 
41468
41771
  // libs/sdk/src/auth/auth.registry.ts
41469
- var import_reflect_metadata21, import_auth34, import_di33, DEFAULT_AUTH_OPTIONS, AuthRegistry;
41772
+ var import_reflect_metadata21, import_auth35, import_di33, DEFAULT_AUTH_OPTIONS, AuthRegistry;
41470
41773
  var init_auth_registry = __esm({
41471
41774
  "libs/sdk/src/auth/auth.registry.ts"() {
41472
41775
  "use strict";
41473
41776
  import_reflect_metadata21 = require("reflect-metadata");
41474
- import_auth34 = require("@frontmcp/auth");
41777
+ import_auth35 = require("@frontmcp/auth");
41475
41778
  import_di33 = require("@frontmcp/di");
41476
41779
  init_common();
41477
41780
  init_context_extension();
@@ -41501,14 +41804,14 @@ var init_auth_registry = __esm({
41501
41804
  super("AuthRegistry", providers, metadata, false);
41502
41805
  this.owner = owner;
41503
41806
  this.logger = providers.get(FrontMcpLogger).child("AuthRegistry");
41504
- this.parsedOptions = (0, import_auth10.parseAuthOptions)(primaryInput ?? DEFAULT_AUTH_OPTIONS);
41807
+ this.parsedOptions = (0, import_auth11.parseAuthOptions)(primaryInput ?? DEFAULT_AUTH_OPTIONS);
41505
41808
  const appAuthInfos = this.extractAppAuthInfo(scope);
41506
- this.detection = (0, import_auth34.detectAuthProviders)(this.parsedOptions, appAuthInfos);
41809
+ this.detection = (0, import_auth35.detectAuthProviders)(this.parsedOptions, appAuthInfos);
41507
41810
  this.requiresOrchestration = this.detection.requiresOrchestration;
41508
41811
  this.logDetectionResults();
41509
41812
  this.validateConfiguration();
41510
41813
  this.primary = this.createPrimaryAuth(scope, providers, this.parsedOptions);
41511
- if ((0, import_auth10.isOrchestratedMode)(this.parsedOptions)) {
41814
+ if ((0, import_auth11.isOrchestratedMode)(this.parsedOptions)) {
41512
41815
  installContextExtensions("orchestrated-auth", [orchestratedAuthContextExtension]);
41513
41816
  }
41514
41817
  const primaryRecord = {
@@ -41603,20 +41906,23 @@ var init_auth_registry = __esm({
41603
41906
  * Create the appropriate primary auth provider based on parsed options
41604
41907
  */
41605
41908
  createPrimaryAuth(scope, providers, options) {
41606
- if ((0, import_auth10.isPublicMode)(options)) {
41909
+ if ((0, import_auth11.isPublicMode)(options)) {
41607
41910
  return new LocalPrimaryAuth(scope, providers, options);
41608
41911
  }
41609
- if ((0, import_auth10.isTransparentMode)(options)) {
41912
+ if ((0, import_auth11.isStaticMode)(options)) {
41913
+ return new LocalPrimaryAuth(scope, providers, options);
41914
+ }
41915
+ if ((0, import_auth11.isTransparentMode)(options)) {
41610
41916
  return new RemotePrimaryAuth(scope, providers, options);
41611
41917
  }
41612
- if ((0, import_auth10.isOrchestratedMode)(options)) {
41613
- if ((0, import_auth10.isOrchestratedLocal)(options)) {
41918
+ if ((0, import_auth11.isOrchestratedMode)(options)) {
41919
+ if ((0, import_auth11.isOrchestratedLocal)(options)) {
41614
41920
  return new LocalPrimaryAuth(scope, providers, options);
41615
41921
  } else {
41616
41922
  return new LocalPrimaryAuth(scope, providers, options);
41617
41923
  }
41618
41924
  }
41619
- const defaultOptions = (0, import_auth10.parseAuthOptions)({ mode: "public" });
41925
+ const defaultOptions = (0, import_auth11.parseAuthOptions)({ mode: "public" });
41620
41926
  return new LocalPrimaryAuth(scope, providers, defaultOptions);
41621
41927
  }
41622
41928
  buildMap(list) {
@@ -42983,12 +43289,12 @@ var init_complete_flow = __esm({
42983
43289
  });
42984
43290
 
42985
43291
  // libs/sdk/src/elicitation/store/storage-elicitation.store.ts
42986
- var import_utils74, import_utils75, RESOLVED_RESULT_TTL_SECONDS, RESULT_CHANNEL_PREFIX, FALLBACK_RESULT_CHANNEL_PREFIX, StorageElicitationStore;
43292
+ var import_utils76, import_utils77, RESOLVED_RESULT_TTL_SECONDS, RESULT_CHANNEL_PREFIX, FALLBACK_RESULT_CHANNEL_PREFIX, StorageElicitationStore;
42987
43293
  var init_storage_elicitation_store = __esm({
42988
43294
  "libs/sdk/src/elicitation/store/storage-elicitation.store.ts"() {
42989
43295
  "use strict";
42990
- import_utils74 = require("@frontmcp/utils");
42991
- import_utils75 = require("@frontmcp/utils");
43296
+ import_utils76 = require("@frontmcp/utils");
43297
+ import_utils77 = require("@frontmcp/utils");
42992
43298
  RESOLVED_RESULT_TTL_SECONDS = 300;
42993
43299
  RESULT_CHANNEL_PREFIX = "result:";
42994
43300
  FALLBACK_RESULT_CHANNEL_PREFIX = "fallback-result:";
@@ -43013,9 +43319,9 @@ var init_storage_elicitation_store = __esm({
43013
43319
  constructor(storage, logger) {
43014
43320
  this.storage = storage;
43015
43321
  this.logger = logger;
43016
- this.pending = new import_utils74.TypedStorage(storage.namespace("pending"));
43017
- this.fallback = new import_utils74.TypedStorage(storage.namespace("fallback"));
43018
- this.resolved = new import_utils74.TypedStorage(storage.namespace("resolved"));
43322
+ this.pending = new import_utils76.TypedStorage(storage.namespace("pending"));
43323
+ this.fallback = new import_utils76.TypedStorage(storage.namespace("fallback"));
43324
+ this.resolved = new import_utils76.TypedStorage(storage.namespace("resolved"));
43019
43325
  }
43020
43326
  // ============================================
43021
43327
  // Pending Elicitation Methods
@@ -43025,7 +43331,7 @@ var init_storage_elicitation_store = __esm({
43025
43331
  */
43026
43332
  async setPending(record) {
43027
43333
  const { sessionId, expiresAt } = record;
43028
- const ttlSeconds = (0, import_utils75.expiresAtToTTL)(expiresAt);
43334
+ const ttlSeconds = (0, import_utils77.expiresAtToTTL)(expiresAt);
43029
43335
  if (ttlSeconds <= 0) {
43030
43336
  this.logger?.warn("[StorageElicitationStore] Record already expired, not storing", {
43031
43337
  sessionId,
@@ -43203,7 +43509,7 @@ var init_storage_elicitation_store = __esm({
43203
43509
  */
43204
43510
  async setPendingFallback(record) {
43205
43511
  const { elicitId, expiresAt } = record;
43206
- const ttlSeconds = (0, import_utils75.expiresAtToTTL)(expiresAt);
43512
+ const ttlSeconds = (0, import_utils77.expiresAtToTTL)(expiresAt);
43207
43513
  if (ttlSeconds <= 0) {
43208
43514
  this.logger?.warn("[StorageElicitationStore] Fallback record already expired, not storing", { elicitId });
43209
43515
  return;
@@ -43458,7 +43764,7 @@ var init_storage_elicitation_store = __esm({
43458
43764
 
43459
43765
  // libs/sdk/src/elicitation/store/elicitation-encryption.ts
43460
43766
  function getElicitationSecret() {
43461
- return (0, import_utils76.getEnv)("MCP_ELICITATION_SECRET") || (0, import_utils76.getEnv)("MCP_SESSION_SECRET") || (0, import_utils76.getEnv)("MCP_SERVER_SECRET") || null;
43767
+ return (0, import_utils78.getEnv)("MCP_ELICITATION_SECRET") || (0, import_utils78.getEnv)("MCP_SESSION_SECRET") || (0, import_utils78.getEnv)("MCP_SERVER_SECRET") || null;
43462
43768
  }
43463
43769
  function isElicitationEncryptionAvailable() {
43464
43770
  return getElicitationSecret() !== null;
@@ -43466,32 +43772,32 @@ function isElicitationEncryptionAvailable() {
43466
43772
  async function deriveElicitationKey(sessionId, secret) {
43467
43773
  const serverSecret = secret ?? getElicitationSecret();
43468
43774
  if (!serverSecret) {
43469
- throw new import_auth11.ElicitationSecretRequiredError();
43775
+ throw new import_auth12.ElicitationSecretRequiredError();
43470
43776
  }
43471
43777
  const ikm = textEncoder.encode(serverSecret + sessionId);
43472
43778
  const salt = textEncoder.encode(ELICITATION_SALT);
43473
43779
  const info = textEncoder.encode(`elicit:${sessionId}`);
43474
- return (0, import_utils76.hkdfSha256)(ikm, salt, info, 32);
43780
+ return (0, import_utils78.hkdfSha256)(ikm, salt, info, 32);
43475
43781
  }
43476
43782
  async function encryptElicitationData(data, sessionId, secret) {
43477
43783
  const key = await deriveElicitationKey(sessionId, secret);
43478
43784
  const plaintext = textEncoder.encode(JSON.stringify(data));
43479
- const iv = (0, import_utils76.randomBytes)(12);
43480
- const { ciphertext, tag } = (0, import_utils76.encryptAesGcm)(key, plaintext, iv);
43785
+ const iv = (0, import_utils78.randomBytes)(12);
43786
+ const { ciphertext, tag } = (0, import_utils78.encryptAesGcm)(key, plaintext, iv);
43481
43787
  return {
43482
43788
  alg: "A256GCM",
43483
- iv: (0, import_utils76.base64urlEncode)(iv),
43484
- tag: (0, import_utils76.base64urlEncode)(tag),
43485
- data: (0, import_utils76.base64urlEncode)(ciphertext)
43789
+ iv: (0, import_utils78.base64urlEncode)(iv),
43790
+ tag: (0, import_utils78.base64urlEncode)(tag),
43791
+ data: (0, import_utils78.base64urlEncode)(ciphertext)
43486
43792
  };
43487
43793
  }
43488
43794
  async function decryptElicitationData(blob, sessionId, secret) {
43489
43795
  try {
43490
43796
  const key = await deriveElicitationKey(sessionId, secret);
43491
- const iv = (0, import_utils76.base64urlDecode)(blob.iv);
43492
- const tag = (0, import_utils76.base64urlDecode)(blob.tag);
43493
- const ciphertext = (0, import_utils76.base64urlDecode)(blob.data);
43494
- const decrypted = (0, import_utils76.decryptAesGcm)(key, ciphertext, iv, tag);
43797
+ const iv = (0, import_utils78.base64urlDecode)(blob.iv);
43798
+ const tag = (0, import_utils78.base64urlDecode)(blob.tag);
43799
+ const ciphertext = (0, import_utils78.base64urlDecode)(blob.data);
43800
+ const decrypted = (0, import_utils78.decryptAesGcm)(key, ciphertext, iv, tag);
43495
43801
  return JSON.parse(textDecoder.decode(decrypted));
43496
43802
  } catch {
43497
43803
  return null;
@@ -43531,11 +43837,11 @@ async function tryDecryptStoredValue(value, sessionId, secret) {
43531
43837
  }
43532
43838
  return decryptElicitationData(value, sessionId, secret);
43533
43839
  }
43534
- var import_utils76, ELICITATION_SALT, textEncoder, textDecoder;
43840
+ var import_utils78, ELICITATION_SALT, textEncoder, textDecoder;
43535
43841
  var init_elicitation_encryption = __esm({
43536
43842
  "libs/sdk/src/elicitation/store/elicitation-encryption.ts"() {
43537
43843
  "use strict";
43538
- import_utils76 = require("@frontmcp/utils");
43844
+ import_utils78 = require("@frontmcp/utils");
43539
43845
  init_auth_internal_errors();
43540
43846
  ELICITATION_SALT = "elicitation-store-v1";
43541
43847
  textEncoder = new TextEncoder();
@@ -43937,10 +44243,10 @@ var init_encrypted_elicitation_store = __esm({
43937
44243
 
43938
44244
  // libs/sdk/src/elicitation/store/elicitation-store.factory.ts
43939
44245
  function detectStorageType2(storage) {
43940
- if ((0, import_utils77.getEnv)("UPSTASH_REDIS_REST_URL")) {
44246
+ if ((0, import_utils79.getEnv)("UPSTASH_REDIS_REST_URL")) {
43941
44247
  return "upstash";
43942
44248
  }
43943
- if ((0, import_utils77.getEnv)("REDIS_URL") || (0, import_utils77.getEnv)("REDIS_HOST")) {
44249
+ if ((0, import_utils79.getEnv)("REDIS_URL") || (0, import_utils79.getEnv)("REDIS_HOST")) {
43944
44250
  return "redis";
43945
44251
  }
43946
44252
  return "memory";
@@ -44026,7 +44332,7 @@ async function createElicitationStore(options = {}) {
44026
44332
  });
44027
44333
  }
44028
44334
  }
44029
- if (finalStorageConfig?.type === "vercel-kv" || (0, import_utils77.getEnv)("KV_REST_API_URL")) {
44335
+ if (finalStorageConfig?.type === "vercel-kv" || (0, import_utils79.getEnv)("KV_REST_API_URL")) {
44030
44336
  throw new ElicitationNotSupportedError(
44031
44337
  "Vercel KV is not supported for elicitation stores. Elicitation requires pub/sub for cross-node result routing, which Vercel KV does not support. Use Redis or Upstash instead."
44032
44338
  );
@@ -44036,7 +44342,7 @@ async function createElicitationStore(options = {}) {
44036
44342
  "Elicitation requires distributed storage when running on Edge runtime. Edge functions are stateless and cannot use in-memory elicitation. Configure Redis or Upstash storage."
44037
44343
  );
44038
44344
  }
44039
- const storage = await (0, import_utils77.createStorage)({
44345
+ const storage = await (0, import_utils79.createStorage)({
44040
44346
  ...finalStorageConfig,
44041
44347
  prefix: keyPrefix,
44042
44348
  fallback: isEdgeRuntime2 ? "error" : "memory"
@@ -44074,7 +44380,7 @@ async function createElicitationStore(options = {}) {
44074
44380
  }
44075
44381
  function createMemoryElicitationStore(options = {}) {
44076
44382
  const { keyPrefix = "mcp:elicit:", logger, encryption } = options;
44077
- const storage = (0, import_utils77.createMemoryStorage)({ prefix: keyPrefix });
44383
+ const storage = (0, import_utils79.createMemoryStorage)({ prefix: keyPrefix });
44078
44384
  let store = new StorageElicitationStore(storage, logger);
44079
44385
  const encryptionEnabled = encryption?.enabled ?? "auto";
44080
44386
  const encryptionSecret = encryption?.secret;
@@ -44130,11 +44436,11 @@ function createSqliteElicitationStore(sqliteConfig, storeOptions = {}) {
44130
44436
  keyPrefix
44131
44437
  });
44132
44438
  }
44133
- var import_utils77;
44439
+ var import_utils79;
44134
44440
  var init_elicitation_store_factory = __esm({
44135
44441
  "libs/sdk/src/elicitation/store/elicitation-store.factory.ts"() {
44136
44442
  "use strict";
44137
- import_utils77 = require("@frontmcp/utils");
44443
+ import_utils79 = require("@frontmcp/utils");
44138
44444
  init_elicitation_error();
44139
44445
  init_elicitation_encryption();
44140
44446
  init_encrypted_elicitation_store();
@@ -44165,12 +44471,12 @@ var init_elicitation2 = __esm({
44165
44471
  });
44166
44472
 
44167
44473
  // libs/sdk/src/elicitation/flows/elicitation-request.flow.ts
44168
- var import_lazy_zod79, import_utils78, inputSchema30, outputSchema28, stateSchema28, plan28, name29, Stage29, ElicitationRequestFlow;
44474
+ var import_lazy_zod79, import_utils80, inputSchema30, outputSchema28, stateSchema28, plan28, name29, Stage29, ElicitationRequestFlow;
44169
44475
  var init_elicitation_request_flow = __esm({
44170
44476
  "libs/sdk/src/elicitation/flows/elicitation-request.flow.ts"() {
44171
44477
  "use strict";
44172
44478
  import_lazy_zod79 = require("@frontmcp/lazy-zod");
44173
- import_utils78 = require("@frontmcp/utils");
44479
+ import_utils80 = require("@frontmcp/utils");
44174
44480
  init_common();
44175
44481
  init_errors();
44176
44482
  init_elicitation_types();
@@ -44253,7 +44559,7 @@ var init_elicitation_request_flow = __esm({
44253
44559
  async generateElicitId() {
44254
44560
  this.logger.verbose("generateElicitId:start");
44255
44561
  const { elicitationId, ttl } = this.state;
44256
- const elicitId = elicitationId ?? `elicit-${(0, import_utils78.randomUUID)()}`;
44562
+ const elicitId = elicitationId ?? `elicit-${(0, import_utils80.randomUUID)()}`;
44257
44563
  const expiresAt = Date.now() + (ttl ?? DEFAULT_ELICIT_TTL);
44258
44564
  this.state.set({ elicitId, expiresAt });
44259
44565
  this.logger.verbose("generateElicitId:done", { elicitId });
@@ -45709,7 +46015,9 @@ var init_workflow_step_executor = __esm({
45709
46015
  "libs/sdk/src/workflow/engine/workflow-step.executor.ts"() {
45710
46016
  "use strict";
45711
46017
  init_errors();
46018
+ init_job_errors();
45712
46019
  init_workflow_errors();
46020
+ init_job_permission_guard();
45713
46021
  WorkflowStepExecutor = class {
45714
46022
  jobRegistry;
45715
46023
  logger;
@@ -45724,6 +46032,16 @@ var init_workflow_step_executor = __esm({
45724
46032
  if (!job) {
45725
46033
  throw new InvalidEntityError("job", step.jobName, `a registered job (referenced by step "${step.id}")`);
45726
46034
  }
46035
+ const allowed = await JobPermissionGuard.check(
46036
+ job.metadata.permissions,
46037
+ "execute",
46038
+ this.extra.authInfo,
46039
+ this.extra.authoritiesContextBuilder
46040
+ );
46041
+ if (!allowed) {
46042
+ this.logger.warn(`Step "${step.id}" denied: caller does not satisfy the execute permissions of "${job.name}"`);
46043
+ throw new JobNotAuthorizedError(job.name);
46044
+ }
45727
46045
  const retryConfig = step.retry ?? job.metadata.retry ?? {};
45728
46046
  const maxAttempts = retryConfig.maxAttempts ?? 3;
45729
46047
  const backoffMs = retryConfig.backoffMs ?? 1e3;
@@ -45948,11 +46266,11 @@ var init_workflow_engine = __esm({
45948
46266
  });
45949
46267
 
45950
46268
  // libs/sdk/src/job/execution/job-execution.manager.ts
45951
- var import_utils79, JobExecutionManager;
46269
+ var import_utils81, JobExecutionManager;
45952
46270
  var init_job_execution_manager = __esm({
45953
46271
  "libs/sdk/src/job/execution/job-execution.manager.ts"() {
45954
46272
  "use strict";
45955
- import_utils79 = require("@frontmcp/utils");
46273
+ import_utils81 = require("@frontmcp/utils");
45956
46274
  init_principal_utils();
45957
46275
  init_errors();
45958
46276
  init_workflow_engine();
@@ -45971,7 +46289,7 @@ var init_job_execution_manager = __esm({
45971
46289
  */
45972
46290
  async executeJob(job, input, opts = {}) {
45973
46291
  await this.assertMayExecute(job.metadata.permissions, job.name, opts);
45974
- const runId = (0, import_utils79.randomUUID)();
46292
+ const runId = (0, import_utils81.randomUUID)();
45975
46293
  const retryConfig = job.metadata.retry ?? {};
45976
46294
  const maxAttempts = retryConfig.maxAttempts ?? 1;
45977
46295
  const runRecord = {
@@ -46011,7 +46329,7 @@ var init_job_execution_manager = __esm({
46011
46329
  */
46012
46330
  async executeWorkflow(workflow, jobRegistry, opts = {}) {
46013
46331
  await this.assertMayExecute(workflow.metadata.permissions, workflow.name, opts);
46014
- const runId = (0, import_utils79.randomUUID)();
46332
+ const runId = (0, import_utils81.randomUUID)();
46015
46333
  const runRecord = {
46016
46334
  runId,
46017
46335
  jobId: workflow.metadata.id ?? workflow.name,
@@ -46137,7 +46455,8 @@ var init_job_execution_manager = __esm({
46137
46455
  try {
46138
46456
  const engine = new WorkflowEngine(workflow.metadata, jobRegistry, this.logger, {
46139
46457
  authInfo: opts.authInfo ?? {},
46140
- contextProviders: opts.contextProviders
46458
+ contextProviders: opts.contextProviders,
46459
+ authoritiesContextBuilder: opts.authoritiesContextBuilder
46141
46460
  });
46142
46461
  const result = await engine.execute(opts.workflowInput);
46143
46462
  await this.stateStore.updateRun(runId, {
@@ -47914,15 +48233,15 @@ var init_skill_session_types = __esm({
47914
48233
  });
47915
48234
 
47916
48235
  // libs/sdk/src/skill/session/skill-session.manager.ts
47917
- var import_utils80, SkillSessionManager;
48236
+ var import_utils82, SkillSessionManager;
47918
48237
  var init_skill_session_manager = __esm({
47919
48238
  "libs/sdk/src/skill/session/skill-session.manager.ts"() {
47920
48239
  "use strict";
47921
- import_utils80 = require("@frontmcp/utils");
48240
+ import_utils82 = require("@frontmcp/utils");
47922
48241
  init_errors();
47923
48242
  init_skill_session_types();
47924
- SkillSessionManager = class extends import_utils80.EventEmitter {
47925
- storage = new import_utils80.AsyncLocalStorage();
48243
+ SkillSessionManager = class extends import_utils82.EventEmitter {
48244
+ storage = new import_utils82.AsyncLocalStorage();
47926
48245
  options;
47927
48246
  logger;
47928
48247
  store;
@@ -49058,11 +49377,11 @@ function createSkillHttpAuthValidator(skillsConfig, logger) {
49058
49377
  }
49059
49378
  return new SkillHttpAuthValidator({ skillsConfig, logger });
49060
49379
  }
49061
- var import_utils81, SkillHttpAuthValidator;
49380
+ var import_utils83, SkillHttpAuthValidator;
49062
49381
  var init_skill_http_auth = __esm({
49063
49382
  "libs/sdk/src/skill/auth/skill-http-auth.ts"() {
49064
49383
  "use strict";
49065
- import_utils81 = require("@frontmcp/utils");
49384
+ import_utils83 = require("@frontmcp/utils");
49066
49385
  SkillHttpAuthValidator = class {
49067
49386
  skillsConfig;
49068
49387
  logger;
@@ -49139,7 +49458,7 @@ var init_skill_http_auth = __esm({
49139
49458
  const keyBytes = encoder5.encode(key);
49140
49459
  if (keyBytes.length === candidateBytes.length) {
49141
49460
  try {
49142
- if ((0, import_utils81.timingSafeEqual)(keyBytes, candidateBytes)) {
49461
+ if ((0, import_utils83.timingSafeEqual)(keyBytes, candidateBytes)) {
49143
49462
  found = true;
49144
49463
  }
49145
49464
  } catch {
@@ -52105,105 +52424,6 @@ var init_decide_request_intent_utils = __esm({
52105
52424
  }
52106
52425
  });
52107
52426
 
52108
- // libs/sdk/src/common/utils/path.utils.ts
52109
- function normalizeEntryPrefix(entryPath) {
52110
- const t = (0, import_utils82.trimSlashes)(entryPath ?? "");
52111
- return t ? `/${t}` : "";
52112
- }
52113
- function normalizeScopeBase(scopeBase) {
52114
- const t = (0, import_utils82.trimSlashes)(scopeBase ?? "");
52115
- return t ? `/${t}` : "";
52116
- }
52117
- function readPublicUrlPin() {
52118
- try {
52119
- if (typeof process !== "undefined" && process.env) {
52120
- const v = process.env["FRONTMCP_PUBLIC_URL"];
52121
- if (typeof v === "string" && v.trim()) {
52122
- return v.trim().replace(/\/+$/, "");
52123
- }
52124
- }
52125
- } catch {
52126
- }
52127
- return void 0;
52128
- }
52129
- function isPublicUrlPinned() {
52130
- return readPublicUrlPin() !== void 0;
52131
- }
52132
- function isProxyTrusted() {
52133
- try {
52134
- if (typeof process !== "undefined" && process.env) {
52135
- const v = process.env["FRONTMCP_TRUST_PROXY"];
52136
- return typeof v === "string" && /^(1|true|yes|on)$/i.test(v.trim());
52137
- }
52138
- } catch {
52139
- }
52140
- return false;
52141
- }
52142
- function getRequestBaseUrl(req, entryPath) {
52143
- const pin = readPublicUrlPin();
52144
- if (pin) {
52145
- return `${pin}${entryPath ?? ""}`;
52146
- }
52147
- const trustProxy = isProxyTrusted();
52148
- const fwdProto = trustProxy ? req.headers["x-forwarded-proto"] : void 0;
52149
- const fwdHost = trustProxy ? req.headers["x-forwarded-host"] : void 0;
52150
- const proto = fwdProto || req.protocol || "http";
52151
- const host = fwdHost || req.headers["host"];
52152
- return `${proto}://${host}${entryPath ?? ""}`;
52153
- }
52154
- function computeIssuer(req, entryPath, scopeBase) {
52155
- const entryPrefix = normalizeEntryPrefix(entryPath);
52156
- const scope = normalizeScopeBase(scopeBase);
52157
- return `${getRequestBaseUrl(req)}${entryPrefix}${scope}`;
52158
- }
52159
- function computeResource(req, entryPath, scopeBase) {
52160
- const entryPrefix = normalizeEntryPrefix(entryPath);
52161
- const scope = normalizeScopeBase(scopeBase);
52162
- return `${getRequestBaseUrl(req)}${entryPrefix}${scope}`;
52163
- }
52164
- function normalizeResourceUri(uri) {
52165
- try {
52166
- const url = new URL(uri);
52167
- let normalized = `${url.protocol}//${url.hostname}`;
52168
- const isDefaultPort = url.protocol === "https:" && url.port === "443" || url.protocol === "http:" && url.port === "80";
52169
- if (url.port && !isDefaultPort) {
52170
- normalized += `:${url.port}`;
52171
- }
52172
- let path3 = url.pathname;
52173
- if (path3.length > 1 && path3.endsWith("/")) {
52174
- path3 = path3.slice(0, -1);
52175
- }
52176
- normalized += path3;
52177
- return normalized;
52178
- } catch {
52179
- return uri;
52180
- }
52181
- }
52182
- function resourceUriMatches(provided, canonical) {
52183
- return normalizeResourceUri(provided) === normalizeResourceUri(canonical);
52184
- }
52185
- function urlToSafeId(url) {
52186
- const u = new URL(url);
52187
- const raw = (u.host + (u.pathname && u.pathname !== "/" ? u.pathname : "")).replace(/\/+$/, "");
52188
- return (0, import_utils82.trimSlashes)(raw).replace(/[^a-zA-Z0-9_-]/g, "-");
52189
- }
52190
- function makeWellKnownPaths(name42, entryPrefix, scopeBase = "") {
52191
- const prefix = normalizeEntryPrefix(entryPrefix);
52192
- const scope = normalizeScopeBase(scopeBase);
52193
- const reversed = (0, import_utils82.joinPath)(".well-known", name42) + `${prefix}${scope}`;
52194
- const inPrefixRoot = `${prefix}${(0, import_utils82.joinPath)(".well-known", name42)}${scope}`;
52195
- const inPrefixScope = `${prefix}${scope}${(0, import_utils82.joinPath)(".well-known", name42)}`;
52196
- return /* @__PURE__ */ new Set([reversed, inPrefixRoot, inPrefixScope]);
52197
- }
52198
- var import_utils82, import_utils83;
52199
- var init_path_utils = __esm({
52200
- "libs/sdk/src/common/utils/path.utils.ts"() {
52201
- "use strict";
52202
- import_utils82 = require("@frontmcp/utils");
52203
- import_utils83 = require("@frontmcp/utils");
52204
- }
52205
- });
52206
-
52207
52427
  // libs/sdk/src/common/utils/global-config.utils.ts
52208
52428
  function getGlobalStoreConfig(pluginName, config) {
52209
52429
  if (!config.redis) {
@@ -52307,14 +52527,14 @@ var init_primary_auth_provider_interface = __esm({
52307
52527
  * to ensure consistent provider IDs across the system.
52308
52528
  */
52309
52529
  deriveId(options) {
52310
- if ((0, import_auth10.isPublicMode)(options)) {
52530
+ if ((0, import_auth11.isPublicMode)(options)) {
52311
52531
  return options.issuer ?? "public";
52312
52532
  }
52313
- if ((0, import_auth10.isTransparentMode)(options)) {
52533
+ if ((0, import_auth11.isTransparentMode)(options)) {
52314
52534
  return options.providerConfig?.id ?? urlToSafeId(options.provider);
52315
52535
  }
52316
- if ((0, import_auth10.isOrchestratedMode)(options)) {
52317
- if ((0, import_auth10.isOrchestratedRemote)(options)) {
52536
+ if ((0, import_auth11.isOrchestratedMode)(options)) {
52537
+ if ((0, import_auth11.isOrchestratedRemote)(options)) {
52318
52538
  return options.providerConfig?.id ?? urlToSafeId(options.provider);
52319
52539
  }
52320
52540
  return options.local?.issuer ?? "local";
@@ -52537,7 +52757,7 @@ async function tryResolvedSubFile(instance, kind, tail) {
52537
52757
  return parseSkillMdFrontmatter(inline).body;
52538
52758
  }
52539
52759
  const absolutePath = entry.path;
52540
- const resolvedPath = resolveEntryPath(instance, kind, absolutePath, filename);
52760
+ const resolvedPath = resolveEntryPath2(instance, kind, absolutePath, filename);
52541
52761
  if (!resolvedPath) continue;
52542
52762
  try {
52543
52763
  const buf = await (0, import_utils85.readFileBuffer)(resolvedPath);
@@ -52552,7 +52772,7 @@ async function tryResolvedSubFile(instance, kind, tail) {
52552
52772
  }
52553
52773
  return void 0;
52554
52774
  }
52555
- function resolveEntryPath(instance, kind, absolutePath, filename) {
52775
+ function resolveEntryPath2(instance, kind, absolutePath, filename) {
52556
52776
  if (absolutePath && (0, import_utils85.isAbsolute)(absolutePath)) return absolutePath;
52557
52777
  if (!filename) return void 0;
52558
52778
  const baseDir = instance.getBaseDir();
@@ -57407,11 +57627,11 @@ function parseUserScopes(user) {
57407
57627
  const s = user?.scope;
57408
57628
  return typeof s === "string" ? s.split(/\s+/).filter(Boolean) : [];
57409
57629
  }
57410
- var import_auth39, import_lazy_zod106, import_utils96, plan40, httpRequestStateSchema, name41, Stage41, HttpRequestFlow;
57630
+ var import_auth40, import_lazy_zod106, import_utils96, plan40, httpRequestStateSchema, name41, Stage41, HttpRequestFlow;
57411
57631
  var init_http_request_flow = __esm({
57412
57632
  "libs/sdk/src/scope/flows/http.request.flow.ts"() {
57413
57633
  "use strict";
57414
- import_auth39 = require("@frontmcp/auth");
57634
+ import_auth40 = require("@frontmcp/auth");
57415
57635
  import_lazy_zod106 = require("@frontmcp/lazy-zod");
57416
57636
  import_utils96 = require("@frontmcp/utils");
57417
57637
  init_session_verify_flow();
@@ -57516,13 +57736,28 @@ var init_http_request_flow = __esm({
57516
57736
  }
57517
57737
  async acquireQuota() {
57518
57738
  const manager = this.scope.rateLimitManager;
57519
- if (!manager?.config?.global) return;
57739
+ if (!manager) return;
57520
57740
  const context = this.tryGetContext();
57521
57741
  const partitionCtx = context ? {
57522
57742
  sessionId: context.sessionId,
57523
57743
  clientIp: context.metadata?.clientIp,
57524
57744
  userId: context.authInfo?.clientId
57525
57745
  } : void 0;
57746
+ const ipResult = manager.checkIpFilter(partitionCtx?.clientIp);
57747
+ if (ipResult && !ipResult.allowed) {
57748
+ this.logger.warn(`[${this.requestId}] request rejected by ipFilter`, { reason: ipResult.reason });
57749
+ this.respond(
57750
+ httpRespond.json(
57751
+ {
57752
+ jsonrpc: "2.0",
57753
+ error: { code: -32001, message: "Forbidden: client IP rejected by ipFilter" }
57754
+ },
57755
+ { status: 403 }
57756
+ )
57757
+ );
57758
+ return;
57759
+ }
57760
+ if (!manager.config?.global) return;
57526
57761
  const result = await manager.checkGlobalRateLimit(partitionCtx);
57527
57762
  if (!result.allowed) {
57528
57763
  const retryAfter = Math.ceil((result.retryAfterMs ?? 6e4) / 1e3);
@@ -57605,20 +57840,20 @@ var init_http_request_flow = __esm({
57605
57840
  const tokenStore = auth.orchestratedTokenStore;
57606
57841
  let providers;
57607
57842
  try {
57608
- const authorizationId = (0, import_auth39.deriveAuthorizationId)(token);
57843
+ const authorizationId = (0, import_auth40.deriveAuthorizationId)(token);
57609
57844
  const providerIds = await tokenStore.getProviderIds(authorizationId);
57610
57845
  providers = Object.fromEntries(providerIds.map((id) => [id, { id }]));
57611
57846
  } catch (err) {
57612
57847
  this.logger.warn(`[${this.requestId}] failed to load orchestrated providers: ${String(err)}`);
57613
57848
  }
57614
- const authorization = import_auth39.OrchestratedAuthorization.create({
57849
+ const authorization = import_auth40.OrchestratedAuthorization.create({
57615
57850
  token,
57616
57851
  user: { sub: user.sub ?? "unknown", name: user.name, email: user.email, picture: user.picture },
57617
57852
  expiresAt: user.exp ? user.exp * 1e3 : void 0,
57618
57853
  tokenStore,
57619
57854
  providers
57620
57855
  });
57621
- ctx.setContextToken(import_auth39.ORCHESTRATED_AUTH_ACCESSOR, new import_auth39.OrchestratedAuthAccessorAdapter(authorization));
57856
+ ctx.setContextToken(import_auth40.ORCHESTRATED_AUTH_ACCESSOR, new import_auth40.OrchestratedAuthAccessorAdapter(authorization));
57622
57857
  }
57623
57858
  async router() {
57624
57859
  try {
@@ -58143,6 +58378,7 @@ var init_scope_instance = __esm({
58143
58378
  init_channel_scope_helper();
58144
58379
  init_common();
58145
58380
  init_sqlite();
58381
+ init_path_utils();
58146
58382
  init_complete_flow();
58147
58383
  init_context();
58148
58384
  init_elicitation2();
@@ -58243,7 +58479,7 @@ var init_scope_instance = __esm({
58243
58479
  this.logger = globalProviders.get(FrontMcpLogger).child("FrontMcp.MultiAppScope");
58244
58480
  this.globalProviders = globalProviders;
58245
58481
  this.server = this.globalProviders.get(FrontMcpServer);
58246
- this.entryPath = rec.metadata.http?.entryPath ?? "";
58482
+ this.entryPath = resolveEntryPath(rec.metadata.http?.entryPath);
58247
58483
  if (rec.kind === "SPLIT_BY_APP") {
58248
58484
  this.routeBase = `/${rec.metadata.id}`;
58249
58485
  } else {
@@ -58347,16 +58583,25 @@ var init_scope_instance = __esm({
58347
58583
  })() : void 0;
58348
58584
  const tasksConfig = this.metadata.tasks;
58349
58585
  const tasksExplicitlyDisabled = tasksConfig?.enabled === false;
58586
+ const tasksExplicitlyEnabled = tasksConfig?.enabled === true;
58350
58587
  const isTaskWorker = !!this.metadata["__taskWorkerMode"];
58351
58588
  const hasPersistentBackend = Boolean(
58352
58589
  tasksConfig?.sqlite || tasksConfig?.redis || this.metadata.redis || this.metadata.sqlite
58353
58590
  );
58354
58591
  const tasksEnabledForCli = this.cliMode && hasPersistentBackend;
58355
- const shouldInitTasks = !tasksExplicitlyDisabled && (!this.cliMode || tasksEnabledForCli || isTaskWorker);
58592
+ const hasDistributedTaskBackend = Boolean(tasksConfig?.redis ?? this.metadata.redis);
58593
+ const onEdgeRuntime = (0, import_utils97.isEdgeRuntime)();
58594
+ const tasksUnavailableOnEdge = onEdgeRuntime && !hasDistributedTaskBackend && !tasksExplicitlyEnabled;
58595
+ if (tasksUnavailableOnEdge) {
58596
+ this.logger.info(
58597
+ "[tasks] Background tasks are unavailable on this edge/serverless runtime: the in-process runner cannot continue past the HTTP response, and an in-memory store is not shared between isolates. Serving without tasks. Configure `tasks.redis` (Upstash Redis over HTTP works on Workers) to enable them."
58598
+ );
58599
+ }
58600
+ const shouldInitTasks = !tasksExplicitlyDisabled && !tasksUnavailableOnEdge && (!this.cliMode || tasksEnabledForCli || isTaskWorker);
58356
58601
  const tasksPromise = shouldInitTasks ? (async () => {
58357
58602
  const tasksRedis = tasksConfig?.redis ?? this.metadata.redis;
58358
58603
  const tasksSqlite = tasksConfig?.sqlite ?? (tasksRedis ? void 0 : resolvedTopLevelSqlite);
58359
- const onEdge = (0, import_utils97.isEdgeRuntime)();
58604
+ const onEdge = onEdgeRuntime;
58360
58605
  if (onEdge) {
58361
58606
  const msg = "[tasks] Background tasks are enabled on an edge/serverless runtime. The in-process runner cannot continue past the HTTP response on this platform \u2014 task bodies will not execute. Run on a long-lived Node process, or set `tasks.enabled: false`.";
58362
58607
  if (tasksConfig?.strict) {
@@ -60495,7 +60740,7 @@ function createWebFetchHandler(scope, options = {}) {
60495
60740
  while (end > 1 && withSlash.charCodeAt(end - 1) === 47) end--;
60496
60741
  return withSlash.slice(0, end);
60497
60742
  };
60498
- const rawEntry = options.entryPath ?? (normalizeEntryPrefix(httpConfig?.entryPath) || "/");
60743
+ const rawEntry = options.entryPath ?? (normalizeEntryPrefix(resolveEntryPath(httpConfig?.entryPath)) || "/");
60499
60744
  const entryPaths = new Set((Array.isArray(rawEntry) ? rawEntry : [rawEntry]).map(normalizePath));
60500
60745
  const cors2 = options.cors ?? mapHttpCors(httpConfig?.cors, scope);
60501
60746
  const corsEnabled = cors2?.origin !== void 0 && cors2.origin !== false;
@@ -60560,7 +60805,7 @@ function createWebFetchHandler(scope, options = {}) {
60560
60805
  );
60561
60806
  }
60562
60807
  if (!entryPaths.has(normalizePath(url.pathname))) {
60563
- const authResponse = await runMatchingHttpFlowWeb(scope, request);
60808
+ const authResponse = await runMatchingHttpFlowWeb(scope, request, { ctx, env });
60564
60809
  if (authResponse) return withCors(authResponse, request);
60565
60810
  return withCors(Response.json({ error: "Not Found", entryPaths: [...entryPaths] }, { status: 404 }), request);
60566
60811
  }
@@ -60568,13 +60813,13 @@ function createWebFetchHandler(scope, options = {}) {
60568
60813
  const routed = await options.sessionRouter(request, env, ctx);
60569
60814
  if (routed) return withCors(routed, request);
60570
60815
  }
60571
- const rendered = await runHttpRequestFlowWeb(scope, request, { ctx });
60816
+ const rendered = await runHttpRequestFlowWeb(scope, request, { ctx, env });
60572
60817
  return withCors(rendered ?? Response.json({ error: "Not Found" }, { status: 404 }), request);
60573
60818
  };
60574
60819
  }
60575
60820
  async function runHttpRequestFlowWeb(scope, request, opts = {}) {
60576
60821
  const url = new URL(request.url);
60577
- const serverRequest = await toServerRequest(request, url, opts.ctx, opts.persistent);
60822
+ const serverRequest = await toServerRequest(request, url, opts.ctx, opts.persistent, opts.env);
60578
60823
  let output;
60579
60824
  try {
60580
60825
  output = await scope.runFlow("http:request", {
@@ -60586,9 +60831,9 @@ async function runHttpRequestFlowWeb(scope, request, opts = {}) {
60586
60831
  }
60587
60832
  return output ? renderHttpOutputToWebResponse(output) : void 0;
60588
60833
  }
60589
- async function runMatchingHttpFlowWeb(scope, request) {
60834
+ async function runMatchingHttpFlowWeb(scope, request, opts = {}) {
60590
60835
  const url = new URL(request.url);
60591
- const serverRequest = await toServerRequest(request, url);
60836
+ const serverRequest = await toServerRequest(request, url, opts.ctx, void 0, opts.env);
60592
60837
  const flowName = await scope.findHttpFlowName(serverRequest);
60593
60838
  if (!flowName) return void 0;
60594
60839
  let output;
@@ -60602,7 +60847,7 @@ async function runMatchingHttpFlowWeb(scope, request) {
60602
60847
  }
60603
60848
  return output ? renderHttpOutputToWebResponse(output) : void 0;
60604
60849
  }
60605
- async function toServerRequest(request, url, ctx, persistent) {
60850
+ async function toServerRequest(request, url, ctx, persistent, env) {
60606
60851
  const headers = {};
60607
60852
  request.headers.forEach((v, k) => {
60608
60853
  headers[k] = v;
@@ -60646,10 +60891,39 @@ async function toServerRequest(request, url, ctx, persistent) {
60646
60891
  const tokenized = serverRequest;
60647
60892
  tokenized[ServerRequestTokens.webRequest] = webRequest;
60648
60893
  tokenized[ServerRequestTokens.webCtx] = ctx;
60894
+ tokenized[ServerRequestTokens.webEnv] = env;
60649
60895
  if (persistent) tokenized[ServerRequestTokens.webTransport] = persistent;
60650
60896
  return serverRequest;
60651
60897
  }
60898
+ function misconfigurationResponse(error) {
60899
+ const misconfiguration = findMisconfiguration(error);
60900
+ if (!misconfiguration) return void 0;
60901
+ return Response.json(
60902
+ { error: "server_misconfigured", code: misconfiguration.code, message: misconfiguration.remedy },
60903
+ { status: 500 }
60904
+ );
60905
+ }
60906
+ function findMisconfiguration(error) {
60907
+ let current = error;
60908
+ for (let depth = 0; current instanceof Error && depth < 5; depth++) {
60909
+ const code = current.code;
60910
+ if (typeof code === "string" && MISCONFIGURATION_REMEDIES[code]) {
60911
+ return { code, remedy: MISCONFIGURATION_REMEDIES[code] };
60912
+ }
60913
+ current = current.cause;
60914
+ }
60915
+ return void 0;
60916
+ }
60652
60917
  function flowErrorToHttpOutput(error) {
60918
+ const misconfiguration = findMisconfiguration(error);
60919
+ if (misconfiguration) {
60920
+ return {
60921
+ kind: "json",
60922
+ status: 500,
60923
+ contentType: "application/json; charset=utf-8",
60924
+ body: { error: "server_misconfigured", code: misconfiguration.code, message: misconfiguration.remedy }
60925
+ };
60926
+ }
60653
60927
  if (error instanceof FlowControl) {
60654
60928
  switch (error.type) {
60655
60929
  case "respond":
@@ -60673,6 +60947,7 @@ function flowErrorToHttpOutput(error) {
60673
60947
  }
60674
60948
  return { kind: "text", status: 500, body: "Internal Server Error", contentType: "text/plain; charset=utf-8" };
60675
60949
  }
60950
+ var MISCONFIGURATION_REMEDIES;
60676
60951
  var init_web_fetch_handler = __esm({
60677
60952
  "libs/sdk/src/transport/web-fetch-handler.ts"() {
60678
60953
  "use strict";
@@ -60682,6 +60957,11 @@ var init_web_fetch_handler = __esm({
60682
60957
  init_errors();
60683
60958
  init_host_validation();
60684
60959
  init_web_response_renderer();
60960
+ MISCONFIGURATION_REMEDIES = {
60961
+ SESSION_SECRET_REQUIRED: "Set MCP_SESSION_SECRET in the deployment environment (e.g. `wrangler secret put MCP_SESSION_SECRET`). Session IDs are encrypted with it, and production refuses the development machine-id fallback.",
60962
+ JWT_SECRET_INVALID: "JWT_SECRET is present but too weak: HS256 requires at least 32 bytes (RFC 7518). Replace it with `openssl rand -hex 32`.",
60963
+ JWT_SECRET_REQUIRED: "Set JWT_SECRET in the deployment environment (e.g. `wrangler secret put JWT_SECRET`). Tokens are signed with it; production refuses the random per-process fallback because tokens would not survive a restart or verify across instances."
60964
+ };
60685
60965
  }
60686
60966
  });
60687
60967
 
@@ -61035,17 +61315,16 @@ var init_express_host_adapter = __esm({
61035
61315
  });
61036
61316
  } else {
61037
61317
  this.deriveHostValidation = (portOrSocketPath, bindAddress) => {
61038
- const isSocket = typeof portOrSocketPath === "string";
61318
+ if (typeof portOrSocketPath === "string") return void 0;
61039
61319
  const derivation = {
61040
61320
  // `start()` binds `bindAddress ?? '0.0.0.0'`; mirror that exactly.
61041
- bindAddress: isSocket ? void 0 : bindAddress ?? "0.0.0.0",
61042
- port: isSocket ? void 0 : portOrSocketPath,
61043
- socketPath: isSocket ? portOrSocketPath : void 0,
61321
+ bindAddress: bindAddress ?? "0.0.0.0",
61322
+ port: portOrSocketPath,
61044
61323
  issuer: options?.listen?.issuer
61045
61324
  };
61046
61325
  if (!shouldEnforceDerivedHosts(derivation)) {
61047
61326
  console.warn(
61048
- `[frontmcp] DNS-rebinding protection is not enforcing a Host allow-list: the server binds a routable address (${derivation.bindAddress ?? "unknown"}) and no allowed hosts are configured. Set security.dnsRebindingProtection.allowedHosts (or FRONTMCP_ALLOWED_HOSTS) to your public hostname(s).`
61327
+ `[frontmcp] DNS-rebinding protection is not enforcing a Host allow-list: the server binds a routable address (${derivation.bindAddress}) and no allowed hosts are configured. Set security.dnsRebindingProtection.allowedHosts (or FRONTMCP_ALLOWED_HOSTS) to your public hostname(s).`
61049
61328
  );
61050
61329
  return void 0;
61051
61330
  }
@@ -61101,7 +61380,6 @@ var init_express_host_adapter = __esm({
61101
61380
  return this.app;
61102
61381
  }
61103
61382
  async start(portOrSocketPath, bindAddress) {
61104
- this.enableDerivedHostValidation(portOrSocketPath, bindAddress);
61105
61383
  this.prepare();
61106
61384
  const server = http.createServer(this.app);
61107
61385
  server.requestTimeout = 0;
@@ -61109,6 +61387,7 @@ var init_express_host_adapter = __esm({
61109
61387
  server.keepAliveTimeout = 75e3;
61110
61388
  if (typeof portOrSocketPath === "string") {
61111
61389
  await this.cleanupStaleSocket(portOrSocketPath);
61390
+ this.enableDerivedHostValidation(portOrSocketPath);
61112
61391
  await new Promise((resolve, reject) => {
61113
61392
  server.on("error", reject);
61114
61393
  server.listen(portOrSocketPath, () => {
@@ -61126,7 +61405,11 @@ var init_express_host_adapter = __esm({
61126
61405
  await new Promise((resolve, reject) => {
61127
61406
  server.on("error", reject);
61128
61407
  server.listen(portOrSocketPath, host, () => {
61129
- console.log(`MCP HTTP (Express) on ${host}:${portOrSocketPath}`);
61408
+ const bound = server.address();
61409
+ const boundPort = typeof bound === "object" && bound ? bound.port : portOrSocketPath;
61410
+ const boundAddress = typeof bound === "object" && bound ? bound.address : host;
61411
+ this.enableDerivedHostValidation(boundPort, boundAddress);
61412
+ console.log(`MCP HTTP (Express) on ${host}:${boundPort}`);
61130
61413
  resolve();
61131
61414
  });
61132
61415
  });
@@ -61528,7 +61811,7 @@ var init_front_mcp = __esm({
61528
61811
  frontMcp.log?.info("FrontMCP fetch handler created (web-standard transport)");
61529
61812
  return createWebFetchHandler(scope);
61530
61813
  };
61531
- return async (request) => {
61814
+ return async (request, ctx, env) => {
61532
61815
  if (!inner) {
61533
61816
  if (!building) {
61534
61817
  building = build().catch((err) => {
@@ -61536,9 +61819,15 @@ var init_front_mcp = __esm({
61536
61819
  throw err;
61537
61820
  });
61538
61821
  }
61539
- inner = await building;
61822
+ try {
61823
+ inner = await building;
61824
+ } catch (err) {
61825
+ const misconfigured = misconfigurationResponse(err);
61826
+ if (misconfigured) return misconfigured;
61827
+ throw err;
61828
+ }
61540
61829
  }
61541
- return inner(request);
61830
+ return inner(request, ctx, env);
61542
61831
  };
61543
61832
  }
61544
61833
  /**
@@ -63946,7 +64235,7 @@ __export(index_exports, {
63946
64235
  AuthProviderEntry: () => AuthProviderEntry,
63947
64236
  AuthProviderKind: () => AuthProviderKind,
63948
64237
  AuthProviderScope: () => AuthProviderScope,
63949
- AuthProvidersNotConfiguredError: () => import_auth11.AuthProvidersNotConfiguredError,
64238
+ AuthProvidersNotConfiguredError: () => import_auth12.AuthProvidersNotConfiguredError,
63950
64239
  AuthorizationRequiredError: () => AuthorizationRequiredError,
63951
64240
  BaseConfig: () => BaseConfig,
63952
64241
  BaseEntry: () => BaseEntry,
@@ -63975,7 +64264,7 @@ __export(index_exports, {
63975
64264
  ConfigValidationError: () => ConfigValidationError,
63976
64265
  Context: () => FrontMcpContext,
63977
64266
  ContextExtensionNotAvailableError: () => ContextExtensionNotAvailableError,
63978
- CredentialProviderAlreadyRegisteredError: () => import_auth11.CredentialProviderAlreadyRegisteredError,
64267
+ CredentialProviderAlreadyRegisteredError: () => import_auth12.CredentialProviderAlreadyRegisteredError,
63979
64268
  DEFAULT_ELICITATION_OPTIONS: () => DEFAULT_ELICITATION_OPTIONS,
63980
64269
  DEFAULT_ELICIT_TTL: () => DEFAULT_ELICIT_TTL,
63981
64270
  DEFAULT_FALLBACK_WAIT_TTL: () => DEFAULT_FALLBACK_WAIT_TTL,
@@ -64000,14 +64289,14 @@ __export(index_exports, {
64000
64289
  ElicitationEncryptionError: () => ElicitationEncryptionError,
64001
64290
  ElicitationFallbackRequired: () => ElicitationFallbackRequired,
64002
64291
  ElicitationNotSupportedError: () => ElicitationNotSupportedError,
64003
- ElicitationSecretRequiredError: () => import_auth11.ElicitationSecretRequiredError,
64292
+ ElicitationSecretRequiredError: () => import_auth12.ElicitationSecretRequiredError,
64004
64293
  ElicitationStoreNotInitializedError: () => ElicitationStoreNotInitializedError,
64005
64294
  ElicitationSubscriptionError: () => ElicitationSubscriptionError,
64006
64295
  ElicitationTimeoutError: () => ElicitationTimeoutError,
64007
64296
  EnclaveExecutionError: () => EnclaveExecutionError,
64008
64297
  EncryptedElicitationStore: () => EncryptedElicitationStore,
64009
- EncryptionContextNotSetError: () => import_auth11.EncryptionContextNotSetError,
64010
- EncryptionKeyNotConfiguredError: () => import_auth11.EncryptionKeyNotConfiguredError,
64298
+ EncryptionContextNotSetError: () => import_auth12.EncryptionContextNotSetError,
64299
+ EncryptionKeyNotConfiguredError: () => import_auth12.EncryptionKeyNotConfiguredError,
64011
64300
  EntryUnavailableError: () => EntryUnavailableError,
64012
64301
  EntryValidationError: () => EntryValidationError,
64013
64302
  ErrorHandler: () => ErrorHandler,
@@ -64115,8 +64404,8 @@ __export(index_exports, {
64115
64404
  HttpTextSchema: () => HttpTextSchema,
64116
64405
  HttpWebResponseSchema: () => HttpWebResponseSchema,
64117
64406
  ImageOutputSchema: () => ImageOutputSchema,
64118
- InMemoryOrchestratedTokenStore: () => import_auth41.InMemoryOrchestratedTokenStore,
64119
- InMemoryStoreRequiredError: () => import_auth11.InMemoryStoreRequiredError,
64407
+ InMemoryOrchestratedTokenStore: () => import_auth42.InMemoryOrchestratedTokenStore,
64408
+ InMemoryStoreRequiredError: () => import_auth12.InMemoryStoreRequiredError,
64120
64409
  InProcessTaskRunner: () => InProcessTaskRunner,
64121
64410
  InputRequiredSignal: () => InputRequiredSignal,
64122
64411
  InternalMcpError: () => InternalMcpError,
@@ -64149,6 +64438,8 @@ __export(index_exports, {
64149
64438
  JobNotAuthorizedError: () => JobNotAuthorizedError,
64150
64439
  JobPermissionGuard: () => JobPermissionGuard,
64151
64440
  JobRegistry: () => JobRegistry,
64441
+ JwtSecretRequiredError: () => import_auth12.JwtSecretRequiredError,
64442
+ JwtSecretWeakError: () => import_auth12.JwtSecretWeakError,
64152
64443
  LLM_ADAPTER: () => LLM_ADAPTER,
64153
64444
  LazyZodSchema: () => import_lazy_zod110.LazyZodSchema,
64154
64445
  ListJobsTool: () => ListJobsTool,
@@ -64178,15 +64469,15 @@ __export(index_exports, {
64178
64469
  NEVER: () => import_lazy_zod110.NEVER,
64179
64470
  NO_BODY_STATUSES: () => NO_BODY_STATUSES,
64180
64471
  NameDisambiguationError: () => NameDisambiguationError,
64181
- NoProviderIdError: () => import_auth11.NoProviderIdError,
64472
+ NoProviderIdError: () => import_auth12.NoProviderIdError,
64182
64473
  OAuthAuthorizeHook: () => OAuthAuthorizeHook,
64183
64474
  OAuthCallbackHook: () => OAuthCallbackHook,
64184
64475
  OAuthRegisterHook: () => OAuthRegisterHook,
64185
64476
  OAuthTokenHook: () => OAuthTokenHook,
64186
64477
  OUTPUT_SCHEMA_MODES: () => OUTPUT_SCHEMA_MODES,
64187
64478
  OpenAIAdapter: () => OpenAIAdapter,
64188
- OrchestratedAuthNotAvailableError: () => import_auth11.OrchestratedAuthNotAvailableError,
64189
- OrchestratorJwksNotAvailableError: () => import_auth11.OrchestratorJwksNotAvailableError,
64479
+ OrchestratedAuthNotAvailableError: () => import_auth12.OrchestratedAuthNotAvailableError,
64480
+ OrchestratorJwksNotAvailableError: () => import_auth12.OrchestratorJwksNotAvailableError,
64190
64481
  PLATFORM_CLIENT_INFO: () => PLATFORM_CLIENT_INFO,
64191
64482
  PRIMITIVE_FILTER_KEYS: () => PRIMITIVE_FILTER_KEYS,
64192
64483
  PROTOCOL_2026_07_28: () => import_protocol57.PROTOCOL_2026_07_28,
@@ -64262,7 +64553,7 @@ __export(index_exports, {
64262
64553
  SCHEMA_DESCRIPTION_FORMATS: () => SCHEMA_DESCRIPTION_FORMATS,
64263
64554
  SamplingNotAvailableError: () => SamplingNotAvailableError,
64264
64555
  ScopeConfigurationError: () => ScopeConfigurationError,
64265
- ScopeDeniedError: () => import_auth11.ScopeDeniedError,
64556
+ ScopeDeniedError: () => import_auth12.ScopeDeniedError,
64266
64557
  ScopeEntry: () => ScopeEntry,
64267
64558
  ScopeKind: () => ScopeKind,
64268
64559
  ServerNotFoundError: () => ServerNotFoundError,
@@ -64272,9 +64563,9 @@ __export(index_exports, {
64272
64563
  ServerlessHandlerNotInitializedError: () => ServerlessHandlerNotInitializedError,
64273
64564
  SessionClaimConflictError: () => SessionClaimConflictError,
64274
64565
  SessionHookStage: () => SessionHookStage,
64275
- SessionIdEmptyError: () => import_auth11.SessionIdEmptyError,
64566
+ SessionIdEmptyError: () => import_auth12.SessionIdEmptyError,
64276
64567
  SessionMissingError: () => SessionMissingError,
64277
- SessionSecretRequiredError: () => import_auth11.SessionSecretRequiredError,
64568
+ SessionSecretRequiredError: () => import_auth12.SessionSecretRequiredError,
64278
64569
  SessionVerificationFailedError: () => SessionVerificationFailedError,
64279
64570
  Skill: () => Skill,
64280
64571
  SkillContext: () => SkillContext,
@@ -64306,9 +64597,9 @@ __export(index_exports, {
64306
64597
  TasksGetFlow: () => TasksGetFlow,
64307
64598
  TasksListFlow: () => TasksListFlow,
64308
64599
  TasksResultFlow: () => TasksResultFlow,
64309
- TokenLeakDetectedError: () => import_auth11.TokenLeakDetectedError,
64310
- TokenNotAvailableError: () => import_auth11.TokenNotAvailableError,
64311
- TokenStoreRequiredError: () => import_auth11.TokenStoreRequiredError,
64600
+ TokenLeakDetectedError: () => import_auth12.TokenLeakDetectedError,
64601
+ TokenNotAvailableError: () => import_auth12.TokenNotAvailableError,
64602
+ TokenStoreRequiredError: () => import_auth12.TokenStoreRequiredError,
64312
64603
  Tool: () => FrontMcpTool,
64313
64604
  ToolContext: () => ToolContext,
64314
64605
  ToolCredentialsRequiredError: () => ToolCredentialsRequiredError,
@@ -64330,8 +64621,8 @@ __export(index_exports, {
64330
64621
  UnsupportedContentTypeError: () => UnsupportedContentTypeError,
64331
64622
  UnsupportedHookOwnerKindError: () => UnsupportedHookOwnerKindError,
64332
64623
  UnsupportedTransportTypeError: () => UnsupportedTransportTypeError,
64333
- VaultLoadError: () => import_auth11.VaultLoadError,
64334
- VaultNotFoundError: () => import_auth11.VaultNotFoundError,
64624
+ VaultLoadError: () => import_auth12.VaultLoadError,
64625
+ VaultNotFoundError: () => import_auth12.VaultNotFoundError,
64335
64626
  VercelKvAsyncInitRequiredError: () => VercelKvAsyncInitRequiredError,
64336
64627
  VercelKvNotSupportedError: () => VercelKvNotSupportedError,
64337
64628
  VersionPoller: () => VersionPoller,
@@ -64378,7 +64669,7 @@ __export(index_exports, {
64378
64669
  ZodVoid: () => import_lazy_zod110.ZodVoid,
64379
64670
  agent: () => frontMcpAgent,
64380
64671
  aiPlatformTypeSchema: () => import_auth3.aiPlatformTypeSchema,
64381
- allowsPublicAccess: () => import_auth10.allowsPublicAccess,
64672
+ allowsPublicAccess: () => import_auth11.allowsPublicAccess,
64382
64673
  annotatedFrontMcpAdaptersSchema: () => annotatedFrontMcpAdaptersSchema,
64383
64674
  annotatedFrontMcpAgentsSchema: () => annotatedFrontMcpAgentsSchema,
64384
64675
  annotatedFrontMcpAppSchema: () => annotatedFrontMcpAppSchema,
@@ -64394,11 +64685,11 @@ __export(index_exports, {
64394
64685
  annotatedFrontMcpToolsSchema: () => annotatedFrontMcpToolsSchema,
64395
64686
  annotatedFrontMcpWorkflowsSchema: () => annotatedFrontMcpWorkflowsSchema,
64396
64687
  app: () => frontMcpApp,
64397
- appAuthOptionsSchema: () => import_auth9.appAuthOptionsSchema,
64688
+ appAuthOptionsSchema: () => import_auth10.appAuthOptionsSchema,
64398
64689
  appFilterConfigSchema: () => appFilterConfigSchema,
64399
64690
  applyPrimitiveFilter: () => applyPrimitiveFilter,
64400
- authOptionsSchema: () => import_auth8.authOptionsSchema,
64401
- authenticateFnSchema: () => import_auth7.authenticateFnSchema,
64691
+ authOptionsSchema: () => import_auth9.authOptionsSchema,
64692
+ authenticateFnSchema: () => import_auth8.authenticateFnSchema,
64402
64693
  authorizationRequiredDataSchema: () => authorizationRequiredDataSchema,
64403
64694
  authorizationRequiredMetaSchema: () => authorizationRequiredMetaSchema,
64404
64695
  authorizationRequiredParamsSchema: () => authorizationRequiredParamsSchema,
@@ -64570,32 +64861,34 @@ __export(index_exports, {
64570
64861
  isFileInstructions: () => isFileInstructions,
64571
64862
  isInlineInstructions: () => isInlineInstructions,
64572
64863
  isLazy: () => import_lazy_zod110.isLazy,
64573
- isLocalMode: () => import_auth10.isLocalMode,
64864
+ isLocalMode: () => import_auth11.isLocalMode,
64574
64865
  isNewerVersion: () => isNewerVersion,
64575
- isOrchestratedLocal: () => import_auth10.isOrchestratedLocal,
64576
- isOrchestratedMode: () => import_auth10.isOrchestratedMode,
64577
- isOrchestratedRemote: () => import_auth10.isOrchestratedRemote,
64866
+ isOrchestratedLocal: () => import_auth11.isOrchestratedLocal,
64867
+ isOrchestratedMode: () => import_auth11.isOrchestratedMode,
64868
+ isOrchestratedRemote: () => import_auth11.isOrchestratedRemote,
64578
64869
  isPackageSpecifier: () => isPackageSpecifier,
64870
+ isProxyTrusted: () => isProxyTrusted,
64579
64871
  isPublicError: () => isPublicError,
64580
- isPublicMode: () => import_auth10.isPublicMode,
64872
+ isPublicMode: () => import_auth11.isPublicMode,
64581
64873
  isPublicUrlPinned: () => isPublicUrlPinned,
64582
64874
  isPubsubConfigured: () => isPubsubConfigured,
64583
64875
  isRedisProvider: () => isRedisProvider,
64584
- isRemoteMode: () => import_auth10.isRemoteMode,
64876
+ isRemoteMode: () => import_auth11.isRemoteMode,
64585
64877
  isSkillDecorated: () => isSkillDecorated,
64586
64878
  isSkillRecord: () => isSkillRecord,
64879
+ isStaticMode: () => import_auth11.isStaticMode,
64587
64880
  isTaskWorkerProcess: () => isTaskWorkerProcess,
64588
64881
  isTerminal: () => isTerminal,
64589
64882
  isToolRefWithClass: () => isToolRefWithClass,
64590
64883
  isToolRefWithName: () => isToolRefWithName,
64591
64884
  isTransientError: () => isTransientError,
64592
- isTransparentMode: () => import_auth10.isTransparentMode,
64885
+ isTransparentMode: () => import_auth11.isTransparentMode,
64593
64886
  isUrlInstructions: () => isUrlInstructions,
64594
64887
  isValidRange: () => isValidRange,
64595
64888
  isValidVersion: () => isValidVersion,
64596
64889
  isVercelKvProvider: () => isVercelKvProvider,
64597
64890
  job: () => frontMcpJob,
64598
- joinPath: () => import_utils83.joinPath,
64891
+ joinPath: () => import_utils48.joinPath,
64599
64892
  jsonWebKeySetSchema: () => import_auth.jsonWebKeySetSchema,
64600
64893
  jwkParametersSchema: () => import_auth.jwkParametersSchema,
64601
64894
  jwkSchema: () => import_auth.jwkSchema,
@@ -64603,12 +64896,12 @@ __export(index_exports, {
64603
64896
  loadConfig: () => loadConfig,
64604
64897
  loadEnvFiles: () => loadEnvFiles,
64605
64898
  loadSkillDirectory: () => loadSkillDirectory,
64606
- localAuthSchema: () => import_auth7.localAuthSchema,
64899
+ localAuthSchema: () => import_auth8.localAuthSchema,
64607
64900
  localDcrClientSchema: () => import_auth4.localDcrClientSchema,
64608
64901
  localDcrConfigSchema: () => import_auth4.localDcrConfigSchema,
64609
64902
  localSigningConfigSchema: () => import_auth4.localSigningConfigSchema,
64610
64903
  loggingOptionsSchema: () => loggingOptionsSchema,
64611
- loginConfigSchema: () => import_auth7.loginConfigSchema,
64904
+ loginConfigSchema: () => import_auth8.loginConfigSchema,
64612
64905
  makeWellKnownPaths: () => makeWellKnownPaths,
64613
64906
  mapEnvToNestedConfig: () => mapEnvToNestedConfig,
64614
64907
  maxSatisfying: () => maxSatisfying2,
@@ -64628,12 +64921,12 @@ __export(index_exports, {
64628
64921
  normalizeToolAuthProviders: () => normalizeToolAuthProviders,
64629
64922
  normalizeToolRef: () => normalizeToolRef,
64630
64923
  observabilityOptionsSchema: () => observabilityOptionsSchema,
64631
- orchestratedLocalSchema: () => import_auth7.orchestratedLocalSchema,
64632
- orchestratedRemoteSchema: () => import_auth7.orchestratedRemoteSchema,
64924
+ orchestratedLocalSchema: () => import_auth8.orchestratedLocalSchema,
64925
+ orchestratedRemoteSchema: () => import_auth8.orchestratedRemoteSchema,
64633
64926
  outputPolicySchema: () => outputPolicySchema,
64634
64927
  packageLoaderSchema: () => packageLoaderSchema,
64635
64928
  paginationOptionsSchema: () => paginationOptionsSchema,
64636
- parseAuthOptions: () => import_auth10.parseAuthOptions,
64929
+ parseAuthOptions: () => import_auth11.parseAuthOptions,
64637
64930
  parseCallerDir: () => parseCallerDir,
64638
64931
  parseEnvContent: () => parseEnvContent,
64639
64932
  parseEnvContentSync: () => parseEnvContentSync,
@@ -64658,9 +64951,10 @@ __export(index_exports, {
64658
64951
  redisOptionsSchema: () => redisOptionsSchema,
64659
64952
  redisProviderSchema: () => redisProviderSchema,
64660
64953
  registerPendingTC39Hook: () => registerPendingTC39Hook,
64661
- remoteAuthSchema: () => import_auth7.remoteAuthSchema,
64954
+ remoteAuthSchema: () => import_auth8.remoteAuthSchema,
64662
64955
  remoteProviderConfigSchema: () => import_auth4.remoteProviderConfigSchema,
64663
64956
  resolveDefaultSqlitePath: () => resolveDefaultSqlitePath,
64957
+ resolveEntryPath: () => resolveEntryPath,
64664
64958
  resolveNameConflicts: () => resolveNameConflicts,
64665
64959
  resolveOutputSchemaMode: () => resolveOutputSchemaMode,
64666
64960
  resolvePendingTC39HooksForClass: () => resolvePendingTC39HooksForClass,
@@ -64703,6 +64997,7 @@ __export(index_exports, {
64703
64997
  skillsConfigOptionsSchema: () => skillsConfigOptionsSchema,
64704
64998
  skippedAppBehaviorSchema: () => import_auth4.skippedAppBehaviorSchema,
64705
64999
  sqliteOptionsSchema: () => sqliteOptionsSchema,
65000
+ staticAuthOptionsSchema: () => import_auth6.staticAuthOptionsSchema,
64706
65001
  storageProviderSchema: () => storageProviderSchema,
64707
65002
  supportsStreaming: () => supportsStreaming,
64708
65003
  toJSONSchema: () => import_lazy_zod110.toJSONSchema,
@@ -64714,9 +65009,9 @@ __export(index_exports, {
64714
65009
  tokenStorageSqliteSchema: () => import_auth4.tokenStorageSqliteSchema,
64715
65010
  tool: () => frontMcpTool,
64716
65011
  toolPaginationOptionsSchema: () => toolPaginationOptionsSchema,
64717
- transparentAuthOptionsSchema: () => import_auth6.transparentAuthOptionsSchema,
65012
+ transparentAuthOptionsSchema: () => import_auth7.transparentAuthOptionsSchema,
64718
65013
  transportOptionsSchema: () => transportOptionsSchema,
64719
- trimSlashes: () => import_utils83.trimSlashes,
65014
+ trimSlashes: () => import_utils48.trimSlashes,
64720
65015
  tryDecryptStoredValue: () => tryDecryptStoredValue,
64721
65016
  tryGetConfig: () => tryGetConfig,
64722
65017
  upstreamProviderSchema: () => import_auth4.upstreamProviderSchema,
@@ -65053,7 +65348,7 @@ init_mcp_20260728();
65053
65348
  init_mcp_stateless_client_adapter();
65054
65349
  var import_protocol57 = require("@frontmcp/protocol");
65055
65350
  init_ext_apps2();
65056
- var import_auth41 = require("@frontmcp/auth");
65351
+ var import_auth42 = require("@frontmcp/auth");
65057
65352
  (function suppressZodExpressWarning() {
65058
65353
  if (typeof process === "undefined" || typeof process.emitWarning !== "function") return;
65059
65354
  const originalEmitWarning = process.emitWarning.bind(process);
@@ -65318,6 +65613,8 @@ var ChannelListHook = FlowHooksOf("channels:list");
65318
65613
  JobNotAuthorizedError,
65319
65614
  JobPermissionGuard,
65320
65615
  JobRegistry,
65616
+ JwtSecretRequiredError,
65617
+ JwtSecretWeakError,
65321
65618
  LLM_ADAPTER,
65322
65619
  LazyZodSchema,
65323
65620
  ListJobsTool,
@@ -65744,6 +66041,7 @@ var ChannelListHook = FlowHooksOf("channels:list");
65744
66041
  isOrchestratedMode,
65745
66042
  isOrchestratedRemote,
65746
66043
  isPackageSpecifier,
66044
+ isProxyTrusted,
65747
66045
  isPublicError,
65748
66046
  isPublicMode,
65749
66047
  isPublicUrlPinned,
@@ -65752,6 +66050,7 @@ var ChannelListHook = FlowHooksOf("channels:list");
65752
66050
  isRemoteMode,
65753
66051
  isSkillDecorated,
65754
66052
  isSkillRecord,
66053
+ isStaticMode,
65755
66054
  isTaskWorkerProcess,
65756
66055
  isTerminal,
65757
66056
  isToolRefWithClass,
@@ -65829,6 +66128,7 @@ var ChannelListHook = FlowHooksOf("channels:list");
65829
66128
  remoteAuthSchema,
65830
66129
  remoteProviderConfigSchema,
65831
66130
  resolveDefaultSqlitePath,
66131
+ resolveEntryPath,
65832
66132
  resolveNameConflicts,
65833
66133
  resolveOutputSchemaMode,
65834
66134
  resolvePendingTC39HooksForClass,
@@ -65871,6 +66171,7 @@ var ChannelListHook = FlowHooksOf("channels:list");
65871
66171
  skillsConfigOptionsSchema,
65872
66172
  skippedAppBehaviorSchema,
65873
66173
  sqliteOptionsSchema,
66174
+ staticAuthOptionsSchema,
65874
66175
  storageProviderSchema,
65875
66176
  supportsStreaming,
65876
66177
  toJSONSchema,