@parhelia/core 0.1.12515 → 0.1.12517
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/editor/ai/AgentTerminal.js +37 -1
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/client/operations.js +5 -3
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/content-tree/index.d.ts +3 -0
- package/dist/editor/content-tree/index.js +4 -0
- package/dist/editor/content-tree/index.js.map +1 -0
- package/dist/editor/reviews/SuggestedEdit.js +31 -3
- package/dist/editor/reviews/SuggestedEdit.js.map +1 -1
- package/dist/editor/reviews/SuggestionDisplayPopover.js +31 -5
- package/dist/editor/reviews/SuggestionDisplayPopover.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/package.json +1 -1
|
@@ -2007,6 +2007,12 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
2007
2007
|
// If no messageId is provided, we'll use the last assistant message or create a new one
|
|
2008
2008
|
let messageId = message.data?.messageId;
|
|
2009
2009
|
if (!messageId && agentData?.id) {
|
|
2010
|
+
console.warn("[AgentTerminal] Content chunk missing messageId; falling back to local resolution", {
|
|
2011
|
+
agentId: agentData.id,
|
|
2012
|
+
isIncremental: message.data?.isIncremental,
|
|
2013
|
+
previousContentLength: message.data?.previousContentLength,
|
|
2014
|
+
totalContentLength: message.data?.totalContentLength,
|
|
2015
|
+
});
|
|
2010
2016
|
// For backward compatibility: if no messageId, find or create the current streaming message
|
|
2011
2017
|
// This handles cases where the backend doesn't send messageId
|
|
2012
2018
|
const currentMessages = messagesRef.current;
|
|
@@ -2107,6 +2113,15 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
2107
2113
|
const existingMessageIndex = prev.findIndex((msg) => msg.id === messageId);
|
|
2108
2114
|
if (existingMessageIndex === -1) {
|
|
2109
2115
|
// Message doesn't exist - create new streaming message
|
|
2116
|
+
const previousContentLength = message.data?.previousContentLength || 0;
|
|
2117
|
+
if (message.data?.isIncremental && previousContentLength > 0) {
|
|
2118
|
+
console.warn("[AgentTerminal] Incremental chunk arrived before its base message existed", {
|
|
2119
|
+
messageId,
|
|
2120
|
+
previousContentLength,
|
|
2121
|
+
totalContentLength: message.data?.totalContentLength,
|
|
2122
|
+
deltaLength: (message.data?.deltaContent || "").length,
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2110
2125
|
const newStreamMessage = createNewStreamMessage(messageId, agentData);
|
|
2111
2126
|
// Set the content for the new message
|
|
2112
2127
|
const updatedNewMessage = { ...newStreamMessage };
|
|
@@ -2129,8 +2144,21 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
2129
2144
|
return prev;
|
|
2130
2145
|
// Check if existing content is already longer than what we're trying to stream
|
|
2131
2146
|
const currentContentLength = existingMessage.content?.length || 0;
|
|
2147
|
+
const previousContentLength = message.data?.previousContentLength || 0;
|
|
2132
2148
|
const totalContentLength = message.data?.totalContentLength || 0;
|
|
2133
|
-
if (
|
|
2149
|
+
if (message.data?.isIncremental &&
|
|
2150
|
+
previousContentLength !== currentContentLength &&
|
|
2151
|
+
(previousContentLength > 0 || currentContentLength > 0)) {
|
|
2152
|
+
console.warn("[AgentTerminal] Content chunk length mismatch", {
|
|
2153
|
+
messageId,
|
|
2154
|
+
previousContentLength,
|
|
2155
|
+
currentContentLength,
|
|
2156
|
+
totalContentLength,
|
|
2157
|
+
deltaLength: (message.data?.deltaContent || "").length,
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
if (message.data?.isIncremental &&
|
|
2161
|
+
currentContentLength >= totalContentLength &&
|
|
2134
2162
|
totalContentLength > 0) {
|
|
2135
2163
|
return prev;
|
|
2136
2164
|
}
|
|
@@ -2159,6 +2187,10 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
2159
2187
|
// Prefer provided messageId, otherwise fall back to the last streaming assistant message
|
|
2160
2188
|
let toolCallMessageId = message.data?.messageId;
|
|
2161
2189
|
if (!toolCallMessageId) {
|
|
2190
|
+
console.warn("[AgentTerminal] Tool call missing messageId; falling back", {
|
|
2191
|
+
toolCallId,
|
|
2192
|
+
toolName: message.data?.name || message.data?.displayName,
|
|
2193
|
+
});
|
|
2162
2194
|
const current = messagesRef.current;
|
|
2163
2195
|
const lastStreaming = [...current]
|
|
2164
2196
|
.reverse()
|
|
@@ -2322,6 +2354,10 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
2322
2354
|
// Prefer provided messageId, otherwise fall back to the last streaming assistant message
|
|
2323
2355
|
let resultMessageId = message.data?.messageId;
|
|
2324
2356
|
if (!resultMessageId) {
|
|
2357
|
+
console.warn("[AgentTerminal] Tool result missing messageId; falling back", {
|
|
2358
|
+
toolCallId: resultToolCallId,
|
|
2359
|
+
toolName: message.data?.functionName || message.data?.displayName,
|
|
2360
|
+
});
|
|
2325
2361
|
const current = messagesRef.current;
|
|
2326
2362
|
const lastStreaming = [...current]
|
|
2327
2363
|
.reverse()
|