@indigoai-us/hq-cli 5.345.247 → 5.345.248

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 (239) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/assets/lanes-hooks/hq-lanes-drain.sh +1 -1
  3. package/contracts/host-canary-release.json +14 -0
  4. package/dist/command-catalog.generated.d.ts +1113 -0
  5. package/dist/command-catalog.generated.js +1370 -0
  6. package/dist/command-registration-plan.d.ts +6 -0
  7. package/dist/command-registration-plan.js +1 -0
  8. package/dist/commands/lanes-hold.js +7 -7
  9. package/dist/commands/lanes-resume.js +2 -2
  10. package/dist/commands/lanes-review.js +1 -1
  11. package/dist/commands/lanes-session-start.d.ts +1 -1
  12. package/dist/commands/lanes-session-start.js +3 -3
  13. package/dist/commands/lanes-shared.d.ts +1 -1
  14. package/dist/commands/lanes.d.ts +2 -2
  15. package/dist/commands/lanes.js +50 -50
  16. package/dist/commands/mesh.d.ts +25 -0
  17. package/dist/commands/mesh.js +48 -8
  18. package/dist/commands/ontology-graph.d.ts +62 -0
  19. package/dist/commands/ontology-graph.js +439 -0
  20. package/dist/index.js +1 -1
  21. package/dist/lanes-monitor-check-argv.d.ts +1 -1
  22. package/dist/lanes-monitor-check-argv.js +1 -1
  23. package/dist/lanes-monitor-check-fast.d.ts +1 -1
  24. package/dist/lanes-monitor-check-fast.js +1 -1
  25. package/dist/lanes-session-start-argv.d.ts +1 -1
  26. package/dist/lanes-session-start-argv.js +1 -1
  27. package/dist/lib/capacity/sign-in.d.ts +1 -1
  28. package/dist/lib/capacity/sign-in.js +1 -1
  29. package/dist/lib/daemon/hook-requests-conduct-link.js +2 -2
  30. package/dist/lib/daemon/lanes-monitor-state.d.ts +2 -2
  31. package/dist/lib/daemon/lanes-monitor-state.js +2 -2
  32. package/dist/lib/daemon/merge-sections.d.ts +3 -3
  33. package/dist/lib/daemon/merge-sections.js +7 -7
  34. package/dist/lib/daemon/remote-control-pools.js +1 -1
  35. package/dist/lib/daemon/run.js +1 -1
  36. package/dist/lib/daemon/state-file.d.ts +1 -1
  37. package/dist/lib/daemon/state-file.js +1 -1
  38. package/dist/lib/flag-snapshot-file.d.ts +2 -0
  39. package/dist/lib/flag-snapshot-file.js +118 -48
  40. package/dist/lib/hook-engine/canary-gate.d.ts +57 -3
  41. package/dist/lib/hook-engine/canary-gate.js +138 -6
  42. package/dist/lib/hot-channels/graph-context.d.ts +105 -0
  43. package/dist/lib/hot-channels/graph-context.js +377 -0
  44. package/dist/lib/hot-channels/signals-pass.js +27 -1
  45. package/dist/lib/lanes/claude-credential.d.ts +1 -1
  46. package/dist/lib/lanes/claude-credential.js +1 -1
  47. package/dist/lib/lanes/delivery-core.d.ts +1 -1
  48. package/dist/lib/lanes/delivery-core.js +1 -1
  49. package/dist/lib/lanes/delivery.d.ts +10 -10
  50. package/dist/lib/lanes/delivery.js +8 -8
  51. package/dist/lib/lanes/dropbox.d.ts +1 -1
  52. package/dist/lib/lanes/dropbox.js +1 -1
  53. package/dist/lib/lanes/hooks-install.js +2 -2
  54. package/dist/lib/lanes/index.d.ts +1 -1
  55. package/dist/lib/lanes/index.js +1 -1
  56. package/dist/lib/lanes/monitor.js +1 -1
  57. package/dist/lib/lanes/quota-notice.js +1 -1
  58. package/dist/lib/lanes/quota.d.ts +1 -1
  59. package/dist/lib/lanes/quota.js +1 -1
  60. package/dist/lib/lanes/repo-merge-hold.d.ts +2 -2
  61. package/dist/lib/lanes/repo-merge-hold.js +2 -2
  62. package/dist/lib/lanes/spawn.d.ts +4 -4
  63. package/dist/lib/lanes/spawn.js +5 -5
  64. package/dist/lib/mesh/live/company-flag-refresh.d.ts +61 -0
  65. package/dist/lib/mesh/live/company-flag-refresh.js +159 -0
  66. package/dist/lib/mesh/live/company-reporting-gaps.d.ts +61 -0
  67. package/dist/lib/mesh/live/company-reporting-gaps.js +238 -0
  68. package/dist/lib/mesh/live/daemon/duplicate-unit.d.ts +156 -0
  69. package/dist/lib/mesh/live/daemon/duplicate-unit.js +616 -0
  70. package/dist/lib/mesh/live/daemon/run.d.ts +13 -0
  71. package/dist/lib/mesh/live/daemon/run.js +35 -2
  72. package/dist/lib/mesh/live/direct-drain.js +1 -1
  73. package/dist/lib/mesh/live/emit.d.ts +3 -0
  74. package/dist/lib/mesh/live/emit.js +32 -9
  75. package/dist/lib/mesh/live/flush.d.ts +3 -0
  76. package/dist/lib/mesh/live/flush.js +115 -32
  77. package/dist/lib/mesh/live/liveness-carry.d.ts +1 -1
  78. package/dist/lib/mesh/live/liveness-carry.js +1 -1
  79. package/dist/lib/mesh/live/reporting-privacy.d.ts +119 -3
  80. package/dist/lib/mesh/live/reporting-privacy.js +235 -11
  81. package/dist/lib/mesh/live/spool.d.ts +17 -2
  82. package/dist/lib/mesh/live/spool.js +22 -6
  83. package/dist/lib/ontology-graph/legacy/coverage.d.ts +67 -0
  84. package/dist/lib/ontology-graph/legacy/coverage.js +192 -0
  85. package/dist/lib/ontology-graph/legacy/index.d.ts +199 -0
  86. package/dist/lib/ontology-graph/legacy/index.js +1150 -0
  87. package/dist/lib/ontology-graph/legacy/parse.d.ts +49 -0
  88. package/dist/lib/ontology-graph/legacy/parse.js +126 -0
  89. package/dist/lib/ontology-graph/legacy/report.d.ts +14 -0
  90. package/dist/lib/ontology-graph/legacy/report.js +254 -0
  91. package/dist/lib/ontology-graph/legacy/verb-map.d.ts +35 -0
  92. package/dist/lib/ontology-graph/legacy/verb-map.js +84 -0
  93. package/dist/lib/ontology-graph/lint/checks.d.ts +140 -0
  94. package/dist/lib/ontology-graph/lint/checks.js +717 -0
  95. package/dist/lib/ontology-graph/lint/coverage.d.ts +106 -0
  96. package/dist/lib/ontology-graph/lint/coverage.js +241 -0
  97. package/dist/lib/ontology-graph/lint/daily-job.d.ts +259 -0
  98. package/dist/lib/ontology-graph/lint/daily-job.js +595 -0
  99. package/dist/lib/ontology-graph/lint/index.d.ts +65 -0
  100. package/dist/lib/ontology-graph/lint/index.js +176 -0
  101. package/dist/lib/ontology-graph/model/files.d.ts +20 -0
  102. package/dist/lib/ontology-graph/model/files.js +89 -0
  103. package/dist/lib/ontology-graph/model/index.d.ts +65 -0
  104. package/dist/lib/ontology-graph/model/index.js +100 -0
  105. package/dist/lib/ontology-graph/model/pass-tasks.d.ts +156 -0
  106. package/dist/lib/ontology-graph/model/pass-tasks.js +345 -0
  107. package/dist/lib/ontology-graph/model/pass.d.ts +109 -0
  108. package/dist/lib/ontology-graph/model/pass.js +958 -0
  109. package/dist/lib/ontology-graph/model/runner.d.ts +50 -0
  110. package/dist/lib/ontology-graph/model/runner.js +160 -0
  111. package/dist/lib/ontology-graph/model/step.d.ts +195 -0
  112. package/dist/lib/ontology-graph/model/step.js +523 -0
  113. package/dist/lib/ontology-graph/model/tasks.d.ts +183 -0
  114. package/dist/lib/ontology-graph/model/tasks.js +349 -0
  115. package/dist/lib/ontology-graph/not-implemented.d.ts +5 -0
  116. package/dist/lib/ontology-graph/not-implemented.js +8 -0
  117. package/dist/lib/ontology-graph/org/compare.d.ts +28 -0
  118. package/dist/lib/ontology-graph/org/compare.js +239 -0
  119. package/dist/lib/ontology-graph/org/derive.d.ts +65 -0
  120. package/dist/lib/ontology-graph/org/derive.js +352 -0
  121. package/dist/lib/ontology-graph/org/index.d.ts +73 -0
  122. package/dist/lib/ontology-graph/org/index.js +513 -0
  123. package/dist/lib/ontology-graph/org/load.d.ts +31 -0
  124. package/dist/lib/ontology-graph/org/load.js +476 -0
  125. package/dist/lib/ontology-graph/org/role.d.ts +38 -0
  126. package/dist/lib/ontology-graph/org/role.js +268 -0
  127. package/dist/lib/ontology-graph/org/structure.d.ts +63 -0
  128. package/dist/lib/ontology-graph/org/structure.js +437 -0
  129. package/dist/lib/ontology-graph/org/text.d.ts +95 -0
  130. package/dist/lib/ontology-graph/org/text.js +315 -0
  131. package/dist/lib/ontology-graph/org/types.d.ts +452 -0
  132. package/dist/lib/ontology-graph/org/types.js +80 -0
  133. package/dist/lib/ontology-graph/pages/index.d.ts +64 -0
  134. package/dist/lib/ontology-graph/pages/index.js +193 -0
  135. package/dist/lib/ontology-graph/pages/render.d.ts +142 -0
  136. package/dist/lib/ontology-graph/pages/render.js +682 -0
  137. package/dist/lib/ontology-graph/proposals/apply.d.ts +109 -0
  138. package/dist/lib/ontology-graph/proposals/apply.js +468 -0
  139. package/dist/lib/ontology-graph/proposals/group.d.ts +63 -0
  140. package/dist/lib/ontology-graph/proposals/group.js +232 -0
  141. package/dist/lib/ontology-graph/proposals/index.d.ts +173 -0
  142. package/dist/lib/ontology-graph/proposals/index.js +474 -0
  143. package/dist/lib/ontology-graph/proposals/model.d.ts +162 -0
  144. package/dist/lib/ontology-graph/proposals/model.js +196 -0
  145. package/dist/lib/ontology-graph/proposals/org-chart.d.ts +82 -0
  146. package/dist/lib/ontology-graph/proposals/org-chart.js +340 -0
  147. package/dist/lib/ontology-graph/read/brief.d.ts +26 -0
  148. package/dist/lib/ontology-graph/read/brief.js +251 -0
  149. package/dist/lib/ontology-graph/read/graph-index.d.ts +76 -0
  150. package/dist/lib/ontology-graph/read/graph-index.js +198 -0
  151. package/dist/lib/ontology-graph/read/index.d.ts +59 -0
  152. package/dist/lib/ontology-graph/read/index.js +792 -0
  153. package/dist/lib/ontology-graph/read/member.d.ts +7 -0
  154. package/dist/lib/ontology-graph/read/member.js +34 -0
  155. package/dist/lib/ontology-graph/read/names.d.ts +44 -0
  156. package/dist/lib/ontology-graph/read/names.js +292 -0
  157. package/dist/lib/ontology-graph/read/reader-setting.d.ts +19 -0
  158. package/dist/lib/ontology-graph/read/reader-setting.js +62 -0
  159. package/dist/lib/ontology-graph/read/test-graph.d.ts +37 -0
  160. package/dist/lib/ontology-graph/read/test-graph.js +150 -0
  161. package/dist/lib/ontology-graph/replay/buffered-store.d.ts +33 -0
  162. package/dist/lib/ontology-graph/replay/buffered-store.js +50 -0
  163. package/dist/lib/ontology-graph/replay/config.d.ts +41 -0
  164. package/dist/lib/ontology-graph/replay/config.js +105 -0
  165. package/dist/lib/ontology-graph/replay/engine.d.ts +100 -0
  166. package/dist/lib/ontology-graph/replay/engine.js +1174 -0
  167. package/dist/lib/ontology-graph/replay/extractors.d.ts +59 -0
  168. package/dist/lib/ontology-graph/replay/extractors.js +1555 -0
  169. package/dist/lib/ontology-graph/replay/index.d.ts +90 -0
  170. package/dist/lib/ontology-graph/replay/index.js +220 -0
  171. package/dist/lib/ontology-graph/replay/listing-manifest.d.ts +66 -0
  172. package/dist/lib/ontology-graph/replay/listing-manifest.js +242 -0
  173. package/dist/lib/ontology-graph/replay/member.d.ts +19 -0
  174. package/dist/lib/ontology-graph/replay/member.js +65 -0
  175. package/dist/lib/ontology-graph/replay/mentions.d.ts +58 -0
  176. package/dist/lib/ontology-graph/replay/mentions.js +239 -0
  177. package/dist/lib/ontology-graph/replay/readers.d.ts +98 -0
  178. package/dist/lib/ontology-graph/replay/readers.js +1251 -0
  179. package/dist/lib/ontology-graph/replay/rules.d.ts +127 -0
  180. package/dist/lib/ontology-graph/replay/rules.js +374 -0
  181. package/dist/lib/ontology-graph/replay/scope.d.ts +35 -0
  182. package/dist/lib/ontology-graph/replay/scope.js +115 -0
  183. package/dist/lib/ontology-graph/replay/transcripts.d.ts +39 -0
  184. package/dist/lib/ontology-graph/replay/transcripts.js +224 -0
  185. package/dist/lib/ontology-graph/replay/util.d.ts +55 -0
  186. package/dist/lib/ontology-graph/replay/util.js +256 -0
  187. package/dist/lib/ontology-graph/resolve/entity-index.d.ts +159 -0
  188. package/dist/lib/ontology-graph/resolve/entity-index.js +652 -0
  189. package/dist/lib/ontology-graph/resolve/index.d.ts +113 -0
  190. package/dist/lib/ontology-graph/resolve/index.js +214 -0
  191. package/dist/lib/ontology-graph/resolve/machine.d.ts +34 -0
  192. package/dist/lib/ontology-graph/resolve/machine.js +95 -0
  193. package/dist/lib/ontology-graph/resolve/normalize.d.ts +35 -0
  194. package/dist/lib/ontology-graph/resolve/normalize.js +124 -0
  195. package/dist/lib/ontology-graph/resolve/org-chart.d.ts +107 -0
  196. package/dist/lib/ontology-graph/resolve/org-chart.js +578 -0
  197. package/dist/lib/ontology-graph/resolve/org-layer.d.ts +78 -0
  198. package/dist/lib/ontology-graph/resolve/org-layer.js +159 -0
  199. package/dist/lib/ontology-graph/resolve/org-seed.d.ts +141 -0
  200. package/dist/lib/ontology-graph/resolve/org-seed.js +631 -0
  201. package/dist/lib/ontology-graph/resolve/org-sources.d.ts +165 -0
  202. package/dist/lib/ontology-graph/resolve/org-sources.js +634 -0
  203. package/dist/lib/ontology-graph/resolve/roster.d.ts +76 -0
  204. package/dist/lib/ontology-graph/resolve/roster.js +226 -0
  205. package/dist/lib/ontology-graph/resolve/seed.d.ts +267 -0
  206. package/dist/lib/ontology-graph/resolve/seed.js +1198 -0
  207. package/dist/lib/ontology-graph/resolve/upsert.d.ts +58 -0
  208. package/dist/lib/ontology-graph/resolve/upsert.js +139 -0
  209. package/dist/lib/ontology-graph/resolve/writer.d.ts +128 -0
  210. package/dist/lib/ontology-graph/resolve/writer.js +351 -0
  211. package/dist/lib/ontology-graph/schema/authority.d.ts +73 -0
  212. package/dist/lib/ontology-graph/schema/authority.js +157 -0
  213. package/dist/lib/ontology-graph/schema/default-schema.d.ts +10 -0
  214. package/dist/lib/ontology-graph/schema/default-schema.js +242 -0
  215. package/dist/lib/ontology-graph/schema/grammar.d.ts +57 -0
  216. package/dist/lib/ontology-graph/schema/grammar.js +409 -0
  217. package/dist/lib/ontology-graph/schema/index.d.ts +12 -0
  218. package/dist/lib/ontology-graph/schema/index.js +10 -0
  219. package/dist/lib/ontology-graph/schema/validate.d.ts +13 -0
  220. package/dist/lib/ontology-graph/schema/validate.js +132 -0
  221. package/dist/lib/ontology-graph/store/files.d.ts +34 -0
  222. package/dist/lib/ontology-graph/store/files.js +207 -0
  223. package/dist/lib/ontology-graph/store/fs.d.ts +30 -0
  224. package/dist/lib/ontology-graph/store/fs.js +101 -0
  225. package/dist/lib/ontology-graph/store/graph-store.d.ts +14 -0
  226. package/dist/lib/ontology-graph/store/graph-store.js +520 -0
  227. package/dist/lib/ontology-graph/store/index.d.ts +18 -0
  228. package/dist/lib/ontology-graph/store/index.js +15 -0
  229. package/dist/lib/ontology-graph/store/ingest.d.ts +37 -0
  230. package/dist/lib/ontology-graph/store/ingest.js +323 -0
  231. package/dist/lib/ontology-graph/store/paths.d.ts +114 -0
  232. package/dist/lib/ontology-graph/store/paths.js +232 -0
  233. package/dist/lib/ontology-graph/types.d.ts +1183 -0
  234. package/dist/lib/ontology-graph/types.js +131 -0
  235. package/dist/lib/secret-scan/gitleaks-rules.generated.js +1 -1
  236. package/dist/utils/frontmatter.d.ts +14 -0
  237. package/dist/utils/frontmatter.js +18 -0
  238. package/dist/utils/interactive-caller.js +1 -1
  239. package/package.json +8 -8
@@ -0,0 +1,409 @@
1
+ /**
2
+ * Row grammar (design section 1). One row per line in a `facts/@{key}/` file.
3
+ * Fields are separated by ` | `, in a fixed order:
4
+ *
5
+ * - F <field> = <value> | valid <from>..<to> | src <ref> | learned <date> | by <origin> | conf <0-1>
6
+ * - E <verb> -> <type>/<slug> | valid <from>..<to> | src <ref> | learned <date> | by <origin> | conf <0-1>
7
+ * - T <date> | <signal type> | <one line> | src <ref>
8
+ *
9
+ * An E row may carry ` | was "<label>"` after `conf`. A closed F or E row ends
10
+ * with ` | closed <date> by <ref>`.
11
+ *
12
+ * Free text (a fact value, a timeline line, a `was` label, a ref) is escaped
13
+ * so it can never contain a field separator or a line break: `\` becomes `\\`,
14
+ * `|` becomes `\|`, a line feed becomes `\n`, a carriage return becomes `\r`.
15
+ *
16
+ * `formatRow` and `parseRow` are exact inverses for every valid row. This file
17
+ * checks shape only; whether a field or verb is allowed is `validateRow`.
18
+ */
19
+ import { createHash } from "node:crypto";
20
+ import { GRAPH_ENTITY_TYPES, ORIGIN_KINDS, ORIGIN_TIER, SOURCE_REF_KINDS, } from "../types.js";
21
+ export class RowGrammarError extends Error {
22
+ code;
23
+ constructor(code, message) {
24
+ super(message);
25
+ this.name = "RowGrammarError";
26
+ this.code = code;
27
+ }
28
+ }
29
+ const ISO_DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
30
+ const SLUG_RE = /^[a-z0-9][a-z0-9._-]*$/;
31
+ const TOKEN_RE = /^[a-z][a-z0-9_]*$/;
32
+ const SIGNAL_TYPE_RE = /^[a-z][a-z0-9_-]*$/;
33
+ /** `local` is the member-only audience of sources that carry no audience key (correction C7). */
34
+ const AUDIENCE_RE = /^(company|local|[0-9a-f]{16})$/;
35
+ const SEPARATOR = " | ";
36
+ // ---------------------------------------------------------------------------
37
+ // Primitives
38
+ // ---------------------------------------------------------------------------
39
+ /** True for a real calendar day written `YYYY-MM-DD`. */
40
+ export function isIsoDate(value) {
41
+ if (typeof value !== "string")
42
+ return false;
43
+ const match = ISO_DATE_RE.exec(value);
44
+ if (!match)
45
+ return false;
46
+ const date = new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3])));
47
+ return !Number.isNaN(date.getTime()) && date.toISOString().slice(0, 10) === value;
48
+ }
49
+ /** `company`, `local` or 16 lower-case hex. */
50
+ export function isAudienceKey(value) {
51
+ return typeof value === "string" && AUDIENCE_RE.test(value);
52
+ }
53
+ /** Lower-case, ASCII, dash-separated. Returns "" when nothing usable is left. */
54
+ export function slugify(name) {
55
+ return name
56
+ .normalize("NFKD")
57
+ .replace(/[̀-ͯ]/g, "")
58
+ .toLowerCase()
59
+ .replace(/['’]/g, "")
60
+ .replace(/[^a-z0-9]+/g, "-")
61
+ .replace(/^-+|-+$/g, "")
62
+ .slice(0, 96)
63
+ .replace(/-+$/g, "");
64
+ }
65
+ export function entityRef(type, slug) {
66
+ const ref = `${type}/${slug}`;
67
+ if (!isEntityRef(ref))
68
+ throw new RowGrammarError("bad_entity_ref", `not an entity ref: ${ref}`);
69
+ return ref;
70
+ }
71
+ export function isEntityRef(value) {
72
+ return typeof value === "string" && parseEntityRef(value) !== null;
73
+ }
74
+ export function parseEntityRef(value) {
75
+ const slash = value.indexOf("/");
76
+ if (slash < 1)
77
+ return null;
78
+ const type = value.slice(0, slash);
79
+ const slug = value.slice(slash + 1);
80
+ if (!GRAPH_ENTITY_TYPES.includes(type))
81
+ return null;
82
+ if (!SLUG_RE.test(slug) || slug.includes(".."))
83
+ return null;
84
+ return { type: type, slug };
85
+ }
86
+ export function parseSourceRef(value) {
87
+ const colon = value.indexOf(":");
88
+ if (colon < 1)
89
+ return null;
90
+ const kind = value.slice(0, colon);
91
+ const rest = value.slice(colon + 1);
92
+ if (!SOURCE_REF_KINDS.includes(kind))
93
+ return null;
94
+ if (rest.trim() === "" || rest !== rest.trim() || /[\r\n]/.test(rest))
95
+ return null;
96
+ if ((kind === "signal" || kind === "legacy") && !/^[0-9a-f]{12}$/.test(rest))
97
+ return null;
98
+ if (kind === "record" && !/^[^:\s]+:.+$/.test(rest))
99
+ return null;
100
+ return { kind: kind, value: rest };
101
+ }
102
+ export function isSourceRef(value) {
103
+ return typeof value === "string" && parseSourceRef(value) !== null;
104
+ }
105
+ export function parseOrigin(value) {
106
+ if (value === "record" || value === "legacy")
107
+ return { kind: value, id: "" };
108
+ const colon = value.indexOf(":");
109
+ if (colon < 1)
110
+ return null;
111
+ const kind = value.slice(0, colon);
112
+ const id = value.slice(colon + 1);
113
+ if (kind === "record" || kind === "legacy")
114
+ return null;
115
+ if (!ORIGIN_KINDS.includes(kind))
116
+ return null;
117
+ if (id === "" || /[\s|]/.test(id))
118
+ return null;
119
+ return { kind: kind, id };
120
+ }
121
+ export function isOrigin(value) {
122
+ return typeof value === "string" && parseOrigin(value) !== null;
123
+ }
124
+ export function formatOrigin(origin) {
125
+ return (origin.id ? `${origin.kind}:${origin.id}` : origin.kind);
126
+ }
127
+ /** Authority tier, 1 (human) to 5 (legacy). An unreadable origin ranks last. */
128
+ export function originTier(by) {
129
+ const parsed = parseOrigin(by);
130
+ return parsed ? ORIGIN_TIER[parsed.kind] : 5;
131
+ }
132
+ /** Two decimals: `0.50`, `1.00`. */
133
+ export function formatConf(conf) {
134
+ return conf.toFixed(2);
135
+ }
136
+ export function escapeText(text) {
137
+ return text.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
138
+ }
139
+ export function unescapeText(text) {
140
+ let out = "";
141
+ for (let index = 0; index < text.length; index += 1) {
142
+ const char = text[index];
143
+ if (char !== "\\" || index === text.length - 1) {
144
+ out += char;
145
+ continue;
146
+ }
147
+ index += 1;
148
+ const next = text[index];
149
+ out += next === "n" ? "\n" : next === "r" ? "\r" : next;
150
+ }
151
+ return out;
152
+ }
153
+ /** Splits on ` | ` where the pipe is not escaped. Parts stay escaped. */
154
+ function splitFields(text) {
155
+ const parts = [];
156
+ let current = "";
157
+ for (let index = 0; index < text.length; index += 1) {
158
+ const char = text[index];
159
+ if (char === "\\" && index + 1 < text.length) {
160
+ current += char + text[index + 1];
161
+ index += 1;
162
+ continue;
163
+ }
164
+ if (char === " " && text.startsWith(SEPARATOR, index)) {
165
+ parts.push(current);
166
+ current = "";
167
+ index += SEPARATOR.length - 1;
168
+ continue;
169
+ }
170
+ current += char;
171
+ }
172
+ parts.push(current);
173
+ return parts;
174
+ }
175
+ // ---------------------------------------------------------------------------
176
+ // Format
177
+ // ---------------------------------------------------------------------------
178
+ function formatStamps(row) {
179
+ return [
180
+ `valid ${row.valid.from}..${row.valid.to ?? ""}`,
181
+ `src ${escapeText(row.src)}`,
182
+ `learned ${row.learned}`,
183
+ `by ${row.by}`,
184
+ `conf ${formatConf(row.conf)}`,
185
+ ];
186
+ }
187
+ /** The markdown line for a row, without a trailing newline. */
188
+ export function formatRow(row) {
189
+ if (row.kind === "T") {
190
+ const fields = ["- T " + row.date, row.signalType, escapeText(row.text), `src ${escapeText(row.src)}`];
191
+ if (row.by !== undefined)
192
+ fields.push(`by ${row.by}`);
193
+ return fields.join(SEPARATOR);
194
+ }
195
+ const head = row.kind === "F" ? `- F ${row.field} = ${escapeText(row.value)}` : `- E ${row.verb} -> ${row.target}`;
196
+ const fields = [head, ...formatStamps(row)];
197
+ if (row.kind === "E" && row.was !== undefined)
198
+ fields.push(`was "${escapeText(row.was)}"`);
199
+ if (row.closed)
200
+ fields.push(`closed ${row.closed.on} by ${escapeText(row.closed.by)}`);
201
+ return fields.join(SEPARATOR);
202
+ }
203
+ // ---------------------------------------------------------------------------
204
+ // Parse
205
+ // ---------------------------------------------------------------------------
206
+ /** True when the line starts like a row (`- F `, `- E `, `- T `). */
207
+ export function isRowLine(line) {
208
+ return /^- [FET] /.test(line);
209
+ }
210
+ function fail(code, message) {
211
+ throw new RowGrammarError(code, message);
212
+ }
213
+ function labelled(part, label, missing) {
214
+ if (part === undefined)
215
+ fail(missing, `missing "${label}" field`);
216
+ if (part === label)
217
+ fail(missing, `empty "${label}" field`);
218
+ if (!part.startsWith(`${label} `))
219
+ fail(missing === "grammar" ? "grammar" : missing, `expected "${label} ..." but found "${part}"`);
220
+ const value = part.slice(label.length + 1);
221
+ if (value.trim() === "")
222
+ fail(missing, `empty "${label}" field`);
223
+ return value;
224
+ }
225
+ function parseValidity(part) {
226
+ const text = labelled(part, "valid", "bad_validity");
227
+ const dots = text.indexOf("..");
228
+ if (dots < 0)
229
+ fail("bad_validity", `expected <from>..<to> but found "${text}"`);
230
+ const from = text.slice(0, dots);
231
+ const to = text.slice(dots + 2);
232
+ if (!isIsoDate(from))
233
+ fail("bad_validity", `valid from is not a date: "${from}"`);
234
+ if (to === "")
235
+ return { from };
236
+ if (!isIsoDate(to))
237
+ fail("bad_validity", `valid to is not a date: "${to}"`);
238
+ if (to < from)
239
+ fail("bad_validity", `valid to ${to} is before valid from ${from}`);
240
+ return { from, to };
241
+ }
242
+ function parseSrc(part) {
243
+ const text = unescapeText(labelled(part, "src", "missing_src"));
244
+ if (!isSourceRef(text))
245
+ fail("bad_src", `not a source ref: "${text}"`);
246
+ return text;
247
+ }
248
+ function parseClosure(part) {
249
+ const match = /^closed (\S+) by (.+)$/.exec(part);
250
+ if (!match)
251
+ fail("bad_closure", `expected "closed <date> by <ref>" but found "${part}"`);
252
+ const by = unescapeText(match[2]);
253
+ if (!isIsoDate(match[1]))
254
+ fail("bad_closure", `closed date is not a date: "${match[1]}"`);
255
+ if (!isSourceRef(by))
256
+ fail("bad_closure", `closed by is not a source ref: "${by}"`);
257
+ return { on: match[1], by };
258
+ }
259
+ function parseStamped(kind, parts) {
260
+ const head = parts[0];
261
+ const valid = parseValidity(parts[1]);
262
+ const src = parseSrc(parts[2]);
263
+ const learned = labelled(parts[3], "learned", "missing_learned");
264
+ if (!isIsoDate(learned))
265
+ fail("bad_date", `learned is not a date: "${learned}"`);
266
+ const by = labelled(parts[4], "by", "missing_by");
267
+ if (!isOrigin(by))
268
+ fail("bad_by", `not an origin: "${by}"`);
269
+ const confText = labelled(parts[5], "conf", "bad_conf");
270
+ if (!/^(0(\.\d+)?|1(\.0+)?)$/.test(confText))
271
+ fail("bad_conf", `conf is not between 0 and 1: "${confText}"`);
272
+ const conf = Number(confText);
273
+ let rest = parts.slice(6);
274
+ let was;
275
+ if (kind === "E" && rest[0]?.startsWith("was ")) {
276
+ const match = /^was "(.*)"$/.exec(rest[0]);
277
+ if (!match)
278
+ fail("grammar", `expected was "<label>" but found "${rest[0]}"`);
279
+ was = unescapeText(match[1]);
280
+ rest = rest.slice(1);
281
+ }
282
+ let closed;
283
+ if (rest[0]?.startsWith("closed ")) {
284
+ closed = parseClosure(rest[0]);
285
+ rest = rest.slice(1);
286
+ }
287
+ if (rest.length > 0)
288
+ fail("grammar", `unexpected field "${rest[0]}"`);
289
+ if (closed && !valid.to)
290
+ fail("bad_closure", "a closed row needs a valid to date");
291
+ const stamps = { valid, src, learned, by, conf, ...(closed ? { closed } : {}) };
292
+ if (kind === "F") {
293
+ const equals = head.indexOf(" = ");
294
+ if (equals < 1)
295
+ fail("grammar", `expected "<field> = <value>" but found "${head}"`);
296
+ const field = head.slice(0, equals);
297
+ const value = unescapeText(head.slice(equals + 3));
298
+ if (!TOKEN_RE.test(field))
299
+ fail("grammar", `not a field name: "${field}"`);
300
+ if (value.trim() === "")
301
+ fail("empty_value", `fact ${field} has no value`);
302
+ return { kind: "F", field, value, ...stamps };
303
+ }
304
+ const arrow = head.indexOf(" -> ");
305
+ if (arrow < 1)
306
+ fail("grammar", `expected "<verb> -> <type>/<slug>" but found "${head}"`);
307
+ const verb = head.slice(0, arrow);
308
+ const target = head.slice(arrow + 4);
309
+ if (!TOKEN_RE.test(verb))
310
+ fail("grammar", `not a verb: "${verb}"`);
311
+ if (!isEntityRef(target))
312
+ fail("bad_entity_ref", `not an entity ref: "${target}"`);
313
+ return { kind: "E", verb: verb, target, ...stamps, ...(was !== undefined ? { was } : {}) };
314
+ }
315
+ function parseTimeline(parts) {
316
+ if (parts.length < 4) {
317
+ const hasSrc = parts.some((part) => part === "src" || part.startsWith("src "));
318
+ fail(hasSrc ? "grammar" : "missing_src", "expected <date> | <signal type> | <one line> | src <ref>");
319
+ }
320
+ if (parts.length > 5)
321
+ fail("grammar", `unexpected field "${parts[5]}"`);
322
+ let by;
323
+ if (parts.length === 5) {
324
+ // The one optional field: who wrote the line when a rule did not copy it from the source.
325
+ if (!parts[4].startsWith("by "))
326
+ fail("grammar", `unexpected field "${parts[4]}"`);
327
+ const origin = parts[4].slice(3).trim();
328
+ if (!isOrigin(origin))
329
+ fail("bad_by", `not an origin: "${origin}"`);
330
+ by = origin;
331
+ }
332
+ const [date, signalType, text] = parts;
333
+ if (!isIsoDate(date))
334
+ fail("bad_date", `not a date: "${date}"`);
335
+ if (!SIGNAL_TYPE_RE.test(signalType))
336
+ fail("bad_signal_type", `not a signal type: "${signalType}"`);
337
+ if (text.trim() === "")
338
+ fail("empty_value", "timeline row has no text");
339
+ return { kind: "T", date, signalType, text: unescapeText(text), src: parseSrc(parts[3]), ...(by !== undefined ? { by } : {}) };
340
+ }
341
+ /** Parses one row line. Throws RowGrammarError with a refusal code. */
342
+ export function parseRow(line) {
343
+ const match = /^- ([FET]) (.*)$/.exec(line);
344
+ if (!match)
345
+ fail("grammar", `not a row: "${line.slice(0, 80)}"`);
346
+ const parts = splitFields(match[2]);
347
+ return match[1] === "T" ? parseTimeline(parts) : parseStamped(match[1], parts);
348
+ }
349
+ export function tryParseRow(line) {
350
+ try {
351
+ return { ok: true, row: parseRow(line) };
352
+ }
353
+ catch (error) {
354
+ if (error instanceof RowGrammarError)
355
+ return { ok: false, refusal: { code: error.code, message: error.message } };
356
+ throw error;
357
+ }
358
+ }
359
+ // ---------------------------------------------------------------------------
360
+ // Identity and order
361
+ // ---------------------------------------------------------------------------
362
+ function identity(row) {
363
+ if (row.kind === "T")
364
+ return ["T", row.date, row.signalType, row.text, row.src].join("\u0000");
365
+ const head = row.kind === "F" ? ["F", row.field, row.value] : ["E", row.verb, row.target];
366
+ return [...head, row.valid.from, row.src, row.by].join("\u0000");
367
+ }
368
+ /**
369
+ * 12 hex. Built from what the row says and where it came from, not from
370
+ * `valid.to`, `learned`, `conf`, `was` or `closed`, and for a T row not from
371
+ * its optional `by`: the same fact from the same
372
+ * source on the same day is the same row however often it is replayed, and a
373
+ * row keeps its id when it is closed.
374
+ */
375
+ export function rowId(row) {
376
+ return createHash("sha256").update(identity(row)).digest("hex").slice(0, 12);
377
+ }
378
+ const KIND_ORDER = { F: 0, E: 1, T: 2 };
379
+ function compareText(a, b) {
380
+ return a < b ? -1 : a > b ? 1 : 0;
381
+ }
382
+ /**
383
+ * File order: F rows, then E rows, then T rows. F by field, E by verb then
384
+ * target, both then by valid from, source and origin. T rows oldest first.
385
+ * Uses code-unit comparison so the order is the same on every machine.
386
+ */
387
+ export function compareRows(a, b) {
388
+ if (a.kind !== b.kind)
389
+ return KIND_ORDER[a.kind] - KIND_ORDER[b.kind];
390
+ if (a.kind === "T" && b.kind === "T") {
391
+ return (compareText(a.date, b.date) ||
392
+ compareText(a.signalType, b.signalType) ||
393
+ compareText(a.src, b.src) ||
394
+ compareText(a.text, b.text));
395
+ }
396
+ const left = a;
397
+ const right = b;
398
+ const head = left.kind === "F" && right.kind === "F"
399
+ ? compareText(left.field, right.field)
400
+ : left.kind === "E" && right.kind === "E"
401
+ ? compareText(left.verb, right.verb) || compareText(left.target, right.target)
402
+ : 0;
403
+ return (head ||
404
+ compareText(left.valid.from, right.valid.from) ||
405
+ compareText(left.src, right.src) ||
406
+ compareText(left.by, right.by) ||
407
+ (left.kind === "F" && right.kind === "F" ? compareText(left.value, right.value) : 0));
408
+ }
409
+ //# sourceMappingURL=grammar.js.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * WP-A: schema and row grammar. Pure functions, no file access.
3
+ * See ../CONTRACT.md for the grammar with examples.
4
+ */
5
+ export { RowGrammarError, compareRows, entityRef, escapeText, formatConf, formatOrigin, formatRow, isAudienceKey, isEntityRef, isIsoDate, isOrigin, isRowLine, isSourceRef, originTier, parseEntityRef, parseOrigin, parseRow, parseSourceRef, rowId, slugify, tryParseRow, unescapeText, } from "./grammar.js";
6
+ export type { RowParseResult } from "./grammar.js";
7
+ export { DEFAULT_SCHEMA, parseSchemaYaml, renderSchemaYaml } from "./default-schema.js";
8
+ export { SchemaError } from "./default-schema.js";
9
+ export { validateEntityUpsert, validateRow } from "./validate.js";
10
+ export { effectiveFacts, inverseEdge, isOpen, isSingleValued, planSupersession, rowCoversDay, singleValueKey, } from "./authority.js";
11
+ export type { SupersessionPlan } from "./authority.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * WP-A: schema and row grammar. Pure functions, no file access.
3
+ * See ../CONTRACT.md for the grammar with examples.
4
+ */
5
+ export { RowGrammarError, compareRows, entityRef, escapeText, formatConf, formatOrigin, formatRow, isAudienceKey, isEntityRef, isIsoDate, isOrigin, isRowLine, isSourceRef, originTier, parseEntityRef, parseOrigin, parseRow, parseSourceRef, rowId, slugify, tryParseRow, unescapeText, } from "./grammar.js";
6
+ export { DEFAULT_SCHEMA, parseSchemaYaml, renderSchemaYaml } from "./default-schema.js";
7
+ export { SchemaError } from "./default-schema.js";
8
+ export { validateEntityUpsert, validateRow } from "./validate.js";
9
+ export { effectiveFacts, inverseEdge, isOpen, isSingleValued, planSupersession, rowCoversDay, singleValueKey, } from "./authority.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Row and entity validation against the schema. The store runs `validateRow`
3
+ * on every row before it writes; a refused row is never written.
4
+ */
5
+ import { type AudienceKey, type EntityUpsert, type GraphRow, type GraphSchema, type RowRefusal } from "../types.js";
6
+ /**
7
+ * Every reason the row may not be written on this entity. Empty means valid.
8
+ * Pass `audience` to check the folder key too.
9
+ */
10
+ export declare function validateRow(schema: GraphSchema, entity: string, row: GraphRow, audience?: AudienceKey): RowRefusal[];
11
+ /** Reasons an entity may not be created. Empty means valid. */
12
+ export declare function validateEntityUpsert(schema: GraphSchema, input: EntityUpsert): RowRefusal[];
13
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Row and entity validation against the schema. The store runs `validateRow`
3
+ * on every row before it writes; a refused row is never written.
4
+ */
5
+ import { GRAPH_ENTITY_TYPES, } from "../types.js";
6
+ import { isAudienceKey, isIsoDate, isOrigin, isSourceRef, parseEntityRef } from "./grammar.js";
7
+ const SIGNAL_TYPE_RE = /^[a-z][a-z0-9_-]*$/;
8
+ const SLUG_RE = /^[a-z0-9][a-z0-9._-]*$/;
9
+ function present(value) {
10
+ return typeof value === "string" && value.trim() !== "";
11
+ }
12
+ /**
13
+ * Every reason the row may not be written on this entity. Empty means valid.
14
+ * Pass `audience` to check the folder key too.
15
+ */
16
+ export function validateRow(schema, entity, row, audience) {
17
+ const refusals = [];
18
+ const refuse = (code, message) => void refusals.push({ code, message });
19
+ if (audience !== undefined && !isAudienceKey(audience)) {
20
+ refuse("bad_audience", `audience must be "company" or 16 hex, got "${String(audience)}"`);
21
+ }
22
+ const subject = typeof entity === "string" ? parseEntityRef(entity) : null;
23
+ if (!subject)
24
+ refuse("bad_entity_ref", `not an entity ref: "${String(entity)}"`);
25
+ const typeSpec = subject ? schema.entity_types[subject.type] : undefined;
26
+ if (subject && !typeSpec)
27
+ refuse("unknown_entity_type", `type ${subject.type} is not in the schema`);
28
+ const kind = row?.kind;
29
+ if (kind !== "F" && kind !== "E" && kind !== "T") {
30
+ refuse("grammar", `row kind must be F, E or T, got "${String(kind)}"`);
31
+ return refusals;
32
+ }
33
+ // src is required on every row kind.
34
+ if (!present(row.src))
35
+ refuse("missing_src", "a row needs a source (src)");
36
+ else if (!isSourceRef(row.src))
37
+ refuse("bad_src", `not a source ref: "${row.src}"`);
38
+ if (row.kind === "T") {
39
+ if (!isIsoDate(row.date))
40
+ refuse("bad_date", `timeline date is not YYYY-MM-DD: "${String(row.date)}"`);
41
+ if (typeof row.signalType !== "string" || !SIGNAL_TYPE_RE.test(row.signalType)) {
42
+ refuse("bad_signal_type", `not a signal type: "${String(row.signalType)}"`);
43
+ }
44
+ if (!present(row.text))
45
+ refuse("empty_value", "timeline row has no text");
46
+ else if (/[\r\n]/.test(row.text))
47
+ refuse("multiline", "timeline text must be one line");
48
+ if (row.by !== undefined && !isOrigin(row.by))
49
+ refuse("bad_by", `not an origin: "${String(row.by)}"`);
50
+ return refusals;
51
+ }
52
+ if (!present(row.learned))
53
+ refuse("missing_learned", "a row needs a learned date");
54
+ else if (!isIsoDate(row.learned))
55
+ refuse("bad_date", `learned is not YYYY-MM-DD: "${row.learned}"`);
56
+ if (!present(row.by))
57
+ refuse("missing_by", "a row needs an origin (by)");
58
+ else if (!isOrigin(row.by))
59
+ refuse("bad_by", `not an origin: "${row.by}"`);
60
+ const valid = row.valid;
61
+ if (!valid || !isIsoDate(valid.from)) {
62
+ refuse("bad_validity", `valid from is not YYYY-MM-DD: "${String(valid?.from)}"`);
63
+ }
64
+ else if (valid.to !== undefined) {
65
+ if (!isIsoDate(valid.to))
66
+ refuse("bad_validity", `valid to is not YYYY-MM-DD: "${String(valid.to)}"`);
67
+ else if (valid.to < valid.from)
68
+ refuse("bad_validity", `valid to ${valid.to} is before valid from ${valid.from}`);
69
+ }
70
+ if (typeof row.conf !== "number" || !Number.isFinite(row.conf) || row.conf < 0 || row.conf > 1) {
71
+ refuse("bad_conf", `conf must be between 0 and 1, got "${String(row.conf)}"`);
72
+ }
73
+ if (row.closed !== undefined) {
74
+ if (!isIsoDate(row.closed?.on) || !isSourceRef(row.closed?.by)) {
75
+ refuse("bad_closure", "closed needs a date and a source ref");
76
+ }
77
+ else if (valid?.to === undefined) {
78
+ refuse("bad_closure", "a closed row needs a valid to date");
79
+ }
80
+ }
81
+ if (row.kind === "F") {
82
+ if (typeof row.field !== "string" || !typeSpec?.facts[row.field]) {
83
+ if (typeSpec)
84
+ refuse("unknown_field", `field "${String(row.field)}" is not listed for ${subject?.type}`);
85
+ }
86
+ if (!present(row.value))
87
+ refuse("empty_value", `fact ${String(row.field)} has no value`);
88
+ else if (/[\r\n]/.test(row.value))
89
+ refuse("multiline", "a fact value must be one line");
90
+ else if (row.value !== row.value.trim())
91
+ refuse("grammar", "a fact value may not start or end with a space");
92
+ return refusals;
93
+ }
94
+ const link = typeof row.verb === "string" ? schema.link_types[row.verb] : undefined;
95
+ if (!link)
96
+ refuse("unknown_verb", `verb "${String(row.verb)}" is not in the schema`);
97
+ const target = typeof row.target === "string" ? parseEntityRef(row.target) : null;
98
+ if (!target)
99
+ refuse("bad_entity_ref", `edge target is not an entity ref: "${String(row.target)}"`);
100
+ else if (!schema.entity_types[target.type])
101
+ refuse("unknown_entity_type", `type ${target.type} is not in the schema`);
102
+ if (link && subject && !link.subjects.includes("*") && !link.subjects.includes(subject.type)) {
103
+ refuse("bad_subject_type", `${row.verb} may not start from a ${subject.type}`);
104
+ }
105
+ if (link && target && !link.objects.includes("*") && !link.objects.includes(target.type)) {
106
+ refuse("bad_object_type", `${row.verb} may not point at a ${target.type}`);
107
+ }
108
+ if (row.was !== undefined && (typeof row.was !== "string" || /[\r\n]/.test(row.was))) {
109
+ refuse("multiline", "a was label must be one line of text");
110
+ }
111
+ return refusals;
112
+ }
113
+ /** Reasons an entity may not be created. Empty means valid. */
114
+ export function validateEntityUpsert(schema, input) {
115
+ const refusals = [];
116
+ if (!GRAPH_ENTITY_TYPES.includes(input.type) || !schema.entity_types[input.type]) {
117
+ refusals.push({ code: "unknown_entity_type", message: `type "${String(input.type)}" is not in the schema` });
118
+ }
119
+ if (typeof input.slug !== "string" || !SLUG_RE.test(input.slug) || input.slug.includes("..")) {
120
+ refusals.push({ code: "bad_entity_ref", message: `not a slug: "${String(input.slug)}"` });
121
+ }
122
+ if (!present(input.canonical_name)) {
123
+ refusals.push({ code: "empty_value", message: "an entity needs a canonical name" });
124
+ }
125
+ else if (/[\r\n]/.test(input.canonical_name)) {
126
+ refusals.push({ code: "multiline", message: "a canonical name must be one line" });
127
+ }
128
+ if (!isIsoDate(input.seen))
129
+ refusals.push({ code: "bad_date", message: `seen is not YYYY-MM-DD: "${String(input.seen)}"` });
130
+ return refusals;
131
+ }
132
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1,34 @@
1
+ import { type AudienceKey, type EntityRef, type GraphEntity, type GraphRow, type LogEntry, type RowId, type RowRefusal } from "../types.js";
2
+ /** Sorted, trimmed, without blanks or repeats. */
3
+ export declare function sortedUnique(values: readonly string[]): string[];
4
+ export declare function renderEntityFile(entity: GraphEntity): string;
5
+ export declare function parseEntityFile(text: string, file: string): GraphEntity;
6
+ /** Rows in file order: F, E, T, each group sorted; ties broken by row id. */
7
+ export declare function sortRows<R extends GraphRow>(rows: readonly R[]): R[];
8
+ export declare function renderFactsFile(entity: EntityRef, audience: AudienceKey, rows: readonly GraphRow[]): string;
9
+ export interface ParsedFactsFile {
10
+ entity: EntityRef | null;
11
+ audience: AudienceKey | null;
12
+ rows: {
13
+ id: RowId;
14
+ row: GraphRow;
15
+ line: number;
16
+ }[];
17
+ /** Lines that start like a row but do not parse, and header problems. */
18
+ errors: {
19
+ line: number;
20
+ refusal: RowRefusal;
21
+ text: string;
22
+ }[];
23
+ }
24
+ /**
25
+ * Lenient parse, used by lint and by read commands: bad lines are returned in
26
+ * `errors` and never thrown. Lines that are not rows (blank, headings, prose)
27
+ * are ignored.
28
+ */
29
+ export declare function parseFactsFile(text: string): ParsedFactsFile;
30
+ export declare const LOG_HEADER = "# Ontology graph log\n\nAppend-only. One entry per ingest, lint run and decision.\n\n";
31
+ export declare function formatLogEntry(entry: LogEntry): string;
32
+ /** Entries in file order (oldest first). Lines that are not part of an entry are ignored. */
33
+ export declare function parseLog(text: string): LogEntry[];
34
+ //# sourceMappingURL=files.d.ts.map