@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,3 @@
1
+
2
+ //# sourceMappingURL=chunk-ZX5OIIJX.js.map
3
+ //# sourceMappingURL=chunk-ZX5OIIJX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-ZX5OIIJX.js"}
@@ -0,0 +1,111 @@
1
+ import { R as Result } from '../session-BO6EZNK7.js';
2
+ export { A as AppServerEvent, a as AppServerRequestHandle, b as AppServerSession, c as ClientRequest, C as CodexAppServer, I as InitializeParams, d as InitializeResponse, T as TypedRequestError, r as requestMethodName, e as requestTyped, s as serverNotificationRequiresDelivery } from '../session-BO6EZNK7.js';
3
+ import { E as ExecPolicyAmendment, N as NetworkPolicyAmendment, j as AdditionalNetworkPermissions, k as AdditionalFileSystemPermissions, J as JsonValue, a as ServerRequest, l as RequestId } from '../thread_event_store-BIS0qzhi.js';
4
+ export { S as ServerNotification, m as ThreadEventSnapshot, n as ThreadEventStore, o as ThreadTokenUsageSnapshot, s as serverNotificationThreadTarget, p as serverRequestThreadId, t as threadEventSnapshotHasStarted } from '../thread_event_store-BIS0qzhi.js';
5
+ export { a as CodexAppServerClientConnectionStatus, C as CodexAppServerClientOptions, b as CodexAppServerClientTransportError, c as createCodexAppServerClient, p as parseCodexAppServerEvent } from '../remote-DMPfepa9.js';
6
+ import { D as DynamicToolCallResponse } from '../DynamicToolCallResponse-D2OVpa4p.js';
7
+ import { T as ToolRequestUserInputResponse } from '../ToolRequestUserInputResponse-Bxjlpgho.js';
8
+
9
+ type CommandExecutionApprovalDecision = "accept" | "acceptForSession" | {
10
+ "acceptWithExecpolicyAmendment": {
11
+ execpolicy_amendment: ExecPolicyAmendment;
12
+ };
13
+ } | {
14
+ "applyNetworkPolicyAmendment": {
15
+ network_policy_amendment: NetworkPolicyAmendment;
16
+ };
17
+ } | "decline" | "cancel";
18
+
19
+ type CommandExecutionRequestApprovalResponse = {
20
+ decision: CommandExecutionApprovalDecision;
21
+ };
22
+
23
+ type FileChangeApprovalDecision = "accept" | "acceptForSession" | "decline" | "cancel";
24
+
25
+ type FileChangeRequestApprovalResponse = {
26
+ decision: FileChangeApprovalDecision;
27
+ };
28
+
29
+ type GrantedPermissionProfile = {
30
+ network?: AdditionalNetworkPermissions;
31
+ fileSystem?: AdditionalFileSystemPermissions;
32
+ };
33
+
34
+ type McpServerElicitationAction = "accept" | "decline" | "cancel";
35
+
36
+ type McpServerElicitationRequestResponse = {
37
+ action: McpServerElicitationAction;
38
+ /**
39
+ * Structured user input for accepted elicitations, mirroring RMCP `CreateElicitationResult`.
40
+ *
41
+ * This is nullable because decline/cancel responses have no content.
42
+ */
43
+ content: JsonValue | null;
44
+ /**
45
+ * Optional client metadata for form-mode action handling.
46
+ */
47
+ _meta: JsonValue | null;
48
+ };
49
+
50
+ type PermissionGrantScope = "turn" | "session";
51
+
52
+ type PermissionsRequestApprovalResponse = {
53
+ permissions: GrantedPermissionProfile;
54
+ scope: PermissionGrantScope;
55
+ /**
56
+ * Review every subsequent command in this turn before normal sandboxed execution.
57
+ */
58
+ strictAutoReview?: boolean;
59
+ };
60
+
61
+ type AppServerRequestResolution = {
62
+ requestId: RequestId;
63
+ result: Result;
64
+ };
65
+ type UnsupportedAppServerRequest = {
66
+ message: string;
67
+ requestId: RequestId;
68
+ };
69
+ type ResolvedAppServerRequest = {
70
+ id: string;
71
+ type: "exec_approval";
72
+ } | {
73
+ id: string;
74
+ type: "file_change_approval";
75
+ } | {
76
+ id: string;
77
+ type: "permissions_approval";
78
+ } | {
79
+ itemId: string;
80
+ type: "user_input";
81
+ } | {
82
+ requestId: RequestId;
83
+ serverName: string;
84
+ type: "mcp_elicitation";
85
+ } | {
86
+ callId: string;
87
+ type: "dynamic_tool_call";
88
+ };
89
+ declare class PendingAppServerRequests {
90
+ private readonly dynamicToolCalls;
91
+ private readonly execApprovals;
92
+ private readonly fileChangeApprovals;
93
+ private readonly mcpRequests;
94
+ private readonly permissionsApprovals;
95
+ private readonly userInputs;
96
+ clear(): void;
97
+ noteServerRequest(request: ServerRequest): UnsupportedAppServerRequest | null;
98
+ takeCommandExecutionApprovalResolution(id: string, response: CommandExecutionRequestApprovalResponse): AppServerRequestResolution | null;
99
+ takeFileChangeApprovalResolution(id: string, response: FileChangeRequestApprovalResponse): AppServerRequestResolution | null;
100
+ takePermissionsApprovalResolution(id: string, response: PermissionsRequestApprovalResponse): AppServerRequestResolution | null;
101
+ takeDynamicToolCallResolution(callId: string, response: DynamicToolCallResponse): AppServerRequestResolution | null;
102
+ takeUserInputResolution(turnId: string, response: ToolRequestUserInputResponse): AppServerRequestResolution | null;
103
+ takeMcpElicitationResolution(serverName: string, requestId: RequestId, response: McpServerElicitationRequestResponse): AppServerRequestResolution | null;
104
+ resolveNotification(requestId: RequestId): ResolvedAppServerRequest | null;
105
+ containsServerRequest(request: ServerRequest): boolean;
106
+ private requestIds;
107
+ private popUserInputRequestForTurn;
108
+ private removeUserInputRequest;
109
+ }
110
+
111
+ export { PendingAppServerRequests, RequestId, ServerRequest };
@@ -0,0 +1,4 @@
1
+ import '../chunk-ZX5OIIJX.js';
2
+ export { AppServerSession, CodexAppServerClientTransportError, PendingAppServerRequests, ThreadEventStore, createCodexAppServerClient, parseCodexAppServerEvent, requestMethodName, requestTyped, serverNotificationRequiresDelivery, serverNotificationThreadTarget, serverRequestThreadId, threadEventSnapshotHasStarted } from '../chunk-TZBLUZ2X.js';
3
+ //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,15 @@
1
+ export { C as CodexChat, a as CodexChatLayout, b as CodexChatLayoutProps, c as CodexChatProps, d as CodexChatProvider, e as CodexChatProviderProps, f as CodexChatSidebar, g as CodexChatSidebarProps, h as CodexChatView, i as CodexChatViewProps } from './chat-runtime-CMli5dzJ.js';
2
+ export { S as ServerNotification, a as ServerRequest } from './thread_event_store-BIS0qzhi.js';
3
+ export { C as CodexAppServerClientOptions, c as createCodexAppServerClient } from './remote-DMPfepa9.js';
4
+ export { C as CodexAppServer } from './session-BO6EZNK7.js';
5
+ import 'react';
6
+ import '@legendapp/list/react';
7
+ import './ToolRequestUserInputResponse-Bxjlpgho.js';
8
+ import 'zustand/middleware';
9
+ import 'zustand';
10
+ import './sidebar-DT2XoitN.js';
11
+ import 'class-variance-authority/types';
12
+ import 'react/jsx-runtime';
13
+ import 'class-variance-authority';
14
+ import 'radix-ui';
15
+ import './store-H2cQxdpe.js';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import './chunk-ZX5OIIJX.js';
2
+ export { CodexChat, CodexChatLayout, CodexChatProvider, CodexChatSidebar, CodexChatView } from './chunk-FFASNDXU.js';
3
+ import './chunk-FN3SWHRH.js';
4
+ export { createCodexAppServerClient } from './chunk-TZBLUZ2X.js';
5
+ //# sourceMappingURL=index.js.map
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,74 @@
1
+ import { M as MentionBinding } from '../chat-runtime-CMli5dzJ.js';
2
+ export { j as ChatComposerHandle, k as ChatComposerSubmitPayload, l as ChatMessage, m as ChatRuntime, n as ChatRuntimeStatus, C as CodexChat, o as CodexChatComposerCommand, p as CodexChatComposerCommandName, q as CodexChatComposerSkill, r as CodexChatInteractionMode, a as CodexChatLayout, b as CodexChatLayoutProps, s as CodexChatLifecycle, t as CodexChatLifecycleOptions, u as CodexChatModelOption, v as CodexChatPendingRequest, w as CodexChatPendingRequestRenderContext, x as CodexChatPendingUserInputRenderContext, y as CodexChatProposedPlan, c as CodexChatProps, d as CodexChatProvider, e as CodexChatProviderProps, z as CodexChatProviderStatus, A as CodexChatRenderState, B as CodexChatRuntimeMode, D as CodexChatRuntimeOptions, f as CodexChatSidebar, g as CodexChatSidebarProps, h as CodexChatView, E as CodexChatViewComposerProps, F as CodexChatViewLifecycleProps, G as CodexChatViewManualProps, i as CodexChatViewProps, H as CodexChatViewRenderComposerControls, I as CodexModelOption, J as CodexReasoningEffort, K as CodexReasoningEffortOption, L as ComposerDraftKey, N as ComposerDraftState, O as ComposerImageAttachment, P as ComposerImageValidationResult, Q as ExpandedImagePreview, R as MentionBindingRange, S as MessagePart, T as PersistedComposerDraftImageAttachment, U as ProviderDriverKind, V as ProviderInstanceEntry, W as ProviderInstanceId, X as RealtimeConversationControlState, Y as RealtimeConversationPhase, Z as RealtimeConversationUiState, _ as RecordingMeterState, $ as SendMessageInput, a0 as ThreadReader, a1 as WORKSPACE_CHAT_MAX_IMAGE_ATTACHMENTS, a2 as WORKSPACE_CHAT_MAX_IMAGE_BYTES, a3 as assistantComposerDraftKey, a4 as buildExpandedImagePreview, a5 as codexModelOptions, a6 as codexReasoningEffortOptions, a7 as createCodexChatRenderState, a8 as createComposerImageAttachments, a9 as createDefaultTurnStartParams, aa as defaultCodexModel, ab as defaultCodexProviderInstance, ac as defaultCodexReasoningEffort, ad as getRealtimeConversationControlState, ae as isAcceptedComposerImageFile, af as isCodexReasoningEffort, ag as isRealtimeConversationLive, ah as mentionBindingRangesForText, ai as mentionBindingsAfterReplacement, aj as normalizeMentionBindingsForText, ak as persistComposerDraftAttachments, al as resolveCodexModelOption, am as resolveCodexReasoningEffortForModel, an as resolveCodexReasoningEffortOption, ao as resolveDraftEffort, ap as resolveDraftModel, aq as restoreComposerDraftAttachments, ar as revokeComposerImageAttachments, as as useCodexChat, at as useCodexChatLifecycle, au as useCodexChatRuntime, av as useComposerDraftStore, aw as useComposerThreadDraft, ax as validateComposerImageFiles } from '../chat-runtime-CMli5dzJ.js';
3
+ import * as React from 'react';
4
+ import { ReactNode } from 'react';
5
+ import { i as TextElement } from '../thread_event_store-BIS0qzhi.js';
6
+ import '@legendapp/list/react';
7
+ import '../session-BO6EZNK7.js';
8
+ import '../ToolRequestUserInputResponse-Bxjlpgho.js';
9
+ import 'zustand/middleware';
10
+ import 'zustand';
11
+ import '../sidebar-DT2XoitN.js';
12
+ import 'class-variance-authority/types';
13
+ import 'react/jsx-runtime';
14
+ import 'class-variance-authority';
15
+ import 'radix-ui';
16
+ import '../store-H2cQxdpe.js';
17
+
18
+ type LinkedMention = {
19
+ mention: string;
20
+ path: string;
21
+ };
22
+ type DecodedHistoryText = {
23
+ mentions: LinkedMention[];
24
+ text: string;
25
+ };
26
+ type LinkedMentionRange = {
27
+ end: number;
28
+ mention: string;
29
+ path: string;
30
+ placeholder: string;
31
+ start: number;
32
+ };
33
+ declare function encodeHistoryMentions(text: string, bindings: readonly MentionBinding[]): string;
34
+ declare function decodeHistoryMentions(text: string): DecodedHistoryText;
35
+ declare function findLinkedMentions(text: string): LinkedMentionRange[];
36
+ declare function linkedMentionTextElements(text: string): TextElement[];
37
+
38
+ declare const PROJECT_MENTION_SIGIL = "@";
39
+ declare const SKILL_MENTION_SIGIL = "$";
40
+ declare const TOOL_MENTION_SIGIL = "@";
41
+ declare function mentionToken(name: string): string;
42
+ declare function skillToken(name: string): string;
43
+
44
+ declare function proposedPlanTitle(planMarkdown: string): string | null;
45
+ declare function stripDisplayedPlanMarkdown(planMarkdown: string): string;
46
+ declare function buildCollapsedProposedPlanPreviewMarkdown(planMarkdown: string, options?: {
47
+ maxLines?: number;
48
+ }): string;
49
+ declare function buildPlanImplementationPrompt(planMarkdown: string): string;
50
+ declare function resolvePlanFollowUpSubmission(input: {
51
+ draftText: string;
52
+ planMarkdown: string;
53
+ }): {
54
+ interactionMode: "default" | "plan";
55
+ text: string;
56
+ };
57
+ declare function buildPlanImplementationThreadTitle(planMarkdown: string): string;
58
+ declare function buildProposedPlanMarkdownFilename(planMarkdown: string): string;
59
+ declare function normalizePlanMarkdownForExport(planMarkdown: string): string;
60
+
61
+ declare function CodexThread({ children }: {
62
+ children?: ReactNode;
63
+ }): React.ReactElement<{
64
+ "data-codex-thread": string;
65
+ }, string | React.JSXElementConstructor<any>>;
66
+ declare function CodexMessages(): React.ReactElement<{
67
+ "data-codex-messages": string;
68
+ }, string | React.JSXElementConstructor<any>>;
69
+ declare function CodexComposer(): React.ReactElement<{
70
+ action: (formData: FormData) => Promise<void>;
71
+ "data-codex-composer": string;
72
+ }, string | React.JSXElementConstructor<any>>;
73
+
74
+ export { CodexComposer, CodexMessages, CodexThread, type LinkedMention, type LinkedMentionRange, MentionBinding, PROJECT_MENTION_SIGIL, SKILL_MENTION_SIGIL, TOOL_MENTION_SIGIL, buildCollapsedProposedPlanPreviewMarkdown, buildPlanImplementationPrompt, buildPlanImplementationThreadTitle, buildProposedPlanMarkdownFilename, decodeHistoryMentions, encodeHistoryMentions, findLinkedMentions, linkedMentionTextElements, mentionToken, normalizePlanMarkdownForExport, proposedPlanTitle, resolvePlanFollowUpSubmission, skillToken, stripDisplayedPlanMarkdown };
@@ -0,0 +1,5 @@
1
+ export { CodexChat, CodexChatLayout, CodexChatProvider, CodexChatSidebar, CodexChatView, CodexComposer, CodexMessages, CodexThread, PROJECT_MENTION_SIGIL, RecordingMeterState, SKILL_MENTION_SIGIL, TOOL_MENTION_SIGIL, WORKSPACE_CHAT_MAX_IMAGE_ATTACHMENTS, WORKSPACE_CHAT_MAX_IMAGE_BYTES, assistantComposerDraftKey, buildCollapsedProposedPlanPreviewMarkdown, buildExpandedImagePreview, buildPlanImplementationPrompt, buildPlanImplementationThreadTitle, buildProposedPlanMarkdownFilename, codexModelOptions, codexReasoningEffortOptions, createCodexChatRenderState, createComposerImageAttachments, createDefaultTurnStartParams, decodeHistoryMentions, defaultCodexModel, defaultCodexProviderInstance, defaultCodexReasoningEffort, encodeHistoryMentions, findLinkedMentions, getRealtimeConversationControlState, isAcceptedComposerImageFile, isCodexReasoningEffort, isRealtimeConversationLive, linkedMentionTextElements, mentionBindingRangesForText, mentionBindingsAfterReplacement, mentionToken, normalizeMentionBindingsForText, normalizePlanMarkdownForExport, persistComposerDraftAttachments, proposedPlanTitle, resolveCodexModelOption, resolveCodexReasoningEffortForModel, resolveCodexReasoningEffortOption, resolveDraftEffort, resolveDraftModel, resolvePlanFollowUpSubmission, restoreComposerDraftAttachments, revokeComposerImageAttachments, skillToken, stripDisplayedPlanMarkdown, useCodexChat, useCodexChatLifecycle, useCodexChatRuntime, useComposerDraftStore, useComposerThreadDraft, validateComposerImageFiles } from '../chunk-FFASNDXU.js';
2
+ import '../chunk-FN3SWHRH.js';
3
+ import '../chunk-TZBLUZ2X.js';
4
+ //# sourceMappingURL=index.js.map
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,19 @@
1
+ import { I as InitializeParams, A as AppServerEvent, C as CodexAppServer } from './session-BO6EZNK7.js';
2
+
3
+ type CodexAppServerClientConnectionStatus = "connecting" | "connected" | "closed" | "error";
4
+ type CodexAppServerClientOptions = {
5
+ WebSocket?: typeof WebSocket;
6
+ initializeParams?: InitializeParams | (() => InitializeParams | Promise<InitializeParams>);
7
+ onConnectionStatus?: (status: CodexAppServerClientConnectionStatus) => void;
8
+ parseEvent?: (value: unknown) => AppServerEvent | null;
9
+ url: string | (() => string | Promise<string>);
10
+ };
11
+ declare class CodexAppServerClientTransportError extends Error {
12
+ readonly status?: number | undefined;
13
+ readonly body?: unknown | undefined;
14
+ constructor(message: string, status?: number | undefined, body?: unknown | undefined);
15
+ }
16
+ declare function createCodexAppServerClient(options: CodexAppServerClientOptions): CodexAppServer;
17
+ declare function parseCodexAppServerEvent(value: unknown): AppServerEvent | null;
18
+
19
+ export { type CodexAppServerClientOptions as C, type CodexAppServerClientConnectionStatus as a, CodexAppServerClientTransportError as b, createCodexAppServerClient as c, parseCodexAppServerEvent as p };