mcp-codex-worker 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +135 -0
- package/bin/mcp-codex-worker.mjs +17 -0
- package/dist/src/app.d.ts +29 -0
- package/dist/src/app.js +353 -0
- package/dist/src/app.js.map +1 -0
- package/dist/src/config/defaults.d.ts +11 -0
- package/dist/src/config/defaults.js +12 -0
- package/dist/src/config/defaults.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +64 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mcp/tool-definitions.d.ts +180 -0
- package/dist/src/mcp/tool-definitions.js +241 -0
- package/dist/src/mcp/tool-definitions.js.map +1 -0
- package/dist/src/services/app-server-client.d.ts +65 -0
- package/dist/src/services/app-server-client.js +511 -0
- package/dist/src/services/app-server-client.js.map +1 -0
- package/dist/src/services/codex-runtime.d.ts +84 -0
- package/dist/src/services/codex-runtime.js +371 -0
- package/dist/src/services/codex-runtime.js.map +1 -0
- package/dist/src/services/fleet-mode.d.ts +3 -0
- package/dist/src/services/fleet-mode.js +21 -0
- package/dist/src/services/fleet-mode.js.map +1 -0
- package/dist/src/services/model-catalog.d.ts +22 -0
- package/dist/src/services/model-catalog.js +51 -0
- package/dist/src/services/model-catalog.js.map +1 -0
- package/dist/src/services/profile-manager.d.ts +29 -0
- package/dist/src/services/profile-manager.js +82 -0
- package/dist/src/services/profile-manager.js.map +1 -0
- package/dist/src/types/codex.d.ts +50 -0
- package/dist/src/types/codex.js +2 -0
- package/dist/src/types/codex.js.map +1 -0
- package/package.json +53 -0
- package/src/app.ts +417 -0
- package/src/config/defaults.ts +14 -0
- package/src/index.ts +84 -0
- package/src/mcp/tool-definitions.ts +280 -0
- package/src/protocol/AbsolutePathBuf.ts +14 -0
- package/src/protocol/AgentPath.ts +5 -0
- package/src/protocol/ApplyPatchApprovalParams.ts +21 -0
- package/src/protocol/ApplyPatchApprovalResponse.ts +6 -0
- package/src/protocol/AuthMode.ts +8 -0
- package/src/protocol/ClientInfo.ts +5 -0
- package/src/protocol/ClientNotification.ts +5 -0
- package/src/protocol/ClientRequest.ts +67 -0
- package/src/protocol/CollaborationMode.ts +10 -0
- package/src/protocol/ContentItem.ts +5 -0
- package/src/protocol/ConversationGitInfo.ts +5 -0
- package/src/protocol/ConversationSummary.ts +8 -0
- package/src/protocol/ExecCommandApprovalParams.ts +16 -0
- package/src/protocol/ExecCommandApprovalResponse.ts +6 -0
- package/src/protocol/ExecPolicyAmendment.ts +12 -0
- package/src/protocol/FileChange.ts +5 -0
- package/src/protocol/ForcedLoginMethod.ts +5 -0
- package/src/protocol/FunctionCallOutputBody.ts +6 -0
- package/src/protocol/FunctionCallOutputContentItem.ts +10 -0
- package/src/protocol/FuzzyFileSearchMatchType.ts +5 -0
- package/src/protocol/FuzzyFileSearchParams.ts +5 -0
- package/src/protocol/FuzzyFileSearchResponse.ts +6 -0
- package/src/protocol/FuzzyFileSearchResult.ts +9 -0
- package/src/protocol/FuzzyFileSearchSessionCompletedNotification.ts +5 -0
- package/src/protocol/FuzzyFileSearchSessionUpdatedNotification.ts +6 -0
- package/src/protocol/GetAuthStatusParams.ts +5 -0
- package/src/protocol/GetAuthStatusResponse.ts +6 -0
- package/src/protocol/GetConversationSummaryParams.ts +6 -0
- package/src/protocol/GetConversationSummaryResponse.ts +6 -0
- package/src/protocol/GhostCommit.ts +8 -0
- package/src/protocol/GitDiffToRemoteParams.ts +5 -0
- package/src/protocol/GitDiffToRemoteResponse.ts +6 -0
- package/src/protocol/GitSha.ts +5 -0
- package/src/protocol/ImageDetail.ts +5 -0
- package/src/protocol/InitializeCapabilities.ts +17 -0
- package/src/protocol/InitializeParams.ts +7 -0
- package/src/protocol/InitializeResponse.ts +20 -0
- package/src/protocol/InputModality.ts +8 -0
- package/src/protocol/LocalShellAction.ts +6 -0
- package/src/protocol/LocalShellExecAction.ts +5 -0
- package/src/protocol/LocalShellStatus.ts +5 -0
- package/src/protocol/MessagePhase.ts +11 -0
- package/src/protocol/ModeKind.ts +8 -0
- package/src/protocol/NetworkPolicyAmendment.ts +6 -0
- package/src/protocol/NetworkPolicyRuleAction.ts +5 -0
- package/src/protocol/ParsedCommand.ts +12 -0
- package/src/protocol/Personality.ts +5 -0
- package/src/protocol/PlanType.ts +5 -0
- package/src/protocol/RealtimeConversationVersion.ts +5 -0
- package/src/protocol/ReasoningEffort.ts +8 -0
- package/src/protocol/ReasoningItemContent.ts +5 -0
- package/src/protocol/ReasoningItemReasoningSummary.ts +5 -0
- package/src/protocol/ReasoningSummary.ts +10 -0
- package/src/protocol/RequestId.ts +5 -0
- package/src/protocol/Resource.ts +9 -0
- package/src/protocol/ResourceTemplate.ts +9 -0
- package/src/protocol/ResponseItem.ts +18 -0
- package/src/protocol/ReviewDecision.ts +10 -0
- package/src/protocol/ServerNotification.ts +60 -0
- package/src/protocol/ServerRequest.ts +18 -0
- package/src/protocol/ServiceTier.ts +5 -0
- package/src/protocol/SessionSource.ts +6 -0
- package/src/protocol/Settings.ts +9 -0
- package/src/protocol/SubAgentSource.ts +7 -0
- package/src/protocol/ThreadId.ts +5 -0
- package/src/protocol/Tool.ts +9 -0
- package/src/protocol/Verbosity.ts +9 -0
- package/src/protocol/WebSearchAction.ts +5 -0
- package/src/protocol/WebSearchContextSize.ts +5 -0
- package/src/protocol/WebSearchLocation.ts +5 -0
- package/src/protocol/WebSearchMode.ts +5 -0
- package/src/protocol/WebSearchToolConfig.ts +7 -0
- package/src/protocol/index.ts +75 -0
- package/src/protocol/serde_json/JsonValue.ts +5 -0
- package/src/protocol/v2/Account.ts +6 -0
- package/src/protocol/v2/AccountLoginCompletedNotification.ts +5 -0
- package/src/protocol/v2/AccountRateLimitsUpdatedNotification.ts +6 -0
- package/src/protocol/v2/AccountUpdatedNotification.ts +7 -0
- package/src/protocol/v2/AdditionalFileSystemPermissions.ts +6 -0
- package/src/protocol/v2/AdditionalNetworkPermissions.ts +5 -0
- package/src/protocol/v2/AdditionalPermissionProfile.ts +7 -0
- package/src/protocol/v2/AgentMessageDeltaNotification.ts +5 -0
- package/src/protocol/v2/AnalyticsConfig.ts +6 -0
- package/src/protocol/v2/AppBranding.ts +8 -0
- package/src/protocol/v2/AppInfo.ts +19 -0
- package/src/protocol/v2/AppListUpdatedNotification.ts +9 -0
- package/src/protocol/v2/AppMetadata.ts +7 -0
- package/src/protocol/v2/AppReview.ts +5 -0
- package/src/protocol/v2/AppScreenshot.ts +5 -0
- package/src/protocol/v2/AppSummary.ts +8 -0
- package/src/protocol/v2/AppToolApproval.ts +5 -0
- package/src/protocol/v2/AppToolsConfig.ts +6 -0
- package/src/protocol/v2/ApprovalsReviewer.ts +12 -0
- package/src/protocol/v2/AppsConfig.ts +8 -0
- package/src/protocol/v2/AppsDefaultConfig.ts +5 -0
- package/src/protocol/v2/AppsListParams.ts +24 -0
- package/src/protocol/v2/AppsListResponse.ts +14 -0
- package/src/protocol/v2/AskForApproval.ts +5 -0
- package/src/protocol/v2/ByteRange.ts +5 -0
- package/src/protocol/v2/CancelLoginAccountParams.ts +5 -0
- package/src/protocol/v2/CancelLoginAccountResponse.ts +6 -0
- package/src/protocol/v2/CancelLoginAccountStatus.ts +5 -0
- package/src/protocol/v2/ChatgptAuthTokensRefreshParams.ts +16 -0
- package/src/protocol/v2/ChatgptAuthTokensRefreshReason.ts +5 -0
- package/src/protocol/v2/ChatgptAuthTokensRefreshResponse.ts +5 -0
- package/src/protocol/v2/CodexErrorInfo.ts +12 -0
- package/src/protocol/v2/CollabAgentState.ts +6 -0
- package/src/protocol/v2/CollabAgentStatus.ts +5 -0
- package/src/protocol/v2/CollabAgentTool.ts +5 -0
- package/src/protocol/v2/CollabAgentToolCallStatus.ts +5 -0
- package/src/protocol/v2/CollaborationModeMask.ts +10 -0
- package/src/protocol/v2/CommandAction.ts +5 -0
- package/src/protocol/v2/CommandExecOutputDeltaNotification.ts +30 -0
- package/src/protocol/v2/CommandExecOutputStream.ts +8 -0
- package/src/protocol/v2/CommandExecParams.ts +97 -0
- package/src/protocol/v2/CommandExecResizeParams.ts +18 -0
- package/src/protocol/v2/CommandExecResizeResponse.ts +8 -0
- package/src/protocol/v2/CommandExecResponse.ts +24 -0
- package/src/protocol/v2/CommandExecTerminalSize.ts +16 -0
- package/src/protocol/v2/CommandExecTerminateParams.ts +13 -0
- package/src/protocol/v2/CommandExecTerminateResponse.ts +8 -0
- package/src/protocol/v2/CommandExecWriteParams.ts +22 -0
- package/src/protocol/v2/CommandExecWriteResponse.ts +8 -0
- package/src/protocol/v2/CommandExecutionApprovalDecision.ts +7 -0
- package/src/protocol/v2/CommandExecutionOutputDeltaNotification.ts +5 -0
- package/src/protocol/v2/CommandExecutionRequestApprovalParams.ts +57 -0
- package/src/protocol/v2/CommandExecutionRequestApprovalResponse.ts +6 -0
- package/src/protocol/v2/CommandExecutionSource.ts +5 -0
- package/src/protocol/v2/CommandExecutionStatus.ts +5 -0
- package/src/protocol/v2/Config.ts +23 -0
- package/src/protocol/v2/ConfigBatchWriteParams.ts +14 -0
- package/src/protocol/v2/ConfigEdit.ts +7 -0
- package/src/protocol/v2/ConfigLayer.ts +7 -0
- package/src/protocol/v2/ConfigLayerMetadata.ts +6 -0
- package/src/protocol/v2/ConfigLayerSource.ts +16 -0
- package/src/protocol/v2/ConfigReadParams.ts +11 -0
- package/src/protocol/v2/ConfigReadResponse.ts +8 -0
- package/src/protocol/v2/ConfigRequirements.ts +9 -0
- package/src/protocol/v2/ConfigRequirementsReadResponse.ts +10 -0
- package/src/protocol/v2/ConfigValueWriteParams.ts +11 -0
- package/src/protocol/v2/ConfigWarningNotification.ts +22 -0
- package/src/protocol/v2/ConfigWriteResponse.ts +12 -0
- package/src/protocol/v2/ContextCompactedNotification.ts +8 -0
- package/src/protocol/v2/CreditsSnapshot.ts +5 -0
- package/src/protocol/v2/DeprecationNoticeNotification.ts +13 -0
- package/src/protocol/v2/DynamicToolCallOutputContentItem.ts +5 -0
- package/src/protocol/v2/DynamicToolCallParams.ts +6 -0
- package/src/protocol/v2/DynamicToolCallResponse.ts +6 -0
- package/src/protocol/v2/DynamicToolCallStatus.ts +5 -0
- package/src/protocol/v2/DynamicToolSpec.ts +6 -0
- package/src/protocol/v2/ErrorNotification.ts +6 -0
- package/src/protocol/v2/ExecPolicyAmendment.ts +5 -0
- package/src/protocol/v2/ExperimentalFeature.ts +37 -0
- package/src/protocol/v2/ExperimentalFeatureEnablementSetParams.ts +12 -0
- package/src/protocol/v2/ExperimentalFeatureEnablementSetResponse.ts +9 -0
- package/src/protocol/v2/ExperimentalFeatureListParams.ts +13 -0
- package/src/protocol/v2/ExperimentalFeatureListResponse.ts +11 -0
- package/src/protocol/v2/ExperimentalFeatureStage.ts +5 -0
- package/src/protocol/v2/ExternalAgentConfigDetectParams.ts +13 -0
- package/src/protocol/v2/ExternalAgentConfigDetectResponse.ts +6 -0
- package/src/protocol/v2/ExternalAgentConfigImportParams.ts +6 -0
- package/src/protocol/v2/ExternalAgentConfigImportResponse.ts +5 -0
- package/src/protocol/v2/ExternalAgentConfigMigrationItem.ts +10 -0
- package/src/protocol/v2/ExternalAgentConfigMigrationItemType.ts +5 -0
- package/src/protocol/v2/FeedbackUploadParams.ts +5 -0
- package/src/protocol/v2/FeedbackUploadResponse.ts +5 -0
- package/src/protocol/v2/FileChangeApprovalDecision.ts +5 -0
- package/src/protocol/v2/FileChangeOutputDeltaNotification.ts +5 -0
- package/src/protocol/v2/FileChangeRequestApprovalParams.ts +14 -0
- package/src/protocol/v2/FileChangeRequestApprovalResponse.ts +6 -0
- package/src/protocol/v2/FileUpdateChange.ts +6 -0
- package/src/protocol/v2/FsChangedNotification.ts +17 -0
- package/src/protocol/v2/FsCopyParams.ts +21 -0
- package/src/protocol/v2/FsCopyResponse.ts +8 -0
- package/src/protocol/v2/FsCreateDirectoryParams.ts +17 -0
- package/src/protocol/v2/FsCreateDirectoryResponse.ts +8 -0
- package/src/protocol/v2/FsGetMetadataParams.ts +13 -0
- package/src/protocol/v2/FsGetMetadataResponse.ts +24 -0
- package/src/protocol/v2/FsReadDirectoryEntry.ts +20 -0
- package/src/protocol/v2/FsReadDirectoryParams.ts +13 -0
- package/src/protocol/v2/FsReadDirectoryResponse.ts +13 -0
- package/src/protocol/v2/FsReadFileParams.ts +13 -0
- package/src/protocol/v2/FsReadFileResponse.ts +12 -0
- package/src/protocol/v2/FsRemoveParams.ts +21 -0
- package/src/protocol/v2/FsRemoveResponse.ts +8 -0
- package/src/protocol/v2/FsUnwatchParams.ts +12 -0
- package/src/protocol/v2/FsUnwatchResponse.ts +8 -0
- package/src/protocol/v2/FsWatchParams.ts +13 -0
- package/src/protocol/v2/FsWatchResponse.ts +17 -0
- package/src/protocol/v2/FsWriteFileParams.ts +17 -0
- package/src/protocol/v2/FsWriteFileResponse.ts +8 -0
- package/src/protocol/v2/GetAccountParams.ts +13 -0
- package/src/protocol/v2/GetAccountRateLimitsResponse.ts +14 -0
- package/src/protocol/v2/GetAccountResponse.ts +6 -0
- package/src/protocol/v2/GitInfo.ts +5 -0
- package/src/protocol/v2/GrantedPermissionProfile.ts +7 -0
- package/src/protocol/v2/GuardianApprovalReview.ts +12 -0
- package/src/protocol/v2/GuardianApprovalReviewStatus.ts +8 -0
- package/src/protocol/v2/GuardianRiskLevel.ts +8 -0
- package/src/protocol/v2/HookCompletedNotification.ts +6 -0
- package/src/protocol/v2/HookEventName.ts +5 -0
- package/src/protocol/v2/HookExecutionMode.ts +5 -0
- package/src/protocol/v2/HookHandlerType.ts +5 -0
- package/src/protocol/v2/HookOutputEntry.ts +6 -0
- package/src/protocol/v2/HookOutputEntryKind.ts +5 -0
- package/src/protocol/v2/HookPromptFragment.ts +5 -0
- package/src/protocol/v2/HookRunStatus.ts +5 -0
- package/src/protocol/v2/HookRunSummary.ts +11 -0
- package/src/protocol/v2/HookScope.ts +5 -0
- package/src/protocol/v2/HookStartedNotification.ts +6 -0
- package/src/protocol/v2/ItemCompletedNotification.ts +6 -0
- package/src/protocol/v2/ItemGuardianApprovalReviewCompletedNotification.ts +15 -0
- package/src/protocol/v2/ItemGuardianApprovalReviewStartedNotification.ts +15 -0
- package/src/protocol/v2/ItemStartedNotification.ts +6 -0
- package/src/protocol/v2/ListMcpServerStatusParams.ts +13 -0
- package/src/protocol/v2/ListMcpServerStatusResponse.ts +11 -0
- package/src/protocol/v2/LoginAccountParams.ts +21 -0
- package/src/protocol/v2/LoginAccountResponse.ts +17 -0
- package/src/protocol/v2/LogoutAccountResponse.ts +5 -0
- package/src/protocol/v2/MarketplaceInterface.ts +5 -0
- package/src/protocol/v2/MarketplaceLoadErrorInfo.ts +6 -0
- package/src/protocol/v2/McpAuthStatus.ts +5 -0
- package/src/protocol/v2/McpElicitationArrayType.ts +5 -0
- package/src/protocol/v2/McpElicitationBooleanSchema.ts +6 -0
- package/src/protocol/v2/McpElicitationBooleanType.ts +5 -0
- package/src/protocol/v2/McpElicitationConstOption.ts +5 -0
- package/src/protocol/v2/McpElicitationEnumSchema.ts +8 -0
- package/src/protocol/v2/McpElicitationLegacyTitledEnumSchema.ts +6 -0
- package/src/protocol/v2/McpElicitationMultiSelectEnumSchema.ts +7 -0
- package/src/protocol/v2/McpElicitationNumberSchema.ts +6 -0
- package/src/protocol/v2/McpElicitationNumberType.ts +5 -0
- package/src/protocol/v2/McpElicitationObjectType.ts +5 -0
- package/src/protocol/v2/McpElicitationPrimitiveSchema.ts +9 -0
- package/src/protocol/v2/McpElicitationSchema.ts +13 -0
- package/src/protocol/v2/McpElicitationSingleSelectEnumSchema.ts +7 -0
- package/src/protocol/v2/McpElicitationStringFormat.ts +5 -0
- package/src/protocol/v2/McpElicitationStringSchema.ts +7 -0
- package/src/protocol/v2/McpElicitationStringType.ts +5 -0
- package/src/protocol/v2/McpElicitationTitledEnumItems.ts +6 -0
- package/src/protocol/v2/McpElicitationTitledMultiSelectEnumSchema.ts +7 -0
- package/src/protocol/v2/McpElicitationTitledSingleSelectEnumSchema.ts +7 -0
- package/src/protocol/v2/McpElicitationUntitledEnumItems.ts +6 -0
- package/src/protocol/v2/McpElicitationUntitledMultiSelectEnumSchema.ts +7 -0
- package/src/protocol/v2/McpElicitationUntitledSingleSelectEnumSchema.ts +6 -0
- package/src/protocol/v2/McpServerElicitationAction.ts +5 -0
- package/src/protocol/v2/McpServerElicitationRequestParams.ts +16 -0
- package/src/protocol/v2/McpServerElicitationRequestResponse.ts +17 -0
- package/src/protocol/v2/McpServerOauthLoginCompletedNotification.ts +5 -0
- package/src/protocol/v2/McpServerOauthLoginParams.ts +5 -0
- package/src/protocol/v2/McpServerOauthLoginResponse.ts +5 -0
- package/src/protocol/v2/McpServerRefreshResponse.ts +5 -0
- package/src/protocol/v2/McpServerStartupState.ts +5 -0
- package/src/protocol/v2/McpServerStatus.ts +9 -0
- package/src/protocol/v2/McpServerStatusUpdatedNotification.ts +6 -0
- package/src/protocol/v2/McpToolCallError.ts +5 -0
- package/src/protocol/v2/McpToolCallProgressNotification.ts +5 -0
- package/src/protocol/v2/McpToolCallResult.ts +6 -0
- package/src/protocol/v2/McpToolCallStatus.ts +5 -0
- package/src/protocol/v2/MemoryCitation.ts +6 -0
- package/src/protocol/v2/MemoryCitationEntry.ts +5 -0
- package/src/protocol/v2/MergeStrategy.ts +5 -0
- package/src/protocol/v2/Model.ts +10 -0
- package/src/protocol/v2/ModelAvailabilityNux.ts +5 -0
- package/src/protocol/v2/ModelListParams.ts +17 -0
- package/src/protocol/v2/ModelListResponse.ts +11 -0
- package/src/protocol/v2/ModelRerouteReason.ts +5 -0
- package/src/protocol/v2/ModelReroutedNotification.ts +6 -0
- package/src/protocol/v2/ModelUpgradeInfo.ts +5 -0
- package/src/protocol/v2/NetworkAccess.ts +5 -0
- package/src/protocol/v2/NetworkApprovalContext.ts +6 -0
- package/src/protocol/v2/NetworkApprovalProtocol.ts +5 -0
- package/src/protocol/v2/NetworkDomainPermission.ts +5 -0
- package/src/protocol/v2/NetworkPolicyAmendment.ts +6 -0
- package/src/protocol/v2/NetworkPolicyRuleAction.ts +5 -0
- package/src/protocol/v2/NetworkRequirements.ts +32 -0
- package/src/protocol/v2/NetworkUnixSocketPermission.ts +5 -0
- package/src/protocol/v2/NonSteerableTurnKind.ts +5 -0
- package/src/protocol/v2/OverriddenMetadata.ts +7 -0
- package/src/protocol/v2/PatchApplyStatus.ts +5 -0
- package/src/protocol/v2/PatchChangeKind.ts +5 -0
- package/src/protocol/v2/PermissionGrantScope.ts +5 -0
- package/src/protocol/v2/PermissionsRequestApprovalParams.ts +6 -0
- package/src/protocol/v2/PermissionsRequestApprovalResponse.ts +7 -0
- package/src/protocol/v2/PlanDeltaNotification.ts +9 -0
- package/src/protocol/v2/PluginAuthPolicy.ts +5 -0
- package/src/protocol/v2/PluginDetail.ts +9 -0
- package/src/protocol/v2/PluginInstallParams.ts +10 -0
- package/src/protocol/v2/PluginInstallPolicy.ts +5 -0
- package/src/protocol/v2/PluginInstallResponse.ts +7 -0
- package/src/protocol/v2/PluginInterface.ts +11 -0
- package/src/protocol/v2/PluginListParams.ts +16 -0
- package/src/protocol/v2/PluginListResponse.ts +7 -0
- package/src/protocol/v2/PluginMarketplaceEntry.ts +8 -0
- package/src/protocol/v2/PluginReadParams.ts +6 -0
- package/src/protocol/v2/PluginReadResponse.ts +6 -0
- package/src/protocol/v2/PluginSource.ts +6 -0
- package/src/protocol/v2/PluginSummary.ts +9 -0
- package/src/protocol/v2/PluginUninstallParams.ts +9 -0
- package/src/protocol/v2/PluginUninstallResponse.ts +5 -0
- package/src/protocol/v2/ProfileV2.ts +19 -0
- package/src/protocol/v2/RateLimitSnapshot.ts +8 -0
- package/src/protocol/v2/RateLimitWindow.ts +5 -0
- package/src/protocol/v2/RawResponseItemCompletedNotification.ts +6 -0
- package/src/protocol/v2/ReadOnlyAccess.ts +6 -0
- package/src/protocol/v2/ReasoningEffortOption.ts +6 -0
- package/src/protocol/v2/ReasoningSummaryPartAddedNotification.ts +5 -0
- package/src/protocol/v2/ReasoningSummaryTextDeltaNotification.ts +5 -0
- package/src/protocol/v2/ReasoningTextDeltaNotification.ts +5 -0
- package/src/protocol/v2/RequestPermissionProfile.ts +7 -0
- package/src/protocol/v2/ResidencyRequirement.ts +5 -0
- package/src/protocol/v2/ReviewDelivery.ts +5 -0
- package/src/protocol/v2/ReviewStartParams.ts +12 -0
- package/src/protocol/v2/ReviewStartResponse.ts +13 -0
- package/src/protocol/v2/ReviewTarget.ts +9 -0
- package/src/protocol/v2/SandboxMode.ts +5 -0
- package/src/protocol/v2/SandboxPolicy.ts +8 -0
- package/src/protocol/v2/SandboxWorkspaceWrite.ts +5 -0
- package/src/protocol/v2/ServerRequestResolvedNotification.ts +6 -0
- package/src/protocol/v2/SessionSource.ts +6 -0
- package/src/protocol/v2/SkillDependencies.ts +6 -0
- package/src/protocol/v2/SkillErrorInfo.ts +5 -0
- package/src/protocol/v2/SkillInterface.ts +5 -0
- package/src/protocol/v2/SkillMetadata.ts +12 -0
- package/src/protocol/v2/SkillScope.ts +5 -0
- package/src/protocol/v2/SkillSummary.ts +6 -0
- package/src/protocol/v2/SkillToolDependency.ts +5 -0
- package/src/protocol/v2/SkillsChangedNotification.ts +11 -0
- package/src/protocol/v2/SkillsConfigWriteParams.ts +14 -0
- package/src/protocol/v2/SkillsConfigWriteResponse.ts +5 -0
- package/src/protocol/v2/SkillsListEntry.ts +7 -0
- package/src/protocol/v2/SkillsListExtraRootsForCwd.ts +5 -0
- package/src/protocol/v2/SkillsListParams.ts +18 -0
- package/src/protocol/v2/SkillsListResponse.ts +6 -0
- package/src/protocol/v2/TerminalInteractionNotification.ts +5 -0
- package/src/protocol/v2/TextElement.ts +14 -0
- package/src/protocol/v2/TextPosition.ts +13 -0
- package/src/protocol/v2/TextRange.ts +6 -0
- package/src/protocol/v2/Thread.ts +72 -0
- package/src/protocol/v2/ThreadActiveFlag.ts +5 -0
- package/src/protocol/v2/ThreadArchiveParams.ts +5 -0
- package/src/protocol/v2/ThreadArchiveResponse.ts +5 -0
- package/src/protocol/v2/ThreadArchivedNotification.ts +5 -0
- package/src/protocol/v2/ThreadClosedNotification.ts +5 -0
- package/src/protocol/v2/ThreadCompactStartParams.ts +5 -0
- package/src/protocol/v2/ThreadCompactStartResponse.ts +5 -0
- package/src/protocol/v2/ThreadForkParams.ts +34 -0
- package/src/protocol/v2/ThreadForkResponse.ts +15 -0
- package/src/protocol/v2/ThreadItem.ts +100 -0
- package/src/protocol/v2/ThreadListParams.ts +43 -0
- package/src/protocol/v2/ThreadListResponse.ts +11 -0
- package/src/protocol/v2/ThreadLoadedListParams.ts +13 -0
- package/src/protocol/v2/ThreadLoadedListResponse.ts +14 -0
- package/src/protocol/v2/ThreadMetadataGitInfoUpdateParams.ts +20 -0
- package/src/protocol/v2/ThreadMetadataUpdateParams.ts +12 -0
- package/src/protocol/v2/ThreadMetadataUpdateResponse.ts +6 -0
- package/src/protocol/v2/ThreadNameUpdatedNotification.ts +5 -0
- package/src/protocol/v2/ThreadReadParams.ts +9 -0
- package/src/protocol/v2/ThreadReadResponse.ts +6 -0
- package/src/protocol/v2/ThreadRealtimeAudioChunk.ts +8 -0
- package/src/protocol/v2/ThreadRealtimeClosedNotification.ts +8 -0
- package/src/protocol/v2/ThreadRealtimeErrorNotification.ts +8 -0
- package/src/protocol/v2/ThreadRealtimeItemAddedNotification.ts +9 -0
- package/src/protocol/v2/ThreadRealtimeOutputAudioDeltaNotification.ts +9 -0
- package/src/protocol/v2/ThreadRealtimeStartedNotification.ts +9 -0
- package/src/protocol/v2/ThreadRealtimeTranscriptUpdatedNotification.ts +9 -0
- package/src/protocol/v2/ThreadResumeParams.ts +43 -0
- package/src/protocol/v2/ThreadResumeResponse.ts +15 -0
- package/src/protocol/v2/ThreadRollbackParams.ts +12 -0
- package/src/protocol/v2/ThreadRollbackResponse.ts +14 -0
- package/src/protocol/v2/ThreadSetNameParams.ts +5 -0
- package/src/protocol/v2/ThreadSetNameResponse.ts +5 -0
- package/src/protocol/v2/ThreadShellCommandParams.ts +12 -0
- package/src/protocol/v2/ThreadShellCommandResponse.ts +5 -0
- package/src/protocol/v2/ThreadSortKey.ts +5 -0
- package/src/protocol/v2/ThreadSourceKind.ts +5 -0
- package/src/protocol/v2/ThreadStartParams.ts +23 -0
- package/src/protocol/v2/ThreadStartResponse.ts +15 -0
- package/src/protocol/v2/ThreadStartedNotification.ts +6 -0
- package/src/protocol/v2/ThreadStatus.ts +6 -0
- package/src/protocol/v2/ThreadStatusChangedNotification.ts +6 -0
- package/src/protocol/v2/ThreadTokenUsage.ts +6 -0
- package/src/protocol/v2/ThreadTokenUsageUpdatedNotification.ts +6 -0
- package/src/protocol/v2/ThreadUnarchiveParams.ts +5 -0
- package/src/protocol/v2/ThreadUnarchiveResponse.ts +6 -0
- package/src/protocol/v2/ThreadUnarchivedNotification.ts +5 -0
- package/src/protocol/v2/ThreadUnsubscribeParams.ts +5 -0
- package/src/protocol/v2/ThreadUnsubscribeResponse.ts +6 -0
- package/src/protocol/v2/ThreadUnsubscribeStatus.ts +5 -0
- package/src/protocol/v2/TokenUsageBreakdown.ts +5 -0
- package/src/protocol/v2/ToolRequestUserInputAnswer.ts +8 -0
- package/src/protocol/v2/ToolRequestUserInputOption.ts +8 -0
- package/src/protocol/v2/ToolRequestUserInputParams.ts +9 -0
- package/src/protocol/v2/ToolRequestUserInputQuestion.ts +9 -0
- package/src/protocol/v2/ToolRequestUserInputResponse.ts +9 -0
- package/src/protocol/v2/ToolsV2.ts +6 -0
- package/src/protocol/v2/Turn.ts +18 -0
- package/src/protocol/v2/TurnCompletedNotification.ts +6 -0
- package/src/protocol/v2/TurnDiffUpdatedNotification.ts +9 -0
- package/src/protocol/v2/TurnError.ts +6 -0
- package/src/protocol/v2/TurnInterruptParams.ts +5 -0
- package/src/protocol/v2/TurnInterruptResponse.ts +5 -0
- package/src/protocol/v2/TurnPlanStep.ts +6 -0
- package/src/protocol/v2/TurnPlanStepStatus.ts +5 -0
- package/src/protocol/v2/TurnPlanUpdatedNotification.ts +6 -0
- package/src/protocol/v2/TurnStartParams.ts +54 -0
- package/src/protocol/v2/TurnStartResponse.ts +6 -0
- package/src/protocol/v2/TurnStartedNotification.ts +6 -0
- package/src/protocol/v2/TurnStatus.ts +5 -0
- package/src/protocol/v2/TurnSteerParams.ts +11 -0
- package/src/protocol/v2/TurnSteerResponse.ts +5 -0
- package/src/protocol/v2/UserInput.ts +10 -0
- package/src/protocol/v2/WebSearchAction.ts +5 -0
- package/src/protocol/v2/WindowsSandboxSetupCompletedNotification.ts +6 -0
- package/src/protocol/v2/WindowsSandboxSetupMode.ts +5 -0
- package/src/protocol/v2/WindowsSandboxSetupStartParams.ts +7 -0
- package/src/protocol/v2/WindowsSandboxSetupStartResponse.ts +5 -0
- package/src/protocol/v2/WindowsWorldWritableWarningNotification.ts +5 -0
- package/src/protocol/v2/WriteStatus.ts +5 -0
- package/src/protocol/v2/index.ts +346 -0
- package/src/services/app-server-client.ts +636 -0
- package/src/services/codex-runtime.ts +500 -0
- package/src/services/fleet-mode.ts +29 -0
- package/src/services/model-catalog.ts +86 -0
- package/src/services/profile-manager.ts +113 -0
- package/src/types/codex.ts +57 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { homedir } from 'node:os';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { CODEX_HOME_DIRS_ENV, PROFILE_COOLDOWN_MS } from '../config/defaults.js';
|
|
5
|
+
|
|
6
|
+
export interface CodexProfile {
|
|
7
|
+
id: string;
|
|
8
|
+
codexHome: string;
|
|
9
|
+
cooldownUntil?: number | undefined;
|
|
10
|
+
failureCount: number;
|
|
11
|
+
lastFailureReason?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface ProfileManagerOptions {
|
|
15
|
+
codexHomes?: string[] | undefined;
|
|
16
|
+
cooldownMs?: number | undefined;
|
|
17
|
+
now?: (() => number) | undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function defaultCodexHome(): string {
|
|
21
|
+
return join(homedir(), '.codex');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function dedupeHomes(codexHomes: string[]): string[] {
|
|
25
|
+
const seen = new Set<string>();
|
|
26
|
+
const result: string[] = [];
|
|
27
|
+
|
|
28
|
+
for (const home of codexHomes) {
|
|
29
|
+
const normalized = home.trim();
|
|
30
|
+
if (!normalized || seen.has(normalized)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
seen.add(normalized);
|
|
34
|
+
result.push(normalized);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return result.length > 0 ? result : [defaultCodexHome()];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class ProfileManager {
|
|
41
|
+
private readonly cooldownMs: number;
|
|
42
|
+
private readonly now: () => number;
|
|
43
|
+
private readonly profiles: CodexProfile[];
|
|
44
|
+
private currentIndex = 0;
|
|
45
|
+
|
|
46
|
+
constructor(options: ProfileManagerOptions = {}) {
|
|
47
|
+
this.cooldownMs = options.cooldownMs ?? PROFILE_COOLDOWN_MS;
|
|
48
|
+
this.now = options.now ?? Date.now;
|
|
49
|
+
|
|
50
|
+
this.profiles = dedupeHomes(options.codexHomes ?? [defaultCodexHome()]).map((codexHome, index) => ({
|
|
51
|
+
id: `profile-${index + 1}`,
|
|
52
|
+
codexHome,
|
|
53
|
+
failureCount: 0,
|
|
54
|
+
}));
|
|
55
|
+
this.currentIndex = this.findFirstAvailableIndex();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static fromEnvironment(now?: () => number): ProfileManager {
|
|
59
|
+
const raw = process.env[CODEX_HOME_DIRS_ENV];
|
|
60
|
+
const homes = raw
|
|
61
|
+
? raw.split(':').map((entry) => entry.trim()).filter(Boolean)
|
|
62
|
+
: [defaultCodexHome()];
|
|
63
|
+
return new ProfileManager({ codexHomes: homes, now });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getCurrentProfile(): CodexProfile {
|
|
67
|
+
this.resetExpiredCooldowns();
|
|
68
|
+
return { ...this.profiles[this.currentIndex]! };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
getProfiles(): CodexProfile[] {
|
|
72
|
+
this.resetExpiredCooldowns();
|
|
73
|
+
return this.profiles.map((profile) => ({ ...profile }));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
markFailure(reason: string): { rotated: boolean; profile?: CodexProfile } {
|
|
77
|
+
const current = this.profiles[this.currentIndex];
|
|
78
|
+
if (!current) {
|
|
79
|
+
return { rotated: false };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
current.failureCount += 1;
|
|
83
|
+
current.lastFailureReason = reason;
|
|
84
|
+
current.cooldownUntil = this.now() + this.cooldownMs;
|
|
85
|
+
|
|
86
|
+
const nextIndex = this.findFirstAvailableIndex();
|
|
87
|
+
if (nextIndex === -1) {
|
|
88
|
+
return { rotated: false };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
this.currentIndex = nextIndex;
|
|
92
|
+
return { rotated: true, profile: this.getCurrentProfile() };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private resetExpiredCooldowns(): void {
|
|
96
|
+
const now = this.now();
|
|
97
|
+
for (const profile of this.profiles) {
|
|
98
|
+
if (profile.cooldownUntil !== undefined && profile.cooldownUntil <= now) {
|
|
99
|
+
profile.cooldownUntil = undefined;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const nextIndex = this.findFirstAvailableIndex();
|
|
103
|
+
if (nextIndex !== -1) {
|
|
104
|
+
this.currentIndex = nextIndex;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private findFirstAvailableIndex(): number {
|
|
109
|
+
const now = this.now();
|
|
110
|
+
return this.profiles.findIndex((profile) => profile.cooldownUntil === undefined || profile.cooldownUntil <= now);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type RequestId = string | number;
|
|
2
|
+
|
|
3
|
+
export interface JsonLineRequest {
|
|
4
|
+
method: string;
|
|
5
|
+
id: RequestId;
|
|
6
|
+
params: unknown;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface JsonLineNotification {
|
|
10
|
+
method: string;
|
|
11
|
+
params: unknown;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface JsonLineResponse {
|
|
15
|
+
id: RequestId;
|
|
16
|
+
result?: unknown;
|
|
17
|
+
error?: unknown;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type JsonLineMessage = JsonLineRequest | JsonLineNotification | JsonLineResponse;
|
|
21
|
+
|
|
22
|
+
export interface InitializeParams {
|
|
23
|
+
clientInfo: {
|
|
24
|
+
name: string;
|
|
25
|
+
title: string | null;
|
|
26
|
+
version: string;
|
|
27
|
+
};
|
|
28
|
+
capabilities: {
|
|
29
|
+
experimentalApi: boolean;
|
|
30
|
+
optOutNotificationMethods?: string[] | null;
|
|
31
|
+
} | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface PendingServerRequest {
|
|
35
|
+
id: RequestId;
|
|
36
|
+
method: string;
|
|
37
|
+
params: unknown;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
resolvedAt?: string | undefined;
|
|
40
|
+
response?: unknown;
|
|
41
|
+
resolutionError?: string | undefined;
|
|
42
|
+
status: 'pending' | 'resolved' | 'failed';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface RuntimeOperation {
|
|
46
|
+
operationId: string;
|
|
47
|
+
requestId: RequestId;
|
|
48
|
+
method: string;
|
|
49
|
+
threadId?: string | undefined;
|
|
50
|
+
turnId?: string | undefined;
|
|
51
|
+
startedAt: string;
|
|
52
|
+
completedAt?: string | undefined;
|
|
53
|
+
status: 'running' | 'completed' | 'failed';
|
|
54
|
+
result?: unknown;
|
|
55
|
+
error?: string;
|
|
56
|
+
pendingRequestIds: RequestId[];
|
|
57
|
+
}
|