@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.
- package/CHANGELOG.md +49 -0
- package/contracts/wirecat.json +2 -1
- package/dist/amo/allow-list.d.ts +1 -1
- package/dist/amo/allow-list.d.ts.map +1 -1
- package/dist/amo/oauth.d.ts.map +1 -1
- package/dist/amo/oauth.js +3 -4
- package/dist/amo/oauth.js.map +1 -1
- package/dist/amo/operation.d.ts +1 -1
- package/dist/amo/operation.d.ts.map +1 -1
- package/dist/amo/transport.d.ts.map +1 -1
- package/dist/amo/transport.js +3 -6
- package/dist/amo/transport.js.map +1 -1
- package/dist/bin/amo.js +2 -2
- package/dist/bundle/agent-VVACEKSX.js +42 -0
- package/dist/bundle/{all-profiles-PRNXEZRH.js → all-profiles-QNUKL4NA.js} +11 -11
- package/dist/bundle/amo.js +28 -28
- package/dist/bundle/{anthropic-FDI24DU2.js → anthropic-PQN6MNP7.js} +5 -5
- package/dist/bundle/{app-server-WAKJVDLN.js → app-server-Q2QEA7GP.js} +71 -69
- package/dist/bundle/areas-27FRPBF3.js +71 -0
- package/dist/bundle/{bun-YPXUXMBI.js → bun-F4M4KCNA.js} +2 -2
- package/dist/bundle/{bun-sqlite-UBQ5M47X.js → bun-sqlite-P5IDBDVR.js} +6 -6
- package/dist/bundle/{chunk-G3LAYJJJ.js → chunk-22KAQPX7.js} +4 -4
- package/dist/bundle/{chunk-XEYT2EQT.js → chunk-2JGNMZ55.js} +6 -6
- package/dist/bundle/{chunk-PL7TNKAY.js → chunk-2VDHC7QO.js} +2 -2
- package/dist/bundle/{chunk-BCIZAUDV.js → chunk-34ZOMVUK.js} +9 -9
- package/dist/bundle/{chunk-SHOSFYI7.js → chunk-3J3EDSXF.js} +20 -84
- package/dist/bundle/{chunk-ELAKOEIO.js → chunk-3TYER5IK.js} +14 -6
- package/dist/bundle/{chunk-NFWD4QX3.js → chunk-5NGLCDYQ.js} +2 -2
- package/dist/bundle/{chunk-NKYWQTS2.js → chunk-5SQTHOBI.js} +270 -252
- package/dist/bundle/{chunk-Z2B3VNRI.js → chunk-6GE36KUE.js} +11 -11
- package/dist/bundle/{chunk-GQKEMBM6.js → chunk-6GZKY3HV.js} +121 -36
- package/dist/bundle/{chunk-M54YKD3I.js → chunk-6OV2TRGF.js} +7 -7
- package/dist/bundle/{chunk-MW7HUD6R.js → chunk-7CPIZFOE.js} +9 -9
- package/dist/bundle/{chunk-TIR3AB35.js → chunk-A5K2NU3K.js} +913 -795
- package/dist/bundle/{chunk-5HZMXHRH.js → chunk-AEC4H5WZ.js} +6 -6
- package/dist/bundle/{chunk-WAFB3IWJ.js → chunk-APBEDWOE.js} +5 -5
- package/dist/bundle/{chunk-V5SETIQK.js → chunk-AQ5RIOUE.js} +1 -1
- package/dist/bundle/{chunk-RQPB2BSH.js → chunk-B7L5MSRP.js} +2 -2
- package/dist/bundle/{chunk-HZZ56JO7.js → chunk-C7JPYWYQ.js} +1 -1
- package/dist/bundle/{chunk-KRD375P7.js → chunk-DIZEHPS6.js} +39 -30
- package/dist/bundle/{chunk-TCSVW7BA.js → chunk-DNCLQPOM.js} +1 -1
- package/dist/bundle/{chunk-WASBOYI2.js → chunk-DPV53EZC.js} +4 -4
- package/dist/bundle/{chunk-HDZNSOV5.js → chunk-DUPCDJ3W.js} +14 -10
- package/dist/bundle/{chunk-YHVHDRED.js → chunk-DWT24UVR.js} +6 -6
- package/dist/bundle/chunk-DXWJORSY.js +1703 -0
- package/dist/bundle/{chunk-E3EWS6DF.js → chunk-DY3PLWIH.js} +6 -6
- package/dist/bundle/{chunk-A4W7J6VN.js → chunk-DYWHAJRK.js} +37 -190
- package/dist/bundle/{chunk-LAR2DLTI.js → chunk-EXRM3ML4.js} +4 -4
- package/dist/bundle/{chunk-ZJC2XJQC.js → chunk-FFER7KJI.js} +13 -13
- package/dist/bundle/{chunk-V2QWX6B3.js → chunk-FIP2DG7W.js} +3 -3
- package/dist/bundle/{chunk-5II6TAJE.js → chunk-FTH6WGYO.js} +1 -1
- package/dist/bundle/{chunk-2AIG2SSJ.js → chunk-FWRLGIF6.js} +1668 -169
- package/dist/bundle/{chunk-DWD3KDJA.js → chunk-FYOPPKAN.js} +1 -1
- package/dist/bundle/{chunk-ABMPZL2P.js → chunk-G3N2RHGF.js} +19 -15
- package/dist/bundle/{chunk-GBQ76X6T.js → chunk-G46PNDWL.js} +2 -2
- package/dist/bundle/{chunk-VG26HDKH.js → chunk-G6NY7LFB.js} +4 -4
- package/dist/bundle/{chunk-5SJEJYQZ.js → chunk-GOCMJBEE.js} +3 -3
- package/dist/bundle/{chunk-3K6T2G52.js → chunk-GRGCZSES.js} +6 -6
- package/dist/bundle/{chunk-4PQECIU2.js → chunk-GVSKLZRD.js} +2 -2
- package/dist/bundle/{chunk-UEN5NWNW.js → chunk-GZ7WBU5Y.js} +1 -1
- package/dist/bundle/{chunk-KQZTX4LM.js → chunk-HN2LCLGT.js} +19 -19
- package/dist/bundle/{chunk-SFZVMKB6.js → chunk-HO4JGD4Q.js} +1 -1
- package/dist/bundle/{chunk-SZX7EPPY.js → chunk-HOF7GQWW.js} +4 -4
- package/dist/bundle/chunk-HUAHLO6N.js +29 -0
- package/dist/bundle/chunk-IDCZ4LWS.js +150 -0
- package/dist/bundle/{chunk-23AQD7JU.js → chunk-IN3VL7UU.js} +18 -17
- package/dist/bundle/{chunk-QGFURWEP.js → chunk-ISQ23VKV.js} +8 -1
- package/dist/bundle/{chunk-PLU2IQXC.js → chunk-JVBCQHCS.js} +3 -3
- package/dist/bundle/{chunk-VEFAYLKX.js → chunk-K5W7YEHB.js} +187 -114
- package/dist/bundle/{chunk-PIOR6PIO.js → chunk-KAFSS35C.js} +2 -2
- package/dist/bundle/{chunk-VG2ERHFJ.js → chunk-KLRCTMES.js} +3 -3
- package/dist/bundle/{chunk-KORZEYZN.js → chunk-KYRYD4CR.js} +1 -1
- package/dist/bundle/{chunk-FEUNZG7U.js → chunk-LBZSURLL.js} +38 -38
- package/dist/bundle/{chunk-EAX5RO7S.js → chunk-LC7ZD2RW.js} +1 -1
- package/dist/bundle/{chunk-O3WE5IGP.js → chunk-LH6FJYMO.js} +6 -6
- package/dist/bundle/{chunk-DWA5TZMP.js → chunk-LJKINNWC.js} +8 -8
- package/dist/bundle/{chunk-U46RNOEQ.js → chunk-M36XP74N.js} +3 -3
- package/dist/bundle/chunk-MNPGZCKE.js +361 -0
- package/dist/bundle/{chunk-WR2FPZTE.js → chunk-MRPMORLH.js} +8 -8
- package/dist/bundle/{chunk-CEBX63XY.js → chunk-NNREILWP.js} +8 -8
- package/dist/bundle/chunk-NSOY4FMN.js +159 -0
- package/dist/bundle/{chunk-SNBYFQHT.js → chunk-OEEWVKJX.js} +1 -1
- package/dist/bundle/{chunk-YREKMP24.js → chunk-OGJFDKDL.js} +4 -4
- package/dist/bundle/chunk-PATZAYFZ.js +453 -0
- package/dist/bundle/chunk-PCR6GFNP.js +1171 -0
- package/dist/bundle/{chunk-3PCVQCCV.js → chunk-Q4MH2O5E.js} +2 -2
- package/dist/bundle/{chunk-7OVTUADG.js → chunk-QFOP3KUP.js} +8 -8
- package/dist/bundle/{chunk-YFRTEJ6V.js → chunk-QQRJEWKB.js} +7 -7
- package/dist/bundle/{chunk-GJBOZAUD.js → chunk-RNWUCAJJ.js} +3 -3
- package/dist/bundle/{chunk-AP3CWDRK.js → chunk-S6JG4YUH.js} +2 -2
- package/dist/bundle/{chunk-KBAOJISR.js → chunk-SDVUGWD7.js} +7 -7
- package/dist/bundle/{chunk-WEWJA42Q.js → chunk-SEFE6PGL.js} +12 -12
- package/dist/bundle/{chunk-6PILR4AX.js → chunk-SWCJM3YD.js} +2 -2
- package/dist/bundle/{chunk-TEGQVVCZ.js → chunk-SYRDEMQE.js} +16709 -13048
- package/dist/bundle/{chunk-NXNUCGGO.js → chunk-SYYQZDHJ.js} +6 -6
- package/dist/bundle/{chunk-SMM7GS4Q.js → chunk-T3W4V4A6.js} +1 -1
- package/dist/bundle/{chunk-EBNCUQLV.js → chunk-TCT5D2X2.js} +1 -1
- package/dist/bundle/{chunk-ASU63X5C.js → chunk-TES7MB6I.js} +2 -2
- package/dist/bundle/{chunk-745FMNI5.js → chunk-TXDR6YSF.js} +1 -1
- package/dist/bundle/{chunk-3WG4MTQI.js → chunk-TY7NDMFY.js} +1 -1
- package/dist/bundle/{chunk-AN6IJYH3.js → chunk-U6XPWCWM.js} +5 -5
- package/dist/bundle/{chunk-LZ4IWN43.js → chunk-UFKC7TIX.js} +1617 -1990
- package/dist/bundle/{chunk-IPNIF5JE.js → chunk-UNWF3TH5.js} +4 -4
- package/dist/bundle/{chunk-6QMSKJB4.js → chunk-W3BOR6AT.js} +8 -8
- package/dist/bundle/{chunk-SCMB4LI6.js → chunk-WIHN3ELW.js} +19 -19
- package/dist/bundle/{chunk-UCM7C773.js → chunk-X76RS6JO.js} +178 -61
- package/dist/bundle/{chunk-GMHRPX5M.js → chunk-YF3S26TS.js} +61 -61
- package/dist/bundle/{chunk-ZKRWNL4T.js → chunk-ZCQ4H7CA.js} +2 -2
- package/dist/bundle/{chunk-CYHIM5SL.js → chunk-ZOZV32IR.js} +3 -3
- package/dist/bundle/{chunk-OYMHPQF7.js → chunk-ZTKHXDEU.js} +4 -4
- package/dist/bundle/{cli-QDPKC2HJ.js → cli-EAD3WZLR.js} +119 -105
- package/dist/bundle/command-contract-SMEJ2ICG.js +40 -0
- package/dist/bundle/{command-server-entry-TX7WNN7G.js → command-server-entry-YTZP6I4T.js} +29 -28
- package/dist/bundle/{decode-BLPC7OYE.js → decode-57BE5OBT.js} +5 -5
- package/dist/bundle/{dispatch-5JUT55CS.js → dispatch-56FECRCU.js} +8 -8
- package/dist/bundle/{echarts-54D3FOCL.js → echarts-QMAA7HH5.js} +2 -2
- package/dist/bundle/{embed-O7KMDYM7.js → embed-NFGFYUO4.js} +6 -6
- package/dist/bundle/{embedder-4PE67CLX.js → embedder-SRBOJMXX.js} +9 -9
- package/dist/bundle/{failure-NNQYTB3Z.js → failure-WDSX6H3B.js} +2 -2
- package/dist/bundle/{first-run-EAU5SHBI.js → first-run-HWRUL2GR.js} +12 -12
- package/dist/bundle/first-screen-ATN4D3FQ.js +41 -0
- package/dist/bundle/{instructions-ONXP5DZQ.js → instructions-4H7UREH2.js} +1 -1
- package/dist/bundle/{mcp-ZNULRPZ4.js → mcp-5HFPWC3W.js} +2 -2
- package/dist/bundle/meeting-combined-BGDEHCWY.js +26 -0
- package/dist/bundle/{meeting-model-FWIZRKVN.js → meeting-model-WWGVRXPL.js} +11 -11
- package/dist/bundle/{meeting-semantic-M4YVJ57W.js → meeting-semantic-ZQ47BL2Z.js} +6 -6
- package/dist/bundle/{node-UTQCYQF5.js → node-P3PUHKYH.js} +2 -2
- package/dist/bundle/{node-sqlite-APJG6MGL.js → node-sqlite-JOTSNH3P.js} +7 -7
- package/dist/bundle/{oauth-TY7RMIBL.js → oauth-XPSAL6VO.js} +7 -7
- package/dist/bundle/{open-WDVEQL75.js → open-PO52FVA5.js} +5 -5
- package/dist/bundle/{openai-H5UJHSEZ.js → openai-WITYLMY5.js} +15 -15
- package/dist/bundle/{process-MGMXXPMY.js → process-AFIXYXWL.js} +1 -1
- package/dist/bundle/{program-IF36C6VR.js → program-JODTZNBZ.js} +331 -196
- package/dist/bundle/{prompt-4RLIWLMF.js → prompt-XORLAXHY.js} +5 -5
- package/dist/bundle/{recognize-UIRTMWM4.js → recognize-JKMZHDYS.js} +4 -4
- package/dist/bundle/{remote-L3MNWZQK.js → remote-3IMEJTEH.js} +9 -9
- package/dist/bundle/{rerank-F4KZQTY6.js → rerank-3F2E6NNN.js} +7 -7
- package/dist/bundle/{serve-37AUYTWS.js → serve-6BWU3NMB.js} +9 -9
- package/dist/bundle/{server-UBG676ZJ.js → server-GPSB5WFG.js} +63 -61
- package/dist/bundle/server-HMCC64ZU.js +88 -0
- package/dist/bundle/source-E72OS27D.js +47 -0
- package/dist/bundle/{sqlite-runtime-CI3RW7VA.js → sqlite-runtime-YHYQDUXE.js} +6 -6
- package/dist/bundle/{state-JOHLSLUO.js → state-R7W4U6T4.js} +6 -6
- package/dist/bundle/{store-OSOUXBYL.js → store-HTVRL7FB.js} +56 -43
- package/dist/bundle/store-IWW6U6QN.js +34 -0
- package/dist/bundle/{store-2MBG4IUS.js → store-TBZ3ZS6H.js} +25 -23
- package/dist/bundle/store-maintenance-command-CJM2VLMW.js +75 -0
- package/dist/bundle/surface-5GBWNYBE.js +74 -0
- package/dist/bundle/writer-TW2Q55VJ.js +49 -0
- package/dist/commands/crm-shared.js +1 -1
- package/dist/commands/crm-shared.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +1 -6
- package/dist/commands/session.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/skills/amo-cli/SKILL.md +6 -0
- package/dist/bundle/agent-43BMVBX2.js +0 -40
- package/dist/bundle/chunk-2UJ7ZZZC.js +0 -79
- package/dist/bundle/chunk-FQRP6JWX.js +0 -29
- package/dist/bundle/chunk-IBEHYGG6.js +0 -721
- package/dist/bundle/chunk-M33XHJTM.js +0 -1266
- package/dist/bundle/chunk-S6DTLAOB.js +0 -761
- package/dist/bundle/command-contract-KWNCP3MQ.js +0 -39
- package/dist/bundle/first-screen-APSNGZYZ.js +0 -39
- package/dist/bundle/meeting-combined-W2XIYXFU.js +0 -24
- package/dist/bundle/server-CRF4QSZR.js +0 -86
- package/dist/bundle/source-Z7GH7T4B.js +0 -44
- package/dist/bundle/store-SNW6U32Y.js +0 -34
- package/dist/bundle/store-maintenance-command-W7V54SLT.js +0 -73
- package/dist/bundle/surface-ESJS2FUI.js +0 -72
- package/dist/bundle/writer-BJDQMKUV.js +0 -46
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
sameOrdinaryFile,
|
|
9
9
|
syncDirectory,
|
|
10
10
|
writeFileAtomic
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FFER7KJI.js";
|
|
12
12
|
import {
|
|
13
13
|
MAIL,
|
|
14
14
|
OWNER_NOTES,
|
|
@@ -18,23 +18,26 @@ import {
|
|
|
18
18
|
listContextOf,
|
|
19
19
|
listedAccounts,
|
|
20
20
|
newOperationId,
|
|
21
|
-
newSendId
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} from "./chunk-QGFURWEP.js";
|
|
21
|
+
newSendId,
|
|
22
|
+
refusedPlace,
|
|
23
|
+
uploadSize
|
|
24
|
+
} from "./chunk-FWRLGIF6.js";
|
|
26
25
|
import {
|
|
27
26
|
isNewer,
|
|
28
27
|
updateCommand
|
|
29
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-HOF7GQWW.js";
|
|
30
29
|
import {
|
|
31
30
|
capability
|
|
32
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-GVSKLZRD.js";
|
|
33
32
|
import {
|
|
34
33
|
LIST_QUERY_GUIDE,
|
|
35
34
|
dateWindow,
|
|
36
35
|
momentOf
|
|
37
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-G3N2RHGF.js";
|
|
37
|
+
import {
|
|
38
|
+
hide,
|
|
39
|
+
isHidden
|
|
40
|
+
} from "./chunk-HUAHLO6N.js";
|
|
38
41
|
import {
|
|
39
42
|
EmptyAnswer,
|
|
40
43
|
MAX_MODEL_IMAGE_BYTES,
|
|
@@ -43,7 +46,7 @@ import {
|
|
|
43
46
|
range,
|
|
44
47
|
systemFor,
|
|
45
48
|
validateImages
|
|
46
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-EXRM3ML4.js";
|
|
47
50
|
import {
|
|
48
51
|
anyOfTerms,
|
|
49
52
|
isFunctionWord,
|
|
@@ -54,16 +57,16 @@ import {
|
|
|
54
57
|
questionText,
|
|
55
58
|
resolveMeetingSelection,
|
|
56
59
|
words
|
|
57
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-6GE36KUE.js";
|
|
58
61
|
import {
|
|
59
62
|
DEFAULT_IMAGE_MODEL,
|
|
60
63
|
LINK,
|
|
61
64
|
WEIGHTS,
|
|
62
65
|
agenda,
|
|
63
|
-
ancestorValue,
|
|
64
66
|
attachment,
|
|
65
67
|
codeOf,
|
|
66
68
|
conversation,
|
|
69
|
+
deadlineMargin,
|
|
67
70
|
envName,
|
|
68
71
|
guardedWrite,
|
|
69
72
|
historyWindow,
|
|
@@ -73,11 +76,10 @@ import {
|
|
|
73
76
|
oddName,
|
|
74
77
|
parseDuration,
|
|
75
78
|
placedImage,
|
|
76
|
-
readOnlyLockOf,
|
|
77
79
|
sentIds,
|
|
78
80
|
tagging,
|
|
79
81
|
task
|
|
80
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-5SQTHOBI.js";
|
|
81
83
|
import {
|
|
82
84
|
CustomTextModelShape,
|
|
83
85
|
DEFAULT_RERANK_MODEL,
|
|
@@ -91,7 +93,7 @@ import {
|
|
|
91
93
|
textModels,
|
|
92
94
|
vectorModelKey,
|
|
93
95
|
writeTextModelsSection
|
|
94
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-LH6FJYMO.js";
|
|
95
97
|
import {
|
|
96
98
|
AGENDA_COLUMNS,
|
|
97
99
|
BUSINESS_FIND_MAX,
|
|
@@ -101,15 +103,13 @@ import {
|
|
|
101
103
|
CONTEXT_MAX_READ_BYTES,
|
|
102
104
|
CONVERSATION_COLUMNS,
|
|
103
105
|
MAIL_AGENDA_COLUMNS,
|
|
104
|
-
MAX_FILE_BYTES,
|
|
105
106
|
MAX_TEXT_CHARS,
|
|
106
107
|
MENTION_QUERY,
|
|
107
108
|
NOT_FILES,
|
|
108
109
|
PRESET_VERSION,
|
|
109
|
-
STOP_WORDS,
|
|
110
110
|
TASK_RELATION_KINDS,
|
|
111
111
|
TRACKED_CHAT_COLUMNS,
|
|
112
|
-
|
|
112
|
+
asBytes,
|
|
113
113
|
attachmentColumns,
|
|
114
114
|
attachmentMaxBytes,
|
|
115
115
|
calendarKey,
|
|
@@ -122,7 +122,6 @@ import {
|
|
|
122
122
|
correctWords,
|
|
123
123
|
cutChunks,
|
|
124
124
|
delayStats,
|
|
125
|
-
dueDayOf,
|
|
126
125
|
fetchedKey,
|
|
127
126
|
foldedWords,
|
|
128
127
|
googleDocumentLinks,
|
|
@@ -130,7 +129,6 @@ import {
|
|
|
130
129
|
hasText,
|
|
131
130
|
historyStartKey,
|
|
132
131
|
hitFiles,
|
|
133
|
-
inboxKey,
|
|
134
132
|
isStemmed,
|
|
135
133
|
matchDownloads,
|
|
136
134
|
messageOfEmail,
|
|
@@ -140,58 +138,69 @@ import {
|
|
|
140
138
|
profilesOn,
|
|
141
139
|
queryFilter,
|
|
142
140
|
rankingContextRange,
|
|
141
|
+
readWhole,
|
|
142
|
+
respelled,
|
|
143
|
+
sizeText,
|
|
143
144
|
threadConversation,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
DEFAULT_STEMMERS,
|
|
148
|
-
createStemmer,
|
|
149
|
-
cutsDeep
|
|
150
|
-
} from "./chunk-6QMSKJB4.js";
|
|
145
|
+
trackerBodyOf,
|
|
146
|
+
trackerTitleOf
|
|
147
|
+
} from "./chunk-SYRDEMQE.js";
|
|
151
148
|
import {
|
|
152
149
|
MINUTE,
|
|
153
150
|
YEAR,
|
|
154
151
|
aheadOf
|
|
155
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-JVBCQHCS.js";
|
|
156
153
|
import {
|
|
157
154
|
FIELD_VERSION,
|
|
158
155
|
RRF_K,
|
|
156
|
+
STOP_WORDS,
|
|
157
|
+
amountsOf,
|
|
158
|
+
dueDayOf,
|
|
159
159
|
fuseRanked,
|
|
160
|
+
inboxKey,
|
|
160
161
|
isPresence,
|
|
161
162
|
plainQuery,
|
|
162
163
|
validateAst,
|
|
163
|
-
validateFields
|
|
164
|
-
|
|
164
|
+
validateFields,
|
|
165
|
+
withoutField
|
|
166
|
+
} from "./chunk-DXWJORSY.js";
|
|
167
|
+
import {
|
|
168
|
+
DEFAULT_STEMMERS,
|
|
169
|
+
createStemmer,
|
|
170
|
+
cutsDeep
|
|
171
|
+
} from "./chunk-W3BOR6AT.js";
|
|
165
172
|
import {
|
|
166
|
-
TASK_KINDS,
|
|
167
|
-
TASK_STATES,
|
|
168
|
-
createTaskService,
|
|
169
173
|
entriesOfList,
|
|
170
174
|
fitting,
|
|
171
175
|
inSource,
|
|
172
|
-
isClosedState,
|
|
173
176
|
listedHolds,
|
|
174
177
|
sourceOf,
|
|
175
178
|
sourceOf3 as sourceOf2,
|
|
176
179
|
typedCommand,
|
|
177
180
|
withAttempt
|
|
178
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-PCR6GFNP.js";
|
|
179
182
|
import {
|
|
180
183
|
isCliFailure,
|
|
181
184
|
sqliteCode
|
|
182
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-3TYER5IK.js";
|
|
186
|
+
import {
|
|
187
|
+
TASK_KINDS,
|
|
188
|
+
TASK_STATES,
|
|
189
|
+
createTaskService,
|
|
190
|
+
isClosedState
|
|
191
|
+
} from "./chunk-IDCZ4LWS.js";
|
|
183
192
|
import {
|
|
184
193
|
localOnly,
|
|
185
194
|
refuseOffComputer,
|
|
186
195
|
remoteKey
|
|
187
|
-
} from "./chunk-
|
|
196
|
+
} from "./chunk-34ZOMVUK.js";
|
|
188
197
|
import {
|
|
189
198
|
PLAIN_HTTP_REFUSED,
|
|
190
199
|
endpoint,
|
|
191
200
|
endpointFetch,
|
|
192
201
|
modelAddressAllowed,
|
|
193
202
|
onThisComputer
|
|
194
|
-
} from "./chunk-
|
|
203
|
+
} from "./chunk-DY3PLWIH.js";
|
|
195
204
|
import {
|
|
196
205
|
Unzip,
|
|
197
206
|
UnzipInflate,
|
|
@@ -202,11 +211,11 @@ import {
|
|
|
202
211
|
placedText,
|
|
203
212
|
runEmbedders,
|
|
204
213
|
textModelsDirectory
|
|
205
|
-
} from "./chunk-
|
|
214
|
+
} from "./chunk-GRGCZSES.js";
|
|
206
215
|
import {
|
|
207
216
|
installFiles,
|
|
208
217
|
megabytes
|
|
209
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-UNWF3TH5.js";
|
|
210
219
|
import {
|
|
211
220
|
MAX_ACTIONS,
|
|
212
221
|
ModerationRules,
|
|
@@ -220,7 +229,7 @@ import {
|
|
|
220
229
|
someUndone,
|
|
221
230
|
validateFormattedText,
|
|
222
231
|
visibleFormattedText
|
|
223
|
-
} from "./chunk-
|
|
232
|
+
} from "./chunk-7CPIZFOE.js";
|
|
224
233
|
import {
|
|
225
234
|
COUNTER_FIELDS,
|
|
226
235
|
RANKING_TOKENIZER_VERSION,
|
|
@@ -237,7 +246,7 @@ import {
|
|
|
237
246
|
pickPerson,
|
|
238
247
|
rankingOptions,
|
|
239
248
|
rankingQuestion
|
|
240
|
-
} from "./chunk-
|
|
249
|
+
} from "./chunk-3J3EDSXF.js";
|
|
241
250
|
import {
|
|
242
251
|
MESSAGE_PARSING,
|
|
243
252
|
QUERY_LIMITS,
|
|
@@ -247,29 +256,30 @@ import {
|
|
|
247
256
|
isQueryLimit,
|
|
248
257
|
outOfTime,
|
|
249
258
|
searchError
|
|
250
|
-
} from "./chunk-
|
|
259
|
+
} from "./chunk-NSOY4FMN.js";
|
|
251
260
|
import {
|
|
252
261
|
fold,
|
|
253
262
|
normalize
|
|
254
|
-
} from "./chunk-
|
|
263
|
+
} from "./chunk-HO4JGD4Q.js";
|
|
264
|
+
import {
|
|
265
|
+
isUsable
|
|
266
|
+
} from "./chunk-MNPGZCKE.js";
|
|
255
267
|
import {
|
|
256
268
|
INTERNAL_NOTES,
|
|
257
269
|
UNKNOWN_PROVIDER,
|
|
258
270
|
formatLocator,
|
|
259
271
|
formatReference,
|
|
272
|
+
hasGlobalItemIds,
|
|
260
273
|
holdsKind,
|
|
261
274
|
isDocumentAccountProvider,
|
|
262
275
|
isFolderProvider,
|
|
263
276
|
isImportedProvider,
|
|
264
277
|
isLocator,
|
|
265
|
-
isUsable,
|
|
266
278
|
kindIn,
|
|
279
|
+
normalizeTag,
|
|
267
280
|
parseLocator,
|
|
268
281
|
parseReference
|
|
269
|
-
} from "./chunk-
|
|
270
|
-
import {
|
|
271
|
-
normalizeTag
|
|
272
|
-
} from "./chunk-FQRP6JWX.js";
|
|
282
|
+
} from "./chunk-PATZAYFZ.js";
|
|
273
283
|
import {
|
|
274
284
|
OPERATORS_BY_TYPE,
|
|
275
285
|
READ_BUDGET_EXCEEDED,
|
|
@@ -294,23 +304,22 @@ import {
|
|
|
294
304
|
validateQuery,
|
|
295
305
|
walkQuery,
|
|
296
306
|
windowOf
|
|
297
|
-
} from "./chunk-
|
|
307
|
+
} from "./chunk-YF3S26TS.js";
|
|
298
308
|
import {
|
|
299
309
|
DEFAULT_TASK_CATEGORIES,
|
|
300
310
|
FALLBACK_CATEGORY,
|
|
301
311
|
readSharedSection,
|
|
302
312
|
sharedConfigPath,
|
|
303
313
|
writeSharedSection
|
|
304
|
-
} from "./chunk-
|
|
314
|
+
} from "./chunk-QQRJEWKB.js";
|
|
305
315
|
import {
|
|
306
|
-
storePath
|
|
307
|
-
|
|
308
|
-
} from "./chunk-ZKRWNL4T.js";
|
|
316
|
+
storePath
|
|
317
|
+
} from "./chunk-ZCQ4H7CA.js";
|
|
309
318
|
import {
|
|
310
319
|
Credentials,
|
|
311
320
|
pathsAreOverridden,
|
|
312
321
|
resolvePaths
|
|
313
|
-
} from "./chunk-
|
|
322
|
+
} from "./chunk-WIHN3ELW.js";
|
|
314
323
|
import {
|
|
315
324
|
array,
|
|
316
325
|
check,
|
|
@@ -336,7 +345,7 @@ import {
|
|
|
336
345
|
trim,
|
|
337
346
|
union,
|
|
338
347
|
unknown
|
|
339
|
-
} from "./chunk-
|
|
348
|
+
} from "./chunk-QFOP3KUP.js";
|
|
340
349
|
import {
|
|
341
350
|
importFrom,
|
|
342
351
|
resolveFrom
|
|
@@ -345,7 +354,7 @@ import {
|
|
|
345
354
|
CliError,
|
|
346
355
|
isCliError,
|
|
347
356
|
singleLine
|
|
348
|
-
} from "./chunk-
|
|
357
|
+
} from "./chunk-S6JG4YUH.js";
|
|
349
358
|
import {
|
|
350
359
|
__commonJS,
|
|
351
360
|
__name,
|
|
@@ -13075,7 +13084,7 @@ var require_lib2 = __commonJS({
|
|
|
13075
13084
|
return matches;
|
|
13076
13085
|
}, "analyse");
|
|
13077
13086
|
exports.analyse = analyse2;
|
|
13078
|
-
var detectFile = /* @__PURE__ */ __name((filepath, opts = {}) => new Promise((
|
|
13087
|
+
var detectFile = /* @__PURE__ */ __name((filepath, opts = {}) => new Promise((resolve6, reject) => {
|
|
13079
13088
|
let fd;
|
|
13080
13089
|
const fs = (0, node_1.default)();
|
|
13081
13090
|
const handler = /* @__PURE__ */ __name((err, buffer) => {
|
|
@@ -13085,7 +13094,7 @@ var require_lib2 = __commonJS({
|
|
|
13085
13094
|
if (err) {
|
|
13086
13095
|
reject(err);
|
|
13087
13096
|
} else if (buffer) {
|
|
13088
|
-
|
|
13097
|
+
resolve6((0, exports.detect)(buffer));
|
|
13089
13098
|
} else {
|
|
13090
13099
|
reject(new Error("No error and no buffer received"));
|
|
13091
13100
|
}
|
|
@@ -16961,10 +16970,26 @@ var require_lib3 = __commonJS({
|
|
|
16961
16970
|
}
|
|
16962
16971
|
});
|
|
16963
16972
|
|
|
16964
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16973
|
+
// 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/http/time-limit.js
|
|
16974
|
+
var timeLimit = /* @__PURE__ */ __name((ms) => {
|
|
16975
|
+
const controller = new AbortController();
|
|
16976
|
+
const timer = setTimeout(() => controller.abort(new DOMException("The operation timed out.", "TimeoutError")), ms);
|
|
16977
|
+
timer.unref();
|
|
16978
|
+
return { signal: controller.signal, clear: /* @__PURE__ */ __name(() => clearTimeout(timer), "clear") };
|
|
16979
|
+
}, "timeLimit");
|
|
16980
|
+
var withTimeLimit = /* @__PURE__ */ __name(async (ms, run2) => {
|
|
16981
|
+
const limit = timeLimit(ms);
|
|
16982
|
+
try {
|
|
16983
|
+
return await run2(limit.signal);
|
|
16984
|
+
} finally {
|
|
16985
|
+
limit.clear();
|
|
16986
|
+
}
|
|
16987
|
+
}, "withTimeLimit");
|
|
16988
|
+
|
|
16989
|
+
// 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/ports/traits.js
|
|
16965
16990
|
var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
|
|
16966
16991
|
|
|
16967
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16992
|
+
// 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/services/questions.js
|
|
16968
16993
|
var LINKS = /https?:\/\/\S+/g;
|
|
16969
16994
|
var unanswered = /* @__PURE__ */ __name((messages, { answerers: answerers2, before }) => questions(messages, { answerers: answerers2 }).filter(({ question, answer }) => answer === void 0 && Date.parse(question.timestamp) < before).map(({ question }) => question), "unanswered");
|
|
16970
16995
|
var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker = "others" }) => {
|
|
@@ -16994,7 +17019,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker
|
|
|
16994
17019
|
});
|
|
16995
17020
|
}, "questions");
|
|
16996
17021
|
|
|
16997
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17022
|
+
// 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/services/task-categories.js
|
|
16998
17023
|
var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
|
|
16999
17024
|
var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
|
|
17000
17025
|
const name = typed.trim().toLowerCase();
|
|
@@ -17051,7 +17076,7 @@ var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGO
|
|
|
17051
17076
|
return best.name;
|
|
17052
17077
|
}, "categorize");
|
|
17053
17078
|
|
|
17054
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17079
|
+
// 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/services/task-rules.js
|
|
17055
17080
|
var taskAccount = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "taskAccount");
|
|
17056
17081
|
var RULES_IN = {
|
|
17057
17082
|
dialog: "all",
|
|
@@ -17077,7 +17102,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account, now
|
|
|
17077
17102
|
const owner = taskAccount(account);
|
|
17078
17103
|
const result = { added: 0, closed: 0, review: 0 };
|
|
17079
17104
|
const sourceOf3 = /* @__PURE__ */ __name((message) => formatLocator({ provider: account.provider, account: account.account, chat: message.chatId, message: message.id }), "sourceOf");
|
|
17080
|
-
const
|
|
17105
|
+
const open6 = /* @__PURE__ */ __name(async (message, group, kind) => {
|
|
17081
17106
|
const { created, review: review2 = 0 } = await tasks.add({
|
|
17082
17107
|
source: sourceOf3(message),
|
|
17083
17108
|
sourceKind: "message",
|
|
@@ -17134,7 +17159,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account, now
|
|
|
17134
17159
|
let held = 0;
|
|
17135
17160
|
for (const [index, { message, kind }] of opens.entries()) {
|
|
17136
17161
|
if (index >= opens.length - keep2)
|
|
17137
|
-
await
|
|
17162
|
+
await open6(message, chat.id, kind);
|
|
17138
17163
|
else if (!await hasTask(message)) {
|
|
17139
17164
|
held += 1;
|
|
17140
17165
|
onHeld?.({ source: sourceOf3(message), kind, category: categorize(message.text, categories) });
|
|
@@ -17257,7 +17282,7 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account, chatId
|
|
|
17257
17282
|
return passes;
|
|
17258
17283
|
}, "applyTaskRulesToChats");
|
|
17259
17284
|
|
|
17260
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17285
|
+
// 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/conversations/link.js
|
|
17261
17286
|
var RULES_VERSION = 6;
|
|
17262
17287
|
var LOOK_BACK = 50;
|
|
17263
17288
|
var SAME_SENDER_WITHIN = 10;
|
|
@@ -17355,223 +17380,7 @@ var latest = /* @__PURE__ */ __name((window2, matches) => {
|
|
|
17355
17380
|
var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
|
|
17356
17381
|
var link = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
|
|
17357
17382
|
|
|
17358
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17359
|
-
import { openAsBlob, realpathSync } from "node:fs";
|
|
17360
|
-
import { open, stat } from "node:fs/promises";
|
|
17361
|
-
import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
17362
|
-
var MAX_BUFFERED_UPLOAD_BYTES = 256 * 1024 * 1024;
|
|
17363
|
-
var uploadSize = /* @__PURE__ */ __name((source) => source.kind === "file" ? source.size : source.bytes.byteLength, "uploadSize");
|
|
17364
|
-
var PHOTO = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp"]);
|
|
17365
|
-
var VOICE = /* @__PURE__ */ new Set([".ogg", ".oga", ".opus"]);
|
|
17366
|
-
var JPEG = /* @__PURE__ */ __name((head) => head[0] === 255 && head[1] === 216 && head[2] === 255, "JPEG");
|
|
17367
|
-
var SIGNATURES = {
|
|
17368
|
-
".jpg": JPEG,
|
|
17369
|
-
".jpeg": JPEG,
|
|
17370
|
-
".png": /* @__PURE__ */ __name((head) => Buffer.from(head.subarray(0, 8)).toString("latin1") === "\x89PNG\r\n\n", ".png"),
|
|
17371
|
-
".webp": /* @__PURE__ */ __name((head) => {
|
|
17372
|
-
const text2 = Buffer.from(head).toString("latin1");
|
|
17373
|
-
return text2.startsWith("RIFF") && text2.slice(8, 12) === "WEBP";
|
|
17374
|
-
}, ".webp")
|
|
17375
|
-
};
|
|
17376
|
-
var fileHead = /* @__PURE__ */ __name(async (path) => {
|
|
17377
|
-
const file = await open(path, "r");
|
|
17378
|
-
try {
|
|
17379
|
-
const head = new Uint8Array(12);
|
|
17380
|
-
const { bytesRead } = await file.read(head, 0, head.length, 0);
|
|
17381
|
-
return head.subarray(0, bytesRead);
|
|
17382
|
-
} finally {
|
|
17383
|
-
await file.close();
|
|
17384
|
-
}
|
|
17385
|
-
}, "fileHead");
|
|
17386
|
-
var typesText = /* @__PURE__ */ __name((types2) => types2.length < 2 ? types2[0] ?? "" : `${types2.slice(0, -1).join(", ")} or ${types2.at(-1)}`, "typesText");
|
|
17387
|
-
var CREDENTIAL_PARTS = /* @__PURE__ */ new Set([
|
|
17388
|
-
".ssh",
|
|
17389
|
-
".gnupg",
|
|
17390
|
-
".aws",
|
|
17391
|
-
".azure",
|
|
17392
|
-
".kube",
|
|
17393
|
-
".secrets",
|
|
17394
|
-
"secrets",
|
|
17395
|
-
".password-store",
|
|
17396
|
-
".mozilla",
|
|
17397
|
-
".env",
|
|
17398
|
-
".npmrc",
|
|
17399
|
-
".pypirc",
|
|
17400
|
-
".netrc",
|
|
17401
|
-
"_netrc",
|
|
17402
|
-
".git-credentials",
|
|
17403
|
-
"credentials.yml.enc",
|
|
17404
|
-
"master.key"
|
|
17405
|
-
]);
|
|
17406
|
-
var CREDENTIAL_RUNS = [
|
|
17407
|
-
[".config", "autostart"],
|
|
17408
|
-
[".config", "git", "credentials"],
|
|
17409
|
-
[".config", "gh"],
|
|
17410
|
-
[".config", "gcloud"],
|
|
17411
|
-
[".config", "google-chrome"],
|
|
17412
|
-
[".config", "chromium"],
|
|
17413
|
-
[".config", "microsoft-edge"],
|
|
17414
|
-
[".config", "BraveSoftware"],
|
|
17415
|
-
[".docker", "config.json"],
|
|
17416
|
-
[".claude", ".credentials.json"],
|
|
17417
|
-
[".codex", "auth.json"],
|
|
17418
|
-
[".local", "share", "keyrings"],
|
|
17419
|
-
["Library", "Keychains"],
|
|
17420
|
-
["Library", "Cookies"],
|
|
17421
|
-
["Library", "Safari"],
|
|
17422
|
-
["Library", "Application Support", "Google", "Chrome"],
|
|
17423
|
-
["Library", "Application Support", "Chromium"],
|
|
17424
|
-
["Library", "Application Support", "Microsoft Edge"],
|
|
17425
|
-
["Library", "Application Support", "BraveSoftware"],
|
|
17426
|
-
["Library", "Application Support", "Firefox"],
|
|
17427
|
-
["AppData", "Local", "Google", "Chrome"],
|
|
17428
|
-
["AppData", "Local", "Chromium"],
|
|
17429
|
-
["AppData", "Local", "Microsoft", "Edge"],
|
|
17430
|
-
["AppData", "Local", "BraveSoftware"],
|
|
17431
|
-
["AppData", "Roaming", "Mozilla", "Firefox"],
|
|
17432
|
-
["AppData", "Local", "Microsoft", "Credentials"],
|
|
17433
|
-
["AppData", "Roaming", "Microsoft", "Credentials"],
|
|
17434
|
-
["AppData", "Roaming", "Microsoft", "Protect"],
|
|
17435
|
-
["AppData", "Roaming", "gcloud"],
|
|
17436
|
-
["AppData", "Roaming", "GitHub CLI"]
|
|
17437
|
-
];
|
|
17438
|
-
var WIRECAT_APPS = [
|
|
17439
|
-
...WIRECAT_TOOLS.map(({ appName, envPrefix }) => ({ appName, prefix: envPrefix })),
|
|
17440
|
-
{ appName: "beeline-cli", prefix: "BEELINE" },
|
|
17441
|
-
{ appName: "zm", prefix: "ZM" },
|
|
17442
|
-
{ appName: "cli-messaging", prefix: "MESSAGING" },
|
|
17443
|
-
{ appName: "cli-common", prefix: "CLI_COMMON" }
|
|
17444
|
-
];
|
|
17445
|
-
var SYSTEM_ROOTS = ["/proc", "/sys", "/dev"];
|
|
17446
|
-
var systemPlace = /* @__PURE__ */ __name((path, platform) => platform !== "win32" && SYSTEM_ROOTS.some((root) => inside(path, root)), "systemPlace");
|
|
17447
|
-
var realPathOf = /* @__PURE__ */ __name((path) => {
|
|
17448
|
-
let ancestor = resolve(path);
|
|
17449
|
-
for (; ; ) {
|
|
17450
|
-
try {
|
|
17451
|
-
return resolve(realpathSync(ancestor), relative(ancestor, resolve(path)));
|
|
17452
|
-
} catch {
|
|
17453
|
-
const parent = dirname(ancestor);
|
|
17454
|
-
if (parent === ancestor)
|
|
17455
|
-
return resolve(path);
|
|
17456
|
-
ancestor = parent;
|
|
17457
|
-
}
|
|
17458
|
-
}
|
|
17459
|
-
}, "realPathOf");
|
|
17460
|
-
var refuseLockedOutput = /* @__PURE__ */ __name((path, app, env, flag) => {
|
|
17461
|
-
const lock = readOnlyLockOf(app, env);
|
|
17462
|
-
if (lock === void 0)
|
|
17463
|
-
return;
|
|
17464
|
-
const named2 = ancestorValue(envName(app, "WORK_FOLDER"), env);
|
|
17465
|
-
const work = named2 ? realPathOf(named2) : void 0;
|
|
17466
|
-
const real = realPathOf(path);
|
|
17467
|
-
if (work !== void 0 && (real === work || real.startsWith(`${work}${sep}`)))
|
|
17468
|
-
return;
|
|
17469
|
-
throw new CliError("permission_error", work === void 0 ? `this process is read-only (${lock}) \u2014 ${flag} writes a file only inside a scheduled run's work folder` : `this process is read-only (${lock}) \u2014 ${flag} writes only inside its run's work folder, ${work}`, { reason: "read-only.output-outside", param: flag });
|
|
17470
|
-
}, "refuseLockedOutput");
|
|
17471
|
-
var refusedPlace = /* @__PURE__ */ __name((path, app, env, platform = process.platform) => {
|
|
17472
|
-
const own = [
|
|
17473
|
-
...[{ appName: app.appName, prefix: app.envPrefix }, ...WIRECAT_APPS].flatMap((one) => Object.values(resolvePaths({ ...one, env, platform }))),
|
|
17474
|
-
// The shared WireCat folder: the store, its backups beside it, the models.
|
|
17475
|
-
wirecatDirectory(env, platform)
|
|
17476
|
-
];
|
|
17477
|
-
const store = resolve(storePath(env));
|
|
17478
|
-
const real = realPathOf(path);
|
|
17479
|
-
const folded = platform === "darwin" || platform === "win32";
|
|
17480
|
-
const fold2 = /* @__PURE__ */ __name((text2) => folded ? text2.toLowerCase() : text2, "fold");
|
|
17481
|
-
const parts = new Set([...CREDENTIAL_PARTS].map(fold2));
|
|
17482
|
-
const runs = CREDENTIAL_RUNS.map((run2) => run2.map(fold2));
|
|
17483
|
-
const named2 = /* @__PURE__ */ __name((candidate) => {
|
|
17484
|
-
const names2 = candidate.split(sep).map(fold2);
|
|
17485
|
-
return names2.some((name, index) => parts.has(name) || /^\.env\./.test(name) || runs.some((run2) => run2.every((part, offset) => names2[index + offset] === part)));
|
|
17486
|
-
}, "named");
|
|
17487
|
-
const same2 = /* @__PURE__ */ __name((a, b) => fold2(a) === fold2(b), "same");
|
|
17488
|
-
return [resolve(path), real].some((candidate) => systemPlace(candidate, platform) || named2(candidate) || own.some((dir) => inside(fold2(candidate), fold2(dir))) || [store, `${store}-wal`, `${store}-shm`].some((file) => same2(candidate, file)));
|
|
17489
|
-
}, "refusedPlace");
|
|
17490
|
-
var inside = /* @__PURE__ */ __name((path, dir) => {
|
|
17491
|
-
const way = relative(resolve(dir), path);
|
|
17492
|
-
return way === "" || !way.startsWith("..") && !isAbsolute(way);
|
|
17493
|
-
}, "inside");
|
|
17494
|
-
var readUpload = /* @__PURE__ */ __name(async (kind, path, { app, env = process.env, anyFile = false, photoTypes }) => {
|
|
17495
|
-
const extension = extname(path).toLowerCase();
|
|
17496
|
-
if (kind === "photo" && photoTypes !== void 0 && !photoTypes.includes(extension)) {
|
|
17497
|
-
throw new CliError("validation_error", `this photo must be a ${typesText(photoTypes)} file, not ${path}`);
|
|
17498
|
-
}
|
|
17499
|
-
if (kind === "photo" && photoTypes === void 0 && !PHOTO.has(extension)) {
|
|
17500
|
-
throw new CliError("validation_error", `a photo is a .jpg, .png or .webp \u2014 send ${path} as a file instead`);
|
|
17501
|
-
}
|
|
17502
|
-
if (kind === "voice" && !VOICE.has(extension)) {
|
|
17503
|
-
throw new CliError("validation_error", `a voice message is Ogg Opus: .ogg, .oga or .opus \u2014 send ${path} as a file`);
|
|
17504
|
-
}
|
|
17505
|
-
if ([resolve(path), realPathOf(path)].some((candidate) => systemPlace(candidate, process.platform))) {
|
|
17506
|
-
throw new CliError("validation_error", `cannot send ${path}: a file under /proc, /sys or /dev is never sent`);
|
|
17507
|
-
}
|
|
17508
|
-
if (!anyFile && refusedPlace(path, app, env)) {
|
|
17509
|
-
throw new CliError("validation_error", `cannot send ${path}: known credential files, browser profiles, the WireCat apps' folders and the message store are not sent \u2014 the owner adds --allow-any-file to the command if this file is meant to go`);
|
|
17510
|
-
}
|
|
17511
|
-
let size2;
|
|
17512
|
-
let head;
|
|
17513
|
-
try {
|
|
17514
|
-
const info = await stat(path);
|
|
17515
|
-
if (!info.isFile())
|
|
17516
|
-
throw Object.assign(new Error("not a file"), { code: "EISDIR" });
|
|
17517
|
-
size2 = info.size;
|
|
17518
|
-
if (photoTypes !== void 0 && SIGNATURES[extension] !== void 0)
|
|
17519
|
-
head = await fileHead(path);
|
|
17520
|
-
} catch (error) {
|
|
17521
|
-
const code = error.code;
|
|
17522
|
-
const reason = code === "ENOENT" ? "no such file" : code === "EISDIR" ? "it is a folder" : "it cannot be read";
|
|
17523
|
-
throw new CliError("validation_error", `cannot send ${path}: ${reason}`);
|
|
17524
|
-
}
|
|
17525
|
-
if (head !== void 0 && SIGNATURES[extension]?.(head) !== true) {
|
|
17526
|
-
throw new CliError("validation_error", `${path} is not a ${typesText(photoTypes ?? [])} image inside`);
|
|
17527
|
-
}
|
|
17528
|
-
return { kind, name: basename(path), source: { kind: "file", path: resolve(path), size: size2 } };
|
|
17529
|
-
}, "readUpload");
|
|
17530
|
-
var checkFilename = /* @__PURE__ */ __name((filename, files) => {
|
|
17531
|
-
if (files.length === 0)
|
|
17532
|
-
throw new CliError("validation_error", "--filename names a --file; give one");
|
|
17533
|
-
if (files.length > 1)
|
|
17534
|
-
throw new CliError("validation_error", "--filename names one --file; an album keeps its names");
|
|
17535
|
-
if (filename.trim() === "" || /[/\\\0]/.test(filename) || filename.length > 255)
|
|
17536
|
-
throw new CliError("validation_error", "--filename is a name, not a path: no / or \\, at most 255 characters");
|
|
17537
|
-
}, "checkFilename");
|
|
17538
|
-
var listOf = /* @__PURE__ */ __name((value) => value === void 0 ? [] : typeof value === "string" ? [value] : value, "listOf");
|
|
17539
|
-
var readAttachments = /* @__PURE__ */ __name(async ({ photo, file, voice, asFile, filename, text: text2 }, read) => {
|
|
17540
|
-
const photos = listOf(photo);
|
|
17541
|
-
const files = listOf(file);
|
|
17542
|
-
if (voice !== void 0 && (photos.length > 0 || files.length > 0 || (text2 ?? "").trim() !== "")) {
|
|
17543
|
-
throw new CliError("validation_error", "a voice message goes alone \u2014 no text, no file, no photo beside it");
|
|
17544
|
-
}
|
|
17545
|
-
if (asFile && files.length === 0)
|
|
17546
|
-
throw new CliError("validation_error", "--as-file is about a --file; give one");
|
|
17547
|
-
if (filename !== void 0)
|
|
17548
|
-
checkFilename(filename, files);
|
|
17549
|
-
const uploads = [];
|
|
17550
|
-
for (const one of photos)
|
|
17551
|
-
uploads.push(await readUpload("photo", one, read));
|
|
17552
|
-
for (const one of files)
|
|
17553
|
-
uploads.push({
|
|
17554
|
-
...await readUpload("file", one, read),
|
|
17555
|
-
...filename === void 0 ? {} : { name: filename },
|
|
17556
|
-
...asFile ? { asFile: true } : {}
|
|
17557
|
-
});
|
|
17558
|
-
if (voice !== void 0)
|
|
17559
|
-
uploads.push(await readUpload("voice", voice, read));
|
|
17560
|
-
return uploads;
|
|
17561
|
-
}, "readAttachments");
|
|
17562
|
-
var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
|
|
17563
|
-
if (extname(path).toLowerCase() !== ".webp")
|
|
17564
|
-
throw new CliError("validation_error", `a sticker is a .webp \u2014 send ${path} as a photo or a file instead`);
|
|
17565
|
-
const { name, source } = await readUpload("file", path, read);
|
|
17566
|
-
if (SIGNATURES[".webp"]?.(await fileHead(path)) !== true)
|
|
17567
|
-
throw new CliError("validation_error", `${path} is named .webp but is not a WebP image \u2014 nothing was sent`);
|
|
17568
|
-
const size2 = uploadSize(source);
|
|
17569
|
-
if (size2 > maxBytes)
|
|
17570
|
-
throw new CliError("validation_error", `the sticker is ${Math.ceil(size2 / 1024)} KiB, and this messenger takes at most ${Math.floor(maxBytes / 1024)} KiB \u2014 nothing was sent`);
|
|
17571
|
-
return { name, source };
|
|
17572
|
-
}, "readStickerFile");
|
|
17573
|
-
|
|
17574
|
-
// 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/services/deps.js
|
|
17383
|
+
// 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/services/deps.js
|
|
17575
17384
|
var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
|
|
17576
17385
|
var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
|
|
17577
17386
|
var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
|
|
@@ -17633,7 +17442,7 @@ var storedDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({
|
|
|
17633
17442
|
}), "storedDeps");
|
|
17634
17443
|
var storeModeDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({ ...storedDeps(messenger, store, account, guard), offline: false, reads: "store" }), "storeModeDeps");
|
|
17635
17444
|
|
|
17636
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17445
|
+
// 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/botcheck/check.js
|
|
17637
17446
|
var DAY_MS = 864e5;
|
|
17638
17447
|
var NEW_DAYS = 30;
|
|
17639
17448
|
var SAME_TEXT_MIN = 20;
|
|
@@ -17710,23 +17519,7 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
|
|
|
17710
17519
|
};
|
|
17711
17520
|
}, "scorePerson");
|
|
17712
17521
|
|
|
17713
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17714
|
-
var timeLimit = /* @__PURE__ */ __name((ms) => {
|
|
17715
|
-
const controller = new AbortController();
|
|
17716
|
-
const timer = setTimeout(() => controller.abort(new DOMException("The operation timed out.", "TimeoutError")), ms);
|
|
17717
|
-
timer.unref();
|
|
17718
|
-
return { signal: controller.signal, clear: /* @__PURE__ */ __name(() => clearTimeout(timer), "clear") };
|
|
17719
|
-
}, "timeLimit");
|
|
17720
|
-
var withTimeLimit = /* @__PURE__ */ __name(async (ms, run2) => {
|
|
17721
|
-
const limit = timeLimit(ms);
|
|
17722
|
-
try {
|
|
17723
|
-
return await run2(limit.signal);
|
|
17724
|
-
} finally {
|
|
17725
|
-
limit.clear();
|
|
17726
|
-
}
|
|
17727
|
-
}, "withTimeLimit");
|
|
17728
|
-
|
|
17729
|
-
// 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/botcheck/registries.js
|
|
17522
|
+
// 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/botcheck/registries.js
|
|
17730
17523
|
var REGISTRIES = {
|
|
17731
17524
|
cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
|
|
17732
17525
|
lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
|
|
@@ -17813,7 +17606,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
|
|
|
17813
17606
|
detail: `lists Telegram accounts only, not ${messenger} ones`
|
|
17814
17607
|
})), "notCovered");
|
|
17815
17608
|
|
|
17816
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17609
|
+
// 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/botcheck/service.js
|
|
17817
17610
|
var ACTIVITY_MESSAGES = 1e3;
|
|
17818
17611
|
var botCheckService = /* @__PURE__ */ __name((deps) => {
|
|
17819
17612
|
const subjectOf = /* @__PURE__ */ __name(async (reference) => {
|
|
@@ -17901,7 +17694,7 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
|
|
|
17901
17694
|
};
|
|
17902
17695
|
}, "botCheckService");
|
|
17903
17696
|
|
|
17904
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17697
|
+
// 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/domain/thread.js
|
|
17905
17698
|
var threadIdOf = /* @__PURE__ */ __name((value) => {
|
|
17906
17699
|
if (value === void 0)
|
|
17907
17700
|
return void 0;
|
|
@@ -17911,7 +17704,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
|
|
|
17911
17704
|
return id2;
|
|
17912
17705
|
}, "threadIdOf");
|
|
17913
17706
|
|
|
17914
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17707
|
+
// 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/services/chat-stats.js
|
|
17915
17708
|
var TOP_POSTS = 5;
|
|
17916
17709
|
var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
|
|
17917
17710
|
var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
|
|
@@ -18028,7 +17821,7 @@ var median = /* @__PURE__ */ __name((values) => {
|
|
|
18028
17821
|
return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
|
|
18029
17822
|
}, "median");
|
|
18030
17823
|
|
|
18031
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17824
|
+
// 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/services/member-history.js
|
|
18032
17825
|
var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
|
|
18033
17826
|
const events = [];
|
|
18034
17827
|
for (const stay of stays) {
|
|
@@ -18060,7 +17853,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
|
|
|
18060
17853
|
return events.filter(({ at }) => Date.parse(at) >= since).sort((a, b) => Date.parse(a.at) - Date.parse(b.at) || a.id.localeCompare(b.id));
|
|
18061
17854
|
}, "memberEvents");
|
|
18062
17855
|
|
|
18063
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17856
|
+
// 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/services/members-audit.js
|
|
18064
17857
|
var AUDIT_PAGE = 200;
|
|
18065
17858
|
var AUDIT_BUDGET = 10;
|
|
18066
17859
|
var AUDIT_PAUSE_MS = 1e3;
|
|
@@ -18140,7 +17933,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
|
|
|
18140
17933
|
return found;
|
|
18141
17934
|
}, "burstJoins");
|
|
18142
17935
|
|
|
18143
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17936
|
+
// 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/services/message-resolution.js
|
|
18144
17937
|
var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account) => {
|
|
18145
17938
|
if (deps.reads !== "store")
|
|
18146
17939
|
return keptChatId(deps.messenger, reference, store, account);
|
|
@@ -18305,9 +18098,9 @@ var senderAmong = /* @__PURE__ */ __name(async (store, accounts, reference, fiel
|
|
|
18305
18098
|
var MOST_NAME_MATCHES = 50;
|
|
18306
18099
|
var patternRefused = /* @__PURE__ */ __name((field, pattern, what, found, near2) => {
|
|
18307
18100
|
if (found === 0) {
|
|
18308
|
-
const
|
|
18101
|
+
const inside = `*${pattern.replace(/^\*+|\*+$/gu, "")}*`;
|
|
18309
18102
|
const [closest] = near2;
|
|
18310
|
-
throw new CliError("not_found", `${field}:${pattern} \u2014 no ${what} fits${near2.length ? `; near: ${near2.map(({ label }) => label).join(", ")}` : ""} \u2014 a pattern matches the whole name: ${pattern ===
|
|
18103
|
+
throw new CliError("not_found", `${field}:${pattern} \u2014 no ${what} fits${near2.length ? `; near: ${near2.map(({ label }) => label).join(", ")}` : ""} \u2014 a pattern matches the whole name: ${pattern === inside ? "" : `write ${field}:${inside} for a part of it, or `}the name: ${field}:${JSON.stringify(closest?.label ?? pattern.replace(/[*?]/gu, ""))}`, { reason: "query.no-match", candidates: near2.map(({ candidate }) => candidate) });
|
|
18311
18104
|
}
|
|
18312
18105
|
throw new CliError("validation_error", `${field}:${pattern} fits ${found} ${what}, more than ${MOST_NAME_MATCHES} \u2014 write more of the name`, { reason: "query.too-large", budget: "name matches", limit: MOST_NAME_MATCHES, complete: false });
|
|
18313
18106
|
}, "patternRefused");
|
|
@@ -18341,7 +18134,7 @@ var chatsMatchingIn = /* @__PURE__ */ __name(async (store, accounts, pattern) =>
|
|
|
18341
18134
|
}, "chatsMatchingIn");
|
|
18342
18135
|
var isText = /* @__PURE__ */ __name((value) => typeof value === "string" && value !== "", "isText");
|
|
18343
18136
|
|
|
18344
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18137
|
+
// 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/services/chats.js
|
|
18345
18138
|
var EVENTS_DAYS = 7;
|
|
18346
18139
|
var TRACKED_DAYS = 30;
|
|
18347
18140
|
var STATS_PAGE = 1e3;
|
|
@@ -18365,7 +18158,7 @@ var deepChecks = /* @__PURE__ */ __name(async (deps, items, deep, pauseMs, regis
|
|
|
18365
18158
|
continue;
|
|
18366
18159
|
}
|
|
18367
18160
|
if (index > 0)
|
|
18368
|
-
await new Promise((
|
|
18161
|
+
await new Promise((resolve6) => setTimeout(resolve6, pauseMs));
|
|
18369
18162
|
const { score, reasons, registries, unknown: unknown3 } = await checks.person(item2.id, {
|
|
18370
18163
|
registries: true,
|
|
18371
18164
|
...registry ? { registry } : {}
|
|
@@ -18577,8 +18370,8 @@ var readInStore = /* @__PURE__ */ __name(async (deps, chatId, kind, until) => {
|
|
|
18577
18370
|
const store = await accountStoreIfOpen(deps);
|
|
18578
18371
|
if (!store)
|
|
18579
18372
|
return;
|
|
18580
|
-
const [
|
|
18581
|
-
if (
|
|
18373
|
+
const [newest2] = (await store.messages.messages(chatId, { limit: 1, outgoing: false })).items;
|
|
18374
|
+
if (newest2 !== void 0 && (until === void 0 || newest2.id === until))
|
|
18582
18375
|
await unlessBusy(() => store.chats.saveChats([{ id: chatId, kind, unreadCount: 0, markedUnread: false }]));
|
|
18583
18376
|
}, "readInStore");
|
|
18584
18377
|
var storedFacts = /* @__PURE__ */ __name(async (store, chatId) => {
|
|
@@ -18622,7 +18415,7 @@ var readMembers = /* @__PURE__ */ __name(async (connection, chat, budget, pauseM
|
|
|
18622
18415
|
let more = true;
|
|
18623
18416
|
for (let page = 0; page < budget && more; page++) {
|
|
18624
18417
|
if (page > 0)
|
|
18625
|
-
await new Promise((
|
|
18418
|
+
await new Promise((resolve6) => setTimeout(resolve6, pauseMs));
|
|
18626
18419
|
const found = await members(chatId ?? chat, { limit: AUDIT_PAGE, offset: read.length });
|
|
18627
18420
|
chatId = found.chatId;
|
|
18628
18421
|
participants = found.participantsCount ?? participants;
|
|
@@ -18636,7 +18429,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
|
|
|
18636
18429
|
return members.length === 0 ? null : members;
|
|
18637
18430
|
}, "storedMembers");
|
|
18638
18431
|
|
|
18639
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18432
|
+
// 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/services/inbox.js
|
|
18640
18433
|
var INBOX_CHATS = 20;
|
|
18641
18434
|
var REVIEW_DAYS = 3;
|
|
18642
18435
|
var UNANSWERED_HOURS = 24;
|
|
@@ -18644,12 +18437,13 @@ var reviewStart = /* @__PURE__ */ __name((now = Date.now()) => now - REVIEW_DAYS
|
|
|
18644
18437
|
var byRecency = /* @__PURE__ */ __name((chats) => chats.toSorted((a, b) => Date.parse(b.lastMessageAt ?? "") - Date.parse(a.lastMessageAt ?? "")), "byRecency");
|
|
18645
18438
|
var isQuiet = /* @__PURE__ */ __name((chat) => (chat.muted === true || chat.archived === true) && (chat.unreadMentions ?? 0) === 0 && chat.markedUnread !== true, "isQuiet");
|
|
18646
18439
|
var heard = /* @__PURE__ */ __name((chats, all) => all ? { heard: chats, quiet: 0 } : { heard: chats.filter((chat) => !isQuiet(chat)), quiet: chats.filter(isQuiet).length }, "heard");
|
|
18647
|
-
var everyChat = /* @__PURE__ */ __name((adapter) => adapter.chats({ offset: 0 }), "everyChat");
|
|
18440
|
+
var everyChat = /* @__PURE__ */ __name((adapter) => adapter.unreadChats ? adapter.unreadChats() : adapter.chats({ offset: 0 }), "everyChat");
|
|
18441
|
+
var leftOf = /* @__PURE__ */ __name((page) => page.left?.length ? { left: page.left } : {}, "leftOf");
|
|
18648
18442
|
var storeReader = /* @__PURE__ */ __name((deps, store, account) => ({
|
|
18649
18443
|
chats: /* @__PURE__ */ __name(async ({ limit, offset }) => {
|
|
18650
|
-
const
|
|
18444
|
+
const newest2 = new Map((await store.chats.chatStats(account)).map((one) => [one.chatId, one.newestAt]));
|
|
18651
18445
|
const all = byRecency((await store.chats.chats(account, {})).items.map((chat) => {
|
|
18652
|
-
const at =
|
|
18446
|
+
const at = newest2.get(chat.id) ?? null;
|
|
18653
18447
|
const later = at !== null && (chat.lastMessageAt === null || Date.parse(at) > Date.parse(chat.lastMessageAt));
|
|
18654
18448
|
return later ? { ...chat, lastMessageAt: at } : chat;
|
|
18655
18449
|
}));
|
|
@@ -18686,9 +18480,9 @@ var unreadIn = /* @__PURE__ */ __name(async (adapter, { limit, all = false, kind
|
|
|
18686
18480
|
for (const { id: id2, title, kind, unreadCount } of read) {
|
|
18687
18481
|
const count3 = unreadCount ?? 0;
|
|
18688
18482
|
if (count3 === 0) {
|
|
18689
|
-
const
|
|
18690
|
-
if (
|
|
18691
|
-
chats.push({ id: id2, title, kind, unreadCount, messages: [
|
|
18483
|
+
const newest2 = (await adapter.history(id2, { limit })).items.findLast((message) => !message.outgoing);
|
|
18484
|
+
if (newest2)
|
|
18485
|
+
chats.push({ id: id2, title, kind, unreadCount, messages: [newest2], more: false });
|
|
18692
18486
|
continue;
|
|
18693
18487
|
}
|
|
18694
18488
|
const wanted = Math.min(count3, limit);
|
|
@@ -18697,7 +18491,7 @@ var unreadIn = /* @__PURE__ */ __name(async (adapter, { limit, all = false, kind
|
|
|
18697
18491
|
if (theirs.length > 0)
|
|
18698
18492
|
chats.push({ id: id2, title, kind, unreadCount, messages: theirs, more: count3 > limit });
|
|
18699
18493
|
}
|
|
18700
|
-
return { mode: "unread", chats, skipped, partial: page.hasMore, quiet: quiet2 };
|
|
18494
|
+
return { mode: "unread", chats, skipped, partial: page.hasMore, ...leftOf(page), quiet: quiet2 };
|
|
18701
18495
|
}, "unreadIn");
|
|
18702
18496
|
var newIn = /* @__PURE__ */ __name(async (adapter, { since, points, limit, all = false, kinds }) => {
|
|
18703
18497
|
const page = await everyChat(adapter);
|
|
@@ -18728,6 +18522,7 @@ var newIn = /* @__PURE__ */ __name(async (adapter, { since, points, limit, all =
|
|
|
18728
18522
|
chats,
|
|
18729
18523
|
skipped,
|
|
18730
18524
|
partial: page.hasMore,
|
|
18525
|
+
...leftOf(page),
|
|
18731
18526
|
quiet: quiet2,
|
|
18732
18527
|
checked: checked2
|
|
18733
18528
|
};
|
|
@@ -18776,6 +18571,7 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
|
|
|
18776
18571
|
chats,
|
|
18777
18572
|
skipped,
|
|
18778
18573
|
partial,
|
|
18574
|
+
...leftOf(page),
|
|
18779
18575
|
quiet: quiet2,
|
|
18780
18576
|
...points === void 0 ? {} : { checked: checked2 }
|
|
18781
18577
|
};
|
|
@@ -18789,7 +18585,7 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
|
|
|
18789
18585
|
await onReviewed?.(reviewed);
|
|
18790
18586
|
if (unansweredAfterHours === void 0)
|
|
18791
18587
|
return reviewed;
|
|
18792
|
-
const
|
|
18588
|
+
const open6 = [];
|
|
18793
18589
|
for (const one of reviewed.chats) {
|
|
18794
18590
|
const admins = answerers2.get(one.id);
|
|
18795
18591
|
const questions3 = unanswered(one.messages, {
|
|
@@ -18797,10 +18593,10 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
|
|
|
18797
18593
|
before: now - unansweredAfterHours * 36e5
|
|
18798
18594
|
});
|
|
18799
18595
|
if (questions3.length > 0) {
|
|
18800
|
-
|
|
18596
|
+
open6.push({ ...one, messages: questions3, answeredBy: admins === void 0 ? "owner" : "owner-and-admins" });
|
|
18801
18597
|
}
|
|
18802
18598
|
}
|
|
18803
|
-
return { ...reviewed, chats:
|
|
18599
|
+
return { ...reviewed, chats: open6, unanswered: { olderThanHours: unansweredAfterHours } };
|
|
18804
18600
|
}, "reviewIn");
|
|
18805
18601
|
var inboxService = /* @__PURE__ */ __name((deps) => {
|
|
18806
18602
|
const reader = /* @__PURE__ */ __name(async () => {
|
|
@@ -18811,7 +18607,8 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
|
|
|
18811
18607
|
chats: capability(connection, "chats", "list chats"),
|
|
18812
18608
|
history: capability(connection, "history", "read a chat's history"),
|
|
18813
18609
|
resolve: /* @__PURE__ */ __name((reference) => connection.resolve(reference), "resolve"),
|
|
18814
|
-
...connection.admins ? { admins: capability(connection, "admins", "list a chat's admins") } : {}
|
|
18610
|
+
...connection.admins ? { admins: capability(connection, "admins", "list a chat's admins") } : {},
|
|
18611
|
+
...connection.unreadChats ? { unreadChats: capability(connection, "unreadChats", "count unread chats") } : {}
|
|
18815
18612
|
};
|
|
18816
18613
|
}, "reader");
|
|
18817
18614
|
return {
|
|
@@ -18844,7 +18641,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
|
|
|
18844
18641
|
};
|
|
18845
18642
|
}, "inboxService");
|
|
18846
18643
|
|
|
18847
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18644
|
+
// 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/services/excerpt.js
|
|
18848
18645
|
var queryWords = /* @__PURE__ */ __name((query) => query.toLowerCase().split(/\s+/).map((word) => word.replace(/^[\p{L}_]+:/u, "").replace(/~\d+$/u, "").replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, "")).filter((word) => word.length > 2 && !["and", "or", "not"].includes(word)), "queryWords");
|
|
18849
18646
|
var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options2 = {}) => {
|
|
18850
18647
|
const flat = text2.replace(/\s+/g, " ").trim();
|
|
@@ -18860,7 +18657,7 @@ var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options2 = {})
|
|
|
18860
18657
|
}, "excerpt");
|
|
18861
18658
|
var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
|
|
18862
18659
|
|
|
18863
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18660
|
+
// 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/services/person-meetings.js
|
|
18864
18661
|
var SCAN = 1e3;
|
|
18865
18662
|
var SNIPPET = 200;
|
|
18866
18663
|
var SNIPPET_ROWS = 6;
|
|
@@ -18891,9 +18688,9 @@ var personMeetings = /* @__PURE__ */ __name(async (store, people, accounts, { li
|
|
|
18891
18688
|
found.set(key, held);
|
|
18892
18689
|
}
|
|
18893
18690
|
}
|
|
18894
|
-
const
|
|
18691
|
+
const newest2 = [...found.values()].sort((a, b) => b.at - a.at || b.meetingId - a.meetingId);
|
|
18895
18692
|
const items = [];
|
|
18896
|
-
for (const { accountId, meetingId, people: who } of
|
|
18693
|
+
for (const { accountId, meetingId, people: who } of newest2.slice(0, limit)) {
|
|
18897
18694
|
const meeting = await store.meetings.meetingMetadata({ accountId, meetingId }).catch(() => void 0);
|
|
18898
18695
|
if (meeting === void 0 || meeting.deletedAt !== null)
|
|
18899
18696
|
continue;
|
|
@@ -18922,10 +18719,10 @@ var personMeetings = /* @__PURE__ */ __name(async (store, people, accounts, { li
|
|
|
18922
18719
|
...call ? { call } : {}
|
|
18923
18720
|
});
|
|
18924
18721
|
}
|
|
18925
|
-
return { items, total:
|
|
18722
|
+
return { items, total: newest2.length, hasMore: cut || newest2.length > limit };
|
|
18926
18723
|
}, "personMeetings");
|
|
18927
18724
|
|
|
18928
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18725
|
+
// 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/services/person-context.js
|
|
18929
18726
|
var CONTEXT_MESSAGES = 10;
|
|
18930
18727
|
var CONTEXT_BYTES = 64 * 1024;
|
|
18931
18728
|
var toContext = /* @__PURE__ */ __name((key, message, chatTitle2) => ({
|
|
@@ -19072,13 +18869,13 @@ var recordContext = /* @__PURE__ */ __name(async (store, record, reads, readable
|
|
|
19072
18869
|
cut ||= page.hasMore;
|
|
19073
18870
|
if (page.hasMore)
|
|
19074
18871
|
for (const outgoing of [true, false]) {
|
|
19075
|
-
const [
|
|
18872
|
+
const [newest2] = (await store.messages.messages(key, dialog.id, {
|
|
19076
18873
|
limit: 1,
|
|
19077
18874
|
outgoing,
|
|
19078
18875
|
...since === void 0 ? {} : { since: new Date(since).toISOString() }
|
|
19079
18876
|
})).items;
|
|
19080
|
-
if (
|
|
19081
|
-
beyond.push(toContext(key,
|
|
18877
|
+
if (newest2)
|
|
18878
|
+
beyond.push(toContext(key, newest2, dialog.title));
|
|
19082
18879
|
}
|
|
19083
18880
|
}
|
|
19084
18881
|
if (key.provider === "email") {
|
|
@@ -19231,10 +19028,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
|
|
|
19231
19028
|
};
|
|
19232
19029
|
}, "personMessages");
|
|
19233
19030
|
|
|
19234
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19031
|
+
// 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/services/meeting-evidence.js
|
|
19235
19032
|
import { createHash } from "node:crypto";
|
|
19236
19033
|
|
|
19237
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19034
|
+
// 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/services/meeting-reference.js
|
|
19238
19035
|
var missing2 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
|
|
19239
19036
|
var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options2 = {}) => {
|
|
19240
19037
|
const parsed = parseMeetingReference(reference);
|
|
@@ -19252,7 +19049,7 @@ var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId,
|
|
|
19252
19049
|
return { parsed, meeting };
|
|
19253
19050
|
}, "authorizedMeetingMetadata");
|
|
19254
19051
|
|
|
19255
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19052
|
+
// 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/services/meeting-evidence.js
|
|
19256
19053
|
var hash = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
|
|
19257
19054
|
var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
|
|
19258
19055
|
if (signal?.aborted)
|
|
@@ -19451,7 +19248,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
|
|
|
19451
19248
|
return { ...packet, fingerprint: hash(packet) };
|
|
19452
19249
|
}, "readMeetingEvidence");
|
|
19453
19250
|
|
|
19454
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19251
|
+
// 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/services/person-meeting-context.js
|
|
19455
19252
|
var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options2) => {
|
|
19456
19253
|
const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options2;
|
|
19457
19254
|
const requestedAccounts = options2.accountIds;
|
|
@@ -19550,7 +19347,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
19550
19347
|
};
|
|
19551
19348
|
}, "personMeetingContext");
|
|
19552
19349
|
|
|
19553
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19350
|
+
// 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/services/person-preparation.js
|
|
19554
19351
|
var PREPARE_BYTES = 96 * 1024;
|
|
19555
19352
|
var MEETINGS = 5;
|
|
19556
19353
|
var CUES = 3;
|
|
@@ -19582,14 +19379,14 @@ var personPreparation = /* @__PURE__ */ __name(async (store, asked, reference, o
|
|
|
19582
19379
|
const waiting = [];
|
|
19583
19380
|
for (const chat of context2.shared.filter((one) => one.kind === "dialog")) {
|
|
19584
19381
|
const key = { provider: chat.provider, account: chat.account };
|
|
19585
|
-
const [
|
|
19586
|
-
if (
|
|
19382
|
+
const [newest2] = (await store.messages.messages(key, chat.chatId, { limit: 1 })).items;
|
|
19383
|
+
if (newest2?.outgoing !== false)
|
|
19587
19384
|
continue;
|
|
19588
19385
|
waiting.push({
|
|
19589
19386
|
...key,
|
|
19590
19387
|
chatId: chat.chatId,
|
|
19591
19388
|
title: chat.title,
|
|
19592
|
-
message: toContext(key,
|
|
19389
|
+
message: toContext(key, newest2, chat.title),
|
|
19593
19390
|
partial: partial.has(`${chat.provider}/${chat.account}/${chat.chatId}`)
|
|
19594
19391
|
});
|
|
19595
19392
|
}
|
|
@@ -19673,7 +19470,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
|
|
|
19673
19470
|
}
|
|
19674
19471
|
}, "meetingsOf");
|
|
19675
19472
|
|
|
19676
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19473
|
+
// 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/services/person-profile.js
|
|
19677
19474
|
var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
|
|
19678
19475
|
const online = deps.offline ? void 0 : await deps.connection();
|
|
19679
19476
|
const held = await storeIfOpen(deps);
|
|
@@ -19743,7 +19540,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
|
|
|
19743
19540
|
complete: false
|
|
19744
19541
|
})), "quiet");
|
|
19745
19542
|
|
|
19746
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19543
|
+
// 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/services/person-timeline.js
|
|
19747
19544
|
var TIMELINE_ITEMS = 50;
|
|
19748
19545
|
var TIMELINE_MAX = 500;
|
|
19749
19546
|
var SCOPES = ["personal", "work"];
|
|
@@ -19805,7 +19602,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
|
|
|
19805
19602
|
};
|
|
19806
19603
|
}, "personTimeline");
|
|
19807
19604
|
|
|
19808
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19605
|
+
// 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/services/chat-coverage.js
|
|
19809
19606
|
var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
|
|
19810
19607
|
const ids = [...new Set(chatIds)];
|
|
19811
19608
|
if (ids.length === 0)
|
|
@@ -19831,7 +19628,7 @@ var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
|
|
|
19831
19628
|
}));
|
|
19832
19629
|
}, "chatCoverage");
|
|
19833
19630
|
|
|
19834
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19631
|
+
// 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/context/evidence-response.js
|
|
19835
19632
|
var contextSourceKey = /* @__PURE__ */ __name((source) => JSON.stringify([source.kind, source.accountId, source.provider, source.account]), "contextSourceKey");
|
|
19836
19633
|
var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
19837
19634
|
const fail2 = /* @__PURE__ */ __name(() => {
|
|
@@ -19895,7 +19692,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
|
19895
19692
|
}
|
|
19896
19693
|
}, "validateContextEvidencePage");
|
|
19897
19694
|
|
|
19898
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19695
|
+
// 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/context/read-budget.js
|
|
19899
19696
|
var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
|
|
19900
19697
|
if (!limits || typeof limits !== "object" || Array.isArray(limits))
|
|
19901
19698
|
throw new CliError("validation_error", "limits needs a context read allowance");
|
|
@@ -19948,7 +19745,7 @@ var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
|
|
|
19948
19745
|
};
|
|
19949
19746
|
}, "contextReadBudget");
|
|
19950
19747
|
|
|
19951
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19748
|
+
// 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/services/context-evidence.js
|
|
19952
19749
|
var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits) => {
|
|
19953
19750
|
if (!port || typeof port.read !== "function")
|
|
19954
19751
|
throw new CliError("configuration_error", "context evidence reader is unavailable");
|
|
@@ -19992,7 +19789,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
|
|
|
19992
19789
|
};
|
|
19993
19790
|
}, "createContextEvidenceReader");
|
|
19994
19791
|
|
|
19995
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19792
|
+
// 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/services/project-gathering-around.js
|
|
19996
19793
|
var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
|
|
19997
19794
|
async around(ref, window2) {
|
|
19998
19795
|
const at = parseLocator(ref);
|
|
@@ -20087,7 +19884,7 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
|
|
|
20087
19884
|
};
|
|
20088
19885
|
}, "storedNeighbours");
|
|
20089
19886
|
|
|
20090
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19887
|
+
// 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/services/project-gathering-request.js
|
|
20091
19888
|
import { createHash as createHash2 } from "node:crypto";
|
|
20092
19889
|
var DAY = 864e5;
|
|
20093
19890
|
var MAX_TIME = 864e13;
|
|
@@ -20403,7 +20200,7 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
|
|
|
20403
20200
|
return value;
|
|
20404
20201
|
}, "decodeCheckpoint");
|
|
20405
20202
|
|
|
20406
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20203
|
+
// 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/services/project-gathering.js
|
|
20407
20204
|
var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
|
|
20408
20205
|
var PAGE = 20;
|
|
20409
20206
|
var PEOPLE = 20;
|
|
@@ -20528,9 +20325,9 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
20528
20325
|
const matchedAgain = /* @__PURE__ */ new Map();
|
|
20529
20326
|
const oversized = /* @__PURE__ */ new Map();
|
|
20530
20327
|
let stopped = null;
|
|
20531
|
-
const
|
|
20328
|
+
const open6 = /* @__PURE__ */ __name((u) => !terminal.has(u.state) && u.state !== "read-limited", "open");
|
|
20532
20329
|
const linkedLanes = new Set(plan.linkedChats.flatMap((c) => c.lane === null ? [] : [c.lane]));
|
|
20533
|
-
const openLanes = new Set(progress.flatMap((u, index) =>
|
|
20330
|
+
const openLanes = new Set(progress.flatMap((u, index) => open6(u) ? [units2[index]?.lane.id] : []));
|
|
20534
20331
|
const shares = [...linkedLanes].filter((id2) => openLanes.has(id2)).length + ([...openLanes].some((id2) => id2 !== void 0 && !linkedLanes.has(id2)) ? 1 : 0);
|
|
20535
20332
|
const linkedLimit = Math.max(PAGE, Math.floor(plan.budgets.maxItems / Math.max(1, shares)));
|
|
20536
20333
|
const linkedTaken = /* @__PURE__ */ new Map();
|
|
@@ -20589,9 +20386,9 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
20589
20386
|
if (linkedLanes.has(lane.id))
|
|
20590
20387
|
linkedTaken.set(lane.id, (linkedTaken.get(lane.id) ?? 0) + 1);
|
|
20591
20388
|
}, "take");
|
|
20592
|
-
const shallowest = progress.reduce((low, u) =>
|
|
20389
|
+
const shallowest = progress.reduce((low, u) => open6(u) ? Math.min(low, u.pages) : low, Number.POSITIVE_INFINITY);
|
|
20593
20390
|
for (let round = shallowest; !stopped; round++) {
|
|
20594
|
-
const due = progress.flatMap((u, index) =>
|
|
20391
|
+
const due = progress.flatMap((u, index) => open6(u) && u.pages <= round && !capped3.has(units2[index]?.lane.id ?? "") ? [index] : []);
|
|
20595
20392
|
if (!due.length)
|
|
20596
20393
|
break;
|
|
20597
20394
|
for (const index of due) {
|
|
@@ -20807,7 +20604,7 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
|
|
|
20807
20604
|
return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
|
|
20808
20605
|
}, "peopleOf");
|
|
20809
20606
|
|
|
20810
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20607
|
+
// 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/services/meeting-project-candidate-matching.js
|
|
20811
20608
|
var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
|
|
20812
20609
|
var termsOf = /* @__PURE__ */ __name((entry) => [
|
|
20813
20610
|
{ name: entry.name, kind: "canonical" },
|
|
@@ -20851,7 +20648,7 @@ var matchVocabularyTerms = /* @__PURE__ */ __name((catalog, texts) => {
|
|
|
20851
20648
|
return result.sort((a, b) => Number(a.entry.id) - Number(b.entry.id));
|
|
20852
20649
|
}, "matchVocabularyTerms");
|
|
20853
20650
|
|
|
20854
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20651
|
+
// 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/services/project-gathering-mentions.js
|
|
20855
20652
|
var KINDS = ["project", "tag", "topic"];
|
|
20856
20653
|
var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options2 = {}) => {
|
|
20857
20654
|
if (typeof vocabulary?.vocabulary !== "function")
|
|
@@ -20906,7 +20703,7 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
|
|
|
20906
20703
|
};
|
|
20907
20704
|
}, "findEvidenceMentions");
|
|
20908
20705
|
|
|
20909
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20706
|
+
// 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/services/project-purposes.js
|
|
20910
20707
|
var BUILT_IN_PURPOSES = ["work", "sales", "support", "other"];
|
|
20911
20708
|
var DEFAULT_PURPOSES = ["work"];
|
|
20912
20709
|
var LINK_PURPOSE = "work";
|
|
@@ -20936,10 +20733,10 @@ var purposeList = /* @__PURE__ */ __name((value, previous = []) => [
|
|
|
20936
20733
|
...value.split(",").map((one) => one.trim()).filter(Boolean)
|
|
20937
20734
|
], "purposeList");
|
|
20938
20735
|
|
|
20939
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20736
|
+
// 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/services/stored-project-gathering.js
|
|
20940
20737
|
var storedChatCount = /* @__PURE__ */ __name((store) => async (account, chatId, { since, until }) => {
|
|
20941
20738
|
const window2 = { since: new Date(since).toISOString(), until: new Date(until - 1).toISOString() };
|
|
20942
|
-
const [messages,
|
|
20739
|
+
const [messages, newest2, oldest] = await Promise.all([
|
|
20943
20740
|
store.messages.countMessages(account, chatId, window2),
|
|
20944
20741
|
store.messages.messages(account, chatId, { limit: 1, since: window2.since, until: until - 1 }),
|
|
20945
20742
|
store.messages.messages(account, chatId, { limit: 1, after: { time: since - 1 }, until: until - 1 })
|
|
@@ -20947,7 +20744,7 @@ var storedChatCount = /* @__PURE__ */ __name((store) => async (account, chatId,
|
|
|
20947
20744
|
return {
|
|
20948
20745
|
messages,
|
|
20949
20746
|
firstAt: oldest.items[0]?.timestamp ?? null,
|
|
20950
|
-
lastAt:
|
|
20747
|
+
lastAt: newest2.items.at(-1)?.timestamp ?? null
|
|
20951
20748
|
};
|
|
20952
20749
|
}, "storedChatCount");
|
|
20953
20750
|
var PROJECT_ID = /^project:[1-9]\d*$/;
|
|
@@ -21247,7 +21044,7 @@ var purposeHintOf = /* @__PURE__ */ __name((linked, rows, of) => {
|
|
|
21247
21044
|
return { chat: top.ref, relationship: link4.relationship, items, of };
|
|
21248
21045
|
}, "purposeHintOf");
|
|
21249
21046
|
|
|
21250
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21047
|
+
// 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/services/people.js
|
|
21251
21048
|
var peopleService = /* @__PURE__ */ __name((deps) => {
|
|
21252
21049
|
const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
|
|
21253
21050
|
const held = await storeIfOpen(deps);
|
|
@@ -21512,7 +21309,7 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
|
|
|
21512
21309
|
return rest;
|
|
21513
21310
|
}, "withoutPhone");
|
|
21514
21311
|
|
|
21515
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21312
|
+
// 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/services/task-stats.js
|
|
21516
21313
|
var TASK_STATS_BY = ["chat", "meeting", "project"];
|
|
21517
21314
|
var PERIOD_FIELD = "created";
|
|
21518
21315
|
var refuseNestedPeriod = /* @__PURE__ */ __name((node, top = true) => {
|
|
@@ -21535,9 +21332,9 @@ var median2 = /* @__PURE__ */ __name((values) => {
|
|
|
21535
21332
|
return sorted.length % 2 === 1 ? upper : ((sorted[middle - 1] ?? 0) + upper) / 2;
|
|
21536
21333
|
}, "median");
|
|
21537
21334
|
var mean = /* @__PURE__ */ __name((values) => Math.round(values.reduce((sum2, one) => sum2 + one, 0) / values.length), "mean");
|
|
21538
|
-
var spread = /* @__PURE__ */ __name((
|
|
21335
|
+
var spread = /* @__PURE__ */ __name((open6, closeMs, now) => ({
|
|
21539
21336
|
...closeMs.length > 0 ? { medianCloseMs: median2(closeMs) } : {},
|
|
21540
|
-
...
|
|
21337
|
+
...open6.length > 0 ? { meanOpenAgeMs: mean(open6.map(({ createdAt }) => now - createdAt)) } : {}
|
|
21541
21338
|
}), "spread");
|
|
21542
21339
|
var and = /* @__PURE__ */ __name((parts) => parts.length === 0 ? void 0 : { sql: parts.map(({ sql }) => `(${sql})`).join(" AND "), params: parts.flatMap(({ params }) => params) }, "and");
|
|
21543
21340
|
var taskStatsOf = /* @__PURE__ */ __name(async (store, accounts, { by = "chat", query, timezone, group, kind }, columns, now = Date.now()) => {
|
|
@@ -21598,15 +21395,15 @@ var taskStatsOf = /* @__PURE__ */ __name(async (store, accounts, { by = "chat",
|
|
|
21598
21395
|
...one.open[0] ? { oldestOpenAt: new Date(one.open[0].createdAt) } : {},
|
|
21599
21396
|
...spread(one.open, one.closeMs, now)
|
|
21600
21397
|
}));
|
|
21601
|
-
const
|
|
21398
|
+
const open6 = kept2.flatMap((one) => one.open);
|
|
21602
21399
|
const closeMs = kept2.flatMap((one) => one.closeMs);
|
|
21603
21400
|
return {
|
|
21604
21401
|
by,
|
|
21605
21402
|
...several ? { accounts: [...list2] } : {},
|
|
21606
|
-
open:
|
|
21403
|
+
open: open6.length,
|
|
21607
21404
|
created: created.length,
|
|
21608
21405
|
closed: closeMs.length,
|
|
21609
|
-
...spread(
|
|
21406
|
+
...spread(open6, closeMs, now),
|
|
21610
21407
|
rows
|
|
21611
21408
|
};
|
|
21612
21409
|
}, "taskStatsOf");
|
|
@@ -21643,7 +21440,7 @@ var meetingNames = /* @__PURE__ */ __name(async (store, groups) => {
|
|
|
21643
21440
|
}));
|
|
21644
21441
|
}, "meetingNames");
|
|
21645
21442
|
|
|
21646
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21443
|
+
// 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/services/task-tag-filters.js
|
|
21647
21444
|
var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
|
|
21648
21445
|
const tags = /* @__PURE__ */ new Map();
|
|
21649
21446
|
for (const node of query ? walkQuery(query.root) : [])
|
|
@@ -21652,7 +21449,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
|
|
|
21652
21449
|
return tags;
|
|
21653
21450
|
}, "taskTagFilters");
|
|
21654
21451
|
|
|
21655
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21452
|
+
// 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/services/tasks.js
|
|
21656
21453
|
var TASK_QUERY = {
|
|
21657
21454
|
entity: "task",
|
|
21658
21455
|
backend: "sql",
|
|
@@ -21779,8 +21576,8 @@ var taskStateOf = oneOf(TASK_STATES, "task state", "--state");
|
|
|
21779
21576
|
var closedStateOf = oneOf(["done", "dismissed"], "way to close a task", "--as");
|
|
21780
21577
|
var taskLinkKindOf = oneOf(TASK_LINK_OPTION_KINDS, "link kind", "--kind");
|
|
21781
21578
|
var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
21782
|
-
const
|
|
21783
|
-
const categoryOf = /* @__PURE__ */ __name(async (store, name) => taskCategoryOf(await
|
|
21579
|
+
const listOf = /* @__PURE__ */ __name(async (store) => categories ?? await store.tasks.categories(), "listOf");
|
|
21580
|
+
const categoryOf = /* @__PURE__ */ __name(async (store, name) => taskCategoryOf(await listOf(store))(name), "categoryOf");
|
|
21784
21581
|
const inStore = /* @__PURE__ */ __name(async (work) => work(await deps.store(), await deps.account()), "inStore");
|
|
21785
21582
|
const service = /* @__PURE__ */ __name((store) => createTaskService({ store: store.tasks }), "service");
|
|
21786
21583
|
const groupOf = /* @__PURE__ */ __name(async (store, account, chat) => chat === void 0 ? void 0 : storedChatId(deps.messenger, chat, store, account, { includeLeft: true }), "groupOf");
|
|
@@ -21811,8 +21608,8 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
21811
21608
|
const planOf = /* @__PURE__ */ __name(async (store, id2, plan, by) => {
|
|
21812
21609
|
if (plan.category !== void 0)
|
|
21813
21610
|
plan = { ...plan, category: await categoryOf(store, plan.category) };
|
|
21814
|
-
const
|
|
21815
|
-
if (!
|
|
21611
|
+
const open6 = !isClosedState((await store.tasks.details(id2)).status);
|
|
21612
|
+
if (!open6 && (plan.dueAt != null || plan.nextCheckAt != null))
|
|
21816
21613
|
throw new CliError("validation_error", "a closed task takes no due date or next check; it stays closed");
|
|
21817
21614
|
const { assignees, ...fields } = plan;
|
|
21818
21615
|
const author = by === "owner" ? "owner" : { bot: by };
|
|
@@ -21932,7 +21729,7 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
21932
21729
|
kind: type,
|
|
21933
21730
|
origin,
|
|
21934
21731
|
...plan.dueAt ? { dueAt: plan.dueAt } : {},
|
|
21935
|
-
category: chosen ?? categorize(await sourceText(), await
|
|
21732
|
+
category: chosen ?? categorize(await sourceText(), await listOf(store))
|
|
21936
21733
|
});
|
|
21937
21734
|
const task2 = await store.tasks.get(added.id) ?? added;
|
|
21938
21735
|
if (created && choice.new)
|
|
@@ -21945,7 +21742,7 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
21945
21742
|
const card = await planOf(store, task2.id, plan, origin);
|
|
21946
21743
|
return { task: await taskView(store, account, task2), created, ...followed, card };
|
|
21947
21744
|
}), "add"),
|
|
21948
|
-
categories: /* @__PURE__ */ __name(() => inStore(async (store) =>
|
|
21745
|
+
categories: /* @__PURE__ */ __name(() => inStore(async (store) => listOf(store)), "categories"),
|
|
21949
21746
|
unlistedCategories: /* @__PURE__ */ __name(() => inStore(async (store) => store.tasks.unlistedCategories()), "unlistedCategories"),
|
|
21950
21747
|
categoriesFile: /* @__PURE__ */ __name(() => inStore(async (store) => store.tasks.categoriesFile()), "categoriesFile"),
|
|
21951
21748
|
duplicates: /* @__PURE__ */ __name(({ decision, limit, offset }) => inStore(async (store, account) => store.tasks.pairs(taskAccount(account), { decision, limit, offset })), "duplicates"),
|
|
@@ -22152,7 +21949,7 @@ var taskView = /* @__PURE__ */ __name(async (store, account, task2) => {
|
|
|
22152
21949
|
};
|
|
22153
21950
|
}, "taskView");
|
|
22154
21951
|
|
|
22155
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21952
|
+
// 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/cli/messenger/lacks.js
|
|
22156
21953
|
var COMMAND_NEEDS = {
|
|
22157
21954
|
"account update": ["updateProfile", "change the profile"],
|
|
22158
21955
|
"account sessions list": ["sessions", "list the account's sessions"],
|
|
@@ -22207,17 +22004,17 @@ var hideNever = /* @__PURE__ */ __name((messenger, group) => {
|
|
|
22207
22004
|
const at = [...path, child.name()];
|
|
22208
22005
|
const need = COMMAND_NEEDS[at.join(" ")];
|
|
22209
22006
|
if (need && messenger.never?.includes(need[0]))
|
|
22210
|
-
child
|
|
22007
|
+
hide(child);
|
|
22211
22008
|
walk(child, at);
|
|
22212
|
-
if (child.commands.length > 0 && child.commands.every(
|
|
22213
|
-
child
|
|
22009
|
+
if (child.commands.length > 0 && child.commands.every(isHidden))
|
|
22010
|
+
hide(child);
|
|
22214
22011
|
}
|
|
22215
22012
|
}, "walk");
|
|
22216
22013
|
walk(group, [group.name()]);
|
|
22217
22014
|
return group;
|
|
22218
22015
|
}, "hideNever");
|
|
22219
22016
|
|
|
22220
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22017
|
+
// 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/context/communication-selection.js
|
|
22221
22018
|
var communicationFields = {
|
|
22222
22019
|
sources: pipe(array(strictObject({
|
|
22223
22020
|
id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
|
|
@@ -22249,16 +22046,16 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
|
|
|
22249
22046
|
return { ...input, after, before };
|
|
22250
22047
|
}, "communicationRequest");
|
|
22251
22048
|
|
|
22252
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22253
|
-
var mailTurn = /* @__PURE__ */ __name((
|
|
22254
|
-
if (
|
|
22049
|
+
// 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/mail/owed.js
|
|
22050
|
+
var mailTurn = /* @__PURE__ */ __name((newest2) => {
|
|
22051
|
+
if (newest2 === null)
|
|
22255
22052
|
return null;
|
|
22256
|
-
if (
|
|
22053
|
+
if (newest2.outgoing)
|
|
22257
22054
|
return "waiting";
|
|
22258
|
-
return
|
|
22055
|
+
return newest2.addressed ? "owed" : null;
|
|
22259
22056
|
}, "mailTurn");
|
|
22260
22057
|
|
|
22261
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22058
|
+
// 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/services/agenda-mail.js
|
|
22262
22059
|
var absent = /* @__PURE__ */ __name((error) => {
|
|
22263
22060
|
if (error instanceof CliError && error.code === "not_found")
|
|
22264
22061
|
return void 0;
|
|
@@ -22292,7 +22089,7 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) =
|
|
|
22292
22089
|
storedAt: synced?.at ?? null,
|
|
22293
22090
|
coverage: /* @__PURE__ */ __name((ids) => ids.map((chatId) => {
|
|
22294
22091
|
const thread = byId2.get(chatId);
|
|
22295
|
-
const
|
|
22092
|
+
const newest2 = thread?.newest?.at ?? thread?.lastEmailAt;
|
|
22296
22093
|
const until = window2.until === void 0 ? Number.NaN : Date.parse(window2.until);
|
|
22297
22094
|
return {
|
|
22298
22095
|
chatId,
|
|
@@ -22301,7 +22098,7 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) =
|
|
|
22301
22098
|
chatId,
|
|
22302
22099
|
// Sync holds a window of the mailbox, never a thread's whole history.
|
|
22303
22100
|
state: synced ? "partial" : "unknown",
|
|
22304
|
-
upToDate: window2.state === "window" &&
|
|
22101
|
+
upToDate: window2.state === "window" && newest2 !== void 0 && !Number.isNaN(until) ? newest2 <= until : null,
|
|
22305
22102
|
gaps: false,
|
|
22306
22103
|
reachesStart: false,
|
|
22307
22104
|
fetchedAt: synced?.at ?? null
|
|
@@ -22309,14 +22106,14 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) =
|
|
|
22309
22106
|
held: {
|
|
22310
22107
|
messages: thread?.emails ?? 0,
|
|
22311
22108
|
oldestAt: null,
|
|
22312
|
-
newestAt:
|
|
22109
|
+
newestAt: newest2 === void 0 ? null : new Date(newest2).toISOString()
|
|
22313
22110
|
}
|
|
22314
22111
|
};
|
|
22315
22112
|
}), "coverage")
|
|
22316
22113
|
};
|
|
22317
22114
|
}, "mailActivity");
|
|
22318
22115
|
|
|
22319
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22116
|
+
// 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/services/agenda.js
|
|
22320
22117
|
var DAY2 = 864e5;
|
|
22321
22118
|
var AGENDA_DEFAULTS = { unanswered: DAY2, waiting: 7 * DAY2 };
|
|
22322
22119
|
var CLAIMS = ["none", "mine", "others", "any"];
|
|
@@ -22362,9 +22159,9 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22362
22159
|
return [];
|
|
22363
22160
|
throw error;
|
|
22364
22161
|
}), "find");
|
|
22365
|
-
const
|
|
22162
|
+
const open6 = await find();
|
|
22366
22163
|
const tags = await taskTagFilters(store, parts.tasks);
|
|
22367
|
-
const listed2 = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns2(holder, at, tags), { command: "tasks agenda", zone: timezoneOf() })) :
|
|
22164
|
+
const listed2 = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns2(holder, at, tags), { command: "tasks agenda", zone: timezoneOf() })) : open6;
|
|
22368
22165
|
const tasks = listed2.map((task2) => ({ task: task2, reasons: reasonsOf(task2, at, dueWithin) })).filter(({ reasons }) => reasons.length > 0).sort((a, b) => urgency(a.task) - urgency(b.task)).map(({ task: task2, reasons }) => ({
|
|
22369
22166
|
id: task2.id,
|
|
22370
22167
|
key: task2.key,
|
|
@@ -22406,7 +22203,7 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22406
22203
|
chat: chat.chatId,
|
|
22407
22204
|
message: lastMessageId
|
|
22408
22205
|
}),
|
|
22409
|
-
openTasks:
|
|
22206
|
+
openTasks: open6.filter((task2) => chatOf2(task2.source) === chat.chatId).map((task2) => task2.id)
|
|
22410
22207
|
}));
|
|
22411
22208
|
const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
|
|
22412
22209
|
const shown = {
|
|
@@ -22420,7 +22217,7 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22420
22217
|
const withCoverage = /* @__PURE__ */ __name((list2) => list2.map(({ turn: _, ...chat }) => ({ ...chat, coverage: covered.get(chat.chatId) })), "withCoverage");
|
|
22421
22218
|
const inList = new Set((await store.tasks.categories()).map(({ name }) => name));
|
|
22422
22219
|
const unlisted = /* @__PURE__ */ new Map();
|
|
22423
|
-
for (const { category } of
|
|
22220
|
+
for (const { category } of open6)
|
|
22424
22221
|
if (category && !inList.has(category))
|
|
22425
22222
|
unlisted.set(category, (unlisted.get(category) ?? 0) + 1);
|
|
22426
22223
|
return {
|
|
@@ -22570,7 +22367,7 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
|
|
|
22570
22367
|
};
|
|
22571
22368
|
}, "agendaItem");
|
|
22572
22369
|
|
|
22573
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22370
|
+
// 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/services/model-downloads.js
|
|
22574
22371
|
import { writeFileSync } from "node:fs";
|
|
22575
22372
|
import { join } from "node:path";
|
|
22576
22373
|
var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file) => sum2 + file.bytes, 0), "bytesOf");
|
|
@@ -22595,7 +22392,7 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
22595
22392
|
`);
|
|
22596
22393
|
await nativeRuntime({ env, progress });
|
|
22597
22394
|
progress(`${model.id}: loading it once to check it works`);
|
|
22598
|
-
const { openEmbedder: openEmbedder2 } = await import("./embed-
|
|
22395
|
+
const { openEmbedder: openEmbedder2 } = await import("./embed-NFGFYUO4.js");
|
|
22599
22396
|
const embedder = await openEmbedder2(model, directory2);
|
|
22600
22397
|
try {
|
|
22601
22398
|
const [vector] = await embedder.embed(["check"], "query");
|
|
@@ -22616,7 +22413,7 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
|
|
|
22616
22413
|
}
|
|
22617
22414
|
await nativeRuntime({ env, progress });
|
|
22618
22415
|
progress(`${model.id}: loading it once to check it works`);
|
|
22619
|
-
const { openReranker } = await import("./rerank-
|
|
22416
|
+
const { openReranker } = await import("./rerank-3F2E6NNN.js");
|
|
22620
22417
|
const reranker = await openReranker(model, directory2);
|
|
22621
22418
|
try {
|
|
22622
22419
|
await reranker.score("check", ["check"]);
|
|
@@ -22634,7 +22431,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
22634
22431
|
await installFiles(placedImage(model, directory2), { progress, ...bytes2 ? { bytes: bytes2 } : {} });
|
|
22635
22432
|
}
|
|
22636
22433
|
progress(`${model.id}: loading it once to check it works`);
|
|
22637
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
22434
|
+
const { openPictureEmbedder } = await import("./embedder-SRBOJMXX.js");
|
|
22638
22435
|
const embedder = await openPictureEmbedder(model, directory2);
|
|
22639
22436
|
try {
|
|
22640
22437
|
const vector = await embedder.embedQuery("check");
|
|
@@ -22646,7 +22443,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
22646
22443
|
return { model, directory: directory2 };
|
|
22647
22444
|
}, "downloadImageModel");
|
|
22648
22445
|
|
|
22649
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22446
|
+
// 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/services/rankings-selection.js
|
|
22650
22447
|
var RANKING_SELECTION_BYTES = 64 * 1024;
|
|
22651
22448
|
var object2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
|
|
22652
22449
|
function invalid(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
|
|
@@ -22815,7 +22612,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
22815
22612
|
};
|
|
22816
22613
|
}, "readRankingSelection");
|
|
22817
22614
|
|
|
22818
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22615
|
+
// 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/services/mail-search.js
|
|
22819
22616
|
var THREADS_PAGE = 500;
|
|
22820
22617
|
var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
|
|
22821
22618
|
const account = await store.accounts.storedAccount(key).catch(() => void 0);
|
|
@@ -22852,10 +22649,10 @@ var withMailThreads = /* @__PURE__ */ __name((store) => {
|
|
|
22852
22649
|
get: /* @__PURE__ */ __name((target2, key, receiver) => key === "chats" ? chats : Reflect.get(target2, key, receiver), "get")
|
|
22853
22650
|
});
|
|
22854
22651
|
}, "withMailThreads");
|
|
22855
|
-
var mergeMail = /* @__PURE__ */ __name((messages, mail, limit,
|
|
22652
|
+
var mergeMail = /* @__PURE__ */ __name((messages, mail, limit, newest2 = false) => {
|
|
22856
22653
|
const moved = new Set(mail.items.map(({ locator }) => locator));
|
|
22857
22654
|
const kept2 = messages.items.filter(({ locator }) => !moved.has(locator));
|
|
22858
|
-
const items =
|
|
22655
|
+
const items = newest2 ? [...kept2, ...mail.items].sort((a, b) => b.timestamp.localeCompare(a.timestamp)) : fuseRanked([kept2, mail.items], (hit) => ({
|
|
22859
22656
|
exact: hit.exact,
|
|
22860
22657
|
ranked: hit.score !== null,
|
|
22861
22658
|
at: Date.parse(hit.timestamp)
|
|
@@ -22890,9 +22687,9 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before = 0, after
|
|
|
22890
22687
|
return thread.slice(Math.max(0, at - before), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
|
|
22891
22688
|
}, "readMail");
|
|
22892
22689
|
|
|
22893
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22690
|
+
// 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/services/messages-search.js
|
|
22894
22691
|
var PERSON_FIELDS = /* @__PURE__ */ new Set(["from", "to", "cc", "bcc"]);
|
|
22895
|
-
var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is", "list"]);
|
|
22692
|
+
var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is", "list", "type", "reach"]);
|
|
22896
22693
|
var positiveSources = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "in" ? [node.value.toLowerCase()] : [] : node.clauses.filter(({ occur }) => occur !== "must_not").flatMap(({ node: node2 }) => positiveSources(node2)), "positiveSources");
|
|
22897
22694
|
var prepareLucene = /* @__PURE__ */ __name(async (store, account, request, messenger) => {
|
|
22898
22695
|
if (!Number.isInteger(request.limit) || request.limit < 1 || request.limit > QUERY_PAGE_LIMIT)
|
|
@@ -22952,11 +22749,11 @@ var prepareLucene = /* @__PURE__ */ __name(async (store, account, request, messe
|
|
|
22952
22749
|
if (mailField && !scopeAccounts.some(({ provider }) => provider === MAIL))
|
|
22953
22750
|
searchError("query.unsupported-field", mailField.span, `${mailField.field}: is a mail field \u2014 memo search mail reads it`);
|
|
22954
22751
|
const globalChat = request.chat === void 0 ? void 0 : await chatAmong(messenger, chatLookup, scopeAccounts, request.chat);
|
|
22955
|
-
const
|
|
22752
|
+
const resolve6 = /* @__PURE__ */ __name(async (node) => {
|
|
22956
22753
|
if (node.kind === "boolean")
|
|
22957
22754
|
return {
|
|
22958
22755
|
...node,
|
|
22959
|
-
clauses: await Promise.all(node.clauses.map(async ({ occur, node: node2 }) => ({ occur, node: await
|
|
22756
|
+
clauses: await Promise.all(node.clauses.map(async ({ occur, node: node2 }) => ({ occur, node: await resolve6(node2) })))
|
|
22960
22757
|
};
|
|
22961
22758
|
if (isPresence(node))
|
|
22962
22759
|
return node;
|
|
@@ -22978,7 +22775,7 @@ var prepareLucene = /* @__PURE__ */ __name(async (store, account, request, messe
|
|
|
22978
22775
|
};
|
|
22979
22776
|
return node;
|
|
22980
22777
|
}, "resolve");
|
|
22981
|
-
const root = await
|
|
22778
|
+
const root = await resolve6(ast.root);
|
|
22982
22779
|
const chats = leaves.filter(({ field }) => field === "chat");
|
|
22983
22780
|
const [lone] = chats.length === 1 && chats[0] && requiresChat(ast.root, chats[0]) ? chats : [];
|
|
22984
22781
|
const loneChats = lone === void 0 || globalChat ? [] : lone.operator === "wildcard" ? await chatsMatchingIn(chatLookup, scopeAccounts, lone.value) : [await chatAmong(messenger, chatLookup, scopeAccounts, lone.value)];
|
|
@@ -23138,13 +22935,13 @@ var coverageOf = /* @__PURE__ */ __name(async (store, { scopeAccounts, selectedC
|
|
|
23138
22935
|
};
|
|
23139
22936
|
}, "coverageOf");
|
|
23140
22937
|
var statKey = /* @__PURE__ */ __name((account, chatId) => JSON.stringify([account.provider, account.account, chatId]), "statKey");
|
|
23141
|
-
var queryOf = /* @__PURE__ */ __name((timezone,
|
|
22938
|
+
var queryOf = /* @__PURE__ */ __name((timezone, newest2, stemming) => ({
|
|
23142
22939
|
language: "lucene-v1",
|
|
23143
22940
|
version: 1,
|
|
23144
22941
|
fieldsVersion: FIELD_VERSION,
|
|
23145
22942
|
presetVersion: PRESET_VERSION,
|
|
23146
22943
|
timezone,
|
|
23147
|
-
order:
|
|
22944
|
+
order: newest2 ? "newest" : "relevance",
|
|
23148
22945
|
...stemming ? { stemming } : {}
|
|
23149
22946
|
}), "queryOf");
|
|
23150
22947
|
var searchLucene = /* @__PURE__ */ __name(async (store, account, request, messenger = {}) => {
|
|
@@ -23263,7 +23060,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account, request, messeng
|
|
|
23263
23060
|
};
|
|
23264
23061
|
}, "statsLucene");
|
|
23265
23062
|
|
|
23266
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23063
|
+
// 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/services/search-record.js
|
|
23267
23064
|
var canonical = /* @__PURE__ */ __name((value, nested = false) => Array.isArray(value) ? value.map((one) => canonical(one, true)) : value !== null && typeof value === "object" ? Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0 && (nested || one !== false)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, one]) => [key, canonical(one, true)])) : value, "canonical");
|
|
23268
23065
|
var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
|
|
23269
23066
|
command,
|
|
@@ -23273,7 +23070,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
|
|
|
23273
23070
|
fieldsVersion: FIELD_VERSION
|
|
23274
23071
|
}), "searchRecordOf");
|
|
23275
23072
|
|
|
23276
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23073
|
+
// 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/services/admin-statistics.js
|
|
23277
23074
|
function invalid2(message) {
|
|
23278
23075
|
throw new CliError("validation_error", message);
|
|
23279
23076
|
}
|
|
@@ -23567,7 +23364,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
23567
23364
|
}, "evidence")
|
|
23568
23365
|
}), "adminStatisticsService");
|
|
23569
23366
|
|
|
23570
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23367
|
+
// 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/services/patience.js
|
|
23571
23368
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
23572
23369
|
var LONGEST_WAIT_MS = 5 * 60 * 1e3;
|
|
23573
23370
|
var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
|
|
@@ -23590,19 +23387,19 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
|
|
|
23590
23387
|
}
|
|
23591
23388
|
}, "patiently");
|
|
23592
23389
|
|
|
23593
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23390
|
+
// 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/services/archive.js
|
|
23594
23391
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
23595
23392
|
|
|
23596
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23393
|
+
// 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/services/backfill-estimate.js
|
|
23597
23394
|
var REQUEST_MS = 400;
|
|
23598
|
-
var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
|
|
23395
|
+
var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest: newest2, page, maxPages, pauseMs }) => {
|
|
23599
23396
|
const lowest = ranges[0];
|
|
23600
23397
|
const top = ranges.at(-1);
|
|
23601
23398
|
if (!lowest || !top)
|
|
23602
23399
|
return { held, ranges, missing: null, requests: null, runs: null, seconds: null };
|
|
23603
23400
|
const covered = ranges.reduce((sum2, range2) => sum2 + range2.to - range2.from + 1, 0);
|
|
23604
23401
|
const between = ranges.slice(1).reduce((sum2, range2, index) => sum2 + range2.from - (ranges[index]?.to ?? 0) - 1, 0);
|
|
23605
|
-
const gapIds = lowest.from - 1 + between + Math.max(0, (
|
|
23402
|
+
const gapIds = lowest.from - 1 + between + Math.max(0, (newest2 ?? top.to) - top.to);
|
|
23606
23403
|
const inRanges = Math.min(held, covered);
|
|
23607
23404
|
const missing4 = gapIds === 0 ? 0 : Math.round(inRanges / covered * gapIds);
|
|
23608
23405
|
const requests = missing4 === 0 ? 0 : Math.ceil(missing4 / page) + ranges.length;
|
|
@@ -23616,13 +23413,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
|
|
|
23616
23413
|
};
|
|
23617
23414
|
}, "estimateBackfill");
|
|
23618
23415
|
|
|
23619
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23416
|
+
// 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/domain/recovery.js
|
|
23620
23417
|
var withRecovery = /* @__PURE__ */ __name((error) => ({
|
|
23621
23418
|
...error,
|
|
23622
23419
|
retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
|
|
23623
23420
|
}), "withRecovery");
|
|
23624
23421
|
|
|
23625
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23422
|
+
// 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/services/batch.js
|
|
23626
23423
|
var actionable = /* @__PURE__ */ __name((error) => {
|
|
23627
23424
|
if (isCliFailure(error))
|
|
23628
23425
|
return withRecovery({ code: error.code, message: error.message, ...error.details });
|
|
@@ -23705,7 +23502,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
|
|
|
23705
23502
|
};
|
|
23706
23503
|
}, "mergeBatches");
|
|
23707
23504
|
|
|
23708
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23505
|
+
// 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/images/context/index.js
|
|
23709
23506
|
var CONTEXT_MESSAGES2 = 3;
|
|
23710
23507
|
var CONTEXT_MINUTES = 10;
|
|
23711
23508
|
var MAX_CHARS = 1200;
|
|
@@ -23729,12 +23526,12 @@ var context = {
|
|
|
23729
23526
|
}, "describe")
|
|
23730
23527
|
};
|
|
23731
23528
|
|
|
23732
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23529
|
+
// 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/images/registry.js
|
|
23733
23530
|
var BUILT_INS = [context];
|
|
23734
23531
|
var providers = [...BUILT_INS];
|
|
23735
23532
|
var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
|
|
23736
23533
|
|
|
23737
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23534
|
+
// 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/services/conversations.js
|
|
23738
23535
|
var READ_PAGE = 5e3;
|
|
23739
23536
|
var CHAIN = 50;
|
|
23740
23537
|
var CONVERSATION_QUERY = {
|
|
@@ -23886,7 +23683,7 @@ var sized = /* @__PURE__ */ __name((size2) => {
|
|
|
23886
23683
|
return size2;
|
|
23887
23684
|
}, "sized");
|
|
23888
23685
|
|
|
23889
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23686
|
+
// 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/services/embeddings-maintenance.js
|
|
23890
23687
|
var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
|
|
23891
23688
|
var MESSAGE_PAGE = 5e3;
|
|
23892
23689
|
var PER_SESSION = 8;
|
|
@@ -23905,7 +23702,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = chosenTextModel(dep
|
|
|
23905
23702
|
price: remote.price,
|
|
23906
23703
|
installed: true,
|
|
23907
23704
|
perBatch: PER_REQUEST * concurrency,
|
|
23908
|
-
open: /* @__PURE__ */ __name(async () => (await import("./remote-
|
|
23705
|
+
open: /* @__PURE__ */ __name(async () => (await import("./remote-3IMEJTEH.js")).openRemote(remote, apiKey, {
|
|
23909
23706
|
concurrency,
|
|
23910
23707
|
env: deps.env ?? process.env
|
|
23911
23708
|
}), "open")
|
|
@@ -23925,7 +23722,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = chosenTextModel(dep
|
|
|
23925
23722
|
if (!isTextModelInstalled(model, directory2))
|
|
23926
23723
|
throw notDownloaded(model.id);
|
|
23927
23724
|
if (apart) {
|
|
23928
|
-
const { openProcess } = await import("./process-
|
|
23725
|
+
const { openProcess } = await import("./process-AFIXYXWL.js");
|
|
23929
23726
|
return openProcess(model, directory2, { threads: threads ?? defaultThreads() });
|
|
23930
23727
|
}
|
|
23931
23728
|
return openEmbedder(model, directory2, { threads: threads ?? defaultThreads() });
|
|
@@ -24214,7 +24011,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
|
|
|
24214
24011
|
return { ...one, state };
|
|
24215
24012
|
}, "shaped");
|
|
24216
24013
|
|
|
24217
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24014
|
+
// 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/services/search-catchup.js
|
|
24218
24015
|
var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
|
|
24219
24016
|
var validateCatchUpBounds = /* @__PURE__ */ __name((options2) => {
|
|
24220
24017
|
for (const [key, value, maximum] of [
|
|
@@ -24267,7 +24064,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options2, signal,
|
|
|
24267
24064
|
}
|
|
24268
24065
|
}, "catchUpSearch");
|
|
24269
24066
|
|
|
24270
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24067
|
+
// 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/services/archive.js
|
|
24271
24068
|
var pushed = /* @__PURE__ */ __name((deps, what) => {
|
|
24272
24069
|
if (deps.reads === "store") {
|
|
24273
24070
|
throw new CliError("validation_error", `${what} asks for older history, and this messenger pushes its history instead \u2014 keep \`${typedCommand(deps.messenger.app.command, "serve")}\` running`);
|
|
@@ -24332,13 +24129,13 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
|
|
|
24332
24129
|
throw new CliError("validation_error", "--dry-run counts the message ids missing between what is held; this messenger's ids do not count messages");
|
|
24333
24130
|
}
|
|
24334
24131
|
const { store, account, chatId } = await found(chat);
|
|
24335
|
-
const
|
|
24132
|
+
const newest2 = Number((await store.messages.messages(account, chatId, { limit: 1 })).items[0]?.id);
|
|
24336
24133
|
return {
|
|
24337
24134
|
chat: chatId,
|
|
24338
24135
|
...estimateBackfill({
|
|
24339
24136
|
ranges: await store.sync.ranges(account, chatId),
|
|
24340
24137
|
held: (await store.chats.chatStats(account, chatId))[0]?.messages ?? 0,
|
|
24341
|
-
newest: Number.isSafeInteger(
|
|
24138
|
+
newest: Number.isSafeInteger(newest2) ? newest2 : void 0,
|
|
24342
24139
|
page: pageSize,
|
|
24343
24140
|
maxPages: Math.ceil(limit / pageSize),
|
|
24344
24141
|
pauseMs
|
|
@@ -24372,15 +24169,22 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
|
|
|
24372
24169
|
return { chat: limit.chatId ?? null, fetched: 0, complete: false, ranges: [], limited: "group_too_large" };
|
|
24373
24170
|
}
|
|
24374
24171
|
const windowed = limit?.keepFrom !== void 0 && !(limit.keepFrom <= (options2.sinceMs ?? Number.NEGATIVE_INFINITY));
|
|
24172
|
+
const roots = /* @__PURE__ */ new Map();
|
|
24173
|
+
const startedAt = Date.now();
|
|
24375
24174
|
const fetched = await fetchInto({
|
|
24376
|
-
history: /* @__PURE__ */ __name((window2) =>
|
|
24175
|
+
history: /* @__PURE__ */ __name(async (window2) => {
|
|
24176
|
+
const page = await history(chat, { ...window2, reactions: false });
|
|
24177
|
+
if (refreshes(connection) && !options2.window && page.items[0])
|
|
24178
|
+
pagedRoots(roots, await connection.threadRootsIn(page.items[0].chatId, page.items), window2.before);
|
|
24179
|
+
return page;
|
|
24180
|
+
}, "history"),
|
|
24377
24181
|
store,
|
|
24378
24182
|
account,
|
|
24379
24183
|
fetching: deps.messenger.fetching ?? FETCHING,
|
|
24380
24184
|
...options2,
|
|
24381
24185
|
...windowed ? { sinceMs: limit.keepFrom } : {}
|
|
24382
24186
|
});
|
|
24383
|
-
const replies = fetched.chat && !options2.window ? await savedReplies(connection, store, account, fetched.chat, options2.stop) : 0;
|
|
24187
|
+
const replies = fetched.chat && !options2.window ? await savedReplies(connection, store, account, fetched.chat, { roots, startedAt }, options2.stop) : 0;
|
|
24384
24188
|
const read = replies > 0 ? { ...fetched, fetched: fetched.fetched + replies } : fetched;
|
|
24385
24189
|
const result = windowed && read.reachedSince ? { ...read, limited: "older_than_window" } : read;
|
|
24386
24190
|
if (result.limited && limit?.keepFrom !== void 0)
|
|
@@ -24416,7 +24220,7 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
|
|
|
24416
24220
|
const upToDate = heldToNewest(await deps.store(), await deps.account(), deps.messenger.fetching ?? FETCHING, {
|
|
24417
24221
|
...options2,
|
|
24418
24222
|
catchUp: catchingUp ? options2.catchUp ?? {} : false,
|
|
24419
|
-
threads: connection.threadReplies !== void 0
|
|
24223
|
+
threads: connection.threadReplies !== void 0 || refreshes(connection)
|
|
24420
24224
|
});
|
|
24421
24225
|
const finished = /* @__PURE__ */ __name(() => options2.onChat?.({ chats: chats.length, done: answer.items.length, fetched: answer.fetched }), "finished");
|
|
24422
24226
|
finished();
|
|
@@ -24629,12 +24433,12 @@ var heldToNewest = /* @__PURE__ */ __name((store, account, fetching, options2) =
|
|
|
24629
24433
|
const lastAt = Date.parse(chat.lastMessageAt ?? "");
|
|
24630
24434
|
if (Number.isNaN(lastAt))
|
|
24631
24435
|
return false;
|
|
24632
|
-
const [
|
|
24633
|
-
if (!
|
|
24436
|
+
const [newest2] = (await store.messages.messages(account, chat.id, { limit: 1 }).catch(() => ({ items: [] }))).items;
|
|
24437
|
+
if (!newest2 || Date.parse(newest2.timestamp) < lastAt)
|
|
24634
24438
|
return false;
|
|
24635
24439
|
const ranges = await store.sync.ranges(account, chat.id);
|
|
24636
24440
|
const top = ranges.reduce((best, range2) => best && best.to >= range2.to ? best : range2, void 0);
|
|
24637
|
-
const key = keyOf(fetching)(
|
|
24441
|
+
const key = keyOf(fetching)(newest2);
|
|
24638
24442
|
if (!top || key > top.to || key < top.from)
|
|
24639
24443
|
return false;
|
|
24640
24444
|
if (ranges.length === 1 && await store.sync.syncState(account, historyStartKey(chat.id)) !== void 0)
|
|
@@ -24645,17 +24449,57 @@ var heldToNewest = /* @__PURE__ */ __name((store, account, fetching, options2) =
|
|
|
24645
24449
|
return !Number.isNaN(startedAt) && startedAt < options2.sinceMs;
|
|
24646
24450
|
}, "heldToNewest");
|
|
24647
24451
|
var threadsKey = /* @__PURE__ */ __name((chatId) => `threads:${chatId}`, "threadsKey");
|
|
24648
|
-
var
|
|
24649
|
-
|
|
24452
|
+
var refreshes = /* @__PURE__ */ __name((connection) => connection.threadRootsIn !== void 0 && connection.recentThreadRoots !== void 0 && connection.rootReplies !== void 0, "refreshes");
|
|
24453
|
+
var pagedRoots = /* @__PURE__ */ __name((into, roots, before) => {
|
|
24454
|
+
for (const root of roots)
|
|
24455
|
+
into.set(root.id, { ...root, whole: before !== void 0 || into.get(root.id)?.whole === true });
|
|
24456
|
+
}, "pagedRoots");
|
|
24457
|
+
var THREAD_CLOCK_SKEW_MS = 6e4;
|
|
24458
|
+
var savedReplies = /* @__PURE__ */ __name(async (connection, store, account, chatId, { roots, startedAt }, stop) => {
|
|
24459
|
+
if (stop.aborted)
|
|
24650
24460
|
return 0;
|
|
24651
|
-
const
|
|
24652
|
-
const point = Number
|
|
24653
|
-
const
|
|
24654
|
-
if (
|
|
24655
|
-
|
|
24461
|
+
const stored = Number((await store.sync.syncState(account, threadsKey(chatId)))?.value);
|
|
24462
|
+
const point = Number.isFinite(stored) ? stored : void 0;
|
|
24463
|
+
const batches = refreshes(connection) ? refreshedThreads(connection, chatId, roots, point, stop) : connection.threadReplies ? await readyBatches(connection.threadReplies(chatId, point === void 0 ? {} : { since: point })) : void 0;
|
|
24464
|
+
if (!batches)
|
|
24465
|
+
return 0;
|
|
24466
|
+
let saved = 0;
|
|
24467
|
+
for await (const replies of batches) {
|
|
24468
|
+
if (replies.length > 0)
|
|
24469
|
+
await store.messages.saveMessages(account, chatId, replies, { via: "history", seenAt: startedAt });
|
|
24470
|
+
saved += replies.length;
|
|
24471
|
+
if (stop.aborted)
|
|
24472
|
+
return saved;
|
|
24473
|
+
}
|
|
24656
24474
|
await store.sync.setSyncState(account, threadsKey(chatId), String(startedAt));
|
|
24657
|
-
return
|
|
24475
|
+
return saved;
|
|
24658
24476
|
}, "savedReplies");
|
|
24477
|
+
var readyBatches = /* @__PURE__ */ __name(async (answer) => {
|
|
24478
|
+
const ready = await answer;
|
|
24479
|
+
return Symbol.asyncIterator in ready ? ready : [ready];
|
|
24480
|
+
}, "readyBatches");
|
|
24481
|
+
async function* refreshedThreads(connection, chatId, roots, point, stop) {
|
|
24482
|
+
const after = point === void 0 ? void 0 : point - THREAD_CLOCK_SKEW_MS;
|
|
24483
|
+
const all = new Map(roots);
|
|
24484
|
+
for (const root of await connection.recentThreadRoots(chatId)) {
|
|
24485
|
+
const paged = all.get(root.id);
|
|
24486
|
+
all.set(root.id, {
|
|
24487
|
+
...root,
|
|
24488
|
+
lastReplyAt: newest(paged?.lastReplyAt, root.lastReplyAt),
|
|
24489
|
+
whole: paged?.whole ?? false
|
|
24490
|
+
});
|
|
24491
|
+
}
|
|
24492
|
+
for (const root of all.values()) {
|
|
24493
|
+
if (stop.aborted)
|
|
24494
|
+
return;
|
|
24495
|
+
const replied = Date.parse(root.lastReplyAt ?? "");
|
|
24496
|
+
if (after !== void 0 && !root.whole && !(replied > after))
|
|
24497
|
+
continue;
|
|
24498
|
+
yield* await readyBatches(connection.rootReplies(chatId, root.id, after === void 0 || root.whole ? {} : { after }));
|
|
24499
|
+
}
|
|
24500
|
+
}
|
|
24501
|
+
__name(refreshedThreads, "refreshedThreads");
|
|
24502
|
+
var newest = /* @__PURE__ */ __name((one, other) => one === void 0 || other !== void 0 && Date.parse(other) > Date.parse(one) ? other : one, "newest");
|
|
24659
24503
|
var timeOfKey = /* @__PURE__ */ __name(async (store, account, chatId, key, byTime, fallback) => {
|
|
24660
24504
|
if (byTime)
|
|
24661
24505
|
return new Date(key).toISOString();
|
|
@@ -24663,20 +24507,20 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account, chatId, key, byTim
|
|
|
24663
24507
|
return message?.timestamp ?? fallback;
|
|
24664
24508
|
}, "timeOfKey");
|
|
24665
24509
|
|
|
24666
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24667
|
-
import { extname as
|
|
24510
|
+
// 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/attachments/extract.js
|
|
24511
|
+
import { extname as extname2 } from "node:path";
|
|
24668
24512
|
|
|
24669
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24513
|
+
// 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/readers/engine.js
|
|
24670
24514
|
import { readFileSync } from "node:fs";
|
|
24671
|
-
import { dirname
|
|
24515
|
+
import { dirname, extname, join as join2 } from "node:path";
|
|
24672
24516
|
import { fileURLToPath } from "node:url";
|
|
24673
24517
|
|
|
24674
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24518
|
+
// 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/attachments/container.js
|
|
24675
24519
|
import { setImmediate as tick } from "node:timers/promises";
|
|
24676
24520
|
import { crc32 } from "node:zlib";
|
|
24677
24521
|
var import_xmldom = __toESM(require_lib(), 1);
|
|
24678
24522
|
|
|
24679
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24523
|
+
// 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/attachments/encoding.js
|
|
24680
24524
|
var import_chardet = __toESM(require_lib2(), 1);
|
|
24681
24525
|
var import_iconv_lite = __toESM(require_lib3(), 1);
|
|
24682
24526
|
var SAMPLE = 65536;
|
|
@@ -24778,7 +24622,8 @@ var decodeXml = /* @__PURE__ */ __name((bytes2) => {
|
|
|
24778
24622
|
return result.text;
|
|
24779
24623
|
}, "decodeXml");
|
|
24780
24624
|
|
|
24781
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24625
|
+
// 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/attachments/container.js
|
|
24626
|
+
var MAX_KEPT = 50 * 1024 * 1024;
|
|
24782
24627
|
var MAX_PART = 10 * 1024 * 1024;
|
|
24783
24628
|
var MAX_ENTRIES = 1e3;
|
|
24784
24629
|
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
@@ -24792,7 +24637,8 @@ var cancelled = /* @__PURE__ */ __name((signal) => {
|
|
|
24792
24637
|
throw new CliError("cancelled", "document extraction cancelled");
|
|
24793
24638
|
}, "cancelled");
|
|
24794
24639
|
var safeName2 = /* @__PURE__ */ __name((name) => name.length > 0 && name.length <= 512 && !/^[\\/]|\\/.test(name) && ![...name].some((character2) => character2.charCodeAt(0) < 32) && !name.split("/").includes(".."), "safeName");
|
|
24795
|
-
var
|
|
24640
|
+
var KEPT = /* @__PURE__ */ __name((name) => /\.(xml|rels|opf|xhtml|html)$/i.test(name) || name === "mimetype", "KEPT");
|
|
24641
|
+
var directory = /* @__PURE__ */ __name((bytes2, maxExpanded) => {
|
|
24796
24642
|
const view = new DataView(bytes2.buffer, bytes2.byteOffset, bytes2.byteLength);
|
|
24797
24643
|
let end = -1;
|
|
24798
24644
|
for (let index = bytes2.length - 22; index >= Math.max(0, bytes2.length - 65557); index--) {
|
|
@@ -24813,6 +24659,7 @@ var directory = /* @__PURE__ */ __name((bytes2) => {
|
|
|
24813
24659
|
throw new Error("invalid_zip");
|
|
24814
24660
|
let offset = view.getUint32(end + 16, true);
|
|
24815
24661
|
let expanded = 0;
|
|
24662
|
+
let kept2 = 0;
|
|
24816
24663
|
const entries = /* @__PURE__ */ new Map();
|
|
24817
24664
|
for (let index = 0; index < count3; index++) {
|
|
24818
24665
|
if (offset + 46 > stop || view.getUint32(offset, true) !== 33639248)
|
|
@@ -24831,7 +24678,9 @@ var directory = /* @__PURE__ */ __name((bytes2) => {
|
|
|
24831
24678
|
if ((view.getUint32(offset + 38, true) >>> 16 & 61440) === 40960)
|
|
24832
24679
|
throw new Error("invalid_zip");
|
|
24833
24680
|
expanded += size2;
|
|
24834
|
-
if (
|
|
24681
|
+
if (KEPT(name))
|
|
24682
|
+
kept2 += size2;
|
|
24683
|
+
if (expanded > maxExpanded || kept2 > MAX_KEPT)
|
|
24835
24684
|
throw new ReaderLimit();
|
|
24836
24685
|
const local = view.getUint32(offset + 42, true);
|
|
24837
24686
|
if (local + 30 > offset || view.getUint32(local, true) !== 67324752)
|
|
@@ -24849,19 +24698,20 @@ var directory = /* @__PURE__ */ __name((bytes2) => {
|
|
|
24849
24698
|
throw new Error("invalid_zip");
|
|
24850
24699
|
return entries;
|
|
24851
24700
|
}, "directory");
|
|
24852
|
-
var readContainer = /* @__PURE__ */ __name(async (bytes2, signal) => {
|
|
24701
|
+
var readContainer = /* @__PURE__ */ __name(async (bytes2, signal, maxExpanded = attachmentMaxBytes()) => {
|
|
24853
24702
|
cancelled(signal);
|
|
24854
|
-
const entries = directory(bytes2);
|
|
24703
|
+
const entries = directory(bytes2, maxExpanded);
|
|
24855
24704
|
const result = /* @__PURE__ */ new Map();
|
|
24856
24705
|
const seen = /* @__PURE__ */ new Set();
|
|
24857
24706
|
const done2 = /* @__PURE__ */ new Set();
|
|
24858
24707
|
let expanded = 0;
|
|
24708
|
+
let kept2 = 0;
|
|
24859
24709
|
const archive = new Unzip((file) => {
|
|
24860
24710
|
const expected2 = entries.get(file.name);
|
|
24861
24711
|
if (!expected2 || seen.has(file.name))
|
|
24862
24712
|
throw new Error("invalid_zip");
|
|
24863
24713
|
seen.add(file.name);
|
|
24864
|
-
const keep2 =
|
|
24714
|
+
const keep2 = KEPT(file.name);
|
|
24865
24715
|
let size2 = 0;
|
|
24866
24716
|
let checksum = 0;
|
|
24867
24717
|
const parts = [];
|
|
@@ -24870,7 +24720,9 @@ var readContainer = /* @__PURE__ */ __name(async (bytes2, signal) => {
|
|
|
24870
24720
|
throw error;
|
|
24871
24721
|
size2 += data.length;
|
|
24872
24722
|
expanded += data.length;
|
|
24873
|
-
if (
|
|
24723
|
+
if (keep2)
|
|
24724
|
+
kept2 += data.length;
|
|
24725
|
+
if (expanded > maxExpanded || kept2 > MAX_KEPT || keep2 && size2 > MAX_PART)
|
|
24874
24726
|
throw new ReaderLimit();
|
|
24875
24727
|
checksum = crc32(data, checksum);
|
|
24876
24728
|
if (keep2)
|
|
@@ -24993,13 +24845,13 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
|
|
|
24993
24845
|
return found;
|
|
24994
24846
|
}, "elements");
|
|
24995
24847
|
|
|
24996
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24848
|
+
// 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/readers/engine.js
|
|
24997
24849
|
var BUILT_IN = ["unpdf", "mammoth", "word-extractor", "linkedom", "defuddle/node"];
|
|
24998
24850
|
var ENGINES = [...BUILT_IN, "@napi-rs/canvas"];
|
|
24999
24851
|
var isMissing = /* @__PURE__ */ __name((error, name) => error?.code === "ERR_MODULE_NOT_FOUND" && String(error.message).includes(name), "isMissing");
|
|
25000
24852
|
var versionOf = /* @__PURE__ */ __name((name) => {
|
|
25001
24853
|
try {
|
|
25002
|
-
let directory2 =
|
|
24854
|
+
let directory2 = dirname(fileURLToPath(resolveFrom(new URL("readers/engine.js", import.meta.resolve("@wirecat/cli-core")).href, name)));
|
|
25003
24855
|
for (let depth = 0; depth < 6; depth += 1) {
|
|
25004
24856
|
try {
|
|
25005
24857
|
const manifest = JSON.parse(readFileSync(join2(directory2, "package.json"), "utf8"));
|
|
@@ -25007,7 +24859,7 @@ var versionOf = /* @__PURE__ */ __name((name) => {
|
|
|
25007
24859
|
return `${name}@${manifest.version}`;
|
|
25008
24860
|
} catch {
|
|
25009
24861
|
}
|
|
25010
|
-
directory2 =
|
|
24862
|
+
directory2 = dirname(directory2);
|
|
25011
24863
|
}
|
|
25012
24864
|
} catch {
|
|
25013
24865
|
}
|
|
@@ -25035,7 +24887,7 @@ var withEngine = /* @__PURE__ */ __name(async (load, name, read) => {
|
|
|
25035
24887
|
}
|
|
25036
24888
|
}, "withEngine");
|
|
25037
24889
|
var startsWith = /* @__PURE__ */ __name((bytes2, magic) => bytes2.length >= magic.length && [...magic].every((char, index) => bytes2[index] === char.charCodeAt(0)), "startsWith");
|
|
25038
|
-
var extensionOf = /* @__PURE__ */ __name(({ name, path }) =>
|
|
24890
|
+
var extensionOf = /* @__PURE__ */ __name(({ name, path }) => extname(name ?? path).toLowerCase(), "extensionOf");
|
|
25039
24891
|
var capped2 = /* @__PURE__ */ __name((text2) => text2.length > MAX_TEXT_CHARS ? text2.slice(0, MAX_TEXT_CHARS) : text2, "capped");
|
|
25040
24892
|
var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
|
|
25041
24893
|
const decoded = decodeText(bytes2);
|
|
@@ -25051,7 +24903,7 @@ var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
|
|
|
25051
24903
|
}
|
|
25052
24904
|
}, "derived");
|
|
25053
24905
|
|
|
25054
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24906
|
+
// 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/readers/image/index.js
|
|
25055
24907
|
var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
|
|
25056
24908
|
var image = {
|
|
25057
24909
|
id: "image",
|
|
@@ -25060,7 +24912,7 @@ var image = {
|
|
|
25060
24912
|
read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
|
|
25061
24913
|
};
|
|
25062
24914
|
|
|
25063
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24915
|
+
// 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/readers/doc/index.js
|
|
25064
24916
|
var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
|
|
25065
24917
|
var doc = {
|
|
25066
24918
|
id: "doc",
|
|
@@ -25072,7 +24924,7 @@ var doc = {
|
|
|
25072
24924
|
}), "read")
|
|
25073
24925
|
};
|
|
25074
24926
|
|
|
25075
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24927
|
+
// 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/readers/docx/index.js
|
|
25076
24928
|
var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
25077
24929
|
var docx = {
|
|
25078
24930
|
id: "docx",
|
|
@@ -25085,10 +24937,10 @@ var docx = {
|
|
|
25085
24937
|
}), "read")
|
|
25086
24938
|
};
|
|
25087
24939
|
|
|
25088
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24940
|
+
// 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/attachments/markup.js
|
|
25089
24941
|
var import_iconv_lite2 = __toESM(require_lib3(), 1);
|
|
25090
24942
|
|
|
25091
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24943
|
+
// 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/domain/html-entities.js
|
|
25092
24944
|
var NAMED = {
|
|
25093
24945
|
amp: "&",
|
|
25094
24946
|
lt: "<",
|
|
@@ -25140,7 +24992,7 @@ var decodeEntities = /* @__PURE__ */ __name((text2) => text2.replace(/&(#x[0-9a-
|
|
|
25140
24992
|
return body[1] === "x" || body[1] === "X" ? character(Number.parseInt(body.slice(2), 16), entity) : character(Number(body.slice(1)), entity);
|
|
25141
24993
|
}), "decodeEntities");
|
|
25142
24994
|
|
|
25143
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24995
|
+
// 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/attachments/markup.js
|
|
25144
24996
|
var RTF_SKIPPED = /* @__PURE__ */ new Set([
|
|
25145
24997
|
"fonttbl",
|
|
25146
24998
|
"colortbl",
|
|
@@ -25281,11 +25133,11 @@ var dropHidden = /* @__PURE__ */ __name((source) => {
|
|
|
25281
25133
|
const unclosed = /* @__PURE__ */ new Set();
|
|
25282
25134
|
let out = "";
|
|
25283
25135
|
let kept2 = 0;
|
|
25284
|
-
for (const
|
|
25285
|
-
const name =
|
|
25286
|
-
if (
|
|
25136
|
+
for (const open6 of source.matchAll(HTML_DROPPED_OPEN)) {
|
|
25137
|
+
const name = open6[1].toLowerCase();
|
|
25138
|
+
if (open6.index < kept2 || unclosed.has(name))
|
|
25287
25139
|
continue;
|
|
25288
|
-
const gt = source.indexOf(">",
|
|
25140
|
+
const gt = source.indexOf(">", open6.index + open6[0].length);
|
|
25289
25141
|
if (gt < 0)
|
|
25290
25142
|
break;
|
|
25291
25143
|
const close = HTML_DROPPED_CLOSE.get(name);
|
|
@@ -25295,7 +25147,7 @@ var dropHidden = /* @__PURE__ */ __name((source) => {
|
|
|
25295
25147
|
unclosed.add(name);
|
|
25296
25148
|
continue;
|
|
25297
25149
|
}
|
|
25298
|
-
out += source.slice(kept2,
|
|
25150
|
+
out += source.slice(kept2, open6.index);
|
|
25299
25151
|
kept2 = end.index + end[0].length;
|
|
25300
25152
|
}
|
|
25301
25153
|
return out + source.slice(kept2);
|
|
@@ -25306,7 +25158,7 @@ var htmlText = /* @__PURE__ */ __name((source) => {
|
|
|
25306
25158
|
return decodeEntities(replaceTags(blocks, /<[^>]*>/g, "")).replace(/(?<![ \t\u00a0])[ \t\u00a0]+\n/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
25307
25159
|
}, "htmlText");
|
|
25308
25160
|
|
|
25309
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25161
|
+
// 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/readers/html/page.js
|
|
25310
25162
|
var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
|
|
25311
25163
|
var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
|
|
25312
25164
|
var jsonLdNodes = /* @__PURE__ */ __name((document) => {
|
|
@@ -25362,7 +25214,7 @@ var markdownSections = /* @__PURE__ */ __name((text2) => {
|
|
|
25362
25214
|
return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text2.length }));
|
|
25363
25215
|
}, "markdownSections");
|
|
25364
25216
|
|
|
25365
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25217
|
+
// 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/readers/html/index.js
|
|
25366
25218
|
var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
|
|
25367
25219
|
var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
|
|
25368
25220
|
var loaded = /* @__PURE__ */ __name(async (load, name) => {
|
|
@@ -25400,8 +25252,8 @@ var readPage = /* @__PURE__ */ __name(async (source, load) => {
|
|
|
25400
25252
|
};
|
|
25401
25253
|
}, "readPage");
|
|
25402
25254
|
var titleOf = /* @__PURE__ */ __name((source) => {
|
|
25403
|
-
const
|
|
25404
|
-
const gt =
|
|
25255
|
+
const open6 = /<title/i.exec(source);
|
|
25256
|
+
const gt = open6 ? source.indexOf(">", open6.index + open6[0].length) : -1;
|
|
25405
25257
|
if (gt < 0)
|
|
25406
25258
|
return "";
|
|
25407
25259
|
const close = /<\/title\s*>/gi;
|
|
@@ -25433,10 +25285,10 @@ var html = {
|
|
|
25433
25285
|
}, "read")
|
|
25434
25286
|
};
|
|
25435
25287
|
|
|
25436
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25288
|
+
// 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/attachments/documents.js
|
|
25437
25289
|
import { posix } from "node:path";
|
|
25438
25290
|
|
|
25439
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25291
|
+
// 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/attachments/sheets.js
|
|
25440
25292
|
var columnName = /* @__PURE__ */ __name((column) => {
|
|
25441
25293
|
let name = "";
|
|
25442
25294
|
for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
|
|
@@ -25491,7 +25343,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
|
|
|
25491
25343
|
return { text: parts.join("").trim(), truncated: false };
|
|
25492
25344
|
}, "sheetText");
|
|
25493
25345
|
|
|
25494
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25346
|
+
// 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/attachments/documents.js
|
|
25495
25347
|
var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
|
|
25496
25348
|
var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
|
|
25497
25349
|
var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
|
|
@@ -25891,7 +25743,7 @@ var readDocument = /* @__PURE__ */ __name(async (bytes2, kind, signal) => {
|
|
|
25891
25743
|
}
|
|
25892
25744
|
}, "readDocument");
|
|
25893
25745
|
|
|
25894
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25746
|
+
// 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/readers/office/index.js
|
|
25895
25747
|
var office = {
|
|
25896
25748
|
id: "office",
|
|
25897
25749
|
version: documentExtractor("odt"),
|
|
@@ -25902,7 +25754,7 @@ var office = {
|
|
|
25902
25754
|
}, "read")
|
|
25903
25755
|
};
|
|
25904
25756
|
|
|
25905
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25757
|
+
// 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/readers/pdf/index.js
|
|
25906
25758
|
var pdf = {
|
|
25907
25759
|
id: "pdf",
|
|
25908
25760
|
version: "unpdf",
|
|
@@ -25969,7 +25821,7 @@ var pdf = {
|
|
|
25969
25821
|
}), "read")
|
|
25970
25822
|
};
|
|
25971
25823
|
|
|
25972
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25824
|
+
// 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/readers/plain/index.js
|
|
25973
25825
|
var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
|
|
25974
25826
|
var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
|
|
25975
25827
|
var readPlain = /* @__PURE__ */ __name((bytes2) => {
|
|
@@ -25989,7 +25841,7 @@ var plain = {
|
|
|
25989
25841
|
read: /* @__PURE__ */ __name(async (bytes2) => readPlain(bytes2), "read")
|
|
25990
25842
|
};
|
|
25991
25843
|
|
|
25992
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25844
|
+
// 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/readers/rtf/index.js
|
|
25993
25845
|
var rtf = {
|
|
25994
25846
|
id: "rtf",
|
|
25995
25847
|
version: "v1",
|
|
@@ -25997,10 +25849,10 @@ var rtf = {
|
|
|
25997
25849
|
read: /* @__PURE__ */ __name(async (bytes2) => derived(bytes2, "rtf:v1", rtfText), "read")
|
|
25998
25850
|
};
|
|
25999
25851
|
|
|
26000
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26001
|
-
import { basename
|
|
25852
|
+
// 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/readers/sheets/index.js
|
|
25853
|
+
import { basename } from "node:path";
|
|
26002
25854
|
|
|
26003
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25855
|
+
// 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/attachments/csv-spans.js
|
|
26004
25856
|
var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) => {
|
|
26005
25857
|
const cells = [];
|
|
26006
25858
|
let row = 1, column = 1, start = 0, quoted = false, truncated = false;
|
|
@@ -26038,7 +25890,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) =
|
|
|
26038
25890
|
return { cells, truncated };
|
|
26039
25891
|
}, "delimitedSpans");
|
|
26040
25892
|
|
|
26041
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25893
|
+
// 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/readers/sheets/index.js
|
|
26042
25894
|
var DELIMITED = {
|
|
26043
25895
|
".csv": ",",
|
|
26044
25896
|
".tsv": " ",
|
|
@@ -26068,7 +25920,7 @@ var sheets = {
|
|
|
26068
25920
|
column,
|
|
26069
25921
|
value: unquoted(result.text.slice(start, end))
|
|
26070
25922
|
}));
|
|
26071
|
-
const name =
|
|
25923
|
+
const name = basename(hint.name ?? hint.path, extensionOf(hint)) || "Sheet";
|
|
26072
25924
|
const { text: text2, truncated } = sheetText([{ name, cells }]);
|
|
26073
25925
|
return text2 === "" ? { status: "needs-agent", extractor } : { status: "extracted", text: text2, extractor, ...truncated || spans.truncated ? { truncated: true } : {} };
|
|
26074
25926
|
} catch {
|
|
@@ -26077,7 +25929,7 @@ var sheets = {
|
|
|
26077
25929
|
}, "read")
|
|
26078
25930
|
};
|
|
26079
25931
|
|
|
26080
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25932
|
+
// 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/readers/registry.js
|
|
26081
25933
|
var BUILT_INS2 = [office, pdf, docx, doc, rtf, html, sheets, plain, image];
|
|
26082
25934
|
var HEAD_BYTES = 1024;
|
|
26083
25935
|
var readers = [...BUILT_INS2];
|
|
@@ -26087,9 +25939,9 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes2, hint, context2) =>
|
|
|
26087
25939
|
return reader ? reader.read(bytes2, hint, context2) : { status: "unsupported" };
|
|
26088
25940
|
}, "readWithRegistry");
|
|
26089
25941
|
|
|
26090
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25942
|
+
// 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/attachments/extract.js
|
|
26091
25943
|
var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
|
|
26092
|
-
var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) =>
|
|
25944
|
+
var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname2(name ?? path).toLowerCase(), "extensionOf");
|
|
26093
25945
|
var extractText = /* @__PURE__ */ __name(async (bytes2, hint, load, signal, env = process.env) => {
|
|
26094
25946
|
if (bytes2.byteLength > attachmentMaxBytes(env))
|
|
26095
25947
|
return { status: "too-large" };
|
|
@@ -26116,16 +25968,16 @@ var ENGINE_FILES = {
|
|
|
26116
25968
|
var isBuiltIn = /* @__PURE__ */ __name((engine) => BUILT_IN.includes(engine), "isBuiltIn");
|
|
26117
25969
|
var engineMissing = /* @__PURE__ */ __name((engine) => isBuiltIn(engine) ? `the package ${engine}, which ships with this tool, could not be loaded \u2014 reinstall the tool` : `the optional package ${engine} is needed, installed where this tool is (for a global npm install: npm install -g ${engine})`, "engineMissing");
|
|
26118
25970
|
var engineHint = /* @__PURE__ */ __name((engine, command) => `${ENGINE_FILES[engine]} files: ${engineMissing(engine).replace("this tool", command)}; they are read on the next run`, "engineHint");
|
|
26119
|
-
var engineStates = /* @__PURE__ */ __name((
|
|
25971
|
+
var engineStates = /* @__PURE__ */ __name((resolve6 = (name) => resolveFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name)) => Object.fromEntries(ENGINES.map((name) => {
|
|
26120
25972
|
try {
|
|
26121
|
-
|
|
25973
|
+
resolve6(name);
|
|
26122
25974
|
return [name, isBuiltIn(name) ? "built in" : "installed"];
|
|
26123
25975
|
} catch {
|
|
26124
25976
|
return [name, "missing"];
|
|
26125
25977
|
}
|
|
26126
25978
|
})), "engineStates");
|
|
26127
25979
|
|
|
26128
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25980
|
+
// 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/domain/models.js
|
|
26129
25981
|
var GROUP_SETTINGS = [
|
|
26130
25982
|
"allCanPin",
|
|
26131
25983
|
"onlyAdminsAdd",
|
|
@@ -26139,7 +25991,7 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
|
|
|
26139
25991
|
var senderIsMe = /* @__PURE__ */ __name((message, account) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account, "senderIsMe");
|
|
26140
25992
|
var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
|
|
26141
25993
|
|
|
26142
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25994
|
+
// 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/sends/send-as.js
|
|
26143
25995
|
var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
|
|
26144
25996
|
if (sendAs === void 0) {
|
|
26145
25997
|
const saved = connection.savedSender?.bind(connection);
|
|
@@ -26164,62 +26016,7 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
|
|
|
26164
26016
|
return sendAs;
|
|
26165
26017
|
}, "typedSendAs");
|
|
26166
26018
|
|
|
26167
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26168
|
-
var LATIN = {
|
|
26169
|
-
\u0430: "a",
|
|
26170
|
-
\u0431: "b",
|
|
26171
|
-
\u0432: "v",
|
|
26172
|
-
\u0433: "g",
|
|
26173
|
-
\u0434: "d",
|
|
26174
|
-
\u0435: "e",
|
|
26175
|
-
\u0436: "zh",
|
|
26176
|
-
\u0437: "z",
|
|
26177
|
-
\u0438: "i",
|
|
26178
|
-
\u043A: "k",
|
|
26179
|
-
\u043B: "l",
|
|
26180
|
-
\u043C: "m",
|
|
26181
|
-
\u043D: "n",
|
|
26182
|
-
\u043E: "o",
|
|
26183
|
-
\u043F: "p",
|
|
26184
|
-
\u0440: "r",
|
|
26185
|
-
\u0441: "s",
|
|
26186
|
-
\u0442: "t",
|
|
26187
|
-
\u0443: "u",
|
|
26188
|
-
\u0444: "f",
|
|
26189
|
-
\u0445: "h",
|
|
26190
|
-
\u0446: "ts",
|
|
26191
|
-
\u0447: "ch",
|
|
26192
|
-
\u0448: "sh",
|
|
26193
|
-
\u0449: "sch",
|
|
26194
|
-
\u044A: "",
|
|
26195
|
-
\u044B: "y",
|
|
26196
|
-
\u044C: "",
|
|
26197
|
-
\u044D: "e",
|
|
26198
|
-
\u044E: "yu",
|
|
26199
|
-
\u044F: "ya"
|
|
26200
|
-
};
|
|
26201
|
-
var latinSpellings = /* @__PURE__ */ __name((word) => {
|
|
26202
|
-
if (!new RegExp("\\p{Script=Cyrillic}", "u").test(word))
|
|
26203
|
-
return [];
|
|
26204
|
-
const plain2 = [...normalize(word)].map((letter) => LATIN[letter] ?? letter).join("");
|
|
26205
|
-
return [.../* @__PURE__ */ new Set([plain2, plain2.replaceAll("ks", "x")])];
|
|
26206
|
-
}, "latinSpellings");
|
|
26207
|
-
var respelled = /* @__PURE__ */ __name(async (vocabulary, words3) => {
|
|
26208
|
-
const known2 = await vocabulary.knownTerms(words3);
|
|
26209
|
-
const found = /* @__PURE__ */ new Map();
|
|
26210
|
-
for (const word of words3.filter((one) => !known2.has(one))) {
|
|
26211
|
-
const latin = latinSpellings(word);
|
|
26212
|
-
const held = await vocabulary.knownTerms(latin);
|
|
26213
|
-
const nearLatin = await correctWords(vocabulary, latin.filter((one) => !held.has(one)));
|
|
26214
|
-
const asLatin = [.../* @__PURE__ */ new Set([...held, ...[...nearLatin.values()].flat()])];
|
|
26215
|
-
const forms = asLatin.length ? asLatin : (await correctWords(vocabulary, [word])).get(normalize(word)) ?? [];
|
|
26216
|
-
if (forms.length)
|
|
26217
|
-
found.set(word, forms);
|
|
26218
|
-
}
|
|
26219
|
-
return found;
|
|
26220
|
-
}, "respelled");
|
|
26221
|
-
|
|
26222
|
-
// 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/search/total.js
|
|
26019
|
+
// 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/search/total.js
|
|
26223
26020
|
var TOTAL_CAP = 1e4;
|
|
26224
26021
|
var totalOf = /* @__PURE__ */ __name((count3, shown, hasMore, exact = true) => {
|
|
26225
26022
|
const least = shown + (hasMore ? 1 : 0);
|
|
@@ -26230,7 +26027,7 @@ var totalOf = /* @__PURE__ */ __name((count3, shown, hasMore, exact = true) => {
|
|
|
26230
26027
|
return { value: count3, relation: exact ? "eq" : "gte" };
|
|
26231
26028
|
}, "totalOf");
|
|
26232
26029
|
|
|
26233
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26030
|
+
// 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/search/lucene/meaning-parts.js
|
|
26234
26031
|
var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
|
|
26235
26032
|
var fieldsOfQuery = /* @__PURE__ */ __name((root, everything) => {
|
|
26236
26033
|
let narrows = false;
|
|
@@ -26259,7 +26056,7 @@ var meaningWords = /* @__PURE__ */ __name((root) => {
|
|
|
26259
26056
|
return wanted(root).join(" ").trim();
|
|
26260
26057
|
}, "meaningWords");
|
|
26261
26058
|
|
|
26262
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26059
|
+
// 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/services/messages-combined.js
|
|
26263
26060
|
var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
|
|
26264
26061
|
var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
|
|
26265
26062
|
var searchCombined = /* @__PURE__ */ __name(async (store, account, request, messenger = {}, options2 = COMBINED_DEFAULTS) => {
|
|
@@ -26460,7 +26257,7 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
|
|
|
26460
26257
|
return mode === "coverage" ? coverage2 * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase2 : coverage2 * 4 + proximity + phrase2;
|
|
26461
26258
|
}, "signals");
|
|
26462
26259
|
|
|
26463
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26260
|
+
// 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/services/messages-discovery.js
|
|
26464
26261
|
var MEANING_DEPTH = 100;
|
|
26465
26262
|
var RRF_K2 = 60;
|
|
26466
26263
|
var RERANK_DEPTH = 50;
|
|
@@ -26786,7 +26583,7 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
|
|
|
26786
26583
|
})).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
|
|
26787
26584
|
}, "mixedWithReranker");
|
|
26788
26585
|
|
|
26789
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26586
|
+
// 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/services/named-chat.js
|
|
26790
26587
|
var LEAST_USES = 3;
|
|
26791
26588
|
var SAMPLE2 = 50;
|
|
26792
26589
|
var CAPITALISED = 0.8;
|
|
@@ -26840,7 +26637,7 @@ var queryWords2 = /* @__PURE__ */ __name((query) => {
|
|
|
26840
26637
|
}, "queryWords");
|
|
26841
26638
|
var without = /* @__PURE__ */ __name((query, word) => query.replace(new RegExp(`(?<![\\p{L}\\p{N}])${word}(?![\\p{L}\\p{N}])`, "giu"), " ").replace(/\s+/gu, " ").trim(), "without");
|
|
26842
26639
|
|
|
26843
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26640
|
+
// 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/services/thread-context.js
|
|
26844
26641
|
var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
|
|
26845
26642
|
var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
|
|
26846
26643
|
var threadBounds = /* @__PURE__ */ __name((options2 = {}) => {
|
|
@@ -27039,7 +26836,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
27039
26836
|
return result;
|
|
27040
26837
|
}, "readThreadContext");
|
|
27041
26838
|
|
|
27042
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26839
|
+
// 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/services/messages-archive-search.js
|
|
27043
26840
|
var SEARCH_FILL_MS = 200;
|
|
27044
26841
|
var statsStore = /* @__PURE__ */ __name(async (store, account, request, messenger = {}) => {
|
|
27045
26842
|
const stop = Date.now() + SEARCH_FILL_MS;
|
|
@@ -27080,15 +26877,15 @@ var searchStore = /* @__PURE__ */ __name(async (store, account, request, messeng
|
|
|
27080
26877
|
const page = /* @__PURE__ */ __name((asked) => searchPage(store, account, { ...asked, limit: asked.limit + offset }, messenger, meaning, rerank), "page");
|
|
27081
26878
|
const all = await page(request);
|
|
27082
26879
|
const { named: named2 } = helped;
|
|
27083
|
-
const
|
|
26880
|
+
const inside = named2 && typed !== void 0 ? await page({
|
|
27084
26881
|
...request,
|
|
27085
26882
|
text: plainQuery(without(helped.text ?? typed, named2.word) || typed),
|
|
27086
26883
|
chat: named2.chatId
|
|
27087
26884
|
}) : void 0;
|
|
27088
|
-
const shown = new Set(
|
|
27089
|
-
const found =
|
|
26885
|
+
const shown = new Set(inside?.items.map(({ locator }) => locator));
|
|
26886
|
+
const found = inside ? {
|
|
27090
26887
|
...all,
|
|
27091
|
-
items: [...
|
|
26888
|
+
items: [...inside.items, ...all.items.filter(({ locator }) => !shown.has(locator))].slice(0, request.limit + offset)
|
|
27092
26889
|
} : all;
|
|
27093
26890
|
const discovery = found.query?.discovery;
|
|
27094
26891
|
const total = discovery ? totalOf(discovery.candidates, found.items.length, found.hasMore, !discovery.truncated) : totalOf(await countLucene(store, account, { ...request.discover ? discoveryRequest(request) : request, limit: request.limit + offset }, messenger, TOTAL_CAP).catch((error) => {
|
|
@@ -27147,7 +26944,7 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
|
|
|
27147
26944
|
}, "accountOf");
|
|
27148
26945
|
var keyOf2 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}/${account}`, "keyOf");
|
|
27149
26946
|
|
|
27150
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26947
|
+
// 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/embeddings/keys.js
|
|
27151
26948
|
var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
|
|
27152
26949
|
const host = new URL(baseUrl).host;
|
|
27153
26950
|
return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
|
|
@@ -27180,7 +26977,7 @@ var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) =>
|
|
|
27180
26977
|
};
|
|
27181
26978
|
}, "embeddingKeys");
|
|
27182
26979
|
|
|
27183
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26980
|
+
// 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/models/openai.js
|
|
27184
26981
|
var options = strictObject({
|
|
27185
26982
|
temperature: range(0, 2),
|
|
27186
26983
|
top_p: range(0, 1),
|
|
@@ -27247,7 +27044,7 @@ var openai = {
|
|
|
27247
27044
|
}), "complete")
|
|
27248
27045
|
};
|
|
27249
27046
|
|
|
27250
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27047
|
+
// 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/models/index.js
|
|
27251
27048
|
var modelGateway = /* @__PURE__ */ __name((deps) => ({
|
|
27252
27049
|
complete: /* @__PURE__ */ __name(async (request) => {
|
|
27253
27050
|
if (deps.signal?.aborted)
|
|
@@ -27262,7 +27059,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
|
|
|
27262
27059
|
if (!adapter && target2.provider === "openai")
|
|
27263
27060
|
adapter = openai;
|
|
27264
27061
|
if (!adapter && target2.provider === "anthropic")
|
|
27265
|
-
adapter = (await import("./anthropic-
|
|
27062
|
+
adapter = (await import("./anthropic-PQN6MNP7.js")).anthropic;
|
|
27266
27063
|
if (!adapter)
|
|
27267
27064
|
throw new CliError("validation_error", `no model adapter for ${target2.provider}`);
|
|
27268
27065
|
if (request.images !== void 0 && adapter.images !== true)
|
|
@@ -27322,7 +27119,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
|
|
|
27322
27119
|
}, "complete")
|
|
27323
27120
|
}), "modelGateway");
|
|
27324
27121
|
|
|
27325
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27122
|
+
// 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/services/searches.js
|
|
27326
27123
|
var savedSearchItem = /* @__PURE__ */ __name((one) => ({
|
|
27327
27124
|
id: one.id,
|
|
27328
27125
|
name: one.name,
|
|
@@ -27448,7 +27245,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
|
|
|
27448
27245
|
};
|
|
27449
27246
|
}, "searchesService");
|
|
27450
27247
|
|
|
27451
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27248
|
+
// 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/services/text-model-choice.js
|
|
27452
27249
|
import { createHash as createHash3 } from "node:crypto";
|
|
27453
27250
|
import { existsSync } from "node:fs";
|
|
27454
27251
|
var useTextModel = /* @__PURE__ */ __name(async (id2, { env, command }) => {
|
|
@@ -27579,11 +27376,11 @@ var addCustomTextModel = /* @__PURE__ */ __name(async (id2, payload, { env, fetc
|
|
|
27579
27376
|
return { ...checked2.output, custom: true };
|
|
27580
27377
|
}, "addCustomTextModel");
|
|
27581
27378
|
|
|
27582
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27379
|
+
// 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/calendar/sync.js
|
|
27583
27380
|
var DAY3 = 864e5;
|
|
27584
27381
|
var SLOTS_EVERY = 7 * DAY3;
|
|
27585
27382
|
|
|
27586
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27383
|
+
// 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/calendar/reads.js
|
|
27587
27384
|
var localDate = /* @__PURE__ */ __name((at, zone) => new Intl.DateTimeFormat("en-CA", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit" }).format(at), "localDate");
|
|
27588
27385
|
var plusDays = /* @__PURE__ */ __name((date, days) => {
|
|
27589
27386
|
const [year, month, day2] = date.split("-").map(Number);
|
|
@@ -27647,10 +27444,10 @@ var EVENTS_QUERY = {
|
|
|
27647
27444
|
} : field)
|
|
27648
27445
|
};
|
|
27649
27446
|
|
|
27650
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27447
|
+
// 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/calendar/feeds.js
|
|
27651
27448
|
var FEED_LIMITS = { maxBytes: 10 * 1024 * 1024, timeoutMs: 3e4, redirects: 5 };
|
|
27652
27449
|
|
|
27653
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27450
|
+
// 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/calendar/writer.js
|
|
27654
27451
|
var EVENTS_NOTIFY_KEY = "events.notify";
|
|
27655
27452
|
var EVENTS_DELETE_SERIES_KEY = "events.delete.series";
|
|
27656
27453
|
var EVENTS_REMIND_HOOK_KEY = "events.remind.hook";
|
|
@@ -27668,7 +27465,7 @@ var CALENDAR_WRITE_DEFAULTS = {
|
|
|
27668
27465
|
[EVENTS_REMIND_HOOK_KEY]: "deny"
|
|
27669
27466
|
};
|
|
27670
27467
|
|
|
27671
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27468
|
+
// 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/services/meeting-passage-format.js
|
|
27672
27469
|
var visible = /* @__PURE__ */ __name((text2) => text2.replace(/[\p{Cc}\p{Cf}]/gu, (value) => value === "\n" || value === " " ? value : `\\u{${value.codePointAt(0)?.toString(16)}}`), "visible");
|
|
27673
27470
|
var markdown = /* @__PURE__ */ __name((text2) => visible(text2).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replace(/[\\`*_[\]#|~]/g, "\\$&"), "markdown");
|
|
27674
27471
|
var timestamp = /* @__PURE__ */ __name((ms) => {
|
|
@@ -27737,7 +27534,7 @@ ${body}`;
|
|
|
27737
27534
|
`;
|
|
27738
27535
|
}, "formatMeetingPassage");
|
|
27739
27536
|
|
|
27740
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27537
|
+
// 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/services/meeting-preparation-validation.js
|
|
27741
27538
|
var MEETING_PREPARATION_LIMITS = {
|
|
27742
27539
|
meetings: { min: 1, max: 20, default: 5 },
|
|
27743
27540
|
cues: { min: 1, max: 100, default: 10 },
|
|
@@ -27810,7 +27607,7 @@ var validateMeetingPreparationRequest = /* @__PURE__ */ __name((externalId, orig
|
|
|
27810
27607
|
};
|
|
27811
27608
|
}, "validateMeetingPreparationRequest");
|
|
27812
27609
|
|
|
27813
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27610
|
+
// 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/services/meeting-communications-selection.js
|
|
27814
27611
|
var validatePreparationCommunications = /* @__PURE__ */ __name((section, request, after) => {
|
|
27815
27612
|
const fail2 = /* @__PURE__ */ __name(() => {
|
|
27816
27613
|
throw new CliError("invalid_response", "Preparation communications returned another selection or invalid evidence");
|
|
@@ -27858,7 +27655,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
27858
27655
|
}
|
|
27859
27656
|
}, "validatePreparationCommunications");
|
|
27860
27657
|
|
|
27861
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27658
|
+
// 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/services/package-upgrade.js
|
|
27862
27659
|
var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check: check2 }, ports) => {
|
|
27863
27660
|
const installer = ports.installer();
|
|
27864
27661
|
const argv = updateCommand(installer, packageName);
|
|
@@ -27923,18 +27720,18 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
|
|
|
27923
27720
|
return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
|
|
27924
27721
|
}, "dayAfter");
|
|
27925
27722
|
|
|
27926
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27723
|
+
// 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/services/media-archive.js
|
|
27927
27724
|
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
27928
27725
|
|
|
27929
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27726
|
+
// 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/services/media-archive-files.js
|
|
27930
27727
|
import { lstat } from "node:fs/promises";
|
|
27931
27728
|
|
|
27932
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27729
|
+
// 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/persistence/native/recording-partial-store.js
|
|
27933
27730
|
import { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypto";
|
|
27934
|
-
import { open as
|
|
27731
|
+
import { open as open2, rename as rename2, unlink as unlink2 } from "node:fs/promises";
|
|
27935
27732
|
import { join as join4 } from "node:path";
|
|
27936
27733
|
|
|
27937
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27734
|
+
// 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/persistence/native/recording-partial-metadata.js
|
|
27938
27735
|
import { createHash as createHash4 } from "node:crypto";
|
|
27939
27736
|
var metadataLimit = 16384;
|
|
27940
27737
|
var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
|
|
@@ -27994,9 +27791,9 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
|
|
|
27994
27791
|
}
|
|
27995
27792
|
}, "readPartialMetadata");
|
|
27996
27793
|
|
|
27997
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27794
|
+
// 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/persistence/native/recording-partial-writer.js
|
|
27998
27795
|
import { randomUUID } from "node:crypto";
|
|
27999
|
-
import { open
|
|
27796
|
+
import { open, rename, unlink } from "node:fs/promises";
|
|
28000
27797
|
import { join as join3 } from "node:path";
|
|
28001
27798
|
var partialWriter = /* @__PURE__ */ __name(async (input) => {
|
|
28002
27799
|
const { file, signal, partial } = input;
|
|
@@ -28024,7 +27821,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
|
|
|
28024
27821
|
if (Buffer.byteLength(content) > metadataLimit)
|
|
28025
27822
|
throw new CliError("validation_error", "recording partial metadata exceeds its byte limit");
|
|
28026
27823
|
const temp = join3(input.root, `${input.prefix}${randomUUID()}.tmp`);
|
|
28027
|
-
const metadata = await
|
|
27824
|
+
const metadata = await open(temp, "wx", 384);
|
|
28028
27825
|
try {
|
|
28029
27826
|
try {
|
|
28030
27827
|
await metadata.writeFile(content);
|
|
@@ -28086,7 +27883,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
|
|
|
28086
27883
|
};
|
|
28087
27884
|
}, "partialWriter");
|
|
28088
27885
|
|
|
28089
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27886
|
+
// 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/persistence/native/recording-partial-store.js
|
|
28090
27887
|
var NativeRecordingPartialStore = class {
|
|
28091
27888
|
static {
|
|
28092
27889
|
__name(this, "NativeRecordingPartialStore");
|
|
@@ -28152,7 +27949,7 @@ var NativeRecordingPartialStore = class {
|
|
|
28152
27949
|
file = await openOrdinaryFile(this.path, { writable: true });
|
|
28153
27950
|
} else {
|
|
28154
27951
|
const temp = join4(this.root, `${this.options.prefix}${randomUUID2()}.tmp`);
|
|
28155
|
-
file = await
|
|
27952
|
+
file = await open2(temp, "wx+", 384);
|
|
28156
27953
|
try {
|
|
28157
27954
|
await rename2(temp, this.path);
|
|
28158
27955
|
await unlink2(this.metadataPath).catch((error) => {
|
|
@@ -28193,12 +27990,12 @@ var NativeRecordingPartialStore = class {
|
|
|
28193
27990
|
}
|
|
28194
27991
|
};
|
|
28195
27992
|
|
|
28196
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27993
|
+
// 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/persistence/native/recording-publication.js
|
|
28197
27994
|
import { createHash as createHash6 } from "node:crypto";
|
|
28198
27995
|
import { link as link2 } from "node:fs/promises";
|
|
28199
|
-
import { basename as
|
|
27996
|
+
import { basename as basename2, dirname as dirname2, join as join6, resolve } from "node:path";
|
|
28200
27997
|
|
|
28201
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27998
|
+
// 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/persistence/native/recording-publication-files.js
|
|
28202
27999
|
import { unlink as unlink3 } from "node:fs/promises";
|
|
28203
28000
|
var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected2, signal, writable = false) => {
|
|
28204
28001
|
signal?.throwIfAborted();
|
|
@@ -28233,9 +28030,9 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
|
|
|
28233
28030
|
signal?.throwIfAborted();
|
|
28234
28031
|
}, "commitPublication");
|
|
28235
28032
|
|
|
28236
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28033
|
+
// 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/persistence/native/recording-publication-journal.js
|
|
28237
28034
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
28238
|
-
import { open as
|
|
28035
|
+
import { open as open3, rename as rename3, unlink as unlink4 } from "node:fs/promises";
|
|
28239
28036
|
import { join as join5 } from "node:path";
|
|
28240
28037
|
var readPublicationJournal = /* @__PURE__ */ __name(async (path, codec, limit, signal) => {
|
|
28241
28038
|
signal?.throwIfAborted();
|
|
@@ -28281,7 +28078,7 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
|
|
|
28281
28078
|
throw new CliError("validation_error", "recording recovery record exceeds its metadata limit");
|
|
28282
28079
|
codec.decode(JSON.parse(content));
|
|
28283
28080
|
const temp = join5(root, `${prefix}${randomUUID3()}.tmp`);
|
|
28284
|
-
const handle = await
|
|
28081
|
+
const handle = await open3(temp, "wx", 384);
|
|
28285
28082
|
let identity;
|
|
28286
28083
|
try {
|
|
28287
28084
|
try {
|
|
@@ -28306,7 +28103,7 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
|
|
|
28306
28103
|
}
|
|
28307
28104
|
}, "writePublicationJournal");
|
|
28308
28105
|
|
|
28309
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28106
|
+
// 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/persistence/native/recording-publication.js
|
|
28310
28107
|
var NativeRecordingPublication = class {
|
|
28311
28108
|
static {
|
|
28312
28109
|
__name(this, "NativeRecordingPublication");
|
|
@@ -28318,7 +28115,7 @@ var NativeRecordingPublication = class {
|
|
|
28318
28115
|
options;
|
|
28319
28116
|
constructor(root, locator, options2) {
|
|
28320
28117
|
this.root = root;
|
|
28321
|
-
if (!root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options2.prefix) || !options2.filename ||
|
|
28118
|
+
if (!root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options2.prefix) || !options2.filename || basename2(options2.filename) !== options2.filename || /[\\/\0]/.test(options2.filename) || [".", ".."].includes(options2.filename) || !Number.isSafeInteger(options2.maxBytes) || options2.maxBytes <= 0 || !Number.isSafeInteger(options2.metadataLimit) || options2.metadataLimit <= 0 || options2.metadataLimit > 1048576 || [locator.provider, locator.account, locator.occurrenceId, locator.assetId].some((value) => typeof value !== "string" || !value.trim() || /[\0\r\n]/.test(value)))
|
|
28322
28119
|
throw new CliError("validation_error", "invalid native recording publication options");
|
|
28323
28120
|
this.scope = partialIdentity(locator);
|
|
28324
28121
|
this.options = Object.freeze({ ...options2, codec: Object.freeze({ ...options2.codec }) });
|
|
@@ -28334,7 +28131,7 @@ var NativeRecordingPublication = class {
|
|
|
28334
28131
|
return writePublicationJournal(this.root, this.journalPath, this.options.prefix, value, this.options.codec, this.options.metadataLimit, this.options.signal);
|
|
28335
28132
|
}
|
|
28336
28133
|
validate(partialPath, expected2) {
|
|
28337
|
-
if (
|
|
28134
|
+
if (resolve(dirname2(partialPath)) !== resolve(this.root) || resolve(partialPath) === resolve(this.finalPath) || resolve(partialPath) === resolve(this.journalPath) || !Number.isSafeInteger(expected2.size) || expected2.size < 0 || expected2.size > this.options.maxBytes || typeof expected2.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(expected2.sha256))
|
|
28338
28135
|
throw new CliError("validation_error", "invalid recording publication evidence");
|
|
28339
28136
|
this.options.signal?.throwIfAborted();
|
|
28340
28137
|
}
|
|
@@ -28379,10 +28176,10 @@ var NativeRecordingPublication = class {
|
|
|
28379
28176
|
}
|
|
28380
28177
|
};
|
|
28381
28178
|
|
|
28382
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28179
|
+
// 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/services/media-archive-manifest.js
|
|
28383
28180
|
import { createHash as createHash7 } from "node:crypto";
|
|
28384
28181
|
import { readdir } from "node:fs/promises";
|
|
28385
|
-
import { isAbsolute
|
|
28182
|
+
import { isAbsolute, join as join7, resolve as resolve2 } from "node:path";
|
|
28386
28183
|
var mediaKey = /* @__PURE__ */ __name((one) => createHash7("sha256").update(JSON.stringify([one.provider, one.account, one.chat, one.message, one.position])).digest("hex"), "mediaKey");
|
|
28387
28184
|
var mediaManifestName = /* @__PURE__ */ __name((one) => `.media-archive-${mediaKey(one)}.json`, "mediaManifestName");
|
|
28388
28185
|
var missingMediaFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingMediaFile");
|
|
@@ -28402,7 +28199,7 @@ var parseMediaEntry = /* @__PURE__ */ __name((value) => {
|
|
|
28402
28199
|
"messageTime",
|
|
28403
28200
|
"mime",
|
|
28404
28201
|
"relocatedTo"
|
|
28405
|
-
].includes(key)) || one.messageTime !== void 0 && (typeof one.messageTime !== "string" || !Number.isFinite(Date.parse(one.messageTime)) || new Date(one.messageTime).toISOString() !== one.messageTime) || one.mime !== void 0 && (typeof one.mime !== "string" || one.mime.length > 127 || !/^[a-z0-9.+-]+\/[a-z0-9.+-]+$/.test(one.mime)) || one.relocatedTo !== void 0 && (typeof one.relocatedTo !== "string" || !
|
|
28202
|
+
].includes(key)) || one.messageTime !== void 0 && (typeof one.messageTime !== "string" || !Number.isFinite(Date.parse(one.messageTime)) || new Date(one.messageTime).toISOString() !== one.messageTime) || one.mime !== void 0 && (typeof one.mime !== "string" || one.mime.length > 127 || !/^[a-z0-9.+-]+\/[a-z0-9.+-]+$/.test(one.mime)) || one.relocatedTo !== void 0 && (typeof one.relocatedTo !== "string" || !isAbsolute(one.relocatedTo) || /[\p{Cc}]/u.test(one.relocatedTo)) || [one.provider, one.account, one.chat, one.message, one.kind].some((text2) => typeof text2 !== "string" || !text2.trim() || text2.length > 512 || /[\0\r\n]/.test(text2)) || !Number.isSafeInteger(one.position) || one.position < 0 || !Number.isSafeInteger(one.size) || one.size < 0 || typeof one.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(one.sha256) || one.path !== `${mediaKey(one)}.bin`)
|
|
28406
28203
|
throw new CliError("validation_error", "invalid media archive manifest");
|
|
28407
28204
|
return { ...one };
|
|
28408
28205
|
}, "parseMediaEntry");
|
|
@@ -28441,7 +28238,7 @@ var readMediaManifests = /* @__PURE__ */ __name(async (root, signal) => {
|
|
|
28441
28238
|
return entries;
|
|
28442
28239
|
}, "readMediaManifests");
|
|
28443
28240
|
var verifyMediaEntry = /* @__PURE__ */ __name(async (root, one, signal) => {
|
|
28444
|
-
let location =
|
|
28241
|
+
let location = resolve2(root);
|
|
28445
28242
|
let entry = one;
|
|
28446
28243
|
const visited = /* @__PURE__ */ new Set();
|
|
28447
28244
|
while (entry.relocatedTo !== void 0) {
|
|
@@ -28449,7 +28246,7 @@ var verifyMediaEntry = /* @__PURE__ */ __name(async (root, one, signal) => {
|
|
|
28449
28246
|
if (visited.has(location) || visited.size >= 64)
|
|
28450
28247
|
throw new CliError("validation_error", "media archive relocation cycle or excessive depth");
|
|
28451
28248
|
visited.add(location);
|
|
28452
|
-
location =
|
|
28249
|
+
location = resolve2(entry.relocatedTo);
|
|
28453
28250
|
const target2 = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join7(location, mediaManifestName(one)), { maxBytes: 16384 })));
|
|
28454
28251
|
if (!sameMediaCopy(one, target2))
|
|
28455
28252
|
return false;
|
|
@@ -28466,7 +28263,7 @@ var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writ
|
|
|
28466
28263
|
beforePublish
|
|
28467
28264
|
}), "commitMediaEntry");
|
|
28468
28265
|
|
|
28469
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28266
|
+
// 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/services/media-archive-files.js
|
|
28470
28267
|
var validator = '"media-completed-v1"';
|
|
28471
28268
|
var maximumFileBytes = 64 * 1024 * 1024 * 1024;
|
|
28472
28269
|
var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file, beforeWrite, signal, metadata = {}) => {
|
|
@@ -28567,12 +28364,12 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file,
|
|
|
28567
28364
|
return entry;
|
|
28568
28365
|
}, "archiveMediaFile");
|
|
28569
28366
|
|
|
28570
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28367
|
+
// 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/services/media-archive-locks.js
|
|
28571
28368
|
import { mkdir, realpath } from "node:fs/promises";
|
|
28572
|
-
import { join as join8, resolve as
|
|
28369
|
+
import { join as join8, resolve as resolve3 } from "node:path";
|
|
28573
28370
|
var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
|
|
28574
28371
|
const roots = /* @__PURE__ */ new Set();
|
|
28575
|
-
const queued = new Set(initial.map((directory2) =>
|
|
28372
|
+
const queued = new Set(initial.map((directory2) => resolve3(directory2)));
|
|
28576
28373
|
const pending = [...queued];
|
|
28577
28374
|
for (let at = 0; at < pending.length; at++) {
|
|
28578
28375
|
signal?.throwIfAborted();
|
|
@@ -28591,7 +28388,7 @@ var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
|
|
|
28591
28388
|
roots.add(root);
|
|
28592
28389
|
for (const entry of await readMediaManifests(root, signal))
|
|
28593
28390
|
if (entry.relocatedTo) {
|
|
28594
|
-
const location =
|
|
28391
|
+
const location = resolve3(entry.relocatedTo);
|
|
28595
28392
|
if (!queued.has(location)) {
|
|
28596
28393
|
queued.add(location);
|
|
28597
28394
|
pending.push(location);
|
|
@@ -28634,7 +28431,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, ru
|
|
|
28634
28431
|
throw new CliError("validation_error", "archive locations changed during locking; run the command again");
|
|
28635
28432
|
}, "withMediaArchiveLocks");
|
|
28636
28433
|
|
|
28637
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28434
|
+
// 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/services/media-archive.js
|
|
28638
28435
|
var checkMediaArchive = /* @__PURE__ */ __name((directory2, signal) => withMediaArchiveLocks(directory2, signal, async (root) => {
|
|
28639
28436
|
const entries = await readMediaManifests(root, signal);
|
|
28640
28437
|
if (!entries.length)
|
|
@@ -28777,17 +28574,17 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options2) => {
|
|
|
28777
28574
|
}, { create: true });
|
|
28778
28575
|
}, "archiveMedia");
|
|
28779
28576
|
|
|
28780
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28577
|
+
// 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/services/media-archive-move.js
|
|
28781
28578
|
import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
|
|
28782
|
-
import { basename as
|
|
28579
|
+
import { basename as basename3, dirname as dirname3, join as join9, resolve as resolve4 } from "node:path";
|
|
28783
28580
|
var canonicalDestination = /* @__PURE__ */ __name(async (directory2) => {
|
|
28784
|
-
const path =
|
|
28581
|
+
const path = resolve4(directory2);
|
|
28785
28582
|
try {
|
|
28786
28583
|
return await realpath2(path);
|
|
28787
28584
|
} catch (error) {
|
|
28788
|
-
if (!missingMediaFile(error) ||
|
|
28585
|
+
if (!missingMediaFile(error) || dirname3(path) === path)
|
|
28789
28586
|
throw error;
|
|
28790
|
-
return join9(await canonicalDestination(
|
|
28587
|
+
return join9(await canonicalDestination(dirname3(path)), basename3(path));
|
|
28791
28588
|
}
|
|
28792
28589
|
}, "canonicalDestination");
|
|
28793
28590
|
var image2 = /* @__PURE__ */ __name((entry) => ["photo", "image"].includes(entry.kind) || entry.mime?.startsWith("image/"), "image");
|
|
@@ -28928,7 +28725,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options2) => {
|
|
|
28928
28725
|
}, { additional: [target2], createAdditional: !options2.dryRun });
|
|
28929
28726
|
}, "moveMediaArchive");
|
|
28930
28727
|
|
|
28931
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28728
|
+
// 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/domain/money-words.js
|
|
28932
28729
|
var MONEY_REQUEST = "money-request";
|
|
28933
28730
|
var MONEY_DONE = "money-done";
|
|
28934
28731
|
var PROMISE = "promise";
|
|
@@ -28962,10 +28759,10 @@ var MONEY_WORDS = [
|
|
|
28962
28759
|
}
|
|
28963
28760
|
];
|
|
28964
28761
|
|
|
28965
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28762
|
+
// 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/services/money-words.js
|
|
28966
28763
|
var moneyClassesOf = /* @__PURE__ */ __name((text2) => listsHit(text2, MONEY_WORDS), "moneyClassesOf");
|
|
28967
28764
|
|
|
28968
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28765
|
+
// 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/domain/status-words.js
|
|
28969
28766
|
var words2 = /* @__PURE__ */ __name((forms) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${forms.join("|")})(?![\\p{L}\\p{N}])`, "iu"), "words");
|
|
28970
28767
|
var MONEY_DONE_FORMS = words2([
|
|
28971
28768
|
"\u043E\u043F\u043B\u0430\u0442\u0438\u043B[\u0430\u0438]?",
|
|
@@ -29005,7 +28802,7 @@ var PROMISE_FORMS = words2([
|
|
|
29005
28802
|
"estar\xE1 listo"
|
|
29006
28803
|
]);
|
|
29007
28804
|
|
|
29008
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28805
|
+
// 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/services/project-status/items.js
|
|
29009
28806
|
var EXCERPT_CHARS = 80;
|
|
29010
28807
|
var excerpt2 = /* @__PURE__ */ __name((text2) => {
|
|
29011
28808
|
const flat = text2.replace(/\s+/g, " ").trim();
|
|
@@ -29027,7 +28824,7 @@ var whoOf = /* @__PURE__ */ __name((message) => ({
|
|
|
29027
28824
|
var fromOwner = /* @__PURE__ */ __name((message) => message.outgoing === true, "fromOwner");
|
|
29028
28825
|
var day = /* @__PURE__ */ __name((at) => new Date(at).toISOString().slice(0, 10), "day");
|
|
29029
28826
|
|
|
29030
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28827
|
+
// 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/services/project-status/signals/amounts.js
|
|
29031
28828
|
var MONEY = DEFAULT_TASK_CATEGORIES.filter((category) => category.name === "money");
|
|
29032
28829
|
var verbOf = /* @__PURE__ */ __name((text2) => {
|
|
29033
28830
|
if (MONEY_DONE_FORMS.test(text2))
|
|
@@ -29108,7 +28905,7 @@ var amounts = {
|
|
|
29108
28905
|
attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state === "asked" ? [{ chat: item2.chat, weight: 2, why: "money asked" }] : []), "attention")
|
|
29109
28906
|
};
|
|
29110
28907
|
|
|
29111
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28908
|
+
// 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/services/project-status/signals/children.js
|
|
29112
28909
|
var children = {
|
|
29113
28910
|
id: "children",
|
|
29114
28911
|
version: 1,
|
|
@@ -29137,7 +28934,7 @@ var children = {
|
|
|
29137
28934
|
}, "read")
|
|
29138
28935
|
};
|
|
29139
28936
|
|
|
29140
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28937
|
+
// 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/services/project-status/signals/coverage.js
|
|
29141
28938
|
var coverage = {
|
|
29142
28939
|
id: "coverage",
|
|
29143
28940
|
version: 1,
|
|
@@ -29166,7 +28963,7 @@ var coverage = {
|
|
|
29166
28963
|
attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state !== "complete" && item2.data.beforeHeld ? [{ chat: item2.chat, weight: 3, why: "held in part" }] : []), "attention")
|
|
29167
28964
|
};
|
|
29168
28965
|
|
|
29169
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28966
|
+
// 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/services/project-status/signals/payments.js
|
|
29170
28967
|
var holding = /* @__PURE__ */ __name((row) => row.review !== "rejected", "holding");
|
|
29171
28968
|
var item = /* @__PURE__ */ __name((row, at, data) => ({
|
|
29172
28969
|
signal: "payments",
|
|
@@ -29216,7 +29013,7 @@ var payments = {
|
|
|
29216
29013
|
}, "read")
|
|
29217
29014
|
};
|
|
29218
29015
|
|
|
29219
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29016
|
+
// 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/services/project-status/signals/promises.js
|
|
29220
29017
|
var PATTERNS_PER_CHAT = 3;
|
|
29221
29018
|
var DAY4 = 864e5;
|
|
29222
29019
|
var KINDS2 = /* @__PURE__ */ new Set(["promise", "request"]);
|
|
@@ -29305,7 +29102,7 @@ var promises = {
|
|
|
29305
29102
|
}, "read")
|
|
29306
29103
|
};
|
|
29307
29104
|
|
|
29308
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29105
|
+
// 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/services/project-status/signals/questions.js
|
|
29309
29106
|
var PER_SIDE = 5;
|
|
29310
29107
|
var WEEK = 7 * 864e5;
|
|
29311
29108
|
var NOBODY = /* @__PURE__ */ new Set();
|
|
@@ -29316,10 +29113,10 @@ var questions2 = {
|
|
|
29316
29113
|
read: /* @__PURE__ */ __name(async (_context, chat) => {
|
|
29317
29114
|
if (!chat)
|
|
29318
29115
|
return [];
|
|
29319
|
-
const
|
|
29116
|
+
const open6 = /* @__PURE__ */ __name((asker) => questions(chat.messages, { answerers: NOBODY, asker }).filter(({ answer }) => answer === void 0).map(({ question }) => question).reverse().slice(0, PER_SIDE), "open");
|
|
29320
29117
|
return [
|
|
29321
|
-
["theirs",
|
|
29322
|
-
["yours",
|
|
29118
|
+
["theirs", open6("others")],
|
|
29119
|
+
["yours", open6("owner")]
|
|
29323
29120
|
].flatMap(([side, asked]) => asked.map((question) => ({
|
|
29324
29121
|
signal: "questions",
|
|
29325
29122
|
chat: chat.ref,
|
|
@@ -29336,7 +29133,7 @@ var questions2 = {
|
|
|
29336
29133
|
}, "attention")
|
|
29337
29134
|
};
|
|
29338
29135
|
|
|
29339
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29136
|
+
// 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/services/project-status/signals/reply-next.js
|
|
29340
29137
|
var targetOf = /* @__PURE__ */ __name((message, chat, owners) => {
|
|
29341
29138
|
const byId2 = /* @__PURE__ */ __name((id2) => chat.messages.find((one) => one.id === id2), "byId");
|
|
29342
29139
|
const quoted = message.replyTo ?? (message.replyToId === void 0 ? void 0 : byId2(message.replyToId));
|
|
@@ -29404,7 +29201,7 @@ var replyNext = {
|
|
|
29404
29201
|
attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.next === "owner" ? [{ chat: item2.chat, weight: 2, why: "your move" }] : []), "attention")
|
|
29405
29202
|
};
|
|
29406
29203
|
|
|
29407
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29204
|
+
// 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/services/project-status/signals/topics.js
|
|
29408
29205
|
var escaped = /* @__PURE__ */ __name((text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
29409
29206
|
var wholeWord = /* @__PURE__ */ __name((word) => new RegExp(`(?<![\\p{L}\\p{N}])${escaped(word)}(?![\\p{L}\\p{N}])`, "u"), "wholeWord");
|
|
29410
29207
|
var matcherOf = /* @__PURE__ */ __name((query) => {
|
|
@@ -29429,14 +29226,14 @@ var topics = {
|
|
|
29429
29226
|
if (!yours && !theirs)
|
|
29430
29227
|
return [];
|
|
29431
29228
|
const silent = theirs && yours && Date.parse(yours.timestamp) > Date.parse(theirs.timestamp);
|
|
29432
|
-
const
|
|
29229
|
+
const newest2 = [yours, theirs].filter((one) => one !== void 0).sort((a, b) => Date.parse(b.timestamp) - Date.parse(a.timestamp));
|
|
29433
29230
|
return [
|
|
29434
29231
|
{
|
|
29435
29232
|
signal: "topics",
|
|
29436
29233
|
chat: chat.ref,
|
|
29437
|
-
at:
|
|
29234
|
+
at: newest2[0]?.timestamp ?? null,
|
|
29438
29235
|
who: null,
|
|
29439
|
-
evidence: evidenceOf(chat, ...
|
|
29236
|
+
evidence: evidenceOf(chat, ...newest2),
|
|
29440
29237
|
basis: "store",
|
|
29441
29238
|
data: {
|
|
29442
29239
|
query,
|
|
@@ -29450,7 +29247,7 @@ var topics = {
|
|
|
29450
29247
|
}, "read")
|
|
29451
29248
|
};
|
|
29452
29249
|
|
|
29453
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29250
|
+
// 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/services/project-status/signals/index.js
|
|
29454
29251
|
var STATUS_SIGNALS = [
|
|
29455
29252
|
replyNext,
|
|
29456
29253
|
questions2,
|
|
@@ -29462,7 +29259,7 @@ var STATUS_SIGNALS = [
|
|
|
29462
29259
|
children
|
|
29463
29260
|
];
|
|
29464
29261
|
|
|
29465
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29262
|
+
// 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/services/project-status/index.js
|
|
29466
29263
|
var DAY5 = 864e5;
|
|
29467
29264
|
var STATUS_WINDOW = 300;
|
|
29468
29265
|
var STATUS_CHATS = 16;
|
|
@@ -29651,7 +29448,7 @@ var projectStatus = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
29651
29448
|
};
|
|
29652
29449
|
}, "projectStatus");
|
|
29653
29450
|
|
|
29654
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29451
|
+
// 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/services/account.js
|
|
29655
29452
|
var accountService = /* @__PURE__ */ __name((deps) => {
|
|
29656
29453
|
const online = /* @__PURE__ */ __name(async (command) => {
|
|
29657
29454
|
if (deps.offline)
|
|
@@ -29723,7 +29520,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
|
|
|
29723
29520
|
};
|
|
29724
29521
|
}, "accountService");
|
|
29725
29522
|
|
|
29726
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29523
|
+
// 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/domain/send-time.js
|
|
29727
29524
|
var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-time", zone) => {
|
|
29728
29525
|
const at = aheadOf(value, flag, now, {
|
|
29729
29526
|
...zone === void 0 ? {} : { zone },
|
|
@@ -29734,7 +29531,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
|
|
|
29734
29531
|
return new Date(at - at % MINUTE).toISOString();
|
|
29735
29532
|
}, "sendTime");
|
|
29736
29533
|
|
|
29737
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29534
|
+
// 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/services/admin.js
|
|
29738
29535
|
var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
|
|
29739
29536
|
try {
|
|
29740
29537
|
const held = await accountStoreIfOpen(deps);
|
|
@@ -29981,7 +29778,7 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
|
|
|
29981
29778
|
return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
|
|
29982
29779
|
}, "linkLimits");
|
|
29983
29780
|
|
|
29984
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29781
|
+
// 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/services/archive-gaps.js
|
|
29985
29782
|
import { createHash as createHash8, randomUUID as randomUUID4 } from "node:crypto";
|
|
29986
29783
|
var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
|
|
29987
29784
|
var validateRepair = /* @__PURE__ */ __name((messenger, options2) => {
|
|
@@ -30118,14 +29915,14 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
|
|
|
30118
29915
|
return { plan, repair };
|
|
30119
29916
|
}, "gapsService");
|
|
30120
29917
|
|
|
30121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29918
|
+
// 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/services/attachments.js
|
|
30122
29919
|
import { createHash as createHash11 } from "node:crypto";
|
|
30123
29920
|
import { constants as constants2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
30124
|
-
import { lstat as lstat5, open as
|
|
29921
|
+
import { lstat as lstat5, open as open5, stat } from "node:fs/promises";
|
|
30125
29922
|
|
|
30126
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29923
|
+
// 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/attachments/directory.js
|
|
30127
29924
|
import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
|
|
30128
|
-
import { basename as
|
|
29925
|
+
import { basename as basename4, join as join10, relative, sep } from "node:path";
|
|
30129
29926
|
var MAX_FILES = 1e4;
|
|
30130
29927
|
var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app, env) => {
|
|
30131
29928
|
if (refusedPlace(directory2, app, env))
|
|
@@ -30149,8 +29946,8 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
|
|
|
30149
29946
|
const canonical2 = await realpath3(path);
|
|
30150
29947
|
if (refusedPlace(canonical2, app, env))
|
|
30151
29948
|
throw new CliError("validation_error", "--from-dir cannot read credential files, the CLI's own files or the message store");
|
|
30152
|
-
const
|
|
30153
|
-
if (
|
|
29949
|
+
const inside = relative(root, canonical2);
|
|
29950
|
+
if (inside === ".." || inside.startsWith(`..${sep}`))
|
|
30154
29951
|
throw new CliError("validation_error", "a file escapes --from-dir");
|
|
30155
29952
|
files.set(name, canonical2);
|
|
30156
29953
|
}
|
|
@@ -30164,20 +29961,20 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
|
|
|
30164
29961
|
group.push(file);
|
|
30165
29962
|
groups.set(file.messageId, group);
|
|
30166
29963
|
if (file.name)
|
|
30167
|
-
counts.set(
|
|
29964
|
+
counts.set(basename4(file.name), (counts.get(basename4(file.name)) ?? 0) + 1);
|
|
30168
29965
|
}
|
|
30169
29966
|
const choices = /* @__PURE__ */ new Map();
|
|
30170
29967
|
for (const group of groups.values()) {
|
|
30171
29968
|
group.sort((a, b) => a.position - b.position);
|
|
30172
29969
|
const candidates = group.map((file, index) => {
|
|
30173
29970
|
const prefix = `${file.messageId}-${index + 1}`;
|
|
30174
|
-
return [...files].filter(([name]) => name === prefix || name.startsWith(`${prefix}.`) || file.name !== null && name === `${prefix}-${
|
|
29971
|
+
return [...files].filter(([name]) => name === prefix || name.startsWith(`${prefix}.`) || file.name !== null && name === `${prefix}-${basename4(file.name)}`).map(([, path]) => path);
|
|
30175
29972
|
});
|
|
30176
29973
|
if (candidates.some((paths) => paths.length > 1))
|
|
30177
29974
|
throw new CliError("validation_error", "more than one directory file matches a download ordinal");
|
|
30178
29975
|
const complete = candidates.every((paths) => paths.length === 1);
|
|
30179
29976
|
group.forEach((file, index) => {
|
|
30180
|
-
const own = file.name === null ? void 0 :
|
|
29977
|
+
const own = file.name === null ? void 0 : basename4(file.name);
|
|
30181
29978
|
const named2 = own && counts.get(own) === 1 ? files.get(own) : void 0;
|
|
30182
29979
|
const canonical2 = complete ? candidates[index]?.[0] : void 0;
|
|
30183
29980
|
if (named2 && canonical2 && named2 !== canonical2 || !complete && own && files.has(own) && (counts.get(own) ?? 0) > 1)
|
|
@@ -31235,7 +31032,7 @@ function imageSize(input) {
|
|
|
31235
31032
|
}
|
|
31236
31033
|
__name(imageSize, "imageSize");
|
|
31237
31034
|
|
|
31238
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31035
|
+
// 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/attachments/ocr.js
|
|
31239
31036
|
var MAX_PAGES = 20;
|
|
31240
31037
|
var MAX_PIXELS = 2e7;
|
|
31241
31038
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
@@ -31395,7 +31192,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
|
|
|
31395
31192
|
}
|
|
31396
31193
|
}, "ocrPdf");
|
|
31397
31194
|
|
|
31398
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31195
|
+
// 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/attachments/pdf-preview.js
|
|
31399
31196
|
var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
|
|
31400
31197
|
const limits = pdfPreviewLimits(env);
|
|
31401
31198
|
const cancelled3 = /* @__PURE__ */ __name(() => {
|
|
@@ -31472,7 +31269,7 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
|
|
|
31472
31269
|
}
|
|
31473
31270
|
}, "pdfPreview");
|
|
31474
31271
|
|
|
31475
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31272
|
+
// 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/attachments/picture-reading.js
|
|
31476
31273
|
import { spawn } from "node:child_process";
|
|
31477
31274
|
import { mkdtempSync, readFileSync as readFileSync2, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
31478
31275
|
import { tmpdir } from "node:os";
|
|
@@ -31505,7 +31302,7 @@ var TIMEOUT_MS2 = 6e5;
|
|
|
31505
31302
|
var MAX_OUTPUT = 4 * 1024 * 1024;
|
|
31506
31303
|
var WITHHELD = /^(ANTHROPIC_API_KEY|OPENAI_API_KEY|CLAUDECODE|CLAUDE_CODE_SESSION_ID|CODEX_THREAD_ID|AI_AGENT|.*_MCP_CLIENT)$/;
|
|
31507
31304
|
var pictureAgentEnv = /* @__PURE__ */ __name((env) => Object.fromEntries(Object.entries(env).filter(([name]) => !WITHHELD.test(name))), "pictureAgentEnv");
|
|
31508
|
-
var run = /* @__PURE__ */ __name((program, args, { env, cwd, stdin, signal }) => new Promise((
|
|
31305
|
+
var run = /* @__PURE__ */ __name((program, args, { env, cwd, stdin, signal }) => new Promise((resolve6, reject) => {
|
|
31509
31306
|
const child = spawn(program, args, {
|
|
31510
31307
|
env: pictureAgentEnv(env),
|
|
31511
31308
|
cwd,
|
|
@@ -31528,7 +31325,7 @@ var run = /* @__PURE__ */ __name((program, args, { env, cwd, stdin, signal }) =>
|
|
|
31528
31325
|
child.on("error", (error) => {
|
|
31529
31326
|
clearTimeout(timer);
|
|
31530
31327
|
if (error.code === "ENOENT")
|
|
31531
|
-
|
|
31328
|
+
resolve6(void 0);
|
|
31532
31329
|
else if (error.name === "AbortError")
|
|
31533
31330
|
reject(new CliError("cancelled", `${program} was stopped`));
|
|
31534
31331
|
else
|
|
@@ -31540,7 +31337,7 @@ var run = /* @__PURE__ */ __name((program, args, { env, cwd, stdin, signal }) =>
|
|
|
31540
31337
|
return reject(new CliError("timeout", `${program} gave no answer in time, or too long an answer`, {
|
|
31541
31338
|
reason: "picture-reading.timeout"
|
|
31542
31339
|
}));
|
|
31543
|
-
|
|
31340
|
+
resolve6({ code, stdout: Buffer.concat(out).toString("utf8"), stderr: Buffer.concat(err).toString("utf8") });
|
|
31544
31341
|
});
|
|
31545
31342
|
child.stdin.on("error", () => {
|
|
31546
31343
|
});
|
|
@@ -31635,10 +31432,10 @@ Read the attached picture.`,
|
|
|
31635
31432
|
}
|
|
31636
31433
|
}, "readPictureWithAgent");
|
|
31637
31434
|
|
|
31638
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31435
|
+
// 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/attachments/transfer.js
|
|
31639
31436
|
import { createHash as createHash9 } from "node:crypto";
|
|
31640
31437
|
import { constants } from "node:fs";
|
|
31641
|
-
import { lstat as lstat3, open as
|
|
31438
|
+
import { lstat as lstat3, open as open4 } from "node:fs/promises";
|
|
31642
31439
|
var MAX_CHUNK_BYTES = 1024 * 1024;
|
|
31643
31440
|
var validateWindow = /* @__PURE__ */ __name(({ offsetBytes = 0, chunkBytes = 524288, ifSha256 }) => {
|
|
31644
31441
|
if (!Number.isSafeInteger(offsetBytes) || offsetBytes < 0 || !Number.isSafeInteger(chunkBytes) || chunkBytes < 1 || chunkBytes > MAX_CHUNK_BYTES || ifSha256 !== void 0 && !/^[a-f0-9]{64}$/i.test(ifSha256))
|
|
@@ -31658,10 +31455,10 @@ var retainedBytes = /* @__PURE__ */ __name(async (path, options2, captureFile =
|
|
|
31658
31455
|
if (!before.isFile() || before.isSymbolicLink())
|
|
31659
31456
|
throw new CliError("validation_error", "the retained attachment must be a regular file");
|
|
31660
31457
|
if (before.size > maxBytes)
|
|
31661
|
-
throw new CliError("validation_error", `the retained attachment exceeds ${maxBytes
|
|
31458
|
+
throw new CliError("validation_error", `the retained attachment exceeds ${sizeText(maxBytes)}; configure MESSAGING_ATTACHMENT_MAX_MIB`);
|
|
31662
31459
|
if (offsetBytes > before.size)
|
|
31663
31460
|
throw new CliError("validation_error", "the byte offset is past the end of this attachment");
|
|
31664
|
-
const handle = await
|
|
31461
|
+
const handle = await open4(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
31665
31462
|
try {
|
|
31666
31463
|
const opened = await handle.stat();
|
|
31667
31464
|
if (!opened.isFile() || opened.ino !== before.ino || opened.dev !== before.dev || opened.size !== before.size)
|
|
@@ -31743,10 +31540,10 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
|
|
|
31743
31540
|
return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
|
|
31744
31541
|
}, "transferMime");
|
|
31745
31542
|
|
|
31746
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31543
|
+
// 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/services/file-download.js
|
|
31747
31544
|
import { createWriteStream, mkdirSync } from "node:fs";
|
|
31748
31545
|
import { link as link3, rm } from "node:fs/promises";
|
|
31749
|
-
import { join as join12, resolve as
|
|
31546
|
+
import { join as join12, resolve as resolve5 } from "node:path";
|
|
31750
31547
|
import { Readable, Transform } from "node:stream";
|
|
31751
31548
|
import { pipeline } from "node:stream/promises";
|
|
31752
31549
|
var refreshedFiles = /* @__PURE__ */ __name((files) => files.flatMap(({ kind, name, position, providerRef }) => providerRef === void 0 || Object.keys(providerRef).length === 0 ? [] : [
|
|
@@ -31822,9 +31619,10 @@ var EXTENSIONS = {
|
|
|
31822
31619
|
var BY_KIND = { photo: "jpg" };
|
|
31823
31620
|
var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { unique = false } = {}) => {
|
|
31824
31621
|
const own = safeName(file.name);
|
|
31622
|
+
const fallback = safeName(fallbackName) ?? "file";
|
|
31825
31623
|
const fileName = /* @__PURE__ */ __name(() => {
|
|
31826
31624
|
const extension = EXTENSIONS[file.mime ?? ""] ?? BY_KIND[file.kind];
|
|
31827
|
-
return own ?? (extension ? `${
|
|
31625
|
+
return own ?? (extension ? `${fallback}.${extension}` : fallback);
|
|
31828
31626
|
}, "fileName");
|
|
31829
31627
|
const partial = join12(directory2, `.${fileName()}.${process.pid}.part`);
|
|
31830
31628
|
let bytes2 = 0;
|
|
@@ -31837,9 +31635,9 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
|
|
|
31837
31635
|
try {
|
|
31838
31636
|
await pipeline(Readable.from(file.bytes()), counting, createWriteStream(partial, { flags: "wx", mode: 384 }));
|
|
31839
31637
|
const name = fileName();
|
|
31840
|
-
const names2 = unique && own ? [name, `${
|
|
31638
|
+
const names2 = unique && own ? [name, `${fallback}-${own}`] : [name];
|
|
31841
31639
|
for (const candidate of names2) {
|
|
31842
|
-
const path2 =
|
|
31640
|
+
const path2 = resolve5(join12(directory2, candidate));
|
|
31843
31641
|
const taken = await link3(partial, path2).then(() => false, (error) => {
|
|
31844
31642
|
if (error.code === "EEXIST")
|
|
31845
31643
|
return true;
|
|
@@ -31848,7 +31646,7 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
|
|
|
31848
31646
|
if (!taken)
|
|
31849
31647
|
return { kind: file.kind, path: path2, bytes: bytes2 };
|
|
31850
31648
|
}
|
|
31851
|
-
const path =
|
|
31649
|
+
const path = resolve5(join12(directory2, names2.at(-1) ?? name));
|
|
31852
31650
|
if (unique)
|
|
31853
31651
|
return { kind: file.kind, path, bytes: bytes2, existing: true };
|
|
31854
31652
|
throw new CliError("validation_error", `${path} already exists \u2014 nothing was overwritten; choose --output-dir`);
|
|
@@ -31857,7 +31655,7 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
|
|
|
31857
31655
|
}
|
|
31858
31656
|
}, "save");
|
|
31859
31657
|
|
|
31860
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31658
|
+
// 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/services/pictures.js
|
|
31861
31659
|
import { createHash as createHash10 } from "node:crypto";
|
|
31862
31660
|
import { lstat as lstat4, readFile } from "node:fs/promises";
|
|
31863
31661
|
import { setTimeout as sleep4 } from "node:timers/promises";
|
|
@@ -31894,18 +31692,18 @@ var pictureBytes = /* @__PURE__ */ __name(async (picture, files, read) => {
|
|
|
31894
31692
|
}, "pictureBytes");
|
|
31895
31693
|
var picturesService = /* @__PURE__ */ __name((deps) => {
|
|
31896
31694
|
let opened;
|
|
31897
|
-
const
|
|
31695
|
+
const open6 = /* @__PURE__ */ __name(async () => {
|
|
31898
31696
|
if (deps.pictureEmbedder)
|
|
31899
31697
|
return deps.pictureEmbedder();
|
|
31900
31698
|
const model2 = imageModel(DEFAULT_IMAGE_MODEL);
|
|
31901
31699
|
const directory2 = imageModelsDirectory(deps.env);
|
|
31902
31700
|
if (!isImageModelInstalled(model2, directory2))
|
|
31903
31701
|
throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
|
|
31904
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
31702
|
+
const { openPictureEmbedder } = await import("./embedder-SRBOJMXX.js");
|
|
31905
31703
|
return openPictureEmbedder(model2, directory2);
|
|
31906
31704
|
}, "open");
|
|
31907
31705
|
const embedder = /* @__PURE__ */ __name(() => {
|
|
31908
|
-
opened ??=
|
|
31706
|
+
opened ??= open6().catch((error) => {
|
|
31909
31707
|
opened = void 0;
|
|
31910
31708
|
throw error;
|
|
31911
31709
|
});
|
|
@@ -32075,7 +31873,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
|
|
|
32075
31873
|
}, "search")
|
|
32076
31874
|
}), "withPictures");
|
|
32077
31875
|
|
|
32078
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31876
|
+
// 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/services/attachments.js
|
|
32079
31877
|
var ATTACHMENT_QUERY = {
|
|
32080
31878
|
entity: "attachment",
|
|
32081
31879
|
backend: "sql",
|
|
@@ -32100,11 +31898,11 @@ var outcome = /* @__PURE__ */ __name(async (file, path, load, signal, noFollow =
|
|
|
32100
31898
|
status: "too-large",
|
|
32101
31899
|
issue: withRecovery({
|
|
32102
31900
|
code: "validation_error",
|
|
32103
|
-
message: `attachment exceeds ${maxBytes
|
|
31901
|
+
message: `attachment exceeds ${sizeText(maxBytes)}; configure MESSAGING_ATTACHMENT_MAX_MIB`,
|
|
32104
31902
|
setting: "MESSAGING_ATTACHMENT_MAX_MIB"
|
|
32105
31903
|
})
|
|
32106
31904
|
}), "tooLarge");
|
|
32107
|
-
const size2 = await
|
|
31905
|
+
const size2 = await stat(path).then((found) => found.isFile() ? found.size : void 0, () => void 0);
|
|
32108
31906
|
if (size2 === void 0)
|
|
32109
31907
|
return { status: "missing" };
|
|
32110
31908
|
const hint = { kind: file.kind, name: file.name, mime: file.mime, path };
|
|
@@ -32113,7 +31911,7 @@ var outcome = /* @__PURE__ */ __name(async (file, path, load, signal, noFollow =
|
|
|
32113
31911
|
return { status: "unsupported" };
|
|
32114
31912
|
if (size2 > maxBytes)
|
|
32115
31913
|
return tooLarge();
|
|
32116
|
-
const handle = await
|
|
31914
|
+
const handle = await open5(path, constants2.O_RDONLY | (noFollow ? constants2.O_NOFOLLOW : 0));
|
|
32117
31915
|
let bytes2;
|
|
32118
31916
|
try {
|
|
32119
31917
|
const opened = await handle.stat();
|
|
@@ -32121,7 +31919,7 @@ var outcome = /* @__PURE__ */ __name(async (file, path, load, signal, noFollow =
|
|
|
32121
31919
|
return { status: "missing" };
|
|
32122
31920
|
if (opened.size > maxBytes)
|
|
32123
31921
|
return tooLarge();
|
|
32124
|
-
bytes2 =
|
|
31922
|
+
bytes2 = asBytes(await readWhole(handle, signal));
|
|
32125
31923
|
} finally {
|
|
32126
31924
|
await handle.close();
|
|
32127
31925
|
}
|
|
@@ -32476,7 +32274,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
32476
32274
|
...file.mime === null ? {} : { mime: file.mime },
|
|
32477
32275
|
position: file.position,
|
|
32478
32276
|
bytes: /* @__PURE__ */ __name(async function* () {
|
|
32479
|
-
const handle = await
|
|
32277
|
+
const handle = await open5(path, constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0));
|
|
32480
32278
|
yield* handle.createReadStream();
|
|
32481
32279
|
}, "bytes")
|
|
32482
32280
|
}, output, `${messageId}-${file.position + 1}`));
|
|
@@ -32546,7 +32344,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
32546
32344
|
}, "readPicture")
|
|
32547
32345
|
}), "attachmentsService");
|
|
32548
32346
|
|
|
32549
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32347
|
+
// 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/services/chat-documents.js
|
|
32550
32348
|
var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
|
|
32551
32349
|
list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
|
|
32552
32350
|
const store = await accountStore(deps);
|
|
@@ -32576,7 +32374,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
32576
32374
|
}, "list")
|
|
32577
32375
|
}), "chatDocumentsService");
|
|
32578
32376
|
|
|
32579
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32377
|
+
// 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/services/retention.js
|
|
32580
32378
|
var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
|
|
32581
32379
|
const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
|
|
32582
32380
|
const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
|
|
@@ -32663,7 +32461,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
|
|
|
32663
32461
|
}
|
|
32664
32462
|
}, "isRetentionSelection");
|
|
32665
32463
|
|
|
32666
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32464
|
+
// 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/services/counters.js
|
|
32667
32465
|
var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
|
|
32668
32466
|
const fields = text2.split(",").map((one) => one.trim());
|
|
32669
32467
|
if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
|
|
@@ -32870,7 +32668,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
|
|
|
32870
32668
|
};
|
|
32871
32669
|
}, "countersService");
|
|
32872
32670
|
|
|
32873
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32671
|
+
// 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/services/search-refresh.js
|
|
32874
32672
|
var SYNC_KEY = "messages.sync-first";
|
|
32875
32673
|
var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
|
|
32876
32674
|
var keyOf3 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
|
|
@@ -32961,13 +32759,13 @@ var refreshSearch = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
32961
32759
|
continue;
|
|
32962
32760
|
}
|
|
32963
32761
|
try {
|
|
32964
|
-
const
|
|
32762
|
+
const newest2 = (await store.messages.messages(account, chatId, { limit: 1 })).items[0];
|
|
32965
32763
|
let counted2 = 0;
|
|
32966
32764
|
const fetched = await archiveService(deps).fetch(chatId, {
|
|
32967
32765
|
limit: options2.maxMessages - result.messages,
|
|
32968
32766
|
pageSize: Math.min(100, deps.messenger.fetching?.maxPageSize ?? 100),
|
|
32969
32767
|
pauseMs: parseDuration(deps.messenger.fetching?.pause ?? "1s", "fetch pause"),
|
|
32970
|
-
...
|
|
32768
|
+
...newest2 ? { sinceMs: Date.parse(newest2.timestamp) + 1 } : {},
|
|
32971
32769
|
stop,
|
|
32972
32770
|
note,
|
|
32973
32771
|
onPage: /* @__PURE__ */ __name(({ fetched: fetched2 }) => {
|
|
@@ -33002,7 +32800,7 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
|
|
|
33002
32800
|
...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
|
|
33003
32801
|
}), "withRefresh");
|
|
33004
32802
|
|
|
33005
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32803
|
+
// 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/services/embeddings-search.js
|
|
33006
32804
|
var CANDIDATES = 50;
|
|
33007
32805
|
var ACROSS_CHATS = 500;
|
|
33008
32806
|
var OWN_BLOCK = 5;
|
|
@@ -33014,6 +32812,7 @@ var SHOWN_CHARS = 200;
|
|
|
33014
32812
|
var SHOWN_HEAD = 80;
|
|
33015
32813
|
var CHUNK_READ = 60;
|
|
33016
32814
|
var REPLIES_READ = 60;
|
|
32815
|
+
var BIG_CONVERSATION = 50;
|
|
33017
32816
|
var RRF_K3 = 60;
|
|
33018
32817
|
var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
33019
32818
|
const command = deps.messenger.app.command;
|
|
@@ -33164,9 +32963,10 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
33164
32963
|
const meaning = texts.map(() => []);
|
|
33165
32964
|
const own = [];
|
|
33166
32965
|
const sources = words3.sources;
|
|
32966
|
+
let vectors = [];
|
|
33167
32967
|
if (target2.installed && prepared.scopeAccounts.length && eligibility?.conversations.length !== 0) {
|
|
33168
32968
|
await withEmbedder(deps, target2, choice, {}, async (embedder) => {
|
|
33169
|
-
|
|
32969
|
+
vectors = await embedder.embed(texts, "query");
|
|
33170
32970
|
for (const [at, vector] of vectors.entries())
|
|
33171
32971
|
for (const one of prepared.scopeAccounts) {
|
|
33172
32972
|
const scope = scopeOf5(one);
|
|
@@ -33241,7 +33041,23 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
33241
33041
|
locator: formatLocator({ ...source2, chat: hit.summary.chatId, message: hit.chunk.firstMessageId })
|
|
33242
33042
|
};
|
|
33243
33043
|
}, "located");
|
|
33244
|
-
const
|
|
33044
|
+
const stemmed = [
|
|
33045
|
+
...chunkStems(query).map((stem) => ({ stem, weight: 2 })),
|
|
33046
|
+
...texts.slice(1).flatMap((text2) => chunkStems(text2).map((stem) => ({ stem, weight: 1 })))
|
|
33047
|
+
];
|
|
33048
|
+
const rechunked = /* @__PURE__ */ __name(async (hit) => {
|
|
33049
|
+
const source2 = sources.get(hit.summary.id);
|
|
33050
|
+
if (texts.length < 2 || hit.matchedIn || !vectors.length || !source2)
|
|
33051
|
+
return hit;
|
|
33052
|
+
const chunk = await store.conversations.bestChunk(source2, hit.summary.id, {
|
|
33053
|
+
model: target2.key,
|
|
33054
|
+
vectors,
|
|
33055
|
+
stems: stemmed,
|
|
33056
|
+
over: BIG_CONVERSATION
|
|
33057
|
+
});
|
|
33058
|
+
return chunk ? { ...hit, chunk } : hit;
|
|
33059
|
+
}, "rechunked");
|
|
33060
|
+
const hits = (await Promise.all(fused(meaning.map((list2) => list2.map(({ hit }) => hit)), words3.hits, meaningFloor(target2.key)).slice(0, limit).map(rechunked))).map(located);
|
|
33245
33061
|
const shown = new Set(hits.map((hit) => hit.summary.id));
|
|
33246
33062
|
const ownOf = /* @__PURE__ */ __name((keep2) => own.filter(keep2).sort((a, b) => b.score - a.score).slice(0, OWN_BLOCK).map((hit) => located({ ...hit, by: ["meaning"] })), "ownOf");
|
|
33247
33063
|
const ownHits = ownOf((hit) => !shown.has(hit.summary.id));
|
|
@@ -33302,9 +33118,9 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
33302
33118
|
return found;
|
|
33303
33119
|
const rest = without(query, named2.word);
|
|
33304
33120
|
const { syncFirst: _, refresh: __, ...plain2 } = options2;
|
|
33305
|
-
const
|
|
33306
|
-
const shown = new Set(
|
|
33307
|
-
const hits = [...
|
|
33121
|
+
const inside = await search(rest || query, { ...plain2, chat: named2.chatId });
|
|
33122
|
+
const shown = new Set(inside.hits.map(({ summary }) => summary.id));
|
|
33123
|
+
const hits = [...inside.hits, ...found.hits.filter(({ summary }) => !shown.has(summary.id))].slice(0, options2.limit);
|
|
33308
33124
|
const kept2 = new Set(hits.map(({ summary }) => summary.id));
|
|
33309
33125
|
const own = [...found.own ?? [], ...(ownSpare ?? []).filter(({ summary }) => !kept2.has(summary.id))].sort((a, b) => (b.score ?? 0) - (a.score ?? 0)).slice(0, OWN_BLOCK);
|
|
33310
33126
|
const { own: _shown, ...plainFound } = found;
|
|
@@ -33389,6 +33205,9 @@ var fused = /* @__PURE__ */ __name((meaning, words3, minimumCosine) => {
|
|
|
33389
33205
|
});
|
|
33390
33206
|
return [...merged2.values()].sort((a, b) => b.fused - a.fused || (b.score ?? -2) - (a.score ?? -2)).map(({ fused: _, ...hit }) => hit);
|
|
33391
33207
|
}, "fused");
|
|
33208
|
+
var chunkStems = /* @__PURE__ */ __name((text2) => [
|
|
33209
|
+
...new Set((text2.toLowerCase().match(/[\p{L}\p{N}_]+/gu) ?? []).filter((word) => word.length >= 3).map((word) => word.slice(0, 5)))
|
|
33210
|
+
], "chunkStems");
|
|
33392
33211
|
var wordStems = /* @__PURE__ */ __name((text2) => [...new Set(queryWords2(text2).map((word) => word.slice(0, 5)))], "wordStems");
|
|
33393
33212
|
var shownLines = /* @__PURE__ */ __name((read, stems, ownFirst, asked, count3 = SHOWN_LINES) => {
|
|
33394
33213
|
const scored = read.map(({ text: text2, ...line3 }, at) => {
|
|
@@ -33442,13 +33261,13 @@ var meanOf = /* @__PURE__ */ __name((vectors) => {
|
|
|
33442
33261
|
return mean2.map((value) => value / length);
|
|
33443
33262
|
}, "meanOf");
|
|
33444
33263
|
|
|
33445
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33264
|
+
// 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/services/embeddings.js
|
|
33446
33265
|
var embeddingsService = /* @__PURE__ */ __name((deps) => ({
|
|
33447
33266
|
...embeddingsMaintenance(deps),
|
|
33448
33267
|
...embeddingsSearch(deps)
|
|
33449
33268
|
}), "embeddingsService");
|
|
33450
33269
|
|
|
33451
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33270
|
+
// 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/services/folders.js
|
|
33452
33271
|
var foldersService = /* @__PURE__ */ __name((deps) => {
|
|
33453
33272
|
const online = /* @__PURE__ */ __name(async (command) => {
|
|
33454
33273
|
if (deps.offline)
|
|
@@ -33589,7 +33408,7 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
|
|
|
33589
33408
|
};
|
|
33590
33409
|
}, "foldersService");
|
|
33591
33410
|
|
|
33592
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33411
|
+
// 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/services/mentions.js
|
|
33593
33412
|
var REVIEW_COUNT = 500;
|
|
33594
33413
|
var mentionsService = /* @__PURE__ */ __name((deps) => {
|
|
33595
33414
|
const located = /* @__PURE__ */ __name(async () => {
|
|
@@ -33668,7 +33487,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
|
|
|
33668
33487
|
};
|
|
33669
33488
|
}, "mentionsService");
|
|
33670
33489
|
|
|
33671
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33490
|
+
// 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/domain/message-link.js
|
|
33672
33491
|
var fileLinks = /* @__PURE__ */ __name((attachments) => hitFiles(attachments).map(({ position, kind, name }) => ({
|
|
33673
33492
|
position,
|
|
33674
33493
|
kind,
|
|
@@ -33717,7 +33536,7 @@ var validatePermalink = /* @__PURE__ */ __name((link4) => {
|
|
|
33717
33536
|
return { url: link4.url, access: link4.access, reason: link4.reason };
|
|
33718
33537
|
}, "validatePermalink");
|
|
33719
33538
|
|
|
33720
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33539
|
+
// 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/domain/pin-duration.js
|
|
33721
33540
|
var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
|
|
33722
33541
|
if (seconds % 86400 === 0 && seconds > 86400)
|
|
33723
33542
|
return `${seconds / 86400}d`;
|
|
@@ -33749,7 +33568,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
|
|
|
33749
33568
|
return seconds;
|
|
33750
33569
|
}, "pinDurationOf");
|
|
33751
33570
|
|
|
33752
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33571
|
+
// 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/services/meaning-model.js
|
|
33753
33572
|
var meaningModel = /* @__PURE__ */ __name(async (store, env = process.env) => {
|
|
33754
33573
|
const chosen = chosenTextModel(env);
|
|
33755
33574
|
if (chosen.from === "chosen" || chosen.id !== DEFAULT_TEXT_MODEL)
|
|
@@ -33764,7 +33583,7 @@ var meaningModel = /* @__PURE__ */ __name(async (store, env = process.env) => {
|
|
|
33764
33583
|
return (counts.get(before) ?? 0) > (counts.get(now) ?? 0) ? previous.id : current.id;
|
|
33765
33584
|
}, "meaningModel");
|
|
33766
33585
|
|
|
33767
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33586
|
+
// 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/services/messages-meaning.js
|
|
33768
33587
|
var meaningText = /* @__PURE__ */ __name((question) => {
|
|
33769
33588
|
try {
|
|
33770
33589
|
const text2 = questionLookup(question) === void 0 ? question : questionText(question);
|
|
@@ -33843,7 +33662,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
33843
33662
|
}
|
|
33844
33663
|
}, "meaningLane");
|
|
33845
33664
|
|
|
33846
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33665
|
+
// 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/services/messages-rerank.js
|
|
33847
33666
|
var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
33848
33667
|
const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
|
|
33849
33668
|
if (choice === "off")
|
|
@@ -33855,9 +33674,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
|
33855
33674
|
return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
|
|
33856
33675
|
try {
|
|
33857
33676
|
const warm = deps.embedders;
|
|
33858
|
-
const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-
|
|
33677
|
+
const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-AFIXYXWL.js")).openRerankerProcess(model, directory2, {
|
|
33859
33678
|
threads: defaultThreads()
|
|
33860
|
-
})) : await (await import("./rerank-
|
|
33679
|
+
})) : await (await import("./rerank-3F2E6NNN.js")).openReranker(model, directory2);
|
|
33861
33680
|
return {
|
|
33862
33681
|
model: model.id,
|
|
33863
33682
|
score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
|
|
@@ -33877,7 +33696,7 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
|
33877
33696
|
};
|
|
33878
33697
|
}, "rerankLane");
|
|
33879
33698
|
|
|
33880
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33699
|
+
// 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/search/question-period.js
|
|
33881
33700
|
var DAY6 = 864e5;
|
|
33882
33701
|
var SPAN = { start: 0, end: 0 };
|
|
33883
33702
|
var phrase = /* @__PURE__ */ __name((source) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${source})(?![\\p{L}\\p{N}])`, "giu"), "phrase");
|
|
@@ -34002,17 +33821,17 @@ var questionPeriod = /* @__PURE__ */ __name((text2, now, zone) => {
|
|
|
34002
33821
|
};
|
|
34003
33822
|
}, "questionPeriod");
|
|
34004
33823
|
|
|
34005
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33824
|
+
// 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/services/document-pictures.js
|
|
34006
33825
|
var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
|
|
34007
33826
|
const model = imageModel(DEFAULT_IMAGE_MODEL);
|
|
34008
33827
|
const directory2 = imageModelsDirectory(env);
|
|
34009
33828
|
if (!isImageModelInstalled(model, directory2))
|
|
34010
33829
|
throw new CliError("not_found", `the picture model is not downloaded \u2014 ${command === void 0 ? "install it with a WireCat CLI that has `images models download` (tg, max or wa); they share the model folder" : `\`${command} images models download ${model.id}\` fetches it`}`, { reason: "model.not-downloaded", model: model.id });
|
|
34011
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
33830
|
+
const { openPictureEmbedder } = await import("./embedder-SRBOJMXX.js");
|
|
34012
33831
|
return openPictureEmbedder(model, directory2);
|
|
34013
33832
|
}, "openPictureEmbedderFor");
|
|
34014
33833
|
|
|
34015
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33834
|
+
// 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/services/document-source.js
|
|
34016
33835
|
var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file) => {
|
|
34017
33836
|
const metadata = note.frontMatter;
|
|
34018
33837
|
const account = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
|
|
@@ -34034,7 +33853,7 @@ var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file) =>
|
|
|
34034
33853
|
};
|
|
34035
33854
|
}, "documentSource");
|
|
34036
33855
|
|
|
34037
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33856
|
+
// 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/services/enrichment-setting.js
|
|
34038
33857
|
var SECTION2 = "enrichment";
|
|
34039
33858
|
var ENRICHMENT_PROVIDERS = ["openai", "anthropic"];
|
|
34040
33859
|
var DEFAULT_BASE_URLS = {
|
|
@@ -34109,7 +33928,7 @@ var costOf = /* @__PURE__ */ __name((usage, setting) => {
|
|
|
34109
33928
|
return price ? Math.round((usage.input * price.input + usage.output * price.output) * 1e6) / 1e6 : null;
|
|
34110
33929
|
}, "costOf");
|
|
34111
33930
|
|
|
34112
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33931
|
+
// 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/services/enrichment.js
|
|
34113
33932
|
var ENRICH_PER_RUN = 600;
|
|
34114
33933
|
var MAX_LINE = 400;
|
|
34115
33934
|
var line2 = pipe(unknown(), transform((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, MAX_LINE) : ""));
|
|
@@ -34185,7 +34004,7 @@ var enrichmentState = /* @__PURE__ */ __name(async (store, env, estimateFor, key
|
|
|
34185
34004
|
};
|
|
34186
34005
|
}, "enrichmentState");
|
|
34187
34006
|
|
|
34188
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34007
|
+
// 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/services/notes-title-tier.js
|
|
34189
34008
|
var plainQueryWords = /* @__PURE__ */ __name((query) => {
|
|
34190
34009
|
let root;
|
|
34191
34010
|
try {
|
|
@@ -34212,15 +34031,15 @@ var titleTiers = /* @__PURE__ */ __name((hits, words3) => {
|
|
|
34212
34031
|
return [...hits].sort((a, b) => rank(a) - rank(b));
|
|
34213
34032
|
}, "titleTiers");
|
|
34214
34033
|
|
|
34215
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34034
|
+
// 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/services/notes-search.js
|
|
34216
34035
|
var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
|
|
34217
34036
|
var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
|
|
34218
34037
|
var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
|
|
34219
34038
|
const ast = { root };
|
|
34220
34039
|
const zone = timezoneOf(timezone);
|
|
34221
|
-
const
|
|
34040
|
+
const resolve6 = /* @__PURE__ */ __name((node) => {
|
|
34222
34041
|
if (node.kind === "boolean")
|
|
34223
|
-
return { ...node, clauses: node.clauses.map(({ occur, node: node2 }) => ({ occur, node:
|
|
34042
|
+
return { ...node, clauses: node.clauses.map(({ occur, node: node2 }) => ({ occur, node: resolve6(node2) })) };
|
|
34224
34043
|
if (node.field !== "date")
|
|
34225
34044
|
return node;
|
|
34226
34045
|
return {
|
|
@@ -34234,7 +34053,7 @@ var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
|
|
|
34234
34053
|
if (stemmers2 === null)
|
|
34235
34054
|
throw new CliError("validation_error", "the store asks for stemmers this tool does not know \u2014 upgrade this tool, or search exact forms with --exact", { reason: "stemmer.unknown" });
|
|
34236
34055
|
return {
|
|
34237
|
-
root:
|
|
34056
|
+
root: resolve6(ast.root),
|
|
34238
34057
|
...hasStems(ast.root) ? { stemmer: createStemmer(stemmers2 ?? DEFAULT_STEMMERS) } : {}
|
|
34239
34058
|
};
|
|
34240
34059
|
}, "resolvedQuery");
|
|
@@ -34254,6 +34073,7 @@ var searchNotesQuery = /* @__PURE__ */ __name(async (store, request) => {
|
|
|
34254
34073
|
...stemmer ? { stemmer } : {}
|
|
34255
34074
|
});
|
|
34256
34075
|
}, "searchNotesQuery");
|
|
34076
|
+
var NOTE_BATCH = 8;
|
|
34257
34077
|
var downloadHint = /* @__PURE__ */ __name((model, command) => command === void 0 ? `install it with a WireCat CLI that has \`models download\` (tg, max or wa); they share the model folder` : `\`${command} models download ${model}\``, "downloadHint");
|
|
34258
34078
|
var localModel = /* @__PURE__ */ __name((choice, env, command) => {
|
|
34259
34079
|
const model = textModel(choice ?? chosenTextModel(env).id, env);
|
|
@@ -34275,6 +34095,45 @@ var withLocal = /* @__PURE__ */ __name(async (model, directory2, threads, work,
|
|
|
34275
34095
|
await embedder.close();
|
|
34276
34096
|
}
|
|
34277
34097
|
}, "withLocal");
|
|
34098
|
+
var stopsAt = /* @__PURE__ */ __name((deadline) => deadline ? deadline.endsAt - deadlineMargin(deadline) : Number.POSITIVE_INFINITY, "stopsAt");
|
|
34099
|
+
var embedChunks = /* @__PURE__ */ __name(async (store, source, { model: choice, maxChunks = Number.POSITIVE_INFINITY, env, threads, command, deadline, signal } = {}) => {
|
|
34100
|
+
const { model, directory: directory2, key } = localModel(choice, env, command);
|
|
34101
|
+
if ((await source.chunksToEmbed(key, { limit: 1 })).length === 0)
|
|
34102
|
+
return { model: model.id, embedded: 0, left: false };
|
|
34103
|
+
const until = stopsAt(deadline);
|
|
34104
|
+
const stopped = /* @__PURE__ */ __name((slowest) => signal?.aborted ? "cancelled" : Date.now() + slowest >= until ? "deadline" : void 0, "stopped");
|
|
34105
|
+
const stop = /* @__PURE__ */ __name(async (embedded, why) => {
|
|
34106
|
+
const remaining = await source.chunksLeft?.(key);
|
|
34107
|
+
return { model: model.id, embedded, left: true, stopped: why, ...remaining === void 0 ? {} : { remaining } };
|
|
34108
|
+
}, "stop");
|
|
34109
|
+
const early = stopped(0);
|
|
34110
|
+
if (early)
|
|
34111
|
+
return stop(0, early);
|
|
34112
|
+
return withLocal(model, directory2, threads, async (embedder) => {
|
|
34113
|
+
let embedded = 0;
|
|
34114
|
+
let after;
|
|
34115
|
+
let slowest = 0;
|
|
34116
|
+
while (embedded < maxChunks) {
|
|
34117
|
+
const started = Date.now();
|
|
34118
|
+
const batch = await source.chunksToEmbed(key, {
|
|
34119
|
+
limit: Math.min(NOTE_BATCH, maxChunks - embedded),
|
|
34120
|
+
...after === void 0 ? {} : { after }
|
|
34121
|
+
});
|
|
34122
|
+
if (batch.length === 0)
|
|
34123
|
+
break;
|
|
34124
|
+
const why = stopped(slowest);
|
|
34125
|
+
if (why)
|
|
34126
|
+
return stop(embedded, why);
|
|
34127
|
+
after = batch.at(-1)?.hash;
|
|
34128
|
+
const vectors = await embedder.embed(batch.map(({ text: text2 }) => text2), "passage");
|
|
34129
|
+
await store.vectors.saveVectors(key, model.dims, batch.map(({ hash: hash3 }, index) => ({ hash: hash3, vector: vectors[index] })));
|
|
34130
|
+
embedded += batch.length;
|
|
34131
|
+
slowest = Math.max(slowest, Date.now() - started);
|
|
34132
|
+
}
|
|
34133
|
+
const left = (await source.chunksToEmbed(key, { limit: 1, ...after === void 0 ? {} : { after } })).length > 0;
|
|
34134
|
+
return { model: model.id, embedded, left };
|
|
34135
|
+
});
|
|
34136
|
+
}, "embedChunks");
|
|
34278
34137
|
var nearestNotes = /* @__PURE__ */ __name(async (store, query, options2) => {
|
|
34279
34138
|
const { key, vector, floor } = await queryVector(store, query, options2);
|
|
34280
34139
|
const nearest2 = await store.notes.nearest(key, vector, {
|
|
@@ -34640,7 +34499,31 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text2, { accou
|
|
|
34640
34499
|
};
|
|
34641
34500
|
}, "searchNotesOf");
|
|
34642
34501
|
|
|
34643
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34502
|
+
// 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/services/crm-meaning.js
|
|
34503
|
+
var embedCrmActivities = /* @__PURE__ */ __name(async (store, options2 = {}) => {
|
|
34504
|
+
localModel(options2.model, options2.env, options2.command);
|
|
34505
|
+
const until = stopsAt(options2.deadline);
|
|
34506
|
+
const refreshed = await store.crm.activityChunks.refresh({
|
|
34507
|
+
until: /* @__PURE__ */ __name(() => options2.signal?.aborted === true || Date.now() >= until, "until")
|
|
34508
|
+
});
|
|
34509
|
+
const embedded = await embedChunks(store, store.crm.activityChunks, options2);
|
|
34510
|
+
return refreshed.left ? { ...embedded, left: true } : embedded;
|
|
34511
|
+
}, "embedCrmActivities");
|
|
34512
|
+
var nearestCrmActivities = /* @__PURE__ */ __name(async (store, words3, { limit, accounts, kinds, viewers, env, command, embedders }) => {
|
|
34513
|
+
const { model, directory: directory2, key } = localModel(await meaningModel(store, env), env, command);
|
|
34514
|
+
if (!await store.crm.activityChunks.embedded(key, accounts))
|
|
34515
|
+
throw new CliError("not_found", `no CRM activity has vectors of ${model.id} yet, so only words were matched`);
|
|
34516
|
+
const [vector] = await withLocal(model, directory2, void 0, (embedder) => embedder.embed([words3], "query"), embedders);
|
|
34517
|
+
const floor = meaningFloor(key);
|
|
34518
|
+
return (await store.crm.activityChunks.nearest(key, vector, {
|
|
34519
|
+
limit,
|
|
34520
|
+
...accounts === void 0 ? {} : { accounts },
|
|
34521
|
+
...kinds === void 0 ? {} : { kinds },
|
|
34522
|
+
...viewers === void 0 ? {} : { viewers }
|
|
34523
|
+
})).filter(({ score }) => score > floor);
|
|
34524
|
+
}, "nearestCrmActivities");
|
|
34525
|
+
|
|
34526
|
+
// 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/services/events-search.js
|
|
34644
34527
|
var MAX_EVENTS_OFFSET = 1e3;
|
|
34645
34528
|
var iso3 = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
|
|
34646
34529
|
var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
|
|
@@ -34674,11 +34557,11 @@ var nearestEvents = /* @__PURE__ */ __name(async (store, words3, { limit, accoun
|
|
|
34674
34557
|
return (await store.calendar.nearest(key, vector, { limit, ...accountIds ? { accountIds } : {} })).filter(({ score }) => score > floor);
|
|
34675
34558
|
}, "nearestEvents");
|
|
34676
34559
|
var keyOf4 = /* @__PURE__ */ __name(({ event: event2 }) => event2.eventSeriesId === null ? `e${event2.id}` : `s${event2.eventSeriesId}`, "keyOf");
|
|
34677
|
-
var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, accounts, exact, discover, newest, timezone, signal, candidates, env, command, embedders } = {}) => {
|
|
34560
|
+
var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, accounts, exact, discover, newest: newest2, timezone, signal, candidates, env, command, embedders } = {}) => {
|
|
34678
34561
|
if (!query.trim())
|
|
34679
34562
|
throw new CliError("validation_error", "say what to find in the events");
|
|
34680
34563
|
query = plainQuery(query);
|
|
34681
|
-
const asked = discover && !exact && !
|
|
34564
|
+
const asked = discover && !exact && !newest2 ? questionLookup(query) : void 0;
|
|
34682
34565
|
const { root, stemmer } = await storeQuery(store, asked ?? query, {
|
|
34683
34566
|
...exact ? { exact: true } : {},
|
|
34684
34567
|
...timezone === void 0 ? {} : { timezone }
|
|
@@ -34692,7 +34575,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
|
|
|
34692
34575
|
let meaning;
|
|
34693
34576
|
if (exact)
|
|
34694
34577
|
meaningSkipped = "--exact searches words as written";
|
|
34695
|
-
else if (
|
|
34578
|
+
else if (newest2)
|
|
34696
34579
|
meaningSkipped = "newest first orders by time";
|
|
34697
34580
|
else if (words3 === void 0)
|
|
34698
34581
|
meaningSkipped = "the query has fields or operators, which meaning cannot follow";
|
|
@@ -34715,7 +34598,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
|
|
|
34715
34598
|
limit: meaning === void 0 ? limit : Math.max(window2, CANDIDATES3),
|
|
34716
34599
|
offset: meaning === void 0 ? offset : 0,
|
|
34717
34600
|
...accountIds === void 0 ? {} : { accountIds },
|
|
34718
|
-
...
|
|
34601
|
+
...newest2 ? { newest: true } : {},
|
|
34719
34602
|
...stemmer ? { stemmer } : {},
|
|
34720
34603
|
...signal ? { signal } : {},
|
|
34721
34604
|
...candidates === void 0 ? {} : { candidates }
|
|
@@ -34758,7 +34641,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
|
|
|
34758
34641
|
};
|
|
34759
34642
|
}, "searchEvents");
|
|
34760
34643
|
|
|
34761
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34644
|
+
// 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/services/search-all-business.js
|
|
34762
34645
|
var OWN_BUSINESS = { provider: "business", account: INTERNAL_NOTES };
|
|
34763
34646
|
var BUSINESS_WORDS_ONLY = "invoices, payments, orders, contracts, subscriptions, products and wallets are found by the words of their numbers and names only";
|
|
34764
34647
|
var placeOf = /* @__PURE__ */ __name(({ source, imported }) => source ?? (imported === void 0 ? OWN_BUSINESS : { provider: imported, account: "" }), "placeOf");
|
|
@@ -34788,7 +34671,7 @@ var searchBusiness = /* @__PURE__ */ __name(async (store, { words: words3, anyWo
|
|
|
34788
34671
|
};
|
|
34789
34672
|
}, "searchBusiness");
|
|
34790
34673
|
|
|
34791
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34674
|
+
// 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/services/search-all-meetings.js
|
|
34792
34675
|
var MOST_HITS_PER_MEETING = 3;
|
|
34793
34676
|
var PAGE_ROWS = 200;
|
|
34794
34677
|
var MOST_PAGES = 25;
|
|
@@ -35016,7 +34899,186 @@ var titleItem = /* @__PURE__ */ __name((account, meeting, query) => ({
|
|
|
35016
34899
|
foundBy: ["title"]
|
|
35017
34900
|
}), "titleItem");
|
|
35018
34901
|
|
|
35019
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34902
|
+
// 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/services/search-all-rank.js
|
|
34903
|
+
var titleWords2 = /* @__PURE__ */ __name((text2, refused = "deals and leads are found by the words of their title, company, contacts and activities only") => {
|
|
34904
|
+
const { root } = parseLucene(text2, SEARCH_QUERY);
|
|
34905
|
+
const clauses = root.kind === "boolean" ? root.clauses : [{ node: root, occur: "must" }];
|
|
34906
|
+
const words3 = clauses.map(({ node, occur }) => occur !== "must_not" && node.kind === "predicate" && (node.field === "text" || node.field === "title") && (node.operator === "term" || node.operator === "phrase") ? (
|
|
34907
|
+
// A title holds "invoice", not the question mark of "invoice?".
|
|
34908
|
+
node.value.replace(/\?+$/u, "") || node.value
|
|
34909
|
+
) : (() => {
|
|
34910
|
+
throw new CliError("validation_error", refused);
|
|
34911
|
+
})());
|
|
34912
|
+
return { words: words3, anyWord: clauses.length > 1 && clauses.every(({ occur }) => occur === "should") };
|
|
34913
|
+
}, "titleWords");
|
|
34914
|
+
var contentWords = /* @__PURE__ */ __name((found, discover) => {
|
|
34915
|
+
if (!discover)
|
|
34916
|
+
return found;
|
|
34917
|
+
const content = found.words.filter((word) => !words(word).every(isFunctionWord));
|
|
34918
|
+
return content.length ? { ...found, words: content } : found;
|
|
34919
|
+
}, "contentWords");
|
|
34920
|
+
var meaningWordsOf = /* @__PURE__ */ __name((text2) => {
|
|
34921
|
+
try {
|
|
34922
|
+
const { root } = parseLucene(text2, SEARCH_QUERY);
|
|
34923
|
+
const nodes = root.kind === "boolean" ? root.clauses.map(({ node }) => node) : [root];
|
|
34924
|
+
if (!nodes.every((node) => node.kind === "predicate" && node.field === "text"))
|
|
34925
|
+
return void 0;
|
|
34926
|
+
return meaningWords(root) || void 0;
|
|
34927
|
+
} catch {
|
|
34928
|
+
return void 0;
|
|
34929
|
+
}
|
|
34930
|
+
}, "meaningWordsOf");
|
|
34931
|
+
var fusedLane = /* @__PURE__ */ __name((byWords, byMeaning, discover, cosines) => {
|
|
34932
|
+
const fused2 = /* @__PURE__ */ new Map();
|
|
34933
|
+
byWords.forEach((item2, rank) => {
|
|
34934
|
+
fused2.set(item2.ref, { item: item2, score: 1 / (RRF_K + rank + 1) });
|
|
34935
|
+
});
|
|
34936
|
+
byMeaning.forEach(({ hit, score }, rank) => {
|
|
34937
|
+
cosines.set(hit.ref, score);
|
|
34938
|
+
const held = fused2.get(hit.ref);
|
|
34939
|
+
if (held && !held.item.foundBy.includes("meaning"))
|
|
34940
|
+
held.item.foundBy = [...held.item.foundBy, "meaning"];
|
|
34941
|
+
const vote = 1 / (RRF_K + rank + 1);
|
|
34942
|
+
if (held && discover)
|
|
34943
|
+
held.score = Math.max(held.score, vote);
|
|
34944
|
+
else
|
|
34945
|
+
fused2.set(hit.ref, { item: held?.item ?? hit, score: (held?.score ?? 0) + vote });
|
|
34946
|
+
});
|
|
34947
|
+
return [...fused2.values()].sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
|
|
34948
|
+
}, "fusedLane");
|
|
34949
|
+
var hitKey = /* @__PURE__ */ __name((item2) => item2.kind === "meeting" ? `${item2.ref}\0${item2.scope}\0${item2.id}` : item2.ref, "hitKey");
|
|
34950
|
+
var oneList = /* @__PURE__ */ __name((lists, cosines) => {
|
|
34951
|
+
const place = /* @__PURE__ */ new Map();
|
|
34952
|
+
for (const list2 of lists) {
|
|
34953
|
+
let above = Number.NEGATIVE_INFINITY;
|
|
34954
|
+
list2.forEach((item2, rank) => {
|
|
34955
|
+
const key = hitKey(item2);
|
|
34956
|
+
above = cosines.get(item2.ref) ?? above;
|
|
34957
|
+
const held = place.get(key);
|
|
34958
|
+
if (!held || rank < held.rank)
|
|
34959
|
+
place.set(key, { item: item2, rank, cosine: above });
|
|
34960
|
+
});
|
|
34961
|
+
}
|
|
34962
|
+
const head = /* @__PURE__ */ __name((rank) => Math.min(rank, 1), "head");
|
|
34963
|
+
return [...place.values()].sort((a, b) => head(a.rank) - head(b.rank) || b.cosine - a.cosine || a.rank - b.rank).map(({ item: item2 }) => item2);
|
|
34964
|
+
}, "oneList");
|
|
34965
|
+
var PERIOD_DEPTH = 100;
|
|
34966
|
+
var PERIOD_BOOST = 0.5;
|
|
34967
|
+
var insidePeriodFirst = /* @__PURE__ */ __name((ordered, period) => {
|
|
34968
|
+
if (!period)
|
|
34969
|
+
return ordered;
|
|
34970
|
+
const inside = /* @__PURE__ */ __name(({ timestamp: timestamp2 }) => {
|
|
34971
|
+
const at = timestamp2 === null ? Number.NaN : Date.parse(timestamp2);
|
|
34972
|
+
return at >= period.from && at < period.to;
|
|
34973
|
+
}, "inside");
|
|
34974
|
+
return ordered.map((item2, rank) => ({ item: item2, score: 1 - rank / PERIOD_DEPTH + (inside(item2) ? PERIOD_BOOST : 0) })).sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
|
|
34975
|
+
}, "insidePeriodFirst");
|
|
34976
|
+
|
|
34977
|
+
// 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/services/tracker-meaning.js
|
|
34978
|
+
var nearestTracker = /* @__PURE__ */ __name(async (store, words3, { limit, accounts, env, command, embedders }) => {
|
|
34979
|
+
const { model, directory: directory2, key } = localModel(await meaningModel(store, env), env, command);
|
|
34980
|
+
if (!await store.tracker.embedded(key, accounts))
|
|
34981
|
+
throw new CliError("not_found", `no issue, project or comment has vectors of ${model.id} yet, so only words were matched`, { reason: "tracker.no-vectors", model: model.id });
|
|
34982
|
+
const [vector] = await withLocal(model, directory2, void 0, (embedder) => embedder.embed([words3], "query"), embedders);
|
|
34983
|
+
const floor = meaningFloor(key);
|
|
34984
|
+
return (await store.tracker.nearest(key, vector, { limit, accounts })).filter(({ score }) => score > floor);
|
|
34985
|
+
}, "nearestTracker");
|
|
34986
|
+
|
|
34987
|
+
// 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/services/search-all-tracker.js
|
|
34988
|
+
var TRACKER_HIT_KINDS = { issue: "issue", project: "project", comment: "issue_comment" };
|
|
34989
|
+
var trackerTitle = /* @__PURE__ */ __name(({ kind, record }) => {
|
|
34990
|
+
const title = trackerTitleOf(kind, record);
|
|
34991
|
+
const key = kind === "issue" ? record.key : void 0;
|
|
34992
|
+
return key ? `${key} ${title}` : title;
|
|
34993
|
+
}, "trackerTitle");
|
|
34994
|
+
var trackerExcerpt = /* @__PURE__ */ __name(({ kind, record }, query) => excerpt([trackerTitleOf(kind, record), trackerBodyOf(kind, record)].filter(Boolean).join("\n"), query), "trackerExcerpt");
|
|
34995
|
+
var oneHitPerItem = /* @__PURE__ */ __name((ordered, cosines, items) => {
|
|
34996
|
+
const kept2 = /* @__PURE__ */ new Map();
|
|
34997
|
+
for (const hit of ordered) {
|
|
34998
|
+
const key = items.get(hit.ref) ?? hit.ref;
|
|
34999
|
+
const held = kept2.get(key);
|
|
35000
|
+
if (!held) {
|
|
35001
|
+
kept2.set(key, hit);
|
|
35002
|
+
continue;
|
|
35003
|
+
}
|
|
35004
|
+
held.accounts = [...held.accounts ?? [held.account], hit.account];
|
|
35005
|
+
held.foundBy = ["words", "meaning"].filter((by) => [held, hit].some(({ foundBy }) => foundBy.includes(by)));
|
|
35006
|
+
const cosine = cosines.get(hit.ref);
|
|
35007
|
+
if (cosine !== void 0 && cosine > (cosines.get(held.ref) ?? Number.NEGATIVE_INFINITY))
|
|
35008
|
+
cosines.set(held.ref, cosine);
|
|
35009
|
+
}
|
|
35010
|
+
return [...kept2.values()];
|
|
35011
|
+
}, "oneHitPerItem");
|
|
35012
|
+
var TRACKER_DEPTH = 500;
|
|
35013
|
+
var trackerLane = /* @__PURE__ */ __name(async (store, { text: text2, accounts: read, depth, discover, exact, cosines, embedders, command, env }) => {
|
|
35014
|
+
const { words: words3, anyWord } = contentWords(titleWords2(text2, "issues, projects and comments are found by the words and meaning of their title and text only"), discover);
|
|
35015
|
+
const deep = Math.min(depth * read.length, TRACKER_DEPTH);
|
|
35016
|
+
const found = await store.tracker.find({
|
|
35017
|
+
words: words3,
|
|
35018
|
+
anyWord: anyWord || discover,
|
|
35019
|
+
...exact ? { exact: true } : {},
|
|
35020
|
+
kinds: ["issue", "project", "comment"],
|
|
35021
|
+
limit: deep,
|
|
35022
|
+
accounts: read
|
|
35023
|
+
});
|
|
35024
|
+
const items = /* @__PURE__ */ new Map();
|
|
35025
|
+
const records = /* @__PURE__ */ new Map();
|
|
35026
|
+
const hitOf = /* @__PURE__ */ __name((at, item2, excerpt3, foundBy) => {
|
|
35027
|
+
const ref = `tracker:${at.provider}/${at.account}/${item2.kind}/${item2.record.externalId}`;
|
|
35028
|
+
if (hasGlobalItemIds(at.provider))
|
|
35029
|
+
items.set(ref, JSON.stringify([at.provider, item2.kind, item2.record.externalId]));
|
|
35030
|
+
records.set(ref, item2);
|
|
35031
|
+
return {
|
|
35032
|
+
kind: TRACKER_HIT_KINDS[item2.kind],
|
|
35033
|
+
// Two sign-ins see the same issue under the same id, so the account keeps their hits apart.
|
|
35034
|
+
ref,
|
|
35035
|
+
provider: at.provider,
|
|
35036
|
+
account: at.account,
|
|
35037
|
+
...item2.record.url ? { url: item2.record.url } : {},
|
|
35038
|
+
title: trackerTitle(item2),
|
|
35039
|
+
timestamp: new Date(item2.record.updatedAt ?? item2.syncedAt).toISOString(),
|
|
35040
|
+
text: excerpt3,
|
|
35041
|
+
foundBy
|
|
35042
|
+
};
|
|
35043
|
+
}, "hitOf");
|
|
35044
|
+
const byWords = found.items.map(({ account: at, item: item2, excerpt: text3 }) => hitOf(at, item2, text3, ["words"]));
|
|
35045
|
+
const plain2 = meaningWordsOf(discover ? questionText(text2) : text2);
|
|
35046
|
+
let near2;
|
|
35047
|
+
let meaningSkipped;
|
|
35048
|
+
let meaningReason;
|
|
35049
|
+
if (exact)
|
|
35050
|
+
meaningSkipped = "--exact searches words as written";
|
|
35051
|
+
else if (plain2 === void 0)
|
|
35052
|
+
meaningSkipped = "the query names a title, which meaning cannot follow";
|
|
35053
|
+
else
|
|
35054
|
+
try {
|
|
35055
|
+
near2 = await nearestTracker(store, plain2, {
|
|
35056
|
+
limit: deep,
|
|
35057
|
+
accounts: read,
|
|
35058
|
+
embedders,
|
|
35059
|
+
...command === void 0 ? {} : { command },
|
|
35060
|
+
...env === void 0 ? {} : { env }
|
|
35061
|
+
});
|
|
35062
|
+
} catch (error) {
|
|
35063
|
+
if (!(error instanceof CliError && error.code === "not_found"))
|
|
35064
|
+
throw error;
|
|
35065
|
+
meaningSkipped = error.message;
|
|
35066
|
+
const { reason } = error.details;
|
|
35067
|
+
if (typeof reason === "string")
|
|
35068
|
+
meaningReason = reason;
|
|
35069
|
+
}
|
|
35070
|
+
const tracker = {
|
|
35071
|
+
by: near2 === void 0 ? "words" : "words and meaning",
|
|
35072
|
+
...meaningSkipped === void 0 ? {} : { meaningSkipped }
|
|
35073
|
+
};
|
|
35074
|
+
const hits = near2 === void 0 ? oneHitPerItem(byWords, cosines, items) : oneHitPerItem(fusedLane(byWords, near2.map(({ account: at, item: item2, score }) => ({
|
|
35075
|
+
hit: hitOf(at, item2, trackerExcerpt(item2, text2), ["meaning"]),
|
|
35076
|
+
score
|
|
35077
|
+
})), discover, cosines), cosines, items);
|
|
35078
|
+
return { hits, records, hasMore: found.hasMore, tracker, ...meaningReason ? { meaningReason } : {} };
|
|
35079
|
+
}, "trackerLane");
|
|
35080
|
+
|
|
35081
|
+
// 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/services/search-harder.js
|
|
35020
35082
|
var SECTION3 = "search_harder";
|
|
35021
35083
|
var HARDER_MODELS = {
|
|
35022
35084
|
anthropic: "claude-haiku-5-5",
|
|
@@ -35262,8 +35324,17 @@ var reorderHarder = /* @__PURE__ */ __name(async (question, hits, { laterPage, a
|
|
|
35262
35324
|
};
|
|
35263
35325
|
}, "reorderHarder");
|
|
35264
35326
|
|
|
35265
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35266
|
-
var RESOURCES_SEARCHED = [
|
|
35327
|
+
// 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/services/search-all.js
|
|
35328
|
+
var RESOURCES_SEARCHED = [
|
|
35329
|
+
"messages",
|
|
35330
|
+
"mail",
|
|
35331
|
+
"notes",
|
|
35332
|
+
"events",
|
|
35333
|
+
"crm",
|
|
35334
|
+
"business",
|
|
35335
|
+
"meetings",
|
|
35336
|
+
"tracker"
|
|
35337
|
+
];
|
|
35267
35338
|
var refusal = /* @__PURE__ */ __name((error, text2) => {
|
|
35268
35339
|
const { reason, span } = error.details ?? {};
|
|
35269
35340
|
const why = typeof reason === "string" ? reason : void 0;
|
|
@@ -35277,17 +35348,6 @@ var filtersBeside = /* @__PURE__ */ __name((text2) => {
|
|
|
35277
35348
|
const top = root.kind === "boolean" ? root.clauses : [{ node: root, occur: "must" }];
|
|
35278
35349
|
return top.every(({ node, occur }) => occur !== "must_not" && followable(node, occur === "must")) ? planQuestion(text2).scope : void 0;
|
|
35279
35350
|
}, "filtersBeside");
|
|
35280
|
-
var titleWords2 = /* @__PURE__ */ __name((text2, refused = "deals and leads are found by the words of their title, company, contacts and activities only") => {
|
|
35281
|
-
const { root } = parseLucene(text2, SEARCH_QUERY);
|
|
35282
|
-
const clauses = root.kind === "boolean" ? root.clauses : [{ node: root, occur: "must" }];
|
|
35283
|
-
const words3 = clauses.map(({ node, occur }) => occur !== "must_not" && node.kind === "predicate" && (node.field === "text" || node.field === "title") && (node.operator === "term" || node.operator === "phrase") ? (
|
|
35284
|
-
// A title holds "invoice", not the question mark of "invoice?".
|
|
35285
|
-
node.value.replace(/\?+$/u, "") || node.value
|
|
35286
|
-
) : (() => {
|
|
35287
|
-
throw new CliError("validation_error", refused);
|
|
35288
|
-
})());
|
|
35289
|
-
return { words: words3, anyWord: clauses.length > 1 && clauses.every(({ occur }) => occur === "should") };
|
|
35290
|
-
}, "titleWords");
|
|
35291
35351
|
var strictWords = /* @__PURE__ */ __name((text2) => {
|
|
35292
35352
|
try {
|
|
35293
35353
|
const { words: words3, anyWord } = titleWords2(text2);
|
|
@@ -35301,14 +35361,21 @@ var strictWords = /* @__PURE__ */ __name((text2) => {
|
|
|
35301
35361
|
}, "strictWords");
|
|
35302
35362
|
var accountKeyOf = /* @__PURE__ */ __name(({ provider, account }) => `${provider}\0${account}`, "accountKeyOf");
|
|
35303
35363
|
var sourceScope = /* @__PURE__ */ __name(async (store, account, source, asked, messenger) => {
|
|
35304
|
-
const
|
|
35364
|
+
const context2 = await listContextOf(store, account, messenger.app);
|
|
35365
|
+
const entries = entriesOfList(source, context2);
|
|
35305
35366
|
const imported = asked.includes("business") ? new Set((await store.business.accounts()).map(accountKeyOf)) : /* @__PURE__ */ new Set();
|
|
35306
35367
|
const holdsBusiness = /* @__PURE__ */ __name((one) => imported.has(accountKeyOf(one)), "holdsBusiness");
|
|
35307
35368
|
const holdsDocuments = /* @__PURE__ */ __name((one) => asked.includes("notes") && holdsKind(one.provider, "documents"), "holdsDocuments");
|
|
35308
35369
|
const { skipped } = fitting(entries, asked.filter((one) => one !== "business"), "search all", (kind) => `--only leaves ${kind} out`, (one) => holdsBusiness(one) || holdsDocuments(one));
|
|
35309
35370
|
const holds = /* @__PURE__ */ __name((resource, one) => resource === "business" ? holdsBusiness(one) : listedHolds(one, resource) || resource === "notes" && holdsDocuments(one), "holds");
|
|
35371
|
+
const asNotes = /* @__PURE__ */ __name((one) => {
|
|
35372
|
+
if (!isDocumentAccountProvider(one.provider))
|
|
35373
|
+
return one;
|
|
35374
|
+
const stored = context2.held.find(({ provider, account: account2 }) => provider === one.provider && account2 === one.account);
|
|
35375
|
+
return stored ? { provider: "notes", account: String(stored.id) } : one;
|
|
35376
|
+
}, "asNotes");
|
|
35310
35377
|
const named2 = /* @__PURE__ */ __name((resource) => [
|
|
35311
|
-
...new Map(entries.flatMap(({ accounts }) => accounts).filter((one) => holds(resource, one)).map(({ provider, account: account2 }) => [`${provider}\0${account2}`, { provider, account: account2 }])).values()
|
|
35378
|
+
...new Map(entries.flatMap(({ accounts }) => accounts).filter((one) => holds(resource, one)).map((one) => resource === "notes" ? asNotes(one) : one).map(({ provider, account: account2 }) => [`${provider}\0${account2}`, { provider, account: account2 }])).values()
|
|
35312
35379
|
], "named");
|
|
35313
35380
|
const scope = Object.fromEntries(asked.map((resource) => [resource, named2(resource)]));
|
|
35314
35381
|
const only = asked.filter((resource) => scope[resource]?.length);
|
|
@@ -35324,6 +35391,7 @@ var copyViewers = /* @__PURE__ */ __name(async (store) => {
|
|
|
35324
35391
|
}
|
|
35325
35392
|
return viewers;
|
|
35326
35393
|
}, "copyViewers");
|
|
35394
|
+
var trackerAccounts = /* @__PURE__ */ __name(async (store) => (await store.accounts.accounts()).filter(({ provider }) => holdsKind(provider, "tracker")), "trackerAccounts");
|
|
35327
35395
|
var crmAccounts = /* @__PURE__ */ __name(async (store) => (await store.accounts.accounts()).filter(({ provider }) => holdsKind(provider, "crm")), "crmAccounts");
|
|
35328
35396
|
var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger = {}, searchMessages = (query) => searchStore(store, account, query, messenger), meaning) => {
|
|
35329
35397
|
if (!asked.text.trim())
|
|
@@ -35345,6 +35413,8 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
|
|
|
35345
35413
|
let hasMore = false;
|
|
35346
35414
|
let notes;
|
|
35347
35415
|
let events;
|
|
35416
|
+
let tracker;
|
|
35417
|
+
let crm;
|
|
35348
35418
|
const by = {};
|
|
35349
35419
|
let server;
|
|
35350
35420
|
const discover = !request.exact && questionLookup(request.text) !== void 0;
|
|
@@ -35513,7 +35583,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
|
|
|
35513
35583
|
})));
|
|
35514
35584
|
accounts.push(...read.map(({ provider, account: account2 }) => ({ resource, provider, account: account2 })));
|
|
35515
35585
|
} else if (resource === "crm") {
|
|
35516
|
-
const { words: words3, anyWord } = titleWords2(request.text);
|
|
35586
|
+
const { words: words3, anyWord } = contentWords(titleWords2(request.text), discover);
|
|
35517
35587
|
const chosen2 = scope?.crm;
|
|
35518
35588
|
const viewers = request.crmViewers ?? await copyViewers(store);
|
|
35519
35589
|
const found = await store.deals.find({
|
|
@@ -35527,7 +35597,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
|
|
|
35527
35597
|
});
|
|
35528
35598
|
hasMore ||= found.hasMore;
|
|
35529
35599
|
const titled = /(?:^|[\s(+])title:/u.test(request.text);
|
|
35530
|
-
|
|
35600
|
+
const byWords = found.items.filter((deal) => !titled || deal.matched.includes("title")).map((deal) => ({
|
|
35531
35601
|
kind: deal.kind,
|
|
35532
35602
|
ref: deal.ref,
|
|
35533
35603
|
provider: deal.account?.provider ?? "crm",
|
|
@@ -35537,7 +35607,56 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
|
|
|
35537
35607
|
text: deal.summary,
|
|
35538
35608
|
foundBy: deal.matched.includes("title") ? ["title"] : ["words"],
|
|
35539
35609
|
...deal.corrections ? { match: "corrected", corrections: deal.corrections } : {}
|
|
35540
|
-
}))
|
|
35610
|
+
}));
|
|
35611
|
+
const plain2 = titled ? void 0 : meaningWordsOf(discover ? questionText(request.text) : request.text);
|
|
35612
|
+
let near2;
|
|
35613
|
+
let meaningSkipped;
|
|
35614
|
+
if (request.crmActivities === false)
|
|
35615
|
+
meaningSkipped = "the profile may not read activities";
|
|
35616
|
+
else if (request.exact)
|
|
35617
|
+
meaningSkipped = "--exact searches words as written";
|
|
35618
|
+
else if (plain2 === void 0)
|
|
35619
|
+
meaningSkipped = "the query names a title, which meaning cannot follow";
|
|
35620
|
+
else
|
|
35621
|
+
try {
|
|
35622
|
+
near2 = await nearestCrmActivities(store, plain2, {
|
|
35623
|
+
limit: Math.min(depth, 500),
|
|
35624
|
+
accounts: chosen2,
|
|
35625
|
+
viewers,
|
|
35626
|
+
embedders,
|
|
35627
|
+
...request.crmKinds === void 0 ? {} : { kinds: request.crmKinds },
|
|
35628
|
+
...command === void 0 ? {} : { command },
|
|
35629
|
+
...request.env === void 0 ? {} : { env: request.env }
|
|
35630
|
+
});
|
|
35631
|
+
} catch (error) {
|
|
35632
|
+
if (!(error instanceof CliError && error.code === "not_found"))
|
|
35633
|
+
throw error;
|
|
35634
|
+
meaningSkipped = error.message;
|
|
35635
|
+
}
|
|
35636
|
+
crm = {
|
|
35637
|
+
by: near2 === void 0 ? "words" : "words and meaning",
|
|
35638
|
+
...meaningSkipped === void 0 ? {} : { meaningSkipped },
|
|
35639
|
+
...near2 === void 0 && plain2 !== void 0 && !request.exact && request.crmActivities !== false ? { needsVectors: true } : {}
|
|
35640
|
+
};
|
|
35641
|
+
if (near2 === void 0)
|
|
35642
|
+
lists.push(byWords);
|
|
35643
|
+
else {
|
|
35644
|
+
const byMeaning = await Promise.all(near2.map(async ({ ref, kind, account: at, subject, body, score }) => {
|
|
35645
|
+
const deal = await store.deals.get(ref);
|
|
35646
|
+
const hit = {
|
|
35647
|
+
kind,
|
|
35648
|
+
ref,
|
|
35649
|
+
provider: at.provider,
|
|
35650
|
+
account: at.account,
|
|
35651
|
+
title: deal.title,
|
|
35652
|
+
timestamp: deal.updatedAt,
|
|
35653
|
+
text: excerpt([subject, body].filter(Boolean).join("\n"), request.text),
|
|
35654
|
+
foundBy: ["meaning"]
|
|
35655
|
+
};
|
|
35656
|
+
return { hit, score };
|
|
35657
|
+
}));
|
|
35658
|
+
lists.push(fusedLane(byWords, byMeaning, discover, cosines));
|
|
35659
|
+
}
|
|
35541
35660
|
if (request.crmFiles !== false) {
|
|
35542
35661
|
const files = await store.crmFiles.find({
|
|
35543
35662
|
words: words3,
|
|
@@ -35562,8 +35681,28 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
|
|
|
35562
35681
|
const read = chosen2 ?? [...await crmAccounts(store), { provider: "crm", account: INTERNAL_NOTES }];
|
|
35563
35682
|
for (const { provider, account: account2 } of read)
|
|
35564
35683
|
accounts.push({ resource, provider, account: account2 });
|
|
35684
|
+
} else if (resource === "tracker") {
|
|
35685
|
+
const read = scope?.tracker ?? await trackerAccounts(store);
|
|
35686
|
+
if (!read.length)
|
|
35687
|
+
continue;
|
|
35688
|
+
const found = await trackerLane(store, {
|
|
35689
|
+
text: request.text,
|
|
35690
|
+
accounts: read,
|
|
35691
|
+
depth,
|
|
35692
|
+
discover,
|
|
35693
|
+
cosines,
|
|
35694
|
+
embedders,
|
|
35695
|
+
...request.exact ? { exact: true } : {},
|
|
35696
|
+
...command === void 0 ? {} : { command },
|
|
35697
|
+
...request.env === void 0 ? {} : { env: request.env }
|
|
35698
|
+
});
|
|
35699
|
+
hasMore ||= found.hasMore;
|
|
35700
|
+
tracker = found.tracker;
|
|
35701
|
+
lists.push(found.hits);
|
|
35702
|
+
for (const { provider, account: account2 } of read)
|
|
35703
|
+
accounts.push({ resource, provider, account: account2 });
|
|
35565
35704
|
} else if (resource === "business") {
|
|
35566
|
-
const { words: words3, anyWord } = titleWords2(request.text, BUSINESS_WORDS_ONLY);
|
|
35705
|
+
const { words: words3, anyWord } = contentWords(titleWords2(request.text, BUSINESS_WORDS_ONLY), discover);
|
|
35567
35706
|
const found = await searchBusiness(store, {
|
|
35568
35707
|
words: words3,
|
|
35569
35708
|
anyWord: anyWord || discover,
|
|
@@ -35642,6 +35781,8 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
|
|
|
35642
35781
|
skipped,
|
|
35643
35782
|
...notes === void 0 ? {} : { notes },
|
|
35644
35783
|
...events === void 0 ? {} : { events },
|
|
35784
|
+
...tracker === void 0 ? {} : { tracker },
|
|
35785
|
+
...crm === void 0 ? {} : { crm },
|
|
35645
35786
|
...by.messages === void 0 ? {} : { messages: by.messages },
|
|
35646
35787
|
...by.mail === void 0 ? {} : { mail: by.mail },
|
|
35647
35788
|
...server === void 0 ? {} : { server },
|
|
@@ -35679,38 +35820,15 @@ var withMeetingDocuments = /* @__PURE__ */ __name(async (store, lists, read) =>
|
|
|
35679
35820
|
];
|
|
35680
35821
|
}));
|
|
35681
35822
|
}, "withMeetingDocuments");
|
|
35682
|
-
var hitKey = /* @__PURE__ */ __name((item2) => item2.kind === "meeting" ? `${item2.ref}\0${item2.scope}\0${item2.id}` : item2.ref, "hitKey");
|
|
35683
|
-
var oneList = /* @__PURE__ */ __name((lists, cosines) => {
|
|
35684
|
-
const place = /* @__PURE__ */ new Map();
|
|
35685
|
-
for (const list2 of lists) {
|
|
35686
|
-
let above = Number.NEGATIVE_INFINITY;
|
|
35687
|
-
list2.forEach((item2, rank) => {
|
|
35688
|
-
const key = hitKey(item2);
|
|
35689
|
-
above = cosines.get(item2.ref) ?? above;
|
|
35690
|
-
const held = place.get(key);
|
|
35691
|
-
if (!held || rank < held.rank)
|
|
35692
|
-
place.set(key, { item: item2, rank, cosine: above });
|
|
35693
|
-
});
|
|
35694
|
-
}
|
|
35695
|
-
const head = /* @__PURE__ */ __name((rank) => Math.min(rank, 1), "head");
|
|
35696
|
-
return [...place.values()].sort((a, b) => head(a.rank) - head(b.rank) || b.cosine - a.cosine || a.rank - b.rank).map(({ item: item2 }) => item2);
|
|
35697
|
-
}, "oneList");
|
|
35698
|
-
var PERIOD_DEPTH = 100;
|
|
35699
|
-
var PERIOD_BOOST = 0.5;
|
|
35700
|
-
var insidePeriodFirst = /* @__PURE__ */ __name((ordered, period) => {
|
|
35701
|
-
if (!period)
|
|
35702
|
-
return ordered;
|
|
35703
|
-
const inside2 = /* @__PURE__ */ __name(({ timestamp: timestamp2 }) => {
|
|
35704
|
-
const at = timestamp2 === null ? Number.NaN : Date.parse(timestamp2);
|
|
35705
|
-
return at >= period.from && at < period.to;
|
|
35706
|
-
}, "inside");
|
|
35707
|
-
return ordered.map((item2, rank) => ({ item: item2, score: 1 - rank / PERIOD_DEPTH + (inside2(item2) ? PERIOD_BOOST : 0) })).sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
|
|
35708
|
-
}, "insidePeriodFirst");
|
|
35709
35823
|
|
|
35710
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35824
|
+
// 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/services/server-search.js
|
|
35711
35825
|
var SERVER_SEARCH_KEY = "messages.server-search";
|
|
35712
35826
|
var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3, textBytes: 262144 };
|
|
35713
35827
|
var DEFAULT_BACKEND = "both";
|
|
35828
|
+
var keysOf = /* @__PURE__ */ __name((error) => {
|
|
35829
|
+
const { reason } = error.details;
|
|
35830
|
+
return { code: error.code, ...typeof reason === "string" ? { reason } : {} };
|
|
35831
|
+
}, "keysOf");
|
|
35714
35832
|
var sourceKey = /* @__PURE__ */ __name((chatId, id2) => JSON.stringify([chatId, id2]), "sourceKey");
|
|
35715
35833
|
var merge = /* @__PURE__ */ __name((one, other) => {
|
|
35716
35834
|
if (one.chat !== void 0 && other.chat !== void 0 && one.chat !== other.chat)
|
|
@@ -35827,37 +35945,41 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
35827
35945
|
const controller = new AbortController();
|
|
35828
35946
|
const timer = setTimeout(() => controller.abort(), timeMs);
|
|
35829
35947
|
const stop = request.signal ? AbortSignal.any([request.signal, controller.signal]) : controller.signal;
|
|
35830
|
-
const bound2 = new Promise((
|
|
35948
|
+
const bound2 = new Promise((resolve6) => {
|
|
35831
35949
|
if (stop.aborted)
|
|
35832
|
-
|
|
35833
|
-
stop.addEventListener("abort", () =>
|
|
35950
|
+
resolve6(BOUND);
|
|
35951
|
+
stop.addEventListener("abort", () => resolve6(BOUND), { once: true });
|
|
35834
35952
|
});
|
|
35835
35953
|
const pending = new Set(calls);
|
|
35836
35954
|
const found = [];
|
|
35837
|
-
let
|
|
35838
|
-
const fail2 = /* @__PURE__ */ __name((branch, reason) => {
|
|
35955
|
+
let open6 = true;
|
|
35956
|
+
const fail2 = /* @__PURE__ */ __name((branch, reason, error) => {
|
|
35839
35957
|
pending.delete(branch);
|
|
35840
35958
|
report.complete = false;
|
|
35841
|
-
report.failed.push({
|
|
35959
|
+
report.failed.push({
|
|
35960
|
+
chat: branch.chat ?? null,
|
|
35961
|
+
reason,
|
|
35962
|
+
...error instanceof CliError ? { error: keysOf(error) } : {}
|
|
35963
|
+
});
|
|
35842
35964
|
}, "fail");
|
|
35843
35965
|
const ask2 = /* @__PURE__ */ __name(async (adapter) => {
|
|
35844
35966
|
const search = capability(adapter, "searchMessages", "search messages on its server");
|
|
35845
35967
|
await Promise.all(calls.map(async (branch) => {
|
|
35846
|
-
if (!
|
|
35968
|
+
if (!open6)
|
|
35847
35969
|
return;
|
|
35848
35970
|
report.calls += 1;
|
|
35849
35971
|
try {
|
|
35850
35972
|
const page = await search(asQuery(branch), { limit: SERVER_BOUNDS.perCall, signal: stop });
|
|
35851
|
-
if (!
|
|
35973
|
+
if (!open6)
|
|
35852
35974
|
return;
|
|
35853
35975
|
pending.delete(branch);
|
|
35854
35976
|
if (page.hasMore)
|
|
35855
35977
|
report.complete = false;
|
|
35856
35978
|
found.push(page);
|
|
35857
35979
|
} catch (error) {
|
|
35858
|
-
if (!
|
|
35980
|
+
if (!open6)
|
|
35859
35981
|
return;
|
|
35860
|
-
fail2(branch, error instanceof CliError && error.code === "rate_limited" ? "rate_limited" : "search_failed");
|
|
35982
|
+
fail2(branch, error instanceof CliError && error.code === "rate_limited" ? "rate_limited" : "search_failed", error);
|
|
35861
35983
|
}
|
|
35862
35984
|
}));
|
|
35863
35985
|
}, "ask");
|
|
@@ -35867,11 +35989,11 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
35867
35989
|
run2.then(() => "done", () => "failed"),
|
|
35868
35990
|
bound2
|
|
35869
35991
|
]);
|
|
35870
|
-
|
|
35992
|
+
open6 = false;
|
|
35871
35993
|
for (const branch of [...pending])
|
|
35872
35994
|
fail2(branch, outcome2 === "failed" ? "search_failed" : "time_or_abort_bound");
|
|
35873
35995
|
} finally {
|
|
35874
|
-
|
|
35996
|
+
open6 = false;
|
|
35875
35997
|
clearTimeout(timer);
|
|
35876
35998
|
}
|
|
35877
35999
|
const chats = new Map(found.flatMap(({ chats: chats2 }) => chats2).map((chat) => [chat.id, chat]));
|
|
@@ -35898,7 +36020,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
35898
36020
|
return { report, sources };
|
|
35899
36021
|
}, "searchServer");
|
|
35900
36022
|
|
|
35901
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36023
|
+
// 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/services/messages.js
|
|
35902
36024
|
var DELETE_AT_ONCE = 10;
|
|
35903
36025
|
var atOnce = /* @__PURE__ */ __name((ids) => {
|
|
35904
36026
|
if (ids.length > DELETE_AT_ONCE)
|
|
@@ -36398,7 +36520,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
|
|
|
36398
36520
|
throw new CliError("validation_error", `${MEDIA_FLAGS[first2]} needs a --photo or --file`);
|
|
36399
36521
|
}, "checkMediaOptions");
|
|
36400
36522
|
|
|
36401
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36523
|
+
// 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/domain/channel-tags.js
|
|
36402
36524
|
var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
|
|
36403
36525
|
var RULES2 = {
|
|
36404
36526
|
ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
|
|
@@ -36413,7 +36535,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES2
|
|
|
36413
36535
|
return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
|
|
36414
36536
|
}), "classifyChannel");
|
|
36415
36537
|
|
|
36416
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36538
|
+
// 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/services/metadata.js
|
|
36417
36539
|
var metadataService = /* @__PURE__ */ __name((deps) => {
|
|
36418
36540
|
const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
|
|
36419
36541
|
const store = await deps.store();
|
|
@@ -36499,7 +36621,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
|
|
|
36499
36621
|
};
|
|
36500
36622
|
}, "metadataService");
|
|
36501
36623
|
|
|
36502
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36624
|
+
// 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/moderation/run.js
|
|
36503
36625
|
var FIRST_LOOK_MS = 24 * 36e5;
|
|
36504
36626
|
var moderateWith = /* @__PURE__ */ __name(async (run2) => {
|
|
36505
36627
|
const { chatId, title, rules, point, since, dryRun } = run2;
|
|
@@ -36536,7 +36658,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run2) => {
|
|
|
36536
36658
|
return { chatId, rows, notes };
|
|
36537
36659
|
}, "moderateWith");
|
|
36538
36660
|
|
|
36539
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36661
|
+
// 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/services/moderation.js
|
|
36540
36662
|
var moderationService = /* @__PURE__ */ __name((deps) => {
|
|
36541
36663
|
const file = /* @__PURE__ */ __name(() => {
|
|
36542
36664
|
const env = deps.env ?? process.env;
|
|
@@ -36621,7 +36743,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
|
|
|
36621
36743
|
}, "removePerson")
|
|
36622
36744
|
}), "moderatorOf");
|
|
36623
36745
|
|
|
36624
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36746
|
+
// 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/services/private-people.js
|
|
36625
36747
|
var noteItem = /* @__PURE__ */ __name((provider, note) => ({
|
|
36626
36748
|
id: note.id,
|
|
36627
36749
|
contact: formatReference({ type: "contact", provider, id: note.personId }),
|
|
@@ -36665,7 +36787,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
|
|
|
36665
36787
|
};
|
|
36666
36788
|
}, "privatePeopleService");
|
|
36667
36789
|
|
|
36668
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36790
|
+
// 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/services/rankings.js
|
|
36669
36791
|
var empty = /* @__PURE__ */ __name(() => ({
|
|
36670
36792
|
total: 0,
|
|
36671
36793
|
population: 0,
|
|
@@ -36921,7 +37043,7 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
36921
37043
|
}, "evidence")
|
|
36922
37044
|
}), "rankingsService");
|
|
36923
37045
|
|
|
36924
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37046
|
+
// 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/services/reply-stats.js
|
|
36925
37047
|
var FIELDS = ["date", "chat", "kind", "muted"];
|
|
36926
37048
|
var WAITING_TAIL = 100;
|
|
36927
37049
|
var plainOnly = /* @__PURE__ */ __name((text2, command) => {
|
|
@@ -36986,12 +37108,12 @@ var figuresOf = /* @__PURE__ */ __name((delays) => {
|
|
|
36986
37108
|
};
|
|
36987
37109
|
}, "figuresOf");
|
|
36988
37110
|
var MINUTE2 = 6e4;
|
|
36989
|
-
var waitsOnOwner = /* @__PURE__ */ __name((
|
|
36990
|
-
if (
|
|
37111
|
+
var waitsOnOwner = /* @__PURE__ */ __name((newest2) => {
|
|
37112
|
+
if (newest2.mine)
|
|
36991
37113
|
return false;
|
|
36992
|
-
if (
|
|
36993
|
-
return !
|
|
36994
|
-
return
|
|
37114
|
+
if (newest2.kind === "private")
|
|
37115
|
+
return !newest2.quiet && rankingQuestion(newest2.text);
|
|
37116
|
+
return newest2.addressed || newest2.ownerUsername !== null && new RegExp(`(^|[^\\w@])@${newest2.ownerUsername.replace(/[^\w]/g, "\\$&")}(?!\\w)`, "i").test(newest2.text);
|
|
36995
37117
|
}, "waitsOnOwner");
|
|
36996
37118
|
var replyStatsService = /* @__PURE__ */ __name((deps) => {
|
|
36997
37119
|
const prepared = /* @__PURE__ */ __name(async (query, command) => {
|
|
@@ -37055,7 +37177,7 @@ var replyStatsService = /* @__PURE__ */ __name((deps) => {
|
|
|
37055
37177
|
};
|
|
37056
37178
|
}, "replyStatsService");
|
|
37057
37179
|
|
|
37058
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37180
|
+
// 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/services/tags.js
|
|
37059
37181
|
var TAGGING_QUERY = {
|
|
37060
37182
|
entity: "tagging",
|
|
37061
37183
|
backend: "sql",
|
|
@@ -37139,7 +37261,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
|
|
|
37139
37261
|
};
|
|
37140
37262
|
}, "tagsService");
|
|
37141
37263
|
|
|
37142
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37264
|
+
// 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/services/topics.js
|
|
37143
37265
|
var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden, icon }) => {
|
|
37144
37266
|
const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
|
|
37145
37267
|
if (title !== void 0 || icon !== void 0 || set !== 1)
|
|
@@ -37338,7 +37460,7 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
|
|
|
37338
37460
|
};
|
|
37339
37461
|
}, "topicsService");
|
|
37340
37462
|
|
|
37341
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37463
|
+
// 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/services/evidence.js
|
|
37342
37464
|
import { createHash as createHash12, randomUUID as randomUUID5 } from "node:crypto";
|
|
37343
37465
|
var hash2 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
|
|
37344
37466
|
var positive2 = /* @__PURE__ */ __name((value, name, minimum = 1) => {
|
|
@@ -37412,7 +37534,7 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
|
|
|
37412
37534
|
return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
|
|
37413
37535
|
}, "prepareEvidencePacket");
|
|
37414
37536
|
|
|
37415
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37537
|
+
// 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/services/evidence-read.js
|
|
37416
37538
|
var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, limit, before }, messenger = {}) => {
|
|
37417
37539
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
|
|
37418
37540
|
throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
|
|
@@ -37432,7 +37554,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, l
|
|
|
37432
37554
|
return { ...packet, nextBeforeId: older && last ? last.id : null };
|
|
37433
37555
|
}, "readEvidencePacket");
|
|
37434
37556
|
|
|
37435
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37557
|
+
// 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/services/meeting-project-discovery.js
|
|
37436
37558
|
var scopeKeys = [
|
|
37437
37559
|
"accountId",
|
|
37438
37560
|
"meetingId",
|
|
@@ -37454,7 +37576,7 @@ var optionKeys = /* @__PURE__ */ new Set([
|
|
|
37454
37576
|
"maxVocabularyReadBytes"
|
|
37455
37577
|
]);
|
|
37456
37578
|
|
|
37457
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37579
|
+
// 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/services/index.js
|
|
37458
37580
|
var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
37459
37581
|
const pictures = picturesService(deps);
|
|
37460
37582
|
const base = {
|
|
@@ -37492,12 +37614,13 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
|
37492
37614
|
}, "servicesFor");
|
|
37493
37615
|
|
|
37494
37616
|
export {
|
|
37617
|
+
timeLimit,
|
|
37618
|
+
withTimeLimit,
|
|
37495
37619
|
communicationFields,
|
|
37496
37620
|
OFFLINE,
|
|
37497
37621
|
onlineDeps,
|
|
37498
37622
|
storedDeps,
|
|
37499
37623
|
storeModeDeps,
|
|
37500
|
-
withTimeLimit,
|
|
37501
37624
|
REGISTRIES,
|
|
37502
37625
|
registriesCover,
|
|
37503
37626
|
chatCoverage,
|
|
@@ -37553,12 +37676,6 @@ export {
|
|
|
37553
37676
|
keyOf,
|
|
37554
37677
|
fetchInto,
|
|
37555
37678
|
GAP_BOUNDS,
|
|
37556
|
-
typesText,
|
|
37557
|
-
refuseLockedOutput,
|
|
37558
|
-
refusedPlace,
|
|
37559
|
-
readUpload,
|
|
37560
|
-
readAttachments,
|
|
37561
|
-
readStickerFile,
|
|
37562
37679
|
importEngine,
|
|
37563
37680
|
extractText,
|
|
37564
37681
|
engineHint,
|
|
@@ -37611,6 +37728,7 @@ export {
|
|
|
37611
37728
|
keyVariable,
|
|
37612
37729
|
enrichmentState,
|
|
37613
37730
|
searchNotesOf,
|
|
37731
|
+
embedCrmActivities,
|
|
37614
37732
|
HARDER_MODELS,
|
|
37615
37733
|
HARDER_CANDIDATES,
|
|
37616
37734
|
HARDER_CHARS,
|