@cortexkit/opencode-anthropic-auth 2.4.13 → 2.5.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/billing-lineage.d.ts +1 -0
- package/dist/cli.js +45 -45
- package/dist/index-y6xse2x7.js +45 -0
- package/dist/index.js +1 -1
- package/dist/transform.d.ts +3 -0
- package/dist/v2/adapter.d.ts +8 -8
- package/dist/v2/install.d.ts +1 -0
- package/dist/v2/reload.d.ts +15 -0
- package/dist/v2/server.js +11 -11
- package/package.json +2 -2
- package/dist/index-e3wjv6pw.js +0 -45
package/dist/v2/adapter.d.ts
CHANGED
|
@@ -95,14 +95,11 @@ export interface NativeAnthropicAttemptContext<P> extends AccountRequest {
|
|
|
95
95
|
/** Non-nullable options accepted by rewriteRequestBody. */
|
|
96
96
|
type RewriteBodyOptions = NonNullable<Parameters<typeof rewriteRequestBody>[1]>;
|
|
97
97
|
/**
|
|
98
|
-
* The
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* identity, which the source returns with the credential, and the session id,
|
|
102
|
-
* which is the host's own session id for the request. The tool-name callback
|
|
103
|
-
* is private to the adapter so response names stay bound to that send.
|
|
98
|
+
* The source supplies billing, effort, cache, fast-mode, safety and diagnostic
|
|
99
|
+
* inputs. The adapter owns identity/session correlation, final signing and
|
|
100
|
+
* the tool-name callback that binds response names to this send.
|
|
104
101
|
*/
|
|
105
|
-
export type NativeAnthropicBodyOptions = Omit<RewriteBodyOptions, 'identity' | 'sessionId' | 'onToolNameMap'>;
|
|
102
|
+
export type NativeAnthropicBodyOptions = Omit<RewriteBodyOptions, 'identity' | 'sessionId' | 'onToolNameMap' | 'deferSigning'>;
|
|
106
103
|
type StrippedStreamOptions = NonNullable<Parameters<typeof createStrippedStream>[1]>;
|
|
107
104
|
/**
|
|
108
105
|
* The response observers a source may attach to an OAuth response. Content
|
|
@@ -174,7 +171,7 @@ export interface NativeAnthropicSource<Q, P> {
|
|
|
174
171
|
readonly requestOptions?: (input: NativeAnthropicRequestContext<P>) => Promise<NativeAnthropicBodyOptions> | NativeAnthropicBodyOptions;
|
|
175
172
|
/** Rechecks policy after asynchronous rewriting, immediately before dispatch. */
|
|
176
173
|
readonly admitRequest?: (input: NativeAnthropicAttemptContext<P>) => Promise<void> | void;
|
|
177
|
-
/** Observe the
|
|
174
|
+
/** Observe the full stateless template; the cache warmer signs its replay. */
|
|
178
175
|
readonly onRequestPrepared?: (input: NativeAnthropicAttemptContext<P> & {
|
|
179
176
|
readonly url: string;
|
|
180
177
|
readonly bodyText: string;
|
|
@@ -219,6 +216,8 @@ export interface NativeAnthropicSource<Q, P> {
|
|
|
219
216
|
* for the session.
|
|
220
217
|
*/
|
|
221
218
|
readonly forgetSession?: (sessionID: string) => void;
|
|
219
|
+
/** Drop the retry budget when the host finishes the user turn, not an HTTP attempt. */
|
|
220
|
+
readonly forgetTurn?: (sessionID: string) => void;
|
|
222
221
|
}
|
|
223
222
|
export interface NativeAnthropicAdapterLogger {
|
|
224
223
|
warn(message: string, data?: Record<string, unknown>): void;
|
|
@@ -238,6 +237,7 @@ export interface NativeAnthropicAdapterDeps<Q, P> {
|
|
|
238
237
|
* OpenCode account storage file.
|
|
239
238
|
*/
|
|
240
239
|
readonly requestGzipLatch?: RequestGzipLatch;
|
|
240
|
+
readonly fetch?: typeof fetch;
|
|
241
241
|
}
|
|
242
242
|
export interface NativeAnthropicAdapter<Q, P> {
|
|
243
243
|
readonly adapter: OpenCode2AuthAdapter<Q, NativeAnthropicAttemptData<P>, ChooseAccountResult> & {
|
package/dist/v2/install.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type NativeAnthropicAdapterDeps, type NativeAnthropicAttemptData } from
|
|
|
3
3
|
export interface NativeAnthropicInstallation<Q, P> {
|
|
4
4
|
readonly installation: OpenCode2AuthInstallation<Q, NativeAnthropicAttemptData<P>>;
|
|
5
5
|
readonly forgetSession: (sessionID: string) => void;
|
|
6
|
+
readonly drain: () => Promise<void>;
|
|
6
7
|
readonly dispose: () => Promise<void>;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Plugin } from '@opencode/plugin';
|
|
2
|
+
interface ReloadableRequestHooks {
|
|
3
|
+
readonly context: Plugin.Context;
|
|
4
|
+
activate(): void;
|
|
5
|
+
retire(): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The host can retain a retired plugin's hooks for an entire turn. Delegate at
|
|
9
|
+
* the installer boundary, not at individual source callbacks: account choice,
|
|
10
|
+
* authorization, rewrites, quota, retry state and redactors must all belong to
|
|
11
|
+
* the same installer. Response streams already close over that installer's
|
|
12
|
+
* adapter, so they never consult the registry again.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createReloadableRequestHooks(ctx: Plugin.Context, key: string, version?: string): ReloadableRequestHooks;
|
|
15
|
+
export {};
|