@cortexkit/opencode-anthropic-auth 2.5.3 → 2.5.5
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 +42 -42
- package/dist/{index-y6xse2x7.js → index-gqgvt8x1.js} +16 -16
- package/dist/index-k6303ymz.js +2 -0
- package/dist/index.js +1 -1
- package/dist/setup/paths.d.ts +2 -1
- package/dist/transform.d.ts +4 -0
- package/dist/v2/adapter.d.ts +1 -1
- package/dist/v2/cachekeep-store.d.ts +7 -2
- package/dist/v2/server.js +8 -8
- package/package.json +2 -2
- package/dist/index-a0jxsmac.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{existsSync as Z,readFileSync as $}from"node:fs";import{dirname as W,join as B,resolve as X}from"node:path";import{fileURLToPath as Y}from"node:url";import{getHostDataHome as F,getHostHome as V}from"@cortexkit/anthropic-auth-core";var b="@cortexkit/opencode-anthropic-auth",x="@cortexkit/pi-anthropic-auth";function G(q=process.env,J=process.platform){let z=q.OPENCODE_CONFIG_DIR?.trim();if(z)return X(z);return B(q.XDG_CONFIG_HOME||B(V(q,J),".config"),"opencode")}function I(q=process.env){return B(F(q),"opencode")}function K(q=process.env){return B(I(q),"auth.json")}function M(q=process.env,J=process.platform){let z=q.PI_CODING_AGENT_DIR?.trim()||q.PI_AGENT_DIR?.trim();if(z)return X(z);return B(V(q,J),".pi","agent")}function R(q=process.env){let J=q.PI_CODING_AGENT_DIR,z=V(q),w=J||B(z,".pi","agent");if(w==="~")w=z;else if(w.startsWith("~/")||process.platform==="win32"&&w.startsWith("~\\"))w=B(z,w.slice(2));if(w.startsWith("file://"))w=Y(w);return B(w,"auth.json")}async function y(){let q=W(Y(import.meta.url));for(let J=0;J<5;J++){let z=B(q,"package.json");if(Z(z))try{let Q=JSON.parse($(z,"utf8"));if(typeof Q.version==="string"&&Q.version.trim())return Q.version.trim()}catch{}let w=W(q);if(w===q)break;q=w}return"1.22.0"}
|
|
2
|
+
export{b as D,x as E,G as F,K as G,M as H,R as I,y as J};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as a}from"./index-
|
|
1
|
+
import{t as a}from"./index-gqgvt8x1.js";import"./index-2ra790fx.js";import"./index-jc8zwxvw.js";import"./index-k6303ymz.js";import"./index-d4e8qj37.js";import"./index-crx0xd9j.js";import"./index-n8xr16kr.js";export{a as AnthropicAuthPlugin};
|
package/dist/setup/paths.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { getHostHome } from '@cortexkit/anthropic-auth-core';
|
|
1
2
|
export declare const OPENCODE_PACKAGE_NAME = "@cortexkit/opencode-anthropic-auth";
|
|
2
3
|
export declare const PI_PACKAGE_NAME = "@cortexkit/pi-anthropic-auth";
|
|
3
|
-
export
|
|
4
|
+
export { getHostHome };
|
|
4
5
|
export declare function getOpenCodeConfigDir(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
|
|
5
6
|
export declare function getOpenCodeDataDir(env?: NodeJS.ProcessEnv): string;
|
|
6
7
|
export declare function getOpenCodeAuthPath(env?: NodeJS.ProcessEnv): string;
|
package/dist/transform.d.ts
CHANGED
|
@@ -106,6 +106,10 @@ export declare function rewriteRequestBody(body: string, options?: {
|
|
|
106
106
|
deferSigning?: boolean;
|
|
107
107
|
identity?: ClaudeCodeIdentity;
|
|
108
108
|
sessionId?: string;
|
|
109
|
+
/** Raw model id supplied by the host, not the wire body model. */
|
|
110
|
+
modelId?: string;
|
|
111
|
+
/** Whether this request uses OAuth. */
|
|
112
|
+
isOAuth?: boolean;
|
|
109
113
|
thinkingPrefixMismatchBehavior?: ThinkingPrefixMismatchBehavior;
|
|
110
114
|
midConversationEffortEnabled?: boolean;
|
|
111
115
|
midConversationEffortPlan?: string;
|
package/dist/v2/adapter.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ type RewriteBodyOptions = NonNullable<Parameters<typeof rewriteRequestBody>[1]>;
|
|
|
99
99
|
* inputs. The adapter owns identity/session correlation, final signing and
|
|
100
100
|
* the tool-name callback that binds response names to this send.
|
|
101
101
|
*/
|
|
102
|
-
export type NativeAnthropicBodyOptions = Omit<RewriteBodyOptions, 'identity' | 'sessionId' | 'onToolNameMap' | 'deferSigning'>;
|
|
102
|
+
export type NativeAnthropicBodyOptions = Omit<RewriteBodyOptions, 'identity' | 'sessionId' | 'modelId' | 'isOAuth' | 'onToolNameMap' | 'deferSigning'>;
|
|
103
103
|
type StrippedStreamOptions = NonNullable<Parameters<typeof createStrippedStream>[1]>;
|
|
104
104
|
/**
|
|
105
105
|
* The response observers a source may attach to an OAuth response. Content
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { type CacheKeepTarget, type OwnerOnlyOptions } from '@cortexkit/anthropic-auth-core';
|
|
2
2
|
declare const RECORD_FORMAT_VERSION = 1;
|
|
3
3
|
export declare function cacheKeepStoreDirectory(storageId: string, root?: string): string;
|
|
4
|
-
export
|
|
4
|
+
export declare function legacyCacheKeepStoreDirectory(storageId: string, root?: string): string;
|
|
5
|
+
export type SavedCacheKeepTarget = Pick<CacheKeepTarget, 'id' | 'bodyText' | 'url' | 'cacheExpiresAt' | 'nextPrewarmAt' | 'oauthAccountIdentity' | 'isSubagent' | 'ttlMs' | 'lastTouchAt' | 'lastTouchKind'> & {
|
|
5
6
|
v: typeof RECORD_FORMAT_VERSION;
|
|
6
7
|
pluginVersion: string;
|
|
7
8
|
};
|
|
8
9
|
type Acceptance = boolean | 'foreign-identity' | 'account-gone' | 'invalid' | undefined;
|
|
9
10
|
export interface CacheKeepStoreOptions {
|
|
10
11
|
storageId: string;
|
|
11
|
-
/** Test seam
|
|
12
|
+
/** Test seam for the data home; never OpenCode's config. */
|
|
12
13
|
root?: string;
|
|
14
|
+
/** Remove in the release after the next one: old temp-root migration seam. */
|
|
15
|
+
legacyRoot?: string;
|
|
13
16
|
ownerOnly?: OwnerOnlyOptions;
|
|
14
17
|
now?: () => number;
|
|
15
18
|
setTimeoutImpl?: typeof globalThis.setTimeout;
|
|
@@ -20,6 +23,7 @@ export declare class CacheKeepStore {
|
|
|
20
23
|
private readonly options;
|
|
21
24
|
readonly directory: string;
|
|
22
25
|
private disabled;
|
|
26
|
+
private legacyLoadAttempted;
|
|
23
27
|
private chain;
|
|
24
28
|
private readonly pending;
|
|
25
29
|
private readonly timers;
|
|
@@ -32,6 +36,7 @@ export declare class CacheKeepStore {
|
|
|
32
36
|
load(now: number, accept: (entry: SavedCacheKeepTarget) => Acceptance): Promise<void>;
|
|
33
37
|
changed(target: Readonly<CacheKeepTarget>): void;
|
|
34
38
|
private flush;
|
|
39
|
+
private writeEntry;
|
|
35
40
|
removed(id: string): void;
|
|
36
41
|
clear(): void;
|
|
37
42
|
drain(): Promise<void>;
|