kibi-cli 0.17.0 → 0.18.1

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.
Files changed (181) hide show
  1. package/dist/cli-json-command.d.ts.map +1 -1
  2. package/dist/cli-json-command.js +87 -11
  3. package/dist/cli-register-maintenance.d.ts.map +1 -1
  4. package/dist/cli-register-maintenance.js +8 -0
  5. package/dist/cli-register-reporting.d.ts.map +1 -1
  6. package/dist/cli-register-reporting.js +5 -0
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +2 -1
  9. package/dist/commands/aggregated-checks.d.ts.map +1 -1
  10. package/dist/commands/aggregated-checks.js +1 -0
  11. package/dist/commands/coverage.d.ts +5 -0
  12. package/dist/commands/coverage.d.ts.map +1 -1
  13. package/dist/commands/coverage.js +5 -0
  14. package/dist/commands/discovery-table.d.ts.map +1 -1
  15. package/dist/commands/discovery-table.js +96 -5
  16. package/dist/commands/sync/cache.d.ts +2 -0
  17. package/dist/commands/sync/cache.d.ts.map +1 -1
  18. package/dist/commands/sync/cache.js +8 -0
  19. package/dist/commands/sync/persistence.d.ts.map +1 -1
  20. package/dist/commands/sync/persistence.js +58 -1
  21. package/dist/commands/sync.d.ts.map +1 -1
  22. package/dist/commands/sync.js +72 -15
  23. package/dist/commands/usage-metrics.d.ts +66 -2
  24. package/dist/commands/usage-metrics.d.ts.map +1 -1
  25. package/dist/commands/usage-metrics.js +34 -24
  26. package/dist/commands/usage-remediation.d.ts +9 -0
  27. package/dist/commands/usage-remediation.d.ts.map +1 -0
  28. package/dist/commands/usage-remediation.js +52 -0
  29. package/dist/extractors/markdown.d.ts +8 -0
  30. package/dist/extractors/markdown.d.ts.map +1 -1
  31. package/dist/extractors/markdown.js +69 -2
  32. package/dist/operations/modeling/logic-modeling.d.ts.map +1 -1
  33. package/dist/operations/modeling/logic-modeling.js +14 -5
  34. package/dist/operations/modeling/model-requirement.d.ts.map +1 -1
  35. package/dist/operations/modeling/model-requirement.js +27 -2
  36. package/dist/operations/modeling/predicate-applyplan.d.ts +1 -1
  37. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  38. package/dist/operations/modeling/predicate-applyplan.js +18 -6
  39. package/dist/operations/modeling/predicate-inference.d.ts.map +1 -1
  40. package/dist/operations/modeling/predicate-inference.js +5 -17
  41. package/dist/operations/modeling/predicate-loader.js +1 -1
  42. package/dist/operations/modeling/predicate-types.d.ts +9 -1
  43. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  44. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  45. package/dist/operations/modeling/suggest-predicates.js +35 -11
  46. package/dist/operations/mutation/audit.js +1 -1
  47. package/dist/operations/mutation/contradictions.d.ts +1 -1
  48. package/dist/operations/mutation/contradictions.d.ts.map +1 -1
  49. package/dist/operations/mutation/contradictions.js +23 -18
  50. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  51. package/dist/operations/mutation/serialization.js +6 -3
  52. package/dist/operations/mutation/upsert.d.ts +3 -1
  53. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  54. package/dist/operations/mutation/upsert.js +51 -12
  55. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  56. package/dist/operations/mutation/validate-upsert.js +18 -2
  57. package/dist/operations/mutation/validation.d.ts.map +1 -1
  58. package/dist/operations/mutation/validation.js +8 -0
  59. package/dist/operations/semantic-advisor/analysis-receipt.d.ts.map +1 -1
  60. package/dist/operations/semantic-advisor/analysis-receipt.js +7 -1
  61. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  62. package/dist/operations/semantic-advisor/analyze-prose.js +76 -61
  63. package/dist/operations/semantic-advisor/clauses.d.ts +1 -0
  64. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  65. package/dist/operations/semantic-advisor/clauses.js +7 -7
  66. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts +18 -0
  67. package/dist/operations/semantic-advisor/ingestion-boundary.d.ts.map +1 -0
  68. package/dist/operations/semantic-advisor/ingestion-boundary.js +167 -0
  69. package/dist/operations/semantic-advisor/shared.d.ts +8 -0
  70. package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
  71. package/dist/operations/semantic-advisor/shared.js +37 -3
  72. package/dist/operations/semantic-advisor/types.d.ts +5 -0
  73. package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
  74. package/dist/prolog/codec.d.ts.map +1 -1
  75. package/dist/prolog/codec.js +9 -2
  76. package/dist/prolog.d.ts +6 -0
  77. package/dist/prolog.d.ts.map +1 -1
  78. package/dist/prolog.js +240 -61
  79. package/dist/public/diagnostic-usage.d.ts +17 -0
  80. package/dist/public/diagnostic-usage.d.ts.map +1 -0
  81. package/dist/public/diagnostic-usage.js +152 -0
  82. package/dist/public/distribution-parity.d.ts +90 -0
  83. package/dist/public/distribution-parity.d.ts.map +1 -0
  84. package/dist/public/distribution-parity.js +367 -0
  85. package/dist/public/impact/full-kb-quality.d.ts +2 -0
  86. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  87. package/dist/public/impact/full-kb-quality.js +53 -1
  88. package/dist/public/impact-diagnostics.d.ts +2 -0
  89. package/dist/public/impact-diagnostics.d.ts.map +1 -1
  90. package/dist/public/impact-diagnostics.js +1 -0
  91. package/dist/public/operations/catalog.d.ts +151 -6
  92. package/dist/public/operations/catalog.d.ts.map +1 -1
  93. package/dist/public/operations/check-executor.d.ts.map +1 -1
  94. package/dist/public/operations/check-executor.js +4 -0
  95. package/dist/public/operations/discovery-executors.d.ts +6 -0
  96. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  97. package/dist/public/operations/discovery-executors.js +18 -2
  98. package/dist/public/operations/index.d.ts +4 -0
  99. package/dist/public/operations/index.d.ts.map +1 -1
  100. package/dist/public/operations/index.js +4 -0
  101. package/dist/public/operations/legacy-migration-plan.d.ts +113 -0
  102. package/dist/public/operations/legacy-migration-plan.d.ts.map +1 -0
  103. package/dist/public/operations/legacy-migration-plan.js +409 -0
  104. package/dist/public/operations/node-ports.d.ts.map +1 -1
  105. package/dist/public/operations/node-ports.js +90 -0
  106. package/dist/public/operations/repair-plan.d.ts +184 -0
  107. package/dist/public/operations/repair-plan.d.ts.map +1 -0
  108. package/dist/public/operations/repair-plan.js +397 -0
  109. package/dist/public/operations/runtime-types.d.ts +7 -0
  110. package/dist/public/operations/runtime-types.d.ts.map +1 -1
  111. package/dist/public/operations/specs/check.d.ts +2 -2
  112. package/dist/public/operations/specs/check.js +2 -2
  113. package/dist/public/operations/specs/discovery.d.ts +1 -1
  114. package/dist/public/operations/specs/discovery.js +1 -1
  115. package/dist/public/operations/specs/modeling.d.ts +19 -1
  116. package/dist/public/operations/specs/modeling.d.ts.map +1 -1
  117. package/dist/public/operations/specs/modeling.js +16 -1
  118. package/dist/public/operations/specs/mutation-schemas.d.ts +96 -1
  119. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  120. package/dist/public/operations/specs/mutation-schemas.js +40 -1
  121. package/dist/public/operations/specs/reporting.d.ts +42 -1
  122. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  123. package/dist/public/operations/specs/reporting.js +70 -6
  124. package/dist/public/operations/specs/semantic.js +1 -1
  125. package/dist/public/operations/specs/upsert.d.ts +96 -1
  126. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  127. package/dist/public/operations/workspace-snapshot.d.ts +10 -0
  128. package/dist/public/operations/workspace-snapshot.d.ts.map +1 -0
  129. package/dist/public/operations/workspace-snapshot.js +20 -0
  130. package/dist/public/schemas/entity.d.ts.map +1 -1
  131. package/dist/public/schemas/entity.js +43 -1
  132. package/dist/public/skills/kibi-traceability/SKILL.md +7 -1
  133. package/dist/public/skills/kibi-usage/SKILL.md +10 -4
  134. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +1 -1
  135. package/dist/public/skills/kibi-usage/resources/logic-ir.md +1 -1
  136. package/dist/public/skills/kibi-usage/resources/workflows.md +19 -2
  137. package/dist/public/telemetry-acceptance.d.ts +89 -0
  138. package/dist/public/telemetry-acceptance.d.ts.map +1 -0
  139. package/dist/public/telemetry-acceptance.js +597 -0
  140. package/dist/public/telemetry-remediation.d.ts +33 -0
  141. package/dist/public/telemetry-remediation.d.ts.map +1 -0
  142. package/dist/public/telemetry-remediation.js +257 -0
  143. package/dist/public/verification-receipt.d.ts +75 -0
  144. package/dist/public/verification-receipt.d.ts.map +1 -0
  145. package/dist/public/verification-receipt.js +129 -0
  146. package/dist/schemas/entity.schema.json +96 -2
  147. package/dist/traceability/temp-kb.d.ts.map +1 -1
  148. package/dist/traceability/temp-kb.js +36 -3
  149. package/dist/types/entities.d.ts +1 -0
  150. package/dist/types/entities.d.ts.map +1 -1
  151. package/dist/utils/rule-registry.d.ts +2 -0
  152. package/dist/utils/rule-registry.d.ts.map +1 -1
  153. package/package.json +30 -2
  154. package/src/public/diagnostic-usage.ts +206 -0
  155. package/src/public/distribution-parity.ts +580 -0
  156. package/src/public/impact/full-kb-quality.ts +74 -1
  157. package/src/public/impact-diagnostics.ts +16 -0
  158. package/src/public/operations/check-executor.ts +4 -0
  159. package/src/public/operations/discovery-executors.ts +24 -2
  160. package/src/public/operations/index.ts +4 -0
  161. package/src/public/operations/legacy-migration-plan.ts +688 -0
  162. package/src/public/operations/node-ports.ts +109 -0
  163. package/src/public/operations/repair-plan.ts +562 -0
  164. package/src/public/operations/runtime-types.ts +8 -0
  165. package/src/public/operations/specs/check.ts +2 -2
  166. package/src/public/operations/specs/discovery.ts +1 -1
  167. package/src/public/operations/specs/modeling.ts +19 -1
  168. package/src/public/operations/specs/mutation-schemas.ts +47 -1
  169. package/src/public/operations/specs/reporting.ts +91 -6
  170. package/src/public/operations/specs/semantic.ts +1 -1
  171. package/src/public/operations/workspace-snapshot.ts +28 -0
  172. package/src/public/schemas/entity.ts +44 -1
  173. package/src/public/skills/kibi-traceability/SKILL.md +7 -1
  174. package/src/public/skills/kibi-usage/SKILL.md +10 -4
  175. package/src/public/skills/kibi-usage/resources/fact-lanes.md +1 -1
  176. package/src/public/skills/kibi-usage/resources/logic-ir.md +1 -1
  177. package/src/public/skills/kibi-usage/resources/workflows.md +19 -2
  178. package/src/public/telemetry-acceptance.ts +859 -0
  179. package/src/public/telemetry-remediation.ts +462 -0
  180. package/src/public/verification-receipt.ts +170 -0
  181. package/src/schemas/entity.schema.json +96 -2
@@ -2,7 +2,8 @@ import { readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { buildStrictWriteSet } from "../../public/check-types.js";
4
4
  import { getSchemaVersionStatus } from "../../public/schema-version.js";
5
- import { semanticClaimKey } from "../semantic-advisor/clauses.js";
5
+ import { normalizeSemanticClause, semanticClaimKey, } from "../semantic-advisor/clauses.js";
6
+ import { semanticSourceHash } from "../semantic-advisor/shared.js";
6
7
  import { buildLogicApplyPlan } from "./logic-modeling.js";
7
8
  import { strictWriteSetToApplyPlan, writeSetPrimaryEntityId, } from "./requirement-applyplan.js";
8
9
  import { estimateNormativeSignalConfidence, extractRequirementClaim, } from "./requirement-modeler.js";
@@ -108,9 +109,33 @@ export async function handleKbModelRequirement(_prolog, args, workspaceRoot) {
108
109
  };
109
110
  }
110
111
  if (step.type === "req") {
112
+ const claimText = extracted.statement.trim();
113
+ const normalizedClaimText = normalizeSemanticClause(claimText);
111
114
  return {
112
115
  ...step,
113
- properties: { ...properties, logic_claims: logicClaims },
116
+ properties: {
117
+ ...properties,
118
+ semantic_text: claimText,
119
+ logic_claims: logicClaims,
120
+ semantic_clauses: [claimText],
121
+ semantic_inventory_version: "kibi.semantic-inventory.v1",
122
+ semantic_source_field: "semantic_text",
123
+ semantic_source_hash: semanticSourceHash(claimText),
124
+ semantic_inventory: [
125
+ {
126
+ claim_key: claimKey,
127
+ claim_text: normalizedClaimText,
128
+ role: /\b(?:must|shall|should|required|requires?)\b/i.test(claimText)
129
+ ? "normative"
130
+ : "descriptive",
131
+ status: "modeled",
132
+ span: {
133
+ start: 0,
134
+ end: Buffer.byteLength(normalizedClaimText, "utf8"),
135
+ },
136
+ },
137
+ ],
138
+ },
114
139
  };
115
140
  }
116
141
  return step;
@@ -1,5 +1,5 @@
1
1
  import type { PredicateSchemaCandidate, PredicateSuggestion, SuggestPredicatesArgs } from "./predicate-types.js";
2
- export declare function buildSuggestion(schema: PredicateSchemaCandidate, text: string, subject: string, score: number): PredicateSuggestion;
2
+ export declare function buildSuggestion(schema: PredicateSchemaCandidate, text: string, subject: string, score: number, argumentBindings?: Readonly<Record<string, string>>, polarityHint?: "assert" | "deny"): PredicateSuggestion;
3
3
  export declare function buildPredicateApplyPlan(suggestion: PredicateSuggestion, args: SuggestPredicatesArgs): Array<Record<string, unknown>>;
4
4
  export declare function buildRelationshipPlan(factId: string | undefined, requirementId: string | undefined, claimText?: string, existingLogicClaims?: readonly string[]): Record<string, unknown> | null;
5
5
  export declare function buildGapApplyPlan(text: string, args: SuggestPredicatesArgs): Array<Record<string, unknown>>;
@@ -1 +1 @@
1
- {"version":3,"file":"predicate-applyplan.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-applyplan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAI9B,wBAAgB,eAAe,CAC7B,MAAM,EAAE,wBAAwB,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,mBAAmB,CAuBrB;AAGD,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,mBAAmB,EAC/B,IAAI,EAAE,qBAAqB,GAC1B,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAgChC;AAGD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,SAAS,CAAC,EAAE,MAAM,EAClB,mBAAmB,GAAE,SAAS,MAAM,EAAO,GAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAwBhC;AAGD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,qBAAqB,GAC1B,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA+BhC"}
1
+ {"version":3,"file":"predicate-applyplan.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-applyplan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAI9B,wBAAgB,eAAe,CAC7B,MAAM,EAAE,wBAAwB,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,gBAAgB,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,EACvD,YAAY,CAAC,EAAE,QAAQ,GAAG,MAAM,GAC/B,mBAAmB,CAmCrB;AAGD,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,mBAAmB,EAC/B,IAAI,EAAE,qBAAqB,GAC1B,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAiChC;AAGD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,SAAS,CAAC,EAAE,MAAM,EAClB,mBAAmB,GAAE,SAAS,MAAM,EAAO,GAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAwBhC;AAGD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,qBAAqB,GAC1B,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA+BhC"}
@@ -3,22 +3,32 @@ import { inferArgs } from "./predicate-inference.js";
3
3
  import { schemaForCandidate } from "./predicate-loader.js";
4
4
  import { hashId } from "./predicate-utils.js";
5
5
  // implements REQ-mcp-suggest-predicates
6
- export function buildSuggestion(schema, text, subject, score) {
7
- const predicateArgs = inferArgs(schema, text, subject);
6
+ export function buildSuggestion(schema, text, subject, score, argumentBindings = {}, polarityHint) {
7
+ const inferredArgs = inferArgs(schema, text, subject);
8
+ const predicateArgs = schema.argument_names.map((name, index) => {
9
+ const exactBinding = argumentBindings[name];
10
+ return typeof exactBinding === "string" && exactBinding.trim().length > 0
11
+ ? exactBinding.trim()
12
+ : (inferredArgs[index] ?? "unknown");
13
+ });
14
+ const unboundArguments = schema.argument_names.filter((_name, index) => predicateArgs[index] === "unknown");
8
15
  const canonicalKey = `${schema.predicate_name}(${predicateArgs.join(",")})`;
9
16
  // Permission-style inference carries the deontic decision as its final
10
17
  // argument. Preserve that polarity in the typed suggestion instead of
11
18
  // silently turning a prohibition into an assertion.
12
- const polarity = predicateArgs.at(-1) === "deny" ||
13
- /\b(?:must\s+not|shall\s+not|never|cannot|can't|forbidden|prohibited)\b/i.test(text)
14
- ? "deny"
15
- : "assert";
19
+ const polarity = polarityHint ??
20
+ (predicateArgs.at(-1) === "deny" ||
21
+ /\b(?:must\s+not|shall\s+not|never|cannot|can't|forbidden|prohibited)\b/i.test(text)
22
+ ? "deny"
23
+ : "assert");
16
24
  return {
17
25
  id: hashId("SUGGEST", [schema.id, canonicalKey, text]),
18
26
  predicate_name: schema.predicate_name,
19
27
  predicate_args: predicateArgs,
20
28
  canonical_key: canonicalKey,
21
29
  polarity,
30
+ binding_status: unboundArguments.length === 0 ? "complete" : "incomplete",
31
+ unbound_arguments: unboundArguments,
22
32
  score,
23
33
  rationale: `Matched ${schema.predicate_name} because the prose overlaps with ${schema.tags.join(", ")} cues.`,
24
34
  schema: schemaForCandidate(schema),
@@ -26,6 +36,8 @@ export function buildSuggestion(schema, text, subject, score) {
26
36
  }
27
37
  // implements REQ-mcp-suggest-predicates
28
38
  export function buildPredicateApplyPlan(suggestion, args) {
39
+ if (suggestion.binding_status !== "complete")
40
+ return [];
29
41
  const claimKey = semanticClaimKey(args.text);
30
42
  const factId = hashId("FACT-PRED", [
31
43
  args.requirementId ?? "",
@@ -1 +1 @@
1
- {"version":3,"file":"predicate-inference.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-inference.ts"],"names":[],"mappings":"AAqDA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EASL,YAAY,EAKb,MAAM,sBAAsB,CAAC;AAG9B,wBAAgB,SAAS,CACvB,MAAM,EAAE,wBAAwB,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CA0JV;AAGD,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"predicate-inference.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-inference.ts"],"names":[],"mappings":"AAqDA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EASL,YAAY,EAIb,MAAM,sBAAsB,CAAC;AAG9B,wBAAgB,SAAS,CACvB,MAAM,EAAE,wBAAwB,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAiJV;AAGD,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { inferAuditEventRuleArgs, inferAvailabilitySlaArgs, inferConsentRuleArgs, inferDataResidencyRuleArgs, inferDependencyRuleArgs, inferEscalationRuleArgs, inferExceptionRuleArgs, inferGuardArgs, inferIdempotencyRuleArgs, inferLifecycleRuleArgs, inferMutualExclusionArgs, inferNotificationRouteArgs, inferOwnershipRuleArgs, inferPermissionRuleArgs, inferRetryPolicyArgs, } from "./predicate-inference-1.js";
2
2
  import { inferAbsenceRequirementArgs, inferAbstractionBoundaryRuleArgs, inferBatchOperationRuleArgs, inferBuildConstraintArgs, inferCodingStandardRuleArgs, inferConflictResolutionRuleArgs, inferConsistencyRuleArgs, inferEnvironmentSafetyRuleArgs, inferFallbackRuleArgs, inferMigrationBoundaryRuleArgs, inferOfflineBehaviorRuleArgs, inferOrderedStrategyRuleArgs, inferPlatformConsistencyRuleArgs, inferPreservationRuleArgs, inferRefreshPolicyRuleArgs, inferReleaseGateRuleArgs, inferSchemaInvariantRuleArgs, inferSecurityConfigurationRuleArgs, } from "./predicate-inference-2.js";
3
3
  import { inferConditionalBehaviorArgs, inferDefaultValueArgs, inferDocumentationStandardRuleArgs, inferEnforcementLocationRuleArgs, inferRateLimitArgs, inferReconciliationRuleArgs, inferScopedAuthorizationRuleArgs, inferStateMembershipArgs, inferStateTransitionArgs, inferTemporalOrderArgs, inferThrottlePolicyRuleArgs, inferUniquenessArgs, inferVisualLayoutRuleArgs, inferWarmupPolicyRuleArgs, } from "./predicate-inference-3.js";
4
- import { inferDuration, inferDurationUnit, inferEvent, inferGate, inferNumber, inferOperator, inferResource, inferScope, inferSubject, inferTrigger, inferUnit, normalizePredicateToken, slug, } from "./predicate-utils.js";
4
+ import { inferDuration, inferDurationUnit, inferEvent, inferGate, inferNumber, inferOperator, inferResource, inferScope, inferSubject, inferTrigger, inferUnit, slug, } from "./predicate-utils.js";
5
5
  // implements REQ-mcp-suggest-predicates
6
6
  export function inferArgs(schema, text, subject) {
7
7
  const lower = text.toLowerCase();
@@ -141,22 +141,10 @@ export function inferArgs(schema, text, subject) {
141
141
  case "rate_limit":
142
142
  return inferRateLimitArgs(text);
143
143
  default:
144
- return schema.argument_names.map((name) => {
145
- if (name === "subject")
146
- return subject;
147
- const normalized = normalizePredicateToken(name);
148
- const words = normalized.split("_").filter((word) => word.length > 2);
149
- // Project-local schemas often use the exact domain vocabulary in
150
- // their ordered argument names. Reuse that declared value when the
151
- // complete name (or all meaningful words) occurs in the claim; keep
152
- // genuinely unbound arguments explicit instead of guessing.
153
- const phrase = words.join(" ");
154
- return phrase.length > 0 &&
155
- (lower.includes(phrase) ||
156
- words.every((word) => lower.includes(word)))
157
- ? normalized
158
- : "unknown";
159
- });
144
+ // A schema argument name declares a role, not its ground value. Only
145
+ // the conventional subject slot has a separately reviewed hint;
146
+ // project-local non-subject arguments require exact argumentBindings.
147
+ return schema.argument_names.map((name) => name === "subject" ? subject : "unknown");
160
148
  }
161
149
  }
162
150
  // implements REQ-mcp-suggest-predicates
@@ -27,7 +27,7 @@ export async function loadExistingPredicateSchemas(prolog, includeExistingSchema
27
27
  return [];
28
28
  }
29
29
  try {
30
- const queryResult = await prolog.query("findall([Id,'fact',Props], (kb_entity(Id, 'fact', Props), member(fact_kind=predicate_schema, Props)), Results)");
30
+ const queryResult = await prolog.query("findall([Id,'fact',Props], (kb:predicate_schema(Id, _Namespace, _Name, _Arity, _ArgumentNames, _ArgumentTypes), kb_entity(Id, 'fact', Props)), Results)");
31
31
  if (!queryResult.success) {
32
32
  throw new Error(queryResult.error || "Query failed with unknown error");
33
33
  }
@@ -26,6 +26,12 @@ export type SuggestPredicatesArgs = Readonly<Record<string, unknown>> & {
26
26
  readonly maxCandidates?: number;
27
27
  readonly minScore?: number;
28
28
  readonly includeExistingSchemas?: boolean;
29
+ /** Exact reviewed schema candidate ID to select instead of lexical ranking. */
30
+ readonly schemaId?: string;
31
+ /** Exact values keyed by the selected predicate schema's argument_names. */
32
+ readonly argumentBindings?: Readonly<Record<string, string>>;
33
+ /** Reviewed polarity override for negation-scope false positives. */
34
+ readonly polarityHint?: PredicatePolarity;
29
35
  /** Existing requirement claim manifest. Relationship guidance merges this list. */
30
36
  readonly existingLogicClaims?: readonly string[];
31
37
  };
@@ -35,6 +41,8 @@ export interface PredicateSuggestion {
35
41
  predicate_args: string[];
36
42
  canonical_key: string;
37
43
  polarity: PredicatePolarity;
44
+ binding_status: "complete" | "incomplete";
45
+ unbound_arguments: string[];
38
46
  score: number;
39
47
  rationale: string;
40
48
  schema: Omit<PredicateSchemaCandidate, "keywords"> & {
@@ -54,7 +62,7 @@ export interface SuggestPredicatesResult {
54
62
  requirementId: string | null;
55
63
  subject: string;
56
64
  candidates: PredicateSuggestion[];
57
- recommendedAction: "apply_requires_predicate" | "record_ontology_gap";
65
+ recommendedAction: "apply_requires_predicate" | "provide_argument_bindings" | "resolve_schema_reference" | "record_ontology_gap";
58
66
  applyPlan: Array<Record<string, unknown>>;
59
67
  relationshipPlan: Record<string, unknown> | null;
60
68
  warnings: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"predicate-types.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAGlD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAGD,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,mGAAmG;IACnG,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAGD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAC1C,mFAAmF;IACnF,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClD,CAAC;AAGF,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,CAAC,wBAAwB,EAAE,UAAU,CAAC,GAAG;QACnD,WAAW,EAAE,mBAAmB,CAAC;KAClC,CAAC;CACH;AAGD,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,mBAAmB,EAAE,CAAC;QAClC,iBAAiB,EAAE,0BAA0B,GAAG,qBAAqB,CAAC;QACtE,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1C,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QACjD,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC3C"}
1
+ {"version":3,"file":"predicate-types.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/predicate-types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAGlD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAGD,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,mGAAmG;IACnG,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAGD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAC1C,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7D,qEAAqE;IACrE,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;IAC1C,mFAAmF;IACnF,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClD,CAAC;AAGF,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,cAAc,EAAE,UAAU,GAAG,YAAY,CAAC;IAC1C,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,CAAC,wBAAwB,EAAE,UAAU,CAAC,GAAG;QACnD,WAAW,EAAE,mBAAmB,CAAC;KAClC,CAAC;CACH;AAGD,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,mBAAmB,EAAE,CAAC;QAClC,iBAAiB,EACb,0BAA0B,GAC1B,2BAA2B,GAC3B,0BAA0B,GAC1B,qBAAqB,CAAC;QAC1B,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1C,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QACjD,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"suggest-predicates.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/suggest-predicates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACX,MAAM,0CAA0C,CAAC;AAYlD,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EACV,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAK9B,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,uBAAuB,CAAC,CA4ElC;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,uBAAuB,CAAC,CAElC"}
1
+ {"version":3,"file":"suggest-predicates.d.ts","sourceRoot":"","sources":["../../../src/operations/modeling/suggest-predicates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACX,MAAM,0CAA0C,CAAC;AAYlD,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EACV,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAK9B,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,uBAAuB,CAAC,CA+GlC;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,uBAAuB,CAAC,CAElC"}
@@ -15,30 +15,54 @@ export async function handleKbSuggestPredicates(prolog, args) {
15
15
  const subject = inferSubject(text, args.subjectHint);
16
16
  const existingSchemas = await loadExistingPredicateSchemas(prolog, args.includeExistingSchemas ?? true, warnings);
17
17
  const schemas = [...existingSchemas, ...BUILT_IN_PREDICATE_SCHEMAS];
18
- const candidates = schemas
18
+ const selectedSchemas = args.schemaId
19
+ ? schemas.filter((schema) => schema.id === args.schemaId)
20
+ : schemas;
21
+ if (args.schemaId && selectedSchemas.length === 0) {
22
+ warnings.push(`Requested predicate schema ${args.schemaId} is not available. Refresh the KB or correct schemaId before retrying; no ontology-gap or predicate write plan was generated.`);
23
+ }
24
+ const candidates = selectedSchemas
19
25
  .map((schema) => ({ schema, score: scoreSchema(schema, text) }))
20
- .filter((scored) => scored.score >= minScore)
26
+ .filter((scored) => args.schemaId || scored.score >= minScore)
21
27
  .sort((left, right) => {
22
28
  if (right.score !== left.score)
23
29
  return right.score - left.score;
24
30
  return left.schema.predicate_name.localeCompare(right.schema.predicate_name);
25
31
  })
26
32
  .slice(0, maxCandidates)
27
- .map((scored) => buildSuggestion(scored.schema, text, subject, scored.score));
28
- if (candidates.length === 0) {
33
+ .map((scored) => buildSuggestion(scored.schema, text, subject, scored.score, args.argumentBindings, args.polarityHint));
34
+ if (candidates.length === 0 && !args.schemaId) {
29
35
  warnings.push("No predicate candidate met minScore. If this is recurring domain language, create a fact_kind=predicate_schema fact; otherwise keep the generated review:ontology-gap observation. Do not invent unsupported predicate names without a predicate_schema.");
30
36
  }
31
- const recommendedAction = candidates.length > 0 ? "apply_requires_predicate" : "record_ontology_gap";
32
37
  const firstCandidate = candidates[0];
33
- const applyPlan = firstCandidate
34
- ? buildPredicateApplyPlan(firstCandidate, args)
35
- : buildGapApplyPlan(text, args);
36
- const relationshipPlan = firstCandidate
38
+ const bindingsComplete = firstCandidate?.binding_status === "complete";
39
+ if (firstCandidate && !bindingsComplete) {
40
+ warnings.push(`Top predicate candidate ${firstCandidate.predicate_name} has unbound arguments: ${firstCandidate.unbound_arguments.join(", ")}. Supply exact argumentBindings keyed by the schema's argument_names before applying it.`);
41
+ }
42
+ const recommendedAction = !firstCandidate
43
+ ? args.schemaId
44
+ ? "resolve_schema_reference"
45
+ : "record_ontology_gap"
46
+ : bindingsComplete
47
+ ? "apply_requires_predicate"
48
+ : "provide_argument_bindings";
49
+ const applyPlan = !firstCandidate
50
+ ? args.schemaId
51
+ ? []
52
+ : buildGapApplyPlan(text, args)
53
+ : bindingsComplete
54
+ ? buildPredicateApplyPlan(firstCandidate, args)
55
+ : [];
56
+ const relationshipPlan = firstCandidate && bindingsComplete
37
57
  ? buildRelationshipPlan(String(applyPlan[0]?.id ?? ""), args.requirementId, text, args.existingLogicClaims)
38
58
  : null;
39
- const textSummary = candidates.length > 0
59
+ const textSummary = firstCandidate && bindingsComplete
40
60
  ? `Suggested ${candidates.length} predicate candidate(s). Top match: ${candidates[0]?.predicate_name}. Apply structured predicate facts before falling back to prose.`
41
- : "No predicate candidate met the confidence threshold; record an ontology gap instead of silently writing prose.";
61
+ : firstCandidate
62
+ ? `Matched ${firstCandidate.predicate_name}, but exact values are still required for: ${firstCandidate.unbound_arguments.join(", ")}. No apply plan was generated.`
63
+ : args.schemaId
64
+ ? `Requested predicate schema ${args.schemaId} is unavailable. No apply plan was generated.`
65
+ : "No predicate candidate met the confidence threshold; record an ontology gap instead of silently writing prose.";
42
66
  const claimKey = semanticClaimKey(text);
43
67
  const logicClaims = Array.from(new Set([...(args.existingLogicClaims ?? []), claimKey]));
44
68
  return {
@@ -17,6 +17,6 @@ export async function recordRelationshipAudits(prolog, relationships) {
17
17
  }
18
18
  }
19
19
  export function buildEntityDeleteAuditGoal(entity) {
20
- const auditEntity = Object.fromEntries(["id", "title", "source", "text_ref"].flatMap((key) => typeof entity[key] === "string" ? [[key, entity[key]]] : []));
20
+ const auditEntity = Object.fromEntries(["id", "title", "source", "text_ref", "semantic_text"].flatMap((key) => typeof entity[key] === "string" ? [[key, entity[key]]] : []));
21
21
  return `kb_retract_entity('${escapeAtom(String(entity.id))}', ${String(entity.type)}, ${buildPropertyList(auditEntity)})`;
22
22
  }
@@ -4,7 +4,7 @@ type TransactionInput = {
4
4
  readonly relationships: readonly RelationshipInput[];
5
5
  readonly skipContradictionCheck: boolean;
6
6
  };
7
- export declare function buildUpsertTransaction(input: TransactionInput): string;
7
+ export declare function buildUpsertCommitGoal(input: TransactionInput): string;
8
8
  export declare function formatUpsertError(entityId: string, raw?: string): string;
9
9
  export {};
10
10
  //# sourceMappingURL=contradictions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contradictions.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/contradictions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,KAAK,gBAAgB,GAAG;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,aAAa,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACrD,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C,CAAC;AAGF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CActE;AAGD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CA0BxE"}
1
+ {"version":3,"file":"contradictions.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/contradictions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,KAAK,gBAAgB,GAAG;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,aAAa,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACrD,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C,CAAC;AAGF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAOrE;AAGD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CA6CxE"}
@@ -2,39 +2,44 @@ import { escapeAtom } from "../../prolog/codec.js";
2
2
  import { formatInvalidRelationshipError } from "./relationships.js";
3
3
  import { buildPropertyList, buildRelationshipMetadata, } from "./serialization.js";
4
4
  // implements REQ-kibi-operation-interface-parity
5
- export function buildUpsertTransaction(input) {
6
- const id = String(input.entity.id);
5
+ export function buildUpsertCommitGoal(input) {
7
6
  const type = String(input.entity.type);
8
- const goals = [
9
- `kb_assert_entity_no_audit(${type}, ${buildPropertyList(input.entity)})`,
10
- ...input.relationships.map((relationship) => `kb_assert_relationship_no_audit(${String(relationship.type)}, '${escapeAtom(String(relationship.from))}', '${escapeAtom(String(relationship.to))}', ${buildRelationshipMetadata(relationship)})`),
11
- ];
12
- if (type === "req" && !input.skipContradictionCheck) {
13
- goals.push(`check_req_contradiction('${escapeAtom(id)}')`);
14
- }
15
- return `rdf_transaction((${goals.join(", ")}))`;
7
+ const relationships = input.relationships.map((relationship) => `rel(${String(relationship.type)}, '${escapeAtom(String(relationship.from))}', '${escapeAtom(String(relationship.to))}', ${buildRelationshipMetadata(relationship)})`);
8
+ return `kb_commit_upsert(${type}, ${buildPropertyList(input.entity)}, [${relationships.join(", ")}], ${input.skipContradictionCheck ? "true" : "false"}, ChangeKind)`;
16
9
  }
17
10
  // implements REQ-kibi-operation-interface-parity
18
11
  export function formatUpsertError(entityId, raw) {
19
12
  if (!raw)
20
13
  return `Failed to upsert entity ${entityId}: Unknown error`;
21
- const invalidRelationship = formatInvalidRelationshipError(raw);
14
+ const stage = raw.match(/\(stage=([^)]+)\)/)?.[1];
15
+ const stageSuffix = stage === undefined ? "" : ` (stage=${stage})`;
16
+ const diagnosticFree = raw.replace(/^__KIBI_(?:STAGE|RUNTIME)__:[^\r\n]*\r?\n?/gm, "");
17
+ if (diagnosticFree.includes("stale_snapshot")) {
18
+ return `Failed to upsert entity ${entityId}: KB snapshot is stale; reattach or refresh the runtime before retrying (stale_snapshot)${stageSuffix}`;
19
+ }
20
+ if (diagnosticFree.includes("Audit journal is locked") ||
21
+ diagnosticFree.includes("audit_log") ||
22
+ diagnosticFree.includes("audit.log") ||
23
+ diagnosticFree.includes("Resource temporarily unavailable")) {
24
+ return `Failed to upsert entity ${entityId}: Audit journal is locked by another Kibi runtime; restart the stale MCP/CLI session before retrying${stageSuffix}`;
25
+ }
26
+ const invalidRelationship = formatInvalidRelationshipError(diagnosticFree);
22
27
  if (invalidRelationship !== null) {
23
- return `Failed to upsert entity ${entityId}: ${invalidRelationship}`;
28
+ return `Failed to upsert entity ${entityId}: ${invalidRelationship}${stageSuffix}`;
24
29
  }
25
- const contradiction = raw.match(/kb_contradiction\(\s*\[([^\]]+)\]\s*\)/);
30
+ const contradiction = diagnosticFree.match(/kb_contradiction\(\s*\[([^\]]+)\]\s*\)/);
26
31
  if (contradiction) {
27
32
  const details = contradiction[1] ?? "";
28
33
  const conflicts = [
29
34
  ...details.matchAll(/(?:'([^']+)'|"([^"\\]*(?:\\.[^"\\]*)*)")-'([^']+)'/g),
30
35
  ].map((match) => ` - Conflicts with ${String(match[3])}: ${String(match[1] ?? match[2])}`);
31
36
  if (conflicts.length > 0) {
32
- return `Contradiction detected for requirement ${entityId}:\n${[...new Set(conflicts)].join("\n")}\n\nTo resolve:\n 1. Add a supersedes relationship from the new requirement to the conflicting one, OR\n 2. Deprecate the conflicting requirement before creating the new one.`;
37
+ return `Contradiction detected for requirement ${entityId}:\n${[...new Set(conflicts)].join("\n")}\n\nTo resolve:\n 1. Add a supersedes relationship from the new requirement to the conflicting one, OR\n 2. Deprecate the conflicting requirement before creating the new one.${stageSuffix}`;
33
38
  }
34
- return `Contradiction detected for entity ${entityId}: This requirement conflicts with existing requirements. Add a supersedes relationship to the conflicting requirement, or deprecate the old requirement before creating the new one.`;
39
+ return `Contradiction detected for entity ${entityId}: This requirement conflicts with existing requirements. Add a supersedes relationship to the conflicting requirement, or deprecate the old requirement before creating the new one.${stageSuffix}`;
35
40
  }
36
- if (raw.includes("rdf_transaction")) {
37
- return `Failed to upsert entity ${entityId}: Transaction failed`;
41
+ if (diagnosticFree.includes("rdf_transaction")) {
42
+ return `Failed to upsert entity ${entityId}: Transaction failed${stageSuffix}`;
38
43
  }
39
- return `Failed to upsert entity ${entityId}: ${raw}`;
44
+ return `Failed to upsert entity ${entityId}: ${diagnosticFree || raw}`;
40
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/serialization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AA6CpD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,MAAM,CAMR;AAGD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAOxE;AAGD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBtD"}
1
+ {"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/serialization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAkDpD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,MAAM,CAMR;AAGD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAOxE;AAGD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBtD"}
@@ -20,16 +20,19 @@ const STRING_FIELDS = [
20
20
  "updated_at",
21
21
  "source",
22
22
  "text_ref",
23
+ "semantic_text",
23
24
  ];
24
25
  function serializeValue(key, value) {
25
26
  if (key === "id" && typeof value === "string") {
26
27
  return `'${value.replaceAll("'", "''")}'`;
27
28
  }
28
- if (Array.isArray(value))
29
- return JSON.stringify(value);
30
- if (key === "rule_ir" || key === "semantic_inventory") {
29
+ if (key === "rule_ir" ||
30
+ key === "semantic_inventory" ||
31
+ key === "verification_receipts") {
31
32
  return toPrologString(JSON.stringify(value));
32
33
  }
34
+ if (Array.isArray(value))
35
+ return JSON.stringify(value);
33
36
  if (typeof value === "string") {
34
37
  return ATOM_FIELDS.includes(key)
35
38
  ? toPrologAtom(value)
@@ -1,5 +1,7 @@
1
1
  import type { OperationContext } from "../../public/operations/runtime-types.js";
2
2
  import type { OperationResult } from "../../public/operations/types.js";
3
- import type { UpsertInput, UpsertPayload } from "./types.js";
3
+ import type { RelationshipInput, UpsertInput, UpsertPayload } from "./types.js";
4
+ export declare function validateAppendOnlyVerificationReceipts(entity: Readonly<Record<string, unknown>>, context: OperationContext): Promise<void>;
5
+ export declare function effectiveRelationships(input: UpsertInput, entity: Readonly<Record<string, unknown>>, relationships: readonly RelationshipInput[], context: OperationContext): Promise<readonly RelationshipInput[]>;
4
6
  export declare function executeUpsert(input: UpsertInput, context: OperationContext): Promise<OperationResult<UpsertPayload>>;
5
7
  //# sourceMappingURL=upsert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/upsert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAaxE,OAAO,KAAK,EAAqB,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAkChF,wBAAsB,aAAa,CACjC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CA0FzC"}
1
+ {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/upsert.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAgBxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA8BhF,wBAAsB,sCAAsC,CAC1D,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,aAAa,EAAE,SAAS,iBAAiB,EAAE,EAC3C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAgBvC;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAuGzC"}
@@ -1,9 +1,10 @@
1
1
  import { escapeAtom } from "../../prolog/codec.js";
2
+ import { loadEntities } from "../../public/operations/discovery-entities.js";
3
+ import { appendOnlyVerificationReceiptHistoryErrors } from "../../public/verification-receipt.js";
2
4
  import { analyzeSemanticAdvisorInput } from "../semantic-advisor/analyze-prose.js";
3
- import { recordEntityAudit, recordRelationshipAudits } from "./audit.js";
4
- import { buildUpsertTransaction, formatUpsertError } from "./contradictions.js";
5
+ import { assertLogicalGroundingClaimKeys, assertSemanticInventoryBoundary, } from "../semantic-advisor/ingestion-boundary.js";
6
+ import { buildUpsertCommitGoal, formatUpsertError } from "./contradictions.js";
5
7
  import { existingRelationships, validateLiveRelationshipTargets, validateRelationshipSources, validateStrictLanePairing, } from "./relationships.js";
6
- import { saveMutation } from "./save.js";
7
8
  import { validateSymbolGranularity } from "./symbol-granularity.js";
8
9
  import { refreshSymbolCoordinates } from "./symbol-refresh.js";
9
10
  import { validateUpsertInput } from "./validation.js";
@@ -14,7 +15,36 @@ function requireProlog(context) {
14
15
  }
15
16
  return context.prolog;
16
17
  }
17
- async function effectiveRelationships(input, entity, relationships, context) {
18
+ function receiptRecords(value) {
19
+ if (!Array.isArray(value))
20
+ return undefined;
21
+ return value.filter((receipt) => receipt !== null &&
22
+ typeof receipt === "object" &&
23
+ !Array.isArray(receipt));
24
+ }
25
+ function parseChangeKind(value) {
26
+ const normalized = value?.trim().replace(/^['"]|['"]$/g, "");
27
+ return normalized === "created" || normalized === "updated"
28
+ ? normalized
29
+ : null;
30
+ }
31
+ export async function validateAppendOnlyVerificationReceipts(entity, context) {
32
+ if (entity.type !== "test")
33
+ return;
34
+ const existing = await loadEntities(requireProlog(context), {
35
+ id: String(entity.id),
36
+ type: "test",
37
+ });
38
+ const previous = receiptRecords(existing[0]?.verification_receipts);
39
+ if (!previous || previous.length === 0)
40
+ return;
41
+ const next = receiptRecords(entity.verification_receipts);
42
+ const errors = appendOnlyVerificationReceiptHistoryErrors(previous, next);
43
+ if (errors.length > 0) {
44
+ throw new Error(`Entity validation failed: ${errors.join("; ")}`);
45
+ }
46
+ }
47
+ export async function effectiveRelationships(input, entity, relationships, context) {
18
48
  if (input.relationships !== undefined && input.relationships.length > 0) {
19
49
  return relationships;
20
50
  }
@@ -36,13 +66,18 @@ export async function executeUpsert(input, context) {
36
66
  const prolog = requireProlog(context);
37
67
  try {
38
68
  const validated = validateUpsertInput(input, context.clock());
69
+ await validateAppendOnlyVerificationReceipts(validated.entity, context);
39
70
  validateRelationshipSources(input.id, validated.relationships);
40
71
  await validateSymbolGranularity(validated.entity, validated.relationships, context);
41
72
  const relationships = await effectiveRelationships(input, validated.entity, validated.relationships, context);
42
73
  await validateStrictLanePairing(prolog, relationships);
43
74
  await validateLiveRelationshipTargets(prolog, validated.entity, relationships);
44
- const exists = await prolog.query(`once(kb_entity('${escapeAtom(input.id)}', _, _))`);
45
- const transaction = buildUpsertTransaction({
75
+ const semantic = analyzeSemanticAdvisorInput({
76
+ payload: { ...input, relationships },
77
+ });
78
+ assertSemanticInventoryBoundary({ ...input, relationships }, relationships, semantic.receipt);
79
+ await assertLogicalGroundingClaimKeys(prolog, { ...input, relationships }, relationships);
80
+ const transaction = buildUpsertCommitGoal({
46
81
  entity: validated.entity,
47
82
  relationships,
48
83
  skipContradictionCheck: input._skipContradictionCheck === true,
@@ -51,9 +86,14 @@ export async function executeUpsert(input, context) {
51
86
  if (!written.success) {
52
87
  throw new Error(formatUpsertError(input.id, written.error));
53
88
  }
54
- await recordEntityAudit(prolog, exists.success ? "updated" : "created", validated.entity);
55
- await recordRelationshipAudits(prolog, relationships);
56
- await saveMutation(prolog);
89
+ // The combined commit is the sole mutation boundary. Invalidate reads only
90
+ // after Prolog reports success so a failed/rolled-back commit does not
91
+ // disturb callers' view of the current snapshot.
92
+ prolog.invalidateCache?.();
93
+ const changeKind = parseChangeKind(written.bindings.ChangeKind);
94
+ if (changeKind === null) {
95
+ throw new Error(`Upsert commit completed without a created/updated result for ${input.id}`);
96
+ }
57
97
  if (input.type === "symbol") {
58
98
  try {
59
99
  await refreshSymbolCoordinates(input.id, context);
@@ -63,12 +103,11 @@ export async function executeUpsert(input, context) {
63
103
  throw error;
64
104
  }
65
105
  }
66
- const semantic = analyzeSemanticAdvisorInput({ payload: { ...input } });
67
106
  const coverage = await scenarioCoverageWarnings(prolog, validated.relationships, input.type, input.id);
68
- const created = exists.success ? 0 : 1;
107
+ const created = changeKind === "created" ? 1 : 0;
69
108
  const payload = {
70
109
  created,
71
- updated: exists.success ? 1 : 0,
110
+ updated: changeKind === "updated" ? 1 : 0,
72
111
  relationships_created: relationships.length,
73
112
  warnings: [...semantic.warnings, ...coverage],
74
113
  semanticAdvisor: semantic.receipt,
@@ -1 +1 @@
1
- {"version":3,"file":"validate-upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validate-upsert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAOxE,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGrE,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAoDjD"}
1
+ {"version":3,"file":"validate-upsert.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validate-upsert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAYxE,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAOrE,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAoFjD"}
@@ -1,16 +1,32 @@
1
1
  import { analyzeSemanticAdvisorInput } from "../semantic-advisor/analyze-prose.js";
2
+ import { assertLogicalGroundingClaimKeys, assertSemanticInventoryBoundary, validateSemanticInventoryBoundary, } from "../semantic-advisor/ingestion-boundary.js";
2
3
  import { validateLiveRelationshipTargets, validateRelationshipSources, } from "./relationships.js";
3
4
  import { validateSymbolGranularity } from "./symbol-granularity.js";
5
+ import { effectiveRelationships, validateAppendOnlyVerificationReceipts, } from "./upsert.js";
4
6
  import { validateUpsertInput } from "./validation.js";
5
7
  export async function executeValidateUpsert(input, context) {
6
8
  try {
7
9
  const validated = validateUpsertInput(input, context.clock());
10
+ await validateAppendOnlyVerificationReceipts(validated.entity, context);
8
11
  validateRelationshipSources(input.id, validated.relationships);
9
12
  await validateSymbolGranularity(validated.entity, validated.relationships, context);
13
+ const previewSemantic = analyzeSemanticAdvisorInput({
14
+ payload: { ...input, relationships: validated.relationships },
15
+ });
16
+ const previewBoundary = validateSemanticInventoryBoundary({ ...input, relationships: validated.relationships }, validated.relationships, previewSemantic.receipt);
17
+ const relationships = context.prolog === undefined || !previewBoundary.applicable
18
+ ? validated.relationships
19
+ : await effectiveRelationships(input, validated.entity, validated.relationships, context);
10
20
  if (context.prolog !== undefined) {
11
- await validateLiveRelationshipTargets(context.prolog, validated.entity, validated.relationships);
21
+ await validateLiveRelationshipTargets(context.prolog, validated.entity, relationships);
22
+ }
23
+ const semantic = analyzeSemanticAdvisorInput({
24
+ payload: { ...input, relationships },
25
+ });
26
+ assertSemanticInventoryBoundary({ ...input, relationships }, relationships, semantic.receipt);
27
+ if (context.prolog !== undefined) {
28
+ await assertLogicalGroundingClaimKeys(context.prolog, { ...input, relationships }, relationships);
12
29
  }
13
- const semantic = analyzeSemanticAdvisorInput({ payload: { ...input } });
14
30
  const payload = {
15
31
  valid: true,
16
32
  errors: [],
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validation.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAO5C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAiF/D,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,IAAI,GACR,eAAe,CA0CjB;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/operations/mutation/validation.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAQ5C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAiF/D,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,IAAI,GACR,eAAe,CAwDjB;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
@@ -3,6 +3,7 @@ import entitySchema from "../../public/schemas/entity.js";
3
3
  import relationshipSchema from "../../public/schemas/relationship.js";
4
4
  // implements REQ-kibi-operation-interface-parity
5
5
  import { SYMBOL_ROLES, isAllowedGranularityReason, } from "../../public/symbol-granularity.js";
6
+ import { verificationReceiptHistoryErrors } from "../../public/verification-receipt.js";
6
7
  import { semanticClaimKey } from "../semantic-advisor/clauses.js";
7
8
  import { factKindShapeHints, validateFactModelingShape, valueFieldHint, } from "./strict-fact.js";
8
9
  const ajv = new Ajv({ strict: false });
@@ -84,6 +85,13 @@ export function validateUpsertInput(input, now) {
84
85
  if (!validateEntity(entity)) {
85
86
  throw new Error(`Entity validation failed: ${formatEntityErrors(entity, validateEntity.errors ?? [])}`);
86
87
  }
88
+ if (entity.type === "test" && Array.isArray(entity.verification_receipts)) {
89
+ const receipts = entity.verification_receipts.filter((value) => typeof value === "object" && value !== null && !Array.isArray(value));
90
+ const receiptErrors = verificationReceiptHistoryErrors(input.id, entity.verification_scope, receipts);
91
+ if (receiptErrors.length > 0) {
92
+ throw new Error(`Entity validation failed: ${receiptErrors.join("; ")}`);
93
+ }
94
+ }
87
95
  validateFactModelingShape(entity);
88
96
  if (entity.type === "fact" &&
89
97
  typeof entity.claim_key === "string" &&
@@ -1 +1 @@
1
- {"version":3,"file":"analysis-receipt.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analysis-receipt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAA6B,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EACV,6BAA6B,EAI7B,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AA0CpB,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,0BAA0B,EAAE,EAClD,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,YAAY,EAAE,SAAS,mBAAmB,EAAE,EAC5C,eAAe,EAAE,SAAS,4BAA4B,EAAE,EACxD,cAAc,EAAE,SAAS,iBAAiB,EAAE,GAC3C,6BAA6B,CA4G/B"}
1
+ {"version":3,"file":"analysis-receipt.d.ts","sourceRoot":"","sources":["../../../src/operations/semantic-advisor/analysis-receipt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,KAAK,OAAO,EAMb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,6BAA6B,EAI7B,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AA0CpB,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,0BAA0B,EAAE,EAClD,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,YAAY,EAAE,SAAS,mBAAmB,EAAE,EAC5C,eAAe,EAAE,SAAS,4BAA4B,EAAE,EACxD,cAAc,EAAE,SAAS,iBAAiB,EAAE,GAC3C,6BAA6B,CAkH/B"}