@jrkropp/codex-js 0.1.0

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 (40) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +29 -0
  4. package/README.md +659 -0
  5. package/dist/DynamicToolCallResponse-D2OVpa4p.d.ts +8 -0
  6. package/dist/ToolRequestUserInputResponse-Bxjlpgho.d.ts +17 -0
  7. package/dist/chat-runtime-CMli5dzJ.d.ts +748 -0
  8. package/dist/chunk-FFASNDXU.js +9383 -0
  9. package/dist/chunk-FFASNDXU.js.map +1 -0
  10. package/dist/chunk-FN3SWHRH.js +934 -0
  11. package/dist/chunk-FN3SWHRH.js.map +1 -0
  12. package/dist/chunk-TZBLUZ2X.js +18640 -0
  13. package/dist/chunk-TZBLUZ2X.js.map +1 -0
  14. package/dist/chunk-ZX5OIIJX.js +3 -0
  15. package/dist/chunk-ZX5OIIJX.js.map +1 -0
  16. package/dist/client/index.d.ts +111 -0
  17. package/dist/client/index.js +4 -0
  18. package/dist/client/index.js.map +1 -0
  19. package/dist/index.d.ts +15 -0
  20. package/dist/index.js +6 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/react/index.d.ts +74 -0
  23. package/dist/react/index.js +5 -0
  24. package/dist/react/index.js.map +1 -0
  25. package/dist/remote-DMPfepa9.d.ts +19 -0
  26. package/dist/server/index.d.ts +1999 -0
  27. package/dist/server/index.js +3 -0
  28. package/dist/server/index.js.map +1 -0
  29. package/dist/session-BO6EZNK7.d.ts +1829 -0
  30. package/dist/shadcn/index.d.ts +68 -0
  31. package/dist/shadcn/index.js +334 -0
  32. package/dist/shadcn/index.js.map +1 -0
  33. package/dist/sidebar-DT2XoitN.d.ts +87 -0
  34. package/dist/store-H2cQxdpe.d.ts +20 -0
  35. package/dist/styles.css +1 -0
  36. package/dist/testing/index.d.ts +91 -0
  37. package/dist/testing/index.js +3 -0
  38. package/dist/testing/index.js.map +1 -0
  39. package/dist/thread_event_store-BIS0qzhi.d.ts +3843 -0
  40. package/package.json +89 -0
@@ -0,0 +1,1829 @@
1
+ import { aL as ThreadId, aM as AbsolutePathBuf, J as JsonValue, aN as ThreadSource, aO as UserInput, aP as ReasoningEffort, aQ as WindowsSandboxSetupMode, l as RequestId, aR as Thread, aS as Turn, S as ServerNotification, a as ServerRequest } from './thread_event_store-BIS0qzhi.js';
2
+
3
+ type ClientInfo = {
4
+ name: string;
5
+ title: string | null;
6
+ version: string;
7
+ };
8
+
9
+ type FuzzyFileSearchParams = {
10
+ query: string;
11
+ roots: Array<string>;
12
+ cancellationToken: string | null;
13
+ };
14
+
15
+ type GetAuthStatusParams = {
16
+ includeToken: boolean | null;
17
+ refreshToken: boolean | null;
18
+ };
19
+
20
+ type GetConversationSummaryParams = {
21
+ rolloutPath: string;
22
+ } | {
23
+ conversationId: ThreadId;
24
+ };
25
+
26
+ type GitDiffToRemoteParams = {
27
+ cwd: string;
28
+ };
29
+
30
+ /**
31
+ * Client-declared capabilities negotiated during initialize.
32
+ */
33
+ type InitializeCapabilities = {
34
+ /**
35
+ * Opt into receiving experimental API methods and fields.
36
+ */
37
+ experimentalApi: boolean;
38
+ /**
39
+ * Exact notification method names that should be suppressed for this
40
+ * connection (for example `thread/started`).
41
+ */
42
+ optOutNotificationMethods?: Array<string> | null;
43
+ };
44
+
45
+ type InitializeParams = {
46
+ clientInfo: ClientInfo;
47
+ capabilities: InitializeCapabilities | null;
48
+ };
49
+
50
+ /**
51
+ * EXPERIMENTAL - list available apps/connectors.
52
+ */
53
+ type AppsListParams = {
54
+ /**
55
+ * Opaque pagination cursor returned by a previous call.
56
+ */
57
+ cursor?: string | null;
58
+ /**
59
+ * Optional page size; defaults to a reasonable server-side value.
60
+ */
61
+ limit?: number | null;
62
+ /**
63
+ * Optional thread id used to evaluate app feature gating from that thread's config.
64
+ */
65
+ threadId?: string | null;
66
+ /**
67
+ * When true, bypass app caches and fetch the latest data from sources.
68
+ */
69
+ forceRefetch?: boolean;
70
+ };
71
+
72
+ type CancelLoginAccountParams = {
73
+ loginId: string;
74
+ };
75
+
76
+ /**
77
+ * PTY size in character cells for `command/exec` PTY sessions.
78
+ */
79
+ type CommandExecTerminalSize = {
80
+ /**
81
+ * Terminal height in character cells.
82
+ */
83
+ rows: number;
84
+ /**
85
+ * Terminal width in character cells.
86
+ */
87
+ cols: number;
88
+ };
89
+
90
+ type NetworkAccess = "restricted" | "enabled";
91
+
92
+ type SandboxPolicy = {
93
+ "type": "dangerFullAccess";
94
+ } | {
95
+ "type": "readOnly";
96
+ networkAccess: boolean;
97
+ } | {
98
+ "type": "externalSandbox";
99
+ networkAccess: NetworkAccess;
100
+ } | {
101
+ "type": "workspaceWrite";
102
+ writableRoots: Array<AbsolutePathBuf>;
103
+ networkAccess: boolean;
104
+ excludeTmpdirEnvVar: boolean;
105
+ excludeSlashTmp: boolean;
106
+ };
107
+
108
+ /**
109
+ * Run a standalone command (argv vector) in the server sandbox without
110
+ * creating a thread or turn.
111
+ *
112
+ * The final `command/exec` response is deferred until the process exits and is
113
+ * sent only after all `command/exec/outputDelta` notifications for that
114
+ * connection have been emitted.
115
+ */
116
+ type CommandExecParams = {
117
+ command: Array<string>; /**
118
+ * Optional client-supplied, connection-scoped process id.
119
+ *
120
+ * Required for `tty`, `streamStdin`, `streamStdoutStderr`, and follow-up
121
+ * `command/exec/write`, `command/exec/resize`, and
122
+ * `command/exec/terminate` calls. When omitted, buffered execution gets an
123
+ * internal id that is not exposed to the client.
124
+ */
125
+ processId?: string | null; /**
126
+ * Enable PTY mode.
127
+ *
128
+ * This implies `streamStdin` and `streamStdoutStderr`.
129
+ */
130
+ tty?: boolean; /**
131
+ * Allow follow-up `command/exec/write` requests to write stdin bytes.
132
+ *
133
+ * Requires a client-supplied `processId`.
134
+ */
135
+ streamStdin?: boolean; /**
136
+ * Stream stdout/stderr via `command/exec/outputDelta` notifications.
137
+ *
138
+ * Streamed bytes are not duplicated into the final response and require a
139
+ * client-supplied `processId`.
140
+ */
141
+ streamStdoutStderr?: boolean; /**
142
+ * Optional per-stream stdout/stderr capture cap in bytes.
143
+ *
144
+ * When omitted, the server default applies. Cannot be combined with
145
+ * `disableOutputCap`.
146
+ */
147
+ outputBytesCap?: number | null; /**
148
+ * Disable stdout/stderr capture truncation for this request.
149
+ *
150
+ * Cannot be combined with `outputBytesCap`.
151
+ */
152
+ disableOutputCap?: boolean; /**
153
+ * Disable the timeout entirely for this request.
154
+ *
155
+ * Cannot be combined with `timeoutMs`.
156
+ */
157
+ disableTimeout?: boolean; /**
158
+ * Optional timeout in milliseconds.
159
+ *
160
+ * When omitted, the server default applies. Cannot be combined with
161
+ * `disableTimeout`.
162
+ */
163
+ timeoutMs?: number | null; /**
164
+ * Optional working directory. Defaults to the server cwd.
165
+ */
166
+ cwd?: string | null; /**
167
+ * Optional environment overrides merged into the server-computed
168
+ * environment.
169
+ *
170
+ * Matching names override inherited values. Set a key to `null` to unset
171
+ * an inherited variable.
172
+ */
173
+ env?: {
174
+ [key in string]?: string | null;
175
+ } | null; /**
176
+ * Optional initial PTY size in character cells. Only valid when `tty` is
177
+ * true.
178
+ */
179
+ size?: CommandExecTerminalSize | null; /**
180
+ * Optional sandbox policy for this command.
181
+ *
182
+ * Uses the same shape as thread/turn execution sandbox configuration and
183
+ * defaults to the user's configured policy when omitted. Cannot be
184
+ * combined with `permissionProfile`.
185
+ */
186
+ sandboxPolicy?: SandboxPolicy | null;
187
+ };
188
+
189
+ /**
190
+ * Resize a running PTY-backed `command/exec` session.
191
+ */
192
+ type CommandExecResizeParams = {
193
+ /**
194
+ * Client-supplied, connection-scoped `processId` from the original
195
+ * `command/exec` request.
196
+ */
197
+ processId: string;
198
+ /**
199
+ * New PTY size in character cells.
200
+ */
201
+ size: CommandExecTerminalSize;
202
+ };
203
+
204
+ /**
205
+ * Terminate a running `command/exec` session.
206
+ */
207
+ type CommandExecTerminateParams = {
208
+ /**
209
+ * Client-supplied, connection-scoped `processId` from the original
210
+ * `command/exec` request.
211
+ */
212
+ processId: string;
213
+ };
214
+
215
+ /**
216
+ * Write stdin bytes to a running `command/exec` session, close stdin, or
217
+ * both.
218
+ */
219
+ type CommandExecWriteParams = {
220
+ /**
221
+ * Client-supplied, connection-scoped `processId` from the original
222
+ * `command/exec` request.
223
+ */
224
+ processId: string;
225
+ /**
226
+ * Optional base64-encoded stdin bytes to write.
227
+ */
228
+ deltaBase64?: string | null;
229
+ /**
230
+ * Close stdin after writing `deltaBase64`, if present.
231
+ */
232
+ closeStdin?: boolean;
233
+ };
234
+
235
+ /**
236
+ * EXPERIMENTAL - list collaboration mode presets.
237
+ */
238
+ type CollaborationModeListParams = Record<string, never>;
239
+
240
+ type MergeStrategy = "replace" | "upsert";
241
+
242
+ type ConfigEdit = {
243
+ keyPath: string;
244
+ value: JsonValue;
245
+ mergeStrategy: MergeStrategy;
246
+ };
247
+
248
+ type ConfigBatchWriteParams = {
249
+ edits: Array<ConfigEdit>;
250
+ /**
251
+ * Path to the config file to write; defaults to the user's `config.toml` when omitted.
252
+ */
253
+ filePath?: string | null;
254
+ expectedVersion?: string | null;
255
+ /**
256
+ * When true, hot-reload the updated user config into all loaded threads after writing.
257
+ */
258
+ reloadUserConfig?: boolean;
259
+ };
260
+
261
+ type ConfigReadParams = {
262
+ includeLayers: boolean;
263
+ /**
264
+ * Optional working directory to resolve project config layers. If specified,
265
+ * return the effective config as seen from that directory (i.e., including any
266
+ * project layers between `cwd` and the project/repo root).
267
+ */
268
+ cwd?: string | null;
269
+ };
270
+
271
+ type ConfigValueWriteParams = {
272
+ keyPath: string;
273
+ value: JsonValue;
274
+ mergeStrategy: MergeStrategy;
275
+ /**
276
+ * Path to the config file to write; defaults to the user's `config.toml` when omitted.
277
+ */
278
+ filePath?: string | null;
279
+ expectedVersion?: string | null;
280
+ };
281
+
282
+ /**
283
+ * Protection policy for creating or loading a controller-local device key.
284
+ */
285
+ type DeviceKeyProtectionPolicy = "hardware_only" | "allow_os_protected_nonextractable";
286
+
287
+ /**
288
+ * Create a controller-local device key with a random key id.
289
+ */
290
+ type DeviceKeyCreateParams = {
291
+ /**
292
+ * Defaults to `hardware_only` when omitted.
293
+ */
294
+ protectionPolicy?: DeviceKeyProtectionPolicy | null;
295
+ accountUserId: string;
296
+ clientId: string;
297
+ };
298
+
299
+ /**
300
+ * Fetch a controller-local device key public key by id.
301
+ */
302
+ type DeviceKeyPublicParams = {
303
+ keyId: string;
304
+ };
305
+
306
+ /**
307
+ * Audience for a remote-control client connection device-key proof.
308
+ */
309
+ type RemoteControlClientConnectionAudience = "remote_control_client_websocket";
310
+
311
+ /**
312
+ * Audience for a remote-control client enrollment device-key proof.
313
+ */
314
+ type RemoteControlClientEnrollmentAudience = "remote_control_client_enrollment";
315
+
316
+ /**
317
+ * Structured payloads accepted by `device/key/sign`.
318
+ */
319
+ type DeviceKeySignPayload = {
320
+ "type": "remoteControlClientConnection";
321
+ nonce: string;
322
+ audience: RemoteControlClientConnectionAudience;
323
+ /**
324
+ * Backend-issued websocket session id that this proof authorizes.
325
+ */
326
+ sessionId: string;
327
+ /**
328
+ * Origin of the backend endpoint that issued the challenge and will verify this proof.
329
+ */
330
+ targetOrigin: string;
331
+ /**
332
+ * Websocket route path that this proof authorizes.
333
+ */
334
+ targetPath: string;
335
+ accountUserId: string;
336
+ clientId: string;
337
+ /**
338
+ * Remote-control token expiration as Unix seconds.
339
+ */
340
+ tokenExpiresAt: number;
341
+ /**
342
+ * SHA-256 of the controller-scoped remote-control token, encoded as unpadded base64url.
343
+ */
344
+ tokenSha256Base64url: string;
345
+ /**
346
+ * Must contain exactly `remote_control_controller_websocket`.
347
+ */
348
+ scopes: Array<string>;
349
+ } | {
350
+ "type": "remoteControlClientEnrollment";
351
+ nonce: string;
352
+ audience: RemoteControlClientEnrollmentAudience;
353
+ /**
354
+ * Backend-issued enrollment challenge id that this proof authorizes.
355
+ */
356
+ challengeId: string;
357
+ /**
358
+ * Origin of the backend endpoint that issued the challenge and will verify this proof.
359
+ */
360
+ targetOrigin: string;
361
+ /**
362
+ * HTTP route path that this proof authorizes.
363
+ */
364
+ targetPath: string;
365
+ accountUserId: string;
366
+ clientId: string;
367
+ /**
368
+ * SHA-256 of the requested device identity operation, encoded as unpadded base64url.
369
+ */
370
+ deviceIdentitySha256Base64url: string;
371
+ /**
372
+ * Enrollment challenge expiration as Unix seconds.
373
+ */
374
+ challengeExpiresAt: number;
375
+ };
376
+
377
+ /**
378
+ * Sign an accepted structured payload with a controller-local device key.
379
+ */
380
+ type DeviceKeySignParams = {
381
+ keyId: string;
382
+ payload: DeviceKeySignPayload;
383
+ };
384
+
385
+ type ExperimentalFeatureEnablementSetParams = {
386
+ /**
387
+ * Process-wide runtime feature enablement keyed by canonical feature name.
388
+ *
389
+ * Only named features are updated. Omitted features are left unchanged.
390
+ * Send an empty map for a no-op.
391
+ */
392
+ enablement: {
393
+ [key in string]?: boolean;
394
+ };
395
+ };
396
+
397
+ type ExperimentalFeatureListParams = {
398
+ /**
399
+ * Opaque pagination cursor returned by a previous call.
400
+ */
401
+ cursor?: string | null;
402
+ /**
403
+ * Optional page size; defaults to a reasonable server-side value.
404
+ */
405
+ limit?: number | null;
406
+ };
407
+
408
+ type ExternalAgentConfigDetectParams = {
409
+ /**
410
+ * If true, include detection under the user's home (~/.claude, ~/.codex, etc.).
411
+ */
412
+ includeHome?: boolean;
413
+ /**
414
+ * Zero or more working directories to include for repo-scoped detection.
415
+ */
416
+ cwds?: Array<string> | null;
417
+ };
418
+
419
+ type ExternalAgentConfigMigrationItemType = "AGENTS_MD" | "CONFIG" | "SKILLS" | "PLUGINS" | "MCP_SERVER_CONFIG" | "SUBAGENTS" | "HOOKS" | "COMMANDS" | "SESSIONS";
420
+
421
+ type CommandMigration = {
422
+ name: string;
423
+ };
424
+
425
+ type HookMigration = {
426
+ name: string;
427
+ };
428
+
429
+ type McpServerMigration = {
430
+ name: string;
431
+ };
432
+
433
+ type PluginsMigration = {
434
+ marketplaceName: string;
435
+ pluginNames: Array<string>;
436
+ };
437
+
438
+ type SessionMigration = {
439
+ path: string;
440
+ cwd: string;
441
+ title: string | null;
442
+ };
443
+
444
+ type SubagentMigration = {
445
+ name: string;
446
+ };
447
+
448
+ type MigrationDetails = {
449
+ plugins: Array<PluginsMigration>;
450
+ sessions: Array<SessionMigration>;
451
+ mcpServers: Array<McpServerMigration>;
452
+ hooks: Array<HookMigration>;
453
+ subagents: Array<SubagentMigration>;
454
+ commands: Array<CommandMigration>;
455
+ };
456
+
457
+ type ExternalAgentConfigMigrationItem = {
458
+ itemType: ExternalAgentConfigMigrationItemType;
459
+ description: string;
460
+ /**
461
+ * Null or empty means home-scoped migration; non-empty means repo-scoped migration.
462
+ */
463
+ cwd: string | null;
464
+ details: MigrationDetails | null;
465
+ };
466
+
467
+ type ExternalAgentConfigImportParams = {
468
+ migrationItems: Array<ExternalAgentConfigMigrationItem>;
469
+ };
470
+
471
+ type FeedbackUploadParams = {
472
+ classification: string;
473
+ reason?: string | null;
474
+ threadId?: string | null;
475
+ includeLogs: boolean;
476
+ extraLogFiles?: Array<string> | null;
477
+ tags?: {
478
+ [key in string]?: string;
479
+ } | null;
480
+ };
481
+
482
+ /**
483
+ * Copy a file or directory tree on the host filesystem.
484
+ */
485
+ type FsCopyParams = {
486
+ /**
487
+ * Absolute source path.
488
+ */
489
+ sourcePath: AbsolutePathBuf;
490
+ /**
491
+ * Absolute destination path.
492
+ */
493
+ destinationPath: AbsolutePathBuf;
494
+ /**
495
+ * Required for directory copies; ignored for file copies.
496
+ */
497
+ recursive?: boolean;
498
+ };
499
+
500
+ /**
501
+ * Create a directory on the host filesystem.
502
+ */
503
+ type FsCreateDirectoryParams = {
504
+ /**
505
+ * Absolute directory path to create.
506
+ */
507
+ path: AbsolutePathBuf;
508
+ /**
509
+ * Whether parent directories should also be created. Defaults to `true`.
510
+ */
511
+ recursive?: boolean | null;
512
+ };
513
+
514
+ /**
515
+ * Request metadata for an absolute path.
516
+ */
517
+ type FsGetMetadataParams = {
518
+ /**
519
+ * Absolute path to inspect.
520
+ */
521
+ path: AbsolutePathBuf;
522
+ };
523
+
524
+ /**
525
+ * List direct child names for a directory.
526
+ */
527
+ type FsReadDirectoryParams = {
528
+ /**
529
+ * Absolute directory path to read.
530
+ */
531
+ path: AbsolutePathBuf;
532
+ };
533
+
534
+ /**
535
+ * Read a file from the host filesystem.
536
+ */
537
+ type FsReadFileParams = {
538
+ /**
539
+ * Absolute path to read.
540
+ */
541
+ path: AbsolutePathBuf;
542
+ };
543
+
544
+ /**
545
+ * Remove a file or directory tree from the host filesystem.
546
+ */
547
+ type FsRemoveParams = {
548
+ /**
549
+ * Absolute path to remove.
550
+ */
551
+ path: AbsolutePathBuf;
552
+ /**
553
+ * Whether directory removal should recurse. Defaults to `true`.
554
+ */
555
+ recursive?: boolean | null;
556
+ /**
557
+ * Whether missing paths should be ignored. Defaults to `true`.
558
+ */
559
+ force?: boolean | null;
560
+ };
561
+
562
+ /**
563
+ * Stop filesystem watch notifications for a prior `fs/watch`.
564
+ */
565
+ type FsUnwatchParams = {
566
+ /**
567
+ * Watch identifier previously provided to `fs/watch`.
568
+ */
569
+ watchId: string;
570
+ };
571
+
572
+ /**
573
+ * Start filesystem watch notifications for an absolute path.
574
+ */
575
+ type FsWatchParams = {
576
+ /**
577
+ * Connection-scoped watch identifier used for `fs/unwatch` and `fs/changed`.
578
+ */
579
+ watchId: string;
580
+ /**
581
+ * Absolute file or directory path to watch.
582
+ */
583
+ path: AbsolutePathBuf;
584
+ };
585
+
586
+ /**
587
+ * Write a file on the host filesystem.
588
+ */
589
+ type FsWriteFileParams = {
590
+ /**
591
+ * Absolute path to write.
592
+ */
593
+ path: AbsolutePathBuf;
594
+ /**
595
+ * File contents encoded as base64.
596
+ */
597
+ dataBase64: string;
598
+ };
599
+
600
+ type GetAccountParams = {
601
+ /**
602
+ * When `true`, requests a proactive token refresh before returning.
603
+ *
604
+ * In managed auth mode this triggers the normal refresh-token flow. In
605
+ * external auth mode this flag is ignored. Clients should refresh tokens
606
+ * themselves and call `account/login/start` with `chatgptAuthTokens`.
607
+ */
608
+ refreshToken: boolean;
609
+ };
610
+
611
+ type HooksListParams = {
612
+ /**
613
+ * When empty, defaults to the current session working directory.
614
+ */
615
+ cwds?: Array<string>;
616
+ };
617
+
618
+ type McpServerStatusDetail = "full" | "toolsAndAuthOnly";
619
+
620
+ type ListMcpServerStatusParams = {
621
+ /**
622
+ * Opaque pagination cursor returned by a previous call.
623
+ */
624
+ cursor?: string | null;
625
+ /**
626
+ * Optional page size; defaults to a server-defined value.
627
+ */
628
+ limit?: number | null;
629
+ /**
630
+ * Controls how much MCP inventory data to fetch for each server.
631
+ * Defaults to `Full` when omitted.
632
+ */
633
+ detail?: McpServerStatusDetail | null;
634
+ };
635
+
636
+ type LoginAccountParams = {
637
+ "type": "apiKey";
638
+ apiKey: string;
639
+ } | {
640
+ "type": "chatgpt";
641
+ codexStreamlinedLogin?: boolean;
642
+ } | {
643
+ "type": "chatgptDeviceCode";
644
+ } | {
645
+ "type": "chatgptAuthTokens";
646
+ /**
647
+ * Access token (JWT) supplied by the client.
648
+ * This token is used for backend API requests and email extraction.
649
+ */
650
+ accessToken: string;
651
+ /**
652
+ * Workspace/account identifier supplied by the client.
653
+ */
654
+ chatgptAccountId: string;
655
+ /**
656
+ * Optional plan type supplied by the client.
657
+ *
658
+ * When `null`, Codex attempts to derive the plan type from access-token
659
+ * claims. If unavailable, the plan defaults to `unknown`.
660
+ */
661
+ chatgptPlanType?: string | null;
662
+ };
663
+
664
+ type MarketplaceAddParams = {
665
+ source: string;
666
+ refName?: string | null;
667
+ sparsePaths?: Array<string> | null;
668
+ };
669
+
670
+ type MarketplaceRemoveParams = {
671
+ marketplaceName: string;
672
+ };
673
+
674
+ type MarketplaceUpgradeParams = {
675
+ marketplaceName?: string | null;
676
+ };
677
+
678
+ type McpResourceReadParams = {
679
+ threadId?: string | null;
680
+ server: string;
681
+ uri: string;
682
+ };
683
+
684
+ type McpServerOauthLoginParams = {
685
+ name: string;
686
+ scopes?: Array<string> | null;
687
+ timeoutSecs?: bigint | null;
688
+ };
689
+
690
+ type McpServerToolCallParams = {
691
+ threadId: string;
692
+ server: string;
693
+ tool: string;
694
+ arguments?: JsonValue;
695
+ _meta?: JsonValue;
696
+ };
697
+
698
+ type ModelListParams = {
699
+ /**
700
+ * Opaque pagination cursor returned by a previous call.
701
+ */
702
+ cursor?: string | null;
703
+ /**
704
+ * Optional page size; defaults to a reasonable server-side value.
705
+ */
706
+ limit?: number | null;
707
+ /**
708
+ * When true, include models that are hidden from the default picker list.
709
+ */
710
+ includeHidden?: boolean | null;
711
+ };
712
+
713
+ type ModelProviderCapabilitiesReadParams = Record<string, never>;
714
+
715
+ type PluginInstallParams = {
716
+ marketplacePath?: AbsolutePathBuf | null;
717
+ remoteMarketplaceName?: string | null;
718
+ pluginName: string;
719
+ };
720
+
721
+ type PluginListMarketplaceKind = "local" | "workspace-directory" | "shared-with-me";
722
+
723
+ type PluginListParams = {
724
+ /**
725
+ * Optional working directories used to discover repo marketplaces. When omitted,
726
+ * only home-scoped marketplaces and the official curated marketplace are considered.
727
+ */
728
+ cwds?: Array<AbsolutePathBuf> | null;
729
+ /**
730
+ * Optional marketplace kind filter. When omitted, only local marketplaces are queried, plus
731
+ * the default remote catalog when enabled by feature flag.
732
+ */
733
+ marketplaceKinds?: Array<PluginListMarketplaceKind> | null;
734
+ };
735
+
736
+ type PluginReadParams = {
737
+ marketplacePath?: AbsolutePathBuf | null;
738
+ remoteMarketplaceName?: string | null;
739
+ pluginName: string;
740
+ };
741
+
742
+ type PluginShareDeleteParams = {
743
+ remotePluginId: string;
744
+ };
745
+
746
+ type PluginShareListParams = Record<string, never>;
747
+
748
+ type PluginShareDiscoverability = "LISTED" | "UNLISTED" | "PRIVATE";
749
+
750
+ type PluginSharePrincipalType = "user" | "group" | "workspace";
751
+
752
+ type PluginShareTarget = {
753
+ principalType: PluginSharePrincipalType;
754
+ principalId: string;
755
+ };
756
+
757
+ type PluginShareSaveParams = {
758
+ pluginPath: AbsolutePathBuf;
759
+ remotePluginId?: string | null;
760
+ discoverability?: PluginShareDiscoverability | null;
761
+ shareTargets?: Array<PluginShareTarget> | null;
762
+ };
763
+
764
+ type PluginShareUpdateTargetsParams = {
765
+ remotePluginId: string;
766
+ shareTargets: Array<PluginShareTarget>;
767
+ };
768
+
769
+ type PluginSkillReadParams = {
770
+ remoteMarketplaceName: string;
771
+ remotePluginId: string;
772
+ skillName: string;
773
+ };
774
+
775
+ type PluginUninstallParams = {
776
+ pluginId: string;
777
+ };
778
+
779
+ type ReviewDelivery = "inline" | "detached";
780
+
781
+ type ReviewTarget = {
782
+ "type": "uncommittedChanges";
783
+ } | {
784
+ "type": "baseBranch";
785
+ branch: string;
786
+ } | {
787
+ "type": "commit";
788
+ sha: string;
789
+ /**
790
+ * Optional human-readable label (e.g., commit subject) for UIs.
791
+ */
792
+ title: string | null;
793
+ } | {
794
+ "type": "custom";
795
+ instructions: string;
796
+ };
797
+
798
+ type ReviewStartParams = {
799
+ threadId: string;
800
+ target: ReviewTarget;
801
+ /**
802
+ * Where to run the review: inline (default) on the current thread or
803
+ * detached on a new thread (returned in `reviewThreadId`).
804
+ */
805
+ delivery?: ReviewDelivery | null;
806
+ };
807
+
808
+ type AddCreditsNudgeCreditType = "credits" | "usage_limit";
809
+
810
+ type SendAddCreditsNudgeEmailParams = {
811
+ creditType: AddCreditsNudgeCreditType;
812
+ };
813
+
814
+ type SkillsConfigWriteParams = {
815
+ /**
816
+ * Path-based selector.
817
+ */
818
+ path?: AbsolutePathBuf | null;
819
+ /**
820
+ * Name-based selector.
821
+ */
822
+ name?: string | null;
823
+ enabled: boolean;
824
+ };
825
+
826
+ type SkillsListExtraRootsForCwd = {
827
+ cwd: string;
828
+ extraUserRoots: Array<string>;
829
+ };
830
+
831
+ type SkillsListParams = {
832
+ /**
833
+ * When empty, defaults to the current session working directory.
834
+ */
835
+ cwds?: Array<string>;
836
+ /**
837
+ * When true, bypass the skills cache and re-scan skills from disk.
838
+ */
839
+ forceReload?: boolean;
840
+ /**
841
+ * Optional per-cwd extra roots to scan as user-scoped skills.
842
+ */
843
+ perCwdExtraUserRoots?: Array<SkillsListExtraRootsForCwd> | null;
844
+ };
845
+
846
+ type ThreadApproveGuardianDeniedActionParams = {
847
+ threadId: string;
848
+ /**
849
+ * Serialized `codex_protocol::protocol::GuardianAssessmentEvent`.
850
+ */
851
+ event: JsonValue;
852
+ };
853
+
854
+ type ThreadArchiveParams = {
855
+ threadId: string;
856
+ };
857
+
858
+ type ThreadCompactStartParams = {
859
+ threadId: string;
860
+ };
861
+
862
+ /**
863
+ * Configures who approval requests are routed to for review. Examples
864
+ * include sandbox escapes, blocked network access, MCP approval prompts, and
865
+ * ARC escalations. Defaults to `user`. `auto_review` uses a carefully
866
+ * prompted subagent to gather relevant context and apply a risk-based
867
+ * decision framework before approving or denying the request.
868
+ */
869
+ type ApprovalsReviewer = "user" | "auto_review" | "guardian_subagent";
870
+
871
+ type AskForApproval = "untrusted" | "on-failure" | "on-request" | {
872
+ "granular": {
873
+ sandbox_approval: boolean;
874
+ rules: boolean;
875
+ skill_approval: boolean;
876
+ request_permissions: boolean;
877
+ mcp_elicitations: boolean;
878
+ };
879
+ } | "never";
880
+
881
+ type SandboxMode = "read-only" | "workspace-write" | "danger-full-access";
882
+
883
+ /**
884
+ * There are two ways to fork a thread:
885
+ * 1. By thread_id: load the thread from disk by thread_id and fork it into a new thread.
886
+ * 2. By path: load the thread from disk by path and fork it into a new thread.
887
+ *
888
+ * If using path, the thread_id param will be ignored.
889
+ *
890
+ * Prefer using thread_id whenever possible.
891
+ */
892
+ type ThreadForkParams = {
893
+ threadId: string; /**
894
+ * Configuration overrides for the forked thread, if any.
895
+ */
896
+ model?: string | null;
897
+ modelProvider?: string | null;
898
+ serviceTier?: string | null | null;
899
+ cwd?: string | null;
900
+ approvalPolicy?: AskForApproval | null; /**
901
+ * Override where approval requests are routed for review on this thread
902
+ * and subsequent turns.
903
+ */
904
+ approvalsReviewer?: ApprovalsReviewer | null;
905
+ sandbox?: SandboxMode | null;
906
+ config?: {
907
+ [key in string]?: JsonValue;
908
+ } | null;
909
+ baseInstructions?: string | null;
910
+ developerInstructions?: string | null;
911
+ ephemeral?: boolean; /**
912
+ * Optional client-supplied analytics source classification for this forked thread.
913
+ */
914
+ threadSource?: ThreadSource | null;
915
+ };
916
+
917
+ type ThreadInjectItemsParams = {
918
+ threadId: string;
919
+ /**
920
+ * Raw Responses API items to append to the thread's model-visible history.
921
+ */
922
+ items: Array<JsonValue>;
923
+ };
924
+
925
+ type SortDirection = "asc" | "desc";
926
+
927
+ type ThreadSortKey = "created_at" | "updated_at";
928
+
929
+ type ThreadSourceKind = "cli" | "vscode" | "exec" | "appServer" | "subAgent" | "subAgentReview" | "subAgentCompact" | "subAgentThreadSpawn" | "subAgentOther" | "unknown";
930
+
931
+ type ThreadListParams = {
932
+ /**
933
+ * Opaque pagination cursor returned by a previous call.
934
+ */
935
+ cursor?: string | null;
936
+ /**
937
+ * Optional page size; defaults to a reasonable server-side value.
938
+ */
939
+ limit?: number | null;
940
+ /**
941
+ * Optional sort key; defaults to created_at.
942
+ */
943
+ sortKey?: ThreadSortKey | null;
944
+ /**
945
+ * Optional sort direction; defaults to descending (newest first).
946
+ */
947
+ sortDirection?: SortDirection | null;
948
+ /**
949
+ * Optional provider filter; when set, only sessions recorded under these
950
+ * providers are returned. When present but empty, includes all providers.
951
+ */
952
+ modelProviders?: Array<string> | null;
953
+ /**
954
+ * Optional source filter; when set, only sessions from these source kinds
955
+ * are returned. When omitted or empty, defaults to interactive sources.
956
+ */
957
+ sourceKinds?: Array<ThreadSourceKind> | null;
958
+ /**
959
+ * Optional archived filter; when set to true, only archived threads are returned.
960
+ * If false or null, only non-archived threads are returned.
961
+ */
962
+ archived?: boolean | null;
963
+ /**
964
+ * Optional cwd filter or filters; when set, only threads whose session cwd
965
+ * exactly matches one of these paths are returned.
966
+ */
967
+ cwd?: string | Array<string> | null;
968
+ /**
969
+ * If true, return from the state DB without scanning JSONL rollouts to
970
+ * repair thread metadata. Omitted or false preserves scan-and-repair
971
+ * behavior.
972
+ */
973
+ useStateDbOnly?: boolean;
974
+ /**
975
+ * Optional substring filter for the extracted thread title.
976
+ */
977
+ searchTerm?: string | null;
978
+ };
979
+
980
+ type ThreadLoadedListParams = {
981
+ /**
982
+ * Opaque pagination cursor returned by a previous call.
983
+ */
984
+ cursor?: string | null;
985
+ /**
986
+ * Optional page size; defaults to no limit.
987
+ */
988
+ limit?: number | null;
989
+ };
990
+
991
+ type ThreadMetadataGitInfoUpdateParams = {
992
+ /**
993
+ * Omit to leave the stored commit unchanged, set to `null` to clear it,
994
+ * or provide a non-empty string to replace it.
995
+ */
996
+ sha?: string | null;
997
+ /**
998
+ * Omit to leave the stored branch unchanged, set to `null` to clear it,
999
+ * or provide a non-empty string to replace it.
1000
+ */
1001
+ branch?: string | null;
1002
+ /**
1003
+ * Omit to leave the stored origin URL unchanged, set to `null` to clear it,
1004
+ * or provide a non-empty string to replace it.
1005
+ */
1006
+ originUrl?: string | null;
1007
+ };
1008
+
1009
+ type ThreadMetadataUpdateParams = {
1010
+ threadId: string;
1011
+ /**
1012
+ * Patch the stored Git metadata for this thread.
1013
+ * Omit a field to leave it unchanged, set it to `null` to clear it, or
1014
+ * provide a string to replace the stored value.
1015
+ */
1016
+ gitInfo?: ThreadMetadataGitInfoUpdateParams | null;
1017
+ };
1018
+
1019
+ type ThreadReadParams = {
1020
+ threadId: string;
1021
+ /**
1022
+ * When true, include turns and their items from rollout history.
1023
+ */
1024
+ includeTurns: boolean;
1025
+ };
1026
+
1027
+ type Personality = "none" | "friendly" | "pragmatic";
1028
+
1029
+ /**
1030
+ * There are three ways to resume a thread:
1031
+ * 1. By thread_id: load the thread from disk by thread_id and resume it.
1032
+ * 2. By history: instantiate the thread from memory and resume it.
1033
+ * 3. By path: load the thread from disk by path and resume it.
1034
+ *
1035
+ * The precedence is: history > path > thread_id.
1036
+ * If using history or path, the thread_id param will be ignored.
1037
+ *
1038
+ * Prefer using thread_id whenever possible.
1039
+ */
1040
+ type ThreadResumeParams = {
1041
+ threadId: string; /**
1042
+ * Configuration overrides for the resumed thread, if any.
1043
+ */
1044
+ model?: string | null;
1045
+ modelProvider?: string | null;
1046
+ serviceTier?: string | null | null;
1047
+ cwd?: string | null;
1048
+ approvalPolicy?: AskForApproval | null; /**
1049
+ * Override where approval requests are routed for review on this thread
1050
+ * and subsequent turns.
1051
+ */
1052
+ approvalsReviewer?: ApprovalsReviewer | null;
1053
+ sandbox?: SandboxMode | null;
1054
+ config?: {
1055
+ [key in string]?: JsonValue;
1056
+ } | null;
1057
+ baseInstructions?: string | null;
1058
+ developerInstructions?: string | null;
1059
+ personality?: Personality | null;
1060
+ };
1061
+
1062
+ type ThreadRollbackParams = {
1063
+ threadId: string;
1064
+ /**
1065
+ * The number of turns to drop from the end of the thread. Must be >= 1.
1066
+ *
1067
+ * This only modifies the thread's history and does not revert local file changes
1068
+ * that have been made by the agent. Clients are responsible for reverting these changes.
1069
+ */
1070
+ numTurns: number;
1071
+ };
1072
+
1073
+ type ThreadSetNameParams = {
1074
+ threadId: string;
1075
+ name: string;
1076
+ };
1077
+
1078
+ type ThreadShellCommandParams = {
1079
+ threadId: string;
1080
+ /**
1081
+ * Shell command string evaluated by the thread's configured shell.
1082
+ * Unlike `command/exec`, this intentionally preserves shell syntax
1083
+ * such as pipes, redirects, and quoting. This runs unsandboxed with full
1084
+ * access rather than inheriting the thread sandbox policy.
1085
+ */
1086
+ command: string;
1087
+ };
1088
+
1089
+ type ThreadStartSource = "startup" | "clear";
1090
+
1091
+ type ThreadStartParams = {
1092
+ model?: string | null;
1093
+ modelProvider?: string | null;
1094
+ serviceTier?: string | null | null;
1095
+ cwd?: string | null;
1096
+ approvalPolicy?: AskForApproval | null; /**
1097
+ * Override where approval requests are routed for review on this thread
1098
+ * and subsequent turns.
1099
+ */
1100
+ approvalsReviewer?: ApprovalsReviewer | null;
1101
+ sandbox?: SandboxMode | null;
1102
+ config?: {
1103
+ [key in string]?: JsonValue;
1104
+ } | null;
1105
+ serviceName?: string | null;
1106
+ baseInstructions?: string | null;
1107
+ developerInstructions?: string | null;
1108
+ personality?: Personality | null;
1109
+ ephemeral?: boolean | null;
1110
+ sessionStartSource?: ThreadStartSource | null; /**
1111
+ * Optional client-supplied analytics source classification for this thread.
1112
+ */
1113
+ threadSource?: ThreadSource | null;
1114
+ };
1115
+
1116
+ type ThreadUnarchiveParams = {
1117
+ threadId: string;
1118
+ };
1119
+
1120
+ type ThreadUnsubscribeParams = {
1121
+ threadId: string;
1122
+ };
1123
+
1124
+ type TurnInterruptParams = {
1125
+ threadId: string;
1126
+ turnId: string;
1127
+ };
1128
+
1129
+ /**
1130
+ * A summary of the reasoning performed by the model. This can be useful for
1131
+ * debugging and understanding the model's reasoning process.
1132
+ * See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries
1133
+ */
1134
+ type ReasoningSummary = "auto" | "concise" | "detailed" | "none";
1135
+
1136
+ type TurnStartParams = {
1137
+ threadId: string;
1138
+ input: Array<UserInput>; /**
1139
+ * Override the working directory for this turn and subsequent turns.
1140
+ */
1141
+ cwd?: string | null; /**
1142
+ * Override the approval policy for this turn and subsequent turns.
1143
+ */
1144
+ approvalPolicy?: AskForApproval | null; /**
1145
+ * Override where approval requests are routed for review on this turn and
1146
+ * subsequent turns.
1147
+ */
1148
+ approvalsReviewer?: ApprovalsReviewer | null; /**
1149
+ * Override the sandbox policy for this turn and subsequent turns.
1150
+ */
1151
+ sandboxPolicy?: SandboxPolicy | null; /**
1152
+ * Override the model for this turn and subsequent turns.
1153
+ */
1154
+ model?: string | null; /**
1155
+ * Override the service tier for this turn and subsequent turns.
1156
+ */
1157
+ serviceTier?: string | null | null; /**
1158
+ * Override the reasoning effort for this turn and subsequent turns.
1159
+ */
1160
+ effort?: ReasoningEffort | null; /**
1161
+ * Override the reasoning summary for this turn and subsequent turns.
1162
+ */
1163
+ summary?: ReasoningSummary | null; /**
1164
+ * Override the personality for this turn and subsequent turns.
1165
+ */
1166
+ personality?: Personality | null; /**
1167
+ * Optional JSON Schema used to constrain the final assistant message for
1168
+ * this turn.
1169
+ */
1170
+ outputSchema?: JsonValue | null;
1171
+ };
1172
+
1173
+ type TurnSteerParams = {
1174
+ threadId: string;
1175
+ input: Array<UserInput>; /**
1176
+ * Required active turn id precondition. The request fails when it does not
1177
+ * match the currently active turn.
1178
+ */
1179
+ expectedTurnId: string;
1180
+ };
1181
+
1182
+ type WindowsSandboxSetupStartParams = {
1183
+ mode: WindowsSandboxSetupMode;
1184
+ cwd?: AbsolutePathBuf | null;
1185
+ };
1186
+
1187
+ /**
1188
+ * Request from the client to the server.
1189
+ */
1190
+ type ClientRequest = {
1191
+ "method": "initialize";
1192
+ id: RequestId;
1193
+ params: InitializeParams;
1194
+ } | {
1195
+ "method": "thread/start";
1196
+ id: RequestId;
1197
+ params: ThreadStartParams;
1198
+ } | {
1199
+ "method": "thread/resume";
1200
+ id: RequestId;
1201
+ params: ThreadResumeParams;
1202
+ } | {
1203
+ "method": "thread/fork";
1204
+ id: RequestId;
1205
+ params: ThreadForkParams;
1206
+ } | {
1207
+ "method": "thread/archive";
1208
+ id: RequestId;
1209
+ params: ThreadArchiveParams;
1210
+ } | {
1211
+ "method": "thread/unsubscribe";
1212
+ id: RequestId;
1213
+ params: ThreadUnsubscribeParams;
1214
+ } | {
1215
+ "method": "thread/name/set";
1216
+ id: RequestId;
1217
+ params: ThreadSetNameParams;
1218
+ } | {
1219
+ "method": "thread/metadata/update";
1220
+ id: RequestId;
1221
+ params: ThreadMetadataUpdateParams;
1222
+ } | {
1223
+ "method": "thread/unarchive";
1224
+ id: RequestId;
1225
+ params: ThreadUnarchiveParams;
1226
+ } | {
1227
+ "method": "thread/compact/start";
1228
+ id: RequestId;
1229
+ params: ThreadCompactStartParams;
1230
+ } | {
1231
+ "method": "thread/shellCommand";
1232
+ id: RequestId;
1233
+ params: ThreadShellCommandParams;
1234
+ } | {
1235
+ "method": "thread/approveGuardianDeniedAction";
1236
+ id: RequestId;
1237
+ params: ThreadApproveGuardianDeniedActionParams;
1238
+ } | {
1239
+ "method": "thread/rollback";
1240
+ id: RequestId;
1241
+ params: ThreadRollbackParams;
1242
+ } | {
1243
+ "method": "thread/list";
1244
+ id: RequestId;
1245
+ params: ThreadListParams;
1246
+ } | {
1247
+ "method": "thread/loaded/list";
1248
+ id: RequestId;
1249
+ params: ThreadLoadedListParams;
1250
+ } | {
1251
+ "method": "thread/read";
1252
+ id: RequestId;
1253
+ params: ThreadReadParams;
1254
+ } | {
1255
+ "method": "thread/inject_items";
1256
+ id: RequestId;
1257
+ params: ThreadInjectItemsParams;
1258
+ } | {
1259
+ "method": "skills/list";
1260
+ id: RequestId;
1261
+ params: SkillsListParams;
1262
+ } | {
1263
+ "method": "hooks/list";
1264
+ id: RequestId;
1265
+ params: HooksListParams;
1266
+ } | {
1267
+ "method": "marketplace/add";
1268
+ id: RequestId;
1269
+ params: MarketplaceAddParams;
1270
+ } | {
1271
+ "method": "marketplace/remove";
1272
+ id: RequestId;
1273
+ params: MarketplaceRemoveParams;
1274
+ } | {
1275
+ "method": "marketplace/upgrade";
1276
+ id: RequestId;
1277
+ params: MarketplaceUpgradeParams;
1278
+ } | {
1279
+ "method": "plugin/list";
1280
+ id: RequestId;
1281
+ params: PluginListParams;
1282
+ } | {
1283
+ "method": "plugin/read";
1284
+ id: RequestId;
1285
+ params: PluginReadParams;
1286
+ } | {
1287
+ "method": "plugin/skill/read";
1288
+ id: RequestId;
1289
+ params: PluginSkillReadParams;
1290
+ } | {
1291
+ "method": "plugin/share/save";
1292
+ id: RequestId;
1293
+ params: PluginShareSaveParams;
1294
+ } | {
1295
+ "method": "plugin/share/updateTargets";
1296
+ id: RequestId;
1297
+ params: PluginShareUpdateTargetsParams;
1298
+ } | {
1299
+ "method": "plugin/share/list";
1300
+ id: RequestId;
1301
+ params: PluginShareListParams;
1302
+ } | {
1303
+ "method": "plugin/share/delete";
1304
+ id: RequestId;
1305
+ params: PluginShareDeleteParams;
1306
+ } | {
1307
+ "method": "app/list";
1308
+ id: RequestId;
1309
+ params: AppsListParams;
1310
+ } | {
1311
+ "method": "device/key/create";
1312
+ id: RequestId;
1313
+ params: DeviceKeyCreateParams;
1314
+ } | {
1315
+ "method": "device/key/public";
1316
+ id: RequestId;
1317
+ params: DeviceKeyPublicParams;
1318
+ } | {
1319
+ "method": "device/key/sign";
1320
+ id: RequestId;
1321
+ params: DeviceKeySignParams;
1322
+ } | {
1323
+ "method": "fs/readFile";
1324
+ id: RequestId;
1325
+ params: FsReadFileParams;
1326
+ } | {
1327
+ "method": "fs/writeFile";
1328
+ id: RequestId;
1329
+ params: FsWriteFileParams;
1330
+ } | {
1331
+ "method": "fs/createDirectory";
1332
+ id: RequestId;
1333
+ params: FsCreateDirectoryParams;
1334
+ } | {
1335
+ "method": "fs/getMetadata";
1336
+ id: RequestId;
1337
+ params: FsGetMetadataParams;
1338
+ } | {
1339
+ "method": "fs/readDirectory";
1340
+ id: RequestId;
1341
+ params: FsReadDirectoryParams;
1342
+ } | {
1343
+ "method": "fs/remove";
1344
+ id: RequestId;
1345
+ params: FsRemoveParams;
1346
+ } | {
1347
+ "method": "fs/copy";
1348
+ id: RequestId;
1349
+ params: FsCopyParams;
1350
+ } | {
1351
+ "method": "fs/watch";
1352
+ id: RequestId;
1353
+ params: FsWatchParams;
1354
+ } | {
1355
+ "method": "fs/unwatch";
1356
+ id: RequestId;
1357
+ params: FsUnwatchParams;
1358
+ } | {
1359
+ "method": "skills/config/write";
1360
+ id: RequestId;
1361
+ params: SkillsConfigWriteParams;
1362
+ } | {
1363
+ "method": "plugin/install";
1364
+ id: RequestId;
1365
+ params: PluginInstallParams;
1366
+ } | {
1367
+ "method": "plugin/uninstall";
1368
+ id: RequestId;
1369
+ params: PluginUninstallParams;
1370
+ } | {
1371
+ "method": "turn/start";
1372
+ id: RequestId;
1373
+ params: TurnStartParams;
1374
+ } | {
1375
+ "method": "turn/steer";
1376
+ id: RequestId;
1377
+ params: TurnSteerParams;
1378
+ } | {
1379
+ "method": "turn/interrupt";
1380
+ id: RequestId;
1381
+ params: TurnInterruptParams;
1382
+ } | {
1383
+ "method": "review/start";
1384
+ id: RequestId;
1385
+ params: ReviewStartParams;
1386
+ } | {
1387
+ "method": "model/list";
1388
+ id: RequestId;
1389
+ params: ModelListParams;
1390
+ } | {
1391
+ "method": "collaborationMode/list";
1392
+ id: RequestId;
1393
+ params: CollaborationModeListParams;
1394
+ } | {
1395
+ "method": "modelProvider/capabilities/read";
1396
+ id: RequestId;
1397
+ params: ModelProviderCapabilitiesReadParams;
1398
+ } | {
1399
+ "method": "experimentalFeature/list";
1400
+ id: RequestId;
1401
+ params: ExperimentalFeatureListParams;
1402
+ } | {
1403
+ "method": "experimentalFeature/enablement/set";
1404
+ id: RequestId;
1405
+ params: ExperimentalFeatureEnablementSetParams;
1406
+ } | {
1407
+ "method": "mcpServer/oauth/login";
1408
+ id: RequestId;
1409
+ params: McpServerOauthLoginParams;
1410
+ } | {
1411
+ "method": "config/mcpServer/reload";
1412
+ id: RequestId;
1413
+ params: undefined;
1414
+ } | {
1415
+ "method": "mcpServerStatus/list";
1416
+ id: RequestId;
1417
+ params: ListMcpServerStatusParams;
1418
+ } | {
1419
+ "method": "mcpServer/resource/read";
1420
+ id: RequestId;
1421
+ params: McpResourceReadParams;
1422
+ } | {
1423
+ "method": "mcpServer/tool/call";
1424
+ id: RequestId;
1425
+ params: McpServerToolCallParams;
1426
+ } | {
1427
+ "method": "windowsSandbox/setupStart";
1428
+ id: RequestId;
1429
+ params: WindowsSandboxSetupStartParams;
1430
+ } | {
1431
+ "method": "windowsSandbox/readiness";
1432
+ id: RequestId;
1433
+ params: undefined;
1434
+ } | {
1435
+ "method": "account/login/start";
1436
+ id: RequestId;
1437
+ params: LoginAccountParams;
1438
+ } | {
1439
+ "method": "account/login/cancel";
1440
+ id: RequestId;
1441
+ params: CancelLoginAccountParams;
1442
+ } | {
1443
+ "method": "account/logout";
1444
+ id: RequestId;
1445
+ params: undefined;
1446
+ } | {
1447
+ "method": "account/rateLimits/read";
1448
+ id: RequestId;
1449
+ params: undefined;
1450
+ } | {
1451
+ "method": "account/sendAddCreditsNudgeEmail";
1452
+ id: RequestId;
1453
+ params: SendAddCreditsNudgeEmailParams;
1454
+ } | {
1455
+ "method": "feedback/upload";
1456
+ id: RequestId;
1457
+ params: FeedbackUploadParams;
1458
+ } | {
1459
+ "method": "command/exec";
1460
+ id: RequestId;
1461
+ params: CommandExecParams;
1462
+ } | {
1463
+ "method": "command/exec/write";
1464
+ id: RequestId;
1465
+ params: CommandExecWriteParams;
1466
+ } | {
1467
+ "method": "command/exec/terminate";
1468
+ id: RequestId;
1469
+ params: CommandExecTerminateParams;
1470
+ } | {
1471
+ "method": "command/exec/resize";
1472
+ id: RequestId;
1473
+ params: CommandExecResizeParams;
1474
+ } | {
1475
+ "method": "config/read";
1476
+ id: RequestId;
1477
+ params: ConfigReadParams;
1478
+ } | {
1479
+ "method": "externalAgentConfig/detect";
1480
+ id: RequestId;
1481
+ params: ExternalAgentConfigDetectParams;
1482
+ } | {
1483
+ "method": "externalAgentConfig/import";
1484
+ id: RequestId;
1485
+ params: ExternalAgentConfigImportParams;
1486
+ } | {
1487
+ "method": "config/value/write";
1488
+ id: RequestId;
1489
+ params: ConfigValueWriteParams;
1490
+ } | {
1491
+ "method": "config/batchWrite";
1492
+ id: RequestId;
1493
+ params: ConfigBatchWriteParams;
1494
+ } | {
1495
+ "method": "configRequirements/read";
1496
+ id: RequestId;
1497
+ params: undefined;
1498
+ } | {
1499
+ "method": "account/read";
1500
+ id: RequestId;
1501
+ params: GetAccountParams;
1502
+ } | {
1503
+ "method": "getConversationSummary";
1504
+ id: RequestId;
1505
+ params: GetConversationSummaryParams;
1506
+ } | {
1507
+ "method": "gitDiffToRemote";
1508
+ id: RequestId;
1509
+ params: GitDiffToRemoteParams;
1510
+ } | {
1511
+ "method": "getAuthStatus";
1512
+ id: RequestId;
1513
+ params: GetAuthStatusParams;
1514
+ } | {
1515
+ "method": "fuzzyFileSearch";
1516
+ id: RequestId;
1517
+ params: FuzzyFileSearchParams;
1518
+ };
1519
+
1520
+ /**
1521
+ * Initial collaboration mode to use when the TUI starts.
1522
+ */
1523
+ type ModeKind = "plan" | "default";
1524
+
1525
+ type InitializeResponse = {
1526
+ userAgent: string;
1527
+ /**
1528
+ * Absolute path to the server's $CODEX_HOME directory.
1529
+ */
1530
+ codexHome: AbsolutePathBuf;
1531
+ /**
1532
+ * Platform family for the running app-server target, for example
1533
+ * `"unix"` or `"windows"`.
1534
+ */
1535
+ platformFamily: string;
1536
+ /**
1537
+ * Operating system for the running app-server target, for example
1538
+ * `"macos"`, `"linux"`, or `"windows"`.
1539
+ */
1540
+ platformOs: string;
1541
+ };
1542
+
1543
+ /**
1544
+ * A known resource that the server is capable of reading.
1545
+ */
1546
+ type Resource = {
1547
+ annotations?: JsonValue;
1548
+ description?: string;
1549
+ mimeType?: string;
1550
+ name: string;
1551
+ size?: number;
1552
+ title?: string;
1553
+ uri: string;
1554
+ icons?: Array<JsonValue>;
1555
+ _meta?: JsonValue;
1556
+ };
1557
+
1558
+ /**
1559
+ * Contents returned when reading a resource from an MCP server.
1560
+ */
1561
+ type ResourceContent = {
1562
+ /**
1563
+ * The URI of this resource.
1564
+ */
1565
+ uri: string;
1566
+ mimeType?: string;
1567
+ text: string;
1568
+ _meta?: JsonValue;
1569
+ } | {
1570
+ /**
1571
+ * The URI of this resource.
1572
+ */
1573
+ uri: string;
1574
+ mimeType?: string;
1575
+ blob: string;
1576
+ _meta?: JsonValue;
1577
+ };
1578
+
1579
+ /**
1580
+ * A template description for resources available on the server.
1581
+ */
1582
+ type ResourceTemplate = {
1583
+ annotations?: JsonValue;
1584
+ uriTemplate: string;
1585
+ name: string;
1586
+ title?: string;
1587
+ description?: string;
1588
+ mimeType?: string;
1589
+ };
1590
+
1591
+ /**
1592
+ * Definition for a tool the client can call.
1593
+ */
1594
+ type Tool = {
1595
+ name: string;
1596
+ title?: string;
1597
+ description?: string;
1598
+ inputSchema: JsonValue;
1599
+ outputSchema?: JsonValue;
1600
+ annotations?: JsonValue;
1601
+ icons?: Array<JsonValue>;
1602
+ _meta?: JsonValue;
1603
+ };
1604
+
1605
+ /**
1606
+ * EXPERIMENTAL - collaboration mode preset metadata for clients.
1607
+ */
1608
+ type CollaborationModeMask = {
1609
+ name: string;
1610
+ mode: ModeKind | null;
1611
+ model: string | null;
1612
+ reasoning_effort: ReasoningEffort | null | null;
1613
+ };
1614
+
1615
+ /**
1616
+ * EXPERIMENTAL - collaboration mode presets response.
1617
+ */
1618
+ type CollaborationModeListResponse = {
1619
+ data: Array<CollaborationModeMask>;
1620
+ };
1621
+
1622
+ type McpAuthStatus = "unsupported" | "notLoggedIn" | "bearerToken" | "oAuth";
1623
+
1624
+ type McpServerStatus = {
1625
+ name: string;
1626
+ tools: {
1627
+ [key in string]?: Tool;
1628
+ };
1629
+ resources: Array<Resource>;
1630
+ resourceTemplates: Array<ResourceTemplate>;
1631
+ authStatus: McpAuthStatus;
1632
+ };
1633
+
1634
+ type ListMcpServerStatusResponse = {
1635
+ data: Array<McpServerStatus>;
1636
+ /**
1637
+ * Opaque cursor to pass to the next call to continue after the last item.
1638
+ * If None, there are no more items to return.
1639
+ */
1640
+ nextCursor: string | null;
1641
+ };
1642
+
1643
+ type McpResourceReadResponse = {
1644
+ contents: Array<ResourceContent>;
1645
+ };
1646
+
1647
+ type McpServerOauthLoginResponse = {
1648
+ authorizationUrl: string;
1649
+ };
1650
+
1651
+ type McpServerRefreshResponse = Record<string, never>;
1652
+
1653
+ type McpServerToolCallResponse = {
1654
+ content: Array<JsonValue>;
1655
+ structuredContent?: JsonValue;
1656
+ isError?: boolean;
1657
+ _meta?: JsonValue;
1658
+ };
1659
+
1660
+ type ThreadArchiveResponse = Record<string, never>;
1661
+
1662
+ type ThreadCompactStartResponse = Record<string, never>;
1663
+
1664
+ type ThreadListResponse = {
1665
+ data: Array<Thread>;
1666
+ /**
1667
+ * Opaque cursor to pass to the next call to continue after the last item.
1668
+ * if None, there are no more items to return.
1669
+ */
1670
+ nextCursor: string | null;
1671
+ /**
1672
+ * Opaque cursor to pass as `cursor` when reversing `sortDirection`.
1673
+ * This is only populated when the page contains at least one thread.
1674
+ * Use it with the opposite `sortDirection`; for timestamp sorts it anchors
1675
+ * at the start of the page timestamp so same-second updates are not skipped.
1676
+ */
1677
+ backwardsCursor: string | null;
1678
+ };
1679
+
1680
+ type ThreadMetadataUpdateResponse = {
1681
+ thread: Thread;
1682
+ };
1683
+
1684
+ type ThreadReadResponse = {
1685
+ thread: Thread;
1686
+ };
1687
+
1688
+ type ThreadResumeResponse = {
1689
+ thread: Thread;
1690
+ model: string;
1691
+ modelProvider: string;
1692
+ serviceTier: string | null;
1693
+ cwd: AbsolutePathBuf; /**
1694
+ * Instruction source files currently loaded for this thread.
1695
+ */
1696
+ instructionSources: Array<AbsolutePathBuf>;
1697
+ approvalPolicy: AskForApproval; /**
1698
+ * Reviewer currently used for approval requests on this thread.
1699
+ */
1700
+ approvalsReviewer: ApprovalsReviewer; /**
1701
+ * Legacy sandbox policy retained for compatibility. Experimental clients
1702
+ * should prefer `permissionProfile` when they need exact runtime
1703
+ * permissions.
1704
+ */
1705
+ sandbox: SandboxPolicy;
1706
+ reasoningEffort: ReasoningEffort | null;
1707
+ };
1708
+
1709
+ type ThreadSetNameResponse = Record<string, never>;
1710
+
1711
+ type ThreadStartResponse = {
1712
+ thread: Thread;
1713
+ model: string;
1714
+ modelProvider: string;
1715
+ serviceTier: string | null;
1716
+ cwd: AbsolutePathBuf; /**
1717
+ * Instruction source files currently loaded for this thread.
1718
+ */
1719
+ instructionSources: Array<AbsolutePathBuf>;
1720
+ approvalPolicy: AskForApproval; /**
1721
+ * Reviewer currently used for approval requests on this thread.
1722
+ */
1723
+ approvalsReviewer: ApprovalsReviewer; /**
1724
+ * Legacy sandbox policy retained for compatibility. Experimental clients
1725
+ * should prefer `permissionProfile` when they need exact runtime
1726
+ * permissions.
1727
+ */
1728
+ sandbox: SandboxPolicy;
1729
+ reasoningEffort: ReasoningEffort | null;
1730
+ };
1731
+
1732
+ type ThreadUnarchiveResponse = {
1733
+ thread: Thread;
1734
+ };
1735
+
1736
+ type TurnInterruptResponse = Record<string, never>;
1737
+
1738
+ type TurnStartResponse = {
1739
+ turn: Turn;
1740
+ };
1741
+
1742
+ type TurnSteerResponse = {
1743
+ turnId: string;
1744
+ };
1745
+
1746
+ type JsonRpcResult = unknown;
1747
+ type JSONRPCErrorError = {
1748
+ code: number;
1749
+ data?: unknown;
1750
+ message: string;
1751
+ };
1752
+ type Result = JsonRpcResult;
1753
+ type AppServerEvent = {
1754
+ skipped: number;
1755
+ type: "lagged";
1756
+ } | {
1757
+ notification: ServerNotification;
1758
+ type: "server_notification";
1759
+ } | {
1760
+ request: ServerRequest;
1761
+ type: "server_request";
1762
+ } | {
1763
+ message: string;
1764
+ type: "disconnected";
1765
+ };
1766
+ type TypedRequestError = {
1767
+ method: string;
1768
+ source: unknown;
1769
+ type: "transport";
1770
+ } | {
1771
+ method: string;
1772
+ source: JSONRPCErrorError;
1773
+ type: "server";
1774
+ } | {
1775
+ method: string;
1776
+ source: unknown;
1777
+ type: "deserialize";
1778
+ };
1779
+ type AppServerRequestHandle = {
1780
+ rejectServerRequest(requestId: RequestId, error: JSONRPCErrorError): Promise<void>;
1781
+ request(request: ClientRequest): Promise<unknown>;
1782
+ requestTyped<T>(request: ClientRequest): Promise<T>;
1783
+ resolveServerRequest(requestId: RequestId, result: Result): Promise<void>;
1784
+ };
1785
+ declare function requestTyped<T>(request: ClientRequest, send: (request: ClientRequest) => Promise<unknown>): Promise<T>;
1786
+ declare function serverNotificationRequiresDelivery(notification: ServerNotification): boolean;
1787
+ declare function requestMethodName(request: ClientRequest): string;
1788
+
1789
+ type CodexAppServer = {
1790
+ close?(): void;
1791
+ events?(): AsyncIterable<AppServerEvent>;
1792
+ nextEvent?(): Promise<AppServerEvent | null>;
1793
+ rejectServerRequest(requestId: RequestId, error: JSONRPCErrorError): Promise<void>;
1794
+ request(request: ClientRequest): Promise<unknown>;
1795
+ requestTyped<T>(request: ClientRequest): Promise<T>;
1796
+ resolveServerRequest(requestId: RequestId, result: Result): Promise<void>;
1797
+ };
1798
+ declare class AppServerSession {
1799
+ private readonly client;
1800
+ private nextRequestIdValue;
1801
+ constructor(client: CodexAppServer);
1802
+ nextRequestId(): RequestId;
1803
+ nextEvent(): Promise<AppServerEvent | null>;
1804
+ events(): AsyncIterable<AppServerEvent> | null;
1805
+ requestTyped<T>(request: ClientRequest): Promise<T>;
1806
+ initialize(params?: InitializeParams): Promise<InitializeResponse>;
1807
+ threadStart(params: ThreadStartParams): Promise<ThreadStartResponse>;
1808
+ threadResume(params: ThreadResumeParams): Promise<ThreadResumeResponse>;
1809
+ threadList(params?: ThreadListParams): Promise<ThreadListResponse>;
1810
+ collaborationModeList(params?: CollaborationModeListParams): Promise<CollaborationModeListResponse>;
1811
+ configMcpServerReload(): Promise<McpServerRefreshResponse>;
1812
+ mcpServerStatusList(params?: ListMcpServerStatusParams): Promise<ListMcpServerStatusResponse>;
1813
+ mcpResourceRead(params: McpResourceReadParams): Promise<McpResourceReadResponse>;
1814
+ mcpServerToolCall(params: McpServerToolCallParams): Promise<McpServerToolCallResponse>;
1815
+ mcpServerOauthLogin(params: McpServerOauthLoginParams): Promise<McpServerOauthLoginResponse>;
1816
+ threadRead(params: ThreadReadParams): Promise<ThreadReadResponse>;
1817
+ threadNameSet(params: ThreadSetNameParams): Promise<ThreadSetNameResponse>;
1818
+ threadArchive(params: ThreadArchiveParams): Promise<ThreadArchiveResponse>;
1819
+ threadUnarchive(params: ThreadUnarchiveParams): Promise<ThreadUnarchiveResponse>;
1820
+ threadMetadataUpdate(params: ThreadMetadataUpdateParams): Promise<ThreadMetadataUpdateResponse>;
1821
+ turnStart(params: TurnStartParams): Promise<TurnStartResponse>;
1822
+ turnSteer(params: TurnSteerParams): Promise<TurnSteerResponse>;
1823
+ turnInterrupt(params: TurnInterruptParams): Promise<TurnInterruptResponse>;
1824
+ threadCompactStart(params: ThreadCompactStartParams): Promise<ThreadCompactStartResponse>;
1825
+ resolveServerRequest(requestId: RequestId, result: Result): Promise<void>;
1826
+ rejectServerRequest(requestId: RequestId, error: JSONRPCErrorError): Promise<void>;
1827
+ }
1828
+
1829
+ export { type AppServerEvent as A, type ThreadSetNameParams as B, type CodexAppServer as C, type ThreadSetNameResponse as D, type ThreadReadParams as E, type ThreadReadResponse as F, type ThreadResumeParams as G, type ThreadResumeResponse as H, type InitializeParams as I, type JSONRPCErrorError as J, type ThreadStartResponse as K, type ListMcpServerStatusParams as L, type McpServerRefreshResponse as M, type ThreadUnarchiveParams as N, type ThreadUnarchiveResponse as O, type TurnInterruptParams as P, type TurnInterruptResponse as Q, type Result as R, type TurnStartResponse as S, type TypedRequestError as T, type TurnSteerParams as U, type TurnSteerResponse as V, type AppServerRequestHandle as a, AppServerSession as b, type ClientRequest as c, type InitializeResponse as d, requestTyped as e, type ThreadStartParams as f, type TurnStartParams as g, type CollaborationModeListParams as h, type CollaborationModeListResponse as i, type McpResourceReadParams as j, type McpResourceReadResponse as k, type McpServerOauthLoginParams as l, type McpServerOauthLoginResponse as m, type ListMcpServerStatusResponse as n, type McpServerToolCallParams as o, type McpServerToolCallResponse as p, type ThreadArchiveParams as q, requestMethodName as r, serverNotificationRequiresDelivery as s, type ThreadArchiveResponse as t, type ThreadCompactStartParams as u, type ThreadCompactStartResponse as v, type ThreadListParams as w, type ThreadListResponse as x, type ThreadMetadataUpdateParams as y, type ThreadMetadataUpdateResponse as z };