@agents24/chat-react 0.3.2 → 0.4.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/LICENSE +19 -0
- package/README.md +21 -66
- package/compatibility.json +54 -0
- package/dist/active-content.d.ts +10 -0
- package/dist/{chunk-EWZO4QJI.js → chunk-CHAU7FNW.js} +3 -3
- package/dist/chunk-CHAU7FNW.js.map +1 -0
- package/dist/{chunk-FFO6KEB4.js → chunk-LI67M74F.js} +98 -12
- package/dist/chunk-LI67M74F.js.map +1 -0
- package/dist/chunk-NLEOWTZG.js +1327 -0
- package/dist/chunk-NLEOWTZG.js.map +1 -0
- package/dist/index.cjs +66 -1852
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +6 -1841
- package/dist/index.js.map +1 -1
- package/dist/latest-thread-scroller.d.ts +7 -7
- package/dist/mcp-oauth.d.ts +3 -1
- package/dist/renderers.d.ts +3 -3
- package/dist/styles.css +407 -0
- package/dist/templates/agent-chat-app.d.ts +18 -0
- package/dist/templates/agent-chat-layout.d.ts +69 -0
- package/dist/templates/agent-chat-shell.d.ts +1 -1
- package/dist/templates/index.cjs +1904 -18
- package/dist/templates/index.cjs.map +1 -1
- package/dist/templates/index.d.ts +2 -0
- package/dist/templates/index.js +529 -11
- package/dist/templates/index.js.map +1 -1
- package/dist/types.d.ts +12 -380
- package/dist/ui/agent-chat-actions.d.ts +1 -2
- package/dist/ui/agent-chat-composer.d.ts +2 -1
- package/dist/ui/agent-chat-message.d.ts +3 -3
- package/dist/ui/agent-response-timeline.d.ts +2 -2
- package/dist/ui/attachment.d.ts +9 -9
- package/dist/ui/bubble.d.ts +4 -4
- package/dist/ui/index.cjs +137 -43
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +62 -1220
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/marker.d.ts +3 -3
- package/dist/ui/mcp-connect-required-card.d.ts +1 -1
- package/dist/ui/message-response.d.ts +1 -1
- package/dist/ui/message.d.ts +6 -6
- package/package.json +27 -8
- package/dist/chunk-EWZO4QJI.js.map +0 -1
- package/dist/chunk-FFO6KEB4.js.map +0 -1
- package/dist/chunk-UU7OXHL3.js +0 -11
- package/dist/chunk-UU7OXHL3.js.map +0 -1
- package/dist/context-window.d.ts +0 -38
- package/dist/controller-actions.d.ts +0 -45
- package/dist/controller-helpers.d.ts +0 -27
- package/dist/controller-hitl.d.ts +0 -22
- package/dist/controller-options.d.ts +0 -15
- package/dist/controller-thread-events.d.ts +0 -7
- package/dist/controller.d.ts +0 -5
- package/dist/message-lifecycle.d.ts +0 -15
- package/dist/model.d.ts +0 -30
- package/dist/sse.d.ts +0 -5
- package/dist/transport.d.ts +0 -43
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ChatRuntimeEventContext } from "./controller-helpers";
|
|
2
|
-
import type { ChatMessage, ChatRuntimeEvent, ChatStorageAdapter, ChatTransport } from "./types";
|
|
3
|
-
export type UseAgents24ChatControllerOptions = {
|
|
4
|
-
transport: ChatTransport;
|
|
5
|
-
storage: ChatStorageAdapter;
|
|
6
|
-
activeThreadId?: string | null;
|
|
7
|
-
pageSize?: number;
|
|
8
|
-
storageKey?: unknown;
|
|
9
|
-
createId?: () => string;
|
|
10
|
-
onActiveThreadIdChange?: (threadId: string | null) => void;
|
|
11
|
-
onSourceClick?: (citations: ChatMessage["citations"]) => void;
|
|
12
|
-
onStreamErrorMessage?: (error: unknown) => string;
|
|
13
|
-
onRuntimeEvent?: (event: ChatRuntimeEvent, context: ChatRuntimeEventContext) => void | Promise<void>;
|
|
14
|
-
onThreadDetailLoaded?: (detail: unknown) => void | Promise<void>;
|
|
15
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ChatStorageAdapter, ChatTransport, StoredChatThread } from "./types";
|
|
2
|
-
export declare function useControllerThreadEvents({ transport, storage, refresh, setThreads, }: {
|
|
3
|
-
transport: ChatTransport;
|
|
4
|
-
storage: ChatStorageAdapter;
|
|
5
|
-
refresh: () => Promise<void>;
|
|
6
|
-
setThreads: (threads: StoredChatThread[]) => void;
|
|
7
|
-
}): void;
|
package/dist/controller.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { UseAgents24ChatControllerOptions } from "./controller-options";
|
|
2
|
-
import type { ChatController } from "./types";
|
|
3
|
-
export { mergeStoredThreadsForRefresh } from "./controller-helpers";
|
|
4
|
-
export type { UseAgents24ChatControllerOptions } from "./controller-options";
|
|
5
|
-
export declare function useAgents24ChatController(options: UseAgents24ChatControllerOptions): ChatController;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type StableChatMessageBase = {
|
|
2
|
-
id: string;
|
|
3
|
-
role: "user" | "assistant";
|
|
4
|
-
runId?: string | null;
|
|
5
|
-
};
|
|
6
|
-
export type StableAssistantUpsertInput<TMessage extends StableChatMessageBase> = {
|
|
7
|
-
baseMessages?: TMessage[];
|
|
8
|
-
create: () => TMessage;
|
|
9
|
-
messageId?: string | null;
|
|
10
|
-
runId?: string | null;
|
|
11
|
-
update: (message: TMessage) => TMessage;
|
|
12
|
-
};
|
|
13
|
-
export declare function findStableAssistantMessageIndex<TMessage extends StableChatMessageBase>(messages: TMessage[], input: Pick<StableAssistantUpsertInput<TMessage>, "messageId" | "runId">): number;
|
|
14
|
-
export declare function appendStableStreamingTurn<TMessage extends StableChatMessageBase>(messages: TMessage[], userMessage: TMessage, assistantMessage: TMessage): TMessage[];
|
|
15
|
-
export declare function upsertStableAssistantMessage<TMessage extends StableChatMessageBase>(messages: TMessage[], input: StableAssistantUpsertInput<TMessage>): TMessage[];
|
package/dist/model.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ChatPart, ChatContextWindow, ChatMessage, ChatReasoningStep, ChatThreadDetail, ChatThreadSummary, ChatToolState } from "./types";
|
|
2
|
-
export declare const DEFAULT_THREAD_PAGE_SIZE = 5;
|
|
3
|
-
export declare const isRunningThreadStatus: (status?: string | null) => boolean;
|
|
4
|
-
export declare const isAutoAttachThreadStatus: (status?: string | null) => boolean;
|
|
5
|
-
export declare const createChatId: () => string;
|
|
6
|
-
export declare const titleFromMessage: (text: string, files?: Array<{
|
|
7
|
-
filename?: string;
|
|
8
|
-
}>) => string;
|
|
9
|
-
export declare const threadActivityDate: (thread: ChatThreadSummary) => string;
|
|
10
|
-
export declare const assistantTextFromResponseBlocks: (blocks?: Array<Record<string, unknown>>) => string;
|
|
11
|
-
export declare const assistantTextFromParts: (parts?: ChatPart[]) => string;
|
|
12
|
-
export declare const toolStateFromStatus: (status?: unknown) => ChatToolState;
|
|
13
|
-
export declare const partsFromResponseBlocks: (blocks?: Array<Record<string, unknown>>, fallbackText?: string) => ChatPart[];
|
|
14
|
-
export declare const mergeReasoningSteps: (steps?: ChatReasoningStep[], options?: {
|
|
15
|
-
finalize?: boolean;
|
|
16
|
-
}) => ChatReasoningStep[];
|
|
17
|
-
export declare const reasoningStepsFromParts: (parts?: ChatPart[]) => ChatReasoningStep[];
|
|
18
|
-
export declare const threadDetailToMessages: (thread: ChatThreadDetail) => ChatMessage[];
|
|
19
|
-
export declare const threadPaging: (thread: ChatThreadDetail) => {
|
|
20
|
-
hasOlderTurns: boolean;
|
|
21
|
-
nextBeforeTurnIndex: number | null;
|
|
22
|
-
};
|
|
23
|
-
export declare const latestContextWindowFromThread: (thread: ChatThreadDetail) => ChatContextWindow | null;
|
|
24
|
-
export declare const activeRunIdFromThread: (thread?: Partial<ChatThreadSummary> | null) => string | null;
|
|
25
|
-
export declare const autoAttachRunIdFromThread: (thread?: Partial<ChatThreadSummary> | null) => string | null;
|
|
26
|
-
export declare const hasUnfinishedAssistantMessage: (messages?: ChatMessage[]) => boolean;
|
|
27
|
-
export declare const hasStaleUnfinishedAssistantCache: (thread?: (Partial<ChatThreadSummary> & {
|
|
28
|
-
messages?: ChatMessage[];
|
|
29
|
-
}) | null) => boolean;
|
|
30
|
-
export declare const activeRunIdFromThreadDetail: (thread?: ChatThreadDetail | null) => string | null;
|
package/dist/sse.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ChatRuntimeEvent, ChatStreamResult } from "./types";
|
|
2
|
-
export declare const parseSseBlock: (block: string) => ChatRuntimeEvent | null;
|
|
3
|
-
export declare const consumeSseResponse: (response: Response, onEvent: (event: ChatRuntimeEvent) => void | Promise<void>, options?: {
|
|
4
|
-
signal?: AbortSignal;
|
|
5
|
-
}) => Promise<ChatStreamResult>;
|
package/dist/transport.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { ChatSubmitInput, ChatTransport } from "./types";
|
|
2
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
3
|
-
export type FetchChatTransportRoutes = {
|
|
4
|
-
listThreads: () => string;
|
|
5
|
-
getThread: (input: {
|
|
6
|
-
threadId: string;
|
|
7
|
-
limit?: number;
|
|
8
|
-
beforeTurnIndex?: number | null;
|
|
9
|
-
includeRunEvents?: boolean;
|
|
10
|
-
}) => string;
|
|
11
|
-
streamMessage: () => string;
|
|
12
|
-
attachRun: (input: {
|
|
13
|
-
runId: string;
|
|
14
|
-
}) => string;
|
|
15
|
-
cancelRun: (input: {
|
|
16
|
-
runId: string;
|
|
17
|
-
}) => string;
|
|
18
|
-
deleteThread?: (input: {
|
|
19
|
-
threadId: string;
|
|
20
|
-
}) => string;
|
|
21
|
-
threadEvents?: (input: {
|
|
22
|
-
cursor?: number | null;
|
|
23
|
-
}) => string;
|
|
24
|
-
resumeRun?: (input: {
|
|
25
|
-
runId: string;
|
|
26
|
-
}) => string;
|
|
27
|
-
startMcpAuth?: (input: {
|
|
28
|
-
runId: string;
|
|
29
|
-
serverId: string;
|
|
30
|
-
}) => string;
|
|
31
|
-
};
|
|
32
|
-
export type FetchChatTransportOptions = {
|
|
33
|
-
routes: FetchChatTransportRoutes;
|
|
34
|
-
fetchImpl?: typeof fetch;
|
|
35
|
-
headers?: () => MaybePromise<HeadersInit>;
|
|
36
|
-
streamBody?: (input: ChatSubmitInput) => unknown;
|
|
37
|
-
};
|
|
38
|
-
export declare class ChatTransportError extends Error {
|
|
39
|
-
status: number;
|
|
40
|
-
constructor(message: string, status: number);
|
|
41
|
-
}
|
|
42
|
-
export declare const createFetchChatTransport: ({ routes, fetchImpl, headers, streamBody, }: FetchChatTransportOptions) => ChatTransport;
|
|
43
|
-
export {};
|