@wirecat/hubspot-cli 0.0.0-stage → 0.2.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 +53 -0
- package/LICENSE +204 -0
- package/README.md +280 -2
- package/contracts/wirecat.json +3270 -0
- package/dist/bin/hubspot.d.ts +3 -0
- package/dist/bin/hubspot.d.ts.map +1 -0
- package/dist/bin/hubspot.js +40 -0
- package/dist/bin/hubspot.js.map +1 -0
- package/dist/bundle/all-profiles-64JAUYW4.js +279 -0
- package/dist/bundle/anthropic-VJOS4OUM.js +91 -0
- package/dist/bundle/app-server-GXV2OFML.js +245 -0
- package/dist/bundle/bun-M3J2QTR3.js +169 -0
- package/dist/bundle/bun-sqlite-IX3XYA5F.js +76 -0
- package/dist/bundle/chunk-24ERVFJP.js +73 -0
- package/dist/bundle/chunk-2QZK5BEP.js +392 -0
- package/dist/bundle/chunk-2UOJ7DLZ.js +46 -0
- package/dist/bundle/chunk-2VGD63G6.js +604 -0
- package/dist/bundle/chunk-2VGZRYEH.js +334 -0
- package/dist/bundle/chunk-36ITRDYY.js +63116 -0
- package/dist/bundle/chunk-3WLYWRGG.js +1395 -0
- package/dist/bundle/chunk-43EKCUBJ.js +72 -0
- package/dist/bundle/chunk-4W6BMH45.js +731 -0
- package/dist/bundle/chunk-5A6ZYNAQ.js +2003 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-5GBUCHRU.js +274 -0
- package/dist/bundle/chunk-5K7QLJMM.js +4072 -0
- package/dist/bundle/chunk-65TWQ7BV.js +54 -0
- package/dist/bundle/chunk-7ELMWE3P.js +12066 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-B3MANLNK.js +602 -0
- package/dist/bundle/chunk-C32AKHTY.js +2310 -0
- package/dist/bundle/chunk-CLAN3FES.js +1246 -0
- package/dist/bundle/chunk-CWXOXIWS.js +46 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DB2XKHI4.js +72 -0
- package/dist/bundle/chunk-DBEQI5YM.js +100 -0
- package/dist/bundle/chunk-DFCHHR5M.js +38 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DRWWJLI6.js +188 -0
- package/dist/bundle/chunk-DSP36YHQ.js +29 -0
- package/dist/bundle/chunk-E52JAS35.js +1028 -0
- package/dist/bundle/chunk-E5WLE7BM.js +78 -0
- package/dist/bundle/chunk-ECEZOLOD.js +230 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-FBCCBCFH.js +288 -0
- package/dist/bundle/chunk-FKA7DOCK.js +53 -0
- package/dist/bundle/chunk-FOZYMDRL.js +259 -0
- package/dist/bundle/chunk-FPUGMDJV.js +7 -0
- package/dist/bundle/chunk-FTFV3HFW.js +721 -0
- package/dist/bundle/chunk-GPYCBYX5.js +218 -0
- package/dist/bundle/chunk-H3TNVEQX.js +782 -0
- package/dist/bundle/chunk-HC5ZWE5X.js +193 -0
- package/dist/bundle/chunk-HCAZV5NP.js +95 -0
- package/dist/bundle/chunk-HZRQLAHO.js +16 -0
- package/dist/bundle/chunk-IJADZW42.js +195 -0
- package/dist/bundle/chunk-IMJQRPLN.js +92 -0
- package/dist/bundle/chunk-JLDBMEKZ.js +106 -0
- package/dist/bundle/chunk-LOBVOGOE.js +66 -0
- package/dist/bundle/chunk-LXZ66MCH.js +1328 -0
- package/dist/bundle/chunk-MFNMKHML.js +26462 -0
- package/dist/bundle/chunk-MVA5HVKL.js +1392 -0
- package/dist/bundle/chunk-N2XADGL4.js +76 -0
- package/dist/bundle/chunk-NHHJHXMQ.js +58 -0
- package/dist/bundle/chunk-NUU4WZVL.js +52 -0
- package/dist/bundle/chunk-NWHEHV3K.js +133 -0
- package/dist/bundle/chunk-NXERIDPJ.js +319 -0
- package/dist/bundle/chunk-O3DYRCIT.js +23 -0
- package/dist/bundle/chunk-O55RWNSH.js +161 -0
- package/dist/bundle/chunk-P5BHKKBI.js +206 -0
- package/dist/bundle/chunk-PPHBRESD.js +82 -0
- package/dist/bundle/chunk-PVKF24ZW.js +364 -0
- package/dist/bundle/chunk-Q2OLOMHL.js +4045 -0
- package/dist/bundle/chunk-QGFX5MXL.js +460 -0
- package/dist/bundle/chunk-QJW35N5V.js +761 -0
- package/dist/bundle/chunk-QU25DA5N.js +360 -0
- package/dist/bundle/chunk-RMIYKDUL.js +1068 -0
- package/dist/bundle/chunk-RR5MX5TM.js +142 -0
- package/dist/bundle/chunk-SDQGB4KB.js +185 -0
- package/dist/bundle/chunk-TBJYLC5K.js +2788 -0
- package/dist/bundle/chunk-TI46WQXQ.js +1197 -0
- package/dist/bundle/chunk-TKVL2C3B.js +170 -0
- package/dist/bundle/chunk-TLKEPUAV.js +786 -0
- package/dist/bundle/chunk-TOSCB4SO.js +1227 -0
- package/dist/bundle/chunk-TP7GDWVF.js +6848 -0
- package/dist/bundle/chunk-URX6YDUL.js +9393 -0
- package/dist/bundle/chunk-UUMUL4L3.js +72 -0
- package/dist/bundle/chunk-VOH7S5M4.js +40963 -0
- package/dist/bundle/chunk-W53EJOFQ.js +63 -0
- package/dist/bundle/chunk-W7HM2VGO.js +24 -0
- package/dist/bundle/chunk-WE4UFASG.js +88 -0
- package/dist/bundle/chunk-X2M6NIQG.js +18 -0
- package/dist/bundle/chunk-XRREFEIW.js +372 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YMCY7VRE.js +1846 -0
- package/dist/bundle/chunk-Z73OL5HV.js +41 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-C6CBFXZF.js +40 -0
- package/dist/bundle/command-server-entry-DJKVVZCQ.js +169 -0
- package/dist/bundle/decode-FC65Y4IV.js +297 -0
- package/dist/bundle/definitions-MVPICAWV.js +2991 -0
- package/dist/bundle/dispatch-KOISQ5QJ.js +411 -0
- package/dist/bundle/dist-7TGU56B2.js +7577 -0
- package/dist/bundle/echarts-FVTUDXDU.js +42501 -0
- package/dist/bundle/embed-VNBZFPYH.js +38 -0
- package/dist/bundle/embedder-6U4NOFRO.js +111 -0
- package/dist/bundle/failure-FZ6VYKEQ.js +25 -0
- package/dist/bundle/first-run-UWAFSINQ.js +29 -0
- package/dist/bundle/first-screen-RTVMGHAE.js +40 -0
- package/dist/bundle/hubspot.js +198 -0
- package/dist/bundle/instructions-HET7BCYK.js +11 -0
- package/dist/bundle/mcp-RGNRW77S.js +167 -0
- package/dist/bundle/meeting-combined-L5AGBPYX.js +25 -0
- package/dist/bundle/meeting-model-NTB4RK3F.js +25 -0
- package/dist/bundle/meeting-semantic-JY3OGCBS.js +22 -0
- package/dist/bundle/node-CXZIFHZC.js +176 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-P3O7XN7Q.js +74 -0
- package/dist/bundle/oauth-HNCY4B2S.js +20 -0
- package/dist/bundle/open-F4P6YV54.js +23 -0
- package/dist/bundle/openai-4AICLIK3.js +238 -0
- package/dist/bundle/process-5RUXWGYS.js +91 -0
- package/dist/bundle/program-XA4C44Z4.js +9374 -0
- package/dist/bundle/prompt-NFMDVBZ4.js +17 -0
- package/dist/bundle/recognize-DKN3RY4V.js +26 -0
- package/dist/bundle/remote-6QHAGQWY.js +31 -0
- package/dist/bundle/rerank-M4KHEHUZ.js +52 -0
- package/dist/bundle/schemas-JRL3DLMP.js +952 -0
- package/dist/bundle/serve-DNU43ND6.js +199 -0
- package/dist/bundle/server-ATG5KY7K.js +207 -0
- package/dist/bundle/server-VNWVVH7A.js +77 -0
- package/dist/bundle/source-54HR4IWG.js +661 -0
- package/dist/bundle/sqlite-runtime-EMQAC63N.js +20 -0
- package/dist/bundle/state-T45CX7VY.js +36 -0
- package/dist/bundle/store-6LCEVBAZ.js +176 -0
- package/dist/bundle/store-6TZ2FCVA.js +295 -0
- package/dist/bundle/store-DXWYNVVB.js +32 -0
- package/dist/bundle/store-maintenance-command-J57HCJYY.js +68 -0
- package/dist/bundle/writer-NLLI5YRM.js +79 -0
- package/dist/commands/account.d.ts +3 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +87 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/api.d.ts +9 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +70 -0
- package/dist/commands/api.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 +109 -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 +14 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +164 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +60 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +153 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +88 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +137 -0
- package/dist/context.js.map +1 -0
- package/dist/crm/activities.d.ts +24 -0
- package/dist/crm/activities.d.ts.map +1 -0
- package/dist/crm/activities.js +214 -0
- package/dist/crm/activities.js.map +1 -0
- package/dist/crm/associations.d.ts +20 -0
- package/dist/crm/associations.d.ts.map +1 -0
- package/dist/crm/associations.js +47 -0
- package/dist/crm/associations.js.map +1 -0
- package/dist/crm/records.d.ts +63 -0
- package/dist/crm/records.d.ts.map +1 -0
- package/dist/crm/records.js +333 -0
- package/dist/crm/records.js.map +1 -0
- package/dist/crm/search.d.ts +57 -0
- package/dist/crm/search.d.ts.map +1 -0
- package/dist/crm/search.js +47 -0
- package/dist/crm/search.js.map +1 -0
- package/dist/crm/source.d.ts +37 -0
- package/dist/crm/source.d.ts.map +1 -0
- package/dist/crm/source.js +366 -0
- package/dist/crm/source.js.map +1 -0
- package/dist/crm/writer.d.ts +15 -0
- package/dist/crm/writer.d.ts.map +1 -0
- package/dist/crm/writer.js +199 -0
- package/dist/crm/writer.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 +2987 -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 +6504 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/schemas.d.ts +205 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +810 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +1114 -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/hubspot/account.d.ts +12 -0
- package/dist/hubspot/account.d.ts.map +1 -0
- package/dist/hubspot/account.js +23 -0
- package/dist/hubspot/account.js.map +1 -0
- package/dist/hubspot/transport.d.ts +81 -0
- package/dist/hubspot/transport.d.ts.map +1 -0
- package/dist/hubspot/transport.js +354 -0
- package/dist/hubspot/transport.js.map +1 -0
- package/dist/identity.d.ts +7 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +32 -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 +78 -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 +33 -0
- package/dist/reasons.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 +97 -0
- package/dist/setup/flow.js.map +1 -0
- package/dist/setup/texts.en.json +19 -0
- package/dist/setup/texts.es.json +19 -0
- package/dist/setup/texts.ru.json +19 -0
- package/dist/store.d.ts +16 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +34 -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 +19 -0
- package/dist/whoami.d.ts.map +1 -0
- package/dist/whoami.js +15 -0
- package/dist/whoami.js.map +1 -0
- package/package.json +98 -4
- package/skills/hubspot-cli/SKILL.md +102 -0
- package/skills/hubspot-cli/references/api/api-advanced.md +51 -0
- package/skills/hubspot-cli/references/api/api-basic.md +1064 -0
- package/skills/hubspot-cli/references/api/api-batch.md +724 -0
- package/skills/hubspot-cli/references/api/api-search.md +147 -0
- package/skills/hubspot-cli/references/api.md +16 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
child_process,
|
|
5
|
+
crypto,
|
|
6
|
+
fs,
|
|
7
|
+
os,
|
|
8
|
+
path,
|
|
9
|
+
stream,
|
|
10
|
+
util
|
|
11
|
+
} from "./chunk-DFDN6AUB.js";
|
|
12
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
13
|
+
export {
|
|
14
|
+
child_process,
|
|
15
|
+
crypto,
|
|
16
|
+
fs,
|
|
17
|
+
os,
|
|
18
|
+
path,
|
|
19
|
+
stream,
|
|
20
|
+
util
|
|
21
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
loadVectorExtension,
|
|
5
|
+
vectorExtension
|
|
6
|
+
} from "./chunk-NHHJHXMQ.js";
|
|
7
|
+
import {
|
|
8
|
+
refuseOwnerStoreInTests
|
|
9
|
+
} from "./chunk-65TWQ7BV.js";
|
|
10
|
+
import {
|
|
11
|
+
TIME_LIMIT_FUNCTION,
|
|
12
|
+
beforeTimeLimit
|
|
13
|
+
} from "./chunk-DFCHHR5M.js";
|
|
14
|
+
import "./chunk-TBJYLC5K.js";
|
|
15
|
+
import "./chunk-TOSCB4SO.js";
|
|
16
|
+
import "./chunk-MVA5HVKL.js";
|
|
17
|
+
import "./chunk-Y5E2WNWB.js";
|
|
18
|
+
import "./chunk-DB2XKHI4.js";
|
|
19
|
+
import {
|
|
20
|
+
__name
|
|
21
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
22
|
+
|
|
23
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/store/drivers/node-sqlite.js
|
|
24
|
+
import { DatabaseSync } from "node:sqlite";
|
|
25
|
+
var openWithNodeSqlite = /* @__PURE__ */ __name(async (path) => cacheOverNodeSqlite(await nodeClient(path)), "openWithNodeSqlite");
|
|
26
|
+
var nodeClient = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
|
|
27
|
+
refuseOwnerStoreInTests(path);
|
|
28
|
+
const extension = await vectorExtension();
|
|
29
|
+
const client = new DatabaseSync(path, { readOnly, allowExtension: true });
|
|
30
|
+
try {
|
|
31
|
+
loadVectorExtension(client, extension);
|
|
32
|
+
return client;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
client.close();
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}, "nodeClient");
|
|
38
|
+
var STATEMENT_CACHE_SIZE = 1e3;
|
|
39
|
+
var cacheOverNodeSqlite = /* @__PURE__ */ __name((database, cacheSize = STATEMENT_CACHE_SIZE) => {
|
|
40
|
+
const statements = /* @__PURE__ */ new Map();
|
|
41
|
+
database.function(TIME_LIMIT_FUNCTION, { deterministic: false, directOnly: true }, beforeTimeLimit);
|
|
42
|
+
const prepare = /* @__PURE__ */ __name((sql) => {
|
|
43
|
+
const statement = database.prepare(sql);
|
|
44
|
+
return {
|
|
45
|
+
run: /* @__PURE__ */ __name((...parameters) => ({ changes: Number(statement.run(...parameters).changes) }), "run"),
|
|
46
|
+
get: /* @__PURE__ */ __name((...parameters) => statement.get(...parameters), "get"),
|
|
47
|
+
all: /* @__PURE__ */ __name((...parameters) => statement.all(...parameters), "all")
|
|
48
|
+
};
|
|
49
|
+
}, "prepare");
|
|
50
|
+
return {
|
|
51
|
+
timeLimit: true,
|
|
52
|
+
exec: /* @__PURE__ */ __name((sql) => database.exec(sql), "exec"),
|
|
53
|
+
prepare: /* @__PURE__ */ __name((sql) => {
|
|
54
|
+
const cached = statements.get(sql);
|
|
55
|
+
if (cached)
|
|
56
|
+
statements.delete(sql);
|
|
57
|
+
const statement = cached ?? prepare(sql);
|
|
58
|
+
statements.set(sql, statement);
|
|
59
|
+
if (statements.size > cacheSize)
|
|
60
|
+
statements.delete(statements.keys().next().value);
|
|
61
|
+
return statement;
|
|
62
|
+
}, "prepare"),
|
|
63
|
+
close: /* @__PURE__ */ __name(() => {
|
|
64
|
+
statements.clear();
|
|
65
|
+
database.close();
|
|
66
|
+
}, "close")
|
|
67
|
+
};
|
|
68
|
+
}, "cacheOverNodeSqlite");
|
|
69
|
+
export {
|
|
70
|
+
STATEMENT_CACHE_SIZE,
|
|
71
|
+
cacheOverNodeSqlite,
|
|
72
|
+
nodeClient,
|
|
73
|
+
openWithNodeSqlite
|
|
74
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ownerLogin,
|
|
5
|
+
revokeAll
|
|
6
|
+
} from "./chunk-FBCCBCFH.js";
|
|
7
|
+
import "./chunk-5D4AEUVA.js";
|
|
8
|
+
import "./chunk-O55RWNSH.js";
|
|
9
|
+
import "./chunk-24ERVFJP.js";
|
|
10
|
+
import "./chunk-W53EJOFQ.js";
|
|
11
|
+
import "./chunk-TBJYLC5K.js";
|
|
12
|
+
import "./chunk-TOSCB4SO.js";
|
|
13
|
+
import "./chunk-MVA5HVKL.js";
|
|
14
|
+
import "./chunk-Y5E2WNWB.js";
|
|
15
|
+
import "./chunk-DB2XKHI4.js";
|
|
16
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
17
|
+
export {
|
|
18
|
+
ownerLogin,
|
|
19
|
+
revokeAll
|
|
20
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CAPABILITY_STATEMENTS,
|
|
5
|
+
assertStoreCapable,
|
|
6
|
+
openCache,
|
|
7
|
+
openFile,
|
|
8
|
+
storeCapable
|
|
9
|
+
} from "./chunk-HCAZV5NP.js";
|
|
10
|
+
import "./chunk-DFCHHR5M.js";
|
|
11
|
+
import "./chunk-TBJYLC5K.js";
|
|
12
|
+
import "./chunk-TOSCB4SO.js";
|
|
13
|
+
import "./chunk-MVA5HVKL.js";
|
|
14
|
+
import "./chunk-Y5E2WNWB.js";
|
|
15
|
+
import "./chunk-DB2XKHI4.js";
|
|
16
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
17
|
+
export {
|
|
18
|
+
CAPABILITY_STATEMENTS,
|
|
19
|
+
assertStoreCapable,
|
|
20
|
+
openCache,
|
|
21
|
+
openFile,
|
|
22
|
+
storeCapable
|
|
23
|
+
};
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
SAMPLE_RATE,
|
|
5
|
+
toModelRate
|
|
6
|
+
} from "./chunk-ECEZOLOD.js";
|
|
7
|
+
import "./chunk-2QZK5BEP.js";
|
|
8
|
+
import {
|
|
9
|
+
OPENAI_URL,
|
|
10
|
+
refuseModelAddress
|
|
11
|
+
} from "./chunk-SDQGB4KB.js";
|
|
12
|
+
import {
|
|
13
|
+
endpointFetch,
|
|
14
|
+
onThisComputer,
|
|
15
|
+
providerWaitMs
|
|
16
|
+
} from "./chunk-XRREFEIW.js";
|
|
17
|
+
import "./chunk-TI46WQXQ.js";
|
|
18
|
+
import "./chunk-E52JAS35.js";
|
|
19
|
+
import {
|
|
20
|
+
OPENAI_TRANSCRIBE_MODEL,
|
|
21
|
+
VAD,
|
|
22
|
+
filesPresent,
|
|
23
|
+
modelsDirectory,
|
|
24
|
+
vadPath
|
|
25
|
+
} from "./chunk-5GBUCHRU.js";
|
|
26
|
+
import "./chunk-65TWQ7BV.js";
|
|
27
|
+
import {
|
|
28
|
+
DEFAULT_RETRY,
|
|
29
|
+
backoffMs
|
|
30
|
+
} from "./chunk-TBJYLC5K.js";
|
|
31
|
+
import "./chunk-TOSCB4SO.js";
|
|
32
|
+
import "./chunk-MVA5HVKL.js";
|
|
33
|
+
import "./chunk-Y5E2WNWB.js";
|
|
34
|
+
import {
|
|
35
|
+
CliError
|
|
36
|
+
} from "./chunk-DB2XKHI4.js";
|
|
37
|
+
import {
|
|
38
|
+
__name
|
|
39
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
40
|
+
|
|
41
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/speech/openai.js
|
|
42
|
+
import { setTimeout as wait } from "node:timers/promises";
|
|
43
|
+
|
|
44
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/speech/wav.js
|
|
45
|
+
var encodeWav = /* @__PURE__ */ __name((samples, sampleRate = 16e3) => {
|
|
46
|
+
const bytes = Buffer.alloc(44 + samples.length * 2);
|
|
47
|
+
bytes.write("RIFF", 0, "ascii");
|
|
48
|
+
bytes.writeUInt32LE(bytes.length - 8, 4);
|
|
49
|
+
bytes.write("WAVEfmt ", 8, "ascii");
|
|
50
|
+
bytes.writeUInt32LE(16, 16);
|
|
51
|
+
bytes.writeUInt16LE(1, 20);
|
|
52
|
+
bytes.writeUInt16LE(1, 22);
|
|
53
|
+
bytes.writeUInt32LE(sampleRate, 24);
|
|
54
|
+
bytes.writeUInt32LE(sampleRate * 2, 28);
|
|
55
|
+
bytes.writeUInt16LE(2, 32);
|
|
56
|
+
bytes.writeUInt16LE(16, 34);
|
|
57
|
+
bytes.write("data", 36, "ascii");
|
|
58
|
+
bytes.writeUInt32LE(samples.length * 2, 40);
|
|
59
|
+
samples.forEach((sample, index) => {
|
|
60
|
+
bytes.writeInt16LE(Math.round(Math.max(-1, Math.min(1, sample || 0)) * 32767), 44 + index * 2);
|
|
61
|
+
});
|
|
62
|
+
return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
63
|
+
}, "encodeWav");
|
|
64
|
+
|
|
65
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/speech/openai.js
|
|
66
|
+
var LONGEST_REQUEST_SECONDS = 600;
|
|
67
|
+
var JOINED_SECONDS = 0.2;
|
|
68
|
+
var PAD_SECONDS = 0.2;
|
|
69
|
+
var LEAD = SAMPLE_RATE / 2;
|
|
70
|
+
var EXHAUSTED = /* @__PURE__ */ new Set([
|
|
71
|
+
"insufficient_quota",
|
|
72
|
+
"credit_balance_exhausted",
|
|
73
|
+
"organization_spend_limit_exceeded",
|
|
74
|
+
"project_spend_limit_exceeded",
|
|
75
|
+
"organization_usage_limit_exceeded"
|
|
76
|
+
]);
|
|
77
|
+
var RETRY = { ...DEFAULT_RETRY, retries: 4 };
|
|
78
|
+
var interrupted = /* @__PURE__ */ __name((signal) => {
|
|
79
|
+
if (!signal?.aborted)
|
|
80
|
+
return;
|
|
81
|
+
if (signal.reason instanceof CliError)
|
|
82
|
+
throw signal.reason;
|
|
83
|
+
const timeout = signal.reason instanceof Error && signal.reason.name === "TimeoutError";
|
|
84
|
+
throw new CliError(timeout ? "timeout" : "cancelled", "the transcription was interrupted");
|
|
85
|
+
}, "interrupted");
|
|
86
|
+
var sleeping = /* @__PURE__ */ __name((ms, signal) => wait(ms, void 0, signal ? { signal } : {}).then(() => void 0, (error) => {
|
|
87
|
+
interrupted(signal);
|
|
88
|
+
throw error;
|
|
89
|
+
}), "sleeping");
|
|
90
|
+
var formOf = /* @__PURE__ */ __name((wav, options) => {
|
|
91
|
+
const form = new FormData();
|
|
92
|
+
form.append("file", new Blob([wav], { type: "audio/wav" }), "audio.wav");
|
|
93
|
+
form.append("model", options.model ?? OPENAI_TRANSCRIBE_MODEL);
|
|
94
|
+
for (const language of options.languages ?? [])
|
|
95
|
+
form.append("languages[]", language);
|
|
96
|
+
for (const keyword of options.keywords ?? [])
|
|
97
|
+
form.append("keywords[]", keyword);
|
|
98
|
+
if (options.prompt)
|
|
99
|
+
form.append("prompt", options.prompt);
|
|
100
|
+
return form;
|
|
101
|
+
}, "formOf");
|
|
102
|
+
var safe = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[\w.-]{1,64}$/.test(value) ? value : void 0, "safe");
|
|
103
|
+
var failureOf = /* @__PURE__ */ __name(async (response) => {
|
|
104
|
+
try {
|
|
105
|
+
const body = await response.json();
|
|
106
|
+
const code = safe(body.error?.code);
|
|
107
|
+
const type = safe(body.error?.type);
|
|
108
|
+
return { ...code ? { code } : {}, ...type ? { type } : {} };
|
|
109
|
+
} catch {
|
|
110
|
+
return {};
|
|
111
|
+
}
|
|
112
|
+
}, "failureOf");
|
|
113
|
+
var TRANSCRIPTION_TIMEOUT_MS = 6e5;
|
|
114
|
+
var send = /* @__PURE__ */ __name(async (wav, options) => {
|
|
115
|
+
const url = `${(options.baseUrl ?? OPENAI_URL).replace(/\/+$/, "")}/audio/transcriptions`;
|
|
116
|
+
const post = options.fetch ?? endpointFetch(url, TRANSCRIPTION_TIMEOUT_MS);
|
|
117
|
+
const retry = options.retry ?? RETRY;
|
|
118
|
+
const sleep = options.sleep ?? sleeping;
|
|
119
|
+
const random = options.random ?? Math.random;
|
|
120
|
+
const who = options.label ?? "OpenAI";
|
|
121
|
+
for (let attempt = 1; ; attempt++) {
|
|
122
|
+
interrupted(options.signal);
|
|
123
|
+
let response;
|
|
124
|
+
try {
|
|
125
|
+
response = await post(url, {
|
|
126
|
+
method: "POST",
|
|
127
|
+
headers: options.apiKey ? { authorization: `Bearer ${options.apiKey}` } : {},
|
|
128
|
+
body: formOf(wav, options),
|
|
129
|
+
...options.signal ? { signal: options.signal } : {}
|
|
130
|
+
});
|
|
131
|
+
} catch {
|
|
132
|
+
interrupted(options.signal);
|
|
133
|
+
if (attempt > retry.retries)
|
|
134
|
+
throw new CliError("network_error", `${who} could not be reached`, { reason: "network.failed" });
|
|
135
|
+
await sleep(backoffMs(attempt, retry, random), options.signal);
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (response.ok) {
|
|
139
|
+
const body = await response.json().catch(() => interrupted(options.signal));
|
|
140
|
+
if (typeof body?.text !== "string")
|
|
141
|
+
throw new CliError("invalid_response", `${who} answered without a transcript`, {
|
|
142
|
+
reason: "provider.invalid-response"
|
|
143
|
+
});
|
|
144
|
+
return body.text.trim();
|
|
145
|
+
}
|
|
146
|
+
const { code, type } = await failureOf(response);
|
|
147
|
+
const status = response.status;
|
|
148
|
+
const said = `HTTP ${status}${code ? `, ${code}` : type ? `, ${type}` : ""}`;
|
|
149
|
+
if (status === 401)
|
|
150
|
+
throw new CliError("authentication_error", `${who} refused the key (${said}) \u2014 set it again with \`${options.keyHint ?? "models keys set openai"}\``, { reason: "auth.failed" });
|
|
151
|
+
if (status === 403)
|
|
152
|
+
throw new CliError("permission_error", `${who} refused the request (${said}) \u2014 OpenAI answers this when the country or region is not supported, or the key's project may not use the model`, { reason: "access.denied" });
|
|
153
|
+
if (status === 413)
|
|
154
|
+
throw new CliError("validation_error", `${who} refused the audio as too large (${said})`, {
|
|
155
|
+
reason: "transcription.too-large"
|
|
156
|
+
});
|
|
157
|
+
if (EXHAUSTED.has(code ?? "") || EXHAUSTED.has(type ?? ""))
|
|
158
|
+
throw new CliError("permission_error", `${who} refused: the account's credit, spend limit or usage limit is used up (${said}) \u2014 see the billing page`, { reason: "transcription.quota-exhausted" });
|
|
159
|
+
const again = status === 408 || status === 429 || status >= 500;
|
|
160
|
+
const asked = providerWaitMs(response.headers, () => /* @__PURE__ */ new Date());
|
|
161
|
+
if (again && attempt <= retry.retries && (asked === void 0 || asked <= retry.maxRetryAfterMs)) {
|
|
162
|
+
await sleep(asked ?? backoffMs(attempt, retry, random), options.signal);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (status === 429)
|
|
166
|
+
throw new CliError("rate_limited", `${who} answered ${said}`, {
|
|
167
|
+
reason: "provider.rate-limited",
|
|
168
|
+
...asked === void 0 ? {} : { retry_after_ms: asked }
|
|
169
|
+
});
|
|
170
|
+
if (status >= 500)
|
|
171
|
+
throw new CliError([502, 503, 504].includes(status) ? "provider_unavailable" : "provider_error", `${who} answered ${said}`, { reason: [502, 503, 504].includes(status) ? "provider.unavailable" : "provider.refused" });
|
|
172
|
+
throw new CliError("provider_error", `${who} answered ${said}`, { reason: "provider.refused" });
|
|
173
|
+
}
|
|
174
|
+
}, "send");
|
|
175
|
+
var piecesOf = /* @__PURE__ */ __name((spans, limit) => {
|
|
176
|
+
const pieces = [];
|
|
177
|
+
for (const span of spans) {
|
|
178
|
+
const last = pieces.at(-1);
|
|
179
|
+
const joined = last !== void 0 && span.start - last.end < JOINED_SECONDS;
|
|
180
|
+
const fits = last !== void 0 && limit !== void 0 && span.end - last.start <= limit;
|
|
181
|
+
if (last && (fits || joined && span.end - last.start <= LONGEST_REQUEST_SECONDS))
|
|
182
|
+
last.end = span.end;
|
|
183
|
+
else
|
|
184
|
+
pieces.push({ start: span.start, end: span.end });
|
|
185
|
+
}
|
|
186
|
+
return pieces;
|
|
187
|
+
}, "piecesOf");
|
|
188
|
+
var openCutter = /* @__PURE__ */ __name(async (vadModel) => {
|
|
189
|
+
const { openSpeechCutter } = await import("./recognize-DKN3RY4V.js");
|
|
190
|
+
return openSpeechCutter(vadModel);
|
|
191
|
+
}, "openCutter");
|
|
192
|
+
var checkKeywords = /* @__PURE__ */ __name((keywords = []) => {
|
|
193
|
+
const bad = keywords.find((keyword) => typeof keyword !== "string" || !keyword.trim() || /[<>\r\n]/.test(keyword));
|
|
194
|
+
if (bad !== void 0)
|
|
195
|
+
throw new CliError("validation_error", "a keyword must be a non-empty single line without < or > \u2014 OpenAI refuses the whole request otherwise");
|
|
196
|
+
}, "checkKeywords");
|
|
197
|
+
var transcribeOpenAI = /* @__PURE__ */ __name(async (audio, options) => {
|
|
198
|
+
refuseModelAddress(options.env ?? process.env, options.baseUrl ?? OPENAI_URL, "audio");
|
|
199
|
+
if (!options.apiKey && !onThisComputer(options.baseUrl ?? OPENAI_URL))
|
|
200
|
+
throw new CliError("authentication_error", "no OpenAI key \u2014 `models keys set openai`, or OPENAI_API_KEY", {
|
|
201
|
+
reason: "transcription.no-key"
|
|
202
|
+
});
|
|
203
|
+
checkKeywords(options.keywords);
|
|
204
|
+
interrupted(options.signal);
|
|
205
|
+
const pcm = toModelRate(audio.samples, audio.rate);
|
|
206
|
+
const duration = (pcm.length - LEAD) / SAMPLE_RATE;
|
|
207
|
+
if (options.bundle && duration <= LONGEST_REQUEST_SECONDS) {
|
|
208
|
+
const text = await send(encodeWav(pcm.subarray(LEAD)), options);
|
|
209
|
+
return text ? [{ start: 0, end: duration, text }] : [];
|
|
210
|
+
}
|
|
211
|
+
const vadModel = options.vadModel ?? vadPath(modelsDirectory(options.env));
|
|
212
|
+
if (!options.cutter && !filesPresent([[VAD, vadModel]]))
|
|
213
|
+
throw new CliError("not_found", "the voice detector that finds the speech is not on this machine \u2014 it comes with any speech model: `models download`", { reason: "model.not-downloaded", model: "silero_vad" });
|
|
214
|
+
const cutter = await (options.cutter ?? openCutter)(vadModel);
|
|
215
|
+
let spans;
|
|
216
|
+
try {
|
|
217
|
+
spans = cutter.cut(pcm);
|
|
218
|
+
} finally {
|
|
219
|
+
cutter.free();
|
|
220
|
+
}
|
|
221
|
+
const pieces = piecesOf(spans, options.bundle ? LONGEST_REQUEST_SECONDS : void 0);
|
|
222
|
+
const heard = [];
|
|
223
|
+
for (const [index, piece] of pieces.entries()) {
|
|
224
|
+
const end = Math.min(piece.end, duration);
|
|
225
|
+
const from = Math.max(piece.start - PAD_SECONDS, pieces[index - 1]?.end ?? 0);
|
|
226
|
+
const to = Math.min(end + PAD_SECONDS, pieces[index + 1]?.start ?? duration);
|
|
227
|
+
const samples = pcm.subarray(LEAD + Math.floor(from * SAMPLE_RATE), LEAD + Math.ceil(to * SAMPLE_RATE));
|
|
228
|
+
const text = await send(encodeWav(samples), options);
|
|
229
|
+
if (text)
|
|
230
|
+
heard.push({ start: Math.min(piece.start, end), end, text });
|
|
231
|
+
}
|
|
232
|
+
return heard;
|
|
233
|
+
}, "transcribeOpenAI");
|
|
234
|
+
export {
|
|
235
|
+
LONGEST_REQUEST_SECONDS,
|
|
236
|
+
piecesOf,
|
|
237
|
+
transcribeOpenAI
|
|
238
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import "./chunk-Y5E2WNWB.js";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
7
|
+
|
|
8
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/embeddings/process.js
|
|
9
|
+
import { spawn } from "node:child_process";
|
|
10
|
+
import { createInterface } from "node:readline";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
12
|
+
var openProcess = /* @__PURE__ */ __name(async (model, directory, { threads }) => {
|
|
13
|
+
const child = await modelProcess({ model, directory, threads });
|
|
14
|
+
return {
|
|
15
|
+
model,
|
|
16
|
+
embed: /* @__PURE__ */ __name(async (texts, kind) => ((await child.ask({ texts, kind })).vectors ?? []).map((vector) => Float32Array.from(vector)), "embed"),
|
|
17
|
+
close: child.close
|
|
18
|
+
};
|
|
19
|
+
}, "openProcess");
|
|
20
|
+
var openRerankerProcess = /* @__PURE__ */ __name(async (model, directory, { threads }) => {
|
|
21
|
+
const child = await modelProcess({ model, directory, threads, rerank: true });
|
|
22
|
+
return {
|
|
23
|
+
model,
|
|
24
|
+
score: /* @__PURE__ */ __name(async (question, passages) => (await child.ask({ question, texts: passages })).scores ?? [], "score"),
|
|
25
|
+
close: child.close
|
|
26
|
+
};
|
|
27
|
+
}, "openRerankerProcess");
|
|
28
|
+
var modelProcess = /* @__PURE__ */ __name(async (setup) => {
|
|
29
|
+
const child = spawn(process.execPath, [fileURLToPath(new URL("./child.js", new URL("embeddings/process.js", import.meta.resolve("@wirecat/cli-core")).href)), JSON.stringify(setup)], { stdio: ["pipe", "pipe", "pipe"] });
|
|
30
|
+
const pending = /* @__PURE__ */ new Map();
|
|
31
|
+
let said = "";
|
|
32
|
+
child.stderr.setEncoding("utf8").on("data", (text) => {
|
|
33
|
+
said = (said + text).slice(-2e3);
|
|
34
|
+
});
|
|
35
|
+
let ready = /* @__PURE__ */ __name(() => {
|
|
36
|
+
}, "ready");
|
|
37
|
+
let refused = /* @__PURE__ */ __name((_error) => {
|
|
38
|
+
}, "refused");
|
|
39
|
+
const started = new Promise((resolve, reject) => {
|
|
40
|
+
ready = resolve;
|
|
41
|
+
refused = reject;
|
|
42
|
+
});
|
|
43
|
+
let gone;
|
|
44
|
+
const stopped = /* @__PURE__ */ __name((error) => {
|
|
45
|
+
gone ??= error;
|
|
46
|
+
refused(error);
|
|
47
|
+
for (const job of pending.values())
|
|
48
|
+
job.reject(error);
|
|
49
|
+
pending.clear();
|
|
50
|
+
}, "stopped");
|
|
51
|
+
const exited = new Promise((resolve) => {
|
|
52
|
+
child.once("exit", (code) => {
|
|
53
|
+
const last = said.trim().split("\n").at(-1);
|
|
54
|
+
stopped(new Error(`the embedding process stopped (exit ${code})${last ? `: ${last}` : ""}`));
|
|
55
|
+
resolve();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
child.once("error", stopped);
|
|
59
|
+
createInterface({ input: child.stdout }).on("line", (line) => {
|
|
60
|
+
const answer = JSON.parse(line);
|
|
61
|
+
if ("ready" in answer)
|
|
62
|
+
return ready();
|
|
63
|
+
const job = pending.get(answer.id);
|
|
64
|
+
pending.delete(answer.id);
|
|
65
|
+
if (answer.error !== void 0 || !(answer.vectors ?? answer.scores))
|
|
66
|
+
job?.reject(new Error(answer.error ?? "no answer"));
|
|
67
|
+
else
|
|
68
|
+
job?.resolve(answer);
|
|
69
|
+
});
|
|
70
|
+
await started;
|
|
71
|
+
let next = 0;
|
|
72
|
+
return {
|
|
73
|
+
ask: /* @__PURE__ */ __name((request) => new Promise((resolve, reject) => {
|
|
74
|
+
if (gone)
|
|
75
|
+
return reject(gone);
|
|
76
|
+
const id = next++;
|
|
77
|
+
pending.set(id, { resolve, reject });
|
|
78
|
+
child.stdin.write(`${JSON.stringify({ id, ...request })}
|
|
79
|
+
`);
|
|
80
|
+
}), "ask"),
|
|
81
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
82
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
83
|
+
child.stdin.end();
|
|
84
|
+
await exited;
|
|
85
|
+
}, "close")
|
|
86
|
+
};
|
|
87
|
+
}, "modelProcess");
|
|
88
|
+
export {
|
|
89
|
+
openProcess,
|
|
90
|
+
openRerankerProcess
|
|
91
|
+
};
|