@ebowwa/coder 0.2.1 → 0.7.64
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 +31 -32
- package/dist/core/__tests__/permissions.test.d.ts +12 -0
- package/dist/core/__tests__/permissions.test.d.ts.map +1 -0
- package/dist/core/__tests__/permissions.test.js +851 -0
- package/dist/core/agent-loop/__tests__/compaction.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/compaction.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/compaction.test.js +209 -0
- package/dist/core/agent-loop/__tests__/formatters.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/formatters.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/formatters.test.js +195 -0
- package/dist/core/agent-loop/__tests__/index.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/index.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/index.test.js +121 -0
- package/dist/core/agent-loop/__tests__/loop-state.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/loop-state.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/loop-state.test.js +340 -0
- package/dist/core/agent-loop/__tests__/message-builder.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/message-builder.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/message-builder.test.js +178 -0
- package/dist/core/agent-loop/__tests__/tool-executor.test.d.ts +5 -0
- package/dist/core/agent-loop/__tests__/tool-executor.test.d.ts.map +1 -0
- package/dist/core/agent-loop/__tests__/tool-executor.test.js +331 -0
- package/dist/core/agent-loop/compaction.d.ts +39 -0
- package/dist/core/agent-loop/compaction.d.ts.map +1 -0
- package/dist/core/agent-loop/compaction.js +51 -0
- package/dist/core/agent-loop/formatters.d.ts +21 -0
- package/dist/core/agent-loop/formatters.d.ts.map +1 -0
- package/dist/core/agent-loop/formatters.js +42 -0
- package/dist/core/agent-loop/index.d.ts +25 -0
- package/dist/core/agent-loop/index.d.ts.map +1 -0
- package/dist/core/agent-loop/index.js +83 -0
- package/dist/core/agent-loop/loop-state.d.ts +74 -0
- package/dist/core/agent-loop/loop-state.d.ts.map +1 -0
- package/dist/core/agent-loop/loop-state.js +147 -0
- package/dist/core/agent-loop/message-builder.d.ts +13 -0
- package/dist/core/agent-loop/message-builder.d.ts.map +1 -0
- package/dist/core/agent-loop/message-builder.js +49 -0
- package/dist/core/agent-loop/tool-executor.d.ts +23 -0
- package/dist/core/agent-loop/tool-executor.d.ts.map +1 -0
- package/dist/core/agent-loop/tool-executor.js +152 -0
- package/dist/core/agent-loop/turn-executor.d.ts +57 -0
- package/dist/core/agent-loop/turn-executor.d.ts.map +1 -0
- package/dist/core/agent-loop/turn-executor.js +124 -0
- package/dist/core/agent-loop/types.d.ts +141 -0
- package/dist/core/agent-loop/types.d.ts.map +1 -0
- package/dist/core/agent-loop/types.js +4 -0
- package/dist/core/agent-loop.d.ts +17 -0
- package/dist/core/agent-loop.d.ts.map +1 -0
- package/dist/core/agent-loop.js +16 -0
- package/dist/core/api-client-impl.d.ts +62 -0
- package/dist/core/api-client-impl.d.ts.map +1 -0
- package/dist/core/api-client-impl.js +479 -0
- package/dist/core/api-client.d.ts +6 -0
- package/dist/core/api-client.d.ts.map +1 -0
- package/dist/core/api-client.js +5 -0
- package/dist/core/checkpoints.d.ts +128 -0
- package/dist/core/checkpoints.d.ts.map +1 -0
- package/dist/core/checkpoints.js +438 -0
- package/dist/core/claude-md.d.ts +71 -0
- package/dist/core/claude-md.d.ts.map +1 -0
- package/dist/core/claude-md.js +198 -0
- package/dist/core/cognitive-security/hooks.d.ts +138 -0
- package/dist/core/cognitive-security/hooks.d.ts.map +1 -0
- package/dist/core/cognitive-security/hooks.js +389 -0
- package/dist/core/cognitive-security/index.d.ts +751 -0
- package/dist/core/cognitive-security/index.d.ts.map +1 -0
- package/dist/core/cognitive-security/index.js +1123 -0
- package/dist/core/cognitive-security/middleware.d.ts +136 -0
- package/dist/core/cognitive-security/middleware.d.ts.map +1 -0
- package/dist/core/cognitive-security/middleware.js +376 -0
- package/dist/core/config-loader.d.ts +127 -0
- package/dist/core/config-loader.d.ts.map +1 -0
- package/dist/core/config-loader.js +219 -0
- package/dist/core/context-compaction.d.ts +87 -0
- package/dist/core/context-compaction.d.ts.map +1 -0
- package/dist/core/context-compaction.js +428 -0
- package/dist/core/git-status.d.ts +25 -0
- package/dist/core/git-status.d.ts.map +1 -0
- package/dist/core/git-status.js +204 -0
- package/dist/core/image.d.ts +69 -0
- package/dist/core/image.d.ts.map +1 -0
- package/dist/core/image.js +290 -0
- package/dist/core/image.test.d.ts +2 -0
- package/dist/core/image.test.d.ts.map +1 -0
- package/dist/core/image.test.js +149 -0
- package/dist/core/models.d.ts +123 -0
- package/dist/core/models.d.ts.map +1 -0
- package/dist/core/models.js +325 -0
- package/dist/core/permissions.d.ts +81 -0
- package/dist/core/permissions.d.ts.map +1 -0
- package/dist/core/permissions.js +327 -0
- package/dist/core/retry.d.ts +25 -0
- package/dist/core/retry.d.ts.map +1 -0
- package/dist/core/retry.js +121 -0
- package/dist/core/session-store.d.ts +9 -0
- package/dist/core/session-store.d.ts.map +1 -0
- package/dist/core/session-store.js +10 -0
- package/dist/core/sessions/export.d.ts +47 -0
- package/dist/core/sessions/export.d.ts.map +1 -0
- package/dist/core/sessions/export.js +256 -0
- package/dist/core/sessions/index.d.ts +132 -0
- package/dist/core/sessions/index.d.ts.map +1 -0
- package/dist/core/sessions/index.js +442 -0
- package/dist/core/sessions/metadata.d.ts +77 -0
- package/dist/core/sessions/metadata.d.ts.map +1 -0
- package/dist/core/sessions/metadata.js +233 -0
- package/dist/core/sessions/persistence.d.ts +72 -0
- package/dist/core/sessions/persistence.d.ts.map +1 -0
- package/dist/core/sessions/persistence.js +201 -0
- package/dist/core/sessions/types.d.ts +110 -0
- package/dist/core/sessions/types.d.ts.map +1 -0
- package/dist/core/sessions/types.js +4 -0
- package/dist/core/stream-highlighter.d.ts +18 -0
- package/dist/core/stream-highlighter.d.ts.map +1 -0
- package/dist/core/stream-highlighter.js +916 -0
- package/dist/core/system-reminders.d.ts +89 -0
- package/dist/core/system-reminders.d.ts.map +1 -0
- package/dist/core/system-reminders.js +285 -0
- package/dist/ecosystem/hooks/__tests__/index.test.d.ts +5 -0
- package/dist/ecosystem/hooks/__tests__/index.test.d.ts.map +1 -0
- package/dist/ecosystem/hooks/__tests__/index.test.js +458 -0
- package/dist/ecosystem/hooks/index.d.ts +59 -0
- package/dist/ecosystem/hooks/index.d.ts.map +1 -0
- package/dist/ecosystem/hooks/index.js +294 -0
- package/dist/ecosystem/hooks/prompt-evaluator.d.ts +32 -0
- package/dist/ecosystem/hooks/prompt-evaluator.d.ts.map +1 -0
- package/dist/ecosystem/hooks/prompt-evaluator.js +229 -0
- package/dist/ecosystem/skills/index.d.ts +55 -0
- package/dist/ecosystem/skills/index.d.ts.map +1 -0
- package/dist/ecosystem/skills/index.js +258 -0
- package/dist/ecosystem/tools/__tests__/index.test.d.ts +7 -0
- package/dist/ecosystem/tools/__tests__/index.test.d.ts.map +1 -0
- package/dist/ecosystem/tools/__tests__/index.test.js +856 -0
- package/dist/ecosystem/tools/index.d.ts +24 -0
- package/dist/ecosystem/tools/index.d.ts.map +1 -0
- package/dist/ecosystem/tools/index.js +1709 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -2
- package/dist/interfaces/mcp/client.d.ts +40 -0
- package/dist/interfaces/mcp/client.d.ts.map +1 -0
- package/dist/interfaces/mcp/client.js +309 -0
- package/dist/interfaces/ui/index.d.ts +36 -0
- package/dist/interfaces/ui/index.d.ts.map +1 -0
- package/dist/interfaces/ui/index.js +61 -0
- package/dist/interfaces/ui/spinner.d.ts +140 -0
- package/dist/interfaces/ui/spinner.d.ts.map +1 -0
- package/dist/interfaces/ui/spinner.js +342 -0
- package/dist/interfaces/ui/terminal/cli/index.d.ts +12 -0
- package/dist/interfaces/ui/terminal/cli/index.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/cli/index.js +167 -0
- package/dist/interfaces/ui/terminal/shared/args.d.ts +39 -0
- package/dist/interfaces/ui/terminal/shared/args.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/args.js +176 -0
- package/dist/interfaces/ui/terminal/shared/index.d.ts +11 -0
- package/dist/interfaces/ui/terminal/shared/index.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/index.js +16 -0
- package/dist/interfaces/ui/terminal/shared/loading-state.d.ts +124 -0
- package/dist/interfaces/ui/terminal/shared/loading-state.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/loading-state.js +246 -0
- package/dist/interfaces/ui/terminal/shared/query.d.ts +22 -0
- package/dist/interfaces/ui/terminal/shared/query.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/query.js +100 -0
- package/dist/interfaces/ui/terminal/shared/setup.d.ts +33 -0
- package/dist/interfaces/ui/terminal/shared/setup.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/setup.js +226 -0
- package/dist/interfaces/ui/terminal/shared/status-line.d.ts +117 -0
- package/dist/interfaces/ui/terminal/shared/status-line.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/status-line.js +267 -0
- package/dist/interfaces/ui/terminal/shared/system-prompt.d.ts +38 -0
- package/dist/interfaces/ui/terminal/shared/system-prompt.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/shared/system-prompt.js +102 -0
- package/dist/interfaces/ui/terminal/tui/HelpPanel.d.ts +39 -0
- package/dist/interfaces/ui/terminal/tui/HelpPanel.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/HelpPanel.js +215 -0
- package/dist/interfaces/ui/terminal/tui/InputContext.d.ts +91 -0
- package/dist/interfaces/ui/terminal/tui/InputContext.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/InputContext.js +154 -0
- package/dist/interfaces/ui/terminal/tui/InputField.d.ts +18 -0
- package/dist/interfaces/ui/terminal/tui/InputField.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/InputField.js +41 -0
- package/dist/interfaces/ui/terminal/tui/InteractiveTUI.d.ts +16 -0
- package/dist/interfaces/ui/terminal/tui/InteractiveTUI.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/InteractiveTUI.js +451 -0
- package/dist/interfaces/ui/terminal/tui/MessageArea.d.ts +10 -0
- package/dist/interfaces/ui/terminal/tui/MessageArea.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/MessageArea.js +91 -0
- package/dist/interfaces/ui/terminal/tui/MessageStore.d.ts +48 -0
- package/dist/interfaces/ui/terminal/tui/MessageStore.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/MessageStore.js +151 -0
- package/dist/interfaces/ui/terminal/tui/StatusBar.d.ts +9 -0
- package/dist/interfaces/ui/terminal/tui/StatusBar.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/StatusBar.js +36 -0
- package/dist/interfaces/ui/terminal/tui/commands.d.ts +21 -0
- package/dist/interfaces/ui/terminal/tui/commands.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/commands.js +359 -0
- package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.d.ts +115 -0
- package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.js +306 -0
- package/dist/interfaces/ui/terminal/tui/components/MultilineInput.d.ts +92 -0
- package/dist/interfaces/ui/terminal/tui/components/MultilineInput.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/components/MultilineInput.js +399 -0
- package/dist/interfaces/ui/terminal/tui/components/PaneManager.d.ts +59 -0
- package/dist/interfaces/ui/terminal/tui/components/PaneManager.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/components/PaneManager.js +139 -0
- package/dist/interfaces/ui/terminal/tui/components/Sidebar.d.ts +68 -0
- package/dist/interfaces/ui/terminal/tui/components/Sidebar.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/components/Sidebar.js +340 -0
- package/dist/interfaces/ui/terminal/tui/components/index.d.ts +23 -0
- package/dist/interfaces/ui/terminal/tui/components/index.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/components/index.js +51 -0
- package/dist/interfaces/ui/terminal/tui/console.d.ts +20 -0
- package/dist/interfaces/ui/terminal/tui/console.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/console.js +46 -0
- package/dist/interfaces/ui/terminal/tui/index.d.ts +20 -0
- package/dist/interfaces/ui/terminal/tui/index.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/index.js +28 -0
- package/dist/interfaces/ui/terminal/tui/run.d.ts +13 -0
- package/dist/interfaces/ui/terminal/tui/run.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/run.js +31 -0
- package/dist/interfaces/ui/terminal/tui/spinner.d.ts +44 -0
- package/dist/interfaces/ui/terminal/tui/spinner.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/spinner.js +59 -0
- package/dist/interfaces/ui/terminal/tui/tui-app.d.ts +39 -0
- package/dist/interfaces/ui/terminal/tui/tui-app.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/tui-app.js +198 -0
- package/dist/interfaces/ui/terminal/tui/tui-footer.d.ts +167 -0
- package/dist/interfaces/ui/terminal/tui/tui-footer.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/tui-footer.js +330 -0
- package/dist/interfaces/ui/terminal/tui/types.d.ts +165 -0
- package/dist/interfaces/ui/terminal/tui/types.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/types.js +5 -0
- package/dist/interfaces/ui/terminal/tui/useInputHandler.d.ts +23 -0
- package/dist/interfaces/ui/terminal/tui/useInputHandler.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/useInputHandler.js +72 -0
- package/dist/interfaces/ui/terminal/tui/useNativeInput.d.ts +90 -0
- package/dist/interfaces/ui/terminal/tui/useNativeInput.d.ts.map +1 -0
- package/dist/interfaces/ui/terminal/tui/useNativeInput.js +188 -0
- package/dist/native/index.d.ts +480 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +1625 -0
- package/dist/teammates/index.d.ts +161 -0
- package/dist/teammates/index.d.ts.map +1 -0
- package/dist/teammates/index.js +827 -0
- package/dist/types/index.d.ts +482 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +52 -0
- package/native/README.md +5 -5
- package/native/index.darwin-arm64.node +0 -0
- package/native/index.node +0 -0
- package/native/package.json +4 -4
- package/package.json +33 -16
- package/packages/src/core/__tests__/permissions.test.ts +1091 -0
- package/packages/src/core/agent-loop/__tests__/compaction.test.ts +280 -0
- package/packages/src/core/agent-loop/__tests__/formatters.test.ts +234 -0
- package/packages/src/core/agent-loop/__tests__/index.test.ts +162 -0
- package/packages/src/core/agent-loop/__tests__/loop-state.test.ts +413 -0
- package/packages/src/core/agent-loop/__tests__/message-builder.test.ts +229 -0
- package/packages/src/core/agent-loop/__tests__/tool-executor.test.ts +457 -0
- package/packages/src/core/agent-loop/compaction.ts +88 -0
- package/packages/src/core/agent-loop/formatters.ts +50 -0
- package/packages/src/core/agent-loop/index.ts +135 -0
- package/packages/src/core/agent-loop/loop-state.ts +187 -0
- package/packages/src/core/agent-loop/message-builder.ts +62 -0
- package/packages/src/core/agent-loop/tool-executor.ts +211 -0
- package/packages/src/core/agent-loop/turn-executor.ts +222 -0
- package/packages/src/core/agent-loop/types.ts +148 -0
- package/packages/src/core/agent-loop.ts +18 -0
- package/packages/src/core/api-client-impl.ts +619 -0
- package/packages/src/core/api-client.ts +6 -0
- package/packages/src/core/checkpoints.ts +606 -0
- package/packages/src/core/claude-md.ts +272 -0
- package/packages/src/core/cognitive-security/hooks.ts +590 -0
- package/packages/src/core/cognitive-security/index.ts +2041 -0
- package/packages/src/core/cognitive-security/middleware.ts +536 -0
- package/packages/src/core/config-loader.ts +324 -0
- package/packages/src/core/context-compaction.ts +578 -0
- package/packages/src/core/git-status.ts +262 -0
- package/packages/src/core/image.test.ts +180 -0
- package/packages/src/core/image.ts +350 -0
- package/packages/src/core/lmdb.db +0 -0
- package/packages/src/core/lmdb.db-lock +0 -0
- package/packages/src/core/models.ts +430 -0
- package/packages/src/core/normalizers/todo +4 -0
- package/packages/src/core/permissions.ts +431 -0
- package/packages/src/core/retry.ts +170 -0
- package/packages/src/core/session-store.ts +36 -0
- package/packages/src/core/sessions/export.ts +329 -0
- package/packages/src/core/sessions/index.ts +587 -0
- package/packages/src/core/sessions/metadata.ts +309 -0
- package/packages/src/core/sessions/persistence.ts +244 -0
- package/packages/src/core/sessions/types.ts +169 -0
- package/packages/src/core/stream-highlighter.ts +1123 -0
- package/packages/src/core/system-reminders.ts +402 -0
- package/packages/src/core/todo +8 -0
- package/packages/src/ecosystem/hooks/__tests__/index.test.ts +561 -0
- package/packages/src/ecosystem/hooks/index.ts +341 -0
- package/packages/src/ecosystem/hooks/prompt-evaluator.ts +300 -0
- package/packages/src/ecosystem/skills/index.ts +295 -0
- package/packages/src/ecosystem/tools/__tests__/index.test.ts +1335 -0
- package/packages/src/ecosystem/tools/index.ts +1877 -0
- package/packages/src/index.ts +120 -0
- package/packages/src/interfaces/mcp/client.ts +389 -0
- package/packages/src/interfaces/ui/Screenshot 2026-03-02 at 9.23.10/342/200/257PM.png +0 -0
- package/packages/src/interfaces/ui/Screenshot 2026-03-03 at 10.55.11/342/200/257AM.png +0 -0
- package/packages/src/interfaces/ui/index.ts +161 -0
- package/packages/src/interfaces/ui/lmdb.db +0 -0
- package/packages/src/interfaces/ui/lmdb.db-lock +0 -0
- package/packages/src/interfaces/ui/spinner.ts +451 -0
- package/packages/src/interfaces/ui/terminal/cli/index.ts +228 -0
- package/packages/src/interfaces/ui/terminal/lmdb.db +0 -0
- package/packages/src/interfaces/ui/terminal/lmdb.db-lock +0 -0
- package/packages/src/interfaces/ui/terminal/shared/args.ts +222 -0
- package/packages/src/interfaces/ui/terminal/shared/index.ts +71 -0
- package/packages/src/interfaces/ui/terminal/shared/loading-state.ts +322 -0
- package/packages/src/interfaces/ui/terminal/shared/query.ts +146 -0
- package/packages/src/interfaces/ui/terminal/shared/setup.ts +295 -0
- package/packages/src/interfaces/ui/terminal/shared/status-line.ts +358 -0
- package/packages/src/interfaces/ui/terminal/shared/system-prompt.ts +146 -0
- package/packages/src/interfaces/ui/terminal/tui/HelpPanel.tsx +262 -0
- package/packages/src/interfaces/ui/terminal/tui/InputContext.tsx +232 -0
- package/packages/src/interfaces/ui/terminal/tui/InputField.tsx +62 -0
- package/packages/src/interfaces/ui/terminal/tui/InteractiveTUI.tsx +537 -0
- package/packages/src/interfaces/ui/terminal/tui/MessageArea.tsx +107 -0
- package/packages/src/interfaces/ui/terminal/tui/MessageStore.tsx +240 -0
- package/packages/src/interfaces/ui/terminal/tui/StatusBar.tsx +54 -0
- package/packages/src/interfaces/ui/terminal/tui/commands.ts +438 -0
- package/packages/src/interfaces/ui/terminal/tui/components/InteractiveElements.tsx +584 -0
- package/packages/src/interfaces/ui/terminal/tui/components/MultilineInput.tsx +614 -0
- package/packages/src/interfaces/ui/terminal/tui/components/PaneManager.tsx +333 -0
- package/packages/src/interfaces/ui/terminal/tui/components/Sidebar.tsx +604 -0
- package/packages/src/interfaces/ui/terminal/tui/components/index.ts +118 -0
- package/packages/src/interfaces/ui/terminal/tui/console.ts +49 -0
- package/packages/src/interfaces/ui/terminal/tui/index.ts +90 -0
- package/packages/src/interfaces/ui/terminal/tui/run.tsx +42 -0
- package/packages/src/interfaces/ui/terminal/tui/spinner.ts +69 -0
- package/packages/src/interfaces/ui/terminal/tui/tui-app.tsx +390 -0
- package/packages/src/interfaces/ui/terminal/tui/tui-footer.ts +422 -0
- package/packages/src/interfaces/ui/terminal/tui/types.ts +186 -0
- package/packages/src/interfaces/ui/terminal/tui/useInputHandler.ts +104 -0
- package/packages/src/interfaces/ui/terminal/tui/useNativeInput.ts +239 -0
- package/packages/src/lmdb.db +0 -0
- package/packages/src/lmdb.db-lock +0 -0
- package/packages/src/native/index.ts +2345 -0
- package/packages/src/teammates/index.ts +982 -0
- package/packages/src/types/index.ts +722 -0
- package/dist/cli.js +0 -148
- package/dist/index-0pkak453.js +0 -136
- package/dist/index-0qd0x8b4.js +0 -110
- package/dist/index-0x3kprq6.js +0 -240
- package/dist/index-1eawy937.js +0 -308
- package/dist/index-24m2aygy.js +0 -240
- package/dist/index-29xcjnne.js +0 -280
- package/dist/index-2avyytn5.js +0 -349
- package/dist/index-4ms367ey.js +0 -136
- package/dist/index-4w2t3b0m.js +0 -240
- package/dist/index-4xfgd8nz.js +0 -261
- package/dist/index-5acjp9gc.js +0 -157
- package/dist/index-5s15hr56.js +0 -136
- package/dist/index-6e4wf341.js +0 -349
- package/dist/index-6fvnkedw.js +0 -240
- package/dist/index-6rqpmd4g.js +0 -128
- package/dist/index-77ckwnbm.js +0 -280
- package/dist/index-9knxy49k.js +0 -128
- package/dist/index-9zrnw4zx.js +0 -128
- package/dist/index-bk21w99v.js +0 -280
- package/dist/index-c41n76fv.js +0 -240
- package/dist/index-cb4ppjdt.js +0 -255
- package/dist/index-cfb2edt6.js +0 -240
- package/dist/index-cmfa38hh.js +0 -308
- package/dist/index-datjz8q1.js +0 -257
- package/dist/index-eadf4wvn.js +0 -240
- package/dist/index-em5k0m3z.js +0 -345
- package/dist/index-gh8r333a.js +0 -110
- package/dist/index-gkx6k2tr.js +0 -261
- package/dist/index-h5cabfks.js +0 -155
- package/dist/index-hcrpwyy3.js +0 -261
- package/dist/index-hk7fwwa8.js +0 -257
- package/dist/index-jb8cw7f8.js +0 -136
- package/dist/index-kbyw4th1.js +0 -347
- package/dist/index-kgj5gqnm.js +0 -345
- package/dist/index-mdf6xp1z.js +0 -255
- package/dist/index-mrhv8kvc.js +0 -280
- package/dist/index-mt4743dd.js +0 -161
- package/dist/index-qnwsg97q.js +0 -240
- package/dist/index-qwdy6x44.js +0 -261
- package/dist/index-rmj77261.js +0 -157
- package/dist/index-sbbw1a61.js +0 -349
- package/dist/index-svy5bcpn.js +0 -345
- package/dist/index-tvmy7tm9.js +0 -261
- package/dist/index-tzz4vzkj.js +0 -312
- package/dist/index-vz80zmhe.js +0 -110
- package/dist/index-wed2fk67.js +0 -240
- package/dist/index-wksgzz8e.js +0 -280
- package/dist/index-wn2m4wma.js +0 -240
- package/dist/index-xha05vjc.js +0 -257
- package/dist/index-yc6eh8p8.js +0 -136
- package/dist/index-ycjxx9ft.js +0 -240
- package/dist/index-z0gzd0fc.js +0 -110
- package/dist/index-z8cwtf8j.js +0 -240
- package/dist/index-zy5mtt00.js +0 -128
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single Query Execution
|
|
3
|
+
* Shared query runner for CLI -q mode
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { Message, ToolDefinition, ExtendedThinkingConfig, GitStatus } from "../../../../types/index.js";
|
|
7
|
+
import { agentLoop, formatCost, formatCostBrief } from "../../../../core/agent-loop.js";
|
|
8
|
+
import { HookManager } from "../../../../ecosystem/hooks/index.js";
|
|
9
|
+
import { SessionStore } from "../../../../core/session-store.js";
|
|
10
|
+
import { createStreamHighlighter } from "../../../../core/stream-highlighter.js";
|
|
11
|
+
import {
|
|
12
|
+
renderStatusLine,
|
|
13
|
+
getContextWindow,
|
|
14
|
+
type StatusLineOptions,
|
|
15
|
+
} from "./status-line.js";
|
|
16
|
+
import type { CLIArgs } from "./args.js";
|
|
17
|
+
|
|
18
|
+
// ============================================
|
|
19
|
+
// TYPES
|
|
20
|
+
// ============================================
|
|
21
|
+
|
|
22
|
+
export interface QueryOptions {
|
|
23
|
+
apiKey: string;
|
|
24
|
+
args: CLIArgs;
|
|
25
|
+
systemPrompt: string;
|
|
26
|
+
tools: ToolDefinition[];
|
|
27
|
+
query: string;
|
|
28
|
+
sessionStore: SessionStore;
|
|
29
|
+
sessionId: string;
|
|
30
|
+
hookManager: HookManager;
|
|
31
|
+
workingDirectory: string;
|
|
32
|
+
gitStatus?: GitStatus | null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ============================================
|
|
36
|
+
// SINGLE QUERY RUNNER
|
|
37
|
+
// ============================================
|
|
38
|
+
|
|
39
|
+
export async function runSingleQuery(options: QueryOptions): Promise<void> {
|
|
40
|
+
const {
|
|
41
|
+
apiKey,
|
|
42
|
+
args,
|
|
43
|
+
systemPrompt,
|
|
44
|
+
tools,
|
|
45
|
+
query,
|
|
46
|
+
sessionStore,
|
|
47
|
+
sessionId,
|
|
48
|
+
hookManager,
|
|
49
|
+
workingDirectory,
|
|
50
|
+
gitStatus,
|
|
51
|
+
} = options;
|
|
52
|
+
|
|
53
|
+
// Show initial status line
|
|
54
|
+
const initialStatusOptions: StatusLineOptions = {
|
|
55
|
+
permissionMode: args.permissionMode,
|
|
56
|
+
tokensUsed: 0,
|
|
57
|
+
maxTokens: getContextWindow(args.model),
|
|
58
|
+
model: args.model,
|
|
59
|
+
isLoading: true,
|
|
60
|
+
};
|
|
61
|
+
console.log(`\x1b[90m${renderStatusLine(initialStatusOptions)}\x1b[0m\n`);
|
|
62
|
+
|
|
63
|
+
// Track tokens for final status
|
|
64
|
+
let totalTokens = 0;
|
|
65
|
+
|
|
66
|
+
const messages: Message[] = [
|
|
67
|
+
{
|
|
68
|
+
role: "user",
|
|
69
|
+
content: [{ type: "text", text: query }],
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
// Save user message to session
|
|
74
|
+
await sessionStore.saveMessage(messages[0]!);
|
|
75
|
+
|
|
76
|
+
// Create stream highlighter for code blocks
|
|
77
|
+
const highlighter = createStreamHighlighter();
|
|
78
|
+
|
|
79
|
+
// Build extended thinking config
|
|
80
|
+
const extendedThinkingConfig: ExtendedThinkingConfig | undefined = args.extendedThinking
|
|
81
|
+
? {
|
|
82
|
+
enabled: true,
|
|
83
|
+
effort: args.effort ?? "medium",
|
|
84
|
+
interleaved: args.interleaved ?? true,
|
|
85
|
+
}
|
|
86
|
+
: undefined;
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
const result = await agentLoop(messages, {
|
|
90
|
+
apiKey,
|
|
91
|
+
model: args.model,
|
|
92
|
+
maxTokens: args.maxTokens,
|
|
93
|
+
systemPrompt,
|
|
94
|
+
tools,
|
|
95
|
+
permissionMode: args.permissionMode,
|
|
96
|
+
workingDirectory,
|
|
97
|
+
gitStatus: gitStatus ?? undefined,
|
|
98
|
+
extendedThinking: extendedThinkingConfig,
|
|
99
|
+
hookManager,
|
|
100
|
+
sessionId,
|
|
101
|
+
onText: (text) => {
|
|
102
|
+
const highlighted = highlighter.process(text);
|
|
103
|
+
if (highlighted) {
|
|
104
|
+
process.stdout.write(highlighted);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
onThinking: (thinking) => {
|
|
108
|
+
process.stdout.write(`\x1b[90m${thinking}\x1b[0m`);
|
|
109
|
+
},
|
|
110
|
+
onMetrics: async (metrics) => {
|
|
111
|
+
// Track tokens for final status
|
|
112
|
+
totalTokens = metrics.usage.input_tokens + metrics.usage.output_tokens;
|
|
113
|
+
console.log(`\n\x1b[90m${formatCostBrief(metrics)}\x1b[0m`);
|
|
114
|
+
await sessionStore.saveMetrics(metrics);
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Flush any remaining highlighted content
|
|
119
|
+
const remaining = highlighter.flush();
|
|
120
|
+
if (remaining) {
|
|
121
|
+
process.stdout.write(remaining);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Save assistant message to session
|
|
125
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
126
|
+
if (lastMessage && lastMessage.role === "assistant") {
|
|
127
|
+
await sessionStore.saveMessage(lastMessage);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Show final status line
|
|
131
|
+
const finalStatusOptions: StatusLineOptions = {
|
|
132
|
+
permissionMode: args.permissionMode,
|
|
133
|
+
tokensUsed: totalTokens,
|
|
134
|
+
maxTokens: getContextWindow(args.model),
|
|
135
|
+
model: args.model,
|
|
136
|
+
isLoading: false,
|
|
137
|
+
};
|
|
138
|
+
console.log(`\n\x1b[90m${renderStatusLine(finalStatusOptions)}\x1b[0m`);
|
|
139
|
+
console.log(`\x1b[90mSession: ${sessionId}\x1b[0m`);
|
|
140
|
+
console.log(`\x1b[90mTotal cost: ${formatCost(result.totalCost)}\x1b[0m`);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
143
|
+
console.error(`Error: ${errorMessage}`);
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Setup
|
|
3
|
+
* Shared initialization logic for CLI and TUI modes
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { MCPServerConfig, ToolDefinition, PermissionMode } from "../../../../types/index.js";
|
|
7
|
+
import { MCPClientImpl, createMCPClients } from "../../../mcp/client.js";
|
|
8
|
+
import { HookManager } from "../../../../ecosystem/hooks/index.js";
|
|
9
|
+
import { createPromptEvaluator } from "../../../../ecosystem/hooks/prompt-evaluator.js";
|
|
10
|
+
import { SkillManager } from "../../../../ecosystem/skills/index.js";
|
|
11
|
+
import { TeammateManager } from "../../../../teammates/index.js";
|
|
12
|
+
import {
|
|
13
|
+
loadAllConfigs,
|
|
14
|
+
getMergedSettings,
|
|
15
|
+
getPermissionMode,
|
|
16
|
+
getAllowedTools,
|
|
17
|
+
getDisallowedTools,
|
|
18
|
+
getAllMCPServers,
|
|
19
|
+
settingsToHookDefinitions,
|
|
20
|
+
type LoadedConfig,
|
|
21
|
+
type SettingsConfig,
|
|
22
|
+
} from "../../../../core/config-loader.js";
|
|
23
|
+
import { createSecurityHookHandlers } from "../../../../core/cognitive-security/hooks.js";
|
|
24
|
+
import type { CLIArgs } from "./args.js";
|
|
25
|
+
|
|
26
|
+
// ============================================
|
|
27
|
+
// TYPES
|
|
28
|
+
// ============================================
|
|
29
|
+
|
|
30
|
+
export interface SessionSetup {
|
|
31
|
+
loadedConfig: LoadedConfig;
|
|
32
|
+
mergedSettings: SettingsConfig;
|
|
33
|
+
hookManager: HookManager;
|
|
34
|
+
skillManager: SkillManager;
|
|
35
|
+
teammateManager: TeammateManager;
|
|
36
|
+
mcpClients: Map<string, MCPClientImpl>;
|
|
37
|
+
tools: ToolDefinition[];
|
|
38
|
+
permissionMode: PermissionMode;
|
|
39
|
+
allowedTools: Set<string>;
|
|
40
|
+
disallowedTools: Set<string>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface SetupOptions {
|
|
44
|
+
args: CLIArgs;
|
|
45
|
+
apiKey: string;
|
|
46
|
+
workingDirectory: string;
|
|
47
|
+
onProgress?: (message: string) => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ============================================
|
|
51
|
+
// MCP CONFIG LOADER
|
|
52
|
+
// ============================================
|
|
53
|
+
|
|
54
|
+
export async function loadMCPConfig(configPath: string): Promise<Record<string, MCPServerConfig>> {
|
|
55
|
+
try {
|
|
56
|
+
const file = Bun.file(configPath);
|
|
57
|
+
const content = await file.text();
|
|
58
|
+
const config = JSON.parse(content) as Record<string, unknown>;
|
|
59
|
+
|
|
60
|
+
// Support both formats:
|
|
61
|
+
// 1. { "servers": { "name": {...} } }
|
|
62
|
+
// 2. { "name": {...} } (direct server config)
|
|
63
|
+
if ("servers" in config && typeof config.servers === "object" && config.servers !== null) {
|
|
64
|
+
return config.servers as Record<string, MCPServerConfig>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Check if it looks like direct server config (has "type" at top level)
|
|
68
|
+
if ("type" in config) {
|
|
69
|
+
// Single server config without "servers" wrapper
|
|
70
|
+
const servers: Record<string, MCPServerConfig> = {};
|
|
71
|
+
servers["default"] = config as unknown as MCPServerConfig;
|
|
72
|
+
return servers;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return config as Record<string, MCPServerConfig>;
|
|
76
|
+
} catch (error) {
|
|
77
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
78
|
+
throw new Error(`Failed to load MCP config from ${configPath}: ${errorMessage}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ============================================
|
|
83
|
+
// MCP TOOLS CONVERTER
|
|
84
|
+
// ============================================
|
|
85
|
+
|
|
86
|
+
export function mcpToolsToToolDefinitions(mcpClients: Map<string, MCPClientImpl>): ToolDefinition[] {
|
|
87
|
+
const tools: ToolDefinition[] = [];
|
|
88
|
+
|
|
89
|
+
for (const [serverName, client] of mcpClients) {
|
|
90
|
+
for (const mcpTool of client.tools) {
|
|
91
|
+
tools.push({
|
|
92
|
+
name: `mcp__${serverName}__${mcpTool.name}`,
|
|
93
|
+
description: mcpTool.description,
|
|
94
|
+
input_schema: mcpTool.inputSchema,
|
|
95
|
+
handler: async (args, context) => {
|
|
96
|
+
if (!client.connected) {
|
|
97
|
+
return {
|
|
98
|
+
content: `Error: MCP server "${serverName}" is not connected`,
|
|
99
|
+
is_error: true,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return client.callTool(mcpTool.name, args);
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return tools;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ============================================
|
|
112
|
+
// SESSION SETUP
|
|
113
|
+
// ============================================
|
|
114
|
+
|
|
115
|
+
export async function setupSession(options: SetupOptions): Promise<SessionSetup> {
|
|
116
|
+
const { args, apiKey, workingDirectory, onProgress } = options;
|
|
117
|
+
|
|
118
|
+
const log = (msg: string) => {
|
|
119
|
+
if (onProgress) onProgress(msg);
|
|
120
|
+
else console.log(`\x1b[90m${msg}\x1b[0m`);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// ============================================
|
|
124
|
+
// LOAD CONFIGURATION
|
|
125
|
+
// ============================================
|
|
126
|
+
log("Loading configuration...");
|
|
127
|
+
|
|
128
|
+
let loadedConfig: LoadedConfig;
|
|
129
|
+
try {
|
|
130
|
+
loadedConfig = await loadAllConfigs(workingDirectory);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
133
|
+
log(`Warning: Failed to load config: ${errorMessage}`);
|
|
134
|
+
// Use empty defaults
|
|
135
|
+
loadedConfig = {
|
|
136
|
+
main: {},
|
|
137
|
+
settings: {},
|
|
138
|
+
keybindings: { bindings: [] },
|
|
139
|
+
projectSettings: {},
|
|
140
|
+
sources: [],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Get merged settings (project overrides global)
|
|
145
|
+
const mergedSettings = getMergedSettings(loadedConfig.settings, loadedConfig.projectSettings);
|
|
146
|
+
|
|
147
|
+
// Log loaded config sources
|
|
148
|
+
if (loadedConfig.sources.length > 0) {
|
|
149
|
+
log(` Config sources: ${loadedConfig.sources.length} files`);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Determine permission mode
|
|
153
|
+
let permissionMode = args.permissionMode;
|
|
154
|
+
if (permissionMode === "default") {
|
|
155
|
+
const configMode = getPermissionMode(mergedSettings);
|
|
156
|
+
if (configMode !== "default") {
|
|
157
|
+
permissionMode = configMode;
|
|
158
|
+
log(` Permission mode: ${configMode} (from config)`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Get allowed/disallowed tools from config
|
|
163
|
+
const allowedTools = getAllowedTools(mergedSettings);
|
|
164
|
+
const disallowedTools = getDisallowedTools(mergedSettings);
|
|
165
|
+
|
|
166
|
+
// ============================================
|
|
167
|
+
// INITIALIZE MANAGERS
|
|
168
|
+
// ============================================
|
|
169
|
+
|
|
170
|
+
// Create prompt evaluator for LLM-based hooks
|
|
171
|
+
const promptEvaluator = createPromptEvaluator({
|
|
172
|
+
apiKey,
|
|
173
|
+
model: "claude-haiku-4-5", // Fast model for hook evaluation
|
|
174
|
+
maxTokens: 256,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Initialize components
|
|
178
|
+
const hookManager = new HookManager(60000, promptEvaluator);
|
|
179
|
+
const skillManager = new SkillManager();
|
|
180
|
+
const teammateManager = new TeammateManager();
|
|
181
|
+
|
|
182
|
+
// ============================================
|
|
183
|
+
// REGISTER HOOKS
|
|
184
|
+
// ============================================
|
|
185
|
+
|
|
186
|
+
// Register hooks from config
|
|
187
|
+
const hookDefinitions = settingsToHookDefinitions(mergedSettings);
|
|
188
|
+
for (const [event, definitions] of Object.entries(hookDefinitions)) {
|
|
189
|
+
for (const def of definitions) {
|
|
190
|
+
hookManager.register(event as import("../../../../types/index.js").HookEvent, def);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (Object.keys(hookDefinitions).length > 0) {
|
|
194
|
+
log(` Hooks registered: ${Object.keys(hookDefinitions).length} events`);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Register cognitive security hooks (in-process handlers)
|
|
198
|
+
// When bypassPermissions is set, disable all security checks
|
|
199
|
+
const isBypassMode = permissionMode === "bypassPermissions";
|
|
200
|
+
const securityHandlers = createSecurityHookHandlers({
|
|
201
|
+
enabled: !isBypassMode, // Disable entirely in bypass mode
|
|
202
|
+
checkIntentAlignment: !isBypassMode,
|
|
203
|
+
enforceFlowPolicies: !isBypassMode,
|
|
204
|
+
preventLeaks: !isBypassMode,
|
|
205
|
+
trackTaints: !isBypassMode,
|
|
206
|
+
logEvents: true, // Always log for audit trail
|
|
207
|
+
blockOnViolation: false, // Never block - log only
|
|
208
|
+
minAlignmentScore: 0.3,
|
|
209
|
+
approvalRequiredSensitivities: ["secret", "top_secret"],
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
hookManager.registerHandler("SessionStart", securityHandlers.SessionStart);
|
|
213
|
+
hookManager.registerHandler("PreToolUse", securityHandlers.PreToolUse);
|
|
214
|
+
hookManager.registerHandler("PostToolUse", securityHandlers.PostToolUse);
|
|
215
|
+
hookManager.registerHandler("UserPromptSubmit", securityHandlers.UserPromptSubmit);
|
|
216
|
+
hookManager.registerHandler("SessionEnd", securityHandlers.SessionEnd);
|
|
217
|
+
|
|
218
|
+
// Load skills from project
|
|
219
|
+
const skillsDir = workingDirectory + "/.claude/skills";
|
|
220
|
+
skillManager.loadFromDirectory(skillsDir, "project");
|
|
221
|
+
|
|
222
|
+
// ============================================
|
|
223
|
+
// MCP SETUP
|
|
224
|
+
// ============================================
|
|
225
|
+
|
|
226
|
+
const mcpClients = new Map<string, MCPClientImpl>();
|
|
227
|
+
|
|
228
|
+
// Get MCP servers from loaded config
|
|
229
|
+
const configServers = getAllMCPServers(loadedConfig.main, workingDirectory);
|
|
230
|
+
|
|
231
|
+
// If --mcp-config is specified, it overrides config file servers
|
|
232
|
+
let servers = configServers;
|
|
233
|
+
if (args.mcpConfig) {
|
|
234
|
+
try {
|
|
235
|
+
log(`Loading MCP config from ${args.mcpConfig}...`);
|
|
236
|
+
const fileServers = await loadMCPConfig(args.mcpConfig);
|
|
237
|
+
servers = fileServers;
|
|
238
|
+
} catch (error) {
|
|
239
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
240
|
+
log(`Warning: Failed to load MCP config file: ${errorMessage}`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Connect to MCP servers
|
|
245
|
+
if (Object.keys(servers).length > 0) {
|
|
246
|
+
// Only count enabled servers
|
|
247
|
+
const enabledServers = Object.entries(servers).filter(([_, config]) => !config.disabled);
|
|
248
|
+
const serverCount = enabledServers.length;
|
|
249
|
+
|
|
250
|
+
if (serverCount > 0) {
|
|
251
|
+
log(` Connecting to ${serverCount} MCP server(s)...`);
|
|
252
|
+
|
|
253
|
+
const connectedClients = await createMCPClients(servers, (message) => {
|
|
254
|
+
log(` ${message}`);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
for (const [name, client] of connectedClients) {
|
|
258
|
+
mcpClients.set(name, client);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (mcpClients.size > 0) {
|
|
262
|
+
log(` Connected to ${mcpClients.size} MCP server(s)`);
|
|
263
|
+
} else {
|
|
264
|
+
log(` Warning: No MCP servers connected successfully`);
|
|
265
|
+
}
|
|
266
|
+
} else if (Object.keys(servers).length > 0) {
|
|
267
|
+
log(` MCP config loaded but all ${Object.keys(servers).length} server(s) are disabled`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// ============================================
|
|
272
|
+
// BUILD TOOLS
|
|
273
|
+
// ============================================
|
|
274
|
+
|
|
275
|
+
// Import built-in tools dynamically to avoid circular deps
|
|
276
|
+
const { builtInTools } = await import("../../../../ecosystem/tools/index.js");
|
|
277
|
+
|
|
278
|
+
const tools: ToolDefinition[] = [
|
|
279
|
+
...builtInTools,
|
|
280
|
+
...mcpToolsToToolDefinitions(mcpClients),
|
|
281
|
+
];
|
|
282
|
+
|
|
283
|
+
return {
|
|
284
|
+
loadedConfig,
|
|
285
|
+
mergedSettings,
|
|
286
|
+
hookManager,
|
|
287
|
+
skillManager,
|
|
288
|
+
teammateManager,
|
|
289
|
+
mcpClients,
|
|
290
|
+
tools,
|
|
291
|
+
permissionMode,
|
|
292
|
+
allowedTools,
|
|
293
|
+
disallowedTools,
|
|
294
|
+
};
|
|
295
|
+
}
|