@agents24/chat-react 0.5.16 → 0.5.18
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 +8 -8
- package/dist/index.cjs +23 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/latest-thread-scroller.d.ts +10 -2
- package/dist/runtime/index.cjs +6 -1
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.js +6 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/use-agent-chat-runtime.d.ts +1 -0
- package/dist/scaffold/components/chat/chat-composer.d.ts +6 -1
- package/dist/scaffold/components/chat/chat-message.d.ts +2 -1
- package/dist/scaffold/index.cjs +185 -286
- package/dist/scaffold/index.cjs.map +1 -1
- package/dist/scaffold/index.js +190 -291
- package/dist/scaffold/index.js.map +1 -1
- package/dist/styles.css +34 -1
- package/dist/types.d.ts +1 -1
- package/dist/ui/agent-chat-actions.d.ts +4 -1
- package/dist/ui/agent-chat-composer.d.ts +9 -1
- package/dist/ui/agent-chat-queue.d.ts +12 -0
- package/dist/ui/agent-response-timeline.d.ts +4 -2
- package/dist/ui/composer-attachments.d.ts +5 -1
- package/dist/ui/composer-interactions.d.ts +17 -0
- package/dist/ui/index.cjs +537 -331
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +522 -322
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/tool-sessions.d.ts +4 -1
- package/package.json +3 -3
- package/scaffold/src/components/chat/chat-composer.tsx +25 -26
- package/scaffold/src/components/chat/chat-message.tsx +7 -2
- package/scaffold/src/components/chat/chat-shell.tsx +52 -69
- package/dist/scaffold/components/ui/message-scroller.d.ts +0 -10
- package/scaffold/src/components/ui/message-scroller.tsx +0 -129
package/dist/styles.css
CHANGED
|
@@ -45,6 +45,26 @@
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
.a24-queue { position: relative; z-index: 0; margin-inline: 2rem; margin-bottom: -.5rem; padding-bottom: .5rem; overflow: visible; border: 1px solid var(--a24-border); border-bottom: 0; border-radius: .75rem .75rem 0 0; background: var(--a24-background); }
|
|
49
|
+
@media (max-width: 640px) { .a24-queue { margin-inline: 1.75rem; } }
|
|
50
|
+
.a24-queue__row { min-width: 0; border-bottom: 1px solid var(--a24-border); }
|
|
51
|
+
.a24-queue__row:last-child { border-bottom: 0; }
|
|
52
|
+
.a24-queue__row-content { display: flex; min-height: 2.25rem; align-items: center; gap: .5rem; padding: 0 .75rem; font-size: .875rem; }
|
|
53
|
+
.a24-queue__row-content > svg { width: 1rem; height: 1rem; flex-shrink: 0; color: var(--a24-muted); }
|
|
54
|
+
.a24-queue__text { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--a24-text); }
|
|
55
|
+
.a24-queue__steer, .a24-queue__icon { display: inline-flex; height: 2rem; align-items: center; justify-content: center; flex-shrink: 0; color: var(--a24-muted); background: transparent; border: 0; cursor: pointer; }
|
|
56
|
+
.a24-queue__steer { gap: .375rem; padding: 0 .375rem; }
|
|
57
|
+
.a24-queue__icon { width: 2rem; padding: 0; }
|
|
58
|
+
.a24-queue__steer svg, .a24-queue__icon svg { width: 1rem; height: 1rem; }
|
|
59
|
+
.a24-queue__steer:hover:not(:disabled), .a24-queue__icon:hover:not(:disabled) { color: var(--a24-text); }
|
|
60
|
+
.a24-queue button:disabled { opacity: .5; cursor: default; }
|
|
61
|
+
.a24-queue__menu { position: relative; }
|
|
62
|
+
.a24-queue__menu summary { list-style: none; cursor: pointer; }
|
|
63
|
+
.a24-queue__menu summary::-webkit-details-marker { display: none; }
|
|
64
|
+
.a24-queue__menu-content { position: absolute; right: 0; bottom: 100%; z-index: 30; min-width: 7rem; margin-bottom: .25rem; padding: .25rem; border: 1px solid var(--a24-border); border-radius: .375rem; background: var(--a24-background); box-shadow: 0 4px 12px rgb(0 0 0 / 10%); }
|
|
65
|
+
.a24-queue__menu-content button { width: 100%; padding: .25rem .5rem; border: 0; border-radius: .25rem; background: transparent; color: var(--a24-text); text-align: left; cursor: pointer; }
|
|
66
|
+
.a24-queue__menu-content button:hover { background: var(--a24-surface); }
|
|
67
|
+
|
|
48
68
|
.a24-scroller {
|
|
49
69
|
display: flex;
|
|
50
70
|
flex: 1;
|
|
@@ -155,18 +175,23 @@
|
|
|
155
175
|
.a24-context-status__sr-only { border: 0; clip: rect(0, 0, 0, 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; white-space: nowrap; width: 1px; }
|
|
156
176
|
.a24-tool-disclosure { min-width: 0; width: 100%; }
|
|
157
177
|
.a24-tool-trigger-row { align-items: center; display: flex; gap: .35rem; min-width: 0; }
|
|
178
|
+
.a24-tool-trigger-row--root { background: transparent; border: 1px solid color-mix(in srgb, var(--a24-border) 55%, var(--a24-background)); border-radius: 9999px; max-width: 100%; padding: .3rem .5rem; width: fit-content; }
|
|
158
179
|
.a24-tool-trigger { align-items: center; appearance: none; background: transparent; border: 0; color: var(--a24-muted); display: flex; font: inherit; font-size: .875rem; gap: .35rem; line-height: 1.35; min-width: 0; padding: .125rem 0; text-align: start; }
|
|
159
180
|
button.a24-tool-trigger { border-radius: .5rem; cursor: pointer; transition: background-color 140ms ease, color 140ms ease; }
|
|
160
181
|
button.a24-tool-trigger:hover { color: var(--a24-text); }
|
|
161
|
-
.a24-tool-trigger--root { background: transparent; border:
|
|
182
|
+
.a24-tool-trigger--root { background: transparent; border: 0; padding: 0; }
|
|
162
183
|
button.a24-tool-trigger--root { border-radius: 9999px; }
|
|
163
184
|
button.a24-tool-trigger--root:hover { background: transparent; }
|
|
164
185
|
.a24-tool-trigger--without-orb { padding-inline-start: .625rem; }
|
|
186
|
+
.a24-tool-trigger--root.a24-tool-trigger--without-orb { padding-inline-start: 0; }
|
|
165
187
|
button.a24-tool-trigger:focus-visible { outline: 2px solid var(--a24-focus); outline-offset: 2px; }
|
|
166
188
|
.a24-tool-trigger--error { color: var(--a24-danger); }
|
|
167
189
|
.a24-tool-orb { align-items: center; display: inline-flex; flex: 0 0 auto; height: 1.25rem; justify-content: center; width: 1.25rem; }
|
|
168
190
|
.a24-tool-orb canvas { display: block; }
|
|
169
191
|
.a24-tool-trigger__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
192
|
+
.a24-tool-resource-action { appearance: none; background: transparent; border: 0; border-radius: .375rem; color: var(--a24-text); cursor: pointer; flex: 0 1 auto; font: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .75rem; max-width: 16rem; min-width: 0; overflow: hidden; padding: .125rem .25rem; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-overflow: ellipsis; text-underline-offset: .18em; white-space: nowrap; }
|
|
193
|
+
.a24-tool-resource-action:hover { background: var(--a24-surface-hover); text-decoration-color: currentColor; }
|
|
194
|
+
.a24-tool-resource-action:focus-visible { outline: 2px solid var(--a24-focus); outline-offset: 2px; }
|
|
170
195
|
.a24-tool-trigger__chevron { flex: 0 0 auto; height: .75rem; opacity: 0; transition: opacity 140ms ease; width: .75rem; }
|
|
171
196
|
.a24-tool-trigger:hover .a24-tool-trigger__chevron,
|
|
172
197
|
.a24-tool-trigger:focus-visible .a24-tool-trigger__chevron { opacity: .7; }
|
|
@@ -210,6 +235,14 @@ button.a24-tool-trigger:focus-visible { outline: 2px solid var(--a24-focus); out
|
|
|
210
235
|
.a24-chat-message { display: flex; flex-direction: column; min-width: 0; width: 100%; }
|
|
211
236
|
.a24-chat-message--user { gap: 0; max-width: 100%; }
|
|
212
237
|
.a24-chat-message--assistant { gap: .5rem; max-width: 100%; }
|
|
238
|
+
.a24-chat-completion-actions { animation: a24-chat-completion-actions-in 200ms cubic-bezier(.2, 0, 0, 1) both; }
|
|
239
|
+
@keyframes a24-chat-completion-actions-in {
|
|
240
|
+
from { filter: blur(4px); opacity: 0; transform: translateY(4px); }
|
|
241
|
+
to { filter: blur(0); opacity: 1; transform: translateY(0); }
|
|
242
|
+
}
|
|
243
|
+
@media (prefers-reduced-motion: reduce) {
|
|
244
|
+
.a24-chat-completion-actions { animation: none; }
|
|
245
|
+
}
|
|
213
246
|
.a24-chat-message-action-row--user { align-items: center; align-self: flex-start; display: flex; gap: .5rem; height: 2rem; margin-left: auto; margin-top: .25rem; padding-inline: .25rem; transition: opacity 150ms ease; width: auto; }
|
|
214
247
|
.a24-user-message-actions { color: var(--a24-muted); font-family: inherit; font-size: .75rem; font-weight: 400; gap: .5rem; }
|
|
215
248
|
.a24-user-message-actions time { white-space: nowrap; }
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HitlAction, HitlResponse } from "@agents24/client";
|
|
2
2
|
export type * from "@agents24/react";
|
|
3
|
-
export type { ChatAttachment, ChatHitlPart, ChatMessage, ChatModelTurnPart, ChatNodeActivityPart, ChatPart, ChatToolPart, } from "@agents24/react";
|
|
3
|
+
export type { ChatAttachment, ChatHitlPart, ChatMessage, ChatModelTurnPart, ChatNodeActivityPart, ChatPart, ChatToolPart, ChatComputerResourceTarget, } from "@agents24/react";
|
|
4
4
|
export type ChatHitlAction = HitlAction;
|
|
5
5
|
export type ChatHitlResponse = HitlResponse;
|
|
6
6
|
export type ChatMcpOauthCompletion = {
|
|
@@ -15,8 +15,11 @@ export type AgentChatMessageActionHandlers = {
|
|
|
15
15
|
};
|
|
16
16
|
export type AgentChatDefaultActionsProps = {
|
|
17
17
|
additionalActions?: React.ReactNode;
|
|
18
|
+
animateCompletion?: boolean;
|
|
18
19
|
dir?: "ltr" | "rtl";
|
|
19
20
|
handlers?: AgentChatMessageActionHandlers;
|
|
20
21
|
message: ChatMessage;
|
|
21
22
|
};
|
|
22
|
-
export declare function
|
|
23
|
+
export declare function useLiveCompletionRuns(runId: string | null | undefined, isRunning: boolean): (candidate: string | null | undefined) => boolean;
|
|
24
|
+
export declare function useCompletionActionEntrance(isComplete: boolean, runId?: string | null, wasLive?: boolean): boolean;
|
|
25
|
+
export declare function AgentChatDefaultActions({ additionalActions, animateCompletion, dir, handlers, message, }: AgentChatDefaultActionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -4,6 +4,7 @@ export type { AgentChatComposerFile } from "./composer-attachments";
|
|
|
4
4
|
export type AgentChatComposerSubmit = {
|
|
5
5
|
text: string;
|
|
6
6
|
files: AgentChatComposerFile[];
|
|
7
|
+
attachmentIds?: string[];
|
|
7
8
|
};
|
|
8
9
|
export type AgentChatComposerProps = {
|
|
9
10
|
accept?: string;
|
|
@@ -12,12 +13,19 @@ export type AgentChatComposerProps = {
|
|
|
12
13
|
className?: string;
|
|
13
14
|
disabled?: boolean;
|
|
14
15
|
forceExpanded?: boolean;
|
|
16
|
+
focusKey?: string | null;
|
|
15
17
|
inputToolbarContent?: React.ReactNode;
|
|
16
18
|
isRunning?: boolean;
|
|
19
|
+
isCancelling?: boolean;
|
|
17
20
|
onAttachmentCountChange?: (count: number) => void;
|
|
18
21
|
onStop?: () => void;
|
|
19
22
|
onSubmit: (message: AgentChatComposerSubmit) => Promise<void> | void;
|
|
20
23
|
placeholder?: string;
|
|
24
|
+
restoredDraft?: {
|
|
25
|
+
revision: number;
|
|
26
|
+
text: string;
|
|
27
|
+
files: AgentChatComposerFile[];
|
|
28
|
+
} | null;
|
|
21
29
|
textareaRef?: React.Ref<HTMLTextAreaElement>;
|
|
22
30
|
};
|
|
23
|
-
export declare function AgentChatComposer({ accept, allowAttachments, attachmentLayout, className, disabled, forceExpanded, inputToolbarContent, isRunning, onAttachmentCountChange, onStop, onSubmit, placeholder, textareaRef, }: AgentChatComposerProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function AgentChatComposer({ accept, allowAttachments, attachmentLayout, className, disabled, forceExpanded, focusKey, inputToolbarContent, isRunning, isCancelling, onAttachmentCountChange, onStop, onSubmit, placeholder, restoredDraft, textareaRef, }: AgentChatComposerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ThreadMessage, ThreadMessageQueueState } from "@agents24/client";
|
|
2
|
+
export type AgentChatQueueProps = {
|
|
3
|
+
pending: readonly ThreadMessage[];
|
|
4
|
+
queue: ThreadMessageQueueState | null;
|
|
5
|
+
canSteer: boolean;
|
|
6
|
+
onSteer(message: ThreadMessage): Promise<void>;
|
|
7
|
+
onRemove(message: ThreadMessage): Promise<void>;
|
|
8
|
+
onEdit(message: ThreadMessage): Promise<void>;
|
|
9
|
+
onResume(): Promise<void>;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function AgentChatQueue({ pending, queue, onRemove, onEdit, onResume, className }: AgentChatQueueProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { ChatHitlPart, ChatHitlResponse, ChatMessage, ChatPart, ChatToolPart } from "../types";
|
|
2
|
+
import type { ChatHitlPart, ChatHitlResponse, ChatMessage, ChatNodeActivityPart, ChatPart, ChatToolPart, ChatUiBlocksPart } from "../types";
|
|
3
3
|
import type { McpConnectRequiredStatus } from "./mcp-connect-required-card";
|
|
4
4
|
import { type MessageResponseProps } from "./message-response";
|
|
5
5
|
import { type AgentChatToolSlots, type AgentChatToolViewMode } from "./tool-sessions";
|
|
@@ -14,7 +14,9 @@ export type AgentResponseTimelineProps = {
|
|
|
14
14
|
message: ChatMessage;
|
|
15
15
|
nodeActivityMode?: "default" | "all" | "hidden";
|
|
16
16
|
onHitlAction?: (part: ChatHitlPart, response: ChatHitlResponse) => void;
|
|
17
|
+
onNodeSelect?: (part: ChatNodeActivityPart) => void;
|
|
17
18
|
parts?: readonly ChatPart[];
|
|
19
|
+
renderUiBlocks?: (part: ChatUiBlocksPart) => React.ReactNode;
|
|
18
20
|
responseProps?: Omit<MessageResponseProps, "children" | "streaming" | "streamingId">;
|
|
19
21
|
toolSlots?: AgentChatToolSlots;
|
|
20
22
|
toolViewMode?: AgentChatToolViewMode;
|
|
@@ -43,4 +45,4 @@ export type AgentChatPartProps = {
|
|
|
43
45
|
toolSlots?: AgentChatToolSlots;
|
|
44
46
|
};
|
|
45
47
|
export declare function AgentChatPart({ activeToolId, getHitlActionState, isLoading, isTextStreaming, message, onHitlAction, part, responseProps, toolSlots, }: AgentChatPartProps): import("react/jsx-runtime").JSX.Element | null;
|
|
46
|
-
export declare function AgentResponseTimeline({ getHitlActionState, isLoading, message, nodeActivityMode, onHitlAction, parts: displayParts, responseProps, toolSlots, toolViewMode, }: AgentResponseTimelineProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export declare function AgentResponseTimeline({ getHitlActionState, isLoading, message, nodeActivityMode, onHitlAction, onNodeSelect, parts: displayParts, renderUiBlocks, responseProps, toolSlots, toolViewMode, }: AgentResponseTimelineProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { ChatAttachment } from "../types";
|
|
2
|
+
import type { ThreadMessage } from "@agents24/client";
|
|
2
3
|
export type AgentChatComposerFile = ChatAttachment & {
|
|
3
4
|
id: string;
|
|
4
5
|
type: "file";
|
|
5
6
|
url: string;
|
|
6
7
|
filename: string;
|
|
7
8
|
mediaType: string;
|
|
8
|
-
source
|
|
9
|
+
source?: File;
|
|
10
|
+
persistedAttachmentId?: string;
|
|
11
|
+
byteSize?: number;
|
|
9
12
|
};
|
|
10
13
|
export declare function createAgentChatComposerFile(file: File): AgentChatComposerFile;
|
|
11
14
|
export declare function revokeAgentChatComposerFiles(files: readonly AgentChatComposerFile[]): void;
|
|
15
|
+
export declare function queuedMessageComposerFiles(message: Pick<ThreadMessage, "attachment_ids" | "attachments">): AgentChatComposerFile[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare function chatComposerAction({ hasDraft, isRunning, isCancelling }: {
|
|
3
|
+
hasDraft: boolean;
|
|
4
|
+
isRunning: boolean;
|
|
5
|
+
isCancelling: boolean;
|
|
6
|
+
}): "stop" | "send";
|
|
7
|
+
export declare function useChatComposerFocus<TDraft>({ textareaRef, disabled, focusKey, restoredDraft, onRestore }: {
|
|
8
|
+
textareaRef: React.RefObject<HTMLTextAreaElement | null>;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
focusKey?: string | null;
|
|
11
|
+
restoredDraft?: (TDraft & {
|
|
12
|
+
revision: number;
|
|
13
|
+
}) | null;
|
|
14
|
+
onRestore: (draft: TDraft & {
|
|
15
|
+
revision: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
}): () => void;
|