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,207 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Box, Text, useWindowSize } from "ink";
|
|
3
|
-
import type { Token, Tokens } from "marked";
|
|
4
|
-
import { CodeBlock } from "./CodeBlock.tsx";
|
|
5
|
-
import { inlineToPlainText, renderInlineTokens } from "./InlineRenderer.tsx";
|
|
6
|
-
import { MarkdownTable } from "./MarkdownTable.tsx";
|
|
7
|
-
|
|
8
|
-
type BlockRendererProps = {
|
|
9
|
-
tokens: Token[];
|
|
10
|
-
streaming?: boolean;
|
|
11
|
-
depth?: number;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
function blockToPlainText(token: Token): string {
|
|
15
|
-
switch (token.type) {
|
|
16
|
-
case "paragraph":
|
|
17
|
-
return inlineToPlainText(token.tokens);
|
|
18
|
-
case "text":
|
|
19
|
-
return token.text ?? "";
|
|
20
|
-
case "code":
|
|
21
|
-
return token.text ?? "";
|
|
22
|
-
case "heading":
|
|
23
|
-
return inlineToPlainText(token.tokens);
|
|
24
|
-
case "blockquote":
|
|
25
|
-
return (token.tokens ?? [])
|
|
26
|
-
.map((child) => blockToPlainText(child))
|
|
27
|
-
.join("\n");
|
|
28
|
-
case "list":
|
|
29
|
-
return token.items
|
|
30
|
-
.map((item: Tokens.ListItem) =>
|
|
31
|
-
(item.tokens ?? [])
|
|
32
|
-
.map((child: Token) => blockToPlainText(child))
|
|
33
|
-
.join(" "),
|
|
34
|
-
)
|
|
35
|
-
.join("\n");
|
|
36
|
-
default:
|
|
37
|
-
return token.raw ?? "";
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function renderBlock(
|
|
42
|
-
token: Token,
|
|
43
|
-
key: string,
|
|
44
|
-
depth: number,
|
|
45
|
-
columns: number,
|
|
46
|
-
streaming: boolean,
|
|
47
|
-
): React.ReactNode | null {
|
|
48
|
-
switch (token.type) {
|
|
49
|
-
case "paragraph":
|
|
50
|
-
return (
|
|
51
|
-
<Box key={key} marginBottom={1}>
|
|
52
|
-
<Text wrap="wrap">
|
|
53
|
-
{renderInlineTokens(token.tokens, { keyPrefix: key })}
|
|
54
|
-
</Text>
|
|
55
|
-
</Box>
|
|
56
|
-
);
|
|
57
|
-
case "heading": {
|
|
58
|
-
const headingColor = token.depth <= 2 ? "cyan" : "white";
|
|
59
|
-
return (
|
|
60
|
-
<Box key={key} marginBottom={1}>
|
|
61
|
-
<Text bold color={headingColor} wrap="wrap">
|
|
62
|
-
{renderInlineTokens(token.tokens, { keyPrefix: key })}
|
|
63
|
-
</Text>
|
|
64
|
-
</Box>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
case "code":
|
|
68
|
-
return (
|
|
69
|
-
<CodeBlock
|
|
70
|
-
key={key}
|
|
71
|
-
code={token.text ?? ""}
|
|
72
|
-
language={token.lang}
|
|
73
|
-
streaming={streaming}
|
|
74
|
-
/>
|
|
75
|
-
);
|
|
76
|
-
case "blockquote": {
|
|
77
|
-
const lines = (token.tokens ?? [])
|
|
78
|
-
.map((child) => blockToPlainText(child))
|
|
79
|
-
.join("\n")
|
|
80
|
-
.split("\n");
|
|
81
|
-
return (
|
|
82
|
-
<Box key={key} flexDirection="column" marginBottom={1}>
|
|
83
|
-
{lines.map((line, index) => (
|
|
84
|
-
<Text key={`${key}-${index}`} color="gray" italic>
|
|
85
|
-
{`│ ${line || " "}`}
|
|
86
|
-
</Text>
|
|
87
|
-
))}
|
|
88
|
-
</Box>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
case "list":
|
|
92
|
-
return (
|
|
93
|
-
<Box key={key} flexDirection="column" marginBottom={1}>
|
|
94
|
-
{token.items.map((item: Tokens.ListItem, index: number) => {
|
|
95
|
-
const marker = token.ordered
|
|
96
|
-
? `${(token.start ?? 1) + index}.`
|
|
97
|
-
: "-";
|
|
98
|
-
const checkbox =
|
|
99
|
-
item.task === true ? (item.checked ? "[x] " : "[ ] ") : "";
|
|
100
|
-
const itemTokens = item.tokens ?? [];
|
|
101
|
-
const [head, ...tail] = itemTokens as Token[];
|
|
102
|
-
const isInlineHead =
|
|
103
|
-
head?.type === "text" || head?.type === "paragraph";
|
|
104
|
-
const headNode =
|
|
105
|
-
head && isInlineHead ? (
|
|
106
|
-
<Text wrap="wrap">
|
|
107
|
-
{head.type === "paragraph"
|
|
108
|
-
? renderInlineTokens(head.tokens, {
|
|
109
|
-
keyPrefix: `${key}-item-${index}-paragraph`,
|
|
110
|
-
})
|
|
111
|
-
: (head.text ??
|
|
112
|
-
renderInlineTokens(head.tokens, {
|
|
113
|
-
keyPrefix: `${key}-item-${index}-text`,
|
|
114
|
-
}))}
|
|
115
|
-
</Text>
|
|
116
|
-
) : head ? (
|
|
117
|
-
renderBlock(
|
|
118
|
-
head,
|
|
119
|
-
`${key}-item-${index}-head`,
|
|
120
|
-
depth + 1,
|
|
121
|
-
columns,
|
|
122
|
-
streaming,
|
|
123
|
-
)
|
|
124
|
-
) : (
|
|
125
|
-
<Text> </Text>
|
|
126
|
-
);
|
|
127
|
-
return (
|
|
128
|
-
<Box key={`${key}-item-${index}`} flexDirection="column">
|
|
129
|
-
<Box flexDirection="row">
|
|
130
|
-
<Text>{`${" ".repeat(depth)}${marker} ${checkbox}`}</Text>
|
|
131
|
-
<Box flexDirection="column" flexGrow={1}>
|
|
132
|
-
{headNode}
|
|
133
|
-
</Box>
|
|
134
|
-
</Box>
|
|
135
|
-
{tail.length > 0 ? (
|
|
136
|
-
<Box
|
|
137
|
-
marginLeft={Math.max(2, depth * 2 + 4)}
|
|
138
|
-
flexDirection="column"
|
|
139
|
-
>
|
|
140
|
-
{tail.map((nestedToken: Token, nestedIndex: number) =>
|
|
141
|
-
renderBlock(
|
|
142
|
-
nestedToken,
|
|
143
|
-
`${key}-item-${index}-tail-${nestedIndex}`,
|
|
144
|
-
depth + 1,
|
|
145
|
-
columns,
|
|
146
|
-
streaming,
|
|
147
|
-
),
|
|
148
|
-
)}
|
|
149
|
-
</Box>
|
|
150
|
-
) : null}
|
|
151
|
-
</Box>
|
|
152
|
-
);
|
|
153
|
-
})}
|
|
154
|
-
</Box>
|
|
155
|
-
);
|
|
156
|
-
case "table":
|
|
157
|
-
return <MarkdownTable key={key} token={token as Tokens.Table} />;
|
|
158
|
-
case "hr":
|
|
159
|
-
return (
|
|
160
|
-
<Box key={key} marginBottom={1}>
|
|
161
|
-
<Text color="gray">
|
|
162
|
-
{"─".repeat(Math.max(8, Math.min(columns - 4, 48)))}
|
|
163
|
-
</Text>
|
|
164
|
-
</Box>
|
|
165
|
-
);
|
|
166
|
-
case "space":
|
|
167
|
-
return null;
|
|
168
|
-
case "text":
|
|
169
|
-
case "escape":
|
|
170
|
-
return (
|
|
171
|
-
<Box key={key} marginBottom={1}>
|
|
172
|
-
<Text wrap="wrap">{token.text ?? token.raw ?? ""}</Text>
|
|
173
|
-
</Box>
|
|
174
|
-
);
|
|
175
|
-
case "html":
|
|
176
|
-
case "def":
|
|
177
|
-
case "del":
|
|
178
|
-
return null;
|
|
179
|
-
default:
|
|
180
|
-
return (
|
|
181
|
-
<Box key={key} marginBottom={1}>
|
|
182
|
-
<Text wrap="wrap">{token.raw ?? ""}</Text>
|
|
183
|
-
</Box>
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export function BlockRenderer({
|
|
189
|
-
tokens,
|
|
190
|
-
streaming = false,
|
|
191
|
-
depth = 0,
|
|
192
|
-
}: BlockRendererProps) {
|
|
193
|
-
const { columns } = useWindowSize();
|
|
194
|
-
return (
|
|
195
|
-
<Box flexDirection="column">
|
|
196
|
-
{tokens.map((token, index) =>
|
|
197
|
-
renderBlock(
|
|
198
|
-
token,
|
|
199
|
-
`block-${depth}-${index}`,
|
|
200
|
-
depth,
|
|
201
|
-
columns,
|
|
202
|
-
streaming,
|
|
203
|
-
),
|
|
204
|
-
)}
|
|
205
|
-
</Box>
|
|
206
|
-
);
|
|
207
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
import type React from "react";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { Box, Text } from "ink";
|
|
5
|
-
import { highlight, supportsLanguage } from "cli-highlight";
|
|
6
|
-
|
|
7
|
-
type CodeBlockProps = {
|
|
8
|
-
code: string;
|
|
9
|
-
language?: string;
|
|
10
|
-
streaming?: boolean;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
type InkAnsiComponent = React.ComponentType<{
|
|
14
|
-
children?: React.ReactNode;
|
|
15
|
-
}>;
|
|
16
|
-
|
|
17
|
-
const localRequire = createRequire(import.meta.url);
|
|
18
|
-
const ANSI_RE = /\u001b\[[0-9;]*m/g;
|
|
19
|
-
let cachedInkAnsi: InkAnsiComponent | null | undefined;
|
|
20
|
-
|
|
21
|
-
function stripAnsi(value: string): string {
|
|
22
|
-
return value.replace(ANSI_RE, "");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function getInkAnsi(): InkAnsiComponent | null {
|
|
26
|
-
if (cachedInkAnsi !== undefined) {
|
|
27
|
-
return cachedInkAnsi;
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
const moduleValue = localRequire("ink-ansi") as
|
|
31
|
-
| InkAnsiComponent
|
|
32
|
-
| { default?: InkAnsiComponent };
|
|
33
|
-
cachedInkAnsi =
|
|
34
|
-
typeof moduleValue === "function"
|
|
35
|
-
? moduleValue
|
|
36
|
-
: (moduleValue.default ?? null);
|
|
37
|
-
} catch {
|
|
38
|
-
cachedInkAnsi = null;
|
|
39
|
-
}
|
|
40
|
-
return cachedInkAnsi;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function renderCodeLines(lines: string[], color?: string) {
|
|
44
|
-
return lines.map((line, index) => (
|
|
45
|
-
<Text key={index} color={color}>
|
|
46
|
-
{line || " "}
|
|
47
|
-
</Text>
|
|
48
|
-
));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function CodeBlock({
|
|
52
|
-
code,
|
|
53
|
-
language,
|
|
54
|
-
streaming = false,
|
|
55
|
-
}: CodeBlockProps) {
|
|
56
|
-
const trimmedLanguage = language?.trim() || undefined;
|
|
57
|
-
const normalizedCode = useMemo(() => code.replace(/\r\n/g, "\n"), [code]);
|
|
58
|
-
const plainLines = useMemo(
|
|
59
|
-
() => normalizedCode.split("\n"),
|
|
60
|
-
[normalizedCode],
|
|
61
|
-
);
|
|
62
|
-
const highlightedLines = useMemo(() => {
|
|
63
|
-
if (streaming || !trimmedLanguage || !supportsLanguage(trimmedLanguage)) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
try {
|
|
67
|
-
return highlight(normalizedCode, {
|
|
68
|
-
language: trimmedLanguage,
|
|
69
|
-
ignoreIllegals: true,
|
|
70
|
-
}).split("\n");
|
|
71
|
-
} catch {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
}, [normalizedCode, streaming, trimmedLanguage]);
|
|
75
|
-
|
|
76
|
-
if (highlightedLines) {
|
|
77
|
-
const InkAnsiText = getInkAnsi();
|
|
78
|
-
return (
|
|
79
|
-
<Box flexDirection="column" marginBottom={1}>
|
|
80
|
-
<Text color="gray">{`\`\`\`${trimmedLanguage}`}</Text>
|
|
81
|
-
{highlightedLines.map((line, index) =>
|
|
82
|
-
InkAnsiText ? (
|
|
83
|
-
<InkAnsiText key={index}>{line || " "}</InkAnsiText>
|
|
84
|
-
) : (
|
|
85
|
-
<Text key={index}>{stripAnsi(line) || " "}</Text>
|
|
86
|
-
),
|
|
87
|
-
)}
|
|
88
|
-
<Text color="gray">```</Text>
|
|
89
|
-
</Box>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<Box flexDirection="column" marginBottom={1}>
|
|
95
|
-
<Text color="gray">{`\`\`\`${trimmedLanguage ?? ""}`}</Text>
|
|
96
|
-
{renderCodeLines(plainLines, "white")}
|
|
97
|
-
<Text color="gray">```</Text>
|
|
98
|
-
</Box>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Text } from "ink";
|
|
3
|
-
import type { Token } from "marked";
|
|
4
|
-
|
|
5
|
-
function plainFromToken(token: Token): string {
|
|
6
|
-
switch (token.type) {
|
|
7
|
-
case "text":
|
|
8
|
-
return token.text ?? "";
|
|
9
|
-
case "codespan":
|
|
10
|
-
return token.text ?? "";
|
|
11
|
-
case "escape":
|
|
12
|
-
return token.text ?? "";
|
|
13
|
-
case "link": {
|
|
14
|
-
const label = inlineToPlainText(token.tokens);
|
|
15
|
-
return label || token.href || "";
|
|
16
|
-
}
|
|
17
|
-
case "strong":
|
|
18
|
-
case "em":
|
|
19
|
-
case "del":
|
|
20
|
-
return inlineToPlainText(token.tokens);
|
|
21
|
-
case "image":
|
|
22
|
-
return token.text || token.href || "";
|
|
23
|
-
case "br":
|
|
24
|
-
return "\n";
|
|
25
|
-
default:
|
|
26
|
-
return token.raw ?? "";
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function inlineToPlainText(tokens: Token[] | undefined): string {
|
|
31
|
-
if (!tokens || tokens.length === 0) {
|
|
32
|
-
return "";
|
|
33
|
-
}
|
|
34
|
-
return tokens.map((token) => plainFromToken(token)).join("");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
type RenderInlineOptions = {
|
|
38
|
-
keyPrefix?: string;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export function renderInlineTokens(
|
|
42
|
-
tokens: Token[] | undefined,
|
|
43
|
-
options: RenderInlineOptions = {},
|
|
44
|
-
): React.ReactNode[] {
|
|
45
|
-
if (!tokens || tokens.length === 0) {
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
const prefix = options.keyPrefix ?? "inline";
|
|
49
|
-
return tokens.flatMap((token, index) => {
|
|
50
|
-
const key = `${prefix}-${index}`;
|
|
51
|
-
switch (token.type) {
|
|
52
|
-
case "text":
|
|
53
|
-
return [token.text ?? ""];
|
|
54
|
-
case "escape":
|
|
55
|
-
return [token.text ?? token.raw ?? ""];
|
|
56
|
-
case "codespan":
|
|
57
|
-
return [
|
|
58
|
-
<Text key={key} color="green">
|
|
59
|
-
{token.text ?? ""}
|
|
60
|
-
</Text>,
|
|
61
|
-
];
|
|
62
|
-
case "strong":
|
|
63
|
-
return [
|
|
64
|
-
<Text key={key} bold>
|
|
65
|
-
{renderInlineTokens(token.tokens, { keyPrefix: key })}
|
|
66
|
-
</Text>,
|
|
67
|
-
];
|
|
68
|
-
case "em":
|
|
69
|
-
return [
|
|
70
|
-
<Text key={key} italic>
|
|
71
|
-
{renderInlineTokens(token.tokens, { keyPrefix: key })}
|
|
72
|
-
</Text>,
|
|
73
|
-
];
|
|
74
|
-
case "del":
|
|
75
|
-
return [
|
|
76
|
-
<Text key={key} dimColor>
|
|
77
|
-
{renderInlineTokens(token.tokens, { keyPrefix: key })}
|
|
78
|
-
</Text>,
|
|
79
|
-
];
|
|
80
|
-
case "link": {
|
|
81
|
-
const href = token.href ?? "";
|
|
82
|
-
const text = inlineToPlainText(token.tokens).trim();
|
|
83
|
-
const label = text || href;
|
|
84
|
-
const shouldShowHref = Boolean(href) && label !== href;
|
|
85
|
-
return [
|
|
86
|
-
<Text key={`${key}-label`} color="blue" underline>
|
|
87
|
-
{label}
|
|
88
|
-
</Text>,
|
|
89
|
-
...(shouldShowHref
|
|
90
|
-
? [
|
|
91
|
-
<Text key={`${key}-href`} color="gray">
|
|
92
|
-
{` (${href})`}
|
|
93
|
-
</Text>,
|
|
94
|
-
]
|
|
95
|
-
: []),
|
|
96
|
-
];
|
|
97
|
-
}
|
|
98
|
-
case "image": {
|
|
99
|
-
const label = token.text?.trim() || "image";
|
|
100
|
-
const href = token.href ?? "";
|
|
101
|
-
return [
|
|
102
|
-
<Text key={`${key}-img-label`} color="magenta">
|
|
103
|
-
{`[${label}]`}
|
|
104
|
-
</Text>,
|
|
105
|
-
...(href
|
|
106
|
-
? [
|
|
107
|
-
<Text key={`${key}-img-href`} color="gray">
|
|
108
|
-
{` (${href})`}
|
|
109
|
-
</Text>,
|
|
110
|
-
]
|
|
111
|
-
: []),
|
|
112
|
-
];
|
|
113
|
-
}
|
|
114
|
-
case "br":
|
|
115
|
-
return [<Text key={key}>{"\n"}</Text>];
|
|
116
|
-
default: {
|
|
117
|
-
const fallback = plainFromToken(token);
|
|
118
|
-
return fallback ? [fallback] : [];
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Box } from "ink";
|
|
2
|
-
import { BlockRenderer } from "./BlockRenderer.tsx";
|
|
3
|
-
import { useMarkdownTokens } from "./hooks/useMarkdownTokens.ts";
|
|
4
|
-
|
|
5
|
-
type MarkdownMessageProps = {
|
|
6
|
-
children: string;
|
|
7
|
-
streaming?: boolean;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function MarkdownMessage({
|
|
11
|
-
children,
|
|
12
|
-
streaming = false,
|
|
13
|
-
}: MarkdownMessageProps) {
|
|
14
|
-
const content = children ?? "";
|
|
15
|
-
const {
|
|
16
|
-
fullTokens,
|
|
17
|
-
stablePrefix,
|
|
18
|
-
unstableSuffix,
|
|
19
|
-
stableTokens,
|
|
20
|
-
unstableTokens,
|
|
21
|
-
} = useMarkdownTokens(content, streaming);
|
|
22
|
-
|
|
23
|
-
if (!streaming) {
|
|
24
|
-
return <BlockRenderer tokens={fullTokens} />;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Box flexDirection="column">
|
|
29
|
-
{stablePrefix ? <BlockRenderer tokens={stableTokens} /> : null}
|
|
30
|
-
{unstableSuffix ? (
|
|
31
|
-
<BlockRenderer tokens={unstableTokens} streaming />
|
|
32
|
-
) : null}
|
|
33
|
-
</Box>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Box, Text, useWindowSize } from "ink";
|
|
2
|
-
import type { Tokens } from "marked";
|
|
3
|
-
import { useMarkdownTableLayout } from "./hooks/useMarkdownTableLayout.ts";
|
|
4
|
-
|
|
5
|
-
type MarkdownTableProps = {
|
|
6
|
-
token: Tokens.Table;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export function MarkdownTable({ token }: MarkdownTableProps) {
|
|
10
|
-
const { columns } = useWindowSize();
|
|
11
|
-
const layout = useMarkdownTableLayout(token, columns);
|
|
12
|
-
if (layout.lines.length === 0) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<Box flexDirection="column" marginBottom={1}>
|
|
18
|
-
{layout.lines.map((line, index) => (
|
|
19
|
-
<Text key={index}>{line}</Text>
|
|
20
|
-
))}
|
|
21
|
-
</Box>
|
|
22
|
-
);
|
|
23
|
-
}
|