@wirecat/mail-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 (157) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +3 -0
  3. package/contracts/wirecat.json +1325 -0
  4. package/dist/bin/mail.js +2 -2
  5. package/dist/bin/mail.js.map +1 -1
  6. package/dist/bundle/{all-profiles-QEV2PSOR.js → all-profiles-5XWH7TBM.js} +11 -11
  7. package/dist/bundle/{anthropic-5NKQXIHM.js → anthropic-QEQGUEPW.js} +5 -5
  8. package/dist/bundle/{app-server-G2CJNT4R.js → app-server-YWDU56NR.js} +55 -51
  9. package/dist/bundle/{bun-6HBYWQIX.js → bun-PWMM6L45.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-DXIQ7BVR.js → bun-sqlite-S4QD5YUO.js} +6 -6
  11. package/dist/bundle/{chunk-37F6QYTO.js → chunk-255RGG5W.js} +6 -6
  12. package/dist/bundle/{chunk-DIA56CS7.js → chunk-2FZMIJW7.js} +11 -7
  13. package/dist/bundle/{chunk-S2QRAKQI.js → chunk-4VDWQKDI.js} +17 -17
  14. package/dist/bundle/{chunk-QB3DP2TN.js → chunk-572NWJUN.js} +2 -2
  15. package/dist/bundle/{chunk-PHHH2NQP.js → chunk-5BPOEPYL.js} +15 -113
  16. package/dist/bundle/{chunk-VL6H2BND.js → chunk-5DLPM5AV.js} +18 -17
  17. package/dist/bundle/{chunk-HEIDAHRC.js → chunk-77J5ID2O.js} +2 -2
  18. package/dist/bundle/{chunk-5ZYFV6FD.js → chunk-7BXOFLWJ.js} +129 -74
  19. package/dist/bundle/{chunk-L4QVOEOB.js → chunk-7C6FGWDH.js} +4 -4
  20. package/dist/bundle/{chunk-VUBZFMGP.js → chunk-7KCBPAQS.js} +2 -2
  21. package/dist/bundle/{chunk-TY644DKQ.js → chunk-7MEVD5PI.js} +57 -28
  22. package/dist/bundle/{chunk-WOAYHCM2.js → chunk-AIEMFRBU.js} +1 -1
  23. package/dist/bundle/{chunk-WX6OYVCH.js → chunk-AIZ225IA.js} +379 -270
  24. package/dist/bundle/{chunk-K2OGF7KC.js → chunk-APLVXHFG.js} +2 -2
  25. package/dist/bundle/{chunk-GY4XCLCO.js → chunk-BZCXAVGP.js} +8 -8
  26. package/dist/bundle/{chunk-434YOD6A.js → chunk-CKFVKHTB.js} +4 -4
  27. package/dist/bundle/{chunk-B7SWTH5O.js → chunk-CZRMT6XV.js} +2 -2
  28. package/dist/bundle/{chunk-Z5T6OW3V.js → chunk-DQO2LX5I.js} +4 -4
  29. package/dist/bundle/{chunk-OLKCJBZY.js → chunk-DSUOYJUL.js} +5 -5
  30. package/dist/bundle/{chunk-IZOYW4Z4.js → chunk-ECZSYLSL.js} +24 -9
  31. package/dist/bundle/{chunk-YNS2YVUR.js → chunk-ELPH22W6.js} +9 -9
  32. package/dist/bundle/{chunk-JG4MNYG2.js → chunk-EXWZCI5G.js} +1 -1
  33. package/dist/bundle/{chunk-MCPOZNWG.js → chunk-FIVFP53N.js} +1 -1
  34. package/dist/bundle/{chunk-HLXVUMZJ.js → chunk-FOTP6QLO.js} +2 -2
  35. package/dist/bundle/{chunk-SMTBV62X.js → chunk-FVVSBQGK.js} +29 -25
  36. package/dist/bundle/{chunk-XQYKIZMG.js → chunk-HBK6MRAL.js} +12 -9
  37. package/dist/bundle/{chunk-5QYK3LWS.js → chunk-IDOHT4Z3.js} +123 -42
  38. package/dist/bundle/{chunk-4W4EVVL4.js → chunk-IX3GUNGV.js} +4 -4
  39. package/dist/bundle/{chunk-7GLJSJ7M.js → chunk-KHBZ4OEP.js} +1 -1
  40. package/dist/bundle/{chunk-RX5CJ55S.js → chunk-M4OP5ASJ.js} +1 -1
  41. package/dist/bundle/{chunk-CBYBZCQP.js → chunk-MY4LVD64.js} +3 -2
  42. package/dist/bundle/{chunk-OLLIWNFG.js → chunk-NZG6IRDW.js} +3 -3
  43. package/dist/bundle/{chunk-ND5H5ADM.js → chunk-OC3U2JAK.js} +4 -4
  44. package/dist/bundle/{chunk-KFB2X6KE.js → chunk-OCUKQRJ3.js} +201 -160
  45. package/dist/bundle/{chunk-PQMJ5BXH.js → chunk-OEPNLKHI.js} +4 -4
  46. package/dist/bundle/{chunk-GJRYZXBN.js → chunk-OPOEAGVB.js} +9 -9
  47. package/dist/bundle/{chunk-VFU7PVPQ.js → chunk-PA7LDYVX.js} +62 -60
  48. package/dist/bundle/{chunk-NMZQTYKJ.js → chunk-PJ3FKBXG.js} +1 -1
  49. package/dist/bundle/{chunk-A6BPOX5O.js → chunk-PRSXMM4I.js} +3825 -3516
  50. package/dist/bundle/{chunk-HEYVMAAQ.js → chunk-QQTSPQ2D.js} +2 -2
  51. package/dist/bundle/{chunk-IXO4SCKE.js → chunk-QVJMFZFW.js} +1 -1
  52. package/dist/bundle/{chunk-J4OYK4WL.js → chunk-R3A65A4D.js} +12 -12
  53. package/dist/bundle/{chunk-QQUY4MZY.js → chunk-R5FTCNLJ.js} +1 -1
  54. package/dist/bundle/{chunk-XMDEM6BZ.js → chunk-RGQFVVBB.js} +276 -254
  55. package/dist/bundle/{chunk-FZZD4AFY.js → chunk-ROLHKFKB.js} +26 -18
  56. package/dist/bundle/{chunk-PP3YOAWG.js → chunk-RRLAFEPQ.js} +3 -3
  57. package/dist/bundle/{chunk-3XVR2ROR.js → chunk-S2QRW647.js} +35 -31
  58. package/dist/bundle/{chunk-G5LHHAW2.js → chunk-S7H7TAC3.js} +6 -6
  59. package/dist/bundle/{chunk-U6IQ6YQ2.js → chunk-SXKKOOA7.js} +8 -2
  60. package/dist/bundle/{chunk-MBFPFWCO.js → chunk-T7VERZP5.js} +27 -27
  61. package/dist/bundle/{chunk-ADKMBXY4.js → chunk-TI2OANJZ.js} +1 -1
  62. package/dist/bundle/{chunk-EXVY76VO.js → chunk-TKOZCIHU.js} +19 -18
  63. package/dist/bundle/{chunk-BC7PFQL7.js → chunk-UBH4UPZ7.js} +40 -2
  64. package/dist/bundle/{chunk-P6GXNT7Z.js → chunk-UEJVXUIO.js} +13 -13
  65. package/dist/bundle/{chunk-IACWKZWS.js → chunk-UIKVP23D.js} +1 -1
  66. package/dist/bundle/{chunk-LGZPKKBN.js → chunk-VYZ37D2Q.js} +3 -2
  67. package/dist/bundle/{chunk-HJSJBNCJ.js → chunk-WMXUFUV3.js} +28 -9
  68. package/dist/bundle/{chunk-CIWWNBVW.js → chunk-WRHAX53U.js} +8 -8
  69. package/dist/bundle/{chunk-LVGX7VTD.js → chunk-XBL46B4V.js} +63 -5
  70. package/dist/bundle/{chunk-KK4HD3SI.js → chunk-XCYDTIVK.js} +7 -7
  71. package/dist/bundle/{chunk-PGC5TRH6.js → chunk-XM2THVMR.js} +3 -3
  72. package/dist/bundle/{chunk-MWGH3M46.js → chunk-ZSWSFKNE.js} +5 -7
  73. package/dist/bundle/{chunk-T27IMG6X.js → chunk-ZVQDOKDY.js} +1 -1
  74. package/dist/bundle/command-contract-MIJONVVG.js +36 -0
  75. package/dist/bundle/{command-server-entry-XMSSY5ID.js → command-server-entry-VHUFW3OZ.js} +25 -25
  76. package/dist/bundle/{decode-RYGB4PGT.js → decode-TIMTSVXM.js} +5 -5
  77. package/dist/bundle/{dispatch-PLQOIZG5.js → dispatch-DSVN7MNG.js} +8 -8
  78. package/dist/bundle/{dist-GY2AQETI.js → dist-IP25JFTN.js} +19 -15
  79. package/dist/bundle/{echarts-7CM2MCMW.js → echarts-SDZA2SWG.js} +2 -2
  80. package/dist/bundle/{embed-FTBDPOPT.js → embed-4W527BCE.js} +6 -6
  81. package/dist/bundle/{embedder-B43WGNBD.js → embedder-LQE2SBJ3.js} +9 -9
  82. package/dist/bundle/{failure-XP5QYV2T.js → failure-COTPFUP4.js} +2 -2
  83. package/dist/bundle/{first-run-XIIUARNM.js → first-run-KZTKMEI4.js} +12 -12
  84. package/dist/bundle/first-screen-4LG5SJ6D.js +34 -0
  85. package/dist/bundle/{instructions-R7OHVAWH.js → instructions-7T6JJIFS.js} +1 -1
  86. package/dist/bundle/mail.js +15 -20
  87. package/dist/bundle/{mcp-7KQUJNFN.js → mcp-TDKGDB4V.js} +2 -2
  88. package/dist/bundle/{node-3N2JGZ7V.js → node-BZDMUFTW.js} +2 -2
  89. package/dist/bundle/{node-sqlite-WFJXW3CZ.js → node-sqlite-PVSKI4OS.js} +7 -7
  90. package/dist/bundle/{oauth-SVJLQTWV.js → oauth-TGYGAVGF.js} +7 -7
  91. package/dist/bundle/{open-ZDONVKSX.js → open-5YED4Q4C.js} +5 -5
  92. package/dist/bundle/{openai-XVEW6XOU.js → openai-XVJTML22.js} +21 -20
  93. package/dist/bundle/{process-YAHHUFR5.js → process-756VBE7E.js} +1 -1
  94. package/dist/bundle/{program-HU2UVMJE.js → program-TDHDXAQA.js} +1499 -998
  95. package/dist/bundle/{prompt-JAJ2CUJI.js → prompt-HPZANASN.js} +5 -5
  96. package/dist/bundle/{recognize-UFBWUNFR.js → recognize-PP5XQQHH.js} +4 -4
  97. package/dist/bundle/{remote-2GFOVLCR.js → remote-C2LU2WYG.js} +9 -9
  98. package/dist/bundle/{rerank-BGPSMXTL.js → rerank-WRHNOM4Z.js} +7 -7
  99. package/dist/bundle/{serve-CB3XJTH3.js → serve-RE3IV2QB.js} +9 -9
  100. package/dist/bundle/server-43V7HNFY.js +68 -0
  101. package/dist/bundle/{server-M7FQY7TX.js → server-52BJ7UTO.js} +44 -42
  102. package/dist/bundle/{sqlite-runtime-AEV6PGDR.js → sqlite-runtime-CRRL3MYX.js} +6 -6
  103. package/dist/bundle/{state-YLBEQLBI.js → state-YGJRPMWD.js} +6 -6
  104. package/dist/bundle/{store-EKWKY6GG.js → store-6AZ5LVJL.js} +21 -19
  105. package/dist/bundle/{store-CDUL3HKK.js → store-ESQE4VHP.js} +17 -17
  106. package/dist/bundle/store-maintenance-command-AKQMKUYO.js +58 -0
  107. package/dist/commands/rules.d.ts.map +1 -1
  108. package/dist/commands/rules.js +57 -19
  109. package/dist/commands/rules.js.map +1 -1
  110. package/dist/commands/session-start.d.ts.map +1 -1
  111. package/dist/commands/session-start.js +1 -1
  112. package/dist/commands/session-start.js.map +1 -1
  113. package/dist/config.d.ts +1 -0
  114. package/dist/config.d.ts.map +1 -1
  115. package/dist/config.js +13 -12
  116. package/dist/config.js.map +1 -1
  117. package/dist/discovery.d.ts.map +1 -1
  118. package/dist/discovery.js +7 -2
  119. package/dist/discovery.js.map +1 -1
  120. package/dist/identity.d.ts +2 -0
  121. package/dist/identity.d.ts.map +1 -1
  122. package/dist/identity.js +34 -0
  123. package/dist/identity.js.map +1 -1
  124. package/dist/mail/domain-age.d.ts +1 -1
  125. package/dist/mail/domain-age.d.ts.map +1 -1
  126. package/dist/mail/domain-age.js +9 -3
  127. package/dist/mail/domain-age.js.map +1 -1
  128. package/dist/mail/rules/file.d.ts.map +1 -1
  129. package/dist/mail/rules/file.js +4 -1
  130. package/dist/mail/rules/file.js.map +1 -1
  131. package/dist/mail/rules/query.d.ts +2 -1
  132. package/dist/mail/rules/query.d.ts.map +1 -1
  133. package/dist/mail/rules/query.js +16 -3
  134. package/dist/mail/rules/query.js.map +1 -1
  135. package/dist/oauth.d.ts +3 -1
  136. package/dist/oauth.d.ts.map +1 -1
  137. package/dist/oauth.js +48 -34
  138. package/dist/oauth.js.map +1 -1
  139. package/dist/reasons.d.ts.map +1 -1
  140. package/dist/reasons.js +5 -0
  141. package/dist/reasons.js.map +1 -1
  142. package/dist/store.d.ts.map +1 -1
  143. package/dist/store.js +2 -21
  144. package/dist/store.js.map +1 -1
  145. package/dist/version.d.ts +1 -1
  146. package/dist/version.js +1 -1
  147. package/dist/wcat.d.ts +3 -0
  148. package/dist/wcat.d.ts.map +1 -0
  149. package/dist/wcat.js +4 -0
  150. package/dist/wcat.js.map +1 -0
  151. package/package.json +10 -9
  152. package/dist/bundle/chunk-K6HR6HCO.js +0 -32
  153. package/dist/bundle/command-contract-XSW2Q33S.js +0 -36
  154. package/dist/bundle/first-screen-Z7HC6PQU.js +0 -34
  155. package/dist/bundle/server-34GEF22R.js +0 -68
  156. package/dist/bundle/store-maintenance-command-XH2JUM5F.js +0 -58
  157. /package/dist/bundle/{chunk-YVNHQFLC.js → chunk-XWBPP2HX.js} +0 -0
@@ -20,20 +20,20 @@ import {
20
20
  providerLabel,
21
21
  providerNamed,
22
22
  queryError
23
- } from "./chunk-5ZYFV6FD.js";
23
+ } from "./chunk-7BXOFLWJ.js";
24
24
  import {
25
25
  fold
26
- } from "./chunk-7GLJSJ7M.js";
26
+ } from "./chunk-KHBZ4OEP.js";
27
27
  import {
28
28
  CliError,
29
29
  isCliError,
30
30
  singleLine
31
- } from "./chunk-VUBZFMGP.js";
31
+ } from "./chunk-7KCBPAQS.js";
32
32
  import {
33
33
  __name
34
34
  } from "./chunk-ZVVMGPBJ.js";
35
35
 
36
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
36
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
37
37
  var TAKES = {
38
38
  chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
39
39
  message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
@@ -93,7 +93,7 @@ var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn)
93
93
  throw wrongAccount(reference, scope, profiles);
94
94
  }, "ensureAccount");
95
95
 
96
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
96
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
97
97
  var QUERY_VERSION = 1;
98
98
  var QUERY_LIMITS2 = {
99
99
  ...QUERY_LIMITS,
@@ -138,7 +138,7 @@ function tooWideTerm([term], budget) {
138
138
  }
139
139
  __name(tooWideTerm, "tooWideTerm");
140
140
 
141
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
141
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
142
142
  var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
143
143
  var literal = /* @__PURE__ */ __name((c) => ({
144
144
  kind: "char",
@@ -538,7 +538,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
538
538
  return out;
539
539
  }, "foldRegex");
540
540
 
541
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/search/trigrams.js
541
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/search/trigrams.js
542
542
  var trigrams = /* @__PURE__ */ __name((term) => {
543
543
  const padded = ` ${term} `;
544
544
  const pieces = /* @__PURE__ */ new Set();
@@ -547,7 +547,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
547
547
  return [...pieces];
548
548
  }, "trigrams");
549
549
 
550
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/resolve.js
550
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/resolve.js
551
551
  var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
552
552
  var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase().replaceAll("\u0451", "\u0435"), "foldName");
553
553
  var pickChat = /* @__PURE__ */ __name((reference, chats) => {
@@ -618,7 +618,7 @@ ${lines}`, { candidates });
618
618
  }, "ambiguous");
619
619
  var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
620
620
 
621
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
621
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
622
622
  var DECIMAL_PATTERN = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
623
623
  var SIGNED_DECIMAL = "^-?[0-9]{1,16}(\\.[0-9]{1,6})?$";
624
624
  var DAY = "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
@@ -668,7 +668,7 @@ var arrayOf = /* @__PURE__ */ __name((item, maxItems, description) => ({
668
668
  }), "arrayOf");
669
669
  var isObject = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isObject");
670
670
 
671
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/record-types.js
671
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/record-types.js
672
672
  var kept = /* @__PURE__ */ __name((description) => ({ description }), "kept");
673
673
  var PARTY = ["person", "organization"];
674
674
  var ORGANIZATION = ["organization"];
@@ -966,6 +966,7 @@ var RECORD_TYPES = {
966
966
  update: "in-place",
967
967
  tombstone: true,
968
968
  importOnly: true,
969
+ sheet: false,
969
970
  fields: objectOf({
970
971
  kind: enumOf(["sms"], "sms: a text message of the phone"),
971
972
  direction: enumOf(SMS_DIRECTIONS, "in: the other side wrote it; out: the owner did"),
@@ -983,6 +984,7 @@ var RECORD_TYPES = {
983
984
  update: "in-place",
984
985
  tombstone: true,
985
986
  importOnly: true,
987
+ sheet: false,
986
988
  fields: objectOf({
987
989
  kind: enumOf(["call"], "call: a phone call"),
988
990
  direction: enumOf(CALL_DIRECTIONS, "in, out, or missed: a call the owner did not take"),
@@ -992,6 +994,25 @@ var RECORD_TYPES = {
992
994
  }, { required: ["kind", "direction", "phone", "started_at"] }),
993
995
  roles: COUNTERPART
994
996
  },
997
+ document: {
998
+ table: "documents",
999
+ review: "direct",
1000
+ update: "in-place",
1001
+ tombstone: true,
1002
+ importOnly: true,
1003
+ fieldsBytes: 1048576,
1004
+ fields: objectOf({
1005
+ title: text("What the document is called; its external id when left out", 500),
1006
+ text: { type: "string", maxLength: 1e6, description: "The text search reads" },
1007
+ created_at: instant("When the source made it"),
1008
+ updated_at: instant("When the source last changed it: what date: reads"),
1009
+ url: text("Where the original is", 4096),
1010
+ metadata: { type: "object", description: "Anything else the source knows about it, kept as sent" }
1011
+ }, { required: ["text"] }),
1012
+ roles: {
1013
+ about: { targets: ["person", "organization", "deal", "event"], many: true }
1014
+ }
1015
+ },
995
1016
  pipeline: {
996
1017
  table: "pipelines",
997
1018
  review: "direct",
@@ -1012,7 +1033,7 @@ var RECORD_TYPES = {
1012
1033
  }
1013
1034
  };
1014
1035
  var isRecordType = /* @__PURE__ */ __name((type) => Object.hasOwn(RECORD_TYPES, type), "isRecordType");
1015
- var isBusinessType = /* @__PURE__ */ __name((type) => isRecordType(type) && RECORD_TYPES[type].review !== "identity", "isBusinessType");
1036
+ var isBusinessType = /* @__PURE__ */ __name((type) => isRecordType(type) && RECORD_TYPES[type].review !== "identity" && type !== "document", "isBusinessType");
1016
1037
  var isIdentityType = /* @__PURE__ */ __name((type) => typeof type === "string" && isRecordType(type) && RECORD_TYPES[type].review === "identity", "isIdentityType");
1017
1038
  var RECORD_ENTITY_TYPES = Object.keys(RECORD_TYPES);
1018
1039
  var RECORD_TABLES = Object.fromEntries(Object.entries(RECORD_TYPES).map(([type, spec]) => [type, spec.table]));
@@ -1042,7 +1063,7 @@ var hasV1Roles = /* @__PURE__ */ __name((type) => rolesOf(type).some(([, role])
1042
1063
  var IDENTITY_TYPES = RECORD_ENTITY_TYPES.filter((type) => RECORD_TYPES[type].review === "identity");
1043
1064
  var article2 = /* @__PURE__ */ __name((word) => /^[aeiou]/.test(word) ? "an" : "a", "article");
1044
1065
 
1045
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/addresses.js
1066
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/addresses.js
1046
1067
  var EMAIL_ADDRESS = /^[^\s@]+@[^\s@]+\.[^\s@]+$/u;
1047
1068
  var isEmailAddress = /* @__PURE__ */ __name((value) => EMAIL_ADDRESS.test(value), "isEmailAddress");
1048
1069
  var ROLE_ADDRESS_WORDS = {
@@ -1104,245 +1125,7 @@ var PERSON_LIKE = /* @__PURE__ */ new Set(["hr"]);
1104
1125
  var isPersonLikeRoleAddress = /* @__PURE__ */ __name((address) => PERSON_LIKE.has(localWord(address)), "isPersonLikeRoleAddress");
1105
1126
  var isNoReplyAddress = /* @__PURE__ */ __name((address) => NO_REPLY.has(localWord(address)), "isNoReplyAddress");
1106
1127
 
1107
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/display-names.js
1108
- var QUOTES = [
1109
- ['"', '"'],
1110
- ["'", "'"],
1111
- ["\xAB", "\xBB"],
1112
- ["\u201C", "\u201D"],
1113
- ["\u201E", "\u201C"],
1114
- ["\u2018", "\u2019"],
1115
- ["`", "`"]
1116
- ];
1117
- var READABLE = /[\p{L}\p{N}]/u;
1118
- var PLACEHOLDERS = /* @__PURE__ */ new Set(["null", "undefined", "none", "\u0431\u0435\u0437 \u0438\u043C\u0435\u043D\u0438", "deleted account", "\u0443\u0434\u0430\u043B\u0451\u043D\u043D\u044B\u0439 \u0430\u043A\u043A\u0430\u0443\u043D\u0442"]);
1119
- var unquoted = /* @__PURE__ */ __name((text2) => {
1120
- let at = text2.replace(/\s+/gu, " ").trim();
1121
- for (; ; ) {
1122
- const pair = QUOTES.find(([open, close]) => at.length >= 2 && at.startsWith(open) && at.endsWith(close));
1123
- if (pair === void 0)
1124
- return at;
1125
- at = at.slice(pair[0].length, at.length - pair[1].length).trim();
1126
- }
1127
- }, "unquoted");
1128
- var given = /* @__PURE__ */ __name((value) => {
1129
- const text2 = typeof value === "string" ? value.trim() : "";
1130
- return text2 === "" ? void 0 : text2;
1131
- }, "given");
1132
- var displayName = /* @__PURE__ */ __name((name, fallbacks = {}) => {
1133
- const unwrapped = typeof name === "string" ? unquoted(name) : "";
1134
- const cleaned = PLACEHOLDERS.has(unwrapped.toLowerCase()) ? "" : unwrapped;
1135
- if (READABLE.test(cleaned))
1136
- return cleaned;
1137
- const borrowed = fallbacks.name === void 0 || fallbacks.name === null ? null : displayName(fallbacks.name);
1138
- if (borrowed !== null && READABLE.test(borrowed) && !borrowed.startsWith("@"))
1139
- return borrowed;
1140
- const username = given(fallbacks.username);
1141
- return (username === void 0 ? void 0 : username.startsWith("@") ? username : `@${username}`) ?? given(fallbacks.phone) ?? given(fallbacks.email) ?? (cleaned === "" ? null : cleaned);
1142
- }, "displayName");
1143
- var present = /* @__PURE__ */ __name((value) => typeof value === "string" && value !== "" ? value : null, "present");
1144
- var takeFallbacks = /* @__PURE__ */ __name((into, identity) => {
1145
- const named = displayName(identity.name);
1146
- if (into.name === null && isReadable(named) && !named?.startsWith("@"))
1147
- into.name = named;
1148
- into.username ??= present(identity.username);
1149
- into.phone ??= present(identity.phone) ?? (identity.provider === "phone" ? identity.id : null);
1150
- into.email ??= present(identity.email) ?? (identity.provider === "email" ? identity.id : null);
1151
- return into;
1152
- }, "takeFallbacks");
1153
- var noFallbacks = /* @__PURE__ */ __name(() => ({ name: null, username: null, phone: null, email: null }), "noFallbacks");
1154
- var nameKey = /* @__PURE__ */ __name((name) => {
1155
- if (typeof name !== "string")
1156
- return null;
1157
- const unwrapped = unquoted(name);
1158
- if (PLACEHOLDERS.has(unwrapped.toLowerCase()))
1159
- return null;
1160
- const words = foldName(unwrapped).split(/[^\p{L}\p{N}]+/u).filter((word) => word !== "");
1161
- return words.length === 0 ? null : words.sort().join(" ");
1162
- }, "nameKey");
1163
- var isReadable = /* @__PURE__ */ __name((shown) => shown !== null && READABLE.test(shown), "isReadable");
1164
-
1165
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/counters.js
1166
- var COUNTER_FIELDS = ["views", "reactions", "comments"];
1167
- var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
1168
- var counterValue = /* @__PURE__ */ __name((message, field) => {
1169
- const value = field === "reactions" ? message.reactions?.total : message.providerMetadata?.[field];
1170
- return validCounter(value) ? value : null;
1171
- }, "counterValue");
1172
- var counterObservationTime = /* @__PURE__ */ __name((observation, now) => {
1173
- const at = Date.parse(observation.observedAt);
1174
- if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now || !["remote_fetch", "remote_update"].includes(observation.source))
1175
- throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
1176
- if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
1177
- throw new CliError("validation_error", "reaction observation payload and total disagree");
1178
- return at;
1179
- }, "counterObservationTime");
1180
- var observedCounters = /* @__PURE__ */ __name((message, observedAt, fields, source = "remote_fetch") => {
1181
- const observations = {};
1182
- for (const field of fields) {
1183
- const value = counterValue(message, field);
1184
- if (value !== null)
1185
- observations[field] = {
1186
- value,
1187
- observedAt,
1188
- source,
1189
- ...field === "reactions" && message.reactions ? { reactions: message.reactions } : {}
1190
- };
1191
- }
1192
- return { ...message, counterObservations: observations };
1193
- }, "observedCounters");
1194
- var counterFreshness = /* @__PURE__ */ __name((states) => {
1195
- if (!states.length || states.every((one) => one.freshness === "unknown"))
1196
- return "unknown";
1197
- if (states.some((one) => one.freshness === "unknown"))
1198
- return "partial";
1199
- return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
1200
- }, "counterFreshness");
1201
-
1202
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
1203
- var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
1204
- var AUTHOR_MEASURES = [
1205
- "messages",
1206
- "words",
1207
- "reactions",
1208
- "replies",
1209
- "answers",
1210
- "answer-time",
1211
- "threads",
1212
- "active-days"
1213
- ];
1214
- var CONTEXT = /* @__PURE__ */ new Set([
1215
- "replies",
1216
- "replies-from-others",
1217
- "replies-from-others-per-message",
1218
- "thread-size",
1219
- "threads",
1220
- "answers",
1221
- "answer-time"
1222
- ]);
1223
- var needsRankingContext = /* @__PURE__ */ __name((options) => options.components.some((name) => CONTEXT.has(name)), "needsRankingContext");
1224
- var presets = {
1225
- helpful: { answers: 0.5, "replies-from-others": 0.25, reactions: 0.25 },
1226
- active: { "active-days": 0.6, messages: 0.4 },
1227
- engaging: { "reactions-per-message": 0.5, "replies-from-others-per-message": 0.5 }
1228
- };
1229
- function invalid(message) {
1230
- throw new CliError("validation_error", message, { reason: "ranking.invalid" });
1231
- }
1232
- __name(invalid, "invalid");
1233
- var rankingOptions = /* @__PURE__ */ __name((target, input) => {
1234
- const measures = target === "messages" ? MESSAGE_MEASURES : AUTHOR_MEASURES;
1235
- const { measure, score, weights: given2, minMessages } = input;
1236
- const messageKind = input.messageKind ?? "all";
1237
- if (!["all", "posts", "comments"].includes(messageKind))
1238
- invalid("message_kind takes all, posts or comments");
1239
- if (target === "messages" && minMessages !== void 0)
1240
- invalid("min_messages applies to stats contacts top");
1241
- if (minMessages !== void 0 && (!Number.isSafeInteger(minMessages) || minMessages < 1))
1242
- invalid("min_messages takes a positive integer");
1243
- if (measure !== void 0 && !measures.includes(measure))
1244
- invalid(`--measure takes ${measures.join(", ")}`);
1245
- if (measure !== void 0 && (score !== void 0 || given2 !== void 0))
1246
- invalid("--measure cannot be combined with --score or --weights");
1247
- if (score !== void 0 && !["helpful", "active", "engaging"].includes(score))
1248
- invalid("--score takes helpful, active or engaging");
1249
- if (target === "messages" && score !== void 0 && score !== "engaging")
1250
- invalid("helpful and active scores apply to authors only");
1251
- const scoring = score !== void 0 || given2 !== void 0;
1252
- const preset = score;
1253
- let weights = null;
1254
- if (scoring) {
1255
- let raw = given2 !== void 0 ? given2 : target === "messages" ? { reactions: 0.5, "replies-from-others": 0.5 } : presets[preset];
1256
- if (typeof raw === "string") {
1257
- try {
1258
- raw = JSON.parse(raw);
1259
- } catch {
1260
- invalid("--weights takes a JSON object of component weights");
1261
- }
1262
- }
1263
- if (!raw || typeof raw !== "object" || Array.isArray(raw))
1264
- invalid("--weights takes a JSON object of component weights");
1265
- const allowed = target === "messages" ? [...MESSAGE_MEASURES, "replies-from-others"] : [
1266
- ...AUTHOR_MEASURES.filter((name) => name !== "answer-time"),
1267
- "replies-from-others",
1268
- "reactions-per-message",
1269
- "replies-from-others-per-message"
1270
- ];
1271
- const entries = Object.entries(raw);
1272
- for (const [name, weight] of entries) {
1273
- if (!allowed.includes(name))
1274
- invalid(`unknown ${target} score component: ${name}`);
1275
- if (typeof weight !== "number" || !Number.isFinite(weight) || weight < 0)
1276
- invalid(`weight for ${name} must be a finite nonnegative number`);
1277
- }
1278
- if (!entries.some(([, weight]) => weight > 0))
1279
- invalid("--weights needs at least one positive weight");
1280
- weights = Object.fromEntries(entries);
1281
- }
1282
- const selected = measure ?? (target === "messages" ? "reactions" : "messages");
1283
- return {
1284
- target,
1285
- messageKind,
1286
- minMessages: minMessages ?? (target === "contacts" && score === "engaging" ? 5 : 1),
1287
- measure: scoring ? "score" : selected,
1288
- order: !scoring && selected === "answer-time" ? "ascending" : "descending",
1289
- weights,
1290
- preset: scoring ? preset ?? "custom" : null,
1291
- components: weights === null ? [selected] : Object.entries(weights).filter(([, weight]) => weight > 0).map(([name]) => name)
1292
- };
1293
- }, "rankingOptions");
1294
- var rankingScore = /* @__PURE__ */ __name((raw, maxima, weights) => {
1295
- const entries = Object.entries(weights).filter(([, weight]) => weight > 0);
1296
- const scale = Math.max(...entries.map(([, weight]) => weight));
1297
- const denominator = entries.reduce((sum2, [, weight]) => sum2 + weight / scale, 0);
1298
- if (!Number.isFinite(scale) || scale <= 0 || !Number.isFinite(denominator) || denominator <= 0)
1299
- return null;
1300
- const normalized = {};
1301
- const contributions = {};
1302
- let sum = 0;
1303
- for (const [name, weight] of entries) {
1304
- const value = raw[name];
1305
- const maximum = maxima[name];
1306
- if (value == null || !Number.isFinite(value) || value < 0 || maximum === void 0 || !Number.isFinite(maximum) || maximum < value)
1307
- return null;
1308
- const part = maximum === 0 ? 0 : value / maximum;
1309
- normalized[name] = part;
1310
- contributions[name] = 100 * part * (weight / scale) / denominator;
1311
- sum += contributions[name];
1312
- }
1313
- return { score: Math.min(100, sum), normalized, contributions };
1314
- }, "rankingScore");
1315
- var RANKING_TOKENIZER_VERSION = 1;
1316
- var withoutUrls = /* @__PURE__ */ __name((text2) => text2.replace(/\S+/gu, (token) => {
1317
- for (let offset = 0; ; ) {
1318
- const marker = token.indexOf("://", offset);
1319
- if (marker < 0)
1320
- break;
1321
- let start = marker;
1322
- while (start > 0 && /[a-z0-9+.-]/iu.test(token[start - 1]))
1323
- start--;
1324
- if (/^[a-z][a-z0-9+.-]*$/iu.test(token.slice(start, marker)) && (start === 0 || !/\w/u.test(token[start - 1])))
1325
- return token.slice(0, start);
1326
- offset = marker + 3;
1327
- }
1328
- const folded = token.toLowerCase();
1329
- for (let offset = 0; ; ) {
1330
- const start = folded.indexOf("www.", offset);
1331
- if (start < 0)
1332
- break;
1333
- if (start === 0 || !/\w/u.test(token[start - 1]))
1334
- return token.slice(0, start);
1335
- offset = start + 4;
1336
- }
1337
- return token;
1338
- }), "withoutUrls");
1339
- var rankingWords = /* @__PURE__ */ __name((text2) => withoutUrls(text2).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
1340
- var rankingQuestion = /* @__PURE__ */ __name((text2) => withoutUrls(text2).includes("?"), "rankingQuestion");
1341
-
1342
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/records.js
1343
- import { createHash } from "node:crypto";
1344
-
1345
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
1128
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
1346
1129
  var PHONE_PLANS = [
1347
1130
  {
1348
1131
  country: "us",
@@ -1722,7 +1505,7 @@ var PHONE_PLANS = [
1722
1505
  }
1723
1506
  ];
1724
1507
 
1725
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/phones.js
1508
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/phones.js
1726
1509
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
1727
1510
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
1728
1511
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -1786,6 +1569,7 @@ var e164Of = /* @__PURE__ */ __name((phone, region) => {
1786
1569
  const digits = phone.replace(/\(0\)/, "").replace(/\D/g, "");
1787
1570
  return nationalPhone(digits, [region], { anyType: true })?.value;
1788
1571
  }, "e164Of");
1572
+ var isMobilePhone = /* @__PURE__ */ __name((e164) => /^\+\d+$/.test(e164) && PHONE_COUNTRIES.some((country) => nationalPhone(e164.slice(1), [country], { anyType: false })?.value === e164), "isMobilePhone");
1789
1573
  var BARE_INTERNATIONAL_PROVIDERS = ["telegram", "max", "whatsapp"];
1790
1574
  var storedPhone = /* @__PURE__ */ __name((raw, provider) => {
1791
1575
  if (/^\s*(\+|00)/.test(raw))
@@ -1796,7 +1580,243 @@ var storedPhone = /* @__PURE__ */ __name((raw, provider) => {
1796
1580
  return found ? `+${found[1]}` : void 0;
1797
1581
  }, "storedPhone");
1798
1582
 
1799
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/records.js
1583
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/display-names.js
1584
+ var QUOTES = [
1585
+ ['"', '"'],
1586
+ ["'", "'"],
1587
+ ["\xAB", "\xBB"],
1588
+ ["\u201C", "\u201D"],
1589
+ ["\u201E", "\u201C"],
1590
+ ["\u2018", "\u2019"],
1591
+ ["`", "`"]
1592
+ ];
1593
+ var READABLE = /[\p{L}\p{N}]/u;
1594
+ var PLACEHOLDERS = /* @__PURE__ */ new Set(["null", "undefined", "none", "\u0431\u0435\u0437 \u0438\u043C\u0435\u043D\u0438", "deleted account", "\u0443\u0434\u0430\u043B\u0451\u043D\u043D\u044B\u0439 \u0430\u043A\u043A\u0430\u0443\u043D\u0442"]);
1595
+ var unquoted = /* @__PURE__ */ __name((text2) => {
1596
+ let at = text2.replace(/\s+/gu, " ").trim();
1597
+ for (; ; ) {
1598
+ const pair = QUOTES.find(([open, close]) => at.length >= 2 && at.startsWith(open) && at.endsWith(close));
1599
+ if (pair === void 0)
1600
+ return at;
1601
+ at = at.slice(pair[0].length, at.length - pair[1].length).trim();
1602
+ }
1603
+ }, "unquoted");
1604
+ var given = /* @__PURE__ */ __name((value) => {
1605
+ const text2 = typeof value === "string" ? value.trim() : "";
1606
+ return text2 === "" ? void 0 : text2;
1607
+ }, "given");
1608
+ var displayName = /* @__PURE__ */ __name((name, fallbacks = {}) => {
1609
+ const unwrapped = typeof name === "string" ? unquoted(name) : "";
1610
+ const cleaned = PLACEHOLDERS.has(unwrapped.toLowerCase()) ? "" : unwrapped;
1611
+ if (READABLE.test(cleaned))
1612
+ return cleaned;
1613
+ const borrowed = fallbacks.name === void 0 || fallbacks.name === null ? null : displayName(fallbacks.name);
1614
+ if (borrowed !== null && READABLE.test(borrowed) && !borrowed.startsWith("@"))
1615
+ return borrowed;
1616
+ const username = given(fallbacks.username);
1617
+ return (username === void 0 ? void 0 : username.startsWith("@") ? username : `@${username}`) ?? given(fallbacks.phone) ?? given(fallbacks.email) ?? (cleaned === "" ? null : cleaned);
1618
+ }, "displayName");
1619
+ var present = /* @__PURE__ */ __name((value) => typeof value === "string" && value !== "" ? value : null, "present");
1620
+ var takeFallbacks = /* @__PURE__ */ __name((into, identity) => {
1621
+ const named = displayName(identity.name);
1622
+ if (into.name === null && isReadable(named) && !named?.startsWith("@"))
1623
+ into.name = named;
1624
+ into.username ??= present(identity.username);
1625
+ into.phone ??= present(identity.phone) ?? (identity.provider === "phone" ? identity.id : null);
1626
+ into.email ??= present(identity.email) ?? (identity.provider === "email" ? identity.id : null);
1627
+ return into;
1628
+ }, "takeFallbacks");
1629
+ var noFallbacks = /* @__PURE__ */ __name(() => ({ name: null, username: null, phone: null, email: null }), "noFallbacks");
1630
+ var nameKey = /* @__PURE__ */ __name((name) => {
1631
+ if (typeof name !== "string")
1632
+ return null;
1633
+ const unwrapped = unquoted(name);
1634
+ if (PLACEHOLDERS.has(unwrapped.toLowerCase()))
1635
+ return null;
1636
+ const words = foldName(unwrapped).split(/[^\p{L}\p{N}]+/u).filter((word) => word !== "");
1637
+ return words.length === 0 ? null : words.sort().join(" ");
1638
+ }, "nameKey");
1639
+ var isReadable = /* @__PURE__ */ __name((shown) => shown !== null && READABLE.test(shown), "isReadable");
1640
+
1641
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/counters.js
1642
+ var COUNTER_FIELDS = ["views", "reactions", "comments"];
1643
+ var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
1644
+ var counterValue = /* @__PURE__ */ __name((message, field) => {
1645
+ const value = field === "reactions" ? message.reactions?.total : message.providerMetadata?.[field];
1646
+ return validCounter(value) ? value : null;
1647
+ }, "counterValue");
1648
+ var counterObservationTime = /* @__PURE__ */ __name((observation, now) => {
1649
+ const at = Date.parse(observation.observedAt);
1650
+ if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now || !["remote_fetch", "remote_update"].includes(observation.source))
1651
+ throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
1652
+ if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
1653
+ throw new CliError("validation_error", "reaction observation payload and total disagree");
1654
+ return at;
1655
+ }, "counterObservationTime");
1656
+ var observedCounters = /* @__PURE__ */ __name((message, observedAt, fields, source = "remote_fetch") => {
1657
+ const observations = {};
1658
+ for (const field of fields) {
1659
+ const value = counterValue(message, field);
1660
+ if (value !== null)
1661
+ observations[field] = {
1662
+ value,
1663
+ observedAt,
1664
+ source,
1665
+ ...field === "reactions" && message.reactions ? { reactions: message.reactions } : {}
1666
+ };
1667
+ }
1668
+ return { ...message, counterObservations: observations };
1669
+ }, "observedCounters");
1670
+ var counterFreshness = /* @__PURE__ */ __name((states) => {
1671
+ if (!states.length || states.every((one) => one.freshness === "unknown"))
1672
+ return "unknown";
1673
+ if (states.some((one) => one.freshness === "unknown"))
1674
+ return "partial";
1675
+ return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
1676
+ }, "counterFreshness");
1677
+
1678
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
1679
+ var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
1680
+ var AUTHOR_MEASURES = [
1681
+ "messages",
1682
+ "words",
1683
+ "reactions",
1684
+ "replies",
1685
+ "answers",
1686
+ "answer-time",
1687
+ "threads",
1688
+ "active-days"
1689
+ ];
1690
+ var CONTEXT = /* @__PURE__ */ new Set([
1691
+ "replies",
1692
+ "replies-from-others",
1693
+ "replies-from-others-per-message",
1694
+ "thread-size",
1695
+ "threads",
1696
+ "answers",
1697
+ "answer-time"
1698
+ ]);
1699
+ var needsRankingContext = /* @__PURE__ */ __name((options) => options.components.some((name) => CONTEXT.has(name)), "needsRankingContext");
1700
+ var presets = {
1701
+ helpful: { answers: 0.5, "replies-from-others": 0.25, reactions: 0.25 },
1702
+ active: { "active-days": 0.6, messages: 0.4 },
1703
+ engaging: { "reactions-per-message": 0.5, "replies-from-others-per-message": 0.5 }
1704
+ };
1705
+ function invalid(message) {
1706
+ throw new CliError("validation_error", message, { reason: "ranking.invalid" });
1707
+ }
1708
+ __name(invalid, "invalid");
1709
+ var rankingOptions = /* @__PURE__ */ __name((target, input) => {
1710
+ const measures = target === "messages" ? MESSAGE_MEASURES : AUTHOR_MEASURES;
1711
+ const { measure, score, weights: given2, minMessages } = input;
1712
+ const messageKind = input.messageKind ?? "all";
1713
+ if (!["all", "posts", "comments"].includes(messageKind))
1714
+ invalid("message_kind takes all, posts or comments");
1715
+ if (target === "messages" && minMessages !== void 0)
1716
+ invalid("min_messages applies to stats contacts top");
1717
+ if (minMessages !== void 0 && (!Number.isSafeInteger(minMessages) || minMessages < 1))
1718
+ invalid("min_messages takes a positive integer");
1719
+ if (measure !== void 0 && !measures.includes(measure))
1720
+ invalid(`--measure takes ${measures.join(", ")}`);
1721
+ if (measure !== void 0 && (score !== void 0 || given2 !== void 0))
1722
+ invalid("--measure cannot be combined with --score or --weights");
1723
+ if (score !== void 0 && !["helpful", "active", "engaging"].includes(score))
1724
+ invalid("--score takes helpful, active or engaging");
1725
+ if (target === "messages" && score !== void 0 && score !== "engaging")
1726
+ invalid("helpful and active scores apply to authors only");
1727
+ const scoring = score !== void 0 || given2 !== void 0;
1728
+ const preset = score;
1729
+ let weights = null;
1730
+ if (scoring) {
1731
+ let raw = given2 !== void 0 ? given2 : target === "messages" ? { reactions: 0.5, "replies-from-others": 0.5 } : presets[preset];
1732
+ if (typeof raw === "string") {
1733
+ try {
1734
+ raw = JSON.parse(raw);
1735
+ } catch {
1736
+ invalid("--weights takes a JSON object of component weights");
1737
+ }
1738
+ }
1739
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
1740
+ invalid("--weights takes a JSON object of component weights");
1741
+ const allowed = target === "messages" ? [...MESSAGE_MEASURES, "replies-from-others"] : [
1742
+ ...AUTHOR_MEASURES.filter((name) => name !== "answer-time"),
1743
+ "replies-from-others",
1744
+ "reactions-per-message",
1745
+ "replies-from-others-per-message"
1746
+ ];
1747
+ const entries = Object.entries(raw);
1748
+ for (const [name, weight] of entries) {
1749
+ if (!allowed.includes(name))
1750
+ invalid(`unknown ${target} score component: ${name}`);
1751
+ if (typeof weight !== "number" || !Number.isFinite(weight) || weight < 0)
1752
+ invalid(`weight for ${name} must be a finite nonnegative number`);
1753
+ }
1754
+ if (!entries.some(([, weight]) => weight > 0))
1755
+ invalid("--weights needs at least one positive weight");
1756
+ weights = Object.fromEntries(entries);
1757
+ }
1758
+ const selected = measure ?? (target === "messages" ? "reactions" : "messages");
1759
+ return {
1760
+ target,
1761
+ messageKind,
1762
+ minMessages: minMessages ?? (target === "contacts" && score === "engaging" ? 5 : 1),
1763
+ measure: scoring ? "score" : selected,
1764
+ order: !scoring && selected === "answer-time" ? "ascending" : "descending",
1765
+ weights,
1766
+ preset: scoring ? preset ?? "custom" : null,
1767
+ components: weights === null ? [selected] : Object.entries(weights).filter(([, weight]) => weight > 0).map(([name]) => name)
1768
+ };
1769
+ }, "rankingOptions");
1770
+ var rankingScore = /* @__PURE__ */ __name((raw, maxima, weights) => {
1771
+ const entries = Object.entries(weights).filter(([, weight]) => weight > 0);
1772
+ const scale = Math.max(...entries.map(([, weight]) => weight));
1773
+ const denominator = entries.reduce((sum2, [, weight]) => sum2 + weight / scale, 0);
1774
+ if (!Number.isFinite(scale) || scale <= 0 || !Number.isFinite(denominator) || denominator <= 0)
1775
+ return null;
1776
+ const normalized = {};
1777
+ const contributions = {};
1778
+ let sum = 0;
1779
+ for (const [name, weight] of entries) {
1780
+ const value = raw[name];
1781
+ const maximum = maxima[name];
1782
+ if (value == null || !Number.isFinite(value) || value < 0 || maximum === void 0 || !Number.isFinite(maximum) || maximum < value)
1783
+ return null;
1784
+ const part = maximum === 0 ? 0 : value / maximum;
1785
+ normalized[name] = part;
1786
+ contributions[name] = 100 * part * (weight / scale) / denominator;
1787
+ sum += contributions[name];
1788
+ }
1789
+ return { score: Math.min(100, sum), normalized, contributions };
1790
+ }, "rankingScore");
1791
+ var RANKING_TOKENIZER_VERSION = 1;
1792
+ var withoutUrls = /* @__PURE__ */ __name((text2) => text2.replace(/\S+/gu, (token) => {
1793
+ for (let offset = 0; ; ) {
1794
+ const marker = token.indexOf("://", offset);
1795
+ if (marker < 0)
1796
+ break;
1797
+ let start = marker;
1798
+ while (start > 0 && /[a-z0-9+.-]/iu.test(token[start - 1]))
1799
+ start--;
1800
+ if (/^[a-z][a-z0-9+.-]*$/iu.test(token.slice(start, marker)) && (start === 0 || !/\w/u.test(token[start - 1])))
1801
+ return token.slice(0, start);
1802
+ offset = marker + 3;
1803
+ }
1804
+ const folded = token.toLowerCase();
1805
+ for (let offset = 0; ; ) {
1806
+ const start = folded.indexOf("www.", offset);
1807
+ if (start < 0)
1808
+ break;
1809
+ if (start === 0 || !/\w/u.test(token[start - 1]))
1810
+ return token.slice(0, start);
1811
+ offset = start + 4;
1812
+ }
1813
+ return token;
1814
+ }), "withoutUrls");
1815
+ var rankingWords = /* @__PURE__ */ __name((text2) => withoutUrls(text2).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
1816
+ var rankingQuestion = /* @__PURE__ */ __name((text2) => withoutUrls(text2).includes("?"), "rankingQuestion");
1817
+
1818
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/records.js
1819
+ import { createHash } from "node:crypto";
1800
1820
  var RECORDS_SCHEMA_VERSION = 1;
1801
1821
  var RECORD_OPERATIONS = ["upsert", "delete"];
1802
1822
  var LINE_OPTIONS = ["text", "products"];
@@ -1967,7 +1987,7 @@ var fieldReferences = /* @__PURE__ */ __name((record, options = {}) => {
1967
1987
  return found;
1968
1988
  }, "fieldReferences");
1969
1989
 
1970
- // node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/relation-role-labels.js
1990
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/relation-role-labels.js
1971
1991
  var label = /* @__PURE__ */ __name((en, ru, es) => ({ en, ru, es }), "label");
1972
1992
  var ROLE_LABELS = {
1973
1993
  organization: {
@@ -2056,11 +2076,13 @@ export {
2056
2076
  isRoleAddress,
2057
2077
  isPersonLikeRoleAddress,
2058
2078
  isNoReplyAddress,
2079
+ PHONE_COUNTRIES,
2059
2080
  DEFAULT_PHONE_COUNTRIES,
2060
2081
  parsePhoneCountries,
2061
2082
  nationalPhone,
2062
2083
  typedPhone,
2063
2084
  e164Of,
2085
+ isMobilePhone,
2064
2086
  BARE_INTERNATIONAL_PROVIDERS,
2065
2087
  storedPhone,
2066
2088
  displayName,