kibi-cli 2.1.0 → 2.3.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-operation-loader.d.ts.map +1 -1
- package/dist/cli-operation-loader.js +3 -0
- package/dist/cli-operation-metadata.d.ts +4 -0
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +5 -0
- package/dist/cli-protocol.d.ts.map +1 -1
- package/dist/cli-protocol.js +3 -2
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +4 -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-diff.d.ts +5 -0
- package/dist/commands/check-diff.d.ts.map +1 -0
- package/dist/commands/check-diff.js +62 -0
- package/dist/commands/check-generated.d.ts.map +1 -1
- package/dist/commands/check-generated.js +41 -18
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +231 -86
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +168 -53
- 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 +10 -3
- 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 +123 -23
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +110 -15
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +10 -18
- 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.map +1 -1
- package/dist/commands/sync/manifest.js +3 -1
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +8 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +11 -3
- package/dist/engine.d.ts +41 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +377 -80
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +66 -28
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +14 -3
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +1 -0
- package/dist/extractors/symbols-coordinator.d.ts +7 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +75 -39
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +68 -29
- 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 +176 -10
- 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-inference-1.js +1 -1
- 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/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 +213 -52
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
- package/dist/operations/mutation/strict-fact.js +5 -0
- 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 +77 -11
- 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 +66 -26
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +3 -1
- 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/ingest-proof.d.ts +4 -2
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +208 -74
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
- package/dist/operations/proof/migrate-legacy-receipts.js +7 -5
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -1
- package/dist/operations/proof/prune-receipts.js +7 -5
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +7 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +26 -4
- package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +7 -1
- package/dist/performance-trace.d.ts +17 -0
- package/dist/performance-trace.d.ts.map +1 -0
- package/dist/performance-trace.js +134 -0
- package/dist/plugins/approved-source-analyzers.d.ts +13 -0
- package/dist/plugins/approved-source-analyzers.d.ts.map +1 -0
- package/dist/plugins/approved-source-analyzers.generated.d.ts +71 -0
- package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -0
- package/dist/plugins/approved-source-analyzers.generated.js +77 -0
- package/dist/plugins/approved-source-analyzers.js +3 -0
- package/dist/plugins/compose-semantic-classifier.d.ts +6 -1
- package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -1
- package/dist/plugins/compose-semantic-classifier.js +8 -3
- 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 +7 -0
- package/dist/plugins/external-allowlist.d.ts.map +1 -1
- package/dist/plugins/external-allowlist.js +13 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/maintenance-source-analysis.d.ts +14 -0
- package/dist/plugins/maintenance-source-analysis.d.ts.map +1 -0
- package/dist/plugins/maintenance-source-analysis.js +191 -0
- package/dist/plugins/registry.d.ts +3 -1
- package/dist/plugins/registry.d.ts.map +1 -1
- package/dist/plugins/registry.js +27 -1
- package/dist/plugins/source-analysis-service.d.ts +36 -1
- package/dist/plugins/source-analysis-service.d.ts.map +1 -1
- package/dist/plugins/source-analysis-service.js +184 -27
- package/dist/plugins/source-change-analysis.d.ts +15 -0
- package/dist/plugins/source-change-analysis.d.ts.map +1 -0
- package/dist/plugins/source-change-analysis.js +54 -0
- package/dist/plugins/source-classification.d.ts +41 -0
- package/dist/plugins/source-classification.d.ts.map +1 -0
- package/dist/plugins/source-classification.js +490 -0
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +2 -0
- package/dist/prolog/swipl-resolver.d.ts +88 -0
- package/dist/prolog/swipl-resolver.d.ts.map +1 -0
- package/dist/prolog/swipl-resolver.js +446 -0
- package/dist/prolog.d.ts +51 -1
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +145 -15
- package/dist/public/diagnostic-usage.d.ts.map +1 -1
- package/dist/public/diagnostic-usage.js +7 -25
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +56 -5
- package/dist/public/impact/diagnostics.d.ts.map +1 -1
- package/dist/public/impact/diagnostics.js +3 -1
- 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/impact/manifest.d.ts.map +1 -1
- package/dist/public/impact/manifest.js +15 -1
- package/dist/public/impact/source-changes.d.ts.map +1 -1
- package/dist/public/impact/source-changes.js +35 -27
- package/dist/public/impact/types.d.ts +2 -0
- package/dist/public/impact/types.d.ts.map +1 -1
- package/dist/public/operations/catalog.d.ts +80 -7
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/catalog.js +2 -0
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +10 -2
- package/dist/public/operations/check-helpers.d.ts +6 -0
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +21 -1
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +325 -8
- package/dist/public/operations/discovery-entities.d.ts +42 -2
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +195 -22
- 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 +75 -46
- package/dist/public/operations/impact-review-preparation.d.ts +14 -0
- package/dist/public/operations/impact-review-preparation.d.ts.map +1 -0
- package/dist/public/operations/impact-review-preparation.js +379 -0
- package/dist/public/operations/index.d.ts +2 -0
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +2 -0
- 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/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +1 -35
- 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.map +1 -1
- package/dist/public/operations/prolog-json.js +9 -3
- package/dist/public/operations/proof-receipt-projection.d.ts +5 -0
- package/dist/public/operations/proof-receipt-projection.d.ts.map +1 -0
- package/dist/public/operations/proof-receipt-projection.js +36 -0
- 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 +1 -1
- 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 +8 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/discovery.d.ts +7 -1
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +7 -1
- package/dist/public/operations/specs/impact-review-preparation.d.ts +47 -0
- package/dist/public/operations/specs/impact-review-preparation.d.ts.map +1 -0
- package/dist/public/operations/specs/impact-review-preparation.js +43 -0
- 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/reporting.d.ts +8 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +46 -15
- 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 +8 -3
- package/dist/public/operations/types.d.ts +1 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- 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 +7 -3
- package/dist/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -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/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/schemas/entity.schema.json +32 -0
- package/dist/traceability/analysis-gate.d.ts +39 -0
- package/dist/traceability/analysis-gate.d.ts.map +1 -0
- package/dist/traceability/analysis-gate.js +51 -0
- package/dist/traceability/git-change-snapshot.d.ts +27 -0
- package/dist/traceability/git-change-snapshot.d.ts.map +1 -0
- package/dist/traceability/git-change-snapshot.js +411 -0
- package/dist/traceability/git-staged.d.ts +5 -1
- package/dist/traceability/git-staged.d.ts.map +1 -1
- package/dist/traceability/git-staged.js +16 -11
- package/dist/traceability/impact-evaluator.d.ts +54 -0
- package/dist/traceability/impact-evaluator.d.ts.map +1 -0
- package/dist/traceability/impact-evaluator.js +270 -0
- package/dist/traceability/impact-git-tree.d.ts +12 -0
- package/dist/traceability/impact-git-tree.d.ts.map +1 -0
- package/dist/traceability/impact-git-tree.js +46 -0
- package/dist/traceability/impact-knowledge.d.ts +16 -0
- package/dist/traceability/impact-knowledge.d.ts.map +1 -0
- package/dist/traceability/impact-knowledge.js +165 -0
- package/dist/traceability/impact-policy.d.ts +15 -0
- package/dist/traceability/impact-policy.d.ts.map +1 -0
- package/dist/traceability/impact-policy.js +48 -0
- package/dist/traceability/impact-policy.v1.schema.json +48 -0
- package/dist/traceability/impact-pr-diff.d.ts +5 -0
- package/dist/traceability/impact-pr-diff.d.ts.map +1 -0
- package/dist/traceability/impact-pr-diff.js +83 -0
- package/dist/traceability/impact-record-validation.d.ts +9 -0
- package/dist/traceability/impact-record-validation.d.ts.map +1 -0
- package/dist/traceability/impact-record-validation.js +113 -0
- package/dist/traceability/impact-review.d.ts +148 -0
- package/dist/traceability/impact-review.d.ts.map +1 -0
- package/dist/traceability/impact-review.js +494 -0
- package/dist/traceability/impact-review.schema.json +365 -0
- package/dist/traceability/impact-side-evidence.d.ts +13 -0
- package/dist/traceability/impact-side-evidence.d.ts.map +1 -0
- package/dist/traceability/impact-side-evidence.js +240 -0
- package/dist/traceability/reviewed-coordinate-refresh.d.ts +10 -0
- package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +1 -0
- package/dist/traceability/reviewed-coordinate-refresh.js +49 -0
- package/dist/traceability/snapshot-knowledge.d.ts +4 -0
- package/dist/traceability/snapshot-knowledge.d.ts.map +1 -0
- package/dist/traceability/snapshot-knowledge.js +98 -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/staged-file-coverage.d.ts +23 -0
- package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
- package/dist/traceability/staged-impact-contract.d.ts.map +1 -1
- package/dist/traceability/staged-impact-contract.js +2 -16
- package/dist/traceability/staged-symbols-manifest.d.ts +4 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +17 -6
- package/dist/traceability/symbol-extract.d.ts +3 -5
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +49 -34
- package/dist/traceability/temp-kb.d.ts +1 -1
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +57 -13
- package/dist/traceability/trusted-pr-event.d.ts +13 -0
- package/dist/traceability/trusted-pr-event.d.ts.map +1 -0
- package/dist/traceability/trusted-pr-event.js +105 -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/canonical-path.d.ts +3 -0
- package/dist/utils/canonical-path.d.ts.map +1 -0
- package/dist/utils/canonical-path.js +33 -0
- 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 +37 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +44 -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 -5
- 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/impact/analyzer.ts +88 -5
- package/src/public/impact/diagnostics.ts +7 -5
- package/src/public/impact/full-kb-quality.ts +4 -16
- package/src/public/impact/manifest.ts +14 -1
- package/src/public/impact/source-changes.ts +39 -34
- package/src/public/impact/types.ts +5 -0
- package/src/public/operations/catalog.ts +2 -0
- package/src/public/operations/check-executor.ts +12 -1
- package/src/public/operations/check-helpers.ts +27 -1
- package/src/public/operations/contracts.ts +404 -9
- package/src/public/operations/discovery-entities.ts +292 -23
- package/src/public/operations/discovery-executors.ts +91 -55
- package/src/public/operations/impact-review-preparation.ts +548 -0
- package/src/public/operations/index.ts +2 -0
- package/src/public/operations/migration-plan.ts +57 -0
- package/src/public/operations/node-ports.ts +1 -39
- package/src/public/operations/predicate-schema-conformance.ts +362 -0
- package/src/public/operations/prolog-json.ts +9 -3
- package/src/public/operations/proof-receipt-projection.ts +39 -0
- package/src/public/operations/result-envelope.ts +114 -2
- package/src/public/operations/runtime-types.ts +1 -1
- package/src/public/operations/specs/check-rules.generated.ts +8 -1
- package/src/public/operations/specs/discovery.ts +8 -1
- package/src/public/operations/specs/impact-review-preparation.ts +46 -0
- package/src/public/operations/specs/mutation-schemas.ts +23 -3
- package/src/public/operations/specs/reporting.ts +69 -22
- package/src/public/operations/specs/upsert.ts +1 -1
- package/src/public/operations/symbol-repair-plan.ts +13 -3
- package/src/public/operations/types.ts +1 -0
- package/src/public/schemas/entity.ts +22 -0
- package/src/public/schemas/relationship.ts +1 -0
- package/src/public/skills/kibi-usage/SKILL.md +7 -3
- package/src/public/skills/kibi-usage/resources/fact-lanes.md +4 -0
- package/src/public/skills/kibi-usage/resources/operation-access.md +1 -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/telemetry-acceptance.ts +37 -6
- package/src/schemas/entity.schema.json +32 -0
- package/src/schemas/relationship.schema.json +1 -0
- package/src/traceability/impact-policy.v1.schema.json +48 -0
- package/src/traceability/impact-review.schema.json +365 -0
- package/templates/github/kibi-badge.yml +0 -4
- package/templates/github/kibi-report.yml +0 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { resolveBoundSymbolScope } from "../../extractors/manifest.js";
|
|
3
|
+
import { loadCoveredBySymbolsByTest, receiptCodeScopeSymbolIds, } from "./code-scope.js";
|
|
3
4
|
import { evaluateContractAgainstRun, } from "../../proof/evaluate.js";
|
|
4
5
|
import { loadProofIntegrations, resolveIntegration, toExecution, } from "../../proof/integrations.js";
|
|
5
6
|
import { loadEntities } from "../../public/operations/discovery-entities.js";
|
|
@@ -9,8 +10,32 @@ import { PROOF_CONTRACT_VERSION, PROOF_RECEIPT_VERSION, proofBindingsErrors, pro
|
|
|
9
10
|
import { MAX_PROOF_RECEIPTS, proofReceiptCurrentBindingErrors, proofReceiptHistoryErrors, } from "../../public/proof-receipt.js";
|
|
10
11
|
import { projectEntityProperties } from "../mutation/entity-projection.js";
|
|
11
12
|
import { resolveContainedSourcePath } from "../mutation/source-authoring.js";
|
|
13
|
+
import { buildUpsertBatchCommitGoal, parseUpsertChangeKinds, } from "../mutation/contradictions.js";
|
|
12
14
|
import { executeUpsert } from "../mutation/upsert.js";
|
|
15
|
+
import { acquireWorkspaceMutationLock, releaseWorkspaceMutationLock, } from "../mutation/workspace-mutation-lock.js";
|
|
16
|
+
import { MutationRollbackFailureError } from "../mutation/saga.js";
|
|
13
17
|
import { patchReceiptsIntoDocument, removeFrontmatterBlock, } from "./receipt-document.js";
|
|
18
|
+
async function rollbackUncommittedReceipts(pending, originalError, lifecycle) {
|
|
19
|
+
const failures = [];
|
|
20
|
+
for (const entry of pending) {
|
|
21
|
+
if (entry.deferred.state === "committed")
|
|
22
|
+
continue;
|
|
23
|
+
try {
|
|
24
|
+
const rollbackFailures = await entry.deferred.rollback();
|
|
25
|
+
for (const failure of rollbackFailures) {
|
|
26
|
+
failures.push({ testId: entry.testId, ...failure });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
failures.push({ testId: entry.testId, step: "rollback", error });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (failures.length > 0) {
|
|
34
|
+
lifecycle?.onRollbackFailure?.();
|
|
35
|
+
throw new AggregateError([originalError, ...failures.map((failure) => failure.error)], `Proof ingest failed and could not restore every uncommitted receipt source; the source mutation lock remains held for recovery (${failures.map(({ testId, step }) => `${testId}:${step}`).join(", ")})`);
|
|
36
|
+
}
|
|
37
|
+
throw originalError;
|
|
38
|
+
}
|
|
14
39
|
function text(value) {
|
|
15
40
|
return typeof value === "string" ? value.trim() : "";
|
|
16
41
|
}
|
|
@@ -120,7 +145,7 @@ function existingReceipts(test) {
|
|
|
120
145
|
: [];
|
|
121
146
|
}
|
|
122
147
|
// implements REQ-kibi-verification-evidence-contract
|
|
123
|
-
|
|
148
|
+
async function executeIngestProofUnlocked(args, context, lifecycle) {
|
|
124
149
|
if (!context.prolog)
|
|
125
150
|
throw new Error("Proof ingest requires a Prolog runtime");
|
|
126
151
|
const snapshot = requiredString(args.snapshot, "snapshot");
|
|
@@ -162,18 +187,37 @@ export async function executeIngestProof(args, context) {
|
|
|
162
187
|
}
|
|
163
188
|
}
|
|
164
189
|
else {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
190
|
+
// Select candidates from the paged contract projection (no receipt
|
|
191
|
+
// histories), then load each matching test in full: the append-only
|
|
192
|
+
// receipt update needs that test's existing history, but never every
|
|
193
|
+
// test's history in a single Prolog answer.
|
|
194
|
+
const candidates = await loadEntities(context.prolog, {
|
|
195
|
+
type: "test",
|
|
196
|
+
projection: "proof_contract",
|
|
197
|
+
});
|
|
198
|
+
for (const candidate of candidates) {
|
|
199
|
+
const contract = record(candidate.proof_contract);
|
|
200
|
+
if (!contract ||
|
|
201
|
+
contract.version !== PROOF_CONTRACT_VERSION ||
|
|
202
|
+
text(contract.integration) !== integrationId) {
|
|
203
|
+
continue;
|
|
172
204
|
}
|
|
205
|
+
const testId = String(candidate.id);
|
|
206
|
+
const found = await loadEntities(context.prolog, {
|
|
207
|
+
id: testId,
|
|
208
|
+
type: "test",
|
|
209
|
+
});
|
|
210
|
+
const test = found[0];
|
|
211
|
+
if (!test)
|
|
212
|
+
throw new Error(`Proof ingest failed: test ${testId} was not found`);
|
|
213
|
+
tests.push(test);
|
|
173
214
|
}
|
|
174
215
|
if (tests.length === 0)
|
|
175
216
|
throw new Error(`Proof ingest failed: no tests declare proof_contract.integration '${integrationId}'`);
|
|
176
217
|
}
|
|
218
|
+
// Loaded outside the per-test binding try/catch: an engine failure must fail
|
|
219
|
+
// the ingest, not silently write receipts without a binding hash.
|
|
220
|
+
const coveredBy = await loadCoveredBySymbolsByTest(context.prolog);
|
|
177
221
|
const prepared = [];
|
|
178
222
|
for (const test of tests) {
|
|
179
223
|
const testId = String(test.id);
|
|
@@ -207,7 +251,7 @@ export async function executeIngestProof(args, context) {
|
|
|
207
251
|
const absolute = resolveContainedSourcePath(context.workspaceRoot, source);
|
|
208
252
|
const authored = await context.fs.readFile(absolute);
|
|
209
253
|
const stripped = removeFrontmatterBlock(authored, "proof_receipts");
|
|
210
|
-
const codeScope = resolveBoundSymbolScope(join(context.workspaceRoot, ".kb", "symbols.yaml"), bindings.
|
|
254
|
+
const codeScope = resolveBoundSymbolScope(join(context.workspaceRoot, ".kb", "symbols.yaml"), receiptCodeScopeSymbolIds(contract, bindings, coveredBy.get(testId) ?? []));
|
|
211
255
|
bindingHash = receiptBindingHash(contract, stripped ?? authored, codeScope);
|
|
212
256
|
}
|
|
213
257
|
catch {
|
|
@@ -253,82 +297,138 @@ export async function executeIngestProof(args, context) {
|
|
|
253
297
|
});
|
|
254
298
|
}
|
|
255
299
|
const results = [];
|
|
300
|
+
const pendingCommits = [];
|
|
256
301
|
let passed = 0;
|
|
257
302
|
let failed = 0;
|
|
258
303
|
let unchanged = 0;
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
304
|
+
try {
|
|
305
|
+
for (const entry of prepared) {
|
|
306
|
+
const { testId, test, contract, evaluation, receipt, existing } = entry;
|
|
307
|
+
// Idempotent re-ingestion: the same artifact against the same effective
|
|
308
|
+
// contract+fingerprint derives the same receipt id and must not re-append.
|
|
309
|
+
if (existing.some((row) => row.receipt_id === receipt.receipt_id)) {
|
|
310
|
+
unchanged += 1;
|
|
311
|
+
if (receipt.outcome === "passed")
|
|
312
|
+
passed += 1;
|
|
313
|
+
else
|
|
314
|
+
failed += 1;
|
|
315
|
+
results.push({
|
|
316
|
+
testId,
|
|
317
|
+
outcome: receipt.outcome,
|
|
318
|
+
receiptId: receipt.receipt_id,
|
|
319
|
+
applied: false,
|
|
320
|
+
duplicate: true,
|
|
321
|
+
receiptCount: existing.length,
|
|
322
|
+
gaps: evaluation.gaps,
|
|
323
|
+
});
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
const nextReceipts = [
|
|
327
|
+
...existing,
|
|
328
|
+
receipt,
|
|
329
|
+
].slice(-MAX_PROOF_RECEIPTS);
|
|
330
|
+
const historyErrors = proofReceiptHistoryErrors(testId, test.verification_scope, nextReceipts);
|
|
331
|
+
const bindingErrors = proofReceiptCurrentBindingErrors(testId, test.verification_scope, receipt, contract, receipt.fingerprint);
|
|
332
|
+
const receiptErrors = [...historyErrors, ...bindingErrors];
|
|
333
|
+
if (receiptErrors.length > 0)
|
|
334
|
+
throw new Error(`Proof ingest failed for ${testId}: ${receiptErrors.join("; ")}`);
|
|
335
|
+
const properties = projectEntityProperties(test);
|
|
336
|
+
properties.proof_receipts = undefined;
|
|
337
|
+
// Surgical receipt append: splice only the proof_receipts block into the
|
|
338
|
+
// authored document so unrelated frontmatter keeps its authored form.
|
|
339
|
+
// Canonical re-rendering here would change non-receipt bytes, shift the
|
|
340
|
+
// workspace snapshot hash mid-campaign, and make later integrations in
|
|
341
|
+
// the same `kibi prove --all` refuse with "changed the tracked
|
|
342
|
+
// workspace". Falls back to the canonical render when the document is
|
|
343
|
+
// not a patchable markdown file.
|
|
344
|
+
let sourceDocumentOverride;
|
|
345
|
+
const source = typeof test.source === "string" ? test.source : "";
|
|
346
|
+
if (context.fs && source !== "" && /\.(md|mdx)$/i.test(source)) {
|
|
347
|
+
try {
|
|
348
|
+
const absolute = resolveContainedSourcePath(context.workspaceRoot, source);
|
|
349
|
+
const before = await context.fs.readFile(absolute);
|
|
350
|
+
sourceDocumentOverride =
|
|
351
|
+
patchReceiptsIntoDocument(before, nextReceipts) ?? undefined;
|
|
352
|
+
}
|
|
353
|
+
catch {
|
|
354
|
+
sourceDocumentOverride = undefined;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
// exactOptionalPropertyTypes: only pass the override when one exists.
|
|
358
|
+
const upsertOptions = {
|
|
359
|
+
deferCompiledCommit: true,
|
|
360
|
+
...(sourceDocumentOverride === undefined
|
|
361
|
+
? {}
|
|
362
|
+
: { sourceDocumentOverride }),
|
|
363
|
+
};
|
|
364
|
+
const upsert = await executeUpsert({
|
|
365
|
+
type: "test",
|
|
366
|
+
id: testId,
|
|
367
|
+
properties: { ...properties, proof_receipts: nextReceipts },
|
|
368
|
+
}, context, upsertOptions);
|
|
369
|
+
const deferred = upsert.structuredContent?.deferredCommit;
|
|
370
|
+
if (!deferred) {
|
|
371
|
+
throw new Error(`Proof ingest failed for ${testId}: receipt commit was not prepared`);
|
|
372
|
+
}
|
|
373
|
+
pendingCommits.push({
|
|
270
374
|
testId,
|
|
271
375
|
outcome: receipt.outcome,
|
|
272
376
|
receiptId: receipt.receipt_id,
|
|
273
|
-
|
|
274
|
-
duplicate: true,
|
|
275
|
-
receiptCount: existing.length,
|
|
377
|
+
receiptCount: nextReceipts.length,
|
|
276
378
|
gaps: evaluation.gaps,
|
|
379
|
+
deferred,
|
|
277
380
|
});
|
|
278
|
-
continue;
|
|
279
381
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
const absolute = resolveContainedSourcePath(context.workspaceRoot, source);
|
|
303
|
-
const before = await context.fs.readFile(absolute);
|
|
304
|
-
sourceDocumentOverride =
|
|
305
|
-
patchReceiptsIntoDocument(before, nextReceipts) ?? undefined;
|
|
306
|
-
}
|
|
307
|
-
catch {
|
|
308
|
-
sourceDocumentOverride = undefined;
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
if (error instanceof MutationRollbackFailureError) {
|
|
385
|
+
lifecycle?.onRollbackFailure?.();
|
|
386
|
+
}
|
|
387
|
+
await rollbackUncommittedReceipts(pendingCommits, error, lifecycle);
|
|
388
|
+
}
|
|
389
|
+
const prolog = context.prolog;
|
|
390
|
+
if (!prolog)
|
|
391
|
+
throw new Error("Proof ingest failed: Prolog runtime is unavailable");
|
|
392
|
+
const batchSize = 25;
|
|
393
|
+
for (let offset = 0; offset < pendingCommits.length; offset += batchSize) {
|
|
394
|
+
const batch = pendingCommits.slice(offset, offset + batchSize);
|
|
395
|
+
let written;
|
|
396
|
+
try {
|
|
397
|
+
written = await prolog.query(buildUpsertBatchCommitGoal(batch.map((entry) => ({
|
|
398
|
+
entity: entry.deferred.entity,
|
|
399
|
+
relationships: entry.deferred.relationships,
|
|
400
|
+
skipContradictionCheck: entry.deferred.skipContradictionCheck,
|
|
401
|
+
}))));
|
|
402
|
+
if (!written.success) {
|
|
403
|
+
throw new Error(written.error || "batch commit failed");
|
|
309
404
|
}
|
|
405
|
+
// Prolog success is the irreversible commit boundary. Finalize this
|
|
406
|
+
// batch before parsing auxiliary metadata or doing more work, so later
|
|
407
|
+
// failures can only roll back still-prepared source writes.
|
|
408
|
+
for (const entry of batch)
|
|
409
|
+
entry.deferred.finalize();
|
|
410
|
+
lifecycle?.onBatchCommitted?.();
|
|
411
|
+
prolog.invalidateCache?.();
|
|
412
|
+
parseUpsertChangeKinds(written.bindings, batch.length);
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
await rollbackUncommittedReceipts(pendingCommits, error, lifecycle);
|
|
416
|
+
}
|
|
417
|
+
for (const entry of batch) {
|
|
418
|
+
if (entry.outcome === "passed")
|
|
419
|
+
passed += 1;
|
|
420
|
+
else
|
|
421
|
+
failed += 1;
|
|
422
|
+
results.push({
|
|
423
|
+
testId: entry.testId,
|
|
424
|
+
outcome: entry.outcome,
|
|
425
|
+
receiptId: entry.receiptId,
|
|
426
|
+
applied: true,
|
|
427
|
+
duplicate: false,
|
|
428
|
+
receiptCount: entry.receiptCount,
|
|
429
|
+
gaps: entry.gaps,
|
|
430
|
+
});
|
|
310
431
|
}
|
|
311
|
-
// exactOptionalPropertyTypes: only pass the override when one exists.
|
|
312
|
-
const upsertOptions = sourceDocumentOverride === undefined ? {} : { sourceDocumentOverride };
|
|
313
|
-
const upsert = await executeUpsert({
|
|
314
|
-
type: "test",
|
|
315
|
-
id: testId,
|
|
316
|
-
properties: { ...properties, proof_receipts: nextReceipts },
|
|
317
|
-
}, context, upsertOptions);
|
|
318
|
-
void upsert;
|
|
319
|
-
if (receipt.outcome === "passed")
|
|
320
|
-
passed += 1;
|
|
321
|
-
else
|
|
322
|
-
failed += 1;
|
|
323
|
-
results.push({
|
|
324
|
-
testId,
|
|
325
|
-
outcome: receipt.outcome,
|
|
326
|
-
receiptId: receipt.receipt_id,
|
|
327
|
-
applied: true,
|
|
328
|
-
duplicate: false,
|
|
329
|
-
receiptCount: nextReceipts.length,
|
|
330
|
-
gaps: evaluation.gaps,
|
|
331
|
-
});
|
|
332
432
|
}
|
|
333
433
|
const summary = passed > 0
|
|
334
434
|
? `Proved ${passed} test(s)${failed > 0 ? `, ${failed} failed` : ""}${unchanged > 0 ? `, ${unchanged} unchanged` : ""}.`
|
|
@@ -346,3 +446,37 @@ export async function executeIngestProof(args, context) {
|
|
|
346
446
|
},
|
|
347
447
|
};
|
|
348
448
|
}
|
|
449
|
+
// implements REQ-kibi-verification-evidence-contract
|
|
450
|
+
export async function executeIngestProof(args, context) {
|
|
451
|
+
if (!context.fs ||
|
|
452
|
+
context.sourceFirst === false ||
|
|
453
|
+
context.sourceMutationLockHeld === true) {
|
|
454
|
+
return executeIngestProofUnlocked(args, context);
|
|
455
|
+
}
|
|
456
|
+
const lock = await acquireWorkspaceMutationLock(context.workspaceRoot);
|
|
457
|
+
let operationFailure;
|
|
458
|
+
let committed = false;
|
|
459
|
+
let releaseSafe = true;
|
|
460
|
+
try {
|
|
461
|
+
return await executeIngestProofUnlocked(args, { ...context, sourceMutationLockHeld: true }, {
|
|
462
|
+
onBatchCommitted: () => {
|
|
463
|
+
committed = true;
|
|
464
|
+
},
|
|
465
|
+
onRollbackFailure: () => {
|
|
466
|
+
releaseSafe = false;
|
|
467
|
+
},
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
catch (error) {
|
|
471
|
+
operationFailure = { error };
|
|
472
|
+
throw error;
|
|
473
|
+
}
|
|
474
|
+
finally {
|
|
475
|
+
// A failed compensation must leave the cooperative lock fail-closed. The
|
|
476
|
+
// next writer will require verified recovery rather than observing a
|
|
477
|
+
// partially restored set of receipt documents.
|
|
478
|
+
if (releaseSafe) {
|
|
479
|
+
releaseWorkspaceMutationLock(lock, operationFailure, committed);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-legacy-receipts.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/migrate-legacy-receipts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrate-legacy-receipts.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/migrate-legacy-receipts.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAOjF,MAAM,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAC/C,yCAAyC;IAEzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAGH,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IAEjD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/C,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AAEH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,yBAAyB,EAC/B,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,2BAA2B,CAAC;CAChD,CAAC,CAqFD"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { loadEntities } from "../../public/operations/discovery-entities.js";
|
|
18
|
+
import { loadEntities, loadEntitiesPaged, } from "../../public/operations/discovery-entities.js";
|
|
19
19
|
import { projectEntityProperties } from "../mutation/entity-projection.js";
|
|
20
20
|
import { resolveContainedSourcePath } from "../mutation/source-authoring.js";
|
|
21
21
|
import { executeUpsert } from "../mutation/upsert.js";
|
|
@@ -37,10 +37,12 @@ export async function executeMigrateLegacyReceipts(args, context) {
|
|
|
37
37
|
throw new Error("Legacy receipt migration requires a Prolog runtime");
|
|
38
38
|
if (context.fs === undefined)
|
|
39
39
|
throw new Error("Legacy receipt migration failed: this maintenance action rewrites authored test documents and requires a filesystem-capable runtime");
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
// A bulk run pages full entities: receipt histories are exactly what this
|
|
41
|
+
// maintenance action reads, and loading all of them at once can exceed the
|
|
42
|
+
// bounded Prolog output capacity on long-lived stores.
|
|
43
|
+
const tests = args.testId === undefined
|
|
44
|
+
? await loadEntitiesPaged(context.prolog, "test")
|
|
45
|
+
: await loadEntities(context.prolog, { type: "test", id: args.testId });
|
|
44
46
|
if (args.testId !== undefined && tests.length === 0) {
|
|
45
47
|
throw new Error(`Legacy receipt migration failed: test ${args.testId} was not found`);
|
|
46
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prune-receipts.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/prune-receipts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prune-receipts.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/prune-receipts.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AASjF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,uDAAuD;IAEvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAGH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAE7C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IAEzC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,uBAAuB,EAAE,CAAC;CAC3C,CAAC,CAAC;AAYH;;;;;;;;;GASG;AAEH,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,mBAAmB,CAAC;CACxC,CAAC,CAuED"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import { loadEntities } from "../../public/operations/discovery-entities.js";
|
|
18
|
+
import { loadEntities, loadEntitiesPaged, } from "../../public/operations/discovery-entities.js";
|
|
19
19
|
import { proofReceiptHistoryErrors, } from "../../public/proof-receipt.js";
|
|
20
20
|
import { projectEntityProperties } from "../mutation/entity-projection.js";
|
|
21
21
|
import { executeUpsert } from "../mutation/upsert.js";
|
|
@@ -44,10 +44,12 @@ export async function executePruneReceipts(args, context) {
|
|
|
44
44
|
if (context.fs === undefined)
|
|
45
45
|
throw new Error("Proof prune failed: this maintenance action rewrites authored test documents and requires a filesystem-capable runtime");
|
|
46
46
|
const keep = parseKeep(args.keep);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
// A bulk run pages full entities: receipt histories are exactly what this
|
|
48
|
+
// maintenance action reads, and loading all of them at once can exceed the
|
|
49
|
+
// bounded Prolog output capacity on long-lived stores.
|
|
50
|
+
const tests = args.testId === undefined
|
|
51
|
+
? await loadEntitiesPaged(context.prolog, "test")
|
|
52
|
+
: await loadEntities(context.prolog, { type: "test", id: args.testId });
|
|
51
53
|
if (args.testId !== undefined && tests.length === 0) {
|
|
52
54
|
throw new Error(`Proof prune failed: test ${args.testId} was not found`);
|
|
53
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis-receipt.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analysis-receipt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,KAAK,OAAO,EAMb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,6BAA6B,EAI7B,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAyBpB,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,0BAA0B,EAAE,EAClD,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,YAAY,EAAE,SAAS,mBAAmB,EAAE,EAC5C,eAAe,EAAE,SAAS,4BAA4B,EAAE,EACxD,cAAc,EAAE,SAAS,iBAAiB,EAAE,GAC3C,6BAA6B,
|
|
1
|
+
{"version":3,"file":"analysis-receipt.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analysis-receipt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,KAAK,OAAO,EAMb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,6BAA6B,EAI7B,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAyBpB,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,0BAA0B,EAAE,EAClD,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,YAAY,EAAE,SAAS,mBAAmB,EAAE,EAC5C,eAAe,EAAE,SAAS,4BAA4B,EAAE,EACxD,cAAc,EAAE,SAAS,iBAAiB,EAAE,GAC3C,6BAA6B,CA2H/B"}
|
|
@@ -27,9 +27,15 @@ export function buildAdvisorResult(payload, signals, modeled, suggestions, claus
|
|
|
27
27
|
: suggestions.some(({ kind }) => kind === "predicate")
|
|
28
28
|
? "predicate"
|
|
29
29
|
: null;
|
|
30
|
+
const signalLane = chooseLane(signals);
|
|
31
|
+
const unresolvedNormative = propositions.some(({ role, status }) => role === "normative" &&
|
|
32
|
+
["missing", "ambiguous", "ontology_gap"].includes(status));
|
|
30
33
|
const candidateLane = modeled
|
|
31
34
|
? "none"
|
|
32
|
-
: (suggestionLane ??
|
|
35
|
+
: (suggestionLane ??
|
|
36
|
+
(signalLane === "none" && unresolvedNormative
|
|
37
|
+
? "observation_review"
|
|
38
|
+
: signalLane));
|
|
33
39
|
const readiness = modeled
|
|
34
40
|
? "modeled"
|
|
35
41
|
: candidateLane === "none"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-prose.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analyze-prose.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analyze-prose.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analyze-prose.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EAWrB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAI1D;AAk2BD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,oBAAoB,GAC1B,6BAA6B,CA+D/B"}
|
|
@@ -2,7 +2,7 @@ import { createBuiltinOntologyPack, detectSignals as detectBuiltinSignals, } fro
|
|
|
2
2
|
import { utf8Span, validateLogicIr, } from "../../logic/ir.js";
|
|
3
3
|
import { logicRuleFactId } from "../modeling/logic-modeling.js";
|
|
4
4
|
import { buildAdvisorResult } from "./analysis-receipt.js";
|
|
5
|
-
import { extractSemanticClauses, semanticClaimKey, } from "./clauses.js";
|
|
5
|
+
import { extractSemanticClauses, hasNormativeAssertion, semanticClaimKey, } from "./clauses.js";
|
|
6
6
|
import { observationPlan } from "./observation-plan.js";
|
|
7
7
|
import { predicateSuggestion as buildPredicateSuggestion, isRecord, payloadHash, propertiesOf, relationship, semanticClausesOf, semanticSourceHash, semanticSourceOf, sourceOf, statementOf, stringValue, } from "./shared.js";
|
|
8
8
|
import { detectStrictSuggestion } from "./strict-rules.js";
|
|
@@ -371,11 +371,33 @@ function unmatchedClauseSuggestion(payload, clause, clauses, expectedClaimKeys)
|
|
|
371
371
|
}, clause, clauses, expectedClaimKeys, statementOf(payload), semanticSourceOf(payload).field);
|
|
372
372
|
}
|
|
373
373
|
function propositionRole(statement, normative) {
|
|
374
|
-
|
|
374
|
+
// Explicit context labels may quote obligations. Incidental explanatory
|
|
375
|
+
// words within an asserted obligation must not exempt it from grounding.
|
|
376
|
+
const assertedNormative = normative && hasNormativeAssertion(statement);
|
|
377
|
+
// A bare desired impression is subjective, even when phrased with should.
|
|
378
|
+
// Keep concrete actions, quantitative conditions and any independent
|
|
379
|
+
// obligation assertive instead of exempting them through subjective words.
|
|
380
|
+
const impression = /\bshould\s+(?:feel\s+(?:welcoming|comfortable|energetic)(?:\s+and\s+(?:welcoming|comfortable|energetic))*|(?:look|seem)\s+complete)\b/i.exec(statement);
|
|
381
|
+
const impressionTail = impression
|
|
382
|
+
? statement.slice(impression.index + impression[0].length).trim()
|
|
383
|
+
: "";
|
|
384
|
+
const subjectiveAspiration = impression !== null &&
|
|
385
|
+
(impressionTail.length === 0 ||
|
|
386
|
+
/^(?:to|for)\s+[^,;.!?]+$/i.test(impressionTail)) &&
|
|
387
|
+
!/\b(?:and|or)\b/i.test(impressionTail) &&
|
|
388
|
+
!/\d|\b(?:at least|at most|exactly|within|no more than)\b/i.test(statement) &&
|
|
389
|
+
!hasNormativeAssertion(statement.replace(impression[0], ""));
|
|
390
|
+
if (/^\s*(?:for example\b|e\.g\.|(?:example|illustrative(?: example)?)\s*:)/i.test(statement) ||
|
|
391
|
+
(!assertedNormative &&
|
|
392
|
+
/\b(?:for example|e\.g\.|such as|illustrative)\b/i.test(statement)))
|
|
375
393
|
return "example";
|
|
376
|
-
if (
|
|
394
|
+
if (/^\s*rationale\s*:/i.test(statement) ||
|
|
395
|
+
(!assertedNormative &&
|
|
396
|
+
/\b(?:because|so that|in order to| rationale|therefore)\b/i.test(statement)))
|
|
377
397
|
return "rationale";
|
|
378
|
-
if (
|
|
398
|
+
if (subjectiveAspiration ||
|
|
399
|
+
(!assertedNormative &&
|
|
400
|
+
/\b(?:feel|comfortable|looks complete|seems complete|subjective|prefer)\b/i.test(statement)))
|
|
379
401
|
return "subjective";
|
|
380
402
|
if (/\b(?:means|defined as|refers to|is called)\b/i.test(statement))
|
|
381
403
|
return "definition";
|
|
@@ -5,6 +5,7 @@ export type SemanticClause = Readonly<{
|
|
|
5
5
|
normative: boolean;
|
|
6
6
|
source: "detected" | "supplied";
|
|
7
7
|
}>;
|
|
8
|
+
export declare function hasNormativeAssertion(text: string): boolean;
|
|
8
9
|
export declare function normalizeSemanticClause(value: string): string;
|
|
9
10
|
export declare function semanticClaimKey(text: string): string;
|
|
10
11
|
export declare function extractSemanticClauses(text: string, suppliedClauses?: readonly string[]): readonly SemanticClause[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clauses.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/clauses.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACjC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"clauses.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/clauses.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACjC,CAAC,CAAC;AAYH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AA4BD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,SAAS,cAAc,EAAE,CA4B3B"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
const
|
|
2
|
+
const NORMATIVE_ASSERTION_PATTERN = /\b(?:must|shall|should|required|requires?|may\s+only|may\s+(?:have\s+)?(?:at\s+most|at\s+least|exactly|no\s+more\s+than|up\s+to)|only\s+.+?\s+(?:may|can)|must\s+not|shall\s+not|cannot|can't|denied|forbidden|prohibited|(?:is|are|be|become|becomes|remain|remains)\s+(?:invalid|rejected|prohibited|forbidden)|(?:reject|rejects|rejected|rejection)\s+(?:invalid|unresolved|ambiguous)|fail(?:s|ed)?\s+(?:clearly|explicitly|with)|expires?\s+(?:after|within|in)|failure\s+(?:behavior|policy|outcome)|error\s+(?:handling|behavior|policy|outcome)|required\s+outcome|defaults?\s+to)\b/i;
|
|
3
|
+
// Conditional/temporal cues help discover clauses but do not by themselves
|
|
4
|
+
// turn explanatory or subjective context into an asserted obligation.
|
|
5
|
+
const NORMATIVE_PATTERN = new RegExp(`${NORMATIVE_ASSERTION_PATTERN.source}|\\b(?:before|unless|when|if)\\b`, "i");
|
|
6
|
+
export function hasNormativeAssertion(text) {
|
|
7
|
+
return NORMATIVE_ASSERTION_PATTERN.test(text);
|
|
8
|
+
}
|
|
3
9
|
export function normalizeSemanticClause(value) {
|
|
4
10
|
return (value
|
|
5
11
|
.replace(/^\s*(?:[-*+]\s+|\d+[.)]\s+)/, "")
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const KIBI_PERF_TRACE_DIR_ENV = "KIBI_PERF_TRACE_DIR";
|
|
2
|
+
export declare const KIBI_PERF_TIMINGS_ENV = "KIBI_PERF_TIMINGS";
|
|
3
|
+
export declare const KIBI_PERF_TRACE_MAX_EVENTS = 5000;
|
|
4
|
+
export declare const KIBI_PERF_TRACE_MAX_BYTES: number;
|
|
5
|
+
export type PerformanceTraceEventKind = "prolog-round-trip" | "prolog-process-cache-hit" | "engine-query-cache-hit" | "engine-freshness-cache-hit";
|
|
6
|
+
interface PerformanceTraceEvent {
|
|
7
|
+
readonly kind: PerformanceTraceEventKind;
|
|
8
|
+
readonly durationMs: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Append one bounded, payload-free timing observation to the explicitly
|
|
12
|
+
* supplied private host trace directory. Trace I/O is best-effort and never
|
|
13
|
+
* changes the operation result.
|
|
14
|
+
*/
|
|
15
|
+
export declare function writePerformanceTraceEvent(event: PerformanceTraceEvent): void;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=performance-trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance-trace.d.ts","sourceRoot":"","sources":["../src/performance-trace.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAC7D,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,0BAA0B,OAAQ,CAAC;AAChD,eAAO,MAAM,yBAAyB,QAAa,CAAC;AAEpD,MAAM,MAAM,yBAAyB,GACjC,mBAAmB,GACnB,0BAA0B,GAC1B,wBAAwB,GACxB,4BAA4B,CAAC;AAEjC,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAwHD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAoC7E"}
|