@codeworksh/aikit 0.3.1 → 0.4.1-dev.20260530133305

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.
@@ -0,0 +1,107 @@
1
+ //#region src/oauth/openai/codex.d.ts
2
+ /**
3
+ * OpenAI Codex OAuth helpers.
4
+ *
5
+ * This flow is intended for Node.js CLI/server environments. The low-level
6
+ * authorization helpers are storage-free so they can also be used from an
7
+ * existing HTTP server callback route.
8
+ */
9
+ type OpenAICodexOAuthCredentials = {
10
+ access: string;
11
+ refresh: string;
12
+ expires: number;
13
+ accountId: string;
14
+ };
15
+ type OpenAICodexTokenSuccess = {
16
+ type: "success";
17
+ access: string;
18
+ refresh: string;
19
+ expires: number;
20
+ };
21
+ type OpenAICodexTokenFailure = {
22
+ type: "failed";
23
+ message: string;
24
+ status?: number;
25
+ };
26
+ type OpenAICodexTokenResult = OpenAICodexTokenSuccess | OpenAICodexTokenFailure;
27
+ type OpenAICodexAuthorizationFlow = {
28
+ url: string;
29
+ verifier: string;
30
+ state: string;
31
+ redirectUri: string;
32
+ };
33
+ type OpenAICodexAuthorizationOptions = {
34
+ originator?: string;
35
+ redirectUri?: string;
36
+ scope?: string;
37
+ };
38
+ type OpenAICodexPrompt = {
39
+ message: string;
40
+ placeholder?: string;
41
+ allowEmpty?: boolean;
42
+ };
43
+ type OpenAICodexLoginOptions = OpenAICodexAuthorizationOptions & {
44
+ onAuth: (info: {
45
+ url: string;
46
+ instructions?: string;
47
+ }) => void;
48
+ onPrompt: (prompt: OpenAICodexPrompt) => Promise<string>;
49
+ onProgress?: (message: string) => void;
50
+ onManualCodeInput?: () => Promise<string>;
51
+ };
52
+ interface OpenAICodexAuthStorage {
53
+ get(): Promise<OpenAICodexOAuthCredentials | undefined>;
54
+ set(credentials: OpenAICodexOAuthCredentials): Promise<void>;
55
+ clear(): Promise<void>;
56
+ }
57
+ type JsonOpenAICodexAuthStorageOptions = {
58
+ path?: string;
59
+ providerId?: string;
60
+ };
61
+ declare function defaultOpenAICodexAuthFilePath(): string;
62
+ declare function parseOpenAICodexAuthorizationInput(input: string): {
63
+ code?: string;
64
+ state?: string;
65
+ };
66
+ declare function getOpenAICodexAccountId(accessToken: string): string | null;
67
+ declare function createOpenAICodexAuthorizationFlow(options?: OpenAICodexAuthorizationOptions): Promise<OpenAICodexAuthorizationFlow>;
68
+ declare function exchangeOpenAICodexAuthorizationCode(code: string, verifier: string, redirectUri?: string): Promise<OpenAICodexTokenResult>;
69
+ declare function loginOpenAICodex(options: OpenAICodexLoginOptions): Promise<OpenAICodexOAuthCredentials>;
70
+ declare function refreshOpenAICodexToken(refreshToken: string): Promise<OpenAICodexOAuthCredentials>;
71
+ declare function openAICodexHeaders(credentials: OpenAICodexOAuthCredentials): Record<string, string>;
72
+ declare class JsonOpenAICodexAuthStorage implements OpenAICodexAuthStorage {
73
+ readonly path: string;
74
+ readonly providerId: string;
75
+ constructor(options?: JsonOpenAICodexAuthStorageOptions);
76
+ get(): Promise<OpenAICodexOAuthCredentials | undefined>;
77
+ set(credentials: OpenAICodexOAuthCredentials): Promise<void>;
78
+ clear(): Promise<void>;
79
+ private readFile;
80
+ private writeFile;
81
+ }
82
+ type OpenAICodexOAuthClientOptions = {
83
+ storage?: OpenAICodexAuthStorage;
84
+ refreshSkewMs?: number;
85
+ };
86
+ declare class OpenAICodexOAuthClient {
87
+ readonly storage: OpenAICodexAuthStorage;
88
+ readonly refreshSkewMs: number;
89
+ constructor(options?: OpenAICodexOAuthClientOptions);
90
+ login(options: OpenAICodexLoginOptions): Promise<OpenAICodexOAuthCredentials>;
91
+ getCredentials(): Promise<OpenAICodexOAuthCredentials | undefined>;
92
+ getApiKey(): Promise<string | undefined>;
93
+ getHeaders(): Promise<Record<string, string> | undefined>;
94
+ logout(): Promise<void>;
95
+ }
96
+ declare const openAICodexOAuthProvider: {
97
+ readonly id: "openai-codex";
98
+ readonly name: "ChatGPT Plus/Pro (OpenAI Codex)";
99
+ readonly usesCallbackServer: true;
100
+ readonly login: (options: OpenAICodexLoginOptions) => Promise<OpenAICodexOAuthCredentials>;
101
+ readonly refreshToken: (credentials: OpenAICodexOAuthCredentials) => Promise<OpenAICodexOAuthCredentials>;
102
+ readonly getApiKey: (credentials: OpenAICodexOAuthCredentials) => string;
103
+ readonly getHeaders: (credentials: OpenAICodexOAuthCredentials) => Record<string, string>;
104
+ };
105
+ //#endregion
106
+ export { JsonOpenAICodexAuthStorage, JsonOpenAICodexAuthStorageOptions, OpenAICodexAuthStorage, OpenAICodexAuthorizationFlow, OpenAICodexAuthorizationOptions, OpenAICodexLoginOptions, OpenAICodexOAuthClient, OpenAICodexOAuthClientOptions, OpenAICodexOAuthCredentials, OpenAICodexPrompt, OpenAICodexTokenFailure, OpenAICodexTokenResult, OpenAICodexTokenSuccess, createOpenAICodexAuthorizationFlow, defaultOpenAICodexAuthFilePath, exchangeOpenAICodexAuthorizationCode, getOpenAICodexAccountId, loginOpenAICodex, openAICodexHeaders, openAICodexOAuthProvider, parseOpenAICodexAuthorizationInput, refreshOpenAICodexToken };
107
+ //# sourceMappingURL=codex.d.mts.map
@@ -0,0 +1,2 @@
1
+ import { a as exchangeOpenAICodexAuthorizationCode, c as openAICodexHeaders, d as refreshOpenAICodexToken, i as defaultOpenAICodexAuthFilePath, l as openAICodexOAuthProvider, n as OpenAICodexOAuthClient, o as getOpenAICodexAccountId, r as createOpenAICodexAuthorizationFlow, s as loginOpenAICodex, t as JsonOpenAICodexAuthStorage, u as parseOpenAICodexAuthorizationInput } from "../../codex-DfYk740t.mjs";
2
+ export { JsonOpenAICodexAuthStorage, OpenAICodexOAuthClient, createOpenAICodexAuthorizationFlow, defaultOpenAICodexAuthFilePath, exchangeOpenAICodexAuthorizationCode, getOpenAICodexAccountId, loginOpenAICodex, openAICodexHeaders, openAICodexOAuthProvider, parseOpenAICodexAuthorizationInput, refreshOpenAICodexToken };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codeworksh/aikit",
3
- "version": "0.3.1",
4
- "description": "Toolkit for building AI agents and workflows.",
3
+ "version": "0.4.1-dev.20260530133305",
4
+ "description": "Toolkit for building AI agents and agent harness.",
5
5
  "keywords": [
6
6
  "agent",
7
7
  "ai",
@@ -24,20 +24,19 @@
24
24
  "directory": "packages/aikit"
25
25
  },
26
26
  "type": "module",
27
- "main": "./index.mjs",
28
- "module": "./index.mjs",
29
27
  "types": "./index.d.mts",
30
28
  "exports": {
31
29
  ".": {
32
- "source": "./src/index.ts",
33
30
  "types": "./index.d.mts",
34
- "import": "./index.mjs"
31
+ "import": "./index.mjs",
32
+ "default": "./index.mjs"
35
33
  },
36
- "./codemode/drivers": {
37
- "source": "./src/agent/codemode/drivers/drivers.ts",
38
- "types": "./agent/codemode/drivers/drivers.d.mts",
39
- "import": "./agent/codemode/drivers/drivers.mjs"
40
- }
34
+ "./oauth/openai-codex": {
35
+ "types": "./oauth/openai/codex.d.mts",
36
+ "import": "./oauth/openai/codex.mjs",
37
+ "default": "./oauth/openai/codex.mjs"
38
+ },
39
+ "./package.json": "./package.json"
41
40
  },
42
41
  "files": [
43
42
  "**/*",
@@ -51,19 +50,22 @@
51
50
  "node": ">=24.14.1"
52
51
  },
53
52
  "dependencies": {
54
- "@anthropic-ai/sdk": "^0.80.0",
55
- "@codeworksh/utils": "0.1.1",
56
- "@sinclair/typebox": "^0.34.48",
57
- "ajv": "^8.18.0",
58
- "ajv-formats": "^3.0.1",
53
+ "@ai-sdk/anthropic": "^3.0.79",
54
+ "@ai-sdk/google": "^3.0.79",
55
+ "@ai-sdk/google-vertex": "^4.0.137",
56
+ "@ai-sdk/openai": "^3.0.65",
57
+ "@ai-sdk/openai-compatible": "^2.0.48",
58
+ "@ai-sdk/provider": "^3.0.10",
59
+ "@ai-sdk/xai": "^3.0.92",
60
+ "@openrouter/ai-sdk-provider": "^2.9.0",
61
+ "ai": "^6.0.191",
62
+ "dedent": "^1.7.2",
59
63
  "esbuild": "^0.27.3",
60
- "openai": "^6.34.0",
61
64
  "partial-json": "^0.1.7",
62
65
  "quickjs-wasi": "^2.2.0",
63
66
  "remeda": "^2.33.6",
64
- "uuidv7": "^1.2.1"
65
- },
66
- "peerDependencies": {
67
- "typescript": "^5"
67
+ "typebox": "^1.1.37",
68
+ "uuidv7": "^1.2.1",
69
+ "yargs": "^18.0.0"
68
70
  }
69
71
  }