@frontmcp/sdk 1.10.8 → 1.10.9-rc.1
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/auth/flows/auth.verify.flow.d.ts +1 -1
- package/auth/flows/oauth.auth-ui.flow.d.ts +2 -2
- package/auth/flows/oauth.authorize.flow.d.ts +2 -2
- package/auth/flows/oauth.callback.flow.d.ts +2 -2
- package/auth/flows/oauth.connect.flow.d.ts +2 -2
- package/auth/flows/oauth.provider-callback.flow.d.ts +2 -2
- package/auth/flows/oauth.register.flow.d.ts +2 -2
- package/auth/flows/oauth.token.flow.d.ts +2 -2
- package/auth/flows/oauth.userinfo.flow.d.ts +2 -2
- package/auth/flows/session.verify.flow.d.ts +1 -1
- package/auth/flows/well-known.jwks.flow.d.ts +2 -2
- package/auth/flows/well-known.oauth-authorization-server.flow.d.ts +2 -2
- package/auth/flows/well-known.prm.flow.d.ts +2 -2
- package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
- package/browser/auth/instances/instance.local-primary-auth.mjs +25 -1
- package/browser/common/interfaces/flow.interface.mjs +10 -0
- package/browser/common/schemas/http-input.schema.mjs +9 -3
- package/browser/common/utils/decide-request-intent.utils.mjs +3 -1
- package/browser/flows/flow.instance.mjs +54 -23
- package/browser/flows/flow.stages.mjs +3 -2
- package/browser/index.cjs +136 -52
- package/browser/skill/providers/memory-skill.provider.mjs +29 -7
- package/browser/tool/tool.instance.mjs +12 -3
- package/common/interfaces/flow.interface.d.ts.map +1 -1
- package/common/schemas/http-input.schema.d.ts +3 -3
- package/common/schemas/http-input.schema.d.ts.map +1 -1
- package/common/utils/decide-request-intent.utils.d.ts.map +1 -1
- package/esm/index.mjs +131 -47
- package/flows/flow.instance.d.ts +1 -0
- package/flows/flow.instance.d.ts.map +1 -1
- package/flows/flow.stages.d.ts.map +1 -1
- package/index.js +136 -52
- package/mcp-registry/flows/server-card.flow.d.ts +2 -2
- package/mcp-registry/flows/well-known.ai-catalog.flow.d.ts +2 -2
- package/mcp-registry/flows/well-known.mcp-registry-auth.flow.d.ts +2 -2
- package/package.json +10 -10
- package/skill/flows/http/llm-full-txt.flow.d.ts +2 -2
- package/skill/flows/http/llm-txt.flow.d.ts +2 -2
- package/skill/flows/http/skills-api.flow.d.ts +2 -2
- package/skill/providers/memory-skill.provider.d.ts +1 -0
- package/skill/providers/memory-skill.provider.d.ts.map +1 -1
- package/tool/tool.instance.d.ts +3 -0
- package/tool/tool.instance.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -2749,19 +2749,25 @@ var init_http_output_schema = __esm({
|
|
|
2749
2749
|
});
|
|
2750
2750
|
|
|
2751
2751
|
// libs/sdk/src/common/schemas/http-input.schema.ts
|
|
2752
|
-
var import_lazy_zod11, httpInputSchema, httpRequestInputSchema;
|
|
2752
|
+
var import_lazy_zod11, httpObjectSchema, httpInputSchema, httpRequestInputSchema;
|
|
2753
2753
|
var init_http_input_schema = __esm({
|
|
2754
2754
|
"libs/sdk/src/common/schemas/http-input.schema.ts"() {
|
|
2755
2755
|
"use strict";
|
|
2756
2756
|
import_lazy_zod11 = require("@frontmcp/lazy-zod");
|
|
2757
|
+
httpObjectSchema = () => import_lazy_zod11.z.custom().check((ctx) => {
|
|
2758
|
+
const value = ctx.value;
|
|
2759
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
2760
|
+
ctx.issues.push({ code: "invalid_type", expected: "object", input: value });
|
|
2761
|
+
}
|
|
2762
|
+
});
|
|
2757
2763
|
httpInputSchema = import_lazy_zod11.z.object({
|
|
2758
|
-
request:
|
|
2764
|
+
request: httpObjectSchema(),
|
|
2759
2765
|
// TODO: must be validated
|
|
2760
|
-
response:
|
|
2766
|
+
response: httpObjectSchema(),
|
|
2761
2767
|
next: import_lazy_zod11.z.function().optional()
|
|
2762
2768
|
});
|
|
2763
2769
|
httpRequestInputSchema = import_lazy_zod11.z.object({
|
|
2764
|
-
request:
|
|
2770
|
+
request: httpObjectSchema()
|
|
2765
2771
|
// TODO: must be validated
|
|
2766
2772
|
});
|
|
2767
2773
|
}
|
|
@@ -6815,6 +6821,12 @@ var init_flow_utils = __esm({
|
|
|
6815
6821
|
});
|
|
6816
6822
|
|
|
6817
6823
|
// libs/sdk/src/common/interfaces/flow.interface.ts
|
|
6824
|
+
function setStackTraceLimit(limit) {
|
|
6825
|
+
try {
|
|
6826
|
+
Error.stackTraceLimit = limit;
|
|
6827
|
+
} catch {
|
|
6828
|
+
}
|
|
6829
|
+
}
|
|
6818
6830
|
var import_utils25, FlowControl, FlowBase;
|
|
6819
6831
|
var init_flow_interface = __esm({
|
|
6820
6832
|
"libs/sdk/src/common/interfaces/flow.interface.ts"() {
|
|
@@ -6824,9 +6836,13 @@ var init_flow_interface = __esm({
|
|
|
6824
6836
|
init_flow_utils();
|
|
6825
6837
|
FlowControl = class _FlowControl extends Error {
|
|
6826
6838
|
constructor(type, output) {
|
|
6839
|
+
const stackTraceLimit = Error.stackTraceLimit;
|
|
6840
|
+
const skipStack = typeof stackTraceLimit === "number" && type !== "fail" && type !== "abort";
|
|
6841
|
+
if (skipStack) setStackTraceLimit(0);
|
|
6827
6842
|
super();
|
|
6828
6843
|
this.type = type;
|
|
6829
6844
|
this.output = output;
|
|
6845
|
+
if (skipStack) setStackTraceLimit(stackTraceLimit);
|
|
6830
6846
|
}
|
|
6831
6847
|
type;
|
|
6832
6848
|
output;
|
|
@@ -14643,7 +14659,7 @@ var init_tool_utils = __esm({
|
|
|
14643
14659
|
});
|
|
14644
14660
|
|
|
14645
14661
|
// libs/sdk/src/tool/tool.instance.ts
|
|
14646
|
-
var import_lazy_zod48, ToolInstance, FunctionToolContext;
|
|
14662
|
+
var import_lazy_zod48, looseArgumentsSchema, ToolInstance, FunctionToolContext;
|
|
14647
14663
|
var init_tool_instance = __esm({
|
|
14648
14664
|
"libs/sdk/src/tool/tool.instance.ts"() {
|
|
14649
14665
|
"use strict";
|
|
@@ -14656,6 +14672,7 @@ var init_tool_instance = __esm({
|
|
|
14656
14672
|
init_hooks_utils();
|
|
14657
14673
|
init_call_tool_flow();
|
|
14658
14674
|
init_tool_utils();
|
|
14675
|
+
looseArgumentsSchema = import_lazy_zod48.z.looseObject({});
|
|
14659
14676
|
ToolInstance = class extends ToolEntry {
|
|
14660
14677
|
/** The provider registry this tool is bound to (captured at construction) */
|
|
14661
14678
|
_providers;
|
|
@@ -14663,6 +14680,7 @@ var init_tool_instance = __esm({
|
|
|
14663
14680
|
scope;
|
|
14664
14681
|
/** The hook registry for this tool's scope (captured at construction) */
|
|
14665
14682
|
hooks;
|
|
14683
|
+
_inputObjectSchema;
|
|
14666
14684
|
constructor(record, providers, owner) {
|
|
14667
14685
|
super(record);
|
|
14668
14686
|
this.owner = owner;
|
|
@@ -14757,10 +14775,17 @@ var init_tool_instance = __esm({
|
|
|
14757
14775
|
const isRemoteTool = this.metadata.annotations?.["frontmcp:remote"] === true;
|
|
14758
14776
|
const hasRawJsonSchema = this.rawInputSchema !== void 0 && this.rawInputSchema !== null;
|
|
14759
14777
|
if (isRemoteTool || hasRawJsonSchema) {
|
|
14760
|
-
return
|
|
14778
|
+
return looseArgumentsSchema.parse(input.arguments ?? {});
|
|
14761
14779
|
}
|
|
14762
|
-
|
|
14763
|
-
|
|
14780
|
+
return this.inputObjectSchema().parse(input.arguments);
|
|
14781
|
+
}
|
|
14782
|
+
/** `z.object(inputSchema)`, built once per shape: building one per call recompiles its parser every call. */
|
|
14783
|
+
inputObjectSchema() {
|
|
14784
|
+
const shape = this.inputSchema;
|
|
14785
|
+
if (this._inputObjectSchema?.shape !== shape) {
|
|
14786
|
+
this._inputObjectSchema = { shape, schema: import_lazy_zod48.z.object(shape) };
|
|
14787
|
+
}
|
|
14788
|
+
return this._inputObjectSchema.schema;
|
|
14764
14789
|
}
|
|
14765
14790
|
/**
|
|
14766
14791
|
* Turn the raw tool function result into an MCP-compliant CallToolResult:
|
|
@@ -28514,7 +28539,7 @@ function collectFlowHookMap(FlowClass) {
|
|
|
28514
28539
|
const entry = {
|
|
28515
28540
|
_priority: m.priority ?? 0,
|
|
28516
28541
|
_order: order++,
|
|
28517
|
-
method: async (ctx, next =
|
|
28542
|
+
method: async (ctx, next = NO_NEXT) => {
|
|
28518
28543
|
const skipHook = () => m.type === "around" ? next() : void 0;
|
|
28519
28544
|
const target = m.static ? FlowClass : ctx;
|
|
28520
28545
|
const impl = typeof m.method === "function" ? m.method : target?.[m.method];
|
|
@@ -28541,7 +28566,7 @@ function mergeHookMetasIntoStageMap(FlowClass, table, metas, orderStart = 1e5, r
|
|
|
28541
28566
|
const entry = {
|
|
28542
28567
|
_priority: m.priority ?? 0,
|
|
28543
28568
|
_order: order++,
|
|
28544
|
-
method: async (ctx, next =
|
|
28569
|
+
method: async (ctx, next = NO_NEXT) => {
|
|
28545
28570
|
const skipHook = () => m.type === "around" ? next() : void 0;
|
|
28546
28571
|
const target = m.target;
|
|
28547
28572
|
if (!target) {
|
|
@@ -28561,7 +28586,7 @@ function mergeHookMetasIntoStageMap(FlowClass, table, metas, orderStart = 1e5, r
|
|
|
28561
28586
|
}
|
|
28562
28587
|
sortStageMap(table);
|
|
28563
28588
|
}
|
|
28564
|
-
var cap, CACHE;
|
|
28589
|
+
var cap, CACHE, NO_NEXT;
|
|
28565
28590
|
var init_flow_stages = __esm({
|
|
28566
28591
|
"libs/sdk/src/flows/flow.stages.ts"() {
|
|
28567
28592
|
"use strict";
|
|
@@ -28569,10 +28594,19 @@ var init_flow_stages = __esm({
|
|
|
28569
28594
|
init_hook_decorator();
|
|
28570
28595
|
cap = (s) => s ? s[0].toUpperCase() + s.slice(1) : s;
|
|
28571
28596
|
CACHE = /* @__PURE__ */ new WeakMap();
|
|
28597
|
+
NO_NEXT = async () => void 0;
|
|
28572
28598
|
}
|
|
28573
28599
|
});
|
|
28574
28600
|
|
|
28575
28601
|
// libs/sdk/src/flows/flow.instance.ts
|
|
28602
|
+
function stageKeysOf(stage) {
|
|
28603
|
+
let keys = stageKeysByName.get(stage);
|
|
28604
|
+
if (!keys) {
|
|
28605
|
+
keys = { will: `will${CAP(stage)}`, did: `did${CAP(stage)}`, around: `around${CAP(stage)}` };
|
|
28606
|
+
stageKeysByName.set(stage, keys);
|
|
28607
|
+
}
|
|
28608
|
+
return keys;
|
|
28609
|
+
}
|
|
28576
28610
|
function parseTypedKey(k) {
|
|
28577
28611
|
const lc = k.toLowerCase();
|
|
28578
28612
|
if (lc.startsWith("will") && k.length > 4) return { base: k.slice(4, 5).toLowerCase() + k.slice(5), type: "will" };
|
|
@@ -28581,7 +28615,25 @@ function parseTypedKey(k) {
|
|
|
28581
28615
|
return { base: k.slice(6, 7).toLowerCase() + k.slice(7), type: "around" };
|
|
28582
28616
|
return { base: k };
|
|
28583
28617
|
}
|
|
28584
|
-
|
|
28618
|
+
function stageBasesOf(group) {
|
|
28619
|
+
let bases = stageBasesByGroup.get(group);
|
|
28620
|
+
if (!bases) {
|
|
28621
|
+
const seen = /* @__PURE__ */ new Set();
|
|
28622
|
+
bases = [];
|
|
28623
|
+
for (const rawKey of group) {
|
|
28624
|
+
const { base, type } = parseTypedKey(rawKey);
|
|
28625
|
+
if (type || seen.has(base)) continue;
|
|
28626
|
+
seen.add(base);
|
|
28627
|
+
bases.push(base);
|
|
28628
|
+
}
|
|
28629
|
+
stageBasesByGroup.set(group, bases);
|
|
28630
|
+
}
|
|
28631
|
+
return bases;
|
|
28632
|
+
}
|
|
28633
|
+
function nextStageOrder(stages) {
|
|
28634
|
+
return Math.max(0, ...Object.values(stages).flatMap((list) => list.map((e) => e._order ?? 0))) + 1;
|
|
28635
|
+
}
|
|
28636
|
+
var import_reflect_metadata14, HOOK_OBSERVER_KEY, FAILED_OUTCOMES, CAP, stageKeysByName, stageBasesByGroup, FlowInstance;
|
|
28585
28637
|
var init_flow_instance = __esm({
|
|
28586
28638
|
"libs/sdk/src/flows/flow.instance.ts"() {
|
|
28587
28639
|
"use strict";
|
|
@@ -28599,9 +28651,8 @@ var init_flow_instance = __esm({
|
|
|
28599
28651
|
HOOK_OBSERVER_KEY = /* @__PURE__ */ Symbol.for("frontmcp:hook-observer");
|
|
28600
28652
|
FAILED_OUTCOMES = /* @__PURE__ */ new Set(["fail", "abort", "unknown_error"]);
|
|
28601
28653
|
CAP = (s) => s ? s[0].toUpperCase() + s.slice(1) : s;
|
|
28602
|
-
|
|
28603
|
-
|
|
28604
|
-
AROUND = (s) => `around${CAP(s)}`;
|
|
28654
|
+
stageKeysByName = /* @__PURE__ */ new Map();
|
|
28655
|
+
stageBasesByGroup = /* @__PURE__ */ new WeakMap();
|
|
28605
28656
|
FlowInstance = class extends FlowEntry {
|
|
28606
28657
|
deps;
|
|
28607
28658
|
globalProviders;
|
|
@@ -28610,6 +28661,7 @@ var init_flow_instance = __esm({
|
|
|
28610
28661
|
stages;
|
|
28611
28662
|
hooks;
|
|
28612
28663
|
logger;
|
|
28664
|
+
baseStageOrderEnd;
|
|
28613
28665
|
constructor(scope, record, deps, globalProviders) {
|
|
28614
28666
|
super(scope, record);
|
|
28615
28667
|
this.deps = [...deps];
|
|
@@ -28815,8 +28867,9 @@ var init_flow_instance = __esm({
|
|
|
28815
28867
|
mergedDeps.set(token, instance);
|
|
28816
28868
|
}
|
|
28817
28869
|
const baseStages = this.stages;
|
|
28818
|
-
|
|
28819
|
-
let
|
|
28870
|
+
let stages = baseStages;
|
|
28871
|
+
let ownsStages = false;
|
|
28872
|
+
let orderBase = this.baseStageOrderEnd ??= nextStageOrder(baseStages);
|
|
28820
28873
|
const hookOwnerId = await FlowClass.resolveHookOwnerId?.(input, scope);
|
|
28821
28874
|
const entryClass = await FlowClass.resolveHookEntryClass?.(input, scope);
|
|
28822
28875
|
const entryStaticHooks = entryClass ? staticHooksFor(this.hooks.getClsHooks(entryClass), name48) : [];
|
|
@@ -28844,6 +28897,10 @@ var init_flow_instance = __esm({
|
|
|
28844
28897
|
}
|
|
28845
28898
|
if (metas.length) {
|
|
28846
28899
|
const start = opts?.orderStart ?? orderBase;
|
|
28900
|
+
if (!ownsStages) {
|
|
28901
|
+
stages = cloneStageMap(baseStages);
|
|
28902
|
+
ownsStages = true;
|
|
28903
|
+
}
|
|
28847
28904
|
mergeHookMetasIntoStageMap(FlowClass, stages, metas, start, runHook);
|
|
28848
28905
|
if (opts?.orderStart === void 0) orderBase += metas.length;
|
|
28849
28906
|
}
|
|
@@ -28854,7 +28911,7 @@ var init_flow_instance = __esm({
|
|
|
28854
28911
|
const context = new FlowClass(this.metadata, input, scope, appendContextHooks, mergedDeps);
|
|
28855
28912
|
contextReady = true;
|
|
28856
28913
|
await materializeAndMerge(initialInjectedHooks, { orderStart: -1e6 });
|
|
28857
|
-
orderBase =
|
|
28914
|
+
if (ownsStages) orderBase = nextStageOrder(stages);
|
|
28858
28915
|
await materializeAndMerge(entryStaticHooks);
|
|
28859
28916
|
let responded;
|
|
28860
28917
|
const toStageResult = (e) => {
|
|
@@ -28868,12 +28925,18 @@ var init_flow_instance = __esm({
|
|
|
28868
28925
|
}
|
|
28869
28926
|
return { outcome: "unknown_error", control: e };
|
|
28870
28927
|
};
|
|
28928
|
+
const hasEntries = (key) => (stages[key]?.length ?? 0) > 0;
|
|
28871
28929
|
const runList = async (key, opts) => {
|
|
28872
|
-
const getList = () => stages[key] ?? [];
|
|
28873
28930
|
const seen = /* @__PURE__ */ new Set();
|
|
28874
28931
|
while (true) {
|
|
28875
|
-
const list =
|
|
28876
|
-
|
|
28932
|
+
const list = stages[key] ?? [];
|
|
28933
|
+
let item;
|
|
28934
|
+
for (const entry of list) {
|
|
28935
|
+
if (!seen.has(entry)) {
|
|
28936
|
+
item = entry;
|
|
28937
|
+
break;
|
|
28938
|
+
}
|
|
28939
|
+
}
|
|
28877
28940
|
if (!item) break;
|
|
28878
28941
|
seen.add(item);
|
|
28879
28942
|
try {
|
|
@@ -28886,7 +28949,7 @@ var init_flow_instance = __esm({
|
|
|
28886
28949
|
return { outcome: "ok" };
|
|
28887
28950
|
};
|
|
28888
28951
|
const runAroundChain = async (stageName, index = 0) => {
|
|
28889
|
-
const around = (stages[
|
|
28952
|
+
const around = (stages[stageKeysOf(stageName).around] ?? [])[index];
|
|
28890
28953
|
if (!around) return runList(stageName, { ignoreRespond: false });
|
|
28891
28954
|
let innerResult = { outcome: "ok" };
|
|
28892
28955
|
const next = async () => {
|
|
@@ -28901,17 +28964,18 @@ var init_flow_instance = __esm({
|
|
|
28901
28964
|
return FAILED_OUTCOMES.has(innerResult.outcome) ? { outcome: "ok" } : innerResult;
|
|
28902
28965
|
};
|
|
28903
28966
|
const runOneStage = async (stageName, stopOnRespond) => {
|
|
28904
|
-
|
|
28905
|
-
|
|
28967
|
+
const keys = stageKeysOf(stageName);
|
|
28968
|
+
if (hasEntries(keys.will)) {
|
|
28969
|
+
const res = await runList(keys.will);
|
|
28906
28970
|
if (res.outcome === "respond" && stopOnRespond) return res;
|
|
28907
28971
|
if (res.outcome !== "ok" && res.outcome !== "respond") return res;
|
|
28908
28972
|
}
|
|
28909
|
-
const bodyOutcome = await runAroundChain(stageName);
|
|
28973
|
+
const bodyOutcome = hasEntries(keys.around) ? await runAroundChain(stageName) : await runList(stageName, { ignoreRespond: false });
|
|
28910
28974
|
if (bodyOutcome.outcome !== "ok" && bodyOutcome.outcome !== "respond") {
|
|
28911
28975
|
return bodyOutcome;
|
|
28912
28976
|
}
|
|
28913
|
-
{
|
|
28914
|
-
const res = await runList(
|
|
28977
|
+
if (hasEntries(keys.did)) {
|
|
28978
|
+
const res = await runList(keys.did, { ignoreRespond: true });
|
|
28915
28979
|
if (res.outcome !== "ok" && res.outcome !== "respond") return res;
|
|
28916
28980
|
}
|
|
28917
28981
|
if (bodyOutcome.outcome === "respond") return bodyOutcome;
|
|
@@ -28919,14 +28983,7 @@ var init_flow_instance = __esm({
|
|
|
28919
28983
|
};
|
|
28920
28984
|
const runStageGroup = async (group, stopOnRespond, opts) => {
|
|
28921
28985
|
if (!group || group.length === 0) return { outcome: "ok" };
|
|
28922
|
-
const
|
|
28923
|
-
for (const rawKey of group) {
|
|
28924
|
-
const { base, type } = parseTypedKey(rawKey);
|
|
28925
|
-
if (type) {
|
|
28926
|
-
continue;
|
|
28927
|
-
}
|
|
28928
|
-
if (seenBase.has(base)) continue;
|
|
28929
|
-
seenBase.add(base);
|
|
28986
|
+
for (const base of stageBasesOf(group)) {
|
|
28930
28987
|
const res = await runOneStage(base, stopOnRespond);
|
|
28931
28988
|
if (res.outcome === "respond") {
|
|
28932
28989
|
if (stopOnRespond) return res;
|
|
@@ -31175,12 +31232,12 @@ function isSnapshotCapable(db) {
|
|
|
31175
31232
|
const d = db;
|
|
31176
31233
|
return typeof d.toSnapshot === "function" && typeof d.loadSnapshot === "function";
|
|
31177
31234
|
}
|
|
31178
|
-
var
|
|
31235
|
+
var import_utils72, STOP_WORDS, MemorySkillProvider;
|
|
31179
31236
|
var init_memory_skill_provider = __esm({
|
|
31180
31237
|
"libs/sdk/src/skill/providers/memory-skill.provider.ts"() {
|
|
31181
31238
|
"use strict";
|
|
31182
|
-
import_vectoriadb = require("vectoriadb");
|
|
31183
31239
|
import_utils72 = require("@frontmcp/utils");
|
|
31240
|
+
init_dynamic_import_utils();
|
|
31184
31241
|
STOP_WORDS = /* @__PURE__ */ new Set([
|
|
31185
31242
|
// Articles & Determiners
|
|
31186
31243
|
"the",
|
|
@@ -31257,6 +31314,7 @@ var init_memory_skill_provider = __esm({
|
|
|
31257
31314
|
type = "memory";
|
|
31258
31315
|
/** The search index, created the first time a search needs it. */
|
|
31259
31316
|
vectorDB;
|
|
31317
|
+
vectorDBLoading;
|
|
31260
31318
|
skills = /* @__PURE__ */ new Map();
|
|
31261
31319
|
defaultTopK;
|
|
31262
31320
|
defaultMinScore;
|
|
@@ -31281,13 +31339,17 @@ var init_memory_skill_provider = __esm({
|
|
|
31281
31339
|
this.scoring = options.scoring ?? "cosine";
|
|
31282
31340
|
this.indexCache = options.indexCache;
|
|
31283
31341
|
}
|
|
31284
|
-
createVectorDB() {
|
|
31342
|
+
async createVectorDB() {
|
|
31343
|
+
const { TFIDFVectoria } = await importWithRequireFallback(
|
|
31344
|
+
() => import("vectoriadb"),
|
|
31345
|
+
() => require("vectoriadb")
|
|
31346
|
+
);
|
|
31285
31347
|
const dbConfig = {
|
|
31286
31348
|
defaultTopK: this.defaultTopK,
|
|
31287
31349
|
defaultSimilarityThreshold: this.defaultMinScore
|
|
31288
31350
|
};
|
|
31289
31351
|
if (this.scoring !== "cosine") dbConfig.scoring = this.scoring;
|
|
31290
|
-
return new
|
|
31352
|
+
return new TFIDFVectoria(dbConfig);
|
|
31291
31353
|
}
|
|
31292
31354
|
/**
|
|
31293
31355
|
* Attach (or replace) the snapshot cache after construction — useful when the
|
|
@@ -31316,8 +31378,8 @@ var init_memory_skill_provider = __esm({
|
|
|
31316
31378
|
*/
|
|
31317
31379
|
async ensureIndexed() {
|
|
31318
31380
|
if (this.indexReady) return;
|
|
31319
|
-
const db = this.db();
|
|
31320
31381
|
const version = this.skillsVersion;
|
|
31382
|
+
const db = await this.db();
|
|
31321
31383
|
if (this.indexCache && isSnapshotCapable(db)) {
|
|
31322
31384
|
const key = await this.computeIndexKey();
|
|
31323
31385
|
try {
|
|
@@ -31372,9 +31434,16 @@ var init_memory_skill_provider = __esm({
|
|
|
31372
31434
|
const canonical = `frontmcp-skill-index:v1|${this.scoring}|${this.skills.size}|${parts.join("")}`;
|
|
31373
31435
|
return (0, import_utils72.sha256Hex)(canonical);
|
|
31374
31436
|
}
|
|
31375
|
-
db() {
|
|
31376
|
-
this.vectorDB
|
|
31377
|
-
|
|
31437
|
+
async db() {
|
|
31438
|
+
if (this.vectorDB) return this.vectorDB;
|
|
31439
|
+
this.vectorDBLoading ??= this.createVectorDB().then(
|
|
31440
|
+
(db) => this.vectorDB ??= db,
|
|
31441
|
+
(error) => {
|
|
31442
|
+
this.vectorDBLoading = void 0;
|
|
31443
|
+
throw error;
|
|
31444
|
+
}
|
|
31445
|
+
);
|
|
31446
|
+
return this.vectorDBLoading;
|
|
31378
31447
|
}
|
|
31379
31448
|
/**
|
|
31380
31449
|
* Set the tool validator after construction.
|
|
@@ -31420,7 +31489,7 @@ var init_memory_skill_provider = __esm({
|
|
|
31420
31489
|
}
|
|
31421
31490
|
return true;
|
|
31422
31491
|
};
|
|
31423
|
-
const db = this.db();
|
|
31492
|
+
const db = await this.db();
|
|
31424
31493
|
await this.ensureIndexed();
|
|
31425
31494
|
let results = await db.search(query, {
|
|
31426
31495
|
topK,
|
|
@@ -38661,13 +38730,13 @@ var init_skill_http_auth = __esm({
|
|
|
38661
38730
|
}
|
|
38662
38731
|
const token = authHeader.slice(7);
|
|
38663
38732
|
try {
|
|
38664
|
-
const { jwtVerify
|
|
38733
|
+
const { jwtVerify, createRemoteJWKSet } = await importWithRequireFallback(
|
|
38665
38734
|
() => import("jose"),
|
|
38666
38735
|
() => require("jose")
|
|
38667
38736
|
);
|
|
38668
38737
|
const jwksUrl = jwtConfig.jwksUrl ?? `${jwtConfig.issuer}/.well-known/jwks.json`;
|
|
38669
38738
|
const JWKS = createRemoteJWKSet(new URL(jwksUrl));
|
|
38670
|
-
const { payload } = await
|
|
38739
|
+
const { payload } = await jwtVerify(token, JWKS, {
|
|
38671
38740
|
issuer: jwtConfig.issuer,
|
|
38672
38741
|
audience: jwtConfig.audience,
|
|
38673
38742
|
requiredClaims: ["exp"]
|
|
@@ -42146,7 +42215,9 @@ function tryDecodeTransportType(sessionId) {
|
|
|
42146
42215
|
if (!sessionId) return;
|
|
42147
42216
|
try {
|
|
42148
42217
|
const b64 = sessionId.replace(/-/g, "+").replace(/_/g, "/");
|
|
42149
|
-
const
|
|
42218
|
+
const json = Buffer.from(b64, "base64").toString("utf8");
|
|
42219
|
+
if (json.trimStart()[0] !== "{") return;
|
|
42220
|
+
const obj = JSON.parse(json);
|
|
42150
42221
|
return obj?.transportType;
|
|
42151
42222
|
} catch {
|
|
42152
42223
|
return;
|
|
@@ -66024,6 +66095,16 @@ var init_secure_store = __esm({
|
|
|
66024
66095
|
});
|
|
66025
66096
|
|
|
66026
66097
|
// libs/sdk/src/auth/instances/instance.local-primary-auth.ts
|
|
66098
|
+
function loadJose() {
|
|
66099
|
+
jose ??= importWithRequireFallback(
|
|
66100
|
+
() => import("jose"),
|
|
66101
|
+
() => require("jose")
|
|
66102
|
+
).catch((error) => {
|
|
66103
|
+
jose = void 0;
|
|
66104
|
+
throw error;
|
|
66105
|
+
});
|
|
66106
|
+
return jose;
|
|
66107
|
+
}
|
|
66027
66108
|
function getDefaultNoAuthSecret() {
|
|
66028
66109
|
if (!defaultNoAuthSecret) {
|
|
66029
66110
|
defaultNoAuthSecret = (0, import_utils129.randomBytes)(32);
|
|
@@ -66063,17 +66144,17 @@ function originOf2(value) {
|
|
|
66063
66144
|
return void 0;
|
|
66064
66145
|
}
|
|
66065
66146
|
}
|
|
66066
|
-
var
|
|
66147
|
+
var import_auth61, import_utils129, jose, MIN_HS256_SECRET_BYTES, defaultNoAuthSecret, RESERVED_JWT_CLAIMS, LocalPrimaryAuth;
|
|
66067
66148
|
var init_instance_local_primary_auth = __esm({
|
|
66068
66149
|
"libs/sdk/src/auth/instances/instance.local-primary-auth.ts"() {
|
|
66069
66150
|
"use strict";
|
|
66070
|
-
import_jose = require("jose");
|
|
66071
66151
|
import_auth61 = require("@frontmcp/auth");
|
|
66072
66152
|
import_utils129 = require("@frontmcp/utils");
|
|
66073
66153
|
init_common();
|
|
66074
66154
|
init_auth2();
|
|
66075
66155
|
init_context_extension();
|
|
66076
66156
|
init_errors();
|
|
66157
|
+
init_dynamic_import_utils();
|
|
66077
66158
|
init_cimd();
|
|
66078
66159
|
init_credentials();
|
|
66079
66160
|
init_credentials_context_extension();
|
|
@@ -66627,7 +66708,8 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66627
66708
|
* @param options.issuer The issuer to name (`iss`): {@link issuerFor} the request. Default: the boot-time issuer.
|
|
66628
66709
|
*/
|
|
66629
66710
|
async signAnonymousJwt(options = {}) {
|
|
66630
|
-
const
|
|
66711
|
+
const { SignJWT } = await loadJose();
|
|
66712
|
+
const jwt = new SignJWT({ sub: `anon:${(0, import_utils129.randomUUID)()}`, anonymous: true, scope: this.anonymousScopes().join(" ") }).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt().setIssuer(options.issuer ?? this.issuer).setExpirationTime(`${this.anonymousTokenTtlSeconds()}s`).setJti((0, import_utils129.randomUUID)());
|
|
66631
66713
|
if (options.audience) jwt.setAudience(options.audience);
|
|
66632
66714
|
return jwt.sign(this.secret);
|
|
66633
66715
|
}
|
|
@@ -66662,7 +66744,8 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66662
66744
|
*/
|
|
66663
66745
|
async verifyGatewayToken(token, requestBaseUrl, expectedAudience, expectedIssuer) {
|
|
66664
66746
|
try {
|
|
66665
|
-
const {
|
|
66747
|
+
const { jwtVerify } = await loadJose();
|
|
66748
|
+
const { payload, protectedHeader } = await jwtVerify(token, this.secret, {
|
|
66666
66749
|
algorithms: ["HS256"],
|
|
66667
66750
|
issuer: typeof expectedIssuer === "string" ? expectedIssuer : expectedIssuer ? [...expectedIssuer] : this.issuer,
|
|
66668
66751
|
requiredClaims: ["exp"]
|
|
@@ -66721,7 +66804,8 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66721
66804
|
}
|
|
66722
66805
|
}
|
|
66723
66806
|
}
|
|
66724
|
-
const
|
|
66807
|
+
const { SignJWT } = await loadJose();
|
|
66808
|
+
const jwt = new SignJWT(claims).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt().setIssuer(issuer ?? this.issuer).setExpirationTime(`${this.accessTokenTtlSeconds}s`).setJti((0, import_utils129.randomUUID)());
|
|
66725
66809
|
if (audience) {
|
|
66726
66810
|
jwt.setAudience(audience);
|
|
66727
66811
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { z } from '@frontmcp/lazy-zod';
|
|
3
3
|
import { FlowBase, type FlowRunOptions, type ScopeEntry, type ServerRequest } from '../../common';
|
|
4
4
|
declare const inputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
5
|
-
request: import("
|
|
6
|
-
response: import("
|
|
5
|
+
request: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
6
|
+
response: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
7
7
|
next: import("@frontmcp/lazy-zod").ZodOptional<import("zod").ZodFunction<import("zod/v4/core").$ZodFunctionArgs, import("zod/v4/core").$ZodFunctionOut>>;
|
|
8
8
|
}, import("zod/v4/core").$strip>;
|
|
9
9
|
declare const stateSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { z } from '@frontmcp/lazy-zod';
|
|
3
3
|
import { FlowBase, type FlowRunOptions, type ServerRequest } from '../../common';
|
|
4
4
|
declare const inputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
5
|
-
request: import("
|
|
6
|
-
response: import("
|
|
5
|
+
request: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
6
|
+
response: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
7
7
|
next: import("@frontmcp/lazy-zod").ZodOptional<import("zod").ZodFunction<import("zod/v4/core").$ZodFunctionArgs, import("zod/v4/core").$ZodFunctionOut>>;
|
|
8
8
|
}, import("zod/v4/core").$strip>;
|
|
9
9
|
declare const outputSchema: import("@frontmcp/lazy-zod").ZodUnion<readonly [import("@frontmcp/lazy-zod").ZodObject<{
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { type z } from '@frontmcp/lazy-zod';
|
|
3
3
|
import { FlowBase, type FlowRunOptions, type ScopeEntry, type ServerRequest } from '../../common';
|
|
4
4
|
declare const inputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
5
|
-
request: import("
|
|
6
|
-
response: import("
|
|
5
|
+
request: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
6
|
+
response: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
7
7
|
next: import("@frontmcp/lazy-zod").ZodOptional<import("zod").ZodFunction<import("zod/v4/core").$ZodFunctionArgs, import("zod/v4/core").$ZodFunctionOut>>;
|
|
8
8
|
}, import("zod/v4/core").$strip>;
|
|
9
9
|
declare const outputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/sdk",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.9-rc.1",
|
|
4
4
|
"description": "The TypeScript framework for MCP servers: typed tools with Zod, dependency injection, auth, testing, agents and jobs, and builds for Node, Vercel, AWS Lambda and Cloudflare Workers.",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://frontmcp.dev",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"@anthropic-ai/sdk": "^0.30.0 || ^0.78.0",
|
|
100
100
|
"@enclave-vm/core": "^2.16.0",
|
|
101
|
-
"@frontmcp/observability": "1.10.
|
|
102
|
-
"@frontmcp/storage-sqlite": "1.10.
|
|
101
|
+
"@frontmcp/observability": "1.10.9-rc.1",
|
|
102
|
+
"@frontmcp/storage-sqlite": "1.10.9-rc.1",
|
|
103
103
|
"@opentelemetry/api": "^1.9.0",
|
|
104
104
|
"@opentelemetry/sdk-trace-base": "^2.8.0",
|
|
105
105
|
"content-type": "^1.0.5",
|
|
@@ -132,13 +132,13 @@
|
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
"dependencies": {
|
|
135
|
-
"@frontmcp/auth": "1.10.
|
|
136
|
-
"@frontmcp/di": "1.10.
|
|
137
|
-
"@frontmcp/guard": "1.10.
|
|
138
|
-
"@frontmcp/lazy-zod": "1.10.
|
|
139
|
-
"@frontmcp/protocol": "1.10.
|
|
140
|
-
"@frontmcp/uipack": "1.10.
|
|
141
|
-
"@frontmcp/utils": "1.10.
|
|
135
|
+
"@frontmcp/auth": "1.10.9-rc.1",
|
|
136
|
+
"@frontmcp/di": "1.10.9-rc.1",
|
|
137
|
+
"@frontmcp/guard": "1.10.9-rc.1",
|
|
138
|
+
"@frontmcp/lazy-zod": "1.10.9-rc.1",
|
|
139
|
+
"@frontmcp/protocol": "1.10.9-rc.1",
|
|
140
|
+
"@frontmcp/uipack": "1.10.9-rc.1",
|
|
141
|
+
"@frontmcp/utils": "1.10.9-rc.1",
|
|
142
142
|
"@types/cors": "^2.8.17",
|
|
143
143
|
"ioredis": "^5.8.0",
|
|
144
144
|
"jose": "^6.1.3",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlowBase, type FlowRunOptions, type ScopeEntry, type ServerRequest } from '../../../common';
|
|
2
2
|
declare const inputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
3
|
-
request: import("
|
|
4
|
-
response: import("
|
|
3
|
+
request: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
4
|
+
response: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
5
5
|
next: import("@frontmcp/lazy-zod").ZodOptional<import("zod").ZodFunction<import("zod/v4/core").$ZodFunctionArgs, import("zod/v4/core").$ZodFunctionOut>>;
|
|
6
6
|
}, import("zod/v4/core").$strip>;
|
|
7
7
|
declare const stateSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlowBase, type FlowRunOptions, type ScopeEntry, type ServerRequest } from '../../../common';
|
|
2
2
|
declare const inputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
3
|
-
request: import("
|
|
4
|
-
response: import("
|
|
3
|
+
request: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
4
|
+
response: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
5
5
|
next: import("@frontmcp/lazy-zod").ZodOptional<import("zod").ZodFunction<import("zod/v4/core").$ZodFunctionArgs, import("zod/v4/core").$ZodFunctionOut>>;
|
|
6
6
|
}, import("zod/v4/core").$strip>;
|
|
7
7
|
declare const stateSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlowBase, type FlowRunOptions, type ScopeEntry, type ServerRequest } from '../../../common';
|
|
2
2
|
declare const inputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
3
|
-
request: import("
|
|
4
|
-
response: import("
|
|
3
|
+
request: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
4
|
+
response: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
5
5
|
next: import("@frontmcp/lazy-zod").ZodOptional<import("zod").ZodFunction<import("zod/v4/core").$ZodFunctionArgs, import("zod/v4/core").$ZodFunctionOut>>;
|
|
6
6
|
}, import("zod/v4/core").$strip>;
|
|
7
7
|
declare const stateSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
@@ -45,6 +45,7 @@ export declare class MemorySkillProvider implements MutableSkillStorageProvider
|
|
|
45
45
|
readonly type: SkillStorageProviderType;
|
|
46
46
|
/** The search index, created the first time a search needs it. */
|
|
47
47
|
private vectorDB?;
|
|
48
|
+
private vectorDBLoading?;
|
|
48
49
|
private skills;
|
|
49
50
|
private defaultTopK;
|
|
50
51
|
private defaultMinScore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-skill.provider.d.ts","sourceRoot":"","sources":["../../../src/skill/providers/memory-skill.provider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"memory-skill.provider.d.ts","sourceRoot":"","sources":["../../../src/skill/providers/memory-skill.provider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,M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O,CAAC,IAAI,CAAC;IAMpD;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IA0D3B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAwC1B;;;OAGG;IACH,OAAO,CAAC,eAAe;IAiCvB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAMpB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAIhB;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACH,OAAO,CAAC,aAAa;CAGtB"}
|
package/tool/tool.instance.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare class ToolInstance<InSchema extends ToolInputType = ToolInputType
|
|
|
21
21
|
readonly scope: ScopeEntry;
|
|
22
22
|
/** The hook registry for this tool's scope (captured at construction) */
|
|
23
23
|
readonly hooks: HookRegistry;
|
|
24
|
+
private _inputObjectSchema?;
|
|
24
25
|
constructor(record: ToolRecord, providers: ProviderRegistry, owner: EntryOwnerRef);
|
|
25
26
|
protected initialize(): Promise<void>;
|
|
26
27
|
getMetadata(): import("../common").ToolMetadata<Readonly<{
|
|
@@ -42,6 +43,8 @@ export declare class ToolInstance<InSchema extends ToolInputType = ToolInputType
|
|
|
42
43
|
get providers(): ProviderRegistry;
|
|
43
44
|
create(input: ToolCallArgs, ctx: ToolCallExtra): ToolContext<InSchema, OutSchema, In, Out>;
|
|
44
45
|
parseInput(input: CallToolRequest['params']): CallToolRequest['params']['arguments'];
|
|
46
|
+
/** `z.object(inputSchema)`, built once per shape: building one per call recompiles its parser every call. */
|
|
47
|
+
private inputObjectSchema;
|
|
45
48
|
/**
|
|
46
49
|
* Turn the raw tool function result into an MCP-compliant CallToolResult:
|
|
47
50
|
* - `content`: list of ContentBlocks (text / image / audio / resource / resource_link)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.instance.d.ts","sourceRoot":"","sources":["../../src/tool/tool.instance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB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