agentix-cli 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/README.md +2 -0
  2. package/dist/{App-6Y7B3YQH.js → App-U52IPUK2.js} +2 -2
  3. package/dist/{ChatApp-KIEUJ2DS.js → ChatApp-XP4OMHPL.js} +2 -2
  4. package/dist/agent-V2CA4TXD.js +2 -0
  5. package/dist/article-fields-L4D2BOGY.js +2 -0
  6. package/dist/article-quality-44ONVGLN.js +3 -0
  7. package/dist/article-quality-44ONVGLN.js.map +1 -0
  8. package/dist/{audit-JU3HWISB.js → audit-4245CX6P.js} +2 -2
  9. package/dist/backfill-MTD2B62I.js +6 -0
  10. package/dist/backfill-MTD2B62I.js.map +1 -0
  11. package/dist/{board-dashboard-CQ5F4GPD.js → board-dashboard-TTMAYRLG.js} +2445 -519
  12. package/dist/board-dashboard-TTMAYRLG.js.map +1 -0
  13. package/dist/{builtin-FRKAQMFS.js → builtin-B67DMJ3M.js} +2 -2
  14. package/dist/calibration-ILS5OI44.js +2 -0
  15. package/dist/chunk-2T5W3ETS.js +5 -0
  16. package/dist/{chunk-FDMWOPEL.js.map → chunk-2T5W3ETS.js.map} +1 -1
  17. package/dist/chunk-3SCPRYJB.js +5 -0
  18. package/dist/chunk-3SCPRYJB.js.map +1 -0
  19. package/dist/chunk-4BR7D2OU.js +36 -0
  20. package/dist/chunk-4BR7D2OU.js.map +1 -0
  21. package/dist/{chunk-P4VWIVKN.js → chunk-52ZPELD2.js} +403 -29
  22. package/dist/chunk-52ZPELD2.js.map +1 -0
  23. package/dist/{chunk-5U35WAZF.js → chunk-77OV7346.js} +6 -6
  24. package/dist/chunk-77OV7346.js.map +1 -0
  25. package/dist/chunk-AJ5RMU7X.js +2 -0
  26. package/dist/chunk-AJ5RMU7X.js.map +1 -0
  27. package/dist/chunk-AJONZWLT.js +2 -0
  28. package/dist/chunk-AJONZWLT.js.map +1 -0
  29. package/dist/chunk-AX2PWSRT.js +114 -0
  30. package/dist/chunk-AX2PWSRT.js.map +1 -0
  31. package/dist/chunk-BH3GTCZ6.js +2 -0
  32. package/dist/chunk-BH3GTCZ6.js.map +1 -0
  33. package/dist/chunk-BPIRO4YD.js +126 -0
  34. package/dist/chunk-BPIRO4YD.js.map +1 -0
  35. package/dist/chunk-CJQQIRPD.js +13 -0
  36. package/dist/chunk-CJQQIRPD.js.map +1 -0
  37. package/dist/chunk-DCDQZR7I.js +24 -0
  38. package/dist/chunk-DCDQZR7I.js.map +1 -0
  39. package/dist/chunk-EVWEG3VD.js +3 -0
  40. package/dist/chunk-EVWEG3VD.js.map +1 -0
  41. package/dist/chunk-F4HZTZHW.js +2 -0
  42. package/dist/chunk-F4HZTZHW.js.map +1 -0
  43. package/dist/chunk-F6CNF7V3.js +25 -0
  44. package/dist/chunk-F6CNF7V3.js.map +1 -0
  45. package/dist/chunk-FIEJDZVC.js +121 -0
  46. package/dist/chunk-FIEJDZVC.js.map +1 -0
  47. package/dist/chunk-FIOB3MEX.js +2 -0
  48. package/dist/{chunk-H5D7ATXS.js → chunk-FKBGJYWQ.js} +5 -5
  49. package/dist/chunk-FKBGJYWQ.js.map +1 -0
  50. package/dist/chunk-GDWJUGB5.js +9 -0
  51. package/dist/chunk-GDWJUGB5.js.map +1 -0
  52. package/dist/{chunk-TRJTTBE2.js → chunk-IB3F7VBE.js} +7 -7
  53. package/dist/{chunk-TRJTTBE2.js.map → chunk-IB3F7VBE.js.map} +1 -1
  54. package/dist/chunk-IBUSGCLQ.js +109 -0
  55. package/dist/chunk-IBUSGCLQ.js.map +1 -0
  56. package/dist/{chunk-LDHPMJ7M.js → chunk-IWMW5432.js} +3 -3
  57. package/dist/chunk-IWMW5432.js.map +1 -0
  58. package/dist/chunk-K33GIBSE.js +2 -0
  59. package/dist/chunk-K33GIBSE.js.map +1 -0
  60. package/dist/chunk-L2IZPR6P.js +45 -0
  61. package/dist/chunk-L2IZPR6P.js.map +1 -0
  62. package/dist/chunk-L2WSPY6S.js +2 -0
  63. package/dist/chunk-L2WSPY6S.js.map +1 -0
  64. package/dist/chunk-LCIREYTD.js +54 -0
  65. package/dist/chunk-LCIREYTD.js.map +1 -0
  66. package/dist/chunk-LNRB5MCU.js +530 -0
  67. package/dist/chunk-LNRB5MCU.js.map +1 -0
  68. package/dist/chunk-OPHIXXGI.js +157 -0
  69. package/dist/chunk-OPHIXXGI.js.map +1 -0
  70. package/dist/{chunk-JTJIPNXY.js → chunk-PNWNVOEZ.js} +1 -1
  71. package/dist/chunk-PNWNVOEZ.js.map +1 -0
  72. package/dist/{chunk-LNXCJWOU.js → chunk-UFAGYX73.js} +45 -47
  73. package/dist/chunk-UFAGYX73.js.map +1 -0
  74. package/dist/{chunk-DJEZ2HVU.js → chunk-VDMYBPYB.js} +1 -1
  75. package/dist/chunk-VDMYBPYB.js.map +1 -0
  76. package/dist/chunk-VTE7L6LO.js +5 -0
  77. package/dist/{chunk-G57RZCXM.js.map → chunk-VTE7L6LO.js.map} +1 -1
  78. package/dist/chunk-W5C2GDNC.js +32 -0
  79. package/dist/{chunk-JP5IEXR7.js.map → chunk-W5C2GDNC.js.map} +1 -1
  80. package/dist/chunk-WPMX3VGI.js +3 -0
  81. package/dist/chunk-WPMX3VGI.js.map +1 -0
  82. package/dist/chunk-WZ72HX5C.js +1182 -0
  83. package/dist/chunk-WZ72HX5C.js.map +1 -0
  84. package/dist/chunk-ZTEU5JVQ.js +2 -0
  85. package/dist/chunk-ZTEU5JVQ.js.map +1 -0
  86. package/dist/{chunk-2WVX3LEC.js → chunk-ZVP6GB4G.js} +1 -1
  87. package/dist/chunk-ZVP6GB4G.js.map +1 -0
  88. package/dist/cli.js +1 -1
  89. package/dist/cli.js.map +1 -1
  90. package/dist/client-PX25MD47.js +2 -0
  91. package/dist/{compaction-NWEMOSHA.js → compaction-FD4R23HZ.js} +4 -4
  92. package/dist/config-HL5F36V4.js +2 -0
  93. package/dist/config-mutator-HBX53OMJ.js +2 -0
  94. package/dist/{conflict-detector-D7VIYPDI.js → conflict-detector-ZPOT3M2C.js} +2 -2
  95. package/dist/conflict-detector-ZPOT3M2C.js.map +1 -0
  96. package/dist/context-planner-AQHJMVY2.js +17 -0
  97. package/dist/context-planner-AQHJMVY2.js.map +1 -0
  98. package/dist/debug-3MEUO2P2.js +2 -0
  99. package/dist/{discover-XJXQXXIO.js → discover-D4VVRNAI.js} +2 -2
  100. package/dist/discover-D4VVRNAI.js.map +1 -0
  101. package/dist/doctor-PBAH6XL3.js +2 -0
  102. package/dist/editor-chat-OB7IQOB5.js +137 -0
  103. package/dist/editor-chat-OB7IQOB5.js.map +1 -0
  104. package/dist/entry-triage-LK34TSQD.js +2 -0
  105. package/dist/entry-triage-LK34TSQD.js.map +1 -0
  106. package/dist/facts-YVEJOM7O.js +22 -0
  107. package/dist/facts-YVEJOM7O.js.map +1 -0
  108. package/dist/heal-FVLBHYP7.js +2 -0
  109. package/dist/index.d.ts +1073 -65
  110. package/dist/index.js +13 -13
  111. package/dist/index.js.map +1 -1
  112. package/dist/{ingest-whatsapp-LZE62INA.js → ingest-whatsapp-NS4OWDOU.js} +2 -2
  113. package/dist/loader-4ZGTK7LD.js +2 -0
  114. package/dist/loader-BOKE5M5S.js +2 -0
  115. package/dist/memory-extract-F5ZHWY5E.js +2 -0
  116. package/dist/{migrate-v2-QO7SLKIM.js → migrate-v2-V4WN2VVM.js} +2 -2
  117. package/dist/ntfy-X7EPB3TG.js +4 -0
  118. package/dist/ntfy-X7EPB3TG.js.map +1 -0
  119. package/dist/processes-WU23U2OJ.js +2 -0
  120. package/dist/program-YGXVCV2Y.js +2 -0
  121. package/dist/{projects-api-KRME2YKZ.js → projects-api-QE6L65SK.js} +2 -2
  122. package/dist/{projects-mutate-3NHVG437.js → projects-mutate-MY7JTLSZ.js} +2 -2
  123. package/dist/providers-KO2DODIO.js +2 -0
  124. package/dist/query-ZKTFJMNE.js +2 -0
  125. package/dist/questions-4B4KSPXG.js +3 -0
  126. package/dist/questions-4B4KSPXG.js.map +1 -0
  127. package/dist/recipes-7S4MC5OJ.js +2 -0
  128. package/dist/registry-PSZDPFZK.js +2 -0
  129. package/dist/review-candidates-AEUXRQQC.js +4 -0
  130. package/dist/review-candidates-AEUXRQQC.js.map +1 -0
  131. package/dist/review-store-B4YE3EFK.js +4 -0
  132. package/dist/review-store-B4YE3EFK.js.map +1 -0
  133. package/dist/{rotation-memo-B3EXXSEH.js → rotation-memo-7T75BLEX.js} +2 -2
  134. package/dist/routing-4PV66BK6.js +2 -0
  135. package/dist/routing-4PV66BK6.js.map +1 -0
  136. package/dist/runner-YRBVNYTY.js +2 -0
  137. package/dist/scheduler-GZZAN6ZG.js +2 -0
  138. package/dist/seat-VZ7AVO27.js +2 -0
  139. package/dist/select-F5I5PO2O.js +2 -0
  140. package/dist/select-F5I5PO2O.js.map +1 -0
  141. package/dist/store-MCOA6N4F.js +2 -0
  142. package/dist/{subagent-WV7QKQ3L.js → subagent-2SJHSSJS.js} +2 -2
  143. package/dist/{surface-usage-PRL6Z4U3.js → surface-usage-NS74AXSE.js} +2 -2
  144. package/dist/timers-PCB4ZIBD.js +2 -0
  145. package/dist/triage-backtest-JNO7RKX7.js +2 -0
  146. package/dist/triage-backtest-JNO7RKX7.js.map +1 -0
  147. package/dist/types-H5ENIUIT.js +2 -0
  148. package/dist/types-OIFU3KSQ.js +2 -0
  149. package/dist/web/workflow-editor.global.js +1542 -0
  150. package/dist/web/workflow-editor.global.js.map +1 -0
  151. package/dist/{whatsapp-state-XMTCSRXU.js → whatsapp-state-6D6FHHD2.js} +2 -2
  152. package/dist/wiki-N5SMP3DT.js +2 -0
  153. package/dist/wiki-N5SMP3DT.js.map +1 -0
  154. package/dist/workflows/templates/branching.yaml +1 -1
  155. package/dist/{workspace-setup-TBQAHYHJ.js → workspace-setup-B3F3TUDE.js} +2 -2
  156. package/dist/workspace-setup-B3F3TUDE.js.map +1 -0
  157. package/package.json +1 -1
  158. package/dist/agent-QGZIAZMY.js +0 -2
  159. package/dist/architect-SEPWMWS4.js +0 -2
  160. package/dist/board-dashboard-CQ5F4GPD.js.map +0 -1
  161. package/dist/chunk-2WVX3LEC.js.map +0 -1
  162. package/dist/chunk-3WQFCIB6.js +0 -24
  163. package/dist/chunk-3WQFCIB6.js.map +0 -1
  164. package/dist/chunk-4YCH6IZV.js +0 -2
  165. package/dist/chunk-53GCFZPR.js +0 -116
  166. package/dist/chunk-53GCFZPR.js.map +0 -1
  167. package/dist/chunk-53NRX2NA.js +0 -2
  168. package/dist/chunk-53NRX2NA.js.map +0 -1
  169. package/dist/chunk-5U35WAZF.js.map +0 -1
  170. package/dist/chunk-BFXONUUN.js +0 -108
  171. package/dist/chunk-BFXONUUN.js.map +0 -1
  172. package/dist/chunk-BFZUG66X.js +0 -45
  173. package/dist/chunk-BFZUG66X.js.map +0 -1
  174. package/dist/chunk-DJEZ2HVU.js.map +0 -1
  175. package/dist/chunk-FDMWOPEL.js +0 -5
  176. package/dist/chunk-FDWOECJY.js +0 -54
  177. package/dist/chunk-FDWOECJY.js.map +0 -1
  178. package/dist/chunk-G57RZCXM.js +0 -5
  179. package/dist/chunk-H5D7ATXS.js.map +0 -1
  180. package/dist/chunk-HA3XI7Z2.js +0 -155
  181. package/dist/chunk-HA3XI7Z2.js.map +0 -1
  182. package/dist/chunk-HR4JSRZS.js +0 -3
  183. package/dist/chunk-HR4JSRZS.js.map +0 -1
  184. package/dist/chunk-ISEBLHWX.js +0 -118
  185. package/dist/chunk-ISEBLHWX.js.map +0 -1
  186. package/dist/chunk-JP5IEXR7.js +0 -32
  187. package/dist/chunk-JTJIPNXY.js.map +0 -1
  188. package/dist/chunk-JXWAGMI2.js +0 -13
  189. package/dist/chunk-JXWAGMI2.js.map +0 -1
  190. package/dist/chunk-KUCCW2VG.js +0 -431
  191. package/dist/chunk-KUCCW2VG.js.map +0 -1
  192. package/dist/chunk-LDHPMJ7M.js.map +0 -1
  193. package/dist/chunk-LNXCJWOU.js.map +0 -1
  194. package/dist/chunk-NGSIRE4X.js +0 -126
  195. package/dist/chunk-NGSIRE4X.js.map +0 -1
  196. package/dist/chunk-P4VWIVKN.js.map +0 -1
  197. package/dist/chunk-Q6YO7LYE.js +0 -47
  198. package/dist/chunk-Q6YO7LYE.js.map +0 -1
  199. package/dist/chunk-SR3X25TN.js +0 -3
  200. package/dist/chunk-SR3X25TN.js.map +0 -1
  201. package/dist/chunk-TMKLHTCG.js +0 -971
  202. package/dist/chunk-TMKLHTCG.js.map +0 -1
  203. package/dist/chunk-VJUTQAPJ.js +0 -2
  204. package/dist/chunk-VJUTQAPJ.js.map +0 -1
  205. package/dist/client-GGVVLOOF.js +0 -2
  206. package/dist/config-7FSZFRTQ.js +0 -2
  207. package/dist/config-mutator-POCOYYJ4.js +0 -2
  208. package/dist/conflict-detector-D7VIYPDI.js.map +0 -1
  209. package/dist/context-planner-45GEWKGL.js +0 -17
  210. package/dist/context-planner-45GEWKGL.js.map +0 -1
  211. package/dist/debug-N3B5NVJU.js +0 -2
  212. package/dist/discover-XJXQXXIO.js.map +0 -1
  213. package/dist/doctor-DHLBEKA4.js +0 -2
  214. package/dist/heal-HZ3EQD52.js +0 -2
  215. package/dist/loader-5CA3O5GM.js +0 -2
  216. package/dist/loader-6IHUCPVO.js +0 -2
  217. package/dist/memory-extract-AENFVVO5.js +0 -2
  218. package/dist/processes-UIC4XXA6.js +0 -2
  219. package/dist/program-WVAVJFND.js +0 -2
  220. package/dist/providers-L27BJ5A6.js +0 -2
  221. package/dist/query-HZYYRCLU.js +0 -2
  222. package/dist/recipes-EPLE2SNT.js +0 -2
  223. package/dist/registry-T36ZIAWV.js +0 -2
  224. package/dist/runner-BFYDWPUO.js +0 -2
  225. package/dist/scheduler-GH7TIKYS.js +0 -2
  226. package/dist/store-I3HEWVLQ.js +0 -2
  227. package/dist/timers-5LPZN55J.js +0 -2
  228. package/dist/types-VECTMYTO.js +0 -2
  229. package/dist/types-Y6ZCZ52Z.js +0 -2
  230. package/dist/wiki-M6YNRFC4.js +0 -2
  231. /package/dist/{App-6Y7B3YQH.js.map → App-U52IPUK2.js.map} +0 -0
  232. /package/dist/{ChatApp-KIEUJ2DS.js.map → ChatApp-XP4OMHPL.js.map} +0 -0
  233. /package/dist/{agent-QGZIAZMY.js.map → agent-V2CA4TXD.js.map} +0 -0
  234. /package/dist/{architect-SEPWMWS4.js.map → article-fields-L4D2BOGY.js.map} +0 -0
  235. /package/dist/{audit-JU3HWISB.js.map → audit-4245CX6P.js.map} +0 -0
  236. /package/dist/{builtin-FRKAQMFS.js.map → builtin-B67DMJ3M.js.map} +0 -0
  237. /package/dist/{chunk-4YCH6IZV.js.map → calibration-ILS5OI44.js.map} +0 -0
  238. /package/dist/{client-GGVVLOOF.js.map → chunk-FIOB3MEX.js.map} +0 -0
  239. /package/dist/{config-7FSZFRTQ.js.map → client-PX25MD47.js.map} +0 -0
  240. /package/dist/{compaction-NWEMOSHA.js.map → compaction-FD4R23HZ.js.map} +0 -0
  241. /package/dist/{config-mutator-POCOYYJ4.js.map → config-HL5F36V4.js.map} +0 -0
  242. /package/dist/{debug-N3B5NVJU.js.map → config-mutator-HBX53OMJ.js.map} +0 -0
  243. /package/dist/{doctor-DHLBEKA4.js.map → debug-3MEUO2P2.js.map} +0 -0
  244. /package/dist/{heal-HZ3EQD52.js.map → doctor-PBAH6XL3.js.map} +0 -0
  245. /package/dist/{loader-5CA3O5GM.js.map → heal-FVLBHYP7.js.map} +0 -0
  246. /package/dist/{ingest-whatsapp-LZE62INA.js.map → ingest-whatsapp-NS4OWDOU.js.map} +0 -0
  247. /package/dist/{loader-6IHUCPVO.js.map → loader-4ZGTK7LD.js.map} +0 -0
  248. /package/dist/{memory-extract-AENFVVO5.js.map → loader-BOKE5M5S.js.map} +0 -0
  249. /package/dist/{processes-UIC4XXA6.js.map → memory-extract-F5ZHWY5E.js.map} +0 -0
  250. /package/dist/{migrate-v2-QO7SLKIM.js.map → migrate-v2-V4WN2VVM.js.map} +0 -0
  251. /package/dist/{program-WVAVJFND.js.map → processes-WU23U2OJ.js.map} +0 -0
  252. /package/dist/{providers-L27BJ5A6.js.map → program-YGXVCV2Y.js.map} +0 -0
  253. /package/dist/{projects-api-KRME2YKZ.js.map → projects-api-QE6L65SK.js.map} +0 -0
  254. /package/dist/{projects-mutate-3NHVG437.js.map → projects-mutate-MY7JTLSZ.js.map} +0 -0
  255. /package/dist/{query-HZYYRCLU.js.map → providers-KO2DODIO.js.map} +0 -0
  256. /package/dist/{recipes-EPLE2SNT.js.map → query-ZKTFJMNE.js.map} +0 -0
  257. /package/dist/{registry-T36ZIAWV.js.map → recipes-7S4MC5OJ.js.map} +0 -0
  258. /package/dist/{runner-BFYDWPUO.js.map → registry-PSZDPFZK.js.map} +0 -0
  259. /package/dist/{rotation-memo-B3EXXSEH.js.map → rotation-memo-7T75BLEX.js.map} +0 -0
  260. /package/dist/{scheduler-GH7TIKYS.js.map → runner-YRBVNYTY.js.map} +0 -0
  261. /package/dist/{store-I3HEWVLQ.js.map → scheduler-GZZAN6ZG.js.map} +0 -0
  262. /package/dist/{surface-usage-PRL6Z4U3.js.map → seat-VZ7AVO27.js.map} +0 -0
  263. /package/dist/{timers-5LPZN55J.js.map → store-MCOA6N4F.js.map} +0 -0
  264. /package/dist/{subagent-WV7QKQ3L.js.map → subagent-2SJHSSJS.js.map} +0 -0
  265. /package/dist/{types-VECTMYTO.js.map → surface-usage-NS74AXSE.js.map} +0 -0
  266. /package/dist/{types-Y6ZCZ52Z.js.map → timers-PCB4ZIBD.js.map} +0 -0
  267. /package/dist/{wiki-M6YNRFC4.js.map → types-H5ENIUIT.js.map} +0 -0
  268. /package/dist/{workspace-setup-TBQAHYHJ.js.map → types-OIFU3KSQ.js.map} +0 -0
  269. /package/dist/{whatsapp-state-XMTCSRXU.js.map → whatsapp-state-6D6FHHD2.js.map} +0 -0
@@ -0,0 +1,22 @@
1
+ import"./chunk-FIOB3MEX.js";import{existsSync as E,readFileSync as T}from"fs";import{resolve as j}from"path";import{execFile as N}from"child_process";function p(e,t,o={}){return new Promise(n=>{N(e,t,{timeout:o.timeoutMs??15e3,signal:o.signal,maxBuffer:4*1024*1024,env:{...process.env,PATH:[process.env.PATH??"","/opt/homebrew/bin","/usr/local/bin",`${process.env.HOME??""}/.local/bin`].filter(Boolean).join(":")}},(r,a,i)=>{let s=r&&typeof r.code=="number"?r.code:r?1:0;n({stdout:String(a??""),stderr:String(i??""),code:s})})})}async function y(e){let{code:t}=await p("command",["-v",e],{timeoutMs:3e3}).catch(()=>({code:1}));if(t===0)return!0;let{code:o}=await p("/usr/bin/which",[e],{timeoutMs:3e3});return o===0}var G=[["216","Tunisia"],["966","Saudi Arabia"],["971","UAE"],["974","Qatar"],["965","Kuwait"],["973","Bahrain"],["968","Oman"],["962","Jordan"],["961","Lebanon"],["212","Morocco"],["213","Algeria"],["218","Libya"],["249","Sudan"],["20","Egypt"],["90","Turkey"],["33","France"],["49","Germany"],["39","Italy"],["34","Spain"],["44","United Kingdom"],["31","Netherlands"],["32","Belgium"],["41","Switzerland"],["1","US/Canada"]];function m(e){let t=e.replace(/\D/g,""),o,n=0;for(let[r,a]of G)t.startsWith(r)&&r.length>n&&(o=a,n=r.length);return o}function F(e){let t=[];for(let o of e.split(`
2
+ `)){let n=o.trim();if(!n||n.startsWith("ALIAS"))continue;let r=n.split(/\s{2,}/).filter(Boolean);if(r.length<2)continue;let a=r[r.length-1];if(!a.includes("@"))continue;let i=r[r.length-2],s=r.length>=3?r[r.length-3]:"";if(!s||!/\d/.test(i))continue;let l=m(i);t.push({name:s,source:"wacli",fields:{phone:`+${i.replace(/\D/g,"")}`,whatsapp:a,...l?{country:l}:{}}})}return t}function w(){return{name:"wacli",provides:["contact value","country"],async available(){if(!await y("wacli"))return{kind:"not-installed",hint:"brew install wacli \u2014 see https://wacli.sh"};let{stdout:e,stderr:t,code:o}=await p("wacli",["contacts","search","__agentx_probe__"],{timeoutMs:1e4});return o!==0&&/auth|not logged in|no session|login/i.test(e+t)?{kind:"not-configured",hint:"wacli auth \u2014 scan the QR to link the account"}:null},async lookup(e,t){let o=[],n=new Set;for(let r of e)for(let a of P(r.name)){let{stdout:i,code:s}=await p("wacli",["contacts","search",a],{signal:t,timeoutMs:15e3});if(s!==0)continue;let l=F(i).filter(u=>A(u.name,r.name));if(l.length!==0){for(let u of l){let c=u.fields.whatsapp;n.has(c)||(n.add(c),o.push({...u,fuzzy:!I(u.name,r.name)}))}break}}return o}}}var h=e=>e.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9 ]/g,"").trim(),I=(e,t)=>h(e)===h(t);function P(e){let t=h(e).split(/\s+/).filter(o=>o.length>2);return t.length>1?[e,t[t.length-1]]:[e]}function A(e,t){let o=h(e).split(/\s+/).filter(Boolean),n=h(t).split(/\s+/).filter(Boolean);if(o.length===0||n.length===0)return!1;let[r,a]=o.length<=n.length?[o,n]:[n,o];return r.every(i=>a.includes(i))}var M={whatsapp:"whatsapp",telegram:"telegram",gitlab:"gitlab",github:"github",email:"email",phone:"phone",slack:"slack",discord:"discord"};function D(e=".agentx"){return j(process.cwd(),e,"contacts.json")}function S(e){if(!E(e))return[];try{let t=JSON.parse(T(e,"utf-8"));return Array.isArray(t?.contacts)?t.contacts:[]}catch{return[]}}var b=e=>e.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9 ]/g,"").trim();function C(e){return[e.name,e.id,...e.aliases??[]].filter(t=>!!(t&&t.trim())).map(b)}function _(e){let t={};for(let[o,n]of Object.entries(e.channels??{})){let r=String(n??"").trim();if(!r)continue;let a=M[o.toLowerCase()]??o.toLowerCase();if(a==="whatsapp"){let i=r.split("@")[0].replace(/\D/g,"");if(t.whatsapp=r.includes("@")?r:`${i}@s.whatsapp.net`,i){t.phone??=`+${i}`;let s=m(i);s&&(t.country??=s)}continue}if(a==="phone"){let i=r.replace(/\D/g,"");t.phone=r.startsWith("+")?r:`+${i}`;let s=m(i);s&&(t.country??=s);continue}if(a==="telegram"&&/^\d+$/.test(r)){t.telegramId=r;continue}t[a]=a==="gitlab"||a==="github"?r.startsWith("@")?r:`@${r}`:r}return t}function k(e={}){let t=e.path??D();return{name:"contacts",provides:["contact value","handles","country"],async available(){return E(t)?S(t).length>0?null:{kind:"not-configured",hint:`${t} has no contacts`}:{kind:"not-configured",hint:`no ${t} \u2014 add {"contacts":[{"name":"\u2026","aliases":[],"channels":{"whatsapp":"\u2026"}}]}`}},async lookup(o){let n=S(t);if(n.length===0)return[];let r=new Map;for(let s of n)for(let l of C(s))l&&r.set(l,s);let a=[],i=new Set;for(let s of o){let l=r.get(b(s.name));if(!l||i.has(l))continue;i.add(l);let u=_(l);Object.keys(u).length!==0&&a.push({name:l.name??s.name,source:"contacts",fields:u,fuzzy:b(l.name??"")!==b(s.name)})}return a}}}function v(e={}){let t=(e.baseUrl??process.env.GITLAB_URL??"").replace(/\/+$/,""),o=e.token??process.env.GITLAB_ADMIN_TOKEN??process.env.GITLAB_TOKEN;return{name:"gitlab",provides:["email","handle","profile URL"],async available(){if(!t)return{kind:"not-configured",hint:"export GITLAB_URL=https://<your-gitlab-host>"};if(!o)return{kind:"not-configured",hint:"export GITLAB_ADMIN_TOKEN=<PAT> (read_api scope is enough)"};try{let n=await fetch(`${t}/api/v4/user`,{headers:{"PRIVATE-TOKEN":o}});if(n.status===401||n.status===403)return{kind:"not-configured",hint:`GitLab rejected the token (${n.status}) \u2014 set a valid GITLAB_ADMIN_TOKEN`};if(!n.ok)return{kind:"failed",hint:`GitLab returned ${n.status} for the auth probe`}}catch(n){return{kind:"failed",hint:`cannot reach ${t}: ${String(n?.message??n)}`}}return null},async lookup(n,r){if(!o||!t)return[];let a=[],i=new Set;for(let s of n){let l=`${t}/api/v4/users?search=${encodeURIComponent(s.name)}&per_page=5`,u;try{let c=await fetch(l,{headers:{"PRIVATE-TOKEN":o},signal:r});if(!c.ok)continue;u=await c.json()}catch{continue}if(Array.isArray(u))for(let c of u){let d=c.username??c.web_url??"";if(!d||i.has(d))continue;i.add(d);let f={},g=c.email||c.public_email;g&&(f.email=g),c.username&&(f.gitlab=`@${c.username}`),c.web_url&&(f.profile=c.web_url),c.organization&&(f.organisation=c.organization),c.job_title&&(f.role=c.job_title),c.state&&c.state!=="active"&&(f.accountState=c.state),Object.keys(f).length!==0&&a.push({name:c.name??s.name,source:"gitlab",fields:f,fuzzy:(c.name??"").toLowerCase()!==s.name.toLowerCase()})}}return a}}}function x(){return{name:"gog",provides:["contact value","email","organisation","role","country"],async available(){if(!await y("gog"))return{kind:"not-installed",hint:"brew install gog \u2014 Google CLI"};let{stdout:e,stderr:t}=await p("gog",["contacts","list","-j"],{timeoutMs:2e4}),o=e+t;return/unknown flag|Run with --help/i.test(o)?{kind:"failed",hint:`gog rejected the probe: ${o.split(`
3
+ `)[0]}`}:/accessNotConfigured|has not been used in project/i.test(o)?{kind:"not-configured",hint:"enable the People API on the gog OAuth project, then retry (console.developers.google.com \u2192 APIs \u2192 People API)"}:/invalid_grant|PERMISSION_DENIED|unauthenticated/i.test(o)?{kind:"not-configured",hint:"gog auth login \u2014 the stored token is expired or lacks contacts scope"}:null},async lookup(e,t){let o=[];for(let n of e){let{stdout:r,code:a}=await p("gog",["contacts","search",n.name,"-j","--results-only"],{signal:t,timeoutMs:2e4});if(a!==0)continue;let i;try{i=JSON.parse(r)}catch{continue}let s=Array.isArray(i)?i:i?.results??i?.people??[];for(let l of s){let u={},c=l.phoneNumbers?.[0]?.value,d=l.emailAddresses?.[0]?.value,f=l.organizations?.[0];c&&(u.phone=c),d&&(u.email=d),f?.name&&(u.organisation=f.name),f?.title&&(u.role=f.title);let g=l.addresses?.[0]?.country;g&&(u.country=g),Object.keys(u).length!==0&&o.push({name:l.names?.[0]?.displayName??n.name,source:"gog",fields:u})}}return o}}}var R=e=>typeof e=="string"&&e.trim()?e.trim():void 0;function L(e){return String(e??"").split("@")[0].split(":")[0].toLowerCase()}function z(e){let t=new Map;for(let o of e){let n=R(o.meta?.sender);if(!n)continue;let r=R(o.meta?.senderId),a=R(o.meta?.senderUsername),i=L(o.source),s={};if(r&&/@s\.whatsapp\.net$/.test(r)){let c=r.split("@")[0].replace(/\D/g,"");if(c){s.phone=`+${c}`,s.whatsapp=r;let d=m(c);d&&(s.country=d)}}else if(i==="whatsapp"&&r&&/^\d{6,}$/.test(r)){s.phone=`+${r}`,s.whatsapp=`${r}@s.whatsapp.net`;let c=m(r);c&&(s.country=c)}if(a){let c=a.startsWith("@")?a:`@${a}`;i==="gitlab"?s.gitlab=c:i==="github"?s.github=c:i==="telegram"?s.telegram=c:s.handle=c}if(r&&!s.phone&&!a&&(s[`${i||"platform"}Id`]=r),Object.keys(s).length===0)continue;let l=n.toLowerCase(),u=t.get(l);if(!u){t.set(l,{name:n,source:"entries",fields:s});continue}for(let[c,d]of Object.entries(s))u.fields[c]??=d}return Array.from(t.values())}function H(e){let t;return{...e,available:()=>t??=e.available(),lookup:(o,n)=>e.lookup(o,n)}}function O(){return[k(),w(),v(),x()].map(H)}function ct(e,t={}){let o=t.max??25,n=new Map;for(let a of e){let i=(a.sender??"").trim();i&&$(i)&&n.set(i.toLowerCase(),{name:i,origin:"sender",type:"person"})}for(let a of e){let i=(a.context??"").trim();if(!$(i))continue;let s=i.toLowerCase();n.has(s)||n.set(s,{name:i,origin:"context"})}let r=(t.known??[]).filter(a=>a.trim().length>2);if(r.length>0){let a=e.map(i=>i.content??"").join(`
4
+ `).toLowerCase();for(let i of r){let s=i.toLowerCase().trim();n.has(s)||a.includes(s)&&n.set(s,{name:i,origin:"body",type:"person"})}}return Array.from(n.values()).slice(0,o)}var U=new Set(["me","user","system","cron","unknown","anonymous","bot","agent","self","test","admin","none","null","n/a"]),B=new Set(["group","team","chat","channel","squad","crew","room","family","project","board","committee","club","staff","office","dept","department","support","sales","ops","admins","everyone","all"]);function $(e){let t=e.trim();if(!t||t.length>48||U.has(t.toLowerCase())||/[\d@/\\#:|_]/.test(t))return!1;let o=t.split(/\s+/);return o.length<2||o.length>4||o.some(n=>B.has(n.toLowerCase()))?!1:o.every(n=>/^[\p{Lu}][\p{L}'’.-]*$/u.test(n))}async function lt(e,t={}){let o=t.sources??O(),n=e.slice(0,t.maxEntities??25);if(n.length===0)return{records:[],results:[]};let r=new AbortController,a=setTimeout(()=>r.abort(),t.timeoutMs??12e4);try{let i=await Promise.all(o.map(async s=>{let l=Date.now();try{let u=await s.available();if(u)return{source:s.name,records:[],unavailable:u,ms:Date.now()-l};let c=await s.lookup(n,r.signal);return{source:s.name,records:c,ms:Date.now()-l}}catch(u){return{source:s.name,records:[],unavailable:{kind:"failed",hint:String(u?.message??u)},ms:Date.now()-l}}}));for(let s of i)t.onResult?.(s);return{records:i.flatMap(s=>s.records),results:i}}finally{clearTimeout(a)}}function ut(e,t=O()){let o=new Map(t.map(n=>[n.name,n.provides]));return e.filter(n=>n.unavailable&&n.unavailable.kind!=="failed").map(n=>({source:n.source,kind:n.unavailable.kind,hint:n.unavailable.hint,provides:o.get(n.source)??[]}))}function ft(e){let t=new Map;for(let o of e){let n=o.name.toLowerCase().trim(),r=t.get(n);r||(r={name:o.name,fields:{}},t.set(n,r));for(let[a,i]of Object.entries(o.fields)){if(!i?.trim())continue;let s=r.fields[a];if(!s){r.fields[a]={value:i,source:o.source};continue}s.value!==i&&(r.fields[`${a} (${o.source})`]??={value:i,source:o.source})}}return Array.from(t.values())}function dt(e){if(e.length===0)return"";let t=e.filter(o=>Object.keys(o.fields).length>0).map(o=>{let n=Object.entries(o.fields).map(([r,a])=>` - ${r}: \`${a.value}\` _(${a.source})_`).join(`
5
+ `);return`- **${o.name}**
6
+ ${n}`});return t.length===0?"":`
7
+ ## Verified facts
8
+
9
+ These were read from systems of record \u2014 WhatsApp, GitLab, Google, the
10
+ ERP \u2014 not from the entries. They are more reliable than anything the
11
+ conversation implies, and they are the identity fields articles are
12
+ graded on.
13
+
14
+ Copy every value that belongs to an article you write, **verbatim**, into
15
+ its Identity section. Do not paraphrase an identifier, reformat it, or
16
+ replace it with the name of the channel it belongs to. Where a fact here
17
+ contradicts the entries, this wins and the entry is stale.
18
+
19
+ ${t.join(`
20
+ `)}
21
+ `}export{m as countryFromPhone,k as createContactsSource,v as createGitlabSource,x as createGogSource,w as createWacliSource,O as defaultSources,ct as extractHints,_ as factsFrom,ut as installPrompts,$ as isPersonName,S as loadContacts,H as memoizeAvailability,ft as mergeRecords,C as namesOf,F as parseContactsTable,L as platformOf,A as plausible,z as recordsFromEntries,dt as renderFactsBlock,lt as resolveFacts};
22
+ //# sourceMappingURL=facts-YVEJOM7O.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/wiki/facts/sources/contacts.ts","../src/wiki/facts/exec.ts","../src/wiki/facts/sources/wacli.ts","../src/wiki/facts/sources/gitlab.ts","../src/wiki/facts/sources/gog.ts","../src/wiki/facts/sources/entries.ts","../src/wiki/facts/index.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"fs\"\nimport { resolve } from \"path\"\nimport type { EntityHint, FactRecord, FactSource } from \"../types\"\nimport { countryFromPhone } from \"./wacli\"\n\n// The contact registry an operator maintains by hand.\n//\n// `.agentx/contacts.json` already existed and nothing in the wiki layer\n// read it, which meant the one place a person had deliberately written\n// down \"this human is these accounts\" was invisible to the pipeline\n// asking that exact question.\n//\n// It ranks above every other source. wacli knows what WhatsApp knows,\n// GitLab knows what GitLab knows, and the entries know who sent a\n// message; this is the only source where someone decided that a name,\n// an alias and a set of handles all refer to one person. Where it\n// disagrees with a directory, the deliberate answer wins — and the\n// disagreement is kept and rendered rather than resolved silently.\n//\n// It is also the only source that resolves aliases, which is what makes\n// a single registry entry cover a given name, a \"first.last\" handle and\n// the display name a phone happens to be saved under.\n\nexport interface ContactRecord {\n id?: string\n name?: string\n aliases?: string[]\n channels?: Record<string, string>\n}\n\n/** Channel key → the fact field it supplies. */\nconst CHANNEL_FIELDS: Record<string, string> = {\n whatsapp: \"whatsapp\",\n telegram: \"telegram\",\n gitlab: \"gitlab\",\n github: \"github\",\n email: \"email\",\n phone: \"phone\",\n slack: \"slack\",\n discord: \"discord\",\n}\n\nexport function contactsPath(agentxDir = \".agentx\"): string {\n return resolve(process.cwd(), agentxDir, \"contacts.json\")\n}\n\nexport function loadContacts(path: string): ContactRecord[] {\n if (!existsSync(path)) return []\n try {\n const parsed = JSON.parse(readFileSync(path, \"utf-8\")) as { contacts?: unknown }\n return Array.isArray(parsed?.contacts) ? (parsed.contacts as ContactRecord[]) : []\n } catch {\n return []\n }\n}\n\nconst norm = (s: string) =>\n s.toLowerCase().normalize(\"NFD\").replace(/[̀-ͯ]/g, \"\").replace(/[^a-z0-9 ]/g, \"\").trim()\n\n/** Every spelling this registry entry answers to. */\nexport function namesOf(c: ContactRecord): string[] {\n return [c.name, c.id, ...(c.aliases ?? [])]\n .filter((x): x is string => Boolean(x && x.trim()))\n .map(norm)\n}\n\n/**\n * Turn one registry entry's channels into fact fields.\n *\n * A WhatsApp JID is also a number and a country, so it expands rather\n * than being copied across verbatim — the same unpacking the entries\n * source does, because a reader wants the number, not the routing\n * address it happens to be embedded in.\n */\nexport function factsFrom(c: ContactRecord): Record<string, string> {\n const fields: Record<string, string> = {}\n for (const [key, raw] of Object.entries(c.channels ?? {})) {\n const value = String(raw ?? \"\").trim()\n if (!value) continue\n const field = CHANNEL_FIELDS[key.toLowerCase()] ?? key.toLowerCase()\n\n if (field === \"whatsapp\") {\n const digits = value.split(\"@\")[0].replace(/\\D/g, \"\")\n fields.whatsapp = value.includes(\"@\") ? value : `${digits}@s.whatsapp.net`\n if (digits) {\n fields.phone ??= `+${digits}`\n const country = countryFromPhone(digits)\n if (country) fields.country ??= country\n }\n continue\n }\n if (field === \"phone\") {\n const digits = value.replace(/\\D/g, \"\")\n fields.phone = value.startsWith(\"+\") ? value : `+${digits}`\n const country = countryFromPhone(digits)\n if (country) fields.country ??= country\n continue\n }\n // A bare numeric Telegram id is an account, not a way to reach\n // someone — same rule the entries source applies.\n if (field === \"telegram\" && /^\\d+$/.test(value)) {\n fields.telegramId = value\n continue\n }\n fields[field] = field === \"gitlab\" || field === \"github\"\n ? (value.startsWith(\"@\") ? value : `@${value}`)\n : value\n }\n return fields\n}\n\nexport function createContactsSource(opts: { path?: string } = {}): FactSource {\n const path = opts.path ?? contactsPath()\n\n return {\n name: \"contacts\",\n provides: [\"contact value\", \"handles\", \"country\"],\n async available() {\n if (!existsSync(path)) {\n return {\n kind: \"not-configured\",\n hint: `no ${path} — add {\"contacts\":[{\"name\":\"…\",\"aliases\":[],\"channels\":{\"whatsapp\":\"…\"}}]}`,\n }\n }\n return loadContacts(path).length > 0\n ? null\n : { kind: \"not-configured\", hint: `${path} has no contacts` }\n },\n async lookup(hints: EntityHint[]) {\n const contacts = loadContacts(path)\n if (contacts.length === 0) return []\n\n const index = new Map<string, ContactRecord>()\n for (const c of contacts) for (const n of namesOf(c)) if (n) index.set(n, c)\n\n const out: FactRecord[] = []\n const seen = new Set<ContactRecord>()\n for (const h of hints) {\n const c = index.get(norm(h.name))\n if (!c || seen.has(c)) continue\n seen.add(c)\n const fields = factsFrom(c)\n if (Object.keys(fields).length === 0) continue\n out.push({\n name: c.name ?? h.name,\n source: \"contacts\",\n fields,\n // Matched on an alias rather than the registry's own name.\n fuzzy: norm(c.name ?? \"\") !== norm(h.name),\n })\n }\n return out\n },\n }\n}\n","import { execFile } from \"child_process\"\n\n/**\n * execFile, not exec — an entity name is untrusted input that reaches\n * this from chat messages and GitLab issue titles. Through a shell,\n * a contact called `; rm -rf ~` is a command. execFile passes argv\n * directly and never opens one.\n */\nexport function run(\n cmd: string,\n args: string[],\n opts: { timeoutMs?: number; signal?: AbortSignal } = {},\n): Promise<{ stdout: string; stderr: string; code: number }> {\n return new Promise((resolve) => {\n execFile(\n cmd,\n args,\n {\n timeout: opts.timeoutMs ?? 15_000,\n signal: opts.signal,\n maxBuffer: 4 * 1024 * 1024,\n // The daemon's PATH is not a login shell's. wacli and gog live in\n // Homebrew, and ~/.local/bin is where the fleet's own tools land.\n env: {\n ...process.env,\n PATH: [\n process.env.PATH ?? \"\",\n \"/opt/homebrew/bin\",\n \"/usr/local/bin\",\n `${process.env.HOME ?? \"\"}/.local/bin`,\n ].filter(Boolean).join(\":\"),\n },\n },\n (err, stdout, stderr) => {\n const code = err && typeof (err as { code?: unknown }).code === \"number\"\n ? ((err as { code: number }).code)\n : err ? 1 : 0\n resolve({ stdout: String(stdout ?? \"\"), stderr: String(stderr ?? \"\"), code })\n },\n )\n })\n}\n\nexport async function binaryExists(cmd: string): Promise<boolean> {\n const { code } = await run(\"command\", [\"-v\", cmd], { timeoutMs: 3000 }).catch(() => ({ code: 1 }) as never)\n if (code === 0) return true\n // `command` is a shell builtin, so the above fails on most systems.\n const { code: which } = await run(\"/usr/bin/which\", [cmd], { timeoutMs: 3000 })\n return which === 0\n}\n","import { binaryExists, run } from \"../exec\"\nimport type { EntityHint, FactRecord, FactSource } from \"../types\"\n\n// Phone numbers, from the WhatsApp contact store.\n//\n// This is the source that closes the gap the grader found. It also\n// answers country for free: a JID is an E.164 number, so the dialling\n// prefix identifies the country without a second lookup.\n\nconst CC: Array<[string, string]> = [\n [\"216\", \"Tunisia\"], [\"966\", \"Saudi Arabia\"], [\"971\", \"UAE\"], [\"974\", \"Qatar\"],\n [\"965\", \"Kuwait\"], [\"973\", \"Bahrain\"], [\"968\", \"Oman\"], [\"962\", \"Jordan\"],\n [\"961\", \"Lebanon\"], [\"212\", \"Morocco\"], [\"213\", \"Algeria\"], [\"218\", \"Libya\"],\n [\"249\", \"Sudan\"], [\"20\", \"Egypt\"], [\"90\", \"Turkey\"], [\"33\", \"France\"],\n [\"49\", \"Germany\"], [\"39\", \"Italy\"], [\"34\", \"Spain\"], [\"44\", \"United Kingdom\"],\n [\"31\", \"Netherlands\"], [\"32\", \"Belgium\"], [\"41\", \"Switzerland\"], [\"1\", \"US/Canada\"],\n]\n\n/** Longest prefix wins, or \"1\" would claim every +1xx number. */\nexport function countryFromPhone(phone: string): string | undefined {\n const d = phone.replace(/\\D/g, \"\")\n let best: string | undefined\n let bestLen = 0\n for (const [code, name] of CC) {\n if (d.startsWith(code) && code.length > bestLen) { best = name; bestLen = code.length }\n }\n return best\n}\n\n/**\n * `wacli contacts search` prints a fixed-width table, not JSON:\n *\n * ALIAS NAME PHONE JID\n * Sample Person <e164> <e164>@s.whatsapp.net\n *\n * Parsed from the right, because ALIAS is frequently empty and NAME\n * contains spaces — splitting from the left mis-assigns both.\n */\nexport function parseContactsTable(stdout: string): FactRecord[] {\n const out: FactRecord[] = []\n for (const line of stdout.split(\"\\n\")) {\n const t = line.trim()\n if (!t || t.startsWith(\"ALIAS\")) continue\n const cols = t.split(/\\s{2,}/).filter(Boolean)\n if (cols.length < 2) continue\n const jid = cols[cols.length - 1]\n if (!jid.includes(\"@\")) continue\n const phone = cols[cols.length - 2]\n const name = cols.length >= 3 ? cols[cols.length - 3] : \"\"\n if (!name || !/\\d/.test(phone)) continue\n const country = countryFromPhone(phone)\n out.push({\n name,\n source: \"wacli\",\n fields: {\n phone: `+${phone.replace(/\\D/g, \"\")}`,\n whatsapp: jid,\n ...(country ? { country } : {}),\n },\n })\n }\n return out\n}\n\nexport function createWacliSource(): FactSource {\n return {\n name: \"wacli\",\n provides: [\"contact value\", \"country\"],\n async available() {\n if (!(await binaryExists(\"wacli\"))) {\n return { kind: \"not-installed\", hint: \"brew install wacli — see https://wacli.sh\" }\n }\n // Installed but never authenticated returns an empty store for\n // every query, which looks identical to \"this person is not a\n // contact\" and would quietly teach us the corpus has no numbers.\n const { stdout, stderr, code } = await run(\"wacli\", [\"contacts\", \"search\", \"__agentx_probe__\"], { timeoutMs: 10_000 })\n if (code !== 0 && /auth|not logged in|no session|login/i.test(stdout + stderr)) {\n return { kind: \"not-configured\", hint: \"wacli auth — scan the QR to link the account\" }\n }\n return null\n },\n async lookup(hints: EntityHint[], signal?: AbortSignal) {\n const records: FactRecord[] = []\n const seen = new Set<string>()\n for (const h of hints) {\n // Search the surname alone when the full name misses; the\n // contact store often holds a shorter form than the wiki does.\n for (const q of queriesFor(h.name)) {\n const { stdout, code } = await run(\"wacli\", [\"contacts\", \"search\", q], { signal, timeoutMs: 15_000 })\n if (code !== 0) continue\n const hit = parseContactsTable(stdout).filter((r) => plausible(r.name, h.name))\n if (hit.length === 0) continue\n for (const r of hit) {\n const key = r.fields.whatsapp\n if (seen.has(key)) continue\n seen.add(key)\n records.push({ ...r, fuzzy: !sameName(r.name, h.name) })\n }\n break\n }\n }\n return records\n },\n }\n}\n\nconst norm = (s: string) => s.toLowerCase().normalize(\"NFD\").replace(/[̀-ͯ]/g, \"\").replace(/[^a-z0-9 ]/g, \"\").trim()\nconst sameName = (a: string, b: string) => norm(a) === norm(b)\n\nfunction queriesFor(name: string): string[] {\n const parts = norm(name).split(/\\s+/).filter((p) => p.length > 2)\n return parts.length > 1 ? [name, parts[parts.length - 1]] : [name]\n}\n\n/**\n * A surname search returns everyone who shares it. Requiring every token\n * of the shorter name to appear in the longer one keeps a two-word wiki\n * name matching a contact stored under just the first name, while\n * rejecting an unrelated person who shares the surname.\n */\nexport function plausible(candidate: string, wanted: string): boolean {\n const a = norm(candidate).split(/\\s+/).filter(Boolean)\n const b = norm(wanted).split(/\\s+/).filter(Boolean)\n if (a.length === 0 || b.length === 0) return false\n const [short, long] = a.length <= b.length ? [a, b] : [b, a]\n return short.every((t) => long.includes(t))\n}\n","import type { EntityHint, FactRecord, FactSource } from \"../types\"\n\n// Emails, handles and profile URLs, from the GitLab instance.\n//\n// Where most of a fleet's entries arrive through GitLab, this is the\n// system that knows who the people in them are. The user search returns\n// `organization` and `job_title` too, but both are optional and often\n// blank — the source reports what it has and stays quiet about the\n// rest, so a blank job title never reaches the prompt as a fact.\n//\n// Host and token come from the environment. There is no default host:\n// guessing one would send entity names from a private corpus to\n// whatever answers at that address.\n\nexport interface GitlabSourceOptions {\n baseUrl?: string\n token?: string\n}\n\ninterface GitlabUser {\n username?: string\n name?: string\n email?: string\n public_email?: string\n organization?: string\n job_title?: string\n web_url?: string\n state?: string\n}\n\nexport function createGitlabSource(opts: GitlabSourceOptions = {}): FactSource {\n const baseUrl = (opts.baseUrl ?? process.env.GITLAB_URL ?? \"\").replace(/\\/+$/, \"\")\n const token = opts.token ?? process.env.GITLAB_ADMIN_TOKEN ?? process.env.GITLAB_TOKEN\n\n return {\n name: \"gitlab\",\n provides: [\"email\", \"handle\", \"profile URL\"],\n async available() {\n if (!baseUrl) {\n return { kind: \"not-configured\", hint: \"export GITLAB_URL=https://<your-gitlab-host>\" }\n }\n if (!token) {\n return { kind: \"not-configured\", hint: \"export GITLAB_ADMIN_TOKEN=<PAT> (read_api scope is enough)\" }\n }\n // A present-but-rejected token is the dangerous case: every lookup\n // returns nothing, which is indistinguishable from \"this person is\n // not in GitLab\", and the corpus quietly grows a hole while the\n // source reports itself healthy. One authenticated call turns that\n // into a prompt.\n try {\n const res = await fetch(`${baseUrl}/api/v4/user`, { headers: { \"PRIVATE-TOKEN\": token } })\n if (res.status === 401 || res.status === 403) {\n return { kind: \"not-configured\", hint: `GitLab rejected the token (${res.status}) — set a valid GITLAB_ADMIN_TOKEN` }\n }\n if (!res.ok) {\n return { kind: \"failed\", hint: `GitLab returned ${res.status} for the auth probe` }\n }\n } catch (err) {\n return { kind: \"failed\", hint: `cannot reach ${baseUrl}: ${String((err as Error)?.message ?? err)}` }\n }\n return null\n },\n async lookup(hints: EntityHint[], signal?: AbortSignal) {\n if (!token || !baseUrl) return []\n const records: FactRecord[] = []\n const seen = new Set<string>()\n for (const h of hints) {\n const url = `${baseUrl}/api/v4/users?search=${encodeURIComponent(h.name)}&per_page=5`\n let users: GitlabUser[]\n try {\n const res = await fetch(url, { headers: { \"PRIVATE-TOKEN\": token }, signal })\n if (!res.ok) continue\n users = (await res.json()) as GitlabUser[]\n } catch {\n continue\n }\n if (!Array.isArray(users)) continue\n for (const u of users) {\n const key = u.username ?? u.web_url ?? \"\"\n if (!key || seen.has(key)) continue\n seen.add(key)\n const fields: Record<string, string> = {}\n const email = u.email || u.public_email\n if (email) fields.email = email\n if (u.username) fields.gitlab = `@${u.username}`\n if (u.web_url) fields.profile = u.web_url\n // Blank strings are the instance's default, not a stated fact.\n if (u.organization) fields.organisation = u.organization\n if (u.job_title) fields.role = u.job_title\n if (u.state && u.state !== \"active\") fields.accountState = u.state\n if (Object.keys(fields).length === 0) continue\n records.push({\n name: u.name ?? h.name,\n source: \"gitlab\",\n fields,\n fuzzy: (u.name ?? \"\").toLowerCase() !== h.name.toLowerCase(),\n })\n }\n }\n return records\n },\n }\n}\n","import { binaryExists, run } from \"../exec\"\nimport type { EntityHint, FactRecord, FactSource } from \"../types\"\n\n// Contact cards, from Google Contacts via `gog`.\n//\n// On this install the People API is not enabled on the OAuth project and\n// every call returns 403 accessNotConfigured. That is the normal case\n// for a source, not an exception: `available()` reports false, the\n// resolver drops it, and the absorb runs with one fewer input. Enabling\n// the API turns it on with no code change.\n\ninterface GogContact {\n names?: Array<{ displayName?: string }>\n emailAddresses?: Array<{ value?: string }>\n phoneNumbers?: Array<{ value?: string }>\n organizations?: Array<{ name?: string; title?: string }>\n addresses?: Array<{ formattedValue?: string; country?: string }>\n}\n\nexport function createGogSource(): FactSource {\n return {\n name: \"gog\",\n provides: [\"contact value\", \"email\", \"organisation\", \"role\", \"country\"],\n async available() {\n if (!(await binaryExists(\"gog\"))) {\n return { kind: \"not-installed\", hint: \"brew install gog — Google CLI\" }\n }\n // A 403 for a disabled API is reported on stdout with exit 0, so\n // the exit code alone would call this source healthy. The probe\n // takes no flags beyond -j: an unknown flag makes gog print a\n // usage error instead of calling the API, and the probe then\n // passes while every real lookup fails.\n const { stdout, stderr } = await run(\"gog\", [\"contacts\", \"list\", \"-j\"], { timeoutMs: 20_000 })\n const out = stdout + stderr\n if (/unknown flag|Run with --help/i.test(out)) {\n return { kind: \"failed\", hint: `gog rejected the probe: ${out.split(\"\\n\")[0]}` }\n }\n if (/accessNotConfigured|has not been used in project/i.test(out)) {\n return {\n kind: \"not-configured\",\n hint: \"enable the People API on the gog OAuth project, then retry (console.developers.google.com → APIs → People API)\",\n }\n }\n if (/invalid_grant|PERMISSION_DENIED|unauthenticated/i.test(out)) {\n return { kind: \"not-configured\", hint: \"gog auth login — the stored token is expired or lacks contacts scope\" }\n }\n return null\n },\n async lookup(hints: EntityHint[], signal?: AbortSignal) {\n const records: FactRecord[] = []\n for (const h of hints) {\n const { stdout, code } = await run(\"gog\", [\"contacts\", \"search\", h.name, \"-j\", \"--results-only\"], { signal, timeoutMs: 20_000 })\n if (code !== 0) continue\n let parsed: unknown\n try { parsed = JSON.parse(stdout) } catch { continue }\n const list: GogContact[] = Array.isArray(parsed)\n ? (parsed as GogContact[])\n : ((parsed as { results?: unknown[]; people?: unknown[] })?.results as GogContact[])\n ?? ((parsed as { people?: unknown[] })?.people as GogContact[])\n ?? []\n for (const c of list) {\n const fields: Record<string, string> = {}\n const phone = c.phoneNumbers?.[0]?.value\n const email = c.emailAddresses?.[0]?.value\n const org = c.organizations?.[0]\n if (phone) fields.phone = phone\n if (email) fields.email = email\n if (org?.name) fields.organisation = org.name\n if (org?.title) fields.role = org.title\n const country = c.addresses?.[0]?.country\n if (country) fields.country = country\n if (Object.keys(fields).length === 0) continue\n records.push({ name: c.names?.[0]?.displayName ?? h.name, source: \"gog\", fields })\n }\n }\n return records\n },\n }\n}\n","import type { FactRecord } from \"../types\"\nimport { countryFromPhone } from \"./wacli\"\n\n// Identifiers the entries already carry.\n//\n// Every other source in this directory asks an outside system who\n// someone is. This one asks the batch, because since senders are\n// stamped at capture the platform's own identifier travels with the\n// message: a WhatsApp JID is the number, a GitLab sender is the handle.\n//\n// That makes it the best source available, not a fallback. It needs no\n// tool installed, no token, and no network — it works on a server with\n// none of the CLIs — and it cannot mismatch, because there is no name\n// resolution step to get wrong. `wacli` answers \"who is called Alex\n// Rivera\"; this answers \"who sent this message\", and only the second\n// question has one right answer.\n\nexport interface SenderStampedEntry {\n source?: string\n meta?: Record<string, unknown> | undefined\n}\n\nconst str = (v: unknown): string | undefined =>\n typeof v === \"string\" && v.trim() ? v.trim() : undefined\n\n/** \"whatsapp@peer-server\" and \"gitlab\" both normalise to their platform. */\nexport function platformOf(source?: string): string {\n return String(source ?? \"\").split(\"@\")[0].split(\":\")[0].toLowerCase()\n}\n\n/**\n * Turn stamped sender metadata into fact records.\n *\n * Deliberately conservative about what counts as a contact value. A\n * Telegram numeric user id identifies an account but cannot be dialled,\n * messaged by a human, or pasted anywhere useful, so it is recorded as\n * an account id and never as a way to reach someone — writing it into\n * an article's contact line would satisfy the grader while helping\n * nobody, which is the exact failure this whole layer exists to undo.\n */\nexport function recordsFromEntries(entries: SenderStampedEntry[]): FactRecord[] {\n const byName = new Map<string, FactRecord>()\n\n for (const e of entries) {\n const name = str(e.meta?.sender)\n if (!name) continue\n const id = str(e.meta?.senderId)\n const username = str(e.meta?.senderUsername)\n const platform = platformOf(e.source)\n\n const fields: Record<string, string> = {}\n\n if (id && /@s\\.whatsapp\\.net$/.test(id)) {\n const digits = id.split(\"@\")[0].replace(/\\D/g, \"\")\n if (digits) {\n fields.phone = `+${digits}`\n fields.whatsapp = id\n const country = countryFromPhone(digits)\n if (country) fields.country = country\n }\n } else if (platform === \"whatsapp\" && id && /^\\d{6,}$/.test(id)) {\n fields.phone = `+${id}`\n fields.whatsapp = `${id}@s.whatsapp.net`\n const country = countryFromPhone(id)\n if (country) fields.country = country\n }\n\n if (username) {\n const handle = username.startsWith(\"@\") ? username : `@${username}`\n if (platform === \"gitlab\") fields.gitlab = handle\n else if (platform === \"github\") fields.github = handle\n else if (platform === \"telegram\") fields.telegram = handle\n else fields.handle = handle\n }\n\n // An account id is provenance, not a contact value.\n if (id && !fields.phone && !username) fields[`${platform || \"platform\"}Id`] = id\n\n if (Object.keys(fields).length === 0) continue\n\n const key = name.toLowerCase()\n const existing = byName.get(key)\n if (!existing) {\n byName.set(key, { name, source: \"entries\", fields })\n continue\n }\n // Same person across several entries — union the identifiers rather\n // than letting the last message win.\n for (const [k, v] of Object.entries(fields)) existing.fields[k] ??= v\n }\n\n return Array.from(byName.values())\n}\n","import { createContactsSource } from \"./sources/contacts\"\nimport { createGitlabSource } from \"./sources/gitlab\"\nimport { createGogSource } from \"./sources/gog\"\nimport { createWacliSource } from \"./sources/wacli\"\nimport type { EntityHint, FactRecord, FactSource, FactSourceResult, Unavailable } from \"./types\"\n\nexport * from \"./types\"\nexport { countryFromPhone, parseContactsTable, plausible } from \"./sources/wacli\"\nexport { createGitlabSource } from \"./sources/gitlab\"\nexport { createGogSource } from \"./sources/gog\"\nexport { createWacliSource } from \"./sources/wacli\"\nexport { platformOf, recordsFromEntries } from \"./sources/entries\"\nexport { createContactsSource, factsFrom, loadContacts, namesOf } from \"./sources/contacts\"\nexport type { ContactRecord } from \"./sources/contacts\"\nexport type { SenderStampedEntry } from \"./sources/entries\"\n\nexport interface ResolveOptions {\n sources?: FactSource[]\n /** Whole-resolve budget. A slow address book must not stall an absorb. */\n timeoutMs?: number\n /** Cap on entities looked up per batch — each one is N network calls. */\n maxEntities?: number\n onResult?: (r: FactSourceResult) => void\n}\n\n/**\n * Probe each source once per process, not once per lookup.\n *\n * Availability does not change mid-run, but the probes are real work —\n * gog's costs about 1.4s because it has to make an API call to\n * distinguish \"installed\" from \"installed but the API is disabled\".\n * Backfilling 50 articles re-ran every probe 50 times and spent longer\n * asking whether the sources worked than using them.\n *\n * The promise is cached, not the result, so concurrent callers share one\n * probe rather than racing.\n */\nexport function memoizeAvailability(source: FactSource): FactSource {\n let probe: Promise<Unavailable | null> | undefined\n return {\n ...source,\n available: () => (probe ??= source.available()),\n lookup: (hints, signal) => source.lookup(hints, signal),\n }\n}\n\n/**\n * Ordered by authority, because mergeRecords lets the first source to\n * state a field win.\n *\n * The hand-maintained registry comes first: it is the only source where\n * a person decided that a name, its aliases and a set of handles all\n * refer to one human. Directories only know their own corner, and they\n * cannot resolve an alias at all.\n */\nexport function defaultSources(): FactSource[] {\n return [\n createContactsSource(),\n createWacliSource(),\n createGitlabSource(),\n createGogSource(),\n ].map(memoizeAvailability)\n}\n\n/**\n * Names worth a lookup, taken from the batch.\n *\n * Only entities the batch already mentions are ever queried. That is a\n * deliberate limit and not just an efficiency one: exporting the address\n * book into a prompt would put identifiers for people who have nothing\n * to do with the work into a model's context. A lookup is justified by\n * the entry that names the person.\n */\nexport function extractHints(\n entries: Array<{ context?: string; content?: string; sender?: string }>,\n opts: { max?: number; known?: string[] } = {},\n): EntityHint[] {\n const max = opts.max ?? 25\n const byName = new Map<string, EntityHint>()\n\n // The stamped sender first: it is the platform's own record of who\n // spoke, so it beats both a heuristic over `context` and a substring\n // scan of the body. Entries captured before senders were recorded\n // simply have none, and fall through to the other two.\n for (const e of entries) {\n const s = (e.sender ?? \"\").trim()\n if (s && isPersonName(s)) byName.set(s.toLowerCase(), { name: s, origin: \"sender\", type: \"person\" })\n }\n\n for (const e of entries) {\n const ctx = (e.context ?? \"\").trim()\n if (!isPersonName(ctx)) continue\n const key = ctx.toLowerCase()\n if (byName.has(key)) continue\n byName.set(key, { name: ctx, origin: \"context\" })\n }\n\n // `context` only names a person for one-to-one channels. On a GitLab\n // entry it is the issue title, and in a group chat it is the group —\n // so the people who talk in groups, which is most of them, were never\n // looked up at all. The first article written with this layer live\n // said \"Contact identifiers: unknown … no number is recorded\" about\n // someone the contact store knew perfectly well.\n //\n // The bodies do name them, but harvesting capitalised word pairs out\n // of free text would spend lookups on noise and, worse, resolve\n // strangers. So the corpus is its own dictionary: a name is a hint\n // only if the wiki already has a person article for it. That is\n // precise by construction, and it targets exactly the articles a\n // second pass is going to rewrite.\n const known = (opts.known ?? []).filter((n) => n.trim().length > 2)\n if (known.length > 0) {\n const haystack = entries.map((e) => e.content ?? \"\").join(\"\\n\").toLowerCase()\n for (const name of known) {\n const key = name.toLowerCase().trim()\n if (byName.has(key)) continue\n if (haystack.includes(key)) byName.set(key, { name, origin: \"body\", type: \"person\" })\n }\n }\n\n return Array.from(byName.values()).slice(0, max)\n}\n\nconst NOT_A_PERSON = new Set([\n \"me\", \"user\", \"system\", \"cron\", \"unknown\", \"anonymous\", \"bot\", \"agent\",\n \"self\", \"test\", \"admin\", \"none\", \"null\", \"n/a\",\n])\n\n/**\n * Words that make a capitalised phrase a collection rather than a person.\n *\n * A group chat's `context` is its name, and plenty of group names are\n * shaped exactly like a person's — \"Team Group\", \"Acme Family\". Shape\n * alone cannot separate them, and treating one as a person spends a\n * lookup and risks matching a real contact with a similar name.\n */\nconst COLLECTION_NOUNS = new Set([\n \"group\", \"team\", \"chat\", \"channel\", \"squad\", \"crew\", \"room\", \"family\",\n \"project\", \"board\", \"committee\", \"club\", \"staff\", \"office\", \"dept\",\n \"department\", \"support\", \"sales\", \"ops\", \"admins\", \"everyone\", \"all\",\n])\n\n/**\n * Two to four capitalised words, no digits, not a known placeholder.\n *\n * `context` holds a person's name for chat sources and an issue title\n * for GitLab ones, and issue titles are long and full of punctuation.\n * The bar is deliberately high: a false positive costs a wasted lookup\n * and, worse, risks putting an unrelated person's identifiers into the\n * prompt, so a missed name is the cheaper error.\n */\nexport function isPersonName(s: string): boolean {\n const t = s.trim()\n if (!t || t.length > 48) return false\n if (NOT_A_PERSON.has(t.toLowerCase())) return false\n if (/[\\d@/\\\\#:|_]/.test(t)) return false\n const words = t.split(/\\s+/)\n if (words.length < 2 || words.length > 4) return false\n if (words.some((w) => COLLECTION_NOUNS.has(w.toLowerCase()))) return false\n return words.every((w) => /^[\\p{Lu}][\\p{L}'’.-]*$/u.test(w))\n}\n\nexport async function resolveFacts(\n hints: EntityHint[],\n opts: ResolveOptions = {},\n): Promise<{ records: FactRecord[]; results: FactSourceResult[] }> {\n const sources = opts.sources ?? defaultSources()\n const picked = hints.slice(0, opts.maxEntities ?? 25)\n if (picked.length === 0) return { records: [], results: [] }\n\n const ac = new AbortController()\n const timer = setTimeout(() => ac.abort(), opts.timeoutMs ?? 120_000)\n try {\n const results = await Promise.all(sources.map(async (s): Promise<FactSourceResult> => {\n const t0 = Date.now()\n try {\n const why = await s.available()\n if (why) return { source: s.name, records: [], unavailable: why, ms: Date.now() - t0 }\n const records = await s.lookup(picked, ac.signal)\n return { source: s.name, records, ms: Date.now() - t0 }\n } catch (err) {\n // A source that throws contributes nothing and blocks nothing.\n return {\n source: s.name,\n records: [],\n unavailable: { kind: \"failed\", hint: String((err as Error)?.message ?? err) },\n ms: Date.now() - t0,\n }\n }\n }))\n for (const r of results) opts.onResult?.(r)\n return { records: results.flatMap((r) => r.records), results }\n } finally {\n clearTimeout(timer)\n }\n}\n\n/**\n * What to tell the operator about the sources that did not answer.\n *\n * A source silently contributing nothing is the worst outcome: the\n * corpus quietly develops a hole shaped like the missing tool, and the\n * grader reports the resulting gaps as though the fact did not exist\n * anywhere. Installing `wacli` is a one-line fix that nobody makes if\n * nobody is told. `failed` is left out — a transient error is noise, not\n * a task.\n */\nexport function installPrompts(\n results: FactSourceResult[],\n sources: FactSource[] = defaultSources(),\n): Array<{ source: string; kind: string; hint: string; provides: string[] }> {\n const provides = new Map(sources.map((s) => [s.name, s.provides]))\n return results\n .filter((r) => r.unavailable && r.unavailable.kind !== \"failed\")\n .map((r) => ({\n source: r.source,\n kind: r.unavailable!.kind,\n hint: r.unavailable!.hint,\n provides: provides.get(r.source) ?? [],\n }))\n}\n\nexport interface MergedEntity {\n name: string\n /** field → value, with the source that supplied it. */\n fields: Record<string, { value: string; source: string }>\n}\n\n/**\n * Merge per entity, first source to state a field wins.\n *\n * Order is the source order, which puts WhatsApp's number ahead of\n * Google's. That is intentional rather than arbitrary: the WhatsApp\n * number is the one the agent will actually message on, so where the two\n * disagree the messaging channel's own record is the operative fact.\n * Conflicts are kept and rendered, never silently resolved.\n */\nexport function mergeRecords(records: FactRecord[]): MergedEntity[] {\n const out = new Map<string, MergedEntity>()\n for (const r of records) {\n const key = r.name.toLowerCase().trim()\n let e = out.get(key)\n if (!e) { e = { name: r.name, fields: {} }; out.set(key, e) }\n for (const [k, v] of Object.entries(r.fields)) {\n if (!v?.trim()) continue\n const existing = e.fields[k]\n if (!existing) { e.fields[k] = { value: v, source: r.source }; continue }\n if (existing.value !== v) {\n // Two systems of record disagree. The writer should see both.\n e.fields[`${k} (${r.source})`] ??= { value: v, source: r.source }\n }\n }\n }\n return Array.from(out.values())\n}\n\n/**\n * The prompt block.\n *\n * Phrased as an instruction to copy rather than as context to consider.\n * Absorb's whole disposition is to summarise, and an identifier\n * summarised is an identifier lost — which is the failure this exists\n * to fix.\n */\nexport function renderFactsBlock(entities: MergedEntity[]): string {\n if (entities.length === 0) return \"\"\n const lines = entities\n .filter((e) => Object.keys(e.fields).length > 0)\n .map((e) => {\n const fields = Object.entries(e.fields)\n .map(([k, v]) => ` - ${k}: \\`${v.value}\\` _(${v.source})_`)\n .join(\"\\n\")\n return `- **${e.name}**\\n${fields}`\n })\n if (lines.length === 0) return \"\"\n return `\n## Verified facts\n\nThese were read from systems of record — WhatsApp, GitLab, Google, the\nERP — not from the entries. They are more reliable than anything the\nconversation implies, and they are the identity fields articles are\ngraded on.\n\nCopy every value that belongs to an article you write, **verbatim**, into\nits Identity section. Do not paraphrase an identifier, reformat it, or\nreplace it with the name of the channel it belongs to. Where a fact here\ncontradicts the entries, this wins and the entry is stale.\n\n${lines.join(\"\\n\")}\n`\n}\n"],"mappings":"4BAAA,OAAS,cAAAA,EAAY,gBAAAC,MAAoB,KACzC,OAAS,WAAAC,MAAe,OCDxB,OAAS,YAAAC,MAAgB,gBAQlB,SAASC,EACdC,EACAC,EACAC,EAAqD,CAAC,EACK,CAC3D,OAAO,IAAI,QAASC,GAAY,CAC9BL,EACEE,EACAC,EACA,CACE,QAASC,EAAK,WAAa,KAC3B,OAAQA,EAAK,OACb,UAAW,EAAI,KAAO,KAGtB,IAAK,CACH,GAAG,QAAQ,IACX,KAAM,CACJ,QAAQ,IAAI,MAAQ,GACpB,oBACA,iBACA,GAAG,QAAQ,IAAI,MAAQ,eACzB,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,CAC5B,CACF,EACA,CAACE,EAAKC,EAAQC,IAAW,CACvB,IAAMC,EAAOH,GAAO,OAAQA,EAA2B,MAAS,SA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M,CAAE,MAAOM,EAAG,OAAQN,EAAE,MAAO,IAItE,OAAO,MAAM,KAAKI,EAAI,OAAO,CAAC,CAChC,CAUO,SAASI,GAAiBC,EAAkC,CACjE,GAAIA,EAAS,SAAW,EAAG,MAAO,GAClC,IAAMC,EAAQD,EACX,OAAQhC,GAAM,OAAO,KAAKA,EAAE,MAAM,EAAE,OAAS,CAAC,EAC9C,IAAKA,GAAM,CACV,IAAMkC,EAAS,OAAO,QAAQlC,EAAE,MAAM,EACnC,IAAI,CAAC,CAAC4B,EAAGC,CAAC,IAAM,OAAOD,QAAQC,EAAE,aAAaA,EAAE,UAAU,EAC1D,KAAK;AAAA,CAAI,EACZ,MAAO,OAAO7B,EAAE;AAAA,EAAWkC,GAC7B,CAAC,EACH,OAAID,EAAM,SAAW,EAAU,GACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaPA,EAAM,KAAK;AAAA,CAAI;AAAA,CAEjB","names":["existsSync","readFileSync","resolve","execFile","run","cmd","args","opts","resolve","err","stdout","stderr","code","binaryExists","which","CC","countryFromPhone","phone","d","best","bestLen","code","name","parseContactsTable","stdout","out","line","t","cols","jid","country","createWacliSource","binaryExists","stderr","run","hints","signal","records","seen","h","q","queriesFor","hit","r","plausible","key","sameName","norm","s","a","b","parts","p","candidate","wanted","short","long","CHANNEL_FIELDS","contactsPath","agentxDir","resolve","loadContacts","path","existsSync","parsed","readFileSync","norm","s","namesOf","c","x","factsFrom","fields","key","raw","value","field","digits","country","countryFromPhone","createContactsSource","opts","hints","contacts","index","n","out","seen","h","createGitlabSource","opts","baseUrl","token","res","err","hints","signal","records","seen","h","url","users","u","key","fields","email","createGogSource","binaryExists","stdout","stderr","run","out","hints","signal","records","h","code","parsed","list","c","fields","phone","email","org","country","str","v","platformOf","source","recordsFromEntries","entries","byName","e","name","id","username","platform","fields","digits","country","countryFromPhone","handle","key","existing","k","memoizeAvailability","source","probe","hints","signal","defaultSources","createContactsSource","createWacliSource","createGitlabSource","createGogSource","extractHints","entries","opts","max","byName","e","s","isPersonName","ctx","key","known","n","haystack","name","NOT_A_PERSON","COLLECTION_NOUNS","words","w","resolveFacts","sources","picked","ac","timer","results","t0","why","records","err","r","installPrompts","provides","mergeRecords","out","k","v","existing","renderFactsBlock","entities","lines","fields"]}
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-W5C2GDNC.js";import"./chunk-SFQUP3BP.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-FIOB3MEX.js";export{a as HealEngine};
2
+ //# sourceMappingURL=heal-FVLBHYP7.js.map