@cortexkit/opencode-anthropic-auth 1.21.0 → 1.22.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/README.md CHANGED
@@ -33,13 +33,13 @@ This repo is a Bun workspace monorepo with two user-facing integrations and one
33
33
  - **Quota window priming**: opt in with `/claude-prime on` to start each 5-hour quota window about one minute after it resets instead of waiting for the next normal prompt.
34
34
  - **Lane start (OpenCode only)**: use `/claude-start` to fire one synthetic, one-token turn through the current session's normal model, agent, variant, quota, routing, cache, and request pipeline.
35
35
  - **Fast mode toggle**: use `/claude-fast on|off` to request Anthropic fast mode for supported Opus models.
36
- - **Adaptive reasoning visibility**: request summarized adaptive thinking for Claude Fable 5, Mythos 5, and Opus 5. OpenCode receives native `low`, `medium`, `high`, `xhigh`, and `max` Opus 5 effort variants rather than legacy manual-thinking budgets.
36
+ - **Adaptive reasoning visibility**: request summarized adaptive thinking for Claude Fable 5/5.1, Mythos 5/5.1, and Opus 5. OpenCode exposes native `low`, `medium`, `high`, `xhigh`, and `max` effort variants for Fable 5.1 and Opus 5. OAuth Fable 5.1 sessions can change effort between turns without rewriting the cached prefix.
37
37
  - **Fable/Opus 5 safety fallback**: eligible OAuth requests try Anthropic's server-side safety fallback first. The plugin preserves Anthropic's fallback conversation boundary across OpenCode history and automatically starts its deterministic 10-response Opus 4.8 recovery if the response still ends in refusal. The TUI sidebar and OpenCode Desktop report the active target model and restoration. Set `OPENCODE_ANTHROPIC_AUTH_FALLBACK_MODE=legacy` to bypass the server policy and use client-side recovery exclusively.
38
38
  - **Live quota visibility**: use `/claude-quota` to see main and fallback quota state, reset times, and refresh errors.
39
39
  - **Host-local quota feed**: optionally publish sanitized response-header quota observations so another local CortexKit process can reuse fresh account state without polling Anthropic's rate-limited usage endpoint.
40
40
  - **Killswitch**: per-account hard-block thresholds that stop requests before hitting Anthropic's rate limits, with synthetic 429 retry-after when all accounts are exhausted.
41
41
  - **User-owned Cloudflare relay**: optionally provision your own Worker relay to reduce repeated client upload bytes for large OpenCode or Pi requests.
42
- - **Claude-compatible request hardening**: final-body billing signing, safer token refresh persistence, replay-safe fallback retries, and subagent cache isolation.
42
+ - **Claude-compatible request hardening**: Claude Code 2.1.258 identity and final-body billing signing, live-session-stable billing suffixes, Fable 5.1 thinking-prefix recovery, safer token refresh persistence, replay-safe fallback retries, and subagent cache isolation.
43
43
 
44
44
  ## What these integrations do
45
45
 
@@ -184,6 +184,9 @@ Example:
184
184
  "quotaHeaderFeed": {
185
185
  "enabled": false
186
186
  },
187
+ "claustrum": {
188
+ "accounts": {}
189
+ },
187
190
  "killswitch": {
188
191
  "enabled": false,
189
192
  "main": { "five_hour": 5, "seven_day": 10, "scoped": 0 },
@@ -205,6 +208,9 @@ Example:
205
208
  "claudeFast": {
206
209
  "enabled": false
207
210
  },
211
+ "thinkingBinding": {
212
+ "prefixMismatchBehavior": "account-default"
213
+ },
208
214
  "costZeroing": {
209
215
  "enabled": true
210
216
  },
@@ -221,8 +227,12 @@ Example:
221
227
 
222
228
  The `routing` block controls `/claude-routing`, `claudeCache` controls `/claude-cache`, `cacheKeep` controls `/claude-cachekeep`, and `claudeFast` controls `/claude-fast`. OpenCode zeroes Anthropic OAuth model costs by default because OAuth usage is quota-based; set `costZeroing.enabled` to `false` only if you want OpenCode to display the provider's model pricing instead. Set `quota.showToasts` to `true` to opt into OpenCode quota toast notifications after quota refreshes. The `main` field identifies OpenCode's primary auth entry; Pi keeps primary OAuth credentials in Pi's own credential store, but uses the same sidecar shape for CortexKit settings and fallback account labels.
223
229
 
230
+ `thinkingBinding.prefixMismatchBehavior` controls replayed signed/redacted thinking on OAuth Fable 5.1 requests. `account-default` (the default) sends no explicit prefix-mismatch override. Use `error` to make prefix changes fail deterministically during compaction testing, or `drop_block` to ask Anthropic to discard mismatched thinking blocks. The beta header is added only when an explicit behavior is configured and replayable thinking is present.
231
+
224
232
  `quotaHeaderFeed.enabled` is an OpenCode-only, restart-required opt-in. It publishes only allowlisted quota-window values, an opaque account reference, an observation timestamp, and the configured OAuth-account count; it never publishes tokens, raw headers, request bodies, model IDs, or refresh errors. Per-process lease files use owner-only permissions under `$TMPDIR/opencode-anthropic-auth/quota-header-feed`, expire after three minutes, and can be redirected with `OPENCODE_ANTHROPIC_AUTH_QUOTA_FEED_DIR`.
225
233
 
234
+ `claustrum.accounts.<fallback-account-id>.enabled` is a per-account opt-in for fallback credential custody. It is inert unless that account's capability handle has been provisioned in `anthropic-auth-state.json`; handles are bearer credentials and must not be copied into the public config file.
235
+
226
236
  Runtime data is stored separately in `anthropic-auth-state.json`: fallback OAuth tokens, API-route keys, token refresh backoff, quota snapshots, and quota API backoff. Sticky session assignments use `anthropic-auth-routing-state.json` and store only SHA-256 hashes of session IDs. Background refresh and quota checks write only runtime state, so editing `anthropic-auth.json` does not get overwritten by another running plugin instance.
227
237
 
228
238
  ## OpenCode lane-start setting
@@ -269,9 +279,27 @@ Fallback retries are only attempted when the request body is safely replayable.
269
279
 
270
280
  ### Token refresh
271
281
 
272
- Fallback OAuth tokens refresh in the background so idle accounts do not expire before they are needed. Refresh token rotation is persisted immediately. The plugin also re-reads the latest sidecar account before refreshing, which avoids using stale refresh-token snapshots when multiple background paths run close together.
282
+ Fallback OAuth tokens refresh in the background so idle accounts do not expire before they are needed. Refresh token rotation is persisted immediately. The plugin also re-reads the latest sidecar account before refreshing, which avoids using stale refresh-token snapshots when multiple background paths run close together. Persisted refresh backoffs are bound to the refresh token that produced them, so replacing a rejected credential immediately clears its stale latch.
283
+
284
+ If Anthropic reports `invalid_grant`, that account must be logged in again. `/claude-account reset-backoff` manually clears the main account's refresh backoff and its matching quota backoff.
285
+
286
+ ### Optional Claustrum custody
287
+
288
+ OpenCode can obtain an opted-in fallback OAuth account's access credential from a local [Claustrum](https://github.com/cortexkit/claustrum) daemon instead of refreshing that account independently. After provisioning the account's runtime handle, enable custody by account ID:
289
+
290
+ ```json
291
+ {
292
+ "claustrum": {
293
+ "accounts": {
294
+ "personal-alt": { "enabled": true }
295
+ }
296
+ }
297
+ }
298
+ ```
299
+
300
+ The request path reads only a resident in-memory credential. Startup warming and periodic custody ticks perform vault I/O and keep idle credentials refreshed; a cold or unavailable vault falls back to the sidecar credential path. Vault-served 401 reports carry the exact record version and response provenance, including relay-stream 401s, so a sidecar-served failure cannot invalidate a healthy vault credential. `/claude-account` and the account modal show the gate, current vault service, and vault reauthentication state without exposing capability handles.
273
301
 
274
- If Anthropic reports `invalid_grant`, that fallback account must be logged in again.
302
+ Custody currently applies only to fallback OAuth accounts. Main-account vault service is not implemented. If Claustrum has replaced the main host credential with its provider-bound tombstone, the plugin rejects refresh locally without contacting Anthropic or persisting a permanent `invalid_grant` state.
275
303
 
276
304
  ## Quota-aware routing
277
305
 
@@ -302,7 +330,7 @@ Reset times are rendered as relative durations, such as `resets in 10m` or `rese
302
330
 
303
331
  ## Safety fallback
304
332
 
305
- Eligible Fable 5 and Opus 5 OAuth requests try Anthropic's server-side safety fallback first. The plugin sends `fallbacks: "default"` with Anthropic's server-side fallback beta, preserves fallback conversation boundaries in OpenCode history, and reports model handoffs and restoration in the TUI sidebar or OpenCode Desktop. Follow-up requests may remain on Anthropic's selected fallback model for approximately one hour.
333
+ Eligible Fable 5/5.1 and Opus 5 OAuth requests try Anthropic's server-side safety fallback first. The plugin sends `fallbacks: "default"` with Anthropic's server-side fallback beta, preserves fallback conversation boundaries in OpenCode history, and reports model handoffs and restoration in the TUI sidebar or OpenCode Desktop. Follow-up requests may remain on Anthropic's selected fallback model for approximately one hour.
306
334
 
307
335
  If an eligible OAuth response still ends in refusal, CortexKit automatically starts its deterministic 10-successful-response Opus 4.8 recovery, prewarms the selected source model without the server-fallback opt-in, and then restores that model. If the refused response already completed a tool call, the plugin preserves that call and continues with its existing tool result instead of replaying the tool.
308
336
 
@@ -314,7 +342,7 @@ To bypass Anthropic's server policy and use deterministic client recovery from t
314
342
  OPENCODE_ANTHROPIC_AUTH_FALLBACK_MODE=legacy opencode
315
343
  ```
316
344
 
317
- Legacy mode routes a refused Fable 5 or Opus 5 session through Opus 4.8 for 10 successful responses, prewarms the selected source model's cache, and then restores that model without first opting into Anthropic's server policy. Unset the variable and restart OpenCode to return to the default server-first policy with the same client recovery as a backstop.
345
+ Legacy mode routes a refused Fable 5/5.1 or Opus 5 session through Opus 4.8 for 10 successful responses, prewarms the selected source model's cache, and then restores that model without first opting into Anthropic's server policy. Unset the variable and restart OpenCode to return to the default server-first policy with the same client recovery as a backstop.
318
346
 
319
347
  ## Killswitch
320
348
 
@@ -520,7 +548,7 @@ Both OpenCode and Pi packages can persistently request Anthropic fast mode for s
520
548
  /claude-fast off
521
549
  ```
522
550
 
523
- When enabled, supported requests add `speed: "fast"` to the Anthropic JSON body and include the `fast-mode-2026-02-01` beta header. Unsupported models are left at standard speed. Anthropic currently documents fast mode for `claude-opus-4-6`, `claude-opus-4-7`, `claude-opus-4-8`, and `claude-opus-5`; Claude Fable 5 and Mythos 5 are not fast-mode models.
551
+ When enabled, supported requests add `speed: "fast"` to the Anthropic JSON body and include the `fast-mode-2026-02-01` beta header. Unsupported models are left at standard speed. Anthropic currently documents fast mode for `claude-opus-4-6`, `claude-opus-4-7`, `claude-opus-4-8`, and `claude-opus-5`; Claude Fable and Mythos 5/5.1 are not fast-mode models.
524
552
 
525
553
  Fast and standard speeds do not share prompt-cache prefixes, so switching this setting can cause cache misses.
526
554
 
@@ -666,7 +694,7 @@ For Claude Pro/Max OAuth requests, the plugin works at the final Anthropic wire-
666
694
  4. Prepends Claude Code identity and billing-header blocks.
667
695
  5. Rewrites cache controls according to `/claude-cache` mode.
668
696
  6. Renames MCP tool names into Claude-compatible PascalCase form.
669
- 7. Opts eligible Fable 5 and Opus 5 OAuth requests into Anthropic's server-side safety fallback, restores stored fallback boundaries, and activates replay-safe client recovery if the response still refuses.
697
+ 7. Opts eligible Fable 5/5.1 and Opus 5 OAuth requests into Anthropic's server-side safety fallback, restores stored fallback boundaries, and activates replay-safe client recovery if the response still refuses.
670
698
  8. Computes final-body `cch` over the fully serialized request body.
671
699
 
672
700
  The sanitizer is anchor-based: it removes paragraphs containing known OpenCode documentation or source anchors, performs a small set of inline replacements, and preserves the rest of the prompt including user/project instructions, tool policy, environment context, and file paths.
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{G as z,H as N,I as P,K as L,Ka as U,M as E,P as K,R as S,mc as T,oc as q}from"./index-yskwj5e6.js";import"./index-4nz423bt.js";import{Zc as w}from"./index-4x20896x.js";import{stdin as x,stdout as v}from"node:process";import{createInterface as y}from"node:readline/promises";function R(){return{version:1,main:{type:"opencode",provider:"anthropic"},fallbackOn:[401,403,429],refresh:{enabled:!0,intervalMinutes:10,refreshBeforeExpiryMinutes:240},quota:{enabled:!0,checkIntervalMinutes:5,minimumRemaining:{five_hour:10,seven_day:20},failClosedOnUnknownQuota:!0},accounts:[]}}function _(){console.log(`Usage:
2
+ import{$ as S,Fc as T,Hc as q,L as z,M as N,O as P,Q as L,T as E,Wa as U,X as K}from"./index-d3f8g6ve.js";import"./index-8aga2zwv.js";import{ud as w}from"./index-cgez4m0h.js";import{stdin as x,stdout as v}from"node:process";import{createInterface as y}from"node:readline/promises";function R(){return{version:1,main:{type:"opencode",provider:"anthropic"},fallbackOn:[401,403,429],refresh:{enabled:!0,intervalMinutes:10,refreshBeforeExpiryMinutes:240},quota:{enabled:!0,checkIntervalMinutes:5,minimumRemaining:{five_hour:10,seven_day:20},failClosedOnUnknownQuota:!0},accounts:[]}}function _(){console.log(`Usage:
3
3
  opencode-anthropic-auth login [label]
4
4
  opencode-anthropic-auth api add [label]
5
5
  opencode-anthropic-auth list
@@ -0,0 +1,58 @@
1
+ import { type AdaptiveEffort } from '@cortexkit/anthropic-auth-core';
2
+ export declare const EFFORT_MARKER_PREFIX = "<cortexkit-internal-effort-v2 ";
3
+ export declare const EFFORT_PLAN_REQUEST_HEADER = "x-cortexkit-effort-plan";
4
+ export type OpenCodeEffortMarkerPlan = {
5
+ scope: string;
6
+ baseline: AdaptiveEffort;
7
+ markerCount: number;
8
+ digest: string;
9
+ sessionId: string;
10
+ messageId: string;
11
+ };
12
+ export declare class EffortMarkerCorrelationError extends Error {
13
+ constructor(message: string);
14
+ }
15
+ type OpenCodeMessageInfo = {
16
+ id?: unknown;
17
+ sessionID?: unknown;
18
+ role?: unknown;
19
+ model?: {
20
+ providerID?: unknown;
21
+ modelID?: unknown;
22
+ variant?: unknown;
23
+ };
24
+ };
25
+ type MutableOpenCodePart = Record<string, unknown> & {
26
+ type?: unknown;
27
+ text?: unknown;
28
+ ignored?: unknown;
29
+ mime?: unknown;
30
+ };
31
+ type MutableOpenCodeMessage = {
32
+ info?: OpenCodeMessageInfo;
33
+ parts?: MutableOpenCodePart[];
34
+ };
35
+ export declare function encodeOpenCodeEffortPlan(plan: OpenCodeEffortMarkerPlan): string;
36
+ /**
37
+ * Annotate effort-changing user turns before OpenCode lowers its internal
38
+ * message records. Markers are stable by session/message identity so later
39
+ * transforms may persist and restore them without changing request lineage.
40
+ */
41
+ export declare function markOpenCodeEffortTransitions(messages: MutableOpenCodeMessage[]): OpenCodeEffortMarkerPlan | null;
42
+ /** Consume request-correlated markers and insert Anthropic effort system messages. */
43
+ export declare function applyOpenCodeEffortMarkers(body: Record<string, unknown>, enabled: boolean, requestPlanHeader?: string): {
44
+ found: number;
45
+ inserted: number;
46
+ };
47
+ export declare class OpenCodeEffortPlanTracker {
48
+ private readonly plans;
49
+ record(plan: OpenCodeEffortMarkerPlan): void;
50
+ clear(sessionId: string, messageId: string): void;
51
+ markHeaders(input: {
52
+ sessionId: string;
53
+ messageId: string;
54
+ headers: Record<string, string>;
55
+ }): boolean;
56
+ private key;
57
+ }
58
+ export {};
@@ -21,14 +21,13 @@ export type FableFallbackPlan = {
21
21
  };
22
22
  /**
23
23
  * Models whose content-filter refusal we recover from by downgrading to Opus 4.8
24
- * for a short window. Fable 5 is the original case; Opus 5 is identical in
25
- * shape (cyber safety classifiers that can return `stop_reason: "refusal"`,
26
- * Anthropic's own fallback default is `claude-opus-4-8`, same pricing). Mythos
27
- * has no classifiers and Sonnet 5 is not flagged — both stay outside this
28
- * gate. The single shared fallback id matches Anthropic's default for both
29
- * source models, so the recovery period is uniform.
24
+ * for a short window. Fable 5, Fable 5.1, and Opus 5 each have a separate
25
+ * source family because recovery state must not cross-contaminate distinct
26
+ * requested models. All three use Anthropic's `claude-opus-4-8` fallback for
27
+ * the same classifier refusal shape and recovery period. Mythos has no
28
+ * classifiers and Sonnet 5 is not flagged — both stay outside this gate.
30
29
  */
31
- export type RecoverableRefusalFamily = 'fable-5' | 'opus-5';
30
+ export type RecoverableRefusalFamily = 'fable-5' | 'fable-5-1' | 'opus-5';
32
31
  export declare function recoverableRefusalFamily(model: unknown): RecoverableRefusalFamily | null;
33
32
  export declare function isRecoverableRefusalModel(model: unknown): model is string;
34
33
  export declare class FableFallbackManager {
@@ -1 +1 @@
1
- import{createHash as z}from"node:crypto";import{homedir as F,tmpdir as O}from"node:os";import{join as q,resolve as G}from"node:path";var J="OPENCODE_ANTHROPIC_AUTH_RPC_DIR";function T(g){let k=process.env[J]?.trim();if(k)return G(g,k);let w=z("sha256").update(g).digest("hex").slice(0,16),x=process.env.XDG_STATE_HOME||q(F(),".local","state");return q(x,"cortexkit","anthropic-auth","rpc",w)}export{O as Vc,T as Wc};
1
+ import{createHash as z}from"node:crypto";import{homedir as F,tmpdir as O}from"node:os";import{join as q,resolve as G}from"node:path";var J="OPENCODE_ANTHROPIC_AUTH_RPC_DIR";function T(g){let k=process.env[J]?.trim();if(k)return G(g,k);let w=z("sha256").update(g).digest("hex").slice(0,16),x=process.env.XDG_STATE_HOME||q(F(),".local","state");return q(x,"cortexkit","anthropic-auth","rpc",w)}export{O as qd,T as rd};
@@ -1,4 +1,4 @@
1
1
  import*as j from"node:fs";import*as P from"node:os";import*as V from"node:path";var U={error:0,warn:1,info:2,debug:3,trace:4},O=new Set(Object.keys(U));function F(q){if(!q)return null;let Q=q.trim().toLowerCase();return O.has(Q)?Q:null}var S=F(process.env.OPENCODE_ANTHROPIC_AUTH_LOG_LEVEL),M=S??"info";function L(q){M=q}function i(){return M}function X(q){return U[q]<=U[M]}var J=process.env.OPENCODE_ANTHROPIC_AUTH_LOG_FILE??V.join(P.tmpdir(),"opencode-anthropic-auth.log");function h(){return J}var R=5242880,N=3;function I(){try{if(!j.existsSync(J))return;if(j.statSync(J).size<R)return}catch{return}try{for(let q=N;q>=1;q--){let Q=q===1?J:`${J}.${q-1}`,W=`${J}.${q}`;try{if(q===N)try{j.unlinkSync(W)}catch{}if(j.existsSync(Q))j.renameSync(Q,W)}catch{}}}catch{}}var T=/^(authorization|x-api-key|cookie|set-cookie|refresh|access|token)$/i;function k(q){if(T.test(q))return!0;let Q=q.toLowerCase().replace(/[-_]/g,"");if(Q.includes("apikey"))return!0;if(Q.endsWith("secret")||Q.endsWith("password"))return!0;if(Q.endsWith("token")&&!Q.endsWith("tokens"))return!0;return!1}var f=[/Bearer\s+\S+/,/sk-[A-Za-z0-9-]+/,/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/];function _(q){if(typeof q!=="string")return!1;return f.some((Q)=>Q.test(q))}function G(q){if(q==null||Object.keys(q).length===0)return;let Q=new WeakSet;function W($){if($==null||typeof $!=="object"){if(_($))return"***REDACTED***";return $}if(Q.has($))return"[Circular]";Q.add($);try{if(Array.isArray($))return $.map(W);let x=$,B={};for(let[H,C]of Object.entries(x)){if(k(H)){B[H]="***REDACTED***";continue}B[H]=W(C)}return B}finally{Q.delete($)}}return W(q)}function g(q,Q,W,$){let x=new Date().toISOString(),B=q.toUpperCase().padEnd(5),H=Q?` [${Q}]`:"",C=(()=>{try{let w=G($),A=w?{...w,pid:process.pid}:{pid:process.pid};return` ${JSON.stringify(A)}`}catch{return` {"pid":${process.pid},"payload":"[unserializable]"}`}})();return`[${x}] ${B}${H} ${W}${C}`}var D=null;function E(q){D=q}function Y(q,Q,W,$){if(!X(q))return;if(D)try{D({level:q,channel:Q,message:W,payload:G($)})}catch{}if(Z)return;try{let x=`${g(q,Q,W,$)}
2
2
  `;if(K.push(x),K.length>=p)b();else r()}catch{}}var m={error(q,Q,W){Y("error",q,Q,W)},warn(q,Q,W){Y("warn",q,Q,W)},info(q,Q,W){Y("info",q,Q,W)},debug(q,Q,W){Y("debug",q,Q,W)},trace(q,Q,W){Y("trace",q,Q,W)}},Z=!1,c=500,p=50,K=[],z=null;function b(){if(z)clearTimeout(z),z=null;if(K.length===0)return;let q=K.join("");K=[];try{I(),j.appendFileSync(J,q)}catch{}}function r(){if(z)return;z=setTimeout(()=>{z=null,b()},c)}var y=/^\[([\w-]+)\]\s*/;function o(q,Q){if(!X("debug"))return;if(Z)return;try{let W="",$=q,x=q.match(y);if(x)W=x[1]??"",$=q.slice(x[0].length);let B;if(Q!=null){if(Q instanceof Error)B={error:`${Q.message}${Q.stack?`
3
3
  ${Q.stack}`:""}`};else if(typeof Q==="object")B=Q}Y("debug",W,$,B)}catch{}}function v(q,Q){if(!X("debug"))return;if(Z)return;try{let W;if(Q!=null){if(typeof Q==="object"&&!(Q instanceof Error))W=Q}Y("debug","relay",q,W)}catch{}}if(!Z)process.on("exit",b);
4
- export{F as Fc,L as Gc,i as Hc,X as Ic,h as Jc,T as Kc,k as Lc,G as Mc,g as Nc,E as Oc,m as Pc,o as Qc,v as Rc};
4
+ export{F as ad,L as bd,i as cd,X as dd,h as ed,T as fd,k as gd,G as hd,g as id,E as jd,m as kd,o as ld,v as md};
@@ -1,2 +1,2 @@
1
1
  import{mkdir as l,readdir as u,readFile as c,rename as p,unlink as m,writeFile as d}from"node:fs/promises";import{join as a}from"node:path";function f(t){try{return process.kill(t,0),!0}catch(r){return r.code==="EPERM"}}async function b(t,r){await l(t,{recursive:!0});let s={...r,startedAt:Date.now()},e=a(t,`port-${r.pid}.json`),i=`${e}.${process.pid}.tmp`;return await d(i,JSON.stringify(s),{encoding:"utf8",mode:384}),await p(i,e),e}async function h(t,r){let s;try{s=await u(t)}catch{return null}let e=[];for(let n of s){if(!n.startsWith("port-")||!n.endsWith(".json"))continue;try{let o=JSON.parse(await c(a(t,n),"utf8"));if(Number.isFinite(o.port))if(f(o.pid))e.push(o);else m(a(t,n)).catch(()=>{})}catch{}}if(e.length===0)return null;let i=r&&r>=1?e.filter((n)=>n.pid===r):[];return(i.length>0?i:e).sort((n,o)=>o.startedAt-n.startedAt)[0]??null}
2
- export{b as Sc,h as Tc};
2
+ export{b as nd,h as od};
@@ -1,2 +1,2 @@
1
1
  var e=["claude-account","claude-cache","claude-cachekeep","claude-prime","claude-start","claude-quota","claude-dump","claude-fast","claude-routing","claude-killswitch","claude-logging"];
2
- export{e as Uc};
2
+ export{e as pd};
@@ -1,2 +1,2 @@
1
1
  import{createRequire as q}from"node:module";var j=Object.create;var{getPrototypeOf:k,defineProperty:i,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,r=(a,b,d)=>{var f=a!=null&&typeof a==="object";if(f){var g=b?o??=new WeakMap:p??=new WeakMap,h=g.get(a);if(h)return h}d=a!=null?j(k(a)):{};let c=b||!a||!a.__esModule?i(d,"default",{value:a,enumerable:!0}):d;for(let e of l(a))if(!m.call(c,e))i(c,e,{get:n.bind(a,e),enumerable:!0});if(f)g.set(a,c);return c};var s=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var u=q(import.meta.url);
2
- export{r as Xc,s as Yc,u as Zc};
2
+ export{r as sd,s as td,u as ud};