@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.cjs
CHANGED
|
@@ -28,7 +28,18 @@ var React11__namespace = /*#__PURE__*/_interopNamespace(React11);
|
|
|
28
28
|
|
|
29
29
|
// src/components/agent-response/AgentResponse.tsx
|
|
30
30
|
var ActivityIndicators = React11__namespace.forwardRef(
|
|
31
|
-
({
|
|
31
|
+
({
|
|
32
|
+
toolCalls,
|
|
33
|
+
knowledge,
|
|
34
|
+
memory,
|
|
35
|
+
statusUpdates = [],
|
|
36
|
+
statusUpdateAnchor,
|
|
37
|
+
toolCallsAnchor,
|
|
38
|
+
knowledgeAnchor,
|
|
39
|
+
memoryAnchor,
|
|
40
|
+
className,
|
|
41
|
+
...props
|
|
42
|
+
}, ref) => {
|
|
32
43
|
const hasAnyActivity = toolCalls.length > 0 || knowledge.length > 0 || memory.length > 0 || statusUpdates.length > 0;
|
|
33
44
|
if (!hasAnyActivity) return null;
|
|
34
45
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: core.cn("flex items-center gap-2", className), ...props, children: [
|
|
@@ -36,6 +47,7 @@ var ActivityIndicators = React11__namespace.forwardRef(
|
|
|
36
47
|
/* @__PURE__ */ jsxRuntime.jsx(core.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37
48
|
"button",
|
|
38
49
|
{
|
|
50
|
+
"data-tour": statusUpdateAnchor,
|
|
39
51
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
40
52
|
onClick: (e) => e.stopPropagation(),
|
|
41
53
|
children: [
|
|
@@ -56,6 +68,7 @@ var ActivityIndicators = React11__namespace.forwardRef(
|
|
|
56
68
|
/* @__PURE__ */ jsxRuntime.jsx(core.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
57
69
|
"button",
|
|
58
70
|
{
|
|
71
|
+
"data-tour": toolCallsAnchor,
|
|
59
72
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
60
73
|
onClick: (e) => e.stopPropagation(),
|
|
61
74
|
children: [
|
|
@@ -76,6 +89,7 @@ var ActivityIndicators = React11__namespace.forwardRef(
|
|
|
76
89
|
/* @__PURE__ */ jsxRuntime.jsx(core.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
77
90
|
"button",
|
|
78
91
|
{
|
|
92
|
+
"data-tour": knowledgeAnchor,
|
|
79
93
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
80
94
|
onClick: (e) => e.stopPropagation(),
|
|
81
95
|
children: [
|
|
@@ -96,6 +110,7 @@ var ActivityIndicators = React11__namespace.forwardRef(
|
|
|
96
110
|
/* @__PURE__ */ jsxRuntime.jsx(core.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
97
111
|
"button",
|
|
98
112
|
{
|
|
113
|
+
"data-tour": memoryAnchor,
|
|
99
114
|
className: "flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",
|
|
100
115
|
onClick: (e) => e.stopPropagation(),
|
|
101
116
|
children: [
|
|
@@ -158,6 +173,11 @@ var MetadataRow = React11__namespace.forwardRef(
|
|
|
158
173
|
statusContent,
|
|
159
174
|
status,
|
|
160
175
|
elapsedTime,
|
|
176
|
+
thinkingToggleAnchor,
|
|
177
|
+
statusUpdateAnchor,
|
|
178
|
+
toolCallsAnchor,
|
|
179
|
+
knowledgeAnchor,
|
|
180
|
+
memoryAnchor,
|
|
161
181
|
className,
|
|
162
182
|
...props
|
|
163
183
|
}, ref) => {
|
|
@@ -193,6 +213,7 @@ var MetadataRow = React11__namespace.forwardRef(
|
|
|
193
213
|
hasThinking ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
214
|
"button",
|
|
195
215
|
{
|
|
216
|
+
"data-tour": thinkingToggleAnchor,
|
|
196
217
|
onClick: onToggle,
|
|
197
218
|
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",
|
|
198
219
|
children: leftContent
|
|
@@ -205,7 +226,11 @@ var MetadataRow = React11__namespace.forwardRef(
|
|
|
205
226
|
toolCalls,
|
|
206
227
|
knowledge,
|
|
207
228
|
memory,
|
|
208
|
-
statusUpdates
|
|
229
|
+
statusUpdates,
|
|
230
|
+
statusUpdateAnchor,
|
|
231
|
+
toolCallsAnchor,
|
|
232
|
+
knowledgeAnchor,
|
|
233
|
+
memoryAnchor
|
|
209
234
|
}
|
|
210
235
|
)
|
|
211
236
|
]
|
|
@@ -276,6 +301,9 @@ var ActionBar = React11__namespace.forwardRef(
|
|
|
276
301
|
feedback,
|
|
277
302
|
onFeedbackChange,
|
|
278
303
|
onResponseCopy,
|
|
304
|
+
copyAnchor,
|
|
305
|
+
thumbsUpAnchor,
|
|
306
|
+
thumbsDownAnchor,
|
|
279
307
|
className,
|
|
280
308
|
...props
|
|
281
309
|
}, ref) => {
|
|
@@ -316,6 +344,7 @@ var ActionBar = React11__namespace.forwardRef(
|
|
|
316
344
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
317
345
|
"button",
|
|
318
346
|
{
|
|
347
|
+
"data-tour": copyAnchor,
|
|
319
348
|
onClick: handleCopy,
|
|
320
349
|
className: "p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",
|
|
321
350
|
title: copied ? "Copied!" : "Copy response",
|
|
@@ -325,6 +354,7 @@ var ActionBar = React11__namespace.forwardRef(
|
|
|
325
354
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
326
355
|
"button",
|
|
327
356
|
{
|
|
357
|
+
"data-tour": thumbsUpAnchor,
|
|
328
358
|
onClick: handleThumbsUp,
|
|
329
359
|
className: core.cn(
|
|
330
360
|
"p-1.5 rounded hover:bg-muted transition-colors",
|
|
@@ -337,6 +367,7 @@ var ActionBar = React11__namespace.forwardRef(
|
|
|
337
367
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
338
368
|
"button",
|
|
339
369
|
{
|
|
370
|
+
"data-tour": thumbsDownAnchor,
|
|
340
371
|
onClick: handleThumbsDown,
|
|
341
372
|
className: core.cn(
|
|
342
373
|
"p-1.5 rounded hover:bg-muted transition-colors",
|
|
@@ -845,6 +876,188 @@ function deduplicateEntries(entries) {
|
|
|
845
876
|
return result;
|
|
846
877
|
}
|
|
847
878
|
|
|
879
|
+
// src/components/agent-response/reducer.ts
|
|
880
|
+
function reduceAgentMessage(prev, payload) {
|
|
881
|
+
const now = payload.timestamp ?? Date.now();
|
|
882
|
+
let newStatus = prev.status;
|
|
883
|
+
const isFirstMessage = prev.status === "idle" && payload.type !== "status";
|
|
884
|
+
if (isFirstMessage) {
|
|
885
|
+
newStatus = "processing";
|
|
886
|
+
}
|
|
887
|
+
const firstMessageTime = prev.firstMessageTime ?? (isFirstMessage ? now : null);
|
|
888
|
+
switch (payload.type) {
|
|
889
|
+
case "status":
|
|
890
|
+
if (payload.message === "Harness connected" || payload.status === "Harness connected") {
|
|
891
|
+
return { ...initialAgentResponseState };
|
|
892
|
+
}
|
|
893
|
+
return { ...prev, status: newStatus };
|
|
894
|
+
case "thinking": {
|
|
895
|
+
if (payload.thinkingStep) {
|
|
896
|
+
const newStep = {
|
|
897
|
+
id: payload.thinkingStep.id || `step-${now}`,
|
|
898
|
+
label: payload.thinkingStep.label,
|
|
899
|
+
content: payload.thinkingStep.content,
|
|
900
|
+
depth: payload.thinkingStep.depth ?? payload.depth ?? 0,
|
|
901
|
+
isCollapsed: payload.thinkingStep.isCollapsed,
|
|
902
|
+
timestamp: now,
|
|
903
|
+
agentName: payload.agentName,
|
|
904
|
+
parentAgent: payload.parentAgent
|
|
905
|
+
};
|
|
906
|
+
const thinkingStartTime2 = prev.thinkingStartTime ?? now;
|
|
907
|
+
const next2 = {
|
|
908
|
+
...prev,
|
|
909
|
+
status: newStatus,
|
|
910
|
+
thinkingSteps: [...prev.thinkingSteps || [], newStep],
|
|
911
|
+
thinkingStartTime: thinkingStartTime2,
|
|
912
|
+
firstMessageTime
|
|
913
|
+
};
|
|
914
|
+
return { ...next2, timelineEntries: buildTimelineEntries(next2) };
|
|
915
|
+
}
|
|
916
|
+
const newThinking = payload.message || payload.content || "";
|
|
917
|
+
const separator = prev.thinking && newThinking ? "\n\n" : "";
|
|
918
|
+
const thinkingStartTime = prev.thinkingStartTime ?? (newThinking ? now : null);
|
|
919
|
+
const prevSteps = prev.thinkingSteps || [];
|
|
920
|
+
const plainStep = {
|
|
921
|
+
id: `step-${prevSteps.length}`,
|
|
922
|
+
label: newThinking,
|
|
923
|
+
content: newThinking,
|
|
924
|
+
depth: payload.depth ?? 0,
|
|
925
|
+
timestamp: now,
|
|
926
|
+
agentName: payload.agentName,
|
|
927
|
+
parentAgent: payload.parentAgent
|
|
928
|
+
};
|
|
929
|
+
const next = {
|
|
930
|
+
...prev,
|
|
931
|
+
status: newStatus,
|
|
932
|
+
thinking: prev.thinking + separator + newThinking,
|
|
933
|
+
thinkingSteps: [...prevSteps, plainStep],
|
|
934
|
+
thinkingStartTime,
|
|
935
|
+
firstMessageTime
|
|
936
|
+
};
|
|
937
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
938
|
+
}
|
|
939
|
+
case "tool_call": {
|
|
940
|
+
const toolName = payload.message || payload.tool?.name;
|
|
941
|
+
if (toolName) {
|
|
942
|
+
const newToolCall = {
|
|
943
|
+
id: payload.tool?.id || `tool-${now}`,
|
|
944
|
+
name: toolName,
|
|
945
|
+
arguments: payload.tool?.arguments,
|
|
946
|
+
timestamp: now,
|
|
947
|
+
agentName: payload.agentName,
|
|
948
|
+
parentAgent: payload.parentAgent,
|
|
949
|
+
depth: payload.depth
|
|
950
|
+
};
|
|
951
|
+
const next = {
|
|
952
|
+
...prev,
|
|
953
|
+
status: newStatus,
|
|
954
|
+
toolCalls: [...prev.toolCalls, newToolCall],
|
|
955
|
+
firstMessageTime
|
|
956
|
+
};
|
|
957
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
958
|
+
}
|
|
959
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
960
|
+
}
|
|
961
|
+
case "knowledge": {
|
|
962
|
+
const knowledgeContent = payload.message || payload.knowledge?.content;
|
|
963
|
+
if (knowledgeContent) {
|
|
964
|
+
const newKnowledge = {
|
|
965
|
+
id: payload.knowledge?.id || `knowledge-${now}`,
|
|
966
|
+
source: payload.knowledge?.source || "unknown",
|
|
967
|
+
content: knowledgeContent,
|
|
968
|
+
timestamp: now,
|
|
969
|
+
agentName: payload.agentName,
|
|
970
|
+
parentAgent: payload.parentAgent,
|
|
971
|
+
depth: payload.depth
|
|
972
|
+
};
|
|
973
|
+
const next = {
|
|
974
|
+
...prev,
|
|
975
|
+
status: newStatus,
|
|
976
|
+
knowledge: [...prev.knowledge, newKnowledge],
|
|
977
|
+
firstMessageTime
|
|
978
|
+
};
|
|
979
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
980
|
+
}
|
|
981
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
982
|
+
}
|
|
983
|
+
case "memory": {
|
|
984
|
+
const memoryContent = payload.message || payload.memory?.content;
|
|
985
|
+
if (memoryContent) {
|
|
986
|
+
const newMemory = {
|
|
987
|
+
id: payload.memory?.id || `memory-${now}`,
|
|
988
|
+
type: payload.memory?.type || "unknown",
|
|
989
|
+
content: memoryContent,
|
|
990
|
+
timestamp: now,
|
|
991
|
+
agentName: payload.agentName,
|
|
992
|
+
parentAgent: payload.parentAgent,
|
|
993
|
+
depth: payload.depth
|
|
994
|
+
};
|
|
995
|
+
const next = {
|
|
996
|
+
...prev,
|
|
997
|
+
status: newStatus,
|
|
998
|
+
memory: [...prev.memory, newMemory],
|
|
999
|
+
firstMessageTime
|
|
1000
|
+
};
|
|
1001
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
1002
|
+
}
|
|
1003
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
1004
|
+
}
|
|
1005
|
+
case "response":
|
|
1006
|
+
return {
|
|
1007
|
+
...prev,
|
|
1008
|
+
status: "complete",
|
|
1009
|
+
response: payload.message || payload.content || "",
|
|
1010
|
+
responseCompleteTime: now,
|
|
1011
|
+
firstMessageTime: prev.firstMessageTime ?? now
|
|
1012
|
+
};
|
|
1013
|
+
case "status_update": {
|
|
1014
|
+
const statusMessage = payload.message || payload.statusUpdate?.message;
|
|
1015
|
+
if (statusMessage) {
|
|
1016
|
+
const newStatusItem = {
|
|
1017
|
+
id: payload.statusUpdate?.id || `status-${now}`,
|
|
1018
|
+
message: statusMessage,
|
|
1019
|
+
agent: payload.statusUpdate?.agent,
|
|
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
|
+
statusUpdates: [...prev.statusUpdates, newStatusItem],
|
|
1029
|
+
firstMessageTime
|
|
1030
|
+
};
|
|
1031
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
1032
|
+
}
|
|
1033
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
1034
|
+
}
|
|
1035
|
+
case "potential_response": {
|
|
1036
|
+
const respContent = payload.message || payload.content || "";
|
|
1037
|
+
if (respContent) {
|
|
1038
|
+
const newResp = {
|
|
1039
|
+
id: `resp-${now}`,
|
|
1040
|
+
content: respContent,
|
|
1041
|
+
timestamp: now,
|
|
1042
|
+
agentName: payload.agentName,
|
|
1043
|
+
parentAgent: payload.parentAgent,
|
|
1044
|
+
depth: payload.depth
|
|
1045
|
+
};
|
|
1046
|
+
const next = {
|
|
1047
|
+
...prev,
|
|
1048
|
+
status: newStatus,
|
|
1049
|
+
potentialResponses: [...prev.potentialResponses || [], newResp],
|
|
1050
|
+
firstMessageTime
|
|
1051
|
+
};
|
|
1052
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
1053
|
+
}
|
|
1054
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
1055
|
+
}
|
|
1056
|
+
default:
|
|
1057
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
|
|
848
1061
|
// src/components/agent-response/hooks/useAgentResponseAccumulator.ts
|
|
849
1062
|
function useAgentResponseAccumulator(options) {
|
|
850
1063
|
const [state, setState] = React11.useState(initialAgentResponseState);
|
|
@@ -859,185 +1072,7 @@ function useAgentResponseAccumulator(options) {
|
|
|
859
1072
|
} else {
|
|
860
1073
|
payload = message;
|
|
861
1074
|
}
|
|
862
|
-
setState((prev) =>
|
|
863
|
-
let newStatus = prev.status;
|
|
864
|
-
const isFirstMessage = prev.status === "idle" && payload.type !== "status";
|
|
865
|
-
if (isFirstMessage) {
|
|
866
|
-
newStatus = "processing";
|
|
867
|
-
}
|
|
868
|
-
const firstMessageTime = prev.firstMessageTime ?? (isFirstMessage ? Date.now() : null);
|
|
869
|
-
switch (payload.type) {
|
|
870
|
-
case "status":
|
|
871
|
-
if (payload.message === "Harness connected" || payload.status === "Harness connected") {
|
|
872
|
-
return { ...initialAgentResponseState };
|
|
873
|
-
}
|
|
874
|
-
return { ...prev, status: newStatus };
|
|
875
|
-
case "thinking": {
|
|
876
|
-
if (payload.thinkingStep) {
|
|
877
|
-
const newStep = {
|
|
878
|
-
id: payload.thinkingStep.id || `step-${Date.now()}`,
|
|
879
|
-
label: payload.thinkingStep.label,
|
|
880
|
-
content: payload.thinkingStep.content,
|
|
881
|
-
depth: payload.thinkingStep.depth ?? payload.depth ?? 0,
|
|
882
|
-
isCollapsed: payload.thinkingStep.isCollapsed,
|
|
883
|
-
timestamp: Date.now(),
|
|
884
|
-
agentName: payload.agentName,
|
|
885
|
-
parentAgent: payload.parentAgent
|
|
886
|
-
};
|
|
887
|
-
const thinkingStartTime2 = prev.thinkingStartTime ?? Date.now();
|
|
888
|
-
const next2 = {
|
|
889
|
-
...prev,
|
|
890
|
-
status: newStatus,
|
|
891
|
-
thinkingSteps: [...prev.thinkingSteps || [], newStep],
|
|
892
|
-
thinkingStartTime: thinkingStartTime2,
|
|
893
|
-
firstMessageTime
|
|
894
|
-
};
|
|
895
|
-
return { ...next2, timelineEntries: buildTimelineEntries(next2) };
|
|
896
|
-
}
|
|
897
|
-
const newThinking = payload.message || payload.content || "";
|
|
898
|
-
const separator = prev.thinking && newThinking ? "\n\n" : "";
|
|
899
|
-
const thinkingStartTime = prev.thinkingStartTime ?? (newThinking ? Date.now() : null);
|
|
900
|
-
const prevSteps = prev.thinkingSteps || [];
|
|
901
|
-
const plainStep = {
|
|
902
|
-
id: `step-${prevSteps.length}`,
|
|
903
|
-
label: newThinking,
|
|
904
|
-
content: newThinking,
|
|
905
|
-
depth: payload.depth ?? 0,
|
|
906
|
-
timestamp: Date.now(),
|
|
907
|
-
agentName: payload.agentName,
|
|
908
|
-
parentAgent: payload.parentAgent
|
|
909
|
-
};
|
|
910
|
-
const next = {
|
|
911
|
-
...prev,
|
|
912
|
-
status: newStatus,
|
|
913
|
-
thinking: prev.thinking + separator + newThinking,
|
|
914
|
-
thinkingSteps: [...prevSteps, plainStep],
|
|
915
|
-
thinkingStartTime,
|
|
916
|
-
firstMessageTime
|
|
917
|
-
};
|
|
918
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
919
|
-
}
|
|
920
|
-
case "tool_call": {
|
|
921
|
-
const toolName = payload.message || payload.tool?.name;
|
|
922
|
-
if (toolName) {
|
|
923
|
-
const newToolCall = {
|
|
924
|
-
id: payload.tool?.id || `tool-${Date.now()}`,
|
|
925
|
-
name: toolName,
|
|
926
|
-
arguments: payload.tool?.arguments,
|
|
927
|
-
timestamp: Date.now(),
|
|
928
|
-
agentName: payload.agentName,
|
|
929
|
-
parentAgent: payload.parentAgent,
|
|
930
|
-
depth: payload.depth
|
|
931
|
-
};
|
|
932
|
-
const next = {
|
|
933
|
-
...prev,
|
|
934
|
-
status: newStatus,
|
|
935
|
-
toolCalls: [...prev.toolCalls, newToolCall],
|
|
936
|
-
firstMessageTime
|
|
937
|
-
};
|
|
938
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
939
|
-
}
|
|
940
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
941
|
-
}
|
|
942
|
-
case "knowledge": {
|
|
943
|
-
const knowledgeContent = payload.message || payload.knowledge?.content;
|
|
944
|
-
if (knowledgeContent) {
|
|
945
|
-
const newKnowledge = {
|
|
946
|
-
id: payload.knowledge?.id || `knowledge-${Date.now()}`,
|
|
947
|
-
source: payload.knowledge?.source || "unknown",
|
|
948
|
-
content: knowledgeContent,
|
|
949
|
-
timestamp: Date.now(),
|
|
950
|
-
agentName: payload.agentName,
|
|
951
|
-
parentAgent: payload.parentAgent,
|
|
952
|
-
depth: payload.depth
|
|
953
|
-
};
|
|
954
|
-
const next = {
|
|
955
|
-
...prev,
|
|
956
|
-
status: newStatus,
|
|
957
|
-
knowledge: [...prev.knowledge, newKnowledge],
|
|
958
|
-
firstMessageTime
|
|
959
|
-
};
|
|
960
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
961
|
-
}
|
|
962
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
963
|
-
}
|
|
964
|
-
case "memory": {
|
|
965
|
-
const memoryContent = payload.message || payload.memory?.content;
|
|
966
|
-
if (memoryContent) {
|
|
967
|
-
const newMemory = {
|
|
968
|
-
id: payload.memory?.id || `memory-${Date.now()}`,
|
|
969
|
-
type: payload.memory?.type || "unknown",
|
|
970
|
-
content: memoryContent,
|
|
971
|
-
timestamp: Date.now(),
|
|
972
|
-
agentName: payload.agentName,
|
|
973
|
-
parentAgent: payload.parentAgent,
|
|
974
|
-
depth: payload.depth
|
|
975
|
-
};
|
|
976
|
-
const next = {
|
|
977
|
-
...prev,
|
|
978
|
-
status: newStatus,
|
|
979
|
-
memory: [...prev.memory, newMemory],
|
|
980
|
-
firstMessageTime
|
|
981
|
-
};
|
|
982
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
983
|
-
}
|
|
984
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
985
|
-
}
|
|
986
|
-
case "response":
|
|
987
|
-
return {
|
|
988
|
-
...prev,
|
|
989
|
-
status: "complete",
|
|
990
|
-
response: payload.message || payload.content || "",
|
|
991
|
-
responseCompleteTime: Date.now(),
|
|
992
|
-
firstMessageTime: prev.firstMessageTime ?? Date.now()
|
|
993
|
-
};
|
|
994
|
-
case "status_update": {
|
|
995
|
-
const statusMessage = payload.message || payload.statusUpdate?.message;
|
|
996
|
-
if (statusMessage) {
|
|
997
|
-
const newStatusItem = {
|
|
998
|
-
id: payload.statusUpdate?.id || `status-${Date.now()}`,
|
|
999
|
-
message: statusMessage,
|
|
1000
|
-
agent: payload.statusUpdate?.agent,
|
|
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
|
-
statusUpdates: [...prev.statusUpdates, newStatusItem],
|
|
1010
|
-
firstMessageTime
|
|
1011
|
-
};
|
|
1012
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
1013
|
-
}
|
|
1014
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
1015
|
-
}
|
|
1016
|
-
case "potential_response": {
|
|
1017
|
-
const respContent = payload.message || payload.content || "";
|
|
1018
|
-
if (respContent) {
|
|
1019
|
-
const newResp = {
|
|
1020
|
-
id: `resp-${Date.now()}`,
|
|
1021
|
-
content: respContent,
|
|
1022
|
-
timestamp: Date.now(),
|
|
1023
|
-
agentName: payload.agentName,
|
|
1024
|
-
parentAgent: payload.parentAgent,
|
|
1025
|
-
depth: payload.depth
|
|
1026
|
-
};
|
|
1027
|
-
const next = {
|
|
1028
|
-
...prev,
|
|
1029
|
-
status: newStatus,
|
|
1030
|
-
potentialResponses: [...prev.potentialResponses || [], newResp],
|
|
1031
|
-
firstMessageTime
|
|
1032
|
-
};
|
|
1033
|
-
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
1034
|
-
}
|
|
1035
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
1036
|
-
}
|
|
1037
|
-
default:
|
|
1038
|
-
return { ...prev, status: newStatus, firstMessageTime };
|
|
1039
|
-
}
|
|
1040
|
-
});
|
|
1075
|
+
setState((prev) => reduceAgentMessage(prev, payload));
|
|
1041
1076
|
},
|
|
1042
1077
|
[topic]
|
|
1043
1078
|
);
|
|
@@ -1346,6 +1381,7 @@ var AgentResponse = React11__namespace.forwardRef(
|
|
|
1346
1381
|
renderThinkingMarkdown,
|
|
1347
1382
|
timelineMaxHeight,
|
|
1348
1383
|
classNames,
|
|
1384
|
+
anchors,
|
|
1349
1385
|
className,
|
|
1350
1386
|
...props
|
|
1351
1387
|
}, ref) => {
|
|
@@ -1404,10 +1440,15 @@ var AgentResponse = React11__namespace.forwardRef(
|
|
|
1404
1440
|
statusUpdates: state.statusUpdates,
|
|
1405
1441
|
statusContent,
|
|
1406
1442
|
status: state.status,
|
|
1407
|
-
elapsedTime
|
|
1443
|
+
elapsedTime,
|
|
1444
|
+
thinkingToggleAnchor: anchors?.thinkingToggle,
|
|
1445
|
+
statusUpdateAnchor: anchors?.statusUpdate,
|
|
1446
|
+
toolCallsAnchor: anchors?.toolCalls,
|
|
1447
|
+
knowledgeAnchor: anchors?.knowledge,
|
|
1448
|
+
memoryAnchor: anchors?.memory
|
|
1408
1449
|
}
|
|
1409
1450
|
),
|
|
1410
|
-
hasTimelineEntries ? thinkingExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-3 border-t border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1451
|
+
hasTimelineEntries ? thinkingExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-3 border-t border-border", "data-tour": anchors?.thinkingSection, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1411
1452
|
AgentTimeline,
|
|
1412
1453
|
{
|
|
1413
1454
|
entries: state.timelineEntries,
|
|
@@ -1418,6 +1459,7 @@ var AgentResponse = React11__namespace.forwardRef(
|
|
|
1418
1459
|
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1419
1460
|
ThinkingSection,
|
|
1420
1461
|
{
|
|
1462
|
+
"data-tour": anchors?.thinkingSection,
|
|
1421
1463
|
content: state.thinkingSteps && state.thinkingSteps.length > 0 ? state.thinkingSteps : state.thinking,
|
|
1422
1464
|
isExpanded: thinkingExpanded,
|
|
1423
1465
|
renderMarkdown: renderThinkingMarkdown
|
|
@@ -1451,7 +1493,10 @@ var AgentResponse = React11__namespace.forwardRef(
|
|
|
1451
1493
|
totalTimeSeconds,
|
|
1452
1494
|
feedback,
|
|
1453
1495
|
onFeedbackChange,
|
|
1454
|
-
onResponseCopy
|
|
1496
|
+
onResponseCopy,
|
|
1497
|
+
copyAnchor: anchors?.copyAction,
|
|
1498
|
+
thumbsUpAnchor: anchors?.thumbsUp,
|
|
1499
|
+
thumbsDownAnchor: anchors?.thumbsDown
|
|
1455
1500
|
}
|
|
1456
1501
|
)
|
|
1457
1502
|
]
|
|
@@ -1581,6 +1626,7 @@ var UserPromptInput = React11__namespace.forwardRef(
|
|
|
1581
1626
|
enableTags = false,
|
|
1582
1627
|
onTagCreate,
|
|
1583
1628
|
onTagDelete,
|
|
1629
|
+
anchors,
|
|
1584
1630
|
className,
|
|
1585
1631
|
...props
|
|
1586
1632
|
}, ref) => {
|
|
@@ -1700,6 +1746,7 @@ var UserPromptInput = React11__namespace.forwardRef(
|
|
|
1700
1746
|
isSubmitting && onStop ? /* @__PURE__ */ jsxRuntime.jsx(core.Tooltip, { content: stopTooltip, disabled: !stopTooltip, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1701
1747
|
core.IconButton,
|
|
1702
1748
|
{
|
|
1749
|
+
"data-tour": anchors?.stopButton,
|
|
1703
1750
|
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Square, {}),
|
|
1704
1751
|
variant: "filled",
|
|
1705
1752
|
size: "sm",
|
|
@@ -1710,6 +1757,7 @@ var UserPromptInput = React11__namespace.forwardRef(
|
|
|
1710
1757
|
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1711
1758
|
core.IconButton,
|
|
1712
1759
|
{
|
|
1760
|
+
"data-tour": anchors?.sendButton,
|
|
1713
1761
|
icon: isSubmitting ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, {}),
|
|
1714
1762
|
variant: "filled",
|
|
1715
1763
|
size: "sm",
|
|
@@ -1858,6 +1906,7 @@ exports.formatTotalTime = formatTotalTime;
|
|
|
1858
1906
|
exports.groupIntoAgentRuns = groupIntoAgentRuns;
|
|
1859
1907
|
exports.initialAgentResponseState = initialAgentResponseState;
|
|
1860
1908
|
exports.parseResponseSegments = parseResponseSegments;
|
|
1909
|
+
exports.reduceAgentMessage = reduceAgentMessage;
|
|
1861
1910
|
exports.useAgentResponseAccumulator = useAgentResponseAccumulator;
|
|
1862
1911
|
exports.useThinkingTimer = useThinkingTimer;
|
|
1863
1912
|
//# sourceMappingURL=index.cjs.map
|