@wirecat/amo-cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/LICENSE +204 -0
- package/README.md +257 -2
- package/contracts/wirecat.json +1356 -0
- package/dist/amo/account.d.ts +18 -0
- package/dist/amo/account.d.ts.map +1 -0
- package/dist/amo/account.js +48 -0
- package/dist/amo/account.js.map +1 -0
- package/dist/amo/allow-list.d.ts +31 -0
- package/dist/amo/allow-list.d.ts.map +1 -0
- package/dist/amo/allow-list.js +106 -0
- package/dist/amo/allow-list.js.map +1 -0
- package/dist/amo/call.d.ts +24 -0
- package/dist/amo/call.d.ts.map +1 -0
- package/dist/amo/call.js +54 -0
- package/dist/amo/call.js.map +1 -0
- package/dist/amo/errors.d.ts +12 -0
- package/dist/amo/errors.d.ts.map +1 -0
- package/dist/amo/errors.js +72 -0
- package/dist/amo/errors.js.map +1 -0
- package/dist/amo/json.d.ts +3 -0
- package/dist/amo/json.d.ts.map +1 -0
- package/dist/amo/json.js +3 -0
- package/dist/amo/json.js.map +1 -0
- package/dist/amo/oauth.d.ts +55 -0
- package/dist/amo/oauth.d.ts.map +1 -0
- package/dist/amo/oauth.js +189 -0
- package/dist/amo/oauth.js.map +1 -0
- package/dist/amo/operation.d.ts +45 -0
- package/dist/amo/operation.d.ts.map +1 -0
- package/dist/amo/operation.js +119 -0
- package/dist/amo/operation.js.map +1 -0
- package/dist/amo/operations.d.ts +3 -0
- package/dist/amo/operations.d.ts.map +1 -0
- package/dist/amo/operations.js +1407 -0
- package/dist/amo/operations.js.map +1 -0
- package/dist/amo/routes.d.ts +67 -0
- package/dist/amo/routes.d.ts.map +1 -0
- package/dist/amo/routes.js +65 -0
- package/dist/amo/routes.js.map +1 -0
- package/dist/amo/transport.d.ts +62 -0
- package/dist/amo/transport.d.ts.map +1 -0
- package/dist/amo/transport.js +282 -0
- package/dist/amo/transport.js.map +1 -0
- package/dist/api-keys.d.ts +47 -0
- package/dist/api-keys.d.ts.map +1 -0
- package/dist/api-keys.js +224 -0
- package/dist/api-keys.js.map +1 -0
- package/dist/bin/amo.d.ts +3 -0
- package/dist/bin/amo.d.ts.map +1 -0
- package/dist/bin/amo.js +40 -0
- package/dist/bin/amo.js.map +1 -0
- package/dist/bundle/all-profiles-3KQVWDV4.js +278 -0
- package/dist/bundle/amo.js +198 -0
- package/dist/bundle/anthropic-N5NOX7K7.js +90 -0
- package/dist/bundle/app-server-2MST5EZ5.js +245 -0
- package/dist/bundle/bun-4NHWOFX2.js +169 -0
- package/dist/bundle/bun-sqlite-DRSXPWPR.js +75 -0
- package/dist/bundle/chunk-2I5UVMLW.js +3232 -0
- package/dist/bundle/chunk-3IRJDH2U.js +731 -0
- package/dist/bundle/chunk-4ZAK773N.js +100 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-5D4Z2B5B.js +334 -0
- package/dist/bundle/chunk-5E5R65CA.js +54 -0
- package/dist/bundle/chunk-5HGGG3QO.js +73 -0
- package/dist/bundle/chunk-5RLUHTK6.js +23 -0
- package/dist/bundle/chunk-5SBLU7D7.js +63 -0
- package/dist/bundle/chunk-5Z5PEEKP.js +206 -0
- package/dist/bundle/chunk-63F65DHU.js +29 -0
- package/dist/bundle/chunk-6RS7OYTD.js +64 -0
- package/dist/bundle/chunk-73CXFE36.js +88 -0
- package/dist/bundle/chunk-7GTUZY7M.js +170 -0
- package/dist/bundle/chunk-7PKFYX7V.js +189 -0
- package/dist/bundle/chunk-7U5HJEPZ.js +1400 -0
- package/dist/bundle/chunk-A33TIM5D.js +4172 -0
- package/dist/bundle/chunk-ADEWU4P4.js +38 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AHJ4W2IL.js +106 -0
- package/dist/bundle/chunk-AUBB72VF.js +2572 -0
- package/dist/bundle/chunk-BVMNXI53.js +1266 -0
- package/dist/bundle/chunk-CDY2NJFE.js +136 -0
- package/dist/bundle/chunk-CHUKWON6.js +244 -0
- package/dist/bundle/chunk-CUZRHF34.js +230 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DAY6TSPF.js +786 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DJD7TBYG.js +2791 -0
- package/dist/bundle/chunk-DOSJONCX.js +1197 -0
- package/dist/bundle/chunk-DQV2IKCF.js +72 -0
- package/dist/bundle/chunk-DTA5YV5O.js +25 -0
- package/dist/bundle/chunk-DXGGCGRP.js +218 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-EPOV5UIO.js +185 -0
- package/dist/bundle/chunk-EQ7A6NA6.js +53 -0
- package/dist/bundle/chunk-EQUKVVHX.js +353 -0
- package/dist/bundle/chunk-EROSAUNP.js +133 -0
- package/dist/bundle/chunk-ESZSMZKT.js +82 -0
- package/dist/bundle/chunk-FKR3M62D.js +407 -0
- package/dist/bundle/chunk-GNTJMB6X.js +142 -0
- package/dist/bundle/chunk-GQ7VFIYM.js +316 -0
- package/dist/bundle/chunk-JH3UOHRE.js +161 -0
- package/dist/bundle/chunk-JMDLPBXK.js +1068 -0
- package/dist/bundle/chunk-JR6TSMFX.js +9435 -0
- package/dist/bundle/chunk-K5UU3IOR.js +27955 -0
- package/dist/bundle/chunk-L6AFE73L.js +18 -0
- package/dist/bundle/chunk-LDEBZ3IX.js +238 -0
- package/dist/bundle/chunk-LGQXGOPJ.js +58 -0
- package/dist/bundle/chunk-LJQUYECN.js +6848 -0
- package/dist/bundle/chunk-LRBPT7LQ.js +95 -0
- package/dist/bundle/chunk-LSND5QYI.js +460 -0
- package/dist/bundle/chunk-NHXJYS4R.js +1334 -0
- package/dist/bundle/chunk-NJYAL3UW.js +92 -0
- package/dist/bundle/chunk-NTLSWCJ5.js +1718 -0
- package/dist/bundle/chunk-O2UCU52O.js +4065 -0
- package/dist/bundle/chunk-ODNQU7DH.js +1028 -0
- package/dist/bundle/chunk-P3WQRTYZ.js +24 -0
- package/dist/bundle/chunk-P5LYZRKW.js +63373 -0
- package/dist/bundle/chunk-PFO76YFP.js +2003 -0
- package/dist/bundle/chunk-PM77PRB6.js +12269 -0
- package/dist/bundle/chunk-Q2VNBY4Y.js +38109 -0
- package/dist/bundle/chunk-QDMXZZG4.js +604 -0
- package/dist/bundle/chunk-QRQYUHCZ.js +761 -0
- package/dist/bundle/chunk-RPWAJYI6.js +2336 -0
- package/dist/bundle/chunk-SMSTGO2G.js +58 -0
- package/dist/bundle/chunk-SZ2V62HB.js +72 -0
- package/dist/bundle/chunk-T2UDLX76.js +259 -0
- package/dist/bundle/chunk-TGEQNS6G.js +16 -0
- package/dist/bundle/chunk-TNUFLULO.js +2333 -0
- package/dist/bundle/chunk-U7RLVJ34.js +274 -0
- package/dist/bundle/chunk-UBRREVLJ.js +72 -0
- package/dist/bundle/chunk-ULXQ5MJM.js +76 -0
- package/dist/bundle/chunk-UMVRT7VQ.js +46 -0
- package/dist/bundle/chunk-V77XNPXG.js +360 -0
- package/dist/bundle/chunk-VVHRQ46X.js +193 -0
- package/dist/bundle/chunk-VX37MPTJ.js +7 -0
- package/dist/bundle/chunk-WCYCUTSK.js +362 -0
- package/dist/bundle/chunk-XEFAMLSD.js +288 -0
- package/dist/bundle/chunk-XQL7FEF4.js +721 -0
- package/dist/bundle/chunk-XRTD2GCU.js +627 -0
- package/dist/bundle/chunk-Y37A3232.js +804 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-ZM7I52EP.js +78 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/cli-KEGIR67U.js +1193 -0
- package/dist/bundle/command-contract-QBUQBXH7.js +39 -0
- package/dist/bundle/command-server-entry-5VL5U5EE.js +168 -0
- package/dist/bundle/decode-SQ5WGNDX.js +296 -0
- package/dist/bundle/dispatch-LA4DFXJD.js +411 -0
- package/dist/bundle/dist-XJGFOXYI.js +7577 -0
- package/dist/bundle/echarts-25Z3RINX.js +42501 -0
- package/dist/bundle/embed-BNOTNXMA.js +37 -0
- package/dist/bundle/embedder-BCUT7KKV.js +110 -0
- package/dist/bundle/failure-PKAC6XCT.js +24 -0
- package/dist/bundle/first-run-EO5K5GME.js +28 -0
- package/dist/bundle/first-screen-GMN3T6RW.js +39 -0
- package/dist/bundle/instructions-VLM3QAYB.js +11 -0
- package/dist/bundle/mcp-7ILNMJH5.js +167 -0
- package/dist/bundle/meeting-combined-LAMF7S2B.js +24 -0
- package/dist/bundle/meeting-model-GHMMUQ34.js +24 -0
- package/dist/bundle/meeting-semantic-BMP6323L.js +21 -0
- package/dist/bundle/node-CT3N3TNL.js +176 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-MELD2SBX.js +73 -0
- package/dist/bundle/oauth-YBH5OKC2.js +19 -0
- package/dist/bundle/open-WNSBWTAG.js +22 -0
- package/dist/bundle/openai-XSNMNLW6.js +237 -0
- package/dist/bundle/process-I2QKOMM7.js +91 -0
- package/dist/bundle/program-VQQTSSAF.js +4940 -0
- package/dist/bundle/prompt-SOG4AKPM.js +16 -0
- package/dist/bundle/recognize-WMQLWMXH.js +25 -0
- package/dist/bundle/remote-4BTFOLFY.js +30 -0
- package/dist/bundle/rerank-LJ3TWRNV.js +51 -0
- package/dist/bundle/serve-B6UANKXN.js +198 -0
- package/dist/bundle/server-S6XD6V6E.js +77 -0
- package/dist/bundle/server-YRH6GJ5Z.js +206 -0
- package/dist/bundle/source-DGFTA2TN.js +42 -0
- package/dist/bundle/sqlite-runtime-R7QFWFE7.js +19 -0
- package/dist/bundle/state-DIJ5YUOE.js +35 -0
- package/dist/bundle/store-6WFWW7EC.js +294 -0
- package/dist/bundle/store-BPNIM4BF.js +32 -0
- package/dist/bundle/store-MYTYDV6A.js +177 -0
- package/dist/bundle/store-maintenance-command-B5TMKFMG.js +68 -0
- package/dist/bundle/writer-GP7VIMAU.js +44 -0
- package/dist/commands/account.d.ts +3 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +86 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/api.d.ts +3 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +224 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.js.map +1 -0
- package/dist/commands/crm-shared.d.ts +8 -0
- package/dist/commands/crm-shared.d.ts.map +1 -0
- package/dist/commands/crm-shared.js +111 -0
- package/dist/commands/crm-shared.js.map +1 -0
- package/dist/commands/schedule.d.ts +3 -0
- package/dist/commands/schedule.d.ts.map +1 -0
- package/dist/commands/schedule.js +9 -0
- package/dist/commands/schedule.js.map +1 -0
- package/dist/commands/session.d.ts +18 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +265 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/write.d.ts +14 -0
- package/dist/commands/write.d.ts.map +1 -0
- package/dist/commands/write.js +36 -0
- package/dist/commands/write.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +29 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +62 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +97 -0
- package/dist/context.js.map +1 -0
- package/dist/crm/activities.d.ts +32 -0
- package/dist/crm/activities.d.ts.map +1 -0
- package/dist/crm/activities.js +196 -0
- package/dist/crm/activities.js.map +1 -0
- package/dist/crm/records.d.ts +20 -0
- package/dist/crm/records.d.ts.map +1 -0
- package/dist/crm/records.js +175 -0
- package/dist/crm/records.js.map +1 -0
- package/dist/crm/source.d.ts +41 -0
- package/dist/crm/source.d.ts.map +1 -0
- package/dist/crm/source.js +673 -0
- package/dist/crm/source.js.map +1 -0
- package/dist/crm/writer.d.ts +14 -0
- package/dist/crm/writer.d.ts.map +1 -0
- package/dist/crm/writer.js +247 -0
- package/dist/crm/writer.js.map +1 -0
- package/dist/identity.d.ts +7 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +33 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +91 -0
- package/dist/program.js.map +1 -0
- package/dist/reasons.d.ts +10 -0
- package/dist/reasons.d.ts.map +1 -0
- package/dist/reasons.js +35 -0
- package/dist/reasons.js.map +1 -0
- package/dist/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/records.d.ts +16 -0
- package/dist/sample/records.d.ts.map +1 -0
- package/dist/sample/records.js +22 -0
- package/dist/sample/records.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +153 -0
- package/dist/sample/transport.js.map +1 -0
- package/dist/setup/flow.d.ts +2 -0
- package/dist/setup/flow.d.ts.map +1 -0
- package/dist/setup/flow.js +127 -0
- package/dist/setup/flow.js.map +1 -0
- package/dist/setup/texts.en.json +25 -0
- package/dist/setup/texts.es.json +25 -0
- package/dist/setup/texts.ru.json +25 -0
- package/dist/store.d.ts +15 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +16 -0
- package/dist/store.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/dist/whoami.d.ts +24 -0
- package/dist/whoami.d.ts.map +1 -0
- package/dist/whoami.js +33 -0
- package/dist/whoami.js.map +1 -0
- package/package.json +85 -4
- package/skills/amo-cli/SKILL.md +116 -0
- package/skills/amo-cli/references/mcp.md +38 -0
- package/skills/amo-cli/references/output.md +42 -0
- package/skills/amo-cli/references/reading.md +77 -0
- package/skills/amo-cli/references/setup.md +59 -0
- package/skills/amo-cli/references/writing.md +85 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
validateVector
|
|
5
|
+
} from "./chunk-7GTUZY7M.js";
|
|
6
|
+
import {
|
|
7
|
+
meaningFloor
|
|
8
|
+
} from "./chunk-5D4Z2B5B.js";
|
|
9
|
+
import {
|
|
10
|
+
RRF_K
|
|
11
|
+
} from "./chunk-XQL7FEF4.js";
|
|
12
|
+
import {
|
|
13
|
+
MESSAGE_PARSING
|
|
14
|
+
} from "./chunk-DQV2IKCF.js";
|
|
15
|
+
import {
|
|
16
|
+
normalize
|
|
17
|
+
} from "./chunk-TGEQNS6G.js";
|
|
18
|
+
import {
|
|
19
|
+
formatMeetingReference,
|
|
20
|
+
implicitTextTerms,
|
|
21
|
+
liftMeetingFields,
|
|
22
|
+
parseLucene,
|
|
23
|
+
parseMeetingReference,
|
|
24
|
+
refreshMeetingIndex,
|
|
25
|
+
walkQuery
|
|
26
|
+
} from "./chunk-A33TIM5D.js";
|
|
27
|
+
import {
|
|
28
|
+
CliError
|
|
29
|
+
} from "./chunk-SZ2V62HB.js";
|
|
30
|
+
import {
|
|
31
|
+
__name
|
|
32
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
33
|
+
|
|
34
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
|
|
35
|
+
import { createHash } from "node:crypto";
|
|
36
|
+
|
|
37
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/search/question-plan.js
|
|
38
|
+
var words = /* @__PURE__ */ __name((text) => normalize(text).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
|
|
39
|
+
var joinedHyphens = /* @__PURE__ */ __name((text) => (normalize(text).match(new RegExp("(?<![:\\p{L}\\p{N}-])\\p{L}[\\p{L}\\p{N}]*(?:-\\p{L}[\\p{L}\\p{N}]*)+", "gu")) ?? []).map((word) => word.replaceAll("-", "")), "joinedHyphens");
|
|
40
|
+
var scaffolding = new Set(words("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"));
|
|
41
|
+
var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
|
|
42
|
+
var QUESTION_STARTS = new Set(words("what which how who whom whose where when why can could should would did do does is are was were will \u0447\u0442\u043E \u043A\u0442\u043E \u043A\u043E\u0433\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u043E\u0435 \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u0443\u044E \u043A\u0430\u043A\u0438\u043C \u043A\u0430\u043A\u043E\u0433\u043E \u043A\u0430\u043A\u0438\u0445 \u043F\u043E\u0447\u0435\u043C\u0443 \u0437\u0430\u0447\u0435\u043C \u043E\u0442\u043A\u0443\u0434\u0430 \u043A\u0443\u0434\u0430 \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043B\u0438 \u043C\u043E\u0436\u043D\u043E \u0440\u0430\u0437\u0432\u0435 \u0447\u0435\u0439 \u0447\u044C\u044F \u0447\u044C\u0451 \u0447\u044C\u0438"));
|
|
43
|
+
var QUESTION_FILLER = new Set(words("about any did does why whom whose would will \u044D\u0442\u043E \u043C\u044B \u0432\u044B \u044F \u043E\u043D\u0438 \u043E\u043D \u043E\u043D\u0430 \u043E \u043E\u0431 \u043F\u0440\u043E \u043B\u0438"));
|
|
44
|
+
var LINKING = new Set(words("and or but not nor with without this that these those there their they them you your our its his her all any and for into onto over then than also just and \u043F\u0440\u0438 \u0434\u043B\u044F \u0431\u0435\u0437 \u043D\u0430\u0434 \u043F\u043E\u0434 \u0438\u043B\u0438 \u043B\u0438\u0431\u043E \u0435\u0433\u043E \u0435\u0451 \u0438\u0445 \u0432\u0441\u0435 \u0432\u0441\u0451 \u0443\u0436\u0435 \u0435\u0449\u0451 \u0442\u0430\u043A \u0442\u043E\u0436\u0435 \u0442\u0430\u043A\u0436\u0435 \u0431\u044B\u043B \u0431\u044B\u043B\u0430 \u0431\u044B\u043B\u0438 \u0431\u044B\u043B\u043E \u0431\u0443\u0434\u0435\u0442 \u044D\u0442\u043E \u044D\u0442\u0430 \u044D\u0442\u043E\u0442 \u044D\u0442\u0438 \u0442\u0430\u043C \u0442\u0443\u0442"));
|
|
45
|
+
var isFunctionWord = /* @__PURE__ */ __name((word) => scaffolding.has(word) || QUESTION_STARTS.has(word) || QUESTION_FILLER.has(word) || LINKING.has(word), "isFunctionWord");
|
|
46
|
+
var questionTerms = /* @__PURE__ */ __name((text) => /\?\s*$/u.test(text) || QUESTION_STARTS.has(words(text)[0] ?? "") ? words(text).filter((word) => !scaffolding.has(word) && !QUESTION_STARTS.has(word) && !QUESTION_FILLER.has(word)) : null, "questionTerms");
|
|
47
|
+
function planQuestion(text, strict = false) {
|
|
48
|
+
if (strict)
|
|
49
|
+
return {
|
|
50
|
+
changed: false,
|
|
51
|
+
natural: false,
|
|
52
|
+
queries: [text],
|
|
53
|
+
scope: "",
|
|
54
|
+
terms: words(text),
|
|
55
|
+
rankingTerms: words(text),
|
|
56
|
+
removed: [],
|
|
57
|
+
aliases: []
|
|
58
|
+
};
|
|
59
|
+
const inputAst = parseLucene(text, MESSAGE_PARSING);
|
|
60
|
+
const rawTextual = walkQuery(inputAst.root).filter((node) => node.field === "text" || node.field === "exact");
|
|
61
|
+
const body = rawTextual.map((node) => node.value).join(" ");
|
|
62
|
+
const prefix = words(body).slice(0, 2);
|
|
63
|
+
const questionPrefix = [
|
|
64
|
+
"what",
|
|
65
|
+
"which",
|
|
66
|
+
"how",
|
|
67
|
+
"who",
|
|
68
|
+
"where",
|
|
69
|
+
"when",
|
|
70
|
+
"can",
|
|
71
|
+
"could",
|
|
72
|
+
"should",
|
|
73
|
+
"\u0441\u043A\u043E\u043B\u044C\u043A\u043E",
|
|
74
|
+
"\u043A\u0430\u043A\u043E\u0438",
|
|
75
|
+
"\u043A\u0430\u043A\u0430\u044F",
|
|
76
|
+
"\u043A\u0430\u043A\u0438\u0435",
|
|
77
|
+
"\u043A\u0430\u043A\u043E\u0435",
|
|
78
|
+
"\u043A\u0442\u043E",
|
|
79
|
+
"\u043A\u043E\u043C\u0443",
|
|
80
|
+
"\u043A\u0435\u043C",
|
|
81
|
+
"\u0433\u0434\u0435",
|
|
82
|
+
"\u043A\u043E\u0433\u0434\u0430",
|
|
83
|
+
"\u043A\u0430\u043A",
|
|
84
|
+
"\u0447\u0442\u043E",
|
|
85
|
+
"\u043C\u043E\u0436\u043D\u043E",
|
|
86
|
+
"\u043C\u043E\u0436\u0435\u0442",
|
|
87
|
+
"\u043C\u043E\u0433\u0443\u0442"
|
|
88
|
+
].includes(prefix[0] ?? "") || ["\u043A", "\u0432\u043E"].includes(prefix[0] ?? "") && ["\u043A\u043E\u043C\u0443", "\u0441\u043A\u043E\u043B\u044C\u043A\u043E"].includes(prefix[1] ?? "");
|
|
89
|
+
const natural = questionWord.test(body) && (/\?/u.test(body) || questionPrefix);
|
|
90
|
+
let cleaned = text;
|
|
91
|
+
if (natural && !text.includes("\\")) {
|
|
92
|
+
const last = rawTextual.at(-1);
|
|
93
|
+
const mark = (last?.span.end ?? 0) - 1;
|
|
94
|
+
if (last?.operator === "wildcard" && text[mark] === "?")
|
|
95
|
+
cleaned = text.slice(0, mark) + text.slice(mark + 1);
|
|
96
|
+
}
|
|
97
|
+
const ast = cleaned === text ? inputAst : parseLucene(cleaned, MESSAGE_PARSING);
|
|
98
|
+
const predicates = walkQuery(ast.root);
|
|
99
|
+
const textual = predicates.filter((p) => p.field === "text" || p.field === "exact");
|
|
100
|
+
const fields = predicates.filter((p) => p.field !== "text" && p.field !== "exact");
|
|
101
|
+
const scope = fields.map((p) => {
|
|
102
|
+
const raw = cleaned.slice(p.span.start, p.span.end);
|
|
103
|
+
return new RegExp(`^${p.field}[:=<>]`, "u").test(raw) ? raw : `${p.field}:${raw}`;
|
|
104
|
+
}).join(" ");
|
|
105
|
+
const bypass = strict || !natural || implicitTextTerms(cleaned).size === 0 || // A quoted single word is how `plainQuery` keeps `10:30` or `HH:MM` literal; it is no phrase the asker wrote.
|
|
106
|
+
textual.some((p) => !(p.operator === "term" || p.operator === "phrase" && !/\s/u.test(p.value)) || p.field === "exact");
|
|
107
|
+
if (bypass)
|
|
108
|
+
return {
|
|
109
|
+
changed: false,
|
|
110
|
+
natural: false,
|
|
111
|
+
queries: [text],
|
|
112
|
+
scope,
|
|
113
|
+
terms: textual.flatMap((p) => words(p.value)),
|
|
114
|
+
rankingTerms: textual.flatMap((p) => words(p.value)),
|
|
115
|
+
removed: [],
|
|
116
|
+
aliases: []
|
|
117
|
+
};
|
|
118
|
+
const original = textual.flatMap((p) => words(p.value));
|
|
119
|
+
const removed = original.filter((w) => scaffolding.has(w));
|
|
120
|
+
const terms = [...new Set(original.filter((w) => !scaffolding.has(w)))];
|
|
121
|
+
if (!terms.length)
|
|
122
|
+
return {
|
|
123
|
+
changed: false,
|
|
124
|
+
natural: true,
|
|
125
|
+
queries: [text],
|
|
126
|
+
scope,
|
|
127
|
+
terms,
|
|
128
|
+
rankingTerms: original,
|
|
129
|
+
removed,
|
|
130
|
+
aliases: []
|
|
131
|
+
};
|
|
132
|
+
const alias = [...terms];
|
|
133
|
+
const changes = [];
|
|
134
|
+
const replace = /* @__PURE__ */ __name((from, to) => {
|
|
135
|
+
for (let i = 0; i < alias.length; i++)
|
|
136
|
+
if (from.includes(alias[i] ?? "")) {
|
|
137
|
+
changes.push(`${alias[i]} -> ${to}`);
|
|
138
|
+
alias[i] = to;
|
|
139
|
+
}
|
|
140
|
+
}, "replace");
|
|
141
|
+
if (terms.some((w) => ["refund", "euros", "euro", "money", "\u0432\u043E\u0437\u0432\u0440\u0430\u0442\u0430", "\u0432\u043E\u0437\u0432\u0440\u0430\u0442", "\u0435\u0432\u0440\u043E"].includes(w))) {
|
|
142
|
+
replace(["returned", "refunded", "received"], "refund");
|
|
143
|
+
replace(["\u0432\u0435\u0440\u043D\u0443\u043B\u0438", "\u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0435\u043D\u043E", "\u043F\u0435\u0440\u0435\u0447\u0438\u0441\u043B\u0435\u043D\u043E"], "\u0432\u043E\u0437\u0432\u0440\u0430\u0442");
|
|
144
|
+
}
|
|
145
|
+
if (terms.some((w) => ["log", "logs", "retention", "backup", "\u043B\u043E\u0433\u043E\u0432", "\u043B\u043E\u0433\u0438", "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435", "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F"].includes(w))) {
|
|
146
|
+
replace(["lifetime", "kept", "keep"], "retention");
|
|
147
|
+
replace(["\u0445\u0440\u0430\u043D\u044F\u0442\u0441\u044F", "\u0445\u0440\u0430\u043D\u044F\u0442", "\u0445\u0440\u0430\u043D\u0438\u0442\u044C", "\u0441\u0440\u043E\u043A"], "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435");
|
|
148
|
+
}
|
|
149
|
+
if (terms.includes("service") || terms.includes("build"))
|
|
150
|
+
replace(["currently", "now"], "current");
|
|
151
|
+
const render = /* @__PURE__ */ __name((ws) => [...new Set(ws)].join(" ") + (scope ? ` ${scope}` : ""), "render");
|
|
152
|
+
const queries = [.../* @__PURE__ */ new Set([render(terms), render(alias)])].slice(0, 2);
|
|
153
|
+
return { changed: true, natural: true, queries, scope, terms, rankingTerms: original, removed, aliases: changes };
|
|
154
|
+
}
|
|
155
|
+
__name(planQuestion, "planQuestion");
|
|
156
|
+
var questionText = /* @__PURE__ */ __name((text) => text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found), "questionText");
|
|
157
|
+
var lookupTerms = /* @__PURE__ */ __name((plan) => [
|
|
158
|
+
...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words(alias.split(" -> ")[1] ?? ""))))
|
|
159
|
+
], "lookupTerms");
|
|
160
|
+
var anyOfTerms = /* @__PURE__ */ __name((terms, scope) => `(${terms.join(" OR ")})${scope ? ` ${scope}` : ""}`, "anyOfTerms");
|
|
161
|
+
var questionLookup = /* @__PURE__ */ __name((text) => {
|
|
162
|
+
let plan;
|
|
163
|
+
try {
|
|
164
|
+
plan = planQuestion(questionText(text));
|
|
165
|
+
} catch (error) {
|
|
166
|
+
if (error instanceof CliError)
|
|
167
|
+
return void 0;
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
170
|
+
const terms = plan.changed ? lookupTerms(plan) : [];
|
|
171
|
+
return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
|
|
172
|
+
}, "questionLookup");
|
|
173
|
+
|
|
174
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
|
|
175
|
+
var resolveMeetingSelection = /* @__PURE__ */ __name(async (store, request) => {
|
|
176
|
+
const { project, tag, topic, ...input } = request;
|
|
177
|
+
input.signal?.throwIfAborted();
|
|
178
|
+
if (project !== void 0 && input.projectId !== void 0 || [tag, topic].filter((value) => value !== void 0).length + Number(input.tagId !== void 0) > 1)
|
|
179
|
+
throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
|
|
180
|
+
const selection = [];
|
|
181
|
+
const knowledge = store.knowledge;
|
|
182
|
+
if (!knowledge && [project, tag, topic].some((value) => value !== void 0))
|
|
183
|
+
throw new CliError("configuration_error", "this store cannot resolve project, tag or topic names");
|
|
184
|
+
for (const [kind, name] of [
|
|
185
|
+
["project", project],
|
|
186
|
+
["tag", tag],
|
|
187
|
+
["topic", topic]
|
|
188
|
+
]) {
|
|
189
|
+
if (name === void 0)
|
|
190
|
+
continue;
|
|
191
|
+
if (!knowledge)
|
|
192
|
+
continue;
|
|
193
|
+
const found = await knowledge.resolveVocabulary(name, { kind, signal: input.signal });
|
|
194
|
+
input.signal?.throwIfAborted();
|
|
195
|
+
if (found.ambiguous || found.matches.length !== 1)
|
|
196
|
+
throw new CliError(found.matches.length ? "validation_error" : "not_found", `the ${kind} name needs one canonical record`, {
|
|
197
|
+
candidates: found.matches.map((entry2) => ({ kind: entry2.kind, id: entry2.id, name: entry2.name }))
|
|
198
|
+
});
|
|
199
|
+
const entry = found.matches[0];
|
|
200
|
+
const id = Number(entry?.id);
|
|
201
|
+
if (!entry || entry.kind !== kind || !Number.isSafeInteger(id) || id < 1)
|
|
202
|
+
throw new CliError("invalid_response", "vocabulary resolution returned an invalid canonical record");
|
|
203
|
+
if (kind === "project")
|
|
204
|
+
input.projectId = id;
|
|
205
|
+
else
|
|
206
|
+
input.tagId = id;
|
|
207
|
+
selection.push({ kind, id, name: entry.name, by: "explicit-link" });
|
|
208
|
+
}
|
|
209
|
+
return { input, selection };
|
|
210
|
+
}, "resolveMeetingSelection");
|
|
211
|
+
|
|
212
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
|
|
213
|
+
var DEPTH = 200;
|
|
214
|
+
var cursorOf = /* @__PURE__ */ __name((value, key) => {
|
|
215
|
+
if (value === void 0)
|
|
216
|
+
return 0;
|
|
217
|
+
let cursor;
|
|
218
|
+
try {
|
|
219
|
+
cursor = JSON.parse(Buffer.from(value, "base64url").toString("utf8"));
|
|
220
|
+
} catch {
|
|
221
|
+
throw new CliError("validation_error", "the cursor is not from a combined meeting search; search again");
|
|
222
|
+
}
|
|
223
|
+
if (cursor?.version !== 1 || cursor.key !== key || !Number.isSafeInteger(cursor.offset) || cursor.offset < 0)
|
|
224
|
+
throw new CliError("validation_error", "the cursor belongs to another query, filter or model; search again");
|
|
225
|
+
return cursor.offset;
|
|
226
|
+
}, "cursorOf");
|
|
227
|
+
var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, typed, request) => {
|
|
228
|
+
const { maxChunks, maxRows, maxTextBytes, ...chosen } = request;
|
|
229
|
+
const { query, request: words2 } = liftMeetingFields(typed, chosen);
|
|
230
|
+
const { input, selection } = await resolveMeetingSelection(store, words2);
|
|
231
|
+
const { after, limit = 20, maxReadBytes, ...filters } = input;
|
|
232
|
+
const terms = questionTerms(query);
|
|
233
|
+
const wordQuery = terms === null ? query : terms.join(" ");
|
|
234
|
+
const key = createHash("sha256").update(JSON.stringify([query, embedder.key, Object.entries(filters).filter(([name]) => name !== "signal")])).digest("base64url");
|
|
235
|
+
const offset = cursorOf(after, key);
|
|
236
|
+
let byWords = [];
|
|
237
|
+
let indexing = "ready";
|
|
238
|
+
let refused;
|
|
239
|
+
if (wordQuery.trim()) {
|
|
240
|
+
await refreshMeetingIndex(store.meetings, input.accountId, input.signal);
|
|
241
|
+
try {
|
|
242
|
+
const page = await store.meetings.searchHits(wordQuery, { ...filters, limit: DEPTH, maxReadBytes });
|
|
243
|
+
byWords = page.items;
|
|
244
|
+
indexing = page.coverage.indexing;
|
|
245
|
+
} catch (error) {
|
|
246
|
+
if (!(error instanceof CliError) || error.code !== "validation_error")
|
|
247
|
+
throw error;
|
|
248
|
+
refused = error.message;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
input.signal?.throwIfAborted();
|
|
252
|
+
const vectors = await embedder.embed([query], "query");
|
|
253
|
+
if (vectors.length !== 1)
|
|
254
|
+
throw new CliError("invalid_response", "Meeting query model returned another vector count");
|
|
255
|
+
const vector = vectors[0];
|
|
256
|
+
const ranked = await store.meetingVectors.ranked(embedder.key, validateVector(vector, embedder.dims), {
|
|
257
|
+
...filters,
|
|
258
|
+
limit: DEPTH,
|
|
259
|
+
...maxChunks === void 0 ? {} : { maxChunks },
|
|
260
|
+
...maxRows === void 0 ? {} : { maxRows },
|
|
261
|
+
...maxTextBytes === void 0 ? {} : { maxTextBytes }
|
|
262
|
+
});
|
|
263
|
+
const floor = meaningFloor(embedder.key);
|
|
264
|
+
const byMeaning = ranked.items.filter(({ score }) => score > floor);
|
|
265
|
+
const merged = /* @__PURE__ */ new Map();
|
|
266
|
+
byMeaning.forEach((hit, rank) => {
|
|
267
|
+
const reference = { type: "meeting", accountId: input.accountId, meetingId: hit.meetingId };
|
|
268
|
+
const first = formatMeetingReference({
|
|
269
|
+
...reference,
|
|
270
|
+
transcriptId: hit.transcriptId,
|
|
271
|
+
cuePosition: hit.firstPosition
|
|
272
|
+
});
|
|
273
|
+
merged.set(`${hit.transcriptId}:${hit.firstPosition}`, {
|
|
274
|
+
ref: first,
|
|
275
|
+
meetingId: hit.meetingId,
|
|
276
|
+
scope: "transcript",
|
|
277
|
+
text: hit.text,
|
|
278
|
+
startMs: null,
|
|
279
|
+
source: { title: hit.title, startedAt: hit.startedAt, url: null },
|
|
280
|
+
by: ["meaning"],
|
|
281
|
+
score: hit.score,
|
|
282
|
+
passage: {
|
|
283
|
+
first,
|
|
284
|
+
last: formatMeetingReference({ ...reference, transcriptId: hit.transcriptId, cuePosition: hit.lastPosition })
|
|
285
|
+
},
|
|
286
|
+
fused: 1 / (RRF_K + rank + 1)
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
byWords.forEach((hit, rank) => {
|
|
290
|
+
const share = 1 / (RRF_K + rank + 1);
|
|
291
|
+
const cue = hit.scope === "transcript" ? parseMeetingReference(hit.ref) : void 0;
|
|
292
|
+
const within = cue?.cuePosition === void 0 ? void 0 : byMeaning.find((passage) => passage.transcriptId === cue.transcriptId && passage.firstPosition <= cue.cuePosition && cue.cuePosition <= passage.lastPosition);
|
|
293
|
+
const held = within && merged.get(`${within.transcriptId}:${within.firstPosition}`);
|
|
294
|
+
const found = {
|
|
295
|
+
ref: hit.ref,
|
|
296
|
+
text: hit.text,
|
|
297
|
+
startMs: hit.startMs,
|
|
298
|
+
...hit.match === void 0 ? {} : { match: hit.match },
|
|
299
|
+
...hit.corrections === void 0 ? {} : { corrections: hit.corrections }
|
|
300
|
+
};
|
|
301
|
+
if (held && !held.by.includes("words")) {
|
|
302
|
+
Object.assign(held, found, { by: ["words", "meaning"], fused: held.fused + share });
|
|
303
|
+
if (hit.source?.url)
|
|
304
|
+
held.source.url = hit.source.url;
|
|
305
|
+
} else if (held)
|
|
306
|
+
held.fused += share;
|
|
307
|
+
else
|
|
308
|
+
merged.set(`w:${hit.ref}:${hit.scope}:${hit.id}`, {
|
|
309
|
+
...found,
|
|
310
|
+
meetingId: hit.meetingId,
|
|
311
|
+
scope: hit.scope,
|
|
312
|
+
source: {
|
|
313
|
+
title: hit.source?.title ?? null,
|
|
314
|
+
startedAt: hit.source?.startedAt ?? null,
|
|
315
|
+
url: hit.source?.url ?? null
|
|
316
|
+
},
|
|
317
|
+
by: ["words"],
|
|
318
|
+
score: null,
|
|
319
|
+
fused: share
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
const ordered = [...merged.values()].sort((a, b) => b.fused - a.fused || Number(b.by.includes("words")) - Number(a.by.includes("words")) || (b.score ?? -2) - (a.score ?? -2));
|
|
323
|
+
const items = ordered.slice(offset, offset + limit).map(({ fused: _, ...hit }) => hit);
|
|
324
|
+
const hasMore = ordered.length > offset + limit;
|
|
325
|
+
return {
|
|
326
|
+
items,
|
|
327
|
+
hasMore,
|
|
328
|
+
nextCursor: hasMore ? Buffer.from(JSON.stringify({ version: 1, key, offset: offset + limit })).toString("base64url") : null,
|
|
329
|
+
selection,
|
|
330
|
+
words: {
|
|
331
|
+
query: wordQuery,
|
|
332
|
+
...terms === null ? {} : { from: "question" },
|
|
333
|
+
...refused === void 0 ? {} : { refused }
|
|
334
|
+
},
|
|
335
|
+
model: { key: embedder.key, model: embedder.model, kind: embedder.kind, dims: embedder.dims },
|
|
336
|
+
coverage: {
|
|
337
|
+
archiveCompleteness: "unknown",
|
|
338
|
+
indexCompleteness: "unknown",
|
|
339
|
+
indexing,
|
|
340
|
+
/** Every vector of the selection was compared; false when `maxChunks` stopped the scan. */
|
|
341
|
+
meaningScanComplete: ranked.complete,
|
|
342
|
+
scanned: ranked.scanned,
|
|
343
|
+
/** Each side ranks this many at most; pages past them hold nothing more. */
|
|
344
|
+
depth: DEPTH
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
}, "searchMeetingsCombined");
|
|
348
|
+
|
|
349
|
+
export {
|
|
350
|
+
words,
|
|
351
|
+
joinedHyphens,
|
|
352
|
+
isFunctionWord,
|
|
353
|
+
planQuestion,
|
|
354
|
+
questionText,
|
|
355
|
+
lookupTerms,
|
|
356
|
+
anyOfTerms,
|
|
357
|
+
questionLookup,
|
|
358
|
+
resolveMeetingSelection,
|
|
359
|
+
searchMeetingsCombined
|
|
360
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
stringWidth,
|
|
5
|
+
wrapAnsi
|
|
6
|
+
} from "./chunk-EH6ZEJGT.js";
|
|
7
|
+
import {
|
|
8
|
+
singleLine,
|
|
9
|
+
visibleControls
|
|
10
|
+
} from "./chunk-SZ2V62HB.js";
|
|
11
|
+
import {
|
|
12
|
+
__name
|
|
13
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
14
|
+
|
|
15
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/render/messages.js
|
|
16
|
+
import { styleText } from "node:util";
|
|
17
|
+
var TIME_WIDTH = 8;
|
|
18
|
+
var INDENT = " ".repeat(TIME_WIDTH + 2);
|
|
19
|
+
var MIN_WIDTH = 40;
|
|
20
|
+
var SENDER_COLOURS = ["green", "yellow", "magenta", "blue", "red"];
|
|
21
|
+
var renderMessages = /* @__PURE__ */ __name((messages, options = {}) => {
|
|
22
|
+
if (messages.length === 0)
|
|
23
|
+
return "(nothing)";
|
|
24
|
+
const day = dayFormatter(options);
|
|
25
|
+
const paint = painter(options);
|
|
26
|
+
let previous;
|
|
27
|
+
const blocks = [];
|
|
28
|
+
for (const message of messages) {
|
|
29
|
+
const date = day(message.timestamp);
|
|
30
|
+
if (date !== previous)
|
|
31
|
+
blocks.push(paint("dim", `\u2500\u2500 ${date} \u2500\u2500`));
|
|
32
|
+
previous = date;
|
|
33
|
+
blocks.push(renderMessage(message, options));
|
|
34
|
+
}
|
|
35
|
+
return blocks.join("\n\n");
|
|
36
|
+
}, "renderMessages");
|
|
37
|
+
var renderMessage = /* @__PURE__ */ __name((message, options = {}) => {
|
|
38
|
+
const paint = painter(options);
|
|
39
|
+
const width = Math.max(MIN_WIDTH, options.width ?? 80);
|
|
40
|
+
const room = width - INDENT.length;
|
|
41
|
+
const time = timeFormatter(options);
|
|
42
|
+
const verbosity = options.verbosity ?? 0;
|
|
43
|
+
const chat = "chatTitle" in message ? paint("dim", ` \xB7 ${singleLine(message.chatTitle ?? message.chatId)}`) : "";
|
|
44
|
+
const mark = "anchor" in message && message.anchor ? paint("bold", " \u25C0") : "";
|
|
45
|
+
const lines = [`${paint("dim", time(message.timestamp))} ${senderOf(message, options)}${chat}${mark}`];
|
|
46
|
+
const body = /* @__PURE__ */ __name((text) => wrapAnsi(visibleControls(text), room, { hard: true }).split("\n"), "body");
|
|
47
|
+
const email = message.email;
|
|
48
|
+
if (email)
|
|
49
|
+
lines.push(paint("dim", mailLine(email)));
|
|
50
|
+
if (message.replyTo)
|
|
51
|
+
lines.push(paint("dim", preview("\u21B3", message.replyTo, room, options)));
|
|
52
|
+
if (message.forwardedFrom) {
|
|
53
|
+
lines.push(paint("dim", `\u21AA ${nameOf(message.forwardedFrom, options)}`));
|
|
54
|
+
if (message.forwardedFrom.text)
|
|
55
|
+
for (const line of body(message.forwardedFrom.text))
|
|
56
|
+
lines.push(line);
|
|
57
|
+
lines.push(...attachmentLines(message.forwardedFrom.attachments, paint, options));
|
|
58
|
+
}
|
|
59
|
+
if (message.text)
|
|
60
|
+
for (const line of body(message.text))
|
|
61
|
+
lines.push(line);
|
|
62
|
+
lines.push(...attachmentLines(message.attachments, paint, options));
|
|
63
|
+
if (message.reactions && message.reactions.total > 0)
|
|
64
|
+
lines.push(paint("dim", reactionLine(message.reactions)));
|
|
65
|
+
if (message.editedAt)
|
|
66
|
+
lines.push(paint("dim", `edited ${editedAt(message, options)}`));
|
|
67
|
+
if (verbosity >= 1) {
|
|
68
|
+
const fields = [
|
|
69
|
+
["message", message.id],
|
|
70
|
+
["sender", message.senderId],
|
|
71
|
+
["chat", message.chatId],
|
|
72
|
+
["reply to", message.replyTo?.id ?? message.replyToId],
|
|
73
|
+
["thread", message.threadId],
|
|
74
|
+
["forward of", message.forwardedFrom?.id],
|
|
75
|
+
...message.attachments.map((a) => ["link", a.url])
|
|
76
|
+
];
|
|
77
|
+
if (verbosity >= 2) {
|
|
78
|
+
fields.push(["provider", options.provider], ["profile", options.profile], ["sent", message.timestamp], ["edited", message.editedAt], ["outgoing", message.outgoing === null ? "unknown" : String(message.outgoing)], ...message.attachments.map((a) => ["attachment", JSON.stringify(a)]), ["metadata", message.providerMetadata && JSON.stringify(message.providerMetadata)]);
|
|
79
|
+
}
|
|
80
|
+
const shown = fields.filter((field) => typeof field[1] === "string");
|
|
81
|
+
const label = Math.max(...shown.map(([key]) => key.length));
|
|
82
|
+
lines.push("", ...shown.map(([key, value]) => paint("dim", `${key.padEnd(label)} ${singleLine(value)}`)));
|
|
83
|
+
}
|
|
84
|
+
return lines.map((line, index) => index === 0 || line === "" ? line : `${INDENT}${line}`).join("\n");
|
|
85
|
+
}, "renderMessage");
|
|
86
|
+
var mailLine = /* @__PURE__ */ __name(({ to, cc, labels }) => {
|
|
87
|
+
const names = /* @__PURE__ */ __name((people) => people.map(({ name, address }) => singleLine(name ?? address)).join(", "), "names");
|
|
88
|
+
return [to.length ? `to ${names(to)}` : "", cc.length ? `cc ${names(cc)}` : "", labels.join(", ")].filter(Boolean).join(" \xB7 ");
|
|
89
|
+
}, "mailLine");
|
|
90
|
+
var painter = /* @__PURE__ */ __name(({ color = false }) => (style, text) => color ? styleText(style, text, { validateStream: false }) : text, "painter");
|
|
91
|
+
var senderOf = /* @__PURE__ */ __name((message, options) => {
|
|
92
|
+
const paint = painter(options);
|
|
93
|
+
if (message.outgoing === true)
|
|
94
|
+
return paint(["bold", "cyan"], you(options));
|
|
95
|
+
const name = nameOf(message, options);
|
|
96
|
+
if (!options.senderColors)
|
|
97
|
+
return paint("bold", name);
|
|
98
|
+
const colour = SENDER_COLOURS[hash(message.senderId ?? name) % SENDER_COLOURS.length] ?? "green";
|
|
99
|
+
return paint(["bold", colour], name);
|
|
100
|
+
}, "senderOf");
|
|
101
|
+
var nameOf = /* @__PURE__ */ __name(({ senderName, senderId, outgoing }, options) => outgoing === true ? you(options) : singleLine(senderName ?? senderId ?? "unknown"), "nameOf");
|
|
102
|
+
var DEFAULT_LOCALE = "ru-RU";
|
|
103
|
+
var you = /* @__PURE__ */ __name(({ locale = DEFAULT_LOCALE }) => locale.startsWith("ru") ? "\u0432\u044B" : "you", "you");
|
|
104
|
+
var hash = /* @__PURE__ */ __name((value) => [...value].reduce((sum, char) => sum * 31 + char.charCodeAt(0) >>> 0, 7), "hash");
|
|
105
|
+
var preview = /* @__PURE__ */ __name((mark, quoted, room, options) => {
|
|
106
|
+
const text = singleLine(quoted.text.split("\n")[0] ?? "") || (quoted.attachments[0] ? `\u{1F4CE} ${quoted.attachments[0].kind}` : "");
|
|
107
|
+
const line = text ? `${mark} ${nameOf(quoted, options)}: ${text}` : `${mark} message ${quoted.id}`;
|
|
108
|
+
if (stringWidth(line) <= room)
|
|
109
|
+
return line;
|
|
110
|
+
return `${wrapAnsi(line, room - 1, { hard: true }).split("\n")[0]}\u2026`;
|
|
111
|
+
}, "preview");
|
|
112
|
+
var attachmentLines = /* @__PURE__ */ __name((attachments, paint, options) => {
|
|
113
|
+
const link = /* @__PURE__ */ __name((label, raw) => {
|
|
114
|
+
if (raw === void 0)
|
|
115
|
+
return label;
|
|
116
|
+
const url = singleLine(raw);
|
|
117
|
+
return options.color ? `\x1B]8;;${url}\x07${label}\x1B]8;;\x07` : `${label} ${url}`;
|
|
118
|
+
}, "link");
|
|
119
|
+
let number = 0;
|
|
120
|
+
const keyboard = attachments.flatMap((attachment) => attachment.buttons ?? []).map((row) => paint("dim", row.map((button) => link(`[${++number} ${singleLine(button.text)}]`, button.url)).join(" ")));
|
|
121
|
+
const polls = attachments.flatMap((attachment) => attachment.poll ? pollLines(attachment.poll) : []);
|
|
122
|
+
const cards = attachments.flatMap(({ contact }) => contact ? [
|
|
123
|
+
paint("dim", `\u{1F464} ${[contact.name, contact.phone].flatMap((part) => part ? [singleLine(part)] : []).join(" \xB7 ")}`)
|
|
124
|
+
] : []);
|
|
125
|
+
const groups = /* @__PURE__ */ new Map();
|
|
126
|
+
for (const attachment of attachments) {
|
|
127
|
+
if (attachment.buttons || attachment.poll || attachment.contact)
|
|
128
|
+
continue;
|
|
129
|
+
const key = singleLine(attachment.name ?? attachment.title ?? attachment.kind);
|
|
130
|
+
groups.set(key, [...groups.get(key) ?? [], attachment]);
|
|
131
|
+
}
|
|
132
|
+
const files = [...groups].map(([label, same]) => {
|
|
133
|
+
const first = same[0];
|
|
134
|
+
const size = first?.size === void 0 ? "" : ` \xB7 ${megabytes(first.size)}`;
|
|
135
|
+
if (same.length === 1)
|
|
136
|
+
return paint("dim", `\u{1F4CE} ${link(`${label}${size}`, first?.url)}`);
|
|
137
|
+
const each = same.map((attachment, index) => link(String(index + 1), attachment.url)).join(" ");
|
|
138
|
+
return paint("dim", `\u{1F4CE} ${label} \xD7${same.length} ${each}`);
|
|
139
|
+
});
|
|
140
|
+
return [...polls, ...cards, ...files, ...keyboard];
|
|
141
|
+
}, "attachmentLines");
|
|
142
|
+
var pollLines = /* @__PURE__ */ __name((poll) => {
|
|
143
|
+
const kind = [
|
|
144
|
+
poll.closed ? "closed" : "",
|
|
145
|
+
poll.multiple ? "several answers" : "",
|
|
146
|
+
poll.anonymous ? "anonymous" : "",
|
|
147
|
+
poll.quiz ? "quiz" : ""
|
|
148
|
+
].filter(Boolean);
|
|
149
|
+
const count = /* @__PURE__ */ __name((voters) => voters === null ? "?" : String(voters), "count");
|
|
150
|
+
return [
|
|
151
|
+
`\u{1F4CA} ${visibleControls(poll.question)}`,
|
|
152
|
+
...poll.answers.map((answer) => ` [${answer.id}] ${visibleControls(answer.text)} \u2014 ${count(answer.voters)}${answer.chosen ? " \u2713" : ""}`),
|
|
153
|
+
` ${[`${count(poll.voters)} voted`, ...kind].join(" \xB7 ")}`
|
|
154
|
+
];
|
|
155
|
+
}, "pollLines");
|
|
156
|
+
var megabytes = /* @__PURE__ */ __name((bytes) => bytes >= 1e6 ? `${Math.round(bytes / 1e6)} MB` : `${Math.max(1, Math.round(bytes / 1e3))} KB`, "megabytes");
|
|
157
|
+
var parts = /* @__PURE__ */ __name((format, iso) => Object.fromEntries(format.formatToParts(new Date(iso)).map(({ type, value }) => [type, value])), "parts");
|
|
158
|
+
var timeFormatter = /* @__PURE__ */ __name(({ timeZone }) => {
|
|
159
|
+
const format = new Intl.DateTimeFormat("en-GB", {
|
|
160
|
+
hour: "2-digit",
|
|
161
|
+
minute: "2-digit",
|
|
162
|
+
second: "2-digit",
|
|
163
|
+
hourCycle: "h23",
|
|
164
|
+
...timeZone ? { timeZone } : {}
|
|
165
|
+
});
|
|
166
|
+
return (iso) => {
|
|
167
|
+
const { hour, minute, second } = parts(format, iso);
|
|
168
|
+
return `${hour}:${minute}:${second}`;
|
|
169
|
+
};
|
|
170
|
+
}, "timeFormatter");
|
|
171
|
+
var dayFormatter = /* @__PURE__ */ __name(({ locale = DEFAULT_LOCALE, timeZone }) => {
|
|
172
|
+
const format = new Intl.DateTimeFormat(locale, {
|
|
173
|
+
day: "numeric",
|
|
174
|
+
month: "long",
|
|
175
|
+
year: "numeric",
|
|
176
|
+
...timeZone ? { timeZone } : {}
|
|
177
|
+
});
|
|
178
|
+
return (iso) => format.format(new Date(iso)).replace(/\s*г\.$/, "");
|
|
179
|
+
}, "dayFormatter");
|
|
180
|
+
var reactionLine = /* @__PURE__ */ __name(({ counts, mine }) => {
|
|
181
|
+
const shown = counts.map(({ reaction, count }) => `${singleLine(reaction)} ${count}`).join(" ");
|
|
182
|
+
return mine ? `${shown} (you: ${singleLine(mine)})` : shown;
|
|
183
|
+
}, "reactionLine");
|
|
184
|
+
var editedAt = /* @__PURE__ */ __name((message, options) => {
|
|
185
|
+
const edited = message.editedAt ?? message.timestamp;
|
|
186
|
+
const time = timeFormatter(options)(edited);
|
|
187
|
+
const day = dayFormatter(options);
|
|
188
|
+
return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
|
|
189
|
+
}, "editedAt");
|
|
190
|
+
|
|
191
|
+
export {
|
|
192
|
+
renderMessages
|
|
193
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/monthly.js
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
var CI_PAGE = join(dirname(fileURLToPath(new URL("standards/monthly.js", import.meta.resolve("@wirecat/cli-base")).href)), "../../docs/standards/ci.md");
|