@optilogic/chat 1.0.0-beta.11 → 1.0.0-beta.13
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 +47 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +47 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/agent-response/AgentResponse.tsx +9 -1
- package/src/components/agent-response/components/ThinkingSection.tsx +1 -1
- package/src/components/agent-response/hooks/useAgentResponseAccumulator.ts +23 -0
- package/src/components/agent-response/index.ts +1 -0
- package/src/components/agent-response/types.ts +19 -1
- package/src/components/agent-timeline/AgentTimeline.tsx +1 -1
- package/src/components/agent-timeline/utils.ts +22 -0
- package/src/index.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -255,7 +255,7 @@ var ThinkingSection = React11__namespace.forwardRef(
|
|
|
255
255
|
ref,
|
|
256
256
|
className: core.cn("px-3 pb-3 border-t border-border", className),
|
|
257
257
|
...props,
|
|
258
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 max-h-[200px] overflow-y-auto
|
|
258
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 max-h-[200px] overflow-y-auto", children: isStructured ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0", children: content.map((step) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
259
259
|
ThinkingStepItem,
|
|
260
260
|
{
|
|
261
261
|
step,
|
|
@@ -699,6 +699,8 @@ var initialAgentResponseState = {
|
|
|
699
699
|
knowledge: [],
|
|
700
700
|
memory: [],
|
|
701
701
|
statusUpdates: [],
|
|
702
|
+
potentialResponses: [],
|
|
703
|
+
customTimelineEntries: [],
|
|
702
704
|
response: "",
|
|
703
705
|
thinkingStartTime: null,
|
|
704
706
|
responseCompleteTime: null,
|
|
@@ -786,6 +788,24 @@ function buildTimelineEntries(state) {
|
|
|
786
788
|
timestamp: item.timestamp
|
|
787
789
|
});
|
|
788
790
|
}
|
|
791
|
+
if (state.potentialResponses) {
|
|
792
|
+
let respIdx = 0;
|
|
793
|
+
for (const resp of state.potentialResponses) {
|
|
794
|
+
entries.push({
|
|
795
|
+
id: `tl-resp-${respIdx++}`,
|
|
796
|
+
type: "ai_response",
|
|
797
|
+
agentName: resp.agentName ?? null,
|
|
798
|
+
parentAgent: resp.parentAgent ?? null,
|
|
799
|
+
depth: resp.depth ?? 0,
|
|
800
|
+
content: resp.content,
|
|
801
|
+
title: null,
|
|
802
|
+
timestamp: resp.timestamp
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
if (state.customTimelineEntries) {
|
|
807
|
+
entries.push(...state.customTimelineEntries);
|
|
808
|
+
}
|
|
789
809
|
entries.sort((a, b) => a.timestamp - b.timestamp);
|
|
790
810
|
return entries;
|
|
791
811
|
}
|
|
@@ -993,6 +1013,27 @@ function useAgentResponseAccumulator(options) {
|
|
|
993
1013
|
}
|
|
994
1014
|
return { ...prev, status: newStatus, firstMessageTime };
|
|
995
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
|
+
}
|
|
996
1037
|
default:
|
|
997
1038
|
return { ...prev, status: newStatus, firstMessageTime };
|
|
998
1039
|
}
|
|
@@ -1204,7 +1245,7 @@ function AgentTimeline({ entries, renderMarkdown, uiState, maxHeight = "300px" }
|
|
|
1204
1245
|
"div",
|
|
1205
1246
|
{
|
|
1206
1247
|
ref: containerRef,
|
|
1207
|
-
className:
|
|
1248
|
+
className: maxHeight !== "none" ? "overflow-y-auto" : "",
|
|
1208
1249
|
style: scrollStyle,
|
|
1209
1250
|
children: [
|
|
1210
1251
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sticky top-0 z-10 bg-background flex items-center gap-1 py-1.5 mb-1 border-b border-border/50 flex-wrap", children: [
|
|
@@ -1303,6 +1344,7 @@ var AgentResponse = React11__namespace.forwardRef(
|
|
|
1303
1344
|
statusContent,
|
|
1304
1345
|
renderMarkdown,
|
|
1305
1346
|
renderThinkingMarkdown,
|
|
1347
|
+
timelineMaxHeight,
|
|
1306
1348
|
className,
|
|
1307
1349
|
...props
|
|
1308
1350
|
}, ref) => {
|
|
@@ -1364,12 +1406,13 @@ var AgentResponse = React11__namespace.forwardRef(
|
|
|
1364
1406
|
elapsedTime
|
|
1365
1407
|
}
|
|
1366
1408
|
),
|
|
1367
|
-
hasTimelineEntries ? thinkingExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
1409
|
+
hasTimelineEntries ? thinkingExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pl-3 pb-3 border-t border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1368
1410
|
AgentTimeline,
|
|
1369
1411
|
{
|
|
1370
1412
|
entries: state.timelineEntries,
|
|
1371
1413
|
renderMarkdown: renderThinkingMarkdown,
|
|
1372
|
-
uiState: timelineUIStateRef.current
|
|
1414
|
+
uiState: timelineUIStateRef.current,
|
|
1415
|
+
maxHeight: timelineMaxHeight
|
|
1373
1416
|
}
|
|
1374
1417
|
) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1375
1418
|
ThinkingSection,
|