@langchain/macaw-components 1.7.19 → 1.7.20
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/dist/catalog.json +798 -775
- package/dist/components/ChatThread/ChatThread.d.ts +59 -0
- package/dist/components/ChatThread/ChatThread.js +338 -0
- package/dist/components/ChatThread/ChatThread.js.map +1 -0
- package/dist/components/ChatThread/ChatThread.types.d.ts +284 -0
- package/dist/components/ChatThread/ChatThread.types.js +0 -0
- package/dist/components/ChatThread/ChatThreadContext.d.ts +34 -0
- package/dist/components/ChatThread/ChatThreadContext.js +53 -0
- package/dist/components/ChatThread/ChatThreadContext.js.map +1 -0
- package/dist/components/ChatThread/ChatThreadRequests.d.ts +1 -0
- package/dist/components/ChatThread/ChatThreadRequests.js +233 -0
- package/dist/components/ChatThread/ChatThreadRequests.js.map +1 -0
- package/dist/components/ChatThread/ChatThreadWork.d.ts +13 -0
- package/dist/components/ChatThread/ChatThreadWork.js +174 -0
- package/dist/components/ChatThread/ChatThreadWork.js.map +1 -0
- package/dist/components/ChatThread/deepAgentTools.d.ts +9 -0
- package/dist/components/ChatThread/deepAgentTools.js +215 -0
- package/dist/components/ChatThread/deepAgentTools.js.map +1 -0
- package/dist/components/ChatThread/index.d.ts +8 -0
- package/dist/components/ChatThread/index.js +6 -0
- package/dist/components/ChatThread/interrupts.d.ts +43 -0
- package/dist/components/ChatThread/interrupts.js +96 -0
- package/dist/components/ChatThread/interrupts.js.map +1 -0
- package/dist/components/ChatThread/messages.d.ts +29 -0
- package/dist/components/ChatThread/messages.js +137 -0
- package/dist/components/ChatThread/messages.js.map +1 -0
- package/dist/components/ChatThread/toChatThread.d.ts +12 -0
- package/dist/components/ChatThread/toChatThread.js +275 -0
- package/dist/components/ChatThread/toChatThread.js.map +1 -0
- package/dist/components/ChatThread/useLangGraphChatThread.d.ts +36 -0
- package/dist/components/ChatThread/useLangGraphChatThread.js +240 -0
- package/dist/components/ChatThread/useLangGraphChatThread.js.map +1 -0
- package/dist/components/ChatToolCall/ChatToolCallDetails.js +1 -1
- package/dist/components/MarkdownDisplay/MarkdownDisplay.js +1 -1
- package/dist/docs/phosphor-icon-catalog.js +2 -2
- package/dist/icons/LongTailPhosphorIcons.js +1 -1
- package/dist/utilities.css +1 -1
- package/docs/CHAT.md +109 -3
- package/docs/DESIGN.md +4 -1
- package/package.json +6 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ChatThreadController, ChatThreadInterrupt, ChatThreadStream, ChatThreadSubagent, ChatThreadToolRenderer } from './ChatThread.types.js';
|
|
3
|
+
import { type UseLangGraphChatThreadOptions } from './useLangGraphChatThread.js';
|
|
4
|
+
interface ChatThreadViewProps {
|
|
5
|
+
/** Tool presentations by tool name, applied over `deepAgentTools`. */
|
|
6
|
+
tools?: Record<string, ChatThreadToolRenderer>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders an interrupt yourself, such as a sign-in prompt. Return
|
|
9
|
+
* undefined to use the default approval, reply, or response card.
|
|
10
|
+
*/
|
|
11
|
+
renderInterrupt?: (interrupt: ChatThreadInterrupt, thread: ChatThreadController) => ReactNode | undefined;
|
|
12
|
+
/** Opens a subagent's full thread, such as in a side pane. */
|
|
13
|
+
onOpenSubagent?: (subagent: ChatThreadSubagent) => void;
|
|
14
|
+
/** Names the agent in its message headers. */
|
|
15
|
+
agentName?: string;
|
|
16
|
+
/** Fixed content above the conversation. */
|
|
17
|
+
header?: ReactNode;
|
|
18
|
+
/** Shown before the first message. */
|
|
19
|
+
emptyState?: ReactNode;
|
|
20
|
+
/** Composer placeholder; defaults follow the run's state. */
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
/** The composer's model picker, such as `ChatComposerModelSelect`. */
|
|
23
|
+
modelSelector?: ReactNode;
|
|
24
|
+
/** Composer tools before the model picker, such as an attachment menu. */
|
|
25
|
+
composerTools?: ReactNode;
|
|
26
|
+
/** Shown before Send/Stop, such as `ChatContextWindowPopover`. */
|
|
27
|
+
composerActions?: ReactNode;
|
|
28
|
+
/** Names the conversation region. */
|
|
29
|
+
label?: string;
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The default: a LangGraph `useStream` handle, adapted by
|
|
34
|
+
* `useLangGraphChatThread`.
|
|
35
|
+
*/
|
|
36
|
+
export interface ChatThreadStreamProps extends ChatThreadViewProps, UseLangGraphChatThreadOptions {
|
|
37
|
+
/** A `useStream` handle from `@langchain/react` (1.x, 2.0) or the 0.3.x hook. */
|
|
38
|
+
stream: ChatThreadStream;
|
|
39
|
+
thread?: never;
|
|
40
|
+
}
|
|
41
|
+
/** Bring your own adapter: any stream or data mapped to a controller. */
|
|
42
|
+
export interface ChatThreadControllerProps extends ChatThreadViewProps {
|
|
43
|
+
/**
|
|
44
|
+
* The thread to render: from `useLangGraphChatThread`, or your own adapter
|
|
45
|
+
* for another stream or data source.
|
|
46
|
+
*/
|
|
47
|
+
thread: ChatThreadController;
|
|
48
|
+
stream?: never;
|
|
49
|
+
}
|
|
50
|
+
export type ChatThreadProps = ChatThreadStreamProps | ChatThreadControllerProps;
|
|
51
|
+
/**
|
|
52
|
+
* An agent conversation view built from Macaw chat parts: messages,
|
|
53
|
+
* reasoning, tool calls, subagents, approvals, the plan, queued messages,
|
|
54
|
+
* and the composer. Pass a LangGraph `stream` to use the built-in
|
|
55
|
+
* `useLangGraphChatThread` adapter, or a `thread` from your own adapter.
|
|
56
|
+
* Pick one for the life of the component.
|
|
57
|
+
*/
|
|
58
|
+
export declare function ChatThread(props: ChatThreadProps): import("react").JSX.Element;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { Text } from "../Text/Text.js";
|
|
3
|
+
import { Button } from "../Button/Button.js";
|
|
4
|
+
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
5
|
+
import { ChatComposer, ChatComposerAction, ChatComposerToolbar } from "../ChatComposer/ChatComposer.js";
|
|
6
|
+
import { copyToClipboard } from "../CopyButton/copyToClipboard.js";
|
|
7
|
+
import { Textarea } from "../Textarea/Textarea.js";
|
|
8
|
+
import { ChatComposerInput } from "../ChatComposer/ChatComposerInput.js";
|
|
9
|
+
import { ChatConversation } from "../ChatConversation/ChatConversation.js";
|
|
10
|
+
import { ChatMessage, ChatMessageActions } from "../ChatMessage/ChatMessage.js";
|
|
11
|
+
import { ChatPlan } from "../ChatPlan/ChatPlan.js";
|
|
12
|
+
import { ChatState } from "../ChatState/ChatState.js";
|
|
13
|
+
import { MarkdownDisplay } from "../MarkdownDisplay/MarkdownDisplay.js";
|
|
14
|
+
import { ThreadContext, splitParts, useThread } from "./ChatThreadContext.js";
|
|
15
|
+
import { InterruptRequests } from "./ChatThreadRequests.js";
|
|
16
|
+
import { deepAgentTools } from "./deepAgentTools.js";
|
|
17
|
+
import { ImagePart, WorkParts, WorkSummary, visibleActionCount } from "./ChatThreadWork.js";
|
|
18
|
+
import { useLangGraphChatThread } from "./useLangGraphChatThread.js";
|
|
19
|
+
import { Fragment, useMemo, useState } from "react";
|
|
20
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
//#region packages/components/src/components/ChatThread/ChatThread.tsx
|
|
22
|
+
/** Chat answers are bounded, so Markdown renders up to this many characters. */
|
|
23
|
+
var MAX_ANSWER_MARKDOWN = 1e5;
|
|
24
|
+
function UserMessage({ turn }) {
|
|
25
|
+
const { thread } = useThread();
|
|
26
|
+
const user = turn.user;
|
|
27
|
+
const forkPoint = thread.useForkPoint ? thread.useForkPoint(turn) : void 0;
|
|
28
|
+
const [editing, setEditing] = useState(false);
|
|
29
|
+
const [draft, setDraft] = useState("");
|
|
30
|
+
if (!user) return null;
|
|
31
|
+
const busy = thread.model.status === "running";
|
|
32
|
+
const fork = forkPoint === void 0 ? void 0 : thread.actions.fork;
|
|
33
|
+
if (editing && fork) {
|
|
34
|
+
const save = () => {
|
|
35
|
+
const text = draft.trim();
|
|
36
|
+
if (!text) return;
|
|
37
|
+
setEditing(false);
|
|
38
|
+
fork(text, forkPoint).catch(() => {
|
|
39
|
+
setDraft(text);
|
|
40
|
+
setEditing(true);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
44
|
+
"data-chat-message-id": user.message.id,
|
|
45
|
+
className: "ml-auto flex w-full max-w-[85%] flex-col gap-space-2 rounded-lg border border-focus bg-elevated p-space-2 duration-normal ease-out animate-in fade-in zoom-in-95 motion-reduce:animate-none",
|
|
46
|
+
children: [/* @__PURE__ */ jsx(Textarea, {
|
|
47
|
+
variant: "plain",
|
|
48
|
+
"aria-label": "Edit message",
|
|
49
|
+
value: draft,
|
|
50
|
+
onChange: setDraft,
|
|
51
|
+
rows: 3,
|
|
52
|
+
resize: "vertical",
|
|
53
|
+
autoFocus: true
|
|
54
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
55
|
+
className: "flex justify-end gap-space-2",
|
|
56
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
57
|
+
size: "sm",
|
|
58
|
+
variant: "plain",
|
|
59
|
+
color: "secondary",
|
|
60
|
+
onClick: () => setEditing(false),
|
|
61
|
+
children: "Cancel"
|
|
62
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
63
|
+
size: "sm",
|
|
64
|
+
disabled: !draft.trim(),
|
|
65
|
+
onClick: save,
|
|
66
|
+
children: "Send"
|
|
67
|
+
})]
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const actions = { copy: { onClick: () => void copyToClipboard(user.text) } };
|
|
72
|
+
if (fork) {
|
|
73
|
+
actions.edit = { onClick: () => {
|
|
74
|
+
setDraft(user.text);
|
|
75
|
+
setEditing(true);
|
|
76
|
+
} };
|
|
77
|
+
actions.retry = { onClick: () => void fork(user.text, forkPoint) };
|
|
78
|
+
}
|
|
79
|
+
return /* @__PURE__ */ jsx(ChatMessage, {
|
|
80
|
+
message: user.message,
|
|
81
|
+
footer: /* @__PURE__ */ jsx(ChatMessageActions, {
|
|
82
|
+
actions,
|
|
83
|
+
readOnly: busy
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function AgentMessage({ turn, isLast }) {
|
|
88
|
+
const { thread, agentName, tools } = useThread();
|
|
89
|
+
const { work, answer } = splitParts(turn.parts);
|
|
90
|
+
const actionCount = visibleActionCount(work, tools);
|
|
91
|
+
const hasActions = actionCount > 0;
|
|
92
|
+
const showInterrupts = isLast && thread.model.interrupts.length > 0;
|
|
93
|
+
const blocks = [];
|
|
94
|
+
if (work.length > 0) blocks.push({
|
|
95
|
+
id: "work",
|
|
96
|
+
type: "custom",
|
|
97
|
+
content: hasActions ? /* @__PURE__ */ jsx(WorkSummary, {
|
|
98
|
+
turn,
|
|
99
|
+
parts: work,
|
|
100
|
+
count: actionCount
|
|
101
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
102
|
+
className: "flex min-w-0 flex-col gap-0.5",
|
|
103
|
+
children: /* @__PURE__ */ jsx(WorkParts, { parts: work })
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
if (showInterrupts) blocks.push({
|
|
107
|
+
id: "interrupts",
|
|
108
|
+
type: "custom",
|
|
109
|
+
content: /* @__PURE__ */ jsx(InterruptRequests, {})
|
|
110
|
+
});
|
|
111
|
+
for (const part of answer) {
|
|
112
|
+
if (part.type === "image") {
|
|
113
|
+
blocks.push({
|
|
114
|
+
id: part.id,
|
|
115
|
+
type: "custom",
|
|
116
|
+
content: /* @__PURE__ */ jsx(ImagePart, { url: part.url })
|
|
117
|
+
});
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (part.type !== "text") continue;
|
|
121
|
+
blocks.push({
|
|
122
|
+
id: part.id,
|
|
123
|
+
type: "custom",
|
|
124
|
+
content: /* @__PURE__ */ jsx(MarkdownDisplay, {
|
|
125
|
+
content: part.text,
|
|
126
|
+
isStreaming: part.streaming,
|
|
127
|
+
maxMarkdownLength: MAX_ANSWER_MARKDOWN
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
if (turn.error) blocks.push({
|
|
132
|
+
id: "error",
|
|
133
|
+
type: "custom",
|
|
134
|
+
content: /* @__PURE__ */ jsxs("div", {
|
|
135
|
+
className: "flex min-w-0 items-start gap-space-2 rounded-lg bg-error-subtle px-space-3 py-space-2",
|
|
136
|
+
children: [/* @__PURE__ */ jsx(ChatState, {
|
|
137
|
+
status: "failed",
|
|
138
|
+
variant: "simple",
|
|
139
|
+
showElapsed: false,
|
|
140
|
+
announce: false
|
|
141
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
142
|
+
variant: "sm",
|
|
143
|
+
color: "error",
|
|
144
|
+
className: "min-w-0 [overflow-wrap:anywhere]",
|
|
145
|
+
children: turn.error
|
|
146
|
+
})]
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
const answerText = answer.map((part) => part.type === "text" ? part.text : "").join("\n\n").trim();
|
|
150
|
+
return /* @__PURE__ */ jsx(ChatMessage, {
|
|
151
|
+
message: {
|
|
152
|
+
id: `${turn.id}:agent`,
|
|
153
|
+
role: "assistant",
|
|
154
|
+
status: turn.status === "interrupted" ? "idle" : turn.status,
|
|
155
|
+
content: blocks
|
|
156
|
+
},
|
|
157
|
+
name: agentName,
|
|
158
|
+
isLatest: isLast,
|
|
159
|
+
footer: answerText ? /* @__PURE__ */ jsx(ChatMessageActions, {
|
|
160
|
+
status: turn.status,
|
|
161
|
+
actions: { copy: { onClick: () => void copyToClipboard(answerText) } }
|
|
162
|
+
}) : void 0
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function ThreadComposer({ placeholder, modelSelector, composerTools, composerActions }) {
|
|
166
|
+
const { thread } = useThread();
|
|
167
|
+
const { model, actions, stopping } = thread;
|
|
168
|
+
const [draft, setDraft] = useState("");
|
|
169
|
+
const running = model.status === "running";
|
|
170
|
+
const waiting = model.status === "interrupted";
|
|
171
|
+
const stop = actions.stop;
|
|
172
|
+
const actionProps = stopping ? { action: "stopping" } : running && stop && !draft.trim() ? {
|
|
173
|
+
action: "stop",
|
|
174
|
+
onStop: () => void stop()
|
|
175
|
+
} : { action: "send" };
|
|
176
|
+
const plan = model.plan;
|
|
177
|
+
const showPlan = plan !== void 0 && (running || plan.some((item) => item.status !== "completed"));
|
|
178
|
+
return /* @__PURE__ */ jsxs(ChatComposer, {
|
|
179
|
+
...actionProps,
|
|
180
|
+
drawer: showPlan ? /* @__PURE__ */ jsx(ChatPlan, {
|
|
181
|
+
items: plan,
|
|
182
|
+
presentation: "drawer"
|
|
183
|
+
}) : void 0,
|
|
184
|
+
submitDisabled: !draft.trim() || waiting,
|
|
185
|
+
onSubmit: () => {
|
|
186
|
+
const text = draft.trim();
|
|
187
|
+
if (!text) return;
|
|
188
|
+
setDraft("");
|
|
189
|
+
actions.send(text).catch(() => {
|
|
190
|
+
setDraft((current) => current || text);
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
children: [/* @__PURE__ */ jsx(ChatComposerInput, {
|
|
194
|
+
value: draft,
|
|
195
|
+
onChange: setDraft,
|
|
196
|
+
"aria-label": "Message",
|
|
197
|
+
placeholder: placeholder ?? (waiting ? "Answer the request above to continue" : running ? "Queue a follow-up" : "Message the agent")
|
|
198
|
+
}), /* @__PURE__ */ jsx(ChatComposerToolbar, {
|
|
199
|
+
modelSelector,
|
|
200
|
+
actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [composerActions, /* @__PURE__ */ jsx(ChatComposerAction, {})] }),
|
|
201
|
+
children: composerTools
|
|
202
|
+
})]
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
var ANNOUNCEMENTS = {
|
|
206
|
+
idle: "Response complete",
|
|
207
|
+
failed: "Response failed",
|
|
208
|
+
interrupted: "The agent is waiting for your input",
|
|
209
|
+
running: ""
|
|
210
|
+
};
|
|
211
|
+
function useStatusAnnouncement(status) {
|
|
212
|
+
const [previous, setPrevious] = useState(status);
|
|
213
|
+
const [announcement, setAnnouncement] = useState("");
|
|
214
|
+
if (status !== previous) {
|
|
215
|
+
setPrevious(status);
|
|
216
|
+
setAnnouncement(previous === "running" ? ANNOUNCEMENTS[status] : "");
|
|
217
|
+
}
|
|
218
|
+
return announcement;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* An agent conversation view built from Macaw chat parts: messages,
|
|
222
|
+
* reasoning, tool calls, subagents, approvals, the plan, queued messages,
|
|
223
|
+
* and the composer. Pass a LangGraph `stream` to use the built-in
|
|
224
|
+
* `useLangGraphChatThread` adapter, or a `thread` from your own adapter.
|
|
225
|
+
* Pick one for the life of the component.
|
|
226
|
+
*/
|
|
227
|
+
function ChatThread(props) {
|
|
228
|
+
if (props.thread) return /* @__PURE__ */ jsx(ChatThreadView, {
|
|
229
|
+
...props,
|
|
230
|
+
thread: props.thread
|
|
231
|
+
});
|
|
232
|
+
return /* @__PURE__ */ jsx(StreamChatThread, { ...props });
|
|
233
|
+
}
|
|
234
|
+
function StreamChatThread({ stream, selectors, hideMessage, messagesKey, subagentTools, ...props }) {
|
|
235
|
+
const thread = useLangGraphChatThread(stream, {
|
|
236
|
+
selectors,
|
|
237
|
+
hideMessage,
|
|
238
|
+
messagesKey,
|
|
239
|
+
subagentTools
|
|
240
|
+
});
|
|
241
|
+
return /* @__PURE__ */ jsx(ChatThreadView, {
|
|
242
|
+
...props,
|
|
243
|
+
thread
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function ChatThreadView({ thread, tools, renderInterrupt, onOpenSubagent, agentName, header, emptyState, placeholder, modelSelector, composerTools, composerActions, label = "Agent conversation", className }) {
|
|
247
|
+
const toolPresentations = useMemo(() => ({
|
|
248
|
+
...deepAgentTools,
|
|
249
|
+
...tools
|
|
250
|
+
}), [tools]);
|
|
251
|
+
const { model, isThreadLoading, actions } = thread;
|
|
252
|
+
const cancelQueued = actions.cancelQueued;
|
|
253
|
+
const announcement = useStatusAnnouncement(model.status);
|
|
254
|
+
const context = useMemo(() => ({
|
|
255
|
+
thread,
|
|
256
|
+
tools: toolPresentations,
|
|
257
|
+
agentName,
|
|
258
|
+
renderInterrupt,
|
|
259
|
+
onOpenSubagent
|
|
260
|
+
}), [
|
|
261
|
+
thread,
|
|
262
|
+
toolPresentations,
|
|
263
|
+
agentName,
|
|
264
|
+
renderInterrupt,
|
|
265
|
+
onOpenSubagent
|
|
266
|
+
]);
|
|
267
|
+
const lastTurn = model.turns.at(-1);
|
|
268
|
+
const needsAgentMessage = (turn, isLast) => turn.parts.length > 0 || Boolean(turn.error) || isLast && (turn.status === "streaming" || model.interrupts.length > 0);
|
|
269
|
+
return /* @__PURE__ */ jsxs(ThreadContext.Provider, {
|
|
270
|
+
value: context,
|
|
271
|
+
children: [/* @__PURE__ */ jsx(ChatConversation, {
|
|
272
|
+
label,
|
|
273
|
+
header,
|
|
274
|
+
footer: /* @__PURE__ */ jsx(ThreadComposer, {
|
|
275
|
+
placeholder,
|
|
276
|
+
modelSelector,
|
|
277
|
+
composerTools,
|
|
278
|
+
composerActions
|
|
279
|
+
}),
|
|
280
|
+
pinnedMessageId: thread.sentMessageId,
|
|
281
|
+
className,
|
|
282
|
+
children: isThreadLoading ? /* @__PURE__ */ jsxs("div", {
|
|
283
|
+
role: "status",
|
|
284
|
+
"aria-label": "Loading conversation",
|
|
285
|
+
className: "flex flex-col gap-space-4",
|
|
286
|
+
children: [
|
|
287
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "ml-auto h-9 w-1/3 rounded-lg" }),
|
|
288
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "w-2/3" }),
|
|
289
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "w-1/2" })
|
|
290
|
+
]
|
|
291
|
+
}) : model.turns.length === 0 && model.queued.length === 0 && model.interrupts.length === 0 ? emptyState : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
292
|
+
model.turns.length === 0 && model.interrupts.length > 0 && /* @__PURE__ */ jsx(AgentMessage, {
|
|
293
|
+
turn: {
|
|
294
|
+
id: "request",
|
|
295
|
+
parts: [],
|
|
296
|
+
status: "interrupted",
|
|
297
|
+
actionCount: 0
|
|
298
|
+
},
|
|
299
|
+
isLast: true
|
|
300
|
+
}),
|
|
301
|
+
model.turns.map((turn) => {
|
|
302
|
+
const isLast = turn === lastTurn;
|
|
303
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(UserMessage, { turn }), needsAgentMessage(turn, isLast) && /* @__PURE__ */ jsx(AgentMessage, {
|
|
304
|
+
turn,
|
|
305
|
+
isLast
|
|
306
|
+
})] }, turn.id);
|
|
307
|
+
}),
|
|
308
|
+
model.queued.map((queued) => /* @__PURE__ */ jsx(ChatMessage, {
|
|
309
|
+
className: cn("duration-normal ease-out animate-in fade-in slide-in-from-bottom-1 motion-reduce:animate-none"),
|
|
310
|
+
message: {
|
|
311
|
+
id: queued.id,
|
|
312
|
+
role: "user",
|
|
313
|
+
status: "queued",
|
|
314
|
+
content: [{
|
|
315
|
+
id: "text",
|
|
316
|
+
type: "text",
|
|
317
|
+
text: queued.text,
|
|
318
|
+
appearance: "bubble"
|
|
319
|
+
}]
|
|
320
|
+
},
|
|
321
|
+
footer: cancelQueued ? /* @__PURE__ */ jsx(ChatMessageActions, {
|
|
322
|
+
status: "queued",
|
|
323
|
+
actions: { cancel: { onClick: () => void cancelQueued(queued.id) } }
|
|
324
|
+
}) : void 0
|
|
325
|
+
}, queued.id))
|
|
326
|
+
] })
|
|
327
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
328
|
+
role: "status",
|
|
329
|
+
"aria-live": "polite",
|
|
330
|
+
className: "sr-only",
|
|
331
|
+
children: announcement
|
|
332
|
+
})]
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
//#endregion
|
|
336
|
+
export { ChatThread };
|
|
337
|
+
|
|
338
|
+
//# sourceMappingURL=ChatThread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatThread.js","names":[],"sources":["../../../src/components/ChatThread/ChatThread.tsx"],"sourcesContent":["import { Fragment, type ReactNode, useMemo, useState } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\nimport {\n ChatComposer,\n ChatComposerAction,\n ChatComposerInput,\n ChatComposerToolbar,\n type ChatComposerProps,\n} from '../ChatComposer';\nimport { ChatConversation } from '../ChatConversation';\nimport {\n ChatMessage,\n ChatMessageActions,\n type ChatMessageActionCapabilities,\n type ChatMessageContentBlock,\n} from '../ChatMessage';\nimport { ChatPlan } from '../ChatPlan';\nimport { ChatState } from '../ChatState';\nimport { copyToClipboard } from '../CopyButton';\nimport { MarkdownDisplay } from '../MarkdownDisplay';\nimport { Skeleton } from '../Skeleton';\nimport { Text } from '../Text';\nimport { Textarea } from '../Textarea';\nimport type {\n ChatThreadController,\n ChatThreadInterrupt,\n ChatThreadStream,\n ChatThreadSubagent,\n ChatThreadToolRenderer,\n ChatThreadTurn,\n} from './ChatThread.types';\nimport {\n splitParts,\n ThreadContext,\n type ThreadContextValue,\n useThread,\n} from './ChatThreadContext';\nimport { InterruptRequests } from './ChatThreadRequests';\nimport {\n ImagePart,\n visibleActionCount,\n WorkParts,\n WorkSummary,\n} from './ChatThreadWork';\nimport { deepAgentTools } from './deepAgentTools';\nimport {\n useLangGraphChatThread,\n type UseLangGraphChatThreadOptions,\n} from './useLangGraphChatThread';\n\n/** Chat answers are bounded, so Markdown renders up to this many characters. */\nconst MAX_ANSWER_MARKDOWN = 100_000;\n\nfunction UserMessage({ turn }: { turn: ChatThreadTurn }) {\n const { thread } = useThread();\n const user = turn.user;\n const forkPoint = thread.useForkPoint ? thread.useForkPoint(turn) : undefined;\n const [editing, setEditing] = useState(false);\n const [draft, setDraft] = useState('');\n if (!user) return null;\n const busy = thread.model.status === 'running';\n const fork = forkPoint === undefined ? undefined : thread.actions.fork;\n\n if (editing && fork) {\n const save = () => {\n const text = draft.trim();\n if (!text) return;\n setEditing(false);\n fork(text, forkPoint).catch(() => {\n // Reopen the edit so the reader can send it again.\n setDraft(text);\n setEditing(true);\n });\n };\n return (\n <div\n data-chat-message-id={user.message.id}\n className=\"ml-auto flex w-full max-w-[85%] flex-col gap-space-2 rounded-lg border border-focus bg-elevated p-space-2 duration-normal ease-out animate-in fade-in zoom-in-95 motion-reduce:animate-none\"\n >\n <Textarea\n variant=\"plain\"\n aria-label=\"Edit message\"\n value={draft}\n onChange={setDraft}\n rows={3}\n resize=\"vertical\"\n autoFocus\n />\n <div className=\"flex justify-end gap-space-2\">\n <Button\n size=\"sm\"\n variant=\"plain\"\n color=\"secondary\"\n onClick={() => setEditing(false)}\n >\n Cancel\n </Button>\n <Button size=\"sm\" disabled={!draft.trim()} onClick={save}>\n Send\n </Button>\n </div>\n </div>\n );\n }\n\n const actions: ChatMessageActionCapabilities = {\n copy: { onClick: () => void copyToClipboard(user.text) },\n };\n if (fork) {\n actions.edit = {\n onClick: () => {\n setDraft(user.text);\n setEditing(true);\n },\n };\n actions.retry = {\n onClick: () => void fork(user.text, forkPoint),\n };\n }\n return (\n <ChatMessage\n message={user.message}\n footer={<ChatMessageActions actions={actions} readOnly={busy} />}\n />\n );\n}\n\nfunction AgentMessage({\n turn,\n isLast,\n}: {\n turn: ChatThreadTurn;\n isLast: boolean;\n}) {\n const { thread, agentName, tools } = useThread();\n const { work, answer } = splitParts(turn.parts);\n const actionCount = visibleActionCount(work, tools);\n const hasActions = actionCount > 0;\n const showInterrupts = isLast && thread.model.interrupts.length > 0;\n const blocks: ChatMessageContentBlock[] = [];\n\n if (work.length > 0) {\n blocks.push({\n id: 'work',\n type: 'custom',\n content: hasActions ? (\n <WorkSummary turn={turn} parts={work} count={actionCount} />\n ) : (\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n <WorkParts parts={work} />\n </div>\n ),\n });\n }\n if (showInterrupts) {\n blocks.push({\n id: 'interrupts',\n type: 'custom',\n content: <InterruptRequests />,\n });\n }\n for (const part of answer) {\n if (part.type === 'image') {\n blocks.push({\n id: part.id,\n type: 'custom',\n content: <ImagePart url={part.url} />,\n });\n continue;\n }\n if (part.type !== 'text') continue;\n blocks.push({\n id: part.id,\n type: 'custom',\n content: (\n <MarkdownDisplay\n content={part.text}\n isStreaming={part.streaming}\n maxMarkdownLength={MAX_ANSWER_MARKDOWN}\n />\n ),\n });\n }\n if (turn.error) {\n blocks.push({\n id: 'error',\n type: 'custom',\n content: (\n <div className=\"flex min-w-0 items-start gap-space-2 rounded-lg bg-error-subtle px-space-3 py-space-2\">\n <ChatState\n status=\"failed\"\n variant=\"simple\"\n showElapsed={false}\n announce={false}\n />\n <Text\n variant=\"sm\"\n color=\"error\"\n className=\"min-w-0 [overflow-wrap:anywhere]\"\n >\n {turn.error}\n </Text>\n </div>\n ),\n });\n }\n\n const answerText = answer\n .map((part) => (part.type === 'text' ? part.text : ''))\n .join('\\n\\n')\n .trim();\n return (\n <ChatMessage\n message={{\n id: `${turn.id}:agent`,\n role: 'assistant',\n // A paused turn is waiting on the reader, not broken; the work\n // summary and the request below it say so.\n status: turn.status === 'interrupted' ? 'idle' : turn.status,\n content: blocks,\n }}\n name={agentName}\n isLatest={isLast}\n footer={\n answerText ? (\n <ChatMessageActions\n status={turn.status}\n actions={{\n copy: { onClick: () => void copyToClipboard(answerText) },\n }}\n />\n ) : undefined\n }\n />\n );\n}\n\ntype ComposerSlots = Pick<\n ChatThreadProps,\n 'placeholder' | 'modelSelector' | 'composerTools' | 'composerActions'\n>;\n\nfunction ThreadComposer({\n placeholder,\n modelSelector,\n composerTools,\n composerActions,\n}: ComposerSlots) {\n const { thread } = useThread();\n const { model, actions, stopping } = thread;\n const [draft, setDraft] = useState('');\n const running = model.status === 'running';\n const waiting = model.status === 'interrupted';\n const stop = actions.stop;\n const actionProps: Pick<ChatComposerProps, 'action' | 'onStop'> = stopping\n ? { action: 'stopping' }\n : running && stop && !draft.trim()\n ? { action: 'stop', onStop: () => void stop() }\n : { action: 'send' };\n const plan = model.plan;\n const showPlan =\n plan !== undefined &&\n (running || plan.some((item) => item.status !== 'completed'));\n\n return (\n <ChatComposer\n {...(actionProps as ChatComposerProps)}\n drawer={\n showPlan ? <ChatPlan items={plan} presentation=\"drawer\" /> : undefined\n }\n // A pending request has to be answered before the agent can continue.\n submitDisabled={!draft.trim() || waiting}\n onSubmit={() => {\n const text = draft.trim();\n if (!text) return;\n setDraft('');\n actions.send(text).catch(() => {\n // Keep the message if it couldn't be sent.\n setDraft((current) => current || text);\n });\n }}\n >\n <ChatComposerInput\n value={draft}\n onChange={setDraft}\n aria-label=\"Message\"\n placeholder={\n placeholder ??\n (waiting\n ? 'Answer the request above to continue'\n : running\n ? 'Queue a follow-up'\n : 'Message the agent')\n }\n />\n <ChatComposerToolbar\n modelSelector={modelSelector}\n actions={\n <>\n {composerActions}\n <ChatComposerAction />\n </>\n }\n >\n {composerTools}\n </ChatComposerToolbar>\n </ChatComposer>\n );\n}\n\nconst ANNOUNCEMENTS = {\n idle: 'Response complete',\n failed: 'Response failed',\n interrupted: 'The agent is waiting for your input',\n running: '',\n} as const;\n\nfunction useStatusAnnouncement(status: keyof typeof ANNOUNCEMENTS) {\n const [previous, setPrevious] = useState(status);\n const [announcement, setAnnouncement] = useState('');\n if (status !== previous) {\n setPrevious(status);\n setAnnouncement(previous === 'running' ? ANNOUNCEMENTS[status] : '');\n }\n return announcement;\n}\n\ninterface ChatThreadViewProps {\n /** Tool presentations by tool name, applied over `deepAgentTools`. */\n tools?: Record<string, ChatThreadToolRenderer>;\n /**\n * Renders an interrupt yourself, such as a sign-in prompt. Return\n * undefined to use the default approval, reply, or response card.\n */\n renderInterrupt?: (\n interrupt: ChatThreadInterrupt,\n thread: ChatThreadController\n ) => ReactNode | undefined;\n /** Opens a subagent's full thread, such as in a side pane. */\n onOpenSubagent?: (subagent: ChatThreadSubagent) => void;\n /** Names the agent in its message headers. */\n agentName?: string;\n /** Fixed content above the conversation. */\n header?: ReactNode;\n /** Shown before the first message. */\n emptyState?: ReactNode;\n /** Composer placeholder; defaults follow the run's state. */\n placeholder?: string;\n /** The composer's model picker, such as `ChatComposerModelSelect`. */\n modelSelector?: ReactNode;\n /** Composer tools before the model picker, such as an attachment menu. */\n composerTools?: ReactNode;\n /** Shown before Send/Stop, such as `ChatContextWindowPopover`. */\n composerActions?: ReactNode;\n /** Names the conversation region. */\n label?: string;\n className?: string;\n}\n\n/**\n * The default: a LangGraph `useStream` handle, adapted by\n * `useLangGraphChatThread`.\n */\nexport interface ChatThreadStreamProps\n extends ChatThreadViewProps, UseLangGraphChatThreadOptions {\n /** A `useStream` handle from `@langchain/react` (1.x, 2.0) or the 0.3.x hook. */\n stream: ChatThreadStream;\n thread?: never;\n}\n\n/** Bring your own adapter: any stream or data mapped to a controller. */\nexport interface ChatThreadControllerProps extends ChatThreadViewProps {\n /**\n * The thread to render: from `useLangGraphChatThread`, or your own adapter\n * for another stream or data source.\n */\n thread: ChatThreadController;\n stream?: never;\n}\n\nexport type ChatThreadProps = ChatThreadStreamProps | ChatThreadControllerProps;\n\n/**\n * An agent conversation view built from Macaw chat parts: messages,\n * reasoning, tool calls, subagents, approvals, the plan, queued messages,\n * and the composer. Pass a LangGraph `stream` to use the built-in\n * `useLangGraphChatThread` adapter, or a `thread` from your own adapter.\n * Pick one for the life of the component.\n */\nexport function ChatThread(props: ChatThreadProps) {\n if (props.thread) return <ChatThreadView {...props} thread={props.thread} />;\n return <StreamChatThread {...props} />;\n}\n\nfunction StreamChatThread({\n stream,\n selectors,\n hideMessage,\n messagesKey,\n subagentTools,\n ...props\n}: ChatThreadStreamProps) {\n const thread = useLangGraphChatThread(stream, {\n selectors,\n hideMessage,\n messagesKey,\n subagentTools,\n });\n return <ChatThreadView {...props} thread={thread} />;\n}\n\nfunction ChatThreadView({\n thread,\n tools,\n renderInterrupt,\n onOpenSubagent,\n agentName,\n header,\n emptyState,\n placeholder,\n modelSelector,\n composerTools,\n composerActions,\n label = 'Agent conversation',\n className,\n}: ChatThreadViewProps & { thread: ChatThreadController }) {\n const toolPresentations = useMemo(\n () => ({ ...deepAgentTools, ...tools }),\n [tools]\n );\n const { model, isThreadLoading, actions } = thread;\n const cancelQueued = actions.cancelQueued;\n const announcement = useStatusAnnouncement(model.status);\n const context = useMemo<ThreadContextValue>(\n () => ({\n thread,\n tools: toolPresentations,\n agentName,\n renderInterrupt,\n onOpenSubagent,\n }),\n [thread, toolPresentations, agentName, renderInterrupt, onOpenSubagent]\n );\n const lastTurn = model.turns.at(-1);\n // A run that has started but not produced output yet still shows the\n // agent's message, so its status reads \"Responding\".\n const needsAgentMessage = (turn: ChatThreadTurn, isLast: boolean) =>\n turn.parts.length > 0 ||\n Boolean(turn.error) ||\n (isLast && (turn.status === 'streaming' || model.interrupts.length > 0));\n\n return (\n <ThreadContext.Provider value={context}>\n <ChatConversation\n label={label}\n header={header}\n footer={\n <ThreadComposer\n placeholder={placeholder}\n modelSelector={modelSelector}\n composerTools={composerTools}\n composerActions={composerActions}\n />\n }\n pinnedMessageId={thread.sentMessageId}\n className={className}\n >\n {isThreadLoading ? (\n <div\n role=\"status\"\n aria-label=\"Loading conversation\"\n className=\"flex flex-col gap-space-4\"\n >\n <Skeleton className=\"ml-auto h-9 w-1/3 rounded-lg\" />\n <Skeleton className=\"w-2/3\" />\n <Skeleton className=\"w-1/2\" />\n </div>\n ) : model.turns.length === 0 &&\n model.queued.length === 0 &&\n model.interrupts.length === 0 ? (\n emptyState\n ) : (\n <>\n {model.turns.length === 0 && model.interrupts.length > 0 && (\n // A request can arrive before any message, such as one the\n // graph raises at its first step.\n <AgentMessage\n turn={{\n id: 'request',\n parts: [],\n status: 'interrupted',\n actionCount: 0,\n }}\n isLast\n />\n )}\n {model.turns.map((turn) => {\n const isLast = turn === lastTurn;\n return (\n <Fragment key={turn.id}>\n <UserMessage turn={turn} />\n {needsAgentMessage(turn, isLast) && (\n <AgentMessage turn={turn} isLast={isLast} />\n )}\n </Fragment>\n );\n })}\n {model.queued.map((queued) => (\n <ChatMessage\n key={queued.id}\n className={cn(\n 'duration-normal ease-out animate-in fade-in slide-in-from-bottom-1 motion-reduce:animate-none'\n )}\n message={{\n id: queued.id,\n role: 'user',\n status: 'queued',\n content: [\n {\n id: 'text',\n type: 'text',\n text: queued.text,\n appearance: 'bubble',\n },\n ],\n }}\n footer={\n cancelQueued ? (\n <ChatMessageActions\n status=\"queued\"\n actions={{\n cancel: {\n onClick: () => void cancelQueued(queued.id),\n },\n }}\n />\n ) : undefined\n }\n />\n ))}\n </>\n )}\n </ChatConversation>\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {announcement}\n </span>\n </ThreadContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqDA,IAAM,sBAAsB;AAE5B,SAAS,YAAY,EAAE,QAAkC;CACvD,MAAM,EAAE,WAAW,UAAU;CAC7B,MAAM,OAAO,KAAK;CAClB,MAAM,YAAY,OAAO,eAAe,OAAO,aAAa,IAAI,IAAI,KAAA;CACpE,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CACrC,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,OAAO,OAAO,MAAM,WAAW;CACrC,MAAM,OAAO,cAAc,KAAA,IAAY,KAAA,IAAY,OAAO,QAAQ;CAElE,IAAI,WAAW,MAAM;EACnB,MAAM,aAAa;GACjB,MAAM,OAAO,MAAM,KAAK;GACxB,IAAI,CAAC,MAAM;GACX,WAAW,KAAK;GAChB,KAAK,MAAM,SAAS,CAAC,CAAC,YAAY;IAEhC,SAAS,IAAI;IACb,WAAW,IAAI;GACjB,CAAC;EACH;EACA,OACE,qBAAC,OAAD;GACE,wBAAsB,KAAK,QAAQ;GACnC,WAAU;GAFZ,UAAA,CAIE,oBAAC,UAAD;IACE,SAAQ;IACR,cAAW;IACX,OAAO;IACP,UAAU;IACV,MAAM;IACN,QAAO;IACP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