@ebowwa/coder 0.7.63 → 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/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 -52192
- 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 +159 -52768
- 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/package.json +4 -2
- 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
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
/** @jsx React.createElement */
|
|
2
|
+
/**
|
|
3
|
+
* Multiline Input Component
|
|
4
|
+
* Enhanced text input with:
|
|
5
|
+
* - Multi-line support (Ctrl+Enter for newline)
|
|
6
|
+
* - Command autocomplete
|
|
7
|
+
* - Input history navigation
|
|
8
|
+
* - Syntax highlighting for input
|
|
9
|
+
*/
|
|
10
|
+
import React, { useState, useCallback, useRef, useEffect } from "react";
|
|
11
|
+
import { Box, Text, useStdout } from "ink";
|
|
12
|
+
// ============================================
|
|
13
|
+
// COMMAND AUTOCOMPLETE DEFINITIONS
|
|
14
|
+
// ============================================
|
|
15
|
+
const COMMAND_SUGGESTIONS = [
|
|
16
|
+
// Session commands
|
|
17
|
+
{ id: "/help", label: "/help", description: "Show help", category: "session" },
|
|
18
|
+
{ id: "/exit", label: "/exit", description: "Exit session", category: "session" },
|
|
19
|
+
{ id: "/new", label: "/new", description: "Start new session", category: "session" },
|
|
20
|
+
{ id: "/clear", label: "/clear", description: "Clear conversation", category: "session" },
|
|
21
|
+
{ id: "/status", label: "/status", description: "Show session status", category: "session" },
|
|
22
|
+
{ id: "/cost", label: "/cost", description: "Show total cost", category: "session" },
|
|
23
|
+
// Model commands
|
|
24
|
+
{ id: "/model", label: "/model", description: "Switch model", category: "model" },
|
|
25
|
+
{ id: "/models", label: "/models", description: "List available models", category: "model" },
|
|
26
|
+
{ id: "/tools", label: "/tools", description: "List available tools", category: "model" },
|
|
27
|
+
// Context commands
|
|
28
|
+
{ id: "/compact", label: "/compact", description: "Force context compaction", category: "context" },
|
|
29
|
+
{ id: "/export", label: "/export", description: "Export session", category: "context" },
|
|
30
|
+
{ id: "/checkpoint", label: "/checkpoint", description: "Save checkpoint", category: "context" },
|
|
31
|
+
{ id: "/checkpoints", label: "/checkpoints", description: "List checkpoints", category: "context" },
|
|
32
|
+
{ id: "/restore", label: "/restore", description: "Restore checkpoint", category: "context" },
|
|
33
|
+
{ id: "/undo", label: "/undo", description: "Undo last action", category: "context" },
|
|
34
|
+
{ id: "/redo", label: "/redo", description: "Redo action", category: "context" },
|
|
35
|
+
// Session management
|
|
36
|
+
{ id: "/resume", label: "/resume", description: "Resume session", category: "sessions" },
|
|
37
|
+
{ id: "/sessions", label: "/sessions", description: "List sessions", category: "sessions" },
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Filter autocomplete suggestions based on prefix
|
|
41
|
+
*/
|
|
42
|
+
export function filterSuggestions(prefix) {
|
|
43
|
+
if (!prefix || !prefix.startsWith("/")) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
const query = prefix.toLowerCase();
|
|
47
|
+
return COMMAND_SUGGESTIONS.filter((cmd) => {
|
|
48
|
+
return (cmd.id.toLowerCase().startsWith(query) ||
|
|
49
|
+
cmd.label.toLowerCase().includes(query) ||
|
|
50
|
+
(cmd.description?.toLowerCase().includes(query) ?? false));
|
|
51
|
+
}).slice(0, 5);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Syntax highlight code block
|
|
55
|
+
* Returns highlighted segments for display
|
|
56
|
+
*/
|
|
57
|
+
export function highlightSyntax(text) {
|
|
58
|
+
const segments = [];
|
|
59
|
+
// Code block detection (``` ... ```)
|
|
60
|
+
const codeBlockRegex = /```[\s\S]*?```/g;
|
|
61
|
+
// Keywords
|
|
62
|
+
const keywords = /\b(const|let|var|function|return|if|else|for|while|class|interface|type|import|export|from|async|await)\b/g;
|
|
63
|
+
// Strings
|
|
64
|
+
const strings = /(["'`])(?:(?!\1)[\s\S])*?\1/g;
|
|
65
|
+
// Numbers
|
|
66
|
+
const numbers = /\b(\d+\.?\d*)\b/g;
|
|
67
|
+
// Comments
|
|
68
|
+
const comments = /(\/\/.*$|\/\*[\s\S]*?\*\/|#.*$)/gm;
|
|
69
|
+
// Check for code blocks first
|
|
70
|
+
if (codeBlockRegex.test(text)) {
|
|
71
|
+
segments.push({ text, color: "green" });
|
|
72
|
+
return segments;
|
|
73
|
+
}
|
|
74
|
+
// Otherwise return as-is
|
|
75
|
+
segments.push({ text, color: "white" });
|
|
76
|
+
return segments;
|
|
77
|
+
}
|
|
78
|
+
// ============================================
|
|
79
|
+
// MULTILINE INPUT COMPONENT
|
|
80
|
+
// ============================================
|
|
81
|
+
export function MultilineInput({ value, cursorPos, currentLine = 0, placeholder = "Type your message... (/help for commands)", isActive = true, showAutocomplete = false, autocompleteSuggestions = [], autocompleteIndex = 0, inputHistory = [], historyIndex = -1, onChange, onSubmit, maxLines = 5, showLineNumbers = false, width: propWidth, }) {
|
|
82
|
+
const { stdout } = useStdout();
|
|
83
|
+
const width = propWidth ?? stdout.columns ?? 80;
|
|
84
|
+
// Split value into lines
|
|
85
|
+
const lines = value.split("\n");
|
|
86
|
+
const displayLines = lines.slice(-maxLines);
|
|
87
|
+
// Calculate cursor display position
|
|
88
|
+
const cursorLineIndex = Math.min(currentLine, displayLines.length - 1);
|
|
89
|
+
const currentLineText = displayLines[cursorLineIndex] ?? "";
|
|
90
|
+
const cursorColInLine = cursorPos;
|
|
91
|
+
// Build line display
|
|
92
|
+
const renderLines = displayLines.map((line, i) => {
|
|
93
|
+
const lineNum = showLineNumbers
|
|
94
|
+
? `${String(lines.length - displayLines.length + i + 1).padStart(3, " ")} `
|
|
95
|
+
: "";
|
|
96
|
+
const isCurrentLine = i === cursorLineIndex;
|
|
97
|
+
if (isCurrentLine) {
|
|
98
|
+
const beforeCursor = line.slice(0, cursorColInLine);
|
|
99
|
+
const cursorChar = line[cursorColInLine] ?? " ";
|
|
100
|
+
const afterCursor = line.slice(cursorColInLine + 1);
|
|
101
|
+
return (React.createElement(Box, { key: i },
|
|
102
|
+
React.createElement(Text, { dimColor: true }, lineNum),
|
|
103
|
+
React.createElement(Text, null, beforeCursor),
|
|
104
|
+
React.createElement(Text, { backgroundColor: "cyan", color: "black" }, cursorChar),
|
|
105
|
+
React.createElement(Text, null, afterCursor)));
|
|
106
|
+
}
|
|
107
|
+
return (React.createElement(Box, { key: i },
|
|
108
|
+
React.createElement(Text, { dimColor: true }, lineNum),
|
|
109
|
+
React.createElement(Text, { dimColor: line.length === 0 }, line || " ")));
|
|
110
|
+
});
|
|
111
|
+
// Render autocomplete dropdown
|
|
112
|
+
const renderAutocomplete = () => {
|
|
113
|
+
if (!showAutocomplete || autocompleteSuggestions.length === 0) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
return (React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", paddingX: 1, marginTop: 1 },
|
|
117
|
+
React.createElement(Text, { dimColor: true }, "Suggestions (Tab to select):"),
|
|
118
|
+
autocompleteSuggestions.map((suggestion, i) => (React.createElement(Box, { key: suggestion.id },
|
|
119
|
+
React.createElement(Text, { color: i === autocompleteIndex ? "yellow" : "white", bold: i === autocompleteIndex }, suggestion.label),
|
|
120
|
+
suggestion.description && (React.createElement(Text, { dimColor: true },
|
|
121
|
+
" - ",
|
|
122
|
+
suggestion.description)))))));
|
|
123
|
+
};
|
|
124
|
+
// Line indicator
|
|
125
|
+
const lineIndicator = lines.length > 1 ? (React.createElement(Text, { dimColor: true },
|
|
126
|
+
" [Line ",
|
|
127
|
+
currentLine + 1,
|
|
128
|
+
"/",
|
|
129
|
+
lines.length,
|
|
130
|
+
"]")) : null;
|
|
131
|
+
return (React.createElement(Box, { flexDirection: "column", width: "100%", borderStyle: "round", borderColor: isActive ? "cyan" : "gray", paddingX: 1 },
|
|
132
|
+
React.createElement(Box, null,
|
|
133
|
+
React.createElement(Text, { bold: true, color: "cyan" }, "You:"),
|
|
134
|
+
lineIndicator),
|
|
135
|
+
React.createElement(Box, { flexDirection: "column" }, lines.length === 0 || (lines.length === 1 && lines[0] === "") ? (React.createElement(Text, { dimColor: true }, placeholder)) : (renderLines)),
|
|
136
|
+
renderAutocomplete(),
|
|
137
|
+
React.createElement(Box, { marginTop: 1 },
|
|
138
|
+
React.createElement(Text, { dimColor: true }, "Ctrl+Enter: newline | up/down: history | Tab: autocomplete"))));
|
|
139
|
+
}
|
|
140
|
+
// ============================================
|
|
141
|
+
// INPUT HANDLER HOOK
|
|
142
|
+
// ============================================
|
|
143
|
+
export function useMultilineInputHandler({ isActive = true, onSubmit, onRequestAutocomplete, inputHistory = [], }) {
|
|
144
|
+
const [state, setState] = useState({
|
|
145
|
+
value: "",
|
|
146
|
+
cursorPos: 0,
|
|
147
|
+
currentLine: 0,
|
|
148
|
+
historyIndex: -1,
|
|
149
|
+
savedInput: "",
|
|
150
|
+
showAutocomplete: false,
|
|
151
|
+
autocompleteSuggestions: [],
|
|
152
|
+
autocompleteIndex: 0,
|
|
153
|
+
});
|
|
154
|
+
const handleKeyEvent = useCallback((event) => {
|
|
155
|
+
if (!isActive)
|
|
156
|
+
return "unhandled";
|
|
157
|
+
const { code, ctrl, shift } = event;
|
|
158
|
+
// Update helper
|
|
159
|
+
const update = (updates) => {
|
|
160
|
+
setState((prev) => ({ ...prev, ...updates }));
|
|
161
|
+
};
|
|
162
|
+
// Get current state
|
|
163
|
+
const { value, cursorPos, currentLine, historyIndex, showAutocomplete } = state;
|
|
164
|
+
// Split into lines for calculations
|
|
165
|
+
const lines = value.split("\n");
|
|
166
|
+
// Autocomplete navigation
|
|
167
|
+
if (showAutocomplete) {
|
|
168
|
+
if (code === "tab" || code === "down") {
|
|
169
|
+
const suggestions = state.autocompleteSuggestions;
|
|
170
|
+
const newIndex = (state.autocompleteIndex + 1) % suggestions.length;
|
|
171
|
+
update({ autocompleteIndex: newIndex });
|
|
172
|
+
return "handled";
|
|
173
|
+
}
|
|
174
|
+
if (code === "up") {
|
|
175
|
+
const suggestions = state.autocompleteSuggestions;
|
|
176
|
+
const newIndex = (state.autocompleteIndex - 1 + suggestions.length) %
|
|
177
|
+
suggestions.length;
|
|
178
|
+
update({ autocompleteIndex: newIndex });
|
|
179
|
+
return "handled";
|
|
180
|
+
}
|
|
181
|
+
if (code === "enter" || code === "return") {
|
|
182
|
+
const suggestion = state.autocompleteSuggestions[state.autocompleteIndex];
|
|
183
|
+
if (suggestion) {
|
|
184
|
+
// Replace current word with suggestion
|
|
185
|
+
const words = value.split(" ");
|
|
186
|
+
words[words.length - 1] = suggestion.id;
|
|
187
|
+
const newValue = words.join(" ");
|
|
188
|
+
update({
|
|
189
|
+
value: newValue,
|
|
190
|
+
cursorPos: newValue.length,
|
|
191
|
+
showAutocomplete: false,
|
|
192
|
+
autocompleteSuggestions: [],
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return "handled";
|
|
196
|
+
}
|
|
197
|
+
if (code === "escape") {
|
|
198
|
+
update({ showAutocomplete: false, autocompleteSuggestions: [] });
|
|
199
|
+
return "handled";
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Submit (Enter without Ctrl = submit if single line, with Ctrl = always submit)
|
|
203
|
+
if (code === "enter" || code === "return") {
|
|
204
|
+
if (ctrl) {
|
|
205
|
+
// Ctrl+Enter = submit even in multiline
|
|
206
|
+
if (value.trim() && onSubmit) {
|
|
207
|
+
onSubmit(value);
|
|
208
|
+
update({
|
|
209
|
+
value: "",
|
|
210
|
+
cursorPos: 0,
|
|
211
|
+
currentLine: 0,
|
|
212
|
+
historyIndex: -1,
|
|
213
|
+
savedInput: "",
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return "handled";
|
|
217
|
+
}
|
|
218
|
+
// Regular Enter
|
|
219
|
+
if (lines.length === 1) {
|
|
220
|
+
// Single line mode - submit
|
|
221
|
+
if (value.trim() && onSubmit) {
|
|
222
|
+
onSubmit(value);
|
|
223
|
+
update({
|
|
224
|
+
value: "",
|
|
225
|
+
cursorPos: 0,
|
|
226
|
+
currentLine: 0,
|
|
227
|
+
historyIndex: -1,
|
|
228
|
+
savedInput: "",
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
// Multiline mode - insert newline
|
|
234
|
+
const newValue = value.slice(0, cursorPos) + "\n" + value.slice(cursorPos);
|
|
235
|
+
const newCursorPos = cursorPos + 1;
|
|
236
|
+
update({
|
|
237
|
+
value: newValue,
|
|
238
|
+
cursorPos: newCursorPos,
|
|
239
|
+
currentLine: currentLine + 1,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
return "handled";
|
|
243
|
+
}
|
|
244
|
+
// Backspace
|
|
245
|
+
if (code === "backspace") {
|
|
246
|
+
if (cursorPos > 0) {
|
|
247
|
+
const newValue = value.slice(0, cursorPos - 1) + value.slice(cursorPos);
|
|
248
|
+
const newCursorPos = cursorPos - 1;
|
|
249
|
+
const newCurrentLine = newValue.slice(0, newCursorPos).split("\n").length - 1;
|
|
250
|
+
update({
|
|
251
|
+
value: newValue,
|
|
252
|
+
cursorPos: newCursorPos,
|
|
253
|
+
currentLine: newCurrentLine,
|
|
254
|
+
});
|
|
255
|
+
// Check for autocomplete
|
|
256
|
+
if (newValue.startsWith("/") && onRequestAutocomplete) {
|
|
257
|
+
const suggestions = onRequestAutocomplete(newValue);
|
|
258
|
+
update({
|
|
259
|
+
showAutocomplete: suggestions.length > 0,
|
|
260
|
+
autocompleteSuggestions: suggestions,
|
|
261
|
+
autocompleteIndex: 0,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return "handled";
|
|
266
|
+
}
|
|
267
|
+
// Delete
|
|
268
|
+
if (code === "delete") {
|
|
269
|
+
if (cursorPos < value.length) {
|
|
270
|
+
const newValue = value.slice(0, cursorPos) + value.slice(cursorPos + 1);
|
|
271
|
+
update({ value: newValue });
|
|
272
|
+
}
|
|
273
|
+
return "handled";
|
|
274
|
+
}
|
|
275
|
+
// Arrow keys
|
|
276
|
+
if (code === "left") {
|
|
277
|
+
update({ cursorPos: Math.max(0, cursorPos - 1) });
|
|
278
|
+
return "handled";
|
|
279
|
+
}
|
|
280
|
+
if (code === "right") {
|
|
281
|
+
update({ cursorPos: Math.min(value.length, cursorPos + 1) });
|
|
282
|
+
return "handled";
|
|
283
|
+
}
|
|
284
|
+
if (code === "up") {
|
|
285
|
+
// History navigation
|
|
286
|
+
if (inputHistory.length > 0) {
|
|
287
|
+
const newIndex = historyIndex === -1 ? 0 : Math.min(historyIndex + 1, inputHistory.length - 1);
|
|
288
|
+
const historyValue = inputHistory[newIndex] ?? "";
|
|
289
|
+
update({
|
|
290
|
+
historyIndex: newIndex,
|
|
291
|
+
value: historyValue,
|
|
292
|
+
cursorPos: historyValue.length,
|
|
293
|
+
currentLine: historyValue.split("\n").length - 1,
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return "handled";
|
|
297
|
+
}
|
|
298
|
+
if (code === "down") {
|
|
299
|
+
if (historyIndex > 0) {
|
|
300
|
+
const newIndex = historyIndex - 1;
|
|
301
|
+
const historyValue = inputHistory[newIndex] ?? "";
|
|
302
|
+
update({
|
|
303
|
+
historyIndex: newIndex,
|
|
304
|
+
value: historyValue,
|
|
305
|
+
cursorPos: historyValue.length,
|
|
306
|
+
currentLine: historyValue.split("\n").length - 1,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
else if (historyIndex === 0) {
|
|
310
|
+
// Restore saved input
|
|
311
|
+
update({
|
|
312
|
+
historyIndex: -1,
|
|
313
|
+
value: state.savedInput,
|
|
314
|
+
cursorPos: state.savedInput.length,
|
|
315
|
+
currentLine: state.savedInput.split("\n").length - 1,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
return "handled";
|
|
319
|
+
}
|
|
320
|
+
// Home/End
|
|
321
|
+
if (code === "home" || (code === "a" && ctrl)) {
|
|
322
|
+
// Go to start of current line
|
|
323
|
+
const lineStart = value.slice(0, cursorPos).lastIndexOf("\n") + 1;
|
|
324
|
+
update({ cursorPos: lineStart });
|
|
325
|
+
return "handled";
|
|
326
|
+
}
|
|
327
|
+
if (code === "end" || (code === "e" && ctrl)) {
|
|
328
|
+
// Go to end of current line
|
|
329
|
+
const lineEnd = value.indexOf("\n", cursorPos);
|
|
330
|
+
update({ cursorPos: lineEnd === -1 ? value.length : lineEnd });
|
|
331
|
+
return "handled";
|
|
332
|
+
}
|
|
333
|
+
// Ctrl+U - clear line
|
|
334
|
+
if (code === "u" && ctrl) {
|
|
335
|
+
const lineStart = value.slice(0, cursorPos).lastIndexOf("\n") + 1;
|
|
336
|
+
const lineEnd = value.indexOf("\n", cursorPos);
|
|
337
|
+
const newValue = value.slice(0, lineStart) +
|
|
338
|
+
(lineEnd === -1 ? "" : value.slice(lineEnd + 1));
|
|
339
|
+
update({
|
|
340
|
+
value: newValue,
|
|
341
|
+
cursorPos: lineStart,
|
|
342
|
+
});
|
|
343
|
+
return "handled";
|
|
344
|
+
}
|
|
345
|
+
// Ctrl+W - delete word
|
|
346
|
+
if (code === "w" && ctrl) {
|
|
347
|
+
const beforeCursor = value
|
|
348
|
+
.slice(0, cursorPos)
|
|
349
|
+
.replace(/\s+\S*$/, "");
|
|
350
|
+
const newValue = beforeCursor + value.slice(cursorPos);
|
|
351
|
+
update({
|
|
352
|
+
value: newValue,
|
|
353
|
+
cursorPos: beforeCursor.length,
|
|
354
|
+
});
|
|
355
|
+
return "handled";
|
|
356
|
+
}
|
|
357
|
+
// Regular printable character
|
|
358
|
+
if (code.length === 1 && !ctrl) {
|
|
359
|
+
const newValue = value.slice(0, cursorPos) + code + value.slice(cursorPos);
|
|
360
|
+
const newCursorPos = cursorPos + 1;
|
|
361
|
+
update({
|
|
362
|
+
value: newValue,
|
|
363
|
+
cursorPos: newCursorPos,
|
|
364
|
+
historyIndex: -1, // Reset history navigation on typing
|
|
365
|
+
});
|
|
366
|
+
// Check for autocomplete trigger
|
|
367
|
+
if (newValue.startsWith("/") && onRequestAutocomplete) {
|
|
368
|
+
const suggestions = onRequestAutocomplete(newValue);
|
|
369
|
+
update({
|
|
370
|
+
showAutocomplete: suggestions.length > 0,
|
|
371
|
+
autocompleteSuggestions: suggestions,
|
|
372
|
+
autocompleteIndex: 0,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
update({ showAutocomplete: false });
|
|
377
|
+
}
|
|
378
|
+
return "handled";
|
|
379
|
+
}
|
|
380
|
+
return "unhandled";
|
|
381
|
+
}, [isActive, onSubmit, onRequestAutocomplete, inputHistory, state]);
|
|
382
|
+
return {
|
|
383
|
+
state,
|
|
384
|
+
handleKeyEvent,
|
|
385
|
+
// Convenience helpers
|
|
386
|
+
setValue: (value) => setState((prev) => ({ ...prev, value })),
|
|
387
|
+
reset: () => setState({
|
|
388
|
+
value: "",
|
|
389
|
+
cursorPos: 0,
|
|
390
|
+
currentLine: 0,
|
|
391
|
+
historyIndex: -1,
|
|
392
|
+
savedInput: "",
|
|
393
|
+
showAutocomplete: false,
|
|
394
|
+
autocompleteSuggestions: [],
|
|
395
|
+
autocompleteIndex: 0,
|
|
396
|
+
}),
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
export default MultilineInput;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** @jsx React.createElement */
|
|
2
|
+
/**
|
|
3
|
+
* Pane Manager Component
|
|
4
|
+
* Resizable split pane layout for TUI
|
|
5
|
+
*
|
|
6
|
+
* Supports:
|
|
7
|
+
* - Horizontal and vertical splits
|
|
8
|
+
* - Keyboard-driven resize (Ctrl+Arrow keys when focused)
|
|
9
|
+
* - Collapsible panes
|
|
10
|
+
* - Min/max widths
|
|
11
|
+
*/
|
|
12
|
+
import React from "react";
|
|
13
|
+
export type PaneDirection = "horizontal" | "vertical";
|
|
14
|
+
export interface PaneConfig {
|
|
15
|
+
id: string;
|
|
16
|
+
/** Initial size (width for horizontal, height for vertical) as percentage or absolute */
|
|
17
|
+
size: number;
|
|
18
|
+
/** Size unit: "percent" or "fixed" */
|
|
19
|
+
sizeUnit?: "percent" | "fixed";
|
|
20
|
+
/** Minimum size in cells */
|
|
21
|
+
minSize?: number;
|
|
22
|
+
/** Maximum size in cells */
|
|
23
|
+
maxSize?: number;
|
|
24
|
+
/** Whether pane can be collapsed */
|
|
25
|
+
collapsible?: boolean;
|
|
26
|
+
/** Whether pane starts collapsed */
|
|
27
|
+
collapsed?: boolean;
|
|
28
|
+
/** Pane label for header */
|
|
29
|
+
label?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface PaneManagerProps {
|
|
32
|
+
direction?: PaneDirection;
|
|
33
|
+
panes: PaneConfig[];
|
|
34
|
+
children: React.ReactNode[];
|
|
35
|
+
/** Active pane index for resize focus */
|
|
36
|
+
activePane?: number;
|
|
37
|
+
/** Show resize handles */
|
|
38
|
+
showHandles?: boolean;
|
|
39
|
+
/** Handle character */
|
|
40
|
+
handleChar?: string;
|
|
41
|
+
/** Handle color */
|
|
42
|
+
handleColor?: string;
|
|
43
|
+
/** Called when pane sizes change */
|
|
44
|
+
onPaneChange?: (sizes: number[]) => void;
|
|
45
|
+
}
|
|
46
|
+
export interface PaneContextValue {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
isActive: boolean;
|
|
50
|
+
paneId: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const PaneContext: React.Context<PaneContextValue>;
|
|
53
|
+
/** Hook to access current pane context */
|
|
54
|
+
export declare function usePaneContext(): PaneContextValue;
|
|
55
|
+
/** Alias for usePaneContext for convenience */
|
|
56
|
+
export declare const usePane: typeof usePaneContext;
|
|
57
|
+
export declare function PaneManager({ direction, panes, children, activePane, showHandles, handleChar, handleColor, onPaneChange, }: PaneManagerProps): React.JSX.Element;
|
|
58
|
+
export default PaneManager;
|
|
59
|
+
//# sourceMappingURL=PaneManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaneManager.d.ts","sourceRoot":"","sources":["../../../../../../packages/src/interfaces/ui/terminal/tui/components/PaneManager.tsx"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B;;;;;;;;;GASG;AAEH,OAAO,KAAmE,MAAM,OAAO,CAAC;AAOxF,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC/B,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC5B,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uBAAuB;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,WAAW,iCAKtB,CAAC;AAEH,0CAA0C;AAC1C,wBAAgB,cAAc,IAAI,gBAAgB,CAEjD;AAED,+CAA+C;AAC/C,eAAO,MAAM,OAAO,uBAAiB,CAAC;AAiGtC,wBAAgB,WAAW,CAAC,EAC1B,SAAwB,EACxB,KAAK,EACL,QAAQ,EACR,UAAc,EACd,WAAkB,EAClB,UAAgB,EAChB,WAAoB,EACpB,YAAY,GACb,EAAE,gBAAgB,qBAqJlB;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/** @jsx React.createElement */
|
|
2
|
+
/**
|
|
3
|
+
* Pane Manager Component
|
|
4
|
+
* Resizable split pane layout for TUI
|
|
5
|
+
*
|
|
6
|
+
* Supports:
|
|
7
|
+
* - Horizontal and vertical splits
|
|
8
|
+
* - Keyboard-driven resize (Ctrl+Arrow keys when focused)
|
|
9
|
+
* - Collapsible panes
|
|
10
|
+
* - Min/max widths
|
|
11
|
+
*/
|
|
12
|
+
import React, { useState, useCallback, useRef, createContext, useContext } from "react";
|
|
13
|
+
import { Box, Text, useStdout } from "ink";
|
|
14
|
+
export const PaneContext = createContext({
|
|
15
|
+
width: 80,
|
|
16
|
+
height: 24,
|
|
17
|
+
isActive: false,
|
|
18
|
+
paneId: "",
|
|
19
|
+
});
|
|
20
|
+
/** Hook to access current pane context */
|
|
21
|
+
export function usePaneContext() {
|
|
22
|
+
return useContext(PaneContext);
|
|
23
|
+
}
|
|
24
|
+
/** Alias for usePaneContext for convenience */
|
|
25
|
+
export const usePane = usePaneContext;
|
|
26
|
+
function ResizeHandle({ direction, color = "gray", char = "│", isFocused }) {
|
|
27
|
+
const handleColor = isFocused ? "cyan" : color;
|
|
28
|
+
const displayChar = direction === "horizontal" ? char : "─";
|
|
29
|
+
return (React.createElement(Box, null,
|
|
30
|
+
React.createElement(Text, { color: handleColor }, displayChar)));
|
|
31
|
+
}
|
|
32
|
+
function CollapsedPane({ config, onToggle }) {
|
|
33
|
+
return (React.createElement(Box, { borderStyle: "single", borderColor: "gray", paddingX: 1, width: 3, flexDirection: "column" },
|
|
34
|
+
React.createElement(Text, { dimColor: true, bold: true }, config.label?.charAt(0) || "P"),
|
|
35
|
+
React.createElement(Text, { dimColor: true }, config.collapsed ? "▶" : "◀")));
|
|
36
|
+
}
|
|
37
|
+
function Pane({ config, width, height, isActive, children, showHeader = true }) {
|
|
38
|
+
return (React.createElement(PaneContext.Provider, { value: { width, height, isActive, paneId: config.id } },
|
|
39
|
+
React.createElement(Box, { flexDirection: "column", width: width, height: height, borderStyle: isActive ? "double" : "single", borderColor: isActive ? "cyan" : "gray" },
|
|
40
|
+
showHeader && config.label && (React.createElement(Box, { paddingX: 1, ...(isActive ? { backgroundColor: "cyan" } : {}) },
|
|
41
|
+
React.createElement(Text, { bold: true, inverse: isActive, color: isActive ? "black" : "white" }, config.label))),
|
|
42
|
+
React.createElement(Box, { flexGrow: 1, overflow: "hidden" }, children))));
|
|
43
|
+
}
|
|
44
|
+
// ============================================
|
|
45
|
+
// PANE MANAGER COMPONENT
|
|
46
|
+
// ============================================
|
|
47
|
+
export function PaneManager({ direction = "horizontal", panes, children, activePane = 0, showHandles = true, handleChar = "│", handleColor = "gray", onPaneChange, }) {
|
|
48
|
+
const { stdout } = useStdout();
|
|
49
|
+
const totalWidth = stdout.columns || 80;
|
|
50
|
+
const totalHeight = stdout.rows || 24;
|
|
51
|
+
const [sizes, setSizes] = useState(() => panes.map(p => p.size));
|
|
52
|
+
const [collapsedPanes, setCollapsedPanes] = useState(() => new Set(panes.filter(p => p.collapsed).map(p => p.id)));
|
|
53
|
+
const containerRef = useRef(0);
|
|
54
|
+
// Calculate actual sizes
|
|
55
|
+
const calculateSizes = useCallback(() => {
|
|
56
|
+
const availableSpace = direction === "horizontal" ? totalWidth : totalHeight;
|
|
57
|
+
const visiblePanes = panes.filter(p => !collapsedPanes.has(p.id));
|
|
58
|
+
const handleCount = showHandles ? Math.max(0, visiblePanes.length - 1) : 0;
|
|
59
|
+
const handleSpace = handleCount * 1; // 1 char per handle
|
|
60
|
+
const usableSpace = availableSpace - handleSpace;
|
|
61
|
+
const calculated = [];
|
|
62
|
+
let remainingSpace = usableSpace;
|
|
63
|
+
let percentTotal = 0;
|
|
64
|
+
panes.forEach((pane, i) => {
|
|
65
|
+
if (collapsedPanes.has(pane.id)) {
|
|
66
|
+
calculated.push(3); // Collapsed width
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const size = sizes[i] ?? pane.size;
|
|
70
|
+
const unit = pane.sizeUnit ?? "percent";
|
|
71
|
+
if (unit === "fixed") {
|
|
72
|
+
calculated.push(size);
|
|
73
|
+
remainingSpace -= size;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
percentTotal += size;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
// Distribute remaining space by percentage
|
|
80
|
+
let percentSpace = remainingSpace;
|
|
81
|
+
panes.forEach((pane, i) => {
|
|
82
|
+
if (collapsedPanes.has(pane.id))
|
|
83
|
+
return;
|
|
84
|
+
if (pane.sizeUnit === "fixed")
|
|
85
|
+
return;
|
|
86
|
+
const size = sizes[i] ?? pane.size;
|
|
87
|
+
const actualSize = Math.round((size / percentTotal) * percentSpace);
|
|
88
|
+
// Apply min/max constraints
|
|
89
|
+
const constrained = Math.max(pane.minSize ?? 10, Math.min(pane.maxSize ?? availableSpace, actualSize));
|
|
90
|
+
calculated[i] = constrained;
|
|
91
|
+
});
|
|
92
|
+
return calculated;
|
|
93
|
+
}, [panes, sizes, collapsedPanes, direction, totalWidth, totalHeight, showHandles]);
|
|
94
|
+
const actualSizes = calculateSizes();
|
|
95
|
+
// Toggle pane collapse
|
|
96
|
+
const togglePane = useCallback((paneId) => {
|
|
97
|
+
setCollapsedPanes(prev => {
|
|
98
|
+
const next = new Set(prev);
|
|
99
|
+
if (next.has(paneId)) {
|
|
100
|
+
next.delete(paneId);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
next.add(paneId);
|
|
104
|
+
}
|
|
105
|
+
return next;
|
|
106
|
+
});
|
|
107
|
+
}, []);
|
|
108
|
+
// Resize pane (keyboard-driven)
|
|
109
|
+
const resizePane = useCallback((paneIndex, delta) => {
|
|
110
|
+
setSizes(prev => {
|
|
111
|
+
const next = [...prev];
|
|
112
|
+
const currentSize = next[paneIndex] ?? panes[paneIndex]?.size ?? 50;
|
|
113
|
+
const newSize = Math.max(panes[paneIndex]?.minSize ?? 10, Math.min(panes[paneIndex]?.maxSize ?? 90, currentSize + delta));
|
|
114
|
+
next[paneIndex] = newSize;
|
|
115
|
+
onPaneChange?.(next);
|
|
116
|
+
return next;
|
|
117
|
+
});
|
|
118
|
+
}, [panes, onPaneChange]);
|
|
119
|
+
// Build layout
|
|
120
|
+
const elements = [];
|
|
121
|
+
let childIndex = 0;
|
|
122
|
+
panes.forEach((pane, i) => {
|
|
123
|
+
const isCollapsed = collapsedPanes.has(pane.id);
|
|
124
|
+
const size = actualSizes[i] ?? 10;
|
|
125
|
+
if (isCollapsed) {
|
|
126
|
+
elements.push(React.createElement(CollapsedPane, { key: pane.id, config: pane, onToggle: () => togglePane(pane.id) }));
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
elements.push(React.createElement(Pane, { key: pane.id, config: pane, width: direction === "horizontal" ? size : totalWidth, height: direction === "vertical" ? size : totalHeight, isActive: i === activePane }, children[childIndex]));
|
|
130
|
+
childIndex++;
|
|
131
|
+
}
|
|
132
|
+
// Add resize handle between panes
|
|
133
|
+
if (showHandles && i < panes.length - 1 && !isCollapsed) {
|
|
134
|
+
elements.push(React.createElement(ResizeHandle, { key: `handle-${i}`, direction: direction, color: handleColor, char: handleChar, isFocused: i === activePane - 1 || i === activePane }));
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return (React.createElement(Box, { ref: containerRef, flexDirection: direction === "horizontal" ? "row" : "column", width: totalWidth, height: totalHeight }, elements));
|
|
138
|
+
}
|
|
139
|
+
export default PaneManager;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** @jsx React.createElement */
|
|
2
|
+
/**
|
|
3
|
+
* Sidebar Component
|
|
4
|
+
* Collapsible sidebar for sessions, files, todos, and tools
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - Collapsible with keyboard shortcut
|
|
8
|
+
* - Tabbed sections (sessions, files, todos, tools)
|
|
9
|
+
* - Keyboard navigation
|
|
10
|
+
* - Context-aware content
|
|
11
|
+
*/
|
|
12
|
+
import React from "react";
|
|
13
|
+
export type SidebarTab = "sessions" | "files" | "todos" | "tools";
|
|
14
|
+
export interface SidebarSession {
|
|
15
|
+
id: string;
|
|
16
|
+
messageCount: number;
|
|
17
|
+
lastActivity?: number;
|
|
18
|
+
model?: string;
|
|
19
|
+
preview?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SidebarFile {
|
|
22
|
+
path: string;
|
|
23
|
+
status: "modified" | "added" | "deleted" | "untracked";
|
|
24
|
+
lineCount?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface SidebarTodo {
|
|
27
|
+
id: string;
|
|
28
|
+
text: string;
|
|
29
|
+
status: "pending" | "in_progress" | "completed";
|
|
30
|
+
}
|
|
31
|
+
export interface SidebarTool {
|
|
32
|
+
name: string;
|
|
33
|
+
server: string;
|
|
34
|
+
status: "available" | "running" | "error";
|
|
35
|
+
}
|
|
36
|
+
export interface SidebarProps {
|
|
37
|
+
/** Whether sidebar is visible */
|
|
38
|
+
isOpen: boolean;
|
|
39
|
+
/** Current active tab */
|
|
40
|
+
activeTab?: SidebarTab;
|
|
41
|
+
/** Width in columns */
|
|
42
|
+
width?: number;
|
|
43
|
+
/** Sessions list */
|
|
44
|
+
sessions?: SidebarSession[];
|
|
45
|
+
/** Modified files list */
|
|
46
|
+
files?: SidebarFile[];
|
|
47
|
+
/** Todos list */
|
|
48
|
+
todos?: SidebarTodo[];
|
|
49
|
+
/** Available tools list */
|
|
50
|
+
tools?: SidebarTool[];
|
|
51
|
+
/** Current session ID */
|
|
52
|
+
currentSessionId?: string;
|
|
53
|
+
/** Called when tab changes */
|
|
54
|
+
onTabChange?: (tab: SidebarTab) => void;
|
|
55
|
+
/** Called when session selected */
|
|
56
|
+
onSessionSelect?: (sessionId: string) => void;
|
|
57
|
+
/** Called when file selected */
|
|
58
|
+
onFileSelect?: (path: string) => void;
|
|
59
|
+
/** Called when todo toggled */
|
|
60
|
+
onTodoToggle?: (todoId: string) => void;
|
|
61
|
+
/** Called when tool selected */
|
|
62
|
+
onToolSelect?: (toolName: string) => void;
|
|
63
|
+
/** Called when close requested */
|
|
64
|
+
onClose?: () => void;
|
|
65
|
+
}
|
|
66
|
+
export declare function Sidebar({ isOpen, activeTab, width, sessions, files, todos, tools, currentSessionId, onTabChange, onSessionSelect, onFileSelect, onTodoToggle, onToolSelect, onClose, }: SidebarProps): React.JSX.Element;
|
|
67
|
+
export default Sidebar;
|
|
68
|
+
//# sourceMappingURL=Sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../../../packages/src/interfaces/ui/terminal/tui/components/Sidebar.tsx"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B;;;;;;;;;GASG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AAQxE,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;CACjD;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;CAC3C;AAED,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,yBAAyB;IACzB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,uBAAuB;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;IAC5B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,iBAAiB;IACjB,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8BAA8B;IAC9B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,mCAAmC;IACnC,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,gCAAgC;IAChC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+BAA+B;IAC/B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,gCAAgC;IAChC,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAmZD,wBAAgB,OAAO,CAAC,EACtB,MAAM,EACN,SAAsB,EACtB,KAAU,EACV,QAAa,EACb,KAAU,EACV,KAAU,EACV,KAAU,EACV,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,OAAO,GACR,EAAE,YAAY,qBAqEd;AAuCD,eAAe,OAAO,CAAC"}
|