@cortexkit/opencode-openai-auth 1.1.0 → 1.2.0

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 (55) hide show
  1. package/dist/bin.js +8 -8
  2. package/dist/{codex-request-BXDXToyt.d.ts → codex-request-CjXETpTA.d.ts} +56 -24
  3. package/dist/index-03em8hv1.js +69 -0
  4. package/dist/index-6n4pnfkg.js +2 -0
  5. package/dist/{index-f2fmb596.js → index-bc89akak.js} +1 -1
  6. package/dist/{index-7c6sxtd6.js → index-ehjj89rx.js} +2 -2
  7. package/dist/index-f21addzm.js +90 -0
  8. package/dist/{index-k6cydkgt.js → index-ffg0sgg5.js} +2 -2
  9. package/dist/{index-zpm95mt5.js → index-ftkhhr6d.js} +1 -1
  10. package/dist/{index-4c8yw54k.js → index-htvcmtcx.js} +2 -2
  11. package/dist/{index-j8v2xwq6.js → index-qp5hdpw8.js} +1 -1
  12. package/dist/{index-msx2m78k.js → index-qxbchh2d.js} +2 -2
  13. package/dist/{index-m5qmvr6c.js → index-r2s51ac1.js} +2 -2
  14. package/dist/index-rwbrhkse.js +65 -0
  15. package/dist/{index-csky2xpg.js → index-xwvze96g.js} +1 -1
  16. package/dist/index.d.ts +5 -3
  17. package/dist/index.js +1 -1
  18. package/dist/{model-YRg7Uowo.d.ts → model-CQcw10oW.d.ts} +1 -1
  19. package/dist/{port-file-CxEpgSHY.d.ts → port-file-BDJnzgHH.d.ts} +1 -1
  20. package/dist/{protocol-CDV1Pc6h.d.ts → protocol-C-kagE6O.d.ts} +1 -1
  21. package/dist/rpc/port-file.d.ts +1 -1
  22. package/dist/rpc/port-file.js +1 -1
  23. package/dist/rpc/protocol.d.ts +1 -1
  24. package/dist/rpc/protocol.js +1 -1
  25. package/dist/rpc/rpc-client.d.ts +3 -3
  26. package/dist/rpc/rpc-client.js +1 -1
  27. package/dist/rpc/rpc-dir.js +1 -1
  28. package/dist/{sidebar-state-DjTWUbmf.d.ts → sidebar-state-BfQ4mpZO.d.ts} +98 -5
  29. package/dist/sidebar-state.d.ts +2 -2
  30. package/dist/sidebar-state.js +1 -1
  31. package/dist/token-util-cf0nyh7n.js +1 -0
  32. package/dist/{token-rz4t3ay6.js → token-z6qq7a1d.js} +1 -1
  33. package/dist/tui-preferences.js +1 -1
  34. package/dist/tui.d.ts +2 -2
  35. package/dist/v2/server.d.ts +109 -2
  36. package/dist/v2/server.js +3 -3
  37. package/package.json +3 -3
  38. package/src/tui-compiled/raw/shared/0332701351b3eeec-format.js +135 -18
  39. package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +17 -0
  40. package/src/tui-compiled/raw/shared/169b2b4bf30909bc-consumer.js +38 -1
  41. package/src/tui-compiled/raw/shared/d5a8f1061ee2f114-index.js +1 -1
  42. package/src/tui-compiled/raw/sidebar-state.js +63 -1
  43. package/src/tui-compiled/raw/tui.tsx +82 -30
  44. package/src/tui-compiled/runtime/shared/0332701351b3eeec-format.js +135 -18
  45. package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +17 -0
  46. package/src/tui-compiled/runtime/shared/169b2b4bf30909bc-consumer.js +38 -1
  47. package/src/tui-compiled/runtime/shared/d5a8f1061ee2f114-index.js +1 -1
  48. package/src/tui-compiled/runtime/sidebar-state.js +63 -1
  49. package/src/tui-compiled/runtime/tui.js +245 -208
  50. package/dist/index-0yh85bwb.js +0 -69
  51. package/dist/index-7eb3dw37.js +0 -90
  52. package/dist/index-8re8rprk.js +0 -2
  53. package/dist/index-edbdscy7.js +0 -65
  54. package/dist/map-Buq-GW7l.d.ts +0 -56
  55. package/dist/token-util-tpy2c7h6.js +0 -1
@@ -1,2 +1,2 @@
1
1
  import{createRequire as n}from"node:module";var k=Object.defineProperty;var q=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b)=>b;function m(b,a){this[b]=l.bind(null,a)}var r=(b,a)=>{for(var c in a)k(b,c,{get:a[c],enumerable:!0,configurable:!0,set:m.bind(a,c)})};var t=n(import.meta.url),o=Symbol.dispose||Symbol.for("Symbol.dispose"),p=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),u=(b,a,c)=>{if(a!=null){if(typeof a!=="object"&&typeof a!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var e;if(c)e=a[p];if(e===void 0)e=a[o];if(typeof e!=="function")throw TypeError("Object not disposable");b.push([c,e,a])}else if(c)b.push([c]);return a},v=(b,a,c)=>{var e=typeof SuppressedError==="function"?SuppressedError:function(d,i,f,g){return g=Error(f),g.name="SuppressedError",g.error=d,g.suppressed=i,g},j=(d)=>a=c?new e(d,a,"An error was suppressed during disposal"):(c=!0,d),h=(d)=>{while(d=b.pop())try{var i=d[1]&&d[1].call(d[2]);if(d[0])return Promise.resolve(i).then(h,(f)=>(j(f),h()))}catch(f){j(f)}if(c)throw a};return h()};
2
- export{q as Ue,r as Ve,t as We,u as Xe,v as Ye};
2
+ export{q as cf,r as df,t as ef,u as ff,v as gf};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as PoolStore, _ as TokenResponse, a as RESPONSES_LITE_MODELS, b as parseJwtClaims, c as CacheKeepManager, d as ResetTargetIdentity, f as OpenAiVault, g as IdTokenClaims, l as MenuMigrationState, n as CODEX_VERSION, o as PoolLifecycleDeps, t as CODEX_USER_AGENT, u as OpenAiMenuOptions, v as beginAccountLogin, x as AccountPaths, y as extractAccountIdFromClaims } from "./codex-request-BXDXToyt.js";
2
- import { _ as SidebarMachineState, b as SidebarState } from "./sidebar-state-DjTWUbmf.js";
1
+ import { S as PoolStore, _ as TokenResponse, a as RESPONSES_LITE_MODELS, b as parseJwtClaims, c as CacheKeepManager, d as ResetTargetIdentity, f as OpenAiVault, g as IdTokenClaims, l as MenuMigrationState, n as CODEX_VERSION, o as PoolLifecycleDeps, t as CODEX_USER_AGENT, u as OpenAiMenuOptions, v as beginAccountLogin, x as AccountPaths, y as extractAccountIdFromClaims } from "./codex-request-CjXETpTA.js";
2
+ import { v as SidebarMachineState, x as SidebarState } from "./sidebar-state-BfQ4mpZO.js";
3
3
  import { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
4
4
  //#region ../core/dist/provider.d.ts
5
5
  type QuotaWindowName = string;
@@ -417,7 +417,9 @@ interface OpenCodeMenuContext {
417
417
  refreshSidebar?: () => Promise<void>;
418
418
  /** Re-read the pool so requests route across the changed rows at once. */
419
419
  afterWrite?: () => unknown;
420
- cacheKeepManager?: CacheKeepManager | null;
420
+ cacheKeepManager?: Pick<CacheKeepManager, 'status' | 'start' | 'stop' | 'remove'> | null;
421
+ /** Host-specific limits to show alongside the keep-warm status. */
422
+ cacheKeepNotice?: string;
421
423
  setCacheKeepEnabled?: (enabled: boolean) => void;
422
424
  setCacheKeepSubagents?: (enabled: boolean) => void;
423
425
  setCacheKeepSustain?: (enabled: boolean) => void;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{$ as u,M as f,N as g,O as h,P as i,Q as j,R as k,S as l,T as m,U as n,V as o,W as p,X as q,Y as r,Z as s,_ as t,aa as v,ba as w,ca as x,da as y,ea as z,fa as A,ga as B,ha as C,ia as D,ja as E,ka as F,m as c,n as d,o as e}from"./index-edbdscy7.js";import"./index-0yh85bwb.js";import"./index-8re8rprk.js";import{Ic as a,Jc as b}from"./index-7eb3dw37.js";import"./index-msx2m78k.js";import"./index-4c8yw54k.js";import"./index-k6cydkgt.js";import"./index-7c6sxtd6.js";import"./index-m5qmvr6c.js";import"./index-f2fmb596.js";import"./index-csky2xpg.js";export{C as rewriteResponsesLiteBody,A as resolveSidebarSessionId,r as poolResetTarget,a as parseJwtClaims,x as mergePushedQuotaMetadata,k as getMainRefreshLockName,w as findCachekeepFallbackAccount,b as extractAccountIdFromClaims,F as default,s as createResetTargetResolver,h as codexOAuthModelListed,i as codexOAuthModelLimit,z as buildSidebarState,y as buildSidebarMachineState,t as buildResetRedemptionDeps,o as __resetBootQuotaSeedForTest,u as __menuContextForTest,n as __bootQuotaSeedPromiseForTest,q as ResetTargetResolutionError,c as RESPONSES_LITE_MODELS,v as POOL_MIGRATION_ENABLED,E as OpenAIAuthPlugin,B as MID_CONVERSATION_EFFORT_MODELS,l as MAIN_REFRESH_LOCK_TTL_MS,m as MAIN_REFRESH_LEASE_TTL_MS,j as EMPTY_BEARER_MESSAGE,g as DISALLOWED_MODELS,D as CodexAuthPlugin,d as CODEX_VERSION,e as CODEX_USER_AGENT,p as AuthPersistError,f as ALLOWED_MODELS};
1
+ import{$ as q,Q as f,R as g,S as h,T as i,U as j,V as k,W as l,X as m,Y as n,Z as o,_ as p,aa as r,ba as s,ca as t,da as u,ea as v,fa as w,ga as x,ha as y,ia as z,ja as A,ka as B,la as C,m as c,ma as D,n as d,na as E,o as e,oa as F}from"./index-rwbrhkse.js";import"./index-03em8hv1.js";import"./index-6n4pnfkg.js";import{Sc as a,Tc as b}from"./index-f21addzm.js";import"./index-qxbchh2d.js";import"./index-htvcmtcx.js";import"./index-ffg0sgg5.js";import"./index-ehjj89rx.js";import"./index-r2s51ac1.js";import"./index-bc89akak.js";import"./index-xwvze96g.js";export{C as rewriteResponsesLiteBody,A as resolveSidebarSessionId,r as poolResetTarget,a as parseJwtClaims,x as mergePushedQuotaMetadata,k as getMainRefreshLockName,w as findCachekeepFallbackAccount,b as extractAccountIdFromClaims,F as default,s as createResetTargetResolver,h as codexOAuthModelListed,i as codexOAuthModelLimit,z as buildSidebarState,y as buildSidebarMachineState,t as buildResetRedemptionDeps,o as __resetBootQuotaSeedForTest,u as __menuContextForTest,n as __bootQuotaSeedPromiseForTest,q as ResetTargetResolutionError,c as RESPONSES_LITE_MODELS,v as POOL_MIGRATION_ENABLED,E as OpenAIAuthPlugin,B as MID_CONVERSATION_EFFORT_MODELS,l as MAIN_REFRESH_LOCK_TTL_MS,m as MAIN_REFRESH_LEASE_TTL_MS,j as EMPTY_BEARER_MESSAGE,g as DISALLOWED_MODELS,D as CodexAuthPlugin,d as CODEX_VERSION,e as CODEX_USER_AGENT,p as AuthPersistError,f as ALLOWED_MODELS};
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/commands/model.d.ts
1
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/commands/model.d.ts
2
2
  /** The section slots, in the one order every renderer shows them. */
3
3
  declare const SECTION_SLOTS: readonly ['accounts', 'quota', 'routing', 'limits', 'cache', 'diagnostics', 'extra'];
4
4
  type SectionSlot = (typeof SECTION_SLOTS)[number];
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/rpc/port-file.d.ts
1
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/rpc/port-file.d.ts
2
2
  interface PortFileEntry {
3
3
  port: number;
4
4
  token: string;
@@ -1,4 +1,4 @@
1
- import { n as CommandApplyResult, r as CommandDialogPayload, s as NotifyKind, t as CommandApplyRequest } from "./model-YRg7Uowo.js";
1
+ import { n as CommandApplyResult, r as CommandDialogPayload, s as NotifyKind, t as CommandApplyRequest } from "./model-CQcw10oW.js";
2
2
  //#region ../core/dist/protocol.d.ts
3
3
  /** The menu, as the slash command opens it in the TUI. */
4
4
  type OpenDialogPayload = CommandDialogPayload;
@@ -1,4 +1,4 @@
1
- import { n as discoverPortFile, r as writePortFile, t as PortFileEntry } from "../port-file-CxEpgSHY.js";
1
+ import { n as discoverPortFile, r as writePortFile, t as PortFileEntry } from "../port-file-BDJnzgHH.js";
2
2
  //#region src/rpc/port-file.d.ts
3
3
  export declare const isOpenaiRpcStateDir: (name: string) => boolean;
4
4
  //#endregion
@@ -1 +1 @@
1
- import{me as c}from"../index-4c8yw54k.js";import{oe as a,qe as b}from"../index-k6cydkgt.js";import"../index-m5qmvr6c.js";import"../index-f2fmb596.js";import"../index-csky2xpg.js";export{a as writePortFile,c as isOpenaiRpcStateDir,b as discoverPortFile};
1
+ import{we as c}from"../index-htvcmtcx.js";import{Ae as b,ye as a}from"../index-ffg0sgg5.js";import"../index-r2s51ac1.js";import"../index-bc89akak.js";import"../index-xwvze96g.js";export{a as writePortFile,c as isOpenaiRpcStateDir,b as discoverPortFile};
@@ -1,2 +1,2 @@
1
- import { a as RpcNotification, i as OpenDialogPayload, n as ApplyResult, o as isNotifyPayload, r as NotifyPayload, t as ApplyRequest } from "../protocol-CDV1Pc6h.js";
1
+ import { a as RpcNotification, i as OpenDialogPayload, n as ApplyResult, o as isNotifyPayload, r as NotifyPayload, t as ApplyRequest } from "../protocol-C-kagE6O.js";
2
2
  export { type ApplyRequest, type ApplyResult, type NotifyPayload, type OpenDialogPayload, type RpcNotification, isNotifyPayload };
@@ -1 +1 @@
1
- import{De as b}from"../index-7c6sxtd6.js";import"../index-m5qmvr6c.js";import"../index-csky2xpg.js";export{b as isNotifyPayload};
1
+ import{Ne as b}from"../index-ehjj89rx.js";import"../index-r2s51ac1.js";import"../index-xwvze96g.js";export{b as isNotifyPayload};
@@ -1,6 +1,6 @@
1
- import { a as RpcNotification, n as ApplyResult, t as ApplyRequest } from "../protocol-CDV1Pc6h.js";
2
- import { t as PortFileEntry } from "../port-file-CxEpgSHY.js";
3
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/rpc/rpc-client.d.ts
1
+ import { a as RpcNotification, n as ApplyResult, t as ApplyRequest } from "../protocol-C-kagE6O.js";
2
+ import { t as PortFileEntry } from "../port-file-BDJnzgHH.js";
3
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/rpc/rpc-client.d.ts
4
4
  export declare const DEFAULT_RPC_TIMEOUT_MS = 2000;
5
5
  //#endregion
6
6
  //#region src/rpc/rpc-client.d.ts
@@ -1 +1 @@
1
- import{re as F,se as f}from"../index-k6cydkgt.js";import"../index-m5qmvr6c.js";import"../index-csky2xpg.js";function y(r,s,v){return f(r,s,v)}export{y as createRpcClient,F as DEFAULT_RPC_TIMEOUT_MS};
1
+ import{Be as F,Ce as f}from"../index-ffg0sgg5.js";import"../index-r2s51ac1.js";import"../index-xwvze96g.js";function y(r,s,v){return f(r,s,v)}export{y as createRpcClient,F as DEFAULT_RPC_TIMEOUT_MS};
@@ -1 +1 @@
1
- import{Qe as a,Re as b,Se as c,Te as d}from"../index-f2fmb596.js";import"../index-csky2xpg.js";export{a as tmpdir,d as resolveRpcDir,c as getRpcDir,b as RPC_DIRECTORY_PREFIX};
1
+ import{$e as b,_e as a,af as c,bf as d}from"../index-bc89akak.js";import"../index-xwvze96g.js";export{a as tmpdir,d as resolveRpcDir,c as getRpcDir,b as RPC_DIRECTORY_PREFIX};
@@ -1,5 +1,4 @@
1
- import { t as QuotaCounter } from "./map-Buq-GW7l.js";
2
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/logger/engine.d.ts
1
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/logger/engine.d.ts
3
2
  interface ChannelLogger {
4
3
  error(message: string, data?: unknown): void;
5
4
  warn(message: string, data?: unknown): void;
@@ -9,7 +8,62 @@ interface ChannelLogger {
9
8
  }
10
9
  declare function createLogger(channel: string): ChannelLogger;
11
10
  //#endregion
12
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/quota/projection.d.ts
11
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/quota/map.d.ts
12
+ interface QuotaReadingEntry {
13
+ scope: string;
14
+ label: string;
15
+ kind: 'reading';
16
+ checkedAt: number;
17
+ usedPercent: number;
18
+ /** ISO timestamp at which the window resets, as the provider reported it. */
19
+ resetsAt?: string;
20
+ /** Window length in minutes, when the provider reported one. */
21
+ windowMinutes?: number;
22
+ }
23
+ interface QuotaRetiredEntry {
24
+ scope: string;
25
+ label: string;
26
+ kind: 'retired';
27
+ retiredAt: number;
28
+ }
29
+ interface QuotaAbsentEntry {
30
+ scope: string;
31
+ label: string;
32
+ kind: 'absent';
33
+ checkedAt: number;
34
+ }
35
+ type QuotaEntry = QuotaReadingEntry | QuotaRetiredEntry | QuotaAbsentEntry;
36
+ interface CreditBudgetReading {
37
+ kind: 'reading';
38
+ checkedAt: number;
39
+ /** The provider's own verdict that the budget is spent. */
40
+ reached: boolean;
41
+ remainingPercent?: number;
42
+ usedPercent?: number;
43
+ resetsAt?: string;
44
+ limit?: number;
45
+ used?: number;
46
+ remaining?: number;
47
+ unit?: string;
48
+ }
49
+ interface CreditBudgetCleared {
50
+ kind: 'cleared';
51
+ checkedAt: number;
52
+ }
53
+ type CreditBudgetEntry = CreditBudgetReading | CreditBudgetCleared;
54
+ interface QuotaCounter {
55
+ value: number;
56
+ checkedAt: number;
57
+ }
58
+ interface QuotaMap {
59
+ limits: QuotaEntry[];
60
+ /** Absent means no observation has reported on the budget yet. */
61
+ budget?: CreditBudgetEntry;
62
+ /** Provider-named counts, each with its own observation time. */
63
+ counters?: Record<string, QuotaCounter>;
64
+ }
65
+ //#endregion
66
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/quota/projection.d.ts
13
67
  interface ProjectedLimit {
14
68
  scope: string;
15
69
  label: string;
@@ -44,7 +98,7 @@ interface ProjectedQuota {
44
98
  counters?: Record<string, QuotaCounter>;
45
99
  }
46
100
  //#endregion
47
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/sidebar-file/sidebar-file.d.ts
101
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/sidebar-file/sidebar-file.d.ts
48
102
  interface SidebarFileHooks {
49
103
  /** Runs on the first merge attempt, before checking for older, unlocked writers. */
50
104
  beforeRecheck?: () => void | Promise<void>;
@@ -382,6 +436,45 @@ declare function getCollapsedQuotaSummary(quota: AccountQuota | null, now?: numb
382
436
  secondaryUsedPercent: number | null;
383
437
  text: string | null;
384
438
  };
439
+ /** One account's line in the collapsed sidebar. */
440
+ interface CollapsedAccountLine {
441
+ id: string;
442
+ name: string;
443
+ killed: boolean;
444
+ /** Whether this account serves the session the sidebar is drawn for. */
445
+ active: boolean;
446
+ /**
447
+ * Whether the reading is old enough that the longer quota texts would say
448
+ * how long ago it was checked. The narrow text leaves that out, so the
449
+ * whole line is drawn dim instead.
450
+ */
451
+ stale: boolean;
452
+ /** The narrow quota text (`5h 38% · 7d 59% left`), or null with no reading. */
453
+ text: string | null;
454
+ }
455
+ /**
456
+ * The collapsed sidebar's lines: one per account the sidebar shows, in the
457
+ * order routing tries them. In vault mode that is every vault account and no
458
+ * local one, as the expanded view lists them. Locally it is main and the
459
+ * enabled fallbacks; with the fallback section hidden, only main, plus the
460
+ * fallback serving this session so the session's account never disappears.
461
+ * `state` carries this session's routing (`activeId`, `route`).
462
+ */
463
+ declare function getCollapsedAccountLines(state: SidebarState, options?: {
464
+ now?: number;
465
+ showFallbacks?: boolean;
466
+ }): CollapsedAccountLine[];
467
+ /**
468
+ * Terminal columns a string takes: wide characters (CJK, most emoji) take
469
+ * two. Uses Bun's measurement when the host runs on Bun, else counts code
470
+ * points.
471
+ */
472
+ declare function displayWidth(text: string): number;
473
+ /**
474
+ * Cut a label to at most `columns` columns, ending in `…` when it was cut.
475
+ * The collapsed sidebar shortens only the label, never the quota text.
476
+ */
477
+ declare function fitCollapsedLabel(label: string, columns: number): string;
385
478
  interface QuotaPacing {
386
479
  pacePercent: number;
387
480
  deltaPercent: number;
@@ -390,4 +483,4 @@ interface QuotaPacing {
390
483
  }
391
484
  declare function computeQuotaPacing(window: QuotaWindow, windowMs: number, now: number): QuotaPacing | null;
392
485
  //#endregion
393
- export { resolveSessionSidebarRouting as $, clearSidebarStickyAssignment as A, getSidebarStateFile as B, StickyAssignment as C, StickyPinOverlay as D, StickyAssignmentPlan as E, exhaustedQuotaResetAt as F, persistSidebarStickyAssignment as G, isQuotaExhausted as H, formatWindowLabel as I, pruneActiveRouting as J, planSidebarStickyAssignment as K, getCollapsedQuotaSummary as L, createSidebarBookkeepingQueue as M, createSidebarStateCache as N, StickyPinOverlayEntry as O, drainSidebarWrites as P, resolveActiveAccount as Q, getPresentQuotaWindows as R, SpendControlReading as S, StickyAssignmentMap as T, isUsableRoutingEntry as U, hashSidebarSessionId as V, normalizeSidebarState as W, rememberStickyPin as X, pruneStickyAssignments as Y, removeSidebarActiveRouting as Z, SidebarMachineState as _, ActiveRoutingMap as a, setSidebarState as at, SidebarState as b, PresentQuotaWindow as c, spendControlExhaustedResetAt as ct, QuotaWindowKey as d, resolveSessionStickyAccount as et, ResolveStickyAssignmentInput as f, SidebarBookkeepingQueue as g, SidebarAccountState as h, ActiveRoutingEntry as i, setSidebarMachineState as it, computeQuotaPacing as j, applyStickyPinOverlay as k, QuotaPacing as l, upsertSidebarActiveRouting as lt, STICKY_ASSIGNMENT_MAX_ENTRIES as m, ACTIVE_ROUTING_MAX_ENTRIES as n, setLegacySidebarStateFileForTest as nt, DEFAULT_SIDEBAR_STATE as o, settleWithinBudget as ot, STICKY_ASSIGNMENT_MAX_AGE_MS as p, planSidebarStickyAssignmentFromSnapshot as q, AccountQuota as r, setSidebarLegacyRouting as rt, HOT_PATH_READ_BUDGET_MS as s, sidebarQuotaProjection as st, ACTIVE_ROUTING_MAX_AGE_MS as t, resolveSidebarStickyAssignment as tt, QuotaWindow as u, SidebarRoutingAccount as v, StickyAssignmentChoice as w, SidebarStateCache as x, SidebarSnapshot as y, getSidebarState as z };
486
+ export { pruneStickyAssignments as $, applyStickyPinOverlay as A, getCollapsedAccountLines as B, SpendControlReading as C, StickyAssignmentPlan as D, StickyAssignmentMap as E, displayWidth as F, hashSidebarSessionId as G, getPresentQuotaWindows as H, drainSidebarWrites as I, normalizeSidebarState as J, isQuotaExhausted as K, exhaustedQuotaResetAt as L, computeQuotaPacing as M, createSidebarBookkeepingQueue as N, StickyPinOverlay as O, createSidebarStateCache as P, pruneActiveRouting as Q, fitCollapsedLabel as R, SidebarStateCache as S, StickyAssignmentChoice as T, getSidebarState as U, getCollapsedQuotaSummary as V, getSidebarStateFile as W, planSidebarStickyAssignment as X, persistSidebarStickyAssignment as Y, planSidebarStickyAssignmentFromSnapshot as Z, SidebarBookkeepingQueue as _, ActiveRoutingMap as a, resolveSidebarStickyAssignment as at, SidebarSnapshot as b, HOT_PATH_READ_BUDGET_MS as c, setSidebarMachineState as ct, QuotaWindow as d, sidebarQuotaProjection as dt, rememberStickyPin as et, QuotaWindowKey as f, spendControlExhaustedResetAt as ft, SidebarAccountState as g, STICKY_ASSIGNMENT_MAX_ENTRIES as h, ActiveRoutingEntry as i, resolveSessionStickyAccount as it, clearSidebarStickyAssignment as j, StickyPinOverlayEntry as k, PresentQuotaWindow as l, setSidebarState as lt, STICKY_ASSIGNMENT_MAX_AGE_MS as m, QuotaMap as mt, ACTIVE_ROUTING_MAX_ENTRIES as n, resolveActiveAccount as nt, CollapsedAccountLine as o, setLegacySidebarStateFileForTest as ot, ResolveStickyAssignmentInput as p, upsertSidebarActiveRouting as pt, isUsableRoutingEntry as q, AccountQuota as r, resolveSessionSidebarRouting as rt, DEFAULT_SIDEBAR_STATE as s, setSidebarLegacyRouting as st, ACTIVE_ROUTING_MAX_AGE_MS as t, removeSidebarActiveRouting as tt, QuotaPacing as u, settleWithinBudget as ut, SidebarMachineState as v, StickyAssignment as w, SidebarState as x, SidebarRoutingAccount as y, formatWindowLabel as z };
@@ -1,2 +1,2 @@
1
- import { $ as resolveSessionSidebarRouting, A as clearSidebarStickyAssignment, B as getSidebarStateFile, C as StickyAssignment, D as StickyPinOverlay, E as StickyAssignmentPlan, F as exhaustedQuotaResetAt, G as persistSidebarStickyAssignment, H as isQuotaExhausted, I as formatWindowLabel, J as pruneActiveRouting, K as planSidebarStickyAssignment, L as getCollapsedQuotaSummary, M as createSidebarBookkeepingQueue, N as createSidebarStateCache, O as StickyPinOverlayEntry, P as drainSidebarWrites, Q as resolveActiveAccount, R as getPresentQuotaWindows, S as SpendControlReading, T as StickyAssignmentMap, U as isUsableRoutingEntry, V as hashSidebarSessionId, W as normalizeSidebarState, X as rememberStickyPin, Y as pruneStickyAssignments, Z as removeSidebarActiveRouting, _ as SidebarMachineState, a as ActiveRoutingMap, at as setSidebarState, b as SidebarState, c as PresentQuotaWindow, ct as spendControlExhaustedResetAt, d as QuotaWindowKey, et as resolveSessionStickyAccount, f as ResolveStickyAssignmentInput, g as SidebarBookkeepingQueue, h as SidebarAccountState, i as ActiveRoutingEntry, it as setSidebarMachineState, j as computeQuotaPacing, k as applyStickyPinOverlay, l as QuotaPacing, lt as upsertSidebarActiveRouting, m as STICKY_ASSIGNMENT_MAX_ENTRIES, n as ACTIVE_ROUTING_MAX_ENTRIES, nt as setLegacySidebarStateFileForTest, o as DEFAULT_SIDEBAR_STATE, ot as settleWithinBudget, p as STICKY_ASSIGNMENT_MAX_AGE_MS, q as planSidebarStickyAssignmentFromSnapshot, r as AccountQuota, rt as setSidebarLegacyRouting, s as HOT_PATH_READ_BUDGET_MS, st as sidebarQuotaProjection, t as ACTIVE_ROUTING_MAX_AGE_MS, tt as resolveSidebarStickyAssignment, u as QuotaWindow, v as SidebarRoutingAccount, w as StickyAssignmentChoice, x as SidebarStateCache, y as SidebarSnapshot, z as getSidebarState } from "./sidebar-state-DjTWUbmf.js";
2
- export { ACTIVE_ROUTING_MAX_AGE_MS, ACTIVE_ROUTING_MAX_ENTRIES, AccountQuota, ActiveRoutingEntry, ActiveRoutingMap, DEFAULT_SIDEBAR_STATE, HOT_PATH_READ_BUDGET_MS, PresentQuotaWindow, QuotaPacing, QuotaWindow, QuotaWindowKey, ResolveStickyAssignmentInput, STICKY_ASSIGNMENT_MAX_AGE_MS, STICKY_ASSIGNMENT_MAX_ENTRIES, SidebarAccountState, SidebarBookkeepingQueue, SidebarMachineState, SidebarRoutingAccount, SidebarSnapshot, SidebarState, SidebarStateCache, SpendControlReading, StickyAssignment, StickyAssignmentChoice, StickyAssignmentMap, StickyAssignmentPlan, StickyPinOverlay, StickyPinOverlayEntry, applyStickyPinOverlay, clearSidebarStickyAssignment, computeQuotaPacing, createSidebarBookkeepingQueue, createSidebarStateCache, drainSidebarWrites, exhaustedQuotaResetAt, formatWindowLabel, getCollapsedQuotaSummary, getPresentQuotaWindows, getSidebarState, getSidebarStateFile, hashSidebarSessionId, isQuotaExhausted, isUsableRoutingEntry, normalizeSidebarState, persistSidebarStickyAssignment, planSidebarStickyAssignment, planSidebarStickyAssignmentFromSnapshot, pruneActiveRouting, pruneStickyAssignments, rememberStickyPin, removeSidebarActiveRouting, resolveActiveAccount, resolveSessionSidebarRouting, resolveSessionStickyAccount, resolveSidebarStickyAssignment, setLegacySidebarStateFileForTest, setSidebarLegacyRouting, setSidebarMachineState, setSidebarState, settleWithinBudget, sidebarQuotaProjection, spendControlExhaustedResetAt, upsertSidebarActiveRouting };
1
+ import { $ as pruneStickyAssignments, A as applyStickyPinOverlay, B as getCollapsedAccountLines, C as SpendControlReading, D as StickyAssignmentPlan, E as StickyAssignmentMap, F as displayWidth, G as hashSidebarSessionId, H as getPresentQuotaWindows, I as drainSidebarWrites, J as normalizeSidebarState, K as isQuotaExhausted, L as exhaustedQuotaResetAt, M as computeQuotaPacing, N as createSidebarBookkeepingQueue, O as StickyPinOverlay, P as createSidebarStateCache, Q as pruneActiveRouting, R as fitCollapsedLabel, S as SidebarStateCache, T as StickyAssignmentChoice, U as getSidebarState, V as getCollapsedQuotaSummary, W as getSidebarStateFile, X as planSidebarStickyAssignment, Y as persistSidebarStickyAssignment, Z as planSidebarStickyAssignmentFromSnapshot, _ as SidebarBookkeepingQueue, a as ActiveRoutingMap, at as resolveSidebarStickyAssignment, b as SidebarSnapshot, c as HOT_PATH_READ_BUDGET_MS, ct as setSidebarMachineState, d as QuotaWindow, dt as sidebarQuotaProjection, et as rememberStickyPin, f as QuotaWindowKey, ft as spendControlExhaustedResetAt, g as SidebarAccountState, h as STICKY_ASSIGNMENT_MAX_ENTRIES, i as ActiveRoutingEntry, it as resolveSessionStickyAccount, j as clearSidebarStickyAssignment, k as StickyPinOverlayEntry, l as PresentQuotaWindow, lt as setSidebarState, m as STICKY_ASSIGNMENT_MAX_AGE_MS, n as ACTIVE_ROUTING_MAX_ENTRIES, nt as resolveActiveAccount, o as CollapsedAccountLine, ot as setLegacySidebarStateFileForTest, p as ResolveStickyAssignmentInput, pt as upsertSidebarActiveRouting, q as isUsableRoutingEntry, r as AccountQuota, rt as resolveSessionSidebarRouting, s as DEFAULT_SIDEBAR_STATE, st as setSidebarLegacyRouting, t as ACTIVE_ROUTING_MAX_AGE_MS, tt as removeSidebarActiveRouting, u as QuotaPacing, ut as settleWithinBudget, v as SidebarMachineState, w as StickyAssignment, x as SidebarState, y as SidebarRoutingAccount, z as formatWindowLabel } from "./sidebar-state-BfQ4mpZO.js";
2
+ export { ACTIVE_ROUTING_MAX_AGE_MS, ACTIVE_ROUTING_MAX_ENTRIES, AccountQuota, ActiveRoutingEntry, ActiveRoutingMap, CollapsedAccountLine, DEFAULT_SIDEBAR_STATE, HOT_PATH_READ_BUDGET_MS, PresentQuotaWindow, QuotaPacing, QuotaWindow, QuotaWindowKey, ResolveStickyAssignmentInput, STICKY_ASSIGNMENT_MAX_AGE_MS, STICKY_ASSIGNMENT_MAX_ENTRIES, SidebarAccountState, SidebarBookkeepingQueue, SidebarMachineState, SidebarRoutingAccount, SidebarSnapshot, SidebarState, SidebarStateCache, SpendControlReading, StickyAssignment, StickyAssignmentChoice, StickyAssignmentMap, StickyAssignmentPlan, StickyPinOverlay, StickyPinOverlayEntry, applyStickyPinOverlay, clearSidebarStickyAssignment, computeQuotaPacing, createSidebarBookkeepingQueue, createSidebarStateCache, displayWidth, drainSidebarWrites, exhaustedQuotaResetAt, fitCollapsedLabel, formatWindowLabel, getCollapsedAccountLines, getCollapsedQuotaSummary, getPresentQuotaWindows, getSidebarState, getSidebarStateFile, hashSidebarSessionId, isQuotaExhausted, isUsableRoutingEntry, normalizeSidebarState, persistSidebarStickyAssignment, planSidebarStickyAssignment, planSidebarStickyAssignmentFromSnapshot, pruneActiveRouting, pruneStickyAssignments, rememberStickyPin, removeSidebarActiveRouting, resolveActiveAccount, resolveSessionSidebarRouting, resolveSessionStickyAccount, resolveSidebarStickyAssignment, setLegacySidebarStateFileForTest, setSidebarLegacyRouting, setSidebarMachineState, setSidebarState, settleWithinBudget, sidebarQuotaProjection, spendControlExhaustedResetAt, upsertSidebarActiveRouting };
@@ -1 +1 @@
1
- import{$b as C,Ab as b,Bb as c,Cb as d,Db as e,Eb as f,Fb as g,Gb as h,Hb as i,Ib as j,Jb as k,Kb as l,Lb as m,Mb as n,Nb as o,Ob as p,Pb as q,Qb as r,Rb as s,Sb as t,Tb as u,Ub as v,Vb as w,Wb as x,Xb as y,Yb as z,Zb as A,_b as B,ac as D,bc as E,cc as F,dc as G,ec as H,fc as I,gc as J,hc as K,ic as L,jc as M,kc as N,lc as O,zb as a}from"./index-8re8rprk.js";import"./index-7eb3dw37.js";import"./index-msx2m78k.js";import"./index-7c6sxtd6.js";import"./index-m5qmvr6c.js";import"./index-csky2xpg.js";export{w as upsertSidebarActiveRouting,n as spendControlExhaustedResetAt,M as sidebarQuotaProjection,G as settleWithinBudget,u as setSidebarState,v as setSidebarMachineState,x as setSidebarLegacyRouting,c as setLegacySidebarStateFileForTest,A as resolveSidebarStickyAssignment,q as resolveSessionStickyAccount,r as resolveSessionSidebarRouting,L as resolveActiveAccount,y as removeSidebarActiveRouting,I as rememberStickyPin,t as pruneStickyAssignments,s as pruneActiveRouting,B as planSidebarStickyAssignmentFromSnapshot,z as planSidebarStickyAssignment,C as persistSidebarStickyAssignment,i as normalizeSidebarState,m as isUsableRoutingEntry,p as isQuotaExhausted,f as hashSidebarSessionId,g as getSidebarStateFile,j as getSidebarState,b as getPresentQuotaWindows,N as getCollapsedQuotaSummary,a as formatWindowLabel,o as exhaustedQuotaResetAt,E as drainSidebarWrites,H as createSidebarStateCache,K as createSidebarBookkeepingQueue,O as computeQuotaPacing,D as clearSidebarStickyAssignment,J as applyStickyPinOverlay,e as STICKY_ASSIGNMENT_MAX_ENTRIES,d as STICKY_ASSIGNMENT_MAX_AGE_MS,F as HOT_PATH_READ_BUDGET_MS,h as DEFAULT_SIDEBAR_STATE,l as ACTIVE_ROUTING_MAX_ENTRIES,k as ACTIVE_ROUTING_MAX_AGE_MS};
1
+ import{$b as w,Fb as a,Gb as b,Hb as c,Ib as d,Jb as e,Kb as f,Lb as g,Mb as h,Nb as i,Ob as j,Pb as k,Qb as l,Rb as m,Sb as n,Tb as o,Ub as p,Vb as q,Wb as r,Xb as s,Yb as t,Zb as u,_b as v,ac as x,bc as y,cc as z,dc as A,ec as B,fc as C,gc as D,hc as E,ic as F,jc as G,kc as H,lc as I,mc as J,nc as K,oc as L,pc as M,qc as N,rc as O,sc as P,tc as Q,uc as R}from"./index-6n4pnfkg.js";import"./index-f21addzm.js";import"./index-qxbchh2d.js";import"./index-ehjj89rx.js";import"./index-r2s51ac1.js";import"./index-xwvze96g.js";export{w as upsertSidebarActiveRouting,n as spendControlExhaustedResetAt,M as sidebarQuotaProjection,G as settleWithinBudget,u as setSidebarState,v as setSidebarMachineState,x as setSidebarLegacyRouting,c as setLegacySidebarStateFileForTest,A as resolveSidebarStickyAssignment,q as resolveSessionStickyAccount,r as resolveSessionSidebarRouting,L as resolveActiveAccount,y as removeSidebarActiveRouting,I as rememberStickyPin,t as pruneStickyAssignments,s as pruneActiveRouting,B as planSidebarStickyAssignmentFromSnapshot,z as planSidebarStickyAssignment,C as persistSidebarStickyAssignment,i as normalizeSidebarState,m as isUsableRoutingEntry,p as isQuotaExhausted,f as hashSidebarSessionId,g as getSidebarStateFile,j as getSidebarState,b as getPresentQuotaWindows,N as getCollapsedQuotaSummary,O as getCollapsedAccountLines,a as formatWindowLabel,Q as fitCollapsedLabel,o as exhaustedQuotaResetAt,E as drainSidebarWrites,P as displayWidth,H as createSidebarStateCache,K as createSidebarBookkeepingQueue,R as computeQuotaPacing,D as clearSidebarStickyAssignment,J as applyStickyPinOverlay,e as STICKY_ASSIGNMENT_MAX_ENTRIES,d as STICKY_ASSIGNMENT_MAX_AGE_MS,F as HOT_PATH_READ_BUDGET_MS,h as DEFAULT_SIDEBAR_STATE,l as ACTIVE_ROUTING_MAX_ENTRIES,k as ACTIVE_ROUTING_MAX_AGE_MS};
@@ -0,0 +1 @@
1
+ import{b as a}from"./index-ftkhhr6d.js";import"./index-xwvze96g.js";export default a();
@@ -1 +1 @@
1
- import{a as U,b as V}from"./index-zpm95mt5.js";import{Ue as R}from"./index-csky2xpg.js";var E=R((M,Q)=>{var{defineProperty:H,getOwnPropertyDescriptor:W,getOwnPropertyNames:X}=Object,Y=Object.prototype.hasOwnProperty,Z=(z,q)=>{for(var B in q)H(z,B,{get:q[B],enumerable:!0})},$=(z,q,B,F)=>{if(q&&typeof q==="object"||typeof q==="function"){for(let v of X(q))if(!Y.call(z,v)&&v!==B)H(z,v,{get:()=>q[v],enumerable:!(F=W(q,v))||F.enumerable})}return z},A=(z)=>$(H({},"__esModule",{value:!0}),z),L={};Z(L,{refreshToken:()=>D});Q.exports=A(L);var K=U(),G=V();async function D(z){let q=z?.project,B=z?.team;if(!q&&!B){let v=(0,G.findProjectInfo)();q=v.projectId,B=v.teamId}else if(!q||!B){let v=(0,G.findProjectInfo)();q=q??v.projectId,B=B??v.teamId}if(!q)throw new K.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let F=(0,G.loadToken)(q);if(!F||(0,G.isExpired)((0,G.getTokenPayload)(F.token),z?.expirationBufferMs)){let v=await(0,G.getVercelToken)({expirationBufferMs:z?.expirationBufferMs});if(F=await(0,G.getVercelOidcToken)(v,q,B),!F)throw new K.VercelOidcTokenError("Failed to refresh OIDC token");(0,G.saveToken)(F,q)}process.env.VERCEL_OIDC_TOKEN=F.token;return}});export default E();
1
+ import{a as U,b as V}from"./index-ftkhhr6d.js";import{cf as R}from"./index-xwvze96g.js";var E=R((M,Q)=>{var{defineProperty:H,getOwnPropertyDescriptor:W,getOwnPropertyNames:X}=Object,Y=Object.prototype.hasOwnProperty,Z=(z,q)=>{for(var B in q)H(z,B,{get:q[B],enumerable:!0})},$=(z,q,B,F)=>{if(q&&typeof q==="object"||typeof q==="function"){for(let v of X(q))if(!Y.call(z,v)&&v!==B)H(z,v,{get:()=>q[v],enumerable:!(F=W(q,v))||F.enumerable})}return z},A=(z)=>$(H({},"__esModule",{value:!0}),z),L={};Z(L,{refreshToken:()=>D});Q.exports=A(L);var K=U(),G=V();async function D(z){let q=z?.project,B=z?.team;if(!q&&!B){let v=(0,G.findProjectInfo)();q=v.projectId,B=v.teamId}else if(!q||!B){let v=(0,G.findProjectInfo)();q=q??v.projectId,B=B??v.teamId}if(!q)throw new K.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let F=(0,G.loadToken)(q);if(!F||(0,G.isExpired)((0,G.getTokenPayload)(F.token),z?.expirationBufferMs)){let v=await(0,G.getVercelToken)({expirationBufferMs:z?.expirationBufferMs});if(F=await(0,G.getVercelOidcToken)(v,q,B),!F)throw new K.VercelOidcTokenError("Failed to refresh OIDC token");(0,G.saveToken)(F,q)}process.env.VERCEL_OIDC_TOKEN=F.token;return}});export default E();
@@ -1,4 +1,4 @@
1
- import{$d as h,fe as u,ge as P}from"./index-msx2m78k.js";import{Fe as M,Ge as R,Le as S}from"./index-m5qmvr6c.js";import"./index-csky2xpg.js";import{mkdir as Yq,writeFile as Vq}from"node:fs/promises";import{homedir as Wq}from"node:os";import{dirname as Dq,join as b}from"node:path";import{applyEdits as t,modify as r,parse as e}from"jsonc-parser";function qq(z){return z!==null&&typeof z==="object"&&!Array.isArray(z)}async function k(z){try{let q=[],H=e(await S(z,M),q,{allowTrailingComma:!0});return q.length===0&&qq(H)?H:{}}catch(q){if(q instanceof R&&q.code!=="ENOENT")throw q;return{}}}var zq=`// Shared preferences for TUI plugins.
1
+ import{je as h,pe as u,qe as P}from"./index-qxbchh2d.js";import{Pe as M,Qe as R,Ve as S}from"./index-r2s51ac1.js";import"./index-xwvze96g.js";import{mkdir as Yq,writeFile as Vq}from"node:fs/promises";import{homedir as Wq}from"node:os";import{dirname as Dq,join as b}from"node:path";import{applyEdits as t,modify as r,parse as e}from"jsonc-parser";function qq(z){return z!==null&&typeof z==="object"&&!Array.isArray(z)}async function k(z){try{let q=[],H=e(await S(z,M),q,{allowTrailingComma:!0});return q.length===0&&qq(H)?H:{}}catch(q){if(q instanceof R&&q.code!=="ENOENT")throw q;return{}}}var zq=`// Shared preferences for TUI plugins.
2
2
  // Plugins update individual keys in place and preserve comments.
3
3
  {}
4
4
  `;function g(z){let{file:q,pluginKey:H,beforeCommit:Q}=z,$={...P.preferences,timeoutMs:z.timeoutMs??P.preferences.timeoutMs},Z=Promise.resolve();async function X(U,j){await u(q,$,async(K)=>{let J;try{J=await S(q,M)}catch(G){if(G.code!=="ENOENT")throw G;J=""}if(J.trim()==="")J=zq;let B=t(J,r(J,[H,...U],j,{formattingOptions:{insertSpaces:!0,tabSize:2}}));await h(q,B,{serialize:(G)=>String(G),beforeRename:async()=>{await Q?.(),await K.assertOwned()}})})}return{queueTuiPreferenceUpdate(U,j){let K=[...U],J=structuredClone(j),B=Z.then(()=>X(K,J));return Z=B.catch(()=>{}),B}}}import{readFileSync as Hq,realpathSync as Qq,statSync as Xq,watch as Zq}from"node:fs";import{readFile as $q,stat as Bq}from"node:fs/promises";import{basename as p,dirname as s,join as Gq,resolve as Jq}from"node:path";import{clearTimeout as w,setTimeout as c}from"node:timers";function n(z){let q=Jq(z);if(M)return q;try{return Qq(q)}catch{let H=s(q);return H===q?q:Gq(n(H),p(q))}}function d(z){return z&&`${z.dev}:${z.ino}:${z.mtimeMs}:${z.size}`}function T(z,q,H={}){let Q=globalThis,$=Symbol.for("cortexkit.common-auth.tui-prefs.watchers.v1"),Z=Q[$]??new Map;Q[$]=Z;let X=n(z),U=Z.get(X);if(U)return U.subscribe(q);let j=p(X),K=M?(Y)=>S(Y):H.fs?.readFile??((Y)=>$q(Y,"utf8")),J=H.fs?.stat??Bq,B=null,G=null,x=null,C=null;if(!M)try{let Y=d((H.fs?.statSync??Xq)(X));C=(H.fs?.readFileSync??((V)=>Hq(V,"utf8")))(X),x=Y}catch{}let N=!1,L=new Set,E=Promise.resolve(),v=(Y)=>{return E=E.then(async()=>{if(N)return;let V=d(await J(X).catch(()=>null));if(!Y&&V===x)return;if(V===null){x=null;return}let I=await K(X).catch((W)=>{if(W instanceof R&&W.code!=="ENOENT")if(H.onError)H.onError(W);else process.emitWarning(W.message,W.name);return null});if(N)return;if(I===null)return;if(x=V,I===C)return;C=I;for(let W of[...L]){if(!L.has(W))continue;try{W.notify()}catch{}}}),E},i=()=>{if(N)return;if(B)w(B);B=c(()=>{B=null,v(!0)},150)},O=null;try{O=(H.watchDirectory??Zq)(s(X),(Y,V)=>{let I=V?.toString(),W=I===j||I?.startsWith(`${j}.`)&&I.endsWith(".tmp");if(I!=null&&!W)return;i()}),O.on("error",()=>{O?.close(),O=null})}catch{}let f=()=>{if(N||G)return;G=c(()=>{if(G=null,N)return;v(!1).finally(f)},1000),G.unref()},F={subscribe:(Y)=>{let V={notify:Y};return L.add(V),()=>{if(!L.delete(V)||L.size>0)return;if(N=!0,B)w(B);if(G)w(G);if(O?.close(),Z.get(X)===F)Z.delete(X)}}};return Z.set(X,F),f(),F.subscribe(q)}var Uq="OPENCODE_TUI_PREFERENCES_FILE",Iq="tui-preferences.jsonc";function m(){let z=process.env[Uq];if(z)return z;let q=process.env.OPENCODE_CONFIG_DIR||b(process.env.XDG_CONFIG_HOME||b(Wq(),".config"),"opencode");return b(q,Iq)}function _(z){return typeof z==="object"&&z!==null&&!Array.isArray(z)}function dq(){return k(m())}var Mq="openai-auth",Aq=160,l={forceToTop:!1,order:Aq,startCollapsed:!1,rememberCollapsed:!0,collapsed:null,pollMs:1500,refreshDebounceMs:200,header:{label:"OPENAI",showVersion:!0},sections:{quota:!0,fallbackAccounts:!0,routing:!0,health:!0,pacing:!0},appearance:{barWidth:10,barFilledChar:"█",barEmptyChar:"░",warnThreshold:50,errorThreshold:80}};function D(z,q){return typeof z==="boolean"?z:q}function A(z,q,H,Q){if(typeof z!=="number"||!Number.isFinite(z))return q;return Math.min(Math.max(Math.round(z),H),Q)}function jq(z,q,H){if(typeof z!=="string"||z.length===0)return q;return z.slice(0,H)}function o(z,q){if(typeof z!=="string")return q;return[...z][0]??q}function pq(z){let q=z[Mq];if(!_(q))return structuredClone(l);let H=l,Q=_(q.header)?q.header:{},$=_(q.sections)?q.sections:{},Z=_(q.appearance)?q.appearance:{},X=A(Z.warnThreshold,H.appearance.warnThreshold,0,99),U=Math.max(A(Z.errorThreshold,H.appearance.errorThreshold,0,100),Math.min(X+1,100));return{forceToTop:D(q.forceToTop,H.forceToTop),order:A(q.order,H.order,-1e4,1e4),startCollapsed:D(q.startCollapsed,H.startCollapsed),rememberCollapsed:D(q.rememberCollapsed,H.rememberCollapsed),collapsed:typeof q.collapsed==="boolean"?q.collapsed:null,pollMs:A(q.pollMs,H.pollMs,500,30000),refreshDebounceMs:A(q.refreshDebounceMs,H.refreshDebounceMs,50,5000),header:{label:jq(Q.label,H.header.label,20),showVersion:D(Q.showVersion,H.header.showVersion)},sections:{quota:D($.quota,H.sections.quota),fallbackAccounts:D($.fallbackAccounts,H.sections.fallbackAccounts),routing:D($.routing,H.sections.routing),health:D($.health,H.sections.health),pacing:D($.pacing,H.sections.pacing)},appearance:{barWidth:A(Z.barWidth,H.appearance.barWidth,4,40),barFilledChar:o(Z.barFilledChar,H.appearance.barFilledChar),barEmptyChar:o(Z.barEmptyChar,H.appearance.barEmptyChar),warnThreshold:X,errorThreshold:U}}}var Nq=-1e5;function sq(z,q,H){let Q=z[q];if(!_(Q))return H;if(Q.forceToTop===!0)return Nq+Object.keys(z).indexOf(q);return A(Q.order,H,-1e4,1e4)}var Kq=`// Shared preferences for opencode TUI plugins.
package/dist/tui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SpendControlReading, b as SidebarState, l as QuotaPacing, r as AccountQuota, u as QuotaWindow } from "./sidebar-state-DjTWUbmf.js";
2
- import { i as OpenDialogPayload, n as ApplyResult, t as ApplyRequest } from "./protocol-CDV1Pc6h.js";
1
+ import { C as SpendControlReading, d as QuotaWindow, r as AccountQuota, u as QuotaPacing, x as SidebarState } from "./sidebar-state-BfQ4mpZO.js";
2
+ import { i as OpenDialogPayload, n as ApplyResult, t as ApplyRequest } from "./protocol-C-kagE6O.js";
3
3
  import { Plugin } from "@opencode/plugin/tui";
4
4
  import { TuiPluginModule } from "@opencode-ai/plugin/tui";
5
5
  import { JSX } from "solid-js";
@@ -1,9 +1,67 @@
1
- import { h as BeginAccountLoginResult, i as CodexSessionMetadata, m as BeginAccountLoginOptions, o as PoolLifecycleDeps, p as OpenAiVaultOptions, r as CodexRequestRuntime, s as HostSlotAdapter, x as AccountPaths } from "../codex-request-BXDXToyt.js";
2
- import { i as OpenDialogPayload, n as ApplyResult } from "../protocol-CDV1Pc6h.js";
1
+ import { h as BeginAccountLoginResult, i as CodexSessionMetadata, m as BeginAccountLoginOptions, o as PoolLifecycleDeps, p as OpenAiVaultOptions, r as CodexRequestRuntime, s as HostSlotAdapter, x as AccountPaths } from "../codex-request-CjXETpTA.js";
2
+ import { i as OpenDialogPayload, n as ApplyResult } from "../protocol-C-kagE6O.js";
3
3
  import { Plugin } from "@opencode/plugin";
4
4
  import "@opencode/plugin/promise/session";
5
5
  import "@opencode/plugin/promise/integration";
6
6
  import "@opencode/plugin/promise/registration";
7
+ //#region src/v2/frame-turn.d.ts
8
+ /** The turn a frame is sent in. */
9
+ interface FrameTurn {
10
+ readonly turnID: string;
11
+ readonly turnStartedAt: number;
12
+ }
13
+ /** What is kept for one session; exposed read-only for tests and diagnostics. */
14
+ interface FrameTurnRecord extends FrameTurn {
15
+ /** Whether the session's last frame got `response.completed`. */
16
+ readonly completed: boolean;
17
+ /** SHA-256 (hex) of `JSON.stringify` of the conversation's last user message. */
18
+ readonly fingerprint: string | undefined;
19
+ /** The conversation's user-message count; undefined when not known. */
20
+ readonly userCount: number | undefined;
21
+ }
22
+ /**
23
+ * The frame turn of each session.
24
+ *
25
+ * Call `advance` once for every `response.create` frame sent, with the
26
+ * host's frame body, and `completed` when that frame's `response.completed`
27
+ * arrives. The rule:
28
+ *
29
+ * - A chained frame (one with `previous_response_id`) starts a new turn
30
+ * exactly when its `input` holds a user message. The host's deltas carry
31
+ * only newly appended items, so two consecutive identical user messages
32
+ * each start a turn, and a delta of tool outputs never does.
33
+ * - A full frame starts a new turn when its last user message comes after
34
+ * every model and tool item, unless it is a resend: the session's previous
35
+ * frame got no `response.completed`, and the frame's last user message has
36
+ * the recorded fingerprint and its user-message count equals the recorded
37
+ * count. A full frame with no recorded state is not a resend.
38
+ * - A full frame that ends on tool output keeps the current turn.
39
+ * - A session with no turn yet (new, forgotten or evicted) starts one on its
40
+ * first frame.
41
+ *
42
+ * A full frame records its own fingerprint and count. A chained frame
43
+ * records its delta's last user message, if any, and adds its delta's user
44
+ * messages to the recorded count; an unknown count stays unknown.
45
+ */
46
+ declare class FrameTurnState {
47
+ #private;
48
+ readonly runtime?: CodexRequestRuntime | undefined;
49
+ readonly maxSessions: number;
50
+ constructor(runtime?: CodexRequestRuntime | undefined, maxSessions?: number);
51
+ /**
52
+ * Applies the rule to one frame about to be sent and returns its turn.
53
+ * `runtime` mints a new turn's id and start time; it defaults to the one
54
+ * given to the constructor, so a process-wide instance can serve callers
55
+ * that each bring their own clock.
56
+ */
57
+ advance(sessionID: string, frame: Record<string, unknown>, runtime?: CodexRequestRuntime | undefined): FrameTurn;
58
+ /** Records that the session's last frame got `response.completed`. */
59
+ completed(sessionID: string): void;
60
+ get(sessionID: string): FrameTurnRecord | undefined;
61
+ /** Drops a deleted host session; its next frame starts a new turn. */
62
+ forget(sessionID: string): void;
63
+ }
64
+ //#endregion
7
65
  //#region src/v2/codex-sessions.d.ts
8
66
  interface CodexSessionStoreOptions {
9
67
  /** Mints the turn ids of loaded sessions; UUIDv7 by default. */
@@ -18,6 +76,13 @@ declare class CodexSessionStore {
18
76
  readonly path: string;
19
77
  readonly options: CodexSessionStoreOptions;
20
78
  readonly sessions: Map<string, CodexSessionMetadata>;
79
+ /**
80
+ * Each session's WebSocket frame turn, kept next to its Codex metadata.
81
+ * Every location in this process gets this same store, so they all share
82
+ * one frame turn per session. It lives in memory only and is never written
83
+ * to the session file at `path`.
84
+ */
85
+ readonly frameTurns: FrameTurnState;
21
86
  constructor(path: string, options?: CodexSessionStoreOptions);
22
87
  /** The session's metadata; a new session gets a new thread id and is saved. */
23
88
  get(sessionID: string, uuid?: () => string): CodexSessionMetadata;
@@ -44,13 +109,48 @@ declare class CodexHttpState {
44
109
  readonly runtime?: CodexRequestRuntime | undefined;
45
110
  readonly store?: CodexSessionStore | undefined;
46
111
  readonly sessions: Map<string, CodexSessionMetadata>;
112
+ /**
113
+ * Each session's WebSocket frame turn (see `frame-turn.ts`). With a store
114
+ * this is the store's process-wide state; without a store it is this
115
+ * object's own. Only WebSocket frames update it; HTTP requests of every
116
+ * kind leave it alone.
117
+ */
118
+ readonly frameTurns: FrameTurnState;
47
119
  readonly installationID: string;
48
120
  constructor(runtime?: CodexRequestRuntime | undefined, installationID?: string, store?: CodexSessionStore | undefined);
49
121
  get(sessionID: string): CodexSessionMetadata;
122
+ /**
123
+ * Applies the frame turn rule to one `response.create` frame the host is
124
+ * about to send, as the host built it, and returns the frame's turn.
125
+ */
126
+ advanceFrame(sessionID: string, frame: Record<string, unknown>): FrameTurn;
127
+ /**
128
+ * Reads one WebSocket frame the server sent on an owned socket. A
129
+ * `response.completed` marks the session's last sent frame as completed,
130
+ * so resending that same full frame afterwards starts a new turn instead
131
+ * of counting as a resend. Every other frame changes nothing.
132
+ */
133
+ frameReceived(sessionID: string, frame: string): void;
50
134
  /** Drops a deleted host session; a later request with its id starts a new thread. */
51
135
  forget(sessionID: string): void;
52
136
  }
53
137
  //#endregion
138
+ //#region src/v2/cache-keep.d.ts
139
+ /**
140
+ * How the store's manager is built. Only the first location to acquire a
141
+ * store's manager supplies these; in production every location passes the
142
+ * same clock and timers.
143
+ */
144
+ interface CacheKeepManagerSetup {
145
+ now: () => number;
146
+ /** Where a warm goes when its capture has no URL; captures always have one. */
147
+ codexResponsesUrl: string;
148
+ setIntervalImpl?: typeof globalThis.setInterval;
149
+ clearIntervalImpl?: typeof globalThis.clearInterval;
150
+ /** How long the last release waits for a warm in flight. */
151
+ joinTimeoutMs?: number;
152
+ }
153
+ //#endregion
54
154
  //#region src/v2/control-plane.d.ts
55
155
  /** Server-owned menu callbacks shared by command dispatch and loopback RPC. */
56
156
  interface ControlPlaneMenu {
@@ -81,6 +181,13 @@ interface OpenAIAuthV2Options {
81
181
  sidebarObservationIntervalMs?: number;
82
182
  /** Overrides the production menu for transport fixtures. */
83
183
  controlPlane?: ControlPlaneMenu;
184
+ /**
185
+ * Test overrides for the keep-warm manager: its interval timer, and how
186
+ * long the last location's release waits for a warm request in flight.
187
+ * Only the location that builds the store's manager applies them;
188
+ * production uses the global timers and `CACHE_KEEP_JOIN_MS`.
189
+ */
190
+ cacheKeep?: Pick<CacheKeepManagerSetup, 'setIntervalImpl' | 'clearIntervalImpl' | 'joinTimeoutMs'>;
84
191
  /** The account config and state files; read on every use. */
85
192
  paths?: () => AccountPaths;
86
193
  /** OpenCode 1's login slot the migration reads; its `auth.json` by default. */