turboflux 1.0.0
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/LICENSE +21 -0
- package/README.md +177 -0
- package/bin/turboflux.mjs +28 -0
- package/dist/cli/brand.d.ts +7 -0
- package/dist/cli/brand.js +33 -0
- package/dist/cli/brand.js.map +1 -0
- package/dist/cli/commands/index.d.ts +4 -0
- package/dist/cli/commands/index.js +671 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/registry.d.ts +24 -0
- package/dist/cli/commands/registry.js +124 -0
- package/dist/cli/commands/registry.js.map +1 -0
- package/dist/cli/commands/types.d.ts +69 -0
- package/dist/cli/commands/types.js +2 -0
- package/dist/cli/commands/types.js.map +1 -0
- package/dist/cli/components/App.d.ts +15 -0
- package/dist/cli/components/App.js +1738 -0
- package/dist/cli/components/App.js.map +1 -0
- package/dist/cli/components/ConversationHistory.d.ts +15 -0
- package/dist/cli/components/ConversationHistory.js +92 -0
- package/dist/cli/components/ConversationHistory.js.map +1 -0
- package/dist/cli/components/TranscriptViewport.d.ts +25 -0
- package/dist/cli/components/TranscriptViewport.js +77 -0
- package/dist/cli/components/TranscriptViewport.js.map +1 -0
- package/dist/cli/components/agentActivityModel.d.ts +24 -0
- package/dist/cli/components/agentActivityModel.js +45 -0
- package/dist/cli/components/agentActivityModel.js.map +1 -0
- package/dist/cli/components/appHelpers.d.ts +34 -0
- package/dist/cli/components/appHelpers.js +209 -0
- package/dist/cli/components/appHelpers.js.map +1 -0
- package/dist/cli/components/design-system/StatusIcon.d.ts +5 -0
- package/dist/cli/components/design-system/StatusIcon.js +25 -0
- package/dist/cli/components/design-system/StatusIcon.js.map +1 -0
- package/dist/cli/components/developerFlowModel.d.ts +36 -0
- package/dist/cli/components/developerFlowModel.js +88 -0
- package/dist/cli/components/developerFlowModel.js.map +1 -0
- package/dist/cli/components/diff/DiffCard.d.ts +16 -0
- package/dist/cli/components/diff/DiffCard.js +30 -0
- package/dist/cli/components/diff/DiffCard.js.map +1 -0
- package/dist/cli/components/diff/DiffHunks.d.ts +11 -0
- package/dist/cli/components/diff/DiffHunks.js +58 -0
- package/dist/cli/components/diff/DiffHunks.js.map +1 -0
- package/dist/cli/components/header/Header.d.ts +13 -0
- package/dist/cli/components/header/Header.js +25 -0
- package/dist/cli/components/header/Header.js.map +1 -0
- package/dist/cli/components/header/Mascot.d.ts +4 -0
- package/dist/cli/components/header/Mascot.js +53 -0
- package/dist/cli/components/header/Mascot.js.map +1 -0
- package/dist/cli/components/header/StatusLine.d.ts +21 -0
- package/dist/cli/components/header/StatusLine.js +110 -0
- package/dist/cli/components/header/StatusLine.js.map +1 -0
- package/dist/cli/components/input/EffortPicker.d.ts +30 -0
- package/dist/cli/components/input/EffortPicker.js +126 -0
- package/dist/cli/components/input/EffortPicker.js.map +1 -0
- package/dist/cli/components/input/ModelPicker.d.ts +15 -0
- package/dist/cli/components/input/ModelPicker.js +95 -0
- package/dist/cli/components/input/ModelPicker.js.map +1 -0
- package/dist/cli/components/input/PromptInput.d.ts +79 -0
- package/dist/cli/components/input/PromptInput.js +496 -0
- package/dist/cli/components/input/PromptInput.js.map +1 -0
- package/dist/cli/components/input/RewindSelector.d.ts +8 -0
- package/dist/cli/components/input/RewindSelector.js +45 -0
- package/dist/cli/components/input/RewindSelector.js.map +1 -0
- package/dist/cli/components/input/pasteState.d.ts +6 -0
- package/dist/cli/components/input/pasteState.js +42 -0
- package/dist/cli/components/input/pasteState.js.map +1 -0
- package/dist/cli/components/input/terminalInputStateMachine.d.ts +29 -0
- package/dist/cli/components/input/terminalInputStateMachine.js +67 -0
- package/dist/cli/components/input/terminalInputStateMachine.js.map +1 -0
- package/dist/cli/components/layout/CockpitRails.d.ts +6 -0
- package/dist/cli/components/layout/CockpitRails.js +13 -0
- package/dist/cli/components/layout/CockpitRails.js.map +1 -0
- package/dist/cli/components/layout/LandingView.d.ts +15 -0
- package/dist/cli/components/layout/LandingView.js +12 -0
- package/dist/cli/components/layout/LandingView.js.map +1 -0
- package/dist/cli/components/layout/SessionSidebar.d.ts +18 -0
- package/dist/cli/components/layout/SessionSidebar.js +70 -0
- package/dist/cli/components/layout/SessionSidebar.js.map +1 -0
- package/dist/cli/components/layout/StartupAnimation.d.ts +14 -0
- package/dist/cli/components/layout/StartupAnimation.js +30 -0
- package/dist/cli/components/layout/StartupAnimation.js.map +1 -0
- package/dist/cli/components/markdown/highlighter.d.ts +1 -0
- package/dist/cli/components/markdown/highlighter.js +110 -0
- package/dist/cli/components/markdown/highlighter.js.map +1 -0
- package/dist/cli/components/markdown/index.d.ts +11 -0
- package/dist/cli/components/markdown/index.js +86 -0
- package/dist/cli/components/markdown/index.js.map +1 -0
- package/dist/cli/components/messages/MessageList.d.ts +16 -0
- package/dist/cli/components/messages/MessageList.js +56 -0
- package/dist/cli/components/messages/MessageList.js.map +1 -0
- package/dist/cli/components/messages/Messages.d.ts +26 -0
- package/dist/cli/components/messages/Messages.js +32 -0
- package/dist/cli/components/messages/Messages.js.map +1 -0
- package/dist/cli/components/messages/ThinkingBlock.d.ts +9 -0
- package/dist/cli/components/messages/ThinkingBlock.js +51 -0
- package/dist/cli/components/messages/ThinkingBlock.js.map +1 -0
- package/dist/cli/components/messages/WindowedMessageList.d.ts +21 -0
- package/dist/cli/components/messages/WindowedMessageList.js +44 -0
- package/dist/cli/components/messages/WindowedMessageList.js.map +1 -0
- package/dist/cli/components/permissions/PermissionDialog.d.ts +23 -0
- package/dist/cli/components/permissions/PermissionDialog.js +83 -0
- package/dist/cli/components/permissions/PermissionDialog.js.map +1 -0
- package/dist/cli/components/spinner/SpinnerGlyph.d.ts +6 -0
- package/dist/cli/components/spinner/SpinnerGlyph.js +55 -0
- package/dist/cli/components/spinner/SpinnerGlyph.js.map +1 -0
- package/dist/cli/components/spinner/constants.d.ts +4 -0
- package/dist/cli/components/spinner/constants.js +5 -0
- package/dist/cli/components/spinner/constants.js.map +1 -0
- package/dist/cli/components/tools/ActiveWorkPanel.d.ts +22 -0
- package/dist/cli/components/tools/ActiveWorkPanel.js +70 -0
- package/dist/cli/components/tools/ActiveWorkPanel.js.map +1 -0
- package/dist/cli/components/tools/AgentActivityLine.d.ts +13 -0
- package/dist/cli/components/tools/AgentActivityLine.js +88 -0
- package/dist/cli/components/tools/AgentActivityLine.js.map +1 -0
- package/dist/cli/components/tools/QueuedPromptList.d.ts +10 -0
- package/dist/cli/components/tools/QueuedPromptList.js +26 -0
- package/dist/cli/components/tools/QueuedPromptList.js.map +1 -0
- package/dist/cli/components/tools/TaskFlowHud.d.ts +15 -0
- package/dist/cli/components/tools/TaskFlowHud.js +55 -0
- package/dist/cli/components/tools/TaskFlowHud.js.map +1 -0
- package/dist/cli/components/tools/TerminalSessionsFooter.d.ts +6 -0
- package/dist/cli/components/tools/TerminalSessionsFooter.js +36 -0
- package/dist/cli/components/tools/TerminalSessionsFooter.js.map +1 -0
- package/dist/cli/components/tools/ToolActivityList.d.ts +11 -0
- package/dist/cli/components/tools/ToolActivityList.js +73 -0
- package/dist/cli/components/tools/ToolActivityList.js.map +1 -0
- package/dist/cli/components/tools/ToolCallTree.d.ts +11 -0
- package/dist/cli/components/tools/ToolCallTree.js +14 -0
- package/dist/cli/components/tools/ToolCallTree.js.map +1 -0
- package/dist/cli/components/tools/toolLifecycleModel.d.ts +16 -0
- package/dist/cli/components/tools/toolLifecycleModel.js +30 -0
- package/dist/cli/components/tools/toolLifecycleModel.js.map +1 -0
- package/dist/cli/components/tools/toolPresentation.d.ts +9 -0
- package/dist/cli/components/tools/toolPresentation.js +171 -0
- package/dist/cli/components/tools/toolPresentation.js.map +1 -0
- package/dist/cli/components/tools/toolTypes.d.ts +16 -0
- package/dist/cli/components/tools/toolTypes.js +2 -0
- package/dist/cli/components/tools/toolTypes.js.map +1 -0
- package/dist/cli/components/transcriptWindowing.d.ts +19 -0
- package/dist/cli/components/transcriptWindowing.js +81 -0
- package/dist/cli/components/transcriptWindowing.js.map +1 -0
- package/dist/cli/config.d.ts +1 -0
- package/dist/cli/config.js +2 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/conversations/journalWriter.d.ts +50 -0
- package/dist/cli/conversations/journalWriter.js +191 -0
- package/dist/cli/conversations/journalWriter.js.map +1 -0
- package/dist/cli/conversations/manager.d.ts +65 -0
- package/dist/cli/conversations/manager.js +435 -0
- package/dist/cli/conversations/manager.js.map +1 -0
- package/dist/cli/conversations/recoveryExport.d.ts +18 -0
- package/dist/cli/conversations/recoveryExport.js +39 -0
- package/dist/cli/conversations/recoveryExport.js.map +1 -0
- package/dist/cli/conversations/recoveryMessages.d.ts +2 -0
- package/dist/cli/conversations/recoveryMessages.js +3 -0
- package/dist/cli/conversations/recoveryMessages.js.map +1 -0
- package/dist/cli/conversations/store.d.ts +14 -0
- package/dist/cli/conversations/store.js +603 -0
- package/dist/cli/conversations/store.js.map +1 -0
- package/dist/cli/conversations/types.d.ts +142 -0
- package/dist/cli/conversations/types.js +2 -0
- package/dist/cli/conversations/types.js.map +1 -0
- package/dist/cli/globalConfiguration.d.ts +13 -0
- package/dist/cli/globalConfiguration.js +61 -0
- package/dist/cli/globalConfiguration.js.map +1 -0
- package/dist/cli/hooks/useMessageCursor.d.ts +16 -0
- package/dist/cli/hooks/useMessageCursor.js +75 -0
- package/dist/cli/hooks/useMessageCursor.js.map +1 -0
- package/dist/cli/hooks/useOverlayStack.d.ts +9 -0
- package/dist/cli/hooks/useOverlayStack.js +26 -0
- package/dist/cli/hooks/useOverlayStack.js.map +1 -0
- package/dist/cli/hooks/useTerminalSize.d.ts +16 -0
- package/dist/cli/hooks/useTerminalSize.js +37 -0
- package/dist/cli/hooks/useTerminalSize.js.map +1 -0
- package/dist/cli/i18n/index.d.ts +15 -0
- package/dist/cli/i18n/index.js +32 -0
- package/dist/cli/i18n/index.js.map +1 -0
- package/dist/cli/i18n/messages.d.ts +1305 -0
- package/dist/cli/i18n/messages.js +1305 -0
- package/dist/cli/i18n/messages.js.map +1 -0
- package/dist/cli/imageAttachments.d.ts +22 -0
- package/dist/cli/imageAttachments.js +329 -0
- package/dist/cli/imageAttachments.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +146 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/platform/terminalAttention.d.ts +46 -0
- package/dist/cli/platform/terminalAttention.js +152 -0
- package/dist/cli/platform/terminalAttention.js.map +1 -0
- package/dist/cli/platform/terminalTransparency.d.ts +11 -0
- package/dist/cli/platform/terminalTransparency.js +193 -0
- package/dist/cli/platform/terminalTransparency.js.map +1 -0
- package/dist/cli/repl.d.ts +15 -0
- package/dist/cli/repl.js +38 -0
- package/dist/cli/repl.js.map +1 -0
- package/dist/cli/setup.d.ts +17 -0
- package/dist/cli/setup.js +991 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/singleShot.d.ts +30 -0
- package/dist/cli/singleShot.js +167 -0
- package/dist/cli/singleShot.js.map +1 -0
- package/dist/cli/state/adaptiveStreamScheduler.d.ts +53 -0
- package/dist/cli/state/adaptiveStreamScheduler.js +136 -0
- package/dist/cli/state/adaptiveStreamScheduler.js.map +1 -0
- package/dist/cli/state/agentFlowController.d.ts +37 -0
- package/dist/cli/state/agentFlowController.js +402 -0
- package/dist/cli/state/agentFlowController.js.map +1 -0
- package/dist/cli/state/approvalPresentationScheduler.d.ts +28 -0
- package/dist/cli/state/approvalPresentationScheduler.js +72 -0
- package/dist/cli/state/approvalPresentationScheduler.js.map +1 -0
- package/dist/cli/state/flowFeatureFlags.d.ts +18 -0
- package/dist/cli/state/flowFeatureFlags.js +45 -0
- package/dist/cli/state/flowFeatureFlags.js.map +1 -0
- package/dist/cli/state/flowReducer.d.ts +120 -0
- package/dist/cli/state/flowReducer.js +535 -0
- package/dist/cli/state/flowReducer.js.map +1 -0
- package/dist/cli/state/flowSelectors.d.ts +45 -0
- package/dist/cli/state/flowSelectors.js +144 -0
- package/dist/cli/state/flowSelectors.js.map +1 -0
- package/dist/cli/state/flowStore.d.ts +19 -0
- package/dist/cli/state/flowStore.js +51 -0
- package/dist/cli/state/flowStore.js.map +1 -0
- package/dist/cli/state/globalCommandActivity.d.ts +25 -0
- package/dist/cli/state/globalCommandActivity.js +57 -0
- package/dist/cli/state/globalCommandActivity.js.map +1 -0
- package/dist/cli/state/goldenTraces.d.ts +2 -0
- package/dist/cli/state/goldenTraces.js +15 -0
- package/dist/cli/state/goldenTraces.js.map +1 -0
- package/dist/cli/state/notificationCoordinator.d.ts +38 -0
- package/dist/cli/state/notificationCoordinator.js +101 -0
- package/dist/cli/state/notificationCoordinator.js.map +1 -0
- package/dist/cli/stateProvider.d.ts +5 -0
- package/dist/cli/stateProvider.js +7 -0
- package/dist/cli/stateProvider.js.map +1 -0
- package/dist/cli/telemetry/localFlowTelemetry.d.ts +42 -0
- package/dist/cli/telemetry/localFlowTelemetry.js +131 -0
- package/dist/cli/telemetry/localFlowTelemetry.js.map +1 -0
- package/dist/cli/telemetry/terminalBaseline.d.ts +93 -0
- package/dist/cli/telemetry/terminalBaseline.js +199 -0
- package/dist/cli/telemetry/terminalBaseline.js.map +1 -0
- package/dist/cli/telemetry/terminalLatencyTracker.d.ts +24 -0
- package/dist/cli/telemetry/terminalLatencyTracker.js +59 -0
- package/dist/cli/telemetry/terminalLatencyTracker.js.map +1 -0
- package/dist/cli/terminalLayout.d.ts +2 -0
- package/dist/cli/terminalLayout.js +16 -0
- package/dist/cli/terminalLayout.js.map +1 -0
- package/dist/cli/terminalMouse.d.ts +10 -0
- package/dist/cli/terminalMouse.js +29 -0
- package/dist/cli/terminalMouse.js.map +1 -0
- package/dist/cli/theme/ThemeProvider.d.ts +9 -0
- package/dist/cli/theme/ThemeProvider.js +26 -0
- package/dist/cli/theme/ThemeProvider.js.map +1 -0
- package/dist/cli/theme/dark.d.ts +2 -0
- package/dist/cli/theme/dark.js +27 -0
- package/dist/cli/theme/dark.js.map +1 -0
- package/dist/cli/theme/index.d.ts +5 -0
- package/dist/cli/theme/index.js +5 -0
- package/dist/cli/theme/index.js.map +1 -0
- package/dist/cli/theme/light.d.ts +2 -0
- package/dist/cli/theme/light.js +26 -0
- package/dist/cli/theme/light.js.map +1 -0
- package/dist/cli/theme/palette.d.ts +7 -0
- package/dist/cli/theme/palette.js +8 -0
- package/dist/cli/theme/palette.js.map +1 -0
- package/dist/cli/theme/resolveColor.d.ts +4 -0
- package/dist/cli/theme/resolveColor.js +43 -0
- package/dist/cli/theme/resolveColor.js.map +1 -0
- package/dist/cli/theme/types.d.ts +27 -0
- package/dist/cli/theme/types.js +2 -0
- package/dist/cli/theme/types.js.map +1 -0
- package/dist/cli/toolExecutor.d.ts +1 -0
- package/dist/cli/toolExecutor.js +2 -0
- package/dist/cli/toolExecutor.js.map +1 -0
- package/dist/core/agentEngine.d.ts +425 -0
- package/dist/core/agentEngine.js +5170 -0
- package/dist/core/agentEngine.js.map +1 -0
- package/dist/core/agents/loader.d.ts +9 -0
- package/dist/core/agents/loader.js +144 -0
- package/dist/core/agents/loader.js.map +1 -0
- package/dist/core/applyPatch.d.ts +24 -0
- package/dist/core/applyPatch.js +158 -0
- package/dist/core/applyPatch.js.map +1 -0
- package/dist/core/cacheMonitor.d.ts +24 -0
- package/dist/core/cacheMonitor.js +211 -0
- package/dist/core/cacheMonitor.js.map +1 -0
- package/dist/core/clientIdentity.d.ts +6 -0
- package/dist/core/clientIdentity.js +44 -0
- package/dist/core/clientIdentity.js.map +1 -0
- package/dist/core/config.d.ts +99 -0
- package/dist/core/config.js +715 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/contextCompaction.d.ts +20 -0
- package/dist/core/contextCompaction.js +158 -0
- package/dist/core/contextCompaction.js.map +1 -0
- package/dist/core/contextManager.d.ts +44 -0
- package/dist/core/contextManager.js +590 -0
- package/dist/core/contextManager.js.map +1 -0
- package/dist/core/contextPolicy.d.ts +18 -0
- package/dist/core/contextPolicy.js +39 -0
- package/dist/core/contextPolicy.js.map +1 -0
- package/dist/core/credentialStore.d.ts +8 -0
- package/dist/core/credentialStore.js +37 -0
- package/dist/core/credentialStore.js.map +1 -0
- package/dist/core/diffCompute.d.ts +31 -0
- package/dist/core/diffCompute.js +116 -0
- package/dist/core/diffCompute.js.map +1 -0
- package/dist/core/editHelpers.d.ts +8 -0
- package/dist/core/editHelpers.js +35 -0
- package/dist/core/editHelpers.js.map +1 -0
- package/dist/core/fileIO.d.ts +12 -0
- package/dist/core/fileIO.js +199 -0
- package/dist/core/fileIO.js.map +1 -0
- package/dist/core/gitService.d.ts +83 -0
- package/dist/core/gitService.js +522 -0
- package/dist/core/gitService.js.map +1 -0
- package/dist/core/index.d.ts +30 -0
- package/dist/core/index.js +19 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/mcp/client.d.ts +32 -0
- package/dist/core/mcp/client.js +186 -0
- package/dist/core/mcp/client.js.map +1 -0
- package/dist/core/mcp/settings.d.ts +2 -0
- package/dist/core/mcp/settings.js +26 -0
- package/dist/core/mcp/settings.js.map +1 -0
- package/dist/core/mcp/toolBridge.d.ts +20 -0
- package/dist/core/mcp/toolBridge.js +74 -0
- package/dist/core/mcp/toolBridge.js.map +1 -0
- package/dist/core/mcp/types.d.ts +29 -0
- package/dist/core/mcp/types.js +2 -0
- package/dist/core/mcp/types.js.map +1 -0
- package/dist/core/modelDiscovery.d.ts +14 -0
- package/dist/core/modelDiscovery.js +566 -0
- package/dist/core/modelDiscovery.js.map +1 -0
- package/dist/core/modelProtocol.d.ts +43 -0
- package/dist/core/modelProtocol.js +238 -0
- package/dist/core/modelProtocol.js.map +1 -0
- package/dist/core/modelRegistry.d.ts +56 -0
- package/dist/core/modelRegistry.js +308 -0
- package/dist/core/modelRegistry.js.map +1 -0
- package/dist/core/networkProxy.d.ts +20 -0
- package/dist/core/networkProxy.js +145 -0
- package/dist/core/networkProxy.js.map +1 -0
- package/dist/core/normalizeBaseUrl.d.ts +1 -0
- package/dist/core/normalizeBaseUrl.js +9 -0
- package/dist/core/normalizeBaseUrl.js.map +1 -0
- package/dist/core/pathUtils.d.ts +3 -0
- package/dist/core/pathUtils.js +46 -0
- package/dist/core/pathUtils.js.map +1 -0
- package/dist/core/permissions.d.ts +29 -0
- package/dist/core/permissions.js +245 -0
- package/dist/core/permissions.js.map +1 -0
- package/dist/core/persona/voiceProfile.d.ts +7 -0
- package/dist/core/persona/voiceProfile.js +14 -0
- package/dist/core/persona/voiceProfile.js.map +1 -0
- package/dist/core/profile.d.ts +35 -0
- package/dist/core/profile.js +373 -0
- package/dist/core/profile.js.map +1 -0
- package/dist/core/requestCompatibility.d.ts +13 -0
- package/dist/core/requestCompatibility.js +181 -0
- package/dist/core/requestCompatibility.js.map +1 -0
- package/dist/core/runtime/agentRuntime.d.ts +43 -0
- package/dist/core/runtime/agentRuntime.js +137 -0
- package/dist/core/runtime/agentRuntime.js.map +1 -0
- package/dist/core/runtime/approvalCoordinator.d.ts +36 -0
- package/dist/core/runtime/approvalCoordinator.js +113 -0
- package/dist/core/runtime/approvalCoordinator.js.map +1 -0
- package/dist/core/runtime/capabilityBoundary.d.ts +18 -0
- package/dist/core/runtime/capabilityBoundary.js +89 -0
- package/dist/core/runtime/capabilityBoundary.js.map +1 -0
- package/dist/core/runtime/nodeToolExecutor.d.ts +200 -0
- package/dist/core/runtime/nodeToolExecutor.js +2446 -0
- package/dist/core/runtime/nodeToolExecutor.js.map +1 -0
- package/dist/core/runtime/runtimeLogWriter.d.ts +32 -0
- package/dist/core/runtime/runtimeLogWriter.js +129 -0
- package/dist/core/runtime/runtimeLogWriter.js.map +1 -0
- package/dist/core/runtime/runtimeTaskManager.d.ts +78 -0
- package/dist/core/runtime/runtimeTaskManager.js +374 -0
- package/dist/core/runtime/runtimeTaskManager.js.map +1 -0
- package/dist/core/runtime/sessionRegistry.d.ts +19 -0
- package/dist/core/runtime/sessionRegistry.js +41 -0
- package/dist/core/runtime/sessionRegistry.js.map +1 -0
- package/dist/core/runtime/stateProvider.d.ts +69 -0
- package/dist/core/runtime/stateProvider.js +131 -0
- package/dist/core/runtime/stateProvider.js.map +1 -0
- package/dist/core/runtime/subAgentTaskManager.d.ts +111 -0
- package/dist/core/runtime/subAgentTaskManager.js +386 -0
- package/dist/core/runtime/subAgentTaskManager.js.map +1 -0
- package/dist/core/schemaValidation.d.ts +5 -0
- package/dist/core/schemaValidation.js +153 -0
- package/dist/core/schemaValidation.js.map +1 -0
- package/dist/core/skills/loader.d.ts +7 -0
- package/dist/core/skills/loader.js +91 -0
- package/dist/core/skills/loader.js.map +1 -0
- package/dist/core/skills/runtime.d.ts +19 -0
- package/dist/core/skills/runtime.js +61 -0
- package/dist/core/skills/runtime.js.map +1 -0
- package/dist/core/subAgent.d.ts +50 -0
- package/dist/core/subAgent.js +1258 -0
- package/dist/core/subAgent.js.map +1 -0
- package/dist/core/systemPrompt.d.ts +27 -0
- package/dist/core/systemPrompt.js +219 -0
- package/dist/core/systemPrompt.js.map +1 -0
- package/dist/core/taskManager.d.ts +105 -0
- package/dist/core/taskManager.js +617 -0
- package/dist/core/taskManager.js.map +1 -0
- package/dist/core/tokenCompressor.d.ts +14 -0
- package/dist/core/tokenCompressor.js +161 -0
- package/dist/core/tokenCompressor.js.map +1 -0
- package/dist/core/tokenCounter.d.ts +28 -0
- package/dist/core/tokenCounter.js +101 -0
- package/dist/core/tokenCounter.js.map +1 -0
- package/dist/core/toolDispatcher.d.ts +11 -0
- package/dist/core/toolDispatcher.js +38 -0
- package/dist/core/toolDispatcher.js.map +1 -0
- package/dist/core/toolExecutionLedger.d.ts +9 -0
- package/dist/core/toolExecutionLedger.js +84 -0
- package/dist/core/toolExecutionLedger.js.map +1 -0
- package/dist/core/toolRegistry.d.ts +19 -0
- package/dist/core/toolRegistry.js +820 -0
- package/dist/core/toolRegistry.js.map +1 -0
- package/dist/core/turnStrategy.d.ts +20 -0
- package/dist/core/turnStrategy.js +103 -0
- package/dist/core/turnStrategy.js.map +1 -0
- package/dist/platform/process.d.ts +14 -0
- package/dist/platform/process.js +28 -0
- package/dist/platform/process.js.map +1 -0
- package/dist/platform/runtime.d.ts +8 -0
- package/dist/platform/runtime.js +21 -0
- package/dist/platform/runtime.js.map +1 -0
- package/dist/server/adminPage.d.ts +1 -0
- package/dist/server/adminPage.js +755 -0
- package/dist/server/adminPage.js.map +1 -0
- package/dist/server/index.d.ts +22 -0
- package/dist/server/index.js +566 -0
- package/dist/server/index.js.map +1 -0
- package/dist/shared/agentTypes.d.ts +227 -0
- package/dist/shared/agentTypes.js +79 -0
- package/dist/shared/agentTypes.js.map +1 -0
- package/dist/shared/codeIndexTypes.d.ts +32 -0
- package/dist/shared/codeIndexTypes.js +2 -0
- package/dist/shared/codeIndexTypes.js.map +1 -0
- package/dist/shared/flowEvents.d.ts +192 -0
- package/dist/shared/flowEvents.js +37 -0
- package/dist/shared/flowEvents.js.map +1 -0
- package/dist/shared/memoryTypes.d.ts +100 -0
- package/dist/shared/memoryTypes.js +2 -0
- package/dist/shared/memoryTypes.js.map +1 -0
- package/dist/shared/pluginTypes.d.ts +345 -0
- package/dist/shared/pluginTypes.js +2 -0
- package/dist/shared/pluginTypes.js.map +1 -0
- package/dist/shared/runtimeTaskTypes.d.ts +43 -0
- package/dist/shared/runtimeTaskTypes.js +2 -0
- package/dist/shared/runtimeTaskTypes.js.map +1 -0
- package/dist/shared/skillTypes.d.ts +1 -0
- package/dist/shared/skillTypes.js +2 -0
- package/dist/shared/skillTypes.js.map +1 -0
- package/dist/shared/subAgentTypes.d.ts +99 -0
- package/dist/shared/subAgentTypes.js +2 -0
- package/dist/shared/subAgentTypes.js.map +1 -0
- package/dist/shared/terminalTypes.d.ts +102 -0
- package/dist/shared/terminalTypes.js +2 -0
- package/dist/shared/terminalTypes.js.map +1 -0
- package/dist/shared/toolCallMarkup.d.ts +10 -0
- package/dist/shared/toolCallMarkup.js +107 -0
- package/dist/shared/toolCallMarkup.js.map +1 -0
- package/dist/shared/toolTypes.d.ts +24 -0
- package/dist/shared/toolTypes.js +2 -0
- package/dist/shared/toolTypes.js.map +1 -0
- package/dist/shared/types.d.ts +81 -0
- package/dist/shared/types.js +2 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/state/types.d.ts +69 -0
- package/dist/state/types.js +2 -0
- package/dist/state/types.js.map +1 -0
- package/dist/tools/executor.d.ts +133 -0
- package/dist/tools/executor.js +2 -0
- package/dist/tools/executor.js.map +1 -0
- package/dist/tools/memory/loaders.d.ts +6 -0
- package/dist/tools/memory/loaders.js +292 -0
- package/dist/tools/memory/loaders.js.map +1 -0
- package/dist/tools/memory/sanitizer.d.ts +6 -0
- package/dist/tools/memory/sanitizer.js +48 -0
- package/dist/tools/memory/sanitizer.js.map +1 -0
- package/dist/tools/memory/service.d.ts +24 -0
- package/dist/tools/memory/service.js +273 -0
- package/dist/tools/memory/service.js.map +1 -0
- package/dist/tools/memory/writer.d.ts +17 -0
- package/dist/tools/memory/writer.js +192 -0
- package/dist/tools/memory/writer.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
import { commandRegistry } from './registry';
|
|
2
|
+
import { getPresetByIdOrModelFrom, applyPreset, redactConfig, setConfigValue } from '../../core/config';
|
|
3
|
+
import { existsSync, writeFileSync, readdirSync, readFileSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { formatNativeReasoningSetting, getModelReasoningCapabilities } from '../../core/modelRegistry';
|
|
6
|
+
import { CAPABILITY_PROFILE_LABELS, normalizeApprovalPolicy, normalizeCapabilityProfile, } from '../../shared/agentTypes';
|
|
7
|
+
import { createTranslator } from '../i18n/index';
|
|
8
|
+
import { describeFlowFeatureFlags } from '../state/flowFeatureFlags';
|
|
9
|
+
const DEFAULT_TRANSLATOR = createTranslator('en');
|
|
10
|
+
commandRegistry.register({
|
|
11
|
+
name: 'exit',
|
|
12
|
+
descriptionKey: 'command.exit.description',
|
|
13
|
+
aliases: ['quit', 'q'],
|
|
14
|
+
type: 'local',
|
|
15
|
+
execute: (_args, ctx) => { ctx.exit(); },
|
|
16
|
+
});
|
|
17
|
+
commandRegistry.register({
|
|
18
|
+
name: 'clear',
|
|
19
|
+
descriptionKey: 'command.clear.description',
|
|
20
|
+
showsProgress: true,
|
|
21
|
+
type: 'local',
|
|
22
|
+
execute: (_args, ctx) => {
|
|
23
|
+
try {
|
|
24
|
+
ctx.conversationManager?.startNew();
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return ctx.t('command.conversation.persistenceBlocked');
|
|
28
|
+
}
|
|
29
|
+
ctx.engine.resetSession();
|
|
30
|
+
ctx.setMessages([]);
|
|
31
|
+
return ctx.t('command.clear.done');
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
commandRegistry.register({
|
|
35
|
+
name: 'help',
|
|
36
|
+
descriptionKey: 'command.help.description',
|
|
37
|
+
aliases: ['?'],
|
|
38
|
+
type: 'local',
|
|
39
|
+
execute: (_args, ctx) => {
|
|
40
|
+
const commands = commandRegistry.listAll();
|
|
41
|
+
const lines = commands.map(c => {
|
|
42
|
+
const hint = c.argumentHint ? ` ${c.argumentHint}` : '';
|
|
43
|
+
const aliases = c.aliases?.length ? ` (${c.aliases.map(a => '/' + a).join(', ')})` : '';
|
|
44
|
+
const description = c.descriptionKey ? ctx.t(c.descriptionKey) : c.description ?? '';
|
|
45
|
+
return ` /${c.name}${hint}${aliases} - ${description}`;
|
|
46
|
+
});
|
|
47
|
+
return `${ctx.t('command.available')}\n${lines.join('\n')}`;
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
commandRegistry.register({
|
|
51
|
+
name: 'config',
|
|
52
|
+
descriptionKey: 'command.config.description',
|
|
53
|
+
argumentHint: '[key] [value]',
|
|
54
|
+
showsProgress: args => args.trim().split(/\s+/).filter(Boolean).length >= 2,
|
|
55
|
+
type: 'local',
|
|
56
|
+
execute: (args, ctx) => {
|
|
57
|
+
if (!args) {
|
|
58
|
+
const safe = redactConfig(ctx.config);
|
|
59
|
+
return `${ctx.t('command.config.current')}\n${Object.entries(safe).map(([k, v]) => ` ${k}: ${v}`).join('\n')}`;
|
|
60
|
+
}
|
|
61
|
+
const parts = args.split(/\s+/);
|
|
62
|
+
if (parts.length < 2) {
|
|
63
|
+
const key = parts[0];
|
|
64
|
+
const val = ctx.config[key];
|
|
65
|
+
return `${key} = ${key === 'apiKey' ? '***' : val}`;
|
|
66
|
+
}
|
|
67
|
+
const [key, ...rest] = parts;
|
|
68
|
+
const val = rest.join(' ');
|
|
69
|
+
try {
|
|
70
|
+
const updated = setConfigValue(ctx.config, key, val);
|
|
71
|
+
ctx.setConfig(updated);
|
|
72
|
+
return ctx.t('command.config.set', { key, value: key === 'apiKey' ? '***' : String(updated[key]) });
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
return ctx.t('command.config.error', { message: error instanceof Error ? error.message : String(error) });
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
commandRegistry.register({
|
|
80
|
+
name: 'setup',
|
|
81
|
+
descriptionKey: 'command.setup.description',
|
|
82
|
+
type: 'local',
|
|
83
|
+
execute: (_args, ctx) => ctx.t('command.setup.instructions'),
|
|
84
|
+
});
|
|
85
|
+
commandRegistry.register({
|
|
86
|
+
name: 'model',
|
|
87
|
+
descriptionKey: 'command.model.description',
|
|
88
|
+
argumentHint: '[add <model-id>|<model-id>]',
|
|
89
|
+
showsProgress: args => Boolean(args.trim()),
|
|
90
|
+
type: 'local',
|
|
91
|
+
execute: (args, ctx) => {
|
|
92
|
+
if (!args) {
|
|
93
|
+
const presetLines = ctx.modelPresets.map(p => {
|
|
94
|
+
const active = ctx.config.model === p.model ? ' *' : '';
|
|
95
|
+
return ` ${p.id.padEnd(8)} ${p.name.padEnd(20)} ${p.description}${active}`;
|
|
96
|
+
});
|
|
97
|
+
return `${ctx.t('command.model.current', { model: ctx.config.model || ctx.t('command.model.none') })}\n\n${ctx.t('command.model.available')}\n${presetLines.join('\n')}\n\n${ctx.t('command.model.usage')}`;
|
|
98
|
+
}
|
|
99
|
+
const input = args.trim();
|
|
100
|
+
const addMatch = input.match(/^add(?:\s+(.+))?$/i);
|
|
101
|
+
if (addMatch) {
|
|
102
|
+
const modelId = addMatch[1]?.trim();
|
|
103
|
+
if (!modelId)
|
|
104
|
+
return ctx.t('command.model.usage');
|
|
105
|
+
const preset = getPresetByIdOrModelFrom(ctx.modelPresets, modelId);
|
|
106
|
+
const updated = preset
|
|
107
|
+
? applyPreset(ctx.config, preset)
|
|
108
|
+
: setConfigValue(ctx.config, 'model', modelId);
|
|
109
|
+
ctx.setConfig(updated);
|
|
110
|
+
return ctx.t('command.model.mounted', { model: updated.model });
|
|
111
|
+
}
|
|
112
|
+
const preset = getPresetByIdOrModelFrom(ctx.modelPresets, input);
|
|
113
|
+
if (preset) {
|
|
114
|
+
const updated = applyPreset(ctx.config, preset);
|
|
115
|
+
ctx.setConfig(updated);
|
|
116
|
+
return ctx.t('command.model.switchedPreset', { name: preset.name, model: preset.model });
|
|
117
|
+
}
|
|
118
|
+
const updated = setConfigValue(ctx.config, 'model', input);
|
|
119
|
+
ctx.setConfig(updated);
|
|
120
|
+
return ctx.t('command.model.switched', { model: input });
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
commandRegistry.register({
|
|
124
|
+
name: 'plan',
|
|
125
|
+
descriptionKey: 'command.plan.description',
|
|
126
|
+
showsProgress: true,
|
|
127
|
+
type: 'local',
|
|
128
|
+
execute: (_args, ctx) => {
|
|
129
|
+
ctx.engine.setMode('plan');
|
|
130
|
+
return ctx.t('command.plan.done');
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
commandRegistry.register({
|
|
134
|
+
name: 'vibe',
|
|
135
|
+
descriptionKey: 'command.vibe.description',
|
|
136
|
+
aliases: ['code'],
|
|
137
|
+
showsProgress: true,
|
|
138
|
+
type: 'local',
|
|
139
|
+
execute: (_args, ctx) => {
|
|
140
|
+
ctx.engine.setMode('vibe');
|
|
141
|
+
return ctx.t('command.vibe.done');
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
commandRegistry.register({
|
|
145
|
+
name: 'git',
|
|
146
|
+
descriptionKey: 'command.git.description',
|
|
147
|
+
argumentHint: '[on|off|refresh]',
|
|
148
|
+
showsProgress: args => Boolean(args.trim()),
|
|
149
|
+
type: 'local',
|
|
150
|
+
execute: (args, ctx) => {
|
|
151
|
+
const sub = args.trim().toLowerCase();
|
|
152
|
+
if (sub === 'off' || sub === 'disable') {
|
|
153
|
+
const nextConfig = setConfigValue(ctx.config, 'gitEnabled', 'off');
|
|
154
|
+
ctx.setConfig(nextConfig);
|
|
155
|
+
return ctx.t('command.git.disabled');
|
|
156
|
+
}
|
|
157
|
+
if (sub === 'on' || sub === 'enable') {
|
|
158
|
+
const nextConfig = setConfigValue(ctx.config, 'gitEnabled', 'on');
|
|
159
|
+
ctx.setConfig(nextConfig);
|
|
160
|
+
return ctx.t('command.git.enabled');
|
|
161
|
+
}
|
|
162
|
+
if (sub === 'refresh') {
|
|
163
|
+
void ctx.engine.initializeGit(true);
|
|
164
|
+
return ctx.t('command.git.refreshing');
|
|
165
|
+
}
|
|
166
|
+
if (sub)
|
|
167
|
+
return ctx.t('command.git.usage');
|
|
168
|
+
const state = ctx.engine.getGitState();
|
|
169
|
+
const snapshot = state.snapshot;
|
|
170
|
+
const lines = [
|
|
171
|
+
ctx.t('command.git.phase', { phase: state.phase }),
|
|
172
|
+
snapshot ? ctx.t('command.git.branch', { branch: `${snapshot.branch}${snapshot.head ? ` @ ${snapshot.head.slice(0, 8)}` : ''}` }) : '',
|
|
173
|
+
snapshot ? ctx.t('command.git.changes', { staged: snapshot.stagedCount, unstaged: snapshot.unstagedCount, untracked: snapshot.untrackedCount, conflicted: snapshot.conflictedCount }) : '',
|
|
174
|
+
snapshot && (snapshot.ahead > 0 || snapshot.behind > 0) ? ctx.t('command.git.tracking', { ahead: snapshot.ahead, behind: snapshot.behind }) : '',
|
|
175
|
+
state.operation ? ctx.t('command.git.operation', { name: state.operation.name, status: state.operation.status, hash: state.operation.hash ? ` ${state.operation.hash.slice(0, 8)}` : '' }) : '',
|
|
176
|
+
state.error ? ctx.t('common.error', { message: state.error }) : '',
|
|
177
|
+
].filter(Boolean);
|
|
178
|
+
return lines.join('\n');
|
|
179
|
+
},
|
|
180
|
+
executeAsync: async (args, ctx) => {
|
|
181
|
+
if (args.trim().toLowerCase() === 'refresh') {
|
|
182
|
+
await ctx.engine.initializeGit(true);
|
|
183
|
+
return ctx.t('command.git.refreshing');
|
|
184
|
+
}
|
|
185
|
+
const result = commandRegistry.execute(`/git${args ? ` ${args}` : ''}`, ctx);
|
|
186
|
+
return result.text;
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
commandRegistry.register({
|
|
190
|
+
name: 'ps',
|
|
191
|
+
descriptionKey: 'command.ps.description',
|
|
192
|
+
type: 'local',
|
|
193
|
+
execute: (_args, ctx) => {
|
|
194
|
+
const tasks = ctx.runtimeTaskManager?.listTasks({ kind: 'terminal' }) || [];
|
|
195
|
+
if (tasks.length === 0)
|
|
196
|
+
return ctx.t('command.ps.none');
|
|
197
|
+
const now = Date.now();
|
|
198
|
+
const lines = tasks.map(task => {
|
|
199
|
+
const sessionId = typeof task.metadata?.sessionId === 'string' ? task.metadata.sessionId : task.id;
|
|
200
|
+
const elapsed = formatRuntimeDuration((task.endedAt || now) - task.startedAt);
|
|
201
|
+
const exit = typeof task.exitCode === 'number' ? ctx.t('command.ps.exit', { code: task.exitCode }) : '';
|
|
202
|
+
const pid = task.pid ? ctx.t('command.ps.pid', { pid: task.pid }) : '';
|
|
203
|
+
const output = typeof task.outputBytes === 'number' ? ` · ${formatRuntimeBytes(task.outputBytes)}` : '';
|
|
204
|
+
const recovered = task.metadata?.recovered === true ? ctx.t('command.ps.recovered') : '';
|
|
205
|
+
return `- ${sessionId} · ${task.status}${exit}${pid} · ${elapsed}${output}${recovered}\n ${task.command || ctx.t('ui.app.shellSession')}`;
|
|
206
|
+
});
|
|
207
|
+
return `${ctx.t('command.ps.title', { count: tasks.length })}\n${lines.join('\n')}`;
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
commandRegistry.register({
|
|
211
|
+
name: 'inbox',
|
|
212
|
+
descriptionKey: 'command.inbox.description',
|
|
213
|
+
argumentHint: '[clear]',
|
|
214
|
+
type: 'local',
|
|
215
|
+
execute: (args, ctx) => {
|
|
216
|
+
const inbox = ctx.notificationInbox;
|
|
217
|
+
if (!inbox)
|
|
218
|
+
return ctx.t('command.inbox.unavailable');
|
|
219
|
+
if (args.trim().toLowerCase() === 'clear') {
|
|
220
|
+
const cleared = inbox.clearResults();
|
|
221
|
+
return cleared > 0
|
|
222
|
+
? ctx.t('command.inbox.cleared', { count: cleared })
|
|
223
|
+
: ctx.t('command.inbox.alreadyClear');
|
|
224
|
+
}
|
|
225
|
+
if (args.trim())
|
|
226
|
+
return ctx.t('command.inbox.usage');
|
|
227
|
+
const snapshot = inbox.snapshot();
|
|
228
|
+
const results = snapshot.inbox.filter(item => item.category === 'result-ready');
|
|
229
|
+
if (results.length === 0)
|
|
230
|
+
return ctx.t('command.inbox.none');
|
|
231
|
+
return [
|
|
232
|
+
ctx.t('command.inbox.title', { count: snapshot.resultCount }),
|
|
233
|
+
...results.map(item => `- ${item.title}${item.count > 1 ? ` x${item.count}` : ''}${item.detail ? ` - ${item.detail}` : ''}`),
|
|
234
|
+
ctx.t('command.inbox.reviewHint'),
|
|
235
|
+
].join('\n');
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
commandRegistry.register({
|
|
239
|
+
name: 'flow',
|
|
240
|
+
descriptionKey: 'command.flow.description',
|
|
241
|
+
argumentHint: '[status|retry|export [path]]',
|
|
242
|
+
showsProgress: args => /^(retry|export)(?:\s|$)/i.test(args.trim()),
|
|
243
|
+
type: 'local',
|
|
244
|
+
execute: (args, ctx) => {
|
|
245
|
+
const manager = ctx.conversationManager;
|
|
246
|
+
if (!manager)
|
|
247
|
+
return ctx.t('command.flow.unavailable');
|
|
248
|
+
const [action = 'status', ...rest] = args.trim().split(/\s+/).filter(Boolean);
|
|
249
|
+
if (action === 'status') {
|
|
250
|
+
const health = manager.getPersistenceHealth();
|
|
251
|
+
return [
|
|
252
|
+
ctx.t('command.flow.status', {
|
|
253
|
+
status: health.status === 'healthy' ? ctx.t('command.flow.healthy') : ctx.t('command.flow.degraded'),
|
|
254
|
+
}),
|
|
255
|
+
ctx.t('command.flow.pending', {
|
|
256
|
+
recovery: health.pendingRecoveryEntries,
|
|
257
|
+
streaming: health.pendingStreamingEntries,
|
|
258
|
+
}),
|
|
259
|
+
ctx.t('command.flow.features', {
|
|
260
|
+
features: ctx.flowFeatures ? describeFlowFeatureFlags(ctx.flowFeatures) : ctx.t('command.flow.featuresUnknown'),
|
|
261
|
+
}),
|
|
262
|
+
health.error ? ctx.t('command.flow.error', { message: health.error }) : '',
|
|
263
|
+
].filter(Boolean).join('\n');
|
|
264
|
+
}
|
|
265
|
+
if (action === 'retry') {
|
|
266
|
+
const health = manager.retryPersistence();
|
|
267
|
+
return health.status === 'healthy'
|
|
268
|
+
? ctx.t('command.flow.retrySucceeded')
|
|
269
|
+
: ctx.t('command.flow.retryFailed', { message: health.error ?? ctx.t('command.flow.unknownError') });
|
|
270
|
+
}
|
|
271
|
+
if (action === 'export') {
|
|
272
|
+
try {
|
|
273
|
+
const target = manager.exportRecoveryBundle(rest.join(' ') || undefined);
|
|
274
|
+
return ctx.t('command.flow.exported', { path: target });
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
return ctx.t('command.flow.exportFailed', { message: error instanceof Error ? error.message : String(error) });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return ctx.t('command.flow.usage');
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
commandRegistry.register({
|
|
284
|
+
name: 'stop',
|
|
285
|
+
descriptionKey: 'command.stop.description',
|
|
286
|
+
argumentHint: '[session-id|all]',
|
|
287
|
+
showsProgress: true,
|
|
288
|
+
type: 'local',
|
|
289
|
+
execute: (args, ctx) => executeStopCommand(args, ctx),
|
|
290
|
+
executeAsync: (args, ctx) => executeStopCommand(args, ctx, true),
|
|
291
|
+
});
|
|
292
|
+
commandRegistry.register({
|
|
293
|
+
name: 'compact',
|
|
294
|
+
descriptionKey: 'command.compact.description',
|
|
295
|
+
showsProgress: true,
|
|
296
|
+
type: 'local',
|
|
297
|
+
execute: (_args, ctx) => {
|
|
298
|
+
ctx.engine.compactContext().catch(() => { });
|
|
299
|
+
return ctx.t('command.compact.triggered');
|
|
300
|
+
},
|
|
301
|
+
executeAsync: async (_args, ctx) => {
|
|
302
|
+
await ctx.engine.compactContext();
|
|
303
|
+
return ctx.t('command.compact.triggered');
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
commandRegistry.register({
|
|
307
|
+
name: 'context',
|
|
308
|
+
descriptionKey: 'command.context.description',
|
|
309
|
+
type: 'local',
|
|
310
|
+
execute: (_args, ctx) => {
|
|
311
|
+
const tokens = ctx.engine.getContextUsage();
|
|
312
|
+
const window = ctx.config.contextWindow;
|
|
313
|
+
if (tokens.source !== 'provider' || typeof tokens.input !== 'number') {
|
|
314
|
+
return [
|
|
315
|
+
ctx.t('command.context.unknown', { window: window.toLocaleString() }),
|
|
316
|
+
ctx.t('command.context.waiting'),
|
|
317
|
+
ctx.t('command.context.noEstimate'),
|
|
318
|
+
].join('\n');
|
|
319
|
+
}
|
|
320
|
+
const used = tokens.input;
|
|
321
|
+
const pct = Math.round((used / window) * 100);
|
|
322
|
+
const bar = renderBar(pct, 30);
|
|
323
|
+
return [
|
|
324
|
+
ctx.t('command.context.usage', { used: used.toLocaleString(), window: window.toLocaleString(), percent: pct }),
|
|
325
|
+
bar,
|
|
326
|
+
ctx.t('command.context.input', { tokens: tokens.input.toLocaleString() }),
|
|
327
|
+
ctx.t('command.context.output', { tokens: (tokens.output ?? 0).toLocaleString() }),
|
|
328
|
+
].join('\n');
|
|
329
|
+
},
|
|
330
|
+
});
|
|
331
|
+
commandRegistry.register({
|
|
332
|
+
name: 'theme',
|
|
333
|
+
descriptionKey: 'command.theme.description',
|
|
334
|
+
argumentHint: '[dark|light]',
|
|
335
|
+
type: 'local',
|
|
336
|
+
execute: (args, ctx) => {
|
|
337
|
+
if (!args || !['dark', 'light'].includes(args.trim())) {
|
|
338
|
+
return ctx.t('command.theme.usage');
|
|
339
|
+
}
|
|
340
|
+
return ctx.t('command.theme.switched', { theme: args.trim() });
|
|
341
|
+
},
|
|
342
|
+
});
|
|
343
|
+
commandRegistry.register({
|
|
344
|
+
name: 'effort',
|
|
345
|
+
descriptionKey: 'command.effort.description',
|
|
346
|
+
argumentHint: '[level]',
|
|
347
|
+
showsProgress: args => Boolean(args.trim()),
|
|
348
|
+
type: 'local',
|
|
349
|
+
execute: (args, ctx) => {
|
|
350
|
+
const capability = getModelReasoningCapabilities(ctx.config.model, ctx.config.provider, ctx.config.modelCapabilities);
|
|
351
|
+
if (!capability)
|
|
352
|
+
return ctx.t('command.effort.unsupported', { model: ctx.config.model || ctx.t('command.effort.thisModel') });
|
|
353
|
+
const input = args.trim().toLowerCase();
|
|
354
|
+
const current = formatNativeReasoningSetting(ctx.config.model, ctx.config.reasoning, ctx.config.provider, ctx.config.modelCapabilities);
|
|
355
|
+
if (!input) {
|
|
356
|
+
const available = [
|
|
357
|
+
capability.efforts.length > 0 ? capability.efforts.join('/') : null,
|
|
358
|
+
capability.supportsToggle ? 'on/off' : null,
|
|
359
|
+
capability.control === 'budget' ? ctx.t('command.effort.budget') : null,
|
|
360
|
+
].filter(Boolean).join(', ');
|
|
361
|
+
return ctx.t('command.effort.summary', { current: current || ctx.t('common.providerDefault'), available: available || ctx.t('command.effort.fixed') });
|
|
362
|
+
}
|
|
363
|
+
let next;
|
|
364
|
+
if (input === 'on' || input === 'off') {
|
|
365
|
+
if (!capability.supportsToggle)
|
|
366
|
+
return ctx.t('command.effort.noToggle');
|
|
367
|
+
next = setConfigValue(ctx.config, 'reasoningEnabled', input);
|
|
368
|
+
}
|
|
369
|
+
else if (capability.efforts.includes(input)) {
|
|
370
|
+
next = setConfigValue(ctx.config, 'reasoningEffort', input);
|
|
371
|
+
}
|
|
372
|
+
else if (capability.control === 'budget' && /^\d+$/.test(input)) {
|
|
373
|
+
next = setConfigValue(ctx.config, 'reasoningBudgetTokens', input);
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
const available = capability.control === 'budget'
|
|
377
|
+
? ctx.t('command.effort.budgetOptions')
|
|
378
|
+
: [...capability.efforts, ...(capability.supportsToggle ? ['on', 'off'] : [])].join(', ') || ctx.t('command.effort.fixed');
|
|
379
|
+
return ctx.t('command.effort.available', { available });
|
|
380
|
+
}
|
|
381
|
+
ctx.setConfig(next);
|
|
382
|
+
return ctx.t('command.effort.set', { effort: formatNativeReasoningSetting(next.model, next.reasoning, next.provider, next.modelCapabilities) });
|
|
383
|
+
},
|
|
384
|
+
});
|
|
385
|
+
commandRegistry.register({
|
|
386
|
+
name: 'approval',
|
|
387
|
+
descriptionKey: 'command.approval.description',
|
|
388
|
+
argumentHint: '[ask|agent|full]',
|
|
389
|
+
showsProgress: args => Boolean(args.trim()),
|
|
390
|
+
type: 'local',
|
|
391
|
+
execute: (args, ctx) => {
|
|
392
|
+
const input = args.trim().toLowerCase();
|
|
393
|
+
if (!input) {
|
|
394
|
+
return ctx.t('command.approval.current', { label: approvalLabel(ctx.config.approvalPolicy, ctx), policy: ctx.config.approvalPolicy });
|
|
395
|
+
}
|
|
396
|
+
if (!['ask', 'agent', 'full', 'request', 'auto'].includes(input)) {
|
|
397
|
+
return ctx.t('command.approval.usage');
|
|
398
|
+
}
|
|
399
|
+
const policy = normalizeApprovalPolicy(input, ctx.config.approvalPolicy);
|
|
400
|
+
const next = setConfigValue(ctx.config, 'approvalPolicy', policy);
|
|
401
|
+
ctx.setConfig(next);
|
|
402
|
+
return `${approvalLabel(policy, ctx)}.`;
|
|
403
|
+
},
|
|
404
|
+
});
|
|
405
|
+
commandRegistry.register({
|
|
406
|
+
name: 'capability',
|
|
407
|
+
descriptionKey: 'command.capability.description',
|
|
408
|
+
argumentHint: '[read-only|workspace-write|danger-full-access]',
|
|
409
|
+
showsProgress: args => Boolean(args.trim()),
|
|
410
|
+
type: 'local',
|
|
411
|
+
execute: (args, ctx) => {
|
|
412
|
+
const input = args.trim().toLowerCase();
|
|
413
|
+
const current = ctx.config.capabilityProfile || 'workspace-write';
|
|
414
|
+
if (!input) {
|
|
415
|
+
return ctx.t('command.capability.current', { label: capabilityLabel(current), profile: current });
|
|
416
|
+
}
|
|
417
|
+
if (!['read-only', 'workspace-write', 'danger-full-access'].includes(input)) {
|
|
418
|
+
return ctx.t('command.capability.usage');
|
|
419
|
+
}
|
|
420
|
+
const profile = normalizeCapabilityProfile(input, current);
|
|
421
|
+
const next = setConfigValue(ctx.config, 'capabilityProfile', profile);
|
|
422
|
+
ctx.setConfig(next);
|
|
423
|
+
return ctx.t('command.capability.set', { label: capabilityLabel(profile), profile });
|
|
424
|
+
},
|
|
425
|
+
});
|
|
426
|
+
function approvalLabel(policy, ctx) {
|
|
427
|
+
if (policy === 'ask')
|
|
428
|
+
return ctx.t('command.approval.ask');
|
|
429
|
+
if (policy === 'agent')
|
|
430
|
+
return ctx.t('command.approval.agent');
|
|
431
|
+
return ctx.t('command.approval.full');
|
|
432
|
+
}
|
|
433
|
+
function executeStopCommand(args, ctx, wait = false) {
|
|
434
|
+
const manager = ctx.runtimeTaskManager;
|
|
435
|
+
if (!manager)
|
|
436
|
+
return wait ? Promise.resolve(ctx.t('command.stop.unavailable')) : ctx.t('command.stop.unavailable');
|
|
437
|
+
const requested = args.trim();
|
|
438
|
+
const active = manager.listTasks({ kind: 'terminal' }).filter(task => task.status === 'starting' || task.status === 'running' || task.status === 'stopping');
|
|
439
|
+
const targets = !requested || requested === 'all'
|
|
440
|
+
? active
|
|
441
|
+
: active.filter(task => task.id === requested || task.metadata?.sessionId === requested);
|
|
442
|
+
const response = targets.length === 0
|
|
443
|
+
? (requested ? ctx.t('command.stop.noMatch', { session: requested }) : ctx.t('command.stop.none'))
|
|
444
|
+
: targets.some(task => task.metadata?.recovered === true && task.metadata?.controlAvailable === false)
|
|
445
|
+
? ctx.t('command.stop.readOnly', {
|
|
446
|
+
count: targets.filter(task => task.metadata?.recovered === true && task.metadata?.controlAvailable === false).length,
|
|
447
|
+
})
|
|
448
|
+
: null;
|
|
449
|
+
if (response)
|
|
450
|
+
return wait ? Promise.resolve(response) : response;
|
|
451
|
+
const stopping = Promise.all(targets.map(task => manager.stopTask(task.id, ctx.t('command.stop.reason')).catch(() => undefined)));
|
|
452
|
+
const message = ctx.t(targets.length === 1 ? 'command.stop.stoppingOne' : 'command.stop.stopping', { count: targets.length });
|
|
453
|
+
if (!wait) {
|
|
454
|
+
void stopping;
|
|
455
|
+
return message;
|
|
456
|
+
}
|
|
457
|
+
return stopping.then(() => message);
|
|
458
|
+
}
|
|
459
|
+
function capabilityLabel(profile) {
|
|
460
|
+
return CAPABILITY_PROFILE_LABELS[profile];
|
|
461
|
+
}
|
|
462
|
+
function renderBar(pct, width) {
|
|
463
|
+
const filled = Math.round((pct / 100) * width);
|
|
464
|
+
const empty = width - filled;
|
|
465
|
+
const bar = '#'.repeat(filled) + '-'.repeat(empty);
|
|
466
|
+
return ` [${bar}]`;
|
|
467
|
+
}
|
|
468
|
+
function formatRuntimeDuration(ms) {
|
|
469
|
+
const seconds = Math.max(0, Math.floor(ms / 1000));
|
|
470
|
+
if (seconds < 60)
|
|
471
|
+
return `${seconds}s`;
|
|
472
|
+
const minutes = Math.floor(seconds / 60);
|
|
473
|
+
if (minutes < 60)
|
|
474
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
475
|
+
const hours = Math.floor(minutes / 60);
|
|
476
|
+
return `${hours}h ${minutes % 60}m`;
|
|
477
|
+
}
|
|
478
|
+
function formatRuntimeBytes(bytes) {
|
|
479
|
+
if (bytes < 1024)
|
|
480
|
+
return `${bytes} B`;
|
|
481
|
+
if (bytes < 1024 * 1024)
|
|
482
|
+
return `${(bytes / 1024).toFixed(1)} KiB`;
|
|
483
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MiB`;
|
|
484
|
+
}
|
|
485
|
+
commandRegistry.register({
|
|
486
|
+
name: 'mcp',
|
|
487
|
+
descriptionKey: 'command.mcp.description',
|
|
488
|
+
argumentHint: '[status|tools]',
|
|
489
|
+
type: 'local',
|
|
490
|
+
execute: (args, ctx) => {
|
|
491
|
+
if (!ctx.mcpClient)
|
|
492
|
+
return ctx.t('command.mcp.uninitialized');
|
|
493
|
+
const connections = ctx.mcpClient.getAllConnections();
|
|
494
|
+
if (connections.length === 0)
|
|
495
|
+
return ctx.t('command.mcp.none');
|
|
496
|
+
if (args === 'tools') {
|
|
497
|
+
const tools = ctx.mcpClient.getAllTools();
|
|
498
|
+
if (tools.length === 0)
|
|
499
|
+
return ctx.t('command.mcp.noTools');
|
|
500
|
+
const lines = tools.map(t => ` ${t.name} - ${t.description.slice(0, 60)}`);
|
|
501
|
+
return `${ctx.t('command.mcp.tools', { count: tools.length })}\n${lines.join('\n')}`;
|
|
502
|
+
}
|
|
503
|
+
const lines = connections.map(c => {
|
|
504
|
+
const status = c.status === 'connected' ? 'ok' : c.status === 'error' ? 'error' : 'pending';
|
|
505
|
+
const toolCount = c.tools.length;
|
|
506
|
+
const err = c.error ? ` (${c.error})` : '';
|
|
507
|
+
return ` ${status} ${c.name} - ${c.status}, ${ctx.t('command.mcp.toolCount', { count: toolCount })}${err}`;
|
|
508
|
+
});
|
|
509
|
+
return `${ctx.t('command.mcp.servers', { count: connections.length })}\n${lines.join('\n')}\n\n${ctx.t('command.mcp.hint')}`;
|
|
510
|
+
},
|
|
511
|
+
});
|
|
512
|
+
commandRegistry.register({
|
|
513
|
+
name: 'skills',
|
|
514
|
+
descriptionKey: 'command.skills.description',
|
|
515
|
+
type: 'local',
|
|
516
|
+
execute: (_args, ctx) => {
|
|
517
|
+
if (!ctx.skillRuntime)
|
|
518
|
+
return ctx.t('command.skills.unavailable');
|
|
519
|
+
const skills = ctx.skillRuntime.getAll();
|
|
520
|
+
if (skills.length === 0)
|
|
521
|
+
return ctx.t('command.skills.none');
|
|
522
|
+
const active = ctx.skillRuntime.getActiveSkillId();
|
|
523
|
+
const lines = skills.map(s => {
|
|
524
|
+
const marker = s.id === active ? ctx.t('command.skills.active') : '';
|
|
525
|
+
return ` ${s.command} - ${s.description}${marker}`;
|
|
526
|
+
});
|
|
527
|
+
return `${ctx.t('command.skills.available', { count: skills.length })}\n${lines.join('\n')}`;
|
|
528
|
+
},
|
|
529
|
+
});
|
|
530
|
+
commandRegistry.register({
|
|
531
|
+
name: 'new',
|
|
532
|
+
descriptionKey: 'command.new.description',
|
|
533
|
+
showsProgress: true,
|
|
534
|
+
type: 'local',
|
|
535
|
+
execute: (_args, ctx) => {
|
|
536
|
+
if (!ctx.conversationManager)
|
|
537
|
+
return ctx.t('command.conversation.unavailable');
|
|
538
|
+
try {
|
|
539
|
+
ctx.conversationManager.startNew();
|
|
540
|
+
}
|
|
541
|
+
catch {
|
|
542
|
+
return ctx.t('command.conversation.persistenceBlocked');
|
|
543
|
+
}
|
|
544
|
+
ctx.engine.resetSession();
|
|
545
|
+
ctx.setMessages([]);
|
|
546
|
+
return ctx.t('command.conversation.started');
|
|
547
|
+
},
|
|
548
|
+
});
|
|
549
|
+
commandRegistry.register({
|
|
550
|
+
name: 'list',
|
|
551
|
+
descriptionKey: 'command.list.description',
|
|
552
|
+
aliases: ['conversations'],
|
|
553
|
+
showsProgress: true,
|
|
554
|
+
type: 'local',
|
|
555
|
+
execute: (_args, ctx) => {
|
|
556
|
+
if (!ctx.conversationManager)
|
|
557
|
+
return ctx.t('command.conversation.unavailable');
|
|
558
|
+
const convs = ctx.conversationManager.list();
|
|
559
|
+
if (convs.length === 0)
|
|
560
|
+
return ctx.t('command.conversation.none');
|
|
561
|
+
const lines = convs.slice(0, 20).map((c, i) => {
|
|
562
|
+
const date = new Date(c.updatedAt).toLocaleString();
|
|
563
|
+
const current = c.id === ctx.conversationManager.getCurrentId() ? ' *' : '';
|
|
564
|
+
return ` ${i + 1}. ${c.title} (${ctx.t('command.conversation.turns', { count: c.turnCount })}, ${date})${current}\n ${ctx.t('command.conversation.id', { id: c.id })}`;
|
|
565
|
+
});
|
|
566
|
+
return `${ctx.t('command.conversation.total', { count: convs.length })}\n${lines.join('\n')}`;
|
|
567
|
+
},
|
|
568
|
+
executeAsync: async (_args, ctx) => {
|
|
569
|
+
if (!ctx.conversationManager)
|
|
570
|
+
return ctx.t('command.conversation.unavailable');
|
|
571
|
+
const convs = await ctx.conversationManager.listAsync();
|
|
572
|
+
if (convs.length === 0)
|
|
573
|
+
return ctx.t('command.conversation.none');
|
|
574
|
+
const lines = convs.slice(0, 20).map((c, i) => {
|
|
575
|
+
const date = new Date(c.updatedAt).toLocaleString();
|
|
576
|
+
const current = c.id === ctx.conversationManager.getCurrentId() ? ' *' : '';
|
|
577
|
+
return ` ${i + 1}. ${c.title} (${ctx.t('command.conversation.turns', { count: c.turnCount })}, ${date})${current}\n ${ctx.t('command.conversation.id', { id: c.id })}`;
|
|
578
|
+
});
|
|
579
|
+
return `${ctx.t('command.conversation.total', { count: convs.length })}\n${lines.join('\n')}`;
|
|
580
|
+
},
|
|
581
|
+
});
|
|
582
|
+
commandRegistry.register({
|
|
583
|
+
name: 'resume',
|
|
584
|
+
descriptionKey: 'command.resume.description',
|
|
585
|
+
showsProgress: true,
|
|
586
|
+
type: 'local',
|
|
587
|
+
execute: () => {
|
|
588
|
+
return '';
|
|
589
|
+
},
|
|
590
|
+
});
|
|
591
|
+
commandRegistry.register({
|
|
592
|
+
name: 'init',
|
|
593
|
+
descriptionKey: 'command.init.description',
|
|
594
|
+
isHidden: true,
|
|
595
|
+
showsProgress: true,
|
|
596
|
+
type: 'local',
|
|
597
|
+
execute: (_args, ctx) => {
|
|
598
|
+
const wsPath = ctx.workspacePath || process.cwd();
|
|
599
|
+
const targetPath = join(wsPath, 'TURBOFLUX.md');
|
|
600
|
+
if (existsSync(targetPath)) {
|
|
601
|
+
return ctx.t('command.init.active', { path: targetPath });
|
|
602
|
+
}
|
|
603
|
+
ensureProjectInstructions(wsPath, ctx.t);
|
|
604
|
+
return ctx.t('command.init.created', { path: targetPath });
|
|
605
|
+
},
|
|
606
|
+
});
|
|
607
|
+
export function ensureProjectInstructions(wsPath, t = DEFAULT_TRANSLATOR) {
|
|
608
|
+
const targetPath = join(wsPath, 'TURBOFLUX.md');
|
|
609
|
+
if (existsSync(targetPath))
|
|
610
|
+
return null;
|
|
611
|
+
const projectName = wsPath.split(/[\\/]/).pop() || 'my-project';
|
|
612
|
+
const techStack = detectTechStack(wsPath, t);
|
|
613
|
+
const structure = scanTopLevel(wsPath, t);
|
|
614
|
+
const template = t('command.init.template', { projectName, techStack, structure });
|
|
615
|
+
writeFileSync(targetPath, template, 'utf-8');
|
|
616
|
+
return targetPath;
|
|
617
|
+
}
|
|
618
|
+
function detectTechStack(wsPath, t) {
|
|
619
|
+
const indicators = [];
|
|
620
|
+
const has = (f) => existsSync(join(wsPath, f));
|
|
621
|
+
if (has('package.json')) {
|
|
622
|
+
try {
|
|
623
|
+
const pkg = JSON.parse(readFileSync(join(wsPath, 'package.json'), 'utf-8'));
|
|
624
|
+
if (pkg.dependencies?.react || pkg.devDependencies?.react)
|
|
625
|
+
indicators.push('React');
|
|
626
|
+
if (pkg.dependencies?.vue || pkg.devDependencies?.vue)
|
|
627
|
+
indicators.push('Vue');
|
|
628
|
+
if (pkg.dependencies?.next)
|
|
629
|
+
indicators.push('Next.js');
|
|
630
|
+
if (pkg.dependencies?.express || pkg.dependencies?.hono)
|
|
631
|
+
indicators.push('Node.js Server');
|
|
632
|
+
if (pkg.devDependencies?.typescript)
|
|
633
|
+
indicators.push('TypeScript');
|
|
634
|
+
if (pkg.devDependencies?.vitest)
|
|
635
|
+
indicators.push('Vitest');
|
|
636
|
+
if (pkg.devDependencies?.tsx)
|
|
637
|
+
indicators.push('TSX');
|
|
638
|
+
}
|
|
639
|
+
catch { }
|
|
640
|
+
}
|
|
641
|
+
if (has('Cargo.toml'))
|
|
642
|
+
indicators.push('Rust');
|
|
643
|
+
if (has('go.mod'))
|
|
644
|
+
indicators.push('Go');
|
|
645
|
+
if (has('pom.xml') || has('build.gradle'))
|
|
646
|
+
indicators.push('Java');
|
|
647
|
+
if (has('requirements.txt') || has('pyproject.toml'))
|
|
648
|
+
indicators.push('Python');
|
|
649
|
+
if (has('tsconfig.json'))
|
|
650
|
+
indicators.push('TypeScript');
|
|
651
|
+
if (indicators.length === 0)
|
|
652
|
+
return t('command.init.unknownStack');
|
|
653
|
+
return indicators.map(t => `- ${t}`).join('\n');
|
|
654
|
+
}
|
|
655
|
+
function scanTopLevel(wsPath, t) {
|
|
656
|
+
try {
|
|
657
|
+
const entries = readdirSync(wsPath, { withFileTypes: true })
|
|
658
|
+
.filter(e => !e.name.startsWith('.') && e.name !== 'node_modules' && e.name !== 'dist')
|
|
659
|
+
.slice(0, 15);
|
|
660
|
+
const lines = entries.map(e => {
|
|
661
|
+
const suffix = e.isDirectory() ? '/' : '';
|
|
662
|
+
return `- ${e.name}${suffix}`;
|
|
663
|
+
});
|
|
664
|
+
return lines.join('\n') || t('command.init.empty');
|
|
665
|
+
}
|
|
666
|
+
catch {
|
|
667
|
+
return t('command.init.scanFailed');
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
export { commandRegistry };
|
|
671
|
+
//# sourceMappingURL=index.js.map
|