@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,485 @@
|
|
|
1
|
+
import { Terminal, X } from "lucide-react";
|
|
2
|
+
import { type Ref, useCallback, useMemo, useState } from "react";
|
|
3
|
+
|
|
4
|
+
import type { DeckTentacleSummary, TentacleWorkspaceMode } from "@octogent/core";
|
|
5
|
+
import type { GraphNode } from "../../app/canvas/types";
|
|
6
|
+
import type { ConversationSessionSummary } from "../../app/types";
|
|
7
|
+
import {
|
|
8
|
+
buildDeckTodoAddUrl,
|
|
9
|
+
buildDeckTodoDeleteUrl,
|
|
10
|
+
buildDeckTodoEditUrl,
|
|
11
|
+
buildDeckTodoSolveUrl,
|
|
12
|
+
buildDeckTodoToggleUrl,
|
|
13
|
+
} from "../../runtime/runtimeEndpoints";
|
|
14
|
+
import {
|
|
15
|
+
type OctopusAccessory,
|
|
16
|
+
type OctopusAnimation,
|
|
17
|
+
type OctopusExpression,
|
|
18
|
+
OctopusGlyph,
|
|
19
|
+
} from "../EmptyOctopus";
|
|
20
|
+
|
|
21
|
+
const OCTOPUS_COLORS = [
|
|
22
|
+
"#ff6b2b",
|
|
23
|
+
"#ff2d6b",
|
|
24
|
+
"#00ffaa",
|
|
25
|
+
"#bf5fff",
|
|
26
|
+
"#00c8ff",
|
|
27
|
+
"#ffee00",
|
|
28
|
+
"#39ff14",
|
|
29
|
+
"#ff4df0",
|
|
30
|
+
"#00fff7",
|
|
31
|
+
"#ff9500",
|
|
32
|
+
];
|
|
33
|
+
const ANIMATIONS: OctopusAnimation[] = ["sway", "walk", "jog", "bounce", "float", "swim-up"];
|
|
34
|
+
const EXPRESSIONS: OctopusExpression[] = ["normal", "happy", "angry", "surprised"];
|
|
35
|
+
const ACCESSORIES: OctopusAccessory[] = ["none", "none", "long", "mohawk", "side-sweep", "curly"];
|
|
36
|
+
|
|
37
|
+
function hashStr(str: string): number {
|
|
38
|
+
let h = 0;
|
|
39
|
+
for (let i = 0; i < str.length; i++) {
|
|
40
|
+
h = ((h << 5) - h + str.charCodeAt(i)) | 0;
|
|
41
|
+
}
|
|
42
|
+
return Math.abs(h);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function seededRng(seed: number): () => number {
|
|
46
|
+
let s = seed;
|
|
47
|
+
return () => {
|
|
48
|
+
s = (s * 16807 + 0) % 2147483647;
|
|
49
|
+
return (s - 1) / 2147483646;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function deriveVisuals(tentacle: DeckTentacleSummary) {
|
|
54
|
+
const rng = seededRng(hashStr(tentacle.tentacleId));
|
|
55
|
+
const stored = tentacle.octopus;
|
|
56
|
+
return {
|
|
57
|
+
color:
|
|
58
|
+
tentacle.color ??
|
|
59
|
+
(OCTOPUS_COLORS[hashStr(tentacle.tentacleId) % OCTOPUS_COLORS.length] as string),
|
|
60
|
+
animation:
|
|
61
|
+
(stored?.animation as OctopusAnimation | null) ??
|
|
62
|
+
(ANIMATIONS[Math.floor(rng() * ANIMATIONS.length)] as OctopusAnimation),
|
|
63
|
+
expression:
|
|
64
|
+
(stored?.expression as OctopusExpression | null) ??
|
|
65
|
+
(EXPRESSIONS[Math.floor(rng() * EXPRESSIONS.length)] as OctopusExpression),
|
|
66
|
+
accessory:
|
|
67
|
+
(stored?.accessory as OctopusAccessory | null) ??
|
|
68
|
+
(ACCESSORIES[Math.floor(rng() * ACCESSORIES.length)] as OctopusAccessory),
|
|
69
|
+
hairColor: stored?.hairColor ?? undefined,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type CanvasTentaclePanelProps = {
|
|
74
|
+
node: GraphNode;
|
|
75
|
+
isFocused?: boolean;
|
|
76
|
+
onClose: () => void;
|
|
77
|
+
onFocus?: () => void;
|
|
78
|
+
panelRef?: Ref<HTMLDivElement> | undefined;
|
|
79
|
+
tentacle: DeckTentacleSummary | null;
|
|
80
|
+
sessions: ConversationSessionSummary[];
|
|
81
|
+
onCreateAgent?: ((tentacleId: string) => void) | undefined;
|
|
82
|
+
onSolveTodoItem?: ((tentacleId: string, itemIndex: number) => void) | undefined;
|
|
83
|
+
onSpawnSwarm?: ((tentacleId: string, workspaceMode: TentacleWorkspaceMode) => void) | undefined;
|
|
84
|
+
onNavigateToConversation?: ((sessionId: string) => void) | undefined;
|
|
85
|
+
onRefreshTentacleData?: (() => Promise<void>) | undefined;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const STATUS_LABELS: Record<string, string> = {
|
|
89
|
+
idle: "idle",
|
|
90
|
+
active: "active",
|
|
91
|
+
blocked: "blocked",
|
|
92
|
+
"needs-review": "review",
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const formatTime = (isoString: string | null): string => {
|
|
96
|
+
if (!isoString) return "—";
|
|
97
|
+
const d = new Date(isoString);
|
|
98
|
+
const now = new Date();
|
|
99
|
+
const diffMs = now.getTime() - d.getTime();
|
|
100
|
+
const diffMin = Math.floor(diffMs / 60000);
|
|
101
|
+
if (diffMin < 1) return "just now";
|
|
102
|
+
if (diffMin < 60) return `${diffMin}m ago`;
|
|
103
|
+
const diffHr = Math.floor(diffMin / 60);
|
|
104
|
+
if (diffHr < 24) return `${diffHr}h ago`;
|
|
105
|
+
const diffDay = Math.floor(diffHr / 24);
|
|
106
|
+
return `${diffDay}d ago`;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const CanvasTentaclePanel = ({
|
|
110
|
+
node,
|
|
111
|
+
isFocused,
|
|
112
|
+
onClose,
|
|
113
|
+
onFocus,
|
|
114
|
+
panelRef,
|
|
115
|
+
tentacle,
|
|
116
|
+
sessions,
|
|
117
|
+
onCreateAgent,
|
|
118
|
+
onSolveTodoItem,
|
|
119
|
+
onSpawnSwarm,
|
|
120
|
+
onNavigateToConversation,
|
|
121
|
+
onRefreshTentacleData,
|
|
122
|
+
}: CanvasTentaclePanelProps) => {
|
|
123
|
+
const visuals = useMemo(() => (tentacle ? deriveVisuals(tentacle) : null), [tentacle]);
|
|
124
|
+
const [editingIndex, setEditingIndex] = useState<number | null>(null);
|
|
125
|
+
const [editText, setEditText] = useState("");
|
|
126
|
+
const [addingTodo, setAddingTodo] = useState(false);
|
|
127
|
+
const [addText, setAddText] = useState("");
|
|
128
|
+
const [solvingTodoIndex, setSolvingTodoIndex] = useState<number | null>(null);
|
|
129
|
+
const refreshTentacleData = useCallback(async () => {
|
|
130
|
+
await onRefreshTentacleData?.();
|
|
131
|
+
}, [onRefreshTentacleData]);
|
|
132
|
+
|
|
133
|
+
const handleTodoToggle = useCallback(
|
|
134
|
+
async (itemIndex: number, done: boolean) => {
|
|
135
|
+
try {
|
|
136
|
+
const response = await fetch(buildDeckTodoToggleUrl(node.tentacleId), {
|
|
137
|
+
method: "PATCH",
|
|
138
|
+
headers: { "Content-Type": "application/json" },
|
|
139
|
+
body: JSON.stringify({ itemIndex, done }),
|
|
140
|
+
});
|
|
141
|
+
if (!response.ok) return;
|
|
142
|
+
await refreshTentacleData();
|
|
143
|
+
} catch {
|
|
144
|
+
// silent
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
[node.tentacleId, refreshTentacleData],
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
const handleTodoEdit = useCallback(
|
|
151
|
+
async (itemIndex: number, text: string) => {
|
|
152
|
+
if (text.trim().length === 0) return;
|
|
153
|
+
try {
|
|
154
|
+
const response = await fetch(buildDeckTodoEditUrl(node.tentacleId), {
|
|
155
|
+
method: "PATCH",
|
|
156
|
+
headers: { "Content-Type": "application/json" },
|
|
157
|
+
body: JSON.stringify({ itemIndex, text: text.trim() }),
|
|
158
|
+
});
|
|
159
|
+
if (!response.ok) return;
|
|
160
|
+
setEditingIndex(null);
|
|
161
|
+
await refreshTentacleData();
|
|
162
|
+
} catch {
|
|
163
|
+
// silent
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
[node.tentacleId, refreshTentacleData],
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const handleTodoAdd = useCallback(
|
|
170
|
+
async (text: string) => {
|
|
171
|
+
if (text.trim().length === 0) return;
|
|
172
|
+
try {
|
|
173
|
+
const response = await fetch(buildDeckTodoAddUrl(node.tentacleId), {
|
|
174
|
+
method: "POST",
|
|
175
|
+
headers: { "Content-Type": "application/json" },
|
|
176
|
+
body: JSON.stringify({ text: text.trim() }),
|
|
177
|
+
});
|
|
178
|
+
if (!response.ok) return;
|
|
179
|
+
setAddingTodo(false);
|
|
180
|
+
setAddText("");
|
|
181
|
+
await refreshTentacleData();
|
|
182
|
+
} catch {
|
|
183
|
+
// silent
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
[node.tentacleId, refreshTentacleData],
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
const handleTodoDelete = useCallback(
|
|
190
|
+
async (itemIndex: number) => {
|
|
191
|
+
try {
|
|
192
|
+
const response = await fetch(buildDeckTodoDeleteUrl(node.tentacleId), {
|
|
193
|
+
method: "POST",
|
|
194
|
+
headers: { "Content-Type": "application/json" },
|
|
195
|
+
body: JSON.stringify({ itemIndex }),
|
|
196
|
+
});
|
|
197
|
+
if (!response.ok) return;
|
|
198
|
+
await refreshTentacleData();
|
|
199
|
+
} catch {
|
|
200
|
+
// silent
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
[node.tentacleId, refreshTentacleData],
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
const handleTodoSolve = useCallback(
|
|
207
|
+
async (itemIndex: number) => {
|
|
208
|
+
try {
|
|
209
|
+
setSolvingTodoIndex(itemIndex);
|
|
210
|
+
const response = await fetch(buildDeckTodoSolveUrl(node.tentacleId), {
|
|
211
|
+
method: "POST",
|
|
212
|
+
headers: { "Content-Type": "application/json" },
|
|
213
|
+
body: JSON.stringify({ itemIndex }),
|
|
214
|
+
});
|
|
215
|
+
if (!response.ok) return;
|
|
216
|
+
onSolveTodoItem?.(node.tentacleId, itemIndex);
|
|
217
|
+
} catch {
|
|
218
|
+
// silent
|
|
219
|
+
} finally {
|
|
220
|
+
setSolvingTodoIndex((current) => (current === itemIndex ? null : current));
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
[node.tentacleId, onSolveTodoItem],
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
const progressPct =
|
|
227
|
+
tentacle && tentacle.todoTotal > 0
|
|
228
|
+
? Math.round((tentacle.todoDone / tentacle.todoTotal) * 100)
|
|
229
|
+
: 0;
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<div
|
|
233
|
+
ref={panelRef}
|
|
234
|
+
className={`detail-panel${isFocused ? " detail-panel--focused" : ""}`}
|
|
235
|
+
tabIndex={-1}
|
|
236
|
+
onPointerDown={() => onFocus?.()}
|
|
237
|
+
>
|
|
238
|
+
{/* Header */}
|
|
239
|
+
<div
|
|
240
|
+
className="detail-panel-header"
|
|
241
|
+
style={{
|
|
242
|
+
background: `linear-gradient(180deg, color-mix(in srgb, ${node.color ?? "var(--accent-primary)"} 90%, #ffd89d 10%) 0%, color-mix(in srgb, ${node.color ?? "var(--accent-primary)"} 78%, #d9851c 22%) 100%)`,
|
|
243
|
+
}}
|
|
244
|
+
>
|
|
245
|
+
<span className="detail-title">{tentacle?.displayName ?? node.label}</span>
|
|
246
|
+
{tentacle && (
|
|
247
|
+
<span className="detail-type-badge">
|
|
248
|
+
{STATUS_LABELS[tentacle.status] ?? tentacle.status}
|
|
249
|
+
</span>
|
|
250
|
+
)}
|
|
251
|
+
<button className="detail-close" type="button" onClick={onClose} aria-label="Close panel">
|
|
252
|
+
<X size={14} />
|
|
253
|
+
</button>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
{/* Content */}
|
|
257
|
+
<div className="detail-content">
|
|
258
|
+
{/* Identity: glyph + info side by side */}
|
|
259
|
+
<div className="detail-identity">
|
|
260
|
+
{visuals && (
|
|
261
|
+
<div className="detail-glyph">
|
|
262
|
+
<OctopusGlyph
|
|
263
|
+
color={visuals.color}
|
|
264
|
+
animation={visuals.animation}
|
|
265
|
+
expression={visuals.expression}
|
|
266
|
+
accessory={visuals.accessory}
|
|
267
|
+
{...(visuals.hairColor ? { hairColor: visuals.hairColor } : {})}
|
|
268
|
+
scale={6}
|
|
269
|
+
/>
|
|
270
|
+
</div>
|
|
271
|
+
)}
|
|
272
|
+
<div className="detail-identity-info">
|
|
273
|
+
<div className="detail-name">{tentacle?.displayName ?? node.label}</div>
|
|
274
|
+
<div className="detail-row">
|
|
275
|
+
<span className="detail-label">ID</span>
|
|
276
|
+
<span className="detail-value detail-value--mono">{node.tentacleId}</span>
|
|
277
|
+
</div>
|
|
278
|
+
{tentacle?.description && (
|
|
279
|
+
<div className="detail-row">
|
|
280
|
+
<span className="detail-label">Description</span>
|
|
281
|
+
<span className="detail-value">{tentacle.description}</span>
|
|
282
|
+
</div>
|
|
283
|
+
)}
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
{/* Actions section */}
|
|
288
|
+
<div className="detail-section">
|
|
289
|
+
<div className="detail-section-title">Actions</div>
|
|
290
|
+
<div className="detail-actions">
|
|
291
|
+
<button
|
|
292
|
+
type="button"
|
|
293
|
+
className="detail-action-btn"
|
|
294
|
+
onClick={() => onCreateAgent?.(node.tentacleId)}
|
|
295
|
+
>
|
|
296
|
+
>_ Create Agent
|
|
297
|
+
</button>
|
|
298
|
+
<button
|
|
299
|
+
type="button"
|
|
300
|
+
className="detail-action-btn"
|
|
301
|
+
onClick={() => onSpawnSwarm?.(node.tentacleId, "worktree")}
|
|
302
|
+
>
|
|
303
|
+
≣ Spawn Swarm (Worktrees)
|
|
304
|
+
</button>
|
|
305
|
+
<button
|
|
306
|
+
type="button"
|
|
307
|
+
className="detail-action-btn"
|
|
308
|
+
onClick={() => onSpawnSwarm?.(node.tentacleId, "shared")}
|
|
309
|
+
>
|
|
310
|
+
≣ Spawn Swarm (Normal)
|
|
311
|
+
</button>
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
{/* Progress section */}
|
|
316
|
+
{tentacle && (
|
|
317
|
+
<div className="detail-section">
|
|
318
|
+
<div className="detail-section-title">Progress</div>
|
|
319
|
+
{tentacle.todoTotal > 0 && (
|
|
320
|
+
<div className="detail-progress">
|
|
321
|
+
<div className="detail-progress-bar">
|
|
322
|
+
<div
|
|
323
|
+
className="detail-progress-fill"
|
|
324
|
+
style={{ width: `${progressPct}%`, backgroundColor: node.color }}
|
|
325
|
+
/>
|
|
326
|
+
</div>
|
|
327
|
+
<span className="detail-progress-label">
|
|
328
|
+
{tentacle.todoDone}/{tentacle.todoTotal}
|
|
329
|
+
</span>
|
|
330
|
+
</div>
|
|
331
|
+
)}
|
|
332
|
+
{tentacle.todoItems.length > 0 && (
|
|
333
|
+
<ul className="detail-todos">
|
|
334
|
+
{tentacle.todoItems.map((item, i) => (
|
|
335
|
+
<li
|
|
336
|
+
key={`${i}-${item.text}`}
|
|
337
|
+
className={`detail-todo${item.done ? " detail-todo--done" : ""}`}
|
|
338
|
+
>
|
|
339
|
+
<div className="detail-todo-controls">
|
|
340
|
+
<button
|
|
341
|
+
type="button"
|
|
342
|
+
className="detail-todo-delete"
|
|
343
|
+
title="Delete item"
|
|
344
|
+
onClick={() => void handleTodoDelete(i)}
|
|
345
|
+
>
|
|
346
|
+
<X size={12} />
|
|
347
|
+
</button>
|
|
348
|
+
<button
|
|
349
|
+
type="button"
|
|
350
|
+
className="detail-todo-solve"
|
|
351
|
+
aria-label={`Spawn agent for todo item: ${item.text}`}
|
|
352
|
+
title="Spawn agent for this item"
|
|
353
|
+
disabled={item.done || solvingTodoIndex === i}
|
|
354
|
+
onClick={() => void handleTodoSolve(i)}
|
|
355
|
+
>
|
|
356
|
+
{solvingTodoIndex === i ? "…" : <Terminal size={15} strokeWidth={2.4} />}
|
|
357
|
+
</button>
|
|
358
|
+
<input
|
|
359
|
+
type="checkbox"
|
|
360
|
+
checked={item.done}
|
|
361
|
+
onChange={() => handleTodoToggle(i, !item.done)}
|
|
362
|
+
/>
|
|
363
|
+
</div>
|
|
364
|
+
{editingIndex === i ? (
|
|
365
|
+
<input
|
|
366
|
+
className="detail-todo-edit-input"
|
|
367
|
+
type="text"
|
|
368
|
+
value={editText}
|
|
369
|
+
onChange={(e) => setEditText(e.target.value)}
|
|
370
|
+
onKeyDown={(e) => {
|
|
371
|
+
if (e.key === "Enter") void handleTodoEdit(i, editText);
|
|
372
|
+
if (e.key === "Escape") setEditingIndex(null);
|
|
373
|
+
}}
|
|
374
|
+
onBlur={() => void handleTodoEdit(i, editText)}
|
|
375
|
+
/>
|
|
376
|
+
) : (
|
|
377
|
+
<span
|
|
378
|
+
className="detail-todo-text"
|
|
379
|
+
onDoubleClick={() => {
|
|
380
|
+
setEditingIndex(i);
|
|
381
|
+
setEditText(item.text);
|
|
382
|
+
}}
|
|
383
|
+
>
|
|
384
|
+
{item.text}
|
|
385
|
+
</span>
|
|
386
|
+
)}
|
|
387
|
+
</li>
|
|
388
|
+
))}
|
|
389
|
+
</ul>
|
|
390
|
+
)}
|
|
391
|
+
{addingTodo ? (
|
|
392
|
+
<div className="detail-todo-add-row">
|
|
393
|
+
<input
|
|
394
|
+
className="detail-todo-edit-input"
|
|
395
|
+
type="text"
|
|
396
|
+
placeholder="New todo item…"
|
|
397
|
+
value={addText}
|
|
398
|
+
onChange={(e) => setAddText(e.target.value)}
|
|
399
|
+
onKeyDown={(e) => {
|
|
400
|
+
if (e.key === "Enter") void handleTodoAdd(addText);
|
|
401
|
+
if (e.key === "Escape") {
|
|
402
|
+
setAddingTodo(false);
|
|
403
|
+
setAddText("");
|
|
404
|
+
}
|
|
405
|
+
}}
|
|
406
|
+
onBlur={() => {
|
|
407
|
+
if (addText.trim().length > 0) {
|
|
408
|
+
void handleTodoAdd(addText);
|
|
409
|
+
} else {
|
|
410
|
+
setAddingTodo(false);
|
|
411
|
+
setAddText("");
|
|
412
|
+
}
|
|
413
|
+
}}
|
|
414
|
+
/>
|
|
415
|
+
</div>
|
|
416
|
+
) : (
|
|
417
|
+
<button
|
|
418
|
+
type="button"
|
|
419
|
+
className="detail-todo-add-btn"
|
|
420
|
+
onClick={() => setAddingTodo(true)}
|
|
421
|
+
>
|
|
422
|
+
+ Add item
|
|
423
|
+
</button>
|
|
424
|
+
)}
|
|
425
|
+
</div>
|
|
426
|
+
)}
|
|
427
|
+
|
|
428
|
+
{/* Vault files */}
|
|
429
|
+
{tentacle && tentacle.vaultFiles.length > 0 && (
|
|
430
|
+
<div className="detail-section">
|
|
431
|
+
<div className="detail-section-title">Vault Files</div>
|
|
432
|
+
<div className="detail-labels-list">
|
|
433
|
+
{tentacle.vaultFiles.map((file) => (
|
|
434
|
+
<span key={file} className="detail-label-tag">
|
|
435
|
+
{file}
|
|
436
|
+
</span>
|
|
437
|
+
))}
|
|
438
|
+
</div>
|
|
439
|
+
</div>
|
|
440
|
+
)}
|
|
441
|
+
|
|
442
|
+
{tentacle && tentacle.suggestedSkills.length > 0 && (
|
|
443
|
+
<div className="detail-section">
|
|
444
|
+
<div className="detail-section-title">Suggested Skills</div>
|
|
445
|
+
<div className="detail-labels-list">
|
|
446
|
+
{tentacle.suggestedSkills.map((skill) => (
|
|
447
|
+
<span key={skill} className="detail-label-tag">
|
|
448
|
+
{skill}
|
|
449
|
+
</span>
|
|
450
|
+
))}
|
|
451
|
+
</div>
|
|
452
|
+
</div>
|
|
453
|
+
)}
|
|
454
|
+
|
|
455
|
+
{/* Sessions section */}
|
|
456
|
+
<div className="detail-section">
|
|
457
|
+
<div className="detail-section-title">Sessions ({sessions.length})</div>
|
|
458
|
+
{sessions.length === 0 ? (
|
|
459
|
+
<div className="detail-empty">No sessions yet</div>
|
|
460
|
+
) : (
|
|
461
|
+
<div className="detail-sessions">
|
|
462
|
+
{sessions.map((s) => (
|
|
463
|
+
<button
|
|
464
|
+
key={s.sessionId}
|
|
465
|
+
type="button"
|
|
466
|
+
className="detail-session-item"
|
|
467
|
+
onClick={() => onNavigateToConversation?.(s.sessionId)}
|
|
468
|
+
>
|
|
469
|
+
<span className="detail-session-preview">
|
|
470
|
+
{s.firstUserTurnPreview
|
|
471
|
+
? s.firstUserTurnPreview.slice(0, 60)
|
|
472
|
+
: s.sessionId.slice(0, 16)}
|
|
473
|
+
</span>
|
|
474
|
+
<span className="detail-session-meta">
|
|
475
|
+
{s.turnCount} turns · {formatTime(s.lastEventAt)}
|
|
476
|
+
</span>
|
|
477
|
+
</button>
|
|
478
|
+
))}
|
|
479
|
+
</div>
|
|
480
|
+
)}
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
</div>
|
|
484
|
+
);
|
|
485
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { X } from "lucide-react";
|
|
2
|
+
import { type Ref, useCallback, useState } from "react";
|
|
3
|
+
|
|
4
|
+
import type { GraphNode } from "../../app/canvas/types";
|
|
5
|
+
import type { TerminalView } from "../../app/types";
|
|
6
|
+
import { type AgentRuntimeState, AgentStateBadge } from "../AgentStateBadge";
|
|
7
|
+
import { Terminal } from "../Terminal";
|
|
8
|
+
|
|
9
|
+
type CanvasTerminalColumnProps = {
|
|
10
|
+
node: GraphNode;
|
|
11
|
+
terminals: TerminalView;
|
|
12
|
+
layoutVersion?: string | number;
|
|
13
|
+
isFocused?: boolean;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
onFocus?: () => void;
|
|
16
|
+
panelRef?: Ref<HTMLElement> | undefined;
|
|
17
|
+
onTerminalRenamed?: ((terminalId: string, tentacleName: string) => void) | undefined;
|
|
18
|
+
onTerminalActivity?: ((terminalId: string) => void) | undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const CanvasTerminalColumn = ({
|
|
22
|
+
node,
|
|
23
|
+
terminals,
|
|
24
|
+
layoutVersion,
|
|
25
|
+
isFocused,
|
|
26
|
+
onClose,
|
|
27
|
+
onFocus,
|
|
28
|
+
panelRef,
|
|
29
|
+
onTerminalRenamed,
|
|
30
|
+
onTerminalActivity,
|
|
31
|
+
}: CanvasTerminalColumnProps) => {
|
|
32
|
+
const [agentState, setAgentState] = useState<AgentRuntimeState>("idle");
|
|
33
|
+
|
|
34
|
+
const terminal = terminals.find((t) => t.terminalId === node.sessionId);
|
|
35
|
+
const rawName = terminal?.tentacleName ?? node.tentacleId;
|
|
36
|
+
const tentacleName = rawName.length > 24 ? `${rawName.slice(0, 24)}...` : rawName;
|
|
37
|
+
const workspaceMode = terminal?.workspaceMode ?? "shared";
|
|
38
|
+
|
|
39
|
+
const handleFocus = useCallback(() => {
|
|
40
|
+
onFocus?.();
|
|
41
|
+
}, [onFocus]);
|
|
42
|
+
|
|
43
|
+
if (!node.sessionId) return null;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<section
|
|
47
|
+
ref={panelRef}
|
|
48
|
+
className={`canvas-terminal-column${isFocused ? " canvas-terminal-column--focused" : ""}`}
|
|
49
|
+
tabIndex={-1}
|
|
50
|
+
onPointerDown={handleFocus}
|
|
51
|
+
onFocusCapture={handleFocus}
|
|
52
|
+
>
|
|
53
|
+
<div className="canvas-terminal-column-header">
|
|
54
|
+
<div className="canvas-terminal-column-heading">
|
|
55
|
+
<h2>
|
|
56
|
+
<span className="canvas-terminal-column-name">{tentacleName}</span>
|
|
57
|
+
{workspaceMode === "worktree" && (
|
|
58
|
+
<span className="canvas-terminal-column-badge">WT</span>
|
|
59
|
+
)}
|
|
60
|
+
</h2>
|
|
61
|
+
</div>
|
|
62
|
+
<div className="canvas-terminal-column-actions">
|
|
63
|
+
<span className="canvas-terminal-column-tentacle-tag" style={{ background: node.color }}>
|
|
64
|
+
{node.tentacleId}
|
|
65
|
+
</span>
|
|
66
|
+
<AgentStateBadge state={agentState} />
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
className="canvas-terminal-column-close"
|
|
70
|
+
onClick={onClose}
|
|
71
|
+
aria-label="Close terminal"
|
|
72
|
+
>
|
|
73
|
+
<X size={14} />
|
|
74
|
+
</button>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
<div className="canvas-terminal-column-body">
|
|
78
|
+
<Terminal
|
|
79
|
+
terminalId={node.sessionId}
|
|
80
|
+
terminalLabel={node.label}
|
|
81
|
+
{...(layoutVersion === undefined ? {} : { layoutVersion })}
|
|
82
|
+
onAgentRuntimeStateChange={setAgentState}
|
|
83
|
+
{...(onTerminalRenamed ? { onTerminalRenamed } : {})}
|
|
84
|
+
{...(onTerminalActivity ? { onTerminalActivity } : {})}
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
</section>
|
|
88
|
+
);
|
|
89
|
+
};
|