better-codex 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.
- package/README.md +26 -0
- package/apps/backend/README.md +46 -0
- package/apps/backend/bun.lock +64 -0
- package/apps/backend/package.json +18 -0
- package/apps/backend/scripts/generate-protocol.ts +32 -0
- package/apps/backend/src/analytics/service.ts +219 -0
- package/apps/backend/src/analytics/store.ts +284 -0
- package/apps/backend/src/config.ts +98 -0
- package/apps/backend/src/core/app-server.ts +131 -0
- package/apps/backend/src/core/jsonrpc.ts +166 -0
- package/apps/backend/src/protocol/AbsolutePathBuf.ts +14 -0
- package/apps/backend/src/protocol/AddConversationListenerParams.ts +6 -0
- package/apps/backend/src/protocol/AddConversationSubscriptionResponse.ts +5 -0
- package/apps/backend/src/protocol/AgentMessageContent.ts +5 -0
- package/apps/backend/src/protocol/AgentMessageContentDeltaEvent.ts +5 -0
- package/apps/backend/src/protocol/AgentMessageDeltaEvent.ts +5 -0
- package/apps/backend/src/protocol/AgentMessageEvent.ts +5 -0
- package/apps/backend/src/protocol/AgentMessageItem.ts +6 -0
- package/apps/backend/src/protocol/AgentReasoningDeltaEvent.ts +5 -0
- package/apps/backend/src/protocol/AgentReasoningEvent.ts +5 -0
- package/apps/backend/src/protocol/AgentReasoningRawContentDeltaEvent.ts +5 -0
- package/apps/backend/src/protocol/AgentReasoningRawContentEvent.ts +5 -0
- package/apps/backend/src/protocol/AgentReasoningSectionBreakEvent.ts +5 -0
- package/apps/backend/src/protocol/Annotations.ts +9 -0
- package/apps/backend/src/protocol/ApplyPatchApprovalParams.ts +21 -0
- package/apps/backend/src/protocol/ApplyPatchApprovalRequestEvent.ts +23 -0
- package/apps/backend/src/protocol/ApplyPatchApprovalResponse.ts +6 -0
- package/apps/backend/src/protocol/ArchiveConversationParams.ts +6 -0
- package/apps/backend/src/protocol/ArchiveConversationResponse.ts +5 -0
- package/apps/backend/src/protocol/AskForApproval.ts +9 -0
- package/apps/backend/src/protocol/AudioContent.ts +9 -0
- package/apps/backend/src/protocol/AuthMode.ts +5 -0
- package/apps/backend/src/protocol/AuthStatusChangeNotification.ts +9 -0
- package/apps/backend/src/protocol/BackgroundEventEvent.ts +5 -0
- package/apps/backend/src/protocol/BlobResourceContents.ts +5 -0
- package/apps/backend/src/protocol/CallToolResult.ts +10 -0
- package/apps/backend/src/protocol/CancelLoginChatGptParams.ts +5 -0
- package/apps/backend/src/protocol/CancelLoginChatGptResponse.ts +5 -0
- package/apps/backend/src/protocol/ClientInfo.ts +5 -0
- package/apps/backend/src/protocol/ClientNotification.ts +5 -0
- package/apps/backend/src/protocol/ClientRequest.ts +46 -0
- package/apps/backend/src/protocol/CodexErrorInfo.ts +8 -0
- package/apps/backend/src/protocol/ContentBlock.ts +10 -0
- package/apps/backend/src/protocol/ContentItem.ts +5 -0
- package/apps/backend/src/protocol/ContextCompactedEvent.ts +5 -0
- package/apps/backend/src/protocol/ConversationGitInfo.ts +5 -0
- package/apps/backend/src/protocol/ConversationId.ts +5 -0
- package/apps/backend/src/protocol/ConversationSummary.ts +8 -0
- package/apps/backend/src/protocol/CreditsSnapshot.ts +5 -0
- package/apps/backend/src/protocol/CustomPrompt.ts +5 -0
- package/apps/backend/src/protocol/DeprecationNoticeEvent.ts +13 -0
- package/apps/backend/src/protocol/ElicitationRequestEvent.ts +6 -0
- package/apps/backend/src/protocol/EmbeddedResource.ts +13 -0
- package/apps/backend/src/protocol/EmbeddedResourceResource.ts +7 -0
- package/apps/backend/src/protocol/ErrorEvent.ts +6 -0
- package/apps/backend/src/protocol/EventMsg.ts +60 -0
- package/apps/backend/src/protocol/ExecApprovalRequestEvent.ts +32 -0
- package/apps/backend/src/protocol/ExecCommandApprovalParams.ts +12 -0
- package/apps/backend/src/protocol/ExecCommandApprovalResponse.ts +6 -0
- package/apps/backend/src/protocol/ExecCommandBeginEvent.ts +35 -0
- package/apps/backend/src/protocol/ExecCommandEndEvent.ts +59 -0
- package/apps/backend/src/protocol/ExecCommandOutputDeltaEvent.ts +18 -0
- package/apps/backend/src/protocol/ExecCommandSource.ts +5 -0
- package/apps/backend/src/protocol/ExecOneOffCommandParams.ts +6 -0
- package/apps/backend/src/protocol/ExecOneOffCommandResponse.ts +5 -0
- package/apps/backend/src/protocol/ExecOutputStream.ts +5 -0
- package/apps/backend/src/protocol/ExecPolicyAmendment.ts +12 -0
- package/apps/backend/src/protocol/ExitedReviewModeEvent.ts +6 -0
- package/apps/backend/src/protocol/FileChange.ts +5 -0
- package/apps/backend/src/protocol/ForcedLoginMethod.ts +5 -0
- package/apps/backend/src/protocol/FunctionCallOutputContentItem.ts +9 -0
- package/apps/backend/src/protocol/FunctionCallOutputPayload.ts +15 -0
- package/apps/backend/src/protocol/FuzzyFileSearchParams.ts +5 -0
- package/apps/backend/src/protocol/FuzzyFileSearchResponse.ts +6 -0
- package/apps/backend/src/protocol/FuzzyFileSearchResult.ts +8 -0
- package/apps/backend/src/protocol/GetAuthStatusParams.ts +5 -0
- package/apps/backend/src/protocol/GetAuthStatusResponse.ts +6 -0
- package/apps/backend/src/protocol/GetConversationSummaryParams.ts +6 -0
- package/apps/backend/src/protocol/GetConversationSummaryResponse.ts +6 -0
- package/apps/backend/src/protocol/GetHistoryEntryResponseEvent.ts +10 -0
- package/apps/backend/src/protocol/GetUserAgentResponse.ts +5 -0
- package/apps/backend/src/protocol/GetUserSavedConfigResponse.ts +6 -0
- package/apps/backend/src/protocol/GhostCommit.ts +8 -0
- package/apps/backend/src/protocol/GitDiffToRemoteParams.ts +5 -0
- package/apps/backend/src/protocol/GitDiffToRemoteResponse.ts +6 -0
- package/apps/backend/src/protocol/GitSha.ts +5 -0
- package/apps/backend/src/protocol/HistoryEntry.ts +5 -0
- package/apps/backend/src/protocol/ImageContent.ts +9 -0
- package/apps/backend/src/protocol/InitializeParams.ts +6 -0
- package/apps/backend/src/protocol/InitializeResponse.ts +5 -0
- package/apps/backend/src/protocol/InputItem.ts +5 -0
- package/apps/backend/src/protocol/InterruptConversationParams.ts +6 -0
- package/apps/backend/src/protocol/InterruptConversationResponse.ts +6 -0
- package/apps/backend/src/protocol/ItemCompletedEvent.ts +7 -0
- package/apps/backend/src/protocol/ItemStartedEvent.ts +7 -0
- package/apps/backend/src/protocol/ListConversationsParams.ts +5 -0
- package/apps/backend/src/protocol/ListConversationsResponse.ts +6 -0
- package/apps/backend/src/protocol/ListCustomPromptsResponseEvent.ts +9 -0
- package/apps/backend/src/protocol/ListSkillsResponseEvent.ts +9 -0
- package/apps/backend/src/protocol/LocalShellAction.ts +6 -0
- package/apps/backend/src/protocol/LocalShellExecAction.ts +5 -0
- package/apps/backend/src/protocol/LocalShellStatus.ts +5 -0
- package/apps/backend/src/protocol/LoginApiKeyParams.ts +5 -0
- package/apps/backend/src/protocol/LoginApiKeyResponse.ts +5 -0
- package/apps/backend/src/protocol/LoginChatGptCompleteNotification.ts +8 -0
- package/apps/backend/src/protocol/LoginChatGptResponse.ts +5 -0
- package/apps/backend/src/protocol/LogoutChatGptResponse.ts +5 -0
- package/apps/backend/src/protocol/McpAuthStatus.ts +5 -0
- package/apps/backend/src/protocol/McpInvocation.ts +18 -0
- package/apps/backend/src/protocol/McpListToolsResponseEvent.ts +25 -0
- package/apps/backend/src/protocol/McpStartupCompleteEvent.ts +6 -0
- package/apps/backend/src/protocol/McpStartupFailure.ts +5 -0
- package/apps/backend/src/protocol/McpStartupStatus.ts +5 -0
- package/apps/backend/src/protocol/McpStartupUpdateEvent.ts +14 -0
- package/apps/backend/src/protocol/McpToolCallBeginEvent.ts +10 -0
- package/apps/backend/src/protocol/McpToolCallEndEvent.ts +15 -0
- package/apps/backend/src/protocol/NetworkAccess.ts +8 -0
- package/apps/backend/src/protocol/NewConversationParams.ts +8 -0
- package/apps/backend/src/protocol/NewConversationResponse.ts +7 -0
- package/apps/backend/src/protocol/ParsedCommand.ts +12 -0
- package/apps/backend/src/protocol/PatchApplyBeginEvent.ts +23 -0
- package/apps/backend/src/protocol/PatchApplyEndEvent.ts +31 -0
- package/apps/backend/src/protocol/PlanItemArg.ts +6 -0
- package/apps/backend/src/protocol/PlanType.ts +5 -0
- package/apps/backend/src/protocol/Profile.ts +9 -0
- package/apps/backend/src/protocol/README.md +11 -0
- package/apps/backend/src/protocol/RateLimitSnapshot.ts +8 -0
- package/apps/backend/src/protocol/RateLimitWindow.ts +17 -0
- package/apps/backend/src/protocol/RawResponseItemEvent.ts +6 -0
- package/apps/backend/src/protocol/ReasoningContentDeltaEvent.ts +5 -0
- package/apps/backend/src/protocol/ReasoningEffort.ts +8 -0
- package/apps/backend/src/protocol/ReasoningItem.ts +5 -0
- package/apps/backend/src/protocol/ReasoningItemContent.ts +5 -0
- package/apps/backend/src/protocol/ReasoningItemReasoningSummary.ts +5 -0
- package/apps/backend/src/protocol/ReasoningRawContentDeltaEvent.ts +5 -0
- package/apps/backend/src/protocol/ReasoningSummary.ts +10 -0
- package/apps/backend/src/protocol/RemoveConversationListenerParams.ts +5 -0
- package/apps/backend/src/protocol/RemoveConversationSubscriptionResponse.ts +5 -0
- package/apps/backend/src/protocol/RequestId.ts +5 -0
- package/apps/backend/src/protocol/Resource.ts +9 -0
- package/apps/backend/src/protocol/ResourceLink.ts +11 -0
- package/apps/backend/src/protocol/ResourceTemplate.ts +9 -0
- package/apps/backend/src/protocol/ResponseItem.ts +17 -0
- package/apps/backend/src/protocol/ResumeConversationParams.ts +8 -0
- package/apps/backend/src/protocol/ResumeConversationResponse.ts +7 -0
- package/apps/backend/src/protocol/ReviewCodeLocation.ts +9 -0
- package/apps/backend/src/protocol/ReviewDecision.ts +9 -0
- package/apps/backend/src/protocol/ReviewFinding.ts +9 -0
- package/apps/backend/src/protocol/ReviewLineRange.ts +8 -0
- package/apps/backend/src/protocol/ReviewOutputEvent.ts +9 -0
- package/apps/backend/src/protocol/ReviewRequest.ts +9 -0
- package/apps/backend/src/protocol/ReviewTarget.ts +9 -0
- package/apps/backend/src/protocol/Role.ts +8 -0
- package/apps/backend/src/protocol/SandboxMode.ts +5 -0
- package/apps/backend/src/protocol/SandboxPolicy.ts +35 -0
- package/apps/backend/src/protocol/SandboxSettings.ts +6 -0
- package/apps/backend/src/protocol/SendUserMessageParams.ts +7 -0
- package/apps/backend/src/protocol/SendUserMessageResponse.ts +5 -0
- package/apps/backend/src/protocol/SendUserTurnParams.ts +11 -0
- package/apps/backend/src/protocol/SendUserTurnResponse.ts +5 -0
- package/apps/backend/src/protocol/ServerNotification.ts +36 -0
- package/apps/backend/src/protocol/ServerRequest.ts +13 -0
- package/apps/backend/src/protocol/SessionConfiguredEvent.ts +48 -0
- package/apps/backend/src/protocol/SessionConfiguredNotification.ts +8 -0
- package/apps/backend/src/protocol/SessionSource.ts +6 -0
- package/apps/backend/src/protocol/SetDefaultModelParams.ts +6 -0
- package/apps/backend/src/protocol/SetDefaultModelResponse.ts +5 -0
- package/apps/backend/src/protocol/SkillErrorInfo.ts +5 -0
- package/apps/backend/src/protocol/SkillMetadata.ts +6 -0
- package/apps/backend/src/protocol/SkillScope.ts +5 -0
- package/apps/backend/src/protocol/SkillsListEntry.ts +7 -0
- package/apps/backend/src/protocol/StepStatus.ts +5 -0
- package/apps/backend/src/protocol/StreamErrorEvent.ts +6 -0
- package/apps/backend/src/protocol/SubAgentSource.ts +5 -0
- package/apps/backend/src/protocol/TaskCompleteEvent.ts +5 -0
- package/apps/backend/src/protocol/TaskStartedEvent.ts +5 -0
- package/apps/backend/src/protocol/TerminalInteractionEvent.ts +17 -0
- package/apps/backend/src/protocol/TextContent.ts +9 -0
- package/apps/backend/src/protocol/TextResourceContents.ts +5 -0
- package/apps/backend/src/protocol/TokenCountEvent.ts +7 -0
- package/apps/backend/src/protocol/TokenUsage.ts +5 -0
- package/apps/backend/src/protocol/TokenUsageInfo.ts +6 -0
- package/apps/backend/src/protocol/Tool.ts +11 -0
- package/apps/backend/src/protocol/ToolAnnotations.ts +15 -0
- package/apps/backend/src/protocol/ToolInputSchema.ts +9 -0
- package/apps/backend/src/protocol/ToolOutputSchema.ts +10 -0
- package/apps/backend/src/protocol/Tools.ts +5 -0
- package/apps/backend/src/protocol/TurnAbortReason.ts +5 -0
- package/apps/backend/src/protocol/TurnAbortedEvent.ts +6 -0
- package/apps/backend/src/protocol/TurnDiffEvent.ts +5 -0
- package/apps/backend/src/protocol/TurnItem.ts +9 -0
- package/apps/backend/src/protocol/UndoCompletedEvent.ts +5 -0
- package/apps/backend/src/protocol/UndoStartedEvent.ts +5 -0
- package/apps/backend/src/protocol/UpdatePlanArgs.ts +6 -0
- package/apps/backend/src/protocol/UserInfoResponse.ts +5 -0
- package/apps/backend/src/protocol/UserInput.ts +8 -0
- package/apps/backend/src/protocol/UserMessageEvent.ts +5 -0
- package/apps/backend/src/protocol/UserMessageItem.ts +6 -0
- package/apps/backend/src/protocol/UserSavedConfig.ts +14 -0
- package/apps/backend/src/protocol/Verbosity.ts +9 -0
- package/apps/backend/src/protocol/ViewImageToolCallEvent.ts +13 -0
- package/apps/backend/src/protocol/WarningEvent.ts +5 -0
- package/apps/backend/src/protocol/WebSearchAction.ts +5 -0
- package/apps/backend/src/protocol/WebSearchBeginEvent.ts +5 -0
- package/apps/backend/src/protocol/WebSearchEndEvent.ts +5 -0
- package/apps/backend/src/protocol/WebSearchItem.ts +5 -0
- package/apps/backend/src/protocol/index.ts +198 -0
- package/apps/backend/src/protocol/serde_json/JsonValue.ts +5 -0
- package/apps/backend/src/protocol/v2/Account.ts +6 -0
- package/apps/backend/src/protocol/v2/AccountLoginCompletedNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/AccountRateLimitsUpdatedNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/AccountUpdatedNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/AgentMessageDeltaNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/ApprovalDecision.ts +6 -0
- package/apps/backend/src/protocol/v2/AskForApproval.ts +5 -0
- package/apps/backend/src/protocol/v2/CancelLoginAccountParams.ts +5 -0
- package/apps/backend/src/protocol/v2/CancelLoginAccountResponse.ts +6 -0
- package/apps/backend/src/protocol/v2/CancelLoginAccountStatus.ts +5 -0
- package/apps/backend/src/protocol/v2/CodexErrorInfo.ts +11 -0
- package/apps/backend/src/protocol/v2/CommandAction.ts +5 -0
- package/apps/backend/src/protocol/v2/CommandExecParams.ts +6 -0
- package/apps/backend/src/protocol/v2/CommandExecResponse.ts +5 -0
- package/apps/backend/src/protocol/v2/CommandExecutionOutputDeltaNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/CommandExecutionRequestApprovalParams.ts +14 -0
- package/apps/backend/src/protocol/v2/CommandExecutionRequestApprovalResponse.ts +6 -0
- package/apps/backend/src/protocol/v2/CommandExecutionStatus.ts +5 -0
- package/apps/backend/src/protocol/v2/Config.ts +15 -0
- package/apps/backend/src/protocol/v2/ConfigBatchWriteParams.ts +10 -0
- package/apps/backend/src/protocol/v2/ConfigEdit.ts +7 -0
- package/apps/backend/src/protocol/v2/ConfigLayer.ts +7 -0
- package/apps/backend/src/protocol/v2/ConfigLayerMetadata.ts +6 -0
- package/apps/backend/src/protocol/v2/ConfigLayerSource.ts +6 -0
- package/apps/backend/src/protocol/v2/ConfigReadParams.ts +5 -0
- package/apps/backend/src/protocol/v2/ConfigReadResponse.ts +8 -0
- package/apps/backend/src/protocol/v2/ConfigValueWriteParams.ts +11 -0
- package/apps/backend/src/protocol/v2/ConfigWriteResponse.ts +12 -0
- package/apps/backend/src/protocol/v2/ContextCompactedNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/CreditsSnapshot.ts +5 -0
- package/apps/backend/src/protocol/v2/DeprecationNoticeNotification.ts +13 -0
- package/apps/backend/src/protocol/v2/ErrorNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/ExecPolicyAmendment.ts +5 -0
- package/apps/backend/src/protocol/v2/FeedbackUploadParams.ts +5 -0
- package/apps/backend/src/protocol/v2/FeedbackUploadResponse.ts +5 -0
- package/apps/backend/src/protocol/v2/FileChangeOutputDeltaNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/FileChangeRequestApprovalParams.ts +14 -0
- package/apps/backend/src/protocol/v2/FileChangeRequestApprovalResponse.ts +6 -0
- package/apps/backend/src/protocol/v2/FileUpdateChange.ts +6 -0
- package/apps/backend/src/protocol/v2/GetAccountParams.ts +5 -0
- package/apps/backend/src/protocol/v2/GetAccountRateLimitsResponse.ts +6 -0
- package/apps/backend/src/protocol/v2/GetAccountResponse.ts +6 -0
- package/apps/backend/src/protocol/v2/GitInfo.ts +5 -0
- package/apps/backend/src/protocol/v2/ItemCompletedNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/ItemStartedNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/ListMcpServerStatusParams.ts +13 -0
- package/apps/backend/src/protocol/v2/ListMcpServerStatusResponse.ts +11 -0
- package/apps/backend/src/protocol/v2/LoginAccountParams.ts +5 -0
- package/apps/backend/src/protocol/v2/LoginAccountResponse.ts +9 -0
- package/apps/backend/src/protocol/v2/LogoutAccountResponse.ts +5 -0
- package/apps/backend/src/protocol/v2/McpAuthStatus.ts +5 -0
- package/apps/backend/src/protocol/v2/McpServerOauthLoginCompletedNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/McpServerOauthLoginParams.ts +5 -0
- package/apps/backend/src/protocol/v2/McpServerOauthLoginResponse.ts +5 -0
- package/apps/backend/src/protocol/v2/McpServerStatus.ts +9 -0
- package/apps/backend/src/protocol/v2/McpToolCallError.ts +5 -0
- package/apps/backend/src/protocol/v2/McpToolCallProgressNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/McpToolCallResult.ts +7 -0
- package/apps/backend/src/protocol/v2/McpToolCallStatus.ts +5 -0
- package/apps/backend/src/protocol/v2/MergeStrategy.ts +5 -0
- package/apps/backend/src/protocol/v2/Model.ts +7 -0
- package/apps/backend/src/protocol/v2/ModelListParams.ts +13 -0
- package/apps/backend/src/protocol/v2/ModelListResponse.ts +11 -0
- package/apps/backend/src/protocol/v2/NetworkAccess.ts +5 -0
- package/apps/backend/src/protocol/v2/OverriddenMetadata.ts +7 -0
- package/apps/backend/src/protocol/v2/PatchApplyStatus.ts +5 -0
- package/apps/backend/src/protocol/v2/PatchChangeKind.ts +5 -0
- package/apps/backend/src/protocol/v2/ProfileV2.ts +10 -0
- package/apps/backend/src/protocol/v2/RateLimitSnapshot.ts +8 -0
- package/apps/backend/src/protocol/v2/RateLimitWindow.ts +5 -0
- package/apps/backend/src/protocol/v2/RawResponseItemCompletedNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/ReasoningEffortOption.ts +6 -0
- package/apps/backend/src/protocol/v2/ReasoningSummaryPartAddedNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/ReasoningSummaryTextDeltaNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/ReasoningTextDeltaNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/ReviewDelivery.ts +5 -0
- package/apps/backend/src/protocol/v2/ReviewStartParams.ts +12 -0
- package/apps/backend/src/protocol/v2/ReviewStartResponse.ts +13 -0
- package/apps/backend/src/protocol/v2/ReviewTarget.ts +9 -0
- package/apps/backend/src/protocol/v2/SandboxMode.ts +5 -0
- package/apps/backend/src/protocol/v2/SandboxPolicy.ts +7 -0
- package/apps/backend/src/protocol/v2/SandboxWorkspaceWrite.ts +5 -0
- package/apps/backend/src/protocol/v2/SessionSource.ts +5 -0
- package/apps/backend/src/protocol/v2/SkillErrorInfo.ts +5 -0
- package/apps/backend/src/protocol/v2/SkillMetadata.ts +6 -0
- package/apps/backend/src/protocol/v2/SkillScope.ts +5 -0
- package/apps/backend/src/protocol/v2/SkillsListEntry.ts +7 -0
- package/apps/backend/src/protocol/v2/SkillsListParams.ts +13 -0
- package/apps/backend/src/protocol/v2/SkillsListResponse.ts +6 -0
- package/apps/backend/src/protocol/v2/TerminalInteractionNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/Thread.ts +46 -0
- package/apps/backend/src/protocol/v2/ThreadArchiveParams.ts +5 -0
- package/apps/backend/src/protocol/v2/ThreadArchiveResponse.ts +5 -0
- package/apps/backend/src/protocol/v2/ThreadItem.ts +48 -0
- package/apps/backend/src/protocol/v2/ThreadListParams.ts +18 -0
- package/apps/backend/src/protocol/v2/ThreadListResponse.ts +11 -0
- package/apps/backend/src/protocol/v2/ThreadResumeParams.ts +35 -0
- package/apps/backend/src/protocol/v2/ThreadResumeResponse.ts +9 -0
- package/apps/backend/src/protocol/v2/ThreadStartParams.ts +15 -0
- package/apps/backend/src/protocol/v2/ThreadStartResponse.ts +9 -0
- package/apps/backend/src/protocol/v2/ThreadStartedNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/ThreadTokenUsage.ts +6 -0
- package/apps/backend/src/protocol/v2/ThreadTokenUsageUpdatedNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/TokenUsageBreakdown.ts +5 -0
- package/apps/backend/src/protocol/v2/ToolsV2.ts +5 -0
- package/apps/backend/src/protocol/v2/Turn.ts +18 -0
- package/apps/backend/src/protocol/v2/TurnCompletedNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/TurnDiffUpdatedNotification.ts +9 -0
- package/apps/backend/src/protocol/v2/TurnError.ts +6 -0
- package/apps/backend/src/protocol/v2/TurnInterruptParams.ts +5 -0
- package/apps/backend/src/protocol/v2/TurnInterruptResponse.ts +5 -0
- package/apps/backend/src/protocol/v2/TurnPlanStep.ts +6 -0
- package/apps/backend/src/protocol/v2/TurnPlanStepStatus.ts +5 -0
- package/apps/backend/src/protocol/v2/TurnPlanUpdatedNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/TurnStartParams.ts +34 -0
- package/apps/backend/src/protocol/v2/TurnStartResponse.ts +6 -0
- package/apps/backend/src/protocol/v2/TurnStartedNotification.ts +6 -0
- package/apps/backend/src/protocol/v2/TurnStatus.ts +5 -0
- package/apps/backend/src/protocol/v2/UserInput.ts +5 -0
- package/apps/backend/src/protocol/v2/WindowsWorldWritableWarningNotification.ts +5 -0
- package/apps/backend/src/protocol/v2/WriteStatus.ts +5 -0
- package/apps/backend/src/protocol/v2/index.ts +123 -0
- package/apps/backend/src/reviews/service.ts +27 -0
- package/apps/backend/src/reviews/store.ts +124 -0
- package/apps/backend/src/server.ts +531 -0
- package/apps/backend/src/services/profile-store.ts +114 -0
- package/apps/backend/src/services/supervisor.ts +102 -0
- package/apps/backend/src/thread-index/service.ts +75 -0
- package/apps/backend/src/thread-index/store.ts +195 -0
- package/apps/backend/src/ws/messages.ts +73 -0
- package/apps/backend/tsconfig.json +20 -0
- package/apps/web/README.md +24 -0
- package/apps/web/bun.lock +1062 -0
- package/apps/web/eslint.config.js +23 -0
- package/apps/web/index.html +16 -0
- package/apps/web/package.json +38 -0
- package/apps/web/src/app.tsx +83 -0
- package/apps/web/src/components/composer/slash-command-menu.tsx +47 -0
- package/apps/web/src/components/index.ts +2 -0
- package/apps/web/src/components/layout/account-usage-panel.tsx +167 -0
- package/apps/web/src/components/layout/analytics-view.tsx +296 -0
- package/apps/web/src/components/layout/index.ts +7 -0
- package/apps/web/src/components/layout/mobile-header.tsx +56 -0
- package/apps/web/src/components/layout/reviews-view.tsx +848 -0
- package/apps/web/src/components/layout/session-view.tsx +1374 -0
- package/apps/web/src/components/layout/settings-dialog.tsx +322 -0
- package/apps/web/src/components/layout/side-bar.tsx +417 -0
- package/apps/web/src/components/layout/thread-list.tsx +488 -0
- package/apps/web/src/components/layout/virtualized-message-list.tsx +748 -0
- package/apps/web/src/components/loading/startup-ascii.ts +652 -0
- package/apps/web/src/components/loading/startup-loader.tsx +37 -0
- package/apps/web/src/components/session-view/file-mention-menu.tsx +46 -0
- package/apps/web/src/components/session-view/session-auth-banner.tsx +61 -0
- package/apps/web/src/components/session-view/session-composer.tsx +328 -0
- package/apps/web/src/components/session-view/session-dialogs.tsx +280 -0
- package/apps/web/src/components/session-view/session-empty.tsx +47 -0
- package/apps/web/src/components/session-view/session-header.tsx +49 -0
- package/apps/web/src/components/ui/avatar.tsx +19 -0
- package/apps/web/src/components/ui/badge.tsx +21 -0
- package/apps/web/src/components/ui/button.tsx +47 -0
- package/apps/web/src/components/ui/collapsible-content.tsx +114 -0
- package/apps/web/src/components/ui/contribution-graph.tsx +182 -0
- package/apps/web/src/components/ui/dialog-box.tsx +203 -0
- package/apps/web/src/components/ui/icon-button.tsx +32 -0
- package/apps/web/src/components/ui/icons.tsx +187 -0
- package/apps/web/src/components/ui/index.tsx +15 -0
- package/apps/web/src/components/ui/input.tsx +43 -0
- package/apps/web/src/components/ui/markdown-stream.tsx +21 -0
- package/apps/web/src/components/ui/mobile-drawer.tsx +124 -0
- package/apps/web/src/components/ui/section-header.tsx +13 -0
- package/apps/web/src/components/ui/select.tsx +217 -0
- package/apps/web/src/components/ui/shimmer.tsx +138 -0
- package/apps/web/src/components/ui/status-dot.tsx +24 -0
- package/apps/web/src/config.ts +5 -0
- package/apps/web/src/hooks/index.ts +3 -0
- package/apps/web/src/hooks/use-analytics.ts +122 -0
- package/apps/web/src/hooks/use-hub-connection.ts +587 -0
- package/apps/web/src/hooks/use-mobile.ts +76 -0
- package/apps/web/src/hooks/use-thread-history.ts +210 -0
- package/apps/web/src/index.css +269 -0
- package/apps/web/src/main.tsx +10 -0
- package/apps/web/src/services/hub-client.ts +358 -0
- package/apps/web/src/store/index.ts +528 -0
- package/apps/web/src/types/index.ts +119 -0
- package/apps/web/src/utils/account-refresh.ts +168 -0
- package/apps/web/src/utils/approval-policy.ts +53 -0
- package/apps/web/src/utils/init-prompt.ts +41 -0
- package/apps/web/src/utils/item-format.ts +170 -0
- package/apps/web/src/utils/prompt-expander.ts +62 -0
- package/apps/web/src/utils/reasoning-summary.ts +48 -0
- package/apps/web/src/utils/slash-commands.ts +98 -0
- package/apps/web/tsconfig.app.json +28 -0
- package/apps/web/tsconfig.json +7 -0
- package/apps/web/tsconfig.node.json +26 -0
- package/apps/web/vite.config.ts +8 -0
- package/bin/better-codex.cjs +199 -0
- package/package.json +20 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto'
|
|
2
|
+
import { homedir } from 'node:os'
|
|
3
|
+
import { dirname, join, resolve } from 'node:path'
|
|
4
|
+
|
|
5
|
+
export type HubConfig = {
|
|
6
|
+
host: string
|
|
7
|
+
port: number
|
|
8
|
+
dataDir: string
|
|
9
|
+
profilesDir: string
|
|
10
|
+
defaultCodexHome: string
|
|
11
|
+
defaultCwd: string
|
|
12
|
+
codexBin: string
|
|
13
|
+
codexArgs: string[]
|
|
14
|
+
codexAppServerArgs: string[]
|
|
15
|
+
authToken: string
|
|
16
|
+
clientInfo: {
|
|
17
|
+
name: string
|
|
18
|
+
title: string
|
|
19
|
+
version: string
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const DEFAULT_HOST = '127.0.0.1'
|
|
24
|
+
const DEFAULT_PORT = 7711
|
|
25
|
+
|
|
26
|
+
const DEFAULT_CLIENT_INFO = {
|
|
27
|
+
name: 'codex-hub',
|
|
28
|
+
title: 'Codex Hub Backend',
|
|
29
|
+
version: '0.1.0',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const inferWorkspaceCwd = () => {
|
|
33
|
+
const explicit = process.env.CODEX_HUB_DEFAULT_CWD ?? process.env.CODEX_DEFAULT_CWD
|
|
34
|
+
if (explicit) {
|
|
35
|
+
return explicit
|
|
36
|
+
}
|
|
37
|
+
const cwd = process.cwd()
|
|
38
|
+
if (cwd.endsWith(`${join('apps', 'backend')}`)) {
|
|
39
|
+
return resolve(cwd, '..', '..')
|
|
40
|
+
}
|
|
41
|
+
return cwd
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const parseJsonArgs = (value: string | undefined): string[] | null => {
|
|
45
|
+
if (!value) {
|
|
46
|
+
return null
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const parsed = JSON.parse(value)
|
|
50
|
+
return Array.isArray(parsed) ? parsed.map(String) : null
|
|
51
|
+
} catch {
|
|
52
|
+
return null
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const parseSpaceArgs = (value: string | undefined): string[] => {
|
|
57
|
+
if (!value) {
|
|
58
|
+
return []
|
|
59
|
+
}
|
|
60
|
+
return value
|
|
61
|
+
.split(/\s+/u)
|
|
62
|
+
.map((item) => item.trim())
|
|
63
|
+
.filter(Boolean)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const loadConfig = (): HubConfig => {
|
|
67
|
+
const dataDir =
|
|
68
|
+
process.env.CODEX_HUB_DATA_DIR ?? join(homedir(), '.codex-hub')
|
|
69
|
+
const profilesDir =
|
|
70
|
+
process.env.CODEX_HUB_PROFILES_DIR ?? join(homedir(), '.codex', 'profiles')
|
|
71
|
+
const defaultCodexHome =
|
|
72
|
+
process.env.CODEX_HUB_DEFAULT_CODEX_HOME ?? join(homedir(), '.codex')
|
|
73
|
+
|
|
74
|
+
const defaultCwd = inferWorkspaceCwd()
|
|
75
|
+
|
|
76
|
+
const codexArgs =
|
|
77
|
+
parseJsonArgs(process.env.CODEX_FLAGS_JSON) ??
|
|
78
|
+
parseSpaceArgs(process.env.CODEX_FLAGS)
|
|
79
|
+
const codexAppServerArgs =
|
|
80
|
+
parseJsonArgs(process.env.CODEX_APP_SERVER_FLAGS_JSON) ??
|
|
81
|
+
parseSpaceArgs(process.env.CODEX_APP_SERVER_FLAGS)
|
|
82
|
+
|
|
83
|
+
const authToken = process.env.CODEX_HUB_TOKEN ?? randomUUID()
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
host: process.env.CODEX_HUB_HOST ?? DEFAULT_HOST,
|
|
87
|
+
port: Number(process.env.CODEX_HUB_PORT ?? DEFAULT_PORT),
|
|
88
|
+
dataDir,
|
|
89
|
+
profilesDir,
|
|
90
|
+
defaultCodexHome,
|
|
91
|
+
defaultCwd,
|
|
92
|
+
codexBin: process.env.CODEX_BIN ?? 'codex',
|
|
93
|
+
codexArgs,
|
|
94
|
+
codexAppServerArgs,
|
|
95
|
+
authToken,
|
|
96
|
+
clientInfo: DEFAULT_CLIENT_INFO,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process'
|
|
2
|
+
import { EventEmitter } from 'node:events'
|
|
3
|
+
import type { ChildProcessWithoutNullStreams } from 'node:child_process'
|
|
4
|
+
import { JsonRpcConnection } from './jsonrpc'
|
|
5
|
+
|
|
6
|
+
type ClientInfo = {
|
|
7
|
+
name: string
|
|
8
|
+
title: string
|
|
9
|
+
version: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type CodexAppServerOptions = {
|
|
13
|
+
codexBin: string
|
|
14
|
+
codexArgs: string[]
|
|
15
|
+
appServerArgs: string[]
|
|
16
|
+
codexHome: string
|
|
17
|
+
clientInfo: ClientInfo
|
|
18
|
+
cwd?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type CodexAppServerEvents = {
|
|
22
|
+
notification: (message: { method: string; params?: unknown }) => void
|
|
23
|
+
serverRequest: (message: { id: number; method: string; params?: unknown }) => void
|
|
24
|
+
stderr: (message: string) => void
|
|
25
|
+
exit: (code: number | null) => void
|
|
26
|
+
error: (error: Error) => void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class CodexAppServer extends EventEmitter {
|
|
30
|
+
private process?: ChildProcessWithoutNullStreams
|
|
31
|
+
private connection?: JsonRpcConnection
|
|
32
|
+
private ready: Promise<void>
|
|
33
|
+
private resolveReady?: () => void
|
|
34
|
+
|
|
35
|
+
constructor(private readonly options: CodexAppServerOptions) {
|
|
36
|
+
super()
|
|
37
|
+
this.ready = new Promise((resolve) => {
|
|
38
|
+
this.resolveReady = resolve
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async start(): Promise<void> {
|
|
43
|
+
if (this.process) {
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const args = [
|
|
48
|
+
...this.options.codexArgs,
|
|
49
|
+
'app-server',
|
|
50
|
+
...this.options.appServerArgs,
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
const child = spawn(this.options.codexBin, args, {
|
|
54
|
+
env: {
|
|
55
|
+
...process.env,
|
|
56
|
+
CODEX_HOME: this.options.codexHome,
|
|
57
|
+
},
|
|
58
|
+
cwd: this.options.cwd,
|
|
59
|
+
stdio: 'pipe',
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
this.process = child
|
|
63
|
+
this.connection = new JsonRpcConnection(
|
|
64
|
+
child.stdin,
|
|
65
|
+
child.stdout,
|
|
66
|
+
child.stderr
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
this.connection.on('notification', (message) => {
|
|
70
|
+
this.emit('notification', message)
|
|
71
|
+
})
|
|
72
|
+
this.connection.on('serverRequest', (message) => {
|
|
73
|
+
this.emit('serverRequest', message)
|
|
74
|
+
})
|
|
75
|
+
this.connection.on('stderr', (message) => {
|
|
76
|
+
this.emit('stderr', message)
|
|
77
|
+
})
|
|
78
|
+
this.connection.on('error', (error) => {
|
|
79
|
+
this.emit('error', error)
|
|
80
|
+
})
|
|
81
|
+
child.on('exit', (code) => {
|
|
82
|
+
this.emit('exit', code)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
await this.initialize()
|
|
86
|
+
this.resolveReady?.()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async request(method: string, params?: unknown): Promise<unknown> {
|
|
90
|
+
await this.ready
|
|
91
|
+
if (!this.connection) {
|
|
92
|
+
throw new Error('app-server is not running')
|
|
93
|
+
}
|
|
94
|
+
return this.connection.sendRequest(method, params)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
notify(method: string, params?: unknown): void {
|
|
98
|
+
if (!this.connection) {
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
this.connection.sendNotification(method, params)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
respond(id: number, result?: unknown, error?: { code?: number; message: string }): void {
|
|
105
|
+
if (!this.connection) {
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
this.connection.sendResponse(id, result, error)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async stop(): Promise<void> {
|
|
112
|
+
if (!this.process) {
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
this.process.kill()
|
|
116
|
+
this.process = undefined
|
|
117
|
+
this.connection = undefined
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private async initialize(): Promise<void> {
|
|
121
|
+
if (!this.connection) {
|
|
122
|
+
throw new Error('missing JSON-RPC connection')
|
|
123
|
+
}
|
|
124
|
+
await this.connection.sendRequest('initialize', {
|
|
125
|
+
clientInfo: this.options.clientInfo,
|
|
126
|
+
})
|
|
127
|
+
this.connection.sendNotification('initialized', {})
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type CodexAppServerEventsMap = CodexAppServerEvents
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events'
|
|
2
|
+
import type { Writable } from 'node:stream'
|
|
3
|
+
|
|
4
|
+
export type JsonRpcError = {
|
|
5
|
+
code?: number
|
|
6
|
+
message: string
|
|
7
|
+
data?: unknown
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type JsonRpcRequest = {
|
|
11
|
+
id: number
|
|
12
|
+
method: string
|
|
13
|
+
params?: unknown
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type JsonRpcResponse = {
|
|
17
|
+
id: number
|
|
18
|
+
result?: unknown
|
|
19
|
+
error?: JsonRpcError
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type JsonRpcNotification = {
|
|
23
|
+
method: string
|
|
24
|
+
params?: unknown
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type JsonRpcServerRequest = JsonRpcRequest
|
|
28
|
+
|
|
29
|
+
type PendingRequest = {
|
|
30
|
+
resolve: (value: unknown) => void
|
|
31
|
+
reject: (error: JsonRpcError) => void
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type JsonRpcEvents = {
|
|
35
|
+
notification: (message: JsonRpcNotification) => void
|
|
36
|
+
serverRequest: (message: JsonRpcServerRequest) => void
|
|
37
|
+
close: () => void
|
|
38
|
+
error: (error: Error) => void
|
|
39
|
+
stderr: (message: string) => void
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class JsonRpcConnection extends EventEmitter {
|
|
43
|
+
private buffer = ''
|
|
44
|
+
private nextId = 1
|
|
45
|
+
private pending = new Map<number, PendingRequest>()
|
|
46
|
+
private readonly stdin: Writable
|
|
47
|
+
|
|
48
|
+
constructor(
|
|
49
|
+
stdin: Writable,
|
|
50
|
+
stdout: NodeJS.ReadableStream,
|
|
51
|
+
stderr?: NodeJS.ReadableStream
|
|
52
|
+
) {
|
|
53
|
+
super()
|
|
54
|
+
this.stdin = stdin
|
|
55
|
+
|
|
56
|
+
stdout.on('data', (chunk: Buffer | string) => {
|
|
57
|
+
const text = typeof chunk === 'string' ? chunk : chunk.toString('utf8')
|
|
58
|
+
this.handleChunk(text)
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
stdout.on('end', () => {
|
|
62
|
+
this.emit('close')
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
stdout.on('error', (error) => {
|
|
66
|
+
this.emit('error', error)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
stderr?.on('data', (chunk: Buffer | string) => {
|
|
70
|
+
const text = typeof chunk === 'string' ? chunk : chunk.toString('utf8')
|
|
71
|
+
const trimmed = text.trim()
|
|
72
|
+
if (trimmed) {
|
|
73
|
+
this.emit('stderr', trimmed)
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
sendRequest(method: string, params?: unknown): Promise<unknown> {
|
|
79
|
+
const id = this.nextId++
|
|
80
|
+
const message: JsonRpcRequest = { id, method, params }
|
|
81
|
+
this.writeMessage(message)
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
this.pending.set(id, {
|
|
84
|
+
resolve,
|
|
85
|
+
reject: (error) => reject(new Error(error.message)),
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
sendNotification(method: string, params?: unknown): void {
|
|
91
|
+
const message: JsonRpcNotification = { method, params }
|
|
92
|
+
this.writeMessage(message)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
sendResponse(id: number, result?: unknown, error?: JsonRpcError): void {
|
|
96
|
+
const message: JsonRpcResponse = { id, result, error }
|
|
97
|
+
this.writeMessage(message)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private handleChunk(text: string): void {
|
|
101
|
+
this.buffer += text
|
|
102
|
+
let newlineIndex = this.buffer.indexOf('\n')
|
|
103
|
+
while (newlineIndex !== -1) {
|
|
104
|
+
const raw = this.buffer.slice(0, newlineIndex).trim()
|
|
105
|
+
this.buffer = this.buffer.slice(newlineIndex + 1)
|
|
106
|
+
if (raw) {
|
|
107
|
+
this.handleLine(raw)
|
|
108
|
+
}
|
|
109
|
+
newlineIndex = this.buffer.indexOf('\n')
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private handleLine(line: string): void {
|
|
114
|
+
let payload: unknown
|
|
115
|
+
try {
|
|
116
|
+
payload = JSON.parse(line)
|
|
117
|
+
} catch (error) {
|
|
118
|
+
this.emit('error', error instanceof Error ? error : new Error(String(error)))
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (!payload || typeof payload !== 'object') {
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const message = payload as Partial<
|
|
127
|
+
JsonRpcRequest & JsonRpcResponse & JsonRpcNotification
|
|
128
|
+
>
|
|
129
|
+
|
|
130
|
+
if (typeof message.id === 'number' && message.method) {
|
|
131
|
+
this.emit('serverRequest', {
|
|
132
|
+
id: message.id,
|
|
133
|
+
method: message.method,
|
|
134
|
+
params: message.params,
|
|
135
|
+
})
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (typeof message.id === 'number' && !message.method) {
|
|
140
|
+
const pending = this.pending.get(message.id)
|
|
141
|
+
if (!pending) {
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
this.pending.delete(message.id)
|
|
145
|
+
if (message.error) {
|
|
146
|
+
pending.reject(message.error)
|
|
147
|
+
} else {
|
|
148
|
+
pending.resolve(message.result)
|
|
149
|
+
}
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (message.method) {
|
|
154
|
+
this.emit('notification', {
|
|
155
|
+
method: message.method,
|
|
156
|
+
params: message.params,
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private writeMessage(message: JsonRpcRequest | JsonRpcResponse | JsonRpcNotification): void {
|
|
162
|
+
this.stdin.write(`${JSON.stringify(message)}\n`)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export type JsonRpcEventsMap = JsonRpcEvents
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A path that is guaranteed to be absolute and normalized (though it is not
|
|
7
|
+
* guaranteed to be canonicalized or exist on the filesystem).
|
|
8
|
+
*
|
|
9
|
+
* IMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set
|
|
10
|
+
* using `AbsolutePathBufGuard::new(base_path)`. If no base path is set, the
|
|
11
|
+
* deserialization will fail unless the path being deserialized is already
|
|
12
|
+
* absolute.
|
|
13
|
+
*/
|
|
14
|
+
export type AbsolutePathBuf = string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { ConversationId } from "./ConversationId";
|
|
5
|
+
|
|
6
|
+
export type AddConversationListenerParams = { conversationId: ConversationId, experimentalRawEvents: boolean, };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
|
|
5
|
+
export type AgentMessageContentDeltaEvent = { thread_id: string, turn_id: string, item_id: string, delta: string, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { AgentMessageContent } from "./AgentMessageContent";
|
|
5
|
+
|
|
6
|
+
export type AgentMessageItem = { id: string, content: Array<AgentMessageContent>, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { Role } from "./Role";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
|
|
8
|
+
*/
|
|
9
|
+
export type Annotations = { audience?: Array<Role>, lastModified?: string, priority?: number, };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { ConversationId } from "./ConversationId";
|
|
5
|
+
import type { FileChange } from "./FileChange";
|
|
6
|
+
|
|
7
|
+
export type ApplyPatchApprovalParams = { conversationId: ConversationId,
|
|
8
|
+
/**
|
|
9
|
+
* Use to correlate this with [codex_core::protocol::PatchApplyBeginEvent]
|
|
10
|
+
* and [codex_core::protocol::PatchApplyEndEvent].
|
|
11
|
+
*/
|
|
12
|
+
callId: string, fileChanges: { [key in string]?: FileChange },
|
|
13
|
+
/**
|
|
14
|
+
* Optional explanatory reason (e.g. request for extra write access).
|
|
15
|
+
*/
|
|
16
|
+
reason: string | null,
|
|
17
|
+
/**
|
|
18
|
+
* When set, the agent is asking the user to allow writes under this root
|
|
19
|
+
* for the remainder of the session (unclear if this is honored today).
|
|
20
|
+
*/
|
|
21
|
+
grantRoot: string | null, };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { FileChange } from "./FileChange";
|
|
5
|
+
|
|
6
|
+
export type ApplyPatchApprovalRequestEvent = {
|
|
7
|
+
/**
|
|
8
|
+
* Responses API call id for the associated patch apply call, if available.
|
|
9
|
+
*/
|
|
10
|
+
call_id: string,
|
|
11
|
+
/**
|
|
12
|
+
* Turn ID that this patch belongs to.
|
|
13
|
+
* Uses `#[serde(default)]` for backwards compatibility with older senders.
|
|
14
|
+
*/
|
|
15
|
+
turn_id: string, changes: { [key in string]?: FileChange },
|
|
16
|
+
/**
|
|
17
|
+
* Optional explanatory reason (e.g. request for extra write access).
|
|
18
|
+
*/
|
|
19
|
+
reason: string | null,
|
|
20
|
+
/**
|
|
21
|
+
* When set, the agent is asking the user to allow writes under this root for the remainder of the session.
|
|
22
|
+
*/
|
|
23
|
+
grant_root: string | null, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { ReviewDecision } from "./ReviewDecision";
|
|
5
|
+
|
|
6
|
+
export type ApplyPatchApprovalResponse = { decision: ReviewDecision, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { ConversationId } from "./ConversationId";
|
|
5
|
+
|
|
6
|
+
export type ArchiveConversationParams = { conversationId: ConversationId, rolloutPath: string, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Determines the conditions under which the user is consulted to approve
|
|
7
|
+
* running the command proposed by Codex.
|
|
8
|
+
*/
|
|
9
|
+
export type AskForApproval = "untrusted" | "on-failure" | "on-request" | "never";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { Annotations } from "./Annotations";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Audio provided to or from an LLM.
|
|
8
|
+
*/
|
|
9
|
+
export type AudioContent = { annotations?: Annotations, data: string, mimeType: string, type: string, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { AuthMode } from "./AuthMode";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Deprecated notification. Use AccountUpdatedNotification instead.
|
|
8
|
+
*/
|
|
9
|
+
export type AuthStatusChangeNotification = { authMethod: AuthMode | null, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { ContentBlock } from "./ContentBlock";
|
|
5
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The server's response to a tool call.
|
|
9
|
+
*/
|
|
10
|
+
export type CallToolResult = { content: Array<ContentBlock>, isError?: boolean, structuredContent?: JsonValue, };
|