markov-cli 1.0.8 → 1.0.9
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/src/interactive.js +19 -5
- package/src/ollama.js +2 -2
package/package.json
CHANGED
package/src/interactive.js
CHANGED
|
@@ -230,6 +230,18 @@ async function applyCodeBlockEdits(responseText, loadedFiles = []) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
/** Run `ls -la` in cwd and return a context string to prepend to user messages. */
|
|
234
|
+
async function getLsContext(cwd = process.cwd()) {
|
|
235
|
+
try {
|
|
236
|
+
const { stdout, stderr, exitCode } = await execCommand('ls -la', cwd);
|
|
237
|
+
const out = [stdout, stderr].filter(Boolean).join('\n').trim();
|
|
238
|
+
if (exitCode === 0 && out) {
|
|
239
|
+
return `[Current directory: ${cwd}]\n$ ls -la\n${out}\n\n`;
|
|
240
|
+
}
|
|
241
|
+
} catch (_) {}
|
|
242
|
+
return `[Current directory: ${cwd}]\n(listing unavailable)\n\n`;
|
|
243
|
+
}
|
|
244
|
+
|
|
233
245
|
/** Shared system message base: Markov intro, cwd, file list. */
|
|
234
246
|
function getSystemMessageBase() {
|
|
235
247
|
const files = getFiles();
|
|
@@ -588,13 +600,14 @@ export async function startInteractive() {
|
|
|
588
600
|
|
|
589
601
|
// /agent [prompt] — run with tools (run_terminal_command, create_folder, file tools), loop until final response
|
|
590
602
|
if (trimmed === '/agent' || trimmed.startsWith('/agent ')) {
|
|
591
|
-
const
|
|
603
|
+
const rawUserContent = trimmed.startsWith('/agent ')
|
|
592
604
|
? trimmed.slice(7).trim()
|
|
593
605
|
: (await promptLine(chalk.bold('Agent prompt: '))).trim();
|
|
594
|
-
if (!
|
|
606
|
+
if (!rawUserContent) {
|
|
595
607
|
console.log(chalk.yellow('No prompt given.\n'));
|
|
596
608
|
continue;
|
|
597
609
|
}
|
|
610
|
+
const userContent = (await getLsContext()) + rawUserContent;
|
|
598
611
|
chatMessages.push({ role: 'user', content: userContent });
|
|
599
612
|
const agentMessages = [buildAgentSystemMessage(), ...chatMessages];
|
|
600
613
|
const abortController = new AbortController();
|
|
@@ -640,7 +653,7 @@ export async function startInteractive() {
|
|
|
640
653
|
},
|
|
641
654
|
onIteration: (iter, max, toolCount) => {
|
|
642
655
|
const w = process.stdout.columns || 80;
|
|
643
|
-
const label = ` Step ${iter}
|
|
656
|
+
const label = ` Step ${iter} `;
|
|
644
657
|
const line = chalk.dim('──') + chalk.bold.white(label) + chalk.dim('─'.repeat(Math.max(0, w - label.length - 2)));
|
|
645
658
|
console.log(line);
|
|
646
659
|
},
|
|
@@ -682,7 +695,8 @@ export async function startInteractive() {
|
|
|
682
695
|
if (failed.length > 0) {
|
|
683
696
|
console.log(chalk.yellow(`\n⚠ not found: ${failed.map(f => `@${f}`).join(', ')}`));
|
|
684
697
|
}
|
|
685
|
-
const
|
|
698
|
+
const rawUserContent = resolvedContent ?? trimmed;
|
|
699
|
+
const userContent = (await getLsContext()) + rawUserContent;
|
|
686
700
|
chatMessages.push({ role: 'user', content: userContent });
|
|
687
701
|
|
|
688
702
|
const agentMessages = [buildAgentSystemMessage(), ...chatMessages];
|
|
@@ -728,7 +742,7 @@ export async function startInteractive() {
|
|
|
728
742
|
},
|
|
729
743
|
onIteration: (iter, max, toolCount) => {
|
|
730
744
|
const w = process.stdout.columns || 80;
|
|
731
|
-
const label = ` Step ${iter}
|
|
745
|
+
const label = ` Step ${iter} `;
|
|
732
746
|
const line = chalk.dim('──') + chalk.bold.white(label) + chalk.dim('─'.repeat(Math.max(0, w - label.length - 2)));
|
|
733
747
|
console.log(line);
|
|
734
748
|
},
|
package/src/ollama.js
CHANGED
|
@@ -4,8 +4,8 @@ const getHeaders = () => {
|
|
|
4
4
|
const token = getToken();
|
|
5
5
|
return { 'Content-Type': 'application/json', ...(token && { Authorization: `Bearer ${token}` }) };
|
|
6
6
|
};
|
|
7
|
-
export const MODELS = ['
|
|
8
|
-
export let MODEL = 'qwen3:
|
|
7
|
+
export const MODELS = ['llama3:latest', 'gpt-oss:20b', 'qwen3:14b', 'qwen2.5:14b-instruct', 'qwen3.5:9b'];
|
|
8
|
+
export let MODEL = 'qwen3.5:9b';
|
|
9
9
|
export function setModel(m) { MODEL = m; }
|
|
10
10
|
|
|
11
11
|
/**
|