@cortexkit/opencode-anthropic-auth 2.6.0 → 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 +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/source.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type NativeAccountRefusalReason, type NativeAccountRuntime, type NativeAccountSnapshot, type NativeApiSubject, type NativeLocalCredentialValidation as NativeKnownCredentialSubject, type NativePoolPaths, type OAuthQuotaSnapshot } from '@cortexkit/anthropic-auth-core';
|
|
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';
|
|
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
|
/**
|
|
@@ -19,6 +19,12 @@ export type NativeSourceProvenance = {
|
|
|
19
19
|
};
|
|
20
20
|
type Authorization = NativeAnthropicAuthorization<NativeSourceProvenance>;
|
|
21
21
|
type OnAccountRefusal = (reason: NativeAccountRefusalReason) => void;
|
|
22
|
+
export type NativeCacheRequestPrepared = Parameters<NonNullable<NativeSource['onRequestPrepared']>>[0] & {
|
|
23
|
+
readonly admission?: {
|
|
24
|
+
readonly snapshot: NativeAccountSnapshot;
|
|
25
|
+
readonly account: NativeAccountView;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
22
28
|
export interface NativeSourceOptions {
|
|
23
29
|
readonly runtime: NativeAccountRuntime;
|
|
24
30
|
readonly paths: NativePoolPaths;
|
|
@@ -27,9 +33,20 @@ export interface NativeSourceOptions {
|
|
|
27
33
|
readonly onRequestId?: (scope: NativeAnthropicResponseContext<NativeSourceProvenance>, requestId: string) => void;
|
|
28
34
|
readonly onForgetSession?: (sessionID: string) => void;
|
|
29
35
|
readonly onOwnedRequest?: () => void;
|
|
30
|
-
readonly onRequestPrepared?:
|
|
36
|
+
readonly onRequestPrepared?: (input: NativeCacheRequestPrepared) => Promise<void> | void;
|
|
31
37
|
readonly onResponseHeaders?: (input: NativeAnthropicResponseContext<NativeSourceProvenance>) => void;
|
|
32
38
|
readonly onAttemptEnd?: NativeSource['onAttemptEnd'];
|
|
39
|
+
readonly onCacheUsage?: (sessionID: string, bodyText: string, usage: {
|
|
40
|
+
input_tokens?: number;
|
|
41
|
+
cache_creation_input_tokens?: number;
|
|
42
|
+
cache_read_input_tokens?: number;
|
|
43
|
+
}) => void;
|
|
44
|
+
readonly onCacheResponse?: (input: {
|
|
45
|
+
attemptId: string;
|
|
46
|
+
acceptedAt?: number;
|
|
47
|
+
ttlMs?: number;
|
|
48
|
+
acceptedUsage?: Record<string, number>;
|
|
49
|
+
}) => void;
|
|
33
50
|
readonly fetch?: typeof fetch;
|
|
34
51
|
/** Resolve a host model alias to the upstream ID before request-local policy. */
|
|
35
52
|
readonly resolveModelId?: (scope: RequestScope) => Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/opencode-anthropic-auth",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@clack/prompts": "^1.6.0",
|
|
80
|
-
"@cortexkit/anthropic-auth-core": "2.
|
|
80
|
+
"@cortexkit/anthropic-auth-core": "2.7.0",
|
|
81
81
|
"@cortexkit/claustrum-client": "0.13.0",
|
|
82
82
|
"@cortexkit/private-files": "0.2.2",
|
|
83
83
|
"@cortexkit/subc-client": "^0.22.10",
|