@base44-preview/sdk 0.8.48-pr.282.554ee7b → 0.8.48-pr.282.5d5566b

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.
@@ -11,8 +11,9 @@ interface ActorsConfig {
11
11
  appId: string;
12
12
  /** Current user access token, if authenticated. Rides the WS query on the
13
13
  * proxy-fallback path so the platform proxy can authenticate the connection;
14
- * anonymous connects omit it. */
15
- getAuthToken(): string | null | undefined | Promise<string | null | undefined>;
14
+ * anonymous connects omit it. Awaited per dial, so a session still being
15
+ * exchanged is in hand before the URL is built. */
16
+ getAuthToken(): Promise<string | null | undefined>;
16
17
  /** Same semantics as function calls: editors with a non-prod version get the
17
18
  * draft actor script; everyone else gets the published one. */
18
19
  functionsVersion?: string;
@@ -161,7 +161,7 @@ export interface AgentsModuleConfig {
161
161
  /** Server URL */
162
162
  serverUrl?: string;
163
163
  /** Returns the current authentication token, if any */
164
- getToken: () => string | null | undefined;
164
+ getToken: () => string | null;
165
165
  }
166
166
  /**
167
167
  * Agents module for managing AI agent conversations.
@@ -360,7 +360,9 @@ export interface AgentsModule {
360
360
  * Gets WhatsApp connection URL for an agent.
361
361
  *
362
362
  * Generates a URL that users can use to connect with the agent through WhatsApp.
363
- * The URL includes authentication if a token is available.
363
+ * The URL includes authentication if a token is available. In an app a
364
+ * platform has embedded, that is only once the session has been exchanged —
365
+ * await a call such as `base44.auth.me()` before building the URL.
364
366
  *
365
367
  * @param agentName - The name of the agent.
366
368
  * @returns WhatsApp connection URL.
@@ -378,7 +380,9 @@ export interface AgentsModule {
378
380
  * Gets Telegram connection URL for an agent.
379
381
  *
380
382
  * Generates a URL that users can use to connect with the agent through Telegram.
381
- * The URL includes authentication if a token is available. When the user opens
383
+ * The URL includes authentication if a token is available. In an app a
384
+ * platform has embedded, that is only once the session has been exchanged —
385
+ * await a call such as `base44.auth.me()` before building the URL. When the user opens
382
386
  * this URL, they are redirected to the agent's Telegram bot with an activation
383
387
  * code that securely links their account.
384
388
  *
@@ -98,16 +98,11 @@ export interface AuthModuleOptions {
98
98
  * which is how the server-side SDK reports a token it never sets explicitly.
99
99
  */
100
100
  token?: string;
101
- /**
102
- * Whether this client runs embedded in a host platform's frame, where a
103
- * session is minted by the platform and cannot be renewed by a login redirect.
104
- */
101
+ /** Whether a host platform embedded this client in a frame. */
105
102
  embedded?: boolean;
106
103
  /**
107
- * Called whenever the identity changes: `true` when a token is set, `false`
108
- * on logout. Lets the client reach what holds its own copy of the identity —
109
- * the realtime socket, which carries a token on the handshake and so has to
110
- * open a new connection to pick one up, or drop the one it has.
104
+ * Called when the identity changes: `true` on `setToken`, `false` on
105
+ * `logout`. Lets the client redial the socket, which holds its own copy.
111
106
  */
112
107
  onSessionChange?: (hasSession: boolean) => void;
113
108
  }
@@ -192,13 +187,13 @@ export interface AuthModule {
192
187
  */
193
188
  redirectToLogin(nextUrl: string): void;
194
189
  /**
195
- * Whether the app is running embedded in a host platform.
190
+ * Whether a host platform embedded this app and signed its user in.
196
191
  *
197
- * A platform embeds an app in an iframe and signs its user in by minting a one-time token onto the frame's URL; the SDK trades it for a session as the client is created. That session is held in memory only and can be renewed only by the platform, so when it ends there is no login page to send the user to — {@linkcode AuthModule.redirectToLogin | redirectToLogin()} and {@linkcode AuthModule.logout | logout()} show a "session ended" notice instead. Use this to render your own notice or to hide sign-in and sign-out controls that cannot work inside the frame.
192
+ * Only the platform can renew that session, so {@linkcode AuthModule.redirectToLogin | redirectToLogin()} and {@linkcode AuthModule.logout | logout()} show a "session ended" notice rather than a login page. Use this to render your own notice, or to hide sign-in controls that cannot work in the frame.
198
193
  *
199
- * Because the session lives in memory, it does not survive a full page load inside the frame: routing within the app keeps it, while a reload or a real navigation ends it and the platform has to embed the app again — and this returns `false` on that load, since nothing about it says it was embedded. Prefer client-side navigation in an embedded app.
194
+ * The session lives in memory, so a reload inside the frame ends it and returns `false` here. Prefer client-side navigation.
200
195
  *
201
- * @returns `true` when the app was embedded by a host platform, `false` otherwise.
196
+ * @returns `true` when a host platform embedded this app.
202
197
  *
203
198
  * @example
204
199
  * ```typescript
@@ -569,9 +564,6 @@ export interface InternalAuthModule extends AuthModule {
569
564
  * could not succeed without a session, not to decide that one is valid.
570
565
  */
571
566
  hasToken(): boolean;
572
- /**
573
- * The access token currently set on the client, or `null` when there is none.
574
- * Follows {@linkcode AuthModule.setToken | setToken} and {@linkcode AuthModule.logout | logout}.
575
- */
567
+ /** The token currently set on the client, or `null`. */
576
568
  getToken(): string | null;
577
569
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.48-pr.282.554ee7b",
3
+ "version": "0.8.48-pr.282.5d5566b",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",