@gokulvenkatareddy/cortex 0.1.7
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 +1295 -0
- package/apps/octogent/.github/workflows/ci.yml +40 -0
- package/apps/octogent/.shims/claude +4 -0
- package/apps/octogent/AGENTS.md +71 -0
- package/apps/octogent/CONTRIBUTING.md +72 -0
- package/apps/octogent/LICENSE +21 -0
- package/apps/octogent/README.md +184 -0
- package/apps/octogent/apps/api/AGENTS.md +32 -0
- package/apps/octogent/apps/api/package.json +19 -0
- package/apps/octogent/apps/api/src/agentStateDetection.ts +181 -0
- package/apps/octogent/apps/api/src/claudeSessionScanner.ts +235 -0
- package/apps/octogent/apps/api/src/claudeSkills.ts +182 -0
- package/apps/octogent/apps/api/src/claudeUsage.ts +922 -0
- package/apps/octogent/apps/api/src/cli.ts +595 -0
- package/apps/octogent/apps/api/src/codeIntelStore.ts +46 -0
- package/apps/octogent/apps/api/src/codexUsage.ts +278 -0
- package/apps/octogent/apps/api/src/createApiServer/codeIntelRoutes.ts +60 -0
- package/apps/octogent/apps/api/src/createApiServer/conversationRoutes.ts +128 -0
- package/apps/octogent/apps/api/src/createApiServer/deckRoutes.ts +873 -0
- package/apps/octogent/apps/api/src/createApiServer/gitParsers.ts +140 -0
- package/apps/octogent/apps/api/src/createApiServer/gitRoutes.ts +214 -0
- package/apps/octogent/apps/api/src/createApiServer/miscRoutes.ts +316 -0
- package/apps/octogent/apps/api/src/createApiServer/monitorParsers.ts +137 -0
- package/apps/octogent/apps/api/src/createApiServer/monitorRoutes.ts +95 -0
- package/apps/octogent/apps/api/src/createApiServer/requestHandler.ts +311 -0
- package/apps/octogent/apps/api/src/createApiServer/requestParsers.ts +25 -0
- package/apps/octogent/apps/api/src/createApiServer/routeHelpers.ts +97 -0
- package/apps/octogent/apps/api/src/createApiServer/security.ts +70 -0
- package/apps/octogent/apps/api/src/createApiServer/terminalParsers.ts +167 -0
- package/apps/octogent/apps/api/src/createApiServer/terminalRoutes.ts +315 -0
- package/apps/octogent/apps/api/src/createApiServer/types.ts +24 -0
- package/apps/octogent/apps/api/src/createApiServer/uiStateParsers.ts +255 -0
- package/apps/octogent/apps/api/src/createApiServer/upgradeHandler.ts +38 -0
- package/apps/octogent/apps/api/src/createApiServer/usageRoutes.ts +84 -0
- package/apps/octogent/apps/api/src/createApiServer.ts +176 -0
- package/apps/octogent/apps/api/src/deck/readDeckTentacles.ts +595 -0
- package/apps/octogent/apps/api/src/githubRepoSummary.ts +397 -0
- package/apps/octogent/apps/api/src/logging.ts +9 -0
- package/apps/octogent/apps/api/src/monitor/defaults.ts +3 -0
- package/apps/octogent/apps/api/src/monitor/index.ts +8 -0
- package/apps/octogent/apps/api/src/monitor/repository.ts +303 -0
- package/apps/octogent/apps/api/src/monitor/service.ts +349 -0
- package/apps/octogent/apps/api/src/monitor/types.ts +120 -0
- package/apps/octogent/apps/api/src/monitor/xProvider.ts +587 -0
- package/apps/octogent/apps/api/src/projectPersistence.ts +377 -0
- package/apps/octogent/apps/api/src/prompts/index.ts +10 -0
- package/apps/octogent/apps/api/src/prompts/promptResolver.ts +145 -0
- package/apps/octogent/apps/api/src/runtimeMetadata.ts +69 -0
- package/apps/octogent/apps/api/src/server.ts +80 -0
- package/apps/octogent/apps/api/src/setupState.ts +80 -0
- package/apps/octogent/apps/api/src/setupStatus.ts +174 -0
- package/apps/octogent/apps/api/src/startupPrerequisites.ts +146 -0
- package/apps/octogent/apps/api/src/terminalRuntime/channelMessaging.ts +87 -0
- package/apps/octogent/apps/api/src/terminalRuntime/claudeTranscript.ts +279 -0
- package/apps/octogent/apps/api/src/terminalRuntime/constants.ts +15 -0
- package/apps/octogent/apps/api/src/terminalRuntime/conversations.ts +492 -0
- package/apps/octogent/apps/api/src/terminalRuntime/gitOperations.ts +341 -0
- package/apps/octogent/apps/api/src/terminalRuntime/hookProcessor.ts +405 -0
- package/apps/octogent/apps/api/src/terminalRuntime/protocol.ts +46 -0
- package/apps/octogent/apps/api/src/terminalRuntime/ptyEnvironment.ts +50 -0
- package/apps/octogent/apps/api/src/terminalRuntime/registry.ts +423 -0
- package/apps/octogent/apps/api/src/terminalRuntime/sessionRuntime.ts +671 -0
- package/apps/octogent/apps/api/src/terminalRuntime/systemClients.ts +432 -0
- package/apps/octogent/apps/api/src/terminalRuntime/types.ts +157 -0
- package/apps/octogent/apps/api/src/terminalRuntime/worktreeManager.ts +135 -0
- package/apps/octogent/apps/api/src/terminalRuntime.ts +567 -0
- package/apps/octogent/apps/api/src/usageUtils.ts +16 -0
- package/apps/octogent/apps/api/src/ws-shim.d.ts +28 -0
- package/apps/octogent/apps/api/tests/agentStateDetection.test.ts +67 -0
- package/apps/octogent/apps/api/tests/claudeUsage.test.ts +583 -0
- package/apps/octogent/apps/api/tests/codexUsage.test.ts +107 -0
- package/apps/octogent/apps/api/tests/createApiServer.test.ts +3207 -0
- package/apps/octogent/apps/api/tests/githubRepoSummary.test.ts +100 -0
- package/apps/octogent/apps/api/tests/logging.test.ts +33 -0
- package/apps/octogent/apps/api/tests/monitorApi.test.ts +467 -0
- package/apps/octogent/apps/api/tests/monitorCore.test.ts +104 -0
- package/apps/octogent/apps/api/tests/promptResolver.test.ts +109 -0
- package/apps/octogent/apps/api/tests/protocol.test.ts +14 -0
- package/apps/octogent/apps/api/tests/sessionRuntime.test.ts +608 -0
- package/apps/octogent/apps/api/tests/startupPrerequisites.test.ts +70 -0
- package/apps/octogent/apps/api/tests/upgradeHandler.test.ts +40 -0
- package/apps/octogent/apps/api/tests/xMonitorProvider.test.ts +109 -0
- package/apps/octogent/apps/api/tsconfig.json +7 -0
- package/apps/octogent/apps/api/vitest.config.ts +7 -0
- package/apps/octogent/apps/web/AGENTS.md +38 -0
- package/apps/octogent/apps/web/index.html +13 -0
- package/apps/octogent/apps/web/package.json +32 -0
- package/apps/octogent/apps/web/public/octopus-favicon.svg +26 -0
- package/apps/octogent/apps/web/src/App.tsx +646 -0
- package/apps/octogent/apps/web/src/app/canvas/types.ts +34 -0
- package/apps/octogent/apps/web/src/app/codeIntelAggregation.ts +278 -0
- package/apps/octogent/apps/web/src/app/constants.ts +28 -0
- package/apps/octogent/apps/web/src/app/conversationNormalizers.ts +135 -0
- package/apps/octogent/apps/web/src/app/formatTimestamp.ts +18 -0
- package/apps/octogent/apps/web/src/app/githubMetrics.ts +76 -0
- package/apps/octogent/apps/web/src/app/githubNormalizers.ts +91 -0
- package/apps/octogent/apps/web/src/app/hooks/useAgentRuntimeStates.ts +18 -0
- package/apps/octogent/apps/web/src/app/hooks/useBackendLivenessPolling.ts +53 -0
- package/apps/octogent/apps/web/src/app/hooks/useCanvasGraphData.ts +449 -0
- package/apps/octogent/apps/web/src/app/hooks/useCanvasTransform.ts +260 -0
- package/apps/octogent/apps/web/src/app/hooks/useClaudeUsagePolling.ts +40 -0
- package/apps/octogent/apps/web/src/app/hooks/useClickOutside.ts +30 -0
- package/apps/octogent/apps/web/src/app/hooks/useCodeIntelRuntime.ts +83 -0
- package/apps/octogent/apps/web/src/app/hooks/useCodexUsagePolling.ts +35 -0
- package/apps/octogent/apps/web/src/app/hooks/useConsoleKeyboardShortcuts.ts +31 -0
- package/apps/octogent/apps/web/src/app/hooks/useConversationsRuntime.ts +377 -0
- package/apps/octogent/apps/web/src/app/hooks/useForceSimulation.ts +319 -0
- package/apps/octogent/apps/web/src/app/hooks/useGitHubPrimaryViewModel.ts +143 -0
- package/apps/octogent/apps/web/src/app/hooks/useGithubSummaryPolling.ts +28 -0
- package/apps/octogent/apps/web/src/app/hooks/useInitialColumnsHydration.ts +64 -0
- package/apps/octogent/apps/web/src/app/hooks/useMonitorRuntime.ts +220 -0
- package/apps/octogent/apps/web/src/app/hooks/usePersistedUiState.ts +536 -0
- package/apps/octogent/apps/web/src/app/hooks/usePollingData.ts +79 -0
- package/apps/octogent/apps/web/src/app/hooks/usePromptLibrary.ts +185 -0
- package/apps/octogent/apps/web/src/app/hooks/useTentacleGitLifecycle.ts +530 -0
- package/apps/octogent/apps/web/src/app/hooks/useTerminalCompletionNotification.ts +94 -0
- package/apps/octogent/apps/web/src/app/hooks/useTerminalMutations.ts +266 -0
- package/apps/octogent/apps/web/src/app/hooks/useTerminalStateReconciliation.ts +23 -0
- package/apps/octogent/apps/web/src/app/hooks/useUsageHeatmapPolling.ts +43 -0
- package/apps/octogent/apps/web/src/app/hooks/useWorkspaceSetup.ts +80 -0
- package/apps/octogent/apps/web/src/app/hotkeys.ts +31 -0
- package/apps/octogent/apps/web/src/app/monitorNormalizers.ts +145 -0
- package/apps/octogent/apps/web/src/app/notificationSounds.ts +164 -0
- package/apps/octogent/apps/web/src/app/terminalRuntimeStateStore.ts +261 -0
- package/apps/octogent/apps/web/src/app/terminalState.ts +21 -0
- package/apps/octogent/apps/web/src/app/types.ts +42 -0
- package/apps/octogent/apps/web/src/app/uiStateNormalizers.ts +113 -0
- package/apps/octogent/apps/web/src/app/usageNormalizers.ts +58 -0
- package/apps/octogent/apps/web/src/components/ActiveAgentsSidebar.tsx +60 -0
- package/apps/octogent/apps/web/src/components/ActivityPrimaryView.tsx +21 -0
- package/apps/octogent/apps/web/src/components/AgentStateBadge.tsx +47 -0
- package/apps/octogent/apps/web/src/components/CanvasPrimaryView.tsx +1532 -0
- package/apps/octogent/apps/web/src/components/ClearAllConversationsDialog.tsx +33 -0
- package/apps/octogent/apps/web/src/components/CodeIntelArcDiagram.tsx +245 -0
- package/apps/octogent/apps/web/src/components/CodeIntelPrimaryView.tsx +104 -0
- package/apps/octogent/apps/web/src/components/CodeIntelTreemap.tsx +138 -0
- package/apps/octogent/apps/web/src/components/ConsolePrimaryNav.tsx +31 -0
- package/apps/octogent/apps/web/src/components/ConversationsPrimaryView.tsx +243 -0
- package/apps/octogent/apps/web/src/components/DeckPrimaryView.tsx +613 -0
- package/apps/octogent/apps/web/src/components/DeleteTentacleDialog.tsx +91 -0
- package/apps/octogent/apps/web/src/components/EmptyOctopus.tsx +715 -0
- package/apps/octogent/apps/web/src/components/GitHubPrimaryView.tsx +494 -0
- package/apps/octogent/apps/web/src/components/MonitorPrimaryView.tsx +475 -0
- package/apps/octogent/apps/web/src/components/PrimaryViewRouter.tsx +99 -0
- package/apps/octogent/apps/web/src/components/PromptsPrimaryView.tsx +243 -0
- package/apps/octogent/apps/web/src/components/RuntimeStatusStrip.tsx +273 -0
- package/apps/octogent/apps/web/src/components/SettingsPrimaryView.tsx +92 -0
- package/apps/octogent/apps/web/src/components/SidebarActionPanel.tsx +124 -0
- package/apps/octogent/apps/web/src/components/SidebarConversationsList.tsx +279 -0
- package/apps/octogent/apps/web/src/components/SidebarPromptsList.tsx +116 -0
- package/apps/octogent/apps/web/src/components/TelemetryTape.tsx +106 -0
- package/apps/octogent/apps/web/src/components/TentacleGitActionsDialog.tsx +341 -0
- package/apps/octogent/apps/web/src/components/Terminal.tsx +524 -0
- package/apps/octogent/apps/web/src/components/TerminalPromptPicker.tsx +140 -0
- package/apps/octogent/apps/web/src/components/UsageHeatmap.tsx +702 -0
- package/apps/octogent/apps/web/src/components/canvas/CanvasTentaclePanel.tsx +485 -0
- package/apps/octogent/apps/web/src/components/canvas/CanvasTerminalColumn.tsx +89 -0
- package/apps/octogent/apps/web/src/components/canvas/DeleteAllTerminalsDialog.tsx +221 -0
- package/apps/octogent/apps/web/src/components/canvas/OctopusNode.tsx +307 -0
- package/apps/octogent/apps/web/src/components/canvas/SessionNode.tsx +185 -0
- package/apps/octogent/apps/web/src/components/deck/ActionCards.tsx +118 -0
- package/apps/octogent/apps/web/src/components/deck/AddTentacleForm.tsx +269 -0
- package/apps/octogent/apps/web/src/components/deck/DeckBottomActions.tsx +56 -0
- package/apps/octogent/apps/web/src/components/deck/TentaclePod.tsx +334 -0
- package/apps/octogent/apps/web/src/components/deck/WorkspaceSetupCard.tsx +105 -0
- package/apps/octogent/apps/web/src/components/deck/octopusVisuals.ts +72 -0
- package/apps/octogent/apps/web/src/components/terminalReplay.ts +62 -0
- package/apps/octogent/apps/web/src/components/terminalWheel.ts +54 -0
- package/apps/octogent/apps/web/src/components/ui/ActionButton.tsx +34 -0
- package/apps/octogent/apps/web/src/components/ui/ConfirmationDialog.tsx +86 -0
- package/apps/octogent/apps/web/src/components/ui/MarkdownContent.tsx +43 -0
- package/apps/octogent/apps/web/src/components/ui/SettingsToggle.tsx +34 -0
- package/apps/octogent/apps/web/src/components/ui/StatusBadge.tsx +24 -0
- package/apps/octogent/apps/web/src/main.tsx +17 -0
- package/apps/octogent/apps/web/src/runtime/HttpTerminalSnapshotReader.ts +87 -0
- package/apps/octogent/apps/web/src/runtime/runtimeEndpoints.ts +412 -0
- package/apps/octogent/apps/web/src/styles/chrome-and-buttons.css +272 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-activity.css +358 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-canvas.css +1843 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-code-intel.css +227 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-conversations.css +705 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-deck.css +1524 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-github.css +541 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-monitor.css +595 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-pixpack.css +81 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-prompts.css +474 -0
- package/apps/octogent/apps/web/src/styles/console-canvas-settings.css +207 -0
- package/apps/octogent/apps/web/src/styles/console-chrome-status-nav.css +441 -0
- package/apps/octogent/apps/web/src/styles/console-overrides-telemetry.css +320 -0
- package/apps/octogent/apps/web/src/styles/console-theme-tokens.css +25 -0
- package/apps/octogent/apps/web/src/styles/cortex-theme.css +412 -0
- package/apps/octogent/apps/web/src/styles/foundation.css +100 -0
- package/apps/octogent/apps/web/src/styles/sidebar-and-scrollbars.css +447 -0
- package/apps/octogent/apps/web/src/styles/terminal-and-status.css +356 -0
- package/apps/octogent/apps/web/src/styles.css +25 -0
- package/apps/octogent/apps/web/src/types/ws.d.ts +23 -0
- package/apps/octogent/apps/web/tests/CanvasPrimaryView.test.tsx +347 -0
- package/apps/octogent/apps/web/tests/HttpTerminalSnapshotReader.test.tsx +54 -0
- package/apps/octogent/apps/web/tests/RuntimeStatusStrip.test.tsx +70 -0
- package/apps/octogent/apps/web/tests/Terminal.test.tsx +87 -0
- package/apps/octogent/apps/web/tests/add-tentacle-form.test.tsx +48 -0
- package/apps/octogent/apps/web/tests/app-github-runtime.test.tsx +162 -0
- package/apps/octogent/apps/web/tests/app-monitor-runtime.test.tsx +657 -0
- package/apps/octogent/apps/web/tests/app-shell-navigation.test.tsx +109 -0
- package/apps/octogent/apps/web/tests/app-swarm-refresh.test.tsx +268 -0
- package/apps/octogent/apps/web/tests/app-ui-state-persistence.test.tsx +116 -0
- package/apps/octogent/apps/web/tests/app-workspace-setup.test.tsx +217 -0
- package/apps/octogent/apps/web/tests/canvas-tentacle-panel.test.tsx +195 -0
- package/apps/octogent/apps/web/tests/delete-all-terminals-dialog.test.tsx +76 -0
- package/apps/octogent/apps/web/tests/githubMetrics.test.tsx +52 -0
- package/apps/octogent/apps/web/tests/hotkeys.test.tsx +44 -0
- package/apps/octogent/apps/web/tests/runtimeEndpoints.test.tsx +240 -0
- package/apps/octogent/apps/web/tests/setup.ts +39 -0
- package/apps/octogent/apps/web/tests/tentacle-pod.test.tsx +62 -0
- package/apps/octogent/apps/web/tests/terminalReplay.test.ts +71 -0
- package/apps/octogent/apps/web/tests/terminalState.test.tsx +49 -0
- package/apps/octogent/apps/web/tests/terminalWheel.test.tsx +51 -0
- package/apps/octogent/apps/web/tests/test-utils/appTestHarness.ts +48 -0
- package/apps/octogent/apps/web/tests/uiPrimitives.test.tsx +31 -0
- package/apps/octogent/apps/web/tests/useAgentRuntimeStates.test.tsx +47 -0
- package/apps/octogent/apps/web/tsconfig.json +8 -0
- package/apps/octogent/apps/web/vite.api.bundle.config.mts +32 -0
- package/apps/octogent/apps/web/vite.config.ts +22 -0
- package/apps/octogent/bin/octogent +3 -0
- package/apps/octogent/biome.json +21 -0
- package/apps/octogent/docs/concepts/mental-model.md +79 -0
- package/apps/octogent/docs/concepts/runtime-and-api.md +60 -0
- package/apps/octogent/docs/concepts/tentacles.md +85 -0
- package/apps/octogent/docs/getting-started/installation.md +54 -0
- package/apps/octogent/docs/getting-started/quickstart.md +79 -0
- package/apps/octogent/docs/guides/inter-agent-messaging.md +43 -0
- package/apps/octogent/docs/guides/orchestrating-child-agents.md +49 -0
- package/apps/octogent/docs/guides/working-with-todos.md +56 -0
- package/apps/octogent/docs/index.md +40 -0
- package/apps/octogent/docs/reference/api.md +103 -0
- package/apps/octogent/docs/reference/cli.md +71 -0
- package/apps/octogent/docs/reference/experimental-features.md +28 -0
- package/apps/octogent/docs/reference/filesystem-layout.md +62 -0
- package/apps/octogent/docs/reference/troubleshooting.md +49 -0
- package/apps/octogent/package.json +35 -0
- package/apps/octogent/packages/core/AGENTS.md +31 -0
- package/apps/octogent/packages/core/package.json +12 -0
- package/apps/octogent/packages/core/src/adapters/InMemoryTerminalSnapshotReader.ts +10 -0
- package/apps/octogent/packages/core/src/application/buildTerminalList.ts +13 -0
- package/apps/octogent/packages/core/src/domain/agentRuntime.ts +18 -0
- package/apps/octogent/packages/core/src/domain/channel.ts +8 -0
- package/apps/octogent/packages/core/src/domain/completionSound.ts +14 -0
- package/apps/octogent/packages/core/src/domain/conversation.ts +48 -0
- package/apps/octogent/packages/core/src/domain/deck.ts +33 -0
- package/apps/octogent/packages/core/src/domain/git.ts +32 -0
- package/apps/octogent/packages/core/src/domain/monitor.ts +62 -0
- package/apps/octogent/packages/core/src/domain/setup.ts +27 -0
- package/apps/octogent/packages/core/src/domain/terminal.ts +17 -0
- package/apps/octogent/packages/core/src/domain/uiState.ts +22 -0
- package/apps/octogent/packages/core/src/domain/usage.ts +60 -0
- package/apps/octogent/packages/core/src/index.ts +15 -0
- package/apps/octogent/packages/core/src/ports/TerminalSnapshotReader.ts +5 -0
- package/apps/octogent/packages/core/src/util/typeCoercion.ts +20 -0
- package/apps/octogent/packages/core/tests/buildTerminalList.test.ts +75 -0
- package/apps/octogent/packages/core/tsconfig.json +7 -0
- package/apps/octogent/packages/core/tsconfig.tsbuildinfo +1 -0
- package/apps/octogent/packages/core/vitest.config.ts +7 -0
- package/apps/octogent/pnpm-lock.yaml +3212 -0
- package/apps/octogent/pnpm-workspace.yaml +3 -0
- package/apps/octogent/prompts/meta-prompt-generator.md +223 -0
- package/apps/octogent/prompts/octoboss-clean-contexts.md +30 -0
- package/apps/octogent/prompts/octoboss-reorganize-tentacles.md +29 -0
- package/apps/octogent/prompts/octoboss-reorganize-todos.md +27 -0
- package/apps/octogent/prompts/sandbox-init.md +3 -0
- package/apps/octogent/prompts/swarm-parent.md +83 -0
- package/apps/octogent/prompts/swarm-worker.md +50 -0
- package/apps/octogent/prompts/tentacle-context-init.md +1 -0
- package/apps/octogent/prompts/tentacle-planner.md +110 -0
- package/apps/octogent/prompts/tentacle-reorganize-todos.md +20 -0
- package/apps/octogent/prompts/tentacle-update-tentacle.md +18 -0
- package/apps/octogent/scripts/build-package.mjs +23 -0
- package/apps/octogent/scripts/dev.mjs +158 -0
- package/apps/octogent/scripts/smoke-public-install.mjs +271 -0
- package/apps/octogent/static/images/octogent-header.png +0 -0
- package/apps/octogent/static/images/preview_1.jpg +0 -0
- package/apps/octogent/static/images/preview_2.jpg +0 -0
- package/apps/octogent/static/images/preview_3.jpg +0 -0
- package/apps/octogent/static/images/preview_4.jpg +0 -0
- package/apps/octogent/static/images/preview_5.jpg +0 -0
- package/apps/octogent/static/images/preview_6.jpg +0 -0
- package/apps/octogent/tsconfig.base.json +16 -0
- package/bin/AGI +3 -0
- package/bin/AGI-install-app +71 -0
- package/bin/AGI-ui +16 -0
- package/bin/AGI-voice +15 -0
- package/bin/AGI-web +16 -0
- package/bin/cortex +109 -0
- package/bin/cortex-octogent +99 -0
- package/bin/import-specifier.mjs +13 -0
- package/bin/import-specifier.test.mjs +13 -0
- package/bin/octo +150 -0
- package/dist/cli.mjs +555650 -0
- package/package.json +157 -0
- package/scripts/setup-wizard.ts +390 -0
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
|
|
4
|
+
import { App } from "../src/App";
|
|
5
|
+
import { MONITOR_SCAN_INTERVAL_MS } from "../src/app/constants";
|
|
6
|
+
import { jsonResponse, notFoundResponse, resetAppTestHarness } from "./test-utils/appTestHarness";
|
|
7
|
+
|
|
8
|
+
describe("App Monitor runtime", () => {
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
cleanup();
|
|
11
|
+
resetAppTestHarness();
|
|
12
|
+
vi.useRealTimers();
|
|
13
|
+
vi.restoreAllMocks();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("saves X credentials, renders monitor feed rows, and supports manual refresh", async () => {
|
|
17
|
+
vi.useFakeTimers({ shouldAdvanceTime: true });
|
|
18
|
+
const monitorConfigPatchBodies: Array<Record<string, unknown>> = [];
|
|
19
|
+
let refreshCount = 0;
|
|
20
|
+
|
|
21
|
+
vi.spyOn(globalThis, "fetch").mockImplementation(async (input, init) => {
|
|
22
|
+
const url = String(input);
|
|
23
|
+
const method = init?.method ?? "GET";
|
|
24
|
+
|
|
25
|
+
if (url.endsWith("/api/terminal-snapshots") && method === "GET") {
|
|
26
|
+
return jsonResponse([]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (url.endsWith("/api/codex/usage") && method === "GET") {
|
|
30
|
+
return jsonResponse({
|
|
31
|
+
status: "unavailable",
|
|
32
|
+
source: "none",
|
|
33
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (url.endsWith("/api/claude/usage") && method === "GET") {
|
|
38
|
+
return jsonResponse({
|
|
39
|
+
status: "unavailable",
|
|
40
|
+
source: "none",
|
|
41
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (url.endsWith("/api/github/summary") && method === "GET") {
|
|
46
|
+
return jsonResponse({
|
|
47
|
+
status: "unavailable",
|
|
48
|
+
source: "none",
|
|
49
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
50
|
+
commitsPerDay: [],
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (url.includes("/api/analytics/usage-heatmap") && method === "GET") {
|
|
55
|
+
return jsonResponse({
|
|
56
|
+
days: [],
|
|
57
|
+
projects: [],
|
|
58
|
+
models: [],
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (url.endsWith("/api/ui-state") && method === "GET") {
|
|
63
|
+
return jsonResponse({});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (url.endsWith("/api/ui-state") && method === "PATCH") {
|
|
67
|
+
return jsonResponse({});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (url.endsWith("/api/monitor/config") && method === "GET") {
|
|
71
|
+
return jsonResponse({
|
|
72
|
+
providerId: "x",
|
|
73
|
+
queryTerms: ["Codex"],
|
|
74
|
+
refreshPolicy: {
|
|
75
|
+
maxCacheAgeMs: 86400000,
|
|
76
|
+
maxPosts: 30,
|
|
77
|
+
searchWindowDays: 7,
|
|
78
|
+
},
|
|
79
|
+
providers: {
|
|
80
|
+
x: {
|
|
81
|
+
credentials: {
|
|
82
|
+
isConfigured: false,
|
|
83
|
+
bearerTokenHint: null,
|
|
84
|
+
apiKeyHint: null,
|
|
85
|
+
hasApiSecret: false,
|
|
86
|
+
hasAccessToken: false,
|
|
87
|
+
hasAccessTokenSecret: false,
|
|
88
|
+
updatedAt: null,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (url.endsWith("/api/monitor/config") && method === "PATCH") {
|
|
96
|
+
if (typeof init?.body === "string") {
|
|
97
|
+
monitorConfigPatchBodies.push(JSON.parse(init.body) as Record<string, unknown>);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return jsonResponse({
|
|
101
|
+
providerId: "x",
|
|
102
|
+
queryTerms: ["Codex"],
|
|
103
|
+
refreshPolicy: {
|
|
104
|
+
maxCacheAgeMs: 86400000,
|
|
105
|
+
maxPosts: 30,
|
|
106
|
+
searchWindowDays: 7,
|
|
107
|
+
},
|
|
108
|
+
providers: {
|
|
109
|
+
x: {
|
|
110
|
+
credentials: {
|
|
111
|
+
isConfigured: true,
|
|
112
|
+
bearerTokenHint: "***********oken",
|
|
113
|
+
apiKeyHint: null,
|
|
114
|
+
hasApiSecret: false,
|
|
115
|
+
hasAccessToken: false,
|
|
116
|
+
hasAccessTokenSecret: false,
|
|
117
|
+
updatedAt: "2026-02-28T12:00:00.000Z",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (url.endsWith("/api/monitor/feed") && method === "GET") {
|
|
125
|
+
return jsonResponse({
|
|
126
|
+
providerId: "x",
|
|
127
|
+
queryTerms: ["Codex"],
|
|
128
|
+
refreshPolicy: {
|
|
129
|
+
maxCacheAgeMs: 86400000,
|
|
130
|
+
maxPosts: 30,
|
|
131
|
+
searchWindowDays: 7,
|
|
132
|
+
},
|
|
133
|
+
lastFetchedAt: "2026-02-28T12:00:00.000Z",
|
|
134
|
+
staleAfter: "2026-03-01T12:00:00.000Z",
|
|
135
|
+
isStale: false,
|
|
136
|
+
lastError: null,
|
|
137
|
+
usage: {
|
|
138
|
+
status: "ok",
|
|
139
|
+
source: "x-api",
|
|
140
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
141
|
+
cap: 1000,
|
|
142
|
+
used: 220,
|
|
143
|
+
remaining: 780,
|
|
144
|
+
resetAt: "2026-03-01T00:00:00.000Z",
|
|
145
|
+
},
|
|
146
|
+
posts: [
|
|
147
|
+
{
|
|
148
|
+
source: "x",
|
|
149
|
+
id: "1",
|
|
150
|
+
text: "Codex is shipping faster loops",
|
|
151
|
+
author: "octogent",
|
|
152
|
+
createdAt: "2026-02-28T10:00:00.000Z",
|
|
153
|
+
likeCount: 123,
|
|
154
|
+
permalink: "https://x.com/octogent/status/1",
|
|
155
|
+
matchedQueryTerm: "Codex",
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (url.endsWith("/api/monitor/refresh") && method === "POST") {
|
|
162
|
+
refreshCount += 1;
|
|
163
|
+
return jsonResponse({
|
|
164
|
+
providerId: "x",
|
|
165
|
+
queryTerms: ["Codex"],
|
|
166
|
+
refreshPolicy: {
|
|
167
|
+
maxCacheAgeMs: 86400000,
|
|
168
|
+
maxPosts: 30,
|
|
169
|
+
searchWindowDays: 7,
|
|
170
|
+
},
|
|
171
|
+
lastFetchedAt: "2026-02-28T12:05:00.000Z",
|
|
172
|
+
staleAfter: "2026-03-01T12:05:00.000Z",
|
|
173
|
+
isStale: false,
|
|
174
|
+
lastError: null,
|
|
175
|
+
usage: {
|
|
176
|
+
status: "ok",
|
|
177
|
+
source: "x-api",
|
|
178
|
+
fetchedAt: "2026-02-28T12:05:00.000Z",
|
|
179
|
+
cap: 1000,
|
|
180
|
+
used: 250,
|
|
181
|
+
remaining: 750,
|
|
182
|
+
resetAt: "2026-03-01T00:00:00.000Z",
|
|
183
|
+
},
|
|
184
|
+
posts: [
|
|
185
|
+
{
|
|
186
|
+
source: "x",
|
|
187
|
+
id: "2",
|
|
188
|
+
text: "Manual refresh delivered this post",
|
|
189
|
+
author: "indy",
|
|
190
|
+
createdAt: "2026-02-28T12:04:00.000Z",
|
|
191
|
+
likeCount: 222,
|
|
192
|
+
permalink: "https://x.com/indy/status/2",
|
|
193
|
+
matchedQueryTerm: "Agent Ops",
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return notFoundResponse();
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
render(<App />);
|
|
203
|
+
|
|
204
|
+
fireEvent.click(
|
|
205
|
+
await screen.findByRole("button", {
|
|
206
|
+
name: "[5] Monitor",
|
|
207
|
+
}),
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
const telemetryTape = screen.getByLabelText("Telemetry ticker tape");
|
|
211
|
+
await waitFor(() => {
|
|
212
|
+
expect(within(telemetryTape).getAllByText("@octogent")).toHaveLength(2);
|
|
213
|
+
expect(within(telemetryTape).getAllByText("♥ 123")).toHaveLength(2);
|
|
214
|
+
expect(within(telemetryTape).getAllByText("𝕏")).toHaveLength(2);
|
|
215
|
+
const resourceLinks = within(telemetryTape).getAllByRole("link");
|
|
216
|
+
expect(resourceLinks.length).toBeGreaterThan(0);
|
|
217
|
+
expect(resourceLinks[0]).toHaveAttribute("href", "https://x.com/octogent/status/1");
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
const monitorView = await screen.findByLabelText("Monitor primary view");
|
|
221
|
+
expect(within(monitorView).getByRole("button", { name: "Resources" })).toHaveAttribute(
|
|
222
|
+
"aria-current",
|
|
223
|
+
"page",
|
|
224
|
+
);
|
|
225
|
+
fireEvent.click(within(monitorView).getByRole("button", { name: "Configure" }));
|
|
226
|
+
expect(within(monitorView).getByRole("button", { name: "Configure" })).toHaveAttribute(
|
|
227
|
+
"aria-current",
|
|
228
|
+
"page",
|
|
229
|
+
);
|
|
230
|
+
expect(
|
|
231
|
+
within(monitorView).queryByRole("textbox", { name: "Monitor query terms" }),
|
|
232
|
+
).not.toBeInTheDocument();
|
|
233
|
+
fireEvent.click(within(monitorView).getByRole("button", { name: "3D" }));
|
|
234
|
+
fireEvent.change(within(monitorView).getByLabelText("Add monitor query term"), {
|
|
235
|
+
target: {
|
|
236
|
+
value: "Agent Ops",
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
fireEvent.click(within(monitorView).getByRole("button", { name: "Add query term" }));
|
|
240
|
+
fireEvent.click(within(monitorView).getByRole("button", { name: "Save monitor settings" }));
|
|
241
|
+
|
|
242
|
+
await waitFor(() => {
|
|
243
|
+
expect(
|
|
244
|
+
monitorConfigPatchBodies.some((body) =>
|
|
245
|
+
Array.isArray(body.queryTerms) ? body.queryTerms.includes("Agent Ops") : false,
|
|
246
|
+
),
|
|
247
|
+
).toBe(true);
|
|
248
|
+
});
|
|
249
|
+
expect(
|
|
250
|
+
monitorConfigPatchBodies.some(
|
|
251
|
+
(body) =>
|
|
252
|
+
typeof body.refreshPolicy === "object" &&
|
|
253
|
+
body.refreshPolicy !== null &&
|
|
254
|
+
(body.refreshPolicy as { searchWindowDays?: number }).searchWindowDays === 3,
|
|
255
|
+
),
|
|
256
|
+
).toBe(true);
|
|
257
|
+
|
|
258
|
+
fireEvent.change(within(monitorView).getByLabelText("X bearer token"), {
|
|
259
|
+
target: {
|
|
260
|
+
value: "my-x-token",
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
fireEvent.click(within(monitorView).getByRole("button", { name: "Save monitor settings" }));
|
|
264
|
+
|
|
265
|
+
await waitFor(() => {
|
|
266
|
+
expect(monitorConfigPatchBodies.length).toBeGreaterThan(0);
|
|
267
|
+
});
|
|
268
|
+
expect(monitorConfigPatchBodies.at(-1)).toMatchObject({
|
|
269
|
+
providerId: "x",
|
|
270
|
+
credentials: {
|
|
271
|
+
bearerToken: "my-x-token",
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
fireEvent.click(within(monitorView).getByRole("button", { name: "Resources" }));
|
|
276
|
+
expect(within(monitorView).getByText("Codex is shipping faster loops")).toBeInTheDocument();
|
|
277
|
+
expect(within(monitorView).getByText("Codex")).toBeInTheDocument();
|
|
278
|
+
fireEvent.click(within(monitorView).getByRole("button", { name: "Refresh monitor feed" }));
|
|
279
|
+
|
|
280
|
+
expect(
|
|
281
|
+
await within(monitorView).findByText("Manual refresh delivered this post"),
|
|
282
|
+
).toBeInTheDocument();
|
|
283
|
+
expect(refreshCount).toBe(1);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
it("polls monitor feed and updates stale view automatically", async () => {
|
|
287
|
+
vi.useFakeTimers({ shouldAdvanceTime: true });
|
|
288
|
+
let feedRequestCount = 0;
|
|
289
|
+
|
|
290
|
+
vi.spyOn(globalThis, "fetch").mockImplementation(async (input, init) => {
|
|
291
|
+
const url = String(input);
|
|
292
|
+
const method = init?.method ?? "GET";
|
|
293
|
+
|
|
294
|
+
if (url.endsWith("/api/terminal-snapshots") && method === "GET") {
|
|
295
|
+
return jsonResponse([]);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (url.endsWith("/api/codex/usage") && method === "GET") {
|
|
299
|
+
return jsonResponse({
|
|
300
|
+
status: "unavailable",
|
|
301
|
+
source: "none",
|
|
302
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (url.endsWith("/api/claude/usage") && method === "GET") {
|
|
307
|
+
return jsonResponse({
|
|
308
|
+
status: "unavailable",
|
|
309
|
+
source: "none",
|
|
310
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (url.endsWith("/api/github/summary") && method === "GET") {
|
|
315
|
+
return jsonResponse({
|
|
316
|
+
status: "unavailable",
|
|
317
|
+
source: "none",
|
|
318
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
319
|
+
commitsPerDay: [],
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (url.includes("/api/analytics/usage-heatmap") && method === "GET") {
|
|
324
|
+
return jsonResponse({
|
|
325
|
+
days: [],
|
|
326
|
+
projects: [],
|
|
327
|
+
models: [],
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (url.endsWith("/api/ui-state") && method === "GET") {
|
|
332
|
+
return jsonResponse({});
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (url.endsWith("/api/ui-state") && method === "PATCH") {
|
|
336
|
+
return jsonResponse({});
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (url.endsWith("/api/monitor/config") && method === "GET") {
|
|
340
|
+
return jsonResponse({
|
|
341
|
+
providerId: "x",
|
|
342
|
+
queryTerms: ["Codex"],
|
|
343
|
+
refreshPolicy: {
|
|
344
|
+
maxCacheAgeMs: 86400000,
|
|
345
|
+
maxPosts: 30,
|
|
346
|
+
searchWindowDays: 7,
|
|
347
|
+
},
|
|
348
|
+
providers: {
|
|
349
|
+
x: {
|
|
350
|
+
credentials: {
|
|
351
|
+
isConfigured: true,
|
|
352
|
+
bearerTokenHint: "****oken",
|
|
353
|
+
apiKeyHint: null,
|
|
354
|
+
hasApiSecret: false,
|
|
355
|
+
hasAccessToken: false,
|
|
356
|
+
hasAccessTokenSecret: false,
|
|
357
|
+
updatedAt: "2026-02-28T12:00:00.000Z",
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (url.endsWith("/api/monitor/feed") && method === "GET") {
|
|
365
|
+
feedRequestCount += 1;
|
|
366
|
+
if (feedRequestCount === 1) {
|
|
367
|
+
return jsonResponse({
|
|
368
|
+
providerId: "x",
|
|
369
|
+
queryTerms: ["Codex"],
|
|
370
|
+
refreshPolicy: {
|
|
371
|
+
maxCacheAgeMs: 86400000,
|
|
372
|
+
maxPosts: 30,
|
|
373
|
+
searchWindowDays: 7,
|
|
374
|
+
},
|
|
375
|
+
lastFetchedAt: "2026-02-26T12:00:00.000Z",
|
|
376
|
+
staleAfter: "2026-02-27T12:00:00.000Z",
|
|
377
|
+
isStale: true,
|
|
378
|
+
lastError: null,
|
|
379
|
+
usage: null,
|
|
380
|
+
posts: [
|
|
381
|
+
{
|
|
382
|
+
source: "x",
|
|
383
|
+
id: "1",
|
|
384
|
+
text: "Older stale post",
|
|
385
|
+
author: "agent",
|
|
386
|
+
createdAt: "2026-02-26T10:00:00.000Z",
|
|
387
|
+
likeCount: 10,
|
|
388
|
+
permalink: "https://x.com/agent/status/1",
|
|
389
|
+
matchedQueryTerm: "Codex",
|
|
390
|
+
},
|
|
391
|
+
],
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return jsonResponse({
|
|
396
|
+
providerId: "x",
|
|
397
|
+
queryTerms: ["Codex"],
|
|
398
|
+
refreshPolicy: {
|
|
399
|
+
maxCacheAgeMs: 86400000,
|
|
400
|
+
maxPosts: 30,
|
|
401
|
+
searchWindowDays: 7,
|
|
402
|
+
},
|
|
403
|
+
lastFetchedAt: "2026-02-28T12:01:00.000Z",
|
|
404
|
+
staleAfter: "2026-03-01T12:01:00.000Z",
|
|
405
|
+
isStale: false,
|
|
406
|
+
lastError: null,
|
|
407
|
+
usage: null,
|
|
408
|
+
posts: [
|
|
409
|
+
{
|
|
410
|
+
source: "x",
|
|
411
|
+
id: "2",
|
|
412
|
+
text: "Fresh post after auto refresh",
|
|
413
|
+
author: "agent",
|
|
414
|
+
createdAt: "2026-02-28T12:01:00.000Z",
|
|
415
|
+
likeCount: 88,
|
|
416
|
+
permalink: "https://x.com/agent/status/2",
|
|
417
|
+
matchedQueryTerm: "Codex",
|
|
418
|
+
},
|
|
419
|
+
],
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
return notFoundResponse();
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
render(<App />);
|
|
427
|
+
|
|
428
|
+
fireEvent.click(
|
|
429
|
+
await screen.findByRole("button", {
|
|
430
|
+
name: "[5] Monitor",
|
|
431
|
+
}),
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
const monitorView = await screen.findByLabelText("Monitor primary view");
|
|
435
|
+
expect(within(monitorView).getByText("Older stale post")).toBeInTheDocument();
|
|
436
|
+
expect(within(monitorView).getByText("STALE")).toBeInTheDocument();
|
|
437
|
+
|
|
438
|
+
await vi.advanceTimersByTimeAsync(MONITOR_SCAN_INTERVAL_MS);
|
|
439
|
+
|
|
440
|
+
await waitFor(() => {
|
|
441
|
+
expect(within(monitorView).getByText("Fresh post after auto refresh")).toBeInTheDocument();
|
|
442
|
+
});
|
|
443
|
+
expect(within(monitorView).getByText("FRESH")).toBeInTheDocument();
|
|
444
|
+
expect(feedRequestCount).toBeGreaterThanOrEqual(2);
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
it("hydrates the bottom telemetry tape after reload without opening the monitor view", async () => {
|
|
448
|
+
vi.useFakeTimers({ shouldAdvanceTime: true });
|
|
449
|
+
|
|
450
|
+
vi.spyOn(globalThis, "fetch").mockImplementation(async (input, init) => {
|
|
451
|
+
const url = String(input);
|
|
452
|
+
const method = init?.method ?? "GET";
|
|
453
|
+
|
|
454
|
+
if (url.endsWith("/api/terminal-snapshots") && method === "GET") {
|
|
455
|
+
return jsonResponse([]);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (url.endsWith("/api/codex/usage") && method === "GET") {
|
|
459
|
+
return jsonResponse({
|
|
460
|
+
status: "unavailable",
|
|
461
|
+
source: "none",
|
|
462
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (url.endsWith("/api/claude/usage") && method === "GET") {
|
|
467
|
+
return jsonResponse({
|
|
468
|
+
status: "unavailable",
|
|
469
|
+
source: "none",
|
|
470
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
if (url.endsWith("/api/github/summary") && method === "GET") {
|
|
475
|
+
return jsonResponse({
|
|
476
|
+
status: "unavailable",
|
|
477
|
+
source: "none",
|
|
478
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
479
|
+
commitsPerDay: [],
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
if (url.includes("/api/analytics/usage-heatmap") && method === "GET") {
|
|
484
|
+
return jsonResponse({
|
|
485
|
+
days: [],
|
|
486
|
+
projects: [],
|
|
487
|
+
models: [],
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
if (url.endsWith("/api/ui-state") && method === "GET") {
|
|
492
|
+
return jsonResponse({
|
|
493
|
+
isMonitorVisible: true,
|
|
494
|
+
isBottomTelemetryVisible: true,
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (url.endsWith("/api/ui-state") && method === "PATCH") {
|
|
499
|
+
return jsonResponse({});
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
if (url.endsWith("/api/monitor/config") && method === "GET") {
|
|
503
|
+
return jsonResponse({
|
|
504
|
+
providerId: "x",
|
|
505
|
+
queryTerms: ["Codex"],
|
|
506
|
+
refreshPolicy: {
|
|
507
|
+
maxCacheAgeMs: 86400000,
|
|
508
|
+
maxPosts: 30,
|
|
509
|
+
searchWindowDays: 7,
|
|
510
|
+
},
|
|
511
|
+
providers: {
|
|
512
|
+
x: {
|
|
513
|
+
credentials: {
|
|
514
|
+
isConfigured: true,
|
|
515
|
+
bearerTokenHint: "****oken",
|
|
516
|
+
apiKeyHint: null,
|
|
517
|
+
hasApiSecret: false,
|
|
518
|
+
hasAccessToken: false,
|
|
519
|
+
hasAccessTokenSecret: false,
|
|
520
|
+
updatedAt: "2026-02-28T12:00:00.000Z",
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
},
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (url.endsWith("/api/monitor/feed") && method === "GET") {
|
|
528
|
+
return jsonResponse({
|
|
529
|
+
providerId: "x",
|
|
530
|
+
queryTerms: ["Codex"],
|
|
531
|
+
refreshPolicy: {
|
|
532
|
+
maxCacheAgeMs: 86400000,
|
|
533
|
+
maxPosts: 30,
|
|
534
|
+
searchWindowDays: 7,
|
|
535
|
+
},
|
|
536
|
+
lastFetchedAt: "2026-02-28T12:00:00.000Z",
|
|
537
|
+
staleAfter: "2026-03-01T12:00:00.000Z",
|
|
538
|
+
isStale: false,
|
|
539
|
+
lastError: null,
|
|
540
|
+
usage: null,
|
|
541
|
+
posts: [
|
|
542
|
+
{
|
|
543
|
+
source: "x",
|
|
544
|
+
id: "1",
|
|
545
|
+
text: "Telemetry should hydrate without visiting monitor",
|
|
546
|
+
author: "octogent",
|
|
547
|
+
createdAt: "2026-02-28T10:00:00.000Z",
|
|
548
|
+
likeCount: 123,
|
|
549
|
+
permalink: "https://x.com/octogent/status/1",
|
|
550
|
+
matchedQueryTerm: "Codex",
|
|
551
|
+
},
|
|
552
|
+
],
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return notFoundResponse();
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
render(<App />);
|
|
560
|
+
|
|
561
|
+
const telemetryTape = await screen.findByLabelText("Telemetry ticker tape");
|
|
562
|
+
await waitFor(() => {
|
|
563
|
+
expect(within(telemetryTape).getAllByText("@octogent")).toHaveLength(2);
|
|
564
|
+
expect(
|
|
565
|
+
within(telemetryTape).queryByText("Waiting for X resources..."),
|
|
566
|
+
).not.toBeInTheDocument();
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
it("does not call monitor APIs when Monitor is disabled, even if bottom telemetry is enabled", async () => {
|
|
571
|
+
vi.useFakeTimers({ shouldAdvanceTime: true });
|
|
572
|
+
let monitorConfigCalls = 0;
|
|
573
|
+
let monitorFeedCalls = 0;
|
|
574
|
+
let monitorRefreshCalls = 0;
|
|
575
|
+
|
|
576
|
+
vi.spyOn(globalThis, "fetch").mockImplementation(async (input, init) => {
|
|
577
|
+
const url = String(input);
|
|
578
|
+
const method = init?.method ?? "GET";
|
|
579
|
+
|
|
580
|
+
if (url.endsWith("/api/terminal-snapshots") && method === "GET") {
|
|
581
|
+
return jsonResponse([]);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if (url.endsWith("/api/codex/usage") && method === "GET") {
|
|
585
|
+
return jsonResponse({
|
|
586
|
+
status: "unavailable",
|
|
587
|
+
source: "none",
|
|
588
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
if (url.endsWith("/api/claude/usage") && method === "GET") {
|
|
593
|
+
return jsonResponse({
|
|
594
|
+
status: "unavailable",
|
|
595
|
+
source: "none",
|
|
596
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
if (url.endsWith("/api/github/summary") && method === "GET") {
|
|
601
|
+
return jsonResponse({
|
|
602
|
+
status: "unavailable",
|
|
603
|
+
source: "none",
|
|
604
|
+
fetchedAt: "2026-02-28T12:00:00.000Z",
|
|
605
|
+
commitsPerDay: [],
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
if (url.includes("/api/analytics/usage-heatmap") && method === "GET") {
|
|
610
|
+
return jsonResponse({
|
|
611
|
+
days: [],
|
|
612
|
+
projects: [],
|
|
613
|
+
models: [],
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (url.endsWith("/api/ui-state") && method === "GET") {
|
|
618
|
+
return jsonResponse({
|
|
619
|
+
isMonitorVisible: false,
|
|
620
|
+
isBottomTelemetryVisible: true,
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if (url.endsWith("/api/ui-state") && method === "PATCH") {
|
|
625
|
+
return jsonResponse({});
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
if (url.endsWith("/api/monitor/config") && method === "GET") {
|
|
629
|
+
monitorConfigCalls += 1;
|
|
630
|
+
return jsonResponse({});
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
if (url.endsWith("/api/monitor/feed") && method === "GET") {
|
|
634
|
+
monitorFeedCalls += 1;
|
|
635
|
+
return jsonResponse({});
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
if (url.endsWith("/api/monitor/refresh") && method === "POST") {
|
|
639
|
+
monitorRefreshCalls += 1;
|
|
640
|
+
return jsonResponse({});
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
return notFoundResponse();
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
render(<App />);
|
|
647
|
+
|
|
648
|
+
expect(screen.queryByLabelText("Telemetry ticker tape")).toBeNull();
|
|
649
|
+
|
|
650
|
+
fireEvent.click(screen.getByRole("button", { name: "[5] Monitor" }));
|
|
651
|
+
expect(await screen.findByLabelText("Monitor primary view disabled")).toBeInTheDocument();
|
|
652
|
+
|
|
653
|
+
expect(monitorConfigCalls).toBe(0);
|
|
654
|
+
expect(monitorFeedCalls).toBe(0);
|
|
655
|
+
expect(monitorRefreshCalls).toBe(0);
|
|
656
|
+
});
|
|
657
|
+
});
|