@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optilogic/chat",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.12",
|
|
4
4
|
"description": "Chat UI components for Optilogic - AgentResponse and related components for LLM interactions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@optilogic/core": "1.0.0-beta.
|
|
28
|
-
"@optilogic/editor": "1.0.0-beta.
|
|
27
|
+
"@optilogic/core": "1.0.0-beta.12",
|
|
28
|
+
"@optilogic/editor": "1.0.0-beta.12"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
type MemoryItem,
|
|
16
16
|
type StatusItem,
|
|
17
17
|
type ThinkingStep,
|
|
18
|
+
type PotentialResponse,
|
|
18
19
|
} from "../types";
|
|
19
20
|
import { buildTimelineEntries } from "../../agent-timeline/utils";
|
|
20
21
|
|
|
@@ -245,6 +246,28 @@ export function useAgentResponseAccumulator(
|
|
|
245
246
|
return { ...prev, status: newStatus, firstMessageTime };
|
|
246
247
|
}
|
|
247
248
|
|
|
249
|
+
case "potential_response": {
|
|
250
|
+
const respContent = payload.message || payload.content || "";
|
|
251
|
+
if (respContent) {
|
|
252
|
+
const newResp: PotentialResponse = {
|
|
253
|
+
id: `resp-${Date.now()}`,
|
|
254
|
+
content: respContent,
|
|
255
|
+
timestamp: Date.now(),
|
|
256
|
+
agentName: payload.agentName,
|
|
257
|
+
parentAgent: payload.parentAgent,
|
|
258
|
+
depth: payload.depth,
|
|
259
|
+
};
|
|
260
|
+
const next = {
|
|
261
|
+
...prev,
|
|
262
|
+
status: newStatus,
|
|
263
|
+
potentialResponses: [...(prev.potentialResponses || []), newResp],
|
|
264
|
+
firstMessageTime,
|
|
265
|
+
};
|
|
266
|
+
return { ...next, timelineEntries: buildTimelineEntries(next) };
|
|
267
|
+
}
|
|
268
|
+
return { ...prev, status: newStatus, firstMessageTime };
|
|
269
|
+
}
|
|
270
|
+
|
|
248
271
|
default:
|
|
249
272
|
return { ...prev, status: newStatus, firstMessageTime };
|
|
250
273
|
}
|
|
@@ -64,6 +64,18 @@ export interface MemoryItem {
|
|
|
64
64
|
depth?: number;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Potential response (sub-agent intermediate AI response)
|
|
69
|
+
*/
|
|
70
|
+
export interface PotentialResponse {
|
|
71
|
+
id: string;
|
|
72
|
+
content: string;
|
|
73
|
+
timestamp: number;
|
|
74
|
+
agentName?: string | null;
|
|
75
|
+
parentAgent?: string | null;
|
|
76
|
+
depth?: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
67
79
|
/**
|
|
68
80
|
* Status update information from the agent
|
|
69
81
|
*/
|
|
@@ -128,6 +140,10 @@ export interface AgentResponseState {
|
|
|
128
140
|
memory: MemoryItem[];
|
|
129
141
|
/** Status updates from the agent */
|
|
130
142
|
statusUpdates: StatusItem[];
|
|
143
|
+
/** Potential responses (sub-agent intermediate AI responses) */
|
|
144
|
+
potentialResponses?: PotentialResponse[];
|
|
145
|
+
/** Custom timeline entries (consumer-provided) */
|
|
146
|
+
customTimelineEntries?: TimelineEntry[];
|
|
131
147
|
/** Final response text */
|
|
132
148
|
response: string;
|
|
133
149
|
/** Timeline entries derived from all accumulator arrays (for AgentTimeline) */
|
|
@@ -144,7 +160,7 @@ export interface AgentResponseState {
|
|
|
144
160
|
* WebSocket message payload for agent responses
|
|
145
161
|
*/
|
|
146
162
|
export interface AgentMessage {
|
|
147
|
-
type: "status" | "thinking" | "tool_call" | "knowledge" | "memory" | "response" | "status_update";
|
|
163
|
+
type: "status" | "thinking" | "tool_call" | "knowledge" | "memory" | "response" | "status_update" | "potential_response";
|
|
148
164
|
/** Message content - for simple string payloads */
|
|
149
165
|
message?: string;
|
|
150
166
|
/** Alternative content field */
|
|
@@ -212,6 +228,8 @@ export const initialAgentResponseState: AgentResponseState = {
|
|
|
212
228
|
knowledge: [],
|
|
213
229
|
memory: [],
|
|
214
230
|
statusUpdates: [],
|
|
231
|
+
potentialResponses: [],
|
|
232
|
+
customTimelineEntries: [],
|
|
215
233
|
response: "",
|
|
216
234
|
thinkingStartTime: null,
|
|
217
235
|
responseCompleteTime: null,
|
|
@@ -98,6 +98,28 @@ export function buildTimelineEntries(state: AgentResponseState): TimelineEntry[]
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
// Potential responses → ai_response timeline entries
|
|
102
|
+
if (state.potentialResponses) {
|
|
103
|
+
let respIdx = 0;
|
|
104
|
+
for (const resp of state.potentialResponses) {
|
|
105
|
+
entries.push({
|
|
106
|
+
id: `tl-resp-${respIdx++}`,
|
|
107
|
+
type: "ai_response",
|
|
108
|
+
agentName: resp.agentName ?? null,
|
|
109
|
+
parentAgent: resp.parentAgent ?? null,
|
|
110
|
+
depth: resp.depth ?? 0,
|
|
111
|
+
content: resp.content,
|
|
112
|
+
title: null,
|
|
113
|
+
timestamp: resp.timestamp,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Merge any custom timeline entries (consumer-provided)
|
|
119
|
+
if (state.customTimelineEntries) {
|
|
120
|
+
entries.push(...state.customTimelineEntries);
|
|
121
|
+
}
|
|
122
|
+
|
|
101
123
|
// Sort chronologically
|
|
102
124
|
entries.sort((a, b) => a.timestamp - b.timestamp);
|
|
103
125
|
|