kibi-cli 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-errors.d.ts +3 -1
- package/dist/cli-errors.d.ts.map +1 -1
- package/dist/cli-errors.js +4 -1
- package/dist/cli-json-command.d.ts +1 -0
- package/dist/cli-json-command.d.ts.map +1 -1
- package/dist/cli-json-command.js +13 -4
- package/dist/cli-operation-loader.js +3 -3
- package/dist/cli-operation-metadata.d.ts +4 -3
- package/dist/cli-operation-metadata.d.ts.map +1 -1
- package/dist/cli-operation-metadata.js +7 -5
- package/dist/cli-protocol.js +1 -1
- package/dist/cli-register-maintenance.d.ts.map +1 -1
- package/dist/cli-register-maintenance.js +7 -0
- package/dist/cli-register-proof.d.ts +3 -0
- package/dist/cli-register-proof.d.ts.map +1 -0
- package/dist/cli-register-proof.js +103 -0
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +1 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +17 -10
- package/dist/commands/branch.d.ts +1 -0
- package/dist/commands/branch.d.ts.map +1 -1
- package/dist/commands/branch.js +8 -4
- package/dist/commands/check.d.ts +14 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +190 -44
- package/dist/commands/coverage.d.ts +1 -0
- package/dist/commands/coverage.d.ts.map +1 -1
- package/dist/commands/coverage.js +6 -0
- package/dist/commands/doctor.d.ts +22 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +48 -22
- package/dist/commands/engine.d.ts +12 -0
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +40 -0
- package/dist/commands/github-init.d.ts +1 -0
- package/dist/commands/github-init.d.ts.map +1 -1
- package/dist/commands/github-init.js +9 -5
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +38 -5
- package/dist/commands/migrate.d.ts +4 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +7 -7
- package/dist/commands/proof-migrate-legacy.d.ts +7 -0
- package/dist/commands/proof-migrate-legacy.d.ts.map +1 -0
- package/dist/commands/proof-migrate-legacy.js +45 -0
- package/dist/commands/proof-prune.d.ts +8 -0
- package/dist/commands/proof-prune.d.ts.map +1 -0
- package/dist/commands/proof-prune.js +53 -0
- package/dist/commands/prove.d.ts +37 -0
- package/dist/commands/prove.d.ts.map +1 -0
- package/dist/commands/prove.js +470 -0
- package/dist/commands/report.js +1 -1
- package/dist/commands/sync/discovery.d.ts +3 -0
- package/dist/commands/sync/discovery.d.ts.map +1 -1
- package/dist/commands/sync/discovery.js +36 -28
- package/dist/commands/sync/manifest.d.ts +1 -1
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +53 -21
- package/dist/commands/sync/persistence.d.ts +4 -1
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +25 -14
- package/dist/commands/sync/staging.d.ts +1 -0
- package/dist/commands/sync/staging.d.ts.map +1 -1
- package/dist/commands/sync/staging.js +5 -2
- package/dist/commands/sync/untracked-targets.d.ts +24 -0
- package/dist/commands/sync/untracked-targets.d.ts.map +1 -0
- package/dist/commands/sync/untracked-targets.js +108 -0
- package/dist/commands/sync.d.ts +11 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +74 -30
- package/dist/engine-daemon.d.ts +3 -1
- package/dist/engine-daemon.d.ts.map +1 -1
- package/dist/engine-daemon.js +49 -20
- package/dist/engine.d.ts +14 -76
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +197 -30
- package/dist/extractors/manifest.d.ts +5 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +46 -1
- package/dist/extractors/markdown.d.ts +5 -3
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +41 -24
- package/dist/extractors/playwright-cases.js +1 -1
- package/dist/extractors/relationships.d.ts +6 -0
- package/dist/extractors/relationships.d.ts.map +1 -1
- package/dist/extractors/relationships.js +1 -1
- package/dist/extractors/symbol-coordinates.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.d.ts +1 -0
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +142 -67
- package/dist/intent-search.d.ts +1 -0
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +7 -3
- package/dist/logic/ir.d.ts +1 -0
- package/dist/logic/ir.d.ts.map +1 -1
- package/dist/logic/ir.js +1 -1
- package/dist/operations/bootstrap/activation.d.ts +2 -1
- package/dist/operations/bootstrap/activation.d.ts.map +1 -1
- package/dist/operations/bootstrap/activation.js +11 -3
- package/dist/operations/bootstrap/generate.d.ts +2 -1
- package/dist/operations/bootstrap/generate.d.ts.map +1 -1
- package/dist/operations/bootstrap/generate.js +6 -3
- package/dist/operations/bootstrap/guidance.d.ts +1 -0
- package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance.js +1 -1
- package/dist/operations/modeling/model-requirement.d.ts +5 -0
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +53 -46
- package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-applicability.js +103 -4
- package/dist/operations/modeling/predicate-catalog-2.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-catalog-2.js +18 -2
- package/dist/operations/modeling/predicate-catalog-3.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-catalog-3.js +17 -1
- package/dist/operations/modeling/predicate-catalog-5.d.ts +10 -0
- package/dist/operations/modeling/predicate-catalog-5.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-catalog-5.js +291 -0
- package/dist/operations/modeling/predicate-catalog.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-catalog.js +4 -0
- package/dist/operations/modeling/predicate-loader.d.ts +1 -0
- package/dist/operations/modeling/predicate-loader.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-loader.js +4 -3
- package/dist/operations/modeling/predicate-ranker.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-ranker.js +4 -1
- package/dist/operations/modeling/predicate-types.d.ts +1 -1
- package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
- package/dist/operations/modeling/predicate-usage-hints-4.d.ts +3 -0
- package/dist/operations/modeling/predicate-usage-hints-4.d.ts.map +1 -0
- package/dist/operations/modeling/predicate-usage-hints-4.js +84 -0
- package/dist/operations/modeling/suggest-predicates.d.ts +3 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +52 -19
- package/dist/operations/mutation/contradictions.d.ts +2 -1
- package/dist/operations/mutation/contradictions.d.ts.map +1 -1
- package/dist/operations/mutation/contradictions.js +26 -5
- package/dist/operations/mutation/delete.d.ts +3 -0
- package/dist/operations/mutation/delete.d.ts.map +1 -1
- package/dist/operations/mutation/delete.js +100 -32
- package/dist/operations/mutation/relationships.d.ts +1 -0
- package/dist/operations/mutation/relationships.d.ts.map +1 -1
- package/dist/operations/mutation/relationships.js +6 -4
- package/dist/operations/mutation/saga.d.ts +51 -0
- package/dist/operations/mutation/saga.d.ts.map +1 -0
- package/dist/operations/mutation/saga.js +67 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +3 -2
- package/dist/operations/mutation/source-authoring.d.ts +5 -1
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +79 -46
- package/dist/operations/mutation/strict-fact.d.ts +1 -0
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
- package/dist/operations/mutation/strict-fact.js +8 -5
- package/dist/operations/mutation/symbol-compiler-lock.d.ts +5 -2
- package/dist/operations/mutation/symbol-compiler-lock.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-compiler-lock.js +65 -2
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +2 -2
- package/dist/operations/mutation/symbol-refresh.d.ts +1 -0
- package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-refresh.js +10 -8
- package/dist/operations/mutation/upsert.d.ts +18 -2
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +86 -54
- package/dist/operations/mutation/validate-upsert.js +2 -2
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +46 -4
- package/dist/operations/mutation/warnings.d.ts +1 -0
- package/dist/operations/mutation/warnings.d.ts.map +1 -1
- package/dist/operations/mutation/warnings.js +7 -5
- package/dist/operations/mutation/workspace-mutation-lock.d.ts +60 -0
- package/dist/operations/mutation/workspace-mutation-lock.d.ts.map +1 -0
- package/dist/operations/mutation/workspace-mutation-lock.js +362 -0
- package/dist/operations/planning/apply-plan.d.ts +8 -106
- package/dist/operations/planning/apply-plan.d.ts.map +1 -1
- package/dist/operations/planning/apply-plan.js +113 -36
- package/dist/operations/planning/compile-intent.d.ts +2 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +70 -14
- package/dist/operations/proof/ingest-proof.d.ts +34 -0
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -0
- package/dist/operations/proof/ingest-proof.js +307 -0
- package/dist/operations/proof/migrate-legacy-receipts.d.ts +30 -0
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -0
- package/dist/operations/proof/migrate-legacy-receipts.js +88 -0
- package/dist/operations/proof/prune-receipts.d.ts +35 -0
- package/dist/operations/proof/prune-receipts.d.ts.map +1 -0
- package/dist/operations/proof/prune-receipts.js +91 -0
- package/dist/operations/proof/receipt-document.d.ts +29 -0
- package/dist/operations/proof/receipt-document.d.ts.map +1 -0
- package/dist/operations/proof/receipt-document.js +117 -0
- package/dist/operations/semantic-advisor/analyze-prose.d.ts +1 -0
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +46 -26
- package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/clauses.js +20 -7
- package/dist/operations/semantic-advisor/strict-count-rules.d.ts +2 -0
- package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/strict-count-rules.js +40 -25
- package/dist/prolog/codec.d.ts +13 -1
- package/dist/prolog/codec.d.ts.map +1 -1
- package/dist/prolog/codec.js +269 -154
- package/dist/prolog/error-terms.d.ts +47 -0
- package/dist/prolog/error-terms.d.ts.map +1 -0
- package/dist/prolog/error-terms.js +334 -0
- package/dist/prolog/janitor.d.ts +50 -0
- package/dist/prolog/janitor.d.ts.map +1 -0
- package/dist/prolog/janitor.js +154 -0
- package/dist/prolog/store-lock.d.ts +45 -0
- package/dist/prolog/store-lock.d.ts.map +1 -0
- package/dist/prolog/store-lock.js +195 -0
- package/dist/prolog.d.ts +7 -0
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +55 -17
- package/dist/proof/evaluate.d.ts +27 -0
- package/dist/proof/evaluate.d.ts.map +1 -0
- package/dist/proof/evaluate.js +151 -0
- package/dist/proof/inspect.d.ts +12 -0
- package/dist/proof/inspect.d.ts.map +1 -0
- package/dist/proof/inspect.js +236 -0
- package/dist/proof/integrations.d.ts +35 -0
- package/dist/proof/integrations.d.ts.map +1 -0
- package/dist/proof/integrations.js +123 -0
- package/dist/proof/producers/junit-adapter.d.ts +26 -0
- package/dist/proof/producers/junit-adapter.d.ts.map +1 -0
- package/dist/proof/producers/junit-adapter.js +186 -0
- package/dist/{public → proof/producers}/playwright-case-id.d.ts +1 -1
- package/dist/proof/producers/playwright-case-id.d.ts.map +1 -0
- package/dist/{public → proof/producers}/playwright-case-id.js +3 -3
- package/dist/proof/producers/playwright-reporter.d.ts +27 -0
- package/dist/proof/producers/playwright-reporter.d.ts.map +1 -0
- package/dist/proof/producers/playwright-reporter.js +138 -0
- package/dist/proof/producers/tap-adapter.d.ts +10 -0
- package/dist/proof/producers/tap-adapter.d.ts.map +1 -0
- package/dist/proof/producers/tap-adapter.js +200 -0
- package/dist/proof/receipt-outcome.d.ts +2 -0
- package/dist/proof/receipt-outcome.d.ts.map +1 -0
- package/dist/proof/receipt-outcome.js +1 -0
- package/dist/public/diagnostic-usage.js +6 -6
- package/dist/public/distribution-parity.d.ts +7 -1
- package/dist/public/distribution-parity.d.ts.map +1 -1
- package/dist/public/distribution-parity.js +15 -10
- package/dist/public/impact/coverage-depth-quality.d.ts +1 -0
- package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
- package/dist/public/impact/coverage-depth-quality.js +1 -1
- package/dist/public/impact/diagnostics.d.ts.map +1 -1
- package/dist/public/impact/diagnostics.js +2 -2
- package/dist/public/impact/diff-meaning.d.ts +1 -0
- package/dist/public/impact/diff-meaning.d.ts.map +1 -1
- package/dist/public/impact/diff-meaning.js +5 -2
- package/dist/public/impact/full-kb-quality.d.ts +5 -2
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +329 -64
- package/dist/public/operations/catalog.d.ts +447 -196
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/catalog.js +6 -4
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +3 -7
- package/dist/public/operations/contracts.d.ts +7 -0
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +31 -22
- package/dist/public/operations/discovery-entities.d.ts +3 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +4 -0
- package/dist/public/operations/discovery-executors.d.ts +9 -9
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +17 -14
- package/dist/public/operations/index.d.ts +1 -1
- package/dist/public/operations/index.d.ts.map +1 -1
- package/dist/public/operations/index.js +1 -1
- package/dist/public/operations/migration-plan.d.ts +4 -3
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +23 -21
- package/dist/public/operations/node-ports.js +6 -6
- package/dist/public/operations/repair-plan.d.ts +3 -3
- package/dist/public/operations/repair-plan.d.ts.map +1 -1
- package/dist/public/operations/repair-plan.js +49 -19
- package/dist/public/operations/result-envelope.d.ts +1 -0
- package/dist/public/operations/result-envelope.d.ts.map +1 -1
- package/dist/public/operations/result-envelope.js +12 -10
- package/dist/public/operations/runtime-types.d.ts +5 -0
- package/dist/public/operations/runtime-types.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts +5 -0
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -0
- package/dist/public/operations/specs/check-rules.generated.js +34 -0
- package/dist/public/operations/specs/check.d.ts +7 -2
- package/dist/public/operations/specs/check.d.ts.map +1 -1
- package/dist/public/operations/specs/check.js +8 -20
- package/dist/public/operations/specs/mutation-schemas.d.ts +257 -163
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +15 -7
- package/dist/public/operations/specs/planning.d.ts +9 -0
- package/dist/public/operations/specs/planning.d.ts.map +1 -1
- package/dist/public/operations/specs/planning.js +6 -0
- package/dist/public/operations/specs/proof.d.ts +212 -0
- package/dist/public/operations/specs/proof.d.ts.map +1 -0
- package/dist/public/operations/specs/proof.js +30 -0
- package/dist/public/operations/specs/reporting.d.ts +19 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +112 -12
- package/dist/public/operations/specs/upsert.d.ts +257 -163
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.d.ts +11 -0
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +118 -3
- package/dist/public/operations/types.d.ts +1 -1
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/proof-fingerprint.d.ts +54 -0
- package/dist/public/proof-fingerprint.d.ts.map +1 -0
- package/dist/public/proof-fingerprint.js +141 -0
- package/dist/public/proof-protocol.d.ts +354 -0
- package/dist/public/proof-protocol.d.ts.map +1 -0
- package/dist/public/proof-protocol.js +454 -0
- package/dist/public/proof-receipt.d.ts +279 -0
- package/dist/public/proof-receipt.d.ts.map +1 -0
- package/dist/public/proof-receipt.js +377 -0
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +21 -7
- package/dist/public/skills/kibi-freshness/SKILL.md +1 -1
- package/dist/public/skills/kibi-usage/SKILL.md +41 -12
- package/dist/public/skills/kibi-usage/resources/operation-access.md +1 -1
- package/dist/public/skills/kibi-usage/resources/proof.md +105 -0
- package/dist/public/skills/kibi-usage/resources/workflows.md +6 -6
- package/dist/public/symbol-granularity.d.ts +3 -14
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.d.ts +16 -0
- package/dist/public/symbol-granularity.generated.d.ts.map +1 -0
- package/dist/public/symbol-granularity.generated.js +20 -0
- package/dist/public/symbol-granularity.js +6 -47
- package/dist/public/telemetry-acceptance.d.ts +3 -77
- package/dist/public/telemetry-acceptance.d.ts.map +1 -1
- package/dist/public/telemetry-acceptance.js +4 -2
- package/dist/public/telemetry-remediation.js +1 -1
- package/dist/report/html-report.css +282 -0
- package/dist/report/html-report.d.ts +4 -2
- package/dist/report/html-report.d.ts.map +1 -1
- package/dist/report/html-report.js +37 -300
- package/dist/runtime/cli-runtime.d.ts +2 -0
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +14 -7
- package/dist/schemas/entity.schema.json +355 -215
- package/dist/search-ranking.d.ts +1 -0
- package/dist/search-ranking.d.ts.map +1 -1
- package/dist/search-ranking.js +3 -0
- package/dist/traceability/evidence-model.d.ts +28 -0
- package/dist/traceability/evidence-model.d.ts.map +1 -1
- package/dist/traceability/git-staged.d.ts +20 -0
- package/dist/traceability/git-staged.d.ts.map +1 -1
- package/dist/traceability/git-staged.js +145 -1
- package/dist/traceability/staged-diagnostics.d.ts +7 -0
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +78 -7
- package/dist/traceability/staged-file-coverage.d.ts +33 -0
- package/dist/traceability/staged-file-coverage.d.ts.map +1 -0
- package/dist/traceability/staged-file-coverage.js +284 -0
- package/dist/traceability/staged-impact-contract.js +4 -4
- package/dist/traceability/staged-symbols-manifest.d.ts +13 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +138 -27
- package/dist/traceability/symbol-extract.d.ts +5 -0
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +1 -1
- package/dist/traceability/temp-kb.d.ts +2 -0
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +13 -4
- package/dist/types/entities.d.ts +5 -3
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/branch-resolver.d.ts +1 -0
- package/dist/utils/branch-resolver.d.ts.map +1 -1
- package/dist/utils/branch-resolver.js +7 -4
- package/dist/utils/branch-store.d.ts +6 -0
- package/dist/utils/branch-store.d.ts.map +1 -1
- package/dist/utils/branch-store.js +27 -0
- package/dist/utils/kb-paths.d.ts +1 -1
- package/dist/utils/kb-paths.d.ts.map +1 -1
- package/dist/utils/kb-paths.js +1 -1
- package/dist/utils/rule-registry.d.ts +1 -11
- package/dist/utils/rule-registry.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.d.ts +97 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -0
- package/dist/utils/rule-registry.generated.js +125 -0
- package/dist/utils/rule-registry.js +12 -113
- package/dist/utils/strict-modeling.d.ts +1 -0
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +1 -1
- package/package.json +8 -11
- package/src/public/diagnostic-usage.ts +6 -6
- package/src/public/distribution-parity.ts +17 -10
- package/src/public/impact/coverage-depth-quality.ts +1 -1
- package/src/public/impact/diagnostics.ts +2 -1
- package/src/public/impact/diff-meaning.ts +11 -4
- package/src/public/impact/full-kb-quality.ts +463 -72
- package/src/public/operations/catalog.ts +10 -4
- package/src/public/operations/check-executor.ts +3 -7
- package/src/public/operations/contracts.ts +38 -22
- package/src/public/operations/discovery-entities.ts +7 -0
- package/src/public/operations/discovery-executors.ts +26 -23
- package/src/public/operations/index.ts +1 -1
- package/src/public/operations/migration-plan.ts +32 -25
- package/src/public/operations/node-ports.ts +6 -6
- package/src/public/operations/repair-plan.ts +60 -23
- package/src/public/operations/result-envelope.ts +15 -10
- package/src/public/operations/runtime-types.ts +5 -0
- package/src/public/operations/specs/check-rules.generated.ts +37 -0
- package/src/public/operations/specs/check.ts +12 -21
- package/src/public/operations/specs/mutation-schemas.ts +22 -9
- package/src/public/operations/specs/planning.ts +7 -0
- package/src/public/operations/specs/proof.ts +43 -0
- package/src/public/operations/specs/reporting.ts +140 -13
- package/src/public/operations/symbol-repair-plan.ts +163 -3
- package/src/public/operations/types.ts +1 -1
- package/src/public/proof-fingerprint.ts +216 -0
- package/src/public/proof-protocol-types.d.ts +96 -0
- package/src/public/proof-protocol.ts +589 -0
- package/src/public/proof-receipt.ts +499 -0
- package/src/public/schemas/entity.ts +26 -10
- package/src/public/skills/kibi-freshness/SKILL.md +1 -1
- package/src/public/skills/kibi-usage/SKILL.md +41 -12
- package/src/public/skills/kibi-usage/resources/operation-access.md +1 -1
- package/src/public/skills/kibi-usage/resources/proof.md +105 -0
- package/src/public/skills/kibi-usage/resources/workflows.md +6 -6
- package/src/public/symbol-granularity.generated.ts +41 -0
- package/src/public/symbol-granularity.ts +35 -60
- package/src/public/telemetry-acceptance-types.d.ts +98 -0
- package/src/public/telemetry-acceptance.ts +22 -100
- package/src/public/telemetry-remediation.ts +1 -1
- package/src/schemas/entity.schema.json +355 -215
- package/dist/cli-register-verification.d.ts +0 -3
- package/dist/cli-register-verification.d.ts.map +0 -1
- package/dist/cli-register-verification.js +0 -16
- package/dist/commands/verify.d.ts +0 -10
- package/dist/commands/verify.d.ts.map +0 -1
- package/dist/commands/verify.js +0 -126
- package/dist/operations/verification/ingest-verification.d.ts +0 -29
- package/dist/operations/verification/ingest-verification.d.ts.map +0 -1
- package/dist/operations/verification/ingest-verification.js +0 -192
- package/dist/public/operations/specs/verification.d.ts +0 -78
- package/dist/public/operations/specs/verification.d.ts.map +0 -1
- package/dist/public/operations/specs/verification.js +0 -62
- package/dist/public/playwright-case-id.d.ts.map +0 -1
- package/dist/public/verification-receipt.d.ts +0 -242
- package/dist/public/verification-receipt.d.ts.map +0 -1
- package/dist/public/verification-receipt.js +0 -296
- package/dist/verification/playwright-reporter.d.ts +0 -21
- package/dist/verification/playwright-reporter.d.ts.map +0 -1
- package/dist/verification/playwright-reporter.js +0 -114
- package/src/public/operations/specs/verification.ts +0 -78
- package/src/public/playwright-case-id.ts +0 -35
- package/src/public/verification-receipt.ts +0 -412
package/dist/engine-daemon.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export
|
|
2
|
+
export declare function isEngineDaemonEntrypoint(argv?: readonly string[], moduleUrl?: string, isMain?: boolean | undefined): boolean;
|
|
3
|
+
export declare function runEngineDaemonCli(args?: readonly string[]): Promise<void>;
|
|
4
|
+
export declare function runEngineDaemonIfEntrypoint(isEntrypoint?: boolean): Promise<void>;
|
|
3
5
|
//# sourceMappingURL=engine-daemon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-daemon.d.ts","sourceRoot":"","sources":["../src/engine-daemon.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"engine-daemon.d.ts","sourceRoot":"","sources":["../src/engine-daemon.ts"],"names":[],"mappings":";AAWA,wBAAgB,wBAAwB,CACtC,IAAI,GAAE,SAAS,MAAM,EAAiB,EACtC,SAAS,GAAE,MAAwB,EACnC,MAAM,GAAE,OAAO,GAAG,SACX,GACN,OAAO,CAWT;AAYD,wBAAsB,kBAAkB,CACtC,IAAI,GAAE,SAAS,MAAM,EAA0B,GAC9C,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED,wBAAsB,2BAA2B,CAC/C,YAAY,UAA6B,GACxC,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
package/dist/engine-daemon.js
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { writeFileSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
3
5
|
import { runEngineDaemon } from "./engine.js";
|
|
6
|
+
// Node 22.14 and earlier do not set `import.meta.main`. The journaled engine
|
|
7
|
+
// client always hosts this file with `node`, so the entry check must work
|
|
8
|
+
// without Bun-only metadata.
|
|
9
|
+
// implements REQ-core-journaled-engine-persistence
|
|
10
|
+
export function isEngineDaemonEntrypoint(argv = process.argv, moduleUrl = import.meta.url, isMain = import.meta
|
|
11
|
+
.main) {
|
|
12
|
+
if (isMain === true) {
|
|
13
|
+
return moduleUrl === import.meta.url;
|
|
14
|
+
}
|
|
15
|
+
const entry = argv[1];
|
|
16
|
+
if (typeof entry !== "string" || entry.length === 0)
|
|
17
|
+
return false;
|
|
18
|
+
try {
|
|
19
|
+
return moduleUrl === pathToFileURL(path.resolve(entry)).href;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
4
25
|
function requiredArg(args, name) {
|
|
5
26
|
const index = args.indexOf(name);
|
|
6
27
|
const value = index >= 0 ? args[index + 1] : undefined;
|
|
@@ -9,26 +30,34 @@ function requiredArg(args, name) {
|
|
|
9
30
|
}
|
|
10
31
|
return value;
|
|
11
32
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
// implements REQ-core-journaled-engine-persistence
|
|
34
|
+
export async function runEngineDaemonCli(args = process.argv.slice(2)) {
|
|
35
|
+
try {
|
|
36
|
+
await runEngineDaemon({
|
|
37
|
+
workspaceRoot: requiredArg(args, "--workspace"),
|
|
38
|
+
branch: requiredArg(args, "--branch"),
|
|
39
|
+
socketPath: requiredArg(args, "--socket"),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
44
|
+
console.error(message);
|
|
45
|
+
const socketIndex = args.indexOf("--socket");
|
|
46
|
+
const socketPath = socketIndex >= 0 ? args[socketIndex + 1] : undefined;
|
|
47
|
+
if (socketPath) {
|
|
48
|
+
try {
|
|
49
|
+
writeFileSync(`${socketPath}.error`, `${message}\n`, { mode: 0o600 });
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Preserve the process exit code even if the diagnostic path is gone.
|
|
53
|
+
}
|
|
31
54
|
}
|
|
55
|
+
process.exitCode = 1;
|
|
32
56
|
}
|
|
33
|
-
process.exitCode = 1;
|
|
34
57
|
}
|
|
58
|
+
export async function runEngineDaemonIfEntrypoint(isEntrypoint = isEngineDaemonEntrypoint()) {
|
|
59
|
+
if (!isEntrypoint)
|
|
60
|
+
return;
|
|
61
|
+
await runEngineDaemonCli();
|
|
62
|
+
}
|
|
63
|
+
await runEngineDaemonIfEntrypoint();
|
package/dist/engine.d.ts
CHANGED
|
@@ -1,84 +1,17 @@
|
|
|
1
|
+
import type { EngineAttachmentIdentity, EngineCommandV1 } from "./engine-types.js";
|
|
1
2
|
import type { PrologQueryResult } from "./public/operations/runtime-types.js";
|
|
2
3
|
import type { PrologEntityQueryInput, PrologEntityQueryResult, PrologSearchQueryInput, PrologSearchQueryResult } from "./public/operations/runtime-types.js";
|
|
4
|
+
export type { EngineAttachmentIdentity, EngineCommandV1, EngineRequest, } from "./engine-types.js";
|
|
3
5
|
export declare const ENGINE_PROTOCOL_VERSION = 1;
|
|
4
6
|
export declare const ENGINE_IDLE_TIMEOUT_MS: number;
|
|
5
7
|
export declare const ENGINE_PACKAGE_VERSIONS: string;
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
id?: string;
|
|
14
|
-
tags?: readonly string[];
|
|
15
|
-
sourceFile?: string;
|
|
16
|
-
limit: number;
|
|
17
|
-
offset: number;
|
|
18
|
-
}> | Readonly<{
|
|
19
|
-
version: 1;
|
|
20
|
-
kind: "search";
|
|
21
|
-
query: string;
|
|
22
|
-
type?: string;
|
|
23
|
-
limit: number;
|
|
24
|
-
offset: number;
|
|
25
|
-
}> | Readonly<{
|
|
26
|
-
version: 1;
|
|
27
|
-
kind: "checkpoint";
|
|
28
|
-
}> | Readonly<{
|
|
29
|
-
version: 1;
|
|
30
|
-
kind: "compact";
|
|
31
|
-
}> | Readonly<{
|
|
32
|
-
version: 1;
|
|
33
|
-
kind: "save";
|
|
34
|
-
}> | Readonly<{
|
|
35
|
-
version: 1;
|
|
36
|
-
kind: "check";
|
|
37
|
-
rule?: string;
|
|
38
|
-
}> | Readonly<{
|
|
39
|
-
version: 1;
|
|
40
|
-
kind: "relationship";
|
|
41
|
-
action: "assert" | "retract";
|
|
42
|
-
type: string;
|
|
43
|
-
from: string;
|
|
44
|
-
to: string;
|
|
45
|
-
}> | Readonly<{
|
|
46
|
-
version: 1;
|
|
47
|
-
kind: "persistence";
|
|
48
|
-
action: "checkpoint" | "compact" | "save" | "export";
|
|
49
|
-
targetDirectory?: string;
|
|
50
|
-
}> | Readonly<{
|
|
51
|
-
version: 1;
|
|
52
|
-
kind: "lifecycle";
|
|
53
|
-
action: "stop" | "cancel";
|
|
54
|
-
requestId?: number;
|
|
55
|
-
}> | Readonly<{
|
|
56
|
-
version: 1;
|
|
57
|
-
kind: "stop";
|
|
58
|
-
}> | Readonly<{
|
|
59
|
-
version: 1;
|
|
60
|
-
kind: "cancel";
|
|
61
|
-
requestId: number;
|
|
62
|
-
}>;
|
|
63
|
-
export type EngineRequest = {
|
|
64
|
-
readonly id: number;
|
|
65
|
-
readonly method: "query" | "command" | "entities" | "search" | "kbStatus" | "status" | "checkpoint" | "compact" | "export" | "stop" | "cancel";
|
|
66
|
-
readonly protocolVersion?: number;
|
|
67
|
-
readonly packageVersions?: string;
|
|
68
|
-
readonly workspaceRoot?: string;
|
|
69
|
-
readonly branch?: string;
|
|
70
|
-
readonly goal?: string;
|
|
71
|
-
readonly type?: string;
|
|
72
|
-
readonly entityId?: string;
|
|
73
|
-
readonly searchQuery?: string;
|
|
74
|
-
readonly tags?: readonly string[];
|
|
75
|
-
readonly sourceFile?: string;
|
|
76
|
-
readonly limit?: number;
|
|
77
|
-
readonly offset?: number;
|
|
78
|
-
readonly targetDirectory?: string;
|
|
79
|
-
readonly cancelOf?: number;
|
|
80
|
-
readonly command?: EngineCommandV1;
|
|
81
|
-
};
|
|
8
|
+
export declare function requestEngineSignalShutdown(shutdown: () => unknown): () => void;
|
|
9
|
+
export declare function readJournalGeneration(branchPath: string): string;
|
|
10
|
+
export declare function readEngineAttachmentIdentity(branchPath: string): EngineAttachmentIdentity | null;
|
|
11
|
+
export declare function parseEngineAttachmentIdentity(statusJson: string | undefined): EngineAttachmentIdentity | null;
|
|
12
|
+
export declare function engineAttachmentsMatch(expected: EngineAttachmentIdentity | null, attached: EngineAttachmentIdentity | null): boolean;
|
|
13
|
+
export declare function formatEngineAttachmentMismatch(operation: string, expected: EngineAttachmentIdentity | null, attached: EngineAttachmentIdentity | null): string;
|
|
14
|
+
export declare function runtimeDirectory(): string;
|
|
82
15
|
/**
|
|
83
16
|
* Cross the kernel durability boundary before a journaled mutation is
|
|
84
17
|
* acknowledged. SWI flushes completed RDF transaction records to its journal
|
|
@@ -120,8 +53,10 @@ export declare class EngineClient {
|
|
|
120
53
|
private pending;
|
|
121
54
|
private requestTail;
|
|
122
55
|
private lastResult;
|
|
56
|
+
private replacingStaleDaemon;
|
|
123
57
|
constructor(options: EngineClientOptions);
|
|
124
58
|
start(allowSpawn?: boolean): Promise<void>;
|
|
59
|
+
private connect;
|
|
125
60
|
private attachSocket;
|
|
126
61
|
private handleResponse;
|
|
127
62
|
private request;
|
|
@@ -143,6 +78,9 @@ export declare class EngineClient {
|
|
|
143
78
|
exportStorage(targetDirectory: string): Promise<PrologQueryResult>;
|
|
144
79
|
invalidateCache(): void;
|
|
145
80
|
isRunning(): boolean;
|
|
81
|
+
private readAttachedIdentity;
|
|
82
|
+
private reconcileAttachment;
|
|
83
|
+
private shutdownConnectedDaemon;
|
|
146
84
|
getPid(): number;
|
|
147
85
|
stop(startIfMissing?: boolean): Promise<void>;
|
|
148
86
|
terminate(): Promise<void>;
|
package/dist/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EACV,wBAAwB,EACxB,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,sCAAsC,CAAC;AAO9C,YAAY,EACV,wBAAwB,EACxB,eAAe,EACf,aAAa,GACd,MAAM,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,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,GAAG,OAAO,CAAC,IAAI,CAAC,CA0lBhB"}
|
package/dist/engine.js
CHANGED
|
@@ -14,8 +14,9 @@ import * as path from "node:path";
|
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
15
|
import { PrologProcess, resolveKbPlPath } from "./prolog.js";
|
|
16
16
|
import { parseEntityFromList, parseListOfLists } from "./prolog/codec.js";
|
|
17
|
+
import { retryAttachAfterBreakingStaleLock } from "./prolog/store-lock.js";
|
|
17
18
|
import { isValidBranchName } from "./utils/branch-resolver.js";
|
|
18
|
-
import { ensureBranchStoreManifest } from "./utils/branch-store-locator.js";
|
|
19
|
+
import { branchStorePath, ensureBranchStoreManifest, } from "./utils/branch-store-locator.js";
|
|
19
20
|
export const ENGINE_PROTOCOL_VERSION = 1;
|
|
20
21
|
export const ENGINE_IDLE_TIMEOUT_MS = 10 * 60 * 1000;
|
|
21
22
|
export const ENGINE_PACKAGE_VERSIONS = process.env.KIBI_PACKAGE_VERSIONS ?? "unknown";
|
|
@@ -23,12 +24,95 @@ const ENGINE_QUERY_CACHE_MAX_ENTRIES = 128;
|
|
|
23
24
|
const ENGINE_QUERY_CACHE_MAX_RESULT_BYTES = 8 * 1024 * 1024;
|
|
24
25
|
const ENGINE_FRESHNESS_CACHE_MS = 100;
|
|
25
26
|
const ENGINE_PUBLICATION_LOCK_STALE_MS = 5_000;
|
|
27
|
+
const ENGINE_WORKSPACE_WATCHDOG_MS = 30_000;
|
|
28
|
+
export function requestEngineSignalShutdown(shutdown) {
|
|
29
|
+
return () => {
|
|
30
|
+
void shutdown();
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function readJournalGeneration(branchPath) {
|
|
34
|
+
// implements REQ-core-journaled-engine-persistence
|
|
35
|
+
const currentPath = path.join(branchPath, "CURRENT");
|
|
36
|
+
if (!existsSync(currentPath))
|
|
37
|
+
return "";
|
|
38
|
+
return readFileSync(currentPath, "utf8").trim();
|
|
39
|
+
}
|
|
40
|
+
export function readEngineAttachmentIdentity(branchPath) {
|
|
41
|
+
// implements REQ-core-journaled-engine-persistence
|
|
42
|
+
if (!existsSync(branchPath))
|
|
43
|
+
return null;
|
|
44
|
+
const stats = statSync(branchPath);
|
|
45
|
+
let resolved = path.resolve(branchPath);
|
|
46
|
+
try {
|
|
47
|
+
resolved = realpathSync(branchPath);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// The live path may be replaced between stat and realpath.
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
path: resolved,
|
|
54
|
+
generation: readJournalGeneration(branchPath),
|
|
55
|
+
dev: stats.dev,
|
|
56
|
+
ino: stats.ino,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function parseEngineAttachmentIdentity(statusJson) {
|
|
60
|
+
// implements REQ-core-journaled-engine-persistence
|
|
61
|
+
if (statusJson === undefined)
|
|
62
|
+
return null;
|
|
63
|
+
try {
|
|
64
|
+
const decoded = JSON.parse(JSON.parse(statusJson));
|
|
65
|
+
if (typeof decoded.attachedPath !== "string" ||
|
|
66
|
+
typeof decoded.attachedGeneration !== "string" ||
|
|
67
|
+
typeof decoded.attachedDev !== "number" ||
|
|
68
|
+
typeof decoded.attachedIno !== "number") {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
path: decoded.attachedPath,
|
|
73
|
+
generation: decoded.attachedGeneration,
|
|
74
|
+
dev: decoded.attachedDev,
|
|
75
|
+
ino: decoded.attachedIno,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export function engineAttachmentsMatch(expected, attached) {
|
|
83
|
+
// implements REQ-core-journaled-engine-persistence
|
|
84
|
+
if (expected === null || attached === null)
|
|
85
|
+
return false;
|
|
86
|
+
if (expected.path !== attached.path)
|
|
87
|
+
return false;
|
|
88
|
+
if (expected.ino !== 0 && attached.ino !== 0) {
|
|
89
|
+
return expected.dev === attached.dev && expected.ino === attached.ino;
|
|
90
|
+
}
|
|
91
|
+
return (expected.generation.length > 0 &&
|
|
92
|
+
expected.generation === attached.generation);
|
|
93
|
+
}
|
|
94
|
+
export function formatEngineAttachmentMismatch(operation, expected, attached) {
|
|
95
|
+
// implements REQ-core-journaled-engine-persistence
|
|
96
|
+
return [
|
|
97
|
+
`operation=${operation}`,
|
|
98
|
+
`branchStore=${expected?.path ?? "missing"}`,
|
|
99
|
+
`expectedGeneration=${expected?.generation || "missing"}`,
|
|
100
|
+
`attachedPath=${attached?.path ?? "missing"}`,
|
|
101
|
+
`attachedGeneration=${attached?.generation || "missing"}`,
|
|
102
|
+
].join(" ");
|
|
103
|
+
}
|
|
26
104
|
function engineIdleTimeoutMs() {
|
|
27
105
|
const configured = Number.parseInt(process.env.KIBI_ENGINE_IDLE_TIMEOUT_MS ?? "", 10);
|
|
28
106
|
return Number.isFinite(configured) && configured >= 100
|
|
29
107
|
? configured
|
|
30
108
|
: ENGINE_IDLE_TIMEOUT_MS;
|
|
31
109
|
}
|
|
110
|
+
function engineWorkspaceWatchdogMs() {
|
|
111
|
+
const configured = Number.parseInt(process.env.KIBI_ENGINE_WORKSPACE_WATCHDOG_MS ?? "", 10);
|
|
112
|
+
return Number.isFinite(configured) && configured >= 100
|
|
113
|
+
? configured
|
|
114
|
+
: ENGINE_WORKSPACE_WATCHDOG_MS;
|
|
115
|
+
}
|
|
32
116
|
function quoteProlog(value) {
|
|
33
117
|
return value.replaceAll("'", "''");
|
|
34
118
|
}
|
|
@@ -162,7 +246,7 @@ function parseFrames(buffer, onFrame) {
|
|
|
162
246
|
}
|
|
163
247
|
return buffer.subarray(cursor);
|
|
164
248
|
}
|
|
165
|
-
function runtimeDirectory() {
|
|
249
|
+
export function runtimeDirectory() {
|
|
166
250
|
const configured = process.env.KIBI_RUNTIME_DIR ??
|
|
167
251
|
process.env.XDG_RUNTIME_DIR ??
|
|
168
252
|
path.join(os.tmpdir(), "kibi-runtime");
|
|
@@ -577,6 +661,7 @@ export class EngineClient {
|
|
|
577
661
|
pending = new Map();
|
|
578
662
|
requestTail = Promise.resolve();
|
|
579
663
|
lastResult = null;
|
|
664
|
+
replacingStaleDaemon = false;
|
|
580
665
|
constructor(options) {
|
|
581
666
|
if (!isValidBranchName(options.branch)) {
|
|
582
667
|
throw new Error(`Invalid Kibi engine branch name: ${options.branch}`);
|
|
@@ -593,6 +678,13 @@ export class EngineClient {
|
|
|
593
678
|
this.allowPublicationLock = options.allowPublicationLock ?? false;
|
|
594
679
|
}
|
|
595
680
|
async start(allowSpawn = true) {
|
|
681
|
+
const wasConnected = this.socket !== null && !this.socket.destroyed;
|
|
682
|
+
await this.connect(allowSpawn);
|
|
683
|
+
if (!wasConnected && this.socket !== null) {
|
|
684
|
+
await this.reconcileAttachment();
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
async connect(allowSpawn = true) {
|
|
596
688
|
if (this.socket !== null && !this.socket.destroyed)
|
|
597
689
|
return;
|
|
598
690
|
const socketPath = engineSocketPath(this.workspaceRoot, this.branch);
|
|
@@ -878,27 +970,36 @@ export class EngineClient {
|
|
|
878
970
|
isRunning() {
|
|
879
971
|
return this.socket !== null && !this.socket.destroyed;
|
|
880
972
|
}
|
|
881
|
-
|
|
882
|
-
const
|
|
973
|
+
async readAttachedIdentity() {
|
|
974
|
+
const status = await this.queryStatusJson();
|
|
975
|
+
if (!status.success)
|
|
976
|
+
return null;
|
|
977
|
+
return parseEngineAttachmentIdentity(status.bindings.JsonString);
|
|
978
|
+
}
|
|
979
|
+
async reconcileAttachment() {
|
|
980
|
+
if (this.replacingStaleDaemon || this.socket === null)
|
|
981
|
+
return;
|
|
982
|
+
const livePath = branchStorePath(this.workspaceRoot, this.branch);
|
|
983
|
+
const expected = readEngineAttachmentIdentity(livePath);
|
|
984
|
+
const attached = await this.readAttachedIdentity();
|
|
985
|
+
if (engineAttachmentsMatch(expected, attached))
|
|
986
|
+
return;
|
|
987
|
+
this.replacingStaleDaemon = true;
|
|
883
988
|
try {
|
|
884
|
-
|
|
989
|
+
await this.shutdownConnectedDaemon();
|
|
990
|
+
await this.connect(true);
|
|
991
|
+
const live = readEngineAttachmentIdentity(livePath);
|
|
992
|
+
const retried = await this.readAttachedIdentity();
|
|
993
|
+
if (!engineAttachmentsMatch(live, retried)) {
|
|
994
|
+
throw new Error(`Kibi engine is attached to a stale branch generation: ${formatEngineAttachmentMismatch("attachment-handshake", live, retried)}`);
|
|
995
|
+
}
|
|
885
996
|
}
|
|
886
|
-
|
|
887
|
-
|
|
997
|
+
finally {
|
|
998
|
+
this.replacingStaleDaemon = false;
|
|
888
999
|
}
|
|
889
1000
|
}
|
|
890
|
-
async
|
|
1001
|
+
async shutdownConnectedDaemon() {
|
|
891
1002
|
const socketPath = engineSocketPath(this.workspaceRoot, this.branch);
|
|
892
|
-
if (!this.isRunning()) {
|
|
893
|
-
try {
|
|
894
|
-
await this.start(startIfMissing);
|
|
895
|
-
}
|
|
896
|
-
catch {
|
|
897
|
-
if (!startIfMissing)
|
|
898
|
-
return;
|
|
899
|
-
throw new Error("Unable to start Kibi engine for stop request");
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
1003
|
if (!this.isRunning()) {
|
|
903
1004
|
if (existsSync(socketPath)) {
|
|
904
1005
|
throw new Error(`Kibi engine socket remains present but is not reachable: ${socketPath}`);
|
|
@@ -914,9 +1015,6 @@ export class EngineClient {
|
|
|
914
1015
|
}
|
|
915
1016
|
this.socket?.destroy();
|
|
916
1017
|
this.socket = null;
|
|
917
|
-
// The daemon acknowledges stop before its SWI child has flushed and the
|
|
918
|
-
// listening socket has closed. Do not let a following auto-start attach to
|
|
919
|
-
// that half-shutdown process.
|
|
920
1018
|
const deadline = Date.now() + 5_000;
|
|
921
1019
|
while (existsSync(socketPath) && Date.now() < deadline) {
|
|
922
1020
|
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
@@ -926,6 +1024,35 @@ export class EngineClient {
|
|
|
926
1024
|
throw new Error(`Kibi engine did not stop within 5 seconds${detail}`);
|
|
927
1025
|
}
|
|
928
1026
|
}
|
|
1027
|
+
getPid() {
|
|
1028
|
+
const pidPath = enginePidPath(this.workspaceRoot, this.branch);
|
|
1029
|
+
try {
|
|
1030
|
+
return Number.parseInt(readFileSync(pidPath, "utf8").trim(), 10) || 0;
|
|
1031
|
+
}
|
|
1032
|
+
catch {
|
|
1033
|
+
return 0;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
async stop(startIfMissing = true) {
|
|
1037
|
+
const socketPath = engineSocketPath(this.workspaceRoot, this.branch);
|
|
1038
|
+
if (!this.isRunning()) {
|
|
1039
|
+
try {
|
|
1040
|
+
await this.connect(startIfMissing);
|
|
1041
|
+
}
|
|
1042
|
+
catch {
|
|
1043
|
+
if (!startIfMissing)
|
|
1044
|
+
return;
|
|
1045
|
+
throw new Error("Unable to start Kibi engine for stop request");
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
if (!this.isRunning()) {
|
|
1049
|
+
if (existsSync(socketPath)) {
|
|
1050
|
+
throw new Error(`Kibi engine socket remains present but is not reachable: ${socketPath}`);
|
|
1051
|
+
}
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
await this.shutdownConnectedDaemon();
|
|
1055
|
+
}
|
|
929
1056
|
async terminate() {
|
|
930
1057
|
// Closing a client connection releases the engine; the daemon remains
|
|
931
1058
|
// available for other operations until its idle timeout expires.
|
|
@@ -1149,12 +1276,26 @@ export async function runEngineDaemon(options) {
|
|
|
1149
1276
|
const prolog = new PrologProcess({ timeout: 120_000, oneShot: false });
|
|
1150
1277
|
await prolog.start();
|
|
1151
1278
|
const attached = await prolog.query(`kb_attach('${quoteProlog(branchPath)}')`);
|
|
1152
|
-
if (!attached.success)
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1279
|
+
if (!attached.success) {
|
|
1280
|
+
// The daemon hosts the branch store for every later request, so a
|
|
1281
|
+
// store-locked startup with a provably dead holder is auto-healed here
|
|
1282
|
+
// exactly like the CLI runtime path; live holders abort the startup
|
|
1283
|
+
// with the holder identity surfaced.
|
|
1284
|
+
const recovered = await retryAttachAfterBreakingStaleLock(prolog, branchPath, attached);
|
|
1285
|
+
if (!recovered.success)
|
|
1286
|
+
throw new Error(recovered.error ?? "Failed to attach branch KB");
|
|
1287
|
+
}
|
|
1288
|
+
const attachedIdentity = readEngineAttachmentIdentity(branchPath);
|
|
1289
|
+
const coreModuleDir = path.dirname(resolveKbPlPath());
|
|
1290
|
+
for (const [fileName, label] of [
|
|
1291
|
+
["status.pl", "status"],
|
|
1292
|
+
["discovery.pl", "discovery"],
|
|
1293
|
+
]) {
|
|
1294
|
+
const modulePath = path.join(coreModuleDir, fileName);
|
|
1295
|
+
const loaded = await prolog.query(`use_module('${quoteProlog(modulePath.replaceAll("\\", "/"))}')`);
|
|
1296
|
+
if (!loaded.success) {
|
|
1297
|
+
throw new Error(loaded.error ?? `Failed to load Kibi ${label} module`);
|
|
1298
|
+
}
|
|
1158
1299
|
}
|
|
1159
1300
|
mkdirSync(path.dirname(options.socketPath), { recursive: true, mode: 0o700 });
|
|
1160
1301
|
if (existsSync(options.socketPath)) {
|
|
@@ -1195,6 +1336,12 @@ export async function runEngineDaemon(options) {
|
|
|
1195
1336
|
try {
|
|
1196
1337
|
const decoded = JSON.parse(JSON.parse(result.bindings.JsonString));
|
|
1197
1338
|
decoded.branch = options.branch;
|
|
1339
|
+
if (attachedIdentity !== null) {
|
|
1340
|
+
decoded.attachedPath = attachedIdentity.path;
|
|
1341
|
+
decoded.attachedGeneration = attachedIdentity.generation;
|
|
1342
|
+
decoded.attachedDev = attachedIdentity.dev;
|
|
1343
|
+
decoded.attachedIno = attachedIdentity.ino;
|
|
1344
|
+
}
|
|
1198
1345
|
return {
|
|
1199
1346
|
...result,
|
|
1200
1347
|
bindings: {
|
|
@@ -1207,6 +1354,27 @@ export async function runEngineDaemon(options) {
|
|
|
1207
1354
|
return result;
|
|
1208
1355
|
}
|
|
1209
1356
|
};
|
|
1357
|
+
// A daemon whose workspace vanished (git worktree remove --force, deleted
|
|
1358
|
+
// checkout) can never serve a request again, but it would keep holding the
|
|
1359
|
+
// branch-store lock and wedge every later operation behind an opaque
|
|
1360
|
+
// "KB locked". Detect the loss and shut down cleanly instead.
|
|
1361
|
+
let workspaceMissingStreak = 0;
|
|
1362
|
+
const workspaceWatchdog = setInterval(() => {
|
|
1363
|
+
if (shuttingDown)
|
|
1364
|
+
return;
|
|
1365
|
+
// Two consecutive misses before giving up: a transient blip (slow
|
|
1366
|
+
// rename, network mount hiccup) must not stop a healthy daemon.
|
|
1367
|
+
if (!existsSync(options.workspaceRoot)) {
|
|
1368
|
+
workspaceMissingStreak += 1;
|
|
1369
|
+
if (workspaceMissingStreak < 2)
|
|
1370
|
+
return;
|
|
1371
|
+
console.error(`[KIBI] workspace ${options.workspaceRoot} no longer exists; stopping engine`);
|
|
1372
|
+
void shutdown();
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
workspaceMissingStreak = 0;
|
|
1376
|
+
}, engineWorkspaceWatchdogMs());
|
|
1377
|
+
workspaceWatchdog.unref();
|
|
1210
1378
|
const scheduleIdleExit = () => {
|
|
1211
1379
|
if (activeClients > 0)
|
|
1212
1380
|
return;
|
|
@@ -1507,6 +1675,7 @@ export async function runEngineDaemon(options) {
|
|
|
1507
1675
|
process.off("SIGINT", requestSignalShutdown);
|
|
1508
1676
|
if (idleTimer)
|
|
1509
1677
|
clearTimeout(idleTimer);
|
|
1678
|
+
clearInterval(workspaceWatchdog);
|
|
1510
1679
|
const saved = await prolog.query("kb_save").catch(() => null);
|
|
1511
1680
|
if (saved?.success) {
|
|
1512
1681
|
try {
|
|
@@ -1545,9 +1714,7 @@ export async function runEngineDaemon(options) {
|
|
|
1545
1714
|
// Detached engines must cross the same durability boundary when a service
|
|
1546
1715
|
// manager or a test harness terminates them as they do for an RPC stop.
|
|
1547
1716
|
// implements REQ-test-journaled-engine-harness
|
|
1548
|
-
const requestSignalShutdown = ()
|
|
1549
|
-
void shutdown();
|
|
1550
|
-
};
|
|
1717
|
+
const requestSignalShutdown = requestEngineSignalShutdown(shutdown);
|
|
1551
1718
|
process.once("SIGTERM", requestSignalShutdown);
|
|
1552
1719
|
process.once("SIGINT", requestSignalShutdown);
|
|
1553
1720
|
server.on("connection", (socket) => {
|
|
@@ -67,4 +67,9 @@ export declare function extractFromManifestString(content: string, filePath: str
|
|
|
67
67
|
export declare function extractManifestSymbolRecordsString(content: string, filePath: string): ManifestSymbolRecord[];
|
|
68
68
|
export declare function extractFromManifest(filePath: string): ExtractionResult[];
|
|
69
69
|
export declare function readManifestWithCoordinateOverlay(manifestPath: string, coordinatesPath?: string): ManifestSymbolRecord[];
|
|
70
|
+
export interface ReceiptCodeScopeEntry {
|
|
71
|
+
readonly symbolId: string;
|
|
72
|
+
readonly sourceHash: string;
|
|
73
|
+
}
|
|
74
|
+
export declare function resolveBoundSymbolScope(manifestPath: string, symbolIds: readonly string[]): ReceiptCodeScopeEntry[];
|
|
70
75
|
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/extractors/manifest.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,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import { createHash } from "node:crypto";
|
|
19
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
19
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
20
20
|
import * as path from "node:path";
|
|
21
21
|
import { load as parseYAML } from "js-yaml";
|
|
22
22
|
import { DEFAULT_COORDINATES_PATH } from "../utils/manifest-paths.js";
|
|
@@ -324,6 +324,51 @@ export function readManifestWithCoordinateOverlay(manifestPath, coordinatesPath)
|
|
|
324
324
|
resolveSourceText: sourceTextResolver(manifestPath),
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Resolve the code scope of a receipt binding: for each proof-bound symbol,
|
|
329
|
+
* its coordinate-recorded source hash. A receipt's binding covers these, so
|
|
330
|
+
* editing the production code behind a test stales only that test's receipts
|
|
331
|
+
* (per-contract binding mode).
|
|
332
|
+
*/
|
|
333
|
+
// implements REQ-kibi-proof-evidence-protocol
|
|
334
|
+
// Receipt-binding scope reads run once per proof-bearing test; a campaign
|
|
335
|
+
// touches dozens-to-hundreds of tests, so the parsed overlay is memoized per
|
|
336
|
+
// manifest state (path + mtime + size) and invalidated when the file changes.
|
|
337
|
+
const boundSymbolScopeCache = new Map();
|
|
338
|
+
function boundSymbolScopeRecords(manifestPath) {
|
|
339
|
+
let stamp = "";
|
|
340
|
+
try {
|
|
341
|
+
const stats = statSync(manifestPath);
|
|
342
|
+
stamp = `${stats.mtimeMs}:${stats.size}`;
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
345
|
+
stamp = "missing";
|
|
346
|
+
}
|
|
347
|
+
const hit = boundSymbolScopeCache.get(manifestPath);
|
|
348
|
+
if (hit && hit.stamp === stamp)
|
|
349
|
+
return hit.records;
|
|
350
|
+
const records = readManifestWithCoordinateOverlay(manifestPath);
|
|
351
|
+
boundSymbolScopeCache.set(manifestPath, { stamp, records });
|
|
352
|
+
return records;
|
|
353
|
+
}
|
|
354
|
+
export function resolveBoundSymbolScope(manifestPath, symbolIds) {
|
|
355
|
+
const wanted = new Set(symbolIds);
|
|
356
|
+
if (wanted.size === 0)
|
|
357
|
+
return [];
|
|
358
|
+
const records = boundSymbolScopeRecords(manifestPath);
|
|
359
|
+
const scope = [];
|
|
360
|
+
for (const record of records) {
|
|
361
|
+
const symbolId = typeof record.id === "string" ? record.id : undefined;
|
|
362
|
+
if (symbolId === undefined || !wanted.has(symbolId))
|
|
363
|
+
continue;
|
|
364
|
+
const sourceHash = record.sourceHash;
|
|
365
|
+
if (typeof sourceHash === "string" && sourceHash !== "") {
|
|
366
|
+
scope.push({ symbolId, sourceHash });
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
scope.sort((left, right) => left.symbolId.localeCompare(right.symbolId));
|
|
370
|
+
return scope;
|
|
371
|
+
}
|
|
327
372
|
function generateId(filePath, title) {
|
|
328
373
|
const hash = createHash("sha256");
|
|
329
374
|
hash.update(`${filePath}:${title}`);
|