orquesta-cli 0.1.13 → 0.1.14
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 +30 -4
- package/dist/cli.js +65 -4
- package/dist/core/config/config-manager.d.ts +13 -1
- package/dist/core/config/config-manager.js +83 -0
- package/dist/core/slash-command-handler.d.ts +1 -0
- package/dist/core/slash-command-handler.js +129 -0
- package/dist/orquesta/config-sync.d.ts +73 -0
- package/dist/orquesta/config-sync.js +230 -0
- package/dist/orquesta/prompt-reporter.d.ts +16 -0
- package/dist/orquesta/prompt-reporter.js +85 -0
- package/dist/setup/first-run-setup.d.ts +15 -0
- package/dist/setup/first-run-setup.js +238 -0
- package/dist/types/index.d.ts +11 -2
- package/dist/ui/TodoPanel.d.ts +1 -0
- package/dist/ui/TodoPanel.js +6 -1
- package/dist/ui/components/LLMSetupWizard.js +373 -7
- package/dist/ui/components/Logo.d.ts +2 -0
- package/dist/ui/components/Logo.js +10 -3
- package/dist/ui/components/OpenRouterModelBrowser.d.ts +13 -0
- package/dist/ui/components/OpenRouterModelBrowser.js +221 -0
- package/dist/ui/components/PlanExecuteApp.js +30 -4
- package/dist/ui/components/ProjectSelector.d.ts +8 -0
- package/dist/ui/components/ProjectSelector.js +119 -0
- package/dist/ui/components/StatusBar.d.ts +2 -0
- package/dist/ui/components/StatusBar.js +6 -1
- package/dist/ui/hooks/slashCommandProcessor.js +8 -4
- package/package.json +11 -5
- package/.eslintrc.json +0 -26
- package/.prettierrc.json +0 -10
- package/CLAUDE.md +0 -199
- package/SECURITY.md +0 -290
- package/TEST_LOCAL.md +0 -245
- package/dist/agents/base/base-agent.d.ts.map +0 -1
- package/dist/agents/base/base-agent.js.map +0 -1
- package/dist/agents/docs-search/index.d.ts.map +0 -1
- package/dist/agents/docs-search/index.js.map +0 -1
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/planner/index.d.ts.map +0 -1
- package/dist/agents/planner/index.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/core/compact/compact-manager.d.ts.map +0 -1
- package/dist/core/compact/compact-manager.js.map +0 -1
- package/dist/core/compact/compact-prompts.d.ts.map +0 -1
- package/dist/core/compact/compact-prompts.js.map +0 -1
- package/dist/core/compact/context-tracker.d.ts.map +0 -1
- package/dist/core/compact/context-tracker.js.map +0 -1
- package/dist/core/compact/index.d.ts.map +0 -1
- package/dist/core/compact/index.js.map +0 -1
- package/dist/core/config/config-manager.d.ts.map +0 -1
- package/dist/core/config/config-manager.js.map +0 -1
- package/dist/core/config/index.d.ts.map +0 -1
- package/dist/core/config/index.js.map +0 -1
- package/dist/core/docs-manager.d.ts.map +0 -1
- package/dist/core/docs-manager.js.map +0 -1
- package/dist/core/git-auto-updater.d.ts.map +0 -1
- package/dist/core/git-auto-updater.js.map +0 -1
- package/dist/core/llm/index.d.ts.map +0 -1
- package/dist/core/llm/index.js.map +0 -1
- package/dist/core/llm/llm-client.d.ts.map +0 -1
- package/dist/core/llm/llm-client.js.map +0 -1
- package/dist/core/session/index.d.ts.map +0 -1
- package/dist/core/session/index.js.map +0 -1
- package/dist/core/session/session-manager.d.ts.map +0 -1
- package/dist/core/session/session-manager.js.map +0 -1
- package/dist/core/slash-command-handler.d.ts.map +0 -1
- package/dist/core/slash-command-handler.js.map +0 -1
- package/dist/core/usage-tracker.d.ts.map +0 -1
- package/dist/core/usage-tracker.js.map +0 -1
- package/dist/errors/base.d.ts.map +0 -1
- package/dist/errors/base.js.map +0 -1
- package/dist/errors/file.d.ts.map +0 -1
- package/dist/errors/file.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/errors/llm.d.ts.map +0 -1
- package/dist/errors/llm.js.map +0 -1
- package/dist/errors/network.d.ts.map +0 -1
- package/dist/errors/network.js.map +0 -1
- package/dist/errors/validation.d.ts.map +0 -1
- package/dist/errors/validation.js.map +0 -1
- package/dist/eval/eval-runner.d.ts.map +0 -1
- package/dist/eval/eval-runner.js.map +0 -1
- package/dist/eval/index.d.ts.map +0 -1
- package/dist/eval/index.js.map +0 -1
- package/dist/eval/types.d.ts.map +0 -1
- package/dist/eval/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/orchestration/index.d.ts.map +0 -1
- package/dist/orchestration/index.js.map +0 -1
- package/dist/orchestration/plan-executor.d.ts.map +0 -1
- package/dist/orchestration/plan-executor.js.map +0 -1
- package/dist/orchestration/types.d.ts.map +0 -1
- package/dist/orchestration/types.js.map +0 -1
- package/dist/orchestration/utils.d.ts.map +0 -1
- package/dist/orchestration/utils.js.map +0 -1
- package/dist/orquesta/connection.d.ts.map +0 -1
- package/dist/orquesta/connection.js.map +0 -1
- package/dist/prompts/agents/docs-search-decision.d.ts.map +0 -1
- package/dist/prompts/agents/docs-search-decision.js.map +0 -1
- package/dist/prompts/agents/docs-search.d.ts.map +0 -1
- package/dist/prompts/agents/docs-search.js.map +0 -1
- package/dist/prompts/agents/planning.d.ts.map +0 -1
- package/dist/prompts/agents/planning.js.map +0 -1
- package/dist/prompts/index.d.ts.map +0 -1
- package/dist/prompts/index.js.map +0 -1
- package/dist/prompts/shared/codebase-rules.d.ts.map +0 -1
- package/dist/prompts/shared/codebase-rules.js.map +0 -1
- package/dist/prompts/shared/git-rules.d.ts.map +0 -1
- package/dist/prompts/shared/git-rules.js.map +0 -1
- package/dist/prompts/shared/language-rules.d.ts.map +0 -1
- package/dist/prompts/shared/language-rules.js.map +0 -1
- package/dist/prompts/shared/tool-usage.d.ts.map +0 -1
- package/dist/prompts/shared/tool-usage.js.map +0 -1
- package/dist/prompts/system/compact.d.ts.map +0 -1
- package/dist/prompts/system/compact.js.map +0 -1
- package/dist/prompts/system/plan-execute.d.ts.map +0 -1
- package/dist/prompts/system/plan-execute.js.map +0 -1
- package/dist/tools/browser/browser-client.d.ts.map +0 -1
- package/dist/tools/browser/browser-client.js.map +0 -1
- package/dist/tools/browser/browser-tools.d.ts.map +0 -1
- package/dist/tools/browser/browser-tools.js.map +0 -1
- package/dist/tools/browser/index.d.ts.map +0 -1
- package/dist/tools/browser/index.js.map +0 -1
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/llm/agents/docs-search-tools.d.ts.map +0 -1
- package/dist/tools/llm/agents/docs-search-tools.js.map +0 -1
- package/dist/tools/llm/agents/index.d.ts.map +0 -1
- package/dist/tools/llm/agents/index.js.map +0 -1
- package/dist/tools/llm/index.d.ts.map +0 -1
- package/dist/tools/llm/index.js.map +0 -1
- package/dist/tools/llm/simple/ask-user-tool.d.ts.map +0 -1
- package/dist/tools/llm/simple/ask-user-tool.js.map +0 -1
- package/dist/tools/llm/simple/background-bash-tool.d.ts.map +0 -1
- package/dist/tools/llm/simple/background-bash-tool.js.map +0 -1
- package/dist/tools/llm/simple/background-powershell-tool.d.ts.map +0 -1
- package/dist/tools/llm/simple/background-powershell-tool.js.map +0 -1
- package/dist/tools/llm/simple/bash-tool.d.ts.map +0 -1
- package/dist/tools/llm/simple/bash-tool.js.map +0 -1
- package/dist/tools/llm/simple/docs-search-agent-tool.d.ts.map +0 -1
- package/dist/tools/llm/simple/docs-search-agent-tool.js.map +0 -1
- package/dist/tools/llm/simple/file-tools.d.ts.map +0 -1
- package/dist/tools/llm/simple/file-tools.js.map +0 -1
- package/dist/tools/llm/simple/final-response-tool.d.ts.map +0 -1
- package/dist/tools/llm/simple/final-response-tool.js.map +0 -1
- package/dist/tools/llm/simple/index.d.ts.map +0 -1
- package/dist/tools/llm/simple/index.js.map +0 -1
- package/dist/tools/llm/simple/planning-tools.d.ts.map +0 -1
- package/dist/tools/llm/simple/planning-tools.js.map +0 -1
- package/dist/tools/llm/simple/powershell-tool.d.ts.map +0 -1
- package/dist/tools/llm/simple/powershell-tool.js.map +0 -1
- package/dist/tools/llm/simple/simple-tool-executor.d.ts.map +0 -1
- package/dist/tools/llm/simple/simple-tool-executor.js.map +0 -1
- package/dist/tools/llm/simple/todo-tools.d.ts.map +0 -1
- package/dist/tools/llm/simple/todo-tools.js.map +0 -1
- package/dist/tools/llm/simple/user-interaction-tools.d.ts.map +0 -1
- package/dist/tools/llm/simple/user-interaction-tools.js.map +0 -1
- package/dist/tools/office/common/constants.d.ts.map +0 -1
- package/dist/tools/office/common/constants.js.map +0 -1
- package/dist/tools/office/common/index.d.ts.map +0 -1
- package/dist/tools/office/common/index.js.map +0 -1
- package/dist/tools/office/common/types.d.ts.map +0 -1
- package/dist/tools/office/common/types.js.map +0 -1
- package/dist/tools/office/common/utils.d.ts.map +0 -1
- package/dist/tools/office/common/utils.js.map +0 -1
- package/dist/tools/office/excel-client.d.ts.map +0 -1
- package/dist/tools/office/excel-client.js.map +0 -1
- package/dist/tools/office/excel-tools/cells.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/cells.js.map +0 -1
- package/dist/tools/office/excel-tools/charts.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/charts.js.map +0 -1
- package/dist/tools/office/excel-tools/comments.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/comments.js.map +0 -1
- package/dist/tools/office/excel-tools/data-ops.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/data-ops.js.map +0 -1
- package/dist/tools/office/excel-tools/export.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/export.js.map +0 -1
- package/dist/tools/office/excel-tools/formatting.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/formatting.js.map +0 -1
- package/dist/tools/office/excel-tools/index.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/index.js.map +0 -1
- package/dist/tools/office/excel-tools/launch.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/launch.js.map +0 -1
- package/dist/tools/office/excel-tools/media.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/media.js.map +0 -1
- package/dist/tools/office/excel-tools/named-ranges.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/named-ranges.js.map +0 -1
- package/dist/tools/office/excel-tools/protection.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/protection.js.map +0 -1
- package/dist/tools/office/excel-tools/rows-columns.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/rows-columns.js.map +0 -1
- package/dist/tools/office/excel-tools/sheets.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/sheets.js.map +0 -1
- package/dist/tools/office/excel-tools/validation.d.ts.map +0 -1
- package/dist/tools/office/excel-tools/validation.js.map +0 -1
- package/dist/tools/office/excel-tools.d.ts.map +0 -1
- package/dist/tools/office/excel-tools.js.map +0 -1
- package/dist/tools/office/index.d.ts.map +0 -1
- package/dist/tools/office/index.js.map +0 -1
- package/dist/tools/office/office-client-base.d.ts.map +0 -1
- package/dist/tools/office/office-client-base.js.map +0 -1
- package/dist/tools/office/office-client.d.ts.map +0 -1
- package/dist/tools/office/office-client.js.map +0 -1
- package/dist/tools/office/powerpoint-client.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-client.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/effects.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/effects.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/export.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/export.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/index.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/index.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/launch.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/launch.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/media.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/media.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/notes.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/notes.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/sections.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/sections.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/shapes.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/shapes.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/slides.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/slides.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/tables.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/tables.js.map +0 -1
- package/dist/tools/office/powerpoint-tools/text.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools/text.js.map +0 -1
- package/dist/tools/office/powerpoint-tools.d.ts.map +0 -1
- package/dist/tools/office/powerpoint-tools.js.map +0 -1
- package/dist/tools/office/word-client.d.ts.map +0 -1
- package/dist/tools/office/word-client.js.map +0 -1
- package/dist/tools/office/word-tools/bookmarks.d.ts.map +0 -1
- package/dist/tools/office/word-tools/bookmarks.js.map +0 -1
- package/dist/tools/office/word-tools/comments.d.ts.map +0 -1
- package/dist/tools/office/word-tools/comments.js.map +0 -1
- package/dist/tools/office/word-tools/content.d.ts.map +0 -1
- package/dist/tools/office/word-tools/content.js.map +0 -1
- package/dist/tools/office/word-tools/export.d.ts.map +0 -1
- package/dist/tools/office/word-tools/export.js.map +0 -1
- package/dist/tools/office/word-tools/formatting.d.ts.map +0 -1
- package/dist/tools/office/word-tools/formatting.js.map +0 -1
- package/dist/tools/office/word-tools/headers-footers.d.ts.map +0 -1
- package/dist/tools/office/word-tools/headers-footers.js.map +0 -1
- package/dist/tools/office/word-tools/index.d.ts.map +0 -1
- package/dist/tools/office/word-tools/index.js.map +0 -1
- package/dist/tools/office/word-tools/launch.d.ts.map +0 -1
- package/dist/tools/office/word-tools/launch.js.map +0 -1
- package/dist/tools/office/word-tools/lists.d.ts.map +0 -1
- package/dist/tools/office/word-tools/lists.js.map +0 -1
- package/dist/tools/office/word-tools/navigation.d.ts.map +0 -1
- package/dist/tools/office/word-tools/navigation.js.map +0 -1
- package/dist/tools/office/word-tools/page-setup.d.ts.map +0 -1
- package/dist/tools/office/word-tools/page-setup.js.map +0 -1
- package/dist/tools/office/word-tools/tables.d.ts.map +0 -1
- package/dist/tools/office/word-tools/tables.js.map +0 -1
- package/dist/tools/office/word-tools/text.d.ts.map +0 -1
- package/dist/tools/office/word-tools/text.js.map +0 -1
- package/dist/tools/office/word-tools/undo-redo.d.ts.map +0 -1
- package/dist/tools/office/word-tools/undo-redo.js.map +0 -1
- package/dist/tools/office/word-tools/watermarks.d.ts.map +0 -1
- package/dist/tools/office/word-tools/watermarks.js.map +0 -1
- package/dist/tools/office/word-tools.d.ts.map +0 -1
- package/dist/tools/office/word-tools.js.map +0 -1
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/types.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/ui/PlanExecuteView.d.ts.map +0 -1
- package/dist/ui/PlanExecuteView.js.map +0 -1
- package/dist/ui/TodoPanel.d.ts.map +0 -1
- package/dist/ui/TodoPanel.js.map +0 -1
- package/dist/ui/UpdateNotification.d.ts.map +0 -1
- package/dist/ui/UpdateNotification.js.map +0 -1
- package/dist/ui/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/ui/components/ActivityIndicator.js.map +0 -1
- package/dist/ui/components/CommandBrowser.d.ts.map +0 -1
- package/dist/ui/components/CommandBrowser.js.map +0 -1
- package/dist/ui/components/CustomTextInput.d.ts.map +0 -1
- package/dist/ui/components/CustomTextInput.js.map +0 -1
- package/dist/ui/components/DocsSearchProgress.d.ts.map +0 -1
- package/dist/ui/components/DocsSearchProgress.js.map +0 -1
- package/dist/ui/components/FileBrowser.d.ts.map +0 -1
- package/dist/ui/components/FileBrowser.js.map +0 -1
- package/dist/ui/components/LLMSetupWizard.d.ts.map +0 -1
- package/dist/ui/components/LLMSetupWizard.js.map +0 -1
- package/dist/ui/components/Logo.d.ts.map +0 -1
- package/dist/ui/components/Logo.js.map +0 -1
- package/dist/ui/components/MarkdownRenderer.d.ts.map +0 -1
- package/dist/ui/components/MarkdownRenderer.js.map +0 -1
- package/dist/ui/components/ModelSelector.d.ts.map +0 -1
- package/dist/ui/components/ModelSelector.js.map +0 -1
- package/dist/ui/components/PlanExecuteApp.d.ts.map +0 -1
- package/dist/ui/components/PlanExecuteApp.js.map +0 -1
- package/dist/ui/components/ProgressBar.d.ts.map +0 -1
- package/dist/ui/components/ProgressBar.js.map +0 -1
- package/dist/ui/components/StatusBar.d.ts.map +0 -1
- package/dist/ui/components/StatusBar.js.map +0 -1
- package/dist/ui/components/ThinkingIndicator.d.ts.map +0 -1
- package/dist/ui/components/ThinkingIndicator.js.map +0 -1
- package/dist/ui/components/TodoListView.d.ts.map +0 -1
- package/dist/ui/components/TodoListView.js.map +0 -1
- package/dist/ui/components/ToolSelector.d.ts.map +0 -1
- package/dist/ui/components/ToolSelector.js.map +0 -1
- package/dist/ui/components/dialogs/ApprovalDialog.d.ts.map +0 -1
- package/dist/ui/components/dialogs/ApprovalDialog.js.map +0 -1
- package/dist/ui/components/dialogs/AskUserDialog.d.ts.map +0 -1
- package/dist/ui/components/dialogs/AskUserDialog.js.map +0 -1
- package/dist/ui/components/dialogs/DocsBrowser.d.ts.map +0 -1
- package/dist/ui/components/dialogs/DocsBrowser.js.map +0 -1
- package/dist/ui/components/dialogs/SettingsDialog.d.ts.map +0 -1
- package/dist/ui/components/dialogs/SettingsDialog.js.map +0 -1
- package/dist/ui/components/dialogs/index.d.ts.map +0 -1
- package/dist/ui/components/dialogs/index.js.map +0 -1
- package/dist/ui/components/index.d.ts.map +0 -1
- package/dist/ui/components/index.js.map +0 -1
- package/dist/ui/components/panels/LogPanel.d.ts.map +0 -1
- package/dist/ui/components/panels/LogPanel.js.map +0 -1
- package/dist/ui/components/panels/SessionPanel.d.ts.map +0 -1
- package/dist/ui/components/panels/SessionPanel.js.map +0 -1
- package/dist/ui/components/panels/index.d.ts.map +0 -1
- package/dist/ui/components/panels/index.js.map +0 -1
- package/dist/ui/components/views/ChatView.d.ts.map +0 -1
- package/dist/ui/components/views/ChatView.js.map +0 -1
- package/dist/ui/components/views/index.d.ts.map +0 -1
- package/dist/ui/components/views/index.js.map +0 -1
- package/dist/ui/contexts/TokenContext.d.ts.map +0 -1
- package/dist/ui/contexts/TokenContext.js.map +0 -1
- package/dist/ui/hooks/atFileProcessor.d.ts.map +0 -1
- package/dist/ui/hooks/atFileProcessor.js.map +0 -1
- package/dist/ui/hooks/index.d.ts.map +0 -1
- package/dist/ui/hooks/index.js.map +0 -1
- package/dist/ui/hooks/slashCommandProcessor.d.ts.map +0 -1
- package/dist/ui/hooks/slashCommandProcessor.js.map +0 -1
- package/dist/ui/hooks/useCommandBrowserState.d.ts.map +0 -1
- package/dist/ui/hooks/useCommandBrowserState.js.map +0 -1
- package/dist/ui/hooks/useFileBrowserState.d.ts.map +0 -1
- package/dist/ui/hooks/useFileBrowserState.js.map +0 -1
- package/dist/ui/hooks/useFileList.d.ts.map +0 -1
- package/dist/ui/hooks/useFileList.js.map +0 -1
- package/dist/ui/hooks/useInputHistory.d.ts.map +0 -1
- package/dist/ui/hooks/useInputHistory.js.map +0 -1
- package/dist/ui/hooks/usePlanExecution.d.ts.map +0 -1
- package/dist/ui/hooks/usePlanExecution.js.map +0 -1
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/ink-entry.d.ts.map +0 -1
- package/dist/ui/ink-entry.js.map +0 -1
- package/dist/utils/env-filter.d.ts.map +0 -1
- package/dist/utils/env-filter.js.map +0 -1
- package/dist/utils/file-system.d.ts.map +0 -1
- package/dist/utils/file-system.js.map +0 -1
- package/dist/utils/git-utils.d.ts.map +0 -1
- package/dist/utils/git-utils.js.map +0 -1
- package/dist/utils/json-stream-logger.d.ts.map +0 -1
- package/dist/utils/json-stream-logger.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/platform-utils.d.ts.map +0 -1
- package/dist/utils/platform-utils.js.map +0 -1
- package/dist/utils/wsl-utils.d.ts.map +0 -1
- package/dist/utils/wsl-utils.js.map +0 -1
- package/electron.vite.config.ts +0 -63
- package/google374b9eba0c52b043.html +0 -1
- package/src/agents/base/base-agent.ts +0 -159
- package/src/agents/docs-search/index.ts +0 -365
- package/src/agents/index.ts +0 -34
- package/src/agents/planner/index.ts +0 -544
- package/src/cli.ts +0 -201
- package/src/constants.ts +0 -47
- package/src/core/compact/compact-manager.ts +0 -160
- package/src/core/compact/compact-prompts.ts +0 -150
- package/src/core/compact/context-tracker.ts +0 -164
- package/src/core/compact/index.ts +0 -25
- package/src/core/config/config-manager.ts +0 -460
- package/src/core/config/index.ts +0 -5
- package/src/core/docs-manager.ts +0 -678
- package/src/core/llm/index.ts +0 -7
- package/src/core/llm/llm-client.ts +0 -1550
- package/src/core/session/index.ts +0 -5
- package/src/core/session/session-manager.ts +0 -464
- package/src/core/slash-command-handler.ts +0 -410
- package/src/core/usage-tracker.ts +0 -438
- package/src/errors/base.ts +0 -81
- package/src/errors/file.ts +0 -183
- package/src/errors/index.ts +0 -95
- package/src/errors/llm.ts +0 -151
- package/src/errors/network.ts +0 -124
- package/src/errors/validation.ts +0 -111
- package/src/eval/eval-runner.ts +0 -456
- package/src/eval/index.ts +0 -8
- package/src/eval/types.ts +0 -139
- package/src/index.ts +0 -22
- package/src/orchestration/index.ts +0 -30
- package/src/orchestration/plan-executor.ts +0 -652
- package/src/orchestration/types.ts +0 -127
- package/src/orchestration/utils.ts +0 -119
- package/src/orquesta/connection.ts +0 -291
- package/src/prompts/agents/docs-search-decision.ts +0 -74
- package/src/prompts/agents/docs-search.ts +0 -84
- package/src/prompts/agents/planning.ts +0 -143
- package/src/prompts/index.ts +0 -31
- package/src/prompts/shared/codebase-rules.ts +0 -29
- package/src/prompts/shared/git-rules.ts +0 -94
- package/src/prompts/shared/language-rules.ts +0 -36
- package/src/prompts/shared/tool-usage.ts +0 -72
- package/src/prompts/system/compact.ts +0 -80
- package/src/prompts/system/plan-execute.ts +0 -89
- package/src/tools/browser/browser-client.ts +0 -1363
- package/src/tools/browser/browser-tools.ts +0 -1139
- package/src/tools/browser/index.ts +0 -65
- package/src/tools/index.ts +0 -23
- package/src/tools/llm/agents/docs-search-tools.ts +0 -368
- package/src/tools/llm/agents/index.ts +0 -22
- package/src/tools/llm/index.ts +0 -11
- package/src/tools/llm/simple/ask-user-tool.ts +0 -25
- package/src/tools/llm/simple/background-bash-tool.ts +0 -443
- package/src/tools/llm/simple/background-powershell-tool.ts +0 -421
- package/src/tools/llm/simple/bash-tool.ts +0 -238
- package/src/tools/llm/simple/docs-search-agent-tool.ts +0 -146
- package/src/tools/llm/simple/file-tools.ts +0 -1051
- package/src/tools/llm/simple/final-response-tool.ts +0 -180
- package/src/tools/llm/simple/index.ts +0 -42
- package/src/tools/llm/simple/planning-tools.ts +0 -143
- package/src/tools/llm/simple/powershell-tool.ts +0 -241
- package/src/tools/llm/simple/simple-tool-executor.ts +0 -279
- package/src/tools/llm/simple/todo-tools.ts +0 -207
- package/src/tools/llm/simple/user-interaction-tools.ts +0 -277
- package/src/tools/office/common/constants.ts +0 -335
- package/src/tools/office/common/index.ts +0 -133
- package/src/tools/office/common/types.ts +0 -286
- package/src/tools/office/common/utils.ts +0 -116
- package/src/tools/office/excel-client.ts +0 -1336
- package/src/tools/office/excel-tools/cells.ts +0 -359
- package/src/tools/office/excel-tools/charts.ts +0 -166
- package/src/tools/office/excel-tools/comments.ts +0 -155
- package/src/tools/office/excel-tools/data-ops.ts +0 -349
- package/src/tools/office/excel-tools/export.ts +0 -105
- package/src/tools/office/excel-tools/formatting.ts +0 -357
- package/src/tools/office/excel-tools/index.ts +0 -55
- package/src/tools/office/excel-tools/launch.ts +0 -303
- package/src/tools/office/excel-tools/media.ts +0 -117
- package/src/tools/office/excel-tools/named-ranges.ts +0 -148
- package/src/tools/office/excel-tools/protection.ts +0 -105
- package/src/tools/office/excel-tools/rows-columns.ts +0 -386
- package/src/tools/office/excel-tools/sheets.ts +0 -228
- package/src/tools/office/excel-tools/validation.ts +0 -226
- package/src/tools/office/excel-tools.ts +0 -9
- package/src/tools/office/index.ts +0 -259
- package/src/tools/office/office-client-base.ts +0 -242
- package/src/tools/office/office-client.ts +0 -377
- package/src/tools/office/powerpoint-client.ts +0 -1498
- package/src/tools/office/powerpoint-tools/effects.ts +0 -315
- package/src/tools/office/powerpoint-tools/export.ts +0 -138
- package/src/tools/office/powerpoint-tools/index.ts +0 -45
- package/src/tools/office/powerpoint-tools/launch.ts +0 -263
- package/src/tools/office/powerpoint-tools/media.ts +0 -291
- package/src/tools/office/powerpoint-tools/notes.ts +0 -220
- package/src/tools/office/powerpoint-tools/sections.ts +0 -140
- package/src/tools/office/powerpoint-tools/shapes.ts +0 -870
- package/src/tools/office/powerpoint-tools/slides.ts +0 -350
- package/src/tools/office/powerpoint-tools/tables.ts +0 -182
- package/src/tools/office/powerpoint-tools/text.ts +0 -473
- package/src/tools/office/powerpoint-tools.ts +0 -9
- package/src/tools/office/word-client.ts +0 -1697
- package/src/tools/office/word-tools/bookmarks.ts +0 -186
- package/src/tools/office/word-tools/comments.ts +0 -185
- package/src/tools/office/word-tools/content.ts +0 -229
- package/src/tools/office/word-tools/export.ts +0 -97
- package/src/tools/office/word-tools/formatting.ts +0 -161
- package/src/tools/office/word-tools/headers-footers.ts +0 -155
- package/src/tools/office/word-tools/index.ts +0 -57
- package/src/tools/office/word-tools/launch.ts +0 -312
- package/src/tools/office/word-tools/lists.ts +0 -97
- package/src/tools/office/word-tools/navigation.ts +0 -114
- package/src/tools/office/word-tools/page-setup.ts +0 -195
- package/src/tools/office/word-tools/tables.ts +0 -262
- package/src/tools/office/word-tools/text.ts +0 -294
- package/src/tools/office/word-tools/undo-redo.ts +0 -97
- package/src/tools/office/word-tools/watermarks.ts +0 -105
- package/src/tools/office/word-tools.ts +0 -9
- package/src/tools/registry.ts +0 -527
- package/src/tools/types.ts +0 -231
- package/src/types/index.ts +0 -181
- package/src/ui/PlanExecuteView.tsx +0 -119
- package/src/ui/TodoPanel.tsx +0 -240
- package/src/ui/UpdateNotification.tsx +0 -105
- package/src/ui/components/ActivityIndicator.tsx +0 -234
- package/src/ui/components/CommandBrowser.tsx +0 -114
- package/src/ui/components/CustomTextInput.tsx +0 -389
- package/src/ui/components/DocsSearchProgress.tsx +0 -85
- package/src/ui/components/FileBrowser.tsx +0 -93
- package/src/ui/components/LLMSetupWizard.tsx +0 -333
- package/src/ui/components/Logo.tsx +0 -125
- package/src/ui/components/MarkdownRenderer.tsx +0 -358
- package/src/ui/components/ModelSelector.tsx +0 -203
- package/src/ui/components/PlanExecuteApp.tsx +0 -2007
- package/src/ui/components/ProgressBar.tsx +0 -51
- package/src/ui/components/StatusBar.tsx +0 -302
- package/src/ui/components/ThinkingIndicator.tsx +0 -120
- package/src/ui/components/TodoListView.tsx +0 -140
- package/src/ui/components/ToolSelector.tsx +0 -215
- package/src/ui/components/dialogs/ApprovalDialog.tsx +0 -259
- package/src/ui/components/dialogs/AskUserDialog.tsx +0 -159
- package/src/ui/components/dialogs/DocsBrowser.tsx +0 -222
- package/src/ui/components/dialogs/SettingsDialog.tsx +0 -939
- package/src/ui/components/dialogs/index.ts +0 -13
- package/src/ui/components/index.ts +0 -27
- package/src/ui/components/panels/LogPanel.tsx +0 -385
- package/src/ui/components/panels/SessionPanel.tsx +0 -146
- package/src/ui/components/panels/index.ts +0 -13
- package/src/ui/components/views/ChatView.tsx +0 -447
- package/src/ui/components/views/index.ts +0 -5
- package/src/ui/contexts/TokenContext.tsx +0 -139
- package/src/ui/hooks/atFileProcessor.ts +0 -167
- package/src/ui/hooks/index.ts +0 -11
- package/src/ui/hooks/slashCommandProcessor.ts +0 -174
- package/src/ui/hooks/useCommandBrowserState.ts +0 -97
- package/src/ui/hooks/useFileBrowserState.ts +0 -116
- package/src/ui/hooks/useFileList.ts +0 -132
- package/src/ui/hooks/useInputHistory.ts +0 -89
- package/src/ui/hooks/usePlanExecution.ts +0 -339
- package/src/ui/index.ts +0 -10
- package/src/ui/ink-entry.tsx +0 -36
- package/src/utils/env-filter.ts +0 -164
- package/src/utils/file-system.ts +0 -133
- package/src/utils/git-utils.ts +0 -30
- package/src/utils/json-stream-logger.ts +0 -1259
- package/src/utils/logger.ts +0 -2767
- package/src/utils/platform-utils.ts +0 -256
- package/src/utils/wsl-utils.ts +0 -113
- package/tsconfig.electron.json +0 -39
- package/tsconfig.json +0 -64
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context Tracker
|
|
3
|
-
*
|
|
4
|
-
* Tracks context window usage and determines when auto-compact should trigger.
|
|
5
|
-
* Uses prompt_tokens from LLM API responses to calculate usage.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { logger } from '../../utils/logger.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Context usage information
|
|
12
|
-
*/
|
|
13
|
-
export interface ContextUsageInfo {
|
|
14
|
-
/** Last prompt_tokens from API response */
|
|
15
|
-
currentTokens: number;
|
|
16
|
-
/** Model's context window size */
|
|
17
|
-
maxTokens: number;
|
|
18
|
-
/** Usage percentage (current/max * 100) */
|
|
19
|
-
usagePercentage: number;
|
|
20
|
-
/** Remaining percentage (100 - usagePercentage) */
|
|
21
|
-
remainingPercentage: number;
|
|
22
|
-
/** Whether auto-compact should trigger */
|
|
23
|
-
shouldAutoCompact: boolean;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Context Tracker Class
|
|
28
|
-
*
|
|
29
|
-
* Singleton that tracks:
|
|
30
|
-
* - Last prompt_tokens from LLM responses
|
|
31
|
-
* - Recent file accesses for compact context
|
|
32
|
-
* - Auto-compact threshold detection
|
|
33
|
-
*/
|
|
34
|
-
class ContextTrackerClass {
|
|
35
|
-
private lastPromptTokens: number = 0;
|
|
36
|
-
private autoCompactThreshold: number = 70; // percentage
|
|
37
|
-
private autoCompactTriggered: boolean = false;
|
|
38
|
-
|
|
39
|
-
// Recent files tracking
|
|
40
|
-
private recentFiles: Set<string> = new Set();
|
|
41
|
-
private maxRecentFiles: number = 20;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Update usage with prompt_tokens from LLM response
|
|
45
|
-
*/
|
|
46
|
-
updateUsage(promptTokens: number): void {
|
|
47
|
-
this.lastPromptTokens = promptTokens;
|
|
48
|
-
logger.debug('Context usage updated', { promptTokens });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Get current context usage information
|
|
53
|
-
*/
|
|
54
|
-
getContextUsage(modelMaxTokens: number): ContextUsageInfo {
|
|
55
|
-
const maxTokens = modelMaxTokens || 128000;
|
|
56
|
-
const usagePercentage = Math.round((this.lastPromptTokens / maxTokens) * 100);
|
|
57
|
-
const remainingPercentage = Math.max(0, 100 - usagePercentage);
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
currentTokens: this.lastPromptTokens,
|
|
61
|
-
maxTokens,
|
|
62
|
-
usagePercentage,
|
|
63
|
-
remainingPercentage,
|
|
64
|
-
shouldAutoCompact: usagePercentage >= this.autoCompactThreshold,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Check if auto-compact should trigger
|
|
70
|
-
* Returns true only once per threshold crossing (prevents multiple triggers)
|
|
71
|
-
*/
|
|
72
|
-
shouldTriggerAutoCompact(modelMaxTokens: number): boolean {
|
|
73
|
-
const usage = this.getContextUsage(modelMaxTokens);
|
|
74
|
-
|
|
75
|
-
if (usage.shouldAutoCompact && !this.autoCompactTriggered) {
|
|
76
|
-
logger.flow('Auto-compact threshold reached');
|
|
77
|
-
logger.vars(
|
|
78
|
-
{ name: 'usagePercentage', value: usage.usagePercentage },
|
|
79
|
-
{ name: 'threshold', value: this.autoCompactThreshold }
|
|
80
|
-
);
|
|
81
|
-
this.autoCompactTriggered = true;
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Reset after compact (allow future auto-compact triggers)
|
|
90
|
-
* @param estimatedTokens Optional estimated token count for compacted messages
|
|
91
|
-
*/
|
|
92
|
-
reset(estimatedTokens?: number): void {
|
|
93
|
-
logger.flow('ContextTracker reset', { estimatedTokens });
|
|
94
|
-
// If estimatedTokens provided, use it; otherwise calculate from 0
|
|
95
|
-
// This ensures UI shows approximate usage after compact
|
|
96
|
-
this.lastPromptTokens = estimatedTokens ?? 0;
|
|
97
|
-
this.autoCompactTriggered = false;
|
|
98
|
-
this.recentFiles.clear();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Estimate token count from text (rough approximation: ~4 chars per token)
|
|
103
|
-
*/
|
|
104
|
-
estimateTokens(text: string): number {
|
|
105
|
-
return Math.ceil(text.length / 4);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Reset only the auto-compact trigger flag
|
|
110
|
-
* Call this after processing a message to allow future triggers
|
|
111
|
-
*/
|
|
112
|
-
resetAutoCompactTrigger(): void {
|
|
113
|
-
this.autoCompactTriggered = false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Track file access for compact context
|
|
118
|
-
*/
|
|
119
|
-
trackFileAccess(filePath: string): void {
|
|
120
|
-
this.recentFiles.add(filePath);
|
|
121
|
-
|
|
122
|
-
// Keep only last N files
|
|
123
|
-
if (this.recentFiles.size > this.maxRecentFiles) {
|
|
124
|
-
const arr = Array.from(this.recentFiles);
|
|
125
|
-
this.recentFiles = new Set(arr.slice(-this.maxRecentFiles));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Get recently accessed files
|
|
131
|
-
*/
|
|
132
|
-
getRecentFiles(): string[] {
|
|
133
|
-
return Array.from(this.recentFiles);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Get the auto-compact threshold percentage
|
|
138
|
-
*/
|
|
139
|
-
getThreshold(): number {
|
|
140
|
-
return this.autoCompactThreshold;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Set the auto-compact threshold percentage
|
|
145
|
-
*/
|
|
146
|
-
setThreshold(threshold: number): void {
|
|
147
|
-
if (threshold > 0 && threshold <= 100) {
|
|
148
|
-
logger.state('Auto-compact threshold', this.autoCompactThreshold, threshold);
|
|
149
|
-
this.autoCompactThreshold = threshold;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Get last prompt tokens
|
|
155
|
-
*/
|
|
156
|
-
getLastPromptTokens(): number {
|
|
157
|
-
return this.lastPromptTokens;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Singleton instance
|
|
162
|
-
export const contextTracker = new ContextTrackerClass();
|
|
163
|
-
|
|
164
|
-
export default contextTracker;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compact Module
|
|
3
|
-
*
|
|
4
|
-
* Provides auto-compact functionality for managing context window usage.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// Context tracking
|
|
8
|
-
export {
|
|
9
|
-
contextTracker,
|
|
10
|
-
type ContextUsageInfo,
|
|
11
|
-
} from './context-tracker.js';
|
|
12
|
-
|
|
13
|
-
// Compact prompts and utilities
|
|
14
|
-
export {
|
|
15
|
-
COMPACT_SYSTEM_PROMPT,
|
|
16
|
-
buildCompactUserPrompt,
|
|
17
|
-
buildCompactedMessages,
|
|
18
|
-
type CompactContext,
|
|
19
|
-
} from './compact-prompts.js';
|
|
20
|
-
|
|
21
|
-
// Compact manager
|
|
22
|
-
export {
|
|
23
|
-
CompactManager,
|
|
24
|
-
type CompactResult,
|
|
25
|
-
} from './compact-manager.js';
|
|
@@ -1,460 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration Manager
|
|
3
|
-
*
|
|
4
|
-
* LOCAL-CLI configuration management system
|
|
5
|
-
* Manages ~/.local-cli/ directory and configuration files
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { OpenConfig, EndpointConfig, ModelInfo } from '../../types/index.js';
|
|
9
|
-
import {
|
|
10
|
-
OPEN_HOME_DIR,
|
|
11
|
-
CONFIG_FILE_PATH,
|
|
12
|
-
DOCS_DIR,
|
|
13
|
-
BACKUPS_DIR,
|
|
14
|
-
PROJECTS_DIR,
|
|
15
|
-
} from '../../constants.js';
|
|
16
|
-
import {
|
|
17
|
-
ensureDirectory,
|
|
18
|
-
readJsonFile,
|
|
19
|
-
writeJsonFile,
|
|
20
|
-
directoryExists,
|
|
21
|
-
} from '../../utils/file-system.js';
|
|
22
|
-
import { logger } from '../../utils/logger.js';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Default configuration (empty endpoint)
|
|
26
|
-
*/
|
|
27
|
-
const DEFAULT_CONFIG: OpenConfig = {
|
|
28
|
-
version: '0.1.0',
|
|
29
|
-
currentEndpoint: undefined,
|
|
30
|
-
currentModel: undefined,
|
|
31
|
-
endpoints: [],
|
|
32
|
-
settings: {
|
|
33
|
-
autoApprove: false,
|
|
34
|
-
debugMode: false,
|
|
35
|
-
streamResponse: true,
|
|
36
|
-
autoSave: true,
|
|
37
|
-
},
|
|
38
|
-
safeEnvVars: [], // User can add env vars they want to pass to subprocesses
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* ConfigManager class
|
|
43
|
-
*
|
|
44
|
-
* Configuration file and directory management
|
|
45
|
-
*/
|
|
46
|
-
export class ConfigManager {
|
|
47
|
-
private config: OpenConfig | null = null;
|
|
48
|
-
private initialized = false;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Initialize LOCAL-CLI
|
|
52
|
-
* Create ~/.local-cli/ directory and configuration file
|
|
53
|
-
*/
|
|
54
|
-
async initialize(): Promise<void> {
|
|
55
|
-
logger.enter('ConfigManager.initialize');
|
|
56
|
-
if (this.initialized) {
|
|
57
|
-
logger.flow('ConfigManager already initialized');
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Create home directory
|
|
62
|
-
await ensureDirectory(OPEN_HOME_DIR);
|
|
63
|
-
|
|
64
|
-
// Create subdirectories
|
|
65
|
-
await ensureDirectory(DOCS_DIR);
|
|
66
|
-
await ensureDirectory(BACKUPS_DIR);
|
|
67
|
-
await ensureDirectory(PROJECTS_DIR);
|
|
68
|
-
|
|
69
|
-
// Load or create configuration file
|
|
70
|
-
await this.loadOrCreateConfig();
|
|
71
|
-
|
|
72
|
-
this.initialized = true;
|
|
73
|
-
logger.exit('ConfigManager.initialize', { success: true });
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Load configuration file or create default configuration
|
|
78
|
-
*/
|
|
79
|
-
private async loadOrCreateConfig(): Promise<void> {
|
|
80
|
-
const existingConfig = await readJsonFile<OpenConfig>(CONFIG_FILE_PATH);
|
|
81
|
-
|
|
82
|
-
if (existingConfig) {
|
|
83
|
-
this.config = existingConfig;
|
|
84
|
-
} else {
|
|
85
|
-
// Create default configuration
|
|
86
|
-
this.config = { ...DEFAULT_CONFIG };
|
|
87
|
-
await this.saveConfig();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Save configuration
|
|
93
|
-
*/
|
|
94
|
-
async saveConfig(): Promise<void> {
|
|
95
|
-
if (!this.config) {
|
|
96
|
-
const error = new Error('Configuration not initialized');
|
|
97
|
-
logger.error('Config save failed', error);
|
|
98
|
-
throw error;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
logger.flow('Saving configuration');
|
|
102
|
-
await writeJsonFile(CONFIG_FILE_PATH, this.config);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Get current configuration
|
|
107
|
-
*/
|
|
108
|
-
getConfig(): OpenConfig {
|
|
109
|
-
if (!this.config) {
|
|
110
|
-
throw new Error('Configuration not initialized. Call initialize() first.');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return this.config;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Get current endpoint
|
|
118
|
-
*/
|
|
119
|
-
getCurrentEndpoint(): EndpointConfig | null {
|
|
120
|
-
const config = this.getConfig();
|
|
121
|
-
|
|
122
|
-
if (!config.currentEndpoint) {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return config.endpoints.find((ep) => ep.id === config.currentEndpoint) || null;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Get current model information
|
|
131
|
-
*/
|
|
132
|
-
getCurrentModel(): ModelInfo | null {
|
|
133
|
-
const endpoint = this.getCurrentEndpoint();
|
|
134
|
-
|
|
135
|
-
if (!endpoint || !this.config?.currentModel) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return endpoint.models.find((m) => m.id === this.config?.currentModel) || null;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Get all endpoints
|
|
144
|
-
*/
|
|
145
|
-
getAllEndpoints(): EndpointConfig[] {
|
|
146
|
-
return this.getConfig().endpoints;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Add endpoint
|
|
151
|
-
*/
|
|
152
|
-
async addEndpoint(endpoint: EndpointConfig): Promise<void> {
|
|
153
|
-
const config = this.getConfig();
|
|
154
|
-
|
|
155
|
-
// Check for duplicate ID
|
|
156
|
-
const exists = config.endpoints.some((ep) => ep.id === endpoint.id);
|
|
157
|
-
if (exists) {
|
|
158
|
-
throw new Error(`Endpoint with ID ${endpoint.id} already exists`);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
config.endpoints.push(endpoint);
|
|
162
|
-
await this.saveConfig();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Delete endpoint
|
|
167
|
-
*/
|
|
168
|
-
async removeEndpoint(endpointId: string): Promise<void> {
|
|
169
|
-
const config = this.getConfig();
|
|
170
|
-
|
|
171
|
-
config.endpoints = config.endpoints.filter((ep) => ep.id !== endpointId);
|
|
172
|
-
|
|
173
|
-
// If current endpoint is deleted, switch to first endpoint (or undefined)
|
|
174
|
-
if (config.currentEndpoint === endpointId) {
|
|
175
|
-
const firstEndpoint = config.endpoints[0];
|
|
176
|
-
config.currentEndpoint = firstEndpoint?.id;
|
|
177
|
-
|
|
178
|
-
// Switch to first model of first endpoint
|
|
179
|
-
if (firstEndpoint) {
|
|
180
|
-
const firstModel = firstEndpoint.models.find((m) => m.enabled);
|
|
181
|
-
config.currentModel = firstModel?.id;
|
|
182
|
-
} else {
|
|
183
|
-
config.currentModel = undefined;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
await this.saveConfig();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Change current endpoint
|
|
192
|
-
*/
|
|
193
|
-
async setCurrentEndpoint(endpointId: string): Promise<void> {
|
|
194
|
-
const config = this.getConfig();
|
|
195
|
-
|
|
196
|
-
const endpoint = config.endpoints.find((ep) => ep.id === endpointId);
|
|
197
|
-
if (!endpoint) {
|
|
198
|
-
throw new Error(`Endpoint ${endpointId} not found`);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
config.currentEndpoint = endpointId;
|
|
202
|
-
|
|
203
|
-
// Switch to first active model of that endpoint
|
|
204
|
-
const activeModel = endpoint.models.find((m) => m.enabled);
|
|
205
|
-
if (activeModel) {
|
|
206
|
-
config.currentModel = activeModel.id;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
await this.saveConfig();
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Change current model
|
|
214
|
-
*/
|
|
215
|
-
async setCurrentModel(modelId: string): Promise<void> {
|
|
216
|
-
const config = this.getConfig();
|
|
217
|
-
const endpoint = this.getCurrentEndpoint();
|
|
218
|
-
|
|
219
|
-
if (!endpoint) {
|
|
220
|
-
throw new Error('No endpoint selected');
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const model = endpoint.models.find((m) => m.id === modelId);
|
|
224
|
-
if (!model) {
|
|
225
|
-
throw new Error(`Model ${modelId} not found in current endpoint`);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
if (!model.enabled) {
|
|
229
|
-
throw new Error(`Model ${modelId} is disabled`);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
config.currentModel = modelId;
|
|
233
|
-
await this.saveConfig();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Update configuration value
|
|
238
|
-
*/
|
|
239
|
-
async updateSettings(settings: Partial<OpenConfig['settings']>): Promise<void> {
|
|
240
|
-
const config = this.getConfig();
|
|
241
|
-
config.settings = { ...config.settings, ...settings };
|
|
242
|
-
await this.saveConfig();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Get user-defined safe environment variables
|
|
247
|
-
* These are additional env vars the user trusts to pass to subprocesses
|
|
248
|
-
*/
|
|
249
|
-
getSafeEnvVars(): string[] {
|
|
250
|
-
const config = this.getConfig();
|
|
251
|
-
return config.safeEnvVars || [];
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Check if home directory exists
|
|
256
|
-
*/
|
|
257
|
-
async isInitialized(): Promise<boolean> {
|
|
258
|
-
return await directoryExists(OPEN_HOME_DIR);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Check if endpoint exists
|
|
263
|
-
*/
|
|
264
|
-
hasEndpoints(): boolean {
|
|
265
|
-
if (!this.config) {
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
return this.config.endpoints.length > 0;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Create initial endpoint
|
|
273
|
-
* Add first endpoint and automatically set as current endpoint/model
|
|
274
|
-
*/
|
|
275
|
-
async createInitialEndpoint(endpoint: EndpointConfig): Promise<void> {
|
|
276
|
-
const config = this.getConfig();
|
|
277
|
-
|
|
278
|
-
// Add first endpoint
|
|
279
|
-
config.endpoints.push(endpoint);
|
|
280
|
-
|
|
281
|
-
// Automatically set as current endpoint/model
|
|
282
|
-
config.currentEndpoint = endpoint.id;
|
|
283
|
-
|
|
284
|
-
// Set first active model as current model
|
|
285
|
-
const activeModel = endpoint.models.find((m) => m.enabled);
|
|
286
|
-
if (activeModel) {
|
|
287
|
-
config.currentModel = activeModel.id;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
await this.saveConfig();
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Reset configuration (factory reset)
|
|
295
|
-
*/
|
|
296
|
-
async reset(): Promise<void> {
|
|
297
|
-
this.config = { ...DEFAULT_CONFIG };
|
|
298
|
-
await this.saveConfig();
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Update endpoint
|
|
303
|
-
*/
|
|
304
|
-
async updateEndpoint(
|
|
305
|
-
endpointId: string,
|
|
306
|
-
updates: Partial<Omit<EndpointConfig, 'id' | 'createdAt'>>
|
|
307
|
-
): Promise<void> {
|
|
308
|
-
const config = this.getConfig();
|
|
309
|
-
const endpointIndex = config.endpoints.findIndex((ep) => ep.id === endpointId);
|
|
310
|
-
|
|
311
|
-
if (endpointIndex === -1) {
|
|
312
|
-
throw new Error(`Endpoint ${endpointId} not found`);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const endpoint = config.endpoints[endpointIndex]!;
|
|
316
|
-
config.endpoints[endpointIndex] = {
|
|
317
|
-
...endpoint,
|
|
318
|
-
...updates,
|
|
319
|
-
updatedAt: new Date(),
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
await this.saveConfig();
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Update model health status
|
|
327
|
-
*/
|
|
328
|
-
async updateModelHealth(
|
|
329
|
-
endpointId: string,
|
|
330
|
-
modelId: string,
|
|
331
|
-
status: 'healthy' | 'degraded' | 'unhealthy',
|
|
332
|
-
_latency?: number
|
|
333
|
-
): Promise<void> {
|
|
334
|
-
const config = this.getConfig();
|
|
335
|
-
const endpoint = config.endpoints.find((ep) => ep.id === endpointId);
|
|
336
|
-
|
|
337
|
-
if (!endpoint) {
|
|
338
|
-
throw new Error(`Endpoint ${endpointId} not found`);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
const model = endpoint.models.find((m) => m.id === modelId);
|
|
342
|
-
if (!model) {
|
|
343
|
-
throw new Error(`Model ${modelId} not found in endpoint ${endpointId}`);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
model.healthStatus = status;
|
|
347
|
-
model.lastHealthCheck = new Date();
|
|
348
|
-
|
|
349
|
-
await this.saveConfig();
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Bulk update health status of all models
|
|
354
|
-
*/
|
|
355
|
-
async updateAllHealthStatus(
|
|
356
|
-
healthResults: Map<string, { modelId: string; healthy: boolean; latency?: number }[]>
|
|
357
|
-
): Promise<void> {
|
|
358
|
-
const config = this.getConfig();
|
|
359
|
-
|
|
360
|
-
for (const [endpointId, modelResults] of healthResults) {
|
|
361
|
-
const endpoint = config.endpoints.find((ep) => ep.id === endpointId);
|
|
362
|
-
if (!endpoint) continue;
|
|
363
|
-
|
|
364
|
-
for (const result of modelResults) {
|
|
365
|
-
const model = endpoint.models.find((m) => m.id === result.modelId);
|
|
366
|
-
if (model) {
|
|
367
|
-
model.healthStatus = result.healthy ? 'healthy' : 'unhealthy';
|
|
368
|
-
model.lastHealthCheck = new Date();
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
await this.saveConfig();
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Query list of all healthy models
|
|
378
|
-
*/
|
|
379
|
-
getHealthyModels(): { endpoint: EndpointConfig; model: ModelInfo }[] {
|
|
380
|
-
const config = this.getConfig();
|
|
381
|
-
const healthyModels: { endpoint: EndpointConfig; model: ModelInfo }[] = [];
|
|
382
|
-
|
|
383
|
-
for (const endpoint of config.endpoints) {
|
|
384
|
-
for (const model of endpoint.models) {
|
|
385
|
-
if (model.enabled && model.healthStatus === 'healthy') {
|
|
386
|
-
healthyModels.push({ endpoint, model });
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
return healthyModels;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Query all model list (including endpoint information)
|
|
396
|
-
*/
|
|
397
|
-
getAllModels(): { endpoint: EndpointConfig; model: ModelInfo; isCurrent: boolean }[] {
|
|
398
|
-
const config = this.getConfig();
|
|
399
|
-
const allModels: { endpoint: EndpointConfig; model: ModelInfo; isCurrent: boolean }[] = [];
|
|
400
|
-
|
|
401
|
-
for (const endpoint of config.endpoints) {
|
|
402
|
-
for (const model of endpoint.models) {
|
|
403
|
-
const isCurrent =
|
|
404
|
-
endpoint.id === config.currentEndpoint && model.id === config.currentModel;
|
|
405
|
-
allModels.push({ endpoint, model, isCurrent });
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
return allModels;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Get enabled tool group IDs
|
|
414
|
-
*/
|
|
415
|
-
getEnabledTools(): string[] {
|
|
416
|
-
const config = this.getConfig();
|
|
417
|
-
return config.enabledTools || [];
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Set enabled tool group IDs
|
|
422
|
-
*/
|
|
423
|
-
async setEnabledTools(toolIds: string[]): Promise<void> {
|
|
424
|
-
const config = this.getConfig();
|
|
425
|
-
config.enabledTools = toolIds;
|
|
426
|
-
await this.saveConfig();
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Enable a tool group
|
|
431
|
-
*/
|
|
432
|
-
async enableTool(toolId: string): Promise<void> {
|
|
433
|
-
const config = this.getConfig();
|
|
434
|
-
const enabledTools = config.enabledTools || [];
|
|
435
|
-
if (!enabledTools.includes(toolId)) {
|
|
436
|
-
enabledTools.push(toolId);
|
|
437
|
-
config.enabledTools = enabledTools;
|
|
438
|
-
await this.saveConfig();
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Disable a tool group
|
|
444
|
-
*/
|
|
445
|
-
async disableTool(toolId: string): Promise<void> {
|
|
446
|
-
const config = this.getConfig();
|
|
447
|
-
const enabledTools = config.enabledTools || [];
|
|
448
|
-
const index = enabledTools.indexOf(toolId);
|
|
449
|
-
if (index !== -1) {
|
|
450
|
-
enabledTools.splice(index, 1);
|
|
451
|
-
config.enabledTools = enabledTools;
|
|
452
|
-
await this.saveConfig();
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* ConfigManager singleton instance
|
|
459
|
-
*/
|
|
460
|
-
export const configManager = new ConfigManager();
|