@wirecat/amo-cli 0.5.0 → 0.7.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 +33 -0
- package/README.md +2 -2
- package/contracts/wirecat.json +14 -0
- package/dist/amo/button.js +1 -1
- package/dist/amo/json.js +1 -1
- package/dist/amo/oauth.js +3 -5
- package/dist/amo/transport.js +3 -7
- package/dist/api-keys.js +1 -1
- package/dist/bin/amo.js +11 -11
- package/dist/bundle/amo.js +5 -183
- package/dist/bundle/{chunk-3PYE55JY.js → chunk-3HWD4BKU.js} +4 -6
- package/dist/bundle/{chunk-M6VZXAJC.js → chunk-4EXURQQQ.js} +21 -19
- package/dist/bundle/chunk-AEWYRB6F.js +8 -0
- package/dist/bundle/{chunk-WUFX4TKA.js → chunk-GL7CRTHR.js} +3 -3
- package/dist/bundle/chunk-N2UB32VN.js +76 -0
- package/dist/bundle/{chunk-KZ2FIDI3.js → chunk-PVVSHDMQ.js} +7 -15
- package/dist/bundle/program-SQH3SPOW.js +2352 -0
- package/dist/bundle/{instructions-AMH5RWVJ.js → source-C65ZJUTW.js} +5 -6
- package/dist/bundle/store-SJ2TOUGU.js +12 -0
- package/dist/bundle/writer-I7GBI3VE.js +12 -0
- package/dist/commands/account.js +1 -1
- package/dist/commands/api.js +1 -3
- package/dist/commands/crm-shared.js +2 -3
- package/dist/commands/schedule.js +1 -1
- package/dist/commands/session.js +1 -8
- package/dist/commands/write.js +1 -2
- package/dist/config.js +1 -2
- package/dist/context.js +1 -2
- package/dist/crm/activities.js +1 -1
- package/dist/crm/records.js +1 -1
- package/dist/crm/source.js +1 -1
- package/dist/crm/writer.js +1 -1
- package/dist/identity.js +4 -0
- package/dist/program.js +1 -2
- package/dist/setup/flow.js +1 -1
- package/dist/store.js +1 -1
- package/dist/version.js +1 -1
- package/dist/whoami.js +1 -1
- package/package.json +3 -3
- package/scenarios/first-sync.md +13 -11
- package/scenarios/keep-in-sync.md +7 -6
- package/scenarios/safe-agent-writes.md +10 -9
- package/dist/amo/account.d.ts +0 -18
- package/dist/amo/account.d.ts.map +0 -1
- package/dist/amo/account.js.map +0 -1
- package/dist/amo/allow-list.d.ts +0 -31
- package/dist/amo/allow-list.d.ts.map +0 -1
- package/dist/amo/allow-list.js.map +0 -1
- package/dist/amo/button.d.ts +0 -53
- package/dist/amo/button.d.ts.map +0 -1
- package/dist/amo/button.js.map +0 -1
- package/dist/amo/errors.d.ts +0 -12
- package/dist/amo/errors.d.ts.map +0 -1
- package/dist/amo/errors.js.map +0 -1
- package/dist/amo/json.d.ts +0 -3
- package/dist/amo/json.d.ts.map +0 -1
- package/dist/amo/json.js.map +0 -1
- package/dist/amo/oauth.d.ts +0 -64
- package/dist/amo/oauth.d.ts.map +0 -1
- package/dist/amo/oauth.js.map +0 -1
- package/dist/amo/operation.d.ts +0 -45
- package/dist/amo/operation.d.ts.map +0 -1
- package/dist/amo/operation.js.map +0 -1
- package/dist/amo/operations.d.ts +0 -3
- package/dist/amo/operations.d.ts.map +0 -1
- package/dist/amo/operations.js.map +0 -1
- package/dist/amo/routes.d.ts +0 -67
- package/dist/amo/routes.d.ts.map +0 -1
- package/dist/amo/routes.js.map +0 -1
- package/dist/amo/transport.d.ts +0 -62
- package/dist/amo/transport.d.ts.map +0 -1
- package/dist/amo/transport.js.map +0 -1
- package/dist/api-keys.d.ts +0 -47
- package/dist/api-keys.d.ts.map +0 -1
- package/dist/api-keys.js.map +0 -1
- package/dist/bin/amo.d.ts +0 -3
- package/dist/bin/amo.d.ts.map +0 -1
- package/dist/bin/amo.js.map +0 -1
- package/dist/bundle/agent-EFMUK732.js +0 -41
- package/dist/bundle/all-profiles-PIWUQWBA.js +0 -320
- package/dist/bundle/anthropic-47CMXBPQ.js +0 -90
- package/dist/bundle/app-server-QRBQODF2.js +0 -257
- package/dist/bundle/areas-QVHVU57Z.js +0 -63
- package/dist/bundle/bun-OPDGMZZQ.js +0 -169
- package/dist/bundle/bun-sqlite-7I4X7CZW.js +0 -75
- package/dist/bundle/chunk-2JHVQMVC.js +0 -16
- package/dist/bundle/chunk-2XBDILVW.js +0 -53
- package/dist/bundle/chunk-3DEQUYEG.js +0 -185
- package/dist/bundle/chunk-3GX6KM2E.js +0 -5302
- package/dist/bundle/chunk-3HC5F3P7.js +0 -24
- package/dist/bundle/chunk-3YM4B2GT.js +0 -63
- package/dist/bundle/chunk-43OW5NTG.js +0 -338
- package/dist/bundle/chunk-43PMSR33.js +0 -357
- package/dist/bundle/chunk-4N7PP76S.js +0 -6848
- package/dist/bundle/chunk-4VN7RI4I.js +0 -1718
- package/dist/bundle/chunk-57HFPNMF.js +0 -189
- package/dist/bundle/chunk-5UTB3ADZ.js +0 -360
- package/dist/bundle/chunk-633NQY2R.js +0 -80
- package/dist/bundle/chunk-63N46DJU.js +0 -12278
- package/dist/bundle/chunk-6D4VWSJD.js +0 -259
- package/dist/bundle/chunk-6JTHXWPE.js +0 -64
- package/dist/bundle/chunk-6QGUK3H7.js +0 -161
- package/dist/bundle/chunk-6WS6GJ4V.js +0 -30
- package/dist/bundle/chunk-7IR2G5XY.js +0 -559
- package/dist/bundle/chunk-7IWIFVXH.js +0 -52
- package/dist/bundle/chunk-ABX7BBS4.js +0 -388
- package/dist/bundle/chunk-ADLS6FVG.js +0 -24600
- package/dist/bundle/chunk-ADTI5RUO.js +0 -1007
- package/dist/bundle/chunk-AKRIUNYP.js +0 -1197
- package/dist/bundle/chunk-BIKOE2IW.js +0 -614
- package/dist/bundle/chunk-BVVMIAQ6.js +0 -37727
- package/dist/bundle/chunk-CGW5R4UD.js +0 -362
- package/dist/bundle/chunk-D4NE7EON.js +0 -170
- package/dist/bundle/chunk-D72URWJE.js +0 -532
- package/dist/bundle/chunk-DFDN6AUB.js +0 -21
- package/dist/bundle/chunk-DNCLQPOM.js +0 -7
- package/dist/bundle/chunk-DPV53EZC.js +0 -206
- package/dist/bundle/chunk-DQ6S5TFZ.js +0 -9539
- package/dist/bundle/chunk-DSJ6EAOA.js +0 -4172
- package/dist/bundle/chunk-DVZ75WZJ.js +0 -3752
- package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
- package/dist/bundle/chunk-EHK73OSW.js +0 -2017
- package/dist/bundle/chunk-FNV5HLHX.js +0 -1068
- package/dist/bundle/chunk-FV4GQNIK.js +0 -136
- package/dist/bundle/chunk-G2TU5RYY.js +0 -332
- package/dist/bundle/chunk-GDK7ETSB.js +0 -218
- package/dist/bundle/chunk-GGMAIIVE.js +0 -38
- package/dist/bundle/chunk-GLYWZQY4.js +0 -86
- package/dist/bundle/chunk-H4AFNENN.js +0 -1343
- package/dist/bundle/chunk-HOF7GQWW.js +0 -142
- package/dist/bundle/chunk-HSPEU6S7.js +0 -209
- package/dist/bundle/chunk-IA7LLLEI.js +0 -100
- package/dist/bundle/chunk-IB55P46L.js +0 -334
- package/dist/bundle/chunk-IG2TJQJ7.js +0 -79
- package/dist/bundle/chunk-JG6LCSEX.js +0 -407
- package/dist/bundle/chunk-JLXXUEAM.js +0 -72
- package/dist/bundle/chunk-JXT6GY4V.js +0 -1023
- package/dist/bundle/chunk-K7YY6SXR.js +0 -738
- package/dist/bundle/chunk-KEKXERBE.js +0 -67181
- package/dist/bundle/chunk-KZN2BG3P.js +0 -721
- package/dist/bundle/chunk-LKH3UKLO.js +0 -230
- package/dist/bundle/chunk-LZPKBN3C.js +0 -193
- package/dist/bundle/chunk-MDEPJZYJ.js +0 -106
- package/dist/bundle/chunk-NB7EOAUZ.js +0 -123
- package/dist/bundle/chunk-NISH4UXM.js +0 -58
- package/dist/bundle/chunk-NSKMNIY6.js +0 -460
- package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
- package/dist/bundle/chunk-PPSAWFJD.js +0 -1293
- package/dist/bundle/chunk-Q7ICVP25.js +0 -18
- package/dist/bundle/chunk-QFOP3KUP.js +0 -2603
- package/dist/bundle/chunk-R53XXHEI.js +0 -76
- package/dist/bundle/chunk-RIMPFMZE.js +0 -1251
- package/dist/bundle/chunk-RN6RT5CB.js +0 -58
- package/dist/bundle/chunk-RRTMPSQR.js +0 -29
- package/dist/bundle/chunk-S4ZHQMNM.js +0 -133
- package/dist/bundle/chunk-S6JG4YUH.js +0 -72
- package/dist/bundle/chunk-TAVI73RW.js +0 -288
- package/dist/bundle/chunk-TLG6ECZ2.js +0 -54
- package/dist/bundle/chunk-TXDR6YSF.js +0 -23
- package/dist/bundle/chunk-TY7NDMFY.js +0 -46
- package/dist/bundle/chunk-U5RJJ2EC.js +0 -353
- package/dist/bundle/chunk-UDSL3MUU.js +0 -2333
- package/dist/bundle/chunk-V2CNGXWX.js +0 -798
- package/dist/bundle/chunk-VB7FZOYX.js +0 -633
- package/dist/bundle/chunk-VZ5PPYDG.js +0 -77
- package/dist/bundle/chunk-W5JRXIG6.js +0 -27995
- package/dist/bundle/chunk-WIHN3ELW.js +0 -2793
- package/dist/bundle/chunk-WOPVBRPV.js +0 -29
- package/dist/bundle/chunk-WXJYMMEL.js +0 -95
- package/dist/bundle/chunk-XCCU2E3Z.js +0 -274
- package/dist/bundle/chunk-XEQQJBBO.js +0 -92
- package/dist/bundle/chunk-XUT7DSM5.js +0 -108
- package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
- package/dist/bundle/chunk-YWDFYQOU.js +0 -82
- package/dist/bundle/chunk-ZLUIRFJX.js +0 -780
- package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
- package/dist/bundle/cli-3NXOSENF.js +0 -1239
- package/dist/bundle/command-contract-LNSAV5LA.js +0 -39
- package/dist/bundle/command-server-entry-4ZQPNUL4.js +0 -168
- package/dist/bundle/decode-K7U7X5EL.js +0 -296
- package/dist/bundle/dispatch-56FECRCU.js +0 -411
- package/dist/bundle/dist-PAKDDIBT.js +0 -191
- package/dist/bundle/dist-T54K3FJV.js +0 -7577
- package/dist/bundle/echarts-O3TNDAXJ.js +0 -42501
- package/dist/bundle/embed-SWLVG73O.js +0 -37
- package/dist/bundle/embedder-EJN75BPV.js +0 -110
- package/dist/bundle/failure-WDSX6H3B.js +0 -24
- package/dist/bundle/first-run-WPGUUC4Z.js +0 -28
- package/dist/bundle/first-screen-JMNEUQ46.js +0 -40
- package/dist/bundle/mcp-5HFPWC3W.js +0 -167
- package/dist/bundle/meeting-combined-5TKG2RYD.js +0 -24
- package/dist/bundle/meeting-model-YXXNETKC.js +0 -24
- package/dist/bundle/meeting-semantic-U7EUB3ET.js +0 -21
- package/dist/bundle/node-EGMCBAO7.js +0 -176
- package/dist/bundle/node-P4E63KXA.js +0 -2340
- package/dist/bundle/node-TLZSIHIJ.js +0 -21
- package/dist/bundle/node-sqlite-YVOGMDSP.js +0 -73
- package/dist/bundle/oauth-2SNRBIJM.js +0 -19
- package/dist/bundle/open-ABCPY5IH.js +0 -22
- package/dist/bundle/openai-4D6PXJR7.js +0 -237
- package/dist/bundle/process-SGHEN6MQ.js +0 -91
- package/dist/bundle/program-CBDQBZZ3.js +0 -4971
- package/dist/bundle/prompt-2QUK5QST.js +0 -16
- package/dist/bundle/recognize-QMQSJRIH.js +0 -25
- package/dist/bundle/remote-U7TC2BLZ.js +0 -30
- package/dist/bundle/rerank-5UPVXGVV.js +0 -51
- package/dist/bundle/serve-VX6GUM6J.js +0 -198
- package/dist/bundle/server-FOPC6DJ3.js +0 -219
- package/dist/bundle/server-OIVNOMVK.js +0 -87
- package/dist/bundle/source-HWS5SJIV.js +0 -46
- package/dist/bundle/sqlite-runtime-77NKDEXN.js +0 -19
- package/dist/bundle/state-X2HU6GB2.js +0 -35
- package/dist/bundle/store-2U4U6KL4.js +0 -184
- package/dist/bundle/store-3CHPHFP7.js +0 -301
- package/dist/bundle/store-Z3747L5F.js +0 -34
- package/dist/bundle/store-maintenance-command-UOSZJTVP.js +0 -74
- package/dist/bundle/surface-MUT72QON.js +0 -73
- package/dist/bundle/writer-RBKQ64ZM.js +0 -48
- package/dist/commands/account.d.ts +0 -4
- package/dist/commands/account.d.ts.map +0 -1
- package/dist/commands/account.js.map +0 -1
- package/dist/commands/api.d.ts +0 -3
- package/dist/commands/api.d.ts.map +0 -1
- package/dist/commands/api.js.map +0 -1
- package/dist/commands/crm-shared.d.ts +0 -8
- package/dist/commands/crm-shared.d.ts.map +0 -1
- package/dist/commands/crm-shared.js.map +0 -1
- package/dist/commands/schedule.d.ts +0 -3
- package/dist/commands/schedule.d.ts.map +0 -1
- package/dist/commands/schedule.js.map +0 -1
- package/dist/commands/session.d.ts +0 -35
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js.map +0 -1
- package/dist/commands/write.d.ts +0 -14
- package/dist/commands/write.d.ts.map +0 -1
- package/dist/commands/write.js.map +0 -1
- package/dist/config.d.ts +0 -4
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/context.d.ts +0 -62
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/crm/activities.d.ts +0 -32
- package/dist/crm/activities.d.ts.map +0 -1
- package/dist/crm/activities.js.map +0 -1
- package/dist/crm/records.d.ts +0 -20
- package/dist/crm/records.d.ts.map +0 -1
- package/dist/crm/records.js.map +0 -1
- package/dist/crm/source.d.ts +0 -41
- package/dist/crm/source.d.ts.map +0 -1
- package/dist/crm/source.js.map +0 -1
- package/dist/crm/writer.d.ts +0 -14
- package/dist/crm/writer.d.ts.map +0 -1
- package/dist/crm/writer.js.map +0 -1
- package/dist/identity.d.ts +0 -7
- package/dist/identity.d.ts.map +0 -1
- package/dist/identity.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/program.d.ts +0 -6
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js.map +0 -1
- package/dist/reasons.d.ts +0 -10
- package/dist/reasons.d.ts.map +0 -1
- package/dist/reasons.js.map +0 -1
- package/dist/setup/flow.d.ts +0 -2
- package/dist/setup/flow.d.ts.map +0 -1
- package/dist/setup/flow.js.map +0 -1
- package/dist/store.d.ts +0 -15
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/wcat.d.ts +0 -3
- package/dist/wcat.d.ts.map +0 -1
- package/dist/wcat.js.map +0 -1
- package/dist/whoami.d.ts +0 -24
- package/dist/whoami.d.ts.map +0 -1
- package/dist/whoami.js.map +0 -1
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
importFrom
|
|
5
|
-
} from "./chunk-Y5E2WNWB.js";
|
|
6
|
-
import {
|
|
7
|
-
CliError
|
|
8
|
-
} from "./chunk-S6JG4YUH.js";
|
|
9
|
-
import {
|
|
10
|
-
__name
|
|
11
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
-
|
|
13
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
14
|
-
import { createRequire } from "node:module";
|
|
15
|
-
|
|
16
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
|
|
17
|
-
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
|
|
18
|
-
var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
19
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
20
|
-
let offset = 0;
|
|
21
|
-
let serial;
|
|
22
|
-
let packet = 0;
|
|
23
|
-
let length = 0;
|
|
24
|
-
const prefix = [];
|
|
25
|
-
while (offset < bytes.length) {
|
|
26
|
-
if (offset + 27 > bytes.length || view.getUint32(offset, false) !== 1332176723 || bytes[offset + 4] !== 0)
|
|
27
|
-
throw invalid();
|
|
28
|
-
const stream = view.getUint32(offset + 14, true);
|
|
29
|
-
if (serial !== void 0 && serial !== stream)
|
|
30
|
-
throw invalid();
|
|
31
|
-
serial = stream;
|
|
32
|
-
const segments = bytes[offset + 26] ?? 0;
|
|
33
|
-
let data = offset + 27 + segments;
|
|
34
|
-
if (data > bytes.length || Boolean((bytes[offset + 5] ?? 0) & 1) !== length > 0)
|
|
35
|
-
throw invalid();
|
|
36
|
-
for (let index = 0; index < segments; index++) {
|
|
37
|
-
const size = bytes[offset + 27 + index] ?? 0;
|
|
38
|
-
if (data + size > bytes.length)
|
|
39
|
-
throw invalid();
|
|
40
|
-
const take = Math.min(size, 19 - prefix.length);
|
|
41
|
-
for (let i = 0; i < take; i++)
|
|
42
|
-
prefix.push(bytes[data + i] ?? 0);
|
|
43
|
-
length += size;
|
|
44
|
-
data += size;
|
|
45
|
-
if (size === 255)
|
|
46
|
-
continue;
|
|
47
|
-
if (packet === 0) {
|
|
48
|
-
if (length < 19 || String.fromCharCode(...prefix.slice(0, 8)) !== "OpusHead" || ![1, 2].includes(prefix[9] ?? 0) || prefix[18] !== 0)
|
|
49
|
-
throw invalid();
|
|
50
|
-
} else if (packet === 1) {
|
|
51
|
-
if (length < 8 || String.fromCharCode(...prefix.slice(0, 8)) !== "OpusTags")
|
|
52
|
-
throw invalid();
|
|
53
|
-
} else {
|
|
54
|
-
if (length < 1)
|
|
55
|
-
throw invalid();
|
|
56
|
-
const toc = prefix[0] ?? 0;
|
|
57
|
-
const config = toc >> 3;
|
|
58
|
-
const frame = config >= 16 ? 120 << (config & 3) : config >= 12 ? 480 << (config & 1) : (config & 3) === 3 ? 2880 : 480 << (config & 3);
|
|
59
|
-
const count = (toc & 3) === 0 ? 1 : (toc & 3) === 3 ? length >= 2 ? (prefix[1] ?? 0) & 63 : 0 : 2;
|
|
60
|
-
if (count < 1 || frame * count > 5760)
|
|
61
|
-
throw invalid();
|
|
62
|
-
}
|
|
63
|
-
packet++;
|
|
64
|
-
length = 0;
|
|
65
|
-
prefix.length = 0;
|
|
66
|
-
}
|
|
67
|
-
offset = data;
|
|
68
|
-
}
|
|
69
|
-
if (length !== 0 || packet < 3)
|
|
70
|
-
throw invalid();
|
|
71
|
-
}, "checkOggDuration");
|
|
72
|
-
|
|
73
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
74
|
-
var SAMPLE_RATE = 16e3;
|
|
75
|
-
var LEAD = SAMPLE_RATE / 2;
|
|
76
|
-
var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
|
|
77
|
-
const step = rate / SAMPLE_RATE;
|
|
78
|
-
const length = Math.floor(samples.length / step);
|
|
79
|
-
const pcm = new Float32Array(LEAD + length);
|
|
80
|
-
for (let i = 0; i < length; i++) {
|
|
81
|
-
const from = Math.floor(i * step);
|
|
82
|
-
const to = Math.max(from + 1, Math.floor((i + 1) * step));
|
|
83
|
-
let sum = 0;
|
|
84
|
-
for (let j = from; j < to; j++)
|
|
85
|
-
sum += samples[j] ?? 0;
|
|
86
|
-
pcm[LEAD + i] = sum / (to - from);
|
|
87
|
-
}
|
|
88
|
-
return pcm;
|
|
89
|
-
}, "toModelRate");
|
|
90
|
-
var decodeOgg = /* @__PURE__ */ __name(async (bytes) => {
|
|
91
|
-
checkOggDuration(bytes);
|
|
92
|
-
const { OggOpusDecoder } = await importFrom(new URL("speech/recognize.js", import.meta.resolve("@wirecat/cli-core")).href, "ogg-opus-decoder");
|
|
93
|
-
const decoder = new OggOpusDecoder();
|
|
94
|
-
await decoder.ready;
|
|
95
|
-
try {
|
|
96
|
-
const { channelData, sampleRate, samplesDecoded } = await decoder.decodeFile(bytes);
|
|
97
|
-
if (!channelData[0] || samplesDecoded === 0)
|
|
98
|
-
throw new Error("no Ogg Opus audio in it");
|
|
99
|
-
return channelData.map((samples) => ({ samples, rate: sampleRate }));
|
|
100
|
-
} finally {
|
|
101
|
-
decoder.free();
|
|
102
|
-
}
|
|
103
|
-
}, "decodeOgg");
|
|
104
|
-
var WINDOW = 512;
|
|
105
|
-
var detector = /* @__PURE__ */ __name((vadModel) => ({
|
|
106
|
-
sileroVad: {
|
|
107
|
-
model: vadModel,
|
|
108
|
-
// At the default 0.5 a quietly spoken stretch in the middle of a voice message never counted as
|
|
109
|
-
// speech and was lost; 0.3 keeps it for both models and changes nothing on clear speech (126508, 2026-09-30).
|
|
110
|
-
threshold: 0.3,
|
|
111
|
-
minSilenceDuration: 0.5,
|
|
112
|
-
minSpeechDuration: 0.25,
|
|
113
|
-
maxSpeechDuration: 20,
|
|
114
|
-
windowSize: WINDOW
|
|
115
|
-
},
|
|
116
|
-
sampleRate: SAMPLE_RATE,
|
|
117
|
-
numThreads: 1,
|
|
118
|
-
provider: "cpu",
|
|
119
|
-
debug: 0,
|
|
120
|
-
bufferSizeInSeconds: 30
|
|
121
|
-
}), "detector");
|
|
122
|
-
var cut = /* @__PURE__ */ __name((vad, pcm, each) => {
|
|
123
|
-
vad.reset();
|
|
124
|
-
const last = Math.max(0, pcm.length - LEAD);
|
|
125
|
-
const drain = /* @__PURE__ */ __name(() => {
|
|
126
|
-
for (; !vad.isEmpty(); vad.pop()) {
|
|
127
|
-
const { start, samples } = vad.front();
|
|
128
|
-
each({
|
|
129
|
-
start: Math.min(last, Math.max(0, start - LEAD)) / SAMPLE_RATE,
|
|
130
|
-
end: Math.min(last, Math.max(0, start + samples.length - LEAD)) / SAMPLE_RATE,
|
|
131
|
-
samples
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}, "drain");
|
|
135
|
-
for (let i = 0; i + WINDOW <= pcm.length; i += WINDOW) {
|
|
136
|
-
vad.acceptWaveform(pcm.subarray(i, i + WINDOW));
|
|
137
|
-
drain();
|
|
138
|
-
}
|
|
139
|
-
vad.flush();
|
|
140
|
-
drain();
|
|
141
|
-
}, "cut");
|
|
142
|
-
var openSpeechCutter = /* @__PURE__ */ __name((vadModel) => {
|
|
143
|
-
const vad = loadSherpa().createVad(detector(vadModel));
|
|
144
|
-
return {
|
|
145
|
-
cut: /* @__PURE__ */ __name((pcm) => {
|
|
146
|
-
const spans = [];
|
|
147
|
-
cut(vad, pcm, ({ start, end }) => spans.push({ start, end }));
|
|
148
|
-
return spans;
|
|
149
|
-
}, "cut"),
|
|
150
|
-
free: /* @__PURE__ */ __name(() => vad.free(), "free")
|
|
151
|
-
};
|
|
152
|
-
}, "openSpeechCutter");
|
|
153
|
-
var loaded;
|
|
154
|
-
var loadSherpa = /* @__PURE__ */ __name(() => {
|
|
155
|
-
if (loaded)
|
|
156
|
-
return loaded;
|
|
157
|
-
const load = createRequire(new URL("speech/recognize.js", import.meta.resolve("@wirecat/cli-core")).href);
|
|
158
|
-
const wasm = {};
|
|
159
|
-
load("sherpa-onnx/sherpa-onnx-wasm-nodejs.js")(wasm);
|
|
160
|
-
const stdout = wasm.FS?.getStream(1);
|
|
161
|
-
if (stdout)
|
|
162
|
-
stdout.nfd = 2;
|
|
163
|
-
const asr = load("sherpa-onnx/sherpa-onnx-asr.js");
|
|
164
|
-
const vad = load("sherpa-onnx/sherpa-onnx-vad.js");
|
|
165
|
-
loaded = {
|
|
166
|
-
createOfflineRecognizer: /* @__PURE__ */ __name((config) => new asr.OfflineRecognizer(config, wasm), "createOfflineRecognizer"),
|
|
167
|
-
createVad: /* @__PURE__ */ __name((config) => vad.createVad(wasm, config), "createVad")
|
|
168
|
-
};
|
|
169
|
-
return loaded;
|
|
170
|
-
}, "loadSherpa");
|
|
171
|
-
var openRecognizer = /* @__PURE__ */ __name((model, path, vadModel) => {
|
|
172
|
-
const sherpa = loadSherpa();
|
|
173
|
-
const engine = sherpa.createOfflineRecognizer({
|
|
174
|
-
featConfig: { sampleRate: SAMPLE_RATE, featureDim: model.featureDim },
|
|
175
|
-
modelConfig: { ...model.config(path), numThreads: 1, provider: "cpu", debug: 0 },
|
|
176
|
-
decodingMethod: "greedy_search"
|
|
177
|
-
});
|
|
178
|
-
const vad = sherpa.createVad(detector(vadModel));
|
|
179
|
-
const piece = /* @__PURE__ */ __name((samples) => {
|
|
180
|
-
const stream = engine.createStream();
|
|
181
|
-
try {
|
|
182
|
-
stream.acceptWaveform(SAMPLE_RATE, samples);
|
|
183
|
-
engine.decode(stream);
|
|
184
|
-
return engine.getResult(stream).text.trim();
|
|
185
|
-
} finally {
|
|
186
|
-
stream.free();
|
|
187
|
-
}
|
|
188
|
-
}, "piece");
|
|
189
|
-
const pieces = /* @__PURE__ */ __name((pcm) => {
|
|
190
|
-
const heard = [];
|
|
191
|
-
cut(vad, pcm, ({ start, end, samples }) => {
|
|
192
|
-
const text = piece(samples);
|
|
193
|
-
if (text)
|
|
194
|
-
heard.push({ start, end, text });
|
|
195
|
-
});
|
|
196
|
-
return heard;
|
|
197
|
-
}, "pieces");
|
|
198
|
-
const piecesUntil = /* @__PURE__ */ __name(async (pcm, signal) => {
|
|
199
|
-
const spans = [];
|
|
200
|
-
cut(vad, pcm, (span) => spans.push(span));
|
|
201
|
-
const heard = [];
|
|
202
|
-
for (const { start, end, samples } of spans) {
|
|
203
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
204
|
-
signal.throwIfAborted();
|
|
205
|
-
const text = piece(samples);
|
|
206
|
-
if (text)
|
|
207
|
-
heard.push({ start, end, text });
|
|
208
|
-
}
|
|
209
|
-
return heard;
|
|
210
|
-
}, "piecesUntil");
|
|
211
|
-
return {
|
|
212
|
-
recognize: /* @__PURE__ */ __name((pcm) => pieces(pcm).map(({ text }) => text).join(" "), "recognize"),
|
|
213
|
-
pieces,
|
|
214
|
-
piecesUntil,
|
|
215
|
-
free: /* @__PURE__ */ __name(() => {
|
|
216
|
-
vad.free();
|
|
217
|
-
engine.free();
|
|
218
|
-
}, "free")
|
|
219
|
-
};
|
|
220
|
-
}, "openRecognizer");
|
|
221
|
-
|
|
222
|
-
export {
|
|
223
|
-
SAMPLE_RATE,
|
|
224
|
-
toModelRate,
|
|
225
|
-
decodeOgg,
|
|
226
|
-
detector,
|
|
227
|
-
openSpeechCutter,
|
|
228
|
-
loadSherpa,
|
|
229
|
-
openRecognizer
|
|
230
|
-
};
|
|
@@ -1,193 +0,0 @@
|
|
|
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-S6JG4YUH.js";
|
|
11
|
-
import {
|
|
12
|
-
__name
|
|
13
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
14
|
-
|
|
15
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/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
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
CAPABILITY_STATEMENTS,
|
|
5
|
-
storeCapable
|
|
6
|
-
} from "./chunk-WXJYMMEL.js";
|
|
7
|
-
import {
|
|
8
|
-
importFrom
|
|
9
|
-
} from "./chunk-Y5E2WNWB.js";
|
|
10
|
-
import {
|
|
11
|
-
__name
|
|
12
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
13
|
-
|
|
14
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/sqlite-runtime.js
|
|
15
|
-
import { spawn, spawnSync } from "node:child_process";
|
|
16
|
-
import { readFileSync } from "node:fs";
|
|
17
|
-
import { dirname } from "node:path";
|
|
18
|
-
var RESTARTED = "CLI_MESSAGING_SQLITE_RESTARTED";
|
|
19
|
-
var USER_LIBRARY_PATH = "CLI_MESSAGING_USER_LD_LIBRARY_PATH";
|
|
20
|
-
var FORWARDED = ["SIGTERM", "SIGHUP", "SIGQUIT"];
|
|
21
|
-
var ensureSqlite = /* @__PURE__ */ __name(async (runtime = nodeRuntime()) => {
|
|
22
|
-
const { env } = runtime;
|
|
23
|
-
if (env[RESTARTED]) {
|
|
24
|
-
if (env[USER_LIBRARY_PATH] === void 0)
|
|
25
|
-
delete env.LD_LIBRARY_PATH;
|
|
26
|
-
else
|
|
27
|
-
env.LD_LIBRARY_PATH = env[USER_LIBRARY_PATH];
|
|
28
|
-
delete env[USER_LIBRARY_PATH];
|
|
29
|
-
delete env[RESTARTED];
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (runtime.bun || runtime.platform !== "linux")
|
|
33
|
-
return;
|
|
34
|
-
const maps = runtime.maps();
|
|
35
|
-
if (!maps.includes("libsqlite3"))
|
|
36
|
-
return;
|
|
37
|
-
if (await runtime.capable())
|
|
38
|
-
return;
|
|
39
|
-
const library = await runtime.library(maps.includes("ld-musl"));
|
|
40
|
-
if (!library)
|
|
41
|
-
return;
|
|
42
|
-
const restarted = {
|
|
43
|
-
...env,
|
|
44
|
-
LD_LIBRARY_PATH: [dirname(library.path), env.LD_LIBRARY_PATH].filter(Boolean).join(":"),
|
|
45
|
-
[RESTARTED]: "1"
|
|
46
|
-
};
|
|
47
|
-
if (env.LD_LIBRARY_PATH !== void 0)
|
|
48
|
-
restarted[USER_LIBRARY_PATH] = env.LD_LIBRARY_PATH;
|
|
49
|
-
if (!runtime.works(restarted, library.version))
|
|
50
|
-
return;
|
|
51
|
-
await runtime.restart(restarted);
|
|
52
|
-
}, "ensureSqlite");
|
|
53
|
-
var trialScript = /* @__PURE__ */ __name((version) => `
|
|
54
|
-
const { DatabaseSync } = await import("node:sqlite")
|
|
55
|
-
const database = new DatabaseSync(":memory:")
|
|
56
|
-
if (database.prepare("SELECT sqlite_version() AS v").get().v !== ${JSON.stringify(version)}) process.exit(1)
|
|
57
|
-
for (const statement of ${JSON.stringify(CAPABILITY_STATEMENTS)}) database.exec(statement)
|
|
58
|
-
`, "trialScript");
|
|
59
|
-
var nodeRuntime = /* @__PURE__ */ __name(() => ({
|
|
60
|
-
env: process.env,
|
|
61
|
-
platform: process.platform,
|
|
62
|
-
bun: "Bun" in globalThis,
|
|
63
|
-
maps: /* @__PURE__ */ __name(() => {
|
|
64
|
-
try {
|
|
65
|
-
return readFileSync("/proc/self/maps", "utf8");
|
|
66
|
-
} catch {
|
|
67
|
-
return "";
|
|
68
|
-
}
|
|
69
|
-
}, "maps"),
|
|
70
|
-
capable: /* @__PURE__ */ __name(() => storeCapable().then(() => true, () => false), "capable"),
|
|
71
|
-
library: /* @__PURE__ */ __name(async (musl) => {
|
|
72
|
-
try {
|
|
73
|
-
const { libraryFor, SQLITE_VERSION } = await importFrom(new URL("sqlite-runtime.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
|
|
74
|
-
const path = libraryFor({ musl });
|
|
75
|
-
return path === void 0 ? void 0 : { path, version: SQLITE_VERSION };
|
|
76
|
-
} catch {
|
|
77
|
-
return void 0;
|
|
78
|
-
}
|
|
79
|
-
}, "library"),
|
|
80
|
-
works: /* @__PURE__ */ __name((env, version) => spawnSync(process.execPath, ["--no-warnings", "--input-type=module", "-e", trialScript(version)], {
|
|
81
|
-
env,
|
|
82
|
-
stdio: "ignore",
|
|
83
|
-
timeout: 1e4
|
|
84
|
-
}).status === 0, "works"),
|
|
85
|
-
restart: /* @__PURE__ */ __name((env) => relay(spawn(process.execPath, [...process.execArgv, ...process.argv.slice(1)], { env, stdio: "inherit" })), "restart")
|
|
86
|
-
}), "nodeRuntime");
|
|
87
|
-
var relay = /* @__PURE__ */ __name((child, host = process) => new Promise(() => {
|
|
88
|
-
for (const signal of FORWARDED)
|
|
89
|
-
host.on(signal, () => child.kill(signal));
|
|
90
|
-
host.on("SIGINT", () => {
|
|
91
|
-
});
|
|
92
|
-
child.on("error", () => host.exit(1));
|
|
93
|
-
child.on("exit", (code, signal) => {
|
|
94
|
-
if (signal) {
|
|
95
|
-
host.removeAllListeners(signal);
|
|
96
|
-
host.kill(host.pid, signal);
|
|
97
|
-
} else
|
|
98
|
-
host.exit(code ?? 1);
|
|
99
|
-
});
|
|
100
|
-
}), "relay");
|
|
101
|
-
|
|
102
|
-
export {
|
|
103
|
-
ensureSqlite,
|
|
104
|
-
nodeRuntime,
|
|
105
|
-
relay
|
|
106
|
-
};
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
|
|
4
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/ports/wirecat-tools.js
|
|
5
|
-
var WIRECAT_TOOLS = [
|
|
6
|
-
{
|
|
7
|
-
command: "tg",
|
|
8
|
-
appName: "tg-cli",
|
|
9
|
-
envPrefix: "TG",
|
|
10
|
-
package: "@wirecat/tg-cli",
|
|
11
|
-
does: "Telegram in the same local store: search, review and tasks offline"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
command: "max",
|
|
15
|
-
appName: "max-cli",
|
|
16
|
-
envPrefix: "MAX",
|
|
17
|
-
package: "@wirecat/max-cli",
|
|
18
|
-
does: "MAX in the same local store: search, review and tasks offline"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
command: "wa",
|
|
22
|
-
appName: "whatsapp-cli",
|
|
23
|
-
envPrefix: "WA",
|
|
24
|
-
package: "@wirecat/whatsapp-cli",
|
|
25
|
-
does: "WhatsApp in the same local store: search, review and tasks offline"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
command: "zm",
|
|
29
|
-
appName: "zoom-cli",
|
|
30
|
-
envPrefix: "ZM",
|
|
31
|
-
package: "@wirecat/zoom-cli",
|
|
32
|
-
does: "Zoom meetings: transcripts and summaries, searchable with your other WireCat data"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
command: "drive",
|
|
36
|
-
appName: "drive-cli",
|
|
37
|
-
envPrefix: "DRIVE",
|
|
38
|
-
package: "@wirecat/drive-cli",
|
|
39
|
-
does: "Google Drive and Docs as local text, searchable with your other WireCat data"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
command: "gcal",
|
|
43
|
-
appName: "gcal-cli",
|
|
44
|
-
envPrefix: "GCAL",
|
|
45
|
-
package: "@wirecat/gcal-cli",
|
|
46
|
-
does: "Google Calendar events, searchable with your other WireCat data"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
command: "memo",
|
|
50
|
-
appName: "cli-memo",
|
|
51
|
-
envPrefix: "MEMO",
|
|
52
|
-
package: "@wirecat/cli-memo",
|
|
53
|
-
shown: "memo context <person>",
|
|
54
|
-
does: "one person across messengers, mail, notes and meetings"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
command: "mail",
|
|
58
|
-
appName: "mail-cli",
|
|
59
|
-
envPrefix: "MAIL",
|
|
60
|
-
package: "@wirecat/mail-cli",
|
|
61
|
-
does: "IMAP mail in the same local store: search your mailbox offline, next to your other WireCat data"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
command: "b24",
|
|
65
|
-
appName: "bitrix24-cli",
|
|
66
|
-
envPrefix: "B24",
|
|
67
|
-
package: "@wirecat/bitrix24-cli",
|
|
68
|
-
does: "Bitrix24 CRM: deals, leads and pipelines, searchable with your other WireCat data"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
command: "amo",
|
|
72
|
-
appName: "amo-cli",
|
|
73
|
-
envPrefix: "AMO",
|
|
74
|
-
package: "@wirecat/amo-cli",
|
|
75
|
-
does: "amoCRM and Kommo: deals, contacts and companies, searchable with your other WireCat data"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
command: "attio",
|
|
79
|
-
appName: "attio-cli",
|
|
80
|
-
envPrefix: "WCATTIO",
|
|
81
|
-
package: "@wirecat/attio-cli",
|
|
82
|
-
does: "Attio CRM: deals, people and companies, searchable with your other WireCat data"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
command: "pbx",
|
|
86
|
-
appName: "asterisk-cli",
|
|
87
|
-
envPrefix: "PBX",
|
|
88
|
-
package: "@wirecat/asterisk-cli",
|
|
89
|
-
does: "Asterisk PBX calls and recordings, searchable with your other WireCat data"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
command: "notion",
|
|
93
|
-
appName: "notion-cli",
|
|
94
|
-
envPrefix: "WCNOTION",
|
|
95
|
-
package: "@wirecat/notion-cli",
|
|
96
|
-
does: "Notion pages and databases as local text, searchable with your other WireCat data"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
command: "ydisk",
|
|
100
|
-
appName: "yandex-disk-cli",
|
|
101
|
-
envPrefix: "YDISK",
|
|
102
|
-
package: "@wirecat/yandex-disk-cli",
|
|
103
|
-
does: "Yandex Disk folders as local text, searchable with your other WireCat data"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
command: "wordpress",
|
|
107
|
-
appName: "wordpress-cli",
|
|
108
|
-
envPrefix: "WCWP",
|
|
109
|
-
package: "@wirecat/wordpress-cli",
|
|
110
|
-
does: "WordPress posts and pages, searchable with your other WireCat data"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
command: "linear",
|
|
114
|
-
appName: "linear-cli",
|
|
115
|
-
envPrefix: "WCLINEAR",
|
|
116
|
-
package: "@wirecat/linear-cli",
|
|
117
|
-
does: "Linear issues and projects, searchable with your other WireCat data"
|
|
118
|
-
}
|
|
119
|
-
];
|
|
120
|
-
|
|
121
|
-
export {
|
|
122
|
-
WIRECAT_TOOLS
|
|
123
|
-
};
|