@base44-preview/platform 0.3.0-pr.340.d4da942 → 0.3.0-pr.341.64849bb

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
@@ -19,7 +19,7 @@ import { createPlatformClient } from "@base44/platform";
19
19
 
20
20
  const client = createPlatformClient();
21
21
  const chat = client.chat.init({
22
- // Returns the body of POST /api/service/socket-sessions, unchanged.
22
+ // Returns the body of POST /api/v1/socket-sessions, unchanged.
23
23
  async getSession() {
24
24
  const response = await fetch("/api/chat-socket-session", { method: "POST" });
25
25
  if (!response.ok) throw new Error("Session request failed");
@@ -98,12 +98,13 @@ Delivery is at least once with no ordering guarantee: deduplicate on `event.id`,
98
98
  ## Sessions
99
99
 
100
100
  `/api/chat-socket-session` is your backend's route, not an SDK endpoint. It opens a
101
- socket session with its workspace key (`apps:watch` scope) through
102
- `POST /api/service/socket-sessions` with `{ app_ids }`, and returns the response body
103
- to the browser. `getSession` returns that body unchanged: the SDK reads `session_token`,
101
+ socket session through `POST /api/v1/socket-sessions` with `{ app_ids }`, and returns the
102
+ response body to the browser. It authenticates as `Authorization: Bearer` with either a
103
+ personal access token, which can watch the apps its owner can edit in its workspace, or a
104
+ workspace API key with the `apps:watch` scope. The workspace needs the Builder plan or higher. `getSession` returns that body unchanged: the SDK reads `session_token`,
104
105
  `socket_url` and `socket_path` and ignores other keys such as `session_id` and
105
- `expires_in`. Never pass the workspace key or any other server credential to this client. Subscribe only to apps on the session's allowlist; your
106
- backend adds or removes apps with `PUT`/`DELETE /api/service/socket-sessions/{session_id}/rooms/{app_id}`.
106
+ `expires_in`. Never pass the token, the workspace key or any other server credential to this client. Subscribe only to apps on the session's allowlist; your
107
+ backend adds or removes apps with `PUT`/`DELETE /api/v1/socket-sessions/{session_id}/apps/{app_id}`.
107
108
 
108
109
  A session lasts one hour and is never extended. The token goes exclusively in
109
110
  CONNECT `auth.session_token`, never a URL, and the SDK keeps it in memory only. It
@@ -161,7 +162,7 @@ their exceptions are isolated so they cannot interrupt another app's delivery.
161
162
 
162
163
  ## Public shapes
163
164
 
164
- - `PlatformClient` (`client.types.ts`): the `chat` module (`builder` is a deprecated alias).
165
+ - `PlatformClient` (`client.types.ts`): the `chat` module.
165
166
  - `ChatModule` (`modules/chat.types.ts`): lazy `init(options)` factory.
166
167
  - `ChatInitOptions`: `getSession` and the connection-level `onError` observer.
167
168
  - `SocketSession`: the `session_token`, `socket_url` and `socket_path` that `getSession` returns.
@@ -28,6 +28,5 @@ import { createChat } from "./modules/chat.js";
28
28
  * ```
29
29
  */
30
30
  export function createPlatformClient() {
31
- const chat = Object.freeze(createChat());
32
- return Object.freeze({ chat, builder: chat });
31
+ return Object.freeze({ chat: Object.freeze(createChat()) });
33
32
  }
@@ -7,9 +7,4 @@ import type { ChatModule } from "./modules/chat.types.js";
7
7
  export interface PlatformClient {
8
8
  /** [Chat module](/developers/references/platform-sdk/docs/interfaces/chat) for following the AI chat in your users' apps live. */
9
9
  readonly chat: ChatModule;
10
- /**
11
- * @deprecated Renamed to {@linkcode chat}, the same module. Removed in 1.0.
12
- * @hidden
13
- */
14
- readonly builder: ChatModule;
15
10
  }
@@ -4,6 +4,5 @@ export { PlatformSocketError } from "./errors.js";
4
4
  export type { AppErrorCode, PlatformSocketErrorCode, SessionErrorCode } from "./errors.types.js";
5
5
  export type { PlatformClient } from "./client.types.js";
6
6
  export type { ChatModule, ChatInitOptions, ChatSession, PlatformSubscription, SocketSession, SubscriptionOptions } from "./modules/chat.types.js";
7
- export type { BuilderInitOptions, BuilderModule, BuilderSession } from "./modules/chat.types.js";
8
7
  export type { GuardApproval, PlatformEvent, PlatformEventMap, PlatformSnapshot, ToolCall } from "./modules/chat.events.types.js";
9
8
  export type * from "./modules/chat.events.generated.js";
@@ -191,18 +191,3 @@ export interface PlatformSubscription {
191
191
  */
192
192
  unsubscribe(): void;
193
193
  }
194
- /**
195
- * @deprecated Renamed to {@linkcode ChatModule}. Removed in 1.0.
196
- * @hidden
197
- */
198
- export type BuilderModule = ChatModule;
199
- /**
200
- * @deprecated Renamed to {@linkcode ChatSession}. Removed in 1.0.
201
- * @hidden
202
- */
203
- export type BuilderSession = ChatSession;
204
- /**
205
- * @deprecated Renamed to {@linkcode ChatInitOptions}. Removed in 1.0.
206
- * @hidden
207
- */
208
- export type BuilderInitOptions = ChatInitOptions;
@@ -32,7 +32,7 @@ export interface ToolCallAnswer {
32
32
  *
33
33
  * Base44 keeps the Send chat message and Submit tool-call input requests open until the AI
34
34
  * finishes the turn. Resolve your call once Base44 accepts the request, not when it returns. The
35
- * chat follows the rest live. A rejected promise from any call sets {@link Base44Chat.error}.
35
+ * chat follows the rest live. A rejected promise from any call sets `error` on the {@link useBase44Chat | chat}.
36
36
  *
37
37
  * @example
38
38
  * ```typescript
@@ -141,10 +141,10 @@ export interface ChatAnswer {
141
141
  * An open question, with the actions that answer this question and no other.
142
142
  *
143
143
  * Each kind carries only the actions that make sense for it, and every kind can be declined. The
144
- * actions never throw. A failure sets {@link Base44Chat.error}, and the question opens again.
144
+ * actions never throw. A failure sets `error` on the {@link useBase44Chat | chat}, and the question opens again.
145
145
  *
146
146
  * The chat declines a question kind this release doesn't know, once per tool call, when Base44
147
- * names that kind on the last assistant message. If the decline fails, {@link Base44Chat.error} says
147
+ * names that kind on the last assistant message. If the decline fails, the chat's `error` says
148
148
  * so, and the chat tries again after it reconnects.
149
149
  */
150
150
  export type ChatQuestion = ChoiceQuestion | SecretsQuestion | ApprovalQuestion;
@@ -138,10 +138,10 @@ export interface WebhookTestV1Data {
138
138
  challenge: string;
139
139
  }
140
140
  /**
141
- * Sent when the builder picks the message up, not when it is received: a
141
+ * Sent when the AI picks the message up, not when it is received: a
142
142
  * message sent while another turn runs waits in the queue until then.
143
143
  */
144
- export interface BuilderTurnStartedV1Data {
144
+ export interface ChatTurnStartedV1Data {
145
145
  /**
146
146
  * The app the event is about.
147
147
  */
@@ -163,7 +163,7 @@ export interface BuilderTurnStartedV1Data {
163
163
  */
164
164
  conversation_id?: string;
165
165
  /**
166
- * When the builder started working on the message (UTC).
166
+ * When the AI started working on the message (UTC).
167
167
  */
168
168
  started_at: string;
169
169
  /**
@@ -172,9 +172,9 @@ export interface BuilderTurnStartedV1Data {
172
172
  continues_message_id?: string;
173
173
  }
174
174
  /**
175
- * The `data` object of `builder.turn_ended.v1`. The builder finished responding to a message.
175
+ * The `data` object of `chat.turn_ended.v1`. The AI finished responding to a message.
176
176
  */
177
- export interface BuilderTurnEndedV1Data {
177
+ export interface ChatTurnEndedV1Data {
178
178
  /**
179
179
  * The app the event is about.
180
180
  */
@@ -196,7 +196,7 @@ export interface BuilderTurnEndedV1Data {
196
196
  */
197
197
  conversation_id?: string;
198
198
  /**
199
- * When the builder started working on the message (UTC).
199
+ * When the AI started working on the message (UTC).
200
200
  */
201
201
  started_at: string;
202
202
  /**
@@ -204,7 +204,7 @@ export interface BuilderTurnEndedV1Data {
204
204
  */
205
205
  continues_message_id?: string;
206
206
  /**
207
- * How the turn ended. `finished`: the builder replied and has nothing pending. `waiting_for_user_input`: the builder stopped to ask something, such as a clarifying question or a plan to approve, and continues when the next message answers it. `failed`: the turn hit an error. `cancelled`: the turn was stopped before it ended. `interrupted`: the builder was interrupted, for example by a restart, and continues the work in a new turn whose `continues_message_id` is this message.
207
+ * How the turn ended. `finished`: the AI replied and has nothing pending. `waiting_for_user_input`: the AI stopped to ask something, such as a clarifying question or a plan to approve, and continues when the next message answers it. `failed`: the turn hit an error. `cancelled`: the turn was stopped before it ended. `interrupted`: the AI was interrupted, for example by a restart, and continues the work in a new turn whose `continues_message_id` is this message.
208
208
  */
209
209
  status: "finished" | "waiting_for_user_input" | "failed" | "cancelled" | "interrupted";
210
210
  /**
@@ -226,10 +226,10 @@ export interface WebhookEventMap {
226
226
  "app.restored.v1": AppRestoredV1Data;
227
227
  /** Carries no domain data — its only job is to be verifiable and echoed. */
228
228
  "webhook.test.v1": WebhookTestV1Data;
229
- /** Sent when the builder picks the message up, not when it is received: a */
230
- "builder.turn_started.v1": BuilderTurnStartedV1Data;
231
- /** The builder finished responding to a message. */
232
- "builder.turn_ended.v1": BuilderTurnEndedV1Data;
229
+ /** Sent when the AI picks the message up, not when it is received: a */
230
+ "chat.turn_started.v1": ChatTurnStartedV1Data;
231
+ /** The AI finished responding to a message. */
232
+ "chat.turn_ended.v1": ChatTurnEndedV1Data;
233
233
  }
234
234
  /** Every event type in {@link WebhookEventMap}, so events from a newer Base44 can be told apart at runtime. @internal */
235
- export declare const WEBHOOK_EVENT_TYPES: readonly ["app.created.v1", "app.published.v1", "app.unpublished.v1", "app.deleted.v1", "app.restored.v1", "webhook.test.v1", "builder.turn_started.v1", "builder.turn_ended.v1"];
235
+ export declare const WEBHOOK_EVENT_TYPES: readonly ["app.created.v1", "app.published.v1", "app.unpublished.v1", "app.deleted.v1", "app.restored.v1", "webhook.test.v1", "chat.turn_started.v1", "chat.turn_ended.v1"];
@@ -1,4 +1,4 @@
1
1
  // Generated by scripts/generate-webhook-types.mjs from the schemas published at
2
2
  // https://base44.com/webhooks/schemas. Do not edit by hand; run `npm run generate:webhooks`.
3
3
  /** Every event type in {@link WebhookEventMap}, so events from a newer Base44 can be told apart at runtime. @internal */
4
- export const WEBHOOK_EVENT_TYPES = ["app.created.v1", "app.published.v1", "app.unpublished.v1", "app.deleted.v1", "app.restored.v1", "webhook.test.v1", "builder.turn_started.v1", "builder.turn_ended.v1"];
4
+ export const WEBHOOK_EVENT_TYPES = ["app.created.v1", "app.published.v1", "app.unpublished.v1", "app.deleted.v1", "app.restored.v1", "webhook.test.v1", "chat.turn_started.v1", "chat.turn_ended.v1"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/platform",
3
- "version": "0.3.0-pr.340.d4da942",
3
+ "version": "0.3.0-pr.341.64849bb",
4
4
  "description": "Base44 Platform SDK for white-label platforms: a browser client for following the AI chat and a server entrypoint for webhooks",
5
5
  "main": "dist/client/index.js",
6
6
  "types": "dist/client/index.d.ts",