kibi-cli 2.19.0 → 2.21.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.
Files changed (117) hide show
  1. package/dist/cli-operation-metadata.d.ts +1 -1
  2. package/dist/cli-operation-metadata.js +1 -1
  3. package/dist/cli-register-maintenance.js +1 -1
  4. package/dist/commands/engine.d.ts +2 -1
  5. package/dist/commands/engine.d.ts.map +1 -1
  6. package/dist/commands/engine.js +6 -1
  7. package/dist/commands/migrate.d.ts +2 -0
  8. package/dist/commands/migrate.d.ts.map +1 -1
  9. package/dist/commands/migrate.js +32 -6
  10. package/dist/commands/sync/discovery.d.ts.map +1 -1
  11. package/dist/commands/sync/discovery.js +14 -2
  12. package/dist/engine.d.ts.map +1 -1
  13. package/dist/engine.js +24 -6
  14. package/dist/extractors/markdown.d.ts.map +1 -1
  15. package/dist/extractors/markdown.js +2 -1
  16. package/dist/intent-search.d.ts +7 -0
  17. package/dist/intent-search.d.ts.map +1 -1
  18. package/dist/intent-search.js +66 -4
  19. package/dist/operations/migration/kb-sources.d.ts +5 -1
  20. package/dist/operations/migration/kb-sources.d.ts.map +1 -1
  21. package/dist/operations/migration/kb-sources.js +28 -1
  22. package/dist/operations/modeling/predicate-applicability.d.ts.map +1 -1
  23. package/dist/operations/modeling/predicate-applicability.js +10 -4
  24. package/dist/operations/modeling/predicate-applyplan.d.ts.map +1 -1
  25. package/dist/operations/modeling/predicate-applyplan.js +16 -5
  26. package/dist/operations/modeling/predicate-catalog-4.d.ts.map +1 -1
  27. package/dist/operations/modeling/predicate-catalog-4.js +3 -0
  28. package/dist/operations/modeling/predicate-inference-1.d.ts.map +1 -1
  29. package/dist/operations/modeling/predicate-inference-1.js +34 -7
  30. package/dist/operations/modeling/predicate-score-3.js +1 -1
  31. package/dist/operations/modeling/predicate-types.d.ts +6 -0
  32. package/dist/operations/modeling/predicate-types.d.ts.map +1 -1
  33. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  34. package/dist/operations/modeling/suggest-predicates.js +111 -0
  35. package/dist/operations/mutation/source-authoring.d.ts +8 -0
  36. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  37. package/dist/operations/mutation/source-authoring.js +33 -0
  38. package/dist/operations/mutation/types.d.ts +26 -0
  39. package/dist/operations/mutation/types.d.ts.map +1 -1
  40. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  41. package/dist/operations/mutation/upsert.js +8 -2
  42. package/dist/operations/mutation/validate-upsert.d.ts.map +1 -1
  43. package/dist/operations/mutation/validate-upsert.js +116 -4
  44. package/dist/operations/mutation/validation.d.ts.map +1 -1
  45. package/dist/operations/mutation/validation.js +2 -1
  46. package/dist/operations/mutation/warnings.d.ts +10 -0
  47. package/dist/operations/mutation/warnings.d.ts.map +1 -1
  48. package/dist/operations/mutation/warnings.js +26 -0
  49. package/dist/operations/mutation/what-if.d.ts +25 -0
  50. package/dist/operations/mutation/what-if.d.ts.map +1 -0
  51. package/dist/operations/mutation/what-if.js +59 -0
  52. package/dist/operations/planning/compile-intent.d.ts +15 -20
  53. package/dist/operations/planning/compile-intent.d.ts.map +1 -1
  54. package/dist/operations/planning/compile-intent.js +64 -53
  55. package/dist/operations/semantic-advisor/clauses.d.ts +9 -0
  56. package/dist/operations/semantic-advisor/clauses.d.ts.map +1 -1
  57. package/dist/operations/semantic-advisor/clauses.js +32 -7
  58. package/dist/prolog/janitor.d.ts +26 -2
  59. package/dist/prolog/janitor.d.ts.map +1 -1
  60. package/dist/prolog/janitor.js +55 -3
  61. package/dist/prolog/store-lock.d.ts +28 -3
  62. package/dist/prolog/store-lock.d.ts.map +1 -1
  63. package/dist/prolog/store-lock.js +103 -12
  64. package/dist/public/operations/catalog.d.ts +49 -5
  65. package/dist/public/operations/catalog.d.ts.map +1 -1
  66. package/dist/public/operations/check-executor.d.ts +2 -2
  67. package/dist/public/operations/check-executor.d.ts.map +1 -1
  68. package/dist/public/operations/check-executor.js +35 -0
  69. package/dist/public/operations/check-format-shared.d.ts +16 -0
  70. package/dist/public/operations/check-format-shared.d.ts.map +1 -1
  71. package/dist/public/operations/check-format-shared.js +19 -0
  72. package/dist/public/operations/contracts.d.ts.map +1 -1
  73. package/dist/public/operations/contracts.js +10 -0
  74. package/dist/public/operations/discovery-executors.d.ts +3 -0
  75. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  76. package/dist/public/operations/discovery-executors.js +7 -2
  77. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  78. package/dist/public/operations/migration-plan.js +37 -7
  79. package/dist/public/operations/specs/composite.d.ts +1 -1
  80. package/dist/public/operations/specs/composite.js +1 -1
  81. package/dist/public/operations/specs/discovery.d.ts +2 -2
  82. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  83. package/dist/public/operations/specs/discovery.js +2 -2
  84. package/dist/public/operations/specs/mutation-schemas.d.ts +2 -2
  85. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  86. package/dist/public/operations/specs/mutation-schemas.js +8 -17
  87. package/dist/public/operations/specs/upsert.d.ts +46 -2
  88. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  89. package/dist/public/operations/specs/upsert.js +14 -0
  90. package/dist/public/schemas/entity.d.ts.map +1 -1
  91. package/dist/public/schemas/entity.js +2 -13
  92. package/dist/public/skills/kibi-usage/SKILL.md +38 -1
  93. package/dist/public/skills/kibi-usage/resources/fact-lanes.md +5 -3
  94. package/dist/public/skills/kibi-usage/resources/ui-requirements.md +2 -2
  95. package/dist/public/skills/kibi-usage/resources/workflows.md +1 -1
  96. package/dist/schemas/entity.schema.json +2 -25
  97. package/dist/search-answer.d.ts +13 -0
  98. package/dist/search-answer.d.ts.map +1 -1
  99. package/dist/search-answer.js +45 -4
  100. package/dist/utils/branch-store.d.ts.map +1 -1
  101. package/dist/utils/branch-store.js +4 -2
  102. package/package.json +3 -3
  103. package/src/public/operations/check-executor.ts +44 -1
  104. package/src/public/operations/check-format-shared.ts +35 -1
  105. package/src/public/operations/contracts.ts +11 -0
  106. package/src/public/operations/discovery-executors.ts +12 -2
  107. package/src/public/operations/migration-plan.ts +41 -9
  108. package/src/public/operations/specs/composite.ts +1 -1
  109. package/src/public/operations/specs/discovery.ts +3 -2
  110. package/src/public/operations/specs/mutation-schemas.ts +8 -17
  111. package/src/public/operations/specs/upsert.ts +15 -0
  112. package/src/public/schemas/entity.ts +2 -13
  113. package/src/public/skills/kibi-usage/SKILL.md +38 -1
  114. package/src/public/skills/kibi-usage/resources/fact-lanes.md +5 -3
  115. package/src/public/skills/kibi-usage/resources/ui-requirements.md +2 -2
  116. package/src/public/skills/kibi-usage/resources/workflows.md +1 -1
  117. package/src/schemas/entity.schema.json +2 -25
@@ -9,9 +9,21 @@ export interface CheckDiagnostic {
9
9
  readonly file?: string;
10
10
  readonly suggestion?: string;
11
11
  }
12
+ /**
13
+ * What a check run evaluated, so "no violations" can be told apart from
14
+ * "nothing evaluated": the rules that ran, and for `domain-contradictions`
15
+ * how many pairs of requirement facts it compared.
16
+ */
17
+ export interface CheckEvaluated {
18
+ readonly rules: readonly string[];
19
+ readonly domainContradictions?: Readonly<{
20
+ factPairsExamined: number;
21
+ }>;
22
+ }
12
23
  export interface CheckStructuredContent {
13
24
  readonly violations: readonly Violation[];
14
25
  readonly count: number;
26
+ readonly evaluated: CheckEvaluated;
15
27
  readonly diagnostics: readonly CheckDiagnostic[];
16
28
  readonly qualityDiagnostics?: readonly QualityDiagnostic[];
17
29
  readonly impactDiagnostics?: ChangedFileImpactResult["impactDiagnostics"];
@@ -26,13 +38,17 @@ export declare function formatQualityDiagnosticsText(diagnostics: readonly Quali
26
38
  export declare function formatViolationText(violations: readonly Violation[]): string;
27
39
  export declare function buildStructuredContent(input: {
28
40
  violations: readonly Violation[];
41
+ evaluated: CheckEvaluated;
29
42
  diagnostics: readonly CheckDiagnostic[];
30
43
  qualityDiagnostics?: readonly QualityDiagnostic[];
31
44
  impactResult: ChangedFileImpactResult | undefined;
32
45
  migrationPlan?: MigrationPlan;
33
46
  }): CheckStructuredContent;
47
+ /** One line saying what the check evaluated, so a clean result is readable. */
48
+ export declare function formatEvaluatedText(evaluated: CheckEvaluated): string;
34
49
  export declare function buildSummary(input: {
35
50
  readonly violations: readonly Violation[];
51
+ readonly evaluated?: CheckEvaluated;
36
52
  readonly impactResult: ChangedFileImpactResult | undefined;
37
53
  readonly qualityDiagnostics: readonly QualityDiagnostic[];
38
54
  }): string;
@@ -1 +1 @@
1
- {"version":3,"file":"check-format-shared.d.ts","sourceRoot":"","sources":["../../../src/public/operations/check-format-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAkBnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAGD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,SAAS,eAAe,EAAE,CAAC;IACjD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC3D,QAAQ,CAAC,iBAAiB,CAAC,EAAE,uBAAuB,CAAC,mBAAmB,CAAC,CAAC;IAC1E,QAAQ,CAAC,WAAW,CAAC,EAA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AAQ,CAAC,WAAW,CAAC,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;IAC9D,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;CACxC;AAaD,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,uBAAuB,GACpC,MAAM,CAaR;AAaD,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,SAAS,iBAAiB,EAAE,GACxC,MAAM,CA4BR;AAGD,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CAmB5E;AAGD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IACjC,SAAS,EAAE,cAAc,CAAC;IAC1B,WAAW,EAAE,SAAS,eAAe,EAAE,CAAC;IACxC,kBAAkB,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAClD,YAAY,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAClD,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,GAAG,sBAAsB,CA4BzB;AAID,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,cAAc,GAAG,MAAM,CAQrE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAC3D,QAAQ,CAAC,kBAAkB,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC3D,GAAG,MAAM,CAWT"}
@@ -79,6 +79,12 @@ export function buildStructuredContent(input) {
79
79
  return {
80
80
  violations: [...input.violations],
81
81
  count: input.violations.length,
82
+ evaluated: {
83
+ rules: [...input.evaluated.rules],
84
+ ...(input.evaluated.domainContradictions !== undefined
85
+ ? { domainContradictions: input.evaluated.domainContradictions }
86
+ : {}),
87
+ },
82
88
  diagnostics: formatDiagnostics(input.diagnostics),
83
89
  ...(qualityDiagnostics.length > 0
84
90
  ? { qualityDiagnostics: [...qualityDiagnostics] }
@@ -98,8 +104,21 @@ export function buildStructuredContent(input) {
98
104
  };
99
105
  }
100
106
  // implements REQ-mcp-tool-check
107
+ // implements REQ-search-answer-hygiene
108
+ /** One line saying what the check evaluated, so a clean result is readable. */
109
+ export function formatEvaluatedText(evaluated) {
110
+ const rules = evaluated.rules.length === 0
111
+ ? "Evaluated no rules"
112
+ : `Evaluated ${evaluated.rules.length} rule${evaluated.rules.length === 1 ? "" : "s"}`;
113
+ const pairs = evaluated.domainContradictions;
114
+ if (pairs === undefined)
115
+ return `${rules}.`;
116
+ return `${rules}; domain-contradictions compared ${pairs.factPairsExamined} fact pair${pairs.factPairsExamined === 1 ? "" : "s"}${pairs.factPairsExamined === 0 ? " (no two current requirements constrain the same subject or predicate case)" : ""}.`;
117
+ }
101
118
  export function buildSummary(input) {
102
119
  const sections = [formatViolationText(input.violations)];
120
+ if (input.evaluated !== undefined)
121
+ sections.push(formatEvaluatedText(input.evaluated));
103
122
  if (input.impactResult !== undefined) {
104
123
  sections.push(formatImpactText(input.impactResult));
105
124
  }
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/public/operations/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAC1B,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAsZpE;;uEAEuE;AACvE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,mBAAmB,GAC1B,mBAAmB,CAMrB;AAoXD,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAC3C,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAa3C,CAAC;AAmDF,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAClD,YAAY,EAAE,MAAM,GACnB,IAAI,CAIN;AAED,wBAAgB,eAAe,CAC7B,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,SAAS,eAAe,EAAE,GAClC,SAAS,0BAA0B,EAAE,CAoBvC"}
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/public/operations/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAC1B,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAsZpE;;uEAEuE;AACvE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,mBAAmB,GAC1B,mBAAmB,CAMrB;AA+XD,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAC3C,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAa3C,CAAC;AAmDF,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAClD,YAAY,EAAE,MAAM,GACnB,IAAI,CAIN;AAED,wBAAgB,eAAe,CAC7B,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,SAAS,eAAe,EAAE,GAClC,SAAS,0BAA0B,EAAE,CAoBvC"}
@@ -349,6 +349,7 @@ const BASE_DATA_SCHEMAS = {
349
349
  kb_search: objectData({
350
350
  results: valueArray,
351
351
  count: integerValue,
352
+ returned: integerValue,
352
353
  truncated: booleanValue,
353
354
  queryAnalysis: recordValue,
354
355
  answer: recordValue,
@@ -468,6 +469,10 @@ const BASE_DATA_SCHEMAS = {
468
469
  recommendedPredicateSchema: { type: ["object", "null"] },
469
470
  applyPlan: recordArray,
470
471
  relationshipPlan: { type: ["object", "null"] },
472
+ plan: {
473
+ type: ["object", "null"],
474
+ description: "With requirementId and a complete candidate: the hash-bound kibi.compile-plan.v1 that writes the predicate fact and links requires_predicate in one kb_apply_plan call (approvedPlanHash = plan.planHash). Its contradictionAnalysis is the what-if over the current KB plus the plan; a conflict leaves the plan blocked. Null when no plan applies.",
475
+ },
471
476
  relationshipTarget: {
472
477
  type: ["string", "null"],
473
478
  description: "The planned predicate fact id (FACT-PRED-...) that a requires_predicate link must target. Candidate ids (SUGGEST-...) are never relationship targets.",
@@ -518,6 +523,8 @@ const BASE_DATA_SCHEMAS = {
518
523
  warnings: valueArray,
519
524
  semanticAdvisor: nullableJsonSchema(recordValue),
520
525
  normalizedPreview: nullableJsonSchema(recordValue),
526
+ stagedFacts: stringArray,
527
+ whatIf: recordValue,
521
528
  }),
522
529
  kb_upsert: {
523
530
  description: "Committed upsert payload, or the validation preview when dryRun:true wrote nothing.",
@@ -540,6 +547,8 @@ const BASE_DATA_SCHEMAS = {
540
547
  warnings: valueArray,
541
548
  semanticAdvisor: nullableJsonSchema(recordValue),
542
549
  normalizedPreview: nullableJsonSchema(recordValue),
550
+ stagedFacts: stringArray,
551
+ whatIf: recordValue,
543
552
  dryRun: { const: true },
544
553
  skippedEffects: stringArray,
545
554
  }, ["valid", "dryRun", "skippedEffects"]),
@@ -567,6 +576,7 @@ const BASE_DATA_SCHEMAS = {
567
576
  objectData({
568
577
  violations: valueArray,
569
578
  count: integerValue,
579
+ evaluated: recordValue,
570
580
  diagnostics: recordArray,
571
581
  qualityDiagnostics: recordArray,
572
582
  impactDiagnostics: recordArray,
@@ -67,7 +67,10 @@ export type SearchInput = {
67
67
  };
68
68
  export type SearchPayload = {
69
69
  readonly results: readonly (SearchMatch | IntentSearchMatch)[];
70
+ /** Matches in the whole ranking, before `limit` and `offset`. */
70
71
  readonly count: number;
72
+ /** Rows in `results`: the page this call returned. */
73
+ readonly returned: number;
71
74
  readonly truncated?: boolean;
72
75
  readonly queryAnalysis?: IntentSearchAnalysis;
73
76
  readonly answer?: SearchAnswer;
@@ -1 +1 @@
1
- {"version":3,"file":"discovery-executors.d.ts","sourceRoot":"","sources":["../../../src/public/operations/discovery-executors.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,wBAAwB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EACL,yBAAyB,EACzB,KAAK,qBAAqB,EAM3B,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAGnB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,gBAAgB,EAAc,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B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,CAAC,EAAE,SAAS,QAAQ,CACjD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACxB,EAAE,CAAC;QACJ,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;QAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KACzD,CAAC;CACH,CAAC;AA+ZF,wBAAsB,YAAY,CAChC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CA8CxC;AAmDD,wBAAsB,aAAa,CACjC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CA6HzC;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAmUzC"}
1
+ {"version":3,"file":"discovery-executors.d.ts","sourceRoot":"","sources":["../../../src/public/operations/discovery-executors.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,wBAAwB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EACL,yBAAyB,EACzB,KAAK,qBAAqB,EAM3B,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAGnB,MAAM,qB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,wBAAsB,aAAa,CACjC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAoIzC;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAmUzC"}
@@ -493,7 +493,7 @@ async function projectMatches(prolog, matches, fields) {
493
493
  }
494
494
  export async function executeSearch(input, context) {
495
495
  // implements REQ-kibi-operation-interface-parity, REQ-mcp-search-discovery
496
- const { query, type, limit = 20, offset = 0, rankingMode = "intent-v1", semanticFacets, sourceLocations, minScore, fields = "summary", answer, } = input;
496
+ const { query, type, limit = 10, offset = 0, rankingMode = "intent-v1", semanticFacets, sourceLocations, minScore, fields = "summary", answer, } = input;
497
497
  const trimmedQuery = query.trim();
498
498
  if (!trimmedQuery) {
499
499
  throw new Error("Search execution failed: query must be a non-empty string");
@@ -534,17 +534,21 @@ export async function executeSearch(input, context) {
534
534
  : undefined;
535
535
  // The structured payload carries every row; the text is a short
536
536
  // human-readable digest instead of a second copy of the results.
537
+ // A top match no requirement owns is said in the digest too, so the
538
+ // governing list is never read as the top match's requirement.
539
+ const topUngoverned = answerLayer?.ungoverned.find((entry) => entry.rank === 1);
537
540
  const text = `${intentResult.matches.length === 0
538
541
  ? `No intent search results for '${trimmedQuery}' (abstained).`
539
542
  : `Found ${intentResult.matches.length} intent search results for '${trimmedQuery}'${intentResult.analysis.ambiguous ? " (top matches are close; confirm before relying on one)" : ""}. Top: ${paginated
540
543
  .slice(0, 5)
541
544
  .map((match) => String(match.entity.id ?? ""))
542
- .join(", ")}${answerLayer ? `. Governing: ${answerLayer.governing.map((req) => req.id).join(", ") || "none found"}` : ""}.`}${storeNote}`;
545
+ .join(", ")}${answerLayer ? `. Governing: ${answerLayer.governing.map((req) => req.id).join(", ") || "none found"}` : ""}${topUngoverned ? ` (the top match ${topUngoverned.id} is linked to no requirement)` : ""}.`}${storeNote}`;
543
546
  return {
544
547
  content: [{ type: "text", text }],
545
548
  structuredContent: {
546
549
  results: await projectMatches(prolog, paginated, fields),
547
550
  count: intentResult.matches.length,
551
+ returned: paginated.length,
548
552
  truncated: offset + paginated.length < intentResult.matches.length,
549
553
  queryAnalysis: intentResult.analysis,
550
554
  ...(answerLayer ? { answer: answerLayer } : {}),
@@ -571,6 +575,7 @@ export async function executeSearch(input, context) {
571
575
  structuredContent: {
572
576
  results: await projectMatches(prolog, paginated, fields),
573
577
  count: matches.length,
578
+ returned: paginated.length,
574
579
  truncated: offset + paginated.length < matches.length,
575
580
  ...branchFields,
576
581
  },
@@ -1 +1 @@
1
- {"version":3,"file":"migration-plan.d.ts","sourceRoot":"","sources":["../../../src/public/operations/migration-plan.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,sBAAsB,EAAG,wBAAiC,CAAC;AAExE,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,SAAS,CAAC;AACvD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAChF,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,CAAC;IACP,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC1C,CAAC,GACF,QAAQ,CAAC;IACP,IAAI,EAAE,KAAK,CAAC;IACZ,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC,CAAC,GACF,QAAQ,CAAC;IACP,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAEP,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,EAAE,EAAE,MAAM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AAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC,CAAC;AAEH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,GACpB,qBAAqB,CA8BvB;AAwBD,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAC5D,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC,GAAG,aAAa,CAsThB"}
@@ -1,6 +1,7 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import * as path from "node:path";
4
+ import { planLegacyStorageMigration } from "../../commands/legacy-storage-migration.js";
4
5
  import { BRANCH_STORE_NOT_COMPILED } from "../../utils/branch-store.js";
5
6
  import { legacyConfigExists } from "../../utils/config.js";
6
7
  import { MTIME_SOURCE_REASON_CODES } from "../../utils/content-freshness.js";
@@ -488,6 +489,13 @@ export function buildActionsFromStatus(input) {
488
489
  }
489
490
  const storeState = typeof store?.state === "string" ? store.state : null;
490
491
  const legacyStorageMigrationRequired = legacyConfigExists(input.workspaceRoot);
492
+ // A legacy cutover that cannot move its files (a destination already
493
+ // exists, a malformed config) is an operator decision, not an automatic
494
+ // step that fails when applied and takes the compile with it.
495
+ const legacyStorage = legacyStorageMigrationRequired
496
+ ? planLegacyStorageMigration(input.workspaceRoot)
497
+ : null;
498
+ const legacyStorageBlocked = legacyStorage !== null && legacyStorage.blockers.length > 0;
491
499
  if (storeState === "missing") {
492
500
  actions.push(migrationAction({
493
501
  id: "branch-store-ensure",
@@ -520,6 +528,7 @@ export function buildActionsFromStatus(input) {
520
528
  }));
521
529
  }
522
530
  if (configStatus.needsMigration || legacyStorageMigrationRequired) {
531
+ const operatorOnly = configStatus.status === "newer" || legacyStorageBlocked;
523
532
  actions.push(migrationAction({
524
533
  id: "schema-config-upgrade",
525
534
  code: configStatus.status === "invalid"
@@ -528,17 +537,34 @@ export function buildActionsFromStatus(input) {
528
537
  ? "legacy_storage_migration"
529
538
  : "schema_version_upgrade",
530
539
  category: "schema",
531
- state: configStatus.status === "newer" ? "blocked" : "ready",
532
- safety: configStatus.status === "newer" ? "operator" : "automatic",
533
- invocation: { kind: "cli", command_argv: ["kibi", "migrate", "--yes"] },
540
+ state: operatorOnly ? "blocked" : "ready",
541
+ safety: operatorOnly ? "operator" : "automatic",
542
+ invocation: legacyStorageBlocked
543
+ ? {
544
+ kind: "review",
545
+ instruction: `The legacy .kb/config.json still names knowledge files outside .kb/ and Kibi cannot move them: ${legacyStorage?.blockers.join(" ")} Keep one copy of each conflicting file (the .kb/ one is what Kibi compiles), remove or git-rm the legacy copy, then run 'kibi migrate --yes' to retire .kb/config.json.`,
546
+ }
547
+ : { kind: "cli", command_argv: ["kibi", "migrate", "--yes"] },
534
548
  affectedFiles: [
535
549
  ".kb/manifest.json",
536
550
  ".kb/migrations",
537
551
  ".kb/config.json",
552
+ ...(legacyStorage?.moves.map((move) => move.from) ?? []),
538
553
  ],
539
- evidence: { configStatus },
554
+ evidence: {
555
+ configStatus,
556
+ ...(legacyStorage === null
557
+ ? {}
558
+ : {
559
+ legacyStorage: {
560
+ moves: legacyStorage.moves,
561
+ blockers: legacyStorage.blockers,
562
+ legacyConfig: legacyStorage.legacyConfig,
563
+ },
564
+ }),
565
+ },
540
566
  dependsOn: storeState === "missing" ? ["branch-store-ensure"] : [],
541
- autoApplicable: configStatus.status !== "newer",
567
+ autoApplicable: !operatorOnly,
542
568
  }));
543
569
  }
544
570
  // implements REQ-cli-status-pre-first-sync
@@ -558,9 +584,13 @@ export function buildActionsFromStatus(input) {
558
584
  typeof store?.path === "string" ? store.path : ".kb/branches",
559
585
  ],
560
586
  evidence: { reason: uncompiled },
587
+ // A blocked schema step waits on an operator; the compile still runs
588
+ // from the .kb/ sources Kibi already reads.
561
589
  dependsOn: actions
562
- .map((action) => action.id)
563
- .filter((id) => id === "branch-store-ensure" || id === "schema-config-upgrade"),
590
+ .filter((action) => action.state === "ready" &&
591
+ (action.id === "branch-store-ensure" ||
592
+ action.id === "schema-config-upgrade"))
593
+ .map((action) => action.id),
564
594
  postconditions: [{ branchStore: "compiled" }],
565
595
  autoApplicable: true,
566
596
  }));
@@ -344,7 +344,7 @@ export declare const skillsSpec: {
344
344
  export declare const modelSpec: {
345
345
  readonly name: "kb_model";
346
346
  readonly cliName: "model";
347
- readonly description: "Turn requirement prose into checkable structure without writing the KB. mode:analyze returns the semantic advisor receipt: the clause ledger, what is grounded, what is ambiguous and suggested modeling (pass clauses for compound prose and optional typed kibi.logic.v1 interpretations). mode:requirement converts one claim (subjectKey, propertyKey, operator, value, or typed logic) into a strict-lane write set and applyPlan. mode:predicates ranks ontology predicate schemas and returns an applicable predicate-fact plan only for reviewed bindings, otherwise an ontology-gap observation. Apply returned plans with kb_upsert.";
347
+ readonly description: "Turn requirement prose into checkable structure without writing the KB. mode:analyze returns the semantic advisor receipt: the clause ledger, what is grounded, what is ambiguous and suggested modeling (pass clauses for compound prose and optional typed kibi.logic.v1 interpretations). mode:requirement converts one claim (subjectKey, propertyKey, operator, value, or typed logic) into a strict-lane write set and applyPlan. mode:predicates ranks ontology predicate schemas and returns an applicable predicate-fact plan only for reviewed bindings, otherwise an ontology-gap observation. With requirementId, mode:predicates also returns a hash-bound plan (fact write plus requires_predicate link) for kb_apply_plan, whose contradictionAnalysis is the what-if over the current KB; other returned plans apply with kb_upsert, and kb_upsert dryRun with plannedFacts previews a requirement before its facts exist.";
348
348
  readonly businessInputSchema: {
349
349
  readonly type: "object";
350
350
  readonly required: readonly ["mode", "text"];
@@ -152,7 +152,7 @@ export const skillsSpec = {
152
152
  export const modelSpec = {
153
153
  name: "kb_model",
154
154
  cliName: "model",
155
- description: "Turn requirement prose into checkable structure without writing the KB. mode:analyze returns the semantic advisor receipt: the clause ledger, what is grounded, what is ambiguous and suggested modeling (pass clauses for compound prose and optional typed kibi.logic.v1 interpretations). mode:requirement converts one claim (subjectKey, propertyKey, operator, value, or typed logic) into a strict-lane write set and applyPlan. mode:predicates ranks ontology predicate schemas and returns an applicable predicate-fact plan only for reviewed bindings, otherwise an ontology-gap observation. Apply returned plans with kb_upsert.",
155
+ description: "Turn requirement prose into checkable structure without writing the KB. mode:analyze returns the semantic advisor receipt: the clause ledger, what is grounded, what is ambiguous and suggested modeling (pass clauses for compound prose and optional typed kibi.logic.v1 interpretations). mode:requirement converts one claim (subjectKey, propertyKey, operator, value, or typed logic) into a strict-lane write set and applyPlan. mode:predicates ranks ontology predicate schemas and returns an applicable predicate-fact plan only for reviewed bindings, otherwise an ontology-gap observation. With requirementId, mode:predicates also returns a hash-bound plan (fact write plus requires_predicate link) for kb_apply_plan, whose contradictionAnalysis is the what-if over the current KB; other returned plans apply with kb_upsert, and kb_upsert dryRun with plannedFacts previews a requirement before its facts exist.",
156
156
  businessInputSchema: {
157
157
  type: "object",
158
158
  required: ["mode", "text"],
@@ -114,8 +114,8 @@ export declare const searchSpec: {
114
114
  readonly limit: {
115
115
  readonly type: "integer";
116
116
  readonly minimum: 0;
117
- readonly default: 20;
118
- readonly description: "Optional max rows to return after ranking. Default: 20.";
117
+ readonly default: 10;
118
+ readonly description: "Optional max rows to return after ranking. Default: 10; raise it or page with offset when the answer layer is not enough.";
119
119
  };
120
120
  readonly offset: {
121
121
  readonly type: "integer";
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACd,MAAM,2BAA2B,CAAC;AAiCnC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuGsC,CAAC;AAE7D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GuC,CAAC;AAE/D,eAAO,MAAM,UAAU;;;;;;;;;;;;CAWuC,CAAC"}
1
+ {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACd,MAAM,2BAA2B,CAAC;AAiCnC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuGsC,CAAC;AAE7D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GuC,CAAC;AAE/D,eAAO,MAAM,UAAU;;;;;;;;;;;;CAWuC,CAAC"}
@@ -128,8 +128,8 @@ export const searchSpec = {
128
128
  limit: {
129
129
  type: "integer",
130
130
  minimum: 0,
131
- default: 20,
132
- description: "Optional max rows to return after ranking. Default: 20.",
131
+ default: 10,
132
+ description: "Optional max rows to return after ranking. Default: 10; raise it or page with offset when the answer layer is not enough.",
133
133
  },
134
134
  offset: {
135
135
  type: "integer",
@@ -522,11 +522,11 @@ export declare const ENTITY_PROPERTIES_SCHEMA: {
522
522
  readonly claim_key: {
523
523
  readonly type: "string";
524
524
  readonly pattern: "^CLAIM-[A-F0-9]{16}$";
525
- readonly description: "Stable semantic-advisor key for the atomic prose clause grounded by this fact.";
525
+ readonly description: "Stable key of the atomic prose clause grounded by this fact, derived from claim_text. Optional: when omitted, Kibi derives it; when sent, it must equal the derived key.";
526
526
  };
527
527
  readonly claim_text: {
528
528
  readonly type: "string";
529
- readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit. Requires claim_key, except on an observation or meta fact, which may quote the clause it is about without claim_key.";
529
+ readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit. On a grounding fact Kibi derives claim_key from it; an observation or meta fact quotes the clause it is about without a key.";
530
530
  };
531
531
  readonly predicate_name: {
532
532
  readonly type: "string";
@@ -1 +1 @@
1
- {"version":3,"file":"mutation-schemas.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/mutation-schemas.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,gFASf,CAAC;AAoBX,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoX3B,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;CA8CvB,CAAC"}
@@ -11,22 +11,13 @@ export const ENTITY_TYPES = [
11
11
  "symbol",
12
12
  "fact",
13
13
  ];
14
- // An observation or meta fact may quote a claim in claim_text alone: it is a
15
- // non-grounding review note, so it does not claim the clause's key.
14
+ // A claim_key names the clause in claim_text, so it never travels alone. The
15
+ // reverse is open: Kibi derives a missing claim_key from claim_text on a
16
+ // grounding fact, and an observation or meta fact quotes a claim without one.
17
+ // implements REQ-kibi-review-observation-claim-text-v2
16
18
  const CLAIM_PROVENANCE_CONDITIONAL = JSON.parse(`{
17
- "if": {
18
- "anyOf": [
19
- { "required": ["claim_key"] },
20
- {
21
- "required": ["claim_text"],
22
- "not": {
23
- "properties": { "fact_kind": { "enum": ["observation", "meta"] } },
24
- "required": ["fact_kind"]
25
- }
26
- }
27
- ]
28
- },
29
- "then": { "required": ["claim_key", "claim_text"] }
19
+ "if": { "required": ["claim_key"] },
20
+ "then": { "required": ["claim_text"] }
30
21
  }`);
31
22
  export const ENTITY_PROPERTIES_SCHEMA = {
32
23
  type: "object",
@@ -251,11 +242,11 @@ export const ENTITY_PROPERTIES_SCHEMA = {
251
242
  claim_key: {
252
243
  type: "string",
253
244
  pattern: "^CLAIM-[A-F0-9]{16}$",
254
- description: "Stable semantic-advisor key for the atomic prose clause grounded by this fact.",
245
+ description: "Stable key of the atomic prose clause grounded by this fact, derived from claim_text. Optional: when omitted, Kibi derives it; when sent, it must equal the derived key.",
255
246
  },
256
247
  claim_text: {
257
248
  type: "string",
258
- description: "Exact atomic requirement clause represented by this fact, retained for human audit. Requires claim_key, except on an observation or meta fact, which may quote the clause it is about without claim_key.",
249
+ description: "Exact atomic requirement clause represented by this fact, retained for human audit. On a grounding fact Kibi derives claim_key from it; an observation or meta fact quotes the clause it is about without a key.",
259
250
  },
260
251
  predicate_name: {
261
252
  type: "string",
@@ -539,11 +539,11 @@ export declare const upsertSpec: {
539
539
  readonly claim_key: {
540
540
  readonly type: "string";
541
541
  readonly pattern: "^CLAIM-[A-F0-9]{16}$";
542
- readonly description: "Stable semantic-advisor key for the atomic prose clause grounded by this fact.";
542
+ readonly description: "Stable key of the atomic prose clause grounded by this fact, derived from claim_text. Optional: when omitted, Kibi derives it; when sent, it must equal the derived key.";
543
543
  };
544
544
  readonly claim_text: {
545
545
  readonly type: "string";
546
- readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit. Requires claim_key, except on an observation or meta fact, which may quote the clause it is about without claim_key.";
546
+ readonly description: "Exact atomic requirement clause represented by this fact, retained for human audit. On a grounding fact Kibi derives claim_key from it; an observation or meta fact quotes the clause it is about without a key.";
547
547
  };
548
548
  readonly predicate_name: {
549
549
  readonly type: "string";
@@ -707,6 +707,50 @@ export declare const upsertSpec: {
707
707
  readonly default: false;
708
708
  readonly description: "Validate the payload and return schema/modeling errors, a normalized preview and the semantic advisor receipt without writing the KB or workspace. Use it as the preflight before the real write.";
709
709
  };
710
+ readonly plannedFacts: {
711
+ readonly type: "array";
712
+ readonly description: "dryRun only. Fact upsert payloads (type, id, properties, optional relationships) that will be written before this payload, typically the applyPlan entries kb_model returned. They are validated in order and staged with the payload, so a requires_predicate or requires_property target that does not exist yet resolves, its claim_key is read from the plan, and the contradiction preview runs against the KB as it would be after the whole batch (result: stagedFacts, whatIf). A conflict the batch would introduce, such as an allow and a deny permission_rule on the same key, is refused as the commit would refuse it. Rejected without dryRun: write the facts first.";
713
+ readonly items: {
714
+ readonly type: "object";
715
+ readonly required: readonly ["type", "id", "properties"];
716
+ readonly properties: {
717
+ readonly type: {
718
+ readonly type: "string";
719
+ readonly const: "fact";
720
+ };
721
+ readonly id: {
722
+ readonly type: "string";
723
+ readonly minLength: 1;
724
+ };
725
+ readonly properties: {
726
+ readonly type: "object";
727
+ };
728
+ readonly relationships: {
729
+ readonly type: "array";
730
+ readonly description: "Optional relationship rows to create in the same call. For requirement encoding, prefer `constrains` + `requires_property` for strict property facts or `requires_predicate` for ontology predicate facts. Side effect: asserts edges in KB.";
731
+ readonly items: {
732
+ readonly type: "object";
733
+ readonly required: readonly ["type", "from", "to"];
734
+ readonly properties: {
735
+ readonly type: {
736
+ readonly type: "string";
737
+ readonly enum: readonly ["depends_on", "specified_by", "verified_by", "validates", "implements", "covered_by", "executable_for", "constrained_by", "constrains", "requires_property", "requires_predicate", "requires_rule", "guards", "publishes", "consumes", "supersedes", "restates", "assumes", "exempts", "relates_to"];
738
+ readonly description: "Relationship type enum. Use only supported values. Direction semantics follow KB model (e.g., implements symbol->req, verified_by req/scenario->test, executable_for symbol->test).";
739
+ };
740
+ readonly from: {
741
+ readonly type: "string";
742
+ readonly description: "Source entity ID (must exist). Example: 'SYM-login-handler'.";
743
+ };
744
+ readonly to: {
745
+ readonly type: "string";
746
+ readonly description: "Target entity ID (must exist). Example: 'REQ-cli-gc'.";
747
+ };
748
+ };
749
+ };
750
+ };
751
+ };
752
+ };
753
+ };
710
754
  readonly document: {
711
755
  readonly type: "object";
712
756
  readonly additionalProperties: false;
@@ -1 +1 @@
1
- {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../../../../src/public/operations/specs/upsert.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAQvE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DuC,CAAC"}
@@ -24,6 +24,20 @@ export const upsertSpec = {
24
24
  default: false,
25
25
  description: "Validate the payload and return schema/modeling errors, a normalized preview and the semantic advisor receipt without writing the KB or workspace. Use it as the preflight before the real write.",
26
26
  },
27
+ plannedFacts: {
28
+ type: "array",
29
+ description: "dryRun only. Fact upsert payloads (type, id, properties, optional relationships) that will be written before this payload, typically the applyPlan entries kb_model returned. They are validated in order and staged with the payload, so a requires_predicate or requires_property target that does not exist yet resolves, its claim_key is read from the plan, and the contradiction preview runs against the KB as it would be after the whole batch (result: stagedFacts, whatIf). A conflict the batch would introduce, such as an allow and a deny permission_rule on the same key, is refused as the commit would refuse it. Rejected without dryRun: write the facts first.",
30
+ items: {
31
+ type: "object",
32
+ required: ["type", "id", "properties"],
33
+ properties: {
34
+ type: { type: "string", const: "fact" },
35
+ id: { type: "string", minLength: 1 },
36
+ properties: { type: "object" },
37
+ relationships: RELATIONSHIPS_SCHEMA,
38
+ },
39
+ },
40
+ },
27
41
  document: {
28
42
  type: "object",
29
43
  additionalProperties: false,
@@ -1 +1 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AAmUA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CA4ZzC,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AAwTA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CA4ZzC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -22,19 +22,8 @@ import { PROOF_RECEIPT_SCHEMA } from "../proof-receipt.js";
22
22
  import { SYMBOL_ROLES } from "../symbol-granularity.js";
23
23
  const factConditionals = JSON.parse(`[
24
24
  {
25
- "if": {
26
- "anyOf": [
27
- { "required": ["claim_key"] },
28
- {
29
- "required": ["claim_text"],
30
- "not": {
31
- "properties": { "fact_kind": { "enum": ["observation", "meta"] } },
32
- "required": ["fact_kind"]
33
- }
34
- }
35
- ]
36
- },
37
- "then": { "required": ["claim_key", "claim_text"] }
25
+ "if": { "required": ["claim_key"] },
26
+ "then": { "required": ["claim_text"] }
38
27
  },
39
28
  {
40
29
  "if": {