@dudousxd/nestjs-agent-react 0.27.0 → 0.28.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 +15 -2
- package/dist/{client-DNM5Qm5N.d.cts → client-CKwSMitS.d.cts} +18 -0
- package/dist/{client-DNM5Qm5N.d.ts → client-CKwSMitS.d.ts} +18 -0
- package/dist/genui-json-render.cjs +202 -370
- package/dist/genui-json-render.cjs.map +1 -1
- package/dist/genui-json-render.js +209 -373
- package/dist/genui-json-render.js.map +1 -1
- package/dist/genui.cjs +178 -320
- package/dist/genui.cjs.map +1 -1
- package/dist/genui.js +185 -323
- package/dist/genui.js.map +1 -1
- package/dist/index.cjs +1982 -2722
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -10
- package/dist/index.d.ts +72 -10
- package/dist/index.js +2008 -2730
- package/dist/index.js.map +1 -1
- package/dist/markdown.cjs +23 -36
- package/dist/markdown.cjs.map +1 -1
- package/dist/markdown.js +23 -28
- package/dist/markdown.js.map +1 -1
- package/dist/media.cjs +46 -79
- package/dist/media.cjs.map +1 -1
- package/dist/media.d.cts +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/media.js +46 -81
- package/dist/media.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -37,8 +37,8 @@ handlers passed. On top of the AI SDK chat it returns:
|
|
|
37
37
|
| On `chat` | What it is |
|
|
38
38
|
|---|---|
|
|
39
39
|
| `transcript` | `useChatTranscript` already bound to the chat — approve/reject/answer/skip, stop, fork, regenerate, the tool catalog, and timestamps/usage read from message metadata. Override any of it with `useAgentChat({ transcript: { … } })`. |
|
|
40
|
-
| `composer` | `{ text, setText, files, canSend, blockedBy, submit() }` — `files` is `useAttachments` on the chat's backend; `submit()` sends the draft with the ready files attached and clears both — while a turn runs it QUEUES it (see *Typing ahead*); `blockedBy` is `'empty' \| 'busy' \| 'uploading' \| 'quota'` (`'busy'` only with `whileRunning: 'block'`). |
|
|
41
|
-
| `queue` | `{ items, paused, isSupported, add(text, { attachments?, mode? }), remove(id), edit(id, text), move(id, index), clear(), resume(), error }` — messages sent mid-turn, waiting server-side for the running turn to settle. |
|
|
40
|
+
| `composer` | `{ text, setText, files, canSend, blockedBy, submit() }` — `files` is `useAttachments` on the chat's backend; `submit()` sends the draft with the ready files attached and clears both — while a turn runs it QUEUES it (see *Typing ahead*), and `submit({ mode: 'interrupt' \| 'queue' })` picks what happens mid-turn for that one send; `blockedBy` is `'empty' \| 'busy' \| 'uploading' \| 'quota'` (`'busy'` only with `whileRunning: 'block'`). |
|
|
41
|
+
| `queue` | `{ items, paused, isSupported, add(text, { attachments?, mode? }), remove(id), interrupt(id), edit(id, text), move(id, index), clear(), resume(), error }` — messages sent mid-turn, waiting server-side for the running turn to settle. |
|
|
42
42
|
| `models` | `{ list, providers, selected, pinned, locked, select(id), pinToThread(id) }` — loaded the first time `list` is read. |
|
|
43
43
|
| `quota` / `blocked` | `useQuota`'s state, and the window blocking sends (the `blocked` option overrides it). |
|
|
44
44
|
| `approve` / `reject` / `answer` / `skip` | `({ toolCallId, … })` — the same object shape the transcript's handlers take. |
|
|
@@ -607,8 +607,21 @@ const chat = useAgentChat({ threadId });
|
|
|
607
607
|
- `useAgentChat({ whileRunning })`: `'queue'` (default), `'interrupt'` (cancel the running turn and
|
|
608
608
|
run this next), or `'block'` (refuse, `composer.blockedBy === 'busy'` — the old behaviour, also
|
|
609
609
|
what a backend without `enqueueMessage` gets).
|
|
610
|
+
- One send can answer differently from the chat's `whileRunning`: `composer.submit({ mode })` and
|
|
611
|
+
`sendMessage(message, { mode })` take `'queue'` or `'interrupt'` — a "send now" button next to a
|
|
612
|
+
plain send that queues. The composer clears its own draft and files either way; with nothing
|
|
613
|
+
running, `mode` means nothing and the message is simply sent. It also lifts `'block'` for that
|
|
614
|
+
send.
|
|
610
615
|
- `chat.queue.edit(id, text)`, `move(id, index)`, `remove(id)`, `clear()` change what is waiting;
|
|
611
616
|
`add(text, { attachments, mode })` queues from your own code.
|
|
617
|
+
- `chat.queue.interrupt(id)` runs a message that is already waiting NOW: it moves to the head as an
|
|
618
|
+
interrupt and the running turn is cancelled for it, in one server call (the message keeps its id
|
|
619
|
+
and never leaves the queue — do not `remove` and `add` it again). With nothing running it starts
|
|
620
|
+
at once.
|
|
621
|
+
- A waiting message's files have the shape a sent message's do: `chat.queue.items[n].files` is
|
|
622
|
+
`MessageFile[]` — what `messageFiles(message)` gives — and `chat.transcript.queued[n].files` is the
|
|
623
|
+
same plus `isImage`, so one file renderer draws both. `attachmentFile(attachment)` makes one from
|
|
624
|
+
an uploaded `MessageAttachment`.
|
|
612
625
|
- The queue pauses behind a failed turn (`run_failed`), a Stop (`cancelled`) or an exhausted quota
|
|
613
626
|
(`quota_exceeded`); `chat.queue.paused` says which, `resume()` lifts it. A queue left waiting with
|
|
614
627
|
nothing running is started when the thread loads.
|
|
@@ -168,6 +168,16 @@ interface AgentBackend {
|
|
|
168
168
|
updateQueuedMessage?(messageId: string, update: QueuedMessageUpdate): Promise<ChatQueueState>;
|
|
169
169
|
/** `DELETE <base>/queue/:messageId`. */
|
|
170
170
|
removeQueuedMessage?(messageId: string): Promise<ChatQueueState>;
|
|
171
|
+
/**
|
|
172
|
+
* `POST <base>/queue/:messageId/interrupt` — run a waiting message now: it moves to the head as an
|
|
173
|
+
* interrupt and the running turn is cancelled for it. `interrupting` is the run that was
|
|
174
|
+
* cancelled; `runId` is set instead when nothing was running and the message started at once.
|
|
175
|
+
* What `chat.queue.interrupt(id)` calls.
|
|
176
|
+
*/
|
|
177
|
+
interruptQueuedMessage?(messageId: string): Promise<ChatQueueState & {
|
|
178
|
+
runId?: string;
|
|
179
|
+
interrupting?: string;
|
|
180
|
+
}>;
|
|
171
181
|
/** `DELETE <base>/threads/:id/queue`. */
|
|
172
182
|
clearQueue?(threadId: string): Promise<ChatQueueState>;
|
|
173
183
|
/** `POST <base>/threads/:id/queue/resume` — `runId` when the head started. */
|
|
@@ -313,6 +323,14 @@ declare class AgentClient implements AgentBackend {
|
|
|
313
323
|
updateQueuedMessage(messageId: string, update: QueuedMessageUpdate): Promise<ChatQueueState>;
|
|
314
324
|
/** `DELETE <path>/queue/:messageId`. */
|
|
315
325
|
removeQueuedMessage(messageId: string): Promise<ChatQueueState>;
|
|
326
|
+
/**
|
|
327
|
+
* `POST <path>/queue/:messageId/interrupt` — run a waiting message now, cancelling the running
|
|
328
|
+
* turn for it. `runId` when nothing was running and it started; else `interrupting`.
|
|
329
|
+
*/
|
|
330
|
+
interruptQueuedMessage(messageId: string): Promise<ChatQueueState & {
|
|
331
|
+
runId?: string;
|
|
332
|
+
interrupting?: string;
|
|
333
|
+
}>;
|
|
316
334
|
/** `DELETE <path>/threads/:id/queue` — drop every waiting message. */
|
|
317
335
|
clearQueue(threadId: string): Promise<ChatQueueState>;
|
|
318
336
|
/** `POST <path>/threads/:id/queue/resume` — lift a pause; `runId` when the head started. */
|
|
@@ -168,6 +168,16 @@ interface AgentBackend {
|
|
|
168
168
|
updateQueuedMessage?(messageId: string, update: QueuedMessageUpdate): Promise<ChatQueueState>;
|
|
169
169
|
/** `DELETE <base>/queue/:messageId`. */
|
|
170
170
|
removeQueuedMessage?(messageId: string): Promise<ChatQueueState>;
|
|
171
|
+
/**
|
|
172
|
+
* `POST <base>/queue/:messageId/interrupt` — run a waiting message now: it moves to the head as an
|
|
173
|
+
* interrupt and the running turn is cancelled for it. `interrupting` is the run that was
|
|
174
|
+
* cancelled; `runId` is set instead when nothing was running and the message started at once.
|
|
175
|
+
* What `chat.queue.interrupt(id)` calls.
|
|
176
|
+
*/
|
|
177
|
+
interruptQueuedMessage?(messageId: string): Promise<ChatQueueState & {
|
|
178
|
+
runId?: string;
|
|
179
|
+
interrupting?: string;
|
|
180
|
+
}>;
|
|
171
181
|
/** `DELETE <base>/threads/:id/queue`. */
|
|
172
182
|
clearQueue?(threadId: string): Promise<ChatQueueState>;
|
|
173
183
|
/** `POST <base>/threads/:id/queue/resume` — `runId` when the head started. */
|
|
@@ -313,6 +323,14 @@ declare class AgentClient implements AgentBackend {
|
|
|
313
323
|
updateQueuedMessage(messageId: string, update: QueuedMessageUpdate): Promise<ChatQueueState>;
|
|
314
324
|
/** `DELETE <path>/queue/:messageId`. */
|
|
315
325
|
removeQueuedMessage(messageId: string): Promise<ChatQueueState>;
|
|
326
|
+
/**
|
|
327
|
+
* `POST <path>/queue/:messageId/interrupt` — run a waiting message now, cancelling the running
|
|
328
|
+
* turn for it. `runId` when nothing was running and it started; else `interrupting`.
|
|
329
|
+
*/
|
|
330
|
+
interruptQueuedMessage(messageId: string): Promise<ChatQueueState & {
|
|
331
|
+
runId?: string;
|
|
332
|
+
interrupting?: string;
|
|
333
|
+
}>;
|
|
316
334
|
/** `DELETE <path>/threads/:id/queue` — drop every waiting message. */
|
|
317
335
|
clearQueue(threadId: string): Promise<ChatQueueState>;
|
|
318
336
|
/** `POST <path>/threads/:id/queue/resume` — lift a pause; `runId` when the head started. */
|