zidane 6.5.5 → 6.5.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.
Files changed (91) hide show
  1. package/dist/{acp-BPJbXS2J.js → acp-Dm95NwNM.js} +4 -4
  2. package/dist/{acp-BPJbXS2J.js.map → acp-Dm95NwNM.js.map} +1 -1
  3. package/dist/acp-cli.js +5 -5
  4. package/dist/acp.d.ts +1 -1
  5. package/dist/acp.js +1 -1
  6. package/dist/{agent-gZjHsUft.js → agent-CcTWL-Z6.js} +59 -5
  7. package/dist/agent-CcTWL-Z6.js.map +1 -0
  8. package/dist/agent.d.ts +1 -1
  9. package/dist/agent.js +1 -1
  10. package/dist/{anthropic-D3le2d-s.js → anthropic-DLc_Kw-1.js} +362 -28
  11. package/dist/anthropic-DLc_Kw-1.js.map +1 -0
  12. package/dist/{auth-DCiXCwGa.js → auth-BAclQnl3.js} +126 -34
  13. package/dist/{auth-DCiXCwGa.js.map → auth-BAclQnl3.js.map} +1 -1
  14. package/dist/chat/pure.d.ts +3 -3
  15. package/dist/chat.d.ts +91 -6
  16. package/dist/chat.d.ts.map +1 -1
  17. package/dist/chat.js +4 -4
  18. package/dist/contexts/daytona.d.ts +1 -1
  19. package/dist/contexts/e2b.d.ts +1 -1
  20. package/dist/eval.d.ts +1 -1
  21. package/dist/eval.js +1 -1
  22. package/dist/extensions.d.ts +1 -1
  23. package/dist/extensions.js +1 -1
  24. package/dist/headless.d.ts +1 -1
  25. package/dist/headless.js +3 -3
  26. package/dist/{index-BYKzzYzi.d.ts → index-ZWibV230.d.ts} +33 -7
  27. package/dist/index-ZWibV230.d.ts.map +1 -0
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +6 -6
  30. package/dist/mcp.d.ts +1 -1
  31. package/dist/{messages-CVVg5jUL.js → messages-CZMUuKzo.js} +2 -2
  32. package/dist/{messages-CVVg5jUL.js.map → messages-CZMUuKzo.js.map} +1 -1
  33. package/dist/{openai-compat-hmZzpDrB.js → openai-compat-BoTi-9fd.js} +8 -3
  34. package/dist/openai-compat-BoTi-9fd.js.map +1 -0
  35. package/dist/output/stream-json.d.ts +1 -1
  36. package/dist/output/terminal.d.ts +1 -1
  37. package/dist/plugins.d.ts +1 -1
  38. package/dist/presets.d.ts +1 -1
  39. package/dist/presets.js +1 -1
  40. package/dist/providers/anthropic.d.ts +1 -1
  41. package/dist/providers/anthropic.js +1 -1
  42. package/dist/providers/arcee.d.ts +1 -1
  43. package/dist/providers/arcee.js +1 -1
  44. package/dist/providers/baseten.d.ts +1 -1
  45. package/dist/providers/baseten.js +1 -1
  46. package/dist/providers/cerebras.d.ts +1 -1
  47. package/dist/providers/cerebras.js +1 -1
  48. package/dist/providers/local.d.ts +1 -1
  49. package/dist/providers/local.js +1 -1
  50. package/dist/providers/openai-compat.d.ts +1 -1
  51. package/dist/providers/openai-compat.js +1 -1
  52. package/dist/providers/openai.d.ts +1 -1
  53. package/dist/providers/openai.js +2 -2
  54. package/dist/providers/openrouter.d.ts +1 -1
  55. package/dist/providers/openrouter.js +1 -1
  56. package/dist/providers/xai.d.ts +1 -1
  57. package/dist/providers/xai.js +1 -1
  58. package/dist/{providers-Cf0AXIIZ.js → providers-CmhdtD7w.js} +2 -2
  59. package/dist/{providers-Cf0AXIIZ.js.map → providers-CmhdtD7w.js.map} +1 -1
  60. package/dist/providers.d.ts +1 -1
  61. package/dist/providers.js +3 -3
  62. package/dist/restate.d.ts +1 -1
  63. package/dist/restate.js +2 -2
  64. package/dist/session/sqlite.d.ts +1 -1
  65. package/dist/{session-cqN5NbO-.js → session-CyRLSsVa.js} +2 -2
  66. package/dist/{session-cqN5NbO-.js.map → session-CyRLSsVa.js.map} +1 -1
  67. package/dist/session.d.ts +1 -1
  68. package/dist/session.js +2 -2
  69. package/dist/skills.d.ts +1 -1
  70. package/dist/{tool-formatters-B5WSHMCU.d.ts → tool-formatters-D3wSS2zz.d.ts} +2 -2
  71. package/dist/{tool-formatters-B5WSHMCU.d.ts.map → tool-formatters-D3wSS2zz.d.ts.map} +1 -1
  72. package/dist/tools/fetch-url.d.ts +1 -1
  73. package/dist/tools/web-search.d.ts +1 -1
  74. package/dist/tools.d.ts +1 -1
  75. package/dist/tools.js +1 -1
  76. package/dist/{transcript-anchors-BvC8t7dt.js → transcript-anchors-D-Yuimif.js} +3 -3
  77. package/dist/{transcript-anchors-BvC8t7dt.js.map → transcript-anchors-D-Yuimif.js.map} +1 -1
  78. package/dist/{transcript-anchors-BPnWHLyr.d.ts → transcript-anchors-llwMrLRG.d.ts} +2 -2
  79. package/dist/{transcript-anchors-BPnWHLyr.d.ts.map → transcript-anchors-llwMrLRG.d.ts.map} +1 -1
  80. package/dist/tui.d.ts +9 -3
  81. package/dist/tui.d.ts.map +1 -1
  82. package/dist/tui.js +232 -13
  83. package/dist/tui.js.map +1 -1
  84. package/dist/{turn-operations-BvP3_HsU.d.ts → turn-operations-C_XvfBU3.d.ts} +3 -3
  85. package/dist/{turn-operations-BvP3_HsU.d.ts.map → turn-operations-C_XvfBU3.d.ts.map} +1 -1
  86. package/dist/types.d.ts +1 -1
  87. package/package.json +1 -1
  88. package/dist/agent-gZjHsUft.js.map +0 -1
  89. package/dist/anthropic-D3le2d-s.js.map +0 -1
  90. package/dist/index-BYKzzYzi.d.ts.map +0 -1
  91. package/dist/openai-compat-hmZzpDrB.js.map +0 -1
@@ -1,13 +1,14 @@
1
- import { A as mergeCatalogEntry, D as listModelOverlay, O as listModels, k as lookupModel } from "./openai-compat-hmZzpDrB.js";
1
+ import { A as mergeCatalogEntry, D as listModelOverlay, O as listModels, k as lookupModel } from "./openai-compat-BoTi-9fd.js";
2
+ import { cn as ALTERNATE_CRED_KEY_SUFFIX, ln as alternateCredKey, un as isReservedCredKey } from "./agent-CcTWL-Z6.js";
2
3
  import { t as writeFileAtomic } from "./atomic-write-B7zr1ddF.js";
3
- import { f as ANTHROPIC_EXTRA_MODELS, n as anthropic, p as FAST_MODE_OPTIONS } from "./anthropic-D3le2d-s.js";
4
+ import { f as ANTHROPIC_EXTRA_MODELS, n as anthropic, p as FAST_MODE_OPTIONS } from "./anthropic-DLc_Kw-1.js";
4
5
  import { d as refreshAnthropicToken, f as refreshOpenAICodexToken, p as registerOAuthProvider } from "./oauth-C4GvY_p1.js";
5
6
  import { arcee } from "./providers/arcee.js";
6
7
  import { baseten } from "./providers/baseten.js";
7
8
  import { cerebras } from "./providers/cerebras.js";
8
9
  import { t as generatePkce } from "./pkce-t8BcPyEi.js";
9
10
  import { n as createCursorOAuthProvider } from "./cursor-iojRXHF9.js";
10
- import { n as zai, r as mistral } from "./providers-Cf0AXIIZ.js";
11
+ import { n as zai, r as mistral } from "./providers-CmhdtD7w.js";
11
12
  import { local } from "./providers/local.js";
12
13
  import { openai } from "./providers/openai.js";
13
14
  import { openrouter } from "./providers/openrouter.js";
@@ -1414,11 +1415,36 @@ function normalizeCredentials(parsed) {
1414
1415
  else result[key] = value;
1415
1416
  return result;
1416
1417
  }
1418
+ /**
1419
+ * Canonical file key for a descriptor, rejecting the reserved alternate suffix.
1420
+ *
1421
+ * Loud on a misconfigured provider instead of quietly mixing its credentials
1422
+ * into another provider's alternate slot (extension registration refuses the
1423
+ * suffix upfront; this covers descriptors passed in directly). Read paths stay
1424
+ * tolerant — only the functions that can WRITE a pair go through here.
1425
+ */
1426
+ function assertableCredKey(descriptor) {
1427
+ const fileKey = credKeyOf(descriptor);
1428
+ if (isReservedCredKey(fileKey)) throw new Error(`Provider "${descriptor.key}" uses credential key "${fileKey}", but the "${ALTERNATE_CRED_KEY_SUFFIX}" suffix is reserved for a provider's second credential slot.`);
1429
+ return fileKey;
1430
+ }
1417
1431
  /** Read a single provider's credential (translating via the descriptor). */
1418
1432
  function readProviderCredential(dataDir, descriptor) {
1419
1433
  return readCredentials(dataDir)[credKeyOf(descriptor)];
1420
1434
  }
1421
1435
  /**
1436
+ * Both stored credentials for a provider: `active` is the one every reader
1437
+ * resolves, `alternate` is the stored-but-not-preferred one (if any).
1438
+ */
1439
+ function readProviderCredentialPair(dataDir, descriptor) {
1440
+ const all = readCredentials(dataDir);
1441
+ const fileKey = credKeyOf(descriptor);
1442
+ return {
1443
+ active: all[fileKey],
1444
+ alternate: all[alternateCredKey(fileKey)]
1445
+ };
1446
+ }
1447
+ /**
1422
1448
  * Write credentials atomically (write-then-rename) with mode 0o600.
1423
1449
  *
1424
1450
  * Atomic on the same filesystem — readers either see the previous file or the
@@ -1431,16 +1457,64 @@ function writeCredentials(dataDir, creds) {
1431
1457
  mode: FILE_MODE
1432
1458
  });
1433
1459
  }
1460
+ /**
1461
+ * Store a credential as the provider's preferred one.
1462
+ *
1463
+ * A credential of the OTHER kind already in the canonical slot is demoted to
1464
+ * {@link alternateCredKey}, not destroyed: authenticating with OAuth used to
1465
+ * silently delete a working API key (and vice versa), leaving the user to
1466
+ * re-enter it. Replacing a credential of the SAME kind is a plain overwrite —
1467
+ * that's a re-auth, not a second source.
1468
+ *
1469
+ * The pair holds AT MOST ONE credential of each kind. A same-kind alternate is
1470
+ * therefore stale — no code path here can produce one, but a file written by an
1471
+ * older build can carry it, and it would surface as two identical source rows
1472
+ * that "switch" between each other. Dropping it on the next write self-heals.
1473
+ */
1434
1474
  function setProviderCredential(dataDir, descriptor, cred) {
1435
1475
  const all = readCredentials(dataDir);
1436
- all[credKeyOf(descriptor)] = cred;
1476
+ const fileKey = assertableCredKey(descriptor);
1477
+ const altKey = alternateCredKey(fileKey);
1478
+ const previous = all[fileKey];
1479
+ if (previous && previous.kind !== cred.kind) all[altKey] = previous;
1480
+ else if (all[altKey]?.kind === cred.kind) delete all[altKey];
1481
+ all[fileKey] = cred;
1437
1482
  writeCredentials(dataDir, all);
1438
1483
  }
1484
+ /**
1485
+ * Make the provider's stored `source` credential the preferred one.
1486
+ *
1487
+ * No-op unless a credential of that kind is sitting in the alternate slot, so
1488
+ * calling it for the already-active source is harmless.
1489
+ */
1490
+ function setPreferredCredential(dataDir, descriptor, source) {
1491
+ const all = readCredentials(dataDir);
1492
+ const fileKey = assertableCredKey(descriptor);
1493
+ const altKey = alternateCredKey(fileKey);
1494
+ const alternate = all[altKey];
1495
+ if (!alternate || alternate.kind !== source) return;
1496
+ const active = all[fileKey];
1497
+ all[fileKey] = alternate;
1498
+ if (active) all[altKey] = active;
1499
+ else delete all[altKey];
1500
+ writeCredentials(dataDir, all);
1501
+ }
1502
+ /**
1503
+ * Sign a provider out — drops BOTH stored credentials.
1504
+ *
1505
+ * "Signed out" has to mean the provider resolves nothing afterwards, which is
1506
+ * what this has always guaranteed and what callers named it for; promoting the
1507
+ * alternate instead would silently leave the provider authenticated through the
1508
+ * other source. Callers that want the fall-back behavior can read the pair
1509
+ * first ({@link readProviderCredentialPair}) and re-store the survivor.
1510
+ */
1439
1511
  function removeProviderCredential(dataDir, descriptor) {
1440
1512
  const all = readCredentials(dataDir);
1441
1513
  const fileKey = credKeyOf(descriptor);
1442
- if (!(fileKey in all)) return;
1514
+ const altKey = alternateCredKey(fileKey);
1515
+ if (!(fileKey in all) && !(altKey in all)) return;
1443
1516
  delete all[fileKey];
1517
+ delete all[altKey];
1444
1518
  writeCredentials(dataDir, all);
1445
1519
  }
1446
1520
  /**
@@ -1474,7 +1548,8 @@ function removeProviderCredential(dataDir, descriptor) {
1474
1548
  * Descriptors without an `envKey` (OAuth-only providers, custom providers
1475
1549
  * that bypass env-var resolution) are skipped silently.
1476
1550
  */
1477
- function applyApiKeyEnv(dataDir, registry) {
1551
+ function applyApiKeyEnv(dataDir, registry, opts = {}) {
1552
+ const log = opts.log ?? ((message) => void process.stderr.write(message));
1478
1553
  const creds = readCredentials(dataDir);
1479
1554
  for (const descriptor of Object.values(registry)) {
1480
1555
  const cred = creds[credKeyOf(descriptor)];
@@ -1484,7 +1559,7 @@ function applyApiKeyEnv(dataDir, registry) {
1484
1559
  const value = stored[field.key];
1485
1560
  if (typeof value === "string" && value.length > 0) {
1486
1561
  const ambient = process.env[field.envVar];
1487
- if (ambient && ambient !== value && process.env.ZIDANE_DEBUG) process.stderr.write(`[zidane/chat] applyApiKeyEnv: overriding ambient \`${field.envVar}\` with stored value from credentials.json (provider=${descriptor.key}, field=${field.key}).\n`);
1562
+ if (ambient && ambient !== value && process.env.ZIDANE_DEBUG) log(`[zidane/chat] applyApiKeyEnv: overriding ambient \`${field.envVar}\` with stored value from credentials.json (provider=${descriptor.key}, field=${field.key}).\n`);
1488
1563
  process.env[field.envVar] = value;
1489
1564
  }
1490
1565
  }
@@ -1493,12 +1568,12 @@ function applyApiKeyEnv(dataDir, registry) {
1493
1568
  const envKey = descriptor.envKey;
1494
1569
  const ambient = process.env[envKey];
1495
1570
  if (cred?.kind === "apikey" && cred.value) {
1496
- if (ambient && ambient !== cred.value && process.env.ZIDANE_DEBUG) process.stderr.write(`[zidane/chat] applyApiKeyEnv: overriding ambient \`${envKey}\` with stored API key from credentials.json (provider=${descriptor.key}). Sign out via the auth wizard if the ambient value was intended to win.\n`);
1571
+ if (ambient && ambient !== cred.value && process.env.ZIDANE_DEBUG) log(`[zidane/chat] applyApiKeyEnv: overriding ambient \`${envKey}\` with stored API key from credentials.json (provider=${descriptor.key}). Sign out via the auth wizard if the ambient value was intended to win.\n`);
1497
1572
  process.env[envKey] = cred.value;
1498
1573
  continue;
1499
1574
  }
1500
1575
  if (cred?.kind === "oauth" && cred.access) {
1501
- if (ambient !== void 0 && process.env.ZIDANE_DEBUG) process.stderr.write(`[zidane/chat] applyApiKeyEnv: clearing ambient \`${envKey}\` because credentials.json has stored OAuth for ${descriptor.key} — refresh path needs the file.\n`);
1576
+ if (ambient !== void 0 && process.env.ZIDANE_DEBUG) log(`[zidane/chat] applyApiKeyEnv: clearing ambient \`${envKey}\` because credentials.json has stored OAuth for ${descriptor.key} — refresh path needs the file.\n`);
1502
1577
  delete process.env[envKey];
1503
1578
  continue;
1504
1579
  }
@@ -1570,13 +1645,17 @@ function isOAuthLegacy(value) {
1570
1645
  /**
1571
1646
  * Detect available auth for every registered provider.
1572
1647
  *
1573
- * Resolution order per provider (a method appears in `methods` for each
1574
- * layer that has a credential — the agent itself resolves them in the same
1575
- * order via its provider factories):
1648
+ * A method appears in `methods` for every layer that has a credential:
1576
1649
  *
1577
- * 1. `kind: 'apikey'` from `credentials.json` (injected into env at TUI launch)
1578
- * 2. explicit env var (descriptor's `envKey`)
1579
- * 3. `kind: 'oauth'` from `credentials.json` (or legacy `cwd/.credentials.json`)
1650
+ * - `kind: 'apikey'` from `credentials.json` (injected into env at TUI launch)
1651
+ * - explicit env var (descriptor's `envKey`)
1652
+ * - `kind: 'oauth'` from `credentials.json` (or legacy `cwd/.credentials.json`)
1653
+ *
1654
+ * A provider may store one of EACH kind. The preferred one lives in the
1655
+ * canonical file key and is flagged {@link AuthMethod.active}; the other sits
1656
+ * in `alternateCredKey` and is reported too, so the UI can offer to promote it.
1657
+ * Order within `methods` is presentational — it is no longer a resolution
1658
+ * order, because the active flag answers that directly.
1580
1659
  *
1581
1660
  * Pure read — never refreshes or rewrites the credentials file.
1582
1661
  */
@@ -1584,45 +1663,58 @@ function detectAuth(dataDir, registry, env = process.env) {
1584
1663
  const creds = readCredentials(dataDir);
1585
1664
  return Object.values(registry).map((descriptor) => {
1586
1665
  const methods = [];
1587
- const fileEntry = creds[credKeyOf(descriptor)];
1588
- if (fileEntry?.kind === "apikey" && fileEntry.value) methods.push({
1589
- source: "apikey",
1590
- detail: "credentials.json"
1591
- });
1666
+ const fileKey = credKeyOf(descriptor);
1667
+ const fileEntry = creds[fileKey];
1668
+ const altEntry = creds[alternateCredKey(fileKey)];
1669
+ const describeStored = (entry, active) => {
1670
+ if (entry?.kind === "apikey" && entry.value) return {
1671
+ source: "apikey",
1672
+ detail: "credentials.json",
1673
+ active
1674
+ };
1675
+ if (entry?.kind === "oauth" && entry.access) return {
1676
+ source: "oauth",
1677
+ detail: typeof entry.expires === "number" ? `oauth · expires ${new Date(entry.expires).toLocaleString()}` : "oauth · credentials.json",
1678
+ active
1679
+ };
1680
+ };
1681
+ const activeMethod = describeStored(fileEntry, true);
1682
+ if (activeMethod) methods.push(activeMethod);
1592
1683
  if (fileEntry?.kind === "apikey" && !fileEntry.value && descriptor.customFields && descriptor.customFields.length > 0) {
1593
1684
  const stored = fileEntry.customFields ?? {};
1594
1685
  if (descriptor.customFields.filter((f) => f.required).every((f) => typeof stored[f.key] === "string" && stored[f.key].length > 0)) methods.push({
1595
1686
  source: "apikey",
1596
- detail: "credentials.json (configured)"
1687
+ detail: "credentials.json (configured)",
1688
+ active: true
1597
1689
  });
1598
1690
  }
1599
1691
  if (descriptor.customFields && descriptor.customFields.length > 0) {
1600
1692
  const required = descriptor.customFields.filter((f) => f.required);
1601
1693
  if (required.length > 0 && required.every((f) => typeof env[f.envVar] === "string" && env[f.envVar].length > 0)) methods.push({
1602
1694
  source: "env",
1603
- detail: required.map((f) => f.envVar).join(", ")
1695
+ detail: required.map((f) => f.envVar).join(", "),
1696
+ active: false
1604
1697
  });
1605
1698
  }
1699
+ const alternateMethod = describeStored(altEntry, false);
1700
+ if (alternateMethod) methods.push(alternateMethod);
1606
1701
  if (descriptor.envKey && env[descriptor.envKey]) methods.push({
1607
1702
  source: "env",
1608
- detail: descriptor.envKey
1703
+ detail: descriptor.envKey,
1704
+ active: false
1609
1705
  });
1610
- if (fileEntry?.kind === "oauth" && fileEntry.access) {
1611
- const detail = typeof fileEntry.expires === "number" ? `oauth · expires ${new Date(fileEntry.expires).toLocaleString()}` : "oauth · credentials.json";
1612
- methods.push({
1613
- source: "oauth",
1614
- detail
1615
- });
1616
- }
1706
+ const unique = [];
1707
+ for (const method of methods) if (!unique.some((seen) => seen.source === method.source)) unique.push(method);
1617
1708
  return {
1618
1709
  key: descriptor.key,
1619
1710
  label: descriptor.label,
1620
- available: methods.length > 0,
1621
- methods
1711
+ available: unique.length > 0,
1712
+ methods: unique,
1713
+ ...descriptor.envKey ? { envKey: descriptor.envKey } : {}
1622
1714
  };
1623
1715
  });
1624
1716
  }
1625
1717
  //#endregion
1626
- export { restoreModelOptions as C, piIdOf as S, modelOptionsFor as _, readProviderCredential as a, openaiDescriptor as b, writeCredentials as c, cerebrasDescriptor as d, credKeyOf as f, localDescriptor as g, getModelInfo as h, readCredentials as i, BUILTIN_PROVIDERS as l, getContextWindow as m, applyApiKeyEnv as n, removeProviderCredential as o, enabledModelOptions as p, credentialsPath as r, setProviderCredential as s, detectAuth as t, anthropicDescriptor as u, modelSupportsReasoning as v, renderDefaultCallbackPage as w, openrouterDescriptor as x, modelsForDescriptor as y };
1718
+ export { openrouterDescriptor as C, renderDefaultCallbackPage as E, openaiDescriptor as S, restoreModelOptions as T, getModelInfo as _, readProviderCredential as a, modelSupportsReasoning as b, setPreferredCredential as c, BUILTIN_PROVIDERS as d, anthropicDescriptor as f, getContextWindow as g, enabledModelOptions as h, readCredentials as i, setProviderCredential as l, credKeyOf as m, applyApiKeyEnv as n, readProviderCredentialPair as o, cerebrasDescriptor as p, credentialsPath as r, removeProviderCredential as s, detectAuth as t, writeCredentials as u, localDescriptor as v, piIdOf as w, modelsForDescriptor as x, modelOptionsFor as y };
1627
1719
 
1628
- //# sourceMappingURL=auth-DCiXCwGa.js.map
1720
+ //# sourceMappingURL=auth-BAclQnl3.js.map