kibi-cli 2.38.0 → 2.40.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-json-command.d.ts.map +1 -1
- package/dist/cli-json-command.js +4 -0
- package/dist/cli-register-foundation.js +2 -2
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +33 -9
- package/dist/commands/coverage.d.ts +1 -0
- package/dist/commands/coverage.d.ts.map +1 -1
- package/dist/commands/coverage.js +40 -0
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +29 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +4 -0
- package/dist/commands/migrate-plan-record.d.ts +18 -0
- package/dist/commands/migrate-plan-record.d.ts.map +1 -0
- package/dist/commands/migrate-plan-record.js +112 -0
- package/dist/commands/migrate.d.ts +11 -2
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +60 -8
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +18 -3
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +17 -4
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +6 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +8 -0
- package/dist/commands/telemetry.d.ts.map +1 -1
- package/dist/commands/telemetry.js +12 -2
- package/dist/extractors/markdown.d.ts +6 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +21 -0
- package/dist/extractors/symbol-title-match.d.ts +31 -0
- package/dist/extractors/symbol-title-match.d.ts.map +1 -0
- package/dist/extractors/symbol-title-match.js +133 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +81 -12
- package/dist/operations/bootstrap/discovery-evidence.d.ts.map +1 -1
- package/dist/operations/bootstrap/discovery-evidence.js +44 -2
- package/dist/operations/bootstrap/discovery.d.ts.map +1 -1
- package/dist/operations/bootstrap/discovery.js +1 -0
- package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
- package/dist/operations/bootstrap/guidance-actions.js +12 -1
- package/dist/operations/bootstrap/plugin-offers.d.ts +7 -1
- package/dist/operations/bootstrap/plugin-offers.d.ts.map +1 -1
- package/dist/operations/bootstrap/plugin-offers.js +73 -3
- package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
- package/dist/operations/modeling/logic-modeling.js +2 -1
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +2 -1
- package/dist/operations/mutation/symbol-refresh.d.ts +2 -0
- package/dist/operations/mutation/symbol-refresh.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-refresh.js +6 -1
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +7 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +2 -1
- package/dist/operations/proof/claim-bindings.d.ts +11 -0
- package/dist/operations/proof/claim-bindings.d.ts.map +1 -1
- package/dist/operations/proof/claim-bindings.js +144 -1
- package/dist/operations/proof/code-certificates.d.ts +10 -3
- package/dist/operations/proof/code-certificates.d.ts.map +1 -1
- package/dist/operations/proof/code-certificates.js +65 -13
- package/dist/operations/proof/code-languages.d.ts +104 -0
- package/dist/operations/proof/code-languages.d.ts.map +1 -0
- package/dist/operations/proof/code-languages.js +119 -0
- package/dist/operations/proof/code-models.d.ts +2 -0
- package/dist/operations/proof/code-models.d.ts.map +1 -1
- package/dist/operations/proof/code-models.js +11 -5
- package/dist/operations/proof/code-runner.d.ts +12 -9
- package/dist/operations/proof/code-runner.d.ts.map +1 -1
- package/dist/operations/proof/code-runner.js +81 -38
- package/dist/operations/proof/code-scope.d.ts +8 -0
- package/dist/operations/proof/code-scope.d.ts.map +1 -1
- package/dist/operations/proof/code-scope.js +30 -1
- package/dist/operations/proof/explain.d.ts +76 -0
- package/dist/operations/proof/explain.d.ts.map +1 -1
- package/dist/operations/proof/explain.js +228 -0
- package/dist/operations/proof/ingest-proof.d.ts +2 -0
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +1 -0
- package/dist/operations/proof/java-package-shadow.d.ts +14 -0
- package/dist/operations/proof/java-package-shadow.d.ts.map +1 -0
- package/dist/operations/proof/java-package-shadow.js +389 -0
- package/dist/operations/proof/prolog-evaluator.d.ts +14 -0
- package/dist/operations/proof/prolog-evaluator.d.ts.map +1 -0
- package/dist/operations/proof/prolog-evaluator.js +247 -0
- package/dist/operations/proof/prolog-source-reader.d.ts +20 -0
- package/dist/operations/proof/prolog-source-reader.d.ts.map +1 -0
- package/dist/operations/proof/prolog-source-reader.js +1123 -0
- package/dist/operations/proof/source-code-readers.d.ts +6 -0
- package/dist/operations/proof/source-code-readers.d.ts.map +1 -1
- package/dist/operations/proof/source-code-readers.js +879 -75
- package/dist/operations/semantic-advisor/analyze-prose.d.ts +9 -1
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +21 -0
- package/dist/operations/semantic-advisor/case-preview.d.ts +24 -0
- package/dist/operations/semantic-advisor/case-preview.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/case-preview.js +216 -0
- package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/shared.js +3 -0
- package/dist/operations/semantic-advisor/types.d.ts +23 -0
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/plugins/approved-source-analyzers.generated.d.ts +15 -34
- package/dist/plugins/approved-source-analyzers.generated.d.ts.map +1 -1
- package/dist/plugins/approved-source-analyzers.generated.js +15 -34
- package/dist/plugins/plugin-install-check.d.ts +21 -0
- package/dist/plugins/plugin-install-check.d.ts.map +1 -0
- package/dist/plugins/plugin-install-check.js +62 -0
- package/dist/plugins/proof-reference-extractors.d.ts +20 -0
- package/dist/plugins/proof-reference-extractors.d.ts.map +1 -0
- package/dist/plugins/proof-reference-extractors.js +104 -0
- package/dist/plugins/reference-language-suggestion.d.ts +51 -0
- package/dist/plugins/reference-language-suggestion.d.ts.map +1 -0
- package/dist/plugins/reference-language-suggestion.js +277 -0
- package/dist/plugins/registry.d.ts.map +1 -1
- package/dist/plugins/registry.js +3 -1
- package/dist/plugins/source-analysis-service.d.ts.map +1 -1
- package/dist/plugins/source-analysis-service.js +4 -0
- package/dist/plugins/source-change-analysis.d.ts +26 -1
- package/dist/plugins/source-change-analysis.d.ts.map +1 -1
- package/dist/plugins/source-change-analysis.js +77 -5
- package/dist/plugins/source-classification.d.ts +2 -2
- package/dist/plugins/source-classification.d.ts.map +1 -1
- package/dist/plugins/source-classification.js +45 -1
- package/dist/public/operations/catalog.d.ts +62 -7
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +3 -0
- package/dist/public/operations/evidence-floor.d.ts +8 -0
- package/dist/public/operations/evidence-floor.d.ts.map +1 -1
- package/dist/public/operations/evidence-floor.js +19 -1
- package/dist/public/operations/repair-plan.d.ts +46 -0
- package/dist/public/operations/repair-plan.d.ts.map +1 -1
- package/dist/public/operations/repair-plan.js +110 -1
- package/dist/public/operations/schema6-check-actions.js +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 +3 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/mutation-schemas.d.ts +61 -6
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +30 -0
- 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 +26 -3
- package/dist/public/operations/specs/semantic.d.ts.map +1 -1
- package/dist/public/operations/specs/semantic.js +2 -1
- package/dist/public/operations/specs/upsert.d.ts +61 -6
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/operations/symbol-coordinates-check.d.ts +11 -0
- package/dist/public/operations/symbol-coordinates-check.d.ts.map +1 -0
- package/dist/public/operations/symbol-coordinates-check.js +66 -0
- package/dist/public/proof-protocol.d.ts +31 -6
- package/dist/public/proof-protocol.d.ts.map +1 -1
- package/dist/public/proof-protocol.js +45 -15
- package/dist/public/proof-sources.d.ts +4 -2
- package/dist/public/proof-sources.d.ts.map +1 -1
- package/dist/public/proof-sources.js +43 -4
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +59 -0
- package/dist/public/skills/kibi-commit-review/SKILL.md +6 -2
- package/dist/public/skills/kibi-decisions/SKILL.md +7 -2
- package/dist/public/skills/kibi-decisions/resources/signoff-views.md +3 -1
- package/dist/public/skills/kibi-usage/SKILL.md +14 -3
- package/dist/public/skills/kibi-usage/resources/prolog-proofs.md +207 -0
- package/dist/public/skills/kibi-usage/resources/proof.md +44 -3
- package/dist/schemas/entity.schema.json +126 -6
- package/dist/search-answer.d.ts +3 -2
- package/dist/search-answer.d.ts.map +1 -1
- package/dist/search-answer.js +56 -3
- package/dist/traceability/analysis-gate.d.ts +3 -1
- package/dist/traceability/analysis-gate.d.ts.map +1 -1
- package/dist/traceability/analysis-gate.js +9 -1
- package/dist/traceability/impact-knowledge.d.ts.map +1 -1
- package/dist/traceability/impact-knowledge.js +2 -0
- package/dist/traceability/staged-file-coverage.d.ts.map +1 -1
- package/dist/traceability/staged-file-coverage.js +7 -2
- package/dist/traceability/symbol-extract.d.ts +17 -0
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +69 -15
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +11 -1
- package/dist/traceability/validate.d.ts.map +1 -1
- package/dist/traceability/validate.js +5 -7
- package/dist/types/entities.d.ts +12 -0
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/usage-telemetry.d.ts +9 -0
- package/dist/usage-telemetry.d.ts.map +1 -1
- package/dist/usage-telemetry.js +50 -4
- package/dist/utils/first-sentence.d.ts +9 -0
- package/dist/utils/first-sentence.d.ts.map +1 -0
- package/dist/utils/first-sentence.js +52 -0
- package/dist/utils/rule-registry.generated.d.ts +11 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +13 -0
- package/package.json +5 -5
- package/schema/entities.pl +12 -0
- package/src/public/operations/check-executor.ts +8 -0
- package/src/public/operations/evidence-floor.ts +29 -1
- package/src/public/operations/repair-plan.ts +152 -1
- package/src/public/operations/schema6-check-actions.ts +1 -1
- package/src/public/operations/specs/check-rules.generated.ts +3 -1
- package/src/public/operations/specs/mutation-schemas.ts +34 -0
- package/src/public/operations/specs/reporting.ts +38 -3
- package/src/public/operations/specs/semantic.ts +2 -1
- package/src/public/operations/symbol-coordinates-check.ts +79 -0
- package/src/public/proof-protocol-types.d.ts +22 -5
- package/src/public/proof-protocol.ts +78 -19
- package/src/public/proof-sources.ts +51 -3
- package/src/public/schemas/entity.ts +65 -0
- package/src/public/skills/kibi-commit-review/SKILL.md +6 -2
- package/src/public/skills/kibi-decisions/SKILL.md +7 -2
- package/src/public/skills/kibi-decisions/resources/signoff-views.md +3 -1
- package/src/public/skills/kibi-usage/SKILL.md +14 -3
- package/src/public/skills/kibi-usage/resources/prolog-proofs.md +207 -0
- package/src/public/skills/kibi-usage/resources/proof.md +44 -3
- package/src/schemas/entity.schema.json +126 -6
|
@@ -27,6 +27,8 @@ import { languageAccepts, languagesDisjoint, languagesEqual, UnsupportedPattern,
|
|
|
27
27
|
import { loadSymbol } from "./code-certificates.js";
|
|
28
28
|
import { describeSource, readSource } from "../../public/proof-sources.js";
|
|
29
29
|
import { runCodeEvaluator, TS_RESOLVE_HOOKS } from "./code-runner.js";
|
|
30
|
+
import { CODE_LANGUAGE_NAMES, codeLanguage, languageName, } from "./code-languages.js";
|
|
31
|
+
import { PROLOG_EVALUATOR } from "./prolog-evaluator.js";
|
|
30
32
|
import { evaluateSourceCode } from "./source-code-readers.js";
|
|
31
33
|
/** The most predicate calls one rule certificate may need. */
|
|
32
34
|
export const MAX_TABLE_ROWS = 100_000;
|
|
@@ -317,9 +319,13 @@ async function resolveReference(context, reference, label) {
|
|
|
317
319
|
const symbol = await loadSymbol(context, reference.symbol_id);
|
|
318
320
|
if (!symbol || symbol.sourceFile === "")
|
|
319
321
|
return `the ${label} symbol ${reference.symbol_id} has no source file`;
|
|
322
|
+
const file = path.resolve(context.workspaceRoot, symbol.sourceFile);
|
|
323
|
+
if (reference.arg !== undefined && codeLanguage(file) !== "prolog")
|
|
324
|
+
return `${label}.arg applies only to a SWI-Prolog predicate, not to ${languageName(file)} in ${symbol.sourceFile}`;
|
|
320
325
|
return {
|
|
321
|
-
file
|
|
326
|
+
file,
|
|
322
327
|
export: reference.export ?? symbol.title,
|
|
328
|
+
...(reference.arg === undefined ? {} : { arg: reference.arg }),
|
|
323
329
|
};
|
|
324
330
|
}
|
|
325
331
|
/**
|
|
@@ -328,16 +334,16 @@ async function resolveReference(context, reference, label) {
|
|
|
328
334
|
*/
|
|
329
335
|
// implements REQ-kibi-non-numeric-proof-kinds
|
|
330
336
|
export function evaluateCodeModel(workspaceRoot, files, plan) {
|
|
331
|
-
const
|
|
332
|
-
if (
|
|
337
|
+
const languages = [...new Set(files.map((file) => codeLanguage(file.file)))];
|
|
338
|
+
if (languages.length > 1)
|
|
333
339
|
return {
|
|
334
340
|
ok: false,
|
|
335
|
-
reason:
|
|
341
|
+
reason: `the contract's sources mix ${languages.map((language) => (language === null ? "unsupported" : CODE_LANGUAGE_NAMES[language])).join(" and ")} files; one certificate reads one language`,
|
|
336
342
|
};
|
|
337
343
|
const first = files[0];
|
|
338
344
|
if (first === undefined)
|
|
339
345
|
return { ok: false, reason: "the contract names no source" };
|
|
340
|
-
const run = runCodeEvaluator(workspaceRoot, path.relative(workspaceRoot, first.file), { js: jsModelEvaluator(), python: PYTHON_MODEL_EVALUATOR }, [JSON.stringify(plan)], (parsed) => parsed !== null && typeof parsed === "object" && "ok" in parsed);
|
|
346
|
+
const run = runCodeEvaluator(workspaceRoot, path.relative(workspaceRoot, first.file), { js: jsModelEvaluator(), python: PYTHON_MODEL_EVALUATOR, prolog: PROLOG_EVALUATOR }, [JSON.stringify(plan)], (parsed) => parsed !== null && typeof parsed === "object" && "ok" in parsed);
|
|
341
347
|
if (!run.ok)
|
|
342
348
|
return {
|
|
343
349
|
ok: false,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { type CodeLanguage } from "./code-languages.js";
|
|
1
2
|
/**
|
|
2
3
|
* How Kibi runs a small evaluator script against the workspace's own code:
|
|
3
4
|
* the TypeScript and JavaScript runners (bun, the workspace's tsx, node with
|
|
4
|
-
* type stripping)
|
|
5
|
+
* type stripping), the Python interpreters a project uses and the SWI-Prolog
|
|
6
|
+
* Kibi's engine runs on. The proof kinds
|
|
5
7
|
* that read a model from the code (exhaustive domains, rule tables, state
|
|
6
8
|
* machines, patterns, data schemas, route tables) all load code this way.
|
|
7
9
|
*/
|
|
@@ -25,6 +27,7 @@ export declare function spawnSyncThroughFiles(command: string, args: readonly st
|
|
|
25
27
|
cwd?: string;
|
|
26
28
|
input?: string;
|
|
27
29
|
timeout: number;
|
|
30
|
+
env?: NodeJS.ProcessEnv;
|
|
28
31
|
}>): {
|
|
29
32
|
error: Error | undefined;
|
|
30
33
|
status: number | null;
|
|
@@ -36,21 +39,21 @@ export declare function spawnSyncThroughFiles(command: string, args: readonly st
|
|
|
36
39
|
* prints last. A TypeScript or JavaScript file runs with bun when it is on
|
|
37
40
|
* PATH, else the workspace's tsx, else node's type stripping (which retries
|
|
38
41
|
* extensionless relative imports as TypeScript files); a Python file (`.py`)
|
|
39
|
-
* runs with the first interpreter pythonDomainInterpreters finds
|
|
40
|
-
*
|
|
42
|
+
* runs with the first interpreter pythonDomainInterpreters finds; a
|
|
43
|
+
* SWI-Prolog file (`.pl`, `.plt`) runs with the SWI-Prolog Kibi resolves for
|
|
44
|
+
* its engine. A runner whose output `accept` rejects (or that fails to
|
|
45
|
+
* start) yields to the next. A file in a language the caller has no script
|
|
46
|
+
* for refuses.
|
|
41
47
|
*/
|
|
42
|
-
export declare function runCodeEvaluator(workspaceRoot: string, sourceFile: string, scripts: Readonly<{
|
|
43
|
-
js: string;
|
|
44
|
-
python: string;
|
|
45
|
-
}>, args: readonly string[], accept?: (parsed: unknown) => boolean, options?: Readonly<{
|
|
48
|
+
export declare function runCodeEvaluator(workspaceRoot: string, sourceFile: string, scripts: Readonly<Partial<Record<CodeLanguage, string>>>, args: readonly string[], accept?: (parsed: unknown) => boolean, options?: Readonly<{
|
|
46
49
|
runners?: readonly ("bun" | "tsx" | "node")[];
|
|
47
50
|
}>): {
|
|
48
51
|
ok: true;
|
|
49
52
|
value: unknown;
|
|
50
|
-
|
|
53
|
+
language: CodeLanguage;
|
|
51
54
|
} | {
|
|
52
55
|
ok: false;
|
|
53
56
|
failure: string;
|
|
54
|
-
|
|
57
|
+
language: CodeLanguage | null;
|
|
55
58
|
};
|
|
56
59
|
//# sourceMappingURL=code-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-runner.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/code-runner.ts"],"names":[],"mappings":"AA+BA
|
|
1
|
+
{"version":3,"file":"code-runner.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/code-runner.ts"],"names":[],"mappings":"AA+BA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;GAOG;AAKH,eAAO,MAAM,g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AAE,GACpD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE,CAoFhE"}
|
|
@@ -19,10 +19,13 @@ import { spawnSync } from "node:child_process";
|
|
|
19
19
|
import { closeSync, existsSync, mkdtempSync, openSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
|
|
20
20
|
import os from "node:os";
|
|
21
21
|
import path from "node:path";
|
|
22
|
+
import { resolveSwipl, swiplChildEnv } from "../../prolog/swipl-resolver.js";
|
|
23
|
+
import { codeLanguage, unsupportedLanguageReason, } from "./code-languages.js";
|
|
22
24
|
/**
|
|
23
25
|
* How Kibi runs a small evaluator script against the workspace's own code:
|
|
24
26
|
* the TypeScript and JavaScript runners (bun, the workspace's tsx, node with
|
|
25
|
-
* type stripping)
|
|
27
|
+
* type stripping), the Python interpreters a project uses and the SWI-Prolog
|
|
28
|
+
* Kibi's engine runs on. The proof kinds
|
|
26
29
|
* that read a model from the code (exhaustive domains, rule tables, state
|
|
27
30
|
* machines, patterns, data schemas, route tables) all load code this way.
|
|
28
31
|
*/
|
|
@@ -111,6 +114,7 @@ export function spawnSyncThroughFiles(command, args, options) {
|
|
|
111
114
|
try {
|
|
112
115
|
run = spawnSync(command, [...args], {
|
|
113
116
|
cwd: options.cwd,
|
|
117
|
+
...(options.env === undefined ? {} : { env: options.env }),
|
|
114
118
|
stdio: fds,
|
|
115
119
|
timeout: options.timeout,
|
|
116
120
|
});
|
|
@@ -131,70 +135,109 @@ export function spawnSyncThroughFiles(command, args, options) {
|
|
|
131
135
|
}
|
|
132
136
|
}
|
|
133
137
|
/** The line of a runner's stderr that names the failure. */
|
|
134
|
-
function failureLine(stderr,
|
|
138
|
+
function failureLine(stderr, language) {
|
|
135
139
|
const lines = stderr
|
|
136
140
|
.trim()
|
|
137
141
|
.split("\n")
|
|
138
142
|
.map((line) => line.trim())
|
|
139
143
|
.filter((line) => line !== "");
|
|
140
144
|
// A Python traceback names the exception on its last line.
|
|
141
|
-
return (python ? lines.at(-1) : lines[0]) ?? "";
|
|
145
|
+
return (language === "python" ? lines.at(-1) : lines[0]) ?? "";
|
|
142
146
|
}
|
|
143
147
|
/**
|
|
144
148
|
* Run an evaluator script against the workspace code and return the JSON it
|
|
145
149
|
* prints last. A TypeScript or JavaScript file runs with bun when it is on
|
|
146
150
|
* PATH, else the workspace's tsx, else node's type stripping (which retries
|
|
147
151
|
* extensionless relative imports as TypeScript files); a Python file (`.py`)
|
|
148
|
-
* runs with the first interpreter pythonDomainInterpreters finds
|
|
149
|
-
*
|
|
152
|
+
* runs with the first interpreter pythonDomainInterpreters finds; a
|
|
153
|
+
* SWI-Prolog file (`.pl`, `.plt`) runs with the SWI-Prolog Kibi resolves for
|
|
154
|
+
* its engine. A runner whose output `accept` rejects (or that fails to
|
|
155
|
+
* start) yields to the next. A file in a language the caller has no script
|
|
156
|
+
* for refuses.
|
|
150
157
|
*/
|
|
151
|
-
// implements REQ-kibi-non-numeric-proof-kinds
|
|
158
|
+
// implements REQ-kibi-non-numeric-proof-kinds, REQ-kibi-multilingual-code-proofs
|
|
152
159
|
export function runCodeEvaluator(workspaceRoot, sourceFile, scripts, args, accept = () => true, options = {}) {
|
|
153
|
-
const
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
const language = codeLanguage(sourceFile);
|
|
161
|
+
const script = language === null ? undefined : scripts[language];
|
|
162
|
+
if (language === null || script === undefined)
|
|
163
|
+
return {
|
|
164
|
+
ok: false,
|
|
165
|
+
failure: unsupportedLanguageReason("this reader", Object.keys(scripts).filter((key) => scripts[key] !== undefined), [sourceFile]),
|
|
166
|
+
language,
|
|
167
|
+
};
|
|
168
|
+
const fail = (failure) => ({ ok: false, failure, language });
|
|
169
|
+
let scriptDir = null;
|
|
170
|
+
let runners;
|
|
171
|
+
if (language === "prolog") {
|
|
172
|
+
let swipl;
|
|
173
|
+
try {
|
|
174
|
+
swipl = resolveSwipl();
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
return fail(error instanceof Error ? error.message.split("\n")[0] ?? "" : String(error));
|
|
178
|
+
}
|
|
179
|
+
// swipl runs a script from a file, not from an argument.
|
|
180
|
+
scriptDir = mkdtempSync(path.join(os.tmpdir(), "kibi-prolog-"));
|
|
181
|
+
const scriptFile = path.join(scriptDir, "evaluator.pl");
|
|
182
|
+
writeFileSync(scriptFile, script);
|
|
183
|
+
runners = [
|
|
184
|
+
{
|
|
185
|
+
command: swipl.bin,
|
|
186
|
+
argv: [scriptFile, "--"],
|
|
187
|
+
env: { ...process.env, ...swiplChildEnv(swipl) },
|
|
188
|
+
},
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
else if (language === "python")
|
|
192
|
+
runners = pythonDomainInterpreters(workspaceRoot, sourceFile).map((interpreter) => ({ command: interpreter, argv: ["-c", script] }));
|
|
193
|
+
else {
|
|
194
|
+
const tsx = workspaceBin(workspaceRoot, "tsx");
|
|
195
|
+
runners = (options.runners ?? ["bun", "tsx", "node"]).flatMap((runner) => {
|
|
161
196
|
if (runner === "bun")
|
|
162
|
-
return [
|
|
197
|
+
return [{ command: "bun", argv: ["-e", script] }];
|
|
163
198
|
if (runner === "tsx")
|
|
164
199
|
return tsx === null
|
|
165
200
|
? []
|
|
166
|
-
: [
|
|
201
|
+
: [{ command: tsx, argv: ["--eval", script, "--"] }];
|
|
167
202
|
return [
|
|
168
|
-
|
|
169
|
-
process.execPath,
|
|
170
|
-
[
|
|
203
|
+
{
|
|
204
|
+
command: process.execPath,
|
|
205
|
+
argv: [
|
|
171
206
|
"--experimental-strip-types",
|
|
172
207
|
"--no-warnings",
|
|
173
208
|
"--input-type=module",
|
|
174
209
|
"-e",
|
|
175
|
-
|
|
210
|
+
script,
|
|
176
211
|
],
|
|
177
|
-
|
|
212
|
+
},
|
|
178
213
|
];
|
|
179
214
|
});
|
|
215
|
+
}
|
|
180
216
|
let failure = "";
|
|
181
|
-
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
217
|
+
try {
|
|
218
|
+
for (const { command, argv, env } of runners) {
|
|
219
|
+
const run = spawnSyncThroughFiles(command, [...argv, ...args], {
|
|
220
|
+
cwd: workspaceRoot,
|
|
221
|
+
timeout: 60_000,
|
|
222
|
+
...(env === undefined ? {} : { env }),
|
|
223
|
+
});
|
|
224
|
+
if (run.error)
|
|
225
|
+
continue;
|
|
226
|
+
const line = run.stdout.trim().split("\n").pop() ?? "";
|
|
227
|
+
try {
|
|
228
|
+
const parsed = JSON.parse(line);
|
|
229
|
+
if (accept(parsed))
|
|
230
|
+
return { ok: true, value: parsed, language };
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
// Fall through to the next runner.
|
|
234
|
+
}
|
|
235
|
+
failure = failureLine(run.stderr, language);
|
|
196
236
|
}
|
|
197
|
-
failure = failureLine(run.stderr, python);
|
|
198
237
|
}
|
|
199
|
-
|
|
238
|
+
finally {
|
|
239
|
+
if (scriptDir !== null)
|
|
240
|
+
rmSync(scriptDir, { recursive: true, force: true });
|
|
241
|
+
}
|
|
242
|
+
return fail(failure);
|
|
200
243
|
}
|
|
@@ -23,6 +23,14 @@ export declare function loadCoveredBySymbolsByTest(prolog: Pick<PrologPort, "que
|
|
|
23
23
|
* make every receipt of that test silently fall back to snapshot matching.
|
|
24
24
|
*/
|
|
25
25
|
export declare function receiptBindingContract(raw: unknown): ProofContract | null;
|
|
26
|
+
/**
|
|
27
|
+
* The code symbols a certificate contract loads at ingest: its domain, value
|
|
28
|
+
* constants, rule predicates and domains, initial states and pattern. They
|
|
29
|
+
* enter the binding with the test's own scope, so editing the file a domain
|
|
30
|
+
* is read from stales the receipt even when that symbol is not linked
|
|
31
|
+
* covered_by the test. A symbol already in scope binds as before.
|
|
32
|
+
*/
|
|
33
|
+
export declare function contractCodeSymbolIds(contract: ProofContract): string[];
|
|
26
34
|
/** Every project source a contract reads: its source, source counts and source domains. */
|
|
27
35
|
export declare function contractSources(contract: ProofContract): SourceSpec[];
|
|
28
36
|
export type ReceiptBindingInput = Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-scope.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/code-scope.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,+BAA+B,CAAC;AACpF,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,gCAAgC,CAAC;AAKxC;;;;;;;;;;;GAWG;AAEH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,gBAAgB,EAAE,SAAS,MAAM,EAAE,GAClC,MAAM,EAAE,CAoBV;AAED,4EAA4E;AAE5E,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAiBjD;AAQD;;;;;GAKG;AAEH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CAmBzE;AAED,2FAA2F;AAE3F,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,UAAU,EAAE,CAQrE;AAGD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,2EAA2E;IAC3E,IAAI,EA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EAAE,CAQrE;AAGD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,2EAA2E;IAC3E,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AAEH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE7B;AAED;;;;;;;;GAQG;AAEH,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC,CA0CxC"}
|
|
@@ -99,6 +99,32 @@ export function receiptBindingContract(raw) {
|
|
|
99
99
|
...optionalProofContractFields(contract),
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* The code symbols a certificate contract loads at ingest: its domain, value
|
|
104
|
+
* constants, rule predicates and domains, initial states and pattern. They
|
|
105
|
+
* enter the binding with the test's own scope, so editing the file a domain
|
|
106
|
+
* is read from stales the receipt even when that symbol is not linked
|
|
107
|
+
* covered_by the test. A symbol already in scope binds as before.
|
|
108
|
+
*/
|
|
109
|
+
// implements REQ-kibi-multilingual-code-proofs
|
|
110
|
+
export function contractCodeSymbolIds(contract) {
|
|
111
|
+
const ids = new Set();
|
|
112
|
+
const add = (entry) => {
|
|
113
|
+
const row = record(entry);
|
|
114
|
+
if (row !== null && typeof row.symbol_id === "string" && row.symbol_id !== "")
|
|
115
|
+
ids.add(row.symbol_id);
|
|
116
|
+
};
|
|
117
|
+
add(contract.domain_source);
|
|
118
|
+
add(contract.initial_source);
|
|
119
|
+
add(contract.pattern_source);
|
|
120
|
+
for (const entry of contract.value_source ?? [])
|
|
121
|
+
add(entry);
|
|
122
|
+
for (const entry of Object.values(contract.domains ?? {}))
|
|
123
|
+
add(entry);
|
|
124
|
+
for (const entry of Object.values(contract.predicate_source ?? {}))
|
|
125
|
+
add(entry);
|
|
126
|
+
return [...ids].sort();
|
|
127
|
+
}
|
|
102
128
|
/** Every project source a contract reads: its source, source counts and source domains. */
|
|
103
129
|
// implements REQ-kibi-source-proof-kinds
|
|
104
130
|
export function contractSources(contract) {
|
|
@@ -154,7 +180,10 @@ export async function currentReceiptBindingHashes(input) {
|
|
|
154
180
|
const authored = await input.readFile(absolute);
|
|
155
181
|
const withoutReceipts = removeFrontmatterBlock(authored, "proof_receipts") ?? authored;
|
|
156
182
|
const withoutLinks = removeFrontmatterBlock(withoutReceipts, "links") ?? withoutReceipts;
|
|
157
|
-
const codeScope = resolveBoundSymbolScope(join(input.workspaceRoot, ".kb", "symbols.yaml"),
|
|
183
|
+
const codeScope = resolveBoundSymbolScope(join(input.workspaceRoot, ".kb", "symbols.yaml"), [
|
|
184
|
+
...receiptCodeScopeSymbolIds(contract, input.test.proof_bindings, input.coveredBySymbols),
|
|
185
|
+
...contractCodeSymbolIds(contract),
|
|
186
|
+
]);
|
|
158
187
|
// A contract that reads project sources stales when what it reads
|
|
159
188
|
// changes: each file's contents and the set of files a glob matches.
|
|
160
189
|
const scope = [
|
|
@@ -43,6 +43,8 @@ export type ClaimExplainEntry = Readonly<{
|
|
|
43
43
|
applicable: boolean;
|
|
44
44
|
level: string | null;
|
|
45
45
|
blocker?: string;
|
|
46
|
+
/** Why a claim with a derived binding is still not proved. */
|
|
47
|
+
notProved?: string;
|
|
46
48
|
bindings: readonly Readonly<{
|
|
47
49
|
test: string;
|
|
48
50
|
kind: string;
|
|
@@ -51,6 +53,11 @@ export type ClaimExplainEntry = Readonly<{
|
|
|
51
53
|
reason?: string;
|
|
52
54
|
}>[];
|
|
53
55
|
}>;
|
|
56
|
+
export type ClaimRefutation = Readonly<{
|
|
57
|
+
test: string;
|
|
58
|
+
claimKey: string;
|
|
59
|
+
reason: string;
|
|
60
|
+
}>;
|
|
54
61
|
export type RequirementProofExplainView = {
|
|
55
62
|
readonly kind: "requirement";
|
|
56
63
|
readonly id: string;
|
|
@@ -63,6 +70,10 @@ export type RequirementProofExplainView = {
|
|
|
63
70
|
test: string;
|
|
64
71
|
reason: string;
|
|
65
72
|
}[];
|
|
73
|
+
/** Claims a proof refuted: the test and what it read that breaks the claim. */
|
|
74
|
+
readonly refutations?: readonly ClaimRefutation[];
|
|
75
|
+
/** Proof-bearing symbols without source coordinates. */
|
|
76
|
+
readonly missingCoordinateSymbols?: readonly string[];
|
|
66
77
|
/** How many applicable claims reach each level, and which are not proved. */
|
|
67
78
|
readonly claimSummary?: ClaimSummary;
|
|
68
79
|
readonly unprovedClaims?: readonly string[];
|
|
@@ -72,10 +83,73 @@ export type RequirementProofExplainView = {
|
|
|
72
83
|
id: string;
|
|
73
84
|
tests: readonly string[];
|
|
74
85
|
}[];
|
|
86
|
+
/** Whether a scenario exercises the requirement's failure side. */
|
|
87
|
+
readonly negativePath?: NegativePathExplain;
|
|
88
|
+
/** Quantified claims grounded only on booleans or ground predicates. */
|
|
89
|
+
readonly dimension?: DimensionExplain;
|
|
90
|
+
/** Edge cases derived from the typed claims and the scenarios covering them. */
|
|
91
|
+
readonly cases?: CasesExplain;
|
|
75
92
|
readonly tests: readonly ProofExplainTestBlock[];
|
|
76
93
|
readonly productionSymbols: readonly ProofExplainSymbolBlock[];
|
|
77
94
|
readonly structuralSymbols: readonly ProofExplainSymbolBlock[];
|
|
78
95
|
};
|
|
96
|
+
export type NegativePathExplain = {
|
|
97
|
+
readonly status: string;
|
|
98
|
+
readonly negativeScenarios: readonly string[];
|
|
99
|
+
readonly claims: readonly string[];
|
|
100
|
+
readonly suggestedNegatives: readonly {
|
|
101
|
+
readonly claimKey: string;
|
|
102
|
+
readonly factId: string;
|
|
103
|
+
readonly assumption: Readonly<Record<string, unknown>>;
|
|
104
|
+
}[];
|
|
105
|
+
/** An approved waiver carries approvedBy; a reason alone awaits approval. */
|
|
106
|
+
readonly waiver?: {
|
|
107
|
+
readonly reason: string;
|
|
108
|
+
readonly approvedBy?: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export type DimensionClaimExplain = {
|
|
112
|
+
readonly claimKey: string;
|
|
113
|
+
readonly claimText: string;
|
|
114
|
+
readonly quantifier: string;
|
|
115
|
+
readonly factIds: readonly string[];
|
|
116
|
+
/** Typed groundings that would represent the quantifier, likeliest first. */
|
|
117
|
+
readonly rewrites: readonly string[];
|
|
118
|
+
/** An approved waiver carries approvedBy; a reason alone awaits approval. */
|
|
119
|
+
readonly waiver?: {
|
|
120
|
+
readonly reason: string;
|
|
121
|
+
readonly approvedBy?: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
export type DimensionExplain = {
|
|
125
|
+
readonly status: string;
|
|
126
|
+
readonly claims: readonly DimensionClaimExplain[];
|
|
127
|
+
readonly waivedClaims: readonly DimensionClaimExplain[];
|
|
128
|
+
};
|
|
129
|
+
export type CaseExplain = {
|
|
130
|
+
readonly caseId: string;
|
|
131
|
+
readonly claimKey: string;
|
|
132
|
+
readonly factId: string;
|
|
133
|
+
readonly generator: string;
|
|
134
|
+
readonly constraint: string;
|
|
135
|
+
/** success, rejection or unspecified */
|
|
136
|
+
readonly predicted: string;
|
|
137
|
+
/** covered, uncovered, unspecified or waived */
|
|
138
|
+
readonly coverage: string;
|
|
139
|
+
readonly scenarios: readonly string[];
|
|
140
|
+
/** The assumes fact a scenario would state to land in the case. */
|
|
141
|
+
readonly assumption: Readonly<Record<string, unknown>>;
|
|
142
|
+
readonly waiver?: {
|
|
143
|
+
readonly reason: string;
|
|
144
|
+
readonly approvedBy?: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export type CasesExplain = {
|
|
148
|
+
readonly status: string;
|
|
149
|
+
readonly cases: readonly CaseExplain[];
|
|
150
|
+
readonly summary: Readonly<Record<string, number>>;
|
|
151
|
+
readonly limitReached: boolean;
|
|
152
|
+
};
|
|
79
153
|
export type SymbolProofExplainView = {
|
|
80
154
|
readonly kind: "symbol";
|
|
81
155
|
readonly id: string;
|
|
@@ -88,6 +162,8 @@ export type SymbolProofExplainView = {
|
|
|
88
162
|
};
|
|
89
163
|
export type ProofExplainView = RequirementProofExplainView | SymbolProofExplainView;
|
|
90
164
|
export declare function projectRequirementExplain(proof: Record<string, unknown>): RequirementProofExplainView;
|
|
165
|
+
/** One plain clause per gap, naming what it is about where Kibi knows. */
|
|
166
|
+
export declare function gapReason(gap: string, view: Pick<RequirementProofExplainView, "missingCoordinateSymbols">): string;
|
|
91
167
|
export declare function projectSymbolExplain(payload: Record<string, unknown>): SymbolProofExplainView;
|
|
92
168
|
export declare function renderProofExplain(view: ProofExplainView): string;
|
|
93
169
|
export declare function classifyExplainTarget(id: string | undefined, options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explain.d.ts","sourceRoot":"","sources":["../../../src/operations/proof/explain.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,0CAA0C,CAAC;AAQlD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,QAAQ,CAAC;AAExD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,Q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