@cortexkit/opencode-anthropic-auth 2.10.0 → 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.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{t as a}from"./index-tqz6p5bw.js";import"./index-2ra790fx.js";import"./index-jc8zwxvw.js";import"./index-k6303ymz.js";import"./index-m7k9zxem.js";import"./index-crx0xd9j.js";import"./index-n8xr16kr.js";export{a as AnthropicAuthPlugin};
1
+ import{t as a}from"./index-hzf7nz91.js";import"./index-2ra790fx.js";import"./index-jc8zwxvw.js";import"./index-k6303ymz.js";import"./index-m7k9zxem.js";import"./index-crx0xd9j.js";import"./index-n8xr16kr.js";export{a as AnthropicAuthPlugin};
@@ -0,0 +1,80 @@
1
+ import { type OwnerOnlyOptions } from '@cortexkit/anthropic-auth-core';
2
+ /** Hash of a thinking block's signature or a redacted block's data. */
3
+ export declare function recoveryThinkingDigest(type: 'thinking' | 'redacted_thinking', value: string): string;
4
+ /**
5
+ * Drop recorded recovery-round thinking from every Anthropic turn in which
6
+ * unrecorded (source) thinking comes before it. Anthropic counts an assistant
7
+ * turn as its assistant messages plus the user messages that hold only tool
8
+ * results; any other user message starts a new turn. Other roles, such as
9
+ * mid-conversation system messages, do not end a turn. A block is kept when
10
+ * removing it would leave its message empty. Returns the number of blocks
11
+ * removed; the body is untouched when nothing matches.
12
+ */
13
+ export declare function stripRecoveryRoundThinking(body: Record<string, unknown>, recorded: ReadonlySet<string>): number;
14
+ /**
15
+ * Collect the digests of the thinking blocks in one streamed response, from
16
+ * parsed SSE event payloads. A block is reported once its
17
+ * `content_block_stop` arrives, so a block cut off mid-stream is never
18
+ * reported.
19
+ */
20
+ export declare function createRecoveryThinkingObserver(onDigest: (digest: string) => void): (event: Record<string, unknown>) => void;
21
+ export declare function recoveryThinkingStoreDirectory(root?: string): string;
22
+ /**
23
+ * Per-session digests of the thinking blocks written by the fallback model
24
+ * during refusal-recovery rounds, keyed by the source model's recovery family
25
+ * (the capability table's `refusalRecoveryFamily`, such as `fable-5-2`).
26
+ * Memory is the source of truth for requests; disk keeps the record across
27
+ * restarts. Each session's file is read once, at first use. Writes are
28
+ * coalesced and detached, so a request never waits for one. Files are
29
+ * owner-only and hold only digests.
30
+ */
31
+ export declare class RecoveryThinkingStore {
32
+ private readonly sessions;
33
+ /** Records evicted from memory whose last change is not on disk yet. */
34
+ private readonly unwritten;
35
+ private readonly directory;
36
+ private readonly now;
37
+ private readonly writeDelayMs;
38
+ private readonly ownerOnly;
39
+ private chain;
40
+ private timer;
41
+ private swept;
42
+ private warned;
43
+ constructor(options?: {
44
+ directory?: string;
45
+ now?: () => number;
46
+ writeDelayMs?: number;
47
+ ownerOnly?: OwnerOnlyOptions;
48
+ });
49
+ /** The recorded digests for one session and family; loads once per session. */
50
+ digests(sessionId: string, family: string): Promise<ReadonlySet<string>>;
51
+ /** Record one fallback-model thinking block; the write happens later. */
52
+ record(sessionId: string, family: string, digest: string): void;
53
+ /** Forget a deleted session, in memory and on disk. */
54
+ forgetSession(sessionId: string): void;
55
+ /** Write every pending change now. Tests use this; shutdown uses close. */
56
+ flush(): Promise<void>;
57
+ /**
58
+ * Write pending changes at shutdown, waiting at most SHUTDOWN_GRACE_MS. A
59
+ * round that ends just before a restart would otherwise lose its record.
60
+ */
61
+ close(): Promise<void>;
62
+ private session;
63
+ private load;
64
+ /**
65
+ * Queue the sweep once per process, behind any queued write or delete, so it
66
+ * never removes a temporary file this process is still writing. Requests
67
+ * never wait for it.
68
+ */
69
+ private startSweep;
70
+ /** Whether a record file belongs to a session this process is using. */
71
+ private inUse;
72
+ /** Delete idle records and stale temporaries. */
73
+ private sweep;
74
+ private schedule;
75
+ private enqueueWrites;
76
+ private enqueueWrite;
77
+ private directoryReady;
78
+ private write;
79
+ private warn;
80
+ }
@@ -126,6 +126,12 @@ export declare function rewriteRequestBody(body: string, options?: {
126
126
  perf?: RewritePerfCallback;
127
127
  hybridStandbyAnchor?: HybridMessageCacheAnchor;
128
128
  sourceRecoveryBody?: string;
129
+ /**
130
+ * Digests of thinking blocks written by the fallback model in this
131
+ * session's refusal-recovery rounds. Set only on requests to the source
132
+ * model; see recovery-thinking.ts.
133
+ */
134
+ recoveryRoundThinking?: ReadonlySet<string>;
129
135
  serverSideFallbackEnabled?: boolean;
130
136
  modelRemapEnabled?: boolean;
131
137
  laneStart?: boolean;
@@ -1,4 +1,4 @@
1
- import { CacheKeepManager, CacheKeepSessionRegistry, type NativeAccountRuntime } from '@cortexkit/anthropic-auth-core';
1
+ import { type AnthropicBillingWarming, CacheKeepManager, CacheKeepSessionRegistry, type NativeAccountRuntime } from '@cortexkit/anthropic-auth-core';
2
2
  import { type CacheKeepStoreOptions } from './cachekeep-store';
3
3
  import type { NativeCacheRequestPrepared, NativeSource } from './source';
4
4
  export interface NativeCacheKeepOptions {
@@ -43,6 +43,15 @@ export declare function createNativeCacheKeep(options: NativeCacheKeepOptions &
43
43
  reason: string;
44
44
  } | undefined;
45
45
  discardAttempt(attemptId: string): void;
46
+ /**
47
+ * Keep-warm state for a model request's billing report, from memory only.
48
+ * API-key routes are never warmed; an older shared manager without the
49
+ * reader leaves the state undecided.
50
+ */
51
+ warming(input: {
52
+ sessionID: string;
53
+ route: string;
54
+ }): AnthropicBillingWarming | undefined;
46
55
  recordAcceptedUsage(sessionID: string, bodyText: string, usage: Parameters<CacheKeepManager['recordAcceptedUsage']>[2]): void;
47
56
  resolvedParent: (sessionID: string, isSubagent: boolean) => Promise<void>;
48
57
  forgetSession(sessionID: string): void;