@wirecat/attio-cli 0.8.0 → 0.10.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 +23 -0
- package/contracts/wirecat.json +1 -0
- package/dist/bin/attio.js +11 -11
- package/dist/bundle/attio.js +5 -166
- package/dist/bundle/{chunk-UXJZISVL.js → chunk-OGWKDPR5.js} +2 -1
- package/dist/bundle/chunk-TQAECZFO.js +13 -0
- package/dist/bundle/{definitions-FODOIPM2.js → definitions-J73IBAHT.js} +1 -1
- package/dist/bundle/program-NSBWZ25F.js +6201 -0
- package/dist/bundle/{schemas-YGSTNU6F.js → schemas-G3HFAS45.js} +576 -29
- package/dist/commands/api.js +1 -2
- package/dist/commands/crm.js +1 -4
- package/dist/commands/schedule.js +1 -1
- package/dist/commands/session.js +1 -2
- package/dist/config.js +1 -2
- package/dist/context.js +1 -1
- package/dist/identity.js +1 -0
- package/dist/program.js +1 -2
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/dist/activities.d.ts +0 -4
- package/dist/activities.d.ts.map +0 -1
- package/dist/activities.js.map +0 -1
- package/dist/bin/attio.d.ts +0 -3
- package/dist/bin/attio.d.ts.map +0 -1
- package/dist/bin/attio.js.map +0 -1
- package/dist/bundle/agent-GUXXSLT5.js +0 -38
- package/dist/bundle/all-profiles-63N3EQ46.js +0 -320
- package/dist/bundle/anthropic-B4W7MZQE.js +0 -91
- package/dist/bundle/app-server-EXNGTHWO.js +0 -250
- package/dist/bundle/bun-OPDGMZZQ.js +0 -169
- package/dist/bundle/bun-sqlite-NBAY7FR2.js +0 -76
- package/dist/bundle/chunk-2JHVQMVC.js +0 -16
- package/dist/bundle/chunk-2QDUP74I.js +0 -794
- package/dist/bundle/chunk-2XBDILVW.js +0 -53
- package/dist/bundle/chunk-3HC5F3P7.js +0 -24
- package/dist/bundle/chunk-3MSHGNVE.js +0 -1243
- package/dist/bundle/chunk-3YM4B2GT.js +0 -63
- package/dist/bundle/chunk-4N7PP76S.js +0 -6848
- package/dist/bundle/chunk-4RBMCXZT.js +0 -1337
- package/dist/bundle/chunk-4RSWOPKL.js +0 -323
- package/dist/bundle/chunk-5JKTVAXX.js +0 -2788
- package/dist/bundle/chunk-5N2V6XO7.js +0 -119
- package/dist/bundle/chunk-5WD22IXQ.js +0 -66
- package/dist/bundle/chunk-6K4Z6CAM.js +0 -43997
- package/dist/bundle/chunk-6TD3DCWC.js +0 -106
- package/dist/bundle/chunk-7Z53MLQP.js +0 -388
- package/dist/bundle/chunk-AATTOFNY.js +0 -2045
- package/dist/bundle/chunk-APARYILG.js +0 -743
- package/dist/bundle/chunk-D72URWJE.js +0 -532
- package/dist/bundle/chunk-DFDN6AUB.js +0 -21
- package/dist/bundle/chunk-DM7KWVDZ.js +0 -3752
- package/dist/bundle/chunk-DNCLQPOM.js +0 -7
- package/dist/bundle/chunk-DPD4FMHN.js +0 -388
- package/dist/bundle/chunk-DPV53EZC.js +0 -206
- package/dist/bundle/chunk-DURNR4RO.js +0 -353
- package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
- package/dist/bundle/chunk-EVUMQKV7.js +0 -76
- package/dist/bundle/chunk-EY36BTKZ.js +0 -108
- package/dist/bundle/chunk-FH6OEGGN.js +0 -557
- package/dist/bundle/chunk-FOP6G45D.js +0 -358
- package/dist/bundle/chunk-GGMAIIVE.js +0 -38
- package/dist/bundle/chunk-GTEX4IUO.js +0 -334
- package/dist/bundle/chunk-HZ3C4WXD.js +0 -142
- package/dist/bundle/chunk-IA7LLLEI.js +0 -100
- package/dist/bundle/chunk-J6GVVISK.js +0 -185
- package/dist/bundle/chunk-JG6LCSEX.js +0 -407
- package/dist/bundle/chunk-JIGEJZ4I.js +0 -68943
- package/dist/bundle/chunk-KVTNYRDO.js +0 -1007
- package/dist/bundle/chunk-L45WN3AR.js +0 -80
- package/dist/bundle/chunk-L72WUJAS.js +0 -54
- package/dist/bundle/chunk-LKH3UKLO.js +0 -230
- package/dist/bundle/chunk-LM3W7YOM.js +0 -274
- package/dist/bundle/chunk-M4AC55ZB.js +0 -12733
- package/dist/bundle/chunk-MCLQTCGH.js +0 -1202
- package/dist/bundle/chunk-NB7EOAUZ.js +0 -123
- package/dist/bundle/chunk-NISH4UXM.js +0 -58
- package/dist/bundle/chunk-OYEVYOCL.js +0 -259
- package/dist/bundle/chunk-P7G5HFY3.js +0 -288
- package/dist/bundle/chunk-PAEKXVJW.js +0 -188
- package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
- package/dist/bundle/chunk-PLPBEWD4.js +0 -170
- package/dist/bundle/chunk-PMQ7GP6X.js +0 -95
- package/dist/bundle/chunk-Q7ICVP25.js +0 -18
- package/dist/bundle/chunk-QPPOIWPY.js +0 -1246
- package/dist/bundle/chunk-QSJKSPWF.js +0 -131
- package/dist/bundle/chunk-RDVTHFPP.js +0 -338
- package/dist/bundle/chunk-RQORQN2V.js +0 -4072
- package/dist/bundle/chunk-RRTMPSQR.js +0 -29
- package/dist/bundle/chunk-S4UUN6LD.js +0 -1410
- package/dist/bundle/chunk-S6JG4YUH.js +0 -72
- package/dist/bundle/chunk-SCI7QEHF.js +0 -362
- package/dist/bundle/chunk-SSA6JBPA.js +0 -778
- package/dist/bundle/chunk-T4J7XFXT.js +0 -9667
- package/dist/bundle/chunk-TTF5DP4V.js +0 -1197
- package/dist/bundle/chunk-TXDR6YSF.js +0 -23
- package/dist/bundle/chunk-TY7NDMFY.js +0 -46
- package/dist/bundle/chunk-UDSL3MUU.js +0 -2333
- package/dist/bundle/chunk-UKHF37ZU.js +0 -1068
- package/dist/bundle/chunk-V57E7PJQ.js +0 -161
- package/dist/bundle/chunk-V7IF2K3P.js +0 -52
- package/dist/bundle/chunk-VB7FZOYX.js +0 -633
- package/dist/bundle/chunk-VZ5PPYDG.js +0 -77
- package/dist/bundle/chunk-WOPVBRPV.js +0 -29
- package/dist/bundle/chunk-WXQGA6XK.js +0 -50
- package/dist/bundle/chunk-XQGN2D44.js +0 -86
- package/dist/bundle/chunk-XQUUANA2.js +0 -24600
- package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
- package/dist/bundle/chunk-YNGU36GW.js +0 -218
- package/dist/bundle/chunk-YWDFYQOU.js +0 -82
- package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
- package/dist/bundle/chunk-ZZD2YPOX.js +0 -156
- package/dist/bundle/command-contract-KCCW4LNI.js +0 -37
- package/dist/bundle/command-server-entry-3NPPABQQ.js +0 -166
- package/dist/bundle/decode-26M7XE2B.js +0 -297
- package/dist/bundle/dispatch-2FTOHA5D.js +0 -411
- package/dist/bundle/dist-EM7KLEG4.js +0 -7577
- package/dist/bundle/dist-PAKDDIBT.js +0 -191
- package/dist/bundle/echarts-O3TNDAXJ.js +0 -42501
- package/dist/bundle/embed-XJLEAWXE.js +0 -38
- package/dist/bundle/embedder-OEL6PXEH.js +0 -111
- package/dist/bundle/failure-OHIXWTR6.js +0 -25
- package/dist/bundle/first-run-CIXGBXY6.js +0 -29
- package/dist/bundle/first-screen-5FK4D45F.js +0 -38
- package/dist/bundle/instructions-AMH5RWVJ.js +0 -11
- package/dist/bundle/mcp-5HFPWC3W.js +0 -167
- package/dist/bundle/meeting-combined-DMVGQNJ7.js +0 -24
- package/dist/bundle/meeting-model-2THAT7OH.js +0 -25
- package/dist/bundle/meeting-semantic-Q6XYFYUD.js +0 -22
- package/dist/bundle/node-EGMCBAO7.js +0 -176
- package/dist/bundle/node-KM3CUABH.js +0 -2340
- package/dist/bundle/node-TLZSIHIJ.js +0 -21
- package/dist/bundle/node-sqlite-2SWWGW6H.js +0 -74
- package/dist/bundle/oauth-V5LGTXF2.js +0 -20
- package/dist/bundle/open-25EKOTZA.js +0 -23
- package/dist/bundle/openai-VX3OLIHM.js +0 -238
- package/dist/bundle/process-SGHEN6MQ.js +0 -91
- package/dist/bundle/program-Z5NUNXME.js +0 -34214
- package/dist/bundle/prompt-2VSPX5S7.js +0 -17
- package/dist/bundle/recognize-NA5XUFKK.js +0 -26
- package/dist/bundle/remote-BOME6XOE.js +0 -31
- package/dist/bundle/rerank-NG3XMFCV.js +0 -52
- package/dist/bundle/serve-MR67OBED.js +0 -199
- package/dist/bundle/server-4BWAGJQO.js +0 -80
- package/dist/bundle/server-OP2HJNXD.js +0 -213
- package/dist/bundle/sqlite-runtime-V5U6F5EB.js +0 -20
- package/dist/bundle/state-L4MWAATO.js +0 -36
- package/dist/bundle/store-2ALTEH55.js +0 -181
- package/dist/bundle/store-CXZFRG5D.js +0 -297
- package/dist/bundle/store-maintenance-command-LC55DRQA.js +0 -67
- package/dist/bundle/surface-3GRJ7473.js +0 -66
- package/dist/commands/api.d.ts +0 -12
- package/dist/commands/api.d.ts.map +0 -1
- package/dist/commands/api.js.map +0 -1
- package/dist/commands/crm.d.ts +0 -7
- package/dist/commands/crm.d.ts.map +0 -1
- package/dist/commands/crm.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 -8
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js.map +0 -1
- package/dist/config.d.ts +0 -13
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/context.d.ts +0 -37
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/generated/definitions.d.ts +0 -3
- package/dist/generated/definitions.d.ts.map +0 -1
- package/dist/generated/definitions.js.map +0 -1
- package/dist/generated/manifest.d.ts +0 -6
- package/dist/generated/manifest.d.ts.map +0 -1
- package/dist/generated/manifest.js.map +0 -1
- package/dist/generated/schemas.d.ts +0 -383
- package/dist/generated/schemas.d.ts.map +0 -1
- package/dist/generated/schemas.js.map +0 -1
- package/dist/generated/types.d.ts +0 -10166
- package/dist/generated/types.d.ts.map +0 -1
- package/dist/generated/types.js.map +0 -1
- package/dist/generated/wirecat-config.d.ts +0 -15
- package/dist/generated/wirecat-config.d.ts.map +0 -1
- package/dist/generated/wirecat-config.js.map +0 -1
- package/dist/hooks.d.ts +0 -33
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js.map +0 -1
- package/dist/identity.d.ts +0 -33
- 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/links.d.ts +0 -10
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js.map +0 -1
- package/dist/meetings.d.ts +0 -57
- package/dist/meetings.d.ts.map +0 -1
- package/dist/meetings.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/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
|
@@ -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
|
-
};
|
|
@@ -1,58 +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/store/vector-extension.js
|
|
14
|
-
import { readFileSync } from "node:fs";
|
|
15
|
-
var musl = /* @__PURE__ */ __name(() => {
|
|
16
|
-
if (process.platform !== "linux")
|
|
17
|
-
return false;
|
|
18
|
-
try {
|
|
19
|
-
return readFileSync("/proc/self/maps", "utf8").includes("ld-musl");
|
|
20
|
-
} catch {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
}, "musl");
|
|
24
|
-
var found;
|
|
25
|
-
var vectorExtension = /* @__PURE__ */ __name(() => {
|
|
26
|
-
found ??= locate();
|
|
27
|
-
return found;
|
|
28
|
-
}, "vectorExtension");
|
|
29
|
-
var locate = /* @__PURE__ */ __name(async () => {
|
|
30
|
-
const onMusl = musl();
|
|
31
|
-
const target = `${process.platform}-${process.arch}${onMusl ? "-musl" : ""}`;
|
|
32
|
-
let path;
|
|
33
|
-
try {
|
|
34
|
-
const { extensionFor } = await importFrom(new URL("store/vector-extension.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
|
|
35
|
-
path = extensionFor({ musl: onMusl });
|
|
36
|
-
} catch {
|
|
37
|
-
path = void 0;
|
|
38
|
-
}
|
|
39
|
-
if (path === void 0) {
|
|
40
|
-
found = void 0;
|
|
41
|
-
throw new CliError("configuration_error", `the message store needs the sqlite-vec extension, and @wirecat/cli-core-sqlite has none for ${target} \u2014 reinstall the CLI so its dependencies install with it (an install that skips optional or native packages leaves it out)`, { reason: "store.vector-extension-missing", target });
|
|
42
|
-
}
|
|
43
|
-
return path;
|
|
44
|
-
}, "locate");
|
|
45
|
-
var loadVectorExtension = /* @__PURE__ */ __name((database, path) => {
|
|
46
|
-
try {
|
|
47
|
-
database.loadExtension(path);
|
|
48
|
-
} catch (error) {
|
|
49
|
-
throw new CliError("configuration_error", `the sqlite-vec extension did not load on ${process.platform}-${process.arch} \u2014 reinstall the CLI; on macOS under Bun, @wirecat/cli-core-sqlite's SQLite must be installed, since the system's cannot load extensions`, { reason: "store.vector-extension-failed", cause: error instanceof Error ? error.message : String(error) });
|
|
50
|
-
} finally {
|
|
51
|
-
database.enableLoadExtension?.(false);
|
|
52
|
-
}
|
|
53
|
-
}, "loadVectorExtension");
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
vectorExtension,
|
|
57
|
-
loadVectorExtension
|
|
58
|
-
};
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
textModel,
|
|
5
|
-
vectorModelKey
|
|
6
|
-
} from "./chunk-GTEX4IUO.js";
|
|
7
|
-
import {
|
|
8
|
-
OPENAI_URL,
|
|
9
|
-
openRemote,
|
|
10
|
-
remoteKey,
|
|
11
|
-
remoteModel
|
|
12
|
-
} from "./chunk-J6GVVISK.js";
|
|
13
|
-
import {
|
|
14
|
-
endpointFetch
|
|
15
|
-
} from "./chunk-7Z53MLQP.js";
|
|
16
|
-
import {
|
|
17
|
-
isTextModelInstalled,
|
|
18
|
-
openEmbedder,
|
|
19
|
-
textModelsDirectory
|
|
20
|
-
} from "./chunk-KVTNYRDO.js";
|
|
21
|
-
import {
|
|
22
|
-
CliError
|
|
23
|
-
} from "./chunk-S6JG4YUH.js";
|
|
24
|
-
import {
|
|
25
|
-
__name
|
|
26
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
27
|
-
|
|
28
|
-
// 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/services/meeting-model.js
|
|
29
|
-
var integer = /* @__PURE__ */ __name((value, name, max) => {
|
|
30
|
-
if (!Number.isSafeInteger(value) || value < 1 || value > max)
|
|
31
|
-
throw new CliError("validation_error", `Invalid ${name}`);
|
|
32
|
-
return value;
|
|
33
|
-
}, "integer");
|
|
34
|
-
var cancelled = /* @__PURE__ */ __name((signal) => {
|
|
35
|
-
if (signal?.aborted)
|
|
36
|
-
throw new CliError("cancelled", "Meeting embedding was cancelled");
|
|
37
|
-
}, "cancelled");
|
|
38
|
-
var validatedRemote = /* @__PURE__ */ __name((remote) => {
|
|
39
|
-
let url;
|
|
40
|
-
try {
|
|
41
|
-
url = new URL(remote.baseUrl);
|
|
42
|
-
} catch {
|
|
43
|
-
throw new CliError("validation_error", "Invalid embedding endpoint");
|
|
44
|
-
}
|
|
45
|
-
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash)
|
|
46
|
-
throw new CliError("validation_error", "Embedding endpoint requires HTTP/S without credentials, query or fragment");
|
|
47
|
-
if (typeof remote.model !== "string" || !/^[\w./:-]{1,200}$/.test(remote.model))
|
|
48
|
-
throw new CliError("validation_error", "Invalid embedding model name");
|
|
49
|
-
const dims = integer(remote.dims, "embedding dimensions", 8192);
|
|
50
|
-
const baseUrl = remote.baseUrl.replace(/\/+$/, "");
|
|
51
|
-
const result = remoteModel({ model: remote.model, dims, ...baseUrl === OPENAI_URL ? {} : { baseUrl } });
|
|
52
|
-
return result;
|
|
53
|
-
}, "validatedRemote");
|
|
54
|
-
var meetingEmbeddingModel = /* @__PURE__ */ __name((choice, env) => {
|
|
55
|
-
if (typeof choice === "string") {
|
|
56
|
-
const model = textModel(choice, env);
|
|
57
|
-
return { key: vectorModelKey(model), dims: model.dims, kind: "local", model: model.id };
|
|
58
|
-
}
|
|
59
|
-
if (!choice || typeof choice !== "object" || !choice.remote)
|
|
60
|
-
throw new CliError("validation_error", "An explicit embedding model is required");
|
|
61
|
-
const remote = validatedRemote(choice.remote);
|
|
62
|
-
if (choice.concurrency !== void 0 && choice.concurrency !== 1)
|
|
63
|
-
throw new CliError("validation_error", "Meeting embedding supports one remote request worker");
|
|
64
|
-
return { key: remoteKey(remote), dims: remote.dims, kind: "remote", model: remote.model };
|
|
65
|
-
}, "meetingEmbeddingModel");
|
|
66
|
-
var createMeetingRemoteModel = /* @__PURE__ */ __name((input) => {
|
|
67
|
-
try {
|
|
68
|
-
return validatedRemote(remoteModel(input));
|
|
69
|
-
} catch (error) {
|
|
70
|
-
if (error instanceof CliError)
|
|
71
|
-
throw error;
|
|
72
|
-
throw new CliError("validation_error", "Invalid embedding endpoint");
|
|
73
|
-
}
|
|
74
|
-
}, "createMeetingRemoteModel");
|
|
75
|
-
var withAbort = /* @__PURE__ */ __name(async (pending, signal) => {
|
|
76
|
-
cancelled(signal);
|
|
77
|
-
if (!signal)
|
|
78
|
-
return pending;
|
|
79
|
-
let onAbort = /* @__PURE__ */ __name(() => {
|
|
80
|
-
}, "onAbort");
|
|
81
|
-
const interrupted = new Promise((_, reject) => {
|
|
82
|
-
onAbort = /* @__PURE__ */ __name(() => reject(new CliError("cancelled", "Meeting embedding was cancelled")), "onAbort");
|
|
83
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
84
|
-
});
|
|
85
|
-
try {
|
|
86
|
-
return await Promise.race([pending, interrupted]);
|
|
87
|
-
} finally {
|
|
88
|
-
signal.removeEventListener("abort", onAbort);
|
|
89
|
-
}
|
|
90
|
-
}, "withAbort");
|
|
91
|
-
var boundedResponse = /* @__PURE__ */ __name(async (response, maxBytes, signal) => {
|
|
92
|
-
const length = response.headers.get("content-length");
|
|
93
|
-
if (length !== null && (!/^\d+$/.test(length) || Number(length) > maxBytes)) {
|
|
94
|
-
void response.body?.cancel().catch(() => {
|
|
95
|
-
});
|
|
96
|
-
throw new CliError("invalid_response", "Embedding response exceeds the byte budget");
|
|
97
|
-
}
|
|
98
|
-
if (!response.body)
|
|
99
|
-
throw new CliError("invalid_response", "Embedding response has no body");
|
|
100
|
-
const reader = response.body.getReader();
|
|
101
|
-
const chunks = [];
|
|
102
|
-
let bytes = 0;
|
|
103
|
-
try {
|
|
104
|
-
for (; ; ) {
|
|
105
|
-
cancelled(signal);
|
|
106
|
-
const part = await withAbort(reader.read(), signal);
|
|
107
|
-
cancelled(signal);
|
|
108
|
-
if (part.done)
|
|
109
|
-
break;
|
|
110
|
-
bytes += part.value.byteLength;
|
|
111
|
-
if (bytes > maxBytes)
|
|
112
|
-
throw new CliError("invalid_response", "Embedding response exceeds the byte budget");
|
|
113
|
-
chunks.push(part.value);
|
|
114
|
-
}
|
|
115
|
-
const body = Buffer.concat(chunks, bytes).toString("utf8");
|
|
116
|
-
try {
|
|
117
|
-
return JSON.parse(body);
|
|
118
|
-
} catch {
|
|
119
|
-
throw new CliError("invalid_response", "Embedding response is not JSON");
|
|
120
|
-
}
|
|
121
|
-
} finally {
|
|
122
|
-
void reader.cancel().catch(() => {
|
|
123
|
-
});
|
|
124
|
-
reader.releaseLock();
|
|
125
|
-
}
|
|
126
|
-
}, "boundedResponse");
|
|
127
|
-
var openMeetingEmbedder = /* @__PURE__ */ __name(async (choice, options = {}) => {
|
|
128
|
-
const descriptor = meetingEmbeddingModel(choice, options.env);
|
|
129
|
-
const { signal } = options;
|
|
130
|
-
cancelled(signal);
|
|
131
|
-
const maxInputBytes = integer(options.maxInputBytes ?? 1024 * 1024, "input byte budget", 16 * 1024 * 1024);
|
|
132
|
-
const maxResponseBytes = integer(options.maxResponseBytes ?? 8 * 1024 * 1024, "response byte budget", 64 * 1024 * 1024);
|
|
133
|
-
if (options.threads !== void 0)
|
|
134
|
-
integer(options.threads, "embedding threads", 128);
|
|
135
|
-
let engine;
|
|
136
|
-
let remoteFailure;
|
|
137
|
-
if (typeof choice === "string") {
|
|
138
|
-
const model = textModel(choice, options.env);
|
|
139
|
-
const directory = options.directory ?? textModelsDirectory(options.env);
|
|
140
|
-
if (!isTextModelInstalled(model, directory))
|
|
141
|
-
throw new CliError("configuration_error", "The explicit local embedding model is not installed");
|
|
142
|
-
engine = await openEmbedder(model, directory, {
|
|
143
|
-
...options.threads === void 0 ? {} : { threads: options.threads }
|
|
144
|
-
});
|
|
145
|
-
} else {
|
|
146
|
-
const remote = validatedRemote(choice.remote);
|
|
147
|
-
const key = choice.apiKey ?? (remote.provider === "openai" ? (options.env ?? process.env).OPENAI_API_KEY : void 0);
|
|
148
|
-
if (remote.provider === "openai" && !key)
|
|
149
|
-
throw new CliError("authentication_error", "The explicit remote embedding model requires an API key");
|
|
150
|
-
const post = options.fetch ?? endpointFetch(remote.baseUrl, 12e4);
|
|
151
|
-
const guarded = /* @__PURE__ */ __name(async (url, init) => {
|
|
152
|
-
try {
|
|
153
|
-
cancelled(signal);
|
|
154
|
-
const responseTask = post(url, { ...init, redirect: "manual", ...signal ? { signal } : {} }).then((response2) => {
|
|
155
|
-
if (signal?.aborted) {
|
|
156
|
-
void response2.body?.cancel().catch(() => {
|
|
157
|
-
});
|
|
158
|
-
cancelled(signal);
|
|
159
|
-
}
|
|
160
|
-
return response2;
|
|
161
|
-
});
|
|
162
|
-
const response = await withAbort(responseTask, signal);
|
|
163
|
-
if (signal?.aborted) {
|
|
164
|
-
void response.body?.cancel().catch(() => {
|
|
165
|
-
});
|
|
166
|
-
cancelled(signal);
|
|
167
|
-
}
|
|
168
|
-
if (response.status >= 300 && response.status < 400) {
|
|
169
|
-
void response.body?.cancel().catch(() => {
|
|
170
|
-
});
|
|
171
|
-
throw new CliError("invalid_response", "Embedding redirects are refused");
|
|
172
|
-
}
|
|
173
|
-
if (!response.ok) {
|
|
174
|
-
void response.body?.cancel().catch(() => {
|
|
175
|
-
});
|
|
176
|
-
return new Response("{}", { status: response.status });
|
|
177
|
-
}
|
|
178
|
-
const body = await boundedResponse(response, maxResponseBytes, signal);
|
|
179
|
-
if (!body || typeof body !== "object" || !("data" in body) || !Array.isArray(body.data) || body.data.length > 256)
|
|
180
|
-
throw new CliError("invalid_response", "Embedding response lacks vector data");
|
|
181
|
-
for (const entry of body.data) {
|
|
182
|
-
if (!entry || typeof entry !== "object" || !Number.isSafeInteger(entry.index) || entry.index < 0 || !Array.isArray(entry.embedding) || entry.embedding.length !== remote.dims || entry.embedding.some((value) => typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(Math.fround(value))))
|
|
183
|
-
throw new CliError("invalid_response", "Embedding response contains invalid vectors");
|
|
184
|
-
}
|
|
185
|
-
const indices = body.data.map((entry) => entry.index).sort((a, b) => a - b);
|
|
186
|
-
if (indices.some((index, position) => index !== position))
|
|
187
|
-
throw new CliError("invalid_response", "Embedding response contains invalid vector indices");
|
|
188
|
-
return new Response(JSON.stringify({ data: body.data.map((entry) => ({ index: entry.index, embedding: entry.embedding })) }), { status: response.status });
|
|
189
|
-
} catch (error) {
|
|
190
|
-
remoteFailure = error;
|
|
191
|
-
throw error;
|
|
192
|
-
}
|
|
193
|
-
}, "guarded");
|
|
194
|
-
engine = openRemote(remote, key, { concurrency: 1, fetch: guarded, tries: 1, env: options.env ?? process.env });
|
|
195
|
-
}
|
|
196
|
-
if (signal?.aborted) {
|
|
197
|
-
await engine.close();
|
|
198
|
-
cancelled(signal);
|
|
199
|
-
}
|
|
200
|
-
let closed = false;
|
|
201
|
-
let running = false;
|
|
202
|
-
let active = null;
|
|
203
|
-
let closing = null;
|
|
204
|
-
return {
|
|
205
|
-
...descriptor,
|
|
206
|
-
async embed(texts, kind) {
|
|
207
|
-
cancelled(signal);
|
|
208
|
-
if (closed)
|
|
209
|
-
throw new CliError("configuration_error", "Meeting embedder is closed");
|
|
210
|
-
if (!Array.isArray(texts) || texts.length > 1e3 || texts.some((text) => typeof text !== "string") || !["query", "passage"].includes(kind))
|
|
211
|
-
throw new CliError("validation_error", "Invalid meeting embedding inputs");
|
|
212
|
-
if (Buffer.byteLength(JSON.stringify(texts), "utf8") > maxInputBytes || texts.length * descriptor.dims * 4 > maxResponseBytes)
|
|
213
|
-
throw new CliError("validation_error", "Meeting embedding input or vector payload exceeds its byte budget");
|
|
214
|
-
if (running)
|
|
215
|
-
throw new CliError("validation_error", "A meeting embedding request is already running");
|
|
216
|
-
running = true;
|
|
217
|
-
let settled = /* @__PURE__ */ __name(() => {
|
|
218
|
-
}, "settled");
|
|
219
|
-
active = new Promise((resolve) => {
|
|
220
|
-
settled = resolve;
|
|
221
|
-
});
|
|
222
|
-
remoteFailure = void 0;
|
|
223
|
-
try {
|
|
224
|
-
const vectors = await engine.embed([...texts], kind);
|
|
225
|
-
cancelled(signal);
|
|
226
|
-
if (vectors.length !== texts.length || vectors.some((vector) => vector.length !== descriptor.dims || !vector.some((value) => value !== 0) || [...vector].some((value) => !Number.isFinite(value))))
|
|
227
|
-
throw new CliError("invalid_response", "Meeting embedder returned invalid vectors");
|
|
228
|
-
return vectors;
|
|
229
|
-
} catch (error) {
|
|
230
|
-
cancelled(signal);
|
|
231
|
-
if (remoteFailure instanceof CliError)
|
|
232
|
-
throw remoteFailure;
|
|
233
|
-
if (error instanceof CliError)
|
|
234
|
-
throw error;
|
|
235
|
-
throw new CliError("provider_error", "Meeting embedding failed");
|
|
236
|
-
} finally {
|
|
237
|
-
running = false;
|
|
238
|
-
settled();
|
|
239
|
-
active = null;
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
async close() {
|
|
243
|
-
if (!closing) {
|
|
244
|
-
closed = true;
|
|
245
|
-
closing = (async () => {
|
|
246
|
-
await active;
|
|
247
|
-
await engine.close();
|
|
248
|
-
})();
|
|
249
|
-
}
|
|
250
|
-
await closing;
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
}, "openMeetingEmbedder");
|
|
254
|
-
|
|
255
|
-
export {
|
|
256
|
-
meetingEmbeddingModel,
|
|
257
|
-
createMeetingRemoteModel,
|
|
258
|
-
openMeetingEmbedder
|
|
259
|
-
};
|