@optilogic/chat 1.3.3 → 1.3.5
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/index.cjs +233 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +132 -2
- package/dist/index.d.ts +132 -2
- package/dist/index.js +233 -185
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/agent-response/AgentResponse.tsx +63 -1
- package/src/components/agent-response/components/ActionBar.tsx +15 -0
- package/src/components/agent-response/components/ActivityIndicators.tsx +27 -1
- package/src/components/agent-response/components/MetadataRow.tsx +20 -0
- package/src/components/agent-response/hooks/useAgentResponseAccumulator.ts +6 -216
- package/src/components/agent-response/index.ts +8 -1
- package/src/components/agent-response/reducer.ts +252 -0
- package/src/components/agent-response/types.ts +8 -0
- package/src/components/user-prompt-input/UserPromptInput.tsx +3 -0
- package/src/components/user-prompt-input/types.ts +13 -0
- package/src/index.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -7,7 +7,18 @@ import { SlateEditor, Text } from '@optilogic/editor';
|
|
|
7
7
|
|
|
8
8
|
// src/components/agent-response/AgentResponse.tsx
|
|
9
9
|
var ActivityIndicators = React11.forwardRef(
|
|
10
|
-
({
|
|
10
|
+
({
|
|
11
|
+
toolCalls,
|
|
12
|
+
knowledge,
|
|
13
|
+
memory,
|
|
14
|
+
statusUpdates = [],
|
|
15
|
+
statusUpdateAnchor,
|
|
16
|
+
toolCallsAnchor,
|
|
17
|
+
knowledgeAnchor,
|
|
18
|
+
memoryAnchor,
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}, ref) => {
|
|
11
22
|
const hasAnyActivity = toolCalls.length > 0 || knowledge.length > 0 || memory.length > 0 || statusUpdates.length > 0;
|
|
12
23
|
if (!hasAnyActivity) return null;
|
|
13
24
|
return /* @__PURE__ */ jsxs("div", { ref, className: cn("flex items-center gap-2", className), ...props, children: [
|
|
@@ -15,6 +26,7 @@ var ActivityIndicators = React11.forwardRef(
|
|
|
15
26
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
16
27
|
"button",
|
|
17
28
|
{
|
|
29
|
+
"data-tour": statusUpdateAnchor,
|
|
18
30
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
19
31
|
onClick: (e) => e.stopPropagation(),
|
|
20
32
|
children: [
|
|
@@ -35,6 +47,7 @@ var ActivityIndicators = React11.forwardRef(
|
|
|
35
47
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
36
48
|
"button",
|
|
37
49
|
{
|
|
50
|
+
"data-tour": toolCallsAnchor,
|
|
38
51
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
39
52
|
onClick: (e) => e.stopPropagation(),
|
|
40
53
|
children: [
|
|
@@ -55,6 +68,7 @@ var ActivityIndicators = React11.forwardRef(
|
|
|
55
68
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
56
69
|
"button",
|
|
57
70
|
{
|
|
71
|
+
"data-tour": knowledgeAnchor,
|
|
58
72
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
59
73
|
onClick: (e) => e.stopPropagation(),
|
|
60
74
|
children: [
|
|
@@ -75,6 +89,7 @@ var ActivityIndicators = React11.forwardRef(
|
|
|
75
89
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
76
90
|
"button",
|
|
77
91
|
{
|
|
92
|
+
"data-tour": memoryAnchor,
|
|
78
93
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
79
94
|
onClick: (e) => e.stopPropagation(),
|
|
80
95
|
children: [
|
|
@@ -137,6 +152,11 @@ var MetadataRow = React11.forwardRef(
|
|
|
137
152
|
statusContent,
|
|
138
153
|
status,
|
|
139
154
|
elapsedTime,
|
|
155
|
+
thinkingToggleAnchor,
|
|
156
|
+
statusUpdateAnchor,
|
|
157
|
+
toolCallsAnchor,
|
|
158
|
+
knowledgeAnchor,
|
|
159
|
+
memoryAnchor,
|
|
140
160
|
className,
|
|
141
161
|
...props
|
|
142
162
|
}, ref) => {
|
|
@@ -172,6 +192,7 @@ var MetadataRow = React11.forwardRef(
|
|
|
172
192
|
hasThinking ? /* @__PURE__ */ jsx(
|
|
173
193
|
"button",
|
|
174
194
|
{
|
|
195
|
+
"data-tour": thinkingToggleAnchor,
|
|
175
196
|
onClick: onToggle,
|
|
176
197
|
className: "flex items-center gap-1.5 hover:bg-muted/50 -ml-1.5 pl-1.5 pr-2 py-0.5 rounded transition-colors shrink-0",
|
|
177
198
|
children: leftContent
|
|
@@ -184,7 +205,11 @@ var MetadataRow = React11.forwardRef(
|
|
|
184
205
|
toolCalls,
|
|
185
206
|
knowledge,
|
|
186
207
|
memory,
|
|
187
|
-
statusUpdates
|
|
208
|
+
statusUpdates,
|
|
209
|
+
statusUpdateAnchor,
|
|
210
|
+
toolCallsAnchor,
|
|
211
|
+
knowledgeAnchor,
|
|
212
|
+
memoryAnchor
|
|
188
213
|
}
|
|
189
214
|
)
|
|
190
215
|
]
|
|
@@ -255,6 +280,9 @@ var ActionBar = React11.forwardRef(
|
|
|
255
280
|
feedback,
|
|
256
281
|
onFeedbackChange,
|
|
257
282
|
onResponseCopy,
|
|
283
|
+
copyAnchor,
|
|
284
|
+
thumbsUpAnchor,
|
|
285
|
+
thumbsDownAnchor,
|
|
258
286
|
className,
|
|
259
287
|
...props
|
|
260
288
|
}, ref) => {
|
|
@@ -295,6 +323,7 @@ var ActionBar = React11.forwardRef(
|
|
|
295
323
|
/* @__PURE__ */ jsx(
|
|
296
324
|
"button",
|
|
297
325
|
{
|
|
326
|
+
"data-tour": copyAnchor,
|
|
298
327
|
onClick: handleCopy,
|
|
299
328
|
className: "p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",
|
|
300
329
|
title: copied ? "Copied!" : "Copy response",
|
|
@@ -304,6 +333,7 @@ var ActionBar = React11.forwardRef(
|
|
|
304
333
|
/* @__PURE__ */ jsx(
|
|
305
334
|
"button",
|
|
306
335
|
{
|
|
336
|
+
"data-tour": thumbsUpAnchor,
|
|
307
337
|
onClick: handleThumbsUp,
|
|
308
338
|
className: cn(
|
|
309
339
|
"p-1.5 rounded hover:bg-muted transition-colors",
|
|
@@ -316,6 +346,7 @@ var ActionBar = React11.forwardRef(
|
|
|
316
346
|
/* @__PURE__ */ jsx(
|
|
317
347
|
"button",
|
|
318
348
|
{
|
|
349
|
+
"data-tour": thumbsDownAnchor,
|
|
319
350
|
onClick: handleThumbsDown,
|
|
320
351
|
className: cn(
|
|
321
352
|
"p-1.5 rounded hover:bg-muted transition-colors",
|
|
@@ -824,6 +855,188 @@ function deduplicateEntries(entries) {
|
|
|
824
855
|
return result;
|
|
825
856
|
}
|
|
826
857
|
|
|
858
|
+
// src/components/agent-response/reducer.ts
|
|
859
|
+
function reduceAgentMessage(prev, payload) {
|
|
860
|
+
const now = payload.timestamp ?? Date.now();
|
|
861
|
+
let newStatus = prev.status;
|
|
862
|
+
const isFirstMessage = prev.status === "idle" && payload.type !== "status";
|
|
863
|
+
if (isFirstMessage) {
|
|
864
|
+
newStatus = "processing";
|
|
865
|
+
}
|
|
866
|
+
const firstMessageTime = prev.firstMessageTime ?? (isFirstMessage ? now : null);
|
|
867
|
+
switch (payload.type) {
|
|
868
|
+
case "status":
|
|
869
|
+
if (payload.message === "Harness connected" || payload.status === "Harness connected") {
|
|
870
|
+
return { ...initialAgentResponseState };
|
|
871
|
+
}
|
|
872
|
+
return { ...prev, status: newStatus };
|
|
873
|
+
case "thinking": {
|
|
874
|
+
if (payload.thinkingStep) {
|
|
875
|
+
const newStep = {
|
|
876
|
+
id: payload.thinkingStep.id || `step-${now}`,
|
|
877
|
+
label: payload.thinkingStep.label,
|
|
878
|
+
content: payload.thinkingStep.content,
|
|
879
|
+
depth: payload.thinkingStep.depth ?? payload.depth ?? 0,
|
|
880
|
+
isCollapsed: payload.thinkingStep.isCollapsed,
|
|
881
|
+
timestamp: now,
|
|
882
|
+
agentName: payload.agentName,
|
|
883
|
+
parentAgent: payload.parentAgent
|
|
884
|
+
};
|
|
885
|
+
const thinkingStartTime2 = prev.thinkingStartTime ?? now;
|
|
886
|
+
const next2 = {
|
|
887
|
+
...prev,
|
|
888
|
+
status: newStatus,
|
|
889
|
+
thinkingSteps: [...prev.thinkingSteps || [], newStep],
|
|
890
|
+
thinkingStartTime: thinkingStartTime2,
|
|
891
|
+
firstMessageTime
|
|
892
|
+
};
|
|
893
|
+
return { ...next2, timelineEntries: buildTimelineEntries(next2) };
|
|
894
|
+
}
|
|
895
|
+
const newThinking = payload.message || payload.content || "";
|
|
896
|
+
const separator = prev.thinking && newThinking ? "\n\n" : "";
|
|
897
|
+
const thinkingStartTime = prev.thinkingStartTime ?? (newThinking ? now : null);
|
|
898
|
+
const prevSteps = prev.thinkingSteps || [];
|
|
899
|
+
const plainStep = {
|
|
900
|
+
id: `step-${prevSteps.length}`,
|
|
901
|
+
label: newThinking,
|
|
902
|
+
content: newThinking,
|
|
903
|
+
depth: payload.depth ?? 0,
|
|
904
|
+
timestamp: now,
|
|
905
|
+
agentName: payload.agentName,
|
|
906
|
+
parentAgent: payload.parentAgent
|
|
907
|
+
};
|
|
908
|
+
const next = {
|
|
909
|
+
...prev,
|
|
910
|
+
status: newStatus,
|
|
911
|
+
thinking: prev.thinking + separator + newThinking,
|
|
912
|
+
thinkingSteps: [...prevSteps, plainStep],
|
|
913
|
+
thinkingStartTime,
|
|
914
|
+
firstMessageTime
|
|
915
|
+
};
|
|
916
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
917
|
+
}
|
|
918
|
+
case "tool_call": {
|
|
919
|
+
const toolName = payload.message || payload.tool?.name;
|
|
920
|
+
if (toolName) {
|
|
921
|
+
const newToolCall = {
|
|
922
|
+
id: payload.tool?.id || `tool-${now}`,
|
|
923
|
+
name: toolName,
|
|
924
|
+
arguments: payload.tool?.arguments,
|
|
925
|
+
timestamp: now,
|
|
926
|
+
agentName: payload.agentName,
|
|
927
|
+
parentAgent: payload.parentAgent,
|
|
928
|
+
depth: payload.depth
|
|
929
|
+
};
|
|
930
|
+
const next = {
|
|
931
|
+
...prev,
|
|
932
|
+
status: newStatus,
|
|
933
|
+
toolCalls: [...prev.toolCalls, newToolCall],
|
|
934
|
+
firstMessageTime
|
|
935
|
+
};
|
|
936
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
937
|
+
}
|
|
938
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
939
|
+
}
|
|
940
|
+
case "knowledge": {
|
|
941
|
+
const knowledgeContent = payload.message || payload.knowledge?.content;
|
|
942
|
+
if (knowledgeContent) {
|
|
943
|
+
const newKnowledge = {
|
|
944
|
+
id: payload.knowledge?.id || `knowledge-${now}`,
|
|
945
|
+
source: payload.knowledge?.source || "unknown",
|
|
946
|
+
content: knowledgeContent,
|
|
947
|
+
timestamp: now,
|
|
948
|
+
agentName: payload.agentName,
|
|
949
|
+
parentAgent: payload.parentAgent,
|
|
950
|
+
depth: payload.depth
|
|
951
|
+
};
|
|
952
|
+
const next = {
|
|
953
|
+
...prev,
|
|
954
|
+
status: newStatus,
|
|
955
|
+
knowledge: [...prev.knowledge, newKnowledge],
|
|
956
|
+
firstMessageTime
|
|
957
|
+
};
|
|
958
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
959
|
+
}
|
|
960
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
961
|
+
}
|
|
962
|
+
case "memory": {
|
|
963
|
+
const memoryContent = payload.message || payload.memory?.content;
|
|
964
|
+
if (memoryContent) {
|
|
965
|
+
const newMemory = {
|
|
966
|
+
id: payload.memory?.id || `memory-${now}`,
|
|
967
|
+
type: payload.memory?.type || "unknown",
|
|
968
|
+
content: memoryContent,
|
|
969
|
+
timestamp: now,
|
|
970
|
+
agentName: payload.agentName,
|
|
971
|
+
parentAgent: payload.parentAgent,
|
|
972
|
+
depth: payload.depth
|
|
973
|
+
};
|
|
974
|
+
const next = {
|
|
975
|
+
...prev,
|
|
976
|
+
status: newStatus,
|
|
977
|
+
memory: [...prev.memory, newMemory],
|
|
978
|
+
firstMessageTime
|
|
979
|
+
};
|
|
980
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
981
|
+
}
|
|
982
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
983
|
+
}
|
|
984
|
+
case "response":
|
|
985
|
+
return {
|
|
986
|
+
...prev,
|
|
987
|
+
status: "complete",
|
|
988
|
+
response: payload.message || payload.content || "",
|
|
989
|
+
responseCompleteTime: now,
|
|
990
|
+
firstMessageTime: prev.firstMessageTime ?? now
|
|
991
|
+
};
|
|
992
|
+
case "status_update": {
|
|
993
|
+
const statusMessage = payload.message || payload.statusUpdate?.message;
|
|
994
|
+
if (statusMessage) {
|
|
995
|
+
const newStatusItem = {
|
|
996
|
+
id: payload.statusUpdate?.id || `status-${now}`,
|
|
997
|
+
message: statusMessage,
|
|
998
|
+
agent: payload.statusUpdate?.agent,
|
|
999
|
+
timestamp: now,
|
|
1000
|
+
agentName: payload.agentName,
|
|
1001
|
+
parentAgent: payload.parentAgent,
|
|
1002
|
+
depth: payload.depth
|
|
1003
|
+
};
|
|
1004
|
+
const next = {
|
|
1005
|
+
...prev,
|
|
1006
|
+
status: newStatus,
|
|
1007
|
+
statusUpdates: [...prev.statusUpdates, newStatusItem],
|
|
1008
|
+
firstMessageTime
|
|
1009
|
+
};
|
|
1010
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
1011
|
+
}
|
|
1012
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
1013
|
+
}
|
|
1014
|
+
case "potential_response": {
|
|
1015
|
+
const respContent = payload.message || payload.content || "";
|
|
1016
|
+
if (respContent) {
|
|
1017
|
+
const newResp = {
|
|
1018
|
+
id: `resp-${now}`,
|
|
1019
|
+
content: respContent,
|
|
1020
|
+
timestamp: now,
|
|
1021
|
+
agentName: payload.agentName,
|
|
1022
|
+
parentAgent: payload.parentAgent,
|
|
1023
|
+
depth: payload.depth
|
|
1024
|
+
};
|
|
1025
|
+
const next = {
|
|
1026
|
+
...prev,
|
|
1027
|
+
status: newStatus,
|
|
1028
|
+
potentialResponses: [...prev.potentialResponses || [], newResp],
|
|
1029
|
+
firstMessageTime
|
|
1030
|
+
};
|
|
1031
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
1032
|
+
}
|
|
1033
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
1034
|
+
}
|
|
1035
|
+
default:
|
|
1036
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
|
|
827
1040
|
// src/components/agent-response/hooks/useAgentResponseAccumulator.ts
|
|
828
1041
|
function useAgentResponseAccumulator(options) {
|
|
829
1042
|
const [state, setState] = useState(initialAgentResponseState);
|
|
@@ -838,185 +1051,7 @@ function useAgentResponseAccumulator(options) {
|
|
|
838
1051
|
} else {
|
|
839
1052
|
payload = message;
|
|
840
1053
|
}
|
|
841
|
-
setState((prev) =>
|
|
842
|
-
let newStatus = prev.status;
|
|
843
|
-
const isFirstMessage = prev.status === "idle" && payload.type !== "status";
|
|
844
|
-
if (isFirstMessage) {
|
|
845
|
-
newStatus = "processing";
|
|
846
|
-
}
|
|
847
|
-
const firstMessageTime = prev.firstMessageTime ?? (isFirstMessage ? Date.now() : null);
|
|
848
|
-
switch (payload.type) {
|
|
849
|
-
case "status":
|
|
850
|
-
if (payload.message === "Harness connected" || payload.status === "Harness connected") {
|
|
851
|
-
return { ...initialAgentResponseState };
|
|
852
|
-
}
|
|
853
|
-
return { ...prev, status: newStatus };
|
|
854
|
-
case "thinking": {
|
|
855
|
-
if (payload.thinkingStep) {
|
|
856
|
-
const newStep = {
|
|
857
|
-
id: payload.thinkingStep.id || `step-${Date.now()}`,
|
|
858
|
-
label: payload.thinkingStep.label,
|
|
859
|
-
content: payload.thinkingStep.content,
|
|
860
|
-
depth: payload.thinkingStep.depth ?? payload.depth ?? 0,
|
|
861
|
-
isCollapsed: payload.thinkingStep.isCollapsed,
|
|
862
|
-
timestamp: Date.now(),
|
|
863
|
-
agentName: payload.agentName,
|
|
864
|
-
parentAgent: payload.parentAgent
|
|
865
|
-
};
|
|
866
|
-
const thinkingStartTime2 = prev.thinkingStartTime ?? Date.now();
|
|
867
|
-
const next2 = {
|
|
868
|
-
...prev,
|
|
869
|
-
status: newStatus,
|
|
870
|
-
thinkingSteps: [...prev.thinkingSteps || [], newStep],
|
|
871
|
-
thinkingStartTime: thinkingStartTime2,
|
|
872
|
-
firstMessageTime
|
|
873
|
-
};
|
|
874
|
-
return { ...next2, timelineEntries: buildTimelineEntries(next2) };
|
|
875
|
-
}
|
|
876
|
-
const newThinking = payload.message || payload.content || "";
|
|
877
|
-
const separator = prev.thinking && newThinking ? "\n\n" : "";
|
|
878
|
-
const thinkingStartTime = prev.thinkingStartTime ?? (newThinking ? Date.now() : null);
|
|
879
|
-
const prevSteps = prev.thinkingSteps || [];
|
|
880
|
-
const plainStep = {
|
|
881
|
-
id: `step-${prevSteps.length}`,
|
|
882
|
-
label: newThinking,
|
|
883
|
-
content: newThinking,
|
|
884
|
-
depth: payload.depth ?? 0,
|
|
885
|
-
timestamp: Date.now(),
|
|
886
|
-
agentName: payload.agentName,
|
|
887
|
-
parentAgent: payload.parentAgent
|
|
888
|
-
};
|
|
889
|
-
const next = {
|
|
890
|
-
...prev,
|
|
891
|
-
status: newStatus,
|
|
892
|
-
thinking: prev.thinking + separator + newThinking,
|
|
893
|
-
thinkingSteps: [...prevSteps, plainStep],
|
|
894
|
-
thinkingStartTime,
|
|
895
|
-
firstMessageTime
|
|
896
|
-
};
|
|
897
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
898
|
-
}
|
|
899
|
-
case "tool_call": {
|
|
900
|
-
const toolName = payload.message || payload.tool?.name;
|
|
901
|
-
if (toolName) {
|
|
902
|
-
const newToolCall = {
|
|
903
|
-
id: payload.tool?.id || `tool-${Date.now()}`,
|
|
904
|
-
name: toolName,
|
|
905
|
-
arguments: payload.tool?.arguments,
|
|
906
|
-
timestamp: Date.now(),
|
|
907
|
-
agentName: payload.agentName,
|
|
908
|
-
parentAgent: payload.parentAgent,
|
|
909
|
-
depth: payload.depth
|
|
910
|
-
};
|
|
911
|
-
const next = {
|
|
912
|
-
...prev,
|
|
913
|
-
status: newStatus,
|
|
914
|
-
toolCalls: [...prev.toolCalls, newToolCall],
|
|
915
|
-
firstMessageTime
|
|
916
|
-
};
|
|
917
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
918
|
-
}
|
|
919
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
920
|
-
}
|
|
921
|
-
case "knowledge": {
|
|
922
|
-
const knowledgeContent = payload.message || payload.knowledge?.content;
|
|
923
|
-
if (knowledgeContent) {
|
|
924
|
-
const newKnowledge = {
|
|
925
|
-
id: payload.knowledge?.id || `knowledge-${Date.now()}`,
|
|
926
|
-
source: payload.knowledge?.source || "unknown",
|
|
927
|
-
content: knowledgeContent,
|
|
928
|
-
timestamp: Date.now(),
|
|
929
|
-
agentName: payload.agentName,
|
|
930
|
-
parentAgent: payload.parentAgent,
|
|
931
|
-
depth: payload.depth
|
|
932
|
-
};
|
|
933
|
-
const next = {
|
|
934
|
-
...prev,
|
|
935
|
-
status: newStatus,
|
|
936
|
-
knowledge: [...prev.knowledge, newKnowledge],
|
|
937
|
-
firstMessageTime
|
|
938
|
-
};
|
|
939
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
940
|
-
}
|
|
941
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
942
|
-
}
|
|
943
|
-
case "memory": {
|
|
944
|
-
const memoryContent = payload.message || payload.memory?.content;
|
|
945
|
-
if (memoryContent) {
|
|
946
|
-
const newMemory = {
|
|
947
|
-
id: payload.memory?.id || `memory-${Date.now()}`,
|
|
948
|
-
type: payload.memory?.type || "unknown",
|
|
949
|
-
content: memoryContent,
|
|
950
|
-
timestamp: Date.now(),
|
|
951
|
-
agentName: payload.agentName,
|
|
952
|
-
parentAgent: payload.parentAgent,
|
|
953
|
-
depth: payload.depth
|
|
954
|
-
};
|
|
955
|
-
const next = {
|
|
956
|
-
...prev,
|
|
957
|
-
status: newStatus,
|
|
958
|
-
memory: [...prev.memory, newMemory],
|
|
959
|
-
firstMessageTime
|
|
960
|
-
};
|
|
961
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
962
|
-
}
|
|
963
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
964
|
-
}
|
|
965
|
-
case "response":
|
|
966
|
-
return {
|
|
967
|
-
...prev,
|
|
968
|
-
status: "complete",
|
|
969
|
-
response: payload.message || payload.content || "",
|
|
970
|
-
responseCompleteTime: Date.now(),
|
|
971
|
-
firstMessageTime: prev.firstMessageTime ?? Date.now()
|
|
972
|
-
};
|
|
973
|
-
case "status_update": {
|
|
974
|
-
const statusMessage = payload.message || payload.statusUpdate?.message;
|
|
975
|
-
if (statusMessage) {
|
|
976
|
-
const newStatusItem = {
|
|
977
|
-
id: payload.statusUpdate?.id || `status-${Date.now()}`,
|
|
978
|
-
message: statusMessage,
|
|
979
|
-
agent: payload.statusUpdate?.agent,
|
|
980
|
-
timestamp: Date.now(),
|
|
981
|
-
agentName: payload.agentName,
|
|
982
|
-
parentAgent: payload.parentAgent,
|
|
983
|
-
depth: payload.depth
|
|
984
|
-
};
|
|
985
|
-
const next = {
|
|
986
|
-
...prev,
|
|
987
|
-
status: newStatus,
|
|
988
|
-
statusUpdates: [...prev.statusUpdates, newStatusItem],
|
|
989
|
-
firstMessageTime
|
|
990
|
-
};
|
|
991
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
992
|
-
}
|
|
993
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
994
|
-
}
|
|
995
|
-
case "potential_response": {
|
|
996
|
-
const respContent = payload.message || payload.content || "";
|
|
997
|
-
if (respContent) {
|
|
998
|
-
const newResp = {
|
|
999
|
-
id: `resp-${Date.now()}`,
|
|
1000
|
-
content: respContent,
|
|
1001
|
-
timestamp: Date.now(),
|
|
1002
|
-
agentName: payload.agentName,
|
|
1003
|
-
parentAgent: payload.parentAgent,
|
|
1004
|
-
depth: payload.depth
|
|
1005
|
-
};
|
|
1006
|
-
const next = {
|
|
1007
|
-
...prev,
|
|
1008
|
-
status: newStatus,
|
|
1009
|
-
potentialResponses: [...prev.potentialResponses || [], newResp],
|
|
1010
|
-
firstMessageTime
|
|
1011
|
-
};
|
|
1012
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
1013
|
-
}
|
|
1014
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
1015
|
-
}
|
|
1016
|
-
default:
|
|
1017
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
1018
|
-
}
|
|
1019
|
-
});
|
|
1054
|
+
setState((prev) => reduceAgentMessage(prev, payload));
|
|
1020
1055
|
},
|
|
1021
1056
|
[topic]
|
|
1022
1057
|
);
|
|
@@ -1325,6 +1360,7 @@ var AgentResponse = React11.forwardRef(
|
|
|
1325
1360
|
renderThinkingMarkdown,
|
|
1326
1361
|
timelineMaxHeight,
|
|
1327
1362
|
classNames,
|
|
1363
|
+
anchors,
|
|
1328
1364
|
className,
|
|
1329
1365
|
...props
|
|
1330
1366
|
}, ref) => {
|
|
@@ -1383,10 +1419,15 @@ var AgentResponse = React11.forwardRef(
|
|
|
1383
1419
|
statusUpdates: state.statusUpdates,
|
|
1384
1420
|
statusContent,
|
|
1385
1421
|
status: state.status,
|
|
1386
|
-
elapsedTime
|
|
1422
|
+
elapsedTime,
|
|
1423
|
+
thinkingToggleAnchor: anchors?.thinkingToggle,
|
|
1424
|
+
statusUpdateAnchor: anchors?.statusUpdate,
|
|
1425
|
+
toolCallsAnchor: anchors?.toolCalls,
|
|
1426
|
+
knowledgeAnchor: anchors?.knowledge,
|
|
1427
|
+
memoryAnchor: anchors?.memory
|
|
1387
1428
|
}
|
|
1388
1429
|
),
|
|
1389
|
-
hasTimelineEntries ? thinkingExpanded && /* @__PURE__ */ jsx("div", { className: "pb-3 border-t border-border", children: /* @__PURE__ */ jsx(
|
|
1430
|
+
hasTimelineEntries ? thinkingExpanded && /* @__PURE__ */ jsx("div", { className: "pb-3 border-t border-border", "data-tour": anchors?.thinkingSection, children: /* @__PURE__ */ jsx(
|
|
1390
1431
|
AgentTimeline,
|
|
1391
1432
|
{
|
|
1392
1433
|
entries: state.timelineEntries,
|
|
@@ -1397,6 +1438,7 @@ var AgentResponse = React11.forwardRef(
|
|
|
1397
1438
|
) }) : /* @__PURE__ */ jsx(
|
|
1398
1439
|
ThinkingSection,
|
|
1399
1440
|
{
|
|
1441
|
+
"data-tour": anchors?.thinkingSection,
|
|
1400
1442
|
content: state.thinkingSteps && state.thinkingSteps.length > 0 ? state.thinkingSteps : state.thinking,
|
|
1401
1443
|
isExpanded: thinkingExpanded,
|
|
1402
1444
|
renderMarkdown: renderThinkingMarkdown
|
|
@@ -1430,7 +1472,10 @@ var AgentResponse = React11.forwardRef(
|
|
|
1430
1472
|
totalTimeSeconds,
|
|
1431
1473
|
feedback,
|
|
1432
1474
|
onFeedbackChange,
|
|
1433
|
-
onResponseCopy
|
|
1475
|
+
onResponseCopy,
|
|
1476
|
+
copyAnchor: anchors?.copyAction,
|
|
1477
|
+
thumbsUpAnchor: anchors?.thumbsUp,
|
|
1478
|
+
thumbsDownAnchor: anchors?.thumbsDown
|
|
1434
1479
|
}
|
|
1435
1480
|
)
|
|
1436
1481
|
]
|
|
@@ -1560,6 +1605,7 @@ var UserPromptInput = React11.forwardRef(
|
|
|
1560
1605
|
enableTags = false,
|
|
1561
1606
|
onTagCreate,
|
|
1562
1607
|
onTagDelete,
|
|
1608
|
+
anchors,
|
|
1563
1609
|
className,
|
|
1564
1610
|
...props
|
|
1565
1611
|
}, ref) => {
|
|
@@ -1679,6 +1725,7 @@ var UserPromptInput = React11.forwardRef(
|
|
|
1679
1725
|
isSubmitting && onStop ? /* @__PURE__ */ jsx(Tooltip, { content: stopTooltip, disabled: !stopTooltip, children: /* @__PURE__ */ jsx(
|
|
1680
1726
|
IconButton,
|
|
1681
1727
|
{
|
|
1728
|
+
"data-tour": anchors?.stopButton,
|
|
1682
1729
|
icon: /* @__PURE__ */ jsx(Square, {}),
|
|
1683
1730
|
variant: "filled",
|
|
1684
1731
|
size: "sm",
|
|
@@ -1689,6 +1736,7 @@ var UserPromptInput = React11.forwardRef(
|
|
|
1689
1736
|
) }) : /* @__PURE__ */ jsx(
|
|
1690
1737
|
IconButton,
|
|
1691
1738
|
{
|
|
1739
|
+
"data-tour": anchors?.sendButton,
|
|
1692
1740
|
icon: isSubmitting ? /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) : /* @__PURE__ */ jsx(Send, {}),
|
|
1693
1741
|
variant: "filled",
|
|
1694
1742
|
size: "sm",
|
|
@@ -1814,6 +1862,6 @@ Available action types:
|
|
|
1814
1862
|
</inline_actions>
|
|
1815
1863
|
`;
|
|
1816
1864
|
|
|
1817
|
-
export { ActionBar, ActionMarkdownRenderer, ActivityIndicators, AgentResponse, AgentTimeline, HITLInteractionRecord, HITLQuestionPanel, HITLSection, INLINE_ACTION_PROMPT, MetadataRow, ThinkingSection, TruncatedMessage, UserPrompt, UserPromptInput, buildResponseString, buildTimelineEntries, createTimelineUIState, deduplicateEntries, formatTime, formatTotalTime, groupIntoAgentRuns, initialAgentResponseState, parseResponseSegments, useAgentResponseAccumulator, useThinkingTimer };
|
|
1865
|
+
export { ActionBar, ActionMarkdownRenderer, ActivityIndicators, AgentResponse, AgentTimeline, HITLInteractionRecord, HITLQuestionPanel, HITLSection, INLINE_ACTION_PROMPT, MetadataRow, ThinkingSection, TruncatedMessage, UserPrompt, UserPromptInput, buildResponseString, buildTimelineEntries, createTimelineUIState, deduplicateEntries, formatTime, formatTotalTime, groupIntoAgentRuns, initialAgentResponseState, parseResponseSegments, reduceAgentMessage, useAgentResponseAccumulator, useThinkingTimer };
|
|
1818
1866
|
//# sourceMappingURL=index.js.map
|
|
1819
1867
|
//# sourceMappingURL=index.js.map
|