clawdex-mobile 5.0.1 → 5.0.2
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 +4 -0
- package/docs/setup-and-operations.md +3 -1
- package/docs/troubleshooting.md +1 -0
- package/package.json +18 -8
- package/scripts/setup-secure-dev.sh +26 -17
- package/services/rust-bridge/Cargo.lock +1 -1
- package/services/rust-bridge/Cargo.toml +1 -1
- package/vendor/bridge-binaries/darwin-arm64/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/darwin-x64/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/linux-x64/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/win32-x64/codex-rust-bridge.exe +0 -0
- package/.artifacts/bridge-binaries/bridge-binaries-darwin-arm64/codex-rust-bridge +0 -0
- package/.artifacts/bridge-binaries/bridge-binaries-darwin-x64/codex-rust-bridge +0 -0
- package/.artifacts/bridge-binaries/bridge-binaries-linux-x64/codex-rust-bridge +0 -0
- package/.artifacts/bridge-binaries/bridge-binaries-win32-x64/codex-rust-bridge.exe +0 -0
- package/.github/workflows/ci.yml +0 -80
- package/.github/workflows/npm-release.yml +0 -208
- package/.github/workflows/pages.yml +0 -41
- package/AGENTS.md +0 -273
- package/STATUS.md +0 -115
- package/apps/mobile/.env.example +0 -6
- package/apps/mobile/App.tsx +0 -943
- package/apps/mobile/app.json +0 -77
- package/apps/mobile/assets/brand/adaptive-icon.png +0 -0
- package/apps/mobile/assets/brand/app-icon.png +0 -0
- package/apps/mobile/assets/brand/favicon.png +0 -0
- package/apps/mobile/assets/brand/mark.png +0 -0
- package/apps/mobile/assets/brand/splash-icon-white.png +0 -0
- package/apps/mobile/assets/brand/splash-icon.png +0 -0
- package/apps/mobile/babel.config.js +0 -7
- package/apps/mobile/eas.json +0 -40
- package/apps/mobile/eslint.config.cjs +0 -28
- package/apps/mobile/index.js +0 -5
- package/apps/mobile/package.json +0 -57
- package/apps/mobile/plugins/withAndroidCleartextTraffic.js +0 -14
- package/apps/mobile/src/api/__tests__/chatMapping.test.ts +0 -351
- package/apps/mobile/src/api/__tests__/client.test.ts +0 -1494
- package/apps/mobile/src/api/__tests__/ws.test.ts +0 -640
- package/apps/mobile/src/api/account.ts +0 -47
- package/apps/mobile/src/api/chatMapping.ts +0 -1048
- package/apps/mobile/src/api/client.ts +0 -1430
- package/apps/mobile/src/api/rateLimits.ts +0 -143
- package/apps/mobile/src/api/types.ts +0 -435
- package/apps/mobile/src/api/ws.ts +0 -852
- package/apps/mobile/src/bridgeUrl.ts +0 -105
- package/apps/mobile/src/components/ActivityBar.tsx +0 -95
- package/apps/mobile/src/components/ApprovalBanner.tsx +0 -207
- package/apps/mobile/src/components/BrandMark.tsx +0 -43
- package/apps/mobile/src/components/ChatHeader.tsx +0 -107
- package/apps/mobile/src/components/ChatInput.tsx +0 -457
- package/apps/mobile/src/components/ChatMessage.tsx +0 -959
- package/apps/mobile/src/components/ComposerUsageLimits.tsx +0 -167
- package/apps/mobile/src/components/SelectionSheet.tsx +0 -466
- package/apps/mobile/src/components/StatusLine.tsx +0 -52
- package/apps/mobile/src/components/ToolBlock.tsx +0 -67
- package/apps/mobile/src/components/TypingIndicator.tsx +0 -64
- package/apps/mobile/src/components/VoiceRecordingWaveform.tsx +0 -181
- package/apps/mobile/src/components/WorkspacePickerModal.tsx +0 -812
- package/apps/mobile/src/components/__tests__/chat-input-layout.test.ts +0 -35
- package/apps/mobile/src/components/__tests__/chatImageSource.test.ts +0 -44
- package/apps/mobile/src/components/__tests__/composerUsageLimits.test.ts +0 -138
- package/apps/mobile/src/components/__tests__/voiceWaveform.test.ts +0 -31
- package/apps/mobile/src/components/chat-input-layout.ts +0 -59
- package/apps/mobile/src/components/chatImageSource.ts +0 -86
- package/apps/mobile/src/components/usageLimitBadges.ts +0 -109
- package/apps/mobile/src/components/voiceWaveform.ts +0 -46
- package/apps/mobile/src/config.ts +0 -64
- package/apps/mobile/src/hooks/useVoiceRecorder.ts +0 -271
- package/apps/mobile/src/navigation/DrawerContent.tsx +0 -1129
- package/apps/mobile/src/navigation/__tests__/chatThreadTree.test.ts +0 -89
- package/apps/mobile/src/navigation/__tests__/drawerChats.test.ts +0 -65
- package/apps/mobile/src/navigation/chatThreadTree.ts +0 -191
- package/apps/mobile/src/navigation/drawerChats.ts +0 -9
- package/apps/mobile/src/screens/GitScreen.tsx +0 -1489
- package/apps/mobile/src/screens/MainScreen.tsx +0 -10511
- package/apps/mobile/src/screens/OnboardingScreen.tsx +0 -1746
- package/apps/mobile/src/screens/PrivacyScreen.tsx +0 -196
- package/apps/mobile/src/screens/SettingsScreen.tsx +0 -870
- package/apps/mobile/src/screens/TerminalScreen.tsx +0 -248
- package/apps/mobile/src/screens/TermsScreen.tsx +0 -192
- package/apps/mobile/src/screens/__tests__/agentThreadDisplay.test.ts +0 -80
- package/apps/mobile/src/screens/__tests__/agentThreads.test.ts +0 -170
- package/apps/mobile/src/screens/__tests__/gitDiff.test.ts +0 -131
- package/apps/mobile/src/screens/__tests__/planCardState.test.ts +0 -88
- package/apps/mobile/src/screens/__tests__/subAgentTranscript.test.ts +0 -102
- package/apps/mobile/src/screens/__tests__/transcriptMessages.test.ts +0 -97
- package/apps/mobile/src/screens/agentThreadDisplay.ts +0 -261
- package/apps/mobile/src/screens/agentThreads.ts +0 -167
- package/apps/mobile/src/screens/gitDiff.ts +0 -380
- package/apps/mobile/src/screens/planCardState.ts +0 -40
- package/apps/mobile/src/screens/subAgentTranscript.ts +0 -149
- package/apps/mobile/src/screens/transcriptMessages.ts +0 -102
- package/apps/mobile/src/theme.ts +0 -106
- package/apps/mobile/src/types/assets.d.ts +0 -4
- package/apps/mobile/tsconfig.json +0 -33
- package/docs/app-review-notes.md +0 -116
- package/docs/codex-app-server-cli-gap-tracker.md +0 -90
- package/docs/eas-builds.md +0 -91
- package/docs/open-source-license-requirements.md +0 -32
- package/docs/plans/2026-02-20-codex-desktop-style-redesign.md +0 -190
- package/docs/plans/2026-02-20-codex-mobile-implementation.md +0 -1630
- package/docs/plans/2026-02-21-codex-ui-redesign-design.md +0 -101
- package/docs/plans/2026-02-21-codex-ui-redesign.md +0 -1229
- package/docs/privacy-policy.md +0 -54
- package/docs/realtime-streaming-limitations.md +0 -161
- package/docs/terms-of-service.md +0 -33
- package/docs/voice-transcription.md +0 -87
- package/scripts/codex-live-demo.sh +0 -69
- package/scripts/start-bridge-secure.sh +0 -5
- package/scripts/start-expo.sh +0 -176
- package/scripts/sync-versions.js +0 -63
- package/scripts/teardown.sh +0 -136
- package/services/mac-bridge/.env.example +0 -10
- package/services/mac-bridge/codex-types/AbsolutePathBuf.ts +0 -14
- package/services/mac-bridge/codex-types/AddConversationListenerParams.ts +0 -6
- package/services/mac-bridge/codex-types/AddConversationSubscriptionResponse.ts +0 -5
- package/services/mac-bridge/codex-types/AgentMessageContent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentMessageContentDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentMessageDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentMessageEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentMessageItem.ts +0 -21
- package/services/mac-bridge/codex-types/AgentReasoningDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentReasoningEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentReasoningRawContentDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentReasoningRawContentEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentReasoningSectionBreakEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentStatus.ts +0 -8
- package/services/mac-bridge/codex-types/ApplyPatchApprovalParams.ts +0 -21
- package/services/mac-bridge/codex-types/ApplyPatchApprovalRequestEvent.ts +0 -23
- package/services/mac-bridge/codex-types/ApplyPatchApprovalResponse.ts +0 -6
- package/services/mac-bridge/codex-types/ArchiveConversationParams.ts +0 -6
- package/services/mac-bridge/codex-types/ArchiveConversationResponse.ts +0 -5
- package/services/mac-bridge/codex-types/AskForApproval.ts +0 -9
- package/services/mac-bridge/codex-types/AuthMode.ts +0 -8
- package/services/mac-bridge/codex-types/AuthStatusChangeNotification.ts +0 -9
- package/services/mac-bridge/codex-types/BackgroundEventEvent.ts +0 -5
- package/services/mac-bridge/codex-types/ByteRange.ts +0 -13
- package/services/mac-bridge/codex-types/CallToolResult.ts +0 -9
- package/services/mac-bridge/codex-types/CancelLoginChatGptParams.ts +0 -5
- package/services/mac-bridge/codex-types/CancelLoginChatGptResponse.ts +0 -5
- package/services/mac-bridge/codex-types/ClientInfo.ts +0 -5
- package/services/mac-bridge/codex-types/ClientNotification.ts +0 -5
- package/services/mac-bridge/codex-types/ClientRequest.ts +0 -60
- package/services/mac-bridge/codex-types/CodexErrorInfo.ts +0 -8
- package/services/mac-bridge/codex-types/CollabAgentInteractionBeginEvent.ts +0 -23
- package/services/mac-bridge/codex-types/CollabAgentInteractionEndEvent.ts +0 -28
- package/services/mac-bridge/codex-types/CollabAgentSpawnBeginEvent.ts +0 -19
- package/services/mac-bridge/codex-types/CollabAgentSpawnEndEvent.ts +0 -28
- package/services/mac-bridge/codex-types/CollabCloseBeginEvent.ts +0 -18
- package/services/mac-bridge/codex-types/CollabCloseEndEvent.ts +0 -24
- package/services/mac-bridge/codex-types/CollabResumeBeginEvent.ts +0 -18
- package/services/mac-bridge/codex-types/CollabResumeEndEvent.ts +0 -24
- package/services/mac-bridge/codex-types/CollabWaitingBeginEvent.ts +0 -18
- package/services/mac-bridge/codex-types/CollabWaitingEndEvent.ts +0 -19
- package/services/mac-bridge/codex-types/CollaborationMode.ts +0 -10
- package/services/mac-bridge/codex-types/CollaborationModeMask.ts +0 -11
- package/services/mac-bridge/codex-types/ContentItem.ts +0 -5
- package/services/mac-bridge/codex-types/ContextCompactedEvent.ts +0 -5
- package/services/mac-bridge/codex-types/ContextCompactionItem.ts +0 -5
- package/services/mac-bridge/codex-types/ConversationGitInfo.ts +0 -5
- package/services/mac-bridge/codex-types/ConversationSummary.ts +0 -8
- package/services/mac-bridge/codex-types/CreditsSnapshot.ts +0 -5
- package/services/mac-bridge/codex-types/CustomPrompt.ts +0 -5
- package/services/mac-bridge/codex-types/DeprecationNoticeEvent.ts +0 -13
- package/services/mac-bridge/codex-types/DynamicToolCallRequest.ts +0 -6
- package/services/mac-bridge/codex-types/ElicitationRequestEvent.ts +0 -5
- package/services/mac-bridge/codex-types/ErrorEvent.ts +0 -6
- package/services/mac-bridge/codex-types/EventMsg.ts +0 -78
- package/services/mac-bridge/codex-types/ExecApprovalRequestEvent.ts +0 -44
- package/services/mac-bridge/codex-types/ExecCommandApprovalParams.ts +0 -16
- package/services/mac-bridge/codex-types/ExecCommandApprovalResponse.ts +0 -6
- package/services/mac-bridge/codex-types/ExecCommandBeginEvent.ts +0 -35
- package/services/mac-bridge/codex-types/ExecCommandEndEvent.ts +0 -64
- package/services/mac-bridge/codex-types/ExecCommandOutputDeltaEvent.ts +0 -18
- package/services/mac-bridge/codex-types/ExecCommandSource.ts +0 -5
- package/services/mac-bridge/codex-types/ExecCommandStatus.ts +0 -5
- package/services/mac-bridge/codex-types/ExecOneOffCommandParams.ts +0 -6
- package/services/mac-bridge/codex-types/ExecOneOffCommandResponse.ts +0 -5
- package/services/mac-bridge/codex-types/ExecOutputStream.ts +0 -5
- package/services/mac-bridge/codex-types/ExecPolicyAmendment.ts +0 -12
- package/services/mac-bridge/codex-types/ExitedReviewModeEvent.ts +0 -6
- package/services/mac-bridge/codex-types/FileChange.ts +0 -5
- package/services/mac-bridge/codex-types/ForcedLoginMethod.ts +0 -5
- package/services/mac-bridge/codex-types/ForkConversationParams.ts +0 -7
- package/services/mac-bridge/codex-types/ForkConversationResponse.ts +0 -7
- package/services/mac-bridge/codex-types/FunctionCallOutputBody.ts +0 -6
- package/services/mac-bridge/codex-types/FunctionCallOutputContentItem.ts +0 -9
- package/services/mac-bridge/codex-types/FunctionCallOutputPayload.ts +0 -12
- package/services/mac-bridge/codex-types/FuzzyFileSearchParams.ts +0 -5
- package/services/mac-bridge/codex-types/FuzzyFileSearchResponse.ts +0 -6
- package/services/mac-bridge/codex-types/FuzzyFileSearchResult.ts +0 -8
- package/services/mac-bridge/codex-types/FuzzyFileSearchSessionCompletedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/FuzzyFileSearchSessionUpdatedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/GetAuthStatusParams.ts +0 -5
- package/services/mac-bridge/codex-types/GetAuthStatusResponse.ts +0 -6
- package/services/mac-bridge/codex-types/GetConversationSummaryParams.ts +0 -6
- package/services/mac-bridge/codex-types/GetConversationSummaryResponse.ts +0 -6
- package/services/mac-bridge/codex-types/GetHistoryEntryResponseEvent.ts +0 -10
- package/services/mac-bridge/codex-types/GetUserAgentResponse.ts +0 -5
- package/services/mac-bridge/codex-types/GetUserSavedConfigResponse.ts +0 -6
- package/services/mac-bridge/codex-types/GhostCommit.ts +0 -8
- package/services/mac-bridge/codex-types/GitDiffToRemoteParams.ts +0 -5
- package/services/mac-bridge/codex-types/GitDiffToRemoteResponse.ts +0 -6
- package/services/mac-bridge/codex-types/GitSha.ts +0 -5
- package/services/mac-bridge/codex-types/HistoryEntry.ts +0 -5
- package/services/mac-bridge/codex-types/InitializeCapabilities.ts +0 -17
- package/services/mac-bridge/codex-types/InitializeParams.ts +0 -7
- package/services/mac-bridge/codex-types/InitializeResponse.ts +0 -5
- package/services/mac-bridge/codex-types/InputItem.ts +0 -10
- package/services/mac-bridge/codex-types/InputModality.ts +0 -8
- package/services/mac-bridge/codex-types/InterruptConversationParams.ts +0 -6
- package/services/mac-bridge/codex-types/InterruptConversationResponse.ts +0 -6
- package/services/mac-bridge/codex-types/ItemCompletedEvent.ts +0 -7
- package/services/mac-bridge/codex-types/ItemStartedEvent.ts +0 -7
- package/services/mac-bridge/codex-types/ListConversationsParams.ts +0 -5
- package/services/mac-bridge/codex-types/ListConversationsResponse.ts +0 -6
- package/services/mac-bridge/codex-types/ListCustomPromptsResponseEvent.ts +0 -9
- package/services/mac-bridge/codex-types/ListRemoteSkillsResponseEvent.ts +0 -9
- package/services/mac-bridge/codex-types/ListSkillsResponseEvent.ts +0 -9
- package/services/mac-bridge/codex-types/LocalShellAction.ts +0 -6
- package/services/mac-bridge/codex-types/LocalShellExecAction.ts +0 -5
- package/services/mac-bridge/codex-types/LocalShellStatus.ts +0 -5
- package/services/mac-bridge/codex-types/LoginApiKeyParams.ts +0 -5
- package/services/mac-bridge/codex-types/LoginApiKeyResponse.ts +0 -5
- package/services/mac-bridge/codex-types/LoginChatGptCompleteNotification.ts +0 -8
- package/services/mac-bridge/codex-types/LoginChatGptResponse.ts +0 -5
- package/services/mac-bridge/codex-types/LogoutChatGptResponse.ts +0 -5
- package/services/mac-bridge/codex-types/McpAuthStatus.ts +0 -5
- package/services/mac-bridge/codex-types/McpInvocation.ts +0 -18
- package/services/mac-bridge/codex-types/McpListToolsResponseEvent.ts +0 -25
- package/services/mac-bridge/codex-types/McpStartupCompleteEvent.ts +0 -6
- package/services/mac-bridge/codex-types/McpStartupFailure.ts +0 -5
- package/services/mac-bridge/codex-types/McpStartupStatus.ts +0 -5
- package/services/mac-bridge/codex-types/McpStartupUpdateEvent.ts +0 -14
- package/services/mac-bridge/codex-types/McpToolCallBeginEvent.ts +0 -10
- package/services/mac-bridge/codex-types/McpToolCallEndEvent.ts +0 -15
- package/services/mac-bridge/codex-types/MessagePhase.ts +0 -11
- package/services/mac-bridge/codex-types/ModeKind.ts +0 -8
- package/services/mac-bridge/codex-types/ModelRerouteEvent.ts +0 -6
- package/services/mac-bridge/codex-types/ModelRerouteReason.ts +0 -5
- package/services/mac-bridge/codex-types/NetworkAccess.ts +0 -8
- package/services/mac-bridge/codex-types/NetworkApprovalContext.ts +0 -6
- package/services/mac-bridge/codex-types/NetworkApprovalProtocol.ts +0 -5
- package/services/mac-bridge/codex-types/NewConversationParams.ts +0 -8
- package/services/mac-bridge/codex-types/NewConversationResponse.ts +0 -7
- package/services/mac-bridge/codex-types/ParsedCommand.ts +0 -12
- package/services/mac-bridge/codex-types/PatchApplyBeginEvent.ts +0 -23
- package/services/mac-bridge/codex-types/PatchApplyEndEvent.ts +0 -36
- package/services/mac-bridge/codex-types/PatchApplyStatus.ts +0 -5
- package/services/mac-bridge/codex-types/Personality.ts +0 -5
- package/services/mac-bridge/codex-types/PlanDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/PlanItem.ts +0 -5
- package/services/mac-bridge/codex-types/PlanItemArg.ts +0 -6
- package/services/mac-bridge/codex-types/PlanType.ts +0 -5
- package/services/mac-bridge/codex-types/Profile.ts +0 -9
- package/services/mac-bridge/codex-types/RateLimitSnapshot.ts +0 -8
- package/services/mac-bridge/codex-types/RateLimitWindow.ts +0 -17
- package/services/mac-bridge/codex-types/RawResponseItemEvent.ts +0 -6
- package/services/mac-bridge/codex-types/ReadOnlyAccess.ts +0 -19
- package/services/mac-bridge/codex-types/ReasoningContentDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/ReasoningEffort.ts +0 -8
- package/services/mac-bridge/codex-types/ReasoningItem.ts +0 -5
- package/services/mac-bridge/codex-types/ReasoningItemContent.ts +0 -5
- package/services/mac-bridge/codex-types/ReasoningItemReasoningSummary.ts +0 -5
- package/services/mac-bridge/codex-types/ReasoningRawContentDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/ReasoningSummary.ts +0 -10
- package/services/mac-bridge/codex-types/RemoteSkillDownloadedEvent.ts +0 -8
- package/services/mac-bridge/codex-types/RemoteSkillSummary.ts +0 -5
- package/services/mac-bridge/codex-types/RemoveConversationListenerParams.ts +0 -5
- package/services/mac-bridge/codex-types/RemoveConversationSubscriptionResponse.ts +0 -5
- package/services/mac-bridge/codex-types/RequestId.ts +0 -5
- package/services/mac-bridge/codex-types/RequestUserInputEvent.ts +0 -15
- package/services/mac-bridge/codex-types/RequestUserInputQuestion.ts +0 -6
- package/services/mac-bridge/codex-types/RequestUserInputQuestionOption.ts +0 -5
- package/services/mac-bridge/codex-types/Resource.ts +0 -9
- package/services/mac-bridge/codex-types/ResourceTemplate.ts +0 -9
- package/services/mac-bridge/codex-types/ResponseItem.ts +0 -18
- package/services/mac-bridge/codex-types/ResumeConversationParams.ts +0 -8
- package/services/mac-bridge/codex-types/ResumeConversationResponse.ts +0 -7
- package/services/mac-bridge/codex-types/ReviewCodeLocation.ts +0 -9
- package/services/mac-bridge/codex-types/ReviewDecision.ts +0 -9
- package/services/mac-bridge/codex-types/ReviewFinding.ts +0 -9
- package/services/mac-bridge/codex-types/ReviewLineRange.ts +0 -8
- package/services/mac-bridge/codex-types/ReviewOutputEvent.ts +0 -9
- package/services/mac-bridge/codex-types/ReviewRequest.ts +0 -9
- package/services/mac-bridge/codex-types/ReviewTarget.ts +0 -9
- package/services/mac-bridge/codex-types/SandboxMode.ts +0 -5
- package/services/mac-bridge/codex-types/SandboxPolicy.ts +0 -44
- package/services/mac-bridge/codex-types/SandboxSettings.ts +0 -6
- package/services/mac-bridge/codex-types/SendUserMessageParams.ts +0 -7
- package/services/mac-bridge/codex-types/SendUserMessageResponse.ts +0 -5
- package/services/mac-bridge/codex-types/SendUserTurnParams.ts +0 -16
- package/services/mac-bridge/codex-types/SendUserTurnResponse.ts +0 -5
- package/services/mac-bridge/codex-types/ServerNotification.ts +0 -45
- package/services/mac-bridge/codex-types/ServerRequest.ts +0 -16
- package/services/mac-bridge/codex-types/SessionConfiguredEvent.ts +0 -57
- package/services/mac-bridge/codex-types/SessionConfiguredNotification.ts +0 -8
- package/services/mac-bridge/codex-types/SessionNetworkProxyRuntime.ts +0 -5
- package/services/mac-bridge/codex-types/SessionSource.ts +0 -6
- package/services/mac-bridge/codex-types/SetDefaultModelParams.ts +0 -6
- package/services/mac-bridge/codex-types/SetDefaultModelResponse.ts +0 -5
- package/services/mac-bridge/codex-types/Settings.ts +0 -9
- package/services/mac-bridge/codex-types/SkillDependencies.ts +0 -6
- package/services/mac-bridge/codex-types/SkillErrorInfo.ts +0 -5
- package/services/mac-bridge/codex-types/SkillInterface.ts +0 -5
- package/services/mac-bridge/codex-types/SkillMetadata.ts +0 -12
- package/services/mac-bridge/codex-types/SkillScope.ts +0 -5
- package/services/mac-bridge/codex-types/SkillToolDependency.ts +0 -5
- package/services/mac-bridge/codex-types/SkillsListEntry.ts +0 -7
- package/services/mac-bridge/codex-types/StepStatus.ts +0 -5
- package/services/mac-bridge/codex-types/StreamErrorEvent.ts +0 -12
- package/services/mac-bridge/codex-types/SubAgentSource.ts +0 -6
- package/services/mac-bridge/codex-types/TerminalInteractionEvent.ts +0 -17
- package/services/mac-bridge/codex-types/TextElement.ts +0 -14
- package/services/mac-bridge/codex-types/ThreadId.ts +0 -5
- package/services/mac-bridge/codex-types/ThreadNameUpdatedEvent.ts +0 -6
- package/services/mac-bridge/codex-types/ThreadRolledBackEvent.ts +0 -9
- package/services/mac-bridge/codex-types/TokenCountEvent.ts +0 -7
- package/services/mac-bridge/codex-types/TokenUsage.ts +0 -5
- package/services/mac-bridge/codex-types/TokenUsageInfo.ts +0 -6
- package/services/mac-bridge/codex-types/Tool.ts +0 -9
- package/services/mac-bridge/codex-types/Tools.ts +0 -5
- package/services/mac-bridge/codex-types/TurnAbortReason.ts +0 -5
- package/services/mac-bridge/codex-types/TurnAbortedEvent.ts +0 -6
- package/services/mac-bridge/codex-types/TurnCompleteEvent.ts +0 -5
- package/services/mac-bridge/codex-types/TurnDiffEvent.ts +0 -5
- package/services/mac-bridge/codex-types/TurnItem.ts +0 -11
- package/services/mac-bridge/codex-types/TurnStartedEvent.ts +0 -6
- package/services/mac-bridge/codex-types/UndoCompletedEvent.ts +0 -5
- package/services/mac-bridge/codex-types/UndoStartedEvent.ts +0 -5
- package/services/mac-bridge/codex-types/UpdatePlanArgs.ts +0 -10
- package/services/mac-bridge/codex-types/UserInfoResponse.ts +0 -5
- package/services/mac-bridge/codex-types/UserInput.ts +0 -16
- package/services/mac-bridge/codex-types/UserMessageEvent.ts +0 -22
- package/services/mac-bridge/codex-types/UserMessageItem.ts +0 -6
- package/services/mac-bridge/codex-types/UserSavedConfig.ts +0 -14
- package/services/mac-bridge/codex-types/Verbosity.ts +0 -9
- package/services/mac-bridge/codex-types/ViewImageToolCallEvent.ts +0 -13
- package/services/mac-bridge/codex-types/WarningEvent.ts +0 -5
- package/services/mac-bridge/codex-types/WebSearchAction.ts +0 -5
- package/services/mac-bridge/codex-types/WebSearchBeginEvent.ts +0 -5
- package/services/mac-bridge/codex-types/WebSearchEndEvent.ts +0 -6
- package/services/mac-bridge/codex-types/WebSearchItem.ts +0 -6
- package/services/mac-bridge/codex-types/WebSearchMode.ts +0 -5
- package/services/mac-bridge/codex-types/index.ts +0 -234
- package/services/mac-bridge/codex-types/serde_json/JsonValue.ts +0 -5
- package/services/mac-bridge/codex-types/v2/Account.ts +0 -6
- package/services/mac-bridge/codex-types/v2/AccountLoginCompletedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/AccountRateLimitsUpdatedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/AccountUpdatedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/AgentMessageDeltaNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/AnalyticsConfig.ts +0 -6
- package/services/mac-bridge/codex-types/v2/AppBranding.ts +0 -8
- package/services/mac-bridge/codex-types/v2/AppDisabledReason.ts +0 -5
- package/services/mac-bridge/codex-types/v2/AppInfo.ts +0 -19
- package/services/mac-bridge/codex-types/v2/AppListUpdatedNotification.ts +0 -9
- package/services/mac-bridge/codex-types/v2/AppMetadata.ts +0 -7
- package/services/mac-bridge/codex-types/v2/AppReview.ts +0 -5
- package/services/mac-bridge/codex-types/v2/AppScreenshot.ts +0 -5
- package/services/mac-bridge/codex-types/v2/AppsConfig.ts +0 -6
- package/services/mac-bridge/codex-types/v2/AppsListParams.ts +0 -24
- package/services/mac-bridge/codex-types/v2/AppsListResponse.ts +0 -14
- package/services/mac-bridge/codex-types/v2/AskForApproval.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ByteRange.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CancelLoginAccountParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CancelLoginAccountResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/CancelLoginAccountStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ChatgptAuthTokensRefreshParams.ts +0 -16
- package/services/mac-bridge/codex-types/v2/ChatgptAuthTokensRefreshReason.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ChatgptAuthTokensRefreshResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CodexErrorInfo.ts +0 -11
- package/services/mac-bridge/codex-types/v2/CollabAgentState.ts +0 -6
- package/services/mac-bridge/codex-types/v2/CollabAgentStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CollabAgentTool.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CollabAgentToolCallStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CommandAction.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CommandExecParams.ts +0 -6
- package/services/mac-bridge/codex-types/v2/CommandExecResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CommandExecutionApprovalDecision.ts +0 -6
- package/services/mac-bridge/codex-types/v2/CommandExecutionOutputDeltaNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CommandExecutionRequestApprovalParams.ts +0 -37
- package/services/mac-bridge/codex-types/v2/CommandExecutionRequestApprovalResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/CommandExecutionStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/Config.ts +0 -17
- package/services/mac-bridge/codex-types/v2/ConfigBatchWriteParams.ts +0 -10
- package/services/mac-bridge/codex-types/v2/ConfigEdit.ts +0 -7
- package/services/mac-bridge/codex-types/v2/ConfigLayer.ts +0 -7
- package/services/mac-bridge/codex-types/v2/ConfigLayerMetadata.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ConfigLayerSource.ts +0 -16
- package/services/mac-bridge/codex-types/v2/ConfigReadParams.ts +0 -11
- package/services/mac-bridge/codex-types/v2/ConfigReadResponse.ts +0 -8
- package/services/mac-bridge/codex-types/v2/ConfigRequirements.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ConfigRequirementsReadResponse.ts +0 -10
- package/services/mac-bridge/codex-types/v2/ConfigValueWriteParams.ts +0 -11
- package/services/mac-bridge/codex-types/v2/ConfigWarningNotification.ts +0 -22
- package/services/mac-bridge/codex-types/v2/ConfigWriteResponse.ts +0 -12
- package/services/mac-bridge/codex-types/v2/ContextCompactedNotification.ts +0 -8
- package/services/mac-bridge/codex-types/v2/CreditsSnapshot.ts +0 -5
- package/services/mac-bridge/codex-types/v2/DeprecationNoticeNotification.ts +0 -13
- package/services/mac-bridge/codex-types/v2/DynamicToolCallOutputContentItem.ts +0 -5
- package/services/mac-bridge/codex-types/v2/DynamicToolCallParams.ts +0 -6
- package/services/mac-bridge/codex-types/v2/DynamicToolCallResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/DynamicToolSpec.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ErrorNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ExecPolicyAmendment.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ExperimentalFeature.ts +0 -37
- package/services/mac-bridge/codex-types/v2/ExperimentalFeatureListParams.ts +0 -13
- package/services/mac-bridge/codex-types/v2/ExperimentalFeatureListResponse.ts +0 -11
- package/services/mac-bridge/codex-types/v2/ExperimentalFeatureStage.ts +0 -5
- package/services/mac-bridge/codex-types/v2/FeedbackUploadParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/FeedbackUploadResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/FileChangeApprovalDecision.ts +0 -5
- package/services/mac-bridge/codex-types/v2/FileChangeOutputDeltaNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/FileChangeRequestApprovalParams.ts +0 -14
- package/services/mac-bridge/codex-types/v2/FileChangeRequestApprovalResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/FileUpdateChange.ts +0 -6
- package/services/mac-bridge/codex-types/v2/GetAccountParams.ts +0 -13
- package/services/mac-bridge/codex-types/v2/GetAccountRateLimitsResponse.ts +0 -14
- package/services/mac-bridge/codex-types/v2/GetAccountResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/GitInfo.ts +0 -5
- package/services/mac-bridge/codex-types/v2/HazelnutScope.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ItemCompletedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ItemStartedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ListMcpServerStatusParams.ts +0 -13
- package/services/mac-bridge/codex-types/v2/ListMcpServerStatusResponse.ts +0 -11
- package/services/mac-bridge/codex-types/v2/LoginAccountParams.ts +0 -21
- package/services/mac-bridge/codex-types/v2/LoginAccountResponse.ts +0 -9
- package/services/mac-bridge/codex-types/v2/LogoutAccountResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpAuthStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpServerOauthLoginCompletedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpServerOauthLoginParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpServerOauthLoginResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpServerRefreshResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpServerStatus.ts +0 -9
- package/services/mac-bridge/codex-types/v2/McpToolCallError.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpToolCallProgressNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpToolCallResult.ts +0 -6
- package/services/mac-bridge/codex-types/v2/McpToolCallStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/MergeStrategy.ts +0 -5
- package/services/mac-bridge/codex-types/v2/Model.ts +0 -8
- package/services/mac-bridge/codex-types/v2/ModelListParams.ts +0 -17
- package/services/mac-bridge/codex-types/v2/ModelListResponse.ts +0 -11
- package/services/mac-bridge/codex-types/v2/ModelRerouteReason.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ModelReroutedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/NetworkAccess.ts +0 -5
- package/services/mac-bridge/codex-types/v2/NetworkRequirements.ts +0 -5
- package/services/mac-bridge/codex-types/v2/OverriddenMetadata.ts +0 -7
- package/services/mac-bridge/codex-types/v2/PatchApplyStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/PatchChangeKind.ts +0 -5
- package/services/mac-bridge/codex-types/v2/PlanDeltaNotification.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ProductSurface.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ProfileV2.ts +0 -11
- package/services/mac-bridge/codex-types/v2/RateLimitSnapshot.ts +0 -8
- package/services/mac-bridge/codex-types/v2/RateLimitWindow.ts +0 -5
- package/services/mac-bridge/codex-types/v2/RawResponseItemCompletedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ReadOnlyAccess.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ReasoningEffortOption.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ReasoningSummaryPartAddedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ReasoningSummaryTextDeltaNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ReasoningTextDeltaNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/RemoteSkillSummary.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ResidencyRequirement.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ReviewDelivery.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ReviewStartParams.ts +0 -12
- package/services/mac-bridge/codex-types/v2/ReviewStartResponse.ts +0 -13
- package/services/mac-bridge/codex-types/v2/ReviewTarget.ts +0 -9
- package/services/mac-bridge/codex-types/v2/SandboxMode.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SandboxPolicy.ts +0 -8
- package/services/mac-bridge/codex-types/v2/SandboxWorkspaceWrite.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SessionSource.ts +0 -6
- package/services/mac-bridge/codex-types/v2/SkillDependencies.ts +0 -6
- package/services/mac-bridge/codex-types/v2/SkillErrorInfo.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillInterface.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillMetadata.ts +0 -12
- package/services/mac-bridge/codex-types/v2/SkillScope.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillToolDependency.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillsConfigWriteParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillsConfigWriteResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillsListEntry.ts +0 -7
- package/services/mac-bridge/codex-types/v2/SkillsListExtraRootsForCwd.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillsListParams.ts +0 -18
- package/services/mac-bridge/codex-types/v2/SkillsListResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/SkillsRemoteReadParams.ts +0 -7
- package/services/mac-bridge/codex-types/v2/SkillsRemoteReadResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/SkillsRemoteWriteParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillsRemoteWriteResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TerminalInteractionNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TextElement.ts +0 -14
- package/services/mac-bridge/codex-types/v2/TextPosition.ts +0 -13
- package/services/mac-bridge/codex-types/v2/TextRange.ts +0 -6
- package/services/mac-bridge/codex-types/v2/Thread.ts +0 -51
- package/services/mac-bridge/codex-types/v2/ThreadArchiveParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadArchiveResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadArchivedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadCompactStartParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadCompactStartResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadForkParams.ts +0 -28
- package/services/mac-bridge/codex-types/v2/ThreadForkResponse.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ThreadItem.ts +0 -81
- package/services/mac-bridge/codex-types/v2/ThreadListParams.ts +0 -39
- package/services/mac-bridge/codex-types/v2/ThreadListResponse.ts +0 -11
- package/services/mac-bridge/codex-types/v2/ThreadLoadedListParams.ts +0 -13
- package/services/mac-bridge/codex-types/v2/ThreadLoadedListResponse.ts +0 -14
- package/services/mac-bridge/codex-types/v2/ThreadNameUpdatedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadReadParams.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ThreadReadResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ThreadResumeParams.ts +0 -37
- package/services/mac-bridge/codex-types/v2/ThreadResumeResponse.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ThreadRollbackParams.ts +0 -12
- package/services/mac-bridge/codex-types/v2/ThreadRollbackResponse.ts +0 -14
- package/services/mac-bridge/codex-types/v2/ThreadSetNameParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadSetNameResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadSortKey.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadSourceKind.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadStartParams.ts +0 -17
- package/services/mac-bridge/codex-types/v2/ThreadStartResponse.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ThreadStartedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ThreadTokenUsage.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ThreadTokenUsageUpdatedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ThreadUnarchiveParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadUnarchiveResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ThreadUnarchivedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TokenUsageBreakdown.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ToolRequestUserInputAnswer.ts +0 -8
- package/services/mac-bridge/codex-types/v2/ToolRequestUserInputOption.ts +0 -8
- package/services/mac-bridge/codex-types/v2/ToolRequestUserInputParams.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ToolRequestUserInputQuestion.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ToolRequestUserInputResponse.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ToolsV2.ts +0 -5
- package/services/mac-bridge/codex-types/v2/Turn.ts +0 -18
- package/services/mac-bridge/codex-types/v2/TurnCompletedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnDiffUpdatedNotification.ts +0 -9
- package/services/mac-bridge/codex-types/v2/TurnError.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnInterruptParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TurnInterruptResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TurnPlanStep.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnPlanStepStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TurnPlanUpdatedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnStartParams.ts +0 -44
- package/services/mac-bridge/codex-types/v2/TurnStartResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnStartedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TurnSteerParams.ts +0 -11
- package/services/mac-bridge/codex-types/v2/TurnSteerResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/UserInput.ts +0 -10
- package/services/mac-bridge/codex-types/v2/WebSearchAction.ts +0 -5
- package/services/mac-bridge/codex-types/v2/WindowsWorldWritableWarningNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/WriteStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/index.ts +0 -204
- package/services/mac-bridge/eslint.config.cjs +0 -22
- package/services/mac-bridge/package.json +0 -30
- package/services/mac-bridge/schema.ts +0 -0
- package/services/mac-bridge/src/index.ts +0 -18
- package/services/mac-bridge/src/server.ts +0 -426
- package/services/mac-bridge/src/services/__tests__/gitService.test.ts +0 -157
- package/services/mac-bridge/src/services/__tests__/realtimeHub.test.ts +0 -116
- package/services/mac-bridge/src/services/__tests__/terminalService.test.ts +0 -51
- package/services/mac-bridge/src/services/codexAppServerClient.ts +0 -507
- package/services/mac-bridge/src/services/codexCliAdapter.ts +0 -622
- package/services/mac-bridge/src/services/gitService.ts +0 -61
- package/services/mac-bridge/src/services/realtimeHub.ts +0 -25
- package/services/mac-bridge/src/services/terminalService.ts +0 -226
- package/services/mac-bridge/src/types.ts +0 -151
- package/services/mac-bridge/src/utils/__tests__/threadMapping.test.ts +0 -397
- package/services/mac-bridge/src/utils/threadMapping.ts +0 -176
- package/services/mac-bridge/tsconfig.json +0 -16
- package/services/mac-bridge/vitest.config.ts +0 -9
- package/services/rust-bridge/.env.example +0 -14
- package/services/rust-bridge/package.json +0 -13
- package/services/rust-bridge/security_best_practices_report.md +0 -24
- package/site/index.html +0 -54
- package/site/privacy/index.html +0 -80
- package/site/styles.css +0 -135
- package/site/support/index.html +0 -51
- package/site/terms/index.html +0 -68
- package/tsconfig.json +0 -4
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
toPreview,
|
|
3
|
-
toRecord,
|
|
4
|
-
readString,
|
|
5
|
-
readNumber,
|
|
6
|
-
unixSecondsToIso,
|
|
7
|
-
mapRawStatus,
|
|
8
|
-
extractLastError,
|
|
9
|
-
toRawThread,
|
|
10
|
-
toRawTurn,
|
|
11
|
-
} from '../threadMapping';
|
|
12
|
-
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
// toPreview
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
describe('toPreview', () => {
|
|
18
|
-
it('collapses multiple whitespace and newlines into single spaces', () => {
|
|
19
|
-
expect(toPreview('hello world\nfoo')).toBe('hello world foo');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('truncates strings longer than 180 chars to 177 + "..."', () => {
|
|
23
|
-
const long = 'a'.repeat(200);
|
|
24
|
-
const result = toPreview(long);
|
|
25
|
-
expect(result.length).toBe(180);
|
|
26
|
-
expect(result).toBe('a'.repeat(177) + '...');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('returns short strings unchanged', () => {
|
|
30
|
-
expect(toPreview('hello')).toBe('hello');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('returns a 180-char string unchanged (boundary)', () => {
|
|
34
|
-
const exact = 'b'.repeat(180);
|
|
35
|
-
expect(toPreview(exact)).toBe(exact);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('trims leading and trailing whitespace', () => {
|
|
39
|
-
expect(toPreview(' hello ')).toBe('hello');
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// ---------------------------------------------------------------------------
|
|
44
|
-
// toRecord
|
|
45
|
-
// ---------------------------------------------------------------------------
|
|
46
|
-
|
|
47
|
-
describe('toRecord', () => {
|
|
48
|
-
it('returns plain objects as-is', () => {
|
|
49
|
-
const obj = { a: 1, b: 'two' };
|
|
50
|
-
expect(toRecord(obj)).toBe(obj);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('returns null for a string', () => {
|
|
54
|
-
expect(toRecord('hello')).toBeNull();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('returns null for a number', () => {
|
|
58
|
-
expect(toRecord(42)).toBeNull();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('returns null for a boolean', () => {
|
|
62
|
-
expect(toRecord(true)).toBeNull();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('returns null for null', () => {
|
|
66
|
-
expect(toRecord(null)).toBeNull();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('returns null for undefined', () => {
|
|
70
|
-
expect(toRecord(undefined)).toBeNull();
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('returns arrays as objects (typeof [] === "object")', () => {
|
|
74
|
-
const arr = [1, 2, 3];
|
|
75
|
-
// Arrays pass the typeof === 'object' && !== null check
|
|
76
|
-
expect(toRecord(arr)).toBe(arr);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// ---------------------------------------------------------------------------
|
|
81
|
-
// readString
|
|
82
|
-
// ---------------------------------------------------------------------------
|
|
83
|
-
|
|
84
|
-
describe('readString', () => {
|
|
85
|
-
it('returns string input unchanged', () => {
|
|
86
|
-
expect(readString('hello')).toBe('hello');
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('returns empty string unchanged', () => {
|
|
90
|
-
expect(readString('')).toBe('');
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('returns null for a number', () => {
|
|
94
|
-
expect(readString(42)).toBeNull();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('returns null for an object', () => {
|
|
98
|
-
expect(readString({ a: 1 })).toBeNull();
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('returns null for null', () => {
|
|
102
|
-
expect(readString(null)).toBeNull();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('returns null for undefined', () => {
|
|
106
|
-
expect(readString(undefined)).toBeNull();
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('returns null for a boolean', () => {
|
|
110
|
-
expect(readString(true)).toBeNull();
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// ---------------------------------------------------------------------------
|
|
115
|
-
// readNumber
|
|
116
|
-
// ---------------------------------------------------------------------------
|
|
117
|
-
|
|
118
|
-
describe('readNumber', () => {
|
|
119
|
-
it('returns finite numbers', () => {
|
|
120
|
-
expect(readNumber(42)).toBe(42);
|
|
121
|
-
expect(readNumber(-3.14)).toBe(-3.14);
|
|
122
|
-
expect(readNumber(0)).toBe(0);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('returns null for NaN', () => {
|
|
126
|
-
expect(readNumber(NaN)).toBeNull();
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('returns null for Infinity', () => {
|
|
130
|
-
expect(readNumber(Infinity)).toBeNull();
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('returns null for -Infinity', () => {
|
|
134
|
-
expect(readNumber(-Infinity)).toBeNull();
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('returns null for a string', () => {
|
|
138
|
-
expect(readNumber('42')).toBeNull();
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it('returns null for null', () => {
|
|
142
|
-
expect(readNumber(null)).toBeNull();
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('returns null for undefined', () => {
|
|
146
|
-
expect(readNumber(undefined)).toBeNull();
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
// ---------------------------------------------------------------------------
|
|
151
|
-
// unixSecondsToIso
|
|
152
|
-
// ---------------------------------------------------------------------------
|
|
153
|
-
|
|
154
|
-
describe('unixSecondsToIso', () => {
|
|
155
|
-
it('converts 1700000000 to the expected ISO string', () => {
|
|
156
|
-
expect(unixSecondsToIso(1700000000)).toBe('2023-11-14T22:13:20.000Z');
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('converts 0 to the Unix epoch ISO string', () => {
|
|
160
|
-
expect(unixSecondsToIso(0)).toBe('1970-01-01T00:00:00.000Z');
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it('returns a valid ISO string for undefined (falls back to current time)', () => {
|
|
164
|
-
const result = unixSecondsToIso(undefined);
|
|
165
|
-
// Should be a valid ISO date string, not throw
|
|
166
|
-
expect(() => new Date(result)).not.toThrow();
|
|
167
|
-
expect(new Date(result).toISOString()).toBe(result);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('returns a valid ISO string for NaN (falls back to current time)', () => {
|
|
171
|
-
const result = unixSecondsToIso(NaN);
|
|
172
|
-
expect(() => new Date(result)).not.toThrow();
|
|
173
|
-
expect(new Date(result).toISOString()).toBe(result);
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
// ---------------------------------------------------------------------------
|
|
178
|
-
// mapRawStatus
|
|
179
|
-
// ---------------------------------------------------------------------------
|
|
180
|
-
|
|
181
|
-
describe('mapRawStatus', () => {
|
|
182
|
-
it('returns "running" for { type: "active" }', () => {
|
|
183
|
-
expect(mapRawStatus({ type: 'active' }, undefined)).toBe('running');
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
it('returns "error" for { type: "systemError" }', () => {
|
|
187
|
-
expect(mapRawStatus({ type: 'systemError' }, undefined)).toBe('error');
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it('returns "complete" for { type: "idle" } with turns', () => {
|
|
191
|
-
const turns = [{ id: 't1', status: 'completed' }];
|
|
192
|
-
expect(mapRawStatus({ type: 'idle' }, turns)).toBe('complete');
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it('returns "idle" for { type: "idle" } with empty turns', () => {
|
|
196
|
-
expect(mapRawStatus({ type: 'idle' }, [])).toBe('idle');
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
it('returns "idle" for { type: "idle" } with no turns', () => {
|
|
200
|
-
expect(mapRawStatus({ type: 'idle' }, undefined)).toBe('idle');
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
it('returns "complete" for { type: "notLoaded" } with turns', () => {
|
|
204
|
-
const turns = [{ id: 't1', status: 'completed' }];
|
|
205
|
-
expect(mapRawStatus({ type: 'notLoaded' }, turns)).toBe('complete');
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
it('returns "running" when last turn status is "inProgress"', () => {
|
|
209
|
-
const turns = [
|
|
210
|
-
{ id: 't1', status: 'completed' },
|
|
211
|
-
{ id: 't2', status: 'inProgress' },
|
|
212
|
-
];
|
|
213
|
-
expect(mapRawStatus({ type: 'idle' }, turns)).toBe('running');
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
it('returns "error" when last turn status is "failed"', () => {
|
|
217
|
-
const turns = [{ id: 't1', status: 'failed' }];
|
|
218
|
-
expect(mapRawStatus({ type: 'idle' }, turns)).toBe('error');
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
it('returns "error" when last turn status is "interrupted"', () => {
|
|
222
|
-
const turns = [{ id: 't1', status: 'interrupted' }];
|
|
223
|
-
expect(mapRawStatus({ type: 'idle' }, turns)).toBe('error');
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
it('returns "complete" when last turn status is "completed"', () => {
|
|
227
|
-
const turns = [{ id: 't1', status: 'completed' }];
|
|
228
|
-
// Note: "idle" status + completed last turn -> lastTurnStatus check fires first
|
|
229
|
-
expect(mapRawStatus({ type: 'idle' }, turns)).toBe('complete');
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
it('returns "idle" for null status with no turns', () => {
|
|
233
|
-
expect(mapRawStatus(null, undefined)).toBe('idle');
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
it('returns "idle" for undefined status with no turns', () => {
|
|
237
|
-
expect(mapRawStatus(undefined, undefined)).toBe('idle');
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
// ---------------------------------------------------------------------------
|
|
242
|
-
// extractLastError
|
|
243
|
-
// ---------------------------------------------------------------------------
|
|
244
|
-
|
|
245
|
-
describe('extractLastError', () => {
|
|
246
|
-
it('returns error message from the last failed turn', () => {
|
|
247
|
-
const turns = [
|
|
248
|
-
{ id: 't1', status: 'failed', error: { message: 'something broke' } },
|
|
249
|
-
];
|
|
250
|
-
expect(extractLastError(turns)).toBe('something broke');
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
it('returns "turn failed" when failed turn has no error message', () => {
|
|
254
|
-
const turns = [{ id: 't1', status: 'failed', error: null }];
|
|
255
|
-
expect(extractLastError(turns)).toBe('turn failed');
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
it('returns "turn interrupted" for an interrupted turn', () => {
|
|
259
|
-
const turns = [{ id: 't1', status: 'interrupted' }];
|
|
260
|
-
expect(extractLastError(turns)).toBe('turn interrupted');
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
it('returns null for an empty array', () => {
|
|
264
|
-
expect(extractLastError([])).toBeNull();
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
it('returns null when all turns are completed', () => {
|
|
268
|
-
const turns = [
|
|
269
|
-
{ id: 't1', status: 'completed' },
|
|
270
|
-
{ id: 't2', status: 'completed' },
|
|
271
|
-
];
|
|
272
|
-
expect(extractLastError(turns)).toBeNull();
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it('finds the LAST failed turn when scanning from end', () => {
|
|
276
|
-
const turns = [
|
|
277
|
-
{ id: 't1', status: 'failed', error: { message: 'first error' } },
|
|
278
|
-
{ id: 't2', status: 'completed' },
|
|
279
|
-
{ id: 't3', status: 'failed', error: { message: 'last error' } },
|
|
280
|
-
];
|
|
281
|
-
expect(extractLastError(turns)).toBe('last error');
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
// ---------------------------------------------------------------------------
|
|
286
|
-
// toRawThread
|
|
287
|
-
// ---------------------------------------------------------------------------
|
|
288
|
-
|
|
289
|
-
describe('toRawThread', () => {
|
|
290
|
-
it('maps a well-formed object with all fields', () => {
|
|
291
|
-
const input = {
|
|
292
|
-
id: 'thread-1',
|
|
293
|
-
preview: 'Hello world',
|
|
294
|
-
modelProvider: 'openai',
|
|
295
|
-
createdAt: 1700000000,
|
|
296
|
-
updatedAt: 1700001000,
|
|
297
|
-
status: { type: 'idle' },
|
|
298
|
-
cwd: '/home/user',
|
|
299
|
-
source: { kind: 'manual' },
|
|
300
|
-
turns: [
|
|
301
|
-
{
|
|
302
|
-
id: 'turn-1',
|
|
303
|
-
status: 'completed',
|
|
304
|
-
error: null,
|
|
305
|
-
items: [{ type: 'userMessage', id: 'item-1', content: [] }],
|
|
306
|
-
},
|
|
307
|
-
],
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
const result = toRawThread(input);
|
|
311
|
-
expect(result.id).toBe('thread-1');
|
|
312
|
-
expect(result.preview).toBe('Hello world');
|
|
313
|
-
expect(result.modelProvider).toBe('openai');
|
|
314
|
-
expect(result.createdAt).toBe(1700000000);
|
|
315
|
-
expect(result.updatedAt).toBe(1700001000);
|
|
316
|
-
expect(result.status).toEqual({ type: 'idle' });
|
|
317
|
-
expect(result.cwd).toBe('/home/user');
|
|
318
|
-
expect(result.source).toEqual({ kind: 'manual' });
|
|
319
|
-
expect(result.turns).toHaveLength(1);
|
|
320
|
-
expect(result.turns![0].id).toBe('turn-1');
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
it('returns safe defaults for null input', () => {
|
|
324
|
-
const result = toRawThread(null);
|
|
325
|
-
expect(result.id).toBeUndefined();
|
|
326
|
-
expect(result.preview).toBeUndefined();
|
|
327
|
-
expect(result.modelProvider).toBeUndefined();
|
|
328
|
-
expect(result.createdAt).toBeUndefined();
|
|
329
|
-
expect(result.updatedAt).toBeUndefined();
|
|
330
|
-
expect(result.status).toBeUndefined();
|
|
331
|
-
expect(result.cwd).toBeUndefined();
|
|
332
|
-
expect(result.source).toBeNull();
|
|
333
|
-
expect(result.turns).toBeUndefined();
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
it('returns safe defaults for non-object input', () => {
|
|
337
|
-
const result = toRawThread('not an object');
|
|
338
|
-
expect(result.id).toBeUndefined();
|
|
339
|
-
expect(result.preview).toBeUndefined();
|
|
340
|
-
expect(result.turns).toBeUndefined();
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
// ---------------------------------------------------------------------------
|
|
345
|
-
// toRawTurn
|
|
346
|
-
// ---------------------------------------------------------------------------
|
|
347
|
-
|
|
348
|
-
describe('toRawTurn', () => {
|
|
349
|
-
it('maps a well-formed turn object', () => {
|
|
350
|
-
const input = {
|
|
351
|
-
id: 'turn-1',
|
|
352
|
-
status: 'completed',
|
|
353
|
-
error: { message: 'oops' },
|
|
354
|
-
items: [{ type: 'userMessage', id: 'item-1' }],
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
const result = toRawTurn(input);
|
|
358
|
-
expect(result).not.toBeNull();
|
|
359
|
-
expect(result!.id).toBe('turn-1');
|
|
360
|
-
expect(result!.status).toBe('completed');
|
|
361
|
-
expect(result!.error).toEqual({ message: 'oops' });
|
|
362
|
-
expect(result!.items).toHaveLength(1);
|
|
363
|
-
expect(result!.items![0]).toEqual({ type: 'userMessage', id: 'item-1' });
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
it('returns null for null input', () => {
|
|
367
|
-
expect(toRawTurn(null)).toBeNull();
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
it('returns null for undefined input', () => {
|
|
371
|
-
expect(toRawTurn(undefined)).toBeNull();
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
it('returns null for non-object input (string)', () => {
|
|
375
|
-
expect(toRawTurn('not an object')).toBeNull();
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
it('returns null for non-object input (number)', () => {
|
|
379
|
-
expect(toRawTurn(42)).toBeNull();
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
it('handles turn with no items', () => {
|
|
383
|
-
const result = toRawTurn({ id: 'turn-2', status: 'failed' });
|
|
384
|
-
expect(result).not.toBeNull();
|
|
385
|
-
expect(result!.items).toBeUndefined();
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
it('filters out non-object items', () => {
|
|
389
|
-
const input = {
|
|
390
|
-
id: 'turn-3',
|
|
391
|
-
items: [{ type: 'userMessage', id: 'i1' }, 'bad-item', null, 42],
|
|
392
|
-
};
|
|
393
|
-
const result = toRawTurn(input);
|
|
394
|
-
expect(result!.items).toHaveLength(1);
|
|
395
|
-
expect(result!.items![0]).toEqual({ type: 'userMessage', id: 'i1' });
|
|
396
|
-
});
|
|
397
|
-
});
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import type { ThreadStatus } from '../types';
|
|
2
|
-
|
|
3
|
-
// ---------------------------------------------------------------------------
|
|
4
|
-
// Raw types from codex app-server JSON responses
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
export type RawThreadStatus =
|
|
8
|
-
| { type?: string }
|
|
9
|
-
| string
|
|
10
|
-
| null
|
|
11
|
-
| undefined;
|
|
12
|
-
|
|
13
|
-
export interface RawTurn {
|
|
14
|
-
id?: string;
|
|
15
|
-
status?: string;
|
|
16
|
-
error?: {
|
|
17
|
-
message?: string;
|
|
18
|
-
} | null;
|
|
19
|
-
items?: RawThreadItem[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type RawThreadItem =
|
|
23
|
-
| {
|
|
24
|
-
type?: 'userMessage';
|
|
25
|
-
id?: string;
|
|
26
|
-
content?: Array<{ type?: string; text?: string; path?: string; url?: string }>;
|
|
27
|
-
}
|
|
28
|
-
| {
|
|
29
|
-
type?: 'agentMessage';
|
|
30
|
-
id?: string;
|
|
31
|
-
text?: string;
|
|
32
|
-
}
|
|
33
|
-
| {
|
|
34
|
-
type?: string;
|
|
35
|
-
id?: string;
|
|
36
|
-
text?: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export interface RawThread {
|
|
40
|
-
id?: string;
|
|
41
|
-
preview?: string;
|
|
42
|
-
modelProvider?: string;
|
|
43
|
-
createdAt?: number;
|
|
44
|
-
updatedAt?: number;
|
|
45
|
-
status?: RawThreadStatus;
|
|
46
|
-
cwd?: string;
|
|
47
|
-
source?: {
|
|
48
|
-
kind?: string;
|
|
49
|
-
};
|
|
50
|
-
turns?: RawTurn[];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// ---------------------------------------------------------------------------
|
|
54
|
-
// Pure helper functions
|
|
55
|
-
// ---------------------------------------------------------------------------
|
|
56
|
-
|
|
57
|
-
export function toPreview(value: string): string {
|
|
58
|
-
const collapsed = value.replace(/\s+/g, ' ').trim();
|
|
59
|
-
if (collapsed.length <= 180) {
|
|
60
|
-
return collapsed;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return `${collapsed.slice(0, 177)}...`;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function toRecord(value: unknown): Record<string, unknown> | null {
|
|
67
|
-
return typeof value === 'object' && value !== null
|
|
68
|
-
? (value as Record<string, unknown>)
|
|
69
|
-
: null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function readString(value: unknown): string | null {
|
|
73
|
-
return typeof value === 'string' ? value : null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function readNumber(value: unknown): number | null {
|
|
77
|
-
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function unixSecondsToIso(value: number | undefined): string {
|
|
81
|
-
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
82
|
-
return new Date().toISOString();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return new Date(value * 1000).toISOString();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function mapRawStatus(status: unknown, turns: RawTurn[] | undefined): ThreadStatus {
|
|
89
|
-
const statusRecord = toRecord(status);
|
|
90
|
-
const statusType = readString(statusRecord?.type);
|
|
91
|
-
|
|
92
|
-
if (statusType === 'active') {
|
|
93
|
-
return 'running';
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (statusType === 'systemError') {
|
|
97
|
-
return 'error';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const lastTurn = Array.isArray(turns) && turns.length > 0 ? turns[turns.length - 1] : null;
|
|
101
|
-
const lastTurnStatus = readString(lastTurn?.status);
|
|
102
|
-
|
|
103
|
-
if (lastTurnStatus === 'inProgress') {
|
|
104
|
-
return 'running';
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (lastTurnStatus === 'failed' || lastTurnStatus === 'interrupted') {
|
|
108
|
-
return 'error';
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (lastTurnStatus === 'completed') {
|
|
112
|
-
return 'complete';
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (statusType === 'idle' || statusType === 'notLoaded') {
|
|
116
|
-
return Array.isArray(turns) && turns.length > 0 ? 'complete' : 'idle';
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return 'idle';
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export function extractLastError(turns: RawTurn[]): string | null {
|
|
123
|
-
for (let i = turns.length - 1; i >= 0; i -= 1) {
|
|
124
|
-
const turn = turns[i];
|
|
125
|
-
const turnStatus = readString(turn.status);
|
|
126
|
-
if (turnStatus !== 'failed' && turnStatus !== 'interrupted') {
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const message = readString(turn.error?.message);
|
|
131
|
-
if (message) {
|
|
132
|
-
return message;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return `turn ${turnStatus}`;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export function toRawThread(value: unknown): RawThread {
|
|
142
|
-
const record = toRecord(value) ?? {};
|
|
143
|
-
return {
|
|
144
|
-
id: readString(record.id) ?? undefined,
|
|
145
|
-
preview: readString(record.preview) ?? undefined,
|
|
146
|
-
modelProvider: readString(record.modelProvider) ?? undefined,
|
|
147
|
-
createdAt: readNumber(record.createdAt) ?? undefined,
|
|
148
|
-
updatedAt: readNumber(record.updatedAt) ?? undefined,
|
|
149
|
-
status: (record.status as RawThreadStatus) ?? undefined,
|
|
150
|
-
cwd: readString(record.cwd) ?? undefined,
|
|
151
|
-
source: toRecord(record.source) as { kind?: string } | undefined,
|
|
152
|
-
turns: Array.isArray(record.turns)
|
|
153
|
-
? (record.turns.map((turn) => toRawTurn(turn)).filter(Boolean) as RawTurn[])
|
|
154
|
-
: undefined
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export function toRawTurn(value: unknown): RawTurn | null {
|
|
159
|
-
const record = toRecord(value);
|
|
160
|
-
if (!record) {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const items = Array.isArray(record.items)
|
|
165
|
-
? (record.items
|
|
166
|
-
.map((item) => toRecord(item))
|
|
167
|
-
.filter((item): item is RawThreadItem => item !== null) as RawThreadItem[])
|
|
168
|
-
: undefined;
|
|
169
|
-
|
|
170
|
-
return {
|
|
171
|
-
id: readString(record.id) ?? undefined,
|
|
172
|
-
status: readString(record.status) ?? undefined,
|
|
173
|
-
error: toRecord(record.error) as { message?: string } | null,
|
|
174
|
-
items
|
|
175
|
-
};
|
|
176
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"moduleResolution": "Node",
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"rootDir": "src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"types": ["node", "vitest/globals"]
|
|
14
|
-
},
|
|
15
|
-
"include": ["src/**/*.ts"]
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
BRIDGE_HOST=127.0.0.1
|
|
2
|
-
BRIDGE_PORT=8787
|
|
3
|
-
BRIDGE_WORKDIR=/path/to/target/repo
|
|
4
|
-
BRIDGE_AUTH_TOKEN=change-me
|
|
5
|
-
BRIDGE_ALLOW_INSECURE_NO_AUTH=false
|
|
6
|
-
BRIDGE_ALLOW_QUERY_TOKEN_AUTH=true
|
|
7
|
-
BRIDGE_ALLOW_OUTSIDE_ROOT_CWD=true
|
|
8
|
-
BRIDGE_DISABLE_TERMINAL_EXEC=false
|
|
9
|
-
BRIDGE_TERMINAL_ALLOWED_COMMANDS=pwd,ls,cat,git
|
|
10
|
-
BRIDGE_CHATGPT_ACCESS_TOKEN=
|
|
11
|
-
BRIDGE_CHATGPT_ACCOUNT_ID=
|
|
12
|
-
BRIDGE_CHATGPT_PLAN_TYPE=
|
|
13
|
-
CODEX_CLI_BIN=codex
|
|
14
|
-
CODEX_CLI_TIMEOUT_MS=180000
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@codex/rust-bridge",
|
|
3
|
-
"version": "5.0.1",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "cargo run",
|
|
7
|
-
"start": "cargo run --release",
|
|
8
|
-
"build": "cargo build --release",
|
|
9
|
-
"typecheck": "cargo check",
|
|
10
|
-
"lint": "cargo fmt --check",
|
|
11
|
-
"test": "cargo test"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Executive Summary
|
|
2
|
-
The bridge exposes powerful RPC surface (terminal execution, git operations, approvals) with minimal automation around authentication, token handling, and child-process resilience. Without tightening the gates, an attacker on the same LAN can run commands or mutate the repository, and outages may go unnoticed. The following findings prioritize these risks and note the lack of tests that would otherwise guard against regressions.
|
|
3
|
-
|
|
4
|
-
## Severity: High
|
|
5
|
-
### HF-1 — Unauthenticated bridge surface with common dev flags
|
|
6
|
-
- **Impact:** When `BRIDGE_ALLOW_INSECURE_NO_AUTH=true` and the host is bound to `0.0.0.0`, any LAN client can connect to `/rpc` and call `bridge/terminal/exec`, `bridge/git/*`, or even forward arbitrary App Server RPCs, effectively running shell commands and mutating the repository as the bridge user. This is a remote code execution and repo integrity risk.
|
|
7
|
-
- **Observation:** `BridgeConfig::from_env` only skips the `BRIDGE_AUTH_TOKEN` requirement when `BRIDGE_ALLOW_INSECURE_NO_AUTH` is true (src/main.rs:51-129). `ws_handler` accepts any socket once `is_authorized` returns true, and that function returns true whenever authentication is disabled (src/main.rs:1125-1144). The powerful operations behind `handle_bridge_method` remain exposed without additional checks (src/main.rs:1307-1405).
|
|
8
|
-
- **Remediation:** Require a token for any non-local binding or refuse to listen on `0.0.0.0` when auth is disabled. Alternatively, keep `BRIDGE_ALLOW_INSECURE_NO_AUTH` but automatically bind to `127.0.0.1` and refuse the flag otherwise, or fail fast if the flag is set without a token plus documented justification. Harden `bridge/terminal/exec` and `bridge/git/*` with explicit policy guards when auth is missing.
|
|
9
|
-
|
|
10
|
-
## Severity: Medium
|
|
11
|
-
### MF-2 — Query-token auth leaks credentials in plaintext URLs
|
|
12
|
-
- **Impact:** `BRIDGE_ALLOW_QUERY_TOKEN_AUTH` accepts the token as a `token` query parameter (src/main.rs:101-129, 1125-1144). Passing secrets in URLs risks leakage through proxy logs, browser history, and any MITM on the local network (the bridge already speaks plain HTTP/TCP). A leaked token allows the exact same RPC surface as a Bearer header, so attackers can replay it.
|
|
13
|
-
- **Observation:** `is_authorized` unconditionally trusts the `token` query value when the flag is true (src/main.rs:101-129). `ws_handler` populates that query into the check every WebSocket upgrade (src/main.rs:1125-1144).
|
|
14
|
-
- **Remediation:** Deprecate `BRIDGE_ALLOW_QUERY_TOKEN_AUTH`; accept only Authorization headers and keep them out of URLs. If the flag is still needed, require TLS + short-lived tokens and actively rotate/log reuse.
|
|
15
|
-
|
|
16
|
-
### MF-3 — App server child death leaves future requests dead and health endpoint blind
|
|
17
|
-
- **Impact:** When the `codex app-server` child exits, the bridge logs the exit, fails outstanding RPCs, and shuts down approval state, but it never restarts the child or marks `/health` as degraded. Forwarded requests still attempt to write to the closed pipe and immediately fail with `-32000`, leaving clients blind and requiring a manual restart, which is a resiliency issue with moderate to high operational impact.
|
|
18
|
-
- **Observation:** `spawn_wait_loop` just logs success/error and clears `pending` state without recovery (src/main.rs:362-403). `forward_request` continues to accept work and only reports failure once `write_json` fails, so the bridge does not short-circuit new requests once the child is gone (src/main.rs:406-439). The existing `/health` handler never observes the child state (src/main.rs:1117-1123).
|
|
19
|
-
- **Remediation:** Monitor the app server child, surface its state through `/health`, and attempt automatic restart/backoff or block forwarded requests (return `ServiceUnavailable`) until recovery. Consider wiring `AppState` with a flag that short-circuits `handle_client_message` whenever the child is not running.
|
|
20
|
-
|
|
21
|
-
### MF-4 — No automated tests for critical security gates or bridge resiliency
|
|
22
|
-
- **Impact:** The bridge’s only source file is `src/main.rs` and `Cargo.toml` defines no `[dev-dependencies]` or test harnesses (Cargo.toml:1-13), so there are no unit or integration tests for `BridgeConfig`, `TerminalService`, or `AppServerBridge`. Any refactor can silently break auth, token parsing, or terminal-command restrictions, and there is no automated guard detecting the regression.
|
|
23
|
-
- **Observation:** `src/main.rs` does not contain any `#[cfg(test)]` modules or `mod tests`, and there is no `tests/` directory in the repo. The mission-critical entry points (`BridgeConfig::from_env`, `TerminalService::execute_shell`, `AppServerBridge::forward_request`) are therefore unverified.
|
|
24
|
-
- **Remediation:** Add tabletop unit tests that cover config parsing (including `BRIDGE_ALLOW_INSECURE_NO_AUTH` vs. `BRIDGE_AUTH_TOKEN`), query token acceptance, terminal command whitelists, and app-server shutdown behavior. Start simple with `#[cfg(test)]` modules shipping assertion scenarios, then expand to integration or smoke tests to exercise `/rpc` and `/health` flows.
|