Skip to content

Commit 9693efe

Browse files
author
Brendan Gray
committed
v1.7.2 — Fix acknowledgment deletion, backtick JSON parsing, truncation limits, continuation planning loop
1 parent 247e509 commit 9693efe

4 files changed

Lines changed: 19 additions & 16 deletions

File tree

main/agenticChat.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,8 @@ function register(ctx) {
463463
if (planningText) {
464464
mainWindow.webContents.send('llm-thinking-token', planningText);
465465
}
466-
// Wipe this iteration's content from main chat — the final answer arrives in
467-
// the last iteration that produces no tool calls (preserved by iterationStartOffsetRef).
468-
mainWindow.webContents.send('llm-replace-last', '');
466+
// Keep acknowledgment/planning text visible in the chat bubble — never delete it.
467+
mainWindow.webContents.send('llm-replace-last', planningText);
469468
}
470469

471470
if (!toolResults.hasToolCalls || toolResults.results.length === 0) {
@@ -1714,7 +1713,7 @@ function register(ctx) {
17141713
iteration--; // Continuation is not a new agentic step
17151714
currentPrompt = {
17161715
systemContext: currentPrompt.systemContext, // Unchanged — KV cache preserved
1717-
userMessage: '[Continue your response exactly where you left off. If you were in the middle of a tool call, call that tool now to complete the task — do not output tool content as raw text. Output only the continuation — no preamble, no summary, no repeated content.]',
1716+
userMessage: '[Continue your response exactly where you left off. If you were listing steps or planning, STOP — do not add more steps. Call the first tool now to begin execution. If you were in the middle of a tool call, call that tool now to complete the task — do not output tool content as raw text. Output only the continuation — no preamble, no summary, no repeated content.]',
17181717
};
17191718
continue;
17201719
}
@@ -1929,12 +1928,12 @@ function register(ctx) {
19291928
}
19301929
const planningText = responseText.substring(0, splitIdx).trim();
19311930
if (planningText) {
1932-
// Planning text belongs in the thinking panel, not the main chat bubble
1931+
// Also send to thinking panel for the reasoning dropdown
19331932
mainWindow.webContents.send('llm-thinking-token', planningText);
19341933
}
1935-
// Wipe this iteration's streamed content from main chat — the final answer
1936-
// streams clean in the last iteration that produces no tool calls.
1937-
mainWindow.webContents.send('llm-replace-last', '');
1934+
// Keep acknowledgment/planning text visible in the chat bubble — never delete it.
1935+
// Send planningText (may be empty string) so prior text is preserved in the bubble.
1936+
mainWindow.webContents.send('llm-replace-last', planningText);
19381937
}
19391938

19401939
if (!toolResults.hasToolCalls || toolResults.results.length === 0) {

main/tools/mcpToolParser.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,13 @@ function parseToolCalls(text) {
302302
if (start === -1) break;
303303
let depth = 0;
304304
let inStr = false;
305+
let inBacktick = false;
305306
let end = -1;
306307
for (let i = start; i < blockContent.length; i++) {
307308
const c = blockContent[i];
308-
if (c === '"' && (i === 0 || blockContent[i - 1] !== '\\')) inStr = !inStr;
309-
if (!inStr) {
309+
if (!inBacktick && c === '"' && (i === 0 || blockContent[i - 1] !== '\\')) inStr = !inStr;
310+
if (!inStr && c === '`') inBacktick = !inBacktick;
311+
if (!inStr && !inBacktick) {
310312
if (c === '{') depth++;
311313
if (c === '}') { depth--; if (depth === 0) { end = i; break; } }
312314
}
@@ -372,15 +374,17 @@ function parseToolCalls(text) {
372374
// String-aware brace-counting to extract complete JSON
373375
let depth = 0;
374376
let inStr = false;
377+
let inBacktick = false;
375378
let endIdx = startIdx;
376379
for (let i = startIdx; i < cleanedText.length; i++) {
377380
const c = cleanedText[i];
378-
if (c === '"' && (i === 0 || cleanedText[i - 1] !== '\\')) inStr = !inStr;
379-
if (!inStr) {
381+
if (!inBacktick && c === '"' && (i === 0 || cleanedText[i - 1] !== '\\')) inStr = !inStr;
382+
if (!inStr && c === '`') inBacktick = !inBacktick;
383+
if (!inStr && !inBacktick) {
380384
if (c === '{') depth++;
381385
if (c === '}') depth--;
382386
}
383-
if (depth === 0 && !inStr) {
387+
if (depth === 0 && !inStr && !inBacktick) {
384388
endIdx = i + 1;
385389
break;
386390
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "guide-ide",
3-
"version": "1.7.1",
3+
"version": "1.7.2",
44
"description": "guIDE - AI-Powered Offline IDE with local LLM, RAG, MCP tools, browser automation, and integrated terminal",
55
"author": {
66
"name": "Brendan Gray",

src/components/Chat/ChatPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ ${e.message}`,
11781178
try {
11791179
const parsed = JSON.parse(content);
11801180
if (parsed.params?.content && typeof parsed.params.content === 'string' && parsed.params.content.length > 500) {
1181-
const truncated = { ...parsed, params: { ...parsed.params, content: parsed.params.content.substring(0, 200) + '...[truncated]' } };
1181+
const truncated = { ...parsed, params: { ...parsed.params, content: parsed.params.content.substring(0, 2000) + '...[truncated]' } };
11821182
return JSON.stringify(truncated, null, 2);
11831183
}
11841184
} catch { /* not JSON, truncate raw */ }
@@ -2512,7 +2512,7 @@ ${e.message}`,
25122512
}
25132513
} catch {}
25142514
const genLabel = partialDetail ? `${tc.functionName}: ${partialDetail}` : tc.functionName;
2515-
const displayText = tc.paramsText.length > 1500 ? tc.paramsText.substring(0, 1500) + '\n\u2026[truncated]' : tc.paramsText;
2515+
const displayText = tc.paramsText.length > 5000 ? tc.paramsText.substring(0, 5000) + '\n\u2026[truncated]' : tc.paramsText;
25162516
return (
25172517
<CollapsibleToolBlock key={`gen-${tc.callIndex}`} label={genLabel} icon="\u29d7">
25182518
<div>

0 commit comments

Comments
 (0)