@cortexkit/opencode-anthropic-auth 2.9.0 → 2.10.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.
@@ -4,6 +4,10 @@ export declare const NATIVE_VAULT_HOST_NAMES: {
4
4
  readonly opencode: "anthropic-auth-opencode";
5
5
  readonly pi: "anthropic-auth-pi";
6
6
  };
7
+ export declare const NATIVE_VAULT_HOST_DISPLAY_NAMES: {
8
+ readonly opencode: 'Claude sign-in for OpenCode';
9
+ readonly pi: 'Claude sign-in for Pi';
10
+ };
7
11
  /** Convert the token file resolved by getHostClaustrumEnrollmentPaths into runSetup's path inputs; the runner derives the matching state file itself. */
8
12
  export declare function nativeVaultHostPaths(host: HarnessKind, env: NodeJS.ProcessEnv): {
9
13
  stateDir: string;
@@ -43,5 +47,5 @@ export declare function enrollNativeVaultForHost(host: HarnessKind, options: Nat
43
47
  * message shows the same command so the user can run it by hand.
44
48
  */
45
49
  export declare function nativeVaultGrantArgs(host: HarnessKind, approvedName?: string): string[];
46
- /** Grant this OpenCode or Pi principal read access to the vault's anthropic-native category; enrollment alone grants no provider access. */
50
+ /** Grant this host read access only when enrollment could not propose permissions. */
47
51
  export declare function grantNativeVaultForHost(host: HarnessKind, options: Pick<NativeVaultEnrollmentOptions, 'env' | 'runner' | 'processFence' | 'ckBinary' | 'paths'>): Promise<string | undefined>;
@@ -154,7 +154,7 @@ export declare function resolveActiveAccount(state: SidebarState): {
154
154
  quotaDated?: boolean;
155
155
  };
156
156
  /**
157
- * Pretty label for a recoverable-refusal source model (Fable or Opus).
157
+ * Pretty label for a recoverable-refusal source model (Fable, Mythos or Opus).
158
158
  * Falls back to the raw id for unrecognized ids so the sidebar never goes
159
159
  * blank on a future model that has not yet been cataloged here.
160
160
  */
@@ -1 +1 @@
1
- import{$ as r,K as a,L as b,M as c,N as d,O as e,P as f,Q as g,R as h,S as i,T as j,U as k,V as l,W as m,X as n,Y as o,Z as p,_ as q,aa as s,ba as t,ca as u,da as v,ea as w,fa as x,ga as y,ha as z,ia as A}from"./index-pxnn7mg1.js";import"./index-n8xr16kr.js";export{i as setSidebarState,r as scopedQuotaShortNames,k as resolveActiveAccount,s as quotaLabelColumnWidth,c as normalizeSidebarState,a as getSidebarStateFile,h as getSidebarState,f as getInitialSidebarRoutingTestHooks,p as getFableRecoverySummary,w as getCollapsedQuotaSummary,x as getCollapsedAccounts,q as formatQuotaRowLabel,m as formatPrimeTime,n as formatPrimeCost,o as formatPrimeAccountValue,l as formatFallbackModelLabel,u as fitQuotaRow,v as fitPaceLine,j as drainSidebarWrites,A as computeQuotaPacing,d as __setSidebarStateWriteTestHooks,e as __setInitialSidebarRoutingTestHooks,g as __acquireSidebarStateLockForTest,z as SEVEN_DAY_MS,t as QUOTA_BAR_MIN_CELLS,y as FIVE_HOUR_MS,b as DEFAULT_SIDEBAR_STATE};
1
+ import{$ as r,K as a,L as b,M as c,N as d,O as e,P as f,Q as g,R as h,S as i,T as j,U as k,V as l,W as m,X as n,Y as o,Z as p,_ as q,aa as s,ba as t,ca as u,da as v,ea as w,fa as x,ga as y,ha as z,ia as A}from"./index-m7k9zxem.js";import"./index-n8xr16kr.js";export{i as setSidebarState,r as scopedQuotaShortNames,k as resolveActiveAccount,s as quotaLabelColumnWidth,c as normalizeSidebarState,a as getSidebarStateFile,h as getSidebarState,f as getInitialSidebarRoutingTestHooks,p as getFableRecoverySummary,w as getCollapsedQuotaSummary,x as getCollapsedAccounts,q as formatQuotaRowLabel,m as formatPrimeTime,n as formatPrimeCost,o as formatPrimeAccountValue,l as formatFallbackModelLabel,u as fitQuotaRow,v as fitPaceLine,j as drainSidebarWrites,A as computeQuotaPacing,d as __setSidebarStateWriteTestHooks,e as __setInitialSidebarRoutingTestHooks,g as __acquireSidebarStateLockForTest,z as SEVEN_DAY_MS,t as QUOTA_BAR_MIN_CELLS,y as FIVE_HOUR_MS,b as DEFAULT_SIDEBAR_STATE};
@@ -1,4 +1,4 @@
1
- import { type BillingLineageFields, type Cache1hMode, type ClaudeCodeIdentity, type ClaudeCodeRequestClass, type ThinkingPrefixMismatchBehavior } from '@cortexkit/anthropic-auth-core';
1
+ import { type BillingLineageFields, type Cache1hMode, type ClaudeCodeIdentity, type ClaudeCodeRequestClass, type IncompleteStreamDiagnostics, type ThinkingPrefixMismatchBehavior } from '@cortexkit/anthropic-auth-core';
2
2
  import { type OpenCodeEffortMarkerPlan } from './effort-history';
3
3
  import { type ServerSideFallbackOutcome } from './server-fallback';
4
4
  export declare const NON_STREAMING_DIAGNOSTICS_MAX_BYTES: number;
@@ -93,6 +93,8 @@ export declare function extractLatestHybridMessageCacheAnchor(bodyText: string):
93
93
  * on a longer history does not count as a prefix change.
94
94
  */
95
95
  export declare function hybridUserMessageCacheAnchorFingerprints(bodyText: string): string[];
96
+ /** Match a continuation's last cache marker to the full body kept for warming. */
97
+ export declare function sourceCacheAnchorMatchesWire(templateBody: string, wireBody: string): boolean;
96
98
  /**
97
99
  * Rewrite the full request body: sanitize system prompt and prefix tool names.
98
100
  */
@@ -123,6 +125,7 @@ export declare function rewriteRequestBody(body: string, options?: {
123
125
  };
124
126
  perf?: RewritePerfCallback;
125
127
  hybridStandbyAnchor?: HybridMessageCacheAnchor;
128
+ sourceRecoveryBody?: string;
126
129
  serverSideFallbackEnabled?: boolean;
127
130
  modelRemapEnabled?: boolean;
128
131
  laneStart?: boolean;
@@ -159,6 +162,9 @@ export declare function createStrippedStream(response: Response, options?: {
159
162
  onRelayUpstreamError?: (status: RelayUpstreamStatus) => void;
160
163
  onStreamEnd?: () => void | Promise<void>;
161
164
  responseMode?: 'json';
165
+ /** Whole Anthropic responses must terminate with message_stop; fragment rewriting need not. */
166
+ requireMessageStop?: boolean;
167
+ onIncompleteStream?: (diagnostics: IncompleteStreamDiagnostics) => void | Promise<void>;
162
168
  laneStart?: boolean;
163
169
  laneStartOAuthServed?: boolean;
164
170
  }): Response;
@@ -1,4 +1,4 @@
1
- import { AnthropicOAuthOriginError, type ClaudeCodeIdentity, type RequestGzipLatch, stateRefusalCause, TrailingAssistantHistoryError } from '@cortexkit/anthropic-auth-core';
1
+ import { type AnthropicBillingRequest, AnthropicOAuthOriginError, type ClaudeCodeIdentity, type RequestGzipLatch, stateRefusalCause, TrailingAssistantHistoryError } from '@cortexkit/anthropic-auth-core';
2
2
  import type { AccountRequest, AttemptOutcome, ChooseAccountInput, ChooseAccountResult, HeaderEdits, HostError, LimitSignal, OpenCode2AuthAdapter, RequestScope, SameAccountRetryInput, SameAccountRetryResult, Transport } from '@cortexkit/common-auth/opencode2';
3
3
  import { EffortMarkerCorrelationError } from '../effort-history';
4
4
  import { createStrippedStream, rewriteRequestBody } from '../transform';
@@ -149,6 +149,7 @@ export interface NativeAnthropicAttemptOutcome extends AttemptOutcome {
149
149
  * the adapter passes it is rejected at compile time.
150
150
  */
151
151
  export interface NativeAnthropicSource<Q, P> {
152
+ readonly billingRequest?: (input: NativeAnthropicAttemptContext<P>) => AnthropicBillingRequest | undefined;
152
153
  /**
153
154
  * Picks the account for one request; `undefined` refuses it. In phase
154
155
  * `retry` it may instead return a hold, which keeps the refused account and
@@ -253,6 +254,8 @@ export interface NativeAnthropicAdapterDeps<Q, P> {
253
254
  readonly now?: () => number;
254
255
  }
255
256
  export interface NativeAnthropicAdapter<Q, P> {
257
+ /** Background drivers can refuse a rewritten request before their final dispatch. */
258
+ discardUnsentBilling(data: NativeAnthropicAttemptData<P>): void;
256
259
  /** Receipt time of this adapter's final verified upstream OAuth 2xx response. */
257
260
  acceptedResponse(response: Response): {
258
261
  at: number;