agentgui 1.0.687 → 1.0.689
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/package.json +1 -1
- package/server.js +0 -5
- package/static/js/streaming-renderer.js +25 -2
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -3429,11 +3429,6 @@ async function processMessageWithStreaming(conversationId, messageId, sessionId,
|
|
|
3429
3429
|
if (parsed.type === 'system') {
|
|
3430
3430
|
if (parsed.subtype === 'task_notification') return;
|
|
3431
3431
|
|
|
3432
|
-
if (parsed.session_id && parsed.session_id !== resumeSessionId) {
|
|
3433
|
-
queries.setClaudeSessionId(conversationId, parsed.session_id, sessionId);
|
|
3434
|
-
debugLog(`[stream] Eagerly persisted claudeSessionId=${parsed.session_id} for conv=${conversationId}`);
|
|
3435
|
-
}
|
|
3436
|
-
|
|
3437
3432
|
const systemBlock = {
|
|
3438
3433
|
type: 'system',
|
|
3439
3434
|
subtype: parsed.subtype,
|
|
@@ -285,6 +285,9 @@ class StreamingRenderer {
|
|
|
285
285
|
if (nodeCount > 0) {
|
|
286
286
|
this.outputContainer.appendChild(fragment);
|
|
287
287
|
this.domNodeCount += nodeCount;
|
|
288
|
+
|
|
289
|
+
// Nest tool result blocks inside their corresponding tool use blocks
|
|
290
|
+
this.nestToolResultsInToolUses();
|
|
288
291
|
}
|
|
289
292
|
|
|
290
293
|
// Auto-scroll to bottom
|
|
@@ -757,7 +760,7 @@ class StreamingRenderer {
|
|
|
757
760
|
const input = block.input || {};
|
|
758
761
|
|
|
759
762
|
const details = document.createElement('details');
|
|
760
|
-
details.className = 'block-tool-use folded-tool
|
|
763
|
+
details.className = 'block-tool-use folded-tool';
|
|
761
764
|
if (block.id) details.dataset.toolUseId = block.id;
|
|
762
765
|
details.classList.add(this._getBlockTypeClass('tool_use'));
|
|
763
766
|
details.classList.add(this._getToolColorClass(toolName));
|
|
@@ -1249,7 +1252,7 @@ class StreamingRenderer {
|
|
|
1249
1252
|
const details = document.createElement('details');
|
|
1250
1253
|
details.className = 'folded-tool' + (isError ? ' folded-tool-error' : ' folded-tool-success');
|
|
1251
1254
|
details.dataset.eventType = 'tool_result';
|
|
1252
|
-
// Only open by default if the content is an image
|
|
1255
|
+
// Only open by default if the content is an image and it's not an error
|
|
1253
1256
|
const isImageContent = contentStr.includes('data:image/') || (block.content && block.content.type === 'base64');
|
|
1254
1257
|
if (!isError && isImageContent) details.open = true;
|
|
1255
1258
|
if (block.tool_use_id) details.dataset.toolUseId = block.tool_use_id;
|
|
@@ -2070,6 +2073,26 @@ class StreamingRenderer {
|
|
|
2070
2073
|
return div;
|
|
2071
2074
|
}
|
|
2072
2075
|
|
|
2076
|
+
/**
|
|
2077
|
+
* Nest tool result blocks inside their corresponding tool use blocks
|
|
2078
|
+
*/
|
|
2079
|
+
nestToolResultsInToolUses() {
|
|
2080
|
+
if (!this.outputContainer) return;
|
|
2081
|
+
|
|
2082
|
+
const toolUseBlocks = this.outputContainer.querySelectorAll('details.block-tool-use[data-tool-use-id]');
|
|
2083
|
+
const toolResultBlocks = this.outputContainer.querySelectorAll('details[data-event-type="tool_result"][data-tool-use-id]');
|
|
2084
|
+
|
|
2085
|
+
toolResultBlocks.forEach(resultBlock => {
|
|
2086
|
+
const toolUseId = resultBlock.dataset.toolUseId;
|
|
2087
|
+
const toolUseBlock = Array.from(toolUseBlocks).find(b => b.dataset.toolUseId === toolUseId);
|
|
2088
|
+
|
|
2089
|
+
if (toolUseBlock && toolUseBlock.parentElement === resultBlock.parentElement) {
|
|
2090
|
+
// Result is a sibling of the tool use block, move it inside
|
|
2091
|
+
toolUseBlock.appendChild(resultBlock);
|
|
2092
|
+
}
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2073
2096
|
/**
|
|
2074
2097
|
* Auto-scroll to bottom of container
|
|
2075
2098
|
*/
|