@miller-tech/uap 1.0.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 +888 -0
- package/dist/analyzers/index.d.ts +3 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +684 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/benchmarks/agents/naive-agent.d.ts +60 -0
- package/dist/benchmarks/agents/naive-agent.d.ts.map +1 -0
- package/dist/benchmarks/agents/naive-agent.js +144 -0
- package/dist/benchmarks/agents/naive-agent.js.map +1 -0
- package/dist/benchmarks/agents/uap-agent.d.ts +167 -0
- package/dist/benchmarks/agents/uap-agent.d.ts.map +1 -0
- package/dist/benchmarks/agents/uap-agent.js +437 -0
- package/dist/benchmarks/agents/uap-agent.js.map +1 -0
- package/dist/benchmarks/benchmark.d.ts +328 -0
- package/dist/benchmarks/benchmark.d.ts.map +1 -0
- package/dist/benchmarks/benchmark.js +112 -0
- package/dist/benchmarks/benchmark.js.map +1 -0
- package/dist/benchmarks/execution-verifier.d.ts +41 -0
- package/dist/benchmarks/execution-verifier.d.ts.map +1 -0
- package/dist/benchmarks/execution-verifier.js +340 -0
- package/dist/benchmarks/execution-verifier.js.map +1 -0
- package/dist/benchmarks/hierarchical-prompting.d.ts +37 -0
- package/dist/benchmarks/hierarchical-prompting.d.ts.map +1 -0
- package/dist/benchmarks/hierarchical-prompting.js +246 -0
- package/dist/benchmarks/hierarchical-prompting.js.map +1 -0
- package/dist/benchmarks/improved-benchmark.d.ts +89 -0
- package/dist/benchmarks/improved-benchmark.d.ts.map +1 -0
- package/dist/benchmarks/improved-benchmark.js +585 -0
- package/dist/benchmarks/improved-benchmark.js.map +1 -0
- package/dist/benchmarks/index.d.ts +11 -0
- package/dist/benchmarks/index.d.ts.map +1 -0
- package/dist/benchmarks/index.js +11 -0
- package/dist/benchmarks/index.js.map +1 -0
- package/dist/benchmarks/model-integration.d.ts +111 -0
- package/dist/benchmarks/model-integration.d.ts.map +1 -0
- package/dist/benchmarks/model-integration.js +904 -0
- package/dist/benchmarks/model-integration.js.map +1 -0
- package/dist/benchmarks/multi-turn-agent.d.ts +44 -0
- package/dist/benchmarks/multi-turn-agent.d.ts.map +1 -0
- package/dist/benchmarks/multi-turn-agent.js +254 -0
- package/dist/benchmarks/multi-turn-agent.js.map +1 -0
- package/dist/benchmarks/multi-turn-loop.d.ts +57 -0
- package/dist/benchmarks/multi-turn-loop.d.ts.map +1 -0
- package/dist/benchmarks/multi-turn-loop.js +167 -0
- package/dist/benchmarks/multi-turn-loop.js.map +1 -0
- package/dist/benchmarks/tasks.d.ts +19 -0
- package/dist/benchmarks/tasks.d.ts.map +1 -0
- package/dist/benchmarks/tasks.js +435 -0
- package/dist/benchmarks/tasks.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 +546 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/bin/llama-server-optimize.d.ts +18 -0
- package/dist/bin/llama-server-optimize.d.ts.map +1 -0
- package/dist/bin/llama-server-optimize.js +708 -0
- package/dist/bin/llama-server-optimize.js.map +1 -0
- package/dist/bin/policy.d.ts +3 -0
- package/dist/bin/policy.d.ts.map +1 -0
- package/dist/bin/policy.js +143 -0
- package/dist/bin/policy.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/browser/index.d.ts +2 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/web-browser.d.ts +30 -0
- package/dist/browser/web-browser.d.ts.map +1 -0
- package/dist/browser/web-browser.js +93 -0
- package/dist/browser/web-browser.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 +474 -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/completion-gates.d.ts +51 -0
- package/dist/cli/completion-gates.d.ts.map +1 -0
- package/dist/cli/completion-gates.js +201 -0
- package/dist/cli/completion-gates.js.map +1 -0
- package/dist/cli/compliance.d.ts +8 -0
- package/dist/cli/compliance.d.ts.map +1 -0
- package/dist/cli/compliance.js +509 -0
- package/dist/cli/compliance.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 +21 -0
- package/dist/cli/dashboard.d.ts.map +1 -0
- package/dist/cli/dashboard.js +1508 -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 +387 -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 +464 -0
- package/dist/cli/hooks.js.map +1 -0
- package/dist/cli/init.d.ts +12 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +364 -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 +885 -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 +290 -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 +862 -0
- package/dist/cli/patterns.js.map +1 -0
- package/dist/cli/rtk-validation.d.ts +9 -0
- package/dist/cli/rtk-validation.d.ts.map +1 -0
- package/dist/cli/rtk-validation.js +9 -0
- package/dist/cli/rtk-validation.js.map +1 -0
- package/dist/cli/rtk.d.ts +34 -0
- package/dist/cli/rtk.d.ts.map +1 -0
- package/dist/cli/rtk.js +401 -0
- package/dist/cli/rtk.js.map +1 -0
- package/dist/cli/schema-diff.d.ts +7 -0
- package/dist/cli/schema-diff.d.ts.map +1 -0
- package/dist/cli/schema-diff.js +11 -0
- package/dist/cli/schema-diff.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-wizard.d.ts +2 -0
- package/dist/cli/setup-wizard.d.ts.map +1 -0
- package/dist/cli/setup-wizard.js +806 -0
- package/dist/cli/setup-wizard.js.map +1 -0
- package/dist/cli/setup.d.ts +15 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +154 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/sync.d.ts +8 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +395 -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 +672 -0
- package/dist/cli/task.js.map +1 -0
- package/dist/cli/tool-calls.d.ts +20 -0
- package/dist/cli/tool-calls.d.ts.map +1 -0
- package/dist/cli/tool-calls.js +605 -0
- package/dist/cli/tool-calls.js.map +1 -0
- package/dist/cli/uap.d.ts +10 -0
- package/dist/cli/uap.d.ts.map +1 -0
- package/dist/cli/uap.js +398 -0
- package/dist/cli/uap.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 +213 -0
- package/dist/cli/worktree.js.map +1 -0
- package/dist/coordination/adaptive-patterns.d.ts +65 -0
- package/dist/coordination/adaptive-patterns.d.ts.map +1 -0
- package/dist/coordination/adaptive-patterns.js +108 -0
- package/dist/coordination/adaptive-patterns.js.map +1 -0
- package/dist/coordination/auto-agent.d.ts +82 -0
- package/dist/coordination/auto-agent.d.ts.map +1 -0
- package/dist/coordination/auto-agent.js +145 -0
- package/dist/coordination/auto-agent.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 +334 -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 +136 -0
- package/dist/coordination/database.js.map +1 -0
- package/dist/coordination/deploy-batcher.d.ts +122 -0
- package/dist/coordination/deploy-batcher.d.ts.map +1 -0
- package/dist/coordination/deploy-batcher.js +718 -0
- package/dist/coordination/deploy-batcher.js.map +1 -0
- package/dist/coordination/droid-validator.d.ts +59 -0
- package/dist/coordination/droid-validator.d.ts.map +1 -0
- package/dist/coordination/droid-validator.js +142 -0
- package/dist/coordination/droid-validator.js.map +1 -0
- package/dist/coordination/index.d.ts +10 -0
- package/dist/coordination/index.d.ts.map +1 -0
- package/dist/coordination/index.js +10 -0
- package/dist/coordination/index.js.map +1 -0
- package/dist/coordination/pattern-router.d.ts +50 -0
- package/dist/coordination/pattern-router.d.ts.map +1 -0
- package/dist/coordination/pattern-router.js +118 -0
- package/dist/coordination/pattern-router.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 +619 -0
- package/dist/coordination/service.js.map +1 -0
- package/dist/coordination/worktree-enforcer.d.ts +22 -0
- package/dist/coordination/worktree-enforcer.d.ts.map +1 -0
- package/dist/coordination/worktree-enforcer.js +71 -0
- package/dist/coordination/worktree-enforcer.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 +1020 -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 +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -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 +189 -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 +144 -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 +149 -0
- package/dist/memory/adaptive-context.d.ts.map +1 -0
- package/dist/memory/adaptive-context.js +1095 -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/ambiguity-detector.d.ts +54 -0
- package/dist/memory/ambiguity-detector.d.ts.map +1 -0
- package/dist/memory/ambiguity-detector.js +401 -0
- package/dist/memory/ambiguity-detector.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 +27 -0
- package/dist/memory/backends/github.d.ts.map +1 -0
- package/dist/memory/backends/github.js +134 -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 +167 -0
- package/dist/memory/backends/qdrant-cloud.js.map +1 -0
- package/dist/memory/context-compressor.d.ts +116 -0
- package/dist/memory/context-compressor.d.ts.map +1 -0
- package/dist/memory/context-compressor.js +430 -0
- package/dist/memory/context-compressor.js.map +1 -0
- package/dist/memory/context-pruner.d.ts +55 -0
- package/dist/memory/context-pruner.d.ts.map +1 -0
- package/dist/memory/context-pruner.js +85 -0
- package/dist/memory/context-pruner.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 +112 -0
- package/dist/memory/dynamic-retrieval.d.ts.map +1 -0
- package/dist/memory/dynamic-retrieval.js +908 -0
- package/dist/memory/dynamic-retrieval.js.map +1 -0
- package/dist/memory/embeddings.d.ts +172 -0
- package/dist/memory/embeddings.d.ts.map +1 -0
- package/dist/memory/embeddings.js +780 -0
- package/dist/memory/embeddings.js.map +1 -0
- package/dist/memory/generic-uap-patterns.d.ts +7 -0
- package/dist/memory/generic-uap-patterns.d.ts.map +1 -0
- package/dist/memory/generic-uap-patterns.js +43 -0
- package/dist/memory/generic-uap-patterns.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 +485 -0
- package/dist/memory/hierarchical-memory.js.map +1 -0
- package/dist/memory/knowledge-graph.d.ts +98 -0
- package/dist/memory/knowledge-graph.d.ts.map +1 -0
- package/dist/memory/knowledge-graph.js +275 -0
- package/dist/memory/knowledge-graph.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 +336 -0
- package/dist/memory/memory-maintenance.js.map +1 -0
- package/dist/memory/model-router.d.ts +105 -0
- package/dist/memory/model-router.d.ts.map +1 -0
- package/dist/memory/model-router.js +474 -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 +430 -0
- package/dist/memory/multi-view-memory.js.map +1 -0
- package/dist/memory/predictive-memory.d.ts +79 -0
- package/dist/memory/predictive-memory.d.ts.map +1 -0
- package/dist/memory/predictive-memory.js +294 -0
- package/dist/memory/predictive-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 +832 -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 +359 -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 +141 -0
- package/dist/memory/short-term/schema.js.map +1 -0
- package/dist/memory/short-term/sqlite.d.ts +64 -0
- package/dist/memory/short-term/sqlite.d.ts.map +1 -0
- package/dist/memory/short-term/sqlite.js +274 -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 +457 -0
- package/dist/memory/speculative-cache.js.map +1 -0
- package/dist/memory/task-classifier.d.ts +40 -0
- package/dist/memory/task-classifier.d.ts.map +1 -0
- package/dist/memory/task-classifier.js +342 -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 +622 -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/api-client.d.ts +46 -0
- package/dist/models/api-client.d.ts.map +1 -0
- package/dist/models/api-client.js +182 -0
- package/dist/models/api-client.js.map +1 -0
- package/dist/models/execution-profiles.d.ts +64 -0
- package/dist/models/execution-profiles.d.ts.map +1 -0
- package/dist/models/execution-profiles.js +403 -0
- package/dist/models/execution-profiles.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 +382 -0
- package/dist/models/executor.js.map +1 -0
- package/dist/models/index.d.ts +19 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +23 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/plan-validator.d.ts +37 -0
- package/dist/models/plan-validator.d.ts.map +1 -0
- package/dist/models/plan-validator.js +179 -0
- package/dist/models/plan-validator.js.map +1 -0
- package/dist/models/planner.d.ts +73 -0
- package/dist/models/planner.d.ts.map +1 -0
- package/dist/models/planner.js +375 -0
- package/dist/models/planner.js.map +1 -0
- package/dist/models/router.d.ts +96 -0
- package/dist/models/router.d.ts.map +1 -0
- package/dist/models/router.js +523 -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 +232 -0
- package/dist/models/types.js.map +1 -0
- package/dist/models/unified-router.d.ts +152 -0
- package/dist/models/unified-router.d.ts.map +1 -0
- package/dist/models/unified-router.js +313 -0
- package/dist/models/unified-router.js.map +1 -0
- package/dist/policies/convert-policy-to-claude.d.ts +3 -0
- package/dist/policies/convert-policy-to-claude.d.ts.map +1 -0
- package/dist/policies/convert-policy-to-claude.js +87 -0
- package/dist/policies/convert-policy-to-claude.js.map +1 -0
- package/dist/policies/database-manager.d.ts +27 -0
- package/dist/policies/database-manager.d.ts.map +1 -0
- package/dist/policies/database-manager.js +198 -0
- package/dist/policies/database-manager.js.map +1 -0
- package/dist/policies/enforced-tool-router.d.ts +53 -0
- package/dist/policies/enforced-tool-router.d.ts.map +1 -0
- package/dist/policies/enforced-tool-router.js +80 -0
- package/dist/policies/enforced-tool-router.js.map +1 -0
- package/dist/policies/index.d.ts +10 -0
- package/dist/policies/index.d.ts.map +1 -0
- package/dist/policies/index.js +8 -0
- package/dist/policies/index.js.map +1 -0
- package/dist/policies/policy-gate.d.ts +59 -0
- package/dist/policies/policy-gate.d.ts.map +1 -0
- package/dist/policies/policy-gate.js +171 -0
- package/dist/policies/policy-gate.js.map +1 -0
- package/dist/policies/policy-memory.d.ts +18 -0
- package/dist/policies/policy-memory.d.ts.map +1 -0
- package/dist/policies/policy-memory.js +126 -0
- package/dist/policies/policy-memory.js.map +1 -0
- package/dist/policies/policy-tools.d.ts +11 -0
- package/dist/policies/policy-tools.d.ts.map +1 -0
- package/dist/policies/policy-tools.js +66 -0
- package/dist/policies/policy-tools.js.map +1 -0
- package/dist/policies/schemas/policy.d.ts +69 -0
- package/dist/policies/schemas/policy.d.ts.map +1 -0
- package/dist/policies/schemas/policy.js +31 -0
- package/dist/policies/schemas/policy.js.map +1 -0
- package/dist/tasks/coordination.d.ts +83 -0
- package/dist/tasks/coordination.d.ts.map +1 -0
- package/dist/tasks/coordination.js +291 -0
- package/dist/tasks/coordination.js.map +1 -0
- package/dist/tasks/database.d.ts +19 -0
- package/dist/tasks/database.d.ts.map +1 -0
- package/dist/tasks/database.js +149 -0
- package/dist/tasks/database.js.map +1 -0
- package/dist/tasks/decoder-gate.d.ts +64 -0
- package/dist/tasks/decoder-gate.d.ts.map +1 -0
- package/dist/tasks/decoder-gate.js +268 -0
- package/dist/tasks/decoder-gate.js.map +1 -0
- package/dist/tasks/index.d.ts +6 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +6 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/service.d.ts +40 -0
- package/dist/tasks/service.d.ts.map +1 -0
- package/dist/tasks/service.js +671 -0
- package/dist/tasks/service.js.map +1 -0
- package/dist/tasks/types.d.ts +238 -0
- package/dist/tasks/types.d.ts.map +1 -0
- package/dist/tasks/types.js +74 -0
- package/dist/tasks/types.js.map +1 -0
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +2 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/session-telemetry.d.ts +56 -0
- package/dist/telemetry/session-telemetry.d.ts.map +1 -0
- package/dist/telemetry/session-telemetry.js +807 -0
- package/dist/telemetry/session-telemetry.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 +3324 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +418 -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/uap-droids-strict.d.ts +59 -0
- package/dist/uap-droids-strict.d.ts.map +1 -0
- package/dist/uap-droids-strict.js +200 -0
- package/dist/uap-droids-strict.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/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/rate-limiter.d.ts +58 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +100 -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 +94 -0
- package/dist/utils/validate-json.js.map +1 -0
- package/docs/INDEX.md +66 -0
- package/docs/architecture/MULTI_MODEL.md +224 -0
- package/docs/architecture/SYSTEM_ANALYSIS.md +1117 -0
- package/docs/architecture/UAP_COMPLIANCE.md +217 -0
- package/docs/architecture/UAP_PROTOCOL.md +339 -0
- package/docs/architecture/UAP_STRICT_DROIDS.md +172 -0
- package/docs/archive/BALLS_MODE_SELF_ANALYSIS.md +260 -0
- package/docs/archive/FAILING_TASKS_SOLUTION_PLAN.md +668 -0
- package/docs/archive/JINJA2-SYSTEM-MESSAGE-FIX.md +209 -0
- package/docs/archive/NPM-PUBLISH-V0.9.1.md +240 -0
- package/docs/archive/OPTIMIZATION_OPTIONS.md +334 -0
- package/docs/archive/SETUP_IMPROVEMENTS.md +213 -0
- package/docs/archive/UAP_GENERIC_OPTIMIZATION_PLAN.md +270 -0
- package/docs/archive/UAP_V103_PATTERN_DESIGN.md +315 -0
- package/docs/archive/UAP_V104_COMPLIANCE_DESIGN.md +223 -0
- package/docs/archive/changelog/2026-03-10_uap-100-compliance.md +77 -0
- package/docs/archive/changelog/2026-03-10_uap-full-system-verification.md +109 -0
- package/docs/benchmarks/ACCURACY_ANALYSIS.md +471 -0
- package/docs/benchmarks/TOKEN_OPTIMIZATION.md +572 -0
- package/docs/benchmarks/VALIDATION_PLAN.md +568 -0
- package/docs/benchmarks/VALIDATION_RESULTS.md +161 -0
- package/docs/deployment/DEPLOYMENT.md +895 -0
- package/docs/deployment/DEPLOYMENT_STRATEGIES.md +518 -0
- package/docs/deployment/DEPLOY_BATCHER_ANALYSIS.md +856 -0
- package/docs/deployment/DEPLOY_BATCHING.md +273 -0
- package/docs/deployment/DEPLOY_BUCKETING_ANALYSIS.md +420 -0
- package/docs/deployment/QWEN35_LLAMA_CPP.md +265 -0
- package/docs/getting-started/INTEGRATION.md +449 -0
- package/docs/getting-started/OVERVIEW.md +344 -0
- package/docs/getting-started/SETUP.md +203 -0
- package/docs/integrations/MCP_ROUTER_SETUP.md +445 -0
- package/docs/integrations/RTK_INTEGRATION.md +468 -0
- package/docs/operations/TROUBLESHOOTING.md +660 -0
- package/docs/reference/API_REFERENCE.md +903 -0
- package/docs/reference/FEATURES.md +472 -0
- package/docs/reference/HARNESS-MATRIX.md +318 -0
- package/docs/reference/UAP_CLI_REFERENCE.md +600 -0
- package/docs/research/BEHAVIORAL_PATTERNS.md +228 -0
- package/docs/research/DOMAIN_STRATEGIES.md +316 -0
- package/docs/research/MEMORY_SYSTEMS_COMPARISON.md +812 -0
- package/docs/research/PATTERN_ANALYSIS_2026-01-18.md +436 -0
- package/docs/research/PERFORMANCE_ANALYSIS_2026-01-18.md +209 -0
- package/docs/research/PERFORMANCE_TEST_PLAN.md +383 -0
- package/docs/research/TERMINAL_BENCH_LEARNINGS.md +217 -0
- package/package.json +113 -0
- package/scripts/README.md +161 -0
- package/templates/CLAUDE.template.md +10 -0
- package/templates/CLAUDE_ARCHITECTURE.template.md +103 -0
- package/templates/CLAUDE_CODING.template.md +127 -0
- package/templates/CLAUDE_DROIDS.template.md +109 -0
- package/templates/CLAUDE_MEMORY.template.md +131 -0
- package/templates/CLAUDE_WORKFLOWS.template.md +139 -0
- package/templates/PROJECT.template.md +209 -0
- package/templates/SCHEMA.md +57 -0
- package/templates/archive/CLAUDE.template.root-v6.md +534 -0
- package/templates/archive/CLAUDE.template.v6.md +534 -0
- package/templates/hooks/forgecode/pre-compact.sh +68 -0
- package/templates/hooks/forgecode/session-start.sh +169 -0
- package/templates/hooks/forgecode.plugin.sh +128 -0
- package/templates/hooks/pre-compact.sh +74 -0
- package/templates/hooks/session-start.sh +366 -0
- package/tools/agents/README.md +224 -0
- package/tools/agents/UAP/README.md +386 -0
- package/tools/agents/UAP/__init__.py +9 -0
- package/tools/agents/UAP/cli.py +901 -0
- package/tools/agents/UAP/compliance_verify.sh +108 -0
- package/tools/agents/UAP/full_verification.sh +126 -0
- package/tools/agents/UAP/version.py +32 -0
- package/tools/agents/benchmarks/benchmark_memory_systems.py +730 -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 +77 -0
- package/tools/agents/config/tool-call-schema.json +19 -0
- package/tools/agents/config/tool-call.gbnf +58 -0
- package/tools/agents/docker/Dockerfile.python +52 -0
- package/tools/agents/docker/Dockerfile.ubuntu +55 -0
- package/tools/agents/docker-compose.qdrant.yml +24 -0
- package/tools/agents/install-opencode-local.sh.j2 +135 -0
- package/tools/agents/migrations/apply.py +256 -0
- package/tools/agents/opencode_uap_agent.py +1505 -0
- package/tools/agents/plugin/README.md +91 -0
- package/tools/agents/plugin/index.ts +46 -0
- package/tools/agents/plugin/pre-compact.sh +68 -0
- package/tools/agents/plugin/session-start.sh +175 -0
- package/tools/agents/plugin/uap-commands.ts +45 -0
- package/tools/agents/plugin/uap-droids.ts +54 -0
- package/tools/agents/plugin/uap-patterns.ts +54 -0
- package/tools/agents/plugin/uap-skills.ts +52 -0
- package/tools/agents/plugins/uap-enforce.ts +314 -0
- package/tools/agents/scripts/__pycache__/tool_call_wrapper.cpython-313.pyc +0 -0
- package/tools/agents/scripts/chat_template_verifier.py +343 -0
- package/tools/agents/scripts/fix-qwen-template.js +38 -0
- package/tools/agents/scripts/fix_qwen_chat_template.py +316 -0
- package/tools/agents/scripts/generate_lora_training_data.py +412 -0
- package/tools/agents/scripts/init_qdrant.py +151 -0
- package/tools/agents/scripts/memory_migration.py +560 -0
- package/tools/agents/scripts/migrate_memory_to_qdrant.py +110 -0
- package/tools/agents/scripts/prepare_lora.sh +512 -0
- package/tools/agents/scripts/query_memory.py +200 -0
- package/tools/agents/scripts/qwen-tool-call-test.js +38 -0
- package/tools/agents/scripts/qwen-tool-call-wrapper.js +38 -0
- package/tools/agents/scripts/qwen_tool_call_test.py +464 -0
- package/tools/agents/scripts/qwen_tool_call_wrapper.py +686 -0
- package/tools/agents/scripts/start-services.sh +96 -0
- package/tools/agents/scripts/tool-choice-proxy.cjs +296 -0
- package/tools/agents/scripts/tool_call_test.py +656 -0
- package/tools/agents/scripts/tool_call_wrapper.py +799 -0
- package/tools/agents/tests/test_uap_compliance.py +257 -0
- package/tools/agents/uap_agent.py +122 -0
- package/tools/agents/uap_agent_install.sh +12 -0
|
@@ -0,0 +1,901 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
UAP CLI - Universal Agent Protocol Command Line Interface
|
|
4
|
+
|
|
5
|
+
This is the core CLI tool for managing agent memory systems.
|
|
6
|
+
All agent hooks and workflows MUST use these commands for compliance.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
UAP task ready # Check task readiness
|
|
10
|
+
UAP memory query "<topic>" # Query memory by topic
|
|
11
|
+
UAP worktree create <slug> # Create new worktree
|
|
12
|
+
UAP worktree cleanup <id> # Clean up merged worktree
|
|
13
|
+
UAP session start # Start new session
|
|
14
|
+
UAP session end # End current session
|
|
15
|
+
UAP compliance check # Check UAP protocol compliance
|
|
16
|
+
UAP setup # Interactive setup
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import argparse
|
|
20
|
+
import sqlite3
|
|
21
|
+
import subprocess
|
|
22
|
+
import sys
|
|
23
|
+
import uuid
|
|
24
|
+
from datetime import datetime, timedelta
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
from typing import Optional
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class UAPCLI:
|
|
30
|
+
"""Universal Agent Protocol CLI."""
|
|
31
|
+
|
|
32
|
+
def __init__(self):
|
|
33
|
+
self.project_root = Path(__file__).parent.parent.parent
|
|
34
|
+
self.db_path = self.project_root / "agents/data/memory/short_term.db"
|
|
35
|
+
self.coord_db_path = (
|
|
36
|
+
self.project_root / "agents/data/coordination/coordination.db"
|
|
37
|
+
)
|
|
38
|
+
self.worktrees_dir = self.project_root / ".worktrees"
|
|
39
|
+
|
|
40
|
+
def get_connection(self, db_path: Optional[Path] = None) -> sqlite3.Connection:
|
|
41
|
+
"""Get database connection."""
|
|
42
|
+
path = db_path or self.db_path
|
|
43
|
+
if not path.exists():
|
|
44
|
+
raise FileNotFoundError(f"Database not found: {path}")
|
|
45
|
+
conn = sqlite3.connect(str(path))
|
|
46
|
+
conn.row_factory = sqlite3.Row
|
|
47
|
+
return conn
|
|
48
|
+
|
|
49
|
+
def get_coordination_connection(self) -> Optional[sqlite3.Connection]:
|
|
50
|
+
"""Get coordination database connection."""
|
|
51
|
+
if not self.coord_db_path.exists():
|
|
52
|
+
return None
|
|
53
|
+
conn = sqlite3.connect(str(self.coord_db_path))
|
|
54
|
+
conn.row_factory = sqlite3.Row
|
|
55
|
+
return conn
|
|
56
|
+
|
|
57
|
+
# ============================================================
|
|
58
|
+
# TASK COMMANDS
|
|
59
|
+
# ============================================================
|
|
60
|
+
|
|
61
|
+
def task_ready(self) -> int:
|
|
62
|
+
"""Check if agent is ready to work."""
|
|
63
|
+
print("=== UAP Task Readiness Check ===\n")
|
|
64
|
+
|
|
65
|
+
# Check memory database
|
|
66
|
+
if not self.db_path.exists():
|
|
67
|
+
print("Memory database not initialized")
|
|
68
|
+
return 1
|
|
69
|
+
print(f"Memory database: {self.db_path}")
|
|
70
|
+
|
|
71
|
+
# Check recent activity
|
|
72
|
+
conn = self.get_connection()
|
|
73
|
+
cursor = conn.cursor()
|
|
74
|
+
|
|
75
|
+
# Get last 5 actions
|
|
76
|
+
cursor.execute("""
|
|
77
|
+
SELECT timestamp, type, substr(content, 1, 60) as content
|
|
78
|
+
FROM memories
|
|
79
|
+
ORDER BY id DESC
|
|
80
|
+
LIMIT 5
|
|
81
|
+
""")
|
|
82
|
+
rows = cursor.fetchall()
|
|
83
|
+
|
|
84
|
+
if rows:
|
|
85
|
+
print(f"\nRecent activity (last {len(rows)} entries):")
|
|
86
|
+
for row in rows:
|
|
87
|
+
print(f" [{row['timestamp']}] {row['type']}: {row['content']}...")
|
|
88
|
+
else:
|
|
89
|
+
print("\nNo recent memory entries found")
|
|
90
|
+
|
|
91
|
+
# Check coordination database
|
|
92
|
+
if self.coord_db_path.exists():
|
|
93
|
+
print(f"\nCoordination DB: {self.coord_db_path}")
|
|
94
|
+
|
|
95
|
+
# Check for stale agents
|
|
96
|
+
coord_conn = self.get_coordination_connection()
|
|
97
|
+
if coord_conn:
|
|
98
|
+
cursor = coord_conn.cursor()
|
|
99
|
+
cursor.execute("""
|
|
100
|
+
SELECT COUNT(*) as count FROM agent_registry
|
|
101
|
+
WHERE status IN ('active', 'idle')
|
|
102
|
+
AND last_heartbeat < datetime('now', '-24 hours')
|
|
103
|
+
""")
|
|
104
|
+
stale = cursor.fetchone()["count"]
|
|
105
|
+
|
|
106
|
+
if stale > 0:
|
|
107
|
+
print(
|
|
108
|
+
f"WARNING: {stale} stale agents detected (no heartbeat in 24h)"
|
|
109
|
+
)
|
|
110
|
+
else:
|
|
111
|
+
print("No stale agents detected")
|
|
112
|
+
else:
|
|
113
|
+
print("\nCoordination DB not initialized (multi-agent mode disabled)")
|
|
114
|
+
|
|
115
|
+
# Check worktrees
|
|
116
|
+
if self.worktrees_dir.exists():
|
|
117
|
+
worktree_count = len(
|
|
118
|
+
[d for d in self.worktrees_dir.iterdir() if d.is_dir()]
|
|
119
|
+
)
|
|
120
|
+
print(f"\nWorktrees: {worktree_count} active")
|
|
121
|
+
|
|
122
|
+
conn.close()
|
|
123
|
+
|
|
124
|
+
print("\nUAP Protocol Ready - You can proceed with work")
|
|
125
|
+
return 0
|
|
126
|
+
|
|
127
|
+
def setup(self, args) -> int:
|
|
128
|
+
"""Interactive setup with feature toggles and verification report."""
|
|
129
|
+
import json
|
|
130
|
+
|
|
131
|
+
print("=" * 70)
|
|
132
|
+
print("Universal Agent Protocol Setup")
|
|
133
|
+
version = self._get_version()
|
|
134
|
+
print(f"Version: {version}")
|
|
135
|
+
print("=" * 70)
|
|
136
|
+
|
|
137
|
+
# Interactive mode vs non-interactive
|
|
138
|
+
use_interactive = not getattr(args, "yes", False)
|
|
139
|
+
|
|
140
|
+
if use_interactive:
|
|
141
|
+
print("\nSelect UAP Features:")
|
|
142
|
+
print("-" * 40)
|
|
143
|
+
memory_enabled = (
|
|
144
|
+
input("Enable Memory System? [Y/n]: ").strip().lower() != "n"
|
|
145
|
+
)
|
|
146
|
+
parallel_enabled = (
|
|
147
|
+
input("Enable Parallel Execution? [y/N]: ").strip().lower() == "y"
|
|
148
|
+
)
|
|
149
|
+
validation_toggle = (
|
|
150
|
+
input("Enable Validation Toggle? [Y/n]: ").strip().lower() != "n"
|
|
151
|
+
)
|
|
152
|
+
else:
|
|
153
|
+
memory_enabled = getattr(args, "feature_memory", True)
|
|
154
|
+
parallel_enabled = getattr(args, "feature_parallel", False)
|
|
155
|
+
validation_toggle = getattr(args, "feature_validation", True)
|
|
156
|
+
|
|
157
|
+
print()
|
|
158
|
+
|
|
159
|
+
# Create .env file with feature toggles
|
|
160
|
+
print("Creating UAP configuration...")
|
|
161
|
+
env_path = self.project_root / ".env"
|
|
162
|
+
with open(env_path, "w") as f:
|
|
163
|
+
f.write("# UAP Feature Configuration\n")
|
|
164
|
+
f.write(f"UAP_MEMORY_ENABLED={'true' if memory_enabled else 'false'}\n")
|
|
165
|
+
f.write(
|
|
166
|
+
f"UAP_PARALLEL_EXECUTION={'true' if parallel_enabled else 'false'}\n"
|
|
167
|
+
)
|
|
168
|
+
f.write(f"UAP_VALIDATE_PLAN={'true' if validation_toggle else 'false'}\n")
|
|
169
|
+
|
|
170
|
+
print(f"Configuration written to {env_path}")
|
|
171
|
+
with open(env_path, "r") as f:
|
|
172
|
+
for line in f:
|
|
173
|
+
line = line.strip()
|
|
174
|
+
if line and not line.startswith("#"):
|
|
175
|
+
print(f" {line}")
|
|
176
|
+
|
|
177
|
+
# Install UAP config directory
|
|
178
|
+
print("\nInstalling UAP configuration...")
|
|
179
|
+
config_dir = self.project_root / "tools/agents/UAP/configs"
|
|
180
|
+
if not config_dir.exists():
|
|
181
|
+
config_dir.mkdir(parents=True)
|
|
182
|
+
|
|
183
|
+
# Run verification tests
|
|
184
|
+
print("\nRunning Verification Tests...")
|
|
185
|
+
test_results = self._run_verification_tests(
|
|
186
|
+
memory_enabled, parallel_enabled, validation_toggle
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
# Print verification report
|
|
190
|
+
return self._print_verification_report(
|
|
191
|
+
test_results, memory_enabled, parallel_enabled, validation_toggle
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
def _get_version(self) -> str:
|
|
195
|
+
"""Get current UAP version from package.json."""
|
|
196
|
+
import json
|
|
197
|
+
|
|
198
|
+
pkg_path = self.project_root / "package.json"
|
|
199
|
+
if pkg_path.exists():
|
|
200
|
+
try:
|
|
201
|
+
with open(pkg_path, "r") as f:
|
|
202
|
+
return json.load(f).get("version", "0.0.0")
|
|
203
|
+
except Exception:
|
|
204
|
+
pass
|
|
205
|
+
return "0.0.0"
|
|
206
|
+
|
|
207
|
+
def _run_verification_tests(
|
|
208
|
+
self, memory_enabled: bool, parallel_enabled: bool, validation_toggle: bool
|
|
209
|
+
) -> dict:
|
|
210
|
+
"""Run verification tests for all enabled features."""
|
|
211
|
+
results = {"tests": [], "passed": 0, "failed": 0}
|
|
212
|
+
|
|
213
|
+
# Test Memory System if enabled
|
|
214
|
+
if memory_enabled:
|
|
215
|
+
print("\nTesting Memory System...")
|
|
216
|
+
if self.db_path.exists():
|
|
217
|
+
print(" Memory database exists")
|
|
218
|
+
results["tests"].append(("Memory Database", "passed"))
|
|
219
|
+
results["passed"] += 1
|
|
220
|
+
else:
|
|
221
|
+
print(" Memory database not found")
|
|
222
|
+
results["tests"].append(("Memory Database", "failed"))
|
|
223
|
+
results["failed"] += 1
|
|
224
|
+
|
|
225
|
+
# Test Parallel Execution
|
|
226
|
+
if parallel_enabled:
|
|
227
|
+
print("\nTesting Parallel Execution...")
|
|
228
|
+
try:
|
|
229
|
+
import asyncio
|
|
230
|
+
|
|
231
|
+
print(" asyncio available")
|
|
232
|
+
results["tests"].append(("Parallel Execution", "passed"))
|
|
233
|
+
results["passed"] += 1
|
|
234
|
+
except ImportError:
|
|
235
|
+
print(" asyncio not available")
|
|
236
|
+
results["tests"].append(("Parallel Execution", "failed"))
|
|
237
|
+
results["failed"] += 1
|
|
238
|
+
|
|
239
|
+
# Test Validation Toggle
|
|
240
|
+
if validation_toggle:
|
|
241
|
+
print("\nValidation Toggle enabled")
|
|
242
|
+
results["tests"].append(("Validation Toggle", "passed"))
|
|
243
|
+
results["passed"] += 1
|
|
244
|
+
|
|
245
|
+
# Run npm tests for TypeScript components
|
|
246
|
+
print("\nRunning NPM Tests...")
|
|
247
|
+
try:
|
|
248
|
+
result = subprocess.run(
|
|
249
|
+
["npm", "test"],
|
|
250
|
+
capture_output=True,
|
|
251
|
+
text=True,
|
|
252
|
+
cwd=str(self.project_root),
|
|
253
|
+
timeout=120,
|
|
254
|
+
)
|
|
255
|
+
if result.returncode == 0:
|
|
256
|
+
print(" All NPM tests passed")
|
|
257
|
+
results["tests"].append(("NPM Test Suite", "passed"))
|
|
258
|
+
results["passed"] += 1
|
|
259
|
+
else:
|
|
260
|
+
print(" Some npm tests failed")
|
|
261
|
+
results["tests"].append(("NPM Test Suite", "failed"))
|
|
262
|
+
results["failed"] += 1
|
|
263
|
+
except Exception as e:
|
|
264
|
+
print(f" Could not run npm test: {e}")
|
|
265
|
+
results["tests"].append(("NPM Test Suite", "failed"))
|
|
266
|
+
results["failed"] += 1
|
|
267
|
+
|
|
268
|
+
return results
|
|
269
|
+
|
|
270
|
+
def _print_verification_report(
|
|
271
|
+
self,
|
|
272
|
+
test_results: dict,
|
|
273
|
+
memory_enabled: bool,
|
|
274
|
+
parallel_enabled: bool,
|
|
275
|
+
validation_toggle: bool,
|
|
276
|
+
) -> int:
|
|
277
|
+
"""Print comprehensive verification report."""
|
|
278
|
+
print()
|
|
279
|
+
print("=" * 70)
|
|
280
|
+
print("UAP Setup Verification Report")
|
|
281
|
+
print("=" * 70)
|
|
282
|
+
|
|
283
|
+
# Feature status summary
|
|
284
|
+
print("\nConfigured Features:")
|
|
285
|
+
print(f" Memory System: {'ENABLED' if memory_enabled else 'DISABLED'}")
|
|
286
|
+
print(f" Parallel Execution: {'ENABLED' if parallel_enabled else 'DISABLED'}")
|
|
287
|
+
print(
|
|
288
|
+
f" Validation Toggle: {'ENABLED' if validation_toggle else 'DISABLED'}"
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
# Test results
|
|
292
|
+
print("\nTest Results:")
|
|
293
|
+
for test_name, status in test_results["tests"]:
|
|
294
|
+
icon = "PASS" if status == "passed" else "FAIL"
|
|
295
|
+
print(f" [{icon}] {test_name}")
|
|
296
|
+
|
|
297
|
+
# Summary statistics
|
|
298
|
+
total_tests = len(test_results["tests"])
|
|
299
|
+
if total_tests > 0:
|
|
300
|
+
passed_count = test_results.get("passed", 0)
|
|
301
|
+
pct = 100 * passed_count / total_tests
|
|
302
|
+
print(f"\nTest Success Rate: {passed_count}/{total_tests} ({pct:.0f}%)")
|
|
303
|
+
|
|
304
|
+
# Final status message
|
|
305
|
+
all_passed = all(s == "passed" for _, s in test_results["tests"])
|
|
306
|
+
if all_passed:
|
|
307
|
+
print("\nSetup Complete! All features verified and working!")
|
|
308
|
+
else:
|
|
309
|
+
print("\nSome components need attention - see report above")
|
|
310
|
+
|
|
311
|
+
print("=" * 70)
|
|
312
|
+
return 0 if all_passed else 1
|
|
313
|
+
|
|
314
|
+
def task_create(self, task_type: str, title: str) -> int:
|
|
315
|
+
"""Create new task entry in memory."""
|
|
316
|
+
timestamp = datetime.utcnow().isoformat() + "Z"
|
|
317
|
+
|
|
318
|
+
conn = self.get_connection()
|
|
319
|
+
cursor = conn.cursor()
|
|
320
|
+
|
|
321
|
+
content = f"[{task_type.upper()}] {title}"
|
|
322
|
+
cursor.execute(
|
|
323
|
+
"INSERT INTO memories (timestamp, type, content) VALUES (?, ?, ?)",
|
|
324
|
+
(timestamp, task_type, content),
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
conn.commit()
|
|
328
|
+
print(f"Created {task_type} task: {title}")
|
|
329
|
+
print(f" ID: {cursor.lastrowid}")
|
|
330
|
+
print(f" Timestamp: {timestamp}")
|
|
331
|
+
|
|
332
|
+
conn.close()
|
|
333
|
+
return 0
|
|
334
|
+
|
|
335
|
+
# ============================================================
|
|
336
|
+
# MEMORY COMMANDS
|
|
337
|
+
# ============================================================
|
|
338
|
+
|
|
339
|
+
def memory_query(self, query: str, limit: int = 10) -> int:
|
|
340
|
+
"""Query memory by topic."""
|
|
341
|
+
print(f"=== Memory Query: '{query}' ===\n")
|
|
342
|
+
|
|
343
|
+
if not self.db_path.exists():
|
|
344
|
+
print("Memory database not initialized")
|
|
345
|
+
return 1
|
|
346
|
+
|
|
347
|
+
conn = self.get_connection()
|
|
348
|
+
cursor = conn.cursor()
|
|
349
|
+
|
|
350
|
+
# Try full-text search first
|
|
351
|
+
try:
|
|
352
|
+
cursor.execute(
|
|
353
|
+
"""
|
|
354
|
+
SELECT m.id, m.timestamp, m.type, m.content
|
|
355
|
+
FROM memories_fts f
|
|
356
|
+
JOIN memories m ON f.rowid = m.id
|
|
357
|
+
WHERE memories_fts MATCH ?
|
|
358
|
+
ORDER BY rank
|
|
359
|
+
LIMIT ?
|
|
360
|
+
""",
|
|
361
|
+
(query, limit),
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
rows = cursor.fetchall()
|
|
365
|
+
if rows:
|
|
366
|
+
print(f"Found {len(rows)} matches via FTS search\n")
|
|
367
|
+
for row in rows:
|
|
368
|
+
self._print_memory_row(row)
|
|
369
|
+
conn.close()
|
|
370
|
+
return 0
|
|
371
|
+
except sqlite3.OperationalError:
|
|
372
|
+
# FTS index doesn't exist, fall back to LIKE search
|
|
373
|
+
pass
|
|
374
|
+
|
|
375
|
+
# Fall back to LIKE search
|
|
376
|
+
search_pattern = f"%{query}%"
|
|
377
|
+
cursor.execute(
|
|
378
|
+
"""
|
|
379
|
+
SELECT id, timestamp, type, content
|
|
380
|
+
FROM memories
|
|
381
|
+
WHERE content LIKE ?
|
|
382
|
+
ORDER BY timestamp DESC
|
|
383
|
+
LIMIT ?
|
|
384
|
+
""",
|
|
385
|
+
(search_pattern, limit),
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
rows = cursor.fetchall()
|
|
389
|
+
|
|
390
|
+
if not rows:
|
|
391
|
+
print("No matches found")
|
|
392
|
+
conn.close()
|
|
393
|
+
return 1
|
|
394
|
+
|
|
395
|
+
print(f"Found {len(rows)} matches\n")
|
|
396
|
+
for row in rows:
|
|
397
|
+
self._print_memory_row(row)
|
|
398
|
+
|
|
399
|
+
conn.close()
|
|
400
|
+
return 0
|
|
401
|
+
|
|
402
|
+
def _print_memory_row(self, row):
|
|
403
|
+
"""Print formatted memory row."""
|
|
404
|
+
print(f"[{row['id']:3d}] {row['timestamp']} [{row['type']:11s}]")
|
|
405
|
+
content = row["content"]
|
|
406
|
+
if len(content) > 200:
|
|
407
|
+
content = content[:200] + "..."
|
|
408
|
+
print(f" {content}")
|
|
409
|
+
print()
|
|
410
|
+
|
|
411
|
+
def memory_store(self, mem_type: str, content: str, importance: int = 5) -> int:
|
|
412
|
+
"""Store memory entry."""
|
|
413
|
+
if mem_type not in ["action", "observation", "thought", "goal"]:
|
|
414
|
+
print("Invalid type. Must be: action, observation, thought, goal")
|
|
415
|
+
return 1
|
|
416
|
+
|
|
417
|
+
timestamp = datetime.utcnow().isoformat() + "Z"
|
|
418
|
+
|
|
419
|
+
conn = self.get_connection()
|
|
420
|
+
cursor = conn.cursor()
|
|
421
|
+
cursor.execute(
|
|
422
|
+
"INSERT INTO memories (timestamp, type, content) VALUES (?, ?, ?)",
|
|
423
|
+
(timestamp, mem_type, content),
|
|
424
|
+
)
|
|
425
|
+
conn.commit()
|
|
426
|
+
conn.close()
|
|
427
|
+
|
|
428
|
+
print(f"Stored memory [{mem_type}]: {content[:50]}...")
|
|
429
|
+
return 0
|
|
430
|
+
|
|
431
|
+
def session_memories_add(
|
|
432
|
+
self, session_id: str, mem_type: str, content: str, importance: int
|
|
433
|
+
) -> int:
|
|
434
|
+
"""Add to session memories (high-importance decisions)."""
|
|
435
|
+
timestamp = datetime.utcnow().isoformat() + "Z"
|
|
436
|
+
|
|
437
|
+
conn = self.get_connection()
|
|
438
|
+
cursor = conn.cursor()
|
|
439
|
+
|
|
440
|
+
try:
|
|
441
|
+
cursor.execute(
|
|
442
|
+
"""
|
|
443
|
+
INSERT OR IGNORE INTO session_memories
|
|
444
|
+
(session_id, timestamp, type, content, importance)
|
|
445
|
+
VALUES (?, ?, ?, ?, ?)
|
|
446
|
+
""",
|
|
447
|
+
(session_id, timestamp, mem_type, content, importance),
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
if cursor.rowcount == 0:
|
|
451
|
+
print("Session memory already exists")
|
|
452
|
+
else:
|
|
453
|
+
print(f"Stored session memory [{mem_type}] importance={importance}")
|
|
454
|
+
print(f" Content: {content[:100]}...")
|
|
455
|
+
|
|
456
|
+
conn.commit()
|
|
457
|
+
except sqlite3.OperationalError as e:
|
|
458
|
+
print(f"Error: {e}")
|
|
459
|
+
print(
|
|
460
|
+
" Hint: Run database migration first (tools/agents/migrations/apply.py)"
|
|
461
|
+
)
|
|
462
|
+
|
|
463
|
+
conn.close()
|
|
464
|
+
return 0
|
|
465
|
+
|
|
466
|
+
# ============================================================
|
|
467
|
+
# WORKTREE COMMANDS
|
|
468
|
+
# ============================================================
|
|
469
|
+
|
|
470
|
+
def worktree_create(self, slug: str) -> int:
|
|
471
|
+
"""Create new git worktree."""
|
|
472
|
+
if not slug:
|
|
473
|
+
print("Worktree slug required")
|
|
474
|
+
return 1
|
|
475
|
+
|
|
476
|
+
# Create worktree using factory script or git directly
|
|
477
|
+
worktree_script = (
|
|
478
|
+
self.project_root / ".factory" / "scripts" / "worktree-manager.sh"
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
if worktree_script.exists():
|
|
482
|
+
print(f"Creating worktree: {slug}")
|
|
483
|
+
result = subprocess.run(
|
|
484
|
+
[str(worktree_script), "create", slug],
|
|
485
|
+
cwd=str(self.project_root),
|
|
486
|
+
capture_output=True,
|
|
487
|
+
text=True,
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
if result.returncode == 0:
|
|
491
|
+
print("Worktree created successfully")
|
|
492
|
+
print(result.stdout)
|
|
493
|
+
|
|
494
|
+
# Record in memory
|
|
495
|
+
timestamp = datetime.utcnow().isoformat() + "Z"
|
|
496
|
+
conn = self.get_connection()
|
|
497
|
+
cursor = conn.cursor()
|
|
498
|
+
cursor.execute(
|
|
499
|
+
"INSERT INTO memories (timestamp, type, content) VALUES (?, ?, ?)",
|
|
500
|
+
(timestamp, "action", f"Created worktree: {slug}"),
|
|
501
|
+
)
|
|
502
|
+
conn.commit()
|
|
503
|
+
conn.close()
|
|
504
|
+
|
|
505
|
+
return 0
|
|
506
|
+
else:
|
|
507
|
+
print(f"Error creating worktree:\n{result.stderr}")
|
|
508
|
+
return 1
|
|
509
|
+
else:
|
|
510
|
+
# Fall back to git worktree command
|
|
511
|
+
print(f"Creating worktree via git: {slug}")
|
|
512
|
+
result = subprocess.run(
|
|
513
|
+
["git", "worktree", "add", f".worktrees/{slug}", "-b", slug],
|
|
514
|
+
cwd=str(self.project_root),
|
|
515
|
+
capture_output=True,
|
|
516
|
+
text=True,
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
if result.returncode == 0:
|
|
520
|
+
print("Worktree created successfully")
|
|
521
|
+
|
|
522
|
+
# Record in memory
|
|
523
|
+
timestamp = datetime.utcnow().isoformat() + "Z"
|
|
524
|
+
conn = self.get_connection()
|
|
525
|
+
cursor = conn.cursor()
|
|
526
|
+
cursor.execute(
|
|
527
|
+
"INSERT INTO memories (timestamp, type, content) VALUES (?, ?, ?)",
|
|
528
|
+
(timestamp, "action", f"Created worktree: {slug}"),
|
|
529
|
+
)
|
|
530
|
+
conn.commit()
|
|
531
|
+
conn.close()
|
|
532
|
+
|
|
533
|
+
return 0
|
|
534
|
+
else:
|
|
535
|
+
print(f"Error creating worktree:\n{result.stderr}")
|
|
536
|
+
return 1
|
|
537
|
+
|
|
538
|
+
def worktree_cleanup(self, id_or_slug: str) -> int:
|
|
539
|
+
"""Clean up merged worktree."""
|
|
540
|
+
import shutil
|
|
541
|
+
|
|
542
|
+
# Find worktree by ID or slug
|
|
543
|
+
if self.worktrees_dir.exists():
|
|
544
|
+
for entry in self.worktrees_dir.iterdir():
|
|
545
|
+
if entry.is_dir() and (
|
|
546
|
+
entry.name == id_or_slug or str(id_or_slug) in entry.name
|
|
547
|
+
):
|
|
548
|
+
print(f"Removing worktree: {entry.name}")
|
|
549
|
+
|
|
550
|
+
try:
|
|
551
|
+
shutil.rmtree(entry)
|
|
552
|
+
print("Worktree removed")
|
|
553
|
+
|
|
554
|
+
# Record in memory
|
|
555
|
+
timestamp = datetime.utcnow().isoformat() + "Z"
|
|
556
|
+
conn = self.get_connection()
|
|
557
|
+
cursor = conn.cursor()
|
|
558
|
+
cursor.execute(
|
|
559
|
+
"INSERT INTO memories (timestamp, type, content) VALUES (?, ?, ?)",
|
|
560
|
+
(timestamp, "action", f"Cleaned up worktree: {entry.name}"),
|
|
561
|
+
)
|
|
562
|
+
conn.commit()
|
|
563
|
+
conn.close()
|
|
564
|
+
|
|
565
|
+
return 0
|
|
566
|
+
except Exception as e:
|
|
567
|
+
print(f"Error removing worktree: {e}")
|
|
568
|
+
return 1
|
|
569
|
+
|
|
570
|
+
print(f"Worktree not found: {id_or_slug}")
|
|
571
|
+
return 1
|
|
572
|
+
|
|
573
|
+
def worktree_list(self) -> int:
|
|
574
|
+
"""List all active worktrees."""
|
|
575
|
+
if not self.worktrees_dir.exists():
|
|
576
|
+
print("No worktrees directory found")
|
|
577
|
+
return 0
|
|
578
|
+
|
|
579
|
+
worktrees = [d.name for d in self.worktrees_dir.iterdir() if d.is_dir()]
|
|
580
|
+
|
|
581
|
+
if not worktrees:
|
|
582
|
+
print("No active worktrees")
|
|
583
|
+
return 0
|
|
584
|
+
|
|
585
|
+
print("=== Active Worktrees ===\n")
|
|
586
|
+
for wt in worktrees:
|
|
587
|
+
print(f" {wt}")
|
|
588
|
+
|
|
589
|
+
return 0
|
|
590
|
+
|
|
591
|
+
# ============================================================
|
|
592
|
+
# SESSION COMMANDS
|
|
593
|
+
# ============================================================
|
|
594
|
+
|
|
595
|
+
def session_start(self) -> int:
|
|
596
|
+
"""Start new agent session."""
|
|
597
|
+
session_id = str(uuid.uuid4())[:8]
|
|
598
|
+
timestamp = datetime.utcnow().isoformat() + "Z"
|
|
599
|
+
|
|
600
|
+
# Store session in coordination DB if available
|
|
601
|
+
coord_conn = self.get_coordination_connection()
|
|
602
|
+
if coord_conn:
|
|
603
|
+
cursor = coord_conn.cursor()
|
|
604
|
+
cursor.execute(
|
|
605
|
+
"""
|
|
606
|
+
INSERT OR REPLACE INTO agent_registry
|
|
607
|
+
(agent_id, status, last_heartbeat)
|
|
608
|
+
VALUES (?, 'active', ?)
|
|
609
|
+
""",
|
|
610
|
+
(session_id, timestamp),
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
# Update any stale agents to failed
|
|
614
|
+
cursor.execute("""
|
|
615
|
+
UPDATE agent_registry SET status='failed'
|
|
616
|
+
WHERE status IN ('active','idle')
|
|
617
|
+
AND last_heartbeat < datetime('now','-24 hours')
|
|
618
|
+
""")
|
|
619
|
+
|
|
620
|
+
coord_conn.commit()
|
|
621
|
+
|
|
622
|
+
# Record in memory
|
|
623
|
+
conn = self.get_connection()
|
|
624
|
+
cursor = conn.cursor()
|
|
625
|
+
cursor.execute(
|
|
626
|
+
"INSERT INTO memories (timestamp, type, content) VALUES (?, ?, ?)",
|
|
627
|
+
(timestamp, "thought", f"Session started: {session_id}"),
|
|
628
|
+
)
|
|
629
|
+
conn.commit()
|
|
630
|
+
conn.close()
|
|
631
|
+
|
|
632
|
+
print(f"Session started: {session_id}")
|
|
633
|
+
print(f" Timestamp: {timestamp}")
|
|
634
|
+
print(f"\nRemember to run 'UAP session end' when done")
|
|
635
|
+
|
|
636
|
+
return 0
|
|
637
|
+
|
|
638
|
+
def session_end(self) -> int:
|
|
639
|
+
"""End current agent session."""
|
|
640
|
+
timestamp = datetime.utcnow().isoformat() + "Z"
|
|
641
|
+
|
|
642
|
+
# Update coordination DB if available
|
|
643
|
+
coord_conn = self.get_coordination_connection()
|
|
644
|
+
if coord_conn:
|
|
645
|
+
cursor = coord_conn.cursor()
|
|
646
|
+
cursor.execute(
|
|
647
|
+
"""
|
|
648
|
+
UPDATE agent_registry SET status='completed', last_heartbeat=?
|
|
649
|
+
WHERE status='active'
|
|
650
|
+
""",
|
|
651
|
+
(timestamp,),
|
|
652
|
+
)
|
|
653
|
+
coord_conn.commit()
|
|
654
|
+
|
|
655
|
+
# Record in memory
|
|
656
|
+
conn = self.get_connection()
|
|
657
|
+
cursor = conn.cursor()
|
|
658
|
+
cursor.execute(
|
|
659
|
+
"INSERT INTO memories (timestamp, type, content) VALUES (?, ?, ?)",
|
|
660
|
+
(timestamp, "thought", "Session ended"),
|
|
661
|
+
)
|
|
662
|
+
conn.commit()
|
|
663
|
+
conn.close()
|
|
664
|
+
|
|
665
|
+
print(f"Session ended: {timestamp}")
|
|
666
|
+
return 0
|
|
667
|
+
|
|
668
|
+
# ============================================================
|
|
669
|
+
# COMPLIANCE COMMANDS
|
|
670
|
+
# ============================================================
|
|
671
|
+
|
|
672
|
+
def compliance_check(self) -> int:
|
|
673
|
+
"""Check UAP protocol compliance."""
|
|
674
|
+
print("=== UAP Protocol Compliance Check ===\n")
|
|
675
|
+
|
|
676
|
+
all_passed = True
|
|
677
|
+
|
|
678
|
+
# Check 1: Memory database exists
|
|
679
|
+
if self.db_path.exists():
|
|
680
|
+
print("PASS: Memory database initialized")
|
|
681
|
+
else:
|
|
682
|
+
print("FAIL: Memory database not initialized")
|
|
683
|
+
all_passed = False
|
|
684
|
+
|
|
685
|
+
# Check 2: Required tables exist
|
|
686
|
+
conn = self.get_connection()
|
|
687
|
+
cursor = conn.cursor()
|
|
688
|
+
cursor.execute("SELECT name FROM sqlite_master WHERE type='table'")
|
|
689
|
+
tables = [row[0] for row in cursor.fetchall()]
|
|
690
|
+
|
|
691
|
+
required_tables = ["memories", "session_memories", "entities", "relationships"]
|
|
692
|
+
for table in required_tables:
|
|
693
|
+
if table in tables:
|
|
694
|
+
print(f"PASS: Table '{table}' exists")
|
|
695
|
+
else:
|
|
696
|
+
print(f"FAIL: Table '{table}' missing (run migration)")
|
|
697
|
+
all_passed = False
|
|
698
|
+
|
|
699
|
+
conn.close()
|
|
700
|
+
|
|
701
|
+
# Check 3: FTS index exists
|
|
702
|
+
if "memories_fts" in tables:
|
|
703
|
+
print("PASS: Full-text search index exists")
|
|
704
|
+
else:
|
|
705
|
+
print("FAIL: FTS5 index missing (run migration)")
|
|
706
|
+
all_passed = False
|
|
707
|
+
|
|
708
|
+
# Check 4: Coordination DB
|
|
709
|
+
if self.coord_db_path.exists():
|
|
710
|
+
print("PASS: Coordination database initialized")
|
|
711
|
+
else:
|
|
712
|
+
print("WARN: Coordination DB not initialized (multi-agent mode disabled)")
|
|
713
|
+
|
|
714
|
+
# Check 5: Worktrees directory
|
|
715
|
+
if self.worktrees_dir.exists():
|
|
716
|
+
wt_count = len([d for d in self.worktrees_dir.iterdir() if d.is_dir()])
|
|
717
|
+
print(f"PASS: Worktrees directory exists ({wt_count} worktrees)")
|
|
718
|
+
else:
|
|
719
|
+
print("WARN: No worktrees directory (single-agent mode)")
|
|
720
|
+
|
|
721
|
+
print("\n" + "=" * 40)
|
|
722
|
+
if all_passed:
|
|
723
|
+
print("UAP Protocol COMPLIANT - All checks passed")
|
|
724
|
+
return 0
|
|
725
|
+
else:
|
|
726
|
+
print("UAP Protocol NON-COMPLIANT - Run migrations first")
|
|
727
|
+
print("\nTo fix:")
|
|
728
|
+
print(" 1. Run database migration: tools/agents/migrations/apply.py")
|
|
729
|
+
print(
|
|
730
|
+
" 2. Initialize coordination DB: tools/agents/scripts/init_coordination_db.sh"
|
|
731
|
+
)
|
|
732
|
+
return 1
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
def main():
|
|
736
|
+
parser = argparse.ArgumentParser(
|
|
737
|
+
description="Universal Agent Protocol CLI",
|
|
738
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
739
|
+
epilog="""
|
|
740
|
+
Examples:
|
|
741
|
+
UAP task ready # Check task readiness
|
|
742
|
+
UAP memory query "Redis caching" # Search memory by topic
|
|
743
|
+
UAP worktree create fix-bug # Create new worktree
|
|
744
|
+
UAP session start # Start agent session
|
|
745
|
+
UAP compliance check # Verify protocol compliance
|
|
746
|
+
UAP setup # Interactive setup
|
|
747
|
+
""",
|
|
748
|
+
)
|
|
749
|
+
|
|
750
|
+
subparsers = parser.add_subparsers(dest="command", help="Command")
|
|
751
|
+
|
|
752
|
+
# Task commands
|
|
753
|
+
task_parser = subparsers.add_parser("task", help="Task management")
|
|
754
|
+
task_sub = task_parser.add_subparsers(dest="subcommand")
|
|
755
|
+
|
|
756
|
+
task_sub.add_parser("ready", help="Check task readiness")
|
|
757
|
+
task_create = task_sub.add_parser("create", help="Create new task")
|
|
758
|
+
task_create.add_argument(
|
|
759
|
+
"type", choices=["action", "observation", "thought", "goal"]
|
|
760
|
+
)
|
|
761
|
+
task_create.add_argument("title", help="Task title")
|
|
762
|
+
|
|
763
|
+
# Memory commands
|
|
764
|
+
memory_parser = subparsers.add_parser("memory", help="Memory operations")
|
|
765
|
+
memory_sub = memory_parser.add_subparsers(dest="subcommand")
|
|
766
|
+
|
|
767
|
+
memory_query = memory_sub.add_parser("query", help="Query memory by topic")
|
|
768
|
+
memory_query.add_argument("query", help="Search query")
|
|
769
|
+
memory_query.add_argument("-n", "--limit", type=int, default=10, help="Max results")
|
|
770
|
+
|
|
771
|
+
# Worktree commands
|
|
772
|
+
wt_parser = subparsers.add_parser("worktree", help="Worktree management")
|
|
773
|
+
wt_sub = wt_parser.add_subparsers(dest="subcommand")
|
|
774
|
+
|
|
775
|
+
wt_create = wt_sub.add_parser("create", help="Create new worktree")
|
|
776
|
+
wt_create.add_argument("slug", help="Worktree slug")
|
|
777
|
+
|
|
778
|
+
wt_cleanup = wt_sub.add_parser("cleanup", help="Clean up worktree")
|
|
779
|
+
wt_cleanup.add_argument("id_or_slug", help="Worktree ID or slug")
|
|
780
|
+
|
|
781
|
+
wt_sub.add_parser("list", help="List active worktrees")
|
|
782
|
+
|
|
783
|
+
# Session commands
|
|
784
|
+
session_parser = subparsers.add_parser("session", help="Session management")
|
|
785
|
+
session_sub = session_parser.add_subparsers(dest="subcommand")
|
|
786
|
+
|
|
787
|
+
session_sub.add_parser("start", help="Start new session")
|
|
788
|
+
session_sub.add_parser("end", help="End current session")
|
|
789
|
+
|
|
790
|
+
# Compliance command
|
|
791
|
+
subparsers.add_parser("compliance", help="Check protocol compliance")
|
|
792
|
+
|
|
793
|
+
# Setup command with feature toggles
|
|
794
|
+
setup_parser = subparsers.add_parser(
|
|
795
|
+
"setup", help="Interactive setup with feature selection and verification"
|
|
796
|
+
)
|
|
797
|
+
setup_parser.add_argument(
|
|
798
|
+
"-y",
|
|
799
|
+
"--yes",
|
|
800
|
+
action="store_true",
|
|
801
|
+
default=False,
|
|
802
|
+
help="Non-interactive mode - use all defaults",
|
|
803
|
+
)
|
|
804
|
+
setup_parser.add_argument(
|
|
805
|
+
"--feature-memory",
|
|
806
|
+
dest="feature_memory",
|
|
807
|
+
action="store_true",
|
|
808
|
+
default=True,
|
|
809
|
+
help="Enable memory system (default: enabled)",
|
|
810
|
+
)
|
|
811
|
+
setup_parser.add_argument(
|
|
812
|
+
"--no-feature-memory",
|
|
813
|
+
dest="feature_memory",
|
|
814
|
+
action="store_false",
|
|
815
|
+
help="Disable memory system",
|
|
816
|
+
)
|
|
817
|
+
setup_parser.add_argument(
|
|
818
|
+
"--feature-parallel",
|
|
819
|
+
dest="feature_parallel",
|
|
820
|
+
action="store_true",
|
|
821
|
+
default=False,
|
|
822
|
+
help="Enable parallel execution mode",
|
|
823
|
+
)
|
|
824
|
+
setup_parser.add_argument(
|
|
825
|
+
"--feature-validation",
|
|
826
|
+
dest="feature_validation",
|
|
827
|
+
action="store_true",
|
|
828
|
+
default=True,
|
|
829
|
+
help="Enable validation toggle (default: enabled)",
|
|
830
|
+
)
|
|
831
|
+
setup_parser.add_argument(
|
|
832
|
+
"--no-feature-validation",
|
|
833
|
+
dest="feature_validation",
|
|
834
|
+
action="store_false",
|
|
835
|
+
help="Disable validation toggle",
|
|
836
|
+
)
|
|
837
|
+
|
|
838
|
+
args = parser.parse_args()
|
|
839
|
+
|
|
840
|
+
if not args.command:
|
|
841
|
+
parser.print_help()
|
|
842
|
+
return 1
|
|
843
|
+
|
|
844
|
+
cli = UAPCLI()
|
|
845
|
+
|
|
846
|
+
try:
|
|
847
|
+
if args.command == "task":
|
|
848
|
+
if args.subcommand == "ready":
|
|
849
|
+
return cli.task_ready()
|
|
850
|
+
elif args.subcommand == "create":
|
|
851
|
+
return cli.task_create(args.type, args.title)
|
|
852
|
+
else:
|
|
853
|
+
task_parser.print_help()
|
|
854
|
+
return 1
|
|
855
|
+
|
|
856
|
+
elif args.command == "memory":
|
|
857
|
+
if args.subcommand == "query":
|
|
858
|
+
return cli.memory_query(args.query, args.limit)
|
|
859
|
+
else:
|
|
860
|
+
memory_parser.print_help()
|
|
861
|
+
return 1
|
|
862
|
+
|
|
863
|
+
elif args.command == "worktree":
|
|
864
|
+
if args.subcommand == "create":
|
|
865
|
+
return cli.worktree_create(args.slug)
|
|
866
|
+
elif args.subcommand == "cleanup":
|
|
867
|
+
return cli.worktree_cleanup(args.id_or_slug)
|
|
868
|
+
elif args.subcommand == "list":
|
|
869
|
+
return cli.worktree_list()
|
|
870
|
+
else:
|
|
871
|
+
wt_parser.print_help()
|
|
872
|
+
return 1
|
|
873
|
+
|
|
874
|
+
elif args.command == "session":
|
|
875
|
+
if args.subcommand == "start":
|
|
876
|
+
return cli.session_start()
|
|
877
|
+
elif args.subcommand == "end":
|
|
878
|
+
return cli.session_end()
|
|
879
|
+
else:
|
|
880
|
+
session_parser.print_help()
|
|
881
|
+
return 1
|
|
882
|
+
|
|
883
|
+
elif args.command == "compliance":
|
|
884
|
+
return cli.compliance_check()
|
|
885
|
+
|
|
886
|
+
elif args.command == "setup":
|
|
887
|
+
return cli.setup(args)
|
|
888
|
+
|
|
889
|
+
except FileNotFoundError as e:
|
|
890
|
+
print(f"Error: {e}")
|
|
891
|
+
return 1
|
|
892
|
+
except Exception as e:
|
|
893
|
+
print(f"Unexpected error: {e}")
|
|
894
|
+
import traceback
|
|
895
|
+
|
|
896
|
+
traceback.print_exc()
|
|
897
|
+
return 1
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
if __name__ == "__main__":
|
|
901
|
+
sys.exit(main())
|