@indigoai-us/hq-cli 5.345.246 → 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 (256) hide show
  1. package/CHANGELOG.md +63 -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 +1116 -3
  5. package/dist/command-catalog.generated.js +1373 -3
  6. package/dist/command-registration-plan.d.ts +6 -0
  7. package/dist/command-registration-plan.js +1 -0
  8. package/dist/commands/install-global.d.ts +15 -0
  9. package/dist/commands/install-global.js +98 -4
  10. package/dist/commands/lanes-hold.js +7 -7
  11. package/dist/commands/lanes-resume.js +2 -2
  12. package/dist/commands/lanes-review.js +1 -1
  13. package/dist/commands/lanes-session-start.d.ts +1 -1
  14. package/dist/commands/lanes-session-start.js +3 -3
  15. package/dist/commands/lanes-shared.d.ts +1 -1
  16. package/dist/commands/lanes.d.ts +2 -2
  17. package/dist/commands/lanes.js +50 -50
  18. package/dist/commands/mcp-registration.d.ts +17 -0
  19. package/dist/commands/mcp-registration.js +119 -0
  20. package/dist/commands/mesh.d.ts +25 -0
  21. package/dist/commands/mesh.js +48 -8
  22. package/dist/commands/ontology-graph.d.ts +62 -0
  23. package/dist/commands/ontology-graph.js +439 -0
  24. package/dist/commands/pkg-install.js +1 -1
  25. package/dist/commands/reindex.js +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/lanes-monitor-check-argv.d.ts +1 -1
  28. package/dist/lanes-monitor-check-argv.js +1 -1
  29. package/dist/lanes-monitor-check-fast.d.ts +1 -1
  30. package/dist/lanes-monitor-check-fast.js +1 -1
  31. package/dist/lanes-session-start-argv.d.ts +1 -1
  32. package/dist/lanes-session-start-argv.js +1 -1
  33. package/dist/lib/capacity/sign-in.d.ts +1 -1
  34. package/dist/lib/capacity/sign-in.js +1 -1
  35. package/dist/lib/daemon/hook-requests-conduct-link.js +2 -2
  36. package/dist/lib/daemon/lanes-monitor-state.d.ts +2 -2
  37. package/dist/lib/daemon/lanes-monitor-state.js +2 -2
  38. package/dist/lib/daemon/merge-sections.d.ts +3 -3
  39. package/dist/lib/daemon/merge-sections.js +7 -7
  40. package/dist/lib/daemon/remote-control-pools.js +1 -1
  41. package/dist/lib/daemon/run.js +1 -1
  42. package/dist/lib/daemon/state-file.d.ts +1 -1
  43. package/dist/lib/daemon/state-file.js +1 -1
  44. package/dist/lib/doctor/checks/antigravity-wiring.d.ts +21 -0
  45. package/dist/lib/doctor/checks/antigravity-wiring.js +75 -0
  46. package/dist/lib/doctor/checks/anywhere.js +30 -0
  47. package/dist/lib/doctor/checks/runtime-probe.js +13 -0
  48. package/dist/lib/doctor/platform.d.ts +1 -1
  49. package/dist/lib/doctor/platform.js +5 -0
  50. package/dist/lib/doctor/registry.js +3 -0
  51. package/dist/lib/flag-snapshot-file.d.ts +2 -0
  52. package/dist/lib/flag-snapshot-file.js +118 -48
  53. package/dist/lib/hook-engine/canary-gate.d.ts +57 -3
  54. package/dist/lib/hook-engine/canary-gate.js +138 -6
  55. package/dist/lib/hook-engine/coverage.d.ts +91 -0
  56. package/dist/lib/hook-engine/coverage.js +184 -0
  57. package/dist/lib/hot-channels/graph-context.d.ts +105 -0
  58. package/dist/lib/hot-channels/graph-context.js +377 -0
  59. package/dist/lib/hot-channels/signals-pass.js +27 -1
  60. package/dist/lib/install/antigravity-targets.d.ts +39 -0
  61. package/dist/lib/install/antigravity-targets.js +122 -0
  62. package/dist/lib/lanes/claude-credential.d.ts +1 -1
  63. package/dist/lib/lanes/claude-credential.js +1 -1
  64. package/dist/lib/lanes/delivery-core.d.ts +1 -1
  65. package/dist/lib/lanes/delivery-core.js +1 -1
  66. package/dist/lib/lanes/delivery.d.ts +10 -10
  67. package/dist/lib/lanes/delivery.js +8 -8
  68. package/dist/lib/lanes/dropbox.d.ts +1 -1
  69. package/dist/lib/lanes/dropbox.js +1 -1
  70. package/dist/lib/lanes/hooks-install.js +2 -2
  71. package/dist/lib/lanes/index.d.ts +1 -1
  72. package/dist/lib/lanes/index.js +1 -1
  73. package/dist/lib/lanes/monitor.js +1 -1
  74. package/dist/lib/lanes/quota-notice.js +1 -1
  75. package/dist/lib/lanes/quota.d.ts +1 -1
  76. package/dist/lib/lanes/quota.js +1 -1
  77. package/dist/lib/lanes/repo-merge-hold.d.ts +2 -2
  78. package/dist/lib/lanes/repo-merge-hold.js +2 -2
  79. package/dist/lib/lanes/spawn.d.ts +4 -4
  80. package/dist/lib/lanes/spawn.js +5 -5
  81. package/dist/lib/mesh/live/company-flag-refresh.d.ts +61 -0
  82. package/dist/lib/mesh/live/company-flag-refresh.js +159 -0
  83. package/dist/lib/mesh/live/company-reporting-gaps.d.ts +61 -0
  84. package/dist/lib/mesh/live/company-reporting-gaps.js +238 -0
  85. package/dist/lib/mesh/live/daemon/duplicate-unit.d.ts +156 -0
  86. package/dist/lib/mesh/live/daemon/duplicate-unit.js +616 -0
  87. package/dist/lib/mesh/live/daemon/run.d.ts +13 -0
  88. package/dist/lib/mesh/live/daemon/run.js +35 -2
  89. package/dist/lib/mesh/live/direct-drain.js +1 -1
  90. package/dist/lib/mesh/live/emit.d.ts +3 -0
  91. package/dist/lib/mesh/live/emit.js +32 -9
  92. package/dist/lib/mesh/live/flush.d.ts +3 -0
  93. package/dist/lib/mesh/live/flush.js +115 -32
  94. package/dist/lib/mesh/live/liveness-carry.d.ts +1 -1
  95. package/dist/lib/mesh/live/liveness-carry.js +1 -1
  96. package/dist/lib/mesh/live/reporting-privacy.d.ts +119 -3
  97. package/dist/lib/mesh/live/reporting-privacy.js +235 -11
  98. package/dist/lib/mesh/live/spool.d.ts +17 -2
  99. package/dist/lib/mesh/live/spool.js +22 -6
  100. package/dist/lib/ontology-graph/legacy/coverage.d.ts +67 -0
  101. package/dist/lib/ontology-graph/legacy/coverage.js +192 -0
  102. package/dist/lib/ontology-graph/legacy/index.d.ts +199 -0
  103. package/dist/lib/ontology-graph/legacy/index.js +1150 -0
  104. package/dist/lib/ontology-graph/legacy/parse.d.ts +49 -0
  105. package/dist/lib/ontology-graph/legacy/parse.js +126 -0
  106. package/dist/lib/ontology-graph/legacy/report.d.ts +14 -0
  107. package/dist/lib/ontology-graph/legacy/report.js +254 -0
  108. package/dist/lib/ontology-graph/legacy/verb-map.d.ts +35 -0
  109. package/dist/lib/ontology-graph/legacy/verb-map.js +84 -0
  110. package/dist/lib/ontology-graph/lint/checks.d.ts +140 -0
  111. package/dist/lib/ontology-graph/lint/checks.js +717 -0
  112. package/dist/lib/ontology-graph/lint/coverage.d.ts +106 -0
  113. package/dist/lib/ontology-graph/lint/coverage.js +241 -0
  114. package/dist/lib/ontology-graph/lint/daily-job.d.ts +259 -0
  115. package/dist/lib/ontology-graph/lint/daily-job.js +595 -0
  116. package/dist/lib/ontology-graph/lint/index.d.ts +65 -0
  117. package/dist/lib/ontology-graph/lint/index.js +176 -0
  118. package/dist/lib/ontology-graph/model/files.d.ts +20 -0
  119. package/dist/lib/ontology-graph/model/files.js +89 -0
  120. package/dist/lib/ontology-graph/model/index.d.ts +65 -0
  121. package/dist/lib/ontology-graph/model/index.js +100 -0
  122. package/dist/lib/ontology-graph/model/pass-tasks.d.ts +156 -0
  123. package/dist/lib/ontology-graph/model/pass-tasks.js +345 -0
  124. package/dist/lib/ontology-graph/model/pass.d.ts +109 -0
  125. package/dist/lib/ontology-graph/model/pass.js +958 -0
  126. package/dist/lib/ontology-graph/model/runner.d.ts +50 -0
  127. package/dist/lib/ontology-graph/model/runner.js +160 -0
  128. package/dist/lib/ontology-graph/model/step.d.ts +195 -0
  129. package/dist/lib/ontology-graph/model/step.js +523 -0
  130. package/dist/lib/ontology-graph/model/tasks.d.ts +183 -0
  131. package/dist/lib/ontology-graph/model/tasks.js +349 -0
  132. package/dist/lib/ontology-graph/not-implemented.d.ts +5 -0
  133. package/dist/lib/ontology-graph/not-implemented.js +8 -0
  134. package/dist/lib/ontology-graph/org/compare.d.ts +28 -0
  135. package/dist/lib/ontology-graph/org/compare.js +239 -0
  136. package/dist/lib/ontology-graph/org/derive.d.ts +65 -0
  137. package/dist/lib/ontology-graph/org/derive.js +352 -0
  138. package/dist/lib/ontology-graph/org/index.d.ts +73 -0
  139. package/dist/lib/ontology-graph/org/index.js +513 -0
  140. package/dist/lib/ontology-graph/org/load.d.ts +31 -0
  141. package/dist/lib/ontology-graph/org/load.js +476 -0
  142. package/dist/lib/ontology-graph/org/role.d.ts +38 -0
  143. package/dist/lib/ontology-graph/org/role.js +268 -0
  144. package/dist/lib/ontology-graph/org/structure.d.ts +63 -0
  145. package/dist/lib/ontology-graph/org/structure.js +437 -0
  146. package/dist/lib/ontology-graph/org/text.d.ts +95 -0
  147. package/dist/lib/ontology-graph/org/text.js +315 -0
  148. package/dist/lib/ontology-graph/org/types.d.ts +452 -0
  149. package/dist/lib/ontology-graph/org/types.js +80 -0
  150. package/dist/lib/ontology-graph/pages/index.d.ts +64 -0
  151. package/dist/lib/ontology-graph/pages/index.js +193 -0
  152. package/dist/lib/ontology-graph/pages/render.d.ts +142 -0
  153. package/dist/lib/ontology-graph/pages/render.js +682 -0
  154. package/dist/lib/ontology-graph/proposals/apply.d.ts +109 -0
  155. package/dist/lib/ontology-graph/proposals/apply.js +468 -0
  156. package/dist/lib/ontology-graph/proposals/group.d.ts +63 -0
  157. package/dist/lib/ontology-graph/proposals/group.js +232 -0
  158. package/dist/lib/ontology-graph/proposals/index.d.ts +173 -0
  159. package/dist/lib/ontology-graph/proposals/index.js +474 -0
  160. package/dist/lib/ontology-graph/proposals/model.d.ts +162 -0
  161. package/dist/lib/ontology-graph/proposals/model.js +196 -0
  162. package/dist/lib/ontology-graph/proposals/org-chart.d.ts +82 -0
  163. package/dist/lib/ontology-graph/proposals/org-chart.js +340 -0
  164. package/dist/lib/ontology-graph/read/brief.d.ts +26 -0
  165. package/dist/lib/ontology-graph/read/brief.js +251 -0
  166. package/dist/lib/ontology-graph/read/graph-index.d.ts +76 -0
  167. package/dist/lib/ontology-graph/read/graph-index.js +198 -0
  168. package/dist/lib/ontology-graph/read/index.d.ts +59 -0
  169. package/dist/lib/ontology-graph/read/index.js +792 -0
  170. package/dist/lib/ontology-graph/read/member.d.ts +7 -0
  171. package/dist/lib/ontology-graph/read/member.js +34 -0
  172. package/dist/lib/ontology-graph/read/names.d.ts +44 -0
  173. package/dist/lib/ontology-graph/read/names.js +292 -0
  174. package/dist/lib/ontology-graph/read/reader-setting.d.ts +19 -0
  175. package/dist/lib/ontology-graph/read/reader-setting.js +62 -0
  176. package/dist/lib/ontology-graph/read/test-graph.d.ts +37 -0
  177. package/dist/lib/ontology-graph/read/test-graph.js +150 -0
  178. package/dist/lib/ontology-graph/replay/buffered-store.d.ts +33 -0
  179. package/dist/lib/ontology-graph/replay/buffered-store.js +50 -0
  180. package/dist/lib/ontology-graph/replay/config.d.ts +41 -0
  181. package/dist/lib/ontology-graph/replay/config.js +105 -0
  182. package/dist/lib/ontology-graph/replay/engine.d.ts +100 -0
  183. package/dist/lib/ontology-graph/replay/engine.js +1174 -0
  184. package/dist/lib/ontology-graph/replay/extractors.d.ts +59 -0
  185. package/dist/lib/ontology-graph/replay/extractors.js +1555 -0
  186. package/dist/lib/ontology-graph/replay/index.d.ts +90 -0
  187. package/dist/lib/ontology-graph/replay/index.js +220 -0
  188. package/dist/lib/ontology-graph/replay/listing-manifest.d.ts +66 -0
  189. package/dist/lib/ontology-graph/replay/listing-manifest.js +242 -0
  190. package/dist/lib/ontology-graph/replay/member.d.ts +19 -0
  191. package/dist/lib/ontology-graph/replay/member.js +65 -0
  192. package/dist/lib/ontology-graph/replay/mentions.d.ts +58 -0
  193. package/dist/lib/ontology-graph/replay/mentions.js +239 -0
  194. package/dist/lib/ontology-graph/replay/readers.d.ts +98 -0
  195. package/dist/lib/ontology-graph/replay/readers.js +1251 -0
  196. package/dist/lib/ontology-graph/replay/rules.d.ts +127 -0
  197. package/dist/lib/ontology-graph/replay/rules.js +374 -0
  198. package/dist/lib/ontology-graph/replay/scope.d.ts +35 -0
  199. package/dist/lib/ontology-graph/replay/scope.js +115 -0
  200. package/dist/lib/ontology-graph/replay/transcripts.d.ts +39 -0
  201. package/dist/lib/ontology-graph/replay/transcripts.js +224 -0
  202. package/dist/lib/ontology-graph/replay/util.d.ts +55 -0
  203. package/dist/lib/ontology-graph/replay/util.js +256 -0
  204. package/dist/lib/ontology-graph/resolve/entity-index.d.ts +159 -0
  205. package/dist/lib/ontology-graph/resolve/entity-index.js +652 -0
  206. package/dist/lib/ontology-graph/resolve/index.d.ts +113 -0
  207. package/dist/lib/ontology-graph/resolve/index.js +214 -0
  208. package/dist/lib/ontology-graph/resolve/machine.d.ts +34 -0
  209. package/dist/lib/ontology-graph/resolve/machine.js +95 -0
  210. package/dist/lib/ontology-graph/resolve/normalize.d.ts +35 -0
  211. package/dist/lib/ontology-graph/resolve/normalize.js +124 -0
  212. package/dist/lib/ontology-graph/resolve/org-chart.d.ts +107 -0
  213. package/dist/lib/ontology-graph/resolve/org-chart.js +578 -0
  214. package/dist/lib/ontology-graph/resolve/org-layer.d.ts +78 -0
  215. package/dist/lib/ontology-graph/resolve/org-layer.js +159 -0
  216. package/dist/lib/ontology-graph/resolve/org-seed.d.ts +141 -0
  217. package/dist/lib/ontology-graph/resolve/org-seed.js +631 -0
  218. package/dist/lib/ontology-graph/resolve/org-sources.d.ts +165 -0
  219. package/dist/lib/ontology-graph/resolve/org-sources.js +634 -0
  220. package/dist/lib/ontology-graph/resolve/roster.d.ts +76 -0
  221. package/dist/lib/ontology-graph/resolve/roster.js +226 -0
  222. package/dist/lib/ontology-graph/resolve/seed.d.ts +267 -0
  223. package/dist/lib/ontology-graph/resolve/seed.js +1198 -0
  224. package/dist/lib/ontology-graph/resolve/upsert.d.ts +58 -0
  225. package/dist/lib/ontology-graph/resolve/upsert.js +139 -0
  226. package/dist/lib/ontology-graph/resolve/writer.d.ts +128 -0
  227. package/dist/lib/ontology-graph/resolve/writer.js +351 -0
  228. package/dist/lib/ontology-graph/schema/authority.d.ts +73 -0
  229. package/dist/lib/ontology-graph/schema/authority.js +157 -0
  230. package/dist/lib/ontology-graph/schema/default-schema.d.ts +10 -0
  231. package/dist/lib/ontology-graph/schema/default-schema.js +242 -0
  232. package/dist/lib/ontology-graph/schema/grammar.d.ts +57 -0
  233. package/dist/lib/ontology-graph/schema/grammar.js +409 -0
  234. package/dist/lib/ontology-graph/schema/index.d.ts +12 -0
  235. package/dist/lib/ontology-graph/schema/index.js +10 -0
  236. package/dist/lib/ontology-graph/schema/validate.d.ts +13 -0
  237. package/dist/lib/ontology-graph/schema/validate.js +132 -0
  238. package/dist/lib/ontology-graph/store/files.d.ts +34 -0
  239. package/dist/lib/ontology-graph/store/files.js +207 -0
  240. package/dist/lib/ontology-graph/store/fs.d.ts +30 -0
  241. package/dist/lib/ontology-graph/store/fs.js +101 -0
  242. package/dist/lib/ontology-graph/store/graph-store.d.ts +14 -0
  243. package/dist/lib/ontology-graph/store/graph-store.js +520 -0
  244. package/dist/lib/ontology-graph/store/index.d.ts +18 -0
  245. package/dist/lib/ontology-graph/store/index.js +15 -0
  246. package/dist/lib/ontology-graph/store/ingest.d.ts +37 -0
  247. package/dist/lib/ontology-graph/store/ingest.js +323 -0
  248. package/dist/lib/ontology-graph/store/paths.d.ts +114 -0
  249. package/dist/lib/ontology-graph/store/paths.js +232 -0
  250. package/dist/lib/ontology-graph/types.d.ts +1183 -0
  251. package/dist/lib/ontology-graph/types.js +131 -0
  252. package/dist/lib/secret-scan/gitleaks-rules.generated.js +1 -1
  253. package/dist/utils/frontmatter.d.ts +14 -0
  254. package/dist/utils/frontmatter.js +18 -0
  255. package/dist/utils/interactive-caller.js +1 -1
  256. package/package.json +8 -8
@@ -0,0 +1,315 @@
1
+ import { AREAS } from "./types.js";
2
+ export function normalizeName(text) {
3
+ return text
4
+ .normalize("NFKD")
5
+ .replace(/[̀-ͯ]/g, "")
6
+ .toLowerCase()
7
+ .replace(/[^a-z0-9]+/g, " ")
8
+ .trim();
9
+ }
10
+ export function daysBetween(from, to) {
11
+ return Math.round((Date.parse(`${to}T00:00:00Z`) - Date.parse(`${from}T00:00:00Z`)) / 86_400_000);
12
+ }
13
+ export function addDays(day, days) {
14
+ return new Date(Date.parse(`${day}T00:00:00Z`) + days * 86_400_000).toISOString().slice(0, 10);
15
+ }
16
+ /** Half-life of evidence, in days: a row this old counts half as much as one from today. */
17
+ export const RECENCY_HALF_LIFE_DAYS = 90;
18
+ export function recencyWeight(date, asOf, halfLife = RECENCY_HALF_LIFE_DAYS) {
19
+ const age = Math.max(0, daysBetween(date, asOf));
20
+ return Math.pow(0.5, age / halfLife);
21
+ }
22
+ export function clip(text, max = 180) {
23
+ const flat = text.replace(/\s+/g, " ").trim();
24
+ return flat.length <= max ? flat : `${flat.slice(0, max - 1).trimEnd()}…`;
25
+ }
26
+ function escapeRegExp(text) {
27
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
28
+ }
29
+ /** Finds people named in a line. Built once per graph. */
30
+ export class NameIndex {
31
+ entries = new Map();
32
+ rosterFirst = new Map();
33
+ fullNames = new Map();
34
+ roster = [];
35
+ constructor(people) {
36
+ for (const person of people) {
37
+ const full = [...new Set([person.name, ...person.aliases].map(normalizeName).filter((name) => name.length >= 3))];
38
+ const canonical = normalizeName(person.name);
39
+ const first = canonical.split(" ")[0] ?? "";
40
+ const words = full.filter((name) => name.includes(" ") || name === canonical);
41
+ const alternatives = [...new Set([...words, ...(first.length >= 3 ? [first] : [])])]
42
+ .sort((a, b) => b.length - a.length)
43
+ .map((name) => name.split(" ").map(escapeRegExp).join("[\\s._-]+"));
44
+ this.entries.set(person.ref, {
45
+ ref: person.ref,
46
+ full,
47
+ first,
48
+ pattern: alternatives.length > 0 ? new RegExp(`(?<![A-Za-z0-9])(?:${alternatives.join("|")})(?![A-Za-z0-9])`, "i") : null,
49
+ });
50
+ for (const name of full)
51
+ this.fullNames.set(name, [...(this.fullNames.get(name) ?? []), person.ref]);
52
+ if (person.onRoster) {
53
+ this.roster.push(person.ref);
54
+ if (first.length >= 3)
55
+ this.rosterFirst.set(first, [...(this.rosterFirst.get(first) ?? []), person.ref]);
56
+ }
57
+ }
58
+ }
59
+ /**
60
+ * The person a line starts with, or null. Candidates are the people the row
61
+ * is filed on first, then a full name known to the graph, then a first name
62
+ * only one roster member has.
63
+ */
64
+ lead(text, filedOn) {
65
+ const stripped = text.replace(/^\s*(?:Meeting:\s*)?/, "");
66
+ const tokens = stripped.split(/\s+/).slice(0, 4);
67
+ for (let take = Math.min(4, tokens.length); take >= 1; take--) {
68
+ const raw = tokens.slice(0, take).join(" ");
69
+ const candidate = normalizeName(raw.replace(/(?:'s|’s)?[:,.]?$/, ""));
70
+ if (candidate.length < 3)
71
+ continue;
72
+ const ref = this.match(candidate, filedOn);
73
+ if (ref) {
74
+ const consumed = new RegExp(`^(?:\\S+\\s+){${take - 1}}\\S+`).exec(stripped);
75
+ let rest = stripped.slice(consumed ? consumed[0].length : raw.length);
76
+ // The name ended inside the last token ("Corey's", "Hassaan:"): give the tail back.
77
+ const tail = /(?:['’]s|:)$/.exec(raw);
78
+ if (tail)
79
+ rest = `${tail[0]}${rest}`;
80
+ return { ref, rest: rest.replace(/^\s*\([^)]{0,80}\)/, "") };
81
+ }
82
+ }
83
+ return null;
84
+ }
85
+ match(candidate, filedOn) {
86
+ const filed = filedOn.filter((ref) => {
87
+ const entry = this.entries.get(ref);
88
+ return entry !== undefined && (entry.full.includes(candidate) || entry.first === candidate);
89
+ });
90
+ if (filed.length === 1)
91
+ return filed[0];
92
+ if (filed.length > 1) {
93
+ const exact = filed.filter((ref) => this.entries.get(ref)?.full.includes(candidate));
94
+ return exact.length === 1 ? exact[0] : null;
95
+ }
96
+ const full = this.fullNames.get(candidate);
97
+ if (full && full.length === 1 && candidate.includes(" "))
98
+ return full[0];
99
+ const first = this.rosterFirst.get(candidate);
100
+ if (first && first.length === 1)
101
+ return first[0];
102
+ return null;
103
+ }
104
+ /** Every candidate person named in the line, with where the name starts and ends. Candidates: filed-on people and the roster. */
105
+ mentions(text, filedOn) {
106
+ const found = [];
107
+ const firstNamesSeen = new Map();
108
+ const candidates = [...new Set([...filedOn, ...this.roster])];
109
+ for (const ref of candidates) {
110
+ const entry = this.entries.get(ref);
111
+ if (entry)
112
+ firstNamesSeen.set(entry.first, (firstNamesSeen.get(entry.first) ?? 0) + 1);
113
+ }
114
+ for (const ref of candidates) {
115
+ const entry = this.entries.get(ref);
116
+ if (!entry?.pattern)
117
+ continue;
118
+ const pattern = new RegExp(entry.pattern.source, "gi");
119
+ let match;
120
+ while ((match = pattern.exec(text)) !== null) {
121
+ const matched = normalizeName(match[0]);
122
+ // "will", "mark", "joy": a name in running text is capitalized; the lower-case word is not a person.
123
+ if (!/^\p{Lu}/u.test(match[0]))
124
+ continue;
125
+ // A bare first name shared by two candidates names neither.
126
+ if (matched === entry.first && !entry.full.includes(matched) && (firstNamesSeen.get(entry.first) ?? 0) > 1)
127
+ continue;
128
+ found.push({ ref, start: match.index, end: match.index + match[0].length });
129
+ }
130
+ }
131
+ found.sort((a, b) => a.start - b.start || b.end - a.end);
132
+ // Drop a shorter match inside a longer one (a first name inside the full name of someone else).
133
+ const kept = [];
134
+ for (const item of found) {
135
+ const last = kept[kept.length - 1];
136
+ if (last && item.start < last.end)
137
+ continue;
138
+ kept.push(item);
139
+ }
140
+ return kept;
141
+ }
142
+ }
143
+ // ---------------------------------------------------------------------------
144
+ // What a line says the lead person did
145
+ // ---------------------------------------------------------------------------
146
+ const OWNS_ACTION = /^(?:['’]s)?\s*(?::|to\b|will\b|should\b|must\b|needs? to\b|is to\b|has to\b|agreed to\b|plans? to\b|was asked\b|is asked\b|is directed\b|was directed\b|is assigned\b|was assigned\b|is responsible\b|owns\b)/i;
147
+ const AND_SECOND = /^\s*(?:and|&|,)\s+/i;
148
+ /** True when the text after a leading name reads as that person's own to-do. */
149
+ export function ownsAction(rest) {
150
+ return OWNS_ACTION.test(rest);
151
+ }
152
+ /** "X and Y to ...": true when the text after X continues with a second owner. */
153
+ export function continuesWithSecondOwner(rest) {
154
+ return AND_SECOND.test(rest);
155
+ }
156
+ const LED = /\b(led|leads|ran|chaired|facilitated|hosted|drove|moderated|kicked off|opened)\b/i;
157
+ const PRESENTED = /\b(presented|demoed|demo['’]d|gave (?:a|the) (?:[a-z]+ )?demo|walked [^.]{0,60} through|pitched|onboarded|showcased)\b/i;
158
+ export function saysLed(rest) {
159
+ return LED.test(rest.split(/\s+/).slice(0, 14).join(" "));
160
+ }
161
+ export function saysPresented(rest) {
162
+ return PRESENTED.test(rest.split(/\s+/).slice(0, 18).join(" "));
163
+ }
164
+ /** The sentence of `text` around position `at`, so a long summary is cited by the part that says it. */
165
+ export function excerptAt(text, at, max = 220) {
166
+ const before = text.slice(0, at);
167
+ const start = Math.max(before.lastIndexOf(". "), before.lastIndexOf("; ")) + 1;
168
+ const from = start > 0 ? start + 1 : 0;
169
+ return clip(`${from > 0 ? "…" : ""}${text.slice(from)}`, max);
170
+ }
171
+ const ASSIGN_BETWEEN = /^\s*(?:\([^)]{0,60}\)\s*)?(?:has |had |also |then |explicitly |directly |again )*(?:asked|directed|assigned|instructed|tasked|told|requested|requests|delegated(?: to)?|wants|expects|urged|pushed|needs)\s+$/i;
172
+ const ASSIGN_AFTER = /^\s*(?:to|with|that)\b/i;
173
+ const HANDED_BETWEEN = /^\s*(?:\([^)]{0,60}\)\s*)?(?:has |had |also )*(?:assigned|delegated|handed(?: off| over)?|gave|passed)\b[^.;]{0,80}\bto\s+$/i;
174
+ const PASSIVE_BETWEEN = /^\s*(?:was|is|were|got)\s+(?:asked|directed|assigned|instructed|tasked|told)\s+by\s+$/i;
175
+ const PER_BEFORE = /\b(?:per|at|on|following)\s+$/i;
176
+ const PER_AFTER = /^(?:['’]s)?\s*(?:request|direction|instruction|instructions|guidance|ask|call|decision)\b/i;
177
+ const APPROVE_AFTER = /^\s*(?:\([^)]{0,60}\)\s*)?(?:has |had |also )*(?:approved|signed off on|greenlit|green-lit|okayed|authorized|merged|accepted)\b/i;
178
+ const SIGNOFF_BEFORE = /\b(?:pending|awaiting|await|needs|need|requires|require|waiting on|waiting for|subject to|get|gets|getting|for|with|after)\s+$/i;
179
+ const SIGNOFF_AFTER = /^(?:['’]s)?\s*(?:approval|sign-?off|review|go-ahead|confirmation|decision|blessing|ok)\b/i;
180
+ const SIGNOFF_FROM_BEFORE = /\b(?:approval|sign-?off|go-ahead|confirmation|review)\s+(?:from|by)\s+$/i;
181
+ const REVIEWS_AFTER = /^\s*(?:to|will|should|must|needs? to)\s+(?:review|approve|sign off on|merge|qa)\b/i;
182
+ /**
183
+ * Directing relations stated in one line. `lead` is the person the line starts
184
+ * with, when there is one; `mentions` is every candidate named, in order.
185
+ */
186
+ export function directHits(text, lead, mentions) {
187
+ const hits = [];
188
+ const add = (kind, from, to, at) => {
189
+ if (from === to)
190
+ return;
191
+ if (!hits.some((hit) => hit.kind === kind && hit.from === from && hit.to === to))
192
+ hits.push({ kind, from, to, at });
193
+ };
194
+ for (let i = 0; i < mentions.length; i++) {
195
+ const x = mentions[i];
196
+ const before = text.slice(Math.max(0, x.start - 40), x.start);
197
+ const after = text.slice(x.end, x.end + 80);
198
+ // "pending X's approval", "sign-off from X": X is asked for sign-off on the lead person's work.
199
+ if (lead && lead !== x.ref && ((SIGNOFF_BEFORE.test(before) && SIGNOFF_AFTER.test(after)) || SIGNOFF_FROM_BEFORE.test(before)))
200
+ add("signoff", x.ref, lead, x.start);
201
+ // "per X's request": the lead person acts on X's direction.
202
+ if (lead && lead !== x.ref && PER_BEFORE.test(before) && PER_AFTER.test(after))
203
+ add("assigns", x.ref, lead, x.start);
204
+ for (let j = i + 1; j < mentions.length; j++) {
205
+ const y = mentions[j];
206
+ if (y.ref === x.ref)
207
+ continue;
208
+ const between = text.slice(x.end, y.start);
209
+ if (between.length > 110 || /[.;]\s/.test(between))
210
+ break;
211
+ const afterY = text.slice(y.end, y.end + 30);
212
+ if (ASSIGN_BETWEEN.test(between) && ASSIGN_AFTER.test(afterY))
213
+ add("assigns", x.ref, y.ref, x.start);
214
+ else if (HANDED_BETWEEN.test(between))
215
+ add("assigns", x.ref, y.ref, x.start);
216
+ else if (PASSIVE_BETWEEN.test(between))
217
+ add("assigns", y.ref, x.ref, x.start);
218
+ else if (APPROVE_AFTER.test(between) && /^(?:['’]s)\b/.test(afterY))
219
+ add("approves", x.ref, y.ref, x.start);
220
+ else if (REVIEWS_AFTER.test(between) && /^(?:['’]s)\b/.test(afterY))
221
+ add("reviews", x.ref, y.ref, x.start);
222
+ }
223
+ }
224
+ return hits;
225
+ }
226
+ /** After a leading name in a decision line: the decision tells that person what to do. */
227
+ export const DECISION_DIRECTS = /^(?:['’]s)?\s*(?:is directed to|was directed to|is to\b|will\b|to\b|should\b|must\b|needs? to\b|is assigned\b|is responsible\b|is tasked\b)/i;
228
+ // ---------------------------------------------------------------------------
229
+ // Areas
230
+ // ---------------------------------------------------------------------------
231
+ /**
232
+ * Words that place a line in an area of work. Generic business vocabulary; a
233
+ * line can fall in several areas and then counts a share in each.
234
+ */
235
+ const AREA_WORDS = {
236
+ engineering: /\b(prs?|pull requests?|merge[ds]?|deploy(?:ed|ment|s|ing)?|release(?:d|s)?|ci|bug(?:s|fix)?|fix(?:ed|es)?|api|backend|frontend|infra(?:structure)?|database|migration|staging|production|repo|branch|commits?|refactor|server|lambda|sdk|cli|auth|tokens?|schema|endpoint|hotfix|rollback|regression|e2e|installer|pipeline run|typecheck|codebase)\b/i,
237
+ product: /\b(prd|roadmap|specs?|features?|ux|user flow|prioriti[sz]e[ds]?|requirements?|backlog|prototype|wireframe|onboarding flow|product direction|scope[ds]?)\b/i,
238
+ design: /\b(design(?:s|ed|ing|er)?|logo|favicon|figma|brand(?:ing)?|visual(?:s)?|typography|illustration|mockups?)\b/i,
239
+ sales: /\b(deals?|prospects?|demo(?:s|ed)?|proposals?|pricing|contracts?|quotes?|outreach|renewal|upsell|discovery call|sales|partnerships?|referrals?|sow|pilot|close the|closing)\b/i,
240
+ marketing: /\b(marketing|content|campaigns?|newsletter|linkedin|twitter|social media|case stud(?:y|ies)|landing page|seo|webinar|launch(?:ed|es)?|copy(?:writing)?|blog|press|creators?|podcast|ad creative|paid media)\b/i,
241
+ customer: /\b(customers?|clients?|onboard(?:ed|ing)?|support|tickets?|feedback|training|workshop|kickoff|check-?in|churn|white-?glove|implementation call)\b/i,
242
+ operations: /\b(hiring|recruit(?:ing|er)?|payroll|legal|finance|accounting|budget|compliance|contractor|insurance|tax(?:es)?|fundrais(?:e|ing)|investors?|equity|stock options?|billing|invoices?|bank|runway)\b/i,
243
+ };
244
+ /** The share of one line in each area. Empty when no area word is in it. */
245
+ export function areasOf(text) {
246
+ const hit = AREAS.filter((area) => AREA_WORDS[area].test(text));
247
+ if (hit.length === 0)
248
+ return {};
249
+ const share = 1 / hit.length;
250
+ return Object.fromEntries(hit.map((area) => [area, share]));
251
+ }
252
+ /** The areas a stated title points at, by the words in it. Empty when the title names no area. */
253
+ const TITLE_AREAS = [
254
+ { pattern: /\b(engineer(?:ing)?|developer|cto|architect|programmer|devops|sre|technical|backend|frontend|full[- ]?stack)\b/i, areas: ["engineering"] },
255
+ { pattern: /\b(product)\b/i, areas: ["product"] },
256
+ { pattern: /\b(design(?:er)?|creative|brand)\b/i, areas: ["design"] },
257
+ { pattern: /\b(gtm|sales|partnerships?|account executive|business development|bd|revenue|growth)\b/i, areas: ["sales", "customer"] },
258
+ { pattern: /\b(marketing|events?|content|copywriter|community|social)\b/i, areas: ["marketing"] },
259
+ { pattern: /\b(customer|success|support|onboarding|forward deployed|fde|implementation)\b/i, areas: ["customer"] },
260
+ { pattern: /\b(operations|ops|finance|legal|counsel|people|hr|coo|cfo)\b/i, areas: ["operations"] },
261
+ { pattern: /\b(ceo|founder|co-?founder|president|owner|chief executive|head of|director|vp|manager)\b/i, areas: [], leads: true },
262
+ { pattern: /\b(advisor|adviser|consultant|investor|board member)\b/i, areas: [], light: true },
263
+ ];
264
+ export function readTitle(title) {
265
+ const areas = new Set();
266
+ let leads = false;
267
+ let light = false;
268
+ for (const rule of TITLE_AREAS) {
269
+ if (!rule.pattern.test(title))
270
+ continue;
271
+ for (const area of rule.areas)
272
+ areas.add(area);
273
+ if (rule.leads)
274
+ leads = true;
275
+ if (rule.light)
276
+ light = true;
277
+ }
278
+ return { areas: [...areas], leads, light };
279
+ }
280
+ /** Words a role description may not use: it describes work, it never awards a title. */
281
+ export const TITLE_WORDS = /\b(ceo|cto|coo|cfo|cmo|chief [a-z]+ officer|vice president|vp of|head of|director of|manager of|team lead|tech lead|lead engineer|principal engineer|senior engineer|staff engineer|founder|co-?founder|president)\b/i;
282
+ /**
283
+ * True when a weekly commit row lists only housekeeping subjects (chore, ci, build, merge, version bump).
284
+ * Such a week is usually a script committing under a person's name, so it says little about what the person did.
285
+ */
286
+ export function looksAutomated(text) {
287
+ const at = text.indexOf(": ");
288
+ if (at < 0)
289
+ return false;
290
+ const subjects = text.slice(at + 2).split(/;\s+/).map((subject) => subject.trim()).filter(Boolean);
291
+ if (subjects.length === 0)
292
+ return false;
293
+ return subjects.every((subject) => /^(?:chore|ci|build)(?:\(|:)|^merge\b|^bump\b|^release\b|^revert\b/i.test(subject));
294
+ }
295
+ /** True when `name` appears in `text` as whole words. */
296
+ export function namesSubject(text, name) {
297
+ const wanted = normalizeName(name);
298
+ if (wanted.length < 3)
299
+ return false;
300
+ return ` ${normalizeName(text)} `.includes(` ${wanted} `);
301
+ }
302
+ /** Jaccard similarity of the word sets of two lines, for folding a row two signals wrote twice. */
303
+ export function similarity(a, b) {
304
+ const wordsOf = (text) => new Set(normalizeName(text).split(" ").filter((word) => word.length > 2));
305
+ const left = wordsOf(a);
306
+ const right = wordsOf(b);
307
+ if (left.size === 0 || right.size === 0)
308
+ return 0;
309
+ let shared = 0;
310
+ for (const word of left)
311
+ if (right.has(word))
312
+ shared += 1;
313
+ return shared / (left.size + right.size - shared);
314
+ }
315
+ //# sourceMappingURL=text.js.map