@superbee/core 0.2.0-pre.16 → 0.2.0-pre.19

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 (278) hide show
  1. package/README.md +622 -5
  2. package/dist/blob-journal.d.ts +187 -2
  3. package/dist/blob-journal.d.ts.map +1 -1
  4. package/dist/blob-journal.js +377 -5
  5. package/dist/blob-journal.js.map +1 -1
  6. package/dist/body-replace-guards.d.ts +50 -0
  7. package/dist/body-replace-guards.d.ts.map +1 -0
  8. package/dist/body-replace-guards.js +158 -0
  9. package/dist/body-replace-guards.js.map +1 -0
  10. package/dist/builtin-recipes/content.d.ts +93 -0
  11. package/dist/builtin-recipes/content.d.ts.map +1 -0
  12. package/dist/builtin-recipes/content.js +288 -0
  13. package/dist/builtin-recipes/content.js.map +1 -0
  14. package/dist/builtin-recipes.d.ts +10 -0
  15. package/dist/builtin-recipes.d.ts.map +1 -0
  16. package/dist/builtin-recipes.js +97 -0
  17. package/dist/builtin-recipes.js.map +1 -0
  18. package/dist/bundle-health/index.d.ts +14 -0
  19. package/dist/bundle-health/index.d.ts.map +1 -0
  20. package/dist/bundle-health/index.js +12 -0
  21. package/dist/bundle-health/index.js.map +1 -0
  22. package/dist/bundle-health/kind-findings.d.ts +44 -0
  23. package/dist/bundle-health/kind-findings.d.ts.map +1 -0
  24. package/dist/bundle-health/kind-findings.js +68 -0
  25. package/dist/bundle-health/kind-findings.js.map +1 -0
  26. package/dist/bundle-health/legacy-page.d.ts +39 -0
  27. package/dist/bundle-health/legacy-page.d.ts.map +1 -0
  28. package/dist/bundle-health/legacy-page.js +50 -0
  29. package/dist/bundle-health/legacy-page.js.map +1 -0
  30. package/dist/bundle-health/report.d.ts +202 -0
  31. package/dist/bundle-health/report.d.ts.map +1 -0
  32. package/dist/bundle-health/report.js +438 -0
  33. package/dist/bundle-health/report.js.map +1 -0
  34. package/dist/code-point-order.d.ts +8 -0
  35. package/dist/code-point-order.d.ts.map +1 -0
  36. package/dist/code-point-order.js +20 -0
  37. package/dist/code-point-order.js.map +1 -0
  38. package/dist/connectors.d.ts +223 -0
  39. package/dist/connectors.d.ts.map +1 -0
  40. package/dist/connectors.js +1143 -0
  41. package/dist/connectors.js.map +1 -0
  42. package/dist/document-field-actions.d.ts +18 -0
  43. package/dist/document-field-actions.d.ts.map +1 -1
  44. package/dist/document-field-actions.js +91 -29
  45. package/dist/document-field-actions.js.map +1 -1
  46. package/dist/document-mutation.d.ts +7 -9
  47. package/dist/document-mutation.d.ts.map +1 -1
  48. package/dist/document-mutation.js +16 -16
  49. package/dist/document-mutation.js.map +1 -1
  50. package/dist/file-journaled-backend.d.ts +31 -5
  51. package/dist/file-journaled-backend.d.ts.map +1 -1
  52. package/dist/file-journaled-backend.js +131 -118
  53. package/dist/file-journaled-backend.js.map +1 -1
  54. package/dist/hosted-client/blob-delivery.d.ts +6 -0
  55. package/dist/hosted-client/blob-delivery.d.ts.map +1 -1
  56. package/dist/hosted-client/blob-delivery.js +23 -1
  57. package/dist/hosted-client/blob-delivery.js.map +1 -1
  58. package/dist/hosted-client/blob-write.d.ts +386 -0
  59. package/dist/hosted-client/blob-write.d.ts.map +1 -0
  60. package/dist/hosted-client/blob-write.js +770 -0
  61. package/dist/hosted-client/blob-write.js.map +1 -0
  62. package/dist/hosted-client/client.d.ts +64 -0
  63. package/dist/hosted-client/client.d.ts.map +1 -1
  64. package/dist/hosted-client/client.js +31 -0
  65. package/dist/hosted-client/client.js.map +1 -1
  66. package/dist/hosted-client/directory.d.ts +46 -0
  67. package/dist/hosted-client/directory.d.ts.map +1 -0
  68. package/dist/hosted-client/directory.js +74 -0
  69. package/dist/hosted-client/directory.js.map +1 -0
  70. package/dist/hosted-client/errors.d.ts +10 -0
  71. package/dist/hosted-client/errors.d.ts.map +1 -1
  72. package/dist/hosted-client/errors.js +13 -0
  73. package/dist/hosted-client/errors.js.map +1 -1
  74. package/dist/hosted-client/inbox.d.ts +320 -0
  75. package/dist/hosted-client/inbox.d.ts.map +1 -0
  76. package/dist/hosted-client/inbox.js +379 -0
  77. package/dist/hosted-client/inbox.js.map +1 -0
  78. package/dist/hosted-client/index.d.ts +11 -4
  79. package/dist/hosted-client/index.d.ts.map +1 -1
  80. package/dist/hosted-client/index.js +11 -4
  81. package/dist/hosted-client/index.js.map +1 -1
  82. package/dist/hosted-client/journal.d.ts +103 -0
  83. package/dist/hosted-client/journal.d.ts.map +1 -0
  84. package/dist/hosted-client/journal.js +464 -0
  85. package/dist/hosted-client/journal.js.map +1 -0
  86. package/dist/hosted-client/node.d.ts +5 -1
  87. package/dist/hosted-client/node.d.ts.map +1 -1
  88. package/dist/hosted-client/node.js +6 -1
  89. package/dist/hosted-client/node.js.map +1 -1
  90. package/dist/hosted-client/write.d.ts +28 -2
  91. package/dist/hosted-client/write.d.ts.map +1 -1
  92. package/dist/hosted-client/write.js +33 -11
  93. package/dist/hosted-client/write.js.map +1 -1
  94. package/dist/hosted-transport/answer-rows.d.ts +3 -2
  95. package/dist/hosted-transport/answer-rows.d.ts.map +1 -1
  96. package/dist/hosted-transport/answer-rows.js +1 -1
  97. package/dist/hosted-transport/answer-rows.js.map +1 -1
  98. package/dist/hosted-transport/carrier.d.ts +10 -0
  99. package/dist/hosted-transport/carrier.d.ts.map +1 -1
  100. package/dist/hosted-transport/carrier.js +22 -2
  101. package/dist/hosted-transport/carrier.js.map +1 -1
  102. package/dist/hosted-transport/whole-document-transport.d.ts +1 -1
  103. package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -1
  104. package/dist/hosted-transport/whole-document-transport.js +20 -12
  105. package/dist/hosted-transport/whole-document-transport.js.map +1 -1
  106. package/dist/index.d.ts +6 -2
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +4 -2
  109. package/dist/index.js.map +1 -1
  110. package/dist/kind-authoring.d.ts +170 -0
  111. package/dist/kind-authoring.d.ts.map +1 -0
  112. package/dist/kind-authoring.js +451 -0
  113. package/dist/kind-authoring.js.map +1 -0
  114. package/dist/kind-conformance-error.d.ts +15 -0
  115. package/dist/kind-conformance-error.d.ts.map +1 -0
  116. package/dist/kind-conformance-error.js +20 -0
  117. package/dist/kind-conformance-error.js.map +1 -0
  118. package/dist/kinds-load.js +4 -4
  119. package/dist/kinds-load.js.map +1 -1
  120. package/dist/kinds.d.ts +2 -0
  121. package/dist/kinds.d.ts.map +1 -1
  122. package/dist/kinds.js +10 -2
  123. package/dist/kinds.js.map +1 -1
  124. package/dist/paths.d.ts +16 -0
  125. package/dist/paths.d.ts.map +1 -1
  126. package/dist/paths.js +25 -0
  127. package/dist/paths.js.map +1 -1
  128. package/dist/query-filter.d.ts +9 -0
  129. package/dist/query-filter.d.ts.map +1 -1
  130. package/dist/query-filter.js +19 -3
  131. package/dist/query-filter.js.map +1 -1
  132. package/dist/recipe-lifecycle/stamp.d.ts +11 -0
  133. package/dist/recipe-lifecycle/stamp.d.ts.map +1 -1
  134. package/dist/recipe-lifecycle/stamp.js +6 -0
  135. package/dist/recipe-lifecycle/stamp.js.map +1 -1
  136. package/dist/record-overlay/apply.d.ts +43 -0
  137. package/dist/record-overlay/apply.d.ts.map +1 -0
  138. package/dist/record-overlay/apply.js +527 -0
  139. package/dist/record-overlay/apply.js.map +1 -0
  140. package/dist/record-overlay/canonical.d.ts +22 -0
  141. package/dist/record-overlay/canonical.d.ts.map +1 -0
  142. package/dist/record-overlay/canonical.js +47 -0
  143. package/dist/record-overlay/canonical.js.map +1 -0
  144. package/dist/record-overlay/digest.d.ts +4 -0
  145. package/dist/record-overlay/digest.d.ts.map +1 -0
  146. package/dist/record-overlay/digest.js +11 -0
  147. package/dist/record-overlay/digest.js.map +1 -0
  148. package/dist/record-overlay/errors.d.ts +44 -0
  149. package/dist/record-overlay/errors.d.ts.map +1 -0
  150. package/dist/record-overlay/errors.js +55 -0
  151. package/dist/record-overlay/errors.js.map +1 -0
  152. package/dist/record-overlay/findings.d.ts +5 -0
  153. package/dist/record-overlay/findings.d.ts.map +1 -0
  154. package/dist/record-overlay/findings.js +83 -0
  155. package/dist/record-overlay/findings.js.map +1 -0
  156. package/dist/record-overlay/index.d.ts +23 -0
  157. package/dist/record-overlay/index.d.ts.map +1 -0
  158. package/dist/record-overlay/index.js +21 -0
  159. package/dist/record-overlay/index.js.map +1 -0
  160. package/dist/record-overlay/plan.d.ts +12 -0
  161. package/dist/record-overlay/plan.d.ts.map +1 -0
  162. package/dist/record-overlay/plan.js +285 -0
  163. package/dist/record-overlay/plan.js.map +1 -0
  164. package/dist/record-overlay/policy.d.ts +69 -0
  165. package/dist/record-overlay/policy.d.ts.map +1 -0
  166. package/dist/record-overlay/policy.js +228 -0
  167. package/dist/record-overlay/policy.js.map +1 -0
  168. package/dist/record-overlay/redact.d.ts +3 -0
  169. package/dist/record-overlay/redact.d.ts.map +1 -0
  170. package/dist/record-overlay/redact.js +27 -0
  171. package/dist/record-overlay/redact.js.map +1 -0
  172. package/dist/record-overlay/signal-kind.d.ts +30 -0
  173. package/dist/record-overlay/signal-kind.d.ts.map +1 -0
  174. package/dist/record-overlay/signal-kind.js +38 -0
  175. package/dist/record-overlay/signal-kind.js.map +1 -0
  176. package/dist/record-overlay/signal-text.d.ts +45 -0
  177. package/dist/record-overlay/signal-text.d.ts.map +1 -0
  178. package/dist/record-overlay/signal-text.js +116 -0
  179. package/dist/record-overlay/signal-text.js.map +1 -0
  180. package/dist/record-overlay/source-index.d.ts +19 -0
  181. package/dist/record-overlay/source-index.d.ts.map +1 -0
  182. package/dist/record-overlay/source-index.js +102 -0
  183. package/dist/record-overlay/source-index.js.map +1 -0
  184. package/dist/record-overlay/types.d.ts +291 -0
  185. package/dist/record-overlay/types.d.ts.map +1 -0
  186. package/dist/record-overlay/types.js +2 -0
  187. package/dist/record-overlay/types.js.map +1 -0
  188. package/dist/remote-operations.js +5 -2
  189. package/dist/remote-operations.js.map +1 -1
  190. package/dist/search/contract.d.ts +151 -0
  191. package/dist/search/contract.d.ts.map +1 -0
  192. package/dist/search/contract.js +78 -0
  193. package/dist/search/contract.js.map +1 -0
  194. package/dist/search/errors.d.ts +30 -0
  195. package/dist/search/errors.d.ts.map +1 -0
  196. package/dist/search/errors.js +50 -0
  197. package/dist/search/errors.js.map +1 -0
  198. package/dist/search/identity.d.ts +12 -0
  199. package/dist/search/identity.d.ts.map +1 -0
  200. package/dist/search/identity.js +90 -0
  201. package/dist/search/identity.js.map +1 -0
  202. package/dist/search/index.d.ts +15 -0
  203. package/dist/search/index.d.ts.map +1 -0
  204. package/dist/search/index.js +14 -0
  205. package/dist/search/index.js.map +1 -0
  206. package/dist/search/memory-source.d.ts +25 -0
  207. package/dist/search/memory-source.d.ts.map +1 -0
  208. package/dist/search/memory-source.js +230 -0
  209. package/dist/search/memory-source.js.map +1 -0
  210. package/dist/search/rank.d.ts +34 -0
  211. package/dist/search/rank.d.ts.map +1 -0
  212. package/dist/search/rank.js +129 -0
  213. package/dist/search/rank.js.map +1 -0
  214. package/dist/search/row-text.d.ts +38 -0
  215. package/dist/search/row-text.d.ts.map +1 -0
  216. package/dist/search/row-text.js +88 -0
  217. package/dist/search/row-text.js.map +1 -0
  218. package/dist/search/search.d.ts +28 -0
  219. package/dist/search/search.d.ts.map +1 -0
  220. package/dist/search/search.js +240 -0
  221. package/dist/search/search.js.map +1 -0
  222. package/dist/search/source.d.ts +67 -0
  223. package/dist/search/source.d.ts.map +1 -0
  224. package/dist/search/source.js +2 -0
  225. package/dist/search/source.js.map +1 -0
  226. package/dist/search/text.d.ts +47 -0
  227. package/dist/search/text.d.ts.map +1 -0
  228. package/dist/search/text.js +148 -0
  229. package/dist/search/text.js.map +1 -0
  230. package/dist/source-engine/guard.d.ts +82 -0
  231. package/dist/source-engine/guard.d.ts.map +1 -0
  232. package/dist/source-engine/guard.js +396 -0
  233. package/dist/source-engine/guard.js.map +1 -0
  234. package/dist/source-engine/index.d.ts +24 -0
  235. package/dist/source-engine/index.d.ts.map +1 -0
  236. package/dist/source-engine/index.js +20 -0
  237. package/dist/source-engine/index.js.map +1 -0
  238. package/dist/source-engine/machine-state.d.ts +74 -0
  239. package/dist/source-engine/machine-state.d.ts.map +1 -0
  240. package/dist/source-engine/machine-state.js +48 -0
  241. package/dist/source-engine/machine-state.js.map +1 -0
  242. package/dist/source-engine/observe.d.ts +18 -0
  243. package/dist/source-engine/observe.d.ts.map +1 -0
  244. package/dist/source-engine/observe.js +598 -0
  245. package/dist/source-engine/observe.js.map +1 -0
  246. package/dist/source-engine/robots.d.ts +53 -0
  247. package/dist/source-engine/robots.d.ts.map +1 -0
  248. package/dist/source-engine/robots.js +158 -0
  249. package/dist/source-engine/robots.js.map +1 -0
  250. package/dist/source-engine/types.d.ts +285 -0
  251. package/dist/source-engine/types.d.ts.map +1 -0
  252. package/dist/source-engine/types.js +2 -0
  253. package/dist/source-engine/types.js.map +1 -0
  254. package/dist/source-harness/conformance.d.ts +16 -0
  255. package/dist/source-harness/conformance.d.ts.map +1 -0
  256. package/dist/source-harness/conformance.js +265 -0
  257. package/dist/source-harness/conformance.js.map +1 -0
  258. package/dist/source-harness/fixture.d.ts +95 -0
  259. package/dist/source-harness/fixture.d.ts.map +1 -0
  260. package/dist/source-harness/fixture.js +261 -0
  261. package/dist/source-harness/fixture.js.map +1 -0
  262. package/dist/source-harness/index.d.ts +22 -0
  263. package/dist/source-harness/index.d.ts.map +1 -0
  264. package/dist/source-harness/index.js +19 -0
  265. package/dist/source-harness/index.js.map +1 -0
  266. package/dist/source-harness/peer.d.ts +74 -0
  267. package/dist/source-harness/peer.d.ts.map +1 -0
  268. package/dist/source-harness/peer.js +106 -0
  269. package/dist/source-harness/peer.js.map +1 -0
  270. package/dist/storage.d.ts +2 -1
  271. package/dist/storage.d.ts.map +1 -1
  272. package/dist/storage.js +1 -1
  273. package/dist/storage.js.map +1 -1
  274. package/dist/uncertain-write.d.ts +39 -6
  275. package/dist/uncertain-write.d.ts.map +1 -1
  276. package/dist/uncertain-write.js +25 -3
  277. package/dist/uncertain-write.js.map +1 -1
  278. package/package.json +33 -1
@@ -0,0 +1,451 @@
1
+ import { InvalidInputError } from "./errors.js";
2
+ import { isManagedDocumentMetadataField } from "./managed-document-metadata.js";
3
+ // Storage-neutral Kind inference and guarded authoring. Pure derivations consume already-read
4
+ // documents; the public operations below acquire state and share mutation specifications with
5
+ // presentation adapters. Host-specific prose, command formatting and receipts stay with callers.
6
+ //
7
+ // The one invariant this module exists to protect: an INFERRED draft applies with zero new
8
+ // conformance warnings ("zero-debt by construction"). That holds only because the inference
9
+ // predicates below are pinned to core's OWN validation predicates — presence is core's
10
+ // `isPresent` (never bare key existence: a `title: ""` on one instance must not become a
11
+ // required field), and enum proposal is scalar-string-only (an array-valued key would fire
12
+ // KIND_FIELD_ARITY on every instance). The apply-then-validate property test in
13
+ // kind-draft.test.ts pins this predicate equality; drift there fails the suite loudly.
14
+ import { sha256HexOfUtf8 } from "./sha256.js";
15
+ import { isPresent, RESERVED_KIND_FIELD_NAMES, SUPERBEE_PROGRESS_STATUS_FIELD, splitSections, validateAgainstKind, } from "./kinds.js";
16
+ /** Enum inference gates: 100% presence, at least this many instances, 2-6 distinct scalar strings. */
17
+ export const ENUM_MIN_INSTANCES = 10;
18
+ export const ENUM_MIN_DISTINCT = 2;
19
+ export const ENUM_MAX_DISTINCT = 6;
20
+ /**
21
+ * Floor for a sub-100% H1 heading to appear as a PRICED promotion (mirrors the 60% descriptive
22
+ * threshold the modeling signal's status block uses). Headings below it are noise, not candidates.
23
+ */
24
+ export const SECTION_PROMOTION_FLOOR = 0.6;
25
+ /** Inference omits ownership metadata and receipts, without changing field-action policy. */
26
+ const EXCLUDED_FIELDS = new Set([...RESERVED_KIND_FIELD_NAMES, "head_version"]);
27
+ function excludedInferenceField(field) {
28
+ return EXCLUDED_FIELDS.has(field) || isManagedDocumentMetadataField(field) ||
29
+ (field.startsWith("superbee_") && field !== SUPERBEE_PROGRESS_STATUS_FIELD);
30
+ }
31
+ /**
32
+ * One predicate per declaring key. The `Record<DeclarationKey, ...>` type is the point: adding a
33
+ * key to `KindConvention` in core makes this object structurally incomplete and FAILS THE BUILD
34
+ * until the new key is classified. This predicate was previously a hand-written chain of `||`,
35
+ * and an enumeration maintained by hand goes stale silently — it omitted `path`, and then
36
+ * `browseCollapsed`, each found only by someone probing for it. A missing entry here is not a
37
+ * cosmetic gap: it makes a real convention read as a dismissal record, so a draft will overwrite
38
+ * the declaration it could not see.
39
+ */
40
+ /**
41
+ * The same exhaustiveness, one level down. `fields` is a structured sub-object, and the first
42
+ * version of this classifier enumerated four of its six keys by hand — missing `descriptions`
43
+ * and `valueDescriptions`, so a convention carrying only field guidance read as declaration-free
44
+ * and could be drafted over. Every key of `KindFields` declares something (a dismissal record has
45
+ * an EMPTY fields block, not a partially-filled one), so nothing is excluded here; adding a key to
46
+ * `KindFields` in core fails the build until it is classified.
47
+ */
48
+ const FIELDS_DECLARES = {
49
+ required: (f) => f.required.length > 0,
50
+ optional: (f) => f.optional.length > 0,
51
+ values: (f) => Object.keys(f.values).length > 0,
52
+ valueDescriptions: (f) => f.valueDescriptions !== undefined && Object.keys(f.valueDescriptions).length > 0,
53
+ terminal: (f) => Object.keys(f.terminal).length > 0,
54
+ descriptions: (f) => Object.keys(f.descriptions).length > 0,
55
+ types: (f) => f.types !== undefined && Object.keys(f.types).length > 0,
56
+ };
57
+ const DECLARES = {
58
+ path: (kind) => kind.path !== undefined && kind.path !== "",
59
+ fields: (kind) => Object.values(FIELDS_DECLARES).some((declares) => declares(kind.fields)),
60
+ links: (kind) => kind.links !== undefined && Object.keys(kind.links).length > 0,
61
+ linkDescriptions: (kind) => kind.linkDescriptions !== undefined && Object.keys(kind.linkDescriptions).length > 0,
62
+ expectsInbound: (kind) => kind.expectsInbound !== undefined && Object.keys(kind.expectsInbound).length > 0,
63
+ sections: (kind) => kind.sections !== undefined && kind.sections.length > 0,
64
+ freshnessHorizon: (kind) => kind.freshnessHorizon !== undefined,
65
+ // Core parses only a strict `true` here; a declared `false` never reaches this predicate, so the
66
+ // `!== undefined` form is the whole check rather than a distinction between true and false.
67
+ browseCollapsed: (kind) => kind.browseCollapsed !== undefined,
68
+ // A reading-order placement is authored on purpose; a draft must never overwrite it.
69
+ order: (kind) => kind.order !== undefined,
70
+ claim: (kind) => kind.claim !== undefined,
71
+ };
72
+ /**
73
+ * Whether `kind` declares ANY schema obligation or behavior. The ONE predicate shared by
74
+ * `kind draft`'s refusal (a declaration-bearing kind is never silently redrafted), `kind
75
+ * dismiss`'s idempotency check, and `new`'s registry-lookup guard (a declaration-free kind — a
76
+ * dismissal record — must leave `new`'s command surface exactly as it was before the dismissal).
77
+ */
78
+ export function kindDeclaresAnything(kind) {
79
+ return Object.values(DECLARES).some((declares) => declares(kind));
80
+ }
81
+ /** `"Context Note"` -> `"context-note"` — the same slug shape the builtin conventions use. */
82
+ export function conventionSlugForType(type) {
83
+ const slug = type
84
+ .trim()
85
+ .toLowerCase()
86
+ .replace(/[^a-z0-9]+/g, "-")
87
+ .replace(/^-|-$/g, "");
88
+ return slug === "" ? "kind" : slug;
89
+ }
90
+ function sortedRecord(entries) {
91
+ return Object.fromEntries([...entries].sort(([a], [b]) => a.localeCompare(b)));
92
+ }
93
+ /** Fold `instances` into the presence stats. Presence is core's `isPresent`, never key existence. */
94
+ export function collectInstanceStats(instances) {
95
+ const keys = new Map();
96
+ const headings = new Map();
97
+ for (const doc of instances) {
98
+ for (const [key, value] of Object.entries(doc.frontmatter)) {
99
+ if (!isPresent(value))
100
+ continue;
101
+ keys.set(key, (keys.get(key) ?? 0) + 1);
102
+ }
103
+ for (const heading of Object.keys(splitSections(doc.body))) {
104
+ headings.set(heading, (headings.get(heading) ?? 0) + 1);
105
+ }
106
+ }
107
+ return {
108
+ count: instances.length,
109
+ keyPresence: sortedRecord(keys),
110
+ headingPresence: sortedRecord(headings),
111
+ };
112
+ }
113
+ /** True when every observed value for `key` across `instances` is a scalar string. */
114
+ function everyValueScalarString(instances, key) {
115
+ for (const doc of instances) {
116
+ const value = doc.frontmatter[key];
117
+ if (value === undefined || value === null)
118
+ continue;
119
+ if (typeof value !== "string")
120
+ return false;
121
+ }
122
+ return true;
123
+ }
124
+ /** Distinct observed (string) values for `key`, in first-seen order. */
125
+ function distinctValues(instances, key) {
126
+ const seen = new Set();
127
+ for (const doc of instances) {
128
+ const value = doc.frontmatter[key];
129
+ if (typeof value === "string" && value.trim() !== "")
130
+ seen.add(value);
131
+ }
132
+ return [...seen];
133
+ }
134
+ /**
135
+ * Infer the candidate convention for `type` from its instances:
136
+ * - required = keys `isPresent` on 100% of instances (minus reserved + attribution)
137
+ * - optional = every other key `isPresent` on >=1 instance
138
+ * - values = only at 100% presence, >= {@link ENUM_MIN_INSTANCES} instances, 2-6 distinct
139
+ * values, every observed value a scalar string
140
+ * - sections = H1 headings on 100% of instances (H1-only: core's ONE heading splitter)
141
+ * - path = the common leading id segment, only when ALL instances share exactly one — a
142
+ * split (`plans/` + `designs/`) is the finding; silently blessing one prefix
143
+ * would orphan the rest, so no `path` is proposed there
144
+ */
145
+ export function inferKindCandidate(type, instances, stats = collectInstanceStats(instances), description = `Drafted from ${stats.count} existing instances.`) {
146
+ const count = stats.count;
147
+ const required = [];
148
+ const optional = [];
149
+ const values = {};
150
+ for (const [key, present] of Object.entries(stats.keyPresence)) {
151
+ if (excludedInferenceField(key))
152
+ continue;
153
+ if (present === count && count > 0) {
154
+ required.push(key);
155
+ if (count >= ENUM_MIN_INSTANCES && everyValueScalarString(instances, key)) {
156
+ const distinct = distinctValues(instances, key);
157
+ if (distinct.length >= ENUM_MIN_DISTINCT && distinct.length <= ENUM_MAX_DISTINCT) {
158
+ values[key] = distinct.sort((a, b) => a.localeCompare(b));
159
+ }
160
+ }
161
+ }
162
+ else {
163
+ optional.push(key);
164
+ }
165
+ }
166
+ const sections = Object.entries(stats.headingPresence)
167
+ .filter(([, present]) => present === count && count > 0)
168
+ .map(([heading]) => heading);
169
+ const prefixes = new Set();
170
+ let allPrefixed = instances.length > 0;
171
+ for (const doc of instances) {
172
+ const slash = doc.id.indexOf("/");
173
+ if (slash <= 0) {
174
+ allPrefixed = false;
175
+ break;
176
+ }
177
+ prefixes.add(doc.id.slice(0, slash));
178
+ }
179
+ const path = allPrefixed && prefixes.size === 1 ? `${[...prefixes][0]}/` : undefined;
180
+ return {
181
+ id: `conventions/${conventionSlugForType(type)}`,
182
+ title: type,
183
+ governs: type,
184
+ description,
185
+ ...(path === undefined ? {} : { path }),
186
+ fields: { required, optional, values, terminal: {}, descriptions: {} },
187
+ ...(sections.length > 0 ? { sections } : {}),
188
+ };
189
+ }
190
+ /**
191
+ * Price the candidate promotions: every sub-100% optional field, plus every H1 heading at or
192
+ * above {@link SECTION_PROMOTION_FLOOR} but below 100%. `warnings_if_added` is exactly the
193
+ * instances the added declaration would newly warn on.
194
+ */
195
+ export function draftPromotions(kind, stats) {
196
+ const rows = [];
197
+ for (const key of kind.fields.optional) {
198
+ const present = stats.keyPresence[key] ?? 0;
199
+ rows.push({
200
+ declaration: `field ${key} (optional -> required)`,
201
+ present: `${present}/${stats.count}`,
202
+ warnings_if_added: stats.count - present,
203
+ });
204
+ }
205
+ for (const [heading, present] of Object.entries(stats.headingPresence)) {
206
+ if (present === stats.count)
207
+ continue; // already in the draft
208
+ if (present / stats.count < SECTION_PROMOTION_FLOOR)
209
+ continue;
210
+ rows.push({
211
+ declaration: `section "# ${heading}"`,
212
+ present: `${present}/${stats.count}`,
213
+ warnings_if_added: stats.count - present,
214
+ });
215
+ }
216
+ rows.sort((a, b) => a.warnings_if_added - b.warnings_if_added || a.declaration.localeCompare(b.declaration));
217
+ return rows;
218
+ }
219
+ /**
220
+ * The MEASURED post-apply warning count: run core's validator over every instance against the
221
+ * candidate and sum the violations. Zero by construction for an inferred candidate (see module
222
+ * comment); the true — possibly large — number for an adopted catalog candidate. Never assumed.
223
+ */
224
+ export function warningsAfterApply(kind, instances) {
225
+ let total = 0;
226
+ for (const doc of instances)
227
+ total += validateAgainstKind(doc, kind).length;
228
+ return total;
229
+ }
230
+ /**
231
+ * The state-bound plan token `--apply` must present: sha256 of the canonical JSON of everything
232
+ * the human inspected — the exact candidate document, the bundle edition, and the instance stats
233
+ * it was inferred from. Any change to WHAT THE TOKEN BINDS between draft and apply refuses:
234
+ * a presence-stat change (new/removed instances, a key appearing or emptying), an edition
235
+ * change, or a candidate difference. It ALSO binds the measured warning count, because that count
236
+ * is what the human accepted: an instance edit that changes the forecast (a value leaving a
237
+ * declared enum) must not apply under a token issued against a different number. An edit changing
238
+ * neither the candidate, the presence stats, nor the warning count keeps the token valid — the
239
+ * written bytes are identical either way.
240
+ */
241
+ export function draftPlanToken(input) {
242
+ return `sha256:${sha256HexOfUtf8(JSON.stringify(input))}`;
243
+ }
244
+ import { CONVENTION_TYPE, parseConventionDoc } from "./kinds.js";
245
+ import { loadKinds } from "./kinds-load.js";
246
+ import { query, readBundleOkfVersion } from "./bundle-ops.js";
247
+ import { builtinNames, resolveBuiltinSync } from "./builtin-recipes.js";
248
+ import { materializeRecipeForEdition } from "./recipe-lifecycle/install.js";
249
+ import { droppedLinks } from "./body-replace-guards.js";
250
+ import { mutateDocument } from "./document-mutation.js";
251
+ /** Adapters render recovery commands from these typed facts, never from parsed prose. */
252
+ export class KindAuthoringError extends Error {
253
+ reason;
254
+ type;
255
+ details;
256
+ constructor(reason, type, details = {}) {
257
+ super(`Kind authoring for '${type}' refused: ${reason}.`);
258
+ this.name = "KindAuthoringError";
259
+ this.reason = reason;
260
+ this.type = type;
261
+ this.details = details;
262
+ }
263
+ }
264
+ /** The builtin convention governing `type`, materialized for this bundle's edition, if any. */
265
+ function catalogConventionForType(type, okfVersion) {
266
+ for (const name of builtinNames()) {
267
+ const recipe = resolveBuiltinSync(name);
268
+ if (!recipe.governs.includes(type))
269
+ continue;
270
+ const materialized = materializeRecipeForEdition(recipe, okfVersion);
271
+ const doc = materialized.docs.find((d) => {
272
+ const governs = d.frontmatter.governs;
273
+ return typeof governs === "string" && governs.trim() === type;
274
+ });
275
+ if (!doc)
276
+ continue;
277
+ const parsed = parseConventionDoc(doc);
278
+ if (!parsed.ok)
279
+ continue;
280
+ return {
281
+ recipeId: recipe.id,
282
+ doc,
283
+ kind: parsed.kind,
284
+ siblings: recipe.governs.filter((governs) => governs !== type),
285
+ };
286
+ }
287
+ return undefined;
288
+ }
289
+ /** Candidate frontmatter WITHOUT a timestamp — the engine stamps one at write time. */
290
+ function candidateDocFor(kind, body) {
291
+ const fields = {};
292
+ if (kind.fields.required.length > 0)
293
+ fields.required = kind.fields.required;
294
+ if (kind.fields.optional.length > 0)
295
+ fields.optional = kind.fields.optional;
296
+ if (Object.keys(kind.fields.values).length > 0)
297
+ fields.values = kind.fields.values;
298
+ const frontmatter = {
299
+ type: CONVENTION_TYPE,
300
+ title: kind.title,
301
+ governs: kind.governs,
302
+ };
303
+ if (kind.description !== undefined)
304
+ frontmatter.description = kind.description;
305
+ if (kind.path !== undefined)
306
+ frontmatter.path = kind.path;
307
+ if (Object.keys(fields).length > 0)
308
+ frontmatter.fields = fields;
309
+ if (kind.sections !== undefined && kind.sections.length > 0)
310
+ frontmatter.sections = kind.sections;
311
+ return { id: kind.id, frontmatter, body };
312
+ }
313
+ /** Match convention parsing: type names are trimmed strings with nonempty content. */
314
+ function normalizeKindAuthoringType(type) {
315
+ const normalized = typeof type === "string" ? type.trim() : "";
316
+ if (!isPresent(normalized))
317
+ throw new InvalidInputError("Kind authoring requires a nonempty type name.");
318
+ return normalized;
319
+ }
320
+ /** Build the whole read-only plan: registry + instances -> candidate + forecast + token. */
321
+ export async function prepareKindDraft(bundle, type, text = {}) {
322
+ type = normalizeKindAuthoringType(type);
323
+ const [registry, okfVersionRead] = await Promise.all([loadKinds(bundle), readBundleOkfVersion(bundle)]);
324
+ const okfVersion = okfVersionRead ?? "0.1";
325
+ const existing = registry.kinds.get(type);
326
+ if (existing && kindDeclaresAnything(existing)) {
327
+ throw new KindAuthoringError("already-governed", type, { id: existing.id });
328
+ }
329
+ const instances = (await query(bundle, { type })).sort((a, b) => a.id.localeCompare(b.id));
330
+ if (instances.length === 0) {
331
+ throw new KindAuthoringError("no-instances", type);
332
+ }
333
+ const stats = collectInstanceStats(instances);
334
+ const catalog = catalogConventionForType(type, okfVersion);
335
+ let candidateKind;
336
+ let candidateDoc;
337
+ if (catalog) {
338
+ // Adopt the builtin definition VERBATIM — the recipe's schema is better than an inference,
339
+ // and landing it at its canonical id keeps the recipes surface consistent. The forecast
340
+ // below then reports the REAL (possibly large) warning count against existing instances —
341
+ // the priced route `recipe add` cannot offer when instances already exist.
342
+ candidateKind = catalog.kind;
343
+ const { timestamp: _timestamp, ...frontmatter } = catalog.doc.frontmatter;
344
+ candidateDoc = { id: catalog.doc.id, frontmatter, body: catalog.doc.body };
345
+ }
346
+ else {
347
+ candidateKind = inferKindCandidate(type, instances, stats, text.inferredDescription?.(type, stats.count));
348
+ candidateDoc = candidateDocFor(candidateKind, text.inferredBody?.(type, stats.count) ?? `Drafted from ${stats.count} existing '${type}' instances.\n`);
349
+ }
350
+ // A redraft upgrades the EXISTING governing record in place, wherever it lives — a
351
+ // hand-authored governs-only convention at a non-canonical id keeps its id (never two
352
+ // conventions for one kind; the slug id is only for true creates).
353
+ if (existing)
354
+ candidateDoc = { ...candidateDoc, id: existing.id };
355
+ const warnings = warningsAfterApply(candidateKind, instances);
356
+ const token = draftPlanToken({ target: candidateDoc.id, candidate: candidateDoc, okfVersion, stats, warnings });
357
+ return {
358
+ type,
359
+ okfVersion,
360
+ registry,
361
+ redraftOver: existing,
362
+ candidateDoc,
363
+ candidateKind,
364
+ catalog,
365
+ stats,
366
+ instances,
367
+ warnings,
368
+ token,
369
+ };
370
+ }
371
+ /** The one guarded mutation specification used by public apply and presentation adapters. */
372
+ export function prepareKindDraftMutation(bundle, plan, expectedToken, options = {}) {
373
+ const expected = expectedToken.trim();
374
+ if (plan.token !== expected)
375
+ throw new KindAuthoringError("plan-changed", plan.type, { expected, current: plan.token });
376
+ const prepared = {
377
+ droppedLinks: [],
378
+ options: {
379
+ seedGenerationClock: false, bundle, id: plan.candidateDoc.id,
380
+ mode: plan.redraftOver ? "replace-document" : "create-only",
381
+ registry: plan.registry, strict: false, actor: options.actor, now: options.now,
382
+ // An accepted redraft replaces the decline prose; report any removed links explicitly.
383
+ bodyReplace: { replaceLinks: true },
384
+ buildCandidate: (existing, context) => {
385
+ if (context.okfVersion !== plan.okfVersion)
386
+ throw new KindAuthoringError("edition-changed", plan.type);
387
+ if (plan.redraftOver) {
388
+ const parsed = existing && parseConventionDoc(existing);
389
+ if (!parsed || !parsed.ok || parsed.kind.governs !== plan.type || kindDeclaresAnything(parsed.kind)) {
390
+ throw new KindAuthoringError("redraft-changed", plan.type, { id: plan.redraftOver.id });
391
+ }
392
+ }
393
+ prepared.droppedLinks = existing ? droppedLinks(bundle, existing, plan.candidateDoc.body) : [];
394
+ return { frontmatter: structuredClone(plan.candidateDoc.frontmatter), body: plan.candidateDoc.body };
395
+ },
396
+ },
397
+ };
398
+ return prepared;
399
+ }
400
+ export async function appliedKindDraftWarnings(bundle, plan) {
401
+ const applied = (await loadKinds(bundle)).kinds.get(plan.type);
402
+ return applied ? warningsAfterApply(applied, plan.instances) : plan.warnings;
403
+ }
404
+ /** Recompute what was inspected before applying; callers never reproduce the stale-plan checks. */
405
+ export async function applyKindDraft(bundle, type, expectedToken, options = {}) {
406
+ const plan = await prepareKindDraft(bundle, type, options);
407
+ const prepared = prepareKindDraftMutation(bundle, plan, expectedToken, options);
408
+ const result = await mutateDocument(prepared.options);
409
+ return { ...result, droppedLinks: prepared.droppedLinks, warningsAfterApply: await appliedKindDraftWarnings(bundle, plan) };
410
+ }
411
+ export async function prepareKindDismissal(bundle, type, options = {}) {
412
+ type = normalizeKindAuthoringType(type);
413
+ const [registry, edition] = await Promise.all([loadKinds(bundle), readBundleOkfVersion(bundle)]);
414
+ const existing = registry.kinds.get(type);
415
+ if (existing && kindDeclaresAnything(existing))
416
+ throw new KindAuthoringError("dismiss-governed", type, { id: existing.id });
417
+ if (existing)
418
+ return { id: existing.id };
419
+ const id = `conventions/${conventionSlugForType(type)}`;
420
+ const catalog = catalogConventionForType(type, edition ?? "0.1");
421
+ return {
422
+ id, catalog,
423
+ options: {
424
+ seedGenerationClock: false, bundle, id, mode: "create-only", registry, strict: false,
425
+ actor: options.actor, now: options.now,
426
+ buildCandidate: () => ({
427
+ frontmatter: { type: CONVENTION_TYPE, title: type, governs: type,
428
+ description: options.description ?? `Declined: '${type}' is deliberately unconstrained.` },
429
+ body: options.body?.(type, catalog) ?? `A Kind for '${type}' was deliberately declined.\n`,
430
+ }),
431
+ },
432
+ };
433
+ }
434
+ export async function dismissKind(bundle, type, options = {}) {
435
+ const prepared = await prepareKindDismissal(bundle, type, options);
436
+ if (!prepared.options)
437
+ return { id: prepared.id, changed: false };
438
+ const result = await mutateDocument(prepared.options);
439
+ return { id: prepared.id, changed: result.changed, result, catalog: prepared.catalog };
440
+ }
441
+ /** Typed values are already authored by the caller; existing core validation owns their meaning.
442
+ * Undefined body scaffolds headings, while an explicit empty body remains deliberately empty. */
443
+ export function kindInstanceCandidate(kind, fields, body) {
444
+ const frontmatter = { type: kind.governs };
445
+ for (const [field, value] of Object.entries(fields)) {
446
+ if (field !== "type")
447
+ Object.defineProperty(frontmatter, field, { value, writable: true, enumerable: true, configurable: true });
448
+ }
449
+ return { frontmatter, body: body ?? (kind.sections ?? []).map(heading => `# ${heading}\n`).join("\n") };
450
+ }
451
+ //# sourceMappingURL=kind-authoring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kind-authoring.js","sourceRoot":"","sources":["../src/kind-authoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAEhF,8FAA8F;AAC9F,8FAA8F;AAC9F,iGAAiG;AACjG,EAAE;AACF,2FAA2F;AAC3F,4FAA4F;AAC5F,uFAAuF;AACvF,yFAAyF;AACzF,2FAA2F;AAC3F,gFAAgF;AAChF,uFAAuF;AACvF,OAAO,EAAE,eAAe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C;AAED;iGACiG;AACjG,MAAM,UAAU,qBAAqB,CAAC,IAAoB,EAAE,MAA+B,EAAE,IAAa;IACxG,MAAM,WAAW,GAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;IACxD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACpD,IAAI,KAAK,KAAK,MAAM;YAAE,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IACnI,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1G,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { InvalidInputError } from "./errors.js";
2
+ import type { ValidationWarning } from "./content-type.js";
3
+ import type { ConceptId } from "./types.js";
4
+ /**
5
+ * Typed strict-kind rejection for trusted consumers to translate at their own boundary. Its own
6
+ * module so field actions can refuse with it without importing the mutation service.
7
+ */
8
+ export declare class KindConformanceError extends InvalidInputError {
9
+ readonly id: ConceptId;
10
+ readonly governs: string;
11
+ readonly violations: ValidationWarning[];
12
+ readonly okfVersion?: "0.1" | "0.2";
13
+ constructor(id: ConceptId, governs: string, violations: ValidationWarning[], okfVersion?: "0.1" | "0.2");
14
+ }
15
+ //# sourceMappingURL=kind-conformance-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kind-conformance-error.d.ts","sourceRoot":"","sources":["../src/kind-conformance-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;IACzD,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC;IACzC,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;gBAGlC,EAAE,EAAE,SAAS,EACb,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,iBAAiB,EAAE,EAC/B,UAAU,CAAC,EAAE,KAAK,GAAG,KAAK;CAS7B"}
@@ -0,0 +1,20 @@
1
+ import { InvalidInputError } from "./errors.js";
2
+ /**
3
+ * Typed strict-kind rejection for trusted consumers to translate at their own boundary. Its own
4
+ * module so field actions can refuse with it without importing the mutation service.
5
+ */
6
+ export class KindConformanceError extends InvalidInputError {
7
+ id;
8
+ governs;
9
+ violations;
10
+ okfVersion;
11
+ constructor(id, governs, violations, okfVersion) {
12
+ super(`'${id}' does not satisfy the '${governs}' kind: ${violations.map((warning) => warning.message).join("; ")}`);
13
+ this.name = "KindConformanceError";
14
+ this.id = id;
15
+ this.governs = governs;
16
+ this.violations = violations;
17
+ this.okfVersion = okfVersion;
18
+ }
19
+ }
20
+ //# sourceMappingURL=kind-conformance-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kind-conformance-error.js","sourceRoot":"","sources":["../src/kind-conformance-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIhD;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,iBAAiB;IAChD,EAAE,CAAY;IACd,OAAO,CAAS;IAChB,UAAU,CAAsB;IAChC,UAAU,CAAiB;IAEpC,YACE,EAAa,EACb,OAAe,EACf,UAA+B,EAC/B,UAA0B;QAE1B,KAAK,CAAC,IAAI,EAAE,2BAA2B,OAAO,WAAW,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpH,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF"}
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * The backend-touching half of the kind-convention registry: {@link loadKinds}
3
3
  * queries a bundle's `conventions/` prefix and builds the registry out of `kinds.ts`'s pure
4
- * parsing/derivation. Split from `kinds.ts` ONLY by dependency weight — `kinds.ts` is the
5
- * browser-safe `@superbee/core/kinds` subpath (browser-safe value imports), while this module may
6
- * pull the engine (`query` -> backends -> node built-ins). One registry, two entry weights.
4
+ * parsing/derivation. Split from `kinds.ts` by what it reads: `kinds.ts` is pure, while this module
5
+ * reads a bundle through `bundle-ops.ts`'s runtime-neutral delegation, never the Node entry, so it
6
+ * stays browser-safe (`@superbee/core/bundle-health` runs it in any runtime). One registry.
7
7
  */
8
8
  import { MalformedDocumentError } from "./frontmatter-contract.js";
9
- import { query, readBundleOkfVersion } from "./bundle.js";
9
+ import { query, readBundleOkfVersion } from "./bundle-ops.js";
10
10
  import { CONVENTIONS_PREFIX, CONVENTION_TYPE, buildKindRegistry, } from "./kinds.js";
11
11
  /**
12
12
  * Build the {@link KindRegistry} for `bundle`: every `Convention` doc under
@@ -1 +1 @@
1
- {"version":3,"file":"kinds-load.js","sourceRoot":"","sources":["../src/kinds-load.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,O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BAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAKpB;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAc;IAC5C,MAAM,QAAQ,GAAwB,EAAE,CAAC;IAEzC,8FAA8F;IAC9F,8FAA8F;IAC9F,+FAA+F;IAC/F,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE;QACtF,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CACzB,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,2BAA2B;YACjC,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,MAAM,EAAE;YAClF,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,SAAS;SACpB,CAAC;KACL,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC7E,sFAAsF;QACtF,qFAAqF;QACrF,IAAI,CAAC,CAAC,KAAK,YAAY,sBAAsB,CAAC;YAAE,MAAM,KAAK,CAAC;QAC5D,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;AAC3D,CAAC"}
package/dist/kinds.d.ts CHANGED
@@ -251,6 +251,8 @@ export declare const KIND_FIELD_TYPE_DESCRIPTIONS: Readonly<Record<KindFieldType
251
251
  * callers never re-implement it.
252
252
  */
253
253
  export declare function kindFieldTypeProblem(type: KindFieldType, value: unknown): string | undefined;
254
+ /** Whether a Kind declares `field` (a storage name) as one of the two list types, `string-list` or `https-url-list`. */
255
+ export declare function isKindListField(kind: Pick<KindConvention, "fields"> | undefined, field: string): boolean;
254
256
  /**
255
257
  * Convert command-line flag text for a declared field into its typed value: numeric types become
256
258
  * numbers, `boolean` accepts exactly `true`/`false`, and both list types are always a list. Text that
@@ -1 +1 @@
1
- {"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../src/kinds.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtE,yFAAyF;AACzF,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,iEAAiE;AACjE,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,uFAAuF;AACvF,MAAM,WAAW,UAAU;IACzB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACjC,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,sEAAsE;IACtE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACvC;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,8IAYnB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CA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AQ,CAAC,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAIxG;AAKD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAiB3G;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,GAAG,iBAAiB,EAAE,CAoF/F;AAED,uFAAuF;AACvF,MAAM,WAAW,wBAAwB;IACvC,iFAAiF;IACjF,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,0CAA0C,CACxD,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,YAAY,EACtB,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAO,GACxD,wBAAwB,CAW1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAUlF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,CAuErG"}
package/dist/kinds.js CHANGED
@@ -20,8 +20,9 @@
20
20
  * convention-doc (de)serialization) is dependency-free — this module carries ONLY that, and is
21
21
  * exported as the browser-safe `@superbee/core/kinds` subpath (the ui shell's bridge
22
22
  * `open` filter consumes `isTerminal` there; a browser bundler must never be dragged through the
23
- * engine's node built-ins for a pure predicate). The one backend-touching entry point,
24
- * `loadKinds`, lives in `kinds-load.ts` — same ONE registry, split only by dependency weight.
23
+ * engine's node built-ins for a pure predicate). The bundle read, `loadKinds`, lives in
24
+ * `kinds-load.ts`, which reads through `bundle-ops.ts` and is browser-safe too: the split is
25
+ * between pure parsing and the bundle read, over the same ONE registry.
25
26
  */
26
27
  import { isOkfLifecycleStatus, OKF_LIFECYCLE_STATUSES } from "./okf-lifecycle.js";
27
28
  import { isUsableTimestamp } from "./frontmatter.js";
@@ -1086,6 +1087,13 @@ export function kindFieldTypeProblem(type, value) {
1086
1087
  }
1087
1088
  }
1088
1089
  }
1090
+ /** Whether a Kind declares `field` (a storage name) as one of the two list types, `string-list` or `https-url-list`. */
1091
+ export function isKindListField(kind, field) {
1092
+ const types = kind?.fields.types;
1093
+ if (!types || !hasOwn(types, field))
1094
+ return false;
1095
+ return types[field] === "string-list" || types[field] === "https-url-list";
1096
+ }
1089
1097
  const NUMBER_INPUT_RE = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
1090
1098
  const INTEGER_INPUT_RE = /^[+-]?\d+$/;
1091
1099
  /**