@frontmcp/sdk 1.0.0-beta.12 → 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.
- package/common/interfaces/resource.interface.d.ts +24 -12
- package/common/interfaces/resource.interface.d.ts.map +1 -1
- package/common/interfaces/skill.interface.d.ts +20 -0
- package/common/interfaces/skill.interface.d.ts.map +1 -1
- package/common/metadata/skill.metadata.d.ts +3 -0
- package/common/metadata/skill.metadata.d.ts.map +1 -1
- package/common/tokens/server.tokens.d.ts +1 -0
- package/common/tokens/server.tokens.d.ts.map +1 -1
- package/esm/index.mjs +659 -353
- package/index.js +731 -425
- package/notification/notification.service.d.ts +5 -0
- package/notification/notification.service.d.ts.map +1 -1
- package/package.json +8 -8
- package/plugin/plugin.utils.d.ts.map +1 -1
- package/resource/resource.instance.d.ts +10 -3
- package/resource/resource.instance.d.ts.map +1 -1
- package/scope/flows/http.request.flow.d.ts.map +1 -1
- package/skill/skill-directory-loader.d.ts.map +1 -1
- package/skill/skill.instance.d.ts +1 -1
- package/skill/skill.instance.d.ts.map +1 -1
- package/skill/skill.utils.d.ts +10 -2
- package/skill/skill.utils.d.ts.map +1 -1
- package/skill/tools/index.d.ts +3 -2
- package/skill/tools/index.d.ts.map +1 -1
- package/skill/tools/read-skill-content.tool.d.ts +65 -0
- package/skill/tools/read-skill-content.tool.d.ts.map +1 -0
- package/tool/ui/ui-shared.d.ts.map +1 -1
- package/transport/adapters/transport.local.adapter.d.ts +6 -0
- package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
- package/transport/flows/handle.streamable-http.flow.d.ts.map +1 -1
- package/transport/transport.local.d.ts +1 -0
- package/transport/transport.local.d.ts.map +1 -1
- package/transport/transport.remote.d.ts +1 -0
- package/transport/transport.remote.d.ts.map +1 -1
- package/transport/transport.types.d.ts +6 -0
- package/transport/transport.types.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -115,7 +115,8 @@ var init_server_tokens = __esm({
|
|
|
115
115
|
type: tokenFactory.type("serverRequest"),
|
|
116
116
|
intent: tokenFactory.meta("intent"),
|
|
117
117
|
auth: tokenFactory.meta("auth"),
|
|
118
|
-
sessionId: tokenFactory.meta("sessionId")
|
|
118
|
+
sessionId: tokenFactory.meta("sessionId"),
|
|
119
|
+
reinitialize: tokenFactory.meta("reinitialize")
|
|
119
120
|
};
|
|
120
121
|
}
|
|
121
122
|
});
|
|
@@ -2935,7 +2936,8 @@ var init_skill_metadata = __esm({
|
|
|
2935
2936
|
skillResourcesSchema = import_zod30.z.object({
|
|
2936
2937
|
scripts: import_zod30.z.string().optional(),
|
|
2937
2938
|
references: import_zod30.z.string().optional(),
|
|
2938
|
-
assets: import_zod30.z.string().optional()
|
|
2939
|
+
assets: import_zod30.z.string().optional(),
|
|
2940
|
+
examples: import_zod30.z.string().optional()
|
|
2939
2941
|
});
|
|
2940
2942
|
skillMetadataSchema = import_zod30.z.object({
|
|
2941
2943
|
id: import_zod30.z.string().optional(),
|
|
@@ -7820,6 +7822,13 @@ var init_notification_service = __esm({
|
|
|
7820
7822
|
isSessionTerminated(sessionId) {
|
|
7821
7823
|
return this.terminatedSessions.has(sessionId);
|
|
7822
7824
|
}
|
|
7825
|
+
/**
|
|
7826
|
+
* Remove a session from the terminated set.
|
|
7827
|
+
* Called when a terminated session is being re-initialized with the same session ID.
|
|
7828
|
+
*/
|
|
7829
|
+
unmarkTerminated(sessionId) {
|
|
7830
|
+
this.terminatedSessions.delete(sessionId);
|
|
7831
|
+
}
|
|
7823
7832
|
/**
|
|
7824
7833
|
* Broadcast a notification to all registered servers.
|
|
7825
7834
|
*
|
|
@@ -8652,8 +8661,8 @@ var init_tool_instance = __esm({
|
|
|
8652
8661
|
if (isRemoteTool || hasRawJsonSchema) {
|
|
8653
8662
|
return import_zod36.z.looseObject({}).parse(input.arguments ?? {});
|
|
8654
8663
|
}
|
|
8655
|
-
const
|
|
8656
|
-
return
|
|
8664
|
+
const inputSchema33 = import_zod36.z.object(this.inputSchema);
|
|
8665
|
+
return inputSchema33.parse(input.arguments);
|
|
8657
8666
|
}
|
|
8658
8667
|
/**
|
|
8659
8668
|
* Turn the raw tool function result into an MCP-compliant CallToolResult:
|
|
@@ -8792,7 +8801,8 @@ var init_ui_shared = __esm({
|
|
|
8792
8801
|
}
|
|
8793
8802
|
async renderAndRegisterAsync(options) {
|
|
8794
8803
|
const toolName = options["toolName"];
|
|
8795
|
-
const
|
|
8804
|
+
const uiConfig = options["uiConfig"];
|
|
8805
|
+
const template = uiConfig?.["template"];
|
|
8796
8806
|
const input = options["input"] ?? {};
|
|
8797
8807
|
const output = options["output"] ?? {};
|
|
8798
8808
|
const platformType = options["platformType"];
|
|
@@ -9315,29 +9325,29 @@ var init_tools_list_flow = __esm({
|
|
|
9315
9325
|
);
|
|
9316
9326
|
}
|
|
9317
9327
|
const tools = resolved.map(({ finalName, tool }) => {
|
|
9318
|
-
let
|
|
9328
|
+
let inputSchema33;
|
|
9319
9329
|
if (tool.rawInputSchema) {
|
|
9320
|
-
|
|
9330
|
+
inputSchema33 = tool.rawInputSchema;
|
|
9321
9331
|
} else if (tool.inputSchema && Object.keys(tool.inputSchema).length > 0) {
|
|
9322
9332
|
try {
|
|
9323
|
-
|
|
9333
|
+
inputSchema33 = (0, import_v43.toJSONSchema)(import_zod37.z.object(tool.inputSchema));
|
|
9324
9334
|
} catch (e) {
|
|
9325
9335
|
this.logger.warn(`Failed to convert inputSchema for tool ${finalName}:`, e);
|
|
9326
|
-
|
|
9336
|
+
inputSchema33 = { type: "object", properties: {} };
|
|
9327
9337
|
}
|
|
9328
9338
|
} else {
|
|
9329
|
-
|
|
9339
|
+
inputSchema33 = { type: "object", properties: {} };
|
|
9330
9340
|
}
|
|
9331
9341
|
const item = {
|
|
9332
9342
|
name: finalName,
|
|
9333
9343
|
title: tool.metadata.name,
|
|
9334
9344
|
description: tool.metadata.description,
|
|
9335
9345
|
annotations: tool.metadata.annotations,
|
|
9336
|
-
inputSchema:
|
|
9346
|
+
inputSchema: inputSchema33
|
|
9337
9347
|
};
|
|
9338
|
-
const
|
|
9339
|
-
if (
|
|
9340
|
-
item.outputSchema =
|
|
9348
|
+
const outputSchema31 = tool.getRawOutputSchema();
|
|
9349
|
+
if (outputSchema31) {
|
|
9350
|
+
item.outputSchema = outputSchema31;
|
|
9341
9351
|
}
|
|
9342
9352
|
if (hasUIConfig(tool.metadata)) {
|
|
9343
9353
|
const uiConfig = tool.metadata.ui;
|
|
@@ -11045,16 +11055,50 @@ var init_resource_instance = __esm({
|
|
|
11045
11055
|
return this.record.metadata;
|
|
11046
11056
|
}
|
|
11047
11057
|
/**
|
|
11048
|
-
* Get an argument completer
|
|
11049
|
-
*
|
|
11050
|
-
*
|
|
11058
|
+
* Get an argument completer for a template parameter.
|
|
11059
|
+
*
|
|
11060
|
+
* Supports two patterns (both have full DI access via `this.get()`):
|
|
11061
|
+
*
|
|
11062
|
+
* 1. **Convention-based (preferred):** Define `${argName}Completer` on the resource class.
|
|
11063
|
+
* Example: `async accountNameCompleter(partial: string) { ... }`
|
|
11064
|
+
*
|
|
11065
|
+
* 2. **Override-based:** Override `getArgumentCompleter(argName)` on the resource class.
|
|
11066
|
+
*
|
|
11067
|
+
* Convention-based completers take priority over override-based ones.
|
|
11051
11068
|
*/
|
|
11052
11069
|
getArgumentCompleter(argName) {
|
|
11053
|
-
const
|
|
11054
|
-
if (
|
|
11055
|
-
return
|
|
11070
|
+
const record = this.record;
|
|
11071
|
+
if (record.kind === "FUNCTION" /* FUNCTION */ || record.kind === "FUNCTION" /* FUNCTION */) {
|
|
11072
|
+
return null;
|
|
11056
11073
|
}
|
|
11057
|
-
|
|
11074
|
+
const cls = record.provide;
|
|
11075
|
+
if (typeof cls !== "function" || !cls.prototype) {
|
|
11076
|
+
return null;
|
|
11077
|
+
}
|
|
11078
|
+
const conventionMethodName = `${argName}Completer`;
|
|
11079
|
+
const hasConventionMethod = typeof cls.prototype[conventionMethodName] === "function";
|
|
11080
|
+
const hasOverride = typeof cls.prototype.getArgumentCompleter === "function" && cls.prototype.getArgumentCompleter !== ResourceContext.prototype.getArgumentCompleter;
|
|
11081
|
+
if (!hasConventionMethod && !hasOverride) {
|
|
11082
|
+
return null;
|
|
11083
|
+
}
|
|
11084
|
+
const providers = this._providers;
|
|
11085
|
+
const scope = providers.getActiveScope();
|
|
11086
|
+
const logger = scope.logger;
|
|
11087
|
+
const metadata = this.getMetadata();
|
|
11088
|
+
const uri = this.isTemplate ? this.uriTemplate ?? "" : this.uri ?? "";
|
|
11089
|
+
const resourceCtorArgs = {
|
|
11090
|
+
metadata,
|
|
11091
|
+
uri,
|
|
11092
|
+
params: {},
|
|
11093
|
+
providers,
|
|
11094
|
+
logger,
|
|
11095
|
+
authInfo: {}
|
|
11096
|
+
};
|
|
11097
|
+
const instance = new cls(resourceCtorArgs);
|
|
11098
|
+
if (hasConventionMethod) {
|
|
11099
|
+
return (partial) => instance[conventionMethodName](partial);
|
|
11100
|
+
}
|
|
11101
|
+
return instance.getArgumentCompleter(argName);
|
|
11058
11102
|
}
|
|
11059
11103
|
/**
|
|
11060
11104
|
* Match a URI against this resource.
|
|
@@ -14096,7 +14140,8 @@ function normalizePlugin(item) {
|
|
|
14096
14140
|
throw new InvalidUseClassError("plugin", (0, import_di17.tokenName)(provide));
|
|
14097
14141
|
}
|
|
14098
14142
|
const decoratorMetadata = collectPluginMetadata(useClass);
|
|
14099
|
-
const
|
|
14143
|
+
const { providers: _dynamicProviders, ...inlineMetadata } = metadata;
|
|
14144
|
+
const mergedMetadata = { ...decoratorMetadata, ...inlineMetadata };
|
|
14100
14145
|
return {
|
|
14101
14146
|
kind: "CLASS" /* CLASS */,
|
|
14102
14147
|
provide,
|
|
@@ -14122,7 +14167,8 @@ function normalizePlugin(item) {
|
|
|
14122
14167
|
throw new InvalidUseValueError("plugin", (0, import_di17.tokenName)(provide));
|
|
14123
14168
|
}
|
|
14124
14169
|
const decoratorMetadata = collectPluginMetadata(useValue.constructor);
|
|
14125
|
-
const
|
|
14170
|
+
const { providers: _dynamicProviders, ...inlineMetadata } = metadata;
|
|
14171
|
+
const mergedMetadata = { ...decoratorMetadata, ...inlineMetadata };
|
|
14126
14172
|
return {
|
|
14127
14173
|
kind: "VALUE" /* VALUE */,
|
|
14128
14174
|
provide,
|
|
@@ -14319,11 +14365,14 @@ async function loadInstructions(source, basePath) {
|
|
|
14319
14365
|
}
|
|
14320
14366
|
throw new InvalidInstructionSourceError();
|
|
14321
14367
|
}
|
|
14322
|
-
function buildSkillContent(metadata, instructions, resolvedReferences) {
|
|
14368
|
+
function buildSkillContent(metadata, instructions, resolvedReferences, resolvedExamples) {
|
|
14323
14369
|
let finalInstructions = instructions;
|
|
14324
14370
|
if (resolvedReferences && resolvedReferences.length > 0) {
|
|
14325
14371
|
finalInstructions += buildReferencesTable(resolvedReferences);
|
|
14326
14372
|
}
|
|
14373
|
+
if (resolvedExamples && resolvedExamples.length > 0) {
|
|
14374
|
+
finalInstructions += buildExamplesTable(resolvedExamples);
|
|
14375
|
+
}
|
|
14327
14376
|
return {
|
|
14328
14377
|
id: metadata.id ?? metadata.name,
|
|
14329
14378
|
name: metadata.name,
|
|
@@ -14337,7 +14386,8 @@ function buildSkillContent(metadata, instructions, resolvedReferences) {
|
|
|
14337
14386
|
specMetadata: metadata.specMetadata,
|
|
14338
14387
|
allowedTools: metadata.allowedTools,
|
|
14339
14388
|
resources: metadata.resources,
|
|
14340
|
-
resolvedReferences
|
|
14389
|
+
resolvedReferences,
|
|
14390
|
+
resolvedExamples
|
|
14341
14391
|
};
|
|
14342
14392
|
}
|
|
14343
14393
|
function buildReferencesTable(refs) {
|
|
@@ -14347,6 +14397,73 @@ function buildReferencesTable(refs) {
|
|
|
14347
14397
|
}
|
|
14348
14398
|
return lines.join("\n");
|
|
14349
14399
|
}
|
|
14400
|
+
function buildExamplesTable(examples) {
|
|
14401
|
+
const lines = [
|
|
14402
|
+
"",
|
|
14403
|
+
"",
|
|
14404
|
+
"## Examples",
|
|
14405
|
+
"",
|
|
14406
|
+
"| Example | Reference | Level | Description |",
|
|
14407
|
+
"| ------- | --------- | ----- | ----------- |"
|
|
14408
|
+
];
|
|
14409
|
+
for (const ex of examples) {
|
|
14410
|
+
lines.push(`| \`${ex.name}\` | \`${ex.reference}\` | ${ex.level} | ${ex.description} |`);
|
|
14411
|
+
}
|
|
14412
|
+
return lines.join("\n");
|
|
14413
|
+
}
|
|
14414
|
+
async function resolveExamples(examplesDir) {
|
|
14415
|
+
if (!await (0, import_utils27.fileExists)(examplesDir)) return void 0;
|
|
14416
|
+
let refDirs;
|
|
14417
|
+
try {
|
|
14418
|
+
refDirs = (await (0, import_utils27.readdir)(examplesDir)).sort();
|
|
14419
|
+
} catch {
|
|
14420
|
+
return void 0;
|
|
14421
|
+
}
|
|
14422
|
+
const examples = [];
|
|
14423
|
+
for (const refDir of refDirs) {
|
|
14424
|
+
const refPath = `${examplesDir}/${refDir}`;
|
|
14425
|
+
try {
|
|
14426
|
+
const s = await (0, import_utils27.stat)(refPath);
|
|
14427
|
+
if (!s.isDirectory()) continue;
|
|
14428
|
+
} catch {
|
|
14429
|
+
continue;
|
|
14430
|
+
}
|
|
14431
|
+
let files;
|
|
14432
|
+
try {
|
|
14433
|
+
files = (await (0, import_utils27.readdir)(refPath)).filter((f) => f.endsWith(".md")).sort();
|
|
14434
|
+
} catch {
|
|
14435
|
+
continue;
|
|
14436
|
+
}
|
|
14437
|
+
for (const file of files) {
|
|
14438
|
+
const content = await (0, import_utils27.readFile)(`${refPath}/${file}`, "utf-8");
|
|
14439
|
+
const filenameWithoutExt = file.replace(/\.md$/, "");
|
|
14440
|
+
let name33 = filenameWithoutExt;
|
|
14441
|
+
let description = "";
|
|
14442
|
+
let reference = refDir;
|
|
14443
|
+
let level = "basic";
|
|
14444
|
+
const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
14445
|
+
if (fmMatch) {
|
|
14446
|
+
const fmLines = fmMatch[1].split(/\r?\n/);
|
|
14447
|
+
for (const line of fmLines) {
|
|
14448
|
+
const colonIdx = line.indexOf(":");
|
|
14449
|
+
if (colonIdx === -1) continue;
|
|
14450
|
+
const key = line.slice(0, colonIdx).trim();
|
|
14451
|
+
const val = line.slice(colonIdx + 1).trim().replace(/^["']|["']$/g, "");
|
|
14452
|
+
if (key === "name" && val) name33 = val;
|
|
14453
|
+
if (key === "description" && val) description = val;
|
|
14454
|
+
if (key === "reference" && val) reference = val;
|
|
14455
|
+
if (key === "level" && val) level = val;
|
|
14456
|
+
}
|
|
14457
|
+
}
|
|
14458
|
+
if (!description) {
|
|
14459
|
+
const body = fmMatch ? content.substring(content.indexOf("---", 3) + 3).trim() : content.trim();
|
|
14460
|
+
description = extractFirstParagraph(body);
|
|
14461
|
+
}
|
|
14462
|
+
examples.push({ name: name33, description, reference, level, filename: `${refDir}/${file}` });
|
|
14463
|
+
}
|
|
14464
|
+
}
|
|
14465
|
+
return examples.length > 0 ? examples : void 0;
|
|
14466
|
+
}
|
|
14350
14467
|
async function resolveReferences(refsDir) {
|
|
14351
14468
|
if (!await (0, import_utils27.fileExists)(refsDir)) return void 0;
|
|
14352
14469
|
let files;
|
|
@@ -14613,16 +14730,24 @@ var init_skill_instance = __esm({
|
|
|
14613
14730
|
return this.cachedContent;
|
|
14614
14731
|
}
|
|
14615
14732
|
const instructions = await this.loadInstructions();
|
|
14733
|
+
const baseDir = this.getBaseDir();
|
|
14616
14734
|
const refsPath = this.metadata.resources?.references;
|
|
14617
14735
|
let resolvedRefs;
|
|
14618
14736
|
if (refsPath) {
|
|
14619
|
-
const baseDir = this.getBaseDir();
|
|
14620
14737
|
const refsDir = refsPath.startsWith("/") ? refsPath : baseDir ? (0, import_utils28.pathResolve)(baseDir, refsPath) : void 0;
|
|
14621
14738
|
if (refsDir) {
|
|
14622
14739
|
resolvedRefs = await resolveReferences(refsDir);
|
|
14623
14740
|
}
|
|
14624
14741
|
}
|
|
14625
|
-
const
|
|
14742
|
+
const examplesPath = this.metadata.resources?.examples;
|
|
14743
|
+
let resolvedExs;
|
|
14744
|
+
if (examplesPath) {
|
|
14745
|
+
const exDir = examplesPath.startsWith("/") ? examplesPath : baseDir ? (0, import_utils28.pathResolve)(baseDir, examplesPath) : void 0;
|
|
14746
|
+
if (exDir) {
|
|
14747
|
+
resolvedExs = await resolveExamples(exDir);
|
|
14748
|
+
}
|
|
14749
|
+
}
|
|
14750
|
+
const baseContent = buildSkillContent(this.metadata, instructions, resolvedRefs, resolvedExs);
|
|
14626
14751
|
this.cachedContent = {
|
|
14627
14752
|
...baseContent,
|
|
14628
14753
|
tags: this.tags,
|
|
@@ -19829,8 +19954,8 @@ var init_agent_instance = __esm({
|
|
|
19829
19954
|
return content;
|
|
19830
19955
|
}
|
|
19831
19956
|
parseInput(input) {
|
|
19832
|
-
const
|
|
19833
|
-
return
|
|
19957
|
+
const inputSchema33 = import_zod47.z.object(this.inputSchema ?? {});
|
|
19958
|
+
return inputSchema33.parse(input.arguments);
|
|
19834
19959
|
}
|
|
19835
19960
|
parseOutput(raw) {
|
|
19836
19961
|
const descriptor = this.outputSchema;
|
|
@@ -19851,13 +19976,13 @@ var init_agent_instance = __esm({
|
|
|
19851
19976
|
*/
|
|
19852
19977
|
getToolDefinition() {
|
|
19853
19978
|
const metadata = this.record.metadata;
|
|
19854
|
-
let
|
|
19979
|
+
let inputSchema33 = {
|
|
19855
19980
|
type: "object",
|
|
19856
19981
|
properties: {}
|
|
19857
19982
|
};
|
|
19858
19983
|
if (this.inputSchema && Object.keys(this.inputSchema).length > 0) {
|
|
19859
19984
|
try {
|
|
19860
|
-
|
|
19985
|
+
inputSchema33 = (0, import_v44.toJSONSchema)(import_zod47.z.object(this.inputSchema));
|
|
19861
19986
|
} catch {
|
|
19862
19987
|
this.scope.logger.warn(`Failed to convert input schema for agent ${this.name}`);
|
|
19863
19988
|
}
|
|
@@ -19865,7 +19990,7 @@ var init_agent_instance = __esm({
|
|
|
19865
19990
|
return {
|
|
19866
19991
|
name: agentToolName(this.id),
|
|
19867
19992
|
description: this.buildToolDescription(metadata),
|
|
19868
|
-
inputSchema:
|
|
19993
|
+
inputSchema: inputSchema33
|
|
19869
19994
|
};
|
|
19870
19995
|
}
|
|
19871
19996
|
/**
|
|
@@ -22696,8 +22821,8 @@ var init_esm_cache = __esm({
|
|
|
22696
22821
|
if (entry.bundleContent) {
|
|
22697
22822
|
return toCachedBundle(entry.bundleContent).content;
|
|
22698
22823
|
}
|
|
22699
|
-
const { readFile:
|
|
22700
|
-
return
|
|
22824
|
+
const { readFile: readFile6 } = require("@frontmcp/utils");
|
|
22825
|
+
return readFile6(entry.bundlePath);
|
|
22701
22826
|
}
|
|
22702
22827
|
/**
|
|
22703
22828
|
* Get the cache directory for a specific package+version combination.
|
|
@@ -22738,13 +22863,13 @@ function normalizeToolFromEsmExport(raw) {
|
|
|
22738
22863
|
const obj = raw;
|
|
22739
22864
|
if (typeof obj["execute"] === "function" && typeof obj["name"] === "string") {
|
|
22740
22865
|
const description = obj["description"];
|
|
22741
|
-
const
|
|
22742
|
-
const
|
|
22866
|
+
const inputSchema33 = obj["inputSchema"];
|
|
22867
|
+
const outputSchema31 = obj["outputSchema"];
|
|
22743
22868
|
return {
|
|
22744
22869
|
name: obj["name"],
|
|
22745
22870
|
description: typeof description === "string" ? description : void 0,
|
|
22746
|
-
inputSchema:
|
|
22747
|
-
outputSchema:
|
|
22871
|
+
inputSchema: inputSchema33 && typeof inputSchema33 === "object" ? inputSchema33 : void 0,
|
|
22872
|
+
outputSchema: outputSchema31 && typeof outputSchema31 === "object" ? outputSchema31 : void 0,
|
|
22748
22873
|
execute: obj["execute"]
|
|
22749
22874
|
};
|
|
22750
22875
|
}
|
|
@@ -23440,11 +23565,11 @@ function isZodShape(schema) {
|
|
|
23440
23565
|
function buildEsmToolRecord(tool, namespace) {
|
|
23441
23566
|
const toolName = namespace ? `${namespace}:${tool.name}` : tool.name;
|
|
23442
23567
|
const ContextClass = createEsmToolContextClass(tool.execute, tool.name);
|
|
23443
|
-
let
|
|
23568
|
+
let inputSchema33 = {};
|
|
23444
23569
|
let rawInputSchema = void 0;
|
|
23445
23570
|
if (tool.inputSchema) {
|
|
23446
23571
|
if (isZodShape(tool.inputSchema)) {
|
|
23447
|
-
|
|
23572
|
+
inputSchema33 = tool.inputSchema;
|
|
23448
23573
|
} else {
|
|
23449
23574
|
rawInputSchema = tool.inputSchema;
|
|
23450
23575
|
}
|
|
@@ -23453,7 +23578,7 @@ function buildEsmToolRecord(tool, namespace) {
|
|
|
23453
23578
|
name: toolName,
|
|
23454
23579
|
id: toolName,
|
|
23455
23580
|
description: tool.description ?? `ESM tool: ${tool.name}`,
|
|
23456
|
-
inputSchema:
|
|
23581
|
+
inputSchema: inputSchema33,
|
|
23457
23582
|
rawInputSchema,
|
|
23458
23583
|
outputSchema: tool.outputSchema ?? "json",
|
|
23459
23584
|
annotations: {
|
|
@@ -27896,11 +28021,10 @@ var init_http_request_flow = __esm({
|
|
|
27896
28021
|
const body = request.body;
|
|
27897
28022
|
if (body?.method === "initialize") {
|
|
27898
28023
|
this.logger.info(
|
|
27899
|
-
`[${this.requestId}] Initialize with terminated session ${sessionId.slice(0, 20)}... -
|
|
28024
|
+
`[${this.requestId}] Initialize with terminated session ${sessionId.slice(0, 20)}... - re-initializing`
|
|
27900
28025
|
);
|
|
27901
|
-
|
|
27902
|
-
|
|
27903
|
-
delete request.headers["mcp-session-id"];
|
|
28026
|
+
this.scope.notifications.unmarkTerminated(sessionId);
|
|
28027
|
+
request[ServerRequestTokens.reinitialize] = true;
|
|
27904
28028
|
} else {
|
|
27905
28029
|
this.logger.warn(`[${this.requestId}] Request to terminated session: ${sessionId.slice(0, 20)}...`);
|
|
27906
28030
|
this.respond(httpRespond.notFound("Session not found"));
|
|
@@ -28024,12 +28148,7 @@ var init_http_request_flow = __esm({
|
|
|
28024
28148
|
return;
|
|
28025
28149
|
}
|
|
28026
28150
|
this.logger.info(`[${this.requestId}] DELETE session: ${sessionId}`);
|
|
28027
|
-
|
|
28028
|
-
if (!wasRegistered) {
|
|
28029
|
-
this.logger.warn(`[${this.requestId}] Session not found for DELETE: ${sessionId}`);
|
|
28030
|
-
this.respond(httpRespond.notFound("Session not found"));
|
|
28031
|
-
return;
|
|
28032
|
-
}
|
|
28151
|
+
this.scope.notifications.terminateSession(sessionId);
|
|
28033
28152
|
const authorization = request[ServerRequestTokens.auth];
|
|
28034
28153
|
if (authorization?.token) {
|
|
28035
28154
|
const transportService = this.scope.transportService;
|
|
@@ -28226,6 +28345,8 @@ var init_transport_remote = __esm({
|
|
|
28226
28345
|
}
|
|
28227
28346
|
resetForReinitialization() {
|
|
28228
28347
|
}
|
|
28348
|
+
reregisterServer() {
|
|
28349
|
+
}
|
|
28229
28350
|
};
|
|
28230
28351
|
}
|
|
28231
28352
|
});
|
|
@@ -29246,20 +29367,20 @@ function formatSkillForLLMWithSchemas(skill, availableTools, missingTools, toolR
|
|
|
29246
29367
|
if (isAvailable) {
|
|
29247
29368
|
const toolEntry = toolEntryByName.get(tool.name);
|
|
29248
29369
|
if (toolEntry) {
|
|
29249
|
-
const
|
|
29250
|
-
const
|
|
29251
|
-
if (
|
|
29370
|
+
const inputSchema33 = getToolInputSchema(toolEntry);
|
|
29371
|
+
const outputSchema31 = toolEntry.getRawOutputSchema?.() ?? toolEntry.rawOutputSchema;
|
|
29372
|
+
if (inputSchema33) {
|
|
29252
29373
|
parts.push("");
|
|
29253
29374
|
parts.push("**Input Schema:**");
|
|
29254
29375
|
parts.push("```json");
|
|
29255
|
-
parts.push(JSON.stringify(
|
|
29376
|
+
parts.push(JSON.stringify(inputSchema33, null, 2));
|
|
29256
29377
|
parts.push("```");
|
|
29257
29378
|
}
|
|
29258
|
-
if (
|
|
29379
|
+
if (outputSchema31) {
|
|
29259
29380
|
parts.push("");
|
|
29260
29381
|
parts.push("**Output Schema:**");
|
|
29261
29382
|
parts.push("```json");
|
|
29262
|
-
parts.push(JSON.stringify(
|
|
29383
|
+
parts.push(JSON.stringify(outputSchema31, null, 2));
|
|
29263
29384
|
parts.push("```");
|
|
29264
29385
|
}
|
|
29265
29386
|
}
|
|
@@ -29600,6 +29721,16 @@ var init_transport_local_adapter = __esm({
|
|
|
29600
29721
|
*/
|
|
29601
29722
|
resetForReinitialization() {
|
|
29602
29723
|
}
|
|
29724
|
+
/**
|
|
29725
|
+
* Re-register the MCP server with the notification service.
|
|
29726
|
+
* Called after resetForReinitialization() to restore the server mapping
|
|
29727
|
+
* that was removed by terminateSession → unregisterServer.
|
|
29728
|
+
*/
|
|
29729
|
+
reregisterServer() {
|
|
29730
|
+
if (this.server) {
|
|
29731
|
+
this.scope.notifications.registerServer(this.key.sessionId, this.server);
|
|
29732
|
+
}
|
|
29733
|
+
}
|
|
29603
29734
|
connectServer() {
|
|
29604
29735
|
const { info, apps } = this.scope.metadata;
|
|
29605
29736
|
const hasRemoteApps = apps?.some((app) => this.isRemoteApp(app)) ?? false;
|
|
@@ -31627,6 +31758,9 @@ var init_transport_local = __esm({
|
|
|
31627
31758
|
resetForReinitialization() {
|
|
31628
31759
|
this.adapter.resetForReinitialization();
|
|
31629
31760
|
}
|
|
31761
|
+
reregisterServer() {
|
|
31762
|
+
this.adapter.reregisterServer();
|
|
31763
|
+
}
|
|
31630
31764
|
async destroy(reason) {
|
|
31631
31765
|
try {
|
|
31632
31766
|
await this.adapter.destroy(reason);
|
|
@@ -31919,18 +32053,18 @@ var init_ext_apps_handler = __esm({
|
|
|
31919
32053
|
if (!this.context.registerTool) {
|
|
31920
32054
|
throw new ExtAppsNotSupportedError("Widget tool registration not supported by host");
|
|
31921
32055
|
}
|
|
31922
|
-
const { name: name33, description, inputSchema:
|
|
32056
|
+
const { name: name33, description, inputSchema: inputSchema33 } = params;
|
|
31923
32057
|
if (!name33 || typeof name33 !== "string") {
|
|
31924
32058
|
throw new ExtAppsInvalidParamsError("Tool name is required");
|
|
31925
32059
|
}
|
|
31926
32060
|
if (!description || typeof description !== "string") {
|
|
31927
32061
|
throw new ExtAppsInvalidParamsError("Tool description is required");
|
|
31928
32062
|
}
|
|
31929
|
-
if (!
|
|
32063
|
+
if (!inputSchema33 || typeof inputSchema33 !== "object" || Array.isArray(inputSchema33)) {
|
|
31930
32064
|
throw new ExtAppsInvalidParamsError("Tool input schema must be a non-null object");
|
|
31931
32065
|
}
|
|
31932
32066
|
this.logger.verbose(`handleRegisterTool: name=${name33}`);
|
|
31933
|
-
await this.context.registerTool(name33, description,
|
|
32067
|
+
await this.context.registerTool(name33, description, inputSchema33);
|
|
31934
32068
|
}
|
|
31935
32069
|
/**
|
|
31936
32070
|
* Handle ui/unregisterTool - Unregister a widget-defined tool.
|
|
@@ -32127,19 +32261,31 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
32127
32261
|
const authorization = request[ServerRequestTokens.auth];
|
|
32128
32262
|
const { token } = authorization;
|
|
32129
32263
|
const logger = this.scopeLogger.child("handle:streamable-http:parseInput");
|
|
32130
|
-
const
|
|
32131
|
-
|
|
32132
|
-
|
|
32133
|
-
|
|
32134
|
-
|
|
32135
|
-
|
|
32136
|
-
|
|
32137
|
-
|
|
32138
|
-
|
|
32139
|
-
|
|
32140
|
-
|
|
32264
|
+
const body = request.body;
|
|
32265
|
+
const isInitialize2 = body?.method === "initialize";
|
|
32266
|
+
const createSession = () => {
|
|
32267
|
+
const query = request.query;
|
|
32268
|
+
const skillsOnlyMode = detectSkillsOnlyMode(query);
|
|
32269
|
+
return createSessionId("streamable-http", token, {
|
|
32270
|
+
userAgent: request.headers?.["user-agent"],
|
|
32271
|
+
platformDetectionConfig: this.scope.metadata.transport?.platformDetection,
|
|
32272
|
+
skillsOnlyMode
|
|
32273
|
+
});
|
|
32274
|
+
};
|
|
32275
|
+
let sessionResolution;
|
|
32276
|
+
if (isInitialize2) {
|
|
32277
|
+
if (authorization.session?.id) {
|
|
32278
|
+
sessionResolution = { session: authorization.session, createdNew: false, responded404: false };
|
|
32279
|
+
} else {
|
|
32280
|
+
sessionResolution = { session: createSession(), createdNew: true, responded404: false };
|
|
32141
32281
|
}
|
|
32142
|
-
}
|
|
32282
|
+
} else {
|
|
32283
|
+
sessionResolution = resolveStreamableHttpSession({
|
|
32284
|
+
rawHeader: request.headers?.["mcp-session-id"],
|
|
32285
|
+
authorizationSession: authorization.session,
|
|
32286
|
+
createSession
|
|
32287
|
+
});
|
|
32288
|
+
}
|
|
32143
32289
|
if (sessionResolution.responded404 || !sessionResolution.session) {
|
|
32144
32290
|
logger.warn("parseInput: invalid mcp-session-id header");
|
|
32145
32291
|
this.respond(httpRespond.sessionNotFound("invalid session id"));
|
|
@@ -32193,11 +32339,13 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
32193
32339
|
const authorization = request[ServerRequestTokens.auth];
|
|
32194
32340
|
syncStreamableHttpAuthorizationSession(authorization, session);
|
|
32195
32341
|
const transport = await transportService.createTransporter("streamable-http", token, session.id, response);
|
|
32196
|
-
|
|
32342
|
+
const isReinitialize = !!request[ServerRequestTokens.reinitialize];
|
|
32343
|
+
if (transport.isInitialized && isReinitialize) {
|
|
32197
32344
|
logger.info("onInitialize: transport already initialized, resetting for re-initialization", {
|
|
32198
32345
|
sessionId: session.id?.slice(0, 20)
|
|
32199
32346
|
});
|
|
32200
32347
|
transport.resetForReinitialization();
|
|
32348
|
+
transport.reregisterServer();
|
|
32201
32349
|
}
|
|
32202
32350
|
logger.info("onInitialize: transport created, calling initialize");
|
|
32203
32351
|
await transport.initialize(request, response);
|
|
@@ -33747,9 +33895,9 @@ var init_load_skill_flow = __esm({
|
|
|
33747
33895
|
if (isAvailable && toolEntryByName) {
|
|
33748
33896
|
const toolEntry = toolEntryByName.get(t.name);
|
|
33749
33897
|
if (toolEntry) {
|
|
33750
|
-
const
|
|
33751
|
-
if (
|
|
33752
|
-
result.inputSchema =
|
|
33898
|
+
const inputSchema33 = toolEntry.getInputJsonSchema?.() ?? toolEntry.rawInputSchema;
|
|
33899
|
+
if (inputSchema33) {
|
|
33900
|
+
result.inputSchema = inputSchema33;
|
|
33753
33901
|
}
|
|
33754
33902
|
const rawOutput = toolEntry.getRawOutputSchema?.() ?? toolEntry.rawOutputSchema;
|
|
33755
33903
|
if (rawOutput) {
|
|
@@ -35173,15 +35321,161 @@ var init_load_skills_tool = __esm({
|
|
|
35173
35321
|
}
|
|
35174
35322
|
});
|
|
35175
35323
|
|
|
35324
|
+
// libs/sdk/src/skill/tools/read-skill-content.tool.ts
|
|
35325
|
+
function flattenFrontmatter(fm) {
|
|
35326
|
+
const result = {};
|
|
35327
|
+
for (const [key, value] of Object.entries(fm)) {
|
|
35328
|
+
if (value !== void 0 && value !== null) {
|
|
35329
|
+
result[key] = value;
|
|
35330
|
+
}
|
|
35331
|
+
}
|
|
35332
|
+
return result;
|
|
35333
|
+
}
|
|
35334
|
+
var import_zod72, import_utils59, inputSchema27, outputSchema25, ReadSkillContentTool;
|
|
35335
|
+
var init_read_skill_content_tool = __esm({
|
|
35336
|
+
"libs/sdk/src/skill/tools/read-skill-content.tool.ts"() {
|
|
35337
|
+
"use strict";
|
|
35338
|
+
import_zod72 = require("zod");
|
|
35339
|
+
init_common();
|
|
35340
|
+
import_utils59 = require("@frontmcp/utils");
|
|
35341
|
+
init_skill_md_parser();
|
|
35342
|
+
inputSchema27 = {
|
|
35343
|
+
skillId: import_zod72.z.string().min(1).describe("ID or name of the skill (as returned by searchSkills or loadSkills)"),
|
|
35344
|
+
type: import_zod72.z.enum(["reference", "example"]).describe("Type of content to read: reference or example"),
|
|
35345
|
+
name: import_zod72.z.string().min(1).describe("Name of the reference or example to read (as shown in the routing table from loadSkills)")
|
|
35346
|
+
};
|
|
35347
|
+
outputSchema25 = {
|
|
35348
|
+
skillId: import_zod72.z.string(),
|
|
35349
|
+
skillName: import_zod72.z.string(),
|
|
35350
|
+
type: import_zod72.z.enum(["reference", "example"]),
|
|
35351
|
+
name: import_zod72.z.string(),
|
|
35352
|
+
description: import_zod72.z.string(),
|
|
35353
|
+
content: import_zod72.z.string().describe("Markdown body with frontmatter stripped"),
|
|
35354
|
+
frontmatter: import_zod72.z.record(import_zod72.z.string(), import_zod72.z.unknown()).optional().describe("Parsed YAML frontmatter fields from the file"),
|
|
35355
|
+
reference: import_zod72.z.string().optional().describe("Parent reference name (examples only)"),
|
|
35356
|
+
level: import_zod72.z.string().optional().describe("Complexity level: basic, intermediate, or advanced (examples only)"),
|
|
35357
|
+
available: import_zod72.z.array(import_zod72.z.string()).optional().describe("Available names for the requested type (included when the requested name is not found)")
|
|
35358
|
+
};
|
|
35359
|
+
ReadSkillContentTool = class extends ToolContext2 {
|
|
35360
|
+
async execute(input) {
|
|
35361
|
+
const skillRegistry = this.scope.skills;
|
|
35362
|
+
if (!skillRegistry) {
|
|
35363
|
+
this.fail(new Error("Skills are not available in this scope"));
|
|
35364
|
+
}
|
|
35365
|
+
const loadResult = await skillRegistry.loadSkill(input.skillId);
|
|
35366
|
+
if (!loadResult) {
|
|
35367
|
+
this.fail(new Error(`Skill "${input.skillId}" not found. Use searchSkills to discover available skills.`));
|
|
35368
|
+
}
|
|
35369
|
+
const { skill } = loadResult;
|
|
35370
|
+
const entry = skillRegistry.findByName(input.skillId);
|
|
35371
|
+
if (!entry) {
|
|
35372
|
+
this.fail(new Error(`Skill "${input.skillId}" entry not found.`));
|
|
35373
|
+
}
|
|
35374
|
+
if (input.type === "reference") {
|
|
35375
|
+
return this.readReference(input, skill, entry);
|
|
35376
|
+
}
|
|
35377
|
+
return this.readExample(input, skill, entry);
|
|
35378
|
+
}
|
|
35379
|
+
async readReference(input, skill, instance) {
|
|
35380
|
+
const refs = skill.resolvedReferences ?? [];
|
|
35381
|
+
const refEntry = refs.find((r) => r.name === input.name);
|
|
35382
|
+
if (!refEntry) {
|
|
35383
|
+
const availableNames = refs.map((r) => r.name);
|
|
35384
|
+
return {
|
|
35385
|
+
skillId: skill.id,
|
|
35386
|
+
skillName: skill.name,
|
|
35387
|
+
type: "reference",
|
|
35388
|
+
name: input.name,
|
|
35389
|
+
description: `Reference "${input.name}" not found.`,
|
|
35390
|
+
content: availableNames.length > 0 ? `Reference "${input.name}" not found. Available references: ${availableNames.join(", ")}` : `Skill "${skill.name}" has no references.`,
|
|
35391
|
+
available: availableNames
|
|
35392
|
+
};
|
|
35393
|
+
}
|
|
35394
|
+
const content = await this.readFileContent(instance, "references", refEntry.filename);
|
|
35395
|
+
const { frontmatter, body } = parseSkillMdFrontmatter(content);
|
|
35396
|
+
return {
|
|
35397
|
+
skillId: skill.id,
|
|
35398
|
+
skillName: skill.name,
|
|
35399
|
+
type: "reference",
|
|
35400
|
+
name: refEntry.name,
|
|
35401
|
+
description: refEntry.description,
|
|
35402
|
+
content: body,
|
|
35403
|
+
frontmatter: flattenFrontmatter(frontmatter)
|
|
35404
|
+
};
|
|
35405
|
+
}
|
|
35406
|
+
async readExample(input, skill, instance) {
|
|
35407
|
+
const examples = skill.resolvedExamples ?? [];
|
|
35408
|
+
const exEntry = examples.find((e) => e.name === input.name);
|
|
35409
|
+
if (!exEntry) {
|
|
35410
|
+
const availableNames = examples.map((e) => e.name);
|
|
35411
|
+
return {
|
|
35412
|
+
skillId: skill.id,
|
|
35413
|
+
skillName: skill.name,
|
|
35414
|
+
type: "example",
|
|
35415
|
+
name: input.name,
|
|
35416
|
+
description: `Example "${input.name}" not found.`,
|
|
35417
|
+
content: availableNames.length > 0 ? `Example "${input.name}" not found. Available examples: ${availableNames.join(", ")}` : `Skill "${skill.name}" has no examples.`,
|
|
35418
|
+
available: availableNames
|
|
35419
|
+
};
|
|
35420
|
+
}
|
|
35421
|
+
const content = await this.readFileContent(instance, "examples", exEntry.filename);
|
|
35422
|
+
const { frontmatter, body } = parseSkillMdFrontmatter(content);
|
|
35423
|
+
return {
|
|
35424
|
+
skillId: skill.id,
|
|
35425
|
+
skillName: skill.name,
|
|
35426
|
+
type: "example",
|
|
35427
|
+
name: exEntry.name,
|
|
35428
|
+
description: exEntry.description,
|
|
35429
|
+
content: body,
|
|
35430
|
+
frontmatter: flattenFrontmatter(frontmatter),
|
|
35431
|
+
reference: exEntry.reference,
|
|
35432
|
+
level: exEntry.level
|
|
35433
|
+
};
|
|
35434
|
+
}
|
|
35435
|
+
async readFileContent(instance, resourceType, filename) {
|
|
35436
|
+
const baseDir = instance.getBaseDir();
|
|
35437
|
+
const resources = instance.getResources();
|
|
35438
|
+
const resourcePath = resources?.[resourceType];
|
|
35439
|
+
if (!baseDir || !resourcePath) {
|
|
35440
|
+
this.fail(new Error(`Skill does not have a ${resourceType} directory configured.`));
|
|
35441
|
+
}
|
|
35442
|
+
const resourceDir = resourcePath.startsWith("/") ? resourcePath : (0, import_utils59.pathResolve)(baseDir, resourcePath);
|
|
35443
|
+
const filePath = (0, import_utils59.pathResolve)(resourceDir, filename);
|
|
35444
|
+
try {
|
|
35445
|
+
return await (0, import_utils59.readFile)(filePath, "utf-8");
|
|
35446
|
+
} catch {
|
|
35447
|
+
this.fail(
|
|
35448
|
+
new Error(`Failed to read ${resourceType} file "${filename}". The file may have been moved or deleted.`)
|
|
35449
|
+
);
|
|
35450
|
+
}
|
|
35451
|
+
}
|
|
35452
|
+
};
|
|
35453
|
+
ReadSkillContentTool = __decorateClass([
|
|
35454
|
+
FrontMcpTool({
|
|
35455
|
+
name: "readSkillContent",
|
|
35456
|
+
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" })',
|
|
35457
|
+
inputSchema: inputSchema27,
|
|
35458
|
+
outputSchema: outputSchema25,
|
|
35459
|
+
tags: ["skills", "references", "examples", "content"],
|
|
35460
|
+
annotations: {
|
|
35461
|
+
title: "Read Skill Content",
|
|
35462
|
+
readOnlyHint: true
|
|
35463
|
+
}
|
|
35464
|
+
})
|
|
35465
|
+
], ReadSkillContentTool);
|
|
35466
|
+
}
|
|
35467
|
+
});
|
|
35468
|
+
|
|
35176
35469
|
// libs/sdk/src/skill/tools/index.ts
|
|
35177
35470
|
function getSkillTools() {
|
|
35178
|
-
return [SearchSkillsTool, LoadSkillsTool];
|
|
35471
|
+
return [SearchSkillsTool, LoadSkillsTool, ReadSkillContentTool];
|
|
35179
35472
|
}
|
|
35180
35473
|
var init_tools = __esm({
|
|
35181
35474
|
"libs/sdk/src/skill/tools/index.ts"() {
|
|
35182
35475
|
"use strict";
|
|
35183
35476
|
init_search_skills_tool();
|
|
35184
35477
|
init_load_skills_tool();
|
|
35478
|
+
init_read_skill_content_tool();
|
|
35185
35479
|
}
|
|
35186
35480
|
});
|
|
35187
35481
|
|
|
@@ -35257,15 +35551,15 @@ var init_skill_session_types = __esm({
|
|
|
35257
35551
|
});
|
|
35258
35552
|
|
|
35259
35553
|
// libs/sdk/src/skill/session/skill-session.manager.ts
|
|
35260
|
-
var
|
|
35554
|
+
var import_utils60, SkillSessionManager;
|
|
35261
35555
|
var init_skill_session_manager = __esm({
|
|
35262
35556
|
"libs/sdk/src/skill/session/skill-session.manager.ts"() {
|
|
35263
35557
|
"use strict";
|
|
35264
|
-
|
|
35558
|
+
import_utils60 = require("@frontmcp/utils");
|
|
35265
35559
|
init_skill_session_types();
|
|
35266
35560
|
init_errors();
|
|
35267
|
-
SkillSessionManager = class extends
|
|
35268
|
-
storage = new
|
|
35561
|
+
SkillSessionManager = class extends import_utils60.EventEmitter {
|
|
35562
|
+
storage = new import_utils60.AsyncLocalStorage();
|
|
35269
35563
|
options;
|
|
35270
35564
|
logger;
|
|
35271
35565
|
store;
|
|
@@ -36096,25 +36390,25 @@ var init_hooks = __esm({
|
|
|
36096
36390
|
});
|
|
36097
36391
|
|
|
36098
36392
|
// libs/sdk/src/logging/flows/set-level.flow.ts
|
|
36099
|
-
var
|
|
36393
|
+
var import_zod73, import_protocol40, inputSchema28, outputSchema26, stateSchema26, plan27, name28, Stage28, SetLevelFlow;
|
|
36100
36394
|
var init_set_level_flow = __esm({
|
|
36101
36395
|
"libs/sdk/src/logging/flows/set-level.flow.ts"() {
|
|
36102
36396
|
"use strict";
|
|
36103
36397
|
init_common();
|
|
36104
|
-
|
|
36398
|
+
import_zod73 = require("zod");
|
|
36105
36399
|
import_protocol40 = require("@frontmcp/protocol");
|
|
36106
36400
|
init_errors();
|
|
36107
|
-
|
|
36401
|
+
inputSchema28 = import_zod73.z.object({
|
|
36108
36402
|
request: import_protocol40.SetLevelRequestSchema,
|
|
36109
|
-
ctx:
|
|
36403
|
+
ctx: import_zod73.z.unknown()
|
|
36110
36404
|
});
|
|
36111
|
-
|
|
36112
|
-
stateSchema26 =
|
|
36113
|
-
input:
|
|
36405
|
+
outputSchema26 = import_protocol40.EmptyResultSchema;
|
|
36406
|
+
stateSchema26 = import_zod73.z.object({
|
|
36407
|
+
input: import_zod73.z.object({
|
|
36114
36408
|
level: import_protocol40.LoggingLevelSchema
|
|
36115
36409
|
}),
|
|
36116
|
-
sessionId:
|
|
36117
|
-
output:
|
|
36410
|
+
sessionId: import_zod73.z.string(),
|
|
36411
|
+
output: outputSchema26
|
|
36118
36412
|
});
|
|
36119
36413
|
plan27 = {
|
|
36120
36414
|
pre: ["parseInput"],
|
|
@@ -36131,12 +36425,12 @@ var init_set_level_flow = __esm({
|
|
|
36131
36425
|
let params;
|
|
36132
36426
|
let ctx;
|
|
36133
36427
|
try {
|
|
36134
|
-
const inputData =
|
|
36428
|
+
const inputData = inputSchema28.parse(this.rawInput);
|
|
36135
36429
|
method = inputData.request.method;
|
|
36136
36430
|
params = inputData.request.params;
|
|
36137
36431
|
ctx = inputData.ctx;
|
|
36138
36432
|
} catch (e) {
|
|
36139
|
-
throw new InvalidInputError("Invalid Input", e instanceof
|
|
36433
|
+
throw new InvalidInputError("Invalid Input", e instanceof import_zod73.z.ZodError ? e.issues : void 0);
|
|
36140
36434
|
}
|
|
36141
36435
|
if (method !== "logging/setLevel") {
|
|
36142
36436
|
this.logger.warn(`parseInput: invalid method "${method}"`);
|
|
@@ -36182,8 +36476,8 @@ var init_set_level_flow = __esm({
|
|
|
36182
36476
|
FrontMcpFlow({
|
|
36183
36477
|
name: name28,
|
|
36184
36478
|
plan: plan27,
|
|
36185
|
-
inputSchema:
|
|
36186
|
-
outputSchema:
|
|
36479
|
+
inputSchema: inputSchema28,
|
|
36480
|
+
outputSchema: outputSchema26,
|
|
36187
36481
|
access: "authorized"
|
|
36188
36482
|
})
|
|
36189
36483
|
], SetLevelFlow);
|
|
@@ -36191,35 +36485,35 @@ var init_set_level_flow = __esm({
|
|
|
36191
36485
|
});
|
|
36192
36486
|
|
|
36193
36487
|
// libs/sdk/src/completion/flows/complete.flow.ts
|
|
36194
|
-
var
|
|
36488
|
+
var import_zod74, import_protocol41, inputSchema29, outputSchema27, PromptRefSchema, ResourceRefSchema, stateSchema27, plan28, name29, Stage29, CompleteFlow;
|
|
36195
36489
|
var init_complete_flow = __esm({
|
|
36196
36490
|
"libs/sdk/src/completion/flows/complete.flow.ts"() {
|
|
36197
36491
|
"use strict";
|
|
36198
36492
|
init_common();
|
|
36199
|
-
|
|
36493
|
+
import_zod74 = require("zod");
|
|
36200
36494
|
import_protocol41 = require("@frontmcp/protocol");
|
|
36201
36495
|
init_errors();
|
|
36202
36496
|
init_ui();
|
|
36203
|
-
|
|
36497
|
+
inputSchema29 = import_zod74.z.object({
|
|
36204
36498
|
request: import_protocol41.CompleteRequestSchema,
|
|
36205
|
-
ctx:
|
|
36499
|
+
ctx: import_zod74.z.unknown()
|
|
36206
36500
|
});
|
|
36207
|
-
|
|
36208
|
-
PromptRefSchema =
|
|
36209
|
-
type:
|
|
36210
|
-
name:
|
|
36501
|
+
outputSchema27 = import_protocol41.CompleteResultSchema;
|
|
36502
|
+
PromptRefSchema = import_zod74.z.object({
|
|
36503
|
+
type: import_zod74.z.literal("ref/prompt"),
|
|
36504
|
+
name: import_zod74.z.string()
|
|
36211
36505
|
});
|
|
36212
|
-
ResourceRefSchema =
|
|
36213
|
-
type:
|
|
36214
|
-
uri:
|
|
36506
|
+
ResourceRefSchema = import_zod74.z.object({
|
|
36507
|
+
type: import_zod74.z.literal("ref/resource"),
|
|
36508
|
+
uri: import_zod74.z.string()
|
|
36215
36509
|
});
|
|
36216
|
-
stateSchema27 =
|
|
36217
|
-
ref:
|
|
36218
|
-
argument:
|
|
36219
|
-
name:
|
|
36220
|
-
value:
|
|
36510
|
+
stateSchema27 = import_zod74.z.object({
|
|
36511
|
+
ref: import_zod74.z.discriminatedUnion("type", [PromptRefSchema, ResourceRefSchema]),
|
|
36512
|
+
argument: import_zod74.z.object({
|
|
36513
|
+
name: import_zod74.z.string(),
|
|
36514
|
+
value: import_zod74.z.string()
|
|
36221
36515
|
}),
|
|
36222
|
-
output:
|
|
36516
|
+
output: outputSchema27
|
|
36223
36517
|
});
|
|
36224
36518
|
plan28 = {
|
|
36225
36519
|
pre: ["parseInput"],
|
|
@@ -36235,11 +36529,11 @@ var init_complete_flow = __esm({
|
|
|
36235
36529
|
let method;
|
|
36236
36530
|
let params;
|
|
36237
36531
|
try {
|
|
36238
|
-
const inputData =
|
|
36532
|
+
const inputData = inputSchema29.parse(this.rawInput);
|
|
36239
36533
|
method = inputData.request.method;
|
|
36240
36534
|
params = inputData.request.params;
|
|
36241
36535
|
} catch (e) {
|
|
36242
|
-
throw new InvalidInputError("Invalid Input", e instanceof
|
|
36536
|
+
throw new InvalidInputError("Invalid Input", e instanceof import_zod74.z.ZodError ? e.issues : void 0);
|
|
36243
36537
|
}
|
|
36244
36538
|
if (method !== "completion/complete") {
|
|
36245
36539
|
this.logger.warn(`parseInput: invalid method "${method}"`);
|
|
@@ -36353,8 +36647,8 @@ var init_complete_flow = __esm({
|
|
|
36353
36647
|
FrontMcpFlow({
|
|
36354
36648
|
name: name29,
|
|
36355
36649
|
plan: plan28,
|
|
36356
|
-
inputSchema:
|
|
36357
|
-
outputSchema:
|
|
36650
|
+
inputSchema: inputSchema29,
|
|
36651
|
+
outputSchema: outputSchema27,
|
|
36358
36652
|
access: "authorized"
|
|
36359
36653
|
})
|
|
36360
36654
|
], CompleteFlow);
|
|
@@ -36362,50 +36656,50 @@ var init_complete_flow = __esm({
|
|
|
36362
36656
|
});
|
|
36363
36657
|
|
|
36364
36658
|
// libs/sdk/src/agent/flows/call-agent.flow.ts
|
|
36365
|
-
var
|
|
36659
|
+
var import_zod75, import_protocol42, import_guard5, inputSchema30, outputSchema28, stateSchema28, plan29, name30, Stage30, CallAgentFlow;
|
|
36366
36660
|
var init_call_agent_flow = __esm({
|
|
36367
36661
|
"libs/sdk/src/agent/flows/call-agent.flow.ts"() {
|
|
36368
36662
|
"use strict";
|
|
36369
36663
|
init_common();
|
|
36370
|
-
|
|
36664
|
+
import_zod75 = require("zod");
|
|
36371
36665
|
import_protocol42 = require("@frontmcp/protocol");
|
|
36372
36666
|
init_errors();
|
|
36373
36667
|
import_guard5 = require("@frontmcp/guard");
|
|
36374
|
-
|
|
36668
|
+
inputSchema30 = import_zod75.z.object({
|
|
36375
36669
|
request: import_protocol42.CallToolRequestSchema,
|
|
36376
36670
|
// z.any() used because ctx is the MCP SDK's ToolCallExtra type which varies by SDK version
|
|
36377
|
-
ctx:
|
|
36671
|
+
ctx: import_zod75.z.any()
|
|
36378
36672
|
});
|
|
36379
|
-
|
|
36380
|
-
stateSchema28 =
|
|
36381
|
-
input:
|
|
36382
|
-
name:
|
|
36383
|
-
arguments:
|
|
36673
|
+
outputSchema28 = import_protocol42.CallToolResultSchema;
|
|
36674
|
+
stateSchema28 = import_zod75.z.object({
|
|
36675
|
+
input: import_zod75.z.looseObject({
|
|
36676
|
+
name: import_zod75.z.string().min(1).max(128),
|
|
36677
|
+
arguments: import_zod75.z.looseObject({}).optional()
|
|
36384
36678
|
}),
|
|
36385
|
-
authInfo:
|
|
36386
|
-
agent:
|
|
36387
|
-
agentContext:
|
|
36679
|
+
authInfo: import_zod75.z.any().optional(),
|
|
36680
|
+
agent: import_zod75.z.instanceof(AgentEntry),
|
|
36681
|
+
agentContext: import_zod75.z.instanceof(AgentContext),
|
|
36388
36682
|
// Store the raw executed output for plugins to see
|
|
36389
|
-
rawOutput:
|
|
36390
|
-
output:
|
|
36683
|
+
rawOutput: import_zod75.z.any().optional(),
|
|
36684
|
+
output: outputSchema28,
|
|
36391
36685
|
// Agent owner ID for hook filtering (set during parseInput)
|
|
36392
|
-
_agentOwnerId:
|
|
36686
|
+
_agentOwnerId: import_zod75.z.string().optional(),
|
|
36393
36687
|
// Progress token from request's _meta (for progress notifications)
|
|
36394
|
-
progressToken:
|
|
36688
|
+
progressToken: import_zod75.z.union([import_zod75.z.string(), import_zod75.z.number()]).optional(),
|
|
36395
36689
|
// JSON-RPC request ID (for elicitation routing)
|
|
36396
|
-
jsonRpcRequestId:
|
|
36690
|
+
jsonRpcRequestId: import_zod75.z.union([import_zod75.z.string(), import_zod75.z.number()]).optional(),
|
|
36397
36691
|
// Execution metadata
|
|
36398
|
-
executionMeta:
|
|
36399
|
-
iterations:
|
|
36400
|
-
durationMs:
|
|
36401
|
-
usage:
|
|
36402
|
-
promptTokens:
|
|
36403
|
-
completionTokens:
|
|
36404
|
-
totalTokens:
|
|
36692
|
+
executionMeta: import_zod75.z.object({
|
|
36693
|
+
iterations: import_zod75.z.number().optional(),
|
|
36694
|
+
durationMs: import_zod75.z.number().optional(),
|
|
36695
|
+
usage: import_zod75.z.object({
|
|
36696
|
+
promptTokens: import_zod75.z.number().optional(),
|
|
36697
|
+
completionTokens: import_zod75.z.number().optional(),
|
|
36698
|
+
totalTokens: import_zod75.z.number().optional()
|
|
36405
36699
|
}).optional()
|
|
36406
36700
|
}).optional(),
|
|
36407
36701
|
// Semaphore ticket for concurrency control (set by acquireSemaphore, used by releaseSemaphore)
|
|
36408
|
-
semaphoreTicket:
|
|
36702
|
+
semaphoreTicket: import_zod75.z.any().optional()
|
|
36409
36703
|
});
|
|
36410
36704
|
plan29 = {
|
|
36411
36705
|
pre: ["parseInput", "findAgent", "checkAgentAuthorization", "createAgentContext", "acquireQuota", "acquireSemaphore"],
|
|
@@ -36422,12 +36716,12 @@ var init_call_agent_flow = __esm({
|
|
|
36422
36716
|
let params;
|
|
36423
36717
|
let ctx;
|
|
36424
36718
|
try {
|
|
36425
|
-
const inputData =
|
|
36719
|
+
const inputData = inputSchema30.parse(this.rawInput);
|
|
36426
36720
|
method = inputData.request.method;
|
|
36427
36721
|
params = inputData.request.params;
|
|
36428
36722
|
ctx = inputData.ctx;
|
|
36429
36723
|
} catch (e) {
|
|
36430
|
-
throw new InvalidInputError("Invalid Input", e instanceof
|
|
36724
|
+
throw new InvalidInputError("Invalid Input", e instanceof import_zod75.z.ZodError ? e.issues : void 0);
|
|
36431
36725
|
}
|
|
36432
36726
|
if (method !== "tools/call") {
|
|
36433
36727
|
this.logger.warn(`parseInput: invalid method "${method}"`);
|
|
@@ -36609,7 +36903,7 @@ var init_call_agent_flow = __esm({
|
|
|
36609
36903
|
agentContext.input = agent.parseInput(input);
|
|
36610
36904
|
this.logger.verbose("validateInput:done");
|
|
36611
36905
|
} catch (err) {
|
|
36612
|
-
if (err instanceof
|
|
36906
|
+
if (err instanceof import_zod75.z.ZodError) {
|
|
36613
36907
|
throw new InvalidInputError("Invalid agent input", err.issues);
|
|
36614
36908
|
}
|
|
36615
36909
|
this.logger.error("validateInput: failed to parse input", err);
|
|
@@ -36769,8 +37063,8 @@ var init_call_agent_flow = __esm({
|
|
|
36769
37063
|
FrontMcpFlow({
|
|
36770
37064
|
name: name30,
|
|
36771
37065
|
plan: plan29,
|
|
36772
|
-
inputSchema:
|
|
36773
|
-
outputSchema:
|
|
37066
|
+
inputSchema: inputSchema30,
|
|
37067
|
+
outputSchema: outputSchema28,
|
|
36774
37068
|
access: "authorized"
|
|
36775
37069
|
})
|
|
36776
37070
|
], CallAgentFlow);
|
|
@@ -36778,58 +37072,58 @@ var init_call_agent_flow = __esm({
|
|
|
36778
37072
|
});
|
|
36779
37073
|
|
|
36780
37074
|
// libs/sdk/src/elicitation/flows/elicitation-request.flow.ts
|
|
36781
|
-
var
|
|
37075
|
+
var import_zod76, import_utils61, inputSchema31, outputSchema29, stateSchema29, plan30, name31, Stage31, ElicitationRequestFlow;
|
|
36782
37076
|
var init_elicitation_request_flow = __esm({
|
|
36783
37077
|
"libs/sdk/src/elicitation/flows/elicitation-request.flow.ts"() {
|
|
36784
37078
|
"use strict";
|
|
36785
37079
|
init_common();
|
|
36786
|
-
|
|
36787
|
-
|
|
37080
|
+
import_zod76 = require("zod");
|
|
37081
|
+
import_utils61 = require("@frontmcp/utils");
|
|
36788
37082
|
init_errors();
|
|
36789
37083
|
init_elicitation_types();
|
|
36790
|
-
|
|
37084
|
+
inputSchema31 = import_zod76.z.object({
|
|
36791
37085
|
/** Related request ID from the transport */
|
|
36792
|
-
relatedRequestId:
|
|
37086
|
+
relatedRequestId: import_zod76.z.union([import_zod76.z.string(), import_zod76.z.number()]),
|
|
36793
37087
|
/** Session ID for the elicitation */
|
|
36794
|
-
sessionId:
|
|
37088
|
+
sessionId: import_zod76.z.string(),
|
|
36795
37089
|
/** Message to display to the user */
|
|
36796
|
-
message:
|
|
37090
|
+
message: import_zod76.z.string(),
|
|
36797
37091
|
/** JSON Schema for the expected response (already converted from Zod) */
|
|
36798
|
-
requestedSchema:
|
|
37092
|
+
requestedSchema: import_zod76.z.record(import_zod76.z.string(), import_zod76.z.unknown()),
|
|
36799
37093
|
/** Elicitation options */
|
|
36800
|
-
options:
|
|
36801
|
-
mode:
|
|
36802
|
-
ttl:
|
|
36803
|
-
elicitationId:
|
|
37094
|
+
options: import_zod76.z.object({
|
|
37095
|
+
mode: import_zod76.z.enum(["form", "url"]).optional(),
|
|
37096
|
+
ttl: import_zod76.z.number().optional(),
|
|
37097
|
+
elicitationId: import_zod76.z.string().optional()
|
|
36804
37098
|
}).optional()
|
|
36805
37099
|
});
|
|
36806
|
-
|
|
37100
|
+
outputSchema29 = import_zod76.z.object({
|
|
36807
37101
|
/** Generated or provided elicit ID */
|
|
36808
|
-
elicitId:
|
|
37102
|
+
elicitId: import_zod76.z.string(),
|
|
36809
37103
|
/** Session ID */
|
|
36810
|
-
sessionId:
|
|
37104
|
+
sessionId: import_zod76.z.string(),
|
|
36811
37105
|
/** Expiration timestamp */
|
|
36812
|
-
expiresAt:
|
|
37106
|
+
expiresAt: import_zod76.z.number(),
|
|
36813
37107
|
/** Elicitation mode */
|
|
36814
|
-
mode:
|
|
37108
|
+
mode: import_zod76.z.enum(["form", "url"]),
|
|
36815
37109
|
/** Request parameters to send to client */
|
|
36816
|
-
requestParams:
|
|
37110
|
+
requestParams: import_zod76.z.record(import_zod76.z.string(), import_zod76.z.unknown()),
|
|
36817
37111
|
/** The pending record that was stored */
|
|
36818
|
-
pendingRecord:
|
|
37112
|
+
pendingRecord: import_zod76.z.any()
|
|
36819
37113
|
});
|
|
36820
|
-
stateSchema29 =
|
|
36821
|
-
relatedRequestId:
|
|
36822
|
-
sessionId:
|
|
36823
|
-
message:
|
|
36824
|
-
requestedSchema:
|
|
36825
|
-
mode:
|
|
36826
|
-
ttl:
|
|
36827
|
-
elicitationId:
|
|
36828
|
-
elicitId:
|
|
36829
|
-
expiresAt:
|
|
36830
|
-
pendingRecord:
|
|
36831
|
-
requestParams:
|
|
36832
|
-
output:
|
|
37114
|
+
stateSchema29 = import_zod76.z.object({
|
|
37115
|
+
relatedRequestId: import_zod76.z.union([import_zod76.z.string(), import_zod76.z.number()]),
|
|
37116
|
+
sessionId: import_zod76.z.string(),
|
|
37117
|
+
message: import_zod76.z.string(),
|
|
37118
|
+
requestedSchema: import_zod76.z.record(import_zod76.z.string(), import_zod76.z.unknown()),
|
|
37119
|
+
mode: import_zod76.z.enum(["form", "url"]).default("form"),
|
|
37120
|
+
ttl: import_zod76.z.number().default(DEFAULT_ELICIT_TTL),
|
|
37121
|
+
elicitationId: import_zod76.z.string().optional(),
|
|
37122
|
+
elicitId: import_zod76.z.string(),
|
|
37123
|
+
expiresAt: import_zod76.z.number(),
|
|
37124
|
+
pendingRecord: import_zod76.z.any().optional(),
|
|
37125
|
+
requestParams: import_zod76.z.record(import_zod76.z.string(), import_zod76.z.unknown()).optional(),
|
|
37126
|
+
output: outputSchema29.optional()
|
|
36833
37127
|
});
|
|
36834
37128
|
plan30 = {
|
|
36835
37129
|
pre: ["parseInput", "validateRequest"],
|
|
@@ -36842,7 +37136,7 @@ var init_elicitation_request_flow = __esm({
|
|
|
36842
37136
|
logger = this.scopeLogger.child("ElicitationRequestFlow");
|
|
36843
37137
|
async parseInput() {
|
|
36844
37138
|
this.logger.verbose("parseInput:start");
|
|
36845
|
-
const input =
|
|
37139
|
+
const input = inputSchema31.parse(this.rawInput);
|
|
36846
37140
|
const { mode = "form", ttl = DEFAULT_ELICIT_TTL, elicitationId } = input.options ?? {};
|
|
36847
37141
|
this.state.set({
|
|
36848
37142
|
relatedRequestId: input.relatedRequestId,
|
|
@@ -36866,7 +37160,7 @@ var init_elicitation_request_flow = __esm({
|
|
|
36866
37160
|
async generateElicitId() {
|
|
36867
37161
|
this.logger.verbose("generateElicitId:start");
|
|
36868
37162
|
const { elicitationId, ttl } = this.state;
|
|
36869
|
-
const elicitId = elicitationId ?? `elicit-${(0,
|
|
37163
|
+
const elicitId = elicitationId ?? `elicit-${(0, import_utils61.randomUUID)()}`;
|
|
36870
37164
|
const expiresAt = Date.now() + (ttl ?? DEFAULT_ELICIT_TTL);
|
|
36871
37165
|
this.state.set({ elicitId, expiresAt });
|
|
36872
37166
|
this.logger.verbose("generateElicitId:done", { elicitId });
|
|
@@ -36946,8 +37240,8 @@ var init_elicitation_request_flow = __esm({
|
|
|
36946
37240
|
FrontMcpFlow({
|
|
36947
37241
|
name: name31,
|
|
36948
37242
|
plan: plan30,
|
|
36949
|
-
inputSchema:
|
|
36950
|
-
outputSchema:
|
|
37243
|
+
inputSchema: inputSchema31,
|
|
37244
|
+
outputSchema: outputSchema29,
|
|
36951
37245
|
access: "authorized"
|
|
36952
37246
|
})
|
|
36953
37247
|
], ElicitationRequestFlow);
|
|
@@ -36955,39 +37249,39 @@ var init_elicitation_request_flow = __esm({
|
|
|
36955
37249
|
});
|
|
36956
37250
|
|
|
36957
37251
|
// libs/sdk/src/elicitation/flows/elicitation-result.flow.ts
|
|
36958
|
-
var
|
|
37252
|
+
var import_zod77, inputSchema32, outputSchema30, stateSchema30, plan31, name32, Stage32, ElicitationResultFlow;
|
|
36959
37253
|
var init_elicitation_result_flow = __esm({
|
|
36960
37254
|
"libs/sdk/src/elicitation/flows/elicitation-result.flow.ts"() {
|
|
36961
37255
|
"use strict";
|
|
36962
37256
|
init_common();
|
|
36963
|
-
|
|
37257
|
+
import_zod77 = require("zod");
|
|
36964
37258
|
init_errors();
|
|
36965
37259
|
init_helpers();
|
|
36966
|
-
|
|
37260
|
+
inputSchema32 = import_zod77.z.object({
|
|
36967
37261
|
/** Session ID for the elicitation */
|
|
36968
|
-
sessionId:
|
|
37262
|
+
sessionId: import_zod77.z.string(),
|
|
36969
37263
|
/** The result from the client */
|
|
36970
|
-
result:
|
|
36971
|
-
action:
|
|
36972
|
-
content:
|
|
37264
|
+
result: import_zod77.z.object({
|
|
37265
|
+
action: import_zod77.z.enum(["accept", "cancel", "decline"]),
|
|
37266
|
+
content: import_zod77.z.unknown().optional()
|
|
36973
37267
|
})
|
|
36974
37268
|
});
|
|
36975
|
-
|
|
37269
|
+
outputSchema30 = import_zod77.z.object({
|
|
36976
37270
|
/** Whether the result was handled */
|
|
36977
|
-
handled:
|
|
37271
|
+
handled: import_zod77.z.boolean(),
|
|
36978
37272
|
/** The elicit ID (if pending was found) */
|
|
36979
|
-
elicitId:
|
|
37273
|
+
elicitId: import_zod77.z.string().optional(),
|
|
36980
37274
|
/** The processed result */
|
|
36981
|
-
result:
|
|
37275
|
+
result: import_zod77.z.any().optional()
|
|
36982
37276
|
});
|
|
36983
|
-
stateSchema30 =
|
|
36984
|
-
sessionId:
|
|
36985
|
-
action:
|
|
36986
|
-
content:
|
|
36987
|
-
pendingRecord:
|
|
36988
|
-
elicitResult:
|
|
36989
|
-
handled:
|
|
36990
|
-
output:
|
|
37277
|
+
stateSchema30 = import_zod77.z.object({
|
|
37278
|
+
sessionId: import_zod77.z.string(),
|
|
37279
|
+
action: import_zod77.z.enum(["accept", "cancel", "decline"]),
|
|
37280
|
+
content: import_zod77.z.unknown().optional(),
|
|
37281
|
+
pendingRecord: import_zod77.z.any().optional(),
|
|
37282
|
+
elicitResult: import_zod77.z.any().optional(),
|
|
37283
|
+
handled: import_zod77.z.boolean().default(false),
|
|
37284
|
+
output: outputSchema30.optional()
|
|
36991
37285
|
});
|
|
36992
37286
|
plan31 = {
|
|
36993
37287
|
pre: ["parseInput"],
|
|
@@ -37000,7 +37294,7 @@ var init_elicitation_result_flow = __esm({
|
|
|
37000
37294
|
logger = this.scopeLogger.child("ElicitationResultFlow");
|
|
37001
37295
|
async parseInput() {
|
|
37002
37296
|
this.logger.verbose("parseInput:start");
|
|
37003
|
-
const input =
|
|
37297
|
+
const input = inputSchema32.parse(this.rawInput);
|
|
37004
37298
|
this.state.set({
|
|
37005
37299
|
sessionId: input.sessionId,
|
|
37006
37300
|
action: input.result.action,
|
|
@@ -37124,8 +37418,8 @@ var init_elicitation_result_flow = __esm({
|
|
|
37124
37418
|
FrontMcpFlow({
|
|
37125
37419
|
name: name32,
|
|
37126
37420
|
plan: plan31,
|
|
37127
|
-
inputSchema:
|
|
37128
|
-
outputSchema:
|
|
37421
|
+
inputSchema: inputSchema32,
|
|
37422
|
+
outputSchema: outputSchema30,
|
|
37129
37423
|
access: "authorized"
|
|
37130
37424
|
})
|
|
37131
37425
|
], ElicitationResultFlow);
|
|
@@ -37174,30 +37468,30 @@ var require_dist = __commonJS({
|
|
|
37174
37468
|
sqliteStorageOptionsSchema: () => sqliteStorageOptionsSchema
|
|
37175
37469
|
});
|
|
37176
37470
|
module2.exports = __toCommonJS2(index_exports2);
|
|
37177
|
-
var
|
|
37471
|
+
var import_utils78 = require("@frontmcp/utils");
|
|
37178
37472
|
var HKDF_SALT = new TextEncoder().encode("frontmcp-sqlite-storage-v1");
|
|
37179
37473
|
var HKDF_INFO = new TextEncoder().encode("aes-256-gcm-value-encryption");
|
|
37180
37474
|
var KEY_LENGTH = 32;
|
|
37181
37475
|
function deriveEncryptionKey(secret) {
|
|
37182
37476
|
const ikm = new TextEncoder().encode(secret);
|
|
37183
|
-
return (0,
|
|
37477
|
+
return (0, import_utils78.hkdfSha256)(ikm, HKDF_SALT, HKDF_INFO, KEY_LENGTH);
|
|
37184
37478
|
}
|
|
37185
37479
|
var SEPARATOR = ":";
|
|
37186
37480
|
function encryptValue(key, plaintext) {
|
|
37187
|
-
const iv = (0,
|
|
37481
|
+
const iv = (0, import_utils78.randomBytes)(12);
|
|
37188
37482
|
const plaintextBytes = new TextEncoder().encode(plaintext);
|
|
37189
|
-
const { ciphertext, tag } = (0,
|
|
37190
|
-
return [(0,
|
|
37483
|
+
const { ciphertext, tag } = (0, import_utils78.encryptAesGcm)(key, plaintextBytes, iv);
|
|
37484
|
+
return [(0, import_utils78.base64urlEncode)(iv), (0, import_utils78.base64urlEncode)(tag), (0, import_utils78.base64urlEncode)(ciphertext)].join(SEPARATOR);
|
|
37191
37485
|
}
|
|
37192
37486
|
function decryptValue(key, encrypted) {
|
|
37193
37487
|
const parts = encrypted.split(SEPARATOR);
|
|
37194
37488
|
if (parts.length !== 3) {
|
|
37195
37489
|
throw new Error("Invalid encrypted value format");
|
|
37196
37490
|
}
|
|
37197
|
-
const iv = (0,
|
|
37198
|
-
const tag = (0,
|
|
37199
|
-
const ciphertext = (0,
|
|
37200
|
-
const plaintext = (0,
|
|
37491
|
+
const iv = (0, import_utils78.base64urlDecode)(parts[0]);
|
|
37492
|
+
const tag = (0, import_utils78.base64urlDecode)(parts[1]);
|
|
37493
|
+
const ciphertext = (0, import_utils78.base64urlDecode)(parts[2]);
|
|
37494
|
+
const plaintext = (0, import_utils78.decryptAesGcm)(key, ciphertext, iv, tag);
|
|
37201
37495
|
return new TextDecoder().decode(plaintext);
|
|
37202
37496
|
}
|
|
37203
37497
|
var SqliteKvStore = class {
|
|
@@ -37669,14 +37963,14 @@ var require_dist = __commonJS({
|
|
|
37669
37963
|
return row.count;
|
|
37670
37964
|
}
|
|
37671
37965
|
};
|
|
37672
|
-
var
|
|
37673
|
-
var sqliteStorageOptionsSchema =
|
|
37674
|
-
path:
|
|
37675
|
-
encryption:
|
|
37676
|
-
secret:
|
|
37966
|
+
var import_zod92 = require("zod");
|
|
37967
|
+
var sqliteStorageOptionsSchema = import_zod92.z.object({
|
|
37968
|
+
path: import_zod92.z.string().min(1),
|
|
37969
|
+
encryption: import_zod92.z.object({
|
|
37970
|
+
secret: import_zod92.z.string().min(1)
|
|
37677
37971
|
}).optional(),
|
|
37678
|
-
ttlCleanupIntervalMs:
|
|
37679
|
-
walMode:
|
|
37972
|
+
ttlCleanupIntervalMs: import_zod92.z.number().int().nonnegative().optional().default(6e4),
|
|
37973
|
+
walMode: import_zod92.z.boolean().optional().default(true)
|
|
37680
37974
|
});
|
|
37681
37975
|
}
|
|
37682
37976
|
});
|
|
@@ -38321,12 +38615,12 @@ var init_records = __esm({
|
|
|
38321
38615
|
});
|
|
38322
38616
|
|
|
38323
38617
|
// libs/sdk/src/common/entries/job.entry.ts
|
|
38324
|
-
var
|
|
38618
|
+
var import_zod78, import_v47, JobEntry;
|
|
38325
38619
|
var init_job_entry = __esm({
|
|
38326
38620
|
"libs/sdk/src/common/entries/job.entry.ts"() {
|
|
38327
38621
|
"use strict";
|
|
38328
38622
|
init_base_entry();
|
|
38329
|
-
|
|
38623
|
+
import_zod78 = require("zod");
|
|
38330
38624
|
import_v47 = require("zod/v4");
|
|
38331
38625
|
JobEntry = class extends BaseEntry {
|
|
38332
38626
|
owner;
|
|
@@ -38352,7 +38646,7 @@ var init_job_entry = __esm({
|
|
|
38352
38646
|
getInputJsonSchema() {
|
|
38353
38647
|
if (this.inputSchema && Object.keys(this.inputSchema).length > 0) {
|
|
38354
38648
|
try {
|
|
38355
|
-
return (0, import_v47.toJSONSchema)(
|
|
38649
|
+
return (0, import_v47.toJSONSchema)(import_zod78.z.object(this.inputSchema));
|
|
38356
38650
|
} catch {
|
|
38357
38651
|
return { type: "object", properties: {} };
|
|
38358
38652
|
}
|
|
@@ -38366,11 +38660,11 @@ var init_job_entry = __esm({
|
|
|
38366
38660
|
const outSchema = this.outputSchema;
|
|
38367
38661
|
if (!outSchema) return null;
|
|
38368
38662
|
try {
|
|
38369
|
-
if (outSchema instanceof
|
|
38663
|
+
if (outSchema instanceof import_zod78.z.ZodType) {
|
|
38370
38664
|
return (0, import_v47.toJSONSchema)(outSchema);
|
|
38371
38665
|
}
|
|
38372
38666
|
if (outSchema && typeof outSchema === "object") {
|
|
38373
|
-
return (0, import_v47.toJSONSchema)(
|
|
38667
|
+
return (0, import_v47.toJSONSchema)(import_zod78.z.object(outSchema));
|
|
38374
38668
|
}
|
|
38375
38669
|
} catch {
|
|
38376
38670
|
return { type: "object", properties: {} };
|
|
@@ -38450,13 +38744,13 @@ var init_job_interface = __esm({
|
|
|
38450
38744
|
});
|
|
38451
38745
|
|
|
38452
38746
|
// libs/sdk/src/job/job.instance.ts
|
|
38453
|
-
var
|
|
38747
|
+
var import_zod79, JobInstance, FunctionJobContext;
|
|
38454
38748
|
var init_job_instance = __esm({
|
|
38455
38749
|
"libs/sdk/src/job/job.instance.ts"() {
|
|
38456
38750
|
"use strict";
|
|
38457
38751
|
init_job_entry();
|
|
38458
38752
|
init_job_interface();
|
|
38459
|
-
|
|
38753
|
+
import_zod79 = require("zod");
|
|
38460
38754
|
init_hooks_utils();
|
|
38461
38755
|
init_mcp_error();
|
|
38462
38756
|
init_errors();
|
|
@@ -38528,17 +38822,17 @@ var init_job_instance = __esm({
|
|
|
38528
38822
|
}
|
|
38529
38823
|
}
|
|
38530
38824
|
parseInput(input) {
|
|
38531
|
-
const
|
|
38532
|
-
return
|
|
38825
|
+
const inputSchema33 = import_zod79.z.object(this.inputSchema);
|
|
38826
|
+
return inputSchema33.parse(input);
|
|
38533
38827
|
}
|
|
38534
38828
|
parseOutput(raw) {
|
|
38535
38829
|
if (this.outputSchema) {
|
|
38536
38830
|
const outSchema = this.outputSchema;
|
|
38537
|
-
if (outSchema instanceof
|
|
38831
|
+
if (outSchema instanceof import_zod79.z.ZodType) {
|
|
38538
38832
|
return outSchema.parse(raw);
|
|
38539
38833
|
}
|
|
38540
38834
|
if (typeof outSchema === "object" && outSchema !== null) {
|
|
38541
|
-
return
|
|
38835
|
+
return import_zod79.z.object(outSchema).parse(raw);
|
|
38542
38836
|
}
|
|
38543
38837
|
}
|
|
38544
38838
|
return raw;
|
|
@@ -39294,11 +39588,11 @@ var init_workflow_engine = __esm({
|
|
|
39294
39588
|
});
|
|
39295
39589
|
|
|
39296
39590
|
// libs/sdk/src/job/execution/job-execution.manager.ts
|
|
39297
|
-
var
|
|
39591
|
+
var import_utils62, JobExecutionManager;
|
|
39298
39592
|
var init_job_execution_manager = __esm({
|
|
39299
39593
|
"libs/sdk/src/job/execution/job-execution.manager.ts"() {
|
|
39300
39594
|
"use strict";
|
|
39301
|
-
|
|
39595
|
+
import_utils62 = require("@frontmcp/utils");
|
|
39302
39596
|
init_workflow_engine();
|
|
39303
39597
|
JobExecutionManager = class {
|
|
39304
39598
|
stateStore;
|
|
@@ -39313,7 +39607,7 @@ var init_job_execution_manager = __esm({
|
|
|
39313
39607
|
* Execute a job inline (synchronous) or in background.
|
|
39314
39608
|
*/
|
|
39315
39609
|
async executeJob(job, input, opts = {}) {
|
|
39316
|
-
const runId = (0,
|
|
39610
|
+
const runId = (0, import_utils62.randomUUID)();
|
|
39317
39611
|
const retryConfig = job.metadata.retry ?? {};
|
|
39318
39612
|
const maxAttempts = retryConfig.maxAttempts ?? 1;
|
|
39319
39613
|
const runRecord = {
|
|
@@ -39351,7 +39645,7 @@ var init_job_execution_manager = __esm({
|
|
|
39351
39645
|
* Execute a workflow inline or in background.
|
|
39352
39646
|
*/
|
|
39353
39647
|
async executeWorkflow(workflow, jobRegistry, opts = {}) {
|
|
39354
|
-
const runId = (0,
|
|
39648
|
+
const runId = (0, import_utils62.randomUUID)();
|
|
39355
39649
|
const runRecord = {
|
|
39356
39650
|
runId,
|
|
39357
39651
|
jobId: workflow.metadata.id ?? workflow.name,
|
|
@@ -39870,11 +40164,11 @@ var init_job_definition_store_factory = __esm({
|
|
|
39870
40164
|
});
|
|
39871
40165
|
|
|
39872
40166
|
// libs/sdk/src/job/tools/list-jobs.tool.ts
|
|
39873
|
-
var
|
|
40167
|
+
var import_zod80, ListJobsTool;
|
|
39874
40168
|
var init_list_jobs_tool = __esm({
|
|
39875
40169
|
"libs/sdk/src/job/tools/list-jobs.tool.ts"() {
|
|
39876
40170
|
"use strict";
|
|
39877
|
-
|
|
40171
|
+
import_zod80 = require("zod");
|
|
39878
40172
|
init_common();
|
|
39879
40173
|
ListJobsTool = class extends ToolContext2 {
|
|
39880
40174
|
async execute(input) {
|
|
@@ -39904,21 +40198,21 @@ var init_list_jobs_tool = __esm({
|
|
|
39904
40198
|
name: "list-jobs",
|
|
39905
40199
|
description: "List registered jobs with optional filtering by tags or labels.",
|
|
39906
40200
|
inputSchema: {
|
|
39907
|
-
tags:
|
|
39908
|
-
labels:
|
|
39909
|
-
query:
|
|
40201
|
+
tags: import_zod80.z.array(import_zod80.z.string()).optional().describe("Filter by tags"),
|
|
40202
|
+
labels: import_zod80.z.record(import_zod80.z.string(), import_zod80.z.string()).optional().describe("Filter by labels"),
|
|
40203
|
+
query: import_zod80.z.string().optional().describe("Search query for name/description")
|
|
39910
40204
|
},
|
|
39911
40205
|
outputSchema: {
|
|
39912
|
-
jobs:
|
|
39913
|
-
|
|
39914
|
-
name:
|
|
39915
|
-
description:
|
|
39916
|
-
tags:
|
|
39917
|
-
labels:
|
|
39918
|
-
inputSchema:
|
|
40206
|
+
jobs: import_zod80.z.array(
|
|
40207
|
+
import_zod80.z.object({
|
|
40208
|
+
name: import_zod80.z.string(),
|
|
40209
|
+
description: import_zod80.z.string().optional(),
|
|
40210
|
+
tags: import_zod80.z.array(import_zod80.z.string()).optional(),
|
|
40211
|
+
labels: import_zod80.z.record(import_zod80.z.string(), import_zod80.z.string()).optional(),
|
|
40212
|
+
inputSchema: import_zod80.z.record(import_zod80.z.string(), import_zod80.z.unknown()).optional()
|
|
39919
40213
|
})
|
|
39920
40214
|
),
|
|
39921
|
-
count:
|
|
40215
|
+
count: import_zod80.z.number()
|
|
39922
40216
|
},
|
|
39923
40217
|
hideFromDiscovery: true
|
|
39924
40218
|
})
|
|
@@ -39927,11 +40221,11 @@ var init_list_jobs_tool = __esm({
|
|
|
39927
40221
|
});
|
|
39928
40222
|
|
|
39929
40223
|
// libs/sdk/src/job/tools/execute-job.tool.ts
|
|
39930
|
-
var
|
|
40224
|
+
var import_zod81, ExecuteJobTool;
|
|
39931
40225
|
var init_execute_job_tool = __esm({
|
|
39932
40226
|
"libs/sdk/src/job/tools/execute-job.tool.ts"() {
|
|
39933
40227
|
"use strict";
|
|
39934
|
-
|
|
40228
|
+
import_zod81 = require("zod");
|
|
39935
40229
|
init_common();
|
|
39936
40230
|
ExecuteJobTool = class extends ToolContext2 {
|
|
39937
40231
|
async execute(input) {
|
|
@@ -39958,15 +40252,15 @@ var init_execute_job_tool = __esm({
|
|
|
39958
40252
|
name: "execute-job",
|
|
39959
40253
|
description: "Execute a registered job by name. Supports inline (synchronous) and background execution.",
|
|
39960
40254
|
inputSchema: {
|
|
39961
|
-
name:
|
|
39962
|
-
input:
|
|
39963
|
-
background:
|
|
40255
|
+
name: import_zod81.z.string().describe("Job name to execute"),
|
|
40256
|
+
input: import_zod81.z.record(import_zod81.z.string(), import_zod81.z.unknown()).optional().describe("Job input data"),
|
|
40257
|
+
background: import_zod81.z.boolean().optional().default(false).describe("Run in background (returns runId for status polling)")
|
|
39964
40258
|
},
|
|
39965
40259
|
outputSchema: {
|
|
39966
|
-
runId:
|
|
39967
|
-
state:
|
|
39968
|
-
result:
|
|
39969
|
-
logs:
|
|
40260
|
+
runId: import_zod81.z.string(),
|
|
40261
|
+
state: import_zod81.z.string(),
|
|
40262
|
+
result: import_zod81.z.unknown().optional(),
|
|
40263
|
+
logs: import_zod81.z.array(import_zod81.z.string()).optional()
|
|
39970
40264
|
}
|
|
39971
40265
|
})
|
|
39972
40266
|
], ExecuteJobTool);
|
|
@@ -39974,11 +40268,11 @@ var init_execute_job_tool = __esm({
|
|
|
39974
40268
|
});
|
|
39975
40269
|
|
|
39976
40270
|
// libs/sdk/src/job/tools/get-job-status.tool.ts
|
|
39977
|
-
var
|
|
40271
|
+
var import_zod82, GetJobStatusTool;
|
|
39978
40272
|
var init_get_job_status_tool = __esm({
|
|
39979
40273
|
"libs/sdk/src/job/tools/get-job-status.tool.ts"() {
|
|
39980
40274
|
"use strict";
|
|
39981
|
-
|
|
40275
|
+
import_zod82 = require("zod");
|
|
39982
40276
|
init_common();
|
|
39983
40277
|
init_errors();
|
|
39984
40278
|
GetJobStatusTool = class extends ToolContext2 {
|
|
@@ -40010,21 +40304,21 @@ var init_get_job_status_tool = __esm({
|
|
|
40010
40304
|
name: "get-job-status",
|
|
40011
40305
|
description: "Get the execution status of a job run by runId.",
|
|
40012
40306
|
inputSchema: {
|
|
40013
|
-
runId:
|
|
40307
|
+
runId: import_zod82.z.string().describe("Run ID returned from execute-job or execute-workflow")
|
|
40014
40308
|
},
|
|
40015
40309
|
outputSchema: {
|
|
40016
|
-
runId:
|
|
40017
|
-
jobName:
|
|
40018
|
-
state:
|
|
40019
|
-
result:
|
|
40020
|
-
error:
|
|
40021
|
-
message:
|
|
40022
|
-
name:
|
|
40310
|
+
runId: import_zod82.z.string(),
|
|
40311
|
+
jobName: import_zod82.z.string(),
|
|
40312
|
+
state: import_zod82.z.string(),
|
|
40313
|
+
result: import_zod82.z.unknown().optional(),
|
|
40314
|
+
error: import_zod82.z.object({
|
|
40315
|
+
message: import_zod82.z.string(),
|
|
40316
|
+
name: import_zod82.z.string()
|
|
40023
40317
|
}).optional(),
|
|
40024
|
-
startedAt:
|
|
40025
|
-
completedAt:
|
|
40026
|
-
attempt:
|
|
40027
|
-
logs:
|
|
40318
|
+
startedAt: import_zod82.z.number(),
|
|
40319
|
+
completedAt: import_zod82.z.number().optional(),
|
|
40320
|
+
attempt: import_zod82.z.number(),
|
|
40321
|
+
logs: import_zod82.z.array(import_zod82.z.string())
|
|
40028
40322
|
}
|
|
40029
40323
|
})
|
|
40030
40324
|
], GetJobStatusTool);
|
|
@@ -40032,11 +40326,11 @@ var init_get_job_status_tool = __esm({
|
|
|
40032
40326
|
});
|
|
40033
40327
|
|
|
40034
40328
|
// libs/sdk/src/job/tools/register-job.tool.ts
|
|
40035
|
-
var
|
|
40329
|
+
var import_zod83, RegisterJobTool;
|
|
40036
40330
|
var init_register_job_tool = __esm({
|
|
40037
40331
|
"libs/sdk/src/job/tools/register-job.tool.ts"() {
|
|
40038
40332
|
"use strict";
|
|
40039
|
-
|
|
40333
|
+
import_zod83 = require("zod");
|
|
40040
40334
|
init_common();
|
|
40041
40335
|
RegisterJobTool = class extends ToolContext2 {
|
|
40042
40336
|
async execute(input) {
|
|
@@ -40073,16 +40367,16 @@ var init_register_job_tool = __esm({
|
|
|
40073
40367
|
name: "register-job",
|
|
40074
40368
|
description: "Register a dynamic job that runs in a sandboxed environment.",
|
|
40075
40369
|
inputSchema: {
|
|
40076
|
-
name:
|
|
40077
|
-
description:
|
|
40078
|
-
script:
|
|
40079
|
-
inputSchema:
|
|
40080
|
-
outputSchema:
|
|
40081
|
-
tags:
|
|
40370
|
+
name: import_zod83.z.string().describe("Job name"),
|
|
40371
|
+
description: import_zod83.z.string().optional().describe("Job description"),
|
|
40372
|
+
script: import_zod83.z.string().describe("JavaScript source code for the job"),
|
|
40373
|
+
inputSchema: import_zod83.z.record(import_zod83.z.string(), import_zod83.z.unknown()).optional().describe("JSON Schema for input"),
|
|
40374
|
+
outputSchema: import_zod83.z.record(import_zod83.z.string(), import_zod83.z.unknown()).optional().describe("JSON Schema for output"),
|
|
40375
|
+
tags: import_zod83.z.array(import_zod83.z.string()).optional().describe("Tags for categorization")
|
|
40082
40376
|
},
|
|
40083
40377
|
outputSchema: {
|
|
40084
|
-
success:
|
|
40085
|
-
jobId:
|
|
40378
|
+
success: import_zod83.z.boolean(),
|
|
40379
|
+
jobId: import_zod83.z.string()
|
|
40086
40380
|
},
|
|
40087
40381
|
hideFromDiscovery: true
|
|
40088
40382
|
})
|
|
@@ -40091,11 +40385,11 @@ var init_register_job_tool = __esm({
|
|
|
40091
40385
|
});
|
|
40092
40386
|
|
|
40093
40387
|
// libs/sdk/src/job/tools/remove-job.tool.ts
|
|
40094
|
-
var
|
|
40388
|
+
var import_zod84, RemoveJobTool;
|
|
40095
40389
|
var init_remove_job_tool = __esm({
|
|
40096
40390
|
"libs/sdk/src/job/tools/remove-job.tool.ts"() {
|
|
40097
40391
|
"use strict";
|
|
40098
|
-
|
|
40392
|
+
import_zod84 = require("zod");
|
|
40099
40393
|
init_common();
|
|
40100
40394
|
RemoveJobTool = class extends ToolContext2 {
|
|
40101
40395
|
async execute(input) {
|
|
@@ -40123,11 +40417,11 @@ var init_remove_job_tool = __esm({
|
|
|
40123
40417
|
name: "remove-job",
|
|
40124
40418
|
description: "Remove a dynamic job by name.",
|
|
40125
40419
|
inputSchema: {
|
|
40126
|
-
name:
|
|
40420
|
+
name: import_zod84.z.string().describe("Job name to remove")
|
|
40127
40421
|
},
|
|
40128
40422
|
outputSchema: {
|
|
40129
|
-
success:
|
|
40130
|
-
message:
|
|
40423
|
+
success: import_zod84.z.boolean(),
|
|
40424
|
+
message: import_zod84.z.string()
|
|
40131
40425
|
},
|
|
40132
40426
|
hideFromDiscovery: true
|
|
40133
40427
|
})
|
|
@@ -40136,11 +40430,11 @@ var init_remove_job_tool = __esm({
|
|
|
40136
40430
|
});
|
|
40137
40431
|
|
|
40138
40432
|
// libs/sdk/src/workflow/tools/list-workflows.tool.ts
|
|
40139
|
-
var
|
|
40433
|
+
var import_zod85, ListWorkflowsTool;
|
|
40140
40434
|
var init_list_workflows_tool = __esm({
|
|
40141
40435
|
"libs/sdk/src/workflow/tools/list-workflows.tool.ts"() {
|
|
40142
40436
|
"use strict";
|
|
40143
|
-
|
|
40437
|
+
import_zod85 = require("zod");
|
|
40144
40438
|
init_common();
|
|
40145
40439
|
ListWorkflowsTool = class extends ToolContext2 {
|
|
40146
40440
|
async execute(input) {
|
|
@@ -40171,21 +40465,21 @@ var init_list_workflows_tool = __esm({
|
|
|
40171
40465
|
name: "list-workflows",
|
|
40172
40466
|
description: "List registered workflows with optional filtering by tags or labels.",
|
|
40173
40467
|
inputSchema: {
|
|
40174
|
-
tags:
|
|
40175
|
-
labels:
|
|
40176
|
-
query:
|
|
40468
|
+
tags: import_zod85.z.array(import_zod85.z.string()).optional().describe("Filter by tags"),
|
|
40469
|
+
labels: import_zod85.z.record(import_zod85.z.string(), import_zod85.z.string()).optional().describe("Filter by labels"),
|
|
40470
|
+
query: import_zod85.z.string().optional().describe("Search query for name/description")
|
|
40177
40471
|
},
|
|
40178
40472
|
outputSchema: {
|
|
40179
|
-
workflows:
|
|
40180
|
-
|
|
40181
|
-
name:
|
|
40182
|
-
description:
|
|
40183
|
-
trigger:
|
|
40184
|
-
stepCount:
|
|
40185
|
-
tags:
|
|
40473
|
+
workflows: import_zod85.z.array(
|
|
40474
|
+
import_zod85.z.object({
|
|
40475
|
+
name: import_zod85.z.string(),
|
|
40476
|
+
description: import_zod85.z.string().optional(),
|
|
40477
|
+
trigger: import_zod85.z.string(),
|
|
40478
|
+
stepCount: import_zod85.z.number(),
|
|
40479
|
+
tags: import_zod85.z.array(import_zod85.z.string()).optional()
|
|
40186
40480
|
})
|
|
40187
40481
|
),
|
|
40188
|
-
count:
|
|
40482
|
+
count: import_zod85.z.number()
|
|
40189
40483
|
},
|
|
40190
40484
|
hideFromDiscovery: true
|
|
40191
40485
|
})
|
|
@@ -40194,11 +40488,11 @@ var init_list_workflows_tool = __esm({
|
|
|
40194
40488
|
});
|
|
40195
40489
|
|
|
40196
40490
|
// libs/sdk/src/workflow/tools/execute-workflow.tool.ts
|
|
40197
|
-
var
|
|
40491
|
+
var import_zod86, ExecuteWorkflowTool;
|
|
40198
40492
|
var init_execute_workflow_tool = __esm({
|
|
40199
40493
|
"libs/sdk/src/workflow/tools/execute-workflow.tool.ts"() {
|
|
40200
40494
|
"use strict";
|
|
40201
|
-
|
|
40495
|
+
import_zod86 = require("zod");
|
|
40202
40496
|
init_common();
|
|
40203
40497
|
ExecuteWorkflowTool = class extends ToolContext2 {
|
|
40204
40498
|
async execute(input) {
|
|
@@ -40227,14 +40521,14 @@ var init_execute_workflow_tool = __esm({
|
|
|
40227
40521
|
name: "execute-workflow",
|
|
40228
40522
|
description: "Execute a registered workflow by name. Supports inline and background execution.",
|
|
40229
40523
|
inputSchema: {
|
|
40230
|
-
name:
|
|
40231
|
-
input:
|
|
40232
|
-
background:
|
|
40524
|
+
name: import_zod86.z.string().describe("Workflow name to execute"),
|
|
40525
|
+
input: import_zod86.z.record(import_zod86.z.string(), import_zod86.z.unknown()).optional().describe("Workflow input data"),
|
|
40526
|
+
background: import_zod86.z.boolean().optional().default(false).describe("Run in background (returns runId)")
|
|
40233
40527
|
},
|
|
40234
40528
|
outputSchema: {
|
|
40235
|
-
runId:
|
|
40236
|
-
state:
|
|
40237
|
-
result:
|
|
40529
|
+
runId: import_zod86.z.string(),
|
|
40530
|
+
state: import_zod86.z.string(),
|
|
40531
|
+
result: import_zod86.z.unknown().optional()
|
|
40238
40532
|
}
|
|
40239
40533
|
})
|
|
40240
40534
|
], ExecuteWorkflowTool);
|
|
@@ -40242,11 +40536,11 @@ var init_execute_workflow_tool = __esm({
|
|
|
40242
40536
|
});
|
|
40243
40537
|
|
|
40244
40538
|
// libs/sdk/src/workflow/tools/get-workflow-status.tool.ts
|
|
40245
|
-
var
|
|
40539
|
+
var import_zod87, GetWorkflowStatusTool;
|
|
40246
40540
|
var init_get_workflow_status_tool = __esm({
|
|
40247
40541
|
"libs/sdk/src/workflow/tools/get-workflow-status.tool.ts"() {
|
|
40248
40542
|
"use strict";
|
|
40249
|
-
|
|
40543
|
+
import_zod87 = require("zod");
|
|
40250
40544
|
init_common();
|
|
40251
40545
|
GetWorkflowStatusTool = class extends ToolContext2 {
|
|
40252
40546
|
async execute(input) {
|
|
@@ -40275,21 +40569,21 @@ var init_get_workflow_status_tool = __esm({
|
|
|
40275
40569
|
name: "get-workflow-status",
|
|
40276
40570
|
description: "Get the execution status of a workflow run with per-step results.",
|
|
40277
40571
|
inputSchema: {
|
|
40278
|
-
runId:
|
|
40572
|
+
runId: import_zod87.z.string().describe("Run ID returned from execute-workflow")
|
|
40279
40573
|
},
|
|
40280
40574
|
outputSchema: {
|
|
40281
|
-
runId:
|
|
40282
|
-
workflowName:
|
|
40283
|
-
state:
|
|
40284
|
-
stepResults:
|
|
40285
|
-
|
|
40286
|
-
|
|
40287
|
-
state:
|
|
40288
|
-
outputs:
|
|
40575
|
+
runId: import_zod87.z.string(),
|
|
40576
|
+
workflowName: import_zod87.z.string().optional(),
|
|
40577
|
+
state: import_zod87.z.string(),
|
|
40578
|
+
stepResults: import_zod87.z.record(
|
|
40579
|
+
import_zod87.z.string(),
|
|
40580
|
+
import_zod87.z.object({
|
|
40581
|
+
state: import_zod87.z.string(),
|
|
40582
|
+
outputs: import_zod87.z.record(import_zod87.z.string(), import_zod87.z.unknown()).optional()
|
|
40289
40583
|
})
|
|
40290
40584
|
).optional(),
|
|
40291
|
-
startedAt:
|
|
40292
|
-
completedAt:
|
|
40585
|
+
startedAt: import_zod87.z.number(),
|
|
40586
|
+
completedAt: import_zod87.z.number().optional()
|
|
40293
40587
|
}
|
|
40294
40588
|
})
|
|
40295
40589
|
], GetWorkflowStatusTool);
|
|
@@ -40297,11 +40591,11 @@ var init_get_workflow_status_tool = __esm({
|
|
|
40297
40591
|
});
|
|
40298
40592
|
|
|
40299
40593
|
// libs/sdk/src/workflow/tools/register-workflow.tool.ts
|
|
40300
|
-
var
|
|
40594
|
+
var import_zod88, RegisterWorkflowTool;
|
|
40301
40595
|
var init_register_workflow_tool = __esm({
|
|
40302
40596
|
"libs/sdk/src/workflow/tools/register-workflow.tool.ts"() {
|
|
40303
40597
|
"use strict";
|
|
40304
|
-
|
|
40598
|
+
import_zod88 = require("zod");
|
|
40305
40599
|
init_common();
|
|
40306
40600
|
RegisterWorkflowTool = class extends ToolContext2 {
|
|
40307
40601
|
async execute(input) {
|
|
@@ -40337,24 +40631,24 @@ var init_register_workflow_tool = __esm({
|
|
|
40337
40631
|
name: "register-workflow",
|
|
40338
40632
|
description: "Register a dynamic workflow with step definitions.",
|
|
40339
40633
|
inputSchema: {
|
|
40340
|
-
name:
|
|
40341
|
-
description:
|
|
40342
|
-
steps:
|
|
40343
|
-
|
|
40344
|
-
id:
|
|
40345
|
-
jobName:
|
|
40346
|
-
input:
|
|
40347
|
-
dependsOn:
|
|
40348
|
-
continueOnError:
|
|
40349
|
-
timeout:
|
|
40634
|
+
name: import_zod88.z.string().describe("Workflow name"),
|
|
40635
|
+
description: import_zod88.z.string().optional().describe("Workflow description"),
|
|
40636
|
+
steps: import_zod88.z.array(
|
|
40637
|
+
import_zod88.z.object({
|
|
40638
|
+
id: import_zod88.z.string().describe("Step identifier"),
|
|
40639
|
+
jobName: import_zod88.z.string().describe("Job name to execute"),
|
|
40640
|
+
input: import_zod88.z.record(import_zod88.z.string(), import_zod88.z.unknown()).optional().describe("Static input for the step"),
|
|
40641
|
+
dependsOn: import_zod88.z.array(import_zod88.z.string()).optional().describe("Step IDs that must complete first"),
|
|
40642
|
+
continueOnError: import_zod88.z.boolean().optional().describe("Continue on failure"),
|
|
40643
|
+
timeout: import_zod88.z.number().optional().describe("Step timeout in ms")
|
|
40350
40644
|
})
|
|
40351
40645
|
).describe("Workflow step definitions"),
|
|
40352
|
-
trigger:
|
|
40353
|
-
tags:
|
|
40646
|
+
trigger: import_zod88.z.enum(["manual", "webhook", "event"]).optional().describe("Trigger type"),
|
|
40647
|
+
tags: import_zod88.z.array(import_zod88.z.string()).optional().describe("Tags for categorization")
|
|
40354
40648
|
},
|
|
40355
40649
|
outputSchema: {
|
|
40356
|
-
success:
|
|
40357
|
-
workflowId:
|
|
40650
|
+
success: import_zod88.z.boolean(),
|
|
40651
|
+
workflowId: import_zod88.z.string()
|
|
40358
40652
|
},
|
|
40359
40653
|
hideFromDiscovery: true
|
|
40360
40654
|
})
|
|
@@ -40363,11 +40657,11 @@ var init_register_workflow_tool = __esm({
|
|
|
40363
40657
|
});
|
|
40364
40658
|
|
|
40365
40659
|
// libs/sdk/src/workflow/tools/remove-workflow.tool.ts
|
|
40366
|
-
var
|
|
40660
|
+
var import_zod89, RemoveWorkflowTool;
|
|
40367
40661
|
var init_remove_workflow_tool = __esm({
|
|
40368
40662
|
"libs/sdk/src/workflow/tools/remove-workflow.tool.ts"() {
|
|
40369
40663
|
"use strict";
|
|
40370
|
-
|
|
40664
|
+
import_zod89 = require("zod");
|
|
40371
40665
|
init_common();
|
|
40372
40666
|
RemoveWorkflowTool = class extends ToolContext2 {
|
|
40373
40667
|
async execute(input) {
|
|
@@ -40395,11 +40689,11 @@ var init_remove_workflow_tool = __esm({
|
|
|
40395
40689
|
name: "remove-workflow",
|
|
40396
40690
|
description: "Remove a dynamic workflow by name.",
|
|
40397
40691
|
inputSchema: {
|
|
40398
|
-
name:
|
|
40692
|
+
name: import_zod89.z.string().describe("Workflow name to remove")
|
|
40399
40693
|
},
|
|
40400
40694
|
outputSchema: {
|
|
40401
|
-
success:
|
|
40402
|
-
message:
|
|
40695
|
+
success: import_zod89.z.boolean(),
|
|
40696
|
+
message: import_zod89.z.string()
|
|
40403
40697
|
},
|
|
40404
40698
|
hideFromDiscovery: true
|
|
40405
40699
|
})
|
|
@@ -40481,7 +40775,7 @@ var init_job_scope_helper = __esm({
|
|
|
40481
40775
|
});
|
|
40482
40776
|
|
|
40483
40777
|
// libs/sdk/src/scope/scope.instance.ts
|
|
40484
|
-
var import_reflect_metadata20,
|
|
40778
|
+
var import_reflect_metadata20, import_utils63, import_guard6, Scope;
|
|
40485
40779
|
var init_scope_instance = __esm({
|
|
40486
40780
|
"libs/sdk/src/scope/scope.instance.ts"() {
|
|
40487
40781
|
"use strict";
|
|
@@ -40501,7 +40795,7 @@ var init_scope_instance = __esm({
|
|
|
40501
40795
|
init_agent_registry();
|
|
40502
40796
|
init_skill_registry();
|
|
40503
40797
|
init_skill_validation_error();
|
|
40504
|
-
|
|
40798
|
+
import_utils63 = require("@frontmcp/utils");
|
|
40505
40799
|
init_errors();
|
|
40506
40800
|
init_skill_scope_helper();
|
|
40507
40801
|
init_session2();
|
|
@@ -40585,7 +40879,7 @@ var init_scope_instance = __esm({
|
|
|
40585
40879
|
await this.scopeProviders.ready;
|
|
40586
40880
|
const scopeRef = { kind: "scope", id: this.id, ref: _Scope };
|
|
40587
40881
|
const scopeProviders = this.scopeProviders;
|
|
40588
|
-
const perf = (0,
|
|
40882
|
+
const perf = (0, import_utils63.getEnvFlag)("FRONTMCP_PERF");
|
|
40589
40883
|
const t0 = perf ? performance.now() : 0;
|
|
40590
40884
|
const mark = perf ? (label) => this.logger.info(`[PERF] ${label}: ${(performance.now() - t0).toFixed(1)}ms`) : () => {
|
|
40591
40885
|
};
|
|
@@ -40611,7 +40905,7 @@ var init_scope_instance = __esm({
|
|
|
40611
40905
|
redis: elicitationRedis,
|
|
40612
40906
|
keyPrefix: elicitationRedis?.keyPrefix ?? "mcp:elicit:",
|
|
40613
40907
|
logger: this.logger,
|
|
40614
|
-
isEdgeRuntime: (0,
|
|
40908
|
+
isEdgeRuntime: (0, import_utils63.isEdgeRuntime)()
|
|
40615
40909
|
});
|
|
40616
40910
|
this._elicitationStore = elicitStore;
|
|
40617
40911
|
})() : void 0;
|
|
@@ -41270,7 +41564,7 @@ var init_base_host_adapter = __esm({
|
|
|
41270
41564
|
});
|
|
41271
41565
|
|
|
41272
41566
|
// libs/sdk/src/server/adapters/express.host.adapter.ts
|
|
41273
|
-
var http, import_express, import_cors,
|
|
41567
|
+
var http, import_express, import_cors, import_utils64, ExpressHostAdapter;
|
|
41274
41568
|
var init_express_host_adapter = __esm({
|
|
41275
41569
|
"libs/sdk/src/server/adapters/express.host.adapter.ts"() {
|
|
41276
41570
|
"use strict";
|
|
@@ -41278,7 +41572,7 @@ var init_express_host_adapter = __esm({
|
|
|
41278
41572
|
import_express = __toESM(require("express"));
|
|
41279
41573
|
import_cors = __toESM(require("cors"));
|
|
41280
41574
|
init_base_host_adapter();
|
|
41281
|
-
|
|
41575
|
+
import_utils64 = require("@frontmcp/utils");
|
|
41282
41576
|
ExpressHostAdapter = class extends HostServerAdapter {
|
|
41283
41577
|
app = (0, import_express.default)();
|
|
41284
41578
|
router = import_express.default.Router();
|
|
@@ -41370,8 +41664,8 @@ var init_express_host_adapter = __esm({
|
|
|
41370
41664
|
}
|
|
41371
41665
|
async cleanupStaleSocket(socketPath) {
|
|
41372
41666
|
try {
|
|
41373
|
-
if (await (0,
|
|
41374
|
-
await (0,
|
|
41667
|
+
if (await (0, import_utils64.fileExists)(socketPath)) {
|
|
41668
|
+
await (0, import_utils64.unlink)(socketPath);
|
|
41375
41669
|
}
|
|
41376
41670
|
} catch {
|
|
41377
41671
|
}
|
|
@@ -41548,12 +41842,12 @@ var init_logger_utils = __esm({
|
|
|
41548
41842
|
});
|
|
41549
41843
|
|
|
41550
41844
|
// libs/sdk/src/logger/instances/instance.console-logger.ts
|
|
41551
|
-
var
|
|
41845
|
+
var import_utils65, ConsoleLogTransportInstance;
|
|
41552
41846
|
var init_instance_console_logger = __esm({
|
|
41553
41847
|
"libs/sdk/src/logger/instances/instance.console-logger.ts"() {
|
|
41554
41848
|
"use strict";
|
|
41555
41849
|
init_common();
|
|
41556
|
-
|
|
41850
|
+
import_utils65 = require("@frontmcp/utils");
|
|
41557
41851
|
ConsoleLogTransportInstance = class extends LogTransportInterface {
|
|
41558
41852
|
log(rec) {
|
|
41559
41853
|
const fn = this.bind(rec.level, rec.prefix);
|
|
@@ -41581,7 +41875,7 @@ var init_instance_console_logger = __esm({
|
|
|
41581
41875
|
const BOLD = "\x1B[1m";
|
|
41582
41876
|
const DIM = "\x1B[2m";
|
|
41583
41877
|
const GRAY = "\x1B[90m";
|
|
41584
|
-
const useAnsi = (0,
|
|
41878
|
+
const useAnsi = (0, import_utils65.supportsAnsi)();
|
|
41585
41879
|
const timePart = useAnsi ? `${DIM}[${ts}]${RESET}` : `[${ts}]`;
|
|
41586
41880
|
const scopePart = loggerPrefix ? useAnsi ? `${BOLD}[${loggerPrefix}]${RESET}` : `[${loggerPrefix}]` : void 0;
|
|
41587
41881
|
const levelPart = useAnsi ? `${BOLD}${meta.ansi}${meta.label}${RESET}` : meta.label;
|
|
@@ -41619,12 +41913,12 @@ var init_instance_console_logger = __esm({
|
|
|
41619
41913
|
});
|
|
41620
41914
|
|
|
41621
41915
|
// libs/sdk/src/logger/instances/instance.logger.ts
|
|
41622
|
-
var
|
|
41916
|
+
var import_utils66, LoggerInstance;
|
|
41623
41917
|
var init_instance_logger = __esm({
|
|
41624
41918
|
"libs/sdk/src/logger/instances/instance.logger.ts"() {
|
|
41625
41919
|
"use strict";
|
|
41626
41920
|
init_common();
|
|
41627
|
-
|
|
41921
|
+
import_utils66 = require("@frontmcp/utils");
|
|
41628
41922
|
LoggerInstance = class _LoggerInstance extends FrontMcpLogger {
|
|
41629
41923
|
constructor(config, getTransports) {
|
|
41630
41924
|
super();
|
|
@@ -41679,7 +41973,7 @@ var init_instance_logger = __esm({
|
|
|
41679
41973
|
}
|
|
41680
41974
|
_getter(level) {
|
|
41681
41975
|
if (level < this.level || this.level === 100 /* Off */) return () => void 0;
|
|
41682
|
-
if ((0,
|
|
41976
|
+
if ((0, import_utils66.isDevelopment)() && this.config.enableConsole && this.consoleTransport) {
|
|
41683
41977
|
return this.consoleTransport.bind(level, this.prefix);
|
|
41684
41978
|
}
|
|
41685
41979
|
const emit = this.emit.bind(this);
|
|
@@ -42009,7 +42303,7 @@ __export(in_memory_server_exports, {
|
|
|
42009
42303
|
async function createInMemoryServer(scope, options) {
|
|
42010
42304
|
const { InMemoryTransport, McpServer: McpServer2 } = await import("@frontmcp/protocol");
|
|
42011
42305
|
const { createMcpHandlers: createMcpHandlers2 } = await Promise.resolve().then(() => (init_mcp_handlers(), mcp_handlers_exports));
|
|
42012
|
-
const sessionId = options?.sessionId ?? `in-memory:${(0,
|
|
42306
|
+
const sessionId = options?.sessionId ?? `in-memory:${(0, import_utils67.randomUUID)()}`;
|
|
42013
42307
|
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
|
42014
42308
|
let currentAuthInfo = options?.authInfo ?? {};
|
|
42015
42309
|
const hasRemoteApps = scope.apps?.getApps().some((app) => app.isRemote) ?? false;
|
|
@@ -42063,11 +42357,11 @@ async function createInMemoryServer(scope, options) {
|
|
|
42063
42357
|
}
|
|
42064
42358
|
};
|
|
42065
42359
|
}
|
|
42066
|
-
var
|
|
42360
|
+
var import_utils67;
|
|
42067
42361
|
var init_in_memory_server = __esm({
|
|
42068
42362
|
"libs/sdk/src/transport/in-memory-server.ts"() {
|
|
42069
42363
|
"use strict";
|
|
42070
|
-
|
|
42364
|
+
import_utils67 = require("@frontmcp/utils");
|
|
42071
42365
|
}
|
|
42072
42366
|
});
|
|
42073
42367
|
|
|
@@ -42076,13 +42370,13 @@ var direct_client_exports = {};
|
|
|
42076
42370
|
__export(direct_client_exports, {
|
|
42077
42371
|
DirectClientImpl: () => DirectClientImpl
|
|
42078
42372
|
});
|
|
42079
|
-
var
|
|
42373
|
+
var import_utils68, import_protocol43, DirectClientImpl;
|
|
42080
42374
|
var init_direct_client = __esm({
|
|
42081
42375
|
"libs/sdk/src/direct/direct-client.ts"() {
|
|
42082
42376
|
"use strict";
|
|
42083
42377
|
init_llm_platform();
|
|
42084
42378
|
init_errors();
|
|
42085
|
-
|
|
42379
|
+
import_utils68 = require("@frontmcp/utils");
|
|
42086
42380
|
import_protocol43 = require("@frontmcp/protocol");
|
|
42087
42381
|
init_skills_mcp_types();
|
|
42088
42382
|
DirectClientImpl = class _DirectClientImpl {
|
|
@@ -42120,7 +42414,7 @@ var init_direct_client = __esm({
|
|
|
42120
42414
|
*/
|
|
42121
42415
|
static async create(scope, options) {
|
|
42122
42416
|
const { createInMemoryServer: createInMemoryServer2 } = await Promise.resolve().then(() => (init_in_memory_server(), in_memory_server_exports));
|
|
42123
|
-
const sessionId = options?.session?.id ?? `direct:${(0,
|
|
42417
|
+
const sessionId = options?.session?.id ?? `direct:${(0, import_utils68.randomUUID)()}`;
|
|
42124
42418
|
const clientInfo = options?.clientInfo ?? { name: "mcp-client", version: "1.0.0" };
|
|
42125
42419
|
const authInfo = {};
|
|
42126
42420
|
if (options?.authToken) {
|
|
@@ -42535,7 +42829,7 @@ function buildAuthInfo(authContext, defaultSessionId) {
|
|
|
42535
42829
|
if (!authContext && !defaultSessionId) {
|
|
42536
42830
|
return void 0;
|
|
42537
42831
|
}
|
|
42538
|
-
const sessionId = authContext?.sessionId ?? defaultSessionId ?? `direct:${(0,
|
|
42832
|
+
const sessionId = authContext?.sessionId ?? defaultSessionId ?? `direct:${(0, import_utils69.randomUUID)()}`;
|
|
42539
42833
|
const user = authContext?.user ? { iss: "direct", sub: authContext.user.sub ?? "direct", ...authContext.user } : { iss: "direct", sub: "direct" };
|
|
42540
42834
|
const clientId = user.sub ?? "direct";
|
|
42541
42835
|
const authInfo = {
|
|
@@ -42550,11 +42844,11 @@ function buildAuthInfo(authContext, defaultSessionId) {
|
|
|
42550
42844
|
}
|
|
42551
42845
|
return authInfo;
|
|
42552
42846
|
}
|
|
42553
|
-
var
|
|
42847
|
+
var import_utils69, DirectMcpServerImpl;
|
|
42554
42848
|
var init_direct_server = __esm({
|
|
42555
42849
|
"libs/sdk/src/direct/direct-server.ts"() {
|
|
42556
42850
|
"use strict";
|
|
42557
|
-
|
|
42851
|
+
import_utils69 = require("@frontmcp/utils");
|
|
42558
42852
|
init_common();
|
|
42559
42853
|
init_errors();
|
|
42560
42854
|
DirectMcpServerImpl = class {
|
|
@@ -42564,7 +42858,7 @@ var init_direct_server = __esm({
|
|
|
42564
42858
|
defaultSessionId;
|
|
42565
42859
|
constructor(scope) {
|
|
42566
42860
|
this.scope = scope;
|
|
42567
|
-
this.defaultSessionId = `direct:${(0,
|
|
42861
|
+
this.defaultSessionId = `direct:${(0, import_utils69.randomUUID)()}`;
|
|
42568
42862
|
this.ready = Promise.resolve();
|
|
42569
42863
|
}
|
|
42570
42864
|
/**
|
|
@@ -42830,7 +43124,7 @@ var front_mcp_exports = {};
|
|
|
42830
43124
|
__export(front_mcp_exports, {
|
|
42831
43125
|
FrontMcpInstance: () => FrontMcpInstance
|
|
42832
43126
|
});
|
|
42833
|
-
var
|
|
43127
|
+
var import_utils70, FrontMcpInstance;
|
|
42834
43128
|
var init_front_mcp = __esm({
|
|
42835
43129
|
"libs/sdk/src/front-mcp/front-mcp.ts"() {
|
|
42836
43130
|
"use strict";
|
|
@@ -42841,7 +43135,7 @@ var init_front_mcp = __esm({
|
|
|
42841
43135
|
init_logger_registry();
|
|
42842
43136
|
init_direct();
|
|
42843
43137
|
init_errors();
|
|
42844
|
-
|
|
43138
|
+
import_utils70 = require("@frontmcp/utils");
|
|
42845
43139
|
FrontMcpInstance = class _FrontMcpInstance2 {
|
|
42846
43140
|
config;
|
|
42847
43141
|
ready;
|
|
@@ -43068,8 +43362,8 @@ var init_front_mcp = __esm({
|
|
|
43068
43362
|
frontMcp.log?.info(`MCP server listening on unix://${socketPath}`);
|
|
43069
43363
|
const cleanup = async () => {
|
|
43070
43364
|
try {
|
|
43071
|
-
if (await (0,
|
|
43072
|
-
await (0,
|
|
43365
|
+
if (await (0, import_utils70.fileExists)(socketPath)) {
|
|
43366
|
+
await (0, import_utils70.unlink)(socketPath);
|
|
43073
43367
|
}
|
|
43074
43368
|
} catch {
|
|
43075
43369
|
}
|
|
@@ -43128,7 +43422,7 @@ var init_front_mcp = __esm({
|
|
|
43128
43422
|
serverInfo: scope.metadata.info
|
|
43129
43423
|
};
|
|
43130
43424
|
const mcpServer = new McpServer2(scope.metadata.info, serverOptions);
|
|
43131
|
-
const sessionId = `stdio:${(0,
|
|
43425
|
+
const sessionId = `stdio:${(0, import_utils70.randomUUID)()}`;
|
|
43132
43426
|
const handlers = createMcpHandlers2({ scope, serverOptions });
|
|
43133
43427
|
for (const handler of handlers) {
|
|
43134
43428
|
const originalHandler = handler.handler;
|
|
@@ -43271,8 +43565,8 @@ function FrontMcp(providedMetadata) {
|
|
|
43271
43565
|
Reflect.defineMetadata(FrontMcpTokens[property] ?? property, metadata[property], target);
|
|
43272
43566
|
}
|
|
43273
43567
|
Reflect.defineMetadata("__frontmcp:config", metadata, target);
|
|
43274
|
-
const isServerless2 = (0,
|
|
43275
|
-
const isSchemaExtract = (0,
|
|
43568
|
+
const isServerless2 = (0, import_utils71.getEnvFlag)("FRONTMCP_SERVERLESS");
|
|
43569
|
+
const isSchemaExtract = (0, import_utils71.getEnvFlag)("FRONTMCP_SCHEMA_EXTRACT");
|
|
43276
43570
|
if (isSchemaExtract) {
|
|
43277
43571
|
} else if (isServerless2) {
|
|
43278
43572
|
const ServerlessInstance = getFrontMcpInstance();
|
|
@@ -43289,14 +43583,14 @@ function FrontMcp(providedMetadata) {
|
|
|
43289
43583
|
}
|
|
43290
43584
|
};
|
|
43291
43585
|
}
|
|
43292
|
-
var import_reflect_metadata25,
|
|
43586
|
+
var import_reflect_metadata25, import_utils71, _FrontMcpInstance, _serverlessHandlerFns;
|
|
43293
43587
|
var init_front_mcp_decorator = __esm({
|
|
43294
43588
|
"libs/sdk/src/common/decorators/front-mcp.decorator.ts"() {
|
|
43295
43589
|
"use strict";
|
|
43296
43590
|
import_reflect_metadata25 = require("reflect-metadata");
|
|
43297
43591
|
init_tokens();
|
|
43298
43592
|
init_metadata();
|
|
43299
|
-
|
|
43593
|
+
import_utils71 = require("@frontmcp/utils");
|
|
43300
43594
|
init_mcp_error();
|
|
43301
43595
|
init_decorator_errors();
|
|
43302
43596
|
_FrontMcpInstance = null;
|
|
@@ -43758,7 +44052,7 @@ function resolveCallerDir() {
|
|
|
43758
44052
|
if (file.includes("node_modules") || file.includes("skill.decorator")) {
|
|
43759
44053
|
continue;
|
|
43760
44054
|
}
|
|
43761
|
-
return (0,
|
|
44055
|
+
return (0, import_utils72.dirname)(file);
|
|
43762
44056
|
}
|
|
43763
44057
|
}
|
|
43764
44058
|
return void 0;
|
|
@@ -43817,14 +44111,14 @@ function getSkillMetadata(target) {
|
|
|
43817
44111
|
}
|
|
43818
44112
|
return metadata;
|
|
43819
44113
|
}
|
|
43820
|
-
var import_reflect_metadata34,
|
|
44114
|
+
var import_reflect_metadata34, import_utils72, Skill;
|
|
43821
44115
|
var init_skill_decorator = __esm({
|
|
43822
44116
|
"libs/sdk/src/common/decorators/skill.decorator.ts"() {
|
|
43823
44117
|
"use strict";
|
|
43824
44118
|
import_reflect_metadata34 = require("reflect-metadata");
|
|
43825
44119
|
init_tokens();
|
|
43826
44120
|
init_metadata();
|
|
43827
|
-
|
|
44121
|
+
import_utils72 = require("@frontmcp/utils");
|
|
43828
44122
|
init_package_specifier();
|
|
43829
44123
|
init_validate_remote_url();
|
|
43830
44124
|
Object.assign(FrontMcpSkill, {
|
|
@@ -44340,20 +44634,32 @@ var init_resource_interface = __esm({
|
|
|
44340
44634
|
* Called by the MCP `completion/complete` handler when a client requests
|
|
44341
44635
|
* suggestions for a template parameter.
|
|
44342
44636
|
*
|
|
44637
|
+
* There are two ways to provide completions (both have full DI access via `this.get()`):
|
|
44638
|
+
*
|
|
44639
|
+
* 1. **Convention-based (preferred):** Define a method named `${argName}Completer`.
|
|
44640
|
+
* The framework auto-discovers these methods.
|
|
44641
|
+
* ```typescript
|
|
44642
|
+
* async accountNameCompleter(partial: string): Promise<ResourceCompletionResult> {
|
|
44643
|
+
* const service = this.get(MyService);
|
|
44644
|
+
* const accounts = await service.listAccounts();
|
|
44645
|
+
* return { values: accounts.map(a => a.name).filter(n => n.startsWith(partial)) };
|
|
44646
|
+
* }
|
|
44647
|
+
* ```
|
|
44648
|
+
*
|
|
44649
|
+
* 2. **Override-based:** Override this method for dynamic dispatch.
|
|
44650
|
+
* ```typescript
|
|
44651
|
+
* getArgumentCompleter(argName: string): ResourceArgumentCompleter | null {
|
|
44652
|
+
* if (argName === 'userId') {
|
|
44653
|
+
* return async (partial) => ({
|
|
44654
|
+
* values: await this.get(UserService).search(partial),
|
|
44655
|
+
* });
|
|
44656
|
+
* }
|
|
44657
|
+
* return null;
|
|
44658
|
+
* }
|
|
44659
|
+
* ```
|
|
44660
|
+
*
|
|
44343
44661
|
* @param argName - The template parameter name (e.g., 'userId')
|
|
44344
44662
|
* @returns A completer function, or null if no completion is available for this argument
|
|
44345
|
-
*
|
|
44346
|
-
* @example
|
|
44347
|
-
* ```typescript
|
|
44348
|
-
* getArgumentCompleter(argName: string): ResourceArgumentCompleter | null {
|
|
44349
|
-
* if (argName === 'userId') {
|
|
44350
|
-
* return async (partial) => ({
|
|
44351
|
-
* values: await this.searchUsers(partial),
|
|
44352
|
-
* });
|
|
44353
|
-
* }
|
|
44354
|
-
* return null;
|
|
44355
|
-
* }
|
|
44356
|
-
* ```
|
|
44357
44663
|
*/
|
|
44358
44664
|
getArgumentCompleter(_argName) {
|
|
44359
44665
|
return null;
|
|
@@ -45384,32 +45690,32 @@ function decideIntent(req, cfg) {
|
|
|
45384
45690
|
debug: { key, channel, flags }
|
|
45385
45691
|
};
|
|
45386
45692
|
}
|
|
45387
|
-
var
|
|
45693
|
+
var import_zod90, intentSchema, decisionSchema, CH_OTHER, CH_GET_SSE, CH_POST_INIT_JSON, CH_POST_INIT_SSE, CH_POST_JSON, CH_POST_SSE, CH_POST_MESSAGE, CH_GET_SSE_PATH, CH_MASK, B_HAS_SESSION, B_STATELESS_EN, B_REQ_SESSION, B_LEGACY_HINT, B_SSE_LISTENER_EN, B_STREAMABLE_EN, B_STATEFUL_EN, B_LEGACY_EN, h, wantsSSE, wantsJSON, isInitialize, RULES;
|
|
45388
45694
|
var init_decide_request_intent_utils = __esm({
|
|
45389
45695
|
"libs/sdk/src/common/utils/decide-request-intent.utils.ts"() {
|
|
45390
45696
|
"use strict";
|
|
45391
|
-
|
|
45392
|
-
intentSchema =
|
|
45393
|
-
|
|
45394
|
-
|
|
45395
|
-
|
|
45396
|
-
|
|
45397
|
-
|
|
45398
|
-
|
|
45399
|
-
|
|
45697
|
+
import_zod90 = require("zod");
|
|
45698
|
+
intentSchema = import_zod90.z.union([
|
|
45699
|
+
import_zod90.z.literal("legacy-sse"),
|
|
45700
|
+
import_zod90.z.literal("sse"),
|
|
45701
|
+
import_zod90.z.literal("streamable-http"),
|
|
45702
|
+
import_zod90.z.literal("stateful-http"),
|
|
45703
|
+
import_zod90.z.literal("stateless-http"),
|
|
45704
|
+
import_zod90.z.literal("delete-session"),
|
|
45705
|
+
import_zod90.z.literal("unknown")
|
|
45400
45706
|
]);
|
|
45401
|
-
decisionSchema =
|
|
45707
|
+
decisionSchema = import_zod90.z.object({
|
|
45402
45708
|
intent: intentSchema,
|
|
45403
|
-
reasons:
|
|
45404
|
-
recommendation:
|
|
45405
|
-
httpStatus:
|
|
45406
|
-
message:
|
|
45709
|
+
reasons: import_zod90.z.array(import_zod90.z.string()),
|
|
45710
|
+
recommendation: import_zod90.z.object({
|
|
45711
|
+
httpStatus: import_zod90.z.number(),
|
|
45712
|
+
message: import_zod90.z.string()
|
|
45407
45713
|
}).optional(),
|
|
45408
45714
|
// Echo back bits for debugging/telemetry if you like
|
|
45409
|
-
debug:
|
|
45410
|
-
key:
|
|
45411
|
-
channel:
|
|
45412
|
-
flags:
|
|
45715
|
+
debug: import_zod90.z.object({
|
|
45716
|
+
key: import_zod90.z.number(),
|
|
45717
|
+
channel: import_zod90.z.number(),
|
|
45718
|
+
flags: import_zod90.z.number()
|
|
45413
45719
|
}).optional()
|
|
45414
45720
|
});
|
|
45415
45721
|
CH_OTHER = 0;
|
|
@@ -45627,11 +45933,11 @@ var init_decide_request_intent_utils = __esm({
|
|
|
45627
45933
|
|
|
45628
45934
|
// libs/sdk/src/common/utils/path.utils.ts
|
|
45629
45935
|
function normalizeEntryPrefix(entryPath) {
|
|
45630
|
-
const t = (0,
|
|
45936
|
+
const t = (0, import_utils73.trimSlashes)(entryPath ?? "");
|
|
45631
45937
|
return t ? `/${t}` : "";
|
|
45632
45938
|
}
|
|
45633
45939
|
function normalizeScopeBase(scopeBase) {
|
|
45634
|
-
const t = (0,
|
|
45940
|
+
const t = (0, import_utils73.trimSlashes)(scopeBase ?? "");
|
|
45635
45941
|
return t ? `/${t}` : "";
|
|
45636
45942
|
}
|
|
45637
45943
|
function getRequestBaseUrl(req, entryPath) {
|
|
@@ -45652,22 +45958,22 @@ function computeResource(req, entryPath, scopeBase) {
|
|
|
45652
45958
|
function urlToSafeId(url) {
|
|
45653
45959
|
const u = new URL(url);
|
|
45654
45960
|
const raw = (u.host + (u.pathname && u.pathname !== "/" ? u.pathname : "")).replace(/\/+$/, "");
|
|
45655
|
-
return (0,
|
|
45961
|
+
return (0, import_utils73.trimSlashes)(raw).replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
45656
45962
|
}
|
|
45657
45963
|
function makeWellKnownPaths(name33, entryPrefix, scopeBase = "") {
|
|
45658
45964
|
const prefix = normalizeEntryPrefix(entryPrefix);
|
|
45659
45965
|
const scope = normalizeScopeBase(scopeBase);
|
|
45660
|
-
const reversed = (0,
|
|
45661
|
-
const inPrefixRoot = `${prefix}${(0,
|
|
45662
|
-
const inPrefixScope = `${prefix}${scope}${(0,
|
|
45966
|
+
const reversed = (0, import_utils73.joinPath)(".well-known", name33) + `${prefix}${scope}`;
|
|
45967
|
+
const inPrefixRoot = `${prefix}${(0, import_utils73.joinPath)(".well-known", name33)}${scope}`;
|
|
45968
|
+
const inPrefixScope = `${prefix}${scope}${(0, import_utils73.joinPath)(".well-known", name33)}`;
|
|
45663
45969
|
return /* @__PURE__ */ new Set([reversed, inPrefixRoot, inPrefixScope]);
|
|
45664
45970
|
}
|
|
45665
|
-
var
|
|
45971
|
+
var import_utils73, import_utils74;
|
|
45666
45972
|
var init_path_utils = __esm({
|
|
45667
45973
|
"libs/sdk/src/common/utils/path.utils.ts"() {
|
|
45668
45974
|
"use strict";
|
|
45669
|
-
import_utils72 = require("@frontmcp/utils");
|
|
45670
45975
|
import_utils73 = require("@frontmcp/utils");
|
|
45976
|
+
import_utils74 = require("@frontmcp/utils");
|
|
45671
45977
|
}
|
|
45672
45978
|
});
|
|
45673
45979
|
|
|
@@ -46124,12 +46430,12 @@ var init_adapter_entry = __esm({
|
|
|
46124
46430
|
});
|
|
46125
46431
|
|
|
46126
46432
|
// libs/sdk/src/common/entries/tool.entry.ts
|
|
46127
|
-
var
|
|
46433
|
+
var import_utils77, ToolEntry2;
|
|
46128
46434
|
var init_tool_entry = __esm({
|
|
46129
46435
|
"libs/sdk/src/common/entries/tool.entry.ts"() {
|
|
46130
46436
|
"use strict";
|
|
46131
46437
|
init_base_entry();
|
|
46132
|
-
|
|
46438
|
+
import_utils77 = require("@frontmcp/utils");
|
|
46133
46439
|
ToolEntry2 = class extends BaseEntry {
|
|
46134
46440
|
owner;
|
|
46135
46441
|
/**
|
|
@@ -46193,10 +46499,10 @@ var init_tool_entry = __esm({
|
|
|
46193
46499
|
}
|
|
46194
46500
|
if (this.inputSchema && Object.keys(this.inputSchema).length > 0) {
|
|
46195
46501
|
try {
|
|
46196
|
-
const { z:
|
|
46197
|
-
return toJSONSchema8(
|
|
46502
|
+
const { z: z92, toJSONSchema: toJSONSchema8 } = require("zod");
|
|
46503
|
+
return toJSONSchema8(z92.object(this.inputSchema));
|
|
46198
46504
|
} catch (error) {
|
|
46199
|
-
if ((0,
|
|
46505
|
+
if ((0, import_utils77.isDebug)() || (0, import_utils77.isDevelopment)()) {
|
|
46200
46506
|
console.warn("[ToolEntry] Failed to convert Zod schema to JSON Schema:", error);
|
|
46201
46507
|
}
|
|
46202
46508
|
return { type: "object", properties: {} };
|
|
@@ -46457,7 +46763,7 @@ function parseListInput(rawInput, schema, expectedMethod) {
|
|
|
46457
46763
|
method = inputData.request.method;
|
|
46458
46764
|
params = inputData.request.params ?? {};
|
|
46459
46765
|
} catch (e) {
|
|
46460
|
-
throw new InvalidInputError("Invalid request format", e instanceof
|
|
46766
|
+
throw new InvalidInputError("Invalid request format", e instanceof import_zod91.z.ZodError ? e.issues : void 0);
|
|
46461
46767
|
}
|
|
46462
46768
|
if (method !== expectedMethod) {
|
|
46463
46769
|
throw new InvalidMethodError(method, expectedMethod);
|
|
@@ -46498,11 +46804,11 @@ function detectConflicts(entries, getBaseName) {
|
|
|
46498
46804
|
names: conflictNames
|
|
46499
46805
|
};
|
|
46500
46806
|
}
|
|
46501
|
-
var
|
|
46807
|
+
var import_zod91;
|
|
46502
46808
|
var init_flow_utils3 = __esm({
|
|
46503
46809
|
"libs/sdk/src/common/flow/flow.utils.ts"() {
|
|
46504
46810
|
"use strict";
|
|
46505
|
-
|
|
46811
|
+
import_zod91 = require("zod");
|
|
46506
46812
|
init_errors();
|
|
46507
46813
|
}
|
|
46508
46814
|
});
|
|
@@ -47294,7 +47600,7 @@ __export(index_exports, {
|
|
|
47294
47600
|
isValidVersion: () => isValidVersion,
|
|
47295
47601
|
isVercelKvProvider: () => isVercelKvProvider,
|
|
47296
47602
|
job: () => frontMcpJob,
|
|
47297
|
-
joinPath: () =>
|
|
47603
|
+
joinPath: () => import_utils74.joinPath,
|
|
47298
47604
|
jsonWebKeySetSchema: () => import_auth.jsonWebKeySetSchema,
|
|
47299
47605
|
jwkParametersSchema: () => import_auth.jwkParametersSchema,
|
|
47300
47606
|
jwkSchema: () => import_auth.jwkSchema,
|
|
@@ -47380,7 +47686,7 @@ __export(index_exports, {
|
|
|
47380
47686
|
toolPaginationOptionsSchema: () => toolPaginationOptionsSchema,
|
|
47381
47687
|
transparentAuthOptionsSchema: () => import_auth6.transparentAuthOptionsSchema,
|
|
47382
47688
|
transportOptionsSchema: () => transportOptionsSchema,
|
|
47383
|
-
trimSlashes: () =>
|
|
47689
|
+
trimSlashes: () => import_utils74.trimSlashes,
|
|
47384
47690
|
tryDecryptStoredValue: () => tryDecryptStoredValue,
|
|
47385
47691
|
tryGetConfig: () => tryGetConfig,
|
|
47386
47692
|
urlToSafeId: () => urlToSafeId,
|