@theoremjs/web 0.3.4-next.419.g1bc04b7 → 0.3.4-next.421.g4bac1c7
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 +1 -1
- package/client/chat.d.ts +7 -0
- package/client/chat.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -177,7 +177,7 @@ await chat.submit();
|
|
|
177
177
|
|
|
178
178
|
- `getState()` returns a `ChatState`. It is a new object after each change, and the same object between changes. So you can compare it by reference, as React's `useSyncExternalStore` does.
|
|
179
179
|
- `subscribe(listener)` calls the listener once for each group of changes, after the code that made them has run. It returns the function that unsubscribes. Until the first subscribe or send, the chat asks nothing of the host. Then it reads a resumed conversation that came without its `conversationView`, and answers a restored page gate as unanswered.
|
|
180
|
-
- `update(options)` gives the controller your latest options, such as a new `context`, `slots`, or `pageTools`. Each turn reads the options as they are when it is sent. `conversation`, `conversationView`, and `
|
|
180
|
+
- `update(options)` gives the controller your latest options, such as a new `context`, `slots`, or `pageTools`. Each turn reads the options as they are when it is sent. `conversation`, `conversationView`, `initialText`, `initialFiles`, and `initialPending` are read only when the controller is created.
|
|
181
181
|
- Each method is bound to the controller. Pass it as a callback as it is.
|
|
182
182
|
|
|
183
183
|
`state.phase` is `'idle'`, `'streaming'`, or `'gated'`. The methods for the composer depend on it:
|
package/client/chat.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ export type ChatOptions = {
|
|
|
21
21
|
conversationView?: ConversationView;
|
|
22
22
|
/** The text the composer starts with. Read once, when the chat is created. */
|
|
23
23
|
initialText?: string;
|
|
24
|
+
/** The files the composer starts with, staged to send. Read once, when the chat is created. */
|
|
25
|
+
initialFiles?: readonly File[];
|
|
26
|
+
/**
|
|
27
|
+
* The messages the composer starts with set aside: queued, stashed or steering. Read once, when
|
|
28
|
+
* the chat is created.
|
|
29
|
+
*/
|
|
30
|
+
initialPending?: readonly ComposerPendingMessage[];
|
|
24
31
|
/**
|
|
25
32
|
* Each new ref the host issues for the conversation: once the message posts, and again as the
|
|
26
33
|
* reply's runs are saved. Keep the latest to resume the chat later. `undefined` when the host
|
package/client/chat.js
CHANGED
|
@@ -120,9 +120,9 @@ class Chat {
|
|
|
120
120
|
streamBlocks: [],
|
|
121
121
|
chatStarted: false,
|
|
122
122
|
draftText: options.initialText ?? '',
|
|
123
|
-
pendingFiles: [],
|
|
123
|
+
pendingFiles: [...(options.initialFiles ?? [])],
|
|
124
124
|
pendingVoice: [],
|
|
125
|
-
pendingMessages: [],
|
|
125
|
+
pendingMessages: orderComposerPendingMessages([...(options.initialPending ?? [])]),
|
|
126
126
|
issues: [],
|
|
127
127
|
failure: null,
|
|
128
128
|
answering: null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theoremjs/web",
|
|
3
|
-
"version": "0.3.4-next.
|
|
3
|
+
"version": "0.3.4-next.421.g4bac1c7",
|
|
4
4
|
"description": "Theorem on the web platform, with no UI framework: Web-standard server handlers that serve a profile, and the browser client that talks to them.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"zod": "^4.6.5",
|
|
28
|
-
"@theoremjs/agents": "^0.3.4-next.
|
|
28
|
+
"@theoremjs/agents": "^0.3.4-next.421.g4bac1c7"
|
|
29
29
|
}
|
|
30
30
|
}
|