kibi-cli 0.14.0 → 0.17.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/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 -211
- 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 +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +53 -95
- package/dist/commands/coverage.d.ts.map +1 -1
- package/dist/commands/coverage.js +12 -17
- package/dist/commands/discovery-shared.d.ts +2 -1
- package/dist/commands/discovery-shared.d.ts.map +1 -1
- package/dist/commands/discovery-shared.js +6 -18
- 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/manifest.d.ts +13 -2
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +31 -22
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +39 -1
- package/dist/extractors/markdown.d.ts +22 -2
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +50 -1
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +11 -1
- package/dist/logic/ir.d.ts +112 -0
- package/dist/logic/ir.d.ts.map +1 -0
- package/dist/logic/ir.js +729 -0
- 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/logic-modeling.d.ts +22 -0
- package/dist/operations/modeling/logic-modeling.d.ts.map +1 -0
- package/dist/operations/modeling/logic-modeling.js +111 -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 +164 -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 +117 -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 +163 -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 +94 -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 +62 -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 +64 -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 +61 -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 +142 -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 +88 -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 +132 -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 +120 -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 +693 -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 +31 -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 +19 -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 +195 -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 +20 -3
- package/dist/prolog.d.ts +5 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +89 -32
- package/dist/public/impact/diagnostics.d.ts.map +1 -1
- package/dist/public/impact/diagnostics.js +8 -4
- package/dist/public/impact/full-kb-quality.d.ts +1 -1
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +34 -1
- package/dist/public/impact/requirement-quality.d.ts.map +1 -1
- package/dist/public/impact/requirement-quality.js +6 -23
- package/dist/public/operations/catalog.d.ts +986 -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 +21 -0
- package/dist/public/operations/index.d.ts.map +1 -0
- package/dist/public/operations/index.js +19 -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 +65 -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 +142 -0
- package/dist/public/operations/specs/modeling.d.ts.map +1 -0
- package/dist/public/operations/specs/modeling.js +133 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts +268 -0
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -0
- package/dist/public/operations/specs/mutation-schemas.js +294 -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 +81 -0
- package/dist/public/operations/specs/semantic.d.ts.map +1 -0
- package/dist/public/operations/specs/semantic.js +137 -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 +291 -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 +317 -0
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +1 -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 +145 -99
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +112 -0
- package/dist/public/skills/kibi-usage/resources/logic-ir.md +43 -0
- package/dist/public/skills/kibi-usage/resources/operation-access.md +44 -0
- package/dist/public/skills/kibi-usage/resources/ui-requirements.md +96 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +41 -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 +9 -0
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.js +16 -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 +329 -3
- package/dist/traceability/staged-diagnostics.d.ts +2 -2
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +17 -10
- 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 +53 -24
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +17 -1
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +47 -1
- package/dist/types/entities.d.ts +3 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/types/relationships.d.ts +1 -1
- package/dist/types/relationships.d.ts.map +1 -1
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.js +24 -0
- package/dist/utils/schema-version.d.ts +1 -1
- package/dist/utils/schema-version.js +1 -1
- package/package.json +60 -2
- package/src/public/impact/diagnostics.ts +18 -11
- package/src/public/impact/full-kb-quality.ts +30 -3
- package/src/public/impact/requirement-quality.ts +6 -26
- 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 +20 -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 +75 -0
- package/src/public/operations/specs/discovery.ts +126 -0
- package/src/public/operations/specs/modeling.ts +174 -0
- package/src/public/operations/specs/mutation-schemas.ts +326 -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 +174 -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 +324 -1
- package/src/public/schemas/relationship.ts +1 -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 +145 -99
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +112 -0
- package/src/public/skills/kibi-usage/resources/logic-ir.md +43 -0
- package/src/public/skills/kibi-usage/resources/operation-access.md +44 -0
- package/src/public/skills/kibi-usage/resources/ui-requirements.md +96 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +41 -3
- package/src/public/skills.ts +18 -427
- package/src/public/symbol-granularity.ts +25 -0
- package/src/schemas/entity.schema.json +329 -3
- package/src/schemas/relationship.schema.json +1 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { OperationResult } from "../../public/operations/types.js";
|
|
2
|
+
export type AutopilotBootstrapContext = {
|
|
3
|
+
readonly projectSummary?: string;
|
|
4
|
+
readonly sourceOfTruthPaths?: readonly string[];
|
|
5
|
+
readonly sourceOfTruthNotes?: readonly string[];
|
|
6
|
+
readonly priorityRoots?: readonly string[];
|
|
7
|
+
readonly verificationAnchors?: readonly string[];
|
|
8
|
+
};
|
|
9
|
+
export type AutopilotGenerateArgs = {
|
|
10
|
+
readonly includeGenericMarkdown?: boolean;
|
|
11
|
+
readonly minConfidence?: number;
|
|
12
|
+
readonly maxCandidates?: number;
|
|
13
|
+
readonly entityTypes?: readonly ("req" | "scenario" | "test" | "adr" | "fact" | "symbol")[];
|
|
14
|
+
readonly bootstrapContext?: AutopilotBootstrapContext;
|
|
15
|
+
};
|
|
16
|
+
export type AutopilotConfidence = {
|
|
17
|
+
readonly score: number;
|
|
18
|
+
readonly level: "high" | "medium" | "low";
|
|
19
|
+
readonly reasons: readonly string[];
|
|
20
|
+
readonly policy: "full_actions" | "review_required" | "handoff_only";
|
|
21
|
+
};
|
|
22
|
+
export type AutopilotRecommendedAction = {
|
|
23
|
+
readonly order: number;
|
|
24
|
+
readonly kind: "query" | "upsert" | "check" | "handoff";
|
|
25
|
+
readonly description: string;
|
|
26
|
+
readonly candidateIds?: readonly string[];
|
|
27
|
+
};
|
|
28
|
+
export type AutopilotDeclaredContext = {
|
|
29
|
+
readonly projectSummary?: string;
|
|
30
|
+
readonly sourceOfTruthPaths: readonly string[];
|
|
31
|
+
readonly sourceOfTruthNotes: readonly string[];
|
|
32
|
+
readonly priorityRoots: readonly string[];
|
|
33
|
+
readonly verificationAnchors: readonly string[];
|
|
34
|
+
};
|
|
35
|
+
export type ActivationState = "root_uninitialized" | "root_partial" | "vendored_only" | "root_active_thin" | "root_active_seeded";
|
|
36
|
+
export type ActivationMode = "cold_start_bootstrap" | "repair_bootstrap" | "attached_thin_handoff" | "attached_seeded_handoff" | "vendored_blocked";
|
|
37
|
+
export declare const AUTOPILOT_PROVIDER_ORDER: readonly ["typed_kibi_docs", "generic_repo_docs", "repo_metadata", "repo_layout", "test_topology", "source_symbols"];
|
|
38
|
+
export type EvidenceProviderName = (typeof AUTOPILOT_PROVIDER_ORDER)[number];
|
|
39
|
+
export type EvidenceKind = "typed_markdown" | "symbol_manifest" | "generic_markdown" | "repo_metadata" | "repo_layout" | "test_topology" | "source_symbols";
|
|
40
|
+
export type ActivationPolicy = {
|
|
41
|
+
readonly activationState: ActivationState;
|
|
42
|
+
readonly activationMode: ActivationMode;
|
|
43
|
+
readonly applyBlocked: boolean;
|
|
44
|
+
readonly allowCandidateGeneration: boolean;
|
|
45
|
+
readonly reason: string;
|
|
46
|
+
readonly handoffMessage?: string;
|
|
47
|
+
};
|
|
48
|
+
export type AutopilotEvidence = {
|
|
49
|
+
readonly provider: EvidenceProviderName;
|
|
50
|
+
readonly kind: EvidenceKind;
|
|
51
|
+
readonly label: string;
|
|
52
|
+
readonly relativePath?: string;
|
|
53
|
+
readonly absolutePath?: string;
|
|
54
|
+
readonly content?: string;
|
|
55
|
+
readonly data: Readonly<Record<string, unknown>>;
|
|
56
|
+
};
|
|
57
|
+
export type DiscoverySummary = {
|
|
58
|
+
readonly activationState: ActivationState;
|
|
59
|
+
readonly activationMode: ActivationMode;
|
|
60
|
+
readonly applyBlocked: boolean;
|
|
61
|
+
readonly reason: string;
|
|
62
|
+
readonly handoffMessage?: string;
|
|
63
|
+
readonly vendored?: readonly string[];
|
|
64
|
+
readonly providersRun: readonly EvidenceProviderName[];
|
|
65
|
+
readonly providerCounts: Readonly<Record<string, number>>;
|
|
66
|
+
readonly detectedLanguages: readonly string[];
|
|
67
|
+
readonly detectedTestFrameworks: readonly string[];
|
|
68
|
+
readonly excludedRoots: readonly string[];
|
|
69
|
+
readonly truncated: boolean;
|
|
70
|
+
readonly scanWarnings: readonly string[];
|
|
71
|
+
};
|
|
72
|
+
export type DiscoveryResult = {
|
|
73
|
+
readonly activation: ActivationPolicy;
|
|
74
|
+
readonly evidence: readonly AutopilotEvidence[];
|
|
75
|
+
readonly ignoredSources: readonly string[];
|
|
76
|
+
readonly summary: DiscoverySummary;
|
|
77
|
+
readonly migrationWarning: string | null;
|
|
78
|
+
};
|
|
79
|
+
export type Candidate = {
|
|
80
|
+
readonly candidateId: string;
|
|
81
|
+
readonly entityType: string;
|
|
82
|
+
readonly title: string;
|
|
83
|
+
readonly sourceKind: string;
|
|
84
|
+
readonly sourcePath: string;
|
|
85
|
+
readonly confidence: number;
|
|
86
|
+
readonly confidenceBand: string;
|
|
87
|
+
readonly evidence: readonly string[];
|
|
88
|
+
readonly relationships: readonly {
|
|
89
|
+
readonly type: string;
|
|
90
|
+
readonly from: string;
|
|
91
|
+
readonly to: string;
|
|
92
|
+
}[];
|
|
93
|
+
readonly applyPlan: readonly Readonly<Record<string, unknown>>[];
|
|
94
|
+
};
|
|
95
|
+
export type SourceOnlySignal = {
|
|
96
|
+
readonly kind: "req" | "scenario" | "test";
|
|
97
|
+
readonly title: string;
|
|
98
|
+
readonly sourcePath: string;
|
|
99
|
+
readonly confidence: number;
|
|
100
|
+
readonly evidence: readonly string[];
|
|
101
|
+
};
|
|
102
|
+
export type AutopilotStructuredContent = Readonly<Record<string, unknown>> & {
|
|
103
|
+
readonly tldr: string;
|
|
104
|
+
readonly activationReason: string;
|
|
105
|
+
readonly candidates: readonly Readonly<Record<string, unknown>>[];
|
|
106
|
+
readonly applyPlan: readonly Readonly<Record<string, unknown>>[];
|
|
107
|
+
readonly suppressedCandidates: readonly Readonly<Record<string, unknown>>[];
|
|
108
|
+
};
|
|
109
|
+
export type AutopilotGenerateResult = OperationResult<AutopilotStructuredContent> & {
|
|
110
|
+
readonly structuredContent: AutopilotStructuredContent;
|
|
111
|
+
readonly migrationWarning: string | null;
|
|
112
|
+
readonly candidates: readonly Readonly<Record<string, unknown>>[];
|
|
113
|
+
readonly applyPlan: readonly Readonly<Record<string, unknown>>[];
|
|
114
|
+
readonly suppressedCandidates: readonly Readonly<Record<string, unknown>>[];
|
|
115
|
+
readonly payoffSummary: Readonly<Record<string, unknown>>;
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/operations/autopilot/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAC1C,QAAQ,CAAC,aAAa,CAAC,EAAE,M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,uBAAuB,GACjC,eAAe,CAAC,0BAA0B,CAAC,GAAG;IAC5C,QAAQ,CAAC,iBAAiB,EAAE,0BAA0B,CAAC;IACvD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,SAAS,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IACjE,QAAQ,CAAC,oBAAoB,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAC5E,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC3D,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type LogicRuleIR } from "../../logic/ir.js";
|
|
2
|
+
export interface LogicApplyPlanInput {
|
|
3
|
+
readonly text: string;
|
|
4
|
+
readonly logic: LogicRuleIR;
|
|
5
|
+
readonly source: string;
|
|
6
|
+
readonly requirementId?: string;
|
|
7
|
+
readonly existingLogicClaims?: readonly string[];
|
|
8
|
+
readonly claimKey?: string;
|
|
9
|
+
readonly claimText?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface LogicApplyPlanResult {
|
|
12
|
+
readonly normalized: LogicRuleIR;
|
|
13
|
+
readonly ruleHash: string;
|
|
14
|
+
readonly semanticKey: string;
|
|
15
|
+
readonly claimKey: string;
|
|
16
|
+
readonly claimText: string;
|
|
17
|
+
readonly renderedProlog: string;
|
|
18
|
+
readonly applyPlan: Array<Record<string, unknown>>;
|
|
19
|
+
}
|
|
20
|
+
export declare function logicRuleFactId(semanticKey: string): string;
|
|
21
|
+
export declare function buildLogicApplyPlan(input: LogicApplyPlanInput): LogicApplyPlanResult;
|
|
22
|
+
//# sourceMappingURL=logic-modeling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logic-modeling.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/logic-modeling.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACpD;AAUD,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,mBAAmB,GACzB,oBAAoB,CAwGtB"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { logicSemanticKey, utf8Span, validateLogicIr, } from "../../logic/ir.js";
|
|
3
|
+
import { semanticClaimKey } from "../semantic-advisor/clauses.js";
|
|
4
|
+
function shortId(value) {
|
|
5
|
+
return createHash("sha256")
|
|
6
|
+
.update(value)
|
|
7
|
+
.digest("hex")
|
|
8
|
+
.slice(0, 16)
|
|
9
|
+
.toUpperCase();
|
|
10
|
+
}
|
|
11
|
+
export function logicRuleFactId(semanticKey) {
|
|
12
|
+
return `FACT-RULE-${shortId(semanticKey)}`;
|
|
13
|
+
}
|
|
14
|
+
export function buildLogicApplyPlan(input) {
|
|
15
|
+
const validation = validateLogicIr(input.logic);
|
|
16
|
+
if (!validation.valid ||
|
|
17
|
+
!validation.normalized ||
|
|
18
|
+
!validation.ruleHash ||
|
|
19
|
+
!validation.semanticKey ||
|
|
20
|
+
!validation.renderedProlog) {
|
|
21
|
+
throw new Error(`Logic IR validation failed: ${validation.errors.join("; ")}`);
|
|
22
|
+
}
|
|
23
|
+
const claimText = input.claimText?.trim() || input.text.trim();
|
|
24
|
+
const claimKey = input.claimKey || semanticClaimKey(claimText);
|
|
25
|
+
const semanticKey = logicSemanticKey(validation.normalized);
|
|
26
|
+
const schemaId = validation.normalized.ruleSchemaId ?? "FACT-RULE-SCHEMA-LOGIC-V1";
|
|
27
|
+
const ruleId = logicRuleFactId(semanticKey);
|
|
28
|
+
const span = utf8Span(input.text, 0, input.text.length);
|
|
29
|
+
const logicClaims = Array.from(new Set([...(input.existingLogicClaims ?? []), claimKey]));
|
|
30
|
+
const schemaPlan = input.logic.ruleSchemaId
|
|
31
|
+
? []
|
|
32
|
+
: [
|
|
33
|
+
{
|
|
34
|
+
type: "fact",
|
|
35
|
+
id: schemaId,
|
|
36
|
+
properties: {
|
|
37
|
+
title: "kibi.logic.v1 rule schema",
|
|
38
|
+
status: "active",
|
|
39
|
+
source: input.source,
|
|
40
|
+
fact_kind: "rule_schema",
|
|
41
|
+
rule_name: "kibi.logic.v1",
|
|
42
|
+
argument_names: ["rule_ir"],
|
|
43
|
+
argument_types: ["logic_ir"],
|
|
44
|
+
aliases: ["conditional rule", "constraint", "policy rule"],
|
|
45
|
+
examples: [validation.renderedProlog],
|
|
46
|
+
},
|
|
47
|
+
relationships: [],
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
return {
|
|
51
|
+
normalized: validation.normalized,
|
|
52
|
+
ruleHash: validation.ruleHash,
|
|
53
|
+
semanticKey,
|
|
54
|
+
claimKey,
|
|
55
|
+
claimText,
|
|
56
|
+
renderedProlog: validation.renderedProlog,
|
|
57
|
+
applyPlan: [
|
|
58
|
+
...schemaPlan,
|
|
59
|
+
{
|
|
60
|
+
type: "fact",
|
|
61
|
+
id: ruleId,
|
|
62
|
+
properties: {
|
|
63
|
+
title: `${validation.normalized.kind} rule ${semanticKey}`,
|
|
64
|
+
status: "active",
|
|
65
|
+
source: input.source,
|
|
66
|
+
fact_kind: "rule",
|
|
67
|
+
rule_ir: validation.normalized,
|
|
68
|
+
rule_hash: validation.ruleHash,
|
|
69
|
+
semantic_key: semanticKey,
|
|
70
|
+
rule_schema_id: schemaId,
|
|
71
|
+
rule_name: validation.normalized.ruleSchemaId ?? "kibi.logic.v1",
|
|
72
|
+
canonical_key: semanticKey,
|
|
73
|
+
claim_key: claimKey,
|
|
74
|
+
claim_text: claimText,
|
|
75
|
+
claim_span_start: span.start,
|
|
76
|
+
claim_span_end: span.end,
|
|
77
|
+
tags: ["lane:logic", "logic-ir-v1"],
|
|
78
|
+
},
|
|
79
|
+
relationships: [],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: "req",
|
|
83
|
+
id: input.requirementId ?? `REQ-LOGIC-${shortId(claimText)}`,
|
|
84
|
+
properties: {
|
|
85
|
+
title: claimText.split(/[.!?]/, 1)[0] || "Typed logical requirement",
|
|
86
|
+
status: "open",
|
|
87
|
+
source: input.source,
|
|
88
|
+
text_ref: claimText,
|
|
89
|
+
logic_claims: logicClaims,
|
|
90
|
+
semantic_inventory: [
|
|
91
|
+
{
|
|
92
|
+
claim_key: claimKey,
|
|
93
|
+
claim_text: claimText,
|
|
94
|
+
role: "normative",
|
|
95
|
+
status: "modeled",
|
|
96
|
+
span,
|
|
97
|
+
semantic_key: semanticKey,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
relationships: [
|
|
102
|
+
{
|
|
103
|
+
type: "requires_rule",
|
|
104
|
+
from: input.requirementId ?? `REQ-LOGIC-${shortId(claimText)}`,
|
|
105
|
+
to: ruleId,
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OperationContext } from "../../public/operations/runtime-types.js";
|
|
2
|
+
import { strictWriteSetToApplyPlan, writeSetPrimaryEntityId } from "./requirement-applyplan.js";
|
|
3
|
+
import { estimateNormativeSignalConfidence, extractRequirementClaim } from "./requirement-modeler.js";
|
|
4
|
+
import type { ModelRequirementArgs, ModelRequirementResult } from "./requirement-types.js";
|
|
5
|
+
export type { ModelRequirementArgs, ModelRequirementResult, } from "./requirement-types.js";
|
|
6
|
+
export { estimateNormativeSignalConfidence, extractRequirementClaim, strictWriteSetToApplyPlan, writeSetPrimaryEntityId, };
|
|
7
|
+
export declare function getWorkspaceMigrationWarning(workspaceRoot: string): Promise<string | null>;
|
|
8
|
+
export declare function handleKbModelRequirement(_prolog: unknown, args: ModelRequirementArgs, workspaceRoot: string): Promise<ModelRequirementResult>;
|
|
9
|
+
export declare function executeModelRequirement(args: ModelRequirementArgs, context: OperationContext): Promise<ModelRequirementResult>;
|
|
10
|
+
//# sourceMappingURL=model-requirement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-requirement.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/model-requirement.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAIjF,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iCAAiC,EACjC,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAMhC,YAAY,EACV,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iCAAiC,EACjC,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,GACxB,CAAC;AAEF,wBAAsB,4BAA4B,CAChD,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgBxB;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,oBAAoB,EAC1B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,sBAAsB,CAAC,CA4IjC;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,sBAAsB,CAAC,CAEjC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { buildStrictWriteSet } from "../../public/check-types.js";
|
|
4
|
+
import { getSchemaVersionStatus } from "../../public/schema-version.js";
|
|
5
|
+
import { semanticClaimKey } from "../semantic-advisor/clauses.js";
|
|
6
|
+
import { buildLogicApplyPlan } from "./logic-modeling.js";
|
|
7
|
+
import { strictWriteSetToApplyPlan, writeSetPrimaryEntityId, } from "./requirement-applyplan.js";
|
|
8
|
+
import { estimateNormativeSignalConfidence, extractRequirementClaim, } from "./requirement-modeler.js";
|
|
9
|
+
import { normalizeOptionalString, normalizeSourceFiles, } from "./requirement-utils.js";
|
|
10
|
+
export { estimateNormativeSignalConfidence, extractRequirementClaim, strictWriteSetToApplyPlan, writeSetPrimaryEntityId, };
|
|
11
|
+
export async function getWorkspaceMigrationWarning(workspaceRoot) {
|
|
12
|
+
const configPath = path.join(workspaceRoot, ".kb", "config.json");
|
|
13
|
+
let rawConfig;
|
|
14
|
+
try {
|
|
15
|
+
rawConfig = await readFile(configPath, "utf8");
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(rawConfig);
|
|
22
|
+
return getSchemaVersionStatus(parsed ?? undefined).warning;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return "KB config schemaVersion could not be read and should be checked before applying automated modeling.";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export async function handleKbModelRequirement(_prolog, args, workspaceRoot) {
|
|
29
|
+
const extracted = extractRequirementClaim({
|
|
30
|
+
...args,
|
|
31
|
+
source: normalizeOptionalString(args.source) ??
|
|
32
|
+
normalizeSourceFiles(args.sourceFiles)[0] ??
|
|
33
|
+
"mcp://kibi/model-requirement",
|
|
34
|
+
});
|
|
35
|
+
if (args.logic !== undefined) {
|
|
36
|
+
const logicPlan = buildLogicApplyPlan({
|
|
37
|
+
text: args.text,
|
|
38
|
+
logic: args.logic,
|
|
39
|
+
source: extracted.source,
|
|
40
|
+
...(typeof args.requirementId === "string"
|
|
41
|
+
? { requirementId: args.requirementId }
|
|
42
|
+
: {}),
|
|
43
|
+
...(args.existingLogicClaims !== undefined
|
|
44
|
+
? { existingLogicClaims: args.existingLogicClaims }
|
|
45
|
+
: {}),
|
|
46
|
+
...(args.claimKey !== undefined ? { claimKey: args.claimKey } : {}),
|
|
47
|
+
...(args.claimText !== undefined ? { claimText: args.claimText } : {}),
|
|
48
|
+
});
|
|
49
|
+
const fallbackWriteSet = buildStrictWriteSet({
|
|
50
|
+
claim: extracted.claim,
|
|
51
|
+
statement: extracted.statement,
|
|
52
|
+
});
|
|
53
|
+
const migrationWarning = await getWorkspaceMigrationWarning(workspaceRoot);
|
|
54
|
+
const structuredContent = {
|
|
55
|
+
statement: extracted.statement,
|
|
56
|
+
claimKey: logicPlan.claimKey,
|
|
57
|
+
logicClaims: Array.from(new Set([...(args.existingLogicClaims ?? []), logicPlan.claimKey])),
|
|
58
|
+
source: extracted.source,
|
|
59
|
+
sourceFiles: extracted.sourceFiles,
|
|
60
|
+
claim: extracted.claim,
|
|
61
|
+
writeSet: fallbackWriteSet,
|
|
62
|
+
applyPlan: logicPlan.applyPlan,
|
|
63
|
+
isStrict: false,
|
|
64
|
+
confidence: args.confidence ?? 1,
|
|
65
|
+
extractionMode: extracted.extractionMode,
|
|
66
|
+
extractionWarnings: extracted.extractionWarnings,
|
|
67
|
+
warnings: [],
|
|
68
|
+
migrationWarning,
|
|
69
|
+
logic: {
|
|
70
|
+
semanticKey: logicPlan.semanticKey,
|
|
71
|
+
claimKey: logicPlan.claimKey,
|
|
72
|
+
claimText: logicPlan.claimText,
|
|
73
|
+
renderedProlog: logicPlan.renderedProlog,
|
|
74
|
+
normalized: logicPlan.normalized,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
content: [
|
|
79
|
+
{
|
|
80
|
+
type: "text",
|
|
81
|
+
text: `Modeled typed kibi.logic.v1 rule ${logicPlan.semanticKey}; apply the returned schema, rule, and requirement steps sequentially.`,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
structuredContent,
|
|
85
|
+
applyPlan: logicPlan.applyPlan,
|
|
86
|
+
writeSet: fallbackWriteSet,
|
|
87
|
+
migrationWarning,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const writeSet = buildStrictWriteSet({
|
|
91
|
+
claim: extracted.claim,
|
|
92
|
+
statement: extracted.statement,
|
|
93
|
+
});
|
|
94
|
+
const claimKey = semanticClaimKey(extracted.statement);
|
|
95
|
+
const logicClaims = Array.from(new Set([...(args.existingLogicClaims ?? []), claimKey]));
|
|
96
|
+
const applyPlan = strictWriteSetToApplyPlan(writeSet).map((step) => {
|
|
97
|
+
const properties = step.properties !== null && typeof step.properties === "object"
|
|
98
|
+
? step.properties
|
|
99
|
+
: {};
|
|
100
|
+
if (step.type === "fact") {
|
|
101
|
+
return {
|
|
102
|
+
...step,
|
|
103
|
+
properties: {
|
|
104
|
+
...properties,
|
|
105
|
+
claim_key: claimKey,
|
|
106
|
+
claim_text: extracted.statement,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
if (step.type === "req") {
|
|
111
|
+
return {
|
|
112
|
+
...step,
|
|
113
|
+
properties: { ...properties, logic_claims: logicClaims },
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return step;
|
|
117
|
+
});
|
|
118
|
+
const migrationWarning = await getWorkspaceMigrationWarning(workspaceRoot);
|
|
119
|
+
const warnings = writeSet.isStrict
|
|
120
|
+
? []
|
|
121
|
+
: [
|
|
122
|
+
{
|
|
123
|
+
kind: "low_confidence_observation_downgrade",
|
|
124
|
+
message: `Claim confidence ${writeSet.confidence.toFixed(2)} is below the strict threshold 0.70, so Kibi emitted an observation fact instead of strict subject/property facts.`,
|
|
125
|
+
nextAction: "If this is normative, provide subjectKey, propertyKey, operator, and value explicitly, then apply the returned strict write-set sequentially.",
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
const strictSummary = writeSet.isStrict
|
|
129
|
+
? `Modeled strict requirement into ${applyPlan.length} sequential applyPlan step(s).`
|
|
130
|
+
: "Modeled a non-blocking observation review artifact; deterministic claim extraction stayed below the strict threshold.";
|
|
131
|
+
const structuredContent = {
|
|
132
|
+
statement: extracted.statement,
|
|
133
|
+
claimKey,
|
|
134
|
+
logicClaims,
|
|
135
|
+
source: extracted.source,
|
|
136
|
+
sourceFiles: extracted.sourceFiles,
|
|
137
|
+
claim: extracted.claim,
|
|
138
|
+
writeSet,
|
|
139
|
+
applyPlan,
|
|
140
|
+
isStrict: writeSet.isStrict,
|
|
141
|
+
confidence: writeSet.confidence,
|
|
142
|
+
extractionMode: extracted.extractionMode,
|
|
143
|
+
extractionWarnings: extracted.extractionWarnings,
|
|
144
|
+
warnings,
|
|
145
|
+
migrationWarning,
|
|
146
|
+
};
|
|
147
|
+
return {
|
|
148
|
+
content: [
|
|
149
|
+
{
|
|
150
|
+
type: "text",
|
|
151
|
+
text: migrationWarning
|
|
152
|
+
? `${strictSummary} Migration warning included.`
|
|
153
|
+
: strictSummary,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
structuredContent,
|
|
157
|
+
applyPlan,
|
|
158
|
+
writeSet,
|
|
159
|
+
migrationWarning,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
export async function executeModelRequirement(args, context) {
|
|
163
|
+
return handleKbModelRequirement(context.prolog, args, context.workspaceRoot);
|
|
164
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PredicateSchemaCandidate, PredicateSuggestion, SuggestPredicatesArgs } from "./predicate-types.js";
|
|
2
|
+
export declare function buildSuggestion(schema: PredicateSchemaCandidate, text: string, subject: string, score: number): PredicateSuggestion;
|
|
3
|
+
export declare function buildPredicateApplyPlan(suggestion: PredicateSuggestion, args: SuggestPredicatesArgs): Array<Record<string, unknown>>;
|
|
4
|
+
export declare function buildRelationshipPlan(factId: string | undefined, requirementId: string | undefined, claimText?: string, existingLogicClaims?: readonly string[]): Record<string, unknown> | null;
|
|
5
|
+
export declare function buildGapApplyPlan(text: string, args: SuggestPredicatesArgs): Array<Record<string, unknown>>;
|
|
6
|
+
//# sourceMappingURL=predicate-applyplan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predicate-applyplan.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-applyplan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAI9B,wBAAgB,eAAe,CAC7B,MAAM,EAAE,wBAAwB,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,mBAAmB,CAuBrB;AAGD,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,mBAAmB,EAC/B,IAAI,EAAE,qBAAqB,GAC1B,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAgChC;AAGD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,SAAS,CAAC,EAAE,MAAM,EAClB,mBAAmB,GAAE,SAAS,MAAM,EAAO,GAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAwBhC;AAGD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,qBAAqB,GAC1B,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA+BhC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { semanticClaimKey } from "../semantic-advisor/clauses.js";
|
|
2
|
+
import { inferArgs } from "./predicate-inference.js";
|
|
3
|
+
import { schemaForCandidate } from "./predicate-loader.js";
|
|
4
|
+
import { hashId } from "./predicate-utils.js";
|
|
5
|
+
// implements REQ-mcp-suggest-predicates
|
|
6
|
+
export function buildSuggestion(schema, text, subject, score) {
|
|
7
|
+
const predicateArgs = inferArgs(schema, text, subject);
|
|
8
|
+
const canonicalKey = `${schema.predicate_name}(${predicateArgs.join(",")})`;
|
|
9
|
+
// Permission-style inference carries the deontic decision as its final
|
|
10
|
+
// argument. Preserve that polarity in the typed suggestion instead of
|
|
11
|
+
// silently turning a prohibition into an assertion.
|
|
12
|
+
const polarity = predicateArgs.at(-1) === "deny" ||
|
|
13
|
+
/\b(?:must\s+not|shall\s+not|never|cannot|can't|forbidden|prohibited)\b/i.test(text)
|
|
14
|
+
? "deny"
|
|
15
|
+
: "assert";
|
|
16
|
+
return {
|
|
17
|
+
id: hashId("SUGGEST", [schema.id, canonicalKey, text]),
|
|
18
|
+
predicate_name: schema.predicate_name,
|
|
19
|
+
predicate_args: predicateArgs,
|
|
20
|
+
canonical_key: canonicalKey,
|
|
21
|
+
polarity,
|
|
22
|
+
score,
|
|
23
|
+
rationale: `Matched ${schema.predicate_name} because the prose overlaps with ${schema.tags.join(", ")} cues.`,
|
|
24
|
+
schema: schemaForCandidate(schema),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
// implements REQ-mcp-suggest-predicates
|
|
28
|
+
export function buildPredicateApplyPlan(suggestion, args) {
|
|
29
|
+
const claimKey = semanticClaimKey(args.text);
|
|
30
|
+
const factId = hashId("FACT-PRED", [
|
|
31
|
+
args.requirementId ?? "",
|
|
32
|
+
args.source ?? "",
|
|
33
|
+
suggestion.canonical_key,
|
|
34
|
+
]);
|
|
35
|
+
return [
|
|
36
|
+
{
|
|
37
|
+
type: "fact",
|
|
38
|
+
id: factId,
|
|
39
|
+
properties: {
|
|
40
|
+
title: `Predicate: ${suggestion.canonical_key}`,
|
|
41
|
+
status: "active",
|
|
42
|
+
source: args.source ?? "mcp://kibi/suggest-predicates",
|
|
43
|
+
text_ref: args.source,
|
|
44
|
+
tags: [
|
|
45
|
+
"lane:ontology",
|
|
46
|
+
"predicate-suggestion",
|
|
47
|
+
...suggestion.schema.tags.map((tag) => `predicate:${tag}`),
|
|
48
|
+
],
|
|
49
|
+
fact_kind: "predicate",
|
|
50
|
+
predicate_name: suggestion.predicate_name,
|
|
51
|
+
predicate_args: suggestion.predicate_args,
|
|
52
|
+
canonical_key: suggestion.canonical_key,
|
|
53
|
+
polarity: suggestion.polarity,
|
|
54
|
+
claim_key: claimKey,
|
|
55
|
+
claim_text: args.text.trim(),
|
|
56
|
+
},
|
|
57
|
+
relationships: [],
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
// implements REQ-mcp-suggest-predicates
|
|
62
|
+
export function buildRelationshipPlan(factId, requirementId, claimText, existingLogicClaims = []) {
|
|
63
|
+
if (!factId || !requirementId)
|
|
64
|
+
return null;
|
|
65
|
+
const claimKey = claimText ? semanticClaimKey(claimText) : null;
|
|
66
|
+
const logicClaims = Array.from(new Set([...existingLogicClaims, ...(claimKey === null ? [] : [claimKey])]));
|
|
67
|
+
return {
|
|
68
|
+
applyAfter: factId,
|
|
69
|
+
requiresExistingReq: requirementId,
|
|
70
|
+
relationship: {
|
|
71
|
+
type: "requires_predicate",
|
|
72
|
+
from: requirementId,
|
|
73
|
+
to: factId,
|
|
74
|
+
},
|
|
75
|
+
...(claimText
|
|
76
|
+
? {
|
|
77
|
+
claimKey,
|
|
78
|
+
claimText: claimText.trim(),
|
|
79
|
+
logicClaims,
|
|
80
|
+
}
|
|
81
|
+
: {}),
|
|
82
|
+
instructions: "Apply the predicate fact first, update the requirement with the returned merged logicClaims manifest, then attach this relationship without overwriting other requirement metadata.",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// implements REQ-mcp-suggest-predicates
|
|
86
|
+
export function buildGapApplyPlan(text, args) {
|
|
87
|
+
const claimKey = semanticClaimKey(text);
|
|
88
|
+
const factId = hashId("FACT-ONTOLOGY-GAP", [
|
|
89
|
+
args.requirementId ?? "",
|
|
90
|
+
args.source ?? "",
|
|
91
|
+
text,
|
|
92
|
+
]);
|
|
93
|
+
return [
|
|
94
|
+
{
|
|
95
|
+
type: "fact",
|
|
96
|
+
id: factId,
|
|
97
|
+
properties: {
|
|
98
|
+
title: "Ontology gap: predicate schema needed",
|
|
99
|
+
status: "active",
|
|
100
|
+
source: args.source ?? "mcp://kibi/suggest-predicates",
|
|
101
|
+
text_ref: args.source,
|
|
102
|
+
tags: ["review:ontology-gap", "needs_schema_extension"],
|
|
103
|
+
fact_kind: "observation",
|
|
104
|
+
value_string: text,
|
|
105
|
+
claim_key: claimKey,
|
|
106
|
+
claim_text: text,
|
|
107
|
+
},
|
|
108
|
+
relationships: [
|
|
109
|
+
{
|
|
110
|
+
type: "relates_to",
|
|
111
|
+
from: factId,
|
|
112
|
+
to: "review:ontology-gap",
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predicate-catalog-1.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-catalog-1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,eAAO,MAAM,mBAAmB,EAAE,wBAAwB,EAmNzD,CAAC"}
|