kibi-cli 2.22.1 → 2.23.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 (124) hide show
  1. package/dist/cli-register-foundation.d.ts.map +1 -1
  2. package/dist/cli-register-foundation.js +1 -0
  3. package/dist/commands/check.d.ts.map +1 -1
  4. package/dist/commands/check.js +51 -3
  5. package/dist/commands/doctor.d.ts.map +1 -1
  6. package/dist/commands/doctor.js +28 -0
  7. package/dist/commands/migrate.d.ts +10 -0
  8. package/dist/commands/migrate.d.ts.map +1 -1
  9. package/dist/commands/migrate.js +58 -9
  10. package/dist/commands/sync.d.ts.map +1 -1
  11. package/dist/commands/sync.js +15 -1
  12. package/dist/extractors/markdown.d.ts.map +1 -1
  13. package/dist/extractors/markdown.js +37 -35
  14. package/dist/intent-search.d.ts.map +1 -1
  15. package/dist/intent-search.js +32 -4
  16. package/dist/operations/bootstrap/activation.d.ts +7 -1
  17. package/dist/operations/bootstrap/activation.d.ts.map +1 -1
  18. package/dist/operations/bootstrap/activation.js +27 -2
  19. package/dist/operations/bootstrap/generate.d.ts.map +1 -1
  20. package/dist/operations/bootstrap/generate.js +56 -16
  21. package/dist/operations/bootstrap/guidance-actions.d.ts.map +1 -1
  22. package/dist/operations/bootstrap/guidance-actions.js +14 -2
  23. package/dist/operations/bootstrap/guidance.d.ts.map +1 -1
  24. package/dist/operations/bootstrap/guidance.js +6 -2
  25. package/dist/operations/bootstrap/presentation.d.ts.map +1 -1
  26. package/dist/operations/bootstrap/presentation.js +75 -9
  27. package/dist/operations/bootstrap/types.d.ts +6 -0
  28. package/dist/operations/bootstrap/types.d.ts.map +1 -1
  29. package/dist/operations/migration/kb-sources.d.ts +8 -5
  30. package/dist/operations/migration/kb-sources.d.ts.map +1 -1
  31. package/dist/operations/migration/kb-sources.js +50 -14
  32. package/dist/operations/migration/schema6.d.ts.map +1 -1
  33. package/dist/operations/migration/schema6.js +11 -2
  34. package/dist/operations/migration/source-paths.d.ts +18 -1
  35. package/dist/operations/migration/source-paths.d.ts.map +1 -1
  36. package/dist/operations/migration/source-paths.js +111 -16
  37. package/dist/operations/modeling/suggest-predicates.d.ts.map +1 -1
  38. package/dist/operations/modeling/suggest-predicates.js +22 -7
  39. package/dist/operations/mutation/requirement-semantics.d.ts +16 -0
  40. package/dist/operations/mutation/requirement-semantics.d.ts.map +1 -1
  41. package/dist/operations/mutation/requirement-semantics.js +50 -0
  42. package/dist/operations/mutation/strict-fact.js +1 -1
  43. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  44. package/dist/operations/mutation/upsert.js +2 -1
  45. package/dist/operations/planning/apply-plan.d.ts.map +1 -1
  46. package/dist/operations/planning/apply-plan.js +22 -2
  47. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  48. package/dist/operations/semantic-advisor/analyze-prose.js +49 -17
  49. package/dist/public/impact/analyzer.d.ts.map +1 -1
  50. package/dist/public/impact/analyzer.js +7 -1
  51. package/dist/public/impact/diagnostics.d.ts.map +1 -1
  52. package/dist/public/impact/diagnostics.js +16 -3
  53. package/dist/public/impact/types.d.ts +2 -0
  54. package/dist/public/impact/types.d.ts.map +1 -1
  55. package/dist/public/operations/catalog.d.ts +7 -2
  56. package/dist/public/operations/catalog.d.ts.map +1 -1
  57. package/dist/public/operations/check-executor.d.ts.map +1 -1
  58. package/dist/public/operations/check-executor.js +10 -3
  59. package/dist/public/operations/check-helpers.d.ts +10 -0
  60. package/dist/public/operations/check-helpers.d.ts.map +1 -1
  61. package/dist/public/operations/check-helpers.js +54 -0
  62. package/dist/public/operations/contracts.d.ts.map +1 -1
  63. package/dist/public/operations/contracts.js +1 -0
  64. package/dist/public/operations/discovery-executors.d.ts +18 -0
  65. package/dist/public/operations/discovery-executors.d.ts.map +1 -1
  66. package/dist/public/operations/discovery-executors.js +62 -3
  67. package/dist/public/operations/schema6-check-actions.d.ts +4 -0
  68. package/dist/public/operations/schema6-check-actions.d.ts.map +1 -1
  69. package/dist/public/operations/schema6-check-actions.js +39 -2
  70. package/dist/public/operations/source-path-dangling.d.ts +1 -1
  71. package/dist/public/operations/source-path-dangling.d.ts.map +1 -1
  72. package/dist/public/operations/source-path-dangling.js +11 -2
  73. package/dist/public/operations/specs/composite.d.ts +1 -1
  74. package/dist/public/operations/specs/discovery.d.ts +5 -0
  75. package/dist/public/operations/specs/discovery.d.ts.map +1 -1
  76. package/dist/public/operations/specs/discovery.js +5 -0
  77. package/dist/public/operations/specs/planning.d.ts +1 -1
  78. package/dist/public/operations/specs/planning.js +1 -1
  79. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  80. package/dist/public/operations/specs/reporting.js +6 -4
  81. package/dist/public/operations/specs/semantic.d.ts +1 -1
  82. package/dist/public/operations/specs/semantic.d.ts.map +1 -1
  83. package/dist/public/operations/specs/semantic.js +4 -2
  84. package/dist/public/skills/kibi-bootstrap/SKILL.md +3 -2
  85. package/dist/public/skills/kibi-usage/SKILL.md +6 -3
  86. package/dist/public/skills/kibi-usage/resources/workflows.md +3 -1
  87. package/dist/search-answer.d.ts +14 -0
  88. package/dist/search-answer.d.ts.map +1 -1
  89. package/dist/search-answer.js +42 -4
  90. package/dist/traceability/git-change-snapshot.d.ts +46 -0
  91. package/dist/traceability/git-change-snapshot.d.ts.map +1 -1
  92. package/dist/traceability/git-change-snapshot.js +187 -3
  93. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  94. package/dist/traceability/staged-diagnostics.js +5 -6
  95. package/dist/traceability/staged-inventory-drift.d.ts +24 -0
  96. package/dist/traceability/staged-inventory-drift.d.ts.map +1 -0
  97. package/dist/traceability/staged-inventory-drift.js +84 -0
  98. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  99. package/dist/traceability/staged-symbols-manifest.js +1 -2
  100. package/dist/utils/content-freshness.d.ts +9 -0
  101. package/dist/utils/content-freshness.d.ts.map +1 -1
  102. package/dist/utils/content-freshness.js +33 -0
  103. package/dist/utils/merge-driver-setup.d.ts +10 -0
  104. package/dist/utils/merge-driver-setup.d.ts.map +1 -0
  105. package/dist/utils/merge-driver-setup.js +69 -0
  106. package/dist/utils/rule-registry.generated.d.ts +1 -1
  107. package/dist/utils/rule-registry.generated.js +1 -1
  108. package/package.json +2 -2
  109. package/src/public/impact/analyzer.ts +13 -1
  110. package/src/public/impact/diagnostics.ts +20 -3
  111. package/src/public/impact/types.ts +2 -0
  112. package/src/public/operations/check-executor.ts +16 -4
  113. package/src/public/operations/check-helpers.ts +65 -0
  114. package/src/public/operations/contracts.ts +1 -0
  115. package/src/public/operations/discovery-executors.ts +97 -3
  116. package/src/public/operations/schema6-check-actions.ts +43 -2
  117. package/src/public/operations/source-path-dangling.ts +12 -2
  118. package/src/public/operations/specs/discovery.ts +6 -0
  119. package/src/public/operations/specs/planning.ts +1 -1
  120. package/src/public/operations/specs/reporting.ts +6 -4
  121. package/src/public/operations/specs/semantic.ts +4 -2
  122. package/src/public/skills/kibi-bootstrap/SKILL.md +3 -2
  123. package/src/public/skills/kibi-usage/SKILL.md +6 -3
  124. package/src/public/skills/kibi-usage/resources/workflows.md +3 -1
@@ -16,6 +16,7 @@ function activationFor(state) {
16
16
  // Discovery remains useful for explaining the next step, but the
17
17
  // resulting plan is blocked until `kibi init` establishes the root.
18
18
  allowCandidateGeneration: true,
19
+ allowDeclaredClaims: true,
19
20
  reason: "Workspace has no attached root KB yet; run `kibi init` before planning bootstrap knowledge.",
20
21
  handoffMessage: "Kibi infrastructure is not initialized. Run `kibi init`, then ask the agent to bootstrap this repository.",
21
22
  };
@@ -25,6 +26,7 @@ function activationFor(state) {
25
26
  activationMode: "repair_bootstrap",
26
27
  applyBlocked: true,
27
28
  allowCandidateGeneration: true,
29
+ allowDeclaredClaims: true,
28
30
  reason: "Workspace root is only partially configured; run a repair bootstrap scan and keep apply blocked until the root is repaired.",
29
31
  };
30
32
  case "vendored_only":
@@ -33,6 +35,7 @@ function activationFor(state) {
33
35
  activationMode: "vendored_blocked",
34
36
  applyBlocked: true,
35
37
  allowCandidateGeneration: false,
38
+ allowDeclaredClaims: false,
36
39
  reason: "Workspace appears to contain vendored Kibi sources only; bootstrap generation is blocked in this posture.",
37
40
  handoffMessage: "Vendored Kibi posture detected. Move to the real project root before attempting bootstrap.",
38
41
  };
@@ -42,19 +45,41 @@ function activationFor(state) {
42
45
  activationMode: "attached_thin_bootstrap",
43
46
  applyBlocked: false,
44
47
  allowCandidateGeneration: true,
48
+ allowDeclaredClaims: true,
45
49
  reason: "Workspace has an attached but unseeded KB; deterministic bootstrap planning is eligible.",
46
50
  };
47
51
  case "root_active_seeded":
48
52
  return {
49
53
  activationState: state,
50
54
  activationMode: "attached_seeded_handoff",
55
+ // Blocked until the plan holds declared claims; see claimPlanActivation.
51
56
  applyBlocked: true,
52
57
  allowCandidateGeneration: false,
53
- reason: "Workspace already has an attached seeded KB; bootstrap synthesis is replaced by an explicit seeded handoff.",
54
- handoffMessage: "Attached seeded KB detected. Use existing KB context instead of generating bootstrap candidates.",
58
+ allowDeclaredClaims: true,
59
+ reason: "Workspace already has an attached seeded KB; discovered bootstrap candidates are replaced by an explicit seeded handoff, and only declared intent claims are planned against the existing KB.",
60
+ handoffMessage: "Attached seeded KB detected. Kibi does not generate discovered bootstrap candidates here: use kb_search and kb_query for existing KB context. Declare cited intentClaims in bootstrapContext to plan them against the existing KB, or compile each claim with kb_compile_intent.",
55
61
  };
56
62
  }
57
63
  }
64
+ /**
65
+ * On a seeded KB the plan may hold declared intent claims, already
66
+ * deduplicated against the existing KB. Such a plan is applicable like a thin
67
+ * bootstrap plan; a seeded plan holding anything else stays a handoff.
68
+ */
69
+ // implements REQ-bootstrap-discovered-candidate-budget
70
+ // covered_by TEST-KIBI-BOOTSTRAP-PLAN-APPLY
71
+ export function claimPlanActivation(policy, candidates) {
72
+ if (policy.activationState !== "root_active_seeded" ||
73
+ candidates.length === 0 ||
74
+ candidates.some((candidate) => candidate.sourceKind !== "intent_claim"))
75
+ return policy;
76
+ return {
77
+ ...policy,
78
+ applyBlocked: false,
79
+ reason: "Workspace already has an attached seeded KB; discovered bootstrap candidates are not generated, and the plan holds only declared intent claims that are not yet in the KB.",
80
+ handoffMessage: "Attached seeded KB detected. The plan holds only your declared intent claims, deduplicated against the existing KB: review it and call kb_apply_plan after explicit approval. Discovered candidates are not generated here; use kb_search and kb_query for existing knowledge, and compile any claim left in sourceOnlySignals with kb_compile_intent.",
81
+ };
82
+ }
58
83
  async function exists(context, target) {
59
84
  try {
60
85
  await context.fs?.stat(target);
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/generate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAcjF,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAGpB,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACzC,SAAS,gBAAgB,EAAE,CAI7B;AA+BD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,OAAO,EAAE,MAAM,GACd;IACD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAwJA;AA+JD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAkH9B"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/generate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAejF,OAAO,KAAK,EAGV,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAGpB,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACzC,SAAS,gBAAgB,EAAE,CAI7B;AA+BD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,OAAO,EAAE,MAAM,GACd;IACD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAClE,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAwJA;AAkMD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAqI9B"}
@@ -4,6 +4,7 @@ import { loadEntityIds } from "../../public/operations/discovery-entities.js";
4
4
  import { executeStatus } from "../../public/operations/discovery-executors.js";
5
5
  import { readWorkspaceSnapshot } from "../../public/operations/workspace-snapshot.js";
6
6
  import { stagedLogicalGroundingError, } from "../semantic-advisor/ingestion-boundary.js";
7
+ import { claimPlanActivation } from "./activation.js";
7
8
  import { buildBootstrapCandidates, isProvenanceStubCandidate, } from "./candidates.js";
8
9
  import { discoverBootstrap } from "./discovery.js";
9
10
  import { buildIntentClaimCandidates } from "./intent-claims.js";
@@ -218,13 +219,40 @@ function stagedGroundingError(candidate, planned) {
218
219
  }
219
220
  return null;
220
221
  }
221
- async function existingEntityIds(context) {
222
- if (!context.prolog)
223
- return new Set();
222
+ /**
223
+ * One suppressedCandidates row per declared claim the activation mode does
224
+ * not plan, so the per-source accounting names the real reason.
225
+ */
226
+ // implements REQ-bootstrap-intent-claim-accounting
227
+ function activationSuppressedClaims(declared, activation) {
228
+ const sources = new Set((declared.knowledgeSources ?? []).map((source) => source.id));
229
+ return (declared.intentClaims ?? [])
230
+ .filter((claim) => sources.has(claim.sourceId))
231
+ .map((claim) => ({
232
+ candidateId: "",
233
+ reason: "suppressed_by_activation",
234
+ sourcePath: claim.reference,
235
+ entityType: (claim.kind ?? "intent") === "intent" ? "req" : "fact",
236
+ statement: claim.statement,
237
+ sourceId: claim.sourceId,
238
+ activationMode: activation.activationMode,
239
+ }));
240
+ }
241
+ /**
242
+ * IDs already in the KB, so declared claims and discovered candidates that
243
+ * exist are counted under entity_exists instead of being planned again. An
244
+ * attached root starts the lazy engine when the host supplied none (the CLI
245
+ * does so for status anyway); an unattached root never starts one.
246
+ */
247
+ // implements REQ-bootstrap-intent-claim-accounting
248
+ async function existingEntityIds(context, attached) {
224
249
  try {
250
+ const prolog = context.prolog ?? (attached ? await context.ensureProlog?.() : undefined);
251
+ if (!prolog)
252
+ return new Set();
225
253
  // Ids only: materializing every entity (receipt histories included)
226
254
  // just to build this set exceeds the bounded engine output.
227
- return new Set((await loadEntityIds(context.prolog)).filter(Boolean));
255
+ return new Set((await loadEntityIds(prolog)).filter(Boolean));
228
256
  }
229
257
  catch (error) {
230
258
  throw new Error(`Bootstrap binding could not read existing entity IDs: ${error instanceof Error ? error.message : String(error)}`);
@@ -317,13 +345,12 @@ export async function executePlanBootstrap(args, context) {
317
345
  const minConfidence = clamp(args.minConfidence ?? 0.8, 0.6, 0.95);
318
346
  const maxCandidates = clamp(Math.trunc(args.maxCandidates ?? 50), 1, 200);
319
347
  const entityBindingDiagnostics = [];
320
- const [discovery, existingIds] = await Promise.all([
321
- discoverBootstrap(context),
322
- existingEntityIds(context).catch((error) => {
323
- entityBindingDiagnostics.push(error.message);
324
- return new Set();
325
- }),
326
- ]);
348
+ const discovery = await discoverBootstrap(context);
349
+ const existingIds = await existingEntityIds(context, discovery.activation.activationState === "root_active_thin" ||
350
+ discovery.activation.activationState === "root_active_seeded").catch((error) => {
351
+ entityBindingDiagnostics.push(error.message);
352
+ return new Set();
353
+ });
327
354
  // Discovery runs before planning so its evidence paths can be bound into
328
355
  // the exact plan rather than leaving the reviewer to reconstruct them.
329
356
  const bound = await expectedSnapshots(context, discovery.evidence
@@ -341,13 +368,17 @@ export async function executePlanBootstrap(args, context) {
341
368
  diagnostics: [],
342
369
  };
343
370
  // Intent harvested from declared knowledge sources joins the repository
344
- // evidence under the same activation policy, filters, and selection.
345
- const claimed = discovery.activation.allowCandidateGeneration
371
+ // evidence under the same filters and selection. A seeded KB still plans
372
+ // declared claims (deduplicated against the existing KB); only discovered
373
+ // candidates stay off there.
374
+ const allowDeclaredClaims = discovery.activation.allowDeclaredClaims ??
375
+ discovery.activation.allowCandidateGeneration;
376
+ const claimed = allowDeclaredClaims
346
377
  ? buildIntentClaimCandidates(declared, existingIds, minConfidence, subjectKeys)
347
378
  : {
348
379
  candidates: [],
349
380
  sourceOnlySignals: [],
350
- suppressed: [],
381
+ suppressed: activationSuppressedClaims(declared, discovery.activation),
351
382
  diagnostics: [],
352
383
  };
353
384
  const filteredSignals = filterSourceOnlySignals([...built.sourceOnlySignals, ...claimed.sourceOnlySignals], args.entityTypes);
@@ -361,10 +392,19 @@ export async function executePlanBootstrap(args, context) {
361
392
  entityType: "",
362
393
  }));
363
394
  const { bindingDiagnostics, ...expected } = bound;
395
+ // A seeded plan holding only declared claims is applicable.
396
+ const activation = claimPlanActivation(discovery.activation, shared.candidates);
364
397
  return presentBootstrap({
365
398
  root: context.workspaceRoot,
366
- activation: discovery.activation,
367
- discoverySummary: discovery.summary,
399
+ activation,
400
+ discoverySummary: {
401
+ ...discovery.summary,
402
+ applyBlocked: activation.applyBlocked,
403
+ reason: activation.reason,
404
+ ...(activation.handoffMessage
405
+ ? { handoffMessage: activation.handoffMessage }
406
+ : {}),
407
+ },
368
408
  migrationWarning: discovery.migrationWarning,
369
409
  pluginOffers: discovery.pluginOffers,
370
410
  ...(args.bootstrapContext
@@ -1 +1 @@
1
- {"version":3,"file":"guidance-actions.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAkBpB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,MAAM,GAAE,SAAS,WAAW,EAAO,GAClC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAgF9C"}
1
+ {"version":3,"file":"guidance-actions.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAkBpB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,MAAM,GAAE,SAAS,WAAW,EAAO,GAClC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CA6F9C"}
@@ -52,6 +52,8 @@ export function buildActions(root, activation, declared, candidates, signals, of
52
52
  : "Use kb_coverage to review traceability and identify areas needing attention.",
53
53
  });
54
54
  }
55
+ const seeded = activation.activationMode === "attached_seeded_handoff";
56
+ const declaredClaims = declared.intentClaims?.length ?? 0;
55
57
  if (activation.applyBlocked)
56
58
  result.push({
57
59
  order: order++,
@@ -62,14 +64,24 @@ export function buildActions(root, activation, declared, candidates, signals, of
62
64
  result.push({
63
65
  order: order++,
64
66
  kind: "plan",
65
- description: `Review the ${candidates.length} safe candidate(s) in the hash-bound plan, then call kb_apply_plan after explicit approval.`,
67
+ description: seeded
68
+ ? `Review the ${candidates.length} candidate(s) planned from declared intent claims (discovered candidates are not generated on a seeded KB, and claims already in the KB are not planned again), then call kb_apply_plan after explicit approval.`
69
+ : `Review the ${candidates.length} safe candidate(s) in the hash-bound plan, then call kb_apply_plan after explicit approval.`,
66
70
  candidateIds: candidates.map((candidate) => candidate.candidateId),
67
71
  });
72
+ // On a seeded KB, declared claims the plan does not write go through the
73
+ // compile workflow, not a second bootstrap.
74
+ if (seeded && declaredClaims > 0 && candidates.length === 0)
75
+ result.push({
76
+ order: order++,
77
+ kind: "handoff",
78
+ description: "No declared intent claim could be planned. Claims already in the KB need nothing; compile each remaining claim with kb_compile_intent, citing its source and reference (see the Knowledge source diagnostics).",
79
+ });
68
80
  if (signals.length > 0)
69
81
  result.push({
70
82
  order: order++,
71
83
  kind: "handoff",
72
- description: `Author ${[...new Set(signals.map((signal) => signal.kind.toUpperCase()))].join("/")} entities manually from source-only evidence.`,
84
+ description: `Author ${[...new Set(signals.map((signal) => signal.kind.toUpperCase()))].join("/")} entities manually from source-only evidence${seeded ? "; compile declared claims left there with kb_compile_intent" : ""}.`,
73
85
  });
74
86
  for (const offer of offers)
75
87
  result.push({
@@ -1 +1 @@
1
- {"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/guidance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAwFpB,wBAAgB,UAAU,CACxB,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,WAAW,EAAE,MAAM,GAClB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAiEnC;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAC1C,GAAG;IACF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAA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 function prompt(root, activation, declared, candidates, signals, warnings) {
51
51
  }
52
52
  else if (declared.verificationAnchors.length > 0)
53
53
  bullets.push(`- Verify after kb_check with ${summary(declared.verificationAnchors, 2)}.`);
54
- if (activation.activationMode === "attached_thin_handoff" ||
54
+ if (activation.activationMode === "attached_seeded_handoff" &&
55
+ !activation.applyBlocked)
56
+ bullets.push("- Seeded KB: only declared intent claims are planned; use kb_search or kb_query for existing knowledge.");
57
+ else if (activation.activationMode === "attached_thin_handoff" ||
55
58
  activation.activationMode === "attached_seeded_handoff")
56
59
  bullets.push("- Handoff: use kb_search, kb_query, or gap/coverage tools to work with existing KB.");
57
60
  if (warnings.length > 0)
@@ -78,7 +81,8 @@ export function confidence(activation, declared, candidates, signals, promptBloc
78
81
  repair_bootstrap: -0.05,
79
82
  attached_thin_bootstrap: 0.04,
80
83
  attached_thin_handoff: -0.12,
81
- attached_seeded_handoff: -0.18,
84
+ // A seeded plan of declared claims weighs like a thin bootstrap plan.
85
+ attached_seeded_handoff: activation.applyBlocked ? -0.18 : 0.04,
82
86
  vendored_blocked: -0.25,
83
87
  }[activation.activationMode];
84
88
  reasons.push(`${activation.activationMode} determined the bootstrap posture.`);
@@ -1 +1 @@
1
- {"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../../src/operations/bootstrap/presentation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACV,gBAAgB,EAGhB,gBAAgB,EAChB,wBAAwB,EAGxB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AA6GpB,wBAAgB,yBAAyB,CACvC,KAAK,CAAC,EAAE,gBAAgB,GACvB,wBAAwB,CAe1B;AAgBD;;;GAGG;AAEH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,C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.count - left.count || left.reason.localeCompare(right.reason));
138
138
  }
139
+ const EXISTING_REASONS = ["entity_exists"];
140
+ const FILTERED_REASONS = ["filtered_by_entity_type", "below_min_confidence"];
139
141
  /** Declared claims per knowledge source against what the plan writes. */
140
142
  // implements REQ-bootstrap-intent-claim-accounting
141
- function claimAccounting(declared, candidates, suppressed) {
143
+ function claimAccounting(declared, candidates, suppressed, signals) {
142
144
  return (declared.knowledgeSources ?? []).flatMap((source) => {
143
145
  const count = (declared.intentClaims ?? []).filter((claim) => claim.sourceId === source.id).length;
144
146
  if (count === 0)
@@ -146,14 +148,75 @@ function claimAccounting(declared, candidates, suppressed) {
146
148
  const prefix = `claim:${source.id}:`;
147
149
  const planned = candidates.filter((candidate) => candidate.sourceKind === "intent_claim" &&
148
150
  candidate.candidateId.startsWith(prefix)).length;
149
- const rows = (reasons) => suppressed.filter((row) => reasons.includes(String(row.reason)) &&
150
- String(row.candidateId).startsWith(prefix)).length;
151
- const existing = rows(["entity_exists"]);
151
+ // Rows cite their claim by candidate ID, or by sourceId when the claim
152
+ // never became a candidate (stale source, missing excerpt, activation).
153
+ const sourceRows = suppressed.filter((row) => String(row.candidateId ?? "").startsWith(prefix) ||
154
+ (!row.candidateId && row.sourceId === source.id));
155
+ const rows = (reasons) => sourceRows.filter((row) => reasons.includes(String(row.reason)));
156
+ const existing = rows(EXISTING_REASONS).length;
152
157
  // Claims the caller filtered out (entityTypes, minConfidence) are not lost.
153
- const filtered = rows(["filtered_by_entity_type", "below_min_confidence"]);
154
- return [{ source, declared: count, planned, existing, filtered }];
158
+ const filteredRows = rows(FILTERED_REASONS);
159
+ const filtered = filteredRows.length;
160
+ // The rest is not planned; each claim is attributed to one reason, in
161
+ // order, so the counts add up to what was declared.
162
+ let rest = Math.max(0, count - planned - existing - filtered);
163
+ const take = (value) => {
164
+ const taken = Math.min(rest, value);
165
+ rest -= taken;
166
+ return taken;
167
+ };
168
+ const byActivation = take(rows(["suppressed_by_activation"]).length);
169
+ const otherRows = sourceRows.filter((row) => ![
170
+ ...EXISTING_REASONS,
171
+ ...FILTERED_REASONS,
172
+ "suppressed_by_activation",
173
+ ].includes(String(row.reason)));
174
+ const suppressedCount = take(otherRows.length);
175
+ // A claim below minConfidence or invalid at write time also leaves a
176
+ // follow-up; it is already counted by its row.
177
+ const counted = new Set([...filteredRows, ...otherRows].map((row) => String(row.sourcePath)));
178
+ const sourceOnly = take(signals.filter((signal) => signal.evidence.some((line) => line.startsWith(`intent_claim:${source.id}:`)) && !counted.has(signal.sourcePath)).length);
179
+ return [
180
+ {
181
+ source,
182
+ declared: count,
183
+ planned,
184
+ existing,
185
+ filtered,
186
+ byActivation,
187
+ suppressed: suppressedCount,
188
+ sourceOnly,
189
+ unattributed: rest,
190
+ },
191
+ ];
155
192
  });
156
193
  }
194
+ /** One diagnostic line per source that names why claims were not planned. */
195
+ // implements REQ-bootstrap-intent-claim-accounting
196
+ function accountingLine(row, activation) {
197
+ const notPlanned = row.byActivation + row.suppressed + row.sourceOnly + row.unattributed;
198
+ const reasons = [
199
+ ...(row.byActivation > 0
200
+ ? [
201
+ `${row.byActivation} because bootstrap synthesis is suppressed in ${activation.activationMode}; compile them with kb_compile_intent`,
202
+ ]
203
+ : []),
204
+ ...(row.suppressed > 0
205
+ ? [`${row.suppressed} suppressed (rows in suppressedCandidates)`]
206
+ : []),
207
+ ...(row.sourceOnly > 0
208
+ ? [
209
+ `${row.sourceOnly} need authoring (sourceOnlySignals; compile them with kb_compile_intent)`,
210
+ ]
211
+ : []),
212
+ ...(row.unattributed > 0
213
+ ? [
214
+ `${row.unattributed} without a suppressedCandidates row or follow-up (see diagnostics)`,
215
+ ]
216
+ : []),
217
+ ];
218
+ return `Knowledge source ${row.source.id} (${row.source.authority}): ${row.declared} declared claim(s), ${row.planned} planned, ${row.existing} already in the KB, ${row.filtered} filtered out, ${notPlanned} not planned${reasons.length > 0 ? `: ${reasons.join("; ")}` : ""}.`;
219
+ }
157
220
  // implements REQ-KIBI-BOOTSTRAP-PLAN, REQ-bootstrap-discovered-candidate-budget, REQ-bootstrap-provenance-stubs
158
221
  export function presentBootstrap(input) {
159
222
  const declaredContext = normalizeBootstrapContext(input.bootstrapContext);
@@ -238,10 +301,13 @@ export function presentBootstrap(input) {
238
301
  candidateId: candidate.candidateId,
239
302
  };
240
303
  });
241
- const accounting = claimAccounting(declaredContext, input.candidates, input.suppressedCandidates);
304
+ const accounting = claimAccounting(declaredContext, input.candidates, input.suppressedCandidates, input.sourceOnlySignals);
242
305
  const droppedAuthoritative = accounting.filter((row) => row.source.authority === "authoritative" &&
243
306
  row.planned + row.existing + row.filtered === 0);
244
- const status = input.activation.activationState === "root_active_seeded"
307
+ const status =
308
+ // A seeded KB is a handoff unless its plan holds declared claims.
309
+ input.activation.activationState === "root_active_seeded" &&
310
+ input.activation.applyBlocked
245
311
  ? "handoff"
246
312
  : applyBlocked
247
313
  ? "blocked"
@@ -277,7 +343,7 @@ export function presentBootstrap(input) {
277
343
  `Suppressed candidates by reason: ${suppression.map((row) => `${row.reason} ${row.count}`).join(", ")} (rows in suppressedCandidates).`,
278
344
  ]
279
345
  : []),
280
- ...accounting.map((row) => `Knowledge source ${row.source.id} (${row.source.authority}): ${row.declared} declared claim(s), ${row.planned} planned, ${row.existing} already in the KB, ${row.filtered} filtered out, ${row.declared - row.planned - row.existing - row.filtered} not planned (see suppressedCandidates and source-only follow-ups).`),
346
+ ...accounting.map((row) => accountingLine(row, input.activation)),
281
347
  ];
282
348
  const planBody = {
283
349
  version: "kibi.bootstrap-plan.v1",
@@ -105,6 +105,12 @@ export type ActivationPolicy = {
105
105
  readonly activationMode: ActivationMode;
106
106
  readonly applyBlocked: boolean;
107
107
  readonly allowCandidateGeneration: boolean;
108
+ /**
109
+ * Whether declared intent claims from bootstrapContext are planned. A
110
+ * seeded KB turns off discovered candidates but still plans these claims.
111
+ * Defaults to allowCandidateGeneration when omitted.
112
+ */
113
+ readonly allowDeclaredClaims?: boolean;
108
114
  readonly reason: string;
109
115
  readonly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own extractor reads it: the frontmatter
23
- * ends at the next `---` after the opening delimiter. Returns null when that
24
- * `---` is not at the start of a line, because an edit there could not be
25
- * read back.
22
+ * Split a document around its YAML frontmatter: the opening and the closing
23
+ * delimiter are each a whole line holding only `---` (trailing whitespace
24
+ * allowed). A `---` inside a line, such as a Markdown table separator row
25
+ * in a quoted scalar, never ends the frontmatter. Returns null when there is
26
+ * no such opening and closing pair.
26
27
  */
27
28
  export declare function sliceFrontmatter(content: string): FrontmatterSlice | null;
28
29
  /**
@@ -36,7 +37,9 @@ export declare function readTopLevelField(frontmatter: string, key: string): unk
36
37
  * Set one top-level scalar frontmatter key, leaving every other byte of the
37
38
  * document unchanged: the key's line is replaced in place, or appended as the
38
39
  * last frontmatter key when absent. Returns null when the key spans several
39
- * lines or the edit would not read back as exactly that change.
40
+ * lines or the edit would not read back as exactly that change: the written
41
+ * document is split and parsed again and must yield the same frontmatter and
42
+ * the same body.
40
43
  */
41
44
  export declare function withTopLevelField(content: string, key: string, value: string): string | null;
42
45
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"kb-sources.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/kb-sources.ts"],"names":[],"mappings":"AA+BA,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,yBAAyB,CAAC;AAGjC,yEAAyE;AAEzE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AAuBH,0EAA0E;AAE1E,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,KAAK,GAAE,SAAS,UAAU,EAAiB,GAC1C,gBAAgB,EAAE,CAkBpB;AAED,6DAA6D;AAE7D,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,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kBpB;AAED,6DAA6D;AAE7D,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH;;;;;;GAMG;AAEH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAezE;AAUD;;;;;GAKG;AAEH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAe3E;AAoDD;;;;;;;GAOG;AAEH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,IAAI,CA0Bf;AAQD;;;;;;GAMG;AAEH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,IAAI,CAsBf;AAID;;;;GAIG;AAEH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAY3E;AAqBD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMxD"}
@@ -65,22 +65,23 @@ export function listLaneMarkdownFiles(workspaceRoot, lanes = ENTITY_LANES) {
65
65
  return result;
66
66
  }
67
67
  /**
68
- * Split a document the way the Markdown extractor reads it: the frontmatter
69
- * ends at the next `---` after the opening delimiter. Returns null when that
70
- * `---` is not at the start of a line, because an edit there could not be
71
- * read back.
68
+ * Split a document around its YAML frontmatter: the opening and the closing
69
+ * delimiter are each a whole line holding only `---` (trailing whitespace
70
+ * allowed). A `---` inside a line, such as a Markdown table separator row
71
+ * in a quoted scalar, never ends the frontmatter. Returns null when there is
72
+ * no such opening and closing pair.
72
73
  */
73
74
  // implements REQ-cli-schema-migration
74
75
  export function sliceFrontmatter(content) {
75
76
  const leading = content.length - content.trimStart().length;
76
- if (!content.startsWith("---", leading))
77
+ const open = /^---[ \t]*\r?\n/.exec(content.slice(leading));
78
+ if (open === null)
77
79
  return null;
78
- const openEnd = content.indexOf("\n", leading + 3);
79
- if (openEnd < 0)
80
- return null;
81
- const close = content.indexOf("---", leading + 3);
82
- if (close <= openEnd || content[close - 1] !== "\n")
80
+ const openEnd = leading + open[0].length - 1;
81
+ const match = /^---[ \t]*\r?$/m.exec(content.slice(openEnd + 1));
82
+ if (match === null)
83
83
  return null;
84
+ const close = openEnd + 1 + match.index;
84
85
  const text = content.slice(openEnd + 1, close);
85
86
  return {
86
87
  prefix: content.slice(0, openEnd + 1),
@@ -121,10 +122,22 @@ export function readTopLevelField(frontmatter, key) {
121
122
  return undefined;
122
123
  }
123
124
  }
125
+ /**
126
+ * A YAML double-quoted scalar for `value` with no run of three dashes, so a
127
+ * reader that splits the document on any `---` still finds the frontmatter
128
+ * intact. Every second dash of a run is written as the `\x2D` escape, which
129
+ * YAML reads back as the same dash.
130
+ */
131
+ function doubleQuotedScalar(value) {
132
+ return JSON.stringify(value).replace(/-{3,}/g, (run) => [...run].map((dash, index) => (index % 2 === 1 ? "\\x2D" : dash)).join(""));
133
+ }
124
134
  function scalarLine(key, value, previous) {
135
+ const quoted = `${key}: ${doubleQuotedScalar(value)}`;
136
+ if (value.includes("---"))
137
+ return quoted;
125
138
  const raw = previous.slice(previous.indexOf(":") + 1).trim();
126
139
  if (raw.startsWith('"'))
127
- return `${key}: ${JSON.stringify(value)}`;
140
+ return quoted;
128
141
  if (raw.startsWith("'"))
129
142
  return `${key}: '${value.replaceAll("'", "''")}'`;
130
143
  try {
@@ -135,13 +148,35 @@ function scalarLine(key, value, previous) {
135
148
  catch {
136
149
  // Fall through to a quoted scalar.
137
150
  }
138
- return `${key}: ${JSON.stringify(value)}`;
151
+ return quoted;
152
+ }
153
+ /**
154
+ * Whether `document` reads back, through the same frontmatter split, as
155
+ * exactly `expected` with the closing delimiter and body of `original`
156
+ * unchanged, and without a new `---` in its frontmatter that a reader
157
+ * splitting on any `---` would cut on.
158
+ */
159
+ function readsBackAs(document, expected, original) {
160
+ const slice = sliceFrontmatter(document);
161
+ if (slice === null || slice.suffix !== original.suffix)
162
+ return false;
163
+ if (slice.text.includes("---") && !original.text.includes("---")) {
164
+ return false;
165
+ }
166
+ try {
167
+ return isDeepStrictEqual(loadYaml(slice.text), expected);
168
+ }
169
+ catch {
170
+ return false;
171
+ }
139
172
  }
140
173
  /**
141
174
  * Set one top-level scalar frontmatter key, leaving every other byte of the
142
175
  * document unchanged: the key's line is replaced in place, or appended as the
143
176
  * last frontmatter key when absent. Returns null when the key spans several
144
- * lines or the edit would not read back as exactly that change.
177
+ * lines or the edit would not read back as exactly that change: the written
178
+ * document is split and parsed again and must yield the same frontmatter and
179
+ * the same body.
145
180
  */
146
181
  // implements REQ-cli-schema-migration
147
182
  export function withTopLevelField(content, key, value) {
@@ -169,11 +204,12 @@ export function withTopLevelField(content, key, value) {
169
204
  const { [key]: _nextValue, ...nextRest } = next;
170
205
  if (!isDeepStrictEqual(beforeRest, nextRest))
171
206
  return null;
207
+ const document = `${slice.prefix}${text}${slice.suffix}`;
208
+ return readsBackAs(document, next, slice) ? document : null;
172
209
  }
173
210
  catch {
174
211
  return null;
175
212
  }
176
- return `${slice.prefix}${text}${slice.suffix}`;
177
213
  }
178
214
  function frontmatterRecord(text) {
179
215
  const parsed = loadYaml(text);
@@ -1 +1 @@
1
- {"version":3,"file":"schema6.d.ts","sourceRoot":"","sources":["../../../src/operations/migration/schema6.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAEL,kCAAkC,EAClC,wBAAwB,EACxB,mBAAmB,EAEnB,wBAAwB,EAOzB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