@tiens.nguyen/gu-cli 1.0.803 → 1.0.804
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 +37 -1
- package/package.json +1 -1
package/gu-repl.mjs
CHANGED
|
@@ -7801,13 +7801,49 @@ async function runLoadSettingsCommand(line) {
|
|
|
7801
7801
|
*/
|
|
7802
7802
|
async function applyTransferDoc(value, opts = {}) {
|
|
7803
7803
|
const pa = await import("./preset-apply.mjs");
|
|
7804
|
-
|
|
7804
|
+
const result = await pa.applyTransfer(value, {
|
|
7805
7805
|
...opts,
|
|
7806
7806
|
api: replPresetApi(),
|
|
7807
7807
|
io: replPresetIo,
|
|
7808
7808
|
backupDir: join(homedir(), ".gonext", "preset-backups"),
|
|
7809
7809
|
host: hostname(),
|
|
7810
7810
|
});
|
|
7811
|
+
if (result?.applied) await refreshAfterPresetApply(value, opts.codingDefault, result);
|
|
7812
|
+
return result;
|
|
7813
|
+
}
|
|
7814
|
+
|
|
7815
|
+
/**
|
|
7816
|
+
* AFTER A PRESET / SETTINGS FILE LANDS, bring the running session in line with it (task #21).
|
|
7817
|
+
* The settings were written, but the REPL kept what it read at startup: the old default coder
|
|
7818
|
+
* (defaultCodingModel/Url), the folder's stored /model pick (which outranks the default, so the
|
|
7819
|
+
* bar and /model kept showing the old coder), and the "no embed model" / "no agent model"
|
|
7820
|
+
* warnings. /model already does this after a change; applying a preset must too.
|
|
7821
|
+
*/
|
|
7822
|
+
async function refreshAfterPresetApply(value, codingDefault, result) {
|
|
7823
|
+
try {
|
|
7824
|
+
// The preset's coder IS the account default now — a folder pick would shadow it.
|
|
7825
|
+
if (result.coder && codingDefault?.model) {
|
|
7826
|
+
sessionCodingModel = "";
|
|
7827
|
+
sessionCodingLabel = "";
|
|
7828
|
+
sessionCodingUrl = "";
|
|
7829
|
+
await saveSessionCoding(resolve(process.cwd()));
|
|
7830
|
+
defaultCodingModel = codingDefault.model;
|
|
7831
|
+
defaultCodingUrl = codingDefault.url;
|
|
7832
|
+
}
|
|
7833
|
+
// What the API now answers with is authoritative — read it back rather than assume.
|
|
7834
|
+
const probe = await fetchAgentPayload([{ role: "user", content: "ping" }]).catch(() => null);
|
|
7835
|
+
const p = probe?.payload ?? {};
|
|
7836
|
+
if (p.codingModelId) defaultCodingModel = p.codingModelId;
|
|
7837
|
+
if (p.codingBaseURL) defaultCodingUrl = p.codingBaseURL;
|
|
7838
|
+
activeCoderWhere = whereOfActiveCoder(probe?.codingChoices ?? p.codingChoices, sessionCodingModel);
|
|
7839
|
+
if (value?.agentModel?.name || p.agentMissing === false) agentMissing = false;
|
|
7840
|
+
else if (p.agentMissing === true) agentMissing = true;
|
|
7841
|
+
if (probe?.payload) noModelAtAll = nothingToAnswerWith(p);
|
|
7842
|
+
await syncEmbedWarning({ repair: true });
|
|
7843
|
+
if (barPinned()) paintBar();
|
|
7844
|
+
} catch {
|
|
7845
|
+
/* a failed refresh must never undo a preset that applied — the next launch re-reads everything */
|
|
7846
|
+
}
|
|
7811
7847
|
}
|
|
7812
7848
|
|
|
7813
7849
|
/** The .json files directly in a folder, with enough of each to recognise a settings file. */
|
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.804",
|
|
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",
|