@tiens.nguyen/gu-cli 1.0.872 → 1.0.874

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.
@@ -350,8 +350,8 @@ export function agentRecoveryOptions({ keyProblem = false, host = "" } = {}) {
350
350
  return [
351
351
  { action: "leave", label: "leave it" },
352
352
  ...(keyProblem ? [{ action: "key", label: `enter the API key for ${host || "this provider"}…` }] : []),
353
- { action: "ollama", label: "use an Ollama server for the agent…" },
354
- { action: "provider", label: "add a provider for the agent — Claude API, OpenAI, Kimi…" },
353
+ // #244: no separate Ollama row — Ollama is one of the providers on the add screen.
354
+ { action: "provider", label: "add a provider for the agent — Claude API, OpenAI, Kimi, Ollama…" },
355
355
  ];
356
356
  }
357
357
 
@@ -375,8 +375,9 @@ export function agentMenuOptions({ host = "", modelCount = 0, needsKey = false }
375
375
  const where = host || "this server";
376
376
  return [
377
377
  { action: "models", label: `pick another model on ${where}${modelCount ? ` (${modelCount})` : ""}` },
378
- { action: "ollama", label: "use an Ollama server for the agent…" },
379
- { action: "provider", label: "use another provider — Claude API, OpenAI, Kimi…" },
378
+ // #244: "use an Ollama server for the agent…" was a second way to the same add screen, left from
379
+ // when Ollama had its own setup (#41). Ollama, ollama.com included, is one provider among the rest.
380
+ { action: "provider", label: "use another provider — Claude API, OpenAI, Kimi, Ollama…" },
380
381
  // Task #245: the SAME key manager /model's ctrl+k and /embed-model open — switch, add, make
381
382
  // default, delete — for this server's keys only.
382
383
  ...(needsKey ? [{ action: "key", label: `API keys for ${where} — switch, add or remove…` }] : []),
@@ -393,7 +394,8 @@ export function agentProviderChoices(settings) {
393
394
  const current = ensureV1Root(String(settings?.agentModelUrl ?? "")).toLowerCase();
394
395
  const out = [];
395
396
  for (const row of rows) {
396
- if (!row || row.kind !== "openai" || !row.url) continue;
397
+ // Ollama rows too (#244): ollama.com or a box saved earlier is a provider like any other.
398
+ if (!row || (row.kind !== "openai" && row.kind !== "ollama") || !row.url) continue;
397
399
  let host = String(row.url);
398
400
  try {
399
401
  host = new URL(String(row.url)).host;
@@ -403,7 +405,7 @@ export function agentProviderChoices(settings) {
403
405
  const isCurrent = ensureV1Root(String(row.url)).toLowerCase() === current;
404
406
  out.push({ action: "row", row, label: `${host}${isCurrent ? " (current)" : ""}` });
405
407
  }
406
- out.push({ action: "add", label: "add a new provider — Claude API, OpenAI, Kimi…" });
408
+ out.push({ action: "add", label: "add a new provider — Claude API, OpenAI, Kimi, Ollama…" });
407
409
  return out;
408
410
  }
409
411
 
@@ -614,20 +614,24 @@ export function providerHost(url) {
614
614
  * KIND, so a second openai row is not even visible there. Add-only was a dead end and this is the
615
615
  * exit from it.
616
616
  *
617
- * OPENAI ROWS ONLY. An Ollama or MLX row is owned by its own flow ("change the Ollama server this
618
- * machine uses…"), which sets URL, models and roles together; editing one field of it from here
619
- * would half-configure a thing that has its own notion of complete.
617
+ * OPENAI AND OLLAMA ROWS (#243). Ollama rows — ollama.com, or a box added with "another URL…" —
618
+ * used to be left to "change the Ollama server this machine uses…"; #412 removed that menu, which
619
+ * left them with no editor at all: an ollama.com coder worked but could not be found here to change
620
+ * or remove. They are listed with `dialect: "ollama"`, and their model list and URL are handled in
621
+ * that dialect (/api/tags, serverTarget). MLX / "local" rows stay out: they are set up by gu itself.
620
622
  */
621
623
  export function manageableProviders(rows) {
622
624
  const out = [];
623
625
  const taken = new Set();
624
626
  for (const b of Array.isArray(rows) ? rows : []) {
625
627
  if (!b || typeof b !== "object") continue;
626
- if (String(b.kind ?? "") !== "openai") continue;
628
+ const kind = String(b.kind ?? "");
629
+ if (kind !== "openai" && kind !== "ollama") continue;
627
630
  const url = String(b.url ?? "").trim();
628
631
  if (!url) continue;
629
- // The same identity rule the API uses, so an id shown here is the id it will patch.
630
- const id = String(b.id ?? "").trim() || (taken.has("openai") ? "" : "openai");
632
+ // The same identity rule the API uses, so an id shown here is the id it will patch: an id-less
633
+ // row is known by its kind, and only the first of each kind can be.
634
+ const id = String(b.id ?? "").trim() || (taken.has(kind) ? "" : kind);
631
635
  if (!id || taken.has(id)) continue;
632
636
  taken.add(id);
633
637
  out.push({
@@ -636,6 +640,7 @@ export function manageableProviders(rows) {
636
640
  model: String(b.defaultModel ?? "").trim(),
637
641
  host: providerHost(url),
638
642
  enabled: b.enabled !== false,
643
+ dialect: kind === "ollama" ? "ollama" : "openai",
639
644
  });
640
645
  }
641
646
  return out;
@@ -106,8 +106,8 @@ export function embedMenuOptions({ current = DEFAULT_EMBED_MODEL, host = "", key
106
106
  const where = host || "this server";
107
107
  return [
108
108
  { action: "model", label: `switch the embedder model (currently ${current})` },
109
- { action: "ollama", label: "use an Ollama server for embedding…" },
110
- { action: "provider", label: "use another OpenAI-compatible provider…" },
109
+ // #244: one row for every server — Ollama (this machine, the network) is a choice on the add screen.
110
+ { action: "provider", label: "use another provider — OpenAI, Ollama…" },
111
111
  ...(keyRequired ? [{ action: "key", label: `enter a new API key for ${where}…` }] : []),
112
112
  ];
113
113
  }