@ai4b-team/fsaos-gateway-sdk 5.1.1 → 5.2.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/README.md +20 -0
- package/dist/iife/gateway.js +4 -4
- package/dist/iife/gateway.js.map +3 -3
- package/dist/iife/ui.js +1 -1
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -851,6 +851,13 @@ declare global {
|
|
|
851
851
|
tracking?: {
|
|
852
852
|
enabled?: boolean;
|
|
853
853
|
};
|
|
854
|
+
/** The page's own host holds the session. Set by a host that serves the
|
|
855
|
+
* page and forwards its kernel calls to the gateway itself, attaching
|
|
856
|
+
* the caller's identity there (a RevDev desk preview). `gatewayUrl` is
|
|
857
|
+
* that host's forwarding address. The SDK then sends no bearer, does
|
|
858
|
+
* not wait for a sign-in, and opens no realtime connection: the page
|
|
859
|
+
* holds no credential and the host has no event stream to offer. */
|
|
860
|
+
hostSession?: boolean;
|
|
854
861
|
};
|
|
855
862
|
}
|
|
856
863
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -851,6 +851,13 @@ declare global {
|
|
|
851
851
|
tracking?: {
|
|
852
852
|
enabled?: boolean;
|
|
853
853
|
};
|
|
854
|
+
/** The page's own host holds the session. Set by a host that serves the
|
|
855
|
+
* page and forwards its kernel calls to the gateway itself, attaching
|
|
856
|
+
* the caller's identity there (a RevDev desk preview). `gatewayUrl` is
|
|
857
|
+
* that host's forwarding address. The SDK then sends no bearer, does
|
|
858
|
+
* not wait for a sign-in, and opens no realtime connection: the page
|
|
859
|
+
* holds no credential and the host has no event stream to offer. */
|
|
860
|
+
hostSession?: boolean;
|
|
854
861
|
};
|
|
855
862
|
}
|
|
856
863
|
}
|
package/dist/index.js
CHANGED
|
@@ -251,6 +251,7 @@ var EnforcementDeniedError = class _EnforcementDeniedError extends Error {
|
|
|
251
251
|
};
|
|
252
252
|
var CONFIG = typeof window !== "undefined" && window.__FSAOS_CONFIG__ || {};
|
|
253
253
|
var PUBLIC_SOURCES = Array.isArray(CONFIG.sources) ? CONFIG.sources : [];
|
|
254
|
+
var HOST_SESSION = CONFIG.hostSession === true;
|
|
254
255
|
var SUPABASE_URL = CONFIG.supabaseUrl || "https://vahbmsslxuustnlvsrkg.supabase.co";
|
|
255
256
|
var SUPABASE_ANON_KEY = CONFIG.supabaseAnonKey || "sb_publishable_ZjosozAjfpZ4InMNElTr6Q_hHB-f5nc";
|
|
256
257
|
var GATEWAY_URL = CONFIG.gatewayUrl || "https://fsaos-mcp-gw-rust.fly.dev";
|
|
@@ -296,6 +297,7 @@ function clearCachedToken() {
|
|
|
296
297
|
}
|
|
297
298
|
async function getAccessToken() {
|
|
298
299
|
const cfg = typeof window !== "undefined" && window.__FSAOS_CONFIG__ || {};
|
|
300
|
+
if (cfg.hostSession === true) return null;
|
|
299
301
|
if (cfg.embedToken) {
|
|
300
302
|
if (typeof cfg.embedToken === "function") {
|
|
301
303
|
try {
|
|
@@ -1215,6 +1217,10 @@ function hasActiveSubscriptions() {
|
|
|
1215
1217
|
return activeScopes.size > 0 || activePaths.size > 0;
|
|
1216
1218
|
}
|
|
1217
1219
|
async function ensureConnection() {
|
|
1220
|
+
if (HOST_SESSION) {
|
|
1221
|
+
log("ensureConnection: the host holds the session, no realtime connection");
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1218
1224
|
if (!hasActiveSubscriptions()) {
|
|
1219
1225
|
log("ensureConnection: no active subscriptions, skipping");
|
|
1220
1226
|
return;
|
|
@@ -1545,6 +1551,7 @@ function getPathSubscriptionState(path) {
|
|
|
1545
1551
|
}
|
|
1546
1552
|
function waitForPathReady(path, timeoutMs = 5e3) {
|
|
1547
1553
|
if (!activePaths.has(path)) return Promise.resolve(false);
|
|
1554
|
+
if (HOST_SESSION) return Promise.resolve(false);
|
|
1548
1555
|
if (pathStates.get(path) === "ready" && ws && ws.readyState === WebSocket.OPEN) {
|
|
1549
1556
|
return Promise.resolve(true);
|
|
1550
1557
|
}
|