orquesta-cli 0.1.12
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/.eslintrc.json +26 -0
- package/.prettierrc.json +10 -0
- package/CLAUDE.md +199 -0
- package/LICENSE +21 -0
- package/README.md +280 -0
- package/SECURITY.md +290 -0
- package/TEST_LOCAL.md +245 -0
- package/dist/agents/base/base-agent.d.ts +38 -0
- package/dist/agents/base/base-agent.d.ts.map +1 -0
- package/dist/agents/base/base-agent.js +69 -0
- package/dist/agents/base/base-agent.js.map +1 -0
- package/dist/agents/docs-search/index.d.ts +33 -0
- package/dist/agents/docs-search/index.d.ts.map +1 -0
- package/dist/agents/docs-search/index.js +244 -0
- package/dist/agents/docs-search/index.js.map +1 -0
- package/dist/agents/index.d.ts +4 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +4 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/planner/index.d.ts +17 -0
- package/dist/agents/planner/index.d.ts.map +1 -0
- package/dist/agents/planner/index.js +250 -0
- package/dist/agents/planner/index.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +144 -0
- package/dist/cli.js.map +1 -0
- package/dist/constants.d.ts +8 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/compact/compact-manager.d.ts +22 -0
- package/dist/core/compact/compact-manager.d.ts.map +1 -0
- package/dist/core/compact/compact-manager.js +75 -0
- package/dist/core/compact/compact-manager.js.map +1 -0
- package/dist/core/compact/compact-prompts.d.ts +11 -0
- package/dist/core/compact/compact-prompts.d.ts.map +1 -0
- package/dist/core/compact/compact-prompts.js +90 -0
- package/dist/core/compact/compact-prompts.js.map +1 -0
- package/dist/core/compact/context-tracker.d.ts +28 -0
- package/dist/core/compact/context-tracker.d.ts.map +1 -0
- package/dist/core/compact/context-tracker.js +71 -0
- package/dist/core/compact/context-tracker.js.map +1 -0
- package/dist/core/compact/index.d.ts +4 -0
- package/dist/core/compact/index.d.ts.map +1 -0
- package/dist/core/compact/index.js +4 -0
- package/dist/core/compact/index.js.map +1 -0
- package/dist/core/config/config-manager.d.ts +44 -0
- package/dist/core/config/config-manager.d.ts.map +1 -0
- package/dist/core/config/config-manager.js +259 -0
- package/dist/core/config/config-manager.js.map +1 -0
- package/dist/core/config/index.d.ts +2 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/index.js +2 -0
- package/dist/core/config/index.js.map +1 -0
- package/dist/core/docs-manager.d.ts +46 -0
- package/dist/core/docs-manager.d.ts.map +1 -0
- package/dist/core/docs-manager.js +475 -0
- package/dist/core/docs-manager.js.map +1 -0
- package/dist/core/git-auto-updater.d.ts +58 -0
- package/dist/core/git-auto-updater.d.ts.map +1 -0
- package/dist/core/git-auto-updater.js +374 -0
- package/dist/core/git-auto-updater.js.map +1 -0
- package/dist/core/llm/index.d.ts +2 -0
- package/dist/core/llm/index.d.ts.map +1 -0
- package/dist/core/llm/index.js +2 -0
- package/dist/core/llm/index.js.map +1 -0
- package/dist/core/llm/llm-client.d.ts +97 -0
- package/dist/core/llm/llm-client.d.ts.map +1 -0
- package/dist/core/llm/llm-client.js +1000 -0
- package/dist/core/llm/llm-client.js.map +1 -0
- package/dist/core/session/index.d.ts +2 -0
- package/dist/core/session/index.d.ts.map +1 -0
- package/dist/core/session/index.js +2 -0
- package/dist/core/session/index.js.map +1 -0
- package/dist/core/session/session-manager.d.ts +71 -0
- package/dist/core/session/session-manager.d.ts.map +1 -0
- package/dist/core/session/session-manager.js +250 -0
- package/dist/core/session/session-manager.js.map +1 -0
- package/dist/core/slash-command-handler.d.ts +31 -0
- package/dist/core/slash-command-handler.d.ts.map +1 -0
- package/dist/core/slash-command-handler.js +302 -0
- package/dist/core/slash-command-handler.js.map +1 -0
- package/dist/core/usage-tracker.d.ts +70 -0
- package/dist/core/usage-tracker.d.ts.map +1 -0
- package/dist/core/usage-tracker.js +251 -0
- package/dist/core/usage-tracker.js.map +1 -0
- package/dist/errors/base.d.ts +22 -0
- package/dist/errors/base.d.ts.map +1 -0
- package/dist/errors/base.js +43 -0
- package/dist/errors/base.js.map +1 -0
- package/dist/errors/file.d.ts +31 -0
- package/dist/errors/file.d.ts.map +1 -0
- package/dist/errors/file.js +110 -0
- package/dist/errors/file.js.map +1 -0
- package/dist/errors/index.d.ts +10 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +41 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/llm.d.ts +26 -0
- package/dist/errors/llm.d.ts.map +1 -0
- package/dist/errors/llm.js +86 -0
- package/dist/errors/llm.js.map +1 -0
- package/dist/errors/network.d.ts +19 -0
- package/dist/errors/network.d.ts.map +1 -0
- package/dist/errors/network.js +82 -0
- package/dist/errors/network.js.map +1 -0
- package/dist/errors/validation.d.ts +19 -0
- package/dist/errors/validation.d.ts.map +1 -0
- package/dist/errors/validation.js +62 -0
- package/dist/errors/validation.js.map +1 -0
- package/dist/eval/eval-runner.d.ts +24 -0
- package/dist/eval/eval-runner.d.ts.map +1 -0
- package/dist/eval/eval-runner.js +309 -0
- package/dist/eval/eval-runner.js.map +1 -0
- package/dist/eval/index.d.ts +3 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +3 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/eval/types.d.ts +77 -0
- package/dist/eval/types.d.ts.map +1 -0
- package/dist/eval/types.js +2 -0
- package/dist/eval/types.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestration/index.d.ts +4 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +3 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/plan-executor.d.ts +28 -0
- package/dist/orchestration/plan-executor.d.ts.map +1 -0
- package/dist/orchestration/plan-executor.js +382 -0
- package/dist/orchestration/plan-executor.js.map +1 -0
- package/dist/orchestration/types.d.ts +66 -0
- package/dist/orchestration/types.d.ts.map +1 -0
- package/dist/orchestration/types.js +2 -0
- package/dist/orchestration/types.js.map +1 -0
- package/dist/orchestration/utils.d.ts +13 -0
- package/dist/orchestration/utils.d.ts.map +1 -0
- package/dist/orchestration/utils.js +78 -0
- package/dist/orchestration/utils.js.map +1 -0
- package/dist/orquesta/connection.d.ts +35 -0
- package/dist/orquesta/connection.d.ts.map +1 -0
- package/dist/orquesta/connection.js +189 -0
- package/dist/orquesta/connection.js.map +1 -0
- package/dist/prompts/agents/docs-search-decision.d.ts +6 -0
- package/dist/prompts/agents/docs-search-decision.d.ts.map +1 -0
- package/dist/prompts/agents/docs-search-decision.js +46 -0
- package/dist/prompts/agents/docs-search-decision.js.map +1 -0
- package/dist/prompts/agents/docs-search.d.ts +4 -0
- package/dist/prompts/agents/docs-search.d.ts.map +1 -0
- package/dist/prompts/agents/docs-search.js +70 -0
- package/dist/prompts/agents/docs-search.js.map +1 -0
- package/dist/prompts/agents/planning.d.ts +4 -0
- package/dist/prompts/agents/planning.d.ts.map +1 -0
- package/dist/prompts/agents/planning.js +119 -0
- package/dist/prompts/agents/planning.js.map +1 -0
- package/dist/prompts/index.d.ts +10 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +10 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/shared/codebase-rules.d.ts +4 -0
- package/dist/prompts/shared/codebase-rules.d.ts.map +1 -0
- package/dist/prompts/shared/codebase-rules.js +16 -0
- package/dist/prompts/shared/codebase-rules.js.map +1 -0
- package/dist/prompts/shared/git-rules.d.ts +2 -0
- package/dist/prompts/shared/git-rules.d.ts.map +1 -0
- package/dist/prompts/shared/git-rules.js +87 -0
- package/dist/prompts/shared/git-rules.js.map +1 -0
- package/dist/prompts/shared/language-rules.d.ts +4 -0
- package/dist/prompts/shared/language-rules.d.ts.map +1 -0
- package/dist/prompts/shared/language-rules.js +22 -0
- package/dist/prompts/shared/language-rules.js.map +1 -0
- package/dist/prompts/shared/tool-usage.d.ts +12 -0
- package/dist/prompts/shared/tool-usage.d.ts.map +1 -0
- package/dist/prompts/shared/tool-usage.js +51 -0
- package/dist/prompts/shared/tool-usage.js.map +1 -0
- package/dist/prompts/system/compact.d.ts +3 -0
- package/dist/prompts/system/compact.d.ts.map +1 -0
- package/dist/prompts/system/compact.js +73 -0
- package/dist/prompts/system/compact.js.map +1 -0
- package/dist/prompts/system/plan-execute.d.ts +3 -0
- package/dist/prompts/system/plan-execute.d.ts.map +1 -0
- package/dist/prompts/system/plan-execute.js +83 -0
- package/dist/prompts/system/plan-execute.js.map +1 -0
- package/dist/tools/browser/browser-client.d.ts +107 -0
- package/dist/tools/browser/browser-client.d.ts.map +1 -0
- package/dist/tools/browser/browser-client.js +958 -0
- package/dist/tools/browser/browser-client.js.map +1 -0
- package/dist/tools/browser/browser-tools.d.ts +17 -0
- package/dist/tools/browser/browser-tools.d.ts.map +1 -0
- package/dist/tools/browser/browser-tools.js +972 -0
- package/dist/tools/browser/browser-tools.js.map +1 -0
- package/dist/tools/browser/index.d.ts +7 -0
- package/dist/tools/browser/index.d.ts.map +1 -0
- package/dist/tools/browser/index.js +17 -0
- package/dist/tools/browser/index.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/llm/agents/docs-search-tools.d.ts +17 -0
- package/dist/tools/llm/agents/docs-search-tools.d.ts.map +1 -0
- package/dist/tools/llm/agents/docs-search-tools.js +265 -0
- package/dist/tools/llm/agents/docs-search-tools.js.map +1 -0
- package/dist/tools/llm/agents/index.d.ts +4 -0
- package/dist/tools/llm/agents/index.d.ts.map +1 -0
- package/dist/tools/llm/agents/index.js +3 -0
- package/dist/tools/llm/agents/index.js.map +1 -0
- package/dist/tools/llm/index.d.ts +3 -0
- package/dist/tools/llm/index.d.ts.map +1 -0
- package/dist/tools/llm/index.js +3 -0
- package/dist/tools/llm/index.js.map +1 -0
- package/dist/tools/llm/simple/ask-user-tool.d.ts +5 -0
- package/dist/tools/llm/simple/ask-user-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/ask-user-tool.js +7 -0
- package/dist/tools/llm/simple/ask-user-tool.js.map +1 -0
- package/dist/tools/llm/simple/background-bash-tool.d.ts +30 -0
- package/dist/tools/llm/simple/background-bash-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/background-bash-tool.js +323 -0
- package/dist/tools/llm/simple/background-bash-tool.js.map +1 -0
- package/dist/tools/llm/simple/background-powershell-tool.d.ts +30 -0
- package/dist/tools/llm/simple/background-powershell-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/background-powershell-tool.js +305 -0
- package/dist/tools/llm/simple/background-powershell-tool.js.map +1 -0
- package/dist/tools/llm/simple/bash-tool.d.ts +4 -0
- package/dist/tools/llm/simple/bash-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/bash-tool.js +178 -0
- package/dist/tools/llm/simple/bash-tool.js.map +1 -0
- package/dist/tools/llm/simple/docs-search-agent-tool.d.ts +6 -0
- package/dist/tools/llm/simple/docs-search-agent-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/docs-search-agent-tool.js +104 -0
- package/dist/tools/llm/simple/docs-search-agent-tool.js.map +1 -0
- package/dist/tools/llm/simple/file-tools.d.ts +13 -0
- package/dist/tools/llm/simple/file-tools.d.ts.map +1 -0
- package/dist/tools/llm/simple/file-tools.js +785 -0
- package/dist/tools/llm/simple/file-tools.js.map +1 -0
- package/dist/tools/llm/simple/final-response-tool.d.ts +12 -0
- package/dist/tools/llm/simple/final-response-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/final-response-tool.js +107 -0
- package/dist/tools/llm/simple/final-response-tool.js.map +1 -0
- package/dist/tools/llm/simple/index.d.ts +11 -0
- package/dist/tools/llm/simple/index.d.ts.map +1 -0
- package/dist/tools/llm/simple/index.js +20 -0
- package/dist/tools/llm/simple/index.js.map +1 -0
- package/dist/tools/llm/simple/planning-tools.d.ts +5 -0
- package/dist/tools/llm/simple/planning-tools.d.ts.map +1 -0
- package/dist/tools/llm/simple/planning-tools.js +117 -0
- package/dist/tools/llm/simple/planning-tools.js.map +1 -0
- package/dist/tools/llm/simple/powershell-tool.d.ts +4 -0
- package/dist/tools/llm/simple/powershell-tool.d.ts.map +1 -0
- package/dist/tools/llm/simple/powershell-tool.js +178 -0
- package/dist/tools/llm/simple/powershell-tool.js.map +1 -0
- package/dist/tools/llm/simple/simple-tool-executor.d.ts +38 -0
- package/dist/tools/llm/simple/simple-tool-executor.d.ts.map +1 -0
- package/dist/tools/llm/simple/simple-tool-executor.js +134 -0
- package/dist/tools/llm/simple/simple-tool-executor.js.map +1 -0
- package/dist/tools/llm/simple/todo-tools.d.ts +15 -0
- package/dist/tools/llm/simple/todo-tools.d.ts.map +1 -0
- package/dist/tools/llm/simple/todo-tools.js +145 -0
- package/dist/tools/llm/simple/todo-tools.js.map +1 -0
- package/dist/tools/llm/simple/user-interaction-tools.d.ts +22 -0
- package/dist/tools/llm/simple/user-interaction-tools.d.ts.map +1 -0
- package/dist/tools/llm/simple/user-interaction-tools.js +168 -0
- package/dist/tools/llm/simple/user-interaction-tools.js.map +1 -0
- package/dist/tools/office/common/constants.d.ts +194 -0
- package/dist/tools/office/common/constants.d.ts.map +1 -0
- package/dist/tools/office/common/constants.js +169 -0
- package/dist/tools/office/common/constants.js.map +1 -0
- package/dist/tools/office/common/index.d.ts +4 -0
- package/dist/tools/office/common/index.d.ts.map +1 -0
- package/dist/tools/office/common/index.js +3 -0
- package/dist/tools/office/common/index.js.map +1 -0
- package/dist/tools/office/common/types.d.ts +82 -0
- package/dist/tools/office/common/types.d.ts.map +1 -0
- package/dist/tools/office/common/types.js +2 -0
- package/dist/tools/office/common/types.js.map +1 -0
- package/dist/tools/office/common/utils.d.ts +14 -0
- package/dist/tools/office/common/utils.d.ts.map +1 -0
- package/dist/tools/office/common/utils.js +58 -0
- package/dist/tools/office/common/utils.js.map +1 -0
- package/dist/tools/office/excel-client.d.ts +123 -0
- package/dist/tools/office/excel-client.d.ts.map +1 -0
- package/dist/tools/office/excel-client.js +1037 -0
- package/dist/tools/office/excel-client.js.map +1 -0
- package/dist/tools/office/excel-tools/cells.d.ts +10 -0
- package/dist/tools/office/excel-tools/cells.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/cells.js +279 -0
- package/dist/tools/office/excel-tools/cells.js.map +1 -0
- package/dist/tools/office/excel-tools/charts.d.ts +6 -0
- package/dist/tools/office/excel-tools/charts.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/charts.js +124 -0
- package/dist/tools/office/excel-tools/charts.js.map +1 -0
- package/dist/tools/office/excel-tools/comments.d.ts +6 -0
- package/dist/tools/office/excel-tools/comments.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/comments.js +114 -0
- package/dist/tools/office/excel-tools/comments.js.map +1 -0
- package/dist/tools/office/excel-tools/data-ops.d.ts +10 -0
- package/dist/tools/office/excel-tools/data-ops.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/data-ops.js +266 -0
- package/dist/tools/office/excel-tools/data-ops.js.map +1 -0
- package/dist/tools/office/excel-tools/export.d.ts +5 -0
- package/dist/tools/office/excel-tools/export.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/export.js +75 -0
- package/dist/tools/office/excel-tools/export.js.map +1 -0
- package/dist/tools/office/excel-tools/formatting.d.ts +10 -0
- package/dist/tools/office/excel-tools/formatting.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/formatting.js +276 -0
- package/dist/tools/office/excel-tools/formatting.js.map +1 -0
- package/dist/tools/office/excel-tools/index.d.ts +16 -0
- package/dist/tools/office/excel-tools/index.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/index.js +42 -0
- package/dist/tools/office/excel-tools/index.js.map +1 -0
- package/dist/tools/office/excel-tools/launch.d.ts +10 -0
- package/dist/tools/office/excel-tools/launch.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/launch.js +248 -0
- package/dist/tools/office/excel-tools/launch.js.map +1 -0
- package/dist/tools/office/excel-tools/media.d.ts +5 -0
- package/dist/tools/office/excel-tools/media.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/media.js +84 -0
- package/dist/tools/office/excel-tools/media.js.map +1 -0
- package/dist/tools/office/excel-tools/named-ranges.d.ts +6 -0
- package/dist/tools/office/excel-tools/named-ranges.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/named-ranges.js +113 -0
- package/dist/tools/office/excel-tools/named-ranges.js.map +1 -0
- package/dist/tools/office/excel-tools/protection.d.ts +5 -0
- package/dist/tools/office/excel-tools/protection.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/protection.js +75 -0
- package/dist/tools/office/excel-tools/protection.js.map +1 -0
- package/dist/tools/office/excel-tools/rows-columns.d.ts +11 -0
- package/dist/tools/office/excel-tools/rows-columns.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/rows-columns.js +293 -0
- package/dist/tools/office/excel-tools/rows-columns.js.map +1 -0
- package/dist/tools/office/excel-tools/sheets.d.ts +8 -0
- package/dist/tools/office/excel-tools/sheets.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/sheets.js +177 -0
- package/dist/tools/office/excel-tools/sheets.js.map +1 -0
- package/dist/tools/office/excel-tools/validation.d.ts +7 -0
- package/dist/tools/office/excel-tools/validation.d.ts.map +1 -0
- package/dist/tools/office/excel-tools/validation.js +175 -0
- package/dist/tools/office/excel-tools/validation.js.map +1 -0
- package/dist/tools/office/excel-tools.d.ts +3 -0
- package/dist/tools/office/excel-tools.d.ts.map +1 -0
- package/dist/tools/office/excel-tools.js +3 -0
- package/dist/tools/office/excel-tools.js.map +1 -0
- package/dist/tools/office/index.d.ts +6 -0
- package/dist/tools/office/index.d.ts.map +1 -0
- package/dist/tools/office/index.js +9 -0
- package/dist/tools/office/index.js.map +1 -0
- package/dist/tools/office/office-client-base.d.ts +31 -0
- package/dist/tools/office/office-client-base.d.ts.map +1 -0
- package/dist/tools/office/office-client-base.js +154 -0
- package/dist/tools/office/office-client-base.js.map +1 -0
- package/dist/tools/office/office-client.d.ts +196 -0
- package/dist/tools/office/office-client.d.ts.map +1 -0
- package/dist/tools/office/office-client.js +200 -0
- package/dist/tools/office/office-client.js.map +1 -0
- package/dist/tools/office/powerpoint-client.d.ts +135 -0
- package/dist/tools/office/powerpoint-client.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-client.js +1136 -0
- package/dist/tools/office/powerpoint-client.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/effects.d.ts +9 -0
- package/dist/tools/office/powerpoint-tools/effects.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/effects.js +246 -0
- package/dist/tools/office/powerpoint-tools/effects.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/export.d.ts +6 -0
- package/dist/tools/office/powerpoint-tools/export.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/export.js +108 -0
- package/dist/tools/office/powerpoint-tools/export.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/index.d.ts +13 -0
- package/dist/tools/office/powerpoint-tools/index.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/index.js +33 -0
- package/dist/tools/office/powerpoint-tools/index.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/launch.d.ts +9 -0
- package/dist/tools/office/powerpoint-tools/launch.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/launch.js +214 -0
- package/dist/tools/office/powerpoint-tools/launch.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/media.d.ts +8 -0
- package/dist/tools/office/powerpoint-tools/media.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/media.js +211 -0
- package/dist/tools/office/powerpoint-tools/media.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/notes.d.ts +8 -0
- package/dist/tools/office/powerpoint-tools/notes.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/notes.js +171 -0
- package/dist/tools/office/powerpoint-tools/notes.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/sections.d.ts +6 -0
- package/dist/tools/office/powerpoint-tools/sections.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/sections.js +104 -0
- package/dist/tools/office/powerpoint-tools/sections.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/shapes.d.ts +22 -0
- package/dist/tools/office/powerpoint-tools/shapes.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/shapes.js +681 -0
- package/dist/tools/office/powerpoint-tools/shapes.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/slides.d.ts +11 -0
- package/dist/tools/office/powerpoint-tools/slides.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/slides.js +283 -0
- package/dist/tools/office/powerpoint-tools/slides.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/tables.d.ts +6 -0
- package/dist/tools/office/powerpoint-tools/tables.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/tables.js +132 -0
- package/dist/tools/office/powerpoint-tools/tables.js.map +1 -0
- package/dist/tools/office/powerpoint-tools/text.d.ts +12 -0
- package/dist/tools/office/powerpoint-tools/text.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools/text.js +366 -0
- package/dist/tools/office/powerpoint-tools/text.js.map +1 -0
- package/dist/tools/office/powerpoint-tools.d.ts +3 -0
- package/dist/tools/office/powerpoint-tools.d.ts.map +1 -0
- package/dist/tools/office/powerpoint-tools.js +3 -0
- package/dist/tools/office/powerpoint-tools.js.map +1 -0
- package/dist/tools/office/word-client.d.ts +147 -0
- package/dist/tools/office/word-client.d.ts.map +1 -0
- package/dist/tools/office/word-client.js +1341 -0
- package/dist/tools/office/word-client.js.map +1 -0
- package/dist/tools/office/word-tools/bookmarks.d.ts +7 -0
- package/dist/tools/office/word-tools/bookmarks.d.ts.map +1 -0
- package/dist/tools/office/word-tools/bookmarks.js +146 -0
- package/dist/tools/office/word-tools/bookmarks.js.map +1 -0
- package/dist/tools/office/word-tools/comments.d.ts +7 -0
- package/dist/tools/office/word-tools/comments.d.ts.map +1 -0
- package/dist/tools/office/word-tools/comments.js +146 -0
- package/dist/tools/office/word-tools/comments.js.map +1 -0
- package/dist/tools/office/word-tools/content.d.ts +7 -0
- package/dist/tools/office/word-tools/content.d.ts.map +1 -0
- package/dist/tools/office/word-tools/content.js +168 -0
- package/dist/tools/office/word-tools/content.js.map +1 -0
- package/dist/tools/office/word-tools/export.d.ts +5 -0
- package/dist/tools/office/word-tools/export.d.ts.map +1 -0
- package/dist/tools/office/word-tools/export.js +73 -0
- package/dist/tools/office/word-tools/export.js.map +1 -0
- package/dist/tools/office/word-tools/formatting.d.ts +6 -0
- package/dist/tools/office/word-tools/formatting.d.ts.map +1 -0
- package/dist/tools/office/word-tools/formatting.js +129 -0
- package/dist/tools/office/word-tools/formatting.js.map +1 -0
- package/dist/tools/office/word-tools/headers-footers.d.ts +6 -0
- package/dist/tools/office/word-tools/headers-footers.d.ts.map +1 -0
- package/dist/tools/office/word-tools/headers-footers.js +117 -0
- package/dist/tools/office/word-tools/headers-footers.js.map +1 -0
- package/dist/tools/office/word-tools/index.d.ts +16 -0
- package/dist/tools/office/word-tools/index.d.ts.map +1 -0
- package/dist/tools/office/word-tools/index.js +45 -0
- package/dist/tools/office/word-tools/index.js.map +1 -0
- package/dist/tools/office/word-tools/launch.d.ts +10 -0
- package/dist/tools/office/word-tools/launch.d.ts.map +1 -0
- package/dist/tools/office/word-tools/launch.js +255 -0
- package/dist/tools/office/word-tools/launch.js.map +1 -0
- package/dist/tools/office/word-tools/lists.d.ts +5 -0
- package/dist/tools/office/word-tools/lists.d.ts.map +1 -0
- package/dist/tools/office/word-tools/lists.js +73 -0
- package/dist/tools/office/word-tools/lists.js.map +1 -0
- package/dist/tools/office/word-tools/navigation.d.ts +5 -0
- package/dist/tools/office/word-tools/navigation.d.ts.map +1 -0
- package/dist/tools/office/word-tools/navigation.js +85 -0
- package/dist/tools/office/word-tools/navigation.js.map +1 -0
- package/dist/tools/office/word-tools/page-setup.d.ts +7 -0
- package/dist/tools/office/word-tools/page-setup.d.ts.map +1 -0
- package/dist/tools/office/word-tools/page-setup.js +152 -0
- package/dist/tools/office/word-tools/page-setup.js.map +1 -0
- package/dist/tools/office/word-tools/tables.d.ts +8 -0
- package/dist/tools/office/word-tools/tables.d.ts.map +1 -0
- package/dist/tools/office/word-tools/tables.js +197 -0
- package/dist/tools/office/word-tools/tables.js.map +1 -0
- package/dist/tools/office/word-tools/text.d.ts +9 -0
- package/dist/tools/office/word-tools/text.d.ts.map +1 -0
- package/dist/tools/office/word-tools/text.js +235 -0
- package/dist/tools/office/word-tools/text.js.map +1 -0
- package/dist/tools/office/word-tools/undo-redo.d.ts +5 -0
- package/dist/tools/office/word-tools/undo-redo.d.ts.map +1 -0
- package/dist/tools/office/word-tools/undo-redo.js +73 -0
- package/dist/tools/office/word-tools/undo-redo.js.map +1 -0
- package/dist/tools/office/word-tools/watermarks.d.ts +5 -0
- package/dist/tools/office/word-tools/watermarks.d.ts.map +1 -0
- package/dist/tools/office/word-tools/watermarks.js +81 -0
- package/dist/tools/office/word-tools/watermarks.js.map +1 -0
- package/dist/tools/office/word-tools.d.ts +3 -0
- package/dist/tools/office/word-tools.d.ts.map +1 -0
- package/dist/tools/office/word-tools.js +3 -0
- package/dist/tools/office/word-tools.js.map +1 -0
- package/dist/tools/registry.d.ts +53 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +278 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +88 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +19 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types/index.d.ts +126 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/PlanExecuteView.d.ts +11 -0
- package/dist/ui/PlanExecuteView.d.ts.map +1 -0
- package/dist/ui/PlanExecuteView.js +29 -0
- package/dist/ui/PlanExecuteView.js.map +1 -0
- package/dist/ui/TodoPanel.d.ts +13 -0
- package/dist/ui/TodoPanel.d.ts.map +1 -0
- package/dist/ui/TodoPanel.js +135 -0
- package/dist/ui/TodoPanel.js.map +1 -0
- package/dist/ui/UpdateNotification.d.ts +13 -0
- package/dist/ui/UpdateNotification.d.ts.map +1 -0
- package/dist/ui/UpdateNotification.js +42 -0
- package/dist/ui/UpdateNotification.js.map +1 -0
- package/dist/ui/components/ActivityIndicator.d.ts +25 -0
- package/dist/ui/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/ui/components/ActivityIndicator.js +115 -0
- package/dist/ui/components/ActivityIndicator.js.map +1 -0
- package/dist/ui/components/CommandBrowser.d.ts +10 -0
- package/dist/ui/components/CommandBrowser.d.ts.map +1 -0
- package/dist/ui/components/CommandBrowser.js +53 -0
- package/dist/ui/components/CommandBrowser.js.map +1 -0
- package/dist/ui/components/CustomTextInput.d.ts +13 -0
- package/dist/ui/components/CustomTextInput.d.ts.map +1 -0
- package/dist/ui/components/CustomTextInput.js +245 -0
- package/dist/ui/components/CustomTextInput.js.map +1 -0
- package/dist/ui/components/DocsSearchProgress.d.ts +13 -0
- package/dist/ui/components/DocsSearchProgress.d.ts.map +1 -0
- package/dist/ui/components/DocsSearchProgress.js +37 -0
- package/dist/ui/components/DocsSearchProgress.js.map +1 -0
- package/dist/ui/components/FileBrowser.d.ts +11 -0
- package/dist/ui/components/FileBrowser.d.ts.map +1 -0
- package/dist/ui/components/FileBrowser.js +45 -0
- package/dist/ui/components/FileBrowser.js.map +1 -0
- package/dist/ui/components/LLMSetupWizard.d.ts +8 -0
- package/dist/ui/components/LLMSetupWizard.d.ts.map +1 -0
- package/dist/ui/components/LLMSetupWizard.js +192 -0
- package/dist/ui/components/LLMSetupWizard.js.map +1 -0
- package/dist/ui/components/Logo.d.ts +19 -0
- package/dist/ui/components/Logo.d.ts.map +1 -0
- package/dist/ui/components/Logo.js +55 -0
- package/dist/ui/components/Logo.js.map +1 -0
- package/dist/ui/components/MarkdownRenderer.d.ts +9 -0
- package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/ui/components/MarkdownRenderer.js +198 -0
- package/dist/ui/components/MarkdownRenderer.js.map +1 -0
- package/dist/ui/components/ModelSelector.d.ts +8 -0
- package/dist/ui/components/ModelSelector.d.ts.map +1 -0
- package/dist/ui/components/ModelSelector.js +111 -0
- package/dist/ui/components/ModelSelector.js.map +1 -0
- package/dist/ui/components/PlanExecuteApp.d.ts +23 -0
- package/dist/ui/components/PlanExecuteApp.d.ts.map +1 -0
- package/dist/ui/components/PlanExecuteApp.js +1324 -0
- package/dist/ui/components/PlanExecuteApp.js.map +1 -0
- package/dist/ui/components/ProgressBar.d.ts +10 -0
- package/dist/ui/components/ProgressBar.d.ts.map +1 -0
- package/dist/ui/components/ProgressBar.js +26 -0
- package/dist/ui/components/ProgressBar.js.map +1 -0
- package/dist/ui/components/StatusBar.d.ts +23 -0
- package/dist/ui/components/StatusBar.d.ts.map +1 -0
- package/dist/ui/components/StatusBar.js +162 -0
- package/dist/ui/components/StatusBar.js.map +1 -0
- package/dist/ui/components/ThinkingIndicator.d.ts +14 -0
- package/dist/ui/components/ThinkingIndicator.d.ts.map +1 -0
- package/dist/ui/components/ThinkingIndicator.js +63 -0
- package/dist/ui/components/ThinkingIndicator.js.map +1 -0
- package/dist/ui/components/TodoListView.d.ts +11 -0
- package/dist/ui/components/TodoListView.d.ts.map +1 -0
- package/dist/ui/components/TodoListView.js +69 -0
- package/dist/ui/components/TodoListView.js.map +1 -0
- package/dist/ui/components/ToolSelector.d.ts +7 -0
- package/dist/ui/components/ToolSelector.d.ts.map +1 -0
- package/dist/ui/components/ToolSelector.js +111 -0
- package/dist/ui/components/ToolSelector.js.map +1 -0
- package/dist/ui/components/dialogs/ApprovalDialog.d.ts +13 -0
- package/dist/ui/components/dialogs/ApprovalDialog.d.ts.map +1 -0
- package/dist/ui/components/dialogs/ApprovalDialog.js +173 -0
- package/dist/ui/components/dialogs/ApprovalDialog.js.map +1 -0
- package/dist/ui/components/dialogs/AskUserDialog.d.ts +9 -0
- package/dist/ui/components/dialogs/AskUserDialog.d.ts.map +1 -0
- package/dist/ui/components/dialogs/AskUserDialog.js +111 -0
- package/dist/ui/components/dialogs/AskUserDialog.js.map +1 -0
- package/dist/ui/components/dialogs/DocsBrowser.d.ts +8 -0
- package/dist/ui/components/dialogs/DocsBrowser.d.ts.map +1 -0
- package/dist/ui/components/dialogs/DocsBrowser.js +127 -0
- package/dist/ui/components/dialogs/DocsBrowser.js.map +1 -0
- package/dist/ui/components/dialogs/SettingsDialog.d.ts +10 -0
- package/dist/ui/components/dialogs/SettingsDialog.d.ts.map +1 -0
- package/dist/ui/components/dialogs/SettingsDialog.js +563 -0
- package/dist/ui/components/dialogs/SettingsDialog.js.map +1 -0
- package/dist/ui/components/dialogs/index.d.ts +4 -0
- package/dist/ui/components/dialogs/index.d.ts.map +1 -0
- package/dist/ui/components/dialogs/index.js +4 -0
- package/dist/ui/components/dialogs/index.js.map +1 -0
- package/dist/ui/components/index.d.ts +12 -0
- package/dist/ui/components/index.d.ts.map +1 -0
- package/dist/ui/components/index.js +9 -0
- package/dist/ui/components/index.js.map +1 -0
- package/dist/ui/components/panels/LogPanel.d.ts +7 -0
- package/dist/ui/components/panels/LogPanel.d.ts.map +1 -0
- package/dist/ui/components/panels/LogPanel.js +280 -0
- package/dist/ui/components/panels/LogPanel.js.map +1 -0
- package/dist/ui/components/panels/SessionPanel.d.ts +8 -0
- package/dist/ui/components/panels/SessionPanel.d.ts.map +1 -0
- package/dist/ui/components/panels/SessionPanel.js +81 -0
- package/dist/ui/components/panels/SessionPanel.js.map +1 -0
- package/dist/ui/components/panels/index.d.ts +4 -0
- package/dist/ui/components/panels/index.d.ts.map +1 -0
- package/dist/ui/components/panels/index.js +4 -0
- package/dist/ui/components/panels/index.js.map +1 -0
- package/dist/ui/components/views/ChatView.d.ts +12 -0
- package/dist/ui/components/views/ChatView.d.ts.map +1 -0
- package/dist/ui/components/views/ChatView.js +289 -0
- package/dist/ui/components/views/ChatView.js.map +1 -0
- package/dist/ui/components/views/index.d.ts +2 -0
- package/dist/ui/components/views/index.d.ts.map +1 -0
- package/dist/ui/components/views/index.js +2 -0
- package/dist/ui/components/views/index.js.map +1 -0
- package/dist/ui/contexts/TokenContext.d.ts +29 -0
- package/dist/ui/contexts/TokenContext.d.ts.map +1 -0
- package/dist/ui/contexts/TokenContext.js +79 -0
- package/dist/ui/contexts/TokenContext.js.map +1 -0
- package/dist/ui/hooks/atFileProcessor.d.ts +15 -0
- package/dist/ui/hooks/atFileProcessor.d.ts.map +1 -0
- package/dist/ui/hooks/atFileProcessor.js +88 -0
- package/dist/ui/hooks/atFileProcessor.js.map +1 -0
- package/dist/ui/hooks/index.d.ts +8 -0
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +8 -0
- package/dist/ui/hooks/index.js.map +1 -0
- package/dist/ui/hooks/slashCommandProcessor.d.ts +21 -0
- package/dist/ui/hooks/slashCommandProcessor.d.ts.map +1 -0
- package/dist/ui/hooks/slashCommandProcessor.js +100 -0
- package/dist/ui/hooks/slashCommandProcessor.js.map +1 -0
- package/dist/ui/hooks/useCommandBrowserState.d.ts +12 -0
- package/dist/ui/hooks/useCommandBrowserState.d.ts.map +1 -0
- package/dist/ui/hooks/useCommandBrowserState.js +66 -0
- package/dist/ui/hooks/useCommandBrowserState.js.map +1 -0
- package/dist/ui/hooks/useFileBrowserState.d.ts +15 -0
- package/dist/ui/hooks/useFileBrowserState.d.ts.map +1 -0
- package/dist/ui/hooks/useFileBrowserState.js +80 -0
- package/dist/ui/hooks/useFileBrowserState.js.map +1 -0
- package/dist/ui/hooks/useFileList.d.ts +20 -0
- package/dist/ui/hooks/useFileList.d.ts.map +1 -0
- package/dist/ui/hooks/useFileList.js +57 -0
- package/dist/ui/hooks/useFileList.js.map +1 -0
- package/dist/ui/hooks/useInputHistory.d.ts +9 -0
- package/dist/ui/hooks/useInputHistory.d.ts.map +1 -0
- package/dist/ui/hooks/useInputHistory.js +68 -0
- package/dist/ui/hooks/useInputHistory.js.map +1 -0
- package/dist/ui/hooks/usePlanExecution.d.ts +8 -0
- package/dist/ui/hooks/usePlanExecution.d.ts.map +1 -0
- package/dist/ui/hooks/usePlanExecution.js +214 -0
- package/dist/ui/hooks/usePlanExecution.js.map +1 -0
- package/dist/ui/index.d.ts +7 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +7 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/ink-entry.d.ts +3 -0
- package/dist/ui/ink-entry.d.ts.map +1 -0
- package/dist/ui/ink-entry.js +22 -0
- package/dist/ui/ink-entry.js.map +1 -0
- package/dist/utils/env-filter.d.ts +4 -0
- package/dist/utils/env-filter.d.ts.map +1 -0
- package/dist/utils/env-filter.js +101 -0
- package/dist/utils/env-filter.js.map +1 -0
- package/dist/utils/file-system.d.ts +9 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +99 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils/git-utils.d.ts +2 -0
- package/dist/utils/git-utils.d.ts.map +1 -0
- package/dist/utils/git-utils.js +16 -0
- package/dist/utils/git-utils.js.map +1 -0
- package/dist/utils/json-stream-logger.d.ts +74 -0
- package/dist/utils/json-stream-logger.d.ts.map +1 -0
- package/dist/utils/json-stream-logger.js +808 -0
- package/dist/utils/json-stream-logger.js.map +1 -0
- package/dist/utils/logger.d.ts +152 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +1672 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/platform-utils.d.ts +19 -0
- package/dist/utils/platform-utils.d.ts.map +1 -0
- package/dist/utils/platform-utils.js +134 -0
- package/dist/utils/platform-utils.js.map +1 -0
- package/dist/utils/wsl-utils.d.ts +4 -0
- package/dist/utils/wsl-utils.d.ts.map +1 -0
- package/dist/utils/wsl-utils.js +72 -0
- package/dist/utils/wsl-utils.js.map +1 -0
- package/electron.vite.config.ts +63 -0
- package/google374b9eba0c52b043.html +1 -0
- package/package.json +122 -0
- package/src/agents/base/base-agent.ts +159 -0
- package/src/agents/docs-search/index.ts +365 -0
- package/src/agents/index.ts +34 -0
- package/src/agents/planner/index.ts +544 -0
- package/src/cli.ts +201 -0
- package/src/constants.ts +47 -0
- package/src/core/compact/compact-manager.ts +160 -0
- package/src/core/compact/compact-prompts.ts +150 -0
- package/src/core/compact/context-tracker.ts +164 -0
- package/src/core/compact/index.ts +25 -0
- package/src/core/config/config-manager.ts +460 -0
- package/src/core/config/index.ts +5 -0
- package/src/core/docs-manager.ts +678 -0
- package/src/core/llm/index.ts +7 -0
- package/src/core/llm/llm-client.ts +1550 -0
- package/src/core/session/index.ts +5 -0
- package/src/core/session/session-manager.ts +464 -0
- package/src/core/slash-command-handler.ts +410 -0
- package/src/core/usage-tracker.ts +438 -0
- package/src/errors/base.ts +81 -0
- package/src/errors/file.ts +183 -0
- package/src/errors/index.ts +95 -0
- package/src/errors/llm.ts +151 -0
- package/src/errors/network.ts +124 -0
- package/src/errors/validation.ts +111 -0
- package/src/eval/eval-runner.ts +456 -0
- package/src/eval/index.ts +8 -0
- package/src/eval/types.ts +139 -0
- package/src/index.ts +22 -0
- package/src/orchestration/index.ts +30 -0
- package/src/orchestration/plan-executor.ts +652 -0
- package/src/orchestration/types.ts +127 -0
- package/src/orchestration/utils.ts +119 -0
- package/src/orquesta/connection.ts +291 -0
- package/src/prompts/agents/docs-search-decision.ts +74 -0
- package/src/prompts/agents/docs-search.ts +84 -0
- package/src/prompts/agents/planning.ts +143 -0
- package/src/prompts/index.ts +31 -0
- package/src/prompts/shared/codebase-rules.ts +29 -0
- package/src/prompts/shared/git-rules.ts +94 -0
- package/src/prompts/shared/language-rules.ts +36 -0
- package/src/prompts/shared/tool-usage.ts +72 -0
- package/src/prompts/system/compact.ts +80 -0
- package/src/prompts/system/plan-execute.ts +89 -0
- package/src/tools/browser/browser-client.ts +1363 -0
- package/src/tools/browser/browser-tools.ts +1139 -0
- package/src/tools/browser/index.ts +65 -0
- package/src/tools/index.ts +23 -0
- package/src/tools/llm/agents/docs-search-tools.ts +368 -0
- package/src/tools/llm/agents/index.ts +22 -0
- package/src/tools/llm/index.ts +11 -0
- package/src/tools/llm/simple/ask-user-tool.ts +25 -0
- package/src/tools/llm/simple/background-bash-tool.ts +443 -0
- package/src/tools/llm/simple/background-powershell-tool.ts +421 -0
- package/src/tools/llm/simple/bash-tool.ts +238 -0
- package/src/tools/llm/simple/docs-search-agent-tool.ts +146 -0
- package/src/tools/llm/simple/file-tools.ts +1051 -0
- package/src/tools/llm/simple/final-response-tool.ts +180 -0
- package/src/tools/llm/simple/index.ts +42 -0
- package/src/tools/llm/simple/planning-tools.ts +143 -0
- package/src/tools/llm/simple/powershell-tool.ts +241 -0
- package/src/tools/llm/simple/simple-tool-executor.ts +279 -0
- package/src/tools/llm/simple/todo-tools.ts +207 -0
- package/src/tools/llm/simple/user-interaction-tools.ts +277 -0
- package/src/tools/office/common/constants.ts +335 -0
- package/src/tools/office/common/index.ts +133 -0
- package/src/tools/office/common/types.ts +286 -0
- package/src/tools/office/common/utils.ts +116 -0
- package/src/tools/office/excel-client.ts +1336 -0
- package/src/tools/office/excel-tools/cells.ts +359 -0
- package/src/tools/office/excel-tools/charts.ts +166 -0
- package/src/tools/office/excel-tools/comments.ts +155 -0
- package/src/tools/office/excel-tools/data-ops.ts +349 -0
- package/src/tools/office/excel-tools/export.ts +105 -0
- package/src/tools/office/excel-tools/formatting.ts +357 -0
- package/src/tools/office/excel-tools/index.ts +55 -0
- package/src/tools/office/excel-tools/launch.ts +303 -0
- package/src/tools/office/excel-tools/media.ts +117 -0
- package/src/tools/office/excel-tools/named-ranges.ts +148 -0
- package/src/tools/office/excel-tools/protection.ts +105 -0
- package/src/tools/office/excel-tools/rows-columns.ts +386 -0
- package/src/tools/office/excel-tools/sheets.ts +228 -0
- package/src/tools/office/excel-tools/validation.ts +226 -0
- package/src/tools/office/excel-tools.ts +9 -0
- package/src/tools/office/index.ts +259 -0
- package/src/tools/office/office-client-base.ts +242 -0
- package/src/tools/office/office-client.ts +377 -0
- package/src/tools/office/powerpoint-client.ts +1498 -0
- package/src/tools/office/powerpoint-tools/effects.ts +315 -0
- package/src/tools/office/powerpoint-tools/export.ts +138 -0
- package/src/tools/office/powerpoint-tools/index.ts +45 -0
- package/src/tools/office/powerpoint-tools/launch.ts +263 -0
- package/src/tools/office/powerpoint-tools/media.ts +291 -0
- package/src/tools/office/powerpoint-tools/notes.ts +220 -0
- package/src/tools/office/powerpoint-tools/sections.ts +140 -0
- package/src/tools/office/powerpoint-tools/shapes.ts +870 -0
- package/src/tools/office/powerpoint-tools/slides.ts +350 -0
- package/src/tools/office/powerpoint-tools/tables.ts +182 -0
- package/src/tools/office/powerpoint-tools/text.ts +473 -0
- package/src/tools/office/powerpoint-tools.ts +9 -0
- package/src/tools/office/word-client.ts +1697 -0
- package/src/tools/office/word-tools/bookmarks.ts +186 -0
- package/src/tools/office/word-tools/comments.ts +185 -0
- package/src/tools/office/word-tools/content.ts +229 -0
- package/src/tools/office/word-tools/export.ts +97 -0
- package/src/tools/office/word-tools/formatting.ts +161 -0
- package/src/tools/office/word-tools/headers-footers.ts +155 -0
- package/src/tools/office/word-tools/index.ts +57 -0
- package/src/tools/office/word-tools/launch.ts +312 -0
- package/src/tools/office/word-tools/lists.ts +97 -0
- package/src/tools/office/word-tools/navigation.ts +114 -0
- package/src/tools/office/word-tools/page-setup.ts +195 -0
- package/src/tools/office/word-tools/tables.ts +262 -0
- package/src/tools/office/word-tools/text.ts +294 -0
- package/src/tools/office/word-tools/undo-redo.ts +97 -0
- package/src/tools/office/word-tools/watermarks.ts +105 -0
- package/src/tools/office/word-tools.ts +9 -0
- package/src/tools/registry.ts +527 -0
- package/src/tools/types.ts +231 -0
- package/src/types/index.ts +181 -0
- package/src/ui/PlanExecuteView.tsx +119 -0
- package/src/ui/TodoPanel.tsx +240 -0
- package/src/ui/UpdateNotification.tsx +105 -0
- package/src/ui/components/ActivityIndicator.tsx +234 -0
- package/src/ui/components/CommandBrowser.tsx +114 -0
- package/src/ui/components/CustomTextInput.tsx +389 -0
- package/src/ui/components/DocsSearchProgress.tsx +85 -0
- package/src/ui/components/FileBrowser.tsx +93 -0
- package/src/ui/components/LLMSetupWizard.tsx +333 -0
- package/src/ui/components/Logo.tsx +125 -0
- package/src/ui/components/MarkdownRenderer.tsx +358 -0
- package/src/ui/components/ModelSelector.tsx +203 -0
- package/src/ui/components/PlanExecuteApp.tsx +2007 -0
- package/src/ui/components/ProgressBar.tsx +51 -0
- package/src/ui/components/StatusBar.tsx +302 -0
- package/src/ui/components/ThinkingIndicator.tsx +120 -0
- package/src/ui/components/TodoListView.tsx +140 -0
- package/src/ui/components/ToolSelector.tsx +215 -0
- package/src/ui/components/dialogs/ApprovalDialog.tsx +259 -0
- package/src/ui/components/dialogs/AskUserDialog.tsx +159 -0
- package/src/ui/components/dialogs/DocsBrowser.tsx +222 -0
- package/src/ui/components/dialogs/SettingsDialog.tsx +939 -0
- package/src/ui/components/dialogs/index.ts +13 -0
- package/src/ui/components/index.ts +27 -0
- package/src/ui/components/panels/LogPanel.tsx +385 -0
- package/src/ui/components/panels/SessionPanel.tsx +146 -0
- package/src/ui/components/panels/index.ts +13 -0
- package/src/ui/components/views/ChatView.tsx +447 -0
- package/src/ui/components/views/index.ts +5 -0
- package/src/ui/contexts/TokenContext.tsx +139 -0
- package/src/ui/hooks/atFileProcessor.ts +167 -0
- package/src/ui/hooks/index.ts +11 -0
- package/src/ui/hooks/slashCommandProcessor.ts +174 -0
- package/src/ui/hooks/useCommandBrowserState.ts +97 -0
- package/src/ui/hooks/useFileBrowserState.ts +116 -0
- package/src/ui/hooks/useFileList.ts +132 -0
- package/src/ui/hooks/useInputHistory.ts +89 -0
- package/src/ui/hooks/usePlanExecution.ts +339 -0
- package/src/ui/index.ts +10 -0
- package/src/ui/ink-entry.tsx +36 -0
- package/src/utils/env-filter.ts +164 -0
- package/src/utils/file-system.ts +133 -0
- package/src/utils/git-utils.ts +30 -0
- package/src/utils/json-stream-logger.ts +1259 -0
- package/src/utils/logger.ts +2767 -0
- package/src/utils/platform-utils.ts +256 -0
- package/src/utils/wsl-utils.ts +113 -0
- package/tsconfig.electron.json +39 -0
- package/tsconfig.json +64 -0
|
@@ -0,0 +1,2767 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger Utility
|
|
3
|
+
*
|
|
4
|
+
* Verbose logging for debugging with full flow tracking
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { getJsonStreamLogger } from './json-stream-logger.js';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
|
|
11
|
+
export enum LogLevel {
|
|
12
|
+
ERROR = 0,
|
|
13
|
+
WARN = 1,
|
|
14
|
+
INFO = 2,
|
|
15
|
+
DEBUG = 3,
|
|
16
|
+
VERBOSE = 4,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// LLM logging dedicated flag (--llm-log mode)
|
|
20
|
+
let llmLogEnabled = false;
|
|
21
|
+
|
|
22
|
+
export function enableLLMLog(): void {
|
|
23
|
+
llmLogEnabled = true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function disableLLMLog(): void {
|
|
27
|
+
llmLogEnabled = false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function isLLMLogEnabled(): boolean {
|
|
31
|
+
return llmLogEnabled;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface LoggerOptions {
|
|
35
|
+
level?: LogLevel;
|
|
36
|
+
prefix?: string;
|
|
37
|
+
timestamp?: boolean;
|
|
38
|
+
showLocation?: boolean; // Show filename, function name, line number
|
|
39
|
+
showPid?: boolean; // Show process ID
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface CallLocation {
|
|
43
|
+
file: string;
|
|
44
|
+
line: number;
|
|
45
|
+
column: number;
|
|
46
|
+
function: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface VariableLog {
|
|
50
|
+
name: string;
|
|
51
|
+
value: unknown;
|
|
52
|
+
type?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Logger class for structured logging with flow tracking
|
|
57
|
+
*/
|
|
58
|
+
export class Logger {
|
|
59
|
+
private level: LogLevel;
|
|
60
|
+
private prefix: string;
|
|
61
|
+
private showTimestamp: boolean;
|
|
62
|
+
private showLocation: boolean;
|
|
63
|
+
private showPid: boolean;
|
|
64
|
+
private traceId: string | null = null;
|
|
65
|
+
private timers: Map<string, number> = new Map();
|
|
66
|
+
|
|
67
|
+
constructor(options: LoggerOptions = {}) {
|
|
68
|
+
this.level = options.level ?? LogLevel.INFO;
|
|
69
|
+
this.prefix = options.prefix ?? '';
|
|
70
|
+
this.showTimestamp = options.timestamp ?? true;
|
|
71
|
+
this.showLocation = options.showLocation ?? true;
|
|
72
|
+
this.showPid = options.showPid ?? false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Set log level
|
|
77
|
+
*/
|
|
78
|
+
setLevel(level: LogLevel): void {
|
|
79
|
+
this.level = level;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Set trace ID for flow tracking
|
|
84
|
+
*/
|
|
85
|
+
setTraceId(traceId: string): void {
|
|
86
|
+
this.traceId = traceId;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Clear trace ID
|
|
91
|
+
*/
|
|
92
|
+
clearTraceId(): void {
|
|
93
|
+
this.traceId = null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get current trace ID
|
|
98
|
+
*/
|
|
99
|
+
getTraceId(): string | null {
|
|
100
|
+
return this.traceId;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Get call location from stack trace
|
|
105
|
+
*/
|
|
106
|
+
private getCallLocation(depth: number = 3): CallLocation | null {
|
|
107
|
+
try {
|
|
108
|
+
const stack = new Error().stack;
|
|
109
|
+
if (!stack) return null;
|
|
110
|
+
|
|
111
|
+
const lines = stack.split('\n');
|
|
112
|
+
if (lines.length <= depth) return null;
|
|
113
|
+
|
|
114
|
+
// Extract file, line, column from stack trace
|
|
115
|
+
// Format: " at functionName (file:line:column)" or " at file:line:column"
|
|
116
|
+
const line = lines[depth];
|
|
117
|
+
if (!line) return null;
|
|
118
|
+
|
|
119
|
+
const match = line.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?/);
|
|
120
|
+
|
|
121
|
+
if (!match) return null;
|
|
122
|
+
|
|
123
|
+
const [, functionName, file, lineNum, column] = match;
|
|
124
|
+
|
|
125
|
+
if (!file || !lineNum || !column) return null;
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
file: path.basename(file),
|
|
129
|
+
line: parseInt(lineNum),
|
|
130
|
+
column: parseInt(column),
|
|
131
|
+
function: functionName?.trim() || '<anonymous>',
|
|
132
|
+
};
|
|
133
|
+
} catch {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Get formatted timestamp
|
|
140
|
+
*/
|
|
141
|
+
private getTimestamp(): string {
|
|
142
|
+
if (!this.showTimestamp) return '';
|
|
143
|
+
const now = new Date();
|
|
144
|
+
return chalk.gray(`[${now.toISOString()}]`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get formatted prefix
|
|
149
|
+
*/
|
|
150
|
+
private getPrefix(): string {
|
|
151
|
+
if (!this.prefix) return '';
|
|
152
|
+
return chalk.cyan(`[${this.prefix}]`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Get formatted process ID
|
|
157
|
+
*/
|
|
158
|
+
private getPid(): string {
|
|
159
|
+
if (!this.showPid) return '';
|
|
160
|
+
return chalk.dim(`[PID:${process.pid}]`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Get formatted trace ID
|
|
165
|
+
*/
|
|
166
|
+
private getTraceIdStr(): string {
|
|
167
|
+
if (!this.traceId) return '';
|
|
168
|
+
return chalk.magenta(`[Trace:${this.traceId.slice(0, 8)}]`);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Get formatted location
|
|
173
|
+
*/
|
|
174
|
+
private getLocation(location: CallLocation | null): string {
|
|
175
|
+
if (!this.showLocation || !location) return '';
|
|
176
|
+
return chalk.dim(`[${location.file}:${location.line}:${location.function}]`);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Format variable for logging
|
|
181
|
+
*/
|
|
182
|
+
private formatVariable(variable: VariableLog): string {
|
|
183
|
+
const type = variable.type || typeof variable.value;
|
|
184
|
+
const valueStr = this.formatValue(variable.value);
|
|
185
|
+
return chalk.yellow(variable.name) + chalk.gray('=') + chalk.white(valueStr) + chalk.dim(` (${type})`);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Format value for display
|
|
190
|
+
*/
|
|
191
|
+
private formatValue(value: unknown): string {
|
|
192
|
+
if (value === null) return 'null';
|
|
193
|
+
if (value === undefined) return 'undefined';
|
|
194
|
+
if (typeof value === 'string') return `"${value}"`;
|
|
195
|
+
if (typeof value === 'number' || typeof value === 'boolean') return String(value);
|
|
196
|
+
if (typeof value === 'function') return '[Function]';
|
|
197
|
+
if (Array.isArray(value)) return `Array(${value.length})`;
|
|
198
|
+
if (value instanceof Error) return `Error: ${value.message}`;
|
|
199
|
+
try {
|
|
200
|
+
const json = JSON.stringify(value);
|
|
201
|
+
return json.length > 100 ? json.slice(0, 100) + '...' : json;
|
|
202
|
+
} catch {
|
|
203
|
+
return '[Object]';
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Log error
|
|
209
|
+
*/
|
|
210
|
+
error(message: string, error?: Error | unknown): void {
|
|
211
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
212
|
+
const jsonLogger = getJsonStreamLogger();
|
|
213
|
+
if (jsonLogger?.isActive()) {
|
|
214
|
+
jsonLogger.logError(error || new Error(message), this.prefix || 'logger');
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Console output controlled by log level
|
|
218
|
+
if (this.level < LogLevel.ERROR) return;
|
|
219
|
+
|
|
220
|
+
const location = this.getCallLocation();
|
|
221
|
+
const timestamp = this.getTimestamp();
|
|
222
|
+
const prefix = this.getPrefix();
|
|
223
|
+
const pid = this.getPid();
|
|
224
|
+
const traceId = this.getTraceIdStr();
|
|
225
|
+
const loc = this.getLocation(location);
|
|
226
|
+
|
|
227
|
+
console.error(
|
|
228
|
+
timestamp,
|
|
229
|
+
prefix,
|
|
230
|
+
pid,
|
|
231
|
+
traceId,
|
|
232
|
+
loc,
|
|
233
|
+
chalk.red('❌ ERROR:'),
|
|
234
|
+
message
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
if (error) {
|
|
238
|
+
if (error instanceof Error) {
|
|
239
|
+
console.error(chalk.red(' Message:'), error.message);
|
|
240
|
+
if (error.stack) {
|
|
241
|
+
console.error(chalk.gray(' Stack:'));
|
|
242
|
+
console.error(chalk.gray(error.stack));
|
|
243
|
+
}
|
|
244
|
+
// Show cause if available
|
|
245
|
+
if ((error as any).cause) {
|
|
246
|
+
console.error(chalk.red(' Cause:'), (error as any).cause);
|
|
247
|
+
}
|
|
248
|
+
// Show details if available (custom errors)
|
|
249
|
+
if ((error as any).details) {
|
|
250
|
+
console.error(chalk.yellow(' Details:'), JSON.stringify((error as any).details, null, 2));
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
253
|
+
console.error(chalk.red(' Error:'), error);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Log warning
|
|
260
|
+
*/
|
|
261
|
+
warn(message: string, data?: unknown): void {
|
|
262
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
263
|
+
const jsonLogger = getJsonStreamLogger();
|
|
264
|
+
if (jsonLogger?.isActive()) {
|
|
265
|
+
jsonLogger.logInfo(`[WARN] ${message}`, data);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Console output controlled by log level
|
|
269
|
+
if (this.level < LogLevel.WARN) return;
|
|
270
|
+
|
|
271
|
+
const location = this.getCallLocation();
|
|
272
|
+
const timestamp = this.getTimestamp();
|
|
273
|
+
const prefix = this.getPrefix();
|
|
274
|
+
const pid = this.getPid();
|
|
275
|
+
const traceId = this.getTraceIdStr();
|
|
276
|
+
const loc = this.getLocation(location);
|
|
277
|
+
|
|
278
|
+
console.warn(
|
|
279
|
+
timestamp,
|
|
280
|
+
prefix,
|
|
281
|
+
pid,
|
|
282
|
+
traceId,
|
|
283
|
+
loc,
|
|
284
|
+
chalk.yellow('⚠️ WARN:'),
|
|
285
|
+
message
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
if (data) {
|
|
289
|
+
console.warn(chalk.yellow(' Data:'), JSON.stringify(data, null, 2));
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Log info
|
|
295
|
+
*/
|
|
296
|
+
info(message: string, data?: unknown): void {
|
|
297
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
298
|
+
const jsonLogger = getJsonStreamLogger();
|
|
299
|
+
if (jsonLogger?.isActive()) {
|
|
300
|
+
jsonLogger.logInfo(message, data);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Console output controlled by log level
|
|
304
|
+
if (this.level < LogLevel.INFO) return;
|
|
305
|
+
|
|
306
|
+
const location = this.getCallLocation();
|
|
307
|
+
const timestamp = this.getTimestamp();
|
|
308
|
+
const prefix = this.getPrefix();
|
|
309
|
+
const pid = this.getPid();
|
|
310
|
+
const traceId = this.getTraceIdStr();
|
|
311
|
+
const loc = this.getLocation(location);
|
|
312
|
+
|
|
313
|
+
console.log(
|
|
314
|
+
timestamp,
|
|
315
|
+
prefix,
|
|
316
|
+
pid,
|
|
317
|
+
traceId,
|
|
318
|
+
loc,
|
|
319
|
+
chalk.blue('ℹ️ INFO:'),
|
|
320
|
+
message
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
if (data) {
|
|
324
|
+
console.log(chalk.blue(' Data:'), JSON.stringify(data, null, 2));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Log debug
|
|
330
|
+
*/
|
|
331
|
+
debug(message: string, data?: unknown): void {
|
|
332
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
333
|
+
const jsonLogger = getJsonStreamLogger();
|
|
334
|
+
if (jsonLogger?.isActive()) {
|
|
335
|
+
jsonLogger.logDebug(message, data);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Console output controlled by log level
|
|
339
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
340
|
+
|
|
341
|
+
const location = this.getCallLocation();
|
|
342
|
+
const timestamp = this.getTimestamp();
|
|
343
|
+
const prefix = this.getPrefix();
|
|
344
|
+
const pid = this.getPid();
|
|
345
|
+
const traceId = this.getTraceIdStr();
|
|
346
|
+
const loc = this.getLocation(location);
|
|
347
|
+
|
|
348
|
+
console.log(
|
|
349
|
+
timestamp,
|
|
350
|
+
prefix,
|
|
351
|
+
pid,
|
|
352
|
+
traceId,
|
|
353
|
+
loc,
|
|
354
|
+
chalk.magenta('🐛 DEBUG:'),
|
|
355
|
+
message
|
|
356
|
+
);
|
|
357
|
+
|
|
358
|
+
if (data) {
|
|
359
|
+
console.log(chalk.magenta(' Data:'), JSON.stringify(data, null, 2));
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Log verbose (most detailed)
|
|
365
|
+
*/
|
|
366
|
+
verbose(message: string, data?: unknown): void {
|
|
367
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
368
|
+
const jsonLogger = getJsonStreamLogger();
|
|
369
|
+
if (jsonLogger?.isActive()) {
|
|
370
|
+
jsonLogger.logDebug(`[VERBOSE] ${message}`, data);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// Console output controlled by log level
|
|
374
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
375
|
+
|
|
376
|
+
const location = this.getCallLocation();
|
|
377
|
+
const timestamp = this.getTimestamp();
|
|
378
|
+
const prefix = this.getPrefix();
|
|
379
|
+
const pid = this.getPid();
|
|
380
|
+
const traceId = this.getTraceIdStr();
|
|
381
|
+
const loc = this.getLocation(location);
|
|
382
|
+
|
|
383
|
+
console.log(
|
|
384
|
+
timestamp,
|
|
385
|
+
prefix,
|
|
386
|
+
pid,
|
|
387
|
+
traceId,
|
|
388
|
+
loc,
|
|
389
|
+
chalk.gray('🔍 VERBOSE:'),
|
|
390
|
+
message
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
if (data) {
|
|
394
|
+
console.log(chalk.gray(' Data:'), JSON.stringify(data, null, 2));
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Log flow - Track execution flow (function calls, branches, etc.)
|
|
400
|
+
*/
|
|
401
|
+
flow(message: string, context?: Record<string, unknown>): void {
|
|
402
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
403
|
+
const jsonLogger = getJsonStreamLogger();
|
|
404
|
+
if (jsonLogger?.isActive()) {
|
|
405
|
+
jsonLogger.logDebug(`[FLOW] ${message}`, context);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// Console output controlled by log level
|
|
409
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
410
|
+
|
|
411
|
+
const location = this.getCallLocation();
|
|
412
|
+
const timestamp = this.getTimestamp();
|
|
413
|
+
const prefix = this.getPrefix();
|
|
414
|
+
const pid = this.getPid();
|
|
415
|
+
const traceId = this.getTraceIdStr();
|
|
416
|
+
const loc = this.getLocation(location);
|
|
417
|
+
|
|
418
|
+
console.log(
|
|
419
|
+
timestamp,
|
|
420
|
+
prefix,
|
|
421
|
+
pid,
|
|
422
|
+
traceId,
|
|
423
|
+
loc,
|
|
424
|
+
chalk.green('➜ FLOW:'),
|
|
425
|
+
message
|
|
426
|
+
);
|
|
427
|
+
|
|
428
|
+
if (context) {
|
|
429
|
+
console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Log variables - Track variable values
|
|
435
|
+
*/
|
|
436
|
+
vars(...variables: VariableLog[]): void {
|
|
437
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
438
|
+
const jsonLogger = getJsonStreamLogger();
|
|
439
|
+
if (jsonLogger?.isActive()) {
|
|
440
|
+
const varsData = variables.reduce((acc, v) => {
|
|
441
|
+
acc[v.name] = v.value;
|
|
442
|
+
return acc;
|
|
443
|
+
}, {} as Record<string, unknown>);
|
|
444
|
+
jsonLogger.logDebug('[VARS]', varsData);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// Console output controlled by log level
|
|
448
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
449
|
+
|
|
450
|
+
const location = this.getCallLocation();
|
|
451
|
+
const timestamp = this.getTimestamp();
|
|
452
|
+
const prefix = this.getPrefix();
|
|
453
|
+
const pid = this.getPid();
|
|
454
|
+
const traceId = this.getTraceIdStr();
|
|
455
|
+
const loc = this.getLocation(location);
|
|
456
|
+
|
|
457
|
+
console.log(
|
|
458
|
+
timestamp,
|
|
459
|
+
prefix,
|
|
460
|
+
pid,
|
|
461
|
+
traceId,
|
|
462
|
+
loc,
|
|
463
|
+
chalk.cyan('📦 VARS:')
|
|
464
|
+
);
|
|
465
|
+
|
|
466
|
+
variables.forEach(variable => {
|
|
467
|
+
console.log(' ', this.formatVariable(variable));
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Log function enter
|
|
473
|
+
*/
|
|
474
|
+
enter(functionName: string, args?: Record<string, unknown>): void {
|
|
475
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
476
|
+
const jsonLogger = getJsonStreamLogger();
|
|
477
|
+
if (jsonLogger?.isActive()) {
|
|
478
|
+
jsonLogger.logDebug(`[ENTER] ${functionName}`, args);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Console output controlled by log level
|
|
482
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
483
|
+
|
|
484
|
+
const location = this.getCallLocation();
|
|
485
|
+
const timestamp = this.getTimestamp();
|
|
486
|
+
const prefix = this.getPrefix();
|
|
487
|
+
const pid = this.getPid();
|
|
488
|
+
const traceId = this.getTraceIdStr();
|
|
489
|
+
const loc = this.getLocation(location);
|
|
490
|
+
|
|
491
|
+
console.log(
|
|
492
|
+
timestamp,
|
|
493
|
+
prefix,
|
|
494
|
+
pid,
|
|
495
|
+
traceId,
|
|
496
|
+
loc,
|
|
497
|
+
chalk.green('↓ ENTER:'),
|
|
498
|
+
chalk.bold(functionName)
|
|
499
|
+
);
|
|
500
|
+
|
|
501
|
+
if (args) {
|
|
502
|
+
console.log(chalk.green(' Args:'), JSON.stringify(args, null, 2));
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Log function exit
|
|
508
|
+
*/
|
|
509
|
+
exit(functionName: string, result?: unknown): void {
|
|
510
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
511
|
+
const jsonLogger = getJsonStreamLogger();
|
|
512
|
+
if (jsonLogger?.isActive()) {
|
|
513
|
+
jsonLogger.logDebug(`[EXIT] ${functionName}`, { result });
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// Console output controlled by log level
|
|
517
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
518
|
+
|
|
519
|
+
const location = this.getCallLocation();
|
|
520
|
+
const timestamp = this.getTimestamp();
|
|
521
|
+
const prefix = this.getPrefix();
|
|
522
|
+
const pid = this.getPid();
|
|
523
|
+
const traceId = this.getTraceIdStr();
|
|
524
|
+
const loc = this.getLocation(location);
|
|
525
|
+
|
|
526
|
+
console.log(
|
|
527
|
+
timestamp,
|
|
528
|
+
prefix,
|
|
529
|
+
pid,
|
|
530
|
+
traceId,
|
|
531
|
+
loc,
|
|
532
|
+
chalk.green('↑ EXIT:'),
|
|
533
|
+
chalk.bold(functionName)
|
|
534
|
+
);
|
|
535
|
+
|
|
536
|
+
if (result !== undefined) {
|
|
537
|
+
console.log(chalk.green(' Result:'), this.formatValue(result));
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Log state change
|
|
543
|
+
*/
|
|
544
|
+
state(description: string, before: unknown, after: unknown): void {
|
|
545
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
546
|
+
const jsonLogger = getJsonStreamLogger();
|
|
547
|
+
if (jsonLogger?.isActive()) {
|
|
548
|
+
jsonLogger.logDebug(`[STATE] ${description}`, { before, after });
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// Console output controlled by log level
|
|
552
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
553
|
+
|
|
554
|
+
const location = this.getCallLocation();
|
|
555
|
+
const timestamp = this.getTimestamp();
|
|
556
|
+
const prefix = this.getPrefix();
|
|
557
|
+
const pid = this.getPid();
|
|
558
|
+
const traceId = this.getTraceIdStr();
|
|
559
|
+
const loc = this.getLocation(location);
|
|
560
|
+
|
|
561
|
+
console.log(
|
|
562
|
+
timestamp,
|
|
563
|
+
prefix,
|
|
564
|
+
pid,
|
|
565
|
+
traceId,
|
|
566
|
+
loc,
|
|
567
|
+
chalk.yellow('🔄 STATE:'),
|
|
568
|
+
description
|
|
569
|
+
);
|
|
570
|
+
|
|
571
|
+
console.log(chalk.red(' Before:'), this.formatValue(before));
|
|
572
|
+
console.log(chalk.green(' After:'), this.formatValue(after));
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Start performance timer
|
|
577
|
+
*/
|
|
578
|
+
startTimer(label: string): void {
|
|
579
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
580
|
+
const jsonLogger = getJsonStreamLogger();
|
|
581
|
+
if (jsonLogger?.isActive()) {
|
|
582
|
+
jsonLogger.logDebug(`[TIMER] Start: ${label}`);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
this.timers.set(label, Date.now());
|
|
586
|
+
|
|
587
|
+
// Console output controlled by log level
|
|
588
|
+
if (this.level >= LogLevel.DEBUG) {
|
|
589
|
+
const location = this.getCallLocation();
|
|
590
|
+
const timestamp = this.getTimestamp();
|
|
591
|
+
const prefix = this.getPrefix();
|
|
592
|
+
const pid = this.getPid();
|
|
593
|
+
const traceId = this.getTraceIdStr();
|
|
594
|
+
const loc = this.getLocation(location);
|
|
595
|
+
|
|
596
|
+
console.log(
|
|
597
|
+
timestamp,
|
|
598
|
+
prefix,
|
|
599
|
+
pid,
|
|
600
|
+
traceId,
|
|
601
|
+
loc,
|
|
602
|
+
chalk.blue('⏱️ TIMER START:'),
|
|
603
|
+
label
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* End performance timer
|
|
610
|
+
*/
|
|
611
|
+
endTimer(label: string): number {
|
|
612
|
+
const startTime = this.timers.get(label);
|
|
613
|
+
if (!startTime) {
|
|
614
|
+
this.warn(`Timer "${label}" was not started`);
|
|
615
|
+
return 0;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
const elapsed = Date.now() - startTime;
|
|
619
|
+
this.timers.delete(label);
|
|
620
|
+
|
|
621
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
622
|
+
const jsonLogger = getJsonStreamLogger();
|
|
623
|
+
if (jsonLogger?.isActive()) {
|
|
624
|
+
jsonLogger.logDebug(`[TIMER] End: ${label}`, { elapsed });
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// Console output controlled by log level
|
|
628
|
+
if (this.level >= LogLevel.DEBUG) {
|
|
629
|
+
const location = this.getCallLocation();
|
|
630
|
+
const timestamp = this.getTimestamp();
|
|
631
|
+
const prefix = this.getPrefix();
|
|
632
|
+
const pid = this.getPid();
|
|
633
|
+
const traceId = this.getTraceIdStr();
|
|
634
|
+
const loc = this.getLocation(location);
|
|
635
|
+
|
|
636
|
+
console.log(
|
|
637
|
+
timestamp,
|
|
638
|
+
prefix,
|
|
639
|
+
pid,
|
|
640
|
+
traceId,
|
|
641
|
+
loc,
|
|
642
|
+
chalk.blue('⏱️ TIMER END:'),
|
|
643
|
+
label,
|
|
644
|
+
chalk.bold(`${elapsed}ms`)
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
return elapsed;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Log HTTP request
|
|
653
|
+
*/
|
|
654
|
+
httpRequest(method: string, url: string, body?: unknown): void {
|
|
655
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
656
|
+
const jsonLogger = getJsonStreamLogger();
|
|
657
|
+
if (jsonLogger?.isActive()) {
|
|
658
|
+
jsonLogger.logDebug(`HTTP ${method} ${url}`, { body });
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// Console output controlled by log level
|
|
662
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
663
|
+
|
|
664
|
+
const location = this.getCallLocation();
|
|
665
|
+
const timestamp = this.getTimestamp();
|
|
666
|
+
const prefix = this.getPrefix();
|
|
667
|
+
const pid = this.getPid();
|
|
668
|
+
const traceId = this.getTraceIdStr();
|
|
669
|
+
const loc = this.getLocation(location);
|
|
670
|
+
|
|
671
|
+
console.log(
|
|
672
|
+
timestamp,
|
|
673
|
+
prefix,
|
|
674
|
+
pid,
|
|
675
|
+
traceId,
|
|
676
|
+
loc,
|
|
677
|
+
chalk.cyan('→ HTTP REQUEST:'),
|
|
678
|
+
chalk.bold(method),
|
|
679
|
+
url
|
|
680
|
+
);
|
|
681
|
+
|
|
682
|
+
if (body) {
|
|
683
|
+
console.log(chalk.cyan(' Body:'), JSON.stringify(body, null, 2));
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Log HTTP response
|
|
689
|
+
*/
|
|
690
|
+
httpResponse(status: number, statusText: string, data?: unknown): void {
|
|
691
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
692
|
+
const jsonLogger = getJsonStreamLogger();
|
|
693
|
+
if (jsonLogger?.isActive()) {
|
|
694
|
+
jsonLogger.logDebug(`HTTP Response ${status} ${statusText}`, { status, statusText, data });
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// Console output controlled by log level
|
|
698
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
699
|
+
|
|
700
|
+
const location = this.getCallLocation();
|
|
701
|
+
const timestamp = this.getTimestamp();
|
|
702
|
+
const prefix = this.getPrefix();
|
|
703
|
+
const pid = this.getPid();
|
|
704
|
+
const traceId = this.getTraceIdStr();
|
|
705
|
+
const loc = this.getLocation(location);
|
|
706
|
+
const statusColor = status >= 400 ? chalk.red : status >= 300 ? chalk.yellow : chalk.green;
|
|
707
|
+
|
|
708
|
+
console.log(
|
|
709
|
+
timestamp,
|
|
710
|
+
prefix,
|
|
711
|
+
pid,
|
|
712
|
+
traceId,
|
|
713
|
+
loc,
|
|
714
|
+
chalk.cyan('← HTTP RESPONSE:'),
|
|
715
|
+
statusColor(`${status} ${statusText}`)
|
|
716
|
+
);
|
|
717
|
+
|
|
718
|
+
if (data && this.level >= LogLevel.VERBOSE) {
|
|
719
|
+
console.log(chalk.cyan(' Data:'), JSON.stringify(data, null, 2));
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Log tool execution
|
|
725
|
+
*/
|
|
726
|
+
toolExecution(toolName: string, args: unknown, result?: unknown, error?: Error): void {
|
|
727
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
728
|
+
const jsonLogger = getJsonStreamLogger();
|
|
729
|
+
if (jsonLogger?.isActive()) {
|
|
730
|
+
jsonLogger.logToolCall(toolName, args, result, error);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// Console output controlled by log level
|
|
734
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
735
|
+
|
|
736
|
+
const location = this.getCallLocation();
|
|
737
|
+
const timestamp = this.getTimestamp();
|
|
738
|
+
const prefix = this.getPrefix();
|
|
739
|
+
const pid = this.getPid();
|
|
740
|
+
const traceId = this.getTraceIdStr();
|
|
741
|
+
const loc = this.getLocation(location);
|
|
742
|
+
|
|
743
|
+
if (error) {
|
|
744
|
+
console.log(
|
|
745
|
+
timestamp,
|
|
746
|
+
prefix,
|
|
747
|
+
pid,
|
|
748
|
+
traceId,
|
|
749
|
+
loc,
|
|
750
|
+
chalk.red('🔧 TOOL FAILED:'),
|
|
751
|
+
chalk.bold(toolName)
|
|
752
|
+
);
|
|
753
|
+
console.log(chalk.red(' Args:'), JSON.stringify(args, null, 2));
|
|
754
|
+
console.log(chalk.red(' Error:'), error.message);
|
|
755
|
+
} else {
|
|
756
|
+
console.log(
|
|
757
|
+
timestamp,
|
|
758
|
+
prefix,
|
|
759
|
+
pid,
|
|
760
|
+
traceId,
|
|
761
|
+
loc,
|
|
762
|
+
chalk.green('🔧 TOOL SUCCESS:'),
|
|
763
|
+
chalk.bold(toolName)
|
|
764
|
+
);
|
|
765
|
+
console.log(chalk.green(' Args:'), JSON.stringify(args, null, 2));
|
|
766
|
+
if (result && this.level >= LogLevel.VERBOSE) {
|
|
767
|
+
console.log(chalk.green(' Result:'), JSON.stringify(result, null, 2));
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Log bash command execution with formatted display
|
|
774
|
+
*/
|
|
775
|
+
bashExecution(formattedDisplay: string): void {
|
|
776
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
777
|
+
const jsonLogger = getJsonStreamLogger();
|
|
778
|
+
if (jsonLogger?.isActive()) {
|
|
779
|
+
jsonLogger.logDebug('[BASH] Execution', { output: formattedDisplay });
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
// Console output controlled by log level
|
|
783
|
+
if (this.level < LogLevel.INFO) return;
|
|
784
|
+
|
|
785
|
+
// Split formatted display into lines and colorize
|
|
786
|
+
const lines = formattedDisplay.split('\n');
|
|
787
|
+
lines.forEach((line) => {
|
|
788
|
+
if (line.startsWith('●')) {
|
|
789
|
+
// Command header in cyan
|
|
790
|
+
console.log(chalk.cyan(line));
|
|
791
|
+
} else if (line.includes('Error:')) {
|
|
792
|
+
// Error lines in red
|
|
793
|
+
console.log(chalk.red(line));
|
|
794
|
+
} else {
|
|
795
|
+
// Output lines in default color
|
|
796
|
+
console.log(line);
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
// Add blank line after output for better readability
|
|
801
|
+
console.log();
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Log LLM request (--llm-log mode only)
|
|
806
|
+
*/
|
|
807
|
+
llmRequest(messages: unknown[], model: string, tools?: unknown[]): void {
|
|
808
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
809
|
+
const jsonLogger = getJsonStreamLogger();
|
|
810
|
+
if (jsonLogger?.isActive()) {
|
|
811
|
+
jsonLogger.logDebug('[LLM] Request', { model, messageCount: messages?.length, toolCount: tools?.length });
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// Console output only in --llm-log mode
|
|
815
|
+
if (!llmLogEnabled) return;
|
|
816
|
+
|
|
817
|
+
const timestamp = this.getTimestamp();
|
|
818
|
+
console.log();
|
|
819
|
+
console.log(chalk.cyan('─'.repeat(80)));
|
|
820
|
+
console.log(chalk.cyan.bold(`[${timestamp}] 📤 LLM REQUEST`));
|
|
821
|
+
console.log(chalk.gray(`Model: ${model}`));
|
|
822
|
+
if (tools && Array.isArray(tools) && tools.length > 0) {
|
|
823
|
+
console.log(chalk.gray(`Tools: ${tools.length} available`));
|
|
824
|
+
}
|
|
825
|
+
console.log(chalk.cyan('─'.repeat(40)));
|
|
826
|
+
|
|
827
|
+
// Show messages
|
|
828
|
+
if (Array.isArray(messages)) {
|
|
829
|
+
messages.forEach((msg: any, idx) => {
|
|
830
|
+
const role = msg.role || 'unknown';
|
|
831
|
+
const content = msg.content || '';
|
|
832
|
+
const roleColor = role === 'user' ? chalk.green : role === 'assistant' ? chalk.blue : chalk.yellow;
|
|
833
|
+
|
|
834
|
+
console.log(roleColor.bold(`[${role.toUpperCase()}]`));
|
|
835
|
+
if (content) {
|
|
836
|
+
// Truncate very long content
|
|
837
|
+
const displayContent = content.length > 2000
|
|
838
|
+
? content.substring(0, 2000) + chalk.gray(`\n... (${content.length - 2000} more chars)`)
|
|
839
|
+
: content;
|
|
840
|
+
console.log(displayContent);
|
|
841
|
+
}
|
|
842
|
+
if (msg.tool_calls && msg.tool_calls.length > 0) {
|
|
843
|
+
console.log(chalk.yellow(` Tool calls: ${msg.tool_calls.map((tc: any) => tc.function?.name).join(', ')}`));
|
|
844
|
+
}
|
|
845
|
+
if (idx < messages.length - 1) console.log();
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
console.log(chalk.cyan('─'.repeat(80)));
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Log LLM response (--llm-log mode only)
|
|
853
|
+
*/
|
|
854
|
+
llmResponse(response: string, toolCalls?: unknown[]): void {
|
|
855
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
856
|
+
const jsonLogger = getJsonStreamLogger();
|
|
857
|
+
if (jsonLogger?.isActive()) {
|
|
858
|
+
jsonLogger.logDebug('[LLM] Response', { responseLength: response?.length, toolCallCount: toolCalls?.length });
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
// Console output only in --llm-log mode
|
|
862
|
+
if (!llmLogEnabled) return;
|
|
863
|
+
|
|
864
|
+
const timestamp = this.getTimestamp();
|
|
865
|
+
console.log();
|
|
866
|
+
console.log(chalk.green('─'.repeat(80)));
|
|
867
|
+
console.log(chalk.green.bold(`[${timestamp}] 📥 LLM RESPONSE`));
|
|
868
|
+
console.log(chalk.green('─'.repeat(40)));
|
|
869
|
+
|
|
870
|
+
// Truncate very long response
|
|
871
|
+
const displayResponse = response.length > 3000
|
|
872
|
+
? response.substring(0, 3000) + chalk.gray(`\n... (${response.length - 3000} more chars)`)
|
|
873
|
+
: response;
|
|
874
|
+
console.log(displayResponse);
|
|
875
|
+
|
|
876
|
+
if (toolCalls && Array.isArray(toolCalls) && toolCalls.length > 0) {
|
|
877
|
+
console.log();
|
|
878
|
+
console.log(chalk.yellow.bold('Tool Calls:'));
|
|
879
|
+
toolCalls.forEach((tc: any) => {
|
|
880
|
+
console.log(chalk.yellow(` - ${tc.function?.name}:`));
|
|
881
|
+
// Pretty print full arguments JSON
|
|
882
|
+
try {
|
|
883
|
+
const args = JSON.parse(tc.function?.arguments || '{}');
|
|
884
|
+
console.log(chalk.gray(JSON.stringify(args, null, 2)));
|
|
885
|
+
} catch {
|
|
886
|
+
console.log(chalk.gray(tc.function?.arguments || '(no arguments)'));
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
console.log(chalk.green('─'.repeat(80)));
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Log tool execution result (--llm-log mode only)
|
|
895
|
+
*/
|
|
896
|
+
llmToolResult(toolName: string, result: string, success: boolean): void {
|
|
897
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
898
|
+
const jsonLogger = getJsonStreamLogger();
|
|
899
|
+
if (jsonLogger?.isActive()) {
|
|
900
|
+
jsonLogger.logDebug(`[LLM] Tool Result: ${toolName}`, { success, resultLength: result?.length });
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
// Console output only in --llm-log mode
|
|
904
|
+
if (!llmLogEnabled) return;
|
|
905
|
+
|
|
906
|
+
const timestamp = this.getTimestamp();
|
|
907
|
+
const color = success ? chalk.cyan : chalk.red;
|
|
908
|
+
console.log();
|
|
909
|
+
console.log(color('─'.repeat(80)));
|
|
910
|
+
console.log(color.bold(`[${timestamp}] 🔧 TOOL: ${toolName} ${success ? '✓' : '✗'}`));
|
|
911
|
+
console.log(color('─'.repeat(40)));
|
|
912
|
+
|
|
913
|
+
// Truncate very long result
|
|
914
|
+
const displayResult = result.length > 1000
|
|
915
|
+
? result.substring(0, 1000) + chalk.gray(`\n... (${result.length - 1000} more chars)`)
|
|
916
|
+
: result;
|
|
917
|
+
console.log(displayResult);
|
|
918
|
+
console.log(color('─'.repeat(80)));
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// ============================================================================
|
|
922
|
+
// HTTP Extended Methods
|
|
923
|
+
// ============================================================================
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Log HTTP error
|
|
927
|
+
*/
|
|
928
|
+
httpError(url: string, error: Error | unknown): void {
|
|
929
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
930
|
+
const jsonLogger = getJsonStreamLogger();
|
|
931
|
+
if (jsonLogger?.isActive()) {
|
|
932
|
+
jsonLogger.logError(error instanceof Error ? error : new Error(String(error)), `HTTP ${url}`);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// Console output controlled by log level
|
|
936
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
937
|
+
|
|
938
|
+
const location = this.getCallLocation();
|
|
939
|
+
const timestamp = this.getTimestamp();
|
|
940
|
+
const prefix = this.getPrefix();
|
|
941
|
+
const pid = this.getPid();
|
|
942
|
+
const traceId = this.getTraceIdStr();
|
|
943
|
+
const loc = this.getLocation(location);
|
|
944
|
+
|
|
945
|
+
console.log(
|
|
946
|
+
timestamp,
|
|
947
|
+
prefix,
|
|
948
|
+
pid,
|
|
949
|
+
traceId,
|
|
950
|
+
loc,
|
|
951
|
+
chalk.red('✗ HTTP ERROR:'),
|
|
952
|
+
url
|
|
953
|
+
);
|
|
954
|
+
|
|
955
|
+
if (error instanceof Error) {
|
|
956
|
+
console.log(chalk.red(' Message:'), error.message);
|
|
957
|
+
} else {
|
|
958
|
+
console.log(chalk.red(' Error:'), error);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Log HTTP stream start
|
|
964
|
+
*/
|
|
965
|
+
httpStreamStart(method: string, url: string): void {
|
|
966
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
967
|
+
const jsonLogger = getJsonStreamLogger();
|
|
968
|
+
if (jsonLogger?.isActive()) {
|
|
969
|
+
jsonLogger.logDebug(`HTTP Stream Start: ${method} ${url}`);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
// Console output controlled by log level
|
|
973
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
974
|
+
|
|
975
|
+
const location = this.getCallLocation();
|
|
976
|
+
const timestamp = this.getTimestamp();
|
|
977
|
+
const prefix = this.getPrefix();
|
|
978
|
+
const pid = this.getPid();
|
|
979
|
+
const traceId = this.getTraceIdStr();
|
|
980
|
+
const loc = this.getLocation(location);
|
|
981
|
+
|
|
982
|
+
console.log(
|
|
983
|
+
timestamp,
|
|
984
|
+
prefix,
|
|
985
|
+
pid,
|
|
986
|
+
traceId,
|
|
987
|
+
loc,
|
|
988
|
+
chalk.cyan('⇢ HTTP STREAM START:'),
|
|
989
|
+
chalk.bold(method),
|
|
990
|
+
url
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* Log HTTP stream chunk
|
|
996
|
+
*/
|
|
997
|
+
httpStreamChunk(data: unknown): void {
|
|
998
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
999
|
+
const chunkSize = typeof data === 'string' ? data.length : JSON.stringify(data).length;
|
|
1000
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1001
|
+
if (jsonLogger?.isActive()) {
|
|
1002
|
+
jsonLogger.logDebug('[HTTP] Stream Chunk', { bytes: chunkSize });
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// Console output controlled by log level
|
|
1006
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
1007
|
+
|
|
1008
|
+
const location = this.getCallLocation();
|
|
1009
|
+
const timestamp = this.getTimestamp();
|
|
1010
|
+
const prefix = this.getPrefix();
|
|
1011
|
+
const pid = this.getPid();
|
|
1012
|
+
const traceId = this.getTraceIdStr();
|
|
1013
|
+
const loc = this.getLocation(location);
|
|
1014
|
+
|
|
1015
|
+
console.log(
|
|
1016
|
+
timestamp,
|
|
1017
|
+
prefix,
|
|
1018
|
+
pid,
|
|
1019
|
+
traceId,
|
|
1020
|
+
loc,
|
|
1021
|
+
chalk.gray('⇨ HTTP STREAM CHUNK:'),
|
|
1022
|
+
`${chunkSize} bytes`
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Log HTTP stream end
|
|
1028
|
+
*/
|
|
1029
|
+
httpStreamEnd(totalBytes: number, duration: number): void {
|
|
1030
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1031
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1032
|
+
if (jsonLogger?.isActive()) {
|
|
1033
|
+
jsonLogger.logDebug(`HTTP Stream End`, { totalBytes, duration });
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
// Console output controlled by log level
|
|
1037
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1038
|
+
|
|
1039
|
+
const location = this.getCallLocation();
|
|
1040
|
+
const timestamp = this.getTimestamp();
|
|
1041
|
+
const prefix = this.getPrefix();
|
|
1042
|
+
const pid = this.getPid();
|
|
1043
|
+
const traceId = this.getTraceIdStr();
|
|
1044
|
+
const loc = this.getLocation(location);
|
|
1045
|
+
|
|
1046
|
+
console.log(
|
|
1047
|
+
timestamp,
|
|
1048
|
+
prefix,
|
|
1049
|
+
pid,
|
|
1050
|
+
traceId,
|
|
1051
|
+
loc,
|
|
1052
|
+
chalk.cyan('⇠ HTTP STREAM END:'),
|
|
1053
|
+
`${totalBytes} bytes in ${duration}ms`
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
// ============================================================================
|
|
1058
|
+
// Tool Individual Methods
|
|
1059
|
+
// ============================================================================
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Log tool start
|
|
1063
|
+
*/
|
|
1064
|
+
toolStart(name: string, args: unknown, reason?: string): void {
|
|
1065
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1066
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1067
|
+
if (jsonLogger?.isActive()) {
|
|
1068
|
+
jsonLogger.logToolStart(name, args, reason);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
// Console output controlled by log level
|
|
1072
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1073
|
+
|
|
1074
|
+
const location = this.getCallLocation();
|
|
1075
|
+
const timestamp = this.getTimestamp();
|
|
1076
|
+
const prefix = this.getPrefix();
|
|
1077
|
+
const pid = this.getPid();
|
|
1078
|
+
const traceId = this.getTraceIdStr();
|
|
1079
|
+
const loc = this.getLocation(location);
|
|
1080
|
+
|
|
1081
|
+
console.log(
|
|
1082
|
+
timestamp,
|
|
1083
|
+
prefix,
|
|
1084
|
+
pid,
|
|
1085
|
+
traceId,
|
|
1086
|
+
loc,
|
|
1087
|
+
chalk.blue('🔧 TOOL START:'),
|
|
1088
|
+
chalk.bold(name)
|
|
1089
|
+
);
|
|
1090
|
+
if (reason) {
|
|
1091
|
+
console.log(chalk.blue(' Reason:'), reason);
|
|
1092
|
+
}
|
|
1093
|
+
if (args && this.level >= LogLevel.VERBOSE) {
|
|
1094
|
+
console.log(chalk.blue(' Args:'), JSON.stringify(args, null, 2));
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Log tool success
|
|
1100
|
+
*/
|
|
1101
|
+
toolSuccess(name: string, _args: unknown, result: unknown, duration: number): void {
|
|
1102
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1103
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1104
|
+
if (jsonLogger?.isActive()) {
|
|
1105
|
+
jsonLogger.logToolEnd(name, true, result, undefined, duration);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
// Console output controlled by log level
|
|
1109
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1110
|
+
|
|
1111
|
+
const location = this.getCallLocation();
|
|
1112
|
+
const timestamp = this.getTimestamp();
|
|
1113
|
+
const prefix = this.getPrefix();
|
|
1114
|
+
const pid = this.getPid();
|
|
1115
|
+
const traceId = this.getTraceIdStr();
|
|
1116
|
+
const loc = this.getLocation(location);
|
|
1117
|
+
|
|
1118
|
+
console.log(
|
|
1119
|
+
timestamp,
|
|
1120
|
+
prefix,
|
|
1121
|
+
pid,
|
|
1122
|
+
traceId,
|
|
1123
|
+
loc,
|
|
1124
|
+
chalk.green('✓ TOOL SUCCESS:'),
|
|
1125
|
+
chalk.bold(name),
|
|
1126
|
+
chalk.dim(`(${duration}ms)`)
|
|
1127
|
+
);
|
|
1128
|
+
if (result && this.level >= LogLevel.VERBOSE) {
|
|
1129
|
+
console.log(chalk.green(' Result:'), this.formatValue(result));
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* Log tool error
|
|
1135
|
+
*/
|
|
1136
|
+
toolError(name: string, args: unknown, error: Error, duration: number): void {
|
|
1137
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1138
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1139
|
+
if (jsonLogger?.isActive()) {
|
|
1140
|
+
jsonLogger.logToolEnd(name, false, undefined, error.message, duration);
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
// Console output controlled by log level
|
|
1144
|
+
if (this.level < LogLevel.ERROR) return;
|
|
1145
|
+
|
|
1146
|
+
const location = this.getCallLocation();
|
|
1147
|
+
const timestamp = this.getTimestamp();
|
|
1148
|
+
const prefix = this.getPrefix();
|
|
1149
|
+
const pid = this.getPid();
|
|
1150
|
+
const traceId = this.getTraceIdStr();
|
|
1151
|
+
const loc = this.getLocation(location);
|
|
1152
|
+
|
|
1153
|
+
console.log(
|
|
1154
|
+
timestamp,
|
|
1155
|
+
prefix,
|
|
1156
|
+
pid,
|
|
1157
|
+
traceId,
|
|
1158
|
+
loc,
|
|
1159
|
+
chalk.red('✗ TOOL ERROR:'),
|
|
1160
|
+
chalk.bold(name),
|
|
1161
|
+
chalk.dim(`(${duration}ms)`)
|
|
1162
|
+
);
|
|
1163
|
+
console.log(chalk.red(' Error:'), error.message);
|
|
1164
|
+
if (args) {
|
|
1165
|
+
console.log(chalk.red(' Args:'), JSON.stringify(args, null, 2));
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
// ============================================================================
|
|
1170
|
+
// UI/UX Interaction Methods
|
|
1171
|
+
// ============================================================================
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* Log user click event
|
|
1175
|
+
*/
|
|
1176
|
+
userClick(element: string, context: Record<string, unknown>): void {
|
|
1177
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1178
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1179
|
+
if (jsonLogger?.isActive()) {
|
|
1180
|
+
jsonLogger.logDebug(`[UI] User Click: ${element}`, context);
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
// Console output controlled by log level
|
|
1184
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1185
|
+
|
|
1186
|
+
const location = this.getCallLocation();
|
|
1187
|
+
const timestamp = this.getTimestamp();
|
|
1188
|
+
const prefix = this.getPrefix();
|
|
1189
|
+
const loc = this.getLocation(location);
|
|
1190
|
+
|
|
1191
|
+
console.log(timestamp, prefix, loc, chalk.yellow('👆 USER CLICK:'), element);
|
|
1192
|
+
if (Object.keys(context).length > 0) {
|
|
1193
|
+
console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* Log user keyboard event
|
|
1199
|
+
*/
|
|
1200
|
+
userKeyboard(type: string, context: Record<string, unknown>): void {
|
|
1201
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1202
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1203
|
+
if (jsonLogger?.isActive()) {
|
|
1204
|
+
jsonLogger.logDebug(`[UI] User Keyboard: ${type}`, context);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
// Console output controlled by log level
|
|
1208
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1209
|
+
|
|
1210
|
+
const location = this.getCallLocation();
|
|
1211
|
+
const timestamp = this.getTimestamp();
|
|
1212
|
+
const prefix = this.getPrefix();
|
|
1213
|
+
const loc = this.getLocation(location);
|
|
1214
|
+
|
|
1215
|
+
console.log(timestamp, prefix, loc, chalk.yellow('⌨️ USER KEYBOARD:'), type);
|
|
1216
|
+
if (Object.keys(context).length > 0) {
|
|
1217
|
+
console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* Log user scroll event
|
|
1223
|
+
*/
|
|
1224
|
+
userScroll(context: Record<string, unknown>): void {
|
|
1225
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1226
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1227
|
+
if (jsonLogger?.isActive()) {
|
|
1228
|
+
jsonLogger.logDebug('[UI] User Scroll', context);
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
// Console output controlled by log level
|
|
1232
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
1233
|
+
|
|
1234
|
+
const location = this.getCallLocation();
|
|
1235
|
+
const timestamp = this.getTimestamp();
|
|
1236
|
+
const prefix = this.getPrefix();
|
|
1237
|
+
const loc = this.getLocation(location);
|
|
1238
|
+
|
|
1239
|
+
console.log(timestamp, prefix, loc, chalk.gray('📜 USER SCROLL'));
|
|
1240
|
+
if (Object.keys(context).length > 0) {
|
|
1241
|
+
console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Log user drag start
|
|
1247
|
+
*/
|
|
1248
|
+
userDragStart(element: string, context: Record<string, unknown>): void {
|
|
1249
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1250
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1251
|
+
if (jsonLogger?.isActive()) {
|
|
1252
|
+
jsonLogger.logDebug(`[UI] User Drag Start: ${element}`, context);
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
// Console output controlled by log level
|
|
1256
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1257
|
+
|
|
1258
|
+
const location = this.getCallLocation();
|
|
1259
|
+
const timestamp = this.getTimestamp();
|
|
1260
|
+
const prefix = this.getPrefix();
|
|
1261
|
+
const loc = this.getLocation(location);
|
|
1262
|
+
|
|
1263
|
+
console.log(timestamp, prefix, loc, chalk.yellow('🖱️ USER DRAG START:'), element);
|
|
1264
|
+
if (Object.keys(context).length > 0) {
|
|
1265
|
+
console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* Log user drag end
|
|
1271
|
+
*/
|
|
1272
|
+
userDragEnd(element: string, context: Record<string, unknown>): void {
|
|
1273
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1274
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1275
|
+
if (jsonLogger?.isActive()) {
|
|
1276
|
+
jsonLogger.logDebug(`[UI] User Drag End: ${element}`, context);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// Console output controlled by log level
|
|
1280
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1281
|
+
|
|
1282
|
+
const location = this.getCallLocation();
|
|
1283
|
+
const timestamp = this.getTimestamp();
|
|
1284
|
+
const prefix = this.getPrefix();
|
|
1285
|
+
const loc = this.getLocation(location);
|
|
1286
|
+
|
|
1287
|
+
console.log(timestamp, prefix, loc, chalk.yellow('🖱️ USER DRAG END:'), element);
|
|
1288
|
+
if (Object.keys(context).length > 0) {
|
|
1289
|
+
console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
// ============================================================================
|
|
1294
|
+
// Component Lifecycle Methods
|
|
1295
|
+
// ============================================================================
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* Log component mount
|
|
1299
|
+
*/
|
|
1300
|
+
componentMount(name: string, context: Record<string, unknown>): void {
|
|
1301
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1302
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1303
|
+
if (jsonLogger?.isActive()) {
|
|
1304
|
+
jsonLogger.logDebug(`[COMPONENT] Mount: ${name}`, context);
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
// Console output controlled by log level
|
|
1308
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1309
|
+
|
|
1310
|
+
const location = this.getCallLocation();
|
|
1311
|
+
const timestamp = this.getTimestamp();
|
|
1312
|
+
const prefix = this.getPrefix();
|
|
1313
|
+
const loc = this.getLocation(location);
|
|
1314
|
+
|
|
1315
|
+
console.log(timestamp, prefix, loc, chalk.green('📦 COMPONENT MOUNT:'), name);
|
|
1316
|
+
if (Object.keys(context).length > 0) {
|
|
1317
|
+
console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
/**
|
|
1322
|
+
* Log component unmount
|
|
1323
|
+
*/
|
|
1324
|
+
componentUnmount(name: string, context: Record<string, unknown>): void {
|
|
1325
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1326
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1327
|
+
if (jsonLogger?.isActive()) {
|
|
1328
|
+
jsonLogger.logDebug(`[COMPONENT] Unmount: ${name}`, context);
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
// Console output controlled by log level
|
|
1332
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1333
|
+
|
|
1334
|
+
const location = this.getCallLocation();
|
|
1335
|
+
const timestamp = this.getTimestamp();
|
|
1336
|
+
const prefix = this.getPrefix();
|
|
1337
|
+
const loc = this.getLocation(location);
|
|
1338
|
+
|
|
1339
|
+
console.log(timestamp, prefix, loc, chalk.red('📦 COMPONENT UNMOUNT:'), name);
|
|
1340
|
+
if (Object.keys(context).length > 0) {
|
|
1341
|
+
console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
/**
|
|
1346
|
+
* Log component render
|
|
1347
|
+
*/
|
|
1348
|
+
componentRender(name: string, context: Record<string, unknown>): void {
|
|
1349
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1350
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1351
|
+
if (jsonLogger?.isActive()) {
|
|
1352
|
+
jsonLogger.logDebug(`[COMPONENT] Render: ${name}`, context);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
// Console output controlled by log level
|
|
1356
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
1357
|
+
|
|
1358
|
+
const location = this.getCallLocation();
|
|
1359
|
+
const timestamp = this.getTimestamp();
|
|
1360
|
+
const prefix = this.getPrefix();
|
|
1361
|
+
const loc = this.getLocation(location);
|
|
1362
|
+
|
|
1363
|
+
console.log(timestamp, prefix, loc, chalk.blue('📦 COMPONENT RENDER:'), name);
|
|
1364
|
+
if (Object.keys(context).length > 0) {
|
|
1365
|
+
console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* Log component render complete
|
|
1371
|
+
*/
|
|
1372
|
+
componentRenderComplete(name: string, context: Record<string, unknown>): void {
|
|
1373
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1374
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1375
|
+
if (jsonLogger?.isActive()) {
|
|
1376
|
+
jsonLogger.logDebug(`[COMPONENT] Render Complete: ${name}`, context);
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
// Console output controlled by log level
|
|
1380
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
1381
|
+
|
|
1382
|
+
const location = this.getCallLocation();
|
|
1383
|
+
const timestamp = this.getTimestamp();
|
|
1384
|
+
const prefix = this.getPrefix();
|
|
1385
|
+
const loc = this.getLocation(location);
|
|
1386
|
+
|
|
1387
|
+
console.log(timestamp, prefix, loc, chalk.green('✓ COMPONENT RENDER COMPLETE:'), name);
|
|
1388
|
+
if (Object.keys(context).length > 0) {
|
|
1389
|
+
console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
/**
|
|
1394
|
+
* Log component state change
|
|
1395
|
+
*/
|
|
1396
|
+
componentStateChange(name: string, field: string, context: Record<string, unknown>): void {
|
|
1397
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1398
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1399
|
+
if (jsonLogger?.isActive()) {
|
|
1400
|
+
jsonLogger.logDebug(`[COMPONENT] State Change: ${name}.${field}`, context);
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
// Console output controlled by log level
|
|
1404
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1405
|
+
|
|
1406
|
+
const location = this.getCallLocation();
|
|
1407
|
+
const timestamp = this.getTimestamp();
|
|
1408
|
+
const prefix = this.getPrefix();
|
|
1409
|
+
const loc = this.getLocation(location);
|
|
1410
|
+
|
|
1411
|
+
console.log(timestamp, prefix, loc, chalk.yellow('🔄 COMPONENT STATE:'), `${name}.${field}`);
|
|
1412
|
+
if (Object.keys(context).length > 0) {
|
|
1413
|
+
console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
// ============================================================================
|
|
1418
|
+
// Screen/Navigation Methods
|
|
1419
|
+
// ============================================================================
|
|
1420
|
+
|
|
1421
|
+
/**
|
|
1422
|
+
* Log screen change
|
|
1423
|
+
*/
|
|
1424
|
+
screenChange(to: string, context: Record<string, unknown>): void {
|
|
1425
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1426
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1427
|
+
if (jsonLogger?.isActive()) {
|
|
1428
|
+
jsonLogger.logDebug(`[SCREEN] Change: ${to}`, context);
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
// Console output controlled by log level
|
|
1432
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1433
|
+
|
|
1434
|
+
const location = this.getCallLocation();
|
|
1435
|
+
const timestamp = this.getTimestamp();
|
|
1436
|
+
const prefix = this.getPrefix();
|
|
1437
|
+
const loc = this.getLocation(location);
|
|
1438
|
+
|
|
1439
|
+
console.log(timestamp, prefix, loc, chalk.magenta('📱 SCREEN CHANGE:'), to);
|
|
1440
|
+
if (Object.keys(context).length > 0) {
|
|
1441
|
+
console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* Log tab change
|
|
1447
|
+
*/
|
|
1448
|
+
tabChange(container: string, context: Record<string, unknown>): void {
|
|
1449
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1450
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1451
|
+
if (jsonLogger?.isActive()) {
|
|
1452
|
+
jsonLogger.logDebug(`[TAB] Change: ${container}`, context);
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// Console output controlled by log level
|
|
1456
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1457
|
+
|
|
1458
|
+
const location = this.getCallLocation();
|
|
1459
|
+
const timestamp = this.getTimestamp();
|
|
1460
|
+
const prefix = this.getPrefix();
|
|
1461
|
+
const loc = this.getLocation(location);
|
|
1462
|
+
|
|
1463
|
+
console.log(timestamp, prefix, loc, chalk.magenta('🗂️ TAB CHANGE:'), container);
|
|
1464
|
+
if (Object.keys(context).length > 0) {
|
|
1465
|
+
console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Log route change
|
|
1471
|
+
*/
|
|
1472
|
+
routeChange(context: Record<string, unknown>): void {
|
|
1473
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1474
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1475
|
+
if (jsonLogger?.isActive()) {
|
|
1476
|
+
jsonLogger.logDebug(`[ROUTE] Change`, context);
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
// Console output controlled by log level
|
|
1480
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1481
|
+
|
|
1482
|
+
const location = this.getCallLocation();
|
|
1483
|
+
const timestamp = this.getTimestamp();
|
|
1484
|
+
const prefix = this.getPrefix();
|
|
1485
|
+
const loc = this.getLocation(location);
|
|
1486
|
+
|
|
1487
|
+
console.log(timestamp, prefix, loc, chalk.magenta('🛤️ ROUTE CHANGE'));
|
|
1488
|
+
if (Object.keys(context).length > 0) {
|
|
1489
|
+
console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
// ============================================================================
|
|
1494
|
+
// Form Methods
|
|
1495
|
+
// ============================================================================
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* Log form start
|
|
1499
|
+
*/
|
|
1500
|
+
formStart(formId: string, context: Record<string, unknown>): void {
|
|
1501
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1502
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1503
|
+
if (jsonLogger?.isActive()) {
|
|
1504
|
+
jsonLogger.logDebug(`[FORM] Start: ${formId}`, context);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
// Console output controlled by log level
|
|
1508
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1509
|
+
|
|
1510
|
+
const location = this.getCallLocation();
|
|
1511
|
+
const timestamp = this.getTimestamp();
|
|
1512
|
+
const prefix = this.getPrefix();
|
|
1513
|
+
const loc = this.getLocation(location);
|
|
1514
|
+
|
|
1515
|
+
console.log(timestamp, prefix, loc, chalk.blue('📝 FORM START:'), formId);
|
|
1516
|
+
if (Object.keys(context).length > 0) {
|
|
1517
|
+
console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
/**
|
|
1522
|
+
* Log form submit
|
|
1523
|
+
*/
|
|
1524
|
+
formSubmit(formId: string, context: Record<string, unknown>): void {
|
|
1525
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1526
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1527
|
+
if (jsonLogger?.isActive()) {
|
|
1528
|
+
jsonLogger.logDebug(`[FORM] Submit: ${formId}`, context);
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
// Console output controlled by log level
|
|
1532
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1533
|
+
|
|
1534
|
+
const location = this.getCallLocation();
|
|
1535
|
+
const timestamp = this.getTimestamp();
|
|
1536
|
+
const prefix = this.getPrefix();
|
|
1537
|
+
const loc = this.getLocation(location);
|
|
1538
|
+
|
|
1539
|
+
console.log(timestamp, prefix, loc, chalk.blue('📤 FORM SUBMIT:'), formId);
|
|
1540
|
+
if (Object.keys(context).length > 0) {
|
|
1541
|
+
console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* Log form result
|
|
1547
|
+
*/
|
|
1548
|
+
formResult(formId: string, context: Record<string, unknown>): void {
|
|
1549
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1550
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1551
|
+
if (jsonLogger?.isActive()) {
|
|
1552
|
+
jsonLogger.logDebug(`[FORM] Result: ${formId}`, context);
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
// Console output controlled by log level
|
|
1556
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1557
|
+
|
|
1558
|
+
const location = this.getCallLocation();
|
|
1559
|
+
const timestamp = this.getTimestamp();
|
|
1560
|
+
const prefix = this.getPrefix();
|
|
1561
|
+
const loc = this.getLocation(location);
|
|
1562
|
+
|
|
1563
|
+
console.log(timestamp, prefix, loc, chalk.green('✓ FORM RESULT:'), formId);
|
|
1564
|
+
if (Object.keys(context).length > 0) {
|
|
1565
|
+
console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* Log form error
|
|
1571
|
+
*/
|
|
1572
|
+
formError(formId: string, context: Record<string, unknown>): void {
|
|
1573
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1574
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1575
|
+
if (jsonLogger?.isActive()) {
|
|
1576
|
+
jsonLogger.logDebug(`[FORM] Error: ${formId}`, context);
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
// Console output controlled by log level
|
|
1580
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1581
|
+
|
|
1582
|
+
const location = this.getCallLocation();
|
|
1583
|
+
const timestamp = this.getTimestamp();
|
|
1584
|
+
const prefix = this.getPrefix();
|
|
1585
|
+
const loc = this.getLocation(location);
|
|
1586
|
+
|
|
1587
|
+
console.log(timestamp, prefix, loc, chalk.red('✗ FORM ERROR:'), formId);
|
|
1588
|
+
if (Object.keys(context).length > 0) {
|
|
1589
|
+
console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* Log field change
|
|
1595
|
+
*/
|
|
1596
|
+
fieldChange(formId: string, field: string, context: Record<string, unknown>): void {
|
|
1597
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1598
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1599
|
+
if (jsonLogger?.isActive()) {
|
|
1600
|
+
jsonLogger.logDebug(`[FORM] Field Change: ${formId}.${field}`, context);
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
// Console output controlled by log level
|
|
1604
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
1605
|
+
|
|
1606
|
+
const location = this.getCallLocation();
|
|
1607
|
+
const timestamp = this.getTimestamp();
|
|
1608
|
+
const prefix = this.getPrefix();
|
|
1609
|
+
const loc = this.getLocation(location);
|
|
1610
|
+
|
|
1611
|
+
console.log(timestamp, prefix, loc, chalk.gray('📝 FIELD CHANGE:'), `${formId}.${field}`);
|
|
1612
|
+
if (Object.keys(context).length > 0) {
|
|
1613
|
+
console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* Log field validation
|
|
1619
|
+
*/
|
|
1620
|
+
fieldValidation(formId: string, field: string, context: Record<string, unknown>): void {
|
|
1621
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1622
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1623
|
+
if (jsonLogger?.isActive()) {
|
|
1624
|
+
jsonLogger.logDebug(`[FORM] Field Validation: ${formId}.${field}`, context);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
// Console output controlled by log level
|
|
1628
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1629
|
+
|
|
1630
|
+
const location = this.getCallLocation();
|
|
1631
|
+
const timestamp = this.getTimestamp();
|
|
1632
|
+
const prefix = this.getPrefix();
|
|
1633
|
+
const loc = this.getLocation(location);
|
|
1634
|
+
|
|
1635
|
+
console.log(timestamp, prefix, loc, chalk.yellow('✓ FIELD VALIDATION:'), `${formId}.${field}`);
|
|
1636
|
+
if (Object.keys(context).length > 0) {
|
|
1637
|
+
console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
// ============================================================================
|
|
1642
|
+
// Modal/Dialog Methods
|
|
1643
|
+
// ============================================================================
|
|
1644
|
+
|
|
1645
|
+
/**
|
|
1646
|
+
* Log modal open
|
|
1647
|
+
*/
|
|
1648
|
+
modalOpen(id: string, context: Record<string, unknown>): void {
|
|
1649
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1650
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1651
|
+
if (jsonLogger?.isActive()) {
|
|
1652
|
+
jsonLogger.logDebug(`[MODAL] Open: ${id}`, context);
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
// Console output controlled by log level
|
|
1656
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1657
|
+
|
|
1658
|
+
const location = this.getCallLocation();
|
|
1659
|
+
const timestamp = this.getTimestamp();
|
|
1660
|
+
const prefix = this.getPrefix();
|
|
1661
|
+
const loc = this.getLocation(location);
|
|
1662
|
+
|
|
1663
|
+
console.log(timestamp, prefix, loc, chalk.cyan('📭 MODAL OPEN:'), id);
|
|
1664
|
+
if (Object.keys(context).length > 0) {
|
|
1665
|
+
console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
/**
|
|
1670
|
+
* Log modal close
|
|
1671
|
+
*/
|
|
1672
|
+
modalClose(id: string, context: Record<string, unknown>): void {
|
|
1673
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1674
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1675
|
+
if (jsonLogger?.isActive()) {
|
|
1676
|
+
jsonLogger.logDebug(`[MODAL] Close: ${id}`, context);
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
// Console output controlled by log level
|
|
1680
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1681
|
+
|
|
1682
|
+
const location = this.getCallLocation();
|
|
1683
|
+
const timestamp = this.getTimestamp();
|
|
1684
|
+
const prefix = this.getPrefix();
|
|
1685
|
+
const loc = this.getLocation(location);
|
|
1686
|
+
|
|
1687
|
+
console.log(timestamp, prefix, loc, chalk.cyan('📪 MODAL CLOSE:'), id);
|
|
1688
|
+
if (Object.keys(context).length > 0) {
|
|
1689
|
+
console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Log dialog show
|
|
1695
|
+
*/
|
|
1696
|
+
dialogShow(type: string, context: Record<string, unknown>): void {
|
|
1697
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1698
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1699
|
+
if (jsonLogger?.isActive()) {
|
|
1700
|
+
jsonLogger.logDebug(`[DIALOG] Show: ${type}`, context);
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
// Console output controlled by log level
|
|
1704
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1705
|
+
|
|
1706
|
+
const location = this.getCallLocation();
|
|
1707
|
+
const timestamp = this.getTimestamp();
|
|
1708
|
+
const prefix = this.getPrefix();
|
|
1709
|
+
const loc = this.getLocation(location);
|
|
1710
|
+
|
|
1711
|
+
console.log(timestamp, prefix, loc, chalk.cyan('💬 DIALOG SHOW:'), type);
|
|
1712
|
+
if (Object.keys(context).length > 0) {
|
|
1713
|
+
console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
/**
|
|
1718
|
+
* Log dialog result
|
|
1719
|
+
*/
|
|
1720
|
+
dialogResult(type: string, context: Record<string, unknown>): void {
|
|
1721
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1722
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1723
|
+
if (jsonLogger?.isActive()) {
|
|
1724
|
+
jsonLogger.logDebug(`[DIALOG] Result: ${type}`, context);
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
// Console output controlled by log level
|
|
1728
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1729
|
+
|
|
1730
|
+
const location = this.getCallLocation();
|
|
1731
|
+
const timestamp = this.getTimestamp();
|
|
1732
|
+
const prefix = this.getPrefix();
|
|
1733
|
+
const loc = this.getLocation(location);
|
|
1734
|
+
|
|
1735
|
+
console.log(timestamp, prefix, loc, chalk.cyan('💬 DIALOG RESULT:'), type);
|
|
1736
|
+
if (Object.keys(context).length > 0) {
|
|
1737
|
+
console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
/**
|
|
1742
|
+
* Log toast show
|
|
1743
|
+
*/
|
|
1744
|
+
toastShow(context: Record<string, unknown>): void {
|
|
1745
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1746
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1747
|
+
if (jsonLogger?.isActive()) {
|
|
1748
|
+
jsonLogger.logDebug(`[TOAST] Show`, context);
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
// Console output controlled by log level
|
|
1752
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1753
|
+
|
|
1754
|
+
const location = this.getCallLocation();
|
|
1755
|
+
const timestamp = this.getTimestamp();
|
|
1756
|
+
const prefix = this.getPrefix();
|
|
1757
|
+
const loc = this.getLocation(location);
|
|
1758
|
+
|
|
1759
|
+
console.log(timestamp, prefix, loc, chalk.yellow('🔔 TOAST SHOW'));
|
|
1760
|
+
if (Object.keys(context).length > 0) {
|
|
1761
|
+
console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
/**
|
|
1766
|
+
* Log toast dismiss
|
|
1767
|
+
*/
|
|
1768
|
+
toastDismiss(context: Record<string, unknown>): void {
|
|
1769
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1770
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1771
|
+
if (jsonLogger?.isActive()) {
|
|
1772
|
+
jsonLogger.logDebug(`[TOAST] Dismiss`, context);
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
// Console output controlled by log level
|
|
1776
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1777
|
+
|
|
1778
|
+
const location = this.getCallLocation();
|
|
1779
|
+
const timestamp = this.getTimestamp();
|
|
1780
|
+
const prefix = this.getPrefix();
|
|
1781
|
+
const loc = this.getLocation(location);
|
|
1782
|
+
|
|
1783
|
+
console.log(timestamp, prefix, loc, chalk.gray('🔕 TOAST DISMISS'));
|
|
1784
|
+
if (Object.keys(context).length > 0) {
|
|
1785
|
+
console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
// ============================================================================
|
|
1790
|
+
// Loading Methods
|
|
1791
|
+
// ============================================================================
|
|
1792
|
+
|
|
1793
|
+
/**
|
|
1794
|
+
* Log loading start
|
|
1795
|
+
*/
|
|
1796
|
+
loadingStart(id: string, context: Record<string, unknown>): void {
|
|
1797
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1798
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1799
|
+
if (jsonLogger?.isActive()) {
|
|
1800
|
+
jsonLogger.logDebug(`[LOADING] Start: ${id}`, context);
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
// Console output controlled by log level
|
|
1804
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1805
|
+
|
|
1806
|
+
const location = this.getCallLocation();
|
|
1807
|
+
const timestamp = this.getTimestamp();
|
|
1808
|
+
const prefix = this.getPrefix();
|
|
1809
|
+
const loc = this.getLocation(location);
|
|
1810
|
+
|
|
1811
|
+
console.log(timestamp, prefix, loc, chalk.blue('⏳ LOADING START:'), id);
|
|
1812
|
+
if (Object.keys(context).length > 0) {
|
|
1813
|
+
console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* Log loading end
|
|
1819
|
+
*/
|
|
1820
|
+
loadingEnd(id: string, context: Record<string, unknown>): void {
|
|
1821
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1822
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1823
|
+
if (jsonLogger?.isActive()) {
|
|
1824
|
+
jsonLogger.logDebug(`[LOADING] End: ${id}`, context);
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
// Console output controlled by log level
|
|
1828
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1829
|
+
|
|
1830
|
+
const location = this.getCallLocation();
|
|
1831
|
+
const timestamp = this.getTimestamp();
|
|
1832
|
+
const prefix = this.getPrefix();
|
|
1833
|
+
const loc = this.getLocation(location);
|
|
1834
|
+
|
|
1835
|
+
console.log(timestamp, prefix, loc, chalk.green('✓ LOADING END:'), id);
|
|
1836
|
+
if (Object.keys(context).length > 0) {
|
|
1837
|
+
console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
/**
|
|
1842
|
+
* Log loading error
|
|
1843
|
+
*/
|
|
1844
|
+
loadingError(id: string, context: Record<string, unknown>): void {
|
|
1845
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1846
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1847
|
+
if (jsonLogger?.isActive()) {
|
|
1848
|
+
jsonLogger.logDebug(`[LOADING] Error: ${id}`, context);
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
// Console output controlled by log level
|
|
1852
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1853
|
+
|
|
1854
|
+
const location = this.getCallLocation();
|
|
1855
|
+
const timestamp = this.getTimestamp();
|
|
1856
|
+
const prefix = this.getPrefix();
|
|
1857
|
+
const loc = this.getLocation(location);
|
|
1858
|
+
|
|
1859
|
+
console.log(timestamp, prefix, loc, chalk.red('✗ LOADING ERROR:'), id);
|
|
1860
|
+
if (Object.keys(context).length > 0) {
|
|
1861
|
+
console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
/**
|
|
1866
|
+
* Log skeleton show
|
|
1867
|
+
*/
|
|
1868
|
+
skeletonShow(id: string, context: Record<string, unknown>): void {
|
|
1869
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1870
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1871
|
+
if (jsonLogger?.isActive()) {
|
|
1872
|
+
jsonLogger.logDebug(`[UI] Skeleton Show: ${id}`, context);
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
// Console output controlled by log level
|
|
1876
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
1877
|
+
|
|
1878
|
+
const location = this.getCallLocation();
|
|
1879
|
+
const timestamp = this.getTimestamp();
|
|
1880
|
+
const prefix = this.getPrefix();
|
|
1881
|
+
const loc = this.getLocation(location);
|
|
1882
|
+
|
|
1883
|
+
console.log(timestamp, prefix, loc, chalk.gray('💀 SKELETON SHOW:'), id);
|
|
1884
|
+
if (Object.keys(context).length > 0) {
|
|
1885
|
+
console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* Log skeleton hide
|
|
1891
|
+
*/
|
|
1892
|
+
skeletonHide(id: string, context: Record<string, unknown>): void {
|
|
1893
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1894
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1895
|
+
if (jsonLogger?.isActive()) {
|
|
1896
|
+
jsonLogger.logDebug(`[UI] Skeleton Hide: ${id}`, context);
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
// Console output controlled by log level
|
|
1900
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
1901
|
+
|
|
1902
|
+
const location = this.getCallLocation();
|
|
1903
|
+
const timestamp = this.getTimestamp();
|
|
1904
|
+
const prefix = this.getPrefix();
|
|
1905
|
+
const loc = this.getLocation(location);
|
|
1906
|
+
|
|
1907
|
+
console.log(timestamp, prefix, loc, chalk.gray('💀 SKELETON HIDE:'), id);
|
|
1908
|
+
if (Object.keys(context).length > 0) {
|
|
1909
|
+
console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
/**
|
|
1914
|
+
* Log progress start
|
|
1915
|
+
*/
|
|
1916
|
+
progressStart(id: string, context: Record<string, unknown>): void {
|
|
1917
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1918
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1919
|
+
if (jsonLogger?.isActive()) {
|
|
1920
|
+
jsonLogger.logDebug(`[PROGRESS] Start: ${id}`, context);
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
// Console output controlled by log level
|
|
1924
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1925
|
+
|
|
1926
|
+
const location = this.getCallLocation();
|
|
1927
|
+
const timestamp = this.getTimestamp();
|
|
1928
|
+
const prefix = this.getPrefix();
|
|
1929
|
+
const loc = this.getLocation(location);
|
|
1930
|
+
|
|
1931
|
+
console.log(timestamp, prefix, loc, chalk.blue('📊 PROGRESS START:'), id);
|
|
1932
|
+
if (Object.keys(context).length > 0) {
|
|
1933
|
+
console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
/**
|
|
1938
|
+
* Log progress update
|
|
1939
|
+
*/
|
|
1940
|
+
progressUpdate(id: string, context: Record<string, unknown>): void {
|
|
1941
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1942
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1943
|
+
if (jsonLogger?.isActive()) {
|
|
1944
|
+
jsonLogger.logDebug(`[PROGRESS] Update: ${id}`, context);
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
// Console output controlled by log level
|
|
1948
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
1949
|
+
|
|
1950
|
+
const location = this.getCallLocation();
|
|
1951
|
+
const timestamp = this.getTimestamp();
|
|
1952
|
+
const prefix = this.getPrefix();
|
|
1953
|
+
const loc = this.getLocation(location);
|
|
1954
|
+
|
|
1955
|
+
console.log(timestamp, prefix, loc, chalk.blue('📊 PROGRESS UPDATE:'), id);
|
|
1956
|
+
if (Object.keys(context).length > 0) {
|
|
1957
|
+
console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
/**
|
|
1962
|
+
* Log progress complete
|
|
1963
|
+
*/
|
|
1964
|
+
progressComplete(id: string, context: Record<string, unknown>): void {
|
|
1965
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1966
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1967
|
+
if (jsonLogger?.isActive()) {
|
|
1968
|
+
jsonLogger.logDebug(`[PROGRESS] Complete: ${id}`, context);
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
// Console output controlled by log level
|
|
1972
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1973
|
+
|
|
1974
|
+
const location = this.getCallLocation();
|
|
1975
|
+
const timestamp = this.getTimestamp();
|
|
1976
|
+
const prefix = this.getPrefix();
|
|
1977
|
+
const loc = this.getLocation(location);
|
|
1978
|
+
|
|
1979
|
+
console.log(timestamp, prefix, loc, chalk.green('✓ PROGRESS COMPLETE:'), id);
|
|
1980
|
+
if (Object.keys(context).length > 0) {
|
|
1981
|
+
console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
/**
|
|
1986
|
+
* Log progress error
|
|
1987
|
+
*/
|
|
1988
|
+
progressError(id: string, context: Record<string, unknown>): void {
|
|
1989
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
1990
|
+
const jsonLogger = getJsonStreamLogger();
|
|
1991
|
+
if (jsonLogger?.isActive()) {
|
|
1992
|
+
jsonLogger.logDebug(`[PROGRESS] Error: ${id}`, context);
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
// Console output controlled by log level
|
|
1996
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
1997
|
+
|
|
1998
|
+
const location = this.getCallLocation();
|
|
1999
|
+
const timestamp = this.getTimestamp();
|
|
2000
|
+
const prefix = this.getPrefix();
|
|
2001
|
+
const loc = this.getLocation(location);
|
|
2002
|
+
|
|
2003
|
+
console.log(timestamp, prefix, loc, chalk.red('✗ PROGRESS ERROR:'), id);
|
|
2004
|
+
if (Object.keys(context).length > 0) {
|
|
2005
|
+
console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
// ============================================================================
|
|
2010
|
+
// Animation Methods
|
|
2011
|
+
// ============================================================================
|
|
2012
|
+
|
|
2013
|
+
/**
|
|
2014
|
+
* Log animation start
|
|
2015
|
+
*/
|
|
2016
|
+
animationStart(name: string, context: Record<string, unknown>): void {
|
|
2017
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2018
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2019
|
+
if (jsonLogger?.isActive()) {
|
|
2020
|
+
jsonLogger.logDebug(`[UI] Animation Start: ${name}`, context);
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
// Console output controlled by log level
|
|
2024
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
2025
|
+
|
|
2026
|
+
const location = this.getCallLocation();
|
|
2027
|
+
const timestamp = this.getTimestamp();
|
|
2028
|
+
const prefix = this.getPrefix();
|
|
2029
|
+
const loc = this.getLocation(location);
|
|
2030
|
+
|
|
2031
|
+
console.log(timestamp, prefix, loc, chalk.magenta('🎬 ANIMATION START:'), name);
|
|
2032
|
+
if (Object.keys(context).length > 0) {
|
|
2033
|
+
console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
/**
|
|
2038
|
+
* Log animation end
|
|
2039
|
+
*/
|
|
2040
|
+
animationEnd(name: string, context: Record<string, unknown>): void {
|
|
2041
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2042
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2043
|
+
if (jsonLogger?.isActive()) {
|
|
2044
|
+
jsonLogger.logDebug(`[UI] Animation End: ${name}`, context);
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
// Console output controlled by log level
|
|
2048
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
2049
|
+
|
|
2050
|
+
const location = this.getCallLocation();
|
|
2051
|
+
const timestamp = this.getTimestamp();
|
|
2052
|
+
const prefix = this.getPrefix();
|
|
2053
|
+
const loc = this.getLocation(location);
|
|
2054
|
+
|
|
2055
|
+
console.log(timestamp, prefix, loc, chalk.magenta('🎬 ANIMATION END:'), name);
|
|
2056
|
+
if (Object.keys(context).length > 0) {
|
|
2057
|
+
console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
/**
|
|
2062
|
+
* Log transition start
|
|
2063
|
+
*/
|
|
2064
|
+
transitionStart(name: string, context: Record<string, unknown>): void {
|
|
2065
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2066
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2067
|
+
if (jsonLogger?.isActive()) {
|
|
2068
|
+
jsonLogger.logDebug(`[UI] Transition Start: ${name}`, context);
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
// Console output controlled by log level
|
|
2072
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
2073
|
+
|
|
2074
|
+
const location = this.getCallLocation();
|
|
2075
|
+
const timestamp = this.getTimestamp();
|
|
2076
|
+
const prefix = this.getPrefix();
|
|
2077
|
+
const loc = this.getLocation(location);
|
|
2078
|
+
|
|
2079
|
+
console.log(timestamp, prefix, loc, chalk.magenta('🔀 TRANSITION START:'), name);
|
|
2080
|
+
if (Object.keys(context).length > 0) {
|
|
2081
|
+
console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* Log transition end
|
|
2087
|
+
*/
|
|
2088
|
+
transitionEnd(name: string, context: Record<string, unknown>): void {
|
|
2089
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2090
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2091
|
+
if (jsonLogger?.isActive()) {
|
|
2092
|
+
jsonLogger.logDebug(`[UI] Transition End: ${name}`, context);
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
// Console output controlled by log level
|
|
2096
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
2097
|
+
|
|
2098
|
+
const location = this.getCallLocation();
|
|
2099
|
+
const timestamp = this.getTimestamp();
|
|
2100
|
+
const prefix = this.getPrefix();
|
|
2101
|
+
const loc = this.getLocation(location);
|
|
2102
|
+
|
|
2103
|
+
console.log(timestamp, prefix, loc, chalk.magenta('🔀 TRANSITION END:'), name);
|
|
2104
|
+
if (Object.keys(context).length > 0) {
|
|
2105
|
+
console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
/**
|
|
2110
|
+
* Log hover enter
|
|
2111
|
+
*/
|
|
2112
|
+
hoverEnter(element: string, context: Record<string, unknown>): void {
|
|
2113
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2114
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2115
|
+
if (jsonLogger?.isActive()) {
|
|
2116
|
+
jsonLogger.logDebug(`[UI] Hover Enter: ${element}`, context);
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
// Console output controlled by log level
|
|
2120
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
2121
|
+
|
|
2122
|
+
const location = this.getCallLocation();
|
|
2123
|
+
const timestamp = this.getTimestamp();
|
|
2124
|
+
const prefix = this.getPrefix();
|
|
2125
|
+
const loc = this.getLocation(location);
|
|
2126
|
+
|
|
2127
|
+
console.log(timestamp, prefix, loc, chalk.gray('🖱️ HOVER ENTER:'), element);
|
|
2128
|
+
if (Object.keys(context).length > 0) {
|
|
2129
|
+
console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
/**
|
|
2134
|
+
* Log hover leave
|
|
2135
|
+
*/
|
|
2136
|
+
hoverLeave(element: string, context: Record<string, unknown>): void {
|
|
2137
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2138
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2139
|
+
if (jsonLogger?.isActive()) {
|
|
2140
|
+
jsonLogger.logDebug(`[UI] Hover Leave: ${element}`, context);
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
// Console output controlled by log level
|
|
2144
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
2145
|
+
|
|
2146
|
+
const location = this.getCallLocation();
|
|
2147
|
+
const timestamp = this.getTimestamp();
|
|
2148
|
+
const prefix = this.getPrefix();
|
|
2149
|
+
const loc = this.getLocation(location);
|
|
2150
|
+
|
|
2151
|
+
console.log(timestamp, prefix, loc, chalk.gray('🖱️ HOVER LEAVE:'), element);
|
|
2152
|
+
if (Object.keys(context).length > 0) {
|
|
2153
|
+
console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
// ============================================================================
|
|
2158
|
+
// Layout Methods
|
|
2159
|
+
// ============================================================================
|
|
2160
|
+
|
|
2161
|
+
/**
|
|
2162
|
+
* Log viewport resize
|
|
2163
|
+
*/
|
|
2164
|
+
viewportResize(context: Record<string, unknown>): void {
|
|
2165
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2166
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2167
|
+
if (jsonLogger?.isActive()) {
|
|
2168
|
+
jsonLogger.logDebug(`[LAYOUT] Viewport Resize`, context);
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
// Console output controlled by log level
|
|
2172
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
2173
|
+
|
|
2174
|
+
const location = this.getCallLocation();
|
|
2175
|
+
const timestamp = this.getTimestamp();
|
|
2176
|
+
const prefix = this.getPrefix();
|
|
2177
|
+
const loc = this.getLocation(location);
|
|
2178
|
+
|
|
2179
|
+
console.log(timestamp, prefix, loc, chalk.blue('📐 VIEWPORT RESIZE'));
|
|
2180
|
+
if (Object.keys(context).length > 0) {
|
|
2181
|
+
console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* Log breakpoint change
|
|
2187
|
+
*/
|
|
2188
|
+
breakpointChange(context: Record<string, unknown>): void {
|
|
2189
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2190
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2191
|
+
if (jsonLogger?.isActive()) {
|
|
2192
|
+
jsonLogger.logDebug(`[LAYOUT] Breakpoint Change`, context);
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
// Console output controlled by log level
|
|
2196
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
2197
|
+
|
|
2198
|
+
const location = this.getCallLocation();
|
|
2199
|
+
const timestamp = this.getTimestamp();
|
|
2200
|
+
const prefix = this.getPrefix();
|
|
2201
|
+
const loc = this.getLocation(location);
|
|
2202
|
+
|
|
2203
|
+
console.log(timestamp, prefix, loc, chalk.blue('📐 BREAKPOINT CHANGE'));
|
|
2204
|
+
if (Object.keys(context).length > 0) {
|
|
2205
|
+
console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
/**
|
|
2210
|
+
* Log layout shift
|
|
2211
|
+
*/
|
|
2212
|
+
layoutShift(context: Record<string, unknown>): void {
|
|
2213
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2214
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2215
|
+
if (jsonLogger?.isActive()) {
|
|
2216
|
+
jsonLogger.logDebug(`[LAYOUT] Shift`, context);
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
// Console output controlled by log level
|
|
2220
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
2221
|
+
|
|
2222
|
+
const location = this.getCallLocation();
|
|
2223
|
+
const timestamp = this.getTimestamp();
|
|
2224
|
+
const prefix = this.getPrefix();
|
|
2225
|
+
const loc = this.getLocation(location);
|
|
2226
|
+
|
|
2227
|
+
console.log(timestamp, prefix, loc, chalk.yellow('📐 LAYOUT SHIFT'));
|
|
2228
|
+
if (Object.keys(context).length > 0) {
|
|
2229
|
+
console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
/**
|
|
2234
|
+
* Log scroll position
|
|
2235
|
+
*/
|
|
2236
|
+
scrollPosition(context: Record<string, unknown>): void {
|
|
2237
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2238
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2239
|
+
if (jsonLogger?.isActive()) {
|
|
2240
|
+
jsonLogger.logDebug('[UI] Scroll Position', context);
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
// Console output controlled by log level
|
|
2244
|
+
if (this.level < LogLevel.VERBOSE) return;
|
|
2245
|
+
|
|
2246
|
+
const location = this.getCallLocation();
|
|
2247
|
+
const timestamp = this.getTimestamp();
|
|
2248
|
+
const prefix = this.getPrefix();
|
|
2249
|
+
const loc = this.getLocation(location);
|
|
2250
|
+
|
|
2251
|
+
console.log(timestamp, prefix, loc, chalk.gray('📜 SCROLL POSITION'));
|
|
2252
|
+
if (Object.keys(context).length > 0) {
|
|
2253
|
+
console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
// ============================================================================
|
|
2258
|
+
// Error Boundary Methods
|
|
2259
|
+
// ============================================================================
|
|
2260
|
+
|
|
2261
|
+
/**
|
|
2262
|
+
* Log error boundary catch
|
|
2263
|
+
*/
|
|
2264
|
+
errorBoundary(context: Record<string, unknown>): void {
|
|
2265
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2266
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2267
|
+
if (jsonLogger?.isActive()) {
|
|
2268
|
+
jsonLogger.logError(new Error('Error Boundary'), 'errorBoundary');
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
// Console output controlled by log level
|
|
2272
|
+
if (this.level < LogLevel.ERROR) return;
|
|
2273
|
+
|
|
2274
|
+
const location = this.getCallLocation();
|
|
2275
|
+
const timestamp = this.getTimestamp();
|
|
2276
|
+
const prefix = this.getPrefix();
|
|
2277
|
+
const loc = this.getLocation(location);
|
|
2278
|
+
|
|
2279
|
+
console.log(timestamp, prefix, loc, chalk.red('🛡️ ERROR BOUNDARY'));
|
|
2280
|
+
if (Object.keys(context).length > 0) {
|
|
2281
|
+
console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
/**
|
|
2286
|
+
* Log unhandled rejection
|
|
2287
|
+
*/
|
|
2288
|
+
unhandledRejection(context: Record<string, unknown>): void {
|
|
2289
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2290
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2291
|
+
if (jsonLogger?.isActive()) {
|
|
2292
|
+
jsonLogger.logError(new Error('Unhandled Rejection'), 'unhandledRejection');
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
// Console output controlled by log level
|
|
2296
|
+
if (this.level < LogLevel.ERROR) return;
|
|
2297
|
+
|
|
2298
|
+
const location = this.getCallLocation();
|
|
2299
|
+
const timestamp = this.getTimestamp();
|
|
2300
|
+
const prefix = this.getPrefix();
|
|
2301
|
+
const loc = this.getLocation(location);
|
|
2302
|
+
|
|
2303
|
+
console.log(timestamp, prefix, loc, chalk.red('⚠️ UNHANDLED REJECTION'));
|
|
2304
|
+
if (Object.keys(context).length > 0) {
|
|
2305
|
+
console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
/**
|
|
2310
|
+
* Log global error
|
|
2311
|
+
*/
|
|
2312
|
+
globalError(context: Record<string, unknown>): void {
|
|
2313
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2314
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2315
|
+
if (jsonLogger?.isActive()) {
|
|
2316
|
+
jsonLogger.logError(new Error('Global Error'), 'globalError');
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
// Console output controlled by log level
|
|
2320
|
+
if (this.level < LogLevel.ERROR) return;
|
|
2321
|
+
|
|
2322
|
+
const location = this.getCallLocation();
|
|
2323
|
+
const timestamp = this.getTimestamp();
|
|
2324
|
+
const prefix = this.getPrefix();
|
|
2325
|
+
const loc = this.getLocation(location);
|
|
2326
|
+
|
|
2327
|
+
console.log(timestamp, prefix, loc, chalk.red('💥 GLOBAL ERROR'));
|
|
2328
|
+
if (Object.keys(context).length > 0) {
|
|
2329
|
+
console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
// ============================================================================
|
|
2334
|
+
// Session Methods
|
|
2335
|
+
// ============================================================================
|
|
2336
|
+
|
|
2337
|
+
/**
|
|
2338
|
+
* Log session start
|
|
2339
|
+
*/
|
|
2340
|
+
sessionStart(context: Record<string, unknown>): void {
|
|
2341
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2342
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2343
|
+
if (jsonLogger?.isActive()) {
|
|
2344
|
+
jsonLogger.logInfo(`Session Start`, context);
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
// Console output controlled by log level
|
|
2348
|
+
if (this.level < LogLevel.INFO) return;
|
|
2349
|
+
|
|
2350
|
+
const location = this.getCallLocation();
|
|
2351
|
+
const timestamp = this.getTimestamp();
|
|
2352
|
+
const prefix = this.getPrefix();
|
|
2353
|
+
const loc = this.getLocation(location);
|
|
2354
|
+
|
|
2355
|
+
console.log(timestamp, prefix, loc, chalk.green('🚀 SESSION START'));
|
|
2356
|
+
if (Object.keys(context).length > 0) {
|
|
2357
|
+
console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* Log session end
|
|
2363
|
+
*/
|
|
2364
|
+
sessionEnd(context: Record<string, unknown>): void {
|
|
2365
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2366
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2367
|
+
if (jsonLogger?.isActive()) {
|
|
2368
|
+
jsonLogger.logInfo(`Session End`, context);
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
// Console output controlled by log level
|
|
2372
|
+
if (this.level < LogLevel.INFO) return;
|
|
2373
|
+
|
|
2374
|
+
const location = this.getCallLocation();
|
|
2375
|
+
const timestamp = this.getTimestamp();
|
|
2376
|
+
const prefix = this.getPrefix();
|
|
2377
|
+
const loc = this.getLocation(location);
|
|
2378
|
+
|
|
2379
|
+
console.log(timestamp, prefix, loc, chalk.red('🏁 SESSION END'));
|
|
2380
|
+
if (Object.keys(context).length > 0) {
|
|
2381
|
+
console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2385
|
+
/**
|
|
2386
|
+
* Log user milestone
|
|
2387
|
+
*/
|
|
2388
|
+
userMilestone(name: string, context: Record<string, unknown>): void {
|
|
2389
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2390
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2391
|
+
if (jsonLogger?.isActive()) {
|
|
2392
|
+
jsonLogger.logInfo(`User Milestone: ${name}`, context);
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
// Console output controlled by log level
|
|
2396
|
+
if (this.level < LogLevel.INFO) return;
|
|
2397
|
+
|
|
2398
|
+
const location = this.getCallLocation();
|
|
2399
|
+
const timestamp = this.getTimestamp();
|
|
2400
|
+
const prefix = this.getPrefix();
|
|
2401
|
+
const loc = this.getLocation(location);
|
|
2402
|
+
|
|
2403
|
+
console.log(timestamp, prefix, loc, chalk.yellow('🏆 USER MILESTONE:'), name);
|
|
2404
|
+
if (Object.keys(context).length > 0) {
|
|
2405
|
+
console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
/**
|
|
2410
|
+
* Log feature usage
|
|
2411
|
+
*/
|
|
2412
|
+
featureUsage(name: string, context: Record<string, unknown>): void {
|
|
2413
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2414
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2415
|
+
if (jsonLogger?.isActive()) {
|
|
2416
|
+
jsonLogger.logDebug(`Feature Usage: ${name}`, context);
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
// Console output controlled by log level
|
|
2420
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
2421
|
+
|
|
2422
|
+
const location = this.getCallLocation();
|
|
2423
|
+
const timestamp = this.getTimestamp();
|
|
2424
|
+
const prefix = this.getPrefix();
|
|
2425
|
+
const loc = this.getLocation(location);
|
|
2426
|
+
|
|
2427
|
+
console.log(timestamp, prefix, loc, chalk.cyan('📊 FEATURE USAGE:'), name);
|
|
2428
|
+
if (Object.keys(context).length > 0) {
|
|
2429
|
+
console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
// ============================================================================
|
|
2434
|
+
// Update Methods (for S3AutoUpdater)
|
|
2435
|
+
// ============================================================================
|
|
2436
|
+
|
|
2437
|
+
/**
|
|
2438
|
+
* Log update check start
|
|
2439
|
+
*/
|
|
2440
|
+
updateCheckStart(): void {
|
|
2441
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2442
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2443
|
+
if (jsonLogger?.isActive()) {
|
|
2444
|
+
jsonLogger.logInfo('Update Check Start', {});
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
// Console output controlled by log level
|
|
2448
|
+
if (this.level < LogLevel.INFO) return;
|
|
2449
|
+
|
|
2450
|
+
const location = this.getCallLocation();
|
|
2451
|
+
const timestamp = this.getTimestamp();
|
|
2452
|
+
const prefix = this.getPrefix();
|
|
2453
|
+
const loc = this.getLocation(location);
|
|
2454
|
+
|
|
2455
|
+
console.log(timestamp, prefix, loc, chalk.cyan('🔄 UPDATE CHECK START'));
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
/**
|
|
2459
|
+
* Log update available
|
|
2460
|
+
*/
|
|
2461
|
+
updateAvailable(context: Record<string, unknown>): void {
|
|
2462
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2463
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2464
|
+
if (jsonLogger?.isActive()) {
|
|
2465
|
+
jsonLogger.logInfo('Update Available', context);
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
// Console output controlled by log level
|
|
2469
|
+
if (this.level < LogLevel.INFO) return;
|
|
2470
|
+
|
|
2471
|
+
const location = this.getCallLocation();
|
|
2472
|
+
const timestamp = this.getTimestamp();
|
|
2473
|
+
const prefix = this.getPrefix();
|
|
2474
|
+
const loc = this.getLocation(location);
|
|
2475
|
+
|
|
2476
|
+
console.log(timestamp, prefix, loc, chalk.green('✨ UPDATE AVAILABLE'));
|
|
2477
|
+
if (Object.keys(context).length > 0) {
|
|
2478
|
+
console.log(chalk.green(' Version:'), context['version']);
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
/**
|
|
2483
|
+
* Log update download start
|
|
2484
|
+
*/
|
|
2485
|
+
updateDownloadStart(context: Record<string, unknown>): void {
|
|
2486
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2487
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2488
|
+
if (jsonLogger?.isActive()) {
|
|
2489
|
+
jsonLogger.logInfo('Update Download Start', context);
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
// Console output controlled by log level
|
|
2493
|
+
if (this.level < LogLevel.INFO) return;
|
|
2494
|
+
|
|
2495
|
+
const location = this.getCallLocation();
|
|
2496
|
+
const timestamp = this.getTimestamp();
|
|
2497
|
+
const prefix = this.getPrefix();
|
|
2498
|
+
const loc = this.getLocation(location);
|
|
2499
|
+
|
|
2500
|
+
console.log(timestamp, prefix, loc, chalk.cyan('⬇️ UPDATE DOWNLOAD START'));
|
|
2501
|
+
if (Object.keys(context).length > 0) {
|
|
2502
|
+
console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
/**
|
|
2507
|
+
* Log update download progress
|
|
2508
|
+
*/
|
|
2509
|
+
updateDownloadProgress(context: Record<string, unknown>): void {
|
|
2510
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2511
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2512
|
+
if (jsonLogger?.isActive()) {
|
|
2513
|
+
jsonLogger.logDebug('Update Download Progress', context);
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
// Console output controlled by log level
|
|
2517
|
+
if (this.level < LogLevel.DEBUG) return;
|
|
2518
|
+
|
|
2519
|
+
const location = this.getCallLocation();
|
|
2520
|
+
const timestamp = this.getTimestamp();
|
|
2521
|
+
const prefix = this.getPrefix();
|
|
2522
|
+
const loc = this.getLocation(location);
|
|
2523
|
+
|
|
2524
|
+
console.log(timestamp, prefix, loc, chalk.cyan('⬇️ DOWNLOAD PROGRESS:'), `${context['percent']}%`);
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
/**
|
|
2528
|
+
* Log update download complete
|
|
2529
|
+
*/
|
|
2530
|
+
updateDownloadComplete(context: Record<string, unknown>): void {
|
|
2531
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2532
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2533
|
+
if (jsonLogger?.isActive()) {
|
|
2534
|
+
jsonLogger.logInfo('Update Download Complete', context);
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
// Console output controlled by log level
|
|
2538
|
+
if (this.level < LogLevel.INFO) return;
|
|
2539
|
+
|
|
2540
|
+
const location = this.getCallLocation();
|
|
2541
|
+
const timestamp = this.getTimestamp();
|
|
2542
|
+
const prefix = this.getPrefix();
|
|
2543
|
+
const loc = this.getLocation(location);
|
|
2544
|
+
|
|
2545
|
+
console.log(timestamp, prefix, loc, chalk.green('✅ UPDATE DOWNLOAD COMPLETE'));
|
|
2546
|
+
if (Object.keys(context).length > 0) {
|
|
2547
|
+
console.log(chalk.green(' Version:'), context['version']);
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
/**
|
|
2552
|
+
* Log update installing
|
|
2553
|
+
*/
|
|
2554
|
+
updateInstalling(): void {
|
|
2555
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2556
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2557
|
+
if (jsonLogger?.isActive()) {
|
|
2558
|
+
jsonLogger.logInfo('Update Installing', {});
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
// Console output controlled by log level
|
|
2562
|
+
if (this.level < LogLevel.INFO) return;
|
|
2563
|
+
|
|
2564
|
+
const location = this.getCallLocation();
|
|
2565
|
+
const timestamp = this.getTimestamp();
|
|
2566
|
+
const prefix = this.getPrefix();
|
|
2567
|
+
const loc = this.getLocation(location);
|
|
2568
|
+
|
|
2569
|
+
console.log(timestamp, prefix, loc, chalk.yellow('🔧 UPDATE INSTALLING'));
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
/**
|
|
2573
|
+
* Log update installed
|
|
2574
|
+
*/
|
|
2575
|
+
updateInstalled(context: Record<string, unknown>): void {
|
|
2576
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2577
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2578
|
+
if (jsonLogger?.isActive()) {
|
|
2579
|
+
jsonLogger.logInfo('Update Installed', context);
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
// Console output controlled by log level
|
|
2583
|
+
if (this.level < LogLevel.INFO) return;
|
|
2584
|
+
|
|
2585
|
+
const location = this.getCallLocation();
|
|
2586
|
+
const timestamp = this.getTimestamp();
|
|
2587
|
+
const prefix = this.getPrefix();
|
|
2588
|
+
const loc = this.getLocation(location);
|
|
2589
|
+
|
|
2590
|
+
console.log(timestamp, prefix, loc, chalk.green('🎉 UPDATE INSTALLED'));
|
|
2591
|
+
if (Object.keys(context).length > 0) {
|
|
2592
|
+
console.log(chalk.green(' Version:'), context['version']);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
/**
|
|
2597
|
+
* Log update error
|
|
2598
|
+
*/
|
|
2599
|
+
updateError(context: Record<string, unknown>): void {
|
|
2600
|
+
// Always log to file first (for Ctrl+O LogBrowser)
|
|
2601
|
+
const jsonLogger = getJsonStreamLogger();
|
|
2602
|
+
if (jsonLogger?.isActive()) {
|
|
2603
|
+
jsonLogger.logError(new Error(String(context['error'] || 'Unknown error')), 'updateError');
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
// Console output controlled by log level
|
|
2607
|
+
if (this.level < LogLevel.ERROR) return;
|
|
2608
|
+
|
|
2609
|
+
const location = this.getCallLocation();
|
|
2610
|
+
const timestamp = this.getTimestamp();
|
|
2611
|
+
const prefix = this.getPrefix();
|
|
2612
|
+
const loc = this.getLocation(location);
|
|
2613
|
+
|
|
2614
|
+
console.log(timestamp, prefix, loc, chalk.red('❌ UPDATE ERROR'));
|
|
2615
|
+
if (Object.keys(context).length > 0) {
|
|
2616
|
+
console.log(chalk.red(' Error:'), context['error']);
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
/**
|
|
2622
|
+
* Global logger instance
|
|
2623
|
+
*
|
|
2624
|
+
* Default is ERROR level (No log output in Normal mode)
|
|
2625
|
+
* Adjust level with CLI argument:
|
|
2626
|
+
* - Normal mode (open): ERROR (No log output, feedback via UI only)
|
|
2627
|
+
* - Verbose mode (open --verbose): WARN
|
|
2628
|
+
* - Debug mode (open --debug): VERBOSE
|
|
2629
|
+
*/
|
|
2630
|
+
export const logger = new Logger({
|
|
2631
|
+
level: LogLevel.ERROR, // Normal mode: No log output (show ERROR only)
|
|
2632
|
+
prefix: 'LOCAL-CLI',
|
|
2633
|
+
timestamp: true,
|
|
2634
|
+
showLocation: false, // Dynamically changed in setLogLevel()
|
|
2635
|
+
showPid: false, // Enable via environment variable if needed
|
|
2636
|
+
});
|
|
2637
|
+
|
|
2638
|
+
/**
|
|
2639
|
+
* Set global log level from CLI or config
|
|
2640
|
+
* Automatically show location info when DEBUG or higher
|
|
2641
|
+
*/
|
|
2642
|
+
export function setLogLevel(level: LogLevel): void {
|
|
2643
|
+
logger.setLevel(level);
|
|
2644
|
+
|
|
2645
|
+
// Automatically show location info for DEBUG or higher
|
|
2646
|
+
if (level >= LogLevel.DEBUG) {
|
|
2647
|
+
logger['showLocation'] = true;
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* Enable verbose logging
|
|
2653
|
+
*/
|
|
2654
|
+
export function enableVerbose(): void {
|
|
2655
|
+
logger.setLevel(LogLevel.VERBOSE);
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
/**
|
|
2659
|
+
* Disable verbose logging
|
|
2660
|
+
*/
|
|
2661
|
+
export function disableVerbose(): void {
|
|
2662
|
+
logger.setLevel(LogLevel.INFO);
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
/**
|
|
2666
|
+
* Enable debug logging
|
|
2667
|
+
*/
|
|
2668
|
+
export function enableDebug(): void {
|
|
2669
|
+
logger.setLevel(LogLevel.DEBUG);
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
/**
|
|
2673
|
+
* Create a child logger with a specific prefix
|
|
2674
|
+
*/
|
|
2675
|
+
export function createLogger(prefix: string, options?: Partial<LoggerOptions>): Logger {
|
|
2676
|
+
return new Logger({
|
|
2677
|
+
level: logger['level'],
|
|
2678
|
+
prefix,
|
|
2679
|
+
timestamp: true,
|
|
2680
|
+
showLocation: logger['showLocation'],
|
|
2681
|
+
showPid: logger['showPid'],
|
|
2682
|
+
...options,
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
/**
|
|
2687
|
+
* Generate a unique trace ID
|
|
2688
|
+
*/
|
|
2689
|
+
export function generateTraceId(): string {
|
|
2690
|
+
return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
/**
|
|
2694
|
+
* Setup logging configuration based on CLI options
|
|
2695
|
+
* - Configures log level (verbose/debug)
|
|
2696
|
+
* - Initializes JSON stream logger
|
|
2697
|
+
* - Sets up process exit handlers for cleanup
|
|
2698
|
+
*
|
|
2699
|
+
* @param options - CLI options containing verbose and debug flags
|
|
2700
|
+
* @returns Object containing cleanup function and JSON logger instance
|
|
2701
|
+
*/
|
|
2702
|
+
export async function setupLogging(options: {
|
|
2703
|
+
verbose?: boolean;
|
|
2704
|
+
debug?: boolean;
|
|
2705
|
+
llmLog?: boolean;
|
|
2706
|
+
sessionId?: string;
|
|
2707
|
+
}): Promise<{
|
|
2708
|
+
cleanup: () => Promise<void>;
|
|
2709
|
+
jsonLogger: Awaited<ReturnType<typeof import('./json-stream-logger.js').initializeJsonStreamLogger>>;
|
|
2710
|
+
}> {
|
|
2711
|
+
const { initializeJsonStreamLogger, closeJsonStreamLogger } = await import('./json-stream-logger.js');
|
|
2712
|
+
const { sessionManager } = await import('../core/session/session-manager.js');
|
|
2713
|
+
|
|
2714
|
+
// Determine if verbose/debug mode is enabled
|
|
2715
|
+
const isVerboseMode = options.verbose || options.debug;
|
|
2716
|
+
|
|
2717
|
+
// Initialize JSON stream logger (always enabled, but only show messages in verbose/debug mode)
|
|
2718
|
+
const sessionId = options.sessionId || (sessionManager.getCurrentSessionId() as string);
|
|
2719
|
+
const jsonLogger = await initializeJsonStreamLogger(sessionId, false, isVerboseMode);
|
|
2720
|
+
|
|
2721
|
+
// Enable LLM logging if --llm-log flag is set
|
|
2722
|
+
if (options.llmLog) {
|
|
2723
|
+
enableLLMLog();
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
// Set log level based on CLI options
|
|
2727
|
+
// Normal mode (no flags): ERROR
|
|
2728
|
+
// --verbose: DEBUG (detailed logging)
|
|
2729
|
+
// --debug: VERBOSE (maximum debug logging + location info)
|
|
2730
|
+
// --llm-log: ERROR (show LLM requests/responses only)
|
|
2731
|
+
if (options.debug) {
|
|
2732
|
+
setLogLevel(LogLevel.VERBOSE);
|
|
2733
|
+
logger.debug('🔍 Debug mode enabled - maximum logging with location tracking');
|
|
2734
|
+
} else if (options.verbose) {
|
|
2735
|
+
setLogLevel(LogLevel.DEBUG);
|
|
2736
|
+
logger.debug('📝 Verbose mode enabled - detailed logging');
|
|
2737
|
+
} else if (options.llmLog) {
|
|
2738
|
+
// llm-log mode: keep ERROR level, just enable LLM logging
|
|
2739
|
+
console.log(chalk.cyan('📡 LLM Log mode enabled - showing LLM requests/responses only'));
|
|
2740
|
+
}
|
|
2741
|
+
// Normal mode: no startup message
|
|
2742
|
+
|
|
2743
|
+
// Track cleanup state to prevent duplicate calls
|
|
2744
|
+
let cleanupCalled = false;
|
|
2745
|
+
|
|
2746
|
+
// Cleanup function to close logger (idempotent - safe to call multiple times)
|
|
2747
|
+
const cleanup = async () => {
|
|
2748
|
+
if (cleanupCalled) {
|
|
2749
|
+
return; // Already cleaned up, skip
|
|
2750
|
+
}
|
|
2751
|
+
cleanupCalled = true;
|
|
2752
|
+
await closeJsonStreamLogger();
|
|
2753
|
+
};
|
|
2754
|
+
|
|
2755
|
+
// Ensure cleanup on exit (prevent duplicate handlers with once flag)
|
|
2756
|
+
// Note: SIGINT is handled by ink/PlanExecuteApp for smart Ctrl+C behavior
|
|
2757
|
+
// Only SIGTERM triggers automatic exit (for system shutdown signals)
|
|
2758
|
+
const exitHandler = async (signal: string) => {
|
|
2759
|
+
logger.debug(`Received ${signal}, cleaning up...`);
|
|
2760
|
+
await cleanup();
|
|
2761
|
+
process.exit(0);
|
|
2762
|
+
};
|
|
2763
|
+
|
|
2764
|
+
process.once('SIGTERM', () => exitHandler('SIGTERM'));
|
|
2765
|
+
|
|
2766
|
+
return { cleanup, jsonLogger };
|
|
2767
|
+
}
|