@cortexkit/opencode-openai-auth 1.0.5 → 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.
- package/dist/bin.js +9 -8
- package/dist/{pool-lifecycle-C_6YRmsh.d.ts → codex-request-CjXETpTA.d.ts} +190 -27
- package/dist/index-03em8hv1.js +69 -0
- package/dist/index-6n4pnfkg.js +2 -0
- package/dist/{index-pg305s90.js → index-bc89akak.js} +1 -1
- package/dist/{index-y4gxyxqd.js → index-ehjj89rx.js} +2 -2
- package/dist/index-f21addzm.js +90 -0
- package/dist/{index-fsky1rsh.js → index-ffg0sgg5.js} +2 -2
- package/dist/{index-nx2qh047.js → index-ftkhhr6d.js} +1 -1
- package/dist/{index-826s1yxa.js → index-htvcmtcx.js} +2 -2
- package/dist/{index-fsxbncpw.js → index-qp5hdpw8.js} +1 -1
- package/dist/index-qxbchh2d.js +8 -0
- package/dist/{index-116q849r.js → index-r2s51ac1.js} +2 -2
- package/dist/index-rwbrhkse.js +65 -0
- package/dist/{index-66asrje2.js → index-xwvze96g.js} +1 -1
- package/dist/index.d.ts +18 -8
- package/dist/index.js +1 -1
- package/dist/{protocol-DctqemRI.d.ts → model-CQcw10oW.d.ts} +67 -25
- package/dist/{port-file-ZPlxXB4G.d.ts → port-file-BDJnzgHH.d.ts} +1 -1
- package/dist/protocol-C-kagE6O.d.ts +29 -0
- package/dist/rpc/port-file.d.ts +1 -1
- package/dist/rpc/port-file.js +1 -1
- package/dist/rpc/protocol.d.ts +1 -1
- package/dist/rpc/protocol.js +1 -1
- package/dist/rpc/rpc-client.d.ts +3 -3
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/rpc/rpc-dir.js +1 -1
- package/dist/{sidebar-state-z_M7Trnd.d.ts → sidebar-state-BfQ4mpZO.d.ts} +109 -10
- package/dist/sidebar-state.d.ts +2 -2
- package/dist/sidebar-state.js +1 -1
- package/dist/token-util-cf0nyh7n.js +1 -0
- package/dist/{token-bzhkgc29.js → token-z6qq7a1d.js} +1 -1
- package/dist/tui-preferences.js +1 -1
- package/dist/tui.d.ts +20 -2
- package/dist/v2/server.d.ts +180 -1
- package/dist/v2/server.js +3 -3
- package/package.json +3 -3
- package/src/tui-compiled/raw/shared/0332701351b3eeec-format.js +148 -26
- package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +371 -0
- package/src/tui-compiled/raw/shared/134b008900698fe0-backoff.js +92 -0
- package/src/tui-compiled/raw/shared/169b2b4bf30909bc-consumer.js +430 -0
- package/src/tui-compiled/raw/shared/2577ec69f9973ae9-quota-normalize.js +154 -0
- package/src/tui-compiled/raw/shared/2dce6e9613993329-quota-manager.js +473 -0
- package/src/tui-compiled/raw/shared/30f5bc480f31f51c-roster.js +566 -0
- package/src/tui-compiled/raw/shared/43fc9e6b994519c7-refresh-lock.js +0 -1
- package/src/tui-compiled/raw/shared/4593a4d71edf69fd-tombstone.js +25 -0
- package/src/tui-compiled/raw/shared/4d05c2d7a531aece-oauth.js +500 -0
- package/src/tui-compiled/raw/shared/6371b24a0573d79e-any-signal.js +42 -0
- package/src/tui-compiled/raw/shared/7c140680fc81be92-interlock.js +29 -0
- package/src/tui-compiled/raw/shared/85512cc5263ba259-provider.js +87 -0
- package/src/tui-compiled/raw/shared/abd062d633e29fd2-pool-routing.js +192 -0
- package/src/tui-compiled/raw/shared/b9588ad4725c1d10-enrollment.js +806 -0
- package/src/tui-compiled/raw/shared/bfbdd0f9aae56b47-pool-quota.js +85 -0
- package/src/tui-compiled/raw/shared/c852a15cfe489d12-pool.js +0 -1
- package/src/tui-compiled/raw/shared/ca0fccaba1d87af4-errors.js +8 -0
- package/src/tui-compiled/raw/shared/d0f0b6be200311af-insula.js +152 -0
- package/src/tui-compiled/raw/shared/d5a8f1061ee2f114-index.js +1 -1
- package/src/tui-compiled/raw/shared/d9d2892a4c371301-host-slot.js +72 -0
- package/src/tui-compiled/raw/shared/dbc61cd405941828-accounts.js +1470 -0
- package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +26 -12
- package/src/tui-compiled/raw/shared/e8d3c8da776ef9cd-index.js +24 -0
- package/src/tui-compiled/raw/sidebar-state.js +103 -14
- package/src/tui-compiled/raw/tui/command-dialogs.tsx +3 -34
- package/src/tui-compiled/raw/tui/section-text.js +21 -0
- package/src/tui-compiled/raw/tui/v2-dialog.js +137 -0
- package/src/tui-compiled/raw/tui/v2.tsx +133 -0
- package/src/tui-compiled/raw/tui.tsx +228 -70
- package/src/tui-compiled/runtime/shared/0332701351b3eeec-format.js +148 -26
- package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +371 -0
- package/src/tui-compiled/runtime/shared/134b008900698fe0-backoff.js +92 -0
- package/src/tui-compiled/runtime/shared/169b2b4bf30909bc-consumer.js +430 -0
- package/src/tui-compiled/runtime/shared/2577ec69f9973ae9-quota-normalize.js +154 -0
- package/src/tui-compiled/runtime/shared/2dce6e9613993329-quota-manager.js +473 -0
- package/src/tui-compiled/runtime/shared/30f5bc480f31f51c-roster.js +566 -0
- package/src/tui-compiled/runtime/shared/43fc9e6b994519c7-refresh-lock.js +0 -1
- package/src/tui-compiled/runtime/shared/4593a4d71edf69fd-tombstone.js +25 -0
- package/src/tui-compiled/runtime/shared/4d05c2d7a531aece-oauth.js +500 -0
- package/src/tui-compiled/runtime/shared/6371b24a0573d79e-any-signal.js +42 -0
- package/src/tui-compiled/runtime/shared/7c140680fc81be92-interlock.js +29 -0
- package/src/tui-compiled/runtime/shared/85512cc5263ba259-provider.js +87 -0
- package/src/tui-compiled/runtime/shared/abd062d633e29fd2-pool-routing.js +192 -0
- package/src/tui-compiled/runtime/shared/b9588ad4725c1d10-enrollment.js +806 -0
- package/src/tui-compiled/runtime/shared/bfbdd0f9aae56b47-pool-quota.js +85 -0
- package/src/tui-compiled/runtime/shared/c852a15cfe489d12-pool.js +0 -1
- package/src/tui-compiled/runtime/shared/ca0fccaba1d87af4-errors.js +8 -0
- package/src/tui-compiled/runtime/shared/d0f0b6be200311af-insula.js +152 -0
- package/src/tui-compiled/runtime/shared/d5a8f1061ee2f114-index.js +1 -1
- package/src/tui-compiled/runtime/shared/d9d2892a4c371301-host-slot.js +72 -0
- package/src/tui-compiled/runtime/shared/dbc61cd405941828-accounts.js +1470 -0
- package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +26 -12
- package/src/tui-compiled/runtime/shared/e8d3c8da776ef9cd-index.js +24 -0
- package/src/tui-compiled/runtime/sidebar-state.js +103 -14
- package/src/tui-compiled/runtime/tui/command-dialogs.js +3 -15
- package/src/tui-compiled/runtime/tui/section-text.js +21 -0
- package/src/tui-compiled/runtime/tui/v2-dialog.js +137 -0
- package/src/tui-compiled/runtime/tui/v2.js +95 -0
- package/src/tui-compiled/runtime/tui.js +351 -222
- package/dist/index-4fnghj9e.js +0 -65
- package/dist/index-a69gr76b.js +0 -2
- package/dist/index-h263aftt.js +0 -157
- package/dist/index-ssj7m2rd.js +0 -8
- package/dist/index-ydz3hbhc.js +0 -2
- package/dist/map-m6f5a_IA.d.ts +0 -56
- package/dist/token-util-4a2xxnpg.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
|
|
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 { a as
|
|
2
|
-
import {
|
|
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;
|
|
@@ -389,12 +389,21 @@ interface RefreshAllQuotaResult {
|
|
|
389
389
|
//#region src/commands.d.ts
|
|
390
390
|
/** What the `/openai` menu reads and changes in this process. */
|
|
391
391
|
interface OpenCodeMenuContext {
|
|
392
|
+
readOnly?: boolean;
|
|
393
|
+
allowAction?: OpenAiMenuOptions['allowAction'];
|
|
394
|
+
unavailableSections?: OpenAiMenuOptions['unavailableSections'];
|
|
392
395
|
accountStoragePath: string;
|
|
393
396
|
/** Runtime-state file that goes with `accountStoragePath`. */
|
|
394
397
|
accountStatePath: string;
|
|
395
398
|
/** Host package version, sent as the version half of the OAuth `User-Agent`. */
|
|
396
399
|
packageVersion: string;
|
|
397
|
-
|
|
400
|
+
/**
|
|
401
|
+
* Each account's saved quota windows and applicable reset-credit count, and
|
|
402
|
+
* whether it is rate limited now: what the Reset credits section judges
|
|
403
|
+
* eligibility and reports a redemption with. OpenCode 2 backs it with its
|
|
404
|
+
* account pool instead of a `QuotaManager`.
|
|
405
|
+
*/
|
|
406
|
+
quotaManager?: Pick<QuotaManager, 'isRateLimited' | 'getMain' | 'getFallback'>;
|
|
398
407
|
loadAccounts: typeof loadAccounts;
|
|
399
408
|
/** The pool store the accounts live in. */
|
|
400
409
|
store: () => PoolStore;
|
|
@@ -408,7 +417,9 @@ interface OpenCodeMenuContext {
|
|
|
408
417
|
refreshSidebar?: () => Promise<void>;
|
|
409
418
|
/** Re-read the pool so requests route across the changed rows at once. */
|
|
410
419
|
afterWrite?: () => unknown;
|
|
411
|
-
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;
|
|
412
423
|
setCacheKeepEnabled?: (enabled: boolean) => void;
|
|
413
424
|
setCacheKeepSubagents?: (enabled: boolean) => void;
|
|
414
425
|
setCacheKeepSustain?: (enabled: boolean) => void;
|
|
@@ -480,9 +491,6 @@ export declare function codexOAuthModelLimit(modelId: string): {
|
|
|
480
491
|
* transport log.
|
|
481
492
|
*/
|
|
482
493
|
export declare const EMPTY_BEARER_MESSAGE = "Refusing to send a request with no access token. This is a defect in the plugin, not a problem with the provider or the account; the transport log names the account and the path that produced it.";
|
|
483
|
-
export declare const RESPONSES_LITE_MODELS: ReadonlySet<string>;
|
|
484
|
-
export declare const CODEX_VERSION = "0.159.0";
|
|
485
|
-
export declare const CODEX_USER_AGENT = "codex_exec/0.159.0 (Debian 12.0.0; aarch64) unknown (codex_exec; 0.159.0)";
|
|
486
494
|
export declare const getMainRefreshLockName: () => string;
|
|
487
495
|
export declare const MAIN_REFRESH_LOCK_TTL_MS: number;
|
|
488
496
|
export declare const MAIN_REFRESH_LEASE_TTL_MS = 90000;
|
|
@@ -537,6 +545,8 @@ export interface PoolResetAccess {
|
|
|
537
545
|
};
|
|
538
546
|
token?: string;
|
|
539
547
|
}
|
|
548
|
+
/** The reset target for a pool row, or the refusal the legacy resolver gives. */
|
|
549
|
+
export declare function poolResetTarget(accountKey: string, pooled: PoolResetAccess): ResetTargetIdentity;
|
|
540
550
|
export declare function createResetTargetResolver(deps: ResetTargetResolverDeps): (accountKey: string) => Promise<ResetTargetIdentity>;
|
|
541
551
|
export declare function buildResetRedemptionDeps(): {
|
|
542
552
|
fetchImpl: typeof fetch;
|
|
@@ -611,4 +621,4 @@ declare const _default: {
|
|
|
611
621
|
server: Plugin;
|
|
612
622
|
};
|
|
613
623
|
//#endregion
|
|
614
|
-
export { type IdTokenClaims, _default as default, extractAccountIdFromClaims, parseJwtClaims };
|
|
624
|
+
export { CODEX_USER_AGENT, CODEX_VERSION, type IdTokenClaims, RESPONSES_LITE_MODELS, _default as default, extractAccountIdFromClaims, parseJwtClaims };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as
|
|
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.
|
|
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];
|
|
@@ -167,32 +167,74 @@ 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;
|
|
174
170
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
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.
|
|
177
175
|
*/
|
|
178
|
-
interface
|
|
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;
|
|
176
|
+
interface CommandInvocation {
|
|
189
177
|
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;
|
|
190
238
|
}
|
|
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;
|
|
197
239
|
//#endregion
|
|
198
|
-
export {
|
|
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
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;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { n as CommandApplyResult, r as CommandDialogPayload, s as NotifyKind, t as CommandApplyRequest } from "./model-CQcw10oW.js";
|
|
2
|
+
//#region ../core/dist/protocol.d.ts
|
|
3
|
+
/** The menu, as the slash command opens it in the TUI. */
|
|
4
|
+
type OpenDialogPayload = CommandDialogPayload;
|
|
5
|
+
/**
|
|
6
|
+
* A message for the user from work a menu action left running (a login that
|
|
7
|
+
* finishes after the action returned).
|
|
8
|
+
*/
|
|
9
|
+
interface NotifyPayload {
|
|
10
|
+
command: string;
|
|
11
|
+
notify: {
|
|
12
|
+
message: string;
|
|
13
|
+
kind: NotifyKind;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
interface RpcNotification {
|
|
17
|
+
id: number;
|
|
18
|
+
type: 'open-dialog';
|
|
19
|
+
payload: OpenDialogPayload | NotifyPayload;
|
|
20
|
+
sessionId?: string;
|
|
21
|
+
}
|
|
22
|
+
/** One action applied from the drawer. */
|
|
23
|
+
type ApplyRequest = CommandApplyRequest;
|
|
24
|
+
/** Its message and the refreshed menu. */
|
|
25
|
+
type ApplyResult = CommandApplyResult;
|
|
26
|
+
/** Whether a pushed notification is the menu itself or a message. */
|
|
27
|
+
declare function isNotifyPayload(payload: OpenDialogPayload | NotifyPayload): payload is NotifyPayload;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { RpcNotification as a, OpenDialogPayload as i, ApplyResult as n, isNotifyPayload as o, NotifyPayload as r, ApplyRequest as t };
|
package/dist/rpc/port-file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as discoverPortFile, r as writePortFile, t as PortFileEntry } from "../port-file-
|
|
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
|
package/dist/rpc/port-file.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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};
|
package/dist/rpc/protocol.d.ts
CHANGED
|
@@ -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-
|
|
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 };
|
package/dist/rpc/protocol.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ne as b}from"../index-ehjj89rx.js";import"../index-r2s51ac1.js";import"../index-xwvze96g.js";export{b as isNotifyPayload};
|
package/dist/rpc/rpc-client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as RpcNotification, n as ApplyResult, t as ApplyRequest } from "../protocol-
|
|
2
|
-
import { t as PortFileEntry } from "../port-file-
|
|
3
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
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
|
package/dist/rpc/rpc-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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};
|
package/dist/rpc/rpc-dir.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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
|
-
|
|
2
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.1+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.
|
|
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.
|
|
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>;
|
|
@@ -92,12 +146,17 @@ interface PresentQuotaWindow {
|
|
|
92
146
|
declare function getPresentQuotaWindows(quota: AccountQuota | null): PresentQuotaWindow[];
|
|
93
147
|
interface SidebarAccountState {
|
|
94
148
|
id: string;
|
|
149
|
+
/** Vault credential name, used only to identify its default OpenAI account. */
|
|
150
|
+
credentialId?: string;
|
|
95
151
|
label: string | undefined;
|
|
96
152
|
/** ChatGPT identity of the account this quota belongs to. */
|
|
97
153
|
accountId?: string;
|
|
98
154
|
quota: AccountQuota | null;
|
|
99
155
|
killed: boolean;
|
|
100
156
|
enabled: boolean;
|
|
157
|
+
/** Whether the vault can serve this row now; `enabled` is the /openai toggle. */
|
|
158
|
+
routable?: boolean;
|
|
159
|
+
vaultState?: 'needs sign-in' | 'turned off in vault' | 'unavailable';
|
|
101
160
|
resetCredits?: number;
|
|
102
161
|
}
|
|
103
162
|
interface ActiveRoutingEntry {
|
|
@@ -158,13 +217,13 @@ interface SidebarState {
|
|
|
158
217
|
*/
|
|
159
218
|
accountPool?: boolean;
|
|
160
219
|
/**
|
|
161
|
-
* Present while the host
|
|
162
|
-
*
|
|
220
|
+
* Present while the host uses the credential vault instead of local logins:
|
|
221
|
+
* the vault accounts that serve instead of the local accounts, in
|
|
163
222
|
* the vault's order. `main` then carries no account and `fallbacks` is
|
|
164
223
|
* empty, so a reader that does not know this field shows no local account.
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
224
|
+
* `enabled` is the host's own toggle, while `routable` and `vaultState`
|
|
225
|
+
* describe vault availability independently. Each entry's `label` is the
|
|
226
|
+
* account's email when the vault knows it, else the vault's label.
|
|
168
227
|
*/
|
|
169
228
|
vaultAccounts?: SidebarAccountState[];
|
|
170
229
|
}
|
|
@@ -192,6 +251,7 @@ type SidebarRoutingAccount = {
|
|
|
192
251
|
id: string;
|
|
193
252
|
enabled?: boolean;
|
|
194
253
|
killed?: boolean;
|
|
254
|
+
routable?: boolean;
|
|
195
255
|
};
|
|
196
256
|
declare function isUsableRoutingEntry(entry: ActiveRoutingEntry, accounts: readonly SidebarRoutingAccount[] | undefined, now?: number): boolean;
|
|
197
257
|
declare function spendControlExhaustedResetAt(quota: AccountQuota | null | undefined, now?: number): {
|
|
@@ -376,6 +436,45 @@ declare function getCollapsedQuotaSummary(quota: AccountQuota | null, now?: numb
|
|
|
376
436
|
secondaryUsedPercent: number | null;
|
|
377
437
|
text: string | null;
|
|
378
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;
|
|
379
478
|
interface QuotaPacing {
|
|
380
479
|
pacePercent: number;
|
|
381
480
|
deltaPercent: number;
|
|
@@ -384,4 +483,4 @@ interface QuotaPacing {
|
|
|
384
483
|
}
|
|
385
484
|
declare function computeQuotaPacing(window: QuotaWindow, windowMs: number, now: number): QuotaPacing | null;
|
|
386
485
|
//#endregion
|
|
387
|
-
export {
|
|
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 };
|
package/dist/sidebar-state.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
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 };
|
package/dist/sidebar-state.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$c as
|
|
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-
|
|
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();
|
package/dist/tui-preferences.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
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,6 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
+
import { Plugin } from "@opencode/plugin/tui";
|
|
3
4
|
import { TuiPluginModule } from "@opencode-ai/plugin/tui";
|
|
5
|
+
import { JSX } from "solid-js";
|
|
6
|
+
//#region src/tui/v2.d.ts
|
|
7
|
+
interface TuiTransportOptions {
|
|
8
|
+
/** Test-only label for proving that the host can render a sidebar component. */
|
|
9
|
+
sidebarText?: string;
|
|
10
|
+
sidebar?: {
|
|
11
|
+
render(input: {
|
|
12
|
+
sessionID: string;
|
|
13
|
+
}): JSX.Element;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
};
|
|
16
|
+
openDialog?: (payload: OpenDialogPayload, apply: (request: Omit<ApplyRequest, 'sessionId'>) => Promise<ApplyResult>) => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
4
19
|
//#region src/tui.d.ts
|
|
5
20
|
/** One drawer action as the RPC apply request carries it, with its session. */
|
|
6
21
|
export declare function buildApplyRequest(request: Omit<ApplyRequest, 'sessionId'>, sessionId?: string): ApplyRequest;
|
|
@@ -11,6 +26,7 @@ export interface QuotaDisplayRow {
|
|
|
11
26
|
label: string;
|
|
12
27
|
labelWidth: number;
|
|
13
28
|
text: string;
|
|
29
|
+
resetText?: string;
|
|
14
30
|
window: QuotaWindow;
|
|
15
31
|
pacing: QuotaPacing | null;
|
|
16
32
|
}
|
|
@@ -56,8 +72,10 @@ export interface RoutingDisplayRow {
|
|
|
56
72
|
tone: Tone;
|
|
57
73
|
}
|
|
58
74
|
export declare function buildRoutingRowsForDisplay(state: SidebarState, sessionId: string | undefined, now?: number): RoutingDisplayRow[];
|
|
75
|
+
declare function setup(context: Plugin.Context, options?: TuiTransportOptions): Promise<() => void>;
|
|
59
76
|
declare const plugin: TuiPluginModule & {
|
|
60
77
|
id: string;
|
|
78
|
+
setup: typeof setup;
|
|
61
79
|
};
|
|
62
80
|
//#endregion
|
|
63
81
|
export { plugin as default };
|