@wirecat/attio-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 +20 -0
- package/LICENSE +204 -0
- package/README.md +248 -2
- package/contracts/wirecat.json +2321 -0
- package/dist/bin/attio.d.ts +3 -0
- package/dist/bin/attio.d.ts.map +1 -0
- package/dist/bin/attio.js +40 -0
- package/dist/bin/attio.js.map +1 -0
- package/dist/bundle/agent-KLBL3FYD.js +37 -0
- package/dist/bundle/all-profiles-C2NMRQPE.js +320 -0
- package/dist/bundle/anthropic-KOU2ILDK.js +91 -0
- package/dist/bundle/app-server-TINV4NNY.js +249 -0
- package/dist/bundle/attio.js +183 -0
- package/dist/bundle/bun-GVNM6IWY.js +169 -0
- package/dist/bundle/bun-sqlite-IF6B3EQI.js +76 -0
- package/dist/bundle/chunk-2343HKEW.js +362 -0
- package/dist/bundle/chunk-2H2MWGBD.js +988 -0
- package/dist/bundle/chunk-2P7ENEQ7.js +288 -0
- package/dist/bundle/chunk-4EYKJLWI.js +771 -0
- package/dist/bundle/chunk-4HQDT5PF.js +338 -0
- package/dist/bundle/chunk-4QE4L7UL.js +142 -0
- package/dist/bundle/chunk-4XHWGJXT.js +6848 -0
- package/dist/bundle/chunk-5DCRHSBI.js +72 -0
- package/dist/bundle/chunk-5ETXE5KF.js +372 -0
- package/dist/bundle/chunk-5WAGTWCS.js +156 -0
- package/dist/bundle/chunk-6B5PSQQ7.js +319 -0
- package/dist/bundle/chunk-6BVPS2YY.js +230 -0
- package/dist/bundle/chunk-6L5EUGLP.js +188 -0
- package/dist/bundle/chunk-7NFEMS4A.js +1028 -0
- package/dist/bundle/chunk-A7YQTQ5U.js +733 -0
- package/dist/bundle/chunk-AEPOHR4Z.js +82 -0
- package/dist/bundle/chunk-ARRQVUJ2.js +334 -0
- package/dist/bundle/chunk-BHNFRL3H.js +95 -0
- package/dist/bundle/chunk-CBPL3GID.js +23 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DVN54VPI.js +16 -0
- package/dist/bundle/chunk-DW3V7GTY.js +388 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-ETSOG6TZ.js +65288 -0
- package/dist/bundle/chunk-FJV3MO57.js +29 -0
- package/dist/bundle/chunk-HLLRNP2G.js +170 -0
- package/dist/bundle/chunk-HQJ2TABD.js +18 -0
- package/dist/bundle/chunk-ICUXAOEM.js +42063 -0
- package/dist/bundle/chunk-IGALQ74S.js +358 -0
- package/dist/bundle/chunk-IPHUAWFG.js +100 -0
- package/dist/bundle/chunk-IYMWUL6E.js +633 -0
- package/dist/bundle/chunk-JKCXDIGC.js +52 -0
- package/dist/bundle/chunk-JTOKDROB.js +95 -0
- package/dist/bundle/chunk-JZMGOVCZ.js +80 -0
- package/dist/bundle/chunk-KB3YJJPN.js +794 -0
- package/dist/bundle/chunk-KD4EUUER.js +37 -0
- package/dist/bundle/chunk-LB6D4QF2.js +2333 -0
- package/dist/bundle/chunk-LWUJZ2E3.js +108 -0
- package/dist/bundle/chunk-MCQOXTAL.js +53 -0
- package/dist/bundle/chunk-MMGCGPKM.js +3571 -0
- package/dist/bundle/chunk-MXDIXBIV.js +24 -0
- package/dist/bundle/chunk-MYVWV5L5.js +407 -0
- package/dist/bundle/chunk-MZNRIH3T.js +1233 -0
- package/dist/bundle/chunk-NEFILPPV.js +353 -0
- package/dist/bundle/chunk-O6CVJGGL.js +131 -0
- package/dist/bundle/chunk-OPXCRQTV.js +161 -0
- package/dist/bundle/chunk-PKNFA5TU.js +38 -0
- package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
- package/dist/bundle/chunk-PO6PLQYL.js +50 -0
- package/dist/bundle/chunk-PWUQC2GI.js +218 -0
- package/dist/bundle/chunk-QCEEPJNN.js +185 -0
- package/dist/bundle/chunk-QG4WCLGB.js +1332 -0
- package/dist/bundle/chunk-QNQ2OF24.js +9578 -0
- package/dist/bundle/chunk-RCKRXBJF.js +1392 -0
- package/dist/bundle/chunk-RK4GN2II.js +2000 -0
- package/dist/bundle/chunk-RRH7UK7L.js +106 -0
- package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
- package/dist/bundle/chunk-S7WJXELM.js +58 -0
- package/dist/bundle/chunk-SBRFKB77.js +1197 -0
- package/dist/bundle/chunk-SP6DPFZ4.js +4072 -0
- package/dist/bundle/chunk-SWJDLFDM.js +557 -0
- package/dist/bundle/chunk-TWCVCW5T.js +66 -0
- package/dist/bundle/chunk-V2R2BJJU.js +63 -0
- package/dist/bundle/chunk-V5K3M7FE.js +78 -0
- package/dist/bundle/chunk-V6ALLFEE.js +1068 -0
- package/dist/bundle/chunk-V6EVJXLO.js +259 -0
- package/dist/bundle/chunk-VJ4CPL6F.js +54 -0
- package/dist/bundle/chunk-VL25A6V2.js +41 -0
- package/dist/bundle/chunk-WBEZZGZE.js +12645 -0
- package/dist/bundle/chunk-WIYAMDPP.js +73 -0
- package/dist/bundle/chunk-WRJGITBX.js +76 -0
- package/dist/bundle/chunk-XHIVZPQ2.js +7 -0
- package/dist/bundle/chunk-XQUUANA2.js +24600 -0
- package/dist/bundle/chunk-XTQIXZVM.js +2788 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YKN4Y35P.js +206 -0
- package/dist/bundle/chunk-ZMJZQGCN.js +46 -0
- package/dist/bundle/chunk-ZPSH27BB.js +274 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-3FR7BK72.js +37 -0
- package/dist/bundle/command-server-entry-4XR4GDS7.js +166 -0
- package/dist/bundle/decode-24EITKP4.js +297 -0
- package/dist/bundle/definitions-HU62PG4L.js +43364 -0
- package/dist/bundle/dispatch-VE6CXCJW.js +411 -0
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/dist-ZSNEZYVF.js +7577 -0
- package/dist/bundle/echarts-LEVLEF7L.js +42501 -0
- package/dist/bundle/embed-G6FGY3VZ.js +38 -0
- package/dist/bundle/embedder-B6LNMXZZ.js +111 -0
- package/dist/bundle/failure-ASVFQXMF.js +25 -0
- package/dist/bundle/first-run-NVXVVALW.js +29 -0
- package/dist/bundle/first-screen-N3IPK5AT.js +37 -0
- package/dist/bundle/instructions-F3KPYMJK.js +11 -0
- package/dist/bundle/mcp-BUCB5ZPE.js +167 -0
- package/dist/bundle/meeting-combined-7FREWXMB.js +24 -0
- package/dist/bundle/meeting-model-GJPAIUQL.js +25 -0
- package/dist/bundle/meeting-semantic-YWY645AH.js +22 -0
- package/dist/bundle/node-KM3CUABH.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-WVUZSDLD.js +176 -0
- package/dist/bundle/node-sqlite-V4NNKABG.js +74 -0
- package/dist/bundle/oauth-7CENTQIN.js +20 -0
- package/dist/bundle/open-OLTONZBG.js +23 -0
- package/dist/bundle/openai-M6ES74YN.js +238 -0
- package/dist/bundle/process-VFIFK5KO.js +91 -0
- package/dist/bundle/program-N72VUDXM.js +33418 -0
- package/dist/bundle/prompt-TNWPBEBB.js +17 -0
- package/dist/bundle/recognize-PV2WOUWS.js +26 -0
- package/dist/bundle/remote-3F6JACS5.js +31 -0
- package/dist/bundle/rerank-33C67PIV.js +52 -0
- package/dist/bundle/schemas-RLDEALIJ.js +21410 -0
- package/dist/bundle/serve-3DEMACSQ.js +199 -0
- package/dist/bundle/server-AAK2HWQM.js +79 -0
- package/dist/bundle/server-LIBRGMUZ.js +212 -0
- package/dist/bundle/sqlite-runtime-SMAREHYG.js +20 -0
- package/dist/bundle/state-WPHAVJIU.js +36 -0
- package/dist/bundle/store-A7V4FEXE.js +177 -0
- package/dist/bundle/store-PMAPJNXT.js +291 -0
- package/dist/bundle/store-maintenance-command-QHRHAEYN.js +66 -0
- package/dist/bundle/surface-MN4RTNYW.js +65 -0
- package/dist/commands/api.d.ts +12 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +27 -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.d.ts +4 -0
- package/dist/commands/crm.d.ts.map +1 -0
- package/dist/commands/crm.js +66 -0
- package/dist/commands/crm.js.map +1 -0
- package/dist/commands/session.d.ts +7 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +22 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +14 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +37 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +31 -0
- package/dist/context.js.map +1 -0
- package/dist/generated/definitions.d.ts +3 -0
- package/dist/generated/definitions.d.ts.map +1 -0
- package/dist/generated/definitions.js +43360 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/manifest.d.ts +6 -0
- package/dist/generated/manifest.d.ts.map +1 -0
- package/dist/generated/manifest.js +5158 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/schemas.d.ts +383 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +21196 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +10156 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +5 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/generated/wirecat-config.d.ts +15 -0
- package/dist/generated/wirecat-config.d.ts.map +1 -0
- package/dist/generated/wirecat-config.js +328 -0
- package/dist/generated/wirecat-config.js.map +1 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +7 -0
- package/dist/hooks.js.map +1 -0
- package/dist/identity.d.ts +33 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +31 -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 +54 -0
- package/dist/program.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/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/package.json +87 -4
- package/skills/attio-cli/SKILL.md +58 -0
- package/skills/attio-cli/references/api/api-activities.md +62 -0
- package/skills/attio-cli/references/api/api-activity-records.md +96 -0
- package/skills/attio-cli/references/api/api-attributes.md +148 -0
- package/skills/attio-cli/references/api/api-call-recordings.md +53 -0
- package/skills/attio-cli/references/api/api-comments.md +36 -0
- package/skills/attio-cli/references/api/api-emails.md +23 -0
- package/skills/attio-cli/references/api/api-entries.md +127 -0
- package/skills/attio-cli/references/api/api-files.md +63 -0
- package/skills/attio-cli/references/api/api-lists.md +44 -0
- package/skills/attio-cli/references/api/api-meetings.md +82 -0
- package/skills/attio-cli/references/api/api-meta.md +8 -0
- package/skills/attio-cli/references/api/api-notes.md +64 -0
- package/skills/attio-cli/references/api/api-objects.md +55 -0
- package/skills/attio-cli/references/api/api-records.md +168 -0
- package/skills/attio-cli/references/api/api-sequences.md +15 -0
- package/skills/attio-cli/references/api/api-sql.md +15 -0
- package/skills/attio-cli/references/api/api-tasks.md +67 -0
- package/skills/attio-cli/references/api/api-threads.md +35 -0
- package/skills/attio-cli/references/api/api-transcripts.md +17 -0
- package/skills/attio-cli/references/api/api-views.md +133 -0
- package/skills/attio-cli/references/api/api-webhooks.md +62 -0
- package/skills/attio-cli/references/api/api-workspace-blocklist.md +39 -0
- package/skills/attio-cli/references/api/api-workspace-members.md +19 -0
- package/skills/attio-cli/references/api.md +35 -0
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
validateVector
|
|
5
|
+
} from "./chunk-HLLRNP2G.js";
|
|
6
|
+
import {
|
|
7
|
+
meaningFloor
|
|
8
|
+
} from "./chunk-ARRQVUJ2.js";
|
|
9
|
+
import {
|
|
10
|
+
MESSAGE_PARSING,
|
|
11
|
+
RRF_K
|
|
12
|
+
} from "./chunk-4EYKJLWI.js";
|
|
13
|
+
import {
|
|
14
|
+
normalize
|
|
15
|
+
} from "./chunk-DVN54VPI.js";
|
|
16
|
+
import {
|
|
17
|
+
formatMeetingReference,
|
|
18
|
+
implicitTextTerms,
|
|
19
|
+
liftMeetingFields,
|
|
20
|
+
parseLucene,
|
|
21
|
+
parseMeetingReference,
|
|
22
|
+
refreshMeetingIndex,
|
|
23
|
+
walkQuery
|
|
24
|
+
} from "./chunk-SP6DPFZ4.js";
|
|
25
|
+
import {
|
|
26
|
+
CliError
|
|
27
|
+
} from "./chunk-5DCRHSBI.js";
|
|
28
|
+
import {
|
|
29
|
+
__name
|
|
30
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
31
|
+
|
|
32
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
|
|
33
|
+
import { createHash } from "node:crypto";
|
|
34
|
+
|
|
35
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/search/question-plan.js
|
|
36
|
+
var words = /* @__PURE__ */ __name((text) => normalize(text).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
|
|
37
|
+
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");
|
|
38
|
+
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"));
|
|
39
|
+
var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
|
|
40
|
+
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"));
|
|
41
|
+
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"));
|
|
42
|
+
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"));
|
|
43
|
+
var isFunctionWord = /* @__PURE__ */ __name((word) => scaffolding.has(word) || QUESTION_STARTS.has(word) || QUESTION_FILLER.has(word) || LINKING.has(word), "isFunctionWord");
|
|
44
|
+
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");
|
|
45
|
+
function planQuestion(text, strict = false) {
|
|
46
|
+
if (strict)
|
|
47
|
+
return {
|
|
48
|
+
changed: false,
|
|
49
|
+
natural: false,
|
|
50
|
+
queries: [text],
|
|
51
|
+
scope: "",
|
|
52
|
+
terms: words(text),
|
|
53
|
+
rankingTerms: words(text),
|
|
54
|
+
removed: [],
|
|
55
|
+
aliases: []
|
|
56
|
+
};
|
|
57
|
+
const inputAst = parseLucene(text, MESSAGE_PARSING);
|
|
58
|
+
const rawTextual = walkQuery(inputAst.root).filter((node) => node.field === "text" || node.field === "exact");
|
|
59
|
+
const body = rawTextual.map((node) => node.value).join(" ");
|
|
60
|
+
const prefix = words(body).slice(0, 2);
|
|
61
|
+
const questionPrefix = [
|
|
62
|
+
"what",
|
|
63
|
+
"which",
|
|
64
|
+
"how",
|
|
65
|
+
"who",
|
|
66
|
+
"where",
|
|
67
|
+
"when",
|
|
68
|
+
"can",
|
|
69
|
+
"could",
|
|
70
|
+
"should",
|
|
71
|
+
"\u0441\u043A\u043E\u043B\u044C\u043A\u043E",
|
|
72
|
+
"\u043A\u0430\u043A\u043E\u0438",
|
|
73
|
+
"\u043A\u0430\u043A\u0430\u044F",
|
|
74
|
+
"\u043A\u0430\u043A\u0438\u0435",
|
|
75
|
+
"\u043A\u0430\u043A\u043E\u0435",
|
|
76
|
+
"\u043A\u0442\u043E",
|
|
77
|
+
"\u043A\u043E\u043C\u0443",
|
|
78
|
+
"\u043A\u0435\u043C",
|
|
79
|
+
"\u0433\u0434\u0435",
|
|
80
|
+
"\u043A\u043E\u0433\u0434\u0430",
|
|
81
|
+
"\u043A\u0430\u043A",
|
|
82
|
+
"\u0447\u0442\u043E",
|
|
83
|
+
"\u043C\u043E\u0436\u043D\u043E",
|
|
84
|
+
"\u043C\u043E\u0436\u0435\u0442",
|
|
85
|
+
"\u043C\u043E\u0433\u0443\u0442"
|
|
86
|
+
].includes(prefix[0] ?? "") || ["\u043A", "\u0432\u043E"].includes(prefix[0] ?? "") && ["\u043A\u043E\u043C\u0443", "\u0441\u043A\u043E\u043B\u044C\u043A\u043E"].includes(prefix[1] ?? "");
|
|
87
|
+
const natural = questionWord.test(body) && (/\?/u.test(body) || questionPrefix);
|
|
88
|
+
let cleaned = text;
|
|
89
|
+
if (natural && !text.includes("\\")) {
|
|
90
|
+
const last = rawTextual.at(-1);
|
|
91
|
+
const mark = (last?.span.end ?? 0) - 1;
|
|
92
|
+
if (last?.operator === "wildcard" && text[mark] === "?")
|
|
93
|
+
cleaned = text.slice(0, mark) + text.slice(mark + 1);
|
|
94
|
+
}
|
|
95
|
+
const ast = cleaned === text ? inputAst : parseLucene(cleaned, MESSAGE_PARSING);
|
|
96
|
+
const predicates = walkQuery(ast.root);
|
|
97
|
+
const textual = predicates.filter((p) => p.field === "text" || p.field === "exact");
|
|
98
|
+
const fields = predicates.filter((p) => p.field !== "text" && p.field !== "exact");
|
|
99
|
+
const scope = fields.map((p) => {
|
|
100
|
+
const raw = cleaned.slice(p.span.start, p.span.end);
|
|
101
|
+
return new RegExp(`^${p.field}[:=<>]`, "u").test(raw) ? raw : `${p.field}:${raw}`;
|
|
102
|
+
}).join(" ");
|
|
103
|
+
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.
|
|
104
|
+
textual.some((p) => !(p.operator === "term" || p.operator === "phrase" && !/\s/u.test(p.value)) || p.field === "exact");
|
|
105
|
+
if (bypass)
|
|
106
|
+
return {
|
|
107
|
+
changed: false,
|
|
108
|
+
natural: false,
|
|
109
|
+
queries: [text],
|
|
110
|
+
scope,
|
|
111
|
+
terms: textual.flatMap((p) => words(p.value)),
|
|
112
|
+
rankingTerms: textual.flatMap((p) => words(p.value)),
|
|
113
|
+
removed: [],
|
|
114
|
+
aliases: []
|
|
115
|
+
};
|
|
116
|
+
const original = textual.flatMap((p) => words(p.value));
|
|
117
|
+
const removed = original.filter((w) => scaffolding.has(w));
|
|
118
|
+
const terms = [...new Set(original.filter((w) => !scaffolding.has(w)))];
|
|
119
|
+
if (!terms.length)
|
|
120
|
+
return {
|
|
121
|
+
changed: false,
|
|
122
|
+
natural: true,
|
|
123
|
+
queries: [text],
|
|
124
|
+
scope,
|
|
125
|
+
terms,
|
|
126
|
+
rankingTerms: original,
|
|
127
|
+
removed,
|
|
128
|
+
aliases: []
|
|
129
|
+
};
|
|
130
|
+
const alias = [...terms];
|
|
131
|
+
const changes = [];
|
|
132
|
+
const replace = /* @__PURE__ */ __name((from, to) => {
|
|
133
|
+
for (let i = 0; i < alias.length; i++)
|
|
134
|
+
if (from.includes(alias[i] ?? "")) {
|
|
135
|
+
changes.push(`${alias[i]} -> ${to}`);
|
|
136
|
+
alias[i] = to;
|
|
137
|
+
}
|
|
138
|
+
}, "replace");
|
|
139
|
+
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))) {
|
|
140
|
+
replace(["returned", "refunded", "received"], "refund");
|
|
141
|
+
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");
|
|
142
|
+
}
|
|
143
|
+
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))) {
|
|
144
|
+
replace(["lifetime", "kept", "keep"], "retention");
|
|
145
|
+
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");
|
|
146
|
+
}
|
|
147
|
+
if (terms.includes("service") || terms.includes("build"))
|
|
148
|
+
replace(["currently", "now"], "current");
|
|
149
|
+
const render = /* @__PURE__ */ __name((ws) => [...new Set(ws)].join(" ") + (scope ? ` ${scope}` : ""), "render");
|
|
150
|
+
const queries = [.../* @__PURE__ */ new Set([render(terms), render(alias)])].slice(0, 2);
|
|
151
|
+
return { changed: true, natural: true, queries, scope, terms, rankingTerms: original, removed, aliases: changes };
|
|
152
|
+
}
|
|
153
|
+
__name(planQuestion, "planQuestion");
|
|
154
|
+
var questionText = /* @__PURE__ */ __name((text) => text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found), "questionText");
|
|
155
|
+
var lookupTerms = /* @__PURE__ */ __name((plan) => [
|
|
156
|
+
...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words(alias.split(" -> ")[1] ?? ""))))
|
|
157
|
+
], "lookupTerms");
|
|
158
|
+
var anyOfTerms = /* @__PURE__ */ __name((terms, scope) => `(${terms.join(" OR ")})${scope ? ` ${scope}` : ""}`, "anyOfTerms");
|
|
159
|
+
var questionLookup = /* @__PURE__ */ __name((text) => {
|
|
160
|
+
let plan;
|
|
161
|
+
try {
|
|
162
|
+
plan = planQuestion(questionText(text));
|
|
163
|
+
} catch (error) {
|
|
164
|
+
if (error instanceof CliError)
|
|
165
|
+
return void 0;
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
168
|
+
const terms = plan.changed ? lookupTerms(plan) : [];
|
|
169
|
+
return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
|
|
170
|
+
}, "questionLookup");
|
|
171
|
+
|
|
172
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
|
|
173
|
+
var resolveMeetingSelection = /* @__PURE__ */ __name(async (store, request) => {
|
|
174
|
+
const { project, tag, topic, ...input } = request;
|
|
175
|
+
input.signal?.throwIfAborted();
|
|
176
|
+
if (project !== void 0 && input.projectId !== void 0 || [tag, topic].filter((value) => value !== void 0).length + Number(input.tagId !== void 0) > 1)
|
|
177
|
+
throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
|
|
178
|
+
const selection = [];
|
|
179
|
+
const knowledge = store.knowledge;
|
|
180
|
+
if (!knowledge && [project, tag, topic].some((value) => value !== void 0))
|
|
181
|
+
throw new CliError("configuration_error", "this store cannot resolve project, tag or topic names");
|
|
182
|
+
for (const [kind, name] of [
|
|
183
|
+
["project", project],
|
|
184
|
+
["tag", tag],
|
|
185
|
+
["topic", topic]
|
|
186
|
+
]) {
|
|
187
|
+
if (name === void 0)
|
|
188
|
+
continue;
|
|
189
|
+
if (!knowledge)
|
|
190
|
+
continue;
|
|
191
|
+
const found = await knowledge.resolveVocabulary(name, { kind, signal: input.signal });
|
|
192
|
+
input.signal?.throwIfAborted();
|
|
193
|
+
if (found.ambiguous || found.matches.length !== 1)
|
|
194
|
+
throw new CliError(found.matches.length ? "validation_error" : "not_found", `the ${kind} name needs one canonical record`, {
|
|
195
|
+
candidates: found.matches.map((entry2) => ({ kind: entry2.kind, id: entry2.id, name: entry2.name }))
|
|
196
|
+
});
|
|
197
|
+
const entry = found.matches[0];
|
|
198
|
+
const id = Number(entry?.id);
|
|
199
|
+
if (!entry || entry.kind !== kind || !Number.isSafeInteger(id) || id < 1)
|
|
200
|
+
throw new CliError("invalid_response", "vocabulary resolution returned an invalid canonical record");
|
|
201
|
+
if (kind === "project")
|
|
202
|
+
input.projectId = id;
|
|
203
|
+
else
|
|
204
|
+
input.tagId = id;
|
|
205
|
+
selection.push({ kind, id, name: entry.name, by: "explicit-link" });
|
|
206
|
+
}
|
|
207
|
+
return { input, selection };
|
|
208
|
+
}, "resolveMeetingSelection");
|
|
209
|
+
|
|
210
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
|
|
211
|
+
var DEPTH = 200;
|
|
212
|
+
var cursorOf = /* @__PURE__ */ __name((value, key) => {
|
|
213
|
+
if (value === void 0)
|
|
214
|
+
return 0;
|
|
215
|
+
let cursor;
|
|
216
|
+
try {
|
|
217
|
+
cursor = JSON.parse(Buffer.from(value, "base64url").toString("utf8"));
|
|
218
|
+
} catch {
|
|
219
|
+
throw new CliError("validation_error", "the cursor is not from a combined meeting search; search again");
|
|
220
|
+
}
|
|
221
|
+
if (cursor?.version !== 1 || cursor.key !== key || !Number.isSafeInteger(cursor.offset) || cursor.offset < 0)
|
|
222
|
+
throw new CliError("validation_error", "the cursor belongs to another query, filter or model; search again");
|
|
223
|
+
return cursor.offset;
|
|
224
|
+
}, "cursorOf");
|
|
225
|
+
var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, typed, request) => {
|
|
226
|
+
const { maxChunks, maxRows, maxTextBytes, ...chosen } = request;
|
|
227
|
+
const { query, request: words2 } = liftMeetingFields(typed, chosen);
|
|
228
|
+
const { input, selection } = await resolveMeetingSelection(store, words2);
|
|
229
|
+
const { after, limit = 20, maxReadBytes, ...filters } = input;
|
|
230
|
+
const terms = questionTerms(query);
|
|
231
|
+
const wordQuery = terms === null ? query : terms.join(" ");
|
|
232
|
+
const key = createHash("sha256").update(JSON.stringify([query, embedder.key, Object.entries(filters).filter(([name]) => name !== "signal")])).digest("base64url");
|
|
233
|
+
const offset = cursorOf(after, key);
|
|
234
|
+
let byWords = [];
|
|
235
|
+
let indexing = "ready";
|
|
236
|
+
let refused;
|
|
237
|
+
if (wordQuery.trim()) {
|
|
238
|
+
await refreshMeetingIndex(store.meetings, input.accountId, input.signal);
|
|
239
|
+
try {
|
|
240
|
+
const page = await store.meetings.searchHits(wordQuery, { ...filters, limit: DEPTH, maxReadBytes });
|
|
241
|
+
byWords = page.items;
|
|
242
|
+
indexing = page.coverage.indexing;
|
|
243
|
+
} catch (error) {
|
|
244
|
+
if (!(error instanceof CliError) || error.code !== "validation_error")
|
|
245
|
+
throw error;
|
|
246
|
+
refused = error.message;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
input.signal?.throwIfAborted();
|
|
250
|
+
const vectors = await embedder.embed([query], "query");
|
|
251
|
+
if (vectors.length !== 1)
|
|
252
|
+
throw new CliError("invalid_response", "Meeting query model returned another vector count");
|
|
253
|
+
const vector = vectors[0];
|
|
254
|
+
const ranked = await store.meetingVectors.ranked(embedder.key, validateVector(vector, embedder.dims), {
|
|
255
|
+
...filters,
|
|
256
|
+
limit: DEPTH,
|
|
257
|
+
...maxChunks === void 0 ? {} : { maxChunks },
|
|
258
|
+
...maxRows === void 0 ? {} : { maxRows },
|
|
259
|
+
...maxTextBytes === void 0 ? {} : { maxTextBytes }
|
|
260
|
+
});
|
|
261
|
+
const floor = meaningFloor(embedder.key);
|
|
262
|
+
const byMeaning = ranked.items.filter(({ score }) => score > floor);
|
|
263
|
+
const merged = /* @__PURE__ */ new Map();
|
|
264
|
+
byMeaning.forEach((hit, rank) => {
|
|
265
|
+
const reference = { type: "meeting", accountId: input.accountId, meetingId: hit.meetingId };
|
|
266
|
+
const first = formatMeetingReference({
|
|
267
|
+
...reference,
|
|
268
|
+
transcriptId: hit.transcriptId,
|
|
269
|
+
cuePosition: hit.firstPosition
|
|
270
|
+
});
|
|
271
|
+
merged.set(`${hit.transcriptId}:${hit.firstPosition}`, {
|
|
272
|
+
ref: first,
|
|
273
|
+
meetingId: hit.meetingId,
|
|
274
|
+
scope: "transcript",
|
|
275
|
+
text: hit.text,
|
|
276
|
+
startMs: null,
|
|
277
|
+
source: { title: hit.title, startedAt: hit.startedAt, url: null },
|
|
278
|
+
by: ["meaning"],
|
|
279
|
+
score: hit.score,
|
|
280
|
+
passage: {
|
|
281
|
+
first,
|
|
282
|
+
last: formatMeetingReference({ ...reference, transcriptId: hit.transcriptId, cuePosition: hit.lastPosition })
|
|
283
|
+
},
|
|
284
|
+
fused: 1 / (RRF_K + rank + 1)
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
byWords.forEach((hit, rank) => {
|
|
288
|
+
const share = 1 / (RRF_K + rank + 1);
|
|
289
|
+
const cue = hit.scope === "transcript" ? parseMeetingReference(hit.ref) : void 0;
|
|
290
|
+
const within = cue?.cuePosition === void 0 ? void 0 : byMeaning.find((passage) => passage.transcriptId === cue.transcriptId && passage.firstPosition <= cue.cuePosition && cue.cuePosition <= passage.lastPosition);
|
|
291
|
+
const held = within && merged.get(`${within.transcriptId}:${within.firstPosition}`);
|
|
292
|
+
const found = {
|
|
293
|
+
ref: hit.ref,
|
|
294
|
+
text: hit.text,
|
|
295
|
+
startMs: hit.startMs,
|
|
296
|
+
...hit.match === void 0 ? {} : { match: hit.match },
|
|
297
|
+
...hit.corrections === void 0 ? {} : { corrections: hit.corrections }
|
|
298
|
+
};
|
|
299
|
+
if (held && !held.by.includes("words")) {
|
|
300
|
+
Object.assign(held, found, { by: ["words", "meaning"], fused: held.fused + share });
|
|
301
|
+
if (hit.source?.url)
|
|
302
|
+
held.source.url = hit.source.url;
|
|
303
|
+
} else if (held)
|
|
304
|
+
held.fused += share;
|
|
305
|
+
else
|
|
306
|
+
merged.set(`w:${hit.ref}:${hit.scope}:${hit.id}`, {
|
|
307
|
+
...found,
|
|
308
|
+
meetingId: hit.meetingId,
|
|
309
|
+
scope: hit.scope,
|
|
310
|
+
source: {
|
|
311
|
+
title: hit.source?.title ?? null,
|
|
312
|
+
startedAt: hit.source?.startedAt ?? null,
|
|
313
|
+
url: hit.source?.url ?? null
|
|
314
|
+
},
|
|
315
|
+
by: ["words"],
|
|
316
|
+
score: null,
|
|
317
|
+
fused: share
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
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));
|
|
321
|
+
const items = ordered.slice(offset, offset + limit).map(({ fused: _, ...hit }) => hit);
|
|
322
|
+
const hasMore = ordered.length > offset + limit;
|
|
323
|
+
return {
|
|
324
|
+
items,
|
|
325
|
+
hasMore,
|
|
326
|
+
nextCursor: hasMore ? Buffer.from(JSON.stringify({ version: 1, key, offset: offset + limit })).toString("base64url") : null,
|
|
327
|
+
selection,
|
|
328
|
+
words: {
|
|
329
|
+
query: wordQuery,
|
|
330
|
+
...terms === null ? {} : { from: "question" },
|
|
331
|
+
...refused === void 0 ? {} : { refused }
|
|
332
|
+
},
|
|
333
|
+
model: { key: embedder.key, model: embedder.model, kind: embedder.kind, dims: embedder.dims },
|
|
334
|
+
coverage: {
|
|
335
|
+
archiveCompleteness: "unknown",
|
|
336
|
+
indexCompleteness: "unknown",
|
|
337
|
+
indexing,
|
|
338
|
+
/** Every vector of the selection was compared; false when `maxChunks` stopped the scan. */
|
|
339
|
+
meaningScanComplete: ranked.complete,
|
|
340
|
+
scanned: ranked.scanned,
|
|
341
|
+
/** Each side ranks this many at most; pages past them hold nothing more. */
|
|
342
|
+
depth: DEPTH
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
}, "searchMeetingsCombined");
|
|
346
|
+
|
|
347
|
+
export {
|
|
348
|
+
words,
|
|
349
|
+
joinedHyphens,
|
|
350
|
+
isFunctionWord,
|
|
351
|
+
planQuestion,
|
|
352
|
+
questionText,
|
|
353
|
+
lookupTerms,
|
|
354
|
+
anyOfTerms,
|
|
355
|
+
questionLookup,
|
|
356
|
+
resolveMeetingSelection,
|
|
357
|
+
searchMeetingsCombined
|
|
358
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
MAX_SECRET_INPUT,
|
|
5
|
+
bufferedInput,
|
|
6
|
+
inputPolicy
|
|
7
|
+
} from "./chunk-AEPOHR4Z.js";
|
|
8
|
+
import {
|
|
9
|
+
CliError
|
|
10
|
+
} from "./chunk-5DCRHSBI.js";
|
|
11
|
+
import {
|
|
12
|
+
__name
|
|
13
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
14
|
+
|
|
15
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.700.0_@wirecat+cli-base@0.118.0_commander@15.0.0_esbuild@0.28.2_typ_365b7216b918b4ff8396dc0e09311081/node_modules/@wirecat/cli-core/dist/terminal/prompt.js
|
|
16
|
+
import { createInterface } from "node:readline";
|
|
17
|
+
import { Writable } from "node:stream";
|
|
18
|
+
var EMPTY_TRIES = 3;
|
|
19
|
+
var pasteHint = /* @__PURE__ */ __name((platform = process.platform) => `Nothing arrived. To paste in a terminal, use ${platform === "darwin" ? "Cmd+V" : "Ctrl+Shift+V (or right-click \u2192 Paste)"}.`, "pasteHint");
|
|
20
|
+
var readSecret = /* @__PURE__ */ __name(async (prompt, { input = process.stdin, output = process.stderr, echo = false, signal: givenSignal } = {}) => {
|
|
21
|
+
const policy = inputPolicy(input);
|
|
22
|
+
const signals = [givenSignal, policy.signal].filter((one) => one !== void 0);
|
|
23
|
+
const signal = signals.length ? AbortSignal.any(signals) : void 0;
|
|
24
|
+
const cancelled = /* @__PURE__ */ __name(() => new CliError("cancelled", "cancelled \u2014 nothing was stored"), "cancelled");
|
|
25
|
+
if (signal?.aborted)
|
|
26
|
+
throw cancelled();
|
|
27
|
+
if (input.isTTY && policy.noInput)
|
|
28
|
+
throw new CliError("validation_error", "interactive input is disabled \u2014 provide the input through a pipe", {
|
|
29
|
+
reason: "input.required"
|
|
30
|
+
});
|
|
31
|
+
if (!input.isTTY) {
|
|
32
|
+
return (await bufferedInput(input, {
|
|
33
|
+
maxBytes: Math.min(policy.maxBytes ?? MAX_SECRET_INPUT, MAX_SECRET_INPUT),
|
|
34
|
+
...signal ? { signal } : {}
|
|
35
|
+
})).toString("utf8").trim();
|
|
36
|
+
}
|
|
37
|
+
let muted = false;
|
|
38
|
+
const shim = new Writable({
|
|
39
|
+
write(chunk, _encoding, done) {
|
|
40
|
+
if (!muted)
|
|
41
|
+
output.write(chunk);
|
|
42
|
+
done();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const reader = createInterface({ input, output: shim, terminal: true });
|
|
46
|
+
const abort = /* @__PURE__ */ __name(() => reader.close(), "abort");
|
|
47
|
+
let bytes = 0;
|
|
48
|
+
let inputFailure;
|
|
49
|
+
const data = /* @__PURE__ */ __name((chunk) => {
|
|
50
|
+
bytes += Buffer.byteLength(chunk);
|
|
51
|
+
if (bytes > Math.min(policy.maxBytes ?? MAX_SECRET_INPUT, MAX_SECRET_INPUT)) {
|
|
52
|
+
inputFailure = new CliError("validation_error", "secret input exceeds its byte limit", {
|
|
53
|
+
reason: "input.too-large",
|
|
54
|
+
retryable: false
|
|
55
|
+
});
|
|
56
|
+
reader.close();
|
|
57
|
+
}
|
|
58
|
+
}, "data");
|
|
59
|
+
const inputError = /* @__PURE__ */ __name((error) => {
|
|
60
|
+
inputFailure = error;
|
|
61
|
+
reader.close();
|
|
62
|
+
}, "inputError");
|
|
63
|
+
input.on("data", data).on("error", inputError);
|
|
64
|
+
try {
|
|
65
|
+
const answer = await new Promise((resolve, reject) => {
|
|
66
|
+
const cancel = /* @__PURE__ */ __name(() => reject(inputFailure ?? cancelled()), "cancel");
|
|
67
|
+
reader.once("SIGINT", cancel);
|
|
68
|
+
reader.once("close", cancel);
|
|
69
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
70
|
+
const ask = /* @__PURE__ */ __name((tries) => {
|
|
71
|
+
muted = false;
|
|
72
|
+
reader.question(prompt, (line) => {
|
|
73
|
+
if (echo || line.trim() || tries >= EMPTY_TRIES)
|
|
74
|
+
return resolve(line);
|
|
75
|
+
output.write(`
|
|
76
|
+
${pasteHint()}
|
|
77
|
+
`);
|
|
78
|
+
ask(tries + 1);
|
|
79
|
+
});
|
|
80
|
+
muted = !echo;
|
|
81
|
+
}, "ask");
|
|
82
|
+
ask(1);
|
|
83
|
+
});
|
|
84
|
+
if (!echo && !answer.trim())
|
|
85
|
+
throw new CliError("validation_error", `nothing arrived after ${EMPTY_TRIES} tries. ${pasteHint()}`, {
|
|
86
|
+
reason: "input.empty"
|
|
87
|
+
});
|
|
88
|
+
return answer.trim();
|
|
89
|
+
} finally {
|
|
90
|
+
input.off("data", data).off("error", inputError);
|
|
91
|
+
signal?.removeEventListener("abort", abort);
|
|
92
|
+
reader.close();
|
|
93
|
+
output.write("\n");
|
|
94
|
+
}
|
|
95
|
+
}, "readSecret");
|
|
96
|
+
|
|
97
|
+
export {
|
|
98
|
+
pasteHint,
|
|
99
|
+
readSecret
|
|
100
|
+
};
|