@cortexkit/opencode-anthropic-auth 2.9.1 → 2.10.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.
@@ -1,4 +1,4 @@
1
- import { type NativeAccountRefusalReason, type NativeAccountRuntime, type NativeAccountSnapshot, type NativeAccountView, type NativeApiSubject, type NativeLocalCredentialValidation as NativeKnownCredentialSubject, type NativePoolPaths, type OAuthQuotaSnapshot } from '@cortexkit/anthropic-auth-core';
1
+ import { type AnthropicBillingWarming, type NativeAccountRefusalReason, type NativeAccountRuntime, type NativeAccountSnapshot, type NativeAccountView, type NativeApiSubject, type NativeLocalCredentialValidation as NativeKnownCredentialSubject, type NativePoolPaths, type OAuthQuotaSnapshot } from '@cortexkit/anthropic-auth-core';
2
2
  import type { RequestScope } from '@cortexkit/common-auth/opencode2';
3
3
  import { type NativeAnthropicAttemptContext, type NativeAnthropicAuthorization, type NativeAnthropicBodyOptions, type NativeAnthropicRequestContext, type NativeAnthropicResponseContext, type NativeAnthropicResponseOptions, type NativeAnthropicSource } from './adapter';
4
4
  /**
@@ -47,6 +47,14 @@ export interface NativeSourceOptions {
47
47
  ttlMs?: number;
48
48
  acceptedUsage?: Record<string, number>;
49
49
  }) => void;
50
+ /**
51
+ * Keep-warm state for a model request's billing report, read from memory
52
+ * once its response finishes; `undefined` leaves the state out.
53
+ */
54
+ readonly billingWarming?: (input: {
55
+ sessionID: string;
56
+ route: string;
57
+ }) => AnthropicBillingWarming | undefined;
50
58
  readonly fetch?: typeof fetch;
51
59
  /** Resolve a host model alias to the upstream ID before request-local policy. */
52
60
  readonly resolveModelId?: (scope: RequestScope) => Promise<string>;
@@ -61,6 +69,7 @@ export interface NativeSource extends NativeAnthropicSource<OAuthQuotaSnapshot,
61
69
  readonly resetRouting: (sessionID: string) => Promise<void>;
62
70
  /** The account that served the session's latest authorization, if any. */
63
71
  readonly servedAccount: (sessionID: string) => string | undefined;
72
+ readonly peekAccount?: (sessionId: string, modelId: string | undefined, snapshot: NativeAccountSnapshot) => string | undefined;
64
73
  readonly recordPrime: (provenance: NativeSourceProvenance, usage: {
65
74
  inputTokens?: number;
66
75
  outputTokens?: number;
package/dist/v2/tui.js CHANGED
@@ -1,4 +1,4 @@
1
- import{x as q}from"../index-h508mdrx.js";import"../index-pxnn7mg1.js";import"../index-n8xr16kr.js";var N="Open this link in your browser and sign in. Then choose Finish OAuth sign-in in the Accounts menu and paste the code Claude shows you.";async function g(D,M={}){let B=D.client.rpc(q),Z=!0,V=!1,Y=new AbortController,$=()=>{let j=D.ui.router.current();return j.type==="session"?j.sessionID:void 0};function C(j){return new Promise((Q)=>{let z="",J=!1,G=D.keymap.mode.push("cortexkit-protected-entry"),X=(H,W=!0)=>{if(J)return;J=!0,D.renderer.keyInput.off("keypress",O),D.renderer.keyInput.off("paste",P),Y.signal.removeEventListener("abort",K),G();let F=H?z:void 0;if(z="",W)D.ui.dialog.clear();Q(F)},K=()=>X(!1),O=(H)=>{if(H.preventDefault(),H.stopPropagation(),H.name==="escape"||H.ctrl&&H.name==="c")return X(!1);if(H.name==="return"||H.name==="enter")return X(!0);if(H.name==="backspace"){z=Array.from(z).slice(0,-1).join("");return}if(!H.ctrl&&!H.meta&&!H.option&&Array.from(H.sequence).every((W)=>W.charCodeAt(0)>=32&&W.charCodeAt(0)!==127))z=(z+H.sequence).slice(0,4096)},P=(H)=>{H.preventDefault(),H.stopPropagation(),z=(z+Array.from(new TextDecoder().decode(H.bytes)).filter((W)=>W.charCodeAt(0)>=32&&W.charCodeAt(0)!==127).join("")).slice(0,4096)};if(D.renderer.keyInput.prependListener("keypress",O),D.renderer.keyInput.prependListener("paste",P),Y.signal.addEventListener("abort",K,{once:!0}),D.ui.dialog.alert({title:j,message:"Type or paste the value. Input is hidden. Enter accepts; Escape cancels."}).then(()=>X(!1,!1),()=>X(!1,!1)),Y.signal.aborted)K()})}async function E(j){let Q={};for(let z of j.knobs){if(!Z)return;if(z.kind==="choice"){let J=await D.ui.dialog.select({title:z.label,options:z.choices.map((G)=>({title:G.label,value:G.value})),current:z.value});if(J===void 0)return;Q[z.id]=J}else if(z.kind==="toggle"){let J=await D.ui.dialog.select({title:z.label,options:[{title:"On",value:!0},{title:"Off",value:!1}],current:z.value});if(J===void 0)return;Q[z.id]=J}else{let J=z.kind==="text"&&z.masked?await C(z.label):await D.ui.dialog.prompt({title:z.label,value:z.value===void 0?void 0:String(z.value),placeholder:z.kind==="text"?z.placeholder:void 0});if(J===void 0)return;Q[z.id]=J===""&&!z.required?null:z.kind==="number"?Number(J):J}}return Q}async function A(j){if(M.showSignInLink)try{await M.showSignInLink(D,j,Y.signal);return}catch{}await D.ui.dialog.alert({title:"Claude sign-in",message:`${N}
1
+ import{x as q}from"../index-pcyn2rkg.js";import"../index-m7k9zxem.js";import"../index-n8xr16kr.js";var N="Open this link in your browser and sign in. Then choose Finish OAuth sign-in in the Accounts menu and paste the code Claude shows you.";async function g(D,M={}){let B=D.client.rpc(q),Z=!0,V=!1,Y=new AbortController,$=()=>{let j=D.ui.router.current();return j.type==="session"?j.sessionID:void 0};function C(j){return new Promise((Q)=>{let z="",J=!1,G=D.keymap.mode.push("cortexkit-protected-entry"),X=(H,W=!0)=>{if(J)return;J=!0,D.renderer.keyInput.off("keypress",O),D.renderer.keyInput.off("paste",P),Y.signal.removeEventListener("abort",K),G();let F=H?z:void 0;if(z="",W)D.ui.dialog.clear();Q(F)},K=()=>X(!1),O=(H)=>{if(H.preventDefault(),H.stopPropagation(),H.name==="escape"||H.ctrl&&H.name==="c")return X(!1);if(H.name==="return"||H.name==="enter")return X(!0);if(H.name==="backspace"){z=Array.from(z).slice(0,-1).join("");return}if(!H.ctrl&&!H.meta&&!H.option&&Array.from(H.sequence).every((W)=>W.charCodeAt(0)>=32&&W.charCodeAt(0)!==127))z=(z+H.sequence).slice(0,4096)},P=(H)=>{H.preventDefault(),H.stopPropagation(),z=(z+Array.from(new TextDecoder().decode(H.bytes)).filter((W)=>W.charCodeAt(0)>=32&&W.charCodeAt(0)!==127).join("")).slice(0,4096)};if(D.renderer.keyInput.prependListener("keypress",O),D.renderer.keyInput.prependListener("paste",P),Y.signal.addEventListener("abort",K,{once:!0}),D.ui.dialog.alert({title:j,message:"Type or paste the value. Input is hidden. Enter accepts; Escape cancels."}).then(()=>X(!1,!1),()=>X(!1,!1)),Y.signal.aborted)K()})}async function E(j){let Q={};for(let z of j.knobs){if(!Z)return;if(z.kind==="choice"){let J=await D.ui.dialog.select({title:z.label,options:z.choices.map((G)=>({title:G.label,value:G.value})),current:z.value});if(J===void 0)return;Q[z.id]=J}else if(z.kind==="toggle"){let J=await D.ui.dialog.select({title:z.label,options:[{title:"On",value:!0},{title:"Off",value:!1}],current:z.value});if(J===void 0)return;Q[z.id]=J}else{let J=z.kind==="text"&&z.masked?await C(z.label):await D.ui.dialog.prompt({title:z.label,value:z.value===void 0?void 0:String(z.value),placeholder:z.kind==="text"?z.placeholder:void 0});if(J===void 0)return;Q[z.id]=J===""&&!z.required?null:z.kind==="number"?Number(J):J}}return Q}async function A(j){if(M.showSignInLink)try{await M.showSignInLink(D,j,Y.signal);return}catch{}await D.ui.dialog.alert({title:"Claude sign-in",message:`${N}
2
2
 
3
3
  ${j}
4
4
  `})}async function T(j,Q){let z=`${Q.title} status`;if(M.showStatus)try{await M.showStatus(D,{title:z,lines:Q.lines,...Q.slot==="quota"&&{readQuota:(J)=>B.sidebar({sessionId:j},{signal:J,location:D.location})}},Y.signal);return}catch{}await D.ui.dialog.alert({title:z,message:Q.lines.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-anthropic-auth",
3
- "version": "2.9.1",
3
+ "version": "2.10.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -77,19 +77,19 @@
77
77
  },
78
78
  "dependencies": {
79
79
  "@clack/prompts": "^1.6.0",
80
- "@cortexkit/anthropic-auth-core": "2.9.1",
81
- "@cortexkit/claustrum-client": "0.17.0",
80
+ "@cortexkit/anthropic-auth-core": "2.10.1",
81
+ "@cortexkit/claustrum-client": "0.18.0",
82
82
  "@cortexkit/private-files": "0.2.2",
83
83
  "@cortexkit/subc-client": "^0.24",
84
- "@opentui/core": "0.8.1",
85
- "@opentui/solid": "0.8.1",
84
+ "@opentui/core": "0.8.3",
85
+ "@opentui/solid": "0.8.3",
86
86
  "jsonc-parser": "^3.3.1",
87
87
  "solid-js": "1.9.18",
88
88
  "xxhash-wasm": "^1.1.0"
89
89
  },
90
90
  "devDependencies": {
91
- "@ai-sdk/anthropic": "4.0.94",
91
+ "@ai-sdk/anthropic": "4.0.99",
92
92
  "@cortexkit/opencode-sidebar": "0.1.0",
93
- "@opencode/plugin": "2.2.5"
93
+ "@opencode/plugin": "2.2.6"
94
94
  }
95
95
  }
@@ -860,13 +860,14 @@ export function resolveActiveAccount(state: SidebarState): {
860
860
  }
861
861
 
862
862
  /**
863
- * Pretty label for a recoverable-refusal source model (Fable or Opus).
863
+ * Pretty label for a recoverable-refusal source model (Fable, Mythos or Opus).
864
864
  * Falls back to the raw id for unrecognized ids so the sidebar never goes
865
865
  * blank on a future model that has not yet been cataloged here.
866
866
  */
867
867
  export function formatFallbackModelLabel(modelId: string | undefined): string {
868
868
  const row = resolveClaudeModelCapabilities(modelId)
869
- if (row?.id === 'claude-fable-5-2') return row.name.replace(/^Claude /, '')
869
+ if (row?.id === 'claude-fable-5-2' || row?.id === 'claude-mythos-5-2')
870
+ return row.name.replace(/^Claude /, '')
870
871
  if (
871
872
  modelId === 'claude-mythos-5-1' ||
872
873
  modelId?.startsWith('claude-mythos-5-1-')
@@ -860,13 +860,14 @@ export function resolveActiveAccount(state: SidebarState): {
860
860
  }
861
861
 
862
862
  /**
863
- * Pretty label for a recoverable-refusal source model (Fable or Opus).
863
+ * Pretty label for a recoverable-refusal source model (Fable, Mythos or Opus).
864
864
  * Falls back to the raw id for unrecognized ids so the sidebar never goes
865
865
  * blank on a future model that has not yet been cataloged here.
866
866
  */
867
867
  export function formatFallbackModelLabel(modelId: string | undefined): string {
868
868
  const row = resolveClaudeModelCapabilities(modelId)
869
- if (row?.id === 'claude-fable-5-2') return row.name.replace(/^Claude /, '')
869
+ if (row?.id === 'claude-fable-5-2' || row?.id === 'claude-mythos-5-2')
870
+ return row.name.replace(/^Claude /, '')
870
871
  if (
871
872
  modelId === 'claude-mythos-5-1' ||
872
873
  modelId?.startsWith('claude-mythos-5-1-')