@wirecat/amo-cli 0.4.0 → 0.5.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 (159) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/contracts/wirecat.json +2 -1
  3. package/dist/amo/allow-list.d.ts +1 -1
  4. package/dist/amo/allow-list.d.ts.map +1 -1
  5. package/dist/amo/operation.d.ts +1 -1
  6. package/dist/amo/operation.d.ts.map +1 -1
  7. package/dist/bin/amo.js +2 -2
  8. package/dist/bundle/agent-EFMUK732.js +41 -0
  9. package/dist/bundle/{all-profiles-PRNXEZRH.js → all-profiles-PIWUQWBA.js} +11 -11
  10. package/dist/bundle/amo.js +28 -28
  11. package/dist/bundle/{anthropic-FDI24DU2.js → anthropic-47CMXBPQ.js} +5 -5
  12. package/dist/bundle/{app-server-WAKJVDLN.js → app-server-QRBQODF2.js} +70 -69
  13. package/dist/bundle/areas-QVHVU57Z.js +63 -0
  14. package/dist/bundle/{bun-YPXUXMBI.js → bun-OPDGMZZQ.js} +2 -2
  15. package/dist/bundle/{bun-sqlite-UBQ5M47X.js → bun-sqlite-7I4X7CZW.js} +6 -6
  16. package/dist/bundle/{chunk-SFZVMKB6.js → chunk-2JHVQMVC.js} +1 -1
  17. package/dist/bundle/{chunk-SNBYFQHT.js → chunk-2XBDILVW.js} +1 -1
  18. package/dist/bundle/{chunk-BCIZAUDV.js → chunk-3DEQUYEG.js} +9 -9
  19. package/dist/bundle/{chunk-2AIG2SSJ.js → chunk-3GX6KM2E.js} +1661 -164
  20. package/dist/bundle/{chunk-5II6TAJE.js → chunk-3HC5F3P7.js} +1 -1
  21. package/dist/bundle/{chunk-DWD3KDJA.js → chunk-3PYE55JY.js} +1 -1
  22. package/dist/bundle/{chunk-SMM7GS4Q.js → chunk-3YM4B2GT.js} +1 -1
  23. package/dist/bundle/{chunk-XEYT2EQT.js → chunk-43OW5NTG.js} +6 -6
  24. package/dist/bundle/{chunk-HDZNSOV5.js → chunk-43PMSR33.js} +13 -9
  25. package/dist/bundle/{chunk-EBNCUQLV.js → chunk-4N7PP76S.js} +1 -1
  26. package/dist/bundle/{chunk-WAFB3IWJ.js → chunk-4VN7RI4I.js} +5 -5
  27. package/dist/bundle/{chunk-CEBX63XY.js → chunk-57HFPNMF.js} +8 -8
  28. package/dist/bundle/{chunk-Z2B3VNRI.js → chunk-5UTB3ADZ.js} +11 -11
  29. package/dist/bundle/{chunk-PLU2IQXC.js → chunk-633NQY2R.js} +3 -3
  30. package/dist/bundle/{chunk-NKYWQTS2.js → chunk-63N46DJU.js} +216 -233
  31. package/dist/bundle/{chunk-5HZMXHRH.js → chunk-6D4VWSJD.js} +6 -6
  32. package/dist/bundle/{chunk-V2QWX6B3.js → chunk-6JTHXWPE.js} +3 -3
  33. package/dist/bundle/{chunk-YREKMP24.js → chunk-6QGUK3H7.js} +4 -4
  34. package/dist/bundle/{chunk-4PQECIU2.js → chunk-6WS6GJ4V.js} +2 -2
  35. package/dist/bundle/{chunk-23AQD7JU.js → chunk-7IR2G5XY.js} +16 -16
  36. package/dist/bundle/{chunk-OYMHPQF7.js → chunk-7IWIFVXH.js} +4 -4
  37. package/dist/bundle/{chunk-YHVHDRED.js → chunk-ABX7BBS4.js} +6 -6
  38. package/dist/bundle/{chunk-3K6T2G52.js → chunk-ADTI5RUO.js} +6 -6
  39. package/dist/bundle/{chunk-YFRTEJ6V.js → chunk-AKRIUNYP.js} +7 -7
  40. package/dist/bundle/{chunk-KBAOJISR.js → chunk-BIKOE2IW.js} +7 -7
  41. package/dist/bundle/{chunk-TIR3AB35.js → chunk-BVVMIAQ6.js} +759 -694
  42. package/dist/bundle/{chunk-M54YKD3I.js → chunk-CGW5R4UD.js} +7 -7
  43. package/dist/bundle/{chunk-CYHIM5SL.js → chunk-D4NE7EON.js} +3 -3
  44. package/dist/bundle/{chunk-TCSVW7BA.js → chunk-DNCLQPOM.js} +1 -1
  45. package/dist/bundle/{chunk-WASBOYI2.js → chunk-DPV53EZC.js} +4 -4
  46. package/dist/bundle/{chunk-VEFAYLKX.js → chunk-DQ6S5TFZ.js} +185 -114
  47. package/dist/bundle/{chunk-GMHRPX5M.js → chunk-DSJ6EAOA.js} +61 -61
  48. package/dist/bundle/{chunk-GQKEMBM6.js → chunk-DVZ75WZJ.js} +121 -36
  49. package/dist/bundle/{chunk-SHOSFYI7.js → chunk-EHK73OSW.js} +38 -24
  50. package/dist/bundle/{chunk-KQZTX4LM.js → chunk-FNV5HLHX.js} +17 -17
  51. package/dist/bundle/{chunk-RQPB2BSH.js → chunk-FV4GQNIK.js} +2 -2
  52. package/dist/bundle/{chunk-E3EWS6DF.js → chunk-G2TU5RYY.js} +6 -6
  53. package/dist/bundle/{chunk-WEWJA42Q.js → chunk-GDK7ETSB.js} +12 -12
  54. package/dist/bundle/{chunk-KORZEYZN.js → chunk-GGMAIIVE.js} +1 -1
  55. package/dist/bundle/{chunk-U46RNOEQ.js → chunk-GLYWZQY4.js} +3 -3
  56. package/dist/bundle/{chunk-KRD375P7.js → chunk-H4AFNENN.js} +34 -29
  57. package/dist/bundle/{chunk-SZX7EPPY.js → chunk-HOF7GQWW.js} +4 -4
  58. package/dist/bundle/{chunk-DWA5TZMP.js → chunk-HSPEU6S7.js} +8 -8
  59. package/dist/bundle/{chunk-VG2ERHFJ.js → chunk-IA7LLLEI.js} +3 -3
  60. package/dist/bundle/{chunk-O3WE5IGP.js → chunk-IB55P46L.js} +6 -6
  61. package/dist/bundle/{chunk-2UJ7ZZZC.js → chunk-IG2TJQJ7.js} +3 -3
  62. package/dist/bundle/{chunk-ZJC2XJQC.js → chunk-JG6LCSEX.js} +13 -13
  63. package/dist/bundle/{chunk-ELAKOEIO.js → chunk-JLXXUEAM.js} +2 -2
  64. package/dist/bundle/{chunk-UCM7C773.js → chunk-JXT6GY4V.js} +158 -61
  65. package/dist/bundle/{chunk-ABMPZL2P.js → chunk-K7YY6SXR.js} +19 -15
  66. package/dist/bundle/{chunk-TEGQVVCZ.js → chunk-KEKXERBE.js} +14581 -11880
  67. package/dist/bundle/{chunk-GJBOZAUD.js → chunk-KZ2FIDI3.js} +3 -3
  68. package/dist/bundle/{chunk-IBEHYGG6.js → chunk-KZN2BG3P.js} +8 -8
  69. package/dist/bundle/{chunk-VG26HDKH.js → chunk-LKH3UKLO.js} +4 -4
  70. package/dist/bundle/{chunk-PIOR6PIO.js → chunk-LZPKBN3C.js} +2 -2
  71. package/dist/bundle/{chunk-5SJEJYQZ.js → chunk-M6VZXAJC.js} +3 -3
  72. package/dist/bundle/{chunk-NFWD4QX3.js → chunk-MDEPJZYJ.js} +2 -2
  73. package/dist/bundle/{chunk-QGFURWEP.js → chunk-NB7EOAUZ.js} +8 -1
  74. package/dist/bundle/{chunk-GBQ76X6T.js → chunk-NISH4UXM.js} +2 -2
  75. package/dist/bundle/{chunk-MW7HUD6R.js → chunk-NSKMNIY6.js} +9 -9
  76. package/dist/bundle/chunk-PPSAWFJD.js +1293 -0
  77. package/dist/bundle/{chunk-UEN5NWNW.js → chunk-Q7ICVP25.js} +1 -1
  78. package/dist/bundle/{chunk-7OVTUADG.js → chunk-QFOP3KUP.js} +8 -8
  79. package/dist/bundle/{chunk-LAR2DLTI.js → chunk-R53XXHEI.js} +4 -4
  80. package/dist/bundle/{chunk-A4W7J6VN.js → chunk-RIMPFMZE.js} +28 -189
  81. package/dist/bundle/{chunk-G3LAYJJJ.js → chunk-RN6RT5CB.js} +4 -4
  82. package/dist/bundle/{chunk-FQRP6JWX.js → chunk-RRTMPSQR.js} +2 -2
  83. package/dist/bundle/{chunk-AN6IJYH3.js → chunk-S4ZHQMNM.js} +5 -5
  84. package/dist/bundle/{chunk-AP3CWDRK.js → chunk-S6JG4YUH.js} +2 -2
  85. package/dist/bundle/{chunk-PL7TNKAY.js → chunk-TAVI73RW.js} +2 -2
  86. package/dist/bundle/{chunk-ZKRWNL4T.js → chunk-TLG6ECZ2.js} +2 -2
  87. package/dist/bundle/{chunk-745FMNI5.js → chunk-TXDR6YSF.js} +1 -1
  88. package/dist/bundle/{chunk-3WG4MTQI.js → chunk-TY7NDMFY.js} +1 -1
  89. package/dist/bundle/{chunk-WR2FPZTE.js → chunk-U5RJJ2EC.js} +8 -8
  90. package/dist/bundle/{chunk-6QMSKJB4.js → chunk-UDSL3MUU.js} +8 -8
  91. package/dist/bundle/{chunk-FEUNZG7U.js → chunk-V2CNGXWX.js} +37 -37
  92. package/dist/bundle/{chunk-V5SETIQK.js → chunk-VB7FZOYX.js} +1 -1
  93. package/dist/bundle/{chunk-HZZ56JO7.js → chunk-VZ5PPYDG.js} +1 -1
  94. package/dist/bundle/{chunk-LZ4IWN43.js → chunk-W5JRXIG6.js} +822 -1604
  95. package/dist/bundle/{chunk-SCMB4LI6.js → chunk-WIHN3ELW.js} +19 -19
  96. package/dist/bundle/chunk-WOPVBRPV.js +29 -0
  97. package/dist/bundle/{chunk-6PILR4AX.js → chunk-WUFX4TKA.js} +2 -2
  98. package/dist/bundle/{chunk-NXNUCGGO.js → chunk-WXJYMMEL.js} +6 -6
  99. package/dist/bundle/{chunk-IPNIF5JE.js → chunk-XCCU2E3Z.js} +4 -4
  100. package/dist/bundle/{chunk-EAX5RO7S.js → chunk-XEQQJBBO.js} +1 -1
  101. package/dist/bundle/{chunk-3PCVQCCV.js → chunk-XUT7DSM5.js} +2 -2
  102. package/dist/bundle/{chunk-ASU63X5C.js → chunk-YWDFYQOU.js} +2 -2
  103. package/dist/bundle/{chunk-S6DTLAOB.js → chunk-ZLUIRFJX.js} +37 -18
  104. package/dist/bundle/{cli-QDPKC2HJ.js → cli-3NXOSENF.js} +104 -105
  105. package/dist/bundle/command-contract-LNSAV5LA.js +39 -0
  106. package/dist/bundle/{command-server-entry-TX7WNN7G.js → command-server-entry-4ZQPNUL4.js} +28 -28
  107. package/dist/bundle/{decode-BLPC7OYE.js → decode-K7U7X5EL.js} +5 -5
  108. package/dist/bundle/{dispatch-5JUT55CS.js → dispatch-56FECRCU.js} +8 -8
  109. package/dist/bundle/{echarts-54D3FOCL.js → echarts-O3TNDAXJ.js} +2 -2
  110. package/dist/bundle/{embed-O7KMDYM7.js → embed-SWLVG73O.js} +6 -6
  111. package/dist/bundle/{embedder-4PE67CLX.js → embedder-EJN75BPV.js} +9 -9
  112. package/dist/bundle/{failure-NNQYTB3Z.js → failure-WDSX6H3B.js} +2 -2
  113. package/dist/bundle/{first-run-EAU5SHBI.js → first-run-WPGUUC4Z.js} +12 -12
  114. package/dist/bundle/first-screen-JMNEUQ46.js +40 -0
  115. package/dist/bundle/{instructions-ONXP5DZQ.js → instructions-AMH5RWVJ.js} +1 -1
  116. package/dist/bundle/{mcp-ZNULRPZ4.js → mcp-5HFPWC3W.js} +2 -2
  117. package/dist/bundle/meeting-combined-5TKG2RYD.js +24 -0
  118. package/dist/bundle/{meeting-model-FWIZRKVN.js → meeting-model-YXXNETKC.js} +11 -11
  119. package/dist/bundle/{meeting-semantic-M4YVJ57W.js → meeting-semantic-U7EUB3ET.js} +6 -6
  120. package/dist/bundle/{node-UTQCYQF5.js → node-EGMCBAO7.js} +2 -2
  121. package/dist/bundle/{node-sqlite-APJG6MGL.js → node-sqlite-YVOGMDSP.js} +7 -7
  122. package/dist/bundle/{oauth-TY7RMIBL.js → oauth-2SNRBIJM.js} +7 -7
  123. package/dist/bundle/{open-WDVEQL75.js → open-ABCPY5IH.js} +5 -5
  124. package/dist/bundle/{openai-H5UJHSEZ.js → openai-4D6PXJR7.js} +15 -15
  125. package/dist/bundle/{process-MGMXXPMY.js → process-SGHEN6MQ.js} +1 -1
  126. package/dist/bundle/{program-IF36C6VR.js → program-CBDQBZZ3.js} +319 -133
  127. package/dist/bundle/{prompt-4RLIWLMF.js → prompt-2QUK5QST.js} +5 -5
  128. package/dist/bundle/{recognize-UIRTMWM4.js → recognize-QMQSJRIH.js} +4 -4
  129. package/dist/bundle/{remote-L3MNWZQK.js → remote-U7TC2BLZ.js} +9 -9
  130. package/dist/bundle/{rerank-F4KZQTY6.js → rerank-5UPVXGVV.js} +7 -7
  131. package/dist/bundle/{serve-37AUYTWS.js → serve-VX6GUM6J.js} +9 -9
  132. package/dist/bundle/{server-UBG676ZJ.js → server-FOPC6DJ3.js} +62 -61
  133. package/dist/bundle/server-OIVNOMVK.js +87 -0
  134. package/dist/bundle/source-HWS5SJIV.js +46 -0
  135. package/dist/bundle/{sqlite-runtime-CI3RW7VA.js → sqlite-runtime-77NKDEXN.js} +6 -6
  136. package/dist/bundle/{state-JOHLSLUO.js → state-X2HU6GB2.js} +6 -6
  137. package/dist/bundle/{store-2MBG4IUS.js → store-2U4U6KL4.js} +22 -22
  138. package/dist/bundle/{store-OSOUXBYL.js → store-3CHPHFP7.js} +26 -24
  139. package/dist/bundle/store-Z3747L5F.js +34 -0
  140. package/dist/bundle/store-maintenance-command-UOSZJTVP.js +74 -0
  141. package/dist/bundle/surface-MUT72QON.js +73 -0
  142. package/dist/bundle/writer-RBKQ64ZM.js +48 -0
  143. package/dist/commands/crm-shared.js +1 -1
  144. package/dist/commands/crm-shared.js.map +1 -1
  145. package/dist/version.d.ts +1 -1
  146. package/dist/version.js +1 -1
  147. package/package.json +4 -4
  148. package/skills/amo-cli/SKILL.md +6 -0
  149. package/dist/bundle/agent-43BMVBX2.js +0 -40
  150. package/dist/bundle/chunk-M33XHJTM.js +0 -1266
  151. package/dist/bundle/command-contract-KWNCP3MQ.js +0 -39
  152. package/dist/bundle/first-screen-APSNGZYZ.js +0 -39
  153. package/dist/bundle/meeting-combined-W2XIYXFU.js +0 -24
  154. package/dist/bundle/server-CRF4QSZR.js +0 -86
  155. package/dist/bundle/source-Z7GH7T4B.js +0 -44
  156. package/dist/bundle/store-SNW6U32Y.js +0 -34
  157. package/dist/bundle/store-maintenance-command-W7V54SLT.js +0 -73
  158. package/dist/bundle/surface-ESJS2FUI.js +0 -72
  159. package/dist/bundle/writer-BJDQMKUV.js +0 -46
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  PROVIDER
5
- } from "./chunk-6PILR4AX.js";
5
+ } from "./chunk-WUFX4TKA.js";
6
6
  import {
7
7
  ProfileTokenStore,
8
8
  REPORT_FORMAT,
@@ -22,8 +22,6 @@ import {
22
22
  oauthAccount,
23
23
  openBrowser,
24
24
  ownerLanguageOf,
25
- providerEvent,
26
- providerRequest,
27
25
  run,
28
26
  runsCommand,
29
27
  scheduleCommandFor,
@@ -34,50 +32,48 @@ import {
34
32
  tokenKeeper,
35
33
  upgradeCommand,
36
34
  writeCsv
37
- } from "./chunk-LZ4IWN43.js";
38
- import "./chunk-5II6TAJE.js";
35
+ } from "./chunk-W5JRXIG6.js";
36
+ import "./chunk-3HC5F3P7.js";
39
37
  import {
40
38
  OPERATIONS,
41
39
  amoCrmSource,
42
40
  matchOperation,
43
41
  pathOf,
44
42
  withEveryId
45
- } from "./chunk-5SJEJYQZ.js";
43
+ } from "./chunk-M6VZXAJC.js";
46
44
  import {
47
45
  AMO_WRITES
48
- } from "./chunk-GJBOZAUD.js";
46
+ } from "./chunk-KZ2FIDI3.js";
49
47
  import {
50
48
  ENTITIES,
51
49
  ROUTES
52
- } from "./chunk-DWD3KDJA.js";
53
- import "./chunk-HZZ56JO7.js";
50
+ } from "./chunk-3PYE55JY.js";
51
+ import "./chunk-VZ5PPYDG.js";
54
52
  import {
55
53
  SOURCE_SEARCHED,
56
54
  allAnswer,
57
55
  historySkipsOf,
58
56
  offsetOf,
59
57
  refuseOffline
60
- } from "./chunk-KRD375P7.js";
61
- import "./chunk-YHVHDRED.js";
62
- import "./chunk-CEBX63XY.js";
63
- import "./chunk-UEN5NWNW.js";
58
+ } from "./chunk-H4AFNENN.js";
59
+ import "./chunk-ABX7BBS4.js";
60
+ import "./chunk-57HFPNMF.js";
61
+ import "./chunk-Q7ICVP25.js";
64
62
  import {
65
- addStoreMaintenanceCommands
66
- } from "./chunk-VEFAYLKX.js";
67
- import {
68
- commandPathKey,
69
- commandPermissions,
70
- terminalAsker
71
- } from "./chunk-A4W7J6VN.js";
72
- import "./chunk-WR2FPZTE.js";
73
- import "./chunk-HDZNSOV5.js";
74
- import "./chunk-WEWJA42Q.js";
75
- import "./chunk-NFWD4QX3.js";
76
- import "./chunk-OYMHPQF7.js";
77
- import "./chunk-XEYT2EQT.js";
78
- import "./chunk-DWA5TZMP.js";
63
+ addStoreMaintenanceCommands,
64
+ notLocalPaths
65
+ } from "./chunk-DQ6S5TFZ.js";
66
+ import "./chunk-RIMPFMZE.js";
67
+ import "./chunk-U5RJJ2EC.js";
68
+ import "./chunk-43PMSR33.js";
69
+ import "./chunk-GDK7ETSB.js";
70
+ import "./chunk-MDEPJZYJ.js";
71
+ import "./chunk-7IWIFVXH.js";
72
+ import "./chunk-43OW5NTG.js";
73
+ import "./chunk-HSPEU6S7.js";
79
74
  import {
80
75
  crmAccounts,
76
+ embedCrmActivities,
81
77
  extractText,
82
78
  importEngine,
83
79
  meaningLane,
@@ -85,10 +81,10 @@ import {
85
81
  readableAccounts,
86
82
  searchAll,
87
83
  taskAccount
88
- } from "./chunk-TIR3AB35.js";
84
+ } from "./chunk-BVVMIAQ6.js";
89
85
  import {
90
86
  safeName
91
- } from "./chunk-ZJC2XJQC.js";
87
+ } from "./chunk-JG6LCSEX.js";
92
88
  import {
93
89
  CRM_ASSIGN_OTHERS_KEY,
94
90
  CRM_SHARED_FOLDERS,
@@ -100,7 +96,11 @@ import {
100
96
  SYNC_FAILED,
101
97
  apiJson,
102
98
  closeCrmItem,
99
+ commandPathKey,
100
+ commandPermissions,
101
+ completeCrmActivity,
103
102
  conditionsOf,
103
+ createCrmActivity,
104
104
  createCrmItem,
105
105
  createCrmRecord,
106
106
  crmAlsoChecks,
@@ -122,11 +122,14 @@ import {
122
122
  parseCrmFileId,
123
123
  pipelineOf,
124
124
  providerCall,
125
+ providerEvent,
126
+ providerRequest,
125
127
  refuseForeignClientReads,
126
128
  removeCrmItem,
127
129
  selectedCodes,
128
130
  shortened,
129
131
  syncRecorded,
132
+ terminalAsker,
130
133
  updateCrmItem,
131
134
  updateCrmRecord,
132
135
  values_exports,
@@ -135,15 +138,15 @@ import {
135
138
  withCustomFields,
136
139
  withReadableDeal,
137
140
  withoutFileLinks
138
- } from "./chunk-2AIG2SSJ.js";
139
- import "./chunk-QGFURWEP.js";
141
+ } from "./chunk-3GX6KM2E.js";
142
+ import "./chunk-NB7EOAUZ.js";
140
143
  import {
141
144
  latestVersion,
142
145
  runUpdate,
143
146
  updateNotice
144
- } from "./chunk-SZX7EPPY.js";
145
- import "./chunk-3WG4MTQI.js";
146
- import "./chunk-4PQECIU2.js";
147
+ } from "./chunk-HOF7GQWW.js";
148
+ import "./chunk-TY7NDMFY.js";
149
+ import "./chunk-6WS6GJ4V.js";
147
150
  import {
148
151
  commandPath,
149
152
  dateWindow,
@@ -158,14 +161,15 @@ import {
158
161
  unfilteredQuery,
159
162
  withQuery,
160
163
  withWords
161
- } from "./chunk-ABMPZL2P.js";
162
- import "./chunk-LAR2DLTI.js";
163
- import "./chunk-5HZMXHRH.js";
164
- import "./chunk-Z2B3VNRI.js";
165
- import "./chunk-CYHIM5SL.js";
166
- import "./chunk-YREKMP24.js";
167
- import "./chunk-U46RNOEQ.js";
168
- import "./chunk-AN6IJYH3.js";
164
+ } from "./chunk-K7YY6SXR.js";
165
+ import "./chunk-WOPVBRPV.js";
166
+ import "./chunk-R53XXHEI.js";
167
+ import "./chunk-6D4VWSJD.js";
168
+ import "./chunk-5UTB3ADZ.js";
169
+ import "./chunk-D4NE7EON.js";
170
+ import "./chunk-6QGUK3H7.js";
171
+ import "./chunk-GLYWZQY4.js";
172
+ import "./chunk-S4ZHQMNM.js";
169
173
  import {
170
174
  Argument,
171
175
  Command,
@@ -177,6 +181,7 @@ import {
177
181
  Option,
178
182
  REMOTE_READ,
179
183
  REMOTE_WRITE,
184
+ allowDeletionsOption,
180
185
  annotate,
181
186
  annotateOption,
182
187
  answerEntity,
@@ -212,13 +217,13 @@ import {
212
217
  sharedCommand,
213
218
  snakeKeys,
214
219
  snakeKeysKeeping
215
- } from "./chunk-NKYWQTS2.js";
216
- import "./chunk-M54YKD3I.js";
217
- import "./chunk-G3LAYJJJ.js";
218
- import "./chunk-O3WE5IGP.js";
219
- import "./chunk-SMM7GS4Q.js";
220
- import "./chunk-KQZTX4LM.js";
221
- import "./chunk-V2QWX6B3.js";
220
+ } from "./chunk-63N46DJU.js";
221
+ import "./chunk-CGW5R4UD.js";
222
+ import "./chunk-RN6RT5CB.js";
223
+ import "./chunk-IB55P46L.js";
224
+ import "./chunk-3YM4B2GT.js";
225
+ import "./chunk-FNV5HLHX.js";
226
+ import "./chunk-6JTHXWPE.js";
222
227
  import {
223
228
  CRM_CHANGES,
224
229
  CRM_SCOPES,
@@ -228,52 +233,53 @@ import {
228
233
  crmSettingKey,
229
234
  seenBy,
230
235
  viewerSql
231
- } from "./chunk-TEGQVVCZ.js";
232
- import "./chunk-6QMSKJB4.js";
236
+ } from "./chunk-KEKXERBE.js";
237
+ import "./chunk-UDSL3MUU.js";
233
238
  import {
239
+ aheadOf,
234
240
  dayIn
235
- } from "./chunk-PLU2IQXC.js";
236
- import "./chunk-IBEHYGG6.js";
241
+ } from "./chunk-633NQY2R.js";
242
+ import "./chunk-KZN2BG3P.js";
237
243
  import {
238
244
  count,
239
245
  createTaskService,
240
246
  currentAttempt,
241
247
  text,
242
248
  time
243
- } from "./chunk-M33XHJTM.js";
244
- import "./chunk-ELAKOEIO.js";
245
- import "./chunk-BCIZAUDV.js";
249
+ } from "./chunk-PPSAWFJD.js";
250
+ import "./chunk-JLXXUEAM.js";
251
+ import "./chunk-3DEQUYEG.js";
246
252
  import {
247
253
  hostFetch,
248
254
  providerWaitMs,
249
255
  readJsonResponse,
250
256
  retryableStatus,
251
257
  statusToCode
252
- } from "./chunk-E3EWS6DF.js";
253
- import "./chunk-3K6T2G52.js";
254
- import "./chunk-IPNIF5JE.js";
258
+ } from "./chunk-G2TU5RYY.js";
259
+ import "./chunk-ADTI5RUO.js";
260
+ import "./chunk-XCCU2E3Z.js";
255
261
  import {
256
262
  IDENTITY,
257
263
  PACKAGE,
258
264
  SKILL
259
- } from "./chunk-WAFB3IWJ.js";
260
- import "./chunk-RQPB2BSH.js";
261
- import "./chunk-PIOR6PIO.js";
265
+ } from "./chunk-4VN7RI4I.js";
266
+ import "./chunk-FV4GQNIK.js";
267
+ import "./chunk-LZPKBN3C.js";
262
268
  import "./chunk-EH6ZEJGT.js";
263
- import "./chunk-UCM7C773.js";
264
- import "./chunk-MW7HUD6R.js";
269
+ import "./chunk-JXT6GY4V.js";
270
+ import "./chunk-NSKMNIY6.js";
265
271
  import {
266
272
  installerOf
267
- } from "./chunk-745FMNI5.js";
273
+ } from "./chunk-TXDR6YSF.js";
268
274
  import {
269
275
  fieldsOf,
270
276
  levelFor
271
- } from "./chunk-KBAOJISR.js";
277
+ } from "./chunk-BIKOE2IW.js";
272
278
  import {
273
279
  foldName
274
- } from "./chunk-SHOSFYI7.js";
275
- import "./chunk-2UJ7ZZZC.js";
276
- import "./chunk-SFZVMKB6.js";
280
+ } from "./chunk-EHK73OSW.js";
281
+ import "./chunk-IG2TJQJ7.js";
282
+ import "./chunk-2JHVQMVC.js";
277
283
  import {
278
284
  CRM_ACTIVITY_KINDS,
279
285
  CRM_KINDS,
@@ -284,26 +290,26 @@ import {
284
290
  normalCrmUserId,
285
291
  parseDecimal,
286
292
  scaleOf
287
- } from "./chunk-S6DTLAOB.js";
288
- import "./chunk-EAX5RO7S.js";
289
- import "./chunk-FQRP6JWX.js";
293
+ } from "./chunk-ZLUIRFJX.js";
294
+ import "./chunk-XEQQJBBO.js";
295
+ import "./chunk-RRTMPSQR.js";
290
296
  import {
291
297
  SAVE_HELP,
292
298
  defineQuery,
293
299
  queryFieldsOf,
294
300
  timezoneOf,
295
301
  zonedMoment
296
- } from "./chunk-GMHRPX5M.js";
297
- import "./chunk-TCSVW7BA.js";
298
- import "./chunk-YFRTEJ6V.js";
302
+ } from "./chunk-DSJ6EAOA.js";
303
+ import "./chunk-DNCLQPOM.js";
304
+ import "./chunk-AKRIUNYP.js";
299
305
  import "./chunk-D72URWJE.js";
300
306
  import {
301
307
  readSecret
302
- } from "./chunk-VG2ERHFJ.js";
303
- import "./chunk-ASU63X5C.js";
304
- import "./chunk-ZKRWNL4T.js";
305
- import "./chunk-NXNUCGGO.js";
306
- import "./chunk-KORZEYZN.js";
308
+ } from "./chunk-IA7LLLEI.js";
309
+ import "./chunk-YWDFYQOU.js";
310
+ import "./chunk-TLG6ECZ2.js";
311
+ import "./chunk-WXJYMMEL.js";
312
+ import "./chunk-GGMAIIVE.js";
307
313
  import {
308
314
  Credentials,
309
315
  isMovedRun,
@@ -312,7 +318,7 @@ import {
312
318
  renderPretty,
313
319
  resolvePaths,
314
320
  systemKeyring
315
- } from "./chunk-SCMB4LI6.js";
321
+ } from "./chunk-WIHN3ELW.js";
316
322
  import {
317
323
  array,
318
324
  boolean,
@@ -321,6 +327,7 @@ import {
321
327
  literal,
322
328
  nullable,
323
329
  number,
330
+ omit,
324
331
  optional,
325
332
  picklist,
326
333
  pipe,
@@ -331,13 +338,13 @@ import {
331
338
  union,
332
339
  unknown,
333
340
  variant
334
- } from "./chunk-7OVTUADG.js";
341
+ } from "./chunk-QFOP3KUP.js";
335
342
  import "./chunk-Y5E2WNWB.js";
336
343
  import {
337
344
  CliError,
338
345
  isCliError
339
- } from "./chunk-AP3CWDRK.js";
340
- import "./chunk-EBNCUQLV.js";
346
+ } from "./chunk-S6JG4YUH.js";
347
+ import "./chunk-4N7PP76S.js";
341
348
  import {
342
349
  __name
343
350
  } from "./chunk-ZVVMGPBJ.js";
@@ -346,7 +353,7 @@ import {
346
353
  import { join as join4 } from "node:path";
347
354
  import { fileURLToPath as fileURLToPath2 } from "node:url";
348
355
 
349
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/update/index.js
356
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/update/index.js
350
357
  import { realpathSync } from "node:fs";
351
358
  import { fileURLToPath } from "node:url";
352
359
  var npmRegistry = /* @__PURE__ */ __name(() => hostFetch({ hosts: ["registry.npmjs.org"] }), "npmRegistry");
@@ -1406,7 +1413,7 @@ var callCommand = /* @__PURE__ */ __name(() => annotate(new Command("call"), {
1406
1413
  }), "callCommand");
1407
1414
  var apiCommand = /* @__PURE__ */ __name(() => annotate(new Command("api"), { effects: LOCAL_READ }).description("see and call the amoCRM API v4 operations directly").addCommand(listCommand()).addCommand(showCommand()).addCommand(callCommand()), "apiCommand");
1408
1415
 
1409
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/stage-tasks.js
1416
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/stage-tasks.js
1410
1417
  var DAY = 864e5;
1411
1418
  var openStageTasks = /* @__PURE__ */ __name(async (store, account2, now, { history = false } = {}) => {
1412
1419
  const rules = await store.crm.stageTasks(account2);
@@ -1443,7 +1450,7 @@ var openStageTasks = /* @__PURE__ */ __name(async (store, account2, now, { histo
1443
1450
  return opened;
1444
1451
  }, "openStageTasks");
1445
1452
 
1446
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/cli/account.js
1453
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/account.js
1447
1454
  import { join } from "node:path";
1448
1455
  var SHARED = new Set(Object.values(CRM_SHARED_FOLDERS));
1449
1456
  var isShared = /* @__PURE__ */ __name((profile) => SHARED.has(profile.toLowerCase()), "isShared");
@@ -1549,7 +1556,7 @@ var crmAccountCommand = /* @__PURE__ */ __name((app, options) => annotate(new Co
1549
1556
  ...options.resolveSettings ? { resolveSettings: options.resolveSettings } : {}
1550
1557
  }), { effects: LOCAL_WRITE }).hook("preAction", (_, action) => refuseSharedDelete(app, options, action))), "crmAccountCommand");
1551
1558
 
1552
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/digest.js
1559
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/digest.js
1553
1560
  var HOUR = 36e5;
1554
1561
  var SHOWN = 7;
1555
1562
  var STALE_HOURS = 24;
@@ -1693,7 +1700,7 @@ var healthOf = /* @__PURE__ */ __name(async (store, account2, { now, profile })
1693
1700
  return stale > STALE_HOURS ? [{ ...named, stale_hours: Math.floor(stale) }] : [];
1694
1701
  }, "healthOf");
1695
1702
 
1696
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/cli/csv.js
1703
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/csv.js
1697
1704
  var csvFormatOption = /* @__PURE__ */ __name(() => annotateOption(new Option("--format <format>", "csv: this page as a table for a spreadsheet; --json=a,b picks its columns").choices(["csv"]), { mcp: false }), "csvFormatOption");
1698
1705
  var DEAL_CSV_COLUMNS = [
1699
1706
  "ref",
@@ -1815,7 +1822,7 @@ var renderCsv = /* @__PURE__ */ __name((command, open2, read, defaults = DEAL_CS
1815
1822
  });
1816
1823
  }, "renderCsv");
1817
1824
 
1818
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/cli/records.js
1825
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/records.js
1819
1826
  var time2 = nullable(isoTime);
1820
1827
  var metadata = optional(record(string(), strictObject({
1821
1828
  label: nullable(string()),
@@ -2036,7 +2043,7 @@ var addCrmRecordCommands = /* @__PURE__ */ __name((program, options) => {
2036
2043
  });
2037
2044
  });
2038
2045
  });
2039
- example(answerEntity(annotate(group.command("show"), { effects: REMOTE_READ, offline: false }), noun.entity, noun.schema).description(`one of the CRM's ${noun.what}, read live, with its phones and e-mails; one that is not your client counts toward the day's limit when the CRM sets one`).argument(`<${noun.kind}>`, `the CRM's id of the ${noun.kind}, as list prints it, or its exact name`), `${noun.noun} show 42`, `${noun.noun} show "Anna Example" --json`).action(async (given, _opts, command) => {
2046
+ example(answerEntity(annotate(group.command("show"), { effects: REMOTE_READ, offline: false }), noun.entity, noun.schema).description(`one of the CRM's ${noun.what}, read live, with its phones and e-mails; one that is not your client counts toward the day's limit when the CRM sets one`).argument(`<${noun.kind}>`, `the CRM's id of the ${noun.kind}, as list prints it, the ${noun.kind}:<id> a deal gives, or its exact name`), `${noun.noun} show 42`, `${noun.noun} show "Anna Example" --json`).action(async (given, _opts, command) => {
2040
2047
  await within(command, async (run3) => {
2041
2048
  const found = await recordNamed(run3, noun, given);
2042
2049
  await quotaOf2(run3).spend(noun.kind, found);
@@ -2060,8 +2067,22 @@ var byIdOrNone = /* @__PURE__ */ __name(async (run3, noun, id) => {
2060
2067
  throw error;
2061
2068
  }
2062
2069
  }, "byIdOrNone");
2070
+ var storedRecord = /* @__PURE__ */ __name(async (run3, noun, ref) => {
2071
+ const ids = await run3.store.crm.externalIdsOf(run3.account, ref);
2072
+ if (ids.length > 1)
2073
+ throw new CliError("validation_error", `${ref} is ${ids.length} records of the CRM; name one by its id`, {
2074
+ reason: "crm.record-ambiguous",
2075
+ candidates: ids.map((id) => ({ id }))
2076
+ });
2077
+ const found = ids[0] ? await sourceWith(run3, "get", noun.what).get(noun.kind, ids[0]) : null;
2078
+ if (!found)
2079
+ throw new CliError("not_found", `the copy holds no CRM ${noun.kind} as ${ref}, or this sign-in cannot see it`);
2080
+ return found;
2081
+ }, "storedRecord");
2063
2082
  var recordNamed = /* @__PURE__ */ __name(async (run3, noun, given) => {
2064
2083
  const id = given.trim();
2084
+ if (id.startsWith(`${noun.kind}:`) && /^\w+:\d+$/.test(id))
2085
+ return storedRecord(run3, noun, id);
2065
2086
  const byId = RECORD_ID.test(id) ? await byIdOrNone(run3, noun, id) : null;
2066
2087
  if (byId)
2067
2088
  return byId;
@@ -2139,16 +2160,28 @@ var addRecordWrites = /* @__PURE__ */ __name((group, noun, { within, example, wr
2139
2160
  if (!writes?.kinds.includes(noun.kind))
2140
2161
  return;
2141
2162
  const person = noun.kind === "person";
2163
+ const written = writes.fields?.[noun.kind];
2164
+ const takes = /* @__PURE__ */ __name((field) => !written || written.includes(field), "takes");
2142
2165
  const fields = /* @__PURE__ */ __name((command2) => {
2143
2166
  command2.option("--name <name>", person ? "the whole name" : "the company's name");
2144
- if (person)
2145
- command2.option("--first-name <name>", "the first name; empty clears it").option("--last-name <name>", "the last name; empty clears it").option("--position <title>", "the job title; empty clears it");
2167
+ if (person) {
2168
+ command2.option("--first-name <name>", "the first name; empty clears it").option("--last-name <name>", "the last name; empty clears it");
2169
+ if (takes("position"))
2170
+ command2.option("--position <title>", "the job title; empty clears it");
2171
+ }
2146
2172
  const repeated = /* @__PURE__ */ __name((value, previous = []) => [...previous, value], "repeated");
2147
- command2.option("--email <address>", "an e-mail address to give it; repeat it for more; replaces its list, and an empty one clears it", repeated).option("--phone <phone>", "a phone number to give it, in international form starting with +; repeat it for more; replaces its list, and an empty one clears it", repeated).option("--owner <user>", "the CRM user it is assigned to; anyone but the sign-in's own user checks crm.assign-others").option("--field <key=value>", "one of the CRM's own fields, by its code or label as `fields list` prints them, and its value; a list field takes its option's label or id; repeat it for more fields, or for each value of a multiple field; an empty value clears it", (value, previous = []) => {
2148
- if (value.indexOf("=") < 1)
2149
- throw new CliError("validation_error", "--field takes <key>=<value>");
2150
- return [...previous, value];
2151
- }, []);
2173
+ if (takes("emails"))
2174
+ command2.option("--email <address>", "an e-mail address to give it; repeat it for more; replaces its list, and an empty one clears it", repeated);
2175
+ if (takes("phones"))
2176
+ command2.option("--phone <phone>", "a phone number to give it, in international form starting with +; repeat it for more; replaces its list, and an empty one clears it", repeated);
2177
+ if (takes("owner"))
2178
+ command2.option("--owner <user>", "the CRM user it is assigned to; anyone but the sign-in's own user checks crm.assign-others");
2179
+ if (takes("custom"))
2180
+ command2.option("--field <key=value>", "one of the CRM's own fields, by its code or label as `fields list` prints them, and its value; a list field takes its option's label or id; repeat it for more fields, or for each value of a multiple field; an empty value clears it", (value, previous = []) => {
2181
+ if (value.indexOf("=") < 1)
2182
+ throw new CliError("validation_error", "--field takes <key>=<value>");
2183
+ return [...previous, value];
2184
+ }, []);
2152
2185
  if (writes.idempotent)
2153
2186
  command2.option("--operation-id <id>", "the operation_id a write that ended in outcome_unknown named: the CRM answers the repeat from its record");
2154
2187
  return command2;
@@ -2196,7 +2229,7 @@ var addRecordWrites = /* @__PURE__ */ __name((group, noun, { within, example, wr
2196
2229
  }, "addRecordWrites");
2197
2230
  var idOf = /* @__PURE__ */ __name((opts) => opts.operationId === void 0 ? {} : { operationId: opts.operationId }, "idOf");
2198
2231
 
2199
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/cli/activities.js
2232
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/activities.js
2200
2233
  var MOST2 = 500;
2201
2234
  var nullableText = nullable(text);
2202
2235
  var REFS = ["deal", "lead", "person", "organization"];
@@ -2240,7 +2273,7 @@ var crmActivity = strictObject({
2240
2273
  });
2241
2274
  var UNTRUSTED2 = ["subject", "body", "on.title"];
2242
2275
  var iso3 = /* @__PURE__ */ __name((at2) => at2 === null ? null : new Date(at2).toISOString(), "iso");
2243
- var itemOf2 = /* @__PURE__ */ __name((one) => ({
2276
+ var listedOf = /* @__PURE__ */ __name((one) => ({
2244
2277
  external_id: one.externalId,
2245
2278
  kind: one.kind,
2246
2279
  subject: one.subject,
@@ -2253,10 +2286,15 @@ var itemOf2 = /* @__PURE__ */ __name((one) => ({
2253
2286
  updated_at: new Date(one.updatedAt).toISOString(),
2254
2287
  on: one.on.map(({ kind, externalId, ref, title }) => ({ kind, external_id: externalId, ref, title })),
2255
2288
  untrusted: UNTRUSTED2
2256
- }), "itemOf");
2289
+ }), "listedOf");
2257
2290
  var addCrmActivityCommands = /* @__PURE__ */ __name((program, options) => {
2291
+ const group = annotate(program.command("activities"), { effects: NO_EFFECTS }).description(options.list ? "the CRM's activities and tasks on deals, leads, contacts and companies, as last synced" : `comments and tasks written to the CRM's ${options.leads === false ? "deals" : "deals, leads"}, contacts and companies`);
2292
+ if (options.list)
2293
+ addList(group, options);
2294
+ addActivityWrites(group, options);
2295
+ }, "addCrmActivityCommands");
2296
+ var addList = /* @__PURE__ */ __name((group, options) => {
2258
2297
  const { within, example, now, ownerOf: ownerOf2, pathOf: pathOf3 } = options;
2259
- const group = annotate(program.command("activities"), { effects: NO_EFFECTS }).description("the CRM's activities and tasks on deals, leads, contacts and companies, as last synced");
2260
2298
  example(withQuery(answerEntity(annotate(group.command("list"), { effects: LOCAL_READ }), "crm_activity", crmActivity).description("activities copied from the CRM, open ones first by due time, then the rest newest first; status:open unless a status is given; the activities setting must be on").option("--limit <n>", `activities per page, 1\u2013${MOST2}`, integer(MOST2), 50).option("--page <n>", "which page, starting at 1", integer(1e6), 1), ACTIVITIES_QUERY), "activities list overdue:true", "activities list due:today --json", "activities list deal:12 status:done").action(async (words, opts, command) => {
2261
2299
  const name = "activities list";
2262
2300
  const terms = queryTerms(words, ACTIVITIES_QUERY, name, ["due"]);
@@ -2299,17 +2337,92 @@ var addCrmActivityCommands = /* @__PURE__ */ __name((program, options) => {
2299
2337
  offset: (opts.page - 1) * opts.limit
2300
2338
  });
2301
2339
  return listOf(pathOf3(command).join(" "), {
2302
- items: found.items.map(itemOf2),
2340
+ items: found.items.map(listedOf),
2303
2341
  ...paged,
2304
2342
  has_more: found.hasMore,
2305
2343
  ...due.meta ? { meta: due.meta } : {}
2306
2344
  });
2307
2345
  });
2308
2346
  });
2309
- }, "addCrmActivityCommands");
2347
+ }, "addList");
2310
2348
  var refOf = /* @__PURE__ */ __name((kind, value) => value.includes(":") ? value : `${kind}:${value}`, "refOf");
2349
+ var writtenActivity = strictObject({
2350
+ operation_id: text,
2351
+ stored: boolean(),
2352
+ activity: omit(crmActivity, ["done_at"]),
2353
+ untrusted: array(text)
2354
+ });
2355
+ var addActivityWrites = /* @__PURE__ */ __name((group, options) => {
2356
+ const { within, example, now, writes } = options;
2357
+ const kinds = writes?.activities ?? [];
2358
+ if (kinds.length === 0)
2359
+ return;
2360
+ const leads = options.leads !== false;
2361
+ const contextOf3 = /* @__PURE__ */ __name((run3, command) => {
2362
+ if (!run3.writes)
2363
+ throw new CliError("configuration_error", "this profile cannot write to its CRM");
2364
+ return {
2365
+ store: run3.store,
2366
+ account: run3.account,
2367
+ writes: run3.writes(),
2368
+ ask: terminalAsker(command),
2369
+ source: run3.source,
2370
+ names: { id: "--operation-id" }
2371
+ };
2372
+ }, "contextOf");
2373
+ const answered = /* @__PURE__ */ __name((run3, done) => itemOf({
2374
+ operation_id: done.operationId,
2375
+ stored: done.stored,
2376
+ activity: writtenOf(run3, done.activity, done.on),
2377
+ untrusted: UNTRUSTED2.map((field) => `activity.${field}`)
2378
+ }), "answered");
2379
+ const write2 = /* @__PURE__ */ __name((name, description) => {
2380
+ const command = answerEntity(annotate(group.command(name), { effects: REMOTE_WRITE, offline: false }), "crm_activity_write", writtenActivity).description(description);
2381
+ if (writes?.idempotent)
2382
+ command.option("--operation-id <id>", "the operation_id a write that ended in outcome_unknown named: the CRM answers the repeat from its record");
2383
+ return command;
2384
+ }, "write");
2385
+ const idOf2 = /* @__PURE__ */ __name((opts) => opts.operationId === void 0 ? {} : { operationId: opts.operationId }, "idOf");
2386
+ const comment = kinds.includes("comment");
2387
+ const task = kinds.includes("task");
2388
+ example(write2("create", `add a ${kinds.join(" or ")} to records of the CRM, then store the CRM's copy of it when the activities setting is on`).addArgument(new Argument("<kind>", "what to add").choices(kinds)).option(
2389
+ "--subject <ref>",
2390
+ `a record it is on: ${leads ? "deal:<id>, lead:<id>" : "deal:<id>"}, person:<id> or organization:<id> as a list or deals show gives it, or person:crm:<id> or organization:crm:<id> by the CRM's id as people list and organizations list print it; repeat it for more`,
2391
+ (value, previous = []) => [...previous, value],
2392
+ // The empty default marks the flag as repeatable, so an agent's tool takes a list.
2393
+ []
2394
+ ).option("--title <title>", task ? "a task's title, needed for a task; a comment's title where the CRM keeps one" : "its title").option("--text <text>", comment ? "a comment's text, needed for a comment; a task's description" : "its text").option("--due <time>", "a task's deadline: an ISO 8601 time, a date (its end), today, or 2h, 3d from now; in your time zone").option("--owner <user>", "the CRM user a task is assigned to; anyone but the sign-in's own user checks crm.assign-others"), ...comment ? ['activities create comment --subject deal:12 --text "Example: asked for a discount"'] : [], ...task ? ['activities create task --subject deal:12 --title "Example: call back" --due 2026-12-01T10:00'] : []).action(async (kind, opts, command) => {
2395
+ await within(command, async (run3) => {
2396
+ const done = await createCrmActivity(contextOf3(run3, command), kind, {
2397
+ on: opts.subject,
2398
+ ...opts.title === void 0 ? {} : { title: opts.title },
2399
+ ...opts.text === void 0 ? {} : { body: opts.text },
2400
+ ...opts.due === void 0 ? {} : { dueAt: aheadOf(opts.due, "--due", now(), { end: true }) },
2401
+ ...opts.owner === void 0 ? {} : { owner: opts.owner }
2402
+ }, idOf2(opts));
2403
+ return answered(run3, done);
2404
+ });
2405
+ });
2406
+ if (task)
2407
+ example(write2("close", "mark a task done in the CRM, then store the CRM's copy of it when the activities setting is on").argument("<task>", "the task's id in the CRM, as activities list prints its external_id"), "activities close 42").action(async (id, opts, command) => {
2408
+ await within(command, async (run3) => answered(run3, await completeCrmActivity(contextOf3(run3, command), id, idOf2(opts))));
2409
+ });
2410
+ }, "addActivityWrites");
2411
+ var writtenOf = /* @__PURE__ */ __name((run3, activity, on) => ({
2412
+ external_id: activity.externalId,
2413
+ kind: activity.kind,
2414
+ subject: activity.subject,
2415
+ body: activity.body ?? null,
2416
+ due_at: iso3(activity.dueAt ?? null),
2417
+ done: activity.done,
2418
+ assignee: activity.assignee ? crmIdentityId(run3.account, activity.assignee, "user") : null,
2419
+ created_at: new Date(activity.createdAt).toISOString(),
2420
+ updated_at: new Date(activity.updatedAt).toISOString(),
2421
+ on: on.map(({ kind, externalId, ref, title }) => ({ kind, external_id: externalId, ref, title })),
2422
+ untrusted: UNTRUSTED2
2423
+ }), "writtenOf");
2311
2424
 
2312
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/cli/changes.js
2425
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/changes.js
2313
2426
  var MOST3 = 500;
2314
2427
  var DAY2 = 864e5;
2315
2428
  var nullableText2 = nullable(text);
@@ -2372,7 +2485,7 @@ var CSV_COLUMNS = [
2372
2485
  "owner",
2373
2486
  "activity.subject"
2374
2487
  ];
2375
- var itemOf3 = /* @__PURE__ */ __name((run3, one) => ({
2488
+ var itemOf2 = /* @__PURE__ */ __name((run3, one) => ({
2376
2489
  change: one.change,
2377
2490
  at: new Date(one.at).toISOString(),
2378
2491
  kind: one.kind,
@@ -2414,8 +2527,17 @@ var digestState = /* @__PURE__ */ __name((schedule) => `crm:digest:${schedule}`,
2414
2527
  var addCrmChangeCommands = /* @__PURE__ */ __name((program, options) => {
2415
2528
  const { within, example, now, ownerOf: ownerOf2, pathOf: pathOf3 } = options;
2416
2529
  const deals = options.leads === false ? "deals" : "deals and leads";
2417
- if (options.activities)
2418
- addCrmActivityCommands(program, { within, example, now, ownerOf: ownerOf2, pathOf: pathOf3 });
2530
+ if (options.activities || options.writes?.activities?.length)
2531
+ addCrmActivityCommands(program, {
2532
+ within,
2533
+ example,
2534
+ now,
2535
+ ownerOf: ownerOf2,
2536
+ pathOf: pathOf3,
2537
+ list: options.activities === true,
2538
+ ...options.writes ? { writes: options.writes } : {},
2539
+ ...options.leads === void 0 ? {} : { leads: options.leads }
2540
+ });
2419
2541
  const group = annotate(program.command("changes"), { effects: NO_EFFECTS }).description(`what changed in the CRM's ${options.leads === false ? "deals" : "deals, leads"}, activities and contacts, as the syncs copied it`);
2420
2542
  example(withQuery(answerEntity(annotate(group.command("list"), { effects: LOCAL_READ }), "crm_change", crmChange).description(`${deals} made, moved, won, lost and given another owner, activities added and done, and contacts added, newest first; the last day unless at: says otherwise`).option("--limit <n>", `changes per page, 1\u2013${MOST3}`, integer(MOST3), 50).option("--cursor <cursor>", "the next page, as the last answer's page.next gave it").addOption(annotateOption(new Option("--format <format>", "csv: this page as a table; report: the window as a morning digest document, for schedule command. Run by a schedule, the report starts where that schedule's last one ended").choices(["csv", "report"]), { mcp: false })), CHANGES_QUERY), 'changes list "at>=1d"', "changes list change:won at>=7d --json", 'changes list "at>=1d" --format report').action(async (words, opts, command) => {
2421
2543
  const name = "changes list";
@@ -2439,7 +2561,7 @@ var addCrmChangeCommands = /* @__PURE__ */ __name((program, options) => {
2439
2561
  offset: position.offset
2440
2562
  });
2441
2563
  const next = found.hasMore ? cursorOf({ ...position, offset: position.offset + opts.limit }) : void 0;
2442
- return { items: found.items.map((one) => itemOf3(run3, one)), next };
2564
+ return { items: found.items.map((one) => itemOf2(run3, one)), next };
2443
2565
  }, "read");
2444
2566
  const noted = /* @__PURE__ */ __name((run3) => {
2445
2567
  const note = shortened.get(run3);
@@ -2529,7 +2651,7 @@ var pipelineOf2 = /* @__PURE__ */ __name(async (run3, value) => {
2529
2651
  }) : new CliError("not_found", `no pipeline ${value} in this account`, { reason: "pipeline.not-found" });
2530
2652
  }, "pipelineOf");
2531
2653
 
2532
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/cli/files.js
2654
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/files.js
2533
2655
  import { createHash } from "node:crypto";
2534
2656
  import { chmodSync, constants, copyFileSync, existsSync, linkSync, mkdirSync, readFileSync, renameSync, rmSync } from "node:fs";
2535
2657
  import { open } from "node:fs/promises";
@@ -2832,7 +2954,7 @@ var addCrmFileCommands = /* @__PURE__ */ __name((program, options) => {
2832
2954
  const { signal } = environmentOf(command);
2833
2955
  return { app, run: run3, now, ...signal ? { signal } : {} };
2834
2956
  }, "contextOf");
2835
- const group = annotate(program.command("files"), { effects: REMOTE_READ }).description("the files of the CRM's deals, leads, contacts and companies: listed live, downloaded on demand, their text found by search all");
2957
+ const group = notLocalPaths(annotate(program.command("files"), { effects: REMOTE_READ }), "file").description("the files of the CRM's deals, leads, contacts and companies: listed live, downloaded on demand, their text found by search all");
2836
2958
  const list = example(answerEntity(annotate(group.command("list"), { effects: REMOTE_READ, offline: false }), "crm_file", crmFile).description("one record's files, read live from the CRM, with the path of each already downloaded; another user's record counts toward the day's limit when the CRM sets one"), "files list --deal 12", "files list --person 42 --json");
2837
2959
  for (const [, flag] of kinds)
2838
2960
  list.option(flag, `the ${flag.slice(2, flag.indexOf(" "))} whose files to list`);
@@ -3066,7 +3188,7 @@ var syncFiles = /* @__PURE__ */ __name(async (context, outOfTime, deadline = (ms
3066
3188
  return report;
3067
3189
  }, "syncFiles");
3068
3190
 
3069
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/cli/pipeline-view.js
3191
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/pipeline-view.js
3070
3192
  var sumOf = /* @__PURE__ */ __name((amounts) => amounts.map(({ amount, currency }) => `${groupDigits(amount)} ${currency}`).join(", ") || "\u2014", "sumOf");
3071
3193
  var percent = /* @__PURE__ */ __name((share) => share === null ? "\u2014" : `${Math.round(share * 100)}%`, "percent");
3072
3194
  var openStages = /* @__PURE__ */ __name((stages) => {
@@ -3112,12 +3234,14 @@ ${outcomes.join("\n")}`
3112
3234
  ].join("\n\n");
3113
3235
  }, "pipelineView");
3114
3236
 
3115
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/cli/search-all.js
3237
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/search-all.js
3116
3238
  var SEARCHED = ["crm", ...SOURCE_SEARCHED];
3117
3239
  var DEFAULT_LIMIT = 20;
3118
3240
  var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example, viewerOf: viewerOf2, leads = true }) => {
3119
3241
  const deals = leads ? "deals and leads" : "deals";
3120
- const all = annotate(new Command("all"), { effects: LOCAL_READ, partial: true, output: { entity: "hit" } }).summary(`search stored ${deals}, messages, notes, calendar events and meetings`).description(`search the CRM's ${deals} by the words of their title, company, contacts and activities, and the messages, notes, calendar events and meetings other WireCat tools stored \u2014 best match first. Use it when you do not know where something was written`).argument("<query...>", `words and "phrases"; ${deals} match the words of their title, company, contacts and activities`).addHelpText("after", SAVE_HELP);
3242
+ const all = annotate(new Command("all"), { effects: LOCAL_READ, partial: true, output: { entity: "hit" } }).summary(`search stored ${deals}, messages, notes, calendar events and meetings`).description(`search the CRM's ${deals} by the words of their title, company, contacts and activities, and the messages, notes, calendar events and meetings other WireCat tools stored \u2014 best match first. Use it when you do not know where something was written`).argument("<query...>", `words and "phrases"; ${deals} match the words of their title, company, contacts and activities`).addHelpText("after", `
3243
+ It finds ${deals} by the meaning of their activities too, in other words or another language, once \`sync --embed\` has built their vectors with a downloaded model; until then it says it searched by words only.
3244
+ ` + SAVE_HELP);
3121
3245
  searches.addCommand(searchAllOptions(all, SEARCHED));
3122
3246
  example(all, "search all Example LLC", "search all website --only crm --json");
3123
3247
  all.action(async (words, _opts, leaf) => {
@@ -3127,7 +3251,7 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
3127
3251
  throw new CliError("permission_error", "this process is locked to one profile; search all reads its own CRM account only, without --source", { reason: "profile.locked" });
3128
3252
  const asked = opts.only ?? SEARCHED;
3129
3253
  const denied = deniedKinds(leaf, app, [
3130
- ...asked.includes("crm") ? [...DEAL_KINDS, "crm_file"] : [],
3254
+ ...asked.includes("crm") ? [...DEAL_KINDS, "crm_file", "crm_activity"] : [],
3131
3255
  ...asked.filter((one) => one !== "crm" && one !== "mail")
3132
3256
  ]);
3133
3257
  const out = new Set(denied.map(({ kind }) => kind));
@@ -3157,6 +3281,7 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
3157
3281
  ...crmKinds.length < DEAL_KINDS.length ? { crmKinds } : {},
3158
3282
  crmViewers: viewers,
3159
3283
  ...out.has("crm_file") ? { crmFiles: false } : {},
3284
+ ...out.has("crm_activity") ? { crmActivities: false } : {},
3160
3285
  ...opts.source === void 0 ? {} : { source: opts.source },
3161
3286
  ...alone ? { scope: { crm: [run3.account] } } : {}
3162
3287
  }, { app, hintCommand: commandAt(rootOf2(leaf), "models download") ? app.command : null }, void 0, meaningLane({ env, messenger: { app }, store: /* @__PURE__ */ __name(async () => run3.store, "store") }));
@@ -3167,6 +3292,11 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
3167
3292
  note(`${resource ?? source} not searched: ${reason}`);
3168
3293
  if (!found.items.length)
3169
3294
  note("nothing found in what the local store holds");
3295
+ const off = found.crm?.needsVectors && !await run3.store.crm.activitiesOn(run3.account);
3296
+ const build = off ? `\`${lineOf(leaf, "config set activities on")}\`, then \`${lineOf(leaf, "sync --embed")}\`, copy the activities and build` : `\`${lineOf(leaf, "sync --embed")}\` builds`;
3297
+ const vectors = found.crm?.needsVectors ? `deals and leads were found by words only: ${found.crm.meaningSkipped}; ${build} the vectors that find them by the meaning of their activities` : void 0;
3298
+ if (vectors)
3299
+ note(vectors);
3170
3300
  const skips = await historySkipsOf(run3.store, found.accounts).catch(() => []);
3171
3301
  const again = {
3172
3302
  query: words.join(" "),
@@ -3174,12 +3304,64 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
3174
3304
  ...opts.source === void 0 ? {} : { source: opts.source },
3175
3305
  ...opts.exact ? { exact: true } : {}
3176
3306
  };
3177
- return allAnswer("search all", found, { limit, page: opts.page ?? 1, again }, opts.exact === true, skips, denied);
3307
+ const body = allAnswer("search all", found, { limit, page: opts.page ?? 1, again }, opts.exact === true, skips, denied);
3308
+ return vectors ? { ...body, missing: [...body.missing ?? [], { field: "found_by", why: vectors }] } : body;
3178
3309
  });
3179
3310
  });
3180
3311
  }, "addCrmSearchAll");
3181
3312
 
3182
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/cli/profile-store.js
3313
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/sync-embed.js
3314
+ var EMBED_MAX = 600;
3315
+ var crmSyncEmbeddings = strictObject({
3316
+ model: text,
3317
+ embedded: count,
3318
+ left: boolean(),
3319
+ stopped: optional(picklist(["deadline", "cancelled"])),
3320
+ remaining: optional(count)
3321
+ });
3322
+ var syncEmbeddings = /* @__PURE__ */ __name(async (command, store, report, app, again) => {
3323
+ if (report.stopped)
3324
+ return { item: {}, issues: [] };
3325
+ const { env, deadline, signal } = environmentOf(command);
3326
+ const ends = deadline?.();
3327
+ try {
3328
+ const embeddings = await embedCrmActivities(store, {
3329
+ maxChunks: EMBED_MAX,
3330
+ ...ends ? { deadline: ends } : {},
3331
+ ...signal ? { signal } : {},
3332
+ ...env ? { env } : {},
3333
+ ...commandAt(rootOf2(command), "models download") ? { command: app.command } : {}
3334
+ });
3335
+ if (!embeddings.left)
3336
+ return { item: { embeddings }, issues: [] };
3337
+ return {
3338
+ item: { embeddings },
3339
+ issues: [],
3340
+ next: [
3341
+ {
3342
+ kind: "command",
3343
+ step: "crm.sync",
3344
+ command: "sync",
3345
+ args: Object.fromEntries(Object.entries({ ...again, embed: true }).filter(([, value]) => value !== void 0)),
3346
+ why: `${embeddings.remaining === void 0 ? "some" : embeddings.remaining} activity chunks have no vectors yet, so search all may miss their deals by meaning; running sync --embed again embeds the next ones`,
3347
+ safe_to_auto_execute: true
3348
+ }
3349
+ ]
3350
+ };
3351
+ } catch (error) {
3352
+ if (signal?.aborted || !isCliError(error))
3353
+ throw error;
3354
+ const reason = error.details.reason;
3355
+ return {
3356
+ item: {},
3357
+ issues: [
3358
+ { code: error.code, reason: typeof reason === "string" ? reason : "sync.failed", source: "crm:embeddings" }
3359
+ ]
3360
+ };
3361
+ }
3362
+ }, "syncEmbeddings");
3363
+
3364
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/cli/profile-store.js
3183
3365
  import { mkdtempSync, rmSync as rmSync2 } from "node:fs";
3184
3366
  import { tmpdir } from "node:os";
3185
3367
  import { join as join3 } from "node:path";
@@ -3228,10 +3410,10 @@ var withProfile = /* @__PURE__ */ __name(async ({ app, profile, open: open2 }, e
3228
3410
  }
3229
3411
  }, "withProfile");
3230
3412
 
3231
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/cli/store.js
3413
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/store.js
3232
3414
  var openCrmStore = openProfileStore;
3233
3415
 
3234
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.127.0_commander@15.0.0_esbuild@0.28.2_typ_d2bed0cfbe6b4358c89d465b9e07afcb/node_modules/@wirecat/cli-core/dist/crm/cli/index.js
3416
+ // node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/crm/cli/index.js
3235
3417
  var MOST4 = 500;
3236
3418
  var STAGE_REF = /^stage:\d+$/;
3237
3419
  var timeField = /* @__PURE__ */ __name((name, example, relation) => nativeField({ name, type: "time", operators: ["term", "range"], example, relation }), "timeField");
@@ -3297,7 +3479,7 @@ var crmSync = strictObject({
3297
3479
  skipped_owner_rejected: count,
3298
3480
  contacts_removed: optional(crmContactsRemoved),
3299
3481
  stage_tasks: count,
3300
- activities: optional(strictObject({ saved: count, out_of_scope: count, state: picklist(["partial", "complete"]) })),
3482
+ activities: optional(strictObject({ saved: count, out_of_scope: count, removed: count, state: picklist(["partial", "complete"]) })),
3301
3483
  synced: array(strictObject({
3302
3484
  kind: picklist(CRM_KINDS),
3303
3485
  round: picklist(["full", "changes"]),
@@ -3323,7 +3505,8 @@ var crmSync = strictObject({
3323
3505
  stopped: optional(picklist(["requests", "deadline", "cancelled"])),
3324
3506
  progress: strictObject({ requests: count, saved: count, steps: count }),
3325
3507
  hint: optional(text),
3326
- group_hint: optional(text)
3508
+ group_hint: optional(text),
3509
+ embeddings: optional(crmSyncEmbeddings)
3327
3510
  });
3328
3511
  var crmSyncProgress = strictObject({
3329
3512
  kind: picklist(CRM_KINDS),
@@ -3402,16 +3585,16 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
3402
3585
  const hasLeads = options.leads !== false;
3403
3586
  const dealsAndLeads = hasLeads ? "deals and leads" : "deals";
3404
3587
  example(answerEntity(annotate(program.command("sync"), { effects: FETCH, offline: false, cooperative: true, partial: true }), "crm_sync", crmSync).description(`bring the CRM's copy in the local store up to date: pipelines, companies, contacts, ${dealsAndLeads} that changed since the last sync, or everything with --rescan; a run stops before its deadline or --max-pages and the next one goes on from there`).addHelpText("after", `
3405
- With the activities setting on, it also copies the activities and tasks on the ${dealsAndLeads} it keeps. Then each ${hasLeads ? "deal or lead" : "deal"} that moved into a stage the stage-tasks setting names opens a local task, once per move.`), "sync", "sync --rescan", "sync --max-pages 20").option("--rescan", "list everything again, every id too, dropping a round in progress").option("--max-pages <pages>", "at most this many requests to the CRM in this run", integer(1e5)).action(async (opts, command) => {
3406
- const { signal } = environmentOf(command);
3588
+ With the activities setting on, it also copies the activities and tasks on the ${dealsAndLeads} it keeps. Then each ${hasLeads ? "deal or lead" : "deal"} that moved into a stage the stage-tasks setting names opens a local task, once per move. With --embed it then indexes the activities' text with a model already downloaded, so search all finds their deals and leads by meaning, not only by words.`), "sync", "sync --rescan", "sync --embed").option("--rescan", "list everything again, every id too, dropping a round in progress").addOption(allowDeletionsOption()).option("--max-pages <pages>", "at most this many requests to the CRM in this run", integer(1e5)).option("--embed", "also index new activities and tasks for search all by meaning, with a model already downloaded").action(async (opts, command) => {
3407
3589
  await within(command, async (run3) => {
3408
3590
  const source = run3.source();
3409
3591
  const started = now();
3410
3592
  const report = await syncRecorded(source, run3.store, run3.account, {
3411
3593
  now: started,
3412
3594
  budget: runBudgetOf(command, opts.maxPages),
3413
- ...signal ? { signal } : {},
3414
- ...opts.rescan ? { rescan: true } : {}
3595
+ signal: environmentOf(command).signal,
3596
+ rescan: opts.rescan,
3597
+ allowDeletions: opts.allowDeletions
3415
3598
  });
3416
3599
  const stageTasks = await openStageTasks(run3.store, run3.account, started, {
3417
3600
  history: source.stageHistory !== void 0
@@ -3420,13 +3603,14 @@ With the activities setting on, it also copies the activities and tasks on the $
3420
3603
  const retried = failed.filter((one) => one.setting === void 0);
3421
3604
  const settings = [...new Set(failed.flatMap((one) => one.setting ?? []))];
3422
3605
  const timeout = command.optsWithGlobals().timeout;
3606
+ const again = { max_pages: opts.maxPages, timeout, embed: opts.embed };
3423
3607
  const stuck = report.state === "partial" && report.progress.steps === 0 && failed.length === 0;
3424
3608
  const next = retried.length || report.state === "partial" && !stuck && failed.length === 0 ? [
3425
3609
  {
3426
3610
  kind: "command",
3427
3611
  step: "crm.sync",
3428
3612
  command: "sync",
3429
- args: Object.fromEntries(Object.entries({ max_pages: opts.maxPages, timeout }).filter(([, value]) => value !== void 0)),
3613
+ args: Object.fromEntries(Object.entries(again).filter(([, value]) => value !== void 0)),
3430
3614
  why: retried.length ? "a kind failed to sync; running sync again retries it" : "the sync stopped before its end to answer in time; running it again goes on from there",
3431
3615
  safe_to_auto_execute: true
3432
3616
  }
@@ -3435,6 +3619,7 @@ With the activities setting on, it also copies the activities and tasks on the $
3435
3619
  const fixes = settings.map((setting) => lineOf(command, `config set ${setting} <value>`));
3436
3620
  const hint = failed.length ? `${failed.map((one) => `${one.kind}: ${one.error}`).join("; ")} \u2014 ${fixes.length ? `fix the setting: ${fixes.join("; ")}` : "run sync again to retry"}` : stuck ? `this run moved nothing on: raise --timeout or --max-pages, then run sync again; see progress: ${progressAt}` : report.state === "partial" ? `run sync again to continue; see progress: ${progressAt}` : void 0;
3437
3621
  const { hint: _hint, ...rest } = report;
3622
+ const embedded = opts.embed ? await syncEmbeddings(command, run3.store, report, options.app, again) : void 0;
3438
3623
  const issues = [
3439
3624
  ...failed.map((one) => ({
3440
3625
  code: one.setting === void 0 ? "provider_error" : "validation_error",
@@ -3445,12 +3630,13 @@ With the activities setting on, it also copies the activities and tasks on the $
3445
3630
  code: "validation_error",
3446
3631
  reason: one.reason,
3447
3632
  source: one.externalId === void 0 ? `crm:${one.kind}` : `crm:${one.kind}/${one.externalId}`
3448
- }))
3633
+ })),
3634
+ ...embedded?.issues ?? []
3449
3635
  ];
3450
3636
  const partial = report.state === "partial" || issues.length > 0;
3451
- return itemOf(snakeKeys({ ...rest, stageTasks, ...hint === void 0 ? {} : { hint } }), {
3637
+ return itemOf(snakeKeys({ ...rest, stageTasks, ...hint === void 0 ? {} : { hint }, ...embedded?.item }), {
3452
3638
  ...partial ? { meta: { complete: false, ...issues.length ? { issues } : {} } } : {},
3453
- ...next ? { next } : {}
3639
+ ...next || embedded?.next ? { next: next ?? embedded?.next } : {}
3454
3640
  });
3455
3641
  });
3456
3642
  });
@@ -3867,9 +4053,9 @@ var userOf = /* @__PURE__ */ __name(async (command, amo) => {
3867
4053
  var openProfile = /* @__PURE__ */ __name(async (command, { readOnly }) => {
3868
4054
  const { env, profile } = contextOf(command);
3869
4055
  const [{ openAmoStore, PROVIDER: PROVIDER3 }, { amoCrmSource: amoCrmSource2 }, { amoCrmWriter }] = await Promise.all([
3870
- import("./store-SNW6U32Y.js"),
3871
- import("./source-Z7GH7T4B.js"),
3872
- import("./writer-BJDQMKUV.js")
4056
+ import("./store-Z3747L5F.js"),
4057
+ import("./source-HWS5SJIV.js"),
4058
+ import("./writer-RBKQ64ZM.js")
3873
4059
  ]);
3874
4060
  const accountOf = /* @__PURE__ */ __name(() => {
3875
4061
  const signIn = storedSignIn(command) ?? signInOf(command);
@@ -3888,7 +4074,7 @@ var openProfile = /* @__PURE__ */ __name(async (command, { readOnly }) => {
3888
4074
  const amo = /* @__PURE__ */ __name(() => transport ??= transportFor(command, signInOf(command)), "amo");
3889
4075
  let source;
3890
4076
  const asked = /* @__PURE__ */ __name(async () => {
3891
- const { crmSettingKey: crmSettingKey2 } = await import("./store-OSOUXBYL.js");
4077
+ const { crmSettingKey: crmSettingKey2 } = await import("./areas-QVHVU57Z.js");
3892
4078
  const scope = await store.crm.scope(account2);
3893
4079
  return {
3894
4080
  mode: scope.mode,