@wirecat/amo-cli 0.4.0 → 0.6.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 (173) hide show
  1. package/CHANGELOG.md +49 -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/oauth.d.ts.map +1 -1
  6. package/dist/amo/oauth.js +3 -4
  7. package/dist/amo/oauth.js.map +1 -1
  8. package/dist/amo/operation.d.ts +1 -1
  9. package/dist/amo/operation.d.ts.map +1 -1
  10. package/dist/amo/transport.d.ts.map +1 -1
  11. package/dist/amo/transport.js +3 -6
  12. package/dist/amo/transport.js.map +1 -1
  13. package/dist/bin/amo.js +2 -2
  14. package/dist/bundle/agent-VVACEKSX.js +42 -0
  15. package/dist/bundle/{all-profiles-PRNXEZRH.js → all-profiles-QNUKL4NA.js} +11 -11
  16. package/dist/bundle/amo.js +28 -28
  17. package/dist/bundle/{anthropic-FDI24DU2.js → anthropic-PQN6MNP7.js} +5 -5
  18. package/dist/bundle/{app-server-WAKJVDLN.js → app-server-Q2QEA7GP.js} +71 -69
  19. package/dist/bundle/areas-27FRPBF3.js +71 -0
  20. package/dist/bundle/{bun-YPXUXMBI.js → bun-F4M4KCNA.js} +2 -2
  21. package/dist/bundle/{bun-sqlite-UBQ5M47X.js → bun-sqlite-P5IDBDVR.js} +6 -6
  22. package/dist/bundle/{chunk-G3LAYJJJ.js → chunk-22KAQPX7.js} +4 -4
  23. package/dist/bundle/{chunk-XEYT2EQT.js → chunk-2JGNMZ55.js} +6 -6
  24. package/dist/bundle/{chunk-PL7TNKAY.js → chunk-2VDHC7QO.js} +2 -2
  25. package/dist/bundle/{chunk-BCIZAUDV.js → chunk-34ZOMVUK.js} +9 -9
  26. package/dist/bundle/{chunk-SHOSFYI7.js → chunk-3J3EDSXF.js} +20 -84
  27. package/dist/bundle/{chunk-ELAKOEIO.js → chunk-3TYER5IK.js} +14 -6
  28. package/dist/bundle/{chunk-NFWD4QX3.js → chunk-5NGLCDYQ.js} +2 -2
  29. package/dist/bundle/{chunk-NKYWQTS2.js → chunk-5SQTHOBI.js} +270 -252
  30. package/dist/bundle/{chunk-Z2B3VNRI.js → chunk-6GE36KUE.js} +11 -11
  31. package/dist/bundle/{chunk-GQKEMBM6.js → chunk-6GZKY3HV.js} +121 -36
  32. package/dist/bundle/{chunk-M54YKD3I.js → chunk-6OV2TRGF.js} +7 -7
  33. package/dist/bundle/{chunk-MW7HUD6R.js → chunk-7CPIZFOE.js} +9 -9
  34. package/dist/bundle/{chunk-TIR3AB35.js → chunk-A5K2NU3K.js} +913 -795
  35. package/dist/bundle/{chunk-5HZMXHRH.js → chunk-AEC4H5WZ.js} +6 -6
  36. package/dist/bundle/{chunk-WAFB3IWJ.js → chunk-APBEDWOE.js} +5 -5
  37. package/dist/bundle/{chunk-V5SETIQK.js → chunk-AQ5RIOUE.js} +1 -1
  38. package/dist/bundle/{chunk-RQPB2BSH.js → chunk-B7L5MSRP.js} +2 -2
  39. package/dist/bundle/{chunk-HZZ56JO7.js → chunk-C7JPYWYQ.js} +1 -1
  40. package/dist/bundle/{chunk-KRD375P7.js → chunk-DIZEHPS6.js} +39 -30
  41. package/dist/bundle/{chunk-TCSVW7BA.js → chunk-DNCLQPOM.js} +1 -1
  42. package/dist/bundle/{chunk-WASBOYI2.js → chunk-DPV53EZC.js} +4 -4
  43. package/dist/bundle/{chunk-HDZNSOV5.js → chunk-DUPCDJ3W.js} +14 -10
  44. package/dist/bundle/{chunk-YHVHDRED.js → chunk-DWT24UVR.js} +6 -6
  45. package/dist/bundle/chunk-DXWJORSY.js +1703 -0
  46. package/dist/bundle/{chunk-E3EWS6DF.js → chunk-DY3PLWIH.js} +6 -6
  47. package/dist/bundle/{chunk-A4W7J6VN.js → chunk-DYWHAJRK.js} +37 -190
  48. package/dist/bundle/{chunk-LAR2DLTI.js → chunk-EXRM3ML4.js} +4 -4
  49. package/dist/bundle/{chunk-ZJC2XJQC.js → chunk-FFER7KJI.js} +13 -13
  50. package/dist/bundle/{chunk-V2QWX6B3.js → chunk-FIP2DG7W.js} +3 -3
  51. package/dist/bundle/{chunk-5II6TAJE.js → chunk-FTH6WGYO.js} +1 -1
  52. package/dist/bundle/{chunk-2AIG2SSJ.js → chunk-FWRLGIF6.js} +1668 -169
  53. package/dist/bundle/{chunk-DWD3KDJA.js → chunk-FYOPPKAN.js} +1 -1
  54. package/dist/bundle/{chunk-ABMPZL2P.js → chunk-G3N2RHGF.js} +19 -15
  55. package/dist/bundle/{chunk-GBQ76X6T.js → chunk-G46PNDWL.js} +2 -2
  56. package/dist/bundle/{chunk-VG26HDKH.js → chunk-G6NY7LFB.js} +4 -4
  57. package/dist/bundle/{chunk-5SJEJYQZ.js → chunk-GOCMJBEE.js} +3 -3
  58. package/dist/bundle/{chunk-3K6T2G52.js → chunk-GRGCZSES.js} +6 -6
  59. package/dist/bundle/{chunk-4PQECIU2.js → chunk-GVSKLZRD.js} +2 -2
  60. package/dist/bundle/{chunk-UEN5NWNW.js → chunk-GZ7WBU5Y.js} +1 -1
  61. package/dist/bundle/{chunk-KQZTX4LM.js → chunk-HN2LCLGT.js} +19 -19
  62. package/dist/bundle/{chunk-SFZVMKB6.js → chunk-HO4JGD4Q.js} +1 -1
  63. package/dist/bundle/{chunk-SZX7EPPY.js → chunk-HOF7GQWW.js} +4 -4
  64. package/dist/bundle/chunk-HUAHLO6N.js +29 -0
  65. package/dist/bundle/chunk-IDCZ4LWS.js +150 -0
  66. package/dist/bundle/{chunk-23AQD7JU.js → chunk-IN3VL7UU.js} +18 -17
  67. package/dist/bundle/{chunk-QGFURWEP.js → chunk-ISQ23VKV.js} +8 -1
  68. package/dist/bundle/{chunk-PLU2IQXC.js → chunk-JVBCQHCS.js} +3 -3
  69. package/dist/bundle/{chunk-VEFAYLKX.js → chunk-K5W7YEHB.js} +187 -114
  70. package/dist/bundle/{chunk-PIOR6PIO.js → chunk-KAFSS35C.js} +2 -2
  71. package/dist/bundle/{chunk-VG2ERHFJ.js → chunk-KLRCTMES.js} +3 -3
  72. package/dist/bundle/{chunk-KORZEYZN.js → chunk-KYRYD4CR.js} +1 -1
  73. package/dist/bundle/{chunk-FEUNZG7U.js → chunk-LBZSURLL.js} +38 -38
  74. package/dist/bundle/{chunk-EAX5RO7S.js → chunk-LC7ZD2RW.js} +1 -1
  75. package/dist/bundle/{chunk-O3WE5IGP.js → chunk-LH6FJYMO.js} +6 -6
  76. package/dist/bundle/{chunk-DWA5TZMP.js → chunk-LJKINNWC.js} +8 -8
  77. package/dist/bundle/{chunk-U46RNOEQ.js → chunk-M36XP74N.js} +3 -3
  78. package/dist/bundle/chunk-MNPGZCKE.js +361 -0
  79. package/dist/bundle/{chunk-WR2FPZTE.js → chunk-MRPMORLH.js} +8 -8
  80. package/dist/bundle/{chunk-CEBX63XY.js → chunk-NNREILWP.js} +8 -8
  81. package/dist/bundle/chunk-NSOY4FMN.js +159 -0
  82. package/dist/bundle/{chunk-SNBYFQHT.js → chunk-OEEWVKJX.js} +1 -1
  83. package/dist/bundle/{chunk-YREKMP24.js → chunk-OGJFDKDL.js} +4 -4
  84. package/dist/bundle/chunk-PATZAYFZ.js +453 -0
  85. package/dist/bundle/chunk-PCR6GFNP.js +1171 -0
  86. package/dist/bundle/{chunk-3PCVQCCV.js → chunk-Q4MH2O5E.js} +2 -2
  87. package/dist/bundle/{chunk-7OVTUADG.js → chunk-QFOP3KUP.js} +8 -8
  88. package/dist/bundle/{chunk-YFRTEJ6V.js → chunk-QQRJEWKB.js} +7 -7
  89. package/dist/bundle/{chunk-GJBOZAUD.js → chunk-RNWUCAJJ.js} +3 -3
  90. package/dist/bundle/{chunk-AP3CWDRK.js → chunk-S6JG4YUH.js} +2 -2
  91. package/dist/bundle/{chunk-KBAOJISR.js → chunk-SDVUGWD7.js} +7 -7
  92. package/dist/bundle/{chunk-WEWJA42Q.js → chunk-SEFE6PGL.js} +12 -12
  93. package/dist/bundle/{chunk-6PILR4AX.js → chunk-SWCJM3YD.js} +2 -2
  94. package/dist/bundle/{chunk-TEGQVVCZ.js → chunk-SYRDEMQE.js} +16709 -13048
  95. package/dist/bundle/{chunk-NXNUCGGO.js → chunk-SYYQZDHJ.js} +6 -6
  96. package/dist/bundle/{chunk-SMM7GS4Q.js → chunk-T3W4V4A6.js} +1 -1
  97. package/dist/bundle/{chunk-EBNCUQLV.js → chunk-TCT5D2X2.js} +1 -1
  98. package/dist/bundle/{chunk-ASU63X5C.js → chunk-TES7MB6I.js} +2 -2
  99. package/dist/bundle/{chunk-745FMNI5.js → chunk-TXDR6YSF.js} +1 -1
  100. package/dist/bundle/{chunk-3WG4MTQI.js → chunk-TY7NDMFY.js} +1 -1
  101. package/dist/bundle/{chunk-AN6IJYH3.js → chunk-U6XPWCWM.js} +5 -5
  102. package/dist/bundle/{chunk-LZ4IWN43.js → chunk-UFKC7TIX.js} +1617 -1990
  103. package/dist/bundle/{chunk-IPNIF5JE.js → chunk-UNWF3TH5.js} +4 -4
  104. package/dist/bundle/{chunk-6QMSKJB4.js → chunk-W3BOR6AT.js} +8 -8
  105. package/dist/bundle/{chunk-SCMB4LI6.js → chunk-WIHN3ELW.js} +19 -19
  106. package/dist/bundle/{chunk-UCM7C773.js → chunk-X76RS6JO.js} +178 -61
  107. package/dist/bundle/{chunk-GMHRPX5M.js → chunk-YF3S26TS.js} +61 -61
  108. package/dist/bundle/{chunk-ZKRWNL4T.js → chunk-ZCQ4H7CA.js} +2 -2
  109. package/dist/bundle/{chunk-CYHIM5SL.js → chunk-ZOZV32IR.js} +3 -3
  110. package/dist/bundle/{chunk-OYMHPQF7.js → chunk-ZTKHXDEU.js} +4 -4
  111. package/dist/bundle/{cli-QDPKC2HJ.js → cli-EAD3WZLR.js} +119 -105
  112. package/dist/bundle/command-contract-SMEJ2ICG.js +40 -0
  113. package/dist/bundle/{command-server-entry-TX7WNN7G.js → command-server-entry-YTZP6I4T.js} +29 -28
  114. package/dist/bundle/{decode-BLPC7OYE.js → decode-57BE5OBT.js} +5 -5
  115. package/dist/bundle/{dispatch-5JUT55CS.js → dispatch-56FECRCU.js} +8 -8
  116. package/dist/bundle/{echarts-54D3FOCL.js → echarts-QMAA7HH5.js} +2 -2
  117. package/dist/bundle/{embed-O7KMDYM7.js → embed-NFGFYUO4.js} +6 -6
  118. package/dist/bundle/{embedder-4PE67CLX.js → embedder-SRBOJMXX.js} +9 -9
  119. package/dist/bundle/{failure-NNQYTB3Z.js → failure-WDSX6H3B.js} +2 -2
  120. package/dist/bundle/{first-run-EAU5SHBI.js → first-run-HWRUL2GR.js} +12 -12
  121. package/dist/bundle/first-screen-ATN4D3FQ.js +41 -0
  122. package/dist/bundle/{instructions-ONXP5DZQ.js → instructions-4H7UREH2.js} +1 -1
  123. package/dist/bundle/{mcp-ZNULRPZ4.js → mcp-5HFPWC3W.js} +2 -2
  124. package/dist/bundle/meeting-combined-BGDEHCWY.js +26 -0
  125. package/dist/bundle/{meeting-model-FWIZRKVN.js → meeting-model-WWGVRXPL.js} +11 -11
  126. package/dist/bundle/{meeting-semantic-M4YVJ57W.js → meeting-semantic-ZQ47BL2Z.js} +6 -6
  127. package/dist/bundle/{node-UTQCYQF5.js → node-P3PUHKYH.js} +2 -2
  128. package/dist/bundle/{node-sqlite-APJG6MGL.js → node-sqlite-JOTSNH3P.js} +7 -7
  129. package/dist/bundle/{oauth-TY7RMIBL.js → oauth-XPSAL6VO.js} +7 -7
  130. package/dist/bundle/{open-WDVEQL75.js → open-PO52FVA5.js} +5 -5
  131. package/dist/bundle/{openai-H5UJHSEZ.js → openai-WITYLMY5.js} +15 -15
  132. package/dist/bundle/{process-MGMXXPMY.js → process-AFIXYXWL.js} +1 -1
  133. package/dist/bundle/{program-IF36C6VR.js → program-JODTZNBZ.js} +331 -196
  134. package/dist/bundle/{prompt-4RLIWLMF.js → prompt-XORLAXHY.js} +5 -5
  135. package/dist/bundle/{recognize-UIRTMWM4.js → recognize-JKMZHDYS.js} +4 -4
  136. package/dist/bundle/{remote-L3MNWZQK.js → remote-3IMEJTEH.js} +9 -9
  137. package/dist/bundle/{rerank-F4KZQTY6.js → rerank-3F2E6NNN.js} +7 -7
  138. package/dist/bundle/{serve-37AUYTWS.js → serve-6BWU3NMB.js} +9 -9
  139. package/dist/bundle/{server-UBG676ZJ.js → server-GPSB5WFG.js} +63 -61
  140. package/dist/bundle/server-HMCC64ZU.js +88 -0
  141. package/dist/bundle/source-E72OS27D.js +47 -0
  142. package/dist/bundle/{sqlite-runtime-CI3RW7VA.js → sqlite-runtime-YHYQDUXE.js} +6 -6
  143. package/dist/bundle/{state-JOHLSLUO.js → state-R7W4U6T4.js} +6 -6
  144. package/dist/bundle/{store-OSOUXBYL.js → store-HTVRL7FB.js} +56 -43
  145. package/dist/bundle/store-IWW6U6QN.js +34 -0
  146. package/dist/bundle/{store-2MBG4IUS.js → store-TBZ3ZS6H.js} +25 -23
  147. package/dist/bundle/store-maintenance-command-CJM2VLMW.js +75 -0
  148. package/dist/bundle/surface-5GBWNYBE.js +74 -0
  149. package/dist/bundle/writer-TW2Q55VJ.js +49 -0
  150. package/dist/commands/crm-shared.js +1 -1
  151. package/dist/commands/crm-shared.js.map +1 -1
  152. package/dist/commands/session.d.ts.map +1 -1
  153. package/dist/commands/session.js +1 -6
  154. package/dist/commands/session.js.map +1 -1
  155. package/dist/version.d.ts +1 -1
  156. package/dist/version.js +1 -1
  157. package/package.json +4 -4
  158. package/skills/amo-cli/SKILL.md +6 -0
  159. package/dist/bundle/agent-43BMVBX2.js +0 -40
  160. package/dist/bundle/chunk-2UJ7ZZZC.js +0 -79
  161. package/dist/bundle/chunk-FQRP6JWX.js +0 -29
  162. package/dist/bundle/chunk-IBEHYGG6.js +0 -721
  163. package/dist/bundle/chunk-M33XHJTM.js +0 -1266
  164. package/dist/bundle/chunk-S6DTLAOB.js +0 -761
  165. package/dist/bundle/command-contract-KWNCP3MQ.js +0 -39
  166. package/dist/bundle/first-screen-APSNGZYZ.js +0 -39
  167. package/dist/bundle/meeting-combined-W2XIYXFU.js +0 -24
  168. package/dist/bundle/server-CRF4QSZR.js +0 -86
  169. package/dist/bundle/source-Z7GH7T4B.js +0 -44
  170. package/dist/bundle/store-SNW6U32Y.js +0 -34
  171. package/dist/bundle/store-maintenance-command-W7V54SLT.js +0 -73
  172. package/dist/bundle/surface-ESJS2FUI.js +0 -72
  173. 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-SWCJM3YD.js";
6
6
  import {
7
7
  ProfileTokenStore,
8
8
  REPORT_FORMAT,
@@ -21,9 +21,8 @@ import {
21
21
  honoursDryRun,
22
22
  oauthAccount,
23
23
  openBrowser,
24
+ openProfileStore,
24
25
  ownerLanguageOf,
25
- providerEvent,
26
- providerRequest,
27
26
  run,
28
27
  runsCommand,
29
28
  scheduleCommandFor,
@@ -31,64 +30,64 @@ import {
31
30
  setupCommand,
32
31
  signInSteps,
33
32
  skillCommand,
33
+ storageOf,
34
34
  tokenKeeper,
35
35
  upgradeCommand,
36
36
  writeCsv
37
- } from "./chunk-LZ4IWN43.js";
38
- import "./chunk-5II6TAJE.js";
37
+ } from "./chunk-UFKC7TIX.js";
38
+ import "./chunk-FTH6WGYO.js";
39
39
  import {
40
40
  OPERATIONS,
41
41
  amoCrmSource,
42
42
  matchOperation,
43
43
  pathOf,
44
44
  withEveryId
45
- } from "./chunk-5SJEJYQZ.js";
45
+ } from "./chunk-GOCMJBEE.js";
46
46
  import {
47
47
  AMO_WRITES
48
- } from "./chunk-GJBOZAUD.js";
48
+ } from "./chunk-RNWUCAJJ.js";
49
49
  import {
50
50
  ENTITIES,
51
51
  ROUTES
52
- } from "./chunk-DWD3KDJA.js";
53
- import "./chunk-HZZ56JO7.js";
52
+ } from "./chunk-FYOPPKAN.js";
53
+ import "./chunk-C7JPYWYQ.js";
54
54
  import {
55
55
  SOURCE_SEARCHED,
56
56
  allAnswer,
57
57
  historySkipsOf,
58
58
  offsetOf,
59
59
  refuseOffline
60
- } from "./chunk-KRD375P7.js";
61
- import "./chunk-YHVHDRED.js";
62
- import "./chunk-CEBX63XY.js";
63
- import "./chunk-UEN5NWNW.js";
64
- import {
65
- addStoreMaintenanceCommands
66
- } from "./chunk-VEFAYLKX.js";
60
+ } from "./chunk-DIZEHPS6.js";
61
+ import "./chunk-DWT24UVR.js";
62
+ import "./chunk-NNREILWP.js";
63
+ import "./chunk-GZ7WBU5Y.js";
67
64
  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";
65
+ addStoreMaintenanceCommands,
66
+ notLocalPaths
67
+ } from "./chunk-K5W7YEHB.js";
68
+ import "./chunk-DYWHAJRK.js";
69
+ import "./chunk-MRPMORLH.js";
70
+ import "./chunk-DUPCDJ3W.js";
71
+ import "./chunk-SEFE6PGL.js";
72
+ import "./chunk-5NGLCDYQ.js";
73
+ import "./chunk-ZTKHXDEU.js";
74
+ import "./chunk-2JGNMZ55.js";
75
+ import "./chunk-LJKINNWC.js";
79
76
  import {
80
77
  crmAccounts,
78
+ embedCrmActivities,
81
79
  extractText,
82
80
  importEngine,
83
81
  meaningLane,
84
82
  personMeetings,
85
83
  readableAccounts,
86
84
  searchAll,
87
- taskAccount
88
- } from "./chunk-TIR3AB35.js";
85
+ taskAccount,
86
+ timeLimit
87
+ } from "./chunk-A5K2NU3K.js";
89
88
  import {
90
89
  safeName
91
- } from "./chunk-ZJC2XJQC.js";
90
+ } from "./chunk-FFER7KJI.js";
92
91
  import {
93
92
  CRM_ASSIGN_OTHERS_KEY,
94
93
  CRM_SHARED_FOLDERS,
@@ -100,7 +99,11 @@ import {
100
99
  SYNC_FAILED,
101
100
  apiJson,
102
101
  closeCrmItem,
102
+ commandPathKey,
103
+ commandPermissions,
104
+ completeCrmActivity,
103
105
  conditionsOf,
106
+ createCrmActivity,
104
107
  createCrmItem,
105
108
  createCrmRecord,
106
109
  crmAlsoChecks,
@@ -122,11 +125,14 @@ import {
122
125
  parseCrmFileId,
123
126
  pipelineOf,
124
127
  providerCall,
128
+ providerEvent,
129
+ providerRequest,
125
130
  refuseForeignClientReads,
126
131
  removeCrmItem,
127
132
  selectedCodes,
128
133
  shortened,
129
134
  syncRecorded,
135
+ terminalAsker,
130
136
  updateCrmItem,
131
137
  updateCrmRecord,
132
138
  values_exports,
@@ -135,15 +141,15 @@ import {
135
141
  withCustomFields,
136
142
  withReadableDeal,
137
143
  withoutFileLinks
138
- } from "./chunk-2AIG2SSJ.js";
139
- import "./chunk-QGFURWEP.js";
144
+ } from "./chunk-FWRLGIF6.js";
145
+ import "./chunk-ISQ23VKV.js";
140
146
  import {
141
147
  latestVersion,
142
148
  runUpdate,
143
149
  updateNotice
144
- } from "./chunk-SZX7EPPY.js";
145
- import "./chunk-3WG4MTQI.js";
146
- import "./chunk-4PQECIU2.js";
150
+ } from "./chunk-HOF7GQWW.js";
151
+ import "./chunk-TY7NDMFY.js";
152
+ import "./chunk-GVSKLZRD.js";
147
153
  import {
148
154
  commandPath,
149
155
  dateWindow,
@@ -158,14 +164,15 @@ import {
158
164
  unfilteredQuery,
159
165
  withQuery,
160
166
  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";
167
+ } from "./chunk-G3N2RHGF.js";
168
+ import "./chunk-HUAHLO6N.js";
169
+ import "./chunk-EXRM3ML4.js";
170
+ import "./chunk-AEC4H5WZ.js";
171
+ import "./chunk-6GE36KUE.js";
172
+ import "./chunk-ZOZV32IR.js";
173
+ import "./chunk-OGJFDKDL.js";
174
+ import "./chunk-M36XP74N.js";
175
+ import "./chunk-U6XPWCWM.js";
169
176
  import {
170
177
  Argument,
171
178
  Command,
@@ -177,6 +184,7 @@ import {
177
184
  Option,
178
185
  REMOTE_READ,
179
186
  REMOTE_WRITE,
187
+ allowDeletionsOption,
180
188
  annotate,
181
189
  annotateOption,
182
190
  answerEntity,
@@ -212,13 +220,13 @@ import {
212
220
  sharedCommand,
213
221
  snakeKeys,
214
222
  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";
223
+ } from "./chunk-5SQTHOBI.js";
224
+ import "./chunk-6OV2TRGF.js";
225
+ import "./chunk-22KAQPX7.js";
226
+ import "./chunk-LH6FJYMO.js";
227
+ import "./chunk-T3W4V4A6.js";
228
+ import "./chunk-HN2LCLGT.js";
229
+ import "./chunk-FIP2DG7W.js";
222
230
  import {
223
231
  CRM_CHANGES,
224
232
  CRM_SCOPES,
@@ -226,54 +234,58 @@ import {
226
234
  attachmentMaxBytes,
227
235
  crmIdentityId,
228
236
  crmSettingKey,
237
+ readWhole,
229
238
  seenBy,
230
239
  viewerSql
231
- } from "./chunk-TEGQVVCZ.js";
232
- import "./chunk-6QMSKJB4.js";
240
+ } from "./chunk-SYRDEMQE.js";
233
241
  import {
242
+ aheadOf,
234
243
  dayIn
235
- } from "./chunk-PLU2IQXC.js";
236
- import "./chunk-IBEHYGG6.js";
244
+ } from "./chunk-JVBCQHCS.js";
245
+ import "./chunk-DXWJORSY.js";
246
+ import "./chunk-W3BOR6AT.js";
237
247
  import {
238
248
  count,
239
- createTaskService,
240
249
  currentAttempt,
241
250
  text,
242
251
  time
243
- } from "./chunk-M33XHJTM.js";
244
- import "./chunk-ELAKOEIO.js";
245
- import "./chunk-BCIZAUDV.js";
252
+ } from "./chunk-PCR6GFNP.js";
253
+ import "./chunk-3TYER5IK.js";
254
+ import {
255
+ createTaskService
256
+ } from "./chunk-IDCZ4LWS.js";
257
+ import "./chunk-34ZOMVUK.js";
246
258
  import {
247
259
  hostFetch,
248
260
  providerWaitMs,
249
261
  readJsonResponse,
250
262
  retryableStatus,
251
263
  statusToCode
252
- } from "./chunk-E3EWS6DF.js";
253
- import "./chunk-3K6T2G52.js";
254
- import "./chunk-IPNIF5JE.js";
264
+ } from "./chunk-DY3PLWIH.js";
265
+ import "./chunk-GRGCZSES.js";
266
+ import "./chunk-UNWF3TH5.js";
255
267
  import {
256
268
  IDENTITY,
257
269
  PACKAGE,
258
270
  SKILL
259
- } from "./chunk-WAFB3IWJ.js";
260
- import "./chunk-RQPB2BSH.js";
261
- import "./chunk-PIOR6PIO.js";
271
+ } from "./chunk-APBEDWOE.js";
272
+ import "./chunk-B7L5MSRP.js";
273
+ import "./chunk-KAFSS35C.js";
262
274
  import "./chunk-EH6ZEJGT.js";
263
- import "./chunk-UCM7C773.js";
264
- import "./chunk-MW7HUD6R.js";
275
+ import "./chunk-X76RS6JO.js";
276
+ import "./chunk-7CPIZFOE.js";
265
277
  import {
266
278
  installerOf
267
- } from "./chunk-745FMNI5.js";
279
+ } from "./chunk-TXDR6YSF.js";
268
280
  import {
269
281
  fieldsOf,
270
282
  levelFor
271
- } from "./chunk-KBAOJISR.js";
283
+ } from "./chunk-SDVUGWD7.js";
272
284
  import {
273
285
  foldName
274
- } from "./chunk-SHOSFYI7.js";
275
- import "./chunk-2UJ7ZZZC.js";
276
- import "./chunk-SFZVMKB6.js";
286
+ } from "./chunk-3J3EDSXF.js";
287
+ import "./chunk-NSOY4FMN.js";
288
+ import "./chunk-HO4JGD4Q.js";
277
289
  import {
278
290
  CRM_ACTIVITY_KINDS,
279
291
  CRM_KINDS,
@@ -284,26 +296,26 @@ import {
284
296
  normalCrmUserId,
285
297
  parseDecimal,
286
298
  scaleOf
287
- } from "./chunk-S6DTLAOB.js";
288
- import "./chunk-EAX5RO7S.js";
289
- import "./chunk-FQRP6JWX.js";
299
+ } from "./chunk-MNPGZCKE.js";
300
+ import "./chunk-LC7ZD2RW.js";
301
+ import "./chunk-PATZAYFZ.js";
290
302
  import {
291
303
  SAVE_HELP,
292
304
  defineQuery,
293
305
  queryFieldsOf,
294
306
  timezoneOf,
295
307
  zonedMoment
296
- } from "./chunk-GMHRPX5M.js";
297
- import "./chunk-TCSVW7BA.js";
298
- import "./chunk-YFRTEJ6V.js";
308
+ } from "./chunk-YF3S26TS.js";
309
+ import "./chunk-DNCLQPOM.js";
310
+ import "./chunk-QQRJEWKB.js";
299
311
  import "./chunk-D72URWJE.js";
300
312
  import {
301
313
  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";
314
+ } from "./chunk-KLRCTMES.js";
315
+ import "./chunk-TES7MB6I.js";
316
+ import "./chunk-ZCQ4H7CA.js";
317
+ import "./chunk-SYYQZDHJ.js";
318
+ import "./chunk-KYRYD4CR.js";
307
319
  import {
308
320
  Credentials,
309
321
  isMovedRun,
@@ -312,7 +324,7 @@ import {
312
324
  renderPretty,
313
325
  resolvePaths,
314
326
  systemKeyring
315
- } from "./chunk-SCMB4LI6.js";
327
+ } from "./chunk-WIHN3ELW.js";
316
328
  import {
317
329
  array,
318
330
  boolean,
@@ -321,6 +333,7 @@ import {
321
333
  literal,
322
334
  nullable,
323
335
  number,
336
+ omit,
324
337
  optional,
325
338
  picklist,
326
339
  pipe,
@@ -331,22 +344,22 @@ import {
331
344
  union,
332
345
  unknown,
333
346
  variant
334
- } from "./chunk-7OVTUADG.js";
347
+ } from "./chunk-QFOP3KUP.js";
335
348
  import "./chunk-Y5E2WNWB.js";
336
349
  import {
337
350
  CliError,
338
351
  isCliError
339
- } from "./chunk-AP3CWDRK.js";
340
- import "./chunk-EBNCUQLV.js";
352
+ } from "./chunk-S6JG4YUH.js";
353
+ import "./chunk-TCT5D2X2.js";
341
354
  import {
342
355
  __name
343
356
  } from "./chunk-ZVVMGPBJ.js";
344
357
 
345
358
  // dist/program.js
346
- import { join as join4 } from "node:path";
359
+ import { join as join3 } from "node:path";
347
360
  import { fileURLToPath as fileURLToPath2 } from "node:url";
348
361
 
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
362
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/update/index.js
350
363
  import { realpathSync } from "node:fs";
351
364
  import { fileURLToPath } from "node:url";
352
365
  var npmRegistry = /* @__PURE__ */ __name(() => hostFetch({ hosts: ["registry.npmjs.org"] }), "npmRegistry");
@@ -514,9 +527,7 @@ var exchange = /* @__PURE__ */ __name(async (origin, redirectUri, params, contex
514
527
  ...refresh ? { refresh_token: params.refresh_token ?? "" } : { code: params.code ?? "" },
515
528
  redirect_uri: redirectUri
516
529
  };
517
- const deadline = new AbortController();
518
- const timer = setTimeout(() => deadline.abort(), REQUEST_MS);
519
- timer.unref();
530
+ const deadline = timeLimit(REQUEST_MS);
520
531
  const signal = context.signal ? AbortSignal.any([context.signal, deadline.signal]) : deadline.signal;
521
532
  try {
522
533
  let response;
@@ -552,7 +563,7 @@ var exchange = /* @__PURE__ */ __name(async (origin, redirectUri, params, contex
552
563
  ...typeof tokenType === "string" ? { tokenType } : {}
553
564
  };
554
565
  } finally {
555
- clearTimeout(timer);
566
+ deadline.clear();
556
567
  }
557
568
  }, "exchange");
558
569
  var appProvider = /* @__PURE__ */ __name((origin, client, redirectUri = RELAY_URL) => ({
@@ -984,9 +995,7 @@ var AmoTransport = class {
984
995
  }
985
996
  async #once(route, request, write2, attempt) {
986
997
  const { operation } = route;
987
- const deadline = new AbortController();
988
- const timer = setTimeout(() => deadline.abort(new DOMException(`${operation.name} timed out`, "TimeoutError")), this.#timeoutMs);
989
- timer.unref();
998
+ const deadline = timeLimit(this.#timeoutMs);
990
999
  const end = providerRequest(operation.name, this.#events ?? providerEvent, {
991
1000
  method: operation.method,
992
1001
  endpointTemplate: operation.template,
@@ -1006,7 +1015,7 @@ var AmoTransport = class {
1006
1015
  end({ status: response.status });
1007
1016
  return { status: response.status, body };
1008
1017
  } finally {
1009
- clearTimeout(timer);
1018
+ deadline.clear();
1010
1019
  }
1011
1020
  }
1012
1021
  async #send(route, request, write2, signal, end) {
@@ -1406,7 +1415,7 @@ var callCommand = /* @__PURE__ */ __name(() => annotate(new Command("call"), {
1406
1415
  }), "callCommand");
1407
1416
  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
1417
 
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
1418
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/stage-tasks.js
1410
1419
  var DAY = 864e5;
1411
1420
  var openStageTasks = /* @__PURE__ */ __name(async (store, account2, now, { history = false } = {}) => {
1412
1421
  const rules = await store.crm.stageTasks(account2);
@@ -1443,7 +1452,7 @@ var openStageTasks = /* @__PURE__ */ __name(async (store, account2, now, { histo
1443
1452
  return opened;
1444
1453
  }, "openStageTasks");
1445
1454
 
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
1455
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/account.js
1447
1456
  import { join } from "node:path";
1448
1457
  var SHARED = new Set(Object.values(CRM_SHARED_FOLDERS));
1449
1458
  var isShared = /* @__PURE__ */ __name((profile) => SHARED.has(profile.toLowerCase()), "isShared");
@@ -1549,7 +1558,7 @@ var crmAccountCommand = /* @__PURE__ */ __name((app, options) => annotate(new Co
1549
1558
  ...options.resolveSettings ? { resolveSettings: options.resolveSettings } : {}
1550
1559
  }), { effects: LOCAL_WRITE }).hook("preAction", (_, action) => refuseSharedDelete(app, options, action))), "crmAccountCommand");
1551
1560
 
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
1561
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/digest.js
1553
1562
  var HOUR = 36e5;
1554
1563
  var SHOWN = 7;
1555
1564
  var STALE_HOURS = 24;
@@ -1693,7 +1702,7 @@ var healthOf = /* @__PURE__ */ __name(async (store, account2, { now, profile })
1693
1702
  return stale > STALE_HOURS ? [{ ...named, stale_hours: Math.floor(stale) }] : [];
1694
1703
  }, "healthOf");
1695
1704
 
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
1705
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/csv.js
1697
1706
  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
1707
  var DEAL_CSV_COLUMNS = [
1699
1708
  "ref",
@@ -1815,7 +1824,7 @@ var renderCsv = /* @__PURE__ */ __name((command, open2, read, defaults = DEAL_CS
1815
1824
  });
1816
1825
  }, "renderCsv");
1817
1826
 
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
1827
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/records.js
1819
1828
  var time2 = nullable(isoTime);
1820
1829
  var metadata = optional(record(string(), strictObject({
1821
1830
  label: nullable(string()),
@@ -2036,7 +2045,7 @@ var addCrmRecordCommands = /* @__PURE__ */ __name((program, options) => {
2036
2045
  });
2037
2046
  });
2038
2047
  });
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) => {
2048
+ 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
2049
  await within(command, async (run3) => {
2041
2050
  const found = await recordNamed(run3, noun, given);
2042
2051
  await quotaOf2(run3).spend(noun.kind, found);
@@ -2060,8 +2069,22 @@ var byIdOrNone = /* @__PURE__ */ __name(async (run3, noun, id) => {
2060
2069
  throw error;
2061
2070
  }
2062
2071
  }, "byIdOrNone");
2072
+ var storedRecord = /* @__PURE__ */ __name(async (run3, noun, ref) => {
2073
+ const ids = await run3.store.crm.externalIdsOf(run3.account, ref);
2074
+ if (ids.length > 1)
2075
+ throw new CliError("validation_error", `${ref} is ${ids.length} records of the CRM; name one by its id`, {
2076
+ reason: "crm.record-ambiguous",
2077
+ candidates: ids.map((id) => ({ id }))
2078
+ });
2079
+ const found = ids[0] ? await sourceWith(run3, "get", noun.what).get(noun.kind, ids[0]) : null;
2080
+ if (!found)
2081
+ throw new CliError("not_found", `the copy holds no CRM ${noun.kind} as ${ref}, or this sign-in cannot see it`);
2082
+ return found;
2083
+ }, "storedRecord");
2063
2084
  var recordNamed = /* @__PURE__ */ __name(async (run3, noun, given) => {
2064
2085
  const id = given.trim();
2086
+ if (id.startsWith(`${noun.kind}:`) && /^\w+:\d+$/.test(id))
2087
+ return storedRecord(run3, noun, id);
2065
2088
  const byId = RECORD_ID.test(id) ? await byIdOrNone(run3, noun, id) : null;
2066
2089
  if (byId)
2067
2090
  return byId;
@@ -2139,16 +2162,28 @@ var addRecordWrites = /* @__PURE__ */ __name((group, noun, { within, example, wr
2139
2162
  if (!writes?.kinds.includes(noun.kind))
2140
2163
  return;
2141
2164
  const person = noun.kind === "person";
2165
+ const written = writes.fields?.[noun.kind];
2166
+ const takes = /* @__PURE__ */ __name((field) => !written || written.includes(field), "takes");
2142
2167
  const fields = /* @__PURE__ */ __name((command2) => {
2143
2168
  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");
2169
+ if (person) {
2170
+ command2.option("--first-name <name>", "the first name; empty clears it").option("--last-name <name>", "the last name; empty clears it");
2171
+ if (takes("position"))
2172
+ command2.option("--position <title>", "the job title; empty clears it");
2173
+ }
2146
2174
  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
- }, []);
2175
+ if (takes("emails"))
2176
+ 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);
2177
+ if (takes("phones"))
2178
+ 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);
2179
+ if (takes("owner"))
2180
+ command2.option("--owner <user>", "the CRM user it is assigned to; anyone but the sign-in's own user checks crm.assign-others");
2181
+ if (takes("custom"))
2182
+ 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 = []) => {
2183
+ if (value.indexOf("=") < 1)
2184
+ throw new CliError("validation_error", "--field takes <key>=<value>");
2185
+ return [...previous, value];
2186
+ }, []);
2152
2187
  if (writes.idempotent)
2153
2188
  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
2189
  return command2;
@@ -2196,7 +2231,7 @@ var addRecordWrites = /* @__PURE__ */ __name((group, noun, { within, example, wr
2196
2231
  }, "addRecordWrites");
2197
2232
  var idOf = /* @__PURE__ */ __name((opts) => opts.operationId === void 0 ? {} : { operationId: opts.operationId }, "idOf");
2198
2233
 
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
2234
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/activities.js
2200
2235
  var MOST2 = 500;
2201
2236
  var nullableText = nullable(text);
2202
2237
  var REFS = ["deal", "lead", "person", "organization"];
@@ -2240,7 +2275,7 @@ var crmActivity = strictObject({
2240
2275
  });
2241
2276
  var UNTRUSTED2 = ["subject", "body", "on.title"];
2242
2277
  var iso3 = /* @__PURE__ */ __name((at2) => at2 === null ? null : new Date(at2).toISOString(), "iso");
2243
- var itemOf2 = /* @__PURE__ */ __name((one) => ({
2278
+ var listedOf = /* @__PURE__ */ __name((one) => ({
2244
2279
  external_id: one.externalId,
2245
2280
  kind: one.kind,
2246
2281
  subject: one.subject,
@@ -2253,10 +2288,15 @@ var itemOf2 = /* @__PURE__ */ __name((one) => ({
2253
2288
  updated_at: new Date(one.updatedAt).toISOString(),
2254
2289
  on: one.on.map(({ kind, externalId, ref, title }) => ({ kind, external_id: externalId, ref, title })),
2255
2290
  untrusted: UNTRUSTED2
2256
- }), "itemOf");
2291
+ }), "listedOf");
2257
2292
  var addCrmActivityCommands = /* @__PURE__ */ __name((program, options) => {
2293
+ 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`);
2294
+ if (options.list)
2295
+ addList(group, options);
2296
+ addActivityWrites(group, options);
2297
+ }, "addCrmActivityCommands");
2298
+ var addList = /* @__PURE__ */ __name((group, options) => {
2258
2299
  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
2300
  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
2301
  const name = "activities list";
2262
2302
  const terms = queryTerms(words, ACTIVITIES_QUERY, name, ["due"]);
@@ -2299,17 +2339,92 @@ var addCrmActivityCommands = /* @__PURE__ */ __name((program, options) => {
2299
2339
  offset: (opts.page - 1) * opts.limit
2300
2340
  });
2301
2341
  return listOf(pathOf3(command).join(" "), {
2302
- items: found.items.map(itemOf2),
2342
+ items: found.items.map(listedOf),
2303
2343
  ...paged,
2304
2344
  has_more: found.hasMore,
2305
2345
  ...due.meta ? { meta: due.meta } : {}
2306
2346
  });
2307
2347
  });
2308
2348
  });
2309
- }, "addCrmActivityCommands");
2349
+ }, "addList");
2310
2350
  var refOf = /* @__PURE__ */ __name((kind, value) => value.includes(":") ? value : `${kind}:${value}`, "refOf");
2351
+ var writtenActivity = strictObject({
2352
+ operation_id: text,
2353
+ stored: boolean(),
2354
+ activity: omit(crmActivity, ["done_at"]),
2355
+ untrusted: array(text)
2356
+ });
2357
+ var addActivityWrites = /* @__PURE__ */ __name((group, options) => {
2358
+ const { within, example, now, writes } = options;
2359
+ const kinds = writes?.activities ?? [];
2360
+ if (kinds.length === 0)
2361
+ return;
2362
+ const leads = options.leads !== false;
2363
+ const contextOf3 = /* @__PURE__ */ __name((run3, command) => {
2364
+ if (!run3.writes)
2365
+ throw new CliError("configuration_error", "this profile cannot write to its CRM");
2366
+ return {
2367
+ store: run3.store,
2368
+ account: run3.account,
2369
+ writes: run3.writes(),
2370
+ ask: terminalAsker(command),
2371
+ source: run3.source,
2372
+ names: { id: "--operation-id" }
2373
+ };
2374
+ }, "contextOf");
2375
+ const answered = /* @__PURE__ */ __name((run3, done) => itemOf({
2376
+ operation_id: done.operationId,
2377
+ stored: done.stored,
2378
+ activity: writtenOf(run3, done.activity, done.on),
2379
+ untrusted: UNTRUSTED2.map((field) => `activity.${field}`)
2380
+ }), "answered");
2381
+ const write2 = /* @__PURE__ */ __name((name, description) => {
2382
+ const command = answerEntity(annotate(group.command(name), { effects: REMOTE_WRITE, offline: false }), "crm_activity_write", writtenActivity).description(description);
2383
+ if (writes?.idempotent)
2384
+ command.option("--operation-id <id>", "the operation_id a write that ended in outcome_unknown named: the CRM answers the repeat from its record");
2385
+ return command;
2386
+ }, "write");
2387
+ const idOf2 = /* @__PURE__ */ __name((opts) => opts.operationId === void 0 ? {} : { operationId: opts.operationId }, "idOf");
2388
+ const comment = kinds.includes("comment");
2389
+ const task = kinds.includes("task");
2390
+ 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(
2391
+ "--subject <ref>",
2392
+ `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`,
2393
+ (value, previous = []) => [...previous, value],
2394
+ // The empty default marks the flag as repeatable, so an agent's tool takes a list.
2395
+ []
2396
+ ).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) => {
2397
+ await within(command, async (run3) => {
2398
+ const done = await createCrmActivity(contextOf3(run3, command), kind, {
2399
+ on: opts.subject,
2400
+ ...opts.title === void 0 ? {} : { title: opts.title },
2401
+ ...opts.text === void 0 ? {} : { body: opts.text },
2402
+ ...opts.due === void 0 ? {} : { dueAt: aheadOf(opts.due, "--due", now(), { end: true }) },
2403
+ ...opts.owner === void 0 ? {} : { owner: opts.owner }
2404
+ }, idOf2(opts));
2405
+ return answered(run3, done);
2406
+ });
2407
+ });
2408
+ if (task)
2409
+ 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) => {
2410
+ await within(command, async (run3) => answered(run3, await completeCrmActivity(contextOf3(run3, command), id, idOf2(opts))));
2411
+ });
2412
+ }, "addActivityWrites");
2413
+ var writtenOf = /* @__PURE__ */ __name((run3, activity, on) => ({
2414
+ external_id: activity.externalId,
2415
+ kind: activity.kind,
2416
+ subject: activity.subject,
2417
+ body: activity.body ?? null,
2418
+ due_at: iso3(activity.dueAt ?? null),
2419
+ done: activity.done,
2420
+ assignee: activity.assignee ? crmIdentityId(run3.account, activity.assignee, "user") : null,
2421
+ created_at: new Date(activity.createdAt).toISOString(),
2422
+ updated_at: new Date(activity.updatedAt).toISOString(),
2423
+ on: on.map(({ kind, externalId, ref, title }) => ({ kind, external_id: externalId, ref, title })),
2424
+ untrusted: UNTRUSTED2
2425
+ }), "writtenOf");
2311
2426
 
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
2427
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/changes.js
2313
2428
  var MOST3 = 500;
2314
2429
  var DAY2 = 864e5;
2315
2430
  var nullableText2 = nullable(text);
@@ -2372,7 +2487,7 @@ var CSV_COLUMNS = [
2372
2487
  "owner",
2373
2488
  "activity.subject"
2374
2489
  ];
2375
- var itemOf3 = /* @__PURE__ */ __name((run3, one) => ({
2490
+ var itemOf2 = /* @__PURE__ */ __name((run3, one) => ({
2376
2491
  change: one.change,
2377
2492
  at: new Date(one.at).toISOString(),
2378
2493
  kind: one.kind,
@@ -2414,8 +2529,17 @@ var digestState = /* @__PURE__ */ __name((schedule) => `crm:digest:${schedule}`,
2414
2529
  var addCrmChangeCommands = /* @__PURE__ */ __name((program, options) => {
2415
2530
  const { within, example, now, ownerOf: ownerOf2, pathOf: pathOf3 } = options;
2416
2531
  const deals = options.leads === false ? "deals" : "deals and leads";
2417
- if (options.activities)
2418
- addCrmActivityCommands(program, { within, example, now, ownerOf: ownerOf2, pathOf: pathOf3 });
2532
+ if (options.activities || options.writes?.activities?.length)
2533
+ addCrmActivityCommands(program, {
2534
+ within,
2535
+ example,
2536
+ now,
2537
+ ownerOf: ownerOf2,
2538
+ pathOf: pathOf3,
2539
+ list: options.activities === true,
2540
+ ...options.writes ? { writes: options.writes } : {},
2541
+ ...options.leads === void 0 ? {} : { leads: options.leads }
2542
+ });
2419
2543
  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
2544
  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
2545
  const name = "changes list";
@@ -2439,7 +2563,7 @@ var addCrmChangeCommands = /* @__PURE__ */ __name((program, options) => {
2439
2563
  offset: position.offset
2440
2564
  });
2441
2565
  const next = found.hasMore ? cursorOf({ ...position, offset: position.offset + opts.limit }) : void 0;
2442
- return { items: found.items.map((one) => itemOf3(run3, one)), next };
2566
+ return { items: found.items.map((one) => itemOf2(run3, one)), next };
2443
2567
  }, "read");
2444
2568
  const noted = /* @__PURE__ */ __name((run3) => {
2445
2569
  const note = shortened.get(run3);
@@ -2529,9 +2653,9 @@ var pipelineOf2 = /* @__PURE__ */ __name(async (run3, value) => {
2529
2653
  }) : new CliError("not_found", `no pipeline ${value} in this account`, { reason: "pipeline.not-found" });
2530
2654
  }, "pipelineOf");
2531
2655
 
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
2656
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/files.js
2533
2657
  import { createHash } from "node:crypto";
2534
- import { chmodSync, constants, copyFileSync, existsSync, linkSync, mkdirSync, readFileSync, renameSync, rmSync } from "node:fs";
2658
+ import { chmodSync, constants, copyFileSync, existsSync, linkSync, mkdirSync, renameSync, rmSync } from "node:fs";
2535
2659
  import { open } from "node:fs/promises";
2536
2660
  import { join as join2, resolve, sep } from "node:path";
2537
2661
  var MB = 1024 * 1024;
@@ -2762,9 +2886,10 @@ var downloadCrmFile = /* @__PURE__ */ __name(async (context, file, assignee, { c
2762
2886
  await discard();
2763
2887
  throw diskFull(limits, top, setting);
2764
2888
  }
2889
+ const overBudget = saved.bytes > attachmentMaxBytes(run3.env ?? process.env);
2765
2890
  let bytes;
2766
2891
  try {
2767
- bytes = readFileSync(target);
2892
+ bytes = overBudget ? Buffer.alloc(0) : await readWhole(target);
2768
2893
  } catch {
2769
2894
  await discard();
2770
2895
  throw new CliError("not_found", `the saved copy of ${file.id} was removed before its text was read; run it again`, {
@@ -2777,7 +2902,7 @@ var downloadCrmFile = /* @__PURE__ */ __name(async (context, file, assignee, { c
2777
2902
  }, "cutOff");
2778
2903
  let extraction;
2779
2904
  try {
2780
- extraction = saved.bytes > attachmentMaxBytes(run3.env ?? process.env) ? { status: "too-large" } : await extractText(bytes, { kind: "file", name: file.name, mime: file.mime, path: target }, importEngine, signal, run3.env ?? process.env);
2905
+ extraction = overBudget ? { status: "too-large" } : await extractText(bytes, { kind: "file", name: file.name, mime: file.mime, path: target }, importEngine, signal, run3.env ?? process.env);
2781
2906
  } catch (error) {
2782
2907
  if (signal?.aborted)
2783
2908
  throw await cutOff();
@@ -2832,7 +2957,7 @@ var addCrmFileCommands = /* @__PURE__ */ __name((program, options) => {
2832
2957
  const { signal } = environmentOf(command);
2833
2958
  return { app, run: run3, now, ...signal ? { signal } : {} };
2834
2959
  }, "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");
2960
+ 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
2961
  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
2962
  for (const [, flag] of kinds)
2838
2963
  list.option(flag, `the ${flag.slice(2, flag.indexOf(" "))} whose files to list`);
@@ -3066,7 +3191,7 @@ var syncFiles = /* @__PURE__ */ __name(async (context, outOfTime, deadline = (ms
3066
3191
  return report;
3067
3192
  }, "syncFiles");
3068
3193
 
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
3194
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/pipeline-view.js
3070
3195
  var sumOf = /* @__PURE__ */ __name((amounts) => amounts.map(({ amount, currency }) => `${groupDigits(amount)} ${currency}`).join(", ") || "\u2014", "sumOf");
3071
3196
  var percent = /* @__PURE__ */ __name((share) => share === null ? "\u2014" : `${Math.round(share * 100)}%`, "percent");
3072
3197
  var openStages = /* @__PURE__ */ __name((stages) => {
@@ -3112,12 +3237,14 @@ ${outcomes.join("\n")}`
3112
3237
  ].join("\n\n");
3113
3238
  }, "pipelineView");
3114
3239
 
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
3240
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/search-all.js
3116
3241
  var SEARCHED = ["crm", ...SOURCE_SEARCHED];
3117
3242
  var DEFAULT_LIMIT = 20;
3118
3243
  var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example, viewerOf: viewerOf2, leads = true }) => {
3119
3244
  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);
3245
+ 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", `
3246
+ 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.
3247
+ ` + SAVE_HELP);
3121
3248
  searches.addCommand(searchAllOptions(all, SEARCHED));
3122
3249
  example(all, "search all Example LLC", "search all website --only crm --json");
3123
3250
  all.action(async (words, _opts, leaf) => {
@@ -3127,7 +3254,7 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
3127
3254
  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
3255
  const asked = opts.only ?? SEARCHED;
3129
3256
  const denied = deniedKinds(leaf, app, [
3130
- ...asked.includes("crm") ? [...DEAL_KINDS, "crm_file"] : [],
3257
+ ...asked.includes("crm") ? [...DEAL_KINDS, "crm_file", "crm_activity"] : [],
3131
3258
  ...asked.filter((one) => one !== "crm" && one !== "mail")
3132
3259
  ]);
3133
3260
  const out = new Set(denied.map(({ kind }) => kind));
@@ -3157,6 +3284,7 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
3157
3284
  ...crmKinds.length < DEAL_KINDS.length ? { crmKinds } : {},
3158
3285
  crmViewers: viewers,
3159
3286
  ...out.has("crm_file") ? { crmFiles: false } : {},
3287
+ ...out.has("crm_activity") ? { crmActivities: false } : {},
3160
3288
  ...opts.source === void 0 ? {} : { source: opts.source },
3161
3289
  ...alone ? { scope: { crm: [run3.account] } } : {}
3162
3290
  }, { 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 +3295,11 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
3167
3295
  note(`${resource ?? source} not searched: ${reason}`);
3168
3296
  if (!found.items.length)
3169
3297
  note("nothing found in what the local store holds");
3298
+ const off = found.crm?.needsVectors && !await run3.store.crm.activitiesOn(run3.account);
3299
+ const build = off ? `\`${lineOf(leaf, "config set activities on")}\`, then \`${lineOf(leaf, "sync --embed")}\`, copy the activities and build` : `\`${lineOf(leaf, "sync --embed")}\` builds`;
3300
+ 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;
3301
+ if (vectors)
3302
+ note(vectors);
3170
3303
  const skips = await historySkipsOf(run3.store, found.accounts).catch(() => []);
3171
3304
  const again = {
3172
3305
  query: words.join(" "),
@@ -3174,64 +3307,67 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
3174
3307
  ...opts.source === void 0 ? {} : { source: opts.source },
3175
3308
  ...opts.exact ? { exact: true } : {}
3176
3309
  };
3177
- return allAnswer("search all", found, { limit, page: opts.page ?? 1, again }, opts.exact === true, skips, denied);
3310
+ const body = allAnswer("search all", found, { limit, page: opts.page ?? 1, again }, opts.exact === true, skips, denied);
3311
+ return vectors ? { ...body, missing: [...body.missing ?? [], { field: "found_by", why: vectors }] } : body;
3178
3312
  });
3179
3313
  });
3180
3314
  }, "addCrmSearchAll");
3181
3315
 
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
3183
- import { mkdtempSync, rmSync as rmSync2 } from "node:fs";
3184
- import { tmpdir } from "node:os";
3185
- import { join as join3 } from "node:path";
3186
- var openProfileStore = /* @__PURE__ */ __name(async (options) => {
3187
- const { app, env, profile, readOnly, open: open2 } = options;
3188
- const locked = readOnly && readOnlyLockOf(app, env) !== void 0;
3189
- if (readOnly) {
3190
- const store = await open2(env, { readOnly: true }).catch((error) => {
3191
- if (locked && !(isCliError(error) && error.code === "not_found"))
3192
- throw error;
3193
- return void 0;
3194
- });
3195
- if (store) {
3196
- const saved = await store.accounts.profiles().then((all) => all[app.command]?.[profile]).catch(() => void 0);
3197
- if (saved)
3198
- return { store, account: { provider: saved.provider, account: saved.account } };
3199
- await store.close();
3200
- }
3201
- }
3202
- if (!locked)
3203
- return withProfile(options, env, options.account());
3204
- const folder = mkdtempSync(join3(tmpdir(), `${app.command}-empty-`));
3205
- const removing = /* @__PURE__ */ __name(() => rmSync2(folder, { recursive: true, force: true }), "removing");
3316
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/sync-embed.js
3317
+ var EMBED_MAX = 600;
3318
+ var crmSyncEmbeddings = strictObject({
3319
+ model: text,
3320
+ embedded: count,
3321
+ left: boolean(),
3322
+ stopped: optional(picklist(["deadline", "cancelled"])),
3323
+ remaining: optional(count)
3324
+ });
3325
+ var syncEmbeddings = /* @__PURE__ */ __name(async (command, store, report, app, again) => {
3326
+ if (report.stopped)
3327
+ return { item: {}, issues: [] };
3328
+ const { env, deadline, signal } = environmentOf(command);
3329
+ const ends = deadline?.();
3206
3330
  try {
3207
- const empty = await withProfile(options, { ...env, MESSAGING_STORE: join3(folder, "wirecat.db") }, {
3208
- provider: options.provider,
3209
- account: profile
3331
+ const embeddings = await embedCrmActivities(store, {
3332
+ maxChunks: EMBED_MAX,
3333
+ ...ends ? { deadline: ends } : {},
3334
+ ...signal ? { signal } : {},
3335
+ ...env ? { env } : {},
3336
+ ...commandAt(rootOf2(command), "models download") ? { command: app.command } : {}
3210
3337
  });
3211
- const close = empty.store.close.bind(empty.store);
3212
- empty.store.close = () => close().finally(removing);
3213
- return empty;
3214
- } catch (error) {
3215
- removing();
3216
- throw error;
3217
- }
3218
- }, "openProfileStore");
3219
- var withProfile = /* @__PURE__ */ __name(async ({ app, profile, open: open2 }, env, account2) => {
3220
- const store = await open2(env);
3221
- try {
3222
- await store.accounts.saveAccount(account2, { name: null, scope: "work" });
3223
- await store.accounts.saveProfile(app.command, profile, account2);
3224
- return { store, account: account2 };
3338
+ if (!embeddings.left)
3339
+ return { item: { embeddings }, issues: [] };
3340
+ return {
3341
+ item: { embeddings },
3342
+ issues: [],
3343
+ next: [
3344
+ {
3345
+ kind: "command",
3346
+ step: "crm.sync",
3347
+ command: "sync",
3348
+ args: Object.fromEntries(Object.entries({ ...again, embed: true }).filter(([, value]) => value !== void 0)),
3349
+ 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`,
3350
+ safe_to_auto_execute: true
3351
+ }
3352
+ ]
3353
+ };
3225
3354
  } catch (error) {
3226
- await store.close();
3227
- throw error;
3355
+ if (signal?.aborted || !isCliError(error))
3356
+ throw error;
3357
+ const reason = error.details.reason;
3358
+ return {
3359
+ item: {},
3360
+ issues: [
3361
+ { code: error.code, reason: typeof reason === "string" ? reason : "sync.failed", source: "crm:embeddings" }
3362
+ ]
3363
+ };
3228
3364
  }
3229
- }, "withProfile");
3365
+ }, "syncEmbeddings");
3230
3366
 
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
3367
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/store.js
3232
3368
  var openCrmStore = openProfileStore;
3233
3369
 
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
3370
+ // node_modules/.pnpm/@wirecat+cli-core@2.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_a82f624c57005d53c3f072e45c3a3a86/node_modules/@wirecat/cli-core/dist/crm/cli/index.js
3235
3371
  var MOST4 = 500;
3236
3372
  var STAGE_REF = /^stage:\d+$/;
3237
3373
  var timeField = /* @__PURE__ */ __name((name, example, relation) => nativeField({ name, type: "time", operators: ["term", "range"], example, relation }), "timeField");
@@ -3297,7 +3433,7 @@ var crmSync = strictObject({
3297
3433
  skipped_owner_rejected: count,
3298
3434
  contacts_removed: optional(crmContactsRemoved),
3299
3435
  stage_tasks: count,
3300
- activities: optional(strictObject({ saved: count, out_of_scope: count, state: picklist(["partial", "complete"]) })),
3436
+ activities: optional(strictObject({ saved: count, out_of_scope: count, removed: count, state: picklist(["partial", "complete"]) })),
3301
3437
  synced: array(strictObject({
3302
3438
  kind: picklist(CRM_KINDS),
3303
3439
  round: picklist(["full", "changes"]),
@@ -3323,7 +3459,8 @@ var crmSync = strictObject({
3323
3459
  stopped: optional(picklist(["requests", "deadline", "cancelled"])),
3324
3460
  progress: strictObject({ requests: count, saved: count, steps: count }),
3325
3461
  hint: optional(text),
3326
- group_hint: optional(text)
3462
+ group_hint: optional(text),
3463
+ embeddings: optional(crmSyncEmbeddings)
3327
3464
  });
3328
3465
  var crmSyncProgress = strictObject({
3329
3466
  kind: picklist(CRM_KINDS),
@@ -3402,16 +3539,16 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
3402
3539
  const hasLeads = options.leads !== false;
3403
3540
  const dealsAndLeads = hasLeads ? "deals and leads" : "deals";
3404
3541
  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);
3542
+ 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
3543
  await within(command, async (run3) => {
3408
3544
  const source = run3.source();
3409
3545
  const started = now();
3410
3546
  const report = await syncRecorded(source, run3.store, run3.account, {
3411
3547
  now: started,
3412
3548
  budget: runBudgetOf(command, opts.maxPages),
3413
- ...signal ? { signal } : {},
3414
- ...opts.rescan ? { rescan: true } : {}
3549
+ signal: environmentOf(command).signal,
3550
+ rescan: opts.rescan,
3551
+ allowDeletions: opts.allowDeletions
3415
3552
  });
3416
3553
  const stageTasks = await openStageTasks(run3.store, run3.account, started, {
3417
3554
  history: source.stageHistory !== void 0
@@ -3420,13 +3557,14 @@ With the activities setting on, it also copies the activities and tasks on the $
3420
3557
  const retried = failed.filter((one) => one.setting === void 0);
3421
3558
  const settings = [...new Set(failed.flatMap((one) => one.setting ?? []))];
3422
3559
  const timeout = command.optsWithGlobals().timeout;
3560
+ const again = { max_pages: opts.maxPages, timeout, embed: opts.embed };
3423
3561
  const stuck = report.state === "partial" && report.progress.steps === 0 && failed.length === 0;
3424
3562
  const next = retried.length || report.state === "partial" && !stuck && failed.length === 0 ? [
3425
3563
  {
3426
3564
  kind: "command",
3427
3565
  step: "crm.sync",
3428
3566
  command: "sync",
3429
- args: Object.fromEntries(Object.entries({ max_pages: opts.maxPages, timeout }).filter(([, value]) => value !== void 0)),
3567
+ args: Object.fromEntries(Object.entries(again).filter(([, value]) => value !== void 0)),
3430
3568
  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
3569
  safe_to_auto_execute: true
3432
3570
  }
@@ -3435,6 +3573,7 @@ With the activities setting on, it also copies the activities and tasks on the $
3435
3573
  const fixes = settings.map((setting) => lineOf(command, `config set ${setting} <value>`));
3436
3574
  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
3575
  const { hint: _hint, ...rest } = report;
3576
+ const embedded = opts.embed ? await syncEmbeddings(command, run3.store, report, options.app, again) : void 0;
3438
3577
  const issues = [
3439
3578
  ...failed.map((one) => ({
3440
3579
  code: one.setting === void 0 ? "provider_error" : "validation_error",
@@ -3445,12 +3584,13 @@ With the activities setting on, it also copies the activities and tasks on the $
3445
3584
  code: "validation_error",
3446
3585
  reason: one.reason,
3447
3586
  source: one.externalId === void 0 ? `crm:${one.kind}` : `crm:${one.kind}/${one.externalId}`
3448
- }))
3587
+ })),
3588
+ ...embedded?.issues ?? []
3449
3589
  ];
3450
3590
  const partial = report.state === "partial" || issues.length > 0;
3451
- return itemOf(snakeKeys({ ...rest, stageTasks, ...hint === void 0 ? {} : { hint } }), {
3591
+ return itemOf(snakeKeys({ ...rest, stageTasks, ...hint === void 0 ? {} : { hint }, ...embedded?.item }), {
3452
3592
  ...partial ? { meta: { complete: false, ...issues.length ? { issues } : {} } } : {},
3453
- ...next ? { next } : {}
3593
+ ...next || embedded?.next ? { next: next ?? embedded?.next } : {}
3454
3594
  });
3455
3595
  });
3456
3596
  });
@@ -3867,9 +4007,9 @@ var userOf = /* @__PURE__ */ __name(async (command, amo) => {
3867
4007
  var openProfile = /* @__PURE__ */ __name(async (command, { readOnly }) => {
3868
4008
  const { env, profile } = contextOf(command);
3869
4009
  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")
4010
+ import("./store-IWW6U6QN.js"),
4011
+ import("./source-E72OS27D.js"),
4012
+ import("./writer-TW2Q55VJ.js")
3873
4013
  ]);
3874
4014
  const accountOf = /* @__PURE__ */ __name(() => {
3875
4015
  const signIn = storedSignIn(command) ?? signInOf(command);
@@ -3888,7 +4028,7 @@ var openProfile = /* @__PURE__ */ __name(async (command, { readOnly }) => {
3888
4028
  const amo = /* @__PURE__ */ __name(() => transport ??= transportFor(command, signInOf(command)), "amo");
3889
4029
  let source;
3890
4030
  const asked = /* @__PURE__ */ __name(async () => {
3891
- const { crmSettingKey: crmSettingKey2 } = await import("./store-OSOUXBYL.js");
4031
+ const { crmSettingKey: crmSettingKey2 } = await import("./areas-27FRPBF3.js");
3892
4032
  const scope = await store.crm.scope(account2);
3893
4033
  return {
3894
4034
  mode: scope.mode,
@@ -4148,11 +4288,6 @@ var browserSignIn = /* @__PURE__ */ __name(async (options) => {
4148
4288
  // dist/commands/session.js
4149
4289
  var AMO2 = IDENTITY.command;
4150
4290
  var answer = /* @__PURE__ */ __name((command, item) => renderAnswer(command, outputFor(command), itemOf(item)), "answer");
4151
- var storageOf = /* @__PURE__ */ __name((raw) => {
4152
- if (raw === "keyring" || raw === "file")
4153
- return raw;
4154
- throw new CliError("validation_error", `--credential-storage takes keyring or file; got ${raw}`);
4155
- }, "storageOf");
4156
4291
  var tokensHere = /* @__PURE__ */ __name((env, keyring) => new ProfileTokenStore({ app: IDENTITY, env, ...keyring ? { keyring } : {} }), "tokensHere");
4157
4292
  var refuseTaken = /* @__PURE__ */ __name((command, at2) => {
4158
4293
  const { env, profile, keyring, settings } = contextOf(command);
@@ -4707,7 +4842,7 @@ var update = appUpdate({
4707
4842
  command: IDENTITY.command,
4708
4843
  version: IDENTITY.version,
4709
4844
  entry: new URL("../program.js", import.meta.url).href,
4710
- statePath: /* @__PURE__ */ __name((env) => join4(resolvePaths({ appName: IDENTITY.appName, prefix: IDENTITY.envPrefix, env }).state, "update-check.json"), "statePath"),
4845
+ statePath: /* @__PURE__ */ __name((env) => join3(resolvePaths({ appName: IDENTITY.appName, prefix: IDENTITY.envPrefix, env }).state, "update-check.json"), "statePath"),
4711
4846
  // biome-ignore lint/plugin/no-own-settings: the update check runs before any command exists to give baseContext
4712
4847
  enabled: /* @__PURE__ */ __name((env) => configuration.resolveSettings({}, { env, needsProfile: false }).updateCheck, "enabled"),
4713
4848
  offVariables: [`${IDENTITY.envPrefix}_NO_UPDATE_CHECK`]