opencode-telos 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/README.md +927 -0
- package/dist/code-intelligence/analyzer.d.ts +9 -0
- package/dist/code-intelligence/analyzer.d.ts.map +1 -0
- package/dist/code-intelligence/analyzer.js +321 -0
- package/dist/code-intelligence/analyzer.js.map +1 -0
- package/dist/code-intelligence/ast/cache.d.ts +16 -0
- package/dist/code-intelligence/ast/cache.d.ts.map +1 -0
- package/dist/code-intelligence/ast/cache.js +44 -0
- package/dist/code-intelligence/ast/cache.js.map +1 -0
- package/dist/code-intelligence/ast/common.d.ts +8 -0
- package/dist/code-intelligence/ast/common.d.ts.map +1 -0
- package/dist/code-intelligence/ast/common.js +42 -0
- package/dist/code-intelligence/ast/common.js.map +1 -0
- package/dist/code-intelligence/ast/component.d.ts +10 -0
- package/dist/code-intelligence/ast/component.d.ts.map +1 -0
- package/dist/code-intelligence/ast/component.js +38 -0
- package/dist/code-intelligence/ast/component.js.map +1 -0
- package/dist/code-intelligence/ast/fallback.d.ts +9 -0
- package/dist/code-intelligence/ast/fallback.d.ts.map +1 -0
- package/dist/code-intelligence/ast/fallback.js +38 -0
- package/dist/code-intelligence/ast/fallback.js.map +1 -0
- package/dist/code-intelligence/ast/index.d.ts +5 -0
- package/dist/code-intelligence/ast/index.d.ts.map +1 -0
- package/dist/code-intelligence/ast/index.js +5 -0
- package/dist/code-intelligence/ast/index.js.map +1 -0
- package/dist/code-intelligence/ast/ir.d.ts +72 -0
- package/dist/code-intelligence/ast/ir.d.ts.map +1 -0
- package/dist/code-intelligence/ast/ir.js +2 -0
- package/dist/code-intelligence/ast/ir.js.map +1 -0
- package/dist/code-intelligence/ast/metrics.d.ts +25 -0
- package/dist/code-intelligence/ast/metrics.d.ts.map +1 -0
- package/dist/code-intelligence/ast/metrics.js +38 -0
- package/dist/code-intelligence/ast/metrics.js.map +1 -0
- package/dist/code-intelligence/ast/registry.d.ts +5 -0
- package/dist/code-intelligence/ast/registry.d.ts.map +1 -0
- package/dist/code-intelligence/ast/registry.js +22 -0
- package/dist/code-intelligence/ast/registry.js.map +1 -0
- package/dist/code-intelligence/ast/tree-sitter.d.ts +8 -0
- package/dist/code-intelligence/ast/tree-sitter.d.ts.map +1 -0
- package/dist/code-intelligence/ast/tree-sitter.js +247 -0
- package/dist/code-intelligence/ast/tree-sitter.js.map +1 -0
- package/dist/code-intelligence/ast/typescript.d.ts +8 -0
- package/dist/code-intelligence/ast/typescript.d.ts.map +1 -0
- package/dist/code-intelligence/ast/typescript.js +147 -0
- package/dist/code-intelligence/ast/typescript.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/server.d.ts +27 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +67 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/opencode/hooks.d.ts +9 -0
- package/dist/opencode/hooks.d.ts.map +1 -0
- package/dist/opencode/hooks.js +583 -0
- package/dist/opencode/hooks.js.map +1 -0
- package/dist/opencode/router/categories.d.ts +31 -0
- package/dist/opencode/router/categories.d.ts.map +1 -0
- package/dist/opencode/router/categories.js +165 -0
- package/dist/opencode/router/categories.js.map +1 -0
- package/dist/opencode/router/embeddings.d.ts +41 -0
- package/dist/opencode/router/embeddings.d.ts.map +1 -0
- package/dist/opencode/router/embeddings.js +136 -0
- package/dist/opencode/router/embeddings.js.map +1 -0
- package/dist/opencode/router/graph-state-snapshot.d.ts +35 -0
- package/dist/opencode/router/graph-state-snapshot.d.ts.map +1 -0
- package/dist/opencode/router/graph-state-snapshot.js +129 -0
- package/dist/opencode/router/graph-state-snapshot.js.map +1 -0
- package/dist/opencode/router/index.d.ts +21 -0
- package/dist/opencode/router/index.d.ts.map +1 -0
- package/dist/opencode/router/index.js +23 -0
- package/dist/opencode/router/index.js.map +1 -0
- package/dist/opencode/router/intent-classifier.d.ts +35 -0
- package/dist/opencode/router/intent-classifier.d.ts.map +1 -0
- package/dist/opencode/router/intent-classifier.js +108 -0
- package/dist/opencode/router/intent-classifier.js.map +1 -0
- package/dist/opencode/router/semantic-nudge.d.ts +42 -0
- package/dist/opencode/router/semantic-nudge.d.ts.map +1 -0
- package/dist/opencode/router/semantic-nudge.js +73 -0
- package/dist/opencode/router/semantic-nudge.js.map +1 -0
- package/dist/opencode/router/state-gate.d.ts +25 -0
- package/dist/opencode/router/state-gate.d.ts.map +1 -0
- package/dist/opencode/router/state-gate.js +178 -0
- package/dist/opencode/router/state-gate.js.map +1 -0
- package/dist/opencode/router/tool-embeddings.d.ts +36 -0
- package/dist/opencode/router/tool-embeddings.d.ts.map +1 -0
- package/dist/opencode/router/tool-embeddings.js +140 -0
- package/dist/opencode/router/tool-embeddings.js.map +1 -0
- package/dist/opencode/router/tool-registry.d.ts +45 -0
- package/dist/opencode/router/tool-registry.d.ts.map +1 -0
- package/dist/opencode/router/tool-registry.js +103 -0
- package/dist/opencode/router/tool-registry.js.map +1 -0
- package/dist/opencode/router/tool-taxonomy.d.ts +51 -0
- package/dist/opencode/router/tool-taxonomy.d.ts.map +1 -0
- package/dist/opencode/router/tool-taxonomy.js +250 -0
- package/dist/opencode/router/tool-taxonomy.js.map +1 -0
- package/dist/opencode/router/tools-composite.d.ts +21 -0
- package/dist/opencode/router/tools-composite.d.ts.map +1 -0
- package/dist/opencode/router/tools-composite.js +684 -0
- package/dist/opencode/router/tools-composite.js.map +1 -0
- package/dist/opencode/shell-hooks.d.ts +7 -0
- package/dist/opencode/shell-hooks.d.ts.map +1 -0
- package/dist/opencode/shell-hooks.js +96 -0
- package/dist/opencode/shell-hooks.js.map +1 -0
- package/dist/opencode/system-prompt.d.ts +10 -0
- package/dist/opencode/system-prompt.d.ts.map +1 -0
- package/dist/opencode/system-prompt.js +600 -0
- package/dist/opencode/system-prompt.js.map +1 -0
- package/dist/opencode/tools.d.ts +8 -0
- package/dist/opencode/tools.d.ts.map +1 -0
- package/dist/opencode/tools.js +3731 -0
- package/dist/opencode/tools.js.map +1 -0
- package/dist/opencode/workflows/chains.d.ts +52 -0
- package/dist/opencode/workflows/chains.d.ts.map +1 -0
- package/dist/opencode/workflows/chains.js +170 -0
- package/dist/opencode/workflows/chains.js.map +1 -0
- package/dist/opencode/workflows/executor.d.ts +52 -0
- package/dist/opencode/workflows/executor.d.ts.map +1 -0
- package/dist/opencode/workflows/executor.js +130 -0
- package/dist/opencode/workflows/executor.js.map +1 -0
- package/dist/opencode/workflows/index.d.ts +14 -0
- package/dist/opencode/workflows/index.d.ts.map +1 -0
- package/dist/opencode/workflows/index.js +15 -0
- package/dist/opencode/workflows/index.js.map +1 -0
- package/dist/opencode/workflows/tools-workflow.d.ts +24 -0
- package/dist/opencode/workflows/tools-workflow.d.ts.map +1 -0
- package/dist/opencode/workflows/tools-workflow.js +85 -0
- package/dist/opencode/workflows/tools-workflow.js.map +1 -0
- package/dist/opencode/workflows/types.d.ts +32 -0
- package/dist/opencode/workflows/types.d.ts.map +1 -0
- package/dist/opencode/workflows/types.js +13 -0
- package/dist/opencode/workflows/types.js.map +1 -0
- package/dist/sdd/analysis/compliance.d.ts +30 -0
- package/dist/sdd/analysis/compliance.d.ts.map +1 -0
- package/dist/sdd/analysis/compliance.js +251 -0
- package/dist/sdd/analysis/compliance.js.map +1 -0
- package/dist/sdd/analysis/scalability.d.ts +15 -0
- package/dist/sdd/analysis/scalability.d.ts.map +1 -0
- package/dist/sdd/analysis/scalability.js +72 -0
- package/dist/sdd/analysis/scalability.js.map +1 -0
- package/dist/sdd/analysis/security.d.ts +25 -0
- package/dist/sdd/analysis/security.d.ts.map +1 -0
- package/dist/sdd/analysis/security.js +94 -0
- package/dist/sdd/analysis/security.js.map +1 -0
- package/dist/sdd/brownfield/scanner.d.ts +31 -0
- package/dist/sdd/brownfield/scanner.d.ts.map +1 -0
- package/dist/sdd/brownfield/scanner.js +228 -0
- package/dist/sdd/brownfield/scanner.js.map +1 -0
- package/dist/sdd/cache/manager.d.ts +237 -0
- package/dist/sdd/cache/manager.d.ts.map +1 -0
- package/dist/sdd/cache/manager.js +770 -0
- package/dist/sdd/cache/manager.js.map +1 -0
- package/dist/sdd/cache/snapshot-store.d.ts +39 -0
- package/dist/sdd/cache/snapshot-store.d.ts.map +1 -0
- package/dist/sdd/cache/snapshot-store.js +156 -0
- package/dist/sdd/cache/snapshot-store.js.map +1 -0
- package/dist/sdd/changes/manager.d.ts +58 -0
- package/dist/sdd/changes/manager.d.ts.map +1 -0
- package/dist/sdd/changes/manager.js +235 -0
- package/dist/sdd/changes/manager.js.map +1 -0
- package/dist/sdd/cicd/generators.d.ts +16 -0
- package/dist/sdd/cicd/generators.d.ts.map +1 -0
- package/dist/sdd/cicd/generators.js +1042 -0
- package/dist/sdd/cicd/generators.js.map +1 -0
- package/dist/sdd/code-quality/complexity.d.ts +38 -0
- package/dist/sdd/code-quality/complexity.d.ts.map +1 -0
- package/dist/sdd/code-quality/complexity.js +161 -0
- package/dist/sdd/code-quality/complexity.js.map +1 -0
- package/dist/sdd/code-quality/conventions.d.ts +33 -0
- package/dist/sdd/code-quality/conventions.d.ts.map +1 -0
- package/dist/sdd/code-quality/conventions.js +193 -0
- package/dist/sdd/code-quality/conventions.js.map +1 -0
- package/dist/sdd/code-quality/dependencies.d.ts +27 -0
- package/dist/sdd/code-quality/dependencies.d.ts.map +1 -0
- package/dist/sdd/code-quality/dependencies.js +142 -0
- package/dist/sdd/code-quality/dependencies.js.map +1 -0
- package/dist/sdd/code-quality/import-analyzer.d.ts +49 -0
- package/dist/sdd/code-quality/import-analyzer.d.ts.map +1 -0
- package/dist/sdd/code-quality/import-analyzer.js +213 -0
- package/dist/sdd/code-quality/import-analyzer.js.map +1 -0
- package/dist/sdd/code-quality/metrics.d.ts +35 -0
- package/dist/sdd/code-quality/metrics.d.ts.map +1 -0
- package/dist/sdd/code-quality/metrics.js +172 -0
- package/dist/sdd/code-quality/metrics.js.map +1 -0
- package/dist/sdd/code-quality/smells.d.ts +38 -0
- package/dist/sdd/code-quality/smells.d.ts.map +1 -0
- package/dist/sdd/code-quality/smells.js +319 -0
- package/dist/sdd/code-quality/smells.js.map +1 -0
- package/dist/sdd/code-quality/symbol-parser.d.ts +28 -0
- package/dist/sdd/code-quality/symbol-parser.d.ts.map +1 -0
- package/dist/sdd/code-quality/symbol-parser.js +230 -0
- package/dist/sdd/code-quality/symbol-parser.js.map +1 -0
- package/dist/sdd/code-quality/usage-tracker.d.ts +59 -0
- package/dist/sdd/code-quality/usage-tracker.d.ts.map +1 -0
- package/dist/sdd/code-quality/usage-tracker.js +402 -0
- package/dist/sdd/code-quality/usage-tracker.js.map +1 -0
- package/dist/sdd/code-quality/utils.d.ts +6 -0
- package/dist/sdd/code-quality/utils.d.ts.map +1 -0
- package/dist/sdd/code-quality/utils.js +14 -0
- package/dist/sdd/code-quality/utils.js.map +1 -0
- package/dist/sdd/codegen/generator.d.ts +42 -0
- package/dist/sdd/codegen/generator.d.ts.map +1 -0
- package/dist/sdd/codegen/generator.js +1023 -0
- package/dist/sdd/codegen/generator.js.map +1 -0
- package/dist/sdd/constitution/validator.d.ts +37 -0
- package/dist/sdd/constitution/validator.d.ts.map +1 -0
- package/dist/sdd/constitution/validator.js +192 -0
- package/dist/sdd/constitution/validator.js.map +1 -0
- package/dist/sdd/cost/estimator.d.ts +31 -0
- package/dist/sdd/cost/estimator.d.ts.map +1 -0
- package/dist/sdd/cost/estimator.js +92 -0
- package/dist/sdd/cost/estimator.js.map +1 -0
- package/dist/sdd/coverage/tracker.d.ts +47 -0
- package/dist/sdd/coverage/tracker.d.ts.map +1 -0
- package/dist/sdd/coverage/tracker.js +251 -0
- package/dist/sdd/coverage/tracker.js.map +1 -0
- package/dist/sdd/disaster/recovery.d.ts +11 -0
- package/dist/sdd/disaster/recovery.d.ts.map +1 -0
- package/dist/sdd/disaster/recovery.js +55 -0
- package/dist/sdd/disaster/recovery.js.map +1 -0
- package/dist/sdd/discovery/adaptive.d.ts +14 -0
- package/dist/sdd/discovery/adaptive.d.ts.map +1 -0
- package/dist/sdd/discovery/adaptive.js +145 -0
- package/dist/sdd/discovery/adaptive.js.map +1 -0
- package/dist/sdd/discovery/briefing-analyzer.d.ts +66 -0
- package/dist/sdd/discovery/briefing-analyzer.d.ts.map +1 -0
- package/dist/sdd/discovery/briefing-analyzer.js +672 -0
- package/dist/sdd/discovery/briefing-analyzer.js.map +1 -0
- package/dist/sdd/discovery/briefing.d.ts +109 -0
- package/dist/sdd/discovery/briefing.d.ts.map +1 -0
- package/dist/sdd/discovery/briefing.js +617 -0
- package/dist/sdd/discovery/briefing.js.map +1 -0
- package/dist/sdd/discovery/graph-builder.d.ts +10 -0
- package/dist/sdd/discovery/graph-builder.d.ts.map +1 -0
- package/dist/sdd/discovery/graph-builder.js +510 -0
- package/dist/sdd/discovery/graph-builder.js.map +1 -0
- package/dist/sdd/documentation/generator.d.ts +7 -0
- package/dist/sdd/documentation/generator.d.ts.map +1 -0
- package/dist/sdd/documentation/generator.js +119 -0
- package/dist/sdd/documentation/generator.js.map +1 -0
- package/dist/sdd/domain/types.d.ts +460 -0
- package/dist/sdd/domain/types.d.ts.map +1 -0
- package/dist/sdd/domain/types.js +25 -0
- package/dist/sdd/domain/types.js.map +1 -0
- package/dist/sdd/drift/detector.d.ts +28 -0
- package/dist/sdd/drift/detector.d.ts.map +1 -0
- package/dist/sdd/drift/detector.js +379 -0
- package/dist/sdd/drift/detector.js.map +1 -0
- package/dist/sdd/drift/exclusion.d.ts +54 -0
- package/dist/sdd/drift/exclusion.d.ts.map +1 -0
- package/dist/sdd/drift/exclusion.js +179 -0
- package/dist/sdd/drift/exclusion.js.map +1 -0
- package/dist/sdd/drift/signals.d.ts +52 -0
- package/dist/sdd/drift/signals.d.ts.map +1 -0
- package/dist/sdd/drift/signals.js +470 -0
- package/dist/sdd/drift/signals.js.map +1 -0
- package/dist/sdd/enforcement/interceptor.d.ts +47 -0
- package/dist/sdd/enforcement/interceptor.d.ts.map +1 -0
- package/dist/sdd/enforcement/interceptor.js +365 -0
- package/dist/sdd/enforcement/interceptor.js.map +1 -0
- package/dist/sdd/enforcement/workflow-tracker.d.ts +66 -0
- package/dist/sdd/enforcement/workflow-tracker.d.ts.map +1 -0
- package/dist/sdd/enforcement/workflow-tracker.js +229 -0
- package/dist/sdd/enforcement/workflow-tracker.js.map +1 -0
- package/dist/sdd/graph/engine.d.ts +44 -0
- package/dist/sdd/graph/engine.d.ts.map +1 -0
- package/dist/sdd/graph/engine.js +203 -0
- package/dist/sdd/graph/engine.js.map +1 -0
- package/dist/sdd/graph/index.d.ts +160 -0
- package/dist/sdd/graph/index.d.ts.map +1 -0
- package/dist/sdd/graph/index.js +624 -0
- package/dist/sdd/graph/index.js.map +1 -0
- package/dist/sdd/graph/integrity-guard.d.ts +129 -0
- package/dist/sdd/graph/integrity-guard.d.ts.map +1 -0
- package/dist/sdd/graph/integrity-guard.js +263 -0
- package/dist/sdd/graph/integrity-guard.js.map +1 -0
- package/dist/sdd/graph/integrity.d.ts +79 -0
- package/dist/sdd/graph/integrity.d.ts.map +1 -0
- package/dist/sdd/graph/integrity.js +462 -0
- package/dist/sdd/graph/integrity.js.map +1 -0
- package/dist/sdd/graph/pruner.d.ts +27 -0
- package/dist/sdd/graph/pruner.d.ts.map +1 -0
- package/dist/sdd/graph/pruner.js +203 -0
- package/dist/sdd/graph/pruner.js.map +1 -0
- package/dist/sdd/graph/traverse.d.ts +43 -0
- package/dist/sdd/graph/traverse.d.ts.map +1 -0
- package/dist/sdd/graph/traverse.js +265 -0
- package/dist/sdd/graph/traverse.js.map +1 -0
- package/dist/sdd/incidents/manager.d.ts +10 -0
- package/dist/sdd/incidents/manager.d.ts.map +1 -0
- package/dist/sdd/incidents/manager.js +63 -0
- package/dist/sdd/incidents/manager.js.map +1 -0
- package/dist/sdd/knowledge/transfer.d.ts +24 -0
- package/dist/sdd/knowledge/transfer.d.ts.map +1 -0
- package/dist/sdd/knowledge/transfer.js +94 -0
- package/dist/sdd/knowledge/transfer.js.map +1 -0
- package/dist/sdd/migrations/fixes.d.ts +2 -0
- package/dist/sdd/migrations/fixes.d.ts.map +1 -0
- package/dist/sdd/migrations/fixes.js +159 -0
- package/dist/sdd/migrations/fixes.js.map +1 -0
- package/dist/sdd/migrations/index.d.ts +2 -0
- package/dist/sdd/migrations/index.d.ts.map +1 -0
- package/dist/sdd/migrations/index.js +5 -0
- package/dist/sdd/migrations/index.js.map +1 -0
- package/dist/sdd/migrations/migration-runner.d.ts +41 -0
- package/dist/sdd/migrations/migration-runner.d.ts.map +1 -0
- package/dist/sdd/migrations/migration-runner.js +91 -0
- package/dist/sdd/migrations/migration-runner.js.map +1 -0
- package/dist/sdd/monitoring/setup.d.ts +40 -0
- package/dist/sdd/monitoring/setup.d.ts.map +1 -0
- package/dist/sdd/monitoring/setup.js +177 -0
- package/dist/sdd/monitoring/setup.js.map +1 -0
- package/dist/sdd/monitoring/telemetry.d.ts +18 -0
- package/dist/sdd/monitoring/telemetry.d.ts.map +1 -0
- package/dist/sdd/monitoring/telemetry.js +37 -0
- package/dist/sdd/monitoring/telemetry.js.map +1 -0
- package/dist/sdd/patterns/anti-patterns.d.ts +21 -0
- package/dist/sdd/patterns/anti-patterns.d.ts.map +1 -0
- package/dist/sdd/patterns/anti-patterns.js +286 -0
- package/dist/sdd/patterns/anti-patterns.js.map +1 -0
- package/dist/sdd/patterns/ast-clones.d.ts +23 -0
- package/dist/sdd/patterns/ast-clones.d.ts.map +1 -0
- package/dist/sdd/patterns/ast-clones.js +171 -0
- package/dist/sdd/patterns/ast-clones.js.map +1 -0
- package/dist/sdd/patterns/config-drift.d.ts +16 -0
- package/dist/sdd/patterns/config-drift.d.ts.map +1 -0
- package/dist/sdd/patterns/config-drift.js +322 -0
- package/dist/sdd/patterns/config-drift.js.map +1 -0
- package/dist/sdd/patterns/contradictions.d.ts +38 -0
- package/dist/sdd/patterns/contradictions.d.ts.map +1 -0
- package/dist/sdd/patterns/contradictions.js +237 -0
- package/dist/sdd/patterns/contradictions.js.map +1 -0
- package/dist/sdd/patterns/learner.d.ts +49 -0
- package/dist/sdd/patterns/learner.d.ts.map +1 -0
- package/dist/sdd/patterns/learner.js +226 -0
- package/dist/sdd/patterns/learner.js.map +1 -0
- package/dist/sdd/permissions/access.d.ts +69 -0
- package/dist/sdd/permissions/access.d.ts.map +1 -0
- package/dist/sdd/permissions/access.js +333 -0
- package/dist/sdd/permissions/access.js.map +1 -0
- package/dist/sdd/persistence/repository.d.ts +60 -0
- package/dist/sdd/persistence/repository.d.ts.map +1 -0
- package/dist/sdd/persistence/repository.js +96 -0
- package/dist/sdd/persistence/repository.js.map +1 -0
- package/dist/sdd/persistence/sqlite.d.ts +122 -0
- package/dist/sdd/persistence/sqlite.d.ts.map +1 -0
- package/dist/sdd/persistence/sqlite.js +602 -0
- package/dist/sdd/persistence/sqlite.js.map +1 -0
- package/dist/sdd/persistence/yaml.d.ts +41 -0
- package/dist/sdd/persistence/yaml.d.ts.map +1 -0
- package/dist/sdd/persistence/yaml.js +382 -0
- package/dist/sdd/persistence/yaml.js.map +1 -0
- package/dist/sdd/promises/classifier.d.ts +48 -0
- package/dist/sdd/promises/classifier.d.ts.map +1 -0
- package/dist/sdd/promises/classifier.js +215 -0
- package/dist/sdd/promises/classifier.js.map +1 -0
- package/dist/sdd/promises/tracker.d.ts +20 -0
- package/dist/sdd/promises/tracker.d.ts.map +1 -0
- package/dist/sdd/promises/tracker.js +204 -0
- package/dist/sdd/promises/tracker.js.map +1 -0
- package/dist/sdd/quality/scorer.d.ts +44 -0
- package/dist/sdd/quality/scorer.d.ts.map +1 -0
- package/dist/sdd/quality/scorer.js +216 -0
- package/dist/sdd/quality/scorer.js.map +1 -0
- package/dist/sdd/rollback/manager.d.ts +45 -0
- package/dist/sdd/rollback/manager.d.ts.map +1 -0
- package/dist/sdd/rollback/manager.js +266 -0
- package/dist/sdd/rollback/manager.js.map +1 -0
- package/dist/sdd/session/handoff.d.ts +52 -0
- package/dist/sdd/session/handoff.d.ts.map +1 -0
- package/dist/sdd/session/handoff.js +264 -0
- package/dist/sdd/session/handoff.js.map +1 -0
- package/dist/sdd/sla/tracker.d.ts +11 -0
- package/dist/sdd/sla/tracker.d.ts.map +1 -0
- package/dist/sdd/sla/tracker.js +52 -0
- package/dist/sdd/sla/tracker.js.map +1 -0
- package/dist/sdd/sync/git-sync.d.ts +61 -0
- package/dist/sdd/sync/git-sync.d.ts.map +1 -0
- package/dist/sdd/sync/git-sync.js +297 -0
- package/dist/sdd/sync/git-sync.js.map +1 -0
- package/dist/sdd/toggle/state.d.ts +8 -0
- package/dist/sdd/toggle/state.d.ts.map +1 -0
- package/dist/sdd/toggle/state.js +32 -0
- package/dist/sdd/toggle/state.js.map +1 -0
- package/dist/sdd/transactions/manager.d.ts +12 -0
- package/dist/sdd/transactions/manager.d.ts.map +1 -0
- package/dist/sdd/transactions/manager.js +80 -0
- package/dist/sdd/transactions/manager.js.map +1 -0
- package/dist/sdd/validation/coverage-index.d.ts +117 -0
- package/dist/sdd/validation/coverage-index.d.ts.map +1 -0
- package/dist/sdd/validation/coverage-index.js +251 -0
- package/dist/sdd/validation/coverage-index.js.map +1 -0
- package/dist/sdd/validation/executable.d.ts +26 -0
- package/dist/sdd/validation/executable.d.ts.map +1 -0
- package/dist/sdd/validation/executable.js +122 -0
- package/dist/sdd/validation/executable.js.map +1 -0
- package/dist/sdd/validation/smart-validator.d.ts +53 -0
- package/dist/sdd/validation/smart-validator.d.ts.map +1 -0
- package/dist/sdd/validation/smart-validator.js +347 -0
- package/dist/sdd/validation/smart-validator.js.map +1 -0
- package/dist/sdd/validation/validator.d.ts +39 -0
- package/dist/sdd/validation/validator.d.ts.map +1 -0
- package/dist/sdd/validation/validator.js +512 -0
- package/dist/sdd/validation/validator.js.map +1 -0
- package/dist/sdd/workflow/exporter.d.ts +36 -0
- package/dist/sdd/workflow/exporter.d.ts.map +1 -0
- package/dist/sdd/workflow/exporter.js +112 -0
- package/dist/sdd/workflow/exporter.js.map +1 -0
- package/dist/sdd/workflows/ab-testing.d.ts +18 -0
- package/dist/sdd/workflows/ab-testing.d.ts.map +1 -0
- package/dist/sdd/workflows/ab-testing.js +67 -0
- package/dist/sdd/workflows/ab-testing.js.map +1 -0
- package/dist/sdd/workflows/bug-fix.d.ts +13 -0
- package/dist/sdd/workflows/bug-fix.d.ts.map +1 -0
- package/dist/sdd/workflows/bug-fix.js +65 -0
- package/dist/sdd/workflows/bug-fix.js.map +1 -0
- package/dist/sdd/workflows/data-migration.d.ts +14 -0
- package/dist/sdd/workflows/data-migration.d.ts.map +1 -0
- package/dist/sdd/workflows/data-migration.js +68 -0
- package/dist/sdd/workflows/data-migration.js.map +1 -0
- package/dist/sdd/workflows/deprecation.d.ts +15 -0
- package/dist/sdd/workflows/deprecation.d.ts.map +1 -0
- package/dist/sdd/workflows/deprecation.js +68 -0
- package/dist/sdd/workflows/deprecation.js.map +1 -0
- package/dist/sdd/workflows/feature-flags.d.ts +14 -0
- package/dist/sdd/workflows/feature-flags.d.ts.map +1 -0
- package/dist/sdd/workflows/feature-flags.js +73 -0
- package/dist/sdd/workflows/feature-flags.js.map +1 -0
- package/dist/sdd/workflows/hotfix.d.ts +13 -0
- package/dist/sdd/workflows/hotfix.d.ts.map +1 -0
- package/dist/sdd/workflows/hotfix.js +67 -0
- package/dist/sdd/workflows/hotfix.js.map +1 -0
- package/dist/sdd/workflows/multi-tenancy.d.ts +13 -0
- package/dist/sdd/workflows/multi-tenancy.d.ts.map +1 -0
- package/dist/sdd/workflows/multi-tenancy.js +68 -0
- package/dist/sdd/workflows/multi-tenancy.js.map +1 -0
- package/dist/sdd/workflows/onboarding.d.ts +7 -0
- package/dist/sdd/workflows/onboarding.d.ts.map +1 -0
- package/dist/sdd/workflows/onboarding.js +43 -0
- package/dist/sdd/workflows/onboarding.js.map +1 -0
- package/dist/sdd/workflows/refactoring.d.ts +14 -0
- package/dist/sdd/workflows/refactoring.d.ts.map +1 -0
- package/dist/sdd/workflows/refactoring.js +73 -0
- package/dist/sdd/workflows/refactoring.js.map +1 -0
- package/dist/server/events.d.ts +64 -0
- package/dist/server/events.d.ts.map +1 -0
- package/dist/server/events.js +149 -0
- package/dist/server/events.js.map +1 -0
- package/dist/server/server.d.ts +33 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +1019 -0
- package/dist/server/server.js.map +1 -0
- package/marketplace.json +39 -0
- package/package.json +65 -0
- package/src/code-intelligence/analyzer.ts +350 -0
- package/src/code-intelligence/ast/cache.ts +61 -0
- package/src/code-intelligence/ast/common.ts +62 -0
- package/src/code-intelligence/ast/component.ts +39 -0
- package/src/code-intelligence/ast/fallback.ts +44 -0
- package/src/code-intelligence/ast/index.ts +4 -0
- package/src/code-intelligence/ast/ir.ts +91 -0
- package/src/code-intelligence/ast/metrics.ts +65 -0
- package/src/code-intelligence/ast/registry.ts +28 -0
- package/src/code-intelligence/ast/tree-sitter.ts +226 -0
- package/src/code-intelligence/ast/typescript.ts +140 -0
- package/src/index.ts +22 -0
- package/src/mcp/server.ts +77 -0
- package/src/opencode/hooks.ts +728 -0
- package/src/opencode/router/categories.ts +192 -0
- package/src/opencode/router/embeddings.ts +149 -0
- package/src/opencode/router/graph-state-snapshot.ts +163 -0
- package/src/opencode/router/index.ts +44 -0
- package/src/opencode/router/intent-classifier.ts +140 -0
- package/src/opencode/router/semantic-nudge.ts +89 -0
- package/src/opencode/router/state-gate.ts +192 -0
- package/src/opencode/router/tool-embeddings.ts +162 -0
- package/src/opencode/router/tool-registry.ts +135 -0
- package/src/opencode/router/tool-taxonomy.ts +284 -0
- package/src/opencode/router/tools-composite.ts +685 -0
- package/src/opencode/shell-hooks.ts +115 -0
- package/src/opencode/system-prompt.ts +617 -0
- package/src/opencode/tools.ts +4102 -0
- package/src/opencode/workflows/chains.ts +205 -0
- package/src/opencode/workflows/executor.ts +172 -0
- package/src/opencode/workflows/index.ts +21 -0
- package/src/opencode/workflows/tools-workflow.ts +91 -0
- package/src/opencode/workflows/types.ts +42 -0
- package/src/sdd/analysis/compliance.ts +279 -0
- package/src/sdd/analysis/scalability.ts +97 -0
- package/src/sdd/analysis/security.ts +135 -0
- package/src/sdd/brownfield/scanner.ts +276 -0
- package/src/sdd/cache/manager.ts +899 -0
- package/src/sdd/cache/snapshot-store.ts +185 -0
- package/src/sdd/changes/manager.ts +326 -0
- package/src/sdd/cicd/generators.ts +1095 -0
- package/src/sdd/code-quality/complexity.ts +235 -0
- package/src/sdd/code-quality/conventions.ts +220 -0
- package/src/sdd/code-quality/dependencies.ts +203 -0
- package/src/sdd/code-quality/import-analyzer.ts +294 -0
- package/src/sdd/code-quality/metrics.ts +232 -0
- package/src/sdd/code-quality/smells.ts +415 -0
- package/src/sdd/code-quality/symbol-parser.ts +335 -0
- package/src/sdd/code-quality/usage-tracker.ts +527 -0
- package/src/sdd/code-quality/utils.ts +13 -0
- package/src/sdd/codegen/generator.ts +1181 -0
- package/src/sdd/constitution/validator.ts +253 -0
- package/src/sdd/cost/estimator.ts +147 -0
- package/src/sdd/coverage/tracker.ts +342 -0
- package/src/sdd/disaster/recovery.ts +79 -0
- package/src/sdd/discovery/adaptive.ts +167 -0
- package/src/sdd/discovery/briefing-analyzer.ts +802 -0
- package/src/sdd/discovery/briefing.ts +770 -0
- package/src/sdd/discovery/graph-builder.ts +598 -0
- package/src/sdd/documentation/generator.ts +158 -0
- package/src/sdd/domain/types.ts +658 -0
- package/src/sdd/drift/detector.ts +465 -0
- package/src/sdd/drift/exclusion.ts +223 -0
- package/src/sdd/drift/signals.ts +577 -0
- package/src/sdd/enforcement/interceptor.ts +444 -0
- package/src/sdd/enforcement/workflow-tracker.ts +263 -0
- package/src/sdd/graph/engine.ts +277 -0
- package/src/sdd/graph/index.ts +700 -0
- package/src/sdd/graph/integrity-guard.ts +348 -0
- package/src/sdd/graph/integrity.ts +628 -0
- package/src/sdd/graph/pruner.ts +221 -0
- package/src/sdd/graph/traverse.ts +331 -0
- package/src/sdd/incidents/manager.ts +87 -0
- package/src/sdd/knowledge/transfer.ts +140 -0
- package/src/sdd/migrations/fixes.ts +154 -0
- package/src/sdd/migrations/index.ts +14 -0
- package/src/sdd/migrations/migration-runner.ts +118 -0
- package/src/sdd/monitoring/setup.ts +237 -0
- package/src/sdd/monitoring/telemetry.ts +44 -0
- package/src/sdd/patterns/anti-patterns.ts +333 -0
- package/src/sdd/patterns/ast-clones.ts +214 -0
- package/src/sdd/patterns/config-drift.ts +346 -0
- package/src/sdd/patterns/contradictions.ts +323 -0
- package/src/sdd/patterns/learner.ts +266 -0
- package/src/sdd/permissions/access.ts +478 -0
- package/src/sdd/persistence/repository.ts +166 -0
- package/src/sdd/persistence/sqlite.ts +703 -0
- package/src/sdd/persistence/yaml.ts +409 -0
- package/src/sdd/promises/classifier.ts +253 -0
- package/src/sdd/promises/tracker.ts +258 -0
- package/src/sdd/quality/scorer.ts +263 -0
- package/src/sdd/rollback/manager.ts +361 -0
- package/src/sdd/session/handoff.ts +354 -0
- package/src/sdd/sla/tracker.ts +68 -0
- package/src/sdd/sync/git-sync.ts +401 -0
- package/src/sdd/toggle/state.ts +38 -0
- package/src/sdd/transactions/manager.ts +93 -0
- package/src/sdd/validation/coverage-index.ts +339 -0
- package/src/sdd/validation/executable.ts +127 -0
- package/src/sdd/validation/smart-validator.ts +470 -0
- package/src/sdd/validation/validator.ts +641 -0
- package/src/sdd/workflow/exporter.ts +169 -0
- package/src/sdd/workflows/ab-testing.ts +90 -0
- package/src/sdd/workflows/bug-fix.ts +81 -0
- package/src/sdd/workflows/data-migration.ts +86 -0
- package/src/sdd/workflows/deprecation.ts +87 -0
- package/src/sdd/workflows/feature-flags.ts +91 -0
- package/src/sdd/workflows/hotfix.ts +83 -0
- package/src/sdd/workflows/multi-tenancy.ts +84 -0
- package/src/sdd/workflows/onboarding.ts +82 -0
- package/src/sdd/workflows/refactoring.ts +90 -0
- package/src/server/events.ts +184 -0
- package/src/server/server.ts +1088 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic Nudge — Sugestões locais por relevância lexical determinística.
|
|
3
|
+
*
|
|
4
|
+
* Calcula relevância BM25 entre o input do usuário e as tool descriptions.
|
|
5
|
+
* Injeta hints no input do LLM com as tools mais relevantes.
|
|
6
|
+
*
|
|
7
|
+
* Consumido por: hooks.ts (chat.message hook)
|
|
8
|
+
* Dependências: embeddings.ts, tool-embeddings.ts, categories.ts
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { rankSimilarity } from "./embeddings.js"
|
|
12
|
+
import { getCachedToolEmbeddings } from "./tool-embeddings.js"
|
|
13
|
+
|
|
14
|
+
export interface NudgeResult {
|
|
15
|
+
/** Hints formatados para injetar no input */
|
|
16
|
+
hints: string[]
|
|
17
|
+
/** Tools sugeridas com confidence */
|
|
18
|
+
suggestions: Array<{ tool: string; confidence: number }>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Minimum lexical relevance for a suggestion. BM25 scores are unbounded. */
|
|
22
|
+
const CONFIDENCE_THRESHOLD = 0.35
|
|
23
|
+
|
|
24
|
+
/** Máximo de sugestões */
|
|
25
|
+
const MAX_SUGGESTIONS = 3
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Calcula nudges semânticos para o input do usuário.
|
|
29
|
+
*
|
|
30
|
+
* @param userInput - Texto do input do usuário
|
|
31
|
+
* @returns NudgeResult com hints e sugestões
|
|
32
|
+
*/
|
|
33
|
+
export function calculateSemanticNudge(userInput: string): NudgeResult {
|
|
34
|
+
const toolEmbeddings = getCachedToolEmbeddings()
|
|
35
|
+
const topLevelTools = toolEmbeddings.filter((tool) => !tool.name.includes(":"))
|
|
36
|
+
const ranked = rankSimilarity(userInput, topLevelTools.map((tool) => ({
|
|
37
|
+
label: tool.name,
|
|
38
|
+
text: `${tool.name} ${tool.description}`,
|
|
39
|
+
})))
|
|
40
|
+
const byName = new Map(topLevelTools.map((tool) => [tool.name, tool]))
|
|
41
|
+
const scores = ranked
|
|
42
|
+
.filter((item) => item.score >= CONFIDENCE_THRESHOLD)
|
|
43
|
+
.map((item) => ({ tool: byName.get(item.label)!, score: item.score }))
|
|
44
|
+
|
|
45
|
+
// Ordenar por score e pegar top-N
|
|
46
|
+
scores.sort((a, b) => b.score - a.score)
|
|
47
|
+
const topScores = scores.slice(0, MAX_SUGGESTIONS)
|
|
48
|
+
|
|
49
|
+
// Gerar hints
|
|
50
|
+
const hints: string[] = []
|
|
51
|
+
const suggestions: Array<{ tool: string; confidence: number }> = []
|
|
52
|
+
|
|
53
|
+
if (topScores.length > 0) {
|
|
54
|
+
hints.push("[SDD Tools Sugeridas]")
|
|
55
|
+
for (const { tool, score } of topScores) {
|
|
56
|
+
const confidencePct = Math.round(score * 100)
|
|
57
|
+
hints.push(`- ${tool.name} (${confidencePct}%): ${tool.description}`)
|
|
58
|
+
suggestions.push({ tool: tool.name, confidence: score })
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return { hints, suggestions }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Gera a string de nudge para injetar no input do LLM.
|
|
67
|
+
* Retorna string vazia se não houver nudges relevantes.
|
|
68
|
+
*/
|
|
69
|
+
export function formatNudgeInput(userInput: string): string {
|
|
70
|
+
const result = calculateSemanticNudge(userInput)
|
|
71
|
+
if (result.hints.length === 0) return ""
|
|
72
|
+
return result.hints.join("\n")
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Verifica se uma tool específica é sugerida pelo nudge.
|
|
77
|
+
*/
|
|
78
|
+
export function isToolSuggested(userInput: string, toolName: string): boolean {
|
|
79
|
+
const result = calculateSemanticNudge(userInput)
|
|
80
|
+
return result.suggestions.some(s => s.tool === toolName)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Obtém a tool mais sugerida para o input.
|
|
85
|
+
*/
|
|
86
|
+
export function getTopSuggestion(userInput: string): { tool: string; confidence: number } | null {
|
|
87
|
+
const result = calculateSemanticNudge(userInput)
|
|
88
|
+
return result.suggestions[0] || null
|
|
89
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State Gate — Determina quais tools são visíveis para cada estado do grafo.
|
|
3
|
+
*
|
|
4
|
+
* Reduz o espaço de escolha do LLM mostrando apenas tools relevantes.
|
|
5
|
+
* Fallback: se o resultado for vazio, mostra todas as tools.
|
|
6
|
+
*
|
|
7
|
+
* Consumido por: hooks.ts (experimental.chat.system.transform)
|
|
8
|
+
* Dependências: graph-state-snapshot.ts, tool-taxonomy.ts
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { getGraphSnapshot, type GraphState, type GraphSnapshot } from "./graph-state-snapshot.js"
|
|
12
|
+
import { STANDALONE_TOOLS, TOOL_TAXONOMY, type ToolCategory } from "./tool-taxonomy.js"
|
|
13
|
+
|
|
14
|
+
/** Tools que são sempre visíveis (essenciais) */
|
|
15
|
+
const ALWAYS_VISIBLE = new Set([
|
|
16
|
+
"sdd.inspect",
|
|
17
|
+
"sdd.query_graph",
|
|
18
|
+
"sdd.validate",
|
|
19
|
+
"sdd.detect_drift",
|
|
20
|
+
"sdd.get_context",
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
/** Tools de composits que são sempre visíveis */
|
|
24
|
+
const ALWAYS_VISIBLE_COMPOSITES = new Set([
|
|
25
|
+
"sdd.graph_query",
|
|
26
|
+
"sdd.graph_mutation",
|
|
27
|
+
"sdd.traverse",
|
|
28
|
+
])
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Mapeamento de estado → tools composits visíveis.
|
|
32
|
+
* Keys são subconjuntos de GraphState.
|
|
33
|
+
*/
|
|
34
|
+
const STATE_TOOLS: Record<GraphState, { composite: string[]; standalone: string[] }> = {
|
|
35
|
+
uninitialized: {
|
|
36
|
+
composite: [],
|
|
37
|
+
standalone: ["sdd.initialize", "sdd.build_graph", "sdd.discover"],
|
|
38
|
+
},
|
|
39
|
+
empty: {
|
|
40
|
+
composite: ["sdd.graph_mutation"],
|
|
41
|
+
standalone: ["sdd.build_graph", "sdd.discover", "sdd.inspect"],
|
|
42
|
+
},
|
|
43
|
+
partial: {
|
|
44
|
+
composite: ["sdd.graph_mutation", "sdd.graph_query"],
|
|
45
|
+
standalone: [
|
|
46
|
+
"sdd.discover", "sdd.update_from_answers", "sdd.inspect",
|
|
47
|
+
"sdd.build_graph", "sdd.enforce",
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
ready: {
|
|
51
|
+
composite: [
|
|
52
|
+
"sdd.graph_mutation", "sdd.graph_query", "sdd.traverse",
|
|
53
|
+
"sdd.code_quality", "sdd.graph_admin",
|
|
54
|
+
],
|
|
55
|
+
standalone: [
|
|
56
|
+
"sdd.enforce", "sdd.build_graph", "sdd.discover",
|
|
57
|
+
"sdd.pending_changes", "sdd.change_history",
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
has_change: {
|
|
61
|
+
composite: [
|
|
62
|
+
"sdd.graph_mutation", "sdd.graph_query", "sdd.traverse",
|
|
63
|
+
"sdd.code_quality", "sdd.graph_admin", "sdd.permissions",
|
|
64
|
+
],
|
|
65
|
+
standalone: [
|
|
66
|
+
"sdd.enforce", "sdd.approve_change", "sdd.update_from_answers",
|
|
67
|
+
"sdd.pending_changes", "sdd.change_history", "sdd.impact_report",
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
has_approved_change: {
|
|
71
|
+
composite: [
|
|
72
|
+
"sdd.graph_mutation", "sdd.graph_query", "sdd.traverse",
|
|
73
|
+
"sdd.code_quality", "sdd.graph_admin", "sdd.permissions",
|
|
74
|
+
"sdd.snapshot", "sdd.sync",
|
|
75
|
+
],
|
|
76
|
+
standalone: [
|
|
77
|
+
"sdd.generate_code", "sdd.complete_change", "sdd.fail_change",
|
|
78
|
+
"sdd.validate", "sdd.detect_drift",
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
emergency: {
|
|
82
|
+
composite: [
|
|
83
|
+
"sdd.graph_mutation", "sdd.graph_query", "sdd.traverse",
|
|
84
|
+
"sdd.snapshot",
|
|
85
|
+
],
|
|
86
|
+
standalone: [
|
|
87
|
+
"sdd.hotfix", "sdd.validate", "sdd.complete_change",
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Categorias de tools que ficam ocultas em certos estados.
|
|
94
|
+
*/
|
|
95
|
+
const CATEGORY_HIDDEN: Record<GraphState, ToolCategory[]> = {
|
|
96
|
+
uninitialized: ["quality", "sync", "enterprise", "admin"],
|
|
97
|
+
empty: ["quality", "sync", "enterprise"],
|
|
98
|
+
partial: ["sync", "enterprise"],
|
|
99
|
+
ready: ["sync"],
|
|
100
|
+
has_change: [],
|
|
101
|
+
has_approved_change: [],
|
|
102
|
+
emergency: ["quality", "sync", "enterprise"],
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Obtém as tools visíveis para o estado atual do grafo.
|
|
107
|
+
*
|
|
108
|
+
* @param directory - Diretório do projeto
|
|
109
|
+
* @returns Set de nomes de tools visíveis. Se vazio (fallback), retorna null para indicar "todas".
|
|
110
|
+
*/
|
|
111
|
+
export function getVisibleTools(directory: string): Set<string> | null {
|
|
112
|
+
const snapshot = getGraphSnapshot(directory)
|
|
113
|
+
const stateConfig = STATE_TOOLS[snapshot.state]
|
|
114
|
+
const hiddenCategories = CATEGORY_HIDDEN[snapshot.state] || []
|
|
115
|
+
|
|
116
|
+
const visible = new Set<string>()
|
|
117
|
+
|
|
118
|
+
// Adicionar sempre-visíveis
|
|
119
|
+
for (const t of ALWAYS_VISIBLE) visible.add(t)
|
|
120
|
+
for (const t of ALWAYS_VISIBLE_COMPOSITES) visible.add(t)
|
|
121
|
+
|
|
122
|
+
// Adicionar tools do estado
|
|
123
|
+
for (const t of stateConfig.standalone) visible.add(t)
|
|
124
|
+
for (const t of stateConfig.composite) visible.add(t)
|
|
125
|
+
|
|
126
|
+
// Adicionar composits de categories não-ocultas
|
|
127
|
+
for (const tool of TOOL_TAXONOMY) {
|
|
128
|
+
if (!hiddenCategories.includes(tool.category)) {
|
|
129
|
+
visible.add(tool.name)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Se o resultado é muito pequeno (< 5 tools), retornar null (fallback: todas)
|
|
134
|
+
if (visible.size < 5) {
|
|
135
|
+
return null
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return visible
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Formata a lista de tools visíveis para injeção no system prompt.
|
|
143
|
+
*/
|
|
144
|
+
export function formatVisibleTools(visibleTools: Set<string> | null): string {
|
|
145
|
+
if (!visibleTools) {
|
|
146
|
+
return "[Todas as tools SDD disponíveis]"
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const lines = ["## Tools SDD Disponíveis para Este Estado\n"]
|
|
150
|
+
|
|
151
|
+
// Agrupar por tipo
|
|
152
|
+
const standalone: string[] = []
|
|
153
|
+
const composite: string[] = []
|
|
154
|
+
|
|
155
|
+
for (const name of visibleTools) {
|
|
156
|
+
if (TOOL_TAXONOMY.find(t => t.name === name)) {
|
|
157
|
+
composite.push(name)
|
|
158
|
+
} else {
|
|
159
|
+
standalone.push(name)
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (standalone.length > 0) {
|
|
164
|
+
lines.push("### Tools Individuais")
|
|
165
|
+
for (const t of standalone.sort()) {
|
|
166
|
+
lines.push(`- \`${t}\``)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (composite.length > 0) {
|
|
171
|
+
lines.push("\n### Tools Compositas (use action= para sub-comando)")
|
|
172
|
+
for (const t of composite.sort()) {
|
|
173
|
+
const tool = TOOL_TAXONOMY.find(tc => tc.name === t)
|
|
174
|
+
if (tool) {
|
|
175
|
+
const actions = tool.actions.map(a => a.name).join(", ")
|
|
176
|
+
lines.push(`- \`${t}\` → [${actions}]`)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return lines.join("\n")
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Escape hatch: instrução para o LLM mostrar todas as tools se necessário.
|
|
186
|
+
*/
|
|
187
|
+
export const ESCAPE_HATCH_INSTRUCTION = `
|
|
188
|
+
### Tools SDD Não Listadas?
|
|
189
|
+
Se precisar de uma tool que não está na lista acima, você pode:
|
|
190
|
+
1. Usar a tool original diretamente (todas ainda existem)
|
|
191
|
+
2. Pedir ao usuário para usar \`/sdd status\` para ver todas as tools disponíveis
|
|
192
|
+
`.trim()
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool catalog — Descriptions cacheadas para todas as tools SDD.
|
|
3
|
+
*
|
|
4
|
+
* Mantém o catálogo usado pelo roteamento lexical. O campo embedding é
|
|
5
|
+
* preservado por compatibilidade com consumidores antigos.
|
|
6
|
+
*
|
|
7
|
+
* Consumido por: semantic-nudge.ts
|
|
8
|
+
* Dependências: embeddings.ts, tool-taxonomy.ts
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { getEmbedding } from "./embeddings.js"
|
|
12
|
+
import { TOOL_TAXONOMY, STANDALONE_TOOLS } from "./tool-taxonomy.js"
|
|
13
|
+
|
|
14
|
+
export interface ToolEmbedding {
|
|
15
|
+
name: string
|
|
16
|
+
description: string
|
|
17
|
+
embedding: number[]
|
|
18
|
+
category: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Descriptions das tools standalone (nomes → descriptions representativas).
|
|
23
|
+
* Em produção, extrair das ToolDefinitions reais.
|
|
24
|
+
*/
|
|
25
|
+
const STANDALONE_DESCRIPTIONS: Record<string, string> = {
|
|
26
|
+
"sdd.initialize": "Initialize the SDD Knowledge Graph for a project",
|
|
27
|
+
"sdd.inspect": "Inspect the current state of the SDD Knowledge Graph stats",
|
|
28
|
+
"sdd.query_graph": "Query the SDD Knowledge Graph search for nodes",
|
|
29
|
+
"sdd.analyze_impact": "Perform impact analysis for a change request traverse graph",
|
|
30
|
+
"sdd.create_change": "Create a Change node in the SDD Knowledge Graph",
|
|
31
|
+
"sdd.discover": "Analyze a user briefing and return discovery questions",
|
|
32
|
+
"sdd.update_from_answers": "Update the Knowledge Graph based on user answers",
|
|
33
|
+
"sdd.validate": "Validate the SDD Knowledge Graph for structural integrity",
|
|
34
|
+
"sdd.detect_drift": "Detect SDD drift discrepancies between specification and codebase",
|
|
35
|
+
"sdd.get_context": "Build a context pack for a specific node",
|
|
36
|
+
"sdd.approve_change": "Approve a pending change in the SDD graph",
|
|
37
|
+
"sdd.complete_change": "Mark a change as completed check pending promises",
|
|
38
|
+
"sdd.fail_change": "Mark a change as FAILED with a reason",
|
|
39
|
+
"sdd.change_history": "View the full history of all changes in the SDD graph",
|
|
40
|
+
"sdd.impact_report": "Generate a detailed impact report for a specific change",
|
|
41
|
+
"sdd.pending_changes": "List all pending changes in the SDD graph",
|
|
42
|
+
"sdd.generate_code": "Generate project code from the SDD Knowledge Graph",
|
|
43
|
+
"sdd.enforce": "Classify a change request and create a Change node",
|
|
44
|
+
"sdd.enforce_rules": "Show the current SDD enforcement rules",
|
|
45
|
+
"sdd.full_cycle": "Run the complete SDD workflow cycle from enforcement to completion",
|
|
46
|
+
"sdd.toggle": "Toggle SDD enforcement on or off",
|
|
47
|
+
"sdd.constitution": "Manage the project constitution principles",
|
|
48
|
+
"sdd.promises": "Manage promises and commitments in the SDD graph",
|
|
49
|
+
"sdd.quality": "Calculate quality score for the SDD graph",
|
|
50
|
+
"sdd.session_handoff": "Generate a session handoff pack for context continuity",
|
|
51
|
+
"sdd.anti_patterns": "Detect anti-patterns in the SDD graph",
|
|
52
|
+
"sdd.clone_detection": "Detect near-duplicate nodes and AST clones",
|
|
53
|
+
"sdd.contradictions": "Detect contradictions in the SDD graph",
|
|
54
|
+
"sdd.coverage": "Calculate test coverage for requirements",
|
|
55
|
+
"sdd.install_hooks": "Install git hooks for SDD enforcement",
|
|
56
|
+
"sdd.brownfield_scan": "Scan existing project and create SDD nodes for brownfield",
|
|
57
|
+
"sdd.generate_cicd": "Generate CI/CD pipeline configuration from SDD graph",
|
|
58
|
+
"sdd.bug_fix": "Automated bug fix workflow through SDD",
|
|
59
|
+
"sdd.hotfix": "Emergency hotfix workflow bypassing normal enforcement",
|
|
60
|
+
"sdd.refactoring": "Safe refactoring workflow with test validation",
|
|
61
|
+
"sdd.deprecate": "Deprecation workflow with migration guide",
|
|
62
|
+
"sdd.toggle_status": "Show current SDD toggle status",
|
|
63
|
+
"sdd.drift_signals": "Detect advanced drift signals mutant duplicates architecture violations",
|
|
64
|
+
"sdd.build_graph": "Build the entire Knowledge Graph from a project briefing",
|
|
65
|
+
"sdd.auto_link_tests": "Automatically link orphan tests to requirements",
|
|
66
|
+
"sdd.migrate_storage": "Migrate SDD storage between YAML and SQLite backends",
|
|
67
|
+
"sdd.start_dashboard": "Start the SDD dashboard server",
|
|
68
|
+
"sdd.mcp_server_info": "Show MCP server information and capabilities",
|
|
69
|
+
"sdd.handle_mcp_tool": "Handle an MCP tool call from an external client",
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Gera embeddings para todas as tools (standalone + composite).
|
|
74
|
+
*/
|
|
75
|
+
export function generateAllToolEmbeddings(): ToolEmbedding[] {
|
|
76
|
+
const embeddings: ToolEmbedding[] = []
|
|
77
|
+
|
|
78
|
+
// Standalone tools
|
|
79
|
+
for (const name of STANDALONE_TOOLS) {
|
|
80
|
+
const description = STANDALONE_DESCRIPTIONS[name] || `SDD tool: ${name}`
|
|
81
|
+
embeddings.push({
|
|
82
|
+
name,
|
|
83
|
+
description,
|
|
84
|
+
embedding: getEmbedding(description),
|
|
85
|
+
category: "standalone",
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Composite tools
|
|
90
|
+
for (const tool of TOOL_TAXONOMY) {
|
|
91
|
+
embeddings.push({
|
|
92
|
+
name: tool.name,
|
|
93
|
+
description: tool.description,
|
|
94
|
+
embedding: getEmbedding(tool.description),
|
|
95
|
+
category: tool.category,
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
// Sub-actions também ganham embeddings
|
|
99
|
+
for (const action of tool.actions) {
|
|
100
|
+
embeddings.push({
|
|
101
|
+
name: `${tool.name}:${action.name}`,
|
|
102
|
+
description: `${action.description} (${tool.label})`,
|
|
103
|
+
embedding: getEmbedding(action.description),
|
|
104
|
+
category: tool.category,
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return embeddings
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Cache global de embeddings.
|
|
114
|
+
*/
|
|
115
|
+
let cachedEmbeddings: ToolEmbedding[] | null = null
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Obtém embeddings com cache.
|
|
119
|
+
*/
|
|
120
|
+
export function getCachedToolEmbeddings(): ToolEmbedding[] {
|
|
121
|
+
if (!cachedEmbeddings) {
|
|
122
|
+
cachedEmbeddings = generateAllToolEmbeddings()
|
|
123
|
+
}
|
|
124
|
+
return cachedEmbeddings
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Força regeneração do cache.
|
|
129
|
+
*/
|
|
130
|
+
export function refreshToolEmbeddings(): ToolEmbedding[] {
|
|
131
|
+
cachedEmbeddings = generateAllToolEmbeddings()
|
|
132
|
+
return cachedEmbeddings
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Serializa embeddings para JSON (para persistência).
|
|
137
|
+
*/
|
|
138
|
+
export function serializeEmbeddings(embeddings: ToolEmbedding[]): string {
|
|
139
|
+
return JSON.stringify(
|
|
140
|
+
embeddings.map(e => ({
|
|
141
|
+
n: e.name,
|
|
142
|
+
d: e.description,
|
|
143
|
+
e: e.embedding,
|
|
144
|
+
c: e.category,
|
|
145
|
+
})),
|
|
146
|
+
null,
|
|
147
|
+
2,
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Desserializa embeddings de JSON.
|
|
153
|
+
*/
|
|
154
|
+
export function deserializeEmbeddings(json: string): ToolEmbedding[] {
|
|
155
|
+
const data = JSON.parse(json)
|
|
156
|
+
return data.map((e: any) => ({
|
|
157
|
+
name: e.n,
|
|
158
|
+
description: e.d,
|
|
159
|
+
embedding: e.e,
|
|
160
|
+
category: e.c,
|
|
161
|
+
}))
|
|
162
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Registry — Registry central de tools SDD.
|
|
3
|
+
*
|
|
4
|
+
* Mantém a lista completa de tools, filtra por estado (state gate)
|
|
5
|
+
* e intenção (intent classifier), e fornece o conjunto final para o LLM.
|
|
6
|
+
*
|
|
7
|
+
* Consumido por: hooks.ts (experimental.chat.system.transform)
|
|
8
|
+
* Dependências: state-gate.ts, intent-classifier.ts, tool-taxonomy.ts
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { getVisibleTools, formatVisibleTools, ESCAPE_HATCH_INSTRUCTION } from "./state-gate.js"
|
|
12
|
+
import { classifyIntent, getToolsForIntent, type IntentResult } from "./intent-classifier.js"
|
|
13
|
+
import { TOOL_TAXONOMY, STANDALONE_TOOLS, type CompositeTool } from "./tool-taxonomy.js"
|
|
14
|
+
|
|
15
|
+
export interface ToolRegistryResult {
|
|
16
|
+
/** Tools finais selecionadas para o LLM */
|
|
17
|
+
tools: string[]
|
|
18
|
+
/** Resultado da classificação de intenção */
|
|
19
|
+
intent: IntentResult
|
|
20
|
+
/** Se null, todas as tools estão disponíveis (fallback) */
|
|
21
|
+
stateTools: Set<string> | null
|
|
22
|
+
/** Mensagem formatada para injeção no system prompt */
|
|
23
|
+
formattedMessage: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Obtém o conjunto final de tools para o LLM.
|
|
28
|
+
*
|
|
29
|
+
* Combina state gate (tools visíveis pelo estado do grafo)
|
|
30
|
+
* com intent classifier (tools relevantes para a intenção).
|
|
31
|
+
*
|
|
32
|
+
* @param directory - Diretório do projeto
|
|
33
|
+
* @param userInput - Texto do input do usuário
|
|
34
|
+
* @returns ToolRegistryResult com tools selecionadas e mensagem formatada
|
|
35
|
+
*/
|
|
36
|
+
export function getToolsForSession(directory: string, userInput: string): ToolRegistryResult {
|
|
37
|
+
// 1. State gate: quais tools são visíveis pelo estado do grafo?
|
|
38
|
+
const stateTools = getVisibleTools(directory)
|
|
39
|
+
|
|
40
|
+
// 2. Intent classifier: qual a intenção do usuário?
|
|
41
|
+
const intent = classifyIntent(userInput)
|
|
42
|
+
|
|
43
|
+
// 3. Interseção: tools da intenção ∩ tools visíveis
|
|
44
|
+
const tools = getToolsForIntent(intent, stateTools)
|
|
45
|
+
|
|
46
|
+
// 4. Se resultado muito pequeno, usar fallback (todas as tools do estado)
|
|
47
|
+
const finalTools = tools.length >= 3 ? tools : (stateTools ? [...stateTools] : [...STANDALONE_TOOLS, ...TOOL_TAXONOMY.map(t => t.name)])
|
|
48
|
+
|
|
49
|
+
// 5. Formatar mensagem para o system prompt
|
|
50
|
+
const formattedMessage = formatToolRegistryMessage(finalTools, intent, stateTools)
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
tools: finalTools,
|
|
54
|
+
intent,
|
|
55
|
+
stateTools,
|
|
56
|
+
formattedMessage,
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Formata a mensagem do tool registry para o system prompt.
|
|
62
|
+
*/
|
|
63
|
+
function formatToolRegistryMessage(
|
|
64
|
+
tools: string[],
|
|
65
|
+
intent: IntentResult,
|
|
66
|
+
stateTools: Set<string> | null,
|
|
67
|
+
): string {
|
|
68
|
+
const lines: string[] = []
|
|
69
|
+
|
|
70
|
+
// Header com intenção detectada
|
|
71
|
+
const confidencePct = Math.round(intent.confidence * 100)
|
|
72
|
+
lines.push(`## Intent Detectado: ${intent.category} (${confidencePct}% confiança)`)
|
|
73
|
+
if (intent.topCategories.length > 1) {
|
|
74
|
+
const alternatives = intent.topCategories.slice(1).map(c => `${c.category} (${Math.round(c.score * 100)}%)`).join(", ")
|
|
75
|
+
lines.push(`Alternativas: ${alternatives}`)
|
|
76
|
+
}
|
|
77
|
+
lines.push("")
|
|
78
|
+
|
|
79
|
+
// Tools selecionadas
|
|
80
|
+
const standalone = tools.filter(t => STANDALONE_TOOLS.includes(t))
|
|
81
|
+
const composite = tools.filter(t => TOOL_TAXONOMY.find(tc => tc.name === t))
|
|
82
|
+
|
|
83
|
+
if (standalone.length > 0) {
|
|
84
|
+
lines.push("### Tools Individuais")
|
|
85
|
+
for (const t of standalone.sort()) {
|
|
86
|
+
lines.push(`- \`${t}\``)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (composite.length > 0) {
|
|
91
|
+
lines.push("\n### Tools Compositas (use action= para sub-comando)")
|
|
92
|
+
for (const t of composite.sort()) {
|
|
93
|
+
const tool = TOOL_TAXONOMY.find(tc => tc.name === t)
|
|
94
|
+
if (tool) {
|
|
95
|
+
const actions = tool.actions.map(a => a.name).join(", ")
|
|
96
|
+
lines.push(`- \`${t}\` → [${actions}]`)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Escape hatch
|
|
102
|
+
lines.push("")
|
|
103
|
+
lines.push(ESCAPE_HATCH_INSTRUCTION)
|
|
104
|
+
|
|
105
|
+
return lines.join("\n")
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Obtém descrição de uma tool (standalone ou composite).
|
|
110
|
+
*/
|
|
111
|
+
export function getToolDescription(toolName: string): string {
|
|
112
|
+
// Tentar standalone primeiro
|
|
113
|
+
if (STANDALONE_TOOLS.includes(toolName)) {
|
|
114
|
+
return `SDD tool: ${toolName}`
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Tentar composite
|
|
118
|
+
const composite = TOOL_TAXONOMY.find(t => t.name === toolName)
|
|
119
|
+
if (composite) {
|
|
120
|
+
return composite.description
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return `Unknown tool: ${toolName}`
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Lista todas as tools ativas (composits + standalone) com contagem.
|
|
128
|
+
*/
|
|
129
|
+
export function listAllTools(): { standalone: string[]; composite: CompositeTool[]; total: number } {
|
|
130
|
+
return {
|
|
131
|
+
standalone: STANDALONE_TOOLS,
|
|
132
|
+
composite: TOOL_TAXONOMY,
|
|
133
|
+
total: STANDALONE_TOOLS.length + TOOL_TAXONOMY.length,
|
|
134
|
+
}
|
|
135
|
+
}
|