@agents24/react 0.2.11 → 0.2.13
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/compatibility.json +5 -5
- package/dist/index.js +247 -116
- package/dist/index.js.map +1 -1
- package/dist/model.d.ts +2 -0
- package/dist/thread-message-queue.d.ts +26 -1
- package/package.json +2 -2
package/dist/model.d.ts
CHANGED
|
@@ -204,12 +204,14 @@ export type ChatMessage = {
|
|
|
204
204
|
id: string;
|
|
205
205
|
/** Durable timeline identity when a mounted optimistic turn keeps its display key. */
|
|
206
206
|
durableId?: string;
|
|
207
|
+
clientSubmissionId?: string;
|
|
207
208
|
segmentIndex?: number | null;
|
|
208
209
|
role: AgentChatMessageRole;
|
|
209
210
|
runId?: string | null;
|
|
210
211
|
content: string;
|
|
211
212
|
createdAt: Date | string;
|
|
212
213
|
isFinal?: boolean;
|
|
214
|
+
responseCompletion?: import("@agents24/client/protocol").ResponseCompletion;
|
|
213
215
|
parts: ChatPart[];
|
|
214
216
|
attachments?: ChatAttachment[];
|
|
215
217
|
citations?: ChatCitation[];
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import type { ChatMessage } from "./model";
|
|
2
|
+
import { type AgentChatState } from "./state";
|
|
1
3
|
import type { ThreadMessage, ThreadMessageInput, ThreadMessageQueueState, ThreadMessageSubmission, ThreadMessagesPage } from "@agents24/client";
|
|
4
|
+
/** Retry uncertain admission once; the caller retains the same receipt and payload. */
|
|
5
|
+
export declare function retrySubmissionAdmission<T>(admit: () => Promise<T>): Promise<T>;
|
|
2
6
|
export type ThreadMessageNotice = {
|
|
3
7
|
messageId: string;
|
|
4
8
|
status: string;
|
|
5
9
|
runId: string | null;
|
|
6
10
|
cursor?: number;
|
|
11
|
+
clientSubmissionId?: string | null;
|
|
7
12
|
};
|
|
8
13
|
export type ThreadMessageQueueTransport = {
|
|
9
14
|
list(threadId: string): Promise<ThreadMessagesPage>;
|
|
@@ -21,18 +26,34 @@ export type ThreadMessageQueueTransport = {
|
|
|
21
26
|
}>;
|
|
22
27
|
};
|
|
23
28
|
export type RetractedMessageDraft = Pick<ThreadMessage, "text" | "attachment_ids" | "attachments">;
|
|
24
|
-
export declare function useThreadMessageQueue({ threadId, transport, onPromoted }: {
|
|
29
|
+
export declare function useThreadMessageQueue({ threadId, transport, onPromoted, onOptimistic, onDiscard }: {
|
|
25
30
|
threadId: string | null;
|
|
26
31
|
transport: ThreadMessageQueueTransport;
|
|
27
32
|
onPromoted: (message: ThreadMessage, runId: string) => void;
|
|
33
|
+
onOptimistic?: (message: ThreadMessage, uploading: boolean) => void;
|
|
34
|
+
onDiscard?: (message: ThreadMessage) => void;
|
|
28
35
|
}): {
|
|
29
36
|
pendingMessages: readonly ThreadMessage[];
|
|
30
37
|
messageQueue: ThreadMessageQueueState | null;
|
|
31
38
|
refresh: (selectedThreadId?: string | null) => Promise<ThreadMessagesPage | null>;
|
|
32
39
|
hydrate: (page: ThreadMessagesPage, selectedThreadId: string) => void;
|
|
33
40
|
acceptNotice: (notice: ThreadMessageNotice) => boolean;
|
|
41
|
+
beginSubmission: (input: {
|
|
42
|
+
input: string;
|
|
43
|
+
clientSubmissionId: string;
|
|
44
|
+
mode?: "queue" | "steer";
|
|
45
|
+
attachmentIds?: readonly string[];
|
|
46
|
+
attachments?: ThreadMessage["attachments"];
|
|
47
|
+
uploading?: boolean;
|
|
48
|
+
}, queued?: boolean) => ThreadMessage;
|
|
49
|
+
discardSubmission: (message: ThreadMessage) => void;
|
|
34
50
|
submit: (input: Omit<ThreadMessageInput, "threadId"> & {
|
|
35
51
|
attachments?: ThreadMessage["attachments"];
|
|
52
|
+
queued?: boolean;
|
|
53
|
+
uploading?: boolean;
|
|
54
|
+
prepare?: () => Promise<Pick<ThreadMessageInput, "attachmentIds"> & {
|
|
55
|
+
attachments?: ThreadMessage["attachments"];
|
|
56
|
+
}>;
|
|
36
57
|
}) => Promise<ThreadMessageSubmission>;
|
|
37
58
|
edit: (message: ThreadMessage, input: {
|
|
38
59
|
text: string;
|
|
@@ -47,3 +68,7 @@ export declare function useThreadMessageQueue({ threadId, transport, onPromoted
|
|
|
47
68
|
run_id: string | null;
|
|
48
69
|
} | null>;
|
|
49
70
|
};
|
|
71
|
+
/** One provisional identity for first sends, idle sends, uploads and queue rows. */
|
|
72
|
+
export declare function optimisticSubmissionTurn(message: ThreadMessage): [ChatMessage, ChatMessage];
|
|
73
|
+
export declare function optimisticSubmissionState(state: AgentChatState, message: ThreadMessage, uploading: boolean): AgentChatState;
|
|
74
|
+
export declare function discardOptimisticSubmission(state: AgentChatState, message: ThreadMessage): AgentChatState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agents24/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "DOM-free React state and hooks for Agents24 client applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"prepack": "pnpm run build && pnpm run check:boundaries"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@agents24/client": "0.2.
|
|
43
|
+
"@agents24/client": "0.2.12"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": ">=19.0.0 <20.0.0"
|