@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,124 @@
|
|
|
1
|
+
import type { PendingDeleteTerminal } from "../app/hooks/useTerminalMutations";
|
|
2
|
+
import type {
|
|
3
|
+
TentacleGitStatusSnapshot,
|
|
4
|
+
TentaclePullRequestSnapshot,
|
|
5
|
+
TerminalView,
|
|
6
|
+
} from "../app/types";
|
|
7
|
+
import { DeleteTentacleDialog } from "./DeleteTentacleDialog";
|
|
8
|
+
import { TentacleGitActionsDialog } from "./TentacleGitActionsDialog";
|
|
9
|
+
|
|
10
|
+
type SidebarActionPanelProps = {
|
|
11
|
+
pendingDeleteTerminal: PendingDeleteTerminal | null;
|
|
12
|
+
isDeletingTerminalId: string | null;
|
|
13
|
+
clearPendingDeleteTerminal: () => void;
|
|
14
|
+
confirmDeleteTerminal: () => Promise<void>;
|
|
15
|
+
openGitTentacleId: string | null;
|
|
16
|
+
columns: TerminalView;
|
|
17
|
+
openGitTentacleStatus: TentacleGitStatusSnapshot | null;
|
|
18
|
+
openGitTentaclePullRequest: TentaclePullRequestSnapshot | null;
|
|
19
|
+
gitCommitMessageDraft: string;
|
|
20
|
+
gitDialogError: string | null;
|
|
21
|
+
isGitDialogLoading: boolean;
|
|
22
|
+
isGitDialogMutating: boolean;
|
|
23
|
+
setGitCommitMessageDraft: (value: string) => void;
|
|
24
|
+
closeTentacleGitActions: () => void;
|
|
25
|
+
commitTentacleChanges: () => Promise<void>;
|
|
26
|
+
commitAndPushTentacleBranch: () => Promise<void>;
|
|
27
|
+
pushTentacleBranch: () => Promise<void>;
|
|
28
|
+
syncTentacleBranch: () => Promise<void>;
|
|
29
|
+
mergeTentaclePullRequest: () => Promise<void>;
|
|
30
|
+
requestDeleteTerminal: (
|
|
31
|
+
tentacleId: string,
|
|
32
|
+
tentacleName: string,
|
|
33
|
+
options: {
|
|
34
|
+
workspaceMode: "shared" | "worktree";
|
|
35
|
+
intent: "delete-terminal" | "cleanup-worktree";
|
|
36
|
+
},
|
|
37
|
+
) => void;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const SidebarActionPanel = ({
|
|
41
|
+
pendingDeleteTerminal,
|
|
42
|
+
isDeletingTerminalId,
|
|
43
|
+
clearPendingDeleteTerminal,
|
|
44
|
+
confirmDeleteTerminal,
|
|
45
|
+
openGitTentacleId,
|
|
46
|
+
columns,
|
|
47
|
+
openGitTentacleStatus,
|
|
48
|
+
openGitTentaclePullRequest,
|
|
49
|
+
gitCommitMessageDraft,
|
|
50
|
+
gitDialogError,
|
|
51
|
+
isGitDialogLoading,
|
|
52
|
+
isGitDialogMutating,
|
|
53
|
+
setGitCommitMessageDraft,
|
|
54
|
+
closeTentacleGitActions,
|
|
55
|
+
commitTentacleChanges,
|
|
56
|
+
commitAndPushTentacleBranch,
|
|
57
|
+
pushTentacleBranch,
|
|
58
|
+
syncTentacleBranch,
|
|
59
|
+
mergeTentaclePullRequest,
|
|
60
|
+
requestDeleteTerminal,
|
|
61
|
+
}: SidebarActionPanelProps) => {
|
|
62
|
+
const openGitTentacleTerminal =
|
|
63
|
+
openGitTentacleId !== null
|
|
64
|
+
? columns.find((terminal) => terminal.tentacleId === openGitTentacleId)
|
|
65
|
+
: null;
|
|
66
|
+
|
|
67
|
+
if (pendingDeleteTerminal) {
|
|
68
|
+
return (
|
|
69
|
+
<DeleteTentacleDialog
|
|
70
|
+
isDeletingTerminalId={isDeletingTerminalId}
|
|
71
|
+
onCancel={clearPendingDeleteTerminal}
|
|
72
|
+
onConfirmDelete={() => {
|
|
73
|
+
void confirmDeleteTerminal();
|
|
74
|
+
}}
|
|
75
|
+
pendingDeleteTerminal={pendingDeleteTerminal}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (openGitTentacleTerminal && openGitTentacleTerminal.workspaceMode === "worktree") {
|
|
81
|
+
return (
|
|
82
|
+
<TentacleGitActionsDialog
|
|
83
|
+
errorMessage={gitDialogError}
|
|
84
|
+
gitCommitMessage={gitCommitMessageDraft}
|
|
85
|
+
gitPullRequest={openGitTentaclePullRequest}
|
|
86
|
+
gitStatus={openGitTentacleStatus}
|
|
87
|
+
isLoading={isGitDialogLoading}
|
|
88
|
+
isMutating={isGitDialogMutating}
|
|
89
|
+
onClose={closeTentacleGitActions}
|
|
90
|
+
onCommit={() => {
|
|
91
|
+
void commitTentacleChanges();
|
|
92
|
+
}}
|
|
93
|
+
onCommitAndPush={() => {
|
|
94
|
+
void commitAndPushTentacleBranch();
|
|
95
|
+
}}
|
|
96
|
+
onCommitMessageChange={setGitCommitMessageDraft}
|
|
97
|
+
onMergePullRequest={() => {
|
|
98
|
+
void mergeTentaclePullRequest();
|
|
99
|
+
}}
|
|
100
|
+
onPush={() => {
|
|
101
|
+
void pushTentacleBranch();
|
|
102
|
+
}}
|
|
103
|
+
onSync={() => {
|
|
104
|
+
void syncTentacleBranch();
|
|
105
|
+
}}
|
|
106
|
+
onCleanupWorktree={() => {
|
|
107
|
+
requestDeleteTerminal(
|
|
108
|
+
openGitTentacleTerminal.terminalId,
|
|
109
|
+
openGitTentacleTerminal.tentacleName ?? openGitTentacleTerminal.tentacleId,
|
|
110
|
+
{
|
|
111
|
+
workspaceMode: openGitTentacleTerminal.workspaceMode ?? "shared",
|
|
112
|
+
intent: "cleanup-worktree",
|
|
113
|
+
},
|
|
114
|
+
);
|
|
115
|
+
closeTentacleGitActions();
|
|
116
|
+
}}
|
|
117
|
+
tentacleId={openGitTentacleTerminal.tentacleId}
|
|
118
|
+
tentacleName={openGitTentacleTerminal.tentacleName ?? openGitTentacleTerminal.tentacleId}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return null;
|
|
124
|
+
};
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import type { ConversationSearchHit, ConversationSessionSummary } from "../app/types";
|
|
4
|
+
|
|
5
|
+
const getSessionTitle = (session: ConversationSessionSummary): string => {
|
|
6
|
+
const preview = session.firstUserTurnPreview;
|
|
7
|
+
if (!preview) return session.sessionId;
|
|
8
|
+
const words = preview.split(/\s+/).slice(0, 8);
|
|
9
|
+
const title = words.join(" ");
|
|
10
|
+
return title.length < preview.length ? `${title}...` : title;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getSessionSortTimestamp = (session: ConversationSessionSummary): number => {
|
|
14
|
+
const raw = session.lastEventAt ?? session.endedAt ?? session.startedAt;
|
|
15
|
+
if (!raw) return 0;
|
|
16
|
+
const parsed = Date.parse(raw);
|
|
17
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type SidebarConversationsListProps = {
|
|
21
|
+
sessions: ConversationSessionSummary[];
|
|
22
|
+
selectedSessionId: string | null;
|
|
23
|
+
isLoadingSessions: boolean;
|
|
24
|
+
isSearching: boolean;
|
|
25
|
+
searchQuery: string;
|
|
26
|
+
searchHits: ConversationSearchHit[];
|
|
27
|
+
onSelectSession: (sessionId: string) => void;
|
|
28
|
+
onRefresh: () => void;
|
|
29
|
+
onClearAll: () => void;
|
|
30
|
+
onSearch: (query: string) => void;
|
|
31
|
+
onClearSearch: () => void;
|
|
32
|
+
onNavigateToHit: (hit: ConversationSearchHit) => void;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const SidebarConversationsList = ({
|
|
36
|
+
sessions,
|
|
37
|
+
selectedSessionId,
|
|
38
|
+
isLoadingSessions,
|
|
39
|
+
isSearching,
|
|
40
|
+
searchQuery,
|
|
41
|
+
searchHits,
|
|
42
|
+
onSelectSession,
|
|
43
|
+
onRefresh,
|
|
44
|
+
onClearAll,
|
|
45
|
+
onSearch,
|
|
46
|
+
onClearSearch,
|
|
47
|
+
onNavigateToHit,
|
|
48
|
+
}: SidebarConversationsListProps) => {
|
|
49
|
+
const [inputValue, setInputValue] = useState("");
|
|
50
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
51
|
+
const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
52
|
+
const onSearchRef = useRef(onSearch);
|
|
53
|
+
const onClearSearchRef = useRef(onClearSearch);
|
|
54
|
+
onSearchRef.current = onSearch;
|
|
55
|
+
onClearSearchRef.current = onClearSearch;
|
|
56
|
+
|
|
57
|
+
const sortedSessions = useMemo(
|
|
58
|
+
() => [...sessions].sort((a, b) => getSessionSortTimestamp(b) - getSessionSortTimestamp(a)),
|
|
59
|
+
[sessions],
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// Live search: debounce input changes and trigger search after 2+ chars
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (debounceRef.current) {
|
|
65
|
+
clearTimeout(debounceRef.current);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const trimmed = inputValue.trim();
|
|
69
|
+
if (trimmed.length === 0) {
|
|
70
|
+
onClearSearchRef.current();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (trimmed.length >= 2) {
|
|
75
|
+
debounceRef.current = setTimeout(() => {
|
|
76
|
+
onSearchRef.current(trimmed);
|
|
77
|
+
}, 280);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return () => {
|
|
81
|
+
if (debounceRef.current) {
|
|
82
|
+
clearTimeout(debounceRef.current);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}, [inputValue]);
|
|
86
|
+
|
|
87
|
+
const handleSearchSubmit = useCallback(
|
|
88
|
+
(e: React.FormEvent) => {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
const trimmed = inputValue.trim();
|
|
91
|
+
if (trimmed.length > 0) {
|
|
92
|
+
if (debounceRef.current) {
|
|
93
|
+
clearTimeout(debounceRef.current);
|
|
94
|
+
}
|
|
95
|
+
onSearch(trimmed);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
[inputValue, onSearch],
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const handleClearSearch = useCallback(() => {
|
|
102
|
+
setInputValue("");
|
|
103
|
+
onClearSearch();
|
|
104
|
+
inputRef.current?.focus();
|
|
105
|
+
}, [onClearSearch]);
|
|
106
|
+
|
|
107
|
+
const handleKeyDown = useCallback(
|
|
108
|
+
(e: React.KeyboardEvent) => {
|
|
109
|
+
if (e.key === "Escape") {
|
|
110
|
+
handleClearSearch();
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
[handleClearSearch],
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const isShowingResults = searchQuery.length > 0;
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<section className="active-agents-section" aria-label="Sidebar section Conversations">
|
|
120
|
+
<div className="sidebar-conversations-toolbar">
|
|
121
|
+
<button
|
|
122
|
+
aria-label="Refresh conversations"
|
|
123
|
+
className="sidebar-conversations-icon-btn"
|
|
124
|
+
disabled={isLoadingSessions}
|
|
125
|
+
onClick={onRefresh}
|
|
126
|
+
type="button"
|
|
127
|
+
>
|
|
128
|
+
<svg
|
|
129
|
+
aria-hidden="true"
|
|
130
|
+
focusable="false"
|
|
131
|
+
viewBox="0 0 16 16"
|
|
132
|
+
fill="none"
|
|
133
|
+
stroke="currentColor"
|
|
134
|
+
strokeWidth="1.6"
|
|
135
|
+
strokeLinecap="round"
|
|
136
|
+
strokeLinejoin="round"
|
|
137
|
+
>
|
|
138
|
+
<path d="M2.5 8a5.5 5.5 0 0 1 9.3-3.95L13.5 5.5" />
|
|
139
|
+
<path d="M13.5 2.5v3h-3" />
|
|
140
|
+
<path d="M13.5 8a5.5 5.5 0 0 1-9.3 3.95L2.5 10.5" />
|
|
141
|
+
<path d="M2.5 13.5v-3h3" />
|
|
142
|
+
</svg>
|
|
143
|
+
</button>
|
|
144
|
+
<button
|
|
145
|
+
aria-label="Clear all conversations"
|
|
146
|
+
className="sidebar-conversations-icon-btn sidebar-conversations-icon-btn--danger"
|
|
147
|
+
disabled={sessions.length === 0}
|
|
148
|
+
onClick={onClearAll}
|
|
149
|
+
type="button"
|
|
150
|
+
>
|
|
151
|
+
<svg
|
|
152
|
+
aria-hidden="true"
|
|
153
|
+
focusable="false"
|
|
154
|
+
viewBox="0 0 16 16"
|
|
155
|
+
fill="none"
|
|
156
|
+
stroke="currentColor"
|
|
157
|
+
strokeWidth="1.6"
|
|
158
|
+
strokeLinecap="round"
|
|
159
|
+
strokeLinejoin="round"
|
|
160
|
+
>
|
|
161
|
+
<path d="M3 4h10" />
|
|
162
|
+
<path d="M6 4V3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1" />
|
|
163
|
+
<path d="M4.5 4l.5 9a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1l.5-9" />
|
|
164
|
+
<path d="M6.5 7v4" />
|
|
165
|
+
<path d="M9.5 7v4" />
|
|
166
|
+
</svg>
|
|
167
|
+
</button>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<form className="sidebar-conversations-search" onSubmit={handleSearchSubmit}>
|
|
171
|
+
<div className="sidebar-conversations-search-input-wrap">
|
|
172
|
+
<svg
|
|
173
|
+
aria-hidden="true"
|
|
174
|
+
className="sidebar-conversations-search-icon"
|
|
175
|
+
focusable="false"
|
|
176
|
+
viewBox="0 0 16 16"
|
|
177
|
+
fill="none"
|
|
178
|
+
stroke="currentColor"
|
|
179
|
+
strokeWidth="1.6"
|
|
180
|
+
strokeLinecap="round"
|
|
181
|
+
strokeLinejoin="round"
|
|
182
|
+
>
|
|
183
|
+
<circle cx="7" cy="7" r="4.5" />
|
|
184
|
+
<path d="M10.5 10.5L14 14" />
|
|
185
|
+
</svg>
|
|
186
|
+
<input
|
|
187
|
+
ref={inputRef}
|
|
188
|
+
type="text"
|
|
189
|
+
className="sidebar-conversations-search-input"
|
|
190
|
+
placeholder="Search conversations..."
|
|
191
|
+
value={inputValue}
|
|
192
|
+
onChange={(e) => {
|
|
193
|
+
setInputValue(e.target.value);
|
|
194
|
+
}}
|
|
195
|
+
onKeyDown={handleKeyDown}
|
|
196
|
+
aria-label="Search conversations"
|
|
197
|
+
/>
|
|
198
|
+
{(inputValue.length > 0 || isShowingResults) && (
|
|
199
|
+
<button
|
|
200
|
+
type="button"
|
|
201
|
+
className="sidebar-conversations-search-clear"
|
|
202
|
+
onClick={handleClearSearch}
|
|
203
|
+
aria-label="Clear search"
|
|
204
|
+
>
|
|
205
|
+
<svg
|
|
206
|
+
aria-hidden="true"
|
|
207
|
+
focusable="false"
|
|
208
|
+
viewBox="0 0 16 16"
|
|
209
|
+
fill="none"
|
|
210
|
+
stroke="currentColor"
|
|
211
|
+
strokeWidth="1.8"
|
|
212
|
+
strokeLinecap="round"
|
|
213
|
+
strokeLinejoin="round"
|
|
214
|
+
>
|
|
215
|
+
<path d="M4 4l8 8" />
|
|
216
|
+
<path d="M12 4l-8 8" />
|
|
217
|
+
</svg>
|
|
218
|
+
</button>
|
|
219
|
+
)}
|
|
220
|
+
</div>
|
|
221
|
+
</form>
|
|
222
|
+
|
|
223
|
+
<div className="active-agents-section-panel">
|
|
224
|
+
{isSearching ? (
|
|
225
|
+
<p className="active-agents-status">Searching...</p>
|
|
226
|
+
) : isShowingResults ? (
|
|
227
|
+
searchHits.length === 0 ? (
|
|
228
|
+
<p className="active-agents-status">No results for "{searchQuery}"</p>
|
|
229
|
+
) : (
|
|
230
|
+
<div className="sidebar-search-results">
|
|
231
|
+
<p className="sidebar-search-results-count">
|
|
232
|
+
{searchHits.length} result{searchHits.length !== 1 ? "s" : ""}
|
|
233
|
+
</p>
|
|
234
|
+
<ol className="sidebar-conversations-list">
|
|
235
|
+
{searchHits.map((hit) => (
|
|
236
|
+
<li key={`${hit.sessionId}-${hit.turnId}`}>
|
|
237
|
+
<button
|
|
238
|
+
className="sidebar-conversation-item sidebar-search-hit"
|
|
239
|
+
onClick={() => {
|
|
240
|
+
onNavigateToHit(hit);
|
|
241
|
+
}}
|
|
242
|
+
type="button"
|
|
243
|
+
>
|
|
244
|
+
<span className="sidebar-search-hit-session">{hit.sessionId}</span>
|
|
245
|
+
<span className="sidebar-search-hit-role">{hit.role}</span>
|
|
246
|
+
<span className="sidebar-search-hit-snippet">{hit.snippet}</span>
|
|
247
|
+
</button>
|
|
248
|
+
</li>
|
|
249
|
+
))}
|
|
250
|
+
</ol>
|
|
251
|
+
</div>
|
|
252
|
+
)
|
|
253
|
+
) : sessions.length === 0 ? (
|
|
254
|
+
<p className="active-agents-status">No conversations yet.</p>
|
|
255
|
+
) : (
|
|
256
|
+
<ol className="sidebar-conversations-list">
|
|
257
|
+
{sortedSessions.map((session) => (
|
|
258
|
+
<li key={session.sessionId}>
|
|
259
|
+
<button
|
|
260
|
+
aria-current={session.sessionId === selectedSessionId ? "page" : undefined}
|
|
261
|
+
className="sidebar-conversation-item"
|
|
262
|
+
data-active={session.sessionId === selectedSessionId ? "true" : "false"}
|
|
263
|
+
onClick={() => {
|
|
264
|
+
onSelectSession(session.sessionId);
|
|
265
|
+
}}
|
|
266
|
+
type="button"
|
|
267
|
+
>
|
|
268
|
+
<strong>{getSessionTitle(session)}</strong>
|
|
269
|
+
<span>{`Tentacle ${session.tentacleId ?? "--"}`}</span>
|
|
270
|
+
<span>{`${session.turnCount} turns`}</span>
|
|
271
|
+
</button>
|
|
272
|
+
</li>
|
|
273
|
+
))}
|
|
274
|
+
</ol>
|
|
275
|
+
)}
|
|
276
|
+
</div>
|
|
277
|
+
</section>
|
|
278
|
+
);
|
|
279
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import type { PromptLibraryEntry } from "../app/types";
|
|
4
|
+
|
|
5
|
+
type SidebarPromptsListProps = {
|
|
6
|
+
prompts: PromptLibraryEntry[];
|
|
7
|
+
selectedPromptName: string | null;
|
|
8
|
+
isLoadingPrompts: boolean;
|
|
9
|
+
onSelectPrompt: (name: string) => void;
|
|
10
|
+
onRefresh: () => void;
|
|
11
|
+
onNewPrompt: () => void;
|
|
12
|
+
activeTerminalId: string | null;
|
|
13
|
+
onRestoreTerminal: () => void;
|
|
14
|
+
onCloseTerminal: () => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const SidebarPromptsList = ({
|
|
18
|
+
prompts,
|
|
19
|
+
selectedPromptName,
|
|
20
|
+
isLoadingPrompts,
|
|
21
|
+
onSelectPrompt,
|
|
22
|
+
onRefresh,
|
|
23
|
+
onNewPrompt,
|
|
24
|
+
activeTerminalId,
|
|
25
|
+
onRestoreTerminal,
|
|
26
|
+
onCloseTerminal,
|
|
27
|
+
}: SidebarPromptsListProps) => {
|
|
28
|
+
const userPrompts = useMemo(() => prompts.filter((p) => p.source === "user"), [prompts]);
|
|
29
|
+
const builtinPrompts = useMemo(() => prompts.filter((p) => p.source === "builtin"), [prompts]);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className="sidebar-prompts">
|
|
33
|
+
<div className="sidebar-prompts-toolbar">
|
|
34
|
+
<button type="button" className="sidebar-prompts-new-btn" onClick={onNewPrompt}>
|
|
35
|
+
+ New Prompt
|
|
36
|
+
</button>
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
className="sidebar-prompts-refresh-btn"
|
|
40
|
+
onClick={onRefresh}
|
|
41
|
+
disabled={isLoadingPrompts}
|
|
42
|
+
aria-label="Refresh prompts"
|
|
43
|
+
>
|
|
44
|
+
↻
|
|
45
|
+
</button>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
{isLoadingPrompts && prompts.length === 0 ? (
|
|
49
|
+
<p className="sidebar-prompts-empty">Loading...</p>
|
|
50
|
+
) : prompts.length === 0 ? (
|
|
51
|
+
<p className="sidebar-prompts-empty">No prompts yet</p>
|
|
52
|
+
) : (
|
|
53
|
+
<div className="sidebar-prompts-list">
|
|
54
|
+
{userPrompts.length > 0 && (
|
|
55
|
+
<div className="sidebar-prompts-group">
|
|
56
|
+
<h4 className="sidebar-prompts-group-label">My Prompts</h4>
|
|
57
|
+
{userPrompts.map((p) => (
|
|
58
|
+
<button
|
|
59
|
+
key={p.name}
|
|
60
|
+
type="button"
|
|
61
|
+
className="sidebar-prompts-item"
|
|
62
|
+
data-active={selectedPromptName === p.name ? "true" : undefined}
|
|
63
|
+
onClick={() => {
|
|
64
|
+
onSelectPrompt(p.name);
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
{p.name}.md
|
|
68
|
+
</button>
|
|
69
|
+
))}
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
|
|
73
|
+
{builtinPrompts.length > 0 && (
|
|
74
|
+
<div className="sidebar-prompts-group">
|
|
75
|
+
<h4 className="sidebar-prompts-group-label">Built-in</h4>
|
|
76
|
+
{builtinPrompts.map((p) => (
|
|
77
|
+
<button
|
|
78
|
+
key={p.name}
|
|
79
|
+
type="button"
|
|
80
|
+
className="sidebar-prompts-item"
|
|
81
|
+
data-active={selectedPromptName === p.name ? "true" : undefined}
|
|
82
|
+
onClick={() => {
|
|
83
|
+
onSelectPrompt(p.name);
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{p.name}.md
|
|
87
|
+
</button>
|
|
88
|
+
))}
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
)}
|
|
93
|
+
|
|
94
|
+
{activeTerminalId && (
|
|
95
|
+
<div className="sidebar-prompts-minimized-terminal">
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
className="sidebar-prompts-minimized-terminal-restore"
|
|
99
|
+
onClick={onRestoreTerminal}
|
|
100
|
+
>
|
|
101
|
+
<span className="sidebar-prompts-minimized-terminal-icon">{">_"}</span>
|
|
102
|
+
<span className="sidebar-prompts-minimized-terminal-label">Prompt Engineer</span>
|
|
103
|
+
</button>
|
|
104
|
+
<button
|
|
105
|
+
type="button"
|
|
106
|
+
className="sidebar-prompts-minimized-terminal-close"
|
|
107
|
+
onClick={onCloseTerminal}
|
|
108
|
+
aria-label="Close terminal"
|
|
109
|
+
>
|
|
110
|
+
✕
|
|
111
|
+
</button>
|
|
112
|
+
</div>
|
|
113
|
+
)}
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import type { MonitorFeedSnapshot } from "../app/types";
|
|
4
|
+
|
|
5
|
+
type TelemetryTapeProps = {
|
|
6
|
+
monitorFeed: MonitorFeedSnapshot | null;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type TelemetryItem = {
|
|
10
|
+
key: string;
|
|
11
|
+
sourceIcon: string;
|
|
12
|
+
authorLabel: string;
|
|
13
|
+
snippet: string;
|
|
14
|
+
fullText: string;
|
|
15
|
+
likesLabel: string;
|
|
16
|
+
permalink: string | null;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const MAX_SNIPPET_LENGTH = 54;
|
|
20
|
+
|
|
21
|
+
const normalizePostSnippet = (value: string): string => value.replace(/\s+/g, " ").trim();
|
|
22
|
+
|
|
23
|
+
const truncateSnippet = (value: string): string => {
|
|
24
|
+
if (value.length <= MAX_SNIPPET_LENGTH) {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return `${value.slice(0, MAX_SNIPPET_LENGTH - 1).trimEnd()}…`;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const buildTelemetryItems = (monitorFeed: MonitorFeedSnapshot | null): TelemetryItem[] => {
|
|
32
|
+
const posts = monitorFeed?.posts ?? [];
|
|
33
|
+
if (posts.length === 0) {
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
key: "monitor-waiting",
|
|
37
|
+
sourceIcon: "𝕏",
|
|
38
|
+
authorLabel: "@monitor",
|
|
39
|
+
snippet: "Waiting for X resources...",
|
|
40
|
+
fullText: "Waiting for X resources...",
|
|
41
|
+
likesLabel: "♥ --",
|
|
42
|
+
permalink: null,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return posts.map((post) => {
|
|
48
|
+
const normalizedSnippet = normalizePostSnippet(post.text);
|
|
49
|
+
return {
|
|
50
|
+
key: `${post.source}:${post.id}`,
|
|
51
|
+
sourceIcon: "𝕏",
|
|
52
|
+
authorLabel: `@${post.author}`,
|
|
53
|
+
snippet: truncateSnippet(normalizedSnippet),
|
|
54
|
+
fullText: normalizedSnippet,
|
|
55
|
+
likesLabel: `♥ ${Math.round(post.likeCount).toLocaleString("en-US")}`,
|
|
56
|
+
permalink: post.permalink,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const TelemetryTape = ({ monitorFeed }: TelemetryTapeProps) => {
|
|
62
|
+
const telemetryItems = useMemo(() => buildTelemetryItems(monitorFeed), [monitorFeed]);
|
|
63
|
+
const scrollDurationSeconds = Math.max(72, telemetryItems.length * 9);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<section className="console-telemetry-tape" aria-label="Telemetry ticker tape">
|
|
67
|
+
<div
|
|
68
|
+
className="console-telemetry-track"
|
|
69
|
+
style={{ animationDuration: `${scrollDurationSeconds}s` }}
|
|
70
|
+
>
|
|
71
|
+
{[...telemetryItems, ...telemetryItems].map((item, index) =>
|
|
72
|
+
item.permalink ? (
|
|
73
|
+
<a
|
|
74
|
+
className="console-telemetry-item"
|
|
75
|
+
href={item.permalink}
|
|
76
|
+
key={`${item.key}-${index}`}
|
|
77
|
+
rel="noreferrer"
|
|
78
|
+
target="_blank"
|
|
79
|
+
title={item.fullText}
|
|
80
|
+
>
|
|
81
|
+
<span aria-hidden="true" className="console-telemetry-source">
|
|
82
|
+
{item.sourceIcon}
|
|
83
|
+
</span>
|
|
84
|
+
<strong>{item.authorLabel}</strong>
|
|
85
|
+
<span className="console-telemetry-snippet">{item.snippet}</span>
|
|
86
|
+
<span className="console-telemetry-likes">{item.likesLabel}</span>
|
|
87
|
+
</a>
|
|
88
|
+
) : (
|
|
89
|
+
<span
|
|
90
|
+
className="console-telemetry-item"
|
|
91
|
+
key={`${item.key}-${index}`}
|
|
92
|
+
title={item.fullText}
|
|
93
|
+
>
|
|
94
|
+
<span aria-hidden="true" className="console-telemetry-source">
|
|
95
|
+
{item.sourceIcon}
|
|
96
|
+
</span>
|
|
97
|
+
<strong>{item.authorLabel}</strong>
|
|
98
|
+
<span className="console-telemetry-snippet">{item.snippet}</span>
|
|
99
|
+
<span className="console-telemetry-likes">{item.likesLabel}</span>
|
|
100
|
+
</span>
|
|
101
|
+
),
|
|
102
|
+
)}
|
|
103
|
+
</div>
|
|
104
|
+
</section>
|
|
105
|
+
);
|
|
106
|
+
};
|