@base44-preview/platform 0.2.0-pr.315.8896ad8 → 0.2.0-pr.315.9332712

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
@@ -196,5 +196,4 @@ the first, and the chat watches it while `appId` is `null`. A sent prompt shows
196
196
  `pending` item until Base44's own message arrives; a prompt sent mid-build waits in Base44's
197
197
  queue meanwhile. A question is a union on `kind` (`choice`, `secrets`, `approval`) and carries only the
198
198
  actions its kind allows, and declining is always one of them. As in Base44's builder, only the
199
- last assistant message makes the chat wait; a kind this release doesn't know is declined for you. Every shape has JSDoc in `src/react/chat.types.ts`, and
200
- [`examples/react-chat/`](examples/react-chat) shows Tiny Sunny's chat built on it, with its `backend`.
199
+ last assistant message makes the chat wait; a kind this release doesn't know is declined for you. Every shape has JSDoc in `src/react/chat.types.ts`.
@@ -34,6 +34,23 @@ export interface ToolCallAnswer {
34
34
  * Base44 holds `sendMessage` and `submitToolCallInput` open for the whole turn, so resolve once
35
35
  * the request is accepted rather than when it returns: the live session shows the rest.
36
36
  * A rejected promise from any of them lands in {@link Base44Chat.error}.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * // Your four calls, behind your own API routes
41
+ * async function post<T>(path: string, body: unknown): Promise<T> {
42
+ * const response = await fetch(path, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });
43
+ * if (!response.ok) throw new Error(`${path} failed: ${response.status}`);
44
+ * return response.json();
45
+ * }
46
+ *
47
+ * const backend: Base44ChatBackend = {
48
+ * createApp: (prompt) => post("/api/chat/apps", { prompt }),
49
+ * openLiveSession: (appId) => post("/api/chat/session", { appId }),
50
+ * sendMessage: (appId, content) => post("/api/chat/message", { appId, content }),
51
+ * submitToolCallInput: (appId, answer) => post("/api/chat/answer", { appId, answer }),
52
+ * };
53
+ * ```
37
54
  */
38
55
  export interface Base44ChatBackend {
39
56
  /** Creates an app from its first prompt. The build starts inside this call. */
@@ -21,7 +21,7 @@ import type { Base44Chat, Base44ChatOptions } from "./chat.types.js";
21
21
  *
22
22
  * @example
23
23
  * ```typescript
24
- * // Render the items, answer a question
24
+ * // Draw the chat and answer an approval
25
25
  * const chat = useBase44Chat({ appId, backend, onAppCreated: selectApp });
26
26
  * return (
27
27
  * <>
@@ -28,7 +28,7 @@ const creating = "creating";
28
28
  *
29
29
  * @example
30
30
  * ```typescript
31
- * // Render the items, answer a question
31
+ * // Draw the chat and answer an approval
32
32
  * const chat = useBase44Chat({ appId, backend, onAppCreated: selectApp });
33
33
  * return (
34
34
  * <>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/platform",
3
- "version": "0.2.0-pr.315.8896ad8",
3
+ "version": "0.2.0-pr.315.9332712",
4
4
  "description": "Client and server SDK for building on the Base44 platform",
5
5
  "main": "dist/client/index.js",
6
6
  "types": "dist/client/index.d.ts",