@ai4b-team/fsaos-gateway-sdk 5.2.0 → 5.4.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 CHANGED
@@ -335,23 +335,43 @@ bootstrap automatically.
335
335
 
336
336
  ### A host that holds the session
337
337
 
338
- A host that serves the page and forwards its kernel calls to the gateway itself
339
- sets `hostSession`, with `gatewayUrl` pointing at its own forwarding address. A
340
- RevDev desk preview does this: the preview host attaches the identity of
341
- whoever asked for the preview, so the page never holds a credential.
338
+ A page can run with no session of its own: the app that frames it makes its
339
+ kernel calls. A RevDev desk preview inside the builder works this way. The
340
+ previewed page holds no credential and nothing secret is in its address; its
341
+ calls go through the same gateway door, as the same person, as the app around
342
+ it.
343
+
344
+ The framed page is started with `hostSession` and meets its host before it
345
+ renders:
342
346
 
343
347
  ```ts
344
- window.__FSAOS_CONFIG__ = {
345
- hostSession: true,
346
- gatewayUrl: `${location.origin}/__fsaos_gateway`,
347
- };
348
+ window.__FSAOS_CONFIG__ = { hostSession: true };
349
+
350
+ const { connectHostSession } = await import('@ai4b-team/fsaos-gateway-sdk');
351
+ const { item } = await connectHostSession(); // sets the host's anchor; `item` is what the app is handed
352
+ ```
353
+
354
+ The host answers one frame, and stops when the frame goes away:
355
+
356
+ ```ts
357
+ const stop = serveHostSession({
358
+ frame: () => iframe.contentWindow,
359
+ origin: 'https://desk-1-preview.example',
360
+ item: () => envelope,
361
+ });
348
362
  ```
349
363
 
350
- With `hostSession` the SDK sends no bearer, does not wait for a sign-in, and
351
- opens no realtime connection. Kernel calls and tool calls work; change events
352
- do not arrive, so a read made with `useRealtimeQuery` runs once and is not
353
- refreshed. Set the anchor (`setAnchor(scopePath)`) before the first call, as
354
- on any page.
364
+ With `hostSession` every `gatewayCall` (and so every hook and `callTool`) goes
365
+ to the host, which makes it with its own token and anchor and passes back the
366
+ same response or the same error. The page sends no bearer, does not wait for a
367
+ sign-in, and opens no realtime connection: change events do not arrive, so a
368
+ read made with `useRealtimeQuery` runs once and is not refreshed. Outside its
369
+ host (opened in its own tab) the page has no session, and
370
+ `connectHostSession()` rejects with `HostSessionUnavailableError`.
371
+
372
+ The framed page's code runs as the signed-in person for as long as it is
373
+ served, as a screen opened inside the app does. Serve only a frame the person
374
+ chose to open.
355
375
 
356
376
  ## Build
357
377