kibi-cli 2.0.0 → 2.2.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/dist/cli-protocol.d.ts.map +1 -1
- package/dist/cli-protocol.js +3 -2
- package/dist/cli-register-proof.d.ts.map +1 -1
- package/dist/cli-register-proof.js +25 -1
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +6 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/commands/aggregated-checks.d.ts +7 -0
- package/dist/commands/aggregated-checks.d.ts.map +1 -1
- package/dist/commands/aggregated-checks.js +25 -1
- package/dist/commands/check-generated.d.ts +7 -0
- package/dist/commands/check-generated.d.ts.map +1 -0
- package/dist/commands/check-generated.js +192 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +24 -15
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +227 -25
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +3 -1
- package/dist/commands/github-init.d.ts +1 -1
- package/dist/commands/github-init.d.ts.map +1 -1
- package/dist/commands/github-init.js +1 -1
- package/dist/commands/init-helpers.d.ts +17 -2
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +136 -30
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +110 -15
- package/dist/commands/proof-explain.d.ts +10 -0
- package/dist/commands/proof-explain.d.ts.map +1 -0
- package/dist/commands/proof-explain.js +45 -0
- package/dist/commands/proof-impact.d.ts +7 -0
- package/dist/commands/proof-impact.d.ts.map +1 -0
- package/dist/commands/proof-impact.js +39 -0
- package/dist/commands/proof-migrate-legacy.js +1 -1
- package/dist/commands/proof-prune.js +1 -1
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +14 -22
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +17 -2
- package/dist/commands/sync/cache.d.ts +20 -1
- package/dist/commands/sync/cache.d.ts.map +1 -1
- package/dist/commands/sync/cache.js +51 -2
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +1 -1
- package/dist/commands/sync/manifest.d.ts +1 -0
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +18 -16
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +14 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +11 -3
- package/dist/engine.d.ts +29 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +259 -89
- package/dist/env/bootstrap.d.ts +84 -0
- package/dist/env/bootstrap.d.ts.map +1 -0
- package/dist/env/bootstrap.js +310 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +67 -29
- package/dist/extractors/markdown.d.ts +4 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +33 -3
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +1 -0
- package/dist/extractors/symbols-coordinator.d.ts +8 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +40 -0
- package/dist/extractors/symbols-ts.d.ts +8 -19
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +33 -503
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +68 -30
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +4 -3
- package/dist/operations/modeling/model-requirement.d.ts +1 -1
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +179 -9
- package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applyplan.js +14 -2
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +24 -0
- package/dist/operations/modeling/predicate-types.d.ts +4 -0
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-vocabulary.d.ts +54 -0
- package/dist/operations/modeling/predicate-vocabulary.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-vocabulary.js +169 -0
- package/dist/operations/modeling/requirement-types.d.ts +5 -0
- package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +30 -3
- package/dist/operations/modeling/vocabulary-alignment.d.ts +60 -0
- package/dist/operations/modeling/vocabulary-alignment.d.ts.map +1 -0
- package/dist/operations/modeling/vocabulary-alignment.js +178 -0
- package/dist/operations/mutation/contradictions.d.ts +3 -0
- package/dist/operations/mutation/contradictions.d.ts.map +1 -1
- package/dist/operations/mutation/contradictions.js +29 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +33 -1
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts +8 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.d.ts.map +1 -0
- package/dist/operations/mutation/predicate-vocabulary-guard.js +64 -0
- package/dist/operations/mutation/relationships.d.ts +1 -1
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +1 -0
- package/dist/operations/mutation/saga.d.ts +5 -0
- package/dist/operations/mutation/saga.d.ts.map +1 -1
- package/dist/operations/mutation/saga.js +10 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +2 -0
- package/dist/operations/mutation/source-authoring.d.ts +6 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +65 -26
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
- package/dist/operations/mutation/strict-fact.js +5 -0
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +9 -87
- package/dist/operations/mutation/types.d.ts +17 -0
- package/dist/operations/mutation/types.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.d.ts +6 -0
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +72 -4
- package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
- package/dist/operations/mutation/validate-upsert.js +24 -1
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +16 -3
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +61 -17
- package/dist/operations/planning/compile-intent.d.ts +49 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +66 -4
- package/dist/operations/proof/baseline-diff.d.ts +41 -0
- package/dist/operations/proof/baseline-diff.d.ts.map +1 -0
- package/dist/operations/proof/baseline-diff.js +153 -0
- package/dist/operations/proof/code-scope.d.ts +17 -0
- package/dist/operations/proof/code-scope.d.ts.map +1 -0
- package/dist/operations/proof/code-scope.js +60 -0
- package/dist/operations/proof/explain.d.ts +75 -0
- package/dist/operations/proof/explain.d.ts.map +1 -0
- package/dist/operations/proof/explain.js +294 -0
- package/dist/operations/proof/impact.d.ts +45 -0
- package/dist/operations/proof/impact.d.ts.map +1 -0
- package/dist/operations/proof/impact.js +118 -0
- package/dist/operations/proof/ingest-proof.d.ts +4 -2
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +251 -77
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
- package/dist/operations/proof/migrate-legacy-receipts.js +28 -22
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
- package/dist/operations/proof/prune-receipts.js +8 -6
- package/dist/operations/proof/receipt-document.js +2 -2
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +3 -9
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +18 -67
- package/dist/operations/semantic-advisor/plugin-orchestration.d.ts +63 -0
- package/dist/operations/semantic-advisor/plugin-orchestration.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/plugin-orchestration.js +489 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +15 -2
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-core.js +7 -140
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts +11 -12
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-launcher.js +6 -94
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +16 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-policy.js +7 -150
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +9 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +7 -102
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +13 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-product.js +7 -133
- package/dist/operations/semantic-advisor/types.d.ts +1 -0
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/plugins/compose-ontology-packs.d.ts +51 -0
- package/dist/plugins/compose-ontology-packs.d.ts.map +1 -0
- package/dist/plugins/compose-ontology-packs.js +257 -0
- package/dist/plugins/compose-semantic-classifier.d.ts +47 -0
- package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -0
- package/dist/plugins/compose-semantic-classifier.js +216 -0
- package/dist/plugins/compose-vocabulary-alignment.d.ts +23 -0
- package/dist/plugins/compose-vocabulary-alignment.d.ts.map +1 -0
- package/dist/plugins/compose-vocabulary-alignment.js +141 -0
- package/dist/plugins/external-allowlist.d.ts +17 -0
- package/dist/plugins/external-allowlist.d.ts.map +1 -0
- package/dist/plugins/external-allowlist.js +29 -0
- package/dist/plugins/index.d.ts +11 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +37 -0
- package/dist/plugins/load-plugin.d.ts +19 -0
- package/dist/plugins/load-plugin.d.ts.map +1 -0
- package/dist/plugins/load-plugin.js +59 -0
- package/dist/plugins/project-config.d.ts +28 -0
- package/dist/plugins/project-config.d.ts.map +1 -0
- package/dist/plugins/project-config.js +90 -0
- package/dist/plugins/registry.d.ts +94 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +359 -0
- package/dist/plugins/resolve-package.d.ts +47 -0
- package/dist/plugins/resolve-package.d.ts.map +1 -0
- package/dist/plugins/resolve-package.js +262 -0
- package/dist/plugins/source-analysis-service.d.ts +44 -0
- package/dist/plugins/source-analysis-service.d.ts.map +1 -0
- package/dist/plugins/source-analysis-service.js +232 -0
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +2 -0
- package/dist/prolog/janitor.d.ts.map +1 -1
- package/dist/prolog/janitor.js +1 -1
- package/dist/prolog/store-lock.d.ts +1 -1
- package/dist/prolog/store-lock.d.ts.map +1 -1
- package/dist/prolog.d.ts +36 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +78 -9
- package/dist/proof/inspect.js +1 -1
- package/dist/proof/producers/playwright-case-id.js +2 -2
- package/dist/proof/producers/playwright-reporter.js +4 -4
- package/dist/public/diagnostic-usage.d.ts.map +1 -1
- package/dist/public/diagnostic-usage.js +7 -25
- package/dist/public/extractors/symbols-coordinator.d.ts +1 -1
- package/dist/public/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/public/extractors/symbols-coordinator.js +1 -1
- package/dist/public/impact/analyzer.d.ts +1 -1
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +6 -4
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +4 -12
- package/dist/public/operations/catalog.d.ts +39 -7
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +11 -3
- package/dist/public/operations/check-helpers.d.ts +7 -1
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +22 -2
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +51 -12
- package/dist/public/operations/discovery-entities.d.ts +53 -1
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +219 -12
- package/dist/public/operations/discovery-executors.d.ts +1 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +93 -59
- package/dist/public/operations/migration-plan.d.ts +2 -0
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +50 -0
- package/dist/public/operations/predicate-schema-conformance.d.ts +41 -0
- package/dist/public/operations/predicate-schema-conformance.d.ts.map +1 -0
- package/dist/public/operations/predicate-schema-conformance.js +242 -0
- package/dist/public/operations/prolog-json.d.ts +1 -1
- package/dist/public/operations/prolog-json.d.ts.map +1 -1
- package/dist/public/operations/prolog-json.js +16 -10
- package/dist/public/operations/result-envelope.d.ts +34 -1
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +78 -2
- package/dist/public/operations/runtime-types.d.ts +17 -2
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +9 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/discovery.d.ts +10 -1
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +10 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +27 -4
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +21 -3
- package/dist/public/operations/specs/proof.js +1 -1
- package/dist/public/operations/specs/reporting.d.ts +9 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +48 -17
- package/dist/public/operations/specs/semantic.d.ts +1 -1
- package/dist/public/operations/specs/semantic.d.ts.map +1 -1
- package/dist/public/operations/specs/semantic.js +54 -4
- package/dist/public/operations/specs/upsert.d.ts +28 -5
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/specs/upsert.js +1 -1
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +11 -4
- package/dist/public/operations/types.d.ts +5 -0
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/proof-protocol.js +4 -4
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +22 -0
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +1 -0
- package/dist/public/skills/kibi-usage/SKILL.md +10 -3
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/dist/public/skills/kibi-usage/resources/proof.md +45 -0
- package/dist/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
- package/dist/public/skills/kibi-usage/resources/source-authoring.md +36 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +52 -1
- package/dist/public/symbol-granularity.d.ts +1 -1
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.js +38 -5
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +21 -5
- package/dist/relationships/shards.d.ts +6 -0
- package/dist/relationships/shards.d.ts.map +1 -1
- package/dist/relationships/shards.js +26 -19
- package/dist/report/html-report.css +1239 -281
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +18 -0
- package/dist/schemas/entity.schema.json +32 -0
- package/dist/traceability/staged-diagnostics.d.ts +1 -1
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-entity-id-style.d.ts +12 -0
- package/dist/traceability/staged-entity-id-style.d.ts.map +1 -0
- package/dist/traceability/staged-entity-id-style.js +68 -0
- package/dist/traceability/symbol-extract.d.ts +24 -7
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +64 -208
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +8 -0
- package/dist/traceability/validate.js +1 -1
- package/dist/types/entities.d.ts +2 -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/entity-id-style.d.ts +27 -0
- package/dist/utils/entity-id-style.d.ts.map +1 -0
- package/dist/utils/entity-id-style.js +81 -0
- package/dist/utils/git-repository-context.d.ts +50 -0
- package/dist/utils/git-repository-context.d.ts.map +1 -0
- package/dist/utils/git-repository-context.js +259 -0
- package/dist/utils/rule-registry.d.ts +5 -0
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.d.ts +42 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +50 -0
- package/dist/utils/strict-modeling.d.ts +7 -0
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +11 -0
- package/package.json +14 -11
- package/schema/entities.pl +60 -1
- package/schema/relationships.pl +17 -4
- package/schema/validation.pl +118 -20
- package/src/public/diagnostic-usage.ts +16 -24
- package/src/public/extractors/symbols-coordinator.ts +1 -0
- package/src/public/impact/analyzer.ts +15 -12
- package/src/public/impact/full-kb-quality.ts +4 -16
- package/src/public/operations/check-executor.ts +13 -2
- package/src/public/operations/check-helpers.ts +29 -3
- package/src/public/operations/contracts.ts +59 -12
- package/src/public/operations/discovery-entities.ts +327 -12
- package/src/public/operations/discovery-executors.ts +110 -61
- package/src/public/operations/migration-plan.ts +57 -0
- package/src/public/operations/predicate-schema-conformance.ts +362 -0
- package/src/public/operations/prolog-json.ts +22 -8
- package/src/public/operations/result-envelope.ts +114 -2
- package/src/public/operations/runtime-types.ts +22 -3
- package/src/public/operations/specs/check-rules.generated.ts +9 -1
- package/src/public/operations/specs/discovery.ts +11 -1
- package/src/public/operations/specs/mutation-schemas.ts +23 -3
- package/src/public/operations/specs/proof.ts +1 -1
- package/src/public/operations/specs/reporting.ts +71 -24
- package/src/public/operations/specs/semantic.ts +79 -17
- package/src/public/operations/specs/upsert.ts +1 -1
- package/src/public/operations/symbol-repair-plan.ts +16 -7
- package/src/public/operations/types.ts +5 -0
- package/src/public/proof-fingerprint.ts +1 -1
- package/src/public/proof-protocol-types.d.ts +1 -1
- package/src/public/proof-protocol.ts +4 -4
- package/src/public/schemas/entity.ts +22 -0
- package/src/public/schemas/relationship.ts +1 -0
- package/src/public/skills/kibi-usage/SKILL.md +10 -3
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/src/public/skills/kibi-usage/resources/proof.md +45 -0
- package/src/public/skills/kibi-usage/resources/relationship-directions.md +35 -17
- package/src/public/skills/kibi-usage/resources/source-authoring.md +36 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +52 -1
- package/src/public/symbol-granularity.generated.ts +45 -12
- package/src/public/symbol-granularity.ts +3 -3
- package/src/public/telemetry-acceptance.ts +37 -6
- package/src/schemas/entity.schema.json +32 -0
- package/src/schemas/relationship.schema.json +1 -0
|
@@ -9,11 +9,13 @@ import { loadEntities } from "../../public/operations/discovery-entities.js";
|
|
|
9
9
|
import { appendOnlyProofReceiptHistoryErrors } from "../../public/proof-receipt.js";
|
|
10
10
|
import { appendRelationship, computeShardPath, } from "../../relationships/shards.js";
|
|
11
11
|
import { resolveBranchAttachment } from "../../utils/branch-resolver.js";
|
|
12
|
+
import { entityIdStyleWarnings } from "../../utils/entity-id-style.js";
|
|
12
13
|
import { analyzeSemanticAdvisorInput } from "../semantic-advisor/analyze-prose.js";
|
|
13
14
|
import { assertLogicalGroundingClaimKeys, assertSemanticInventoryBoundary, } from "../semantic-advisor/ingestion-boundary.js";
|
|
14
15
|
import { buildUpsertCommitGoal, formatUpsertError } from "./contradictions.js";
|
|
16
|
+
import { assertPredicateArgumentVocabulary } from "./predicate-vocabulary-guard.js";
|
|
15
17
|
import { existingRelationships, validateLiveRelationshipTargets, validateRelationshipSources, validateStrictLanePairing, validateSupersedesSourceHistory, } from "./relationships.js";
|
|
16
|
-
import { MutationSaga } from "./saga.js";
|
|
18
|
+
import { MutationRollbackFailureError, MutationSaga } from "./saga.js";
|
|
17
19
|
import { writePendingSourceReceipt, writeSourceForUpsert, } from "./source-authoring.js";
|
|
18
20
|
import { acquireSymbolCompilerLock, releaseSymbolCompilerLock, } from "./symbol-compiler-lock.js";
|
|
19
21
|
import { validateSymbolGranularity } from "./symbol-granularity.js";
|
|
@@ -220,6 +222,7 @@ export async function executeUpsert(input, context, options = {}) {
|
|
|
220
222
|
semanticAdvisor = semantic.receipt;
|
|
221
223
|
assertSemanticInventoryBoundary({ ...input, relationships }, relationships, semantic.receipt);
|
|
222
224
|
await assertLogicalGroundingClaimKeys(prolog, { ...input, relationships }, relationships);
|
|
225
|
+
await assertPredicateArgumentVocabulary(prolog, validated.entity);
|
|
223
226
|
if (context.fs !== undefined && context.sourceFirst !== false) {
|
|
224
227
|
const existingRows = await loadEntities(prolog, {
|
|
225
228
|
id: input.id,
|
|
@@ -329,6 +332,57 @@ export async function executeUpsert(input, context, options = {}) {
|
|
|
329
332
|
source: sourceWrite.receipt.path,
|
|
330
333
|
};
|
|
331
334
|
}
|
|
335
|
+
if (options.deferCompiledCommit === true) {
|
|
336
|
+
let deferredState = "prepared";
|
|
337
|
+
let rollbackPromise;
|
|
338
|
+
const deferredCommit = {
|
|
339
|
+
entity: commitEntity ?? validated.entity,
|
|
340
|
+
relationships: validated.relationships,
|
|
341
|
+
skipContradictionCheck: input._skipContradictionCheck === true,
|
|
342
|
+
get state() {
|
|
343
|
+
return deferredState;
|
|
344
|
+
},
|
|
345
|
+
finalize: () => {
|
|
346
|
+
if (deferredState !== "prepared") {
|
|
347
|
+
throw new Error(`Cannot finalize deferred upsert ${input.id} from state ${deferredState}`);
|
|
348
|
+
}
|
|
349
|
+
saga.markCommitted();
|
|
350
|
+
deferredState = "committed";
|
|
351
|
+
},
|
|
352
|
+
rollback: () => {
|
|
353
|
+
if (deferredState === "committed") {
|
|
354
|
+
return Promise.reject(new Error(`Cannot roll back deferred upsert ${input.id} after its compiled commit`));
|
|
355
|
+
}
|
|
356
|
+
if (deferredState === "rolled_back")
|
|
357
|
+
return Promise.resolve([]);
|
|
358
|
+
if (rollbackPromise !== undefined)
|
|
359
|
+
return rollbackPromise;
|
|
360
|
+
deferredState = "rolling_back";
|
|
361
|
+
rollbackPromise = saga.rollback().then((failures) => {
|
|
362
|
+
deferredState = "rolled_back";
|
|
363
|
+
return failures;
|
|
364
|
+
});
|
|
365
|
+
return rollbackPromise;
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
return {
|
|
369
|
+
content: [
|
|
370
|
+
{
|
|
371
|
+
type: "text",
|
|
372
|
+
text: `Prepared ${input.id} for a batched proof commit.`,
|
|
373
|
+
},
|
|
374
|
+
],
|
|
375
|
+
structuredContent: {
|
|
376
|
+
created: 0,
|
|
377
|
+
updated: 0,
|
|
378
|
+
relationships_created: validated.relationships.length,
|
|
379
|
+
warnings: semantic.warnings,
|
|
380
|
+
semanticAdvisor: semantic.receipt,
|
|
381
|
+
deferredCommit,
|
|
382
|
+
...(sourceWrite ? { sourceWrites: [sourceWrite.receipt] } : {}),
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
}
|
|
332
386
|
const transaction = buildUpsertCommitGoal({
|
|
333
387
|
entity: commitEntity ?? validated.entity,
|
|
334
388
|
relationships: validated.relationships,
|
|
@@ -349,6 +403,15 @@ export async function executeUpsert(input, context, options = {}) {
|
|
|
349
403
|
}
|
|
350
404
|
const coverage = await scenarioCoverageWarnings(prolog, validated.relationships, input.type, input.id);
|
|
351
405
|
const created = changeKind === "created" ? 1 : 0;
|
|
406
|
+
const idStyleWarnings = created === 1
|
|
407
|
+
? entityIdStyleWarnings({
|
|
408
|
+
id: input.id,
|
|
409
|
+
sourcePath: sourceWrite?.receipt.path ??
|
|
410
|
+
(typeof validated.entity.source === "string"
|
|
411
|
+
? validated.entity.source
|
|
412
|
+
: undefined),
|
|
413
|
+
})
|
|
414
|
+
: [];
|
|
352
415
|
const shardWarnings = [];
|
|
353
416
|
const relationshipSourceWrites = [];
|
|
354
417
|
for (const [shardPath, before] of relationshipShardBefore) {
|
|
@@ -382,7 +445,12 @@ export async function executeUpsert(input, context, options = {}) {
|
|
|
382
445
|
created,
|
|
383
446
|
updated: changeKind === "updated" ? 1 : 0,
|
|
384
447
|
relationships_created: validated.relationships.length,
|
|
385
|
-
warnings: [
|
|
448
|
+
warnings: [
|
|
449
|
+
...semantic.warnings,
|
|
450
|
+
...coverage,
|
|
451
|
+
...idStyleWarnings,
|
|
452
|
+
...shardWarnings,
|
|
453
|
+
],
|
|
386
454
|
semanticAdvisor: semantic.receipt,
|
|
387
455
|
...(shardWarnings.length > 0
|
|
388
456
|
? {
|
|
@@ -480,7 +548,7 @@ export async function executeUpsert(input, context, options = {}) {
|
|
|
480
548
|
}
|
|
481
549
|
const coordinateFailure = rollbackFailures.find((failure) => failure.step === "symbol-coordinates");
|
|
482
550
|
if (coordinateFailure !== undefined) {
|
|
483
|
-
const failure = new
|
|
551
|
+
const failure = new MutationRollbackFailureError([error, coordinateFailure.error], `Upsert failed and coordinate artifact rollback failed for ${input.id}`, rollbackFailures);
|
|
484
552
|
operationFailure = { error: failure };
|
|
485
553
|
throw failure;
|
|
486
554
|
}
|
|
@@ -489,7 +557,7 @@ export async function executeUpsert(input, context, options = {}) {
|
|
|
489
557
|
const rollbackMessage = sourceFailure.error instanceof Error
|
|
490
558
|
? sourceFailure.error.message
|
|
491
559
|
: String(sourceFailure.error);
|
|
492
|
-
const failure = new
|
|
560
|
+
const failure = new MutationRollbackFailureError([error, sourceFailure.error], `Upsert failed and authored source rollback failed for ${input.id}: ${rollbackMessage}`, rollbackFailures);
|
|
493
561
|
operationFailure = { error: failure };
|
|
494
562
|
throw failure;
|
|
495
563
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validate-upsert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validate-upsert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAcxE,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAerE,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAoGjD"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
// implements REQ-kibi-operation-interface-parity
|
|
2
|
+
import { escapeAtom } from "../../prolog/codec.js";
|
|
3
|
+
import { entityIdStyleWarnings } from "../../utils/entity-id-style.js";
|
|
1
4
|
import { analyzeSemanticAdvisorInput } from "../semantic-advisor/analyze-prose.js";
|
|
2
5
|
import { assertLogicalGroundingClaimKeys, assertSemanticInventoryBoundary, validateSemanticInventoryBoundary, } from "../semantic-advisor/ingestion-boundary.js";
|
|
6
|
+
import { assertPredicateArgumentVocabulary } from "./predicate-vocabulary-guard.js";
|
|
3
7
|
import { validateLiveRelationshipTargets, validateRelationshipSources, } from "./relationships.js";
|
|
4
8
|
import { validateSymbolGranularity } from "./symbol-granularity.js";
|
|
5
9
|
import { effectiveRelationships, validateAppendOnlyProofReceipts, } from "./upsert.js";
|
|
6
10
|
import { validateUpsertInput } from "./validation.js";
|
|
11
|
+
// implements REQ-kibi-entity-id-style
|
|
12
|
+
async function entityExists(prolog, id) {
|
|
13
|
+
const result = await prolog.query(`once(kb_entity('${escapeAtom(id)}', _Type, _Props))`);
|
|
14
|
+
return result.success;
|
|
15
|
+
}
|
|
7
16
|
export async function executeValidateUpsert(input, context) {
|
|
8
17
|
try {
|
|
9
18
|
const validated = validateUpsertInput(input, context.clock());
|
|
@@ -26,11 +35,25 @@ export async function executeValidateUpsert(input, context) {
|
|
|
26
35
|
assertSemanticInventoryBoundary({ ...input, relationships }, relationships, semantic.receipt);
|
|
27
36
|
if (context.prolog !== undefined) {
|
|
28
37
|
await assertLogicalGroundingClaimKeys(context.prolog, { ...input, relationships }, relationships);
|
|
38
|
+
await assertPredicateArgumentVocabulary(context.prolog, validated.entity);
|
|
29
39
|
}
|
|
40
|
+
// Style warnings apply only to entities this upsert would create, so the
|
|
41
|
+
// existence read happens only when the ID actually has a style issue.
|
|
42
|
+
const candidateIdStyleWarnings = entityIdStyleWarnings({
|
|
43
|
+
id: input.id,
|
|
44
|
+
sourcePath: typeof validated.entity.source === "string"
|
|
45
|
+
? validated.entity.source
|
|
46
|
+
: undefined,
|
|
47
|
+
});
|
|
48
|
+
const idStyleWarnings = candidateIdStyleWarnings.length > 0 &&
|
|
49
|
+
context.prolog &&
|
|
50
|
+
!(await entityExists(context.prolog, input.id))
|
|
51
|
+
? candidateIdStyleWarnings
|
|
52
|
+
: [];
|
|
30
53
|
const payload = {
|
|
31
54
|
valid: true,
|
|
32
55
|
errors: [],
|
|
33
|
-
warnings: semantic.warnings,
|
|
56
|
+
warnings: [...semantic.warnings, ...idStyleWarnings],
|
|
34
57
|
semanticAdvisor: semantic.receipt,
|
|
35
58
|
normalizedPreview: validated.entity,
|
|
36
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validation.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAO5C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validation.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAO5C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA6F/D,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,IAAI,GACR,eAAe,CA4DjB;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -11,7 +11,19 @@ const schema = entitySchema;
|
|
|
11
11
|
const properties = schema.properties !== null && typeof schema.properties === "object"
|
|
12
12
|
? schema.properties
|
|
13
13
|
: {};
|
|
14
|
-
|
|
14
|
+
// Compiled on first mutation: every CLI command imports this module, and
|
|
15
|
+
// most never validate an upsert.
|
|
16
|
+
let entityValidator;
|
|
17
|
+
let relationshipValidator;
|
|
18
|
+
function entitySchemaValidator() {
|
|
19
|
+
entityValidator ??= ajv.compile(upsertEntitySchema);
|
|
20
|
+
return entityValidator;
|
|
21
|
+
}
|
|
22
|
+
function relationshipSchemaValidator() {
|
|
23
|
+
relationshipValidator ??= ajv.compile(relationshipSchema);
|
|
24
|
+
return relationshipValidator;
|
|
25
|
+
}
|
|
26
|
+
const upsertEntitySchema = {
|
|
15
27
|
...schema,
|
|
16
28
|
properties: {
|
|
17
29
|
...properties,
|
|
@@ -27,8 +39,7 @@ const validateEntity = ajv.compile({
|
|
|
27
39
|
},
|
|
28
40
|
symbol_role: { type: "string", enum: [...SYMBOL_ROLES] },
|
|
29
41
|
},
|
|
30
|
-
}
|
|
31
|
-
const validateRelationship = ajv.compile(relationshipSchema);
|
|
42
|
+
};
|
|
32
43
|
const ALIASES = new Map([
|
|
33
44
|
["subjectKey", "subject_key"],
|
|
34
45
|
["propertyKey", "property_key"],
|
|
@@ -83,6 +94,7 @@ export function validateUpsertInput(input, now) {
|
|
|
83
94
|
entity.created_at ??= now.toISOString();
|
|
84
95
|
entity.updated_at ??= now.toISOString();
|
|
85
96
|
entity.source ??= "mcp://kibi/upsert";
|
|
97
|
+
const validateEntity = entitySchemaValidator();
|
|
86
98
|
if (!validateEntity(entity)) {
|
|
87
99
|
throw new Error(`Entity validation failed: ${formatEntityErrors(entity, validateEntity.errors ?? [])}`);
|
|
88
100
|
}
|
|
@@ -105,6 +117,7 @@ export function validateUpsertInput(input, now) {
|
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
const relationships = input.relationships ?? [];
|
|
120
|
+
const validateRelationship = relationshipSchemaValidator();
|
|
108
121
|
relationships.forEach((relationship, index) => {
|
|
109
122
|
if (!validateRelationship(relationship)) {
|
|
110
123
|
const details = (validateRelationship.errors ?? [])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/apply-plan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/apply-plan.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAGjF,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,uBAAuB,CAAC;AAwB/B,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAGhB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAG/B,eAAO,MAAM,yBAAyB,EAAG,2BAAoC,CAAC;AAmI9E,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,IAAI,CAMN;AAED,wBAAgB,mCAAmC,CACjD,SAAS,EAAE,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,EACnE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,IAAI,CAaN;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,SAAS,cAAoB,GAC5B,eAAe,EAAE,CA2CnB;AAy+CD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IACT,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE,eAAe,CAAC;CACpC,CAAC,CA2BD"}
|
|
@@ -5,14 +5,15 @@ import { OperationError } from "../../cli-errors.js";
|
|
|
5
5
|
import { branchEnsureCommand, branchMigrateCommand, branchRecoverCommand, } from "../../commands/branch.js";
|
|
6
6
|
import { migrateCommand } from "../../commands/migrate.js";
|
|
7
7
|
import { syncCommand } from "../../commands/sync.js";
|
|
8
|
+
import { loadEntities } from "../../public/operations/discovery-entities.js";
|
|
8
9
|
import { executeStatus } from "../../public/operations/discovery-executors.js";
|
|
9
|
-
import { migrationPlanHash, } from "../../public/operations/migration-plan.js";
|
|
10
|
+
import { PREDICATE_SCHEMA_ALIGNMENT_CODE, migrationPlanHash, } from "../../public/operations/migration-plan.js";
|
|
10
11
|
import { readMigrationConfigStatus } from "../../public/operations/migration-plan.js";
|
|
11
12
|
import { readWorkspaceSnapshot } from "../../public/operations/workspace-snapshot.js";
|
|
12
13
|
import { isDerivedKbPath } from "../../utils/kb-paths.js";
|
|
13
14
|
import { bootstrapEmptyKbSnapshotId, bootstrapPlanHash, } from "../bootstrap/types.js";
|
|
14
15
|
import { executeDelete } from "../mutation/delete.js";
|
|
15
|
-
import { writePendingSourceReceipt } from "../mutation/source-authoring.js";
|
|
16
|
+
import { retirePendingSourceReceipt, writePendingSourceReceipt, } from "../mutation/source-authoring.js";
|
|
16
17
|
import { executeUpsert } from "../mutation/upsert.js";
|
|
17
18
|
import { acquireWorkspaceMutationLock, releaseWorkspaceMutationLock, } from "../mutation/workspace-mutation-lock.js";
|
|
18
19
|
import { compilePlanHash, } from "./compile-intent.js";
|
|
@@ -37,6 +38,21 @@ function isRecord(value) {
|
|
|
37
38
|
function digest(value) {
|
|
38
39
|
return createHash("sha256").update(value).digest("hex");
|
|
39
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Reconcile pending-source receipts with committed source writes: a written
|
|
43
|
+
* file is bound to its exact bytes until Git tracks it, and a deleted file
|
|
44
|
+
* must not leave a receipt that later syncs would report as missing.
|
|
45
|
+
*/
|
|
46
|
+
function reconcilePendingSourceReceipts(workspaceRoot, writes) {
|
|
47
|
+
for (const write of writes) {
|
|
48
|
+
if ((write.mode ?? "write") === "delete") {
|
|
49
|
+
retirePendingSourceReceipt(workspaceRoot, write.path);
|
|
50
|
+
}
|
|
51
|
+
else if (write.afterHash !== null) {
|
|
52
|
+
writePendingSourceReceipt(workspaceRoot, write.path, write.afterHash);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
40
56
|
function relationships(step) {
|
|
41
57
|
if (!Array.isArray(step.relationships))
|
|
42
58
|
return [];
|
|
@@ -356,11 +372,7 @@ async function applySourceWrites(context, writes, planHash, allowReplay = false,
|
|
|
356
372
|
throw new Error(`MUTATION_ALREADY_COMMITTED: source plan ${planHash} already crossed the authoritative commit boundary; use kb_apply_plan recoveryJournalId=${journalId} instead of retrying the original mutation`);
|
|
357
373
|
}
|
|
358
374
|
onCommitted();
|
|
359
|
-
|
|
360
|
-
if (entry.mode === "write" && entry.afterHash !== null) {
|
|
361
|
-
writePendingSourceReceipt(context.workspaceRoot, entry.path, entry.afterHash);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
375
|
+
reconcilePendingSourceReceipts(context.workspaceRoot, prior.entries);
|
|
364
376
|
return { paths: priorPaths, rollback: async () => undefined, journalId };
|
|
365
377
|
}
|
|
366
378
|
}
|
|
@@ -518,11 +530,7 @@ async function applySourceWrites(context, writes, planHash, allowReplay = false,
|
|
|
518
530
|
// A newly authored file is intentionally excluded from ordinary Git
|
|
519
531
|
// discovery until the operator stages it. The receipt binds that pending
|
|
520
532
|
// input to the exact bytes committed by this plan.
|
|
521
|
-
|
|
522
|
-
if ((write.mode ?? "write") === "write" && write.afterHash !== null) {
|
|
523
|
-
writePendingSourceReceipt(context.workspaceRoot, write.path, write.afterHash);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
533
|
+
reconcilePendingSourceReceipts(context.workspaceRoot, writes);
|
|
526
534
|
}
|
|
527
535
|
catch (error) {
|
|
528
536
|
if (sourceCommitted) {
|
|
@@ -609,11 +617,7 @@ async function executeSourceRecovery(args, context, onCommitted = () => undefine
|
|
|
609
617
|
});
|
|
610
618
|
}
|
|
611
619
|
const sourceWrites = await applySourceWrites(context, writes, journal.planHash, true, onCommitted);
|
|
612
|
-
|
|
613
|
-
if (write.mode === "write" && write.afterHash !== null) {
|
|
614
|
-
writePendingSourceReceipt(context.workspaceRoot, write.path, write.afterHash);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
620
|
+
reconcilePendingSourceReceipts(context.workspaceRoot, writes);
|
|
617
621
|
const sync = await syncCommand({
|
|
618
622
|
workspaceRoot: context.workspaceRoot,
|
|
619
623
|
rebuild: true,
|
|
@@ -1272,6 +1276,7 @@ async function executeApplyPlanUnlocked(args, context, onCommitted = () => undef
|
|
|
1272
1276
|
structuredContent: payload,
|
|
1273
1277
|
};
|
|
1274
1278
|
}
|
|
1279
|
+
// implements REQ-agent-guided-migration-orchestration, REQ-cli-canonical-runtime, REQ-KIBI-BOOTSTRAP-PLAN, REQ-kibi-change-to-proof-plan-compiler, REQ-kibi-predicate-vocabulary-migration
|
|
1275
1280
|
export async function executeApplyPlan(args, context) {
|
|
1276
1281
|
if (!context.fs || context.sourceMutationLockHeld === true)
|
|
1277
1282
|
return executeApplyPlanUnlocked(args, context);
|
|
@@ -1508,7 +1513,46 @@ async function applyMigrationAction(action, context) {
|
|
|
1508
1513
|
throw new Error("Coordinate refresh did not complete successfully.");
|
|
1509
1514
|
return;
|
|
1510
1515
|
}
|
|
1516
|
+
case PREDICATE_SCHEMA_ALIGNMENT_CODE:
|
|
1517
|
+
await applyPredicateSchemaAlignment(action, context);
|
|
1518
|
+
return;
|
|
1511
1519
|
default:
|
|
1512
1520
|
throw new Error(`Migration action '${action.code}' has no automatic executor.`);
|
|
1513
1521
|
}
|
|
1514
1522
|
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Replay the planned kb_upsert for one predicate fact after confirming the
|
|
1525
|
+
* fact still has the namespace and alias spellings the plan was built from.
|
|
1526
|
+
*/
|
|
1527
|
+
// implements REQ-kibi-predicate-vocabulary-migration
|
|
1528
|
+
async function applyPredicateSchemaAlignment(action, context) {
|
|
1529
|
+
const invocation = action.invocation;
|
|
1530
|
+
if (invocation.kind !== "operation" || invocation.name !== "kb_upsert")
|
|
1531
|
+
throw new Error("Predicate schema alignment requires its planned kb_upsert invocation.");
|
|
1532
|
+
const input = asUpsert(invocation.input);
|
|
1533
|
+
if (input.type !== "fact")
|
|
1534
|
+
throw new Error("Predicate schema alignment only rewrites fact entities.");
|
|
1535
|
+
const prolog = context.prolog ?? (await context.ensureProlog?.());
|
|
1536
|
+
if (!prolog)
|
|
1537
|
+
throw new Error("Predicate schema alignment requires a Prolog runtime.");
|
|
1538
|
+
const operationContext = { ...context, prolog, sourceFirst: true };
|
|
1539
|
+
const [current] = await loadEntities(prolog, { type: "fact", id: input.id });
|
|
1540
|
+
const evidence = action.evidence;
|
|
1541
|
+
const currentNamespace = typeof current?.predicate_namespace === "string" &&
|
|
1542
|
+
current.predicate_namespace !== ""
|
|
1543
|
+
? current.predicate_namespace
|
|
1544
|
+
: "default";
|
|
1545
|
+
const currentArgs = Array.isArray(current?.predicate_args)
|
|
1546
|
+
? current.predicate_args
|
|
1547
|
+
: [];
|
|
1548
|
+
const rewrites = Array.isArray(evidence.rewrites) ? evidence.rewrites : [];
|
|
1549
|
+
const unchanged = current !== undefined &&
|
|
1550
|
+
current.fact_kind === "predicate" &&
|
|
1551
|
+
currentNamespace === evidence.namespace &&
|
|
1552
|
+
rewrites.every((rewrite) => isRecord(rewrite) &&
|
|
1553
|
+
typeof rewrite.index === "number" &&
|
|
1554
|
+
currentArgs[rewrite.index] === rewrite.from);
|
|
1555
|
+
if (!unchanged)
|
|
1556
|
+
throw new Error(`Predicate fact ${input.id} changed since planning; rerun kibi check and approve the new plan.`);
|
|
1557
|
+
await executeUpsert(input, operationContext);
|
|
1558
|
+
}
|
|
@@ -90,6 +90,55 @@ export type CompilePlanV1 = Readonly<{
|
|
|
90
90
|
steps: readonly PlanStep[];
|
|
91
91
|
sourceWrites: readonly SourceWritePlan[];
|
|
92
92
|
diagnostics: readonly string[];
|
|
93
|
+
/** Bounded replace/augment/shadow provenance; never changes canonical steps. */
|
|
94
|
+
capabilityPlugins?: Readonly<{
|
|
95
|
+
stamps: readonly {
|
|
96
|
+
pluginId: string;
|
|
97
|
+
pluginVersion: string;
|
|
98
|
+
capability: string;
|
|
99
|
+
mode: string;
|
|
100
|
+
external: boolean;
|
|
101
|
+
network: boolean;
|
|
102
|
+
metered: boolean;
|
|
103
|
+
fallbackUsed?: boolean;
|
|
104
|
+
model?: string;
|
|
105
|
+
}[];
|
|
106
|
+
classification: Readonly<{
|
|
107
|
+
fallbackUsed: boolean;
|
|
108
|
+
decisions: readonly {
|
|
109
|
+
claimKey: string;
|
|
110
|
+
lane: string;
|
|
111
|
+
confidence: number;
|
|
112
|
+
}[];
|
|
113
|
+
shadowComparisons: readonly {
|
|
114
|
+
pluginId: string;
|
|
115
|
+
pluginVersion: string;
|
|
116
|
+
capability: string;
|
|
117
|
+
mode: string;
|
|
118
|
+
external: boolean;
|
|
119
|
+
network: boolean;
|
|
120
|
+
metered: boolean;
|
|
121
|
+
fallbackUsed?: boolean;
|
|
122
|
+
model?: string;
|
|
123
|
+
decisions: readonly {
|
|
124
|
+
claimKey: string;
|
|
125
|
+
lane: string;
|
|
126
|
+
confidence: number;
|
|
127
|
+
}[];
|
|
128
|
+
}[];
|
|
129
|
+
}> | null;
|
|
130
|
+
ontology: Readonly<{
|
|
131
|
+
replaced: boolean;
|
|
132
|
+
matchCount: number;
|
|
133
|
+
shadowMatchCount: number;
|
|
134
|
+
shadowMatches: readonly {
|
|
135
|
+
packId: string;
|
|
136
|
+
schemaId: string;
|
|
137
|
+
predicateName: string;
|
|
138
|
+
confidence: number;
|
|
139
|
+
}[];
|
|
140
|
+
}>;
|
|
141
|
+
}>;
|
|
93
142
|
}>;
|
|
94
143
|
export type SourceWritePlan = Readonly<{
|
|
95
144
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-intent.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/compile-intent.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"compile-intent.d.ts","sourceRoot":"","sources":["../../../src/operations/planning/compile-intent.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc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IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AA0eH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC;IACT,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE,aAAa,CAAC;CAClC,CAAC,CA4WD"}
|
|
@@ -2,11 +2,12 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { dump as dumpYaml } from "js-yaml";
|
|
4
4
|
import { executeIntentSearch, } from "../../intent-search.js";
|
|
5
|
+
import { publicCapabilityStamp } from "../../plugins/compose-semantic-classifier.js";
|
|
5
6
|
import { normalizeEntityId, parseTriples } from "../../prolog/codec.js";
|
|
6
7
|
import { loadEntities } from "../../public/operations/discovery-entities.js";
|
|
7
8
|
import { executeStatus } from "../../public/operations/discovery-executors.js";
|
|
8
9
|
import { configuredSourceTarget } from "../mutation/source-authoring.js";
|
|
9
|
-
import {
|
|
10
|
+
import { analyzeSemanticAdvisorInputWithPlugins } from "../semantic-advisor/plugin-orchestration.js";
|
|
10
11
|
import { canonicalize } from "../semantic-advisor/shared.js";
|
|
11
12
|
// implements REQ-kibi-change-to-proof-plan-compiler
|
|
12
13
|
export const COMPILE_PLAN_VERSION = "kibi.compile-plan.v1";
|
|
@@ -445,7 +446,9 @@ export async function executeCompileIntent(args, context) {
|
|
|
445
446
|
diagnostics.push("Update target is unresolved: supply requirementId or improve the top candidate score and margin.");
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
|
-
|
|
449
|
+
// A caller-chosen ID names the requirement by what it governs and wins;
|
|
450
|
+
// the content-hash ID is only a fallback when none is supplied.
|
|
451
|
+
if (args.mode === "create" && !explicitId)
|
|
449
452
|
requirementId = generatedRequirementId(intent);
|
|
450
453
|
if (!requirementId)
|
|
451
454
|
throw new Error("Compile intent failed: could not determine requirementId");
|
|
@@ -471,7 +474,7 @@ export async function executeCompileIntent(args, context) {
|
|
|
471
474
|
const source = text(args.sourceLocations?.[0]?.path) ||
|
|
472
475
|
text(existingEntity.source) ||
|
|
473
476
|
"mcp://kibi/compile-intent";
|
|
474
|
-
const
|
|
477
|
+
const orchestrated = await analyzeSemanticAdvisorInputWithPlugins({
|
|
475
478
|
payload: {
|
|
476
479
|
type: "req",
|
|
477
480
|
id: requirementId,
|
|
@@ -486,9 +489,65 @@ export async function executeCompileIntent(args, context) {
|
|
|
486
489
|
},
|
|
487
490
|
},
|
|
488
491
|
...(args.clauses ? { clauses: args.clauses } : {}),
|
|
489
|
-
...(args.interpretations
|
|
492
|
+
...(args.interpretations
|
|
493
|
+
? { interpretations: args.interpretations }
|
|
494
|
+
: {}),
|
|
495
|
+
}, {
|
|
496
|
+
operationName: "kb_compile_intent",
|
|
497
|
+
...(context.ensurePlugins
|
|
498
|
+
? { ensurePlugins: context.ensurePlugins }
|
|
499
|
+
: {}),
|
|
490
500
|
});
|
|
501
|
+
const advisor = orchestrated.analysis;
|
|
491
502
|
diagnostics.push(...advisor.warnings);
|
|
503
|
+
if (orchestrated.stamps.length > 0) {
|
|
504
|
+
diagnostics.push(`Capability plugins consulted: ${orchestrated.stamps
|
|
505
|
+
.map((stamp) => `${stamp.pluginId}/${stamp.capability}`)
|
|
506
|
+
.join(", ")}.`);
|
|
507
|
+
}
|
|
508
|
+
const semanticShadowCount = orchestrated.classification?.shadowComparisons.length ?? 0;
|
|
509
|
+
if (semanticShadowCount > 0) {
|
|
510
|
+
diagnostics.push(`Semantic classifier shadow comparisons observed (${semanticShadowCount}); canonical compile plan unchanged.`);
|
|
511
|
+
}
|
|
512
|
+
if (orchestrated.ontologyShadowMatches.length > 0) {
|
|
513
|
+
diagnostics.push(`Ontology pack shadow matches observed (${orchestrated.ontologyShadowMatches.length}); canonical compile plan unchanged.`);
|
|
514
|
+
}
|
|
515
|
+
const capabilityPlugins = orchestrated.stamps.length > 0 ||
|
|
516
|
+
semanticShadowCount > 0 ||
|
|
517
|
+
orchestrated.ontologyShadowMatches.length > 0
|
|
518
|
+
? {
|
|
519
|
+
stamps: orchestrated.stamps.map((stamp) => publicCapabilityStamp(stamp)),
|
|
520
|
+
classification: orchestrated.classification
|
|
521
|
+
? {
|
|
522
|
+
fallbackUsed: orchestrated.classification.fallbackUsed,
|
|
523
|
+
decisions: orchestrated.classification.decisions.map((decision) => ({
|
|
524
|
+
claimKey: decision.claimKey,
|
|
525
|
+
lane: decision.lane,
|
|
526
|
+
confidence: decision.confidence,
|
|
527
|
+
})),
|
|
528
|
+
shadowComparisons: orchestrated.classification.shadowComparisons.map((comparison) => ({
|
|
529
|
+
...publicCapabilityStamp(comparison.stamp),
|
|
530
|
+
decisions: comparison.decisions.map((decision) => ({
|
|
531
|
+
claimKey: decision.claimKey,
|
|
532
|
+
lane: decision.lane,
|
|
533
|
+
confidence: decision.confidence,
|
|
534
|
+
})),
|
|
535
|
+
})),
|
|
536
|
+
}
|
|
537
|
+
: null,
|
|
538
|
+
ontology: {
|
|
539
|
+
replaced: orchestrated.ontologyCatalog?.replaced ?? false,
|
|
540
|
+
matchCount: orchestrated.ontologyMatches.length,
|
|
541
|
+
shadowMatchCount: orchestrated.ontologyShadowMatches.length,
|
|
542
|
+
shadowMatches: orchestrated.ontologyShadowMatches.map((candidate) => ({
|
|
543
|
+
packId: candidate.packId,
|
|
544
|
+
schemaId: candidate.schemaId,
|
|
545
|
+
predicateName: candidate.predicateName,
|
|
546
|
+
confidence: candidate.confidence,
|
|
547
|
+
})),
|
|
548
|
+
},
|
|
549
|
+
}
|
|
550
|
+
: undefined;
|
|
492
551
|
const suggestionByClaim = new Map(advisor.receipt.suggestions.map((suggestion) => [
|
|
493
552
|
suggestion.claim_key,
|
|
494
553
|
suggestion,
|
|
@@ -602,8 +661,11 @@ export async function executeCompileIntent(args, context) {
|
|
|
602
661
|
sourceWrites,
|
|
603
662
|
diagnostics,
|
|
604
663
|
};
|
|
664
|
+
// Shadow/provenance metadata is returned for observation but must not enter
|
|
665
|
+
// planHash — shadow providers never affect canonical apply identity.
|
|
605
666
|
const plan = {
|
|
606
667
|
...planBody,
|
|
668
|
+
...(capabilityPlugins ? { capabilityPlugins } : {}),
|
|
607
669
|
planHash: compilePlanHash(planBody),
|
|
608
670
|
};
|
|
609
671
|
return {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const PROOF_BASELINE_VERSION = "kibi.proof-baseline.v2";
|
|
2
|
+
export type RequirementFingerprint = {
|
|
3
|
+
readonly proofStatus: string;
|
|
4
|
+
readonly gaps: readonly string[];
|
|
5
|
+
readonly uncoveredSymbols: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
export type RequirementFingerprints = Readonly<Record<string, RequirementFingerprint>>;
|
|
8
|
+
export type CoverageRowLike = {
|
|
9
|
+
readonly id?: unknown;
|
|
10
|
+
readonly proofStatus?: unknown;
|
|
11
|
+
readonly proofGaps?: unknown;
|
|
12
|
+
readonly proofStages?: {
|
|
13
|
+
readonly productionSymbols?: {
|
|
14
|
+
readonly uncoveredSymbols?: unknown;
|
|
15
|
+
readonly explanations?: unknown;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type FingerprintChange = {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly kind: "added" | "removed" | "changed";
|
|
22
|
+
readonly before?: RequirementFingerprint;
|
|
23
|
+
readonly after?: RequirementFingerprint;
|
|
24
|
+
};
|
|
25
|
+
export declare function fingerprintRequirements(rows: readonly CoverageRowLike[]): RequirementFingerprints;
|
|
26
|
+
export declare function diffFingerprints(baseline: RequirementFingerprints | undefined, current: RequirementFingerprints): FingerprintChange[];
|
|
27
|
+
type ExplanationLike = {
|
|
28
|
+
readonly symbolId?: unknown;
|
|
29
|
+
readonly reason?: unknown;
|
|
30
|
+
readonly coverageCandidates?: unknown;
|
|
31
|
+
};
|
|
32
|
+
export declare function explanationsForRequirement(rows: readonly CoverageRowLike[], requirementId: string): readonly ExplanationLike[];
|
|
33
|
+
export declare function renderRequirementDiffs(changes: readonly FingerprintChange[], rows?: readonly CoverageRowLike[]): string;
|
|
34
|
+
export declare function parseSpawnJson(result: {
|
|
35
|
+
readonly error?: unknown;
|
|
36
|
+
readonly status?: number | null;
|
|
37
|
+
readonly stdout?: string | null;
|
|
38
|
+
readonly stderr?: string | null;
|
|
39
|
+
}): unknown;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=baseline-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline-diff.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/baseline-diff.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAC5C,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CACvC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE;QACrB,QAAQ,CAAC,iBAAiB,CAAC,EAAE;YAC3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