kibi-cli 0.12.8 → 0.16.1
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/bin/kibi +3 -1
- package/dist/cli-command.d.ts +5 -0
- package/dist/cli-command.d.ts.map +1 -0
- package/dist/cli-command.js +9 -0
- package/dist/cli-errors.d.ts +13 -0
- package/dist/cli-errors.d.ts.map +1 -0
- package/dist/cli-errors.js +26 -0
- package/dist/cli-input.d.ts +6 -0
- package/dist/cli-input.d.ts.map +1 -0
- package/dist/cli-input.js +54 -0
- package/dist/cli-json-command.d.ts +14 -0
- package/dist/cli-json-command.d.ts.map +1 -0
- package/dist/cli-json-command.js +96 -0
- package/dist/cli-protocol.d.ts +12 -0
- package/dist/cli-protocol.d.ts.map +1 -0
- package/dist/cli-protocol.js +37 -0
- package/dist/cli-register-foundation.d.ts +3 -0
- package/dist/cli-register-foundation.d.ts.map +1 -0
- package/dist/cli-register-foundation.js +90 -0
- package/dist/cli-register-maintenance.d.ts +3 -0
- package/dist/cli-register-maintenance.d.ts.map +1 -0
- package/dist/cli-register-maintenance.js +36 -0
- package/dist/cli-register-reporting.d.ts +3 -0
- package/dist/cli-register-reporting.d.ts.map +1 -0
- package/dist/cli-register-reporting.js +101 -0
- package/dist/cli-register-skills.d.ts +3 -0
- package/dist/cli-register-skills.d.ts.map +1 -0
- package/dist/cli-register-skills.js +71 -0
- package/dist/cli-validate.d.ts +18 -0
- package/dist/cli-validate.d.ts.map +1 -0
- package/dist/cli-validate.js +45 -0
- package/dist/cli.d.ts +4 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +48 -210
- package/dist/commands/aggregated-checks.d.ts +1 -1
- package/dist/commands/aggregated-checks.d.ts.map +1 -1
- package/dist/commands/aggregated-checks.js +28 -34
- package/dist/commands/check.d.ts +2 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +145 -152
- package/dist/commands/coverage.d.ts.map +1 -1
- package/dist/commands/coverage.js +12 -17
- package/dist/commands/discovery-shared.d.ts +3 -1
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +8 -209
- package/dist/commands/discovery-table.d.ts +3 -0
- package/dist/commands/discovery-table.d.ts.map +1 -0
- package/dist/commands/discovery-table.js +204 -0
- package/dist/commands/gaps.d.ts.map +1 -1
- package/dist/commands/gaps.js +15 -19
- package/dist/commands/graph.d.ts.map +1 -1
- package/dist/commands/graph.js +15 -21
- package/dist/commands/query.d.ts +7 -7
- package/dist/commands/query.d.ts.map +1 -1
- package/dist/commands/query.js +98 -204
- package/dist/commands/search.d.ts +4 -4
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +14 -27
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +6 -7
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +8 -1
- package/dist/commands/sync/extraction.d.ts +6 -1
- package/dist/commands/sync/extraction.d.ts.map +1 -1
- package/dist/commands/sync/extraction.js +7 -3
- package/dist/commands/sync/manifest.d.ts +1 -1
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +9 -17
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +51 -2
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +18 -0
- package/dist/extractors/markdown.d.ts +20 -2
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +38 -1
- package/dist/extractors/symbols-coordinator.d.ts +1 -1
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +73 -1
- package/dist/operations/autopilot/activation.d.ts +4 -0
- package/dist/operations/autopilot/activation.d.ts.map +1 -0
- package/dist/operations/autopilot/activation.js +130 -0
- package/dist/operations/autopilot/candidate-helpers.d.ts +13 -0
- package/dist/operations/autopilot/candidate-helpers.d.ts.map +1 -0
- package/dist/operations/autopilot/candidate-helpers.js +55 -0
- package/dist/operations/autopilot/candidates.d.ts +4 -0
- package/dist/operations/autopilot/candidates.d.ts.map +1 -0
- package/dist/operations/autopilot/candidates.js +114 -0
- package/dist/operations/autopilot/discovery-evidence.d.ts +10 -0
- package/dist/operations/autopilot/discovery-evidence.d.ts.map +1 -0
- package/dist/operations/autopilot/discovery-evidence.js +158 -0
- package/dist/operations/autopilot/discovery.d.ts +4 -0
- package/dist/operations/autopilot/discovery.d.ts.map +1 -0
- package/dist/operations/autopilot/discovery.js +100 -0
- package/dist/operations/autopilot/generate.d.ts +8 -0
- package/dist/operations/autopilot/generate.d.ts.map +1 -0
- package/dist/operations/autopilot/generate.js +112 -0
- package/dist/operations/autopilot/guidance-actions.d.ts +3 -0
- package/dist/operations/autopilot/guidance-actions.d.ts.map +1 -0
- package/dist/operations/autopilot/guidance-actions.js +79 -0
- package/dist/operations/autopilot/guidance.d.ts +14 -0
- package/dist/operations/autopilot/guidance.d.ts.map +1 -0
- package/dist/operations/autopilot/guidance.js +124 -0
- package/dist/operations/autopilot/markdown-candidates.d.ts +7 -0
- package/dist/operations/autopilot/markdown-candidates.d.ts.map +1 -0
- package/dist/operations/autopilot/markdown-candidates.js +134 -0
- package/dist/operations/autopilot/presentation.d.ts +13 -0
- package/dist/operations/autopilot/presentation.d.ts.map +1 -0
- package/dist/operations/autopilot/presentation.js +91 -0
- package/dist/operations/autopilot/requirement-claims.d.ts +3 -0
- package/dist/operations/autopilot/requirement-claims.d.ts.map +1 -0
- package/dist/operations/autopilot/requirement-claims.js +48 -0
- package/dist/operations/autopilot/types.d.ts +117 -0
- package/dist/operations/autopilot/types.d.ts.map +1 -0
- package/dist/operations/autopilot/types.js +8 -0
- package/dist/operations/modeling/model-requirement.d.ts +10 -0
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -0
- package/dist/operations/modeling/model-requirement.js +108 -0
- package/dist/operations/modeling/predicate-applyplan.d.ts +6 -0
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-applyplan.js +104 -0
- package/dist/operations/modeling/predicate-catalog-1.d.ts +3 -0
- package/dist/operations/modeling/predicate-catalog-1.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog-1.js +200 -0
- package/dist/operations/modeling/predicate-catalog-2.d.ts +3 -0
- package/dist/operations/modeling/predicate-catalog-2.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog-2.js +197 -0
- package/dist/operations/modeling/predicate-catalog-3.d.ts +3 -0
- package/dist/operations/modeling/predicate-catalog-3.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog-3.js +193 -0
- package/dist/operations/modeling/predicate-catalog-4.d.ts +3 -0
- package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog-4.js +149 -0
- package/dist/operations/modeling/predicate-catalog.d.ts +5 -0
- package/dist/operations/modeling/predicate-catalog.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog.js +29 -0
- package/dist/operations/modeling/predicate-inference-1.d.ts +16 -0
- package/dist/operations/modeling/predicate-inference-1.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-inference-1.js +161 -0
- package/dist/operations/modeling/predicate-inference-2.d.ts +19 -0
- package/dist/operations/modeling/predicate-inference-2.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-inference-2.js +169 -0
- package/dist/operations/modeling/predicate-inference-3.d.ts +15 -0
- package/dist/operations/modeling/predicate-inference-3.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-inference-3.js +163 -0
- package/dist/operations/modeling/predicate-inference.d.ts +5 -0
- package/dist/operations/modeling/predicate-inference.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-inference.js +148 -0
- package/dist/operations/modeling/predicate-loader.d.ts +10 -0
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-loader.js +88 -0
- package/dist/operations/modeling/predicate-ranker.d.ts +3 -0
- package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-ranker.js +24 -0
- package/dist/operations/modeling/predicate-score-1.d.ts +3 -0
- package/dist/operations/modeling/predicate-score-1.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-score-1.js +121 -0
- package/dist/operations/modeling/predicate-score-2.d.ts +3 -0
- package/dist/operations/modeling/predicate-score-2.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-score-2.js +122 -0
- package/dist/operations/modeling/predicate-score-3.d.ts +3 -0
- package/dist/operations/modeling/predicate-score-3.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-score-3.js +54 -0
- package/dist/operations/modeling/predicate-types.d.ts +61 -0
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-types.js +1 -0
- package/dist/operations/modeling/predicate-usage-hints-1.d.ts +3 -0
- package/dist/operations/modeling/predicate-usage-hints-1.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-usage-hints-1.js +211 -0
- package/dist/operations/modeling/predicate-usage-hints-2.d.ts +3 -0
- package/dist/operations/modeling/predicate-usage-hints-2.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-usage-hints-2.js +209 -0
- package/dist/operations/modeling/predicate-usage-hints-3.d.ts +3 -0
- package/dist/operations/modeling/predicate-usage-hints-3.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-usage-hints-3.js +45 -0
- package/dist/operations/modeling/predicate-utils.d.ts +23 -0
- package/dist/operations/modeling/predicate-utils.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-utils.js +187 -0
- package/dist/operations/modeling/requirement-applyplan.d.ts +4 -0
- package/dist/operations/modeling/requirement-applyplan.d.ts.map +1 -0
- package/dist/operations/modeling/requirement-applyplan.js +44 -0
- package/dist/operations/modeling/requirement-heuristics.d.ts +4 -0
- package/dist/operations/modeling/requirement-heuristics.d.ts.map +1 -0
- package/dist/operations/modeling/requirement-heuristics.js +114 -0
- package/dist/operations/modeling/requirement-modeler.d.ts +8 -0
- package/dist/operations/modeling/requirement-modeler.d.ts.map +1 -0
- package/dist/operations/modeling/requirement-modeler.js +70 -0
- package/dist/operations/modeling/requirement-types.d.ts +49 -0
- package/dist/operations/modeling/requirement-types.d.ts.map +1 -0
- package/dist/operations/modeling/requirement-types.js +1 -0
- package/dist/operations/modeling/requirement-utils.d.ts +10 -0
- package/dist/operations/modeling/requirement-utils.d.ts.map +1 -0
- package/dist/operations/modeling/requirement-utils.js +65 -0
- package/dist/operations/modeling/suggest-predicates.d.ts +6 -0
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -0
- package/dist/operations/modeling/suggest-predicates.js +64 -0
- package/dist/operations/mutation/audit.d.ts +6 -0
- package/dist/operations/mutation/audit.d.ts.map +1 -0
- package/dist/operations/mutation/audit.js +22 -0
- package/dist/operations/mutation/contradictions.d.ts +10 -0
- package/dist/operations/mutation/contradictions.d.ts.map +1 -0
- package/dist/operations/mutation/contradictions.js +40 -0
- package/dist/operations/mutation/delete.d.ts +5 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -0
- package/dist/operations/mutation/delete.js +67 -0
- package/dist/operations/mutation/relationships.d.ts +17 -0
- package/dist/operations/mutation/relationships.d.ts.map +1 -0
- package/dist/operations/mutation/relationships.js +134 -0
- package/dist/operations/mutation/save.d.ts +4 -0
- package/dist/operations/mutation/save.d.ts.map +1 -0
- package/dist/operations/mutation/save.js +14 -0
- package/dist/operations/mutation/serialization.d.ts +5 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -0
- package/dist/operations/mutation/serialization.js +85 -0
- package/dist/operations/mutation/strict-fact.d.ts +4 -0
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -0
- package/dist/operations/mutation/strict-fact.js +67 -0
- package/dist/operations/mutation/symbol-granularity.d.ts +4 -0
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -0
- package/dist/operations/mutation/symbol-granularity.js +109 -0
- package/dist/operations/mutation/symbol-refresh.d.ts +10 -0
- package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -0
- package/dist/operations/mutation/symbol-refresh.js +105 -0
- package/dist/operations/mutation/types.d.ts +43 -0
- package/dist/operations/mutation/types.d.ts.map +1 -0
- package/dist/operations/mutation/types.js +1 -0
- package/dist/operations/mutation/upsert.d.ts +5 -0
- package/dist/operations/mutation/upsert.d.ts.map +1 -0
- package/dist/operations/mutation/upsert.js +103 -0
- package/dist/operations/mutation/validate-upsert.d.ts +5 -0
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -0
- package/dist/operations/mutation/validate-upsert.js +50 -0
- package/dist/operations/mutation/validation.d.ts +5 -0
- package/dist/operations/mutation/validation.d.ts.map +1 -0
- package/dist/operations/mutation/validation.js +107 -0
- package/dist/operations/mutation/warnings.d.ts +4 -0
- package/dist/operations/mutation/warnings.d.ts.map +1 -0
- package/dist/operations/mutation/warnings.js +17 -0
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts +5 -0
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/analysis-receipt.js +112 -0
- package/dist/operations/semantic-advisor/analyze-prose.d.ts +5 -0
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/analyze-prose.js +271 -0
- package/dist/operations/semantic-advisor/clauses.d.ts +10 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/clauses.js +43 -0
- package/dist/operations/semantic-advisor/observation-plan.d.ts +3 -0
- package/dist/operations/semantic-advisor/observation-plan.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/observation-plan.js +19 -0
- package/dist/operations/semantic-advisor/predicate-rule.d.ts +14 -0
- package/dist/operations/semantic-advisor/predicate-rule.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rule.js +22 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +79 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.js +140 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +83 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.js +150 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +48 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +102 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +71 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.js +133 -0
- package/dist/operations/semantic-advisor/prose-coverage-evaluator.d.ts +29 -0
- package/dist/operations/semantic-advisor/prose-coverage-evaluator.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/prose-coverage-evaluator.js +54 -0
- package/dist/operations/semantic-advisor/shared.d.ts +18 -0
- package/dist/operations/semantic-advisor/shared.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/shared.js +209 -0
- package/dist/operations/semantic-advisor/strict-count-rules.d.ts +4 -0
- package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/strict-count-rules.js +62 -0
- package/dist/operations/semantic-advisor/strict-rules.d.ts +4 -0
- package/dist/operations/semantic-advisor/strict-rules.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/strict-rules.js +106 -0
- package/dist/operations/semantic-advisor/types.d.ts +135 -0
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/types.js +1 -0
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +9 -2
- package/dist/prolog.d.ts +5 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +82 -30
- package/dist/public/impact/analyzer.d.ts +3 -0
- package/dist/public/impact/analyzer.d.ts.map +1 -0
- package/dist/public/impact/analyzer.js +54 -0
- package/dist/public/impact/coverage-depth-quality.d.ts +4 -0
- package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -0
- package/dist/public/impact/coverage-depth-quality.js +179 -0
- package/dist/public/impact/diagnostics.d.ts +7 -0
- package/dist/public/impact/diagnostics.d.ts.map +1 -0
- package/dist/public/impact/diagnostics.js +126 -0
- package/dist/public/impact/diff-meaning.d.ts +2 -0
- package/dist/public/impact/diff-meaning.d.ts.map +1 -0
- package/dist/public/impact/diff-meaning.js +101 -0
- package/dist/public/impact/full-kb-quality.d.ts +10 -0
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -0
- package/dist/public/impact/full-kb-quality.js +191 -0
- package/dist/public/impact/manifest.d.ts +5 -0
- package/dist/public/impact/manifest.d.ts.map +1 -0
- package/dist/public/impact/manifest.js +43 -0
- package/dist/public/impact/requirement-quality.d.ts +4 -0
- package/dist/public/impact/requirement-quality.d.ts.map +1 -0
- package/dist/public/impact/requirement-quality.js +199 -0
- package/dist/public/impact/source-changes.d.ts +5 -0
- package/dist/public/impact/source-changes.d.ts.map +1 -0
- package/dist/public/impact/source-changes.js +129 -0
- package/dist/public/impact/summaries.d.ts +6 -0
- package/dist/public/impact/summaries.d.ts.map +1 -0
- package/dist/public/impact/summaries.js +68 -0
- package/dist/public/impact/symbol-quality-model.d.ts +21 -0
- package/dist/public/impact/symbol-quality-model.d.ts.map +1 -0
- package/dist/public/impact/symbol-quality-model.js +116 -0
- package/dist/public/impact/symbol-quality.d.ts +4 -0
- package/dist/public/impact/symbol-quality.d.ts.map +1 -0
- package/dist/public/impact/symbol-quality.js +159 -0
- package/dist/public/impact/types.d.ts +79 -0
- package/dist/public/impact/types.d.ts.map +1 -0
- package/dist/public/impact/types.js +1 -0
- package/dist/public/impact-diagnostics.d.ts +7 -0
- package/dist/public/impact-diagnostics.d.ts.map +1 -0
- package/dist/public/impact-diagnostics.js +5 -0
- package/dist/public/operations/catalog.d.ts +907 -0
- package/dist/public/operations/catalog.d.ts.map +1 -0
- package/dist/public/operations/catalog.js +42 -0
- package/dist/public/operations/check-executor.d.ts +21 -0
- package/dist/public/operations/check-executor.d.ts.map +1 -0
- package/dist/public/operations/check-executor.js +111 -0
- package/dist/public/operations/check-format-shared.d.ts +36 -0
- package/dist/public/operations/check-format-shared.d.ts.map +1 -0
- package/dist/public/operations/check-format-shared.js +107 -0
- package/dist/public/operations/check-helpers.d.ts +10 -0
- package/dist/public/operations/check-helpers.d.ts.map +1 -0
- package/dist/public/operations/check-helpers.js +107 -0
- package/dist/public/operations/discovery-entities.d.ts +14 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -0
- package/dist/public/operations/discovery-entities.js +91 -0
- package/dist/public/operations/discovery-executors.d.ts +39 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -0
- package/dist/public/operations/discovery-executors.js +101 -0
- package/dist/public/operations/index.d.ts +20 -0
- package/dist/public/operations/index.d.ts.map +1 -0
- package/dist/public/operations/index.js +18 -0
- package/dist/public/operations/node-ports.d.ts +15 -0
- package/dist/public/operations/node-ports.d.ts.map +1 -0
- package/dist/public/operations/node-ports.js +57 -0
- package/dist/public/operations/prolog-json.d.ts +5 -0
- package/dist/public/operations/prolog-json.d.ts.map +1 -0
- package/dist/public/operations/prolog-json.js +44 -0
- package/dist/public/operations/runtime-types.d.ts +69 -0
- package/dist/public/operations/runtime-types.d.ts.map +1 -0
- package/dist/public/operations/runtime-types.js +17 -0
- package/dist/public/operations/specs/autopilot.d.ts +82 -0
- package/dist/public/operations/specs/autopilot.d.ts.map +1 -0
- package/dist/public/operations/specs/autopilot.js +72 -0
- package/dist/public/operations/specs/check.d.ts +51 -0
- package/dist/public/operations/specs/check.d.ts.map +1 -0
- package/dist/public/operations/specs/check.js +62 -0
- package/dist/public/operations/specs/discovery.d.ts +94 -0
- package/dist/public/operations/specs/discovery.d.ts.map +1 -0
- package/dist/public/operations/specs/discovery.js +98 -0
- package/dist/public/operations/specs/modeling.d.ts +126 -0
- package/dist/public/operations/specs/modeling.d.ts.map +1 -0
- package/dist/public/operations/specs/modeling.js +117 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts +233 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -0
- package/dist/public/operations/specs/mutation-schemas.js +267 -0
- package/dist/public/operations/specs/mutation.d.ts +56 -0
- package/dist/public/operations/specs/mutation.d.ts.map +1 -0
- package/dist/public/operations/specs/mutation.js +44 -0
- package/dist/public/operations/specs/reporting.d.ts +185 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -0
- package/dist/public/operations/specs/reporting.js +158 -0
- package/dist/public/operations/specs/semantic.d.ts +53 -0
- package/dist/public/operations/specs/semantic.d.ts.map +1 -0
- package/dist/public/operations/specs/semantic.js +105 -0
- package/dist/public/operations/specs/skills.d.ts +70 -0
- package/dist/public/operations/specs/skills.d.ts.map +1 -0
- package/dist/public/operations/specs/skills.js +107 -0
- package/dist/public/operations/specs/sparql.d.ts +39 -0
- package/dist/public/operations/specs/sparql.d.ts.map +1 -0
- package/dist/public/operations/specs/sparql.js +121 -0
- package/dist/public/operations/specs/upsert.d.ts +256 -0
- package/dist/public/operations/specs/upsert.d.ts.map +1 -0
- package/dist/public/operations/specs/upsert.js +27 -0
- package/dist/public/operations/types.d.ts +24 -0
- package/dist/public/operations/types.d.ts.map +1 -0
- package/dist/public/operations/types.js +1 -0
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +48 -0
- package/dist/public/skill-system/errors.d.ts +19 -0
- package/dist/public/skill-system/errors.d.ts.map +1 -0
- package/dist/public/skill-system/errors.js +36 -0
- package/dist/public/skill-system/loader.d.ts +9 -0
- package/dist/public/skill-system/loader.d.ts.map +1 -0
- package/dist/public/skill-system/loader.js +76 -0
- package/dist/public/skill-system/paths.d.ts +6 -0
- package/dist/public/skill-system/paths.d.ts.map +1 -0
- package/dist/public/skill-system/paths.js +25 -0
- package/dist/public/skill-system/types.d.ts +15 -0
- package/dist/public/skill-system/types.d.ts.map +1 -0
- package/dist/public/skill-system/types.js +1 -0
- package/dist/public/skill-system/validation.d.ts +10 -0
- package/dist/public/skill-system/validation.d.ts.map +1 -0
- package/dist/public/skill-system/validation.js +119 -0
- package/dist/public/skills/init-kibi/SKILL.md +62 -0
- package/dist/public/skills/kibi-freshness/SKILL.md +44 -0
- package/dist/public/skills/kibi-traceability/SKILL.md +54 -0
- package/dist/public/skills/kibi-usage/SKILL.md +123 -95
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +107 -5
- package/dist/public/skills/kibi-usage/resources/operation-access.md +44 -0
- package/dist/public/skills/kibi-usage/resources/relationship-directions.md +30 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +40 -3
- package/dist/public/skills.d.ts +4 -41
- package/dist/public/skills.d.ts.map +1 -1
- package/dist/public/skills.js +3 -270
- package/dist/public/symbol-granularity.d.ts +1 -1
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.js +2 -0
- package/dist/runtime/cli-runtime.d.ts +3 -0
- package/dist/runtime/cli-runtime.d.ts.map +1 -0
- package/dist/runtime/cli-runtime.js +96 -0
- package/dist/schemas/entity.schema.json +23 -0
- package/dist/traceability/evidence-model.d.ts +1 -1
- package/dist/traceability/evidence-model.d.ts.map +1 -1
- package/dist/traceability/evidence-model.js +1 -1
- package/dist/traceability/staged-diagnostics.d.ts +6 -6
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +12 -6
- package/dist/traceability/staged-impact-contract.js +1 -1
- package/dist/traceability/staged-symbols-manifest.d.ts +1 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +60 -27
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +58 -1
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +34 -1
- package/dist/types/entities.d.ts +8 -1
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/prolog-query-plan-safety.d.ts +8 -0
- package/dist/utils/prolog-query-plan-safety.d.ts.map +1 -0
- package/dist/utils/prolog-query-plan-safety.js +47 -0
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.js +18 -0
- package/package.json +60 -2
- package/schema/entities.pl +4 -0
- package/src/public/impact/analyzer.ts +90 -0
- package/src/public/impact/coverage-depth-quality.ts +268 -0
- package/src/public/impact/diagnostics.ts +199 -0
- package/src/public/impact/diff-meaning.ts +121 -0
- package/src/public/impact/full-kb-quality.ts +230 -0
- package/src/public/impact/manifest.ts +57 -0
- package/src/public/impact/requirement-quality.ts +262 -0
- package/src/public/impact/source-changes.ts +180 -0
- package/src/public/impact/summaries.ts +100 -0
- package/src/public/impact/symbol-quality-model.ts +171 -0
- package/src/public/impact/symbol-quality.ts +207 -0
- package/src/public/impact/types.ts +99 -0
- package/src/public/impact-diagnostics.ts +22 -0
- package/src/public/operations/catalog.ts +60 -0
- package/src/public/operations/check-executor.ts +185 -0
- package/src/public/operations/check-format-shared.ts +178 -0
- package/src/public/operations/check-helpers.ts +141 -0
- package/src/public/operations/discovery-entities.ts +122 -0
- package/src/public/operations/discovery-executors.ts +176 -0
- package/src/public/operations/index.ts +19 -0
- package/src/public/operations/node-ports.ts +78 -0
- package/src/public/operations/prolog-json.ts +71 -0
- package/src/public/operations/runtime-types.ts +106 -0
- package/src/public/operations/specs/autopilot.ts +98 -0
- package/src/public/operations/specs/check.ts +72 -0
- package/src/public/operations/specs/discovery.ts +126 -0
- package/src/public/operations/specs/modeling.ts +154 -0
- package/src/public/operations/specs/mutation-schemas.ts +296 -0
- package/src/public/operations/specs/mutation.ts +58 -0
- package/src/public/operations/specs/reporting.ts +249 -0
- package/src/public/operations/specs/semantic.ts +135 -0
- package/src/public/operations/specs/skills.ts +142 -0
- package/src/public/operations/specs/sparql.ts +149 -0
- package/src/public/operations/specs/upsert.ts +40 -0
- package/src/public/operations/types.ts +57 -0
- package/src/public/schemas/entity.ts +50 -0
- package/src/public/skill-system/errors.ts +38 -0
- package/src/public/skill-system/loader.ts +108 -0
- package/src/public/skill-system/paths.ts +27 -0
- package/src/public/skill-system/types.ts +14 -0
- package/src/public/skill-system/validation.ts +175 -0
- package/src/public/skills/init-kibi/SKILL.md +62 -0
- package/src/public/skills/kibi-freshness/SKILL.md +44 -0
- package/src/public/skills/kibi-traceability/SKILL.md +54 -0
- package/src/public/skills/kibi-usage/SKILL.md +123 -95
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +107 -5
- package/src/public/skills/kibi-usage/resources/operation-access.md +44 -0
- package/src/public/skills/kibi-usage/resources/relationship-directions.md +30 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +40 -3
- package/src/public/skills.ts +18 -427
- package/src/public/symbol-granularity.ts +4 -0
- package/src/schemas/entity.schema.json +23 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import Ajv from "ajv";
|
|
2
|
+
import entitySchema from "../../public/schemas/entity.js";
|
|
3
|
+
import relationshipSchema from "../../public/schemas/relationship.js";
|
|
4
|
+
// implements REQ-kibi-operation-interface-parity
|
|
5
|
+
import { SYMBOL_ROLES, isAllowedGranularityReason, } from "../../public/symbol-granularity.js";
|
|
6
|
+
import { semanticClaimKey } from "../semantic-advisor/clauses.js";
|
|
7
|
+
import { factKindShapeHints, validateFactModelingShape, valueFieldHint, } from "./strict-fact.js";
|
|
8
|
+
const ajv = new Ajv({ strict: false });
|
|
9
|
+
const schema = entitySchema;
|
|
10
|
+
const properties = schema.properties !== null && typeof schema.properties === "object"
|
|
11
|
+
? schema.properties
|
|
12
|
+
: {};
|
|
13
|
+
const validateEntity = ajv.compile({
|
|
14
|
+
...schema,
|
|
15
|
+
properties: {
|
|
16
|
+
...properties,
|
|
17
|
+
granularity_reason: {
|
|
18
|
+
type: "string",
|
|
19
|
+
enum: [
|
|
20
|
+
"config-artifact",
|
|
21
|
+
"module-level-behavior",
|
|
22
|
+
"extractor-miss",
|
|
23
|
+
"legacy-link",
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
symbol_role: { type: "string", enum: [...SYMBOL_ROLES] },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const validateRelationship = ajv.compile(relationshipSchema);
|
|
30
|
+
const ALIASES = new Map([
|
|
31
|
+
["subjectKey", "subject_key"],
|
|
32
|
+
["propertyKey", "property_key"],
|
|
33
|
+
["predicateName", "predicate_name"],
|
|
34
|
+
["predicateArgs", "predicate_args"],
|
|
35
|
+
["canonicalKey", "canonical_key"],
|
|
36
|
+
["closedWorld", "closed_world"],
|
|
37
|
+
]);
|
|
38
|
+
function formatEntityErrors(entity, errors) {
|
|
39
|
+
const messages = errors.map((error) => {
|
|
40
|
+
const params = error.params;
|
|
41
|
+
const path = error.instancePath || "root";
|
|
42
|
+
if (error.keyword === "additionalProperties" && params.additionalProperty) {
|
|
43
|
+
const property = params.additionalProperty;
|
|
44
|
+
if (property === "value") {
|
|
45
|
+
return `${path}: unknown property 'value'. ${valueFieldHint(entity.value)} Do not use generic value in kb_upsert.properties.`;
|
|
46
|
+
}
|
|
47
|
+
const canonical = ALIASES.get(property);
|
|
48
|
+
if (canonical) {
|
|
49
|
+
return `${path}: unknown property '${property}'. Did you mean '${canonical}'? kb_upsert.properties uses snake_case typed fact fields.`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (error.keyword === "enum" && params.allowedValues) {
|
|
53
|
+
return `${path}: ${error.message}. Allowed values: ${params.allowedValues.map(String).join(", ")}`;
|
|
54
|
+
}
|
|
55
|
+
return `${path}: ${error.message}`;
|
|
56
|
+
});
|
|
57
|
+
const hints = factKindShapeHints(entity);
|
|
58
|
+
for (const [alias, canonical] of ALIASES) {
|
|
59
|
+
if (Object.hasOwn(entity, alias)) {
|
|
60
|
+
hints.push(`Unknown property '${alias}'. Use '${canonical}' in kb_upsert.properties.`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (Object.hasOwn(entity, "value"))
|
|
64
|
+
hints.push(valueFieldHint(entity.value));
|
|
65
|
+
if (hints.length > 0 &&
|
|
66
|
+
(Object.hasOwn(entity, "value") ||
|
|
67
|
+
[...ALIASES.keys()].some((key) => Object.hasOwn(entity, key)))) {
|
|
68
|
+
hints.push("Next action: if starting from prose, call kb_model_requirement and apply its sequential applyPlan instead of guessing field names.");
|
|
69
|
+
}
|
|
70
|
+
return [...messages, ...hints].join("; ");
|
|
71
|
+
}
|
|
72
|
+
export function validateUpsertInput(input, now) {
|
|
73
|
+
if (!input.type || !input.id) {
|
|
74
|
+
throw new Error("'type' and 'id' are required for upsert");
|
|
75
|
+
}
|
|
76
|
+
const entity = {
|
|
77
|
+
id: input.id,
|
|
78
|
+
type: input.type,
|
|
79
|
+
...input.properties,
|
|
80
|
+
};
|
|
81
|
+
entity.created_at ??= now.toISOString();
|
|
82
|
+
entity.updated_at ??= now.toISOString();
|
|
83
|
+
entity.source ??= "mcp://kibi/upsert";
|
|
84
|
+
if (!validateEntity(entity)) {
|
|
85
|
+
throw new Error(`Entity validation failed: ${formatEntityErrors(entity, validateEntity.errors ?? [])}`);
|
|
86
|
+
}
|
|
87
|
+
validateFactModelingShape(entity);
|
|
88
|
+
if (entity.type === "fact" &&
|
|
89
|
+
typeof entity.claim_key === "string" &&
|
|
90
|
+
typeof entity.claim_text === "string") {
|
|
91
|
+
const expectedClaimKey = semanticClaimKey(entity.claim_text);
|
|
92
|
+
if (entity.claim_key !== expectedClaimKey) {
|
|
93
|
+
throw new Error(`Entity validation failed: claim_key must equal the stable key derived from claim_text (expected '${expectedClaimKey}')`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const relationships = input.relationships ?? [];
|
|
97
|
+
relationships.forEach((relationship, index) => {
|
|
98
|
+
if (!validateRelationship(relationship)) {
|
|
99
|
+
const details = (validateRelationship.errors ?? [])
|
|
100
|
+
.map((error) => `${error.instancePath || "root"}: ${error.message}`)
|
|
101
|
+
.join("; ");
|
|
102
|
+
throw new Error(`Relationship validation failed at index ${index}: ${details}`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return { entity, relationships };
|
|
106
|
+
}
|
|
107
|
+
export { isAllowedGranularityReason };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PrologPort } from "../../public/operations/runtime-types.js";
|
|
2
|
+
import type { RelationshipInput } from "./types.js";
|
|
3
|
+
export declare function scenarioCoverageWarnings(prolog: PrologPort, relationships: readonly RelationshipInput[], entityType: string, entityId: string): Promise<readonly string[]>;
|
|
4
|
+
//# sourceMappingURL=warnings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/warnings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,SAAS,iBAAiB,EAAE,EAC3C,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAc5B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { escapeAtom } from "../../prolog/codec.js";
|
|
2
|
+
// implements REQ-kibi-operation-interface-parity
|
|
3
|
+
export async function scenarioCoverageWarnings(prolog, relationships, entityType, entityId) {
|
|
4
|
+
if (entityType !== "req")
|
|
5
|
+
return [];
|
|
6
|
+
for (const relationship of relationships) {
|
|
7
|
+
if (relationship.type !== "verified_by")
|
|
8
|
+
continue;
|
|
9
|
+
const result = await prolog.query(`once(kb_relationship(specified_by, '${escapeAtom(entityId)}', ScenarioId))`);
|
|
10
|
+
if (result.success) {
|
|
11
|
+
return [
|
|
12
|
+
`Scenario-backed coverage: verified_by(${entityId},test) is valid but will not satisfy symbol-coverage because ${entityId} has specified_by a scenario. Use verified_by(scenario,test) or validates(test,scenario) instead.`,
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SemanticClause } from "./clauses.js";
|
|
2
|
+
import { type Payload } from "./shared.js";
|
|
3
|
+
import type { SemanticAdvisorAnalysisResult, SemanticModelingSuggestion, SemanticSignal } from "./types.js";
|
|
4
|
+
export declare function buildAdvisorResult(payload: Payload, signals: readonly SemanticSignal[], modeled: boolean, suggestions: readonly SemanticModelingSuggestion[], clauses: readonly SemanticClause[]): SemanticAdvisorAnalysisResult;
|
|
5
|
+
//# sourceMappingURL=analysis-receipt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis-receipt.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analysis-receipt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAA6B,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EACV,6BAA6B,EAI7B,0BAA0B,EAC1B,cAAc,EACf,MAAM,YAAY,CAAC;AAwCpB,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,0BAA0B,EAAE,EAClD,OAAO,EAAE,SAAS,cAAc,EAAE,GACjC,6BAA6B,CAqG/B"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { payloadHash, propertiesOf } from "./shared.js";
|
|
2
|
+
function chooseLane(signals) {
|
|
3
|
+
if (signals.some(({ kind }) => kind === "numeric_cardinality" || kind === "numeric_threshold"))
|
|
4
|
+
return "strict_property";
|
|
5
|
+
if (signals.some(({ kind }) => kind === "conditional" ||
|
|
6
|
+
kind === "permission" ||
|
|
7
|
+
kind === "state_or_default"))
|
|
8
|
+
return "predicate";
|
|
9
|
+
return signals.some(({ kind }) => kind === "normative_modal")
|
|
10
|
+
? "observation_review"
|
|
11
|
+
: "none";
|
|
12
|
+
}
|
|
13
|
+
function summary(readiness, lane) {
|
|
14
|
+
if (readiness === "modeled")
|
|
15
|
+
return "Requirement declares every detected atomic claim and has logical fact links; run kb_check logic-coverage to verify each manifest entry is grounded.";
|
|
16
|
+
if (readiness === "not_applicable")
|
|
17
|
+
return "No strong machine-checkable requirement signals were detected.";
|
|
18
|
+
if (lane === "strict_property")
|
|
19
|
+
return "Requirement prose appears to contain scalar, threshold, or cardinality logic that should be modeled with strict facts.";
|
|
20
|
+
if (lane === "predicate")
|
|
21
|
+
return "Requirement prose appears to contain relational or behavioral logic that should be modeled with ontology predicates.";
|
|
22
|
+
return "Requirement prose appears normative but needs review before it can participate in logic checks.";
|
|
23
|
+
}
|
|
24
|
+
// implements REQ-mcp-semantic-advisor-preflight
|
|
25
|
+
export function buildAdvisorResult(payload, signals, modeled, suggestions, clauses) {
|
|
26
|
+
const suggestionLane = suggestions.some(({ kind }) => kind === "strict_property")
|
|
27
|
+
? "strict_property"
|
|
28
|
+
: suggestions.some(({ kind }) => kind === "predicate")
|
|
29
|
+
? "predicate"
|
|
30
|
+
: null;
|
|
31
|
+
const candidateLane = modeled
|
|
32
|
+
? "none"
|
|
33
|
+
: (suggestionLane ?? chooseLane(signals));
|
|
34
|
+
const readiness = modeled
|
|
35
|
+
? "modeled"
|
|
36
|
+
: candidateLane === "none"
|
|
37
|
+
? "not_applicable"
|
|
38
|
+
: "needs_modeling";
|
|
39
|
+
const tools = modeled
|
|
40
|
+
? []
|
|
41
|
+
: candidateLane === "strict_property"
|
|
42
|
+
? ["kb_model_requirement"]
|
|
43
|
+
: candidateLane === "predicate"
|
|
44
|
+
? ["kb_suggest_predicates"]
|
|
45
|
+
: candidateLane === "observation_review"
|
|
46
|
+
? ["kb_model_requirement", "kb_suggest_predicates"]
|
|
47
|
+
: [];
|
|
48
|
+
const expectedClaimKeys = clauses
|
|
49
|
+
.filter((clause) => clause.normative)
|
|
50
|
+
.map((clause) => clause.claim_key);
|
|
51
|
+
const rawDeclaredClaimKeys = propertiesOf(payload).logic_claims;
|
|
52
|
+
const declaredClaimKeys = Array.isArray(rawDeclaredClaimKeys)
|
|
53
|
+
? rawDeclaredClaimKeys.filter((value) => typeof value === "string")
|
|
54
|
+
: [];
|
|
55
|
+
const missingClaimKeys = expectedClaimKeys.filter((claimKey) => !declaredClaimKeys.includes(claimKey));
|
|
56
|
+
const unresolvedClaimKeys = suggestions
|
|
57
|
+
.filter((suggestion) => suggestion.kind === "ambiguity_observation" ||
|
|
58
|
+
suggestion.kind === "ontology_gap")
|
|
59
|
+
.map((suggestion) => suggestion.claim_key);
|
|
60
|
+
const coverageStatus = expectedClaimKeys.length === 0
|
|
61
|
+
? "not_applicable"
|
|
62
|
+
: modeled
|
|
63
|
+
? "complete"
|
|
64
|
+
: declaredClaimKeys.length === 0
|
|
65
|
+
? "unverified"
|
|
66
|
+
: "partial";
|
|
67
|
+
const receipt = {
|
|
68
|
+
version: "semantic-advisor-v1",
|
|
69
|
+
payload_hash: payloadHash(payload),
|
|
70
|
+
logic_readiness: readiness,
|
|
71
|
+
candidate_lane: candidateLane,
|
|
72
|
+
signals,
|
|
73
|
+
ambiguity_witnesses: modeled
|
|
74
|
+
? []
|
|
75
|
+
: signals
|
|
76
|
+
.filter(({ kind }) => kind === "numeric_cardinality")
|
|
77
|
+
.map((signal) => ({
|
|
78
|
+
signal_kind: signal.kind,
|
|
79
|
+
evidence: signal.evidence,
|
|
80
|
+
interpretations: [
|
|
81
|
+
"exactly",
|
|
82
|
+
"at_most",
|
|
83
|
+
"at_least",
|
|
84
|
+
"named_membership",
|
|
85
|
+
"illustrative_example",
|
|
86
|
+
],
|
|
87
|
+
message: "Numeric cardinality prose can mean an exact count, an upper/lower bound, named membership, or an example; model it explicitly before relying on contradiction checks.",
|
|
88
|
+
})),
|
|
89
|
+
suggestions,
|
|
90
|
+
clauses: clauses.map((clause) => ({
|
|
91
|
+
...clause,
|
|
92
|
+
suggestion_indexes: suggestions.flatMap((suggestion, index) => suggestion.claim_key === clause.claim_key ? [index] : []),
|
|
93
|
+
})),
|
|
94
|
+
logic_coverage: {
|
|
95
|
+
status: coverageStatus,
|
|
96
|
+
expected_claim_keys: expectedClaimKeys,
|
|
97
|
+
declared_claim_keys: declaredClaimKeys,
|
|
98
|
+
missing_claim_keys: missingClaimKeys,
|
|
99
|
+
unresolved_claim_keys: unresolvedClaimKeys,
|
|
100
|
+
},
|
|
101
|
+
suggested_next_tools: tools,
|
|
102
|
+
summary: summary(readiness, candidateLane),
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
receipt,
|
|
106
|
+
warnings: readiness === "needs_modeling"
|
|
107
|
+
? [
|
|
108
|
+
`Semantic advisor: ${receipt.summary} Next action: call ${tools.join(" or ")} before treating this requirement as Prolog-checkable.`,
|
|
109
|
+
]
|
|
110
|
+
: [],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SemanticAdvisorAnalysisResult, SemanticAdvisorInput } from "./types.js";
|
|
2
|
+
export declare const SEMANTIC_ADVISOR_VERSION = "semantic-advisor-v1";
|
|
3
|
+
export { semanticClaimKey } from "./clauses.js";
|
|
4
|
+
export declare function analyzeSemanticAdvisorInput(input: SemanticAdvisorInput): SemanticAdvisorAnalysisResult;
|
|
5
|
+
//# sourceMappingURL=analyze-prose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-prose.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analyze-prose.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EAKrB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAsThD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,oBAAoB,GAC1B,6BAA6B,CAuB/B"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { buildAdvisorResult } from "./analysis-receipt.js";
|
|
2
|
+
import { extractSemanticClauses } from "./clauses.js";
|
|
3
|
+
import { observationPlan } from "./observation-plan.js";
|
|
4
|
+
import { detectPredicateRules } from "./predicate-rule.js";
|
|
5
|
+
import { CORE_PREDICATE_RULES } from "./predicate-rules-core.js";
|
|
6
|
+
import { POLICY_PREDICATE_RULES } from "./predicate-rules-policy.js";
|
|
7
|
+
import { PRODUCT_TAIL_PREDICATE_RULES } from "./predicate-rules-product-tail.js";
|
|
8
|
+
import { PRODUCT_PREDICATE_RULES } from "./predicate-rules-product.js";
|
|
9
|
+
import { isRecord, propertiesOf, statementOf, stringValue, } from "./shared.js";
|
|
10
|
+
import { detectStrictSuggestion } from "./strict-rules.js";
|
|
11
|
+
export const SEMANTIC_ADVISOR_VERSION = "semantic-advisor-v1";
|
|
12
|
+
export { semanticClaimKey } from "./clauses.js";
|
|
13
|
+
const SIGNAL_PATTERNS = [
|
|
14
|
+
{
|
|
15
|
+
kind: "numeric_cardinality",
|
|
16
|
+
candidateLane: "strict_property",
|
|
17
|
+
confidence: 0.92,
|
|
18
|
+
pattern: /\b(?:(?:at\s+most|at\s+least|exactly|no\s+more\s+than|up\s+to|cap(?:ped)?\s+at)\s+)?(?:\d+|zero|one|two|three|four|five|six|seven|eight|nine|ten)\b/i,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
kind: "numeric_threshold",
|
|
22
|
+
candidateLane: "strict_property",
|
|
23
|
+
confidence: 0.86,
|
|
24
|
+
pattern: /\b(?:maximum|minimum|under|within|below|above|expires?|retained\s+for)\s+(?:\d+|zero|one|two|three|four|five|six|seven|eight|nine|ten)\b/i,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
kind: "conditional",
|
|
28
|
+
candidateLane: "predicate",
|
|
29
|
+
confidence: 0.82,
|
|
30
|
+
pattern: /\b(?:if|when|unless|except|only\s+if|provided\s+that)\b/i,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
kind: "permission",
|
|
34
|
+
candidateLane: "predicate",
|
|
35
|
+
confidence: 0.8,
|
|
36
|
+
pattern: /\b(?:only|may|can|allowed|denied|forbidden|must\s+not|cannot|can't)\b/i,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
kind: "state_or_default",
|
|
40
|
+
candidateLane: "predicate",
|
|
41
|
+
confidence: 0.74,
|
|
42
|
+
pattern: /\b(?:state|mode|defaults?\s+to|ready|disabled|enabled|terminal)\b/i,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
kind: "normative_modal",
|
|
46
|
+
candidateLane: "observation_review",
|
|
47
|
+
confidence: 0.65,
|
|
48
|
+
pattern: /\b(?:must|shall|should|may|must\s+not|cannot|can't)\b/i,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
function proseOf(payload) {
|
|
52
|
+
const properties = propertiesOf(payload);
|
|
53
|
+
return [properties.title, properties.text_ref, properties.description]
|
|
54
|
+
.map(stringValue)
|
|
55
|
+
.filter(Boolean)
|
|
56
|
+
.join("\n");
|
|
57
|
+
}
|
|
58
|
+
function isRequirement(payload) {
|
|
59
|
+
return stringValue(payload.type) === "req";
|
|
60
|
+
}
|
|
61
|
+
// implements REQ-kibi-logical-requirement-coverage
|
|
62
|
+
// implements REQ-skillopt-logical-evidence-fidelity
|
|
63
|
+
function logicalGroundingSlots(payload) {
|
|
64
|
+
const relationships = Array.isArray(payload.relationships)
|
|
65
|
+
? payload.relationships
|
|
66
|
+
: [];
|
|
67
|
+
return relationships.filter((relationship) => isRecord(relationship) &&
|
|
68
|
+
["requires_property", "requires_predicate"].includes(stringValue(relationship.type))).length;
|
|
69
|
+
}
|
|
70
|
+
function isModeled(payload, expectedClaimCount) {
|
|
71
|
+
if (expectedClaimCount === 0)
|
|
72
|
+
return false;
|
|
73
|
+
const relationships = Array.isArray(payload.relationships)
|
|
74
|
+
? payload.relationships
|
|
75
|
+
: [];
|
|
76
|
+
const types = new Set(relationships
|
|
77
|
+
.filter(isRecord)
|
|
78
|
+
.map((relationship) => stringValue(relationship.type))
|
|
79
|
+
.filter(Boolean));
|
|
80
|
+
return (logicalGroundingSlots(payload) >= expectedClaimCount &&
|
|
81
|
+
((types.has("constrains") && types.has("requires_property")) ||
|
|
82
|
+
types.has("requires_predicate")));
|
|
83
|
+
}
|
|
84
|
+
function detectSignals(prose) {
|
|
85
|
+
const seen = new Set();
|
|
86
|
+
return SIGNAL_PATTERNS.flatMap((candidate) => {
|
|
87
|
+
const evidence = prose.match(candidate.pattern)?.[0];
|
|
88
|
+
if (!evidence || seen.has(candidate.kind))
|
|
89
|
+
return [];
|
|
90
|
+
seen.add(candidate.kind);
|
|
91
|
+
return [
|
|
92
|
+
{
|
|
93
|
+
kind: candidate.kind,
|
|
94
|
+
evidence,
|
|
95
|
+
candidate_lane: candidate.candidateLane,
|
|
96
|
+
confidence: candidate.confidence,
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function ambiguitySuggestion(payload, statement) {
|
|
102
|
+
const match = statement.match(/\b(?<value>\d+|zero|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?<resource>active\s+sessions?|sessions?)\b/i);
|
|
103
|
+
if (!match?.groups?.value ||
|
|
104
|
+
!match.groups.resource ||
|
|
105
|
+
/at\s+most|at\s+least|exactly|no\s+more\s+than|up\s+to/i.test(statement))
|
|
106
|
+
return null;
|
|
107
|
+
return {
|
|
108
|
+
kind: "ambiguity_observation",
|
|
109
|
+
claim_key: "",
|
|
110
|
+
claim_text: statement,
|
|
111
|
+
confidence: 0.78,
|
|
112
|
+
evidence: `${match.groups.value} ${match.groups.resource}`,
|
|
113
|
+
rationale: "Cardinality without an explicit operator is ambiguous and should be clarified before strict modeling.",
|
|
114
|
+
ambiguity: ["exactly", "at_most", "at_least", "illustrative_example"],
|
|
115
|
+
suggested_next_tool: "kb_model_requirement",
|
|
116
|
+
applyPlan: observationPlan(payload, "Ambiguous cardinality requirement", [
|
|
117
|
+
"semantic-advisor-suggestion",
|
|
118
|
+
"review:ambiguity",
|
|
119
|
+
]),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function ontologyGapSuggestion(payload, statement) {
|
|
123
|
+
const match = statement.match(/\brate\s+limited\s+to\s+(?<count>\d+)\s+(?<action>[a-z][a-z\s_-]*?)\s+per\s+(?<window>[a-z]+)\b/i);
|
|
124
|
+
if (!match?.groups)
|
|
125
|
+
return null;
|
|
126
|
+
return {
|
|
127
|
+
kind: "ontology_gap",
|
|
128
|
+
claim_key: "",
|
|
129
|
+
claim_text: statement,
|
|
130
|
+
confidence: 0.82,
|
|
131
|
+
evidence: match[0],
|
|
132
|
+
rationale: "Rate limiting is logical and machine-checkable, but the current built-in predicate set needs a dedicated schema before grounding it safely.",
|
|
133
|
+
suggested_next_tool: "kb_suggest_predicates",
|
|
134
|
+
recommendedPredicateSchema: {
|
|
135
|
+
predicate_name: "rate_limit",
|
|
136
|
+
argument_names: ["subject", "action", "window", "count"],
|
|
137
|
+
argument_types: ["entity", "action", "duration", "number"],
|
|
138
|
+
},
|
|
139
|
+
applyPlan: observationPlan(payload, "Ontology gap: rate_limit", [
|
|
140
|
+
"semantic-advisor-suggestion",
|
|
141
|
+
"review:ontology-gap",
|
|
142
|
+
"needs_schema_extension",
|
|
143
|
+
]),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function predicateSuggestion(payload, statement) {
|
|
147
|
+
return (detectPredicateRules(payload, statement, CORE_PREDICATE_RULES) ??
|
|
148
|
+
detectPredicateRules(payload, statement, POLICY_PREDICATE_RULES) ??
|
|
149
|
+
detectPredicateRules(payload, statement, PRODUCT_PREDICATE_RULES) ??
|
|
150
|
+
detectPredicateRules(payload, statement, PRODUCT_TAIL_PREDICATE_RULES));
|
|
151
|
+
}
|
|
152
|
+
function modelingSuggestions(payload, modeled, clauses) {
|
|
153
|
+
if (!isRequirement(payload) || modeled)
|
|
154
|
+
return [];
|
|
155
|
+
const suggestions = [];
|
|
156
|
+
const seen = new Set();
|
|
157
|
+
const expectedClaimKeys = clauses
|
|
158
|
+
.filter((clause) => clause.normative)
|
|
159
|
+
.map((clause) => clause.claim_key);
|
|
160
|
+
const rawDeclaredClaimKeys = propertiesOf(payload).logic_claims;
|
|
161
|
+
const declaredClaimKeys = Array.isArray(rawDeclaredClaimKeys)
|
|
162
|
+
? rawDeclaredClaimKeys.filter((value) => typeof value === "string")
|
|
163
|
+
: [];
|
|
164
|
+
const mergedClaimKeys = Array.from(new Set([...declaredClaimKeys, ...expectedClaimKeys]));
|
|
165
|
+
for (const clause of clauses) {
|
|
166
|
+
const candidate = clause.text;
|
|
167
|
+
const rawSuggestion = predicateSuggestion(payload, candidate) ??
|
|
168
|
+
ontologyGapSuggestion(payload, candidate) ??
|
|
169
|
+
ambiguitySuggestion(payload, candidate) ??
|
|
170
|
+
detectStrictSuggestion(payload, candidate);
|
|
171
|
+
const suggestion = rawSuggestion
|
|
172
|
+
? withClauseProvenance(rawSuggestion, clause, mergedClaimKeys)
|
|
173
|
+
: clause.normative
|
|
174
|
+
? unmatchedClauseSuggestion(payload, clause, mergedClaimKeys)
|
|
175
|
+
: null;
|
|
176
|
+
if (!suggestion)
|
|
177
|
+
continue;
|
|
178
|
+
const key = `${suggestion.claim_key}:${suggestion.kind}:${suggestion.evidence}:${suggestion.suggested_next_tool}`;
|
|
179
|
+
if (!seen.has(key)) {
|
|
180
|
+
seen.add(key);
|
|
181
|
+
suggestions.push(suggestion);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return suggestions;
|
|
185
|
+
}
|
|
186
|
+
function withClauseProvenance(suggestion, clause, expectedClaimKeys) {
|
|
187
|
+
const applyPlan = suggestion.applyPlan.map((step) => {
|
|
188
|
+
if (!isRecord(step))
|
|
189
|
+
return step;
|
|
190
|
+
const properties = isRecord(step.properties) ? step.properties : null;
|
|
191
|
+
if (properties === null)
|
|
192
|
+
return step;
|
|
193
|
+
if (step.type === "req") {
|
|
194
|
+
const existing = Array.isArray(properties.logic_claims)
|
|
195
|
+
? properties.logic_claims.filter((value) => typeof value === "string")
|
|
196
|
+
: [];
|
|
197
|
+
return {
|
|
198
|
+
...step,
|
|
199
|
+
properties: {
|
|
200
|
+
...properties,
|
|
201
|
+
logic_claims: Array.from(new Set([...existing, ...expectedClaimKeys])),
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (step.type !== "fact")
|
|
206
|
+
return step;
|
|
207
|
+
return {
|
|
208
|
+
...step,
|
|
209
|
+
properties: {
|
|
210
|
+
...properties,
|
|
211
|
+
claim_key: clause.claim_key,
|
|
212
|
+
claim_text: clause.text,
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
});
|
|
216
|
+
return {
|
|
217
|
+
...suggestion,
|
|
218
|
+
claim_key: clause.claim_key,
|
|
219
|
+
claim_text: clause.text,
|
|
220
|
+
applyPlan,
|
|
221
|
+
...(suggestion.kind === "predicate" && suggestion.relationshipPlan !== null
|
|
222
|
+
? {
|
|
223
|
+
relationshipPlan: {
|
|
224
|
+
...suggestion.relationshipPlan,
|
|
225
|
+
claimKey: clause.claim_key,
|
|
226
|
+
claimText: clause.text,
|
|
227
|
+
logicClaims: expectedClaimKeys,
|
|
228
|
+
instructions: "Create the predicate fact, merge the returned logicClaims into the requirement logic_claims manifest, then add requires_predicate without overwriting other requirement metadata.",
|
|
229
|
+
},
|
|
230
|
+
}
|
|
231
|
+
: {}),
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function unmatchedClauseSuggestion(payload, clause, expectedClaimKeys) {
|
|
235
|
+
return withClauseProvenance({
|
|
236
|
+
kind: "ontology_gap",
|
|
237
|
+
claim_key: clause.claim_key,
|
|
238
|
+
claim_text: clause.text,
|
|
239
|
+
confidence: 0.6,
|
|
240
|
+
evidence: clause.text,
|
|
241
|
+
rationale: "This normative clause has no deterministic strict-property or declared predicate grounding. Define its domain terms and predicate signature explicitly before grounding it; keep it unresolved instead of treating prose as logic-complete.",
|
|
242
|
+
suggested_next_tool: "kb_suggest_predicates",
|
|
243
|
+
recommendedPredicateSchema: null,
|
|
244
|
+
applyPlan: observationPlan(payload, "Ontology gap: ungrounded clause", [
|
|
245
|
+
"semantic-advisor-suggestion",
|
|
246
|
+
"review:ontology-gap",
|
|
247
|
+
"needs_schema_extension",
|
|
248
|
+
]),
|
|
249
|
+
}, clause, expectedClaimKeys);
|
|
250
|
+
}
|
|
251
|
+
export function analyzeSemanticAdvisorInput(input) {
|
|
252
|
+
const payload = input.payload;
|
|
253
|
+
const requirement = isRequirement(payload);
|
|
254
|
+
const signals = requirement ? detectSignals(proseOf(payload)) : [];
|
|
255
|
+
const clauses = requirement
|
|
256
|
+
? extractSemanticClauses(statementOf(payload), input.clauses)
|
|
257
|
+
: [];
|
|
258
|
+
const rawDeclaredClaims = propertiesOf(payload).logic_claims;
|
|
259
|
+
const declaredClaims = Array.isArray(rawDeclaredClaims)
|
|
260
|
+
? rawDeclaredClaims.filter((value) => typeof value === "string")
|
|
261
|
+
: [];
|
|
262
|
+
const expectedClaims = clauses
|
|
263
|
+
.filter((clause) => clause.normative)
|
|
264
|
+
.map((clause) => clause.claim_key);
|
|
265
|
+
const modeled = requirement &&
|
|
266
|
+
isModeled(payload, expectedClaims.length) &&
|
|
267
|
+
expectedClaims.length > 0 &&
|
|
268
|
+
expectedClaims.every((claimKey) => declaredClaims.includes(claimKey));
|
|
269
|
+
const suggestions = modelingSuggestions(payload, modeled, clauses);
|
|
270
|
+
return buildAdvisorResult(payload, signals, modeled, suggestions, clauses);
|
|
271
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type SemanticClause = Readonly<{
|
|
2
|
+
claim_key: string;
|
|
3
|
+
text: string;
|
|
4
|
+
index: number;
|
|
5
|
+
normative: boolean;
|
|
6
|
+
source: "detected" | "supplied";
|
|
7
|
+
}>;
|
|
8
|
+
export declare function semanticClaimKey(text: string): string;
|
|
9
|
+
export declare function extractSemanticClauses(text: string, suppliedClauses?: readonly string[]): readonly SemanticClause[];
|
|
10
|
+
//# sourceMappingURL=clauses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clauses.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/clauses.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACjC,CAAC,CAAC;AAkBH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AAeD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,SAAS,cAAc,EAAE,CAgB3B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
const NORMATIVE_PATTERN = /\b(?:must|shall|should|required|requires?|may\s+only|only\s+.+?\s+(?:may|can)|must\s+not|shall\s+not|cannot|can't|forbidden|denied|defaults?\s+to|before|unless|when|if)\b/i;
|
|
3
|
+
function normalizeClause(value) {
|
|
4
|
+
return (value
|
|
5
|
+
.replace(/^\s*(?:[-*+]\s+|\d+[.)]\s+)/, "")
|
|
6
|
+
.replace(/\s+/g, " ")
|
|
7
|
+
// Clause splitters and copied list items commonly leave a conjunction
|
|
8
|
+
// comma or sentence punctuation on an otherwise identical atomic claim.
|
|
9
|
+
// Those formatting artifacts must not mint a second logical identity.
|
|
10
|
+
.replace(/[,.:;!?]+$/g, "")
|
|
11
|
+
.trim());
|
|
12
|
+
}
|
|
13
|
+
export function semanticClaimKey(text) {
|
|
14
|
+
const normalized = normalizeClause(text).toLowerCase();
|
|
15
|
+
const digest = createHash("sha256").update(normalized).digest("hex");
|
|
16
|
+
return `CLAIM-${digest.slice(0, 16).toUpperCase()}`;
|
|
17
|
+
}
|
|
18
|
+
function detectedClauses(text) {
|
|
19
|
+
return text
|
|
20
|
+
.split(/(?:\r?\n)+|;|(?<=[.!?])\s+(?=[A-Z0-9])/)
|
|
21
|
+
.flatMap((sentence) => {
|
|
22
|
+
if (/\bmutually\s+exclusive\b/i.test(sentence))
|
|
23
|
+
return [sentence];
|
|
24
|
+
return sentence.split(/\s+(?:,\s*)?and\s+(?=(?:the\s+)?[a-z][^.!?]{0,100}\b(?:must|shall|should|requires?|cannot|can't|expire|default|transition|states?\s+are)\b)/i);
|
|
25
|
+
})
|
|
26
|
+
.map(normalizeClause)
|
|
27
|
+
.filter(Boolean);
|
|
28
|
+
}
|
|
29
|
+
export function extractSemanticClauses(text, suppliedClauses) {
|
|
30
|
+
const source = suppliedClauses === undefined ? "detected" : "supplied";
|
|
31
|
+
const raw = suppliedClauses ?? detectedClauses(text);
|
|
32
|
+
const unique = Array.from(new Set(raw.map(normalizeClause).filter(Boolean)));
|
|
33
|
+
if (suppliedClauses !== undefined && unique.length === 0) {
|
|
34
|
+
throw new Error("Semantic advisor clauses must contain at least one non-empty atomic claim");
|
|
35
|
+
}
|
|
36
|
+
return unique.map((clause, index) => ({
|
|
37
|
+
claim_key: semanticClaimKey(clause),
|
|
38
|
+
text: clause,
|
|
39
|
+
index,
|
|
40
|
+
normative: source === "supplied" || NORMATIVE_PATTERN.test(clause),
|
|
41
|
+
source,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation-plan.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/observation-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAKb,MAAM,aAAa,CAAC;AAGrB,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAgB9C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { shortHash, sourceOf, statementOf, stringValue, } from "./shared.js";
|
|
2
|
+
// implements REQ-mcp-semantic-advisor-preflight
|
|
3
|
+
export function observationPlan(payload, title, tags) {
|
|
4
|
+
return [
|
|
5
|
+
{
|
|
6
|
+
type: "fact",
|
|
7
|
+
id: `FACT-OBS-${shortHash(`${stringValue(payload.id)}.${title}.${statementOf(payload)}`)}`,
|
|
8
|
+
properties: {
|
|
9
|
+
title,
|
|
10
|
+
status: "active",
|
|
11
|
+
source: sourceOf(payload),
|
|
12
|
+
fact_kind: "observation",
|
|
13
|
+
text_ref: statementOf(payload),
|
|
14
|
+
tags,
|
|
15
|
+
},
|
|
16
|
+
relationships: [],
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type MatchGroups, type Payload, normalizeKey, normalizePredicateToken, normalizeSubjectKey, singularize } from "./shared.js";
|
|
2
|
+
import type { SemanticModelingSuggestion } from "./types.js";
|
|
3
|
+
export { normalizeKey, normalizePredicateToken, normalizeSubjectKey, singularize, };
|
|
4
|
+
export interface PredicateRule {
|
|
5
|
+
readonly pattern: RegExp;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly args: (groups: MatchGroups) => readonly string[];
|
|
8
|
+
readonly rationale: string;
|
|
9
|
+
readonly polarity?: "assert" | "deny";
|
|
10
|
+
readonly accepts?: (statement: string) => boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function detectPredicateRules(payload: Payload, statement: string, rules: readonly PredicateRule[]): SemanticModelingSuggestion | null;
|
|
13
|
+
export declare function commaList(value: string, separator?: RegExp): string;
|
|
14
|
+
//# sourceMappingURL=predicate-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predicate-rule.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/predicate-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EAEnB,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,GACZ,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,SAAS,MAAM,EAAE,CAAC;IAC1D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CACnD;AAGD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,SAAS,aAAa,EAAE,GAC9B,0BAA0B,GAAG,IAAI,CAenC;AAGD,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAqB,GAC/B,MAAM,CAMR"}
|