@jrkropp/codex-js 0.1.2 → 0.1.4

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 (134) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -2
  3. package/dist/ClientNotification-B6-FhXQf.d.ts +5 -0
  4. package/dist/DynamicToolCallResponse-82DFjES2.d.ts +8 -0
  5. package/dist/DynamicToolSpec-CfnhqAYK.d.ts +29 -0
  6. package/dist/PermissionsRequestApprovalResponse-DxzPPDRb.d.ts +55 -0
  7. package/dist/ProviderStatusBanner-BlP6lzwE.d.ts +441 -0
  8. package/dist/ServerRequest-B5cKVJjr.d.ts +2181 -0
  9. package/dist/{session-DPhHN7RZ.d.ts → ThreadResumeResponse-DvmE1juU.d.ts} +3 -306
  10. package/dist/ToolRequestUserInputQuestion-CeZa5X1J.d.ts +23 -0
  11. package/dist/ToolRequestUserInputResponse-zcPLwbiK.d.ts +17 -0
  12. package/dist/TurnSteerResponse-0kBCfplh.d.ts +209 -0
  13. package/dist/WebSearchToolConfig-D3ep0625.d.ts +18 -0
  14. package/dist/chat-runtime-9RkXHC_w.d.ts +382 -0
  15. package/dist/chunk-2DZRMCI2.js +1258 -0
  16. package/dist/chunk-2DZRMCI2.js.map +1 -0
  17. package/dist/chunk-4DPLJPB5.js +396 -0
  18. package/dist/chunk-4DPLJPB5.js.map +1 -0
  19. package/dist/chunk-5JMJ6OI5.js +3 -0
  20. package/dist/chunk-5JMJ6OI5.js.map +1 -0
  21. package/dist/chunk-6ZMJ34KE.js +1153 -0
  22. package/dist/chunk-6ZMJ34KE.js.map +1 -0
  23. package/dist/chunk-CGBS37IU.js +128 -0
  24. package/dist/chunk-CGBS37IU.js.map +1 -0
  25. package/dist/chunk-DCMKA2A6.js +18 -0
  26. package/dist/chunk-DCMKA2A6.js.map +1 -0
  27. package/dist/chunk-DYLHN3HG.js +937 -0
  28. package/dist/chunk-DYLHN3HG.js.map +1 -0
  29. package/dist/{chunk-SVK6PLGO.js → chunk-LWQNX4LI.js} +12009 -18768
  30. package/dist/chunk-LWQNX4LI.js.map +1 -0
  31. package/dist/{chunk-JLDH4U5L.js → chunk-NCI4MAWZ.js} +317 -1967
  32. package/dist/chunk-NCI4MAWZ.js.map +1 -0
  33. package/dist/chunk-O44XP7LH.js +214 -0
  34. package/dist/chunk-O44XP7LH.js.map +1 -0
  35. package/dist/chunk-PST3ZWX2.js +555 -0
  36. package/dist/chunk-PST3ZWX2.js.map +1 -0
  37. package/dist/chunk-SYPHCDRD.js +1133 -0
  38. package/dist/chunk-SYPHCDRD.js.map +1 -0
  39. package/dist/chunk-V4BMZWBM.js +2401 -0
  40. package/dist/chunk-V4BMZWBM.js.map +1 -0
  41. package/dist/chunk-W7S6HFCQ.js +1983 -0
  42. package/dist/chunk-W7S6HFCQ.js.map +1 -0
  43. package/dist/chunk-YHVCFD2D.js +117 -0
  44. package/dist/chunk-YHVCFD2D.js.map +1 -0
  45. package/dist/chunk-Z63UPBS3.js +152 -0
  46. package/dist/chunk-Z63UPBS3.js.map +1 -0
  47. package/dist/client/index.d.ts +16 -4
  48. package/dist/client/index.js +13 -1
  49. package/dist/codex-rs/app-server/index.d.ts +161 -0
  50. package/dist/codex-rs/app-server/index.js +13 -0
  51. package/dist/codex-rs/app-server/index.js.map +1 -0
  52. package/dist/codex-rs/app-server-protocol/index.d.ts +1722 -0
  53. package/dist/codex-rs/app-server-protocol/index.js +6 -0
  54. package/dist/codex-rs/app-server-protocol/index.js.map +1 -0
  55. package/dist/codex-rs/app-server-protocol/protocol.d.ts +19 -0
  56. package/dist/codex-rs/app-server-protocol/protocol.js +4 -0
  57. package/dist/codex-rs/app-server-protocol/protocol.js.map +1 -0
  58. package/dist/codex-rs/codex-api/index.d.ts +104 -0
  59. package/dist/codex-rs/codex-api/index.js +11 -0
  60. package/dist/codex-rs/codex-api/index.js.map +1 -0
  61. package/dist/codex-rs/config/index.d.ts +88 -0
  62. package/dist/codex-rs/config/index.js +4 -0
  63. package/dist/codex-rs/config/index.js.map +1 -0
  64. package/dist/codex-rs/core/config/index.d.ts +61 -0
  65. package/dist/codex-rs/core/config/index.js +5 -0
  66. package/dist/codex-rs/core/config/index.js.map +1 -0
  67. package/dist/codex-rs/core/index.d.ts +1393 -0
  68. package/dist/codex-rs/core/index.js +11 -0
  69. package/dist/codex-rs/core/index.js.map +1 -0
  70. package/dist/codex-rs/model-provider/index.d.ts +2 -0
  71. package/dist/codex-rs/model-provider/index.js +4 -0
  72. package/dist/codex-rs/model-provider/index.js.map +1 -0
  73. package/dist/codex-rs/models-manager/index.d.ts +2 -0
  74. package/dist/codex-rs/models-manager/index.js +4 -0
  75. package/dist/codex-rs/models-manager/index.js.map +1 -0
  76. package/dist/codex-rs/parity.d.ts +26 -0
  77. package/dist/codex-rs/parity.js +3 -0
  78. package/dist/codex-rs/parity.js.map +1 -0
  79. package/dist/codex-rs/thread-store/index.d.ts +5 -0
  80. package/dist/codex-rs/thread-store/index.js +4 -0
  81. package/dist/codex-rs/thread-store/index.js.map +1 -0
  82. package/dist/codex-rs/unsupported.d.ts +15 -0
  83. package/dist/codex-rs/unsupported.js +22 -0
  84. package/dist/codex-rs/unsupported.js.map +1 -0
  85. package/dist/codex-rs/utils/output-truncation.d.ts +21 -0
  86. package/dist/codex-rs/utils/output-truncation.js +4 -0
  87. package/dist/codex-rs/utils/output-truncation.js.map +1 -0
  88. package/dist/codex-rs/utils/string.d.ts +7 -0
  89. package/dist/codex-rs/utils/string.js +3 -0
  90. package/dist/codex-rs/utils/string.js.map +1 -0
  91. package/dist/common-CTyph5x8.d.ts +40 -0
  92. package/dist/event-mapping-CbISdQ1D.d.ts +43 -0
  93. package/dist/history-CfM-4V7b.d.ts +1654 -0
  94. package/dist/index-77U_Oc-a.d.ts +63 -0
  95. package/dist/index-CoDZosq0.d.ts +261 -0
  96. package/dist/index.d.ts +18 -7
  97. package/dist/index.js +16 -2
  98. package/dist/lib-nXlaKiS-.d.ts +48 -0
  99. package/dist/live-thread-BMvlflzM.d.ts +30 -0
  100. package/dist/merge-B_AWVmnI.d.ts +24 -0
  101. package/dist/mod-DYVLSWO4.d.ts +91 -0
  102. package/dist/plan-mode-Cv6KWb_S.d.ts +14 -0
  103. package/dist/proposed-plan-DpN1ma0Y.d.ts +53 -0
  104. package/dist/protocol-mpBcYHrm.d.ts +1655 -0
  105. package/dist/react/index.d.ts +56 -48
  106. package/dist/react/index.js +16 -2
  107. package/dist/{remote-_6TDvg-g.d.ts → remote-ClZbq9KN.d.ts} +3 -1
  108. package/dist/rendered-thread-AOxw3V5b.d.ts +29 -0
  109. package/dist/responses_websocket-BhxSgCzK.d.ts +183 -0
  110. package/dist/runtime-Cm6ml53h.d.ts +528 -0
  111. package/dist/server/index.d.ts +29 -2416
  112. package/dist/server/index.js +13 -1
  113. package/dist/session-BRYzi8OT.d.ts +46 -0
  114. package/dist/shadcn/index.d.ts +1 -1
  115. package/dist/{sidebar-DT2XoitN.d.ts → sidebar-DMMij22z.d.ts} +1 -1
  116. package/dist/spec_plan_types-CmsJ-Tfn.d.ts +260 -0
  117. package/dist/{store-GYldc9EJ.d.ts → store-AGRxhgQ3.d.ts} +2 -1
  118. package/dist/t3code/apps/web/components/chat.d.ts +508 -0
  119. package/dist/t3code/apps/web/components/chat.js +12 -0
  120. package/dist/t3code/apps/web/components/chat.js.map +1 -0
  121. package/dist/t3code/apps/web/index.d.ts +12 -0
  122. package/dist/t3code/apps/web/index.js +13 -0
  123. package/dist/t3code/apps/web/index.js.map +1 -0
  124. package/dist/testing/index.d.ts +9 -91
  125. package/dist/testing/index.js +13 -1
  126. package/dist/thread-history-builder-zW0zeqcS.d.ts +58 -0
  127. package/dist/thread_event_store-C0zYzukG.d.ts +77 -0
  128. package/dist/types-BTeabLYr.d.ts +126 -0
  129. package/package.json +152 -88
  130. package/dist/chat-runtime-D7wu_KbX.d.ts +0 -747
  131. package/dist/chunk-JLDH4U5L.js.map +0 -1
  132. package/dist/chunk-SVK6PLGO.js.map +0 -1
  133. package/dist/index-CB9la6xE.d.ts +0 -112
  134. package/dist/thread_event_store-B9CoQUIA.d.ts +0 -3868
@@ -0,0 +1,382 @@
1
+ import * as React from 'react';
2
+ import { ReactNode, ComponentPropsWithRef, RefObject, ReactElement, ComponentProps } from 'react';
3
+ import { LegendListRef } from '@legendapp/list/react';
4
+ import { l as ThreadId, C as CollaborationMode, a4 as UserMessageTurnItem, w as DynamicToolCallRequest, v as RequestPermissionsEvent, t as TurnItem } from './protocol-mpBcYHrm.js';
5
+ import { R as RequestId } from './ToolRequestUserInputQuestion-CeZa5X1J.js';
6
+ import { k as ThreadStartParams, n as TurnStartParams } from './ThreadResumeResponse-DvmE1juU.js';
7
+ import { a as ServerRequest } from './ServerRequest-B5cKVJjr.js';
8
+ import { R as Result, J as JSONRPCErrorError } from './lib-nXlaKiS-.js';
9
+ import { e as StoredThread } from './types-BTeabLYr.js';
10
+ import { C as CodexAppServer } from './session-BRYzi8OT.js';
11
+ import { a as ThreadEventSnapshot } from './thread_event_store-C0zYzukG.js';
12
+ import { a as ChatComposerSubmitPayload, X as PendingUserInput, Y as ContextWindowSnapshot, Z as MessagesTimelineProps, _ as ChatViewProps, $ as ChatComposer, C as ChatComposerHandle, a0 as ChatComposerRuntimeMode, a1 as ProviderStatus, a2 as ComposerBannerStackItem, b as ChatViewRenderComposerControls } from './ProviderStatusBanner-BlP6lzwE.js';
13
+ import { S as Sidebar, a as SidebarProvider } from './sidebar-DMMij22z.js';
14
+ import { T as ThreadStore } from './store-AGRxhgQ3.js';
15
+ import { a as Turn } from './thread-history-builder-zW0zeqcS.js';
16
+
17
+ type ThreadReader = Pick<ThreadStore, "loadHistory" | "readThread">;
18
+
19
+ type CodexChatLifecycleBuildThreadStartParamsInput = {
20
+ threadId: ThreadId;
21
+ };
22
+ type CodexChatLifecycleThreadStartParams = ThreadStartParams & {
23
+ threadId?: ThreadId | string;
24
+ };
25
+ type CodexChatLifecycleBuildTurnStartParamsInput = {
26
+ clientMessageId: string;
27
+ imageUrls: string[];
28
+ interactionMode?: "default" | "plan";
29
+ runtimeMode?: "approval-required" | "auto-accept-edits" | "full-access";
30
+ sendContext: ChatComposerSubmitPayload;
31
+ threadId: ThreadId;
32
+ };
33
+ type CodexChatLifecycleTurnStartParams = TurnStartParams & {
34
+ collaborationMode?: CollaborationMode;
35
+ collaboration_mode?: CollaborationMode;
36
+ clientMessageId?: string;
37
+ };
38
+ type CodexChatLifecycleSendControls = {
39
+ clearComposer: () => void;
40
+ prepareForOptimisticAppend: () => Promise<void>;
41
+ restoreComposer: (sendContext: ChatComposerSubmitPayload) => void;
42
+ };
43
+ type CodexChatLifecycleSendOptions = {
44
+ interactionMode?: "default" | "plan";
45
+ runtimeMode?: "approval-required" | "auto-accept-edits" | "full-access";
46
+ };
47
+ type CodexChatLifecycleOptions = {
48
+ buildThreadStartParams?: (input: CodexChatLifecycleBuildThreadStartParamsInput) => CodexChatLifecycleThreadStartParams;
49
+ buildTurnStartParams?: (input: CodexChatLifecycleBuildTurnStartParamsInput) => CodexChatLifecycleTurnStartParams;
50
+ connectOnMount?: boolean;
51
+ initialState?: ThreadEventSnapshot | null;
52
+ isRecoverableConnectionError?: (error: Error) => boolean;
53
+ onActiveThread?: (thread: StoredThread | null) => void;
54
+ onRuntimeError?: (error: Error) => void;
55
+ onServerRequest?: (request: ServerRequest) => void;
56
+ onState?: (state: ThreadEventSnapshot | null) => void;
57
+ onSubmittedUserMessage?: (state: ThreadEventSnapshot) => void;
58
+ onThreadListChanged?: () => void;
59
+ onThreadStarted?: (state: ThreadEventSnapshot) => void;
60
+ appServer: CodexAppServer;
61
+ threadReader?: ThreadReader;
62
+ threadId: ThreadId | string;
63
+ };
64
+ declare function createDefaultThreadStartParams({ threadId, }: CodexChatLifecycleBuildThreadStartParamsInput): CodexChatLifecycleThreadStartParams;
65
+ declare function createDefaultTurnStartParams({ clientMessageId, imageUrls, interactionMode, runtimeMode, sendContext, threadId, }: CodexChatLifecycleBuildTurnStartParamsInput): CodexChatLifecycleTurnStartParams;
66
+ type CodexChatLifecycle = {
67
+ activeThread: StoredThread | null;
68
+ activeWorkStartedAt: string | null;
69
+ assistantStreaming: boolean;
70
+ compact: () => Promise<boolean>;
71
+ connectionStatus: ThreadEventSnapshot["connectionStatus"] | "idle";
72
+ interrupt: () => Promise<boolean>;
73
+ isSendBusy: boolean;
74
+ isSending: boolean;
75
+ isWorking: boolean;
76
+ pendingPermissionRequestActive: boolean;
77
+ pendingUserInputActive: boolean;
78
+ reconnect: () => void;
79
+ runtimeError: string | null;
80
+ sendComposerMessage: (sendContext: ChatComposerSubmitPayload, controls: CodexChatLifecycleSendControls, options?: CodexChatLifecycleSendOptions) => Promise<void>;
81
+ resolveServerRequest: (requestId: RequestId, response: Result) => Promise<boolean>;
82
+ rejectServerRequest: (requestId: RequestId, error: JSONRPCErrorError) => Promise<boolean>;
83
+ threadSnapshot: ThreadEventSnapshot | null;
84
+ threadId: ThreadId;
85
+ turnRunning: boolean;
86
+ visibleOptimisticUserMessages: readonly UserMessageTurnItem[];
87
+ };
88
+ declare function useCodexChatLifecycle(options: CodexChatLifecycleOptions): CodexChatLifecycle;
89
+
90
+ type CodexChatInteractionMode = "default" | "plan";
91
+ type CodexChatProposedPlan = {
92
+ id: string;
93
+ planMarkdown: string;
94
+ title: string | null;
95
+ turnId: string;
96
+ };
97
+ type CodexChatPendingUserInputRequest = {
98
+ kind: "userInput";
99
+ itemId: string;
100
+ pendingUserInput: PendingUserInput;
101
+ request: Extract<ServerRequest, {
102
+ method: "item/tool/requestUserInput";
103
+ }>;
104
+ requestId: RequestId;
105
+ threadId: string;
106
+ turnId: string;
107
+ };
108
+ type CodexChatPendingPermissionRequest = {
109
+ kind: "permissions";
110
+ composerRequest: RequestPermissionsEvent;
111
+ request: Extract<ServerRequest, {
112
+ method: "item/permissions/requestApproval";
113
+ }>;
114
+ requestId: RequestId;
115
+ threadId: string;
116
+ turnId: string | null;
117
+ };
118
+ type CodexChatPendingDynamicToolCallRequest = {
119
+ kind: "dynamicToolCall";
120
+ compatRequest: DynamicToolCallRequest;
121
+ request: Extract<ServerRequest, {
122
+ method: "item/tool/call";
123
+ }>;
124
+ requestId: RequestId;
125
+ threadId: string;
126
+ turnId: string | null;
127
+ };
128
+ type CodexChatPendingMcpElicitationRequest = {
129
+ kind: "mcpElicitation";
130
+ request: Extract<ServerRequest, {
131
+ method: "mcpServer/elicitation/request";
132
+ }>;
133
+ requestId: RequestId;
134
+ threadId: string | null;
135
+ turnId: string | null;
136
+ };
137
+ type CodexChatPendingCommandApprovalRequest = {
138
+ kind: "commandApproval";
139
+ request: Extract<ServerRequest, {
140
+ method: "item/commandExecution/requestApproval";
141
+ }>;
142
+ requestId: RequestId;
143
+ threadId: string;
144
+ turnId: string | null;
145
+ };
146
+ type CodexChatPendingFileChangeApprovalRequest = {
147
+ kind: "fileChangeApproval";
148
+ request: Extract<ServerRequest, {
149
+ method: "item/fileChange/requestApproval";
150
+ }>;
151
+ requestId: RequestId;
152
+ threadId: string;
153
+ turnId: string | null;
154
+ };
155
+ type CodexChatPendingAuthRefreshRequest = {
156
+ kind: "chatgptAuthTokensRefresh";
157
+ request: Extract<ServerRequest, {
158
+ method: "account/chatgptAuthTokens/refresh";
159
+ }>;
160
+ requestId: RequestId;
161
+ threadId: null;
162
+ turnId: null;
163
+ };
164
+ type CodexChatPendingApplyPatchApprovalRequest = {
165
+ kind: "applyPatchApproval";
166
+ request: Extract<ServerRequest, {
167
+ method: "applyPatchApproval";
168
+ }>;
169
+ requestId: RequestId;
170
+ threadId: string;
171
+ turnId: null;
172
+ };
173
+ type CodexChatPendingExecCommandApprovalRequest = {
174
+ kind: "execCommandApproval";
175
+ request: Extract<ServerRequest, {
176
+ method: "execCommandApproval";
177
+ }>;
178
+ requestId: RequestId;
179
+ threadId: string;
180
+ turnId: null;
181
+ };
182
+ type CodexChatPendingRequest = CodexChatPendingApplyPatchApprovalRequest | CodexChatPendingAuthRefreshRequest | CodexChatPendingCommandApprovalRequest | CodexChatPendingDynamicToolCallRequest | CodexChatPendingExecCommandApprovalRequest | CodexChatPendingFileChangeApprovalRequest | CodexChatPendingMcpElicitationRequest | CodexChatPendingPermissionRequest | CodexChatPendingUserInputRequest;
183
+ type CodexChatRenderLifecycleState = {
184
+ activeWorkStartedAt: string | null;
185
+ isWorking: boolean;
186
+ runtimeError: string | null;
187
+ visibleOptimisticUserMessages: readonly UserMessageTurnItem[];
188
+ };
189
+ type CodexChatPendingRequestRenderContext = {
190
+ defaultNode: ReactNode;
191
+ reject: (message?: string | JSONRPCErrorError) => Promise<boolean>;
192
+ request: CodexChatPendingRequest;
193
+ resolve: (result: Result) => Promise<boolean>;
194
+ state: CodexChatRenderState;
195
+ };
196
+ type CodexChatPendingUserInputRenderContext = {
197
+ defaultNode: ReactNode;
198
+ reject: (message?: string | JSONRPCErrorError) => Promise<boolean>;
199
+ request: CodexChatPendingUserInputRequest;
200
+ resolve: (result: Result) => Promise<boolean>;
201
+ state: CodexChatRenderState;
202
+ };
203
+ type CodexChatRenderStateInput = {
204
+ interactionMode?: CodexChatInteractionMode;
205
+ lifecycle?: Partial<CodexChatRenderLifecycleState>;
206
+ snapshot: ThreadEventSnapshot | null;
207
+ };
208
+ type CodexChatRenderState = {
209
+ activeProposedPlan: CodexChatProposedPlan | null;
210
+ activeTurnStartedAt: string | null;
211
+ banners: CodexChatRenderBanner[];
212
+ composer: CodexChatComposerRenderState;
213
+ errors: string[];
214
+ interactionMode: CodexChatInteractionMode;
215
+ items: TurnItem[];
216
+ isWorking: boolean;
217
+ optimisticUserMessages: readonly UserMessageTurnItem[];
218
+ pending_dynamic_tool_call_requests: DynamicToolCallRequest[];
219
+ pendingRequests: readonly CodexChatPendingRequest[];
220
+ pendingPermissionRequest: CodexChatPendingPermissionRequest | null;
221
+ pendingUserInputRequest: CodexChatPendingUserInputRequest | null;
222
+ runtimeError: string | null;
223
+ running_turn_ids: string[];
224
+ showPlanFollowUpPrompt: boolean;
225
+ timeline: Omit<MessagesTimelineProps, "listRef" | "onImageExpand" | "onIsAtEndChange">;
226
+ turns: Turn[];
227
+ warnings: string[];
228
+ };
229
+ type CodexChatComposerRenderState = {
230
+ contextWindow: ContextWindowSnapshot | null;
231
+ pendingUserInput: PendingUserInput | null;
232
+ pendingUserInputAdapter: CodexChatPendingUserInputRequest | null;
233
+ };
234
+ type CodexChatRenderBanner = {
235
+ description?: string;
236
+ id: string;
237
+ request?: CodexChatPendingRequest;
238
+ title: string;
239
+ tone?: "destructive";
240
+ variant: "error" | "info" | "success" | "warning";
241
+ };
242
+ declare function createCodexChatRenderState({ interactionMode, lifecycle, snapshot, }: CodexChatRenderStateInput): CodexChatRenderState;
243
+
244
+ type CodexChatViewComposerProps = ComponentPropsWithRef<typeof ChatComposer>;
245
+ type CodexChatComposerCommand = NonNullable<CodexChatViewComposerProps["composerCommands"]>[number];
246
+ type CodexChatComposerCommandName = CodexChatComposerCommand["name"];
247
+ type CodexChatComposerSkill = NonNullable<CodexChatViewComposerProps["composerSkills"]>[number];
248
+ type CodexChatModelOption = NonNullable<CodexChatViewComposerProps["modelOptions"]>[number];
249
+ type CodexChatProviderStatus = ProviderStatus;
250
+ type CodexChatRuntimeMode = ChatComposerRuntimeMode;
251
+ type CodexChatViewManualProps = Omit<ChatViewProps, "composer"> & {
252
+ composer: CodexChatViewComposerProps;
253
+ lifecycle?: never;
254
+ };
255
+ type CodexChatViewLifecycleProps = Omit<ChatViewProps, "composer" | "listRef" | "onControlsChange" | "onIsAtEndChange" | "threadKey" | "timeline" | "title"> & {
256
+ composerCommands?: CodexChatViewComposerProps["composerCommands"];
257
+ composerSkills?: CodexChatViewComposerProps["composerSkills"];
258
+ composerDraftKey?: string;
259
+ composerRef?: RefObject<ChatComposerHandle | null>;
260
+ editorAriaLabel?: string;
261
+ isEnvironmentUnavailable?: boolean;
262
+ defaultInteractionMode?: CodexChatInteractionMode;
263
+ defaultRuntimeMode?: CodexChatRuntimeMode;
264
+ interactionMode?: CodexChatInteractionMode;
265
+ listRef?: RefObject<LegendListRef | null>;
266
+ lifecycle: CodexChatLifecycleOptions;
267
+ mentionRefs?: CodexChatViewComposerProps["mentionRefs"];
268
+ modelOptions?: CodexChatViewComposerProps["modelOptions"];
269
+ placeholder?: string;
270
+ providerStatus?: CodexChatProviderStatus | null;
271
+ realtimeConversation?: CodexChatViewComposerProps["realtimeConversation"];
272
+ renderBannerItems?: (state: CodexChatRenderState) => readonly ComposerBannerStackItem[];
273
+ renderPendingRequest?: (context: CodexChatPendingRequestRenderContext) => ReactNode;
274
+ renderPendingUserInput?: (context: CodexChatPendingUserInputRenderContext) => ReactNode;
275
+ renderTimelineExtras?: (context: {
276
+ state: CodexChatRenderState;
277
+ }) => ReactNode;
278
+ showInteractionModeToggle?: boolean;
279
+ runtimeMode?: CodexChatRuntimeMode;
280
+ showPlanToggle?: boolean;
281
+ planSidebarLabel?: string;
282
+ planSidebarOpen?: boolean;
283
+ onCommand?: CodexChatViewComposerProps["onCommand"];
284
+ onComposerError?: (message: string | null) => void;
285
+ onControlsChange?: (controls: ChatViewRenderComposerControls | null) => void;
286
+ onIsAtEndChange?: (isAtEnd: boolean) => void;
287
+ onImplementProposedPlan?: (plan: CodexChatProposedPlan) => void;
288
+ onInteractionModeChange?: (mode: CodexChatInteractionMode) => void;
289
+ onRuntimeModeChange?: (mode: CodexChatRuntimeMode) => void;
290
+ onTogglePlanSidebar?: () => void;
291
+ threadKey?: string;
292
+ title?: ReactNode;
293
+ };
294
+ type CodexChatViewProps = CodexChatViewLifecycleProps | CodexChatViewManualProps;
295
+ declare function CodexChatView(props: CodexChatViewProps): ReactElement;
296
+
297
+ type CodexChatLifecyclePassthroughProps = Pick<CodexChatLifecycleOptions, "buildThreadStartParams" | "buildTurnStartParams" | "connectOnMount" | "initialState" | "isRecoverableConnectionError" | "onActiveThread" | "onRuntimeError" | "onServerRequest" | "onState" | "onSubmittedUserMessage" | "onThreadListChanged" | "onThreadStarted">;
298
+ type CodexChatProps = Omit<CodexChatViewLifecycleProps, "lifecycle"> & CodexChatLifecyclePassthroughProps & {
299
+ appServer: CodexAppServer;
300
+ threadId: ThreadId | string;
301
+ threadReader?: ThreadReader;
302
+ };
303
+ declare function CodexChat({ appServer, buildThreadStartParams, buildTurnStartParams, connectOnMount, initialState, isRecoverableConnectionError, onActiveThread, onRuntimeError, onServerRequest, onState, onSubmittedUserMessage, onThreadListChanged, onThreadStarted, threadId, threadReader, ...viewProps }: CodexChatProps): React.FunctionComponentElement<CodexChatViewProps>;
304
+
305
+ type CodexChatSidebarProps = ComponentProps<typeof Sidebar>;
306
+ declare function CodexChatSidebar(props: CodexChatSidebarProps): React.FunctionComponentElement<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
307
+ side?: "left" | "right";
308
+ variant?: "sidebar" | "floating" | "inset";
309
+ collapsible?: "offcanvas" | "icon" | "none";
310
+ }>;
311
+ type CodexChatLayoutProps = {
312
+ children: ReactNode;
313
+ sidebar?: ReactNode;
314
+ side?: CodexChatSidebarProps["side"];
315
+ collapsible?: CodexChatSidebarProps["collapsible"];
316
+ defaultOpen?: ComponentProps<typeof SidebarProvider>["defaultOpen"];
317
+ open?: ComponentProps<typeof SidebarProvider>["open"];
318
+ onOpenChange?: ComponentProps<typeof SidebarProvider>["onOpenChange"];
319
+ className?: ComponentProps<typeof SidebarProvider>["className"];
320
+ };
321
+ declare function CodexChatLayout({ children, className, collapsible, defaultOpen, onOpenChange, open, side, sidebar, }: CodexChatLayoutProps): React.FunctionComponentElement<React.FragmentProps> | React.FunctionComponentElement<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
322
+ defaultOpen?: boolean;
323
+ open?: boolean;
324
+ onOpenChange?: (open: boolean) => void;
325
+ }>;
326
+
327
+ type MessagePart = {
328
+ type: "text";
329
+ text: string;
330
+ } | {
331
+ type: "image";
332
+ url: string;
333
+ } | {
334
+ type: "file";
335
+ name?: string;
336
+ url: string;
337
+ } | {
338
+ type: "tool-call";
339
+ input: unknown;
340
+ name: string;
341
+ toolCallId: string;
342
+ } | {
343
+ type: "tool-result";
344
+ output: unknown;
345
+ toolCallId: string;
346
+ };
347
+ type ChatMessage = {
348
+ id: string;
349
+ metadata?: Record<string, unknown>;
350
+ parts: MessagePart[];
351
+ role: "assistant" | "system" | "user";
352
+ };
353
+ type ChatRuntimeStatus = "error" | "idle" | "loading" | "ready" | "streaming" | "submitting";
354
+ type SendMessageInput = {
355
+ files?: FileList | File[] | MessagePart[];
356
+ metadata?: Record<string, unknown>;
357
+ text?: string;
358
+ };
359
+ type ChatRuntime = {
360
+ error: Error | null;
361
+ messages: ChatMessage[];
362
+ sendMessage(input: SendMessageInput): Promise<void>;
363
+ setThread(threadId: ThreadId | string | null): void;
364
+ status: ChatRuntimeStatus;
365
+ stop(): Promise<void>;
366
+ threadId: ThreadId | string | null;
367
+ threadSnapshot: ThreadEventSnapshot | null;
368
+ threadState: CodexChatRenderState | null;
369
+ };
370
+ type CodexChatRuntimeOptions = {
371
+ appServer: CodexAppServer;
372
+ threadReader?: ThreadReader;
373
+ threadId?: ThreadId | string;
374
+ };
375
+ type CodexChatProviderProps = CodexChatRuntimeOptions & {
376
+ children?: ReactNode;
377
+ };
378
+ declare function CodexChatProvider({ appServer, children, threadReader, threadId, }: CodexChatProviderProps): React.FunctionComponentElement<React.ProviderProps<ChatRuntime | null>>;
379
+ declare function useCodexChatRuntime(): ChatRuntime;
380
+ declare function useCodexChat(options: CodexChatRuntimeOptions): ChatRuntime;
381
+
382
+ export { type CodexChatProposedPlan as A, type CodexChatProviderStatus as B, CodexChat as C, type CodexChatRenderState as D, type CodexChatRuntimeMode as E, type CodexChatRuntimeOptions as F, type CodexChatViewComposerProps as G, type CodexChatViewLifecycleProps as H, type CodexChatViewManualProps as I, createCodexChatRenderState as J, createDefaultThreadStartParams as K, createDefaultTurnStartParams as L, type MessagePart as M, useCodexChat as N, useCodexChatLifecycle as O, useCodexChatRuntime as P, type SendMessageInput as S, type ThreadReader as T, CodexChatLayout as a, type CodexChatLayoutProps as b, type CodexChatProps as c, CodexChatProvider as d, type CodexChatProviderProps as e, CodexChatSidebar as f, type CodexChatSidebarProps as g, CodexChatView as h, type CodexChatViewProps as i, type ChatMessage as j, type ChatRuntime as k, type ChatRuntimeStatus as l, type CodexChatComposerCommand as m, type CodexChatComposerCommandName as n, type CodexChatComposerSkill as o, type CodexChatInteractionMode as p, type CodexChatLifecycle as q, type CodexChatLifecycleBuildThreadStartParamsInput as r, type CodexChatLifecycleBuildTurnStartParamsInput as s, type CodexChatLifecycleOptions as t, type CodexChatLifecycleSendControls as u, type CodexChatLifecycleSendOptions as v, type CodexChatModelOption as w, type CodexChatPendingRequest as x, type CodexChatPendingRequestRenderContext as y, type CodexChatPendingUserInputRenderContext as z };