@cortexkit/opencode-openai-auth 1.7.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +9 -9
- package/dist/{codex-request-CN4rD2kf.d.ts → codex-request-GJkvxv4S.d.ts} +51 -57
- package/dist/{index-b5459de4.js → index-21yxzeet.js} +2 -2
- package/dist/index-4rf3rkdm.js +2 -0
- package/dist/{index-dr93b3g6.js → index-73z9ftrg.js} +6 -6
- package/dist/index-97cz7kyq.js +74 -0
- package/dist/index-b7p76qqa.js +91 -0
- package/dist/{index-r4avvxf0.js → index-c50p5mem.js} +1 -1
- package/dist/{index-p9vnmnzr.js → index-fhcnxrtz.js} +1 -1
- package/dist/{index-7zy4vdd3.js → index-h1r8cbet.js} +2 -2
- package/dist/{index-jaqm1xda.js → index-hpnj460b.js} +1 -1
- package/dist/{index-yayz83vv.js → index-mg4w434p.js} +2 -2
- package/dist/{index-g08eptzm.js → index-p8m4yh73.js} +1 -1
- package/dist/index-vh1sr50d.js +63 -0
- package/dist/index-ww8w9edq.js +2 -0
- package/dist/index.d.ts +4 -12
- package/dist/index.js +1 -1
- package/dist/{port-file-8ElfwDcq.d.ts → port-file-DXCxv8tU.d.ts} +0 -2
- package/dist/{protocol-BeeDdtpa.d.ts → protocol-BZZtDn5h.d.ts} +0 -4
- package/dist/rpc/port-file.d.ts +4 -4
- 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 +1 -1
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/rpc/rpc-dir.d.ts +0 -2
- package/dist/rpc/rpc-dir.js +1 -1
- package/dist/{rpc-client-DlR9a0_7.d.ts → rpc-client-CmaZW1by.d.ts} +2 -6
- package/dist/{sidebar-state-DHsZ9axt.d.ts → sidebar-state-DkNebAiC.d.ts} +3 -11
- package/dist/sidebar-state.d.ts +1 -1
- package/dist/sidebar-state.js +1 -1
- package/dist/{token-511npvw8.js → token-3vtr29vt.js} +1 -1
- package/dist/token-util-erhrf24m.js +1 -0
- package/dist/tui-preferences.d.ts +0 -2
- package/dist/tui-preferences.js +1 -1
- package/dist/tui.d.ts +3 -7
- package/dist/v2/server.d.ts +15 -23
- package/dist/v2/server.js +2 -2
- package/package.json +6 -6
- package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +95 -11
- package/src/tui-compiled/raw/shared/169b2b4bf30909bc-consumer.js +320 -35
- package/src/tui-compiled/raw/shared/30f5bc480f31f51c-roster.js +187 -12
- package/src/tui-compiled/raw/shared/352d228be2832bd4-hub.js +988 -0
- package/src/tui-compiled/raw/shared/458b934e92490331-mutate.js +4 -0
- package/src/tui-compiled/raw/shared/81dddd203f1b92a3-quota-writer.js +34 -12
- package/src/tui-compiled/raw/shared/836fc615de6afbd9-settings.js +16 -6
- package/src/tui-compiled/raw/shared/88b7fc40900fb003-commit-interval.js +18 -0
- package/src/tui-compiled/raw/shared/92e38944b51b2405-file-read-cache.js +57 -0
- package/src/tui-compiled/raw/shared/a670cb7f5987bc1b-shutdown.js +42 -0
- package/src/tui-compiled/raw/shared/b9588ad4725c1d10-enrollment.js +37 -12
- package/src/tui-compiled/raw/shared/c852a15cfe489d12-pool.js +1 -1
- package/src/tui-compiled/raw/shared/c911dbb64c9d85c7-quota-writer.js +27 -13
- package/src/tui-compiled/raw/shared/dbc61cd405941828-accounts.js +42 -0
- package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +20 -11
- package/src/tui-compiled/raw/shared/e8d3c8da776ef9cd-index.js +37 -4
- package/src/tui-compiled/raw/sidebar-state.js +4 -2
- package/src/tui-compiled/raw/tui.tsx +7 -1
- package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +95 -11
- package/src/tui-compiled/runtime/shared/169b2b4bf30909bc-consumer.js +320 -35
- package/src/tui-compiled/runtime/shared/30f5bc480f31f51c-roster.js +187 -12
- package/src/tui-compiled/runtime/shared/352d228be2832bd4-hub.js +988 -0
- package/src/tui-compiled/runtime/shared/458b934e92490331-mutate.js +4 -0
- package/src/tui-compiled/runtime/shared/81dddd203f1b92a3-quota-writer.js +34 -12
- package/src/tui-compiled/runtime/shared/836fc615de6afbd9-settings.js +16 -6
- package/src/tui-compiled/runtime/shared/88b7fc40900fb003-commit-interval.js +18 -0
- package/src/tui-compiled/runtime/shared/92e38944b51b2405-file-read-cache.js +57 -0
- package/src/tui-compiled/runtime/shared/a670cb7f5987bc1b-shutdown.js +42 -0
- package/src/tui-compiled/runtime/shared/b9588ad4725c1d10-enrollment.js +37 -12
- package/src/tui-compiled/runtime/shared/c852a15cfe489d12-pool.js +1 -1
- package/src/tui-compiled/runtime/shared/c911dbb64c9d85c7-quota-writer.js +27 -13
- package/src/tui-compiled/runtime/shared/dbc61cd405941828-accounts.js +42 -0
- package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +20 -11
- package/src/tui-compiled/runtime/shared/e8d3c8da776ef9cd-index.js +37 -4
- package/src/tui-compiled/runtime/sidebar-state.js +4 -2
- package/src/tui-compiled/runtime/tui.js +4 -1
- package/dist/index-0p3cbtwq.js +0 -2
- package/dist/index-2e2kqmsy.js +0 -2
- package/dist/index-apkavdvq.js +0 -90
- package/dist/index-qg2syg0r.js +0 -65
- package/dist/index-se9ykks8.js +0 -69
- package/dist/token-util-jsw1zdc6.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Re as w,Se as O,Te as k}from"./index-21yxzeet.js";import{jf as h,of as D}from"./index-mg4w434p.js";import{uf as j}from"./index-c50p5mem.js";class g extends Error{operation;constructor(f){super(`a ${f} on a strict notification scope needs a session id`);this.name="RpcSessionRequiredError",this.operation=f}}function M(f){return typeof f==="string"&&f.length>0}var U=new Map;function y(f){let x=JSON.stringify([f.rpcRoot,f.directoryPrefix,f.registrationSessionId,...f.requireSession===!0?["strict"]:[]]),z=U.get(x);if(!z)z={queue:[],nextId:1,lastDrainAtBySession:new Map,lastDrainAtAny:0},U.set(x,z);return z}var m=100,t=3000;function i(f,x,z){if(f.requireSession===!0&&!M(z))throw new g("push");let H=y(f);if(H.queue.push({id:H.nextId++,type:"open-dialog",payload:x,sessionId:z}),H.queue.length>m)H.queue=H.queue.slice(-m)}function n(f,x=0,z){if(f.requireSession===!0&&!M(z))throw new g("drain");let H=y(f),Y=Date.now();if(H.lastDrainAtAny=Y,z!==void 0)H.lastDrainAtBySession.set(z,Y);let Z=f.sessionlessDrain==="broadcast-only",L=(B)=>z===void 0?!Z||B.sessionId===void 0:B.sessionId===void 0||B.sessionId===z;if(x>0)H.queue=H.queue.filter((B)=>{if(B.id>x)return!0;if(z===void 0)return!Z||B.sessionId!==void 0;return B.sessionId!==z});return H.queue.filter((B)=>B.id>x&&L(B))}function a(f,x){let z=Date.now(),H=y(f),Y=x!==void 0?H.lastDrainAtBySession.get(x)??0:f.sessionlessDrain==="broadcast-only"?H.lastDrainAtAny:0;return Y>0&&z-Y<t}import{randomBytes as v,timingSafeEqual as q}from"node:crypto";import{unlink as u}from"node:fs/promises";import{createServer as I}from"node:http";import{join as l}from"node:path";class N extends Error{status;constructor(f,x){if(!Number.isInteger(f)||f<400||f>499)throw RangeError(`RpcRequestError status must be 4xx, got ${f}`);super(x);this.name="RpcRequestError",this.status=f}}var E=1e6;class _ extends Error{declaredOversize;constructor(f){super("body too large");this.declaredOversize=f}}function p(f){return new Promise((x,z)=>{let H=(B=!1)=>{f.removeAllListeners("data"),f.on("data",()=>{}),f.resume(),z(new _(B))},Y=Number(f.headers["content-length"]);if(Number.isFinite(Y)&&Y>E){H(!0);return}let Z=[],L=0;f.on("data",(B)=>{if(L+=B.length,L>E){H();return}Z.push(B)}),f.on("end",()=>x(Buffer.concat(Z).toString("utf8"))),f.on("error",z)})}class S extends Error{}async function c(f,x){let z,H=new Promise((Y,Z)=>{z=setTimeout(()=>Z(new S("apply deadline exceeded")),x),z.unref?.()});f.catch(()=>{});try{return await Promise.race([f,H])}finally{clearTimeout(z)}}function d(f,x){if(!f?.startsWith("Bearer "))return!1;let z=Buffer.from(f.slice(7)),H=Buffer.from(x);return z.length===H.length&&q(z,H)}async function Bf(f){if(typeof f.drain==="function"===(typeof f.drainAsync==="function"))throw TypeError("exactly one of drain or drainAsync must be provided");let x=f.log??{warn(){},debug(){}},z=v(32).toString("hex"),H=f.timeoutMs??90000,Y=f.receiptTimeoutMs??2000,Z=!1,L=new Set,B=I((V,J)=>{V.setTimeout(H,()=>{V.socket.destroy()}),T(V,J)});B.on("connection",(V)=>{L.add(V),V.once("close",()=>L.delete(V))}),B.requestTimeout=Y,B.headersTimeout=Y;async function T(V,J){let G=(X,b,C={})=>{if(J.headersSent||J.writableEnded||J.destroyed)return;J.writeHead(X,{"content-type":"application/json",...C}),J.end(JSON.stringify(b))};try{let X=new URL(V.url??"/","http://127.0.0.1").pathname;if(V.method==="GET"&&X==="/health")return G(200,{ok:!0});if(V.method!=="POST"||!X.startsWith("/rpc/"))return G(404,{error:"not found"});if(!d(V.headers.authorization,z))return G(401,{error:"unauthorized"});let b=X.slice(5),C;try{C=await p(V)}catch($){if(!($ instanceof _))throw $;let P=V.socket;if(J.once("finish",()=>{P.end();let A=setTimeout(()=>P.destroy(),2000);if(A.unref(),V.once("end",()=>P.destroy()),P.once("close",()=>clearTimeout(A)),V.complete)P.destroy()}),!$.declaredOversize&&!V.complete){if(J.headersSent||J.writableEnded||J.destroyed)return;let A=JSON.stringify({error:"body too large"});J.writeHead(413,{"content-type":"application/json","content-length":Buffer.byteLength(A),connection:"close"}),J.write(A),V.once("end",()=>J.end());return}return G(413,{error:"body too large"},{connection:"close"})}let F;try{F=JSON.parse(C||"{}")}catch{return G(400,{error:"invalid json"})}if(b==="pending-notifications"){let $;try{if(f.parsePending)$=f.parsePending(F);else{if(!F||typeof F!=="object"||Array.isArray(F))throw Error("invalid params");let K=F;if(f.requireSession===!0&&!M(K.sessionId))return G(400,{error:"session required"});if("lastReceivedId"in K&&(typeof K.lastReceivedId!=="number"||!Number.isSafeInteger(K.lastReceivedId)||K.lastReceivedId<0)||"sessionId"in K&&typeof K.sessionId!=="string")throw Error("invalid params");$={lastReceivedId:Number(K.lastReceivedId??0),sessionId:typeof K.sessionId==="string"?K.sessionId:void 0}}}catch(K){if(K instanceof N)throw K;return G(400,{error:"invalid params"})}let{lastReceivedId:P,sessionId:A}=$;if(f.requireSession===!0&&!M(A))return G(400,{error:"session required"});if(A===void 0&&!Z)Z=!0,x.warn("rpc notification drain missing session id",{pid:process.pid});let W;if(f.drainAsync)try{W=await f.drainAsync(P,A)}catch(K){return x.warn("rpc notification drain failed",{pid:process.pid,error:K instanceof Error?K.message:String(K)}),G(500,{error:"drain failed"})}else W=f.drain?.(P,A);return G(200,{messages:W})}if(b==="apply"){let $=Promise.resolve(f.apply(F)),P=f.applyDeadlineMs===void 0?await $:await c($,f.applyDeadlineMs);return G(200,P)}return G(404,{error:"unknown method"})}catch(X){if(X instanceof N)return x.debug("rpc request refused",{pid:process.pid,status:X.status}),G(X.status,{error:X.message});if(X instanceof S)return x.warn("rpc apply deadline exceeded",{pid:process.pid,deadlineMs:f.applyDeadlineMs}),G(504,{error:"handler deadline exceeded"});x.warn("rpc request failed",{pid:process.pid,error:X instanceof Error?X.message:String(X)}),G(500,{error:"internal error"})}}let Q=await new Promise((V,J)=>{B.on("error",J),B.listen(0,"127.0.0.1",()=>{let G=B.address();if(G&&typeof G==="object")V(G.port);else J(Error("no port"))})});if(B.unref(),f.sweepRoot)try{await k(f.sweepRoot,f.dir,f.isManagedDir,x)}catch(V){x.warn("rpc state sweep failed",{pid:process.pid,error:V instanceof Error?V.message:String(V)})}try{await O(f.dir,{port:Q,token:z,pid:process.pid},{secureDir:f.secureDir}),x.debug("rpc server pid",{pid:process.pid,rpcPort:Q})}catch(V){throw await new Promise((J)=>B.close(()=>J())),V}return{port:Q,token:z,async stop(){await new Promise((G)=>{B.closeAllConnections?.(),B.close(()=>G());for(let X of L)X.destroy()});let V=l(f.dir,`port-${process.pid}.json`),J=await D(V).then((G)=>JSON.parse(G)).catch((G)=>{if(G instanceof h&&G.code!=="ENOENT")throw G;return});if(J?.port===Q&&J.token===z)await u(V).catch(()=>{})}}}async function Hf(f,x,z){let H=globalThis,Y=Symbol.for(f),Z=H[Y]??{servers:new Map,pending:new Map};H[Y]=Z;let{servers:L,pending:B}=Z,T=B.get(x)??Promise.resolve(),Q,V=T.catch(()=>{}).then(async()=>{let G=L.get(x);if(G){if(await G.stop(),L.get(x)===G)L.delete(x)}Q=await z(),L.set(x,Q)});B.set(x,V);try{await V}finally{if(B.get(x)===V)B.delete(x)}let J=Q;if(!J)throw Error("RPC server failed to start");return{server:J,release:async()=>{if(L.get(x)!==J)return;if(await J.stop(),L.get(x)===J)L.delete(x)}}}var R="1.8.1";function bf(f,x,z){let H={...x,version:R};return O(f,H,z)}var Cf=w(j);
|
|
2
|
+
export{i as Je,n as Ke,a as Le,Bf as Me,Hf as Ne,R as Oe,bf as Pe,Cf as Qe};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { S as SidebarState, y as SidebarMachineState } from "./sidebar-state-
|
|
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-GJkvxv4S.js";
|
|
2
|
+
import { S as SidebarState, y as SidebarMachineState } from "./sidebar-state-DkNebAiC.js";
|
|
3
3
|
import { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
|
|
4
|
-
//#region ../core/dist/provider.d.ts
|
|
5
4
|
type QuotaWindowName = string;
|
|
6
5
|
type ProviderQuotaFn = (input: {
|
|
7
6
|
accessToken: string;
|
|
8
7
|
fetchImpl: typeof fetch;
|
|
9
8
|
now: () => number;
|
|
10
9
|
}) => Promise<OAuthQuotaSnapshot>;
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region ../core/dist/quota-manager.d.ts
|
|
13
10
|
type QuotaEntry = {
|
|
14
11
|
quota: OAuthQuotaSnapshot;
|
|
15
12
|
refreshAfter: number;
|
|
@@ -180,8 +177,6 @@ declare class QuotaManager {
|
|
|
180
177
|
*/
|
|
181
178
|
private _handleFallbackFetchError;
|
|
182
179
|
}
|
|
183
|
-
//#endregion
|
|
184
|
-
//#region ../core/dist/accounts.d.ts
|
|
185
180
|
type AccountQuotaWindow = {
|
|
186
181
|
usedPercent: number;
|
|
187
182
|
remainingPercent: number;
|
|
@@ -376,8 +371,6 @@ type AccountStorage = {
|
|
|
376
371
|
accounts: FallbackAccount[];
|
|
377
372
|
};
|
|
378
373
|
declare function loadAccounts(paths: AccountPaths): Promise<AccountStorage | null>;
|
|
379
|
-
//#endregion
|
|
380
|
-
//#region src/core/background-quota-refresh.d.ts
|
|
381
374
|
type TimerHandle = ReturnType<typeof setInterval>;
|
|
382
375
|
interface BackgroundQuotaRefreshOptions {
|
|
383
376
|
setIntervalFn?: (callback: () => void, intervalMs: number) => TimerHandle;
|
|
@@ -399,8 +392,6 @@ declare class BackgroundQuotaRefresh {
|
|
|
399
392
|
stop(): void;
|
|
400
393
|
isStopped(): boolean;
|
|
401
394
|
}
|
|
402
|
-
//#endregion
|
|
403
|
-
//#region src/index.d.ts
|
|
404
395
|
export declare const ALLOWED_MODELS: Set<string>;
|
|
405
396
|
export declare const DISALLOWED_MODELS: Set<string>;
|
|
406
397
|
/**
|
|
@@ -494,6 +485,8 @@ export declare function buildResetRedemptionDeps(): {
|
|
|
494
485
|
};
|
|
495
486
|
export declare const POOL_MIGRATION_ENABLED = true;
|
|
496
487
|
interface CodexAuthPluginOptions {
|
|
488
|
+
/** Test seams for the one-time move of the runtime files (`core/runtime-layout.ts`). */
|
|
489
|
+
runtimeLayout?: Partial<Omit<RuntimeLayoutOptions, 'version'>>;
|
|
497
490
|
/**
|
|
498
491
|
* Test seams for the background account-pool migration and adoption
|
|
499
492
|
* (`core/pool-lifecycle.ts`): its fence, timers, run functions and
|
|
@@ -553,5 +546,4 @@ declare const _default: {
|
|
|
553
546
|
id: string;
|
|
554
547
|
server: Plugin;
|
|
555
548
|
};
|
|
556
|
-
//#endregion
|
|
557
549
|
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 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-vh1sr50d.js";import"./index-97cz7kyq.js";import"./index-4rf3rkdm.js";import{dd as a,ed as b}from"./index-b7p76qqa.js";import"./index-73z9ftrg.js";import"./index-ww8w9edq.js";import"./index-21yxzeet.js";import"./index-h1r8cbet.js";import"./index-mg4w434p.js";import"./index-c50p5mem.js";import"./index-hpnj460b.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,3 @@
|
|
|
1
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/rpc/port-file.d.ts
|
|
2
1
|
interface PortFileEntry {
|
|
3
2
|
port: number;
|
|
4
3
|
token: string;
|
|
@@ -25,5 +24,4 @@ interface DiscoverPortFileOptions {
|
|
|
25
24
|
exactPid?: boolean;
|
|
26
25
|
}
|
|
27
26
|
declare function discoverPortFile(dir: string, expectedPid?: number, options?: DiscoverPortFileOptions): Promise<PortFileEntry | null>;
|
|
28
|
-
//#endregion
|
|
29
27
|
export { discoverPortFile as n, writePortFile as r, PortFileEntry as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/commands/model.d.ts
|
|
2
1
|
/** The section slots, in the one order every renderer shows them. */
|
|
3
2
|
declare const SECTION_SLOTS: readonly ['accounts', 'quota', 'routing', 'limits', 'cache', 'diagnostics', 'extra'];
|
|
4
3
|
type SectionSlot = (typeof SECTION_SLOTS)[number];
|
|
@@ -167,8 +166,6 @@ interface CommandApplyResult {
|
|
|
167
166
|
menu: CommandMenuModel;
|
|
168
167
|
}
|
|
169
168
|
type NotifyKind = 'info' | 'warning' | 'error';
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region ../core/dist/protocol.d.ts
|
|
172
169
|
/** The menu, as the slash command opens it in the TUI. */
|
|
173
170
|
type OpenDialogPayload = CommandDialogPayload;
|
|
174
171
|
/**
|
|
@@ -194,5 +191,4 @@ type ApplyRequest = CommandApplyRequest;
|
|
|
194
191
|
type ApplyResult = CommandApplyResult;
|
|
195
192
|
/** Whether a pushed notification is the menu itself or a message. */
|
|
196
193
|
declare function isNotifyPayload(payload: OpenDialogPayload | NotifyPayload): payload is NotifyPayload;
|
|
197
|
-
//#endregion
|
|
198
194
|
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,5 +1,5 @@
|
|
|
1
|
-
import { n as discoverPortFile, r as writePortFile, t as PortFileEntry } from "../port-file-
|
|
2
|
-
|
|
1
|
+
import { n as discoverPortFile, r as writePortFile$1, t as PortFileEntry } from "../port-file-DXCxv8tU.js";
|
|
2
|
+
/** Stamp the record itself; a heartbeat with the same pid may be stale. */
|
|
3
|
+
export declare function writePortFile(dir: string, entry: Parameters<typeof writePortFile$1>[1], options?: Parameters<typeof writePortFile$1>[2]): Promise<string>;
|
|
3
4
|
export declare const isOpenaiRpcStateDir: (name: string) => boolean;
|
|
4
|
-
|
|
5
|
-
export { type PortFileEntry, discoverPortFile, writePortFile };
|
|
5
|
+
export { type PortFileEntry, discoverPortFile };
|
package/dist/rpc/port-file.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Pe as b,Qe as c}from"../index-ww8w9edq.js";import{Ue as a}from"../index-21yxzeet.js";import"../index-mg4w434p.js";import"../index-c50p5mem.js";import"../index-hpnj460b.js";export{b as writePortFile,c as isOpenaiRpcStateDir,a 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-BZZtDn5h.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{gf as b}from"../index-h1r8cbet.js";import"../index-mg4w434p.js";import"../index-hpnj460b.js";export{b as isNotifyPayload};
|
package/dist/rpc/rpc-client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createRpcClient, r as DEFAULT_RPC_TIMEOUT_MS, t as RpcClient } from "../rpc-client-
|
|
1
|
+
import { n as createRpcClient, r as DEFAULT_RPC_TIMEOUT_MS, t as RpcClient } from "../rpc-client-CmaZW1by.js";
|
|
2
2
|
export { DEFAULT_RPC_TIMEOUT_MS, RpcClient, createRpcClient };
|
package/dist/rpc/rpc-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ve as F,We as f}from"../index-21yxzeet.js";import"../index-mg4w434p.js";import"../index-hpnj460b.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.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { tmpdir } from "node:os";
|
|
2
|
-
//#region src/rpc/rpc-dir.d.ts
|
|
3
2
|
/** Name prefix of this plugin's per-project RPC state directories. */
|
|
4
3
|
export declare const RPC_DIRECTORY_PREFIX = "openai-auth-";
|
|
5
4
|
export interface RpcDirResolution {
|
|
@@ -9,5 +8,4 @@ export interface RpcDirResolution {
|
|
|
9
8
|
}
|
|
10
9
|
export declare function getRpcDir(projectDirectory: string): string;
|
|
11
10
|
export declare function resolveRpcDir(projectDirectory: string): Promise<RpcDirResolution>;
|
|
12
|
-
//#endregion
|
|
13
11
|
export { tmpdir };
|
package/dist/rpc/rpc-dir.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{tf as a,uf as b,vf as c,wf as d}from"../index-c50p5mem.js";import"../index-hpnj460b.js";export{a as tmpdir,d as resolveRpcDir,c as getRpcDir,b as RPC_DIRECTORY_PREFIX};
|
|
@@ -1,13 +1,9 @@
|
|
|
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.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/rpc/rpc-client.d.ts
|
|
1
|
+
import { a as RpcNotification, n as ApplyResult, t as ApplyRequest } from "./protocol-BZZtDn5h.js";
|
|
2
|
+
import { t as PortFileEntry } from "./port-file-DXCxv8tU.js";
|
|
4
3
|
declare const DEFAULT_RPC_TIMEOUT_MS = 2000;
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/rpc/rpc-client.d.ts
|
|
7
4
|
interface RpcClient {
|
|
8
5
|
pending: (lastReceivedId: number, sessionId?: string, timeoutMs?: number) => Promise<RpcNotification[]>;
|
|
9
6
|
apply: (request: ApplyRequest, timeoutMs?: number) => Promise<ApplyResult>;
|
|
10
7
|
}
|
|
11
8
|
declare function createRpcClient(dir: string, expectedPid?: number, onSelected?: (entry: PortFileEntry | null) => void): RpcClient;
|
|
12
|
-
//#endregion
|
|
13
9
|
export { createRpcClient as n, DEFAULT_RPC_TIMEOUT_MS as r, RpcClient as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/logger/engine.d.ts
|
|
2
1
|
interface ChannelLogger {
|
|
3
2
|
error(message: string, data?: unknown): void;
|
|
4
3
|
warn(message: string, data?: unknown): void;
|
|
@@ -7,8 +6,6 @@ interface ChannelLogger {
|
|
|
7
6
|
trace(message: string, data?: unknown): void;
|
|
8
7
|
}
|
|
9
8
|
declare function createLogger(channel: string): ChannelLogger;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/quota/map.d.ts
|
|
12
9
|
interface QuotaReadingEntry {
|
|
13
10
|
scope: string;
|
|
14
11
|
label: string;
|
|
@@ -80,8 +77,6 @@ interface QuotaMap {
|
|
|
80
77
|
/** Absent means no observation has reported on prepaid credits yet. */
|
|
81
78
|
credits?: QuotaCredits;
|
|
82
79
|
}
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/quota/projection.d.ts
|
|
85
80
|
interface ProjectedLimit {
|
|
86
81
|
scope: string;
|
|
87
82
|
label: string;
|
|
@@ -133,8 +128,6 @@ interface ProjectedQuota {
|
|
|
133
128
|
*/
|
|
134
129
|
groups?: readonly QuotaGroup[];
|
|
135
130
|
}
|
|
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
|
|
138
131
|
interface SidebarFileHooks {
|
|
139
132
|
/** Runs on the first merge attempt, before checking for older, unlocked writers. */
|
|
140
133
|
beforeRecheck?: () => void | Promise<void>;
|
|
@@ -143,8 +136,6 @@ interface SidebarFileHooks {
|
|
|
143
136
|
/** @internal Test seam after the rename, before ownership is checked again. */
|
|
144
137
|
afterRename?: () => Promise<void>;
|
|
145
138
|
}
|
|
146
|
-
//#endregion
|
|
147
|
-
//#region src/sidebar-state.d.ts
|
|
148
139
|
interface QuotaWindow {
|
|
149
140
|
usedPercent: number;
|
|
150
141
|
remainingPercent: number;
|
|
@@ -290,6 +281,8 @@ interface SidebarState {
|
|
|
290
281
|
* account's email when the vault knows it, else the vault's label.
|
|
291
282
|
*/
|
|
292
283
|
vaultAccounts?: SidebarAccountState[];
|
|
284
|
+
/** Whether the vault supplied a roster snapshot, including an empty one. */
|
|
285
|
+
vaultDiscovered?: boolean;
|
|
293
286
|
}
|
|
294
287
|
declare const STICKY_ASSIGNMENT_MAX_AGE_MS: number;
|
|
295
288
|
declare const STICKY_ASSIGNMENT_MAX_ENTRIES = 256;
|
|
@@ -348,7 +341,7 @@ type SidebarMergeHooks = Pick<SidebarFileHooks, 'beforeRecheck'> & {
|
|
|
348
341
|
* Defaults to getSidebarStateFile() (per-call resolution).
|
|
349
342
|
*/
|
|
350
343
|
declare function setSidebarState(state: SidebarState, file?: string): Promise<void>;
|
|
351
|
-
type SidebarMachineState = Pick<SidebarState, 'main' | 'fallbacks' | 'planType' | 'lastUpdated' | 'accountPool' | 'vaultAccounts'> & {
|
|
344
|
+
type SidebarMachineState = Pick<SidebarState, 'main' | 'fallbacks' | 'planType' | 'lastUpdated' | 'accountPool' | 'vaultAccounts' | 'vaultDiscovered'> & {
|
|
352
345
|
route: string;
|
|
353
346
|
};
|
|
354
347
|
declare function setSidebarMachineState(machineState: SidebarMachineState, file?: string, hooks?: SidebarMergeHooks): Promise<void>;
|
|
@@ -544,5 +537,4 @@ interface QuotaPacing {
|
|
|
544
537
|
runsOutAt: string | null;
|
|
545
538
|
}
|
|
546
539
|
declare function computeQuotaPacing(window: QuotaWindow, windowMs: number, now: number): QuotaPacing | null;
|
|
547
|
-
//#endregion
|
|
548
540
|
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 };
|
package/dist/sidebar-state.d.ts
CHANGED
|
@@ -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 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-
|
|
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-DkNebAiC.js";
|
|
2
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 };
|
package/dist/sidebar-state.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$b as
|
|
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-4rf3rkdm.js";import"./index-b7p76qqa.js";import"./index-73z9ftrg.js";import"./index-h1r8cbet.js";import"./index-mg4w434p.js";import"./index-hpnj460b.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-
|
|
1
|
+
import{a as U,b as V}from"./index-p8m4yh73.js";import{xf as R}from"./index-hpnj460b.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-p8m4yh73.js";import"./index-hpnj460b.js";export default a();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/tui-preferences.d.ts
|
|
2
1
|
export declare const TUI_PREFS_FILE_ENV = "OPENCODE_TUI_PREFERENCES_FILE";
|
|
3
2
|
export declare function getTuiPreferencesFile(): string;
|
|
4
3
|
export declare function readTuiPreferencesFile(): Promise<Record<string, unknown>>;
|
|
@@ -38,5 +37,4 @@ export declare function computeEffectiveOrder(root: Record<string, unknown>, plu
|
|
|
38
37
|
type JsonValue = string | number | boolean | null;
|
|
39
38
|
export declare function queueTuiPreferenceUpdate(pluginKey: string, path: string[], value: JsonValue): Promise<void>;
|
|
40
39
|
export declare function watchTuiPreferences(onChange: () => void): () => void;
|
|
41
|
-
//#endregion
|
|
42
40
|
export {};
|
package/dist/tui-preferences.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ae as h,He as u,Ie as P}from"./index-73z9ftrg.js";import{if as M,jf as R,of as S}from"./index-mg4w434p.js";import"./index-hpnj460b.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,10 +1,9 @@
|
|
|
1
|
-
import { i as OpenDialogPayload, n as ApplyResult, t as ApplyRequest } from "./protocol-
|
|
2
|
-
import { S as SidebarState, d as QuotaPacing, f as QuotaWindow, i as AccountQuota, w as SpendControlReading } from "./sidebar-state-
|
|
3
|
-
import { t as RpcClient } from "./rpc-client-
|
|
1
|
+
import { i as OpenDialogPayload, n as ApplyResult, t as ApplyRequest } from "./protocol-BZZtDn5h.js";
|
|
2
|
+
import { S as SidebarState, d as QuotaPacing, f as QuotaWindow, i as AccountQuota, w as SpendControlReading } from "./sidebar-state-DkNebAiC.js";
|
|
3
|
+
import { t as RpcClient } from "./rpc-client-CmaZW1by.js";
|
|
4
4
|
import { Plugin } from "@opencode/plugin/tui";
|
|
5
5
|
import { TuiPluginApi, TuiPluginModule } from "@opencode-ai/plugin/tui";
|
|
6
6
|
import { JSX } from "solid-js";
|
|
7
|
-
//#region src/tui/v2.d.ts
|
|
8
7
|
interface TuiTransportOptions {
|
|
9
8
|
/** Test-only label for proving that the host can render a sidebar component. */
|
|
10
9
|
sidebarText?: string;
|
|
@@ -24,8 +23,6 @@ interface TuiTransportOptions {
|
|
|
24
23
|
setIntervalImpl?: typeof globalThis.setInterval;
|
|
25
24
|
clearIntervalImpl?: typeof globalThis.clearInterval;
|
|
26
25
|
}
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/tui.d.ts
|
|
29
26
|
/** One drawer action as the RPC apply request carries it, with its session. */
|
|
30
27
|
export declare function buildApplyRequest(request: Omit<ApplyRequest, 'sessionId'>, sessionId?: string): ApplyRequest;
|
|
31
28
|
type Tone = 'ok' | 'warn' | 'err' | 'muted' | 'accent' | 'text';
|
|
@@ -132,5 +129,4 @@ declare const plugin: TuiPluginModule & {
|
|
|
132
129
|
id: string;
|
|
133
130
|
setup: typeof setup;
|
|
134
131
|
};
|
|
135
|
-
//#endregion
|
|
136
132
|
export { plugin as default };
|
package/dist/v2/server.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as OpenDialogPayload, n as ApplyResult } from "../protocol-
|
|
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-GJkvxv4S.js";
|
|
2
|
+
import { i as OpenDialogPayload, n as ApplyResult } from "../protocol-BZZtDn5h.js";
|
|
3
3
|
import { Plugin } from "@opencode/plugin";
|
|
4
4
|
import "@opencode/plugin/promise/session";
|
|
5
5
|
import "@opencode/plugin/promise/integration";
|
|
6
6
|
import "@opencode/plugin/promise/registration";
|
|
7
|
-
//#region src/v2/frame-turn.d.ts
|
|
8
7
|
/** The turn a frame is sent in. */
|
|
9
8
|
interface FrameTurn {
|
|
10
9
|
readonly turnID: string;
|
|
@@ -61,15 +60,15 @@ declare class FrameTurnState {
|
|
|
61
60
|
/** Drops a deleted host session; its next frame starts a new turn. */
|
|
62
61
|
forget(sessionID: string): void;
|
|
63
62
|
}
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region src/v2/codex-sessions.d.ts
|
|
66
63
|
interface CodexSessionStoreOptions {
|
|
67
64
|
/** Mints the turn ids of loaded sessions; UUIDv7 by default. */
|
|
68
65
|
uuid?: () => string;
|
|
69
66
|
/** Test seam: runs while the lock is held, after the file was re-read. */
|
|
70
67
|
afterRead?: () => Promise<void>;
|
|
71
|
-
/** Test seam: the lock wait; `
|
|
68
|
+
/** Test seam: the lock wait; `CODEX_SESSIONS_LOCK_WAIT_MS` by default. */
|
|
72
69
|
lockWaitMs?: number;
|
|
70
|
+
/** Test seam: the save delay; `CODEX_SESSIONS_SAVE_DELAY_MS` by default. */
|
|
71
|
+
saveDelayMs?: number;
|
|
73
72
|
}
|
|
74
73
|
declare class CodexSessionStore {
|
|
75
74
|
#private;
|
|
@@ -89,16 +88,18 @@ declare class CodexSessionStore {
|
|
|
89
88
|
/** Forgets a deleted host session here and, on the next save, in the file. */
|
|
90
89
|
delete(sessionID: string): void;
|
|
91
90
|
/**
|
|
92
|
-
* Saves this process's changes
|
|
93
|
-
* one runs go in the next. Never rejects:
|
|
94
|
-
* keeps the changes for the next save.
|
|
91
|
+
* Saves this process's changes now, taking over any delayed save. Saves run
|
|
92
|
+
* one at a time; changes made while one runs go in the next. Never rejects:
|
|
93
|
+
* a lock timeout or write failure keeps the changes for the next save.
|
|
95
94
|
*/
|
|
96
95
|
save(): Promise<void>;
|
|
97
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* Starts a delayed save now, if one is waiting, and resolves once every
|
|
98
|
+
* save has finished. The plugin's shutdown awaits this, so stopping never
|
|
99
|
+
* drops changes still inside the save delay.
|
|
100
|
+
*/
|
|
98
101
|
settled(): Promise<void>;
|
|
99
102
|
}
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/v2/codex-wire.d.ts
|
|
102
103
|
/**
|
|
103
104
|
* HTTP requests and WebSocket cache keys share each host session's thread
|
|
104
105
|
* identity. With a store, sessions are the store's process-wide map and new
|
|
@@ -134,8 +135,6 @@ declare class CodexHttpState {
|
|
|
134
135
|
/** Drops a deleted host session; a later request with its id starts a new thread. */
|
|
135
136
|
forget(sessionID: string): void;
|
|
136
137
|
}
|
|
137
|
-
//#endregion
|
|
138
|
-
//#region src/v2/cache-keep.d.ts
|
|
139
138
|
/**
|
|
140
139
|
* How the store's manager is built. Only the first location to acquire a
|
|
141
140
|
* store's manager supplies these; in production every location passes the
|
|
@@ -150,18 +149,12 @@ interface CacheKeepManagerSetup {
|
|
|
150
149
|
/** How long the last release waits for a warm in flight. */
|
|
151
150
|
joinTimeoutMs?: number;
|
|
152
151
|
}
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/v2/control-plane.d.ts
|
|
155
152
|
/** Server-owned menu callbacks shared by command dispatch and loopback RPC. */
|
|
156
153
|
interface ControlPlaneMenu {
|
|
157
154
|
open(sessionId: string): Promise<OpenDialogPayload>;
|
|
158
155
|
apply(request: unknown): Promise<ApplyResult>;
|
|
159
156
|
}
|
|
160
|
-
//#endregion
|
|
161
|
-
//#region src/v2/login.d.ts
|
|
162
157
|
type BeginLogin = (options: BeginAccountLoginOptions) => Promise<BeginAccountLoginResult>;
|
|
163
|
-
//#endregion
|
|
164
|
-
//#region src/v2/setup.d.ts
|
|
165
158
|
/**
|
|
166
159
|
* The plugin id both hosts list this plugin under: the OpenCode 1 plugin's
|
|
167
160
|
* own id, since OpenCode 1 reads the `./server` entry as well.
|
|
@@ -209,6 +202,8 @@ interface OpenAIAuthV2Options {
|
|
|
209
202
|
poolMigration?: boolean;
|
|
210
203
|
/** Whether to write this process's heartbeat (other processes' fence reads it). */
|
|
211
204
|
heartbeat?: boolean;
|
|
205
|
+
/** Test seams for the one-time move of the runtime files (`core/runtime-layout.ts`). */
|
|
206
|
+
runtimeLayout?: Partial<Omit<RuntimeLayoutOptions, 'version'>>;
|
|
212
207
|
/** The vault's directory and connections; the production ones by default. */
|
|
213
208
|
vault?: Partial<Pick<OpenAiVaultOptions, 'stateDir' | 'connectionFile' | 'connectScoped' | 'connectEnrollment' | 'pollIntervalMs'>> & {
|
|
214
209
|
/**
|
|
@@ -220,8 +215,6 @@ interface OpenAIAuthV2Options {
|
|
|
220
215
|
};
|
|
221
216
|
}
|
|
222
217
|
export declare function createOpenAIAuthPlugin(options?: OpenAIAuthV2Options): Plugin.Plugin;
|
|
223
|
-
//#endregion
|
|
224
|
-
//#region src/v2/server.d.ts
|
|
225
218
|
declare const _default: {
|
|
226
219
|
id: string;
|
|
227
220
|
/** OpenCode 2. */
|
|
@@ -229,5 +222,4 @@ declare const _default: {
|
|
|
229
222
|
/** OpenCode 1. */
|
|
230
223
|
server: import("@opencode-ai/plugin").Plugin;
|
|
231
224
|
};
|
|
232
|
-
//#endregion
|
|
233
225
|
export { type OpenAIAuthV2Options, _default as default };
|