@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/esm/index.mjs
CHANGED
|
@@ -2750,18 +2750,24 @@ var init_http_output_schema = __esm({
|
|
|
2750
2750
|
|
|
2751
2751
|
// libs/sdk/src/common/schemas/http-input.schema.ts
|
|
2752
2752
|
import { z as z11 } from "@frontmcp/lazy-zod";
|
|
2753
|
-
var httpInputSchema, httpRequestInputSchema;
|
|
2753
|
+
var httpObjectSchema, httpInputSchema, httpRequestInputSchema;
|
|
2754
2754
|
var init_http_input_schema = __esm({
|
|
2755
2755
|
"libs/sdk/src/common/schemas/http-input.schema.ts"() {
|
|
2756
2756
|
"use strict";
|
|
2757
|
+
httpObjectSchema = () => z11.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 = z11.object({
|
|
2758
|
-
request:
|
|
2764
|
+
request: httpObjectSchema(),
|
|
2759
2765
|
// TODO: must be validated
|
|
2760
|
-
response:
|
|
2766
|
+
response: httpObjectSchema(),
|
|
2761
2767
|
next: z11.function().optional()
|
|
2762
2768
|
});
|
|
2763
2769
|
httpRequestInputSchema = z11.object({
|
|
2764
|
-
request:
|
|
2770
|
+
request: httpObjectSchema()
|
|
2765
2771
|
// TODO: must be validated
|
|
2766
2772
|
});
|
|
2767
2773
|
}
|
|
@@ -6865,6 +6871,12 @@ var init_flow_utils = __esm({
|
|
|
6865
6871
|
|
|
6866
6872
|
// libs/sdk/src/common/interfaces/flow.interface.ts
|
|
6867
6873
|
import { brandClass as brandClass2, isBrandedInstance as isBrandedInstance2 } from "@frontmcp/utils";
|
|
6874
|
+
function setStackTraceLimit(limit) {
|
|
6875
|
+
try {
|
|
6876
|
+
Error.stackTraceLimit = limit;
|
|
6877
|
+
} catch {
|
|
6878
|
+
}
|
|
6879
|
+
}
|
|
6868
6880
|
var FlowControl, FlowBase;
|
|
6869
6881
|
var init_flow_interface = __esm({
|
|
6870
6882
|
"libs/sdk/src/common/interfaces/flow.interface.ts"() {
|
|
@@ -6873,9 +6885,13 @@ var init_flow_interface = __esm({
|
|
|
6873
6885
|
init_flow_utils();
|
|
6874
6886
|
FlowControl = class _FlowControl extends Error {
|
|
6875
6887
|
constructor(type, output) {
|
|
6888
|
+
const stackTraceLimit = Error.stackTraceLimit;
|
|
6889
|
+
const skipStack = typeof stackTraceLimit === "number" && type !== "fail" && type !== "abort";
|
|
6890
|
+
if (skipStack) setStackTraceLimit(0);
|
|
6876
6891
|
super();
|
|
6877
6892
|
this.type = type;
|
|
6878
6893
|
this.output = output;
|
|
6894
|
+
if (skipStack) setStackTraceLimit(stackTraceLimit);
|
|
6879
6895
|
}
|
|
6880
6896
|
type;
|
|
6881
6897
|
output;
|
|
@@ -14711,7 +14727,7 @@ var init_tool_utils = __esm({
|
|
|
14711
14727
|
|
|
14712
14728
|
// libs/sdk/src/tool/tool.instance.ts
|
|
14713
14729
|
import { z as z47 } from "@frontmcp/lazy-zod";
|
|
14714
|
-
var ToolInstance, FunctionToolContext;
|
|
14730
|
+
var looseArgumentsSchema, ToolInstance, FunctionToolContext;
|
|
14715
14731
|
var init_tool_instance = __esm({
|
|
14716
14732
|
"libs/sdk/src/tool/tool.instance.ts"() {
|
|
14717
14733
|
"use strict";
|
|
@@ -14723,6 +14739,7 @@ var init_tool_instance = __esm({
|
|
|
14723
14739
|
init_hooks_utils();
|
|
14724
14740
|
init_call_tool_flow();
|
|
14725
14741
|
init_tool_utils();
|
|
14742
|
+
looseArgumentsSchema = z47.looseObject({});
|
|
14726
14743
|
ToolInstance = class extends ToolEntry {
|
|
14727
14744
|
/** The provider registry this tool is bound to (captured at construction) */
|
|
14728
14745
|
_providers;
|
|
@@ -14730,6 +14747,7 @@ var init_tool_instance = __esm({
|
|
|
14730
14747
|
scope;
|
|
14731
14748
|
/** The hook registry for this tool's scope (captured at construction) */
|
|
14732
14749
|
hooks;
|
|
14750
|
+
_inputObjectSchema;
|
|
14733
14751
|
constructor(record, providers, owner) {
|
|
14734
14752
|
super(record);
|
|
14735
14753
|
this.owner = owner;
|
|
@@ -14824,10 +14842,17 @@ var init_tool_instance = __esm({
|
|
|
14824
14842
|
const isRemoteTool = this.metadata.annotations?.["frontmcp:remote"] === true;
|
|
14825
14843
|
const hasRawJsonSchema = this.rawInputSchema !== void 0 && this.rawInputSchema !== null;
|
|
14826
14844
|
if (isRemoteTool || hasRawJsonSchema) {
|
|
14827
|
-
return
|
|
14845
|
+
return looseArgumentsSchema.parse(input.arguments ?? {});
|
|
14828
14846
|
}
|
|
14829
|
-
|
|
14830
|
-
|
|
14847
|
+
return this.inputObjectSchema().parse(input.arguments);
|
|
14848
|
+
}
|
|
14849
|
+
/** `z.object(inputSchema)`, built once per shape: building one per call recompiles its parser every call. */
|
|
14850
|
+
inputObjectSchema() {
|
|
14851
|
+
const shape = this.inputSchema;
|
|
14852
|
+
if (this._inputObjectSchema?.shape !== shape) {
|
|
14853
|
+
this._inputObjectSchema = { shape, schema: z47.object(shape) };
|
|
14854
|
+
}
|
|
14855
|
+
return this._inputObjectSchema.schema;
|
|
14831
14856
|
}
|
|
14832
14857
|
/**
|
|
14833
14858
|
* Turn the raw tool function result into an MCP-compliant CallToolResult:
|
|
@@ -28588,7 +28613,7 @@ function collectFlowHookMap(FlowClass) {
|
|
|
28588
28613
|
const entry = {
|
|
28589
28614
|
_priority: m.priority ?? 0,
|
|
28590
28615
|
_order: order++,
|
|
28591
|
-
method: async (ctx, next =
|
|
28616
|
+
method: async (ctx, next = NO_NEXT) => {
|
|
28592
28617
|
const skipHook = () => m.type === "around" ? next() : void 0;
|
|
28593
28618
|
const target = m.static ? FlowClass : ctx;
|
|
28594
28619
|
const impl = typeof m.method === "function" ? m.method : target?.[m.method];
|
|
@@ -28615,7 +28640,7 @@ function mergeHookMetasIntoStageMap(FlowClass, table, metas, orderStart = 1e5, r
|
|
|
28615
28640
|
const entry = {
|
|
28616
28641
|
_priority: m.priority ?? 0,
|
|
28617
28642
|
_order: order++,
|
|
28618
|
-
method: async (ctx, next =
|
|
28643
|
+
method: async (ctx, next = NO_NEXT) => {
|
|
28619
28644
|
const skipHook = () => m.type === "around" ? next() : void 0;
|
|
28620
28645
|
const target = m.target;
|
|
28621
28646
|
if (!target) {
|
|
@@ -28635,7 +28660,7 @@ function mergeHookMetasIntoStageMap(FlowClass, table, metas, orderStart = 1e5, r
|
|
|
28635
28660
|
}
|
|
28636
28661
|
sortStageMap(table);
|
|
28637
28662
|
}
|
|
28638
|
-
var cap, CACHE;
|
|
28663
|
+
var cap, CACHE, NO_NEXT;
|
|
28639
28664
|
var init_flow_stages = __esm({
|
|
28640
28665
|
"libs/sdk/src/flows/flow.stages.ts"() {
|
|
28641
28666
|
"use strict";
|
|
@@ -28643,11 +28668,20 @@ var init_flow_stages = __esm({
|
|
|
28643
28668
|
init_hook_decorator();
|
|
28644
28669
|
cap = (s) => s ? s[0].toUpperCase() + s.slice(1) : s;
|
|
28645
28670
|
CACHE = /* @__PURE__ */ new WeakMap();
|
|
28671
|
+
NO_NEXT = async () => void 0;
|
|
28646
28672
|
}
|
|
28647
28673
|
});
|
|
28648
28674
|
|
|
28649
28675
|
// libs/sdk/src/flows/flow.instance.ts
|
|
28650
28676
|
import "reflect-metadata";
|
|
28677
|
+
function stageKeysOf(stage) {
|
|
28678
|
+
let keys = stageKeysByName.get(stage);
|
|
28679
|
+
if (!keys) {
|
|
28680
|
+
keys = { will: `will${CAP(stage)}`, did: `did${CAP(stage)}`, around: `around${CAP(stage)}` };
|
|
28681
|
+
stageKeysByName.set(stage, keys);
|
|
28682
|
+
}
|
|
28683
|
+
return keys;
|
|
28684
|
+
}
|
|
28651
28685
|
function parseTypedKey(k) {
|
|
28652
28686
|
const lc = k.toLowerCase();
|
|
28653
28687
|
if (lc.startsWith("will") && k.length > 4) return { base: k.slice(4, 5).toLowerCase() + k.slice(5), type: "will" };
|
|
@@ -28656,7 +28690,25 @@ function parseTypedKey(k) {
|
|
|
28656
28690
|
return { base: k.slice(6, 7).toLowerCase() + k.slice(7), type: "around" };
|
|
28657
28691
|
return { base: k };
|
|
28658
28692
|
}
|
|
28659
|
-
|
|
28693
|
+
function stageBasesOf(group) {
|
|
28694
|
+
let bases = stageBasesByGroup.get(group);
|
|
28695
|
+
if (!bases) {
|
|
28696
|
+
const seen = /* @__PURE__ */ new Set();
|
|
28697
|
+
bases = [];
|
|
28698
|
+
for (const rawKey of group) {
|
|
28699
|
+
const { base, type } = parseTypedKey(rawKey);
|
|
28700
|
+
if (type || seen.has(base)) continue;
|
|
28701
|
+
seen.add(base);
|
|
28702
|
+
bases.push(base);
|
|
28703
|
+
}
|
|
28704
|
+
stageBasesByGroup.set(group, bases);
|
|
28705
|
+
}
|
|
28706
|
+
return bases;
|
|
28707
|
+
}
|
|
28708
|
+
function nextStageOrder(stages) {
|
|
28709
|
+
return Math.max(0, ...Object.values(stages).flatMap((list) => list.map((e) => e._order ?? 0))) + 1;
|
|
28710
|
+
}
|
|
28711
|
+
var HOOK_OBSERVER_KEY, FAILED_OUTCOMES, CAP, stageKeysByName, stageBasesByGroup, FlowInstance;
|
|
28660
28712
|
var init_flow_instance = __esm({
|
|
28661
28713
|
"libs/sdk/src/flows/flow.instance.ts"() {
|
|
28662
28714
|
"use strict";
|
|
@@ -28673,9 +28725,8 @@ var init_flow_instance = __esm({
|
|
|
28673
28725
|
HOOK_OBSERVER_KEY = /* @__PURE__ */ Symbol.for("frontmcp:hook-observer");
|
|
28674
28726
|
FAILED_OUTCOMES = /* @__PURE__ */ new Set(["fail", "abort", "unknown_error"]);
|
|
28675
28727
|
CAP = (s) => s ? s[0].toUpperCase() + s.slice(1) : s;
|
|
28676
|
-
|
|
28677
|
-
|
|
28678
|
-
AROUND = (s) => `around${CAP(s)}`;
|
|
28728
|
+
stageKeysByName = /* @__PURE__ */ new Map();
|
|
28729
|
+
stageBasesByGroup = /* @__PURE__ */ new WeakMap();
|
|
28679
28730
|
FlowInstance = class extends FlowEntry {
|
|
28680
28731
|
deps;
|
|
28681
28732
|
globalProviders;
|
|
@@ -28684,6 +28735,7 @@ var init_flow_instance = __esm({
|
|
|
28684
28735
|
stages;
|
|
28685
28736
|
hooks;
|
|
28686
28737
|
logger;
|
|
28738
|
+
baseStageOrderEnd;
|
|
28687
28739
|
constructor(scope, record, deps, globalProviders) {
|
|
28688
28740
|
super(scope, record);
|
|
28689
28741
|
this.deps = [...deps];
|
|
@@ -28889,8 +28941,9 @@ var init_flow_instance = __esm({
|
|
|
28889
28941
|
mergedDeps.set(token, instance);
|
|
28890
28942
|
}
|
|
28891
28943
|
const baseStages = this.stages;
|
|
28892
|
-
|
|
28893
|
-
let
|
|
28944
|
+
let stages = baseStages;
|
|
28945
|
+
let ownsStages = false;
|
|
28946
|
+
let orderBase = this.baseStageOrderEnd ??= nextStageOrder(baseStages);
|
|
28894
28947
|
const hookOwnerId = await FlowClass.resolveHookOwnerId?.(input, scope);
|
|
28895
28948
|
const entryClass = await FlowClass.resolveHookEntryClass?.(input, scope);
|
|
28896
28949
|
const entryStaticHooks = entryClass ? staticHooksFor(this.hooks.getClsHooks(entryClass), name48) : [];
|
|
@@ -28918,6 +28971,10 @@ var init_flow_instance = __esm({
|
|
|
28918
28971
|
}
|
|
28919
28972
|
if (metas.length) {
|
|
28920
28973
|
const start = opts?.orderStart ?? orderBase;
|
|
28974
|
+
if (!ownsStages) {
|
|
28975
|
+
stages = cloneStageMap(baseStages);
|
|
28976
|
+
ownsStages = true;
|
|
28977
|
+
}
|
|
28921
28978
|
mergeHookMetasIntoStageMap(FlowClass, stages, metas, start, runHook);
|
|
28922
28979
|
if (opts?.orderStart === void 0) orderBase += metas.length;
|
|
28923
28980
|
}
|
|
@@ -28928,7 +28985,7 @@ var init_flow_instance = __esm({
|
|
|
28928
28985
|
const context = new FlowClass(this.metadata, input, scope, appendContextHooks, mergedDeps);
|
|
28929
28986
|
contextReady = true;
|
|
28930
28987
|
await materializeAndMerge(initialInjectedHooks, { orderStart: -1e6 });
|
|
28931
|
-
orderBase =
|
|
28988
|
+
if (ownsStages) orderBase = nextStageOrder(stages);
|
|
28932
28989
|
await materializeAndMerge(entryStaticHooks);
|
|
28933
28990
|
let responded;
|
|
28934
28991
|
const toStageResult = (e) => {
|
|
@@ -28942,12 +28999,18 @@ var init_flow_instance = __esm({
|
|
|
28942
28999
|
}
|
|
28943
29000
|
return { outcome: "unknown_error", control: e };
|
|
28944
29001
|
};
|
|
29002
|
+
const hasEntries = (key) => (stages[key]?.length ?? 0) > 0;
|
|
28945
29003
|
const runList = async (key, opts) => {
|
|
28946
|
-
const getList = () => stages[key] ?? [];
|
|
28947
29004
|
const seen = /* @__PURE__ */ new Set();
|
|
28948
29005
|
while (true) {
|
|
28949
|
-
const list =
|
|
28950
|
-
|
|
29006
|
+
const list = stages[key] ?? [];
|
|
29007
|
+
let item;
|
|
29008
|
+
for (const entry of list) {
|
|
29009
|
+
if (!seen.has(entry)) {
|
|
29010
|
+
item = entry;
|
|
29011
|
+
break;
|
|
29012
|
+
}
|
|
29013
|
+
}
|
|
28951
29014
|
if (!item) break;
|
|
28952
29015
|
seen.add(item);
|
|
28953
29016
|
try {
|
|
@@ -28960,7 +29023,7 @@ var init_flow_instance = __esm({
|
|
|
28960
29023
|
return { outcome: "ok" };
|
|
28961
29024
|
};
|
|
28962
29025
|
const runAroundChain = async (stageName, index = 0) => {
|
|
28963
|
-
const around = (stages[
|
|
29026
|
+
const around = (stages[stageKeysOf(stageName).around] ?? [])[index];
|
|
28964
29027
|
if (!around) return runList(stageName, { ignoreRespond: false });
|
|
28965
29028
|
let innerResult = { outcome: "ok" };
|
|
28966
29029
|
const next = async () => {
|
|
@@ -28975,17 +29038,18 @@ var init_flow_instance = __esm({
|
|
|
28975
29038
|
return FAILED_OUTCOMES.has(innerResult.outcome) ? { outcome: "ok" } : innerResult;
|
|
28976
29039
|
};
|
|
28977
29040
|
const runOneStage = async (stageName, stopOnRespond) => {
|
|
28978
|
-
|
|
28979
|
-
|
|
29041
|
+
const keys = stageKeysOf(stageName);
|
|
29042
|
+
if (hasEntries(keys.will)) {
|
|
29043
|
+
const res = await runList(keys.will);
|
|
28980
29044
|
if (res.outcome === "respond" && stopOnRespond) return res;
|
|
28981
29045
|
if (res.outcome !== "ok" && res.outcome !== "respond") return res;
|
|
28982
29046
|
}
|
|
28983
|
-
const bodyOutcome = await runAroundChain(stageName);
|
|
29047
|
+
const bodyOutcome = hasEntries(keys.around) ? await runAroundChain(stageName) : await runList(stageName, { ignoreRespond: false });
|
|
28984
29048
|
if (bodyOutcome.outcome !== "ok" && bodyOutcome.outcome !== "respond") {
|
|
28985
29049
|
return bodyOutcome;
|
|
28986
29050
|
}
|
|
28987
|
-
{
|
|
28988
|
-
const res = await runList(
|
|
29051
|
+
if (hasEntries(keys.did)) {
|
|
29052
|
+
const res = await runList(keys.did, { ignoreRespond: true });
|
|
28989
29053
|
if (res.outcome !== "ok" && res.outcome !== "respond") return res;
|
|
28990
29054
|
}
|
|
28991
29055
|
if (bodyOutcome.outcome === "respond") return bodyOutcome;
|
|
@@ -28993,14 +29057,7 @@ var init_flow_instance = __esm({
|
|
|
28993
29057
|
};
|
|
28994
29058
|
const runStageGroup = async (group, stopOnRespond, opts) => {
|
|
28995
29059
|
if (!group || group.length === 0) return { outcome: "ok" };
|
|
28996
|
-
const
|
|
28997
|
-
for (const rawKey of group) {
|
|
28998
|
-
const { base, type } = parseTypedKey(rawKey);
|
|
28999
|
-
if (type) {
|
|
29000
|
-
continue;
|
|
29001
|
-
}
|
|
29002
|
-
if (seenBase.has(base)) continue;
|
|
29003
|
-
seenBase.add(base);
|
|
29060
|
+
for (const base of stageBasesOf(group)) {
|
|
29004
29061
|
const res = await runOneStage(base, stopOnRespond);
|
|
29005
29062
|
if (res.outcome === "respond") {
|
|
29006
29063
|
if (stopOnRespond) return res;
|
|
@@ -31247,7 +31304,6 @@ var memory_skill_provider_exports = {};
|
|
|
31247
31304
|
__export(memory_skill_provider_exports, {
|
|
31248
31305
|
MemorySkillProvider: () => MemorySkillProvider
|
|
31249
31306
|
});
|
|
31250
|
-
import { TFIDFVectoria } from "vectoriadb";
|
|
31251
31307
|
import { sha256Hex as sha256Hex9 } from "@frontmcp/utils";
|
|
31252
31308
|
function isSnapshotCapable(db) {
|
|
31253
31309
|
const d = db;
|
|
@@ -31257,6 +31313,7 @@ var STOP_WORDS, MemorySkillProvider;
|
|
|
31257
31313
|
var init_memory_skill_provider = __esm({
|
|
31258
31314
|
"libs/sdk/src/skill/providers/memory-skill.provider.ts"() {
|
|
31259
31315
|
"use strict";
|
|
31316
|
+
init_dynamic_import_utils();
|
|
31260
31317
|
STOP_WORDS = /* @__PURE__ */ new Set([
|
|
31261
31318
|
// Articles & Determiners
|
|
31262
31319
|
"the",
|
|
@@ -31333,6 +31390,7 @@ var init_memory_skill_provider = __esm({
|
|
|
31333
31390
|
type = "memory";
|
|
31334
31391
|
/** The search index, created the first time a search needs it. */
|
|
31335
31392
|
vectorDB;
|
|
31393
|
+
vectorDBLoading;
|
|
31336
31394
|
skills = /* @__PURE__ */ new Map();
|
|
31337
31395
|
defaultTopK;
|
|
31338
31396
|
defaultMinScore;
|
|
@@ -31357,7 +31415,11 @@ var init_memory_skill_provider = __esm({
|
|
|
31357
31415
|
this.scoring = options.scoring ?? "cosine";
|
|
31358
31416
|
this.indexCache = options.indexCache;
|
|
31359
31417
|
}
|
|
31360
|
-
createVectorDB() {
|
|
31418
|
+
async createVectorDB() {
|
|
31419
|
+
const { TFIDFVectoria } = await importWithRequireFallback(
|
|
31420
|
+
() => import("vectoriadb"),
|
|
31421
|
+
() => __require("vectoriadb")
|
|
31422
|
+
);
|
|
31361
31423
|
const dbConfig = {
|
|
31362
31424
|
defaultTopK: this.defaultTopK,
|
|
31363
31425
|
defaultSimilarityThreshold: this.defaultMinScore
|
|
@@ -31392,8 +31454,8 @@ var init_memory_skill_provider = __esm({
|
|
|
31392
31454
|
*/
|
|
31393
31455
|
async ensureIndexed() {
|
|
31394
31456
|
if (this.indexReady) return;
|
|
31395
|
-
const db = this.db();
|
|
31396
31457
|
const version = this.skillsVersion;
|
|
31458
|
+
const db = await this.db();
|
|
31397
31459
|
if (this.indexCache && isSnapshotCapable(db)) {
|
|
31398
31460
|
const key = await this.computeIndexKey();
|
|
31399
31461
|
try {
|
|
@@ -31448,9 +31510,16 @@ var init_memory_skill_provider = __esm({
|
|
|
31448
31510
|
const canonical = `frontmcp-skill-index:v1|${this.scoring}|${this.skills.size}|${parts.join("")}`;
|
|
31449
31511
|
return sha256Hex9(canonical);
|
|
31450
31512
|
}
|
|
31451
|
-
db() {
|
|
31452
|
-
this.vectorDB
|
|
31453
|
-
|
|
31513
|
+
async db() {
|
|
31514
|
+
if (this.vectorDB) return this.vectorDB;
|
|
31515
|
+
this.vectorDBLoading ??= this.createVectorDB().then(
|
|
31516
|
+
(db) => this.vectorDB ??= db,
|
|
31517
|
+
(error) => {
|
|
31518
|
+
this.vectorDBLoading = void 0;
|
|
31519
|
+
throw error;
|
|
31520
|
+
}
|
|
31521
|
+
);
|
|
31522
|
+
return this.vectorDBLoading;
|
|
31454
31523
|
}
|
|
31455
31524
|
/**
|
|
31456
31525
|
* Set the tool validator after construction.
|
|
@@ -31496,7 +31565,7 @@ var init_memory_skill_provider = __esm({
|
|
|
31496
31565
|
}
|
|
31497
31566
|
return true;
|
|
31498
31567
|
};
|
|
31499
|
-
const db = this.db();
|
|
31568
|
+
const db = await this.db();
|
|
31500
31569
|
await this.ensureIndexed();
|
|
31501
31570
|
let results = await db.search(query, {
|
|
31502
31571
|
topK,
|
|
@@ -38735,13 +38804,13 @@ var init_skill_http_auth = __esm({
|
|
|
38735
38804
|
}
|
|
38736
38805
|
const token = authHeader.slice(7);
|
|
38737
38806
|
try {
|
|
38738
|
-
const { jwtVerify
|
|
38807
|
+
const { jwtVerify, createRemoteJWKSet } = await importWithRequireFallback(
|
|
38739
38808
|
() => import("jose"),
|
|
38740
38809
|
() => __require("jose")
|
|
38741
38810
|
);
|
|
38742
38811
|
const jwksUrl = jwtConfig.jwksUrl ?? `${jwtConfig.issuer}/.well-known/jwks.json`;
|
|
38743
38812
|
const JWKS = createRemoteJWKSet(new URL(jwksUrl));
|
|
38744
|
-
const { payload } = await
|
|
38813
|
+
const { payload } = await jwtVerify(token, JWKS, {
|
|
38745
38814
|
issuer: jwtConfig.issuer,
|
|
38746
38815
|
audience: jwtConfig.audience,
|
|
38747
38816
|
requiredClaims: ["exp"]
|
|
@@ -42216,7 +42285,9 @@ function tryDecodeTransportType(sessionId) {
|
|
|
42216
42285
|
if (!sessionId) return;
|
|
42217
42286
|
try {
|
|
42218
42287
|
const b64 = sessionId.replace(/-/g, "+").replace(/_/g, "/");
|
|
42219
|
-
const
|
|
42288
|
+
const json = Buffer.from(b64, "base64").toString("utf8");
|
|
42289
|
+
if (json.trimStart()[0] !== "{") return;
|
|
42290
|
+
const obj = JSON.parse(json);
|
|
42220
42291
|
return obj?.transportType;
|
|
42221
42292
|
} catch {
|
|
42222
42293
|
return;
|
|
@@ -66206,7 +66277,6 @@ var init_secure_store = __esm({
|
|
|
66206
66277
|
});
|
|
66207
66278
|
|
|
66208
66279
|
// libs/sdk/src/auth/instances/instance.local-primary-auth.ts
|
|
66209
|
-
import { jwtVerify, SignJWT } from "jose";
|
|
66210
66280
|
import {
|
|
66211
66281
|
createSecureStore,
|
|
66212
66282
|
createTokenStorageAdapter,
|
|
@@ -66236,6 +66306,16 @@ import {
|
|
|
66236
66306
|
randomUUID as randomUUID27,
|
|
66237
66307
|
StorageNotSupportedError
|
|
66238
66308
|
} from "@frontmcp/utils";
|
|
66309
|
+
function loadJose() {
|
|
66310
|
+
jose ??= importWithRequireFallback(
|
|
66311
|
+
() => import("jose"),
|
|
66312
|
+
() => __require("jose")
|
|
66313
|
+
).catch((error) => {
|
|
66314
|
+
jose = void 0;
|
|
66315
|
+
throw error;
|
|
66316
|
+
});
|
|
66317
|
+
return jose;
|
|
66318
|
+
}
|
|
66239
66319
|
function getDefaultNoAuthSecret() {
|
|
66240
66320
|
if (!defaultNoAuthSecret) {
|
|
66241
66321
|
defaultNoAuthSecret = randomBytes10(32);
|
|
@@ -66275,7 +66355,7 @@ function originOf2(value) {
|
|
|
66275
66355
|
return void 0;
|
|
66276
66356
|
}
|
|
66277
66357
|
}
|
|
66278
|
-
var MIN_HS256_SECRET_BYTES, defaultNoAuthSecret, RESERVED_JWT_CLAIMS, LocalPrimaryAuth;
|
|
66358
|
+
var jose, MIN_HS256_SECRET_BYTES, defaultNoAuthSecret, RESERVED_JWT_CLAIMS, LocalPrimaryAuth;
|
|
66279
66359
|
var init_instance_local_primary_auth = __esm({
|
|
66280
66360
|
"libs/sdk/src/auth/instances/instance.local-primary-auth.ts"() {
|
|
66281
66361
|
"use strict";
|
|
@@ -66283,6 +66363,7 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66283
66363
|
init_auth2();
|
|
66284
66364
|
init_context_extension();
|
|
66285
66365
|
init_errors();
|
|
66366
|
+
init_dynamic_import_utils();
|
|
66286
66367
|
init_cimd();
|
|
66287
66368
|
init_credentials();
|
|
66288
66369
|
init_credentials_context_extension();
|
|
@@ -66836,6 +66917,7 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66836
66917
|
* @param options.issuer The issuer to name (`iss`): {@link issuerFor} the request. Default: the boot-time issuer.
|
|
66837
66918
|
*/
|
|
66838
66919
|
async signAnonymousJwt(options = {}) {
|
|
66920
|
+
const { SignJWT } = await loadJose();
|
|
66839
66921
|
const jwt = new SignJWT({ sub: `anon:${randomUUID27()}`, anonymous: true, scope: this.anonymousScopes().join(" ") }).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt().setIssuer(options.issuer ?? this.issuer).setExpirationTime(`${this.anonymousTokenTtlSeconds()}s`).setJti(randomUUID27());
|
|
66840
66922
|
if (options.audience) jwt.setAudience(options.audience);
|
|
66841
66923
|
return jwt.sign(this.secret);
|
|
@@ -66871,6 +66953,7 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66871
66953
|
*/
|
|
66872
66954
|
async verifyGatewayToken(token, requestBaseUrl, expectedAudience, expectedIssuer) {
|
|
66873
66955
|
try {
|
|
66956
|
+
const { jwtVerify } = await loadJose();
|
|
66874
66957
|
const { payload, protectedHeader } = await jwtVerify(token, this.secret, {
|
|
66875
66958
|
algorithms: ["HS256"],
|
|
66876
66959
|
issuer: typeof expectedIssuer === "string" ? expectedIssuer : expectedIssuer ? [...expectedIssuer] : this.issuer,
|
|
@@ -66930,6 +67013,7 @@ var init_instance_local_primary_auth = __esm({
|
|
|
66930
67013
|
}
|
|
66931
67014
|
}
|
|
66932
67015
|
}
|
|
67016
|
+
const { SignJWT } = await loadJose();
|
|
66933
67017
|
const jwt = new SignJWT(claims).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt().setIssuer(issuer ?? this.issuer).setExpirationTime(`${this.accessTokenTtlSeconds}s`).setJti(randomUUID27());
|
|
66934
67018
|
if (audience) {
|
|
66935
67019
|
jwt.setAudience(audience);
|
package/flows/flow.instance.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare class FlowInstance<Name extends FlowName> extends FlowEntry<Name>
|
|
|
9
9
|
private stages;
|
|
10
10
|
private hooks;
|
|
11
11
|
private readonly logger;
|
|
12
|
+
private baseStageOrderEnd?;
|
|
12
13
|
constructor(scope: ScopeEntry, record: FlowRecord, deps: Set<Reference>, globalProviders: ProviderRegistry);
|
|
13
14
|
protected initialize(): Promise<void>;
|
|
14
15
|
canActivate(request: ServerRequest): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow.instance.d.ts","sourceRoot":"","sources":["../../src/flows/flow.instance.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAEL,SAAS,EAIT,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,YAAY,EAEjB,KAAK,UAAU,EAOf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,IAAI,EACV,MAAM,WAAW,CAAC;AAOnB,OAAO,KAAK,gBAAgB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"flow.instance.d.ts","sourceRoot":"","sources":["../../src/flows/flow.instance.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAEL,SAAS,EAIT,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,YAAY,EAEjB,KAAK,UAAU,EAOf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,IAAI,EACV,MAAM,WAAW,CAAC;AAOnB,OAAO,KAAK,gBAAgB,MAAM,+BAA+B,CAAC;AAsFlE,qBAAa,YAAY,CAAC,IAAI,SAAS,QAAQ,CAAE,SAAQ,SAAS,CAAC,IAAI,CAAC;IACtE,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAkB;IAC9B,OAAO,CAAC,SAAS,CAAW;IAC5B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,iBAAiB,CAAC,CAAS;gBAEvB,KAAK,EAAE,UAAU,EAAE,MAAM,EA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