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
package/src/chat/app.tsx
DELETED
|
@@ -1,636 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useCallback,
|
|
3
|
-
useEffect,
|
|
4
|
-
useMemo,
|
|
5
|
-
useRef,
|
|
6
|
-
useState,
|
|
7
|
-
} from "react";
|
|
8
|
-
import fastq from "fastq";
|
|
9
|
-
import { Box, useApp, useInput, useWindowSize } from "ink";
|
|
10
|
-
import {
|
|
11
|
-
BeforeToolCallEvent,
|
|
12
|
-
Message,
|
|
13
|
-
TextBlock,
|
|
14
|
-
type Agent,
|
|
15
|
-
type AgentStreamEvent,
|
|
16
|
-
type ContentBlock,
|
|
17
|
-
} from "@strands-agents/sdk";
|
|
18
|
-
import type { Manager as McpManager } from "../core/mcp/index.ts";
|
|
19
|
-
import type { Registry } from "../core/skills/index.ts";
|
|
20
|
-
import { takeFileToolDisplay } from "../core/state/file-tool-display.ts";
|
|
21
|
-
import {
|
|
22
|
-
ChatApprovalController,
|
|
23
|
-
createChatApprovalHandler,
|
|
24
|
-
} from "./approvals.ts";
|
|
25
|
-
import { ApprovalPrompt } from "./components/ApprovalPrompt.tsx";
|
|
26
|
-
import { Composer } from "./components/Composer.tsx";
|
|
27
|
-
import { QueuedPrompts } from "./components/QueuedPrompts.tsx";
|
|
28
|
-
import { StatusBar } from "./components/StatusBar.tsx";
|
|
29
|
-
import { TodoPanel } from "./components/TodoPanel.tsx";
|
|
30
|
-
import { TranscriptViewport } from "./components/TranscriptViewport.tsx";
|
|
31
|
-
import type { ApprovalRequest, ChatLine } from "./types.ts";
|
|
32
|
-
import { getTodoViewState, type TodoViewState } from "../core/state/todos.ts";
|
|
33
|
-
import { attachmentPathsToPromptBlocks } from "../core/utils/attachments.ts";
|
|
34
|
-
import { isMouseInput } from "./mouse.ts";
|
|
35
|
-
import type { PromptSubmission } from "./components/prompt-input/hooks/usePromptInputController.ts";
|
|
36
|
-
|
|
37
|
-
type ChatAppProps = {
|
|
38
|
-
agent: Agent;
|
|
39
|
-
sessionId: string;
|
|
40
|
-
manager: McpManager;
|
|
41
|
-
registry: Registry;
|
|
42
|
-
initialPrompt?: string;
|
|
43
|
-
yolo?: boolean;
|
|
44
|
-
onExit: () => void;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
type QueuedPrompt = {
|
|
48
|
-
id: string;
|
|
49
|
-
prompt: PromptSubmission;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
function normalizePromptSubmission(
|
|
53
|
-
value: string | PromptSubmission,
|
|
54
|
-
): PromptSubmission {
|
|
55
|
-
if (typeof value === "string") {
|
|
56
|
-
return { text: value, attachments: [] };
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
text: value.text,
|
|
60
|
-
attachments: [
|
|
61
|
-
...new Set(value.attachments.map((item) => item.trim()).filter(Boolean)),
|
|
62
|
-
],
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const INPUT_HINT =
|
|
67
|
-
"enter: queue prompt | shift/meta+enter or \\+enter: newline | esc/ctrl+c: cancel or exit";
|
|
68
|
-
|
|
69
|
-
function nowId(): string {
|
|
70
|
-
return `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function stringifyUnknown(value: unknown): string {
|
|
74
|
-
try {
|
|
75
|
-
return JSON.stringify(value, null, 2);
|
|
76
|
-
} catch {
|
|
77
|
-
return String(value);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function toToolResultText(result: unknown): string {
|
|
82
|
-
const data = result as {
|
|
83
|
-
status?: string;
|
|
84
|
-
content?: Array<{ type?: string; text?: string; json?: unknown }>;
|
|
85
|
-
};
|
|
86
|
-
const pieces = (data.content ?? []).map((item) => {
|
|
87
|
-
if (item.type === "textBlock" && typeof item.text === "string") {
|
|
88
|
-
return item.text;
|
|
89
|
-
}
|
|
90
|
-
if (item.type === "jsonBlock") {
|
|
91
|
-
return stringifyUnknown(item.json);
|
|
92
|
-
}
|
|
93
|
-
return stringifyUnknown(item);
|
|
94
|
-
});
|
|
95
|
-
const body = pieces.filter(Boolean).join("\n");
|
|
96
|
-
return body || `Tool finished with status: ${data.status ?? "unknown"}`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function getToolUseId(value: unknown): string | null {
|
|
100
|
-
if (!value || typeof value !== "object") {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
const data = value as {
|
|
104
|
-
toolUseId?: unknown;
|
|
105
|
-
toolUse?: { toolUseId?: unknown };
|
|
106
|
-
};
|
|
107
|
-
if (typeof data.toolUseId === "string") {
|
|
108
|
-
return data.toolUseId;
|
|
109
|
-
}
|
|
110
|
-
if (typeof data.toolUse?.toolUseId === "string") {
|
|
111
|
-
return data.toolUse.toolUseId;
|
|
112
|
-
}
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export function ChatApp({
|
|
117
|
-
agent,
|
|
118
|
-
sessionId,
|
|
119
|
-
manager,
|
|
120
|
-
registry,
|
|
121
|
-
initialPrompt,
|
|
122
|
-
yolo,
|
|
123
|
-
onExit,
|
|
124
|
-
}: ChatAppProps): React.JSX.Element {
|
|
125
|
-
const { exit } = useApp();
|
|
126
|
-
const { rows } = useWindowSize();
|
|
127
|
-
const totalTools =
|
|
128
|
-
(agent as Agent & { tools?: unknown[] }).tools?.length ?? 0;
|
|
129
|
-
const [input, setInput] = useState("");
|
|
130
|
-
const [running, setRunning] = useState(false);
|
|
131
|
-
const [status, setStatus] = useState("ready");
|
|
132
|
-
const [lines, setLines] = useState<ChatLine[]>([]);
|
|
133
|
-
const [turnCount, setTurnCount] = useState(0);
|
|
134
|
-
const [skillsFound, setSkillsFound] = useState(0);
|
|
135
|
-
const [turnStartedAt, setTurnStartedAt] = useState<number | null>(null);
|
|
136
|
-
const [turnElapsedMs, setTurnElapsedMs] = useState(0);
|
|
137
|
-
const [usage, setUsage] = useState({
|
|
138
|
-
inputTokens: 0,
|
|
139
|
-
outputTokens: 0,
|
|
140
|
-
totalTokens: 0,
|
|
141
|
-
latencyMs: 0,
|
|
142
|
-
});
|
|
143
|
-
const [pendingApproval, setPendingApproval] =
|
|
144
|
-
useState<ApprovalRequest | null>(null);
|
|
145
|
-
const [queuedPrompts, setQueuedPrompts] = useState<QueuedPrompt[]>([]);
|
|
146
|
-
const [liveReasoning, setLiveReasoning] = useState("");
|
|
147
|
-
const [followRequest, setFollowRequest] = useState(0);
|
|
148
|
-
const [todoState, setTodoState] = useState<TodoViewState>(() =>
|
|
149
|
-
getTodoViewState(agent),
|
|
150
|
-
);
|
|
151
|
-
const controllerRef = useRef(new ChatApprovalController());
|
|
152
|
-
const mountedRef = useRef(true);
|
|
153
|
-
const runningRef = useRef(false);
|
|
154
|
-
const assistantLineIdRef = useRef<string | null>(null);
|
|
155
|
-
const toolLineIdsRef = useRef(new Map<string, string>());
|
|
156
|
-
const pendingToolLineIdsRef = useRef<string[]>([]);
|
|
157
|
-
const initialRanRef = useRef(false);
|
|
158
|
-
|
|
159
|
-
useEffect(() => {
|
|
160
|
-
let cancelled = false;
|
|
161
|
-
void registry
|
|
162
|
-
.list()
|
|
163
|
-
.then((skills) => {
|
|
164
|
-
if (!cancelled) {
|
|
165
|
-
setSkillsFound(skills.length);
|
|
166
|
-
}
|
|
167
|
-
})
|
|
168
|
-
.catch(() => {
|
|
169
|
-
if (!cancelled) {
|
|
170
|
-
setSkillsFound(0);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
return () => {
|
|
174
|
-
cancelled = true;
|
|
175
|
-
};
|
|
176
|
-
}, [registry]);
|
|
177
|
-
|
|
178
|
-
useEffect(() => {
|
|
179
|
-
if (!running || turnStartedAt === null) {
|
|
180
|
-
setTurnElapsedMs(0);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
setTurnElapsedMs(Date.now() - turnStartedAt);
|
|
184
|
-
const timer = setInterval(() => {
|
|
185
|
-
setTurnElapsedMs(Date.now() - turnStartedAt);
|
|
186
|
-
}, 1_000);
|
|
187
|
-
return () => {
|
|
188
|
-
clearInterval(timer);
|
|
189
|
-
};
|
|
190
|
-
}, [running, turnStartedAt]);
|
|
191
|
-
|
|
192
|
-
useEffect(() => {
|
|
193
|
-
const controller = controllerRef.current;
|
|
194
|
-
const cleanupListener = controller.subscribe(() => {
|
|
195
|
-
setPendingApproval(controller.pending);
|
|
196
|
-
});
|
|
197
|
-
const cleanupHook = agent.addHook(
|
|
198
|
-
BeforeToolCallEvent,
|
|
199
|
-
createChatApprovalHandler(controller, { yolo }),
|
|
200
|
-
);
|
|
201
|
-
return () => {
|
|
202
|
-
cleanupListener();
|
|
203
|
-
cleanupHook();
|
|
204
|
-
};
|
|
205
|
-
}, [agent, yolo]);
|
|
206
|
-
|
|
207
|
-
useEffect(() => {
|
|
208
|
-
let active = true;
|
|
209
|
-
const refresh = () => {
|
|
210
|
-
if (!active) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
setTodoState(getTodoViewState(agent));
|
|
214
|
-
};
|
|
215
|
-
refresh();
|
|
216
|
-
const timer = setInterval(refresh, running ? 200 : 800);
|
|
217
|
-
return () => {
|
|
218
|
-
active = false;
|
|
219
|
-
clearInterval(timer);
|
|
220
|
-
};
|
|
221
|
-
}, [agent, running]);
|
|
222
|
-
|
|
223
|
-
const appendLine = useCallback((line: ChatLine) => {
|
|
224
|
-
setLines((prev) => [...prev, line]);
|
|
225
|
-
}, []);
|
|
226
|
-
|
|
227
|
-
const updateLine = useCallback((id: string, patch: Partial<ChatLine>) => {
|
|
228
|
-
setLines((prev) =>
|
|
229
|
-
prev.map((line) => (line.id === id ? { ...line, ...patch } : line)),
|
|
230
|
-
);
|
|
231
|
-
}, []);
|
|
232
|
-
|
|
233
|
-
const moveLineToEnd = useCallback((id: string) => {
|
|
234
|
-
setLines((prev) => {
|
|
235
|
-
const index = prev.findIndex((line) => line.id === id);
|
|
236
|
-
if (index === -1 || index === prev.length - 1) {
|
|
237
|
-
return prev;
|
|
238
|
-
}
|
|
239
|
-
const next = [...prev];
|
|
240
|
-
const [line] = next.splice(index, 1);
|
|
241
|
-
if (!line) {
|
|
242
|
-
return prev;
|
|
243
|
-
}
|
|
244
|
-
next.push(line);
|
|
245
|
-
return next;
|
|
246
|
-
});
|
|
247
|
-
}, []);
|
|
248
|
-
|
|
249
|
-
const appendAssistantText = useCallback((text: string) => {
|
|
250
|
-
const id = assistantLineIdRef.current;
|
|
251
|
-
if (!id) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
setLines((prev) =>
|
|
255
|
-
prev.map((line) =>
|
|
256
|
-
line.id === id ? { ...line, content: `${line.content}${text}` } : line,
|
|
257
|
-
),
|
|
258
|
-
);
|
|
259
|
-
}, []);
|
|
260
|
-
|
|
261
|
-
const runTurn = useCallback(
|
|
262
|
-
async (prompt: PromptSubmission) => {
|
|
263
|
-
const trimmed = prompt.text.trim();
|
|
264
|
-
if (!trimmed && prompt.attachments.length === 0) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
const attachmentBlocks = await attachmentPathsToPromptBlocks(
|
|
268
|
-
prompt.attachments,
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
runningRef.current = true;
|
|
272
|
-
setRunning(true);
|
|
273
|
-
setStatus("thinking");
|
|
274
|
-
setTurnStartedAt(Date.now());
|
|
275
|
-
setLiveReasoning("");
|
|
276
|
-
setTurnCount((value) => value + 1);
|
|
277
|
-
appendLine({
|
|
278
|
-
id: nowId(),
|
|
279
|
-
role: "user",
|
|
280
|
-
content:
|
|
281
|
-
prompt.attachments.length > 0
|
|
282
|
-
? `${trimmed || "[attachments]"}\n\n${prompt.attachments
|
|
283
|
-
.map((attachmentPath) => `[attachment] ${attachmentPath}`)
|
|
284
|
-
.join("\n")}`
|
|
285
|
-
: trimmed,
|
|
286
|
-
done: true,
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
const assistantId = nowId();
|
|
290
|
-
assistantLineIdRef.current = assistantId;
|
|
291
|
-
appendLine({
|
|
292
|
-
id: assistantId,
|
|
293
|
-
role: "assistant",
|
|
294
|
-
content: "",
|
|
295
|
-
done: false,
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
try {
|
|
299
|
-
const streamInput =
|
|
300
|
-
attachmentBlocks.length > 0
|
|
301
|
-
? [
|
|
302
|
-
new Message({
|
|
303
|
-
role: "user",
|
|
304
|
-
content: [
|
|
305
|
-
...(trimmed ? [new TextBlock(trimmed)] : []),
|
|
306
|
-
...attachmentBlocks,
|
|
307
|
-
] as ContentBlock[],
|
|
308
|
-
}),
|
|
309
|
-
]
|
|
310
|
-
: trimmed;
|
|
311
|
-
for await (const event of agent.stream(streamInput)) {
|
|
312
|
-
const e = event as AgentStreamEvent;
|
|
313
|
-
switch (e.type) {
|
|
314
|
-
case "contentBlockEvent": {
|
|
315
|
-
const block = e.contentBlock as {
|
|
316
|
-
type?: string;
|
|
317
|
-
text?: string;
|
|
318
|
-
name?: string;
|
|
319
|
-
input?: unknown;
|
|
320
|
-
};
|
|
321
|
-
if (block.type === "textBlock") {
|
|
322
|
-
appendAssistantText(block.text ?? "");
|
|
323
|
-
} else if (block.type === "toolUseBlock") {
|
|
324
|
-
const toolId = nowId();
|
|
325
|
-
const toolUseId = getToolUseId(block);
|
|
326
|
-
if (toolUseId) {
|
|
327
|
-
toolLineIdsRef.current.set(toolUseId, toolId);
|
|
328
|
-
} else {
|
|
329
|
-
pendingToolLineIdsRef.current.push(toolId);
|
|
330
|
-
}
|
|
331
|
-
appendLine({
|
|
332
|
-
id: toolId,
|
|
333
|
-
role: "tool",
|
|
334
|
-
title: "tool",
|
|
335
|
-
toolName: block.name ?? "unknown",
|
|
336
|
-
content: stringifyUnknown(block.input ?? {}),
|
|
337
|
-
phase: "running",
|
|
338
|
-
done: false,
|
|
339
|
-
});
|
|
340
|
-
if (assistantLineIdRef.current) {
|
|
341
|
-
moveLineToEnd(assistantLineIdRef.current);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
case "toolResultEvent": {
|
|
347
|
-
const resultContent = toToolResultText(e.result);
|
|
348
|
-
const toolUseId = getToolUseId(e.result);
|
|
349
|
-
const fileToolDisplay = takeFileToolDisplay(
|
|
350
|
-
agent.appState,
|
|
351
|
-
toolUseId,
|
|
352
|
-
);
|
|
353
|
-
let toolLineId = toolUseId
|
|
354
|
-
? toolLineIdsRef.current.get(toolUseId)
|
|
355
|
-
: undefined;
|
|
356
|
-
if (toolLineId && toolUseId) {
|
|
357
|
-
toolLineIdsRef.current.delete(toolUseId);
|
|
358
|
-
}
|
|
359
|
-
toolLineId ??= pendingToolLineIdsRef.current.shift();
|
|
360
|
-
if (!toolLineId) {
|
|
361
|
-
const firstTrackedTool = toolLineIdsRef.current
|
|
362
|
-
.entries()
|
|
363
|
-
.next();
|
|
364
|
-
if (!firstTrackedTool.done) {
|
|
365
|
-
const [trackedToolUseId, trackedToolLineId] =
|
|
366
|
-
firstTrackedTool.value;
|
|
367
|
-
toolLineIdsRef.current.delete(trackedToolUseId);
|
|
368
|
-
toolLineId = trackedToolLineId;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
if (toolLineId) {
|
|
372
|
-
updateLine(toolLineId, {
|
|
373
|
-
phase: "done",
|
|
374
|
-
done: true,
|
|
375
|
-
resultContent,
|
|
376
|
-
fileToolDisplay,
|
|
377
|
-
});
|
|
378
|
-
} else {
|
|
379
|
-
appendLine({
|
|
380
|
-
id: nowId(),
|
|
381
|
-
role: "tool",
|
|
382
|
-
title: "tool",
|
|
383
|
-
toolName: "unknown",
|
|
384
|
-
content: "",
|
|
385
|
-
resultContent,
|
|
386
|
-
fileToolDisplay,
|
|
387
|
-
phase: "done",
|
|
388
|
-
done: true,
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
case "toolStreamUpdateEvent":
|
|
394
|
-
setStatus("running tool");
|
|
395
|
-
break;
|
|
396
|
-
case "modelStreamUpdateEvent": {
|
|
397
|
-
const modelEvent = (
|
|
398
|
-
e as {
|
|
399
|
-
event?: { type?: string; usage?: unknown; metrics?: unknown };
|
|
400
|
-
}
|
|
401
|
-
).event;
|
|
402
|
-
if (modelEvent?.type === "modelContentBlockDeltaEvent") {
|
|
403
|
-
const delta = (
|
|
404
|
-
modelEvent as {
|
|
405
|
-
delta?: { type?: string; text?: string };
|
|
406
|
-
}
|
|
407
|
-
).delta;
|
|
408
|
-
if (delta?.type === "reasoningContentDelta" && delta.text) {
|
|
409
|
-
setStatus("thinking");
|
|
410
|
-
setLiveReasoning((prev) => `${prev}${delta.text}`);
|
|
411
|
-
} else if (delta?.type === "textDelta") {
|
|
412
|
-
setStatus("streaming");
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
if (modelEvent?.type === "modelMetadataEvent") {
|
|
416
|
-
const usageData = (modelEvent.usage ?? {}) as {
|
|
417
|
-
inputTokens?: number;
|
|
418
|
-
outputTokens?: number;
|
|
419
|
-
totalTokens?: number;
|
|
420
|
-
};
|
|
421
|
-
const metricsData = (modelEvent.metrics ?? {}) as {
|
|
422
|
-
latencyMs?: number;
|
|
423
|
-
};
|
|
424
|
-
setUsage({
|
|
425
|
-
inputTokens: usageData.inputTokens ?? 0,
|
|
426
|
-
outputTokens: usageData.outputTokens ?? 0,
|
|
427
|
-
totalTokens: usageData.totalTokens ?? 0,
|
|
428
|
-
latencyMs: metricsData.latencyMs ?? 0,
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
default:
|
|
434
|
-
break;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
} catch (error) {
|
|
438
|
-
appendLine({
|
|
439
|
-
id: nowId(),
|
|
440
|
-
role: "system",
|
|
441
|
-
title: "error",
|
|
442
|
-
content: error instanceof Error ? error.message : String(error),
|
|
443
|
-
done: true,
|
|
444
|
-
});
|
|
445
|
-
} finally {
|
|
446
|
-
updateLine(assistantId, { done: true });
|
|
447
|
-
assistantLineIdRef.current = null;
|
|
448
|
-
for (const toolLineId of toolLineIdsRef.current.values()) {
|
|
449
|
-
updateLine(toolLineId, { phase: "done", done: true });
|
|
450
|
-
}
|
|
451
|
-
for (const toolLineId of pendingToolLineIdsRef.current) {
|
|
452
|
-
updateLine(toolLineId, { phase: "done", done: true });
|
|
453
|
-
}
|
|
454
|
-
toolLineIdsRef.current.clear();
|
|
455
|
-
pendingToolLineIdsRef.current = [];
|
|
456
|
-
runningRef.current = false;
|
|
457
|
-
setRunning(false);
|
|
458
|
-
setTurnStartedAt(null);
|
|
459
|
-
setLiveReasoning("");
|
|
460
|
-
setStatus("ready");
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
[agent, appendAssistantText, appendLine, moveLineToEnd, updateLine],
|
|
464
|
-
);
|
|
465
|
-
|
|
466
|
-
const runTurnRef = useRef(runTurn);
|
|
467
|
-
useEffect(() => {
|
|
468
|
-
runTurnRef.current = runTurn;
|
|
469
|
-
}, [runTurn]);
|
|
470
|
-
|
|
471
|
-
const queueRef = useRef<fastq.queueAsPromised<QueuedPrompt, void> | null>(
|
|
472
|
-
null,
|
|
473
|
-
);
|
|
474
|
-
if (!queueRef.current) {
|
|
475
|
-
queueRef.current = fastq.promise(async (item: QueuedPrompt) => {
|
|
476
|
-
if (mountedRef.current) {
|
|
477
|
-
setQueuedPrompts((prev) =>
|
|
478
|
-
prev.filter((entry) => entry.id !== item.id),
|
|
479
|
-
);
|
|
480
|
-
}
|
|
481
|
-
await runTurnRef.current(item.prompt);
|
|
482
|
-
}, 1);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
useEffect(() => {
|
|
486
|
-
return () => {
|
|
487
|
-
mountedRef.current = false;
|
|
488
|
-
queueRef.current?.kill();
|
|
489
|
-
};
|
|
490
|
-
}, []);
|
|
491
|
-
|
|
492
|
-
const pushPrompt = useCallback(
|
|
493
|
-
(value: string | PromptSubmission): boolean => {
|
|
494
|
-
const normalized = normalizePromptSubmission(value);
|
|
495
|
-
const trimmed = normalized.text.trim();
|
|
496
|
-
if (!trimmed && normalized.attachments.length === 0) {
|
|
497
|
-
return false;
|
|
498
|
-
}
|
|
499
|
-
const item: QueuedPrompt = {
|
|
500
|
-
id: nowId(),
|
|
501
|
-
prompt: { ...normalized, text: trimmed },
|
|
502
|
-
};
|
|
503
|
-
setQueuedPrompts((prev) => [...prev, item]);
|
|
504
|
-
void queueRef.current?.push(item).catch((error) => {
|
|
505
|
-
if (!mountedRef.current) {
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
setQueuedPrompts((prev) =>
|
|
509
|
-
prev.filter((entry) => entry.id !== item.id),
|
|
510
|
-
);
|
|
511
|
-
appendLine({
|
|
512
|
-
id: nowId(),
|
|
513
|
-
role: "system",
|
|
514
|
-
title: "error",
|
|
515
|
-
content: error instanceof Error ? error.message : String(error),
|
|
516
|
-
done: true,
|
|
517
|
-
});
|
|
518
|
-
});
|
|
519
|
-
return true;
|
|
520
|
-
},
|
|
521
|
-
[appendLine],
|
|
522
|
-
);
|
|
523
|
-
|
|
524
|
-
useEffect(() => {
|
|
525
|
-
if (initialPrompt && !initialRanRef.current) {
|
|
526
|
-
initialRanRef.current = true;
|
|
527
|
-
pushPrompt(initialPrompt);
|
|
528
|
-
}
|
|
529
|
-
}, [initialPrompt, pushPrompt]);
|
|
530
|
-
|
|
531
|
-
const onSubmit = useCallback(
|
|
532
|
-
(value: PromptSubmission) => {
|
|
533
|
-
if (pendingApproval) {
|
|
534
|
-
return;
|
|
535
|
-
}
|
|
536
|
-
if (pushPrompt(value)) {
|
|
537
|
-
setFollowRequest((value) => value + 1);
|
|
538
|
-
setInput("");
|
|
539
|
-
}
|
|
540
|
-
},
|
|
541
|
-
[pendingApproval, pushPrompt],
|
|
542
|
-
);
|
|
543
|
-
|
|
544
|
-
useInput(
|
|
545
|
-
(inputKey, key) => {
|
|
546
|
-
if (isMouseInput(inputKey)) {
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
if (key.ctrl && inputKey.toLowerCase() === "c") {
|
|
550
|
-
if (runningRef.current) {
|
|
551
|
-
agent.cancel();
|
|
552
|
-
setStatus("cancel requested");
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
onExit();
|
|
556
|
-
exit();
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
if (key.escape) {
|
|
560
|
-
if (runningRef.current) {
|
|
561
|
-
agent.cancel();
|
|
562
|
-
setStatus("cancel requested");
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
onExit();
|
|
566
|
-
exit();
|
|
567
|
-
}
|
|
568
|
-
},
|
|
569
|
-
// Keep active while a turn runs so Esc / Ctrl+C can call `agent.cancel()`.
|
|
570
|
-
// When `running` was false here, keys never reached this handler during streaming.
|
|
571
|
-
{ isActive: !pendingApproval },
|
|
572
|
-
);
|
|
573
|
-
|
|
574
|
-
const elapsedLabel = useMemo(() => {
|
|
575
|
-
const seconds = Math.floor(turnElapsedMs / 1000);
|
|
576
|
-
const min = Math.floor(seconds / 60);
|
|
577
|
-
const sec = seconds % 60;
|
|
578
|
-
return `${String(min).padStart(2, "0")}:${String(sec).padStart(2, "0")}`;
|
|
579
|
-
}, [turnElapsedMs]);
|
|
580
|
-
|
|
581
|
-
const activeTodo = useMemo(
|
|
582
|
-
() => todoState.todos.find((todo) => todo.status === "in_progress"),
|
|
583
|
-
[todoState.todos],
|
|
584
|
-
);
|
|
585
|
-
const statusLabel =
|
|
586
|
-
running && activeTodo
|
|
587
|
-
? activeTodo.activeForm.trim() || activeTodo.content
|
|
588
|
-
: status;
|
|
589
|
-
|
|
590
|
-
return (
|
|
591
|
-
<Box flexDirection="column" width="100%" height={rows} paddingX={1}>
|
|
592
|
-
<TranscriptViewport
|
|
593
|
-
lines={lines}
|
|
594
|
-
liveReasoning={liveReasoning}
|
|
595
|
-
followRequest={followRequest}
|
|
596
|
-
/>
|
|
597
|
-
|
|
598
|
-
<Box flexDirection="column" flexShrink={0}>
|
|
599
|
-
{running && todoState.visible && todoState.todos.length > 0 ? (
|
|
600
|
-
<TodoPanel todos={todoState.todos} />
|
|
601
|
-
) : null}
|
|
602
|
-
<QueuedPrompts prompts={queuedPrompts} />
|
|
603
|
-
|
|
604
|
-
{pendingApproval ? (
|
|
605
|
-
<ApprovalPrompt
|
|
606
|
-
onDecision={(decision) => controllerRef.current.decide(decision)}
|
|
607
|
-
/>
|
|
608
|
-
) : null}
|
|
609
|
-
|
|
610
|
-
{!pendingApproval ? (
|
|
611
|
-
<Composer
|
|
612
|
-
input={input}
|
|
613
|
-
running={running}
|
|
614
|
-
disabled={Boolean(pendingApproval)}
|
|
615
|
-
hint={INPUT_HINT}
|
|
616
|
-
onChange={setInput}
|
|
617
|
-
onSubmit={onSubmit}
|
|
618
|
-
/>
|
|
619
|
-
) : null}
|
|
620
|
-
|
|
621
|
-
<StatusBar
|
|
622
|
-
running={running}
|
|
623
|
-
status={status}
|
|
624
|
-
statusLabel={statusLabel}
|
|
625
|
-
sessionId={sessionId}
|
|
626
|
-
elapsedLabel={elapsedLabel}
|
|
627
|
-
turnCount={turnCount}
|
|
628
|
-
totalTools={totalTools}
|
|
629
|
-
skillsFound={skillsFound}
|
|
630
|
-
manager={manager}
|
|
631
|
-
usage={usage}
|
|
632
|
-
/>
|
|
633
|
-
</Box>
|
|
634
|
-
</Box>
|
|
635
|
-
);
|
|
636
|
-
}
|