hoomanjs 1.18.0 → 1.18.1
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 +22 -26
- package/dist/acp/acp-agent.d.ts +69 -0
- package/dist/acp/acp-agent.js +628 -0
- package/dist/acp/acp-agent.js.map +1 -0
- package/dist/acp/approvals.d.ts +5 -0
- package/dist/acp/approvals.js +130 -0
- package/dist/acp/approvals.js.map +1 -0
- package/dist/acp/index.d.ts +1 -0
- package/dist/acp/index.js +2 -0
- package/dist/acp/index.js.map +1 -0
- package/dist/acp/mcp-servers.d.ts +7 -0
- package/dist/acp/mcp-servers.js +57 -0
- package/dist/acp/mcp-servers.js.map +1 -0
- package/dist/acp/meta/system-prompt.d.ts +12 -0
- package/dist/acp/meta/system-prompt.js +41 -0
- package/dist/acp/meta/system-prompt.js.map +1 -0
- package/dist/acp/meta/user-id.d.ts +12 -0
- package/dist/acp/meta/user-id.js +43 -0
- package/dist/acp/meta/user-id.js.map +1 -0
- package/dist/acp/prompt-invoke.d.ts +10 -0
- package/dist/acp/prompt-invoke.js +131 -0
- package/dist/acp/prompt-invoke.js.map +1 -0
- package/dist/acp/sessions/config-options.d.ts +7 -0
- package/dist/acp/sessions/config-options.js +101 -0
- package/dist/acp/sessions/config-options.js.map +1 -0
- package/dist/acp/sessions/replay.d.ts +7 -0
- package/dist/acp/sessions/replay.js +117 -0
- package/dist/acp/sessions/replay.js.map +1 -0
- package/dist/acp/sessions/store.d.ts +24 -0
- package/dist/acp/sessions/store.js +96 -0
- package/dist/acp/sessions/store.js.map +1 -0
- package/dist/acp/sessions/title.d.ts +5 -0
- package/dist/acp/sessions/title.js +22 -0
- package/dist/acp/sessions/title.js.map +1 -0
- package/dist/acp/utils/paths.d.ts +2 -0
- package/{src/acp/utils/paths.ts → dist/acp/utils/paths.js} +2 -2
- package/dist/acp/utils/paths.js.map +1 -0
- package/dist/acp/utils/tool-kind.d.ts +6 -0
- package/dist/acp/utils/tool-kind.js +53 -0
- package/dist/acp/utils/tool-kind.js.map +1 -0
- package/dist/acp/utils/tool-locations.d.ts +3 -0
- package/dist/acp/utils/tool-locations.js +44 -0
- package/dist/acp/utils/tool-locations.js.map +1 -0
- package/dist/acp/utils/tool-result-content.d.ts +8 -0
- package/dist/acp/utils/tool-result-content.js +14 -0
- package/dist/acp/utils/tool-result-content.js.map +1 -0
- package/dist/chat/app.d.ts +15 -0
- package/dist/chat/app.js +458 -0
- package/dist/chat/app.js.map +1 -0
- package/dist/chat/approvals.d.ts +15 -0
- package/dist/chat/approvals.js +74 -0
- package/dist/chat/approvals.js.map +1 -0
- package/dist/chat/components/ApprovalPrompt.d.ts +6 -0
- package/dist/chat/components/ApprovalPrompt.js +11 -0
- package/dist/chat/components/ApprovalPrompt.js.map +1 -0
- package/dist/chat/components/ChatMessage.d.ts +7 -0
- package/dist/chat/components/ChatMessage.js +19 -0
- package/dist/chat/components/ChatMessage.js.map +1 -0
- package/dist/chat/components/Composer.d.ts +11 -0
- package/dist/chat/components/Composer.js +9 -0
- package/dist/chat/components/Composer.js.map +1 -0
- package/dist/chat/components/EmptyChatBanner.d.ts +2 -0
- package/dist/chat/components/EmptyChatBanner.js +8 -0
- package/dist/chat/components/EmptyChatBanner.js.map +1 -0
- package/dist/chat/components/PromptInput.d.ts +11 -0
- package/dist/chat/components/PromptInput.js +26 -0
- package/dist/chat/components/PromptInput.js.map +1 -0
- package/dist/chat/components/QueuedPrompts.d.ts +10 -0
- package/dist/chat/components/QueuedPrompts.js +38 -0
- package/dist/chat/components/QueuedPrompts.js.map +1 -0
- package/dist/chat/components/ReasoningStrip.d.ts +6 -0
- package/dist/chat/components/ReasoningStrip.js +13 -0
- package/dist/chat/components/ReasoningStrip.js.map +1 -0
- package/dist/chat/components/ScrollView.d.ts +101 -0
- package/dist/chat/components/ScrollView.js +74 -0
- package/dist/chat/components/ScrollView.js.map +1 -0
- package/dist/chat/components/Spinner.d.ts +8 -0
- package/dist/chat/components/Spinner.js +19 -0
- package/dist/chat/components/Spinner.js.map +1 -0
- package/dist/chat/components/StatusBar.d.ts +20 -0
- package/dist/chat/components/StatusBar.js +20 -0
- package/dist/chat/components/StatusBar.js.map +1 -0
- package/dist/chat/components/ThinkingStatus.d.ts +1 -0
- package/dist/chat/components/ThinkingStatus.js +119 -0
- package/dist/chat/components/ThinkingStatus.js.map +1 -0
- package/dist/chat/components/TodoPanel.d.ts +6 -0
- package/dist/chat/components/TodoPanel.js +27 -0
- package/dist/chat/components/TodoPanel.js.map +1 -0
- package/dist/chat/components/ToolEvent.d.ts +6 -0
- package/dist/chat/components/ToolEvent.js +18 -0
- package/dist/chat/components/ToolEvent.js.map +1 -0
- package/dist/chat/components/ToolEventFileResult.d.ts +9 -0
- package/dist/chat/components/ToolEventFileResult.js +50 -0
- package/dist/chat/components/ToolEventFileResult.js.map +1 -0
- package/dist/chat/components/Transcript.d.ts +7 -0
- package/dist/chat/components/Transcript.js +9 -0
- package/dist/chat/components/Transcript.js.map +1 -0
- package/dist/chat/components/TranscriptViewport.d.ts +9 -0
- package/dist/chat/components/TranscriptViewport.js +124 -0
- package/dist/chat/components/TranscriptViewport.js.map +1 -0
- package/dist/chat/components/ascii-logo.d.ts +1 -0
- package/{src/chat/components/ascii-logo.ts → dist/chat/components/ascii-logo.js} +3 -2
- package/dist/chat/components/ascii-logo.js.map +1 -0
- package/dist/chat/components/file-tool-diff/file-tool-result.d.ts +26 -0
- package/dist/chat/components/file-tool-diff/file-tool-result.js +73 -0
- package/dist/chat/components/file-tool-diff/file-tool-result.js.map +1 -0
- package/dist/chat/components/markdown/BlockRenderer.d.ts +8 -0
- package/dist/chat/components/markdown/BlockRenderer.js +87 -0
- package/dist/chat/components/markdown/BlockRenderer.js.map +1 -0
- package/dist/chat/components/markdown/CodeBlock.d.ts +7 -0
- package/dist/chat/components/markdown/CodeBlock.js +55 -0
- package/dist/chat/components/markdown/CodeBlock.js.map +1 -0
- package/dist/chat/components/markdown/InlineRenderer.d.ts +8 -0
- package/dist/chat/components/markdown/InlineRenderer.js +96 -0
- package/dist/chat/components/markdown/InlineRenderer.js.map +1 -0
- package/dist/chat/components/markdown/MarkdownMessage.d.ts +6 -0
- package/dist/chat/components/markdown/MarkdownMessage.js +13 -0
- package/dist/chat/components/markdown/MarkdownMessage.js.map +1 -0
- package/dist/chat/components/markdown/MarkdownTable.d.ts +6 -0
- package/dist/chat/components/markdown/MarkdownTable.js +12 -0
- package/dist/chat/components/markdown/MarkdownTable.js.map +1 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTableLayout.d.ts +7 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTableLayout.js +186 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTableLayout.js.map +1 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTokens.d.ts +9 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTokens.js +25 -0
- package/dist/chat/components/markdown/hooks/useMarkdownTokens.js.map +1 -0
- package/dist/chat/components/markdown/lexer.d.ts +7 -0
- package/dist/chat/components/markdown/lexer.js +89 -0
- package/dist/chat/components/markdown/lexer.js.map +1 -0
- package/dist/chat/components/prompt-input/clipboard-image.d.ts +1 -0
- package/dist/chat/components/prompt-input/clipboard-image.js +112 -0
- package/dist/chat/components/prompt-input/clipboard-image.js.map +1 -0
- package/dist/chat/components/prompt-input/hooks/usePromptInputController.d.ts +1 -0
- package/dist/chat/components/prompt-input/hooks/usePromptInputController.js +2 -0
- package/dist/chat/components/prompt-input/hooks/usePromptInputController.js.map +1 -0
- package/dist/chat/components/prompt-input/input-model.d.ts +28 -0
- package/dist/chat/components/prompt-input/input-model.js +231 -0
- package/dist/chat/components/prompt-input/input-model.js.map +1 -0
- package/dist/chat/components/prompt-input/paste.d.ts +11 -0
- package/dist/chat/components/prompt-input/paste.js +85 -0
- package/dist/chat/components/prompt-input/paste.js.map +1 -0
- package/dist/chat/components/prompt-input/render.d.ts +13 -0
- package/dist/chat/components/prompt-input/render.js +54 -0
- package/dist/chat/components/prompt-input/render.js.map +1 -0
- package/dist/chat/components/prompt-input/usePromptInputController.d.ts +17 -0
- package/dist/chat/components/prompt-input/usePromptInputController.js +366 -0
- package/dist/chat/components/prompt-input/usePromptInputController.js.map +1 -0
- package/dist/chat/components/shared.d.ts +6 -0
- package/dist/chat/components/shared.js +66 -0
- package/dist/chat/components/shared.js.map +1 -0
- package/dist/chat/index.d.ts +13 -0
- package/dist/chat/index.js +18 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/mouse.d.ts +5 -0
- package/dist/chat/mouse.js +9 -0
- package/dist/chat/mouse.js.map +1 -0
- package/dist/chat/types.d.ts +20 -0
- package/dist/chat/types.js +2 -0
- package/dist/chat/types.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +126 -0
- package/dist/cli.js.map +1 -0
- package/dist/configure/app.d.ts +3 -0
- package/dist/configure/app.js +1036 -0
- package/dist/configure/app.js.map +1 -0
- package/dist/configure/components/BusyScreen.d.ts +6 -0
- package/dist/configure/components/BusyScreen.js +7 -0
- package/dist/configure/components/BusyScreen.js.map +1 -0
- package/dist/configure/components/HomeScreen.d.ts +12 -0
- package/dist/configure/components/HomeScreen.js +7 -0
- package/dist/configure/components/HomeScreen.js.map +1 -0
- package/dist/configure/components/MenuScreen.d.ts +10 -0
- package/dist/configure/components/MenuScreen.js +15 -0
- package/dist/configure/components/MenuScreen.js.map +1 -0
- package/dist/configure/components/PromptForm.d.ts +8 -0
- package/dist/configure/components/PromptForm.js +12 -0
- package/dist/configure/components/PromptForm.js.map +1 -0
- package/dist/configure/components/SelectMenuItem.d.ts +7 -0
- package/dist/configure/components/SelectMenuItem.js +18 -0
- package/dist/configure/components/SelectMenuItem.js.map +1 -0
- package/dist/configure/index.d.ts +1 -0
- package/dist/configure/index.js +28 -0
- package/dist/configure/index.js.map +1 -0
- package/dist/configure/open-in-editor.d.ts +8 -0
- package/dist/configure/open-in-editor.js +120 -0
- package/dist/configure/open-in-editor.js.map +1 -0
- package/dist/configure/types.d.ts +63 -0
- package/dist/configure/types.js +2 -0
- package/dist/configure/types.js.map +1 -0
- package/dist/configure/utils.d.ts +19 -0
- package/dist/configure/utils.js +108 -0
- package/dist/configure/utils.js.map +1 -0
- package/dist/core/agent/index.d.ts +13 -0
- package/dist/core/agent/index.js +70 -0
- package/dist/core/agent/index.js.map +1 -0
- package/dist/core/agents/definitions.d.ts +12 -0
- package/dist/core/agents/definitions.js +35 -0
- package/dist/core/agents/definitions.js.map +1 -0
- package/dist/core/agents/index.d.ts +4 -0
- package/dist/core/agents/index.js +5 -0
- package/dist/core/agents/index.js.map +1 -0
- package/dist/core/agents/registry.d.ts +5 -0
- package/dist/core/agents/registry.js +84 -0
- package/dist/core/agents/registry.js.map +1 -0
- package/dist/core/agents/runner.d.ts +36 -0
- package/dist/core/agents/runner.js +275 -0
- package/dist/core/agents/runner.js.map +1 -0
- package/dist/core/agents/tools.d.ts +20 -0
- package/dist/core/agents/tools.js +66 -0
- package/dist/core/agents/tools.js.map +1 -0
- package/dist/core/config.d.ts +272 -0
- package/dist/core/config.js +334 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/index.d.ts +23 -0
- package/dist/core/index.js +21 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/mcp/config.d.ts +44 -0
- package/dist/core/mcp/config.js +65 -0
- package/dist/core/mcp/config.js.map +1 -0
- package/dist/core/mcp/index.d.ts +8 -0
- package/dist/core/mcp/index.js +12 -0
- package/dist/core/mcp/index.js.map +1 -0
- package/dist/core/mcp/manager.d.ts +69 -0
- package/dist/core/mcp/manager.js +376 -0
- package/dist/core/mcp/manager.js.map +1 -0
- package/dist/core/mcp/prefixed-mcp-tool.d.ts +14 -0
- package/dist/core/mcp/prefixed-mcp-tool.js +38 -0
- package/dist/core/mcp/prefixed-mcp-tool.js.map +1 -0
- package/dist/core/mcp/tools.d.ts +5 -0
- package/dist/core/mcp/tools.js +82 -0
- package/dist/core/mcp/tools.js.map +1 -0
- package/dist/core/mcp/types.d.ts +40 -0
- package/dist/core/mcp/types.js +28 -0
- package/dist/core/mcp/types.js.map +1 -0
- package/dist/core/memory/index.d.ts +3 -0
- package/dist/core/memory/index.js +3 -0
- package/dist/core/memory/index.js.map +1 -0
- package/dist/core/memory/ltm/embed.d.ts +16 -0
- package/dist/core/memory/ltm/embed.js +49 -0
- package/dist/core/memory/ltm/embed.js.map +1 -0
- package/dist/core/memory/ltm/index.d.ts +3 -0
- package/dist/core/memory/ltm/index.js +3 -0
- package/dist/core/memory/ltm/index.js.map +1 -0
- package/dist/core/memory/ltm/store.d.ts +20 -0
- package/dist/core/memory/ltm/store.js +271 -0
- package/dist/core/memory/ltm/store.js.map +1 -0
- package/dist/core/memory/ltm/tools.d.ts +21 -0
- package/dist/core/memory/ltm/tools.js +127 -0
- package/dist/core/memory/ltm/tools.js.map +1 -0
- package/dist/core/memory/ltm/types.d.ts +79 -0
- package/dist/core/memory/ltm/types.js +2 -0
- package/dist/core/memory/ltm/types.js.map +1 -0
- package/dist/core/memory/ltm/utils.d.ts +40 -0
- package/dist/core/memory/ltm/utils.js +145 -0
- package/dist/core/memory/ltm/utils.js.map +1 -0
- package/dist/core/memory/stm/flat-file-storage.d.ts +27 -0
- package/dist/core/memory/stm/flat-file-storage.js +63 -0
- package/dist/core/memory/stm/flat-file-storage.js.map +1 -0
- package/dist/core/memory/stm/index.d.ts +13 -0
- package/dist/core/memory/stm/index.js +24 -0
- package/dist/core/memory/stm/index.js.map +1 -0
- package/dist/core/memory/stm/lazy-session-manager.d.ts +37 -0
- package/dist/core/memory/stm/lazy-session-manager.js +163 -0
- package/dist/core/memory/stm/lazy-session-manager.js.map +1 -0
- package/dist/core/models/anthropic.d.ts +10 -0
- package/dist/core/models/anthropic.js +38 -0
- package/dist/core/models/anthropic.js.map +1 -0
- package/dist/core/models/bedrock.d.ts +21 -0
- package/dist/core/models/bedrock.js +24 -0
- package/dist/core/models/bedrock.js.map +1 -0
- package/dist/core/models/google.d.ts +10 -0
- package/dist/core/models/google.js +36 -0
- package/dist/core/models/google.js.map +1 -0
- package/dist/core/models/groq.d.ts +10 -0
- package/dist/core/models/groq.js +33 -0
- package/dist/core/models/groq.js.map +1 -0
- package/dist/core/models/index.d.ts +5 -0
- package/dist/core/models/index.js +11 -0
- package/dist/core/models/index.js.map +1 -0
- package/dist/core/models/moonshot.d.ts +11 -0
- package/dist/core/models/moonshot.js +39 -0
- package/dist/core/models/moonshot.js.map +1 -0
- package/dist/core/models/ollama/index.d.ts +3 -0
- package/dist/core/models/ollama/index.js +9 -0
- package/dist/core/models/ollama/index.js.map +1 -0
- package/dist/core/models/ollama/strands-ollama.d.ts +30 -0
- package/dist/core/models/ollama/strands-ollama.js +336 -0
- package/dist/core/models/ollama/strands-ollama.js.map +1 -0
- package/dist/core/models/openai.d.ts +4 -0
- package/dist/core/models/openai.js +9 -0
- package/dist/core/models/openai.js.map +1 -0
- package/dist/core/models/xai.d.ts +10 -0
- package/dist/core/models/xai.js +33 -0
- package/dist/core/models/xai.js.map +1 -0
- package/dist/core/prompts/environment.d.ts +11 -0
- package/dist/core/prompts/environment.js +51 -0
- package/dist/core/prompts/environment.js.map +1 -0
- package/dist/core/prompts/index.d.ts +7 -0
- package/dist/core/prompts/index.js +14 -0
- package/dist/core/prompts/index.js.map +1 -0
- package/dist/core/prompts/skills.d.ts +15 -0
- package/dist/core/prompts/skills.js +86 -0
- package/dist/core/prompts/skills.js.map +1 -0
- package/dist/core/prompts/system.d.ts +22 -0
- package/dist/core/prompts/system.js +164 -0
- package/dist/core/prompts/system.js.map +1 -0
- package/dist/core/skills/built-in/hooman-config/SKILL.md +9 -0
- package/dist/core/skills/index.d.ts +2 -0
- package/dist/core/skills/index.js +3 -0
- package/dist/core/skills/index.js.map +1 -0
- package/dist/core/skills/metadata.d.ts +8 -0
- package/dist/core/skills/metadata.js +20 -0
- package/dist/core/skills/metadata.js.map +1 -0
- package/dist/core/skills/registry.d.ts +38 -0
- package/dist/core/skills/registry.js +165 -0
- package/dist/core/skills/registry.js.map +1 -0
- package/dist/core/skills/tools.d.ts +9 -0
- package/dist/core/skills/tools.js +73 -0
- package/dist/core/skills/tools.js.map +1 -0
- package/dist/core/state/file-tool-display.d.ts +20 -0
- package/dist/core/state/file-tool-display.js +35 -0
- package/dist/core/state/file-tool-display.js.map +1 -0
- package/dist/core/state/thought-process.d.ts +18 -0
- package/dist/core/state/thought-process.js +21 -0
- package/dist/core/state/thought-process.js.map +1 -0
- package/dist/core/state/todos.d.ts +39 -0
- package/dist/core/state/todos.js +53 -0
- package/dist/core/state/todos.js.map +1 -0
- package/dist/core/state/tool-approvals.d.ts +12 -0
- package/dist/core/state/tool-approvals.js +81 -0
- package/dist/core/state/tool-approvals.js.map +1 -0
- package/dist/core/tools/fetch.d.ts +9 -0
- package/dist/core/tools/fetch.js +228 -0
- package/dist/core/tools/fetch.js.map +1 -0
- package/dist/core/tools/filesystem.d.ts +35 -0
- package/dist/core/tools/filesystem.js +791 -0
- package/dist/core/tools/filesystem.js.map +1 -0
- package/dist/core/tools/index.d.ts +9 -0
- package/dist/core/tools/index.js +10 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/shell.d.ts +18 -0
- package/dist/core/tools/shell.js +308 -0
- package/dist/core/tools/shell.js.map +1 -0
- package/dist/core/tools/sleep.d.ts +4 -0
- package/dist/core/tools/sleep.js +46 -0
- package/dist/core/tools/sleep.js.map +1 -0
- package/dist/core/tools/thinking.d.ts +12 -0
- package/dist/core/tools/thinking.js +119 -0
- package/dist/core/tools/thinking.js.map +1 -0
- package/dist/core/tools/time.d.ts +8 -0
- package/dist/core/tools/time.js +94 -0
- package/dist/core/tools/time.js.map +1 -0
- package/dist/core/tools/todo.d.ts +9 -0
- package/dist/core/tools/todo.js +33 -0
- package/dist/core/tools/todo.js.map +1 -0
- package/dist/core/tools/web-search.d.ts +11 -0
- package/dist/core/tools/web-search.js +211 -0
- package/dist/core/tools/web-search.js.map +1 -0
- package/dist/core/tools/wiki.d.ts +11 -0
- package/dist/core/tools/wiki.js +566 -0
- package/dist/core/tools/wiki.js.map +1 -0
- package/dist/core/utils/attachments.d.ts +23 -0
- package/dist/core/utils/attachments.js +125 -0
- package/dist/core/utils/attachments.js.map +1 -0
- package/dist/core/utils/cwd-context.d.ts +2 -0
- package/dist/core/utils/cwd-context.js +9 -0
- package/dist/core/utils/cwd-context.js.map +1 -0
- package/dist/core/utils/file-formats.d.ts +4 -0
- package/dist/core/utils/file-formats.js +48 -0
- package/dist/core/utils/file-formats.js.map +1 -0
- package/dist/core/utils/paths.d.ts +7 -0
- package/dist/core/utils/paths.js +25 -0
- package/dist/core/utils/paths.js.map +1 -0
- package/dist/daemon/approvals.d.ts +5 -0
- package/dist/daemon/approvals.js +95 -0
- package/dist/daemon/approvals.js.map +1 -0
- package/dist/daemon/index.d.ts +11 -0
- package/dist/daemon/index.js +106 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/queue.d.ts +5 -0
- package/dist/daemon/queue.js +38 -0
- package/dist/daemon/queue.js.map +1 -0
- package/dist/exec/approvals.d.ts +6 -0
- package/dist/exec/approvals.js +74 -0
- package/dist/exec/approvals.js.map +1 -0
- package/package.json +20 -9
- package/.github/screenshot.png +0 -0
- package/.github/workflows/build-publish.yml +0 -49
- package/docker-compose.yml +0 -13
- package/src/acp/acp-agent.ts +0 -814
- package/src/acp/approvals.ts +0 -146
- package/src/acp/index.ts +0 -1
- package/src/acp/mcp-servers.ts +0 -64
- package/src/acp/meta/system-prompt.ts +0 -44
- package/src/acp/meta/user-id.ts +0 -44
- package/src/acp/prompt-invoke.ts +0 -149
- package/src/acp/sessions/config-options.ts +0 -120
- package/src/acp/sessions/replay.ts +0 -131
- package/src/acp/sessions/store.ts +0 -161
- package/src/acp/sessions/title.ts +0 -22
- package/src/acp/utils/tool-kind.ts +0 -61
- package/src/acp/utils/tool-locations.ts +0 -48
- package/src/acp/utils/tool-result-content.ts +0 -27
- package/src/chat/app.tsx +0 -636
- package/src/chat/approvals.ts +0 -97
- package/src/chat/components/ApprovalPrompt.tsx +0 -25
- package/src/chat/components/ChatMessage.tsx +0 -50
- package/src/chat/components/Composer.tsx +0 -45
- package/src/chat/components/EmptyChatBanner.tsx +0 -26
- package/src/chat/components/PromptInput.tsx +0 -62
- package/src/chat/components/QueuedPrompts.tsx +0 -76
- package/src/chat/components/ReasoningStrip.tsx +0 -30
- package/src/chat/components/Spinner.tsx +0 -34
- package/src/chat/components/StatusBar.tsx +0 -67
- package/src/chat/components/ThinkingStatus.tsx +0 -128
- package/src/chat/components/TodoPanel.tsx +0 -49
- package/src/chat/components/ToolEvent.tsx +0 -41
- package/src/chat/components/ToolEventFileResult.tsx +0 -116
- package/src/chat/components/Transcript.tsx +0 -34
- package/src/chat/components/TranscriptViewport.tsx +0 -170
- package/src/chat/components/file-tool-diff/file-tool-result.ts +0 -155
- package/src/chat/components/markdown/BlockRenderer.tsx +0 -207
- package/src/chat/components/markdown/CodeBlock.tsx +0 -100
- package/src/chat/components/markdown/InlineRenderer.tsx +0 -122
- package/src/chat/components/markdown/MarkdownMessage.tsx +0 -35
- package/src/chat/components/markdown/MarkdownTable.tsx +0 -23
- package/src/chat/components/markdown/hooks/useMarkdownTableLayout.ts +0 -242
- package/src/chat/components/markdown/hooks/useMarkdownTokens.ts +0 -46
- package/src/chat/components/markdown/lexer.ts +0 -100
- package/src/chat/components/prompt-input/clipboard-image.ts +0 -119
- package/src/chat/components/prompt-input/hooks/usePromptInputController.ts +0 -4
- package/src/chat/components/prompt-input/input-model.ts +0 -294
- package/src/chat/components/prompt-input/paste.ts +0 -105
- package/src/chat/components/prompt-input/render.ts +0 -83
- package/src/chat/components/prompt-input/usePromptInputController.ts +0 -498
- package/src/chat/components/shared.ts +0 -70
- package/src/chat/index.tsx +0 -41
- package/src/chat/mouse.ts +0 -17
- package/src/chat/types.ts +0 -24
- package/src/cli.ts +0 -181
- package/src/configure/app.tsx +0 -1349
- package/src/configure/components/BusyScreen.tsx +0 -22
- package/src/configure/components/HomeScreen.tsx +0 -43
- package/src/configure/components/MenuScreen.tsx +0 -44
- package/src/configure/components/PromptForm.tsx +0 -40
- package/src/configure/components/SelectMenuItem.tsx +0 -30
- package/src/configure/index.tsx +0 -43
- package/src/configure/open-in-editor.ts +0 -133
- package/src/configure/types.ts +0 -51
- package/src/configure/utils.ts +0 -134
- package/src/core/agent/index.ts +0 -108
- package/src/core/agents/definitions.ts +0 -48
- package/src/core/agents/index.ts +0 -15
- package/src/core/agents/registry.ts +0 -106
- package/src/core/agents/runner.ts +0 -375
- package/src/core/agents/tools.ts +0 -100
- package/src/core/config.ts +0 -377
- package/src/core/index.ts +0 -60
- package/src/core/mcp/config.ts +0 -80
- package/src/core/mcp/index.ts +0 -33
- package/src/core/mcp/manager.ts +0 -491
- package/src/core/mcp/prefixed-mcp-tool.ts +0 -45
- package/src/core/mcp/tools.ts +0 -92
- package/src/core/mcp/types.ts +0 -37
- package/src/core/memory/index.ts +0 -17
- package/src/core/memory/ltm/embed.ts +0 -67
- package/src/core/memory/ltm/index.ts +0 -18
- package/src/core/memory/ltm/store.ts +0 -376
- package/src/core/memory/ltm/tools.ts +0 -146
- package/src/core/memory/ltm/types.ts +0 -111
- package/src/core/memory/ltm/utils.ts +0 -218
- package/src/core/memory/stm/flat-file-storage.ts +0 -89
- package/src/core/memory/stm/index.ts +0 -32
- package/src/core/memory/stm/lazy-session-manager.ts +0 -220
- package/src/core/models/anthropic.ts +0 -53
- package/src/core/models/bedrock.ts +0 -54
- package/src/core/models/google.ts +0 -51
- package/src/core/models/groq.ts +0 -48
- package/src/core/models/index.ts +0 -19
- package/src/core/models/moonshot.ts +0 -54
- package/src/core/models/ollama/index.ts +0 -13
- package/src/core/models/ollama/strands-ollama.ts +0 -439
- package/src/core/models/openai.ts +0 -12
- package/src/core/models/xai.ts +0 -47
- package/src/core/prompts/environment.ts +0 -71
- package/src/core/prompts/index.ts +0 -22
- package/src/core/prompts/skills.ts +0 -66
- package/src/core/prompts/system.ts +0 -183
- package/src/core/skills/index.ts +0 -2
- package/src/core/skills/registry.ts +0 -239
- package/src/core/skills/tools.ts +0 -80
- package/src/core/state/file-tool-display.ts +0 -70
- package/src/core/state/thought-process.ts +0 -49
- package/src/core/state/todos.ts +0 -84
- package/src/core/state/tool-approvals.ts +0 -100
- package/src/core/tools/fetch.ts +0 -288
- package/src/core/tools/filesystem.ts +0 -1105
- package/src/core/tools/index.ts +0 -9
- package/src/core/tools/shell.ts +0 -426
- package/src/core/tools/sleep.ts +0 -51
- package/src/core/tools/thinking.ts +0 -149
- package/src/core/tools/time.ts +0 -121
- package/src/core/tools/todo.ts +0 -44
- package/src/core/tools/web-search.ts +0 -278
- package/src/core/tools/wiki.ts +0 -703
- package/src/core/utils/attachments.ts +0 -201
- package/src/core/utils/cwd-context.ts +0 -11
- package/src/core/utils/file-formats.ts +0 -60
- package/src/core/utils/paths.ts +0 -37
- package/src/daemon/approvals.ts +0 -127
- package/src/daemon/index.ts +0 -153
- package/src/daemon/queue.ts +0 -48
- package/src/exec/approvals.ts +0 -90
- package/tsconfig.json +0 -30
- /package/{src → dist}/core/prompts/agents/plan.md +0 -0
- /package/{src → dist}/core/prompts/agents/research.md +0 -0
- /package/{src → dist}/core/prompts/harness/behaviour.md +0 -0
- /package/{src → dist}/core/prompts/harness/communication.md +0 -0
- /package/{src → dist}/core/prompts/harness/engineering.md +0 -0
- /package/{src → dist}/core/prompts/harness/execution.md +0 -0
- /package/{src → dist}/core/prompts/harness/guardrails.md +0 -0
- /package/{src → dist}/core/prompts/static/daemon.md +0 -0
- /package/{src → dist}/core/prompts/static/environment.md +0 -0
- /package/{src → dist}/core/prompts/static/fetch.md +0 -0
- /package/{src → dist}/core/prompts/static/filesystem.md +0 -0
- /package/{src → dist}/core/prompts/static/identity.md +0 -0
- /package/{src → dist}/core/prompts/static/ltm.md +0 -0
- /package/{src → dist}/core/prompts/static/shell.md +0 -0
- /package/{src → dist}/core/prompts/static/skills.md +0 -0
- /package/{src → dist}/core/prompts/static/sleep.md +0 -0
- /package/{src → dist}/core/prompts/static/subagents.md +0 -0
- /package/{src → dist}/core/prompts/static/thinking.md +0 -0
- /package/{src → dist}/core/prompts/static/todo.md +0 -0
- /package/{src → dist}/core/prompts/static/web-search.md +0 -0
- /package/{src → dist}/core/prompts/static/wiki.md +0 -0
|
@@ -1,498 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
-
import { useInput } from "ink";
|
|
3
|
-
import fs from "node:fs/promises";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import type { InputState } from "./input-model.ts";
|
|
6
|
-
import {
|
|
7
|
-
clampCursor,
|
|
8
|
-
deleteBackward,
|
|
9
|
-
deleteForward,
|
|
10
|
-
deleteToLineEnd,
|
|
11
|
-
deleteToLineStart,
|
|
12
|
-
deleteWordBackward,
|
|
13
|
-
deleteWordForward,
|
|
14
|
-
insertText,
|
|
15
|
-
moveCursorDown,
|
|
16
|
-
moveCursorLeft,
|
|
17
|
-
moveCursorLineEnd,
|
|
18
|
-
moveCursorLineStart,
|
|
19
|
-
moveCursorRight,
|
|
20
|
-
moveCursorUp,
|
|
21
|
-
moveCursorWordLeft,
|
|
22
|
-
moveCursorWordRight,
|
|
23
|
-
} from "./input-model.ts";
|
|
24
|
-
import {
|
|
25
|
-
formatAttachmentRef,
|
|
26
|
-
expandPasteRefs,
|
|
27
|
-
formatPasteRef,
|
|
28
|
-
normalizePastedText,
|
|
29
|
-
parseAttachmentRefs,
|
|
30
|
-
parsePastedFilePathCandidates,
|
|
31
|
-
parsePasteRefs,
|
|
32
|
-
shouldCollapsePaste,
|
|
33
|
-
} from "./paste.ts";
|
|
34
|
-
import { getPromptView, type PromptView } from "./render.ts";
|
|
35
|
-
import { getCwd } from "../../../core/utils/cwd-context.ts";
|
|
36
|
-
import { saveClipboardImageAsAttachment } from "./clipboard-image.ts";
|
|
37
|
-
import { isMouseInput } from "../../mouse.ts";
|
|
38
|
-
|
|
39
|
-
export type PromptSubmission = {
|
|
40
|
-
text: string;
|
|
41
|
-
attachments: string[];
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
type Args = {
|
|
45
|
-
value: string;
|
|
46
|
-
onChange: (value: string) => void;
|
|
47
|
-
onSubmit: (value: PromptSubmission) => void;
|
|
48
|
-
focus: boolean;
|
|
49
|
-
maxVisibleLines: number;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
type Result = {
|
|
53
|
-
view: PromptView;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export function usePromptInputController({
|
|
57
|
-
value,
|
|
58
|
-
onChange,
|
|
59
|
-
onSubmit,
|
|
60
|
-
focus,
|
|
61
|
-
maxVisibleLines,
|
|
62
|
-
}: Args): Result {
|
|
63
|
-
const [cursor, setCursor] = useState(value.length);
|
|
64
|
-
const [col, setCol] = useState<number | null>(null);
|
|
65
|
-
const [pastes, setPastes] = useState<Record<number, string>>({});
|
|
66
|
-
const [attachments, setAttachments] = useState<Record<number, string>>({});
|
|
67
|
-
|
|
68
|
-
const valueRef = useRef(value);
|
|
69
|
-
const cursorRef = useRef(cursor);
|
|
70
|
-
const pastesRef = useRef(pastes);
|
|
71
|
-
const attachmentsRef = useRef(attachments);
|
|
72
|
-
const nextPasteIdRef = useRef(1);
|
|
73
|
-
const nextAttachmentIdRef = useRef(1);
|
|
74
|
-
const chunksRef = useRef<string[]>([]);
|
|
75
|
-
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
76
|
-
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
valueRef.current = value;
|
|
79
|
-
}, [value]);
|
|
80
|
-
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
cursorRef.current = cursor;
|
|
83
|
-
}, [cursor]);
|
|
84
|
-
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
pastesRef.current = pastes;
|
|
87
|
-
}, [pastes]);
|
|
88
|
-
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
attachmentsRef.current = attachments;
|
|
91
|
-
}, [attachments]);
|
|
92
|
-
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
setCursor((prev) => clampCursor(value, prev));
|
|
95
|
-
setCol(null);
|
|
96
|
-
}, [value]);
|
|
97
|
-
|
|
98
|
-
useEffect(
|
|
99
|
-
() => () => {
|
|
100
|
-
if (timerRef.current) {
|
|
101
|
-
clearTimeout(timerRef.current);
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
[],
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
useEffect(() => {
|
|
108
|
-
const ids = new Set(parsePasteRefs(value));
|
|
109
|
-
setPastes((prev) => {
|
|
110
|
-
const entries = Object.entries(prev);
|
|
111
|
-
const hasOrphans = entries.some(([raw]) => {
|
|
112
|
-
const id = Number.parseInt(raw, 10);
|
|
113
|
-
return !ids.has(id);
|
|
114
|
-
});
|
|
115
|
-
if (!hasOrphans) {
|
|
116
|
-
return prev;
|
|
117
|
-
}
|
|
118
|
-
const next: Record<number, string> = {};
|
|
119
|
-
for (const [raw, text] of entries) {
|
|
120
|
-
const id = Number.parseInt(raw, 10);
|
|
121
|
-
if (ids.has(id)) {
|
|
122
|
-
next[id] = text;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return next;
|
|
126
|
-
});
|
|
127
|
-
}, [value]);
|
|
128
|
-
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
const ids = new Set(parseAttachmentRefs(value));
|
|
131
|
-
setAttachments((prev) => {
|
|
132
|
-
const entries = Object.entries(prev);
|
|
133
|
-
const hasOrphans = entries.some(([raw]) => {
|
|
134
|
-
const id = Number.parseInt(raw, 10);
|
|
135
|
-
return !ids.has(id);
|
|
136
|
-
});
|
|
137
|
-
if (!hasOrphans) {
|
|
138
|
-
return prev;
|
|
139
|
-
}
|
|
140
|
-
const next: Record<number, string> = {};
|
|
141
|
-
for (const [raw, attachmentPath] of entries) {
|
|
142
|
-
const id = Number.parseInt(raw, 10);
|
|
143
|
-
if (ids.has(id)) {
|
|
144
|
-
next[id] = attachmentPath;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return next;
|
|
148
|
-
});
|
|
149
|
-
}, [value]);
|
|
150
|
-
|
|
151
|
-
const apply = useCallback(
|
|
152
|
-
(next: InputState) => {
|
|
153
|
-
const clamped = clampCursor(next.value, next.cursor);
|
|
154
|
-
setCursor(clamped);
|
|
155
|
-
setCol(null);
|
|
156
|
-
if (next.value !== valueRef.current) {
|
|
157
|
-
onChange(next.value);
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
[onChange],
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
const getState = useCallback(
|
|
164
|
-
(): InputState => ({
|
|
165
|
-
value: valueRef.current,
|
|
166
|
-
cursor: clampCursor(valueRef.current, cursorRef.current),
|
|
167
|
-
}),
|
|
168
|
-
[],
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
const submit = useCallback(() => {
|
|
172
|
-
const expanded = expandPasteRefs(valueRef.current, pastesRef.current);
|
|
173
|
-
const attachmentIds = parseAttachmentRefs(valueRef.current);
|
|
174
|
-
const attachmentPaths = attachmentIds
|
|
175
|
-
.map((id) => attachmentsRef.current[id])
|
|
176
|
-
.filter((value): value is string => Boolean(value));
|
|
177
|
-
onSubmit({ text: expanded, attachments: [...new Set(attachmentPaths)] });
|
|
178
|
-
setPastes({});
|
|
179
|
-
setAttachments({});
|
|
180
|
-
nextPasteIdRef.current = 1;
|
|
181
|
-
nextAttachmentIdRef.current = 1;
|
|
182
|
-
setCol(null);
|
|
183
|
-
}, [onSubmit]);
|
|
184
|
-
|
|
185
|
-
const normalizeCandidatePath = useCallback((candidate: string): string => {
|
|
186
|
-
const expanded =
|
|
187
|
-
candidate === "~" || candidate.startsWith("~/")
|
|
188
|
-
? path.join(process.env.HOME ?? "", candidate.slice(1))
|
|
189
|
-
: candidate;
|
|
190
|
-
return path.isAbsolute(expanded)
|
|
191
|
-
? path.resolve(expanded)
|
|
192
|
-
: path.resolve(getCwd(), expanded);
|
|
193
|
-
}, []);
|
|
194
|
-
|
|
195
|
-
const readAttachmentPath = useCallback(
|
|
196
|
-
async (candidate: string): Promise<string | null> => {
|
|
197
|
-
const filePath = normalizeCandidatePath(candidate);
|
|
198
|
-
try {
|
|
199
|
-
const info = await fs.stat(filePath);
|
|
200
|
-
return info.isFile() ? filePath : null;
|
|
201
|
-
} catch {
|
|
202
|
-
return null;
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
[normalizeCandidatePath],
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
const applyAttachmentPaths = useCallback(
|
|
209
|
-
(paths: string[]) => {
|
|
210
|
-
if (paths.length === 0) {
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
let state = getState();
|
|
214
|
-
const nextAttachments: Record<number, string> = {};
|
|
215
|
-
for (const attachmentPath of paths) {
|
|
216
|
-
const id = nextAttachmentIdRef.current;
|
|
217
|
-
nextAttachmentIdRef.current += 1;
|
|
218
|
-
nextAttachments[id] = attachmentPath;
|
|
219
|
-
const prefix =
|
|
220
|
-
state.value.length > 0 &&
|
|
221
|
-
state.cursor > 0 &&
|
|
222
|
-
!/\s/.test(state.value[state.cursor - 1] ?? "")
|
|
223
|
-
? " "
|
|
224
|
-
: "";
|
|
225
|
-
state = insertText(state, `${prefix}${formatAttachmentRef(id)}`);
|
|
226
|
-
}
|
|
227
|
-
setAttachments((prev) => ({ ...prev, ...nextAttachments }));
|
|
228
|
-
apply(state);
|
|
229
|
-
return true;
|
|
230
|
-
},
|
|
231
|
-
[apply, getState],
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
const applyTextPaste = useCallback(
|
|
235
|
-
(text: string) => {
|
|
236
|
-
const state = getState();
|
|
237
|
-
const collapse = text.length > 1 && shouldCollapsePaste(text);
|
|
238
|
-
if (collapse) {
|
|
239
|
-
const id = nextPasteIdRef.current;
|
|
240
|
-
nextPasteIdRef.current += 1;
|
|
241
|
-
setPastes((prev) => ({
|
|
242
|
-
...prev,
|
|
243
|
-
[id]: text,
|
|
244
|
-
}));
|
|
245
|
-
apply(insertText(state, formatPasteRef(id)));
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
apply(insertText(state, text));
|
|
249
|
-
},
|
|
250
|
-
[apply, getState],
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
const applyPaste = useCallback(
|
|
254
|
-
(raw: string) => {
|
|
255
|
-
const text = normalizePastedText(raw);
|
|
256
|
-
if (text.length === 0) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const candidates = parsePastedFilePathCandidates(text);
|
|
260
|
-
if (candidates.length > 0) {
|
|
261
|
-
void Promise.all(
|
|
262
|
-
candidates.map((candidate) => readAttachmentPath(candidate)),
|
|
263
|
-
).then((paths) => {
|
|
264
|
-
const valid = paths.filter((value): value is string =>
|
|
265
|
-
Boolean(value),
|
|
266
|
-
);
|
|
267
|
-
if (
|
|
268
|
-
valid.length === candidates.length &&
|
|
269
|
-
applyAttachmentPaths(valid)
|
|
270
|
-
) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
applyTextPaste(text);
|
|
274
|
-
});
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
applyTextPaste(text);
|
|
278
|
-
},
|
|
279
|
-
[applyAttachmentPaths, applyTextPaste, readAttachmentPath],
|
|
280
|
-
);
|
|
281
|
-
|
|
282
|
-
const applyClipboardImage = useCallback(() => {
|
|
283
|
-
void saveClipboardImageAsAttachment().then((attachmentPath) => {
|
|
284
|
-
if (attachmentPath) {
|
|
285
|
-
applyAttachmentPaths([attachmentPath]);
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
}, [applyAttachmentPaths]);
|
|
289
|
-
|
|
290
|
-
const clearChunkTimer = useCallback(() => {
|
|
291
|
-
if (!timerRef.current) {
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
clearTimeout(timerRef.current);
|
|
295
|
-
timerRef.current = null;
|
|
296
|
-
}, []);
|
|
297
|
-
|
|
298
|
-
const drainChunks = useCallback((): string | null => {
|
|
299
|
-
if (chunksRef.current.length === 0) {
|
|
300
|
-
return null;
|
|
301
|
-
}
|
|
302
|
-
clearChunkTimer();
|
|
303
|
-
const raw = chunksRef.current.join("");
|
|
304
|
-
chunksRef.current = [];
|
|
305
|
-
return raw;
|
|
306
|
-
}, [clearChunkTimer]);
|
|
307
|
-
|
|
308
|
-
const flush = useCallback((): boolean => {
|
|
309
|
-
const raw = drainChunks();
|
|
310
|
-
if (!raw) {
|
|
311
|
-
return false;
|
|
312
|
-
}
|
|
313
|
-
applyPaste(raw);
|
|
314
|
-
return true;
|
|
315
|
-
}, [applyPaste, drainChunks]);
|
|
316
|
-
|
|
317
|
-
const queueChunk = useCallback(
|
|
318
|
-
(chunk: string) => {
|
|
319
|
-
clearChunkTimer();
|
|
320
|
-
chunksRef.current.push(chunk);
|
|
321
|
-
timerRef.current = setTimeout(() => {
|
|
322
|
-
const raw = drainChunks();
|
|
323
|
-
if (!raw) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
applyPaste(raw);
|
|
327
|
-
}, 40);
|
|
328
|
-
},
|
|
329
|
-
[applyPaste, clearChunkTimer, drainChunks],
|
|
330
|
-
);
|
|
331
|
-
|
|
332
|
-
const ctrlMoves = useMemo(
|
|
333
|
-
() =>
|
|
334
|
-
({
|
|
335
|
-
a: moveCursorLineStart,
|
|
336
|
-
b: moveCursorLeft,
|
|
337
|
-
d: deleteForward,
|
|
338
|
-
e: moveCursorLineEnd,
|
|
339
|
-
f: moveCursorRight,
|
|
340
|
-
k: deleteToLineEnd,
|
|
341
|
-
u: deleteToLineStart,
|
|
342
|
-
w: deleteWordBackward,
|
|
343
|
-
}) as const,
|
|
344
|
-
[],
|
|
345
|
-
);
|
|
346
|
-
|
|
347
|
-
const metaMoves = useMemo(
|
|
348
|
-
() =>
|
|
349
|
-
({
|
|
350
|
-
b: moveCursorWordLeft,
|
|
351
|
-
f: moveCursorWordRight,
|
|
352
|
-
d: deleteWordForward,
|
|
353
|
-
}) as const,
|
|
354
|
-
[],
|
|
355
|
-
);
|
|
356
|
-
|
|
357
|
-
useInput(
|
|
358
|
-
(input, key) => {
|
|
359
|
-
if (isMouseInput(input)) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
const state = getState();
|
|
364
|
-
|
|
365
|
-
if (key.return) {
|
|
366
|
-
if (flush()) {
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
const hasBackslash =
|
|
370
|
-
!key.shift &&
|
|
371
|
-
!key.meta &&
|
|
372
|
-
state.cursor > 0 &&
|
|
373
|
-
state.value[state.cursor - 1] === "\\";
|
|
374
|
-
if (hasBackslash) {
|
|
375
|
-
const withoutBackslash = deleteBackward(state);
|
|
376
|
-
apply(insertText(withoutBackslash, "\n"));
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
if (key.shift || key.meta) {
|
|
380
|
-
apply(insertText(state, "\n"));
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
submit();
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
if (key.leftArrow && (key.ctrl || key.meta || key.super)) {
|
|
388
|
-
apply(moveCursorWordLeft(state));
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
if (key.rightArrow && (key.ctrl || key.meta || key.super)) {
|
|
392
|
-
apply(moveCursorWordRight(state));
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
if (key.leftArrow) {
|
|
397
|
-
apply(moveCursorLeft(state));
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
if (key.rightArrow) {
|
|
401
|
-
apply(moveCursorRight(state));
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
if (key.home) {
|
|
405
|
-
apply(moveCursorLineStart(state));
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
if (key.end) {
|
|
409
|
-
apply(moveCursorLineEnd(state));
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
if (key.upArrow) {
|
|
413
|
-
const moved = moveCursorUp(state, col ?? undefined);
|
|
414
|
-
setCol(moved.targetColumn);
|
|
415
|
-
setCursor(moved.state.cursor);
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
if (key.downArrow) {
|
|
419
|
-
const moved = moveCursorDown(state, col ?? undefined);
|
|
420
|
-
setCol(moved.targetColumn);
|
|
421
|
-
setCursor(moved.state.cursor);
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
if (key.backspace) {
|
|
426
|
-
if (key.ctrl || key.meta) {
|
|
427
|
-
apply(deleteWordBackward(state));
|
|
428
|
-
} else {
|
|
429
|
-
apply(deleteBackward(state));
|
|
430
|
-
}
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
if (key.delete) {
|
|
434
|
-
if (key.meta) {
|
|
435
|
-
apply(deleteToLineEnd(state));
|
|
436
|
-
} else if (key.ctrl) {
|
|
437
|
-
apply(deleteWordForward(state));
|
|
438
|
-
} else {
|
|
439
|
-
apply(deleteForward(state));
|
|
440
|
-
}
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
if (key.ctrl) {
|
|
445
|
-
const lower = input.toLowerCase();
|
|
446
|
-
if (lower === "v") {
|
|
447
|
-
applyClipboardImage();
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
if (lower in ctrlMoves) {
|
|
451
|
-
const op = ctrlMoves[lower as keyof typeof ctrlMoves];
|
|
452
|
-
apply(op(state));
|
|
453
|
-
}
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
if (key.meta) {
|
|
458
|
-
const lower = input.toLowerCase();
|
|
459
|
-
if (lower in metaMoves) {
|
|
460
|
-
const op = metaMoves[lower as keyof typeof metaMoves];
|
|
461
|
-
apply(op(state));
|
|
462
|
-
}
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
if (key.tab) {
|
|
467
|
-
apply(insertText(state, " "));
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
if (input.length === 0 || key.escape) {
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
const isPasteChunk =
|
|
476
|
-
input.length > 1 &&
|
|
477
|
-
!key.ctrl &&
|
|
478
|
-
!key.meta &&
|
|
479
|
-
!key.tab &&
|
|
480
|
-
!key.return &&
|
|
481
|
-
!key.escape;
|
|
482
|
-
if (isPasteChunk) {
|
|
483
|
-
queueChunk(input);
|
|
484
|
-
return;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
applyPaste(input);
|
|
488
|
-
},
|
|
489
|
-
{ isActive: focus },
|
|
490
|
-
);
|
|
491
|
-
|
|
492
|
-
const view = useMemo(
|
|
493
|
-
() => getPromptView(value, cursor, maxVisibleLines),
|
|
494
|
-
[cursor, maxVisibleLines, value],
|
|
495
|
-
);
|
|
496
|
-
|
|
497
|
-
return { view };
|
|
498
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { ChatLine } from "../types.ts";
|
|
2
|
-
|
|
3
|
-
export function lineColor(line: ChatLine): string {
|
|
4
|
-
switch (line.role) {
|
|
5
|
-
case "user":
|
|
6
|
-
return "cyan";
|
|
7
|
-
case "assistant":
|
|
8
|
-
return "blue";
|
|
9
|
-
case "tool":
|
|
10
|
-
return "gray";
|
|
11
|
-
case "system":
|
|
12
|
-
return "red";
|
|
13
|
-
default:
|
|
14
|
-
return "gray";
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function truncLine(value: string, max: number): string {
|
|
19
|
-
if (value.length <= max) {
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
return `${value.slice(0, max - 1)}…`;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function compactInline(value: string, max = 120): string {
|
|
26
|
-
const normalized = value.replace(/\s+/g, " ").trim();
|
|
27
|
-
return truncLine(normalized, max);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function formatToolArgs(raw: string): string[] {
|
|
31
|
-
if (!raw) {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
const obj = JSON.parse(raw);
|
|
36
|
-
if (typeof obj !== "object" || obj === null) {
|
|
37
|
-
return [compactInline(String(obj), 120)];
|
|
38
|
-
}
|
|
39
|
-
return [compactInline(JSON.stringify(obj, null, 2), 120)];
|
|
40
|
-
} catch {
|
|
41
|
-
return [compactInline(raw, 120)];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function wrapTextToLines(text: string, width: number): string[] {
|
|
46
|
-
const maxWidth = Math.max(20, width);
|
|
47
|
-
return text.split("\n").flatMap((paragraph) => {
|
|
48
|
-
const words = paragraph.trim().split(/\s+/).filter(Boolean);
|
|
49
|
-
if (words.length === 0) {
|
|
50
|
-
return [""];
|
|
51
|
-
}
|
|
52
|
-
const lines: string[] = [];
|
|
53
|
-
let current = "";
|
|
54
|
-
for (const word of words) {
|
|
55
|
-
const candidate = current ? `${current} ${word}` : word;
|
|
56
|
-
if (candidate.length <= maxWidth) {
|
|
57
|
-
current = candidate;
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (current) {
|
|
61
|
-
lines.push(current);
|
|
62
|
-
}
|
|
63
|
-
current = word.length > maxWidth ? word.slice(0, maxWidth - 1) : word;
|
|
64
|
-
}
|
|
65
|
-
if (current) {
|
|
66
|
-
lines.push(current);
|
|
67
|
-
}
|
|
68
|
-
return lines;
|
|
69
|
-
});
|
|
70
|
-
}
|
package/src/chat/index.tsx
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "ink";
|
|
3
|
-
import type { Agent } from "@strands-agents/sdk";
|
|
4
|
-
import type { Manager as McpManager } from "../core/mcp/index.ts";
|
|
5
|
-
import type { Registry } from "../core/skills/index.ts";
|
|
6
|
-
import { ChatApp } from "./app.tsx";
|
|
7
|
-
|
|
8
|
-
type LaunchChatOptions = {
|
|
9
|
-
agent: Agent;
|
|
10
|
-
manager: McpManager;
|
|
11
|
-
registry: Registry;
|
|
12
|
-
sessionId: string;
|
|
13
|
-
initialPrompt?: string;
|
|
14
|
-
yolo?: boolean;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export async function chat(options: LaunchChatOptions): Promise<void> {
|
|
18
|
-
let done = false;
|
|
19
|
-
const { waitUntilExit, unmount } = render(
|
|
20
|
-
<ChatApp
|
|
21
|
-
agent={options.agent}
|
|
22
|
-
manager={options.manager}
|
|
23
|
-
registry={options.registry}
|
|
24
|
-
sessionId={options.sessionId}
|
|
25
|
-
initialPrompt={options.initialPrompt}
|
|
26
|
-
yolo={options.yolo}
|
|
27
|
-
onExit={() => {
|
|
28
|
-
done = true;
|
|
29
|
-
}}
|
|
30
|
-
/>,
|
|
31
|
-
{ exitOnCtrlC: false },
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
await waitUntilExit();
|
|
36
|
-
} finally {
|
|
37
|
-
if (!done) {
|
|
38
|
-
unmount();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
package/src/chat/mouse.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { parseMouseEvents } from "ink-use-mouse";
|
|
2
|
-
|
|
3
|
-
const STRIPPED_SGR_MOUSE_RE = /\[?<\d+;\d+;\d+[mM]/;
|
|
4
|
-
|
|
5
|
-
export const MOUSE_REPORTING_ENABLE =
|
|
6
|
-
"\x1b[?1003l\x1b[?1002l\x1b[?1000h\x1b[?1006h";
|
|
7
|
-
|
|
8
|
-
export const MOUSE_REPORTING_DISABLE =
|
|
9
|
-
"\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l";
|
|
10
|
-
|
|
11
|
-
export function isMouseInput(input: string): boolean {
|
|
12
|
-
return (
|
|
13
|
-
parseMouseEvents(input).length > 0 || STRIPPED_SGR_MOUSE_RE.test(input)
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { parseMouseEvents };
|
package/src/chat/types.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { FileToolDisplay } from "../core/state/file-tool-display.ts";
|
|
2
|
-
|
|
3
|
-
export type ChatRole = "user" | "assistant" | "tool" | "system";
|
|
4
|
-
|
|
5
|
-
export interface ChatLine {
|
|
6
|
-
id: string;
|
|
7
|
-
role: ChatRole;
|
|
8
|
-
title?: string;
|
|
9
|
-
content: string;
|
|
10
|
-
done?: boolean;
|
|
11
|
-
toolName?: string;
|
|
12
|
-
phase?: "running" | "done";
|
|
13
|
-
resultContent?: string;
|
|
14
|
-
fileToolDisplay?: FileToolDisplay;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type ApprovalDecision = "allow" | "reject" | "always";
|
|
18
|
-
|
|
19
|
-
export interface ApprovalRequest {
|
|
20
|
-
id: string;
|
|
21
|
-
toolName: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
inputPreview: string;
|
|
24
|
-
}
|