zidane 7.0.20 → 7.0.22

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 (78) hide show
  1. package/dist/acp-cli.js +2 -2
  2. package/dist/acp.d.ts +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/{anthropic-DATE-m9f.js → anthropic-BSbDiW0J.js} +34 -4
  5. package/dist/anthropic-BSbDiW0J.js.map +1 -0
  6. package/dist/{approvals-CzrFKdu-.js → approvals-BnDsgTtD.js} +2 -2
  7. package/dist/{approvals-CzrFKdu-.js.map → approvals-BnDsgTtD.js.map} +1 -1
  8. package/dist/{auth-DD4KYv1w.js → auth-Nq-tSMb9.js} +52 -34
  9. package/dist/{auth-DD4KYv1w.js.map → auth-Nq-tSMb9.js.map} +1 -1
  10. package/dist/chat/pure.d.ts +3 -3
  11. package/dist/chat.d.ts +5 -5
  12. package/dist/chat.js +2 -2
  13. package/dist/contexts/daytona.d.ts +1 -1
  14. package/dist/contexts/e2b.d.ts +1 -1
  15. package/dist/daemon-cli.js +1 -1
  16. package/dist/eval.d.ts +1 -1
  17. package/dist/extensions.d.ts +1 -1
  18. package/dist/headless.d.ts +1 -1
  19. package/dist/{index-CvGkUoNk.d.ts → index-C4mY0oKE.d.ts} +3 -21
  20. package/dist/index-C4mY0oKE.d.ts.map +1 -0
  21. package/dist/{index-CGjexO2a.d.ts → index-D2JCY11Z.d.ts} +5 -5
  22. package/dist/index-D2JCY11Z.d.ts.map +1 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +3 -3
  25. package/dist/{ipc-gce-02nV.js → ipc-Oro3uyMP.js} +2 -2
  26. package/dist/{ipc-gce-02nV.js.map → ipc-Oro3uyMP.js.map} +1 -1
  27. package/dist/ipc.d.ts +5 -5
  28. package/dist/ipc.d.ts.map +1 -1
  29. package/dist/ipc.js +3 -3
  30. package/dist/mcp.d.ts +1 -1
  31. package/dist/{oauth-D-LZ4ic-.js → oauth-CmtlmCzi.js} +142 -210
  32. package/dist/oauth-CmtlmCzi.js.map +1 -0
  33. package/dist/output/stream-json.d.ts +1 -1
  34. package/dist/output/terminal.d.ts +1 -1
  35. package/dist/plugins.d.ts +1 -1
  36. package/dist/presets.d.ts +1 -1
  37. package/dist/providers/anthropic.d.ts +1 -1
  38. package/dist/providers/anthropic.js +1 -1
  39. package/dist/providers/arcee.d.ts +1 -1
  40. package/dist/providers/baseten.d.ts +1 -1
  41. package/dist/providers/cerebras.d.ts +1 -1
  42. package/dist/providers/local.d.ts +1 -1
  43. package/dist/providers/openai-compat.d.ts +1 -1
  44. package/dist/providers/openai.d.ts +1 -1
  45. package/dist/providers/openai.js +1 -1
  46. package/dist/providers/openrouter.d.ts +1 -1
  47. package/dist/providers/xai.d.ts +1 -1
  48. package/dist/providers/xai.js +1 -1
  49. package/dist/{providers-Bjdvmpfu.js → providers-ZucqgwU7.js} +2 -2
  50. package/dist/{providers-Bjdvmpfu.js.map → providers-ZucqgwU7.js.map} +1 -1
  51. package/dist/providers.d.ts +1 -1
  52. package/dist/providers.js +3 -3
  53. package/dist/restate.d.ts +1 -1
  54. package/dist/{server-C3FOQvIu.js → server-HZdjqDpS.js} +18 -5
  55. package/dist/server-HZdjqDpS.js.map +1 -0
  56. package/dist/session/sqlite.d.ts +1 -1
  57. package/dist/session.d.ts +1 -1
  58. package/dist/skills.d.ts +1 -1
  59. package/dist/{tool-formatters-BTNnkola.d.ts → tool-formatters-GZHxP824.d.ts} +2 -2
  60. package/dist/{tool-formatters-BTNnkola.d.ts.map → tool-formatters-GZHxP824.d.ts.map} +1 -1
  61. package/dist/tools/fetch-url.d.ts +1 -1
  62. package/dist/tools/web-search.d.ts +1 -1
  63. package/dist/tools.d.ts +1 -1
  64. package/dist/{transcript-anchors-DzY3KZ54.d.ts → transcript-anchors-CY50AXdF.d.ts} +2 -2
  65. package/dist/{transcript-anchors-DzY3KZ54.d.ts.map → transcript-anchors-CY50AXdF.d.ts.map} +1 -1
  66. package/dist/tui.d.ts +3 -3
  67. package/dist/tui.js +3 -3
  68. package/dist/{turn-operations-DRED3NeH.d.ts → turn-operations-CAmNETlu.d.ts} +3 -3
  69. package/dist/{turn-operations-DRED3NeH.d.ts.map → turn-operations-CAmNETlu.d.ts.map} +1 -1
  70. package/dist/types.d.ts +1 -1
  71. package/docs/CHAT.md +8 -0
  72. package/docs/IPC.md +4 -2
  73. package/package.json +1 -1
  74. package/dist/anthropic-DATE-m9f.js.map +0 -1
  75. package/dist/index-CGjexO2a.d.ts.map +0 -1
  76. package/dist/index-CvGkUoNk.d.ts.map +0 -1
  77. package/dist/oauth-D-LZ4ic-.js.map +0 -1
  78. package/dist/server-C3FOQvIu.js.map +0 -1
@@ -1,14 +1,14 @@
1
1
  import { A as mergeCatalogEntry, D as listModelOverlay, O as listModels, k as lookupModel } from "./openai-compat-cIeLSED_.js";
2
2
  import { fn as ALTERNATE_CRED_KEY_SUFFIX, mn as isReservedCredKey, pn as alternateCredKey } from "./agent-LC2c1ue-.js";
3
3
  import { t as writeFileAtomic } from "./atomic-write-B7zr1ddF.js";
4
- import { m as FAST_MODE_OPTIONS, n as anthropic, p as ANTHROPIC_EXTRA_MODELS } from "./anthropic-DATE-m9f.js";
5
- import { f as refreshAnthropicToken, m as registerOAuthProvider, p as refreshOpenAICodexToken } from "./oauth-D-LZ4ic-.js";
4
+ import { m as FAST_MODE_OPTIONS, n as anthropic, p as ANTHROPIC_EXTRA_MODELS } from "./anthropic-BSbDiW0J.js";
5
+ import { c as withCredentialsLock, h as registerOAuthProvider, m as refreshOpenAICodexToken, p as refreshAnthropicToken } from "./oauth-CmtlmCzi.js";
6
6
  import { arcee } from "./providers/arcee.js";
7
7
  import { baseten } from "./providers/baseten.js";
8
8
  import { cerebras } from "./providers/cerebras.js";
9
9
  import { t as generatePkce } from "./pkce-t8BcPyEi.js";
10
10
  import { n as createCursorOAuthProvider } from "./cursor-iojRXHF9.js";
11
- import { n as zai, r as mistral } from "./providers-Bjdvmpfu.js";
11
+ import { n as zai, r as mistral } from "./providers-ZucqgwU7.js";
12
12
  import { local } from "./providers/local.js";
13
13
  import { openai } from "./providers/openai.js";
14
14
  import { openrouter } from "./providers/openrouter.js";
@@ -1404,6 +1404,9 @@ function readCredentials(dataDir) {
1404
1404
  if (migrated) return migrated;
1405
1405
  return {};
1406
1406
  }
1407
+ return readStoredCredentials(path);
1408
+ }
1409
+ function readStoredCredentials(path) {
1407
1410
  try {
1408
1411
  const raw = readFileSync(path, "utf-8");
1409
1412
  const parsed = JSON.parse(raw);
@@ -1470,6 +1473,9 @@ function readProviderCredentialPair(dataDir, descriptor) {
1470
1473
  * (first launch on a fresh machine: `~/.zidane/` may not exist yet).
1471
1474
  */
1472
1475
  function writeCredentials(dataDir, creds) {
1476
+ withCredentialsLock(credentialsPath(dataDir), () => writeCredentialsUnlocked(dataDir, creds));
1477
+ }
1478
+ function writeCredentialsUnlocked(dataDir, creds) {
1473
1479
  writeFileAtomic(credentialsPath(dataDir), `${JSON.stringify(creds, null, 2)}\n`, {
1474
1480
  ensureDir: true,
1475
1481
  mode: FILE_MODE
@@ -1490,14 +1496,17 @@ function writeCredentials(dataDir, creds) {
1490
1496
  * that "switch" between each other. Dropping it on the next write self-heals.
1491
1497
  */
1492
1498
  function setProviderCredential(dataDir, descriptor, cred) {
1493
- const all = readCredentials(dataDir);
1494
- const fileKey = assertableCredKey(descriptor);
1495
- const altKey = alternateCredKey(fileKey);
1496
- const previous = all[fileKey];
1497
- if (previous && previous.kind !== cred.kind) all[altKey] = previous;
1498
- else if (all[altKey]?.kind === cred.kind) delete all[altKey];
1499
- all[fileKey] = cred;
1500
- writeCredentials(dataDir, all);
1499
+ readCredentials(dataDir);
1500
+ return withCredentialsLock(credentialsPath(dataDir), () => {
1501
+ const all = readStoredCredentials(credentialsPath(dataDir));
1502
+ const fileKey = assertableCredKey(descriptor);
1503
+ const altKey = alternateCredKey(fileKey);
1504
+ const previous = all[fileKey];
1505
+ if (previous && previous.kind !== cred.kind) all[altKey] = previous;
1506
+ else if (all[altKey]?.kind === cred.kind) delete all[altKey];
1507
+ all[fileKey] = cred;
1508
+ writeCredentialsUnlocked(dataDir, all);
1509
+ });
1501
1510
  }
1502
1511
  /**
1503
1512
  * Make the provider's stored `source` credential the preferred one.
@@ -1509,17 +1518,20 @@ function setProviderCredential(dataDir, descriptor, cred) {
1509
1518
  * any caller that trusted it instead of refetching.
1510
1519
  */
1511
1520
  function setPreferredCredential(dataDir, descriptor, source) {
1512
- const all = readCredentials(dataDir);
1513
- const fileKey = assertableCredKey(descriptor);
1514
- const altKey = alternateCredKey(fileKey);
1515
- const alternate = all[altKey];
1516
- if (!alternate || alternate.kind !== source) return all[fileKey]?.kind === source ? "already-active" : "not-stored";
1517
- const active = all[fileKey];
1518
- all[fileKey] = alternate;
1519
- if (active) all[altKey] = active;
1520
- else delete all[altKey];
1521
- writeCredentials(dataDir, all);
1522
- return "promoted";
1521
+ readCredentials(dataDir);
1522
+ return withCredentialsLock(credentialsPath(dataDir), () => {
1523
+ const all = readStoredCredentials(credentialsPath(dataDir));
1524
+ const fileKey = assertableCredKey(descriptor);
1525
+ const altKey = alternateCredKey(fileKey);
1526
+ const alternate = all[altKey];
1527
+ if (!alternate || alternate.kind !== source) return all[fileKey]?.kind === source ? "already-active" : "not-stored";
1528
+ const active = all[fileKey];
1529
+ all[fileKey] = alternate;
1530
+ if (active) all[altKey] = active;
1531
+ else delete all[altKey];
1532
+ writeCredentialsUnlocked(dataDir, all);
1533
+ return "promoted";
1534
+ });
1523
1535
  }
1524
1536
  /**
1525
1537
  * Sign a provider out — drops BOTH stored credentials.
@@ -1531,13 +1543,16 @@ function setPreferredCredential(dataDir, descriptor, source) {
1531
1543
  * first ({@link readProviderCredentialPair}) and re-store the survivor.
1532
1544
  */
1533
1545
  function removeProviderCredential(dataDir, descriptor) {
1534
- const all = readCredentials(dataDir);
1535
- const fileKey = credKeyOf(descriptor);
1536
- const altKey = alternateCredKey(fileKey);
1537
- if (!(fileKey in all) && !(altKey in all)) return;
1538
- delete all[fileKey];
1539
- delete all[altKey];
1540
- writeCredentials(dataDir, all);
1546
+ readCredentials(dataDir);
1547
+ return withCredentialsLock(credentialsPath(dataDir), () => {
1548
+ const all = readStoredCredentials(credentialsPath(dataDir));
1549
+ const fileKey = credKeyOf(descriptor);
1550
+ const altKey = alternateCredKey(fileKey);
1551
+ if (!(fileKey in all) && !(altKey in all)) return;
1552
+ delete all[fileKey];
1553
+ delete all[altKey];
1554
+ writeCredentialsUnlocked(dataDir, all);
1555
+ });
1541
1556
  }
1542
1557
  /**
1543
1558
  * Reconcile `process.env` with the stored credentials so the harness providers
@@ -1653,11 +1668,14 @@ function migrateLegacyFile(targetPath) {
1653
1668
  };
1654
1669
  }
1655
1670
  if (Object.keys(migrated).length === 0) return null;
1656
- writeFileAtomic(targetPath, `${JSON.stringify(migrated, null, 2)}\n`, {
1657
- ensureDir: true,
1658
- mode: FILE_MODE
1671
+ return withCredentialsLock(targetPath, () => {
1672
+ if (existsSync(targetPath)) return readStoredCredentials(targetPath);
1673
+ writeFileAtomic(targetPath, `${JSON.stringify(migrated, null, 2)}\n`, {
1674
+ ensureDir: true,
1675
+ mode: FILE_MODE
1676
+ });
1677
+ return migrated;
1659
1678
  });
1660
- return migrated;
1661
1679
  }
1662
1680
  function isOAuthLegacy(value) {
1663
1681
  return typeof value === "object" && value !== null && "access" in value && typeof value.access === "string";
@@ -1739,4 +1757,4 @@ function detectAuth(dataDir, registry, env = process.env) {
1739
1757
  //#endregion
1740
1758
  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 };
1741
1759
 
1742
- //# sourceMappingURL=auth-DD4KYv1w.js.map
1760
+ //# sourceMappingURL=auth-Nq-tSMb9.js.map