@frontmcp/sdk 1.0.0-beta.13 → 1.0.0-beta.14

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 (35) hide show
  1. package/common/interfaces/resource.interface.d.ts +24 -12
  2. package/common/interfaces/resource.interface.d.ts.map +1 -1
  3. package/common/interfaces/skill.interface.d.ts +20 -0
  4. package/common/interfaces/skill.interface.d.ts.map +1 -1
  5. package/common/metadata/skill.metadata.d.ts +3 -0
  6. package/common/metadata/skill.metadata.d.ts.map +1 -1
  7. package/common/tokens/server.tokens.d.ts +1 -0
  8. package/common/tokens/server.tokens.d.ts.map +1 -1
  9. package/esm/index.mjs +655 -351
  10. package/index.js +727 -423
  11. package/notification/notification.service.d.ts +5 -0
  12. package/notification/notification.service.d.ts.map +1 -1
  13. package/package.json +8 -8
  14. package/resource/resource.instance.d.ts +10 -3
  15. package/resource/resource.instance.d.ts.map +1 -1
  16. package/scope/flows/http.request.flow.d.ts.map +1 -1
  17. package/skill/skill-directory-loader.d.ts.map +1 -1
  18. package/skill/skill.instance.d.ts +1 -1
  19. package/skill/skill.instance.d.ts.map +1 -1
  20. package/skill/skill.utils.d.ts +10 -2
  21. package/skill/skill.utils.d.ts.map +1 -1
  22. package/skill/tools/index.d.ts +3 -2
  23. package/skill/tools/index.d.ts.map +1 -1
  24. package/skill/tools/read-skill-content.tool.d.ts +65 -0
  25. package/skill/tools/read-skill-content.tool.d.ts.map +1 -0
  26. package/tool/ui/ui-shared.d.ts.map +1 -1
  27. package/transport/adapters/transport.local.adapter.d.ts +6 -0
  28. package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
  29. package/transport/flows/handle.streamable-http.flow.d.ts.map +1 -1
  30. package/transport/transport.local.d.ts +1 -0
  31. package/transport/transport.local.d.ts.map +1 -1
  32. package/transport/transport.remote.d.ts +1 -0
  33. package/transport/transport.remote.d.ts.map +1 -1
  34. package/transport/transport.types.d.ts +6 -0
  35. package/transport/transport.types.d.ts.map +1 -1
package/esm/index.mjs CHANGED
@@ -109,7 +109,8 @@ var init_server_tokens = __esm({
109
109
  type: tokenFactory.type("serverRequest"),
110
110
  intent: tokenFactory.meta("intent"),
111
111
  auth: tokenFactory.meta("auth"),
112
- sessionId: tokenFactory.meta("sessionId")
112
+ sessionId: tokenFactory.meta("sessionId"),
113
+ reinitialize: tokenFactory.meta("reinitialize")
113
114
  };
114
115
  }
115
116
  });
@@ -2949,7 +2950,8 @@ var init_skill_metadata = __esm({
2949
2950
  skillResourcesSchema = z30.object({
2950
2951
  scripts: z30.string().optional(),
2951
2952
  references: z30.string().optional(),
2952
- assets: z30.string().optional()
2953
+ assets: z30.string().optional(),
2954
+ examples: z30.string().optional()
2953
2955
  });
2954
2956
  skillMetadataSchema = z30.object({
2955
2957
  id: z30.string().optional(),
@@ -7854,6 +7856,13 @@ var init_notification_service = __esm({
7854
7856
  isSessionTerminated(sessionId) {
7855
7857
  return this.terminatedSessions.has(sessionId);
7856
7858
  }
7859
+ /**
7860
+ * Remove a session from the terminated set.
7861
+ * Called when a terminated session is being re-initialized with the same session ID.
7862
+ */
7863
+ unmarkTerminated(sessionId) {
7864
+ this.terminatedSessions.delete(sessionId);
7865
+ }
7857
7866
  /**
7858
7867
  * Broadcast a notification to all registered servers.
7859
7868
  *
@@ -8684,8 +8693,8 @@ var init_tool_instance = __esm({
8684
8693
  if (isRemoteTool || hasRawJsonSchema) {
8685
8694
  return z36.looseObject({}).parse(input.arguments ?? {});
8686
8695
  }
8687
- const inputSchema32 = z36.object(this.inputSchema);
8688
- return inputSchema32.parse(input.arguments);
8696
+ const inputSchema33 = z36.object(this.inputSchema);
8697
+ return inputSchema33.parse(input.arguments);
8689
8698
  }
8690
8699
  /**
8691
8700
  * Turn the raw tool function result into an MCP-compliant CallToolResult:
@@ -8824,7 +8833,8 @@ var init_ui_shared = __esm({
8824
8833
  }
8825
8834
  async renderAndRegisterAsync(options) {
8826
8835
  const toolName = options["toolName"];
8827
- const template = options["uiConfig"]?.["template"];
8836
+ const uiConfig = options["uiConfig"];
8837
+ const template = uiConfig?.["template"];
8828
8838
  const input = options["input"] ?? {};
8829
8839
  const output = options["output"] ?? {};
8830
8840
  const platformType = options["platformType"];
@@ -9343,29 +9353,29 @@ var init_tools_list_flow = __esm({
9343
9353
  );
9344
9354
  }
9345
9355
  const tools = resolved.map(({ finalName, tool }) => {
9346
- let inputSchema32;
9356
+ let inputSchema33;
9347
9357
  if (tool.rawInputSchema) {
9348
- inputSchema32 = tool.rawInputSchema;
9358
+ inputSchema33 = tool.rawInputSchema;
9349
9359
  } else if (tool.inputSchema && Object.keys(tool.inputSchema).length > 0) {
9350
9360
  try {
9351
- inputSchema32 = toJSONSchema3(z37.object(tool.inputSchema));
9361
+ inputSchema33 = toJSONSchema3(z37.object(tool.inputSchema));
9352
9362
  } catch (e) {
9353
9363
  this.logger.warn(`Failed to convert inputSchema for tool ${finalName}:`, e);
9354
- inputSchema32 = { type: "object", properties: {} };
9364
+ inputSchema33 = { type: "object", properties: {} };
9355
9365
  }
9356
9366
  } else {
9357
- inputSchema32 = { type: "object", properties: {} };
9367
+ inputSchema33 = { type: "object", properties: {} };
9358
9368
  }
9359
9369
  const item = {
9360
9370
  name: finalName,
9361
9371
  title: tool.metadata.name,
9362
9372
  description: tool.metadata.description,
9363
9373
  annotations: tool.metadata.annotations,
9364
- inputSchema: inputSchema32
9374
+ inputSchema: inputSchema33
9365
9375
  };
9366
- const outputSchema30 = tool.getRawOutputSchema();
9367
- if (outputSchema30) {
9368
- item.outputSchema = outputSchema30;
9376
+ const outputSchema31 = tool.getRawOutputSchema();
9377
+ if (outputSchema31) {
9378
+ item.outputSchema = outputSchema31;
9369
9379
  }
9370
9380
  if (hasUIConfig(tool.metadata)) {
9371
9381
  const uiConfig = tool.metadata.ui;
@@ -11077,16 +11087,50 @@ var init_resource_instance = __esm({
11077
11087
  return this.record.metadata;
11078
11088
  }
11079
11089
  /**
11080
- * Get an argument completer from the resource class prototype.
11081
- * Returns a completer function if the resource class overrides getArgumentCompleter,
11082
- * or null if no completer is available.
11090
+ * Get an argument completer for a template parameter.
11091
+ *
11092
+ * Supports two patterns (both have full DI access via `this.get()`):
11093
+ *
11094
+ * 1. **Convention-based (preferred):** Define `${argName}Completer` on the resource class.
11095
+ * Example: `async accountNameCompleter(partial: string) { ... }`
11096
+ *
11097
+ * 2. **Override-based:** Override `getArgumentCompleter(argName)` on the resource class.
11098
+ *
11099
+ * Convention-based completers take priority over override-based ones.
11083
11100
  */
11084
11101
  getArgumentCompleter(argName) {
11085
- const cls = this.record.provide;
11086
- if (typeof cls === "function" && cls.prototype && typeof cls.prototype.getArgumentCompleter === "function") {
11087
- return cls.prototype.getArgumentCompleter.call(cls.prototype, argName);
11102
+ const record = this.record;
11103
+ if (record.kind === "FUNCTION" /* FUNCTION */ || record.kind === "FUNCTION" /* FUNCTION */) {
11104
+ return null;
11088
11105
  }
11089
- return null;
11106
+ const cls = record.provide;
11107
+ if (typeof cls !== "function" || !cls.prototype) {
11108
+ return null;
11109
+ }
11110
+ const conventionMethodName = `${argName}Completer`;
11111
+ const hasConventionMethod = typeof cls.prototype[conventionMethodName] === "function";
11112
+ const hasOverride = typeof cls.prototype.getArgumentCompleter === "function" && cls.prototype.getArgumentCompleter !== ResourceContext.prototype.getArgumentCompleter;
11113
+ if (!hasConventionMethod && !hasOverride) {
11114
+ return null;
11115
+ }
11116
+ const providers = this._providers;
11117
+ const scope = providers.getActiveScope();
11118
+ const logger = scope.logger;
11119
+ const metadata = this.getMetadata();
11120
+ const uri = this.isTemplate ? this.uriTemplate ?? "" : this.uri ?? "";
11121
+ const resourceCtorArgs = {
11122
+ metadata,
11123
+ uri,
11124
+ params: {},
11125
+ providers,
11126
+ logger,
11127
+ authInfo: {}
11128
+ };
11129
+ const instance = new cls(resourceCtorArgs);
11130
+ if (hasConventionMethod) {
11131
+ return (partial) => instance[conventionMethodName](partial);
11132
+ }
11133
+ return instance.getArgumentCompleter(argName);
11090
11134
  }
11091
11135
  /**
11092
11136
  * Match a URI against this resource.
@@ -14274,7 +14318,7 @@ var init_skill_md_parser = __esm({
14274
14318
 
14275
14319
  // libs/sdk/src/skill/skill.utils.ts
14276
14320
  import { isClass as isClass11, getMetadata as getMetadata13, depsOfClass as depsOfClass8 } from "@frontmcp/di";
14277
- import { readFile as readFile2, readdir, fileExists } from "@frontmcp/utils";
14321
+ import { readFile as readFile2, readdir, fileExists, stat } from "@frontmcp/utils";
14278
14322
  function collectSkillMetadata(cls) {
14279
14323
  const extended = getMetadata13(extendedSkillMetadata, cls);
14280
14324
  const seed = extended ? { ...extended } : {};
@@ -14354,11 +14398,14 @@ async function loadInstructions(source, basePath) {
14354
14398
  }
14355
14399
  throw new InvalidInstructionSourceError();
14356
14400
  }
14357
- function buildSkillContent(metadata, instructions, resolvedReferences) {
14401
+ function buildSkillContent(metadata, instructions, resolvedReferences, resolvedExamples) {
14358
14402
  let finalInstructions = instructions;
14359
14403
  if (resolvedReferences && resolvedReferences.length > 0) {
14360
14404
  finalInstructions += buildReferencesTable(resolvedReferences);
14361
14405
  }
14406
+ if (resolvedExamples && resolvedExamples.length > 0) {
14407
+ finalInstructions += buildExamplesTable(resolvedExamples);
14408
+ }
14362
14409
  return {
14363
14410
  id: metadata.id ?? metadata.name,
14364
14411
  name: metadata.name,
@@ -14372,7 +14419,8 @@ function buildSkillContent(metadata, instructions, resolvedReferences) {
14372
14419
  specMetadata: metadata.specMetadata,
14373
14420
  allowedTools: metadata.allowedTools,
14374
14421
  resources: metadata.resources,
14375
- resolvedReferences
14422
+ resolvedReferences,
14423
+ resolvedExamples
14376
14424
  };
14377
14425
  }
14378
14426
  function buildReferencesTable(refs) {
@@ -14382,6 +14430,73 @@ function buildReferencesTable(refs) {
14382
14430
  }
14383
14431
  return lines.join("\n");
14384
14432
  }
14433
+ function buildExamplesTable(examples) {
14434
+ const lines = [
14435
+ "",
14436
+ "",
14437
+ "## Examples",
14438
+ "",
14439
+ "| Example | Reference | Level | Description |",
14440
+ "| ------- | --------- | ----- | ----------- |"
14441
+ ];
14442
+ for (const ex of examples) {
14443
+ lines.push(`| \`${ex.name}\` | \`${ex.reference}\` | ${ex.level} | ${ex.description} |`);
14444
+ }
14445
+ return lines.join("\n");
14446
+ }
14447
+ async function resolveExamples(examplesDir) {
14448
+ if (!await fileExists(examplesDir)) return void 0;
14449
+ let refDirs;
14450
+ try {
14451
+ refDirs = (await readdir(examplesDir)).sort();
14452
+ } catch {
14453
+ return void 0;
14454
+ }
14455
+ const examples = [];
14456
+ for (const refDir of refDirs) {
14457
+ const refPath = `${examplesDir}/${refDir}`;
14458
+ try {
14459
+ const s = await stat(refPath);
14460
+ if (!s.isDirectory()) continue;
14461
+ } catch {
14462
+ continue;
14463
+ }
14464
+ let files;
14465
+ try {
14466
+ files = (await readdir(refPath)).filter((f) => f.endsWith(".md")).sort();
14467
+ } catch {
14468
+ continue;
14469
+ }
14470
+ for (const file of files) {
14471
+ const content = await readFile2(`${refPath}/${file}`, "utf-8");
14472
+ const filenameWithoutExt = file.replace(/\.md$/, "");
14473
+ let name33 = filenameWithoutExt;
14474
+ let description = "";
14475
+ let reference = refDir;
14476
+ let level = "basic";
14477
+ const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
14478
+ if (fmMatch) {
14479
+ const fmLines = fmMatch[1].split(/\r?\n/);
14480
+ for (const line of fmLines) {
14481
+ const colonIdx = line.indexOf(":");
14482
+ if (colonIdx === -1) continue;
14483
+ const key = line.slice(0, colonIdx).trim();
14484
+ const val = line.slice(colonIdx + 1).trim().replace(/^["']|["']$/g, "");
14485
+ if (key === "name" && val) name33 = val;
14486
+ if (key === "description" && val) description = val;
14487
+ if (key === "reference" && val) reference = val;
14488
+ if (key === "level" && val) level = val;
14489
+ }
14490
+ }
14491
+ if (!description) {
14492
+ const body = fmMatch ? content.substring(content.indexOf("---", 3) + 3).trim() : content.trim();
14493
+ description = extractFirstParagraph(body);
14494
+ }
14495
+ examples.push({ name: name33, description, reference, level, filename: `${refDir}/${file}` });
14496
+ }
14497
+ }
14498
+ return examples.length > 0 ? examples : void 0;
14499
+ }
14385
14500
  async function resolveReferences(refsDir) {
14386
14501
  if (!await fileExists(refsDir)) return void 0;
14387
14502
  let files;
@@ -14645,16 +14760,24 @@ var init_skill_instance = __esm({
14645
14760
  return this.cachedContent;
14646
14761
  }
14647
14762
  const instructions = await this.loadInstructions();
14763
+ const baseDir = this.getBaseDir();
14648
14764
  const refsPath = this.metadata.resources?.references;
14649
14765
  let resolvedRefs;
14650
14766
  if (refsPath) {
14651
- const baseDir = this.getBaseDir();
14652
14767
  const refsDir = refsPath.startsWith("/") ? refsPath : baseDir ? pathResolve(baseDir, refsPath) : void 0;
14653
14768
  if (refsDir) {
14654
14769
  resolvedRefs = await resolveReferences(refsDir);
14655
14770
  }
14656
14771
  }
14657
- const baseContent = buildSkillContent(this.metadata, instructions, resolvedRefs);
14772
+ const examplesPath = this.metadata.resources?.examples;
14773
+ let resolvedExs;
14774
+ if (examplesPath) {
14775
+ const exDir = examplesPath.startsWith("/") ? examplesPath : baseDir ? pathResolve(baseDir, examplesPath) : void 0;
14776
+ if (exDir) {
14777
+ resolvedExs = await resolveExamples(exDir);
14778
+ }
14779
+ }
14780
+ const baseContent = buildSkillContent(this.metadata, instructions, resolvedRefs, resolvedExs);
14658
14781
  this.cachedContent = {
14659
14782
  ...baseContent,
14660
14783
  tags: this.tags,
@@ -19855,8 +19978,8 @@ var init_agent_instance = __esm({
19855
19978
  return content;
19856
19979
  }
19857
19980
  parseInput(input) {
19858
- const inputSchema32 = z47.object(this.inputSchema ?? {});
19859
- return inputSchema32.parse(input.arguments);
19981
+ const inputSchema33 = z47.object(this.inputSchema ?? {});
19982
+ return inputSchema33.parse(input.arguments);
19860
19983
  }
19861
19984
  parseOutput(raw) {
19862
19985
  const descriptor = this.outputSchema;
@@ -19877,13 +20000,13 @@ var init_agent_instance = __esm({
19877
20000
  */
19878
20001
  getToolDefinition() {
19879
20002
  const metadata = this.record.metadata;
19880
- let inputSchema32 = {
20003
+ let inputSchema33 = {
19881
20004
  type: "object",
19882
20005
  properties: {}
19883
20006
  };
19884
20007
  if (this.inputSchema && Object.keys(this.inputSchema).length > 0) {
19885
20008
  try {
19886
- inputSchema32 = toJSONSchema4(z47.object(this.inputSchema));
20009
+ inputSchema33 = toJSONSchema4(z47.object(this.inputSchema));
19887
20010
  } catch {
19888
20011
  this.scope.logger.warn(`Failed to convert input schema for agent ${this.name}`);
19889
20012
  }
@@ -19891,7 +20014,7 @@ var init_agent_instance = __esm({
19891
20014
  return {
19892
20015
  name: agentToolName(this.id),
19893
20016
  description: this.buildToolDescription(metadata),
19894
- inputSchema: inputSchema32
20017
+ inputSchema: inputSchema33
19895
20018
  };
19896
20019
  }
19897
20020
  /**
@@ -22721,8 +22844,8 @@ var init_esm_cache = __esm({
22721
22844
  if (entry.bundleContent) {
22722
22845
  return toCachedBundle(entry.bundleContent).content;
22723
22846
  }
22724
- const { readFile: readFile5 } = __require("@frontmcp/utils");
22725
- return readFile5(entry.bundlePath);
22847
+ const { readFile: readFile6 } = __require("@frontmcp/utils");
22848
+ return readFile6(entry.bundlePath);
22726
22849
  }
22727
22850
  /**
22728
22851
  * Get the cache directory for a specific package+version combination.
@@ -22765,13 +22888,13 @@ function normalizeToolFromEsmExport(raw) {
22765
22888
  const obj = raw;
22766
22889
  if (typeof obj["execute"] === "function" && typeof obj["name"] === "string") {
22767
22890
  const description = obj["description"];
22768
- const inputSchema32 = obj["inputSchema"];
22769
- const outputSchema30 = obj["outputSchema"];
22891
+ const inputSchema33 = obj["inputSchema"];
22892
+ const outputSchema31 = obj["outputSchema"];
22770
22893
  return {
22771
22894
  name: obj["name"],
22772
22895
  description: typeof description === "string" ? description : void 0,
22773
- inputSchema: inputSchema32 && typeof inputSchema32 === "object" ? inputSchema32 : void 0,
22774
- outputSchema: outputSchema30 && typeof outputSchema30 === "object" ? outputSchema30 : void 0,
22896
+ inputSchema: inputSchema33 && typeof inputSchema33 === "object" ? inputSchema33 : void 0,
22897
+ outputSchema: outputSchema31 && typeof outputSchema31 === "object" ? outputSchema31 : void 0,
22775
22898
  execute: obj["execute"]
22776
22899
  };
22777
22900
  }
@@ -23465,11 +23588,11 @@ function isZodShape(schema) {
23465
23588
  function buildEsmToolRecord(tool, namespace) {
23466
23589
  const toolName = namespace ? `${namespace}:${tool.name}` : tool.name;
23467
23590
  const ContextClass = createEsmToolContextClass(tool.execute, tool.name);
23468
- let inputSchema32 = {};
23591
+ let inputSchema33 = {};
23469
23592
  let rawInputSchema = void 0;
23470
23593
  if (tool.inputSchema) {
23471
23594
  if (isZodShape(tool.inputSchema)) {
23472
- inputSchema32 = tool.inputSchema;
23595
+ inputSchema33 = tool.inputSchema;
23473
23596
  } else {
23474
23597
  rawInputSchema = tool.inputSchema;
23475
23598
  }
@@ -23478,7 +23601,7 @@ function buildEsmToolRecord(tool, namespace) {
23478
23601
  name: toolName,
23479
23602
  id: toolName,
23480
23603
  description: tool.description ?? `ESM tool: ${tool.name}`,
23481
- inputSchema: inputSchema32,
23604
+ inputSchema: inputSchema33,
23482
23605
  rawInputSchema,
23483
23606
  outputSchema: tool.outputSchema ?? "json",
23484
23607
  annotations: {
@@ -27958,11 +28081,10 @@ var init_http_request_flow = __esm({
27958
28081
  const body = request.body;
27959
28082
  if (body?.method === "initialize") {
27960
28083
  this.logger.info(
27961
- `[${this.requestId}] Initialize with terminated session ${sessionId.slice(0, 20)}... - allowing reconnect`
28084
+ `[${this.requestId}] Initialize with terminated session ${sessionId.slice(0, 20)}... - re-initializing`
27962
28085
  );
27963
- authorization.session = void 0;
27964
- delete request[ServerRequestTokens.sessionId];
27965
- delete request.headers["mcp-session-id"];
28086
+ this.scope.notifications.unmarkTerminated(sessionId);
28087
+ request[ServerRequestTokens.reinitialize] = true;
27966
28088
  } else {
27967
28089
  this.logger.warn(`[${this.requestId}] Request to terminated session: ${sessionId.slice(0, 20)}...`);
27968
28090
  this.respond(httpRespond.notFound("Session not found"));
@@ -28086,12 +28208,7 @@ var init_http_request_flow = __esm({
28086
28208
  return;
28087
28209
  }
28088
28210
  this.logger.info(`[${this.requestId}] DELETE session: ${sessionId}`);
28089
- const wasRegistered = this.scope.notifications.terminateSession(sessionId);
28090
- if (!wasRegistered) {
28091
- this.logger.warn(`[${this.requestId}] Session not found for DELETE: ${sessionId}`);
28092
- this.respond(httpRespond.notFound("Session not found"));
28093
- return;
28094
- }
28211
+ this.scope.notifications.terminateSession(sessionId);
28095
28212
  const authorization = request[ServerRequestTokens.auth];
28096
28213
  if (authorization?.token) {
28097
28214
  const transportService = this.scope.transportService;
@@ -28288,6 +28405,8 @@ var init_transport_remote = __esm({
28288
28405
  }
28289
28406
  resetForReinitialization() {
28290
28407
  }
28408
+ reregisterServer() {
28409
+ }
28291
28410
  };
28292
28411
  }
28293
28412
  });
@@ -29298,20 +29417,20 @@ function formatSkillForLLMWithSchemas(skill, availableTools, missingTools, toolR
29298
29417
  if (isAvailable) {
29299
29418
  const toolEntry = toolEntryByName.get(tool.name);
29300
29419
  if (toolEntry) {
29301
- const inputSchema32 = getToolInputSchema(toolEntry);
29302
- const outputSchema30 = toolEntry.getRawOutputSchema?.() ?? toolEntry.rawOutputSchema;
29303
- if (inputSchema32) {
29420
+ const inputSchema33 = getToolInputSchema(toolEntry);
29421
+ const outputSchema31 = toolEntry.getRawOutputSchema?.() ?? toolEntry.rawOutputSchema;
29422
+ if (inputSchema33) {
29304
29423
  parts.push("");
29305
29424
  parts.push("**Input Schema:**");
29306
29425
  parts.push("```json");
29307
- parts.push(JSON.stringify(inputSchema32, null, 2));
29426
+ parts.push(JSON.stringify(inputSchema33, null, 2));
29308
29427
  parts.push("```");
29309
29428
  }
29310
- if (outputSchema30) {
29429
+ if (outputSchema31) {
29311
29430
  parts.push("");
29312
29431
  parts.push("**Output Schema:**");
29313
29432
  parts.push("```json");
29314
- parts.push(JSON.stringify(outputSchema30, null, 2));
29433
+ parts.push(JSON.stringify(outputSchema31, null, 2));
29315
29434
  parts.push("```");
29316
29435
  }
29317
29436
  }
@@ -29652,6 +29771,16 @@ var init_transport_local_adapter = __esm({
29652
29771
  */
29653
29772
  resetForReinitialization() {
29654
29773
  }
29774
+ /**
29775
+ * Re-register the MCP server with the notification service.
29776
+ * Called after resetForReinitialization() to restore the server mapping
29777
+ * that was removed by terminateSession → unregisterServer.
29778
+ */
29779
+ reregisterServer() {
29780
+ if (this.server) {
29781
+ this.scope.notifications.registerServer(this.key.sessionId, this.server);
29782
+ }
29783
+ }
29655
29784
  connectServer() {
29656
29785
  const { info, apps } = this.scope.metadata;
29657
29786
  const hasRemoteApps = apps?.some((app) => this.isRemoteApp(app)) ?? false;
@@ -31686,6 +31815,9 @@ var init_transport_local = __esm({
31686
31815
  resetForReinitialization() {
31687
31816
  this.adapter.resetForReinitialization();
31688
31817
  }
31818
+ reregisterServer() {
31819
+ this.adapter.reregisterServer();
31820
+ }
31689
31821
  async destroy(reason) {
31690
31822
  try {
31691
31823
  await this.adapter.destroy(reason);
@@ -31978,18 +32110,18 @@ var init_ext_apps_handler = __esm({
31978
32110
  if (!this.context.registerTool) {
31979
32111
  throw new ExtAppsNotSupportedError("Widget tool registration not supported by host");
31980
32112
  }
31981
- const { name: name33, description, inputSchema: inputSchema32 } = params;
32113
+ const { name: name33, description, inputSchema: inputSchema33 } = params;
31982
32114
  if (!name33 || typeof name33 !== "string") {
31983
32115
  throw new ExtAppsInvalidParamsError("Tool name is required");
31984
32116
  }
31985
32117
  if (!description || typeof description !== "string") {
31986
32118
  throw new ExtAppsInvalidParamsError("Tool description is required");
31987
32119
  }
31988
- if (!inputSchema32 || typeof inputSchema32 !== "object" || Array.isArray(inputSchema32)) {
32120
+ if (!inputSchema33 || typeof inputSchema33 !== "object" || Array.isArray(inputSchema33)) {
31989
32121
  throw new ExtAppsInvalidParamsError("Tool input schema must be a non-null object");
31990
32122
  }
31991
32123
  this.logger.verbose(`handleRegisterTool: name=${name33}`);
31992
- await this.context.registerTool(name33, description, inputSchema32);
32124
+ await this.context.registerTool(name33, description, inputSchema33);
31993
32125
  }
31994
32126
  /**
31995
32127
  * Handle ui/unregisterTool - Unregister a widget-defined tool.
@@ -32186,19 +32318,31 @@ var init_handle_streamable_http_flow = __esm({
32186
32318
  const authorization = request[ServerRequestTokens.auth];
32187
32319
  const { token } = authorization;
32188
32320
  const logger = this.scopeLogger.child("handle:streamable-http:parseInput");
32189
- const sessionResolution = resolveStreamableHttpSession({
32190
- rawHeader: request.headers?.["mcp-session-id"],
32191
- authorizationSession: authorization.session,
32192
- createSession: () => {
32193
- const query = request.query;
32194
- const skillsOnlyMode = detectSkillsOnlyMode(query);
32195
- return createSessionId("streamable-http", token, {
32196
- userAgent: request.headers?.["user-agent"],
32197
- platformDetectionConfig: this.scope.metadata.transport?.platformDetection,
32198
- skillsOnlyMode
32199
- });
32321
+ const body = request.body;
32322
+ const isInitialize2 = body?.method === "initialize";
32323
+ const createSession = () => {
32324
+ const query = request.query;
32325
+ const skillsOnlyMode = detectSkillsOnlyMode(query);
32326
+ return createSessionId("streamable-http", token, {
32327
+ userAgent: request.headers?.["user-agent"],
32328
+ platformDetectionConfig: this.scope.metadata.transport?.platformDetection,
32329
+ skillsOnlyMode
32330
+ });
32331
+ };
32332
+ let sessionResolution;
32333
+ if (isInitialize2) {
32334
+ if (authorization.session?.id) {
32335
+ sessionResolution = { session: authorization.session, createdNew: false, responded404: false };
32336
+ } else {
32337
+ sessionResolution = { session: createSession(), createdNew: true, responded404: false };
32200
32338
  }
32201
- });
32339
+ } else {
32340
+ sessionResolution = resolveStreamableHttpSession({
32341
+ rawHeader: request.headers?.["mcp-session-id"],
32342
+ authorizationSession: authorization.session,
32343
+ createSession
32344
+ });
32345
+ }
32202
32346
  if (sessionResolution.responded404 || !sessionResolution.session) {
32203
32347
  logger.warn("parseInput: invalid mcp-session-id header");
32204
32348
  this.respond(httpRespond.sessionNotFound("invalid session id"));
@@ -32252,11 +32396,13 @@ var init_handle_streamable_http_flow = __esm({
32252
32396
  const authorization = request[ServerRequestTokens.auth];
32253
32397
  syncStreamableHttpAuthorizationSession(authorization, session);
32254
32398
  const transport = await transportService.createTransporter("streamable-http", token, session.id, response);
32255
- if (transport.isInitialized) {
32399
+ const isReinitialize = !!request[ServerRequestTokens.reinitialize];
32400
+ if (transport.isInitialized && isReinitialize) {
32256
32401
  logger.info("onInitialize: transport already initialized, resetting for re-initialization", {
32257
32402
  sessionId: session.id?.slice(0, 20)
32258
32403
  });
32259
32404
  transport.resetForReinitialization();
32405
+ transport.reregisterServer();
32260
32406
  }
32261
32407
  logger.info("onInitialize: transport created, calling initialize");
32262
32408
  await transport.initialize(request, response);
@@ -33805,9 +33951,9 @@ var init_load_skill_flow = __esm({
33805
33951
  if (isAvailable && toolEntryByName) {
33806
33952
  const toolEntry = toolEntryByName.get(t.name);
33807
33953
  if (toolEntry) {
33808
- const inputSchema32 = toolEntry.getInputJsonSchema?.() ?? toolEntry.rawInputSchema;
33809
- if (inputSchema32) {
33810
- result.inputSchema = inputSchema32;
33954
+ const inputSchema33 = toolEntry.getInputJsonSchema?.() ?? toolEntry.rawInputSchema;
33955
+ if (inputSchema33) {
33956
+ result.inputSchema = inputSchema33;
33811
33957
  }
33812
33958
  const rawOutput = toolEntry.getRawOutputSchema?.() ?? toolEntry.rawOutputSchema;
33813
33959
  if (rawOutput) {
@@ -35231,15 +35377,161 @@ var init_load_skills_tool = __esm({
35231
35377
  }
35232
35378
  });
35233
35379
 
35380
+ // libs/sdk/src/skill/tools/read-skill-content.tool.ts
35381
+ import { z as z72 } from "zod";
35382
+ import { readFile as readFile5, pathResolve as pathResolve4 } from "@frontmcp/utils";
35383
+ function flattenFrontmatter(fm) {
35384
+ const result = {};
35385
+ for (const [key, value] of Object.entries(fm)) {
35386
+ if (value !== void 0 && value !== null) {
35387
+ result[key] = value;
35388
+ }
35389
+ }
35390
+ return result;
35391
+ }
35392
+ var inputSchema27, outputSchema25, ReadSkillContentTool;
35393
+ var init_read_skill_content_tool = __esm({
35394
+ "libs/sdk/src/skill/tools/read-skill-content.tool.ts"() {
35395
+ "use strict";
35396
+ init_common();
35397
+ init_skill_md_parser();
35398
+ inputSchema27 = {
35399
+ skillId: z72.string().min(1).describe("ID or name of the skill (as returned by searchSkills or loadSkills)"),
35400
+ type: z72.enum(["reference", "example"]).describe("Type of content to read: reference or example"),
35401
+ name: z72.string().min(1).describe("Name of the reference or example to read (as shown in the routing table from loadSkills)")
35402
+ };
35403
+ outputSchema25 = {
35404
+ skillId: z72.string(),
35405
+ skillName: z72.string(),
35406
+ type: z72.enum(["reference", "example"]),
35407
+ name: z72.string(),
35408
+ description: z72.string(),
35409
+ content: z72.string().describe("Markdown body with frontmatter stripped"),
35410
+ frontmatter: z72.record(z72.string(), z72.unknown()).optional().describe("Parsed YAML frontmatter fields from the file"),
35411
+ reference: z72.string().optional().describe("Parent reference name (examples only)"),
35412
+ level: z72.string().optional().describe("Complexity level: basic, intermediate, or advanced (examples only)"),
35413
+ available: z72.array(z72.string()).optional().describe("Available names for the requested type (included when the requested name is not found)")
35414
+ };
35415
+ ReadSkillContentTool = class extends ToolContext2 {
35416
+ async execute(input) {
35417
+ const skillRegistry = this.scope.skills;
35418
+ if (!skillRegistry) {
35419
+ this.fail(new Error("Skills are not available in this scope"));
35420
+ }
35421
+ const loadResult = await skillRegistry.loadSkill(input.skillId);
35422
+ if (!loadResult) {
35423
+ this.fail(new Error(`Skill "${input.skillId}" not found. Use searchSkills to discover available skills.`));
35424
+ }
35425
+ const { skill } = loadResult;
35426
+ const entry = skillRegistry.findByName(input.skillId);
35427
+ if (!entry) {
35428
+ this.fail(new Error(`Skill "${input.skillId}" entry not found.`));
35429
+ }
35430
+ if (input.type === "reference") {
35431
+ return this.readReference(input, skill, entry);
35432
+ }
35433
+ return this.readExample(input, skill, entry);
35434
+ }
35435
+ async readReference(input, skill, instance) {
35436
+ const refs = skill.resolvedReferences ?? [];
35437
+ const refEntry = refs.find((r) => r.name === input.name);
35438
+ if (!refEntry) {
35439
+ const availableNames = refs.map((r) => r.name);
35440
+ return {
35441
+ skillId: skill.id,
35442
+ skillName: skill.name,
35443
+ type: "reference",
35444
+ name: input.name,
35445
+ description: `Reference "${input.name}" not found.`,
35446
+ content: availableNames.length > 0 ? `Reference "${input.name}" not found. Available references: ${availableNames.join(", ")}` : `Skill "${skill.name}" has no references.`,
35447
+ available: availableNames
35448
+ };
35449
+ }
35450
+ const content = await this.readFileContent(instance, "references", refEntry.filename);
35451
+ const { frontmatter, body } = parseSkillMdFrontmatter(content);
35452
+ return {
35453
+ skillId: skill.id,
35454
+ skillName: skill.name,
35455
+ type: "reference",
35456
+ name: refEntry.name,
35457
+ description: refEntry.description,
35458
+ content: body,
35459
+ frontmatter: flattenFrontmatter(frontmatter)
35460
+ };
35461
+ }
35462
+ async readExample(input, skill, instance) {
35463
+ const examples = skill.resolvedExamples ?? [];
35464
+ const exEntry = examples.find((e) => e.name === input.name);
35465
+ if (!exEntry) {
35466
+ const availableNames = examples.map((e) => e.name);
35467
+ return {
35468
+ skillId: skill.id,
35469
+ skillName: skill.name,
35470
+ type: "example",
35471
+ name: input.name,
35472
+ description: `Example "${input.name}" not found.`,
35473
+ content: availableNames.length > 0 ? `Example "${input.name}" not found. Available examples: ${availableNames.join(", ")}` : `Skill "${skill.name}" has no examples.`,
35474
+ available: availableNames
35475
+ };
35476
+ }
35477
+ const content = await this.readFileContent(instance, "examples", exEntry.filename);
35478
+ const { frontmatter, body } = parseSkillMdFrontmatter(content);
35479
+ return {
35480
+ skillId: skill.id,
35481
+ skillName: skill.name,
35482
+ type: "example",
35483
+ name: exEntry.name,
35484
+ description: exEntry.description,
35485
+ content: body,
35486
+ frontmatter: flattenFrontmatter(frontmatter),
35487
+ reference: exEntry.reference,
35488
+ level: exEntry.level
35489
+ };
35490
+ }
35491
+ async readFileContent(instance, resourceType, filename) {
35492
+ const baseDir = instance.getBaseDir();
35493
+ const resources = instance.getResources();
35494
+ const resourcePath = resources?.[resourceType];
35495
+ if (!baseDir || !resourcePath) {
35496
+ this.fail(new Error(`Skill does not have a ${resourceType} directory configured.`));
35497
+ }
35498
+ const resourceDir = resourcePath.startsWith("/") ? resourcePath : pathResolve4(baseDir, resourcePath);
35499
+ const filePath = pathResolve4(resourceDir, filename);
35500
+ try {
35501
+ return await readFile5(filePath, "utf-8");
35502
+ } catch {
35503
+ this.fail(
35504
+ new Error(`Failed to read ${resourceType} file "${filename}". The file may have been moved or deleted.`)
35505
+ );
35506
+ }
35507
+ }
35508
+ };
35509
+ ReadSkillContentTool = __decorateClass([
35510
+ FrontMcpTool({
35511
+ name: "readSkillContent",
35512
+ description: 'Read the full content of a specific reference or example from a skill. After loading a skill with loadSkills, the instructions include routing tables listing available references and examples by name. Use this tool to read the complete content of any listed item.\n\n**When to use:**\n- After loadSkills shows a reference you need to read for detailed guidance\n- When you need a worked example for a specific scenario\n- When the routing table lists a topic you want to explore further\n\n**Example flow:**\n1. loadSkills({ skillIds: ["frontmcp-deployment"] }) \u2014 see routing table\n2. readSkillContent({ skillId: "frontmcp-deployment", type: "reference", name: "deploy-to-vercel" })\n3. readSkillContent({ skillId: "frontmcp-deployment", type: "example", name: "vercel-with-kv" })',
35513
+ inputSchema: inputSchema27,
35514
+ outputSchema: outputSchema25,
35515
+ tags: ["skills", "references", "examples", "content"],
35516
+ annotations: {
35517
+ title: "Read Skill Content",
35518
+ readOnlyHint: true
35519
+ }
35520
+ })
35521
+ ], ReadSkillContentTool);
35522
+ }
35523
+ });
35524
+
35234
35525
  // libs/sdk/src/skill/tools/index.ts
35235
35526
  function getSkillTools() {
35236
- return [SearchSkillsTool, LoadSkillsTool];
35527
+ return [SearchSkillsTool, LoadSkillsTool, ReadSkillContentTool];
35237
35528
  }
35238
35529
  var init_tools = __esm({
35239
35530
  "libs/sdk/src/skill/tools/index.ts"() {
35240
35531
  "use strict";
35241
35532
  init_search_skills_tool();
35242
35533
  init_load_skills_tool();
35534
+ init_read_skill_content_tool();
35243
35535
  }
35244
35536
  });
35245
35537
 
@@ -36154,25 +36446,25 @@ var init_hooks = __esm({
36154
36446
  });
36155
36447
 
36156
36448
  // libs/sdk/src/logging/flows/set-level.flow.ts
36157
- import { z as z72 } from "zod";
36449
+ import { z as z73 } from "zod";
36158
36450
  import { SetLevelRequestSchema as SetLevelRequestSchema2, EmptyResultSchema as EmptyResultSchema4, LoggingLevelSchema } from "@frontmcp/protocol";
36159
- var inputSchema27, outputSchema25, stateSchema26, plan27, name28, Stage28, SetLevelFlow;
36451
+ var inputSchema28, outputSchema26, stateSchema26, plan27, name28, Stage28, SetLevelFlow;
36160
36452
  var init_set_level_flow = __esm({
36161
36453
  "libs/sdk/src/logging/flows/set-level.flow.ts"() {
36162
36454
  "use strict";
36163
36455
  init_common();
36164
36456
  init_errors();
36165
- inputSchema27 = z72.object({
36457
+ inputSchema28 = z73.object({
36166
36458
  request: SetLevelRequestSchema2,
36167
- ctx: z72.unknown()
36459
+ ctx: z73.unknown()
36168
36460
  });
36169
- outputSchema25 = EmptyResultSchema4;
36170
- stateSchema26 = z72.object({
36171
- input: z72.object({
36461
+ outputSchema26 = EmptyResultSchema4;
36462
+ stateSchema26 = z73.object({
36463
+ input: z73.object({
36172
36464
  level: LoggingLevelSchema
36173
36465
  }),
36174
- sessionId: z72.string(),
36175
- output: outputSchema25
36466
+ sessionId: z73.string(),
36467
+ output: outputSchema26
36176
36468
  });
36177
36469
  plan27 = {
36178
36470
  pre: ["parseInput"],
@@ -36189,12 +36481,12 @@ var init_set_level_flow = __esm({
36189
36481
  let params;
36190
36482
  let ctx;
36191
36483
  try {
36192
- const inputData = inputSchema27.parse(this.rawInput);
36484
+ const inputData = inputSchema28.parse(this.rawInput);
36193
36485
  method = inputData.request.method;
36194
36486
  params = inputData.request.params;
36195
36487
  ctx = inputData.ctx;
36196
36488
  } catch (e) {
36197
- throw new InvalidInputError("Invalid Input", e instanceof z72.ZodError ? e.issues : void 0);
36489
+ throw new InvalidInputError("Invalid Input", e instanceof z73.ZodError ? e.issues : void 0);
36198
36490
  }
36199
36491
  if (method !== "logging/setLevel") {
36200
36492
  this.logger.warn(`parseInput: invalid method "${method}"`);
@@ -36240,8 +36532,8 @@ var init_set_level_flow = __esm({
36240
36532
  FrontMcpFlow({
36241
36533
  name: name28,
36242
36534
  plan: plan27,
36243
- inputSchema: inputSchema27,
36244
- outputSchema: outputSchema25,
36535
+ inputSchema: inputSchema28,
36536
+ outputSchema: outputSchema26,
36245
36537
  access: "authorized"
36246
36538
  })
36247
36539
  ], SetLevelFlow);
@@ -36249,35 +36541,35 @@ var init_set_level_flow = __esm({
36249
36541
  });
36250
36542
 
36251
36543
  // libs/sdk/src/completion/flows/complete.flow.ts
36252
- import { z as z73 } from "zod";
36544
+ import { z as z74 } from "zod";
36253
36545
  import { CompleteRequestSchema as CompleteRequestSchema2, CompleteResultSchema } from "@frontmcp/protocol";
36254
- var inputSchema28, outputSchema26, PromptRefSchema, ResourceRefSchema, stateSchema27, plan28, name29, Stage29, CompleteFlow;
36546
+ var inputSchema29, outputSchema27, PromptRefSchema, ResourceRefSchema, stateSchema27, plan28, name29, Stage29, CompleteFlow;
36255
36547
  var init_complete_flow = __esm({
36256
36548
  "libs/sdk/src/completion/flows/complete.flow.ts"() {
36257
36549
  "use strict";
36258
36550
  init_common();
36259
36551
  init_errors();
36260
36552
  init_ui();
36261
- inputSchema28 = z73.object({
36553
+ inputSchema29 = z74.object({
36262
36554
  request: CompleteRequestSchema2,
36263
- ctx: z73.unknown()
36555
+ ctx: z74.unknown()
36264
36556
  });
36265
- outputSchema26 = CompleteResultSchema;
36266
- PromptRefSchema = z73.object({
36267
- type: z73.literal("ref/prompt"),
36268
- name: z73.string()
36557
+ outputSchema27 = CompleteResultSchema;
36558
+ PromptRefSchema = z74.object({
36559
+ type: z74.literal("ref/prompt"),
36560
+ name: z74.string()
36269
36561
  });
36270
- ResourceRefSchema = z73.object({
36271
- type: z73.literal("ref/resource"),
36272
- uri: z73.string()
36562
+ ResourceRefSchema = z74.object({
36563
+ type: z74.literal("ref/resource"),
36564
+ uri: z74.string()
36273
36565
  });
36274
- stateSchema27 = z73.object({
36275
- ref: z73.discriminatedUnion("type", [PromptRefSchema, ResourceRefSchema]),
36276
- argument: z73.object({
36277
- name: z73.string(),
36278
- value: z73.string()
36566
+ stateSchema27 = z74.object({
36567
+ ref: z74.discriminatedUnion("type", [PromptRefSchema, ResourceRefSchema]),
36568
+ argument: z74.object({
36569
+ name: z74.string(),
36570
+ value: z74.string()
36279
36571
  }),
36280
- output: outputSchema26
36572
+ output: outputSchema27
36281
36573
  });
36282
36574
  plan28 = {
36283
36575
  pre: ["parseInput"],
@@ -36293,11 +36585,11 @@ var init_complete_flow = __esm({
36293
36585
  let method;
36294
36586
  let params;
36295
36587
  try {
36296
- const inputData = inputSchema28.parse(this.rawInput);
36588
+ const inputData = inputSchema29.parse(this.rawInput);
36297
36589
  method = inputData.request.method;
36298
36590
  params = inputData.request.params;
36299
36591
  } catch (e) {
36300
- throw new InvalidInputError("Invalid Input", e instanceof z73.ZodError ? e.issues : void 0);
36592
+ throw new InvalidInputError("Invalid Input", e instanceof z74.ZodError ? e.issues : void 0);
36301
36593
  }
36302
36594
  if (method !== "completion/complete") {
36303
36595
  this.logger.warn(`parseInput: invalid method "${method}"`);
@@ -36411,8 +36703,8 @@ var init_complete_flow = __esm({
36411
36703
  FrontMcpFlow({
36412
36704
  name: name29,
36413
36705
  plan: plan28,
36414
- inputSchema: inputSchema28,
36415
- outputSchema: outputSchema26,
36706
+ inputSchema: inputSchema29,
36707
+ outputSchema: outputSchema27,
36416
36708
  access: "authorized"
36417
36709
  })
36418
36710
  ], CompleteFlow);
@@ -36420,50 +36712,50 @@ var init_complete_flow = __esm({
36420
36712
  });
36421
36713
 
36422
36714
  // libs/sdk/src/agent/flows/call-agent.flow.ts
36423
- import { z as z74 } from "zod";
36715
+ import { z as z75 } from "zod";
36424
36716
  import { CallToolRequestSchema as CallToolRequestSchema3, CallToolResultSchema as CallToolResultSchema4 } from "@frontmcp/protocol";
36425
36717
  import { ExecutionTimeoutError as ExecutionTimeoutError2, ConcurrencyLimitError as ConcurrencyLimitError2, withTimeout as withTimeout2 } from "@frontmcp/guard";
36426
- var inputSchema29, outputSchema27, stateSchema28, plan29, name30, Stage30, CallAgentFlow;
36718
+ var inputSchema30, outputSchema28, stateSchema28, plan29, name30, Stage30, CallAgentFlow;
36427
36719
  var init_call_agent_flow = __esm({
36428
36720
  "libs/sdk/src/agent/flows/call-agent.flow.ts"() {
36429
36721
  "use strict";
36430
36722
  init_common();
36431
36723
  init_errors();
36432
- inputSchema29 = z74.object({
36724
+ inputSchema30 = z75.object({
36433
36725
  request: CallToolRequestSchema3,
36434
36726
  // z.any() used because ctx is the MCP SDK's ToolCallExtra type which varies by SDK version
36435
- ctx: z74.any()
36727
+ ctx: z75.any()
36436
36728
  });
36437
- outputSchema27 = CallToolResultSchema4;
36438
- stateSchema28 = z74.object({
36439
- input: z74.looseObject({
36440
- name: z74.string().min(1).max(128),
36441
- arguments: z74.looseObject({}).optional()
36729
+ outputSchema28 = CallToolResultSchema4;
36730
+ stateSchema28 = z75.object({
36731
+ input: z75.looseObject({
36732
+ name: z75.string().min(1).max(128),
36733
+ arguments: z75.looseObject({}).optional()
36442
36734
  }),
36443
- authInfo: z74.any().optional(),
36444
- agent: z74.instanceof(AgentEntry),
36445
- agentContext: z74.instanceof(AgentContext),
36735
+ authInfo: z75.any().optional(),
36736
+ agent: z75.instanceof(AgentEntry),
36737
+ agentContext: z75.instanceof(AgentContext),
36446
36738
  // Store the raw executed output for plugins to see
36447
- rawOutput: z74.any().optional(),
36448
- output: outputSchema27,
36739
+ rawOutput: z75.any().optional(),
36740
+ output: outputSchema28,
36449
36741
  // Agent owner ID for hook filtering (set during parseInput)
36450
- _agentOwnerId: z74.string().optional(),
36742
+ _agentOwnerId: z75.string().optional(),
36451
36743
  // Progress token from request's _meta (for progress notifications)
36452
- progressToken: z74.union([z74.string(), z74.number()]).optional(),
36744
+ progressToken: z75.union([z75.string(), z75.number()]).optional(),
36453
36745
  // JSON-RPC request ID (for elicitation routing)
36454
- jsonRpcRequestId: z74.union([z74.string(), z74.number()]).optional(),
36746
+ jsonRpcRequestId: z75.union([z75.string(), z75.number()]).optional(),
36455
36747
  // Execution metadata
36456
- executionMeta: z74.object({
36457
- iterations: z74.number().optional(),
36458
- durationMs: z74.number().optional(),
36459
- usage: z74.object({
36460
- promptTokens: z74.number().optional(),
36461
- completionTokens: z74.number().optional(),
36462
- totalTokens: z74.number().optional()
36748
+ executionMeta: z75.object({
36749
+ iterations: z75.number().optional(),
36750
+ durationMs: z75.number().optional(),
36751
+ usage: z75.object({
36752
+ promptTokens: z75.number().optional(),
36753
+ completionTokens: z75.number().optional(),
36754
+ totalTokens: z75.number().optional()
36463
36755
  }).optional()
36464
36756
  }).optional(),
36465
36757
  // Semaphore ticket for concurrency control (set by acquireSemaphore, used by releaseSemaphore)
36466
- semaphoreTicket: z74.any().optional()
36758
+ semaphoreTicket: z75.any().optional()
36467
36759
  });
36468
36760
  plan29 = {
36469
36761
  pre: ["parseInput", "findAgent", "checkAgentAuthorization", "createAgentContext", "acquireQuota", "acquireSemaphore"],
@@ -36480,12 +36772,12 @@ var init_call_agent_flow = __esm({
36480
36772
  let params;
36481
36773
  let ctx;
36482
36774
  try {
36483
- const inputData = inputSchema29.parse(this.rawInput);
36775
+ const inputData = inputSchema30.parse(this.rawInput);
36484
36776
  method = inputData.request.method;
36485
36777
  params = inputData.request.params;
36486
36778
  ctx = inputData.ctx;
36487
36779
  } catch (e) {
36488
- throw new InvalidInputError("Invalid Input", e instanceof z74.ZodError ? e.issues : void 0);
36780
+ throw new InvalidInputError("Invalid Input", e instanceof z75.ZodError ? e.issues : void 0);
36489
36781
  }
36490
36782
  if (method !== "tools/call") {
36491
36783
  this.logger.warn(`parseInput: invalid method "${method}"`);
@@ -36667,7 +36959,7 @@ var init_call_agent_flow = __esm({
36667
36959
  agentContext.input = agent.parseInput(input);
36668
36960
  this.logger.verbose("validateInput:done");
36669
36961
  } catch (err) {
36670
- if (err instanceof z74.ZodError) {
36962
+ if (err instanceof z75.ZodError) {
36671
36963
  throw new InvalidInputError("Invalid agent input", err.issues);
36672
36964
  }
36673
36965
  this.logger.error("validateInput: failed to parse input", err);
@@ -36827,8 +37119,8 @@ var init_call_agent_flow = __esm({
36827
37119
  FrontMcpFlow({
36828
37120
  name: name30,
36829
37121
  plan: plan29,
36830
- inputSchema: inputSchema29,
36831
- outputSchema: outputSchema27,
37122
+ inputSchema: inputSchema30,
37123
+ outputSchema: outputSchema28,
36832
37124
  access: "authorized"
36833
37125
  })
36834
37126
  ], CallAgentFlow);
@@ -36836,58 +37128,58 @@ var init_call_agent_flow = __esm({
36836
37128
  });
36837
37129
 
36838
37130
  // libs/sdk/src/elicitation/flows/elicitation-request.flow.ts
36839
- import { z as z75 } from "zod";
37131
+ import { z as z76 } from "zod";
36840
37132
  import { randomUUID as randomUUID20 } from "@frontmcp/utils";
36841
- var inputSchema30, outputSchema28, stateSchema29, plan30, name31, Stage31, ElicitationRequestFlow;
37133
+ var inputSchema31, outputSchema29, stateSchema29, plan30, name31, Stage31, ElicitationRequestFlow;
36842
37134
  var init_elicitation_request_flow = __esm({
36843
37135
  "libs/sdk/src/elicitation/flows/elicitation-request.flow.ts"() {
36844
37136
  "use strict";
36845
37137
  init_common();
36846
37138
  init_errors();
36847
37139
  init_elicitation_types();
36848
- inputSchema30 = z75.object({
37140
+ inputSchema31 = z76.object({
36849
37141
  /** Related request ID from the transport */
36850
- relatedRequestId: z75.union([z75.string(), z75.number()]),
37142
+ relatedRequestId: z76.union([z76.string(), z76.number()]),
36851
37143
  /** Session ID for the elicitation */
36852
- sessionId: z75.string(),
37144
+ sessionId: z76.string(),
36853
37145
  /** Message to display to the user */
36854
- message: z75.string(),
37146
+ message: z76.string(),
36855
37147
  /** JSON Schema for the expected response (already converted from Zod) */
36856
- requestedSchema: z75.record(z75.string(), z75.unknown()),
37148
+ requestedSchema: z76.record(z76.string(), z76.unknown()),
36857
37149
  /** Elicitation options */
36858
- options: z75.object({
36859
- mode: z75.enum(["form", "url"]).optional(),
36860
- ttl: z75.number().optional(),
36861
- elicitationId: z75.string().optional()
37150
+ options: z76.object({
37151
+ mode: z76.enum(["form", "url"]).optional(),
37152
+ ttl: z76.number().optional(),
37153
+ elicitationId: z76.string().optional()
36862
37154
  }).optional()
36863
37155
  });
36864
- outputSchema28 = z75.object({
37156
+ outputSchema29 = z76.object({
36865
37157
  /** Generated or provided elicit ID */
36866
- elicitId: z75.string(),
37158
+ elicitId: z76.string(),
36867
37159
  /** Session ID */
36868
- sessionId: z75.string(),
37160
+ sessionId: z76.string(),
36869
37161
  /** Expiration timestamp */
36870
- expiresAt: z75.number(),
37162
+ expiresAt: z76.number(),
36871
37163
  /** Elicitation mode */
36872
- mode: z75.enum(["form", "url"]),
37164
+ mode: z76.enum(["form", "url"]),
36873
37165
  /** Request parameters to send to client */
36874
- requestParams: z75.record(z75.string(), z75.unknown()),
37166
+ requestParams: z76.record(z76.string(), z76.unknown()),
36875
37167
  /** The pending record that was stored */
36876
- pendingRecord: z75.any()
37168
+ pendingRecord: z76.any()
36877
37169
  });
36878
- stateSchema29 = z75.object({
36879
- relatedRequestId: z75.union([z75.string(), z75.number()]),
36880
- sessionId: z75.string(),
36881
- message: z75.string(),
36882
- requestedSchema: z75.record(z75.string(), z75.unknown()),
36883
- mode: z75.enum(["form", "url"]).default("form"),
36884
- ttl: z75.number().default(DEFAULT_ELICIT_TTL),
36885
- elicitationId: z75.string().optional(),
36886
- elicitId: z75.string(),
36887
- expiresAt: z75.number(),
36888
- pendingRecord: z75.any().optional(),
36889
- requestParams: z75.record(z75.string(), z75.unknown()).optional(),
36890
- output: outputSchema28.optional()
37170
+ stateSchema29 = z76.object({
37171
+ relatedRequestId: z76.union([z76.string(), z76.number()]),
37172
+ sessionId: z76.string(),
37173
+ message: z76.string(),
37174
+ requestedSchema: z76.record(z76.string(), z76.unknown()),
37175
+ mode: z76.enum(["form", "url"]).default("form"),
37176
+ ttl: z76.number().default(DEFAULT_ELICIT_TTL),
37177
+ elicitationId: z76.string().optional(),
37178
+ elicitId: z76.string(),
37179
+ expiresAt: z76.number(),
37180
+ pendingRecord: z76.any().optional(),
37181
+ requestParams: z76.record(z76.string(), z76.unknown()).optional(),
37182
+ output: outputSchema29.optional()
36891
37183
  });
36892
37184
  plan30 = {
36893
37185
  pre: ["parseInput", "validateRequest"],
@@ -36900,7 +37192,7 @@ var init_elicitation_request_flow = __esm({
36900
37192
  logger = this.scopeLogger.child("ElicitationRequestFlow");
36901
37193
  async parseInput() {
36902
37194
  this.logger.verbose("parseInput:start");
36903
- const input = inputSchema30.parse(this.rawInput);
37195
+ const input = inputSchema31.parse(this.rawInput);
36904
37196
  const { mode = "form", ttl = DEFAULT_ELICIT_TTL, elicitationId } = input.options ?? {};
36905
37197
  this.state.set({
36906
37198
  relatedRequestId: input.relatedRequestId,
@@ -37004,8 +37296,8 @@ var init_elicitation_request_flow = __esm({
37004
37296
  FrontMcpFlow({
37005
37297
  name: name31,
37006
37298
  plan: plan30,
37007
- inputSchema: inputSchema30,
37008
- outputSchema: outputSchema28,
37299
+ inputSchema: inputSchema31,
37300
+ outputSchema: outputSchema29,
37009
37301
  access: "authorized"
37010
37302
  })
37011
37303
  ], ElicitationRequestFlow);
@@ -37013,39 +37305,39 @@ var init_elicitation_request_flow = __esm({
37013
37305
  });
37014
37306
 
37015
37307
  // libs/sdk/src/elicitation/flows/elicitation-result.flow.ts
37016
- import { z as z76 } from "zod";
37017
- var inputSchema31, outputSchema29, stateSchema30, plan31, name32, Stage32, ElicitationResultFlow;
37308
+ import { z as z77 } from "zod";
37309
+ var inputSchema32, outputSchema30, stateSchema30, plan31, name32, Stage32, ElicitationResultFlow;
37018
37310
  var init_elicitation_result_flow = __esm({
37019
37311
  "libs/sdk/src/elicitation/flows/elicitation-result.flow.ts"() {
37020
37312
  "use strict";
37021
37313
  init_common();
37022
37314
  init_errors();
37023
37315
  init_helpers();
37024
- inputSchema31 = z76.object({
37316
+ inputSchema32 = z77.object({
37025
37317
  /** Session ID for the elicitation */
37026
- sessionId: z76.string(),
37318
+ sessionId: z77.string(),
37027
37319
  /** The result from the client */
37028
- result: z76.object({
37029
- action: z76.enum(["accept", "cancel", "decline"]),
37030
- content: z76.unknown().optional()
37320
+ result: z77.object({
37321
+ action: z77.enum(["accept", "cancel", "decline"]),
37322
+ content: z77.unknown().optional()
37031
37323
  })
37032
37324
  });
37033
- outputSchema29 = z76.object({
37325
+ outputSchema30 = z77.object({
37034
37326
  /** Whether the result was handled */
37035
- handled: z76.boolean(),
37327
+ handled: z77.boolean(),
37036
37328
  /** The elicit ID (if pending was found) */
37037
- elicitId: z76.string().optional(),
37329
+ elicitId: z77.string().optional(),
37038
37330
  /** The processed result */
37039
- result: z76.any().optional()
37331
+ result: z77.any().optional()
37040
37332
  });
37041
- stateSchema30 = z76.object({
37042
- sessionId: z76.string(),
37043
- action: z76.enum(["accept", "cancel", "decline"]),
37044
- content: z76.unknown().optional(),
37045
- pendingRecord: z76.any().optional(),
37046
- elicitResult: z76.any().optional(),
37047
- handled: z76.boolean().default(false),
37048
- output: outputSchema29.optional()
37333
+ stateSchema30 = z77.object({
37334
+ sessionId: z77.string(),
37335
+ action: z77.enum(["accept", "cancel", "decline"]),
37336
+ content: z77.unknown().optional(),
37337
+ pendingRecord: z77.any().optional(),
37338
+ elicitResult: z77.any().optional(),
37339
+ handled: z77.boolean().default(false),
37340
+ output: outputSchema30.optional()
37049
37341
  });
37050
37342
  plan31 = {
37051
37343
  pre: ["parseInput"],
@@ -37058,7 +37350,7 @@ var init_elicitation_result_flow = __esm({
37058
37350
  logger = this.scopeLogger.child("ElicitationResultFlow");
37059
37351
  async parseInput() {
37060
37352
  this.logger.verbose("parseInput:start");
37061
- const input = inputSchema31.parse(this.rawInput);
37353
+ const input = inputSchema32.parse(this.rawInput);
37062
37354
  this.state.set({
37063
37355
  sessionId: input.sessionId,
37064
37356
  action: input.result.action,
@@ -37182,8 +37474,8 @@ var init_elicitation_result_flow = __esm({
37182
37474
  FrontMcpFlow({
37183
37475
  name: name32,
37184
37476
  plan: plan31,
37185
- inputSchema: inputSchema31,
37186
- outputSchema: outputSchema29,
37477
+ inputSchema: inputSchema32,
37478
+ outputSchema: outputSchema30,
37187
37479
  access: "authorized"
37188
37480
  })
37189
37481
  ], ElicitationResultFlow);
@@ -37232,30 +37524,30 @@ var require_dist = __commonJS({
37232
37524
  sqliteStorageOptionsSchema: () => sqliteStorageOptionsSchema
37233
37525
  });
37234
37526
  module.exports = __toCommonJS2(index_exports);
37235
- var import_utils77 = __require("@frontmcp/utils");
37527
+ var import_utils78 = __require("@frontmcp/utils");
37236
37528
  var HKDF_SALT = new TextEncoder().encode("frontmcp-sqlite-storage-v1");
37237
37529
  var HKDF_INFO = new TextEncoder().encode("aes-256-gcm-value-encryption");
37238
37530
  var KEY_LENGTH = 32;
37239
37531
  function deriveEncryptionKey(secret) {
37240
37532
  const ikm = new TextEncoder().encode(secret);
37241
- return (0, import_utils77.hkdfSha256)(ikm, HKDF_SALT, HKDF_INFO, KEY_LENGTH);
37533
+ return (0, import_utils78.hkdfSha256)(ikm, HKDF_SALT, HKDF_INFO, KEY_LENGTH);
37242
37534
  }
37243
37535
  var SEPARATOR = ":";
37244
37536
  function encryptValue(key, plaintext) {
37245
- const iv = (0, import_utils77.randomBytes)(12);
37537
+ const iv = (0, import_utils78.randomBytes)(12);
37246
37538
  const plaintextBytes = new TextEncoder().encode(plaintext);
37247
- const { ciphertext, tag } = (0, import_utils77.encryptAesGcm)(key, plaintextBytes, iv);
37248
- return [(0, import_utils77.base64urlEncode)(iv), (0, import_utils77.base64urlEncode)(tag), (0, import_utils77.base64urlEncode)(ciphertext)].join(SEPARATOR);
37539
+ const { ciphertext, tag } = (0, import_utils78.encryptAesGcm)(key, plaintextBytes, iv);
37540
+ return [(0, import_utils78.base64urlEncode)(iv), (0, import_utils78.base64urlEncode)(tag), (0, import_utils78.base64urlEncode)(ciphertext)].join(SEPARATOR);
37249
37541
  }
37250
37542
  function decryptValue(key, encrypted) {
37251
37543
  const parts = encrypted.split(SEPARATOR);
37252
37544
  if (parts.length !== 3) {
37253
37545
  throw new Error("Invalid encrypted value format");
37254
37546
  }
37255
- const iv = (0, import_utils77.base64urlDecode)(parts[0]);
37256
- const tag = (0, import_utils77.base64urlDecode)(parts[1]);
37257
- const ciphertext = (0, import_utils77.base64urlDecode)(parts[2]);
37258
- const plaintext = (0, import_utils77.decryptAesGcm)(key, ciphertext, iv, tag);
37547
+ const iv = (0, import_utils78.base64urlDecode)(parts[0]);
37548
+ const tag = (0, import_utils78.base64urlDecode)(parts[1]);
37549
+ const ciphertext = (0, import_utils78.base64urlDecode)(parts[2]);
37550
+ const plaintext = (0, import_utils78.decryptAesGcm)(key, ciphertext, iv, tag);
37259
37551
  return new TextDecoder().decode(plaintext);
37260
37552
  }
37261
37553
  var SqliteKvStore = class {
@@ -37727,14 +38019,14 @@ var require_dist = __commonJS({
37727
38019
  return row.count;
37728
38020
  }
37729
38021
  };
37730
- var import_zod91 = __require("zod");
37731
- var sqliteStorageOptionsSchema = import_zod91.z.object({
37732
- path: import_zod91.z.string().min(1),
37733
- encryption: import_zod91.z.object({
37734
- secret: import_zod91.z.string().min(1)
38022
+ var import_zod92 = __require("zod");
38023
+ var sqliteStorageOptionsSchema = import_zod92.z.object({
38024
+ path: import_zod92.z.string().min(1),
38025
+ encryption: import_zod92.z.object({
38026
+ secret: import_zod92.z.string().min(1)
37735
38027
  }).optional(),
37736
- ttlCleanupIntervalMs: import_zod91.z.number().int().nonnegative().optional().default(6e4),
37737
- walMode: import_zod91.z.boolean().optional().default(true)
38028
+ ttlCleanupIntervalMs: import_zod92.z.number().int().nonnegative().optional().default(6e4),
38029
+ walMode: import_zod92.z.boolean().optional().default(true)
37738
38030
  });
37739
38031
  }
37740
38032
  });
@@ -38378,7 +38670,7 @@ var init_records = __esm({
38378
38670
  });
38379
38671
 
38380
38672
  // libs/sdk/src/common/entries/job.entry.ts
38381
- import { z as z77 } from "zod";
38673
+ import { z as z78 } from "zod";
38382
38674
  import { toJSONSchema as toJSONSchema7 } from "zod/v4";
38383
38675
  var JobEntry;
38384
38676
  var init_job_entry = __esm({
@@ -38409,7 +38701,7 @@ var init_job_entry = __esm({
38409
38701
  getInputJsonSchema() {
38410
38702
  if (this.inputSchema && Object.keys(this.inputSchema).length > 0) {
38411
38703
  try {
38412
- return toJSONSchema7(z77.object(this.inputSchema));
38704
+ return toJSONSchema7(z78.object(this.inputSchema));
38413
38705
  } catch {
38414
38706
  return { type: "object", properties: {} };
38415
38707
  }
@@ -38423,11 +38715,11 @@ var init_job_entry = __esm({
38423
38715
  const outSchema = this.outputSchema;
38424
38716
  if (!outSchema) return null;
38425
38717
  try {
38426
- if (outSchema instanceof z77.ZodType) {
38718
+ if (outSchema instanceof z78.ZodType) {
38427
38719
  return toJSONSchema7(outSchema);
38428
38720
  }
38429
38721
  if (outSchema && typeof outSchema === "object") {
38430
- return toJSONSchema7(z77.object(outSchema));
38722
+ return toJSONSchema7(z78.object(outSchema));
38431
38723
  }
38432
38724
  } catch {
38433
38725
  return { type: "object", properties: {} };
@@ -38507,7 +38799,7 @@ var init_job_interface = __esm({
38507
38799
  });
38508
38800
 
38509
38801
  // libs/sdk/src/job/job.instance.ts
38510
- import { z as z78 } from "zod";
38802
+ import { z as z79 } from "zod";
38511
38803
  var JobInstance, FunctionJobContext;
38512
38804
  var init_job_instance = __esm({
38513
38805
  "libs/sdk/src/job/job.instance.ts"() {
@@ -38585,17 +38877,17 @@ var init_job_instance = __esm({
38585
38877
  }
38586
38878
  }
38587
38879
  parseInput(input) {
38588
- const inputSchema32 = z78.object(this.inputSchema);
38589
- return inputSchema32.parse(input);
38880
+ const inputSchema33 = z79.object(this.inputSchema);
38881
+ return inputSchema33.parse(input);
38590
38882
  }
38591
38883
  parseOutput(raw) {
38592
38884
  if (this.outputSchema) {
38593
38885
  const outSchema = this.outputSchema;
38594
- if (outSchema instanceof z78.ZodType) {
38886
+ if (outSchema instanceof z79.ZodType) {
38595
38887
  return outSchema.parse(raw);
38596
38888
  }
38597
38889
  if (typeof outSchema === "object" && outSchema !== null) {
38598
- return z78.object(outSchema).parse(raw);
38890
+ return z79.object(outSchema).parse(raw);
38599
38891
  }
38600
38892
  }
38601
38893
  return raw;
@@ -39926,7 +40218,7 @@ var init_job_definition_store_factory = __esm({
39926
40218
  });
39927
40219
 
39928
40220
  // libs/sdk/src/job/tools/list-jobs.tool.ts
39929
- import { z as z79 } from "zod";
40221
+ import { z as z80 } from "zod";
39930
40222
  var ListJobsTool;
39931
40223
  var init_list_jobs_tool = __esm({
39932
40224
  "libs/sdk/src/job/tools/list-jobs.tool.ts"() {
@@ -39960,21 +40252,21 @@ var init_list_jobs_tool = __esm({
39960
40252
  name: "list-jobs",
39961
40253
  description: "List registered jobs with optional filtering by tags or labels.",
39962
40254
  inputSchema: {
39963
- tags: z79.array(z79.string()).optional().describe("Filter by tags"),
39964
- labels: z79.record(z79.string(), z79.string()).optional().describe("Filter by labels"),
39965
- query: z79.string().optional().describe("Search query for name/description")
40255
+ tags: z80.array(z80.string()).optional().describe("Filter by tags"),
40256
+ labels: z80.record(z80.string(), z80.string()).optional().describe("Filter by labels"),
40257
+ query: z80.string().optional().describe("Search query for name/description")
39966
40258
  },
39967
40259
  outputSchema: {
39968
- jobs: z79.array(
39969
- z79.object({
39970
- name: z79.string(),
39971
- description: z79.string().optional(),
39972
- tags: z79.array(z79.string()).optional(),
39973
- labels: z79.record(z79.string(), z79.string()).optional(),
39974
- inputSchema: z79.record(z79.string(), z79.unknown()).optional()
40260
+ jobs: z80.array(
40261
+ z80.object({
40262
+ name: z80.string(),
40263
+ description: z80.string().optional(),
40264
+ tags: z80.array(z80.string()).optional(),
40265
+ labels: z80.record(z80.string(), z80.string()).optional(),
40266
+ inputSchema: z80.record(z80.string(), z80.unknown()).optional()
39975
40267
  })
39976
40268
  ),
39977
- count: z79.number()
40269
+ count: z80.number()
39978
40270
  },
39979
40271
  hideFromDiscovery: true
39980
40272
  })
@@ -39983,7 +40275,7 @@ var init_list_jobs_tool = __esm({
39983
40275
  });
39984
40276
 
39985
40277
  // libs/sdk/src/job/tools/execute-job.tool.ts
39986
- import { z as z80 } from "zod";
40278
+ import { z as z81 } from "zod";
39987
40279
  var ExecuteJobTool;
39988
40280
  var init_execute_job_tool = __esm({
39989
40281
  "libs/sdk/src/job/tools/execute-job.tool.ts"() {
@@ -40014,15 +40306,15 @@ var init_execute_job_tool = __esm({
40014
40306
  name: "execute-job",
40015
40307
  description: "Execute a registered job by name. Supports inline (synchronous) and background execution.",
40016
40308
  inputSchema: {
40017
- name: z80.string().describe("Job name to execute"),
40018
- input: z80.record(z80.string(), z80.unknown()).optional().describe("Job input data"),
40019
- background: z80.boolean().optional().default(false).describe("Run in background (returns runId for status polling)")
40309
+ name: z81.string().describe("Job name to execute"),
40310
+ input: z81.record(z81.string(), z81.unknown()).optional().describe("Job input data"),
40311
+ background: z81.boolean().optional().default(false).describe("Run in background (returns runId for status polling)")
40020
40312
  },
40021
40313
  outputSchema: {
40022
- runId: z80.string(),
40023
- state: z80.string(),
40024
- result: z80.unknown().optional(),
40025
- logs: z80.array(z80.string()).optional()
40314
+ runId: z81.string(),
40315
+ state: z81.string(),
40316
+ result: z81.unknown().optional(),
40317
+ logs: z81.array(z81.string()).optional()
40026
40318
  }
40027
40319
  })
40028
40320
  ], ExecuteJobTool);
@@ -40030,7 +40322,7 @@ var init_execute_job_tool = __esm({
40030
40322
  });
40031
40323
 
40032
40324
  // libs/sdk/src/job/tools/get-job-status.tool.ts
40033
- import { z as z81 } from "zod";
40325
+ import { z as z82 } from "zod";
40034
40326
  var GetJobStatusTool;
40035
40327
  var init_get_job_status_tool = __esm({
40036
40328
  "libs/sdk/src/job/tools/get-job-status.tool.ts"() {
@@ -40066,21 +40358,21 @@ var init_get_job_status_tool = __esm({
40066
40358
  name: "get-job-status",
40067
40359
  description: "Get the execution status of a job run by runId.",
40068
40360
  inputSchema: {
40069
- runId: z81.string().describe("Run ID returned from execute-job or execute-workflow")
40361
+ runId: z82.string().describe("Run ID returned from execute-job or execute-workflow")
40070
40362
  },
40071
40363
  outputSchema: {
40072
- runId: z81.string(),
40073
- jobName: z81.string(),
40074
- state: z81.string(),
40075
- result: z81.unknown().optional(),
40076
- error: z81.object({
40077
- message: z81.string(),
40078
- name: z81.string()
40364
+ runId: z82.string(),
40365
+ jobName: z82.string(),
40366
+ state: z82.string(),
40367
+ result: z82.unknown().optional(),
40368
+ error: z82.object({
40369
+ message: z82.string(),
40370
+ name: z82.string()
40079
40371
  }).optional(),
40080
- startedAt: z81.number(),
40081
- completedAt: z81.number().optional(),
40082
- attempt: z81.number(),
40083
- logs: z81.array(z81.string())
40372
+ startedAt: z82.number(),
40373
+ completedAt: z82.number().optional(),
40374
+ attempt: z82.number(),
40375
+ logs: z82.array(z82.string())
40084
40376
  }
40085
40377
  })
40086
40378
  ], GetJobStatusTool);
@@ -40088,7 +40380,7 @@ var init_get_job_status_tool = __esm({
40088
40380
  });
40089
40381
 
40090
40382
  // libs/sdk/src/job/tools/register-job.tool.ts
40091
- import { z as z82 } from "zod";
40383
+ import { z as z83 } from "zod";
40092
40384
  var RegisterJobTool;
40093
40385
  var init_register_job_tool = __esm({
40094
40386
  "libs/sdk/src/job/tools/register-job.tool.ts"() {
@@ -40129,16 +40421,16 @@ var init_register_job_tool = __esm({
40129
40421
  name: "register-job",
40130
40422
  description: "Register a dynamic job that runs in a sandboxed environment.",
40131
40423
  inputSchema: {
40132
- name: z82.string().describe("Job name"),
40133
- description: z82.string().optional().describe("Job description"),
40134
- script: z82.string().describe("JavaScript source code for the job"),
40135
- inputSchema: z82.record(z82.string(), z82.unknown()).optional().describe("JSON Schema for input"),
40136
- outputSchema: z82.record(z82.string(), z82.unknown()).optional().describe("JSON Schema for output"),
40137
- tags: z82.array(z82.string()).optional().describe("Tags for categorization")
40424
+ name: z83.string().describe("Job name"),
40425
+ description: z83.string().optional().describe("Job description"),
40426
+ script: z83.string().describe("JavaScript source code for the job"),
40427
+ inputSchema: z83.record(z83.string(), z83.unknown()).optional().describe("JSON Schema for input"),
40428
+ outputSchema: z83.record(z83.string(), z83.unknown()).optional().describe("JSON Schema for output"),
40429
+ tags: z83.array(z83.string()).optional().describe("Tags for categorization")
40138
40430
  },
40139
40431
  outputSchema: {
40140
- success: z82.boolean(),
40141
- jobId: z82.string()
40432
+ success: z83.boolean(),
40433
+ jobId: z83.string()
40142
40434
  },
40143
40435
  hideFromDiscovery: true
40144
40436
  })
@@ -40147,7 +40439,7 @@ var init_register_job_tool = __esm({
40147
40439
  });
40148
40440
 
40149
40441
  // libs/sdk/src/job/tools/remove-job.tool.ts
40150
- import { z as z83 } from "zod";
40442
+ import { z as z84 } from "zod";
40151
40443
  var RemoveJobTool;
40152
40444
  var init_remove_job_tool = __esm({
40153
40445
  "libs/sdk/src/job/tools/remove-job.tool.ts"() {
@@ -40179,11 +40471,11 @@ var init_remove_job_tool = __esm({
40179
40471
  name: "remove-job",
40180
40472
  description: "Remove a dynamic job by name.",
40181
40473
  inputSchema: {
40182
- name: z83.string().describe("Job name to remove")
40474
+ name: z84.string().describe("Job name to remove")
40183
40475
  },
40184
40476
  outputSchema: {
40185
- success: z83.boolean(),
40186
- message: z83.string()
40477
+ success: z84.boolean(),
40478
+ message: z84.string()
40187
40479
  },
40188
40480
  hideFromDiscovery: true
40189
40481
  })
@@ -40192,7 +40484,7 @@ var init_remove_job_tool = __esm({
40192
40484
  });
40193
40485
 
40194
40486
  // libs/sdk/src/workflow/tools/list-workflows.tool.ts
40195
- import { z as z84 } from "zod";
40487
+ import { z as z85 } from "zod";
40196
40488
  var ListWorkflowsTool;
40197
40489
  var init_list_workflows_tool = __esm({
40198
40490
  "libs/sdk/src/workflow/tools/list-workflows.tool.ts"() {
@@ -40227,21 +40519,21 @@ var init_list_workflows_tool = __esm({
40227
40519
  name: "list-workflows",
40228
40520
  description: "List registered workflows with optional filtering by tags or labels.",
40229
40521
  inputSchema: {
40230
- tags: z84.array(z84.string()).optional().describe("Filter by tags"),
40231
- labels: z84.record(z84.string(), z84.string()).optional().describe("Filter by labels"),
40232
- query: z84.string().optional().describe("Search query for name/description")
40522
+ tags: z85.array(z85.string()).optional().describe("Filter by tags"),
40523
+ labels: z85.record(z85.string(), z85.string()).optional().describe("Filter by labels"),
40524
+ query: z85.string().optional().describe("Search query for name/description")
40233
40525
  },
40234
40526
  outputSchema: {
40235
- workflows: z84.array(
40236
- z84.object({
40237
- name: z84.string(),
40238
- description: z84.string().optional(),
40239
- trigger: z84.string(),
40240
- stepCount: z84.number(),
40241
- tags: z84.array(z84.string()).optional()
40527
+ workflows: z85.array(
40528
+ z85.object({
40529
+ name: z85.string(),
40530
+ description: z85.string().optional(),
40531
+ trigger: z85.string(),
40532
+ stepCount: z85.number(),
40533
+ tags: z85.array(z85.string()).optional()
40242
40534
  })
40243
40535
  ),
40244
- count: z84.number()
40536
+ count: z85.number()
40245
40537
  },
40246
40538
  hideFromDiscovery: true
40247
40539
  })
@@ -40250,7 +40542,7 @@ var init_list_workflows_tool = __esm({
40250
40542
  });
40251
40543
 
40252
40544
  // libs/sdk/src/workflow/tools/execute-workflow.tool.ts
40253
- import { z as z85 } from "zod";
40545
+ import { z as z86 } from "zod";
40254
40546
  var ExecuteWorkflowTool;
40255
40547
  var init_execute_workflow_tool = __esm({
40256
40548
  "libs/sdk/src/workflow/tools/execute-workflow.tool.ts"() {
@@ -40283,14 +40575,14 @@ var init_execute_workflow_tool = __esm({
40283
40575
  name: "execute-workflow",
40284
40576
  description: "Execute a registered workflow by name. Supports inline and background execution.",
40285
40577
  inputSchema: {
40286
- name: z85.string().describe("Workflow name to execute"),
40287
- input: z85.record(z85.string(), z85.unknown()).optional().describe("Workflow input data"),
40288
- background: z85.boolean().optional().default(false).describe("Run in background (returns runId)")
40578
+ name: z86.string().describe("Workflow name to execute"),
40579
+ input: z86.record(z86.string(), z86.unknown()).optional().describe("Workflow input data"),
40580
+ background: z86.boolean().optional().default(false).describe("Run in background (returns runId)")
40289
40581
  },
40290
40582
  outputSchema: {
40291
- runId: z85.string(),
40292
- state: z85.string(),
40293
- result: z85.unknown().optional()
40583
+ runId: z86.string(),
40584
+ state: z86.string(),
40585
+ result: z86.unknown().optional()
40294
40586
  }
40295
40587
  })
40296
40588
  ], ExecuteWorkflowTool);
@@ -40298,7 +40590,7 @@ var init_execute_workflow_tool = __esm({
40298
40590
  });
40299
40591
 
40300
40592
  // libs/sdk/src/workflow/tools/get-workflow-status.tool.ts
40301
- import { z as z86 } from "zod";
40593
+ import { z as z87 } from "zod";
40302
40594
  var GetWorkflowStatusTool;
40303
40595
  var init_get_workflow_status_tool = __esm({
40304
40596
  "libs/sdk/src/workflow/tools/get-workflow-status.tool.ts"() {
@@ -40331,21 +40623,21 @@ var init_get_workflow_status_tool = __esm({
40331
40623
  name: "get-workflow-status",
40332
40624
  description: "Get the execution status of a workflow run with per-step results.",
40333
40625
  inputSchema: {
40334
- runId: z86.string().describe("Run ID returned from execute-workflow")
40626
+ runId: z87.string().describe("Run ID returned from execute-workflow")
40335
40627
  },
40336
40628
  outputSchema: {
40337
- runId: z86.string(),
40338
- workflowName: z86.string().optional(),
40339
- state: z86.string(),
40340
- stepResults: z86.record(
40341
- z86.string(),
40342
- z86.object({
40343
- state: z86.string(),
40344
- outputs: z86.record(z86.string(), z86.unknown()).optional()
40629
+ runId: z87.string(),
40630
+ workflowName: z87.string().optional(),
40631
+ state: z87.string(),
40632
+ stepResults: z87.record(
40633
+ z87.string(),
40634
+ z87.object({
40635
+ state: z87.string(),
40636
+ outputs: z87.record(z87.string(), z87.unknown()).optional()
40345
40637
  })
40346
40638
  ).optional(),
40347
- startedAt: z86.number(),
40348
- completedAt: z86.number().optional()
40639
+ startedAt: z87.number(),
40640
+ completedAt: z87.number().optional()
40349
40641
  }
40350
40642
  })
40351
40643
  ], GetWorkflowStatusTool);
@@ -40353,7 +40645,7 @@ var init_get_workflow_status_tool = __esm({
40353
40645
  });
40354
40646
 
40355
40647
  // libs/sdk/src/workflow/tools/register-workflow.tool.ts
40356
- import { z as z87 } from "zod";
40648
+ import { z as z88 } from "zod";
40357
40649
  var RegisterWorkflowTool;
40358
40650
  var init_register_workflow_tool = __esm({
40359
40651
  "libs/sdk/src/workflow/tools/register-workflow.tool.ts"() {
@@ -40393,24 +40685,24 @@ var init_register_workflow_tool = __esm({
40393
40685
  name: "register-workflow",
40394
40686
  description: "Register a dynamic workflow with step definitions.",
40395
40687
  inputSchema: {
40396
- name: z87.string().describe("Workflow name"),
40397
- description: z87.string().optional().describe("Workflow description"),
40398
- steps: z87.array(
40399
- z87.object({
40400
- id: z87.string().describe("Step identifier"),
40401
- jobName: z87.string().describe("Job name to execute"),
40402
- input: z87.record(z87.string(), z87.unknown()).optional().describe("Static input for the step"),
40403
- dependsOn: z87.array(z87.string()).optional().describe("Step IDs that must complete first"),
40404
- continueOnError: z87.boolean().optional().describe("Continue on failure"),
40405
- timeout: z87.number().optional().describe("Step timeout in ms")
40688
+ name: z88.string().describe("Workflow name"),
40689
+ description: z88.string().optional().describe("Workflow description"),
40690
+ steps: z88.array(
40691
+ z88.object({
40692
+ id: z88.string().describe("Step identifier"),
40693
+ jobName: z88.string().describe("Job name to execute"),
40694
+ input: z88.record(z88.string(), z88.unknown()).optional().describe("Static input for the step"),
40695
+ dependsOn: z88.array(z88.string()).optional().describe("Step IDs that must complete first"),
40696
+ continueOnError: z88.boolean().optional().describe("Continue on failure"),
40697
+ timeout: z88.number().optional().describe("Step timeout in ms")
40406
40698
  })
40407
40699
  ).describe("Workflow step definitions"),
40408
- trigger: z87.enum(["manual", "webhook", "event"]).optional().describe("Trigger type"),
40409
- tags: z87.array(z87.string()).optional().describe("Tags for categorization")
40700
+ trigger: z88.enum(["manual", "webhook", "event"]).optional().describe("Trigger type"),
40701
+ tags: z88.array(z88.string()).optional().describe("Tags for categorization")
40410
40702
  },
40411
40703
  outputSchema: {
40412
- success: z87.boolean(),
40413
- workflowId: z87.string()
40704
+ success: z88.boolean(),
40705
+ workflowId: z88.string()
40414
40706
  },
40415
40707
  hideFromDiscovery: true
40416
40708
  })
@@ -40419,7 +40711,7 @@ var init_register_workflow_tool = __esm({
40419
40711
  });
40420
40712
 
40421
40713
  // libs/sdk/src/workflow/tools/remove-workflow.tool.ts
40422
- import { z as z88 } from "zod";
40714
+ import { z as z89 } from "zod";
40423
40715
  var RemoveWorkflowTool;
40424
40716
  var init_remove_workflow_tool = __esm({
40425
40717
  "libs/sdk/src/workflow/tools/remove-workflow.tool.ts"() {
@@ -40451,11 +40743,11 @@ var init_remove_workflow_tool = __esm({
40451
40743
  name: "remove-workflow",
40452
40744
  description: "Remove a dynamic workflow by name.",
40453
40745
  inputSchema: {
40454
- name: z88.string().describe("Workflow name to remove")
40746
+ name: z89.string().describe("Workflow name to remove")
40455
40747
  },
40456
40748
  outputSchema: {
40457
- success: z88.boolean(),
40458
- message: z88.string()
40749
+ success: z89.boolean(),
40750
+ message: z89.string()
40459
40751
  },
40460
40752
  hideFromDiscovery: true
40461
40753
  })
@@ -44386,20 +44678,32 @@ var init_resource_interface = __esm({
44386
44678
  * Called by the MCP `completion/complete` handler when a client requests
44387
44679
  * suggestions for a template parameter.
44388
44680
  *
44681
+ * There are two ways to provide completions (both have full DI access via `this.get()`):
44682
+ *
44683
+ * 1. **Convention-based (preferred):** Define a method named `${argName}Completer`.
44684
+ * The framework auto-discovers these methods.
44685
+ * ```typescript
44686
+ * async accountNameCompleter(partial: string): Promise<ResourceCompletionResult> {
44687
+ * const service = this.get(MyService);
44688
+ * const accounts = await service.listAccounts();
44689
+ * return { values: accounts.map(a => a.name).filter(n => n.startsWith(partial)) };
44690
+ * }
44691
+ * ```
44692
+ *
44693
+ * 2. **Override-based:** Override this method for dynamic dispatch.
44694
+ * ```typescript
44695
+ * getArgumentCompleter(argName: string): ResourceArgumentCompleter | null {
44696
+ * if (argName === 'userId') {
44697
+ * return async (partial) => ({
44698
+ * values: await this.get(UserService).search(partial),
44699
+ * });
44700
+ * }
44701
+ * return null;
44702
+ * }
44703
+ * ```
44704
+ *
44389
44705
  * @param argName - The template parameter name (e.g., 'userId')
44390
44706
  * @returns A completer function, or null if no completion is available for this argument
44391
- *
44392
- * @example
44393
- * ```typescript
44394
- * getArgumentCompleter(argName: string): ResourceArgumentCompleter | null {
44395
- * if (argName === 'userId') {
44396
- * return async (partial) => ({
44397
- * values: await this.searchUsers(partial),
44398
- * });
44399
- * }
44400
- * return null;
44401
- * }
44402
- * ```
44403
44707
  */
44404
44708
  getArgumentCompleter(_argName) {
44405
44709
  return null;
@@ -45323,7 +45627,7 @@ var init_workflow_interface = __esm({
45323
45627
  });
45324
45628
 
45325
45629
  // libs/sdk/src/common/utils/decide-request-intent.utils.ts
45326
- import { z as z89 } from "zod";
45630
+ import { z as z90 } from "zod";
45327
45631
  function pathOf(req) {
45328
45632
  const anyReq = req;
45329
45633
  const raw = anyReq.path ?? anyReq.pathname ?? anyReq.url ?? "/";
@@ -45435,27 +45739,27 @@ var intentSchema, decisionSchema, CH_OTHER, CH_GET_SSE, CH_POST_INIT_JSON, CH_PO
45435
45739
  var init_decide_request_intent_utils = __esm({
45436
45740
  "libs/sdk/src/common/utils/decide-request-intent.utils.ts"() {
45437
45741
  "use strict";
45438
- intentSchema = z89.union([
45439
- z89.literal("legacy-sse"),
45440
- z89.literal("sse"),
45441
- z89.literal("streamable-http"),
45442
- z89.literal("stateful-http"),
45443
- z89.literal("stateless-http"),
45444
- z89.literal("delete-session"),
45445
- z89.literal("unknown")
45742
+ intentSchema = z90.union([
45743
+ z90.literal("legacy-sse"),
45744
+ z90.literal("sse"),
45745
+ z90.literal("streamable-http"),
45746
+ z90.literal("stateful-http"),
45747
+ z90.literal("stateless-http"),
45748
+ z90.literal("delete-session"),
45749
+ z90.literal("unknown")
45446
45750
  ]);
45447
- decisionSchema = z89.object({
45751
+ decisionSchema = z90.object({
45448
45752
  intent: intentSchema,
45449
- reasons: z89.array(z89.string()),
45450
- recommendation: z89.object({
45451
- httpStatus: z89.number(),
45452
- message: z89.string()
45753
+ reasons: z90.array(z90.string()),
45754
+ recommendation: z90.object({
45755
+ httpStatus: z90.number(),
45756
+ message: z90.string()
45453
45757
  }).optional(),
45454
45758
  // Echo back bits for debugging/telemetry if you like
45455
- debug: z89.object({
45456
- key: z89.number(),
45457
- channel: z89.number(),
45458
- flags: z89.number()
45759
+ debug: z90.object({
45760
+ key: z90.number(),
45761
+ channel: z90.number(),
45762
+ flags: z90.number()
45459
45763
  }).optional()
45460
45764
  });
45461
45765
  CH_OTHER = 0;
@@ -46238,8 +46542,8 @@ var init_tool_entry = __esm({
46238
46542
  }
46239
46543
  if (this.inputSchema && Object.keys(this.inputSchema).length > 0) {
46240
46544
  try {
46241
- const { z: z91, toJSONSchema: toJSONSchema8 } = __require("zod");
46242
- return toJSONSchema8(z91.object(this.inputSchema));
46545
+ const { z: z92, toJSONSchema: toJSONSchema8 } = __require("zod");
46546
+ return toJSONSchema8(z92.object(this.inputSchema));
46243
46547
  } catch (error) {
46244
46548
  if (isDebug2() || isDevelopment4()) {
46245
46549
  console.warn("[ToolEntry] Failed to convert Zod schema to JSON Schema:", error);
@@ -46494,7 +46798,7 @@ var init_entries = __esm({
46494
46798
  });
46495
46799
 
46496
46800
  // libs/sdk/src/common/flow/flow.utils.ts
46497
- import { z as z90 } from "zod";
46801
+ import { z as z91 } from "zod";
46498
46802
  function parseListInput(rawInput, schema, expectedMethod) {
46499
46803
  let method;
46500
46804
  let params;
@@ -46503,7 +46807,7 @@ function parseListInput(rawInput, schema, expectedMethod) {
46503
46807
  method = inputData.request.method;
46504
46808
  params = inputData.request.params ?? {};
46505
46809
  } catch (e) {
46506
- throw new InvalidInputError("Invalid request format", e instanceof z90.ZodError ? e.issues : void 0);
46810
+ throw new InvalidInputError("Invalid request format", e instanceof z91.ZodError ? e.issues : void 0);
46507
46811
  }
46508
46812
  if (method !== expectedMethod) {
46509
46813
  throw new InvalidMethodError(method, expectedMethod);