@wirecat/tg-cli 0.115.0 → 0.117.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/dist/bin/tg.js +2 -2
- package/dist/bot/transport.d.ts +11 -9
- package/dist/bot/transport.d.ts.map +1 -1
- package/dist/bot/transport.js +58 -32
- package/dist/bot/transport.js.map +1 -1
- package/dist/bundle/{adapter-ODK7R4LY.js → adapter-VNQ72MBK.js} +98 -63
- package/dist/bundle/{all-profiles-AQYM65BS.js → all-profiles-3W2UQTCK.js} +10 -9
- package/dist/bundle/{anthropic-VBDSVNIM.js → anthropic-DFUW2KTG.js} +6 -6
- package/dist/bundle/{app-server-YOIHLBNS.js → app-server-5XJIMLHB.js} +49 -45
- package/dist/bundle/{bot-api-TRYLGQKK.js → bot-api-HRRBF3W6.js} +50 -49
- package/dist/bundle/{bot-history-7DTJLBBJ.js → bot-history-GBH5XE4N.js} +18 -17
- package/dist/bundle/{bun-XIMM6EHD.js → bun-ZMOYGG6F.js} +2 -2
- package/dist/bundle/{bun-sqlite-6B3BL5IV.js → bun-sqlite-6FZFMA7K.js} +5 -5
- package/dist/bundle/{chunk-DIABP7ZP.js → chunk-2452HCIV.js} +3 -3
- package/dist/bundle/{chunk-WMG4IGEB.js → chunk-2XLKZL6K.js} +77 -38
- package/dist/bundle/chunk-3GRX7WP6.js +35 -0
- package/dist/bundle/{chunk-WINKEV4F.js → chunk-3MQOLYAN.js} +4 -4
- package/dist/bundle/{chunk-KDOBY524.js → chunk-3RJYLN5V.js} +133 -27
- package/dist/bundle/{chunk-Y3AQHPAJ.js → chunk-4JDGN6OD.js} +1 -1
- package/dist/bundle/{chunk-JZXQZW2D.js → chunk-56Q5JV3Z.js} +2 -2
- package/dist/bundle/{chunk-XIYRHIBK.js → chunk-66FZBLRJ.js} +13 -13
- package/dist/bundle/{chunk-OUX3QMYI.js → chunk-6GFUL4OU.js} +228 -84
- package/dist/bundle/{chunk-O7CBGHI7.js → chunk-6HRN7BW6.js} +1 -1
- package/dist/bundle/{chunk-TQYMLXDS.js → chunk-7NBUT62O.js} +3 -3
- package/dist/bundle/{chunk-A4BQGSKI.js → chunk-7Y3RUEVY.js} +6 -6
- package/dist/bundle/chunk-AG6HWPQP.js +64 -0
- package/dist/bundle/{chunk-GCFU6WBE.js → chunk-AUBRELCM.js} +3 -3
- package/dist/bundle/{chunk-PEKTB3FQ.js → chunk-B2YPB5AE.js} +56 -27
- package/dist/bundle/{chunk-CCHHEMPM.js → chunk-BXTDAGM4.js} +3 -2
- package/dist/bundle/{chunk-QK6VLKG5.js → chunk-C6TUVV7E.js} +674 -316
- package/dist/bundle/{chunk-XY7IGVVS.js → chunk-EA2PGDER.js} +2 -2
- package/dist/bundle/{chunk-KIZT2MI6.js → chunk-EL6I4WTB.js} +1 -1
- package/dist/bundle/{chunk-77M3IAVU.js → chunk-EPCFXKTX.js} +27 -8
- package/dist/bundle/{chunk-L4CMCC3V.js → chunk-EZTYJ43A.js} +4 -2
- package/dist/bundle/{chunk-PEJHI7QO.js → chunk-F6KBVIJP.js} +4 -4
- package/dist/bundle/{chunk-UY7GJRGY.js → chunk-FAHHERJ7.js} +4 -4
- package/dist/bundle/{chunk-WOQGUIXE.js → chunk-FEKXHILZ.js} +1 -1
- package/dist/bundle/chunk-G7B5UIE7.js +182 -0
- package/dist/bundle/{chunk-RFRI2HFT.js → chunk-GFHNQBD2.js} +1 -1
- package/dist/bundle/{chunk-TMATSEP5.js → chunk-HORGORHK.js} +12 -12
- package/dist/bundle/{chunk-2TC76TLJ.js → chunk-HWYSRB64.js} +2 -2
- package/dist/bundle/{chunk-GX4DMI4H.js → chunk-HZZGOLGP.js} +15 -12
- package/dist/bundle/{chunk-MUZ4KYGY.js → chunk-JWIUK3SK.js} +2 -2
- package/dist/bundle/{chunk-WDNNN3J4.js → chunk-KVTLT4V7.js} +6 -6
- package/dist/bundle/{chunk-UBQ3LOF6.js → chunk-L5WNE4WS.js} +2 -2
- package/dist/bundle/{chunk-OMP6ALBT.js → chunk-M7V5XRM6.js} +3 -3
- package/dist/bundle/{chunk-LUIPXRKN.js → chunk-MLHKQDUN.js} +647 -129
- package/dist/bundle/{chunk-VQCWVZWG.js → chunk-MP7M6FFU.js} +6 -6
- package/dist/bundle/{chunk-5ROWSRK7.js → chunk-NUCDEOFC.js} +2 -2
- package/dist/bundle/{chunk-ILHTNOIV.js → chunk-P3ASN72F.js} +1 -1
- package/dist/bundle/{chunk-VVKEWWSO.js → chunk-PTIB7NEE.js} +1 -1
- package/dist/bundle/{chunk-D4E345BC.js → chunk-Q7O4CQDO.js} +4 -2
- package/dist/bundle/{chunk-EW3XTUPB.js → chunk-QOGYHU3Q.js} +4 -4
- package/dist/bundle/{chunk-BEQPZA3S.js → chunk-RDH2QBUE.js} +3 -3
- package/dist/bundle/{chunk-AVWPMJ6E.js → chunk-RDSLSV4M.js} +2 -2
- package/dist/bundle/{chunk-YCUQKFGD.js → chunk-SQXB5ZUZ.js} +3 -3
- package/dist/bundle/{chunk-RHUNMU4Q.js → chunk-TFBHDIGY.js} +4 -4
- package/dist/bundle/{chunk-OSP335AJ.js → chunk-TG6ZYL4B.js} +8 -8
- package/dist/bundle/{chunk-IUDIRZVU.js → chunk-UGPZCNYC.js} +991 -536
- package/dist/bundle/{chunk-AICS3TSF.js → chunk-UYK5AXSW.js} +4 -4
- package/dist/bundle/{chunk-PZAEI4NM.js → chunk-V2T7NYNU.js} +55 -46
- package/dist/bundle/{chunk-HZKWB6WS.js → chunk-V47NPSSV.js} +28 -28
- package/dist/bundle/{chunk-U67TSAAO.js → chunk-VMCQGZIA.js} +1893 -840
- package/dist/bundle/{chunk-CNO3R4O4.js → chunk-VRDVXXXD.js} +8 -8
- package/dist/bundle/{chunk-PQLBPYJR.js → chunk-VW6BF6M7.js} +1 -1
- package/dist/bundle/{chunk-M7B5IMH3.js → chunk-X3CD475M.js} +1336 -366
- package/dist/bundle/chunk-XW5C4TI7.js +91 -0
- package/dist/bundle/{chunk-NTW5ZE47.js → chunk-YHZFGUAP.js} +39 -33
- package/dist/bundle/{chunk-BIEBJLYO.js → chunk-YIXXH74F.js} +2 -2
- package/dist/bundle/{chunk-BPPRR7TV.js → chunk-Z4QKLHJW.js} +15587 -1637
- package/dist/bundle/{chunk-POKTQZOM.js → chunk-ZPILMEFY.js} +12 -89
- package/dist/bundle/command-contract-KMMHARMR.js +33 -0
- package/dist/bundle/{decode-2GATBZGH.js → decode-YMSOY2AY.js} +5 -5
- package/dist/bundle/{dispatch-MJMW7WDH.js → dispatch-OP27MWX5.js} +8 -8
- package/dist/bundle/{echarts-GKEZEAL7.js → echarts-7XS55TQY.js} +2 -2
- package/dist/bundle/{embed-TBQPLA4Y.js → embed-QTOE7NN3.js} +6 -6
- package/dist/bundle/{embedder-B5DTNCRO.js → embedder-KBBRYSNH.js} +9 -9
- package/dist/bundle/{entry-A6DEW2TD.js → entry-HGEUYYMX.js} +7 -7
- package/dist/bundle/{failure-TLF3SISS.js → failure-4JUQFXJT.js} +2 -2
- package/dist/bundle/{first-run-3N5AABEY.js → first-run-CSGMEJXY.js} +11 -11
- package/dist/bundle/first-screen-K2PBNJNE.js +31 -0
- package/dist/bundle/{instructions-P5E34PQR.js → instructions-S6ZXCTFH.js} +1 -1
- package/dist/bundle/{mcp-MNI62HHE.js → mcp-M4QN2E7R.js} +2 -2
- package/dist/bundle/{node-GKPRXS5Y.js → node-LCIUWXXG.js} +2 -2
- package/dist/bundle/{node-sqlite-GIDPALK3.js → node-sqlite-HL4WY4N2.js} +6 -6
- package/dist/bundle/{oauth-C57W4IMD.js → oauth-U4KIMDKG.js} +7 -7
- package/dist/bundle/{open-E6Q4WRPU.js → open-EH7OS7M7.js} +5 -5
- package/dist/bundle/{openai-5WMXY2KP.js → openai-W5TB3NA5.js} +14 -14
- package/dist/bundle/{process-U2P5Z6UF.js → process-3CVLTCTA.js} +1 -1
- package/dist/bundle/{program-FEUDU6GF.js → program-LOIZTK2P.js} +58 -50
- package/dist/bundle/{prompt-4NGAZGHE.js → prompt-IDNH7N3W.js} +5 -5
- package/dist/bundle/{proxy-transport-MGCJ7JAW.js → proxy-transport-4DPZB2W2.js} +5 -5
- package/dist/bundle/{recognize-EUHRBA7V.js → recognize-G5EWYXIF.js} +4 -4
- package/dist/bundle/{remote-3JHLB2FV.js → remote-4XTBZVZD.js} +7 -7
- package/dist/bundle/{rerank-ZZ45SZPC.js → rerank-OWSTDLZN.js} +7 -7
- package/dist/bundle/{serve-XOGX5FC5.js → serve-YCPSEWP3.js} +9 -9
- package/dist/bundle/server-KELKX6S3.js +60 -0
- package/dist/bundle/{server-I6O72XP5.js → server-ODG4A2KK.js} +35 -34
- package/dist/bundle/{state-BIUYTGH6.js → state-OL2235G5.js} +6 -6
- package/dist/bundle/{store-FOJFYOMR.js → store-5AACYNDM.js} +17 -12
- package/dist/bundle/store-maintenance-command-3J7WZYVN.js +50 -0
- package/dist/bundle/tg.js +13 -13
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +7 -0
- package/dist/commands/session.js.map +1 -1
- package/dist/telegram/account.d.ts.map +1 -1
- package/dist/telegram/account.js +4 -1
- package/dist/telegram/account.js.map +1 -1
- package/dist/telegram/errors.d.ts.map +1 -1
- package/dist/telegram/errors.js +2 -1
- package/dist/telegram/errors.js.map +1 -1
- package/dist/telegram/feature.d.ts +4 -1
- package/dist/telegram/feature.d.ts.map +1 -1
- package/dist/telegram/feature.js +5 -2
- package/dist/telegram/feature.js.map +1 -1
- package/dist/telegram/login.d.ts +2 -0
- package/dist/telegram/login.d.ts.map +1 -1
- package/dist/telegram/login.js +31 -2
- package/dist/telegram/login.js.map +1 -1
- package/dist/telegram/sending.d.ts.map +1 -1
- package/dist/telegram/sending.js +24 -10
- package/dist/telegram/sending.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/bundle/chunk-63YKD7YA.js +0 -18
- package/dist/bundle/chunk-GWDMKEDY.js +0 -48
- package/dist/bundle/chunk-WMRFAK5B.js +0 -132
- package/dist/bundle/command-contract-YF4KGFXC.js +0 -32
- package/dist/bundle/first-screen-HANARM67.js +0 -30
- package/dist/bundle/server-DRE5MJ76.js +0 -59
- package/dist/bundle/store-maintenance-command-YKV2C34N.js +0 -49
- /package/dist/bundle/{chunk-NUN6OGOV.js → chunk-VOXIGICJ.js} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
sameOrdinaryFile,
|
|
9
9
|
syncDirectory,
|
|
10
10
|
writeFileAtomic
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-66FZBLRJ.js";
|
|
12
12
|
import {
|
|
13
13
|
Command,
|
|
14
14
|
DEFAULT_IMAGE_MODEL,
|
|
@@ -48,17 +48,17 @@ import {
|
|
|
48
48
|
typedCommand,
|
|
49
49
|
vectorModelKey,
|
|
50
50
|
withAttempt
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-X3CD475M.js";
|
|
52
52
|
import {
|
|
53
53
|
isCliFailure
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-ZPILMEFY.js";
|
|
55
55
|
import {
|
|
56
56
|
isNewer,
|
|
57
57
|
updateCommand
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-3MQOLYAN.js";
|
|
59
59
|
import {
|
|
60
60
|
readOnlyLockOf
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-Q7O4CQDO.js";
|
|
62
62
|
import {
|
|
63
63
|
AGENDA_COLUMNS,
|
|
64
64
|
CHAT_COLUMNS,
|
|
@@ -69,6 +69,7 @@ import {
|
|
|
69
69
|
COUNTER_FIELDS,
|
|
70
70
|
FIELD_VERSION,
|
|
71
71
|
INTERNAL_NOTES,
|
|
72
|
+
MAIL_AGENDA_COLUMNS,
|
|
72
73
|
MAX_FILE_BYTES,
|
|
73
74
|
MAX_TEXT_CHARS,
|
|
74
75
|
MENTION_QUERY,
|
|
@@ -97,6 +98,7 @@ import {
|
|
|
97
98
|
counterFreshness,
|
|
98
99
|
counterObservationTime,
|
|
99
100
|
cutChunks,
|
|
101
|
+
delayStats,
|
|
100
102
|
dueDayOf,
|
|
101
103
|
entriesOfList,
|
|
102
104
|
exhausted,
|
|
@@ -132,12 +134,14 @@ import {
|
|
|
132
134
|
queryFilter,
|
|
133
135
|
rankingContextRange,
|
|
134
136
|
rankingOptions,
|
|
137
|
+
rankingQuestion,
|
|
135
138
|
searchError,
|
|
136
139
|
sourceOf,
|
|
137
140
|
threadConversation,
|
|
138
141
|
validateAst,
|
|
139
|
-
validateFields
|
|
140
|
-
|
|
142
|
+
validateFields,
|
|
143
|
+
withoutField
|
|
144
|
+
} from "./chunk-Z4QKLHJW.js";
|
|
141
145
|
import {
|
|
142
146
|
EVENT_QUERY,
|
|
143
147
|
MEETING_PROJECT_EVIDENCE_QUERY,
|
|
@@ -171,7 +175,6 @@ import {
|
|
|
171
175
|
normalizeTag,
|
|
172
176
|
parseLucene,
|
|
173
177
|
parseMeetingReference,
|
|
174
|
-
paymentTitle,
|
|
175
178
|
pull,
|
|
176
179
|
queryError,
|
|
177
180
|
queryFieldsOf,
|
|
@@ -183,23 +186,23 @@ import {
|
|
|
183
186
|
validateQuery,
|
|
184
187
|
walkQuery,
|
|
185
188
|
zonedMoment
|
|
186
|
-
} from "./chunk-
|
|
189
|
+
} from "./chunk-C6TUVV7E.js";
|
|
187
190
|
import {
|
|
188
191
|
DEFAULT_STEMMERS,
|
|
189
192
|
createStemmer,
|
|
190
193
|
fold,
|
|
191
194
|
normalize
|
|
192
|
-
} from "./chunk-
|
|
195
|
+
} from "./chunk-TG6ZYL4B.js";
|
|
193
196
|
import {
|
|
194
197
|
DEFAULT_TASK_CATEGORIES,
|
|
195
198
|
FALLBACK_CATEGORY
|
|
196
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-7Y3RUEVY.js";
|
|
197
200
|
import {
|
|
198
201
|
MAX_MODEL_IMAGE_BYTES
|
|
199
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-56Q5JV3Z.js";
|
|
200
203
|
import {
|
|
201
204
|
remoteKey
|
|
202
|
-
} from "./chunk-
|
|
205
|
+
} from "./chunk-2452HCIV.js";
|
|
203
206
|
import {
|
|
204
207
|
Unzip,
|
|
205
208
|
UnzipInflate,
|
|
@@ -210,19 +213,19 @@ import {
|
|
|
210
213
|
placedText,
|
|
211
214
|
runEmbedders,
|
|
212
215
|
textModelsDirectory
|
|
213
|
-
} from "./chunk-
|
|
216
|
+
} from "./chunk-KVTLT4V7.js";
|
|
214
217
|
import {
|
|
215
218
|
installFiles,
|
|
216
219
|
megabytes
|
|
217
|
-
} from "./chunk-
|
|
220
|
+
} from "./chunk-F6KBVIJP.js";
|
|
218
221
|
import {
|
|
219
222
|
storePath,
|
|
220
223
|
wirecatDirectory
|
|
221
|
-
} from "./chunk-
|
|
224
|
+
} from "./chunk-3GRX7WP6.js";
|
|
222
225
|
import {
|
|
223
226
|
resolvePaths,
|
|
224
227
|
writeSecurely
|
|
225
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-YHZFGUAP.js";
|
|
226
229
|
import {
|
|
227
230
|
array,
|
|
228
231
|
boolean,
|
|
@@ -245,7 +248,7 @@ import {
|
|
|
245
248
|
string,
|
|
246
249
|
transform,
|
|
247
250
|
unknown
|
|
248
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-EPCFXKTX.js";
|
|
249
252
|
import {
|
|
250
253
|
importFrom,
|
|
251
254
|
resolveFrom
|
|
@@ -255,7 +258,7 @@ import {
|
|
|
255
258
|
isCliError,
|
|
256
259
|
singleLine,
|
|
257
260
|
visibleControls
|
|
258
|
-
} from "./chunk-
|
|
261
|
+
} from "./chunk-BXTDAGM4.js";
|
|
259
262
|
import {
|
|
260
263
|
__commonJS,
|
|
261
264
|
__name,
|
|
@@ -276,9 +279,9 @@ var require_conventions = __commonJS({
|
|
|
276
279
|
}
|
|
277
280
|
for (var i = 0; i < list3.length; i++) {
|
|
278
281
|
if (hasOwn(list3, i)) {
|
|
279
|
-
var
|
|
280
|
-
if (predicate.call(void 0,
|
|
281
|
-
return
|
|
282
|
+
var item2 = list3[i];
|
|
283
|
+
if (predicate.call(void 0, item2, i, list3)) {
|
|
284
|
+
return item2;
|
|
282
285
|
}
|
|
283
286
|
}
|
|
284
287
|
}
|
|
@@ -1087,8 +1090,8 @@ var require_dom = __commonJS({
|
|
|
1087
1090
|
* The first index of the node in the NodeList; -1 if not found.
|
|
1088
1091
|
* @private
|
|
1089
1092
|
*/
|
|
1090
|
-
indexOf: /* @__PURE__ */ __name(function(
|
|
1091
|
-
return Array.prototype.indexOf.call(this,
|
|
1093
|
+
indexOf: /* @__PURE__ */ __name(function(item2) {
|
|
1094
|
+
return Array.prototype.indexOf.call(this, item2);
|
|
1092
1095
|
}, "indexOf")
|
|
1093
1096
|
};
|
|
1094
1097
|
NodeList.prototype[Symbol.iterator] = function() {
|
|
@@ -16871,7 +16874,7 @@ var require_lib3 = __commonJS({
|
|
|
16871
16874
|
}
|
|
16872
16875
|
});
|
|
16873
16876
|
|
|
16874
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16877
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/conversations/link.js
|
|
16875
16878
|
var RULES_VERSION = 5;
|
|
16876
16879
|
var LOOK_BACK = 50;
|
|
16877
16880
|
var SAME_SENDER_WITHIN = 10;
|
|
@@ -16961,15 +16964,15 @@ var latest = /* @__PURE__ */ __name((window3, matches) => {
|
|
|
16961
16964
|
var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
|
|
16962
16965
|
var link = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
|
|
16963
16966
|
|
|
16964
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16967
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/ports/traits.js
|
|
16965
16968
|
var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
|
|
16966
16969
|
|
|
16967
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16970
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/send-id.js
|
|
16968
16971
|
import { randomBytes } from "node:crypto";
|
|
16969
16972
|
var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
|
|
16970
16973
|
var newOperationId = newSendId;
|
|
16971
16974
|
|
|
16972
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16975
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/upload.js
|
|
16973
16976
|
import { openAsBlob, realpathSync } from "node:fs";
|
|
16974
16977
|
import { open, stat } from "node:fs/promises";
|
|
16975
16978
|
import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
@@ -17190,7 +17193,7 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
|
|
|
17190
17193
|
return { name, source };
|
|
17191
17194
|
}, "readStickerFile");
|
|
17192
17195
|
|
|
17193
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17196
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
|
|
17194
17197
|
var COMMAND_NEEDS = {
|
|
17195
17198
|
"account update": ["updateProfile", "change the profile"],
|
|
17196
17199
|
"account sessions list": ["sessions", "list the account's sessions"],
|
|
@@ -17240,7 +17243,7 @@ var hideNever = /* @__PURE__ */ __name((messenger, group) => {
|
|
|
17240
17243
|
return group;
|
|
17241
17244
|
}, "hideNever");
|
|
17242
17245
|
|
|
17243
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17246
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/members-audit.js
|
|
17244
17247
|
var AUDIT_PAGE = 200;
|
|
17245
17248
|
var AUDIT_BUDGET = 10;
|
|
17246
17249
|
var AUDIT_PAUSE_MS = 1e3;
|
|
@@ -17320,7 +17323,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
|
|
|
17320
17323
|
return found;
|
|
17321
17324
|
}, "burstJoins");
|
|
17322
17325
|
|
|
17323
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17326
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/meetings/cli/query-options.js
|
|
17324
17327
|
var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
|
|
17325
17328
|
command.allowUnknownOption();
|
|
17326
17329
|
const parse = command.parseOptions.bind(command);
|
|
@@ -17340,7 +17343,7 @@ var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
|
|
|
17340
17343
|
return command;
|
|
17341
17344
|
}, "queryWordsAfterOptions");
|
|
17342
17345
|
|
|
17343
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17346
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/meetings/cli/passage.js
|
|
17344
17347
|
var count = /* @__PURE__ */ __name((value) => {
|
|
17345
17348
|
if (!/^(0|[1-9]\d*)$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
17346
17349
|
throw new CliError("validation_error", "expected a nonnegative safe integer");
|
|
@@ -17382,7 +17385,7 @@ var addMeetingPassageCommandDefinition = /* @__PURE__ */ __name((program, deps)
|
|
|
17382
17385
|
var createMeetingPassageCommand = sharedCommand(createMeetingPassageCommandDefinition);
|
|
17383
17386
|
var addMeetingPassageCommand = sharedCommand(addMeetingPassageCommandDefinition);
|
|
17384
17387
|
|
|
17385
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17388
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/meetings/cli/project-evidence.js
|
|
17386
17389
|
var integer2 = /* @__PURE__ */ __name((value) => {
|
|
17387
17390
|
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
17388
17391
|
throw new CliError("validation_error", "expected a positive safe integer");
|
|
@@ -17405,7 +17408,7 @@ ${fieldsHelp(MEETING_PROJECT_EVIDENCE_QUERY)}`).option("--limit <n>", "hits in o
|
|
|
17405
17408
|
}, "addMeetingProjectEvidenceCommandDefinition");
|
|
17406
17409
|
var addMeetingProjectEvidenceCommand = sharedCommand(addMeetingProjectEvidenceCommandDefinition);
|
|
17407
17410
|
|
|
17408
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17411
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/meetings/cli/search.js
|
|
17409
17412
|
var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
|
|
17410
17413
|
var moment = /* @__PURE__ */ __name((flag, end, readIn) => (value) => {
|
|
17411
17414
|
const zone = timezoneOf();
|
|
@@ -17491,7 +17494,7 @@ var addMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program, deps) =
|
|
|
17491
17494
|
var createMeetingSearchCommand = sharedCommand(createMeetingSearchCommandDefinition);
|
|
17492
17495
|
var addMeetingSearchCommand = sharedCommand(addMeetingSearchCommandDefinition);
|
|
17493
17496
|
|
|
17494
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17497
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/meetings/cli/index.js
|
|
17495
17498
|
var integer4 = /* @__PURE__ */ __name((text2) => {
|
|
17496
17499
|
if (!/^[1-9]\d*$/.test(text2) || !Number.isSafeInteger(Number(text2)))
|
|
17497
17500
|
throw new InvalidArgumentError("expected a positive integer");
|
|
@@ -17570,14 +17573,15 @@ ${fieldsHelp(MEETING_QUERY, MEETING_QUERY_GUIDE)}`);
|
|
|
17570
17573
|
offline: false,
|
|
17571
17574
|
output: { entity: "meeting_ingestion" }
|
|
17572
17575
|
}).description("bring the stored meetings up to date from the connected account")).option("--since-time <time>", "fetch meetings starting at or after this ISO 8601 date or time", date).option("--lookback-days <days>", "revisit recent occurrences for late transcripts (0\u201331)", lookbackDays, 0).action(async (opts, command) => {
|
|
17573
|
-
|
|
17576
|
+
const source = deps.source;
|
|
17577
|
+
if (!source)
|
|
17574
17578
|
throw new MeetingError("configuration_error", "meeting source is unavailable");
|
|
17575
|
-
print(await pull(
|
|
17579
|
+
await deps.inRun(command, async () => print(await pull(source, deps.store, {
|
|
17576
17580
|
accountId: deps.accountId,
|
|
17577
17581
|
since: opts.sinceTime === void 0 ? void 0 : new Date(opts.sinceTime).toISOString(),
|
|
17578
17582
|
now: deps.now?.(),
|
|
17579
17583
|
lookbackMs: opts.lookbackDays * 864e5
|
|
17580
|
-
}), command);
|
|
17584
|
+
}), command));
|
|
17581
17585
|
});
|
|
17582
17586
|
const importCommand = annotate(group.command("import"), {
|
|
17583
17587
|
effects: LOCAL_WRITE,
|
|
@@ -17623,7 +17627,7 @@ ${fieldsHelp(EVENT_QUERY, MEETING_QUERY_GUIDE)}`);
|
|
|
17623
17627
|
}, "addMeetingCommandsDefinition");
|
|
17624
17628
|
var addMeetingCommands = sharedCommand(addMeetingCommandsDefinition);
|
|
17625
17629
|
|
|
17626
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17630
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/list-query.js
|
|
17627
17631
|
var LIST_QUERY_GUIDE = "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md";
|
|
17628
17632
|
var QUERY_ARGUMENT = "field:value terms that narrow the list \u2014 the fields are below";
|
|
17629
17633
|
var withQuery = /* @__PURE__ */ __name((command, registry) => {
|
|
@@ -17756,7 +17760,7 @@ var termField = /* @__PURE__ */ __name((name, type, example, more = {}) => nativ
|
|
|
17756
17760
|
var queryHelp = /* @__PURE__ */ __name((registry) => `
|
|
17757
17761
|
${fieldsHelp(registry, LIST_QUERY_GUIDE)}`, "queryHelp");
|
|
17758
17762
|
|
|
17759
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17763
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/paging.js
|
|
17760
17764
|
var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
|
|
17761
17765
|
if (!/^\d+$/.test(value.trim()) || Number(value) < 1)
|
|
17762
17766
|
throw new CliError("validation_error", `${flag} takes a whole number from 1 upwards, not "${value}"`);
|
|
@@ -17765,7 +17769,7 @@ var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
|
|
|
17765
17769
|
var withPaging = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many to show", positiveCount("--limit")).option("--page <n>", "which page, starting at 1", positiveCount("--page")).option("--all", "every row, no paging"), "withPaging");
|
|
17766
17770
|
var window = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { offset: 0 } : { limit, offset: (page - 1) * limit }, "window");
|
|
17767
17771
|
|
|
17768
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17772
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
|
|
17769
17773
|
var defined = /* @__PURE__ */ __name((record2) => Object.fromEntries(Object.entries(record2).filter(([, value]) => value !== void 0)), "defined");
|
|
17770
17774
|
var chatRef = /* @__PURE__ */ __name((account, chat) => formatReference({ type: "chat", provider: account.provider, account: account.account, chat }), "chatRef");
|
|
17771
17775
|
var settingsOf = /* @__PURE__ */ __name((settings) => defined({
|
|
@@ -17956,7 +17960,7 @@ var folderAnswer = /* @__PURE__ */ __name((folder) => {
|
|
|
17956
17960
|
excluded_chats: shown?.excluded
|
|
17957
17961
|
});
|
|
17958
17962
|
}, "folderAnswer");
|
|
17959
|
-
var lines = /* @__PURE__ */ __name((line2) => (body) => (body.items ?? (body.item === void 0 ? [] : [body.item])).map((
|
|
17963
|
+
var lines = /* @__PURE__ */ __name((line2) => (body) => (body.items ?? (body.item === void 0 ? [] : [body.item])).map((item2) => `${line2(item2).trimEnd()}
|
|
17960
17964
|
`).join(""), "lines");
|
|
17961
17965
|
var pageOf2 = /* @__PURE__ */ __name(({ limit, page, all }, { items, hasMore }) => all ? { limit: Math.max(1, items.length), has_more: false, page: 1 } : { limit, has_more: hasMore, page }, "pageOf");
|
|
17962
17966
|
var wholeList = /* @__PURE__ */ __name((command, items, extra = {}) => listOf(command, { items, limit: Math.max(1, items.length), has_more: false, ...extra }), "wholeList");
|
|
@@ -18027,7 +18031,7 @@ var sessionAnswer = /* @__PURE__ */ __name(({ current, client, device, location,
|
|
|
18027
18031
|
...createdAt === void 0 ? {} : { created_at: createdAt }
|
|
18028
18032
|
}), "sessionAnswer");
|
|
18029
18033
|
|
|
18030
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18034
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/ports/messenger.js
|
|
18031
18035
|
var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
|
|
18032
18036
|
get: /* @__PURE__ */ __name((own, key) => {
|
|
18033
18037
|
if (key in own)
|
|
@@ -18044,7 +18048,7 @@ var capability = /* @__PURE__ */ __name((adapter, method, what) => {
|
|
|
18044
18048
|
return found.bind(adapter);
|
|
18045
18049
|
}, "capability");
|
|
18046
18050
|
|
|
18047
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18051
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
|
|
18048
18052
|
var TAKES = {
|
|
18049
18053
|
chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
|
|
18050
18054
|
message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
|
|
@@ -18104,7 +18108,7 @@ var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn)
|
|
|
18104
18108
|
throw wrongAccount(reference, scope, profiles);
|
|
18105
18109
|
}, "ensureAccount");
|
|
18106
18110
|
|
|
18107
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18111
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/resolve.js
|
|
18108
18112
|
var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
|
|
18109
18113
|
var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase(), "foldName");
|
|
18110
18114
|
var pickChat = /* @__PURE__ */ __name((reference, chats) => {
|
|
@@ -18149,7 +18153,7 @@ ${lines3}`, { candidates });
|
|
|
18149
18153
|
}, "ambiguous");
|
|
18150
18154
|
var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
|
|
18151
18155
|
|
|
18152
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18156
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/deps.js
|
|
18153
18157
|
var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
|
|
18154
18158
|
var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
|
|
18155
18159
|
var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
|
|
@@ -18162,11 +18166,11 @@ var storeAbsent = /* @__PURE__ */ __name((error) => {
|
|
|
18162
18166
|
return error instanceof Error && typeof code === "number" && (code & 255) === SQLITE_BUSY;
|
|
18163
18167
|
}, "storeAbsent");
|
|
18164
18168
|
var accountUnknown = /* @__PURE__ */ __name((error) => isCliFailure(error) && (error.code === "not_found" || error.code === "authentication_error"), "accountUnknown");
|
|
18165
|
-
var unless = /* @__PURE__ */ __name(async (work,
|
|
18169
|
+
var unless = /* @__PURE__ */ __name(async (work, expected2) => {
|
|
18166
18170
|
try {
|
|
18167
18171
|
return await work();
|
|
18168
18172
|
} catch (error) {
|
|
18169
|
-
if (
|
|
18173
|
+
if (expected2(error))
|
|
18170
18174
|
return void 0;
|
|
18171
18175
|
throw error;
|
|
18172
18176
|
}
|
|
@@ -18213,7 +18217,7 @@ var storedDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({
|
|
|
18213
18217
|
}), "storedDeps");
|
|
18214
18218
|
var storeModeDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({ ...storedDeps(messenger, store, account, guard), offline: false, reads: "store" }), "storeModeDeps");
|
|
18215
18219
|
|
|
18216
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18220
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/patience.js
|
|
18217
18221
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
18218
18222
|
var LONGEST_WAIT_MS = 5 * 60 * 1e3;
|
|
18219
18223
|
var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
|
|
@@ -18236,10 +18240,10 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
|
|
|
18236
18240
|
}
|
|
18237
18241
|
}, "patiently");
|
|
18238
18242
|
|
|
18239
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18243
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/archive.js
|
|
18240
18244
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
18241
18245
|
|
|
18242
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18246
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
|
|
18243
18247
|
var REQUEST_MS = 400;
|
|
18244
18248
|
var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
|
|
18245
18249
|
const lowest = ranges[0];
|
|
@@ -18262,13 +18266,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
|
|
|
18262
18266
|
};
|
|
18263
18267
|
}, "estimateBackfill");
|
|
18264
18268
|
|
|
18265
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18269
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/recovery.js
|
|
18266
18270
|
var withRecovery = /* @__PURE__ */ __name((error) => ({
|
|
18267
18271
|
...error,
|
|
18268
18272
|
retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
|
|
18269
18273
|
}), "withRecovery");
|
|
18270
18274
|
|
|
18271
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18275
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/batch.js
|
|
18272
18276
|
var actionable = /* @__PURE__ */ __name((error) => {
|
|
18273
18277
|
if (isCliFailure(error))
|
|
18274
18278
|
return withRecovery({ code: error.code, message: error.message, ...error.details });
|
|
@@ -18351,7 +18355,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
|
|
|
18351
18355
|
};
|
|
18352
18356
|
}, "mergeBatches");
|
|
18353
18357
|
|
|
18354
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18358
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
|
|
18355
18359
|
var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account) => {
|
|
18356
18360
|
if (deps.reads !== "store")
|
|
18357
18361
|
return keptChatId(deps.messenger, reference, store, account);
|
|
@@ -18369,11 +18373,11 @@ var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account)
|
|
|
18369
18373
|
}, "readChatId");
|
|
18370
18374
|
var LEFT_EMPTY = "you left this chat, and the store holds none of its messages";
|
|
18371
18375
|
var storedChatId = /* @__PURE__ */ __name((messenger, reference, store, account, { includeLeft = false } = {}) => {
|
|
18372
|
-
const
|
|
18376
|
+
const renamed2 = /* @__PURE__ */ __name((id2) => store.chats.renamedChatId(account, id2), "renamed");
|
|
18373
18377
|
const profilesOn = profilesOnAccount(store, messenger.app?.command, account.provider);
|
|
18374
18378
|
const among = chatIdAmong(messenger, reference, account, {
|
|
18375
18379
|
held: /* @__PURE__ */ __name(() => store.chats.chats(account, {}), "held"),
|
|
18376
|
-
renamed,
|
|
18380
|
+
renamed: renamed2,
|
|
18377
18381
|
left: /* @__PURE__ */ __name(async (id2) => leftIn(await store.chats.chats(account, byId(id2))), "left"),
|
|
18378
18382
|
profilesOn
|
|
18379
18383
|
});
|
|
@@ -18384,17 +18388,17 @@ var storedChatId = /* @__PURE__ */ __name((messenger, reference, store, account,
|
|
|
18384
18388
|
throw error;
|
|
18385
18389
|
return chatIdAmong(messenger, reference, account, {
|
|
18386
18390
|
held: /* @__PURE__ */ __name(() => store.chats.chats(account, { includeLeft: true }), "held"),
|
|
18387
|
-
renamed,
|
|
18391
|
+
renamed: renamed2,
|
|
18388
18392
|
profilesOn
|
|
18389
18393
|
});
|
|
18390
18394
|
});
|
|
18391
18395
|
}, "storedChatId");
|
|
18392
18396
|
var keptChatId = /* @__PURE__ */ __name((messenger, reference, store, account) => storedChatId(messenger, reference, store, account, { includeLeft: true }), "keptChatId");
|
|
18393
18397
|
var chatIdIn = /* @__PURE__ */ __name((messenger, reference, store, { includeLeft = false } = {}) => {
|
|
18394
|
-
const
|
|
18398
|
+
const renamed2 = /* @__PURE__ */ __name((id2) => store.chats.renamedChatId(id2), "renamed");
|
|
18395
18399
|
const among = chatIdAmong(messenger, reference, store.account, {
|
|
18396
18400
|
held: /* @__PURE__ */ __name(() => store.chats.chats({}), "held"),
|
|
18397
|
-
renamed,
|
|
18401
|
+
renamed: renamed2,
|
|
18398
18402
|
left: /* @__PURE__ */ __name(async (id2) => leftIn(await store.chats.chats(byId(id2))), "left")
|
|
18399
18403
|
});
|
|
18400
18404
|
if (!includeLeft)
|
|
@@ -18404,7 +18408,7 @@ var chatIdIn = /* @__PURE__ */ __name((messenger, reference, store, { includeLef
|
|
|
18404
18408
|
throw error;
|
|
18405
18409
|
return chatIdAmong(messenger, reference, store.account, {
|
|
18406
18410
|
held: /* @__PURE__ */ __name(() => store.chats.chats({ includeLeft: true }), "held"),
|
|
18407
|
-
renamed
|
|
18411
|
+
renamed: renamed2
|
|
18408
18412
|
});
|
|
18409
18413
|
});
|
|
18410
18414
|
}, "chatIdIn");
|
|
@@ -18419,7 +18423,7 @@ var profilesOnAccount = /* @__PURE__ */ __name((store, app, provider) => async (
|
|
|
18419
18423
|
return void 0;
|
|
18420
18424
|
return Object.entries((await store.accounts.profiles())[app] ?? {}).filter(([, key]) => key.provider === provider && key.account === account).map(([name]) => name);
|
|
18421
18425
|
}, "profilesOnAccount");
|
|
18422
|
-
var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, { held, renamed, left, profilesOn }) => {
|
|
18426
|
+
var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, { held, renamed: renamed2, left, profilesOn }) => {
|
|
18423
18427
|
const trimmed = reference.trim();
|
|
18424
18428
|
if (messenger.savedChatId && ["me", "self", "saved"].includes(trimmed.toLowerCase())) {
|
|
18425
18429
|
return messenger.savedChatId(account);
|
|
@@ -18429,7 +18433,7 @@ var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, {
|
|
|
18429
18433
|
await ensureAccount(named2, { account: account.account }, profilesOn);
|
|
18430
18434
|
if (named2 || /^-?\d+$/.test(trimmed)) {
|
|
18431
18435
|
const typed = named2?.chat ?? trimmed;
|
|
18432
|
-
const id2 = await
|
|
18436
|
+
const id2 = await renamed2(typed) ?? typed;
|
|
18433
18437
|
if (await left?.(id2))
|
|
18434
18438
|
throw new CliError("not_found", `you left chat ${id2}`);
|
|
18435
18439
|
return id2;
|
|
@@ -18438,7 +18442,7 @@ var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, {
|
|
|
18438
18442
|
const exact = chats.find((one) => one.id === trimmed);
|
|
18439
18443
|
if (exact)
|
|
18440
18444
|
return exact.id;
|
|
18441
|
-
const moved = await
|
|
18445
|
+
const moved = await renamed2(trimmed);
|
|
18442
18446
|
if (moved !== void 0 && chats.some((one) => one.id === moved))
|
|
18443
18447
|
return moved;
|
|
18444
18448
|
if (trimmed.startsWith("@")) {
|
|
@@ -18510,7 +18514,7 @@ var senderAmong = /* @__PURE__ */ __name(async (store, accounts, reference) => {
|
|
|
18510
18514
|
}
|
|
18511
18515
|
}, "senderAmong");
|
|
18512
18516
|
|
|
18513
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18517
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/images/context/index.js
|
|
18514
18518
|
var CONTEXT_MESSAGES = 3;
|
|
18515
18519
|
var CONTEXT_MINUTES = 10;
|
|
18516
18520
|
var MAX_CHARS = 1200;
|
|
@@ -18534,12 +18538,12 @@ var context = {
|
|
|
18534
18538
|
}, "describe")
|
|
18535
18539
|
};
|
|
18536
18540
|
|
|
18537
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18541
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/images/registry.js
|
|
18538
18542
|
var BUILT_INS = [context];
|
|
18539
18543
|
var providers = [...BUILT_INS];
|
|
18540
18544
|
var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
|
|
18541
18545
|
|
|
18542
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18546
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/conversations.js
|
|
18543
18547
|
var READ_PAGE = 5e3;
|
|
18544
18548
|
var CHAIN = 50;
|
|
18545
18549
|
var CONVERSATION_QUERY = {
|
|
@@ -18691,7 +18695,7 @@ var sized = /* @__PURE__ */ __name((size2) => {
|
|
|
18691
18695
|
return size2;
|
|
18692
18696
|
}, "sized");
|
|
18693
18697
|
|
|
18694
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18698
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
|
|
18695
18699
|
var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
|
|
18696
18700
|
var MESSAGE_PAGE = 5e3;
|
|
18697
18701
|
var PER_SESSION = 8;
|
|
@@ -18710,7 +18714,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
|
|
|
18710
18714
|
price: remote.price,
|
|
18711
18715
|
installed: true,
|
|
18712
18716
|
perBatch: PER_REQUEST * concurrency,
|
|
18713
|
-
open: /* @__PURE__ */ __name(async () => (await import("./remote-
|
|
18717
|
+
open: /* @__PURE__ */ __name(async () => (await import("./remote-4XTBZVZD.js")).openRemote(remote, apiKey, { concurrency }), "open")
|
|
18714
18718
|
};
|
|
18715
18719
|
}
|
|
18716
18720
|
const model = textModel(choice);
|
|
@@ -18727,7 +18731,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
|
|
|
18727
18731
|
if (!isTextModelInstalled(model, directory2))
|
|
18728
18732
|
throw notDownloaded(model.id);
|
|
18729
18733
|
if (apart) {
|
|
18730
|
-
const { openProcess } = await import("./process-
|
|
18734
|
+
const { openProcess } = await import("./process-3CVLTCTA.js");
|
|
18731
18735
|
return openProcess(model, directory2, { threads: threads ?? defaultThreads() });
|
|
18732
18736
|
}
|
|
18733
18737
|
return openEmbedder(model, directory2, { threads: threads ?? defaultThreads() });
|
|
@@ -19016,7 +19020,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
|
|
|
19016
19020
|
return { ...one, state };
|
|
19017
19021
|
}, "shaped");
|
|
19018
19022
|
|
|
19019
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19023
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
|
|
19020
19024
|
var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
|
|
19021
19025
|
var validateCatchUpBounds = /* @__PURE__ */ __name((options) => {
|
|
19022
19026
|
for (const [key, value, maximum] of [
|
|
@@ -19069,7 +19073,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options, signal, c
|
|
|
19069
19073
|
}
|
|
19070
19074
|
}, "catchUpSearch");
|
|
19071
19075
|
|
|
19072
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19076
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/archive.js
|
|
19073
19077
|
var pushed = /* @__PURE__ */ __name((deps, what) => {
|
|
19074
19078
|
if (deps.reads === "store") {
|
|
19075
19079
|
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`);
|
|
@@ -19435,7 +19439,7 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account, chatId, key, byTim
|
|
|
19435
19439
|
return message?.timestamp ?? fallback;
|
|
19436
19440
|
}, "timeOfKey");
|
|
19437
19441
|
|
|
19438
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19442
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/questions.js
|
|
19439
19443
|
var LINKS = /https?:\/\/\S+/g;
|
|
19440
19444
|
var unanswered = /* @__PURE__ */ __name((messages, { answerers: answerers2, before: before2 }) => questions(messages, { answerers: answerers2 }).filter(({ question, answer }) => answer === void 0 && Date.parse(question.timestamp) < before2).map(({ question }) => question), "unanswered");
|
|
19441
19445
|
var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker = "others" }) => {
|
|
@@ -19465,7 +19469,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker
|
|
|
19465
19469
|
});
|
|
19466
19470
|
}, "questions");
|
|
19467
19471
|
|
|
19468
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19472
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/task-categories.js
|
|
19469
19473
|
var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
|
|
19470
19474
|
var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
|
|
19471
19475
|
const name = typed.trim().toLowerCase();
|
|
@@ -19499,7 +19503,7 @@ var hitsByList = /* @__PURE__ */ __name((text2, categories) => {
|
|
|
19499
19503
|
const stem = stemmersOf();
|
|
19500
19504
|
const english = stem.english.stemTokens(text2);
|
|
19501
19505
|
const spanish = readsSpanish(text2) ? stem.spanish.stemTokens(text2) : [];
|
|
19502
|
-
const
|
|
19506
|
+
const counted2 = [];
|
|
19503
19507
|
for (const triggers of triggerStems(categories)) {
|
|
19504
19508
|
const hit = /* @__PURE__ */ new Set();
|
|
19505
19509
|
english.forEach((word, at) => {
|
|
@@ -19509,20 +19513,20 @@ var hitsByList = /* @__PURE__ */ __name((text2, categories) => {
|
|
|
19509
19513
|
else if (other !== void 0 && triggers.spanish.has(other))
|
|
19510
19514
|
hit.add(other);
|
|
19511
19515
|
});
|
|
19512
|
-
|
|
19516
|
+
counted2.push({ name: triggers.name, hits: hit.size });
|
|
19513
19517
|
}
|
|
19514
|
-
return
|
|
19518
|
+
return counted2;
|
|
19515
19519
|
}, "hitsByList");
|
|
19516
19520
|
var listsHit = /* @__PURE__ */ __name((text2, categories) => hitsByList(text2, categories).filter(({ hits }) => hits > 0).map(({ name }) => name), "listsHit");
|
|
19517
19521
|
var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGORIES) => {
|
|
19518
19522
|
let best = { name: FALLBACK_CATEGORY, hits: 0 };
|
|
19519
|
-
for (const
|
|
19520
|
-
if (
|
|
19521
|
-
best =
|
|
19523
|
+
for (const counted2 of hitsByList(text2, categories))
|
|
19524
|
+
if (counted2.hits > best.hits)
|
|
19525
|
+
best = counted2;
|
|
19522
19526
|
return best.name;
|
|
19523
19527
|
}, "categorize");
|
|
19524
19528
|
|
|
19525
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19529
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/task-rules.js
|
|
19526
19530
|
var taskAccount = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "taskAccount");
|
|
19527
19531
|
var RULES_IN = {
|
|
19528
19532
|
dialog: "all",
|
|
@@ -19728,7 +19732,7 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account, chatId
|
|
|
19728
19732
|
return passes;
|
|
19729
19733
|
}, "applyTaskRulesToChats");
|
|
19730
19734
|
|
|
19731
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19735
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/moment.js
|
|
19732
19736
|
var AGO = /^(\d+)(m|h|d)$/;
|
|
19733
19737
|
var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
|
|
19734
19738
|
var DATE = /^\d{4}-\d{2}-\d{2}/;
|
|
@@ -19768,7 +19772,7 @@ var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Dat
|
|
|
19768
19772
|
};
|
|
19769
19773
|
}, "dateWindow");
|
|
19770
19774
|
|
|
19771
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19775
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/botcheck/check.js
|
|
19772
19776
|
var DAY_MS = 864e5;
|
|
19773
19777
|
var NEW_DAYS = 30;
|
|
19774
19778
|
var SAME_TEXT_MIN = 20;
|
|
@@ -19845,7 +19849,23 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
|
|
|
19845
19849
|
};
|
|
19846
19850
|
}, "scorePerson");
|
|
19847
19851
|
|
|
19848
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19852
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/http/time-limit.js
|
|
19853
|
+
var timeLimit = /* @__PURE__ */ __name((ms) => {
|
|
19854
|
+
const controller = new AbortController();
|
|
19855
|
+
const timer = setTimeout(() => controller.abort(new DOMException("The operation timed out.", "TimeoutError")), ms);
|
|
19856
|
+
timer.unref();
|
|
19857
|
+
return { signal: controller.signal, clear: /* @__PURE__ */ __name(() => clearTimeout(timer), "clear") };
|
|
19858
|
+
}, "timeLimit");
|
|
19859
|
+
var withTimeLimit = /* @__PURE__ */ __name(async (ms, run) => {
|
|
19860
|
+
const limit = timeLimit(ms);
|
|
19861
|
+
try {
|
|
19862
|
+
return await run(limit.signal);
|
|
19863
|
+
} finally {
|
|
19864
|
+
limit.clear();
|
|
19865
|
+
}
|
|
19866
|
+
}, "withTimeLimit");
|
|
19867
|
+
|
|
19868
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
|
|
19849
19869
|
var REGISTRIES = {
|
|
19850
19870
|
cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
|
|
19851
19871
|
lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
|
|
@@ -19854,16 +19874,18 @@ var TIMEOUT_MS = 1e4;
|
|
|
19854
19874
|
var askRegistries = /* @__PURE__ */ __name(async (id2, options = {}) => Promise.all([askCas(id2, options), askLols(id2, options)]), "askRegistries");
|
|
19855
19875
|
var getJson = /* @__PURE__ */ __name(async (url, headers, { fetch: fetchFn = fetch, timeoutMs = TIMEOUT_MS }) => {
|
|
19856
19876
|
try {
|
|
19857
|
-
const
|
|
19858
|
-
|
|
19859
|
-
|
|
19860
|
-
|
|
19877
|
+
const { status, text: text2 } = await withTimeLimit(timeoutMs, async (signal) => {
|
|
19878
|
+
const response = await fetchFn(url, {
|
|
19879
|
+
headers: { accept: "application/json", ...headers },
|
|
19880
|
+
signal,
|
|
19881
|
+
redirect: "error"
|
|
19882
|
+
});
|
|
19883
|
+
return { status: response.status, text: await response.text() };
|
|
19861
19884
|
});
|
|
19862
|
-
const text2 = await response.text();
|
|
19863
19885
|
try {
|
|
19864
|
-
return { status
|
|
19886
|
+
return { status, body: JSON.parse(text2) };
|
|
19865
19887
|
} catch {
|
|
19866
|
-
return { failed: `answered ${
|
|
19888
|
+
return { failed: `answered ${status} with something that is not JSON` };
|
|
19867
19889
|
}
|
|
19868
19890
|
} catch (error) {
|
|
19869
19891
|
return {
|
|
@@ -19930,7 +19952,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
|
|
|
19930
19952
|
detail: `lists Telegram accounts only, not ${messenger} ones`
|
|
19931
19953
|
})), "notCovered");
|
|
19932
19954
|
|
|
19933
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19955
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/botcheck/service.js
|
|
19934
19956
|
var ACTIVITY_MESSAGES = 1e3;
|
|
19935
19957
|
var botCheckService = /* @__PURE__ */ __name((deps) => {
|
|
19936
19958
|
const subjectOf = /* @__PURE__ */ __name(async (reference) => {
|
|
@@ -20018,7 +20040,7 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
|
|
|
20018
20040
|
};
|
|
20019
20041
|
}, "botCheckService");
|
|
20020
20042
|
|
|
20021
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20043
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/thread.js
|
|
20022
20044
|
var threadIdOf = /* @__PURE__ */ __name((value) => {
|
|
20023
20045
|
if (value === void 0)
|
|
20024
20046
|
return void 0;
|
|
@@ -20028,7 +20050,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
|
|
|
20028
20050
|
return id2;
|
|
20029
20051
|
}, "threadIdOf");
|
|
20030
20052
|
|
|
20031
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20053
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
|
|
20032
20054
|
var TOP_POSTS = 5;
|
|
20033
20055
|
var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
|
|
20034
20056
|
var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
|
|
@@ -20145,7 +20167,7 @@ var median = /* @__PURE__ */ __name((values) => {
|
|
|
20145
20167
|
return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
|
|
20146
20168
|
}, "median");
|
|
20147
20169
|
|
|
20148
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20170
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/member-history.js
|
|
20149
20171
|
var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
|
|
20150
20172
|
const events = [];
|
|
20151
20173
|
for (const stay of stays) {
|
|
@@ -20177,7 +20199,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
|
|
|
20177
20199
|
return events.filter(({ at }) => Date.parse(at) >= since).sort((a, b) => Date.parse(a.at) - Date.parse(b.at) || a.id.localeCompare(b.id));
|
|
20178
20200
|
}, "memberEvents");
|
|
20179
20201
|
|
|
20180
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20202
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/chats.js
|
|
20181
20203
|
var EVENTS_DAYS = 7;
|
|
20182
20204
|
var TRACKED_DAYS = 30;
|
|
20183
20205
|
var STATS_PAGE = 1e3;
|
|
@@ -20195,18 +20217,18 @@ var storedEvents = /* @__PURE__ */ __name(async (store, deps, chat, since) => {
|
|
|
20195
20217
|
var deepChecks = /* @__PURE__ */ __name(async (deps, items, deep, pauseMs, registry) => {
|
|
20196
20218
|
const checks = botCheckService(deps);
|
|
20197
20219
|
const checked2 = [];
|
|
20198
|
-
for (const [index,
|
|
20220
|
+
for (const [index, item2] of items.entries()) {
|
|
20199
20221
|
if (index >= deep) {
|
|
20200
|
-
checked2.push(
|
|
20222
|
+
checked2.push(item2);
|
|
20201
20223
|
continue;
|
|
20202
20224
|
}
|
|
20203
20225
|
if (index > 0)
|
|
20204
20226
|
await new Promise((resolve7) => setTimeout(resolve7, pauseMs));
|
|
20205
|
-
const { score, reasons, registries, unknown: unknown3 } = await checks.person(
|
|
20227
|
+
const { score, reasons, registries, unknown: unknown3 } = await checks.person(item2.id, {
|
|
20206
20228
|
registries: true,
|
|
20207
20229
|
...registry ? { registry } : {}
|
|
20208
20230
|
});
|
|
20209
|
-
checked2.push({ ...
|
|
20231
|
+
checked2.push({ ...item2, check: { score, reasons, registries, unknown: unknown3 } });
|
|
20210
20232
|
}
|
|
20211
20233
|
return checked2;
|
|
20212
20234
|
}, "deepChecks");
|
|
@@ -20295,8 +20317,8 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
20295
20317
|
});
|
|
20296
20318
|
const counts = await store.roster.memberCounts(chatId, { since: new Date(from).toISOString().slice(0, 10) });
|
|
20297
20319
|
const known2 = unrecorded ? { ...stats, complete: false, membersUnrecorded: true } : stats;
|
|
20298
|
-
const
|
|
20299
|
-
return completeness.state === "complete" || !syncsOneChat(deps.messenger) ?
|
|
20320
|
+
const counted2 = counts.length > 0 ? { ...known2, memberCounts: counts } : known2;
|
|
20321
|
+
return completeness.state === "complete" || !syncsOneChat(deps.messenger) ? counted2 : { ...counted2, fetch: typedCommand(deps.messenger.app.command, `messages sync ${chatId}`) };
|
|
20300
20322
|
}, "stats"),
|
|
20301
20323
|
sendAs: /* @__PURE__ */ __name(async (chat) => {
|
|
20302
20324
|
if (deps.offline) {
|
|
@@ -20472,7 +20494,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
|
|
|
20472
20494
|
return members.length === 0 ? null : members;
|
|
20473
20495
|
}, "storedMembers");
|
|
20474
20496
|
|
|
20475
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20497
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/inbox.js
|
|
20476
20498
|
var INBOX_CHATS = 20;
|
|
20477
20499
|
var REVIEW_DAYS = 3;
|
|
20478
20500
|
var UNANSWERED_HOURS = 24;
|
|
@@ -20680,7 +20702,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
|
|
|
20680
20702
|
};
|
|
20681
20703
|
}, "inboxService");
|
|
20682
20704
|
|
|
20683
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20705
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/formatting.js
|
|
20684
20706
|
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "the messenger formatter returned invalid text spans"), "invalid");
|
|
20685
20707
|
var validateFormattedText = /* @__PURE__ */ __name((formatted2) => {
|
|
20686
20708
|
const { text: text2, spans } = formatted2;
|
|
@@ -20740,7 +20762,7 @@ var visibleFormattedText = /* @__PURE__ */ __name((formatted2) => {
|
|
|
20740
20762
|
};
|
|
20741
20763
|
}, "visibleFormattedText");
|
|
20742
20764
|
|
|
20743
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20765
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/moderation/check.js
|
|
20744
20766
|
var INVITE = /max\.ru\/join\/|(t|telegram)\.me\/(\+|joinchat\/)|tg:\/\/join/i;
|
|
20745
20767
|
var LINK2 = /https?:\/\/\S+/i;
|
|
20746
20768
|
var STRENGTH = { report: 0, delete: 1, remove: 2 };
|
|
@@ -20928,7 +20950,7 @@ var nextPoint = /* @__PURE__ */ __name((rows, found) => {
|
|
|
20928
20950
|
}, "nextPoint");
|
|
20929
20951
|
var someUndone = /* @__PURE__ */ __name((rows) => rows.some(undone), "someUndone");
|
|
20930
20952
|
|
|
20931
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20953
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/moderation/rules.js
|
|
20932
20954
|
import { existsSync, readFileSync } from "node:fs";
|
|
20933
20955
|
import { join } from "node:path";
|
|
20934
20956
|
var RULE_ACTIONS = ["report", "delete", "remove"];
|
|
@@ -20978,7 +21000,7 @@ var defaultRules = /* @__PURE__ */ __name((title) => ({
|
|
|
20978
21000
|
newAccount: { days: 7, action: "report" },
|
|
20979
21001
|
consent: { delete: "ask", remove: "ask" }
|
|
20980
21002
|
}), "defaultRules");
|
|
20981
|
-
var list = /* @__PURE__ */ __name((value) => value.split(",").map((
|
|
21003
|
+
var list = /* @__PURE__ */ __name((value) => value.split(",").map((item2) => item2.trim()).filter(Boolean), "list");
|
|
20982
21004
|
var whole = /* @__PURE__ */ __name((value) => /^\d+$/.test(value.trim()) ? Number(value) : Number.NaN, "whole");
|
|
20983
21005
|
var KEYS = {
|
|
20984
21006
|
trusted: { help: "person ids, comma-separated; never acted on", parse: list },
|
|
@@ -21071,7 +21093,7 @@ var assign = /* @__PURE__ */ __name((rules, key, value) => {
|
|
|
21071
21093
|
return { ...rules, [head]: { ...rules[head], [tail]: value } };
|
|
21072
21094
|
}, "assign");
|
|
21073
21095
|
|
|
21074
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21096
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/person-context.js
|
|
21075
21097
|
var CONTEXT_MESSAGES2 = 10;
|
|
21076
21098
|
var CONTEXT_BYTES = 64 * 1024;
|
|
21077
21099
|
var toContext = /* @__PURE__ */ __name((key, message, chatTitle2) => ({
|
|
@@ -21256,8 +21278,8 @@ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, { messa
|
|
|
21256
21278
|
var withinBytes = /* @__PURE__ */ __name((lists, bytes2) => {
|
|
21257
21279
|
let used = 0;
|
|
21258
21280
|
let cut = false;
|
|
21259
|
-
const keep2 = /* @__PURE__ */ __name((items) => items.filter((
|
|
21260
|
-
const size2 = Buffer.byteLength(JSON.stringify(
|
|
21281
|
+
const keep2 = /* @__PURE__ */ __name((items) => items.filter((item2) => {
|
|
21282
|
+
const size2 = Buffer.byteLength(JSON.stringify(item2), "utf8");
|
|
21261
21283
|
if (cut || used + size2 > bytes2) {
|
|
21262
21284
|
cut = true;
|
|
21263
21285
|
return false;
|
|
@@ -21332,10 +21354,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
|
|
|
21332
21354
|
};
|
|
21333
21355
|
}, "personMessages");
|
|
21334
21356
|
|
|
21335
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21357
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
|
|
21336
21358
|
import { createHash } from "node:crypto";
|
|
21337
21359
|
|
|
21338
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21360
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
|
|
21339
21361
|
var missing2 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
|
|
21340
21362
|
var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options = {}) => {
|
|
21341
21363
|
const parsed = parseMeetingReference(reference);
|
|
@@ -21353,7 +21375,7 @@ var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId,
|
|
|
21353
21375
|
return { parsed, meeting };
|
|
21354
21376
|
}, "authorizedMeetingMetadata");
|
|
21355
21377
|
|
|
21356
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21378
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
|
|
21357
21379
|
var hash = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
|
|
21358
21380
|
var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
|
|
21359
21381
|
if (signal?.aborted)
|
|
@@ -21499,16 +21521,16 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
|
|
|
21499
21521
|
hasMore = true;
|
|
21500
21522
|
break;
|
|
21501
21523
|
}
|
|
21502
|
-
const
|
|
21503
|
-
const bytes2 = Buffer.byteLength(JSON.stringify(
|
|
21524
|
+
const item2 = cueEvidence(accountId, meeting.id, page.transcript, row);
|
|
21525
|
+
const bytes2 = Buffer.byteLength(JSON.stringify(item2), "utf8") + (items.length ? 1 : 0);
|
|
21504
21526
|
if (contentBytes + bytes2 > limits.bytes) {
|
|
21505
21527
|
truncatedBy = "bytes";
|
|
21506
21528
|
hasMore = true;
|
|
21507
21529
|
break;
|
|
21508
21530
|
}
|
|
21509
|
-
items.push(
|
|
21531
|
+
items.push(item2);
|
|
21510
21532
|
contentBytes += bytes2;
|
|
21511
|
-
nextReference =
|
|
21533
|
+
nextReference = item2.reference;
|
|
21512
21534
|
afterPosition = row.position;
|
|
21513
21535
|
}
|
|
21514
21536
|
if (truncatedBy !== null || parsed.cuePosition !== void 0 || !page.hasMore)
|
|
@@ -21552,7 +21574,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
|
|
|
21552
21574
|
return { ...packet, fingerprint: hash(packet) };
|
|
21553
21575
|
}, "readMeetingEvidence");
|
|
21554
21576
|
|
|
21555
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21577
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
|
|
21556
21578
|
var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options) => {
|
|
21557
21579
|
const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options;
|
|
21558
21580
|
const requestedAccounts = options.accountIds;
|
|
@@ -21616,7 +21638,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
21616
21638
|
}
|
|
21617
21639
|
throw error;
|
|
21618
21640
|
}
|
|
21619
|
-
const
|
|
21641
|
+
const item2 = {
|
|
21620
21642
|
reference,
|
|
21621
21643
|
cues: evidence.items,
|
|
21622
21644
|
cueCoverage: {
|
|
@@ -21625,12 +21647,12 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
21625
21647
|
hasMore: evidence.coverage.hasMore
|
|
21626
21648
|
}
|
|
21627
21649
|
};
|
|
21628
|
-
const itemBytes = Buffer.byteLength(JSON.stringify(
|
|
21650
|
+
const itemBytes = Buffer.byteLength(JSON.stringify(item2), "utf8") + (items.length ? 1 : 0);
|
|
21629
21651
|
if (contentBytes + itemBytes > bytes2) {
|
|
21630
21652
|
truncatedBy = "bytes";
|
|
21631
21653
|
break;
|
|
21632
21654
|
}
|
|
21633
|
-
items.push(
|
|
21655
|
+
items.push(item2);
|
|
21634
21656
|
contentBytes += itemBytes;
|
|
21635
21657
|
}
|
|
21636
21658
|
checkMeetingCancelled(signal);
|
|
@@ -21651,7 +21673,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
21651
21673
|
};
|
|
21652
21674
|
}, "personMeetingContext");
|
|
21653
21675
|
|
|
21654
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21676
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
|
|
21655
21677
|
var PREPARE_BYTES = 96 * 1024;
|
|
21656
21678
|
var MEETINGS = 5;
|
|
21657
21679
|
var CUES = 3;
|
|
@@ -21664,14 +21686,14 @@ var personPreparation = /* @__PURE__ */ __name(async (store, asked, reference, o
|
|
|
21664
21686
|
const budgeted = /* @__PURE__ */ __name((page) => {
|
|
21665
21687
|
const items = [];
|
|
21666
21688
|
let cut = false;
|
|
21667
|
-
for (const
|
|
21668
|
-
const bytes2 = size(
|
|
21689
|
+
for (const item2 of page.items.slice(0, limit)) {
|
|
21690
|
+
const bytes2 = size(item2);
|
|
21669
21691
|
if (cut || bytes2 > left) {
|
|
21670
21692
|
cut = true;
|
|
21671
21693
|
continue;
|
|
21672
21694
|
}
|
|
21673
21695
|
left -= bytes2;
|
|
21674
|
-
items.push(
|
|
21696
|
+
items.push(item2);
|
|
21675
21697
|
}
|
|
21676
21698
|
const over = page.hasMore || page.items.length > limit;
|
|
21677
21699
|
return {
|
|
@@ -21754,7 +21776,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
|
|
|
21754
21776
|
bytes: Math.min(left(), 4 * 1024 * 1024),
|
|
21755
21777
|
...since === void 0 ? {} : { since }
|
|
21756
21778
|
});
|
|
21757
|
-
const read = new Set(found.items.map((
|
|
21779
|
+
const read = new Set(found.items.map((item2) => parseMeetingReference(item2.reference).accountId));
|
|
21758
21780
|
return {
|
|
21759
21781
|
items: found.items,
|
|
21760
21782
|
hasMore: found.coverage.truncatedBy !== null || found.coverage.scanLimitReached,
|
|
@@ -21768,7 +21790,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
|
|
|
21768
21790
|
}
|
|
21769
21791
|
}, "meetingsOf");
|
|
21770
21792
|
|
|
21771
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21793
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/person-profile.js
|
|
21772
21794
|
var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
|
|
21773
21795
|
const online = deps.offline ? void 0 : await deps.connection();
|
|
21774
21796
|
const held = await storeIfOpen(deps);
|
|
@@ -21838,7 +21860,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
|
|
|
21838
21860
|
complete: false
|
|
21839
21861
|
})), "quiet");
|
|
21840
21862
|
|
|
21841
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21863
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
|
|
21842
21864
|
var TIMELINE_ITEMS = 50;
|
|
21843
21865
|
var TIMELINE_MAX = 500;
|
|
21844
21866
|
var SCOPES = ["personal", "work"];
|
|
@@ -21893,7 +21915,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
|
|
|
21893
21915
|
};
|
|
21894
21916
|
}, "personTimeline");
|
|
21895
21917
|
|
|
21896
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21918
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/people.js
|
|
21897
21919
|
var peopleService = /* @__PURE__ */ __name((deps) => {
|
|
21898
21920
|
const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
|
|
21899
21921
|
const held = await storeIfOpen(deps);
|
|
@@ -22120,7 +22142,110 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
|
|
|
22120
22142
|
return rest;
|
|
22121
22143
|
}, "withoutPhone");
|
|
22122
22144
|
|
|
22123
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22145
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/task-stats.js
|
|
22146
|
+
var TASK_STATS_BY = ["chat", "meeting", "project"];
|
|
22147
|
+
var PERIOD_FIELD = "created";
|
|
22148
|
+
var refuseNestedPeriod = /* @__PURE__ */ __name((node, top = true) => {
|
|
22149
|
+
if (node.kind === "predicate")
|
|
22150
|
+
return;
|
|
22151
|
+
const optional2 = node.clauses.some(({ occur }) => occur === "should");
|
|
22152
|
+
for (const { occur, node: inner } of node.clauses) {
|
|
22153
|
+
if (!walkQuery(inner).some(({ field }) => field === PERIOD_FIELD))
|
|
22154
|
+
continue;
|
|
22155
|
+
if (!top || optional2 || occur !== "must")
|
|
22156
|
+
throw new CliError("validation_error", `${PERIOD_FIELD}: sets the period of stats tasks show: give it as a required term, not inside OR or NOT`);
|
|
22157
|
+
refuseNestedPeriod(inner, top);
|
|
22158
|
+
}
|
|
22159
|
+
}, "refuseNestedPeriod");
|
|
22160
|
+
var renamed = /* @__PURE__ */ __name((node, from, to) => node.kind === "predicate" ? node.field === from ? { ...node, field: to } : node : { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: renamed(clause.node, from, to) })) }, "renamed");
|
|
22161
|
+
var median2 = /* @__PURE__ */ __name((values) => {
|
|
22162
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
22163
|
+
const middle = Math.floor(sorted.length / 2);
|
|
22164
|
+
const upper = sorted[middle] ?? 0;
|
|
22165
|
+
return sorted.length % 2 === 1 ? upper : ((sorted[middle - 1] ?? 0) + upper) / 2;
|
|
22166
|
+
}, "median");
|
|
22167
|
+
var mean = /* @__PURE__ */ __name((values) => Math.round(values.reduce((sum2, one) => sum2 + one, 0) / values.length), "mean");
|
|
22168
|
+
var spread = /* @__PURE__ */ __name((open7, closeMs, now) => ({
|
|
22169
|
+
...closeMs.length > 0 ? { medianCloseMs: median2(closeMs) } : {},
|
|
22170
|
+
...open7.length > 0 ? { meanOpenAgeMs: mean(open7.map(({ createdAt }) => now - createdAt)) } : {}
|
|
22171
|
+
}), "spread");
|
|
22172
|
+
var and = /* @__PURE__ */ __name((parts) => parts.length === 0 ? void 0 : { sql: parts.map(({ sql }) => `(${sql})`).join(" AND "), params: parts.flatMap(({ params }) => params) }, "and");
|
|
22173
|
+
var taskStatsOf = /* @__PURE__ */ __name(async (store, account, { by = "chat", query, timezone, group, kind }, columns, now = Date.now()) => {
|
|
22174
|
+
if (query)
|
|
22175
|
+
refuseNestedPeriod(query.root);
|
|
22176
|
+
const time = /* @__PURE__ */ __name((sql) => ({ type: "time", sql }), "time");
|
|
22177
|
+
const read = { ...columns, [PERIOD_FIELD]: time("t.created_at"), closed: time("t.closed_at") };
|
|
22178
|
+
const fixed = [
|
|
22179
|
+
...group === void 0 ? [] : [{ sql: "t.source_group = ?", params: [group] }],
|
|
22180
|
+
...kind === void 0 ? [] : [{ sql: "t.type = ?", params: [kind] }],
|
|
22181
|
+
...by === "meeting" ? [{ sql: "t.source_kind = 'meeting'", params: [] }] : []
|
|
22182
|
+
];
|
|
22183
|
+
const options = { command: "stats tasks show", now, ...timezone === void 0 ? {} : { zone: timezone } };
|
|
22184
|
+
const where = /* @__PURE__ */ __name((ast, more = []) => and([...fixed, ...more, ...ast ? [queryFilter(ast, read, options)] : []]), "where");
|
|
22185
|
+
const scope = by === "project" ? { board: true } : { account: taskAccount(account) };
|
|
22186
|
+
const all = await store.tasks.statRows(scope, where(withoutField(query, PERIOD_FIELD)));
|
|
22187
|
+
const created = await store.tasks.statRows(scope, where(query));
|
|
22188
|
+
const closed = await store.tasks.statRows(scope, where(query && { ...query, root: renamed(query.root, PERIOD_FIELD, "closed") }, [
|
|
22189
|
+
{ sql: "t.closed_at IS NOT NULL", params: [] }
|
|
22190
|
+
]));
|
|
22191
|
+
const keyOf5 = /* @__PURE__ */ __name((row) => by === "project" ? String(row.projectId) : row.group ?? "", "keyOf");
|
|
22192
|
+
const groups = /* @__PURE__ */ new Map();
|
|
22193
|
+
const slot = /* @__PURE__ */ __name((row) => {
|
|
22194
|
+
const key = keyOf5(row);
|
|
22195
|
+
const found = groups.get(key) ?? { open: [], created: 0, closeMs: [] };
|
|
22196
|
+
groups.set(key, found);
|
|
22197
|
+
return found;
|
|
22198
|
+
}, "slot");
|
|
22199
|
+
for (const row of all)
|
|
22200
|
+
if (!isClosedState(row.state))
|
|
22201
|
+
slot(row).open.push(row);
|
|
22202
|
+
for (const row of created)
|
|
22203
|
+
slot(row).created++;
|
|
22204
|
+
for (const row of closed)
|
|
22205
|
+
slot(row).closeMs.push((row.closedAt ?? row.createdAt) - row.createdAt);
|
|
22206
|
+
const kept2 = [...groups].filter(([, one]) => one.open.length + one.created + one.closeMs.length > 0);
|
|
22207
|
+
const ids = kept2.map(([key]) => key);
|
|
22208
|
+
const names2 = by === "chat" ? await store.tasks.statNames("chat", ids, taskAccount(account)) : by === "project" ? await store.tasks.statNames("project", ids) : await meetingNames(store, ids);
|
|
22209
|
+
const rows = kept2.map(([key, one]) => ({
|
|
22210
|
+
group: key,
|
|
22211
|
+
name: names2.get(key) ?? null,
|
|
22212
|
+
open: one.open.length,
|
|
22213
|
+
created: one.created,
|
|
22214
|
+
closed: one.closeMs.length,
|
|
22215
|
+
...one.open[0] ? { oldestOpenAt: new Date(one.open[0].createdAt) } : {},
|
|
22216
|
+
...spread(one.open, one.closeMs, now)
|
|
22217
|
+
}));
|
|
22218
|
+
const open7 = kept2.flatMap(([, one]) => one.open);
|
|
22219
|
+
const closeMs = kept2.flatMap(([, one]) => one.closeMs);
|
|
22220
|
+
return {
|
|
22221
|
+
by,
|
|
22222
|
+
open: open7.length,
|
|
22223
|
+
created: created.length,
|
|
22224
|
+
closed: closeMs.length,
|
|
22225
|
+
...spread(open7, closeMs, now),
|
|
22226
|
+
rows
|
|
22227
|
+
};
|
|
22228
|
+
}, "taskStatsOf");
|
|
22229
|
+
var meetingIdOf = /* @__PURE__ */ __name((group) => {
|
|
22230
|
+
try {
|
|
22231
|
+
return String(parseMeetingReference(group).meetingId);
|
|
22232
|
+
} catch {
|
|
22233
|
+
return void 0;
|
|
22234
|
+
}
|
|
22235
|
+
}, "meetingIdOf");
|
|
22236
|
+
var meetingNames = /* @__PURE__ */ __name(async (store, groups) => {
|
|
22237
|
+
const meetingOf = new Map(groups.flatMap((group) => {
|
|
22238
|
+
const id2 = meetingIdOf(group);
|
|
22239
|
+
return id2 === void 0 ? [] : [[group, id2]];
|
|
22240
|
+
}));
|
|
22241
|
+
const titles = await store.tasks.statNames("meeting", [...new Set(meetingOf.values())]);
|
|
22242
|
+
return new Map([...meetingOf].flatMap(([group, id2]) => {
|
|
22243
|
+
const title = titles.get(id2);
|
|
22244
|
+
return title === void 0 ? [] : [[group, title]];
|
|
22245
|
+
}));
|
|
22246
|
+
}, "meetingNames");
|
|
22247
|
+
|
|
22248
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
|
|
22124
22249
|
var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
|
|
22125
22250
|
const tags = /* @__PURE__ */ new Map();
|
|
22126
22251
|
for (const node of query ? walkQuery(query.root) : [])
|
|
@@ -22129,7 +22254,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
|
|
|
22129
22254
|
return tags;
|
|
22130
22255
|
}, "taskTagFilters");
|
|
22131
22256
|
|
|
22132
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22257
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/tasks.js
|
|
22133
22258
|
var TASK_QUERY = {
|
|
22134
22259
|
entity: "task",
|
|
22135
22260
|
backend: "sql",
|
|
@@ -22160,6 +22285,20 @@ var TASK_QUERY = {
|
|
|
22160
22285
|
}
|
|
22161
22286
|
})
|
|
22162
22287
|
};
|
|
22288
|
+
var TASK_STATS_QUERY = {
|
|
22289
|
+
entity: "task",
|
|
22290
|
+
backend: "sql",
|
|
22291
|
+
fields: [
|
|
22292
|
+
...TASK_QUERY.fields.filter(({ name }) => name !== "created_at" && name !== "closed_at"),
|
|
22293
|
+
{
|
|
22294
|
+
name: PERIOD_FIELD,
|
|
22295
|
+
type: "time",
|
|
22296
|
+
operators: OPERATORS_BY_TYPE.time,
|
|
22297
|
+
example: `${PERIOD_FIELD}>=30d`,
|
|
22298
|
+
relation: "the period: created counts the tasks opened in it, closed the tasks done or dismissed in it; open is open now"
|
|
22299
|
+
}
|
|
22300
|
+
]
|
|
22301
|
+
};
|
|
22163
22302
|
var PAIR_DECISIONS = ["review", "unsure"];
|
|
22164
22303
|
var TASK_PAIR_QUERY = {
|
|
22165
22304
|
entity: "task_pair",
|
|
@@ -22246,6 +22385,13 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
22246
22385
|
const inStore = /* @__PURE__ */ __name(async (work) => work(await deps.store(), await deps.account()), "inStore");
|
|
22247
22386
|
const service = /* @__PURE__ */ __name((store) => createTaskService({ store: store.tasks }), "service");
|
|
22248
22387
|
const groupOf = /* @__PURE__ */ __name(async (store, account, chat) => chat === void 0 ? void 0 : storedChatId(deps.messenger, chat, store, account, { includeLeft: true }), "groupOf");
|
|
22388
|
+
const queryColumns = /* @__PURE__ */ __name(async (store, account, query) => {
|
|
22389
|
+
const groups = /* @__PURE__ */ new Map();
|
|
22390
|
+
for (const node of query ? walkQuery(query.root) : [])
|
|
22391
|
+
if (node.field === "chat" && node.operator !== "wildcard" && !groups.has(node.value))
|
|
22392
|
+
groups.set(node.value, await storedChatId(deps.messenger, node.value, store, account, { includeLeft: true }));
|
|
22393
|
+
return taskColumns(groups, await taskTagFilters(store, query));
|
|
22394
|
+
}, "queryColumns");
|
|
22249
22395
|
const refuseBare = /* @__PURE__ */ __name((target2) => {
|
|
22250
22396
|
throw new CliError("validation_error", `no task ${singleLine(target2)} \u2014 write task:${singleLine(target2)} for a task`);
|
|
22251
22397
|
}, "refuseBare");
|
|
@@ -22300,12 +22446,7 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
22300
22446
|
const reviewAfterLink = /* @__PURE__ */ __name(async (store, id2) => !isClosedState((await store.tasks.get(id2))?.state ?? "done") ? store.tasks.reviewDuplicates(id2, { linked: true }) : 0, "reviewAfterLink");
|
|
22301
22447
|
return {
|
|
22302
22448
|
list: /* @__PURE__ */ __name(({ query, limit, offset, previews }) => inStore(async (store, account) => {
|
|
22303
|
-
const
|
|
22304
|
-
for (const node of query ? walkQuery(query.root) : [])
|
|
22305
|
-
if (node.field === "chat" && node.operator !== "wildcard" && !groups.has(node.value))
|
|
22306
|
-
groups.set(node.value, await storedChatId(deps.messenger, node.value, store, account, { includeLeft: true }));
|
|
22307
|
-
const tags = await taskTagFilters(store, query);
|
|
22308
|
-
const where = query ? queryFilter(query, taskColumns(groups, tags), { command: "tasks list" }) : void 0;
|
|
22449
|
+
const where = query ? queryFilter(query, await queryColumns(store, account, query), { command: "tasks list" }) : void 0;
|
|
22309
22450
|
const rows = await store.tasks.query(taskAccount(account), where, { limit: limit + 1, offset });
|
|
22310
22451
|
const shown = rows.slice(0, limit);
|
|
22311
22452
|
return {
|
|
@@ -22552,13 +22693,9 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
22552
22693
|
await owned(store, account, subject);
|
|
22553
22694
|
return store.tasks.similar({ task: subject }, options);
|
|
22554
22695
|
}), "similar"),
|
|
22555
|
-
stats: /* @__PURE__ */ __name((
|
|
22556
|
-
const group = await groupOf(store, account,
|
|
22557
|
-
|
|
22558
|
-
account: taskAccount(account),
|
|
22559
|
-
...filter.type === void 0 ? {} : { kind: filter.type }
|
|
22560
|
-
});
|
|
22561
|
-
return group === void 0 ? rows : rows.filter((one) => one.group === group);
|
|
22696
|
+
stats: /* @__PURE__ */ __name(({ chat, ...request } = {}) => inStore(async (store, account) => {
|
|
22697
|
+
const group = await groupOf(store, account, chat);
|
|
22698
|
+
return taskStatsOf(store, account, { ...request, ...group === void 0 ? {} : { group } }, await queryColumns(store, account, request.query));
|
|
22562
22699
|
}), "stats")
|
|
22563
22700
|
};
|
|
22564
22701
|
}, "tasksService");
|
|
@@ -22609,7 +22746,74 @@ var taskView = /* @__PURE__ */ __name(async (store, account, task2) => {
|
|
|
22609
22746
|
};
|
|
22610
22747
|
}, "taskView");
|
|
22611
22748
|
|
|
22612
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22749
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/mail/owed.js
|
|
22750
|
+
var mailTurn = /* @__PURE__ */ __name((newest) => {
|
|
22751
|
+
if (newest === null)
|
|
22752
|
+
return null;
|
|
22753
|
+
if (newest.outgoing)
|
|
22754
|
+
return "waiting";
|
|
22755
|
+
return newest.addressed ? "owed" : null;
|
|
22756
|
+
}, "mailTurn");
|
|
22757
|
+
|
|
22758
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/agenda-mail.js
|
|
22759
|
+
var absent = /* @__PURE__ */ __name((error) => {
|
|
22760
|
+
if (error instanceof CliError && error.code === "not_found")
|
|
22761
|
+
return void 0;
|
|
22762
|
+
throw error;
|
|
22763
|
+
}, "absent");
|
|
22764
|
+
var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) => {
|
|
22765
|
+
const stored = await store.accounts.storedAccount(account).catch(absent);
|
|
22766
|
+
if (!stored)
|
|
22767
|
+
return { chats: [], storedAt: null, coverage: /* @__PURE__ */ __name(() => [], "coverage") };
|
|
22768
|
+
const where = chats ? queryFilter(chats, MAIL_AGENDA_COLUMNS, { command: "tasks agenda" }) : void 0;
|
|
22769
|
+
const threads = await store.mail.threadActivity(stored.id, since, where);
|
|
22770
|
+
const synced = await store.sync.syncState(account, "mail_coverage");
|
|
22771
|
+
const window3 = (() => {
|
|
22772
|
+
try {
|
|
22773
|
+
return JSON.parse(synced?.value ?? "{}");
|
|
22774
|
+
} catch {
|
|
22775
|
+
return {};
|
|
22776
|
+
}
|
|
22777
|
+
})();
|
|
22778
|
+
const byId2 = new Map(threads.map((thread) => [thread.threadId, thread]));
|
|
22779
|
+
return {
|
|
22780
|
+
chats: threads.map((thread) => ({
|
|
22781
|
+
chatId: thread.threadId,
|
|
22782
|
+
title: thread.subject,
|
|
22783
|
+
kind: "dialog",
|
|
22784
|
+
lastMessageAt: new Date(thread.newest?.at ?? thread.lastEmailAt).toISOString(),
|
|
22785
|
+
lastMessageId: thread.newest?.externalId ?? null,
|
|
22786
|
+
lastFromOwner: thread.newest ? thread.newest.outgoing : null,
|
|
22787
|
+
turn: mailTurn(thread.newest)
|
|
22788
|
+
})),
|
|
22789
|
+
storedAt: synced?.at ?? null,
|
|
22790
|
+
coverage: /* @__PURE__ */ __name((ids) => ids.map((chatId) => {
|
|
22791
|
+
const thread = byId2.get(chatId);
|
|
22792
|
+
const newest = thread?.newest?.at ?? thread?.lastEmailAt;
|
|
22793
|
+
const until = window3.until === void 0 ? Number.NaN : Date.parse(window3.until);
|
|
22794
|
+
return {
|
|
22795
|
+
chatId,
|
|
22796
|
+
title: thread?.subject ?? null,
|
|
22797
|
+
completeness: {
|
|
22798
|
+
chatId,
|
|
22799
|
+
// Sync holds a window of the mailbox, never a thread's whole history.
|
|
22800
|
+
state: synced ? "partial" : "unknown",
|
|
22801
|
+
upToDate: window3.state === "window" && newest !== void 0 && !Number.isNaN(until) ? newest <= until : null,
|
|
22802
|
+
gaps: false,
|
|
22803
|
+
reachesStart: false,
|
|
22804
|
+
fetchedAt: synced?.at ?? null
|
|
22805
|
+
},
|
|
22806
|
+
held: {
|
|
22807
|
+
messages: thread?.emails ?? 0,
|
|
22808
|
+
oldestAt: null,
|
|
22809
|
+
newestAt: newest === void 0 ? null : new Date(newest).toISOString()
|
|
22810
|
+
}
|
|
22811
|
+
};
|
|
22812
|
+
}), "coverage")
|
|
22813
|
+
};
|
|
22814
|
+
}, "mailActivity");
|
|
22815
|
+
|
|
22816
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
|
|
22613
22817
|
var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
|
|
22614
22818
|
const ids = [...new Set(chatIds)];
|
|
22615
22819
|
if (ids.length === 0)
|
|
@@ -22635,7 +22839,7 @@ var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
|
|
|
22635
22839
|
}));
|
|
22636
22840
|
}, "chatCoverage");
|
|
22637
22841
|
|
|
22638
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22842
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/agenda.js
|
|
22639
22843
|
var DAY = 864e5;
|
|
22640
22844
|
var AGENDA_DEFAULTS = { unanswered: DAY, waiting: 7 * DAY };
|
|
22641
22845
|
var CLAIMS = ["none", "mine", "others", "any"];
|
|
@@ -22669,7 +22873,7 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22669
22873
|
const [store, account] = [await deps.store(), await deps.account()];
|
|
22670
22874
|
const at = now();
|
|
22671
22875
|
const parts = query ? split(query) : { tasks: void 0, chats: void 0 };
|
|
22672
|
-
const find = /* @__PURE__ */ __name((
|
|
22876
|
+
const find = /* @__PURE__ */ __name((where) => store.tasks.find({ project: inboxKey(taskAccount(account)), status: "open", limit: 500, ...where ? { where } : {} }).catch((error) => {
|
|
22673
22877
|
if (error instanceof Error && "code" in error && error.code === "not_found")
|
|
22674
22878
|
return [];
|
|
22675
22879
|
throw error;
|
|
@@ -22706,9 +22910,11 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22706
22910
|
createdAt: task2.createdAt,
|
|
22707
22911
|
assignees
|
|
22708
22912
|
}));
|
|
22709
|
-
const
|
|
22710
|
-
const activity = await store.chats.chatActivity(account, at - within,
|
|
22913
|
+
const mail = account.provider === "email" ? await mailActivity(store, account, at - within, parts.chats) : void 0;
|
|
22914
|
+
const activity = mail ?? await store.chats.chatActivity(account, at - within, parts.chats ? queryFilter(parts.chats, AGENDA_COLUMNS, { command: "tasks agenda" }) : void 0);
|
|
22915
|
+
const turnOf = /* @__PURE__ */ __name((chat) => "turn" in chat ? chat.turn : chat.lastFromOwner === null ? null : chat.lastFromOwner ? "waiting" : "owed", "turnOf");
|
|
22711
22916
|
const chats = activity.chats.map(({ lastMessageId, ...chat }) => ({
|
|
22917
|
+
turn: turnOf({ lastMessageId, ...chat }),
|
|
22712
22918
|
...chat,
|
|
22713
22919
|
lastMessage: lastMessageId === null ? null : formatLocator({
|
|
22714
22920
|
provider: account.provider,
|
|
@@ -22720,12 +22926,14 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
22720
22926
|
}));
|
|
22721
22927
|
const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
|
|
22722
22928
|
const shown = {
|
|
22723
|
-
owed: chats.filter((chat) => chat.
|
|
22724
|
-
waiting: chats.filter((chat) => chat.
|
|
22725
|
-
|
|
22929
|
+
owed: chats.filter((chat) => chat.turn === "owed" && silentFor(chat) >= unanswered2),
|
|
22930
|
+
waiting: chats.filter((chat) => chat.turn === "waiting" && silentFor(chat) >= waiting),
|
|
22931
|
+
// A thread with no stored email but drafts is not behind: mail sync stores every email it lists.
|
|
22932
|
+
unsynced: mail ? [] : chats.filter((chat) => chat.lastMessage === null)
|
|
22726
22933
|
};
|
|
22727
|
-
const
|
|
22728
|
-
const
|
|
22934
|
+
const ids = Object.values(shown).flatMap((list3) => list3.map(({ chatId }) => chatId));
|
|
22935
|
+
const covered = new Map((mail ? mail.coverage(ids) : await chatCoverage(store, account, ids)).map((one) => [one.chatId, one]));
|
|
22936
|
+
const withCoverage = /* @__PURE__ */ __name((list3) => list3.map(({ turn: _, ...chat }) => ({ ...chat, coverage: covered.get(chat.chatId) })), "withCoverage");
|
|
22729
22937
|
const inList = new Set((await store.tasks.categories()).map(({ name }) => name));
|
|
22730
22938
|
const unlisted = /* @__PURE__ */ new Map();
|
|
22731
22939
|
for (const { category } of open7)
|
|
@@ -22878,7 +23086,7 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
|
|
|
22878
23086
|
};
|
|
22879
23087
|
}, "agendaItem");
|
|
22880
23088
|
|
|
22881
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23089
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
|
|
22882
23090
|
var contextSourceKey = /* @__PURE__ */ __name((source) => JSON.stringify([source.kind, source.accountId, source.provider, source.account]), "contextSourceKey");
|
|
22883
23091
|
var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
22884
23092
|
const fail2 = /* @__PURE__ */ __name(() => {
|
|
@@ -22901,33 +23109,33 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
|
22901
23109
|
if (big !== void 0 && (!big || page.items.length || typeof big.ref !== "string" || !Number.isSafeInteger(big.bytes) || big.bytes <= maxReadBytes))
|
|
22902
23110
|
fail2();
|
|
22903
23111
|
let actual = 0;
|
|
22904
|
-
for (const
|
|
22905
|
-
if (!
|
|
23112
|
+
for (const item2 of page.items) {
|
|
23113
|
+
if (!item2 || item2.provider !== source.provider || item2.account !== source.account || typeof item2.text !== "string" || typeof item2.ref !== "string")
|
|
22906
23114
|
fail2();
|
|
22907
|
-
if (!Number.isSafeInteger(
|
|
23115
|
+
if (!Number.isSafeInteger(item2.at) || item2.at < after || item2.at >= before2 || !Number.isSafeInteger(item2.updatedAt) || item2.updatedAt < 0)
|
|
22908
23116
|
fail2();
|
|
22909
|
-
if (
|
|
23117
|
+
if (item2.revision !== null && (!Number.isSafeInteger(item2.revision) || item2.revision < 1))
|
|
22910
23118
|
fail2();
|
|
22911
|
-
if (source.kind === "document" ? !["source-modified", "stored-update"].includes(
|
|
23119
|
+
if (source.kind === "document" ? !["source-modified", "stored-update"].includes(item2.timeKind) : item2.timeKind !== (source.kind === "meeting" ? "meeting-start" : "sent"))
|
|
22912
23120
|
fail2();
|
|
22913
|
-
const sender =
|
|
23121
|
+
const sender = item2.sender;
|
|
22914
23122
|
if (sender != null && (typeof sender !== "object" || typeof sender.provider !== "string" || typeof sender.id !== "string" || typeof sender.owner !== "boolean" || [sender.name, sender.person, sender.personName].some((v) => v !== null && typeof v !== "string") || sender.person !== null && !/^person:[1-9]\d*$/.test(sender.person)))
|
|
22915
23123
|
fail2();
|
|
22916
|
-
const text2 = [
|
|
23124
|
+
const text2 = [item2.text, item2.title, item2.url, item2.provider, item2.account, item2.timeKind];
|
|
22917
23125
|
if (text2.some((value) => value !== null && typeof value !== "string"))
|
|
22918
23126
|
fail2();
|
|
22919
23127
|
if (source.kind === "document") {
|
|
22920
|
-
const id2 = Number(
|
|
22921
|
-
if (!Number.isSafeInteger(id2) || id2 < 1 ||
|
|
23128
|
+
const id2 = Number(item2.ref.slice(9));
|
|
23129
|
+
if (!Number.isSafeInteger(id2) || id2 < 1 || item2.ref !== `document:${id2}`)
|
|
22922
23130
|
fail2();
|
|
22923
23131
|
} else if (source.kind === "meeting") {
|
|
22924
|
-
const reference = parseMeetingReference(
|
|
22925
|
-
if (reference.accountId !== source.accountId || reference.transcriptId === void 0 || reference.cuePosition === void 0 || formatMeetingReference(reference) !==
|
|
23132
|
+
const reference = parseMeetingReference(item2.ref);
|
|
23133
|
+
if (reference.accountId !== source.accountId || reference.transcriptId === void 0 || reference.cuePosition === void 0 || formatMeetingReference(reference) !== item2.ref)
|
|
22926
23134
|
fail2();
|
|
22927
|
-
text2.push(
|
|
23135
|
+
text2.push(item2.ref);
|
|
22928
23136
|
} else {
|
|
22929
|
-
const locator = parseLocator(
|
|
22930
|
-
if (locator.provider !== source.provider || locator.account !== source.account || chat !== void 0 && locator.chat !== chat || formatLocator(locator) !==
|
|
23137
|
+
const locator = parseLocator(item2.ref);
|
|
23138
|
+
if (locator.provider !== source.provider || locator.account !== source.account || chat !== void 0 && locator.chat !== chat || formatLocator(locator) !== item2.ref)
|
|
22931
23139
|
fail2();
|
|
22932
23140
|
text2.push(locator.chat, locator.message);
|
|
22933
23141
|
}
|
|
@@ -22942,7 +23150,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
|
22942
23150
|
}
|
|
22943
23151
|
}, "validateContextEvidencePage");
|
|
22944
23152
|
|
|
22945
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23153
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/context/read-budget.js
|
|
22946
23154
|
var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
|
|
22947
23155
|
if (!limits || typeof limits !== "object" || Array.isArray(limits))
|
|
22948
23156
|
throw new CliError("validation_error", "limits needs a context read allowance");
|
|
@@ -22995,7 +23203,7 @@ var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
|
|
|
22995
23203
|
};
|
|
22996
23204
|
}, "contextReadBudget");
|
|
22997
23205
|
|
|
22998
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23206
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
|
|
22999
23207
|
var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits) => {
|
|
23000
23208
|
if (!port || typeof port.read !== "function")
|
|
23001
23209
|
throw new CliError("configuration_error", "context evidence reader is unavailable");
|
|
@@ -23039,7 +23247,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
|
|
|
23039
23247
|
};
|
|
23040
23248
|
}, "createContextEvidenceReader");
|
|
23041
23249
|
|
|
23042
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23250
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/excerpt.js
|
|
23043
23251
|
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");
|
|
23044
23252
|
var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options = {}) => {
|
|
23045
23253
|
const flat = text2.replace(/\s+/g, " ").trim();
|
|
@@ -23055,7 +23263,7 @@ var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options = {}) =
|
|
|
23055
23263
|
}, "excerpt");
|
|
23056
23264
|
var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
|
|
23057
23265
|
|
|
23058
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23266
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-purposes.js
|
|
23059
23267
|
var BUILT_IN_PURPOSES = ["work", "sales", "support", "other"];
|
|
23060
23268
|
var DEFAULT_PURPOSES = ["work"];
|
|
23061
23269
|
var LINK_PURPOSE = "work";
|
|
@@ -23085,7 +23293,7 @@ var purposeList = /* @__PURE__ */ __name((value, previous = []) => [
|
|
|
23085
23293
|
...value.split(",").map((one) => one.trim()).filter(Boolean)
|
|
23086
23294
|
], "purposeList");
|
|
23087
23295
|
|
|
23088
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23296
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
|
|
23089
23297
|
var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
|
|
23090
23298
|
async around(ref, window3) {
|
|
23091
23299
|
const at = parseLocator(ref);
|
|
@@ -23119,35 +23327,35 @@ var documentMatches = /* @__PURE__ */ __name((text2, queries, window3) => {
|
|
|
23119
23327
|
var attachNeighbours = /* @__PURE__ */ __name(async (items, reader, window3, budget, known2, signal) => {
|
|
23120
23328
|
if (!reader || window3.before + window3.after === 0)
|
|
23121
23329
|
return;
|
|
23122
|
-
for (const
|
|
23123
|
-
if (
|
|
23330
|
+
for (const item2 of items) {
|
|
23331
|
+
if (item2.kind !== "message" && item2.kind !== "mail")
|
|
23124
23332
|
continue;
|
|
23125
23333
|
if (budget.remaining() <= 0) {
|
|
23126
|
-
|
|
23127
|
-
|
|
23334
|
+
item2.around = null;
|
|
23335
|
+
item2.aroundIssue = "read-bytes";
|
|
23128
23336
|
continue;
|
|
23129
23337
|
}
|
|
23130
23338
|
signal?.throwIfAborted();
|
|
23131
23339
|
try {
|
|
23132
|
-
const rows = await reader.around(
|
|
23340
|
+
const rows = await reader.around(item2.ref, window3);
|
|
23133
23341
|
const around = [];
|
|
23134
23342
|
for (const row of rows.slice(0, window3.before + window3.after)) {
|
|
23135
23343
|
const text2 = excerpt(row.text, "", 200);
|
|
23136
23344
|
const bytes2 = Buffer.byteLength(text2);
|
|
23137
23345
|
if (bytes2 > budget.remaining()) {
|
|
23138
|
-
|
|
23346
|
+
item2.aroundIssue = "read-bytes";
|
|
23139
23347
|
break;
|
|
23140
23348
|
}
|
|
23141
23349
|
budget.charge(bytes2);
|
|
23142
23350
|
around.push({ ...row, text: text2, found: known2(row.ref) });
|
|
23143
23351
|
}
|
|
23144
|
-
|
|
23352
|
+
item2.around = around;
|
|
23145
23353
|
} catch (error) {
|
|
23146
23354
|
signal?.throwIfAborted();
|
|
23147
23355
|
if (!(error instanceof CliError))
|
|
23148
23356
|
throw error;
|
|
23149
|
-
|
|
23150
|
-
|
|
23357
|
+
item2.around = null;
|
|
23358
|
+
item2.aroundIssue = error.code;
|
|
23151
23359
|
}
|
|
23152
23360
|
}
|
|
23153
23361
|
}, "attachNeighbours");
|
|
@@ -23180,7 +23388,7 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
|
|
|
23180
23388
|
};
|
|
23181
23389
|
}, "storedNeighbours");
|
|
23182
23390
|
|
|
23183
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23391
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
|
|
23184
23392
|
import { createHash as createHash2 } from "node:crypto";
|
|
23185
23393
|
var DAY2 = 864e5;
|
|
23186
23394
|
var MAX_TIME = 864e13;
|
|
@@ -23496,7 +23704,7 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
|
|
|
23496
23704
|
return value;
|
|
23497
23705
|
}, "decodeCheckpoint");
|
|
23498
23706
|
|
|
23499
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23707
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
|
|
23500
23708
|
var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
|
|
23501
23709
|
var PAGE3 = 20;
|
|
23502
23710
|
var PEOPLE = 20;
|
|
@@ -23643,27 +23851,27 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23643
23851
|
matchedAgain.set(ref, (matchedAgain.get(ref) ?? /* @__PURE__ */ new Set()).add(lane.id));
|
|
23644
23852
|
return true;
|
|
23645
23853
|
}, "again");
|
|
23646
|
-
const take = /* @__PURE__ */ __name((
|
|
23647
|
-
if (again(
|
|
23854
|
+
const take = /* @__PURE__ */ __name((item2, lane, kind, source) => {
|
|
23855
|
+
if (again(item2.ref, lane))
|
|
23648
23856
|
return;
|
|
23649
|
-
seen.add(seenKey(
|
|
23650
|
-
const short = excerpt(
|
|
23651
|
-
const fingerprint = contextEvidenceFingerprint(
|
|
23652
|
-
const { sender, ...stored } =
|
|
23857
|
+
seen.add(seenKey(item2.ref));
|
|
23858
|
+
const short = excerpt(item2.text, lane.query ?? "", 300, { literal: true });
|
|
23859
|
+
const fingerprint = contextEvidenceFingerprint(item2);
|
|
23860
|
+
const { sender, ...stored } = item2;
|
|
23653
23861
|
if (sender)
|
|
23654
|
-
senderOf.set(
|
|
23862
|
+
senderOf.set(item2.ref, sender);
|
|
23655
23863
|
const entry = {
|
|
23656
23864
|
...stored,
|
|
23657
23865
|
kind,
|
|
23658
23866
|
source,
|
|
23659
23867
|
text: short,
|
|
23660
|
-
textTruncated: short !==
|
|
23868
|
+
textTruncated: short !== item2.text.replace(/\s+/g, " ").trim(),
|
|
23661
23869
|
fingerprint,
|
|
23662
23870
|
lanes: [lane.id],
|
|
23663
23871
|
context: contextOf(lane)
|
|
23664
23872
|
};
|
|
23665
23873
|
if (kind === "document" && lane.query !== null && plan.around.before + plan.around.after) {
|
|
23666
|
-
const passage = documentMatches(
|
|
23874
|
+
const passage = documentMatches(item2.text, queries, plan.around);
|
|
23667
23875
|
entry.around = [];
|
|
23668
23876
|
entry.moreMatches = passage.moreMatches;
|
|
23669
23877
|
for (const part of passage.around) {
|
|
@@ -23673,10 +23881,10 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23673
23881
|
break;
|
|
23674
23882
|
}
|
|
23675
23883
|
usage.aroundBytes += bytes2;
|
|
23676
|
-
entry.around.push({ ref:
|
|
23884
|
+
entry.around.push({ ref: item2.ref, at: item2.at, sender: null, ...part });
|
|
23677
23885
|
}
|
|
23678
23886
|
}
|
|
23679
|
-
byRef.set(
|
|
23887
|
+
byRef.set(item2.ref, entry);
|
|
23680
23888
|
items.push(entry);
|
|
23681
23889
|
usage.items++;
|
|
23682
23890
|
if (linkedLanes.has(lane.id))
|
|
@@ -23743,8 +23951,8 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23743
23951
|
}
|
|
23744
23952
|
state.pages++;
|
|
23745
23953
|
state.code = page.coverage.index === "ready" ? null : `index-${page.coverage.index}`;
|
|
23746
|
-
for (const
|
|
23747
|
-
take(
|
|
23954
|
+
for (const item2 of page.items)
|
|
23955
|
+
take(item2, unit.lane, unit.source.kind, unit.sourceIndex);
|
|
23748
23956
|
if (!page.coverage.available)
|
|
23749
23957
|
state.state = "unavailable";
|
|
23750
23958
|
else if (page.next) {
|
|
@@ -23768,7 +23976,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23768
23976
|
}
|
|
23769
23977
|
await attachNeighbours(
|
|
23770
23978
|
// A linked chat's neighbours are already its own lane's evidence.
|
|
23771
|
-
items.filter((
|
|
23979
|
+
items.filter((item2) => item2.context !== "linked-chat"),
|
|
23772
23980
|
ports.neighbours,
|
|
23773
23981
|
plan.around,
|
|
23774
23982
|
{
|
|
@@ -23879,8 +24087,8 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
23879
24087
|
}, "gatherProjectEvidence");
|
|
23880
24088
|
var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
|
|
23881
24089
|
const byKey = /* @__PURE__ */ new Map();
|
|
23882
|
-
for (const
|
|
23883
|
-
const sender = senderOf.get(
|
|
24090
|
+
for (const item2 of items) {
|
|
24091
|
+
const sender = senderOf.get(item2.ref);
|
|
23884
24092
|
if (!sender || sender.owner)
|
|
23885
24093
|
continue;
|
|
23886
24094
|
const key = sender.person ?? JSON.stringify([sender.provider, sender.id]);
|
|
@@ -23892,15 +24100,15 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
|
|
|
23892
24100
|
contexts: {}
|
|
23893
24101
|
};
|
|
23894
24102
|
byKey.set(key, found);
|
|
23895
|
-
if (!found.identities.some((i) => i.provider === sender.provider && i.account ===
|
|
23896
|
-
found.identities.push({ provider: sender.provider, account:
|
|
24103
|
+
if (!found.identities.some((i) => i.provider === sender.provider && i.account === item2.account && i.id === sender.id))
|
|
24104
|
+
found.identities.push({ provider: sender.provider, account: item2.account, id: sender.id });
|
|
23897
24105
|
found.items++;
|
|
23898
|
-
found.contexts[
|
|
24106
|
+
found.contexts[item2.context] = (found.contexts[item2.context] ?? 0) + 1;
|
|
23899
24107
|
}
|
|
23900
24108
|
return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
|
|
23901
24109
|
}, "peopleOf");
|
|
23902
24110
|
|
|
23903
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24111
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
|
|
23904
24112
|
var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
|
|
23905
24113
|
var termsOf = /* @__PURE__ */ __name((entry) => [
|
|
23906
24114
|
{ name: entry.name, kind: "canonical" },
|
|
@@ -23944,7 +24152,7 @@ var matchVocabularyTerms = /* @__PURE__ */ __name((catalog, texts) => {
|
|
|
23944
24152
|
return result.sort((a, b) => Number(a.entry.id) - Number(b.entry.id));
|
|
23945
24153
|
}, "matchVocabularyTerms");
|
|
23946
24154
|
|
|
23947
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24155
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
|
|
23948
24156
|
var KINDS = ["project", "tag", "topic"];
|
|
23949
24157
|
var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options = {}) => {
|
|
23950
24158
|
if (typeof vocabulary?.vocabulary !== "function")
|
|
@@ -23952,9 +24160,9 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
|
|
|
23952
24160
|
const limit = options.limit ?? 50;
|
|
23953
24161
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 200)
|
|
23954
24162
|
throw new CliError("validation_error", "limit must be a whole number from 1 to 200", { param: "limit" });
|
|
23955
|
-
const texts = gathering.items.flatMap((
|
|
23956
|
-
{ text: `${
|
|
23957
|
-
...(
|
|
24163
|
+
const texts = gathering.items.flatMap((item2) => [
|
|
24164
|
+
{ text: `${item2.title ?? ""} ${item2.text}`, source: { reference: item2.ref, in: "hit" } },
|
|
24165
|
+
...(item2.around ?? []).map((one) => ({ text: one.text, source: { reference: one.ref, in: "around" } }))
|
|
23958
24166
|
]);
|
|
23959
24167
|
const items = [];
|
|
23960
24168
|
const vocabularyFingerprints = {};
|
|
@@ -23999,7 +24207,7 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
|
|
|
23999
24207
|
};
|
|
24000
24208
|
}, "findEvidenceMentions");
|
|
24001
24209
|
|
|
24002
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24210
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
|
|
24003
24211
|
var storedChatCount = /* @__PURE__ */ __name((store) => async (account, chatId, { since, until }) => {
|
|
24004
24212
|
const window3 = { since: new Date(since).toISOString(), until: new Date(until - 1).toISOString() };
|
|
24005
24213
|
const [messages, newest, oldest] = await Promise.all([
|
|
@@ -24250,9 +24458,9 @@ var gatherStoredProject = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
24250
24458
|
if (proposed && lane.kinds.includes("sender"))
|
|
24251
24459
|
proposedLanes.set(lane.id, proposed);
|
|
24252
24460
|
}
|
|
24253
|
-
const items = gathered.items.map((
|
|
24254
|
-
const proposed =
|
|
24255
|
-
return proposed ? { ...
|
|
24461
|
+
const items = gathered.items.map((item2) => {
|
|
24462
|
+
const proposed = item2.lanes.every((lane) => proposedLanes.has(lane)) ? proposedLanes.get(item2.lanes[0] ?? "") : void 0;
|
|
24463
|
+
return proposed ? { ...item2, proposed } : item2;
|
|
24256
24464
|
});
|
|
24257
24465
|
const linkedRows = gathered.linkedChats.map((row) => {
|
|
24258
24466
|
const link4 = byRef.get(row.ref);
|
|
@@ -24267,7 +24475,7 @@ var gatherStoredProject = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
24267
24475
|
const leftOut = [];
|
|
24268
24476
|
for (const one of all.filter((chat) => !purposeRead(purposes, chat.purpose))) {
|
|
24269
24477
|
const account = { provider: one.provider, account: one.account };
|
|
24270
|
-
const [
|
|
24478
|
+
const [counted2, [held]] = await Promise.all([
|
|
24271
24479
|
count4(account, one.chat, { since: gathered.window.after, until: gathered.window.before }),
|
|
24272
24480
|
chatCoverage(store, account, [one.chat])
|
|
24273
24481
|
]);
|
|
@@ -24280,7 +24488,7 @@ var gatherStoredProject = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
24280
24488
|
purpose: one.purpose ?? LINK_PURPOSE,
|
|
24281
24489
|
relationship: one.relationship,
|
|
24282
24490
|
...one.proposed ? { proposed: one.proposed } : {},
|
|
24283
|
-
...
|
|
24491
|
+
...counted2
|
|
24284
24492
|
});
|
|
24285
24493
|
}
|
|
24286
24494
|
return {
|
|
@@ -24305,18 +24513,18 @@ var purposeHintOf = /* @__PURE__ */ __name((linked, rows, of) => {
|
|
|
24305
24513
|
return { chat: top.ref, relationship: link4.relationship, items, of };
|
|
24306
24514
|
}, "purposeHintOf");
|
|
24307
24515
|
|
|
24308
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24516
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/media-archive.js
|
|
24309
24517
|
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
24310
24518
|
|
|
24311
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24519
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
|
|
24312
24520
|
import { lstat } from "node:fs/promises";
|
|
24313
24521
|
|
|
24314
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24522
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
|
|
24315
24523
|
import { createHash as createHash4, randomUUID as randomUUID2 } from "node:crypto";
|
|
24316
24524
|
import { open as open3, rename as rename2, unlink as unlink2 } from "node:fs/promises";
|
|
24317
24525
|
import { join as join3 } from "node:path";
|
|
24318
24526
|
|
|
24319
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24527
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
|
|
24320
24528
|
import { createHash as createHash3 } from "node:crypto";
|
|
24321
24529
|
var metadataLimit = 16384;
|
|
24322
24530
|
var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
|
|
@@ -24376,7 +24584,7 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
|
|
|
24376
24584
|
}
|
|
24377
24585
|
}, "readPartialMetadata");
|
|
24378
24586
|
|
|
24379
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24587
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
|
|
24380
24588
|
import { randomUUID } from "node:crypto";
|
|
24381
24589
|
import { open as open2, rename, unlink } from "node:fs/promises";
|
|
24382
24590
|
import { join as join2 } from "node:path";
|
|
@@ -24468,7 +24676,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
|
|
|
24468
24676
|
};
|
|
24469
24677
|
}, "partialWriter");
|
|
24470
24678
|
|
|
24471
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24679
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
|
|
24472
24680
|
var NativeRecordingPartialStore = class {
|
|
24473
24681
|
static {
|
|
24474
24682
|
__name(this, "NativeRecordingPartialStore");
|
|
@@ -24575,21 +24783,21 @@ var NativeRecordingPartialStore = class {
|
|
|
24575
24783
|
}
|
|
24576
24784
|
};
|
|
24577
24785
|
|
|
24578
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24786
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
|
|
24579
24787
|
import { createHash as createHash5 } from "node:crypto";
|
|
24580
24788
|
import { link as link2 } from "node:fs/promises";
|
|
24581
24789
|
import { basename as basename2, dirname as dirname2, join as join5, resolve as resolve2 } from "node:path";
|
|
24582
24790
|
|
|
24583
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24791
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
|
|
24584
24792
|
import { unlink as unlink3 } from "node:fs/promises";
|
|
24585
|
-
var verifiedPublicationFile = /* @__PURE__ */ __name(async (path,
|
|
24793
|
+
var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected2, signal, writable = false) => {
|
|
24586
24794
|
signal?.throwIfAborted();
|
|
24587
24795
|
const file2 = await openOrdinaryFile(path, { writable });
|
|
24588
24796
|
try {
|
|
24589
|
-
if ((await file2.stat()).size !==
|
|
24797
|
+
if ((await file2.stat()).size !== expected2.size)
|
|
24590
24798
|
throw new CliError("validation_error", "recording recovery final checksum does not match");
|
|
24591
|
-
const actual = await fingerprintPartial(file2, signal,
|
|
24592
|
-
if (actual.offset !==
|
|
24799
|
+
const actual = await fingerprintPartial(file2, signal, expected2.size);
|
|
24800
|
+
if (actual.offset !== expected2.size || actual.sha256 !== expected2.sha256)
|
|
24593
24801
|
throw new CliError("validation_error", "recording recovery final checksum does not match");
|
|
24594
24802
|
return file2;
|
|
24595
24803
|
} catch (error) {
|
|
@@ -24615,7 +24823,7 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
|
|
|
24615
24823
|
signal?.throwIfAborted();
|
|
24616
24824
|
}, "commitPublication");
|
|
24617
24825
|
|
|
24618
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24826
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
|
|
24619
24827
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
24620
24828
|
import { open as open4, rename as rename3, unlink as unlink4 } from "node:fs/promises";
|
|
24621
24829
|
import { join as join4 } from "node:path";
|
|
@@ -24688,7 +24896,7 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
|
|
|
24688
24896
|
}
|
|
24689
24897
|
}, "writePublicationJournal");
|
|
24690
24898
|
|
|
24691
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24899
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
|
|
24692
24900
|
var NativeRecordingPublication = class {
|
|
24693
24901
|
static {
|
|
24694
24902
|
__name(this, "NativeRecordingPublication");
|
|
@@ -24715,13 +24923,13 @@ var NativeRecordingPublication = class {
|
|
|
24715
24923
|
write(value) {
|
|
24716
24924
|
return writePublicationJournal(this.root, this.journalPath, this.options.prefix, value, this.options.codec, this.options.metadataLimit, this.options.signal);
|
|
24717
24925
|
}
|
|
24718
|
-
validate(partialPath,
|
|
24719
|
-
if (resolve2(dirname2(partialPath)) !== resolve2(this.root) || resolve2(partialPath) === resolve2(this.finalPath) || resolve2(partialPath) === resolve2(this.journalPath) || !Number.isSafeInteger(
|
|
24926
|
+
validate(partialPath, expected2) {
|
|
24927
|
+
if (resolve2(dirname2(partialPath)) !== resolve2(this.root) || resolve2(partialPath) === resolve2(this.finalPath) || resolve2(partialPath) === resolve2(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))
|
|
24720
24928
|
throw new CliError("validation_error", "invalid recording publication evidence");
|
|
24721
24929
|
this.options.signal?.throwIfAborted();
|
|
24722
24930
|
}
|
|
24723
|
-
async publish(partialPath,
|
|
24724
|
-
const proof = { ...
|
|
24931
|
+
async publish(partialPath, expected2, commit) {
|
|
24932
|
+
const proof = { ...expected2 };
|
|
24725
24933
|
this.validate(partialPath, proof);
|
|
24726
24934
|
const partial = await verifiedPublicationFile(partialPath, proof, this.options.signal, true);
|
|
24727
24935
|
try {
|
|
@@ -24739,14 +24947,14 @@ var NativeRecordingPublication = class {
|
|
|
24739
24947
|
const intent = await this.read();
|
|
24740
24948
|
if (intent === null)
|
|
24741
24949
|
throw new CliError("validation_error", "recording path already exists without a verified manifest or scoped recovery record");
|
|
24742
|
-
const
|
|
24743
|
-
this.validate(partialPath,
|
|
24950
|
+
const expected2 = { ...this.options.evidence(intent) };
|
|
24951
|
+
this.validate(partialPath, expected2);
|
|
24744
24952
|
const completed = await loadPartial();
|
|
24745
|
-
if (!strongRecordingValidator(
|
|
24953
|
+
if (!strongRecordingValidator(expected2.validator) || !completed || partialIdentity(completed.locator) !== this.scope || completed.offset !== expected2.size || completed.sha256 !== expected2.sha256 || completed.validator !== expected2.validator || completed.total !== null && completed.total !== expected2.size)
|
|
24746
24954
|
throw new CliError("validation_error", "recording recovery checkpoint does not prove this completed asset");
|
|
24747
|
-
const partial = await verifiedPublicationFile(partialPath,
|
|
24955
|
+
const partial = await verifiedPublicationFile(partialPath, expected2, this.options.signal);
|
|
24748
24956
|
try {
|
|
24749
|
-
const final = await verifiedPublicationFile(this.finalPath,
|
|
24957
|
+
const final = await verifiedPublicationFile(this.finalPath, expected2, this.options.signal, true);
|
|
24750
24958
|
try {
|
|
24751
24959
|
await final.sync();
|
|
24752
24960
|
this.options.signal?.throwIfAborted();
|
|
@@ -24761,7 +24969,7 @@ var NativeRecordingPublication = class {
|
|
|
24761
24969
|
}
|
|
24762
24970
|
};
|
|
24763
24971
|
|
|
24764
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24972
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
|
|
24765
24973
|
import { createHash as createHash6 } from "node:crypto";
|
|
24766
24974
|
import { readdir } from "node:fs/promises";
|
|
24767
24975
|
import { isAbsolute as isAbsolute2, join as join6, resolve as resolve3 } from "node:path";
|
|
@@ -24848,7 +25056,7 @@ var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writ
|
|
|
24848
25056
|
beforePublish
|
|
24849
25057
|
}), "commitMediaEntry");
|
|
24850
25058
|
|
|
24851
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25059
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
|
|
24852
25060
|
var validator = '"media-completed-v1"';
|
|
24853
25061
|
var maximumFileBytes = 64 * 1024 * 1024 * 1024;
|
|
24854
25062
|
var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2, beforeWrite, signal, metadata = {}) => {
|
|
@@ -24949,7 +25157,7 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2
|
|
|
24949
25157
|
return entry;
|
|
24950
25158
|
}, "archiveMediaFile");
|
|
24951
25159
|
|
|
24952
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25160
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
|
|
24953
25161
|
import { mkdir, realpath } from "node:fs/promises";
|
|
24954
25162
|
import { join as join7, resolve as resolve4 } from "node:path";
|
|
24955
25163
|
var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
|
|
@@ -25016,7 +25224,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, ru
|
|
|
25016
25224
|
throw new CliError("validation_error", "archive locations changed during locking; run the command again");
|
|
25017
25225
|
}, "withMediaArchiveLocks");
|
|
25018
25226
|
|
|
25019
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25227
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/media-archive.js
|
|
25020
25228
|
var validateMediaSince = /* @__PURE__ */ __name((value, flag = "--since-time") => {
|
|
25021
25229
|
if (value === void 0)
|
|
25022
25230
|
return void 0;
|
|
@@ -25169,7 +25377,7 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options) => {
|
|
|
25169
25377
|
}, { create: true });
|
|
25170
25378
|
}, "archiveMedia");
|
|
25171
25379
|
|
|
25172
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25380
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
|
|
25173
25381
|
import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
|
|
25174
25382
|
import { basename as basename3, dirname as dirname3, join as join8, resolve as resolve5 } from "node:path";
|
|
25175
25383
|
var canonicalDestination = /* @__PURE__ */ __name(async (directory2) => {
|
|
@@ -25322,7 +25530,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
|
|
|
25322
25530
|
}, { additional: [target2], createAdditional: !options.dryRun });
|
|
25323
25531
|
}, "moveMediaArchive");
|
|
25324
25532
|
|
|
25325
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25533
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
|
|
25326
25534
|
var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file2) => sum2 + file2.bytes, 0), "bytesOf");
|
|
25327
25535
|
var nativeRuntime = /* @__PURE__ */ __name(async ({ env, progress = /* @__PURE__ */ __name(() => {
|
|
25328
25536
|
}, "progress") }) => {
|
|
@@ -25345,7 +25553,7 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
25345
25553
|
}
|
|
25346
25554
|
await nativeRuntime({ env, progress });
|
|
25347
25555
|
progress(`${model.id}: loading it once to check it works`);
|
|
25348
|
-
const { openEmbedder: openEmbedder2 } = await import("./embed-
|
|
25556
|
+
const { openEmbedder: openEmbedder2 } = await import("./embed-QTOE7NN3.js");
|
|
25349
25557
|
const embedder = await openEmbedder2(model, directory2);
|
|
25350
25558
|
try {
|
|
25351
25559
|
const [vector] = await embedder.embed(["check"], "query");
|
|
@@ -25366,7 +25574,7 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
|
|
|
25366
25574
|
}
|
|
25367
25575
|
await nativeRuntime({ env, progress });
|
|
25368
25576
|
progress(`${model.id}: loading it once to check it works`);
|
|
25369
|
-
const { openReranker } = await import("./rerank-
|
|
25577
|
+
const { openReranker } = await import("./rerank-OWSTDLZN.js");
|
|
25370
25578
|
const reranker = await openReranker(model, directory2);
|
|
25371
25579
|
try {
|
|
25372
25580
|
await reranker.score("check", ["check"]);
|
|
@@ -25384,7 +25592,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
25384
25592
|
await installFiles(placedImage(model, directory2), { progress });
|
|
25385
25593
|
}
|
|
25386
25594
|
progress(`${model.id}: loading it once to check it works`);
|
|
25387
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
25595
|
+
const { openPictureEmbedder } = await import("./embedder-KBBRYSNH.js");
|
|
25388
25596
|
const embedder = await openPictureEmbedder(model, directory2);
|
|
25389
25597
|
try {
|
|
25390
25598
|
const vector = await embedder.embedQuery("check");
|
|
@@ -25396,7 +25604,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
25396
25604
|
return { model, directory: directory2 };
|
|
25397
25605
|
}, "downloadImageModel");
|
|
25398
25606
|
|
|
25399
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25607
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/money-words.js
|
|
25400
25608
|
var MONEY_REQUEST = "money-request";
|
|
25401
25609
|
var MONEY_DONE = "money-done";
|
|
25402
25610
|
var PROMISE = "promise";
|
|
@@ -25430,10 +25638,10 @@ var MONEY_WORDS = [
|
|
|
25430
25638
|
}
|
|
25431
25639
|
];
|
|
25432
25640
|
|
|
25433
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25641
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/money-words.js
|
|
25434
25642
|
var moneyClassesOf = /* @__PURE__ */ __name((text2) => listsHit(text2, MONEY_WORDS), "moneyClassesOf");
|
|
25435
25643
|
|
|
25436
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25644
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/status-words.js
|
|
25437
25645
|
var words = /* @__PURE__ */ __name((forms) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${forms.join("|")})(?![\\p{L}\\p{N}])`, "iu"), "words");
|
|
25438
25646
|
var MONEY_DONE_FORMS = words([
|
|
25439
25647
|
"\u043E\u043F\u043B\u0430\u0442\u0438\u043B[\u0430\u0438]?",
|
|
@@ -25473,7 +25681,7 @@ var PROMISE_FORMS = words([
|
|
|
25473
25681
|
"estar\xE1 listo"
|
|
25474
25682
|
]);
|
|
25475
25683
|
|
|
25476
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25684
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/items.js
|
|
25477
25685
|
var EXCERPT_CHARS = 80;
|
|
25478
25686
|
var excerpt2 = /* @__PURE__ */ __name((text2) => {
|
|
25479
25687
|
const flat = text2.replace(/\s+/g, " ").trim();
|
|
@@ -25495,7 +25703,7 @@ var whoOf = /* @__PURE__ */ __name((message) => ({
|
|
|
25495
25703
|
var fromOwner = /* @__PURE__ */ __name((message) => message.outgoing === true, "fromOwner");
|
|
25496
25704
|
var day = /* @__PURE__ */ __name((at) => new Date(at).toISOString().slice(0, 10), "day");
|
|
25497
25705
|
|
|
25498
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25706
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/signals/amounts.js
|
|
25499
25707
|
var MONEY = DEFAULT_TASK_CATEGORIES.filter((category) => category.name === "money");
|
|
25500
25708
|
var verbOf = /* @__PURE__ */ __name((text2) => {
|
|
25501
25709
|
if (MONEY_DONE_FORMS.test(text2))
|
|
@@ -25535,10 +25743,10 @@ var rowsOf = /* @__PURE__ */ __name((chat) => chat.messages.flatMap((message) =>
|
|
|
25535
25743
|
var centsText = /* @__PURE__ */ __name((cents) => `${Math.floor(cents / 100)}.${String(cents % 100).padStart(2, "0")}`, "centsText");
|
|
25536
25744
|
var amounts = {
|
|
25537
25745
|
id: "amounts",
|
|
25538
|
-
version:
|
|
25746
|
+
version: 3,
|
|
25539
25747
|
scope: "chat",
|
|
25540
|
-
read: /* @__PURE__ */ __name(async (
|
|
25541
|
-
if (!chat)
|
|
25748
|
+
read: /* @__PURE__ */ __name(async (context2, chat) => {
|
|
25749
|
+
if (!chat || context2.books)
|
|
25542
25750
|
return [];
|
|
25543
25751
|
const groups = /* @__PURE__ */ new Map();
|
|
25544
25752
|
for (const row of rowsOf(chat)) {
|
|
@@ -25551,7 +25759,8 @@ var amounts = {
|
|
|
25551
25759
|
const lastAsk = asks.at(-1);
|
|
25552
25760
|
const first2 = asks[0] ?? done2[0] ?? rows[0];
|
|
25553
25761
|
const paidAfter = done2.some((row) => !lastAsk || Date.parse(row.message.timestamp) >= Date.parse(lastAsk.message.timestamp));
|
|
25554
|
-
const
|
|
25762
|
+
const paid2 = asks.length ? paidAfter : done2.length > 0;
|
|
25763
|
+
const state = paid2 ? "paid-mentioned" : asks.length ? "asked" : "mentioned";
|
|
25555
25764
|
const cited = asks.length ? [...asks, ...paidAfter ? done2.slice(-1) : []] : rows;
|
|
25556
25765
|
return {
|
|
25557
25766
|
signal: "amounts",
|
|
@@ -25572,16 +25781,16 @@ var amounts = {
|
|
|
25572
25781
|
};
|
|
25573
25782
|
});
|
|
25574
25783
|
}, "read"),
|
|
25575
|
-
attention: /* @__PURE__ */ __name((items) => items.flatMap((
|
|
25784
|
+
attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state === "asked" ? [{ chat: item2.chat, weight: 2, why: "money asked" }] : []), "attention")
|
|
25576
25785
|
};
|
|
25577
25786
|
|
|
25578
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25787
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/signals/children.js
|
|
25579
25788
|
var children = {
|
|
25580
25789
|
id: "children",
|
|
25581
25790
|
version: 1,
|
|
25582
25791
|
scope: "project",
|
|
25583
25792
|
read: /* @__PURE__ */ __name(async (context2) => {
|
|
25584
|
-
const
|
|
25793
|
+
const item2 = /* @__PURE__ */ __name((data) => ({
|
|
25585
25794
|
signal: "children",
|
|
25586
25795
|
chat: null,
|
|
25587
25796
|
at: null,
|
|
@@ -25591,7 +25800,7 @@ var children = {
|
|
|
25591
25800
|
data
|
|
25592
25801
|
}), "item");
|
|
25593
25802
|
return [
|
|
25594
|
-
...context2.project.children.map((child) =>
|
|
25803
|
+
...context2.project.children.map((child) => item2({
|
|
25595
25804
|
child: child.ref,
|
|
25596
25805
|
key: child.key,
|
|
25597
25806
|
name: child.name,
|
|
@@ -25599,12 +25808,12 @@ var children = {
|
|
|
25599
25808
|
chats: context2.chats.filter((chat) => chat.project === child.ref).length,
|
|
25600
25809
|
cut: null
|
|
25601
25810
|
})),
|
|
25602
|
-
...context2.project.cut.map(({ ref, reason }) =>
|
|
25811
|
+
...context2.project.cut.map(({ ref, reason }) => item2({ child: ref, key: null, name: null, depth: null, chats: null, cut: reason }))
|
|
25603
25812
|
];
|
|
25604
25813
|
}, "read")
|
|
25605
25814
|
};
|
|
25606
25815
|
|
|
25607
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25816
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/signals/coverage.js
|
|
25608
25817
|
var coverage = {
|
|
25609
25818
|
id: "coverage",
|
|
25610
25819
|
version: 1,
|
|
@@ -25630,54 +25839,60 @@ var coverage = {
|
|
|
25630
25839
|
}
|
|
25631
25840
|
];
|
|
25632
25841
|
}, "read"),
|
|
25633
|
-
attention: /* @__PURE__ */ __name((items) => items.flatMap((
|
|
25634
|
-
};
|
|
25635
|
-
|
|
25636
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/services/project-status/signals/last-message.js
|
|
25637
|
-
var lastMessage = {
|
|
25638
|
-
id: "last-message",
|
|
25639
|
-
version: 1,
|
|
25640
|
-
scope: "chat",
|
|
25641
|
-
read: /* @__PURE__ */ __name(async (_context, chat) => {
|
|
25642
|
-
const last = chat?.messages.at(-1);
|
|
25643
|
-
if (!chat || !last)
|
|
25644
|
-
return [];
|
|
25645
|
-
const item = {
|
|
25646
|
-
signal: "last-message",
|
|
25647
|
-
chat: chat.ref,
|
|
25648
|
-
at: last.timestamp,
|
|
25649
|
-
who: whoOf(last),
|
|
25650
|
-
evidence: evidenceOf(chat, last),
|
|
25651
|
-
basis: "store",
|
|
25652
|
-
data: {}
|
|
25653
|
-
};
|
|
25654
|
-
return [item];
|
|
25655
|
-
}, "read")
|
|
25842
|
+
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")
|
|
25656
25843
|
};
|
|
25657
25844
|
|
|
25658
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25659
|
-
var
|
|
25845
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/signals/payments.js
|
|
25846
|
+
var holding = /* @__PURE__ */ __name((row) => row.review !== "rejected", "holding");
|
|
25847
|
+
var item = /* @__PURE__ */ __name((row, at, data) => ({
|
|
25848
|
+
signal: "payments",
|
|
25849
|
+
chat: null,
|
|
25850
|
+
at,
|
|
25851
|
+
who: null,
|
|
25852
|
+
// The row first, then what it cites, so an amount read from a cited message is not counted twice.
|
|
25853
|
+
evidence: [row.ref, ...row.evidence].map((ref) => ({ ref, fingerprint: null })),
|
|
25854
|
+
basis: "store",
|
|
25855
|
+
data: { ...data, title: row.title, status: row.review }
|
|
25856
|
+
}), "item");
|
|
25857
|
+
var paid = /* @__PURE__ */ __name((row) => {
|
|
25858
|
+
const party = row.direction === "in" ? row.payer : row.payee;
|
|
25859
|
+
return item(row, `${row.date}T00:00:00.000Z`, {
|
|
25860
|
+
amount: row.amount,
|
|
25861
|
+
currency: row.currency,
|
|
25862
|
+
direction: row.direction === "in" ? "to_us" : "from_us",
|
|
25863
|
+
counterparty: party?.ref ?? null,
|
|
25864
|
+
counterparty_name: party?.name ?? null,
|
|
25865
|
+
due_at: null,
|
|
25866
|
+
state: "paid",
|
|
25867
|
+
item: row.reference,
|
|
25868
|
+
paid_at: row.date
|
|
25869
|
+
});
|
|
25870
|
+
}, "paid");
|
|
25871
|
+
var expected = /* @__PURE__ */ __name((row) => item(row, row.issueDate === null ? row.createdAt : `${row.issueDate}T00:00:00.000Z`, {
|
|
25872
|
+
amount: row.open,
|
|
25873
|
+
currency: row.currency,
|
|
25874
|
+
direction: row.direction === "receivable" ? "to_us" : "from_us",
|
|
25875
|
+
counterparty: row.counterparty.ref,
|
|
25876
|
+
counterparty_name: row.counterparty.name,
|
|
25877
|
+
due_at: row.dueDate,
|
|
25878
|
+
state: "expected",
|
|
25879
|
+
item: row.number
|
|
25880
|
+
}), "expected");
|
|
25660
25881
|
var payments = {
|
|
25661
25882
|
id: "payments",
|
|
25662
|
-
version:
|
|
25883
|
+
version: 3,
|
|
25663
25884
|
scope: "project",
|
|
25664
25885
|
read: /* @__PURE__ */ __name(async (context2) => {
|
|
25665
25886
|
const projects = [context2.project.ref, ...context2.project.children.map((child) => child.ref)];
|
|
25666
|
-
const
|
|
25667
|
-
|
|
25668
|
-
|
|
25669
|
-
|
|
25670
|
-
|
|
25671
|
-
who: null,
|
|
25672
|
-
// The fact first, then what it cites, so an amount read from a cited message is not counted twice.
|
|
25673
|
-
evidence: [fact.ref, ...fact.evidence].map((ref) => ({ ref, fingerprint: null })),
|
|
25674
|
-
basis: "fact",
|
|
25675
|
-
data: { ...fact.payment, title: paymentTitle(fact), status: fact.status }
|
|
25676
|
-
}));
|
|
25887
|
+
const rows = await Promise.all(projects.map(async (project) => [
|
|
25888
|
+
...(await context2.store.finance.payments({ project, limit: 500 })).filter(holding).map(paid),
|
|
25889
|
+
...(await context2.store.finance.invoices({ project, open: true, limit: 500 })).filter(holding).map(expected)
|
|
25890
|
+
]));
|
|
25891
|
+
return rows.flat();
|
|
25677
25892
|
}, "read")
|
|
25678
25893
|
};
|
|
25679
25894
|
|
|
25680
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25895
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/signals/promises.js
|
|
25681
25896
|
var PATTERNS_PER_CHAT = 3;
|
|
25682
25897
|
var DAY3 = 864e5;
|
|
25683
25898
|
var KINDS2 = /* @__PURE__ */ new Set(["promise", "request"]);
|
|
@@ -25766,7 +25981,7 @@ var promises = {
|
|
|
25766
25981
|
}, "read")
|
|
25767
25982
|
};
|
|
25768
25983
|
|
|
25769
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25984
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/signals/questions.js
|
|
25770
25985
|
var PER_SIDE = 5;
|
|
25771
25986
|
var WEEK = 7 * 864e5;
|
|
25772
25987
|
var NOBODY = /* @__PURE__ */ new Set();
|
|
@@ -25792,12 +26007,12 @@ var questions2 = {
|
|
|
25792
26007
|
})));
|
|
25793
26008
|
}, "read"),
|
|
25794
26009
|
attention: /* @__PURE__ */ __name((items, context2) => {
|
|
25795
|
-
const stale = new Set(items.flatMap((
|
|
26010
|
+
const stale = new Set(items.flatMap((item2) => item2.chat !== null && item2.data.side === "yours" && item2.at && context2.now - Date.parse(item2.at) > WEEK ? [item2.chat] : []));
|
|
25796
26011
|
return [...stale].map((chat) => ({ chat, weight: 1, why: "your question unanswered for a week" }));
|
|
25797
26012
|
}, "attention")
|
|
25798
26013
|
};
|
|
25799
26014
|
|
|
25800
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26015
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/signals/reply-next.js
|
|
25801
26016
|
var targetOf = /* @__PURE__ */ __name((message, chat, owners) => {
|
|
25802
26017
|
const byId2 = /* @__PURE__ */ __name((id2) => chat.messages.find((one) => one.id === id2), "byId");
|
|
25803
26018
|
const quoted = message.replyTo ?? (message.replyToId === void 0 ? void 0 : byId2(message.replyToId));
|
|
@@ -25862,10 +26077,10 @@ var replyNext = {
|
|
|
25862
26077
|
}
|
|
25863
26078
|
];
|
|
25864
26079
|
}, "read"),
|
|
25865
|
-
attention: /* @__PURE__ */ __name((items) => items.flatMap((
|
|
26080
|
+
attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.next === "owner" ? [{ chat: item2.chat, weight: 2, why: "your move" }] : []), "attention")
|
|
25866
26081
|
};
|
|
25867
26082
|
|
|
25868
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26083
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/signals/topics.js
|
|
25869
26084
|
var escaped = /* @__PURE__ */ __name((text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
25870
26085
|
var wholeWord = /* @__PURE__ */ __name((word) => new RegExp(`(?<![\\p{L}\\p{N}])${escaped(word)}(?![\\p{L}\\p{N}])`, "u"), "wholeWord");
|
|
25871
26086
|
var matcherOf = /* @__PURE__ */ __name((query) => {
|
|
@@ -25911,9 +26126,8 @@ var topics = {
|
|
|
25911
26126
|
}, "read")
|
|
25912
26127
|
};
|
|
25913
26128
|
|
|
25914
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26129
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/signals/index.js
|
|
25915
26130
|
var STATUS_SIGNALS = [
|
|
25916
|
-
lastMessage,
|
|
25917
26131
|
replyNext,
|
|
25918
26132
|
questions2,
|
|
25919
26133
|
promises,
|
|
@@ -25924,7 +26138,7 @@ var STATUS_SIGNALS = [
|
|
|
25924
26138
|
children
|
|
25925
26139
|
];
|
|
25926
26140
|
|
|
25927
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26141
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/project-status/index.js
|
|
25928
26142
|
var DAY4 = 864e5;
|
|
25929
26143
|
var STATUS_WINDOW = 300;
|
|
25930
26144
|
var STATUS_CHATS = 16;
|
|
@@ -25969,16 +26183,23 @@ var childrenOf = /* @__PURE__ */ __name(async (store, root, catalog) => {
|
|
|
25969
26183
|
}, "childrenOf");
|
|
25970
26184
|
var inAccounts = /* @__PURE__ */ __name((accounts, provider, account) => accounts === void 0 || accounts.some((one) => one.provider === provider && one.account === account), "inAccounts");
|
|
25971
26185
|
var failure = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "failure");
|
|
25972
|
-
var
|
|
25973
|
-
const
|
|
25974
|
-
return
|
|
25975
|
-
}, "
|
|
26186
|
+
var owed = /* @__PURE__ */ __name((item2) => {
|
|
26187
|
+
const data = item2.data;
|
|
26188
|
+
return item2.signal === "payments" && data.state === "expected" && data.status === "confirmed";
|
|
26189
|
+
}, "owed");
|
|
26190
|
+
var keepsBooks = /* @__PURE__ */ __name(async (store, projects) => {
|
|
26191
|
+
for (const project of projects) {
|
|
26192
|
+
const filter = { project, review: "confirmed", limit: 1 };
|
|
26193
|
+
if ((await store.finance.invoices(filter)).length || (await store.finance.payments(filter)).length)
|
|
26194
|
+
return true;
|
|
26195
|
+
}
|
|
26196
|
+
return false;
|
|
26197
|
+
}, "keepsBooks");
|
|
25976
26198
|
var totalsOf = /* @__PURE__ */ __name((items) => {
|
|
25977
26199
|
const totals = /* @__PURE__ */ new Map();
|
|
25978
|
-
const
|
|
25979
|
-
|
|
25980
|
-
|
|
25981
|
-
if (!open7(item, data.state) || data.amount === void 0)
|
|
26200
|
+
for (const item2 of items) {
|
|
26201
|
+
const data = item2.data;
|
|
26202
|
+
if (!owed(item2) || data.amount === void 0)
|
|
25982
26203
|
continue;
|
|
25983
26204
|
const key = `${data.direction}|${data.currency ?? ""}`;
|
|
25984
26205
|
const total = totals.get(key) ?? {
|
|
@@ -26061,6 +26282,7 @@ var projectStatus = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
26061
26282
|
chats,
|
|
26062
26283
|
project: { ...root, children: children2, cut },
|
|
26063
26284
|
store,
|
|
26285
|
+
books: await keepsBooks(store, [root.ref, ...children2.map((child) => child.ref)]),
|
|
26064
26286
|
contextQueries: input.contextQueries ?? []
|
|
26065
26287
|
};
|
|
26066
26288
|
const items = [];
|
|
@@ -26105,7 +26327,7 @@ var projectStatus = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
26105
26327
|
};
|
|
26106
26328
|
}, "projectStatus");
|
|
26107
26329
|
|
|
26108
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26330
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/account.js
|
|
26109
26331
|
var accountService = /* @__PURE__ */ __name((deps) => {
|
|
26110
26332
|
const online = /* @__PURE__ */ __name(async (command) => {
|
|
26111
26333
|
if (deps.offline)
|
|
@@ -26177,7 +26399,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
|
|
|
26177
26399
|
};
|
|
26178
26400
|
}, "accountService");
|
|
26179
26401
|
|
|
26180
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26402
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/send-time.js
|
|
26181
26403
|
var MINUTE = 6e4;
|
|
26182
26404
|
var YEAR = 365 * 24 * 60 * MINUTE;
|
|
26183
26405
|
var DELAY = /^(\d+)(m|h|d)$/;
|
|
@@ -26196,7 +26418,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
|
|
|
26196
26418
|
return new Date(at - at % MINUTE).toISOString();
|
|
26197
26419
|
}, "sendTime");
|
|
26198
26420
|
|
|
26199
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26421
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/admin.js
|
|
26200
26422
|
var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
|
|
26201
26423
|
try {
|
|
26202
26424
|
const held = await accountStoreIfOpen(deps);
|
|
@@ -26342,21 +26564,21 @@ var adminService = /* @__PURE__ */ __name((deps) => {
|
|
|
26342
26564
|
const answerAll = capability(connection, "answerAllJoinRequests", "answer every join request at once");
|
|
26343
26565
|
const { id: chatId } = await connection.resolve(chat);
|
|
26344
26566
|
const page = await list3(chatId, { limit: 100, ...link4 === void 0 ? {} : { link: link4 } });
|
|
26345
|
-
const
|
|
26567
|
+
const counted2 = page.total ?? page.items.length;
|
|
26346
26568
|
if (page.total === void 0 && page.hasMore)
|
|
26347
26569
|
throw new CliError("validation_error", "too many requests to count; answer them by person, or by --link");
|
|
26348
|
-
if (
|
|
26349
|
-
return { chatId, accepted: accept, counted:
|
|
26570
|
+
if (counted2 === 0)
|
|
26571
|
+
return { chatId, accepted: accept, counted: counted2 };
|
|
26350
26572
|
const operationId = newOperationId();
|
|
26351
26573
|
await guardedWrite(deps.guard, {
|
|
26352
26574
|
operationId,
|
|
26353
26575
|
chatId,
|
|
26354
26576
|
kind: "chat",
|
|
26355
26577
|
action: accept ? "requests.accept" : "requests.decline",
|
|
26356
|
-
count:
|
|
26357
|
-
people:
|
|
26578
|
+
count: counted2,
|
|
26579
|
+
people: counted2
|
|
26358
26580
|
}, () => answerAll(chatId, accept, link4));
|
|
26359
|
-
return { operationId, chatId, accepted: accept, counted:
|
|
26581
|
+
return { operationId, chatId, accepted: accept, counted: counted2 };
|
|
26360
26582
|
}, "answerAllRequests"),
|
|
26361
26583
|
links: /* @__PURE__ */ __name(async (chat, window3) => {
|
|
26362
26584
|
if (deps.offline)
|
|
@@ -26443,7 +26665,7 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
|
|
|
26443
26665
|
return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
|
|
26444
26666
|
}, "linkLimits");
|
|
26445
26667
|
|
|
26446
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26668
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/mail-search.js
|
|
26447
26669
|
var THREADS_PAGE = 500;
|
|
26448
26670
|
var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
|
|
26449
26671
|
const account = await store.accounts.storedAccount(key).catch(() => void 0);
|
|
@@ -26522,7 +26744,7 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 =
|
|
|
26522
26744
|
return thread.slice(Math.max(0, at - before2), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
|
|
26523
26745
|
}, "readMail");
|
|
26524
26746
|
|
|
26525
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26747
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/search-kind.js
|
|
26526
26748
|
var NO_MAIL = "no_mail";
|
|
26527
26749
|
var MAIL = "email";
|
|
26528
26750
|
var listContextOf = /* @__PURE__ */ __name(async (store, account, app, stored) => {
|
|
@@ -26569,7 +26791,7 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
|
|
|
26569
26791
|
return chosenMail.map(({ provider, account }) => ({ provider, account }));
|
|
26570
26792
|
}, "accountsOfKind");
|
|
26571
26793
|
|
|
26572
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26794
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/messages-search.js
|
|
26573
26795
|
var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is"]);
|
|
26574
26796
|
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");
|
|
26575
26797
|
var prepareLucene = /* @__PURE__ */ __name(async (store, account, request, messenger) => {
|
|
@@ -26828,9 +27050,9 @@ var searchLucene = /* @__PURE__ */ __name(async (store, account, request, messen
|
|
|
26828
27050
|
}, "inMailTables");
|
|
26829
27051
|
const found = !prepared.scopeAccounts.length ? { items: [], hasMore: false } : mailAccounts.length ? mergeMail(await execute(prepared.execution), await inMailTables(), request.limit, request.newest) : await execute(prepared.execution);
|
|
26830
27052
|
const { completeness, coverage: coverage2 } = request.kind === "mail" ? { completeness: [], coverage: void 0 } : await coverageOf(store, prepared, messenger);
|
|
26831
|
-
const items = await Promise.all(found.items.map(async (
|
|
26832
|
-
const garbled =
|
|
26833
|
-
const hit = withExcerpt(
|
|
27053
|
+
const items = await Promise.all(found.items.map(async (item2) => {
|
|
27054
|
+
const garbled = item2.corrections?.flatMap(({ to }) => to) ?? [];
|
|
27055
|
+
const hit = withExcerpt(item2, [request.text ?? "", ...garbled].join(" "));
|
|
26834
27056
|
if (!request.context)
|
|
26835
27057
|
return hit;
|
|
26836
27058
|
const locator = parseLocator(hit.locator);
|
|
@@ -26917,7 +27139,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account, request, messeng
|
|
|
26917
27139
|
};
|
|
26918
27140
|
}, "statsLucene");
|
|
26919
27141
|
|
|
26920
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27142
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
|
|
26921
27143
|
var RANKING_SELECTION_BYTES = 64 * 1024;
|
|
26922
27144
|
var object = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
|
|
26923
27145
|
function invalid3(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
|
|
@@ -27086,7 +27308,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
27086
27308
|
};
|
|
27087
27309
|
}, "readRankingSelection");
|
|
27088
27310
|
|
|
27089
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27311
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/search-record.js
|
|
27090
27312
|
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");
|
|
27091
27313
|
var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
|
|
27092
27314
|
command,
|
|
@@ -27096,7 +27318,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
|
|
|
27096
27318
|
fieldsVersion: FIELD_VERSION
|
|
27097
27319
|
}), "searchRecordOf");
|
|
27098
27320
|
|
|
27099
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27321
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
|
|
27100
27322
|
function invalid4(message) {
|
|
27101
27323
|
throw new CliError("validation_error", message);
|
|
27102
27324
|
}
|
|
@@ -27390,7 +27612,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
27390
27612
|
}, "evidence")
|
|
27391
27613
|
}), "adminStatisticsService");
|
|
27392
27614
|
|
|
27393
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27615
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
|
|
27394
27616
|
import { createHash as createHash7, randomUUID as randomUUID4 } from "node:crypto";
|
|
27395
27617
|
var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
|
|
27396
27618
|
var validateRepair = /* @__PURE__ */ __name((messenger, options) => {
|
|
@@ -27527,12 +27749,12 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
|
|
|
27527
27749
|
return { plan, repair };
|
|
27528
27750
|
}, "gapsService");
|
|
27529
27751
|
|
|
27530
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27752
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/attachments.js
|
|
27531
27753
|
import { createHash as createHash9 } from "node:crypto";
|
|
27532
27754
|
import { constants as constants2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
27533
27755
|
import { lstat as lstat4, open as open6, readFile, stat as stat2 } from "node:fs/promises";
|
|
27534
27756
|
|
|
27535
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27757
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/directory.js
|
|
27536
27758
|
import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
|
|
27537
27759
|
import { basename as basename4, join as join9, relative as relative2, sep as sep2 } from "node:path";
|
|
27538
27760
|
var MAX_FILES = 1e4;
|
|
@@ -27603,15 +27825,15 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
|
|
|
27603
27825
|
return choices;
|
|
27604
27826
|
}, "directoryPaths");
|
|
27605
27827
|
|
|
27606
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27828
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/documents.js
|
|
27607
27829
|
import { posix } from "node:path";
|
|
27608
27830
|
|
|
27609
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27831
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/container.js
|
|
27610
27832
|
import { setImmediate as tick } from "node:timers/promises";
|
|
27611
27833
|
import { crc32 } from "node:zlib";
|
|
27612
27834
|
var import_xmldom = __toESM(require_lib(), 1);
|
|
27613
27835
|
|
|
27614
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27836
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
|
|
27615
27837
|
var import_chardet = __toESM(require_lib2(), 1);
|
|
27616
27838
|
var import_iconv_lite = __toESM(require_lib3(), 1);
|
|
27617
27839
|
var SAMPLE = 65536;
|
|
@@ -27713,7 +27935,7 @@ var decodeXml = /* @__PURE__ */ __name((bytes2) => {
|
|
|
27713
27935
|
return result.text;
|
|
27714
27936
|
}, "decodeXml");
|
|
27715
27937
|
|
|
27716
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27938
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/container.js
|
|
27717
27939
|
var MAX_PART = 10 * 1024 * 1024;
|
|
27718
27940
|
var MAX_ENTRIES = 1e3;
|
|
27719
27941
|
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
@@ -27792,8 +28014,8 @@ var readContainer = /* @__PURE__ */ __name(async (bytes2, signal) => {
|
|
|
27792
28014
|
const done2 = /* @__PURE__ */ new Set();
|
|
27793
28015
|
let expanded = 0;
|
|
27794
28016
|
const archive = new Unzip((file2) => {
|
|
27795
|
-
const
|
|
27796
|
-
if (!
|
|
28017
|
+
const expected2 = entries.get(file2.name);
|
|
28018
|
+
if (!expected2 || seen.has(file2.name))
|
|
27797
28019
|
throw new Error("invalid_zip");
|
|
27798
28020
|
seen.add(file2.name);
|
|
27799
28021
|
const keep2 = /\.(xml|rels|opf|xhtml|html)$/i.test(file2.name) || file2.name === "mimetype";
|
|
@@ -27811,7 +28033,7 @@ var readContainer = /* @__PURE__ */ __name(async (bytes2, signal) => {
|
|
|
27811
28033
|
if (keep2)
|
|
27812
28034
|
parts.push(data.slice());
|
|
27813
28035
|
if (final) {
|
|
27814
|
-
if (size2 !==
|
|
28036
|
+
if (size2 !== expected2.size || checksum !== expected2.crc)
|
|
27815
28037
|
throw new Error("invalid_zip");
|
|
27816
28038
|
done2.add(file2.name);
|
|
27817
28039
|
if (keep2) {
|
|
@@ -27928,7 +28150,7 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
|
|
|
27928
28150
|
return found;
|
|
27929
28151
|
}, "elements");
|
|
27930
28152
|
|
|
27931
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28153
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
|
|
27932
28154
|
var columnName = /* @__PURE__ */ __name((column) => {
|
|
27933
28155
|
let name = "";
|
|
27934
28156
|
for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
|
|
@@ -27983,7 +28205,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
|
|
|
27983
28205
|
return { text: parts.join("").trim(), truncated: false };
|
|
27984
28206
|
}, "sheetText");
|
|
27985
28207
|
|
|
27986
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28208
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/documents.js
|
|
27987
28209
|
var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
|
|
27988
28210
|
var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
|
|
27989
28211
|
var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
|
|
@@ -28319,21 +28541,21 @@ var readBook = /* @__PURE__ */ __name((archive, output) => {
|
|
|
28319
28541
|
const book = xmlPart(archive, path);
|
|
28320
28542
|
rootIs(book, "package", [OPF]);
|
|
28321
28543
|
const manifest = /* @__PURE__ */ new Map();
|
|
28322
|
-
for (const
|
|
28323
|
-
const id2 = required(attribute(
|
|
28544
|
+
for (const item2 of elements(book, "item", OPF)) {
|
|
28545
|
+
const id2 = required(attribute(item2, "id"));
|
|
28324
28546
|
if (manifest.has(id2))
|
|
28325
28547
|
throw new Error("duplicate_chapter");
|
|
28326
|
-
manifest.set(id2, { path: target(path, required(attribute(
|
|
28548
|
+
manifest.set(id2, { path: target(path, required(attribute(item2, "href"))), type: attribute(item2, "media-type") });
|
|
28327
28549
|
}
|
|
28328
28550
|
let number2 = 0;
|
|
28329
28551
|
const chapters = elements(book, "itemref", OPF);
|
|
28330
28552
|
if (!chapters.length)
|
|
28331
28553
|
throw new Error("missing_chapters");
|
|
28332
28554
|
for (const chapter of chapters) {
|
|
28333
|
-
const
|
|
28334
|
-
if (
|
|
28555
|
+
const item2 = manifest.get(required(attribute(chapter, "idref")));
|
|
28556
|
+
if (item2?.type !== "application/xhtml+xml")
|
|
28335
28557
|
throw new Error("unsupported_chapter");
|
|
28336
|
-
const document = xmlPart(archive,
|
|
28558
|
+
const document = xmlPart(archive, item2.path);
|
|
28337
28559
|
const bodies = elements(document, "body", XHTML);
|
|
28338
28560
|
if (bodies.length !== 1)
|
|
28339
28561
|
throw new Error("missing_chapter");
|
|
@@ -28383,10 +28605,10 @@ var readDocument = /* @__PURE__ */ __name(async (bytes2, kind, signal) => {
|
|
|
28383
28605
|
}
|
|
28384
28606
|
}, "readDocument");
|
|
28385
28607
|
|
|
28386
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28608
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/extract.js
|
|
28387
28609
|
import { extname as extname3 } from "node:path";
|
|
28388
28610
|
|
|
28389
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28611
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/engine.js
|
|
28390
28612
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
28391
28613
|
import { dirname as dirname4, extname as extname2, join as join10 } from "node:path";
|
|
28392
28614
|
import { fileURLToPath } from "node:url";
|
|
@@ -28447,7 +28669,7 @@ var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
|
|
|
28447
28669
|
}
|
|
28448
28670
|
}, "derived");
|
|
28449
28671
|
|
|
28450
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28672
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/image/index.js
|
|
28451
28673
|
var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
|
|
28452
28674
|
var image2 = {
|
|
28453
28675
|
id: "image",
|
|
@@ -28456,7 +28678,7 @@ var image2 = {
|
|
|
28456
28678
|
read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
|
|
28457
28679
|
};
|
|
28458
28680
|
|
|
28459
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28681
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
|
|
28460
28682
|
var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
|
|
28461
28683
|
var doc = {
|
|
28462
28684
|
id: "doc",
|
|
@@ -28468,7 +28690,7 @@ var doc = {
|
|
|
28468
28690
|
}), "read")
|
|
28469
28691
|
};
|
|
28470
28692
|
|
|
28471
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28693
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
|
|
28472
28694
|
var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
28473
28695
|
var docx = {
|
|
28474
28696
|
id: "docx",
|
|
@@ -28481,7 +28703,7 @@ var docx = {
|
|
|
28481
28703
|
}), "read")
|
|
28482
28704
|
};
|
|
28483
28705
|
|
|
28484
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28706
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/markup.js
|
|
28485
28707
|
var import_iconv_lite2 = __toESM(require_lib3(), 1);
|
|
28486
28708
|
var RTF_SKIPPED = /* @__PURE__ */ new Set([
|
|
28487
28709
|
"fonttbl",
|
|
@@ -28657,7 +28879,7 @@ var htmlText = /* @__PURE__ */ __name((source) => {
|
|
|
28657
28879
|
}, "htmlText");
|
|
28658
28880
|
var safeChar = /* @__PURE__ */ __name((code, fallback) => code > 0 && code <= 1114111 ? String.fromCodePoint(code) : fallback, "safeChar");
|
|
28659
28881
|
|
|
28660
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28882
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/html/page.js
|
|
28661
28883
|
var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
|
|
28662
28884
|
var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
|
|
28663
28885
|
var jsonLdNodes = /* @__PURE__ */ __name((document) => {
|
|
@@ -28713,7 +28935,7 @@ var markdownSections = /* @__PURE__ */ __name((text2) => {
|
|
|
28713
28935
|
return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text2.length }));
|
|
28714
28936
|
}, "markdownSections");
|
|
28715
28937
|
|
|
28716
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28938
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/html/index.js
|
|
28717
28939
|
var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
|
|
28718
28940
|
var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
|
|
28719
28941
|
var loaded = /* @__PURE__ */ __name(async (load, name) => {
|
|
@@ -28784,7 +29006,7 @@ var html = {
|
|
|
28784
29006
|
}, "read")
|
|
28785
29007
|
};
|
|
28786
29008
|
|
|
28787
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29009
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/office/index.js
|
|
28788
29010
|
var office = {
|
|
28789
29011
|
id: "office",
|
|
28790
29012
|
version: documentExtractor("odt"),
|
|
@@ -28795,7 +29017,7 @@ var office = {
|
|
|
28795
29017
|
}, "read")
|
|
28796
29018
|
};
|
|
28797
29019
|
|
|
28798
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29020
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
|
|
28799
29021
|
var pdf = {
|
|
28800
29022
|
id: "pdf",
|
|
28801
29023
|
version: "unpdf",
|
|
@@ -28862,7 +29084,7 @@ var pdf = {
|
|
|
28862
29084
|
}), "read")
|
|
28863
29085
|
};
|
|
28864
29086
|
|
|
28865
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29087
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
|
|
28866
29088
|
var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
|
|
28867
29089
|
var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
|
|
28868
29090
|
var readPlain = /* @__PURE__ */ __name((bytes2) => {
|
|
@@ -28882,7 +29104,7 @@ var plain = {
|
|
|
28882
29104
|
read: /* @__PURE__ */ __name(async (bytes2) => readPlain(bytes2), "read")
|
|
28883
29105
|
};
|
|
28884
29106
|
|
|
28885
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29107
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
|
|
28886
29108
|
var rtf = {
|
|
28887
29109
|
id: "rtf",
|
|
28888
29110
|
version: "v1",
|
|
@@ -28890,10 +29112,10 @@ var rtf = {
|
|
|
28890
29112
|
read: /* @__PURE__ */ __name(async (bytes2) => derived(bytes2, "rtf:v1", rtfText), "read")
|
|
28891
29113
|
};
|
|
28892
29114
|
|
|
28893
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29115
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
|
|
28894
29116
|
import { basename as basename5 } from "node:path";
|
|
28895
29117
|
|
|
28896
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29118
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
|
|
28897
29119
|
var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) => {
|
|
28898
29120
|
const cells = [];
|
|
28899
29121
|
let row = 1, column = 1, start = 0, quoted = false, truncated = false;
|
|
@@ -28931,7 +29153,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) =
|
|
|
28931
29153
|
return { cells, truncated };
|
|
28932
29154
|
}, "delimitedSpans");
|
|
28933
29155
|
|
|
28934
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29156
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
|
|
28935
29157
|
var DELIMITED = {
|
|
28936
29158
|
".csv": ",",
|
|
28937
29159
|
".tsv": " ",
|
|
@@ -28970,7 +29192,7 @@ var sheets = {
|
|
|
28970
29192
|
}, "read")
|
|
28971
29193
|
};
|
|
28972
29194
|
|
|
28973
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29195
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/readers/registry.js
|
|
28974
29196
|
var BUILT_INS2 = [office, pdf, docx, doc, rtf, html, sheets, plain, image2];
|
|
28975
29197
|
var HEAD_BYTES = 1024;
|
|
28976
29198
|
var readers = [...BUILT_INS2];
|
|
@@ -28980,7 +29202,7 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes2, hint, context2) =>
|
|
|
28980
29202
|
return reader ? reader.read(bytes2, hint, context2) : { status: "unsupported" };
|
|
28981
29203
|
}, "readWithRegistry");
|
|
28982
29204
|
|
|
28983
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29205
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/extract.js
|
|
28984
29206
|
var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
|
|
28985
29207
|
var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname3(name ?? path).toLowerCase(), "extensionOf");
|
|
28986
29208
|
var extractText = /* @__PURE__ */ __name(async (bytes2, hint, load, signal, env = process.env) => {
|
|
@@ -30059,7 +30281,7 @@ function imageSize(input) {
|
|
|
30059
30281
|
}
|
|
30060
30282
|
__name(imageSize, "imageSize");
|
|
30061
30283
|
|
|
30062
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30284
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
|
|
30063
30285
|
var MAX_PAGES = 20;
|
|
30064
30286
|
var MAX_PIXELS = 2e7;
|
|
30065
30287
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
@@ -30143,7 +30365,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
|
|
|
30143
30365
|
let text2;
|
|
30144
30366
|
try {
|
|
30145
30367
|
const content = await page.getTextContent();
|
|
30146
|
-
text2 = content.items.map((
|
|
30368
|
+
text2 = content.items.map((item2) => `${item2.str ?? ""}${item2.hasEOL ? "\n" : " "}`).join("").trim();
|
|
30147
30369
|
if (!text2) {
|
|
30148
30370
|
if (typeof unpdf.createIsomorphicCanvasFactory !== "function" || typeof unpdf.renderPageAsImage !== "function")
|
|
30149
30371
|
return { status: "engine-missing", engine: "unpdf" };
|
|
@@ -30210,7 +30432,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
|
|
|
30210
30432
|
}
|
|
30211
30433
|
}, "ocrPdf");
|
|
30212
30434
|
|
|
30213
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30435
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
|
|
30214
30436
|
var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
|
|
30215
30437
|
const limits = pdfPreviewLimits(env);
|
|
30216
30438
|
const cancelled4 = /* @__PURE__ */ __name(() => {
|
|
@@ -30287,7 +30509,7 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
|
|
|
30287
30509
|
}
|
|
30288
30510
|
}, "pdfPreview");
|
|
30289
30511
|
|
|
30290
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30512
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
|
|
30291
30513
|
import { createHash as createHash8 } from "node:crypto";
|
|
30292
30514
|
import { constants } from "node:fs";
|
|
30293
30515
|
import { lstat as lstat3, open as open5 } from "node:fs/promises";
|
|
@@ -30395,7 +30617,7 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
|
|
|
30395
30617
|
return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
|
|
30396
30618
|
}, "transferMime");
|
|
30397
30619
|
|
|
30398
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30620
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/file-download.js
|
|
30399
30621
|
import { createWriteStream, mkdirSync } from "node:fs";
|
|
30400
30622
|
import { link as link3, rm } from "node:fs/promises";
|
|
30401
30623
|
import { join as join11, resolve as resolve6 } from "node:path";
|
|
@@ -30509,7 +30731,7 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
|
|
|
30509
30731
|
}
|
|
30510
30732
|
}, "save");
|
|
30511
30733
|
|
|
30512
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30734
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/attachments.js
|
|
30513
30735
|
var ATTACHMENT_QUERY = {
|
|
30514
30736
|
entity: "attachment",
|
|
30515
30737
|
backend: "sql",
|
|
@@ -30705,7 +30927,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30705
30927
|
issue = batch.fail(formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }), "extract", limitIssue ?? (extraction?.status === "unreadable" && extraction.issue ? extraction.issue : new CliError(status === "missing" ? "not_found" : "validation_error", status === "too-large" ? "attachment exceeds an extraction, decompression or OCR size limit" : extraction?.status === "engine-missing" ? `attachment engine-missing; ${engineMissing(extraction.engine)}; \`doctor\` lists the readers` : `attachment ${status}; retry or skip this item`, { limit_source: ocr ? "provider" : "local" })), file2.position + 1);
|
|
30706
30928
|
} else
|
|
30707
30929
|
batch.ok();
|
|
30708
|
-
const
|
|
30930
|
+
const item2 = {
|
|
30709
30931
|
ref: formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }),
|
|
30710
30932
|
attachment: file2.position + 1,
|
|
30711
30933
|
kind: file2.kind,
|
|
@@ -30720,13 +30942,13 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30720
30942
|
...extraction.pages === void 0 ? {} : { pages: extraction.pages, ocrPages: extraction.ocrPages }
|
|
30721
30943
|
} : {}
|
|
30722
30944
|
};
|
|
30723
|
-
finished.set(file2.pk,
|
|
30724
|
-
onItem?.(
|
|
30945
|
+
finished.set(file2.pk, item2);
|
|
30946
|
+
onItem?.(item2);
|
|
30725
30947
|
}, "processFile");
|
|
30726
30948
|
const failedItem = /* @__PURE__ */ __name((file2, stage, error) => {
|
|
30727
30949
|
const issue = batch.fail(formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }), stage, error, file2.position + 1);
|
|
30728
30950
|
run.failed += 1;
|
|
30729
|
-
const
|
|
30951
|
+
const item2 = {
|
|
30730
30952
|
ref: formatLocator({ ...account, chat: file2.chatId, message: file2.messageId }),
|
|
30731
30953
|
attachment: file2.position + 1,
|
|
30732
30954
|
kind: file2.kind,
|
|
@@ -30735,8 +30957,8 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30735
30957
|
error: issue.code,
|
|
30736
30958
|
issue
|
|
30737
30959
|
};
|
|
30738
|
-
finished.set(file2.pk,
|
|
30739
|
-
onItem?.(
|
|
30960
|
+
finished.set(file2.pk, item2);
|
|
30961
|
+
onItem?.(item2);
|
|
30740
30962
|
}, "failedItem");
|
|
30741
30963
|
try {
|
|
30742
30964
|
walk: for (; ; ) {
|
|
@@ -30796,7 +31018,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30796
31018
|
run.batch = batch.result();
|
|
30797
31019
|
run.complete = false;
|
|
30798
31020
|
}
|
|
30799
|
-
run.items = [...finished.entries()].sort(([a], [b]) => b - a).map(([,
|
|
31021
|
+
run.items = [...finished.entries()].sort(([a], [b]) => b - a).map(([, item2]) => item2);
|
|
30800
31022
|
return run;
|
|
30801
31023
|
}, "extract"),
|
|
30802
31024
|
list: /* @__PURE__ */ __name(async ({ limit, offset = 0, query }) => {
|
|
@@ -30932,7 +31154,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30932
31154
|
}, "setText")
|
|
30933
31155
|
}), "attachmentsService");
|
|
30934
31156
|
|
|
30935
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31157
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
|
|
30936
31158
|
var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
|
|
30937
31159
|
list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
|
|
30938
31160
|
const store = await accountStore(deps);
|
|
@@ -30962,7 +31184,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30962
31184
|
}, "list")
|
|
30963
31185
|
}), "chatDocumentsService");
|
|
30964
31186
|
|
|
30965
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31187
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/retention.js
|
|
30966
31188
|
var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
|
|
30967
31189
|
const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
|
|
30968
31190
|
const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
|
|
@@ -30996,14 +31218,14 @@ var retentionService = /* @__PURE__ */ __name((deps) => ({
|
|
|
30996
31218
|
const result = await store.roster.retention(account, chatId, options);
|
|
30997
31219
|
return {
|
|
30998
31220
|
...result,
|
|
30999
|
-
items: result.items.map((
|
|
31000
|
-
...
|
|
31221
|
+
items: result.items.map((item2) => ({
|
|
31222
|
+
...item2,
|
|
31001
31223
|
drilldown: {
|
|
31002
31224
|
command: "stats messages evidence",
|
|
31003
31225
|
arguments: {
|
|
31004
|
-
message:
|
|
31226
|
+
message: item2.cohort,
|
|
31005
31227
|
component: "report",
|
|
31006
|
-
selection: { kind: "retention", version: 1, account, chatId, cohort:
|
|
31228
|
+
selection: { kind: "retention", version: 1, account, chatId, cohort: item2.cohort, options }
|
|
31007
31229
|
}
|
|
31008
31230
|
}
|
|
31009
31231
|
})),
|
|
@@ -31049,7 +31271,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
|
|
|
31049
31271
|
}
|
|
31050
31272
|
}, "isRetentionSelection");
|
|
31051
31273
|
|
|
31052
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31274
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/counters.js
|
|
31053
31275
|
var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
|
|
31054
31276
|
const fields = text2.split(",").map((one) => one.trim());
|
|
31055
31277
|
if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
|
|
@@ -31112,7 +31334,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
|
|
|
31112
31334
|
fields,
|
|
31113
31335
|
now,
|
|
31114
31336
|
maxAge,
|
|
31115
|
-
items: items.map((
|
|
31337
|
+
items: items.map((item2) => ({ ...item2, counters: item2.counters.filter((one) => fields.includes(one.counter)) })),
|
|
31116
31338
|
hasMore
|
|
31117
31339
|
};
|
|
31118
31340
|
}, "select");
|
|
@@ -31256,7 +31478,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
|
|
|
31256
31478
|
};
|
|
31257
31479
|
}, "countersService");
|
|
31258
31480
|
|
|
31259
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31481
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
|
|
31260
31482
|
var SYNC_KEY = "messages.sync-first";
|
|
31261
31483
|
var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
|
|
31262
31484
|
var keyOf2 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
|
|
@@ -31348,7 +31570,7 @@ var refreshSearch = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
31348
31570
|
}
|
|
31349
31571
|
try {
|
|
31350
31572
|
const newest = (await store.messages.messages(account, chatId, { limit: 1 })).items[0];
|
|
31351
|
-
let
|
|
31573
|
+
let counted2 = 0;
|
|
31352
31574
|
const fetched = await archiveService(deps).fetch(chatId, {
|
|
31353
31575
|
limit: options.maxMessages - result.messages,
|
|
31354
31576
|
pageSize: Math.min(100, deps.messenger.fetching?.maxPageSize ?? 100),
|
|
@@ -31357,11 +31579,11 @@ var refreshSearch = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
31357
31579
|
stop,
|
|
31358
31580
|
note,
|
|
31359
31581
|
onPage: /* @__PURE__ */ __name(({ fetched: fetched2 }) => {
|
|
31360
|
-
result.messages += fetched2 -
|
|
31361
|
-
|
|
31582
|
+
result.messages += fetched2 - counted2;
|
|
31583
|
+
counted2 = fetched2;
|
|
31362
31584
|
}, "onPage")
|
|
31363
31585
|
});
|
|
31364
|
-
result.messages += fetched.fetched -
|
|
31586
|
+
result.messages += fetched.fetched - counted2;
|
|
31365
31587
|
if (fetched.stopped || !fetched.complete && !fetched.reachedSince) {
|
|
31366
31588
|
result.complete = false;
|
|
31367
31589
|
result.failed.push({
|
|
@@ -31388,7 +31610,7 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
|
|
|
31388
31610
|
...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
|
|
31389
31611
|
}), "withRefresh");
|
|
31390
31612
|
|
|
31391
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31613
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
|
|
31392
31614
|
var CANDIDATES = 50;
|
|
31393
31615
|
var WORD_HITS = 200;
|
|
31394
31616
|
var RRF_K = 60;
|
|
@@ -31506,7 +31728,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
31506
31728
|
}, deps.messenger);
|
|
31507
31729
|
const eligibility = filter === void 0 ? void 0 : await store.queries.conversationEligibility(prepared.execution);
|
|
31508
31730
|
const selected = prepared.selectedChat;
|
|
31509
|
-
const
|
|
31731
|
+
const scopeOf4 = /* @__PURE__ */ __name((one) => selected ? selected.account.provider === one.provider && selected.account.account === one.account ? { chatId: selected.chatId } : null : {}, "scopeOf");
|
|
31510
31732
|
const words3 = await byWords(query, prepared, eligibility?.conversations, since);
|
|
31511
31733
|
const meaning = [];
|
|
31512
31734
|
const sources = words3.sources;
|
|
@@ -31514,7 +31736,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
31514
31736
|
await withEmbedder(deps, target2, choice, {}, async (embedder) => {
|
|
31515
31737
|
const [vector] = await embedder.embed([query], "query");
|
|
31516
31738
|
for (const one of prepared.scopeAccounts) {
|
|
31517
|
-
const scope =
|
|
31739
|
+
const scope = scopeOf4(one);
|
|
31518
31740
|
if (scope === null)
|
|
31519
31741
|
continue;
|
|
31520
31742
|
const hits = await store.vectors.nearestConversations(one, {
|
|
@@ -31548,7 +31770,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
|
|
|
31548
31770
|
const scoped = [];
|
|
31549
31771
|
const elsewhere = [];
|
|
31550
31772
|
for (const one of prepared.scopeAccounts) {
|
|
31551
|
-
const scope =
|
|
31773
|
+
const scope = scopeOf4(one);
|
|
31552
31774
|
if (scope === null)
|
|
31553
31775
|
continue;
|
|
31554
31776
|
const eligibleChats = eligibility?.chats.filter(({ account: account2 }) => account2.provider === one.provider && account2.account === one.account).map(({ chat: chat2 }) => chat2);
|
|
@@ -31654,22 +31876,22 @@ var searchReadiness = /* @__PURE__ */ __name((chats, meaning, outside) => {
|
|
|
31654
31876
|
};
|
|
31655
31877
|
}, "searchReadiness");
|
|
31656
31878
|
var meanOf = /* @__PURE__ */ __name((vectors) => {
|
|
31657
|
-
const
|
|
31879
|
+
const mean2 = new Float32Array(vectors[0]?.length ?? 0);
|
|
31658
31880
|
for (const vector of vectors) {
|
|
31659
|
-
for (let index = 0; index <
|
|
31660
|
-
|
|
31881
|
+
for (let index = 0; index < mean2.length; index++)
|
|
31882
|
+
mean2[index] = mean2[index] + vector[index];
|
|
31661
31883
|
}
|
|
31662
|
-
const length = Math.hypot(...
|
|
31663
|
-
return
|
|
31884
|
+
const length = Math.hypot(...mean2) || 1;
|
|
31885
|
+
return mean2.map((value) => value / length);
|
|
31664
31886
|
}, "meanOf");
|
|
31665
31887
|
|
|
31666
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31888
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/embeddings.js
|
|
31667
31889
|
var embeddingsService = /* @__PURE__ */ __name((deps) => ({
|
|
31668
31890
|
...embeddingsMaintenance(deps),
|
|
31669
31891
|
...embeddingsSearch(deps)
|
|
31670
31892
|
}), "embeddingsService");
|
|
31671
31893
|
|
|
31672
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31894
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/folders.js
|
|
31673
31895
|
var foldersService = /* @__PURE__ */ __name((deps) => {
|
|
31674
31896
|
const online = /* @__PURE__ */ __name(async (command) => {
|
|
31675
31897
|
if (deps.offline)
|
|
@@ -31810,7 +32032,7 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
|
|
|
31810
32032
|
};
|
|
31811
32033
|
}, "foldersService");
|
|
31812
32034
|
|
|
31813
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32035
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/mentions.js
|
|
31814
32036
|
var REVIEW_COUNT = 500;
|
|
31815
32037
|
var mentionsService = /* @__PURE__ */ __name((deps) => {
|
|
31816
32038
|
const located = /* @__PURE__ */ __name(async () => {
|
|
@@ -31889,7 +32111,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
|
|
|
31889
32111
|
};
|
|
31890
32112
|
}, "mentionsService");
|
|
31891
32113
|
|
|
31892
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32114
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/message-link.js
|
|
31893
32115
|
var fileLinks = /* @__PURE__ */ __name((attachments) => hitFiles(attachments).map(({ position, kind, name }) => ({
|
|
31894
32116
|
position,
|
|
31895
32117
|
kind,
|
|
@@ -31938,7 +32160,7 @@ var validatePermalink = /* @__PURE__ */ __name((link4) => {
|
|
|
31938
32160
|
return { url: link4.url, access: link4.access, reason: link4.reason };
|
|
31939
32161
|
}, "validatePermalink");
|
|
31940
32162
|
|
|
31941
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32163
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
|
|
31942
32164
|
var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
|
|
31943
32165
|
if (seconds % 86400 === 0 && seconds > 86400)
|
|
31944
32166
|
return `${seconds / 86400}d`;
|
|
@@ -31970,7 +32192,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
|
|
|
31970
32192
|
return seconds;
|
|
31971
32193
|
}, "pinDurationOf");
|
|
31972
32194
|
|
|
31973
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32195
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/sends/send-as.js
|
|
31974
32196
|
var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
|
|
31975
32197
|
if (sendAs === void 0) {
|
|
31976
32198
|
const saved = connection.savedSender?.bind(connection);
|
|
@@ -31995,7 +32217,7 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
|
|
|
31995
32217
|
return sendAs;
|
|
31996
32218
|
}, "typedSendAs");
|
|
31997
32219
|
|
|
31998
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32220
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/search/total.js
|
|
31999
32221
|
var TOTAL_CAP = 1e4;
|
|
32000
32222
|
var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
|
|
32001
32223
|
const least = shown + (hasMore ? 1 : 0);
|
|
@@ -32006,7 +32228,7 @@ var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
|
|
|
32006
32228
|
return { value: count4, relation: exact ? "eq" : "gte" };
|
|
32007
32229
|
}, "totalOf");
|
|
32008
32230
|
|
|
32009
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32231
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
|
|
32010
32232
|
var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
|
|
32011
32233
|
var fieldsOfQuery = /* @__PURE__ */ __name((root, everything) => {
|
|
32012
32234
|
let narrows = false;
|
|
@@ -32035,7 +32257,7 @@ var meaningWords = /* @__PURE__ */ __name((root) => {
|
|
|
32035
32257
|
return wanted(root).join(" ").trim();
|
|
32036
32258
|
}, "meaningWords");
|
|
32037
32259
|
|
|
32038
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32260
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/search/question-plan.js
|
|
32039
32261
|
var words2 = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
|
|
32040
32262
|
var scaffolding = new Set(words2("what which how many much who where when is are was were do does did can could should we the a an for of to under from in on at has have \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u043E\u0435 \u043A\u0442\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u0447\u0442\u043E \u0432\u043E \u043F\u043E \u043D\u0430 \u0432 \u043A \u0441 \u0443 \u0447\u0435\u0440\u0435\u0437 \u043B\u0438 \u0434\u043E\u043B\u0436\u0435\u043D \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0443\u0436\u043D\u043E \u0438\u0434\u0451\u0442 \u0438\u0434\u0435\u0442 \u043C\u043E\u0436\u043D\u043E \u043C\u043E\u0436\u0435\u0442 \u043C\u043E\u0433\u0443\u0442"));
|
|
32041
32263
|
var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
|
|
@@ -32149,8 +32371,25 @@ function planQuestion(text2, strict = false) {
|
|
|
32149
32371
|
return { changed: true, natural: true, queries, scope, terms, rankingTerms: original, removed, aliases: changes };
|
|
32150
32372
|
}
|
|
32151
32373
|
__name(planQuestion, "planQuestion");
|
|
32374
|
+
var questionText = /* @__PURE__ */ __name((text2) => text2.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found), "questionText");
|
|
32375
|
+
var lookupTerms = /* @__PURE__ */ __name((plan) => [
|
|
32376
|
+
...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words2(alias.split(" -> ")[1] ?? ""))))
|
|
32377
|
+
], "lookupTerms");
|
|
32378
|
+
var anyOfTerms = /* @__PURE__ */ __name((terms, scope) => `(${terms.join(" OR ")})${scope ? ` ${scope}` : ""}`, "anyOfTerms");
|
|
32379
|
+
var questionLookup = /* @__PURE__ */ __name((text2) => {
|
|
32380
|
+
let plan;
|
|
32381
|
+
try {
|
|
32382
|
+
plan = planQuestion(questionText(text2));
|
|
32383
|
+
} catch (error) {
|
|
32384
|
+
if (error instanceof CliError)
|
|
32385
|
+
return void 0;
|
|
32386
|
+
throw error;
|
|
32387
|
+
}
|
|
32388
|
+
const terms = plan.changed ? lookupTerms(plan) : [];
|
|
32389
|
+
return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
|
|
32390
|
+
}, "questionLookup");
|
|
32152
32391
|
|
|
32153
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32392
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
|
|
32154
32393
|
var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
|
|
32155
32394
|
var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
|
|
32156
32395
|
var searchCombined = /* @__PURE__ */ __name(async (store, account, request, messenger = {}, options = COMBINED_DEFAULTS) => {
|
|
@@ -32274,8 +32513,8 @@ var searchCombined = /* @__PURE__ */ __name(async (store, account, request, mess
|
|
|
32274
32513
|
return finish(listed2.map(({ fused: _fused, ...hit }) => hit), ordered.length > request.limit || truncated, usedCorrections, truncated, true);
|
|
32275
32514
|
async function finish(items, hasMore, listed3, truncated2, expanded) {
|
|
32276
32515
|
const { completeness, coverage: coverage2 } = request.kind === "mail" ? { completeness: [], coverage: void 0 } : await coverageOf(store, prepared, messenger);
|
|
32277
|
-
const hydrated = await Promise.all(items.map(async (
|
|
32278
|
-
const hit = withExcerpt(
|
|
32516
|
+
const hydrated = await Promise.all(items.map(async (item2) => {
|
|
32517
|
+
const hit = withExcerpt(item2, request.text ?? "");
|
|
32279
32518
|
if (!request.context)
|
|
32280
32519
|
return hit;
|
|
32281
32520
|
const { provider, account: account2 } = parseLocator(hit.locator);
|
|
@@ -32343,7 +32582,7 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
|
|
|
32343
32582
|
return mode === "coverage" ? coverage2 * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase : coverage2 * 4 + proximity + phrase;
|
|
32344
32583
|
}, "signals");
|
|
32345
32584
|
|
|
32346
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32585
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
|
|
32347
32586
|
var MEANING_DEPTH = 100;
|
|
32348
32587
|
var RRF_K2 = 60;
|
|
32349
32588
|
var RERANK_DEPTH = 50;
|
|
@@ -32365,10 +32604,7 @@ var EVERY_MESSAGE = {
|
|
|
32365
32604
|
upper_inclusive: true
|
|
32366
32605
|
};
|
|
32367
32606
|
var scopeOf2 = /* @__PURE__ */ __name((root) => root === void 0 ? {} : { ast: { version: 1, language: "lucene-v1", root } }, "scopeOf");
|
|
32368
|
-
var discoveryRequest = /* @__PURE__ */ __name((asked) => asked.ast !== void 0 || asked.exact || !asked.text ? asked : {
|
|
32369
|
-
...asked,
|
|
32370
|
-
text: asked.text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found)
|
|
32371
|
-
}, "discoveryRequest");
|
|
32607
|
+
var discoveryRequest = /* @__PURE__ */ __name((asked) => asked.ast !== void 0 || asked.exact || !asked.text ? asked : { ...asked, text: questionText(asked.text) }, "discoveryRequest");
|
|
32372
32608
|
var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messenger = {}, meaning, rerank) => {
|
|
32373
32609
|
const request = discoveryRequest(asked);
|
|
32374
32610
|
const original = await prepareLucene(store, account, request, messenger);
|
|
@@ -32382,7 +32618,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
|
|
|
32382
32618
|
const question = root === void 0 ? text2 : meaningWords(root);
|
|
32383
32619
|
if (!question)
|
|
32384
32620
|
return searchLucene(store, account, request, messenger);
|
|
32385
|
-
const terms = root === void 0 ?
|
|
32621
|
+
const terms = root === void 0 ? lookupTerms(plan) : [...new Set(words2(question))];
|
|
32386
32622
|
if (!terms.length)
|
|
32387
32623
|
return searchLucene(store, account, request, messenger);
|
|
32388
32624
|
if (terms.length > 64)
|
|
@@ -32419,7 +32655,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
|
|
|
32419
32655
|
truncated ||= found.hasMore || found.query.combined.truncated;
|
|
32420
32656
|
}
|
|
32421
32657
|
check2();
|
|
32422
|
-
const relaxed = root === void 0 ?
|
|
32658
|
+
const relaxed = root === void 0 ? anyOfTerms(terms, plan.scope) : text2;
|
|
32423
32659
|
const partialRequest = { ...request, text: relaxed, ast: void 0, limit: 300, context: 0, thread: void 0 };
|
|
32424
32660
|
const partial = await searchLucene(store, account, partialRequest, messenger);
|
|
32425
32661
|
add(partial.items);
|
|
@@ -32671,7 +32907,7 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
|
|
|
32671
32907
|
})).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
|
|
32672
32908
|
}, "mixedWithReranker");
|
|
32673
32909
|
|
|
32674
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32910
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/thread-context.js
|
|
32675
32911
|
var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
|
|
32676
32912
|
var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
|
|
32677
32913
|
var threadBounds = /* @__PURE__ */ __name((options = {}) => {
|
|
@@ -32741,8 +32977,8 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32741
32977
|
stopped("messages");
|
|
32742
32978
|
const neighbours = anchor ? await around(message, before2, after) : [];
|
|
32743
32979
|
const nearest = neighbours.sort((a, b) => Number(a.id !== message) - Number(b.id !== message) || Math.abs(Date.parse(a.timestamp) - Date.parse(anchor?.timestamp ?? "")) - Math.abs(Date.parse(b.timestamp) - Date.parse(anchor?.timestamp ?? "")));
|
|
32744
|
-
for (const
|
|
32745
|
-
if (
|
|
32980
|
+
for (const item2 of nearest) {
|
|
32981
|
+
if (item2.threadId !== anchor?.threadId) {
|
|
32746
32982
|
stopped("thread");
|
|
32747
32983
|
continue;
|
|
32748
32984
|
}
|
|
@@ -32750,15 +32986,15 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32750
32986
|
stopped("messages");
|
|
32751
32987
|
break;
|
|
32752
32988
|
}
|
|
32753
|
-
if (Math.abs(Date.parse(
|
|
32989
|
+
if (Math.abs(Date.parse(item2.timestamp) - Date.parse(anchor?.timestamp ?? "")) > bounds.withinMs) {
|
|
32754
32990
|
stopped("time");
|
|
32755
32991
|
continue;
|
|
32756
32992
|
}
|
|
32757
|
-
if (bytes([...result.items,
|
|
32993
|
+
if (bytes([...result.items, item2], []) > bounds.maxBytes) {
|
|
32758
32994
|
stopped("bytes");
|
|
32759
32995
|
break;
|
|
32760
32996
|
}
|
|
32761
|
-
result.items.push(
|
|
32997
|
+
result.items.push(item2);
|
|
32762
32998
|
}
|
|
32763
32999
|
result.items.sort((a, b) => a.timestamp.localeCompare(b.timestamp) || a.id.localeCompare(b.id));
|
|
32764
33000
|
return result;
|
|
@@ -32788,16 +33024,16 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32788
33024
|
break;
|
|
32789
33025
|
}
|
|
32790
33026
|
const node = queue[index];
|
|
32791
|
-
const [
|
|
32792
|
-
if (!
|
|
33027
|
+
const [item2] = node.id === message ? [anchor] : await around(node.id);
|
|
33028
|
+
if (!item2) {
|
|
32793
33029
|
result.stale = true;
|
|
32794
33030
|
continue;
|
|
32795
33031
|
}
|
|
32796
|
-
if (Math.abs(Date.parse(
|
|
33032
|
+
if (Math.abs(Date.parse(item2.timestamp) - at) > bounds.withinMs) {
|
|
32797
33033
|
stopped("time");
|
|
32798
33034
|
continue;
|
|
32799
33035
|
}
|
|
32800
|
-
if (
|
|
33036
|
+
if (item2.threadId !== anchor.threadId) {
|
|
32801
33037
|
stopped("thread");
|
|
32802
33038
|
continue;
|
|
32803
33039
|
}
|
|
@@ -32805,7 +33041,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32805
33041
|
stopped("messages");
|
|
32806
33042
|
break;
|
|
32807
33043
|
}
|
|
32808
|
-
const { anchor: _anchor, ...body } =
|
|
33044
|
+
const { anchor: _anchor, ...body } = item2;
|
|
32809
33045
|
const displayed2 = node.id === message ? { ...body, anchor: true } : body;
|
|
32810
33046
|
const own = await linksOf(node.id);
|
|
32811
33047
|
const parent = chosen(own);
|
|
@@ -32870,7 +33106,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
|
|
|
32870
33106
|
return result;
|
|
32871
33107
|
}, "readThreadContext");
|
|
32872
33108
|
|
|
32873
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33109
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
|
|
32874
33110
|
var SEARCH_FILL_MS = 200;
|
|
32875
33111
|
var statsStore = /* @__PURE__ */ __name(async (store, account, request, messenger = {}) => {
|
|
32876
33112
|
const stop = Date.now() + SEARCH_FILL_MS;
|
|
@@ -32937,12 +33173,12 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
|
|
|
32937
33173
|
}, "accountOf");
|
|
32938
33174
|
var keyOf3 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}/${account}`, "keyOf");
|
|
32939
33175
|
|
|
32940
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33176
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/pictures.js
|
|
32941
33177
|
import { createHash as createHash10 } from "node:crypto";
|
|
32942
33178
|
import { readFile as readFile2, stat as stat3 } from "node:fs/promises";
|
|
32943
33179
|
import { setTimeout as sleep4 } from "node:timers/promises";
|
|
32944
33180
|
|
|
32945
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33181
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/models.js
|
|
32946
33182
|
var GROUP_SETTINGS = [
|
|
32947
33183
|
"allCanPin",
|
|
32948
33184
|
"onlyAdminsAdd",
|
|
@@ -32956,7 +33192,7 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
|
|
|
32956
33192
|
var senderIsMe = /* @__PURE__ */ __name((message, account) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account, "senderIsMe");
|
|
32957
33193
|
var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
|
|
32958
33194
|
|
|
32959
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33195
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/pictures.js
|
|
32960
33196
|
var PICTURE_MAX_BYTES = 25 * 1024 * 1024;
|
|
32961
33197
|
var PICTURE_FLOOR = 0.25;
|
|
32962
33198
|
var PAGE5 = 50;
|
|
@@ -32973,7 +33209,7 @@ var picturesService = /* @__PURE__ */ __name((deps) => {
|
|
|
32973
33209
|
const directory2 = imageModelsDirectory(deps.env);
|
|
32974
33210
|
if (!isImageModelInstalled(model2, directory2))
|
|
32975
33211
|
throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
|
|
32976
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
33212
|
+
const { openPictureEmbedder } = await import("./embedder-KBBRYSNH.js");
|
|
32977
33213
|
return openPictureEmbedder(model2, directory2);
|
|
32978
33214
|
}, "open");
|
|
32979
33215
|
const embedder = /* @__PURE__ */ __name(() => {
|
|
@@ -33170,7 +33406,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
|
|
|
33170
33406
|
}, "search")
|
|
33171
33407
|
}), "withPictures");
|
|
33172
33408
|
|
|
33173
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33409
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
|
|
33174
33410
|
var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, shared, within) => {
|
|
33175
33411
|
const target2 = embeddingTarget(deps, DEFAULT_TEXT_MODEL);
|
|
33176
33412
|
const skipped = /* @__PURE__ */ __name((reason, step) => ({
|
|
@@ -33181,9 +33417,16 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
33181
33417
|
const store = await deps.store();
|
|
33182
33418
|
const ready = [];
|
|
33183
33419
|
const without = [];
|
|
33184
|
-
|
|
33185
|
-
|
|
33186
|
-
|
|
33420
|
+
const mail = /* @__PURE__ */ new Map();
|
|
33421
|
+
const stored = await store.accounts.storedAccounts();
|
|
33422
|
+
for (const one of accounts) {
|
|
33423
|
+
const id2 = one.provider === "email" ? stored.find(({ provider, account }) => provider === one.provider && account === one.account)?.id : void 0;
|
|
33424
|
+
if (id2 !== void 0)
|
|
33425
|
+
mail.set(one, Number(id2));
|
|
33426
|
+
else
|
|
33427
|
+
(await store.vectors.hasMessageVectors(one, target2.key) ? ready : without).push(one);
|
|
33428
|
+
}
|
|
33429
|
+
if (ready.length === 0 && mail.size === 0)
|
|
33187
33430
|
return skipped("no message has a vector yet", "conversations.rebuild");
|
|
33188
33431
|
const words3 = plainWords(question);
|
|
33189
33432
|
try {
|
|
@@ -33201,12 +33444,24 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
33201
33444
|
for (const { chatId, messageId, score } of near2)
|
|
33202
33445
|
ranked.push({ ...one, chatId, id: messageId, score });
|
|
33203
33446
|
}
|
|
33447
|
+
for (const [one, accountId] of mail) {
|
|
33448
|
+
const near2 = await store.mail.nearest(target2.key, query, {
|
|
33449
|
+
accountId,
|
|
33450
|
+
limit: MEANING_DEPTH
|
|
33451
|
+
});
|
|
33452
|
+
if (near2.length === 0)
|
|
33453
|
+
without.push(one);
|
|
33454
|
+
for (const { threadExternalId, externalId, score } of near2)
|
|
33455
|
+
ranked.push({ ...one, chatId: threadExternalId, id: externalId, score });
|
|
33456
|
+
}
|
|
33204
33457
|
}, "lookUp");
|
|
33205
33458
|
if (shared && !deps.embedders)
|
|
33206
33459
|
await lookUp(await shared.get(target2.key, () => target2.open()));
|
|
33207
33460
|
else
|
|
33208
33461
|
await withEmbedder(deps, target2, DEFAULT_TEXT_MODEL, {}, lookUp);
|
|
33209
33462
|
}
|
|
33463
|
+
if (ranked.length === 0 && without.length === accounts.length)
|
|
33464
|
+
return skipped("no message has a vector yet", "conversations.rebuild");
|
|
33210
33465
|
return {
|
|
33211
33466
|
model: target2.id,
|
|
33212
33467
|
ranked: ranked.sort((a, b) => b.score - a.score).slice(0, MEANING_DEPTH),
|
|
@@ -33219,7 +33474,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
33219
33474
|
}
|
|
33220
33475
|
}, "meaningLane");
|
|
33221
33476
|
|
|
33222
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33477
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
|
|
33223
33478
|
var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
33224
33479
|
const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
|
|
33225
33480
|
if (choice === "off")
|
|
@@ -33231,9 +33486,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
|
33231
33486
|
return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
|
|
33232
33487
|
try {
|
|
33233
33488
|
const warm = deps.embedders;
|
|
33234
|
-
const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-
|
|
33489
|
+
const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-3CVLTCTA.js")).openRerankerProcess(model, directory2, {
|
|
33235
33490
|
threads: defaultThreads()
|
|
33236
|
-
})) : await (await import("./rerank-
|
|
33491
|
+
})) : await (await import("./rerank-OWSTDLZN.js")).openReranker(model, directory2);
|
|
33237
33492
|
return {
|
|
33238
33493
|
model: model.id,
|
|
33239
33494
|
score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
|
|
@@ -33253,17 +33508,17 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
|
33253
33508
|
};
|
|
33254
33509
|
}, "rerankLane");
|
|
33255
33510
|
|
|
33256
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33511
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
|
|
33257
33512
|
var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
|
|
33258
33513
|
const model = imageModel(DEFAULT_IMAGE_MODEL);
|
|
33259
33514
|
const directory2 = imageModelsDirectory(env);
|
|
33260
33515
|
if (!isImageModelInstalled(model, directory2))
|
|
33261
33516
|
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 });
|
|
33262
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
33517
|
+
const { openPictureEmbedder } = await import("./embedder-KBBRYSNH.js");
|
|
33263
33518
|
return openPictureEmbedder(model, directory2);
|
|
33264
33519
|
}, "openPictureEmbedderFor");
|
|
33265
33520
|
|
|
33266
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33521
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/document-source.js
|
|
33267
33522
|
var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) => {
|
|
33268
33523
|
const metadata = note.frontMatter;
|
|
33269
33524
|
const account = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
|
|
@@ -33278,7 +33533,7 @@ var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) =>
|
|
|
33278
33533
|
};
|
|
33279
33534
|
}, "documentSource");
|
|
33280
33535
|
|
|
33281
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33536
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
|
|
33282
33537
|
var plainQueryWords = /* @__PURE__ */ __name((query) => {
|
|
33283
33538
|
let root;
|
|
33284
33539
|
try {
|
|
@@ -33305,7 +33560,7 @@ var titleTiers = /* @__PURE__ */ __name((hits, words3) => {
|
|
|
33305
33560
|
return [...hits].sort((a, b) => rank(a) - rank(b));
|
|
33306
33561
|
}, "titleTiers");
|
|
33307
33562
|
|
|
33308
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33563
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/notes-search.js
|
|
33309
33564
|
var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
|
|
33310
33565
|
var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
|
|
33311
33566
|
var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
|
|
@@ -33520,19 +33775,21 @@ var notesTotal = /* @__PURE__ */ __name(async (store, text2, { exact, scope, sho
|
|
|
33520
33775
|
const count4 = (/* @__PURE__ */ new Set([...words3.refs, ...others])).size + (words3.hasMore ? 1 : 0);
|
|
33521
33776
|
return totalOf(count4, shown, hasMore, othersComplete);
|
|
33522
33777
|
}, "notesTotal");
|
|
33523
|
-
var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, tag, filter: expression, folderIds, withInternal, source: given, exact = false, timezone, env, command, embedders, pictures: withPictures2 = false, pictureLimit = 5, pictureEmbedder } = {}) => {
|
|
33778
|
+
var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, tag, filter: expression, folderIds, withInternal, source: given, exact = false, discover = false, timezone, env, command, embedders, pictures: withPictures2 = false, pictureLimit = 5, pictureEmbedder } = {}) => {
|
|
33524
33779
|
const typed = noteSourceOfQuery(query);
|
|
33525
33780
|
const source = given ?? typed.source;
|
|
33526
33781
|
const rest = typed.source !== void 0 && typed.source === source ? typed.rest : query;
|
|
33527
33782
|
const label = tag === void 0 ? void 0 : normalizeTag(tag);
|
|
33528
33783
|
const filter = [expression ? `(${expression})` : "", label === void 0 ? "" : `tag:${label}`].filter(Boolean).join(" AND ") || void 0;
|
|
33529
|
-
const
|
|
33784
|
+
const lookup2 = discover && !exact ? questionLookup(query) : void 0;
|
|
33785
|
+
const parsed = query.trim() ? parsedQuery(lookup2 === void 0 ? query : questionText(query), exact) : void 0;
|
|
33530
33786
|
const words3 = parsed === void 0 ? "" : meaningWords(parsed);
|
|
33531
33787
|
const narrowing = allOf([
|
|
33532
33788
|
...parsed === void 0 ? [] : [fieldsOfQuery2(parsed)].filter((node) => node !== void 0),
|
|
33533
33789
|
...filter === void 0 ? [] : [parsedQuery(filter)]
|
|
33534
33790
|
]);
|
|
33535
|
-
const
|
|
33791
|
+
const asked = lookup2 ?? query;
|
|
33792
|
+
const text2 = [asked.trim() ? `(${asked})` : "", filter ?? ""].filter(Boolean).join(" AND ");
|
|
33536
33793
|
const window3 = offset + limit;
|
|
33537
33794
|
const scope = {
|
|
33538
33795
|
...folderIds === void 0 ? {} : { folderIds },
|
|
@@ -33542,6 +33799,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33542
33799
|
};
|
|
33543
33800
|
let meaningSkipped;
|
|
33544
33801
|
let meaning;
|
|
33802
|
+
const cosines = /* @__PURE__ */ new Map();
|
|
33545
33803
|
let meaningRefs;
|
|
33546
33804
|
let meaningComplete = true;
|
|
33547
33805
|
if (exact)
|
|
@@ -33568,8 +33826,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33568
33826
|
nearest = ranked2.slice(0, depth);
|
|
33569
33827
|
}
|
|
33570
33828
|
const allowed = await matching(store, nearest.map(({ ref }) => ref), narrowing, scope);
|
|
33571
|
-
meaning = nearest.flatMap(({ ref }) => {
|
|
33829
|
+
meaning = nearest.flatMap(({ ref, score }) => {
|
|
33572
33830
|
const found = allowed.get(ref);
|
|
33831
|
+
if (found)
|
|
33832
|
+
cosines.set(ref, score);
|
|
33573
33833
|
return found ? [{ ref, ...found }] : [];
|
|
33574
33834
|
});
|
|
33575
33835
|
meaningRefs ??= new Set(meaning.map(({ ref }) => ref));
|
|
@@ -33579,13 +33839,13 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33579
33839
|
meaningSkipped = error.message;
|
|
33580
33840
|
}
|
|
33581
33841
|
}
|
|
33582
|
-
const
|
|
33583
|
-
const titled =
|
|
33584
|
-
text: [titleQuery(
|
|
33842
|
+
const titleWords2 = plainQueryWords(rest);
|
|
33843
|
+
const titled = titleWords2 === void 0 ? { items: [], hasMore: false } : await searchNotesQuery(store, {
|
|
33844
|
+
text: [titleQuery(titleWords2), filter ?? ""].filter(Boolean).join(" AND "),
|
|
33585
33845
|
limit: Math.max(window3, CANDIDATES2),
|
|
33586
33846
|
...scope
|
|
33587
33847
|
});
|
|
33588
|
-
const tier =
|
|
33848
|
+
const tier = titleWords2 === void 0 ? [] : titleTiers(titled.items, titleWords2);
|
|
33589
33849
|
const tierRefs = new Set(tier.map(({ ref }) => ref));
|
|
33590
33850
|
const slice = meaning === void 0 && tier.length === 0;
|
|
33591
33851
|
const matched = await searchNotesQuery(store, {
|
|
@@ -33600,9 +33860,11 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33600
33860
|
if (tierRefs.has(ref))
|
|
33601
33861
|
return;
|
|
33602
33862
|
const held = ranked.get(ref) ?? { note, at, score: 0, foundBy: [] };
|
|
33603
|
-
held.score += 1 / (RRF_K3 + rank + 1);
|
|
33604
33863
|
held.foundBy.push(by);
|
|
33605
33864
|
ranked.set(ref, held);
|
|
33865
|
+
if (by === "meaning" && lookup2 !== void 0 && held.foundBy.includes("words"))
|
|
33866
|
+
return;
|
|
33867
|
+
held.score += 1 / (RRF_K3 + rank + 1);
|
|
33606
33868
|
}), "add");
|
|
33607
33869
|
add(matched.items, "words");
|
|
33608
33870
|
if (meaning !== void 0)
|
|
@@ -33635,7 +33897,8 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
33635
33897
|
updated_at: at,
|
|
33636
33898
|
excerpt: firstLine(note.text, words3),
|
|
33637
33899
|
links,
|
|
33638
|
-
found_by: foundBy
|
|
33900
|
+
found_by: foundBy,
|
|
33901
|
+
...cosines.has(ref) ? { meaning_score: cosines.get(ref) } : {}
|
|
33639
33902
|
});
|
|
33640
33903
|
for (const link4 of new Map(links.map((link5) => [link5.to ?? `?${link5.target_text}`, link5])).values()) {
|
|
33641
33904
|
const key = link4.to ?? `?${link4.target_text}`;
|
|
@@ -33714,7 +33977,7 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text2, { accou
|
|
|
33714
33977
|
};
|
|
33715
33978
|
}, "searchNotesOf");
|
|
33716
33979
|
|
|
33717
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33980
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/events-search.js
|
|
33718
33981
|
var MAX_EVENTS_OFFSET = 1e3;
|
|
33719
33982
|
var iso3 = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
|
|
33720
33983
|
var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
|
|
@@ -33748,17 +34011,18 @@ var nearestEvents = /* @__PURE__ */ __name(async (store, words3, { limit, accoun
|
|
|
33748
34011
|
return (await store.calendar.nearest(key, vector, { limit, ...accountIds ? { accountIds } : {} })).filter(({ score }) => score > floor);
|
|
33749
34012
|
}, "nearestEvents");
|
|
33750
34013
|
var keyOf4 = /* @__PURE__ */ __name(({ event }) => event.eventSeriesId === null ? `e${event.id}` : `s${event.eventSeriesId}`, "keyOf");
|
|
33751
|
-
var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, accounts, exact, newest, timezone, signal, candidates, env, command, embedders } = {}) => {
|
|
34014
|
+
var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, accounts, exact, discover, newest, timezone, signal, candidates, env, command, embedders } = {}) => {
|
|
33752
34015
|
if (!query.trim())
|
|
33753
34016
|
throw new CliError("validation_error", "say what to find in the events");
|
|
33754
|
-
const
|
|
34017
|
+
const asked = discover && !exact && !newest ? questionLookup(query) : void 0;
|
|
34018
|
+
const { root, stemmer } = await storeQuery(store, asked ?? query, {
|
|
33755
34019
|
...exact ? { exact: true } : {},
|
|
33756
34020
|
...timezone === void 0 ? {} : { timezone }
|
|
33757
34021
|
});
|
|
33758
34022
|
const accountIds = accounts === void 0 ? void 0 : await accountIdsOf(store, accounts);
|
|
33759
34023
|
if (accountIds?.length === 0)
|
|
33760
34024
|
return { query, by: "words", hits: [], has_more: false };
|
|
33761
|
-
const words3 = plainQueryWords(query);
|
|
34025
|
+
const words3 = plainQueryWords(asked === void 0 ? query : questionText(query));
|
|
33762
34026
|
const window3 = offset + limit;
|
|
33763
34027
|
let meaningSkipped;
|
|
33764
34028
|
let meaning;
|
|
@@ -33814,20 +34078,24 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
|
|
|
33814
34078
|
}), "add");
|
|
33815
34079
|
add(found.items, "words");
|
|
33816
34080
|
add(meaning, "meaning");
|
|
34081
|
+
const cosines = new Map(meaning.map((hit) => [keyOf4(hit), hit.score]));
|
|
33817
34082
|
const ordered = [...ranked.values()].sort((a, b) => b.score - a.score);
|
|
33818
34083
|
const hasMore = ordered.length > window3 || found.hasMore;
|
|
33819
34084
|
return {
|
|
33820
34085
|
query,
|
|
33821
34086
|
by,
|
|
33822
|
-
hits: ordered.slice(offset, window3).map(({ hit, by: halves }) =>
|
|
34087
|
+
hits: ordered.slice(offset, window3).map(({ hit, by: halves }) => {
|
|
34088
|
+
const cosine = cosines.get(keyOf4(hit));
|
|
34089
|
+
return { ...foundEvent(hit, query, halves), ...cosine === void 0 ? {} : { meaning_score: cosine } };
|
|
34090
|
+
}),
|
|
33823
34091
|
has_more: hasMore,
|
|
33824
34092
|
...hasMore && window3 <= MAX_EVENTS_OFFSET ? { next_offset: window3 } : {},
|
|
33825
34093
|
...truncated
|
|
33826
34094
|
};
|
|
33827
34095
|
}, "searchEvents");
|
|
33828
34096
|
|
|
33829
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33830
|
-
var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events"];
|
|
34097
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/search-all.js
|
|
34098
|
+
var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events", "crm"];
|
|
33831
34099
|
var skippable = /* @__PURE__ */ __name((error) => error instanceof CliError && (error.code === "validation_error" || error.code === "not_found"), "skippable");
|
|
33832
34100
|
var filtersBeside = /* @__PURE__ */ __name((text2) => {
|
|
33833
34101
|
const { root } = parseLucene(text2, MESSAGE_PARSING);
|
|
@@ -33835,6 +34103,15 @@ var filtersBeside = /* @__PURE__ */ __name((text2) => {
|
|
|
33835
34103
|
const top = root.kind === "boolean" ? root.clauses : [{ node: root, occur: "must" }];
|
|
33836
34104
|
return top.every(({ node, occur }) => occur !== "must_not" && followable(node, occur === "must")) ? planQuestion(text2).scope : void 0;
|
|
33837
34105
|
}, "filtersBeside");
|
|
34106
|
+
var titleWords = /* @__PURE__ */ __name((text2) => {
|
|
34107
|
+
const { root } = parseLucene(text2, SEARCH_QUERY);
|
|
34108
|
+
const clauses = root.kind === "boolean" ? root.clauses : [{ node: root, occur: "must" }];
|
|
34109
|
+
const words3 = clauses.map(({ node, occur }) => occur !== "must_not" && node.kind === "predicate" && node.field === "text" && (node.operator === "term" || node.operator === "phrase") ? node.value : (() => {
|
|
34110
|
+
throw new CliError("validation_error", "deals and leads are found by the words of their title only");
|
|
34111
|
+
})());
|
|
34112
|
+
return { words: words3, anyWord: clauses.length > 1 && clauses.every(({ occur }) => occur === "should") };
|
|
34113
|
+
}, "titleWords");
|
|
34114
|
+
var crmAccounts = /* @__PURE__ */ __name(async (store) => (await store.accounts.accounts()).filter(({ provider }) => kindIn(provider) === "crm"), "crmAccounts");
|
|
33838
34115
|
var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger = {}, searchMessages = (query) => searchStore(store, account, query, messenger), meaning) => {
|
|
33839
34116
|
if (!request.text.trim())
|
|
33840
34117
|
throw new CliError("validation_error", "say what to find");
|
|
@@ -33851,11 +34128,14 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33851
34128
|
let hasMore = false;
|
|
33852
34129
|
let notes;
|
|
33853
34130
|
let events;
|
|
33854
|
-
|
|
34131
|
+
const by = {};
|
|
33855
34132
|
let server;
|
|
34133
|
+
const discover = !request.exact && questionLookup(request.text) !== void 0;
|
|
34134
|
+
const cosines = /* @__PURE__ */ new Map();
|
|
33856
34135
|
let coverage2;
|
|
33857
34136
|
const messagesOf = /* @__PURE__ */ __name(async (kind) => {
|
|
33858
34137
|
const given = request.scope?.[kind];
|
|
34138
|
+
const discovers = discover && (kind === "mail" || request.backend !== "server");
|
|
33859
34139
|
const query = {
|
|
33860
34140
|
text: request.text,
|
|
33861
34141
|
kind,
|
|
@@ -33868,6 +34148,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33868
34148
|
} : {},
|
|
33869
34149
|
limit: window3,
|
|
33870
34150
|
...request.exact ? { exact: true } : {},
|
|
34151
|
+
...discovers ? { discover: true } : {},
|
|
33871
34152
|
...request.timezone === void 0 ? {} : { timezone: request.timezone },
|
|
33872
34153
|
...request.signal === void 0 ? {} : { signal: request.signal }
|
|
33873
34154
|
};
|
|
@@ -33900,7 +34181,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33900
34181
|
};
|
|
33901
34182
|
}, "itemOf");
|
|
33902
34183
|
const byWords = found.items.map((hit) => itemOf3(hit, ["words"]));
|
|
33903
|
-
if (
|
|
34184
|
+
if (!meaning || request.exact || kind === "messages" && request.backend === "server")
|
|
33904
34185
|
return byWords;
|
|
33905
34186
|
const filters = filtersBeside(request.text);
|
|
33906
34187
|
const lane = filters === void 0 ? {
|
|
@@ -33910,25 +34191,28 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33910
34191
|
}
|
|
33911
34192
|
} : await meaning(request.text, read, embedders);
|
|
33912
34193
|
if ("skipped" in lane) {
|
|
33913
|
-
|
|
34194
|
+
by[kind] = { by: "words", meaningSkipped: lane.skipped };
|
|
33914
34195
|
return byWords;
|
|
33915
34196
|
}
|
|
33916
|
-
|
|
34197
|
+
by[kind] = { by: "words and meaning", ...lane.partly ? { meaningSkipped: lane.partly } : {} };
|
|
33917
34198
|
const near2 = await nearEligible(store, account, query, messenger, lane.ranked, filters ? { text: filters } : {});
|
|
33918
34199
|
const fused2 = /* @__PURE__ */ new Map();
|
|
33919
|
-
byWords.forEach((
|
|
33920
|
-
fused2.set(
|
|
34200
|
+
byWords.forEach((item2, rank) => {
|
|
34201
|
+
fused2.set(item2.ref, { item: item2, score: 1 / (RRF_K3 + rank + 1) });
|
|
33921
34202
|
});
|
|
33922
34203
|
near2.forEach((hit, rank) => {
|
|
34204
|
+
cosines.set(hit.locator, hit.cosine);
|
|
33923
34205
|
const held = fused2.get(hit.locator);
|
|
33924
34206
|
if (held)
|
|
33925
34207
|
held.item.foundBy = ["words", "meaning"];
|
|
34208
|
+
if (held && discovers)
|
|
34209
|
+
return;
|
|
33926
34210
|
fused2.set(hit.locator, {
|
|
33927
34211
|
item: held?.item ?? itemOf3(hit, ["meaning"]),
|
|
33928
34212
|
score: (held?.score ?? 0) + 1 / (RRF_K3 + rank + 1)
|
|
33929
34213
|
});
|
|
33930
34214
|
});
|
|
33931
|
-
return [...fused2.values()].sort((a, b) => b.score - a.score).map(({ item }) =>
|
|
34215
|
+
return [...fused2.values()].sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
|
|
33932
34216
|
}, "messagesOf");
|
|
33933
34217
|
const embedders = runEmbedders();
|
|
33934
34218
|
try {
|
|
@@ -33942,6 +34226,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33942
34226
|
embedders,
|
|
33943
34227
|
...chosen === void 0 ? {} : notesScopeOf(chosen),
|
|
33944
34228
|
...request.exact ? { exact: true } : {},
|
|
34229
|
+
...discover ? { discover: true } : {},
|
|
33945
34230
|
...request.timezone === void 0 ? {} : { timezone: request.timezone },
|
|
33946
34231
|
...request.env === void 0 ? {} : { env: request.env }
|
|
33947
34232
|
});
|
|
@@ -33950,6 +34235,9 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33950
34235
|
by: found.by,
|
|
33951
34236
|
...found.meaning_skipped === void 0 ? {} : { meaningSkipped: found.meaning_skipped }
|
|
33952
34237
|
};
|
|
34238
|
+
for (const hit of found.hits)
|
|
34239
|
+
if (hit.meaning_score !== void 0)
|
|
34240
|
+
cosines.set(hit.ref, hit.meaning_score);
|
|
33953
34241
|
lists.push(found.hits.map((hit) => ({
|
|
33954
34242
|
kind: hit.kind ?? "note",
|
|
33955
34243
|
ref: hit.ref,
|
|
@@ -33978,6 +34266,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33978
34266
|
...command === void 0 ? {} : { command },
|
|
33979
34267
|
...request.env === void 0 ? {} : { env: request.env },
|
|
33980
34268
|
...request.exact ? { exact: true } : {},
|
|
34269
|
+
...discover ? { discover: true } : {},
|
|
33981
34270
|
...request.timezone === void 0 ? {} : { timezone: request.timezone },
|
|
33982
34271
|
...request.signal === void 0 ? {} : { signal: request.signal }
|
|
33983
34272
|
});
|
|
@@ -33986,6 +34275,9 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33986
34275
|
by: found.by,
|
|
33987
34276
|
...found.meaning_skipped === void 0 ? {} : { meaningSkipped: found.meaning_skipped }
|
|
33988
34277
|
};
|
|
34278
|
+
for (const hit of found.hits)
|
|
34279
|
+
if (hit.meaning_score !== void 0)
|
|
34280
|
+
cosines.set(hit.ref, hit.meaning_score);
|
|
33989
34281
|
lists.push(found.hits.map((hit) => ({
|
|
33990
34282
|
kind: "event",
|
|
33991
34283
|
ref: hit.ref,
|
|
@@ -33998,6 +34290,29 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
33998
34290
|
foundBy: hit.found_by
|
|
33999
34291
|
})));
|
|
34000
34292
|
accounts.push(...read.map(({ provider, account: account2 }) => ({ resource, provider, account: account2 })));
|
|
34293
|
+
} else if (resource === "crm") {
|
|
34294
|
+
const { words: words3, anyWord } = titleWords(request.text);
|
|
34295
|
+
const chosen = request.scope?.crm;
|
|
34296
|
+
const found = await store.deals.find({
|
|
34297
|
+
words: words3,
|
|
34298
|
+
anyWord: anyWord || discover,
|
|
34299
|
+
limit: Math.min(window3 + 1, 500),
|
|
34300
|
+
...chosen === void 0 ? {} : { accounts: chosen }
|
|
34301
|
+
});
|
|
34302
|
+
hasMore ||= found.length > window3;
|
|
34303
|
+
lists.push(found.slice(0, window3).map((deal) => ({
|
|
34304
|
+
kind: deal.kind,
|
|
34305
|
+
ref: deal.ref,
|
|
34306
|
+
provider: deal.account?.provider ?? "crm",
|
|
34307
|
+
account: deal.account?.account ?? INTERNAL_NOTES,
|
|
34308
|
+
title: deal.title,
|
|
34309
|
+
timestamp: deal.updatedAt,
|
|
34310
|
+
text: deal.summary,
|
|
34311
|
+
foundBy: ["title"]
|
|
34312
|
+
})));
|
|
34313
|
+
const read = chosen ?? [...await crmAccounts(store), { provider: "crm", account: INTERNAL_NOTES }];
|
|
34314
|
+
for (const { provider, account: account2 } of read)
|
|
34315
|
+
accounts.push({ resource, provider, account: account2 });
|
|
34001
34316
|
} else
|
|
34002
34317
|
lists.push(await messagesOf(resource));
|
|
34003
34318
|
searched.push(resource);
|
|
@@ -34010,14 +34325,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
34010
34325
|
} finally {
|
|
34011
34326
|
await embedders.close();
|
|
34012
34327
|
}
|
|
34013
|
-
const
|
|
34014
|
-
for (const list3 of lists)
|
|
34015
|
-
list3.forEach((item, rank) => {
|
|
34016
|
-
const held = ranked.get(item.ref) ?? { item, score: 0 };
|
|
34017
|
-
held.score += 1 / (RRF_K3 + rank + 1);
|
|
34018
|
-
ranked.set(item.ref, held);
|
|
34019
|
-
});
|
|
34020
|
-
const ordered = [...ranked.values()].sort((a, b) => b.score - a.score).map(({ item }) => item);
|
|
34328
|
+
const ordered = oneList(lists, cosines);
|
|
34021
34329
|
const more = hasMore || ordered.length > window3;
|
|
34022
34330
|
return {
|
|
34023
34331
|
query: request.text,
|
|
@@ -34029,13 +34337,25 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
|
|
|
34029
34337
|
skipped,
|
|
34030
34338
|
...notes === void 0 ? {} : { notes },
|
|
34031
34339
|
...events === void 0 ? {} : { events },
|
|
34032
|
-
...
|
|
34340
|
+
...by.messages === void 0 ? {} : { messages: by.messages },
|
|
34341
|
+
...by.mail === void 0 ? {} : { mail: by.mail },
|
|
34033
34342
|
...server === void 0 ? {} : { server },
|
|
34034
34343
|
...coverage2 === void 0 ? {} : { coverage: coverage2 }
|
|
34035
34344
|
};
|
|
34036
34345
|
}, "searchAll");
|
|
34346
|
+
var oneList = /* @__PURE__ */ __name((lists, cosines) => {
|
|
34347
|
+
const place = /* @__PURE__ */ new Map();
|
|
34348
|
+
for (const list3 of lists)
|
|
34349
|
+
list3.forEach((item2, rank) => {
|
|
34350
|
+
const held = place.get(item2.ref);
|
|
34351
|
+
if (!held || rank < held.rank)
|
|
34352
|
+
place.set(item2.ref, { item: item2, rank });
|
|
34353
|
+
});
|
|
34354
|
+
const cosine = /* @__PURE__ */ __name((ref) => cosines.get(ref) ?? Number.NEGATIVE_INFINITY, "cosine");
|
|
34355
|
+
return [...place.values()].sort((a, b) => a.rank - b.rank || cosine(b.item.ref) - cosine(a.item.ref)).map(({ item: item2 }) => item2);
|
|
34356
|
+
}, "oneList");
|
|
34037
34357
|
|
|
34038
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34358
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
|
|
34039
34359
|
var RESOURCES_SEARCHED_WITH_MEETINGS = [...RESOURCES_SEARCHED, "meetings"];
|
|
34040
34360
|
var whole3 = /* @__PURE__ */ __name((value, minimum, maximum, label) => {
|
|
34041
34361
|
if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
|
|
@@ -34203,16 +34523,16 @@ var searchAllIncludingMeetings = /* @__PURE__ */ __name(async (store, account, r
|
|
|
34203
34523
|
};
|
|
34204
34524
|
}
|
|
34205
34525
|
const ranked = /* @__PURE__ */ new Map();
|
|
34206
|
-
for (const list3 of [legacy.items, meetings.items.map(({ item }) =>
|
|
34207
|
-
list3.forEach((
|
|
34208
|
-
const key =
|
|
34209
|
-
const held = ranked.get(key) ?? { item, score: 0 };
|
|
34526
|
+
for (const list3 of [legacy.items, meetings.items.map(({ item: item2 }) => item2)])
|
|
34527
|
+
list3.forEach((item2, rank) => {
|
|
34528
|
+
const key = item2.kind === "meeting" ? JSON.stringify([item2.kind, item2.accountId, item2.meetingId, item2.scope, item2.id]) : item2.ref;
|
|
34529
|
+
const held = ranked.get(key) ?? { item: item2, score: 0 };
|
|
34210
34530
|
held.score += 1 / (RRF_K3 + rank + 1);
|
|
34211
34531
|
ranked.set(key, held);
|
|
34212
34532
|
});
|
|
34213
|
-
const ordered = [...ranked.values()].sort((a, b) => b.score - a.score).map(({ item }) =>
|
|
34533
|
+
const ordered = [...ranked.values()].sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
|
|
34214
34534
|
const items = ordered.slice(offset, window3);
|
|
34215
|
-
const returnedMeetings = ordered.slice(0, window3).filter((
|
|
34535
|
+
const returnedMeetings = ordered.slice(0, window3).filter((item2) => item2.kind === "meeting").length;
|
|
34216
34536
|
const nextCursor = meetings.items[returnedMeetings]?.before ?? (!meetings.coverage.complete ? meetings.after : void 0);
|
|
34217
34537
|
const more = legacy.hasMore || ordered.length > window3;
|
|
34218
34538
|
const { nextOffset: _, ...rest } = legacy;
|
|
@@ -34247,13 +34567,13 @@ var searchAllWithMeetings = /* @__PURE__ */ __name(async (store, account, reques
|
|
|
34247
34567
|
var holdingMeetings = /* @__PURE__ */ __name(async (store, named2) => {
|
|
34248
34568
|
if (named2.length < 2)
|
|
34249
34569
|
return named2;
|
|
34250
|
-
const
|
|
34570
|
+
const holding2 = [];
|
|
34251
34571
|
for (const key of named2) {
|
|
34252
34572
|
const { id: id2 } = await store.accounts.storedAccount(key);
|
|
34253
34573
|
if ((await store.meetings.meetings({ accountId: id2, limit: 1 })).length)
|
|
34254
|
-
|
|
34574
|
+
holding2.push(key);
|
|
34255
34575
|
}
|
|
34256
|
-
return
|
|
34576
|
+
return holding2.length ? holding2 : named2;
|
|
34257
34577
|
}, "holdingMeetings");
|
|
34258
34578
|
var searchAllOfSource = /* @__PURE__ */ __name(async (store, account, source, request, messenger, searchMessages, meaning) => {
|
|
34259
34579
|
const only = request.only ?? RESOURCES_SEARCHED_WITH_MEETINGS;
|
|
@@ -34280,7 +34600,8 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account, source, re
|
|
|
34280
34600
|
messages: named2("messages"),
|
|
34281
34601
|
mail: named2("mail"),
|
|
34282
34602
|
notes: named2("notes"),
|
|
34283
|
-
events: named2("events")
|
|
34603
|
+
events: named2("events"),
|
|
34604
|
+
crm: named2("crm")
|
|
34284
34605
|
},
|
|
34285
34606
|
...meetings[0] ? { meetingAccount: meetings[0] } : {}
|
|
34286
34607
|
}, messenger, searchMessages, meaning);
|
|
@@ -34288,7 +34609,7 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account, source, re
|
|
|
34288
34609
|
return { ...found, skipped: [...skipped, ...empty2, ...unnamed, ...found.skipped] };
|
|
34289
34610
|
}, "searchAllOfSource");
|
|
34290
34611
|
|
|
34291
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34612
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/server-search.js
|
|
34292
34613
|
var SERVER_SEARCH_KEY = "messages.server-search";
|
|
34293
34614
|
var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3, textBytes: 262144 };
|
|
34294
34615
|
var DEFAULT_BACKEND = "both";
|
|
@@ -34477,7 +34798,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
34477
34798
|
return { report, sources };
|
|
34478
34799
|
}, "searchServer");
|
|
34479
34800
|
|
|
34480
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34801
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/messages.js
|
|
34481
34802
|
var DELETE_AT_ONCE = 10;
|
|
34482
34803
|
var filesOf = /* @__PURE__ */ __name(({ attachments }) => {
|
|
34483
34804
|
const files = fileLinks(attachments);
|
|
@@ -34493,18 +34814,18 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
|
|
|
34493
34814
|
return;
|
|
34494
34815
|
await ensureAccount({ text: target2.text, account: target2.account }, { account: account.account, ...deps.profile === void 0 ? {} : { profile: deps.profile } });
|
|
34495
34816
|
}, "ownTarget");
|
|
34496
|
-
const serverThenStore = /* @__PURE__ */ __name(async (store, account, query) => {
|
|
34817
|
+
const serverThenStore = /* @__PURE__ */ __name(async (store, account, query, lanes = true) => {
|
|
34497
34818
|
const server = await searchServer(deps, query);
|
|
34498
34819
|
const only = query.backend === "server" && server ? [...server.sources.keys()].map((key) => {
|
|
34499
34820
|
const [chatId, id2] = JSON.parse(key);
|
|
34500
34821
|
return { ...account, chatId, id: id2 };
|
|
34501
34822
|
}) : void 0;
|
|
34502
|
-
const found = await searchStore(store, account, only ? { ...query, only } : query, deps.messenger, query.discover && query.kind !== "mail" ? meaningLane(deps) : void 0, query.discover && query.kind !== "mail" ? rerankLane(deps) : void 0);
|
|
34823
|
+
const found = await searchStore(store, account, only ? { ...query, only } : query, deps.messenger, lanes && query.discover && query.kind !== "mail" ? meaningLane(deps) : void 0, lanes && query.discover && query.kind !== "mail" ? rerankLane(deps) : void 0);
|
|
34503
34824
|
return { found, server };
|
|
34504
34825
|
}, "serverThenStore");
|
|
34505
34826
|
const unifiedMessages = /* @__PURE__ */ __name((store, account) => async (query) => {
|
|
34506
34827
|
await topUp(store);
|
|
34507
|
-
const { found, server } = await serverThenStore(store, account, query);
|
|
34828
|
+
const { found, server } = await serverThenStore(store, account, query, false);
|
|
34508
34829
|
return withServer(found, account, server);
|
|
34509
34830
|
}, "unifiedMessages");
|
|
34510
34831
|
const remember = /* @__PURE__ */ __name(async (store, command, query) => {
|
|
@@ -34634,7 +34955,7 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
|
|
|
34634
34955
|
const store = await deps.store();
|
|
34635
34956
|
const chat2 = await readChatId(deps, target2.chat, store, account);
|
|
34636
34957
|
const found2 = await store.messages.around(account, chat2, target2.message, { before: 0, after: 0 });
|
|
34637
|
-
const held2 = found2.find((
|
|
34958
|
+
const held2 = found2.find((item2) => item2.id === target2.message && item2.chatId === chat2);
|
|
34638
34959
|
if (!held2)
|
|
34639
34960
|
throw new CliError("not_found", "no such message in this account's stored chat");
|
|
34640
34961
|
return {
|
|
@@ -34652,14 +34973,14 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
|
|
|
34652
34973
|
const locator = formatLocator({ ...account, chat, message: target2.message });
|
|
34653
34974
|
if (connection.permalink) {
|
|
34654
34975
|
const permalink = validatePermalink(await connection.permalink(chat, target2.message));
|
|
34655
|
-
const held2 = await deps.store().then((store) => store.messages.around(account, chat, target2.message, { before: 0, after: 0 })).then((found2) => found2.find((
|
|
34976
|
+
const held2 = await deps.store().then((store) => store.messages.around(account, chat, target2.message, { before: 0, after: 0 })).then((found2) => found2.find((item2) => item2.id === target2.message && item2.chatId === chat)).catch(() => void 0);
|
|
34656
34977
|
return { locator, ...permalink, ...held2 ? filesOf(held2) : {} };
|
|
34657
34978
|
}
|
|
34658
34979
|
const found = await capability(connection, "around", "read a message")(chat, target2.message, {
|
|
34659
34980
|
before: 0,
|
|
34660
34981
|
after: 0
|
|
34661
34982
|
});
|
|
34662
|
-
const held = found.find((
|
|
34983
|
+
const held = found.find((item2) => item2.id === target2.message && item2.chatId === chat);
|
|
34663
34984
|
if (!held)
|
|
34664
34985
|
throw new CliError("not_found", "no such message in this chat");
|
|
34665
34986
|
return { locator, url: null, access: "unavailable", reason: "unsupported_provider", ...filesOf(held) };
|
|
@@ -34918,7 +35239,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
|
|
|
34918
35239
|
throw new CliError("validation_error", `${MEDIA_FLAGS[first2]} needs a --photo or --file`);
|
|
34919
35240
|
}, "checkMediaOptions");
|
|
34920
35241
|
|
|
34921
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35242
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
|
|
34922
35243
|
var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
|
|
34923
35244
|
var RULES = {
|
|
34924
35245
|
ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
|
|
@@ -34933,7 +35254,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES)
|
|
|
34933
35254
|
return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
|
|
34934
35255
|
}), "classifyChannel");
|
|
34935
35256
|
|
|
34936
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35257
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/metadata.js
|
|
34937
35258
|
var metadataService = /* @__PURE__ */ __name((deps) => {
|
|
34938
35259
|
const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
|
|
34939
35260
|
const store = await deps.store();
|
|
@@ -35019,7 +35340,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
|
|
|
35019
35340
|
};
|
|
35020
35341
|
}, "metadataService");
|
|
35021
35342
|
|
|
35022
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35343
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/moderation/run.js
|
|
35023
35344
|
var FIRST_LOOK_MS = 24 * 36e5;
|
|
35024
35345
|
var moderateWith = /* @__PURE__ */ __name(async (run) => {
|
|
35025
35346
|
const { chatId, title, rules, point, since, dryRun } = run;
|
|
@@ -35056,7 +35377,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run) => {
|
|
|
35056
35377
|
return { chatId, rows, notes };
|
|
35057
35378
|
}, "moderateWith");
|
|
35058
35379
|
|
|
35059
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35380
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/moderation.js
|
|
35060
35381
|
var moderationService = /* @__PURE__ */ __name((deps) => {
|
|
35061
35382
|
const file2 = /* @__PURE__ */ __name(() => new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile ?? "default", deps.env ?? process.env)), "file");
|
|
35062
35383
|
const group = /* @__PURE__ */ __name(async (chat) => {
|
|
@@ -35134,7 +35455,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
|
|
|
35134
35455
|
}, "removePerson")
|
|
35135
35456
|
}), "moderatorOf");
|
|
35136
35457
|
|
|
35137
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35458
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/private-people.js
|
|
35138
35459
|
var noteItem = /* @__PURE__ */ __name((provider, note) => ({
|
|
35139
35460
|
id: note.id,
|
|
35140
35461
|
contact: formatReference({ type: "contact", provider, id: note.personId }),
|
|
@@ -35178,7 +35499,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
|
|
|
35178
35499
|
};
|
|
35179
35500
|
}, "privatePeopleService");
|
|
35180
35501
|
|
|
35181
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35502
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/rankings.js
|
|
35182
35503
|
var empty = /* @__PURE__ */ __name(() => ({
|
|
35183
35504
|
total: 0,
|
|
35184
35505
|
population: 0,
|
|
@@ -35434,7 +35755,134 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
35434
35755
|
}, "evidence")
|
|
35435
35756
|
}), "rankingsService");
|
|
35436
35757
|
|
|
35437
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35758
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/reply-stats.js
|
|
35759
|
+
var FIELDS = ["date", "chat", "kind"];
|
|
35760
|
+
var WAITING_TAIL = 100;
|
|
35761
|
+
var plainOnly = /* @__PURE__ */ __name((text2, command) => {
|
|
35762
|
+
if (text2 === void 0)
|
|
35763
|
+
return;
|
|
35764
|
+
const refuse = /* @__PURE__ */ __name(() => {
|
|
35765
|
+
throw new CliError("validation_error", `${command} reads date:, chat: and kind: terms, AND-ed \u2014 not words, other fields, OR or NOT`, { reason: "query.unsupported-field" });
|
|
35766
|
+
}, "refuse");
|
|
35767
|
+
const visit = /* @__PURE__ */ __name((node) => {
|
|
35768
|
+
if (node.kind === "boolean")
|
|
35769
|
+
for (const clause of node.clauses) {
|
|
35770
|
+
if (clause.occur !== "must")
|
|
35771
|
+
refuse();
|
|
35772
|
+
visit(clause.node);
|
|
35773
|
+
}
|
|
35774
|
+
else if (!FIELDS.includes(node.field) || !["term", "phrase", "range"].includes(node.operator))
|
|
35775
|
+
refuse();
|
|
35776
|
+
}, "visit");
|
|
35777
|
+
visit(parseLucene(text2, { ...MESSAGE_PARSING, defaultField: "text" }).root);
|
|
35778
|
+
}, "plainOnly");
|
|
35779
|
+
var scopeOf3 = /* @__PURE__ */ __name((root, accounts) => {
|
|
35780
|
+
const scope = { accounts, chats: [], kinds: [] };
|
|
35781
|
+
const visit = /* @__PURE__ */ __name((node) => {
|
|
35782
|
+
if (node.kind === "boolean") {
|
|
35783
|
+
for (const clause of node.clauses)
|
|
35784
|
+
visit(clause.node);
|
|
35785
|
+
return;
|
|
35786
|
+
}
|
|
35787
|
+
const { chat, date: date2 } = node.resolution ?? {};
|
|
35788
|
+
if (chat)
|
|
35789
|
+
scope.chats.push(chat);
|
|
35790
|
+
else if (node.field === "kind")
|
|
35791
|
+
scope.kinds.push(node.value.toLowerCase());
|
|
35792
|
+
else if (date2) {
|
|
35793
|
+
if (date2.lower !== void 0) {
|
|
35794
|
+
const lower = date2.lower + (date2.lower_inclusive ? 0 : 1);
|
|
35795
|
+
scope.since = Math.max(scope.since ?? lower, lower);
|
|
35796
|
+
}
|
|
35797
|
+
if (date2.upper !== void 0) {
|
|
35798
|
+
const upper = date2.upper - (date2.upper_inclusive ? 0 : 1);
|
|
35799
|
+
scope.until = Math.min(scope.until ?? upper, upper);
|
|
35800
|
+
}
|
|
35801
|
+
}
|
|
35802
|
+
}, "visit");
|
|
35803
|
+
visit(root);
|
|
35804
|
+
return scope;
|
|
35805
|
+
}, "scopeOf");
|
|
35806
|
+
var figuresOf = /* @__PURE__ */ __name((delays) => {
|
|
35807
|
+
const { medianMilliseconds, p90Milliseconds } = delayStats(delays);
|
|
35808
|
+
return {
|
|
35809
|
+
replies: delays.length,
|
|
35810
|
+
medianMs: medianMilliseconds,
|
|
35811
|
+
p90Ms: p90Milliseconds,
|
|
35812
|
+
meanMs: delays.length ? Math.round(delays.reduce((sum2, one) => sum2 + one, 0) / delays.length) : null
|
|
35813
|
+
};
|
|
35814
|
+
}, "figuresOf");
|
|
35815
|
+
var MINUTE2 = 6e4;
|
|
35816
|
+
var waitsOnOwner = /* @__PURE__ */ __name((newest) => {
|
|
35817
|
+
if (newest.mine)
|
|
35818
|
+
return false;
|
|
35819
|
+
if (newest.kind === "private")
|
|
35820
|
+
return !newest.quiet && rankingQuestion(newest.text);
|
|
35821
|
+
return newest.addressed || newest.ownerUsername !== null && new RegExp(`(^|[^\\w@])@${newest.ownerUsername.replace(/[^\w]/g, "\\$&")}(?!\\w)`, "i").test(newest.text);
|
|
35822
|
+
}, "waitsOnOwner");
|
|
35823
|
+
var replyStatsService = /* @__PURE__ */ __name((deps) => {
|
|
35824
|
+
const prepared = /* @__PURE__ */ __name(async (query, command) => {
|
|
35825
|
+
plainOnly(query.text, command);
|
|
35826
|
+
const store = await deps.store();
|
|
35827
|
+
const found = await prepareLucene(store, await deps.account(), {
|
|
35828
|
+
...query.text === void 0 ? {} : { text: query.text },
|
|
35829
|
+
...query.source === void 0 ? {} : { source: query.source },
|
|
35830
|
+
timezone: timezoneOf(query.timezone),
|
|
35831
|
+
limit: 1
|
|
35832
|
+
}, deps.messenger);
|
|
35833
|
+
return { store, timezone: found.timezone, scope: scopeOf3(found.execution.root, found.scopeAccounts) };
|
|
35834
|
+
}, "prepared");
|
|
35835
|
+
return {
|
|
35836
|
+
responses: /* @__PURE__ */ __name(async ({ who: who2, by, ...query }) => {
|
|
35837
|
+
const { store, timezone, scope } = await prepared(query, "stats messages responses");
|
|
35838
|
+
const delays = scope.accounts.length ? await store.queries.replyDelays(scope, who2) : [];
|
|
35839
|
+
const buckets = { under5m: 0, under1h: 0, under1d: 0, over1d: 0 };
|
|
35840
|
+
for (const { delayMs } of delays) {
|
|
35841
|
+
if (delayMs < 5 * MINUTE2)
|
|
35842
|
+
buckets.under5m++;
|
|
35843
|
+
else if (delayMs < 60 * MINUTE2)
|
|
35844
|
+
buckets.under1h++;
|
|
35845
|
+
else if (delayMs < 24 * 60 * MINUTE2)
|
|
35846
|
+
buckets.under1d++;
|
|
35847
|
+
else
|
|
35848
|
+
buckets.over1d++;
|
|
35849
|
+
}
|
|
35850
|
+
const days = /* @__PURE__ */ new Map();
|
|
35851
|
+
if (by === "day") {
|
|
35852
|
+
const keyOf5 = calendarKey(timezone, "day");
|
|
35853
|
+
for (const { repliedAt, delayMs } of delays) {
|
|
35854
|
+
const key = keyOf5(repliedAt);
|
|
35855
|
+
const list3 = days.get(key) ?? [];
|
|
35856
|
+
list3.push(delayMs);
|
|
35857
|
+
days.set(key, list3);
|
|
35858
|
+
}
|
|
35859
|
+
}
|
|
35860
|
+
return {
|
|
35861
|
+
who: who2,
|
|
35862
|
+
by,
|
|
35863
|
+
...figuresOf(delays.map(({ delayMs }) => delayMs)),
|
|
35864
|
+
buckets,
|
|
35865
|
+
rows: [...days].sort(([a], [b]) => a.localeCompare(b)).map(([key, list3]) => ({ key, ...figuresOf(list3) }))
|
|
35866
|
+
};
|
|
35867
|
+
}, "responses"),
|
|
35868
|
+
waiting: /* @__PURE__ */ __name(async (query) => {
|
|
35869
|
+
const { store, scope } = await prepared(query, "stats messages waiting");
|
|
35870
|
+
const chats = scope.accounts.length ? await store.queries.waitingChats(scope, waitsOnOwner, WAITING_TAIL) : [];
|
|
35871
|
+
const firsts = chats.flatMap(({ unanswered: unanswered2 }) => unanswered2.at(-1) ?? []);
|
|
35872
|
+
return {
|
|
35873
|
+
chats: chats.length,
|
|
35874
|
+
messages: chats.reduce((sum2, { unanswered: unanswered2 }) => sum2 + unanswered2.length, 0),
|
|
35875
|
+
oldestAt: firsts.length ? new Date(firsts.reduce((low, one) => Math.min(low, one))).toISOString() : null,
|
|
35876
|
+
byKind: {
|
|
35877
|
+
private: chats.filter(({ kind }) => kind === "private").length,
|
|
35878
|
+
group: chats.filter(({ kind }) => kind === "group").length
|
|
35879
|
+
}
|
|
35880
|
+
};
|
|
35881
|
+
}, "waiting")
|
|
35882
|
+
};
|
|
35883
|
+
}, "replyStatsService");
|
|
35884
|
+
|
|
35885
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/searches.js
|
|
35438
35886
|
var savedSearchItem = /* @__PURE__ */ __name((one) => ({
|
|
35439
35887
|
id: one.id,
|
|
35440
35888
|
name: one.name,
|
|
@@ -35563,7 +36011,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
|
|
|
35563
36011
|
};
|
|
35564
36012
|
}, "searchesService");
|
|
35565
36013
|
|
|
35566
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36014
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/tags.js
|
|
35567
36015
|
var TAGGING_QUERY = {
|
|
35568
36016
|
entity: "tagging",
|
|
35569
36017
|
backend: "sql",
|
|
@@ -35647,7 +36095,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
|
|
|
35647
36095
|
};
|
|
35648
36096
|
}, "tagsService");
|
|
35649
36097
|
|
|
35650
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36098
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/topics.js
|
|
35651
36099
|
var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden, icon }) => {
|
|
35652
36100
|
const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
|
|
35653
36101
|
if (title !== void 0 || icon !== void 0 || set !== 1)
|
|
@@ -35846,7 +36294,7 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
|
|
|
35846
36294
|
};
|
|
35847
36295
|
}, "topicsService");
|
|
35848
36296
|
|
|
35849
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36297
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/evidence.js
|
|
35850
36298
|
import { createHash as createHash11, randomUUID as randomUUID5 } from "node:crypto";
|
|
35851
36299
|
var hash2 = /* @__PURE__ */ __name((value) => createHash11("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
|
|
35852
36300
|
var positive = /* @__PURE__ */ __name((value, name, minimum = 1) => {
|
|
@@ -35892,13 +36340,13 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
|
|
|
35892
36340
|
threadId: message.threadId ?? null,
|
|
35893
36341
|
attachmentKinds: message.attachments.map(({ kind: attachmentKind }) => attachmentKind)
|
|
35894
36342
|
};
|
|
35895
|
-
const
|
|
35896
|
-
const bytes2 = Buffer.byteLength(JSON.stringify(
|
|
36343
|
+
const item2 = { ...content2, fingerprint: hash2(content2) };
|
|
36344
|
+
const bytes2 = Buffer.byteLength(JSON.stringify(item2), "utf8") + (items.length > 0 ? 1 : 0);
|
|
35897
36345
|
if (bytes2 > limits.bytes - contentBytes) {
|
|
35898
36346
|
truncatedBy = "bytes";
|
|
35899
36347
|
break;
|
|
35900
36348
|
}
|
|
35901
|
-
items.push(
|
|
36349
|
+
items.push(item2);
|
|
35902
36350
|
contentBytes += bytes2;
|
|
35903
36351
|
}
|
|
35904
36352
|
const content = {
|
|
@@ -35920,7 +36368,7 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
|
|
|
35920
36368
|
return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
|
|
35921
36369
|
}, "prepareEvidencePacket");
|
|
35922
36370
|
|
|
35923
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36371
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
|
|
35924
36372
|
var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, limit, before: before2 }, messenger = {}) => {
|
|
35925
36373
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
|
|
35926
36374
|
throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
|
|
@@ -35940,7 +36388,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, l
|
|
|
35940
36388
|
return { ...packet, nextBeforeId: older && last ? last.id : null };
|
|
35941
36389
|
}, "readEvidencePacket");
|
|
35942
36390
|
|
|
35943
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36391
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
|
|
35944
36392
|
var scopeKeys = [
|
|
35945
36393
|
"accountId",
|
|
35946
36394
|
"meetingId",
|
|
@@ -35962,7 +36410,7 @@ var optionKeys = /* @__PURE__ */ new Set([
|
|
|
35962
36410
|
"maxVocabularyReadBytes"
|
|
35963
36411
|
]);
|
|
35964
36412
|
|
|
35965
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36413
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
|
|
35966
36414
|
var communicationFields = {
|
|
35967
36415
|
sources: pipe(array(strictObject({
|
|
35968
36416
|
id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
|
|
@@ -35994,7 +36442,7 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
|
|
|
35994
36442
|
return { ...input, after, before: before2 };
|
|
35995
36443
|
}, "communicationRequest");
|
|
35996
36444
|
|
|
35997
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36445
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
|
|
35998
36446
|
var MEETING_PREPARATION_LIMITS = {
|
|
35999
36447
|
meetings: { min: 1, max: 20, default: 5 },
|
|
36000
36448
|
cues: { min: 1, max: 100, default: 10 },
|
|
@@ -36067,7 +36515,7 @@ var validateMeetingPreparationRequest = /* @__PURE__ */ __name((externalId, orig
|
|
|
36067
36515
|
};
|
|
36068
36516
|
}, "validateMeetingPreparationRequest");
|
|
36069
36517
|
|
|
36070
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36518
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
|
|
36071
36519
|
var validatePreparationCommunications = /* @__PURE__ */ __name((section, request, after) => {
|
|
36072
36520
|
const fail2 = /* @__PURE__ */ __name(() => {
|
|
36073
36521
|
throw new CliError("invalid_response", "Preparation communications returned another selection or invalid evidence");
|
|
@@ -36077,13 +36525,13 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
36077
36525
|
fail2();
|
|
36078
36526
|
return;
|
|
36079
36527
|
}
|
|
36080
|
-
const
|
|
36081
|
-
if (!section || section.query !==
|
|
36528
|
+
const expected2 = communicationRequest(request, after);
|
|
36529
|
+
if (!section || section.query !== expected2.query || section.window?.after !== expected2.after || section.window?.before !== expected2.before)
|
|
36082
36530
|
fail2();
|
|
36083
|
-
if (!Array.isArray(section.sources) || section.sources.length !==
|
|
36531
|
+
if (!Array.isArray(section.sources) || section.sources.length !== expected2.sources.length || section.sources.some((s) => !s || typeof s.selectionId !== "string") || new Set(section.sources.map((s) => s.selectionId)).size !== expected2.sources.length)
|
|
36084
36532
|
fail2();
|
|
36085
36533
|
for (const source of section.sources) {
|
|
36086
|
-
if (!
|
|
36534
|
+
if (!expected2.sources.some((s) => s.id === source.selectionId))
|
|
36087
36535
|
fail2();
|
|
36088
36536
|
try {
|
|
36089
36537
|
contextSource(source.source);
|
|
@@ -36093,20 +36541,20 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
36093
36541
|
}
|
|
36094
36542
|
if (!Array.isArray(section.items) || section.items.length > 20)
|
|
36095
36543
|
fail2();
|
|
36096
|
-
for (const
|
|
36097
|
-
if (!
|
|
36544
|
+
for (const item2 of section.items) {
|
|
36545
|
+
if (!item2)
|
|
36098
36546
|
fail2();
|
|
36099
|
-
const source = section.sources.find((s) => s.selectionId ===
|
|
36100
|
-
if (!source ||
|
|
36547
|
+
const source = section.sources.find((s) => s.selectionId === item2.selectionId)?.source;
|
|
36548
|
+
if (!source || item2.provider !== source.provider || item2.account !== source.account || !Number.isSafeInteger(item2.at) || item2.at < expected2.after || item2.at >= expected2.before || !Number.isSafeInteger(item2.updatedAt) || item2.updatedAt < 0 || item2.updatedAt > 864e13 || typeof item2.text !== "string" || Buffer.byteLength(item2.text) > 1024)
|
|
36101
36549
|
fail2();
|
|
36102
36550
|
try {
|
|
36103
36551
|
if (source.kind === "document") {
|
|
36104
|
-
const id2 = Number(
|
|
36105
|
-
if (!Number.isSafeInteger(id2) || id2 < 1 ||
|
|
36552
|
+
const id2 = Number(item2.ref.slice(9));
|
|
36553
|
+
if (!Number.isSafeInteger(id2) || id2 < 1 || item2.ref !== `document:${id2}`)
|
|
36106
36554
|
fail2();
|
|
36107
36555
|
} else {
|
|
36108
|
-
const locator = parseLocator(
|
|
36109
|
-
if (locator.provider !== source.provider || locator.account !== source.account || formatLocator(locator) !==
|
|
36556
|
+
const locator = parseLocator(item2.ref);
|
|
36557
|
+
if (locator.provider !== source.provider || locator.account !== source.account || formatLocator(locator) !== item2.ref)
|
|
36110
36558
|
fail2();
|
|
36111
36559
|
}
|
|
36112
36560
|
} catch {
|
|
@@ -36115,7 +36563,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
36115
36563
|
}
|
|
36116
36564
|
}, "validatePreparationCommunications");
|
|
36117
36565
|
|
|
36118
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36566
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
|
|
36119
36567
|
var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check: check2 }, ports) => {
|
|
36120
36568
|
const installer = ports.installer();
|
|
36121
36569
|
const argv = updateCommand(installer, packageName);
|
|
@@ -36180,7 +36628,7 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
|
|
|
36180
36628
|
return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
|
|
36181
36629
|
}, "dayAfter");
|
|
36182
36630
|
|
|
36183
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36631
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/services/index.js
|
|
36184
36632
|
var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
36185
36633
|
const pictures = picturesService(deps);
|
|
36186
36634
|
const base = {
|
|
@@ -36190,6 +36638,7 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
|
36190
36638
|
counters: countersService(deps),
|
|
36191
36639
|
retention: retentionService(deps),
|
|
36192
36640
|
rankings: rankingsService(deps),
|
|
36641
|
+
replyStats: replyStatsService(deps),
|
|
36193
36642
|
topics: topicsService(deps),
|
|
36194
36643
|
messages: withPictures(messagesService(deps), pictures),
|
|
36195
36644
|
chats: chatsService(deps),
|
|
@@ -36216,7 +36665,7 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
|
36216
36665
|
return deps.messenger.services ? { ...base, ...deps.messenger.services(base, deps) } : base;
|
|
36217
36666
|
}, "servicesFor");
|
|
36218
36667
|
|
|
36219
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36668
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/background/relay.js
|
|
36220
36669
|
import { createHash as createHash12 } from "node:crypto";
|
|
36221
36670
|
import { chmodSync, lstatSync, mkdirSync as mkdirSync3, rmSync } from "node:fs";
|
|
36222
36671
|
import { createConnection, createServer } from "node:net";
|
|
@@ -36437,7 +36886,7 @@ var relayCommand = /* @__PURE__ */ __name((path, request, options) => new Promis
|
|
|
36437
36886
|
}, () => finish({ error: stopped() }));
|
|
36438
36887
|
}), "relayCommand");
|
|
36439
36888
|
|
|
36440
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36889
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
|
|
36441
36890
|
var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
|
|
36442
36891
|
close: /* @__PURE__ */ __name(async () => {
|
|
36443
36892
|
}, "close"),
|
|
@@ -36527,6 +36976,7 @@ export {
|
|
|
36527
36976
|
syncsOneChat,
|
|
36528
36977
|
throughWrapper,
|
|
36529
36978
|
capability,
|
|
36979
|
+
withTimeLimit,
|
|
36530
36980
|
newSendId,
|
|
36531
36981
|
newOperationId,
|
|
36532
36982
|
batchProgress,
|
|
@@ -36564,8 +37014,11 @@ export {
|
|
|
36564
37014
|
EVENTS_DAYS,
|
|
36565
37015
|
TRACKED_DAYS,
|
|
36566
37016
|
CHAT_KINDS,
|
|
37017
|
+
taskAccount,
|
|
37018
|
+
RULES_IN,
|
|
36567
37019
|
ARRIVAL_WINDOW,
|
|
36568
37020
|
applyTaskRulesOnArrival,
|
|
37021
|
+
FIRST_PASS_DAYS,
|
|
36569
37022
|
applyTaskRulesSinceLastPass,
|
|
36570
37023
|
openRequestTask,
|
|
36571
37024
|
applyTaskRulesToChats,
|
|
@@ -36645,7 +37098,9 @@ export {
|
|
|
36645
37098
|
withoutPhone,
|
|
36646
37099
|
savedSearchItem,
|
|
36647
37100
|
TAGGING_QUERY,
|
|
37101
|
+
TASK_STATS_BY,
|
|
36648
37102
|
TASK_QUERY,
|
|
37103
|
+
TASK_STATS_QUERY,
|
|
36649
37104
|
TASK_PAIR_QUERY,
|
|
36650
37105
|
CLAIM_LEASE_MS,
|
|
36651
37106
|
taskTypeOf,
|