@frontmcp/sdk 1.12.3 → 1.13.0-rc.2
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/agent/agent.instance.d.ts +2 -0
- package/agent/agent.instance.d.ts.map +1 -1
- package/app/instances/app.lazy.instance.d.ts.map +1 -1
- package/auth/flows/auth.verify.flow.d.ts.map +1 -1
- package/auth/flows/session.verify.flow.d.ts.map +1 -1
- package/auth/instances/instance.remote-primary-auth.d.ts +2 -1
- package/auth/instances/instance.remote-primary-auth.d.ts.map +1 -1
- package/auth/transparent-audience.d.ts +21 -0
- package/auth/transparent-audience.d.ts.map +1 -0
- package/browser/agent/agent.instance.mjs +9 -1
- package/browser/app/instances/app.lazy.instance.mjs +1 -0
- package/browser/auth/flows/session.verify.flow.mjs +10 -4
- package/browser/auth/instances/instance.remote-primary-auth.mjs +13 -5
- package/browser/auth/transparent-audience.mjs +52 -0
- package/browser/common/interfaces/tool.interface.mjs +4 -0
- package/browser/common/metadata/app.metadata.mjs +2 -0
- package/browser/common/metadata/front-mcp.metadata.mjs +4 -0
- package/browser/common/metadata/input-policy.mjs +12 -0
- package/browser/common/metadata/output-policy.mjs +1 -0
- package/browser/common/metadata/tool.metadata.mjs +3 -1
- package/browser/common/tokens/app.tokens.mjs +1 -0
- package/browser/common/tokens/front-mcp.tokens.mjs +1 -0
- package/browser/common/tokens/tool.tokens.mjs +2 -1
- package/browser/context/frontmcp-context.mjs +2 -2
- package/browser/elicitation/questions/ask-question.mjs +1 -2
- package/browser/elicitation/questions/question.store.mjs +22 -8
- package/browser/elicitation/send-elicitation-result.tool.mjs +11 -6
- package/browser/index.cjs +5022 -4157
- package/browser/notification/notification.service.mjs +1 -0
- package/browser/remote-mcp/factories/record-builders.mjs +2 -0
- package/browser/resource/flows/read-resource.flow.mjs +33 -10
- package/browser/scope/scope.instance.mjs +3 -1
- package/browser/server/security/resolve-allowed-hosts.mjs +3 -2
- package/browser/task/store/storage-task.store.mjs +69 -20
- package/browser/task/store/task-session-index.mjs +300 -0
- package/browser/task/store/task-store.factory.mjs +4 -1
- package/browser/tool/flows/call-tool.flow.mjs +103 -21
- package/browser/tool/flows/tools-list.flow.mjs +49 -8
- package/browser/tool/tool-output-policy.mjs +14 -3
- package/browser/tool/tool.instance.mjs +9 -2
- package/browser/tool/tool.utils.mjs +90 -3
- package/browser/tool/ui/app-only-tools.mjs +17 -0
- package/browser/tool/undeclared-arguments-message.mjs +61 -0
- package/browser/tool/undeclared-arguments.mjs +35 -0
- package/browser/transport/adapters/transport.streamable-http.adapter.mjs +5 -0
- package/browser/transport/flows/handle.mcp-20260728.flow.mjs +12 -16
- package/common/entries/tool.entry.d.ts +12 -1
- package/common/entries/tool.entry.d.ts.map +1 -1
- package/common/interfaces/tool.interface.d.ts +17 -0
- package/common/interfaces/tool.interface.d.ts.map +1 -1
- package/common/metadata/app.metadata.d.ts +19 -0
- package/common/metadata/app.metadata.d.ts.map +1 -1
- package/common/metadata/front-mcp.metadata.d.ts +161 -9
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/metadata/index.d.ts +1 -0
- package/common/metadata/index.d.ts.map +1 -1
- package/common/metadata/input-policy.d.ts +22 -0
- package/common/metadata/input-policy.d.ts.map +1 -0
- package/common/metadata/output-policy.d.ts +21 -3
- package/common/metadata/output-policy.d.ts.map +1 -1
- package/common/metadata/tool.metadata.d.ts +20 -1
- package/common/metadata/tool.metadata.d.ts.map +1 -1
- package/common/records/app.record.d.ts +2 -1
- package/common/records/app.record.d.ts.map +1 -1
- package/common/tokens/app.tokens.d.ts.map +1 -1
- package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
- package/common/tokens/tool.tokens.d.ts +1 -0
- package/common/tokens/tool.tokens.d.ts.map +1 -1
- package/elicitation/elicitation.types.d.ts +2 -0
- package/elicitation/elicitation.types.d.ts.map +1 -1
- package/elicitation/questions/ask-question.d.ts.map +1 -1
- package/elicitation/questions/question.store.d.ts +5 -0
- package/elicitation/questions/question.store.d.ts.map +1 -1
- package/esm/index.mjs +31 -31
- package/index.d.ts +15 -15
- package/index.js +40 -40
- package/notification/notification.service.d.ts.map +1 -1
- package/package.json +10 -10
- package/remote-mcp/factories/record-builders.d.ts.map +1 -1
- package/resource/flows/read-resource.flow.d.ts +13 -1
- package/resource/flows/read-resource.flow.d.ts.map +1 -1
- package/scope/scope.instance.d.ts.map +1 -1
- package/server/security/resolve-allowed-hosts.d.ts +4 -2
- package/server/security/resolve-allowed-hosts.d.ts.map +1 -1
- package/task/store/storage-task.store.d.ts +19 -2
- package/task/store/storage-task.store.d.ts.map +1 -1
- package/task/store/task-session-index.d.ts +100 -0
- package/task/store/task-session-index.d.ts.map +1 -0
- package/task/store/task-store.factory.d.ts +5 -0
- package/task/store/task-store.factory.d.ts.map +1 -1
- package/task/task.types.d.ts +6 -0
- package/task/task.types.d.ts.map +1 -1
- package/tool/flows/call-tool.flow.d.ts +13 -1
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tools-list.flow.d.ts +8 -1
- package/tool/flows/tools-list.flow.d.ts.map +1 -1
- package/tool/tool-output-policy.d.ts +6 -1
- package/tool/tool-output-policy.d.ts.map +1 -1
- package/tool/tool.instance.d.ts +2 -0
- package/tool/tool.instance.d.ts.map +1 -1
- package/tool/tool.utils.d.ts +12 -0
- package/tool/tool.utils.d.ts.map +1 -1
- package/tool/ui/app-only-tools.d.ts +9 -0
- package/tool/ui/app-only-tools.d.ts.map +1 -0
- package/tool/undeclared-arguments-message.d.ts +13 -0
- package/tool/undeclared-arguments-message.d.ts.map +1 -0
- package/tool/undeclared-arguments.d.ts +7 -0
- package/tool/undeclared-arguments.d.ts.map +1 -0
- package/transport/adapters/transport.streamable-http.adapter.d.ts +2 -0
- package/transport/adapters/transport.streamable-http.adapter.d.ts.map +1 -1
- package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -1
|
@@ -274,6 +274,8 @@ export declare class AgentInstance<InSchema extends ToolInputType = ToolInputTyp
|
|
|
274
274
|
private extractToolResult;
|
|
275
275
|
parseInput(input: CallToolRequest['params']): AgentCallArgs;
|
|
276
276
|
parseOutput(raw: Out | Partial<Out> | unknown): ParsedAgentResult;
|
|
277
|
+
/** How a `CallToolResult` the agent returns is checked against its `outputSchema`: its app's policy, else the server's. */
|
|
278
|
+
private structuredContentValidation;
|
|
277
279
|
safeParseOutput(raw: Out | Partial<Out> | unknown): SafeTransformResult<ParsedAgentResult>;
|
|
278
280
|
/**
|
|
279
281
|
* Get the MCP Tool definition for this agent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.instance.d.ts","sourceRoot":"","sources":["../../src/agent/agent.instance.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,eAAe,EAAyC,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG5G,OAAO,EACL,YAAY,EACZ,UAAU,EAEV,KAAK,aAAa,EAClB,KAAK,cAAc,EAGnB,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"agent.instance.d.ts","sourceRoot":"","sources":["../../src/agent/agent.instance.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,eAAe,EAAyC,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG5G,OAAO,EACL,YAAY,EACZ,UAAU,EAEV,KAAK,aAAa,EAClB,KAAK,cAAc,EAGnB,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EAElB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAGf,KAAK,SAAS,EACd,KAAK,aAAa,EAElB,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AAiBnB,OAAO,KAAK,YAAY,MAAM,wBAAwB,CAA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,CAAC,aAAa;IAIrB,OAAO,CAAC,eAAe;IAmBvB,+GAA+G;IAC/G,OAAO,CAAC,iBAAiB;IAczB,2GAA2G;YAC7F,OAAO;IASrB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAanB,mGAAmG;IACnG,OAAO,CAAC,SAAS;IA0BjB,OAAO,CAAC,UAAU;IAKlB,wHAAwH;YAC1G,QAAQ;IAmBtB,OAAO,CAAC,eAAe;IA6BvB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,iBAAiB;IAazB,IAAI,SAAS,IAAI,gBAAgB,CAEhC;IAED,IAAI,QAAQ,IAAI,wBAAwB,CAEvC;IAED,IAAI,OAAO,IAAI,uBAAuB,CAErC;IAED,IAAI,KAAK,IAAI,YAAY,CAExB;IAED,IAAI,SAAS,IAAI,gBAAgB,CAEhC;IAED,IAAI,OAAO,IAAI,cAAc,CAE5B;IAED,IAAI,MAAM,IAAI,sBAAsB,CAEnC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.verify.flow.d.ts","sourceRoot":"","sources":["../../../src/auth/flows/auth.verify.flow.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,QAAQ,EAQR,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,kBAAkB,CAAC;AAI1B,OAAO,
|
|
1
|
+
{"version":3,"file":"auth.verify.flow.d.ts","sourceRoot":"","sources":["../../../src/auth/flows/auth.verify.flow.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,QAAQ,EAQR,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,kBAAkB,CAAC;AAI1B,OAAO,EAiBL,KAAK,aAAa,EAMnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAMpD,QAAA,MAAM,WAAW;;gCAAyB,CAAC;AAG3C,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;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C;IACb,UAAU,WAAW;QACnB,gBAAgB,EAAE,cAAc,CAC9B,iBAAiB,EACjB,OAAO,IAAI,EACX,OAAO,WAAW,EAClB,OAAO,yBAAyB,EAChC,OAAO,WAAW,CACnB,CAAC;KACH;CACF;AAED,QAAA,MAAM,IAAI,EAAG,gBAAyB,CAAC;AA8EvC,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,QAAQ,CAAC,OAAO,IAAI,CAAC;IAClE,MAAM,wCAA+C;IAErD,OAAO,CAAC,OAAO;IAMf;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAsHxB,UAAU;IAsDhB;;;;;;;;;;;OAWG;IAOG,iBAAiB;IA8CvB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAgB5B;;;;;;;OAOG;IAEG,gBAAgB;IAwCtB;;;OAGG;IAUG,uBAAuB;IA4BvB,+BAA+B;IAQrC;;;;;;;OAOG;IAEG,WAAW;IAiKjB;;;;OAIG;IAEG,UAAU;IAgBhB;;;;;OAKG;IAEG,kBAAkB;IAclB,qBAAqB;CAsB5B"}
|
|
@@ -11,8 +11,9 @@ export declare class RemotePrimaryAuth extends FrontMcpAuth<TransparentAuthOptio
|
|
|
11
11
|
validate(request: ServerRequest): Promise<void>;
|
|
12
12
|
get issuer(): string;
|
|
13
13
|
protected initialize(): Promise<void>;
|
|
14
|
-
/** Warn once at startup when nothing configures the token audience
|
|
14
|
+
/** Warn once at startup when nothing configures the token audience: say what this server accepts, and what to set. */
|
|
15
15
|
private warnWithoutConfiguredAudience;
|
|
16
|
+
private unconfiguredAudienceBehaviour;
|
|
16
17
|
private registerAuthFlows;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=instance.remote-primary-auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.remote-primary-auth.d.ts","sourceRoot":"","sources":["../../../src/auth/instances/instance.remote-primary-auth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAoC,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACnH,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,gBAAgB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"instance.remote-primary-auth.d.ts","sourceRoot":"","sources":["../../../src/auth/instances/instance.remote-primary-auth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAoC,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACnH,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,gBAAgB,MAAM,kCAAkC,CAAC;AAOrE,qBAAa,iBAAkB,SAAQ,YAAY,CAAC,sBAAsB,CAAC;IAKvE,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IALnB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,CAAC,IAAI,CAAqB;gBAGd,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,gBAAgB,EAC5C,OAAO,EAAE,sBAAsB;IAMxB,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAItE,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,IAAI,MAAM,IAAI,MAAM,CAEnB;cAEe,UAAU;IAiB1B,sHAAsH;IACtH,OAAO,CAAC,6BAA6B;IAWrC,OAAO,CAAC,6BAA6B;YAUvB,iBAAiB;CAQhC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The audience a transparent-mode token must name, from the server's configuration only (#1393).
|
|
3
|
+
*/
|
|
4
|
+
import { type ScopeEntry } from '../common';
|
|
5
|
+
/** The audience settings of transparent auth. */
|
|
6
|
+
export interface TransparentAudienceOptions {
|
|
7
|
+
expectedAudience?: string | string[];
|
|
8
|
+
audienceFromRequestHost?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** The hosts DNS-rebinding protection checks the request host against: none while it is off. */
|
|
11
|
+
export declare function checkedAllowedHosts(scope: ScopeEntry): string[] | undefined;
|
|
12
|
+
/** Whether a server with no configured audience accepts its loopback address: only in development and tests. */
|
|
13
|
+
export declare function acceptsLoopbackAudience(): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The audiences a transparent-mode token must name: `expectedAudience`; else the server's address, from the pinned
|
|
16
|
+
* `FRONTMCP_PUBLIC_URL`, a request host listed in the allowed hosts, or, with `audienceFromRequestHost`, any request
|
|
17
|
+
* host; else, in development and tests, its loopback address on `http.port`. None otherwise, which refuses every
|
|
18
|
+
* token that names an audience.
|
|
19
|
+
*/
|
|
20
|
+
export declare function transparentTokenAudiences(options: TransparentAudienceOptions, requestBaseUrl: string, scope: ScopeEntry): string[];
|
|
21
|
+
//# sourceMappingURL=transparent-audience.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transparent-audience.d.ts","sourceRoot":"","sources":["../../src/auth/transparent-audience.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAA4D,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAItG,iDAAiD;AACjD,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACrC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,gGAAgG;AAChG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE,GAAG,SAAS,CAG3E;AAED,gHAAgH;AAChH,wBAAgB,uBAAuB,IAAI,OAAO,CAQjD;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,EACnC,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,UAAU,GAChB,MAAM,EAAE,CAcV"}
|
|
@@ -27,6 +27,7 @@ import { normalizeHooksFromCls } from "../hooks/hooks.utils.mjs";
|
|
|
27
27
|
import { normalizePrompt } from "../prompt/prompt.utils.mjs";
|
|
28
28
|
import { normalizeProvider } from "../provider/provider.utils.mjs";
|
|
29
29
|
import { isResourceTemplate, normalizeResource, normalizeResourceTemplate } from "../resource/resource.utils.mjs";
|
|
30
|
+
import { resolveStructuredContentValidation } from "../tool/tool-output-policy.mjs";
|
|
30
31
|
import { ToolInstance } from "../tool/tool.instance.mjs";
|
|
31
32
|
import { buildAgentToolDefinition, buildParsedToolResult, normalizeTool } from "../tool/tool.utils.mjs";
|
|
32
33
|
import { errorBehindFlowControl } from "../transport/mcp-handlers/mcp-error.utils.mjs";
|
|
@@ -795,7 +796,14 @@ var AgentInstance = class extends AgentEntry {
|
|
|
795
796
|
}
|
|
796
797
|
parseOutput(raw) {
|
|
797
798
|
const descriptor = this.outputSchema;
|
|
798
|
-
return buildParsedToolResult(descriptor, raw);
|
|
799
|
+
return buildParsedToolResult(descriptor, raw, { validateStructuredContent: this.structuredContentValidation() });
|
|
800
|
+
}
|
|
801
|
+
/** How a `CallToolResult` the agent returns is checked against its `outputSchema`: its app's policy, else the server's. */
|
|
802
|
+
structuredContentValidation() {
|
|
803
|
+
const { owner, scope } = this;
|
|
804
|
+
const app = owner.kind === "app" ? scope.apps.getApps().find((candidate) => candidate.id === owner.id) : void 0;
|
|
805
|
+
const appOutput = app?.metadata?.output;
|
|
806
|
+
return resolveStructuredContentValidation(void 0, appOutput, scope.metadata.output);
|
|
799
807
|
}
|
|
800
808
|
safeParseOutput(raw) {
|
|
801
809
|
try {
|
|
@@ -215,6 +215,7 @@ var AppLazyInstance = class extends AppEntry {
|
|
|
215
215
|
const listedOutput = this.metadata.output;
|
|
216
216
|
this.metadata.description ??= imported.description;
|
|
217
217
|
this.metadata.output = imported.output;
|
|
218
|
+
this.metadata.input = imported.input;
|
|
218
219
|
const changed = this.listed ? changedLists(recordedListsOf(this.listed), recorded, { listed: listedOutput, loaded: imported.output }) : [];
|
|
219
220
|
keepingListsUnchanged(() => {
|
|
220
221
|
this.appTools.replaceAll([], this.appOwner);
|
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
buildInsufficientScopeHeader,
|
|
34
34
|
buildInvalidTokenHeader,
|
|
35
35
|
buildUnauthorizedHeader,
|
|
36
|
-
deriveExpectedAudience,
|
|
37
36
|
deriveTypedUser,
|
|
38
37
|
encryptJson,
|
|
39
38
|
extractBearerToken,
|
|
@@ -48,6 +47,7 @@ import { getMachineId, randomUUID, sha256, sha256Hex, timingSafeEqual } from "@f
|
|
|
48
47
|
import { detectPlatformFromUserAgent } from "../../notification/notification.service.mjs";
|
|
49
48
|
import { detectSkillsOnlyMode } from "../../skill/skill-mode.utils.mjs";
|
|
50
49
|
import { decryptPublicSession, parseSessionHeader } from "../session/utils/session-id.utils.mjs";
|
|
50
|
+
import { transparentTokenAudiences } from "../transparent-audience.mjs";
|
|
51
51
|
var inputSchema = httpRequestInputSchema.extend({
|
|
52
52
|
/**
|
|
53
53
|
* The request is served without a session (MCP 2026-07-28): an anonymous or static-key caller is
|
|
@@ -370,8 +370,11 @@ var SessionVerifyFlow = class extends FlowBase {
|
|
|
370
370
|
this.state.set("principalIssuer", tokenIssuer);
|
|
371
371
|
}
|
|
372
372
|
if (isTransparentMode(authOptions)) {
|
|
373
|
-
const
|
|
374
|
-
|
|
373
|
+
const expectedAudiences = transparentTokenAudiences(
|
|
374
|
+
authOptions,
|
|
375
|
+
this.state.required.baseUrl,
|
|
376
|
+
this.scope
|
|
377
|
+
);
|
|
375
378
|
const audResult = validateAudience(result.payload?.["aud"], {
|
|
376
379
|
expectedAudiences,
|
|
377
380
|
// By default accept tokens with no `aud` claim: many IdPs omit it, and
|
|
@@ -383,7 +386,10 @@ var SessionVerifyFlow = class extends FlowBase {
|
|
|
383
386
|
allowNoAudience: authOptions.requireAudience !== true
|
|
384
387
|
});
|
|
385
388
|
if (!audResult.valid) {
|
|
386
|
-
this.logger.warn(
|
|
389
|
+
this.logger.warn(
|
|
390
|
+
expectedAudiences.length > 0 ? "verifyIfJwt: audience validation failed" : "verifyIfJwt: no token audience is configured, so a token with an aud claim is refused: set auth.expectedAudience (or FRONTMCP_PUBLIC_URL, or allowed hosts), or auth.audienceFromRequestHost: true while migrating",
|
|
391
|
+
{ error: audResult.error }
|
|
392
|
+
);
|
|
387
393
|
this.respond({
|
|
388
394
|
kind: "unauthorized",
|
|
389
395
|
prmMetadataHeader: buildInvalidTokenHeader(
|
|
@@ -5,6 +5,7 @@ import SessionVerifyFlow from "../flows/session.verify.flow.mjs";
|
|
|
5
5
|
import WellKnownJwksFlow from "../flows/well-known.jwks.flow.mjs";
|
|
6
6
|
import WellKnownAsFlow from "../flows/well-known.oauth-authorization-server.flow.mjs";
|
|
7
7
|
import WellKnownPrmFlow from "../flows/well-known.prm.flow.mjs";
|
|
8
|
+
import { acceptsLoopbackAudience, checkedAllowedHosts } from "../transparent-audience.mjs";
|
|
8
9
|
var RemotePrimaryAuth = class extends FrontMcpAuth {
|
|
9
10
|
constructor(scope, providers, options) {
|
|
10
11
|
super(options);
|
|
@@ -39,17 +40,24 @@ var RemotePrimaryAuth = class extends FrontMcpAuth {
|
|
|
39
40
|
this.warnWithoutConfiguredAudience(scope);
|
|
40
41
|
return Promise.resolve();
|
|
41
42
|
}
|
|
42
|
-
/** Warn once at startup when nothing configures the token audience
|
|
43
|
+
/** Warn once at startup when nothing configures the token audience: say what this server accepts, and what to set. */
|
|
43
44
|
warnWithoutConfiguredAudience(scope) {
|
|
44
|
-
|
|
45
|
-
const checkedHosts = protection?.enabled === false ? void 0 : protection?.allowedHosts;
|
|
46
|
-
if (this.options.expectedAudience || isPublicUrlPinned() || checkedHosts?.length) {
|
|
45
|
+
if (this.options.expectedAudience || isPublicUrlPinned() || checkedAllowedHosts(scope)?.length) {
|
|
47
46
|
return;
|
|
48
47
|
}
|
|
49
48
|
scope.logger.warn(
|
|
50
|
-
|
|
49
|
+
`Transparent auth has no configured token audience, so ${this.unconfiguredAudienceBehaviour()}. Set auth.expectedAudience to the audience your identity provider puts in tokens (or set FRONTMCP_PUBLIC_URL, or list the server host in security.dnsRebindingProtection.allowedHosts or FRONTMCP_ALLOWED_HOSTS).`
|
|
51
50
|
);
|
|
52
51
|
}
|
|
52
|
+
unconfiguredAudienceBehaviour() {
|
|
53
|
+
if (this.options.audienceFromRequestHost) {
|
|
54
|
+
return "each token is checked against the host the request names, which the client chooses (audienceFromRequestHost)";
|
|
55
|
+
}
|
|
56
|
+
if (acceptsLoopbackAudience()) {
|
|
57
|
+
return "tokens that carry an aud claim are accepted only for this server's loopback address (NODE_ENV is development or test)";
|
|
58
|
+
}
|
|
59
|
+
return "tokens that carry an aud claim are refused (NODE_ENV is not development or test)";
|
|
60
|
+
}
|
|
53
61
|
async registerAuthFlows(scope) {
|
|
54
62
|
await scope.registryFlows(
|
|
55
63
|
WellKnownPrmFlow,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// libs/sdk/src/auth/transparent-audience.ts
|
|
2
|
+
import { deriveExpectedAudience } from "@frontmcp/auth";
|
|
3
|
+
import { getNodeEnv } from "@frontmcp/utils";
|
|
4
|
+
import { defaultHttpPort, isPublicUrlPinned, normalizeEntryPrefix } from "../common/index.mjs";
|
|
5
|
+
import { normalizeHost } from "../server/security/host-validation.mjs";
|
|
6
|
+
import { allowedHostsFromEnv, LOOPBACK_NAMES } from "../server/security/resolve-allowed-hosts.mjs";
|
|
7
|
+
function checkedAllowedHosts(scope) {
|
|
8
|
+
const protection = scope.metadata.http?.security?.dnsRebindingProtection;
|
|
9
|
+
return protection?.enabled === false ? void 0 : protection?.allowedHosts ?? allowedHostsFromEnv();
|
|
10
|
+
}
|
|
11
|
+
function acceptsLoopbackAudience() {
|
|
12
|
+
let nodeEnv;
|
|
13
|
+
try {
|
|
14
|
+
nodeEnv = getNodeEnv();
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return nodeEnv === "development" || nodeEnv === "test";
|
|
19
|
+
}
|
|
20
|
+
function transparentTokenAudiences(options, requestBaseUrl, scope) {
|
|
21
|
+
const configured = options.expectedAudience;
|
|
22
|
+
if (configured) {
|
|
23
|
+
return Array.isArray(configured) ? configured : [configured];
|
|
24
|
+
}
|
|
25
|
+
if (isPublicUrlPinned() || options.audienceFromRequestHost || isAllowedHost(requestBaseUrl, scope)) {
|
|
26
|
+
return deriveExpectedAudience(requestBaseUrl);
|
|
27
|
+
}
|
|
28
|
+
if (!acceptsLoopbackAudience()) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
const port = scope.metadata.http?.port ?? defaultHttpPort();
|
|
32
|
+
const entryPath = normalizeEntryPrefix(scope.entryPath);
|
|
33
|
+
return LOOPBACK_NAMES.flatMap((host) => deriveExpectedAudience(`http://${host}:${port}${entryPath}`));
|
|
34
|
+
}
|
|
35
|
+
function isAllowedHost(requestBaseUrl, scope) {
|
|
36
|
+
const allowedHosts = checkedAllowedHosts(scope);
|
|
37
|
+
if (!allowedHosts?.length) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
let requestHost;
|
|
41
|
+
try {
|
|
42
|
+
requestHost = normalizeHost(new URL(requestBaseUrl).host);
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return allowedHosts.some((allowedHost) => normalizeHost(allowedHost) === requestHost);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
acceptsLoopbackAudience,
|
|
50
|
+
checkedAllowedHosts,
|
|
51
|
+
transparentTokenAudiences
|
|
52
|
+
};
|
|
@@ -212,6 +212,10 @@ var ToolContext = class extends ExecutionContextBase {
|
|
|
212
212
|
notifyResourceListChanged() {
|
|
213
213
|
this.scope.notifications.broadcastNotification("notifications/resources/list_changed");
|
|
214
214
|
}
|
|
215
|
+
/** Adds `count` records this call changed for the in-process dispatcher that counts them (CodeCall's budgets). */
|
|
216
|
+
reportRecordsChanged(count) {
|
|
217
|
+
this._onRecordsChangedInternal?.(count);
|
|
218
|
+
}
|
|
215
219
|
// ============================================
|
|
216
220
|
// Elicitation API
|
|
217
221
|
// ============================================
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "../schemas/index.mjs";
|
|
20
20
|
import { appFilterConfigSchema } from "./app-filter.metadata.mjs";
|
|
21
21
|
import { enabledOptionSchema } from "./enabled.metadata.mjs";
|
|
22
|
+
import { inputPolicySchema } from "./input-policy.mjs";
|
|
22
23
|
import { outputPolicySchema } from "./output-policy.mjs";
|
|
23
24
|
import { widgetServingModeSchema } from "./ui-serving-mode.mjs";
|
|
24
25
|
var frontMcpLocalAppMetadataSchema = z.looseObject({
|
|
@@ -45,6 +46,7 @@ var frontMcpLocalAppMetadataSchema = z.looseObject({
|
|
|
45
46
|
).optional(),
|
|
46
47
|
auth: authOptionsSchema.optional(),
|
|
47
48
|
output: outputPolicySchema.optional(),
|
|
49
|
+
input: inputPolicySchema.optional(),
|
|
48
50
|
ui: z.object({ servingMode: widgetServingModeSchema.optional() }).optional(),
|
|
49
51
|
standalone: z.union([z.literal("includeInParent"), z.boolean()]).optional().default(false)
|
|
50
52
|
});
|
|
@@ -40,6 +40,7 @@ import { legacySessionOptionsSchema } from "../types/options/session/schema.mjs"
|
|
|
40
40
|
import { packageLoaderSchema } from "./app.metadata.mjs";
|
|
41
41
|
import { channelsConfigSchema } from "./channel.metadata.mjs";
|
|
42
42
|
import { eventsConfigSchema } from "./event.metadata.mjs";
|
|
43
|
+
import { inputPolicySchema } from "./input-policy.mjs";
|
|
43
44
|
import { MAX_JOB_TIMER_MS, timerLimitMessage } from "./job.metadata.mjs";
|
|
44
45
|
import { outputPolicySchema } from "./output-policy.mjs";
|
|
45
46
|
import { widgetServingModeSchema } from "./ui-serving-mode.mjs";
|
|
@@ -98,6 +99,7 @@ var frontMcpBaseSchema = z.object({
|
|
|
98
99
|
* numeric output throws `InvalidOutputError`.
|
|
99
100
|
*/
|
|
100
101
|
output: outputPolicySchema.optional(),
|
|
102
|
+
input: inputPolicySchema.optional(),
|
|
101
103
|
clients: clientProfilesOptionsSchema.optional(),
|
|
102
104
|
jobs: z.object({
|
|
103
105
|
enabled: z.boolean(),
|
|
@@ -156,6 +158,7 @@ var frontMcpBaseSchema = z.object({
|
|
|
156
158
|
maxTtlMs: z.number().int().positive().optional(),
|
|
157
159
|
defaultPollIntervalMs: z.number().int().positive().optional(),
|
|
158
160
|
maxConcurrentPerSession: z.number().int().positive().max(MAX_CONCURRENT_TASKS_PER_SESSION).optional(),
|
|
161
|
+
listFrom: z.enum(["scan", "index"]).optional(),
|
|
159
162
|
strict: z.boolean().optional(),
|
|
160
163
|
runner: z.enum(["in-process", "cli"]).optional(),
|
|
161
164
|
sqlite: z.object({
|
|
@@ -284,6 +287,7 @@ var frontMcpLiteSchema = z.object({
|
|
|
284
287
|
// Output-validation policy (see `frontMcpBaseSchema.output`). CLI mode
|
|
285
288
|
// honors the same `allowNonFinite` switch as the full server.
|
|
286
289
|
output: outputPolicySchema.optional(),
|
|
290
|
+
input: inputPolicySchema.optional(),
|
|
287
291
|
session: checkedAsServer("session"),
|
|
288
292
|
clients: checkedAsServer("clients"),
|
|
289
293
|
observability: checkedAsServer("observability"),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// libs/sdk/src/common/metadata/input-policy.ts
|
|
2
|
+
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
3
|
+
var inputPolicySchema = z.object({
|
|
4
|
+
undeclaredKeys: z.enum(["strip", "warn", "fail"]).optional()
|
|
5
|
+
});
|
|
6
|
+
function resolveInputUndeclaredKeysPolicy(tool, app, server) {
|
|
7
|
+
return tool?.undeclaredKeys ?? app?.undeclaredKeys ?? server?.undeclaredKeys ?? "warn";
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
inputPolicySchema,
|
|
11
|
+
resolveInputUndeclaredKeysPolicy
|
|
12
|
+
};
|
|
@@ -13,6 +13,7 @@ var outputPolicySchema = z.object({
|
|
|
13
13
|
schemaMode: z.enum(OUTPUT_SCHEMA_MODES).optional(),
|
|
14
14
|
schemaDescriptionFormat: z.enum(SCHEMA_DESCRIPTION_FORMATS).optional(),
|
|
15
15
|
undeclaredKeys: z.enum(UNDECLARED_KEYS_POLICIES).optional(),
|
|
16
|
+
validateStructuredContent: z.enum(["warn", "enforce"]).optional(),
|
|
16
17
|
budget: z.union([
|
|
17
18
|
z.literal(false),
|
|
18
19
|
z.object({
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from "@frontmcp/protocol";
|
|
15
15
|
import { entryAvailabilitySchema } from "@frontmcp/utils";
|
|
16
16
|
import { enabledOptionSchema } from "./enabled.metadata.mjs";
|
|
17
|
+
import { inputPolicySchema } from "./input-policy.mjs";
|
|
17
18
|
import { outputPolicySchema } from "./output-policy.mjs";
|
|
18
19
|
var toolAuthProviderMappingSchema = z.union([
|
|
19
20
|
z.string().min(1),
|
|
@@ -100,7 +101,8 @@ var frontMcpToolMetadataSchema = z.object({
|
|
|
100
101
|
execution: z.object({
|
|
101
102
|
taskSupport: z.enum(["required", "optional", "forbidden"]).optional()
|
|
102
103
|
}).optional(),
|
|
103
|
-
output: outputPolicySchema.optional()
|
|
104
|
+
output: outputPolicySchema.optional(),
|
|
105
|
+
input: inputPolicySchema.optional()
|
|
104
106
|
}).passthrough();
|
|
105
107
|
export {
|
|
106
108
|
AudioOutputSchema,
|
|
@@ -21,6 +21,7 @@ var FrontMcpLocalAppTokens = {
|
|
|
21
21
|
events: tokenFactory.meta("events"),
|
|
22
22
|
routes: tokenFactory.meta("routes"),
|
|
23
23
|
output: tokenFactory.meta("output"),
|
|
24
|
+
input: tokenFactory.meta("input"),
|
|
24
25
|
// tool UI defaults (`ui.servingMode`) for the app's tools (#720)
|
|
25
26
|
ui: tokenFactory.meta("ui"),
|
|
26
27
|
standalone: tokenFactory.meta("standalone"),
|
|
@@ -75,6 +75,7 @@ var FrontMcpTokens = {
|
|
|
75
75
|
tasks: tokenFactory.meta("tasks"),
|
|
76
76
|
// output validation policy (e.g., reject non-finite numeric output)
|
|
77
77
|
output: tokenFactory.meta("output"),
|
|
78
|
+
input: tokenFactory.meta("input"),
|
|
78
79
|
// per-client answer shaping, keyed by a clientInfo.name glob
|
|
79
80
|
clients: tokenFactory.meta("clients")
|
|
80
81
|
};
|
|
@@ -33,8 +33,9 @@ var FrontMcpToolTokens = {
|
|
|
33
33
|
enabled: tokenFactory.meta("enabled"),
|
|
34
34
|
execution: tokenFactory.meta("execution"),
|
|
35
35
|
// Execution hints (taskSupport, etc.)
|
|
36
|
-
output: tokenFactory.meta("output")
|
|
36
|
+
output: tokenFactory.meta("output"),
|
|
37
37
|
// Output policy (allowNonFinite, schemaMode, ...)
|
|
38
|
+
input: tokenFactory.meta("input")
|
|
38
39
|
};
|
|
39
40
|
var extendedToolMetadata = tokenFactory.meta("extendedToolMetadata");
|
|
40
41
|
export {
|
|
@@ -176,8 +176,8 @@ var FrontMcpContext = class {
|
|
|
176
176
|
return this._platformType;
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
|
-
* Record the client info a request carries, and the platform detected from it
|
|
180
|
-
* An `'unknown'` platform is not recorded, so lookups fall back to the session's platform.
|
|
179
|
+
* Record the client info a request carries, if any, and the platform detected from it or from the capabilities the
|
|
180
|
+
* request declares. An `'unknown'` platform is not recorded, so lookups fall back to the session's platform.
|
|
181
181
|
*
|
|
182
182
|
* @internal
|
|
183
183
|
*/
|
|
@@ -5,7 +5,6 @@ import { ElicitationNotSupportedError, InvalidInputError } from "../../errors/in
|
|
|
5
5
|
import { DEFAULT_ELICIT_TTL } from "../elicitation.types.mjs";
|
|
6
6
|
import { questionSubjectOf } from "./question-subject.mjs";
|
|
7
7
|
import { QuestionPendingError, QuestionSupersededError } from "./question.errors.mjs";
|
|
8
|
-
import { QUESTIONS_TOPIC } from "./question.store.mjs";
|
|
9
8
|
var RECHECK_MS = 5e3;
|
|
10
9
|
var MAX_QUESTION_KEY_LENGTH = 256;
|
|
11
10
|
async function delivered(answer, schema) {
|
|
@@ -86,7 +85,7 @@ async function askPersistentQuestion(deps, message, schema, options) {
|
|
|
86
85
|
const onAbort = () => pending();
|
|
87
86
|
const timer = setTimeout(giveUp, options.waitMs);
|
|
88
87
|
const poll = setInterval(check, RECHECK_MS);
|
|
89
|
-
const stop = store.
|
|
88
|
+
const stop = store.subscribeToQuestion(subject, options.key, check);
|
|
90
89
|
if (signal?.aborted) return onAbort();
|
|
91
90
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
92
91
|
check();
|
|
@@ -10,6 +10,7 @@ import { validateElicitationContent } from "../helpers/validate-elicitation-cont
|
|
|
10
10
|
import { deserializeAndDecrypt, encryptAndSerialize } from "../store/elicitation-encryption.mjs";
|
|
11
11
|
import { QuestionAlreadyAnsweredError, QuestionNotFoundError, QuestionStoreBusyError } from "./question.errors.mjs";
|
|
12
12
|
var QUESTIONS_TOPIC = "questions";
|
|
13
|
+
var QUESTION_TOPIC_PREFIX = "question:";
|
|
13
14
|
var RECORD_PREFIX = "q:";
|
|
14
15
|
var MAX_ATTEMPTS = 16;
|
|
15
16
|
var textEncoder = new TextEncoder();
|
|
@@ -43,7 +44,7 @@ var QuestionStore = class {
|
|
|
43
44
|
}
|
|
44
45
|
const { record, raw } = current;
|
|
45
46
|
if (record.answer) {
|
|
46
|
-
if (await this.claim(storageKey, raw)) {
|
|
47
|
+
if (await this.claim(storageKey, raw, record.expiresAt)) {
|
|
47
48
|
return { kind: "answered", answer: record.answer, expiresAt: record.expiresAt };
|
|
48
49
|
}
|
|
49
50
|
continue;
|
|
@@ -62,7 +63,7 @@ var QuestionStore = class {
|
|
|
62
63
|
if (!current || current.record.waiter !== waiter) return { kind: "superseded" };
|
|
63
64
|
const { record, raw } = current;
|
|
64
65
|
if (!record.answer) return { kind: "waiting", question: view(record) };
|
|
65
|
-
if (await this.claim(storageKey, raw)) {
|
|
66
|
+
if (await this.claim(storageKey, raw, record.expiresAt)) {
|
|
66
67
|
return { kind: "answered", answer: record.answer, expiresAt: record.expiresAt };
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -116,6 +117,10 @@ var QuestionStore = class {
|
|
|
116
117
|
subscribe(topic, listener) {
|
|
117
118
|
return this.options.feed.subscribe(topic, listener);
|
|
118
119
|
}
|
|
120
|
+
/** Call `listener` when the question `key` of `subject` changes, here or in another process, and for no other. */
|
|
121
|
+
subscribeToQuestion(subject, key, listener) {
|
|
122
|
+
return this.options.feed.subscribe(this.questionTopic(this.recordKey(subject, key)), listener);
|
|
123
|
+
}
|
|
119
124
|
async close() {
|
|
120
125
|
await this.options.feed.close();
|
|
121
126
|
await this.options.storage.disconnect();
|
|
@@ -140,12 +145,12 @@ var QuestionStore = class {
|
|
|
140
145
|
});
|
|
141
146
|
const stored = await this.read(storageKey, request.subject);
|
|
142
147
|
if (stored?.record.id !== record.id) return void 0;
|
|
143
|
-
await this.changed();
|
|
148
|
+
await this.changed(storageKey, record.expiresAt);
|
|
144
149
|
return record;
|
|
145
150
|
}
|
|
146
|
-
async claim(storageKey, raw) {
|
|
151
|
+
async claim(storageKey, raw, expiresAt) {
|
|
147
152
|
const claimed = await this.options.storage.deleteIfEquals(storageKey, raw);
|
|
148
|
-
if (claimed) await this.changed();
|
|
153
|
+
if (claimed) await this.changed(storageKey, expiresAt);
|
|
149
154
|
return claimed;
|
|
150
155
|
}
|
|
151
156
|
async replace(storageKey, raw, record) {
|
|
@@ -153,7 +158,7 @@ var QuestionStore = class {
|
|
|
153
158
|
const { storage } = this.options;
|
|
154
159
|
if (!await storage.setIfEquals(storageKey, raw, next)) return false;
|
|
155
160
|
await storage.expireIfEquals(storageKey, next, ttlSecondsUntil(record.expiresAt));
|
|
156
|
-
await this.changed();
|
|
161
|
+
await this.changed(storageKey, record.expiresAt);
|
|
157
162
|
return true;
|
|
158
163
|
}
|
|
159
164
|
async read(storageKey, subject) {
|
|
@@ -203,9 +208,18 @@ var QuestionStore = class {
|
|
|
203
208
|
const text = `${kind}:${value}`;
|
|
204
209
|
return secret === void 0 ? sha256Hex(text) : bytesToHex(hmacSha256(textEncoder.encode(secret), textEncoder.encode(text)));
|
|
205
210
|
}
|
|
206
|
-
|
|
211
|
+
/** A question's topic names it by its storage key, made of digests, so it shows neither the subject nor the key. */
|
|
212
|
+
questionTopic(storageKey) {
|
|
213
|
+
return QUESTION_TOPIC_PREFIX + storageKey;
|
|
214
|
+
}
|
|
215
|
+
/** Tell the inbox, and the call waiting on this question; a polling feed drops the question's counter with it. */
|
|
216
|
+
async changed(storageKey, expiresAt) {
|
|
217
|
+
const { feed } = this.options;
|
|
207
218
|
try {
|
|
208
|
-
await
|
|
219
|
+
await Promise.all([
|
|
220
|
+
feed.publish(QUESTIONS_TOPIC),
|
|
221
|
+
feed.publish(this.questionTopic(storageKey), { ttlSeconds: ttlSecondsUntil(expiresAt) })
|
|
222
|
+
]);
|
|
209
223
|
} catch {
|
|
210
224
|
}
|
|
211
225
|
}
|
|
@@ -96,12 +96,17 @@ var SendElicitationResultTool = class extends ToolContext {
|
|
|
96
96
|
// The call context of this call, whose caller is the owner: its auth info as its transport
|
|
97
97
|
// gave it (the tool reads it as `this.auth`), on the surface it was made from. Not the
|
|
98
98
|
// request context object, whose auth info is a getter a call context does not carry over.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
// The first try's idempotency key is kept, not enumerable, as its dispatcher set it.
|
|
100
|
+
ctx: Object.defineProperty(
|
|
101
|
+
{
|
|
102
|
+
authInfo: this.authInfo,
|
|
103
|
+
requestId: this.tryGetContext()?.requestId ?? this.runId,
|
|
104
|
+
surface: getCallSurface(),
|
|
105
|
+
...this.signal ? { signal: this.signal } : {}
|
|
106
|
+
},
|
|
107
|
+
"idempotencyKey",
|
|
108
|
+
{ value: pending.idempotencyKey }
|
|
109
|
+
)
|
|
105
110
|
});
|
|
106
111
|
this.logger.info("sendElicitationResult: original tool completed", {
|
|
107
112
|
elicitId,
|