@cortexkit/opencode-anthropic-auth 2.13.1 → 2.14.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 +43 -43
- package/dist/setup/native-activation.d.ts +2 -2
- package/dist/setup/native-enrollment.d.ts +2 -2
- package/dist/setup/native-local.d.ts +4 -2
- package/dist/setup/types.d.ts +7 -0
- package/dist/v2/adapter.d.ts +2 -1
- package/dist/v2/cachekeep.d.ts +5 -1
- package/dist/v2/server.js +13 -13
- package/dist/v2/source.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type NativeCustodyActivationHooks, type NativeCustodyInventory } from '@cortexkit/anthropic-auth-core';
|
|
2
2
|
import { type NativeVaultEnrollmentOptions } from './native-enrollment.ts';
|
|
3
3
|
import { type NativeSetupPaths } from './native-paths.ts';
|
|
4
|
-
import { type CommandRunner, type HarnessKind, type ProcessFence } from './types.ts';
|
|
4
|
+
import { type CommandRunner, type HarnessKind, type ProcessFence, type SharedSetupRunnerEntry } from './types.ts';
|
|
5
5
|
type HostIndependentActivationCode = 'auth-content-refused' | 'host-auth-invalid' | 'primary-conflict' | 'consent-required' | 'primary-unverified';
|
|
6
6
|
/** Activation codes whose remedy names the host, so the host is required. */
|
|
7
7
|
type HostActivationCode = 'no-read-grant' | 'grant-reaches-nothing';
|
|
@@ -12,7 +12,7 @@ export declare class NativeVaultActivationError extends Error {
|
|
|
12
12
|
constructor(code: HostIndependentActivationCode);
|
|
13
13
|
constructor(code: HostActivationCode, host: HarnessKind, approvedName?: string);
|
|
14
14
|
}
|
|
15
|
-
export interface NativeVaultActivationOptions {
|
|
15
|
+
export interface NativeVaultActivationOptions extends SharedSetupRunnerEntry {
|
|
16
16
|
env: NodeJS.ProcessEnv;
|
|
17
17
|
runner: CommandRunner;
|
|
18
18
|
fence: ProcessFence;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ClaustrumEnrollmentClient, type ClaustrumEnrollmentPaths } from '@cortexkit/common-auth/claustrum';
|
|
2
|
-
import type { CommandRunner, HarnessKind } from './types.ts';
|
|
2
|
+
import type { CommandRunner, HarnessKind, SharedSetupRunnerEntry } from './types.ts';
|
|
3
3
|
export declare const NATIVE_VAULT_HOST_NAMES: {
|
|
4
4
|
readonly opencode: "anthropic-auth-opencode";
|
|
5
5
|
readonly pi: "anthropic-auth-pi";
|
|
@@ -48,4 +48,4 @@ export declare function enrollNativeVaultForHost(host: HarnessKind, options: Nat
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function nativeVaultGrantArgs(host: HarnessKind, approvedName?: string): string[];
|
|
50
50
|
/** Grant this host read access only when enrollment could not propose permissions. */
|
|
51
|
-
export declare function grantNativeVaultForHost(host: HarnessKind, options: Pick<NativeVaultEnrollmentOptions, 'env' | 'runner' | 'processFence' | 'ckBinary' | 'paths'>): Promise<string | undefined>;
|
|
51
|
+
export declare function grantNativeVaultForHost(host: HarnessKind, options: Pick<NativeVaultEnrollmentOptions, 'env' | 'runner' | 'processFence' | 'ckBinary' | 'paths'> & SharedSetupRunnerEntry): Promise<string | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NativeMigrationPreflight, readNativeMigrationJournal } from '@cortexkit/anthropic-auth-core';
|
|
2
2
|
import { type NativeSetupPaths } from './native-paths';
|
|
3
|
-
import { type HarnessKind, type ProcessFence } from './types';
|
|
3
|
+
import { type HarnessKind, type ProcessFence, type SharedSetupRunnerEntry } from './types';
|
|
4
4
|
export interface NativeOfflineLogin {
|
|
5
5
|
credential: {
|
|
6
6
|
type: 'oauth';
|
|
@@ -10,7 +10,7 @@ export interface NativeOfflineLogin {
|
|
|
10
10
|
};
|
|
11
11
|
accountIdentity: string;
|
|
12
12
|
}
|
|
13
|
-
export interface NativeLocalSetupOptions {
|
|
13
|
+
export interface NativeLocalSetupOptions extends SharedSetupRunnerEntry {
|
|
14
14
|
env: NodeJS.ProcessEnv;
|
|
15
15
|
fence: ProcessFence;
|
|
16
16
|
paths?: NativeSetupPaths;
|
|
@@ -24,6 +24,8 @@ export interface NativeLocalSetupOptions {
|
|
|
24
24
|
export declare const SEPARATE_HOST_LOGIN_NOTICE = "OpenCode's separate Anthropic login is not used. Add that account through /claude Accounts if needed, or remove the separate login from OpenCode.";
|
|
25
25
|
export declare function requireNativeLocalEnrollment(hosts: readonly HarnessKind[], env: NodeJS.ProcessEnv): Promise<void>;
|
|
26
26
|
export declare function nativeLocalProcessFence(host: HarnessKind, options: NativeLocalSetupOptions): () => Promise<void>;
|
|
27
|
+
/** Read-only planning still refuses environment-provided host auth and vault enrollment. */
|
|
28
|
+
export declare function validateNativeLocalSetup(host: HarnessKind, options: NativeLocalSetupOptions): Promise<void>;
|
|
27
29
|
export declare function nativeSetupFileFingerprint(path: string): Promise<string>;
|
|
28
30
|
export declare function inspectSetupHostAuth(host: HarnessKind, path: string): Promise<{
|
|
29
31
|
kind: 'absent' | 'oauth' | 'api' | 'api_key' | 'activation';
|
package/dist/setup/types.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export type HarnessKind = 'opencode' | 'pi';
|
|
2
|
+
export interface SharedSetupRunnerEntry {
|
|
3
|
+
/**
|
|
4
|
+
* Only the setup CLI sets this: the shared runner listed processes immediately
|
|
5
|
+
* before calling the adapter. Standalone callers must keep the entry check.
|
|
6
|
+
*/
|
|
7
|
+
sharedRunnerCheckedEntry?: true;
|
|
8
|
+
}
|
|
2
9
|
export declare function setupRefusalMessage(error: unknown): string | undefined;
|
|
3
10
|
/** runSetup prints failures from its own stopped-host checks; provider callbacks need a displayable refusal for their separate process checks. */
|
|
4
11
|
export declare function setupProcessInspectionMessage(error: unknown): string | undefined;
|
package/dist/v2/adapter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnthropicBillingRequest, AnthropicOAuthOriginError, type ClaudeCodeIdentity, type ClaudeGateway, type RequestGzipLatch, stateRefusalCause, TrailingAssistantHistoryError } from '@cortexkit/anthropic-auth-core';
|
|
1
|
+
import { type AnthropicBillingRequest, AnthropicOAuthOriginError, type CacheKeepRealTurn, type ClaudeCodeIdentity, type ClaudeGateway, type RequestGzipLatch, stateRefusalCause, TrailingAssistantHistoryError } from '@cortexkit/anthropic-auth-core';
|
|
2
2
|
import type { AccountRequest, AttemptOutcome, ChooseAccountInput, ChooseAccountResult, HeaderEdits, HostError, LimitSignal, OpenCode2AuthAdapter, RequestScope, SameAccountRetryInput, SameAccountRetryResult, Transport } from '@cortexkit/common-auth/opencode2';
|
|
3
3
|
import { EffortMarkerCorrelationError } from '../effort-history';
|
|
4
4
|
import { createStrippedStream, rewriteRequestBody } from '../transform';
|
|
@@ -156,6 +156,7 @@ export interface NativeAnthropicAttemptOutcome extends AttemptOutcome {
|
|
|
156
156
|
* the adapter passes it is rejected at compile time.
|
|
157
157
|
*/
|
|
158
158
|
export interface NativeAnthropicSource<Q, P> {
|
|
159
|
+
readonly beginRealTurn?: (scope: RequestScope) => CacheKeepRealTurn | undefined;
|
|
159
160
|
readonly billingRequest?: (input: NativeAnthropicAttemptContext<P>) => AnthropicBillingRequest | undefined;
|
|
160
161
|
/**
|
|
161
162
|
* Picks the account for one request; `undefined` refuses it. In phase
|
package/dist/v2/cachekeep.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
2
|
+
import { type AnthropicBillingWarming, CacheKeepManager, type CacheKeepRealTurn, CacheKeepSessionRegistry, type NativeAccountRuntime } from '@cortexkit/anthropic-auth-core';
|
|
3
|
+
import type { RequestScope } from '@cortexkit/common-auth/opencode2';
|
|
2
4
|
import { type CacheKeepStoreOptions } from './cachekeep-store';
|
|
3
5
|
import type { NativeCacheRequestPrepared, NativeSource } from './source';
|
|
4
6
|
export interface NativeCacheKeepOptions {
|
|
@@ -7,6 +9,7 @@ export interface NativeCacheKeepOptions {
|
|
|
7
9
|
readonly clearIntervalImpl?: typeof globalThis.clearInterval;
|
|
8
10
|
readonly setTimeoutImpl?: typeof globalThis.setTimeout;
|
|
9
11
|
readonly clearTimeoutImpl?: typeof globalThis.clearTimeout;
|
|
12
|
+
readonly delayImpl?: typeof delay;
|
|
10
13
|
readonly registryDirectory?: string;
|
|
11
14
|
/** Filesystem seam for tests; this is not a user setting. */
|
|
12
15
|
readonly persistence?: Omit<CacheKeepStoreOptions, 'storageId'>;
|
|
@@ -29,6 +32,7 @@ export declare function createNativeCacheKeep(options: NativeCacheKeepOptions &
|
|
|
29
32
|
subagent?: (sessionID: string) => boolean | undefined;
|
|
30
33
|
}): {
|
|
31
34
|
ready: Promise<void>;
|
|
35
|
+
beginRealTurn: (input: RequestScope) => CacheKeepRealTurn | undefined;
|
|
32
36
|
track(input: NativeCacheRequestPrepared): Promise<void>;
|
|
33
37
|
onResponseHeaders(input: {
|
|
34
38
|
attemptId: string;
|