@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,243 @@
|
|
|
1
|
+
import { type ReactNode, useCallback, useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { usePromptLibrary } from "../app/hooks/usePromptLibrary";
|
|
4
|
+
import { SidebarPromptsList } from "./SidebarPromptsList";
|
|
5
|
+
import { Terminal } from "./Terminal";
|
|
6
|
+
import { ActionButton } from "./ui/ActionButton";
|
|
7
|
+
import { MarkdownContent } from "./ui/MarkdownContent";
|
|
8
|
+
|
|
9
|
+
type PromptsPrimaryViewProps = {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
onSidebarContent?: (content: ReactNode) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type NewPromptMode = {
|
|
15
|
+
terminalId: string;
|
|
16
|
+
} | null;
|
|
17
|
+
|
|
18
|
+
export const PromptsPrimaryView = ({ enabled, onSidebarContent }: PromptsPrimaryViewProps) => {
|
|
19
|
+
const {
|
|
20
|
+
prompts,
|
|
21
|
+
selectedPromptName,
|
|
22
|
+
selectedPromptDetail: selectedPrompt,
|
|
23
|
+
isLoadingPrompts,
|
|
24
|
+
isLoadingDetail,
|
|
25
|
+
isEditing,
|
|
26
|
+
editDraft,
|
|
27
|
+
errorMessage,
|
|
28
|
+
refreshPrompts,
|
|
29
|
+
selectPrompt: selectPromptLibraryItem,
|
|
30
|
+
deletePrompt: deletePromptLibraryItem,
|
|
31
|
+
startEditing: onStartEditing,
|
|
32
|
+
cancelEditing: onCancelEditing,
|
|
33
|
+
setEditDraft: onSetEditDraft,
|
|
34
|
+
submitEdit: onSubmitEdit,
|
|
35
|
+
} = usePromptLibrary({ enabled });
|
|
36
|
+
|
|
37
|
+
const [promptEngineerTerminalId, setPromptEngineerTerminalId] = useState<string | null>(null);
|
|
38
|
+
const [newPromptRequestCount, setNewPromptRequestCount] = useState(0);
|
|
39
|
+
const [restoreTerminalCount, setRestoreTerminalCount] = useState(0);
|
|
40
|
+
const [closeTerminalCount, setCloseTerminalCount] = useState(0);
|
|
41
|
+
|
|
42
|
+
const onDelete = useCallback(() => {
|
|
43
|
+
if (selectedPromptName) {
|
|
44
|
+
return deletePromptLibraryItem(selectedPromptName);
|
|
45
|
+
}
|
|
46
|
+
return Promise.resolve(false);
|
|
47
|
+
}, [selectedPromptName, deletePromptLibraryItem]);
|
|
48
|
+
|
|
49
|
+
const onRefresh = refreshPrompts;
|
|
50
|
+
const onTerminalIdChange = setPromptEngineerTerminalId;
|
|
51
|
+
|
|
52
|
+
// Push sidebar content
|
|
53
|
+
const sidebarContent = (
|
|
54
|
+
<SidebarPromptsList
|
|
55
|
+
prompts={prompts}
|
|
56
|
+
selectedPromptName={selectedPromptName}
|
|
57
|
+
isLoadingPrompts={isLoadingPrompts}
|
|
58
|
+
onSelectPrompt={selectPromptLibraryItem}
|
|
59
|
+
onRefresh={() => {
|
|
60
|
+
void refreshPrompts();
|
|
61
|
+
}}
|
|
62
|
+
onNewPrompt={() => {
|
|
63
|
+
setNewPromptRequestCount((c) => c + 1);
|
|
64
|
+
}}
|
|
65
|
+
activeTerminalId={promptEngineerTerminalId}
|
|
66
|
+
onRestoreTerminal={() => {
|
|
67
|
+
setRestoreTerminalCount((c) => c + 1);
|
|
68
|
+
}}
|
|
69
|
+
onCloseTerminal={() => {
|
|
70
|
+
setCloseTerminalCount((c) => c + 1);
|
|
71
|
+
}}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
onSidebarContent?.(sidebarContent);
|
|
77
|
+
return () => onSidebarContent?.(null);
|
|
78
|
+
});
|
|
79
|
+
const [newPromptMode, setNewPromptMode] = useState<NewPromptMode>(null);
|
|
80
|
+
const [isCreatingTerminal, setIsCreatingTerminal] = useState(false);
|
|
81
|
+
const [showTerminal, setShowTerminal] = useState(false);
|
|
82
|
+
|
|
83
|
+
const handleNewPrompt = useCallback(async () => {
|
|
84
|
+
setIsCreatingTerminal(true);
|
|
85
|
+
try {
|
|
86
|
+
const res = await fetch("/api/terminals", {
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: { "Content-Type": "application/json" },
|
|
89
|
+
body: JSON.stringify({
|
|
90
|
+
workspaceMode: "shared",
|
|
91
|
+
agentProvider: "claude-code",
|
|
92
|
+
promptTemplate: "meta-prompt-generator",
|
|
93
|
+
}),
|
|
94
|
+
});
|
|
95
|
+
if (!res.ok) throw new Error("Failed to create terminal");
|
|
96
|
+
const data = (await res.json()) as { terminalId?: string; tentacleId?: string };
|
|
97
|
+
const agentId = (data.terminalId ?? data.tentacleId) as string;
|
|
98
|
+
setNewPromptMode({ terminalId: agentId });
|
|
99
|
+
setShowTerminal(true);
|
|
100
|
+
onTerminalIdChange(agentId);
|
|
101
|
+
} catch {
|
|
102
|
+
// Silently fail — the user can retry
|
|
103
|
+
} finally {
|
|
104
|
+
setIsCreatingTerminal(false);
|
|
105
|
+
}
|
|
106
|
+
}, [onTerminalIdChange]);
|
|
107
|
+
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (newPromptRequestCount > 0) {
|
|
110
|
+
void handleNewPrompt();
|
|
111
|
+
}
|
|
112
|
+
}, [newPromptRequestCount, handleNewPrompt]);
|
|
113
|
+
|
|
114
|
+
// When a prompt is selected from the sidebar, switch away from terminal view
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (selectedPrompt) {
|
|
117
|
+
setShowTerminal(false);
|
|
118
|
+
}
|
|
119
|
+
}, [selectedPrompt]);
|
|
120
|
+
|
|
121
|
+
// When the sidebar's minimized bar is clicked, restore terminal view
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (restoreTerminalCount > 0) {
|
|
124
|
+
setShowTerminal(true);
|
|
125
|
+
}
|
|
126
|
+
}, [restoreTerminalCount]);
|
|
127
|
+
|
|
128
|
+
// When the sidebar's close button is clicked, destroy the terminal
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (closeTerminalCount > 0) {
|
|
131
|
+
setNewPromptMode(null);
|
|
132
|
+
setShowTerminal(false);
|
|
133
|
+
onTerminalIdChange(null);
|
|
134
|
+
void onRefresh();
|
|
135
|
+
}
|
|
136
|
+
}, [closeTerminalCount, onRefresh, onTerminalIdChange]);
|
|
137
|
+
|
|
138
|
+
const handleBackToLibrary = useCallback(() => {
|
|
139
|
+
setNewPromptMode(null);
|
|
140
|
+
setShowTerminal(false);
|
|
141
|
+
onTerminalIdChange(null);
|
|
142
|
+
void onRefresh();
|
|
143
|
+
}, [onRefresh, onTerminalIdChange]);
|
|
144
|
+
|
|
145
|
+
const showPromptDetail = !showTerminal || !newPromptMode;
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<section className="prompts-view" aria-label="Prompts primary view">
|
|
149
|
+
{/* Terminal — kept mounted when active, hidden via CSS when viewing a prompt */}
|
|
150
|
+
{newPromptMode && (
|
|
151
|
+
<div
|
|
152
|
+
className="prompts-terminal"
|
|
153
|
+
key={newPromptMode.terminalId}
|
|
154
|
+
style={showTerminal ? undefined : { display: "none" }}
|
|
155
|
+
>
|
|
156
|
+
<header className="prompts-terminal-header">
|
|
157
|
+
<button type="button" className="prompts-terminal-back" onClick={handleBackToLibrary}>
|
|
158
|
+
← Back
|
|
159
|
+
</button>
|
|
160
|
+
<span className="prompts-terminal-label">
|
|
161
|
+
<strong>Prompt Engineer</strong>
|
|
162
|
+
</span>
|
|
163
|
+
</header>
|
|
164
|
+
<Terminal
|
|
165
|
+
terminalId={newPromptMode.terminalId}
|
|
166
|
+
terminalLabel="Prompt Engineer"
|
|
167
|
+
hidePromptPicker
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
)}
|
|
171
|
+
|
|
172
|
+
{/* Prompt detail / empty state — shown when terminal is hidden or doesn't exist */}
|
|
173
|
+
{showPromptDetail && (
|
|
174
|
+
<>
|
|
175
|
+
{errorMessage ? <p className="prompts-error">{errorMessage}</p> : null}
|
|
176
|
+
|
|
177
|
+
{isLoadingDetail ? (
|
|
178
|
+
<p className="prompts-empty">Loading prompt...</p>
|
|
179
|
+
) : selectedPrompt ? (
|
|
180
|
+
<div className="prompts-detail">
|
|
181
|
+
<header className="prompts-detail-header">
|
|
182
|
+
<div className="prompts-detail-header-left">
|
|
183
|
+
<h3 className="prompts-detail-name">{selectedPrompt.name}</h3>
|
|
184
|
+
<span className="prompts-detail-source-badge" data-source={selectedPrompt.source}>
|
|
185
|
+
{selectedPrompt.source === "user" ? "User" : "Built-in"}
|
|
186
|
+
</span>
|
|
187
|
+
</div>
|
|
188
|
+
{selectedPrompt.source === "user" && (
|
|
189
|
+
<div className="prompts-detail-header-actions">
|
|
190
|
+
{isEditing ? (
|
|
191
|
+
<>
|
|
192
|
+
<ActionButton
|
|
193
|
+
onClick={() => {
|
|
194
|
+
void onSubmitEdit();
|
|
195
|
+
}}
|
|
196
|
+
>
|
|
197
|
+
Save
|
|
198
|
+
</ActionButton>
|
|
199
|
+
<ActionButton onClick={onCancelEditing}>Cancel</ActionButton>
|
|
200
|
+
</>
|
|
201
|
+
) : (
|
|
202
|
+
<>
|
|
203
|
+
<ActionButton onClick={onStartEditing}>Edit</ActionButton>
|
|
204
|
+
<ActionButton
|
|
205
|
+
onClick={() => {
|
|
206
|
+
void onDelete();
|
|
207
|
+
}}
|
|
208
|
+
>
|
|
209
|
+
Delete
|
|
210
|
+
</ActionButton>
|
|
211
|
+
</>
|
|
212
|
+
)}
|
|
213
|
+
</div>
|
|
214
|
+
)}
|
|
215
|
+
</header>
|
|
216
|
+
|
|
217
|
+
{isEditing ? (
|
|
218
|
+
<textarea
|
|
219
|
+
className="prompts-edit-area"
|
|
220
|
+
value={editDraft}
|
|
221
|
+
onChange={(e) => {
|
|
222
|
+
onSetEditDraft(e.target.value);
|
|
223
|
+
}}
|
|
224
|
+
spellCheck={false}
|
|
225
|
+
/>
|
|
226
|
+
) : (
|
|
227
|
+
<div className="prompts-content">
|
|
228
|
+
<MarkdownContent content={selectedPrompt.content} />
|
|
229
|
+
</div>
|
|
230
|
+
)}
|
|
231
|
+
</div>
|
|
232
|
+
) : (
|
|
233
|
+
<div className="prompts-empty-state">
|
|
234
|
+
<p className="prompts-empty">
|
|
235
|
+
Select a prompt from the sidebar, or create a new one.
|
|
236
|
+
</p>
|
|
237
|
+
</div>
|
|
238
|
+
)}
|
|
239
|
+
</>
|
|
240
|
+
)}
|
|
241
|
+
</section>
|
|
242
|
+
);
|
|
243
|
+
};
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { GITHUB_SPARKLINE_HEIGHT, GITHUB_SPARKLINE_WIDTH } from "../app/constants";
|
|
4
|
+
import type { UsageChartData } from "../app/hooks/useUsageHeatmapPolling";
|
|
5
|
+
import type { ClaudeUsageSnapshot } from "../app/types";
|
|
6
|
+
import { OctopusGlyph } from "./EmptyOctopus";
|
|
7
|
+
|
|
8
|
+
type RuntimeStatusStripProps = {
|
|
9
|
+
sparklinePoints: string;
|
|
10
|
+
usageData: UsageChartData | null;
|
|
11
|
+
claudeUsage: ClaudeUsageSnapshot | null;
|
|
12
|
+
isRefreshingClaudeUsage?: boolean;
|
|
13
|
+
onRefreshClaudeUsage?: () => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const MINI_USAGE_WIDTH = 160;
|
|
17
|
+
const MINI_USAGE_HEIGHT = 28;
|
|
18
|
+
const MINI_BAR_GAP = 1;
|
|
19
|
+
|
|
20
|
+
type MiniBar = { x: number; y: number; width: number; height: number };
|
|
21
|
+
|
|
22
|
+
const buildUsageBars = (data: UsageChartData): MiniBar[] => {
|
|
23
|
+
const days = Array.isArray(data.days) ? data.days.slice(-30) : [];
|
|
24
|
+
if (days.length === 0) return [];
|
|
25
|
+
|
|
26
|
+
const totals = days.map((day) => (typeof day.totalTokens === "number" ? day.totalTokens : 0));
|
|
27
|
+
const max = Math.max(...totals, 1);
|
|
28
|
+
const barSlot = MINI_USAGE_WIDTH / days.length;
|
|
29
|
+
const barWidth = Math.max(1, barSlot - MINI_BAR_GAP);
|
|
30
|
+
|
|
31
|
+
return days.map((day, index) => {
|
|
32
|
+
const totalTokens = typeof day.totalTokens === "number" ? day.totalTokens : 0;
|
|
33
|
+
const h = Math.max(0.5, (totalTokens / max) * (MINI_USAGE_HEIGHT - 2));
|
|
34
|
+
return {
|
|
35
|
+
x: index * barSlot,
|
|
36
|
+
y: MINI_USAGE_HEIGHT - h,
|
|
37
|
+
width: barWidth,
|
|
38
|
+
height: h,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const pct = (value: number | null | undefined, loading?: boolean): string => {
|
|
44
|
+
if (loading) return "···";
|
|
45
|
+
return value == null ? "NA" : `${Math.round(value)}%`;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const usageState = (
|
|
49
|
+
claudeUsage: ClaudeUsageSnapshot | null,
|
|
50
|
+
): {
|
|
51
|
+
label: string;
|
|
52
|
+
loading: boolean;
|
|
53
|
+
sessionPercent: number | null | undefined;
|
|
54
|
+
weekPercent: number | null | undefined;
|
|
55
|
+
message?: string;
|
|
56
|
+
} => {
|
|
57
|
+
if (claudeUsage === null) {
|
|
58
|
+
return {
|
|
59
|
+
label: "Session",
|
|
60
|
+
loading: true,
|
|
61
|
+
sessionPercent: 0,
|
|
62
|
+
weekPercent: 0,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const label = claudeUsage.source === "oauth-api" ? "5h" : "Session";
|
|
67
|
+
if (claudeUsage.status === "ok") {
|
|
68
|
+
return {
|
|
69
|
+
label,
|
|
70
|
+
loading: false,
|
|
71
|
+
sessionPercent: claudeUsage.primaryUsedPercent,
|
|
72
|
+
weekPercent: claudeUsage.secondaryUsedPercent,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
label,
|
|
78
|
+
loading: false,
|
|
79
|
+
sessionPercent: null,
|
|
80
|
+
weekPercent: null,
|
|
81
|
+
message: claudeUsage.message ?? "Claude usage unavailable",
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const UsageRail = ({
|
|
86
|
+
label,
|
|
87
|
+
percent,
|
|
88
|
+
loading,
|
|
89
|
+
title,
|
|
90
|
+
}: {
|
|
91
|
+
label: string;
|
|
92
|
+
percent: number | null | undefined;
|
|
93
|
+
loading?: boolean;
|
|
94
|
+
title?: string;
|
|
95
|
+
}) => {
|
|
96
|
+
const [tooltip, setTooltip] = useState<{ x: number; y: number } | null>(null);
|
|
97
|
+
|
|
98
|
+
const showTooltip = (clientX: number, clientY: number) => {
|
|
99
|
+
if (!title) return;
|
|
100
|
+
setTooltip({ x: clientX, y: clientY });
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<div
|
|
105
|
+
className="console-status-usage-row"
|
|
106
|
+
data-has-tooltip={title ? "true" : undefined}
|
|
107
|
+
tabIndex={title ? 0 : -1}
|
|
108
|
+
onMouseEnter={(event) => showTooltip(event.clientX, event.clientY)}
|
|
109
|
+
onMouseMove={(event) => showTooltip(event.clientX, event.clientY)}
|
|
110
|
+
onMouseLeave={() => setTooltip(null)}
|
|
111
|
+
onBlur={() => setTooltip(null)}
|
|
112
|
+
onFocus={(event) => {
|
|
113
|
+
if (!title) return;
|
|
114
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
115
|
+
setTooltip({ x: rect.left + 24, y: rect.bottom + 8 });
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
<span className="console-status-usage-row-meta">
|
|
119
|
+
<span className="console-status-usage-row-label">{label}</span>
|
|
120
|
+
<span className="console-status-usage-row-value">{pct(percent, loading)}</span>
|
|
121
|
+
</span>
|
|
122
|
+
<span className="console-status-usage-rail">
|
|
123
|
+
<span
|
|
124
|
+
className="console-status-usage-rail-fill"
|
|
125
|
+
style={{ width: `${Math.min(100, percent ?? 0)}%` }}
|
|
126
|
+
/>
|
|
127
|
+
</span>
|
|
128
|
+
{title && tooltip ? (
|
|
129
|
+
<span
|
|
130
|
+
className="console-status-usage-tooltip"
|
|
131
|
+
style={{
|
|
132
|
+
left: `${Math.max(8, tooltip.x - 260)}px`,
|
|
133
|
+
top: `${Math.min(window.innerHeight - 80, tooltip.y + 14)}px`,
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
{title}
|
|
137
|
+
</span>
|
|
138
|
+
) : null}
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const RuntimeStatusStrip = ({
|
|
144
|
+
sparklinePoints,
|
|
145
|
+
usageData,
|
|
146
|
+
claudeUsage,
|
|
147
|
+
isRefreshingClaudeUsage = false,
|
|
148
|
+
onRefreshClaudeUsage,
|
|
149
|
+
}: RuntimeStatusStripProps) => {
|
|
150
|
+
const usageBars = useMemo(() => (usageData ? buildUsageBars(usageData) : []), [usageData]);
|
|
151
|
+
const claudeUsageState = usageState(claudeUsage);
|
|
152
|
+
const [showRefreshSpin, setShowRefreshSpin] = useState(false);
|
|
153
|
+
const refreshStartedAtRef = useRef<number | null>(null);
|
|
154
|
+
const refreshHideTimerRef = useRef<number | null>(null);
|
|
155
|
+
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
return () => {
|
|
158
|
+
if (refreshHideTimerRef.current !== null) {
|
|
159
|
+
window.clearTimeout(refreshHideTimerRef.current);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}, []);
|
|
163
|
+
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (isRefreshingClaudeUsage) {
|
|
166
|
+
if (refreshHideTimerRef.current !== null) {
|
|
167
|
+
window.clearTimeout(refreshHideTimerRef.current);
|
|
168
|
+
refreshHideTimerRef.current = null;
|
|
169
|
+
}
|
|
170
|
+
refreshStartedAtRef.current = Date.now();
|
|
171
|
+
setShowRefreshSpin(true);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (refreshStartedAtRef.current === null) {
|
|
176
|
+
setShowRefreshSpin(false);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const elapsedMs = Date.now() - refreshStartedAtRef.current;
|
|
181
|
+
const remainingMs = Math.max(0, 450 - elapsedMs);
|
|
182
|
+
refreshHideTimerRef.current = window.setTimeout(() => {
|
|
183
|
+
setShowRefreshSpin(false);
|
|
184
|
+
refreshStartedAtRef.current = null;
|
|
185
|
+
refreshHideTimerRef.current = null;
|
|
186
|
+
}, remainingMs);
|
|
187
|
+
}, [isRefreshingClaudeUsage]);
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<section className="console-status-strip" aria-label="Runtime status strip">
|
|
191
|
+
<div className="console-status-main">
|
|
192
|
+
<OctopusGlyph
|
|
193
|
+
className="console-status-octopus-icon"
|
|
194
|
+
animation="sway"
|
|
195
|
+
expression="normal"
|
|
196
|
+
scale={2}
|
|
197
|
+
/>
|
|
198
|
+
<span className="console-status-brand">OCTOGENT</span>
|
|
199
|
+
</div>
|
|
200
|
+
<div className="console-status-charts">
|
|
201
|
+
<div className="console-status-sparkline" aria-label="Commits per day over last 30 days">
|
|
202
|
+
<div className="console-status-sparkline-chart">
|
|
203
|
+
<svg
|
|
204
|
+
viewBox={`0 0 ${GITHUB_SPARKLINE_WIDTH} ${GITHUB_SPARKLINE_HEIGHT}`}
|
|
205
|
+
role="presentation"
|
|
206
|
+
>
|
|
207
|
+
<polyline points={sparklinePoints} />
|
|
208
|
+
</svg>
|
|
209
|
+
</div>
|
|
210
|
+
<span className="console-status-sparkline-label">COMMITS/DAY · LAST 30 DAYS</span>
|
|
211
|
+
</div>
|
|
212
|
+
<div className="console-status-usage-mini" aria-label="Claude token usage last 30 days">
|
|
213
|
+
{usageBars.length > 0 ? (
|
|
214
|
+
<>
|
|
215
|
+
<div className="console-status-usage-mini-chart">
|
|
216
|
+
<svg viewBox={`0 0 ${MINI_USAGE_WIDTH} ${MINI_USAGE_HEIGHT}`} role="presentation">
|
|
217
|
+
{usageBars.map((bar, index) => (
|
|
218
|
+
<rect
|
|
219
|
+
key={`${index}-${bar.x}-${bar.height}`}
|
|
220
|
+
x={bar.x}
|
|
221
|
+
y={bar.y}
|
|
222
|
+
width={bar.width}
|
|
223
|
+
height={bar.height}
|
|
224
|
+
rx={0.5}
|
|
225
|
+
/>
|
|
226
|
+
))}
|
|
227
|
+
</svg>
|
|
228
|
+
</div>
|
|
229
|
+
<span className="console-status-sparkline-label">
|
|
230
|
+
CLAUDE TOKENS/DAY · LAST 30 DAYS
|
|
231
|
+
</span>
|
|
232
|
+
</>
|
|
233
|
+
) : (
|
|
234
|
+
<span className="console-status-sparkline-label">CLAUDE USAGE —</span>
|
|
235
|
+
)}
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
<div className="console-status-claude-usage" aria-label="Claude usage limits">
|
|
239
|
+
{onRefreshClaudeUsage && (
|
|
240
|
+
<button
|
|
241
|
+
type="button"
|
|
242
|
+
className="console-status-claude-usage-refresh"
|
|
243
|
+
onClick={onRefreshClaudeUsage}
|
|
244
|
+
aria-label="Refresh Claude usage"
|
|
245
|
+
title="Refresh Claude usage"
|
|
246
|
+
data-refreshing={showRefreshSpin ? "true" : "false"}
|
|
247
|
+
>
|
|
248
|
+
↻
|
|
249
|
+
</button>
|
|
250
|
+
)}
|
|
251
|
+
<span className="console-status-claude-usage-title">
|
|
252
|
+
CLAUDE
|
|
253
|
+
<br />
|
|
254
|
+
USAGE
|
|
255
|
+
</span>
|
|
256
|
+
<div className="console-status-claude-usage-bars">
|
|
257
|
+
<UsageRail
|
|
258
|
+
label={claudeUsageState.label}
|
|
259
|
+
percent={claudeUsageState.sessionPercent}
|
|
260
|
+
loading={claudeUsageState.loading}
|
|
261
|
+
{...(claudeUsageState.message ? { title: claudeUsageState.message } : {})}
|
|
262
|
+
/>
|
|
263
|
+
<UsageRail
|
|
264
|
+
label="Week (all)"
|
|
265
|
+
percent={claudeUsageState.weekPercent}
|
|
266
|
+
loading={claudeUsageState.loading}
|
|
267
|
+
{...(claudeUsageState.message ? { title: claudeUsageState.message } : {})}
|
|
268
|
+
/>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
</section>
|
|
272
|
+
);
|
|
273
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TERMINAL_COMPLETION_SOUND_OPTIONS,
|
|
3
|
+
type TerminalCompletionSoundId,
|
|
4
|
+
} from "../app/notificationSounds";
|
|
5
|
+
import { ActionButton } from "./ui/ActionButton";
|
|
6
|
+
import { SettingsToggle } from "./ui/SettingsToggle";
|
|
7
|
+
|
|
8
|
+
type SettingsPrimaryViewProps = {
|
|
9
|
+
terminalCompletionSound: TerminalCompletionSoundId;
|
|
10
|
+
isRuntimeStatusStripVisible: boolean;
|
|
11
|
+
isMonitorVisible: boolean;
|
|
12
|
+
onTerminalCompletionSoundChange: (soundId: TerminalCompletionSoundId) => void;
|
|
13
|
+
onPreviewTerminalCompletionSound: (soundId: TerminalCompletionSoundId) => void;
|
|
14
|
+
onRuntimeStatusStripVisibilityChange: (visible: boolean) => void;
|
|
15
|
+
onMonitorVisibilityChange: (visible: boolean) => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const SettingsPrimaryView = ({
|
|
19
|
+
terminalCompletionSound,
|
|
20
|
+
isRuntimeStatusStripVisible,
|
|
21
|
+
isMonitorVisible,
|
|
22
|
+
onTerminalCompletionSoundChange,
|
|
23
|
+
onPreviewTerminalCompletionSound,
|
|
24
|
+
onRuntimeStatusStripVisibilityChange,
|
|
25
|
+
onMonitorVisibilityChange,
|
|
26
|
+
}: SettingsPrimaryViewProps) => (
|
|
27
|
+
<section className="settings-view" aria-label="Settings primary view">
|
|
28
|
+
<section className="settings-panel" aria-label="Completion notification settings">
|
|
29
|
+
<header className="settings-panel-header">
|
|
30
|
+
<h2>Tentacle completion sound</h2>
|
|
31
|
+
<p>Play a notification when a tentacle moves from processing to idle.</p>
|
|
32
|
+
</header>
|
|
33
|
+
|
|
34
|
+
<div className="settings-sound-picker">
|
|
35
|
+
{TERMINAL_COMPLETION_SOUND_OPTIONS.map((option) => (
|
|
36
|
+
<button
|
|
37
|
+
aria-pressed={terminalCompletionSound === option.id}
|
|
38
|
+
className="settings-sound-option"
|
|
39
|
+
data-active={terminalCompletionSound === option.id ? "true" : "false"}
|
|
40
|
+
key={option.id}
|
|
41
|
+
onClick={() => {
|
|
42
|
+
onTerminalCompletionSoundChange(option.id);
|
|
43
|
+
onPreviewTerminalCompletionSound(option.id);
|
|
44
|
+
}}
|
|
45
|
+
type="button"
|
|
46
|
+
>
|
|
47
|
+
<span className="settings-sound-option-label">{option.label}</span>
|
|
48
|
+
<span className="settings-sound-option-description">{option.description}</span>
|
|
49
|
+
</button>
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div className="settings-panel-actions">
|
|
54
|
+
<ActionButton
|
|
55
|
+
aria-label="Preview selected completion sound"
|
|
56
|
+
className="settings-sound-preview"
|
|
57
|
+
onClick={() => {
|
|
58
|
+
onPreviewTerminalCompletionSound(terminalCompletionSound);
|
|
59
|
+
}}
|
|
60
|
+
size="dense"
|
|
61
|
+
variant="accent"
|
|
62
|
+
>
|
|
63
|
+
Preview
|
|
64
|
+
</ActionButton>
|
|
65
|
+
<span className="settings-saved-pill">Saved to workspace</span>
|
|
66
|
+
</div>
|
|
67
|
+
</section>
|
|
68
|
+
<section className="settings-panel" aria-label="Workspace surface visibility settings">
|
|
69
|
+
<header className="settings-panel-header">
|
|
70
|
+
<h2>Workspace surface visibility</h2>
|
|
71
|
+
<p>Enable or disable monitor surfaces in the main workspace shell.</p>
|
|
72
|
+
</header>
|
|
73
|
+
|
|
74
|
+
<div className="settings-toggle-grid">
|
|
75
|
+
<SettingsToggle
|
|
76
|
+
label="X Monitor"
|
|
77
|
+
description="Auto-fetch X feed and show monitor tab"
|
|
78
|
+
ariaLabel="Enable X Monitor"
|
|
79
|
+
checked={isMonitorVisible}
|
|
80
|
+
onChange={onMonitorVisibilityChange}
|
|
81
|
+
/>
|
|
82
|
+
<SettingsToggle
|
|
83
|
+
label="Runtime status strip"
|
|
84
|
+
description="Top console status strip metrics"
|
|
85
|
+
ariaLabel="Show runtime status strip"
|
|
86
|
+
checked={isRuntimeStatusStripVisible}
|
|
87
|
+
onChange={onRuntimeStatusStripVisibilityChange}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</section>
|
|
91
|
+
</section>
|
|
92
|
+
);
|