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