@gakr-gakr/codex 0.1.0 → 0.1.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.
Files changed (115) hide show
  1. package/dist/client-DNN2uyJW.js +642 -0
  2. package/dist/client-factory-Bu9OClHJ.js +9 -0
  3. package/dist/command-formatters-BpPOTePl.js +520 -0
  4. package/dist/command-handlers-BBs7Vws9.js +1533 -0
  5. package/dist/compact-CDboBy7o.js +329 -0
  6. package/dist/computer-use-DCZB46Sw.js +367 -0
  7. package/dist/config-CLMSw0p2.js +510 -0
  8. package/dist/doctor-contract-api.js +53 -0
  9. package/dist/harness.js +51 -0
  10. package/dist/index.js +1171 -0
  11. package/dist/media-understanding-provider.js +335 -0
  12. package/dist/models-jLA2SIvd.js +110 -0
  13. package/dist/node-cli-sessions-BLRDs_US.js +1216 -0
  14. package/dist/plugin-activation-CEy_oYpx.js +452 -0
  15. package/dist/prompt-overlay.js +12 -0
  16. package/dist/protocol-C9UWI98H.js +9 -0
  17. package/dist/protocol-validators-BGBspNmF.js +5988 -0
  18. package/dist/provider-catalog.js +84 -0
  19. package/dist/provider-discovery.js +33 -0
  20. package/dist/provider.js +150 -0
  21. package/dist/rate-limit-cache-9LxQdE0K.js +24 -0
  22. package/dist/request-DbSPeTcV.js +89 -0
  23. package/dist/rolldown-runtime-DUslC3ob.js +14 -0
  24. package/dist/run-attempt-BoEwzQCv.js +5463 -0
  25. package/dist/session-binding-e2GFp9VH.js +222 -0
  26. package/dist/shared-client-D7Vy0glq.js +631 -0
  27. package/dist/side-question-BDLuEzFP.js +668 -0
  28. package/dist/test-api.js +49 -0
  29. package/dist/thread-lifecycle-Clo0EHMk.js +1565 -0
  30. package/dist/vision-tools-Cofrv35p.js +1379 -0
  31. package/package.json +16 -1
  32. package/doctor-contract-api.ts +0 -68
  33. package/harness.ts +0 -72
  34. package/index.ts +0 -124
  35. package/media-understanding-provider.ts +0 -521
  36. package/prompt-overlay.ts +0 -21
  37. package/provider-catalog.ts +0 -83
  38. package/provider-discovery.ts +0 -45
  39. package/provider.ts +0 -243
  40. package/src/app-server/app-inventory-cache.ts +0 -324
  41. package/src/app-server/approval-bridge.ts +0 -1211
  42. package/src/app-server/auth-bridge.ts +0 -614
  43. package/src/app-server/capabilities.ts +0 -27
  44. package/src/app-server/client-factory.ts +0 -24
  45. package/src/app-server/client.ts +0 -715
  46. package/src/app-server/compact.ts +0 -512
  47. package/src/app-server/computer-use.ts +0 -683
  48. package/src/app-server/config.ts +0 -1038
  49. package/src/app-server/context-engine-projection.ts +0 -403
  50. package/src/app-server/dynamic-tool-diagnostics.ts +0 -73
  51. package/src/app-server/dynamic-tool-profile.ts +0 -70
  52. package/src/app-server/dynamic-tools.ts +0 -623
  53. package/src/app-server/elicitation-bridge.ts +0 -783
  54. package/src/app-server/event-projector.ts +0 -2065
  55. package/src/app-server/image-payload-sanitizer.ts +0 -167
  56. package/src/app-server/local-runtime-attribution.ts +0 -39
  57. package/src/app-server/managed-binary.ts +0 -193
  58. package/src/app-server/models.ts +0 -172
  59. package/src/app-server/native-hook-relay.ts +0 -150
  60. package/src/app-server/native-subagent-task-mirror.ts +0 -497
  61. package/src/app-server/plugin-activation.ts +0 -283
  62. package/src/app-server/plugin-app-cache-key.ts +0 -74
  63. package/src/app-server/plugin-approval-roundtrip.ts +0 -122
  64. package/src/app-server/plugin-inventory.ts +0 -357
  65. package/src/app-server/plugin-thread-config.ts +0 -455
  66. package/src/app-server/protocol-generated/json/DynamicToolCallParams.json +0 -33
  67. package/src/app-server/protocol-generated/json/v2/ErrorNotification.json +0 -199
  68. package/src/app-server/protocol-generated/json/v2/GetAccountResponse.json +0 -102
  69. package/src/app-server/protocol-generated/json/v2/ModelListResponse.json +0 -227
  70. package/src/app-server/protocol-generated/json/v2/ThreadResumeResponse.json +0 -2630
  71. package/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json +0 -2630
  72. package/src/app-server/protocol-generated/json/v2/TurnCompletedNotification.json +0 -1659
  73. package/src/app-server/protocol-generated/json/v2/TurnStartResponse.json +0 -1655
  74. package/src/app-server/protocol-validators.ts +0 -203
  75. package/src/app-server/protocol.ts +0 -520
  76. package/src/app-server/rate-limit-cache.ts +0 -48
  77. package/src/app-server/rate-limits.ts +0 -583
  78. package/src/app-server/request.ts +0 -73
  79. package/src/app-server/run-attempt.ts +0 -4862
  80. package/src/app-server/session-binding.ts +0 -398
  81. package/src/app-server/session-history.ts +0 -44
  82. package/src/app-server/shared-client.ts +0 -289
  83. package/src/app-server/side-question.ts +0 -1009
  84. package/src/app-server/test-support.ts +0 -48
  85. package/src/app-server/thread-lifecycle.ts +0 -959
  86. package/src/app-server/timeout.ts +0 -9
  87. package/src/app-server/tool-progress-normalization.ts +0 -77
  88. package/src/app-server/trajectory.ts +0 -368
  89. package/src/app-server/transcript-mirror.ts +0 -208
  90. package/src/app-server/transport-stdio.ts +0 -107
  91. package/src/app-server/transport-websocket.ts +0 -90
  92. package/src/app-server/transport.ts +0 -117
  93. package/src/app-server/user-input-bridge.ts +0 -316
  94. package/src/app-server/version.ts +0 -4
  95. package/src/app-server/vision-tools.ts +0 -12
  96. package/src/command-account.ts +0 -544
  97. package/src/command-formatters.ts +0 -426
  98. package/src/command-handlers.ts +0 -2021
  99. package/src/command-plugins-management.ts +0 -137
  100. package/src/command-rpc.ts +0 -142
  101. package/src/commands.ts +0 -65
  102. package/src/conversation-binding-data.ts +0 -124
  103. package/src/conversation-binding.ts +0 -561
  104. package/src/conversation-control.ts +0 -303
  105. package/src/conversation-turn-collector.ts +0 -186
  106. package/src/conversation-turn-input.ts +0 -106
  107. package/src/migration/apply.ts +0 -501
  108. package/src/migration/helpers.ts +0 -55
  109. package/src/migration/plan.ts +0 -461
  110. package/src/migration/provider.ts +0 -41
  111. package/src/migration/source.ts +0 -643
  112. package/src/migration/targets.ts +0 -25
  113. package/src/node-cli-sessions.ts +0 -711
  114. package/test-api.ts +0 -95
  115. package/tsconfig.json +0 -16
@@ -1,203 +0,0 @@
1
- import AjvPkg, { type ValidateFunction } from "ajv";
2
- import dynamicToolCallParamsSchema from "./protocol-generated/json/DynamicToolCallParams.json" with { type: "json" };
3
- import errorNotificationSchema from "./protocol-generated/json/v2/ErrorNotification.json" with { type: "json" };
4
- import modelListResponseSchema from "./protocol-generated/json/v2/ModelListResponse.json" with { type: "json" };
5
- import threadResumeResponseSchema from "./protocol-generated/json/v2/ThreadResumeResponse.json" with { type: "json" };
6
- import threadStartResponseSchema from "./protocol-generated/json/v2/ThreadStartResponse.json" with { type: "json" };
7
- import turnCompletedNotificationSchema from "./protocol-generated/json/v2/TurnCompletedNotification.json" with { type: "json" };
8
- import turnStartResponseSchema from "./protocol-generated/json/v2/TurnStartResponse.json" with { type: "json" };
9
- import type {
10
- CodexDynamicToolCallParams,
11
- CodexErrorNotification,
12
- CodexModelListResponse,
13
- CodexThreadForkResponse,
14
- CodexThreadResumeResponse,
15
- CodexThreadStartResponse,
16
- CodexTurn,
17
- CodexTurnCompletedNotification,
18
- CodexTurnStartResponse,
19
- } from "./protocol.js";
20
-
21
- type AjvInstance = import("ajv").default;
22
-
23
- const AjvCtor = AjvPkg as unknown as new (opts?: object) => AjvInstance;
24
- const ajv = new AjvCtor({
25
- allErrors: true,
26
- strict: false,
27
- useDefaults: true,
28
- validateFormats: false,
29
- });
30
-
31
- const validateDynamicToolCallParams = ajv.compile<CodexDynamicToolCallParams>(
32
- dynamicToolCallParamsSchema,
33
- );
34
- const validateErrorNotification = ajv.compile<CodexErrorNotification>(errorNotificationSchema);
35
- const validateModelListResponse = ajv.compile<CodexModelListResponse>(modelListResponseSchema);
36
- const validateThreadResumeResponse = ajv.compile<CodexThreadResumeResponse>(
37
- threadResumeResponseSchema,
38
- );
39
- const validateThreadStartResponse =
40
- ajv.compile<CodexThreadStartResponse>(threadStartResponseSchema);
41
- const validateTurnCompletedNotification = ajv.compile<CodexTurnCompletedNotification>(
42
- turnCompletedNotificationSchema,
43
- );
44
- const validateTurnStartResponse = ajv.compile<CodexTurnStartResponse>(turnStartResponseSchema);
45
-
46
- export function assertCodexThreadStartResponse(value: unknown): CodexThreadStartResponse {
47
- return assertCodexShape(
48
- validateThreadStartResponse,
49
- normalizeThreadResponse(value),
50
- "thread/start response",
51
- );
52
- }
53
-
54
- export function assertCodexThreadForkResponse(value: unknown): CodexThreadForkResponse {
55
- return assertCodexShape(
56
- validateThreadStartResponse,
57
- normalizeThreadResponse(value),
58
- "thread/fork response",
59
- );
60
- }
61
-
62
- export function assertCodexThreadResumeResponse(value: unknown): CodexThreadResumeResponse {
63
- return assertCodexShape(
64
- validateThreadResumeResponse,
65
- normalizeThreadResponse(value),
66
- "thread/resume response",
67
- );
68
- }
69
-
70
- export function assertCodexTurnStartResponse(value: unknown): CodexTurnStartResponse {
71
- return assertCodexShape(
72
- validateTurnStartResponse,
73
- normalizeTurnStartResponse(value),
74
- "turn/start response",
75
- );
76
- }
77
-
78
- export function readCodexDynamicToolCallParams(
79
- value: unknown,
80
- ): CodexDynamicToolCallParams | undefined {
81
- return readCodexShape(validateDynamicToolCallParams, value);
82
- }
83
-
84
- export function readCodexErrorNotification(value: unknown): CodexErrorNotification | undefined {
85
- return readCodexShape(validateErrorNotification, value);
86
- }
87
-
88
- export function readCodexModelListResponse(value: unknown): CodexModelListResponse | undefined {
89
- return readCodexShape(validateModelListResponse, value);
90
- }
91
-
92
- export function readCodexTurn(value: unknown): CodexTurn | undefined {
93
- const response = readCodexShape(validateTurnStartResponse, { turn: normalizeTurn(value) });
94
- return response?.turn;
95
- }
96
-
97
- export function readCodexTurnCompletedNotification(
98
- value: unknown,
99
- ): CodexTurnCompletedNotification | undefined {
100
- return readCodexShape(
101
- validateTurnCompletedNotification,
102
- normalizeTurnCompletedNotification(value),
103
- );
104
- }
105
-
106
- function assertCodexShape<T>(validate: ValidateFunction<T>, value: unknown, label: string): T {
107
- if (validate(value)) {
108
- return value;
109
- }
110
- throw new Error(`Invalid Codex app-server ${label}: ${formatAjvErrors(validate)}`);
111
- }
112
-
113
- function readCodexShape<T>(validate: ValidateFunction<T>, value: unknown): T | undefined {
114
- return validate(value) ? value : undefined;
115
- }
116
-
117
- function normalizeTurn(value: unknown): unknown {
118
- if (!value || typeof value !== "object" || Array.isArray(value)) {
119
- return value;
120
- }
121
- return {
122
- error: null,
123
- startedAt: null,
124
- completedAt: null,
125
- durationMs: null,
126
- ...value,
127
- items: Array.isArray((value as { items?: unknown }).items)
128
- ? (value as { items: unknown[] }).items.map(normalizeThreadItem)
129
- : [],
130
- };
131
- }
132
-
133
- function normalizeThreadItem(value: unknown): unknown {
134
- if (!value || typeof value !== "object" || Array.isArray(value)) {
135
- return value;
136
- }
137
- const item = value as { type?: unknown };
138
- switch (item.type) {
139
- case "agentMessage":
140
- return { phase: null, memoryCitation: null, ...value };
141
- case "plan":
142
- return { text: "", ...value };
143
- case "reasoning":
144
- return { summary: [], content: [], ...value };
145
- case "dynamicToolCall":
146
- return {
147
- namespace: null,
148
- arguments: null,
149
- status: "completed",
150
- contentItems: null,
151
- success: null,
152
- durationMs: null,
153
- ...value,
154
- };
155
- default:
156
- return value;
157
- }
158
- }
159
-
160
- function normalizeThreadResponse(value: unknown): unknown {
161
- if (!value || typeof value !== "object" || Array.isArray(value) || !("thread" in value)) {
162
- return value;
163
- }
164
- const thread = (value as { thread?: unknown }).thread;
165
- if (thread && typeof thread === "object" && !Array.isArray(thread)) {
166
- const t = thread as { id?: string; sessionId?: string };
167
- if (typeof t.id === "string" && typeof t.sessionId !== "string") {
168
- return { ...value, thread: { ...thread, sessionId: t.id } };
169
- }
170
- if (typeof t.sessionId === "string" && typeof t.id !== "string") {
171
- return { ...value, thread: { ...thread, id: t.sessionId } };
172
- }
173
- }
174
- return value;
175
- }
176
-
177
- function normalizeTurnStartResponse(value: unknown): unknown {
178
- if (!value || typeof value !== "object" || Array.isArray(value) || !("turn" in value)) {
179
- return value;
180
- }
181
- return {
182
- ...value,
183
- turn: normalizeTurn((value as { turn?: unknown }).turn),
184
- };
185
- }
186
-
187
- function normalizeTurnCompletedNotification(value: unknown): unknown {
188
- if (!value || typeof value !== "object" || Array.isArray(value) || !("turn" in value)) {
189
- return value;
190
- }
191
- return {
192
- ...value,
193
- turn: normalizeTurn((value as { turn?: unknown }).turn),
194
- };
195
- }
196
-
197
- function formatAjvErrors(validate: ValidateFunction): string {
198
- const errors = validate.errors;
199
- if (!errors || errors.length === 0) {
200
- return "schema validation failed";
201
- }
202
- return ajv.errorsText(errors, { separator: "; " });
203
- }
@@ -1,520 +0,0 @@
1
- export type JsonValue = null | boolean | number | string | JsonValue[] | JsonObject;
2
- export type JsonObject = { [key: string]: JsonValue };
3
- export type CodexServiceTier = string;
4
-
5
- export type CodexAppServerRequestMethod = keyof CodexAppServerRequestResultMap | (string & {});
6
- export type CodexAppServerRequestParams<M extends CodexAppServerRequestMethod> =
7
- M extends keyof CodexAppServerRequestParamsOverride
8
- ? CodexAppServerRequestParamsOverride[M]
9
- : unknown;
10
-
11
- export type CodexAppServerRequestResult<M extends CodexAppServerRequestMethod> =
12
- M extends keyof CodexAppServerRequestResultMap
13
- ? CodexAppServerRequestResultMap[M]
14
- : JsonValue | undefined;
15
-
16
- export type RpcRequest = {
17
- id?: number | string;
18
- method: string;
19
- params?: JsonValue;
20
- };
21
-
22
- export type RpcResponse = {
23
- id: number | string;
24
- result?: JsonValue;
25
- error?: {
26
- code?: number;
27
- message: string;
28
- data?: JsonValue;
29
- };
30
- };
31
-
32
- export type RpcMessage = RpcRequest | RpcResponse;
33
-
34
- export type CodexInitializeParams = {
35
- clientInfo: {
36
- name: string;
37
- title?: string;
38
- version?: string;
39
- };
40
- capabilities?: JsonObject;
41
- };
42
-
43
- export type CodexInitializeResponse = {
44
- serverInfo?: {
45
- name?: string;
46
- version?: string;
47
- };
48
- protocolVersion?: string;
49
- userAgent?: string;
50
- };
51
-
52
- export type CodexUserInput =
53
- | {
54
- type: "text";
55
- text: string;
56
- text_elements?: JsonValue[];
57
- }
58
- | {
59
- type: "image";
60
- url: string;
61
- }
62
- | {
63
- type: "localImage";
64
- path: string;
65
- };
66
-
67
- export type CodexDynamicToolSpec = JsonObject & {
68
- name: string;
69
- description: string;
70
- inputSchema: JsonValue;
71
- };
72
-
73
- export type CodexThreadStartParams = JsonObject & {
74
- input?: CodexUserInput[];
75
- cwd?: string;
76
- model?: string;
77
- modelProvider?: string | null;
78
- approvalPolicy?: string | JsonObject;
79
- approvalsReviewer?: string | null;
80
- sandbox?: CodexSandboxPolicy;
81
- serviceTier?: CodexServiceTier | null;
82
- dynamicTools?: CodexDynamicToolSpec[] | null;
83
- developerInstructions?: string;
84
- experimentalRawEvents?: boolean;
85
- persistExtendedHistory?: boolean;
86
- };
87
-
88
- export type CodexThreadResumeParams = JsonObject & {
89
- threadId: string;
90
- model?: string;
91
- modelProvider?: string | null;
92
- };
93
-
94
- export type CodexThreadStartResponse = {
95
- thread: CodexThread;
96
- model: string;
97
- modelProvider?: string | null;
98
- };
99
-
100
- export type CodexThreadForkParams = CodexThreadStartParams & {
101
- threadId: string;
102
- baseInstructions?: string;
103
- ephemeral?: boolean;
104
- threadSource?: string | JsonObject;
105
- excludeTurns?: boolean;
106
- };
107
-
108
- export type CodexThreadForkResponse = CodexThreadStartResponse;
109
-
110
- export type CodexThreadResumeResponse = {
111
- thread: CodexThread;
112
- model: string;
113
- modelProvider?: string | null;
114
- };
115
-
116
- export type CodexThreadInjectItemsParams = JsonObject & {
117
- threadId: string;
118
- items: JsonValue[];
119
- };
120
-
121
- export type CodexThreadUnsubscribeParams = JsonObject & {
122
- threadId: string;
123
- };
124
-
125
- export type CodexTurnInterruptParams = JsonObject & {
126
- threadId: string;
127
- turnId: string;
128
- };
129
-
130
- export type CodexTurnStartParams = JsonObject & {
131
- threadId: string;
132
- input?: CodexUserInput[];
133
- cwd?: string;
134
- model?: string;
135
- approvalPolicy?: string | JsonObject;
136
- approvalsReviewer?: string | null;
137
- sandboxPolicy?: CodexSandboxPolicy;
138
- serviceTier?: CodexServiceTier | null;
139
- effort?: string | null;
140
- collaborationMode?: {
141
- mode: string;
142
- settings: JsonObject & {
143
- developer_instructions: string | null;
144
- };
145
- } | null;
146
- };
147
-
148
- export type CodexSandboxPolicy = string | JsonObject;
149
-
150
- export type CodexTurnStartResponse = {
151
- turn: CodexTurn;
152
- };
153
-
154
- export type CodexTurn = {
155
- id: string;
156
- threadId: string;
157
- status?: string;
158
- error?: CodexErrorNotification["error"];
159
- startedAt?: string | null;
160
- completedAt?: string | null;
161
- durationMs?: number | null;
162
- items: CodexThreadItem[];
163
- };
164
-
165
- export type CodexThread = {
166
- id: string;
167
- sessionId?: string;
168
- name?: string | null;
169
- preview?: string | null;
170
- createdAt?: number | null;
171
- updatedAt?: number | null;
172
- status?: CodexThreadStatus | null;
173
- cwd?: string | null;
174
- source?: CodexSessionSource | null;
175
- threadSource?: string | null;
176
- agentNickname?: string | null;
177
- agentRole?: string | null;
178
- };
179
-
180
- export type CodexThreadStatus =
181
- | { type: "notLoaded" }
182
- | { type: "idle" }
183
- | { type: "systemError" }
184
- | { type: "active"; activeFlags?: string[] };
185
-
186
- export type CodexSubAgentThreadSpawnSource = {
187
- parent_thread_id: string;
188
- depth?: number;
189
- agent_path?: string | null;
190
- agent_nickname?: string | null;
191
- agent_role?: string | null;
192
- };
193
-
194
- export type CodexSubAgentSource =
195
- | "review"
196
- | "compact"
197
- | "memory_consolidation"
198
- | { thread_spawn: CodexSubAgentThreadSpawnSource }
199
- | { other: string };
200
-
201
- export type CodexSessionSource =
202
- | "cli"
203
- | "vscode"
204
- | "exec"
205
- | "appServer"
206
- | "unknown"
207
- | { custom: string }
208
- | { subAgent: CodexSubAgentSource };
209
-
210
- export type CodexThreadStartedNotification = {
211
- thread: CodexThread;
212
- };
213
-
214
- export type CodexThreadStatusChangedNotification = {
215
- threadId: string;
216
- status: CodexThreadStatus;
217
- };
218
-
219
- export type CodexThreadItem = {
220
- id: string;
221
- type: string;
222
- title: string | null;
223
- status: string | null;
224
- name: string | null;
225
- tool: string | null;
226
- server: string | null;
227
- command: string | null;
228
- cwd: string | null;
229
- query: string | null;
230
- arguments?: JsonValue;
231
- result?: JsonValue;
232
- error?: CodexErrorNotification["error"];
233
- exitCode?: number | null;
234
- durationMs?: number | null;
235
- aggregatedOutput: string | null;
236
- text: string;
237
- contentItems?: CodexDynamicToolCallOutputContentItem[] | null;
238
- changes: Array<{ path: string; kind: string }>;
239
- [key: string]: unknown;
240
- };
241
-
242
- export type CodexServerNotification = {
243
- method: string;
244
- params?: JsonValue;
245
- };
246
-
247
- export type CodexDynamicToolCallParams = {
248
- namespace?: string | null;
249
- threadId: string;
250
- turnId: string;
251
- callId: string;
252
- tool: string;
253
- arguments?: JsonValue;
254
- };
255
-
256
- export type CodexDynamicToolCallResponse = {
257
- contentItems: CodexDynamicToolCallOutputContentItem[];
258
- diagnosticTerminalType?: CodexDynamicToolDiagnosticTerminalType;
259
- success: boolean;
260
- };
261
-
262
- export type CodexDynamicToolDiagnosticTerminalType = "blocked" | "completed" | "error";
263
-
264
- export type CodexDynamicToolCallOutputContentItem =
265
- | {
266
- type: "inputText";
267
- text: string;
268
- }
269
- | {
270
- type: "inputImage";
271
- imageUrl: string;
272
- }
273
- | JsonObject;
274
-
275
- export type CodexErrorNotification = {
276
- error: {
277
- message?: string;
278
- codexErrorInfo?: {
279
- message?: string;
280
- [key: string]: unknown;
281
- };
282
- [key: string]: unknown;
283
- };
284
- message?: string;
285
- };
286
-
287
- export type CodexTurnCompletedNotification = {
288
- turn: CodexTurn;
289
- };
290
-
291
- export type CodexModel = {
292
- id?: string;
293
- model?: string;
294
- displayName?: string | null;
295
- description?: string | null;
296
- hidden: boolean;
297
- isDefault: boolean;
298
- inputModalities: string[];
299
- supportedReasoningEfforts: CodexReasoningEffortOption[];
300
- defaultReasoningEffort?: string | null;
301
- };
302
-
303
- export type CodexReasoningEffortOption = {
304
- reasoningEffort?: string | null;
305
- };
306
-
307
- export type CodexModelListResponse = {
308
- data: CodexModel[];
309
- nextCursor?: string | null;
310
- };
311
-
312
- export type CodexGetAccountResponse = {
313
- account?: JsonValue;
314
- requiresOpenaiAuth?: boolean;
315
- };
316
-
317
- export type CodexChatgptAuthTokensRefreshResponse = {
318
- accessToken: string;
319
- chatgptAccountId: string;
320
- chatgptPlanType: string | null;
321
- };
322
-
323
- export type CodexLoginAccountParams =
324
- | {
325
- type: "apiKey";
326
- apiKey: string;
327
- }
328
- | {
329
- type: "chatgptAuthTokens";
330
- accessToken: string;
331
- chatgptAccountId: string;
332
- chatgptPlanType: string | null;
333
- };
334
-
335
- export type CodexPluginSummary = {
336
- id: string;
337
- name: string;
338
- source?: JsonObject;
339
- installed: boolean;
340
- enabled: boolean;
341
- installPolicy?: string;
342
- authPolicy?: string;
343
- availability?: string;
344
- interface?: JsonValue;
345
- };
346
-
347
- export type CodexAppSummary = {
348
- id: string;
349
- name: string;
350
- description?: string | null;
351
- installUrl?: string | null;
352
- needsAuth: boolean;
353
- };
354
-
355
- export type CodexPluginDetail = {
356
- marketplaceName?: string;
357
- marketplacePath?: string | null;
358
- summary: CodexPluginSummary;
359
- description?: string | null;
360
- skills?: JsonValue[];
361
- apps: CodexAppSummary[];
362
- mcpServers: string[];
363
- };
364
-
365
- export type CodexPluginMarketplaceEntry = {
366
- name: string;
367
- path?: string | null;
368
- interface?: JsonValue;
369
- plugins: CodexPluginSummary[];
370
- };
371
-
372
- export type CodexPluginListResponse = {
373
- marketplaces: CodexPluginMarketplaceEntry[];
374
- marketplaceLoadErrors?: JsonValue[];
375
- featuredPluginIds?: string[];
376
- };
377
-
378
- export type CodexPluginReadResponse = {
379
- plugin: CodexPluginDetail;
380
- };
381
-
382
- export type CodexPluginListParams = {
383
- cwds: string[];
384
- };
385
-
386
- export type CodexPluginReadParams = {
387
- marketplacePath?: string;
388
- remoteMarketplaceName?: string;
389
- pluginName: string;
390
- };
391
-
392
- export type CodexPluginInstallParams = CodexPluginReadParams;
393
-
394
- export type CodexPluginInstallResponse = {
395
- authPolicy: string;
396
- appsNeedingAuth: CodexAppSummary[];
397
- };
398
-
399
- export type CodexAppInfo = {
400
- id: string;
401
- name: string;
402
- description?: string | null;
403
- logoUrl?: string | null;
404
- logoUrlDark?: string | null;
405
- distributionChannel?: string | null;
406
- branding?: JsonValue;
407
- appMetadata?: JsonValue;
408
- labels?: JsonValue;
409
- installUrl?: string | null;
410
- isAccessible: boolean;
411
- isEnabled: boolean;
412
- pluginDisplayNames: string[];
413
- };
414
-
415
- export type CodexAppsListParams = {
416
- cursor?: string | null;
417
- limit?: number;
418
- forceRefetch?: boolean;
419
- };
420
-
421
- export type CodexAppsListResponse = {
422
- data: CodexAppInfo[];
423
- nextCursor?: string | null;
424
- };
425
-
426
- export type CodexSkillsListParams = {
427
- cwds: string[];
428
- forceReload?: boolean;
429
- };
430
-
431
- export type CodexSkillsListResponse = {
432
- data: JsonValue[];
433
- nextCursor?: string | null;
434
- };
435
-
436
- export type CodexHooksListParams = {
437
- cwds: string[];
438
- };
439
-
440
- export type CodexHooksListResponse = {
441
- data: JsonValue[];
442
- nextCursor?: string | null;
443
- };
444
-
445
- export type CodexMcpServerStatus = {
446
- name: string;
447
- tools: JsonObject;
448
- };
449
-
450
- export type CodexListMcpServerStatusResponse = {
451
- data: CodexMcpServerStatus[];
452
- nextCursor?: string | null;
453
- };
454
-
455
- export type CodexRequestObject = Record<string, unknown>;
456
-
457
- export declare namespace v2 {
458
- export type AppInfo = CodexAppInfo;
459
- export type AppSummary = CodexAppSummary;
460
- export type AppsListParams = CodexAppsListParams;
461
- export type AppsListResponse = CodexAppsListResponse;
462
- export type HooksListParams = CodexHooksListParams;
463
- export type HooksListResponse = CodexHooksListResponse;
464
- export type PluginDetail = CodexPluginDetail;
465
- export type PluginInstallParams = CodexPluginInstallParams;
466
- export type PluginInstallResponse = CodexPluginInstallResponse;
467
- export type PluginListParams = CodexPluginListParams;
468
- export type PluginListResponse = CodexPluginListResponse;
469
- export type PluginMarketplaceEntry = CodexPluginMarketplaceEntry;
470
- export type PluginReadParams = CodexPluginReadParams;
471
- export type PluginReadResponse = CodexPluginReadResponse;
472
- export type PluginSummary = CodexPluginSummary;
473
- export type SkillsListParams = CodexSkillsListParams;
474
- export type SkillsListResponse = CodexSkillsListResponse;
475
- }
476
-
477
- type CodexAppServerRequestParamsOverride = {
478
- "thread/fork": CodexThreadForkParams;
479
- "thread/inject_items": CodexThreadInjectItemsParams;
480
- "thread/start": CodexThreadStartParams;
481
- "thread/unsubscribe": CodexThreadUnsubscribeParams;
482
- "turn/interrupt": CodexTurnInterruptParams;
483
- };
484
-
485
- type CodexAppServerRequestResultMap = {
486
- initialize: CodexInitializeResponse;
487
- "account/rateLimits/read": JsonValue;
488
- "account/read": CodexGetAccountResponse;
489
- "app/list": CodexAppsListResponse;
490
- "config/mcpServer/reload": JsonValue;
491
- "experimentalFeature/enablement/set": JsonValue;
492
- "feedback/upload": JsonValue;
493
- "hooks/list": CodexHooksListResponse;
494
- "marketplace/add": JsonValue;
495
- "mcpServerStatus/list": CodexListMcpServerStatusResponse;
496
- "model/list": CodexModelListResponse;
497
- "plugin/install": CodexPluginInstallResponse;
498
- "plugin/list": CodexPluginListResponse;
499
- "plugin/read": CodexPluginReadResponse;
500
- "review/start": JsonValue;
501
- "skills/list": CodexSkillsListResponse;
502
- "thread/compact/start": JsonValue;
503
- "thread/fork": CodexThreadForkResponse;
504
- "thread/inject_items": JsonValue;
505
- "thread/list": JsonValue;
506
- "thread/resume": CodexThreadResumeResponse;
507
- "thread/start": CodexThreadStartResponse;
508
- "thread/unsubscribe": JsonValue;
509
- "turn/interrupt": JsonValue;
510
- "turn/start": CodexTurnStartResponse;
511
- "turn/steer": JsonValue;
512
- };
513
-
514
- export function isJsonObject(value: JsonValue | undefined): value is JsonObject {
515
- return Boolean(value && typeof value === "object" && !Array.isArray(value));
516
- }
517
-
518
- export function isRpcResponse(message: RpcMessage): message is RpcResponse {
519
- return "id" in message && !("method" in message);
520
- }