@cortexkit/opencode-openai-auth 1.2.0 → 1.4.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 +8 -8
- package/dist/{codex-request-CjXETpTA.d.ts → codex-request-hw0XcldE.d.ts} +146 -29
- package/dist/index-1eq2s1cp.js +2 -0
- package/dist/{index-qp5hdpw8.js → index-1tdnrt68.js} +1 -1
- package/dist/index-5230x6s8.js +2 -0
- package/dist/{index-qxbchh2d.js → index-ag04nyv7.js} +7 -7
- package/dist/index-brbqqer5.js +90 -0
- package/dist/{index-xwvze96g.js → index-d98f1xdp.js} +1 -1
- package/dist/index-jcyrm58f.js +65 -0
- package/dist/{index-htvcmtcx.js → index-rsvnabbe.js} +2 -2
- package/dist/{index-ftkhhr6d.js → index-s88n2bjn.js} +1 -1
- package/dist/{index-bc89akak.js → index-t5m0dhmq.js} +1 -1
- package/dist/index-vy729a0b.js +69 -0
- package/dist/index-wgwze391.js +2 -0
- package/dist/{index-ffg0sgg5.js → index-yhw3hnsh.js} +2 -2
- package/dist/index.d.ts +11 -3
- package/dist/index.js +1 -1
- package/dist/{model-CQcw10oW.d.ts → model-DphbMQce.d.ts} +1 -1
- package/dist/{port-file-BDJnzgHH.d.ts → port-file-Cx-wwe5Q.d.ts} +1 -1
- package/dist/{protocol-C-kagE6O.d.ts → protocol-CDqdjh74.d.ts} +1 -1
- 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-BfQ4mpZO.d.ts → sidebar-state-pTd9gg9W.d.ts} +71 -7
- package/dist/sidebar-state.d.ts +2 -2
- package/dist/sidebar-state.js +1 -1
- package/dist/{token-z6qq7a1d.js → token-0z5g59p8.js} +1 -1
- package/dist/token-util-jf9g6stk.js +1 -0
- package/dist/tui-preferences.js +1 -1
- package/dist/tui.d.ts +30 -3
- package/dist/v2/server.d.ts +2 -2
- package/dist/v2/server.js +2 -2
- package/package.json +6 -6
- package/src/tui-compiled/raw/shared/0332701351b3eeec-format.js +119 -6
- package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +294 -16
- package/src/tui-compiled/raw/shared/169b2b4bf30909bc-consumer.js +178 -26
- package/src/tui-compiled/raw/shared/2577ec69f9973ae9-quota-normalize.js +45 -1
- package/src/tui-compiled/raw/shared/30f5bc480f31f51c-roster.js +100 -43
- package/src/tui-compiled/raw/shared/375d9cca2def037d-private-files.js +10 -2
- package/src/tui-compiled/raw/shared/39c3cb05738fcf6d-projection.js +3 -1
- package/src/tui-compiled/raw/shared/42ae93ab554fcec2-open-url.js +7 -9
- package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +2 -0
- package/src/tui-compiled/raw/shared/4f36d333d081d040-merge.js +17 -3
- package/src/tui-compiled/raw/shared/81dddd203f1b92a3-quota-writer.js +253 -0
- package/src/tui-compiled/raw/shared/905bffc0220f43d0-map.js +31 -6
- package/src/tui-compiled/raw/shared/94f53cfd572ba4bb-availability.js +106 -0
- package/src/tui-compiled/raw/shared/abd062d633e29fd2-pool-routing.js +116 -12
- package/src/tui-compiled/raw/shared/bfbdd0f9aae56b47-pool-quota.js +15 -3
- package/src/tui-compiled/raw/shared/d0f0b6be200311af-insula.js +348 -21
- package/src/tui-compiled/raw/shared/d5a8f1061ee2f114-index.js +2 -2
- package/src/tui-compiled/raw/shared/dbc61cd405941828-accounts.js +5 -4
- package/src/tui-compiled/raw/shared/dc9290c2a7552ba6-watch.js +254 -0
- package/src/tui-compiled/raw/shared/e8d3c8da776ef9cd-index.js +5 -1
- package/src/tui-compiled/raw/sidebar-state.js +32 -3
- package/src/tui-compiled/raw/tui/v2-dialog.js +2 -1
- package/src/tui-compiled/raw/tui.tsx +170 -26
- package/src/tui-compiled/runtime/shared/0332701351b3eeec-format.js +119 -6
- package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +294 -16
- package/src/tui-compiled/runtime/shared/169b2b4bf30909bc-consumer.js +178 -26
- package/src/tui-compiled/runtime/shared/2577ec69f9973ae9-quota-normalize.js +45 -1
- package/src/tui-compiled/runtime/shared/30f5bc480f31f51c-roster.js +100 -43
- package/src/tui-compiled/runtime/shared/375d9cca2def037d-private-files.js +10 -2
- package/src/tui-compiled/runtime/shared/39c3cb05738fcf6d-projection.js +3 -1
- package/src/tui-compiled/runtime/shared/42ae93ab554fcec2-open-url.js +7 -9
- package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +2 -0
- package/src/tui-compiled/runtime/shared/4f36d333d081d040-merge.js +17 -3
- package/src/tui-compiled/runtime/shared/81dddd203f1b92a3-quota-writer.js +253 -0
- package/src/tui-compiled/runtime/shared/905bffc0220f43d0-map.js +31 -6
- package/src/tui-compiled/runtime/shared/94f53cfd572ba4bb-availability.js +106 -0
- package/src/tui-compiled/runtime/shared/abd062d633e29fd2-pool-routing.js +116 -12
- package/src/tui-compiled/runtime/shared/bfbdd0f9aae56b47-pool-quota.js +15 -3
- package/src/tui-compiled/runtime/shared/d0f0b6be200311af-insula.js +348 -21
- package/src/tui-compiled/runtime/shared/d5a8f1061ee2f114-index.js +2 -2
- package/src/tui-compiled/runtime/shared/dbc61cd405941828-accounts.js +5 -4
- package/src/tui-compiled/runtime/shared/dc9290c2a7552ba6-watch.js +254 -0
- package/src/tui-compiled/runtime/shared/e8d3c8da776ef9cd-index.js +5 -1
- package/src/tui-compiled/runtime/sidebar-state.js +32 -3
- package/src/tui-compiled/runtime/tui/v2-dialog.js +2 -1
- package/src/tui-compiled/runtime/tui.js +350 -219
- package/dist/index-03em8hv1.js +0 -69
- package/dist/index-6n4pnfkg.js +0 -2
- package/dist/index-ehjj89rx.js +0 -2
- package/dist/index-f21addzm.js +0 -90
- package/dist/index-r2s51ac1.js +0 -2
- package/dist/index-rwbrhkse.js +0 -65
- package/dist/token-util-cf0nyh7n.js +0 -1
package/dist/bin.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{c as _0}from"./index-
|
|
3
|
-
`);return b<0?"":G.slice(b+1)}class d extends Error{step="pi-install";exitCode;signal;stderrTail;constructor(G){super(y0);this.name="SetupCommandError",this.exitCode=G.exitCode,this.signal=G.signal;let b=G.stderrTruncated?E0(G.stderrTail):G.stderrTail,z=e(b);this.stderrTail=v0(typeof z==="string"?z:"")}}var f0={opencode:"OpenCode",pi:"Pi"},g0={enrolled:"connected to the vault","not-enrolled":"not connected",unknown:"unknown, check with ck auth status"};function G0({host:G,outcome:b}){return`${f0[G]}: ${g0[b]}`}var d0=new WeakMap;function b0(G,b){if(typeof G!=="object"&&typeof G!=="function"||!G)return;d0.set(G,Object.freeze(b.map((z)=>Object.freeze({...z}))))}import{accessSync as p0,constants as l0,existsSync as a0,readFileSync as i0,realpathSync as s0,statSync as r0}from"node:fs";import{mkdtemp as n0,rm as o0}from"node:fs/promises";import{tmpdir as t0}from"node:os";import{join as e0}from"node:path";import{parse as
|
|
2
|
+
import{c as _0}from"./index-1tdnrt68.js";import{Cb as I0,Fa as j0,Ga as E,Ha as O,Ia as v,kb as A0,ta as k0,ua as f,va as o}from"./index-vy729a0b.js";import{cd as R0,jd as m,kd as L,md as c,nd as q0}from"./index-brbqqer5.js";import"./index-ag04nyv7.js";import{Je as e,Pe as Y0,Qe as C0,Te as w0}from"./index-wgwze391.js";import"./index-5230x6s8.js";import"./index-d98f1xdp.js";import{spawn as P0}from"node:child_process";var M=4096,S0=1048576;class t{buffer=Buffer.alloc(M);start=0;length=0;truncated=!1;get didTruncate(){return this.truncated}push(G){if(G.length>=M){if(G.length>M||this.length>0)this.truncated=!0;G.copy(this.buffer,0,G.length-M),this.start=0,this.length=M;return}let b=Math.max(0,this.length+G.length-M);if(b>0)this.truncated=!0;this.start=(this.start+b)%M,this.length-=b;let z=(this.start+this.length)%M,K=Math.min(G.length,M-z);if(G.copy(this.buffer,z,0,K),K<G.length)G.copy(this.buffer,0,K);this.length+=G.length}toString(){let G=Buffer.alloc(this.length),b=Math.min(this.length,M-this.start);if(this.buffer.copy(G,0,this.start,this.start+b),b<this.length)this.buffer.copy(G,b,0,this.length-b);let z=0;while(z<G.length){let K=G[z];if(K===void 0||(K&192)!==128)break;z++}return G.subarray(z).toString("utf8")}}var A={run(G,b,z={}){return new Promise((K)=>{let J=performance.now(),Q=z.timeoutMs??15000,$=new t,q=[],U=0,Z=!1,D=!1,W=!1,F;try{F=P0(G,[...b],{env:z.env??process.env,windowsHide:!0,windowsVerbatimArguments:z.windowsVerbatimArguments,stdio:["ignore","pipe","pipe"]})}catch{K({exitCode:1,stdout:"",stderr:"",spawnError:!0,signal:null,timedOut:!1,durationMs:performance.now()-J});return}let x=Q>0?setTimeout(()=>{W=!0,F.kill("SIGTERM")},Q):void 0;F.stdout?.on("data",(j)=>{let R=S0-U,V=Math.min(R,j.length);if(V>0)q.push(j.subarray(0,V)),U+=V;if(j.length>R)Z=!0,F.kill("SIGTERM")}),F.stderr?.on("data",(j)=>$.push(j));let X=!1,B=(j,R)=>{if(X)return;if(X=!0,x)clearTimeout(x);K({exitCode:D?1:Z?1:j??1,stdout:Buffer.concat(q,U).toString("utf8"),stderr:$.toString(),stderrTruncated:$.didTruncate,...D?{spawnError:!0}:{},signal:R??null,timedOut:W,durationMs:performance.now()-J})};F.once("error",()=>{if(D=!0,F.pid===void 0)B(null,null)}),F.once("close",(j,R)=>B(j,R))})}};function g(G,b,z,K,J,Q=15000){if(b==="win32"&&/\.(cmd|bat)$/i.test(z)){if(/["%!\r\n]/.test(z)||K.some(($)=>!/^[a-zA-Z0-9@:/._+-]+$/.test($)))throw Error("Unsafe batch launcher or argument; use an executable instead.");return G.run("cmd.exe",["/d","/s","/c",`""${z}" ${K.join(" ")}"`],{env:J,timeoutMs:Q,windowsVerbatimArguments:!0})}return G.run(z,K,{env:J,timeoutMs:Q})}var y0="Pi install failed; run pi install after checking your npm connection.";function v0(G){let b=Buffer.from(G,"utf8");if(b.length<=M)return G;let z=b.length-M;while(z<b.length){let K=b[z];if(K===void 0||(K&192)!==128)break;z++}return b.subarray(z).toString("utf8")}function E0(G){let b=G.indexOf(`
|
|
3
|
+
`);return b<0?"":G.slice(b+1)}class d extends Error{step="pi-install";exitCode;signal;stderrTail;constructor(G){super(y0);this.name="SetupCommandError",this.exitCode=G.exitCode,this.signal=G.signal;let b=G.stderrTruncated?E0(G.stderrTail):G.stderrTail,z=e(b);this.stderrTail=v0(typeof z==="string"?z:"")}}var f0={opencode:"OpenCode",pi:"Pi"},g0={enrolled:"connected to the vault","not-enrolled":"not connected",unknown:"unknown, check with ck auth status"};function G0({host:G,outcome:b}){return`${f0[G]}: ${g0[b]}`}var d0=new WeakMap;function b0(G,b){if(typeof G!=="object"&&typeof G!=="function"||!G)return;d0.set(G,Object.freeze(b.map((z)=>Object.freeze({...z}))))}import{accessSync as p0,constants as l0,existsSync as a0,readFileSync as i0,realpathSync as s0,statSync as r0}from"node:fs";import{mkdtemp as n0,rm as o0}from"node:fs/promises";import{tmpdir as t0}from"node:os";import{join as e0}from"node:path";import{parse as G2}from"jsonc-parser";import{homedir as m0}from"node:os";import{posix as c0,win32 as h0}from"node:path";import{fileURLToPath as u0}from"node:url";function N(G={}){let b=G.env??process.env,z=G.platform??process.platform,K=z==="win32"?h0:c0,J=G.home??(z==="win32"?b.USERPROFILE:b.HOME)??m0(),Q=G.cwd??process.cwd(),$=(D)=>K.resolve(Q,D),q=b.OPENCODE_CONFIG_DIR?.trim(),U=b.XDG_CONFIG_HOME?.trim(),Z=b.PI_CODING_AGENT_DIR?.trim()||K.join(J,".pi","agent");if(Z==="~")Z=J;else if(/^~[/\\]/.test(Z))Z=K.join(J,Z.slice(2));if(Z.startsWith("file://"))Z=u0(Z);return{env:b,platform:z,path:K,home:J,cwd:Q,opencode:q?$(q):U?K.join($(U),"opencode"):K.join(J,".config","opencode"),pi:$(Z)}}function h(G,b){try{return r0(G)[b]()}catch{return!1}}var _={exists:a0,isFile:(G)=>h(G,"isFile"),isDirectory:(G)=>h(G,"isDirectory"),isExecutable(G){try{return p0(G,l0.X_OK),h(G,"isFile")}catch{return!1}},readText:(G)=>i0(G,"utf8"),realpath:s0};function k(G,b={}){let{env:z,platform:K,path:J,cwd:Q}=N(b),$=b.fs??_,q=Object.entries(z).find(([Z])=>K==="win32"?Z.toUpperCase()==="PATH":Z==="PATH")?.[1]??"",U=K==="win32"?[".exe",".cmd",".bat",""]:[""];for(let Z of q.split(K==="win32"?";":":")){let D=Z.trim().replace(/^"|"$/g,"");if(!D)continue;for(let W of U){let F=J.resolve(Q,D,G+W);if(K==="win32"?$.isFile(F):$.isExecutable(F))return F}}return null}function z0(G={}){let{platform:b,home:z,env:K,path:J}=N(G);if(b==="darwin")return["/Applications/OpenCode.app","/Applications/OpenCode Beta.app",J.join(z,"Applications","OpenCode.app"),J.join(z,"Applications","OpenCode Beta.app")];if(b==="win32"){let Q=K.LOCALAPPDATA||J.join(z,"AppData","Local");return[J.join(Q,"Programs","opencode"),J.join(Q,"opencode")]}return["/opt/OpenCode","/usr/lib/opencode",J.join(z,".local","share","applications","opencode.desktop")]}function u(G,b){let z=b.fs??_,{path:K}=N(b);try{let J=z.readText(G);if(J.length>65536)return G;let Q=[...J.matchAll(/"%~?dp0%?\\([^"%\r\n]+)"/g)];if(!Q.length)Q.push(...J.matchAll(/"\$basedir\/([^"$\r\n]+)"/g));let $=Q.at(-1)?.[1];if($){let q=K.join(K.dirname(G),...$.split(/[/\\]+/));if(z.isFile(q))return z.realpath(q)}return z.realpath(G)}catch{return G}}function b2(G,b){let z=b.fs??_,{path:K}=N(b),J=K.dirname(u(G,b));for(;;){try{let $=JSON.parse(z.readText(K.join(J,"package.json")));if(["@opencode/cli","@opencode-ai/cli"].includes($.name))return"2";if($.name==="opencode-ai")return/^(?:[2-9]\d*|1\d+)\.|^0\.0\.0-(?:beta|dev)-/.test($.version??"")?"2":"1"}catch{}let Q=K.dirname(J);if(Q===J)return null;J=Q}}function J0(G={}){let b=k("opencode",G),z=k("opencode2",G),K=b&&z&&u(b,G)===u(z,G),J=G.fs??_,{path:Q,opencode:$}=N(G),q="1";for(let Z of["jsonc","json"]){let D=Q.join($,`opencode.${Z}`);if(!J.exists(D))continue;try{if(Object.hasOwn(G2(J.readText(D))??{},"plugins"))q="2"}catch{}break}let U=b?b2(b,G)??(K?"2":q):null;if(z&&U==="1"&&!K)return"ambiguous";return z||K?"2":U??q}async function p(G,b={}){let z=b.fs??_,{env:K,platform:J,opencode:Q,pi:$}=N(b),q=b.runner??A,U=k("opencode",b)??k("opencode2",b),Z=k("pi",b),D=k("ck",b),W=async(B)=>{if(!B)return null;let j;try{j=await n0(e0(t0(),"common-auth-setup-version-"));let R={...K,HOME:j,USERPROFILE:j,XDG_CONFIG_HOME:j,XDG_DATA_HOME:j,XDG_STATE_HOME:j,XDG_CACHE_HOME:j,OPENCODE_CONFIG_DIR:j,OPENCODE_CONFIG:void 0,OPENCODE_CONFIG_CONTENT:void 0,OPENCODE_AUTH_CONTENT:void 0,PI_CODING_AGENT_DIR:j},V=await g(q,J,B,["--version"],R,2000);return V.exitCode===0?/\b\d+\.\d+\.\d+(?:-[\w.-]+)?/.exec(V.stdout)?.[0]??null:null}catch{return null}finally{if(j)await o0(j,{recursive:!0,force:!0}).catch(()=>{})}},F=!1;if(D&&z.exists(G.vault.connectionFile))try{(await(b.connect??m)({connectionFile:G.vault.connectionFile,handshakeTimeoutMs:2000})).close(),F=!0}catch{F=!1}let[x,X]=await Promise.all([W(U),W(Z)]);return{opencode:{installed:z.isDirectory(Q)||z0(b).some((B)=>z.exists(B))||U!==null,executable:U,version:x,directory:Q,generation:J0(b)},pi:{installed:Z!==null||z.isDirectory($),executable:Z,version:X,directory:$},claustrum:{available:F,executable:D}}}import{setTimeout as U2}from"node:timers/promises";import{writeEnrollmentTokenFile as W2}from"@cortexkit/claustrum-client";var z2=45000,K0=new Set(["opencode","litecode","opencode2","pi"]),J2=new Set(["node","bun"]),K2=/(?:^|[/\\])pi-coding-agent[/\\]dist[/\\](?:(?:bundle|bun)[/\\])?cli\.m?js$/i;function Q2(G){return[...G.matchAll(/"([^"]*)"|(\S+)/g)].map((b)=>b[1]??b[2]??"")}function Q0(G){return(G.split(/[/\\]/).pop()??"").toLowerCase().replace(/\.(?:exe|cmd|bat|m?js)$/,"")}var Z2=new Set(["-r","--require","--import","--loader","--experimental-loader","-C","--conditions","--env-file","--title","--input-type","--preload","--cwd","-c","--config","--tsconfig-override","-d","--define","-l","--main-fields"]),$2=new Set(["-e","--eval","-p","--print"]);function q2(G,b){for(let z=0;z<b.length;z++){let K=b[z]??"";if(K==="--")return b[z+1];if($2.has(K))return;if(K.startsWith("-")){if(!K.includes("=")&&Z2.has(K))z++;continue}if(G==="bun"&&K==="run")continue;return K}return}function Z0(G){let[b,...z]=Q2(G);if(b===void 0)return null;let K=Q0(b);if(K0.has(K))return K;if(!J2.has(K))return null;let J=q2(K,z);if(J===void 0)return null;let Q=Q0(J);if(K0.has(Q))return Q;return K2.test(J)?"pi":null}class Y extends Error{code="process-inspection-failed";step;exitCode;signal;timedOut;durationMs;constructor(G){super("Process inspection failed; setup cannot prove hosts are stopped.");this.name="ProcessInspectionError",this.step=G.step,this.exitCode=G.exitCode,this.signal=G.signal,this.timedOut=G.timedOut,this.durationMs=G.durationMs}get refusalText(){let G=this.timedOut?"timed out":this.signal?`signal ${this.signal}`:this.exitCode===null?"could not start or complete":this.exitCode===0?"invalid output (exit code 0)":`exit code ${this.exitCode}`;return`${this.message} ${this.step}: ${G} after ${Math.round(this.durationMs)} ms.`}}class T extends Error{activeHosts;constructor(G){let b=G.map((z)=>({pid:z.pid,command:Z0(z.command)??"host"}));super(`OpenCode or Pi processes are currently running:
|
|
4
4
|
${b.map((z)=>` - PID ${z.pid}: ${z.command}`).join(`
|
|
5
5
|
`)}
|
|
6
6
|
|
|
7
|
-
Please quit all OpenCode, LiteCode, and Pi processes before running setup.`);this.activeHosts=b,this.name="ProcessFenceViolationError"}}async function l(G=A,b={}){let z=(b.platform??process.platform)==="win32",J={step:z?"tasklist":"ps",exitCode:null,signal:null,timedOut:!1,durationMs:0},
|
|
7
|
+
Please quit all OpenCode, LiteCode, and Pi processes before running setup.`);this.activeHosts=b,this.name="ProcessFenceViolationError"}}async function l(G=A,b={}){let z=(b.platform??process.platform)==="win32",K=b.selfPid??process.pid,J={step:z?"tasklist":"ps",exitCode:null,signal:null,timedOut:!1,durationMs:0},Q=async($,q,U,Z)=>{let D=performance.now();J={step:$,exitCode:null,signal:null,timedOut:!1,durationMs:0};try{let W=await G.run(q,U,{env:b.env,timeoutMs:Z});return J={step:$,exitCode:W.exitCode,signal:W.signal??null,timedOut:W.timedOut??!1,durationMs:W.durationMs??performance.now()-D},W}finally{if(J.exitCode===null)J.durationMs=performance.now()-D;b.onStep?.({...J})}};try{let $=await Q(z?"tasklist":"ps",z?"tasklist.exe":"ps",z?["/fo","csv","/nh"]:["-eo","pid,command"]);if($.exitCode!==0)throw new Y(J);let q=[];for(let Z of $.stdout.split(/\r?\n/)){let D=Z.trim();if(!D)continue;let W,F;if(z){let x=/^"([^"]+)","(\d+)"(?:,|$)/.exec(D);if(!x)throw new Y(J);F=x[1]??"",W=Number(x[2])}else{let x=/^(\d+)\s+(.+)$/.exec(D);if(!x){if(/^PID\s+COMMAND$/i.test(D))continue;throw new Y(J)}W=Number(x[1]),F=x[2]??""}if(!Number.isSafeInteger(W)||W<0)throw new Y(J);q.push({pid:W,command:F})}if(!q.length)throw new Y(J);let U=q.filter((Z)=>Z.pid!==K&&/^(?:node|bun)\.exe$/i.test(Z.command));if(z&&U.length&&b.inspectRuntimes!==!1){let Z=await Q("CIM","powershell.exe",["-NoProfile","-NonInteractive","-Command",`$ErrorActionPreference = 'Stop'; Get-CimInstance Win32_Process -Filter "Name = 'node.exe' OR Name = 'bun.exe'" | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress`],z2);if(Z.exitCode!==0)throw new Y(J);let D=JSON.parse(Z.stdout||"null"),W=D===null?[]:Array.isArray(D)?D:[D],F=new Map;for(let x of W){if(!x||typeof x!=="object"||!("ProcessId"in x)||!("CommandLine"in x)||!Number.isSafeInteger(x.ProcessId))throw new Y(J);if(typeof x.CommandLine==="string")F.set(Number(x.ProcessId),x.CommandLine);else if(U.some((X)=>X.pid===x.ProcessId))throw new Y(J)}for(let x of U)x.command=F.get(x.pid)??""}return q}catch($){if($ instanceof Y)throw $;throw new Y(J)}}function S(G=A,b={}){let z=b.selfPid??process.pid,K=(J)=>J.pid!==z&&Z0(J.command)!==null;return{async listRunningHosts(J){return(await l(G,{...b,env:J})).filter(K)},async previewRunningHosts(J){let Q=await l(G,{...b,env:J,inspectRuntimes:!1}),$=(b.platform??process.platform)==="win32";return{hosts:Q.filter(K),uncheckedRuntimes:$?Q.filter((q)=>q.pid!==z&&/^(?:node|bun)\.exe$/i.test(q.command)).length:0}}}}async function y(G,b){let z=await G.listRunningHosts(b);if(z.length)throw new T(z)}var $0="Claustrum enrollment did not complete. Inspect and approve with ck, then rerun setup.";class I extends Error{}async function U0(G,b,z,K,J){let{name:Q,paths:$}=G.vault.hosts[b],q=L($);await J();let U=await(z.connect??m)({connectionFile:G.vault.connectionFile,handshakeTimeoutMs:2000}).catch(()=>{throw new I("Claustrum connection failed; start ck and rerun setup.")});try{let Z=new q0({proposedName:Q,paths:q,client:{enrollPropose:async(W)=>{return await J(),U.enrollPropose(W)},enrollPoll:async(W)=>{return await J(),U.enrollPoll(W)}},writeTokenFile:async(W,F)=>{await J(),await W2(W,F)}}),D;for(let W=0;W<300;W++){await J();let F=await Z.reconcile();if(F.state==="approved"){O(K,`Connected ${b} to Claustrum.`);return}if(F.state!=="pending"&&F.state!=="busy")throw new I("Claustrum enrollment refused; inspect its status with ck before rerunning setup.");if(F.state==="pending"&&F.requestId&&F.requestId!==D){if(!/^[a-zA-Z0-9_-]+$/.test(F.requestId))throw new I("Invalid enrollment request id.");D=F.requestId,O(K,"Waiting for approval. In another terminal, run:"),O(K,` ck auth enroll approve --request-id ${F.requestId} --name ${Q}`),O(K,`Enrollment files: ${q.statePath}, ${q.tokenPath}`)}await(z.wait??U2)(1000)}throw new I("Claustrum approval is still pending; approve with ck and rerun setup.")}catch(Z){if(Z instanceof T||Z instanceof Y)throw Z;if(Z instanceof I)throw new I($0);throw Error($0)}finally{U.close()}}async function W0(G,b){let z=new Set(b);for(;;){let K=await v(G,[...["opencode","pi"].map((J)=>({value:J,label:`[${z.has(J)?"x":" "}] ${J==="opencode"?"OpenCode":"Pi"}`,hint:b.includes(J)?"found":"not found"})),{value:"done",label:"Continue with selected hosts"}],{message:"Select hosts to set up",subtitle:"Enter toggles a host; choose Continue when ready."});if(K===null)return null;if(K==="done")return[...z];if(z.has(K))z.delete(K);else z.add(K)}}import{applyEdits as a,createScanner as H2,findNodeAtLocation as M2,modify as D0,parse as N2,parseTree as R2}from"jsonc-parser";import{randomUUID as x2}from"node:crypto";import{mkdir as D2,open as F2,rename as V2,stat as X2,unlink as j2}from"node:fs/promises";import{basename as O2,dirname as B2,join as Y2}from"node:path";import{setTimeout as C2}from"node:timers/promises";async function x0(G,b,z={}){let K=(z.platform??process.platform)==="win32",J=B2(G);await D2(J,{recursive:!0});let Q;if(!K)try{Q=(await X2(G)).mode&4095}catch(U){if(U.code!=="ENOENT")throw U}let $=Y2(J,`.${O2(G)}.${(z.stageName??x2)()}.tmp`),q=!1;try{let U=await F2($,"wx",Q??438);q=!0;try{if(await U.writeFile(b,"utf8"),Q!==void 0)await U.chmod(Q)}finally{await U.close()}let Z=z.now??(()=>performance.now()),D=Z();for(let W=0;;W++){await z.beforeRename?.();try{await(z.rename??V2)($,G),q=!1;return}catch(F){let x=F.code,X=2000-(Z()-D);if(!K||!["EPERM","EBUSY","EACCES"].includes(x??"")||X<=0||W>=40)throw Error(`Unable to replace host config ${G}. Close editors or other programs using the file, then rerun setup.`);await(z.wait??C2)(Math.min(X,25*2**Math.min(W,2)))}}}finally{if(q)await j2($).catch(()=>{})}}function F0(G){let b=typeof G==="string"?G:Array.isArray(G)?G[0]:G&&typeof G==="object"&&("package"in G)?G.package:null;if(typeof b!=="string")return null;let z=b.indexOf("@",b.startsWith("@")?1:0);return z<0?b:b.slice(0,z)}function V0(G,b,z){let K=R2(G),J=K&&M2(K,[b]),Q=J?.children??[],$=Q[z];if(!$||!J)throw Error("Invalid plugin array edit.");let q=[{offset:$.offset,length:$.length,content:""}],U=(Z,D)=>{let W=H2(G.slice(Z,D),!0);if(W.scan(),G[Z+W.getTokenOffset()]===",")q.push({offset:Z+W.getTokenOffset(),length:1,content:""})};if(z===Q.length-1){let Z=Q[z-1];if(Z)U(Z.offset+Z.length,$.offset);U($.offset+$.length,J.offset+J.length-1)}else U($.offset+$.length,Q[z+1]?.offset??$.offset+$.length);return a(G,q)}function X0(G,b,z,K){let J=[],Q=N2(G,J,{allowTrailingComma:!0});if(J.length||!Q||typeof Q!=="object"||Array.isArray(Q))throw Error("Invalid OpenCode config; refusing to overwrite it.");let $={formattingOptions:{insertSpaces:!/^\t+/m.test(G),tabSize:/^([ ]+)"/m.exec(G)?.[1]?.length??2,eol:G.includes(`\r
|
|
8
8
|
`)?`\r
|
|
9
9
|
`:`
|
|
10
|
-
`}},
|
|
11
|
-
`,
|
|
12
|
-
${
|
|
13
|
-
ck auth grant --principal enrolled:${f(Q)} --selector-kind category --selector ${k0.category} --operation read`),Q==="opencode")b("Then run opencode auth login and choose ChatGPT accounts in the vault to activate vault routing without local sign-in.");return}await
|
|
14
|
-
${
|
|
10
|
+
`}},q=G,U=Q[b];if(U!==void 0&&!Array.isArray(U))throw Error(`OpenCode ${b} must be an array.`);let Z=Array.isArray(U)?[...U]:[],D=Z.flatMap((x,X)=>F0(x)===z?[X]:[]),W=`${z}@${K}`;if(!D.length)q=a(q,D0(q,U===void 0?[b]:[b,Z.length],U===void 0?[W]:W,$));else{let x=D[0],X=Z[x],B=Array.isArray(X)?[W,...X.slice(1)]:X&&typeof X==="object"?{...X,package:W}:W;if(JSON.stringify(X)!==JSON.stringify(B))q=a(q,D0(q,[b,x],B,$));for(let j of D.slice(1).reverse())q=V0(q,b,j)}let F=b==="plugin"?"plugins":"plugin";if(Array.isArray(Q[F])){let x=Q[F];for(let X=x.length-1;X>=0;X--)if(F0(x[X])===z)q=V0(q,F,X)}return q}function i(G,b,z={}){let K=z.fs??_,{path:J,opencode:Q}=N(z),$=b==="2"?"plugins":"plugin";return(b==="2"?["opencode"]:["opencode","tui"]).map((U)=>{let Z=J.join(Q,`${U}.jsonc`),D=J.join(Q,`${U}.json`),W=K.exists(Z)?Z:K.exists(D)?D:Z,F=K.exists(W),x=F?K.readText(W):`${JSON.stringify({$schema:`https://opencode.ai/${U==="tui"?"tui":"config"}.json`},null,2)}
|
|
11
|
+
`,X=X0(x,$,G.packages.opencode,G.version);return{path:W,content:X,changed:!F||X!==x}})}async function s(G,b){for(let z of G){if(!z.changed)continue;await b?.(),await x0(z.path,z.content,{beforeRename:b})}}async function r(G,b,z={}){let{platform:K,env:J}=N(z),Q=await g(z.runner??A,K,b,["install",`npm:${G.packages.pi}@${G.version}`],J);if(Q.exitCode!==0||Q.timedOut)throw new d({exitCode:Q.spawnError?null:Q.exitCode,signal:Q.signal??null,stderrTail:Q.stderr,stderrTruncated:Q.stderrTruncated??!1})}var O0="Multiple OpenCode generations found. Choose --opencode=1|2|both before running noninteractive setup.";function k2(G){let b={yes:!1,dryRun:!1,claustrum:!1,noClaustrum:!1,login:!1,opencode:void 0};for(let z of G)if(z==="--yes")b.yes=!0;else if(z==="--dry-run")b.dryRun=!0;else if(z==="--claustrum")b.claustrum=!0;else if(z==="--no-claustrum")b.noClaustrum=!0;else if(z==="--login")b.login=!0;else if(/^--opencode=(1|2|both)$/.test(z))b.opencode=z.slice(11);else throw Error(`Unknown setup argument: ${z}`);if(b.claustrum&&b.noClaustrum)throw Error("--claustrum and --no-claustrum cannot be used together.");if(b.login&&b.claustrum)throw Error("--login and --claustrum cannot be used together.");return b}function w2(G){for(let b of Object.values(G.packages))if(!/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/.test(b))throw Error("Setup requires npm package names.");if(!/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?(?:\+[a-zA-Z0-9.-]+)?$/.test(G.version))throw Error("Setup requires a concrete package version.");for(let b of Object.values(G.vault.hosts))if(!/^[a-z0-9][a-z0-9-]*$/.test(b.name))throw Error("Setup requires lowercase vault names containing only letters, digits and dashes.")}async function A2(G,b,z){let K=[];for(let J of b){let Q=z.get(J)??"not-enrolled";if(Q==="unknown"){let{name:$,paths:q}=G.vault.hosts[J],U=await c(L(q),$).catch(()=>"unreadable");if(U==="vault")Q="enrolled";else if(U==="local")Q="not-enrolled"}K.push({host:J,outcome:Q})}return K}async function n(G,b=[],z={}){let K=k2(b);w2(G);let J=z.terminal??j0(),Q=await p(G,z);O(J,`${G.displayName} setup`);for(let[V,H]of[["OpenCode",Q.opencode],["Pi",Q.pi]])O(J,`${V}: ${H.installed?`found (version ${H.version??"unknown"})`:"not found"} — ${H.directory}`);O(J,`Claustrum: ${Q.claustrum.available?"available":"not available"}`);let $=Q.pi.installed&&!Q.pi.executable;if($)O(J,"Pi: skipped, because its folder exists but pi is not on PATH. Install the Pi CLI and rerun setup to add it.");let q=["opencode","pi"].filter((V)=>Q[V].installed&&!(V==="pi"&&$)),U=K.yes||K.dryRun&&!E(J);if(!U&&!E(J))throw Error("Setup requires a TTY or --yes.");let Z=U?q:await W0(J,q)??[],D=K.opencode??(Q.opencode.generation==="ambiguous"?"1":Q.opencode.generation);if(Z.includes("opencode")&&!K.opencode&&Q.opencode.generation==="ambiguous"){if(U||!E(J))throw Error(O0);let V=await v(J,[{value:"1",label:"OpenCode 1"},{value:"2",label:"OpenCode 2"},{value:"both",label:"Both (one compatible registration)"}],{message:"Which OpenCode generation should be registered?"});if(V===null)return{hosts:[],dryRun:K.dryRun,mode:"local",detection:Q};D=V}if(!Z.length)return O(J,"No hosts selected. Install OpenCode or Pi and rerun setup."),{hosts:Z,dryRun:K.dryRun,mode:"local",detection:Q};let{env:W,platform:F}=N(z),x=z.fence??S(z.runner??A,{platform:F}),X=async()=>{try{await y(x,W)}catch(V){if(V instanceof Y)O(J,V.refusalText);throw V}};if(O(J,"Checking that OpenCode and Pi are not running…"),K.dryRun)try{let V=x.previewRunningHosts?await x.previewRunningHosts(W):{hosts:await x.listRunningHosts(W),uncheckedRuntimes:0},H=V.hosts;if(V.uncheckedRuntimes>0)O(J,"Node or Bun programs are running; a real run checks whether any of them is OpenCode or Pi.");let C=new Set(new T(H).activeHosts.map((w)=>w.command.toLowerCase()==="pi"?"Pi":"OpenCode"));for(let w of C)O(J,`${w} is running; setup will ask you to quit it.`)}catch(V){if(O(J,"Process inspection failed; real setup will require successful inspection and stopped OpenCode/Pi hosts."),V instanceof Y)O(J,V.refusalText)}else await X();if(K.claustrum&&!Q.claustrum.available)throw Error("Claustrum is not available. Start ck or use --no-claustrum for local sign-in.");let B=Boolean(K.claustrum);if(!B&&!K.login&&!K.noClaustrum&&!U&&Q.claustrum.available&&E(J)){let V=await v(J,[{label:"No",value:!1},{label:"Yes",value:!0}],{message:"Connect these hosts to the Claustrum vault?"});if(V===null)return O(J,"Setup cancelled. Nothing was changed."),{hosts:[],dryRun:K.dryRun,mode:"local",detection:Q};B=V===!0}let j=B?"claustrum":"local",R=Z.includes("opencode")?i(G,D,z):[];if(K.dryRun){O(J,"Dry run: no registrations, enrollment, sign-in or migration will be performed.");for(let V of Z){if(G.beforeSignIn)O(J,`Would run beforeSignIn(${V}, ${j}).`);if(B){let H=L(G.vault.hosts[V].paths);O(J,`Would Connect ${V}: write ${H.statePath} and ${H.tokenPath}; wait for ck auth enroll approve.`)}else O(J,`Would sign in locally for ${V}.`);if(G.beforeRegister)O(J,`Would run beforeRegister(${V}, ${j}).`)}for(let V of R)O(J,`${V.changed?"Would write":"Unchanged"} ${V.path}:
|
|
12
|
+
${V.content}`);if(Z.includes("pi"))O(J,`Would run ${Q.pi.executable} install npm:${G.packages.pi}@${G.version}`);for(let V of Z)O(J,`Would migrate ${V} using the plugin callback (provider-specific writes).`)}else{let V={opencodeGeneration:D,mode:j,hosts:Object.freeze([...Z]),piAgentDir:Q.pi.directory},H=new Map;try{for(let C of Z){if(await X(),await G.beforeSignIn?.(C,V),await X(),B){H.set(C,"unknown");try{await U0(G,C,z,J,X)}catch(w){if(w instanceof I)H.set(C,"not-enrolled");throw w}H.set(C,"enrolled")}else await G.signInLocal(C,V);if(await X(),await G.beforeRegister?.(C,j,V),await X(),C==="opencode")await s(R,X);else await r(G,Q.pi.executable,z);await X(),await G.migrate(C,V)}}catch(C){if(H.size===0)throw C;try{let w=await A2(G,Z,H);b0(C,w);for(let L0 of w)O(J,G0(L0))}catch{}throw C}}return O(J,`${K.dryRun?"Planned":"Configured"} ${G.displayName} for ${Z.join(", ")} (${j}).`),O(J,`Next: ${Z.includes("opencode")?"start OpenCode":"start Pi"} and run ${G.slashCommand}.`),{hosts:Z,dryRun:K.dryRun,mode:j,detection:Q}}import{basename as S2}from"node:path";import{resolveClaustrumConnectionPath as y2}from"@cortexkit/claustrum-client";var B0={name:"@cortexkit/pi-openai-auth",version:"1.4.0",license:"MIT",type:"module",repository:{type:"git",url:"git+https://github.com/cortexkit/openai-auth.git",directory:"packages/pi"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"}},files:["dist","README.md","LICENSE"],keywords:["pi-package"],pi:{extensions:["./dist/index.js"]},scripts:{build:"rm -rf dist && bun build src/index.ts --outdir dist --target node --format esm --external '@earendil-works/pi-ai' --external '@earendil-works/pi-ai/*' --external '@earendil-works/pi-coding-agent' --external '@earendil-works/pi-coding-agent/*' --external '@earendil-works/pi-tui' --external '@earendil-works/pi-tui/*' --external @cortexkit/private-files --external @cortexkit/claustrum-client --external @cortexkit/subc-client --minify && bun run build:types","build:types":"cd ../core && bun run build && cd ../pi && tsdown --config tsdown.config.ts --config-loader native",test:"bun test src/tests",typecheck:"tsc",types:"tsc",prepublishOnly:"bun run build"},devDependencies:{"@cortexkit/common-auth":"^0.23.0","@cortexkit/openai-auth-core":"workspace:*"},dependencies:{"@cortexkit/claustrum-client":"^0.12.0","@cortexkit/private-files":"^0.2.1","@cortexkit/subc-client":"^0.22.0"},peerDependencies:{"@earendil-works/pi-ai":">=1.0.1","@earendil-works/pi-coding-agent":">=1.0.1","@earendil-works/pi-tui":">=1.0.1"}};import{homedir as _2}from"node:os";import{join as H0}from"node:path";function T2(){return process.env.PI_AGENT_DIR?.trim()||H0(_2(),".pi","agent")}function M0(){return process.env.PI_OPENAI_AUTH_FILE?.trim()||H0(T2(),Y0)}function L2(G=M0()){return process.env.PI_OPENAI_AUTH_STATE_FILE?.trim()||C0(G)}function N0(G=M0()){return{configPath:G,statePath:L2(G)}}var P={name:"@cortexkit/opencode-openai-auth",version:"1.4.0",license:"MIT",type:"module",repository:{type:"git",url:"git+https://github.com/cortexkit/openai-auth.git",directory:"packages/opencode"},main:"./dist/index.js",types:"./dist/index.d.ts",bin:{"opencode-openai-auth":"./dist/bin.js"},exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"},"./tui":{types:"./dist/tui.d.ts",import:"./src/tui/entry.mjs"},"./tui-prefs":{types:"./dist/tui-preferences.d.ts",import:"./dist/tui-preferences.js"},"./server":{types:"./dist/v2/server.d.ts",import:"./dist/v2/server.js"}},"oc-plugin":["server","tui"],engines:{bun:"1.3.14"},files:["dist","src/tui/entry.mjs","src/tui-compiled","README.md","LICENSE"],scripts:{build:"rm -rf dist && bun build src/index.ts src/v2/server.ts src/sidebar-state.ts src/tui-preferences.ts src/rpc/rpc-client.ts src/rpc/port-file.ts src/rpc/protocol.ts src/rpc/rpc-dir.ts src/bin.ts --root src --outdir dist --target node --format esm --splitting --external @opencode-ai/plugin --external @opencode/plugin --external @cortexkit/private-files --external jsonc-parser --external @cortexkit/claustrum-client --external @cortexkit/subc-client --minify && bun run build:types && bun run build:tui","build:tui":"bun scripts/build-tui.ts","build:types":"cd ../core && bun run build && cd ../opencode && tsdown --config tsdown.config.ts --config-loader native","build:dev":"rm -rf dist && tsc -p tsconfig.build.json",test:"bun test src/tests",typecheck:"tsc",types:"tsc",prepublishOnly:"bun run build"},peerDependencies:{"@opencode-ai/plugin":"*","@opencode/plugin":">=2.0.21"},peerDependenciesMeta:{"@opencode/plugin":{optional:!0}},devDependencies:{"@ai-sdk/openai":"3.0.88","@cortexkit/common-auth":"^0.23.0","@cortexkit/openai-auth-core":"workspace:*","@opencode/plugin":"2.0.32"},dependencies:{"@cortexkit/claustrum-client":"^0.12.0","@cortexkit/private-files":"^0.2.1","@cortexkit/subc-client":"^0.22.0","@opentui/core":">=0.6.1","@opentui/solid":">=0.6.1",ai:"^7.0.143","jsonc-parser":"^3.3.1","solid-js":"1.9.12"}};function T0(G={}){let b=G.print??console.log,z=G.fence??S(),K={opencode:{stateDir:o(A0().statePath),host:"opencode"},pi:{stateDir:o(N0().statePath),host:"pi"}},J=async(Q)=>{if(await c(L(K[Q]),f(Q))!=="local")throw Error(`${Q} is enrolled in Claustrum or its enrollment is unreadable. Disconnect it from the vault before using local sign-in.`)};return{packages:{opencode:P.name,pi:B0.name},version:P.version,displayName:"OpenAI Auth",slashCommand:"/openai",vault:{connectionFile:y2(),hosts:{opencode:{name:f("opencode"),paths:K.opencode},pi:{name:f("pi"),paths:K.pi}}},async beforeRegister(Q,$){if($==="claustrum"){if(b(`Allow this host to read OpenAI accounts with:
|
|
13
|
+
ck auth grant --principal enrolled:${f(Q)} --selector-kind category --selector ${k0.category} --operation read`),Q==="opencode")b("Then run opencode auth login and choose ChatGPT accounts in the vault to activate vault routing without local sign-in.");return}await J(Q)},async signInLocal(Q,$){if(await J(Q),Q==="pi"){b("Start Pi and run /login openai-codex to sign in with Pi itself.");return}if($.opencodeGeneration!=="1"){let j=S2(k("opencode2",G.io)??k("opencode",G.io)??"opencode");b(`In OpenCode 2, run ${j} auth login openai and choose "ChatGPT (openai-auth pool, browser)" or "ChatGPT (openai-auth pool, headless)" to sign in to the account pool and activate it.`)}if($.opencodeGeneration==="2")return;if(I0(process.env))throw Error("Unset OPENCODE_AUTH_CONTENT before local setup sign-in.");let q=_0(),U={path:{id:"openai"}};if(await q.get(U)!==void 0){b("OpenCode already has an OpenAI login. Use opencode auth login to change it.");return}let Z=G.beginLogin??R0,D=new AbortController,W=Boolean(process.env.SSH_CONNECTION||process.env.SSH_TTY||process.platform==="linux"&&!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY),F={version:P.version,signal:D.signal},x,X=!W;try{x=await Z({...F,headless:W})}catch(j){if(W)throw j;X=!1,b("Browser callback unavailable; using device-code sign-in."),x=await Z({version:P.version,headless:!0})}if(X){if(!(G.openBrowser??w0)(x.url))D.abort(),await x.completion.catch(()=>{}),b("Browser unavailable; using device-code sign-in."),x=await Z({version:P.version,headless:!0})}b(`${x.url}
|
|
14
|
+
${x.instructions}`);let B=await x.completion;await y(z),await J(Q),await q.set({...U,body:{type:"oauth",access:B.access,refresh:B.refresh,expires:B.expires,...B.accountId?{accountId:B.accountId}:{}}}),b("Signed in to OpenCode. The first plugin start adopts this login into the account pool.")},async migrate(Q){b(`${Q}: account migration runs on first plugin start; setup leaves existing credentials unchanged.`)}}}if(process.argv[2]!=="setup")console.log("Usage: opencode-openai-auth setup [options]");else try{await n(T0(),process.argv.slice(3))}catch(G){console.error(G instanceof Error?G.message:String(G)),process.exitCode=1}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as KnobValues, c as PluginExtraSection, i as CommandInvocation, l as PluginSection, o as MenuKnob, t as CommandApplyRequest } from "./model-
|
|
2
|
-
import {
|
|
1
|
+
import { a as KnobValues, c as PluginExtraSection, i as CommandInvocation, l as PluginSection, o as MenuKnob, t as CommandApplyRequest } from "./model-DphbMQce.js";
|
|
2
|
+
import { _t as QuotaMap } from "./sidebar-state-pTd9gg9W.js";
|
|
3
3
|
import { ClaustrumClient, EnrollmentPollOutcome } from "@cortexkit/claustrum-client";
|
|
4
4
|
import "@cortexkit/private-files";
|
|
5
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
5
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/schema.d.ts
|
|
6
6
|
type OAuthCredential = {
|
|
7
7
|
type: 'oauth';
|
|
8
8
|
access?: string;
|
|
@@ -191,7 +191,7 @@ interface PoolRow {
|
|
|
191
191
|
unbound?: true;
|
|
192
192
|
}
|
|
193
193
|
//#endregion
|
|
194
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
194
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/errors.d.ts
|
|
195
195
|
/** Every library operation that can fail, as named in the failure value. */
|
|
196
196
|
type PoolOperation = 'initialize' | 'add' | 'replace' | 'rotate' | 'disable' | 'enable' | 'remove' | 'reorder' | 'updateSettings' | 'recordIdentity' | 'updateProviderState' | 'refresh' | 'pull' | 'publishRoster';
|
|
197
197
|
/**
|
|
@@ -238,12 +238,12 @@ declare class PoolOperationError extends Error {
|
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
//#endregion
|
|
241
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
241
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/hooks.d.ts
|
|
242
242
|
interface PoolLogger {
|
|
243
243
|
warn(message: string, data?: unknown): void;
|
|
244
244
|
}
|
|
245
245
|
//#endregion
|
|
246
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
246
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/fs/refresh-file-lock.d.ts
|
|
247
247
|
interface LockLoss {
|
|
248
248
|
readonly reason: 'taken-over' | 'expired' | 'unreadable' | 'renewal-failed' | 'marker-lost';
|
|
249
249
|
readonly expectedOwnerId: string;
|
|
@@ -278,7 +278,7 @@ type RefreshFileLockOptions = {
|
|
|
278
278
|
/** Filesystem leases share wall time across all callers and processes. */
|
|
279
279
|
declare function acquireRefreshFileLock(options: RefreshFileLockOptions): Promise<RefreshFileLock | null>;
|
|
280
280
|
//#endregion
|
|
281
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
281
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/refresh-lock.d.ts
|
|
282
282
|
type LockStep = NonNullable<Parameters<typeof acquireRefreshFileLock>[0]['onStep']> extends ((step: infer S) => unknown) ? S : never;
|
|
283
283
|
/** Tuning shared by every lock the store takes; each field is overridable. */
|
|
284
284
|
interface PoolLockOptions {
|
|
@@ -310,7 +310,7 @@ interface LockEnvironment {
|
|
|
310
310
|
}, event: 'scheduled' | 'cancelled') => void;
|
|
311
311
|
}
|
|
312
312
|
//#endregion
|
|
313
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
313
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/mutate.d.ts
|
|
314
314
|
/** Named points on the write path, for crash and ownership injection. */
|
|
315
315
|
type WriteStep = 'before-config-write' | 'after-config-write' | 'before-state-write' | 'after-state-write';
|
|
316
316
|
/** Awaitable pause points on the pull and refresh paths. */
|
|
@@ -345,11 +345,11 @@ interface StoreContext {
|
|
|
345
345
|
/** What `initializePool` did. */
|
|
346
346
|
type InitializeOutcome = 'initialized' | 'already-ready';
|
|
347
347
|
//#endregion
|
|
348
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
348
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/runtime.d.ts
|
|
349
349
|
/** Where a pull was fired from; `load` fires at most once per process per row. */
|
|
350
350
|
type PullReason = 'load' | 'add' | 'replace' | 'admission';
|
|
351
351
|
//#endregion
|
|
352
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
352
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/attribution.d.ts
|
|
353
353
|
/**
|
|
354
354
|
* What a pull or refresh captured about its row (named by id alongside) when
|
|
355
355
|
* it was issued. A result applies only while the row with that id still has
|
|
@@ -372,7 +372,7 @@ interface Attribution {
|
|
|
372
372
|
identity?: string;
|
|
373
373
|
}
|
|
374
374
|
//#endregion
|
|
375
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
375
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/rows.d.ts
|
|
376
376
|
type FailureHook = (rowId: string, error: PoolOperationError) => void | Promise<void>;
|
|
377
377
|
interface RowOperationOptions {
|
|
378
378
|
/** Called once, awaited, on every non-success path, before locks release. */
|
|
@@ -588,7 +588,7 @@ interface RowTransitionResult {
|
|
|
588
588
|
providerState?: unknown;
|
|
589
589
|
}
|
|
590
590
|
//#endregion
|
|
591
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
591
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/provider-state.d.ts
|
|
592
592
|
/**
|
|
593
593
|
* Receives a private copy of the row's provider state (undefined when the row
|
|
594
594
|
* shows none) and the row as loaded under the locks, and returns the next
|
|
@@ -624,7 +624,7 @@ declare const DECLINE_TRANSITION: unique symbol;
|
|
|
624
624
|
*/
|
|
625
625
|
type RowTransitionMutator = (current: unknown | undefined, row: PoolRow) => unknown | typeof DECLINE_TRANSITION | Promise<unknown | typeof DECLINE_TRANSITION>;
|
|
626
626
|
//#endregion
|
|
627
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
627
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/publication.d.ts
|
|
628
628
|
interface PublishPlan {
|
|
629
629
|
operationId: string;
|
|
630
630
|
remove: Array<{
|
|
@@ -667,7 +667,7 @@ interface PublishResult {
|
|
|
667
667
|
receipt: PublicationReceipt;
|
|
668
668
|
}
|
|
669
669
|
//#endregion
|
|
670
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
670
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/pull.d.ts
|
|
671
671
|
/** What a pull is issued with: the credential and its attribution tuple. */
|
|
672
672
|
interface PullRequest {
|
|
673
673
|
id: string;
|
|
@@ -678,7 +678,7 @@ interface PullRequest {
|
|
|
678
678
|
}
|
|
679
679
|
type PullHook = (request: PullRequest) => Promise<unknown>;
|
|
680
680
|
//#endregion
|
|
681
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
681
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/refresh.d.ts
|
|
682
682
|
/** What the injected provider refresh function returns. */
|
|
683
683
|
interface ProviderRefreshResult {
|
|
684
684
|
access: string;
|
|
@@ -741,7 +741,7 @@ type RefreshOutcome = {
|
|
|
741
741
|
reason: string;
|
|
742
742
|
};
|
|
743
743
|
//#endregion
|
|
744
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
744
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/settings.d.ts
|
|
745
745
|
/** The plugin's settings: every top-level config key except the pool-owned ones. */
|
|
746
746
|
type PoolSettings = Record<string, unknown>;
|
|
747
747
|
type SettingsRead = {
|
|
@@ -785,7 +785,7 @@ type UpdateSettingsResult = {
|
|
|
785
785
|
outcome: 'updated' | 'unchanged';
|
|
786
786
|
};
|
|
787
787
|
//#endregion
|
|
788
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
788
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/store/pool.d.ts
|
|
789
789
|
interface OpenPoolStoreOptions {
|
|
790
790
|
/** The provider every row of this pool belongs to; keys the provider-wide lock. */
|
|
791
791
|
provider: string;
|
|
@@ -971,13 +971,13 @@ interface PoolStore {
|
|
|
971
971
|
pullsSettled(): Promise<void>;
|
|
972
972
|
}
|
|
973
973
|
//#endregion
|
|
974
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
974
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/commands/seam.d.ts
|
|
975
975
|
/** Where a dropped field is reported. Names only, never values. */
|
|
976
976
|
interface SeamLogger {
|
|
977
977
|
warn(message: string, data?: unknown): void;
|
|
978
978
|
}
|
|
979
979
|
//#endregion
|
|
980
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
980
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/commands/builtins.d.ts
|
|
981
981
|
/**
|
|
982
982
|
* What a plugin's login hands back. `ready` adds the account now. `pending`
|
|
983
983
|
* means the user must finish somewhere else (a browser, a device code):
|
|
@@ -1097,17 +1097,92 @@ interface BeginAccountLoginResult {
|
|
|
1097
1097
|
*/
|
|
1098
1098
|
declare function beginAccountLogin(opts: BeginAccountLoginOptions): Promise<BeginAccountLoginResult>;
|
|
1099
1099
|
//#endregion
|
|
1100
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1100
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/claustrum/watch.d.ts
|
|
1101
|
+
/**
|
|
1102
|
+
* How a host currently learns about changes, for logs and status displays.
|
|
1103
|
+
* `watching`: a watch was accepted and is open, so polling is reduced to a
|
|
1104
|
+
* slow safety read. `polling`: no watch is open yet (not started, opening, or
|
|
1105
|
+
* re-subscribing after a close), so the host polls at its usual interval.
|
|
1106
|
+
* `fallback`: the watch is unavailable (an older module or client, a refusal,
|
|
1107
|
+
* the watch limit, or repeated failures), so the host polls at its usual
|
|
1108
|
+
* interval and may try a watch again later. Never carries secrets.
|
|
1109
|
+
*/
|
|
1110
|
+
type WatchMode = 'watching' | 'polling' | 'fallback';
|
|
1111
|
+
/**
|
|
1112
|
+
* The fields every change notice carries, from the vault's watchScoped and
|
|
1113
|
+
* insula's usage.watch alike.
|
|
1114
|
+
*/
|
|
1115
|
+
interface ChangeNotice {
|
|
1116
|
+
readonly kind: string;
|
|
1117
|
+
readonly epoch: string;
|
|
1118
|
+
readonly seq: number;
|
|
1119
|
+
}
|
|
1120
|
+
/** A vault watch notice: `view` is the same digest `list_scoped` returns. */
|
|
1121
|
+
interface ScopedWatchNoticeShape extends ChangeNotice {
|
|
1122
|
+
readonly view: string;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* How a vault watch ended, as claustrum-client 0.12.0 reports it. `refused`
|
|
1126
|
+
* and `not_accepting` both mean the watch closed before its first notice; the
|
|
1127
|
+
* client then made one `list_scoped` read to learn why, and `refused` carries
|
|
1128
|
+
* that read's refusal.
|
|
1129
|
+
*/
|
|
1130
|
+
type ScopedWatchEnd = {
|
|
1131
|
+
readonly kind: 'refused';
|
|
1132
|
+
readonly error: unknown;
|
|
1133
|
+
} | {
|
|
1134
|
+
readonly kind: 'transport_lost';
|
|
1135
|
+
readonly error: unknown;
|
|
1136
|
+
} | {
|
|
1137
|
+
readonly kind: 'ended' | 'not_accepting' | 'unsupported' | 'stopped';
|
|
1138
|
+
};
|
|
1139
|
+
interface ScopedWatchHandle {
|
|
1140
|
+
stop(): void;
|
|
1141
|
+
readonly closed: Promise<ScopedWatchEnd>;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* The part of a vault client that can watch. claustrum-client added
|
|
1145
|
+
* `watchScoped` in 0.12.0; the peer range still admits 0.6.2, so it is
|
|
1146
|
+
* optional and detected at run time.
|
|
1147
|
+
*/
|
|
1148
|
+
interface ScopedWatchSource {
|
|
1149
|
+
watchScoped?(onNotice: (notice: ScopedWatchNoticeShape) => void, options?: {
|
|
1150
|
+
enrollmentToken?: string;
|
|
1151
|
+
}): ScopedWatchHandle;
|
|
1152
|
+
}
|
|
1153
|
+
//#endregion
|
|
1154
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/claustrum/insula.d.ts
|
|
1155
|
+
/**
|
|
1156
|
+
* A held-open `usage.watch` stream. `closed` resolves when insula ends the
|
|
1157
|
+
* stream (STREAM_END at shutdown, or a reply that ends it) or after `stop()`,
|
|
1158
|
+
* and rejects with insula's refusal (an error with a `code`, such as
|
|
1159
|
+
* `unknown_method` from an insula that predates the method, or
|
|
1160
|
+
* `usage_watch_limit` when 64 watches are already open) or with the
|
|
1161
|
+
* transport failure.
|
|
1162
|
+
*/
|
|
1163
|
+
interface InsulaUsageWatch {
|
|
1164
|
+
stop(): void;
|
|
1165
|
+
readonly closed: Promise<void>;
|
|
1166
|
+
}
|
|
1101
1167
|
/** Optional transport for custom scoped clients; getUsage must not retry refusals. */
|
|
1102
1168
|
interface InsulaUsageTransport {
|
|
1103
1169
|
connectionFile: string;
|
|
1104
1170
|
getUsage(): Promise<unknown>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Open a `usage.watch` stream, passing each notice's raw JSON body to
|
|
1173
|
+
* `onNotice`. Optional: a transport without it is polled as before.
|
|
1174
|
+
*/
|
|
1175
|
+
watchUsage?(onNotice: (body: Uint8Array) => void): InsulaUsageWatch;
|
|
1105
1176
|
}
|
|
1106
1177
|
//#endregion
|
|
1107
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1178
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/claustrum/custody.d.ts
|
|
1179
|
+
/**
|
|
1180
|
+
* `watchScoped` is present from claustrum-client 0.12.0. Hosts detect it at
|
|
1181
|
+
* run time and keep polling without it.
|
|
1182
|
+
*/
|
|
1108
1183
|
type ClaustrumScopedClient = Pick<ClaustrumClient, 'listScoped' | 'getScoped' | 'reportAuthFailureScoped' | 'close'> & {
|
|
1109
1184
|
insula?: InsulaUsageTransport;
|
|
1110
|
-
};
|
|
1185
|
+
} & ScopedWatchSource;
|
|
1111
1186
|
/** The two credential types a plugin's family can hold; routing differs by type. */
|
|
1112
1187
|
type VaultCredentialType = 'oauth' | 'api_key';
|
|
1113
1188
|
/**
|
|
@@ -1192,9 +1267,20 @@ interface ClaustrumScopedAttempt {
|
|
|
1192
1267
|
readonly accessToken: string;
|
|
1193
1268
|
readonly recordVersion: number;
|
|
1194
1269
|
readonly expiresAtMs: number | null;
|
|
1270
|
+
/**
|
|
1271
|
+
* True when this receipt was not freshly served but is the last token kept
|
|
1272
|
+
* from an earlier read, used because the vault could not be reached. A 401
|
|
1273
|
+
* with such a receipt must not be retried and is not reported to the vault,
|
|
1274
|
+
* which is unreachable.
|
|
1275
|
+
*/
|
|
1276
|
+
readonly fromKeptReceipt?: true;
|
|
1277
|
+
}
|
|
1278
|
+
interface KeptReceiptState {
|
|
1279
|
+
readonly active: boolean;
|
|
1280
|
+
readonly since: number | null;
|
|
1195
1281
|
}
|
|
1196
1282
|
//#endregion
|
|
1197
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1283
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/claustrum/interlock.d.ts
|
|
1198
1284
|
/**
|
|
1199
1285
|
* The declined-account interlock: the user's "do not use this vault account",
|
|
1200
1286
|
* kept on the consumer side because the vault has no notion of it.
|
|
@@ -1213,7 +1299,7 @@ interface DeclinedAccount {
|
|
|
1213
1299
|
readonly accountIdentity?: string;
|
|
1214
1300
|
}
|
|
1215
1301
|
//#endregion
|
|
1216
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1302
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/claustrum/roster.d.ts
|
|
1217
1303
|
/**
|
|
1218
1304
|
* One vault account as the pool sees it. It carries no bearer material: the
|
|
1219
1305
|
* access token is fetched from the vault for every send. Several vault
|
|
@@ -1268,7 +1354,18 @@ interface VaultRosterFile {
|
|
|
1268
1354
|
*/
|
|
1269
1355
|
type QuotaReceipt = Pick<ClaustrumScopedAttempt, 'credentialId' | 'accountIdentity' | 'accountIdentitySource' | 'expectedAccountIdentity'>;
|
|
1270
1356
|
//#endregion
|
|
1271
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1357
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/claustrum/consumer.d.ts
|
|
1358
|
+
/**
|
|
1359
|
+
* How a started consumer learns about changes, for logs and status displays.
|
|
1360
|
+
* `insula` is present when the consumer was given an insula source. Never
|
|
1361
|
+
* carries secrets.
|
|
1362
|
+
*/
|
|
1363
|
+
interface ClaustrumWatchState {
|
|
1364
|
+
readonly vault: WatchMode;
|
|
1365
|
+
readonly insula?: WatchMode;
|
|
1366
|
+
}
|
|
1367
|
+
//#endregion
|
|
1368
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.23.0+48f2e2ce69c71a39/node_modules/@cortexkit/common-auth/dist/claustrum/enrollment.d.ts
|
|
1272
1369
|
interface ClaustrumEnrollmentClient {
|
|
1273
1370
|
enrollPropose(input: {
|
|
1274
1371
|
name: string;
|
|
@@ -1369,6 +1466,12 @@ interface OpenAiVaultOptions {
|
|
|
1369
1466
|
pollIntervalMs?: number;
|
|
1370
1467
|
fetchImpl?: () => typeof fetch;
|
|
1371
1468
|
now?: () => number;
|
|
1469
|
+
/**
|
|
1470
|
+
* Replace the timers behind the background poll, the vault and insula
|
|
1471
|
+
* watches' retries and the outage probe (tests).
|
|
1472
|
+
*/
|
|
1473
|
+
setTimeoutImpl?: typeof setTimeout;
|
|
1474
|
+
clearTimeoutImpl?: typeof clearTimeout;
|
|
1372
1475
|
}
|
|
1373
1476
|
/** One host's view of its OpenAI accounts in the vault. */
|
|
1374
1477
|
declare class OpenAiVault {
|
|
@@ -1387,9 +1490,13 @@ declare class OpenAiVault {
|
|
|
1387
1490
|
*/
|
|
1388
1491
|
enrolled(): boolean;
|
|
1389
1492
|
/**
|
|
1390
|
-
*
|
|
1391
|
-
* consumer sends no vault request. A new
|
|
1392
|
-
* process is detected on the next poll.
|
|
1493
|
+
* Starts the consumer's background poll and its vault and insula watches.
|
|
1494
|
+
* With local authority the consumer sends no vault request. A new
|
|
1495
|
+
* enrollment completed by another process is detected on the next poll.
|
|
1496
|
+
* While the vault watch is open the poll lists the vault only every five
|
|
1497
|
+
* minutes, and a notice that the visible accounts changed starts a
|
|
1498
|
+
* discovery at once; without a watch (an older vault or client, or a
|
|
1499
|
+
* refusal) every poll lists the vault as before.
|
|
1393
1500
|
*/
|
|
1394
1501
|
start(): void;
|
|
1395
1502
|
/**
|
|
@@ -1414,6 +1521,16 @@ declare class OpenAiVault {
|
|
|
1414
1521
|
*/
|
|
1415
1522
|
refresh(): Promise<VaultRosterFile | undefined>;
|
|
1416
1523
|
snapshot(): VaultRosterFile | undefined;
|
|
1524
|
+
/**
|
|
1525
|
+
* Whether the consumer learns about vault and insula changes from a watch
|
|
1526
|
+
* or by polling, without any I/O.
|
|
1527
|
+
*/
|
|
1528
|
+
watchState(): ClaustrumWatchState;
|
|
1529
|
+
/**
|
|
1530
|
+
* Whether any account is being served the last token the vault gave it
|
|
1531
|
+
* because the vault cannot be reached, without any I/O.
|
|
1532
|
+
*/
|
|
1533
|
+
keptReceiptState(): KeptReceiptState;
|
|
1417
1534
|
/**
|
|
1418
1535
|
* What the vault says this host is granted, from the latest list, without
|
|
1419
1536
|
* any I/O. Undefined is unknown (a vault that does not report grants, or
|
|
@@ -1476,7 +1593,7 @@ declare class OpenAiVault {
|
|
|
1476
1593
|
* the background; a failure is logged.
|
|
1477
1594
|
*/
|
|
1478
1595
|
recordSnapshot(routeId: string, snapshot: unknown, complete: boolean, receipt: QuotaReceipt): Promise<void>;
|
|
1479
|
-
/** Joins a quota poll;
|
|
1596
|
+
/** Joins a quota poll; insula decides whether a background provider read is needed. */
|
|
1480
1597
|
pollQuota(routeId: string, background?: boolean): Promise<{
|
|
1481
1598
|
ok: boolean;
|
|
1482
1599
|
error?: string;
|