@cortexkit/opencode-anthropic-auth 2.6.0 → 2.7.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/cli.js +3 -3
- package/dist/index-2cg2an3s.js +45 -0
- package/dist/index.js +1 -1
- package/dist/v2/adapter.d.ts +15 -0
- package/dist/v2/cachekeep.d.ts +11 -3
- package/dist/v2/server.js +11 -11
- package/dist/v2/source.d.ts +19 -2
- package/package.json +2 -2
- package/dist/index-c85qdpfy.js +0 -45
package/dist/v2/adapter.d.ts
CHANGED
|
@@ -179,6 +179,15 @@ export interface NativeAnthropicSource<Q, P> {
|
|
|
179
179
|
readonly bodyText: string;
|
|
180
180
|
readonly signal?: AbortSignal;
|
|
181
181
|
}) => Promise<void> | void;
|
|
182
|
+
readonly onFinalRequestPrepared?: (input: {
|
|
183
|
+
attemptId: string;
|
|
184
|
+
requestId: string | undefined;
|
|
185
|
+
bodyText: string;
|
|
186
|
+
ttlMs: number;
|
|
187
|
+
}) => void;
|
|
188
|
+
readonly onResponseHandedToHost?: (request: Request, accepted: {
|
|
189
|
+
at: number;
|
|
190
|
+
} | undefined) => void;
|
|
182
191
|
/** Response observers for an OAuth response. */
|
|
183
192
|
readonly responseOptions?: (input: NativeAnthropicResponseContext<P>) => NativeAnthropicResponseOptions | undefined;
|
|
184
193
|
/** Quota carried by the upstream response headers, read once per response. */
|
|
@@ -240,8 +249,14 @@ export interface NativeAnthropicAdapterDeps<Q, P> {
|
|
|
240
249
|
*/
|
|
241
250
|
readonly requestGzipLatch?: RequestGzipLatch;
|
|
242
251
|
readonly fetch?: typeof fetch;
|
|
252
|
+
/** Receipt clock; production uses epoch milliseconds from Date.now. */
|
|
253
|
+
readonly now?: () => number;
|
|
243
254
|
}
|
|
244
255
|
export interface NativeAnthropicAdapter<Q, P> {
|
|
256
|
+
/** Receipt time of this adapter's final verified upstream OAuth 2xx response. */
|
|
257
|
+
acceptedResponse(response: Response): {
|
|
258
|
+
at: number;
|
|
259
|
+
} | undefined;
|
|
245
260
|
readonly adapter: OpenCode2AuthAdapter<Q, NativeAnthropicAttemptData<P>, ChooseAccountResult> & {
|
|
246
261
|
readonly dropChoice: (input: AccountRequest) => Promise<void> | void;
|
|
247
262
|
};
|
package/dist/v2/cachekeep.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { CacheKeepSessionRegistry, type NativeAccountRuntime } from '@cortexkit/anthropic-auth-core';
|
|
1
|
+
import { CacheKeepManager, CacheKeepSessionRegistry, type NativeAccountRuntime } from '@cortexkit/anthropic-auth-core';
|
|
2
2
|
import { type CacheKeepStoreOptions } from './cachekeep-store';
|
|
3
|
-
import type { NativeSource } from './source';
|
|
3
|
+
import type { NativeCacheRequestPrepared, NativeSource } from './source';
|
|
4
4
|
export interface NativeCacheKeepOptions {
|
|
5
5
|
readonly now?: () => number;
|
|
6
6
|
readonly setIntervalImpl?: typeof globalThis.setInterval;
|
|
7
7
|
readonly clearIntervalImpl?: typeof globalThis.clearInterval;
|
|
8
|
+
readonly setTimeoutImpl?: typeof globalThis.setTimeout;
|
|
9
|
+
readonly clearTimeoutImpl?: typeof globalThis.clearTimeout;
|
|
8
10
|
readonly registryDirectory?: string;
|
|
9
11
|
/** Filesystem seam for tests; this is not a user setting. */
|
|
10
12
|
readonly persistence?: Omit<CacheKeepStoreOptions, 'storageId'>;
|
|
@@ -24,12 +26,16 @@ export declare function createNativeCacheKeep(options: NativeCacheKeepOptions &
|
|
|
24
26
|
storageId: string;
|
|
25
27
|
fetch?: typeof fetch;
|
|
26
28
|
isSubagent?: (sessionID: string) => Promise<boolean>;
|
|
29
|
+
subagent?: (sessionID: string) => boolean | undefined;
|
|
27
30
|
}): {
|
|
28
31
|
ready: Promise<void>;
|
|
29
|
-
track(input:
|
|
32
|
+
track(input: NativeCacheRequestPrepared): Promise<void>;
|
|
30
33
|
onResponseHeaders(input: {
|
|
31
34
|
attemptId: string;
|
|
32
35
|
status: number;
|
|
36
|
+
acceptedAt?: number;
|
|
37
|
+
ttlMs?: number;
|
|
38
|
+
acceptedUsage?: Parameters<CacheKeepManager['recordAcceptedUsage']>[2];
|
|
33
39
|
}): {
|
|
34
40
|
tracked: true;
|
|
35
41
|
} | {
|
|
@@ -37,6 +43,8 @@ export declare function createNativeCacheKeep(options: NativeCacheKeepOptions &
|
|
|
37
43
|
reason: string;
|
|
38
44
|
} | undefined;
|
|
39
45
|
discardAttempt(attemptId: string): void;
|
|
46
|
+
recordAcceptedUsage(sessionID: string, bodyText: string, usage: Parameters<CacheKeepManager['recordAcceptedUsage']>[2]): void;
|
|
47
|
+
resolvedParent: (sessionID: string, isSubagent: boolean) => Promise<void>;
|
|
40
48
|
forgetSession(sessionID: string): void;
|
|
41
49
|
registry: CacheKeepSessionRegistry;
|
|
42
50
|
dispose(): Promise<void>;
|