@codeworksh/aikit 0.4.1-dev.20260531052349 → 0.5.1-dev.20260613074656
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/LICENSE +1 -1
- package/cli.mjs +95 -5
- package/cli.mjs.map +1 -1
- package/{codex-DfYk740t.mjs → codex-C36oU6yH.mjs} +30 -23
- package/codex-C36oU6yH.mjs.map +1 -0
- package/index.d.mts +142 -75
- package/index.mjs +8 -3
- package/index.mjs.map +1 -1
- package/oauth/openai/codex.d.mts +27 -18
- package/oauth/openai/codex.mjs +2 -2
- package/openai-codex-CZrBnLAJ.mjs +753 -0
- package/openai-codex-CZrBnLAJ.mjs.map +1 -0
- package/openai-codex-bzfev3us.mjs +2 -0
- package/package.json +2 -1
- package/{registry-Cfdk78qk.mjs → registry-DUKrGxt4.mjs} +12 -7
- package/{registry-Cfdk78qk.mjs.map → registry-DUKrGxt4.mjs.map} +1 -1
- package/codex-DfYk740t.mjs.map +0 -1
package/oauth/openai/codex.d.mts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
//#region src/oauth/openai/codex.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* OpenAI Codex OAuth
|
|
3
|
+
* OpenAI Codex OAuth.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Public interface, by use case:
|
|
6
|
+
*
|
|
7
|
+
* 1. Server OAuth integration (storage-free, bring your own routes):
|
|
8
|
+
* `createOpenAICodexAuthorizationFlow`, `exchangeOpenAICodexAuthorizationCode`,
|
|
9
|
+
* `parseOpenAICodexAuthorizationInput`, `refreshOpenAICodexToken`, `getOpenAICodexAccountId`.
|
|
10
|
+
* 2. CLI / interactive login (localhost callback server, persisted credentials):
|
|
11
|
+
* `OpenAICodexOAuthClient`, `JsonOpenAICodexAuthStorage`, `OpenAICodexAuthStorage`.
|
|
12
|
+
* 3. Application credential access (get key, auto-refresh, request headers):
|
|
13
|
+
* `getOpenAICodexApiKey`, `OpenAICodexOAuthClient.getCredentials/getApiKey/getHeaders`,
|
|
14
|
+
* `openAICodexHeaders`, `OPENAI_CODEX_API_KEY_ENV`.
|
|
15
|
+
*
|
|
16
|
+
* Everything else in this module is an implementation detail and intentionally
|
|
17
|
+
* not exported.
|
|
8
18
|
*/
|
|
9
19
|
type OpenAICodexOAuthCredentials = {
|
|
10
20
|
access: string;
|
|
@@ -35,7 +45,7 @@ type OpenAICodexAuthorizationOptions = {
|
|
|
35
45
|
redirectUri?: string;
|
|
36
46
|
scope?: string;
|
|
37
47
|
};
|
|
38
|
-
type
|
|
48
|
+
type OpenAICodexLoginPrompt = {
|
|
39
49
|
message: string;
|
|
40
50
|
placeholder?: string;
|
|
41
51
|
allowEmpty?: boolean;
|
|
@@ -45,7 +55,7 @@ type OpenAICodexLoginOptions = OpenAICodexAuthorizationOptions & {
|
|
|
45
55
|
url: string;
|
|
46
56
|
instructions?: string;
|
|
47
57
|
}) => void;
|
|
48
|
-
onPrompt: (prompt:
|
|
58
|
+
onPrompt: (prompt: OpenAICodexLoginPrompt) => Promise<string>;
|
|
49
59
|
onProgress?: (message: string) => void;
|
|
50
60
|
onManualCodeInput?: () => Promise<string>;
|
|
51
61
|
};
|
|
@@ -58,7 +68,6 @@ type JsonOpenAICodexAuthStorageOptions = {
|
|
|
58
68
|
path?: string;
|
|
59
69
|
providerId?: string;
|
|
60
70
|
};
|
|
61
|
-
declare function defaultOpenAICodexAuthFilePath(): string;
|
|
62
71
|
declare function parseOpenAICodexAuthorizationInput(input: string): {
|
|
63
72
|
code?: string;
|
|
64
73
|
state?: string;
|
|
@@ -66,7 +75,6 @@ declare function parseOpenAICodexAuthorizationInput(input: string): {
|
|
|
66
75
|
declare function getOpenAICodexAccountId(accessToken: string): string | null;
|
|
67
76
|
declare function createOpenAICodexAuthorizationFlow(options?: OpenAICodexAuthorizationOptions): Promise<OpenAICodexAuthorizationFlow>;
|
|
68
77
|
declare function exchangeOpenAICodexAuthorizationCode(code: string, verifier: string, redirectUri?: string): Promise<OpenAICodexTokenResult>;
|
|
69
|
-
declare function loginOpenAICodex(options: OpenAICodexLoginOptions): Promise<OpenAICodexOAuthCredentials>;
|
|
70
78
|
declare function refreshOpenAICodexToken(refreshToken: string): Promise<OpenAICodexOAuthCredentials>;
|
|
71
79
|
declare function openAICodexHeaders(credentials: OpenAICodexOAuthCredentials): Record<string, string>;
|
|
72
80
|
declare class JsonOpenAICodexAuthStorage implements OpenAICodexAuthStorage {
|
|
@@ -93,15 +101,16 @@ declare class OpenAICodexOAuthClient {
|
|
|
93
101
|
getHeaders(): Promise<Record<string, string> | undefined>;
|
|
94
102
|
logout(): Promise<void>;
|
|
95
103
|
}
|
|
96
|
-
declare const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
declare const OPENAI_CODEX_API_KEY_ENV = "OPENAI_CODEX_API_KEY";
|
|
105
|
+
/**
|
|
106
|
+
* Resolve the OpenAI Codex API key the same way other provider API keys are
|
|
107
|
+
* resolved: prefer the OPENAI_CODEX_API_KEY environment variable, then fall
|
|
108
|
+
* back to stored OAuth credentials (refreshing them when close to expiry).
|
|
109
|
+
*
|
|
110
|
+
* The result can be passed directly as `apiKey` to the runtime options or to
|
|
111
|
+
* `createOpenAICodex`. Returns undefined when no key is available.
|
|
112
|
+
*/
|
|
113
|
+
declare function getOpenAICodexApiKey(options?: OpenAICodexOAuthClientOptions): Promise<string | undefined>;
|
|
105
114
|
//#endregion
|
|
106
|
-
export { JsonOpenAICodexAuthStorage, JsonOpenAICodexAuthStorageOptions, OpenAICodexAuthStorage, OpenAICodexAuthorizationFlow, OpenAICodexAuthorizationOptions, OpenAICodexLoginOptions, OpenAICodexOAuthClient, OpenAICodexOAuthClientOptions, OpenAICodexOAuthCredentials,
|
|
115
|
+
export { JsonOpenAICodexAuthStorage, JsonOpenAICodexAuthStorageOptions, OPENAI_CODEX_API_KEY_ENV, OpenAICodexAuthStorage, OpenAICodexAuthorizationFlow, OpenAICodexAuthorizationOptions, OpenAICodexLoginOptions, OpenAICodexLoginPrompt, OpenAICodexOAuthClient, OpenAICodexOAuthClientOptions, OpenAICodexOAuthCredentials, OpenAICodexTokenFailure, OpenAICodexTokenResult, OpenAICodexTokenSuccess, createOpenAICodexAuthorizationFlow, exchangeOpenAICodexAuthorizationCode, getOpenAICodexAccountId, getOpenAICodexApiKey, openAICodexHeaders, parseOpenAICodexAuthorizationInput, refreshOpenAICodexToken };
|
|
107
116
|
//# sourceMappingURL=codex.d.mts.map
|
package/oauth/openai/codex.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as exchangeOpenAICodexAuthorizationCode, c as openAICodexHeaders,
|
|
2
|
-
export { JsonOpenAICodexAuthStorage, OpenAICodexOAuthClient, createOpenAICodexAuthorizationFlow,
|
|
1
|
+
import { a as exchangeOpenAICodexAuthorizationCode, c as openAICodexHeaders, i as createOpenAICodexAuthorizationFlow, l as parseOpenAICodexAuthorizationInput, n as OPENAI_CODEX_API_KEY_ENV, o as getOpenAICodexAccountId, r as OpenAICodexOAuthClient, s as getOpenAICodexApiKey, t as JsonOpenAICodexAuthStorage, u as refreshOpenAICodexToken } from "../../codex-C36oU6yH.mjs";
|
|
2
|
+
export { JsonOpenAICodexAuthStorage, OPENAI_CODEX_API_KEY_ENV, OpenAICodexOAuthClient, createOpenAICodexAuthorizationFlow, exchangeOpenAICodexAuthorizationCode, getOpenAICodexAccountId, getOpenAICodexApiKey, openAICodexHeaders, parseOpenAICodexAuthorizationInput, refreshOpenAICodexToken };
|