@cortexkit/opencode-anthropic-auth 2.5.8 → 2.7.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/dist/cli.js +46 -46
- package/dist/index-2cg2an3s.js +45 -0
- package/dist/index.js +1 -1
- package/dist/v2/adapter.d.ts +17 -0
- package/dist/v2/cachekeep.d.ts +11 -3
- package/dist/v2/server.js +11 -11
- package/dist/v2/setup.d.ts +1 -0
- package/dist/v2/source.d.ts +19 -2
- package/package.json +2 -2
- package/dist/index-yys9dczn.js +0 -45
package/dist/v2/adapter.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ export type NativeAnthropicDispatch = {
|
|
|
55
55
|
export type NativeAnthropicAuthorization<P> = {
|
|
56
56
|
readonly route: 'oauth';
|
|
57
57
|
readonly accessToken: string;
|
|
58
|
+
/** Stable credential row identity, unchanged by token refresh and changed by login replacement. */
|
|
59
|
+
readonly credentialId: string;
|
|
58
60
|
/** The Claude Code identity of the account, when the source knows it. */
|
|
59
61
|
readonly identity?: ClaudeCodeIdentity;
|
|
60
62
|
/** Additional OAuth request headers; authorization and x-api-key edits are ignored so they cannot replace the authorized bearer. */
|
|
@@ -177,6 +179,15 @@ export interface NativeAnthropicSource<Q, P> {
|
|
|
177
179
|
readonly bodyText: string;
|
|
178
180
|
readonly signal?: AbortSignal;
|
|
179
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;
|
|
180
191
|
/** Response observers for an OAuth response. */
|
|
181
192
|
readonly responseOptions?: (input: NativeAnthropicResponseContext<P>) => NativeAnthropicResponseOptions | undefined;
|
|
182
193
|
/** Quota carried by the upstream response headers, read once per response. */
|
|
@@ -238,8 +249,14 @@ export interface NativeAnthropicAdapterDeps<Q, P> {
|
|
|
238
249
|
*/
|
|
239
250
|
readonly requestGzipLatch?: RequestGzipLatch;
|
|
240
251
|
readonly fetch?: typeof fetch;
|
|
252
|
+
/** Receipt clock; production uses epoch milliseconds from Date.now. */
|
|
253
|
+
readonly now?: () => number;
|
|
241
254
|
}
|
|
242
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;
|
|
243
260
|
readonly adapter: OpenCode2AuthAdapter<Q, NativeAnthropicAttemptData<P>, ChooseAccountResult> & {
|
|
244
261
|
readonly dropChoice: (input: AccountRequest) => Promise<void> | void;
|
|
245
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>;
|