@compass-ai/nova 1.0.72 → 1.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp/agent.d.ts +318 -0
- package/dist/acp/agent.d.ts.map +1 -0
- package/dist/acp/agent.js +795 -0
- package/dist/acp/agent.js.map +1 -0
- package/dist/acp/backpressure-writer.d.ts +49 -0
- package/dist/acp/backpressure-writer.d.ts.map +1 -0
- package/dist/acp/backpressure-writer.js +153 -0
- package/dist/acp/backpressure-writer.js.map +1 -0
- package/dist/acp/event-adapter.d.ts +242 -0
- package/dist/acp/event-adapter.d.ts.map +1 -0
- package/dist/acp/event-adapter.js +456 -0
- package/dist/acp/event-adapter.js.map +1 -0
- package/dist/acp/index.d.ts +30 -0
- package/dist/acp/index.d.ts.map +1 -0
- package/dist/acp/index.js +36 -0
- package/dist/acp/index.js.map +1 -0
- package/dist/acp/modes.d.ts +56 -0
- package/dist/acp/modes.d.ts.map +1 -0
- package/dist/acp/modes.js +135 -0
- package/dist/acp/modes.js.map +1 -0
- package/dist/acp/session-manager.d.ts +170 -0
- package/dist/acp/session-manager.d.ts.map +1 -0
- package/dist/acp/session-manager.js +381 -0
- package/dist/acp/session-manager.js.map +1 -0
- package/dist/acp/text-coalescer.d.ts +45 -0
- package/dist/acp/text-coalescer.d.ts.map +1 -0
- package/dist/acp/text-coalescer.js +110 -0
- package/dist/acp/text-coalescer.js.map +1 -0
- package/dist/acp/tool-bridge.d.ts +156 -0
- package/dist/acp/tool-bridge.d.ts.map +1 -0
- package/dist/acp/tool-bridge.js +381 -0
- package/dist/acp/tool-bridge.js.map +1 -0
- package/dist/acp/types.d.ts +314 -0
- package/dist/acp/types.d.ts.map +1 -0
- package/dist/acp/types.js +8 -0
- package/dist/acp/types.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +185 -184
- package/dist/cli.js.map +1 -0
- package/dist/commands/acp.d.ts +26 -0
- package/dist/commands/acp.d.ts.map +1 -0
- package/dist/commands/acp.js +492 -0
- package/dist/commands/acp.js.map +1 -0
- package/dist/commands/cache.d.ts +33 -0
- package/dist/commands/cache.d.ts.map +1 -0
- package/dist/commands/cache.js +537 -0
- package/dist/commands/cache.js.map +1 -0
- package/dist/commands/config.d.ts +10 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +367 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/consent.d.ts +21 -0
- package/dist/commands/consent.d.ts.map +1 -0
- package/dist/commands/consent.js +334 -0
- package/dist/commands/consent.js.map +1 -0
- package/dist/commands/data.d.ts +24 -0
- package/dist/commands/data.d.ts.map +1 -0
- package/dist/commands/data.js +586 -0
- package/dist/commands/data.js.map +1 -0
- package/dist/commands/index.d.ts +145 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +210 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +106 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +349 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/logs.d.ts +13 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +359 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/mcp.d.ts +20 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +687 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/reset.d.ts +20 -0
- package/dist/commands/reset.d.ts.map +1 -0
- package/dist/commands/reset.js +372 -0
- package/dist/commands/reset.js.map +1 -0
- package/dist/commands/setup.d.ts +74 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +863 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/slash/agents.d.ts +40 -0
- package/dist/commands/slash/agents.d.ts.map +1 -0
- package/dist/commands/slash/agents.js +519 -0
- package/dist/commands/slash/agents.js.map +1 -0
- package/dist/commands/slash/approve.d.ts +46 -0
- package/dist/commands/slash/approve.d.ts.map +1 -0
- package/dist/commands/slash/approve.js +239 -0
- package/dist/commands/slash/approve.js.map +1 -0
- package/dist/commands/slash/attach.d.ts +70 -0
- package/dist/commands/slash/attach.d.ts.map +1 -0
- package/dist/commands/slash/attach.js +333 -0
- package/dist/commands/slash/attach.js.map +1 -0
- package/dist/commands/slash/clear.d.ts +47 -0
- package/dist/commands/slash/clear.d.ts.map +1 -0
- package/dist/commands/slash/clear.js +261 -0
- package/dist/commands/slash/clear.js.map +1 -0
- package/dist/commands/slash/commit.d.ts +40 -0
- package/dist/commands/slash/commit.d.ts.map +1 -0
- package/dist/commands/slash/commit.js +337 -0
- package/dist/commands/slash/commit.js.map +1 -0
- package/dist/commands/slash/compact.d.ts +48 -0
- package/dist/commands/slash/compact.d.ts.map +1 -0
- package/dist/commands/slash/compact.js +288 -0
- package/dist/commands/slash/compact.js.map +1 -0
- package/dist/commands/slash/config.d.ts +20 -0
- package/dist/commands/slash/config.d.ts.map +1 -0
- package/dist/commands/slash/config.js +136 -0
- package/dist/commands/slash/config.js.map +1 -0
- package/dist/commands/slash/context.d.ts +49 -0
- package/dist/commands/slash/context.d.ts.map +1 -0
- package/dist/commands/slash/context.js +430 -0
- package/dist/commands/slash/context.js.map +1 -0
- package/dist/commands/slash/cost.d.ts +34 -0
- package/dist/commands/slash/cost.d.ts.map +1 -0
- package/dist/commands/slash/cost.js +312 -0
- package/dist/commands/slash/cost.js.map +1 -0
- package/dist/commands/slash/custom.d.ts +41 -0
- package/dist/commands/slash/custom.d.ts.map +1 -0
- package/dist/commands/slash/custom.js +126 -0
- package/dist/commands/slash/custom.js.map +1 -0
- package/dist/commands/slash/exit.d.ts +25 -0
- package/dist/commands/slash/exit.d.ts.map +1 -0
- package/dist/commands/slash/exit.js +186 -0
- package/dist/commands/slash/exit.js.map +1 -0
- package/dist/commands/slash/export.d.ts +27 -0
- package/dist/commands/slash/export.d.ts.map +1 -0
- package/dist/commands/slash/export.js +318 -0
- package/dist/commands/slash/export.js.map +1 -0
- package/dist/commands/slash/files.d.ts +47 -0
- package/dist/commands/slash/files.d.ts.map +1 -0
- package/dist/commands/slash/files.js +521 -0
- package/dist/commands/slash/files.js.map +1 -0
- package/dist/commands/slash/help.d.ts +50 -0
- package/dist/commands/slash/help.d.ts.map +1 -0
- package/dist/commands/slash/help.js +282 -0
- package/dist/commands/slash/help.js.map +1 -0
- package/dist/commands/slash/index-cmd.d.ts +41 -0
- package/dist/commands/slash/index-cmd.d.ts.map +1 -0
- package/dist/commands/slash/index-cmd.js +349 -0
- package/dist/commands/slash/index-cmd.js.map +1 -0
- package/dist/commands/slash/index.d.ts +97 -0
- package/dist/commands/slash/index.d.ts.map +1 -0
- package/dist/commands/slash/index.js +251 -0
- package/dist/commands/slash/index.js.map +1 -0
- package/dist/commands/slash/login.d.ts +23 -0
- package/dist/commands/slash/login.d.ts.map +1 -0
- package/dist/commands/slash/login.js +175 -0
- package/dist/commands/slash/login.js.map +1 -0
- package/dist/commands/slash/logout.d.ts +23 -0
- package/dist/commands/slash/logout.d.ts.map +1 -0
- package/dist/commands/slash/logout.js +153 -0
- package/dist/commands/slash/logout.js.map +1 -0
- package/dist/commands/slash/logs.d.ts +29 -0
- package/dist/commands/slash/logs.d.ts.map +1 -0
- package/dist/commands/slash/logs.js +423 -0
- package/dist/commands/slash/logs.js.map +1 -0
- package/dist/commands/slash/mcp.d.ts +29 -0
- package/dist/commands/slash/mcp.d.ts.map +1 -0
- package/dist/commands/slash/mcp.js +1026 -0
- package/dist/commands/slash/mcp.js.map +1 -0
- package/dist/commands/slash/model.d.ts +60 -0
- package/dist/commands/slash/model.d.ts.map +1 -0
- package/dist/commands/slash/model.js +466 -0
- package/dist/commands/slash/model.js.map +1 -0
- package/dist/commands/slash/personality.d.ts +40 -0
- package/dist/commands/slash/personality.d.ts.map +1 -0
- package/dist/commands/slash/personality.js +272 -0
- package/dist/commands/slash/personality.js.map +1 -0
- package/dist/commands/slash/purge.d.ts +42 -0
- package/dist/commands/slash/purge.d.ts.map +1 -0
- package/dist/commands/slash/purge.js +233 -0
- package/dist/commands/slash/purge.js.map +1 -0
- package/dist/commands/slash/reset.d.ts +44 -0
- package/dist/commands/slash/reset.d.ts.map +1 -0
- package/dist/commands/slash/reset.js +326 -0
- package/dist/commands/slash/reset.js.map +1 -0
- package/dist/commands/slash/skills.d.ts +40 -0
- package/dist/commands/slash/skills.d.ts.map +1 -0
- package/dist/commands/slash/skills.js +207 -0
- package/dist/commands/slash/skills.js.map +1 -0
- package/dist/commands/slash/tokens.d.ts +34 -0
- package/dist/commands/slash/tokens.d.ts.map +1 -0
- package/dist/commands/slash/tokens.js +205 -0
- package/dist/commands/slash/tokens.js.map +1 -0
- package/dist/commands/slash/unleash.d.ts +50 -0
- package/dist/commands/slash/unleash.d.ts.map +1 -0
- package/dist/commands/slash/unleash.js +262 -0
- package/dist/commands/slash/unleash.js.map +1 -0
- package/dist/commands/slash/update.d.ts +34 -0
- package/dist/commands/slash/update.d.ts.map +1 -0
- package/dist/commands/slash/update.js +364 -0
- package/dist/commands/slash/update.js.map +1 -0
- package/dist/commands/slash/wrap.d.ts +18 -0
- package/dist/commands/slash/wrap.d.ts.map +1 -0
- package/dist/commands/slash/wrap.js +21 -0
- package/dist/commands/slash/wrap.js.map +1 -0
- package/dist/commands/tokens.d.ts +26 -0
- package/dist/commands/tokens.d.ts.map +1 -0
- package/dist/commands/tokens.js +245 -0
- package/dist/commands/tokens.js.map +1 -0
- package/dist/constants/builtin-agents.d.ts +27 -0
- package/dist/constants/builtin-agents.d.ts.map +1 -0
- package/dist/constants/builtin-agents.js +710 -0
- package/dist/constants/builtin-agents.js.map +1 -0
- package/dist/constants/builtin-skills.d.ts +32 -0
- package/dist/constants/builtin-skills.d.ts.map +1 -0
- package/dist/constants/builtin-skills.js +389 -0
- package/dist/constants/builtin-skills.js.map +1 -0
- package/dist/constants/defaults.d.ts +448 -0
- package/dist/constants/defaults.d.ts.map +1 -0
- package/dist/constants/defaults.js +829 -0
- package/dist/constants/defaults.js.map +1 -0
- package/dist/constants/index.d.ts +27 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +85 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/install-hints.d.ts +7 -0
- package/dist/constants/install-hints.d.ts.map +1 -0
- package/dist/constants/install-hints.js +123 -0
- package/dist/constants/install-hints.js.map +1 -0
- package/dist/constants/models.d.ts +255 -0
- package/dist/constants/models.d.ts.map +1 -0
- package/dist/constants/models.js +596 -0
- package/dist/constants/models.js.map +1 -0
- package/dist/constants/schedule.d.ts +43 -0
- package/dist/constants/schedule.d.ts.map +1 -0
- package/dist/constants/schedule.js +110 -0
- package/dist/constants/schedule.js.map +1 -0
- package/dist/constants/system-utilities.d.ts +57 -0
- package/dist/constants/system-utilities.d.ts.map +1 -0
- package/dist/constants/system-utilities.js +421 -0
- package/dist/constants/system-utilities.js.map +1 -0
- package/dist/constants/token-limits.d.ts +102 -0
- package/dist/constants/token-limits.d.ts.map +1 -0
- package/dist/constants/token-limits.js +286 -0
- package/dist/constants/token-limits.js.map +1 -0
- package/dist/core/autocomplete.d.ts +132 -0
- package/dist/core/autocomplete.d.ts.map +1 -0
- package/dist/core/autocomplete.js +653 -0
- package/dist/core/autocomplete.js.map +1 -0
- package/dist/core/command-parser.d.ts +301 -0
- package/dist/core/command-parser.d.ts.map +1 -0
- package/dist/core/command-parser.js +526 -0
- package/dist/core/command-parser.js.map +1 -0
- package/dist/core/context-builder.d.ts +264 -0
- package/dist/core/context-builder.d.ts.map +1 -0
- package/dist/core/context-builder.js +1018 -0
- package/dist/core/context-builder.js.map +1 -0
- package/dist/core/event-emitter.d.ts +411 -0
- package/dist/core/event-emitter.d.ts.map +1 -0
- package/dist/core/event-emitter.js +138 -0
- package/dist/core/event-emitter.js.map +1 -0
- package/dist/core/history-manager.d.ts +62 -0
- package/dist/core/history-manager.d.ts.map +1 -0
- package/dist/core/history-manager.js +151 -0
- package/dist/core/history-manager.js.map +1 -0
- package/dist/core/slash-command-handler.d.ts +352 -0
- package/dist/core/slash-command-handler.d.ts.map +1 -0
- package/dist/core/slash-command-handler.js +563 -0
- package/dist/core/slash-command-handler.js.map +1 -0
- package/dist/core/task-processor.d.ts +179 -0
- package/dist/core/task-processor.d.ts.map +1 -0
- package/dist/core/task-processor.js +519 -0
- package/dist/core/task-processor.js.map +1 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -0
- package/dist/prompts/agent-prompt-generator.d.ts +26 -0
- package/dist/prompts/agent-prompt-generator.d.ts.map +1 -0
- package/dist/prompts/agent-prompt-generator.js +244 -0
- package/dist/prompts/agent-prompt-generator.js.map +1 -0
- package/dist/prompts/commit-message.d.ts +35 -0
- package/dist/prompts/commit-message.d.ts.map +1 -0
- package/dist/prompts/commit-message.js +187 -0
- package/dist/prompts/commit-message.js.map +1 -0
- package/dist/prompts/conversation.d.ts +51 -0
- package/dist/prompts/conversation.d.ts.map +1 -0
- package/dist/prompts/conversation.js +115 -0
- package/dist/prompts/conversation.js.map +1 -0
- package/dist/prompts/index.d.ts +39 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +74 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/memory.d.ts +6 -0
- package/dist/prompts/memory.d.ts.map +1 -0
- package/dist/prompts/memory.js +29 -0
- package/dist/prompts/memory.js.map +1 -0
- package/dist/prompts/personality.d.ts +77 -0
- package/dist/prompts/personality.d.ts.map +1 -0
- package/dist/prompts/personality.js +393 -0
- package/dist/prompts/personality.js.map +1 -0
- package/dist/prompts/plan-generator.d.ts +144 -0
- package/dist/prompts/plan-generator.d.ts.map +1 -0
- package/dist/prompts/plan-generator.js +553 -0
- package/dist/prompts/plan-generator.js.map +1 -0
- package/dist/prompts/system.d.ts +95 -0
- package/dist/prompts/system.d.ts.map +1 -0
- package/dist/prompts/system.js +461 -0
- package/dist/prompts/system.js.map +1 -0
- package/dist/prompts/task-processor.d.ts +94 -0
- package/dist/prompts/task-processor.d.ts.map +1 -0
- package/dist/prompts/task-processor.js +554 -0
- package/dist/prompts/task-processor.js.map +1 -0
- package/dist/prompts/unguarded.d.ts +78 -0
- package/dist/prompts/unguarded.d.ts.map +1 -0
- package/dist/prompts/unguarded.js +418 -0
- package/dist/prompts/unguarded.js.map +1 -0
- package/dist/prompts/utils.d.ts +73 -0
- package/dist/prompts/utils.d.ts.map +1 -0
- package/dist/prompts/utils.js +114 -0
- package/dist/prompts/utils.js.map +1 -0
- package/dist/prompts/workflow.d.ts +241 -0
- package/dist/prompts/workflow.d.ts.map +1 -0
- package/dist/prompts/workflow.js +608 -0
- package/dist/prompts/workflow.js.map +1 -0
- package/dist/services/action-logger.d.ts +383 -0
- package/dist/services/action-logger.d.ts.map +1 -0
- package/dist/services/action-logger.js +544 -0
- package/dist/services/action-logger.js.map +1 -0
- package/dist/services/agent-budget-allocator.d.ts +111 -0
- package/dist/services/agent-budget-allocator.d.ts.map +1 -0
- package/dist/services/agent-budget-allocator.js +278 -0
- package/dist/services/agent-budget-allocator.js.map +1 -0
- package/dist/services/agent-manager.d.ts +181 -0
- package/dist/services/agent-manager.d.ts.map +1 -0
- package/dist/services/agent-manager.js +749 -0
- package/dist/services/agent-manager.js.map +1 -0
- package/dist/services/agent-spawner.d.ts +138 -0
- package/dist/services/agent-spawner.d.ts.map +1 -0
- package/dist/services/agent-spawner.js +748 -0
- package/dist/services/agent-spawner.js.map +1 -0
- package/dist/services/agent-state-service.d.ts +145 -0
- package/dist/services/agent-state-service.d.ts.map +1 -0
- package/dist/services/agent-state-service.js +247 -0
- package/dist/services/agent-state-service.js.map +1 -0
- package/dist/services/anthropic-client.d.ts +357 -0
- package/dist/services/anthropic-client.d.ts.map +1 -0
- package/dist/services/anthropic-client.js +1451 -0
- package/dist/services/anthropic-client.js.map +1 -0
- package/dist/services/approval-manager.d.ts +385 -0
- package/dist/services/approval-manager.d.ts.map +1 -0
- package/dist/services/approval-manager.js +1044 -0
- package/dist/services/approval-manager.js.map +1 -0
- package/dist/services/audit-logger.d.ts +245 -0
- package/dist/services/audit-logger.d.ts.map +1 -0
- package/dist/services/audit-logger.js +324 -0
- package/dist/services/audit-logger.js.map +1 -0
- package/dist/services/backup-manager.d.ts +136 -0
- package/dist/services/backup-manager.d.ts.map +1 -0
- package/dist/services/backup-manager.js +260 -0
- package/dist/services/backup-manager.js.map +1 -0
- package/dist/services/cache-service.d.ts +247 -0
- package/dist/services/cache-service.d.ts.map +1 -0
- package/dist/services/cache-service.js +558 -0
- package/dist/services/cache-service.js.map +1 -0
- package/dist/services/chat-archival-service.d.ts +108 -0
- package/dist/services/chat-archival-service.d.ts.map +1 -0
- package/dist/services/chat-archival-service.js +465 -0
- package/dist/services/chat-archival-service.js.map +1 -0
- package/dist/services/codebase-indexer.d.ts +272 -0
- package/dist/services/codebase-indexer.d.ts.map +1 -0
- package/dist/services/codebase-indexer.js +863 -0
- package/dist/services/codebase-indexer.js.map +1 -0
- package/dist/services/compass-auth-service.d.ts +204 -0
- package/dist/services/compass-auth-service.d.ts.map +1 -0
- package/dist/services/compass-auth-service.js +391 -0
- package/dist/services/compass-auth-service.js.map +1 -0
- package/dist/services/complexity-classifier.d.ts +208 -0
- package/dist/services/complexity-classifier.d.ts.map +1 -0
- package/dist/services/complexity-classifier.js +1410 -0
- package/dist/services/complexity-classifier.js.map +1 -0
- package/dist/services/config-manager.d.ts +278 -0
- package/dist/services/config-manager.d.ts.map +1 -0
- package/dist/services/config-manager.js +651 -0
- package/dist/services/config-manager.js.map +1 -0
- package/dist/services/consent-manager.d.ts +239 -0
- package/dist/services/consent-manager.d.ts.map +1 -0
- package/dist/services/consent-manager.js +516 -0
- package/dist/services/consent-manager.js.map +1 -0
- package/dist/services/conversation-compactor.d.ts +223 -0
- package/dist/services/conversation-compactor.d.ts.map +1 -0
- package/dist/services/conversation-compactor.js +750 -0
- package/dist/services/conversation-compactor.js.map +1 -0
- package/dist/services/cost-tracker.d.ts +167 -0
- package/dist/services/cost-tracker.d.ts.map +1 -0
- package/dist/services/cost-tracker.js +199 -0
- package/dist/services/cost-tracker.js.map +1 -0
- package/dist/services/credential-store.d.ts +273 -0
- package/dist/services/credential-store.d.ts.map +1 -0
- package/dist/services/credential-store.js +877 -0
- package/dist/services/credential-store.js.map +1 -0
- package/dist/services/custom-command-service.d.ts +112 -0
- package/dist/services/custom-command-service.d.ts.map +1 -0
- package/dist/services/custom-command-service.js +464 -0
- package/dist/services/custom-command-service.js.map +1 -0
- package/dist/services/default-statusline-renderer.d.ts +60 -0
- package/dist/services/default-statusline-renderer.d.ts.map +1 -0
- package/dist/services/default-statusline-renderer.js +110 -0
- package/dist/services/default-statusline-renderer.js.map +1 -0
- package/dist/services/enhanced-context-gatherer.d.ts +116 -0
- package/dist/services/enhanced-context-gatherer.d.ts.map +1 -0
- package/dist/services/enhanced-context-gatherer.js +605 -0
- package/dist/services/enhanced-context-gatherer.js.map +1 -0
- package/dist/services/file-hash-tracker.d.ts +95 -0
- package/dist/services/file-hash-tracker.d.ts.map +1 -0
- package/dist/services/file-hash-tracker.js +199 -0
- package/dist/services/file-hash-tracker.js.map +1 -0
- package/dist/services/file-service.d.ts +274 -0
- package/dist/services/file-service.d.ts.map +1 -0
- package/dist/services/file-service.js +876 -0
- package/dist/services/file-service.js.map +1 -0
- package/dist/services/git-service.d.ts +536 -0
- package/dist/services/git-service.d.ts.map +1 -0
- package/dist/services/git-service.js +1215 -0
- package/dist/services/git-service.js.map +1 -0
- package/dist/services/hook-service.d.ts +148 -0
- package/dist/services/hook-service.d.ts.map +1 -0
- package/dist/services/hook-service.js +705 -0
- package/dist/services/hook-service.js.map +1 -0
- package/dist/services/ide-state-service.d.ts +114 -0
- package/dist/services/ide-state-service.d.ts.map +1 -0
- package/dist/services/ide-state-service.js +204 -0
- package/dist/services/ide-state-service.js.map +1 -0
- package/dist/services/interactive-clarifier.d.ts +90 -0
- package/dist/services/interactive-clarifier.d.ts.map +1 -0
- package/dist/services/interactive-clarifier.js +446 -0
- package/dist/services/interactive-clarifier.js.map +1 -0
- package/dist/services/iteration-scoper.d.ts +225 -0
- package/dist/services/iteration-scoper.d.ts.map +1 -0
- package/dist/services/iteration-scoper.js +387 -0
- package/dist/services/iteration-scoper.js.map +1 -0
- package/dist/services/llm-plan-generator.d.ts +44 -0
- package/dist/services/llm-plan-generator.d.ts.map +1 -0
- package/dist/services/llm-plan-generator.js +863 -0
- package/dist/services/llm-plan-generator.js.map +1 -0
- package/dist/services/llm-system-prompt-generator.d.ts +85 -0
- package/dist/services/llm-system-prompt-generator.d.ts.map +1 -0
- package/dist/services/llm-system-prompt-generator.js +257 -0
- package/dist/services/llm-system-prompt-generator.js.map +1 -0
- package/dist/services/log-interpreter.d.ts +190 -0
- package/dist/services/log-interpreter.d.ts.map +1 -0
- package/dist/services/log-interpreter.js +520 -0
- package/dist/services/log-interpreter.js.map +1 -0
- package/dist/services/mcp-config-manager.d.ts +141 -0
- package/dist/services/mcp-config-manager.d.ts.map +1 -0
- package/dist/services/mcp-config-manager.js +678 -0
- package/dist/services/mcp-config-manager.js.map +1 -0
- package/dist/services/mcp-oauth-service.d.ts +170 -0
- package/dist/services/mcp-oauth-service.d.ts.map +1 -0
- package/dist/services/mcp-oauth-service.js +892 -0
- package/dist/services/mcp-oauth-service.js.map +1 -0
- package/dist/services/mcp-plugin-support.d.ts +81 -0
- package/dist/services/mcp-plugin-support.d.ts.map +1 -0
- package/dist/services/mcp-plugin-support.js +305 -0
- package/dist/services/mcp-plugin-support.js.map +1 -0
- package/dist/services/mcp-server-manager.d.ts +134 -0
- package/dist/services/mcp-server-manager.d.ts.map +1 -0
- package/dist/services/mcp-server-manager.js +613 -0
- package/dist/services/mcp-server-manager.js.map +1 -0
- package/dist/services/mcp-tool-integration.d.ts +119 -0
- package/dist/services/mcp-tool-integration.d.ts.map +1 -0
- package/dist/services/mcp-tool-integration.js +381 -0
- package/dist/services/mcp-tool-integration.js.map +1 -0
- package/dist/services/mcp-transport.d.ts +105 -0
- package/dist/services/mcp-transport.d.ts.map +1 -0
- package/dist/services/mcp-transport.js +1316 -0
- package/dist/services/mcp-transport.js.map +1 -0
- package/dist/services/memory-service.d.ts +55 -0
- package/dist/services/memory-service.d.ts.map +1 -0
- package/dist/services/memory-service.js +251 -0
- package/dist/services/memory-service.js.map +1 -0
- package/dist/services/model-availability.d.ts +64 -0
- package/dist/services/model-availability.d.ts.map +1 -0
- package/dist/services/model-availability.js +114 -0
- package/dist/services/model-availability.js.map +1 -0
- package/dist/services/plan-generator.d.ts +98 -0
- package/dist/services/plan-generator.d.ts.map +1 -0
- package/dist/services/plan-generator.js +658 -0
- package/dist/services/plan-generator.js.map +1 -0
- package/dist/services/plan-mode-fallback.d.ts +80 -0
- package/dist/services/plan-mode-fallback.d.ts.map +1 -0
- package/dist/services/plan-mode-fallback.js +307 -0
- package/dist/services/plan-mode-fallback.js.map +1 -0
- package/dist/services/plan-mode-handler.d.ts +42 -0
- package/dist/services/plan-mode-handler.d.ts.map +1 -0
- package/dist/services/plan-mode-handler.js +388 -0
- package/dist/services/plan-mode-handler.js.map +1 -0
- package/dist/services/plan-persistence.d.ts +203 -0
- package/dist/services/plan-persistence.d.ts.map +1 -0
- package/dist/services/plan-persistence.js +538 -0
- package/dist/services/plan-persistence.js.map +1 -0
- package/dist/services/prompt-preprocessor.d.ts +73 -0
- package/dist/services/prompt-preprocessor.d.ts.map +1 -0
- package/dist/services/prompt-preprocessor.js +146 -0
- package/dist/services/prompt-preprocessor.js.map +1 -0
- package/dist/services/rating-service.d.ts +84 -0
- package/dist/services/rating-service.d.ts.map +1 -0
- package/dist/services/rating-service.js +171 -0
- package/dist/services/rating-service.js.map +1 -0
- package/dist/services/rating-state-manager.d.ts +131 -0
- package/dist/services/rating-state-manager.d.ts.map +1 -0
- package/dist/services/rating-state-manager.js +270 -0
- package/dist/services/rating-state-manager.js.map +1 -0
- package/dist/services/sdk-runner.d.ts +113 -0
- package/dist/services/sdk-runner.d.ts.map +1 -0
- package/dist/services/sdk-runner.js +1424 -0
- package/dist/services/sdk-runner.js.map +1 -0
- package/dist/services/session-manager.d.ts +528 -0
- package/dist/services/session-manager.d.ts.map +1 -0
- package/dist/services/session-manager.js +1184 -0
- package/dist/services/session-manager.js.map +1 -0
- package/dist/services/shell-executor.d.ts +337 -0
- package/dist/services/shell-executor.d.ts.map +1 -0
- package/dist/services/shell-executor.js +1201 -0
- package/dist/services/shell-executor.js.map +1 -0
- package/dist/services/skill-service.d.ts +149 -0
- package/dist/services/skill-service.d.ts.map +1 -0
- package/dist/services/skill-service.js +594 -0
- package/dist/services/skill-service.js.map +1 -0
- package/dist/services/statusline-executor.d.ts +102 -0
- package/dist/services/statusline-executor.d.ts.map +1 -0
- package/dist/services/statusline-executor.js +305 -0
- package/dist/services/statusline-executor.js.map +1 -0
- package/dist/services/step-tracker.d.ts +356 -0
- package/dist/services/step-tracker.d.ts.map +1 -0
- package/dist/services/step-tracker.js +634 -0
- package/dist/services/step-tracker.js.map +1 -0
- package/dist/services/system-event-logger.d.ts +473 -0
- package/dist/services/system-event-logger.d.ts.map +1 -0
- package/dist/services/system-event-logger.js +790 -0
- package/dist/services/system-event-logger.js.map +1 -0
- package/dist/services/system-utility-detector.d.ts +91 -0
- package/dist/services/system-utility-detector.d.ts.map +1 -0
- package/dist/services/system-utility-detector.js +238 -0
- package/dist/services/system-utility-detector.js.map +1 -0
- package/dist/services/team-context-store.d.ts +100 -0
- package/dist/services/team-context-store.d.ts.map +1 -0
- package/dist/services/team-context-store.js +513 -0
- package/dist/services/team-context-store.js.map +1 -0
- package/dist/services/temp-file-service.d.ts +164 -0
- package/dist/services/temp-file-service.d.ts.map +1 -0
- package/dist/services/temp-file-service.js +303 -0
- package/dist/services/temp-file-service.js.map +1 -0
- package/dist/services/token-limit-enforcer.d.ts +53 -0
- package/dist/services/token-limit-enforcer.d.ts.map +1 -0
- package/dist/services/token-limit-enforcer.js +90 -0
- package/dist/services/token-limit-enforcer.js.map +1 -0
- package/dist/services/token-limit-store.d.ts +105 -0
- package/dist/services/token-limit-store.d.ts.map +1 -0
- package/dist/services/token-limit-store.js +288 -0
- package/dist/services/token-limit-store.js.map +1 -0
- package/dist/services/token-tracker.d.ts +290 -0
- package/dist/services/token-tracker.d.ts.map +1 -0
- package/dist/services/token-tracker.js +751 -0
- package/dist/services/token-tracker.js.map +1 -0
- package/dist/services/tool-registry.d.ts +302 -0
- package/dist/services/tool-registry.d.ts.map +1 -0
- package/dist/services/tool-registry.js +606 -0
- package/dist/services/tool-registry.js.map +1 -0
- package/dist/services/tools-logger.d.ts +152 -0
- package/dist/services/tools-logger.d.ts.map +1 -0
- package/dist/services/tools-logger.js +222 -0
- package/dist/services/tools-logger.js.map +1 -0
- package/dist/services/update-plan-handler.d.ts +56 -0
- package/dist/services/update-plan-handler.d.ts.map +1 -0
- package/dist/services/update-plan-handler.js +372 -0
- package/dist/services/update-plan-handler.js.map +1 -0
- package/dist/services/update-service.d.ts +197 -0
- package/dist/services/update-service.d.ts.map +1 -0
- package/dist/services/update-service.js +749 -0
- package/dist/services/update-service.js.map +1 -0
- package/dist/services/verifier.d.ts +113 -0
- package/dist/services/verifier.d.ts.map +1 -0
- package/dist/services/verifier.js +541 -0
- package/dist/services/verifier.js.map +1 -0
- package/dist/services/workflow-manager.d.ts +277 -0
- package/dist/services/workflow-manager.d.ts.map +1 -0
- package/dist/services/workflow-manager.js +616 -0
- package/dist/services/workflow-manager.js.map +1 -0
- package/dist/services/workflow-orchestrator.d.ts +148 -0
- package/dist/services/workflow-orchestrator.d.ts.map +1 -0
- package/dist/services/workflow-orchestrator.js +617 -0
- package/dist/services/workflow-orchestrator.js.map +1 -0
- package/dist/services/worktree-manager.d.ts +36 -0
- package/dist/services/worktree-manager.d.ts.map +1 -0
- package/dist/services/worktree-manager.js +185 -0
- package/dist/services/worktree-manager.js.map +1 -0
- package/dist/templates/ascii-art.d.ts +136 -0
- package/dist/templates/ascii-art.d.ts.map +1 -0
- package/dist/templates/ascii-art.js +286 -0
- package/dist/templates/ascii-art.js.map +1 -0
- package/dist/templates/help.d.ts +186 -0
- package/dist/templates/help.d.ts.map +1 -0
- package/dist/templates/help.js +588 -0
- package/dist/templates/help.js.map +1 -0
- package/dist/templates/prompts/workflow-prompts.d.ts +9 -0
- package/dist/templates/prompts/workflow-prompts.d.ts.map +1 -0
- package/dist/templates/prompts/workflow-prompts.js +9 -0
- package/dist/templates/prompts/workflow-prompts.js.map +1 -0
- package/dist/tools/agent-tools.d.ts +9 -0
- package/dist/tools/agent-tools.d.ts.map +1 -0
- package/dist/tools/agent-tools.js +349 -0
- package/dist/tools/agent-tools.js.map +1 -0
- package/dist/tools/edit-replacers.d.ts +90 -0
- package/dist/tools/edit-replacers.d.ts.map +1 -0
- package/dist/tools/edit-replacers.js +553 -0
- package/dist/tools/edit-replacers.js.map +1 -0
- package/dist/tools/file-tools.d.ts +13 -0
- package/dist/tools/file-tools.d.ts.map +1 -0
- package/dist/tools/file-tools.js +954 -0
- package/dist/tools/file-tools.js.map +1 -0
- package/dist/tools/git-tools.d.ts +9 -0
- package/dist/tools/git-tools.d.ts.map +1 -0
- package/dist/tools/git-tools.js +261 -0
- package/dist/tools/git-tools.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +70 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/network-tools.d.ts +8 -0
- package/dist/tools/network-tools.d.ts.map +1 -0
- package/dist/tools/network-tools.js +261 -0
- package/dist/tools/network-tools.js.map +1 -0
- package/dist/tools/openai-tools.d.ts +16 -0
- package/dist/tools/openai-tools.d.ts.map +1 -0
- package/dist/tools/openai-tools.js +385 -0
- package/dist/tools/openai-tools.js.map +1 -0
- package/dist/tools/plan-tools.d.ts +9 -0
- package/dist/tools/plan-tools.d.ts.map +1 -0
- package/dist/tools/plan-tools.js +223 -0
- package/dist/tools/plan-tools.js.map +1 -0
- package/dist/tools/schedule-tools.d.ts +9 -0
- package/dist/tools/schedule-tools.d.ts.map +1 -0
- package/dist/tools/schedule-tools.js +405 -0
- package/dist/tools/schedule-tools.js.map +1 -0
- package/dist/tools/search-tools.d.ts +8 -0
- package/dist/tools/search-tools.d.ts.map +1 -0
- package/dist/tools/search-tools.js +357 -0
- package/dist/tools/search-tools.js.map +1 -0
- package/dist/tools/shared-utils.d.ts +91 -0
- package/dist/tools/shared-utils.d.ts.map +1 -0
- package/dist/tools/shared-utils.js +385 -0
- package/dist/tools/shared-utils.js.map +1 -0
- package/dist/tools/shell-tools.d.ts +9 -0
- package/dist/tools/shell-tools.d.ts.map +1 -0
- package/dist/tools/shell-tools.js +409 -0
- package/dist/tools/shell-tools.js.map +1 -0
- package/dist/tools/skill-tools.d.ts +13 -0
- package/dist/tools/skill-tools.d.ts.map +1 -0
- package/dist/tools/skill-tools.js +244 -0
- package/dist/tools/skill-tools.js.map +1 -0
- package/dist/tools/swarm-tools.d.ts +9 -0
- package/dist/tools/swarm-tools.d.ts.map +1 -0
- package/dist/tools/swarm-tools.js +422 -0
- package/dist/tools/swarm-tools.js.map +1 -0
- package/dist/tools/user-tools.d.ts +13 -0
- package/dist/tools/user-tools.d.ts.map +1 -0
- package/dist/tools/user-tools.js +232 -0
- package/dist/tools/user-tools.js.map +1 -0
- package/dist/types/agent-process.d.ts +244 -0
- package/dist/types/agent-process.d.ts.map +1 -0
- package/dist/types/agent-process.js +93 -0
- package/dist/types/agent-process.js.map +1 -0
- package/dist/types/agent.d.ts +358 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +171 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/anthropic.d.ts +438 -0
- package/dist/types/anthropic.d.ts.map +1 -0
- package/dist/types/anthropic.js +9 -0
- package/dist/types/anthropic.js.map +1 -0
- package/dist/types/approval.d.ts +332 -0
- package/dist/types/approval.d.ts.map +1 -0
- package/dist/types/approval.js +44 -0
- package/dist/types/approval.js.map +1 -0
- package/dist/types/autocomplete.d.ts +57 -0
- package/dist/types/autocomplete.d.ts.map +1 -0
- package/dist/types/autocomplete.js +7 -0
- package/dist/types/autocomplete.js.map +1 -0
- package/dist/types/chat-archive.d.ts +161 -0
- package/dist/types/chat-archive.d.ts.map +1 -0
- package/dist/types/chat-archive.js +36 -0
- package/dist/types/chat-archive.js.map +1 -0
- package/dist/types/config.d.ts +268 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +188 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/consent.d.ts +191 -0
- package/dist/types/consent.d.ts.map +1 -0
- package/dist/types/consent.js +119 -0
- package/dist/types/consent.js.map +1 -0
- package/dist/types/custom-command.d.ts +139 -0
- package/dist/types/custom-command.d.ts.map +1 -0
- package/dist/types/custom-command.js +7 -0
- package/dist/types/custom-command.js.map +1 -0
- package/dist/types/git.d.ts +20 -0
- package/dist/types/git.d.ts.map +1 -0
- package/dist/types/git.js +2 -0
- package/dist/types/git.js.map +1 -0
- package/dist/types/hook.d.ts +342 -0
- package/dist/types/hook.d.ts.map +1 -0
- package/dist/types/hook.js +84 -0
- package/dist/types/hook.js.map +1 -0
- package/dist/types/index.d.ts +86 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +71 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/mcp.d.ts +456 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +94 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/types/rating.d.ts +110 -0
- package/dist/types/rating.d.ts.map +1 -0
- package/dist/types/rating.js +53 -0
- package/dist/types/rating.js.map +1 -0
- package/dist/types/schedule.d.ts +91 -0
- package/dist/types/schedule.d.ts.map +1 -0
- package/dist/types/schedule.js +8 -0
- package/dist/types/schedule.js.map +1 -0
- package/dist/types/session.d.ts +361 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/session.js +9 -0
- package/dist/types/session.js.map +1 -0
- package/dist/types/skill.d.ts +258 -0
- package/dist/types/skill.d.ts.map +1 -0
- package/dist/types/skill.js +79 -0
- package/dist/types/skill.js.map +1 -0
- package/dist/types/statusline.d.ts +212 -0
- package/dist/types/statusline.d.ts.map +1 -0
- package/dist/types/statusline.js +8 -0
- package/dist/types/statusline.js.map +1 -0
- package/dist/types/stream.d.ts +61 -0
- package/dist/types/stream.d.ts.map +1 -0
- package/dist/types/stream.js +17 -0
- package/dist/types/stream.js.map +1 -0
- package/dist/types/swarm.d.ts +132 -0
- package/dist/types/swarm.d.ts.map +1 -0
- package/dist/types/swarm.js +21 -0
- package/dist/types/swarm.js.map +1 -0
- package/dist/types/token-limits.d.ts +107 -0
- package/dist/types/token-limits.d.ts.map +1 -0
- package/dist/types/token-limits.js +57 -0
- package/dist/types/token-limits.js.map +1 -0
- package/dist/types/token.d.ts +329 -0
- package/dist/types/token.d.ts.map +1 -0
- package/dist/types/token.js +9 -0
- package/dist/types/token.js.map +1 -0
- package/dist/types/update.d.ts +189 -0
- package/dist/types/update.d.ts.map +1 -0
- package/dist/types/update.js +55 -0
- package/dist/types/update.js.map +1 -0
- package/dist/types/workflow.d.ts +396 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/types/workflow.js +46 -0
- package/dist/types/workflow.js.map +1 -0
- package/dist/ui/App.d.ts +62 -0
- package/dist/ui/App.d.ts.map +1 -0
- package/dist/ui/App.js +511 -0
- package/dist/ui/App.js.map +1 -0
- package/dist/ui/InteractiveSession.d.ts +34 -0
- package/dist/ui/InteractiveSession.d.ts.map +1 -0
- package/dist/ui/InteractiveSession.js +3611 -0
- package/dist/ui/InteractiveSession.js.map +1 -0
- package/dist/ui/MCPApprovalPrompt.d.ts +27 -0
- package/dist/ui/MCPApprovalPrompt.d.ts.map +1 -0
- package/dist/ui/MCPApprovalPrompt.js +51 -0
- package/dist/ui/MCPApprovalPrompt.js.map +1 -0
- package/dist/ui/SetupWizard.d.ts +26 -0
- package/dist/ui/SetupWizard.d.ts.map +1 -0
- package/dist/ui/SetupWizard.js +396 -0
- package/dist/ui/SetupWizard.js.map +1 -0
- package/dist/ui/components/AgentCreationWizard.d.ts +36 -0
- package/dist/ui/components/AgentCreationWizard.d.ts.map +1 -0
- package/dist/ui/components/AgentCreationWizard.js +619 -0
- package/dist/ui/components/AgentCreationWizard.js.map +1 -0
- package/dist/ui/components/AgentManager.d.ts +41 -0
- package/dist/ui/components/AgentManager.d.ts.map +1 -0
- package/dist/ui/components/AgentManager.js +343 -0
- package/dist/ui/components/AgentManager.js.map +1 -0
- package/dist/ui/components/ApprovalDialog.d.ts +18 -0
- package/dist/ui/components/ApprovalDialog.d.ts.map +1 -0
- package/dist/ui/components/ApprovalDialog.js +439 -0
- package/dist/ui/components/ApprovalDialog.js.map +1 -0
- package/dist/ui/components/AsciiArt.d.ts +54 -0
- package/dist/ui/components/AsciiArt.d.ts.map +1 -0
- package/dist/ui/components/AsciiArt.js +89 -0
- package/dist/ui/components/AsciiArt.js.map +1 -0
- package/dist/ui/components/ClarificationWizard.d.ts +36 -0
- package/dist/ui/components/ClarificationWizard.d.ts.map +1 -0
- package/dist/ui/components/ClarificationWizard.js +407 -0
- package/dist/ui/components/ClarificationWizard.js.map +1 -0
- package/dist/ui/components/CompassSpinner.d.ts +15 -0
- package/dist/ui/components/CompassSpinner.d.ts.map +1 -0
- package/dist/ui/components/CompassSpinner.js +50 -0
- package/dist/ui/components/CompassSpinner.js.map +1 -0
- package/dist/ui/components/ConfirmationSelector.d.ts +45 -0
- package/dist/ui/components/ConfirmationSelector.d.ts.map +1 -0
- package/dist/ui/components/ConfirmationSelector.js +106 -0
- package/dist/ui/components/ConfirmationSelector.js.map +1 -0
- package/dist/ui/components/ContextUsage.d.ts +76 -0
- package/dist/ui/components/ContextUsage.d.ts.map +1 -0
- package/dist/ui/components/ContextUsage.js +188 -0
- package/dist/ui/components/ContextUsage.js.map +1 -0
- package/dist/ui/components/DiffPreview.d.ts +13 -0
- package/dist/ui/components/DiffPreview.d.ts.map +1 -0
- package/dist/ui/components/DiffPreview.js +30 -0
- package/dist/ui/components/DiffPreview.js.map +1 -0
- package/dist/ui/components/ExecutionModeSelector.d.ts +45 -0
- package/dist/ui/components/ExecutionModeSelector.d.ts.map +1 -0
- package/dist/ui/components/ExecutionModeSelector.js +120 -0
- package/dist/ui/components/ExecutionModeSelector.js.map +1 -0
- package/dist/ui/components/FileTree.d.ts +47 -0
- package/dist/ui/components/FileTree.d.ts.map +1 -0
- package/dist/ui/components/FileTree.js +258 -0
- package/dist/ui/components/FileTree.js.map +1 -0
- package/dist/ui/components/HelpMenu.d.ts +49 -0
- package/dist/ui/components/HelpMenu.d.ts.map +1 -0
- package/dist/ui/components/HelpMenu.js +91 -0
- package/dist/ui/components/HelpMenu.js.map +1 -0
- package/dist/ui/components/InterleavedStream.d.ts +42 -0
- package/dist/ui/components/InterleavedStream.d.ts.map +1 -0
- package/dist/ui/components/InterleavedStream.js +1500 -0
- package/dist/ui/components/InterleavedStream.js.map +1 -0
- package/dist/ui/components/ModelSelector.d.ts +81 -0
- package/dist/ui/components/ModelSelector.d.ts.map +1 -0
- package/dist/ui/components/ModelSelector.js +305 -0
- package/dist/ui/components/ModelSelector.js.map +1 -0
- package/dist/ui/components/PlanApprovalDialog.d.ts +21 -0
- package/dist/ui/components/PlanApprovalDialog.d.ts.map +1 -0
- package/dist/ui/components/PlanApprovalDialog.js +189 -0
- package/dist/ui/components/PlanApprovalDialog.js.map +1 -0
- package/dist/ui/components/PlanExecutionTracker.d.ts +53 -0
- package/dist/ui/components/PlanExecutionTracker.d.ts.map +1 -0
- package/dist/ui/components/PlanExecutionTracker.js +113 -0
- package/dist/ui/components/PlanExecutionTracker.js.map +1 -0
- package/dist/ui/components/ProgressIndicator.d.ts +151 -0
- package/dist/ui/components/ProgressIndicator.d.ts.map +1 -0
- package/dist/ui/components/ProgressIndicator.js +171 -0
- package/dist/ui/components/ProgressIndicator.js.map +1 -0
- package/dist/ui/components/Prompt.d.ts +47 -0
- package/dist/ui/components/Prompt.d.ts.map +1 -0
- package/dist/ui/components/Prompt.js +632 -0
- package/dist/ui/components/Prompt.js.map +1 -0
- package/dist/ui/components/RatingPanel.d.ts +45 -0
- package/dist/ui/components/RatingPanel.d.ts.map +1 -0
- package/dist/ui/components/RatingPanel.js +119 -0
- package/dist/ui/components/RatingPanel.js.map +1 -0
- package/dist/ui/components/StatusLine.d.ts +43 -0
- package/dist/ui/components/StatusLine.d.ts.map +1 -0
- package/dist/ui/components/StatusLine.js +44 -0
- package/dist/ui/components/StatusLine.js.map +1 -0
- package/dist/ui/components/StreamingResponse.d.ts +45 -0
- package/dist/ui/components/StreamingResponse.d.ts.map +1 -0
- package/dist/ui/components/StreamingResponse.js +56 -0
- package/dist/ui/components/StreamingResponse.js.map +1 -0
- package/dist/ui/components/TokenUsage.d.ts +89 -0
- package/dist/ui/components/TokenUsage.d.ts.map +1 -0
- package/dist/ui/components/TokenUsage.js +99 -0
- package/dist/ui/components/TokenUsage.js.map +1 -0
- package/dist/ui/components/ToolSummary.d.ts +77 -0
- package/dist/ui/components/ToolSummary.d.ts.map +1 -0
- package/dist/ui/components/ToolSummary.js +162 -0
- package/dist/ui/components/ToolSummary.js.map +1 -0
- package/dist/ui/components/UpdateNotification.d.ts +65 -0
- package/dist/ui/components/UpdateNotification.d.ts.map +1 -0
- package/dist/ui/components/UpdateNotification.js +166 -0
- package/dist/ui/components/UpdateNotification.js.map +1 -0
- package/dist/ui/diff-renderer.d.ts +18 -0
- package/dist/ui/diff-renderer.d.ts.map +1 -0
- package/dist/ui/diff-renderer.js +206 -0
- package/dist/ui/diff-renderer.js.map +1 -0
- package/dist/ui/themes/markdown-theme.d.ts +48 -0
- package/dist/ui/themes/markdown-theme.d.ts.map +1 -0
- package/dist/ui/themes/markdown-theme.js +79 -0
- package/dist/ui/themes/markdown-theme.js.map +1 -0
- package/dist/ui/themes/ui-theme.d.ts +301 -0
- package/dist/ui/themes/ui-theme.d.ts.map +1 -0
- package/dist/ui/themes/ui-theme.js +204 -0
- package/dist/ui/themes/ui-theme.js.map +1 -0
- package/dist/utils/attachment-handler.d.ts +129 -0
- package/dist/utils/attachment-handler.d.ts.map +1 -0
- package/dist/utils/attachment-handler.js +280 -0
- package/dist/utils/attachment-handler.js.map +1 -0
- package/dist/utils/backup-cleanup.d.ts +28 -0
- package/dist/utils/backup-cleanup.d.ts.map +1 -0
- package/dist/utils/backup-cleanup.js +99 -0
- package/dist/utils/backup-cleanup.js.map +1 -0
- package/dist/utils/clipboard-handler.d.ts +82 -0
- package/dist/utils/clipboard-handler.d.ts.map +1 -0
- package/dist/utils/clipboard-handler.js +311 -0
- package/dist/utils/clipboard-handler.js.map +1 -0
- package/dist/utils/cloud-detection.d.ts +14 -0
- package/dist/utils/cloud-detection.d.ts.map +1 -0
- package/dist/utils/cloud-detection.js +92 -0
- package/dist/utils/cloud-detection.js.map +1 -0
- package/dist/utils/command-parser.d.ts +56 -0
- package/dist/utils/command-parser.d.ts.map +1 -0
- package/dist/utils/command-parser.js +206 -0
- package/dist/utils/command-parser.js.map +1 -0
- package/dist/utils/console-capture.d.ts +30 -0
- package/dist/utils/console-capture.d.ts.map +1 -0
- package/dist/utils/console-capture.js +88 -0
- package/dist/utils/console-capture.js.map +1 -0
- package/dist/utils/cron-parser.d.ts +52 -0
- package/dist/utils/cron-parser.d.ts.map +1 -0
- package/dist/utils/cron-parser.js +455 -0
- package/dist/utils/cron-parser.js.map +1 -0
- package/dist/utils/crypto.d.ts +351 -0
- package/dist/utils/crypto.d.ts.map +1 -0
- package/dist/utils/crypto.js +615 -0
- package/dist/utils/crypto.js.map +1 -0
- package/dist/utils/diff.d.ts +311 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +566 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/editor.d.ts +12 -0
- package/dist/utils/editor.d.ts.map +1 -0
- package/dist/utils/editor.js +30 -0
- package/dist/utils/editor.js.map +1 -0
- package/dist/utils/file-system.d.ts +512 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +798 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils/format.d.ts +318 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +587 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/ignore-patterns.d.ts +93 -0
- package/dist/utils/ignore-patterns.d.ts.map +1 -0
- package/dist/utils/ignore-patterns.js +710 -0
- package/dist/utils/ignore-patterns.js.map +1 -0
- package/dist/utils/log-cleanup.d.ts +16 -0
- package/dist/utils/log-cleanup.d.ts.map +1 -0
- package/dist/utils/log-cleanup.js +51 -0
- package/dist/utils/log-cleanup.js.map +1 -0
- package/dist/utils/logger.d.ts +305 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +447 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/path.d.ts +406 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +549 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/schedule-file.d.ts +63 -0
- package/dist/utils/schedule-file.d.ts.map +1 -0
- package/dist/utils/schedule-file.js +244 -0
- package/dist/utils/schedule-file.js.map +1 -0
- package/dist/utils/task-id.d.ts +29 -0
- package/dist/utils/task-id.d.ts.map +1 -0
- package/dist/utils/task-id.js +53 -0
- package/dist/utils/task-id.js.map +1 -0
- package/dist/utils/temp-cleanup.d.ts +46 -0
- package/dist/utils/temp-cleanup.d.ts.map +1 -0
- package/dist/utils/temp-cleanup.js +95 -0
- package/dist/utils/temp-cleanup.js.map +1 -0
- package/dist/utils/terminal-output.d.ts +34 -0
- package/dist/utils/terminal-output.d.ts.map +1 -0
- package/dist/utils/terminal-output.js +40 -0
- package/dist/utils/terminal-output.js.map +1 -0
- package/dist/utils/token-counter.d.ts +224 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +332 -0
- package/dist/utils/token-counter.js.map +1 -0
- package/dist/utils/tool-mapper.d.ts +70 -0
- package/dist/utils/tool-mapper.d.ts.map +1 -0
- package/dist/utils/tool-mapper.js +234 -0
- package/dist/utils/tool-mapper.js.map +1 -0
- package/package.json +2 -1
- package/scripts/preuninstall.mjs +99 -0
|
@@ -0,0 +1,1500 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* React/ink component for rendering interleaved text and tool calls
|
|
4
|
+
* in Claude Code CLI style format.
|
|
5
|
+
*
|
|
6
|
+
* Example output:
|
|
7
|
+
* ```
|
|
8
|
+
* ● I'll first look at an existing ADR to understand the format...
|
|
9
|
+
*
|
|
10
|
+
* ● Read(file_path: "docs/adr/adr007.md")
|
|
11
|
+
* ⎿ Read 473 lines
|
|
12
|
+
*
|
|
13
|
+
* ● Search(pattern: "**\/*.ts")
|
|
14
|
+
* ⎿ Found 8 files
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { Box, Text } from 'ink';
|
|
19
|
+
import { marked } from 'marked';
|
|
20
|
+
import cliTruncate from 'cli-truncate';
|
|
21
|
+
import { createMarkdownRenderer } from '../themes/markdown-theme.js';
|
|
22
|
+
import { truncate, formatCompactNumber } from '../../utils/format.js';
|
|
23
|
+
import { getToolRegistry } from '../../services/tool-registry.js';
|
|
24
|
+
import { getSessionManager } from '../../services/session-manager.js';
|
|
25
|
+
import { getRelativePath, isPathWithin } from '../../utils/path.js';
|
|
26
|
+
/**
|
|
27
|
+
* Static activity indicator using empty circle.
|
|
28
|
+
* No animation to prevent layout bouncing from re-renders.
|
|
29
|
+
*/
|
|
30
|
+
const ActivityDot = ({ color = 'cyan' }) => {
|
|
31
|
+
return _jsx(Text, { color: color, children: "\u25CB" });
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Word-wraps text to fit within a given width, breaking at word boundaries.
|
|
35
|
+
* Returns an array of lines. Sentences that start after a period get their own line
|
|
36
|
+
* when possible for improved readability.
|
|
37
|
+
*/
|
|
38
|
+
function wordWrap(text, maxWidth) {
|
|
39
|
+
if (maxWidth <= 0 || !text)
|
|
40
|
+
return [text];
|
|
41
|
+
// Split into sentences (at ". " boundaries) for intelligent breaking
|
|
42
|
+
const sentences = text.split(/(?<=\.)\s+/);
|
|
43
|
+
const lines = [];
|
|
44
|
+
let currentLine = '';
|
|
45
|
+
for (const sentence of sentences) {
|
|
46
|
+
// If adding this sentence would exceed width, start a new line
|
|
47
|
+
if (currentLine && (currentLine.length + 1 + sentence.length > maxWidth)) {
|
|
48
|
+
// If the current line is non-empty, push it
|
|
49
|
+
if (currentLine) {
|
|
50
|
+
lines.push(currentLine);
|
|
51
|
+
currentLine = '';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// If the sentence itself is longer than maxWidth, do word-level wrapping
|
|
55
|
+
if (sentence.length > maxWidth) {
|
|
56
|
+
const words = sentence.split(' ');
|
|
57
|
+
for (const word of words) {
|
|
58
|
+
if (!currentLine) {
|
|
59
|
+
currentLine = word;
|
|
60
|
+
}
|
|
61
|
+
else if (currentLine.length + 1 + word.length <= maxWidth) {
|
|
62
|
+
currentLine += ' ' + word;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
lines.push(currentLine);
|
|
66
|
+
currentLine = word;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
if (!currentLine) {
|
|
72
|
+
currentLine = sentence;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
currentLine += ' ' + sentence;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (currentLine) {
|
|
80
|
+
lines.push(currentLine);
|
|
81
|
+
}
|
|
82
|
+
return lines.length > 0 ? lines : [text];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Converts an absolute file path to a relative path for display.
|
|
86
|
+
* Returns the original path if it's not within the project root or already relative.
|
|
87
|
+
*/
|
|
88
|
+
function makePathRelative(filePath) {
|
|
89
|
+
// Skip if already relative
|
|
90
|
+
if (!filePath || (!filePath.startsWith('/') && !filePath.match(/^[A-Za-z]:\\/))) {
|
|
91
|
+
return filePath;
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
const projectRoot = getSessionManager().getProjectRoot();
|
|
95
|
+
if (projectRoot && isPathWithin(filePath, projectRoot)) {
|
|
96
|
+
const relativePath = getRelativePath(filePath, projectRoot);
|
|
97
|
+
// Return relative path, or '.' if it's the root itself
|
|
98
|
+
return relativePath || '.';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// If session manager not available, return original path
|
|
103
|
+
}
|
|
104
|
+
return filePath;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Map of tool names to their essential display parameters.
|
|
108
|
+
* Tools listed here will only show the specified parameters in the UI.
|
|
109
|
+
* Tools not in this map will show all parameters.
|
|
110
|
+
*/
|
|
111
|
+
const TOOL_DISPLAY_PARAMS = {
|
|
112
|
+
// File tools - only show path
|
|
113
|
+
read: ['file_path', 'path'],
|
|
114
|
+
read_file: ['file_path', 'path'],
|
|
115
|
+
write: ['file_path', 'path'],
|
|
116
|
+
write_file: ['file_path', 'path'],
|
|
117
|
+
edit: ['file_path', 'path'],
|
|
118
|
+
edit_file: ['file_path', 'path'],
|
|
119
|
+
delete: ['description'],
|
|
120
|
+
delete_file: ['description'],
|
|
121
|
+
create_directory: ['path'],
|
|
122
|
+
get_file_info: ['path'],
|
|
123
|
+
// Read multiple - handled specially, but define to filter params
|
|
124
|
+
read_multiple_files: ['paths'],
|
|
125
|
+
// Search tools - show pattern and path
|
|
126
|
+
glob: ['pattern', 'path'],
|
|
127
|
+
grep: ['pattern', 'path'],
|
|
128
|
+
search: ['pattern', 'path'],
|
|
129
|
+
// List tool - show pattern if present, otherwise path
|
|
130
|
+
list: ['pattern', 'path'],
|
|
131
|
+
list_directory: ['pattern', 'path'],
|
|
132
|
+
// Shell tools - show description in header, command shown separately
|
|
133
|
+
bash: ['description'],
|
|
134
|
+
shell: ['description'],
|
|
135
|
+
execute: ['description'],
|
|
136
|
+
execute_command: ['description'],
|
|
137
|
+
// Plan tools - only show task summary / modification request
|
|
138
|
+
plan: ['task_summary'],
|
|
139
|
+
update_plan: ['modification_request'],
|
|
140
|
+
complete_plan_task: ['task_id', 'summary'],
|
|
141
|
+
// Agent tools - only show task (agent type shown in display name)
|
|
142
|
+
spawn_task: ['task'],
|
|
143
|
+
task: ['prompt'],
|
|
144
|
+
// Poll task - only show process_id
|
|
145
|
+
poll_task: ['process_id'],
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Map of tool names to their expected parameters (in generation order).
|
|
149
|
+
* Used to show progress during the 'generating' phase.
|
|
150
|
+
*/
|
|
151
|
+
const TOOL_EXPECTED_PARAMS = {
|
|
152
|
+
// Edit tools - typically generate path, then old content, then new content
|
|
153
|
+
edit: ['file_path', 'old_string', 'new_string'],
|
|
154
|
+
edit_file: ['file_path', 'old_string', 'new_string'],
|
|
155
|
+
// Write tools - path then content
|
|
156
|
+
write: ['file_path', 'content'],
|
|
157
|
+
write_file: ['file_path', 'content'],
|
|
158
|
+
// Read tools - just path
|
|
159
|
+
read: ['file_path'],
|
|
160
|
+
read_file: ['file_path'],
|
|
161
|
+
// Search tools
|
|
162
|
+
glob: ['pattern', 'path'],
|
|
163
|
+
grep: ['pattern', 'path'],
|
|
164
|
+
search: ['pattern', 'path'],
|
|
165
|
+
// Shell tools
|
|
166
|
+
bash: ['command', 'timeout'],
|
|
167
|
+
shell: ['command'],
|
|
168
|
+
execute: ['command'],
|
|
169
|
+
execute_command: ['command'],
|
|
170
|
+
// Task/Agent tools
|
|
171
|
+
delegate_task: ['task_description', 'context'],
|
|
172
|
+
task: ['prompt'],
|
|
173
|
+
spawn_task: ['task', 'agent_type'],
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Human-readable labels for parameter names
|
|
177
|
+
*/
|
|
178
|
+
const PARAM_LABELS = {
|
|
179
|
+
file_path: 'file path',
|
|
180
|
+
old_string: 'content to replace',
|
|
181
|
+
new_string: 'new content',
|
|
182
|
+
content: 'content',
|
|
183
|
+
pattern: 'pattern',
|
|
184
|
+
path: 'path',
|
|
185
|
+
command: 'command',
|
|
186
|
+
timeout: 'timeout',
|
|
187
|
+
task_description: 'task',
|
|
188
|
+
context: 'context',
|
|
189
|
+
prompt: 'prompt',
|
|
190
|
+
subagent_type: 'agent type',
|
|
191
|
+
agent_type: 'agent type',
|
|
192
|
+
task: 'task',
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Finds the common directory prefix from an array of file paths.
|
|
196
|
+
* Returns './' if no common prefix is found.
|
|
197
|
+
*/
|
|
198
|
+
function findCommonDirectory(paths) {
|
|
199
|
+
if (!paths || paths.length === 0)
|
|
200
|
+
return './';
|
|
201
|
+
// First make all paths relative to project root
|
|
202
|
+
const relativePaths = paths.map((p) => makePathRelative(p));
|
|
203
|
+
if (relativePaths.length === 1) {
|
|
204
|
+
const dir = relativePaths[0].replace(/\\/g, '/').split('/').slice(0, -1).join('/');
|
|
205
|
+
return dir || './';
|
|
206
|
+
}
|
|
207
|
+
// Normalize paths and split into parts
|
|
208
|
+
const normalizedPaths = relativePaths.map((p) => p.replace(/\\/g, '/'));
|
|
209
|
+
const splitPaths = normalizedPaths.map((p) => p.split('/'));
|
|
210
|
+
// Find common prefix
|
|
211
|
+
const minLength = Math.min(...splitPaths.map((p) => p.length));
|
|
212
|
+
const commonParts = [];
|
|
213
|
+
for (let i = 0; i < minLength - 1; i++) { // -1 to exclude filename
|
|
214
|
+
const part = splitPaths[0][i];
|
|
215
|
+
if (splitPaths.every((p) => p[i] === part)) {
|
|
216
|
+
commonParts.push(part);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (commonParts.length === 0)
|
|
223
|
+
return './';
|
|
224
|
+
return commonParts.join('/');
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Extracts a clean display name from an MCP tool registry name.
|
|
228
|
+
* Strips the server name prefix and shows just the tool name.
|
|
229
|
+
* Example: mcp_fetch_fetch -> "Fetch", mcp_compass_web_search -> "Web Search"
|
|
230
|
+
*/
|
|
231
|
+
function getMCPDisplayName(registryName) {
|
|
232
|
+
const lowerName = registryName.toLowerCase();
|
|
233
|
+
if (!lowerName.startsWith('mcp_')) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
const parts = registryName.substring(4).split('_'); // Remove 'mcp_' prefix
|
|
237
|
+
if (parts.length < 2) {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
// First part is server name, rest is tool name
|
|
241
|
+
const serverName = parts[0];
|
|
242
|
+
const toolParts = parts.slice(1);
|
|
243
|
+
// Capitalize each part
|
|
244
|
+
const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
|
|
245
|
+
// If server name equals tool name (e.g., mcp_fetch_fetch), just show the tool name
|
|
246
|
+
if (toolParts.length === 1 && toolParts[0].toLowerCase() === serverName.toLowerCase()) {
|
|
247
|
+
return capitalize(serverName);
|
|
248
|
+
}
|
|
249
|
+
// Otherwise show just the tool name without server prefix
|
|
250
|
+
const formattedTool = toolParts.map(capitalize).join(' ');
|
|
251
|
+
return formattedTool;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Computes the generating progress message for a tool.
|
|
255
|
+
* Shows which parameter is currently being generated and overall progress.
|
|
256
|
+
*/
|
|
257
|
+
function getGeneratingProgress(toolName, params) {
|
|
258
|
+
const toolLower = toolName.toLowerCase();
|
|
259
|
+
const expectedParams = TOOL_EXPECTED_PARAMS[toolLower];
|
|
260
|
+
if (!expectedParams) {
|
|
261
|
+
// Unknown tool - show generic message with count of received params
|
|
262
|
+
const receivedCount = Object.keys(params).length;
|
|
263
|
+
if (receivedCount === 0) {
|
|
264
|
+
return 'Preparing parameters...';
|
|
265
|
+
}
|
|
266
|
+
return `Preparing parameters (${receivedCount} received)...`;
|
|
267
|
+
}
|
|
268
|
+
const receivedParams = Object.keys(params);
|
|
269
|
+
const receivedCount = receivedParams.length;
|
|
270
|
+
const totalCount = expectedParams.length;
|
|
271
|
+
if (receivedCount === 0) {
|
|
272
|
+
// No params yet - show first expected param
|
|
273
|
+
const firstParam = expectedParams[0];
|
|
274
|
+
const label = PARAM_LABELS[firstParam] || firstParam;
|
|
275
|
+
return `Preparing ${label}...`;
|
|
276
|
+
}
|
|
277
|
+
// Find the next parameter being prepared (first expected param not yet received)
|
|
278
|
+
const nextParam = expectedParams.find((p) => !(p in params));
|
|
279
|
+
if (nextParam) {
|
|
280
|
+
const label = PARAM_LABELS[nextParam] || nextParam;
|
|
281
|
+
return `Preparing ${label} (${receivedCount}/${totalCount})...`;
|
|
282
|
+
}
|
|
283
|
+
// All expected params received, but still finalizing (maybe optional params)
|
|
284
|
+
return `Finalizing (${receivedCount}/${totalCount})...`;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Tools that should show only the value (no parameter name or quotes)
|
|
288
|
+
* These are typically file tools where showing just the path is cleaner
|
|
289
|
+
*/
|
|
290
|
+
const TOOLS_VALUE_ONLY = new Set([
|
|
291
|
+
'read', 'read_file', 'write', 'write_file', 'edit', 'edit_file', 'create_directory', 'plan',
|
|
292
|
+
'bash', 'shell', 'execute', 'execute_command', 'task', 'spawn_task', 'get_file_info',
|
|
293
|
+
'list', 'list_directory', 'update_plan', 'complete_plan_task', 'poll_task',
|
|
294
|
+
]);
|
|
295
|
+
/**
|
|
296
|
+
* Tools that should hide the result line (⎿ Done)
|
|
297
|
+
* These are simple operations where showing "Done" adds no value
|
|
298
|
+
*/
|
|
299
|
+
const TOOLS_HIDE_RESULT = new Set([
|
|
300
|
+
'create_directory',
|
|
301
|
+
'list_directory_with_sizes',
|
|
302
|
+
'git_status',
|
|
303
|
+
'git_diff',
|
|
304
|
+
'git_log',
|
|
305
|
+
'git_stage',
|
|
306
|
+
'git_commit',
|
|
307
|
+
'git_push',
|
|
308
|
+
]);
|
|
309
|
+
/**
|
|
310
|
+
* Tools that should collapse (hide) results by default
|
|
311
|
+
* Results are shown only when expanded with Ctrl+O
|
|
312
|
+
*/
|
|
313
|
+
const TOOLS_COLLAPSE_RESULT = new Set([
|
|
314
|
+
'read',
|
|
315
|
+
'read_file',
|
|
316
|
+
'read_multiple_files',
|
|
317
|
+
'grep',
|
|
318
|
+
'glob',
|
|
319
|
+
'search',
|
|
320
|
+
'task',
|
|
321
|
+
'spawn_task',
|
|
322
|
+
'delegate_task',
|
|
323
|
+
]);
|
|
324
|
+
/**
|
|
325
|
+
* Tools that should show only the quoted value (no parameter name, but with quotes)
|
|
326
|
+
* Example: SomeTool("value here") instead of SomeTool(param: "value here")
|
|
327
|
+
*/
|
|
328
|
+
const TOOLS_QUOTED_VALUE_ONLY = new Set([
|
|
329
|
+
// Currently empty - add tools here if you want quoted values without param names
|
|
330
|
+
]);
|
|
331
|
+
/**
|
|
332
|
+
* Extracts line count from a read tool result.
|
|
333
|
+
* Accepts optional pre-parsed data to avoid JSON.parse in the render path.
|
|
334
|
+
*/
|
|
335
|
+
function extractLineCount(result, parsedResult) {
|
|
336
|
+
if (!result && !parsedResult)
|
|
337
|
+
return null;
|
|
338
|
+
const data = parsedResult ?? (() => { try {
|
|
339
|
+
return JSON.parse(result);
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
return null;
|
|
343
|
+
} })();
|
|
344
|
+
if (typeof data === 'object' && data !== null && 'content' in data && typeof data.content === 'string') {
|
|
345
|
+
return data.content.split('\n').length;
|
|
346
|
+
}
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Gets the file path from a read tool block
|
|
351
|
+
*/
|
|
352
|
+
function getReadFilePath(tool) {
|
|
353
|
+
const path = tool.params.file_path || tool.params.path;
|
|
354
|
+
return typeof path === 'string' ? path : null;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Checks if a tool is a read tool
|
|
358
|
+
*/
|
|
359
|
+
function isReadTool(name) {
|
|
360
|
+
const lower = name.toLowerCase();
|
|
361
|
+
return lower === 'read' || lower === 'read_file';
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Checks if a tool is an edit tool
|
|
365
|
+
*/
|
|
366
|
+
function isEditTool(name) {
|
|
367
|
+
const lower = name.toLowerCase();
|
|
368
|
+
return lower === 'edit' || lower === 'edit_file';
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Gets the file path from an edit tool block
|
|
372
|
+
*/
|
|
373
|
+
function getEditFilePath(tool) {
|
|
374
|
+
const path = tool.params.file_path || tool.params.path;
|
|
375
|
+
return typeof path === 'string' ? path : null;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Extracts additions, deletions, and changes from an edit tool result
|
|
379
|
+
*/
|
|
380
|
+
function extractEditChanges(result, parsedResult) {
|
|
381
|
+
if (!result && !parsedResult)
|
|
382
|
+
return null;
|
|
383
|
+
const data = parsedResult ?? (() => { try {
|
|
384
|
+
return JSON.parse(result);
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
return null;
|
|
388
|
+
} })();
|
|
389
|
+
if (typeof data === 'object' && data !== null && 'success' in data && data.success === true) {
|
|
390
|
+
const obj = data;
|
|
391
|
+
const additions = typeof obj.additions === 'number' ? obj.additions : 0;
|
|
392
|
+
const deletions = typeof obj.deletions === 'number' ? obj.deletions : 0;
|
|
393
|
+
const changes = Array.isArray(obj.changes) ? obj.changes : [];
|
|
394
|
+
return { additions, deletions, changes };
|
|
395
|
+
}
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Consolidates consecutive read operations on the same file into a single display block.
|
|
400
|
+
* This reduces visual clutter when the LLM reads the same file multiple times in succession.
|
|
401
|
+
*/
|
|
402
|
+
function consolidateReadBlocks(blocks) {
|
|
403
|
+
const result = [];
|
|
404
|
+
let i = 0;
|
|
405
|
+
while (i < blocks.length) {
|
|
406
|
+
const block = blocks[i];
|
|
407
|
+
// Check if this is a completed read tool
|
|
408
|
+
if (block.type === 'tool' && isReadTool(block.name) &&
|
|
409
|
+
(block.status === 'success' || block.status === 'error')) {
|
|
410
|
+
const filePath = getReadFilePath(block);
|
|
411
|
+
if (filePath) {
|
|
412
|
+
// Look ahead for consecutive reads of the same file
|
|
413
|
+
const consecutiveReads = [block];
|
|
414
|
+
let j = i + 1;
|
|
415
|
+
while (j < blocks.length) {
|
|
416
|
+
const nextBlock = blocks[j];
|
|
417
|
+
if (nextBlock.type === 'tool' && isReadTool(nextBlock.name) &&
|
|
418
|
+
(nextBlock.status === 'success' || nextBlock.status === 'error') &&
|
|
419
|
+
getReadFilePath(nextBlock) === filePath) {
|
|
420
|
+
consecutiveReads.push(nextBlock);
|
|
421
|
+
j++;
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
// If we found multiple consecutive reads, consolidate them
|
|
428
|
+
if (consecutiveReads.length > 1) {
|
|
429
|
+
const durations = [];
|
|
430
|
+
const lineCounts = [];
|
|
431
|
+
let hasError = false;
|
|
432
|
+
let errorMsg;
|
|
433
|
+
for (const read of consecutiveReads) {
|
|
434
|
+
if (read.duration_ms !== undefined) {
|
|
435
|
+
durations.push(read.duration_ms);
|
|
436
|
+
}
|
|
437
|
+
const lineCount = extractLineCount(read.result, read.parsedResult);
|
|
438
|
+
if (lineCount !== null) {
|
|
439
|
+
lineCounts.push(lineCount);
|
|
440
|
+
}
|
|
441
|
+
if (read.status === 'error') {
|
|
442
|
+
hasError = true;
|
|
443
|
+
errorMsg = read.error;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
result.push({
|
|
447
|
+
type: 'consolidated_read',
|
|
448
|
+
filePath,
|
|
449
|
+
durations,
|
|
450
|
+
lineCounts,
|
|
451
|
+
status: hasError ? 'error' : 'success',
|
|
452
|
+
error: errorMsg,
|
|
453
|
+
originalBlocks: consecutiveReads,
|
|
454
|
+
});
|
|
455
|
+
i = j;
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
// Not a read tool or single read - add as-is
|
|
461
|
+
result.push(block);
|
|
462
|
+
i++;
|
|
463
|
+
}
|
|
464
|
+
return result;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Consolidates consecutive edit operations on the same file into a single display block.
|
|
468
|
+
* This reduces visual clutter when the LLM edits the same file multiple times in succession.
|
|
469
|
+
*/
|
|
470
|
+
function consolidateEditBlocks(blocks) {
|
|
471
|
+
const result = [];
|
|
472
|
+
let i = 0;
|
|
473
|
+
while (i < blocks.length) {
|
|
474
|
+
const block = blocks[i];
|
|
475
|
+
// Check if this is a completed edit tool
|
|
476
|
+
if (block.type === 'tool' && isEditTool(block.name) &&
|
|
477
|
+
(block.status === 'success' || block.status === 'error')) {
|
|
478
|
+
const filePath = getEditFilePath(block);
|
|
479
|
+
if (filePath) {
|
|
480
|
+
// Look ahead for consecutive edits of the same file
|
|
481
|
+
const consecutiveEdits = [block];
|
|
482
|
+
let j = i + 1;
|
|
483
|
+
while (j < blocks.length) {
|
|
484
|
+
const nextBlock = blocks[j];
|
|
485
|
+
if (nextBlock.type === 'tool' && isEditTool(nextBlock.name) &&
|
|
486
|
+
(nextBlock.status === 'success' || nextBlock.status === 'error') &&
|
|
487
|
+
getEditFilePath(nextBlock) === filePath) {
|
|
488
|
+
consecutiveEdits.push(nextBlock);
|
|
489
|
+
j++;
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
// If we found multiple consecutive edits, consolidate them
|
|
496
|
+
if (consecutiveEdits.length > 1) {
|
|
497
|
+
const durations = [];
|
|
498
|
+
const additions = [];
|
|
499
|
+
const deletions = [];
|
|
500
|
+
const allChanges = [];
|
|
501
|
+
let hasError = false;
|
|
502
|
+
let errorMsg;
|
|
503
|
+
for (const edit of consecutiveEdits) {
|
|
504
|
+
if (edit.duration_ms !== undefined) {
|
|
505
|
+
durations.push(edit.duration_ms);
|
|
506
|
+
}
|
|
507
|
+
const extracted = extractEditChanges(edit.result, edit.parsedResult);
|
|
508
|
+
if (extracted !== null) {
|
|
509
|
+
additions.push(extracted.additions);
|
|
510
|
+
deletions.push(extracted.deletions);
|
|
511
|
+
allChanges.push(...extracted.changes);
|
|
512
|
+
}
|
|
513
|
+
if (edit.status === 'error') {
|
|
514
|
+
hasError = true;
|
|
515
|
+
errorMsg = edit.error;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
result.push({
|
|
519
|
+
type: 'consolidated_edit',
|
|
520
|
+
filePath,
|
|
521
|
+
durations,
|
|
522
|
+
additions,
|
|
523
|
+
deletions,
|
|
524
|
+
allChanges,
|
|
525
|
+
status: hasError ? 'error' : 'success',
|
|
526
|
+
error: errorMsg,
|
|
527
|
+
originalBlocks: consecutiveEdits,
|
|
528
|
+
});
|
|
529
|
+
i = j;
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
// Not an edit tool or single edit - add as-is
|
|
535
|
+
result.push(block);
|
|
536
|
+
i++;
|
|
537
|
+
}
|
|
538
|
+
return result;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Extracts an AgentEntry from a ToolStreamBlock for agent/task tools.
|
|
542
|
+
*/
|
|
543
|
+
function extractAgentEntry(block) {
|
|
544
|
+
const params = block.params;
|
|
545
|
+
const rawDescription = (params.task || params.prompt || params.description || '');
|
|
546
|
+
const taskDescription = rawDescription.length > 120
|
|
547
|
+
? rawDescription.slice(0, 117) + '...'
|
|
548
|
+
: rawDescription;
|
|
549
|
+
const agentType = (params.agent_type || params.subagent_type || '');
|
|
550
|
+
const agentTypeLabel = agentType
|
|
551
|
+
? agentType
|
|
552
|
+
.split(/[-_]/)
|
|
553
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
554
|
+
.join(' ')
|
|
555
|
+
: 'Task';
|
|
556
|
+
let toolCallCount;
|
|
557
|
+
let tokensUsed;
|
|
558
|
+
let resultSummary;
|
|
559
|
+
let rawResult;
|
|
560
|
+
const error = block.error;
|
|
561
|
+
if (block.result) {
|
|
562
|
+
rawResult = block.result;
|
|
563
|
+
try {
|
|
564
|
+
const resultData = block.parsedResult ?? JSON.parse(block.result);
|
|
565
|
+
if (typeof resultData === 'object' && resultData !== null) {
|
|
566
|
+
if (typeof resultData.toolCallCount === 'number') {
|
|
567
|
+
toolCallCount = resultData.toolCallCount;
|
|
568
|
+
}
|
|
569
|
+
if (resultData.usage && typeof resultData.usage === 'object') {
|
|
570
|
+
if (typeof resultData.usage.tokensUsed === 'number') {
|
|
571
|
+
tokensUsed = resultData.usage.tokensUsed;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
// Extract a short result summary
|
|
575
|
+
const content = (resultData.content || resultData.response || '');
|
|
576
|
+
if (typeof content === 'string' && content.length > 0) {
|
|
577
|
+
// Take the last non-empty line as summary
|
|
578
|
+
const lines = content.split('\n').filter((l) => l.trim().length > 0);
|
|
579
|
+
const lastLine = lines[lines.length - 1] || '';
|
|
580
|
+
resultSummary = lastLine.length > 80 ? lastLine.slice(0, 77) + '...' : lastLine;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
catch {
|
|
585
|
+
// Not JSON, use raw result
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
if (block.status === 'error') {
|
|
589
|
+
resultSummary = error || 'Error';
|
|
590
|
+
}
|
|
591
|
+
else if (block.status === 'success' && !resultSummary) {
|
|
592
|
+
resultSummary = 'Done';
|
|
593
|
+
}
|
|
594
|
+
return {
|
|
595
|
+
taskDescription,
|
|
596
|
+
agentTypeLabel,
|
|
597
|
+
toolCallCount,
|
|
598
|
+
tokensUsed,
|
|
599
|
+
resultSummary,
|
|
600
|
+
status: block.status,
|
|
601
|
+
error,
|
|
602
|
+
rawResult,
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Consolidates consecutive agent/task tool calls into a single display block.
|
|
607
|
+
* Groups 2+ consecutive agent blocks into a ConsolidatedAgentBlock.
|
|
608
|
+
*/
|
|
609
|
+
function consolidateAgentBlocks(blocks) {
|
|
610
|
+
const result = [];
|
|
611
|
+
let i = 0;
|
|
612
|
+
while (i < blocks.length) {
|
|
613
|
+
const block = blocks[i];
|
|
614
|
+
// Check if this is an agent tool (any status)
|
|
615
|
+
if (block.type === 'tool' && isAgentTool(block.name)) {
|
|
616
|
+
// Look ahead for consecutive agent blocks
|
|
617
|
+
const consecutiveAgents = [block];
|
|
618
|
+
let j = i + 1;
|
|
619
|
+
while (j < blocks.length) {
|
|
620
|
+
const nextBlock = blocks[j];
|
|
621
|
+
if (nextBlock.type === 'tool' && isAgentTool(nextBlock.name)) {
|
|
622
|
+
consecutiveAgents.push(nextBlock);
|
|
623
|
+
j++;
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
// If we found multiple consecutive agents, consolidate them
|
|
630
|
+
if (consecutiveAgents.length > 1) {
|
|
631
|
+
const agents = consecutiveAgents.map(extractAgentEntry);
|
|
632
|
+
// Compute combined status: generating > running > error/success
|
|
633
|
+
let combinedStatus = 'success';
|
|
634
|
+
for (const agent of agents) {
|
|
635
|
+
if (agent.status === 'generating') {
|
|
636
|
+
combinedStatus = 'generating';
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
if (agent.status === 'running' || agent.status === 'pending') {
|
|
640
|
+
combinedStatus = 'running';
|
|
641
|
+
}
|
|
642
|
+
if (agent.status === 'error' && combinedStatus !== 'running') {
|
|
643
|
+
combinedStatus = 'error';
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
result.push({
|
|
647
|
+
type: 'consolidated_agent',
|
|
648
|
+
agents,
|
|
649
|
+
status: combinedStatus,
|
|
650
|
+
originalBlocks: consecutiveAgents,
|
|
651
|
+
});
|
|
652
|
+
i = j;
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
// Not an agent tool or single agent - add as-is
|
|
657
|
+
result.push(block);
|
|
658
|
+
i++;
|
|
659
|
+
}
|
|
660
|
+
return result;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Formats tool parameters for display
|
|
664
|
+
* Example for file tools: src/index.ts
|
|
665
|
+
* Example for other tools: pattern: "*.tsx", path: "src"
|
|
666
|
+
*/
|
|
667
|
+
function formatParams(params, maxLength = 100, toolName) {
|
|
668
|
+
let entries = Object.entries(params);
|
|
669
|
+
if (entries.length === 0)
|
|
670
|
+
return '';
|
|
671
|
+
// Filter to essential params if tool has a display config
|
|
672
|
+
if (toolName) {
|
|
673
|
+
const toolLower = toolName.toLowerCase();
|
|
674
|
+
const essentialParams = TOOL_DISPLAY_PARAMS[toolLower];
|
|
675
|
+
if (essentialParams) {
|
|
676
|
+
entries = entries.filter(([key]) => essentialParams.includes(key));
|
|
677
|
+
}
|
|
678
|
+
// Special handling for read_multiple_files: show common directory
|
|
679
|
+
if (toolLower === 'read_multiple_files' && 'paths' in params && Array.isArray(params.paths)) {
|
|
680
|
+
const paths = params.paths;
|
|
681
|
+
const commonDir = findCommonDirectory(paths);
|
|
682
|
+
return commonDir;
|
|
683
|
+
}
|
|
684
|
+
// Special handling for List tool: show pattern if present, otherwise path
|
|
685
|
+
if ((toolLower === 'list' || toolLower === 'list_directory') && ('pattern' in params || 'path' in params)) {
|
|
686
|
+
const pattern = params.pattern;
|
|
687
|
+
const path = params.path;
|
|
688
|
+
// Prefer pattern over path for display
|
|
689
|
+
if (pattern && pattern !== '*') {
|
|
690
|
+
return pattern;
|
|
691
|
+
}
|
|
692
|
+
if (path) {
|
|
693
|
+
return makePathRelative(path);
|
|
694
|
+
}
|
|
695
|
+
return '.';
|
|
696
|
+
}
|
|
697
|
+
// Special handling for MCP fetch-like tools: only show URL
|
|
698
|
+
if (toolLower.startsWith('mcp_') && (toolLower.includes('fetch') || toolLower.includes('browse'))) {
|
|
699
|
+
if ('url' in params && typeof params.url === 'string') {
|
|
700
|
+
const url = params.url;
|
|
701
|
+
// Show just the URL, truncated if needed
|
|
702
|
+
return url.length > 70 ? truncate(url, 70) : url;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
// Special handling for MCP search-like tools: only show query
|
|
706
|
+
if (toolLower.startsWith('mcp_') && toolLower.includes('search')) {
|
|
707
|
+
entries = entries.filter(([key]) => key === 'query');
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
if (entries.length === 0)
|
|
711
|
+
return '';
|
|
712
|
+
// For file tools (Read, Write, Edit), show just the value without key/quotes
|
|
713
|
+
const toolLower = toolName?.toLowerCase() ?? '';
|
|
714
|
+
const valueOnly = TOOLS_VALUE_ONLY.has(toolLower);
|
|
715
|
+
const quotedValueOnly = TOOLS_QUOTED_VALUE_ONLY.has(toolLower);
|
|
716
|
+
// Parameters that contain file paths and should be made relative
|
|
717
|
+
const FILE_PATH_PARAMS = new Set(['file_path', 'path', 'paths']);
|
|
718
|
+
const formatted = entries
|
|
719
|
+
.map(([key, value]) => {
|
|
720
|
+
if (typeof value === 'string') {
|
|
721
|
+
// Convert file paths to relative paths for display
|
|
722
|
+
let processedValue = value;
|
|
723
|
+
if (FILE_PATH_PARAMS.has(key)) {
|
|
724
|
+
processedValue = makePathRelative(value);
|
|
725
|
+
}
|
|
726
|
+
const valueMaxLen = valueOnly ? maxLength : 70;
|
|
727
|
+
const displayValue = processedValue.length > valueMaxLen ? truncate(processedValue, valueMaxLen) : processedValue;
|
|
728
|
+
// For value-only tools, just show the value without key or quotes
|
|
729
|
+
if (valueOnly) {
|
|
730
|
+
return displayValue;
|
|
731
|
+
}
|
|
732
|
+
// For quoted-value-only tools, show the value with quotes but no key
|
|
733
|
+
if (quotedValueOnly) {
|
|
734
|
+
return `"${displayValue}"`;
|
|
735
|
+
}
|
|
736
|
+
return `${key}: "${displayValue}"`;
|
|
737
|
+
}
|
|
738
|
+
if (typeof value === 'boolean' || typeof value === 'number') {
|
|
739
|
+
return `${key}: ${value}`;
|
|
740
|
+
}
|
|
741
|
+
if (Array.isArray(value)) {
|
|
742
|
+
return `${key}: [${value.length} items]`;
|
|
743
|
+
}
|
|
744
|
+
if (value && typeof value === 'object') {
|
|
745
|
+
return `${key}: {...}`;
|
|
746
|
+
}
|
|
747
|
+
return `${key}: ${String(value)}`;
|
|
748
|
+
})
|
|
749
|
+
.join(', ');
|
|
750
|
+
return formatted.length > maxLength ? truncate(formatted, maxLength) : formatted;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Formats tool result for display based on tool name and result data
|
|
754
|
+
*/
|
|
755
|
+
function formatToolResult(name, result, error, parsedResult) {
|
|
756
|
+
if (error) {
|
|
757
|
+
// Simplify common error messages for cleaner UI display
|
|
758
|
+
if (error.startsWith('Text not found in file:')) {
|
|
759
|
+
return 'Text not found';
|
|
760
|
+
}
|
|
761
|
+
if (error.startsWith('Text is not unique:')) {
|
|
762
|
+
return 'Text is not unique';
|
|
763
|
+
}
|
|
764
|
+
if (error.startsWith('No change needed:')) {
|
|
765
|
+
return 'No change needed';
|
|
766
|
+
}
|
|
767
|
+
return error.length > 100 ? truncate(error, 100) : error;
|
|
768
|
+
}
|
|
769
|
+
if (!result)
|
|
770
|
+
return null;
|
|
771
|
+
// Use pre-parsed data if available, otherwise parse
|
|
772
|
+
let data = parsedResult;
|
|
773
|
+
if (data === undefined) {
|
|
774
|
+
try {
|
|
775
|
+
data = JSON.parse(result);
|
|
776
|
+
}
|
|
777
|
+
catch {
|
|
778
|
+
// Not JSON, use raw result
|
|
779
|
+
return result.length > 100 ? truncate(result, 100) : result;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
// Format based on tool name and result structure
|
|
783
|
+
const toolLower = name.toLowerCase();
|
|
784
|
+
if (typeof data === 'object' && data !== null) {
|
|
785
|
+
const obj = data;
|
|
786
|
+
// Read tool - show line count
|
|
787
|
+
if (toolLower === 'read' || toolLower === 'read_file') {
|
|
788
|
+
if ('content' in obj && typeof obj.content === 'string') {
|
|
789
|
+
const lines = obj.content.split('\n').length;
|
|
790
|
+
return `Read ${lines} lines`;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
// Read multiple files - handled specially in ToolBlock for list output
|
|
794
|
+
if (toolLower === 'read_multiple_files') {
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
797
|
+
// File info - show human-readable size
|
|
798
|
+
if (toolLower === 'get_file_info') {
|
|
799
|
+
if ('size' in obj && typeof obj.size === 'number') {
|
|
800
|
+
const size = obj.size;
|
|
801
|
+
if (size < 1024)
|
|
802
|
+
return `${size} bytes`;
|
|
803
|
+
if (size < 1024 * 1024)
|
|
804
|
+
return `${(size / 1024).toFixed(1)} KB`;
|
|
805
|
+
return `${(size / (1024 * 1024)).toFixed(1)} MB`;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
// Glob/Find files - show file count
|
|
809
|
+
if (toolLower === 'glob' || toolLower === 'list_files' || toolLower === 'find_files') {
|
|
810
|
+
if ('files' in obj && Array.isArray(obj.files)) {
|
|
811
|
+
const count = typeof obj.totalFound === 'number' ? obj.totalFound : obj.files.length;
|
|
812
|
+
const truncatedSuffix = obj.truncated ? '+' : '';
|
|
813
|
+
return count === 0 ? 'No files found' : `Found ${count}${truncatedSuffix} file${count === 1 ? '' : 's'}`;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
// List/list_directory - show total count
|
|
817
|
+
if (toolLower === 'list' || toolLower === 'list_directory') {
|
|
818
|
+
// Use 'total' field if available, otherwise count entries
|
|
819
|
+
const total = typeof obj.total === 'number' ? obj.total : (Array.isArray(obj.entries) ? obj.entries.length : 0);
|
|
820
|
+
return `found ${total} total`;
|
|
821
|
+
}
|
|
822
|
+
// Grep/Search - show match count
|
|
823
|
+
if (toolLower === 'grep' || toolLower === 'search' || toolLower === 'search_code') {
|
|
824
|
+
// Use matchCount for total count (before truncation), fall back to matches.length
|
|
825
|
+
if ('matchCount' in obj && typeof obj.matchCount === 'number') {
|
|
826
|
+
const count = obj.matchCount;
|
|
827
|
+
const truncatedSuffix = obj.truncated ? '+' : '';
|
|
828
|
+
return count === 0 ? 'No matches found' : `Found ${count}${truncatedSuffix} match${count === 1 ? '' : 'es'}`;
|
|
829
|
+
}
|
|
830
|
+
if ('matches' in obj && Array.isArray(obj.matches)) {
|
|
831
|
+
const count = obj.matches.length;
|
|
832
|
+
return count === 0 ? 'No matches found' : `Found ${count} match${count === 1 ? '' : 'es'}`;
|
|
833
|
+
}
|
|
834
|
+
if ('count' in obj && typeof obj.count === 'number') {
|
|
835
|
+
const count = obj.count;
|
|
836
|
+
return count === 0 ? 'No matches found' : `Found ${count} match${count === 1 ? '' : 'es'}`;
|
|
837
|
+
}
|
|
838
|
+
if ('files' in obj && Array.isArray(obj.files)) {
|
|
839
|
+
const count = obj.files.length;
|
|
840
|
+
return count === 0 ? 'No files found' : `Found ${count} file${count === 1 ? '' : 's'}`;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
// Bash/Shell - show exit code and output lines
|
|
844
|
+
if (toolLower === 'bash' || toolLower === 'shell' || toolLower === 'execute' || toolLower === 'execute_command') {
|
|
845
|
+
// Check for timeout first
|
|
846
|
+
if (obj.timedOut === true || obj.timed_out === true) {
|
|
847
|
+
return '(timeout)';
|
|
848
|
+
}
|
|
849
|
+
if ('exitCode' in obj || 'exit_code' in obj) {
|
|
850
|
+
const code = obj.exitCode ?? obj.exit_code ?? 0;
|
|
851
|
+
const stdout = obj.stdout ?? obj.output ?? '';
|
|
852
|
+
if (typeof stdout === 'string' && stdout.length > 0) {
|
|
853
|
+
const lines = stdout.split('\n').filter(Boolean).length;
|
|
854
|
+
return code === 0 ? `Ran successfully (${lines} lines)` : `Exit code ${code}`;
|
|
855
|
+
}
|
|
856
|
+
return code === 0 ? 'Ran successfully' : `Exit code ${code}`;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
// Edit - handled specially in ToolBlock for colored output
|
|
860
|
+
if (toolLower === 'edit' || toolLower === 'edit_file') {
|
|
861
|
+
// Return null to let ToolBlock render the colored version
|
|
862
|
+
return null;
|
|
863
|
+
}
|
|
864
|
+
// Write - show success with line count and size
|
|
865
|
+
if (toolLower === 'write' || toolLower === 'write_file') {
|
|
866
|
+
if ('success' in obj && obj.success === true) {
|
|
867
|
+
const lines = typeof obj.lineCount === 'number' ? obj.lineCount : null;
|
|
868
|
+
const size = typeof obj.byteSize === 'number' ? obj.byteSize : null;
|
|
869
|
+
if (lines !== null && size !== null) {
|
|
870
|
+
const sizeStr = size < 1024 ? `${size} B` : `${(size / 1024).toFixed(1)} KB`;
|
|
871
|
+
return `Wrote ${lines} lines (${sizeStr})`;
|
|
872
|
+
}
|
|
873
|
+
if ('path' in obj && typeof obj.path === 'string') {
|
|
874
|
+
const filename = obj.path.split(/[/\\]/).pop() || obj.path;
|
|
875
|
+
return `Wrote ${filename}`;
|
|
876
|
+
}
|
|
877
|
+
return 'Done';
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
// Delete - show path in result instead of "Done"
|
|
881
|
+
if (toolLower === 'delete' || toolLower === 'delete_file') {
|
|
882
|
+
if ('success' in obj && obj.success === true && 'path' in obj && typeof obj.path === 'string') {
|
|
883
|
+
return makePathRelative(obj.path);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
// Agent/Task tools - show model, tokens, and turns (handle both flat and nested fields)
|
|
887
|
+
if (toolLower === 'task' || toolLower === 'spawn_task' || toolLower === 'delegate_task') {
|
|
888
|
+
// Check for failure first
|
|
889
|
+
if (obj.success === false) {
|
|
890
|
+
const errorMsg = typeof obj.error === 'string' ? obj.error : 'Unknown error';
|
|
891
|
+
return `Failed: ${truncate(errorMsg, 80)}`;
|
|
892
|
+
}
|
|
893
|
+
// Background spawn — agent hasn't finished yet, just spawned
|
|
894
|
+
const processStatus = typeof obj.status === 'string' ? obj.status : '';
|
|
895
|
+
if (processStatus === 'running' || processStatus === 'pending') {
|
|
896
|
+
return 'Spawned in background';
|
|
897
|
+
}
|
|
898
|
+
const usage = (typeof obj.usage === 'object' && obj.usage !== null) ? obj.usage : null;
|
|
899
|
+
// Read agentModel with fallback to agentType
|
|
900
|
+
const agentModel = typeof obj.agentModel === 'string' ? obj.agentModel
|
|
901
|
+
: typeof obj.agentType === 'string' ? obj.agentType
|
|
902
|
+
: 'unknown';
|
|
903
|
+
// Read tokensUsed from flat fields or nested usage object
|
|
904
|
+
const tokensUsed = typeof obj.tokensUsed === 'number' ? obj.tokensUsed
|
|
905
|
+
: (usage && typeof usage.tokensUsed === 'number') ? usage.tokensUsed
|
|
906
|
+
: 0;
|
|
907
|
+
// Build concise completion message
|
|
908
|
+
const parts = [`using ${agentModel}`];
|
|
909
|
+
if (tokensUsed > 0) {
|
|
910
|
+
parts.push(`${formatCompactNumber(tokensUsed)} tokens`);
|
|
911
|
+
}
|
|
912
|
+
return `Done (${parts.join(', ')})`;
|
|
913
|
+
}
|
|
914
|
+
// Check for specific error codes first (before generic success/error)
|
|
915
|
+
if ('error' in obj && typeof obj.error === 'string') {
|
|
916
|
+
if (obj.error === 'FILE_MODIFIED_EXTERNALLY') {
|
|
917
|
+
return 'File was modified externally. Please re-read before editing.';
|
|
918
|
+
}
|
|
919
|
+
// Prefer the human-readable 'message' field if available
|
|
920
|
+
if ('message' in obj && typeof obj.message === 'string') {
|
|
921
|
+
return truncate(obj.message, 100);
|
|
922
|
+
}
|
|
923
|
+
return truncate(obj.error, 100);
|
|
924
|
+
}
|
|
925
|
+
// Generic success/error handling
|
|
926
|
+
if ('success' in obj) {
|
|
927
|
+
return obj.success ? 'Done' : 'Failed';
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
// Fallback: truncate raw result
|
|
931
|
+
if (typeof result === 'string' && result.length > 0) {
|
|
932
|
+
return truncate(result, 100);
|
|
933
|
+
}
|
|
934
|
+
return 'Done';
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Renders markdown text with terminal formatting
|
|
938
|
+
*/
|
|
939
|
+
const MarkdownText = ({ children, indent = 2 }) => {
|
|
940
|
+
const rendered = React.useMemo(() => {
|
|
941
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
942
|
+
marked.setOptions({ renderer: createMarkdownRenderer() });
|
|
943
|
+
const raw = String(marked.parse(children)).trim();
|
|
944
|
+
// Truncate lines that exceed terminal width (e.g. table borders)
|
|
945
|
+
const maxWidth = Math.max(20, (process.stdout.columns || 80) - indent - 2);
|
|
946
|
+
return raw
|
|
947
|
+
.split('\n')
|
|
948
|
+
.map(line => cliTruncate(line, maxWidth, { preferTruncationOnSpace: false }))
|
|
949
|
+
.join('\n');
|
|
950
|
+
}, [children, indent]);
|
|
951
|
+
return _jsx(Text, { children: rendered });
|
|
952
|
+
};
|
|
953
|
+
/**
|
|
954
|
+
* Renders a text block with bullet point
|
|
955
|
+
* Uses orange bullet for task-progress variant (plan execution transitions)
|
|
956
|
+
*/
|
|
957
|
+
const TextBlock = ({ content, variant = 'default', }) => {
|
|
958
|
+
if (!content.trim())
|
|
959
|
+
return null;
|
|
960
|
+
// Green for task progress, white for default
|
|
961
|
+
const bulletColor = variant === 'task-progress' ? 'green' : 'white';
|
|
962
|
+
return (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: _jsxs(Box, { children: [_jsx(Text, { color: bulletColor, bold: true, children: "\u25CF " }), _jsx(Box, { flexDirection: "column", flexGrow: 1, children: _jsx(MarkdownText, { children: content }) })] }) }));
|
|
963
|
+
};
|
|
964
|
+
/**
|
|
965
|
+
* Extracts file names and line counts from read_multiple_files result
|
|
966
|
+
* Returns an array of file info (name + line count) and error info
|
|
967
|
+
*/
|
|
968
|
+
function getReadMultipleFiles(result, parsedResult) {
|
|
969
|
+
if (!result && !parsedResult)
|
|
970
|
+
return null;
|
|
971
|
+
try {
|
|
972
|
+
const data = parsedResult ?? JSON.parse(result);
|
|
973
|
+
if (typeof data === 'object' && data !== null && 'files' in data && Array.isArray(data.files)) {
|
|
974
|
+
const files = [];
|
|
975
|
+
const errors = [];
|
|
976
|
+
for (const file of data.files) {
|
|
977
|
+
if (typeof file === 'object' && file !== null && 'path' in file) {
|
|
978
|
+
const path = String(file.path);
|
|
979
|
+
// Extract just the filename from the path
|
|
980
|
+
const fileName = path.replace(/\\/g, '/').split('/').pop() || path;
|
|
981
|
+
if (file.error) {
|
|
982
|
+
errors.push(`${fileName}: ${file.error}`);
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
const lineCount = typeof file.content === 'string'
|
|
986
|
+
? file.content.split('\n').length
|
|
987
|
+
: 0;
|
|
988
|
+
files.push({ name: fileName, lineCount });
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
return { files, errors };
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
catch {
|
|
996
|
+
// Not valid JSON
|
|
997
|
+
}
|
|
998
|
+
return null;
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Extracts edit statistics from a tool result
|
|
1002
|
+
*/
|
|
1003
|
+
function getEditStats(result, parsedResult) {
|
|
1004
|
+
if (!result && !parsedResult)
|
|
1005
|
+
return null;
|
|
1006
|
+
try {
|
|
1007
|
+
const data = parsedResult ?? JSON.parse(result);
|
|
1008
|
+
if (typeof data === 'object' && data !== null) {
|
|
1009
|
+
const obj = data;
|
|
1010
|
+
if ('success' in obj && obj.success === true) {
|
|
1011
|
+
const additions = typeof obj.additions === 'number' ? obj.additions : null;
|
|
1012
|
+
const deletions = typeof obj.deletions === 'number' ? obj.deletions : null;
|
|
1013
|
+
const changes = Array.isArray(obj.changes) ? obj.changes : [];
|
|
1014
|
+
return { additions, deletions, changes };
|
|
1015
|
+
}
|
|
1016
|
+
if ('error' in obj && typeof obj.error === 'string') {
|
|
1017
|
+
const friendlyError = obj.error === 'FILE_MODIFIED_EXTERNALLY'
|
|
1018
|
+
? 'File was modified externally. Please re-read before editing.'
|
|
1019
|
+
: obj.error;
|
|
1020
|
+
return { additions: null, deletions: null, changes: [], error: friendlyError };
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
catch {
|
|
1025
|
+
// Not JSON
|
|
1026
|
+
}
|
|
1027
|
+
return null;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Renders edit result with colored additions/deletions
|
|
1031
|
+
*/
|
|
1032
|
+
const EditResultDisplay = ({ additions, deletions }) => {
|
|
1033
|
+
const hasAdditions = additions !== null && additions > 0;
|
|
1034
|
+
const hasDeletions = deletions !== null && deletions > 0;
|
|
1035
|
+
if (!hasAdditions && !hasDeletions) {
|
|
1036
|
+
return _jsx(Text, { dimColor: true, children: "No changes" });
|
|
1037
|
+
}
|
|
1038
|
+
return (_jsxs(_Fragment, { children: [hasAdditions && (_jsxs(Text, { color: "green", children: ["+", additions, " ", additions === 1 ? 'line' : 'lines'] })), hasAdditions && hasDeletions && (_jsx(Text, { dimColor: true, children: ", " })), hasDeletions && (_jsxs(Text, { color: "red", children: ["-", deletions, " ", deletions === 1 ? 'line' : 'lines'] }))] }));
|
|
1039
|
+
};
|
|
1040
|
+
/**
|
|
1041
|
+
* Renders a consolidated read block that combines multiple consecutive reads of the same file.
|
|
1042
|
+
* Shows combined timing like (43+62)ms and combined lines like Read (20+40) lines
|
|
1043
|
+
*/
|
|
1044
|
+
const ConsolidatedReadBlockComponent = ({ block }) => {
|
|
1045
|
+
const { filePath, durations, lineCounts, status, error } = block;
|
|
1046
|
+
// Format the relative file path for display
|
|
1047
|
+
const displayPath = makePathRelative(filePath);
|
|
1048
|
+
// Format combined duration: sum all durations and display total
|
|
1049
|
+
const formatCombinedDuration = () => {
|
|
1050
|
+
if (durations.length === 0)
|
|
1051
|
+
return '';
|
|
1052
|
+
const totalMs = durations.reduce((sum, d) => sum + d, 0);
|
|
1053
|
+
return formatDuration(totalMs);
|
|
1054
|
+
};
|
|
1055
|
+
// Format combined line counts: sum all lines and display total
|
|
1056
|
+
const formatCombinedLines = () => {
|
|
1057
|
+
if (lineCounts.length === 0)
|
|
1058
|
+
return 'Read file';
|
|
1059
|
+
const totalLines = lineCounts.reduce((sum, l) => sum + l, 0);
|
|
1060
|
+
return `Read ${totalLines} lines`;
|
|
1061
|
+
};
|
|
1062
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: status === 'error' ? 'red' : 'cyan', children: "\u25CF" }), _jsx(Text, { children: " " }), _jsx(Text, { color: status === 'error' ? 'red' : 'cyan', children: "Read" }), _jsxs(Text, { dimColor: true, children: ["(", displayPath, ")"] }), _jsxs(Text, { dimColor: true, children: [" ", formatCombinedDuration()] })] }), _jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), error ? (_jsx(Text, { color: "red", children: truncate(error, 100) })) : (_jsx(Text, { children: formatCombinedLines() }))] })] }));
|
|
1063
|
+
};
|
|
1064
|
+
/**
|
|
1065
|
+
* Constants for edit diff display
|
|
1066
|
+
*/
|
|
1067
|
+
const EDIT_DIFF_MAX_LINES = 20;
|
|
1068
|
+
const EDIT_DIFF_LINE_MAX_CHARS = 120;
|
|
1069
|
+
/**
|
|
1070
|
+
* Renders a consolidated edit block that combines multiple consecutive edits of the same file.
|
|
1071
|
+
* Shows combined timing and combined additions/deletions.
|
|
1072
|
+
* Supports Ctrl+O to expand and show the actual diff.
|
|
1073
|
+
*/
|
|
1074
|
+
const ConsolidatedEditBlockComponent = ({ block, expanded = false, isStatic = false }) => {
|
|
1075
|
+
const { filePath, durations, additions, deletions, allChanges, status, error } = block;
|
|
1076
|
+
// Format the relative file path for display
|
|
1077
|
+
const displayPath = makePathRelative(filePath);
|
|
1078
|
+
// Format combined duration: sum all durations and display total
|
|
1079
|
+
const formatCombinedDuration = () => {
|
|
1080
|
+
if (durations.length === 0)
|
|
1081
|
+
return '';
|
|
1082
|
+
const totalMs = durations.reduce((sum, d) => sum + d, 0);
|
|
1083
|
+
return formatDuration(totalMs);
|
|
1084
|
+
};
|
|
1085
|
+
// Calculate total additions and deletions
|
|
1086
|
+
const totalAdditions = additions.reduce((sum, a) => sum + a, 0);
|
|
1087
|
+
const totalDeletions = deletions.reduce((sum, d) => sum + d, 0);
|
|
1088
|
+
// Collect all diff lines for expanded view
|
|
1089
|
+
const diffLines = [];
|
|
1090
|
+
if (expanded && allChanges.length > 0) {
|
|
1091
|
+
for (const change of allChanges) {
|
|
1092
|
+
// Add line range info
|
|
1093
|
+
diffLines.push({ type: 'info', content: `@@ Lines ${change.lineStart}-${change.lineEnd} @@` });
|
|
1094
|
+
// Add removed lines (before)
|
|
1095
|
+
for (const line of change.before) {
|
|
1096
|
+
diffLines.push({ type: 'removed', content: line });
|
|
1097
|
+
}
|
|
1098
|
+
// Add added lines (after)
|
|
1099
|
+
for (const line of change.after) {
|
|
1100
|
+
diffLines.push({ type: 'added', content: line });
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
// Trim diff if too long
|
|
1105
|
+
const isTruncated = diffLines.length > EDIT_DIFF_MAX_LINES;
|
|
1106
|
+
const displayDiffLines = diffLines.slice(0, EDIT_DIFF_MAX_LINES);
|
|
1107
|
+
const hiddenLinesCount = diffLines.length - EDIT_DIFF_MAX_LINES;
|
|
1108
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: status === 'error' ? 'red' : 'cyan', children: "\u25CF" }), _jsx(Text, { children: " " }), _jsx(Text, { color: status === 'error' ? 'red' : 'cyan', children: "Edit" }), _jsxs(Text, { dimColor: true, children: ["(", displayPath, ")"] }), _jsxs(Text, { dimColor: true, children: [" ", formatCombinedDuration()] })] }), _jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), error ? (_jsx(Text, { color: "red", children: truncate(error, 100) })) : (_jsx(_Fragment, { children: _jsx(EditResultDisplay, { additions: totalAdditions, deletions: totalDeletions }) }))] }), (expanded || isStatic) && displayDiffLines.length > 0 && (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [displayDiffLines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), line.type === 'info' && (_jsx(Text, { color: "cyan", children: truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS) })), line.type === 'removed' && (_jsxs(Text, { color: "red", children: ["-", truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS - 1)] })), line.type === 'added' && (_jsxs(Text, { color: "green", children: ["+", truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS - 1)] }))] }, i))), isTruncated && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), _jsxs(Text, { dimColor: true, children: ["... (", hiddenLinesCount, " more lines)"] })] }))] }))] }));
|
|
1109
|
+
};
|
|
1110
|
+
/**
|
|
1111
|
+
* Renders a consolidated agent block that combines multiple consecutive parallel agent tool calls.
|
|
1112
|
+
* Displays a tree-style UI with agent descriptions, tool use counts, and token counts.
|
|
1113
|
+
*/
|
|
1114
|
+
const ConsolidatedAgentBlockComponent = ({ block, expanded = false, isStatic = false }) => {
|
|
1115
|
+
const { agents, status } = block;
|
|
1116
|
+
// Determine header label: if all agents share the same type, use that; otherwise "agents"
|
|
1117
|
+
const allSameType = agents.every(a => a.agentTypeLabel === agents[0].agentTypeLabel);
|
|
1118
|
+
const typeLabel = allSameType ? agents[0].agentTypeLabel : '';
|
|
1119
|
+
const isInProgress = status === 'generating' || status === 'running';
|
|
1120
|
+
const headerText = isInProgress
|
|
1121
|
+
? `Running ${agents.length} ${typeLabel ? typeLabel + ' ' : ''}agent${agents.length === 1 ? '' : 's'}…`
|
|
1122
|
+
: `Ran ${agents.length} ${typeLabel ? typeLabel + ' ' : ''}agent${agents.length === 1 ? '' : 's'}`;
|
|
1123
|
+
// Status color
|
|
1124
|
+
const statusColor = status === 'error' ? 'red'
|
|
1125
|
+
: isInProgress ? 'cyan'
|
|
1126
|
+
: 'cyan';
|
|
1127
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: statusColor, children: isInProgress ? '○' : '●' }), _jsx(Text, { children: " " }), _jsx(Text, { color: statusColor, children: headerText })] }), agents.map((agent, i) => {
|
|
1128
|
+
const isLast = i === agents.length - 1;
|
|
1129
|
+
const branchChar = isLast ? '└─' : '├─';
|
|
1130
|
+
const continueChar = isLast ? ' ' : '│ ';
|
|
1131
|
+
// Build metadata string: "· N tool uses · XK tokens"
|
|
1132
|
+
const metaParts = [];
|
|
1133
|
+
if (agent.toolCallCount !== undefined && agent.toolCallCount > 0) {
|
|
1134
|
+
metaParts.push(`${agent.toolCallCount} tool use${agent.toolCallCount === 1 ? '' : 's'}`);
|
|
1135
|
+
}
|
|
1136
|
+
if (agent.tokensUsed !== undefined && agent.tokensUsed > 0) {
|
|
1137
|
+
metaParts.push(`${formatCompactNumber(agent.tokensUsed)} tokens`);
|
|
1138
|
+
}
|
|
1139
|
+
const metaStr = metaParts.length > 0 ? ' · ' + metaParts.join(' · ') : '';
|
|
1140
|
+
// Agent status indicator color
|
|
1141
|
+
const agentColor = agent.status === 'error' ? 'red'
|
|
1142
|
+
: (agent.status === 'generating' || agent.status === 'running' || agent.status === 'pending') ? 'yellow'
|
|
1143
|
+
: undefined;
|
|
1144
|
+
return (_jsxs(Box, { flexDirection: "column", marginLeft: 3, children: [_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [branchChar, " "] }), _jsx(Text, { children: agent.taskDescription || agent.agentTypeLabel }), metaStr && _jsx(Text, { dimColor: true, children: metaStr })] }), agent.resultSummary && !expanded && (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [continueChar, " \u23BF "] }), _jsx(Text, { color: agentColor, children: agent.resultSummary })] })), expanded && agent.rawResult && (() => {
|
|
1145
|
+
const contentLines = formatAgentResultContent(agent.rawResult, true, isStatic);
|
|
1146
|
+
if (contentLines.length === 0) {
|
|
1147
|
+
return (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [continueChar, " \u23BF "] }), _jsx(Text, { children: agent.resultSummary || 'Done' })] }));
|
|
1148
|
+
}
|
|
1149
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [continueChar, " \u23BF "] }), _jsx(Text, { children: agent.resultSummary || 'Done' })] }), contentLines.map((line, li) => (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [continueChar, " "] }), _jsx(Text, { children: line })] }, li)))] }));
|
|
1150
|
+
})(), !agent.resultSummary && (agent.status === 'running' || agent.status === 'pending' || agent.status === 'generating') && (_jsxs(Box, { children: [_jsxs(Text, { dimColor: true, children: [continueChar, " \u23BF "] }), _jsx(Text, { dimColor: true, children: "Running\u2026" })] }))] }, i));
|
|
1151
|
+
})] }));
|
|
1152
|
+
};
|
|
1153
|
+
/**
|
|
1154
|
+
* Renders a tool call block with bullet point and result
|
|
1155
|
+
*/
|
|
1156
|
+
const ToolBlock = ({ tool, isStreaming = true, expandMCPResults = false, isStatic = false }) => {
|
|
1157
|
+
const { name, params, status, result, error, duration_ms, parsedResult } = tool;
|
|
1158
|
+
const formattedParams = formatParams(params, 100, name);
|
|
1159
|
+
const formattedResult = formatToolResult(name, result, error, parsedResult);
|
|
1160
|
+
// Check if this is a Plan tool - needs special display format
|
|
1161
|
+
const isPlanTool = name.toLowerCase() === 'plan' || name.toLowerCase() === 'enter_plan_mode';
|
|
1162
|
+
// Compute display name with special handling for certain tools
|
|
1163
|
+
const displayName = (() => {
|
|
1164
|
+
const lowerName = name.toLowerCase();
|
|
1165
|
+
if (lowerName === 'read_multiple_files') {
|
|
1166
|
+
return 'Read';
|
|
1167
|
+
}
|
|
1168
|
+
// Plan tool - show "Nova entered plan mode"
|
|
1169
|
+
if (lowerName === 'plan' || lowerName === 'enter_plan_mode') {
|
|
1170
|
+
return 'Nova entered plan mode';
|
|
1171
|
+
}
|
|
1172
|
+
if (lowerName === 'task' || lowerName === 'spawn_task' || lowerName === 'delegate_task') {
|
|
1173
|
+
// Format as "Explore Agent", "Bash Agent", etc. based on agent_type/subagent_type
|
|
1174
|
+
const agentType = (params.agent_type || params.subagent_type);
|
|
1175
|
+
// Try to extract model from pre-parsed result (avoids JSON.parse in render path)
|
|
1176
|
+
let model;
|
|
1177
|
+
if (result || parsedResult) {
|
|
1178
|
+
try {
|
|
1179
|
+
const resultData = parsedResult ?? JSON.parse(result);
|
|
1180
|
+
if (typeof resultData === 'object' && resultData !== null && 'agentModel' in resultData) {
|
|
1181
|
+
model = String(resultData.agentModel);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
catch {
|
|
1185
|
+
// Ignore parse errors
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
if (agentType) {
|
|
1189
|
+
// Convert kebab-case/snake_case to Title Case
|
|
1190
|
+
const formatted = agentType
|
|
1191
|
+
.split(/[-_]/)
|
|
1192
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
1193
|
+
.join(' ');
|
|
1194
|
+
const modelSuffix = model ? ` (${model})` : '';
|
|
1195
|
+
return `${formatted} Agent${modelSuffix}`;
|
|
1196
|
+
}
|
|
1197
|
+
return 'Task';
|
|
1198
|
+
}
|
|
1199
|
+
// Execute tools - use description as the display name (no wrapper)
|
|
1200
|
+
if (lowerName === 'execute' || lowerName === 'execute_command') {
|
|
1201
|
+
const description = params.description;
|
|
1202
|
+
if (description) {
|
|
1203
|
+
return description.length > 80 ? truncate(description, 80) : description;
|
|
1204
|
+
}
|
|
1205
|
+
// Fallback to command if no description
|
|
1206
|
+
const command = params.command;
|
|
1207
|
+
if (command) {
|
|
1208
|
+
return command.length > 80 ? truncate(command, 80) : command;
|
|
1209
|
+
}
|
|
1210
|
+
return getToolRegistry().getDisplayName(name);
|
|
1211
|
+
}
|
|
1212
|
+
// Handle MCP tools - show clean "Mcp Server Tool" format
|
|
1213
|
+
const mcpDisplayName = getMCPDisplayName(name);
|
|
1214
|
+
if (mcpDisplayName) {
|
|
1215
|
+
return mcpDisplayName;
|
|
1216
|
+
}
|
|
1217
|
+
return getToolRegistry().getDisplayName(name);
|
|
1218
|
+
})();
|
|
1219
|
+
// Get plan task summary for special display format
|
|
1220
|
+
const planTaskSummary = isPlanTool ? params.task_summary : undefined;
|
|
1221
|
+
// Status indicator
|
|
1222
|
+
const getStatusIndicator = () => {
|
|
1223
|
+
switch (status) {
|
|
1224
|
+
case 'generating':
|
|
1225
|
+
return isStreaming ? (_jsx(ActivityDot, { color: "cyan" })) : (_jsx(Text, { color: "cyan", children: "\u25CB" }));
|
|
1226
|
+
case 'running':
|
|
1227
|
+
return isStreaming ? (_jsx(ActivityDot, { color: "cyan" })) : (_jsx(Text, { color: "cyan", children: "\u25CB" }));
|
|
1228
|
+
case 'success':
|
|
1229
|
+
return _jsx(Text, { color: "cyan", children: "\u25CF" });
|
|
1230
|
+
case 'error':
|
|
1231
|
+
return _jsx(Text, { color: "red", children: "\u25CF" });
|
|
1232
|
+
case 'skipped':
|
|
1233
|
+
return _jsx(Text, { color: "yellow", children: "\u25CF" });
|
|
1234
|
+
default:
|
|
1235
|
+
return _jsx(Text, { dimColor: true, children: "\u25CF" });
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
// Tool name color based on status
|
|
1239
|
+
const getNameColor = () => {
|
|
1240
|
+
switch (status) {
|
|
1241
|
+
case 'generating':
|
|
1242
|
+
return 'cyan';
|
|
1243
|
+
case 'running':
|
|
1244
|
+
return 'cyan';
|
|
1245
|
+
case 'error':
|
|
1246
|
+
return 'red';
|
|
1247
|
+
case 'skipped':
|
|
1248
|
+
return 'yellow';
|
|
1249
|
+
default:
|
|
1250
|
+
return 'cyan';
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [getStatusIndicator(), _jsx(Text, { children: " " }), _jsx(Text, { color: getNameColor(), children: displayName }), !isPlanTool && ['spawn_task', 'task', 'delegate_task'].includes(name.toLowerCase()) && (() => {
|
|
1254
|
+
const taskText = (params.task || params.prompt);
|
|
1255
|
+
if (!taskText)
|
|
1256
|
+
return null;
|
|
1257
|
+
const singleLine = taskText.replace(/[\r\n]+/g, ' ').trim();
|
|
1258
|
+
return _jsxs(Text, { dimColor: true, children: ["(", truncate(singleLine, 120), ")"] });
|
|
1259
|
+
})(), !isPlanTool && formattedParams && !['execute', 'execute_command', 'spawn_task', 'task', 'delegate_task'].includes(name.toLowerCase()) && (_jsxs(Text, { dimColor: true, children: ["(", formattedParams, ")"] })), duration_ms !== undefined && status !== 'running' && status !== 'generating' && (_jsxs(Text, { dimColor: true, children: [" ", formatDuration(duration_ms)] }))] }), isPlanTool && planTaskSummary && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { dimColor: true, children: planTaskSummary })] })), status === 'skipped' && ['bash', 'shell', 'execute', 'execute_command'].includes(name.toLowerCase()) && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), typeof params.command === 'string' && params.command && (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: truncate(params.command, 80) }), _jsx(Text, { dimColor: true, children: " \u2192 " })] })), _jsx(Text, { color: "yellow", children: "Skipped" })] })), status !== 'running' && status !== 'pending' && status !== 'generating' && status !== 'skipped' && formattedResult && !(status === 'success' && TOOLS_HIDE_RESULT.has(name.toLowerCase())) && !(status === 'success' && TOOLS_COLLAPSE_RESULT.has(name.toLowerCase()) && !expandMCPResults) && !isMCPTool(name) && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), ['bash', 'shell', 'execute', 'execute_command'].includes(name.toLowerCase()) && typeof params.command === 'string' && params.command ? (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: truncate(params.command, 80) }), _jsx(Text, { dimColor: true, children: " \u2192 " }), _jsx(Text, { color: status === 'error' ? 'red' : undefined, children: formattedResult })] })) : (_jsx(Text, { color: status === 'error' ? 'red' : undefined, children: formattedResult }))] })), (name.toLowerCase() === 'edit' || name.toLowerCase() === 'edit_file') && status !== 'running' && status !== 'pending' && status !== 'generating' && (() => {
|
|
1260
|
+
const editStats = getEditStats(result, parsedResult);
|
|
1261
|
+
if (editStats?.error) {
|
|
1262
|
+
return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { color: "red", children: truncate(editStats.error, 100) })] }));
|
|
1263
|
+
}
|
|
1264
|
+
if (editStats) {
|
|
1265
|
+
// Build diff lines for expanded view
|
|
1266
|
+
const diffLines = [];
|
|
1267
|
+
if (expandMCPResults && editStats.changes.length > 0) {
|
|
1268
|
+
for (const change of editStats.changes) {
|
|
1269
|
+
diffLines.push({ type: 'info', content: `@@ Lines ${change.lineStart}-${change.lineEnd} @@` });
|
|
1270
|
+
for (const line of change.before) {
|
|
1271
|
+
diffLines.push({ type: 'removed', content: line });
|
|
1272
|
+
}
|
|
1273
|
+
for (const line of change.after) {
|
|
1274
|
+
diffLines.push({ type: 'added', content: line });
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
const isTruncated = diffLines.length > EDIT_DIFF_MAX_LINES;
|
|
1279
|
+
const displayDiffLines = diffLines.slice(0, EDIT_DIFF_MAX_LINES);
|
|
1280
|
+
const hiddenLinesCount = diffLines.length - EDIT_DIFF_MAX_LINES;
|
|
1281
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(EditResultDisplay, { additions: editStats.additions, deletions: editStats.deletions })] }), (expandMCPResults || isStatic) && displayDiffLines.length > 0 && (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [displayDiffLines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), line.type === 'info' && (_jsx(Text, { color: "cyan", children: truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS) })), line.type === 'removed' && (_jsxs(Text, { color: "red", children: ["-", truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS - 1)] })), line.type === 'added' && (_jsxs(Text, { color: "green", children: ["+", truncate(line.content, EDIT_DIFF_LINE_MAX_CHARS - 1)] }))] }, i))), isTruncated && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), _jsxs(Text, { dimColor: true, children: ["... (", hiddenLinesCount, " more lines)"] })] }))] }))] }));
|
|
1282
|
+
}
|
|
1283
|
+
return null;
|
|
1284
|
+
})(), name.toLowerCase() === 'read_multiple_files' && status !== 'running' && status !== 'pending' && status !== 'generating' && (() => {
|
|
1285
|
+
const fileData = getReadMultipleFiles(result, parsedResult);
|
|
1286
|
+
if (fileData) {
|
|
1287
|
+
// Only show file list when expanded, but always show errors
|
|
1288
|
+
const showFileList = expandMCPResults || status !== 'success';
|
|
1289
|
+
const maxFilesToShow = 5;
|
|
1290
|
+
const filesToShow = fileData.files.slice(0, maxFilesToShow);
|
|
1291
|
+
const remainingCount = fileData.files.length - maxFilesToShow;
|
|
1292
|
+
// If collapsed and no errors, show nothing
|
|
1293
|
+
if (!showFileList && fileData.errors.length === 0) {
|
|
1294
|
+
return null;
|
|
1295
|
+
}
|
|
1296
|
+
return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [showFileList && filesToShow.map((file, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: file.name }), _jsxs(Text, { dimColor: true, children: [" (", file.lineCount, " lines)"] })] }, i))), showFileList && remainingCount > 0 && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsxs(Text, { dimColor: true, children: ["...and ", remainingCount, " more"] })] })), fileData.errors.map((err, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { color: "red", children: err })] }, `err-${i}`)))] }));
|
|
1297
|
+
}
|
|
1298
|
+
return null;
|
|
1299
|
+
})(), isMCPTool(name) && status !== 'running' && status !== 'pending' && status !== 'generating' && (() => {
|
|
1300
|
+
// Handle errors
|
|
1301
|
+
if (error) {
|
|
1302
|
+
return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { color: "red", children: truncate(error, MCP_RESULT_LINE_MAX_CHARS) })] }));
|
|
1303
|
+
}
|
|
1304
|
+
// Handle successful results with multi-line display
|
|
1305
|
+
if (result) {
|
|
1306
|
+
const lines = formatMCPResultLines(result, expandMCPResults);
|
|
1307
|
+
if (lines.length === 0) {
|
|
1308
|
+
return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: "Done" })] }));
|
|
1309
|
+
}
|
|
1310
|
+
return (_jsx(Box, { flexDirection: "column", marginLeft: 2, children: lines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: i === 0 ? '⎿ ' : ' ' }), _jsx(Text, { color: status === 'error' ? 'red' : undefined, children: line })] }, i))) }));
|
|
1311
|
+
}
|
|
1312
|
+
return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: "Done" })] }));
|
|
1313
|
+
})(), isAgentTool(name) && status !== 'running' && status !== 'pending' && status !== 'generating' && (() => {
|
|
1314
|
+
// Handle errors
|
|
1315
|
+
if (error) {
|
|
1316
|
+
return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { color: "red", children: truncate(error, MCP_RESULT_LINE_MAX_CHARS) })] }));
|
|
1317
|
+
}
|
|
1318
|
+
// Handle successful results with multi-line display
|
|
1319
|
+
if (result) {
|
|
1320
|
+
const contentLines = formatAgentResultContent(result, expandMCPResults, isStatic, parsedResult);
|
|
1321
|
+
if (contentLines.length === 0) {
|
|
1322
|
+
// No content to display, show formatted result summary instead
|
|
1323
|
+
return formattedResult ? (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: formattedResult })] })) : (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: "Done" })] }));
|
|
1324
|
+
}
|
|
1325
|
+
// Show content with expand hint
|
|
1326
|
+
const shouldShowHint = false; // Ctrl+O no longer functional
|
|
1327
|
+
return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), formattedResult && _jsx(Text, { children: formattedResult })] }), contentLines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), _jsx(Text, { color: status === 'error' ? 'red' : undefined, children: line })] }, i))), shouldShowHint && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: " " }), _jsx(Text, { dimColor: true, children: "(Ctrl+O to expand)" })] }))] }));
|
|
1328
|
+
}
|
|
1329
|
+
return (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: "Done" })] }));
|
|
1330
|
+
})(), status === 'generating' && (_jsxs(Box, { marginLeft: 2, children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { color: "cyan", children: getGeneratingProgress(name, params) })] })), status === 'running' && (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [tool.complexityReasoning && (() => {
|
|
1331
|
+
const indent = 5; // " ⎿ " = marginLeft(2) + "⎿ "(3)
|
|
1332
|
+
const availableWidth = Math.max(40, (process.stdout.columns || 80) - indent);
|
|
1333
|
+
const wrappedLines = wordWrap(tool.complexityReasoning, availableWidth);
|
|
1334
|
+
return (_jsx(Box, { flexDirection: "column", children: wrappedLines.map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: i === 0 ? '⎿ ' : ' ' }), _jsx(Text, { color: "magenta", children: line })] }, i))) }));
|
|
1335
|
+
})(), ['bash', 'shell', 'execute', 'execute_command'].includes(name.toLowerCase()) && typeof params.command === 'string' && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "\u23BF " }), _jsx(Text, { children: truncate(params.command, 80) })] })), (tool.statusMessage || 'Executing...').split('\n').map((line, i) => (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: ' ' }), _jsx(Text, { dimColor: true, children: line })] }, i))), name.toLowerCase() === 'execute_command' && (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: ' ' }), _jsx(Text, { dimColor: true, children: "Ctrl+X to skip" })] }))] }))] }));
|
|
1336
|
+
};
|
|
1337
|
+
/**
|
|
1338
|
+
* Formats duration in ms to human readable
|
|
1339
|
+
*/
|
|
1340
|
+
function formatDuration(ms) {
|
|
1341
|
+
if (ms < 1000)
|
|
1342
|
+
return `${ms}ms`;
|
|
1343
|
+
if (ms < 60000)
|
|
1344
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
1345
|
+
return `${Math.floor(ms / 60000)}m ${Math.floor((ms % 60000) / 1000)}s`;
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Tools that should be hidden from UI display (internal/progress tools)
|
|
1349
|
+
*/
|
|
1350
|
+
const HIDDEN_TOOLS = new Set(['complete_plan_task']);
|
|
1351
|
+
/**
|
|
1352
|
+
* Constants for MCP result display
|
|
1353
|
+
*/
|
|
1354
|
+
const MCP_RESULT_MAX_LINES = 5;
|
|
1355
|
+
const MCP_RESULT_LINE_MAX_CHARS = 100;
|
|
1356
|
+
/**
|
|
1357
|
+
* Formats MCP tool result into multiple lines for display.
|
|
1358
|
+
* Returns an array of lines, truncated to max lines unless expanded.
|
|
1359
|
+
*/
|
|
1360
|
+
function formatMCPResultLines(result, expanded = false) {
|
|
1361
|
+
if (!result)
|
|
1362
|
+
return [];
|
|
1363
|
+
// Clean up the result - remove excessive whitespace and normalize
|
|
1364
|
+
const cleaned = result
|
|
1365
|
+
.replace(/\\n/g, '\n') // Handle escaped newlines
|
|
1366
|
+
.replace(/\r\n/g, '\n') // Normalize line endings
|
|
1367
|
+
.trim();
|
|
1368
|
+
// Split into lines and filter empty ones
|
|
1369
|
+
const lines = cleaned.split('\n').filter(line => line.trim().length > 0);
|
|
1370
|
+
if (lines.length === 0) {
|
|
1371
|
+
return [truncate(cleaned, MCP_RESULT_LINE_MAX_CHARS)];
|
|
1372
|
+
}
|
|
1373
|
+
// When expanded, show all lines; otherwise limit to max
|
|
1374
|
+
const maxLines = expanded ? lines.length : MCP_RESULT_MAX_LINES;
|
|
1375
|
+
const displayLines = lines.slice(0, maxLines);
|
|
1376
|
+
// Truncate each line (even when expanded, keep lines readable)
|
|
1377
|
+
const maxChars = expanded ? 500 : MCP_RESULT_LINE_MAX_CHARS;
|
|
1378
|
+
const truncatedLines = displayLines.map(line => truncate(line.trim(), maxChars));
|
|
1379
|
+
// Add indicator if there are more lines (only when not expanded)
|
|
1380
|
+
if (!expanded && lines.length > maxLines) {
|
|
1381
|
+
truncatedLines.push(`... (${lines.length - maxLines} more lines)`);
|
|
1382
|
+
}
|
|
1383
|
+
return truncatedLines;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Checks if a tool is an MCP tool.
|
|
1387
|
+
*/
|
|
1388
|
+
function isMCPTool(toolName) {
|
|
1389
|
+
return toolName.toLowerCase().startsWith('mcp_');
|
|
1390
|
+
}
|
|
1391
|
+
/**
|
|
1392
|
+
* Checks if a tool is an agent/task tool.
|
|
1393
|
+
*/
|
|
1394
|
+
function isAgentTool(toolName) {
|
|
1395
|
+
const lowerName = toolName.toLowerCase();
|
|
1396
|
+
return lowerName === 'task' || lowerName === 'spawn_task' || lowerName === 'delegate_task';
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Formats agent tool result content for multi-line display.
|
|
1400
|
+
* Extracts the 'content' or 'response' field from the result JSON.
|
|
1401
|
+
*/
|
|
1402
|
+
function formatAgentResultContent(result, expanded = false, _isStatic = false, parsedResult) {
|
|
1403
|
+
try {
|
|
1404
|
+
const resultData = parsedResult ?? JSON.parse(result);
|
|
1405
|
+
if (typeof resultData === 'object' && resultData !== null) {
|
|
1406
|
+
// Extract content from either 'content' or 'response' field
|
|
1407
|
+
const content = (resultData.content || resultData.response || '');
|
|
1408
|
+
if (typeof content === 'string' && content.length > 0) {
|
|
1409
|
+
// Use same formatting as MCP tools
|
|
1410
|
+
return formatMCPResultLines(content, expanded);
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
catch {
|
|
1415
|
+
// If parsing fails, return empty array
|
|
1416
|
+
}
|
|
1417
|
+
return [];
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* InterleavedStream renders a sequence of text and tool blocks
|
|
1421
|
+
* in Claude Code CLI style format.
|
|
1422
|
+
* Memoized to prevent unnecessary re-renders during modal displays.
|
|
1423
|
+
*/
|
|
1424
|
+
const InterleavedStreamComponent = ({ blocks, isStreaming, showThinkingIndicator = true, expandMCPResults = false, isStatic = false, maxVisibleBlocks, }) => {
|
|
1425
|
+
// Memoize visible blocks filtering to avoid recalculation on every render
|
|
1426
|
+
const visibleBlocks = React.useMemo(() => blocks.filter((block) => block.type !== 'tool' || !HIDDEN_TOOLS.has(block.name)), [blocks]);
|
|
1427
|
+
// Consolidate consecutive read/edit/agent blocks into compact display blocks.
|
|
1428
|
+
// Only depends on visibleBlocks — removed isStreaming dependency to avoid
|
|
1429
|
+
// re-running O(n) consolidation passes on every throttled render tick (~10fps).
|
|
1430
|
+
const displayBlocks = React.useMemo(() => {
|
|
1431
|
+
const readConsolidated = consolidateReadBlocks(visibleBlocks);
|
|
1432
|
+
const editConsolidated = consolidateEditBlocks(readConsolidated);
|
|
1433
|
+
return consolidateAgentBlocks(editConsolidated);
|
|
1434
|
+
}, [visibleBlocks]);
|
|
1435
|
+
// Truncate to last N blocks while streaming to keep the dynamic area small.
|
|
1436
|
+
// When not streaming, render everything so the full history is visible.
|
|
1437
|
+
const hiddenCount = (isStreaming && maxVisibleBlocks !== undefined && displayBlocks.length > maxVisibleBlocks)
|
|
1438
|
+
? displayBlocks.length - maxVisibleBlocks
|
|
1439
|
+
: 0;
|
|
1440
|
+
const renderedBlocks = hiddenCount > 0
|
|
1441
|
+
? displayBlocks.slice(-maxVisibleBlocks)
|
|
1442
|
+
: displayBlocks;
|
|
1443
|
+
// Thinking indicator when no blocks yet
|
|
1444
|
+
if (displayBlocks.length === 0 && isStreaming && showThinkingIndicator) {
|
|
1445
|
+
return (_jsxs(Box, { children: [_jsx(ActivityDot, { color: "cyan" }), _jsx(Text, { dimColor: true, children: " Thinking..." })] }));
|
|
1446
|
+
}
|
|
1447
|
+
// Nothing to render
|
|
1448
|
+
if (displayBlocks.length === 0) {
|
|
1449
|
+
return null;
|
|
1450
|
+
}
|
|
1451
|
+
// Detect task transitions: text blocks that follow tool blocks
|
|
1452
|
+
// These are typically brief progress messages during plan execution
|
|
1453
|
+
const getTextVariant = (index, block) => {
|
|
1454
|
+
// Explicit variant takes precedence
|
|
1455
|
+
if (block.variant)
|
|
1456
|
+
return block.variant;
|
|
1457
|
+
// Heuristic: if this text block follows a tool/consolidated block and is short,
|
|
1458
|
+
// it's likely a task transition message
|
|
1459
|
+
if (index > 0) {
|
|
1460
|
+
// Map renderedBlocks index back to displayBlocks index for prev-block lookup
|
|
1461
|
+
const displayIndex = index + hiddenCount;
|
|
1462
|
+
const prevBlock = displayBlocks[displayIndex - 1];
|
|
1463
|
+
const isShort = block.content.length < 200 && !block.content.includes('```');
|
|
1464
|
+
const isPrevToolSuccess = (prevBlock.type === 'tool' && prevBlock.status === 'success') ||
|
|
1465
|
+
(prevBlock.type === 'consolidated_read' && prevBlock.status === 'success') ||
|
|
1466
|
+
(prevBlock.type === 'consolidated_edit' && prevBlock.status === 'success') ||
|
|
1467
|
+
(prevBlock.type === 'consolidated_agent' && prevBlock.status === 'success');
|
|
1468
|
+
if (isPrevToolSuccess && isShort) {
|
|
1469
|
+
return 'task-progress';
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
return 'default';
|
|
1473
|
+
};
|
|
1474
|
+
return (_jsxs(Box, { flexDirection: "column", children: [hiddenCount > 0 && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { dimColor: true, children: [" \u2191 ", hiddenCount, " block", hiddenCount === 1 ? '' : 's', " above"] }) })), renderedBlocks.map((block, index) => {
|
|
1475
|
+
const isLast = index === renderedBlocks.length - 1;
|
|
1476
|
+
if (block.type === 'text') {
|
|
1477
|
+
return (_jsx(TextBlock, { content: block.content, isLast: isLast, isStreaming: isStreaming, variant: getTextVariant(index, block) }, `text-${index}`));
|
|
1478
|
+
}
|
|
1479
|
+
if (block.type === 'consolidated_read') {
|
|
1480
|
+
// Use first original block's ID for stable key to prevent flicker during consolidation
|
|
1481
|
+
const stableKey = block.originalBlocks[0]?.id || `consolidated-read-${index}`;
|
|
1482
|
+
return _jsx(ConsolidatedReadBlockComponent, { block: block }, stableKey);
|
|
1483
|
+
}
|
|
1484
|
+
if (block.type === 'consolidated_edit') {
|
|
1485
|
+
// Use first original block's ID for stable key to prevent flicker during consolidation
|
|
1486
|
+
const stableKey = block.originalBlocks[0]?.id || `consolidated-edit-${index}`;
|
|
1487
|
+
return _jsx(ConsolidatedEditBlockComponent, { block: block, expanded: expandMCPResults, isStatic: isStatic }, stableKey);
|
|
1488
|
+
}
|
|
1489
|
+
if (block.type === 'consolidated_agent') {
|
|
1490
|
+
const stableKey = block.originalBlocks[0]?.id || `consolidated-agent-${index}`;
|
|
1491
|
+
return _jsx(ConsolidatedAgentBlockComponent, { block: block, expanded: expandMCPResults, isStatic: isStatic }, stableKey);
|
|
1492
|
+
}
|
|
1493
|
+
return _jsx(ToolBlock, { tool: block, isStreaming: isStreaming, expandMCPResults: expandMCPResults, isStatic: isStatic }, block.id || `tool-${index}`);
|
|
1494
|
+
})] }));
|
|
1495
|
+
};
|
|
1496
|
+
// Memoized to prevent unnecessary re-renders when props haven't changed.
|
|
1497
|
+
// Parent triggers re-renders via forceRender counter rather than array reference changes.
|
|
1498
|
+
export const InterleavedStream = React.memo(InterleavedStreamComponent);
|
|
1499
|
+
export default InterleavedStream;
|
|
1500
|
+
//# sourceMappingURL=InterleavedStream.js.map
|