@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,475 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { formatTimestamp } from "../app/formatTimestamp";
|
|
4
|
+
import type {
|
|
5
|
+
MonitorConfigPatchRequest,
|
|
6
|
+
UseMonitorRuntimeResult,
|
|
7
|
+
} from "../app/hooks/useMonitorRuntime";
|
|
8
|
+
import { ActionButton } from "./ui/ActionButton";
|
|
9
|
+
|
|
10
|
+
type MonitorPrimaryViewProps = {
|
|
11
|
+
monitorRuntime: Pick<
|
|
12
|
+
UseMonitorRuntimeResult,
|
|
13
|
+
| "monitorConfig"
|
|
14
|
+
| "monitorFeed"
|
|
15
|
+
| "monitorError"
|
|
16
|
+
| "isRefreshingMonitorFeed"
|
|
17
|
+
| "isSavingMonitorConfig"
|
|
18
|
+
| "refreshMonitorFeed"
|
|
19
|
+
| "patchMonitorConfig"
|
|
20
|
+
>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type MonitorSubtabId = "resources" | "configure";
|
|
24
|
+
type MonitorProviderId = "x";
|
|
25
|
+
|
|
26
|
+
const MONITOR_PROVIDER_TABS: Array<{
|
|
27
|
+
id: MonitorProviderId;
|
|
28
|
+
label: string;
|
|
29
|
+
icon: string;
|
|
30
|
+
}> = [{ id: "x", label: "X Monitor", icon: "𝕏" }];
|
|
31
|
+
|
|
32
|
+
const MONITOR_SUBTABS: Array<{ id: MonitorSubtabId; label: string }> = [
|
|
33
|
+
{ id: "resources", label: "Resources" },
|
|
34
|
+
{ id: "configure", label: "Configure" },
|
|
35
|
+
];
|
|
36
|
+
const MONITOR_SEARCH_WINDOW_OPTIONS: Array<{ value: 7 | 3 | 1; label: string }> = [
|
|
37
|
+
{ value: 7, label: "7D" },
|
|
38
|
+
{ value: 3, label: "3D" },
|
|
39
|
+
{ value: 1, label: "1D" },
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const normalizeTerms = (terms: string[]): string[] => {
|
|
43
|
+
const split = terms.map((term) => term.trim()).filter((term) => term.length > 0);
|
|
44
|
+
return [...new Set(split)];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const MonitorPrimaryView = ({ monitorRuntime }: MonitorPrimaryViewProps) => {
|
|
48
|
+
const {
|
|
49
|
+
monitorConfig,
|
|
50
|
+
monitorFeed,
|
|
51
|
+
monitorError,
|
|
52
|
+
isRefreshingMonitorFeed,
|
|
53
|
+
isSavingMonitorConfig,
|
|
54
|
+
refreshMonitorFeed,
|
|
55
|
+
patchMonitorConfig,
|
|
56
|
+
} = monitorRuntime;
|
|
57
|
+
|
|
58
|
+
const onRefresh = () => {
|
|
59
|
+
void refreshMonitorFeed(true);
|
|
60
|
+
};
|
|
61
|
+
const onSyncFeed = () => {
|
|
62
|
+
void refreshMonitorFeed(false);
|
|
63
|
+
};
|
|
64
|
+
const onPatchConfig = patchMonitorConfig as (
|
|
65
|
+
patch: MonitorConfigPatchRequest,
|
|
66
|
+
) => Promise<boolean>;
|
|
67
|
+
const activeProviderId: MonitorProviderId = "x";
|
|
68
|
+
const [activeSubtab, setActiveSubtab] = useState<MonitorSubtabId>("resources");
|
|
69
|
+
const [queryTermsDraft, setQueryTermsDraft] = useState<string[]>([]);
|
|
70
|
+
const [queryTermInput, setQueryTermInput] = useState("");
|
|
71
|
+
const [maxPostsDraft, setMaxPostsDraft] = useState("30");
|
|
72
|
+
const [searchWindowDaysDraft, setSearchWindowDaysDraft] = useState<7 | 3 | 1>(7);
|
|
73
|
+
const [bearerToken, setBearerToken] = useState("");
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (!monitorConfig) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
setQueryTermsDraft(normalizeTerms(monitorConfig.queryTerms));
|
|
81
|
+
setMaxPostsDraft(String(monitorConfig.refreshPolicy.maxPosts));
|
|
82
|
+
setSearchWindowDaysDraft(monitorConfig.refreshPolicy.searchWindowDays);
|
|
83
|
+
}, [monitorConfig]);
|
|
84
|
+
|
|
85
|
+
const usageCapLabel = useMemo(() => {
|
|
86
|
+
if (!monitorFeed?.usage?.cap && monitorFeed?.usage?.cap !== 0) {
|
|
87
|
+
return "--";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return Math.round(monitorFeed.usage.cap).toLocaleString("en-US");
|
|
91
|
+
}, [monitorFeed]);
|
|
92
|
+
|
|
93
|
+
const usageUsedLabel = useMemo(() => {
|
|
94
|
+
if (!monitorFeed?.usage?.used && monitorFeed?.usage?.used !== 0) {
|
|
95
|
+
return "--";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return Math.round(monitorFeed.usage.used).toLocaleString("en-US");
|
|
99
|
+
}, [monitorFeed]);
|
|
100
|
+
|
|
101
|
+
const usageRemainingLabel = useMemo(() => {
|
|
102
|
+
if (!monitorFeed?.usage?.remaining && monitorFeed?.usage?.remaining !== 0) {
|
|
103
|
+
return "--";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return Math.round(monitorFeed.usage.remaining).toLocaleString("en-US");
|
|
107
|
+
}, [monitorFeed]);
|
|
108
|
+
const resourceRollItems = useMemo(
|
|
109
|
+
() => [
|
|
110
|
+
`Last sync ${formatTimestamp(monitorFeed?.lastFetchedAt ?? null)}`,
|
|
111
|
+
`Stale after ${formatTimestamp(monitorFeed?.staleAfter ?? null)}`,
|
|
112
|
+
`Usage cap ${usageCapLabel}`,
|
|
113
|
+
`Used ${usageUsedLabel}`,
|
|
114
|
+
`Remaining ${usageRemainingLabel}`,
|
|
115
|
+
`Window ${searchWindowDaysDraft}D`,
|
|
116
|
+
`Resets ${formatTimestamp(monitorFeed?.usage?.resetAt ?? null)}`,
|
|
117
|
+
],
|
|
118
|
+
[monitorFeed, searchWindowDaysDraft, usageCapLabel, usageRemainingLabel, usageUsedLabel],
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const credentialsSummary = monitorConfig?.providers.x.credentials;
|
|
122
|
+
const parsedMaxPosts = /^[1-9]\d*$/.test(maxPostsDraft.trim())
|
|
123
|
+
? Number.parseInt(maxPostsDraft.trim(), 10)
|
|
124
|
+
: null;
|
|
125
|
+
const currentConfiguredTerms = monitorConfig?.queryTerms ?? [];
|
|
126
|
+
const nextTermsForSave = normalizeTerms(
|
|
127
|
+
queryTermsDraft.length > 0 ? queryTermsDraft : currentConfiguredTerms,
|
|
128
|
+
);
|
|
129
|
+
const hasCredentialInput = bearerToken.trim().length > 0;
|
|
130
|
+
const canSaveConfig =
|
|
131
|
+
parsedMaxPosts !== null && (nextTermsForSave.length > 0 || hasCredentialInput);
|
|
132
|
+
const configuredMaxPosts =
|
|
133
|
+
monitorFeed?.refreshPolicy.maxPosts ?? monitorConfig?.refreshPolicy.maxPosts ?? 30;
|
|
134
|
+
|
|
135
|
+
const appendQueryTerm = (raw: string) => {
|
|
136
|
+
const nextTerms = normalizeTerms(raw.split(/[\n,]/));
|
|
137
|
+
if (nextTerms.length === 0) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
setQueryTermsDraft((current) => normalizeTerms([...current, ...nextTerms]));
|
|
142
|
+
setQueryTermInput("");
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const removeQueryTerm = (termToRemove: string) => {
|
|
146
|
+
setQueryTermsDraft((current) => current.filter((term) => term !== termToRemove));
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const saveMonitorSettings = () => {
|
|
150
|
+
if (parsedMaxPosts === null) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const patchCredentials: {
|
|
155
|
+
bearerToken?: string;
|
|
156
|
+
} = {};
|
|
157
|
+
if (hasCredentialInput) {
|
|
158
|
+
patchCredentials.bearerToken = bearerToken.trim();
|
|
159
|
+
}
|
|
160
|
+
const hasCredentialPatch = Object.keys(patchCredentials).length > 0;
|
|
161
|
+
const patchPayload = {
|
|
162
|
+
providerId: "x" as const,
|
|
163
|
+
validateCredentials: false,
|
|
164
|
+
...(nextTermsForSave.length > 0 ? { queryTerms: nextTermsForSave } : {}),
|
|
165
|
+
refreshPolicy: {
|
|
166
|
+
maxPosts: parsedMaxPosts,
|
|
167
|
+
searchWindowDays: searchWindowDaysDraft,
|
|
168
|
+
},
|
|
169
|
+
...(hasCredentialPatch ? { credentials: patchCredentials } : {}),
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
void onPatchConfig(patchPayload).then((saved) => {
|
|
173
|
+
if (!saved) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
setBearerToken("");
|
|
178
|
+
onSyncFeed();
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<section className="monitor-view" aria-label="Monitor primary view">
|
|
184
|
+
<header className="monitor-header">
|
|
185
|
+
<div className="monitor-header-top">
|
|
186
|
+
<div className="monitor-header-main">
|
|
187
|
+
<nav className="monitor-provider-tabs" aria-label="Monitor providers">
|
|
188
|
+
{MONITOR_PROVIDER_TABS.map((provider) => (
|
|
189
|
+
<button
|
|
190
|
+
aria-current={activeProviderId === provider.id ? "page" : undefined}
|
|
191
|
+
className="monitor-provider-tab"
|
|
192
|
+
data-active={activeProviderId === provider.id ? "true" : "false"}
|
|
193
|
+
key={provider.id}
|
|
194
|
+
type="button"
|
|
195
|
+
>
|
|
196
|
+
<span aria-hidden="true" className="monitor-provider-tab-icon">
|
|
197
|
+
{provider.icon}
|
|
198
|
+
</span>
|
|
199
|
+
<span>{provider.label}</span>
|
|
200
|
+
</button>
|
|
201
|
+
))}
|
|
202
|
+
</nav>
|
|
203
|
+
|
|
204
|
+
<nav className="monitor-subtabs" aria-label="Monitor subtabs">
|
|
205
|
+
{MONITOR_SUBTABS.map((subtab) => (
|
|
206
|
+
<button
|
|
207
|
+
aria-current={activeSubtab === subtab.id ? "page" : undefined}
|
|
208
|
+
className="monitor-subtab"
|
|
209
|
+
data-active={activeSubtab === subtab.id ? "true" : "false"}
|
|
210
|
+
key={subtab.id}
|
|
211
|
+
onClick={() => {
|
|
212
|
+
setActiveSubtab(subtab.id);
|
|
213
|
+
}}
|
|
214
|
+
type="button"
|
|
215
|
+
>
|
|
216
|
+
{subtab.label}
|
|
217
|
+
</button>
|
|
218
|
+
))}
|
|
219
|
+
</nav>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<div className="monitor-header-actions">
|
|
223
|
+
<span
|
|
224
|
+
className="console-status-pill"
|
|
225
|
+
data-state={monitorFeed?.isStale ? "stale" : "fresh"}
|
|
226
|
+
>
|
|
227
|
+
{monitorFeed?.isStale ? "STALE" : "FRESH"}
|
|
228
|
+
</span>
|
|
229
|
+
<ActionButton
|
|
230
|
+
aria-label="Refresh monitor feed"
|
|
231
|
+
className="monitor-refresh"
|
|
232
|
+
disabled={isRefreshingMonitorFeed}
|
|
233
|
+
onClick={onRefresh}
|
|
234
|
+
size="dense"
|
|
235
|
+
variant="accent"
|
|
236
|
+
>
|
|
237
|
+
{isRefreshingMonitorFeed ? "Refreshing..." : "Refresh"}
|
|
238
|
+
</ActionButton>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
{activeSubtab === "resources" && (
|
|
243
|
+
<div className="monitor-header-roll" aria-label="Monitor rolling stats">
|
|
244
|
+
<div className="monitor-header-roll-track">
|
|
245
|
+
{resourceRollItems.map((item) => (
|
|
246
|
+
<span key={`primary-${item}`}>{item}</span>
|
|
247
|
+
))}
|
|
248
|
+
{resourceRollItems.map((item) => (
|
|
249
|
+
<span key={`echo-${item}`}>{item}</span>
|
|
250
|
+
))}
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
)}
|
|
254
|
+
</header>
|
|
255
|
+
|
|
256
|
+
{activeSubtab === "configure" ? (
|
|
257
|
+
<section className="monitor-configure" aria-label="Monitor configuration">
|
|
258
|
+
<section
|
|
259
|
+
className="monitor-panel monitor-panel--configure"
|
|
260
|
+
aria-label="Monitor configuration panel"
|
|
261
|
+
>
|
|
262
|
+
<h3>Monitor setup</h3>
|
|
263
|
+
<div className="monitor-config-summary" aria-label="Monitor setup summary">
|
|
264
|
+
<span className="monitor-config-chip">{`Terms ${nextTermsForSave.length}`}</span>
|
|
265
|
+
<span className="monitor-config-chip">{`Window ${searchWindowDaysDraft}D`}</span>
|
|
266
|
+
<span className="monitor-config-chip">{`Max ${parsedMaxPosts ?? "--"}`}</span>
|
|
267
|
+
</div>
|
|
268
|
+
|
|
269
|
+
{monitorError ? <p className="monitor-error">{monitorError}</p> : null}
|
|
270
|
+
{monitorFeed?.lastError ? (
|
|
271
|
+
<p className="monitor-error">{monitorFeed.lastError}</p>
|
|
272
|
+
) : null}
|
|
273
|
+
|
|
274
|
+
<div className="monitor-config-layout">
|
|
275
|
+
<div className="monitor-config-column">
|
|
276
|
+
<div className="monitor-config-section">
|
|
277
|
+
<label htmlFor="monitor-x-bearer-token">X bearer token</label>
|
|
278
|
+
<input
|
|
279
|
+
id="monitor-x-bearer-token"
|
|
280
|
+
autoComplete="off"
|
|
281
|
+
className="monitor-input"
|
|
282
|
+
onChange={(event) => {
|
|
283
|
+
setBearerToken(event.target.value);
|
|
284
|
+
}}
|
|
285
|
+
placeholder={
|
|
286
|
+
credentialsSummary?.isConfigured
|
|
287
|
+
? "Token saved. Paste to replace"
|
|
288
|
+
: "Paste X bearer token"
|
|
289
|
+
}
|
|
290
|
+
type="password"
|
|
291
|
+
value={bearerToken}
|
|
292
|
+
/>
|
|
293
|
+
{credentialsSummary && (
|
|
294
|
+
<output className="monitor-credentials-meta" aria-live="polite">
|
|
295
|
+
{credentialsSummary.isConfigured ? (
|
|
296
|
+
<span className="monitor-state-badge monitor-state-badge--saved">
|
|
297
|
+
Saved
|
|
298
|
+
</span>
|
|
299
|
+
) : (
|
|
300
|
+
<span>Not configured</span>
|
|
301
|
+
)}
|
|
302
|
+
</output>
|
|
303
|
+
)}
|
|
304
|
+
</div>
|
|
305
|
+
|
|
306
|
+
<div className="monitor-config-section">
|
|
307
|
+
<p className="monitor-section-label">Target terms</p>
|
|
308
|
+
<ul className="monitor-query-terms-list" aria-label="Monitor query terms">
|
|
309
|
+
{queryTermsDraft.map((term) => (
|
|
310
|
+
<li className="monitor-query-term" key={term}>
|
|
311
|
+
<span>{term}</span>
|
|
312
|
+
<button
|
|
313
|
+
aria-label={`Remove query term ${term}`}
|
|
314
|
+
onClick={() => {
|
|
315
|
+
removeQueryTerm(term);
|
|
316
|
+
}}
|
|
317
|
+
type="button"
|
|
318
|
+
>
|
|
319
|
+
Remove
|
|
320
|
+
</button>
|
|
321
|
+
</li>
|
|
322
|
+
))}
|
|
323
|
+
{queryTermsDraft.length === 0 ? (
|
|
324
|
+
<p className="monitor-query-empty">Add at least one query term to save.</p>
|
|
325
|
+
) : null}
|
|
326
|
+
</ul>
|
|
327
|
+
<div className="monitor-query-term-form">
|
|
328
|
+
<input
|
|
329
|
+
aria-label="Add monitor query term"
|
|
330
|
+
className="monitor-input"
|
|
331
|
+
onChange={(event) => {
|
|
332
|
+
setQueryTermInput(event.target.value);
|
|
333
|
+
}}
|
|
334
|
+
onKeyDown={(event) => {
|
|
335
|
+
if (event.key === "Enter") {
|
|
336
|
+
event.preventDefault();
|
|
337
|
+
appendQueryTerm(queryTermInput);
|
|
338
|
+
}
|
|
339
|
+
}}
|
|
340
|
+
placeholder="Add term and press Enter"
|
|
341
|
+
type="text"
|
|
342
|
+
value={queryTermInput}
|
|
343
|
+
/>
|
|
344
|
+
<ActionButton
|
|
345
|
+
aria-label="Add query term"
|
|
346
|
+
className="monitor-query-add"
|
|
347
|
+
onClick={() => {
|
|
348
|
+
appendQueryTerm(queryTermInput);
|
|
349
|
+
}}
|
|
350
|
+
size="dense"
|
|
351
|
+
variant="info"
|
|
352
|
+
>
|
|
353
|
+
Add
|
|
354
|
+
</ActionButton>
|
|
355
|
+
</div>
|
|
356
|
+
</div>
|
|
357
|
+
</div>
|
|
358
|
+
|
|
359
|
+
<div className="monitor-config-column">
|
|
360
|
+
<div className="monitor-config-section">
|
|
361
|
+
<p className="monitor-section-label">Search policy</p>
|
|
362
|
+
<div className="monitor-policy-grid">
|
|
363
|
+
<div className="monitor-field">
|
|
364
|
+
<label htmlFor="monitor-max-posts">Max returned posts</label>
|
|
365
|
+
<input
|
|
366
|
+
id="monitor-max-posts"
|
|
367
|
+
className="monitor-input"
|
|
368
|
+
inputMode="numeric"
|
|
369
|
+
min={1}
|
|
370
|
+
onChange={(event) => {
|
|
371
|
+
setMaxPostsDraft(event.target.value);
|
|
372
|
+
}}
|
|
373
|
+
pattern="[0-9]*"
|
|
374
|
+
type="text"
|
|
375
|
+
value={maxPostsDraft}
|
|
376
|
+
/>
|
|
377
|
+
</div>
|
|
378
|
+
<div className="monitor-field">
|
|
379
|
+
<p
|
|
380
|
+
className="monitor-section-label monitor-field-label"
|
|
381
|
+
id="monitor-search-window-label"
|
|
382
|
+
>
|
|
383
|
+
Search timeframe
|
|
384
|
+
</p>
|
|
385
|
+
<div
|
|
386
|
+
aria-labelledby="monitor-search-window-label"
|
|
387
|
+
className="monitor-timeframe-picker"
|
|
388
|
+
>
|
|
389
|
+
{MONITOR_SEARCH_WINDOW_OPTIONS.map((option) => (
|
|
390
|
+
<button
|
|
391
|
+
aria-pressed={searchWindowDaysDraft === option.value}
|
|
392
|
+
className="monitor-timeframe-option"
|
|
393
|
+
data-active={searchWindowDaysDraft === option.value ? "true" : "false"}
|
|
394
|
+
key={option.value}
|
|
395
|
+
onClick={() => {
|
|
396
|
+
setSearchWindowDaysDraft(option.value);
|
|
397
|
+
}}
|
|
398
|
+
type="button"
|
|
399
|
+
>
|
|
400
|
+
{option.label}
|
|
401
|
+
</button>
|
|
402
|
+
))}
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
<div className="monitor-config-footer">
|
|
410
|
+
<ActionButton
|
|
411
|
+
aria-label="Save monitor settings"
|
|
412
|
+
className="monitor-config-save"
|
|
413
|
+
disabled={isSavingMonitorConfig || !canSaveConfig}
|
|
414
|
+
onClick={saveMonitorSettings}
|
|
415
|
+
size="dense"
|
|
416
|
+
variant="primary"
|
|
417
|
+
>
|
|
418
|
+
{isSavingMonitorConfig ? "Saving..." : "Save monitor settings"}
|
|
419
|
+
</ActionButton>
|
|
420
|
+
</div>
|
|
421
|
+
</section>
|
|
422
|
+
</section>
|
|
423
|
+
) : (
|
|
424
|
+
<section className="monitor-resources" aria-label="Monitor resources">
|
|
425
|
+
<section className="monitor-feed" aria-label="Monitor feed results">
|
|
426
|
+
<header>
|
|
427
|
+
<h3>Top posts by likes</h3>
|
|
428
|
+
<span>{`${monitorFeed?.posts.length ?? 0} / ${configuredMaxPosts}`}</span>
|
|
429
|
+
</header>
|
|
430
|
+
{monitorError ? <p className="monitor-error">{monitorError}</p> : null}
|
|
431
|
+
{monitorFeed?.lastError ? (
|
|
432
|
+
<p className="monitor-error">{monitorFeed.lastError}</p>
|
|
433
|
+
) : null}
|
|
434
|
+
{monitorFeed && monitorFeed.posts.length === 0 ? (
|
|
435
|
+
<p className="monitor-empty">No posts available yet.</p>
|
|
436
|
+
) : (
|
|
437
|
+
<div className="monitor-feed-scroll">
|
|
438
|
+
<table>
|
|
439
|
+
<thead>
|
|
440
|
+
<tr>
|
|
441
|
+
<th scope="col">Likes</th>
|
|
442
|
+
<th scope="col">Term</th>
|
|
443
|
+
<th scope="col">Author</th>
|
|
444
|
+
<th scope="col">Post</th>
|
|
445
|
+
<th scope="col">Created</th>
|
|
446
|
+
</tr>
|
|
447
|
+
</thead>
|
|
448
|
+
<tbody>
|
|
449
|
+
{(monitorFeed?.posts ?? []).map((post) => (
|
|
450
|
+
<tr key={`${post.source}:${post.id}`}>
|
|
451
|
+
<td>{Math.round(post.likeCount).toLocaleString("en-US")}</td>
|
|
452
|
+
<td>
|
|
453
|
+
<span className="monitor-term-badge">
|
|
454
|
+
{post.matchedQueryTerm ?? "Unknown"}
|
|
455
|
+
</span>
|
|
456
|
+
</td>
|
|
457
|
+
<td>@{post.author}</td>
|
|
458
|
+
<td>
|
|
459
|
+
<a href={post.permalink} rel="noreferrer" target="_blank">
|
|
460
|
+
{post.text}
|
|
461
|
+
</a>
|
|
462
|
+
</td>
|
|
463
|
+
<td>{formatTimestamp(post.createdAt)}</td>
|
|
464
|
+
</tr>
|
|
465
|
+
))}
|
|
466
|
+
</tbody>
|
|
467
|
+
</table>
|
|
468
|
+
</div>
|
|
469
|
+
)}
|
|
470
|
+
</section>
|
|
471
|
+
</section>
|
|
472
|
+
)}
|
|
473
|
+
</section>
|
|
474
|
+
);
|
|
475
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
import type { PrimaryNavIndex } from "../app/constants";
|
|
4
|
+
import type { UseMonitorRuntimeResult } from "../app/hooks/useMonitorRuntime";
|
|
5
|
+
import { ActivityPrimaryView } from "./ActivityPrimaryView";
|
|
6
|
+
import { CanvasPrimaryView } from "./CanvasPrimaryView";
|
|
7
|
+
import { CodeIntelPrimaryView } from "./CodeIntelPrimaryView";
|
|
8
|
+
import { ConversationsPrimaryView } from "./ConversationsPrimaryView";
|
|
9
|
+
import { DeckPrimaryView } from "./DeckPrimaryView";
|
|
10
|
+
import { MonitorPrimaryView } from "./MonitorPrimaryView";
|
|
11
|
+
import { PromptsPrimaryView } from "./PromptsPrimaryView";
|
|
12
|
+
import { SettingsPrimaryView } from "./SettingsPrimaryView";
|
|
13
|
+
|
|
14
|
+
type PrimaryViewRouterProps = {
|
|
15
|
+
activePrimaryNav: PrimaryNavIndex;
|
|
16
|
+
deckPrimaryViewProps: ComponentProps<typeof DeckPrimaryView>;
|
|
17
|
+
isMonitorVisible: boolean;
|
|
18
|
+
activityPrimaryViewProps: ComponentProps<typeof ActivityPrimaryView>;
|
|
19
|
+
settingsPrimaryViewProps: ComponentProps<typeof SettingsPrimaryView>;
|
|
20
|
+
canvasPrimaryViewProps: ComponentProps<typeof CanvasPrimaryView>;
|
|
21
|
+
monitorRuntime: Pick<
|
|
22
|
+
UseMonitorRuntimeResult,
|
|
23
|
+
| "monitorConfig"
|
|
24
|
+
| "monitorFeed"
|
|
25
|
+
| "monitorError"
|
|
26
|
+
| "isRefreshingMonitorFeed"
|
|
27
|
+
| "isSavingMonitorConfig"
|
|
28
|
+
| "refreshMonitorFeed"
|
|
29
|
+
| "patchMonitorConfig"
|
|
30
|
+
>;
|
|
31
|
+
conversationsEnabled: boolean;
|
|
32
|
+
onConversationsSidebarContent: (content: ReactNode) => void;
|
|
33
|
+
onConversationsActionPanel: (content: ReactNode) => void;
|
|
34
|
+
promptsEnabled: boolean;
|
|
35
|
+
onPromptsSidebarContent: (content: ReactNode) => void;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const PrimaryViewRouter = ({
|
|
39
|
+
activePrimaryNav,
|
|
40
|
+
deckPrimaryViewProps,
|
|
41
|
+
isMonitorVisible,
|
|
42
|
+
activityPrimaryViewProps,
|
|
43
|
+
settingsPrimaryViewProps,
|
|
44
|
+
canvasPrimaryViewProps,
|
|
45
|
+
monitorRuntime,
|
|
46
|
+
conversationsEnabled,
|
|
47
|
+
onConversationsSidebarContent,
|
|
48
|
+
onConversationsActionPanel,
|
|
49
|
+
promptsEnabled,
|
|
50
|
+
onPromptsSidebarContent,
|
|
51
|
+
}: PrimaryViewRouterProps) => {
|
|
52
|
+
if (activePrimaryNav === 2) {
|
|
53
|
+
return <DeckPrimaryView {...deckPrimaryViewProps} />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (activePrimaryNav === 3) {
|
|
57
|
+
return <ActivityPrimaryView {...activityPrimaryViewProps} />;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (activePrimaryNav === 4) {
|
|
61
|
+
return <CodeIntelPrimaryView enabled={activePrimaryNav === 4} />;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (activePrimaryNav === 5) {
|
|
65
|
+
if (isMonitorVisible) {
|
|
66
|
+
return <MonitorPrimaryView monitorRuntime={monitorRuntime} />;
|
|
67
|
+
}
|
|
68
|
+
return (
|
|
69
|
+
<section className="monitor-view" aria-label="Monitor primary view disabled">
|
|
70
|
+
<section className="monitor-panel monitor-panel--configure">
|
|
71
|
+
<h3>Monitor is disabled</h3>
|
|
72
|
+
<p>Enable Monitor workspace view in Settings to restore this panel.</p>
|
|
73
|
+
</section>
|
|
74
|
+
</section>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (activePrimaryNav === 6) {
|
|
79
|
+
return (
|
|
80
|
+
<ConversationsPrimaryView
|
|
81
|
+
enabled={conversationsEnabled}
|
|
82
|
+
onSidebarContent={onConversationsSidebarContent}
|
|
83
|
+
onActionPanel={onConversationsActionPanel}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (activePrimaryNav === 7) {
|
|
89
|
+
return (
|
|
90
|
+
<PromptsPrimaryView enabled={promptsEnabled} onSidebarContent={onPromptsSidebarContent} />
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (activePrimaryNav === 8) {
|
|
95
|
+
return <SettingsPrimaryView {...settingsPrimaryViewProps} />;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return <CanvasPrimaryView {...canvasPrimaryViewProps} />;
|
|
99
|
+
};
|