@optilogic/chat 1.0.0-beta.11 → 1.0.0-beta.12
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 +41 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- 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/utils.ts +22 -0
- package/src/index.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -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
|
}
|