@tiens.nguyen/gu-cli 1.0.772 → 1.0.774
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/gu-repl.mjs +12 -4
- package/model-doctor.mjs +24 -0
- package/package.json +1 -1
package/gu-repl.mjs
CHANGED
|
@@ -11622,10 +11622,18 @@ async function main() {
|
|
|
11622
11622
|
}
|
|
11623
11623
|
}
|
|
11624
11624
|
}
|
|
11625
|
-
const chatUrl = String(p.agentBaseURL || "").trim()
|
|
11626
|
-
//
|
|
11627
|
-
//
|
|
11628
|
-
|
|
11625
|
+
const chatUrl = String(p.agentBaseURL || "").trim();
|
|
11626
|
+
// ONLY an Apple-Silicon Mac in Host mode whose agent model is its own local MLX server
|
|
11627
|
+
// is offered a local model setup (task #311): a CLIENT or a CLIENT EXPERT keeps its models
|
|
11628
|
+
// remote, Linux/Windows/Intel cannot run MLX, and no configured agent URL is not a reason
|
|
11629
|
+
// to probe 127.0.0.1:8082 — the bar already says "agent model is not set".
|
|
11630
|
+
const offerLocal = md.shouldOfferLocalModelSetup({
|
|
11631
|
+
canHostMlx: md.canHostMlxModels(),
|
|
11632
|
+
clientMode: Boolean(clientModeBanner),
|
|
11633
|
+
clientExpert: isClientExpert(),
|
|
11634
|
+
agentUrl: chatUrl,
|
|
11635
|
+
});
|
|
11636
|
+
if (offerLocal && !(await md.probeModelServer(chatUrl))) {
|
|
11629
11637
|
console.log(
|
|
11630
11638
|
dim(`\ngu: the chat model server (${md.modelRoot(chatUrl)}) isn't responding.`)
|
|
11631
11639
|
);
|
package/model-doctor.mjs
CHANGED
|
@@ -1172,6 +1172,30 @@ export function canHostMlxModels() {
|
|
|
1172
1172
|
return platform() === "darwin" && arch() === "arm64";
|
|
1173
1173
|
}
|
|
1174
1174
|
|
|
1175
|
+
/**
|
|
1176
|
+
* Should gu offer to download and start the LOCAL chat model when it is not answering? (task #311)
|
|
1177
|
+
*
|
|
1178
|
+
* That offer is for one machine: an Apple-Silicon Mac running its own MLX chat model on 127.0.0.1.
|
|
1179
|
+
* It used to be asked whenever the hosted-Client flag was off — so a Client Expert box (models
|
|
1180
|
+
* REMOTE by definition) on Ubuntu was offered an MLX download, and with no agent model configured
|
|
1181
|
+
* the check fell back to 127.0.0.1:8082, which can never answer there.
|
|
1182
|
+
* · canHostMlx — canHostMlxModels() (darwin + arm64)
|
|
1183
|
+
* · neither hosted Client nor Client Expert
|
|
1184
|
+
* · an agent model URL IS configured and points at THIS machine
|
|
1185
|
+
* Pure: every input is passed in.
|
|
1186
|
+
*/
|
|
1187
|
+
export function shouldOfferLocalModelSetup({ canHostMlx, clientMode, clientExpert, agentUrl }) {
|
|
1188
|
+
if (!canHostMlx || clientMode || clientExpert) return false;
|
|
1189
|
+
const url = String(agentUrl ?? "").trim();
|
|
1190
|
+
if (!url) return false;
|
|
1191
|
+
try {
|
|
1192
|
+
const h = new URL(url).hostname.replace(/^\[|\]$/g, "");
|
|
1193
|
+
return h === "localhost" || h === "::1" || h.startsWith("127.");
|
|
1194
|
+
} catch {
|
|
1195
|
+
return false;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1175
1199
|
/**
|
|
1176
1200
|
* True when a local OLLAMA is serving models here. Matters because canHostMlxModels() is
|
|
1177
1201
|
* false on an Intel Mac or a Linux box, yet such a machine may well host models via Ollama —
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiens.nguyen/gu-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.774",
|
|
4
4
|
"description": "Gu CLI — the gu terminal plus the local worker that runs agent / OCR / PDF / embedding jobs on your Mac (Ollama / MLX / OpenAI-compatible).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|