@jrkropp/codex-js 0.1.3 → 0.2.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/CHANGELOG.md +10 -0
- package/README.md +57 -617
- package/dist/client/index.d.ts +2 -16
- package/dist/client/index.js +2522 -16
- package/dist/index.d.ts +2 -25
- package/dist/index.js +699 -20
- package/dist/internal/codex/app-server/src/bespoke_event_handling.d.ts +5 -0
- package/dist/internal/codex/app-server/src/connection_rpc_gate.d.ts +11 -0
- package/dist/internal/codex/app-server/src/dynamic_tools.d.ts +5 -0
- package/dist/internal/codex/app-server/src/message_processor.d.ts +88 -0
- package/dist/internal/codex/app-server/src/outgoing_message.d.ts +73 -0
- package/dist/internal/codex/app-server/src/request_processors/common.d.ts +25 -0
- package/dist/internal/codex/app-server/src/request_processors/mcp_processor.d.ts +32 -0
- package/dist/internal/codex/app-server/src/request_processors/request_errors.d.ts +9 -0
- package/dist/internal/codex/app-server/src/request_processors/thread_processor.d.ts +38 -0
- package/dist/internal/codex/app-server/src/request_processors/token_usage_replay.d.ts +22 -0
- package/dist/internal/codex/app-server/src/request_processors/turn_processor.d.ts +21 -0
- package/dist/internal/codex/app-server/src/request_processors.d.ts +5 -0
- package/dist/internal/codex/app-server/src/request_serialization.d.ts +7 -0
- package/dist/internal/codex/app-server/src/runtime.d.ts +96 -0
- package/dist/internal/codex/app-server/src/server_request_response.d.ts +30 -0
- package/dist/internal/codex/app-server/src/session_factory.d.ts +30 -0
- package/dist/internal/codex/app-server/src/session_task_runner.d.ts +44 -0
- package/dist/internal/codex/app-server/src/thread_state.d.ts +56 -0
- package/dist/internal/codex/app-server-client/src/lib.d.ts +48 -0
- package/dist/{index-77U_Oc-a.d.ts → internal/codex/app-server-client/src/pending_requests.d.ts} +7 -18
- package/dist/internal/codex/app-server-client/src/remote.d.ts +18 -0
- package/dist/{session-BRYzi8OT.d.ts → internal/codex/app-server-client/src/session.d.ts} +5 -9
- package/dist/{thread_event_store-C0zYzukG.d.ts → internal/codex/app-server-client/src/thread_event_store.d.ts} +14 -14
- package/dist/internal/codex/app-server-client/src/thread_projection.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/AbsolutePathBuf.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/AgentPath.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ApplyPatchApprovalParams.d.ts +22 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ApplyPatchApprovalResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/AuthMode.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ClientInfo.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ClientNotification.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ClientRequest.d.ts +410 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/CollaborationMode.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ContentItem.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ConversationGitInfo.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ConversationSummary.d.ts +15 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ExecCommandApprovalParams.d.ts +18 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ExecCommandApprovalResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ExecPolicyAmendment.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/FileChange.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ForcedLoginMethod.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/FunctionCallOutputBody.d.ts +2 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/FunctionCallOutputContentItem.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchMatchType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchParams.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchResult.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchSessionCompletedNotification.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/FuzzyFileSearchSessionUpdatedNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/GetAuthStatusParams.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/GetAuthStatusResponse.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/GetConversationSummaryParams.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/GetConversationSummaryResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/GitDiffToRemoteParams.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/GitDiffToRemoteResponse.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/GitSha.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ImageDetail.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/InitializeCapabilities.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/InitializeParams.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/InitializeResponse.d.ts +18 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/InputModality.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/InternalSessionSource.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/LocalShellAction.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/LocalShellExecAction.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/LocalShellStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/MessagePhase.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ModeKind.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/NetworkPolicyAmendment.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/NetworkPolicyRuleAction.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ParsedCommand.d.ts +24 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/Personality.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/PlanType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/RealtimeConversationVersion.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/RealtimeOutputModality.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/RealtimeVoice.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/RealtimeVoicesList.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ReasoningEffort.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ReasoningItemContent.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ReasoningItemReasoningSummary.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ReasoningSummary.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/RequestId.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/Resource.d.ts +15 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ResourceContent.d.ts +21 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ResourceTemplate.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ResponseItem.d.ts +78 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ReviewDecision.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ServerNotification.d.ts +260 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ServerRequest.d.ts +50 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/SessionSource.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/Settings.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/SubAgentSource.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ThreadId.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/ThreadMemoryMode.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/Tool.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/Verbosity.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/WebSearchAction.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/WebSearchContextSize.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/WebSearchLocation.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/WebSearchMode.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/WebSearchToolConfig.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/index.d.ts +77 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/serde_json/JsonValue.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/Account.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AccountLoginCompletedNotification.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AccountRateLimitsUpdatedNotification.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AccountUpdatedNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ActivePermissionProfile.d.ts +18 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ActivePermissionProfileModification.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AddCreditsNudgeCreditType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AddCreditsNudgeEmailStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AdditionalFileSystemPermissions.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AdditionalNetworkPermissions.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AdditionalPermissionProfile.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AgentMessageDeltaNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AnalyticsConfig.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppBranding.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppInfo.d.ts +30 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppListUpdatedNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppMetadata.d.ts +16 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppReview.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppScreenshot.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppSummary.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppToolApproval.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppToolsConfig.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ApprovalsReviewer.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppsConfig.d.ts +15 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppsDefaultConfig.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppsListParams.d.ts +21 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AppsListResponse.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AskForApproval.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/AutoReviewDecisionSource.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ByteRange.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CancelLoginAccountParams.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CancelLoginAccountResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CancelLoginAccountStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ChatgptAuthTokensRefreshParams.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ChatgptAuthTokensRefreshReason.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ChatgptAuthTokensRefreshResponse.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CodexErrorInfo.d.ts +28 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollabAgentState.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollabAgentStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollabAgentTool.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollabAgentToolCallStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollaborationModeListParams.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollaborationModeListResponse.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CollaborationModeMask.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandAction.d.ts +19 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecOutputDeltaNotification.d.ts +27 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecOutputStream.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecParams.d.ts +82 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecResizeParams.d.ts +15 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecResizeResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecResponse.d.ts +21 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecTerminalSize.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecTerminateParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecTerminateResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecWriteParams.d.ts +19 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecWriteResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionApprovalDecision.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionOutputDeltaNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionRequestApprovalParams.d.ts +40 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionRequestApprovalResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionSource.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandExecutionStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CommandMigration.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/Config.d.ts +47 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigBatchWriteParams.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigEdit.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigLayer.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigLayerMetadata.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigLayerSource.d.ts +30 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigReadParams.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigReadResponse.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigRequirements.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigRequirementsReadResponse.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigValueWriteParams.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigWarningNotification.d.ts +19 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfigWriteResponse.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfiguredHookHandler.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ConfiguredHookMatcherGroup.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ContextCompactedNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/CreditsSnapshot.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeprecationNoticeNotification.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyAlgorithm.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyCreateParams.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyCreateResponse.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyProtectionClass.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyProtectionPolicy.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyPublicParams.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeyPublicResponse.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeySignParams.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeySignPayload.d.ts +62 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DeviceKeySignResponse.d.ts +16 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DynamicToolCallOutputContentItem.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DynamicToolCallParams.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DynamicToolCallResponse.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DynamicToolCallStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/DynamicToolSpec.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ErrorNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExecPolicyAmendment.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeature.d.ts +34 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeatureEnablementSetParams.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeatureEnablementSetResponse.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeatureListParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeatureListResponse.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExperimentalFeatureStage.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigDetectParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigDetectResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigImportCompletedNotification.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigImportParams.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigImportResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigMigrationItem.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ExternalAgentConfigMigrationItemType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FeedbackUploadParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FeedbackUploadResponse.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileChangeApprovalDecision.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileChangeOutputDeltaNotification.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileChangePatchUpdatedNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileChangeRequestApprovalParams.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileChangeRequestApprovalResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileSystemAccessMode.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileSystemPath.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileSystemSandboxEntry.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileSystemSpecialPath.d.ts +16 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FileUpdateChange.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsChangedNotification.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsCopyParams.d.ts +18 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsCopyResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsCreateDirectoryParams.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsCreateDirectoryResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsGetMetadataParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsGetMetadataResponse.d.ts +25 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsReadDirectoryEntry.d.ts +17 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsReadDirectoryParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsReadDirectoryResponse.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsReadFileParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsReadFileResponse.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsRemoveParams.d.ts +18 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsRemoveResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsUnwatchParams.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsUnwatchResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsWatchParams.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsWatchResponse.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsWriteFileParams.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/FsWriteFileResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GetAccountParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GetAccountRateLimitsResponse.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GetAccountResponse.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GitInfo.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GrantedPermissionProfile.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianApprovalReview.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianApprovalReviewAction.d.ts +37 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianApprovalReviewStatus.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianCommandSource.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianRiskLevel.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianUserAuthorization.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/GuardianWarningNotification.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookCompletedNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookErrorInfo.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookEventName.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookExecutionMode.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookHandlerType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookMetadata.d.ts +22 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookMigration.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookOutputEntry.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookOutputEntryKind.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookPromptFragment.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookRunStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookRunSummary.d.ts +24 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookScope.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookSource.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookStartedNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HookTrustStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HooksListEntry.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HooksListParams.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/HooksListResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ItemCompletedNotification.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ItemGuardianApprovalReviewCompletedNotification.d.ts +32 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ItemGuardianApprovalReviewStartedNotification.d.ts +30 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ItemStartedNotification.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ListMcpServerStatusParams.d.ts +16 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ListMcpServerStatusResponse.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/LoginAccountParams.d.ts +27 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/LoginAccountResponse.d.ts +23 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/LogoutAccountResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ManagedHooksRequirements.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceAddParams.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceAddResponse.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceInterface.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceLoadErrorInfo.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceRemoveParams.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceRemoveResponse.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceUpgradeErrorInfo.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceUpgradeParams.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MarketplaceUpgradeResponse.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpAuthStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationArrayType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationBooleanSchema.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationBooleanType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationConstOption.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationEnumSchema.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationLegacyTitledEnumSchema.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationMultiSelectEnumSchema.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationNumberSchema.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationNumberType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationObjectType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationPrimitiveSchema.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationSchema.d.ts +16 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationSingleSelectEnumSchema.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationStringFormat.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationStringSchema.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationStringType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationTitledEnumItems.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationTitledMultiSelectEnumSchema.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationTitledSingleSelectEnumSchema.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationUntitledEnumItems.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationUntitledMultiSelectEnumSchema.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpElicitationUntitledSingleSelectEnumSchema.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpResourceReadParams.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpResourceReadResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerElicitationAction.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerElicitationRequestParams.d.ts +26 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerElicitationRequestResponse.d.ts +15 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerMigration.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerOauthLoginCompletedNotification.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerOauthLoginParams.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerOauthLoginResponse.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerRefreshResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerStartupState.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerStatus.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerStatusDetail.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerStatusUpdatedNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerToolCallParams.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpServerToolCallResponse.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpToolCallError.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpToolCallProgressNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpToolCallResult.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/McpToolCallStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MemoryCitation.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MemoryCitationEntry.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MergeStrategy.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/MigrationDetails.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/Model.d.ts +26 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelAvailabilityNux.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelListParams.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelListResponse.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelProviderCapabilitiesReadParams.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelProviderCapabilitiesReadResponse.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelRerouteReason.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelReroutedNotification.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelServiceTier.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelUpgradeInfo.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelVerification.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ModelVerificationNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkAccess.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkApprovalContext.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkApprovalProtocol.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkDomainPermission.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkPolicyAmendment.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkPolicyRuleAction.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkRequirements.d.ts +40 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NetworkUnixSocketPermission.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/NonSteerableTurnKind.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/OverriddenMetadata.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PatchApplyStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PatchChangeKind.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionGrantScope.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionProfile.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionProfileFileSystemPermissions.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionProfileModificationParams.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionProfileNetworkPermissions.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionProfileSelectionParams.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionsRequestApprovalParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PermissionsRequestApprovalResponse.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PlanDeltaNotification.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginAuthPolicy.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginAvailability.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginDetail.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginInstallParams.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginInstallPolicy.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginInstallResponse.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginInterface.d.ts +42 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginListMarketplaceKind.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginListParams.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginListResponse.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginMarketplaceEntry.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginReadParams.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginReadResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareContext.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareDeleteParams.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareDeleteResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareDiscoverability.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareListItem.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareListParams.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareListResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSharePrincipal.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSharePrincipalType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareSaveParams.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareSaveResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareTarget.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareUpdateTargetsParams.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginShareUpdateTargetsResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSkillReadParams.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSkillReadResponse.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSource.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginSummary.d.ts +25 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginUninstallParams.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginUninstallResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/PluginsMigration.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ProcessExitedNotification.d.ts +39 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ProcessOutputDeltaNotification.d.ts +23 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ProcessOutputStream.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ProcessTerminalSize.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ProfileV2.d.ts +29 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RateLimitReachedType.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RateLimitSnapshot.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RateLimitWindow.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RawResponseItemCompletedNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReasoningEffortOption.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReasoningSummaryPartAddedNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReasoningSummaryTextDeltaNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReasoningTextDeltaNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RemoteControlClientConnectionAudience.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RemoteControlClientEnrollmentAudience.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RemoteControlConnectionStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RemoteControlStatusChangedNotification.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/RequestPermissionProfile.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ResidencyRequirement.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReviewDelivery.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReviewStartParams.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReviewStartResponse.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ReviewTarget.d.ts +16 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SandboxMode.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SandboxPolicy.d.ts +17 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SandboxWorkspaceWrite.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SendAddCreditsNudgeEmailParams.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SendAddCreditsNudgeEmailResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ServerRequestResolvedNotification.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SessionMigration.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SessionSource.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillDependencies.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillErrorInfo.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillInterface.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillMetadata.d.ts +17 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillScope.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillSummary.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillToolDependency.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsChangedNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsConfigWriteParams.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsConfigWriteResponse.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsListEntry.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsListExtraRootsForCwd.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsListParams.d.ts +15 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SkillsListResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SortDirection.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/SubagentMigration.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TerminalInteractionNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TextElement.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TextPosition.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TextRange.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/Thread.d.ts +84 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadActiveFlag.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadApproveGuardianDeniedActionParams.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadApproveGuardianDeniedActionResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadArchiveParams.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadArchiveResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadArchivedNotification.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadClosedNotification.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadCompactStartParams.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadCompactStartResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadForkParams.d.ts +38 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadForkResponse.d.ts +26 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadGoal.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadGoalClearedNotification.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadGoalStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadGoalUpdatedNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadInjectItemsParams.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadInjectItemsResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadItem.d.ts +180 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadListParams.d.ts +51 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadListResponse.d.ts +16 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadLoadedListParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadLoadedListResponse.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadMetadataGitInfoUpdateParams.d.ts +17 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadMetadataUpdateParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadMetadataUpdateResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadNameUpdatedNotification.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadReadParams.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadReadResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeAudioChunk.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeClosedNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeErrorNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeItemAddedNotification.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeOutputAudioDeltaNotification.d.ts +8 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeSdpNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeStartTransport.d.ts +13 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeStartedNotification.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeTranscriptDeltaNotification.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRealtimeTranscriptDoneNotification.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadResumeParams.d.ts +37 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadResumeResponse.d.ts +26 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRollbackParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadRollbackResponse.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadSetNameParams.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadSetNameResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadShellCommandParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadShellCommandResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadSortKey.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadSource.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadSourceKind.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStartParams.d.ts +31 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStartResponse.d.ts +26 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStartSource.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStartedNotification.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStatus.d.ts +11 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadStatusChangedNotification.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadTokenUsage.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadTokenUsageUpdatedNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnarchiveParams.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnarchiveResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnarchivedNotification.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnsubscribeParams.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnsubscribeResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ThreadUnsubscribeStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TokenUsageBreakdown.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolRequestUserInputAnswer.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolRequestUserInputOption.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolRequestUserInputParams.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolRequestUserInputQuestion.d.ts +12 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolRequestUserInputResponse.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/ToolsV2.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/Turn.d.ts +32 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnCompletedNotification.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnDiffUpdatedNotification.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnEnvironmentParams.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnError.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnInterruptParams.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnInterruptResponse.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnItemsView.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnPlanStep.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnPlanStepStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnPlanUpdatedNotification.d.ts +7 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnStartParams.d.ts +44 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnStartResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnStartedNotification.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnSteerParams.d.ts +9 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/TurnSteerResponse.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/UserInput.d.ts +23 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WarningNotification.d.ts +10 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WebSearchAction.d.ts +14 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxReadiness.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxReadinessResponse.d.ts +4 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxSetupCompletedNotification.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxSetupMode.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxSetupStartParams.d.ts +6 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsSandboxSetupStartResponse.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WindowsWorldWritableWarningNotification.d.ts +5 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/WriteStatus.d.ts +1 -0
- package/dist/internal/codex/app-server-protocol/schema/typescript/v2/index.d.ts +457 -0
- package/dist/internal/codex/app-server-protocol/src/protocol/common.d.ts +36 -0
- package/dist/internal/codex/app-server-protocol/src/protocol/event-mapping.d.ts +41 -0
- package/dist/internal/codex/app-server-protocol/src/protocol/index.d.ts +3 -0
- package/dist/internal/codex/app-server-protocol/src/protocol/thread-resume.d.ts +11 -0
- package/dist/internal/codex/app-server-transport/src/outgoing_message.d.ts +27 -0
- package/dist/internal/codex/app-server-transport/src/transport/mod.d.ts +78 -0
- package/dist/internal/codex/codex-api/src/common.d.ts +100 -0
- package/dist/internal/codex/codex-api/src/endpoint/responses.d.ts +28 -0
- package/dist/internal/codex/codex-api/src/endpoint/responses_websocket.d.ts +54 -0
- package/dist/internal/codex/codex-api/src/error.d.ts +21 -0
- package/dist/internal/codex/codex-api/src/index.d.ts +9 -0
- package/dist/internal/codex/codex-api/src/provider.d.ts +22 -0
- package/dist/internal/codex/codex-api/src/rate_limits.d.ts +3 -0
- package/dist/internal/codex/codex-api/src/requests/responses.d.ts +16 -0
- package/dist/internal/codex/codex-api/src/sse/responses.d.ts +13 -0
- package/dist/internal/codex/codex-api/src/stream_events_utils.d.ts +23 -0
- package/dist/internal/codex/codex-mcp/src/auth_elicitation.d.ts +41 -0
- package/dist/internal/codex/codex-mcp/src/codex_apps.d.ts +57 -0
- package/dist/internal/codex/codex-mcp/src/connection_manager.d.ts +72 -0
- package/dist/internal/codex/codex-mcp/src/elicitation.d.ts +77 -0
- package/dist/internal/codex/codex-mcp/src/mcp/auth.d.ts +64 -0
- package/dist/internal/codex/codex-mcp/src/mcp/mod.d.ts +16 -0
- package/dist/internal/codex/codex-mcp/src/rmcp_client.d.ts +221 -0
- package/dist/internal/codex/codex-mcp/src/tools.d.ts +37 -0
- package/dist/internal/codex/config/src/config_toml.d.ts +14 -0
- package/dist/internal/codex/config/src/index.d.ts +7 -0
- package/dist/internal/codex/config/src/loader/mod.d.ts +21 -0
- package/dist/internal/codex/config/src/merge.d.ts +22 -0
- package/dist/internal/codex/config/src/permissions_toml.d.ts +6 -0
- package/dist/internal/codex/config/src/profile_toml.d.ts +1 -0
- package/dist/internal/codex/config/src/thread_config.d.ts +43 -0
- package/dist/internal/codex/config/src/types.d.ts +121 -0
- package/dist/internal/codex/core/src/agent/agent_resolver.d.ts +3 -0
- package/dist/internal/codex/core/src/agent/control.d.ts +76 -0
- package/dist/internal/codex/core/src/agent/mailbox.d.ts +28 -0
- package/dist/internal/codex/core/src/agent/mod.d.ts +6 -0
- package/dist/internal/codex/core/src/agent/registry.d.ts +54 -0
- package/dist/internal/codex/core/src/agent/role.d.ts +19 -0
- package/dist/internal/codex/core/src/agent/status.d.ts +3 -0
- package/dist/internal/codex/core/src/auth.d.ts +65 -0
- package/dist/internal/codex/core/src/client.d.ts +129 -0
- package/dist/internal/codex/core/src/collaboration-mode-presets.d.ts +9 -0
- package/dist/internal/codex/core/src/compact-task-runner.d.ts +18 -0
- package/dist/internal/codex/core/src/compact.d.ts +12 -0
- package/dist/internal/codex/core/src/config/agent_roles.d.ts +6 -0
- package/dist/internal/codex/core/src/config/managed_features.d.ts +7 -0
- package/dist/internal/codex/core/src/config/mod.d.ts +9 -0
- package/dist/internal/codex/core/src/config/network_proxy_spec.d.ts +5 -0
- package/dist/internal/codex/core/src/config/permissions.d.ts +30 -0
- package/dist/internal/codex/core/src/config-types.d.ts +28 -0
- package/dist/internal/codex/core/src/context/collaboration-mode-instructions.d.ts +10 -0
- package/dist/internal/codex/core/src/context/context-updates.d.ts +10 -0
- package/dist/internal/codex/core/src/context/environment-context.d.ts +24 -0
- package/dist/internal/codex/core/src/context/fragment.d.ts +22 -0
- package/dist/internal/codex/core/src/context/permissions-instructions.d.ts +8 -0
- package/dist/internal/codex/core/src/context/prompt-context.d.ts +8 -0
- package/dist/internal/codex/core/src/context/turn-aborted.d.ts +3 -0
- package/dist/internal/codex/core/src/context/user-instructions.d.ts +7 -0
- package/dist/internal/codex/core/src/context_manager/history.d.ts +60 -0
- package/dist/internal/codex/core/src/context_manager/normalize.d.ts +6 -0
- package/dist/internal/codex/core/src/event-mapping.d.ts +9 -0
- package/dist/internal/codex/core/src/exec-output.d.ts +20 -0
- package/dist/internal/codex/core/src/goals/index.d.ts +2 -0
- package/dist/internal/codex/core/src/goals/runtime.d.ts +32 -0
- package/dist/internal/codex/core/src/goals/types.d.ts +95 -0
- package/dist/internal/codex/core/src/goals.d.ts +1 -0
- package/dist/internal/codex/core/src/hooks/dispatcher.d.ts +5 -0
- package/dist/internal/codex/core/src/hooks/index.d.ts +4 -0
- package/dist/internal/codex/core/src/hooks/output-parser.d.ts +9 -0
- package/dist/internal/codex/core/src/hooks/runtime.d.ts +125 -0
- package/dist/internal/codex/core/src/hooks/types.d.ts +40 -0
- package/dist/internal/codex/core/src/ids.d.ts +5 -0
- package/dist/internal/codex/core/src/index.d.ts +98 -0
- package/dist/internal/codex/core/src/items.d.ts +137 -0
- package/dist/internal/codex/core/src/mcp/index.d.ts +10 -0
- package/dist/internal/codex/core/src/mcp/manager.d.ts +73 -0
- package/dist/internal/codex/core/src/mcp/types.d.ts +165 -0
- package/dist/internal/codex/core/src/mcp.d.ts +1 -0
- package/dist/internal/codex/core/src/memory.d.ts +21 -0
- package/dist/internal/codex/core/src/model-provider.d.ts +193 -0
- package/dist/internal/codex/core/src/models.d.ts +158 -0
- package/dist/internal/codex/core/src/plan-mode.d.ts +1 -0
- package/dist/internal/codex/core/src/protocol/dynamic_tools.d.ts +48 -0
- package/dist/internal/codex/core/src/protocol/user_input.d.ts +30 -0
- package/dist/internal/codex/core/src/protocol.d.ts +893 -0
- package/dist/internal/codex/core/src/rendered-thread.d.ts +30 -0
- package/dist/internal/codex/core/src/request_permissions.d.ts +52 -0
- package/dist/internal/codex/core/src/request_user_input.d.ts +47 -0
- package/dist/internal/codex/core/src/session/rollout-reconstruction.d.ts +11 -0
- package/dist/internal/codex/core/src/session/session-settings.d.ts +29 -0
- package/dist/internal/codex/core/src/session/session.d.ts +226 -0
- package/dist/internal/codex/core/src/session/turn-context.d.ts +71 -0
- package/dist/internal/codex/core/src/session/turn-timing.d.ts +12 -0
- package/dist/internal/codex/core/src/session/turn.d.ts +35 -0
- package/dist/internal/codex/core/src/state/session.d.ts +40 -0
- package/dist/internal/codex/core/src/state/turn.d.ts +83 -0
- package/dist/internal/codex/core/src/stream-parser.d.ts +36 -0
- package/dist/internal/codex/core/src/stream_events_utils.d.ts +43 -0
- package/dist/internal/codex/core/src/tasks/compact.d.ts +26 -0
- package/dist/internal/codex/core/src/tasks/mod.d.ts +43 -0
- package/dist/internal/codex/core/src/tasks/regular.d.ts +27 -0
- package/dist/internal/codex/core/src/templates.d.ts +12 -0
- package/dist/{thread-history-builder-zW0zeqcS.d.ts → internal/codex/core/src/thread-history-builder.d.ts} +14 -16
- package/dist/internal/codex/core/src/thread-store/index.d.ts +3 -0
- package/dist/{live-thread-BMvlflzM.d.ts → internal/codex/core/src/thread-store/live-thread.d.ts} +7 -8
- package/dist/{store-AGRxhgQ3.d.ts → internal/codex/core/src/thread-store/store.d.ts} +3 -6
- package/dist/{types-BTeabLYr.d.ts → internal/codex/core/src/thread-store/types.d.ts} +25 -26
- package/dist/internal/codex/core/src/tools/code_mode/execute_handler.d.ts +7 -0
- package/dist/internal/codex/core/src/tools/code_mode/execute_spec.d.ts +13 -0
- package/dist/internal/codex/core/src/tools/code_mode/mod.d.ts +5 -0
- package/dist/internal/codex/core/src/tools/code_mode/response_adapter.d.ts +2 -0
- package/dist/internal/codex/core/src/tools/code_mode/wait_handler.d.ts +7 -0
- package/dist/internal/codex/core/src/tools/code_mode/wait_spec.d.ts +13 -0
- package/dist/internal/codex/core/src/tools/context.d.ts +155 -0
- package/dist/internal/codex/core/src/tools/events.d.ts +50 -0
- package/dist/internal/codex/core/src/tools/handlers/apply_patch.d.ts +14 -0
- package/dist/internal/codex/core/src/tools/handlers/apply_patch_spec.d.ts +16 -0
- package/dist/internal/codex/core/src/tools/handlers/dynamic.d.ts +17 -0
- package/dist/internal/codex/core/src/tools/handlers/goal.d.ts +20 -0
- package/dist/internal/codex/core/src/tools/handlers/goal_spec.d.ts +51 -0
- package/dist/internal/codex/core/src/tools/handlers/mcp.d.ts +23 -0
- package/dist/internal/codex/core/src/tools/handlers/mcp_resource.d.ts +24 -0
- package/dist/internal/codex/core/src/tools/handlers/mcp_resource_spec.d.ts +61 -0
- package/dist/internal/codex/core/src/tools/handlers/multi_agents.d.ts +50 -0
- package/dist/internal/codex/core/src/tools/handlers/multi_agents_common.d.ts +3 -0
- package/dist/internal/codex/core/src/tools/handlers/multi_agents_spec.d.ts +5 -0
- package/dist/internal/codex/core/src/tools/handlers/multi_agents_v2.d.ts +1 -0
- package/dist/internal/codex/core/src/tools/handlers/plan.d.ts +8 -0
- package/dist/internal/codex/core/src/tools/handlers/plan_spec.d.ts +35 -0
- package/dist/internal/codex/core/src/tools/handlers/request_permissions.d.ts +7 -0
- package/dist/internal/codex/core/src/tools/handlers/request_permissions_spec.d.ts +1 -0
- package/dist/internal/codex/core/src/tools/handlers/request_plugin_install.d.ts +8 -0
- package/dist/internal/codex/core/src/tools/handlers/request_plugin_install_spec.d.ts +12 -0
- package/dist/internal/codex/core/src/tools/handlers/request_user_input.d.ts +13 -0
- package/dist/internal/codex/core/src/tools/handlers/request_user_input_spec.d.ts +1 -0
- package/dist/internal/codex/core/src/tools/handlers/shell_spec.d.ts +60 -0
- package/dist/internal/codex/core/src/tools/handlers/test_sync.d.ts +1 -0
- package/dist/internal/codex/core/src/tools/handlers/test_sync_spec.d.ts +12 -0
- package/dist/internal/codex/core/src/tools/handlers/tool_search.d.ts +28 -0
- package/dist/internal/codex/core/src/tools/handlers/tool_search_spec.d.ts +21 -0
- package/dist/internal/codex/core/src/tools/handlers/unavailable_tool.d.ts +10 -0
- package/dist/internal/codex/core/src/tools/handlers/unified_exec/exec_command.d.ts +13 -0
- package/dist/internal/codex/core/src/tools/handlers/unified_exec/write_stdin.d.ts +8 -0
- package/dist/internal/codex/core/src/tools/handlers/unified_exec.d.ts +2 -0
- package/dist/internal/codex/core/src/tools/hook_names.d.ts +6 -0
- package/dist/internal/codex/core/src/tools/hosted_spec.d.ts +9 -0
- package/dist/internal/codex/core/src/tools/network_approval.d.ts +11 -0
- package/dist/internal/codex/core/src/tools/orchestrator.d.ts +28 -0
- package/dist/internal/codex/core/src/tools/parallel.d.ts +33 -0
- package/dist/internal/codex/core/src/tools/registry.d.ts +27 -0
- package/dist/internal/codex/core/src/tools/responses_api.d.ts +34 -0
- package/dist/internal/codex/core/src/tools/router.d.ts +50 -0
- package/dist/internal/codex/core/src/tools/runtimes/apply_patch.d.ts +2 -0
- package/dist/internal/codex/core/src/tools/runtimes/mod.d.ts +4 -0
- package/dist/internal/codex/core/src/tools/runtimes/shell.d.ts +2 -0
- package/dist/internal/codex/core/src/tools/runtimes/unified_exec.d.ts +2 -0
- package/dist/internal/codex/core/src/tools/sandboxing.d.ts +36 -0
- package/dist/internal/codex/core/src/tools/spec.d.ts +10 -0
- package/dist/internal/codex/core/src/tools/spec_plan.d.ts +2 -0
- package/dist/internal/codex/core/src/tools/spec_plan_types.d.ts +93 -0
- package/dist/internal/codex/core/src/tools/tool_dispatch_trace.d.ts +12 -0
- package/dist/internal/codex/core/src/tools/tool_name.d.ts +17 -0
- package/dist/internal/codex/core/src/tools/tool_search_entry.d.ts +35 -0
- package/dist/internal/codex/core/src/tools/tool_spec.d.ts +29 -0
- package/dist/{mod-DYVLSWO4.d.ts → internal/codex/thread-store/src/in_memory.d.ts} +8 -39
- package/dist/internal/codex/thread-store/src/index.d.ts +6 -0
- package/dist/internal/codex/thread-store/src/local/mod.d.ts +32 -0
- package/dist/internal/codex/utils/output-truncation/src/lib.d.ts +19 -0
- package/dist/internal/codex/utils/string/src/lib.d.ts +1 -0
- package/dist/internal/codex/utils/string/src/truncate.d.ts +5 -0
- package/dist/runtime/index.d.ts +47 -0
- package/dist/server/index.d.ts +2 -29
- package/dist/server/index.js +20488 -15
- package/dist/testing/index.d.ts +2 -9
- package/dist/testing/index.js +1698 -15
- package/package.json +9 -100
- package/dist/ClientNotification-B6-FhXQf.d.ts +0 -5
- package/dist/DynamicToolCallResponse-82DFjES2.d.ts +0 -8
- package/dist/DynamicToolSpec-CfnhqAYK.d.ts +0 -29
- package/dist/PermissionsRequestApprovalResponse-DxzPPDRb.d.ts +0 -55
- package/dist/ProviderStatusBanner-BlP6lzwE.d.ts +0 -441
- package/dist/ServerRequest-B5cKVJjr.d.ts +0 -2181
- package/dist/ThreadResumeResponse-DvmE1juU.d.ts +0 -1542
- package/dist/ToolRequestUserInputQuestion-CeZa5X1J.d.ts +0 -23
- package/dist/ToolRequestUserInputResponse-zcPLwbiK.d.ts +0 -17
- package/dist/TurnSteerResponse-0kBCfplh.d.ts +0 -209
- package/dist/WebSearchToolConfig-D3ep0625.d.ts +0 -18
- package/dist/chat-runtime-B6azJyKo.d.ts +0 -381
- package/dist/chunk-2DZRMCI2.js +0 -1258
- package/dist/chunk-2DZRMCI2.js.map +0 -1
- package/dist/chunk-4DPLJPB5.js +0 -396
- package/dist/chunk-4DPLJPB5.js.map +0 -1
- package/dist/chunk-5JMJ6OI5.js +0 -3
- package/dist/chunk-5JMJ6OI5.js.map +0 -1
- package/dist/chunk-6ZMJ34KE.js +0 -1153
- package/dist/chunk-6ZMJ34KE.js.map +0 -1
- package/dist/chunk-CGBS37IU.js +0 -128
- package/dist/chunk-CGBS37IU.js.map +0 -1
- package/dist/chunk-DCMKA2A6.js +0 -18
- package/dist/chunk-DCMKA2A6.js.map +0 -1
- package/dist/chunk-DYLHN3HG.js +0 -937
- package/dist/chunk-DYLHN3HG.js.map +0 -1
- package/dist/chunk-FN3SWHRH.js +0 -934
- package/dist/chunk-FN3SWHRH.js.map +0 -1
- package/dist/chunk-ILXA6HLX.js +0 -1973
- package/dist/chunk-ILXA6HLX.js.map +0 -1
- package/dist/chunk-LWQNX4LI.js +0 -13755
- package/dist/chunk-LWQNX4LI.js.map +0 -1
- package/dist/chunk-NCI4MAWZ.js +0 -7733
- package/dist/chunk-NCI4MAWZ.js.map +0 -1
- package/dist/chunk-O44XP7LH.js +0 -214
- package/dist/chunk-O44XP7LH.js.map +0 -1
- package/dist/chunk-PST3ZWX2.js +0 -555
- package/dist/chunk-PST3ZWX2.js.map +0 -1
- package/dist/chunk-SYPHCDRD.js +0 -1133
- package/dist/chunk-SYPHCDRD.js.map +0 -1
- package/dist/chunk-V4BMZWBM.js +0 -2401
- package/dist/chunk-V4BMZWBM.js.map +0 -1
- package/dist/chunk-YHVCFD2D.js +0 -117
- package/dist/chunk-YHVCFD2D.js.map +0 -1
- package/dist/chunk-Z63UPBS3.js +0 -152
- package/dist/chunk-Z63UPBS3.js.map +0 -1
- package/dist/chunk-ZX5OIIJX.js +0 -3
- package/dist/chunk-ZX5OIIJX.js.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/codex-rs/app-server/index.d.ts +0 -161
- package/dist/codex-rs/app-server/index.js +0 -13
- package/dist/codex-rs/app-server/index.js.map +0 -1
- package/dist/codex-rs/app-server-protocol/index.d.ts +0 -1722
- package/dist/codex-rs/app-server-protocol/index.js +0 -6
- package/dist/codex-rs/app-server-protocol/index.js.map +0 -1
- package/dist/codex-rs/app-server-protocol/protocol.d.ts +0 -19
- package/dist/codex-rs/app-server-protocol/protocol.js +0 -4
- package/dist/codex-rs/app-server-protocol/protocol.js.map +0 -1
- package/dist/codex-rs/codex-api/index.d.ts +0 -104
- package/dist/codex-rs/codex-api/index.js +0 -11
- package/dist/codex-rs/codex-api/index.js.map +0 -1
- package/dist/codex-rs/config/index.d.ts +0 -88
- package/dist/codex-rs/config/index.js +0 -4
- package/dist/codex-rs/config/index.js.map +0 -1
- package/dist/codex-rs/core/config/index.d.ts +0 -61
- package/dist/codex-rs/core/config/index.js +0 -5
- package/dist/codex-rs/core/config/index.js.map +0 -1
- package/dist/codex-rs/core/index.d.ts +0 -1393
- package/dist/codex-rs/core/index.js +0 -11
- package/dist/codex-rs/core/index.js.map +0 -1
- package/dist/codex-rs/model-provider/index.d.ts +0 -2
- package/dist/codex-rs/model-provider/index.js +0 -4
- package/dist/codex-rs/model-provider/index.js.map +0 -1
- package/dist/codex-rs/models-manager/index.d.ts +0 -2
- package/dist/codex-rs/models-manager/index.js +0 -4
- package/dist/codex-rs/models-manager/index.js.map +0 -1
- package/dist/codex-rs/parity.d.ts +0 -26
- package/dist/codex-rs/parity.js +0 -3
- package/dist/codex-rs/parity.js.map +0 -1
- package/dist/codex-rs/thread-store/index.d.ts +0 -5
- package/dist/codex-rs/thread-store/index.js +0 -4
- package/dist/codex-rs/thread-store/index.js.map +0 -1
- package/dist/codex-rs/unsupported.d.ts +0 -15
- package/dist/codex-rs/unsupported.js +0 -22
- package/dist/codex-rs/unsupported.js.map +0 -1
- package/dist/codex-rs/utils/output-truncation.d.ts +0 -21
- package/dist/codex-rs/utils/output-truncation.js +0 -4
- package/dist/codex-rs/utils/output-truncation.js.map +0 -1
- package/dist/codex-rs/utils/string.d.ts +0 -7
- package/dist/codex-rs/utils/string.js +0 -3
- package/dist/codex-rs/utils/string.js.map +0 -1
- package/dist/common-CTyph5x8.d.ts +0 -40
- package/dist/event-mapping-CbISdQ1D.d.ts +0 -43
- package/dist/history-CfM-4V7b.d.ts +0 -1654
- package/dist/index-CoDZosq0.d.ts +0 -261
- package/dist/index.js.map +0 -1
- package/dist/lib-nXlaKiS-.d.ts +0 -48
- package/dist/merge-B_AWVmnI.d.ts +0 -24
- package/dist/plan-mode-Cv6KWb_S.d.ts +0 -14
- package/dist/proposed-plan-DpN1ma0Y.d.ts +0 -53
- package/dist/protocol-mpBcYHrm.d.ts +0 -1655
- package/dist/react/index.d.ts +0 -41
- package/dist/react/index.js +0 -19
- package/dist/react/index.js.map +0 -1
- package/dist/remote-ClZbq9KN.d.ts +0 -21
- package/dist/rendered-thread-AOxw3V5b.d.ts +0 -29
- package/dist/responses_websocket-BhxSgCzK.d.ts +0 -183
- package/dist/runtime-Cm6ml53h.d.ts +0 -528
- package/dist/server/index.js.map +0 -1
- package/dist/shadcn/index.d.ts +0 -68
- package/dist/shadcn/index.js +0 -334
- package/dist/shadcn/index.js.map +0 -1
- package/dist/sidebar-DMMij22z.d.ts +0 -87
- package/dist/spec_plan_types-CmsJ-Tfn.d.ts +0 -260
- package/dist/styles.css +0 -1
- package/dist/t3code/apps/web/components/chat.d.ts +0 -508
- package/dist/t3code/apps/web/components/chat.js +0 -12
- package/dist/t3code/apps/web/components/chat.js.map +0 -1
- package/dist/t3code/apps/web/index.d.ts +0 -12
- package/dist/t3code/apps/web/index.js +0 -13
- package/dist/t3code/apps/web/index.js.map +0 -1
- package/dist/testing/index.js.map +0 -1
package/dist/testing/index.js
CHANGED
|
@@ -1,15 +1,1698 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
// src/internal/codex/core/src/event-mapping.ts
|
|
2
|
+
function isContextualUserMessageContent(message) {
|
|
3
|
+
return message.some(isContextualUserFragment);
|
|
4
|
+
}
|
|
5
|
+
function parseUserMessage(id, message) {
|
|
6
|
+
if (isContextualUserMessageContent(message)) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const content = [];
|
|
10
|
+
for (const [index, contentItem] of message.entries()) {
|
|
11
|
+
if (contentItem.type === "input_text") {
|
|
12
|
+
if ((isLocalImageOpenTagText(contentItem.text) || isImageOpenTagText(contentItem.text)) && message[index + 1]?.type === "input_image" || index > 0 && (isLocalImageCloseTagText(contentItem.text) || isImageCloseTagText(contentItem.text)) && message[index - 1]?.type === "input_image") {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
content.push({
|
|
16
|
+
type: "text",
|
|
17
|
+
text: contentItem.text,
|
|
18
|
+
text_elements: []
|
|
19
|
+
});
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (contentItem.type === "input_image") {
|
|
23
|
+
content.push({
|
|
24
|
+
type: "image",
|
|
25
|
+
image_url: contentItem.image_url
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
type: "UserMessage",
|
|
31
|
+
id: id ?? "",
|
|
32
|
+
content
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function parseAgentMessage(id, message, phase) {
|
|
36
|
+
const content = [];
|
|
37
|
+
for (const contentItem of message) {
|
|
38
|
+
if (contentItem.type === "input_text" || contentItem.type === "output_text") {
|
|
39
|
+
content.push({ type: "Text", text: contentItem.text });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
type: "AgentMessage",
|
|
44
|
+
id: id ?? "",
|
|
45
|
+
content,
|
|
46
|
+
phase: phase ?? null,
|
|
47
|
+
memory_citation: null
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function parseVisibleHookPromptMessage(id, message) {
|
|
51
|
+
const fragments = [];
|
|
52
|
+
for (const contentItem of message) {
|
|
53
|
+
if (contentItem.type !== "input_text") {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const fragment = parseHookPromptFragment(contentItem.text);
|
|
57
|
+
if (fragment) {
|
|
58
|
+
fragments.push(fragment);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (isStandardContextualUserText(contentItem.text)) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
if (fragments.length === 0) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
type: "HookPrompt",
|
|
71
|
+
id: id ?? "",
|
|
72
|
+
fragments
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function parseTurnItem(item) {
|
|
76
|
+
switch (item.type) {
|
|
77
|
+
case "message":
|
|
78
|
+
if (item.role === "user") {
|
|
79
|
+
return parseVisibleHookPromptMessage(item.id, item.content) ?? parseUserMessage(item.id, item.content);
|
|
80
|
+
}
|
|
81
|
+
if (item.role === "assistant" || !item.role) {
|
|
82
|
+
return parseAgentMessage(item.id, item.content, item.phase);
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
case "reasoning":
|
|
86
|
+
return parseReasoningItem(item);
|
|
87
|
+
case "web_search_call":
|
|
88
|
+
return parseWebSearchCall(item);
|
|
89
|
+
case "image_generation_call":
|
|
90
|
+
return parseImageGenerationCall(item);
|
|
91
|
+
default:
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function parseReasoningItem(item) {
|
|
96
|
+
return {
|
|
97
|
+
type: "Reasoning",
|
|
98
|
+
id: item.id ?? "",
|
|
99
|
+
summary_text: item.summary.flatMap((entry) => {
|
|
100
|
+
if (typeof entry.text === "string") {
|
|
101
|
+
return [entry.text];
|
|
102
|
+
}
|
|
103
|
+
return [];
|
|
104
|
+
}),
|
|
105
|
+
raw_content: (item.content ?? []).flatMap((entry) => {
|
|
106
|
+
if ((entry.type === "reasoning_text" || entry.type === "text") && typeof entry.text === "string") {
|
|
107
|
+
return [entry.text];
|
|
108
|
+
}
|
|
109
|
+
return [];
|
|
110
|
+
})
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function parseWebSearchCall(item) {
|
|
114
|
+
const action = webSearchActionFromRecord(item.action);
|
|
115
|
+
return {
|
|
116
|
+
type: "WebSearch",
|
|
117
|
+
id: item.id ?? "",
|
|
118
|
+
query: webSearchActionDetail(action),
|
|
119
|
+
action
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function parseImageGenerationCall(item) {
|
|
123
|
+
return {
|
|
124
|
+
type: "ImageGeneration",
|
|
125
|
+
id: item.id,
|
|
126
|
+
status: item.status,
|
|
127
|
+
revised_prompt: item.revised_prompt ?? void 0,
|
|
128
|
+
result: item.result,
|
|
129
|
+
saved_path: item.saved_path
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function webSearchActionFromRecord(action) {
|
|
133
|
+
if (!action) {
|
|
134
|
+
return { type: "other" };
|
|
135
|
+
}
|
|
136
|
+
if (action.type === "search") {
|
|
137
|
+
return {
|
|
138
|
+
type: "search",
|
|
139
|
+
...typeof action.query === "string" ? { query: action.query } : {},
|
|
140
|
+
...Array.isArray(action.queries) ? { queries: action.queries.filter(isString) } : {}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (action.type === "open_page") {
|
|
144
|
+
return {
|
|
145
|
+
type: "open_page",
|
|
146
|
+
...typeof action.url === "string" ? { url: action.url } : {}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
if (action.type === "find_in_page") {
|
|
150
|
+
return {
|
|
151
|
+
type: "find_in_page",
|
|
152
|
+
...typeof action.url === "string" ? { url: action.url } : {},
|
|
153
|
+
...typeof action.pattern === "string" ? { pattern: action.pattern } : {}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return { type: "other" };
|
|
157
|
+
}
|
|
158
|
+
function webSearchActionDetail(action) {
|
|
159
|
+
switch (action.type) {
|
|
160
|
+
case "search":
|
|
161
|
+
return action.query ?? action.queries?.join(", ") ?? "";
|
|
162
|
+
case "open_page":
|
|
163
|
+
return action.url ?? "";
|
|
164
|
+
case "find_in_page": {
|
|
165
|
+
const pattern = action.pattern ?? "";
|
|
166
|
+
const url = action.url ?? "";
|
|
167
|
+
return pattern && url ? `'${pattern}' in ${url}` : pattern || url;
|
|
168
|
+
}
|
|
169
|
+
case "other":
|
|
170
|
+
return "";
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function isContextualUserFragment(contentItem) {
|
|
174
|
+
return contentItem.type === "input_text" && (parseHookPromptFragment(contentItem.text) !== null || isStandardContextualUserText(contentItem.text));
|
|
175
|
+
}
|
|
176
|
+
function isStandardContextualUserText(text) {
|
|
177
|
+
const trimmed = text.trimStart();
|
|
178
|
+
return trimmed.startsWith("# AGENTS.md instructions for ") || trimmed.startsWith("<environment_context>") || trimmed.startsWith("<skill>") || trimmed.startsWith("<user_shell_command>") || trimmed.startsWith("<turn_aborted>") || trimmed.startsWith("<thread_goal_budget_limit>") || trimmed.startsWith("<subagent_notification>");
|
|
179
|
+
}
|
|
180
|
+
function parseHookPromptFragment(text) {
|
|
181
|
+
const trimmed = text.trim();
|
|
182
|
+
const match = trimmed.match(
|
|
183
|
+
/^<hook_prompt\s+hook_run_id=(["'])(.*?)\1>([\s\S]*)<\/hook_prompt>$/u
|
|
184
|
+
);
|
|
185
|
+
if (!match) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
const hookRunId = decodeXmlEntities(match[2] ?? "").trim();
|
|
189
|
+
if (!hookRunId) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
hookRunId,
|
|
194
|
+
text: decodeXmlEntities(match[3] ?? "")
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function isImageOpenTagText(text) {
|
|
198
|
+
return text === "<image>";
|
|
199
|
+
}
|
|
200
|
+
function isImageCloseTagText(text) {
|
|
201
|
+
return text === "</image>";
|
|
202
|
+
}
|
|
203
|
+
function isLocalImageOpenTagText(text) {
|
|
204
|
+
return text.startsWith("<image name=") && text.endsWith(">");
|
|
205
|
+
}
|
|
206
|
+
function isLocalImageCloseTagText(text) {
|
|
207
|
+
return isImageCloseTagText(text);
|
|
208
|
+
}
|
|
209
|
+
function decodeXmlEntities(value) {
|
|
210
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll(""", '"').replaceAll("'", "'");
|
|
211
|
+
}
|
|
212
|
+
function isString(value) {
|
|
213
|
+
return typeof value === "string";
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// src/internal/codex/core/src/thread-history-builder.ts
|
|
217
|
+
var ThreadHistoryBuilder = class _ThreadHistoryBuilder {
|
|
218
|
+
turns = [];
|
|
219
|
+
next_item_index = 1;
|
|
220
|
+
static fromTurns(turns) {
|
|
221
|
+
const builder = new _ThreadHistoryBuilder();
|
|
222
|
+
builder.turns = turns.map((turn) => ({
|
|
223
|
+
...cloneTurn(turn),
|
|
224
|
+
opened_explicitly: true
|
|
225
|
+
}));
|
|
226
|
+
builder.next_item_index = nextItemIndexFromTurns(turns);
|
|
227
|
+
return builder;
|
|
228
|
+
}
|
|
229
|
+
handle_rollout_item(item, index = this.next_item_index) {
|
|
230
|
+
if (item.type === "event_msg") {
|
|
231
|
+
this.handle_event(item.payload, `rollout-${index}`);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (item.type === "response_item") {
|
|
235
|
+
this.handle_response_item(item.payload, `response-${index}`);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (item.type === "compacted") {
|
|
239
|
+
this.append_to_current_turn({
|
|
240
|
+
type: "ContextCompaction",
|
|
241
|
+
id: `compacted-${index}`
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
handle_event(event, eventId = `event-${this.next_item_index}`) {
|
|
246
|
+
switch (event.type) {
|
|
247
|
+
case "turn_started":
|
|
248
|
+
this.open_explicit_turn(event.turn_id);
|
|
249
|
+
if (event.started_at !== void 0 && event.started_at !== null) {
|
|
250
|
+
const turn = this.turn_by_id(event.turn_id);
|
|
251
|
+
if (turn) {
|
|
252
|
+
turn.started_at = event.started_at;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return;
|
|
256
|
+
case "turn_complete":
|
|
257
|
+
this.complete_turn(event.turn_id, {
|
|
258
|
+
status: "completed",
|
|
259
|
+
completed_at: event.completed_at ?? null,
|
|
260
|
+
duration_ms: event.duration_ms ?? null
|
|
261
|
+
});
|
|
262
|
+
return;
|
|
263
|
+
case "turn_aborted":
|
|
264
|
+
this.complete_turn(event.turn_id, {
|
|
265
|
+
status: "interrupted",
|
|
266
|
+
completed_at: event.completed_at ?? event.aborted_at ?? null,
|
|
267
|
+
duration_ms: event.duration_ms ?? null
|
|
268
|
+
});
|
|
269
|
+
return;
|
|
270
|
+
case "user_message":
|
|
271
|
+
this.append_user_message(userMessageTurnItem(event, userMessageId(eventId)), {
|
|
272
|
+
replaceDuplicate: true
|
|
273
|
+
});
|
|
274
|
+
return;
|
|
275
|
+
case "agent_message":
|
|
276
|
+
this.upsert_agent_message({
|
|
277
|
+
type: "AgentMessage",
|
|
278
|
+
id: agentMessageId(eventId),
|
|
279
|
+
content: [{ type: "Text", text: event.message }],
|
|
280
|
+
phase: event.phase ?? null,
|
|
281
|
+
memory_citation: event.memory_citation ?? null
|
|
282
|
+
});
|
|
283
|
+
return;
|
|
284
|
+
case "item_started":
|
|
285
|
+
this.upsert_item_in_turn(event.turn_id, event.item, {
|
|
286
|
+
started: true
|
|
287
|
+
});
|
|
288
|
+
return;
|
|
289
|
+
case "item_completed":
|
|
290
|
+
this.upsert_item_in_turn(event.turn_id, completedItem(event.item));
|
|
291
|
+
return;
|
|
292
|
+
case "agent_message_content_delta":
|
|
293
|
+
this.apply_agent_message_delta(event.item_id, event.delta);
|
|
294
|
+
return;
|
|
295
|
+
case "plan_delta":
|
|
296
|
+
this.apply_plan_delta(event.item_id, event.delta);
|
|
297
|
+
return;
|
|
298
|
+
case "exec_command_begin":
|
|
299
|
+
this.upsert_item_in_turn(event.turn_id, {
|
|
300
|
+
type: "CommandExecution",
|
|
301
|
+
id: event.call_id,
|
|
302
|
+
command: event.command,
|
|
303
|
+
cwd: event.cwd,
|
|
304
|
+
status: "in_progress"
|
|
305
|
+
});
|
|
306
|
+
return;
|
|
307
|
+
case "exec_command_output_delta":
|
|
308
|
+
this.apply_exec_command_output_delta(event);
|
|
309
|
+
return;
|
|
310
|
+
case "exec_command_end":
|
|
311
|
+
this.apply_exec_command_end(event);
|
|
312
|
+
return;
|
|
313
|
+
case "patch_apply_updated":
|
|
314
|
+
this.upsert_item_in_current_or_existing_turn(event.call_id, {
|
|
315
|
+
type: "FileChange",
|
|
316
|
+
id: event.call_id,
|
|
317
|
+
changes: event.changes,
|
|
318
|
+
status: event.status ?? null,
|
|
319
|
+
auto_approved: false,
|
|
320
|
+
stdout: event.stdout ?? "",
|
|
321
|
+
stderr: event.stderr ?? ""
|
|
322
|
+
});
|
|
323
|
+
return;
|
|
324
|
+
case "dynamic_tool_call_request":
|
|
325
|
+
this.upsert_item_in_turn(event.turn_id, dynamicToolRequestTurnItem(event));
|
|
326
|
+
return;
|
|
327
|
+
case "dynamic_tool_call_response":
|
|
328
|
+
this.upsert_item_in_turn(event.turn_id, {
|
|
329
|
+
type: "DynamicToolCall",
|
|
330
|
+
id: event.call_id,
|
|
331
|
+
namespace: event.namespace ?? null,
|
|
332
|
+
tool: event.tool,
|
|
333
|
+
arguments: event.arguments,
|
|
334
|
+
status: event.success ? "completed" : "failed",
|
|
335
|
+
content_items: event.content_items,
|
|
336
|
+
success: event.success,
|
|
337
|
+
duration: event.duration
|
|
338
|
+
});
|
|
339
|
+
return;
|
|
340
|
+
case "mcp_tool_call_progress":
|
|
341
|
+
this.upsert_item_in_turn(event.turn_id, {
|
|
342
|
+
type: "McpToolCall",
|
|
343
|
+
id: event.call_id,
|
|
344
|
+
server: event.server_name,
|
|
345
|
+
tool: event.tool_name,
|
|
346
|
+
arguments: {},
|
|
347
|
+
status: "inProgress",
|
|
348
|
+
result: event.progress ?? event.message ?? null
|
|
349
|
+
});
|
|
350
|
+
return;
|
|
351
|
+
case "image_generation_end":
|
|
352
|
+
this.upsert_item_in_current_or_existing_turn(
|
|
353
|
+
event.call_id,
|
|
354
|
+
imageGenerationTurnItem(event, eventId)
|
|
355
|
+
);
|
|
356
|
+
return;
|
|
357
|
+
case "error": {
|
|
358
|
+
const turn = this.active_turn();
|
|
359
|
+
if (turn) {
|
|
360
|
+
turn.status = "failed";
|
|
361
|
+
turn.error = {
|
|
362
|
+
message: event.message,
|
|
363
|
+
codex_error_info: event.codex_error_info ?? null
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
default:
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
handle_response_item(item, id) {
|
|
373
|
+
const turnItem = parseTurnItem(item);
|
|
374
|
+
if (!turnItem) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const itemWithFallbackId = turnItem.id.length > 0 ? turnItem : { ...turnItem, id };
|
|
378
|
+
if (itemWithFallbackId.type === "AgentMessage") {
|
|
379
|
+
this.upsert_agent_message(itemWithFallbackId);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (itemWithFallbackId.type === "UserMessage") {
|
|
383
|
+
this.append_user_message(itemWithFallbackId, {
|
|
384
|
+
replaceDuplicate: false
|
|
385
|
+
});
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
this.append_to_current_turn(itemWithFallbackId);
|
|
389
|
+
}
|
|
390
|
+
active_turn_snapshot() {
|
|
391
|
+
const turn = this.active_turn();
|
|
392
|
+
return turn ? stripInternalTurn(turn) : null;
|
|
393
|
+
}
|
|
394
|
+
active_turn_position() {
|
|
395
|
+
const turn = this.active_turn();
|
|
396
|
+
return turn ? this.turns.indexOf(turn) : null;
|
|
397
|
+
}
|
|
398
|
+
finish() {
|
|
399
|
+
return this.turns.map(stripInternalTurn);
|
|
400
|
+
}
|
|
401
|
+
has_active_turn() {
|
|
402
|
+
return this.active_turn() !== null;
|
|
403
|
+
}
|
|
404
|
+
reset() {
|
|
405
|
+
this.turns = [];
|
|
406
|
+
this.next_item_index = 1;
|
|
407
|
+
}
|
|
408
|
+
open_explicit_turn(turnId) {
|
|
409
|
+
const existing = this.turns.find((turn) => turn.id === turnId);
|
|
410
|
+
if (existing) {
|
|
411
|
+
existing.status = "in_progress";
|
|
412
|
+
existing.opened_explicitly = true;
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
this.turns.push(newTurn(turnId, true));
|
|
416
|
+
}
|
|
417
|
+
complete_turn(turnId, input) {
|
|
418
|
+
const turn = this.turn_by_id(turnId) ?? this.ensure_turn(turnId, true);
|
|
419
|
+
turn.status = input.status;
|
|
420
|
+
turn.completed_at = input.completed_at;
|
|
421
|
+
turn.duration_ms = input.duration_ms;
|
|
422
|
+
}
|
|
423
|
+
append_user_message(item, options) {
|
|
424
|
+
const active = this.active_turn();
|
|
425
|
+
if (!active || !active.opened_explicitly && active.items.length > 0) {
|
|
426
|
+
this.turns.push(newTurn(`turn-${this.turns.length + 1}`, false));
|
|
427
|
+
}
|
|
428
|
+
const turn = this.active_turn() ?? this.ensure_turn();
|
|
429
|
+
const lastItem = turn.items.at(-1);
|
|
430
|
+
if (lastItem?.type === "UserMessage" && userMessageFingerprint(lastItem) === userMessageFingerprint(item)) {
|
|
431
|
+
if (options.replaceDuplicate) {
|
|
432
|
+
turn.items[turn.items.length - 1] = item;
|
|
433
|
+
}
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
turn.items.push(item);
|
|
437
|
+
}
|
|
438
|
+
upsert_agent_message(item) {
|
|
439
|
+
const turn = this.ensure_turn();
|
|
440
|
+
const lastItem = turn.items.at(-1);
|
|
441
|
+
if (item.phase === "streaming") {
|
|
442
|
+
if (lastItem?.type === "AgentMessage" && lastItem.phase === "streaming") {
|
|
443
|
+
turn.items[turn.items.length - 1] = { ...item, id: lastItem.id };
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
turn.items.push({ ...item, id: `streaming-${item.id}` });
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (lastItem?.type === "AgentMessage" && lastItem.phase === "streaming") {
|
|
450
|
+
turn.items[turn.items.length - 1] = { ...item, id: lastItem.id };
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (lastItem?.type === "AgentMessage" && agentMessageText(lastItem) === agentMessageText(item)) {
|
|
454
|
+
turn.items[turn.items.length - 1] = { ...item, id: lastItem.id };
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
turn.items.push(item);
|
|
458
|
+
}
|
|
459
|
+
upsert_item_in_turn(turnId, item, options = {}) {
|
|
460
|
+
const turn = turnId ? this.ensure_turn(turnId, true) : this.ensure_turn();
|
|
461
|
+
upsertItem(turn, options.started ? startedItem(item) : item);
|
|
462
|
+
}
|
|
463
|
+
upsert_item_in_current_or_existing_turn(itemId, item) {
|
|
464
|
+
const existingTurn = this.turns.find(
|
|
465
|
+
(turn) => turn.items.some((candidate) => candidate.id === itemId)
|
|
466
|
+
);
|
|
467
|
+
upsertItem(existingTurn ?? this.ensure_turn(), item);
|
|
468
|
+
}
|
|
469
|
+
append_to_current_turn(item) {
|
|
470
|
+
this.ensure_turn().items.push(item);
|
|
471
|
+
}
|
|
472
|
+
apply_agent_message_delta(itemId, delta) {
|
|
473
|
+
const existing = this.find_item(itemId);
|
|
474
|
+
if (!existing || existing.item.type !== "AgentMessage") {
|
|
475
|
+
this.append_to_current_turn({
|
|
476
|
+
type: "AgentMessage",
|
|
477
|
+
id: itemId,
|
|
478
|
+
content: [{ type: "Text", text: delta }],
|
|
479
|
+
phase: "streaming",
|
|
480
|
+
memory_citation: null
|
|
481
|
+
});
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const item = existing.item;
|
|
485
|
+
const lastContent = item.content.at(-1);
|
|
486
|
+
const nextContent = lastContent?.type === "Text" ? [
|
|
487
|
+
...item.content.slice(0, -1),
|
|
488
|
+
{ type: "Text", text: `${lastContent.text}${delta}` }
|
|
489
|
+
] : [...item.content, { type: "Text", text: delta }];
|
|
490
|
+
existing.turn.items[existing.index] = {
|
|
491
|
+
...item,
|
|
492
|
+
content: nextContent,
|
|
493
|
+
phase: "streaming"
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
apply_plan_delta(itemId, delta) {
|
|
497
|
+
const existing = this.find_item(itemId);
|
|
498
|
+
if (!existing || existing.item.type !== "Plan") {
|
|
499
|
+
this.append_to_current_turn({ type: "Plan", id: itemId, text: delta });
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
existing.turn.items[existing.index] = {
|
|
503
|
+
...existing.item,
|
|
504
|
+
text: `${existing.item.text}${delta}`
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
apply_exec_command_output_delta(msg) {
|
|
508
|
+
const existing = this.find_item(msg.call_id);
|
|
509
|
+
if (!existing || existing.item.type !== "CommandExecution") {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
existing.turn.items[existing.index] = {
|
|
513
|
+
...existing.item,
|
|
514
|
+
stdout: msg.stream === "stdout" ? `${existing.item.stdout ?? ""}${msg.chunk}` : existing.item.stdout,
|
|
515
|
+
stderr: msg.stream === "stderr" ? `${existing.item.stderr ?? ""}${msg.chunk}` : existing.item.stderr
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
apply_exec_command_end(msg) {
|
|
519
|
+
const existing = this.find_item(msg.call_id);
|
|
520
|
+
const item = existing?.item.type === "CommandExecution" ? existing.item : null;
|
|
521
|
+
const turn = msg.turn_id ? this.ensure_turn(msg.turn_id, true) : existing?.turn ?? this.ensure_turn();
|
|
522
|
+
upsertItem(turn, {
|
|
523
|
+
type: "CommandExecution",
|
|
524
|
+
id: msg.call_id,
|
|
525
|
+
command: item?.command ?? [],
|
|
526
|
+
cwd: item?.cwd ?? "",
|
|
527
|
+
status: msg.status === "completed" ? "completed" : msg.status === "cancelled" ? "cancelled" : "failed",
|
|
528
|
+
stdout: msg.stdout ?? msg.output?.stdout.text ?? item?.stdout ?? "",
|
|
529
|
+
stderr: msg.stderr ?? msg.output?.stderr.text ?? item?.stderr ?? "",
|
|
530
|
+
exit_code: msg.exit_code,
|
|
531
|
+
duration_ms: msg.duration_ms ?? msg.output?.duration_ms ?? null
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
ensure_turn(id, explicit = false) {
|
|
535
|
+
if (id) {
|
|
536
|
+
const existing = this.turn_by_id(id);
|
|
537
|
+
if (existing) {
|
|
538
|
+
return existing;
|
|
539
|
+
}
|
|
540
|
+
const turn2 = newTurn(id, explicit);
|
|
541
|
+
this.turns.push(turn2);
|
|
542
|
+
return turn2;
|
|
543
|
+
}
|
|
544
|
+
const active = this.active_turn();
|
|
545
|
+
if (active) {
|
|
546
|
+
return active;
|
|
547
|
+
}
|
|
548
|
+
const turn = newTurn(`turn-${this.turns.length + 1}`, false);
|
|
549
|
+
this.turns.push(turn);
|
|
550
|
+
return turn;
|
|
551
|
+
}
|
|
552
|
+
active_turn() {
|
|
553
|
+
for (let index = this.turns.length - 1; index >= 0; index -= 1) {
|
|
554
|
+
const turn = this.turns[index];
|
|
555
|
+
if (turn?.status === "in_progress") {
|
|
556
|
+
return turn;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return null;
|
|
560
|
+
}
|
|
561
|
+
turn_by_id(id) {
|
|
562
|
+
return this.turns.find((turn) => turn.id === id) ?? null;
|
|
563
|
+
}
|
|
564
|
+
find_item(itemId) {
|
|
565
|
+
for (const turn of this.turns) {
|
|
566
|
+
const index = turn.items.findIndex((item) => item.id === itemId);
|
|
567
|
+
if (index !== -1) {
|
|
568
|
+
return { turn, item: turn.items[index], index };
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
function flattenTurnsToTurnItems(turns) {
|
|
575
|
+
return turns.flatMap((turn) => turn.items);
|
|
576
|
+
}
|
|
577
|
+
function applyEventToTurns(turns, event, eventId) {
|
|
578
|
+
const builder = ThreadHistoryBuilder.fromTurns(turns);
|
|
579
|
+
builder.handle_event(event, eventId);
|
|
580
|
+
return builder.finish();
|
|
581
|
+
}
|
|
582
|
+
function applyResponseItemToTurns(turns, item, id) {
|
|
583
|
+
const builder = ThreadHistoryBuilder.fromTurns(turns);
|
|
584
|
+
builder.handle_response_item(item, id);
|
|
585
|
+
return builder.finish();
|
|
586
|
+
}
|
|
587
|
+
function appendCompactionTurnToTurns(turns, id) {
|
|
588
|
+
const builder = ThreadHistoryBuilder.fromTurns(turns);
|
|
589
|
+
builder.handle_rollout_item({ type: "compacted", payload: { message: "" } }, 0);
|
|
590
|
+
const next = builder.finish();
|
|
591
|
+
const last = next.at(-1);
|
|
592
|
+
if (last?.items.at(-1)?.type === "ContextCompaction") {
|
|
593
|
+
last.items[last.items.length - 1] = { type: "ContextCompaction", id };
|
|
594
|
+
}
|
|
595
|
+
return next;
|
|
596
|
+
}
|
|
597
|
+
function newTurn(id, openedExplicitly) {
|
|
598
|
+
return {
|
|
599
|
+
id,
|
|
600
|
+
items: [],
|
|
601
|
+
items_view: "full",
|
|
602
|
+
status: "in_progress",
|
|
603
|
+
error: null,
|
|
604
|
+
started_at: null,
|
|
605
|
+
completed_at: null,
|
|
606
|
+
duration_ms: null,
|
|
607
|
+
opened_explicitly: openedExplicitly
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
function stripInternalTurn(turn) {
|
|
611
|
+
const { opened_explicitly, ...publicTurn } = turn;
|
|
612
|
+
return cloneTurn(publicTurn);
|
|
613
|
+
}
|
|
614
|
+
function cloneTurn(turn) {
|
|
615
|
+
return {
|
|
616
|
+
...turn,
|
|
617
|
+
items: turn.items.map((item) => structuredClone(item)),
|
|
618
|
+
error: turn.error ? { ...turn.error } : null
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
function nextItemIndexFromTurns(turns) {
|
|
622
|
+
return turns.reduce((count, turn) => count + turn.items.length, 0) + 1;
|
|
623
|
+
}
|
|
624
|
+
function upsertItem(turn, item) {
|
|
625
|
+
const index = turn.items.findIndex((candidate) => candidate.id === item.id);
|
|
626
|
+
if (index === -1) {
|
|
627
|
+
turn.items.push(item);
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
turn.items[index] = item;
|
|
631
|
+
}
|
|
632
|
+
function startedItem(item) {
|
|
633
|
+
return item.type === "AgentMessage" ? { ...item, phase: item.phase ?? "streaming" } : item;
|
|
634
|
+
}
|
|
635
|
+
function completedItem(item) {
|
|
636
|
+
return item.type === "AgentMessage" ? { ...item, phase: item.phase ?? null } : item;
|
|
637
|
+
}
|
|
638
|
+
function dynamicToolRequestTurnItem(request) {
|
|
639
|
+
return {
|
|
640
|
+
type: "DynamicToolCall",
|
|
641
|
+
id: request.call_id,
|
|
642
|
+
namespace: request.namespace ?? null,
|
|
643
|
+
tool: request.tool,
|
|
644
|
+
arguments: request.arguments,
|
|
645
|
+
status: "inProgress",
|
|
646
|
+
content_items: null,
|
|
647
|
+
success: null,
|
|
648
|
+
duration: null
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
function userMessageId(eventId) {
|
|
652
|
+
return `user-${eventId}`;
|
|
653
|
+
}
|
|
654
|
+
function agentMessageId(eventId) {
|
|
655
|
+
return `agent-${eventId}`;
|
|
656
|
+
}
|
|
657
|
+
function userMessageTurnItem(msg, id) {
|
|
658
|
+
return {
|
|
659
|
+
type: "UserMessage",
|
|
660
|
+
id,
|
|
661
|
+
content: userInputFromUserMessage(msg)
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
function userInputFromUserMessage(msg) {
|
|
665
|
+
const items = [];
|
|
666
|
+
if (msg.message.length > 0) {
|
|
667
|
+
items.push({
|
|
668
|
+
type: "text",
|
|
669
|
+
text: msg.message,
|
|
670
|
+
text_elements: msg.text_elements
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
for (const imageUrl of msg.images ?? []) {
|
|
674
|
+
items.push({ type: "image", image_url: imageUrl });
|
|
675
|
+
}
|
|
676
|
+
for (const path of msg.local_images ?? []) {
|
|
677
|
+
items.push({ type: "local_image", path });
|
|
678
|
+
}
|
|
679
|
+
return items;
|
|
680
|
+
}
|
|
681
|
+
function imageGenerationTurnItem(msg, id) {
|
|
682
|
+
return {
|
|
683
|
+
type: "ImageGeneration",
|
|
684
|
+
id: msg.call_id || id,
|
|
685
|
+
status: msg.status,
|
|
686
|
+
revised_prompt: msg.revised_prompt,
|
|
687
|
+
result: msg.result,
|
|
688
|
+
saved_path: msg.saved_path
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function agentMessageText(item) {
|
|
692
|
+
return item.content.map((part) => part.text).join("");
|
|
693
|
+
}
|
|
694
|
+
function userMessageFingerprint(item) {
|
|
695
|
+
return item.content.map((content) => {
|
|
696
|
+
if (content.type === "text") {
|
|
697
|
+
return `text:${content.text}`;
|
|
698
|
+
}
|
|
699
|
+
if (content.type === "image") {
|
|
700
|
+
return `image:${content.image_url}`;
|
|
701
|
+
}
|
|
702
|
+
if (content.type === "local_image") {
|
|
703
|
+
return `local_image:${content.path}`;
|
|
704
|
+
}
|
|
705
|
+
if (content.type === "skill") {
|
|
706
|
+
return `skill:${content.name}:${content.path}`;
|
|
707
|
+
}
|
|
708
|
+
return `mention:${content.name}:${content.path}`;
|
|
709
|
+
}).join("\n");
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// src/internal/codex/core/src/rendered-thread.ts
|
|
713
|
+
function createRenderedThreadState(threadId) {
|
|
714
|
+
return {
|
|
715
|
+
thread_id: threadId,
|
|
716
|
+
turns: [],
|
|
717
|
+
items: [],
|
|
718
|
+
pending_request_user_input: null,
|
|
719
|
+
pending_request_permissions: null,
|
|
720
|
+
pending_dynamic_tool_call_requests: [],
|
|
721
|
+
running_turn_ids: [],
|
|
722
|
+
warnings: [],
|
|
723
|
+
errors: [],
|
|
724
|
+
last_history_fingerprint: null,
|
|
725
|
+
connection_status: "idle"
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
function renderThreadFromHistory(history) {
|
|
729
|
+
let state = createRenderedThreadState(history.thread_id);
|
|
730
|
+
for (const [index, item] of history.items.entries()) {
|
|
731
|
+
state = applyRolloutItemToRenderedThread(state, item, index);
|
|
732
|
+
}
|
|
733
|
+
return {
|
|
734
|
+
...state,
|
|
735
|
+
running_turn_ids: [],
|
|
736
|
+
last_history_fingerprint: fingerprintRolloutItems(history.items)
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
function applyRolloutItemToRenderedThread(state, item, index = state.items.length) {
|
|
740
|
+
if (item.type === "event_msg") {
|
|
741
|
+
return applyEventMsgToRenderedThread(state, item.payload, {
|
|
742
|
+
event_id: `rollout-${index}`
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
if (item.type === "response_item") {
|
|
746
|
+
return withTurns(
|
|
747
|
+
state,
|
|
748
|
+
applyResponseItemToTurns(state.turns, item.payload, `response-${index}`)
|
|
749
|
+
);
|
|
750
|
+
}
|
|
751
|
+
if (item.type === "compacted") {
|
|
752
|
+
return withTurns(
|
|
753
|
+
state,
|
|
754
|
+
appendCompactionTurnToTurns(state.turns, `compacted-${index}`)
|
|
755
|
+
);
|
|
756
|
+
}
|
|
757
|
+
return state;
|
|
758
|
+
}
|
|
759
|
+
function applyEventMsgToRenderedThread(state, msg, options = {}) {
|
|
760
|
+
const eventId = options.event_id ?? `event-${state.items.length}`;
|
|
761
|
+
const hadActiveTurn = hasActiveTurn(state.turns);
|
|
762
|
+
const next = withTurns(state, applyEventToTurns(state.turns, msg, eventId));
|
|
763
|
+
switch (msg.type) {
|
|
764
|
+
case "turn_started":
|
|
765
|
+
return {
|
|
766
|
+
...next,
|
|
767
|
+
running_turn_ids: addUnique(next.running_turn_ids, msg.turn_id)
|
|
768
|
+
};
|
|
769
|
+
case "turn_complete":
|
|
770
|
+
return clearPendingForTurn(
|
|
771
|
+
{
|
|
772
|
+
...next,
|
|
773
|
+
running_turn_ids: next.running_turn_ids.filter(
|
|
774
|
+
(turnId) => turnId !== msg.turn_id
|
|
775
|
+
)
|
|
776
|
+
},
|
|
777
|
+
msg.turn_id
|
|
778
|
+
);
|
|
779
|
+
case "turn_aborted":
|
|
780
|
+
return clearPendingForTurn(
|
|
781
|
+
{
|
|
782
|
+
...next,
|
|
783
|
+
running_turn_ids: next.running_turn_ids.filter(
|
|
784
|
+
(turnId) => turnId !== msg.turn_id
|
|
785
|
+
)
|
|
786
|
+
},
|
|
787
|
+
msg.turn_id
|
|
788
|
+
);
|
|
789
|
+
case "request_user_input":
|
|
790
|
+
return {
|
|
791
|
+
...next,
|
|
792
|
+
pending_request_user_input: {
|
|
793
|
+
call_id: msg.call_id,
|
|
794
|
+
turn_id: msg.turn_id,
|
|
795
|
+
questions: msg.questions.map((question) => ({
|
|
796
|
+
...question,
|
|
797
|
+
options: question.options.map((option) => ({ ...option }))
|
|
798
|
+
}))
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
case "request_permissions":
|
|
802
|
+
return {
|
|
803
|
+
...next,
|
|
804
|
+
pending_request_permissions: {
|
|
805
|
+
call_id: msg.call_id,
|
|
806
|
+
turn_id: msg.turn_id,
|
|
807
|
+
reason: msg.reason ?? null,
|
|
808
|
+
permissions: JSON.parse(JSON.stringify(msg.permissions)),
|
|
809
|
+
cwd: msg.cwd ?? null
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
case "dynamic_tool_call_request":
|
|
813
|
+
return {
|
|
814
|
+
...next,
|
|
815
|
+
pending_dynamic_tool_call_requests: upsertDynamicToolCallRequest(
|
|
816
|
+
next.pending_dynamic_tool_call_requests,
|
|
817
|
+
msg
|
|
818
|
+
)
|
|
819
|
+
};
|
|
820
|
+
case "dynamic_tool_call_response":
|
|
821
|
+
return {
|
|
822
|
+
...next,
|
|
823
|
+
pending_dynamic_tool_call_requests: next.pending_dynamic_tool_call_requests.filter(
|
|
824
|
+
(request) => request.call_id !== msg.call_id
|
|
825
|
+
)
|
|
826
|
+
};
|
|
827
|
+
case "warning":
|
|
828
|
+
return {
|
|
829
|
+
...next,
|
|
830
|
+
warnings: [...next.warnings, msg.message]
|
|
831
|
+
};
|
|
832
|
+
case "error":
|
|
833
|
+
return hadActiveTurn ? next : {
|
|
834
|
+
...next,
|
|
835
|
+
errors: [...next.errors, msg.message]
|
|
836
|
+
};
|
|
837
|
+
default:
|
|
838
|
+
return next;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
function fingerprintRolloutItems(items) {
|
|
842
|
+
const last = items.at(-1);
|
|
843
|
+
return `${items.length}:${hashString(JSON.stringify(last ?? null))}`;
|
|
844
|
+
}
|
|
845
|
+
function withTurns(state, turns) {
|
|
846
|
+
const nextTurns = turns.map((turn) => ({
|
|
847
|
+
...turn,
|
|
848
|
+
items: turn.items.map((item) => structuredClone(item)),
|
|
849
|
+
error: turn.error ? { ...turn.error } : null
|
|
850
|
+
}));
|
|
851
|
+
return {
|
|
852
|
+
...state,
|
|
853
|
+
turns: nextTurns,
|
|
854
|
+
items: flattenTurnsToTurnItems(nextTurns)
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
function clearPendingForTurn(state, turnId) {
|
|
858
|
+
return {
|
|
859
|
+
...state,
|
|
860
|
+
pending_request_user_input: state.pending_request_user_input?.turn_id === turnId ? null : state.pending_request_user_input,
|
|
861
|
+
pending_dynamic_tool_call_requests: state.pending_dynamic_tool_call_requests.filter(
|
|
862
|
+
(request) => request.turn_id !== turnId
|
|
863
|
+
),
|
|
864
|
+
pending_request_permissions: state.pending_request_permissions?.turn_id === turnId ? null : state.pending_request_permissions
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
function upsertDynamicToolCallRequest(requests, request) {
|
|
868
|
+
return [
|
|
869
|
+
...requests.filter((item) => item.call_id !== request.call_id),
|
|
870
|
+
{
|
|
871
|
+
call_id: request.call_id,
|
|
872
|
+
turn_id: request.turn_id,
|
|
873
|
+
started_at_ms: request.started_at_ms,
|
|
874
|
+
namespace: request.namespace ?? null,
|
|
875
|
+
tool: request.tool,
|
|
876
|
+
arguments: request.arguments
|
|
877
|
+
}
|
|
878
|
+
];
|
|
879
|
+
}
|
|
880
|
+
function hasActiveTurn(turns) {
|
|
881
|
+
return turns.some((turn) => turn.status === "in_progress");
|
|
882
|
+
}
|
|
883
|
+
function addUnique(values, value) {
|
|
884
|
+
return values.includes(value) ? values : [...values, value];
|
|
885
|
+
}
|
|
886
|
+
function hashString(value) {
|
|
887
|
+
let hash = 0;
|
|
888
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
889
|
+
hash = hash * 31 + value.charCodeAt(index) >>> 0;
|
|
890
|
+
}
|
|
891
|
+
return hash.toString(16);
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// src/internal/codex/app-server-client/src/thread_event_store.ts
|
|
895
|
+
var ThreadEventStore = class _ThreadEventStore {
|
|
896
|
+
accountRateLimits = null;
|
|
897
|
+
activeTurnIds = /* @__PURE__ */ new Set();
|
|
898
|
+
bufferedEvents = [];
|
|
899
|
+
connectionStatus = "idle";
|
|
900
|
+
errors = [];
|
|
901
|
+
pendingRequests = /* @__PURE__ */ new Map();
|
|
902
|
+
resolvedRequestIds = [];
|
|
903
|
+
thread = null;
|
|
904
|
+
tokenUsage = null;
|
|
905
|
+
turns = [];
|
|
906
|
+
warnings = [];
|
|
907
|
+
static fromThread(thread) {
|
|
908
|
+
const store = new _ThreadEventStore();
|
|
909
|
+
store.setThread(thread);
|
|
910
|
+
return store;
|
|
911
|
+
}
|
|
912
|
+
applyNotification(notification) {
|
|
913
|
+
applyServerNotificationToThreadEventStore(this, notification);
|
|
914
|
+
return this.snapshot();
|
|
915
|
+
}
|
|
916
|
+
applyRequest(request) {
|
|
917
|
+
applyServerRequestToThreadEventStore(this, request);
|
|
918
|
+
return this.snapshot();
|
|
919
|
+
}
|
|
920
|
+
setConnectionStatus(status) {
|
|
921
|
+
this.connectionStatus = status;
|
|
922
|
+
return this.snapshot();
|
|
923
|
+
}
|
|
924
|
+
setThread(thread) {
|
|
925
|
+
this.thread = cloneThread(thread);
|
|
926
|
+
this.turns = thread.turns.map(cloneTurn2);
|
|
927
|
+
this.activeTurnIds = new Set(
|
|
928
|
+
this.turns.filter((turn) => turn.status === "inProgress").map((turn) => turn.id)
|
|
929
|
+
);
|
|
930
|
+
return this.snapshot();
|
|
931
|
+
}
|
|
932
|
+
snapshot() {
|
|
933
|
+
return {
|
|
934
|
+
activeTurnIds: [...this.activeTurnIds],
|
|
935
|
+
accountRateLimits: this.accountRateLimits ? { ...this.accountRateLimits } : null,
|
|
936
|
+
bufferedEvents: [...this.bufferedEvents],
|
|
937
|
+
connectionStatus: this.connectionStatus,
|
|
938
|
+
errors: [...this.errors],
|
|
939
|
+
pendingRequests: [...this.pendingRequests.values()],
|
|
940
|
+
resolvedRequestIds: [...this.resolvedRequestIds],
|
|
941
|
+
thread: this.thread ? cloneThread(this.thread) : null,
|
|
942
|
+
tokenUsage: this.tokenUsage ? {
|
|
943
|
+
...this.tokenUsage,
|
|
944
|
+
tokenUsage: cloneThreadTokenUsage(this.tokenUsage.tokenUsage)
|
|
945
|
+
} : null,
|
|
946
|
+
turns: this.turns.map(cloneTurn2),
|
|
947
|
+
warnings: [...this.warnings]
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
noteNotification(notification) {
|
|
951
|
+
this.bufferedEvents = [...this.bufferedEvents, { notification, type: "notification" }];
|
|
952
|
+
switch (notification.method) {
|
|
953
|
+
case "thread/started":
|
|
954
|
+
this.setThread(notification.params.thread);
|
|
955
|
+
return;
|
|
956
|
+
case "thread/status/changed":
|
|
957
|
+
if (this.thread) {
|
|
958
|
+
this.thread = { ...this.thread, status: notification.params.status };
|
|
959
|
+
}
|
|
960
|
+
return;
|
|
961
|
+
case "thread/name/updated":
|
|
962
|
+
if (this.thread) {
|
|
963
|
+
this.thread = { ...this.thread, name: notification.params.threadName ?? null };
|
|
964
|
+
}
|
|
965
|
+
return;
|
|
966
|
+
case "thread/archived":
|
|
967
|
+
case "thread/unarchived":
|
|
968
|
+
case "thread/closed":
|
|
969
|
+
case "thread/goal/updated":
|
|
970
|
+
case "thread/goal/cleared":
|
|
971
|
+
return;
|
|
972
|
+
case "thread/tokenUsage/updated":
|
|
973
|
+
this.tokenUsage = {
|
|
974
|
+
threadId: notification.params.threadId,
|
|
975
|
+
tokenUsage: cloneThreadTokenUsage(notification.params.tokenUsage),
|
|
976
|
+
turnId: notification.params.turnId,
|
|
977
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
978
|
+
};
|
|
979
|
+
return;
|
|
980
|
+
case "turn/started":
|
|
981
|
+
this.upsertTurn(notification.params.turn);
|
|
982
|
+
this.activeTurnIds.add(notification.params.turn.id);
|
|
983
|
+
return;
|
|
984
|
+
case "turn/diff/updated":
|
|
985
|
+
case "turn/plan/updated":
|
|
986
|
+
this.ensureTurn(notification.params.turnId);
|
|
987
|
+
return;
|
|
988
|
+
case "turn/completed":
|
|
989
|
+
this.upsertTurn(notification.params.turn);
|
|
990
|
+
this.activeTurnIds.delete(notification.params.turn.id);
|
|
991
|
+
if (notification.params.turn.error?.message) {
|
|
992
|
+
this.errors = appendUnique(this.errors, notification.params.turn.error.message);
|
|
993
|
+
}
|
|
994
|
+
return;
|
|
995
|
+
case "item/started":
|
|
996
|
+
case "item/completed":
|
|
997
|
+
this.upsertItem(notification.params.turnId, notification.params.item);
|
|
998
|
+
return;
|
|
999
|
+
case "item/agentMessage/delta":
|
|
1000
|
+
this.applyAgentMessageDelta(
|
|
1001
|
+
notification.params.turnId,
|
|
1002
|
+
notification.params.itemId,
|
|
1003
|
+
notification.params.delta
|
|
1004
|
+
);
|
|
1005
|
+
return;
|
|
1006
|
+
case "item/plan/delta":
|
|
1007
|
+
this.applyPlanDelta(
|
|
1008
|
+
notification.params.turnId,
|
|
1009
|
+
notification.params.itemId,
|
|
1010
|
+
notification.params.delta
|
|
1011
|
+
);
|
|
1012
|
+
return;
|
|
1013
|
+
case "item/reasoning/summaryPartAdded":
|
|
1014
|
+
this.applyReasoningSummaryPartAdded(
|
|
1015
|
+
notification.params.turnId,
|
|
1016
|
+
notification.params.itemId,
|
|
1017
|
+
notification.params.summaryIndex
|
|
1018
|
+
);
|
|
1019
|
+
return;
|
|
1020
|
+
case "item/reasoning/summaryTextDelta":
|
|
1021
|
+
this.applyReasoningSummaryTextDelta(
|
|
1022
|
+
notification.params.turnId,
|
|
1023
|
+
notification.params.itemId,
|
|
1024
|
+
notification.params.summaryIndex,
|
|
1025
|
+
notification.params.delta
|
|
1026
|
+
);
|
|
1027
|
+
return;
|
|
1028
|
+
case "item/reasoning/textDelta":
|
|
1029
|
+
this.applyReasoningTextDelta(
|
|
1030
|
+
notification.params.turnId,
|
|
1031
|
+
notification.params.itemId,
|
|
1032
|
+
notification.params.contentIndex,
|
|
1033
|
+
notification.params.delta
|
|
1034
|
+
);
|
|
1035
|
+
return;
|
|
1036
|
+
case "item/commandExecution/outputDelta":
|
|
1037
|
+
this.applyCommandOutputDelta(
|
|
1038
|
+
notification.params.turnId,
|
|
1039
|
+
notification.params.itemId,
|
|
1040
|
+
notification.params.delta
|
|
1041
|
+
);
|
|
1042
|
+
return;
|
|
1043
|
+
case "item/fileChange/outputDelta":
|
|
1044
|
+
this.ensureTurn(notification.params.turnId);
|
|
1045
|
+
return;
|
|
1046
|
+
case "item/fileChange/patchUpdated":
|
|
1047
|
+
this.applyFileChangePatchUpdated(
|
|
1048
|
+
notification.params.turnId,
|
|
1049
|
+
notification.params.itemId,
|
|
1050
|
+
notification.params.changes
|
|
1051
|
+
);
|
|
1052
|
+
return;
|
|
1053
|
+
case "item/mcpToolCall/progress":
|
|
1054
|
+
case "item/commandExecution/terminalInteraction":
|
|
1055
|
+
case "command/exec/outputDelta":
|
|
1056
|
+
case "process/outputDelta":
|
|
1057
|
+
case "process/exited":
|
|
1058
|
+
case "rawResponseItem/completed":
|
|
1059
|
+
case "hook/started":
|
|
1060
|
+
case "hook/completed":
|
|
1061
|
+
case "item/autoApprovalReview/started":
|
|
1062
|
+
case "item/autoApprovalReview/completed":
|
|
1063
|
+
return;
|
|
1064
|
+
case "thread/compacted":
|
|
1065
|
+
this.upsertItem(notification.params.turnId, {
|
|
1066
|
+
id: `compacted-${notification.params.turnId}`,
|
|
1067
|
+
type: "contextCompaction"
|
|
1068
|
+
});
|
|
1069
|
+
return;
|
|
1070
|
+
case "serverRequest/resolved":
|
|
1071
|
+
this.pendingRequests.delete(notification.params.requestId);
|
|
1072
|
+
this.resolvedRequestIds = appendUnique(
|
|
1073
|
+
this.resolvedRequestIds,
|
|
1074
|
+
notification.params.requestId
|
|
1075
|
+
);
|
|
1076
|
+
return;
|
|
1077
|
+
case "warning":
|
|
1078
|
+
this.warnings = appendUnique(this.warnings, notification.params.message);
|
|
1079
|
+
return;
|
|
1080
|
+
case "error":
|
|
1081
|
+
this.errors = appendUnique(this.errors, notification.params.error.message);
|
|
1082
|
+
return;
|
|
1083
|
+
case "guardianWarning":
|
|
1084
|
+
this.warnings = appendUnique(this.warnings, notification.params.message);
|
|
1085
|
+
return;
|
|
1086
|
+
case "deprecationNotice":
|
|
1087
|
+
this.warnings = appendUnique(this.warnings, notification.params.summary);
|
|
1088
|
+
return;
|
|
1089
|
+
case "configWarning":
|
|
1090
|
+
this.warnings = appendUnique(this.warnings, notification.params.summary);
|
|
1091
|
+
return;
|
|
1092
|
+
case "account/rateLimits/updated":
|
|
1093
|
+
this.accountRateLimits = { ...notification.params.rateLimits };
|
|
1094
|
+
return;
|
|
1095
|
+
case "thread/realtime/started":
|
|
1096
|
+
case "thread/realtime/itemAdded":
|
|
1097
|
+
case "thread/realtime/transcript/delta":
|
|
1098
|
+
case "thread/realtime/transcript/done":
|
|
1099
|
+
case "thread/realtime/outputAudio/delta":
|
|
1100
|
+
case "thread/realtime/sdp":
|
|
1101
|
+
case "thread/realtime/error":
|
|
1102
|
+
case "thread/realtime/closed":
|
|
1103
|
+
case "fs/changed":
|
|
1104
|
+
case "model/rerouted":
|
|
1105
|
+
case "model/verification":
|
|
1106
|
+
case "mcpServer/oauthLogin/completed":
|
|
1107
|
+
case "mcpServer/startupStatus/updated":
|
|
1108
|
+
case "fuzzyFileSearch/sessionUpdated":
|
|
1109
|
+
case "fuzzyFileSearch/sessionCompleted":
|
|
1110
|
+
case "windows/worldWritableWarning":
|
|
1111
|
+
case "windowsSandbox/setupCompleted":
|
|
1112
|
+
return;
|
|
1113
|
+
default:
|
|
1114
|
+
if (notificationThreadId(notification)) {
|
|
1115
|
+
this.warnings = appendUnique(
|
|
1116
|
+
this.warnings,
|
|
1117
|
+
`Unsupported Codex app-server notification: ${notification.method}`
|
|
1118
|
+
);
|
|
1119
|
+
}
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
noteRequest(request) {
|
|
1124
|
+
this.bufferedEvents = [...this.bufferedEvents, { request, type: "request" }];
|
|
1125
|
+
this.pendingRequests.set(request.id, request);
|
|
1126
|
+
}
|
|
1127
|
+
upsertTurn(turn) {
|
|
1128
|
+
const index = this.turns.findIndex((candidate) => candidate.id === turn.id);
|
|
1129
|
+
if (index === -1) {
|
|
1130
|
+
this.turns = [...this.turns, cloneTurn2(turn)];
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
const current = this.turns[index];
|
|
1134
|
+
this.turns = replaceAt(this.turns, index, {
|
|
1135
|
+
...current,
|
|
1136
|
+
...turn,
|
|
1137
|
+
items: turn.items.length > 0 ? turn.items.map(cloneThreadItem) : current.items
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
upsertItem(turnId, item) {
|
|
1141
|
+
const turn = this.ensureTurn(turnId);
|
|
1142
|
+
const itemIndex = turn.items.findIndex((candidate) => candidate.id === item.id);
|
|
1143
|
+
const nextItems = itemIndex === -1 ? [...turn.items, cloneThreadItem(item)] : replaceAt(turn.items, itemIndex, cloneThreadItem(item));
|
|
1144
|
+
this.replaceTurn({ ...turn, items: nextItems, itemsView: "full" });
|
|
1145
|
+
}
|
|
1146
|
+
applyAgentMessageDelta(turnId, itemId, delta) {
|
|
1147
|
+
const turn = this.ensureTurn(turnId);
|
|
1148
|
+
const item = turn.items.find((candidate) => candidate.id === itemId);
|
|
1149
|
+
if (item?.type === "agentMessage") {
|
|
1150
|
+
this.upsertItem(turnId, { ...item, text: `${item.text}${delta}` });
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
this.upsertItem(turnId, {
|
|
1154
|
+
id: itemId,
|
|
1155
|
+
memoryCitation: null,
|
|
1156
|
+
phase: "commentary",
|
|
1157
|
+
text: delta,
|
|
1158
|
+
type: "agentMessage"
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
applyPlanDelta(turnId, itemId, delta) {
|
|
1162
|
+
const turn = this.ensureTurn(turnId);
|
|
1163
|
+
const item = turn.items.find((candidate) => candidate.id === itemId);
|
|
1164
|
+
if (item?.type === "plan") {
|
|
1165
|
+
this.upsertItem(turnId, { ...item, text: `${item.text}${delta}` });
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
this.upsertItem(turnId, {
|
|
1169
|
+
id: itemId,
|
|
1170
|
+
text: delta,
|
|
1171
|
+
type: "plan"
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
applyReasoningSummaryPartAdded(turnId, itemId, summaryIndex) {
|
|
1175
|
+
const item = this.reasoningItem(turnId, itemId);
|
|
1176
|
+
const summary = replaceAtOrAppend(item.summary, summaryIndex, "");
|
|
1177
|
+
this.upsertItem(turnId, { ...item, summary });
|
|
1178
|
+
}
|
|
1179
|
+
applyReasoningSummaryTextDelta(turnId, itemId, summaryIndex, delta) {
|
|
1180
|
+
const item = this.reasoningItem(turnId, itemId);
|
|
1181
|
+
const current = item.summary[summaryIndex] ?? "";
|
|
1182
|
+
const summary = replaceAtOrAppend(item.summary, summaryIndex, `${current}${delta}`);
|
|
1183
|
+
this.upsertItem(turnId, { ...item, summary });
|
|
1184
|
+
}
|
|
1185
|
+
applyReasoningTextDelta(turnId, itemId, contentIndex, delta) {
|
|
1186
|
+
const item = this.reasoningItem(turnId, itemId);
|
|
1187
|
+
const current = item.content[contentIndex] ?? "";
|
|
1188
|
+
const content = replaceAtOrAppend(item.content, contentIndex, `${current}${delta}`);
|
|
1189
|
+
this.upsertItem(turnId, { ...item, content });
|
|
1190
|
+
}
|
|
1191
|
+
applyCommandOutputDelta(turnId, itemId, delta) {
|
|
1192
|
+
const turn = this.ensureTurn(turnId);
|
|
1193
|
+
const item = turn.items.find((candidate) => candidate.id === itemId);
|
|
1194
|
+
if (item?.type !== "commandExecution") {
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
this.upsertItem(turnId, {
|
|
1198
|
+
...item,
|
|
1199
|
+
aggregatedOutput: `${item.aggregatedOutput ?? ""}${delta}`
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
applyFileChangePatchUpdated(turnId, itemId, changes) {
|
|
1203
|
+
const turn = this.ensureTurn(turnId);
|
|
1204
|
+
const item = turn.items.find((candidate) => candidate.id === itemId);
|
|
1205
|
+
if (item?.type !== "fileChange") {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
this.upsertItem(turnId, { ...item, changes });
|
|
1209
|
+
}
|
|
1210
|
+
reasoningItem(turnId, itemId) {
|
|
1211
|
+
const turn = this.ensureTurn(turnId);
|
|
1212
|
+
const item = turn.items.find((candidate) => candidate.id === itemId);
|
|
1213
|
+
if (item?.type === "reasoning") {
|
|
1214
|
+
return item;
|
|
1215
|
+
}
|
|
1216
|
+
return {
|
|
1217
|
+
content: [],
|
|
1218
|
+
id: itemId,
|
|
1219
|
+
summary: [],
|
|
1220
|
+
type: "reasoning"
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
ensureTurn(turnId) {
|
|
1224
|
+
const existing = this.turns.find((turn2) => turn2.id === turnId);
|
|
1225
|
+
if (existing) {
|
|
1226
|
+
return existing;
|
|
1227
|
+
}
|
|
1228
|
+
const turn = {
|
|
1229
|
+
completedAt: null,
|
|
1230
|
+
durationMs: null,
|
|
1231
|
+
error: null,
|
|
1232
|
+
id: turnId,
|
|
1233
|
+
items: [],
|
|
1234
|
+
itemsView: "full",
|
|
1235
|
+
startedAt: null,
|
|
1236
|
+
status: "inProgress"
|
|
1237
|
+
};
|
|
1238
|
+
this.turns = [...this.turns, turn];
|
|
1239
|
+
this.activeTurnIds.add(turnId);
|
|
1240
|
+
return turn;
|
|
1241
|
+
}
|
|
1242
|
+
replaceTurn(turn) {
|
|
1243
|
+
const index = this.turns.findIndex((candidate) => candidate.id === turn.id);
|
|
1244
|
+
this.turns = index === -1 ? [...this.turns, turn] : replaceAt(this.turns, index, turn);
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
function applyServerNotificationToThreadEventStore(store, notification) {
|
|
1248
|
+
store.noteNotification(notification);
|
|
1249
|
+
return store.snapshot();
|
|
1250
|
+
}
|
|
1251
|
+
function applyServerRequestToThreadEventStore(store, request) {
|
|
1252
|
+
store.noteRequest(request);
|
|
1253
|
+
return store.snapshot();
|
|
1254
|
+
}
|
|
1255
|
+
function notificationThreadId(notification) {
|
|
1256
|
+
if (notification.method === "thread/started") {
|
|
1257
|
+
return notification.params.thread.id;
|
|
1258
|
+
}
|
|
1259
|
+
if ("params" in notification && notification.params && typeof notification.params === "object") {
|
|
1260
|
+
const threadId = notification.params.threadId;
|
|
1261
|
+
return typeof threadId === "string" ? threadId : null;
|
|
1262
|
+
}
|
|
1263
|
+
return null;
|
|
1264
|
+
}
|
|
1265
|
+
function cloneThread(thread) {
|
|
1266
|
+
return {
|
|
1267
|
+
...thread,
|
|
1268
|
+
turns: thread.turns.map(cloneTurn2)
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
function cloneTurn2(turn) {
|
|
1272
|
+
return {
|
|
1273
|
+
...turn,
|
|
1274
|
+
items: turn.items.map(cloneThreadItem)
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
function cloneThreadItem(item) {
|
|
1278
|
+
return { ...item };
|
|
1279
|
+
}
|
|
1280
|
+
function cloneThreadTokenUsage(tokenUsage) {
|
|
1281
|
+
return {
|
|
1282
|
+
last: { ...tokenUsage.last },
|
|
1283
|
+
modelContextWindow: tokenUsage.modelContextWindow,
|
|
1284
|
+
total: { ...tokenUsage.total }
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
function replaceAt(items, index, item) {
|
|
1288
|
+
return [...items.slice(0, index), item, ...items.slice(index + 1)];
|
|
1289
|
+
}
|
|
1290
|
+
function replaceAtOrAppend(items, index, item) {
|
|
1291
|
+
if (index < items.length) {
|
|
1292
|
+
return replaceAt(items, index, item);
|
|
1293
|
+
}
|
|
1294
|
+
return [...items, item];
|
|
1295
|
+
}
|
|
1296
|
+
function appendUnique(items, item) {
|
|
1297
|
+
return items.includes(item) ? [...items] : [...items, item];
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
// src/internal/codex/core/src/memory.ts
|
|
1301
|
+
var ThreadMemoryMode = {
|
|
1302
|
+
Enabled: "Enabled"};
|
|
1303
|
+
|
|
1304
|
+
// src/internal/codex/thread-store/src/in_memory.ts
|
|
1305
|
+
var stores = /* @__PURE__ */ new Map();
|
|
1306
|
+
var InMemoryThreadStore = class _InMemoryThreadStore {
|
|
1307
|
+
state = {
|
|
1308
|
+
calls: emptyCalls(),
|
|
1309
|
+
createdThreads: /* @__PURE__ */ new Map(),
|
|
1310
|
+
histories: /* @__PURE__ */ new Map(),
|
|
1311
|
+
rolloutPaths: /* @__PURE__ */ new Map(),
|
|
1312
|
+
threads: /* @__PURE__ */ new Map()
|
|
1313
|
+
};
|
|
1314
|
+
static forId(id) {
|
|
1315
|
+
const existing = stores.get(id);
|
|
1316
|
+
if (existing) {
|
|
1317
|
+
return existing;
|
|
1318
|
+
}
|
|
1319
|
+
const store = new _InMemoryThreadStore();
|
|
1320
|
+
stores.set(id, store);
|
|
1321
|
+
return store;
|
|
1322
|
+
}
|
|
1323
|
+
static removeId(id) {
|
|
1324
|
+
const store = stores.get(id) ?? null;
|
|
1325
|
+
stores.delete(id);
|
|
1326
|
+
return store;
|
|
1327
|
+
}
|
|
1328
|
+
calls() {
|
|
1329
|
+
return { ...this.state.calls };
|
|
1330
|
+
}
|
|
1331
|
+
snapshot() {
|
|
1332
|
+
return {
|
|
1333
|
+
createdThreads: Array.from(this.state.createdThreads.entries()),
|
|
1334
|
+
histories: Array.from(this.state.histories.entries()).map(
|
|
1335
|
+
([threadId, items]) => [threadId, [...items]]
|
|
1336
|
+
),
|
|
1337
|
+
rolloutPaths: Array.from(this.state.rolloutPaths.entries()),
|
|
1338
|
+
threads: Array.from(this.state.threads.entries()).map(
|
|
1339
|
+
([threadId, thread]) => [threadId, { ...thread }]
|
|
1340
|
+
)
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
restoreSnapshot(snapshot) {
|
|
1344
|
+
this.state.createdThreads = new Map(snapshot.createdThreads);
|
|
1345
|
+
this.state.histories = new Map(
|
|
1346
|
+
snapshot.histories.map(([threadId, items]) => [threadId, [...items]])
|
|
1347
|
+
);
|
|
1348
|
+
this.state.rolloutPaths = new Map(snapshot.rolloutPaths);
|
|
1349
|
+
this.state.threads = new Map(
|
|
1350
|
+
snapshot.threads.map(([threadId, thread]) => [threadId, { ...thread }])
|
|
1351
|
+
);
|
|
1352
|
+
}
|
|
1353
|
+
async createThread(params) {
|
|
1354
|
+
this.state.calls.createThread += 1;
|
|
1355
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1356
|
+
this.state.createdThreads.set(params.thread_id, params);
|
|
1357
|
+
this.state.histories.set(params.thread_id, []);
|
|
1358
|
+
this.state.threads.set(params.thread_id, {
|
|
1359
|
+
archived_at: null,
|
|
1360
|
+
created_at: now,
|
|
1361
|
+
cwd: String(params.metadata.cwd ?? "/"),
|
|
1362
|
+
forked_from_id: params.forked_from_id ?? null,
|
|
1363
|
+
history: null,
|
|
1364
|
+
model: stringOrNull(params.metadata.model),
|
|
1365
|
+
model_provider: params.metadata.model_provider,
|
|
1366
|
+
name: null,
|
|
1367
|
+
preview: "",
|
|
1368
|
+
reasoning_effort: stringOrNull(params.metadata.reasoning_effort),
|
|
1369
|
+
source: params.source,
|
|
1370
|
+
thread_id: params.thread_id,
|
|
1371
|
+
thread_source: params.thread_source ?? null,
|
|
1372
|
+
token_usage: null,
|
|
1373
|
+
updated_at: now
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
async resumeThread(params) {
|
|
1377
|
+
this.state.calls.resumeThread += 1;
|
|
1378
|
+
if (!this.state.threads.has(params.thread_id)) {
|
|
1379
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1380
|
+
this.state.threads.set(params.thread_id, {
|
|
1381
|
+
archived_at: null,
|
|
1382
|
+
created_at: now,
|
|
1383
|
+
cwd: String(params.metadata.cwd ?? "/"),
|
|
1384
|
+
history: null,
|
|
1385
|
+
model: stringOrNull(params.metadata.model),
|
|
1386
|
+
model_provider: params.metadata.model_provider,
|
|
1387
|
+
preview: "",
|
|
1388
|
+
source: "appServer",
|
|
1389
|
+
thread_id: params.thread_id,
|
|
1390
|
+
token_usage: lastTokenInfoFromRolloutItems(params.history ?? []),
|
|
1391
|
+
updated_at: now
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
this.state.histories.set(
|
|
1395
|
+
params.thread_id,
|
|
1396
|
+
[...params.history ?? this.state.histories.get(params.thread_id) ?? []]
|
|
1397
|
+
);
|
|
1398
|
+
this.updateThreadTokenUsage(
|
|
1399
|
+
params.thread_id,
|
|
1400
|
+
params.history ?? this.state.histories.get(params.thread_id) ?? []
|
|
1401
|
+
);
|
|
1402
|
+
if (params.rollout_path) {
|
|
1403
|
+
this.state.rolloutPaths.set(params.rollout_path, params.thread_id);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
async appendItems(params) {
|
|
1407
|
+
this.state.calls.appendItems += 1;
|
|
1408
|
+
this.history(params.thread_id).push(...params.items);
|
|
1409
|
+
this.updateThreadTokenUsage(params.thread_id, params.items);
|
|
1410
|
+
this.touch(params.thread_id);
|
|
1411
|
+
}
|
|
1412
|
+
async persistThread(threadId) {
|
|
1413
|
+
this.state.calls.persistThread += 1;
|
|
1414
|
+
}
|
|
1415
|
+
async flushThread(threadId) {
|
|
1416
|
+
this.state.calls.flushThread += 1;
|
|
1417
|
+
}
|
|
1418
|
+
async shutdownThread(threadId) {
|
|
1419
|
+
this.state.calls.shutdownThread += 1;
|
|
1420
|
+
}
|
|
1421
|
+
async discardThread(threadId) {
|
|
1422
|
+
this.state.calls.discardThread += 1;
|
|
1423
|
+
}
|
|
1424
|
+
async loadHistory(params) {
|
|
1425
|
+
this.state.calls.loadHistory += 1;
|
|
1426
|
+
return {
|
|
1427
|
+
items: [...this.history(params.thread_id)],
|
|
1428
|
+
thread_id: params.thread_id
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
async readThread(params) {
|
|
1432
|
+
this.state.calls.readThread += 1;
|
|
1433
|
+
return this.storedThread(params.thread_id, params.include_history);
|
|
1434
|
+
}
|
|
1435
|
+
async readThreadByRolloutPath(params) {
|
|
1436
|
+
this.state.calls.readThreadByRolloutPath += 1;
|
|
1437
|
+
const threadId = this.state.rolloutPaths.get(params.rollout_path);
|
|
1438
|
+
if (!threadId) {
|
|
1439
|
+
throw new Error(`Unknown rollout path: ${params.rollout_path}`);
|
|
1440
|
+
}
|
|
1441
|
+
return this.storedThread(threadId, params.include_history);
|
|
1442
|
+
}
|
|
1443
|
+
async listThreads(params) {
|
|
1444
|
+
this.state.calls.listThreads += 1;
|
|
1445
|
+
const items = Array.from(this.state.threads.values()).filter((thread) => params.archived || !thread.archived_at).sort(
|
|
1446
|
+
(left, right) => params.sort_direction === "Asc" ? left.created_at.localeCompare(right.created_at) : right.created_at.localeCompare(left.created_at)
|
|
1447
|
+
).slice(0, params.page_size).map((thread) => ({ ...thread, history: null }));
|
|
1448
|
+
return { items, next_cursor: null };
|
|
1449
|
+
}
|
|
1450
|
+
async updateThreadMetadata(params) {
|
|
1451
|
+
this.state.calls.updateThreadMetadata += 1;
|
|
1452
|
+
const thread = this.storedThread(params.thread_id, false);
|
|
1453
|
+
const next = {
|
|
1454
|
+
...thread,
|
|
1455
|
+
name: params.patch.name ?? thread.name,
|
|
1456
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1457
|
+
};
|
|
1458
|
+
if (params.patch.memory_mode === ThreadMemoryMode.Enabled) {
|
|
1459
|
+
next.preview = thread.preview;
|
|
1460
|
+
}
|
|
1461
|
+
this.state.threads.set(params.thread_id, next);
|
|
1462
|
+
return { ...next };
|
|
1463
|
+
}
|
|
1464
|
+
async archiveThread(params) {
|
|
1465
|
+
this.state.calls.archiveThread += 1;
|
|
1466
|
+
const thread = this.storedThread(params.thread_id, false);
|
|
1467
|
+
this.state.threads.set(params.thread_id, {
|
|
1468
|
+
...thread,
|
|
1469
|
+
archived_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
async unarchiveThread(params) {
|
|
1473
|
+
this.state.calls.unarchiveThread += 1;
|
|
1474
|
+
const thread = this.storedThread(params.thread_id, false);
|
|
1475
|
+
const next = { ...thread, archived_at: null };
|
|
1476
|
+
this.state.threads.set(params.thread_id, next);
|
|
1477
|
+
return next;
|
|
1478
|
+
}
|
|
1479
|
+
history(threadId) {
|
|
1480
|
+
const history = this.state.histories.get(threadId);
|
|
1481
|
+
if (!history) {
|
|
1482
|
+
throw new Error(`Thread not found: ${threadId}`);
|
|
1483
|
+
}
|
|
1484
|
+
return history;
|
|
1485
|
+
}
|
|
1486
|
+
storedThread(threadId, includeHistory) {
|
|
1487
|
+
const thread = this.state.threads.get(threadId);
|
|
1488
|
+
if (!thread) {
|
|
1489
|
+
throw new Error(`Thread not found: ${threadId}`);
|
|
1490
|
+
}
|
|
1491
|
+
return {
|
|
1492
|
+
...thread,
|
|
1493
|
+
history: includeHistory ? { items: [...this.history(threadId)], thread_id: threadId } : null
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
touch(threadId) {
|
|
1497
|
+
const thread = this.state.threads.get(threadId);
|
|
1498
|
+
if (thread) {
|
|
1499
|
+
this.state.threads.set(threadId, {
|
|
1500
|
+
...thread,
|
|
1501
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
updateThreadTokenUsage(threadId, items) {
|
|
1506
|
+
const info = lastTokenInfoFromRolloutItems(items);
|
|
1507
|
+
if (!info) {
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1510
|
+
const thread = this.state.threads.get(threadId);
|
|
1511
|
+
if (!thread) {
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
this.state.threads.set(threadId, {
|
|
1515
|
+
...thread,
|
|
1516
|
+
token_usage: info
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
function emptyCalls() {
|
|
1521
|
+
return {
|
|
1522
|
+
archiveThread: 0,
|
|
1523
|
+
appendItems: 0,
|
|
1524
|
+
createThread: 0,
|
|
1525
|
+
discardThread: 0,
|
|
1526
|
+
flushThread: 0,
|
|
1527
|
+
listThreads: 0,
|
|
1528
|
+
loadHistory: 0,
|
|
1529
|
+
persistThread: 0,
|
|
1530
|
+
readThread: 0,
|
|
1531
|
+
readThreadByRolloutPath: 0,
|
|
1532
|
+
resumeThread: 0,
|
|
1533
|
+
shutdownThread: 0,
|
|
1534
|
+
unarchiveThread: 0,
|
|
1535
|
+
updateThreadMetadata: 0
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
function stringOrNull(value) {
|
|
1539
|
+
return typeof value === "string" ? value : null;
|
|
1540
|
+
}
|
|
1541
|
+
function lastTokenInfoFromRolloutItems(items) {
|
|
1542
|
+
for (let index = items.length - 1; index >= 0; index -= 1) {
|
|
1543
|
+
const item = items[index];
|
|
1544
|
+
if (item?.type === "event_msg" && item.payload.type === "token_count" && item.payload.info) {
|
|
1545
|
+
return item.payload.info;
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
return null;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
// src/internal/codex/thread-store/src/local/mod.ts
|
|
1552
|
+
var LocalThreadStore = class extends InMemoryThreadStore {
|
|
1553
|
+
constructor(config) {
|
|
1554
|
+
super();
|
|
1555
|
+
this.config = config;
|
|
1556
|
+
}
|
|
1557
|
+
config;
|
|
1558
|
+
stateDb() {
|
|
1559
|
+
return null;
|
|
1560
|
+
}
|
|
1561
|
+
async createThread(params) {
|
|
1562
|
+
await this.load();
|
|
1563
|
+
await super.createThread(params);
|
|
1564
|
+
this.attachRolloutPath(params.thread_id);
|
|
1565
|
+
await this.save();
|
|
1566
|
+
}
|
|
1567
|
+
async resumeThread(params) {
|
|
1568
|
+
await this.load();
|
|
1569
|
+
await super.resumeThread({
|
|
1570
|
+
...params,
|
|
1571
|
+
rollout_path: params.rollout_path ?? this.rolloutPath(params.thread_id)
|
|
1572
|
+
});
|
|
1573
|
+
this.attachRolloutPath(params.thread_id, params.rollout_path ?? void 0);
|
|
1574
|
+
await this.save();
|
|
1575
|
+
}
|
|
1576
|
+
async appendItems(params) {
|
|
1577
|
+
await this.load();
|
|
1578
|
+
await super.appendItems(params);
|
|
1579
|
+
await this.save();
|
|
1580
|
+
}
|
|
1581
|
+
async persistThread(threadId) {
|
|
1582
|
+
await this.load();
|
|
1583
|
+
await super.persistThread(threadId);
|
|
1584
|
+
await this.save();
|
|
1585
|
+
}
|
|
1586
|
+
async flushThread(threadId) {
|
|
1587
|
+
await this.load();
|
|
1588
|
+
await super.flushThread(threadId);
|
|
1589
|
+
await this.save();
|
|
1590
|
+
}
|
|
1591
|
+
async shutdownThread(threadId) {
|
|
1592
|
+
await this.load();
|
|
1593
|
+
await super.shutdownThread(threadId);
|
|
1594
|
+
await this.save();
|
|
1595
|
+
}
|
|
1596
|
+
async discardThread(threadId) {
|
|
1597
|
+
await this.load();
|
|
1598
|
+
await super.discardThread(threadId);
|
|
1599
|
+
await this.save();
|
|
1600
|
+
}
|
|
1601
|
+
async loadHistory(params) {
|
|
1602
|
+
await this.load();
|
|
1603
|
+
return super.loadHistory(params);
|
|
1604
|
+
}
|
|
1605
|
+
async readThread(params) {
|
|
1606
|
+
await this.load();
|
|
1607
|
+
return super.readThread(params);
|
|
1608
|
+
}
|
|
1609
|
+
async readThreadByRolloutPath(params) {
|
|
1610
|
+
await this.load();
|
|
1611
|
+
return super.readThreadByRolloutPath(params);
|
|
1612
|
+
}
|
|
1613
|
+
async listThreads(params) {
|
|
1614
|
+
await this.load();
|
|
1615
|
+
return super.listThreads(params);
|
|
1616
|
+
}
|
|
1617
|
+
async updateThreadMetadata(params) {
|
|
1618
|
+
await this.load();
|
|
1619
|
+
const thread = await super.updateThreadMetadata(params);
|
|
1620
|
+
await this.save();
|
|
1621
|
+
return thread;
|
|
1622
|
+
}
|
|
1623
|
+
async archiveThread(params) {
|
|
1624
|
+
await this.load();
|
|
1625
|
+
await super.archiveThread(params);
|
|
1626
|
+
await this.save();
|
|
1627
|
+
}
|
|
1628
|
+
async unarchiveThread(params) {
|
|
1629
|
+
await this.load();
|
|
1630
|
+
const thread = await super.unarchiveThread(params);
|
|
1631
|
+
await this.save();
|
|
1632
|
+
return thread;
|
|
1633
|
+
}
|
|
1634
|
+
liveRolloutPath(threadId) {
|
|
1635
|
+
return this.rolloutPath(threadId);
|
|
1636
|
+
}
|
|
1637
|
+
attachRolloutPath(threadId, rolloutPath) {
|
|
1638
|
+
const snapshot = this.snapshot();
|
|
1639
|
+
const path = rolloutPath ?? this.rolloutPath(threadId);
|
|
1640
|
+
const threads = snapshot.threads.map(
|
|
1641
|
+
([candidateThreadId, thread]) => [
|
|
1642
|
+
candidateThreadId,
|
|
1643
|
+
candidateThreadId === threadId ? { ...thread, rollout_path: path } : thread
|
|
1644
|
+
]
|
|
1645
|
+
);
|
|
1646
|
+
const rolloutPaths = new Map(snapshot.rolloutPaths);
|
|
1647
|
+
rolloutPaths.set(path, threadId);
|
|
1648
|
+
this.restoreSnapshot({
|
|
1649
|
+
...snapshot,
|
|
1650
|
+
rolloutPaths: Array.from(rolloutPaths.entries()),
|
|
1651
|
+
threads
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
async load() {
|
|
1655
|
+
try {
|
|
1656
|
+
const { readFile } = await nodeFsPromises();
|
|
1657
|
+
const raw = await readFile(this.storePath(), "utf8");
|
|
1658
|
+
const data = JSON.parse(raw);
|
|
1659
|
+
this.restoreSnapshot(data);
|
|
1660
|
+
} catch (error) {
|
|
1661
|
+
if (error.code === "ENOENT") {
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
throw error;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
async save() {
|
|
1668
|
+
const { mkdir, writeFile } = await nodeFsPromises();
|
|
1669
|
+
const path = this.storePath();
|
|
1670
|
+
await mkdir(dirname(path), { recursive: true });
|
|
1671
|
+
const data = {
|
|
1672
|
+
version: 1,
|
|
1673
|
+
...this.snapshot()
|
|
1674
|
+
};
|
|
1675
|
+
await writeFile(path, `${JSON.stringify(data, null, 2)}
|
|
1676
|
+
`, "utf8");
|
|
1677
|
+
}
|
|
1678
|
+
rolloutPath(threadId) {
|
|
1679
|
+
return `${this.config.codex_home.replace(/\/+$/, "")}/sessions/${threadId}.jsonl`;
|
|
1680
|
+
}
|
|
1681
|
+
storePath() {
|
|
1682
|
+
return `${this.config.codex_home.replace(/\/+$/, "")}/thread-store/store.json`;
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
async function nodeFsPromises() {
|
|
1686
|
+
const moduleName = "node:fs/promises";
|
|
1687
|
+
return import(
|
|
1688
|
+
/* @vite-ignore */
|
|
1689
|
+
moduleName
|
|
1690
|
+
);
|
|
1691
|
+
}
|
|
1692
|
+
function dirname(path) {
|
|
1693
|
+
const normalized = path.replace(/\/+$/, "");
|
|
1694
|
+
const separatorIndex = normalized.lastIndexOf("/");
|
|
1695
|
+
return separatorIndex <= 0 ? "/" : normalized.slice(0, separatorIndex);
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
export { InMemoryThreadStore, LocalThreadStore, ThreadEventStore, createRenderedThreadState, renderThreadFromHistory };
|