universal-agent-protocol 0.5.0
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/LICENSE +21 -0
- package/README.md +462 -0
- package/dist/analyzers/index.d.ts +3 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +656 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/bin/cli.d.ts +3 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +506 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/bin/tool-calls.d.ts +3 -0
- package/dist/bin/tool-calls.d.ts.map +1 -0
- package/dist/bin/tool-calls.js +4 -0
- package/dist/bin/tool-calls.js.map +1 -0
- package/dist/cli/agent.d.ts +20 -0
- package/dist/cli/agent.d.ts.map +1 -0
- package/dist/cli/agent.js +434 -0
- package/dist/cli/agent.js.map +1 -0
- package/dist/cli/analyze.d.ts +7 -0
- package/dist/cli/analyze.d.ts.map +1 -0
- package/dist/cli/analyze.js +103 -0
- package/dist/cli/analyze.js.map +1 -0
- package/dist/cli/coord.d.ts +7 -0
- package/dist/cli/coord.d.ts.map +1 -0
- package/dist/cli/coord.js +138 -0
- package/dist/cli/coord.js.map +1 -0
- package/dist/cli/dashboard.d.ts +8 -0
- package/dist/cli/dashboard.d.ts.map +1 -0
- package/dist/cli/dashboard.js +704 -0
- package/dist/cli/dashboard.js.map +1 -0
- package/dist/cli/deploy.d.ts +19 -0
- package/dist/cli/deploy.d.ts.map +1 -0
- package/dist/cli/deploy.js +267 -0
- package/dist/cli/deploy.js.map +1 -0
- package/dist/cli/droids.d.ts +9 -0
- package/dist/cli/droids.d.ts.map +1 -0
- package/dist/cli/droids.js +227 -0
- package/dist/cli/droids.js.map +1 -0
- package/dist/cli/generate.d.ts +17 -0
- package/dist/cli/generate.d.ts.map +1 -0
- package/dist/cli/generate.js +432 -0
- package/dist/cli/generate.js.map +1 -0
- package/dist/cli/hooks.d.ts +9 -0
- package/dist/cli/hooks.d.ts.map +1 -0
- package/dist/cli/hooks.js +374 -0
- package/dist/cli/hooks.js.map +1 -0
- package/dist/cli/init.d.ts +11 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +316 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/mcp-router.d.ts +16 -0
- package/dist/cli/mcp-router.d.ts.map +1 -0
- package/dist/cli/mcp-router.js +143 -0
- package/dist/cli/mcp-router.js.map +1 -0
- package/dist/cli/memory.d.ts +24 -0
- package/dist/cli/memory.d.ts.map +1 -0
- package/dist/cli/memory.js +877 -0
- package/dist/cli/memory.js.map +1 -0
- package/dist/cli/model.d.ts +15 -0
- package/dist/cli/model.d.ts.map +1 -0
- package/dist/cli/model.js +270 -0
- package/dist/cli/model.js.map +1 -0
- package/dist/cli/patterns.d.ts +26 -0
- package/dist/cli/patterns.d.ts.map +1 -0
- package/dist/cli/patterns.js +587 -0
- package/dist/cli/patterns.js.map +1 -0
- package/dist/cli/setup-mcp-router.d.ts +8 -0
- package/dist/cli/setup-mcp-router.d.ts.map +1 -0
- package/dist/cli/setup-mcp-router.js +163 -0
- package/dist/cli/setup-mcp-router.js.map +1 -0
- package/dist/cli/setup.d.ts +13 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +146 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/sync.d.ts +7 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +26 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/cli/task.d.ts +33 -0
- package/dist/cli/task.d.ts.map +1 -0
- package/dist/cli/task.js +616 -0
- package/dist/cli/task.js.map +1 -0
- package/dist/cli/tool-calls.d.ts +8 -0
- package/dist/cli/tool-calls.d.ts.map +1 -0
- package/dist/cli/tool-calls.js +239 -0
- package/dist/cli/tool-calls.js.map +1 -0
- package/dist/cli/update.d.ts +10 -0
- package/dist/cli/update.d.ts.map +1 -0
- package/dist/cli/update.js +300 -0
- package/dist/cli/update.js.map +1 -0
- package/dist/cli/visualize.d.ts +77 -0
- package/dist/cli/visualize.d.ts.map +1 -0
- package/dist/cli/visualize.js +287 -0
- package/dist/cli/visualize.js.map +1 -0
- package/dist/cli/worktree.d.ts +9 -0
- package/dist/cli/worktree.d.ts.map +1 -0
- package/dist/cli/worktree.js +175 -0
- package/dist/cli/worktree.js.map +1 -0
- package/dist/coordination/capability-router.d.ts +79 -0
- package/dist/coordination/capability-router.d.ts.map +1 -0
- package/dist/coordination/capability-router.js +324 -0
- package/dist/coordination/capability-router.js.map +1 -0
- package/dist/coordination/database.d.ts +13 -0
- package/dist/coordination/database.d.ts.map +1 -0
- package/dist/coordination/database.js +131 -0
- package/dist/coordination/database.js.map +1 -0
- package/dist/coordination/deploy-batcher.d.ts +101 -0
- package/dist/coordination/deploy-batcher.d.ts.map +1 -0
- package/dist/coordination/deploy-batcher.js +565 -0
- package/dist/coordination/deploy-batcher.js.map +1 -0
- package/dist/coordination/index.d.ts +5 -0
- package/dist/coordination/index.d.ts.map +1 -0
- package/dist/coordination/index.js +5 -0
- package/dist/coordination/index.js.map +1 -0
- package/dist/coordination/service.d.ts +81 -0
- package/dist/coordination/service.d.ts.map +1 -0
- package/dist/coordination/service.js +603 -0
- package/dist/coordination/service.js.map +1 -0
- package/dist/generators/claude-md.d.ts +3 -0
- package/dist/generators/claude-md.d.ts.map +1 -0
- package/dist/generators/claude-md.js +977 -0
- package/dist/generators/claude-md.js.map +1 -0
- package/dist/generators/template-loader.d.ts +105 -0
- package/dist/generators/template-loader.d.ts.map +1 -0
- package/dist/generators/template-loader.js +291 -0
- package/dist/generators/template-loader.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-router/config/parser.d.ts +9 -0
- package/dist/mcp-router/config/parser.d.ts.map +1 -0
- package/dist/mcp-router/config/parser.js +174 -0
- package/dist/mcp-router/config/parser.js.map +1 -0
- package/dist/mcp-router/executor/client.d.ts +31 -0
- package/dist/mcp-router/executor/client.d.ts.map +1 -0
- package/dist/mcp-router/executor/client.js +187 -0
- package/dist/mcp-router/executor/client.js.map +1 -0
- package/dist/mcp-router/index.d.ts +22 -0
- package/dist/mcp-router/index.d.ts.map +1 -0
- package/dist/mcp-router/index.js +18 -0
- package/dist/mcp-router/index.js.map +1 -0
- package/dist/mcp-router/output-compressor.d.ts +26 -0
- package/dist/mcp-router/output-compressor.d.ts.map +1 -0
- package/dist/mcp-router/output-compressor.js +236 -0
- package/dist/mcp-router/output-compressor.js.map +1 -0
- package/dist/mcp-router/search/fuzzy.d.ts +26 -0
- package/dist/mcp-router/search/fuzzy.d.ts.map +1 -0
- package/dist/mcp-router/search/fuzzy.js +94 -0
- package/dist/mcp-router/search/fuzzy.js.map +1 -0
- package/dist/mcp-router/server.d.ts +50 -0
- package/dist/mcp-router/server.d.ts.map +1 -0
- package/dist/mcp-router/server.js +229 -0
- package/dist/mcp-router/server.js.map +1 -0
- package/dist/mcp-router/session-stats.d.ts +37 -0
- package/dist/mcp-router/session-stats.d.ts.map +1 -0
- package/dist/mcp-router/session-stats.js +56 -0
- package/dist/mcp-router/session-stats.js.map +1 -0
- package/dist/mcp-router/tools/discover.d.ts +37 -0
- package/dist/mcp-router/tools/discover.d.ts.map +1 -0
- package/dist/mcp-router/tools/discover.js +65 -0
- package/dist/mcp-router/tools/discover.js.map +1 -0
- package/dist/mcp-router/tools/execute.d.ts +43 -0
- package/dist/mcp-router/tools/execute.d.ts.map +1 -0
- package/dist/mcp-router/tools/execute.js +103 -0
- package/dist/mcp-router/tools/execute.js.map +1 -0
- package/dist/mcp-router/types.d.ts +62 -0
- package/dist/mcp-router/types.d.ts.map +1 -0
- package/dist/mcp-router/types.js +6 -0
- package/dist/mcp-router/types.js.map +1 -0
- package/dist/memory/adaptive-context.d.ts +146 -0
- package/dist/memory/adaptive-context.d.ts.map +1 -0
- package/dist/memory/adaptive-context.js +1022 -0
- package/dist/memory/adaptive-context.js.map +1 -0
- package/dist/memory/agent-scoped-memory.d.ts +67 -0
- package/dist/memory/agent-scoped-memory.d.ts.map +1 -0
- package/dist/memory/agent-scoped-memory.js +126 -0
- package/dist/memory/agent-scoped-memory.js.map +1 -0
- package/dist/memory/backends/base.d.ts +18 -0
- package/dist/memory/backends/base.d.ts.map +1 -0
- package/dist/memory/backends/base.js +2 -0
- package/dist/memory/backends/base.js.map +1 -0
- package/dist/memory/backends/factory.d.ts +4 -0
- package/dist/memory/backends/factory.d.ts.map +1 -0
- package/dist/memory/backends/factory.js +53 -0
- package/dist/memory/backends/factory.js.map +1 -0
- package/dist/memory/backends/github.d.ts +22 -0
- package/dist/memory/backends/github.d.ts.map +1 -0
- package/dist/memory/backends/github.js +118 -0
- package/dist/memory/backends/github.js.map +1 -0
- package/dist/memory/backends/qdrant-cloud.d.ts +32 -0
- package/dist/memory/backends/qdrant-cloud.d.ts.map +1 -0
- package/dist/memory/backends/qdrant-cloud.js +168 -0
- package/dist/memory/backends/qdrant-cloud.js.map +1 -0
- package/dist/memory/context-compressor.d.ts +74 -0
- package/dist/memory/context-compressor.d.ts.map +1 -0
- package/dist/memory/context-compressor.js +289 -0
- package/dist/memory/context-compressor.js.map +1 -0
- package/dist/memory/correction-propagator.d.ts +44 -0
- package/dist/memory/correction-propagator.d.ts.map +1 -0
- package/dist/memory/correction-propagator.js +156 -0
- package/dist/memory/correction-propagator.js.map +1 -0
- package/dist/memory/daily-log.d.ts +67 -0
- package/dist/memory/daily-log.d.ts.map +1 -0
- package/dist/memory/daily-log.js +143 -0
- package/dist/memory/daily-log.js.map +1 -0
- package/dist/memory/dynamic-retrieval.d.ts +110 -0
- package/dist/memory/dynamic-retrieval.d.ts.map +1 -0
- package/dist/memory/dynamic-retrieval.js +688 -0
- package/dist/memory/dynamic-retrieval.js.map +1 -0
- package/dist/memory/embeddings.d.ts +116 -0
- package/dist/memory/embeddings.d.ts.map +1 -0
- package/dist/memory/embeddings.js +461 -0
- package/dist/memory/embeddings.js.map +1 -0
- package/dist/memory/hierarchical-memory.d.ts +141 -0
- package/dist/memory/hierarchical-memory.d.ts.map +1 -0
- package/dist/memory/hierarchical-memory.js +477 -0
- package/dist/memory/hierarchical-memory.js.map +1 -0
- package/dist/memory/memory-consolidator.d.ts +124 -0
- package/dist/memory/memory-consolidator.d.ts.map +1 -0
- package/dist/memory/memory-consolidator.js +514 -0
- package/dist/memory/memory-consolidator.js.map +1 -0
- package/dist/memory/memory-maintenance.d.ts +39 -0
- package/dist/memory/memory-maintenance.d.ts.map +1 -0
- package/dist/memory/memory-maintenance.js +305 -0
- package/dist/memory/memory-maintenance.js.map +1 -0
- package/dist/memory/model-router.d.ts +102 -0
- package/dist/memory/model-router.d.ts.map +1 -0
- package/dist/memory/model-router.js +448 -0
- package/dist/memory/model-router.js.map +1 -0
- package/dist/memory/multi-view-memory.d.ts +134 -0
- package/dist/memory/multi-view-memory.d.ts.map +1 -0
- package/dist/memory/multi-view-memory.js +420 -0
- package/dist/memory/multi-view-memory.js.map +1 -0
- package/dist/memory/prepopulate.d.ts +76 -0
- package/dist/memory/prepopulate.d.ts.map +1 -0
- package/dist/memory/prepopulate.js +815 -0
- package/dist/memory/prepopulate.js.map +1 -0
- package/dist/memory/semantic-compression.d.ts +77 -0
- package/dist/memory/semantic-compression.d.ts.map +1 -0
- package/dist/memory/semantic-compression.js +348 -0
- package/dist/memory/semantic-compression.js.map +1 -0
- package/dist/memory/serverless-qdrant.d.ts +102 -0
- package/dist/memory/serverless-qdrant.d.ts.map +1 -0
- package/dist/memory/serverless-qdrant.js +369 -0
- package/dist/memory/serverless-qdrant.js.map +1 -0
- package/dist/memory/short-term/factory.d.ts +26 -0
- package/dist/memory/short-term/factory.d.ts.map +1 -0
- package/dist/memory/short-term/factory.js +28 -0
- package/dist/memory/short-term/factory.js.map +1 -0
- package/dist/memory/short-term/indexeddb.d.ts +25 -0
- package/dist/memory/short-term/indexeddb.d.ts.map +1 -0
- package/dist/memory/short-term/indexeddb.js +64 -0
- package/dist/memory/short-term/indexeddb.js.map +1 -0
- package/dist/memory/short-term/schema.d.ts +6 -0
- package/dist/memory/short-term/schema.d.ts.map +1 -0
- package/dist/memory/short-term/schema.js +119 -0
- package/dist/memory/short-term/schema.js.map +1 -0
- package/dist/memory/short-term/sqlite.d.ts +50 -0
- package/dist/memory/short-term/sqlite.d.ts.map +1 -0
- package/dist/memory/short-term/sqlite.js +221 -0
- package/dist/memory/short-term/sqlite.js.map +1 -0
- package/dist/memory/speculative-cache.d.ts +111 -0
- package/dist/memory/speculative-cache.d.ts.map +1 -0
- package/dist/memory/speculative-cache.js +409 -0
- package/dist/memory/speculative-cache.js.map +1 -0
- package/dist/memory/task-classifier.d.ts +34 -0
- package/dist/memory/task-classifier.d.ts.map +1 -0
- package/dist/memory/task-classifier.js +300 -0
- package/dist/memory/task-classifier.js.map +1 -0
- package/dist/memory/terminal-bench-knowledge.d.ts +48 -0
- package/dist/memory/terminal-bench-knowledge.d.ts.map +1 -0
- package/dist/memory/terminal-bench-knowledge.js +399 -0
- package/dist/memory/terminal-bench-knowledge.js.map +1 -0
- package/dist/memory/write-gate.d.ts +39 -0
- package/dist/memory/write-gate.d.ts.map +1 -0
- package/dist/memory/write-gate.js +190 -0
- package/dist/memory/write-gate.js.map +1 -0
- package/dist/models/executor.d.ts +130 -0
- package/dist/models/executor.d.ts.map +1 -0
- package/dist/models/executor.js +383 -0
- package/dist/models/executor.js.map +1 -0
- package/dist/models/index.d.ts +15 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +17 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/planner.d.ts +71 -0
- package/dist/models/planner.d.ts.map +1 -0
- package/dist/models/planner.js +344 -0
- package/dist/models/planner.js.map +1 -0
- package/dist/models/router.d.ts +75 -0
- package/dist/models/router.d.ts.map +1 -0
- package/dist/models/router.js +344 -0
- package/dist/models/router.js.map +1 -0
- package/dist/models/types.d.ts +370 -0
- package/dist/models/types.d.ts.map +1 -0
- package/dist/models/types.js +181 -0
- package/dist/models/types.js.map +1 -0
- package/dist/tasks/coordination.d.ts +74 -0
- package/dist/tasks/coordination.d.ts.map +1 -0
- package/dist/tasks/coordination.js +237 -0
- package/dist/tasks/coordination.js.map +1 -0
- package/dist/tasks/database.d.ts +14 -0
- package/dist/tasks/database.d.ts.map +1 -0
- package/dist/tasks/database.js +128 -0
- package/dist/tasks/database.js.map +1 -0
- package/dist/tasks/index.d.ts +5 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +5 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/service.d.ts +39 -0
- package/dist/tasks/service.d.ts.map +1 -0
- package/dist/tasks/service.js +582 -0
- package/dist/tasks/service.js.map +1 -0
- package/dist/tasks/types.d.ts +224 -0
- package/dist/tasks/types.d.ts.map +1 -0
- package/dist/tasks/types.js +64 -0
- package/dist/tasks/types.js.map +1 -0
- package/dist/types/analysis.d.ts +82 -0
- package/dist/types/analysis.d.ts.map +1 -0
- package/dist/types/analysis.js +2 -0
- package/dist/types/analysis.js.map +1 -0
- package/dist/types/config.d.ts +3023 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +292 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/coordination.d.ts +240 -0
- package/dist/types/coordination.d.ts.map +1 -0
- package/dist/types/coordination.js +43 -0
- package/dist/types/coordination.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/calculate-average.d.ts +15 -0
- package/dist/utils/calculate-average.d.ts.map +1 -0
- package/dist/utils/calculate-average.js +21 -0
- package/dist/utils/calculate-average.js.map +1 -0
- package/dist/utils/config-manager.d.ts +30 -0
- package/dist/utils/config-manager.d.ts.map +1 -0
- package/dist/utils/config-manager.js +41 -0
- package/dist/utils/config-manager.js.map +1 -0
- package/dist/utils/dijkstra.d.ts +17 -0
- package/dist/utils/dijkstra.d.ts.map +1 -0
- package/dist/utils/dijkstra.js +91 -0
- package/dist/utils/dijkstra.js.map +1 -0
- package/dist/utils/fetch-with-retry.d.ts +5 -0
- package/dist/utils/fetch-with-retry.d.ts.map +1 -0
- package/dist/utils/fetch-with-retry.js +61 -0
- package/dist/utils/fetch-with-retry.js.map +1 -0
- package/dist/utils/merge-claude-md.d.ts +28 -0
- package/dist/utils/merge-claude-md.d.ts.map +1 -0
- package/dist/utils/merge-claude-md.js +342 -0
- package/dist/utils/merge-claude-md.js.map +1 -0
- package/dist/utils/order-processor-refactored.d.ts +126 -0
- package/dist/utils/order-processor-refactored.d.ts.map +1 -0
- package/dist/utils/order-processor-refactored.js +165 -0
- package/dist/utils/order-processor-refactored.js.map +1 -0
- package/dist/utils/order-processor-strategy.d.ts +72 -0
- package/dist/utils/order-processor-strategy.d.ts.map +1 -0
- package/dist/utils/order-processor-strategy.js +158 -0
- package/dist/utils/order-processor-strategy.js.map +1 -0
- package/dist/utils/order-processor.d.ts +242 -0
- package/dist/utils/order-processor.d.ts.map +1 -0
- package/dist/utils/order-processor.js +370 -0
- package/dist/utils/order-processor.js.map +1 -0
- package/dist/utils/rate-limiter-simple.d.ts +58 -0
- package/dist/utils/rate-limiter-simple.d.ts.map +1 -0
- package/dist/utils/rate-limiter-simple.js +100 -0
- package/dist/utils/rate-limiter-simple.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +62 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +150 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/utils/string-similarity.d.ts +37 -0
- package/dist/utils/string-similarity.d.ts.map +1 -0
- package/dist/utils/string-similarity.js +114 -0
- package/dist/utils/string-similarity.js.map +1 -0
- package/dist/utils/validate-json.d.ts +51 -0
- package/dist/utils/validate-json.d.ts.map +1 -0
- package/dist/utils/validate-json.js +99 -0
- package/dist/utils/validate-json.js.map +1 -0
- package/package.json +96 -0
- package/templates/CLAUDE.template.md +11 -0
- package/templates/CLAUDE_ARCHITECTURE.template.md +103 -0
- package/templates/CLAUDE_CODING.template.md +125 -0
- package/templates/CLAUDE_DROIDS.template.md +109 -0
- package/templates/CLAUDE_MEMORY.template.md +130 -0
- package/templates/CLAUDE_WORKFLOWS.template.md +136 -0
- package/templates/PROJECT.template.md +209 -0
- package/templates/SCHEMA.md +57 -0
- package/templates/archive/CLAUDE.template.root-v6.md +762 -0
- package/templates/archive/CLAUDE.template.v6.md +762 -0
- package/templates/hooks/pre-compact.sh +68 -0
- package/templates/hooks/session-start.sh +106 -0
- package/tools/agents/README.md +224 -0
- package/tools/agents/UAP/README.md +351 -0
- package/tools/agents/UAP/__init__.py +9 -0
- package/tools/agents/UAP/cli.py +675 -0
- package/tools/agents/UAP/version.py +2 -0
- package/tools/agents/benchmarks/benchmark_memory_systems.py +637 -0
- package/tools/agents/benchmarks/results/benchmark_20260106_064817.json +170 -0
- package/tools/agents/benchmarks/results/benchmark_20260106_064817.md +51 -0
- package/tools/agents/config/chat_template.jinja +172 -0
- package/tools/agents/docker-compose.qdrant.yml +24 -0
- package/tools/agents/migrations/apply.py +256 -0
- package/tools/agents/scripts/fix_qwen_chat_template.py +314 -0
- package/tools/agents/scripts/init_qdrant.py +151 -0
- package/tools/agents/scripts/memory_migration.py +518 -0
- package/tools/agents/scripts/migrate_memory_to_qdrant.py +113 -0
- package/tools/agents/scripts/query_memory.py +189 -0
- package/tools/agents/scripts/qwen_tool_call_test.py +419 -0
- package/tools/agents/scripts/qwen_tool_call_wrapper.py +517 -0
- package/tools/agents/scripts/start-services.sh +96 -0
- package/tools/agents/tests/test_uap_compliance.py +257 -0
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import ora from 'ora';
|
|
3
|
+
import { existsSync, statSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { execSync } from 'child_process';
|
|
6
|
+
import { TaskService } from '../tasks/service.js';
|
|
7
|
+
import { CoordinationService } from '../coordination/service.js';
|
|
8
|
+
import { SQLiteShortTermMemory } from '../memory/short-term/sqlite.js';
|
|
9
|
+
import { progressBar, stackedBar, stackedBarLegend, horizontalBarChart, table, tree, box, sectionHeader, keyValue, miniGauge, statusBadge, divider, bulletList, columns, } from './visualize.js';
|
|
10
|
+
import { STATUS_ICONS, TYPE_ICONS, PRIORITY_LABELS } from '../tasks/types.js';
|
|
11
|
+
import { globalSessionStats } from '../mcp-router/session-stats.js';
|
|
12
|
+
export async function dashboardCommand(action, options = {}) {
|
|
13
|
+
switch (action) {
|
|
14
|
+
case 'overview':
|
|
15
|
+
await showOverview(options);
|
|
16
|
+
break;
|
|
17
|
+
case 'tasks':
|
|
18
|
+
await showTaskDashboard(options);
|
|
19
|
+
break;
|
|
20
|
+
case 'agents':
|
|
21
|
+
await showAgentDashboard(options);
|
|
22
|
+
break;
|
|
23
|
+
case 'memory':
|
|
24
|
+
await showMemoryDashboard(options);
|
|
25
|
+
break;
|
|
26
|
+
case 'progress':
|
|
27
|
+
await showProgressDashboard(options);
|
|
28
|
+
break;
|
|
29
|
+
case 'stats':
|
|
30
|
+
await showStatsDashboard(options);
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function showOverview(_options) {
|
|
35
|
+
const spinner = ora('Loading dashboard...').start();
|
|
36
|
+
try {
|
|
37
|
+
const taskService = new TaskService();
|
|
38
|
+
const coordService = new CoordinationService();
|
|
39
|
+
const stats = taskService.getStats();
|
|
40
|
+
const coordStatus = coordService.getStatus();
|
|
41
|
+
spinner.stop();
|
|
42
|
+
console.log('');
|
|
43
|
+
console.log(chalk.bold.cyan(' UAP Dashboard'));
|
|
44
|
+
console.log(divider(60));
|
|
45
|
+
console.log('');
|
|
46
|
+
// Task completion progress
|
|
47
|
+
const completedTasks = stats.byStatus.done + stats.byStatus.wont_do;
|
|
48
|
+
const activeTasks = stats.total - completedTasks;
|
|
49
|
+
console.log(sectionHeader('Task Progress'));
|
|
50
|
+
console.log('');
|
|
51
|
+
console.log(` ${progressBar(completedTasks, stats.total, 40, {
|
|
52
|
+
label: 'Completion',
|
|
53
|
+
filled: chalk.green,
|
|
54
|
+
})}`);
|
|
55
|
+
console.log('');
|
|
56
|
+
// Status breakdown bar
|
|
57
|
+
const statusSegments = [
|
|
58
|
+
{ value: stats.byStatus.done, color: chalk.green, label: `Done ${STATUS_ICONS.done}` },
|
|
59
|
+
{ value: stats.byStatus.in_progress, color: chalk.cyan, label: `In Progress ${STATUS_ICONS.in_progress}` },
|
|
60
|
+
{ value: stats.byStatus.open, color: chalk.white, label: `Open ${STATUS_ICONS.open}` },
|
|
61
|
+
{ value: stats.byStatus.blocked, color: chalk.red, label: `Blocked ${STATUS_ICONS.blocked}` },
|
|
62
|
+
{ value: stats.byStatus.wont_do, color: chalk.dim, label: `Won't Do ${STATUS_ICONS.wont_do}` },
|
|
63
|
+
];
|
|
64
|
+
console.log(` ${stackedBar(statusSegments, stats.total, 50)}`);
|
|
65
|
+
console.log(` ${stackedBarLegend(statusSegments)}`);
|
|
66
|
+
console.log('');
|
|
67
|
+
// Two-column layout: Priority vs Type
|
|
68
|
+
const priorityLines = [
|
|
69
|
+
chalk.bold(' By Priority'),
|
|
70
|
+
...horizontalBarChart([
|
|
71
|
+
{ label: 'P0 Critical', value: stats.byPriority[0], color: chalk.red },
|
|
72
|
+
{ label: 'P1 High', value: stats.byPriority[1], color: chalk.yellow },
|
|
73
|
+
{ label: 'P2 Medium', value: stats.byPriority[2], color: chalk.blue },
|
|
74
|
+
{ label: 'P3 Low', value: stats.byPriority[3], color: chalk.dim },
|
|
75
|
+
{ label: 'P4 Backlog', value: stats.byPriority[4], color: chalk.dim },
|
|
76
|
+
], { maxWidth: 20, maxLabelWidth: 14 }),
|
|
77
|
+
];
|
|
78
|
+
const typeData = Object.entries(stats.byType)
|
|
79
|
+
.filter(([, count]) => count > 0);
|
|
80
|
+
const typeLines = [
|
|
81
|
+
chalk.bold(' By Type'),
|
|
82
|
+
...horizontalBarChart(typeData.map(([type, count]) => ({
|
|
83
|
+
label: `${TYPE_ICONS[type]} ${type}`,
|
|
84
|
+
value: count,
|
|
85
|
+
color: chalk.magenta,
|
|
86
|
+
})), { maxWidth: 20, maxLabelWidth: 14 }),
|
|
87
|
+
];
|
|
88
|
+
const combined = columns(priorityLines, typeLines, { gap: 6, leftWidth: 42 });
|
|
89
|
+
for (const line of combined)
|
|
90
|
+
console.log(line);
|
|
91
|
+
console.log('');
|
|
92
|
+
// Agent Status
|
|
93
|
+
console.log(sectionHeader('Agents & Coordination'));
|
|
94
|
+
console.log('');
|
|
95
|
+
const agentItems = coordStatus.activeAgents.map(a => ({
|
|
96
|
+
text: `${chalk.cyan(a.name)} ${statusBadge(a.status)}${a.currentTask ? chalk.dim(` working on ${a.currentTask}`) : ''}`,
|
|
97
|
+
status: a.status === 'active' ? 'ok' : 'warn',
|
|
98
|
+
}));
|
|
99
|
+
if (agentItems.length > 0) {
|
|
100
|
+
for (const line of bulletList(agentItems))
|
|
101
|
+
console.log(line);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
console.log(chalk.dim(' No active agents'));
|
|
105
|
+
}
|
|
106
|
+
console.log('');
|
|
107
|
+
for (const line of keyValue([
|
|
108
|
+
['Active Agents', coordStatus.activeAgents.length],
|
|
109
|
+
['Resource Claims', coordStatus.activeClaims.length],
|
|
110
|
+
['Pending Deploys', coordStatus.pendingDeploys.length],
|
|
111
|
+
['Unread Messages', coordStatus.pendingMessages],
|
|
112
|
+
]))
|
|
113
|
+
console.log(line);
|
|
114
|
+
// Memory summary
|
|
115
|
+
console.log('');
|
|
116
|
+
console.log(sectionHeader('Memory'));
|
|
117
|
+
console.log('');
|
|
118
|
+
const cwd = process.cwd();
|
|
119
|
+
const dbPath = join(cwd, 'agents/data/memory/short_term.db');
|
|
120
|
+
const memoryItems = [];
|
|
121
|
+
if (existsSync(dbPath)) {
|
|
122
|
+
const dbStats = statSync(dbPath);
|
|
123
|
+
const sizeKB = Math.round(dbStats.size / 1024);
|
|
124
|
+
memoryItems.push({
|
|
125
|
+
text: `Short-term: ${chalk.bold(sizeKB + ' KB')} ${chalk.dim(`(modified ${dbStats.mtime.toLocaleDateString()})`)}`,
|
|
126
|
+
status: 'ok',
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
memoryItems.push({ text: 'Short-term: Not initialized', status: 'warn' });
|
|
131
|
+
}
|
|
132
|
+
let qdrantRunning = false;
|
|
133
|
+
try {
|
|
134
|
+
const dockerStatus = execSync('docker ps --filter name=qdrant --format "{{.Status}}"', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
135
|
+
if (dockerStatus) {
|
|
136
|
+
memoryItems.push({ text: `Qdrant: ${chalk.bold('Running')} ${chalk.dim(dockerStatus)}`, status: 'ok' });
|
|
137
|
+
qdrantRunning = true;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
memoryItems.push({ text: 'Qdrant: Stopped', status: 'warn' });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
memoryItems.push({ text: 'Qdrant: Not available', status: 'warn' });
|
|
145
|
+
}
|
|
146
|
+
for (const line of bulletList(memoryItems))
|
|
147
|
+
console.log(line);
|
|
148
|
+
// Summary box
|
|
149
|
+
console.log('');
|
|
150
|
+
const summaryContent = [
|
|
151
|
+
`Tasks: ${chalk.bold(stats.total)} total, ${chalk.green(completedTasks + ' done')}, ${chalk.yellow(activeTasks + ' active')}`,
|
|
152
|
+
`Agents: ${chalk.bold(coordStatus.activeAgents.length)} active`,
|
|
153
|
+
`Memory: ${existsSync(dbPath) ? chalk.green('SQLite') : chalk.dim('None')} / ${qdrantRunning ? chalk.green('Qdrant') : chalk.dim('No Qdrant')}`,
|
|
154
|
+
];
|
|
155
|
+
for (const line of box('Summary', summaryContent, { borderColor: chalk.cyan })) {
|
|
156
|
+
console.log(` ${line}`);
|
|
157
|
+
}
|
|
158
|
+
console.log('');
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
spinner.fail('Failed to load dashboard');
|
|
162
|
+
console.error(chalk.red(error instanceof Error ? error.message : String(error)));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
async function showTaskDashboard(options) {
|
|
166
|
+
const spinner = ora('Loading task dashboard...').start();
|
|
167
|
+
try {
|
|
168
|
+
const service = new TaskService();
|
|
169
|
+
const stats = service.getStats();
|
|
170
|
+
const allTasks = service.list({});
|
|
171
|
+
const readyTasks = service.ready();
|
|
172
|
+
const blockedTasks = service.blocked();
|
|
173
|
+
spinner.stop();
|
|
174
|
+
console.log('');
|
|
175
|
+
console.log(chalk.bold.cyan(' Task Dashboard'));
|
|
176
|
+
console.log(divider(60));
|
|
177
|
+
console.log('');
|
|
178
|
+
// Completion gauge
|
|
179
|
+
const done = stats.byStatus.done + stats.byStatus.wont_do;
|
|
180
|
+
console.log(` ${chalk.bold('Completion')} ${miniGauge(done, stats.total, 20)} ${chalk.bold(Math.round(done / Math.max(stats.total, 1) * 100) + '%')} ${chalk.dim(`(${done}/${stats.total})`)}`);
|
|
181
|
+
console.log(` ${chalk.bold('In Flight ')} ${miniGauge(stats.byStatus.in_progress, stats.total, 20)} ${chalk.dim(`${stats.byStatus.in_progress} tasks`)}`);
|
|
182
|
+
console.log(` ${chalk.bold('Blocked ')} ${miniGauge(stats.byStatus.blocked, stats.total, 20)} ${chalk.dim(`${stats.byStatus.blocked} tasks`)}`);
|
|
183
|
+
console.log('');
|
|
184
|
+
// Status stacked bar
|
|
185
|
+
console.log(sectionHeader('Status Distribution'));
|
|
186
|
+
console.log('');
|
|
187
|
+
const segments = [
|
|
188
|
+
{ value: stats.byStatus.done, color: chalk.green, label: 'Done' },
|
|
189
|
+
{ value: stats.byStatus.in_progress, color: chalk.cyan, label: 'In Progress' },
|
|
190
|
+
{ value: stats.byStatus.open, color: chalk.white, label: 'Open' },
|
|
191
|
+
{ value: stats.byStatus.blocked, color: chalk.red, label: 'Blocked' },
|
|
192
|
+
{ value: stats.byStatus.wont_do, color: chalk.dim, label: "Won't Do" },
|
|
193
|
+
];
|
|
194
|
+
console.log(` ${stackedBar(segments, stats.total, 50)}`);
|
|
195
|
+
console.log(` ${stackedBarLegend(segments)}`);
|
|
196
|
+
console.log('');
|
|
197
|
+
// Priority chart
|
|
198
|
+
console.log(sectionHeader('Priority Breakdown'));
|
|
199
|
+
console.log('');
|
|
200
|
+
for (const line of horizontalBarChart([
|
|
201
|
+
{ label: 'P0 Critical', value: stats.byPriority[0], color: chalk.red },
|
|
202
|
+
{ label: 'P1 High', value: stats.byPriority[1], color: chalk.yellow },
|
|
203
|
+
{ label: 'P2 Medium', value: stats.byPriority[2], color: chalk.blue },
|
|
204
|
+
{ label: 'P3 Low', value: stats.byPriority[3], color: chalk.dim },
|
|
205
|
+
{ label: 'P4 Backlog', value: stats.byPriority[4], color: chalk.dim },
|
|
206
|
+
], { maxWidth: 35, maxLabelWidth: 14 })) {
|
|
207
|
+
console.log(line);
|
|
208
|
+
}
|
|
209
|
+
console.log('');
|
|
210
|
+
// Type chart
|
|
211
|
+
const typeData = Object.entries(stats.byType)
|
|
212
|
+
.filter(([, count]) => count > 0);
|
|
213
|
+
if (typeData.length > 0) {
|
|
214
|
+
console.log(sectionHeader('Type Breakdown'));
|
|
215
|
+
console.log('');
|
|
216
|
+
for (const line of horizontalBarChart(typeData.map(([type, count]) => ({
|
|
217
|
+
label: `${TYPE_ICONS[type]} ${type}`,
|
|
218
|
+
value: count,
|
|
219
|
+
color: chalk.magenta,
|
|
220
|
+
})), { maxWidth: 35, maxLabelWidth: 14 })) {
|
|
221
|
+
console.log(line);
|
|
222
|
+
}
|
|
223
|
+
console.log('');
|
|
224
|
+
}
|
|
225
|
+
// Ready tasks table
|
|
226
|
+
if (readyTasks.length > 0) {
|
|
227
|
+
console.log(sectionHeader('Ready to Work'));
|
|
228
|
+
console.log('');
|
|
229
|
+
const readyRows = readyTasks.slice(0, 10).map(t => ({
|
|
230
|
+
id: t.id,
|
|
231
|
+
priority: `P${t.priority}`,
|
|
232
|
+
type: TYPE_ICONS[t.type],
|
|
233
|
+
title: t.title.slice(0, 40) + (t.title.length > 40 ? '...' : ''),
|
|
234
|
+
}));
|
|
235
|
+
for (const line of table(readyRows, [
|
|
236
|
+
{ key: 'id', header: 'ID', width: 10, color: chalk.cyan },
|
|
237
|
+
{ key: 'priority', header: 'Pri', width: 5 },
|
|
238
|
+
{ key: 'type', header: 'T', width: 3 },
|
|
239
|
+
{ key: 'title', header: 'Title', width: 42 },
|
|
240
|
+
])) {
|
|
241
|
+
console.log(line);
|
|
242
|
+
}
|
|
243
|
+
if (readyTasks.length > 10) {
|
|
244
|
+
console.log(chalk.dim(` ... and ${readyTasks.length - 10} more`));
|
|
245
|
+
}
|
|
246
|
+
console.log('');
|
|
247
|
+
}
|
|
248
|
+
// Blocked tasks
|
|
249
|
+
if (blockedTasks.length > 0) {
|
|
250
|
+
console.log(sectionHeader('Blocked Tasks'));
|
|
251
|
+
console.log('');
|
|
252
|
+
for (const t of blockedTasks.slice(0, 5)) {
|
|
253
|
+
console.log(` ${chalk.red(STATUS_ICONS.blocked)} ${chalk.cyan(t.id)} ${t.title}`);
|
|
254
|
+
if (t.blockedBy.length > 0) {
|
|
255
|
+
console.log(chalk.red(` Blocked by: ${t.blockedBy.join(', ')}`));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
console.log('');
|
|
259
|
+
}
|
|
260
|
+
// In-progress tasks
|
|
261
|
+
const inProgress = allTasks.filter(t => t.status === 'in_progress');
|
|
262
|
+
if (inProgress.length > 0) {
|
|
263
|
+
console.log(sectionHeader('In Progress'));
|
|
264
|
+
console.log('');
|
|
265
|
+
for (const t of inProgress) {
|
|
266
|
+
console.log(` ${chalk.cyan(STATUS_ICONS.in_progress)} ${chalk.cyan(t.id)} ${t.title}`);
|
|
267
|
+
if (t.assignee)
|
|
268
|
+
console.log(chalk.dim(` Assigned: ${t.assignee}`));
|
|
269
|
+
}
|
|
270
|
+
console.log('');
|
|
271
|
+
}
|
|
272
|
+
// Task hierarchy tree (epics with children)
|
|
273
|
+
const epics = allTasks.filter(t => t.type === 'epic' && t.status !== 'done' && t.status !== 'wont_do');
|
|
274
|
+
if (epics.length > 0 && !options.compact) {
|
|
275
|
+
console.log(sectionHeader('Task Hierarchy'));
|
|
276
|
+
console.log('');
|
|
277
|
+
for (const epic of epics.slice(0, 3)) {
|
|
278
|
+
const children = allTasks.filter(t => t.parentId === epic.id);
|
|
279
|
+
const epicNode = {
|
|
280
|
+
label: `${chalk.bold(epic.title)} ${chalk.dim(epic.id)}`,
|
|
281
|
+
status: STATUS_ICONS[epic.status],
|
|
282
|
+
children: children.map(c => ({
|
|
283
|
+
label: `${c.title} ${chalk.dim(c.id)}`,
|
|
284
|
+
status: STATUS_ICONS[c.status],
|
|
285
|
+
meta: `P${c.priority} ${c.type}`,
|
|
286
|
+
})),
|
|
287
|
+
};
|
|
288
|
+
for (const line of tree(epicNode))
|
|
289
|
+
console.log(line);
|
|
290
|
+
}
|
|
291
|
+
console.log('');
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
spinner.fail('Failed to load task dashboard');
|
|
296
|
+
console.error(chalk.red(error instanceof Error ? error.message : String(error)));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
async function showAgentDashboard(_options) {
|
|
300
|
+
const spinner = ora('Loading agent dashboard...').start();
|
|
301
|
+
try {
|
|
302
|
+
const coordService = new CoordinationService();
|
|
303
|
+
const status = coordService.getStatus();
|
|
304
|
+
const activeWork = coordService.getActiveWork();
|
|
305
|
+
spinner.stop();
|
|
306
|
+
console.log('');
|
|
307
|
+
console.log(chalk.bold.cyan(' Agent Dashboard'));
|
|
308
|
+
console.log(divider(60));
|
|
309
|
+
console.log('');
|
|
310
|
+
// Agent count and status
|
|
311
|
+
console.log(sectionHeader('Active Agents'));
|
|
312
|
+
console.log('');
|
|
313
|
+
if (status.activeAgents.length === 0) {
|
|
314
|
+
console.log(chalk.dim(' No active agents registered'));
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
const agentRows = status.activeAgents.map(a => ({
|
|
318
|
+
name: a.name,
|
|
319
|
+
status: statusBadge(a.status),
|
|
320
|
+
task: a.currentTask || chalk.dim('idle'),
|
|
321
|
+
heartbeat: chalk.dim(a.lastHeartbeat.slice(11, 19)),
|
|
322
|
+
}));
|
|
323
|
+
for (const line of table(agentRows, [
|
|
324
|
+
{ key: 'name', header: 'Agent', width: 18, color: chalk.cyan },
|
|
325
|
+
{ key: 'status', header: 'Status', width: 16 },
|
|
326
|
+
{ key: 'task', header: 'Current Task', width: 20 },
|
|
327
|
+
{ key: 'heartbeat', header: 'Last Beat', width: 10 },
|
|
328
|
+
])) {
|
|
329
|
+
console.log(line);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
console.log('');
|
|
333
|
+
// Resource claims
|
|
334
|
+
console.log(sectionHeader('Resource Claims'));
|
|
335
|
+
console.log('');
|
|
336
|
+
if (status.activeClaims.length === 0) {
|
|
337
|
+
console.log(chalk.dim(' No active resource claims'));
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
for (const claim of status.activeClaims) {
|
|
341
|
+
const lockIcon = claim.claimType === 'exclusive' ? chalk.red('EXCL') : chalk.green('SHARED');
|
|
342
|
+
console.log(` ${lockIcon} ${chalk.yellow(claim.resource)}`);
|
|
343
|
+
console.log(chalk.dim(` Agent: ${claim.agentId.slice(0, 8)}...`));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
console.log('');
|
|
347
|
+
// Active work visualization
|
|
348
|
+
if (activeWork.length > 0) {
|
|
349
|
+
console.log(sectionHeader('Active Work'));
|
|
350
|
+
console.log('');
|
|
351
|
+
const grouped = new Map();
|
|
352
|
+
for (const work of activeWork) {
|
|
353
|
+
const existing = grouped.get(work.resource) || [];
|
|
354
|
+
existing.push(work);
|
|
355
|
+
grouped.set(work.resource, existing);
|
|
356
|
+
}
|
|
357
|
+
for (const [resource, works] of grouped) {
|
|
358
|
+
const hasConflict = works.length > 1;
|
|
359
|
+
const icon = hasConflict ? chalk.red('!!') : chalk.green('OK');
|
|
360
|
+
console.log(` ${icon} ${chalk.bold(resource)}`);
|
|
361
|
+
for (const w of works) {
|
|
362
|
+
console.log(` ${chalk.cyan(w.agentName || w.agentId.slice(0, 8))} ${chalk.dim(w.intentType)}`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
console.log('');
|
|
366
|
+
}
|
|
367
|
+
// Deploy queue
|
|
368
|
+
console.log(sectionHeader('Deploy Queue'));
|
|
369
|
+
console.log('');
|
|
370
|
+
if (status.pendingDeploys.length === 0) {
|
|
371
|
+
console.log(chalk.dim(' No pending deploys'));
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
console.log(` ${chalk.bold(String(status.pendingDeploys.length))} pending deploy action(s)`);
|
|
375
|
+
const grouped = new Map();
|
|
376
|
+
for (const d of status.pendingDeploys) {
|
|
377
|
+
grouped.set(d.actionType, (grouped.get(d.actionType) || 0) + 1);
|
|
378
|
+
}
|
|
379
|
+
for (const line of horizontalBarChart([...grouped.entries()].map(([type, count]) => ({
|
|
380
|
+
label: type,
|
|
381
|
+
value: count,
|
|
382
|
+
color: chalk.yellow,
|
|
383
|
+
})), { maxWidth: 20, maxLabelWidth: 12 })) {
|
|
384
|
+
console.log(line);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
console.log('');
|
|
388
|
+
// Summary
|
|
389
|
+
for (const line of keyValue([
|
|
390
|
+
['Total Agents', status.activeAgents.length],
|
|
391
|
+
['Resource Claims', status.activeClaims.length],
|
|
392
|
+
['Active Work Items', activeWork.length],
|
|
393
|
+
['Pending Deploys', status.pendingDeploys.length],
|
|
394
|
+
['Unread Messages', status.pendingMessages],
|
|
395
|
+
]))
|
|
396
|
+
console.log(line);
|
|
397
|
+
console.log('');
|
|
398
|
+
}
|
|
399
|
+
catch (error) {
|
|
400
|
+
spinner.fail('Failed to load agent dashboard');
|
|
401
|
+
console.error(chalk.red(error instanceof Error ? error.message : String(error)));
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
async function showMemoryDashboard(_options) {
|
|
405
|
+
const spinner = ora('Loading memory dashboard...').start();
|
|
406
|
+
try {
|
|
407
|
+
const cwd = process.cwd();
|
|
408
|
+
const dbPath = join(cwd, 'agents/data/memory/short_term.db');
|
|
409
|
+
spinner.stop();
|
|
410
|
+
console.log('');
|
|
411
|
+
console.log(chalk.bold.cyan(' Memory Dashboard'));
|
|
412
|
+
console.log(divider(60));
|
|
413
|
+
console.log('');
|
|
414
|
+
// Short-term memory
|
|
415
|
+
console.log(sectionHeader('Short-Term Memory (SQLite)'));
|
|
416
|
+
console.log('');
|
|
417
|
+
if (existsSync(dbPath)) {
|
|
418
|
+
const dbStats = statSync(dbPath);
|
|
419
|
+
const sizeKB = Math.round(dbStats.size / 1024);
|
|
420
|
+
try {
|
|
421
|
+
const shortTermDb = new SQLiteShortTermMemory({
|
|
422
|
+
dbPath,
|
|
423
|
+
projectId: 'dashboard',
|
|
424
|
+
maxEntries: 9999,
|
|
425
|
+
});
|
|
426
|
+
const count = await shortTermDb.count();
|
|
427
|
+
await shortTermDb.close();
|
|
428
|
+
for (const line of keyValue([
|
|
429
|
+
['Status', 'Active'],
|
|
430
|
+
['Entries', count],
|
|
431
|
+
['Size', `${sizeKB} KB`],
|
|
432
|
+
['Last Modified', dbStats.mtime.toLocaleDateString()],
|
|
433
|
+
['Path', dbPath],
|
|
434
|
+
]))
|
|
435
|
+
console.log(line);
|
|
436
|
+
console.log('');
|
|
437
|
+
console.log(` ${chalk.bold('Capacity')} ${miniGauge(count, 50, 20)} ${chalk.dim(`${count}/50 entries`)}`);
|
|
438
|
+
}
|
|
439
|
+
catch {
|
|
440
|
+
console.log(` ${statusBadge('active')} ${chalk.dim(`${sizeKB} KB`)}`);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
console.log(` ${statusBadge('not_available')} Not initialized`);
|
|
445
|
+
}
|
|
446
|
+
console.log('');
|
|
447
|
+
// Qdrant status
|
|
448
|
+
console.log(sectionHeader('Long-Term Memory (Qdrant)'));
|
|
449
|
+
console.log('');
|
|
450
|
+
try {
|
|
451
|
+
const dockerStatus = execSync('docker ps --filter name=qdrant --format "{{.Status}}"', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
452
|
+
if (dockerStatus) {
|
|
453
|
+
console.log(` ${statusBadge('running')} ${chalk.dim(dockerStatus)}`);
|
|
454
|
+
try {
|
|
455
|
+
const dockerInspect = execSync('docker inspect --format "{{.Config.Image}}" uap-qdrant 2>/dev/null || docker inspect --format "{{.Config.Image}}" qdrant 2>/dev/null', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
456
|
+
if (dockerInspect) {
|
|
457
|
+
console.log(chalk.dim(` Image: ${dockerInspect}`));
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
catch { /* ignore */ }
|
|
461
|
+
console.log(chalk.dim(' Endpoint: http://localhost:6333'));
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
console.log(` ${statusBadge('stopped')} Container not running`);
|
|
465
|
+
console.log(chalk.dim(' Start with: uap memory start'));
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
catch {
|
|
469
|
+
console.log(` ${statusBadge('not_available')} Docker not available`);
|
|
470
|
+
}
|
|
471
|
+
console.log('');
|
|
472
|
+
// Embeddings
|
|
473
|
+
console.log(sectionHeader('Embeddings (Ollama)'));
|
|
474
|
+
console.log('');
|
|
475
|
+
try {
|
|
476
|
+
const ollamaResponse = await fetch('http://localhost:11434/api/tags', {
|
|
477
|
+
method: 'GET',
|
|
478
|
+
signal: AbortSignal.timeout(2000),
|
|
479
|
+
});
|
|
480
|
+
if (ollamaResponse.ok) {
|
|
481
|
+
const ollamaData = await ollamaResponse.json();
|
|
482
|
+
const embedModels = ollamaData.models?.filter(m => m.name.includes('embed') || m.name.includes('nomic')) || [];
|
|
483
|
+
if (embedModels.length > 0) {
|
|
484
|
+
console.log(` ${statusBadge('active')}`);
|
|
485
|
+
for (const model of embedModels) {
|
|
486
|
+
const sizeMB = Math.round((model.size || 0) / 1024 / 1024);
|
|
487
|
+
console.log(` ${chalk.cyan(model.name)} ${chalk.dim(`${sizeMB} MB`)}`);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
console.log(` ${statusBadge('not_available')} No embedding models found`);
|
|
492
|
+
console.log(chalk.dim(' Install: ollama pull nomic-embed-text'));
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
console.log(` ${statusBadge('stopped')} Not responding`);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
catch {
|
|
500
|
+
console.log(` ${statusBadge('not_available')} Ollama not running`);
|
|
501
|
+
console.log(chalk.dim(' Install from https://ollama.ai'));
|
|
502
|
+
}
|
|
503
|
+
// Memory layers summary
|
|
504
|
+
console.log('');
|
|
505
|
+
console.log(sectionHeader('Memory Layer Architecture'));
|
|
506
|
+
console.log('');
|
|
507
|
+
const layers = {
|
|
508
|
+
label: chalk.bold('UAP Memory System'),
|
|
509
|
+
children: [
|
|
510
|
+
{
|
|
511
|
+
label: 'L1 Working Memory',
|
|
512
|
+
status: existsSync(dbPath) ? chalk.green('ON') : chalk.red('OFF'),
|
|
513
|
+
meta: 'SQLite, <1ms',
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
label: 'L2 Session Memory',
|
|
517
|
+
status: existsSync(dbPath) ? chalk.green('ON') : chalk.red('OFF'),
|
|
518
|
+
meta: 'SQLite, <5ms',
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
label: 'L3 Semantic Memory',
|
|
522
|
+
status: chalk.yellow('?'),
|
|
523
|
+
meta: 'Qdrant, ~50ms',
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
label: 'L4 Knowledge Graph',
|
|
527
|
+
status: existsSync(dbPath) ? chalk.green('ON') : chalk.red('OFF'),
|
|
528
|
+
meta: 'SQLite entities/rels',
|
|
529
|
+
},
|
|
530
|
+
],
|
|
531
|
+
};
|
|
532
|
+
for (const line of tree(layers))
|
|
533
|
+
console.log(line);
|
|
534
|
+
console.log('');
|
|
535
|
+
}
|
|
536
|
+
catch (error) {
|
|
537
|
+
spinner.fail('Failed to load memory dashboard');
|
|
538
|
+
console.error(chalk.red(error instanceof Error ? error.message : String(error)));
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
async function showProgressDashboard(_options) {
|
|
542
|
+
const spinner = ora('Loading progress dashboard...').start();
|
|
543
|
+
try {
|
|
544
|
+
const service = new TaskService();
|
|
545
|
+
const stats = service.getStats();
|
|
546
|
+
const allTasks = service.list({});
|
|
547
|
+
spinner.stop();
|
|
548
|
+
console.log('');
|
|
549
|
+
console.log(chalk.bold.cyan(' Progress Dashboard'));
|
|
550
|
+
console.log(divider(60));
|
|
551
|
+
console.log('');
|
|
552
|
+
const total = stats.total;
|
|
553
|
+
const done = stats.byStatus.done;
|
|
554
|
+
const wontDo = stats.byStatus.wont_do;
|
|
555
|
+
const inProgress = stats.byStatus.in_progress;
|
|
556
|
+
const blocked = stats.byStatus.blocked;
|
|
557
|
+
const open = stats.byStatus.open;
|
|
558
|
+
const completed = done + wontDo;
|
|
559
|
+
// Big completion percentage
|
|
560
|
+
const pct = total > 0 ? Math.round((completed / total) * 100) : 0;
|
|
561
|
+
const bigNum = pct >= 80 ? chalk.green : pct >= 50 ? chalk.yellow : chalk.red;
|
|
562
|
+
console.log(` ${bigNum(chalk.bold(`${pct}%`))} ${chalk.dim('complete')}`);
|
|
563
|
+
console.log('');
|
|
564
|
+
console.log(` ${progressBar(completed, total, 50, {
|
|
565
|
+
showPercent: false,
|
|
566
|
+
showCount: false,
|
|
567
|
+
filled: pct >= 80 ? chalk.green : pct >= 50 ? chalk.yellow : chalk.red,
|
|
568
|
+
})}`);
|
|
569
|
+
console.log('');
|
|
570
|
+
// Flow breakdown
|
|
571
|
+
console.log(sectionHeader('Task Flow'));
|
|
572
|
+
console.log('');
|
|
573
|
+
console.log(` ${chalk.white('Open')} ${progressBar(open, total, 30, { filled: chalk.white, showPercent: true, showCount: true })}`);
|
|
574
|
+
console.log(` ${chalk.cyan('In Progress')} ${progressBar(inProgress, total, 30, { filled: chalk.cyan, showPercent: true, showCount: true })}`);
|
|
575
|
+
console.log(` ${chalk.red('Blocked')} ${progressBar(blocked, total, 30, { filled: chalk.red, showPercent: true, showCount: true })}`);
|
|
576
|
+
console.log(` ${chalk.green('Done')} ${progressBar(done, total, 30, { filled: chalk.green, showPercent: true, showCount: true })}`);
|
|
577
|
+
if (wontDo > 0) {
|
|
578
|
+
console.log(` ${chalk.dim("Won't Do")} ${progressBar(wontDo, total, 30, { filled: chalk.dim, showPercent: true, showCount: true })}`);
|
|
579
|
+
}
|
|
580
|
+
console.log('');
|
|
581
|
+
// Per-priority progress
|
|
582
|
+
console.log(sectionHeader('Progress by Priority'));
|
|
583
|
+
console.log('');
|
|
584
|
+
for (let p = 0; p <= 4; p++) {
|
|
585
|
+
const priority = p;
|
|
586
|
+
const priorityTasks = allTasks.filter(t => t.priority === priority);
|
|
587
|
+
const priorityDone = priorityTasks.filter(t => t.status === 'done' || t.status === 'wont_do').length;
|
|
588
|
+
const priorityTotal = priorityTasks.length;
|
|
589
|
+
if (priorityTotal > 0) {
|
|
590
|
+
const color = p === 0 ? chalk.red : p === 1 ? chalk.yellow : p === 2 ? chalk.blue : chalk.dim;
|
|
591
|
+
const label = PRIORITY_LABELS[priority].padEnd(14);
|
|
592
|
+
console.log(` ${color(label)} ${progressBar(priorityDone, priorityTotal, 25, {
|
|
593
|
+
filled: color,
|
|
594
|
+
showPercent: true,
|
|
595
|
+
showCount: true,
|
|
596
|
+
})}`);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
console.log('');
|
|
600
|
+
// Per-type progress
|
|
601
|
+
const typeData = Object.entries(stats.byType)
|
|
602
|
+
.filter(([, count]) => count > 0);
|
|
603
|
+
if (typeData.length > 0) {
|
|
604
|
+
console.log(sectionHeader('Progress by Type'));
|
|
605
|
+
console.log('');
|
|
606
|
+
for (const [type, typeTotal] of typeData) {
|
|
607
|
+
const typeDone = allTasks.filter(t => t.type === type && (t.status === 'done' || t.status === 'wont_do')).length;
|
|
608
|
+
const label = `${TYPE_ICONS[type]} ${type}`.padEnd(14);
|
|
609
|
+
console.log(` ${label} ${progressBar(typeDone, typeTotal, 25, {
|
|
610
|
+
filled: chalk.magenta,
|
|
611
|
+
showPercent: true,
|
|
612
|
+
showCount: true,
|
|
613
|
+
})}`);
|
|
614
|
+
}
|
|
615
|
+
console.log('');
|
|
616
|
+
}
|
|
617
|
+
// Velocity indicator (recent completions)
|
|
618
|
+
const now = new Date();
|
|
619
|
+
const recentDone = allTasks.filter(t => {
|
|
620
|
+
if (t.status !== 'done' || !t.closedAt)
|
|
621
|
+
return false;
|
|
622
|
+
const closedDate = new Date(t.closedAt);
|
|
623
|
+
const daysDiff = (now.getTime() - closedDate.getTime()) / (1000 * 60 * 60 * 24);
|
|
624
|
+
return daysDiff <= 7;
|
|
625
|
+
});
|
|
626
|
+
const recentCreated = allTasks.filter(t => {
|
|
627
|
+
const createdDate = new Date(t.createdAt);
|
|
628
|
+
const daysDiff = (now.getTime() - createdDate.getTime()) / (1000 * 60 * 60 * 24);
|
|
629
|
+
return daysDiff <= 7;
|
|
630
|
+
});
|
|
631
|
+
console.log(sectionHeader('Velocity (Last 7 Days)'));
|
|
632
|
+
console.log('');
|
|
633
|
+
for (const line of keyValue([
|
|
634
|
+
['Completed', `${recentDone.length} tasks`],
|
|
635
|
+
['Created', `${recentCreated.length} tasks`],
|
|
636
|
+
['Net Progress', `${recentDone.length - recentCreated.length > 0 ? '+' : ''}${recentDone.length - recentCreated.length}`],
|
|
637
|
+
]))
|
|
638
|
+
console.log(line);
|
|
639
|
+
console.log('');
|
|
640
|
+
// Summary box
|
|
641
|
+
const summaryLines = [
|
|
642
|
+
`${chalk.bold(String(total))} total tasks`,
|
|
643
|
+
`${chalk.green(String(completed))} completed ${chalk.dim(`(${pct}%)`)}`,
|
|
644
|
+
`${chalk.cyan(String(inProgress))} in progress`,
|
|
645
|
+
`${blocked > 0 ? chalk.red(String(blocked) + ' blocked') : chalk.dim('0 blocked')}`,
|
|
646
|
+
`${chalk.dim(String(open))} open / awaiting`,
|
|
647
|
+
];
|
|
648
|
+
for (const line of box('Summary', summaryLines, { borderColor: chalk.cyan })) {
|
|
649
|
+
console.log(` ${line}`);
|
|
650
|
+
}
|
|
651
|
+
console.log('');
|
|
652
|
+
}
|
|
653
|
+
catch (error) {
|
|
654
|
+
spinner.fail('Failed to load progress dashboard');
|
|
655
|
+
console.error(chalk.red(error instanceof Error ? error.message : String(error)));
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
function formatBytes(bytes) {
|
|
659
|
+
if (bytes < 1024)
|
|
660
|
+
return `${bytes} B`;
|
|
661
|
+
if (bytes < 1024 * 1024)
|
|
662
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
663
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
664
|
+
}
|
|
665
|
+
function formatDuration(ms) {
|
|
666
|
+
if (ms < 60000)
|
|
667
|
+
return `${(ms / 1000).toFixed(1)} sec`;
|
|
668
|
+
return `${(ms / 60000).toFixed(1)} min`;
|
|
669
|
+
}
|
|
670
|
+
async function showStatsDashboard(_options) {
|
|
671
|
+
const summary = globalSessionStats.getSummary();
|
|
672
|
+
console.log('');
|
|
673
|
+
console.log(chalk.bold.cyan(' Session Stats'));
|
|
674
|
+
console.log(divider(60));
|
|
675
|
+
console.log('');
|
|
676
|
+
const estimatedTokens = Math.round(summary.totalContextBytes / 4);
|
|
677
|
+
for (const line of keyValue([
|
|
678
|
+
['Uptime', formatDuration(summary.uptimeMs)],
|
|
679
|
+
['Tool calls', String(summary.totalCalls)],
|
|
680
|
+
['Context used', `${formatBytes(summary.totalContextBytes)} (~${estimatedTokens.toLocaleString()} tokens)`],
|
|
681
|
+
['Raw data processed', formatBytes(summary.totalRawBytes)],
|
|
682
|
+
['Savings ratio', `${summary.savingsRatio}x (${summary.savingsPercent} reduction)`],
|
|
683
|
+
]))
|
|
684
|
+
console.log(line);
|
|
685
|
+
if (summary.byTool.length > 0) {
|
|
686
|
+
console.log('');
|
|
687
|
+
console.log(sectionHeader('Per-Tool Breakdown'));
|
|
688
|
+
console.log('');
|
|
689
|
+
const rows = summary.byTool.map(t => [
|
|
690
|
+
chalk.white(t.tool),
|
|
691
|
+
`${t.calls} call${t.calls !== 1 ? 's' : ''}`,
|
|
692
|
+
formatBytes(t.contextBytes),
|
|
693
|
+
]);
|
|
694
|
+
for (const row of rows) {
|
|
695
|
+
console.log(` ${row[0].padEnd(35)} ${row[1].padEnd(12)} ${row[2]}`);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
if (summary.totalCalls === 0) {
|
|
699
|
+
console.log('');
|
|
700
|
+
console.log(chalk.dim(' No tool calls recorded yet. Stats populate when MCP Router processes requests.'));
|
|
701
|
+
}
|
|
702
|
+
console.log('');
|
|
703
|
+
}
|
|
704
|
+
//# sourceMappingURL=dashboard.js.map
|