kibi-cli 2.0.0 → 2.1.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-register-proof.d.ts.map +1 -1
- package/dist/cli-register-proof.js +25 -1
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +6 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/commands/check-generated.d.ts +7 -0
- package/dist/commands/check-generated.d.ts.map +1 -0
- package/dist/commands/check-generated.js +192 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +3 -2
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +122 -1
- package/dist/commands/engine.d.ts.map +1 -1
- package/dist/commands/engine.js +3 -1
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +13 -7
- package/dist/commands/proof-explain.d.ts +10 -0
- package/dist/commands/proof-explain.d.ts.map +1 -0
- package/dist/commands/proof-explain.js +45 -0
- package/dist/commands/proof-impact.d.ts +7 -0
- package/dist/commands/proof-impact.d.ts.map +1 -0
- package/dist/commands/proof-impact.js +39 -0
- package/dist/commands/proof-migrate-legacy.js +1 -1
- package/dist/commands/proof-prune.js +1 -1
- package/dist/commands/prove.js +4 -4
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +17 -2
- package/dist/commands/sync/manifest.d.ts +1 -0
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +18 -16
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +6 -0
- package/dist/engine.d.ts +3 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +134 -61
- package/dist/env/bootstrap.d.ts +84 -0
- package/dist/env/bootstrap.d.ts.map +1 -0
- package/dist/env/bootstrap.js +310 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +1 -1
- package/dist/extractors/markdown.d.ts +2 -0
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +19 -0
- package/dist/extractors/symbols-coordinator.d.ts +8 -0
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +40 -0
- package/dist/extractors/symbols-ts.d.ts +8 -19
- package/dist/extractors/symbols-ts.d.ts.map +1 -1
- package/dist/extractors/symbols-ts.js +33 -503
- package/dist/intent-search.d.ts.map +1 -1
- package/dist/intent-search.js +4 -5
- package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
- package/dist/operations/modeling/model-requirement.js +4 -0
- package/dist/operations/modeling/suggest-predicates.d.ts +1 -1
- package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
- package/dist/operations/modeling/suggest-predicates.js +30 -3
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +9 -87
- package/dist/operations/planning/compile-intent.d.ts +49 -0
- package/dist/operations/planning/compile-intent.d.ts.map +1 -1
- package/dist/operations/planning/compile-intent.js +63 -3
- package/dist/operations/proof/baseline-diff.d.ts +41 -0
- package/dist/operations/proof/baseline-diff.d.ts.map +1 -0
- package/dist/operations/proof/baseline-diff.js +153 -0
- package/dist/operations/proof/explain.d.ts +75 -0
- package/dist/operations/proof/explain.d.ts.map +1 -0
- package/dist/operations/proof/explain.js +294 -0
- package/dist/operations/proof/impact.d.ts +45 -0
- package/dist/operations/proof/impact.d.ts.map +1 -0
- package/dist/operations/proof/impact.js +118 -0
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +44 -3
- package/dist/operations/proof/migrate-legacy-receipts.d.ts.map +1 -1
- package/dist/operations/proof/migrate-legacy-receipts.js +21 -17
- package/dist/operations/proof/prune-receipts.js +1 -1
- package/dist/operations/proof/receipt-document.js +2 -2
- package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analysis-receipt.js +3 -9
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +18 -67
- package/dist/operations/semantic-advisor/plugin-orchestration.d.ts +63 -0
- package/dist/operations/semantic-advisor/plugin-orchestration.d.ts.map +1 -0
- package/dist/operations/semantic-advisor/plugin-orchestration.js +489 -0
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts +15 -2
- package/dist/operations/semantic-advisor/predicate-rules-core.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-core.js +7 -140
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts +11 -12
- package/dist/operations/semantic-advisor/predicate-rules-launcher.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-launcher.js +6 -94
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts +16 -0
- package/dist/operations/semantic-advisor/predicate-rules-policy.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-policy.js +7 -150
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts +9 -0
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-product-tail.js +7 -102
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts +13 -0
- package/dist/operations/semantic-advisor/predicate-rules-product.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/predicate-rules-product.js +7 -133
- package/dist/operations/semantic-advisor/types.d.ts +1 -0
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/plugins/compose-ontology-packs.d.ts +51 -0
- package/dist/plugins/compose-ontology-packs.d.ts.map +1 -0
- package/dist/plugins/compose-ontology-packs.js +257 -0
- package/dist/plugins/compose-semantic-classifier.d.ts +42 -0
- package/dist/plugins/compose-semantic-classifier.d.ts.map +1 -0
- package/dist/plugins/compose-semantic-classifier.js +211 -0
- package/dist/plugins/external-allowlist.d.ts +10 -0
- package/dist/plugins/external-allowlist.d.ts.map +1 -0
- package/dist/plugins/external-allowlist.js +16 -0
- package/dist/plugins/index.d.ts +9 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +33 -0
- package/dist/plugins/load-plugin.d.ts +19 -0
- package/dist/plugins/load-plugin.d.ts.map +1 -0
- package/dist/plugins/load-plugin.js +59 -0
- package/dist/plugins/project-config.d.ts +28 -0
- package/dist/plugins/project-config.d.ts.map +1 -0
- package/dist/plugins/project-config.js +90 -0
- package/dist/plugins/registry.d.ts +93 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +338 -0
- package/dist/plugins/resolve-package.d.ts +47 -0
- package/dist/plugins/resolve-package.d.ts.map +1 -0
- package/dist/plugins/resolve-package.js +262 -0
- package/dist/plugins/source-analysis-service.d.ts +44 -0
- package/dist/plugins/source-analysis-service.d.ts.map +1 -0
- package/dist/plugins/source-analysis-service.js +232 -0
- package/dist/prolog/janitor.d.ts.map +1 -1
- package/dist/prolog/janitor.js +1 -1
- package/dist/prolog/store-lock.d.ts +1 -1
- package/dist/prolog/store-lock.d.ts.map +1 -1
- package/dist/proof/inspect.js +1 -1
- package/dist/proof/producers/playwright-case-id.js +2 -2
- package/dist/proof/producers/playwright-reporter.js +4 -4
- package/dist/public/extractors/symbols-coordinator.d.ts +1 -1
- package/dist/public/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/public/extractors/symbols-coordinator.js +1 -1
- package/dist/public/impact/analyzer.d.ts +1 -1
- package/dist/public/impact/analyzer.d.ts.map +1 -1
- package/dist/public/impact/analyzer.js +6 -4
- package/dist/public/operations/catalog.d.ts +4 -1
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +1 -1
- package/dist/public/operations/check-helpers.d.ts +1 -1
- package/dist/public/operations/check-helpers.d.ts.map +1 -1
- package/dist/public/operations/check-helpers.js +1 -1
- package/dist/public/operations/contracts.d.ts.map +1 -1
- package/dist/public/operations/contracts.js +35 -12
- package/dist/public/operations/discovery-entities.d.ts +12 -0
- package/dist/public/operations/discovery-entities.d.ts.map +1 -1
- package/dist/public/operations/discovery-entities.js +34 -0
- package/dist/public/operations/discovery-executors.d.ts.map +1 -1
- package/dist/public/operations/discovery-executors.js +23 -18
- package/dist/public/operations/prolog-json.d.ts +1 -1
- package/dist/public/operations/prolog-json.d.ts.map +1 -1
- package/dist/public/operations/prolog-json.js +7 -7
- package/dist/public/operations/runtime-types.d.ts +16 -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 +2 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/discovery.d.ts +3 -0
- package/dist/public/operations/specs/discovery.d.ts.map +1 -1
- package/dist/public/operations/specs/discovery.js +3 -0
- package/dist/public/operations/specs/proof.js +1 -1
- package/dist/public/operations/specs/reporting.d.ts +1 -0
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +2 -2
- package/dist/public/operations/specs/semantic.d.ts +1 -1
- package/dist/public/operations/specs/semantic.d.ts.map +1 -1
- package/dist/public/operations/specs/semantic.js +54 -4
- package/dist/public/operations/symbol-repair-plan.d.ts.map +1 -1
- package/dist/public/operations/symbol-repair-plan.js +3 -1
- package/dist/public/operations/types.d.ts +5 -0
- package/dist/public/operations/types.d.ts.map +1 -1
- package/dist/public/proof-protocol.js +4 -4
- package/dist/public/skills/kibi-usage/SKILL.md +4 -1
- package/dist/public/skills/kibi-usage/resources/proof.md +45 -0
- package/dist/public/symbol-granularity.d.ts +1 -1
- package/dist/public/symbol-granularity.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.d.ts.map +1 -1
- package/dist/public/symbol-granularity.generated.js +38 -5
- package/dist/report/html-report.css +1239 -281
- package/dist/runtime/cli-runtime.d.ts.map +1 -1
- package/dist/runtime/cli-runtime.js +18 -0
- package/dist/traceability/symbol-extract.d.ts +24 -7
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +64 -208
- package/dist/utils/rule-registry.generated.d.ts +5 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +6 -0
- package/package.json +14 -11
- package/src/public/extractors/symbols-coordinator.ts +1 -0
- package/src/public/impact/analyzer.ts +15 -12
- package/src/public/operations/check-executor.ts +1 -1
- package/src/public/operations/check-helpers.ts +2 -2
- package/src/public/operations/contracts.ts +40 -12
- package/src/public/operations/discovery-entities.ts +46 -0
- package/src/public/operations/discovery-executors.ts +39 -26
- package/src/public/operations/prolog-json.ts +13 -5
- package/src/public/operations/runtime-types.ts +21 -2
- package/src/public/operations/specs/check-rules.generated.ts +2 -1
- package/src/public/operations/specs/discovery.ts +3 -0
- package/src/public/operations/specs/proof.ts +1 -1
- package/src/public/operations/specs/reporting.ts +2 -2
- package/src/public/operations/specs/semantic.ts +79 -17
- package/src/public/operations/symbol-repair-plan.ts +3 -4
- package/src/public/operations/types.ts +5 -0
- package/src/public/proof-fingerprint.ts +1 -1
- package/src/public/proof-protocol-types.d.ts +1 -1
- package/src/public/proof-protocol.ts +4 -4
- package/src/public/skills/kibi-usage/SKILL.md +4 -1
- package/src/public/skills/kibi-usage/resources/proof.md +45 -0
- package/src/public/symbol-granularity.generated.ts +45 -12
- package/src/public/symbol-granularity.ts +3 -3
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
3
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { validateOntologyMatchCandidate, validatePredicateSchema, } from "kibi-plugin-sdk";
|
|
19
|
+
import { PluginResolutionError } from "./resolve-package.js";
|
|
20
|
+
function candidateKey(candidate, claimKey) {
|
|
21
|
+
return [
|
|
22
|
+
claimKey ?? "",
|
|
23
|
+
candidate.schemaId,
|
|
24
|
+
candidate.polarity,
|
|
25
|
+
...candidate.arguments,
|
|
26
|
+
].join("\0");
|
|
27
|
+
}
|
|
28
|
+
function packOwnedSchemas(binding) {
|
|
29
|
+
const schemas = binding.capability
|
|
30
|
+
.schemas()
|
|
31
|
+
.map((schema) => validatePredicateSchema(schema));
|
|
32
|
+
const owned = new Set(schemas.map((schema) => schema.schemaId));
|
|
33
|
+
return { schemas, owned };
|
|
34
|
+
}
|
|
35
|
+
function tryPackOwnedSchemas(binding, diagnostics) {
|
|
36
|
+
try {
|
|
37
|
+
return packOwnedSchemas(binding);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
41
|
+
diagnostics.push(`ontology pack '${binding.capability.id}' schemas() failed: ${message}`);
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Collect active ontology schemas with replace / augment / shadow semantics.
|
|
47
|
+
* Schema id collisions across packs are rejected. Shadow packs do not alter
|
|
48
|
+
* the canonical catalog.
|
|
49
|
+
*
|
|
50
|
+
* Replace semantics:
|
|
51
|
+
* - A successful replace pack *replaces* the builtin provider catalog.
|
|
52
|
+
* - Provider exception / invalid catalog construction falls back to builtin.
|
|
53
|
+
* - Shadow packs are never merged into the canonical catalog.
|
|
54
|
+
*/
|
|
55
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
56
|
+
export function composeOntologyCatalog(resolution) {
|
|
57
|
+
const stamps = [];
|
|
58
|
+
const ownership = new Map();
|
|
59
|
+
const schemasById = new Map();
|
|
60
|
+
const diagnostics = [];
|
|
61
|
+
let replaced = false;
|
|
62
|
+
const addPack = (binding) => {
|
|
63
|
+
const { schemas, owned } = packOwnedSchemas(binding);
|
|
64
|
+
for (const schema of schemas) {
|
|
65
|
+
const existing = schemasById.get(schema.schemaId);
|
|
66
|
+
if (existing && existing.predicateName !== schema.predicateName) {
|
|
67
|
+
throw new PluginResolutionError("ONTOLOGY_SCHEMA_COLLISION", `Ontology schema id '${schema.schemaId}' collides across packs`);
|
|
68
|
+
}
|
|
69
|
+
if (!existing) {
|
|
70
|
+
schemasById.set(schema.schemaId, schema);
|
|
71
|
+
}
|
|
72
|
+
owned.add(schema.schemaId);
|
|
73
|
+
}
|
|
74
|
+
ownership.set(binding.capability.id, owned);
|
|
75
|
+
stamps.push(binding.stamp);
|
|
76
|
+
};
|
|
77
|
+
if (resolution.replace) {
|
|
78
|
+
try {
|
|
79
|
+
addPack(resolution.replace);
|
|
80
|
+
replaced = true;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
+
diagnostics.push(`replace ontology pack '${resolution.replace.pluginId}' failed catalog construction (${message}); falling back to builtin`);
|
|
85
|
+
addPack(resolution.builtin);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
addPack(resolution.builtin);
|
|
90
|
+
for (const augment of resolution.augment) {
|
|
91
|
+
addPack(augment);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const shadow of resolution.shadow) {
|
|
95
|
+
stamps.push(shadow.stamp);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
schemas: [...schemasById.values()],
|
|
99
|
+
stamps,
|
|
100
|
+
ownership,
|
|
101
|
+
replaced,
|
|
102
|
+
diagnostics,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function runPackMatches(binding, context, ownedSchemaIds, packSchemas, target, seen, diagnostics) {
|
|
106
|
+
let raw;
|
|
107
|
+
try {
|
|
108
|
+
raw = binding.capability.match(context);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
112
|
+
diagnostics.push(`ontology pack '${binding.capability.id}' match() threw: ${message}`);
|
|
113
|
+
return "failed";
|
|
114
|
+
}
|
|
115
|
+
if (!Array.isArray(raw)) {
|
|
116
|
+
diagnostics.push(`ontology pack '${binding.capability.id}' match() returned a non-array; treating as provider failure`);
|
|
117
|
+
return "failed";
|
|
118
|
+
}
|
|
119
|
+
let accepted = 0;
|
|
120
|
+
for (const entry of raw) {
|
|
121
|
+
try {
|
|
122
|
+
if (entry &&
|
|
123
|
+
typeof entry === "object" &&
|
|
124
|
+
"schemaId" in entry &&
|
|
125
|
+
typeof entry.schemaId === "string" &&
|
|
126
|
+
!ownedSchemaIds.has(entry.schemaId)) {
|
|
127
|
+
diagnostics.push(`ontology pack '${binding.capability.id}' returned schema '${entry.schemaId}' it does not own; rejected`);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const candidate = validateOntologyMatchCandidate(entry, packSchemas);
|
|
131
|
+
if (!ownedSchemaIds.has(candidate.schemaId)) {
|
|
132
|
+
diagnostics.push(`ontology pack '${binding.capability.id}' returned schema '${candidate.schemaId}' it does not own; rejected`);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const key = candidateKey(candidate, context.claimKey);
|
|
136
|
+
if (seen.has(key))
|
|
137
|
+
continue;
|
|
138
|
+
seen.add(key);
|
|
139
|
+
target.push({
|
|
140
|
+
...candidate,
|
|
141
|
+
claimKey: context.claimKey,
|
|
142
|
+
packId: binding.capability.id,
|
|
143
|
+
stamp: binding.stamp,
|
|
144
|
+
});
|
|
145
|
+
accepted += 1;
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
149
|
+
diagnostics.push(`ontology pack '${binding.capability.id}' produced an invalid candidate: ${message}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (raw.length === 0) {
|
|
153
|
+
diagnostics.push(`ontology pack '${binding.capability.id}' abstained (valid empty match)`);
|
|
154
|
+
return "abstained";
|
|
155
|
+
}
|
|
156
|
+
if (accepted === 0 && raw.length > 0) {
|
|
157
|
+
// Every candidate was invalid → treat as provider failure for replace fallback.
|
|
158
|
+
diagnostics.push(`ontology pack '${binding.capability.id}' returned only invalid candidates`);
|
|
159
|
+
return "failed";
|
|
160
|
+
}
|
|
161
|
+
return "ok";
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Match ontology candidates across the active catalog.
|
|
165
|
+
*
|
|
166
|
+
* Replace abstention (`[]`) is *not* failure: it means the replacement pack
|
|
167
|
+
* found no match and builtin must not run. Builtin fallback happens only on
|
|
168
|
+
* provider exception / malformed output / invalid catalog construction.
|
|
169
|
+
*
|
|
170
|
+
* Shadow packs validate against their own schemas and use a separate dedupe
|
|
171
|
+
* set so a canonical candidate never suppresses the corresponding shadow
|
|
172
|
+
* comparison.
|
|
173
|
+
*/
|
|
174
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
175
|
+
export function composeOntologyMatches(resolution, context) {
|
|
176
|
+
const catalog = composeOntologyCatalog(resolution);
|
|
177
|
+
const diagnostics = [...catalog.diagnostics];
|
|
178
|
+
const canonical = [];
|
|
179
|
+
const shadow = [];
|
|
180
|
+
const canonicalSeen = new Set();
|
|
181
|
+
const shadowSeen = new Set();
|
|
182
|
+
const ownedFor = (binding) => {
|
|
183
|
+
// Prefer the already-validated catalog schemas so we never re-invoke
|
|
184
|
+
// schemas() for packs that survived catalog construction (and so a
|
|
185
|
+
// replace pack that already failed catalog cannot crash matching).
|
|
186
|
+
const fromCatalog = catalog.ownership.get(binding.capability.id);
|
|
187
|
+
if (fromCatalog) {
|
|
188
|
+
const schemas = catalog.schemas.filter((schema) => fromCatalog.has(schema.schemaId));
|
|
189
|
+
return { owned: fromCatalog, schemas };
|
|
190
|
+
}
|
|
191
|
+
// Shadow packs (and replace packs that failed catalog construction) are
|
|
192
|
+
// not in the canonical catalog; load their schemas with containment.
|
|
193
|
+
return tryPackOwnedSchemas(binding, diagnostics);
|
|
194
|
+
};
|
|
195
|
+
if (resolution.replace) {
|
|
196
|
+
const replaceOwned = ownedFor(resolution.replace);
|
|
197
|
+
if (!replaceOwned) {
|
|
198
|
+
diagnostics.push(`replace ontology pack '${resolution.replace.pluginId}' schemas unavailable for match; falling back to builtin`);
|
|
199
|
+
const builtin = ownedFor(resolution.builtin);
|
|
200
|
+
if (builtin) {
|
|
201
|
+
runPackMatches(resolution.builtin, context, builtin.owned, builtin.schemas, canonical, canonicalSeen, diagnostics);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
const outcome = runPackMatches(resolution.replace, context, replaceOwned.owned, replaceOwned.schemas, canonical, canonicalSeen, diagnostics);
|
|
206
|
+
if (outcome === "failed") {
|
|
207
|
+
diagnostics.push(`replace ontology pack '${resolution.replace.pluginId}' match failed; falling back to builtin`);
|
|
208
|
+
const builtin = ownedFor(resolution.builtin);
|
|
209
|
+
if (builtin) {
|
|
210
|
+
runPackMatches(resolution.builtin, context, builtin.owned, builtin.schemas, canonical, canonicalSeen, diagnostics);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else if (outcome === "abstained") {
|
|
214
|
+
diagnostics.push(`replace ontology pack '${resolution.replace.pluginId}' abstained; builtin match not consulted`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
const builtin = ownedFor(resolution.builtin);
|
|
220
|
+
if (builtin) {
|
|
221
|
+
runPackMatches(resolution.builtin, context, builtin.owned, builtin.schemas, canonical, canonicalSeen, diagnostics);
|
|
222
|
+
}
|
|
223
|
+
for (const augment of resolution.augment) {
|
|
224
|
+
const pack = ownedFor(augment);
|
|
225
|
+
if (!pack)
|
|
226
|
+
continue;
|
|
227
|
+
runPackMatches(augment, context, pack.owned, pack.schemas, canonical, canonicalSeen, diagnostics);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
for (const shadowBinding of resolution.shadow) {
|
|
231
|
+
const pack = ownedFor(shadowBinding);
|
|
232
|
+
if (!pack) {
|
|
233
|
+
// Shadow must never fail the host operation; skip this pack.
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
runPackMatches(shadowBinding, context, pack.owned, pack.schemas, shadow, shadowSeen, diagnostics);
|
|
237
|
+
}
|
|
238
|
+
canonical.sort((a, b) => {
|
|
239
|
+
const pack = a.packId.localeCompare(b.packId);
|
|
240
|
+
if (pack !== 0)
|
|
241
|
+
return pack;
|
|
242
|
+
const schema = a.schemaId.localeCompare(b.schemaId);
|
|
243
|
+
if (schema !== 0)
|
|
244
|
+
return schema;
|
|
245
|
+
const polarity = a.polarity.localeCompare(b.polarity);
|
|
246
|
+
if (polarity !== 0)
|
|
247
|
+
return polarity;
|
|
248
|
+
return a.arguments.join("\0").localeCompare(b.arguments.join("\0"));
|
|
249
|
+
});
|
|
250
|
+
return {
|
|
251
|
+
canonical,
|
|
252
|
+
shadow,
|
|
253
|
+
stamps: catalog.stamps,
|
|
254
|
+
replaced: catalog.replaced,
|
|
255
|
+
diagnostics,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type PluginMode, type PluginProviderStamp, type SemanticClassificationDecision, type SemanticClassifierInput, type SemanticClassifierV1 } from "kibi-plugin-sdk";
|
|
2
|
+
import type { CapabilityModeResolution } from "./registry.js";
|
|
3
|
+
export type SemanticClassifierDiagnostic = Readonly<{
|
|
4
|
+
pluginId: string;
|
|
5
|
+
packageName: string | null;
|
|
6
|
+
mode: PluginMode | "builtin";
|
|
7
|
+
code: string;
|
|
8
|
+
message: string;
|
|
9
|
+
model?: string;
|
|
10
|
+
}>;
|
|
11
|
+
export type ComposedSemanticClassifierResult = Readonly<{
|
|
12
|
+
decisions: readonly SemanticClassificationDecision[];
|
|
13
|
+
stamps: readonly PluginProviderStamp[];
|
|
14
|
+
shadowComparisons: readonly {
|
|
15
|
+
readonly stamp: PluginProviderStamp;
|
|
16
|
+
readonly decisions: readonly SemanticClassificationDecision[];
|
|
17
|
+
}[];
|
|
18
|
+
fallbackUsed: boolean;
|
|
19
|
+
diagnostics: readonly SemanticClassifierDiagnostic[];
|
|
20
|
+
}>;
|
|
21
|
+
/** Bounded provenance copied onto advisor and compile-intent results. */
|
|
22
|
+
export declare function publicCapabilityStamp(stamp: PluginProviderStamp): {
|
|
23
|
+
pluginId: string;
|
|
24
|
+
pluginVersion: string;
|
|
25
|
+
capability: string;
|
|
26
|
+
mode: string;
|
|
27
|
+
external: boolean;
|
|
28
|
+
network: boolean;
|
|
29
|
+
metered: boolean;
|
|
30
|
+
fallbackUsed?: boolean;
|
|
31
|
+
model?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Compose semantic classifiers according to replace / augment / shadow modes.
|
|
35
|
+
*
|
|
36
|
+
* External providers are skipped unless `operationName` is on the allowlist
|
|
37
|
+
* (`kb_semantic_advisor`, `kb_compile_intent`).
|
|
38
|
+
*/
|
|
39
|
+
export declare function composeSemanticClassification(resolution: CapabilityModeResolution<SemanticClassifierV1>, input: SemanticClassifierInput, options: Readonly<{
|
|
40
|
+
operationName: string;
|
|
41
|
+
}>): Promise<ComposedSemanticClassifierResult>;
|
|
42
|
+
//# sourceMappingURL=compose-semantic-classifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-semantic-classifier.d.ts","sourceRoot":"","sources":["../../src/plugins/compose-semantic-classifier.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,mBAAmB,EAExB,KAAK,8BAA8B,EACnC,KAAK,uBAAuB,EAE5B,KAAK,oBAAoB,EAE1B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EACV,wBAAwB,EAEzB,MAAM,eAAe,CAAC;AAGvB,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CAAC;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAGH,MAAM,MAAM,gCAAgC,GAAG,QAAQ,CAAC;IACtD,SAAS,EAAE,SAAS,8BAA8B,EAAE,CAAC;IACrD,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACvC,iBAAiB,EAAE,SAAS;QAC1B,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;QACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,8BAA8B,EAAE,CAAC;KAC/D,EAAE,CAAC;IACJ,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,SAAS,4BAA4B,EAAE,CAAC;CACtD,CAAC,CAAC;AAMH,yEAAyE;AAEzE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,mBAAmB,GAAG;IACjE,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAYA;AAyGD;;;;;GAKG;AAEH,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,wBAAwB,CAAC,oBAAoB,CAAC,EAC1D,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,QAAQ,CAAC;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,GAC3C,OAAO,CAAC,gCAAgC,CAAC,CA0G3C"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
3
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { PluginValidationError, validateSemanticClassifierResult, } from "kibi-plugin-sdk";
|
|
19
|
+
import { allowsExternalSemanticClassifier } from "./external-allowlist.js";
|
|
20
|
+
/** Bounded provenance copied onto advisor and compile-intent results. */
|
|
21
|
+
// implements REQ-capability-plugin-activation-disclosure-v1, REQ-capability-plugin-observable-behavior-v1
|
|
22
|
+
export function publicCapabilityStamp(stamp) {
|
|
23
|
+
return {
|
|
24
|
+
pluginId: stamp.pluginId,
|
|
25
|
+
pluginVersion: stamp.pluginVersion,
|
|
26
|
+
capability: stamp.capability,
|
|
27
|
+
mode: stamp.mode,
|
|
28
|
+
external: stamp.external,
|
|
29
|
+
network: stamp.network,
|
|
30
|
+
metered: stamp.metered,
|
|
31
|
+
...(stamp.fallbackUsed === true ? { fallbackUsed: true } : {}),
|
|
32
|
+
...(stamp.model !== undefined ? { model: stamp.model } : {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function withFallback(stamp, fallbackUsed) {
|
|
36
|
+
return fallbackUsed ? { ...stamp, fallbackUsed: true } : stamp;
|
|
37
|
+
}
|
|
38
|
+
function isUnresolved(decision) {
|
|
39
|
+
if (!decision)
|
|
40
|
+
return true;
|
|
41
|
+
if (decision.lane === "none")
|
|
42
|
+
return true;
|
|
43
|
+
if (decision.ambiguity?.ambiguous === true)
|
|
44
|
+
return true;
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
function redactClassifierMessage(message) {
|
|
48
|
+
return message
|
|
49
|
+
.replace(/sk-[A-Za-z0-9_-]+/g, "[redacted]")
|
|
50
|
+
.replace(/(api[_-]?key\s*[:=]\s*)\S+/gi, "$1[redacted]")
|
|
51
|
+
.slice(0, 300);
|
|
52
|
+
}
|
|
53
|
+
function diagnosticFromError(binding, error) {
|
|
54
|
+
const message = redactClassifierMessage(error instanceof Error ? error.message : String(error));
|
|
55
|
+
let code = "unknown";
|
|
56
|
+
let model;
|
|
57
|
+
if (error instanceof PluginValidationError) {
|
|
58
|
+
code = error.code;
|
|
59
|
+
}
|
|
60
|
+
else if (typeof error === "object" &&
|
|
61
|
+
error !== null &&
|
|
62
|
+
"code" in error &&
|
|
63
|
+
typeof error.code === "string") {
|
|
64
|
+
code = error.code;
|
|
65
|
+
}
|
|
66
|
+
if (typeof error === "object" &&
|
|
67
|
+
error !== null &&
|
|
68
|
+
"model" in error &&
|
|
69
|
+
typeof error.model === "string") {
|
|
70
|
+
model = error.model;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
pluginId: binding.pluginId,
|
|
74
|
+
packageName: binding.packageName,
|
|
75
|
+
mode: binding.mode,
|
|
76
|
+
code,
|
|
77
|
+
message,
|
|
78
|
+
...(model !== undefined ? { model } : {}),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
async function runClassifier(binding, input) {
|
|
82
|
+
try {
|
|
83
|
+
const raw = await binding.capability.classify(input);
|
|
84
|
+
return {
|
|
85
|
+
ok: true,
|
|
86
|
+
result: validateSemanticClassifierResult(raw, {
|
|
87
|
+
expectedClaimKeys: input.propositions.map((proposition) => proposition.claimKey),
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
return { ok: false, diagnostic: diagnosticFromError(binding, error) };
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function fillMissingDecisions(input, decisions, builtin) {
|
|
96
|
+
const byKey = new Map(decisions.map((decision) => [decision.claimKey, decision]));
|
|
97
|
+
const builtinByKey = new Map((builtin?.decisions ?? []).map((decision) => [decision.claimKey, decision]));
|
|
98
|
+
return input.propositions.map((proposition) => {
|
|
99
|
+
const existing = byKey.get(proposition.claimKey);
|
|
100
|
+
if (existing)
|
|
101
|
+
return existing;
|
|
102
|
+
const fallback = builtinByKey.get(proposition.claimKey);
|
|
103
|
+
if (fallback)
|
|
104
|
+
return fallback;
|
|
105
|
+
return {
|
|
106
|
+
claimKey: proposition.claimKey,
|
|
107
|
+
lane: "none",
|
|
108
|
+
confidence: 0,
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Compose semantic classifiers according to replace / augment / shadow modes.
|
|
114
|
+
*
|
|
115
|
+
* External providers are skipped unless `operationName` is on the allowlist
|
|
116
|
+
* (`kb_semantic_advisor`, `kb_compile_intent`).
|
|
117
|
+
*/
|
|
118
|
+
// implements REQ-capability-plugin-activation-disclosure-v1, REQ-capability-plugin-observable-behavior-v1
|
|
119
|
+
export async function composeSemanticClassification(resolution, input, options) {
|
|
120
|
+
const allowExternal = allowsExternalSemanticClassifier(options.operationName);
|
|
121
|
+
const stamps = [];
|
|
122
|
+
const diagnostics = [];
|
|
123
|
+
const shadowComparisons = [];
|
|
124
|
+
let fallbackUsed = false;
|
|
125
|
+
let decisions = [];
|
|
126
|
+
if (allowExternal && resolution.replace) {
|
|
127
|
+
const replaced = await runClassifier(resolution.replace, input);
|
|
128
|
+
if (replaced.ok) {
|
|
129
|
+
// Replace success: missing decisions get conservative `none`, not builtin
|
|
130
|
+
// fill. Valid empty decisions[] is abstention (same as ontology replace).
|
|
131
|
+
decisions = fillMissingDecisions(input, replaced.result.decisions, null);
|
|
132
|
+
stamps.push(resolution.replace.stamp);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
diagnostics.push(replaced.diagnostic);
|
|
136
|
+
const builtinResult = await runClassifier(resolution.builtin, input);
|
|
137
|
+
if (builtinResult.ok) {
|
|
138
|
+
decisions = [...builtinResult.result.decisions];
|
|
139
|
+
stamps.push(withFallback(resolution.builtin.stamp, true));
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
diagnostics.push(builtinResult.diagnostic);
|
|
143
|
+
decisions = [];
|
|
144
|
+
}
|
|
145
|
+
fallbackUsed = true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const builtinResult = await runClassifier(resolution.builtin, input);
|
|
150
|
+
if (builtinResult.ok) {
|
|
151
|
+
decisions = [...builtinResult.result.decisions];
|
|
152
|
+
stamps.push(resolution.builtin.stamp);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
diagnostics.push(builtinResult.diagnostic);
|
|
156
|
+
decisions = [];
|
|
157
|
+
}
|
|
158
|
+
if (allowExternal) {
|
|
159
|
+
for (const augment of resolution.augment) {
|
|
160
|
+
const unresolvedKeys = new Set(input.propositions
|
|
161
|
+
.filter((proposition) => {
|
|
162
|
+
const current = decisions.find((decision) => decision.claimKey === proposition.claimKey);
|
|
163
|
+
return isUnresolved(current);
|
|
164
|
+
})
|
|
165
|
+
.map((proposition) => proposition.claimKey));
|
|
166
|
+
if (unresolvedKeys.size === 0)
|
|
167
|
+
break;
|
|
168
|
+
const subset = {
|
|
169
|
+
propositions: input.propositions.filter((proposition) => unresolvedKeys.has(proposition.claimKey)),
|
|
170
|
+
};
|
|
171
|
+
const augmentResult = await runClassifier(augment, subset);
|
|
172
|
+
if (!augmentResult.ok) {
|
|
173
|
+
diagnostics.push(augmentResult.diagnostic);
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
stamps.push(augment.stamp);
|
|
177
|
+
const byKey = new Map(decisions.map((decision) => [decision.claimKey, decision]));
|
|
178
|
+
for (const decision of augmentResult.result.decisions) {
|
|
179
|
+
if (!unresolvedKeys.has(decision.claimKey))
|
|
180
|
+
continue;
|
|
181
|
+
if (decision.lane === "none")
|
|
182
|
+
continue;
|
|
183
|
+
byKey.set(decision.claimKey, decision);
|
|
184
|
+
}
|
|
185
|
+
decisions = fillMissingDecisions(input, [...byKey.values()], builtinResult.ok ? builtinResult.result : null);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
decisions = fillMissingDecisions(input, decisions, null);
|
|
190
|
+
if (allowExternal) {
|
|
191
|
+
for (const shadow of resolution.shadow) {
|
|
192
|
+
const shadowResult = await runClassifier(shadow, input);
|
|
193
|
+
if (!shadowResult.ok) {
|
|
194
|
+
diagnostics.push(shadowResult.diagnostic);
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
stamps.push(shadow.stamp);
|
|
198
|
+
shadowComparisons.push({
|
|
199
|
+
stamp: shadow.stamp,
|
|
200
|
+
decisions: shadowResult.result.decisions,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
decisions,
|
|
206
|
+
stamps,
|
|
207
|
+
shadowComparisons,
|
|
208
|
+
fallbackUsed,
|
|
209
|
+
diagnostics,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External capability plugins may be imported only from these operation
|
|
3
|
+
* boundaries. sync / check / validate-upsert / upsert / migration / status /
|
|
4
|
+
* proof / doctor / coverage / suggest-predicates must never import a
|
|
5
|
+
* third-party plugin module — allowlisting the classifier call is not enough.
|
|
6
|
+
*/
|
|
7
|
+
export declare const EXTERNAL_SEMANTIC_CLASSIFIER_OPERATIONS: readonly ["kb_semantic_advisor", "kb_compile_intent"];
|
|
8
|
+
export type ExternalSemanticClassifierOperation = (typeof EXTERNAL_SEMANTIC_CLASSIFIER_OPERATIONS)[number];
|
|
9
|
+
export declare function allowsExternalSemanticClassifier(operationName: string): boolean;
|
|
10
|
+
//# sourceMappingURL=external-allowlist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-allowlist.d.ts","sourceRoot":"","sources":["../../src/plugins/external-allowlist.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,uCAAuC,uDAG1C,CAAC;AAGX,MAAM,MAAM,mCAAmC,GAC7C,CAAC,OAAO,uCAAuC,CAAC,CAAC,MAAM,CAAC,CAAC;AAK3D,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,MAAM,GACpB,OAAO,CAET"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External capability plugins may be imported only from these operation
|
|
3
|
+
* boundaries. sync / check / validate-upsert / upsert / migration / status /
|
|
4
|
+
* proof / doctor / coverage / suggest-predicates must never import a
|
|
5
|
+
* third-party plugin module — allowlisting the classifier call is not enough.
|
|
6
|
+
*/
|
|
7
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
8
|
+
export const EXTERNAL_SEMANTIC_CLASSIFIER_OPERATIONS = [
|
|
9
|
+
"kb_semantic_advisor",
|
|
10
|
+
"kb_compile_intent",
|
|
11
|
+
];
|
|
12
|
+
const ALLOWED = new Set(EXTERNAL_SEMANTIC_CLASSIFIER_OPERATIONS);
|
|
13
|
+
// implements REQ-capability-plugin-activation-disclosure-v1, REQ-capability-plugin-observable-behavior-v1
|
|
14
|
+
export function allowsExternalSemanticClassifier(operationName) {
|
|
15
|
+
return ALLOWED.has(operationName);
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { describeConfiguredCapabilityPlugins, readProjectKibiConfig, readProjectPackageJson, type ConfiguredCapabilityPluginDiagnostic, type ProjectPackageManifest, } from "./project-config.js";
|
|
2
|
+
export { PluginResolutionError, PluginValidationError, assertBarePackageName, assertResolvedEntryInsidePackageRoot, hasConsumerNodeModulesLink, hasDeclaredProjectDependency, isBarePackageName, isProjectScopedPackage, packageJsonForResolvedFile, resolveProjectLocalPackage, type ResolvedProjectPackage, } from "./resolve-package.js";
|
|
3
|
+
export { loadPluginPackage, type LoadPluginOptions, type LoadedPlugin, } from "./load-plugin.js";
|
|
4
|
+
export { CapabilityRegistry, CapabilityRegistryCache, createCapabilityRegistry, createCapabilityRegistryCache, createStubBuiltinPlugin, ensureCapabilityRegistry, type BuiltinPluginFactory, type CapabilityModeResolution, type CapabilityProviderBinding, type CapabilityRegistryOptions, type EnsureCapabilityRegistryOptions, } from "./registry.js";
|
|
5
|
+
export { composeSemanticClassification, publicCapabilityStamp, type ComposedSemanticClassifierResult, type SemanticClassifierDiagnostic, } from "./compose-semantic-classifier.js";
|
|
6
|
+
export { composeOntologyCatalog, composeOntologyMatches, type ComposedOntologyCatalog, type StampedOntologyCandidate, } from "./compose-ontology-packs.js";
|
|
7
|
+
export { SourceAnalysisService, analyzeWithResolution, createConservativeFallbackAnalysis, createSourceAnalysisService, type HostSourceAnalysisResult, type SourceAnalysisServiceOptions, } from "./source-analysis-service.js";
|
|
8
|
+
export { EXTERNAL_SEMANTIC_CLASSIFIER_OPERATIONS, allowsExternalSemanticClassifier, type ExternalSemanticClassifierOperation, } from "./external-allowlist.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,mCAAmC,EACnC,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,oCAAoC,EACzC,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,oCAAoC,EACpC,0BAA0B,EAC1B,4BAA4B,EAC5B,iBAAiB,EACjB,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,GAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,GACrC,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,GAClC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,kCAAkC,EAClC,2BAA2B,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,GAClC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,uCAAuC,EACvC,gCAAgC,EAChC,KAAK,mCAAmC,GACzC,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Kibi — repo-local, per-branch, queryable long-term memory for software projects
|
|
3
|
+
Copyright (C) 2026 Piotr Franczyk
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
19
|
+
export { describeConfiguredCapabilityPlugins, readProjectKibiConfig, readProjectPackageJson, } from "./project-config.js";
|
|
20
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
21
|
+
export { PluginResolutionError, PluginValidationError, assertBarePackageName, assertResolvedEntryInsidePackageRoot, hasConsumerNodeModulesLink, hasDeclaredProjectDependency, isBarePackageName, isProjectScopedPackage, packageJsonForResolvedFile, resolveProjectLocalPackage, } from "./resolve-package.js";
|
|
22
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
23
|
+
export { loadPluginPackage, } from "./load-plugin.js";
|
|
24
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
25
|
+
export { CapabilityRegistry, CapabilityRegistryCache, createCapabilityRegistry, createCapabilityRegistryCache, createStubBuiltinPlugin, ensureCapabilityRegistry, } from "./registry.js";
|
|
26
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
27
|
+
export { composeSemanticClassification, publicCapabilityStamp, } from "./compose-semantic-classifier.js";
|
|
28
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
29
|
+
export { composeOntologyCatalog, composeOntologyMatches, } from "./compose-ontology-packs.js";
|
|
30
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
31
|
+
export { SourceAnalysisService, analyzeWithResolution, createConservativeFallbackAnalysis, createSourceAnalysisService, } from "./source-analysis-service.js";
|
|
32
|
+
// implements REQ-capability-plugin-activation-disclosure-v1
|
|
33
|
+
export { EXTERNAL_SEMANTIC_CLASSIFIER_OPERATIONS, allowsExternalSemanticClassifier, } from "./external-allowlist.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type KibiPluginV1 } from "kibi-plugin-sdk";
|
|
2
|
+
import { type ResolvedProjectPackage } from "./resolve-package.js";
|
|
3
|
+
export type LoadedPlugin = Readonly<{
|
|
4
|
+
packageName: string;
|
|
5
|
+
resolved: ResolvedProjectPackage;
|
|
6
|
+
plugin: KibiPluginV1;
|
|
7
|
+
}>;
|
|
8
|
+
export type LoadPluginOptions = Readonly<{
|
|
9
|
+
/** Injectable dynamic import for tests. */
|
|
10
|
+
importModule?: (url: string) => Promise<unknown>;
|
|
11
|
+
/** Injectable package resolver for tests. */
|
|
12
|
+
resolvePackage?: (workspaceRoot: string, packageName: string) => ResolvedProjectPackage;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Dynamically import a project-local plugin package and validate the named
|
|
16
|
+
* `kibiPlugin` export against kibi.plugin.v1.
|
|
17
|
+
*/
|
|
18
|
+
export declare function loadPluginPackage(workspaceRoot: string, packageName: string, options?: LoadPluginOptions): Promise<LoadedPlugin>;
|
|
19
|
+
//# sourceMappingURL=load-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/load-plugin.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEL,KAAK,sBAAsB,EAE5B,MAAM,sBAAsB,CAAC;AAG9B,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC,CAAC;AAGH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,2CAA2C;IAC3C,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,6CAA6C;IAC7C,cAAc,CAAC,EAAE,CACf,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,KAChB,sBAAsB,CAAC;CAC7B,CAAC,CAAC;AAMH;;;GAGG;AAEH,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,YAAY,CAAC,CA8CvB"}
|