@frontmcp/sdk 1.9.1-rc.2 → 1.9.1-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/browser/index.cjs CHANGED
@@ -28237,8 +28237,20 @@ function parseEnvContent(content) {
28237
28237
  }
28238
28238
  return result;
28239
28239
  }
28240
+ function canReadConfigFiles() {
28241
+ return (0, import_utils60.getRuntimeContext)().runtime !== "browser";
28242
+ }
28243
+ function processEnvEntries() {
28244
+ const env = {};
28245
+ const processEnv = typeof process === "undefined" ? void 0 : process.env;
28246
+ for (const [key, value] of Object.entries(processEnv ?? {})) {
28247
+ if (value !== void 0) env[key] = value;
28248
+ }
28249
+ return env;
28250
+ }
28240
28251
  async function loadEnvFiles(basePath = (0, import_utils60.getCwd)(), envPath = ".env", localEnvPath = ".env.local") {
28241
28252
  const result = {};
28253
+ if (!canReadConfigFiles()) return result;
28242
28254
  const envFile = (0, import_utils60.pathResolve)(basePath, envPath);
28243
28255
  if (await (0, import_utils60.fileExists)(envFile)) {
28244
28256
  const content = await (0, import_utils60.readFile)(envFile);
@@ -28386,12 +28398,7 @@ async function loadConfig(schema, options = {}) {
28386
28398
  if (shouldPopulate) {
28387
28399
  populateProcessEnv(envFromFiles, false);
28388
28400
  }
28389
- const allEnv = { ...envFromFiles };
28390
- for (const [key, value] of Object.entries(process.env)) {
28391
- if (value !== void 0) {
28392
- allEnv[key] = value;
28393
- }
28394
- }
28401
+ const allEnv = { ...envFromFiles, ...processEnvEntries() };
28395
28402
  const paths = extractSchemaPaths(schema);
28396
28403
  const envConfig = mapEnvToNestedConfig(allEnv, paths);
28397
28404
  config = deepMerge(config, envConfig);
@@ -28403,6 +28410,7 @@ async function loadConfig(schema, options = {}) {
28403
28410
  return result.data;
28404
28411
  }
28405
28412
  async function loadYamlConfig(basePath, configPath) {
28413
+ if (!canReadConfigFiles()) return {};
28406
28414
  const extensions = ["", ".yml", ".yaml"];
28407
28415
  const baseName = configPath.replace(/\.(ya?ml)$/, "");
28408
28416
  for (const ext of extensions) {
@@ -28528,14 +28536,7 @@ var init_config_plugin = __esm({
28528
28536
  const basePath = pluginConfig.basePath ?? (0, import_utils62.getCwd)();
28529
28537
  env = await loadEnvFiles(basePath, pluginConfig.envPath, pluginConfig.localEnvPath);
28530
28538
  }
28531
- const merged = { ...env };
28532
- if (typeof process !== "undefined" && process.env) {
28533
- for (const [key, value] of Object.entries(process.env)) {
28534
- if (value !== void 0 && merged[key] === void 0) {
28535
- merged[key] = value;
28536
- }
28537
- }
28538
- }
28539
+ const merged = { ...processEnvEntries(), ...env };
28539
28540
  if (pluginConfig.populateProcessEnv) {
28540
28541
  populateProcessEnv(env, false);
28541
28542
  }
@@ -32225,52 +32226,17 @@ var init_skill_validation_error = __esm({
32225
32226
  }
32226
32227
  });
32227
32228
 
32228
- // libs/sdk/src/scope/optional-dependency.util.ts
32229
- function probeOptionalDependency(moduleName, loadError, resolve) {
32230
- let resolvedPath;
32231
- try {
32232
- resolvedPath = resolve(moduleName);
32233
- } catch {
32234
- resolvedPath = void 0;
32235
- }
32236
- const error = loadError instanceof Error ? loadError.message : String(loadError);
32237
- return resolvedPath ? { status: "load-failed", resolvedPath, error } : { status: "not-installed", error };
32238
- }
32239
- async function importOptionalPeer(moduleName, importer, resolve, feature) {
32240
- try {
32241
- return await importer();
32242
- } catch (cause) {
32243
- const probe = probeOptionalDependency(moduleName, cause, resolve);
32244
- if (probe.status === "not-installed") {
32245
- throw new Error(
32246
- `@frontmcp/sdk ${feature} needs the optional peer dependency '${moduleName}'. Install it in your project (e.g. \`npm i ${moduleName}\`).`,
32247
- { cause }
32248
- );
32249
- }
32250
- throw new Error(
32251
- `@frontmcp/sdk ${feature} found '${moduleName}' at ${probe.resolvedPath} but it failed to load \u2014 reinstalling will not help. This is usually an export-condition, transpile, or transitive-peer mismatch. Original error: ${probe.error}`,
32252
- { cause }
32253
- );
32254
- }
32255
- }
32256
- var init_optional_dependency_util = __esm({
32257
- "libs/sdk/src/scope/optional-dependency.util.ts"() {
32258
- "use strict";
32259
- }
32260
- });
32261
-
32262
32229
  // libs/sdk/src/skill/providers/memory-skill.provider.ts
32263
32230
  function isSnapshotCapable(db) {
32264
32231
  const d = db;
32265
32232
  return typeof d.toSnapshot === "function" && typeof d.loadSnapshot === "function";
32266
32233
  }
32267
- var import_utils68, STOP_WORDS, MemorySkillProvider;
32234
+ var import_vectoriadb, import_utils68, STOP_WORDS, MemorySkillProvider;
32268
32235
  var init_memory_skill_provider = __esm({
32269
32236
  "libs/sdk/src/skill/providers/memory-skill.provider.ts"() {
32270
32237
  "use strict";
32238
+ import_vectoriadb = require("vectoriadb");
32271
32239
  import_utils68 = require("@frontmcp/utils");
32272
- init_optional_dependency_util();
32273
- init_dynamic_import_utils();
32274
32240
  STOP_WORDS = /* @__PURE__ */ new Set([
32275
32241
  // Articles & Determiners
32276
32242
  "the",
@@ -32345,13 +32311,8 @@ var init_memory_skill_provider = __esm({
32345
32311
  ]);
32346
32312
  MemorySkillProvider = class {
32347
32313
  type = "memory";
32348
- /**
32349
- * The search index. `vectoriadb` is loaded the first time a search needs it,
32350
- * never at construction: a server whose skills are only listed or loaded
32351
- * (or that has none) must not pay for, or depend on, the optional peer.
32352
- */
32314
+ /** The search index, created the first time a search needs it. */
32353
32315
  vectorDB;
32354
- vectorDBLoad;
32355
32316
  skills = /* @__PURE__ */ new Map();
32356
32317
  defaultTopK;
32357
32318
  defaultMinScore;
@@ -32364,8 +32325,8 @@ var init_memory_skill_provider = __esm({
32364
32325
  /**
32365
32326
  * The index is rebuilt from `skills` when it is stale: adds/removes bump
32366
32327
  * `skillsVersion`, and the FIRST search after a mutation builds (or restores)
32367
- * the index exactly once. This keeps the expensive IDF/embedding pass — and
32368
- * the `vectoriadb` load itself — off the registration hot-path.
32328
+ * the index exactly once. This keeps the expensive IDF/embedding pass off the
32329
+ * registration hot-path.
32369
32330
  */
32370
32331
  skillsVersion = 0;
32371
32332
  indexedVersion = -1;
@@ -32376,25 +32337,13 @@ var init_memory_skill_provider = __esm({
32376
32337
  this.scoring = options.scoring ?? "cosine";
32377
32338
  this.indexCache = options.indexCache;
32378
32339
  }
32379
- async loadVectorDB() {
32380
- const mod = await importOptionalPeer(
32381
- "vectoriadb",
32382
- // A dynamic import inside Jest's VM throws unless the run uses
32383
- // --experimental-vm-modules; `vectoriadb` ships CommonJS, so fall back to `require`.
32384
- () => importWithRequireFallback(
32385
- () => import("vectoriadb"),
32386
- () => require("vectoriadb")
32387
- ),
32388
- // Read only when the import fails: an ESM browser bundle has no `require` at all
32389
- (id) => require.resolve(id),
32390
- "skill search"
32391
- );
32340
+ createVectorDB() {
32392
32341
  const dbConfig = {
32393
32342
  defaultTopK: this.defaultTopK,
32394
32343
  defaultSimilarityThreshold: this.defaultMinScore
32395
32344
  };
32396
32345
  if (this.scoring !== "cosine") dbConfig.scoring = this.scoring;
32397
- return new mod.TFIDFVectoria(dbConfig);
32346
+ return new import_vectoriadb.TFIDFVectoria(dbConfig);
32398
32347
  }
32399
32348
  /**
32400
32349
  * Attach (or replace) the snapshot cache after construction — useful when the
@@ -32423,7 +32372,7 @@ var init_memory_skill_provider = __esm({
32423
32372
  */
32424
32373
  async ensureIndexed() {
32425
32374
  if (this.indexReady) return;
32426
- const db = await this.db();
32375
+ const db = this.db();
32427
32376
  const version = this.skillsVersion;
32428
32377
  if (this.indexCache && isSnapshotCapable(db)) {
32429
32378
  const key = await this.computeIndexKey();
@@ -32479,11 +32428,8 @@ var init_memory_skill_provider = __esm({
32479
32428
  const canonical = `frontmcp-skill-index:v1|${this.scoring}|${this.skills.size}|${parts.join("")}`;
32480
32429
  return (0, import_utils68.sha256Hex)(canonical);
32481
32430
  }
32482
- /** Load `vectoriadb` on first use (throws the clear install hint if absent). */
32483
- async db() {
32484
- if (this.vectorDB) return this.vectorDB;
32485
- this.vectorDBLoad ??= this.loadVectorDB();
32486
- this.vectorDB = await this.vectorDBLoad;
32431
+ db() {
32432
+ this.vectorDB ??= this.createVectorDB();
32487
32433
  return this.vectorDB;
32488
32434
  }
32489
32435
  /**
@@ -32530,7 +32476,7 @@ var init_memory_skill_provider = __esm({
32530
32476
  }
32531
32477
  return true;
32532
32478
  };
32533
- const db = await this.db();
32479
+ const db = this.db();
32534
32480
  await this.ensureIndexed();
32535
32481
  let results = await db.search(query, {
32536
32482
  topK,
@@ -64389,6 +64335,23 @@ var init_http_request_flow = __esm({
64389
64335
  }
64390
64336
  });
64391
64337
 
64338
+ // libs/sdk/src/scope/optional-dependency.util.ts
64339
+ function probeOptionalDependency(moduleName, loadError, resolve) {
64340
+ let resolvedPath;
64341
+ try {
64342
+ resolvedPath = resolve(moduleName);
64343
+ } catch {
64344
+ resolvedPath = void 0;
64345
+ }
64346
+ const error = loadError instanceof Error ? loadError.message : String(loadError);
64347
+ return resolvedPath ? { status: "load-failed", resolvedPath, error } : { status: "not-installed", error };
64348
+ }
64349
+ var init_optional_dependency_util = __esm({
64350
+ "libs/sdk/src/scope/optional-dependency.util.ts"() {
64351
+ "use strict";
64352
+ }
64353
+ });
64354
+
64392
64355
  // libs/sdk/src/scope/server-entries.helper.ts
64393
64356
  async function registerServerEntries(providers, entries, appIds) {
64394
64357
  if (!entries.tools?.length && !entries.resources?.length) return;
@@ -68593,7 +68556,7 @@ var init_front_mcp = __esm({
68593
68556
  * const scopes = instance.getScopes();
68594
68557
  */
68595
68558
  static async createForGraph(options) {
68596
- const parsedConfig = frontMcpMetadataSchema.parse(options);
68559
+ const parsedConfig = frontMcpMetadataSchema.parse({ ...options, serve: false });
68597
68560
  const frontMcp = new _FrontMcpInstance2(parsedConfig);
68598
68561
  await frontMcp.ready;
68599
68562
  return frontMcp;
package/browser/index.mjs CHANGED
@@ -28290,7 +28290,7 @@ var init_config_symbols = __esm({
28290
28290
  });
28291
28291
 
28292
28292
  // libs/sdk/src/builtin/config/providers/env-loader.ts
28293
- import { fileExists as fileExists3, getCwd, getEnv as getEnv5, pathResolve as pathResolve2, readFile as readFile3, setEnv } from "@frontmcp/utils";
28293
+ import { fileExists as fileExists3, getCwd, getEnv as getEnv5, getRuntimeContext as getRuntimeContext9, pathResolve as pathResolve2, readFile as readFile3, setEnv } from "@frontmcp/utils";
28294
28294
  function parseEnvContent(content) {
28295
28295
  const result = {};
28296
28296
  const lines = content.split("\n");
@@ -28316,8 +28316,20 @@ function parseEnvContent(content) {
28316
28316
  }
28317
28317
  return result;
28318
28318
  }
28319
+ function canReadConfigFiles() {
28320
+ return getRuntimeContext9().runtime !== "browser";
28321
+ }
28322
+ function processEnvEntries() {
28323
+ const env = {};
28324
+ const processEnv = typeof process === "undefined" ? void 0 : process.env;
28325
+ for (const [key, value] of Object.entries(processEnv ?? {})) {
28326
+ if (value !== void 0) env[key] = value;
28327
+ }
28328
+ return env;
28329
+ }
28319
28330
  async function loadEnvFiles(basePath = getCwd(), envPath = ".env", localEnvPath = ".env.local") {
28320
28331
  const result = {};
28332
+ if (!canReadConfigFiles()) return result;
28321
28333
  const envFile = pathResolve2(basePath, envPath);
28322
28334
  if (await fileExists3(envFile)) {
28323
28335
  const content = await readFile3(envFile);
@@ -28466,12 +28478,7 @@ async function loadConfig(schema, options = {}) {
28466
28478
  if (shouldPopulate) {
28467
28479
  populateProcessEnv(envFromFiles, false);
28468
28480
  }
28469
- const allEnv = { ...envFromFiles };
28470
- for (const [key, value] of Object.entries(process.env)) {
28471
- if (value !== void 0) {
28472
- allEnv[key] = value;
28473
- }
28474
- }
28481
+ const allEnv = { ...envFromFiles, ...processEnvEntries() };
28475
28482
  const paths = extractSchemaPaths(schema);
28476
28483
  const envConfig = mapEnvToNestedConfig(allEnv, paths);
28477
28484
  config = deepMerge(config, envConfig);
@@ -28483,6 +28490,7 @@ async function loadConfig(schema, options = {}) {
28483
28490
  return result.data;
28484
28491
  }
28485
28492
  async function loadYamlConfig(basePath, configPath) {
28493
+ if (!canReadConfigFiles()) return {};
28486
28494
  const extensions = ["", ".yml", ".yaml"];
28487
28495
  const baseName = configPath.replace(/\.(ya?ml)$/, "");
28488
28496
  for (const ext of extensions) {
@@ -28606,14 +28614,7 @@ var init_config_plugin = __esm({
28606
28614
  const basePath = pluginConfig.basePath ?? getCwd3();
28607
28615
  env = await loadEnvFiles(basePath, pluginConfig.envPath, pluginConfig.localEnvPath);
28608
28616
  }
28609
- const merged = { ...env };
28610
- if (typeof process !== "undefined" && process.env) {
28611
- for (const [key, value] of Object.entries(process.env)) {
28612
- if (value !== void 0 && merged[key] === void 0) {
28613
- merged[key] = value;
28614
- }
28615
- }
28616
- }
28617
+ const merged = { ...processEnvEntries(), ...env };
28617
28618
  if (pluginConfig.populateProcessEnv) {
28618
28619
  populateProcessEnv(env, false);
28619
28620
  }
@@ -31496,7 +31497,7 @@ var init_flow_interface = __esm({
31496
31497
 
31497
31498
  // libs/sdk/src/common/interfaces/execution-context.interface.ts
31498
31499
  import { buildAuthContext } from "@frontmcp/auth";
31499
- import { getRuntimeContext as getRuntimeContext9, randomUUID as randomUUID13 } from "@frontmcp/utils";
31500
+ import { getRuntimeContext as getRuntimeContext10, randomUUID as randomUUID13 } from "@frontmcp/utils";
31500
31501
  var ExecutionContextBase;
31501
31502
  var init_execution_context_interface = __esm({
31502
31503
  "libs/sdk/src/common/interfaces/execution-context.interface.ts"() {
@@ -31803,7 +31804,7 @@ var init_execution_context_interface = __esm({
31803
31804
  * Get the current runtime context (platform, runtime, deployment, env).
31804
31805
  */
31805
31806
  get runtimeContext() {
31806
- return getRuntimeContext9();
31807
+ return getRuntimeContext10();
31807
31808
  }
31808
31809
  /**
31809
31810
  * Check if running on a specific OS platform.
@@ -31838,7 +31839,7 @@ var init_execution_context_interface = __esm({
31838
31839
  });
31839
31840
 
31840
31841
  // libs/sdk/src/common/interfaces/prompt.interface.ts
31841
- import { getRuntimeContext as getRuntimeContext10, randomUUID as randomUUID14 } from "@frontmcp/utils";
31842
+ import { getRuntimeContext as getRuntimeContext11, randomUUID as randomUUID14 } from "@frontmcp/utils";
31842
31843
  var PromptContext;
31843
31844
  var init_prompt_interface = __esm({
31844
31845
  "libs/sdk/src/common/interfaces/prompt.interface.ts"() {
@@ -31938,7 +31939,7 @@ var init_prompt_interface = __esm({
31938
31939
  // ---- Runtime context helpers ----
31939
31940
  /** Get the current runtime context (platform, runtime, deployment, env). */
31940
31941
  get runtimeContext() {
31941
- return getRuntimeContext10();
31942
+ return getRuntimeContext11();
31942
31943
  }
31943
31944
  /** Check if running on a specific OS platform. */
31944
31945
  isPlatform(platform) {
@@ -32300,41 +32301,8 @@ var init_skill_validation_error = __esm({
32300
32301
  }
32301
32302
  });
32302
32303
 
32303
- // libs/sdk/src/scope/optional-dependency.util.ts
32304
- function probeOptionalDependency(moduleName, loadError, resolve) {
32305
- let resolvedPath;
32306
- try {
32307
- resolvedPath = resolve(moduleName);
32308
- } catch {
32309
- resolvedPath = void 0;
32310
- }
32311
- const error = loadError instanceof Error ? loadError.message : String(loadError);
32312
- return resolvedPath ? { status: "load-failed", resolvedPath, error } : { status: "not-installed", error };
32313
- }
32314
- async function importOptionalPeer(moduleName, importer, resolve, feature) {
32315
- try {
32316
- return await importer();
32317
- } catch (cause) {
32318
- const probe = probeOptionalDependency(moduleName, cause, resolve);
32319
- if (probe.status === "not-installed") {
32320
- throw new Error(
32321
- `@frontmcp/sdk ${feature} needs the optional peer dependency '${moduleName}'. Install it in your project (e.g. \`npm i ${moduleName}\`).`,
32322
- { cause }
32323
- );
32324
- }
32325
- throw new Error(
32326
- `@frontmcp/sdk ${feature} found '${moduleName}' at ${probe.resolvedPath} but it failed to load \u2014 reinstalling will not help. This is usually an export-condition, transpile, or transitive-peer mismatch. Original error: ${probe.error}`,
32327
- { cause }
32328
- );
32329
- }
32330
- }
32331
- var init_optional_dependency_util = __esm({
32332
- "libs/sdk/src/scope/optional-dependency.util.ts"() {
32333
- "use strict";
32334
- }
32335
- });
32336
-
32337
32304
  // libs/sdk/src/skill/providers/memory-skill.provider.ts
32305
+ import { TFIDFVectoria } from "vectoriadb";
32338
32306
  import { sha256Hex as sha256Hex9 } from "@frontmcp/utils";
32339
32307
  function isSnapshotCapable(db) {
32340
32308
  const d = db;
@@ -32344,8 +32312,6 @@ var STOP_WORDS, MemorySkillProvider;
32344
32312
  var init_memory_skill_provider = __esm({
32345
32313
  "libs/sdk/src/skill/providers/memory-skill.provider.ts"() {
32346
32314
  "use strict";
32347
- init_optional_dependency_util();
32348
- init_dynamic_import_utils();
32349
32315
  STOP_WORDS = /* @__PURE__ */ new Set([
32350
32316
  // Articles & Determiners
32351
32317
  "the",
@@ -32420,13 +32386,8 @@ var init_memory_skill_provider = __esm({
32420
32386
  ]);
32421
32387
  MemorySkillProvider = class {
32422
32388
  type = "memory";
32423
- /**
32424
- * The search index. `vectoriadb` is loaded the first time a search needs it,
32425
- * never at construction: a server whose skills are only listed or loaded
32426
- * (or that has none) must not pay for, or depend on, the optional peer.
32427
- */
32389
+ /** The search index, created the first time a search needs it. */
32428
32390
  vectorDB;
32429
- vectorDBLoad;
32430
32391
  skills = /* @__PURE__ */ new Map();
32431
32392
  defaultTopK;
32432
32393
  defaultMinScore;
@@ -32439,8 +32400,8 @@ var init_memory_skill_provider = __esm({
32439
32400
  /**
32440
32401
  * The index is rebuilt from `skills` when it is stale: adds/removes bump
32441
32402
  * `skillsVersion`, and the FIRST search after a mutation builds (or restores)
32442
- * the index exactly once. This keeps the expensive IDF/embedding pass — and
32443
- * the `vectoriadb` load itself — off the registration hot-path.
32403
+ * the index exactly once. This keeps the expensive IDF/embedding pass off the
32404
+ * registration hot-path.
32444
32405
  */
32445
32406
  skillsVersion = 0;
32446
32407
  indexedVersion = -1;
@@ -32451,25 +32412,13 @@ var init_memory_skill_provider = __esm({
32451
32412
  this.scoring = options.scoring ?? "cosine";
32452
32413
  this.indexCache = options.indexCache;
32453
32414
  }
32454
- async loadVectorDB() {
32455
- const mod = await importOptionalPeer(
32456
- "vectoriadb",
32457
- // A dynamic import inside Jest's VM throws unless the run uses
32458
- // --experimental-vm-modules; `vectoriadb` ships CommonJS, so fall back to `require`.
32459
- () => importWithRequireFallback(
32460
- () => import("vectoriadb"),
32461
- () => __require("vectoriadb")
32462
- ),
32463
- // Read only when the import fails: an ESM browser bundle has no `require` at all
32464
- (id) => __require.resolve(id),
32465
- "skill search"
32466
- );
32415
+ createVectorDB() {
32467
32416
  const dbConfig = {
32468
32417
  defaultTopK: this.defaultTopK,
32469
32418
  defaultSimilarityThreshold: this.defaultMinScore
32470
32419
  };
32471
32420
  if (this.scoring !== "cosine") dbConfig.scoring = this.scoring;
32472
- return new mod.TFIDFVectoria(dbConfig);
32421
+ return new TFIDFVectoria(dbConfig);
32473
32422
  }
32474
32423
  /**
32475
32424
  * Attach (or replace) the snapshot cache after construction — useful when the
@@ -32498,7 +32447,7 @@ var init_memory_skill_provider = __esm({
32498
32447
  */
32499
32448
  async ensureIndexed() {
32500
32449
  if (this.indexReady) return;
32501
- const db = await this.db();
32450
+ const db = this.db();
32502
32451
  const version = this.skillsVersion;
32503
32452
  if (this.indexCache && isSnapshotCapable(db)) {
32504
32453
  const key = await this.computeIndexKey();
@@ -32554,11 +32503,8 @@ var init_memory_skill_provider = __esm({
32554
32503
  const canonical = `frontmcp-skill-index:v1|${this.scoring}|${this.skills.size}|${parts.join("")}`;
32555
32504
  return sha256Hex9(canonical);
32556
32505
  }
32557
- /** Load `vectoriadb` on first use (throws the clear install hint if absent). */
32558
- async db() {
32559
- if (this.vectorDB) return this.vectorDB;
32560
- this.vectorDBLoad ??= this.loadVectorDB();
32561
- this.vectorDB = await this.vectorDBLoad;
32506
+ db() {
32507
+ this.vectorDB ??= this.createVectorDB();
32562
32508
  return this.vectorDB;
32563
32509
  }
32564
32510
  /**
@@ -32605,7 +32551,7 @@ var init_memory_skill_provider = __esm({
32605
32551
  }
32606
32552
  return true;
32607
32553
  };
32608
- const db = await this.db();
32554
+ const db = this.db();
32609
32555
  await this.ensureIndexed();
32610
32556
  let results = await db.search(query, {
32611
32557
  topK,
@@ -33421,7 +33367,7 @@ var init_skill_instance = __esm({
33421
33367
 
33422
33368
  // libs/sdk/src/skill/skill.registry.ts
33423
33369
  import { tokenName as tokenName10 } from "@frontmcp/di";
33424
- import { getRuntimeContext as getRuntimeContext11, isEntryAvailable as isEntryAvailable5 } from "@frontmcp/utils";
33370
+ import { getRuntimeContext as getRuntimeContext12, isEntryAvailable as isEntryAvailable5 } from "@frontmcp/utils";
33425
33371
  function findIdPathCollision(skills) {
33426
33372
  const byPath = /* @__PURE__ */ new Map();
33427
33373
  for (const skill of skills) {
@@ -33711,7 +33657,7 @@ var init_skill_registry = __esm({
33711
33657
  return skillVis === visibility;
33712
33658
  });
33713
33659
  }
33714
- const ctx = getRuntimeContext11();
33660
+ const ctx = getRuntimeContext12();
33715
33661
  skills = skills.filter((s) => isEntryAvailable5(s.metadata.availableWhen, ctx));
33716
33662
  return skills;
33717
33663
  }
@@ -33733,7 +33679,7 @@ var init_skill_registry = __esm({
33733
33679
  getAlwaysLoadedSkills() {
33734
33680
  let skills = this.listAllIndexed().map((r) => r.instance);
33735
33681
  skills = skills.filter((s) => s.isAlwaysLoaded());
33736
- const ctx = getRuntimeContext11();
33682
+ const ctx = getRuntimeContext12();
33737
33683
  skills = skills.filter((s) => isEntryAvailable5(s.metadata.availableWhen, ctx));
33738
33684
  return skills;
33739
33685
  }
@@ -33864,7 +33810,7 @@ var init_skill_registry = __esm({
33864
33810
  }
33865
33811
  }
33866
33812
  if (localSkill) {
33867
- const ctx = getRuntimeContext11();
33813
+ const ctx = getRuntimeContext12();
33868
33814
  if (!isEntryAvailable5(localSkill.metadata.availableWhen, ctx)) {
33869
33815
  return void 0;
33870
33816
  }
@@ -36907,7 +36853,7 @@ var init_agent_instance = __esm({
36907
36853
 
36908
36854
  // libs/sdk/src/agent/agent.registry.ts
36909
36855
  import { tokenName as tokenName13 } from "@frontmcp/di";
36910
- import { getRuntimeContext as getRuntimeContext12, isEntryAvailable as isEntryAvailable6 } from "@frontmcp/utils";
36856
+ import { getRuntimeContext as getRuntimeContext13, isEntryAvailable as isEntryAvailable6 } from "@frontmcp/utils";
36911
36857
  function ownerKeyOf2(lineage) {
36912
36858
  return lineage.map((o) => `${o.kind}:${o.id}`).join("/");
36913
36859
  }
@@ -37129,7 +37075,7 @@ var init_agent_registry = __esm({
37129
37075
  */
37130
37076
  // NOTE: `any` is intentional - heterogeneous agent collections
37131
37077
  getAgents(includeHidden = false) {
37132
- const ctx = getRuntimeContext12();
37078
+ const ctx = getRuntimeContext13();
37133
37079
  const local = [...this.localRows].map((a) => a.instance);
37134
37080
  const adopted = [...this.adopted.values()].flat().map((a) => a.instance);
37135
37081
  return [...local, ...adopted].filter((a) => {
@@ -37162,7 +37108,7 @@ var init_agent_registry = __esm({
37162
37108
  * Used by discovery/listing APIs to enforce registry-level constraints.
37163
37109
  */
37164
37110
  getAvailableInstances() {
37165
- const ctx = getRuntimeContext12();
37111
+ const ctx = getRuntimeContext13();
37166
37112
  return [...this.listAllInstances()].filter((a) => isEntryAvailable6(a.metadata.availableWhen, ctx));
37167
37113
  }
37168
37114
  /**
@@ -60055,9 +60001,9 @@ var init_handle_mcp_20260728_flow = __esm({
60055
60001
  });
60056
60002
 
60057
60003
  // libs/sdk/src/ha/ha-headers.ts
60058
- import { buildSetCookie, getEnv as getEnv12, getMachineId as getMachineId3, getRuntimeContext as getRuntimeContext13 } from "@frontmcp/utils";
60004
+ import { buildSetCookie, getEnv as getEnv12, getMachineId as getMachineId3, getRuntimeContext as getRuntimeContext14 } from "@frontmcp/utils";
60059
60005
  function machineIdHeader() {
60060
- if (getRuntimeContext13().deployment !== "distributed") return void 0;
60006
+ if (getRuntimeContext14().deployment !== "distributed") return void 0;
60061
60007
  return [DEFAULT_FRONTMCP_MACHINE_ID_HEADER, getMachineId3()];
60062
60008
  }
60063
60009
  function applyMachineIdHeader(response) {
@@ -64590,6 +64536,23 @@ var init_http_request_flow = __esm({
64590
64536
  }
64591
64537
  });
64592
64538
 
64539
+ // libs/sdk/src/scope/optional-dependency.util.ts
64540
+ function probeOptionalDependency(moduleName, loadError, resolve) {
64541
+ let resolvedPath;
64542
+ try {
64543
+ resolvedPath = resolve(moduleName);
64544
+ } catch {
64545
+ resolvedPath = void 0;
64546
+ }
64547
+ const error = loadError instanceof Error ? loadError.message : String(loadError);
64548
+ return resolvedPath ? { status: "load-failed", resolvedPath, error } : { status: "not-installed", error };
64549
+ }
64550
+ var init_optional_dependency_util = __esm({
64551
+ "libs/sdk/src/scope/optional-dependency.util.ts"() {
64552
+ "use strict";
64553
+ }
64554
+ });
64555
+
64593
64556
  // libs/sdk/src/scope/server-entries.helper.ts
64594
64557
  async function registerServerEntries(providers, entries, appIds) {
64595
64558
  if (!entries.tools?.length && !entries.resources?.length) return;
@@ -64622,7 +64585,7 @@ import {
64622
64585
  AuthoritiesProfileRegistry
64623
64586
  } from "@frontmcp/auth";
64624
64587
  import { createGuardManager } from "@frontmcp/guard";
64625
- import { createRedisClient, getEnvFlag, getMachineId as getMachineId5, getRuntimeContext as getRuntimeContext14, isEdgeRuntime } from "@frontmcp/utils";
64588
+ import { createRedisClient, getEnvFlag, getMachineId as getMachineId5, getRuntimeContext as getRuntimeContext15, isEdgeRuntime } from "@frontmcp/utils";
64626
64589
  var SCOPE_NON_DISPATCHABLE_FLOWS, Scope;
64627
64590
  var init_scope_instance = __esm({
64628
64591
  "libs/sdk/src/scope/scope.instance.ts"() {
@@ -64786,7 +64749,7 @@ var init_scope_instance = __esm({
64786
64749
  this.scopeApps = new AppRegistry(this.scopeProviders, this.metadata.apps, scopeRef);
64787
64750
  this.logger.info(`Initializing ${this.metadata.apps.length} app(s)...`);
64788
64751
  const transportConfig = this.metadata.transport;
64789
- const isDistributed = getRuntimeContext14().deployment === "distributed";
64752
+ const isDistributed = getRuntimeContext15().deployment === "distributed";
64790
64753
  if (isDistributed && this.metadata.redis && !this.cliMode) {
64791
64754
  try {
64792
64755
  const haRedis = this.createHaRedisClient();
@@ -64833,7 +64796,7 @@ var init_scope_instance = __esm({
64833
64796
  onOrphan: (sessionId, previousNodeId, session) => transportService.adoptClaimedSession(sessionId, previousNodeId, session)
64834
64797
  });
64835
64798
  }
64836
- if (getRuntimeContext14().deployment === "serverless") {
64799
+ if (getRuntimeContext15().deployment === "serverless") {
64837
64800
  const protocolCfg = transportConfig?.protocol;
64838
64801
  const hasSSE = typeof protocolCfg === "string" ? protocolCfg !== "stateless-api" : protocolCfg?.sse === true;
64839
64802
  if (hasSSE) {
@@ -68189,7 +68152,7 @@ var init_browser_express_host = __esm({
68189
68152
  });
68190
68153
 
68191
68154
  // libs/sdk/src/server/server.instance.ts
68192
- import { getRuntimeContext as getRuntimeContext15, isProduction as isProduction7 } from "@frontmcp/utils";
68155
+ import { getRuntimeContext as getRuntimeContext16, isProduction as isProduction7 } from "@frontmcp/utils";
68193
68156
  var DEFAULT_CORS, FrontMcpServerInstance;
68194
68157
  var init_server_instance = __esm({
68195
68158
  "libs/sdk/src/server/server.instance.ts"() {
@@ -68298,7 +68261,7 @@ var init_server_instance = __esm({
68298
68261
  }
68299
68262
  async start() {
68300
68263
  this.prepare();
68301
- const deploymentMode = getRuntimeContext15().deployment;
68264
+ const deploymentMode = getRuntimeContext16().deployment;
68302
68265
  const bindAddress = resolveBindAddress(this.config.security, deploymentMode);
68303
68266
  const findings = auditSecurityDefaults(
68304
68267
  {
@@ -68804,7 +68767,7 @@ var init_front_mcp = __esm({
68804
68767
  * const scopes = instance.getScopes();
68805
68768
  */
68806
68769
  static async createForGraph(options) {
68807
- const parsedConfig = frontMcpMetadataSchema.parse(options);
68770
+ const parsedConfig = frontMcpMetadataSchema.parse({ ...options, serve: false });
68808
68771
  const frontMcp = new _FrontMcpInstance2(parsedConfig);
68809
68772
  await frontMcp.ready;
68810
68773
  return frontMcp;
@@ -1 +1 @@
1
- {"version":3,"file":"config.plugin.d.ts","sourceRoot":"","sources":["../../../src/builtin/config/config.plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAyB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvF,OAAO,KAAK,EAAE,m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;;OAEG;IACH,OAAgB,gBAAgB,GAAI,CAAC,SAAS,MAAM,EAAE,SAAS,wBAAwB,CAAC,CAAC,CAAC,KAAG,YAAY,EAAE,CA8DzG;CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../../src/builtin/config/providers/config-loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAM5C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,MAAM,EAC/C,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,CAAC,CAAC,CAmDZ;AA6DD;;;;;;;;GAQG;AACH,iBAAS,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2B5G;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../../src/builtin/config/providers/config-loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAa5C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,MAAM,EAC/C,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,CAAC,CAAC,CA8CZ;AA8DD;;;;;;;;GAQG;AACH,iBAAS,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2B5G;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -12,6 +12,12 @@ import { type z } from '@frontmcp/lazy-zod';
12
12
  * @returns Record of key-value pairs
13
13
  */
14
14
  export declare function parseEnvContent(content: string): Record<string, string>;
15
+ /** False in the browser build, which has no file system to read config files from. */
16
+ export declare function canReadConfigFiles(): boolean;
17
+ /**
18
+ * Environment variables of the running process; empty where there is no `process`, as in a browser.
19
+ */
20
+ export declare function processEnvEntries(): Record<string, string>;
15
21
  /**
16
22
  * Load environment variables from .env files.
17
23
  * Follows NestJS-style priority: .env.local overrides .env
@@ -19,7 +25,7 @@ export declare function parseEnvContent(content: string): Record<string, string>
19
25
  * @param basePath - Base directory to resolve files from
20
26
  * @param envPath - Path to base .env file (relative to basePath)
21
27
  * @param localEnvPath - Path to local override file (relative to basePath)
22
- * @returns Record of merged environment variables
28
+ * @returns Record of merged environment variables, empty where config files cannot be read
23
29
  */
24
30
  export declare function loadEnvFiles(basePath?: string, envPath?: string, localEnvPath?: string): Promise<Record<string, string>>;
25
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"env-loader.d.ts","sourceRoot":"","sources":["../../../../src/builtin/config/providers/env-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAG5C;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2CvE;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,QAAQ,SAAW,EACnB,OAAO,SAAS,EAChB,YAAY,SAAe,GAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAkBjC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,UAAQ,GAAG,IAAI,CAMtF;AAoBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CA+B/F;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAA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