@cortexkit/opencode-openai-auth 1.6.2 → 1.8.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 (77) hide show
  1. package/dist/bin.js +9 -9
  2. package/dist/{codex-request-D_In8uaR.d.ts → codex-request-DohnbsFR.d.ts} +66 -848
  3. package/dist/index-3v868rnp.js +63 -0
  4. package/dist/{index-b0ty9qam.js → index-5d4y47h8.js} +2 -2
  5. package/dist/{index-7nmdsmpp.js → index-5dxpsa3t.js} +2 -2
  6. package/dist/{index-8xq099qf.js → index-8pk9savd.js} +6 -6
  7. package/dist/{index-jkpg9d1p.js → index-cbcka7sa.js} +1 -1
  8. package/dist/{index-79y7w9bz.js → index-cxstwq02.js} +1 -1
  9. package/dist/{index-x9nffaye.js → index-dtwgf694.js} +1 -1
  10. package/dist/index-dzaqj248.js +2 -0
  11. package/dist/index-g3d50jz0.js +74 -0
  12. package/dist/{index-1qxz4s8a.js → index-n7fxqgfb.js} +2 -2
  13. package/dist/{index-rf0ht3gc.js → index-th47aqez.js} +2 -2
  14. package/dist/index-tvban5vp.js +91 -0
  15. package/dist/{index-ya9c5e4m.js → index-x7jzcvqy.js} +1 -1
  16. package/dist/index.d.ts +6 -79
  17. package/dist/index.js +1 -1
  18. package/dist/{port-file-8ElfwDcq.d.ts → port-file-DQ7-ItDK.d.ts} +1 -1
  19. package/dist/{model-D22uj0OB.d.ts → protocol-CVQK-d3j.d.ts} +25 -67
  20. package/dist/rpc/port-file.d.ts +4 -2
  21. package/dist/rpc/port-file.js +1 -1
  22. package/dist/rpc/protocol.d.ts +1 -1
  23. package/dist/rpc/protocol.js +1 -1
  24. package/dist/rpc/rpc-client.d.ts +2 -12
  25. package/dist/rpc/rpc-client.js +1 -1
  26. package/dist/rpc/rpc-dir.js +1 -1
  27. package/dist/rpc-client-BQfIKrXI.d.ts +13 -0
  28. package/dist/{sidebar-state-Bb9L9oPq.d.ts → sidebar-state-B1cq68UB.d.ts} +5 -7
  29. package/dist/sidebar-state.d.ts +2 -2
  30. package/dist/sidebar-state.js +1 -1
  31. package/dist/{token-xtq3457d.js → token-gy442bba.js} +1 -1
  32. package/dist/token-util-rxy0p234.js +1 -0
  33. package/dist/tui-preferences.js +1 -1
  34. package/dist/tui.d.ts +11 -2
  35. package/dist/v2/server.d.ts +15 -7
  36. package/dist/v2/server.js +2 -2
  37. package/package.json +2 -2
  38. package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +95 -11
  39. package/src/tui-compiled/raw/shared/169b2b4bf30909bc-consumer.js +320 -35
  40. package/src/tui-compiled/raw/shared/30f5bc480f31f51c-roster.js +187 -12
  41. package/src/tui-compiled/raw/shared/352d228be2832bd4-hub.js +988 -0
  42. package/src/tui-compiled/raw/shared/458b934e92490331-mutate.js +4 -0
  43. package/src/tui-compiled/raw/shared/81dddd203f1b92a3-quota-writer.js +34 -12
  44. package/src/tui-compiled/raw/shared/836fc615de6afbd9-settings.js +16 -6
  45. package/src/tui-compiled/raw/shared/88b7fc40900fb003-commit-interval.js +18 -0
  46. package/src/tui-compiled/raw/shared/92e38944b51b2405-file-read-cache.js +57 -0
  47. package/src/tui-compiled/raw/shared/a670cb7f5987bc1b-shutdown.js +42 -0
  48. package/src/tui-compiled/raw/shared/b9588ad4725c1d10-enrollment.js +37 -12
  49. package/src/tui-compiled/raw/shared/c852a15cfe489d12-pool.js +1 -1
  50. package/src/tui-compiled/raw/shared/c911dbb64c9d85c7-quota-writer.js +27 -13
  51. package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +20 -11
  52. package/src/tui-compiled/raw/shared/e8d3c8da776ef9cd-index.js +37 -4
  53. package/src/tui-compiled/raw/tui/v2.tsx +88 -6
  54. package/src/tui-compiled/raw/tui.tsx +45 -3
  55. package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +95 -11
  56. package/src/tui-compiled/runtime/shared/169b2b4bf30909bc-consumer.js +320 -35
  57. package/src/tui-compiled/runtime/shared/30f5bc480f31f51c-roster.js +187 -12
  58. package/src/tui-compiled/runtime/shared/352d228be2832bd4-hub.js +988 -0
  59. package/src/tui-compiled/runtime/shared/458b934e92490331-mutate.js +4 -0
  60. package/src/tui-compiled/runtime/shared/81dddd203f1b92a3-quota-writer.js +34 -12
  61. package/src/tui-compiled/runtime/shared/836fc615de6afbd9-settings.js +16 -6
  62. package/src/tui-compiled/runtime/shared/88b7fc40900fb003-commit-interval.js +18 -0
  63. package/src/tui-compiled/runtime/shared/92e38944b51b2405-file-read-cache.js +57 -0
  64. package/src/tui-compiled/runtime/shared/a670cb7f5987bc1b-shutdown.js +42 -0
  65. package/src/tui-compiled/runtime/shared/b9588ad4725c1d10-enrollment.js +37 -12
  66. package/src/tui-compiled/runtime/shared/c852a15cfe489d12-pool.js +1 -1
  67. package/src/tui-compiled/runtime/shared/c911dbb64c9d85c7-quota-writer.js +27 -13
  68. package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +20 -11
  69. package/src/tui-compiled/runtime/shared/e8d3c8da776ef9cd-index.js +37 -4
  70. package/src/tui-compiled/runtime/tui/v2.js +66 -5
  71. package/src/tui-compiled/runtime/tui.js +32 -3
  72. package/dist/index-ge60xry3.js +0 -90
  73. package/dist/index-k5anexvs.js +0 -69
  74. package/dist/index-xpc2hm9h.js +0 -65
  75. package/dist/index-z8bptbrk.js +0 -2
  76. package/dist/protocol-CK9guiFy.d.ts +0 -29
  77. package/dist/token-util-nyvn9866.js +0 -1
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-D_In8uaR.js";
2
- import { S as SidebarState, y as SidebarMachineState } from "./sidebar-state-Bb9L9oPq.js";
1
+ import { _ as parseJwtClaims, a as RESPONSES_LITE_MODELS, g as extractAccountIdFromClaims, h as TokenResponse, l as ResetTargetIdentity, m as IdTokenClaims, n as CODEX_VERSION, o as RuntimeLayoutOptions, s as PoolLifecycleDeps, t as CODEX_USER_AGENT, u as OpenAiVault, v as AccountPaths } from "./codex-request-DohnbsFR.js";
2
+ import { S as SidebarState, y as SidebarMachineState } from "./sidebar-state-B1cq68UB.js";
3
3
  import { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
4
4
  //#region ../core/dist/provider.d.ts
5
5
  type QuotaWindowName = string;
@@ -377,75 +377,6 @@ type AccountStorage = {
377
377
  };
378
378
  declare function loadAccounts(paths: AccountPaths): Promise<AccountStorage | null>;
379
379
  //#endregion
380
- //#region ../core/dist/refresh-all-quota.d.ts
381
- interface RefreshAllQuotaResult {
382
- account: string;
383
- ok: boolean;
384
- error?: string;
385
- /**
386
- * The account cannot recover on its own: the provider has rejected its
387
- * credentials, so no amount of retrying will help until the operator re-adds
388
- * it.
389
- *
390
- * Carried as a flag rather than left for the caller to infer from `error`,
391
- * because sniffing an error string for a user-facing decision breaks the
392
- * moment the wording changes.
393
- */
394
- permanent?: boolean;
395
- }
396
- //#endregion
397
- //#region src/commands.d.ts
398
- /** What the `/openai` menu reads and changes in this process. */
399
- interface OpenCodeMenuContext {
400
- readOnly?: boolean;
401
- allowAction?: OpenAiMenuOptions['allowAction'];
402
- unavailableSections?: OpenAiMenuOptions['unavailableSections'];
403
- accountStoragePath: string;
404
- /** Runtime-state file that goes with `accountStoragePath`. */
405
- accountStatePath: string;
406
- /** Host package version, sent as the version half of the OAuth `User-Agent`. */
407
- packageVersion: string;
408
- /**
409
- * Each account's saved quota windows and applicable reset-credit count, and
410
- * whether it is rate limited now: what the Reset credits section judges
411
- * eligibility and reports a redemption with. OpenCode 2 backs it with its
412
- * account pool instead of a `QuotaManager`.
413
- */
414
- quotaManager?: Pick<QuotaManager, 'isRateLimited' | 'getMain' | 'getFallback'>;
415
- loadAccounts: typeof loadAccounts;
416
- /** The pool store the accounts live in. */
417
- store: () => PoolStore;
418
- /** Whether the install is migrated, and what holds it back when not. */
419
- migration: () => Promise<MenuMigrationState>;
420
- /** Starts an OAuth account-add flow; injected by the runtime boundary. */
421
- beginAccountLogin?: typeof beginAccountLogin;
422
- /** Actively poll quota for every account. */
423
- refreshAllQuota?: () => Promise<RefreshAllQuotaResult[]>;
424
- /** Refresh the sidebar-state file after a change. */
425
- refreshSidebar?: () => Promise<void>;
426
- /** Re-read the pool so requests route across the changed rows at once. */
427
- afterWrite?: () => unknown;
428
- cacheKeepManager?: Pick<CacheKeepManager, 'status' | 'start' | 'stop' | 'remove'> | null;
429
- /** Host-specific limits to show alongside the keep-warm status. */
430
- cacheKeepNotice?: string;
431
- setCacheKeepEnabled?: (enabled: boolean) => void;
432
- setCacheKeepSubagents?: (enabled: boolean) => void;
433
- setCacheKeepSustain?: (enabled: boolean) => void;
434
- setCacheKeepWindow?: (window: {
435
- startHour: number;
436
- endHour: number;
437
- } | undefined) => void;
438
- clearStickyRouting?: (sessionId: string) => Promise<boolean>;
439
- getStickyRouting?: (sessionId: string) => Promise<string | undefined>;
440
- resolveResetTarget?: (accountKey: string) => Promise<ResetTargetIdentity>;
441
- refreshResetTargetQuota?: (accountKey: string) => Promise<RefreshAllQuotaResult>;
442
- fetchImpl?: typeof fetch;
443
- now?: () => number;
444
- randomUUID?: () => string;
445
- /** This host's connection to the Claustrum vault (the Vault section). */
446
- vault?: OpenAiVault;
447
- }
448
- //#endregion
449
380
  //#region src/core/background-quota-refresh.d.ts
450
381
  type TimerHandle = ReturnType<typeof setInterval>;
451
382
  interface BackgroundQuotaRefreshOptions {
@@ -489,6 +420,8 @@ export declare function codexOAuthModelLimit(modelId: string): {
489
420
  input: number;
490
421
  output: number;
491
422
  } | undefined;
423
+ /** Terra supports Sol's reasoning variants before every host catalog knows it. */
424
+ export declare function codexOAuthModelVariantSource(modelId: string): string | undefined;
492
425
  /**
493
426
  * Surfaced when a request would go to the wire with no credential.
494
427
  *
@@ -502,8 +435,6 @@ export declare const EMPTY_BEARER_MESSAGE = "Refusing to send a request with no
502
435
  export declare const getMainRefreshLockName: () => string;
503
436
  export declare const MAIN_REFRESH_LOCK_TTL_MS: number;
504
437
  export declare const MAIN_REFRESH_LEASE_TTL_MS = 90000;
505
- export declare function __bootQuotaSeedPromiseForTest(): Promise<unknown> | undefined;
506
- export declare function __resetBootQuotaSeedForTest(): void;
507
438
  export declare class AuthPersistError extends Error {
508
439
  readonly code = "OPENAI_AUTH_PERSIST_FAILED";
509
440
  constructor(cause: unknown);
@@ -561,14 +492,10 @@ export declare function buildResetRedemptionDeps(): {
561
492
  now: () => number;
562
493
  randomUUID: () => `${string}-${string}-${string}-${string}-${string}`;
563
494
  };
564
- /**
565
- * Test seam: the context the latest loader run gave the `/openai` menu, so a
566
- * test of the loader's live gates (keep-warm, sticky pins) can drive them on
567
- * an install the menu itself would not open on.
568
- */
569
- export declare function __menuContextForTest(): OpenCodeMenuContext | null;
570
495
  export declare const POOL_MIGRATION_ENABLED = true;
571
496
  interface CodexAuthPluginOptions {
497
+ /** Test seams for the one-time move of the runtime files (`core/runtime-layout.ts`). */
498
+ runtimeLayout?: Partial<Omit<RuntimeLayoutOptions, 'version'>>;
572
499
  /**
573
500
  * Test seams for the background account-pool migration and adoption
574
501
  * (`core/pool-lifecycle.ts`): its fence, timers, run functions and
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{$ as p,R as f,S as g,T as h,U as i,V as j,W as k,X as l,Y as m,Z as n,_ as o,aa as q,ba as r,ca as s,da as t,ea as u,fa as v,ga as w,ha as x,ia as y,ja as z,ka as A,la as B,ma as C,n as c,na as D,o as d,oa as E,p as e,pa as F}from"./index-xpc2hm9h.js";import"./index-k5anexvs.js";import"./index-1qxz4s8a.js";import{Wc as a,Xc as b}from"./index-ge60xry3.js";import"./index-8xq099qf.js";import"./index-z8bptbrk.js";import"./index-rf0ht3gc.js";import"./index-b0ty9qam.js";import"./index-7nmdsmpp.js";import"./index-x9nffaye.js";import"./index-ya9c5e4m.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 x,J as f,K as g,L as h,M as i,N as j,O as k,P as l,Q as m,R as n,S as o,T as p,U as q,V as r,W as s,X as t,Y as u,Z as v,_ as w,aa as y,ba as z,ca as A,da as B,ea as C,fa as D,ga as E,ha as F,ia as G,j as c,k as d,l as e}from"./index-3v868rnp.js";import"./index-g3d50jz0.js";import"./index-n7fxqgfb.js";import{dd as a,ed as b}from"./index-tvban5vp.js";import"./index-8pk9savd.js";import"./index-dzaqj248.js";import"./index-th47aqez.js";import"./index-5d4y47h8.js";import"./index-5dxpsa3t.js";import"./index-dtwgf694.js";import"./index-x7jzcvqy.js";export{D as rewriteResponsesLiteBody,B as resolveSidebarSessionId,s as poolResetTarget,a as parseJwtClaims,y as mergePushedQuotaMetadata,l as getMainRefreshLockName,x as findCachekeepFallbackAccount,b as extractAccountIdFromClaims,G as default,t as createResetTargetResolver,j as codexOAuthModelVariantSource,h as codexOAuthModelListed,i as codexOAuthModelLimit,A as buildSidebarState,z as buildSidebarMachineState,u as buildResetRedemptionDeps,p as __resetBootQuotaSeedForTest,v as __menuContextForTest,o as __bootQuotaSeedPromiseForTest,r as ResetTargetResolutionError,c as RESPONSES_LITE_MODELS,w as POOL_MIGRATION_ENABLED,F as OpenAIAuthPlugin,C as MID_CONVERSATION_EFFORT_MODELS,m as MAIN_REFRESH_LOCK_TTL_MS,n as MAIN_REFRESH_LEASE_TTL_MS,k as EMPTY_BEARER_MESSAGE,g as DISALLOWED_MODELS,E as CodexAuthPlugin,d as CODEX_VERSION,e as CODEX_USER_AGENT,q as AuthPersistError,f as ALLOWED_MODELS};
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/rpc/port-file.d.ts
1
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/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
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/commands/model.d.ts
1
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/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];
@@ -167,74 +167,32 @@ interface CommandApplyResult {
167
167
  menu: CommandMenuModel;
168
168
  }
169
169
  type NotifyKind = 'info' | 'warning' | 'error';
170
+ //#endregion
171
+ //#region ../core/dist/protocol.d.ts
172
+ /** The menu, as the slash command opens it in the TUI. */
173
+ type OpenDialogPayload = CommandDialogPayload;
170
174
  /**
171
- * The per-invocation context of one slash-command call. The library reads
172
- * both fields once, when the call starts, and keeps that copy for any work
173
- * the call leaves running (a login completing later, for example), so a host
174
- * that reuses one context object across sessions cannot reroute feedback.
175
+ * A message for the user from work a menu action left running (a login that
176
+ * finishes after the action returned).
175
177
  */
176
- interface CommandInvocation {
178
+ interface NotifyPayload {
179
+ command: string;
180
+ notify: {
181
+ message: string;
182
+ kind: NotifyKind;
183
+ };
184
+ }
185
+ interface RpcNotification {
186
+ id: number;
187
+ type: 'open-dialog';
188
+ payload: OpenDialogPayload | NotifyPayload;
177
189
  sessionId?: string;
178
- notify(message: string, kind?: NotifyKind): void;
179
- }
180
- interface ActionOutcome {
181
- ok: boolean;
182
- text: string;
183
- /** The failure's stable code; a failure without one is `refused`. */
184
- code?: string;
185
- }
186
- interface ActionInput {
187
- values: KnobValues;
188
- /** The item the action sits on; absent for a section-level action. */
189
- itemId?: string;
190
- invocation: CommandInvocation;
191
- }
192
- type ActionBase = {
193
- id: string;
194
- label: string;
195
- description?: string;
196
- /** The header a section-level action is listed under; see `MenuSection`. */
197
- group?: string;
198
- knobs?: MenuKnob[];
199
- run(input: ActionInput): Promise<string | ActionOutcome>;
200
- };
201
- /**
202
- * An action and its body. An irreversible action must name its
203
- * confirmation; a reversible one may.
204
- */
205
- type ActionDefinition = ActionBase & ({
206
- irreversible: true;
207
- confirm: string;
208
- } | {
209
- irreversible?: false;
210
- confirm?: string;
211
- });
212
- interface ItemDefinition {
213
- id: string;
214
- label: string;
215
- detail?: string;
216
- /** The header the item is listed under; see `MenuSection`. */
217
- group?: string;
218
- /** A short value shown right-aligned beside the label. */
219
- status?: string;
220
- facts?: Record<string, unknown>;
221
- actions?: ActionDefinition[];
222
- }
223
- interface SectionContent {
224
- /** Read-only text; renderers never make a line selectable. */
225
- lines?: string[];
226
- items?: ItemDefinition[];
227
- actions?: ActionDefinition[];
228
- facts?: Record<string, unknown>;
229
- }
230
- /** A section a plugin supplies for one of its slots. */
231
- interface PluginSection {
232
- title: string;
233
- build(invocation: CommandInvocation): SectionContent | Promise<SectionContent>;
234
- }
235
- /** A provider extra: a plugin section shown after the fixed slots. */
236
- interface PluginExtraSection extends PluginSection {
237
- id: string;
238
190
  }
191
+ /** One action applied from the drawer. */
192
+ type ApplyRequest = CommandApplyRequest;
193
+ /** Its message and the refreshed menu. */
194
+ type ApplyResult = CommandApplyResult;
195
+ /** Whether a pushed notification is the menu itself or a message. */
196
+ declare function isNotifyPayload(payload: OpenDialogPayload | NotifyPayload): payload is NotifyPayload;
239
197
  //#endregion
240
- export { KnobValues as a, PluginExtraSection as c, CommandInvocation as i, PluginSection as l, CommandApplyResult as n, MenuKnob as o, CommandDialogPayload as r, NotifyKind as s, CommandApplyRequest as t };
198
+ export { RpcNotification as a, OpenDialogPayload as i, ApplyResult as n, isNotifyPayload as o, NotifyPayload as r, ApplyRequest as t };
@@ -1,5 +1,7 @@
1
- import { n as discoverPortFile, r as writePortFile, t as PortFileEntry } from "../port-file-8ElfwDcq.js";
1
+ import { n as discoverPortFile, r as writePortFile$1, t as PortFileEntry } from "../port-file-DQ7-ItDK.js";
2
2
  //#region src/rpc/port-file.d.ts
3
+ /** Stamp the record itself; a heartbeat with the same pid may be stale. */
4
+ export declare function writePortFile(dir: string, entry: Parameters<typeof writePortFile$1>[1], options?: Parameters<typeof writePortFile$1>[2]): Promise<string>;
3
5
  export declare const isOpenaiRpcStateDir: (name: string) => boolean;
4
6
  //#endregion
5
- export { type PortFileEntry, discoverPortFile, writePortFile };
7
+ export { type PortFileEntry, discoverPortFile };
@@ -1 +1 @@
1
- import{De as c}from"../index-z8bptbrk.js";import{Fe as a,He as b}from"../index-rf0ht3gc.js";import"../index-7nmdsmpp.js";import"../index-x9nffaye.js";import"../index-ya9c5e4m.js";export{a as writePortFile,c as isOpenaiRpcStateDir,b as discoverPortFile};
1
+ import{Oe as b,Pe as c}from"../index-dzaqj248.js";import{Te as a}from"../index-th47aqez.js";import"../index-5dxpsa3t.js";import"../index-dtwgf694.js";import"../index-x7jzcvqy.js";export{b as writePortFile,c as isOpenaiRpcStateDir,a 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-CK9guiFy.js";
1
+ import { a as RpcNotification, i as OpenDialogPayload, n as ApplyResult, o as isNotifyPayload, r as NotifyPayload, t as ApplyRequest } from "../protocol-CVQK-d3j.js";
2
2
  export { type ApplyRequest, type ApplyResult, type NotifyPayload, type OpenDialogPayload, type RpcNotification, isNotifyPayload };
@@ -1 +1 @@
1
- import{Ue as b}from"../index-b0ty9qam.js";import"../index-7nmdsmpp.js";import"../index-ya9c5e4m.js";export{b as isNotifyPayload};
1
+ import{ff as b}from"../index-5d4y47h8.js";import"../index-5dxpsa3t.js";import"../index-x7jzcvqy.js";export{b as isNotifyPayload};
@@ -1,12 +1,2 @@
1
- import { a as RpcNotification, n as ApplyResult, t as ApplyRequest } from "../protocol-CK9guiFy.js";
2
- import { t as PortFileEntry } from "../port-file-8ElfwDcq.js";
3
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/rpc/rpc-client.d.ts
4
- export declare const DEFAULT_RPC_TIMEOUT_MS = 2000;
5
- //#endregion
6
- //#region src/rpc/rpc-client.d.ts
7
- export interface RpcClient {
8
- pending: (lastReceivedId: number, sessionId?: string) => Promise<RpcNotification[]>;
9
- apply: (request: ApplyRequest, timeoutMs?: number) => Promise<ApplyResult>;
10
- }
11
- export declare function createRpcClient(dir: string, expectedPid?: number, onSelected?: (entry: PortFileEntry | null) => void): RpcClient;
12
- //#endregion
1
+ import { n as createRpcClient, r as DEFAULT_RPC_TIMEOUT_MS, t as RpcClient } from "../rpc-client-BQfIKrXI.js";
2
+ export { DEFAULT_RPC_TIMEOUT_MS, RpcClient, createRpcClient };
@@ -1 +1 @@
1
- import{Ie as F,Je as f}from"../index-rf0ht3gc.js";import"../index-7nmdsmpp.js";import"../index-ya9c5e4m.js";function y(r,s,v){return f(r,s,v)}export{y as createRpcClient,F as DEFAULT_RPC_TIMEOUT_MS};
1
+ import{Ue as F,Ve as f}from"../index-th47aqez.js";import"../index-5dxpsa3t.js";import"../index-x7jzcvqy.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{ff as a,gf as b,hf as c,if as d}from"../index-x9nffaye.js";import"../index-ya9c5e4m.js";export{a as tmpdir,d as resolveRpcDir,c as getRpcDir,b as RPC_DIRECTORY_PREFIX};
1
+ import{sf as a,tf as b,uf as c,vf as d}from"../index-dtwgf694.js";import"../index-x7jzcvqy.js";export{a as tmpdir,d as resolveRpcDir,c as getRpcDir,b as RPC_DIRECTORY_PREFIX};
@@ -0,0 +1,13 @@
1
+ import { a as RpcNotification, n as ApplyResult, t as ApplyRequest } from "./protocol-CVQK-d3j.js";
2
+ import { t as PortFileEntry } from "./port-file-DQ7-ItDK.js";
3
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/rpc/rpc-client.d.ts
4
+ declare const DEFAULT_RPC_TIMEOUT_MS = 2000;
5
+ //#endregion
6
+ //#region src/rpc/rpc-client.d.ts
7
+ interface RpcClient {
8
+ pending: (lastReceivedId: number, sessionId?: string, timeoutMs?: number) => Promise<RpcNotification[]>;
9
+ apply: (request: ApplyRequest, timeoutMs?: number) => Promise<ApplyResult>;
10
+ }
11
+ declare function createRpcClient(dir: string, expectedPid?: number, onSelected?: (entry: PortFileEntry | null) => void): RpcClient;
12
+ //#endregion
13
+ export { createRpcClient as n, DEFAULT_RPC_TIMEOUT_MS as r, RpcClient as t };
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/logger/engine.d.ts
1
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/logger/engine.d.ts
2
2
  interface ChannelLogger {
3
3
  error(message: string, data?: unknown): void;
4
4
  warn(message: string, data?: unknown): void;
@@ -8,7 +8,7 @@ interface ChannelLogger {
8
8
  }
9
9
  declare function createLogger(channel: string): ChannelLogger;
10
10
  //#endregion
11
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/quota/map.d.ts
11
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/quota/map.d.ts
12
12
  interface QuotaReadingEntry {
13
13
  scope: string;
14
14
  label: string;
@@ -81,7 +81,7 @@ interface QuotaMap {
81
81
  credits?: QuotaCredits;
82
82
  }
83
83
  //#endregion
84
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/quota/projection.d.ts
84
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/quota/projection.d.ts
85
85
  interface ProjectedLimit {
86
86
  scope: string;
87
87
  label: string;
@@ -134,7 +134,7 @@ interface ProjectedQuota {
134
134
  groups?: readonly QuotaGroup[];
135
135
  }
136
136
  //#endregion
137
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/sidebar-file/sidebar-file.d.ts
137
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/sidebar-file/sidebar-file.d.ts
138
138
  interface SidebarFileHooks {
139
139
  /** Runs on the first merge attempt, before checking for older, unlocked writers. */
140
140
  beforeRecheck?: () => void | Promise<void>;
@@ -291,8 +291,6 @@ interface SidebarState {
291
291
  */
292
292
  vaultAccounts?: SidebarAccountState[];
293
293
  }
294
- /** Test seam: point the one-time import at a fixture instead of the temp folder. */
295
- declare function setLegacySidebarStateFileForTest(file: string): void;
296
294
  declare const STICKY_ASSIGNMENT_MAX_AGE_MS: number;
297
295
  declare const STICKY_ASSIGNMENT_MAX_ENTRIES = 256;
298
296
  declare function hashSidebarSessionId(sessionId: string): string;
@@ -547,4 +545,4 @@ interface QuotaPacing {
547
545
  }
548
546
  declare function computeQuotaPacing(window: QuotaWindow, windowMs: number, now: number): QuotaPacing | null;
549
547
  //#endregion
550
- export { planSidebarStickyAssignment as $, StickyPinOverlayEntry as A, exhaustedQuotaResetAt as B, SidebarStateCache as C, StickyAssignmentMap as D, StickyAssignmentChoice as E, computeQuotaPacing as F, getPresentQuotaWindows as G, formatWindowLabel as H, createSidebarBookkeepingQueue as I, hashSidebarSessionId as J, getSidebarState as K, createSidebarStateCache as L, accountServesOnCredits as M, applyStickyPinOverlay as N, StickyAssignmentPlan as O, clearSidebarStickyAssignment as P, persistSidebarStickyAssignment as Q, displayWidth as R, SidebarState as S, StickyAssignment as T, getCollapsedAccountLines as U, fitCollapsedLabel as V, getCollapsedQuotaSummary as W, isUsableRoutingEntry as X, isQuotaExhausted as Y, normalizeSidebarState as Z, SidebarAccountState as _, QuotaMap as _t, ActiveRoutingEntry as a, resolveActiveAccount as at, SidebarRoutingAccount as b, DEFAULT_SIDEBAR_STATE as c, resolveSidebarStickyAssignment as ct, QuotaPacing as d, setSidebarMachineState as dt, planSidebarStickyAssignmentFromSnapshot as et, QuotaWindow as f, setSidebarState as ft, STICKY_ASSIGNMENT_MAX_ENTRIES as g, upsertSidebarActiveRouting as gt, STICKY_ASSIGNMENT_MAX_AGE_MS as h, spendControlExhaustedResetAt as ht, AccountQuota as i, removeSidebarActiveRouting as it, accountCreditsText as j, StickyPinOverlay as k, HOT_PATH_READ_BUDGET_MS as l, setLegacySidebarStateFileForTest as lt, ResolveStickyAssignmentInput as m, sidebarQuotaProjection as mt, ACTIVE_ROUTING_MAX_ENTRIES as n, pruneStickyAssignments as nt, ActiveRoutingMap as o, resolveSessionSidebarRouting as ot, QuotaWindowKey as p, settleWithinBudget as pt, getSidebarStateFile as q, AccountCredits as r, rememberStickyPin as rt, CollapsedAccountLine as s, resolveSessionStickyAccount as st, ACTIVE_ROUTING_MAX_AGE_MS as t, pruneActiveRouting as tt, PresentQuotaWindow as u, setSidebarLegacyRouting as ut, SidebarBookkeepingQueue as v, SpendControlReading as w, SidebarSnapshot as x, SidebarMachineState as y, drainSidebarWrites as z };
548
+ export { planSidebarStickyAssignment as $, StickyPinOverlayEntry as A, exhaustedQuotaResetAt as B, SidebarStateCache as C, StickyAssignmentMap as D, StickyAssignmentChoice as E, computeQuotaPacing as F, getPresentQuotaWindows as G, formatWindowLabel as H, createSidebarBookkeepingQueue as I, hashSidebarSessionId as J, getSidebarState as K, createSidebarStateCache as L, accountServesOnCredits as M, applyStickyPinOverlay as N, StickyAssignmentPlan as O, clearSidebarStickyAssignment as P, persistSidebarStickyAssignment as Q, displayWidth as R, SidebarState as S, StickyAssignment as T, getCollapsedAccountLines as U, fitCollapsedLabel as V, getCollapsedQuotaSummary as W, isUsableRoutingEntry as X, isQuotaExhausted as Y, normalizeSidebarState as Z, SidebarAccountState as _, ActiveRoutingEntry as a, resolveActiveAccount as at, SidebarRoutingAccount as b, DEFAULT_SIDEBAR_STATE as c, resolveSidebarStickyAssignment as ct, QuotaPacing as d, setSidebarState as dt, planSidebarStickyAssignmentFromSnapshot as et, QuotaWindow as f, settleWithinBudget as ft, STICKY_ASSIGNMENT_MAX_ENTRIES as g, QuotaMap as gt, STICKY_ASSIGNMENT_MAX_AGE_MS as h, upsertSidebarActiveRouting as ht, AccountQuota as i, removeSidebarActiveRouting as it, accountCreditsText as j, StickyPinOverlay as k, HOT_PATH_READ_BUDGET_MS as l, setSidebarLegacyRouting as lt, ResolveStickyAssignmentInput as m, spendControlExhaustedResetAt as mt, ACTIVE_ROUTING_MAX_ENTRIES as n, pruneStickyAssignments as nt, ActiveRoutingMap as o, resolveSessionSidebarRouting as ot, QuotaWindowKey as p, sidebarQuotaProjection as pt, getSidebarStateFile as q, AccountCredits as r, rememberStickyPin as rt, CollapsedAccountLine as s, resolveSessionStickyAccount as st, ACTIVE_ROUTING_MAX_AGE_MS as t, pruneActiveRouting as tt, PresentQuotaWindow as u, setSidebarMachineState as ut, SidebarBookkeepingQueue as v, SpendControlReading as w, SidebarSnapshot as x, SidebarMachineState as y, drainSidebarWrites as z };
@@ -1,2 +1,2 @@
1
- import { $ as planSidebarStickyAssignment, A as StickyPinOverlayEntry, B as exhaustedQuotaResetAt, C as SidebarStateCache, D as StickyAssignmentMap, E as StickyAssignmentChoice, F as computeQuotaPacing, G as getPresentQuotaWindows, H as formatWindowLabel, I as createSidebarBookkeepingQueue, J as hashSidebarSessionId, K as getSidebarState, L as createSidebarStateCache, M as accountServesOnCredits, N as applyStickyPinOverlay, O as StickyAssignmentPlan, P as clearSidebarStickyAssignment, Q as persistSidebarStickyAssignment, R as displayWidth, S as SidebarState, T as StickyAssignment, U as getCollapsedAccountLines, V as fitCollapsedLabel, W as getCollapsedQuotaSummary, X as isUsableRoutingEntry, Y as isQuotaExhausted, Z as normalizeSidebarState, _ as SidebarAccountState, a as ActiveRoutingEntry, at as resolveActiveAccount, b as SidebarRoutingAccount, c as DEFAULT_SIDEBAR_STATE, ct as resolveSidebarStickyAssignment, d as QuotaPacing, dt as setSidebarMachineState, et as planSidebarStickyAssignmentFromSnapshot, f as QuotaWindow, ft as setSidebarState, g as STICKY_ASSIGNMENT_MAX_ENTRIES, gt as upsertSidebarActiveRouting, h as STICKY_ASSIGNMENT_MAX_AGE_MS, ht as spendControlExhaustedResetAt, i as AccountQuota, it as removeSidebarActiveRouting, j as accountCreditsText, k as StickyPinOverlay, l as HOT_PATH_READ_BUDGET_MS, lt as setLegacySidebarStateFileForTest, m as ResolveStickyAssignmentInput, mt as sidebarQuotaProjection, n as ACTIVE_ROUTING_MAX_ENTRIES, nt as pruneStickyAssignments, o as ActiveRoutingMap, ot as resolveSessionSidebarRouting, p as QuotaWindowKey, pt as settleWithinBudget, q as getSidebarStateFile, r as AccountCredits, rt as rememberStickyPin, s as CollapsedAccountLine, st as resolveSessionStickyAccount, t as ACTIVE_ROUTING_MAX_AGE_MS, tt as pruneActiveRouting, u as PresentQuotaWindow, ut as setSidebarLegacyRouting, v as SidebarBookkeepingQueue, w as SpendControlReading, x as SidebarSnapshot, y as SidebarMachineState, z as drainSidebarWrites } from "./sidebar-state-Bb9L9oPq.js";
2
- export { ACTIVE_ROUTING_MAX_AGE_MS, ACTIVE_ROUTING_MAX_ENTRIES, AccountCredits, 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, accountCreditsText, accountServesOnCredits, 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
+ import { $ as planSidebarStickyAssignment, A as StickyPinOverlayEntry, B as exhaustedQuotaResetAt, C as SidebarStateCache, D as StickyAssignmentMap, E as StickyAssignmentChoice, F as computeQuotaPacing, G as getPresentQuotaWindows, H as formatWindowLabel, I as createSidebarBookkeepingQueue, J as hashSidebarSessionId, K as getSidebarState, L as createSidebarStateCache, M as accountServesOnCredits, N as applyStickyPinOverlay, O as StickyAssignmentPlan, P as clearSidebarStickyAssignment, Q as persistSidebarStickyAssignment, R as displayWidth, S as SidebarState, T as StickyAssignment, U as getCollapsedAccountLines, V as fitCollapsedLabel, W as getCollapsedQuotaSummary, X as isUsableRoutingEntry, Y as isQuotaExhausted, Z as normalizeSidebarState, _ as SidebarAccountState, a as ActiveRoutingEntry, at as resolveActiveAccount, b as SidebarRoutingAccount, c as DEFAULT_SIDEBAR_STATE, ct as resolveSidebarStickyAssignment, d as QuotaPacing, dt as setSidebarState, et as planSidebarStickyAssignmentFromSnapshot, f as QuotaWindow, ft as settleWithinBudget, g as STICKY_ASSIGNMENT_MAX_ENTRIES, h as STICKY_ASSIGNMENT_MAX_AGE_MS, ht as upsertSidebarActiveRouting, i as AccountQuota, it as removeSidebarActiveRouting, j as accountCreditsText, k as StickyPinOverlay, l as HOT_PATH_READ_BUDGET_MS, lt as setSidebarLegacyRouting, m as ResolveStickyAssignmentInput, mt as spendControlExhaustedResetAt, n as ACTIVE_ROUTING_MAX_ENTRIES, nt as pruneStickyAssignments, o as ActiveRoutingMap, ot as resolveSessionSidebarRouting, p as QuotaWindowKey, pt as sidebarQuotaProjection, q as getSidebarStateFile, r as AccountCredits, rt as rememberStickyPin, s as CollapsedAccountLine, st as resolveSessionStickyAccount, t as ACTIVE_ROUTING_MAX_AGE_MS, tt as pruneActiveRouting, u as PresentQuotaWindow, ut as setSidebarMachineState, v as SidebarBookkeepingQueue, w as SpendControlReading, x as SidebarSnapshot, y as SidebarMachineState, z as drainSidebarWrites } from "./sidebar-state-B1cq68UB.js";
2
+ export { ACTIVE_ROUTING_MAX_AGE_MS, ACTIVE_ROUTING_MAX_ENTRIES, AccountCredits, 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, accountCreditsText, accountServesOnCredits, 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, setSidebarLegacyRouting, setSidebarMachineState, setSidebarState, settleWithinBudget, sidebarQuotaProjection, spendControlExhaustedResetAt, upsertSidebarActiveRouting };
@@ -1 +1 @@
1
- import{$b as v,Gb as a,Hb as b,Ib as c,Jb as d,Kb as e,Lb as f,Mb as g,Nb as h,Ob as i,Pb as j,Qb as k,Rb as l,Sb as m,Tb as n,Ub as o,Vb as p,Wb as q,Xb as r,Yb as s,Zb as t,_b as u,ac as w,bc as x,cc as y,dc as z,ec as A,fc as B,gc as C,hc as D,ic as E,jc as F,kc as G,lc as H,mc as I,nc as J,oc as K,pc as L,qc as M,rc as N,sc as O,tc as P,uc as Q,vc as R,wc as S,xc as T}from"./index-1qxz4s8a.js";import"./index-ge60xry3.js";import"./index-8xq099qf.js";import"./index-b0ty9qam.js";import"./index-7nmdsmpp.js";import"./index-ya9c5e4m.js";export{y as upsertSidebarActiveRouting,p as spendControlExhaustedResetAt,O as sidebarQuotaProjection,I as settleWithinBudget,w as setSidebarState,x as setSidebarMachineState,z as setSidebarLegacyRouting,e as setLegacySidebarStateFileForTest,C as resolveSidebarStickyAssignment,s as resolveSessionStickyAccount,t as resolveSessionSidebarRouting,N as resolveActiveAccount,A as removeSidebarActiveRouting,K as rememberStickyPin,v as pruneStickyAssignments,u as pruneActiveRouting,D as planSidebarStickyAssignmentFromSnapshot,B as planSidebarStickyAssignment,E as persistSidebarStickyAssignment,k as normalizeSidebarState,o as isUsableRoutingEntry,r as isQuotaExhausted,h as hashSidebarSessionId,i as getSidebarStateFile,l as getSidebarState,d as getPresentQuotaWindows,P as getCollapsedQuotaSummary,Q as getCollapsedAccountLines,c as formatWindowLabel,S as fitCollapsedLabel,q as exhaustedQuotaResetAt,G as drainSidebarWrites,R as displayWidth,J as createSidebarStateCache,M as createSidebarBookkeepingQueue,T as computeQuotaPacing,F as clearSidebarStickyAssignment,L as applyStickyPinOverlay,b as accountServesOnCredits,a as accountCreditsText,g as STICKY_ASSIGNMENT_MAX_ENTRIES,f as STICKY_ASSIGNMENT_MAX_AGE_MS,H as HOT_PATH_READ_BUDGET_MS,j as DEFAULT_SIDEBAR_STATE,n as ACTIVE_ROUTING_MAX_ENTRIES,m as ACTIVE_ROUTING_MAX_AGE_MS};
1
+ import{$b as p,Ac as Q,Bc as R,Cc as S,Dc as T,Mb as a,Nb as b,Ob as c,Pb as d,Qb as e,Rb as f,Sb as g,Tb as h,Ub as i,Vb as j,Wb as k,Xb as l,Yb as m,Zb as n,_b as o,ac as q,bc as r,cc as s,dc as t,ec as u,fc as v,gc as w,hc as x,ic as y,jc as z,kc as A,lc as B,mc as C,nc as D,oc as E,pc as F,qc as G,rc as H,sc as I,tc as J,uc as K,vc as L,wc as M,xc as N,yc as O,zc as P}from"./index-n7fxqgfb.js";import"./index-tvban5vp.js";import"./index-8pk9savd.js";import"./index-5d4y47h8.js";import"./index-5dxpsa3t.js";import"./index-x7jzcvqy.js";export{y as upsertSidebarActiveRouting,p as spendControlExhaustedResetAt,O as sidebarQuotaProjection,I as settleWithinBudget,w as setSidebarState,x as setSidebarMachineState,z as setSidebarLegacyRouting,e as setLegacySidebarStateFileForTest,C as resolveSidebarStickyAssignment,s as resolveSessionStickyAccount,t as resolveSessionSidebarRouting,N as resolveActiveAccount,A as removeSidebarActiveRouting,K as rememberStickyPin,v as pruneStickyAssignments,u as pruneActiveRouting,D as planSidebarStickyAssignmentFromSnapshot,B as planSidebarStickyAssignment,E as persistSidebarStickyAssignment,k as normalizeSidebarState,o as isUsableRoutingEntry,r as isQuotaExhausted,h as hashSidebarSessionId,i as getSidebarStateFile,l as getSidebarState,d as getPresentQuotaWindows,P as getCollapsedQuotaSummary,Q as getCollapsedAccountLines,c as formatWindowLabel,S as fitCollapsedLabel,q as exhaustedQuotaResetAt,G as drainSidebarWrites,R as displayWidth,J as createSidebarStateCache,M as createSidebarBookkeepingQueue,T as computeQuotaPacing,F as clearSidebarStickyAssignment,L as applyStickyPinOverlay,b as accountServesOnCredits,a as accountCreditsText,g as STICKY_ASSIGNMENT_MAX_ENTRIES,f as STICKY_ASSIGNMENT_MAX_AGE_MS,H as HOT_PATH_READ_BUDGET_MS,j as DEFAULT_SIDEBAR_STATE,n as ACTIVE_ROUTING_MAX_ENTRIES,m as ACTIVE_ROUTING_MAX_AGE_MS};
@@ -1 +1 @@
1
- import{a as U,b as V}from"./index-jkpg9d1p.js";import{jf as R}from"./index-ya9c5e4m.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-cbcka7sa.js";import{wf as R}from"./index-x7jzcvqy.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();
@@ -0,0 +1 @@
1
+ import{b as a}from"./index-cbcka7sa.js";import"./index-x7jzcvqy.js";export default a();
@@ -1,4 +1,4 @@
1
- import{qe as h,we as u,xe as P}from"./index-8xq099qf.js";import{We as M,Xe as R,af as S}from"./index-7nmdsmpp.js";import"./index-ya9c5e4m.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{Ge as u,He as P,ze as h}from"./index-8pk9savd.js";import{hf as M,if as R,nf as S}from"./index-5dxpsa3t.js";import"./index-x7jzcvqy.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,6 @@
1
- import { S as SidebarState, d as QuotaPacing, f as QuotaWindow, i as AccountQuota, w as SpendControlReading } from "./sidebar-state-Bb9L9oPq.js";
2
- import { i as OpenDialogPayload, n as ApplyResult, t as ApplyRequest } from "./protocol-CK9guiFy.js";
1
+ import { i as OpenDialogPayload, n as ApplyResult, t as ApplyRequest } from "./protocol-CVQK-d3j.js";
2
+ import { S as SidebarState, d as QuotaPacing, f as QuotaWindow, i as AccountQuota, w as SpendControlReading } from "./sidebar-state-B1cq68UB.js";
3
+ import { t as RpcClient } from "./rpc-client-BQfIKrXI.js";
3
4
  import { Plugin } from "@opencode/plugin/tui";
4
5
  import { TuiPluginApi, TuiPluginModule } from "@opencode-ai/plugin/tui";
5
6
  import { JSX } from "solid-js";
@@ -14,6 +15,14 @@ interface TuiTransportOptions {
14
15
  dispose(): void;
15
16
  };
16
17
  openDialog?: (payload: OpenDialogPayload, apply: (request: Omit<ApplyRequest, 'sessionId'>) => Promise<ApplyResult>) => Promise<void>;
18
+ /**
19
+ * Builds the RPC client the poll drains. Tests inject failures here; a
20
+ * host setup that runs again needs its own RPC client.
21
+ */
22
+ createRpcClient?: (dir: string, expectedPid?: number) => RpcClient;
23
+ /** Timer seam so tests can drive poll cycles without wall-clock waits. */
24
+ setIntervalImpl?: typeof globalThis.setInterval;
25
+ clearIntervalImpl?: typeof globalThis.clearInterval;
17
26
  }
18
27
  //#endregion
19
28
  //#region src/tui.d.ts
@@ -1,5 +1,5 @@
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-D_In8uaR.js";
2
- import { i as OpenDialogPayload, n as ApplyResult } from "../protocol-CK9guiFy.js";
1
+ import { c as HostSlotAdapter, d as OpenAiVaultOptions, f as BeginAccountLoginOptions, i as CodexSessionMetadata, o as RuntimeLayoutOptions, p as BeginAccountLoginResult, r as CodexRequestRuntime, s as PoolLifecycleDeps, v as AccountPaths } from "../codex-request-DohnbsFR.js";
2
+ import { i as OpenDialogPayload, n as ApplyResult } from "../protocol-CVQK-d3j.js";
3
3
  import { Plugin } from "@opencode/plugin";
4
4
  import "@opencode/plugin/promise/session";
5
5
  import "@opencode/plugin/promise/integration";
@@ -68,8 +68,10 @@ interface CodexSessionStoreOptions {
68
68
  uuid?: () => string;
69
69
  /** Test seam: runs while the lock is held, after the file was re-read. */
70
70
  afterRead?: () => Promise<void>;
71
- /** Test seam: the lock wait; `LOCK_WAIT_MS` by default. */
71
+ /** Test seam: the lock wait; `CODEX_SESSIONS_LOCK_WAIT_MS` by default. */
72
72
  lockWaitMs?: number;
73
+ /** Test seam: the save delay; `CODEX_SESSIONS_SAVE_DELAY_MS` by default. */
74
+ saveDelayMs?: number;
73
75
  }
74
76
  declare class CodexSessionStore {
75
77
  #private;
@@ -89,12 +91,16 @@ declare class CodexSessionStore {
89
91
  /** Forgets a deleted host session here and, on the next save, in the file. */
90
92
  delete(sessionID: string): void;
91
93
  /**
92
- * Saves this process's changes. Saves run one at a time; changes made while
93
- * one runs go in the next. Never rejects: a lock timeout or write failure
94
- * keeps the changes for the next save.
94
+ * Saves this process's changes now, taking over any delayed save. Saves run
95
+ * one at a time; changes made while one runs go in the next. Never rejects:
96
+ * a lock timeout or write failure keeps the changes for the next save.
95
97
  */
96
98
  save(): Promise<void>;
97
- /** Resolves once every save started so far has finished. */
99
+ /**
100
+ * Starts a delayed save now, if one is waiting, and resolves once every
101
+ * save has finished. The plugin's shutdown awaits this, so stopping never
102
+ * drops changes still inside the save delay.
103
+ */
98
104
  settled(): Promise<void>;
99
105
  }
100
106
  //#endregion
@@ -209,6 +215,8 @@ interface OpenAIAuthV2Options {
209
215
  poolMigration?: boolean;
210
216
  /** Whether to write this process's heartbeat (other processes' fence reads it). */
211
217
  heartbeat?: boolean;
218
+ /** Test seams for the one-time move of the runtime files (`core/runtime-layout.ts`). */
219
+ runtimeLayout?: Partial<Omit<RuntimeLayoutOptions, 'version'>>;
212
220
  /** The vault's directory and connections; the production ones by default. */
213
221
  vault?: Partial<Pick<OpenAiVaultOptions, 'stateDir' | 'connectionFile' | 'connectScoped' | 'connectEnrollment' | 'pollIntervalMs'>> & {
214
222
  /**