@makaio/adapter-codex-app-server 1.0.0-dev-1779051654000 → 1.0.0-dev-1781368205459
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/LICENSE +1 -1
- package/dist/adapter.d.ts +51 -0
- package/dist/agent.d.ts +148 -0
- package/dist/bus/index.d.ts +2 -0
- package/dist/bus/register.d.ts +10 -0
- package/dist/bus/schemas.d.ts +80 -0
- package/dist/config.d.ts +4 -0
- package/dist/connector/approval-handlers.d.ts +111 -0
- package/dist/connector/client-handlers.d.ts +56 -0
- package/dist/connector/connection-manager.d.ts +88 -0
- package/dist/connector/connector.d.ts +95 -0
- package/dist/connector/delta-handlers.d.ts +37 -0
- package/dist/connector/index.d.ts +6 -0
- package/dist/connector/lifecycle-handlers.d.ts +69 -0
- package/dist/connector/turn-flow-handlers.d.ts +136 -0
- package/dist/connector/types.d.ts +69 -0
- package/dist/connector.d.ts +5 -0
- package/dist/constants.d.ts +14 -0
- package/dist/definition.d.ts +9 -0
- package/dist/dynamic-tool-handling.d.ts +166 -0
- package/dist/event-normalizers.d.ts +27 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.mjs +14 -3586
- package/dist/namespaces/index.d.ts +750 -0
- package/dist/namespaces/schemas/agent-message.d.ts +23 -0
- package/dist/namespaces/schemas/command-execution.d.ts +73 -0
- package/dist/namespaces/schemas/dynamic-tool-call.d.ts +64 -0
- package/dist/namespaces/schemas/file-change.d.ts +43 -0
- package/dist/namespaces/schemas/item-lifecycle.d.ts +25 -0
- package/dist/namespaces/schemas/reasoning.d.ts +23 -0
- package/dist/namespaces/schemas/shared.d.ts +26 -0
- package/dist/namespaces/schemas/thread-lifecycle.d.ts +26 -0
- package/dist/namespaces/schemas/token-usage.d.ts +20 -0
- package/dist/namespaces/schemas/turn-lifecycle.d.ts +110 -0
- package/dist/package.d.ts +11 -0
- package/dist/protocol/generated/AbsolutePathBuf.d.ts +10 -0
- package/dist/protocol/generated/AddConversationListenerParams.d.ts +5 -0
- package/dist/protocol/generated/AddConversationSubscriptionResponse.d.ts +3 -0
- package/dist/protocol/generated/AgentMessageContent.d.ts +4 -0
- package/dist/protocol/generated/AgentMessageContentDeltaEvent.d.ts +6 -0
- package/dist/protocol/generated/AgentMessageDeltaEvent.d.ts +3 -0
- package/dist/protocol/generated/AgentMessageEvent.d.ts +3 -0
- package/dist/protocol/generated/AgentMessageItem.d.ts +5 -0
- package/dist/protocol/generated/AgentReasoningDeltaEvent.d.ts +3 -0
- package/dist/protocol/generated/AgentReasoningEvent.d.ts +3 -0
- package/dist/protocol/generated/AgentReasoningRawContentDeltaEvent.d.ts +3 -0
- package/dist/protocol/generated/AgentReasoningRawContentEvent.d.ts +3 -0
- package/dist/protocol/generated/AgentReasoningSectionBreakEvent.d.ts +4 -0
- package/dist/protocol/generated/Annotations.d.ts +9 -0
- package/dist/protocol/generated/ApplyPatchApprovalParams.d.ts +22 -0
- package/dist/protocol/generated/ApplyPatchApprovalRequestEvent.d.ts +23 -0
- package/dist/protocol/generated/ApplyPatchApprovalResponse.d.ts +4 -0
- package/dist/protocol/generated/ArchiveConversationParams.d.ts +5 -0
- package/dist/protocol/generated/ArchiveConversationResponse.d.ts +1 -0
- package/dist/protocol/generated/AskForApproval.d.ts +5 -0
- package/dist/protocol/generated/AudioContent.d.ts +10 -0
- package/dist/protocol/generated/AuthMode.d.ts +1 -0
- package/dist/protocol/generated/AuthStatusChangeNotification.d.ts +7 -0
- package/dist/protocol/generated/BackgroundEventEvent.d.ts +3 -0
- package/dist/protocol/generated/BlobResourceContents.d.ts +5 -0
- package/dist/protocol/generated/CallToolResult.d.ts +10 -0
- package/dist/protocol/generated/CancelLoginChatGptParams.d.ts +3 -0
- package/dist/protocol/generated/CancelLoginChatGptResponse.d.ts +1 -0
- package/dist/protocol/generated/ClientInfo.d.ts +5 -0
- package/dist/protocol/generated/ClientNotification.d.ts +3 -0
- package/dist/protocol/generated/ClientRequest.d.ts +242 -0
- package/dist/protocol/generated/CodexErrorInfo.d.ts +20 -0
- package/dist/protocol/generated/ContentBlock.d.ts +6 -0
- package/dist/protocol/generated/ContentItem.d.ts +10 -0
- package/dist/protocol/generated/ContextCompactedEvent.d.ts +1 -0
- package/dist/protocol/generated/ConversationGitInfo.d.ts +5 -0
- package/dist/protocol/generated/ConversationSummary.d.ts +14 -0
- package/dist/protocol/generated/CreditsSnapshot.d.ts +5 -0
- package/dist/protocol/generated/CustomPrompt.d.ts +7 -0
- package/dist/protocol/generated/DeprecationNoticeEvent.d.ts +10 -0
- package/dist/protocol/generated/ElicitationRequestEvent.d.ts +6 -0
- package/dist/protocol/generated/EmbeddedResource.d.ts +13 -0
- package/dist/protocol/generated/EmbeddedResourceResource.d.ts +3 -0
- package/dist/protocol/generated/ErrorEvent.d.ts +5 -0
- package/dist/protocol/generated/EventMsg.d.ts +165 -0
- package/dist/protocol/generated/ExecApprovalRequestEvent.d.ts +30 -0
- package/dist/protocol/generated/ExecCommandApprovalParams.d.ts +14 -0
- package/dist/protocol/generated/ExecCommandApprovalResponse.d.ts +4 -0
- package/dist/protocol/generated/ExecCommandBeginEvent.d.ts +33 -0
- package/dist/protocol/generated/ExecCommandEndEvent.d.ts +57 -0
- package/dist/protocol/generated/ExecCommandOutputDeltaEvent.d.ts +15 -0
- package/dist/protocol/generated/ExecCommandSource.d.ts +1 -0
- package/dist/protocol/generated/ExecOneOffCommandParams.d.ts +7 -0
- package/dist/protocol/generated/ExecOneOffCommandResponse.d.ts +5 -0
- package/dist/protocol/generated/ExecOutputStream.d.ts +1 -0
- package/dist/protocol/generated/ExecPolicyAmendment.d.ts +8 -0
- package/dist/protocol/generated/ExitedReviewModeEvent.d.ts +4 -0
- package/dist/protocol/generated/FileChange.d.ts +11 -0
- package/dist/protocol/generated/ForcedLoginMethod.d.ts +1 -0
- package/dist/protocol/generated/ForkConversationParams.d.ts +7 -0
- package/dist/protocol/generated/ForkConversationResponse.d.ts +8 -0
- package/dist/protocol/generated/FunctionCallOutputContentItem.d.ts +11 -0
- package/dist/protocol/generated/FunctionCallOutputPayload.d.ts +15 -0
- package/dist/protocol/generated/FuzzyFileSearchParams.d.ts +5 -0
- package/dist/protocol/generated/FuzzyFileSearchResponse.d.ts +4 -0
- package/dist/protocol/generated/FuzzyFileSearchResult.d.ts +10 -0
- package/dist/protocol/generated/GetAuthStatusParams.d.ts +4 -0
- package/dist/protocol/generated/GetAuthStatusResponse.d.ts +6 -0
- package/dist/protocol/generated/GetConversationSummaryParams.d.ts +6 -0
- package/dist/protocol/generated/GetConversationSummaryResponse.d.ts +4 -0
- package/dist/protocol/generated/GetHistoryEntryResponseEvent.d.ts +9 -0
- package/dist/protocol/generated/GetUserAgentResponse.d.ts +3 -0
- package/dist/protocol/generated/GetUserSavedConfigResponse.d.ts +4 -0
- package/dist/protocol/generated/GhostCommit.d.ts +9 -0
- package/dist/protocol/generated/GitDiffToRemoteParams.d.ts +3 -0
- package/dist/protocol/generated/GitDiffToRemoteResponse.d.ts +5 -0
- package/dist/protocol/generated/GitSha.d.ts +1 -0
- package/dist/protocol/generated/HistoryEntry.d.ts +5 -0
- package/dist/protocol/generated/ImageContent.d.ts +10 -0
- package/dist/protocol/generated/InitializeParams.d.ts +4 -0
- package/dist/protocol/generated/InitializeResponse.d.ts +3 -0
- package/dist/protocol/generated/InputItem.d.ts +16 -0
- package/dist/protocol/generated/InterruptConversationParams.d.ts +4 -0
- package/dist/protocol/generated/InterruptConversationResponse.d.ts +4 -0
- package/dist/protocol/generated/ItemCompletedEvent.d.ts +7 -0
- package/dist/protocol/generated/ItemStartedEvent.d.ts +7 -0
- package/dist/protocol/generated/ListConversationsParams.d.ts +5 -0
- package/dist/protocol/generated/ListConversationsResponse.d.ts +5 -0
- package/dist/protocol/generated/ListCustomPromptsResponseEvent.d.ts +7 -0
- package/dist/protocol/generated/ListSkillsResponseEvent.d.ts +7 -0
- package/dist/protocol/generated/LocalShellAction.d.ts +4 -0
- package/dist/protocol/generated/LocalShellExecAction.d.ts +9 -0
- package/dist/protocol/generated/LocalShellStatus.d.ts +1 -0
- package/dist/protocol/generated/LoginApiKeyParams.d.ts +3 -0
- package/dist/protocol/generated/LoginApiKeyResponse.d.ts +1 -0
- package/dist/protocol/generated/LoginChatGptCompleteNotification.d.ts +8 -0
- package/dist/protocol/generated/LoginChatGptResponse.d.ts +4 -0
- package/dist/protocol/generated/LogoutChatGptResponse.d.ts +1 -0
- package/dist/protocol/generated/McpAuthStatus.d.ts +1 -0
- package/dist/protocol/generated/McpInvocation.d.ts +15 -0
- package/dist/protocol/generated/McpListToolsResponseEvent.d.ts +30 -0
- package/dist/protocol/generated/McpStartupCompleteEvent.d.ts +6 -0
- package/dist/protocol/generated/McpStartupFailure.d.ts +4 -0
- package/dist/protocol/generated/McpStartupStatus.d.ts +10 -0
- package/dist/protocol/generated/McpStartupUpdateEvent.d.ts +11 -0
- package/dist/protocol/generated/McpToolCallBeginEvent.d.ts +8 -0
- package/dist/protocol/generated/McpToolCallEndEvent.d.ts +18 -0
- package/dist/protocol/generated/NetworkAccess.d.ts +4 -0
- package/dist/protocol/generated/NewConversationParams.d.ts +18 -0
- package/dist/protocol/generated/NewConversationResponse.d.ts +8 -0
- package/dist/protocol/generated/ParsedCommand.d.ts +24 -0
- package/dist/protocol/generated/PatchApplyBeginEvent.d.ts +22 -0
- package/dist/protocol/generated/PatchApplyEndEvent.d.ts +30 -0
- package/dist/protocol/generated/PlanItemArg.d.ts +5 -0
- package/dist/protocol/generated/PlanType.d.ts +1 -0
- package/dist/protocol/generated/Profile.d.ts +13 -0
- package/dist/protocol/generated/RateLimitSnapshot.d.ts +9 -0
- package/dist/protocol/generated/RateLimitWindow.d.ts +14 -0
- package/dist/protocol/generated/RawResponseItemEvent.d.ts +4 -0
- package/dist/protocol/generated/ReasoningContentDeltaEvent.d.ts +7 -0
- package/dist/protocol/generated/ReasoningEffort.d.ts +4 -0
- package/dist/protocol/generated/ReasoningItem.d.ts +5 -0
- package/dist/protocol/generated/ReasoningItemContent.d.ts +7 -0
- package/dist/protocol/generated/ReasoningItemReasoningSummary.d.ts +4 -0
- package/dist/protocol/generated/ReasoningRawContentDeltaEvent.d.ts +7 -0
- package/dist/protocol/generated/ReasoningSummary.d.ts +6 -0
- package/dist/protocol/generated/RemoveConversationListenerParams.d.ts +3 -0
- package/dist/protocol/generated/RemoveConversationSubscriptionResponse.d.ts +1 -0
- package/dist/protocol/generated/RequestId.d.ts +1 -0
- package/dist/protocol/generated/Resource.d.ts +13 -0
- package/dist/protocol/generated/ResourceLink.d.ts +16 -0
- package/dist/protocol/generated/ResourceTemplate.d.ts +12 -0
- package/dist/protocol/generated/ResponseItem.d.ts +57 -0
- package/dist/protocol/generated/ResumeConversationParams.d.ts +9 -0
- package/dist/protocol/generated/ResumeConversationResponse.d.ts +8 -0
- package/dist/protocol/generated/ReviewCodeLocation.d.ts +8 -0
- package/dist/protocol/generated/ReviewDecision.d.ts +9 -0
- package/dist/protocol/generated/ReviewFinding.d.ts +11 -0
- package/dist/protocol/generated/ReviewLineRange.d.ts +7 -0
- package/dist/protocol/generated/ReviewOutputEvent.d.ts +10 -0
- package/dist/protocol/generated/ReviewRequest.d.ts +8 -0
- package/dist/protocol/generated/ReviewTarget.d.ts +16 -0
- package/dist/protocol/generated/Role.d.ts +4 -0
- package/dist/protocol/generated/SandboxMode.d.ts +1 -0
- package/dist/protocol/generated/SandboxPolicy.d.ts +39 -0
- package/dist/protocol/generated/SandboxSettings.d.ts +7 -0
- package/dist/protocol/generated/SendUserMessageParams.d.ts +6 -0
- package/dist/protocol/generated/SendUserMessageResponse.d.ts +1 -0
- package/dist/protocol/generated/SendUserTurnParams.d.ts +21 -0
- package/dist/protocol/generated/SendUserTurnResponse.d.ts +1 -0
- package/dist/protocol/generated/ServerNotification.d.ts +116 -0
- package/dist/protocol/generated/ServerRequest.d.ts +25 -0
- package/dist/protocol/generated/SessionConfiguredEvent.d.ts +47 -0
- package/dist/protocol/generated/SessionConfiguredNotification.d.ts +12 -0
- package/dist/protocol/generated/SessionSource.d.ts +4 -0
- package/dist/protocol/generated/SetDefaultModelParams.d.ts +5 -0
- package/dist/protocol/generated/SetDefaultModelResponse.d.ts +1 -0
- package/dist/protocol/generated/SkillErrorInfo.d.ts +4 -0
- package/dist/protocol/generated/SkillMetadata.d.ts +8 -0
- package/dist/protocol/generated/SkillScope.d.ts +1 -0
- package/dist/protocol/generated/SkillsListEntry.d.ts +7 -0
- package/dist/protocol/generated/StepStatus.d.ts +1 -0
- package/dist/protocol/generated/StreamErrorEvent.d.ts +11 -0
- package/dist/protocol/generated/SubAgentSource.d.ts +3 -0
- package/dist/protocol/generated/TaskCompleteEvent.d.ts +3 -0
- package/dist/protocol/generated/TaskStartedEvent.d.ts +3 -0
- package/dist/protocol/generated/TerminalInteractionEvent.d.ts +14 -0
- package/dist/protocol/generated/TextContent.d.ts +9 -0
- package/dist/protocol/generated/TextResourceContents.d.ts +5 -0
- package/dist/protocol/generated/ThreadId.d.ts +1 -0
- package/dist/protocol/generated/ThreadRolledBackEvent.d.ts +6 -0
- package/dist/protocol/generated/TokenCountEvent.d.ts +6 -0
- package/dist/protocol/generated/TokenUsage.d.ts +7 -0
- package/dist/protocol/generated/TokenUsageInfo.d.ts +6 -0
- package/dist/protocol/generated/Tool.d.ts +14 -0
- package/dist/protocol/generated/ToolAnnotations.d.ts +17 -0
- package/dist/protocol/generated/ToolInputSchema.d.ts +9 -0
- package/dist/protocol/generated/ToolOutputSchema.d.ts +10 -0
- package/dist/protocol/generated/Tools.d.ts +4 -0
- package/dist/protocol/generated/TurnAbortReason.d.ts +1 -0
- package/dist/protocol/generated/TurnAbortedEvent.d.ts +4 -0
- package/dist/protocol/generated/TurnDiffEvent.d.ts +3 -0
- package/dist/protocol/generated/TurnItem.d.ts +13 -0
- package/dist/protocol/generated/UndoCompletedEvent.d.ts +4 -0
- package/dist/protocol/generated/UndoStartedEvent.d.ts +3 -0
- package/dist/protocol/generated/UpdatePlanArgs.d.ts +5 -0
- package/dist/protocol/generated/UserInfoResponse.d.ts +3 -0
- package/dist/protocol/generated/UserInput.d.ts +17 -0
- package/dist/protocol/generated/UserMessageEvent.d.ts +4 -0
- package/dist/protocol/generated/UserMessageItem.d.ts +5 -0
- package/dist/protocol/generated/UserSavedConfig.d.ts +25 -0
- package/dist/protocol/generated/Verbosity.d.ts +5 -0
- package/dist/protocol/generated/ViewImageToolCallEvent.d.ts +10 -0
- package/dist/protocol/generated/WarningEvent.d.ts +3 -0
- package/dist/protocol/generated/WebSearchAction.d.ts +13 -0
- package/dist/protocol/generated/WebSearchBeginEvent.d.ts +3 -0
- package/dist/protocol/generated/WebSearchEndEvent.d.ts +4 -0
- package/dist/protocol/generated/WebSearchItem.d.ts +4 -0
- package/dist/protocol/generated/index.d.ts +199 -0
- package/dist/protocol/generated/serde_json/JsonValue.d.ts +3 -0
- package/dist/protocol/generated/v2/Account.d.ts +8 -0
- package/dist/protocol/generated/v2/AccountLoginCompletedNotification.d.ts +5 -0
- package/dist/protocol/generated/v2/AccountRateLimitsUpdatedNotification.d.ts +4 -0
- package/dist/protocol/generated/v2/AccountUpdatedNotification.d.ts +4 -0
- package/dist/protocol/generated/v2/AgentMessageDeltaNotification.d.ts +6 -0
- package/dist/protocol/generated/v2/AnalyticsConfig.d.ts +8 -0
- package/dist/protocol/generated/v2/AskForApproval.d.ts +1 -0
- package/dist/protocol/generated/v2/CancelLoginAccountParams.d.ts +3 -0
- package/dist/protocol/generated/v2/CancelLoginAccountResponse.d.ts +4 -0
- package/dist/protocol/generated/v2/CancelLoginAccountStatus.d.ts +1 -0
- package/dist/protocol/generated/v2/CodexErrorInfo.d.ts +23 -0
- package/dist/protocol/generated/v2/CommandAction.d.ts +18 -0
- package/dist/protocol/generated/v2/CommandExecParams.d.ts +7 -0
- package/dist/protocol/generated/v2/CommandExecResponse.d.ts +5 -0
- package/dist/protocol/generated/v2/CommandExecutionApprovalDecision.d.ts +6 -0
- package/dist/protocol/generated/v2/CommandExecutionOutputDeltaNotification.d.ts +6 -0
- package/dist/protocol/generated/v2/CommandExecutionRequestApprovalParams.d.ts +14 -0
- package/dist/protocol/generated/v2/CommandExecutionRequestApprovalResponse.d.ts +4 -0
- package/dist/protocol/generated/v2/CommandExecutionStatus.d.ts +1 -0
- package/dist/protocol/generated/v2/Config.d.ts +39 -0
- package/dist/protocol/generated/v2/ConfigBatchWriteParams.d.ts +9 -0
- package/dist/protocol/generated/v2/ConfigEdit.d.ts +7 -0
- package/dist/protocol/generated/v2/ConfigLayer.d.ts +7 -0
- package/dist/protocol/generated/v2/ConfigLayerMetadata.d.ts +5 -0
- package/dist/protocol/generated/v2/ConfigLayerSource.d.ts +30 -0
- package/dist/protocol/generated/v2/ConfigReadParams.d.ts +3 -0
- package/dist/protocol/generated/v2/ConfigReadResponse.d.ts +10 -0
- package/dist/protocol/generated/v2/ConfigRequirements.d.ts +6 -0
- package/dist/protocol/generated/v2/ConfigRequirementsReadResponse.d.ts +7 -0
- package/dist/protocol/generated/v2/ConfigValueWriteParams.d.ts +12 -0
- package/dist/protocol/generated/v2/ConfigWriteResponse.d.ts +12 -0
- package/dist/protocol/generated/v2/ContextCompactedNotification.d.ts +4 -0
- package/dist/protocol/generated/v2/CreditsSnapshot.d.ts +5 -0
- package/dist/protocol/generated/v2/DeprecationNoticeNotification.d.ts +10 -0
- package/dist/protocol/generated/v2/ErrorNotification.d.ts +7 -0
- package/dist/protocol/generated/v2/ExecPolicyAmendment.d.ts +1 -0
- package/dist/protocol/generated/v2/FeedbackUploadParams.d.ts +6 -0
- package/dist/protocol/generated/v2/FeedbackUploadResponse.d.ts +3 -0
- package/dist/protocol/generated/v2/FileChangeApprovalDecision.d.ts +1 -0
- package/dist/protocol/generated/v2/FileChangeOutputDeltaNotification.d.ts +6 -0
- package/dist/protocol/generated/v2/FileChangeRequestApprovalParams.d.ts +14 -0
- package/dist/protocol/generated/v2/FileChangeRequestApprovalResponse.d.ts +4 -0
- package/dist/protocol/generated/v2/FileUpdateChange.d.ts +6 -0
- package/dist/protocol/generated/v2/GetAccountParams.d.ts +3 -0
- package/dist/protocol/generated/v2/GetAccountRateLimitsResponse.d.ts +4 -0
- package/dist/protocol/generated/v2/GetAccountResponse.d.ts +5 -0
- package/dist/protocol/generated/v2/GitInfo.d.ts +5 -0
- package/dist/protocol/generated/v2/ItemCompletedNotification.d.ts +6 -0
- package/dist/protocol/generated/v2/ItemStartedNotification.d.ts +6 -0
- package/dist/protocol/generated/v2/ListMcpServerStatusParams.d.ts +10 -0
- package/dist/protocol/generated/v2/ListMcpServerStatusResponse.d.ts +9 -0
- package/dist/protocol/generated/v2/LoginAccountParams.d.ts +6 -0
- package/dist/protocol/generated/v2/LoginAccountResponse.d.ts +10 -0
- package/dist/protocol/generated/v2/LogoutAccountResponse.d.ts +1 -0
- package/dist/protocol/generated/v2/McpAuthStatus.d.ts +1 -0
- package/dist/protocol/generated/v2/McpServerOauthLoginCompletedNotification.d.ts +5 -0
- package/dist/protocol/generated/v2/McpServerOauthLoginParams.d.ts +5 -0
- package/dist/protocol/generated/v2/McpServerOauthLoginResponse.d.ts +3 -0
- package/dist/protocol/generated/v2/McpServerStatus.d.ts +13 -0
- package/dist/protocol/generated/v2/McpToolCallError.d.ts +3 -0
- package/dist/protocol/generated/v2/McpToolCallProgressNotification.d.ts +6 -0
- package/dist/protocol/generated/v2/McpToolCallResult.d.ts +6 -0
- package/dist/protocol/generated/v2/McpToolCallStatus.d.ts +1 -0
- package/dist/protocol/generated/v2/MergeStrategy.d.ts +1 -0
- package/dist/protocol/generated/v2/Model.d.ts +11 -0
- package/dist/protocol/generated/v2/ModelListParams.d.ts +10 -0
- package/dist/protocol/generated/v2/ModelListResponse.d.ts +9 -0
- package/dist/protocol/generated/v2/NetworkAccess.d.ts +1 -0
- package/dist/protocol/generated/v2/OverriddenMetadata.d.ts +7 -0
- package/dist/protocol/generated/v2/PatchApplyStatus.d.ts +1 -0
- package/dist/protocol/generated/v2/PatchChangeKind.d.ts +8 -0
- package/dist/protocol/generated/v2/ProfileV2.d.ts +18 -0
- package/dist/protocol/generated/v2/RateLimitSnapshot.d.ts +9 -0
- package/dist/protocol/generated/v2/RateLimitWindow.d.ts +5 -0
- package/dist/protocol/generated/v2/RawResponseItemCompletedNotification.d.ts +6 -0
- package/dist/protocol/generated/v2/ReasoningEffortOption.d.ts +5 -0
- package/dist/protocol/generated/v2/ReasoningSummaryPartAddedNotification.d.ts +6 -0
- package/dist/protocol/generated/v2/ReasoningSummaryTextDeltaNotification.d.ts +7 -0
- package/dist/protocol/generated/v2/ReasoningTextDeltaNotification.d.ts +7 -0
- package/dist/protocol/generated/v2/ReviewDelivery.d.ts +1 -0
- package/dist/protocol/generated/v2/ReviewStartParams.d.ts +11 -0
- package/dist/protocol/generated/v2/ReviewStartResponse.d.ts +11 -0
- package/dist/protocol/generated/v2/ReviewTarget.d.ts +16 -0
- package/dist/protocol/generated/v2/SandboxMode.d.ts +1 -0
- package/dist/protocol/generated/v2/SandboxPolicy.d.ts +16 -0
- package/dist/protocol/generated/v2/SandboxWorkspaceWrite.d.ts +6 -0
- package/dist/protocol/generated/v2/SessionSource.d.ts +1 -0
- package/dist/protocol/generated/v2/SkillErrorInfo.d.ts +4 -0
- package/dist/protocol/generated/v2/SkillMetadata.d.ts +8 -0
- package/dist/protocol/generated/v2/SkillScope.d.ts +1 -0
- package/dist/protocol/generated/v2/SkillsListEntry.d.ts +7 -0
- package/dist/protocol/generated/v2/SkillsListParams.d.ts +10 -0
- package/dist/protocol/generated/v2/SkillsListResponse.d.ts +4 -0
- package/dist/protocol/generated/v2/TerminalInteractionNotification.d.ts +7 -0
- package/dist/protocol/generated/v2/Thread.d.ts +44 -0
- package/dist/protocol/generated/v2/ThreadArchiveParams.d.ts +3 -0
- package/dist/protocol/generated/v2/ThreadArchiveResponse.d.ts +1 -0
- package/dist/protocol/generated/v2/ThreadForkParams.d.ts +33 -0
- package/dist/protocol/generated/v2/ThreadForkResponse.d.ts +13 -0
- package/dist/protocol/generated/v2/ThreadItem.d.ts +91 -0
- package/dist/protocol/generated/v2/ThreadListParams.d.ts +15 -0
- package/dist/protocol/generated/v2/ThreadListResponse.d.ts +9 -0
- package/dist/protocol/generated/v2/ThreadLoadedListParams.d.ts +10 -0
- package/dist/protocol/generated/v2/ThreadLoadedListResponse.d.ts +11 -0
- package/dist/protocol/generated/v2/ThreadResumeParams.d.ts +42 -0
- package/dist/protocol/generated/v2/ThreadResumeResponse.d.ts +13 -0
- package/dist/protocol/generated/v2/ThreadRollbackParams.d.ts +10 -0
- package/dist/protocol/generated/v2/ThreadRollbackResponse.d.ts +11 -0
- package/dist/protocol/generated/v2/ThreadStartParams.d.ts +22 -0
- package/dist/protocol/generated/v2/ThreadStartResponse.d.ts +13 -0
- package/dist/protocol/generated/v2/ThreadStartedNotification.d.ts +4 -0
- package/dist/protocol/generated/v2/ThreadTokenUsage.d.ts +6 -0
- package/dist/protocol/generated/v2/ThreadTokenUsageUpdatedNotification.d.ts +6 -0
- package/dist/protocol/generated/v2/TokenUsageBreakdown.d.ts +7 -0
- package/dist/protocol/generated/v2/ToolsV2.d.ts +4 -0
- package/dist/protocol/generated/v2/Turn.d.ts +17 -0
- package/dist/protocol/generated/v2/TurnCompletedNotification.d.ts +5 -0
- package/dist/protocol/generated/v2/TurnDiffUpdatedNotification.d.ts +9 -0
- package/dist/protocol/generated/v2/TurnError.d.ts +6 -0
- package/dist/protocol/generated/v2/TurnInterruptParams.d.ts +4 -0
- package/dist/protocol/generated/v2/TurnInterruptResponse.d.ts +1 -0
- package/dist/protocol/generated/v2/TurnPlanStep.d.ts +5 -0
- package/dist/protocol/generated/v2/TurnPlanStepStatus.d.ts +1 -0
- package/dist/protocol/generated/v2/TurnPlanUpdatedNotification.d.ts +7 -0
- package/dist/protocol/generated/v2/TurnStartParams.d.ts +38 -0
- package/dist/protocol/generated/v2/TurnStartResponse.d.ts +4 -0
- package/dist/protocol/generated/v2/TurnStartedNotification.d.ts +5 -0
- package/dist/protocol/generated/v2/TurnStatus.d.ts +1 -0
- package/dist/protocol/generated/v2/UserInput.d.ts +14 -0
- package/dist/protocol/generated/v2/WindowsWorldWritableWarningNotification.d.ts +5 -0
- package/dist/protocol/generated/v2/WriteStatus.d.ts +1 -0
- package/dist/protocol/generated/v2/index.d.ts +131 -0
- package/dist/provider-B8amrSUA.mjs +3594 -0
- package/dist/provider.d.ts +14 -0
- package/dist/provider.fetcher.d.ts +11 -0
- package/dist/schemas.d.ts +56 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.mjs +85 -0
- package/dist/thread.d.ts +125 -0
- package/dist/tool-handling.d.ts +68 -0
- package/dist/turn.d.ts +146 -0
- package/dist/utils/attachmentHelpers.d.ts +24 -0
- package/dist/utils/buildUserInputs.d.ts +19 -0
- package/dist/utils/createStdioTransport.d.ts +58 -0
- package/dist/utils/formatMessageHistory.d.ts +10 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/jsonRpcClient.d.ts +75 -0
- package/package.json +21 -13
- package/dist/chunk-DQk6qfdC.mjs +0 -18
- package/dist/index.d.mts +0 -5565
package/LICENSE
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { AIAdapter, type AIAdapterConfig } from '@makaio/framework/adapters';
|
|
2
|
+
import { CodexAppServerAgent } from './agent.js';
|
|
3
|
+
import { CodexAppServerConnector } from './connector.js';
|
|
4
|
+
import { type CodexAppServerBus } from './namespaces/index.js';
|
|
5
|
+
import { CodexAppServerAdapterName } from './constants.js';
|
|
6
|
+
export { CodexAppServerAdapterName };
|
|
7
|
+
/**
|
|
8
|
+
* Codex App-Server Adapter - Domain-level adapter using the three-layer architecture.
|
|
9
|
+
*
|
|
10
|
+
* Architecture:
|
|
11
|
+
* ```
|
|
12
|
+
* CodexAppServerAdapter extends AIAdapter
|
|
13
|
+
* -> creates via agentFactory()
|
|
14
|
+
* CodexAppServerAgent extends AIAgent
|
|
15
|
+
* -> receives connector via connectorFactory()
|
|
16
|
+
* CodexAppServerConnector extends AIAgentConnector
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Responsibilities:
|
|
20
|
+
* - Handle adapter.startAgent RPC (inherited from AIAdapter)
|
|
21
|
+
* - Provide agent and connector factories for instance creation
|
|
22
|
+
* - Emit adapter.initialized and adapter.session.created events
|
|
23
|
+
* - Manage agent lifecycle (tracking, disposal)
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Using the class directly
|
|
27
|
+
* const adapter = new CodexAppServerAdapter();
|
|
28
|
+
* await adapter.init();
|
|
29
|
+
*
|
|
30
|
+
* // Using the convenience factory
|
|
31
|
+
* const adapter = await createCodexAppServerAdapter();
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class CodexAppServerAdapter extends AIAdapter<CodexAppServerBus, CodexAppServerConnector, CodexAppServerAgent> {
|
|
35
|
+
constructor(config?: Partial<AIAdapterConfig>);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Factory function to create and initialize a Codex App-Server adapter.
|
|
39
|
+
*
|
|
40
|
+
* Convenience wrapper that creates the adapter and calls init() for you.
|
|
41
|
+
* @param config - Optional adapter configuration
|
|
42
|
+
* @returns Initialized CodexAppServerAdapter instance
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const adapter = await createCodexAppServerAdapter();
|
|
46
|
+
*
|
|
47
|
+
* // Adapter is ready to handle requests via bus
|
|
48
|
+
* // e.g., MakaioBus.request(AdapterSubjects.startAgent, { adapterId: adapter.adapterId, ... })
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function createCodexAppServerAdapter(config?: Partial<AIAdapterConfig>): Promise<CodexAppServerAdapter>;
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex App-Server Agent - Event routing layer.
|
|
3
|
+
*
|
|
4
|
+
* Wires connector events to global agent.* subjects.
|
|
5
|
+
* Auto-enriches payloads with AgentContext via emitGlobal().
|
|
6
|
+
*
|
|
7
|
+
* Responsibilities:
|
|
8
|
+
* 1. Wire connector's scoped bus events to global agent.* subjects
|
|
9
|
+
* 2. Auto-enrich payloads with AgentContext
|
|
10
|
+
* 3. Track usage metrics
|
|
11
|
+
* 4. Route tool approval to global bus
|
|
12
|
+
* 5. Emit normalized client.session.* observed-semantics events
|
|
13
|
+
* 6. Emit client.runtime.observe (best-effort) when a thread starts with a confirmed adapter session ID
|
|
14
|
+
*
|
|
15
|
+
* Event Flow:
|
|
16
|
+
* - CodexAppServerConnector emits to adapter:codex-app-server:* subjects
|
|
17
|
+
* - CodexAppServerAgent routes to semantic subjects via wireConnectorEvents()
|
|
18
|
+
* - CodexAppServerAgent subscribes to semantic subjects and emits to global bus (agent.*)
|
|
19
|
+
* - Downstream consumers subscribe to normalized agent.* subjects
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
import { AIAgent } from '@makaio/framework/adapters';
|
|
23
|
+
import { CodexAppServerConnector } from './connector.js';
|
|
24
|
+
import { type CodexAppServerBus } from './namespaces/index.js';
|
|
25
|
+
/**
|
|
26
|
+
* Codex App-Server Agent - Middle layer between AIAdapter and CodexAppServerConnector.
|
|
27
|
+
*
|
|
28
|
+
* Responsibilities:
|
|
29
|
+
* 1. Wire connector's scoped bus events to global agent.* subjects
|
|
30
|
+
* 2. Auto-enrich payloads with AgentContext via emitGlobal()
|
|
31
|
+
* 3. Emit normalized client.session.* observed-semantics events (best-effort)
|
|
32
|
+
* 4. Emit client.runtime.observe (best-effort) when a thread starts with a confirmed adapter session ID
|
|
33
|
+
*
|
|
34
|
+
* Event Flow:
|
|
35
|
+
* - CodexAppServerConnector emits to adapter:codex-app-server:* subjects
|
|
36
|
+
* - CodexAppServerAgent routes to semantic subjects via wireConnectorEvents()
|
|
37
|
+
* - CodexAppServerAgent subscribes to semantic subjects and emits to global bus (agent.*)
|
|
38
|
+
* - Downstream consumers subscribe to normalized agent.* subjects
|
|
39
|
+
*/
|
|
40
|
+
export declare class CodexAppServerAgent extends AIAgent<CodexAppServerBus, CodexAppServerConnector> {
|
|
41
|
+
/** Cache of tool call arguments indexed by callId for content blocks */
|
|
42
|
+
private toolCallCache;
|
|
43
|
+
/** Accumulated tool output indexed by callId during streaming */
|
|
44
|
+
private toolOutputCache;
|
|
45
|
+
/** Track toolCallId to blockIndex for correlation between step.started and step.finished */
|
|
46
|
+
private toolBlockIndexMap;
|
|
47
|
+
/**
|
|
48
|
+
* Guard: client.session.* global bus observations are wired once per agent
|
|
49
|
+
* lifetime (not per connector swap). Connector-level wiring uses
|
|
50
|
+
* addConnectorWiringCleanup(); these stable global subscriptions use
|
|
51
|
+
* addBusHandlerCleanup() and must not accumulate across swaps.
|
|
52
|
+
*/
|
|
53
|
+
private clientSessionObservationsWired;
|
|
54
|
+
protected wireEvents(connector: CodexAppServerConnector): void;
|
|
55
|
+
/**
|
|
56
|
+
* Wire connector's bus events to global agent.* subjects.
|
|
57
|
+
*
|
|
58
|
+
* Maps CodexAppServerSubjects.* to AgentSubjects.*
|
|
59
|
+
*
|
|
60
|
+
* Note: Turn lifecycle events (turn.started, turn.completed) are NOT wired here
|
|
61
|
+
* because the base AIAgent's message-lifecycle-tracker already handles emitting
|
|
62
|
+
* these global events when messages are acknowledged and turns complete.
|
|
63
|
+
* @param connector - The CodexAppServerConnector to wire events from
|
|
64
|
+
*/
|
|
65
|
+
private wireConnectorEvents;
|
|
66
|
+
/**
|
|
67
|
+
* Build the shared base payload for all `client.session.*` observed-semantics
|
|
68
|
+
* events by forwarding this agent's current identity fields to the shared
|
|
69
|
+
* {@link buildClientSessionBase} helper.
|
|
70
|
+
*
|
|
71
|
+
* Captures the adapter session ID best-effort: if the connector has not yet
|
|
72
|
+
* confirmed a session ID (e.g., very early in initialization), the field is
|
|
73
|
+
* omitted rather than blocking emission.
|
|
74
|
+
* @returns Base payload with clientId, source, observedAt, and optional session IDs
|
|
75
|
+
*/
|
|
76
|
+
private getClientSessionBase;
|
|
77
|
+
/**
|
|
78
|
+
* Wire stable global bus subscriptions for client.session.turn.* events.
|
|
79
|
+
*
|
|
80
|
+
* Uses addBusHandlerCleanup() so these subscriptions survive connector swaps.
|
|
81
|
+
* Guarded by clientSessionObservationsWired so they are registered exactly once
|
|
82
|
+
* per agent lifetime regardless of how many connector swaps occur.
|
|
83
|
+
*
|
|
84
|
+
* Subscribes to:
|
|
85
|
+
* - AgentSubjects.turn.started → client.session.turn.started
|
|
86
|
+
* - AgentSubjects.turn.completed → client.session.turn.completed
|
|
87
|
+
* - AgentSubjects.user_message.sent → client.session.userPrompt.submitted
|
|
88
|
+
*/
|
|
89
|
+
private wireClientSessionTurnObservations;
|
|
90
|
+
/**
|
|
91
|
+
* Wire thread lifecycle events.
|
|
92
|
+
* @param connector - The CodexAppServerConnector to wire events from
|
|
93
|
+
*/
|
|
94
|
+
private wireThreadLifecycleEvents;
|
|
95
|
+
/**
|
|
96
|
+
* Wire assistant message events.
|
|
97
|
+
*
|
|
98
|
+
* Note: Turn lifecycle events (agent.turn.started, agent.turn.completed) are emitted by
|
|
99
|
+
* MessageLifecycleTracker in ai-adapters-core based on message handle states,
|
|
100
|
+
* not by adapter-specific events.
|
|
101
|
+
* @param connector - The CodexAppServerConnector to wire events from
|
|
102
|
+
*/
|
|
103
|
+
private wireMessageEvents;
|
|
104
|
+
/**
|
|
105
|
+
* Wire tool-related events.
|
|
106
|
+
* @param connector - The CodexAppServerConnector to wire events from
|
|
107
|
+
*/
|
|
108
|
+
private wireToolEvents;
|
|
109
|
+
/**
|
|
110
|
+
* Wire command execution events (bash tool).
|
|
111
|
+
* @param connector - The CodexAppServerConnector to wire events from
|
|
112
|
+
*/
|
|
113
|
+
private wireCommandExecutionEvents;
|
|
114
|
+
private handleExecCommandBegin;
|
|
115
|
+
/**
|
|
116
|
+
* Wire file change events (patch tool).
|
|
117
|
+
* @param connector - The CodexAppServerConnector to wire events from
|
|
118
|
+
*/
|
|
119
|
+
private wireFileChangeEvents;
|
|
120
|
+
/**
|
|
121
|
+
* Wire dynamic tool call events (experimental API).
|
|
122
|
+
*
|
|
123
|
+
* Handles registry tools declared in `dynamicTools` at `thread/start`.
|
|
124
|
+
* The execution happens in the `item/tool/call` server request handler; these
|
|
125
|
+
* events carry the cached result into the agent's step lifecycle.
|
|
126
|
+
* @param connector - The CodexAppServerConnector to wire events from
|
|
127
|
+
*/
|
|
128
|
+
private wireDynamicToolCallEvents;
|
|
129
|
+
/**
|
|
130
|
+
* Wire usage tracking events.
|
|
131
|
+
* The base AIAgent.trackUsage() handles dual emission to both
|
|
132
|
+
* AgentSubjects.usage and adapter session usage subjects.
|
|
133
|
+
* @param connector - The CodexAppServerConnector to wire events from
|
|
134
|
+
*/
|
|
135
|
+
private wireUsageTracking;
|
|
136
|
+
/**
|
|
137
|
+
* Wire tool approval RPC from connector's scoped bus to global AgentSubjects.toolApprove.
|
|
138
|
+
*
|
|
139
|
+
* Uses centralized tool-handling helper for consistent approval flow.
|
|
140
|
+
* Note: adapterSessionId may be undefined at wire time — the lazy callback resolves it
|
|
141
|
+
* at request time via connector.getAdapterSessionId() to avoid the race condition.
|
|
142
|
+
* sessionId is always set for agents running within a session; asserted here as the
|
|
143
|
+
* Zod schema on AgentSubjects.toolApprove enforces it at runtime.
|
|
144
|
+
* @param connector - The CodexAppServerConnector to wire RPC from
|
|
145
|
+
*/
|
|
146
|
+
private wireToolApprovalRpc;
|
|
147
|
+
private emitToolStepFinished;
|
|
148
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification domain has no bus subjects — types are UI-local state only.
|
|
3
|
+
*
|
|
4
|
+
* This module exists to satisfy the `./register` export convention used by
|
|
5
|
+
* domain packages and to serve as a future extension point if notification
|
|
6
|
+
* bus subjects are introduced.
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { NotificationKindSchema, NotificationUrgencySchema } from './schemas.js';
|
|
10
|
+
export type { AgentCompleteNotification, ApprovalNotification, NotificationBase, NotificationEntry, NotificationUrgency, } from './schemas.js';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification types and Zod schemas for the in-app notification center.
|
|
3
|
+
*
|
|
4
|
+
* Notification entries are UI-local state (not bus-transported RPCs), but
|
|
5
|
+
* schemas are provided for consistency and future validation needs.
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import type { RiskLevel } from '@makaio/framework/contracts';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/** Zod schema for {@link NotificationUrgency}. */
|
|
11
|
+
export declare const NotificationUrgencySchema: z.ZodEnum<{
|
|
12
|
+
critical: "critical";
|
|
13
|
+
high: "high";
|
|
14
|
+
low: "low";
|
|
15
|
+
normal: "normal";
|
|
16
|
+
}>;
|
|
17
|
+
/** Zod schema for notification kind discriminator. */
|
|
18
|
+
export declare const NotificationKindSchema: z.ZodEnum<{
|
|
19
|
+
"agent-complete": "agent-complete";
|
|
20
|
+
approval: "approval";
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Urgency level for a notification entry.
|
|
24
|
+
* Controls sort order and visual treatment in the notification center.
|
|
25
|
+
*/
|
|
26
|
+
export type NotificationUrgency = z.infer<typeof NotificationUrgencySchema>;
|
|
27
|
+
/**
|
|
28
|
+
* Base shape shared by all notification entries.
|
|
29
|
+
*/
|
|
30
|
+
export interface NotificationBase<TKind extends string = string> {
|
|
31
|
+
/** Unique notification identifier */
|
|
32
|
+
readonly id: string;
|
|
33
|
+
/** Discriminator for the notification kind */
|
|
34
|
+
readonly kind: TKind;
|
|
35
|
+
/** Unix timestamp (ms) when the notification was created */
|
|
36
|
+
readonly createdAt: number;
|
|
37
|
+
/** How urgent the notification is (controls sort order) */
|
|
38
|
+
readonly urgency: NotificationUrgency;
|
|
39
|
+
/** Whether the user has seen/acknowledged this notification */
|
|
40
|
+
readonly isRead: boolean;
|
|
41
|
+
/** Session the notification is associated with (if any) */
|
|
42
|
+
readonly sessionId?: string;
|
|
43
|
+
/** Agent the notification is associated with (if any) */
|
|
44
|
+
readonly agentId?: string;
|
|
45
|
+
/** Human-readable label for the notification source */
|
|
46
|
+
readonly sourceLabel: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Notification for a pending tool approval request.
|
|
50
|
+
* Derived from the approval queue — not stored independently.
|
|
51
|
+
*/
|
|
52
|
+
export interface ApprovalNotification extends NotificationBase<'approval'> {
|
|
53
|
+
/** Discriminator: approval notification */
|
|
54
|
+
readonly kind: 'approval';
|
|
55
|
+
/** Session associated with this approval request */
|
|
56
|
+
readonly sessionId: string;
|
|
57
|
+
/** FK to the approval queue entry's requestId */
|
|
58
|
+
readonly requestId: string;
|
|
59
|
+
/** Tool call identifier */
|
|
60
|
+
readonly toolCallId: string;
|
|
61
|
+
/** Name of the tool awaiting approval */
|
|
62
|
+
readonly toolName?: string;
|
|
63
|
+
/** Risk classification for this tool call */
|
|
64
|
+
readonly riskLevel?: RiskLevel;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Notification for agent completion.
|
|
68
|
+
* Emitted when an `agent.complete` bus event is received with a `sessionId`.
|
|
69
|
+
*/
|
|
70
|
+
export interface AgentCompleteNotification extends NotificationBase<'agent-complete'> {
|
|
71
|
+
/** Discriminator: agent-complete notification */
|
|
72
|
+
readonly kind: 'agent-complete';
|
|
73
|
+
/** Summary of what the agent accomplished */
|
|
74
|
+
readonly summary?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Discriminated union of all notification entry types.
|
|
78
|
+
* Extend this union to add new notification kinds.
|
|
79
|
+
*/
|
|
80
|
+
export type NotificationEntry = ApprovalNotification | AgentCompleteNotification;
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const CodexAppServerConfig: {
|
|
2
|
+
getConfig: <TInput extends import("@makaio/framework/adapters/config").AdapterConfigFactoryInput<import("@makaio/framework/adapters").BaseAgentConnectorConfig<import("@makaio/framework/bus").ScopedBus<string>, object>>>(input: TInput) => Promise<Partial<Omit<import("@makaio/framework/adapters").BaseAgentConnectorConfig<import("@makaio/framework/bus").ScopedBus<string>, object>, "adapterName" | "agentId" | "bus" | "sessionId">> & Omit<TInput, "providerConfig"> & import("@makaio/framework/adapters/config").FactoryGuaranteedFields<object | undefined> extends infer T ? { [KeyType in keyof T]: T[KeyType]; } : never>;
|
|
3
|
+
getDefaults: () => Partial<Omit<import("@makaio/framework/adapters").BaseAgentConnectorConfig<import("@makaio/framework/bus").ScopedBus<string>, object>, "adapterName" | "agentId" | "bus" | "sessionId">>;
|
|
4
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approval request handlers for Codex App-Server.
|
|
3
|
+
*
|
|
4
|
+
* Handles command execution, file change, and dynamic tool call approval requests
|
|
5
|
+
* from the server. All approval handlers gate execution through the scoped bus
|
|
6
|
+
* via `requestToolApproval`, enabling a shared approval policy across adapter types.
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import type { ServerRequest } from '../protocol/generated/index.js';
|
|
10
|
+
import { type CodexAppServerBus } from '../namespaces/index.js';
|
|
11
|
+
import { type DynamicToolCallCacheEntry, type DynamicToolCallServerRequest, type DynamicToolCallResponse } from '../dynamic-tool-handling.js';
|
|
12
|
+
/**
|
|
13
|
+
* Approval response returned to the server.
|
|
14
|
+
*/
|
|
15
|
+
export interface ApprovalResponse {
|
|
16
|
+
decision: 'accept' | 'decline';
|
|
17
|
+
message?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Context needed for approval handling.
|
|
21
|
+
*/
|
|
22
|
+
export interface ApprovalContext {
|
|
23
|
+
agentId: string;
|
|
24
|
+
cwd: string;
|
|
25
|
+
commandExecutionByItemId: Map<string, {
|
|
26
|
+
command: string;
|
|
27
|
+
cwd: string;
|
|
28
|
+
}>;
|
|
29
|
+
/** Bound requestToolApproval from AIAgentConnector - typed loosely to avoid coupling */
|
|
30
|
+
requestToolApproval: (subject: unknown, payload: unknown) => Promise<ApprovalResponse>;
|
|
31
|
+
handleError: (error: Error, terminate: boolean) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the set of SDK-native tool names currently disabled by the active harness.
|
|
34
|
+
*
|
|
35
|
+
* Evaluated lazily at each approval call so that the set reflects the state
|
|
36
|
+
* resolved during {@link initializeConnection}, even though the context object
|
|
37
|
+
* is constructed before the harness query runs.
|
|
38
|
+
*/
|
|
39
|
+
getDisabledNativeTools: () => ReadonlySet<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Waits for `item/started` to populate `commandExecutionByItemId` for the given
|
|
42
|
+
* item. Returns the cached entry immediately if already present (fast path), or
|
|
43
|
+
* waits up to 5 seconds for the lifecycle handler to provide it. Returns
|
|
44
|
+
* `undefined` on timeout so callers can degrade gracefully.
|
|
45
|
+
* @param itemId - The item ID to wait for
|
|
46
|
+
*/
|
|
47
|
+
waitForCommandInfo: (itemId: string) => Promise<{
|
|
48
|
+
command: string;
|
|
49
|
+
cwd: string;
|
|
50
|
+
} | undefined>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Handle command approval request.
|
|
54
|
+
*
|
|
55
|
+
* Returns an immediate `decline` when the `bash` native tool is disabled by the
|
|
56
|
+
* active harness, bypassing the normal approval flow.
|
|
57
|
+
* Otherwise routes the JSON-RPC server request to the scoped bus via requestToolApproval.
|
|
58
|
+
* @param request - Server request for command approval
|
|
59
|
+
* @param ctx - Approval context
|
|
60
|
+
* @returns Approval response with decision and optional message
|
|
61
|
+
*/
|
|
62
|
+
export declare function handleCommandApprovalRequest(request: ServerRequest, ctx: ApprovalContext): Promise<ApprovalResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Handle file change approval request.
|
|
65
|
+
*
|
|
66
|
+
* Returns an immediate `decline` when the `patch` native tool is disabled by the
|
|
67
|
+
* active harness, bypassing the normal approval flow.
|
|
68
|
+
* Otherwise routes the JSON-RPC server request to the scoped bus via requestToolApproval.
|
|
69
|
+
* @param request - Server request for file change approval
|
|
70
|
+
* @param ctx - Approval context
|
|
71
|
+
* @returns Approval response with decision and optional message
|
|
72
|
+
*/
|
|
73
|
+
export declare function handleFileChangeApprovalRequest(request: ServerRequest, ctx: ApprovalContext): Promise<ApprovalResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* Context needed for dynamic tool call approval and execution.
|
|
76
|
+
*/
|
|
77
|
+
export interface DynamicToolApprovalContext {
|
|
78
|
+
/** Bound requestToolApproval from AIAgentConnector — typed loosely to avoid coupling */
|
|
79
|
+
requestToolApproval: (subject: unknown, payload: unknown) => Promise<ApprovalResponse>;
|
|
80
|
+
/** Scoped bus emit function for emitting lifecycle events */
|
|
81
|
+
emit: CodexAppServerBus['emit'];
|
|
82
|
+
/** Session ID for bus routing */
|
|
83
|
+
sessionId?: string;
|
|
84
|
+
/** Agent ID for attribution */
|
|
85
|
+
agentId: string;
|
|
86
|
+
/** Adapter instance ID for allowedAdapters policy enforcement */
|
|
87
|
+
adapterId: string;
|
|
88
|
+
/** Adapter type name for allowedAdapters policy enforcement */
|
|
89
|
+
adapterName: string;
|
|
90
|
+
/** Session tool ledger for MCP call tracking. */
|
|
91
|
+
toolLedger?: import('@makaio/framework/adapters').ISessionToolLedger;
|
|
92
|
+
/** Current turn number for MCP call tracking. */
|
|
93
|
+
currentTurnNumber: number;
|
|
94
|
+
/** Cache for lifecycle event correlation, keyed by itemId */
|
|
95
|
+
dynamicToolCallByItemId: Map<string, DynamicToolCallCacheEntry>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Handle an `item/tool/call` server request (experimental API).
|
|
99
|
+
*
|
|
100
|
+
* Requests tool approval via the scoped bus before executing. If denied, returns error
|
|
101
|
+
* content without executing. If approved, executes via bus and caches result under
|
|
102
|
+
* `itemId` for lifecycle handler correlation.
|
|
103
|
+
*
|
|
104
|
+
* Denied calls emit a synthetic `dynamic_tool_call_begin`/`end` pair so that
|
|
105
|
+
* downstream lifecycle consumers (e.g. `AgentSubjects.tool.use`) observe every
|
|
106
|
+
* tool invocation regardless of approval outcome.
|
|
107
|
+
* @param params - Parsed `item/tool/call` request parameters
|
|
108
|
+
* @param ctx - Dynamic tool approval and execution context
|
|
109
|
+
* @returns Content items to send back to codex
|
|
110
|
+
*/
|
|
111
|
+
export declare function handleDynamicToolCallApprovalRequest(params: DynamicToolCallServerRequest['params'], ctx: DynamicToolApprovalContext): Promise<DynamicToolCallResponse>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ProcessingState } from '@makaio/framework/adapters';
|
|
2
|
+
import type { ThreadStartedNotification, TurnCompletedNotification } from '../protocol/generated/v2/index.js';
|
|
3
|
+
import type { CodexAppServerBus } from '../namespaces/index.js';
|
|
4
|
+
import type { JsonRpcClient } from '../utils/jsonRpcClient.js';
|
|
5
|
+
import { type ApprovalContext } from './approval-handlers.js';
|
|
6
|
+
import { type DynamicToolCallCacheEntry, type DynamicToolCallResponse, type DynamicToolCallServerRequest } from '../dynamic-tool-handling.js';
|
|
7
|
+
import type { CodexAppServerThread } from '../thread.js';
|
|
8
|
+
import type { CodexAppServerTurn } from '../turn.js';
|
|
9
|
+
interface NotificationHandlerOptions {
|
|
10
|
+
client: JsonRpcClient;
|
|
11
|
+
enqueueNotification: (handler: () => Promise<void>) => void;
|
|
12
|
+
onThreadStarted: (params: ThreadStartedNotification) => Promise<void>;
|
|
13
|
+
consumeTurnNumber: () => number;
|
|
14
|
+
getCurrentTurn: () => CodexAppServerTurn | undefined;
|
|
15
|
+
emit: CodexAppServerBus['emit'];
|
|
16
|
+
commandExecutionByItemId: Map<string, {
|
|
17
|
+
command: string;
|
|
18
|
+
cwd: string;
|
|
19
|
+
}>;
|
|
20
|
+
dynamicToolCallByItemId: Map<string, DynamicToolCallCacheEntry>;
|
|
21
|
+
updateProcessingState: (state: ProcessingState) => Promise<void>;
|
|
22
|
+
appendAgentMessageDelta: (delta: string) => void;
|
|
23
|
+
onTurnCompleted: (params: TurnCompletedNotification) => Promise<void>;
|
|
24
|
+
getThread: () => CodexAppServerThread | undefined;
|
|
25
|
+
handleAsyncError: (error: unknown) => void;
|
|
26
|
+
/** Invoked after a commandExecution entry is written to commandExecutionByItemId. */
|
|
27
|
+
onCommandInfoReady: (itemId: string, info: {
|
|
28
|
+
command: string;
|
|
29
|
+
cwd: string;
|
|
30
|
+
}) => void;
|
|
31
|
+
}
|
|
32
|
+
interface ServerRequestHandlerOptions {
|
|
33
|
+
client: JsonRpcClient;
|
|
34
|
+
agentId: string;
|
|
35
|
+
cwd: string;
|
|
36
|
+
commandExecutionByItemId: Map<string, {
|
|
37
|
+
command: string;
|
|
38
|
+
cwd: string;
|
|
39
|
+
}>;
|
|
40
|
+
requestToolApproval: ApprovalContext['requestToolApproval'];
|
|
41
|
+
handleError: (error: unknown, terminate?: boolean) => void;
|
|
42
|
+
getDisabledNativeTools: () => ReadonlySet<string>;
|
|
43
|
+
handleDynamicToolCallRequest: (params: DynamicToolCallServerRequest['params']) => Promise<DynamicToolCallResponse>;
|
|
44
|
+
waitForCommandInfo: ApprovalContext['waitForCommandInfo'];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Register JSON-RPC notification handlers for the connector client instance.
|
|
48
|
+
* @param options - Callbacks and state accessors used to bridge notifications into connector state
|
|
49
|
+
*/
|
|
50
|
+
export declare function registerNotificationHandlers(options: NotificationHandlerOptions): void;
|
|
51
|
+
/**
|
|
52
|
+
* Register the JSON-RPC server-request handler for approval and dynamic tool call flows.
|
|
53
|
+
* @param options - Callbacks and state accessors needed to answer server requests
|
|
54
|
+
*/
|
|
55
|
+
export declare function registerServerRequestHandler(options: ServerRequestHandlerOptions): void;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection lifecycle management for the Codex App-Server connector.
|
|
3
|
+
*
|
|
4
|
+
* Handles JSON-RPC client creation, subprocess spawning, credential resolution,
|
|
5
|
+
* the ACP `initialize` handshake, and error-path teardown. The connector holds all
|
|
6
|
+
* mutable state; this module mutates it only through the typed accessors in
|
|
7
|
+
* {@link ConnectionManagerContext}.
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import type { ProviderContext } from '@makaio/framework/contracts';
|
|
11
|
+
import { type JsonRpcClient } from '../utils/jsonRpcClient.js';
|
|
12
|
+
import { type StdioTransport } from '../utils/createStdioTransport.js';
|
|
13
|
+
import { type SessionEnvironmentOptions } from '@makaio/framework/adapters/config';
|
|
14
|
+
/**
|
|
15
|
+
* Mutable connector state and callbacks required by the connection manager.
|
|
16
|
+
*
|
|
17
|
+
* All state accessors are passed as getters/setters so the manager never holds
|
|
18
|
+
* a stale reference to the connector's internal fields.
|
|
19
|
+
*/
|
|
20
|
+
export interface ConnectionManagerContext {
|
|
21
|
+
/** Returns the current JSON-RPC client, or `undefined` before first connection. */
|
|
22
|
+
getJsonRpcClient: () => JsonRpcClient | undefined;
|
|
23
|
+
/** Replaces the active JSON-RPC client (or clears it by passing `undefined`). */
|
|
24
|
+
setJsonRpcClient: (client: JsonRpcClient | undefined) => void;
|
|
25
|
+
/** Returns the injected test-double client, if any. */
|
|
26
|
+
getInjectedJsonRpcClient: () => JsonRpcClient | undefined;
|
|
27
|
+
/** Returns the injected test-double transport, if any. */
|
|
28
|
+
getInjectedTransport: () => StdioTransport | undefined;
|
|
29
|
+
/** Returns the transport currently owned (and closeable) by this connector. */
|
|
30
|
+
getOwnedTransport: () => StdioTransport | undefined;
|
|
31
|
+
/** Replaces (or clears) the owned transport reference. */
|
|
32
|
+
setOwnedTransport: (transport: StdioTransport | undefined) => void;
|
|
33
|
+
/** Returns the current `isConnected` flag. */
|
|
34
|
+
getIsConnected: () => boolean;
|
|
35
|
+
/** Updates the `isConnected` flag. */
|
|
36
|
+
setIsConnected: (value: boolean) => void;
|
|
37
|
+
/** Updates the `clientHandlersRegistered` flag to `false` on reset. */
|
|
38
|
+
setClientHandlersRegistered: (value: boolean) => void;
|
|
39
|
+
/** Clears the `disabledNativeTools` set to an empty set on reset. */
|
|
40
|
+
setDisabledNativeTools: (tools: ReadonlySet<string>) => void;
|
|
41
|
+
/** Working directory passed to the subprocess on first spawn. */
|
|
42
|
+
cwd: string;
|
|
43
|
+
/** Environment variables merged into the subprocess environment. */
|
|
44
|
+
env: Record<string, string>;
|
|
45
|
+
/** Adapter type name used for harness tool policy lookup. */
|
|
46
|
+
adapterName: string;
|
|
47
|
+
/** Provider context carrying credential refs for resolution. */
|
|
48
|
+
providerContext: ProviderContext | undefined;
|
|
49
|
+
/** Optional client identifier for binary resolution (defaults to `'codex'`). */
|
|
50
|
+
clientId: string | undefined;
|
|
51
|
+
/** Optional harness ID for native-tool policy lookup. */
|
|
52
|
+
harnessId: string | undefined;
|
|
53
|
+
/** Scoped bus used for credential resolution. */
|
|
54
|
+
bus: SessionEnvironmentOptions['bus'];
|
|
55
|
+
/**
|
|
56
|
+
* Registers JSON-RPC notification and server-request handlers on the newly created client.
|
|
57
|
+
* Called immediately after the client is assigned so handlers are in place before any
|
|
58
|
+
* messages are sent.
|
|
59
|
+
*/
|
|
60
|
+
registerClientHandlers: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Routes transport or protocol errors through the connector's error handling path.
|
|
63
|
+
* @param error - The error to handle
|
|
64
|
+
* @param terminate - When `true`, the connector should be torn down
|
|
65
|
+
*/
|
|
66
|
+
handleError: (error: unknown, terminate: boolean) => void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Tear down the active JSON-RPC client and owned transport after a connection failure.
|
|
70
|
+
*
|
|
71
|
+
* Resets connection and handler-registration flags so the next `initializeConnection`
|
|
72
|
+
* call starts fresh. If an injected test client is present it is restored (not closed)
|
|
73
|
+
* so the test can continue using the same mock instance.
|
|
74
|
+
* @param ctx - Connection manager context
|
|
75
|
+
*/
|
|
76
|
+
export declare function resetClient(ctx: ConnectionManagerContext): void;
|
|
77
|
+
/**
|
|
78
|
+
* Ensure the connector is connected, using single-flight deduplication.
|
|
79
|
+
*
|
|
80
|
+
* Concurrent callers share the same in-flight promise so the subprocess is spawned
|
|
81
|
+
* exactly once. Resolves immediately when already connected.
|
|
82
|
+
* @param ctx - Connection manager context
|
|
83
|
+
* @param inflight - Mutable holder for the in-flight promise; updated by this function
|
|
84
|
+
* @returns Promise that resolves when the connection is established
|
|
85
|
+
*/
|
|
86
|
+
export declare function initializeConnection(ctx: ConnectionManagerContext, inflight: {
|
|
87
|
+
promise: Promise<void> | undefined;
|
|
88
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { AIAgentConnector, type AgentStartResult, type ConnectorSendMessageOptions, type ConnectorStartOptions, type MessageHandle, type MessageResult, type NormalizedMessageInput } from '@makaio/framework/adapters';
|
|
2
|
+
import type { AIReasoningLevel } from '@makaio/framework/contracts';
|
|
3
|
+
import type { CodexAppServerBus } from '../namespaces/index.js';
|
|
4
|
+
import { type CodexAppServerConfig, type ApprovalPolicy, type SandboxMode, type ReasoningEffort } from './types.js';
|
|
5
|
+
export declare class CodexAppServerConnector extends AIAgentConnector<CodexAppServerBus> {
|
|
6
|
+
/** Lazy: initialised in initializeConnection(); public methods access via getJsonRpcClient(). */
|
|
7
|
+
private jsonRpcClient?;
|
|
8
|
+
/** Injected transport for tests; null means "create from subprocess on first connect". */
|
|
9
|
+
private readonly _injectedTransport?;
|
|
10
|
+
/** Injected JSON-RPC client for tests; bypasses subprocess creation entirely. */
|
|
11
|
+
private readonly _injectedJsonRpcClient?;
|
|
12
|
+
/** Transport owned by this connector and safe to tear down after partial startup failures. */
|
|
13
|
+
private ownedTransport?;
|
|
14
|
+
private readonly messageQueue;
|
|
15
|
+
private thread?;
|
|
16
|
+
private currentTurn?;
|
|
17
|
+
private isConnected;
|
|
18
|
+
/** In-flight connection initialization promise for single-flight deduplication. */
|
|
19
|
+
private readonly initConnectionInflight;
|
|
20
|
+
/** Handlers are registered once per client instance to avoid duplicate listeners on retries. */
|
|
21
|
+
private clientHandlersRegistered;
|
|
22
|
+
private isTerminated;
|
|
23
|
+
private agentMessageContent;
|
|
24
|
+
private notificationQueue;
|
|
25
|
+
private threadStartedDeferred?;
|
|
26
|
+
private readonly _approvalPolicy?;
|
|
27
|
+
private readonly _sandboxMode?;
|
|
28
|
+
private readonly _reasoningEffort?;
|
|
29
|
+
private readonly commandExecutionByItemId;
|
|
30
|
+
private readonly dynamicToolCallByItemId;
|
|
31
|
+
/** Pending resolvers for {@link waitForCommandInfo}, keyed by itemId. */
|
|
32
|
+
private readonly commandInfoWaiters;
|
|
33
|
+
private disabledNativeTools;
|
|
34
|
+
/**
|
|
35
|
+
* Stable context object passed to connection-manager module functions.
|
|
36
|
+
* All state access is via closures over `this` so the object is never stale.
|
|
37
|
+
*/
|
|
38
|
+
private readonly connCtx;
|
|
39
|
+
/**
|
|
40
|
+
* Stable context object passed to turn-flow-handlers module functions.
|
|
41
|
+
* All state access is via closures over `this` so the object is never stale.
|
|
42
|
+
*/
|
|
43
|
+
private readonly turnCtx;
|
|
44
|
+
constructor(config: CodexAppServerConfig);
|
|
45
|
+
private buildConnectionContext;
|
|
46
|
+
private buildTurnFlowContext;
|
|
47
|
+
get approvalPolicy(): ApprovalPolicy | undefined;
|
|
48
|
+
get sandboxMode(): SandboxMode | undefined;
|
|
49
|
+
get reasoningEffort(): ReasoningEffort | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve any pending {@link waitForCommandInfo} promise for `itemId`.
|
|
52
|
+
* Called by the `item/started` lifecycle path after populating `commandExecutionByItemId`.
|
|
53
|
+
* @param itemId - Item now available in commandExecutionByItemId
|
|
54
|
+
* @param info - Command execution metadata just written to the cache
|
|
55
|
+
*/
|
|
56
|
+
private notifyCommandInfoReady;
|
|
57
|
+
/**
|
|
58
|
+
* Return `commandExecutionByItemId` entry for `itemId` immediately if present,
|
|
59
|
+
* otherwise wait up to 5 seconds for `item/started` to populate it.
|
|
60
|
+
* Returns `undefined` on timeout so callers can degrade gracefully.
|
|
61
|
+
* @param itemId - Item ID to wait for
|
|
62
|
+
* @returns Command execution metadata, or `undefined` on timeout
|
|
63
|
+
*/
|
|
64
|
+
private waitForCommandInfo;
|
|
65
|
+
private resolveSystemPrompt;
|
|
66
|
+
private enqueueNotification;
|
|
67
|
+
private getJsonRpcClient;
|
|
68
|
+
private registerClientHandlers;
|
|
69
|
+
private handleDynamicToolCallRequest;
|
|
70
|
+
initialize(options?: ConnectorStartOptions): Promise<void>;
|
|
71
|
+
start(message: NormalizedMessageInput, options?: ConnectorStartOptions): Promise<AgentStartResult>;
|
|
72
|
+
sendMessage(message: NormalizedMessageInput, options?: ConnectorSendMessageOptions): Promise<MessageHandle>;
|
|
73
|
+
/**
|
|
74
|
+
* Codex supports per-turn model switching via `turn/start`.
|
|
75
|
+
* The caller updates `this.model` after this returns true.
|
|
76
|
+
* @param _newModel - The model identifier (unused — read from `this.model` at turn start)
|
|
77
|
+
* @returns Always `true`
|
|
78
|
+
*/
|
|
79
|
+
changeModelInPlace(_newModel: string): Promise<boolean>;
|
|
80
|
+
/**
|
|
81
|
+
* Codex passes reasoning effort per-turn via `turn/start`; `startTurn` reads
|
|
82
|
+
* `this.currentReasoningEffort` at send time, so no SDK reconfiguration is needed.
|
|
83
|
+
* @param _newLevel - Unused — read from `this.currentReasoningEffort` at turn start
|
|
84
|
+
* @returns Always `true`
|
|
85
|
+
*/
|
|
86
|
+
changeReasoningInPlace(_newLevel: AIReasoningLevel): Promise<boolean>;
|
|
87
|
+
interrupt(): Promise<void>;
|
|
88
|
+
getAdapterSessionId(): Promise<string>;
|
|
89
|
+
complete(): Promise<MessageResult | null>;
|
|
90
|
+
abort(): void;
|
|
91
|
+
close(): Promise<void>;
|
|
92
|
+
private archiveThread;
|
|
93
|
+
protected acceptsImmediate(): boolean;
|
|
94
|
+
handleError(error: unknown, terminate?: boolean): void;
|
|
95
|
+
}
|