miii-agent 0.1.5 → 0.1.6
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/cli.js +18 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -12,10 +12,21 @@ import { sep } from "path";
|
|
|
12
12
|
|
|
13
13
|
// src/ollama/client.ts
|
|
14
14
|
import { Ollama } from "ollama";
|
|
15
|
+
import { execFileSync } from "child_process";
|
|
15
16
|
var ollama = new Ollama({
|
|
16
17
|
host: process.env.OLLAMA_HOST ?? "http://localhost:11434"
|
|
17
18
|
});
|
|
19
|
+
var OLLAMA_NOT_INSTALLED = "Ollama is not installed. Install it with: npm i -g ollama\nOr download from https://ollama.com/download";
|
|
18
20
|
var OLLAMA_NOT_RUNNING = "Ollama is not running. Start it with: ollama serve";
|
|
21
|
+
function ollamaInstalled() {
|
|
22
|
+
try {
|
|
23
|
+
const cmd = process.platform === "win32" ? "where" : "which";
|
|
24
|
+
execFileSync(cmd, ["ollama"], { stdio: "ignore" });
|
|
25
|
+
return true;
|
|
26
|
+
} catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
19
30
|
var HARMONY_RE = /<\|?\/?(?:channel|message|start|end|return|constrain|assistant|user|system|developer|tool|tool_call|tool_response|final|analysis|commentary)\|?>/gi;
|
|
20
31
|
var CHANNEL_LABEL_RE = /^(?:analysis|commentary|final)\s*(?=\w)/i;
|
|
21
32
|
function stripHarmony(s) {
|
|
@@ -2039,6 +2050,7 @@ function App() {
|
|
|
2039
2050
|
const [state, setState] = useState4("loading");
|
|
2040
2051
|
const [cursor, setCursor] = useState4(0);
|
|
2041
2052
|
const [updateAvailable, setUpdateAvailable] = useState4(null);
|
|
2053
|
+
const [ollamaDown, setOllamaDown] = useState4(false);
|
|
2042
2054
|
const [sessionId, setSessionId] = useState4(() => newSessionId());
|
|
2043
2055
|
const [sessions, setSessions] = useState4([]);
|
|
2044
2056
|
const [notice, setNotice] = useState4(null);
|
|
@@ -2067,7 +2079,8 @@ function App() {
|
|
|
2067
2079
|
});
|
|
2068
2080
|
}).catch((err) => {
|
|
2069
2081
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2070
|
-
agent.setError(msg);
|
|
2082
|
+
agent.setError(ollamaInstalled() ? msg : OLLAMA_NOT_INSTALLED);
|
|
2083
|
+
setOllamaDown(true);
|
|
2071
2084
|
setModels([]);
|
|
2072
2085
|
setState(cfg.model ? "ready" : "select-model");
|
|
2073
2086
|
});
|
|
@@ -2158,8 +2171,10 @@ function App() {
|
|
|
2158
2171
|
if (!m) return null;
|
|
2159
2172
|
return /* @__PURE__ */ jsx10(FilePicker, { matches: searchFiles(process.cwd(), m.query), cursor: filePickerCursor });
|
|
2160
2173
|
})(),
|
|
2161
|
-
/* @__PURE__ */
|
|
2162
|
-
|
|
2174
|
+
!ollamaDown && /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2175
|
+
/* @__PURE__ */ jsx10(InputBar, { input, disabled: agent.busy, processingLabel: agent.processingLabel }),
|
|
2176
|
+
!agent.busy && /* @__PURE__ */ jsx10(Box10, { marginLeft: 2, marginBottom: 1, children: /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "type / to see commands" }) })
|
|
2177
|
+
] })
|
|
2163
2178
|
] })
|
|
2164
2179
|
] });
|
|
2165
2180
|
}
|