@tiens.nguyen/gu-cli 1.0.713 → 1.0.715

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.
Files changed (2) hide show
  1. package/gu-repl.mjs +27 -4
  2. package/package.json +1 -1
package/gu-repl.mjs CHANGED
@@ -6367,6 +6367,14 @@ async function askKeyForRow(row, host) {
6367
6367
  console.log(red(" couldn't save the key — nothing changed.\n"));
6368
6368
  return "";
6369
6369
  }
6370
+ // The key just entered for THIS provider is the one to use (follow-up: the new ollama
6371
+ // cloud key should become the chosen one) — pin it to this folder now so the next coder
6372
+ // pick doesn't fall back to an older key, and the bar tail matches what will be sent.
6373
+ sessionCodingKeyId = id;
6374
+ await saveSessionCodingKeyId(resolve(process.cwd()));
6375
+ sessionApiKeyTail = secret.slice(-4);
6376
+ keyChoicePending = false;
6377
+ codingKeyMissingKnown = false;
6370
6378
  return secret;
6371
6379
  }
6372
6380
 
@@ -7590,7 +7598,19 @@ async function replaceCodingKey() {
7590
7598
  // not usable here — so an unbound key added at this prompt would become usable EVERYWHERE on
7591
7599
  // the strength of a question that was asked about one provider.
7592
7600
  const id = await promptNewCodingKey(ks.backendId, ks.provider);
7593
- if (id) codingKeyMissingKnown = false;
7601
+ if (id) {
7602
+ // A key you just added for THIS coder is the one you mean to use (follow-up: "when i
7603
+ // added a new ollama cloud api key, make it the chosen one"). Pinning used to be skipped
7604
+ // here on the reasoning that one key is the account default anyway — but a SECOND key
7605
+ // later leaves this folder un-pinned, and the bar then reads the old coder's key until
7606
+ // ctrl+k is opened by hand. Pin now so the new key is chosen from the start.
7607
+ sessionCodingKeyId = id;
7608
+ await saveSessionCodingKeyId(resolve(process.cwd()));
7609
+ codingKeyMissingKnown = false;
7610
+ keyChoicePending = false;
7611
+ const kd = await fetchCodingKey(ks.backendId || "");
7612
+ sessionApiKeyTail = kd.key ? kd.key.slice(-4) : "";
7613
+ }
7594
7614
  paintBar();
7595
7615
  return;
7596
7616
  }
@@ -7683,9 +7703,12 @@ async function manageCodingKeys(ks, keys) {
7683
7703
  await saveSessionCodingKeyId(resolve(process.cwd()));
7684
7704
  keyChoicePending = false; // chosen — the bar's mark comes off
7685
7705
  codingKeyMissingKnown = false;
7686
- // Fetch the key to get its tail for the bottom bar
7687
- const keyData = await fetchCodingKey(keys[idx].backendId || "");
7688
- sessionApiKeyTail = keyData.key ? keyData.key.slice(-4) : "";
7706
+ // The picked row already carries the correct masked tail. Do NOT refetch via
7707
+ // fetchCodingKey(backendId): that returns the key the provider would DEFAULT to, not the key
7708
+ // just chosen by id — and for an UNBOUND key backendId is "", so it answers the account
7709
+ // default. Either way the bar kept showing the old/default key's tail no matter what you
7710
+ // picked (reported: "choosing between multiple keys doesn't change the tail").
7711
+ sessionApiKeyTail = keys[idx].tail || "";
7689
7712
  console.log(
7690
7713
  accent(` ✓ ${folderLabel()} → ${keys[idx].name}`) + dim(` ····${keys[idx].tail}\n`)
7691
7714
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gu-cli",
3
- "version": "1.0.713",
3
+ "version": "1.0.715",
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",