@salesforce/platform-sdk 12.8.0 → 12.10.0
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/dist/analytics/analytics.d.ts +19 -15
- package/dist/analytics/analytics.d.ts.map +1 -1
- package/dist/analytics/error-listener.d.ts +3 -3
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +1 -1
- package/dist/analytics/method-configs.d.ts +8 -4
- package/dist/analytics/method-configs.d.ts.map +1 -1
- package/dist/analytics/pft.d.ts +22 -16
- package/dist/analytics/pft.d.ts.map +1 -1
- package/dist/analytics/proxy.d.ts +10 -8
- package/dist/analytics/proxy.d.ts.map +1 -1
- package/dist/analytics/types.d.ts +57 -43
- package/dist/analytics/types.d.ts.map +1 -1
- package/dist/{analytics-Dpz22kda.js → analytics-wESbWdca.js} +1 -1
- package/dist/app/index.d.ts +18 -13
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +5 -3
- package/dist/app/webapp.d.ts +5 -2
- package/dist/app/webapp.d.ts.map +1 -1
- package/dist/{capabilities-CKe8z6kZ.js → capabilities-B0mU0_G0.js} +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/core/app.d.ts +31 -22
- package/dist/core/app.d.ts.map +1 -1
- package/dist/core/capabilities.d.ts +26 -17
- package/dist/core/capabilities.d.ts.map +1 -1
- package/dist/core/chat.d.ts +155 -125
- package/dist/core/chat.d.ts.map +1 -1
- package/dist/core/data.d.ts +146 -107
- package/dist/core/data.d.ts.map +1 -1
- package/dist/core/extension-attach.d.ts +65 -51
- package/dist/core/extension-attach.d.ts.map +1 -1
- package/dist/core/extension-types.d.ts +214 -153
- package/dist/core/extension-types.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/lightning.d.ts +11 -19
- package/dist/core/lightning.d.ts.map +1 -1
- package/dist/core/mcpapps-session.d.ts +63 -52
- package/dist/core/mcpapps-session.d.ts.map +1 -1
- package/dist/core/options.d.ts +6 -4
- package/dist/core/options.d.ts.map +1 -1
- package/dist/core/platforms.d.ts +29 -29
- package/dist/core/sdk-promise.d.ts +7 -4
- package/dist/core/sdk-promise.d.ts.map +1 -1
- package/dist/core/surface.d.ts +89 -67
- package/dist/core/surface.d.ts.map +1 -1
- package/dist/core/view.d.ts +164 -113
- package/dist/core/view.d.ts.map +1 -1
- package/dist/data/extensions/index.d.ts +5 -2
- package/dist/data/extensions/index.d.ts.map +1 -1
- package/dist/data/extensions/labels/index.d.ts +72 -49
- package/dist/data/extensions/labels/index.d.ts.map +1 -1
- package/dist/data/extensions/labels/query.d.ts +38 -29
- package/dist/data/extensions/labels/query.d.ts.map +1 -1
- package/dist/data/gql.d.ts +8 -4
- package/dist/data/gql.d.ts.map +1 -1
- package/dist/data/index.d.ts +67 -48
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +265 -242
- package/dist/data/mosaic/fetch.d.ts +24 -15
- package/dist/data/mosaic/fetch.d.ts.map +1 -1
- package/dist/data/mosaic/index.d.ts +13 -9
- package/dist/data/mosaic/index.d.ts.map +1 -1
- package/dist/data/openai/index.d.ts +11 -5
- package/dist/data/openai/index.d.ts.map +1 -1
- package/dist/data/shared/graphql/cache/command.d.ts +60 -46
- package/dist/data/shared/graphql/cache/command.d.ts.map +1 -1
- package/dist/data/shared/graphql/cache/invoker.d.ts.map +1 -1
- package/dist/data/shared/graphql/cache/services.d.ts +21 -11
- package/dist/data/shared/graphql/cache/services.d.ts.map +1 -1
- package/dist/data/shared/graphql/cached-graphql.d.ts +9 -4
- package/dist/data/shared/graphql/cached-graphql.d.ts.map +1 -1
- package/dist/data/shared/graphql/graphql-parse.d.ts +6 -3
- package/dist/data/shared/graphql/graphql-parse.d.ts.map +1 -1
- package/dist/data/shared/graphql/headers.d.ts +34 -27
- package/dist/data/shared/graphql/headers.d.ts.map +1 -1
- package/dist/data/shared/graphql/parse-response.d.ts +31 -23
- package/dist/data/shared/graphql/parse-response.d.ts.map +1 -1
- package/dist/data/shared/graphql/uncached-graphql.d.ts +10 -6
- package/dist/data/shared/graphql/uncached-graphql.d.ts.map +1 -1
- package/dist/data/shared/url-utils.d.ts +1 -1
- package/dist/data/shared/url-utils.d.ts.map +1 -1
- package/dist/data/webapp/accept-language.interceptor.d.ts +26 -9
- package/dist/data/webapp/accept-language.interceptor.d.ts.map +1 -1
- package/dist/data/webapp/client-headers.interceptor.d.ts +4 -3
- package/dist/data/webapp/client-headers.interceptor.d.ts.map +1 -1
- package/dist/data/webapp/csrf/header.interceptor.d.ts +4 -4
- package/dist/data/webapp/csrf/header.interceptor.d.ts.map +1 -1
- package/dist/data/webapp/csrf/retry.policy.d.ts +12 -11
- package/dist/data/webapp/csrf/retry.policy.d.ts.map +1 -1
- package/dist/data/webapp/csrf/token-manager.d.ts +18 -12
- package/dist/data/webapp/csrf/token-manager.d.ts.map +1 -1
- package/dist/data/webapp/fetch.d.ts +12 -8
- package/dist/data/webapp/fetch.d.ts.map +1 -1
- package/dist/data/webapp/index.d.ts +12 -7
- package/dist/data/webapp/index.d.ts.map +1 -1
- package/dist/i18n/locale-format.d.ts +23 -21
- package/dist/i18n/locale-format.d.ts.map +1 -1
- package/dist/i18n/salesforce-backend.d.ts +19 -11
- package/dist/i18n/salesforce-backend.d.ts.map +1 -1
- package/dist/i18n/salesforce-detector.d.ts +22 -14
- package/dist/i18n/salesforce-detector.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lightning/embedding.d.ts.map +1 -1
- package/dist/lightning/index.d.ts +4 -4
- package/dist/lightning/index.d.ts.map +1 -1
- package/dist/lightning/index.js +2 -2
- package/dist/{surface-Dd2tqrPi.js → surface-DWDgqdpN.js} +18 -13
- package/dist/telemetry/tool-adapter.d.ts.map +1 -1
- package/dist/telemetry/uploader/TelemetryUploader.d.ts.map +1 -1
- package/dist/ui-embedding/index.d.ts.map +1 -1
- package/dist/ui-embedding/session.d.ts +7 -2
- package/dist/ui-embedding/session.d.ts.map +1 -1
- package/dist/ui-embedding/session.js +1 -1
- package/dist/view/index.js +1 -1
- package/package.json +2 -2
|
@@ -2,128 +2,139 @@ import { JsonRpcClient } from '@salesforce/jsonrpc';
|
|
|
2
2
|
import { DisplayMode, HostStyles } from './chat';
|
|
3
3
|
import { ThemeMode } from './view';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* The host context that the `ui/initialize` handshake returns.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This interface represents the raw MCP Apps wire-format fields. SDK
|
|
9
|
+
* classes map these fields to their own protocol-agnostic types.
|
|
9
10
|
*/
|
|
10
11
|
export interface McpAppsHostContext {
|
|
11
|
-
/**
|
|
12
|
+
/** The theme mode that the host provides. */
|
|
12
13
|
theme?: ThemeMode;
|
|
13
|
-
/**
|
|
14
|
+
/** The display mode of the widget. */
|
|
14
15
|
displayMode?: DisplayMode;
|
|
15
|
-
/**
|
|
16
|
+
/** The container dimensions. */
|
|
16
17
|
containerDimensions?: {
|
|
17
18
|
height?: number;
|
|
18
19
|
maxHeight?: number;
|
|
19
20
|
width?: number;
|
|
20
21
|
maxWidth?: number;
|
|
21
22
|
};
|
|
22
|
-
/**
|
|
23
|
+
/** The safe area insets, in CSS pixels. */
|
|
23
24
|
safeAreaInsets?: {
|
|
24
25
|
top: number;
|
|
25
26
|
right: number;
|
|
26
27
|
bottom: number;
|
|
27
28
|
left: number;
|
|
28
29
|
};
|
|
29
|
-
/**
|
|
30
|
+
/** The host's user agent string. */
|
|
30
31
|
userAgent?: string;
|
|
31
|
-
/** BCP 47 locale */
|
|
32
|
+
/** The BCP 47 locale tag. */
|
|
32
33
|
locale?: string;
|
|
33
|
-
/**
|
|
34
|
+
/** The device's interaction capabilities. */
|
|
34
35
|
deviceCapabilities?: {
|
|
35
36
|
touch?: boolean;
|
|
36
37
|
hover?: boolean;
|
|
37
38
|
};
|
|
38
|
-
/**
|
|
39
|
+
/** The tool information for the current tool invocation, including its name and schema. */
|
|
39
40
|
toolInfo?: {
|
|
40
|
-
/** JSON-RPC
|
|
41
|
+
/** The JSON-RPC ID of the `tools/call` request. */
|
|
41
42
|
id?: string | number;
|
|
42
|
-
/**
|
|
43
|
+
/** The full tool definition. */
|
|
43
44
|
tool: Record<string, unknown>;
|
|
44
45
|
};
|
|
45
|
-
/**
|
|
46
|
+
/** The initial tool output, the `structuredContent` field from `CallToolResult`, when available at initialization. */
|
|
46
47
|
toolOutput?: Record<string, unknown> | null;
|
|
47
|
-
/**
|
|
48
|
+
/** The initial tool output's structured content, when available at initialization. */
|
|
48
49
|
toolStructuredContent?: Record<string, unknown> | null;
|
|
49
|
-
/**
|
|
50
|
+
/** The initial tool input arguments, when available at initialization. */
|
|
50
51
|
toolInput?: Record<string, unknown>;
|
|
51
|
-
/**
|
|
52
|
+
/** The initial tool response metadata, the `_meta` field from `CallToolResult`, when available at initialization. */
|
|
52
53
|
toolResponseMetadata?: Record<string, unknown> | null;
|
|
53
|
-
/**
|
|
54
|
+
/** The initial widget state, when available at initialization. */
|
|
54
55
|
widgetState?: Record<string, unknown> | null;
|
|
55
|
-
/**
|
|
56
|
+
/** The styles that the host provides for theming and font loading. */
|
|
56
57
|
styles?: HostStyles;
|
|
57
58
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Options for McpAppsSession initialization.
|
|
60
|
-
*/
|
|
59
|
+
/** The options for `McpAppsSession` initialization. */
|
|
61
60
|
export interface McpAppsSessionOptions {
|
|
62
61
|
/**
|
|
63
62
|
* The origin to pass as the second argument of `window.parent.postMessage`.
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* This field defaults to `"*"` when you omit it, matching the
|
|
66
|
+
* pre-extraction MCP Apps behavior. Pin this to the known MCP host
|
|
67
|
+
* origin when you know it. `"*"` is the documented fallback for when
|
|
68
|
+
* you cannot determine the host origin ahead of time.
|
|
68
69
|
*/
|
|
69
70
|
targetOrigin?: string;
|
|
70
|
-
/**
|
|
71
|
+
/** The app identity to send during the `ui/initialize` handshake. */
|
|
71
72
|
appInfo?: {
|
|
72
73
|
name: string;
|
|
73
74
|
version: string;
|
|
74
75
|
};
|
|
75
|
-
/**
|
|
76
|
+
/** The handshake timeout, in milliseconds. Defaults to 500. */
|
|
76
77
|
handshakeTimeoutMs?: number;
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
79
|
-
*
|
|
80
|
-
* handshake has not succeeded.
|
|
80
|
+
* The error that the SDK throws when the MCPApps surface is required, but
|
|
81
|
+
* the SEP-1865 `ui/initialize` handshake has not succeeded.
|
|
81
82
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
83
|
+
* @remarks
|
|
84
|
+
* In practice, this error surfaces only on the `options.surface` override
|
|
85
|
+
* path. A caller that forces `{ surface: Surface.MCPApps }` bypasses
|
|
86
|
+
* detection, so the handshake may run, and time out, for the first time
|
|
87
|
+
* during verification. Detection never yields MCPApps without a live
|
|
88
|
+
* handshake, so the no-override path cannot raise this error. This
|
|
89
|
+
* mirrors {@link SfEmbeddingNotAvailableError} for the MicroFrontend
|
|
90
|
+
* surface.
|
|
88
91
|
*/
|
|
89
92
|
export declare class McpAppsNotAvailableError extends Error {
|
|
90
93
|
constructor();
|
|
91
94
|
}
|
|
92
95
|
/**
|
|
93
|
-
*
|
|
96
|
+
* The shared MCP Apps session singleton.
|
|
94
97
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* This class provides a single JSON-RPC transport, with one postMessage
|
|
100
|
+
* listener and one ID counter, shared by both `MCPAppsChatSDK` and
|
|
101
|
+
* `MCPAppsViewSDK`. It runs the SEP-1865 `ui/initialize` handshake once
|
|
102
|
+
* and exposes the resulting host context.
|
|
98
103
|
*
|
|
99
|
-
* Use {@link McpAppsSession.getInstance} to
|
|
100
|
-
* triggers the handshake
|
|
104
|
+
* Use {@link McpAppsSession.getInstance} to get the singleton. The first
|
|
105
|
+
* call triggers the handshake. Later calls return the same initialized
|
|
106
|
+
* instance.
|
|
101
107
|
*/
|
|
102
108
|
export declare class McpAppsSession extends JsonRpcClient {
|
|
103
109
|
private static initPromise;
|
|
104
110
|
private hostCtx;
|
|
105
111
|
private _handshakeSucceeded;
|
|
106
112
|
/**
|
|
107
|
-
*
|
|
113
|
+
* Gets or creates the shared session singleton.
|
|
108
114
|
*
|
|
109
|
-
*
|
|
115
|
+
* @remarks
|
|
116
|
+
* The first call runs the SEP-1865 handshake. Concurrent and later
|
|
110
117
|
* calls reuse the same session and handshake result.
|
|
111
118
|
*
|
|
112
|
-
* @param options -
|
|
113
|
-
* when
|
|
119
|
+
* @param options - The configuration. `targetOrigin` defaults to `"*"`
|
|
120
|
+
* when you omit it. Pin this to the concrete MCP host origin when
|
|
121
|
+
* you know it.
|
|
114
122
|
*/
|
|
115
123
|
static getInstance(options?: McpAppsSessionOptions): Promise<McpAppsSession>;
|
|
116
124
|
/**
|
|
117
|
-
*
|
|
125
|
+
* Runs the handshake: `ui/initialize`, then the host context, then
|
|
126
|
+
* `ui/notifications/initialized`.
|
|
118
127
|
*
|
|
119
|
-
*
|
|
120
|
-
* On
|
|
121
|
-
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* On success, this method stores the host context and sends the
|
|
130
|
+
* initialized notification. On timeout or error, it falls back to an
|
|
131
|
+
* empty host context, so the app can still render. This degrades
|
|
132
|
+
* gracefully for hosts that do not support SEP-1865.
|
|
122
133
|
*/
|
|
123
134
|
private handshake;
|
|
124
|
-
/** Returns the current host context
|
|
135
|
+
/** Returns the current host context, from the handshake and later notification updates. */
|
|
125
136
|
getHostContext(): McpAppsHostContext;
|
|
126
|
-
/**
|
|
137
|
+
/** True when the `ui/initialize` handshake completed successfully, without timing out. */
|
|
127
138
|
get handshakeSucceeded(): boolean;
|
|
128
139
|
request<TParams = unknown, TResult = unknown>(method: string, params: TParams): Promise<TResult>;
|
|
129
140
|
sendNotification<TParams = unknown>(method: string, params?: TParams): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpapps-session.d.ts","sourceRoot":"","sources":["../../src/core/mcpapps-session.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAA8B,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"mcpapps-session.d.ts","sourceRoot":"","sources":["../../src/core/mcpapps-session.ts"],"names":[],"mappings":"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"}
|
package/dist/core/options.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { Surface } from './surface';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The base options for every SDK factory function.
|
|
4
4
|
*
|
|
5
|
+
* @remarks
|
|
5
6
|
* Individual SDKs extend this interface to add SDK-specific options.
|
|
6
7
|
*/
|
|
7
8
|
export interface SDKOptions {
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Overrides the auto-detected surface.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* When you provide this value, the SDK uses it instead of the result
|
|
14
|
+
* of the runtime surface detection.
|
|
13
15
|
*/
|
|
14
16
|
surface?: Surface;
|
|
15
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/core/options.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/core/options.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
package/dist/core/platforms.d.ts
CHANGED
|
@@ -24,96 +24,96 @@ declare global {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* The severity level of a message.
|
|
28
28
|
*/
|
|
29
29
|
export type MessageLevel = "info" | "success" | "warning" | "error";
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* The options for an alert.
|
|
32
32
|
*/
|
|
33
33
|
export interface AlertOptions {
|
|
34
34
|
/**
|
|
35
|
-
* The message to display
|
|
35
|
+
* The message to display.
|
|
36
36
|
*/
|
|
37
37
|
message: string;
|
|
38
38
|
/**
|
|
39
|
-
* The severity level of the alert
|
|
39
|
+
* The severity level of the alert. Defaults to `info`.
|
|
40
40
|
*/
|
|
41
41
|
level?: MessageLevel;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* The options for a toast.
|
|
45
45
|
*/
|
|
46
46
|
export interface ToastOptions {
|
|
47
47
|
/**
|
|
48
|
-
* The message to display
|
|
48
|
+
* The message to display.
|
|
49
49
|
*/
|
|
50
50
|
message: string;
|
|
51
51
|
/**
|
|
52
|
-
* The severity level of the toast
|
|
52
|
+
* The severity level of the toast. Defaults to `info`.
|
|
53
53
|
*/
|
|
54
54
|
level?: MessageLevel;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* The options for a modal.
|
|
58
58
|
*/
|
|
59
59
|
export interface ModalOptions {
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
61
|
+
* The template URI for the custom modal UI, in the form
|
|
62
|
+
* `ui://widget/[name].html`.
|
|
63
63
|
*/
|
|
64
64
|
template: string;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
66
|
+
* The parameters to pass to the modal, accessible through
|
|
67
|
+
* `window.openai.view.params` in the modal.
|
|
68
68
|
*/
|
|
69
69
|
params?: Record<string, unknown>;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* The View SDK API.
|
|
73
73
|
*/
|
|
74
74
|
export interface ViewSDK {
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* Displays an alert in the host.
|
|
77
77
|
*
|
|
78
|
-
* @param options -
|
|
79
|
-
* @returns
|
|
78
|
+
* @param options - The alert configuration.
|
|
79
|
+
* @returns Resolves once the host displays the alert.
|
|
80
80
|
*/
|
|
81
81
|
displayAlert?(options: AlertOptions): Promise<void>;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Displays a toast notification in the host.
|
|
84
84
|
*
|
|
85
|
-
* @param options -
|
|
86
|
-
* @returns
|
|
85
|
+
* @param options - The toast configuration.
|
|
86
|
+
* @returns Resolves once the host displays the toast.
|
|
87
87
|
*/
|
|
88
88
|
displayToast?(options: ToastOptions): Promise<void>;
|
|
89
89
|
/**
|
|
90
|
-
*
|
|
90
|
+
* Displays a modal in the host.
|
|
91
91
|
*
|
|
92
|
-
* @param options -
|
|
93
|
-
* @returns
|
|
92
|
+
* @param options - The modal configuration.
|
|
93
|
+
* @returns Resolves once the host displays the modal.
|
|
94
94
|
*/
|
|
95
95
|
displayModal?(options: ModalOptions): Promise<void>;
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
97
|
+
* Gets the current theme.
|
|
98
98
|
*
|
|
99
|
-
* @returns The current theme or null
|
|
99
|
+
* @returns The current theme, or `null` when it is not available.
|
|
100
100
|
*/
|
|
101
101
|
getTheme(): Theme | null;
|
|
102
102
|
}
|
|
103
103
|
export interface DataSDK {
|
|
104
104
|
/**
|
|
105
|
-
*
|
|
105
|
+
* Runs a GraphQL query.
|
|
106
106
|
*
|
|
107
107
|
* @param query
|
|
108
108
|
* @param variables
|
|
109
109
|
*/
|
|
110
110
|
graphql?: <T, V = Record<string, unknown>>(query: string, variables?: V) => Promise<GraphQLResponse<T>>;
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* Makes a request with the Fetch API.
|
|
113
113
|
*
|
|
114
|
-
* @param input - The URL or Request object
|
|
115
|
-
* @param init -
|
|
116
|
-
* @returns
|
|
114
|
+
* @param input - The URL or `Request` object.
|
|
115
|
+
* @param init - The `RequestInit` configuration.
|
|
116
|
+
* @returns The response.
|
|
117
117
|
*/
|
|
118
118
|
fetch?: typeof fetch;
|
|
119
119
|
}
|
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* Wraps an SDK factory
|
|
8
|
-
* non-
|
|
7
|
+
* Wraps an SDK factory promise in a proxy that throws a clear error when
|
|
8
|
+
* code accesses a non-promise method.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This function guides a caller who forgot to `await` the factory call.
|
|
12
|
+
* Symbol-keyed properties, for example `Symbol.toStringTag` and
|
|
13
|
+
* `Symbol.iterator`, always pass through, so the value continues to
|
|
14
|
+
* behave as a proper thenable.
|
|
12
15
|
*/
|
|
13
16
|
export declare function wrapSDKPromise<T>(promise: Promise<T>, factoryName: string): Promise<T>;
|
|
14
17
|
//# sourceMappingURL=sdk-promise.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-promise.d.ts","sourceRoot":"","sources":["../../src/core/sdk-promise.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH
|
|
1
|
+
{"version":3,"file":"sdk-promise.d.ts","sourceRoot":"","sources":["../../src/core/sdk-promise.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAgBtF"}
|
package/dist/core/surface.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { McpAppsSessionOptions } from './mcpapps-session';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The set of possible runtime surfaces.
|
|
4
4
|
*/
|
|
5
5
|
export declare enum Surface {
|
|
6
6
|
WebApp = "WebApp",
|
|
@@ -10,92 +10,114 @@ export declare enum Surface {
|
|
|
10
10
|
Mosaic = "Mosaic"
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* The options for the one-time {@link initialize} lifecycle call.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This interface is modeled as a bag, so a later revision can add new
|
|
17
|
+
* setup inputs without changing the signature or breaking callers.
|
|
16
18
|
*/
|
|
17
19
|
export interface InitializeOptions {
|
|
18
20
|
/**
|
|
19
|
-
* MCP Apps session options
|
|
20
|
-
* applied
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* The MCP Apps session options, such as the target origin, app
|
|
22
|
+
* identity, and handshake timeout, applied when the SEP-1865
|
|
23
|
+
* handshake probe runs during surface detection.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* These are per-widget-environment settings, configured once for the
|
|
27
|
+
* page. That is why they live on the {@link initialize} lifecycle,
|
|
28
|
+
* rather than on individual SDK factory options.
|
|
24
29
|
*/
|
|
25
30
|
mcpApps?: McpAppsSessionOptions;
|
|
26
31
|
}
|
|
27
32
|
/**
|
|
28
|
-
*
|
|
29
|
-
* detection
|
|
33
|
+
* Initializes the SDK runtime: configures the MCP Apps session and runs
|
|
34
|
+
* surface detection, including the handshake probe, exactly once.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* Calling this function is optional. When an SDK factory or
|
|
38
|
+
* {@link getVerifiedSurface} runs first, detection starts automatically
|
|
39
|
+
* with default options. Call `initialize` explicitly, before you create
|
|
40
|
+
* any SDK, only when you need to pass MCP Apps options, for example to
|
|
41
|
+
* pin the host `targetOrigin`.
|
|
30
42
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
43
|
+
* This function is idempotent and first-call-wins. The first call
|
|
44
|
+
* starts detection, and its options take effect. Later calls, including
|
|
45
|
+
* concurrent ones, resolve to the same result. A page has one
|
|
46
|
+
* postMessage channel and one SEP-1865 handshake, so this function
|
|
47
|
+
* cannot honor a second set of `mcpApps` options. A repeat call with no
|
|
48
|
+
* options, or with options equal to the first call's, is therefore a
|
|
49
|
+
* silent no-op. This is the SDK-factory auto-init path.
|
|
35
50
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* **differ** is a misconfiguration — almost always an ordering bug, where an SDK
|
|
43
|
-
* factory auto-initialized with defaults before the app pinned its `targetOrigin`
|
|
44
|
-
* — and silently dropping the new options is exactly the footgun this lifecycle
|
|
45
|
-
* exists to remove, so it **throws** instead. Configure the MCP Apps session
|
|
46
|
-
* exactly once, before creating any SDK.
|
|
51
|
+
* A repeat call whose `mcpApps` options differ is a misconfiguration,
|
|
52
|
+
* almost always an ordering bug where an SDK factory auto-initialized
|
|
53
|
+
* with defaults before the app pinned its `targetOrigin`. Silently
|
|
54
|
+
* dropping the new options is exactly the footgun this lifecycle exists
|
|
55
|
+
* to remove, so this function throws instead. Configure the MCP Apps
|
|
56
|
+
* session exactly once, before you create any SDK.
|
|
47
57
|
*
|
|
48
|
-
* @param options -
|
|
49
|
-
* @returns
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* promise rejection
|
|
58
|
+
* @param options - The configuration, applied only on the first call.
|
|
59
|
+
* @returns The detected surface. Rejects with an `Error` when a later
|
|
60
|
+
* call passes `mcpApps` options that differ from the options the
|
|
61
|
+
* first call established. Because this function is `async`, the
|
|
62
|
+
* conflict is a promise rejection, awaitable or catchable, not a
|
|
63
|
+
* synchronous throw.
|
|
53
64
|
*/
|
|
54
65
|
export declare function initialize(options?: InitializeOptions): Promise<Surface>;
|
|
55
66
|
/**
|
|
56
|
-
* True
|
|
57
|
-
* `hostMetaData` query parameter
|
|
58
|
-
* iframe creation.
|
|
59
|
-
*
|
|
60
|
-
*
|
|
67
|
+
* True only when the current document is an iframe whose URL carries a
|
|
68
|
+
* valid `hostMetaData` query parameter, meaning the host LWC populated
|
|
69
|
+
* it during iframe creation.
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* `readHostMetaData` enforces the required `hostAppOrigin` and
|
|
73
|
+
* `instanceId` fields. Cross-origin `window.parent` access throws in
|
|
74
|
+
* some browsers. This function treats that throw as not a
|
|
75
|
+
* MicroFrontend iframe.
|
|
61
76
|
*/
|
|
62
77
|
export declare function isSfEmbeddingIframe(): boolean;
|
|
63
78
|
/**
|
|
64
|
-
* Resolves the surface to use for SDK initialization and verifies that
|
|
65
|
-
* surface is actually usable
|
|
79
|
+
* Resolves the surface to use for SDK initialization and verifies that
|
|
80
|
+
* the surface is actually usable.
|
|
66
81
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* This function always runs the one-time {@link initialize} first, on
|
|
84
|
+
* both the detection and the override paths. Because {@link initialize}
|
|
85
|
+
* is idempotent and first-call-wins, this only runs detection, and its
|
|
86
|
+
* handshake probe, when detection has not yet run. Otherwise it just
|
|
87
|
+
* awaits the established, in-flight or resolved, result. So detection
|
|
88
|
+
* still runs at most once per page.
|
|
72
89
|
*
|
|
73
|
-
* Initializing up front matters even when an `override
|
|
74
|
-
* the lifecycle
|
|
75
|
-
* so a later `initialize({ mcpApps })`
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
90
|
+
* Initializing up front matters even when you supply an `override`. It
|
|
91
|
+
* claims the lifecycle, setting the shared `initPromise` and capturing
|
|
92
|
+
* the session configuration, so a later `initialize({ mcpApps })` call
|
|
93
|
+
* that conflicts now correctly throws, instead of silently establishing
|
|
94
|
+
* a second, defaults-based configuration. The previous behavior ran the
|
|
95
|
+
* override's liveness probe through a bare
|
|
96
|
+
* {@link McpAppsSession.getInstance} call, which left `initPromise`
|
|
97
|
+
* unset and let that footgun slip through. For example,
|
|
98
|
+
* `createChatSDK({ surface: MCPApps })` followed by
|
|
99
|
+
* `initialize({ mcpApps })` would not throw. See the W-23083001 review
|
|
100
|
+
* feedback.
|
|
81
101
|
*
|
|
82
|
-
*
|
|
83
|
-
* override bypasses detection's
|
|
84
|
-
* {@link Surface.MCPApps} may not have a vetted handshake
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
102
|
+
* Only the `override` path adds a verification check, and only for
|
|
103
|
+
* MCPApps. An override bypasses detection's result, so a caller that
|
|
104
|
+
* forces {@link Surface.MCPApps} may not have a vetted handshake. When
|
|
105
|
+
* the handshake has not succeeded, this function throws
|
|
106
|
+
* {@link McpAppsNotAvailableError}. The detection path needs no extra
|
|
107
|
+
* check, because {@link detectSurface} only yields MCPApps after a
|
|
108
|
+
* successful handshake. The {@link McpAppsSession.getInstance} call is
|
|
109
|
+
* memoized and shared with detection, so in a real MCP Apps iframe this
|
|
110
|
+
* reuses the session that detection already built, with no second
|
|
111
|
+
* handshake. This centralizes the liveness check that the SDK factories
|
|
112
|
+
* previously each performed inline. The factories catch the error and
|
|
113
|
+
* degrade to an empty SDK, mirroring how the MicroFrontend path handles
|
|
114
|
+
* {@link SfEmbeddingNotAvailableError}.
|
|
93
115
|
*
|
|
94
|
-
* @param override -
|
|
95
|
-
*
|
|
96
|
-
* @returns
|
|
97
|
-
* @throws McpAppsNotAvailableError
|
|
98
|
-
* has not succeeded.
|
|
116
|
+
* @param override - The explicit surface that overrides the detected
|
|
117
|
+
* result. Detection itself still runs once, to claim the lifecycle.
|
|
118
|
+
* @returns The verified surface.
|
|
119
|
+
* @throws {McpAppsNotAvailableError} When MCPApps is required but the
|
|
120
|
+
* handshake has not succeeded.
|
|
99
121
|
*/
|
|
100
122
|
export declare function getVerifiedSurface(override?: Surface): Promise<Surface>;
|
|
101
123
|
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../src/core/surface.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D;;GAEG;AACH,oBAAY,OAAO;IAClB,MAAM,WAAW;IACjB,aAAa,mBAAmB;IAChC,MAAM,WAAW;IACjB,OAAO,aAAa;IACpB,MAAM,WAAW;CACjB;AAED
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../src/core/surface.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D;;GAEG;AACH,oBAAY,OAAO;IAClB,MAAM,WAAW;IACjB,aAAa,mBAAmB;IAChC,MAAM,WAAW;IACjB,OAAO,aAAa;IACpB,MAAM,WAAW;CACjB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAiHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAsB9E;AAoBD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAU7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAoC7E"}
|