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,257 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
UAP Compliance Test Suite
|
|
4
|
+
|
|
5
|
+
Tests all UAP protocol requirements to ensure 100% compliance.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
tools/agents/tests/test_uap_compliance.py
|
|
9
|
+
# or with pytest:
|
|
10
|
+
pytest tools/agents/tests/test_uap_compliance.py -v
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import sqlite3
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
import unittest
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class TestUAPCompliance(unittest.TestCase):
|
|
21
|
+
"""Test suite for UAP protocol compliance."""
|
|
22
|
+
|
|
23
|
+
def setUp(self):
|
|
24
|
+
"""Setup test fixtures."""
|
|
25
|
+
self.project_root = Path(__file__).parent.parent.parent
|
|
26
|
+
self.db_path = self.project_root / "agents/data/memory/short_term.db"
|
|
27
|
+
self.coord_db_path = (
|
|
28
|
+
self.project_root / "agents/data/coordination/coordination.db"
|
|
29
|
+
)
|
|
30
|
+
self.worktrees_dir = self.project_root / ".worktrees"
|
|
31
|
+
|
|
32
|
+
def test_01_memory_database_exists(self):
|
|
33
|
+
"""Test that memory database is initialized."""
|
|
34
|
+
assert self.db_path.exists(), "Memory database not found"
|
|
35
|
+
print("✅ Memory database exists")
|
|
36
|
+
|
|
37
|
+
def test_02_memories_table_exists(self):
|
|
38
|
+
"""Test that memories table exists."""
|
|
39
|
+
conn = sqlite3.connect(str(self.db_path))
|
|
40
|
+
cursor = conn.cursor()
|
|
41
|
+
cursor.execute(
|
|
42
|
+
"SELECT name FROM sqlite_master WHERE type='table' AND name='memories'"
|
|
43
|
+
)
|
|
44
|
+
result = cursor.fetchone()
|
|
45
|
+
conn.close()
|
|
46
|
+
|
|
47
|
+
assert result is not None, "memories table not found"
|
|
48
|
+
print("✅ memories table exists")
|
|
49
|
+
|
|
50
|
+
def test_03_session_memories_table_exists(self):
|
|
51
|
+
"""Test that session_memories table exists."""
|
|
52
|
+
conn = sqlite3.connect(str(self.db_path))
|
|
53
|
+
cursor = conn.cursor()
|
|
54
|
+
cursor.execute(
|
|
55
|
+
"SELECT name FROM sqlite_master WHERE type='table' AND name='session_memories'"
|
|
56
|
+
)
|
|
57
|
+
result = cursor.fetchone()
|
|
58
|
+
conn.close()
|
|
59
|
+
|
|
60
|
+
assert result is not None, "session_memories table not found"
|
|
61
|
+
print("✅ session_memories table exists")
|
|
62
|
+
|
|
63
|
+
def test_04_entities_table_exists(self):
|
|
64
|
+
"""Test that entities table exists."""
|
|
65
|
+
conn = sqlite3.connect(str(self.db_path))
|
|
66
|
+
cursor = conn.cursor()
|
|
67
|
+
cursor.execute(
|
|
68
|
+
"SELECT name FROM sqlite_master WHERE type='table' AND name='entities'"
|
|
69
|
+
)
|
|
70
|
+
result = cursor.fetchone()
|
|
71
|
+
conn.close()
|
|
72
|
+
|
|
73
|
+
assert result is not None, "entities table not found"
|
|
74
|
+
print("✅ entities table exists")
|
|
75
|
+
|
|
76
|
+
def test_05_relationships_table_exists(self):
|
|
77
|
+
"""Test that relationships table exists."""
|
|
78
|
+
conn = sqlite3.connect(str(self.db_path))
|
|
79
|
+
cursor = conn.cursor()
|
|
80
|
+
cursor.execute(
|
|
81
|
+
"SELECT name FROM sqlite_master WHERE type='table' AND name='relationships'"
|
|
82
|
+
)
|
|
83
|
+
result = cursor.fetchone()
|
|
84
|
+
conn.close()
|
|
85
|
+
|
|
86
|
+
assert result is not None, "relationships table not found"
|
|
87
|
+
print("✅ relationships table exists")
|
|
88
|
+
|
|
89
|
+
def test_06_fts5_index_exists(self):
|
|
90
|
+
"""Test that FTS5 full-text search index exists."""
|
|
91
|
+
conn = sqlite3.connect(str(self.db_path))
|
|
92
|
+
cursor = conn.cursor()
|
|
93
|
+
cursor.execute(
|
|
94
|
+
"SELECT name FROM sqlite_master WHERE type='table' AND name='memories_fts'"
|
|
95
|
+
)
|
|
96
|
+
result = cursor.fetchone()
|
|
97
|
+
conn.close()
|
|
98
|
+
|
|
99
|
+
assert result is not None, "memories_fts FTS5 index not found"
|
|
100
|
+
print("✅ memories_fts FTS5 index exists")
|
|
101
|
+
|
|
102
|
+
def test_07_coordination_database_exists(self):
|
|
103
|
+
"""Test that coordination database exists."""
|
|
104
|
+
assert self.coord_db_path.exists(), "Coordination database not found"
|
|
105
|
+
print("✅ Coordination database exists")
|
|
106
|
+
|
|
107
|
+
def test_08_agent_registry_table_exists(self):
|
|
108
|
+
"""Test that agent_registry table exists in coordination DB."""
|
|
109
|
+
conn = sqlite3.connect(str(self.coord_db_path))
|
|
110
|
+
cursor = conn.cursor()
|
|
111
|
+
cursor.execute(
|
|
112
|
+
"SELECT name FROM sqlite_master WHERE type='table' AND name='agent_registry'"
|
|
113
|
+
)
|
|
114
|
+
result = cursor.fetchone()
|
|
115
|
+
conn.close()
|
|
116
|
+
|
|
117
|
+
assert result is not None, "agent_registry table not found"
|
|
118
|
+
print("✅ agent_registry table exists")
|
|
119
|
+
|
|
120
|
+
def test_09_uap_cli_command_exists(self):
|
|
121
|
+
"""Test that UAP CLI command is available."""
|
|
122
|
+
cli_path = Path(__file__).parent.parent / "UAP" / "cli.py"
|
|
123
|
+
assert cli_path.exists(), f"UAP CLI not found at {cli_path}"
|
|
124
|
+
|
|
125
|
+
# Test CLI help
|
|
126
|
+
result = subprocess.run(
|
|
127
|
+
["python3", str(cli_path), "--help"], capture_output=True, text=True
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
assert result.returncode == 0, "UAP CLI failed to run"
|
|
131
|
+
assert "task" in result.stdout.lower(), "CLI missing 'task' command"
|
|
132
|
+
assert "memory" in result.stdout.lower(), "CLI missing 'memory' command"
|
|
133
|
+
assert "worktree" in result.stdout.lower(), "CLI missing 'worktree' command"
|
|
134
|
+
|
|
135
|
+
print("✅ UAP CLI command available")
|
|
136
|
+
|
|
137
|
+
def test_10_uap_task_ready_command(self):
|
|
138
|
+
"""Test that UAP task ready command works."""
|
|
139
|
+
cli_path = Path(__file__).parent.parent / "UAP" / "cli.py"
|
|
140
|
+
|
|
141
|
+
result = subprocess.run(
|
|
142
|
+
["python3", str(cli_path), "task", "ready"], capture_output=True, text=True
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
assert result.returncode == 0, f"UAP task ready failed: {result.stderr}"
|
|
146
|
+
print("✅ UAP task ready command works")
|
|
147
|
+
|
|
148
|
+
def test_11_uap_memory_query_command(self):
|
|
149
|
+
"""Test that UAP memory query command works."""
|
|
150
|
+
cli_path = Path(__file__).parent.parent / "UAP" / "cli.py"
|
|
151
|
+
|
|
152
|
+
result = subprocess.run(
|
|
153
|
+
["python3", str(cli_path), "memory", "query", "test"],
|
|
154
|
+
capture_output=True,
|
|
155
|
+
text=True,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
# Query should succeed (even if no results)
|
|
159
|
+
assert result.returncode == 0 or result.returncode == 1, (
|
|
160
|
+
f"UAP memory query failed unexpectedly: {result.stderr}"
|
|
161
|
+
)
|
|
162
|
+
print("✅ UAP memory query command works")
|
|
163
|
+
|
|
164
|
+
def test_12_uap_compliance_check_command(self):
|
|
165
|
+
"""Test that UAP compliance check command works."""
|
|
166
|
+
cli_path = Path(__file__).parent.parent / "UAP" / "cli.py"
|
|
167
|
+
|
|
168
|
+
result = subprocess.run(
|
|
169
|
+
["python3", str(cli_path), "compliance"], capture_output=True, text=True
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
# Should return 0 if compliant, 1 if not (both are valid outcomes)
|
|
173
|
+
assert result.returncode in [0, 1], (
|
|
174
|
+
f"UAP compliance check failed: {result.stderr}"
|
|
175
|
+
)
|
|
176
|
+
print("✅ UAP compliance check command works")
|
|
177
|
+
|
|
178
|
+
def test_13_session_memories_schema(self):
|
|
179
|
+
"""Test session_memories table schema."""
|
|
180
|
+
conn = sqlite3.connect(str(self.db_path))
|
|
181
|
+
cursor = conn.cursor()
|
|
182
|
+
|
|
183
|
+
# Get table info
|
|
184
|
+
cursor.execute("PRAGMA table_info(session_memories)")
|
|
185
|
+
columns = {row[1]: row[2] for row in cursor.fetchall()}
|
|
186
|
+
conn.close()
|
|
187
|
+
|
|
188
|
+
assert "session_id" in columns, "session_id column missing"
|
|
189
|
+
assert "timestamp" in columns, "timestamp column missing"
|
|
190
|
+
assert "type" in columns, "type column missing"
|
|
191
|
+
assert "content" in columns, "content column missing"
|
|
192
|
+
assert "importance" in columns, "importance column missing"
|
|
193
|
+
|
|
194
|
+
print("✅ session_memories table schema correct")
|
|
195
|
+
|
|
196
|
+
def test_14_entities_schema(self):
|
|
197
|
+
"""Test entities table schema."""
|
|
198
|
+
conn = sqlite3.connect(str(self.db_path))
|
|
199
|
+
cursor = conn.cursor()
|
|
200
|
+
|
|
201
|
+
cursor.execute("PRAGMA table_info(entities)")
|
|
202
|
+
columns = {row[1]: row[2] for row in cursor.fetchall()}
|
|
203
|
+
conn.close()
|
|
204
|
+
|
|
205
|
+
assert "name" in columns, "name column missing"
|
|
206
|
+
assert "type" in columns, "type column missing"
|
|
207
|
+
assert "description" in columns, "description column missing"
|
|
208
|
+
|
|
209
|
+
print("✅ entities table schema correct")
|
|
210
|
+
|
|
211
|
+
def test_15_relationships_schema(self):
|
|
212
|
+
"""Test relationships table schema."""
|
|
213
|
+
conn = sqlite3.connect(str(self.db_path))
|
|
214
|
+
cursor = conn.cursor()
|
|
215
|
+
|
|
216
|
+
cursor.execute("PRAGMA table_info(relationships)")
|
|
217
|
+
columns = {row[1]: row[2] for row in cursor.fetchall()}
|
|
218
|
+
conn.close()
|
|
219
|
+
|
|
220
|
+
assert "source_id" in columns, "source_id column missing"
|
|
221
|
+
assert "target_id" in columns, "target_id column missing"
|
|
222
|
+
assert "relation" in columns, "relation column missing"
|
|
223
|
+
|
|
224
|
+
print("✅ relationships table schema correct")
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def run_tests():
|
|
228
|
+
"""Run all compliance tests."""
|
|
229
|
+
import unittest
|
|
230
|
+
|
|
231
|
+
# Create test suite
|
|
232
|
+
loader = unittest.TestLoader()
|
|
233
|
+
suite = loader.loadTestsFromTestCase(TestUAPCompliance)
|
|
234
|
+
|
|
235
|
+
# Run tests
|
|
236
|
+
runner = unittest.TextTestRunner(verbosity=2)
|
|
237
|
+
result = runner.run(suite)
|
|
238
|
+
|
|
239
|
+
# Print summary
|
|
240
|
+
print("\n" + "=" * 60)
|
|
241
|
+
print("TEST SUMMARY")
|
|
242
|
+
print("=" * 60)
|
|
243
|
+
print(f"Tests run: {result.testsRun}")
|
|
244
|
+
print(f"Failures: {len(result.failures)}")
|
|
245
|
+
print(f"Errors: {len(result.errors)}")
|
|
246
|
+
print(f"Successes: {result.testsRun - len(result.failures) - len(result.errors)}")
|
|
247
|
+
|
|
248
|
+
if result.wasSuccessful():
|
|
249
|
+
print("\n✅ ALL COMPLIANCE TESTS PASSED")
|
|
250
|
+
return 0
|
|
251
|
+
else:
|
|
252
|
+
print("\n❌ SOME COMPLIANCE TESTS FAILED")
|
|
253
|
+
return 1
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
if __name__ == "__main__":
|
|
257
|
+
sys.exit(run_tests())
|