miii-cli 0.2.3 → 0.2.4
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/tools/index.js +3 -1
- package/dist/tui/InputBar.js +18 -1
- package/package.json +1 -1
package/dist/tools/index.js
CHANGED
|
@@ -246,7 +246,9 @@ Rules:
|
|
|
246
246
|
- Be concise
|
|
247
247
|
- Output plain text only — never use markdown formatting in your responses
|
|
248
248
|
- No headers (no #, ##), no bold (**text**), no italic (*text*), no bullet points with *, no horizontal rules (---)
|
|
249
|
-
-
|
|
249
|
+
- NEVER show file content or code in your text response — always use edit_file, patch_file, or create_file tools to write code to files
|
|
250
|
+
- If you want to show the user code, write it to the file with a tool call instead
|
|
251
|
+
- No fenced code blocks (no \`\`\`). If you find yourself about to write a code block, use a tool call instead
|
|
250
252
|
- Use plain indentation and labels for structure. This is a terminal, not a chat UI
|
|
251
253
|
- After editing files that have tests, call run_tests to verify nothing broke
|
|
252
254
|
- If run_tests fails, read the failing test output and fix the code, then run_tests again (max 3 retries)${extra}`;
|
package/dist/tui/InputBar.js
CHANGED
|
@@ -6,7 +6,7 @@ import { ModelPicker } from './components/ModelPicker.js';
|
|
|
6
6
|
import { Divider } from './components/StatusBar.js';
|
|
7
7
|
import { chat } from '../llm/stream.js';
|
|
8
8
|
import { listModels, pullModel } from '../llm/ollama.js';
|
|
9
|
-
import { StreamParser } from '../parser/stream-parser.js';
|
|
9
|
+
import { StreamParser, extractBareToolCall } from '../parser/stream-parser.js';
|
|
10
10
|
import { tools, getSystemPrompt } from '../tools/index.js';
|
|
11
11
|
import { readFile } from '../files/ops.js';
|
|
12
12
|
import { resolve } from 'path';
|
|
@@ -209,9 +209,26 @@ export function InputBar({ config, skills, cwd, session }) {
|
|
|
209
209
|
if (item.type === 'tool_call')
|
|
210
210
|
pendingTools.push({ name: item.toolName, args: item.toolArgs });
|
|
211
211
|
}
|
|
212
|
+
// Fallback: bare JSON tool call without <tool_call> wrapper
|
|
213
|
+
if (!pendingTools.length) {
|
|
214
|
+
const bare = extractBareToolCall(fullText);
|
|
215
|
+
if (bare)
|
|
216
|
+
pendingTools.push({ name: bare.name, args: bare.args });
|
|
217
|
+
}
|
|
212
218
|
printer.assistantMsg(fullText);
|
|
213
219
|
pushHistory({ role: 'assistant', content: fullText });
|
|
214
220
|
if (!pendingTools.length) {
|
|
221
|
+
// Model printed code as text instead of using tools — nudge it
|
|
222
|
+
const hasFencedCode = /```[\w]*\n[\s\S]{50,}?\n```/.test(fullText);
|
|
223
|
+
if (hasFencedCode && depth < MAX_TOOL_DEPTH - 1) {
|
|
224
|
+
const nudge = {
|
|
225
|
+
role: 'user',
|
|
226
|
+
content: 'You showed code in your response but did not use any file tools. Use edit_file or patch_file to actually write the changes to disk.',
|
|
227
|
+
};
|
|
228
|
+
const next = [...msgs, { role: 'assistant', content: fullText }, nudge];
|
|
229
|
+
await runLoop(next, depth + 1, goal);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
215
232
|
setStatus('idle');
|
|
216
233
|
return;
|
|
217
234
|
}
|