code-ollama 0.3.0 → 0.3.1
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.
|
@@ -31,6 +31,17 @@ function Messages({ messages, isLoading }) {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
|
+
//#region src/components/SelectPrompt.tsx
|
|
35
|
+
function SelectPrompt({ children, onEscape, ...selectProps }) {
|
|
36
|
+
useInput((_, key) => {
|
|
37
|
+
if (key.escape) onEscape?.();
|
|
38
|
+
});
|
|
39
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
40
|
+
flexDirection: "column",
|
|
41
|
+
children: [children, /* @__PURE__ */ jsx(Select, { ...selectProps })]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
34
45
|
//#region src/components/PlanApproval.tsx
|
|
35
46
|
var options$1 = [
|
|
36
47
|
{
|
|
@@ -47,34 +58,33 @@ var options$1 = [
|
|
|
47
58
|
}
|
|
48
59
|
];
|
|
49
60
|
function PlanApproval({ planContent, onModeChange }) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onModeChange
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
]
|
|
61
|
+
return /* @__PURE__ */ jsx(SelectPrompt, {
|
|
62
|
+
options: options$1,
|
|
63
|
+
onChange: useCallback((value) => {
|
|
64
|
+
onModeChange(value);
|
|
65
|
+
}, [onModeChange]),
|
|
66
|
+
onEscape: useCallback(() => {
|
|
67
|
+
onModeChange(NAME.PLAN);
|
|
68
|
+
}, [onModeChange]),
|
|
69
|
+
children: /* @__PURE__ */ jsxs(Box, {
|
|
70
|
+
flexDirection: "column",
|
|
71
|
+
marginTop: 1,
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx(Text, {
|
|
74
|
+
bold: true,
|
|
75
|
+
color: "magenta",
|
|
76
|
+
children: "Plan Generated - Choose execution mode:"
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ jsx(Box, {
|
|
79
|
+
marginY: 1,
|
|
80
|
+
children: /* @__PURE__ */ jsx(Text, { children: planContent })
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsx(Text, {
|
|
83
|
+
dimColor: true,
|
|
84
|
+
children: "Select execution mode (↑↓ + Enter to confirm, Esc to cancel)"
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
})
|
|
78
88
|
});
|
|
79
89
|
}
|
|
80
90
|
//#endregion
|
|
@@ -87,15 +97,17 @@ var options = [{
|
|
|
87
97
|
value: REJECT
|
|
88
98
|
}];
|
|
89
99
|
function ToolApproval({ toolCall, onDecision }) {
|
|
90
|
-
useInput((_, key) => {
|
|
91
|
-
if (key.escape) onDecision(REJECT);
|
|
92
|
-
});
|
|
93
100
|
const handleChange = useCallback((value) => {
|
|
94
101
|
onDecision(value);
|
|
95
102
|
}, [onDecision]);
|
|
103
|
+
const handleEscape = useCallback(() => {
|
|
104
|
+
onDecision(REJECT);
|
|
105
|
+
}, [onDecision]);
|
|
96
106
|
const args = JSON.stringify(toolCall.function.arguments, null, 2);
|
|
97
|
-
return /* @__PURE__ */ jsxs(
|
|
98
|
-
|
|
107
|
+
return /* @__PURE__ */ jsxs(SelectPrompt, {
|
|
108
|
+
options,
|
|
109
|
+
onChange: handleChange,
|
|
110
|
+
onEscape: handleEscape,
|
|
99
111
|
children: [
|
|
100
112
|
/* @__PURE__ */ jsx(Text, {
|
|
101
113
|
color: "yellow",
|
|
@@ -124,10 +136,6 @@ function ToolApproval({ toolCall, onDecision }) {
|
|
|
124
136
|
/* @__PURE__ */ jsx(Text, {
|
|
125
137
|
dimColor: true,
|
|
126
138
|
children: "Select approval action (↑↓ + Enter to confirm, Esc to reject)"
|
|
127
|
-
}),
|
|
128
|
-
/* @__PURE__ */ jsx(Select, {
|
|
129
|
-
options,
|
|
130
|
-
onChange: handleChange
|
|
131
139
|
})
|
|
132
140
|
]
|
|
133
141
|
});
|
|
@@ -512,40 +520,44 @@ function Header({ model }) {
|
|
|
512
520
|
}
|
|
513
521
|
//#endregion
|
|
514
522
|
//#region src/components/ModelPicker.tsx
|
|
515
|
-
function ModelPicker({ currentModel, onSelect,
|
|
523
|
+
function ModelPicker({ currentModel, onSelect, onClose }) {
|
|
516
524
|
const [options, setOptions] = useState([]);
|
|
517
525
|
const [error, setError] = useState(null);
|
|
526
|
+
useInput((_, key) => {
|
|
527
|
+
if (options.length && key.return) setTimeout(onClose);
|
|
528
|
+
});
|
|
518
529
|
useEffect(() => {
|
|
519
530
|
async function load() {
|
|
520
531
|
try {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
532
|
+
const models = await listModels();
|
|
533
|
+
if (models.includes(currentModel)) {
|
|
534
|
+
models.splice(models.indexOf(currentModel), 1);
|
|
535
|
+
models.unshift(currentModel);
|
|
536
|
+
}
|
|
537
|
+
setOptions(models.map((model) => ({
|
|
538
|
+
label: model,
|
|
539
|
+
value: model
|
|
524
540
|
})));
|
|
525
|
-
} catch (
|
|
526
|
-
setError(
|
|
541
|
+
} catch (error) {
|
|
542
|
+
setError(error instanceof Error ? error.message : String(error));
|
|
527
543
|
}
|
|
528
544
|
}
|
|
529
545
|
load();
|
|
530
|
-
}, []);
|
|
531
|
-
useInput((_, key) => {
|
|
532
|
-
if (key.escape) onCancel();
|
|
533
|
-
});
|
|
546
|
+
}, [currentModel]);
|
|
534
547
|
if (error) return /* @__PURE__ */ jsxs(Text, {
|
|
535
548
|
color: "red",
|
|
536
549
|
children: ["Error loading models: ", error]
|
|
537
550
|
});
|
|
538
551
|
if (!options.length) return /* @__PURE__ */ jsx(Spinner, { label: "Loading models..." });
|
|
539
|
-
return /* @__PURE__ */
|
|
540
|
-
|
|
541
|
-
|
|
552
|
+
return /* @__PURE__ */ jsx(SelectPrompt, {
|
|
553
|
+
options,
|
|
554
|
+
defaultValue: currentModel,
|
|
555
|
+
onChange: onSelect,
|
|
556
|
+
onEscape: onClose,
|
|
557
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
542
558
|
dimColor: true,
|
|
543
559
|
children: "Select a model (↑↓ + Enter to confirm, Esc to cancel)"
|
|
544
|
-
})
|
|
545
|
-
options,
|
|
546
|
-
defaultValue: currentModel,
|
|
547
|
-
onChange: onSelect
|
|
548
|
-
})]
|
|
560
|
+
})
|
|
549
561
|
});
|
|
550
562
|
}
|
|
551
563
|
//#endregion
|
|
@@ -562,7 +574,7 @@ function App() {
|
|
|
562
574
|
saveConfig({ model: selected });
|
|
563
575
|
setPicking(false);
|
|
564
576
|
}, []);
|
|
565
|
-
const
|
|
577
|
+
const handleClose = useCallback(() => {
|
|
566
578
|
setPicking(false);
|
|
567
579
|
}, []);
|
|
568
580
|
return /* @__PURE__ */ jsxs(Box, {
|
|
@@ -572,7 +584,7 @@ function App() {
|
|
|
572
584
|
picking ? /* @__PURE__ */ jsx(ModelPicker, {
|
|
573
585
|
currentModel: model,
|
|
574
586
|
onSelect: handleSelect,
|
|
575
|
-
|
|
587
|
+
onClose: handleClose
|
|
576
588
|
}) : /* @__PURE__ */ jsx(Chat, {
|
|
577
589
|
model,
|
|
578
590
|
onCommand: handleCommand,
|
package/dist/cli.js
CHANGED
|
@@ -28,7 +28,7 @@ var LABEL = {
|
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/constants/package.ts
|
|
31
|
-
var VERSION = "0.3.
|
|
31
|
+
var VERSION = "0.3.1";
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/constants/prompt.ts
|
|
34
34
|
var BASE_SYSTEM_PROMPT = `You are a coding assistant that helps users write, edit, and understand code. You have access to tools for reading files, writing files, running shell commands, and searching code
|
|
@@ -519,7 +519,7 @@ async function processRunStream(messages, model) {
|
|
|
519
519
|
}
|
|
520
520
|
async function main(args = process.argv.slice(2)) {
|
|
521
521
|
if (!args.length) {
|
|
522
|
-
const { renderApp } = await import("./assets/tui-
|
|
522
|
+
const { renderApp } = await import("./assets/tui-CVsodXv3.js");
|
|
523
523
|
clear();
|
|
524
524
|
renderApp();
|
|
525
525
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-ollama",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Ollama coding agent that runs in your terminal",
|
|
5
5
|
"author": "Mark <mark@remarkablemark.org> (https://remarkablemark.org)",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"cac": "7.0.0",
|
|
44
44
|
"ink": "7.0.2",
|
|
45
45
|
"ollama": "0.6.3",
|
|
46
|
-
"react": "19.2.
|
|
46
|
+
"react": "19.2.6"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@commitlint/cli": "20.5.3",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"globals": "17.6.0",
|
|
60
60
|
"husky": "9.1.7",
|
|
61
61
|
"ink-testing-library": "4.0.0",
|
|
62
|
-
"lint-staged": "
|
|
62
|
+
"lint-staged": "17.0.2",
|
|
63
63
|
"prettier": "3.8.3",
|
|
64
64
|
"publint": "0.3.19",
|
|
65
65
|
"tsx": "4.21.0",
|