@indigoai-us/hq-cli 5.345.247 → 5.345.250

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 (284) hide show
  1. package/CHANGELOG.md +95 -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 +1198 -0
  5. package/dist/command-catalog.generated.js +1476 -0
  6. package/dist/command-registration-plan.d.ts +6 -0
  7. package/dist/command-registration-plan.js +1 -0
  8. package/dist/commands/core-job-run-native.js +4 -0
  9. package/dist/commands/core-knowledge-prefs.d.ts +1 -1
  10. package/dist/commands/core-knowledge-prefs.js +1 -16
  11. package/dist/commands/core.js +0 -2
  12. package/dist/commands/daemon.js +21 -0
  13. package/dist/commands/lanes-hold.js +7 -7
  14. package/dist/commands/lanes-resume.js +2 -2
  15. package/dist/commands/lanes-review.js +1 -1
  16. package/dist/commands/lanes-session-start.d.ts +1 -1
  17. package/dist/commands/lanes-session-start.js +3 -3
  18. package/dist/commands/lanes-shared.d.ts +1 -1
  19. package/dist/commands/lanes.d.ts +2 -2
  20. package/dist/commands/lanes.js +50 -50
  21. package/dist/commands/mesh.d.ts +25 -0
  22. package/dist/commands/mesh.js +48 -8
  23. package/dist/commands/ontology-graph.d.ts +63 -0
  24. package/dist/commands/ontology-graph.js +470 -0
  25. package/dist/commands/sync-core.js +6 -0
  26. package/dist/fast-scaffold.js +1 -3
  27. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +281 -256
  28. package/dist/hq-cloud-sync-runner/package.json +1 -1
  29. package/dist/index.d.ts +8 -0
  30. package/dist/index.js +48 -1
  31. package/dist/lanes-monitor-check-argv.d.ts +1 -1
  32. package/dist/lanes-monitor-check-argv.js +1 -1
  33. package/dist/lanes-monitor-check-fast.d.ts +1 -1
  34. package/dist/lanes-monitor-check-fast.js +1 -1
  35. package/dist/lanes-session-start-argv.d.ts +1 -1
  36. package/dist/lanes-session-start-argv.js +1 -1
  37. package/dist/lib/capacity/sign-in.d.ts +1 -1
  38. package/dist/lib/capacity/sign-in.js +1 -1
  39. package/dist/lib/daemon/hook-requests-conduct-link.js +2 -2
  40. package/dist/lib/daemon/installed-cli-restart.d.ts +57 -0
  41. package/dist/lib/daemon/installed-cli-restart.js +114 -0
  42. package/dist/lib/daemon/lanes-monitor-state.d.ts +2 -2
  43. package/dist/lib/daemon/lanes-monitor-state.js +2 -2
  44. package/dist/lib/daemon/legacy-journal-gate.d.ts +32 -0
  45. package/dist/lib/daemon/legacy-journal-gate.js +102 -0
  46. package/dist/lib/daemon/machine-checks.d.ts +7 -0
  47. package/dist/lib/daemon/machine-checks.js +10 -0
  48. package/dist/lib/daemon/merge-sections.d.ts +3 -3
  49. package/dist/lib/daemon/merge-sections.js +7 -7
  50. package/dist/lib/daemon/remote-control-pools.js +1 -1
  51. package/dist/lib/daemon/run.d.ts +3 -1
  52. package/dist/lib/daemon/run.js +49 -6
  53. package/dist/lib/daemon/state-file.d.ts +1 -1
  54. package/dist/lib/daemon/state-file.js +1 -1
  55. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  56. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  57. package/dist/lib/flag-snapshot-file.d.ts +2 -0
  58. package/dist/lib/flag-snapshot-file.js +118 -48
  59. package/dist/lib/hook-engine/canary-gate.d.ts +57 -3
  60. package/dist/lib/hook-engine/canary-gate.js +138 -6
  61. package/dist/lib/hook-engine/coverage.d.ts +82 -13
  62. package/dist/lib/hook-engine/coverage.js +214 -18
  63. package/dist/lib/hook-engine/registration-identity.d.ts +5 -0
  64. package/dist/lib/hook-engine/registration-identity.js +1 -1
  65. package/dist/lib/hook-engine/resolve.d.ts +23 -0
  66. package/dist/lib/hook-engine/resolve.js +48 -1
  67. package/dist/lib/hook-engine/stable-heal.d.ts +87 -0
  68. package/dist/lib/hook-engine/stable-heal.js +214 -0
  69. package/dist/lib/hot-channels/graph-context.d.ts +105 -0
  70. package/dist/lib/hot-channels/graph-context.js +380 -0
  71. package/dist/lib/hot-channels/signals-pass.js +27 -1
  72. package/dist/lib/lanes/claude-credential.d.ts +1 -1
  73. package/dist/lib/lanes/claude-credential.js +1 -1
  74. package/dist/lib/lanes/delivery-core.d.ts +1 -1
  75. package/dist/lib/lanes/delivery-core.js +1 -1
  76. package/dist/lib/lanes/delivery.d.ts +10 -10
  77. package/dist/lib/lanes/delivery.js +8 -8
  78. package/dist/lib/lanes/dropbox.d.ts +1 -1
  79. package/dist/lib/lanes/dropbox.js +1 -1
  80. package/dist/lib/lanes/hooks-install.js +2 -2
  81. package/dist/lib/lanes/index.d.ts +1 -1
  82. package/dist/lib/lanes/index.js +1 -1
  83. package/dist/lib/lanes/monitor.js +1 -1
  84. package/dist/lib/lanes/quota-notice.js +1 -1
  85. package/dist/lib/lanes/quota.d.ts +1 -1
  86. package/dist/lib/lanes/quota.js +1 -1
  87. package/dist/lib/lanes/repo-merge-hold.d.ts +2 -2
  88. package/dist/lib/lanes/repo-merge-hold.js +2 -2
  89. package/dist/lib/lanes/spawn.d.ts +4 -4
  90. package/dist/lib/lanes/spawn.js +5 -5
  91. package/dist/lib/mesh/live/company-flag-refresh.d.ts +61 -0
  92. package/dist/lib/mesh/live/company-flag-refresh.js +159 -0
  93. package/dist/lib/mesh/live/company-reporting-gaps.d.ts +61 -0
  94. package/dist/lib/mesh/live/company-reporting-gaps.js +238 -0
  95. package/dist/lib/mesh/live/daemon/duplicate-unit.d.ts +156 -0
  96. package/dist/lib/mesh/live/daemon/duplicate-unit.js +616 -0
  97. package/dist/lib/mesh/live/daemon/run.d.ts +13 -0
  98. package/dist/lib/mesh/live/daemon/run.js +35 -2
  99. package/dist/lib/mesh/live/direct-drain.js +1 -1
  100. package/dist/lib/mesh/live/emit.d.ts +3 -0
  101. package/dist/lib/mesh/live/emit.js +32 -9
  102. package/dist/lib/mesh/live/flush.d.ts +3 -0
  103. package/dist/lib/mesh/live/flush.js +115 -32
  104. package/dist/lib/mesh/live/liveness-carry.d.ts +1 -1
  105. package/dist/lib/mesh/live/liveness-carry.js +1 -1
  106. package/dist/lib/mesh/live/reporting-privacy.d.ts +119 -3
  107. package/dist/lib/mesh/live/reporting-privacy.js +235 -11
  108. package/dist/lib/mesh/live/spool.d.ts +17 -2
  109. package/dist/lib/mesh/live/spool.js +22 -6
  110. package/dist/lib/ontology-graph/legacy/coverage.d.ts +67 -0
  111. package/dist/lib/ontology-graph/legacy/coverage.js +192 -0
  112. package/dist/lib/ontology-graph/legacy/index.d.ts +199 -0
  113. package/dist/lib/ontology-graph/legacy/index.js +1150 -0
  114. package/dist/lib/ontology-graph/legacy/parse.d.ts +49 -0
  115. package/dist/lib/ontology-graph/legacy/parse.js +126 -0
  116. package/dist/lib/ontology-graph/legacy/report.d.ts +14 -0
  117. package/dist/lib/ontology-graph/legacy/report.js +254 -0
  118. package/dist/lib/ontology-graph/legacy/verb-map.d.ts +35 -0
  119. package/dist/lib/ontology-graph/legacy/verb-map.js +84 -0
  120. package/dist/lib/ontology-graph/lint/checks.d.ts +140 -0
  121. package/dist/lib/ontology-graph/lint/checks.js +717 -0
  122. package/dist/lib/ontology-graph/lint/coverage.d.ts +106 -0
  123. package/dist/lib/ontology-graph/lint/coverage.js +241 -0
  124. package/dist/lib/ontology-graph/lint/daily-job.d.ts +259 -0
  125. package/dist/lib/ontology-graph/lint/daily-job.js +595 -0
  126. package/dist/lib/ontology-graph/lint/index.d.ts +65 -0
  127. package/dist/lib/ontology-graph/lint/index.js +176 -0
  128. package/dist/lib/ontology-graph/model/files.d.ts +20 -0
  129. package/dist/lib/ontology-graph/model/files.js +89 -0
  130. package/dist/lib/ontology-graph/model/index.d.ts +65 -0
  131. package/dist/lib/ontology-graph/model/index.js +100 -0
  132. package/dist/lib/ontology-graph/model/pass-tasks.d.ts +156 -0
  133. package/dist/lib/ontology-graph/model/pass-tasks.js +345 -0
  134. package/dist/lib/ontology-graph/model/pass.d.ts +109 -0
  135. package/dist/lib/ontology-graph/model/pass.js +958 -0
  136. package/dist/lib/ontology-graph/model/runner.d.ts +50 -0
  137. package/dist/lib/ontology-graph/model/runner.js +160 -0
  138. package/dist/lib/ontology-graph/model/step.d.ts +197 -0
  139. package/dist/lib/ontology-graph/model/step.js +526 -0
  140. package/dist/lib/ontology-graph/model/tasks.d.ts +183 -0
  141. package/dist/lib/ontology-graph/model/tasks.js +349 -0
  142. package/dist/lib/ontology-graph/not-implemented.d.ts +5 -0
  143. package/dist/lib/ontology-graph/not-implemented.js +8 -0
  144. package/dist/lib/ontology-graph/org/compare.d.ts +28 -0
  145. package/dist/lib/ontology-graph/org/compare.js +239 -0
  146. package/dist/lib/ontology-graph/org/derive.d.ts +67 -0
  147. package/dist/lib/ontology-graph/org/derive.js +359 -0
  148. package/dist/lib/ontology-graph/org/index.d.ts +102 -0
  149. package/dist/lib/ontology-graph/org/index.js +630 -0
  150. package/dist/lib/ontology-graph/org/load.d.ts +31 -0
  151. package/dist/lib/ontology-graph/org/load.js +476 -0
  152. package/dist/lib/ontology-graph/org/role.d.ts +38 -0
  153. package/dist/lib/ontology-graph/org/role.js +268 -0
  154. package/dist/lib/ontology-graph/org/structure.d.ts +63 -0
  155. package/dist/lib/ontology-graph/org/structure.js +437 -0
  156. package/dist/lib/ontology-graph/org/text.d.ts +97 -0
  157. package/dist/lib/ontology-graph/org/text.js +321 -0
  158. package/dist/lib/ontology-graph/org/types.d.ts +457 -0
  159. package/dist/lib/ontology-graph/org/types.js +80 -0
  160. package/dist/lib/ontology-graph/pages/index.d.ts +64 -0
  161. package/dist/lib/ontology-graph/pages/index.js +193 -0
  162. package/dist/lib/ontology-graph/pages/render.d.ts +144 -0
  163. package/dist/lib/ontology-graph/pages/render.js +688 -0
  164. package/dist/lib/ontology-graph/proposals/apply.d.ts +109 -0
  165. package/dist/lib/ontology-graph/proposals/apply.js +468 -0
  166. package/dist/lib/ontology-graph/proposals/group.d.ts +63 -0
  167. package/dist/lib/ontology-graph/proposals/group.js +232 -0
  168. package/dist/lib/ontology-graph/proposals/index.d.ts +173 -0
  169. package/dist/lib/ontology-graph/proposals/index.js +474 -0
  170. package/dist/lib/ontology-graph/proposals/model.d.ts +162 -0
  171. package/dist/lib/ontology-graph/proposals/model.js +196 -0
  172. package/dist/lib/ontology-graph/proposals/org-chart.d.ts +82 -0
  173. package/dist/lib/ontology-graph/proposals/org-chart.js +340 -0
  174. package/dist/lib/ontology-graph/read/brief.d.ts +26 -0
  175. package/dist/lib/ontology-graph/read/brief.js +254 -0
  176. package/dist/lib/ontology-graph/read/graph-index.d.ts +76 -0
  177. package/dist/lib/ontology-graph/read/graph-index.js +198 -0
  178. package/dist/lib/ontology-graph/read/index.d.ts +59 -0
  179. package/dist/lib/ontology-graph/read/index.js +803 -0
  180. package/dist/lib/ontology-graph/read/member.d.ts +7 -0
  181. package/dist/lib/ontology-graph/read/member.js +34 -0
  182. package/dist/lib/ontology-graph/read/names.d.ts +49 -0
  183. package/dist/lib/ontology-graph/read/names.js +297 -0
  184. package/dist/lib/ontology-graph/read/reader-setting.d.ts +19 -0
  185. package/dist/lib/ontology-graph/read/reader-setting.js +62 -0
  186. package/dist/lib/ontology-graph/read/test-graph.d.ts +37 -0
  187. package/dist/lib/ontology-graph/read/test-graph.js +150 -0
  188. package/dist/lib/ontology-graph/replay/buffered-store.d.ts +33 -0
  189. package/dist/lib/ontology-graph/replay/buffered-store.js +50 -0
  190. package/dist/lib/ontology-graph/replay/config.d.ts +41 -0
  191. package/dist/lib/ontology-graph/replay/config.js +105 -0
  192. package/dist/lib/ontology-graph/replay/engine.d.ts +146 -0
  193. package/dist/lib/ontology-graph/replay/engine.js +1240 -0
  194. package/dist/lib/ontology-graph/replay/extractors.d.ts +59 -0
  195. package/dist/lib/ontology-graph/replay/extractors.js +1555 -0
  196. package/dist/lib/ontology-graph/replay/index.d.ts +91 -0
  197. package/dist/lib/ontology-graph/replay/index.js +220 -0
  198. package/dist/lib/ontology-graph/replay/listing-manifest.d.ts +66 -0
  199. package/dist/lib/ontology-graph/replay/listing-manifest.js +242 -0
  200. package/dist/lib/ontology-graph/replay/member.d.ts +19 -0
  201. package/dist/lib/ontology-graph/replay/member.js +65 -0
  202. package/dist/lib/ontology-graph/replay/mentions.d.ts +58 -0
  203. package/dist/lib/ontology-graph/replay/mentions.js +239 -0
  204. package/dist/lib/ontology-graph/replay/readers.d.ts +98 -0
  205. package/dist/lib/ontology-graph/replay/readers.js +1251 -0
  206. package/dist/lib/ontology-graph/replay/rules.d.ts +127 -0
  207. package/dist/lib/ontology-graph/replay/rules.js +374 -0
  208. package/dist/lib/ontology-graph/replay/scope.d.ts +35 -0
  209. package/dist/lib/ontology-graph/replay/scope.js +115 -0
  210. package/dist/lib/ontology-graph/replay/transcripts.d.ts +39 -0
  211. package/dist/lib/ontology-graph/replay/transcripts.js +224 -0
  212. package/dist/lib/ontology-graph/replay/util.d.ts +55 -0
  213. package/dist/lib/ontology-graph/replay/util.js +256 -0
  214. package/dist/lib/ontology-graph/resolve/entity-index.d.ts +159 -0
  215. package/dist/lib/ontology-graph/resolve/entity-index.js +652 -0
  216. package/dist/lib/ontology-graph/resolve/index.d.ts +113 -0
  217. package/dist/lib/ontology-graph/resolve/index.js +214 -0
  218. package/dist/lib/ontology-graph/resolve/machine.d.ts +34 -0
  219. package/dist/lib/ontology-graph/resolve/machine.js +95 -0
  220. package/dist/lib/ontology-graph/resolve/normalize.d.ts +35 -0
  221. package/dist/lib/ontology-graph/resolve/normalize.js +124 -0
  222. package/dist/lib/ontology-graph/resolve/org-chart.d.ts +107 -0
  223. package/dist/lib/ontology-graph/resolve/org-chart.js +578 -0
  224. package/dist/lib/ontology-graph/resolve/org-layer.d.ts +78 -0
  225. package/dist/lib/ontology-graph/resolve/org-layer.js +159 -0
  226. package/dist/lib/ontology-graph/resolve/org-seed.d.ts +141 -0
  227. package/dist/lib/ontology-graph/resolve/org-seed.js +631 -0
  228. package/dist/lib/ontology-graph/resolve/org-sources.d.ts +165 -0
  229. package/dist/lib/ontology-graph/resolve/org-sources.js +634 -0
  230. package/dist/lib/ontology-graph/resolve/roster.d.ts +76 -0
  231. package/dist/lib/ontology-graph/resolve/roster.js +226 -0
  232. package/dist/lib/ontology-graph/resolve/seed.d.ts +267 -0
  233. package/dist/lib/ontology-graph/resolve/seed.js +1198 -0
  234. package/dist/lib/ontology-graph/resolve/upsert.d.ts +58 -0
  235. package/dist/lib/ontology-graph/resolve/upsert.js +139 -0
  236. package/dist/lib/ontology-graph/resolve/writer.d.ts +128 -0
  237. package/dist/lib/ontology-graph/resolve/writer.js +351 -0
  238. package/dist/lib/ontology-graph/schema/authority.d.ts +107 -0
  239. package/dist/lib/ontology-graph/schema/authority.js +186 -0
  240. package/dist/lib/ontology-graph/schema/default-schema.d.ts +10 -0
  241. package/dist/lib/ontology-graph/schema/default-schema.js +242 -0
  242. package/dist/lib/ontology-graph/schema/grammar.d.ts +57 -0
  243. package/dist/lib/ontology-graph/schema/grammar.js +409 -0
  244. package/dist/lib/ontology-graph/schema/index.d.ts +12 -0
  245. package/dist/lib/ontology-graph/schema/index.js +10 -0
  246. package/dist/lib/ontology-graph/schema/validate.d.ts +13 -0
  247. package/dist/lib/ontology-graph/schema/validate.js +132 -0
  248. package/dist/lib/ontology-graph/store/files.d.ts +34 -0
  249. package/dist/lib/ontology-graph/store/files.js +207 -0
  250. package/dist/lib/ontology-graph/store/fs.d.ts +30 -0
  251. package/dist/lib/ontology-graph/store/fs.js +101 -0
  252. package/dist/lib/ontology-graph/store/graph-store.d.ts +14 -0
  253. package/dist/lib/ontology-graph/store/graph-store.js +520 -0
  254. package/dist/lib/ontology-graph/store/index.d.ts +18 -0
  255. package/dist/lib/ontology-graph/store/index.js +15 -0
  256. package/dist/lib/ontology-graph/store/ingest.d.ts +37 -0
  257. package/dist/lib/ontology-graph/store/ingest.js +323 -0
  258. package/dist/lib/ontology-graph/store/paths.d.ts +114 -0
  259. package/dist/lib/ontology-graph/store/paths.js +232 -0
  260. package/dist/lib/ontology-graph/types.d.ts +1190 -0
  261. package/dist/lib/ontology-graph/types.js +131 -0
  262. package/dist/lib/secret-scan/gitleaks-rules.generated.js +1 -1
  263. package/dist/lib/sync-core/engine-holds.d.ts +1 -1
  264. package/dist/lib/sync-core/engine-holds.js +12 -2
  265. package/dist/lib/sync-core/hand-back.d.ts +2 -1
  266. package/dist/lib/sync-core/hand-back.js +16 -2
  267. package/dist/lib/sync-core/legacy-journal-export-child.d.ts +2 -0
  268. package/dist/lib/sync-core/legacy-journal-export-child.js +24 -0
  269. package/dist/lib/sync-core/legacy-journal-export.d.ts +39 -0
  270. package/dist/lib/sync-core/legacy-journal-export.js +241 -0
  271. package/dist/lib/sync-core/legacy-journal-reader.d.ts +15 -0
  272. package/dist/lib/sync-core/legacy-journal-reader.js +56 -0
  273. package/dist/lib/sync-core/reconcile.d.ts +3 -0
  274. package/dist/lib/sync-core/reconcile.js +43 -3
  275. package/dist/utils/cli-telemetry.d.ts +1 -0
  276. package/dist/utils/cli-telemetry.js +6 -3
  277. package/dist/utils/frontmatter.d.ts +14 -0
  278. package/dist/utils/frontmatter.js +18 -0
  279. package/dist/utils/hook-engine-rollup.d.ts +96 -0
  280. package/dist/utils/hook-engine-rollup.js +725 -0
  281. package/dist/utils/interactive-caller.js +1 -1
  282. package/package.json +9 -9
  283. package/scripts/install-hook-engine.mjs +4 -0
  284. package/assets/scaffold/core/scripts/knowledge-prefs.sh +0 -55
@@ -0,0 +1,437 @@
1
+ import { actInWindow, inWindow, subjectName } from "./derive.js";
2
+ import { recencyWeight } from "./text.js";
3
+ import { DIRECT_WEIGHT, ORG_WINDOWS, SKEW_WEIGHTS, } from "./types.js";
4
+ const zeroCounts = () => ({ "30d": 0, "90d": 0, "365d": 0, all: 0 });
5
+ function bump(counts, date, asOf) {
6
+ for (const window of ORG_WINDOWS)
7
+ if (inWindow(date, window, asOf))
8
+ counts[window] += 1;
9
+ }
10
+ /** Confidence from an amount of evidence: 0.2 with almost none, approaching 0.9. */
11
+ export function confidenceFrom(amount, scale) {
12
+ return Math.round(Math.min(0.9, 0.2 + 0.7 * (1 - Math.exp(-amount / scale))) * 100) / 100;
13
+ }
14
+ // ---------------------------------------------------------------------------
15
+ // Who acts as part of the organization
16
+ // ---------------------------------------------------------------------------
17
+ export const ACTS_INTERNAL = { commits: 5, meetings: 10, actions: 5 };
18
+ /**
19
+ * People on the roster, plus people who behave like team members without being
20
+ * on it: they commit to the company's repos, or they sit in the team's
21
+ * meetings and take actions there and no row places them at another company.
22
+ */
23
+ export function orgSet(graph, actsByPerson) {
24
+ const members = new Set();
25
+ const actsInternal = new Set();
26
+ for (const person of graph.people.values()) {
27
+ if (person.onRoster) {
28
+ members.add(person.ref);
29
+ continue;
30
+ }
31
+ let commits = 0;
32
+ let meetings = 0;
33
+ let actions = 0;
34
+ for (const item of actsByPerson.get(person.ref) ?? []) {
35
+ if (!actInWindow(item, "365d", graph.asOf) || SKEW_WEIGHTS[item.cls].others <= 0)
36
+ continue;
37
+ if (item.kind === "commits")
38
+ commits += item.count;
39
+ else if (item.kind === "meetings_attended" && item.meeting) {
40
+ const attendees = graph.meetings.get(item.meeting)?.attendees ?? [];
41
+ if (attendees.filter((ref) => graph.people.get(ref)?.onRoster).length >= 2)
42
+ meetings += 1;
43
+ }
44
+ else if (item.kind === "action_items" || item.kind === "decisions" || item.kind === "commitments")
45
+ actions += 1;
46
+ }
47
+ const elsewhere = person.external || person.employers.some((ref) => !graph.companies.get(ref)?.isSelf);
48
+ if (commits >= ACTS_INTERNAL.commits || (!elsewhere && meetings >= ACTS_INTERNAL.meetings && actions >= ACTS_INTERNAL.actions)) {
49
+ members.add(person.ref);
50
+ actsInternal.add(person.ref);
51
+ }
52
+ }
53
+ return { members, actsInternal };
54
+ }
55
+ // ---------------------------------------------------------------------------
56
+ // Who directs whom
57
+ // ---------------------------------------------------------------------------
58
+ /** The score one direction needs over the other before it is called a line and not two peers. */
59
+ export const DIRECTS_ASYMMETRY = 2;
60
+ export const DIRECTS_MIN_WEIGHT = 2;
61
+ export function buildDirects(graph, evidence, members) {
62
+ const sums = new Map();
63
+ const seen = new Set();
64
+ for (const item of evidence) {
65
+ if (!members.has(item.from) || !members.has(item.to))
66
+ continue;
67
+ const skew = SKEW_WEIGHTS[item.cls].structure;
68
+ if (skew <= 0)
69
+ continue;
70
+ const once = `${item.kind}|${item.from}|${item.to}|${item.src}`;
71
+ if (seen.has(once))
72
+ continue;
73
+ seen.add(once);
74
+ const key = `${item.from}|${item.to}`;
75
+ const sum = sums.get(key) ?? { from: item.from, to: item.to, score: 0, weight: 0, counts: zeroCounts(), byKind: {}, first: item.date, last: item.date, examples: [] };
76
+ sums.set(key, sum);
77
+ const base = DIRECT_WEIGHT[item.kind] * skew;
78
+ sum.weight += base;
79
+ sum.score += base * recencyWeight(item.date, graph.asOf);
80
+ bump(sum.counts, item.date, graph.asOf);
81
+ sum.byKind[item.kind] = (sum.byKind[item.kind] ?? 0) + 1;
82
+ if (item.date < sum.first)
83
+ sum.first = item.date;
84
+ if (item.date > sum.last)
85
+ sum.last = item.date;
86
+ sum.examples.push({ date: item.date, text: `[${item.kind}] ${item.text}`, src: item.src, cls: item.cls, strength: DIRECT_WEIGHT[item.kind] });
87
+ }
88
+ const edges = [];
89
+ for (const sum of sums.values()) {
90
+ const reverse = sums.get(`${sum.to}|${sum.from}`);
91
+ const reverseScore = reverse?.score ?? 0;
92
+ const onlyCarried = Object.keys(sum.byKind).every((kind) => kind === "carries_out");
93
+ const asymmetric = !onlyCarried && sum.weight >= DIRECTS_MIN_WEIGHT && sum.score >= DIRECTS_ASYMMETRY * reverseScore;
94
+ let conf = confidenceFrom(sum.weight, 4);
95
+ if (!asymmetric)
96
+ conf = Math.round(conf * 0.6 * 100) / 100;
97
+ if (onlyCarried)
98
+ conf = Math.min(conf, 0.4);
99
+ edges.push({
100
+ from: sum.from,
101
+ to: sum.to,
102
+ score: Math.round(sum.score * 100) / 100,
103
+ reverseScore: Math.round(reverseScore * 100) / 100,
104
+ counts: sum.counts,
105
+ byKind: sum.byKind,
106
+ first: sum.first,
107
+ last: sum.last,
108
+ conf,
109
+ asymmetric,
110
+ examples: sum.examples
111
+ .sort((a, b) => b.strength - a.strength || (a.date > b.date ? -1 : a.date < b.date ? 1 : 0))
112
+ .slice(0, 4)
113
+ .map(({ strength: _strength, ...example }) => example),
114
+ });
115
+ }
116
+ return edges.sort((a, b) => b.score - a.score || (a.from < b.from ? -1 : 1));
117
+ }
118
+ // ---------------------------------------------------------------------------
119
+ // Who works with whom
120
+ // ---------------------------------------------------------------------------
121
+ const MAX_MEETING_SIZE = 12;
122
+ const SHARED_SIGNAL_TYPES = new Set(["action_item", "decision", "commitment", "question", "summary"]);
123
+ export function buildCollaboration(graph, members) {
124
+ const sums = new Map();
125
+ const add = (x, y, kind, weight, example) => {
126
+ if (x === y || weight <= 0 || !members.has(x) || !members.has(y))
127
+ return;
128
+ const [a, b] = x < y ? [x, y] : [y, x];
129
+ const key = `${a}|${b}`;
130
+ const sum = sums.get(key) ?? { a, b, score: 0, counts: zeroCounts(), byKind: {}, first: example.date, last: example.date, examples: [] };
131
+ sums.set(key, sum);
132
+ sum.score += weight * recencyWeight(example.date, graph.asOf);
133
+ bump(sum.counts, example.date, graph.asOf);
134
+ sum.byKind[kind] = (sum.byKind[kind] ?? 0) + 1;
135
+ if (example.date < sum.first)
136
+ sum.first = example.date;
137
+ if (example.date > sum.last)
138
+ sum.last = example.date;
139
+ sum.examples.push(example);
140
+ };
141
+ const pairs = (people, each) => {
142
+ for (let i = 0; i < people.length; i++)
143
+ for (let j = i + 1; j < people.length; j++)
144
+ each(people[i], people[j]);
145
+ };
146
+ // A small meeting says more about two people than a large one: each pair gets 1 / (attendees - 1).
147
+ for (const meeting of graph.meetings.values()) {
148
+ const size = meeting.attendees.length;
149
+ if (size < 2 || size > MAX_MEETING_SIZE)
150
+ continue;
151
+ const example = { date: meeting.date, text: `${meeting.title} (${size} people)`, src: meeting.src, cls: "meeting" };
152
+ pairs(meeting.attendees, (x, y) => add(x, y, "meetings", 1 / (size - 1), example));
153
+ }
154
+ for (const event of graph.events) {
155
+ const skew = SKEW_WEIGHTS[event.cls].structure;
156
+ if (skew <= 0)
157
+ continue;
158
+ const size = event.people.length;
159
+ const example = { date: event.date, text: event.text.length > 160 ? `${event.text.slice(0, 159)}…` : event.text, src: event.src, cls: event.cls };
160
+ if (event.type === "slack-dm" && graph.member && size >= 1) {
161
+ for (const person of event.people)
162
+ add(graph.member, person, "dm", 0.5 * skew, example);
163
+ }
164
+ else if (event.cls === "thread" && size >= 2 && size <= 8) {
165
+ pairs(event.people, (x, y) => add(x, y, "threads", (0.5 * skew) / (size - 1), example));
166
+ }
167
+ else if ((event.cls === "signal" || event.cls === "member-dm") && SHARED_SIGNAL_TYPES.has(event.type) && size >= 2 && size <= 6) {
168
+ pairs(event.people, (x, y) => add(x, y, "signals", (0.5 * skew) / (size - 1), example));
169
+ }
170
+ }
171
+ // Two people committing to one repository in the same week.
172
+ const byRepoWeek = new Map();
173
+ for (const commit of graph.commits) {
174
+ if (!/@week-/.test(commit.src))
175
+ continue;
176
+ const entry = byRepoWeek.get(commit.src) ?? { people: new Set(), date: commit.date, src: commit.src, repo: commit.repo };
177
+ byRepoWeek.set(commit.src, entry);
178
+ entry.people.add(commit.person);
179
+ }
180
+ for (const entry of byRepoWeek.values()) {
181
+ const people = [...entry.people].sort();
182
+ if (people.length < 2 || people.length > 8)
183
+ continue;
184
+ pairs(people, (x, y) => add(x, y, "code", 0.5 / (people.length - 1), { date: entry.date, text: `Both committed to ${entry.repo} that week`, src: entry.src, cls: "code" }));
185
+ }
186
+ return [...sums.values()]
187
+ .map((sum) => ({
188
+ a: sum.a,
189
+ b: sum.b,
190
+ score: Math.round(sum.score * 100) / 100,
191
+ counts: sum.counts,
192
+ byKind: sum.byKind,
193
+ first: sum.first,
194
+ last: sum.last,
195
+ conf: confidenceFrom(sum.counts.all, 8),
196
+ examples: sum.examples.sort((x, y) => (x.date > y.date ? -1 : x.date < y.date ? 1 : 0)).slice(0, 3),
197
+ }))
198
+ .sort((x, y) => y.score - x.score || (x.a < y.a ? -1 : 1));
199
+ }
200
+ // ---------------------------------------------------------------------------
201
+ // Working groups: clusters of the collaboration graph
202
+ // ---------------------------------------------------------------------------
203
+ /** A bridge carries at least this share of all collaboration between two groups, and at least this much weight. */
204
+ export const BRIDGE_MIN_SHARE = 0.3;
205
+ export const BRIDGE_MIN_WEIGHT = 1;
206
+ /** Edges below this recency-weighted score are too thin to place anyone in a group. */
207
+ export const GROUP_MIN_EDGE = 0.5;
208
+ /**
209
+ * Greedy modularity clustering (Clauset, Newman, Moore): start with every
210
+ * person alone, repeatedly merge the two clusters whose merge raises
211
+ * modularity most, stop when no merge raises it. Deterministic: ties break on
212
+ * the smaller member name.
213
+ */
214
+ export function cluster(nodes, edges) {
215
+ const index = new Map(nodes.map((node, i) => [node, i]));
216
+ const total = edges.reduce((sum, edge) => sum + edge.weight, 0);
217
+ if (total <= 0)
218
+ return nodes.map((node) => [node]);
219
+ const communities = new Map(nodes.map((node, i) => [i, [node]]));
220
+ const degree = new Map(nodes.map((_, i) => [i, 0]));
221
+ const between = new Map();
222
+ const pairKey = (x, y) => (x < y ? `${x}|${y}` : `${y}|${x}`);
223
+ for (const edge of edges) {
224
+ const x = index.get(edge.a);
225
+ const y = index.get(edge.b);
226
+ if (x === undefined || y === undefined || x === y)
227
+ continue;
228
+ degree.set(x, (degree.get(x) ?? 0) + edge.weight);
229
+ degree.set(y, (degree.get(y) ?? 0) + edge.weight);
230
+ between.set(pairKey(x, y), (between.get(pairKey(x, y)) ?? 0) + edge.weight);
231
+ }
232
+ for (;;) {
233
+ let best = null;
234
+ for (const [key, weight] of between) {
235
+ const [x, y] = key.split("|").map(Number);
236
+ const gain = weight / total - ((degree.get(x) ?? 0) * (degree.get(y) ?? 0)) / (2 * total * total);
237
+ if (gain > 1e-9 && (best === null || gain > best.gain + 1e-12))
238
+ best = { x, y, gain };
239
+ }
240
+ if (!best)
241
+ break;
242
+ const { x, y } = best;
243
+ communities.set(x, [...(communities.get(x) ?? []), ...(communities.get(y) ?? [])]);
244
+ communities.delete(y);
245
+ degree.set(x, (degree.get(x) ?? 0) + (degree.get(y) ?? 0));
246
+ degree.delete(y);
247
+ between.delete(pairKey(x, y));
248
+ for (const [key, weight] of [...between]) {
249
+ const [p, q] = key.split("|").map(Number);
250
+ if (p !== y && q !== y)
251
+ continue;
252
+ const other = p === y ? q : p;
253
+ between.delete(key);
254
+ between.set(pairKey(x, other), (between.get(pairKey(x, other)) ?? 0) + weight);
255
+ }
256
+ }
257
+ return [...communities.values()].map((members) => members.sort()).sort((a, b) => b.length - a.length || (a[0] < b[0] ? -1 : 1));
258
+ }
259
+ export function buildGroups(graph, collaboration, actsByPerson, members) {
260
+ const window = "365d";
261
+ const edges = collaboration.filter((edge) => edge.counts[window] > 0 && edge.score >= GROUP_MIN_EDGE).map((edge) => ({ a: edge.a, b: edge.b, weight: edge.score }));
262
+ const nodes = [...new Set(edges.flatMap((edge) => [edge.a, edge.b]))].filter((ref) => members.has(ref)).sort();
263
+ if (nodes.length === 0)
264
+ return { groups: [], bridges: [] };
265
+ const clusters = cluster(nodes, edges);
266
+ // What each cluster works on: subjects of its members' acts, ranked by how much of that subject's activity is theirs.
267
+ const subjectTotals = new Map();
268
+ const subjectByCluster = clusters.map(() => new Map());
269
+ clusters.forEach((people, i) => {
270
+ for (const person of people) {
271
+ for (const item of actsByPerson.get(person) ?? []) {
272
+ if (!actInWindow(item, window, graph.asOf) || SKEW_WEIGHTS[item.cls].structure <= 0 || item.kind === "directions_received")
273
+ continue;
274
+ const weight = item.kind === "commits" ? Math.min(3, item.count * 0.2) : item.kind === "meetings_attended" ? 0.3 : 1;
275
+ for (const ref of item.subjects) {
276
+ subjectTotals.set(ref, (subjectTotals.get(ref) ?? 0) + weight);
277
+ const mine = subjectByCluster[i];
278
+ mine.set(ref, (mine.get(ref) ?? 0) + weight);
279
+ }
280
+ }
281
+ }
282
+ });
283
+ const memberOf = new Map();
284
+ clusters.forEach((people, i) => people.forEach((person) => memberOf.set(person, i)));
285
+ const inside = clusters.map(() => 0);
286
+ const touching = clusters.map(() => 0);
287
+ for (const edge of edges) {
288
+ const x = memberOf.get(edge.a);
289
+ const y = memberOf.get(edge.b);
290
+ if (x === undefined || y === undefined)
291
+ continue;
292
+ if (x === y)
293
+ inside[x] = inside[x] + edge.weight;
294
+ touching[x] = touching[x] + edge.weight;
295
+ if (x !== y)
296
+ touching[y] = touching[y] + edge.weight;
297
+ }
298
+ const groups = clusters.map((people, i) => {
299
+ const mine = subjectByCluster[i];
300
+ const ranked = [...mine]
301
+ .filter(([, count]) => count >= 2)
302
+ .map(([ref, count]) => ({ ref, name: subjectName(graph, ref), count: Math.round(count * 10) / 10, rank: count * (count / (subjectTotals.get(ref) ?? count)) }))
303
+ .sort((a, b) => b.rank - a.rank || (a.ref < b.ref ? -1 : 1))
304
+ .slice(0, 4)
305
+ .map(({ rank: _rank, ...subject }) => subject);
306
+ const cohesion = touching[i] > 0 ? inside[i] / touching[i] : 0;
307
+ const name = ranked.length > 0 ? `Works on ${ranked.slice(0, 3).map((subject) => subject.name).join(", ")}` : people.length === 1 ? "Works mostly alone" : "Works together; no shared subject stands out";
308
+ return {
309
+ id: `g${i + 1}`,
310
+ name,
311
+ members: people,
312
+ subjects: ranked,
313
+ cohesion: Math.round(cohesion * 100) / 100,
314
+ window,
315
+ conf: people.length < 2 ? 0.2 : confidenceFrom(inside[i] * cohesion, 3),
316
+ };
317
+ });
318
+ // Bridges: for each pair of groups, the people who carry most of the collaboration between them.
319
+ const bridges = [];
320
+ if (groups.length > 1) {
321
+ const crossTotal = new Map();
322
+ const carried = new Map();
323
+ const pairOf = (x, y) => (x < y ? `${x}|${y}` : `${y}|${x}`);
324
+ for (const edge of edges) {
325
+ const x = memberOf.get(edge.a);
326
+ const y = memberOf.get(edge.b);
327
+ if (x === undefined || y === undefined || x === y)
328
+ continue;
329
+ crossTotal.set(pairOf(x, y), (crossTotal.get(pairOf(x, y)) ?? 0) + edge.weight);
330
+ for (const [person, other] of [[edge.a, y], [edge.b, x]]) {
331
+ const mine = carried.get(person) ?? new Map();
332
+ carried.set(person, mine);
333
+ mine.set(other, (mine.get(other) ?? 0) + edge.weight);
334
+ }
335
+ }
336
+ for (const [person, mine] of carried) {
337
+ const home = memberOf.get(person);
338
+ const to = [...mine]
339
+ .map(([group, weight]) => ({ group: groups[group].id, weight, share: Math.round((weight / (crossTotal.get(pairOf(home, group)) ?? weight)) * 100) / 100 }))
340
+ .filter((item) => item.share >= BRIDGE_MIN_SHARE && item.weight >= BRIDGE_MIN_WEIGHT)
341
+ .sort((x, y) => y.share - x.share || (x.group < y.group ? -1 : 1));
342
+ if (to.length === 0)
343
+ continue;
344
+ bridges.push({ person: person, home: groups[home].id, to: to.map(({ group, share }) => ({ group, share })), score: Math.round(to.reduce((sum, item) => sum + item.share, 0) * 100) / 100 });
345
+ }
346
+ }
347
+ return { groups, bridges: bridges.sort((a, b) => b.score - a.score || (a.person < b.person ? -1 : 1)) };
348
+ }
349
+ // ---------------------------------------------------------------------------
350
+ // De facto owners
351
+ // ---------------------------------------------------------------------------
352
+ /** How decisive one act is for "who runs this". Attendance alone barely counts. */
353
+ export const OWNER_WEIGHT = {
354
+ decisions: 3,
355
+ action_items: 1.5,
356
+ commitments: 1.5,
357
+ meetings_led: 1,
358
+ presented: 0.7,
359
+ threads_started: 0.5,
360
+ external_meetings: 0.5,
361
+ meetings_attended: 0.2,
362
+ commits: 0.2,
363
+ };
364
+ export const OWNER_MIN_EVENTS = 4;
365
+ export const OWNER_CLEAR_SHARE = 0.5;
366
+ export function buildOwners(graph, acts, members, window = "90d") {
367
+ const bySubject = new Map();
368
+ for (const item of acts) {
369
+ if (!item.kind || !(item.kind in OWNER_WEIGHT) || !members.has(item.person))
370
+ continue;
371
+ if (item.automated)
372
+ continue;
373
+ if (!actInWindow(item, window, graph.asOf))
374
+ continue;
375
+ const skew = SKEW_WEIGHTS[item.cls].structure;
376
+ if (skew <= 0)
377
+ continue;
378
+ const perAct = OWNER_WEIGHT[item.kind] * (item.kind === "commits" ? Math.min(15, item.count) : 1) * skew;
379
+ for (const subject of item.subjects) {
380
+ const people = bySubject.get(subject) ?? new Map();
381
+ bySubject.set(subject, people);
382
+ const tally = people.get(item.person) ?? { score: 0, events: 0, byKind: {}, examples: [] };
383
+ people.set(item.person, tally);
384
+ tally.score += perAct * recencyWeight(item.date, graph.asOf, 45);
385
+ tally.events += 1;
386
+ tally.byKind[item.kind] = (tally.byKind[item.kind] ?? 0) + item.count;
387
+ tally.examples.push({ date: item.date, text: `[${item.kind}] ${item.text.length > 150 ? `${item.text.slice(0, 149)}…` : item.text}`, src: item.src, cls: item.cls, weight: perAct });
388
+ }
389
+ }
390
+ const owners = [];
391
+ for (const [subject, people] of bySubject) {
392
+ const total = [...people.values()].reduce((sum, tally) => sum + tally.score, 0);
393
+ const events = [...people.values()].reduce((sum, tally) => sum + tally.events, 0);
394
+ if (events < OWNER_MIN_EVENTS || total <= 0)
395
+ continue;
396
+ const candidates = [...people]
397
+ .map(([person, tally]) => ({
398
+ person,
399
+ score: Math.round(tally.score * 100) / 100,
400
+ share: Math.round((tally.score / total) * 100) / 100,
401
+ events: tally.events,
402
+ byKind: tally.byKind,
403
+ examples: tally.examples.sort((a, b) => b.weight - a.weight || (a.date > b.date ? -1 : 1)).slice(0, 3).map(({ weight: _weight, ...example }) => example),
404
+ }))
405
+ .sort((a, b) => b.score - a.score || (a.person < b.person ? -1 : 1));
406
+ const first = candidates[0];
407
+ const second = candidates[1];
408
+ // Attendance and commits alone do not make an owner: a clear owner has decided, taken an action or led.
409
+ const decisive = (first.byKind.decisions ?? 0) + (first.byKind.action_items ?? 0) + (first.byKind.commitments ?? 0) + (first.byKind.meetings_led ?? 0) + (first.byKind.commits ?? 0) > 0;
410
+ let verdict = "none";
411
+ if (first.share >= OWNER_CLEAR_SHARE && first.events >= 3 && decisive)
412
+ verdict = "clear";
413
+ else if (second && first.share + second.share >= 0.6 && first.events >= 2 && second.events >= 2)
414
+ verdict = "shared";
415
+ const isCompany = graph.companies.has(subject);
416
+ const node = isCompany ? graph.companies.get(subject) : graph.projects.get(subject);
417
+ const listed = (node?.listedOwners ?? []).filter((claim) => claim.open);
418
+ const owner = verdict === "clear" ? first.person : null;
419
+ const listedTargets = new Set(listed.map((claim) => claim.target).filter((ref) => Boolean(ref)));
420
+ const agrees = listedTargets.size === 0 || verdict === "none" ? null : verdict === "clear" ? listedTargets.has(first.person) : listedTargets.has(first.person) || (second !== undefined && listedTargets.has(second.person));
421
+ owners.push({
422
+ subject,
423
+ subjectName: subjectName(graph, subject),
424
+ kind: isCompany ? "customer" : "project",
425
+ window,
426
+ owner,
427
+ verdict,
428
+ candidates: candidates.slice(0, 4),
429
+ listed,
430
+ agrees,
431
+ events,
432
+ conf: verdict === "none" ? 0.2 : Math.round(Math.min(0.9, 0.3 + 0.5 * first.share * (1 - Math.exp(-events / 6))) * 100) / 100,
433
+ });
434
+ }
435
+ return owners.sort((a, b) => b.events - a.events || (a.subject < b.subject ? -1 : 1));
436
+ }
437
+ //# sourceMappingURL=structure.js.map
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Observed org chart: reading who did what out of one line of text.
3
+ *
4
+ * Rules only. A line names its actor at the start ("Corey Epstein to ...",
5
+ * "Jacob Posel decided ...", "Hassaan: ...") and names a second person when
6
+ * one person hands work to, or approves the work of, another. Every pattern
7
+ * here is a fixed phrase; none of it knows a company, a product or a person.
8
+ */
9
+ import type { EntityRef, IsoDate } from "../types.js";
10
+ import { type Area, type DirectKind } from "./types.js";
11
+ export declare function normalizeName(text: string): string;
12
+ export declare function daysBetween(from: IsoDate, to: IsoDate): number;
13
+ export declare function addDays(day: IsoDate, days: number): IsoDate;
14
+ /** Half-life of evidence, in days: a row this old counts half as much as one from today. */
15
+ export declare const RECENCY_HALF_LIFE_DAYS = 90;
16
+ export declare function recencyWeight(date: IsoDate, asOf: IsoDate, halfLife?: number): number;
17
+ export declare function clip(text: string, max?: number): string;
18
+ export interface NamedPerson {
19
+ ref: EntityRef;
20
+ name: string;
21
+ aliases: readonly string[];
22
+ onRoster: boolean;
23
+ }
24
+ /** Finds people named in a line. Built once per graph. */
25
+ /** Labels a transcript uses when it does not know who spoke. Never a person. */
26
+ export declare const PLACEHOLDER_SPEAKERS: ReadonlySet<string>;
27
+ export declare class NameIndex {
28
+ private readonly entries;
29
+ private readonly rosterFirst;
30
+ private readonly fullNames;
31
+ private readonly roster;
32
+ constructor(people: Iterable<NamedPerson>);
33
+ /**
34
+ * The person a line starts with, or null. Candidates are the people the row
35
+ * is filed on first, then a full name known to the graph, then a first name
36
+ * only one roster member has.
37
+ */
38
+ lead(text: string, filedOn: readonly EntityRef[]): {
39
+ ref: EntityRef;
40
+ rest: string;
41
+ } | null;
42
+ private match;
43
+ /** Every candidate person named in the line, with where the name starts and ends. Candidates: filed-on people and the roster. */
44
+ mentions(text: string, filedOn: readonly EntityRef[]): {
45
+ ref: EntityRef;
46
+ start: number;
47
+ end: number;
48
+ }[];
49
+ }
50
+ /** True when the text after a leading name reads as that person's own to-do. */
51
+ export declare function ownsAction(rest: string): boolean;
52
+ /** "X and Y to ...": true when the text after X continues with a second owner. */
53
+ export declare function continuesWithSecondOwner(rest: string): boolean;
54
+ export declare function saysLed(rest: string): boolean;
55
+ export declare function saysPresented(rest: string): boolean;
56
+ export interface DirectHit {
57
+ kind: DirectKind;
58
+ from: EntityRef;
59
+ to: EntityRef;
60
+ /** Where in the line the relation is stated. */
61
+ at: number;
62
+ }
63
+ /** The sentence of `text` around position `at`, so a long summary is cited by the part that says it. */
64
+ export declare function excerptAt(text: string, at: number, max?: number): string;
65
+ /**
66
+ * Directing relations stated in one line. `lead` is the person the line starts
67
+ * with, when there is one; `mentions` is every candidate named, in order.
68
+ */
69
+ export declare function directHits(text: string, lead: EntityRef | null, mentions: readonly {
70
+ ref: EntityRef;
71
+ start: number;
72
+ end: number;
73
+ }[]): DirectHit[];
74
+ /** After a leading name in a decision line: the decision tells that person what to do. */
75
+ export declare const DECISION_DIRECTS: RegExp;
76
+ /** The share of one line in each area. Empty when no area word is in it. */
77
+ export declare function areasOf(text: string): Partial<Record<Area, number>>;
78
+ export interface TitleReading {
79
+ areas: Area[];
80
+ /** The title says the person leads others. */
81
+ leads: boolean;
82
+ /** The title says the person is at arm's length (advisor, consultant). */
83
+ light: boolean;
84
+ }
85
+ export declare function readTitle(title: string): TitleReading;
86
+ /** Words a role description may not use: it describes work, it never awards a title. */
87
+ export declare const TITLE_WORDS: RegExp;
88
+ /**
89
+ * True when a weekly commit row lists only housekeeping subjects (chore, ci, build, merge, version bump).
90
+ * Such a week is usually a script committing under a person's name, so it says little about what the person did.
91
+ */
92
+ export declare function looksAutomated(text: string): boolean;
93
+ /** True when `name` appears in `text` as whole words. */
94
+ export declare function namesSubject(text: string, name: string): boolean;
95
+ /** Jaccard similarity of the word sets of two lines, for folding a row two signals wrote twice. */
96
+ export declare function similarity(a: string, b: string): number;
97
+ //# sourceMappingURL=text.d.ts.map