@salesforce/platform-sdk 10.24.0 → 11.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/analytics/analytics.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAmB,MAAM,SAAS,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CA0HnF"}
1
+ {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/analytics/analytics.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAmB,MAAM,SAAS,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAK7E"}
@@ -1,4 +1,4 @@
1
- import { A as s, I as A, P as E, c as t, v as I } from "../analytics-Cgt83u0I.js";
1
+ import { A as s, I as A, P as E, c as t, v as I } from "../analytics-ygoSv0Cj.js";
2
2
  export {
3
3
  s as AXL_PFT_ID,
4
4
  A as INTERNAL_SESSION_META_KEY,
@@ -0,0 +1,157 @@
1
+ import { registerInstrumentedApp as P } from "o11y/client";
2
+ import { g as h, S as T } from "./surface-CEErnCgI.js";
3
+ import { w as x } from "./sdk-promise-D0sy7OW1.js";
4
+ import { getChatSDK as v } from "./chat/index.js";
5
+ import { r as _ } from "./TelemetryUploader-DKkdppe9.js";
6
+ import { analyticsContextSchema as C, sessionSchema as k, pageViewSchema as L, errorContextSchema as N, interactionSchema as D, customEventSchema as F } from "o11y_schema/sf_mcpanalytics";
7
+ function O(e) {
8
+ const r = (n, c, p, a, u) => {
9
+ e.error(u ?? n);
10
+ }, o = (n) => {
11
+ e.error(n.reason);
12
+ };
13
+ return window.addEventListener("error", r), window.addEventListener("unhandledrejection", o), () => {
14
+ window.removeEventListener("error", r), window.removeEventListener("unhandledrejection", o);
15
+ };
16
+ }
17
+ const J = "aJC", U = "sfdc.pftId", W = "sfdc.internalSession", K = "aJCEE000000FgYP4A0", w = /* @__PURE__ */ new Set(), M = /^aJC[0-9A-Za-z]{12}(?:[0-9A-Za-z]{3})?$/;
18
+ function S(e) {
19
+ return typeof e != "string" || e.length === 0 ? !1 : e.length !== 15 && e.length !== 18 ? (E(e, "Expected a 15- or 18-character Salesforce ID"), !1) : M.test(e) ? !0 : (E(e, `Expected a Product Feature Id (prefix "${J}", base62).`), !1);
20
+ }
21
+ function E(e, r) {
22
+ w.has(e) || (w.add(e), console.debug(`[platform-sdk:analytics] Ignoring invalid PFT Id "${e}". ${r}`));
23
+ }
24
+ function g(e, r) {
25
+ return { surface: r };
26
+ }
27
+ const R = {
28
+ callTool: {
29
+ isAsync: !0,
30
+ extractTags: (e, r) => ({ toolName: e[0]?.toolName ?? "unknown", surface: r })
31
+ },
32
+ setWidgetState: {
33
+ isAsync: !1,
34
+ extractTags: g
35
+ },
36
+ sendMessageToHost: {
37
+ isAsync: !0,
38
+ extractTags: g
39
+ },
40
+ openLink: {
41
+ isAsync: !0,
42
+ extractTags: g
43
+ },
44
+ readResource: {
45
+ isAsync: !0,
46
+ extractTags: (e, r) => {
47
+ const n = e[0]?.uri ?? "", c = n.indexOf("://");
48
+ return { scheme: c > 0 ? n.slice(0, c).toLowerCase() : "unknown", surface: r };
49
+ }
50
+ },
51
+ setDisplayMode: {
52
+ isAsync: !0,
53
+ extractTags: (e, r) => ({ mode: e[0] ?? "unknown", surface: r })
54
+ }
55
+ };
56
+ function $(e, r, o) {
57
+ return new Proxy(e, {
58
+ get(n, c, p) {
59
+ const a = Reflect.get(n, c, p), u = R[c];
60
+ return !u || typeof a != "function" ? a : (...d) => {
61
+ const f = u.extractTags(d, o), s = `sdk.${String(c)}`;
62
+ return u.isAsync ? r.activityAsync(s, async () => {
63
+ try {
64
+ const m = await a.apply(n, d);
65
+ return r.incrementCounter(s, 1, !1, f), m;
66
+ } catch (m) {
67
+ throw r.incrementCounter(s, 1, !0, f), m;
68
+ }
69
+ }) : (r.incrementCounter(s, 1, !1, f), a.apply(n, d));
70
+ };
71
+ }
72
+ });
73
+ }
74
+ function X(e) {
75
+ return x(V(e), "createAnalytics");
76
+ }
77
+ async function V(e) {
78
+ const { appId: r, clientSessionId: o } = e;
79
+ let n;
80
+ try {
81
+ n = await h();
82
+ } catch {
83
+ n = T.WebApp;
84
+ }
85
+ const c = Date.now(), p = e.sdk ?? await v();
86
+ let a = null;
87
+ e.pftId !== void 0 && S(e.pftId) && (a = e.pftId);
88
+ const u = e.enforceInternalGate === !0;
89
+ let d = !1;
90
+ const f = P("mcp-widget", {
91
+ appPayloadProvider: {
92
+ getPayload: () => {
93
+ const t = !u || d;
94
+ return {
95
+ schema: C,
96
+ payload: {
97
+ appId: r,
98
+ surface: n,
99
+ ...t ? { axlPftId: K } : {},
100
+ ...t && a !== null ? { pftId: a } : {}
101
+ }
102
+ };
103
+ }
104
+ },
105
+ clientSessionId: o
106
+ }), s = f, m = $(p, s, n), A = O(s);
107
+ let y;
108
+ e.transport && (y = _(f, {
109
+ onEnvelope: (t) => {
110
+ e.transport.enqueue(t);
111
+ }
112
+ }));
113
+ let I, i = !1;
114
+ return {
115
+ instrumentedSDK: m,
116
+ app: f,
117
+ trackEvent(t, l) {
118
+ i || s.log(F, {
119
+ eventName: t,
120
+ properties: l ? JSON.stringify(l) : ""
121
+ });
122
+ },
123
+ trackInteraction(t, l) {
124
+ i || s.log(D, {
125
+ elementId: t,
126
+ properties: l ? JSON.stringify(l) : ""
127
+ });
128
+ },
129
+ trackError(t, l) {
130
+ i || s.error(t, N, {
131
+ properties: l ? JSON.stringify(l) : ""
132
+ });
133
+ },
134
+ trackPageView(t) {
135
+ i || t !== I && (I = t, s.log(L, { componentRef: t }));
136
+ },
137
+ setPftId(t) {
138
+ i || S(t) && (a = t);
139
+ },
140
+ setInternalSession(t) {
141
+ i || (d = t === !0);
142
+ },
143
+ dispose() {
144
+ if (i) return;
145
+ i = !0, A();
146
+ const t = Date.now() - c;
147
+ s.log(k, { durationMs: t }), y?.dispose();
148
+ }
149
+ };
150
+ }
151
+ export {
152
+ K as A,
153
+ W as I,
154
+ U as P,
155
+ X as c,
156
+ S as v
157
+ };
@@ -1,4 +1,4 @@
1
- import { S as e } from "./surface-DX5JCZPQ.js";
1
+ import { S as e } from "./surface-CEErnCgI.js";
2
2
  const s = {
3
3
  callTool: !0,
4
4
  sendMessageToHost: !0,
@@ -1,16 +1,23 @@
1
- import { ChatSDK, SDKOptions, McpAppsSessionOptions } from '../core';
1
+ import { ChatSDK, SDKOptions } from '../core';
2
2
  /**
3
3
  * Options for creating a ChatSDK instance.
4
+ *
5
+ * MCP Apps session configuration (target origin, app identity, handshake
6
+ * timeout) lives on {@link initialize}, not here — it is a per-page setting,
7
+ * not a per-SDK one.
4
8
  */
5
9
  export interface ChatSDKOptions extends SDKOptions {
6
- /** MCP Apps session options (app identity, handshake timeout) */
7
- mcpApps?: McpAppsSessionOptions;
8
10
  }
9
11
  /**
10
- * Create and initialize a ChatSDK instance based on the detected surface
12
+ * Create and initialize a ChatSDK instance based on the detected surface.
11
13
  *
12
- * For MCP Apps surfaces, this performs the SEP-1865 handshake (ui/initialize)
13
- * via the shared {@link McpAppsSession} singleton on the first call.
14
+ * Never rejects on an unusable surface: every surface degrades to an empty SDK
15
+ * so an embedding host always renders. This covers both the central liveness
16
+ * check in {@link getVerifiedSurface} (e.g. MCPApps forced via `options.surface`
17
+ * without a successful SEP-1865 handshake) and a surface-specific construction
18
+ * failure such as the MicroFrontend branch's {@link SfEmbeddingNotAvailableError}
19
+ * (no active sf-embedding session) — both are caught and degrade rather than
20
+ * propagate.
14
21
  *
15
22
  * @param options - Optional configuration including surface override
16
23
  * @returns Promise resolving to an initialized ChatSDK instance
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chat/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAK1E;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD,iEAAiE;IACjE,OAAO,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CA+BxE;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EACX,WAAW,EACX,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,QAAQ,EACR,SAAS,GACT,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chat/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKnD;;;;;;GAMG;AAEH,MAAM,WAAW,cAAe,SAAQ,UAAU;CAAG;AAErD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAgCxE;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EACX,WAAW,EACX,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,QAAQ,EACR,SAAS,GACT,MAAM,SAAS,CAAC"}
@@ -1,5 +1,4 @@
1
- import { g as c, S as n } from "../surface-DX5JCZPQ.js";
2
- import { M as d } from "../mcpapps-session-BThDrfRw.js";
1
+ import { g as c, S as n, a as d } from "../surface-CEErnCgI.js";
3
2
  import { w as p } from "../sdk-promise-D0sy7OW1.js";
4
3
  import { requireSharedSession as h } from "../sf-embedding/index.js";
5
4
  class a {
@@ -190,36 +189,36 @@ class g {
190
189
  }
191
190
  }
192
191
  let i = null, r = null;
193
- function y(s) {
192
+ function C(s) {
194
193
  return i || (i = w(s).then((t) => (r = t, t))), i;
195
194
  }
196
- function v() {
195
+ function y() {
197
196
  return r;
198
197
  }
199
- function M() {
198
+ function v() {
200
199
  i = null, r = null;
201
200
  }
202
201
  function w(s) {
203
202
  return p(
204
203
  (async () => {
205
- switch (c(s?.surface)) {
206
- case n.OpenAI:
207
- return new g();
208
- case n.Mosaic:
209
- return {};
210
- case n.MicroFrontend:
211
- return a.create();
212
- // WebApp intentionally probes here: surface detection never returns
213
- // MCPApps, and after hardening the iframe detection (#567) MCP App
214
- // widgets fall through to WebApp. Short-term fix (W-23083001) — the
215
- // async getSurface end state is tracked separately.
216
- case n.WebApp:
217
- case n.MCPApps: {
218
- const e = await d.getInstance(s?.mcpApps);
219
- return e.handshakeSucceeded ? new f(e) : {};
204
+ try {
205
+ switch (await c(s?.surface)) {
206
+ case n.OpenAI:
207
+ return new g();
208
+ case n.WebApp:
209
+ case n.Mosaic:
210
+ return {};
211
+ case n.MicroFrontend:
212
+ return await a.create();
213
+ case n.MCPApps: {
214
+ const e = await d.getInstance();
215
+ return new f(e);
216
+ }
217
+ default:
218
+ return {};
220
219
  }
221
- default:
222
- return {};
220
+ } catch {
221
+ return {};
223
222
  }
224
223
  })(),
225
224
  "createChatSDK"
@@ -228,7 +227,7 @@ function w(s) {
228
227
  export {
229
228
  f as MCPAppsChatSDK,
230
229
  w as createChatSDK,
231
- y as getChatSDK,
232
- v as getChatSDKSync,
233
- M as resetChatSDK
230
+ C as getChatSDK,
231
+ y as getChatSDKSync,
232
+ v as resetChatSDK
234
233
  };
@@ -3,14 +3,15 @@
3
3
  * All rights reserved.
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
- export { Surface, getSurface, isSfEmbeddingIframe } from './surface';
6
+ export { Surface, getVerifiedSurface, initialize, isSfEmbeddingIframe, resetSurface, } from './surface';
7
+ export type { InitializeOptions } from './surface';
7
8
  export type { SDKOptions } from './options';
8
9
  export type { HostContext, HostStyles, ChatMessage, ChatSDK, ContentBlock, DeviceCapabilities, DisplayMode, ResourceRequest, SafeAreaInsets, SetWidgetStateOptions, ToolCall, ToolState, } from './chat';
9
10
  export type { AlertOptions, MessageLevel, ModalOptions, ToastOptions, Theme, ThemeMode, ViewSDK, } from './view';
10
11
  export type { CacheControl, DataSDK, DataSDKGraphQL, GraphQLError, GraphQLRawDocument, GraphQLRequest, GraphQLResponse, MutateOptions, MutationResult, QueryOptions, QueryResult, QuerySubscriber, Unsubscribe, } from './data';
11
12
  export type { LightningSDK, LMSMessage, LMSSubscription, MessageChannel } from './lightning';
12
13
  export type { OpenAISDK } from './platforms';
13
- export { McpAppsSession } from './mcpapps-session';
14
+ export { McpAppsNotAvailableError, McpAppsSession } from './mcpapps-session';
14
15
  export type { McpAppsHostContext, McpAppsSessionOptions } from './mcpapps-session';
15
16
  export { getSurfaceCapabilities } from './capabilities';
16
17
  export type { SurfaceCapabilities } from './capabilities';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,YAAY,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,e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MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,SAAS,EACT,OAAO,GACP,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ,OAAO,EACP,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,WAAW,GACX,MAAM,QAAQ,CAAC;AAGhB,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7F,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -1,12 +1,14 @@
1
- import { S as a, g as s, i as o } from "../surface-DX5JCZPQ.js";
2
- import { M as p } from "../mcpapps-session-BThDrfRw.js";
3
- import { g as m } from "../capabilities-DtUMG0oZ.js";
4
- import { w as S } from "../sdk-promise-D0sy7OW1.js";
1
+ import { M as r, a as s, S as i, g as p, i as f, b as o, r as t } from "../surface-CEErnCgI.js";
2
+ import { g as c } from "../capabilities-CBmOyHnc.js";
3
+ import { w as g } from "../sdk-promise-D0sy7OW1.js";
5
4
  export {
6
- p as McpAppsSession,
7
- a as Surface,
8
- s as getSurface,
9
- m as getSurfaceCapabilities,
5
+ r as McpAppsNotAvailableError,
6
+ s as McpAppsSession,
7
+ i as Surface,
8
+ c as getSurfaceCapabilities,
9
+ p as getVerifiedSurface,
10
+ f as initialize,
10
11
  o as isSfEmbeddingIframe,
11
- S as wrapSDKPromise
12
+ t as resetSurface,
13
+ g as wrapSDKPromise
12
14
  };
@@ -72,9 +72,23 @@ export interface McpAppsSessionOptions {
72
72
  name: string;
73
73
  version: string;
74
74
  };
75
- /** Handshake timeout in milliseconds (default 5000) */
75
+ /** Handshake timeout in milliseconds (default 500) */
76
76
  handshakeTimeoutMs?: number;
77
77
  }
78
+ /**
79
+ * Thrown when the MCPApps surface is required but the SEP-1865 `ui/initialize`
80
+ * handshake has not succeeded.
81
+ *
82
+ * In practice this only surfaces on the `options.surface` override path: a
83
+ * caller forcing `{ surface: Surface.MCPApps }` bypasses detection, so the
84
+ * handshake may run (and time out) for the first time during verification.
85
+ * Detection never yields MCPApps without a live handshake, so the no-override
86
+ * path cannot raise this. Mirrors {@link SfEmbeddingNotAvailableError} for the
87
+ * MicroFrontend surface.
88
+ */
89
+ export declare class McpAppsNotAvailableError extends Error {
90
+ constructor();
91
+ }
78
92
  /**
79
93
  * Shared MCP Apps session singleton.
80
94
  *
@@ -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;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IAClC,sCAAsC;IACtC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,iCAAiC;IACjC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,2BAA2B;IAC3B,mBAAmB,CAAC,EAAE;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CA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AAI,GAChC,IAAI;CAGP"}
@@ -1,3 +1,4 @@
1
+ import { McpAppsSessionOptions } from './mcpapps-session';
1
2
  /**
2
3
  * Enumeration of possible runtime surfaces
3
4
  */
@@ -8,6 +9,49 @@ export declare enum Surface {
8
9
  MCPApps = "MCP-Apps",
9
10
  Mosaic = "Mosaic"
10
11
  }
12
+ /**
13
+ * Options for the one-time {@link initialize} lifecycle call. Modeled as a bag
14
+ * so new setup inputs can be added later without changing the signature or
15
+ * breaking callers.
16
+ */
17
+ export interface InitializeOptions {
18
+ /**
19
+ * MCP Apps session options (target origin, app identity, handshake timeout)
20
+ * applied if the SEP-1865 handshake probe runs during surface detection.
21
+ * These are per-widget-environment settings configured once for the page,
22
+ * which is why they live on the {@link initialize} lifecycle rather than on
23
+ * individual SDK factory options.
24
+ */
25
+ mcpApps?: McpAppsSessionOptions;
26
+ }
27
+ /**
28
+ * Initialize the SDK runtime: configure the MCP Apps session and run surface
29
+ * detection (including the handshake probe) exactly once.
30
+ *
31
+ * Calling this is **optional**. If an SDK factory or {@link getVerifiedSurface}
32
+ * runs first, detection is kicked off automatically with default options. Call
33
+ * `initialize` explicitly — before creating any SDK — only when you need to
34
+ * pass MCP Apps options (e.g. pin the host `targetOrigin`).
35
+ *
36
+ * Idempotent and first-call-wins: the first invocation starts detection and its
37
+ * options take effect; later calls (and concurrent ones) resolve to the same
38
+ * result. A page has one postMessage channel and one SEP-1865 handshake, so a
39
+ * second set of `mcpApps` options cannot be honored. A repeat call with no
40
+ * options or with options equal to the first is therefore a silent no-op (this
41
+ * is the SDK-factory auto-init path). But a repeat call whose `mcpApps` options
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.
47
+ *
48
+ * @param options - Optional configuration, applied only on the first call.
49
+ * @returns Promise resolving to the detected surface, or **rejecting** with an
50
+ * Error when called again with `mcpApps` options that differ from the options
51
+ * the first call established. The function is `async`, so the conflict is a
52
+ * promise rejection (awaitable / `.catch`-able), not a synchronous throw.
53
+ */
54
+ export declare function initialize(options?: InitializeOptions): Promise<Surface>;
11
55
  /**
12
56
  * True iff the current document is an iframe whose URL carries a valid
13
57
  * `hostMetaData` query parameter — i.e., the host LWC populated it during
@@ -17,10 +61,41 @@ export declare enum Surface {
17
61
  */
18
62
  export declare function isSfEmbeddingIframe(): boolean;
19
63
  /**
20
- * Returns the surface to use for SDK initialization.
64
+ * Resolves the surface to use for SDK initialization and verifies that the
65
+ * surface is actually usable, throwing if it is not.
66
+ *
67
+ * Always runs the one-time {@link initialize} first — on **both** the detection
68
+ * and the override paths. {@link initialize} is first-call-wins idempotent, so
69
+ * this only *runs* detection (and its handshake probe) when nothing has yet;
70
+ * otherwise it just awaits the established, in-flight or resolved result.
71
+ * Detection therefore still runs at most once per page.
72
+ *
73
+ * Initializing up front matters even when an `override` is supplied: it claims
74
+ * the lifecycle (sets the shared `initPromise` and captures the session config),
75
+ * so a later `initialize({ mcpApps })` that *conflicts* now correctly throws
76
+ * instead of silently establishing a second, defaults-based configuration. Doing
77
+ * the override's liveness probe via a bare {@link McpAppsSession.getInstance}
78
+ * (the previous behavior) left `initPromise` unset and let that footgun slip
79
+ * through — e.g. `createChatSDK({ surface: MCPApps })` then `initialize({ mcpApps })`
80
+ * would not throw. (W-23083001 review feedback.)
81
+ *
82
+ * Verification: only the `override` path adds a check, and only for MCPApps. An
83
+ * override bypasses detection's *result*, so a caller forcing
84
+ * {@link Surface.MCPApps} may not have a vetted handshake; if it has not
85
+ * succeeded this throws {@link McpAppsNotAvailableError}. The detection path
86
+ * needs no extra check: {@link detectSurface} only yields MCPApps after a
87
+ * successful handshake. The {@link McpAppsSession.getInstance} call is memoized
88
+ * and shared with detection, so in a real MCP Apps iframe this reuses the very
89
+ * session detection already built — no second handshake. This centralizes the
90
+ * liveness check the SDK factories previously each performed inline; factories
91
+ * catch the error and degrade to an empty SDK, mirroring how the MicroFrontend
92
+ * path handles {@link SfEmbeddingNotAvailableError}.
21
93
  *
22
- * Returns the override surface if provided, otherwise falls back
23
- * to the auto-detected surface.
94
+ * @param override - Optional explicit surface; overrides the detected *result*
95
+ * (detection itself still runs once to claim the lifecycle).
96
+ * @returns Promise resolving to the verified surface.
97
+ * @throws McpAppsNotAvailableError when MCPApps is required but the handshake
98
+ * has not succeeded.
24
99
  */
25
- export declare function getSurface(override?: Surface): Surface;
100
+ export declare function getVerifiedSurface(override?: Surface): Promise<Surface>;
26
101
  //# sourceMappingURL=surface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../src/core/surface.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,oBAAY,OAAO;IAClB,MAAM,WAAW;IACjB,aAAa,mBAAmB;IAChC,MAAM,WAAW;IACjB,OAAO,aAAa;IACpB,MAAM,WAAW;CACjB;AA2BD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAU7C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAEtD"}
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;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;CAChC;AA2FD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,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AgB,CAAC,CAAC,IAAI,CAAC,SAAS;IAC3C,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;CAC3B,GAAG,IAAI,GACL,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,GAClC,CAAC,GACD,KAAK,GACN,KAAK,CAAC"}
@@ -1,7 +1,7 @@
1
- import { g as L, S as m } from "../surface-DX5JCZPQ.js";
2
- import { w as x } from "../sdk-promise-D0sy7OW1.js";
1
+ import { g as L, S as m } from "../surface-CEErnCgI.js";
2
+ import { w as V } from "../sdk-promise-D0sy7OW1.js";
3
3
  import { buildServiceDescriptor as _, setHeader as y } from "@conduit-client/service-fetch-network/v1";
4
- import { resolvedPromiseLike as u, ok as w, err as C, stableJSONStringify as V, DataNotFoundError as Q, UserVisibleError as H, deepFreeze as b, isUserVisibleError as G } from "@conduit-client/utils";
4
+ import { resolvedPromiseLike as u, ok as w, err as C, stableJSONStringify as x, DataNotFoundError as Q, UserVisibleError as H, deepFreeze as b, isUserVisibleError as G } from "@conduit-client/utils";
5
5
  import { print as D, parse as K } from "@conduit-client/onestore-graphql-parser/v1";
6
6
  import { RetryPolicy as z, buildServiceDescriptor as W } from "@conduit-client/service-retry/v1";
7
7
  import { buildServiceDescriptor as j } from "@conduit-client/service-cache/v1";
@@ -196,7 +196,7 @@ class ie {
196
196
  })).structuredContent;
197
197
  }
198
198
  }
199
- const ce = "X-SFDC-Client-Name", ue = "X-SFDC-Client-Version", he = "@salesforce/platform-sdk", le = "10.24.0", de = (t) => {
199
+ const ce = "X-SFDC-Client-Name", ue = "X-SFDC-Client-Version", he = "@salesforce/platform-sdk", le = "11.1.0", de = (t) => {
200
200
  let e = y(ce, he, t);
201
201
  return e = y(ue, le, e), u(e);
202
202
  }, pe = "X-CSRF-Token";
@@ -386,7 +386,7 @@ class qe extends Y {
386
386
  ];
387
387
  }
388
388
  buildKey() {
389
- return V({
389
+ return x({
390
390
  query: this.query,
391
391
  variables: this.normalizedVariables,
392
392
  operationName: this.normalizedOperationName
@@ -603,20 +603,24 @@ function ze(t, ...e) {
603
603
  return r;
604
604
  }
605
605
  function We(t) {
606
- return x(
606
+ return V(
607
607
  (async () => {
608
- switch (L(t?.surface)) {
609
- case m.OpenAI:
610
- return new ie();
611
- case m.WebApp:
612
- case m.MicroFrontend:
613
- return new _e(t?.webapp);
614
- case m.Mosaic:
615
- return new ne(t?.mosaic);
616
- case m.MCPApps:
617
- return {};
618
- default:
619
- return {};
608
+ try {
609
+ switch (await L(t?.surface)) {
610
+ case m.OpenAI:
611
+ return new ie();
612
+ case m.WebApp:
613
+ case m.MicroFrontend:
614
+ return new _e(t?.webapp);
615
+ case m.Mosaic:
616
+ return new ne(t?.mosaic);
617
+ case m.MCPApps:
618
+ return {};
619
+ default:
620
+ return {};
621
+ }
622
+ } catch {
623
+ return {};
620
624
  }
621
625
  })(),
622
626
  "createDataSDK"
package/dist/index.js CHANGED
@@ -1,40 +1,42 @@
1
- import { S as t, g as a, i as o } from "./surface-DX5JCZPQ.js";
2
- import { M as S } from "./mcpapps-session-BThDrfRw.js";
3
- import { g as i } from "./capabilities-DtUMG0oZ.js";
4
- import { w as m } from "./sdk-promise-D0sy7OW1.js";
5
- import { MCPAppsChatSDK as D, createChatSDK as K, getChatSDK as g, getChatSDKSync as x, resetChatSDK as T } from "./chat/index.js";
6
- import { MCPAppsViewSDK as A, createViewSDK as n, getViewSDK as C, getViewSDKSync as w, resetViewSDK as E } from "./view/index.js";
7
- import { createDataSDK as _, gql as d } from "./data/index.js";
8
- import { createLightningSDK as y } from "./lightning/index.js";
9
- import { c as M } from "./transport-CdXFRgRc.js";
10
- import { T as u, r as L } from "./TelemetryUploader-DKkdppe9.js";
11
- import { A as b, I as v, P as F, c as U, v as Y } from "./analytics-Cgt83u0I.js";
1
+ import { M as a, a as t, S as s, g as o, i, b as p, r as S } from "./surface-CEErnCgI.js";
2
+ import { g as c } from "./capabilities-CBmOyHnc.js";
3
+ import { w as D } from "./sdk-promise-D0sy7OW1.js";
4
+ import { MCPAppsChatSDK as g, createChatSDK as l, getChatSDK as A, getChatSDKSync as x, resetChatSDK as T } from "./chat/index.js";
5
+ import { MCPAppsViewSDK as C, createViewSDK as E, getViewSDK as d, getViewSDKSync as w, resetViewSDK as M } from "./view/index.js";
6
+ import { createDataSDK as _, gql as h } from "./data/index.js";
7
+ import { createLightningSDK as I } from "./lightning/index.js";
8
+ import { c as b } from "./transport-CdXFRgRc.js";
9
+ import { T as N, r as v } from "./TelemetryUploader-DKkdppe9.js";
10
+ import { A as F, I as U, P as Y, c as q, v as z } from "./analytics-ygoSv0Cj.js";
12
11
  export {
13
- b as AXL_PFT_ID,
14
- v as INTERNAL_SESSION_META_KEY,
15
- D as MCPAppsChatSDK,
16
- A as MCPAppsViewSDK,
17
- S as McpAppsSession,
18
- F as PFT_META_KEY,
19
- t as Surface,
20
- u as TelemetryUploader,
21
- U as createAnalytics,
22
- K as createChatSDK,
12
+ F as AXL_PFT_ID,
13
+ U as INTERNAL_SESSION_META_KEY,
14
+ g as MCPAppsChatSDK,
15
+ C as MCPAppsViewSDK,
16
+ a as McpAppsNotAvailableError,
17
+ t as McpAppsSession,
18
+ Y as PFT_META_KEY,
19
+ s as Surface,
20
+ N as TelemetryUploader,
21
+ q as createAnalytics,
22
+ l as createChatSDK,
23
23
  _ as createDataSDK,
24
- y as createLightningSDK,
25
- M as createTelemetryTransport,
26
- n as createViewSDK,
27
- g as getChatSDK,
24
+ I as createLightningSDK,
25
+ b as createTelemetryTransport,
26
+ E as createViewSDK,
27
+ A as getChatSDK,
28
28
  x as getChatSDKSync,
29
- a as getSurface,
30
- i as getSurfaceCapabilities,
31
- C as getViewSDK,
29
+ c as getSurfaceCapabilities,
30
+ o as getVerifiedSurface,
31
+ d as getViewSDK,
32
32
  w as getViewSDKSync,
33
- d as gql,
34
- o as isSfEmbeddingIframe,
35
- L as registerTelemetryUploader,
33
+ h as gql,
34
+ i as initialize,
35
+ p as isSfEmbeddingIframe,
36
+ v as registerTelemetryUploader,
36
37
  T as resetChatSDK,
37
- E as resetViewSDK,
38
- Y as validatePftId,
39
- m as wrapSDKPromise
38
+ S as resetSurface,
39
+ M as resetViewSDK,
40
+ z as validatePftId,
41
+ D as wrapSDKPromise
40
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lightning/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGxD;;GAEG;AAEH,MAAM,WAAW,mBAAoB,SAAQ,UAAU;CAAG;AAE1D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,CAqBvF;AAED,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lightning/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGxD;;GAEG;AAEH,MAAM,WAAW,mBAAoB,SAAQ,UAAU;CAAG;AAE1D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,CA4BvF;AAED,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}