@cortexkit/opencode-openai-auth 1.8.6 → 1.9.1

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 (46) hide show
  1. package/dist/bin.js +2 -2
  2. package/dist/{index-byz2j6hz.js → index-2f9w48sc.js} +1 -1
  3. package/dist/{index-zah8t2d2.js → index-5sgqz46z.js} +2 -2
  4. package/dist/{index-jh90fx7y.js → index-6j3059fy.js} +2 -2
  5. package/dist/index-6r27fz5a.js +91 -0
  6. package/dist/{index-kphzmgq6.js → index-96971sba.js} +1 -1
  7. package/dist/{index-pnvp8hvs.js → index-b79fxcrc.js} +1 -1
  8. package/dist/{index-5wgxt362.js → index-bvswyxpt.js} +1 -1
  9. package/dist/index-fqt90tbq.js +76 -0
  10. package/dist/{index-95s2mw9w.js → index-hpb6k6st.js} +2 -2
  11. package/dist/{index-25p8t63g.js → index-hyjrm2vw.js} +2 -2
  12. package/dist/{index-zf649dj2.js → index-k1dfzavn.js} +2 -2
  13. package/dist/index-mtf8pv2w.js +8 -0
  14. package/dist/index-mw7fqra8.js +63 -0
  15. package/dist/index.js +1 -1
  16. package/dist/rpc/port-file.js +1 -1
  17. package/dist/rpc/protocol.js +1 -1
  18. package/dist/rpc/rpc-client.js +1 -1
  19. package/dist/rpc/rpc-dir.js +1 -1
  20. package/dist/sidebar-state.js +1 -1
  21. package/dist/token-util-ybe08zph.js +1 -0
  22. package/dist/{token-j2jmx8k7.js → token-y2zkdr5m.js} +1 -1
  23. package/dist/tui-preferences.js +1 -1
  24. package/dist/v2/server.js +2 -2
  25. package/package.json +2 -2
  26. package/src/tui-compiled/raw/shared/0332701351b3eeec-format.js +45 -26
  27. package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +25 -0
  28. package/src/tui-compiled/raw/shared/352d228be2832bd4-hub.js +20 -1
  29. package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +37 -10
  30. package/src/tui-compiled/raw/shared/549daf371622c304-index.tsx +288 -131
  31. package/src/tui-compiled/raw/shared/7c97ac0cec074ae7-format.js +30 -17
  32. package/src/tui-compiled/raw/shared/d0f0b6be200311af-insula.js +6 -0
  33. package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +2 -2
  34. package/src/tui-compiled/runtime/shared/0332701351b3eeec-format.js +45 -26
  35. package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +25 -0
  36. package/src/tui-compiled/runtime/shared/352d228be2832bd4-hub.js +20 -1
  37. package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +37 -10
  38. package/src/tui-compiled/runtime/shared/549daf371622c304-index.js +358 -225
  39. package/src/tui-compiled/runtime/shared/7c97ac0cec074ae7-format.js +30 -17
  40. package/src/tui-compiled/runtime/shared/d0f0b6be200311af-insula.js +6 -0
  41. package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +2 -2
  42. package/dist/index-a8wbqm6a.js +0 -74
  43. package/dist/index-n12zjwh9.js +0 -8
  44. package/dist/index-v6jcz0hz.js +0 -63
  45. package/dist/index-zne9tzy9.js +0 -91
  46. package/dist/token-util-7n2nfbyc.js +0 -1
@@ -55,7 +55,7 @@ function displayOrder(left, right) {
55
55
  return left.label < right.label ? -1 : left.label > right.label ? 1 : 0;
56
56
  }
57
57
  export function quotaWindowParts(quota, options) {
58
- const { windows, age } = scopedWindowParts(quota, options), parts = windows.map(({ part }) => part);
58
+ const { windows, age } = scopedWindowParts(quota, options, !0), parts = windows.map(({ part }) => part);
59
59
  return age === void 0 ? { windows: parts } : { windows: parts, age };
60
60
  }
61
61
  function withShortNames(windows) {
@@ -64,23 +64,34 @@ function withShortNames(windows) {
64
64
  window.part.short = window.part.kind === "budget" ? "cr" : window.scope === ALL_SCOPE ? window.part.name : abbreviations.get(window.scope) ?? window.scope;
65
65
  return windows;
66
66
  }
67
- function scopedWindowParts(quota, options) {
67
+ function hasWindowReading(limit) {
68
+ return Number.isFinite(limit.remainingPercent) && Number.isFinite(limit.checkedAt);
69
+ }
70
+ function scopedWindowParts(quota, options, includeUnknown = !1) {
68
71
  if (!quota)
69
72
  return { windows: [] };
70
- const { now } = options, windows = quota.limits.filter((limit) => limit.kind === "reading" && limit.remainingPercent !== void 0).sort(displayOrder).map((limit) => {
71
- const remainingPercent = clampPercent(limit.remainingPercent ?? 0);
73
+ const { now } = options, windows = quota.limits.filter((limit) => limit.kind === "reading" && (includeUnknown || hasWindowReading(limit))).sort(displayOrder).map((limit) => {
74
+ const part = hasWindowReading(limit) ? {
75
+ kind: "window",
76
+ reading: "known",
77
+ name: quotaWindowName(limit),
78
+ short: "",
79
+ figure: percentLeft(limit.remainingPercent),
80
+ remainingPercent: clampPercent(limit.remainingPercent),
81
+ checkedAt: limit.checkedAt,
82
+ ...resetDetails(limit.resetsAt, limit.checkedAt, now)
83
+ } : {
84
+ kind: "window",
85
+ reading: "unknown",
86
+ name: quotaWindowName(limit),
87
+ short: "",
88
+ figure: "no reading",
89
+ resetSinceReading: !1
90
+ };
72
91
  return {
73
92
  scope: limit.scope,
74
93
  ...limit.windowMinutes === void 0 ? {} : { windowMinutes: limit.windowMinutes },
75
- part: {
76
- kind: "window",
77
- name: quotaWindowName(limit),
78
- short: "",
79
- figure: percentLeft(limit.remainingPercent ?? 0),
80
- remainingPercent,
81
- checkedAt: limit.checkedAt,
82
- ...resetDetails(limit.resetsAt, limit.checkedAt, now)
83
- }
94
+ part
84
95
  };
85
96
  }), budget = quota.budget;
86
97
  if (budget) {
@@ -90,6 +101,7 @@ function scopedWindowParts(quota, options) {
90
101
  spent: budget.reached,
91
102
  part: {
92
103
  kind: "budget",
104
+ reading: "known",
93
105
  name: "credits",
94
106
  short: "",
95
107
  figure,
@@ -100,8 +112,9 @@ function scopedWindowParts(quota, options) {
100
112
  });
101
113
  }
102
114
  withShortNames(windows);
103
- if (windows.length > 0) {
104
- const age = now - Math.min(...windows.map(({ part }) => part.checkedAt));
115
+ const readingTimes = windows.flatMap(({ part }) => part.reading === "known" && part.checkedAt !== void 0 ? [part.checkedAt] : []);
116
+ if (readingTimes.length > 0) {
117
+ const age = now - Math.min(...readingTimes);
105
118
  if (age > (options.staleAfterMs ?? QUOTA_STALE_AFTER_MS))
106
119
  return { windows, age: `checked ${shortSpan(age)} ago` };
107
120
  }
@@ -184,11 +197,11 @@ function narrowTextParts(quota, options) {
184
197
  export function quotaTextParts(quota, options) {
185
198
  if (options.form === "narrow")
186
199
  return narrowTextParts(quota, options);
187
- const parts = quotaWindowParts(quota, options), full = (options.form ?? "full") === "full", text = parts.windows.map((part) => {
200
+ const { windows, age } = scopedWindowParts(quota, options), full = (options.form ?? "full") === "full", text = windows.map(({ part }) => {
188
201
  const reset = full && part.resetIn ? `, resets ${part.resetIn}` : "";
189
202
  return `${part.kind === "budget" ? "" : `${part.name} `}${part.figure}${reset}`;
190
203
  });
191
- return parts.age === void 0 ? text : [...text, parts.age];
204
+ return age === void 0 ? text : [...text, age];
192
205
  }
193
206
  export function formatQuota(quota, options) {
194
207
  const parts = quotaTextParts(quota, options);
@@ -443,6 +443,12 @@ export class InsulaQuotaSource {
443
443
  ...(typeof entry.source === 'string' && { source: entry.source }),
444
444
  },
445
445
  };
446
+ // Kept usage must not trigger a provider poll after a non-local failure.
447
+ // Only an explicitly local failure permits fallback; unknown causes do not.
448
+ if (entry.stale !== undefined &&
449
+ (!record(entry.stale) ||
450
+ entry.stale.class !== 'local_source_unavailable'))
451
+ return { miss: 'upstream-failed', reading };
446
452
  return now >= fetchedAt + MAX_AGE || entry.stale !== undefined
447
453
  ? { miss: 'stale', reading }
448
454
  : { reading };
@@ -244,8 +244,8 @@ export async function acquireRefreshFileLockWithClock(options) {
244
244
  }
245
245
  catch (readError) {
246
246
  // The holder can release after exclusive creation reports a collision.
247
- // Only absence permits another acquisition attempt; security and sharing
248
- // refusals must still escape rather than being treated as contention.
247
+ // Only absence permits acquisition to continue here. Sharing failures
248
+ // escape to withLock's deadline-bounded retry, never to stale eviction.
249
249
  if (readError.code !== 'ENOENT')
250
250
  throw readError;
251
251
  }