@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,86 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
import { ActionButton } from "./ActionButton";
|
|
4
|
+
|
|
5
|
+
type ConfirmationDialogProps = {
|
|
6
|
+
title: string;
|
|
7
|
+
ariaLabel: string;
|
|
8
|
+
message: ReactNode;
|
|
9
|
+
warning: string;
|
|
10
|
+
confirmLabel: string;
|
|
11
|
+
isConfirmDisabled: boolean;
|
|
12
|
+
isBusy: boolean;
|
|
13
|
+
cancelAriaLabel?: string;
|
|
14
|
+
onCancel: () => void;
|
|
15
|
+
onConfirm: () => void;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const ConfirmationDialog = ({
|
|
20
|
+
title,
|
|
21
|
+
ariaLabel,
|
|
22
|
+
message,
|
|
23
|
+
warning,
|
|
24
|
+
confirmLabel,
|
|
25
|
+
isConfirmDisabled,
|
|
26
|
+
isBusy,
|
|
27
|
+
cancelAriaLabel,
|
|
28
|
+
onCancel,
|
|
29
|
+
onConfirm,
|
|
30
|
+
children,
|
|
31
|
+
}: ConfirmationDialogProps) => (
|
|
32
|
+
<section
|
|
33
|
+
aria-label={ariaLabel}
|
|
34
|
+
className="delete-confirm-dialog"
|
|
35
|
+
onKeyDown={(event) => {
|
|
36
|
+
if (event.key !== "Escape" || isBusy) return;
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
onCancel();
|
|
39
|
+
}}
|
|
40
|
+
tabIndex={-1}
|
|
41
|
+
>
|
|
42
|
+
<header className="delete-confirm-header">
|
|
43
|
+
<h2>{title}</h2>
|
|
44
|
+
<div className="delete-confirm-header-actions">
|
|
45
|
+
<span className="pill blocked">DESTRUCTIVE</span>
|
|
46
|
+
<ActionButton
|
|
47
|
+
aria-label="Close confirmation"
|
|
48
|
+
className="delete-confirm-close"
|
|
49
|
+
disabled={isBusy}
|
|
50
|
+
onClick={onCancel}
|
|
51
|
+
size="dense"
|
|
52
|
+
variant="accent"
|
|
53
|
+
>
|
|
54
|
+
Close
|
|
55
|
+
</ActionButton>
|
|
56
|
+
</div>
|
|
57
|
+
</header>
|
|
58
|
+
<div className="delete-confirm-body">
|
|
59
|
+
<p className="delete-confirm-message">{message}</p>
|
|
60
|
+
<p className="delete-confirm-warning">{warning}</p>
|
|
61
|
+
{children}
|
|
62
|
+
</div>
|
|
63
|
+
<div className="delete-confirm-actions">
|
|
64
|
+
<ActionButton
|
|
65
|
+
aria-label={cancelAriaLabel ?? "Cancel"}
|
|
66
|
+
className="delete-confirm-cancel"
|
|
67
|
+
disabled={isBusy}
|
|
68
|
+
onClick={onCancel}
|
|
69
|
+
size="dense"
|
|
70
|
+
variant="accent"
|
|
71
|
+
>
|
|
72
|
+
Cancel
|
|
73
|
+
</ActionButton>
|
|
74
|
+
<ActionButton
|
|
75
|
+
aria-label={`Confirm ${title.toLowerCase()}`}
|
|
76
|
+
className="delete-confirm-submit"
|
|
77
|
+
disabled={isConfirmDisabled}
|
|
78
|
+
onClick={onConfirm}
|
|
79
|
+
size="dense"
|
|
80
|
+
variant="danger"
|
|
81
|
+
>
|
|
82
|
+
{confirmLabel}
|
|
83
|
+
</ActionButton>
|
|
84
|
+
</div>
|
|
85
|
+
</section>
|
|
86
|
+
);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { marked } from "marked";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
|
|
4
|
+
marked.setOptions({
|
|
5
|
+
breaks: true,
|
|
6
|
+
gfm: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const escapeRegExp = (str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
10
|
+
|
|
11
|
+
const highlightHtml = (html: string, term: string): string => {
|
|
12
|
+
const escaped = escapeRegExp(term);
|
|
13
|
+
const regex = new RegExp(`(${escaped})`, "gi");
|
|
14
|
+
|
|
15
|
+
// Only highlight text nodes — skip anything inside HTML tags
|
|
16
|
+
// Split on tags, highlight only the non-tag segments
|
|
17
|
+
const parts = html.split(/(<[^>]*>)/);
|
|
18
|
+
return parts
|
|
19
|
+
.map((part) => {
|
|
20
|
+
if (part.startsWith("<")) return part;
|
|
21
|
+
return part.replace(regex, '<mark class="search-highlight">$1</mark>');
|
|
22
|
+
})
|
|
23
|
+
.join("");
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type MarkdownContentProps = {
|
|
27
|
+
content: string;
|
|
28
|
+
className?: string;
|
|
29
|
+
highlightTerm?: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const MarkdownContent = ({ content, className, highlightTerm }: MarkdownContentProps) => {
|
|
33
|
+
const html = useMemo(() => {
|
|
34
|
+
const rendered = marked.parse(content, { async: false }) as string;
|
|
35
|
+
if (highlightTerm && highlightTerm.length > 0) {
|
|
36
|
+
return highlightHtml(rendered, highlightTerm);
|
|
37
|
+
}
|
|
38
|
+
return rendered;
|
|
39
|
+
}, [content, highlightTerm]);
|
|
40
|
+
|
|
41
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: markdown is rendered only inside the local operator UI and highlight markup is controlled.
|
|
42
|
+
return <div className={className} dangerouslySetInnerHTML={{ __html: html }} />;
|
|
43
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type SettingsToggleProps = {
|
|
2
|
+
label: string;
|
|
3
|
+
description: string;
|
|
4
|
+
ariaLabel: string;
|
|
5
|
+
checked: boolean;
|
|
6
|
+
onChange: (checked: boolean) => void;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const SettingsToggle = ({
|
|
10
|
+
label,
|
|
11
|
+
description,
|
|
12
|
+
ariaLabel,
|
|
13
|
+
checked,
|
|
14
|
+
onChange,
|
|
15
|
+
}: SettingsToggleProps) => (
|
|
16
|
+
<button
|
|
17
|
+
aria-checked={checked}
|
|
18
|
+
aria-label={ariaLabel}
|
|
19
|
+
className="settings-toggle-option"
|
|
20
|
+
data-active={checked ? "true" : "false"}
|
|
21
|
+
onClick={() => onChange(!checked)}
|
|
22
|
+
role="switch"
|
|
23
|
+
type="button"
|
|
24
|
+
>
|
|
25
|
+
<span className="settings-toggle-copy">
|
|
26
|
+
<span className="settings-toggle-label">{label}</span>
|
|
27
|
+
<span className="settings-toggle-description">{description}</span>
|
|
28
|
+
</span>
|
|
29
|
+
<span className="settings-toggle-switch" aria-hidden="true">
|
|
30
|
+
<span className="settings-toggle-thumb" />
|
|
31
|
+
</span>
|
|
32
|
+
<span className="settings-toggle-state">{checked ? "Enabled" : "Disabled"}</span>
|
|
33
|
+
</button>
|
|
34
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type StatusBadgeTone = "live" | "idle" | "processing" | "queued" | "blocked" | "warning";
|
|
2
|
+
|
|
3
|
+
type StatusBadgeProps = {
|
|
4
|
+
tone: StatusBadgeTone;
|
|
5
|
+
label?: string;
|
|
6
|
+
compactLabel?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const StatusBadge = ({ tone, label, compactLabel, className }: StatusBadgeProps) => {
|
|
11
|
+
const classes = ["status-badge", "pill", tone, className]
|
|
12
|
+
.filter((value) => Boolean(value))
|
|
13
|
+
.join(" ");
|
|
14
|
+
const fullLabel = label ?? tone.toUpperCase();
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<span className={classes}>
|
|
18
|
+
<span className="status-badge__full">{fullLabel}</span>
|
|
19
|
+
{compactLabel && compactLabel !== fullLabel ? (
|
|
20
|
+
<span className="status-badge__compact">{compactLabel}</span>
|
|
21
|
+
) : null}
|
|
22
|
+
</span>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StrictMode } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
|
|
4
|
+
import { App } from "./App";
|
|
5
|
+
import "./styles.css";
|
|
6
|
+
|
|
7
|
+
const rootElement = document.getElementById("root");
|
|
8
|
+
|
|
9
|
+
if (!rootElement) {
|
|
10
|
+
throw new Error("Root container '#root' was not found.");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
createRoot(rootElement).render(
|
|
14
|
+
<StrictMode>
|
|
15
|
+
<App />
|
|
16
|
+
</StrictMode>,
|
|
17
|
+
);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { AgentState, TerminalSnapshot, TerminalSnapshotReader } from "@octogent/core";
|
|
2
|
+
|
|
3
|
+
type HttpResponse = {
|
|
4
|
+
ok: boolean;
|
|
5
|
+
status: number;
|
|
6
|
+
json: () => Promise<unknown>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type HttpRequestInit = {
|
|
10
|
+
method: "GET";
|
|
11
|
+
headers: Record<string, string>;
|
|
12
|
+
signal?: AbortSignal | null;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type HttpFetcher = (input: string, init: HttpRequestInit) => Promise<HttpResponse>;
|
|
16
|
+
|
|
17
|
+
type HttpTerminalSnapshotReaderOptions = {
|
|
18
|
+
endpoint: string;
|
|
19
|
+
fetcher?: HttpFetcher;
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const isAgentState = (value: unknown): value is AgentState =>
|
|
24
|
+
value === "live" || value === "idle" || value === "queued" || value === "blocked";
|
|
25
|
+
|
|
26
|
+
const isTerminalSnapshot = (value: unknown): value is TerminalSnapshot => {
|
|
27
|
+
if (typeof value !== "object" || value === null) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const snapshot = value as Record<string, unknown>;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
typeof snapshot.terminalId === "string" &&
|
|
35
|
+
typeof snapshot.label === "string" &&
|
|
36
|
+
isAgentState(snapshot.state) &&
|
|
37
|
+
typeof snapshot.tentacleId === "string" &&
|
|
38
|
+
(snapshot.tentacleName === undefined || typeof snapshot.tentacleName === "string") &&
|
|
39
|
+
(snapshot.workspaceMode === undefined ||
|
|
40
|
+
snapshot.workspaceMode === "shared" ||
|
|
41
|
+
snapshot.workspaceMode === "worktree") &&
|
|
42
|
+
typeof snapshot.createdAt === "string"
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export class HttpTerminalSnapshotReader implements TerminalSnapshotReader {
|
|
47
|
+
private readonly endpoint: string;
|
|
48
|
+
private readonly fetcher: HttpFetcher;
|
|
49
|
+
private readonly signal: AbortSignal | undefined;
|
|
50
|
+
|
|
51
|
+
constructor({ endpoint, fetcher, signal }: HttpTerminalSnapshotReaderOptions) {
|
|
52
|
+
this.endpoint = endpoint;
|
|
53
|
+
this.fetcher =
|
|
54
|
+
fetcher ??
|
|
55
|
+
((input, init) =>
|
|
56
|
+
fetch(input, {
|
|
57
|
+
...init,
|
|
58
|
+
signal: init.signal ?? null,
|
|
59
|
+
}));
|
|
60
|
+
this.signal = signal;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async listTerminalSnapshots(): Promise<TerminalSnapshot[]> {
|
|
64
|
+
const requestInit: HttpRequestInit = {
|
|
65
|
+
method: "GET",
|
|
66
|
+
headers: {
|
|
67
|
+
Accept: "application/json",
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
if (this.signal) {
|
|
71
|
+
requestInit.signal = this.signal;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const response = await this.fetcher(this.endpoint, requestInit);
|
|
75
|
+
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
throw new Error(`Unable to load terminal snapshots (${response.status})`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const payload: unknown = await response.json();
|
|
81
|
+
if (!Array.isArray(payload)) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return payload.filter(isTerminalSnapshot);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
type LocationLike = Pick<Location, "host" | "protocol">;
|
|
2
|
+
|
|
3
|
+
const readRuntimeBaseUrl = (): string | null => {
|
|
4
|
+
const value = import.meta.env.VITE_OCTOGENT_API_ORIGIN;
|
|
5
|
+
if (typeof value !== "string") {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const trimmed = value.trim();
|
|
10
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const withTrailingSlash = (value: string) => (value.endsWith("/") ? value : `${value}/`);
|
|
14
|
+
|
|
15
|
+
const buildAbsoluteUrl = (baseUrl: string, pathname: string) => {
|
|
16
|
+
const normalizedPath = pathname.startsWith("/") ? pathname.slice(1) : pathname;
|
|
17
|
+
return new URL(normalizedPath, withTrailingSlash(baseUrl)).toString();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const localWebSocketUrl = (location: LocationLike, tentacleId: string) => {
|
|
21
|
+
const protocol = location.protocol === "https:" ? "wss:" : "ws:";
|
|
22
|
+
return `${protocol}//${location.host}/api/terminals/${tentacleId}/ws`;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const localRuntimeWebSocketUrl = (location: LocationLike, pathname: string) => {
|
|
26
|
+
const protocol = location.protocol === "https:" ? "wss:" : "ws:";
|
|
27
|
+
return `${protocol}//${location.host}${pathname}`;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const toWebSocketBase = (runtimeBaseUrl: string): string | null => {
|
|
31
|
+
try {
|
|
32
|
+
const url = new URL(runtimeBaseUrl);
|
|
33
|
+
if (url.protocol === "https:") {
|
|
34
|
+
url.protocol = "wss:";
|
|
35
|
+
return url.toString();
|
|
36
|
+
}
|
|
37
|
+
if (url.protocol === "http:") {
|
|
38
|
+
url.protocol = "ws:";
|
|
39
|
+
return url.toString();
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const buildTerminalSnapshotsUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
48
|
+
if (!runtimeBaseUrl) {
|
|
49
|
+
return "/api/terminal-snapshots";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/terminal-snapshots");
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const buildTerminalEventsSocketUrl = (
|
|
56
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
57
|
+
location: LocationLike = window.location,
|
|
58
|
+
) => {
|
|
59
|
+
if (!runtimeBaseUrl) {
|
|
60
|
+
return localRuntimeWebSocketUrl(location, "/api/terminal-events/ws");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const websocketBase = toWebSocketBase(runtimeBaseUrl);
|
|
64
|
+
if (!websocketBase) {
|
|
65
|
+
return localRuntimeWebSocketUrl(location, "/api/terminal-events/ws");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return buildAbsoluteUrl(websocketBase, "/api/terminal-events/ws");
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const buildTerminalsUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
72
|
+
if (!runtimeBaseUrl) {
|
|
73
|
+
return "/api/terminals";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/terminals");
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const buildCodexUsageUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
80
|
+
if (!runtimeBaseUrl) {
|
|
81
|
+
return "/api/codex/usage";
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/codex/usage");
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const buildClaudeUsageUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
88
|
+
if (!runtimeBaseUrl) {
|
|
89
|
+
return "/api/claude/usage";
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/claude/usage");
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const buildGithubSummaryUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
96
|
+
if (!runtimeBaseUrl) {
|
|
97
|
+
return "/api/github/summary";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/github/summary");
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const buildUiStateUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
104
|
+
if (!runtimeBaseUrl) {
|
|
105
|
+
return "/api/ui-state";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/ui-state");
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const buildWorkspaceSetupUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
112
|
+
if (!runtimeBaseUrl) {
|
|
113
|
+
return "/api/setup";
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/setup");
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const buildWorkspaceSetupStepUrl = (
|
|
120
|
+
stepId: string,
|
|
121
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
122
|
+
) => {
|
|
123
|
+
const path = `/api/setup/steps/${encodeURIComponent(stepId)}`;
|
|
124
|
+
if (!runtimeBaseUrl) {
|
|
125
|
+
return path;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const buildMonitorConfigUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
132
|
+
if (!runtimeBaseUrl) {
|
|
133
|
+
return "/api/monitor/config";
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/monitor/config");
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const buildMonitorFeedUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
140
|
+
if (!runtimeBaseUrl) {
|
|
141
|
+
return "/api/monitor/feed";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/monitor/feed");
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const buildMonitorRefreshUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
148
|
+
if (!runtimeBaseUrl) {
|
|
149
|
+
return "/api/monitor/refresh";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/monitor/refresh");
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const buildUsageHeatmapUrl = (
|
|
156
|
+
scope: "all" | "project" = "all",
|
|
157
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
158
|
+
) => {
|
|
159
|
+
const path = `/api/analytics/usage-heatmap?scope=${scope}`;
|
|
160
|
+
if (!runtimeBaseUrl) {
|
|
161
|
+
return path;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const buildConversationsUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
168
|
+
if (!runtimeBaseUrl) {
|
|
169
|
+
return "/api/conversations";
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/conversations");
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const buildConversationSearchUrl = (
|
|
176
|
+
query: string,
|
|
177
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
178
|
+
) => {
|
|
179
|
+
const path = `/api/conversations/search?q=${encodeURIComponent(query)}`;
|
|
180
|
+
if (!runtimeBaseUrl) {
|
|
181
|
+
return path;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const buildConversationSessionUrl = (
|
|
188
|
+
sessionId: string,
|
|
189
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
190
|
+
) => {
|
|
191
|
+
const encodedSessionId = encodeURIComponent(sessionId);
|
|
192
|
+
const path = `/api/conversations/${encodedSessionId}`;
|
|
193
|
+
if (!runtimeBaseUrl) {
|
|
194
|
+
return path;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export const buildConversationExportUrl = (
|
|
201
|
+
sessionId: string,
|
|
202
|
+
format: "json" | "md",
|
|
203
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
204
|
+
) => {
|
|
205
|
+
const encodedSessionId = encodeURIComponent(sessionId);
|
|
206
|
+
const path = `/api/conversations/${encodedSessionId}/export?format=${format}`;
|
|
207
|
+
if (!runtimeBaseUrl) {
|
|
208
|
+
return path;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export const buildTentacleRenameUrl = (
|
|
215
|
+
tentacleId: string,
|
|
216
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
217
|
+
) => {
|
|
218
|
+
const encodedTentacleId = encodeURIComponent(tentacleId);
|
|
219
|
+
if (!runtimeBaseUrl) {
|
|
220
|
+
return `/api/tentacles/${encodedTentacleId}`;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return buildAbsoluteUrl(runtimeBaseUrl, `/api/tentacles/${encodedTentacleId}`);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const buildTentacleGitActionUrl = (
|
|
227
|
+
tentacleId: string,
|
|
228
|
+
action: "status" | "commit" | "push" | "sync",
|
|
229
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
230
|
+
) => {
|
|
231
|
+
const encodedTentacleId = encodeURIComponent(tentacleId);
|
|
232
|
+
const path = `/api/tentacles/${encodedTentacleId}/git/${action}`;
|
|
233
|
+
if (!runtimeBaseUrl) {
|
|
234
|
+
return path;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export const buildTentacleGitStatusUrl = (
|
|
241
|
+
tentacleId: string,
|
|
242
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
243
|
+
) => buildTentacleGitActionUrl(tentacleId, "status", runtimeBaseUrl);
|
|
244
|
+
|
|
245
|
+
export const buildTentacleGitCommitUrl = (
|
|
246
|
+
tentacleId: string,
|
|
247
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
248
|
+
) => buildTentacleGitActionUrl(tentacleId, "commit", runtimeBaseUrl);
|
|
249
|
+
|
|
250
|
+
export const buildTentacleGitPushUrl = (
|
|
251
|
+
tentacleId: string,
|
|
252
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
253
|
+
) => buildTentacleGitActionUrl(tentacleId, "push", runtimeBaseUrl);
|
|
254
|
+
|
|
255
|
+
export const buildTentacleGitSyncUrl = (
|
|
256
|
+
tentacleId: string,
|
|
257
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
258
|
+
) => buildTentacleGitActionUrl(tentacleId, "sync", runtimeBaseUrl);
|
|
259
|
+
|
|
260
|
+
export const buildTentacleGitPullRequestUrl = (
|
|
261
|
+
tentacleId: string,
|
|
262
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
263
|
+
) => {
|
|
264
|
+
const encodedTentacleId = encodeURIComponent(tentacleId);
|
|
265
|
+
const path = `/api/tentacles/${encodedTentacleId}/git/pr`;
|
|
266
|
+
if (!runtimeBaseUrl) {
|
|
267
|
+
return path;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
export const buildTentacleGitPullRequestMergeUrl = (
|
|
274
|
+
tentacleId: string,
|
|
275
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
276
|
+
) => {
|
|
277
|
+
const encodedTentacleId = encodeURIComponent(tentacleId);
|
|
278
|
+
const path = `/api/tentacles/${encodedTentacleId}/git/pr/merge`;
|
|
279
|
+
if (!runtimeBaseUrl) {
|
|
280
|
+
return path;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
export const buildDeckTentaclesUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
287
|
+
if (!runtimeBaseUrl) {
|
|
288
|
+
return "/api/deck/tentacles";
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/deck/tentacles");
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export const buildDeckSkillsUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
295
|
+
if (!runtimeBaseUrl) {
|
|
296
|
+
return "/api/deck/skills";
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/deck/skills");
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
export const buildDeckTentacleUrl = (tentacleId: string, runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
303
|
+
const encodedTentacleId = encodeURIComponent(tentacleId);
|
|
304
|
+
const path = `/api/deck/tentacles/${encodedTentacleId}`;
|
|
305
|
+
if (!runtimeBaseUrl) {
|
|
306
|
+
return path;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export const buildDeckTentacleSkillsUrl = (
|
|
313
|
+
tentacleId: string,
|
|
314
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
315
|
+
) => {
|
|
316
|
+
const path = `/api/deck/tentacles/${encodeURIComponent(tentacleId)}/skills`;
|
|
317
|
+
if (!runtimeBaseUrl) {
|
|
318
|
+
return path;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
export const buildDeckVaultFileUrl = (
|
|
325
|
+
tentacleId: string,
|
|
326
|
+
fileName: string,
|
|
327
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
328
|
+
) => {
|
|
329
|
+
const encodedTentacleId = encodeURIComponent(tentacleId);
|
|
330
|
+
const encodedFileName = encodeURIComponent(fileName);
|
|
331
|
+
const path = `/api/deck/tentacles/${encodedTentacleId}/files/${encodedFileName}`;
|
|
332
|
+
if (!runtimeBaseUrl) {
|
|
333
|
+
return path;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export const buildDeckTodoToggleUrl = (
|
|
340
|
+
tentacleId: string,
|
|
341
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
342
|
+
) => {
|
|
343
|
+
const path = `/api/deck/tentacles/${encodeURIComponent(tentacleId)}/todo/toggle`;
|
|
344
|
+
if (!runtimeBaseUrl) return path;
|
|
345
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
export const buildDeckTodoEditUrl = (tentacleId: string, runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
349
|
+
const path = `/api/deck/tentacles/${encodeURIComponent(tentacleId)}/todo/edit`;
|
|
350
|
+
if (!runtimeBaseUrl) return path;
|
|
351
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
export const buildDeckTodoAddUrl = (tentacleId: string, runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
355
|
+
const path = `/api/deck/tentacles/${encodeURIComponent(tentacleId)}/todo`;
|
|
356
|
+
if (!runtimeBaseUrl) return path;
|
|
357
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
export const buildDeckTodoDeleteUrl = (
|
|
361
|
+
tentacleId: string,
|
|
362
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
363
|
+
) => {
|
|
364
|
+
const path = `/api/deck/tentacles/${encodeURIComponent(tentacleId)}/todo/delete`;
|
|
365
|
+
if (!runtimeBaseUrl) return path;
|
|
366
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
export const buildDeckTodoSolveUrl = (
|
|
370
|
+
tentacleId: string,
|
|
371
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
372
|
+
) => {
|
|
373
|
+
const path = `/api/deck/tentacles/${encodeURIComponent(tentacleId)}/todo/solve`;
|
|
374
|
+
if (!runtimeBaseUrl) return path;
|
|
375
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
export const buildPromptsUrl = (runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
379
|
+
if (!runtimeBaseUrl) {
|
|
380
|
+
return "/api/prompts";
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
return buildAbsoluteUrl(runtimeBaseUrl, "/api/prompts");
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
export const buildPromptItemUrl = (name: string, runtimeBaseUrl = readRuntimeBaseUrl()) => {
|
|
387
|
+
const encodedName = encodeURIComponent(name);
|
|
388
|
+
const path = `/api/prompts/${encodedName}`;
|
|
389
|
+
if (!runtimeBaseUrl) {
|
|
390
|
+
return path;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return buildAbsoluteUrl(runtimeBaseUrl, path);
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
export const buildTerminalSocketUrl = (
|
|
397
|
+
tentacleId: string,
|
|
398
|
+
runtimeBaseUrl = readRuntimeBaseUrl(),
|
|
399
|
+
location: LocationLike = window.location,
|
|
400
|
+
) => {
|
|
401
|
+
const encodedTentacleId = encodeURIComponent(tentacleId);
|
|
402
|
+
if (!runtimeBaseUrl) {
|
|
403
|
+
return localWebSocketUrl(location, encodedTentacleId);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const webSocketBase = toWebSocketBase(runtimeBaseUrl);
|
|
407
|
+
if (!webSocketBase) {
|
|
408
|
+
return localWebSocketUrl(location, encodedTentacleId);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return buildAbsoluteUrl(webSocketBase, `/api/terminals/${encodedTentacleId}/ws`);
|
|
412
|
+
};
|