@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,158 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { createServer } from "node:net";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
|
|
7
|
+
const DEFAULT_START_PORT = 8787;
|
|
8
|
+
const MAX_PORT_ATTEMPTS = 200;
|
|
9
|
+
|
|
10
|
+
const parseStartPort = (value) => {
|
|
11
|
+
if (!value) {
|
|
12
|
+
return DEFAULT_START_PORT;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const parsed = Number.parseInt(value, 10);
|
|
16
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 65535) {
|
|
17
|
+
return DEFAULT_START_PORT;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return parsed;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const isPortInUseError = (error) =>
|
|
24
|
+
Boolean(error) &&
|
|
25
|
+
typeof error === "object" &&
|
|
26
|
+
"code" in error &&
|
|
27
|
+
(error.code === "EADDRINUSE" || error.code === "EACCES");
|
|
28
|
+
|
|
29
|
+
const canListenOnPort = (port) =>
|
|
30
|
+
new Promise((resolve) => {
|
|
31
|
+
const probeServer = createServer();
|
|
32
|
+
|
|
33
|
+
const closeAndResolve = (result) => {
|
|
34
|
+
probeServer.removeAllListeners();
|
|
35
|
+
probeServer.close(() => {
|
|
36
|
+
resolve(result);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
probeServer.once("error", (error) => {
|
|
41
|
+
if (isPortInUseError(error)) {
|
|
42
|
+
resolve(false);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
resolve(false);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
probeServer.once("listening", () => {
|
|
50
|
+
closeAndResolve(true);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
probeServer.listen(port, "127.0.0.1");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const findOpenPort = async (startPort) => {
|
|
57
|
+
for (let offset = 0; offset < MAX_PORT_ATTEMPTS; offset += 1) {
|
|
58
|
+
const port = startPort + offset;
|
|
59
|
+
if (port > 65535) {
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// eslint-disable-next-line no-await-in-loop
|
|
64
|
+
const isAvailable = await canListenOnPort(port);
|
|
65
|
+
if (isAvailable) {
|
|
66
|
+
return port;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
throw new Error(`Unable to find an open port starting from ${startPort}`);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const pnpmCommand = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
|
|
74
|
+
const startPort = parseStartPort(process.env.OCTOGENT_DEV_START_PORT);
|
|
75
|
+
const apiPort = await findOpenPort(startPort);
|
|
76
|
+
const apiOrigin = `http://127.0.0.1:${apiPort}`;
|
|
77
|
+
|
|
78
|
+
console.log(`[octogent-dev] using api port ${apiPort}`);
|
|
79
|
+
|
|
80
|
+
const monorepoRoot = new URL("..", import.meta.url).pathname.replace(/\/$/, "");
|
|
81
|
+
|
|
82
|
+
// Resolve project state dir from global registry.
|
|
83
|
+
const resolveProjectStateDir = (workspaceCwd) => {
|
|
84
|
+
if (process.env.OCTOGENT_PROJECT_STATE_DIR) {
|
|
85
|
+
return process.env.OCTOGENT_PROJECT_STATE_DIR;
|
|
86
|
+
}
|
|
87
|
+
const projectConfigPath = join(workspaceCwd, ".octogent", "project.json");
|
|
88
|
+
if (existsSync(projectConfigPath)) {
|
|
89
|
+
try {
|
|
90
|
+
const projectConfig = JSON.parse(readFileSync(projectConfigPath, "utf-8"));
|
|
91
|
+
if (
|
|
92
|
+
typeof projectConfig.projectId === "string" &&
|
|
93
|
+
projectConfig.projectId.trim().length > 0
|
|
94
|
+
) {
|
|
95
|
+
return join(homedir(), ".octogent", "projects", projectConfig.projectId);
|
|
96
|
+
}
|
|
97
|
+
} catch {
|
|
98
|
+
// fall through
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const projectsFile = join(homedir(), ".octogent", "projects.json");
|
|
102
|
+
if (existsSync(projectsFile)) {
|
|
103
|
+
try {
|
|
104
|
+
const registry = JSON.parse(readFileSync(projectsFile, "utf-8"));
|
|
105
|
+
const project = registry.projects?.find((p) => p.path === workspaceCwd);
|
|
106
|
+
if (project) {
|
|
107
|
+
if (typeof project.id === "string" && project.id.trim().length > 0) {
|
|
108
|
+
return join(homedir(), ".octogent", "projects", project.id);
|
|
109
|
+
}
|
|
110
|
+
if (typeof project.name === "string" && project.name.trim().length > 0) {
|
|
111
|
+
return join(homedir(), ".octogent", "projects", project.name);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} catch {
|
|
115
|
+
// fall through
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return `${workspaceCwd}/.octogent`;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const workspaceCwd = process.env.OCTOGENT_WORKSPACE_CWD ?? monorepoRoot;
|
|
122
|
+
const projectStateDir = resolveProjectStateDir(workspaceCwd);
|
|
123
|
+
|
|
124
|
+
const child = spawn(
|
|
125
|
+
pnpmCommand,
|
|
126
|
+
["-r", "--parallel", "--filter", "@octogent/api", "--filter", "@octogent/web", "dev"],
|
|
127
|
+
{
|
|
128
|
+
stdio: "inherit",
|
|
129
|
+
env: {
|
|
130
|
+
...process.env,
|
|
131
|
+
OCTOGENT_API_PORT: String(apiPort),
|
|
132
|
+
OCTOGENT_API_ORIGIN: apiOrigin,
|
|
133
|
+
OCTOGENT_WORKSPACE_CWD: workspaceCwd,
|
|
134
|
+
OCTOGENT_PROJECT_STATE_DIR: projectStateDir,
|
|
135
|
+
OCTOGENT_PROMPTS_DIR: process.env.OCTOGENT_PROMPTS_DIR ?? `${monorepoRoot}/prompts`,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
const forwardSignal = (signal) => {
|
|
141
|
+
if (child.killed) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
child.kill(signal);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
process.on("SIGINT", () => forwardSignal("SIGINT"));
|
|
149
|
+
process.on("SIGTERM", () => forwardSignal("SIGTERM"));
|
|
150
|
+
|
|
151
|
+
child.on("exit", (code, signal) => {
|
|
152
|
+
if (signal) {
|
|
153
|
+
process.kill(process.pid, signal);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
process.exit(code ?? 0);
|
|
158
|
+
});
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
4
|
+
import {
|
|
5
|
+
chmodSync,
|
|
6
|
+
existsSync,
|
|
7
|
+
mkdirSync,
|
|
8
|
+
mkdtempSync,
|
|
9
|
+
readFileSync,
|
|
10
|
+
realpathSync,
|
|
11
|
+
rmSync,
|
|
12
|
+
writeFileSync,
|
|
13
|
+
} from "node:fs";
|
|
14
|
+
import { tmpdir } from "node:os";
|
|
15
|
+
import { delimiter, dirname, join } from "node:path";
|
|
16
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
18
|
+
|
|
19
|
+
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
const repoRoot = dirname(scriptDir);
|
|
21
|
+
const tempRoot = mkdtempSync(join(tmpdir(), "octogent-public-install-"));
|
|
22
|
+
const packDir = join(tempRoot, "pack");
|
|
23
|
+
const installDir = join(tempRoot, "install");
|
|
24
|
+
const workspaceDir = join(tempRoot, "workspace");
|
|
25
|
+
const homeDir = join(tempRoot, "home");
|
|
26
|
+
const binDir = join(tempRoot, "bin");
|
|
27
|
+
const npmCacheDir = join(tempRoot, "npm-cache");
|
|
28
|
+
|
|
29
|
+
mkdirSync(packDir, { recursive: true });
|
|
30
|
+
mkdirSync(installDir, { recursive: true });
|
|
31
|
+
mkdirSync(workspaceDir, { recursive: true });
|
|
32
|
+
mkdirSync(homeDir, { recursive: true });
|
|
33
|
+
mkdirSync(binDir, { recursive: true });
|
|
34
|
+
mkdirSync(npmCacheDir, { recursive: true });
|
|
35
|
+
|
|
36
|
+
const canonicalWorkspaceDir = realpathSync(workspaceDir);
|
|
37
|
+
|
|
38
|
+
const runtimeEnv = {
|
|
39
|
+
...process.env,
|
|
40
|
+
HOME: homeDir,
|
|
41
|
+
npm_config_cache: npmCacheDir,
|
|
42
|
+
};
|
|
43
|
+
const npmEnv = {
|
|
44
|
+
...process.env,
|
|
45
|
+
npm_config_logs_dir: join(npmCacheDir, "_logs"),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
npmEnv.npm_config_verify_deps_before_run = undefined;
|
|
49
|
+
|
|
50
|
+
const formatCommand = (command, args) => [command, ...args].join(" ");
|
|
51
|
+
|
|
52
|
+
const runChecked = (command, args, options = {}) => {
|
|
53
|
+
const result = spawnSync(command, args, {
|
|
54
|
+
encoding: "utf8",
|
|
55
|
+
stdio: "pipe",
|
|
56
|
+
...options,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (result.status !== 0) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
[
|
|
62
|
+
`Command failed: ${formatCommand(command, args)}`,
|
|
63
|
+
result.stdout ? `stdout:\n${result.stdout.trimEnd()}` : "",
|
|
64
|
+
result.stderr ? `stderr:\n${result.stderr.trimEnd()}` : "",
|
|
65
|
+
]
|
|
66
|
+
.filter(Boolean)
|
|
67
|
+
.join("\n\n"),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return result.stdout.trim();
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const writeProviderStub = () => {
|
|
75
|
+
if (process.platform === "win32") {
|
|
76
|
+
writeFileSync(join(binDir, "codex.cmd"), "@echo off\r\nexit /b 0\r\n", "utf8");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const stubPath = join(binDir, "codex");
|
|
81
|
+
writeFileSync(stubPath, "#!/bin/sh\nexit 0\n", "utf8");
|
|
82
|
+
chmodSync(stubPath, 0o755);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const assertFile = (filePath, description) => {
|
|
86
|
+
if (!existsSync(filePath)) {
|
|
87
|
+
throw new Error(`Missing ${description}: ${filePath}`);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const main = async () => {
|
|
92
|
+
let serverProcess;
|
|
93
|
+
let keepArtifacts = false;
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
writeProviderStub();
|
|
97
|
+
|
|
98
|
+
console.log("Building package artifacts...");
|
|
99
|
+
runChecked("pnpm", ["build"], {
|
|
100
|
+
cwd: repoRoot,
|
|
101
|
+
env: process.env,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
console.log("Packing npm tarball...");
|
|
105
|
+
const packed = JSON.parse(
|
|
106
|
+
runChecked("npm", ["pack", "--json", "--pack-destination", packDir], {
|
|
107
|
+
cwd: repoRoot,
|
|
108
|
+
env: npmEnv,
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
111
|
+
const tarballFilename = packed[0]?.filename;
|
|
112
|
+
if (typeof tarballFilename !== "string" || tarballFilename.length === 0) {
|
|
113
|
+
throw new Error("`npm pack --json` did not return a tarball filename.");
|
|
114
|
+
}
|
|
115
|
+
const tarballPath = join(packDir, tarballFilename);
|
|
116
|
+
|
|
117
|
+
console.log("Installing packed CLI into a clean temp project...");
|
|
118
|
+
runChecked("npm", ["init", "-y"], {
|
|
119
|
+
cwd: installDir,
|
|
120
|
+
env: npmEnv,
|
|
121
|
+
});
|
|
122
|
+
runChecked("npm", ["install", tarballPath], {
|
|
123
|
+
cwd: installDir,
|
|
124
|
+
env: npmEnv,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
console.log("Launching packaged Octogent in a fresh workspace...");
|
|
128
|
+
const octogentBin =
|
|
129
|
+
process.platform === "win32"
|
|
130
|
+
? join(installDir, "node_modules", ".bin", "octogent.cmd")
|
|
131
|
+
: join(installDir, "node_modules", ".bin", "octogent");
|
|
132
|
+
|
|
133
|
+
let stdout = "";
|
|
134
|
+
let stderr = "";
|
|
135
|
+
|
|
136
|
+
serverProcess = spawn(octogentBin, [], {
|
|
137
|
+
cwd: workspaceDir,
|
|
138
|
+
env: {
|
|
139
|
+
...runtimeEnv,
|
|
140
|
+
OCTOGENT_NO_OPEN: "1",
|
|
141
|
+
PATH: `${binDir}${delimiter}${runtimeEnv.PATH ?? ""}`,
|
|
142
|
+
},
|
|
143
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
serverProcess.stdout?.on("data", (chunk) => {
|
|
147
|
+
stdout += chunk.toString();
|
|
148
|
+
});
|
|
149
|
+
serverProcess.stderr?.on("data", (chunk) => {
|
|
150
|
+
stderr += chunk.toString();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const runtimeMetadataPath = join(homeDir, ".octogent", "projects");
|
|
154
|
+
|
|
155
|
+
for (let attempt = 0; attempt < 80; attempt += 1) {
|
|
156
|
+
if (serverProcess.exitCode !== null) {
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const projectConfigPath = join(workspaceDir, ".octogent", "project.json");
|
|
161
|
+
if (existsSync(projectConfigPath)) {
|
|
162
|
+
const projectConfig = JSON.parse(readFileSync(projectConfigPath, "utf8"));
|
|
163
|
+
const candidateRuntimePath = join(
|
|
164
|
+
runtimeMetadataPath,
|
|
165
|
+
projectConfig.projectId,
|
|
166
|
+
"state",
|
|
167
|
+
"runtime.json",
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
if (existsSync(candidateRuntimePath)) {
|
|
171
|
+
const runtimeMetadata = JSON.parse(readFileSync(candidateRuntimePath, "utf8"));
|
|
172
|
+
try {
|
|
173
|
+
const response = await fetch(runtimeMetadata.apiBaseUrl);
|
|
174
|
+
if (response.ok) {
|
|
175
|
+
const html = await response.text();
|
|
176
|
+
if (!html.includes("<title>Octogent</title>")) {
|
|
177
|
+
throw new Error("Packaged UI responded, but the returned HTML was not Octogent.");
|
|
178
|
+
}
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
} catch {
|
|
182
|
+
// Server may still be binding even after runtime metadata is written.
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
await delay(250);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (serverProcess.exitCode !== null) {
|
|
191
|
+
throw new Error(
|
|
192
|
+
[
|
|
193
|
+
`Packaged CLI exited before startup completed (exit ${serverProcess.exitCode}).`,
|
|
194
|
+
stdout ? `stdout:\n${stdout.trimEnd()}` : "",
|
|
195
|
+
stderr ? `stderr:\n${stderr.trimEnd()}` : "",
|
|
196
|
+
]
|
|
197
|
+
.filter(Boolean)
|
|
198
|
+
.join("\n\n"),
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const projectConfigPath = join(workspaceDir, ".octogent", "project.json");
|
|
203
|
+
const gitignorePath = join(workspaceDir, ".gitignore");
|
|
204
|
+
const projectsRegistryPath = join(homeDir, ".octogent", "projects.json");
|
|
205
|
+
|
|
206
|
+
assertFile(projectConfigPath, "local project config");
|
|
207
|
+
assertFile(gitignorePath, "workspace .gitignore");
|
|
208
|
+
assertFile(projectsRegistryPath, "global projects registry");
|
|
209
|
+
|
|
210
|
+
const projectConfig = JSON.parse(readFileSync(projectConfigPath, "utf8"));
|
|
211
|
+
const projectsRegistry = JSON.parse(readFileSync(projectsRegistryPath, "utf8"));
|
|
212
|
+
const registeredProject = projectsRegistry.projects.find(
|
|
213
|
+
(project) => project.id === projectConfig.projectId && project.path === canonicalWorkspaceDir,
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
if (!registeredProject) {
|
|
217
|
+
throw new Error("Global projects registry did not include the fresh workspace.");
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const runtimePath = join(
|
|
221
|
+
homeDir,
|
|
222
|
+
".octogent",
|
|
223
|
+
"projects",
|
|
224
|
+
projectConfig.projectId,
|
|
225
|
+
"state",
|
|
226
|
+
"runtime.json",
|
|
227
|
+
);
|
|
228
|
+
assertFile(runtimePath, "runtime metadata");
|
|
229
|
+
|
|
230
|
+
const runtime = JSON.parse(readFileSync(runtimePath, "utf8"));
|
|
231
|
+
if (runtime.workspaceCwd !== canonicalWorkspaceDir) {
|
|
232
|
+
throw new Error(
|
|
233
|
+
`Runtime metadata pointed at ${runtime.workspaceCwd}, expected ${canonicalWorkspaceDir}.`,
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const gitignoreContent = readFileSync(gitignorePath, "utf8");
|
|
238
|
+
if (!gitignoreContent.split(/\r?\n/).includes(".octogent")) {
|
|
239
|
+
throw new Error("Workspace .gitignore did not include the .octogent entry.");
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
console.log("Public install smoke test passed.");
|
|
243
|
+
console.log(` Tarball: ${tarballPath}`);
|
|
244
|
+
console.log(` Workspace: ${workspaceDir}`);
|
|
245
|
+
console.log(` API: ${runtime.apiBaseUrl}`);
|
|
246
|
+
} catch (error) {
|
|
247
|
+
keepArtifacts = true;
|
|
248
|
+
console.error("Public install smoke test failed.");
|
|
249
|
+
if (error instanceof Error) {
|
|
250
|
+
console.error(error.message);
|
|
251
|
+
} else {
|
|
252
|
+
console.error(String(error));
|
|
253
|
+
}
|
|
254
|
+
console.error(`Artifacts preserved at: ${tempRoot}`);
|
|
255
|
+
process.exitCode = 1;
|
|
256
|
+
} finally {
|
|
257
|
+
if (serverProcess && serverProcess.exitCode === null) {
|
|
258
|
+
serverProcess.kill("SIGTERM");
|
|
259
|
+
await delay(500);
|
|
260
|
+
if (serverProcess.exitCode === null) {
|
|
261
|
+
serverProcess.kill("SIGKILL");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (!keepArtifacts) {
|
|
266
|
+
rmSync(tempRoot, { force: true, recursive: true });
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
void main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noUncheckedIndexedAccess": true,
|
|
8
|
+
"exactOptionalPropertyTypes": true,
|
|
9
|
+
"useDefineForClassFields": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"allowSyntheticDefaultImports": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"isolatedModules": true
|
|
15
|
+
}
|
|
16
|
+
}
|
package/bin/AGI
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Creates a double-clickable GOKUL.app in /Applications that launches
|
|
3
|
+
# the Electron voice UI. After running once, Spotlight ⌘Space → "GOKUL"
|
|
4
|
+
# (in ALL CAPS or any case — Spotlight is case-insensitive) opens it.
|
|
5
|
+
set -e
|
|
6
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
7
|
+
|
|
8
|
+
# /Applications is the spot Spotlight always indexes. Fall back to
|
|
9
|
+
# ~/Applications if we can't write there (no sudo).
|
|
10
|
+
if [ -w "/Applications" ] || sudo -n true 2>/dev/null; then
|
|
11
|
+
APP_DIR="/Applications"
|
|
12
|
+
else
|
|
13
|
+
APP_DIR="$HOME/Applications"
|
|
14
|
+
mkdir -p "$APP_DIR"
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
APP="$APP_DIR/GOKUL.app"
|
|
18
|
+
CONTENTS="$APP/Contents"
|
|
19
|
+
MACOS="$CONTENTS/MacOS"
|
|
20
|
+
RES="$CONTENTS/Resources"
|
|
21
|
+
|
|
22
|
+
# Wipe any previous install so Spotlight re-indexes cleanly
|
|
23
|
+
rm -rf "$APP" "$APP_DIR/CORTEX.app" 2>/dev/null || true
|
|
24
|
+
mkdir -p "$MACOS" "$RES"
|
|
25
|
+
|
|
26
|
+
cat > "$CONTENTS/Info.plist" <<PLIST
|
|
27
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
28
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
29
|
+
<plist version="1.0"><dict>
|
|
30
|
+
<key>CFBundleName</key> <string>GOKUL</string>
|
|
31
|
+
<key>CFBundleDisplayName</key> <string>GOKUL</string>
|
|
32
|
+
<key>CFBundleExecutable</key> <string>gokul-launcher</string>
|
|
33
|
+
<key>CFBundleIdentifier</key> <string>com.gokul.cortex</string>
|
|
34
|
+
<key>CFBundleVersion</key> <string>1.0</string>
|
|
35
|
+
<key>CFBundleShortVersionString</key> <string>1.0</string>
|
|
36
|
+
<key>CFBundlePackageType</key> <string>APPL</string>
|
|
37
|
+
<key>LSMinimumSystemVersion</key> <string>11.0</string>
|
|
38
|
+
<key>NSHighResolutionCapable</key> <true/>
|
|
39
|
+
<key>LSUIElement</key> <false/>
|
|
40
|
+
<key>NSCameraUsageDescription</key> <string>CORTEX uses the camera only when you run a vision task.</string>
|
|
41
|
+
<key>NSMicrophoneUsageDescription</key> <string>CORTEX needs the mic for voice input.</string>
|
|
42
|
+
<key>NSAppleEventsUsageDescription</key> <string>Allow CORTEX to open the browser for the dashboard.</string>
|
|
43
|
+
</dict></plist>
|
|
44
|
+
PLIST
|
|
45
|
+
|
|
46
|
+
# PkgInfo helps LaunchServices recognise this as an app
|
|
47
|
+
printf 'APPL????' > "$CONTENTS/PkgInfo"
|
|
48
|
+
|
|
49
|
+
cat > "$MACOS/gokul-launcher" <<LAUNCHER
|
|
50
|
+
#!/bin/bash
|
|
51
|
+
# GOKUL — CORTEX AGI launcher (Electron UI only).
|
|
52
|
+
# Web dashboard is auto-opened by the CLI, not this app.
|
|
53
|
+
REPO="$REPO_ROOT"
|
|
54
|
+
export PATH="/opt/homebrew/bin:/usr/local/bin:\$PATH"
|
|
55
|
+
|
|
56
|
+
# Electron UI in foreground — when the user quits it, script exits
|
|
57
|
+
exec "\$REPO/bin/AGI-ui"
|
|
58
|
+
LAUNCHER
|
|
59
|
+
chmod +x "$MACOS/gokul-launcher"
|
|
60
|
+
|
|
61
|
+
# Force Spotlight to re-index immediately so ⌘Space → GOKUL works NOW
|
|
62
|
+
/usr/bin/touch "$APP"
|
|
63
|
+
/usr/bin/mdimport "$APP" 2>/dev/null || true
|
|
64
|
+
|
|
65
|
+
echo "✅ Installed: $APP"
|
|
66
|
+
echo
|
|
67
|
+
echo " 1. ⌘Space → type GOKUL → Enter → app opens"
|
|
68
|
+
echo " 2. Drag $APP onto the Dock to pin it"
|
|
69
|
+
echo " 3. While running: ⌘⇧A toggle window ⌘⇧F fullscreen"
|
|
70
|
+
echo
|
|
71
|
+
echo " Note: Web dashboard auto-opens when you run the CLI (./bin/AGI)."
|
package/bin/AGI-ui
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CORTEX Voice UI — always-on-top Electron app with zero-lag voice.
|
|
3
|
+
# Run: ./bin/AGI-ui
|
|
4
|
+
set -e
|
|
5
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
6
|
+
APP_DIR="$REPO_ROOT/apps/voice-ui"
|
|
7
|
+
|
|
8
|
+
if [ ! -d "$APP_DIR/node_modules/electron" ]; then
|
|
9
|
+
echo "📦 Installing Electron (one-time, ~2 min, ~150MB)..."
|
|
10
|
+
cd "$APP_DIR"
|
|
11
|
+
bun install 2>/dev/null || npm install
|
|
12
|
+
cd - >/dev/null
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
cd "$APP_DIR"
|
|
16
|
+
exec ./node_modules/.bin/electron . "$@"
|
package/bin/AGI-voice
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CORTEX Voice Loop — hands-free AGI.
|
|
3
|
+
# Just run: ./bin/AGI-voice
|
|
4
|
+
# Or symlink into PATH: ln -s $PWD/bin/AGI-voice /usr/local/bin/AGI-voice
|
|
5
|
+
set -e
|
|
6
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
7
|
+
|
|
8
|
+
# Auto-load .env so HF_TOKEN etc. are available
|
|
9
|
+
if [ -f "$REPO_ROOT/.env" ]; then
|
|
10
|
+
set -a
|
|
11
|
+
source "$REPO_ROOT/.env"
|
|
12
|
+
set +a
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
exec python3 "$REPO_ROOT/python/cortex_voice_loop.py" "$@"
|
package/bin/AGI-web
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CORTEX Dashboard — localhost web UI at http://localhost:3737
|
|
3
|
+
# Run: ./bin/AGI-web (auto-opens browser)
|
|
4
|
+
set -e
|
|
5
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
6
|
+
APP_DIR="$REPO_ROOT/apps/web-ui"
|
|
7
|
+
|
|
8
|
+
if [ ! -d "$APP_DIR/node_modules/express" ]; then
|
|
9
|
+
echo "📦 Installing express + ws (one-time, ~15s)..."
|
|
10
|
+
cd "$APP_DIR"
|
|
11
|
+
(bun install 2>/dev/null) || npm install --silent
|
|
12
|
+
cd - >/dev/null
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
cd "$APP_DIR"
|
|
16
|
+
exec node server.mjs "$@"
|