@wirecat/hubspot-cli 0.1.0 → 0.3.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 +41 -0
- package/README.md +40 -16
- package/contracts/wirecat.json +1516 -173
- package/dist/bin/hubspot.js +2 -2
- package/dist/bundle/agent-A7ARC3QB.js +40 -0
- package/dist/bundle/{all-profiles-64JAUYW4.js → all-profiles-6452VSJB.js} +64 -22
- package/dist/bundle/{anthropic-VJOS4OUM.js → anthropic-VQUOVYOW.js} +6 -6
- package/dist/bundle/{app-server-422MCA7S.js → app-server-FFYKM37G.js} +79 -68
- package/dist/bundle/{bun-M3J2QTR3.js → bun-AJPJ4ZUN.js} +2 -2
- package/dist/bundle/{bun-sqlite-IX3XYA5F.js → bun-sqlite-AGXGSF6D.js} +7 -7
- package/dist/bundle/{chunk-N2XADGL4.js → chunk-2A64XS22.js} +4 -4
- package/dist/bundle/{chunk-HTAN663T.js → chunk-2HYGCLKN.js} +93 -565
- package/dist/bundle/{chunk-FOZYMDRL.js → chunk-2NCO4E4T.js} +6 -6
- package/dist/bundle/{chunk-FBCCBCFH.js → chunk-2PRVWEJC.js} +3 -3
- package/dist/bundle/{chunk-LOBVOGOE.js → chunk-3DIXAEGH.js} +4 -4
- package/dist/bundle/{chunk-O3DYRCIT.js → chunk-3I2FGNWO.js} +1 -1
- package/dist/bundle/{chunk-65TWQ7BV.js → chunk-3PEKYGZ3.js} +2 -2
- package/dist/bundle/{chunk-DRWWJLI6.js → chunk-3R4KRNUZ.js} +8 -8
- package/dist/bundle/{chunk-2VGD63G6.js → chunk-3TEFE6YU.js} +7 -7
- package/dist/bundle/{chunk-BKXDHU3G.js → chunk-3WIVJJNB.js} +19 -17
- package/dist/bundle/{chunk-TI46WQXQ.js → chunk-4DNHXRCJ.js} +7 -7
- package/dist/bundle/{chunk-QU25DA5N.js → chunk-5AYKCKSE.js} +11 -11
- package/dist/bundle/chunk-5HD64ETI.js +561 -0
- package/dist/bundle/{chunk-CWXOXIWS.js → chunk-5K3FGXZH.js} +1 -1
- package/dist/bundle/{chunk-24ERVFJP.js → chunk-5YNAVVCW.js} +3 -3
- package/dist/bundle/chunk-77CUE3VX.js +46 -0
- package/dist/bundle/{chunk-36ITRDYY.js → chunk-7LQRXVQ3.js} +783 -482
- package/dist/bundle/{chunk-E5WLE7BM.js → chunk-7NZT7Y55.js} +1 -1
- package/dist/bundle/{chunk-C32AKHTY.js → chunk-7UEL65GQ.js} +35 -12
- package/dist/bundle/chunk-7VHBS5BJ.js +108 -0
- package/dist/bundle/{chunk-O55RWNSH.js → chunk-A6UFH3QU.js} +4 -4
- package/dist/bundle/{chunk-WE4UFASG.js → chunk-ABXVU5O4.js} +8 -1
- package/dist/bundle/{chunk-4W6BMH45.js → chunk-AF7DANIR.js} +2 -100
- package/dist/bundle/{chunk-LNV33FDC.js → chunk-AFL2C4JR.js} +60 -50
- package/dist/bundle/{chunk-2VGZRYEH.js → chunk-ARTJLL7W.js} +6 -6
- package/dist/bundle/chunk-AVUMH42T.js +194 -0
- package/dist/bundle/chunk-B2W3C4N6.js +338 -0
- package/dist/bundle/{chunk-FKA7DOCK.js → chunk-B3EH22CO.js} +1 -1
- package/dist/bundle/{chunk-E52JAS35.js → chunk-BAUK2MD5.js} +6 -6
- package/dist/bundle/{chunk-JLDBMEKZ.js → chunk-BN22EKQQ.js} +2 -2
- package/dist/bundle/{chunk-DB2XKHI4.js → chunk-BUGROVF3.js} +2 -2
- package/dist/bundle/{chunk-DSP36YHQ.js → chunk-CBCEMFCF.js} +2 -2
- package/dist/bundle/{chunk-WQBX7XYP.js → chunk-CYADK744.js} +1559 -1888
- package/dist/bundle/{chunk-HZRQLAHO.js → chunk-DQB5JMTY.js} +1 -1
- package/dist/bundle/{chunk-JRCPCVPI.js → chunk-DQP2GAAO.js} +75 -66
- package/dist/bundle/{chunk-FPUGMDJV.js → chunk-DSRXCLPO.js} +1 -1
- package/dist/bundle/{chunk-UUMUL4L3.js → chunk-DW23LM47.js} +2 -2
- package/dist/bundle/{chunk-TKVL2C3B.js → chunk-E4X7JAFC.js} +3 -3
- package/dist/bundle/{chunk-NUU4WZVL.js → chunk-EE4JSYGZ.js} +3 -3
- package/dist/bundle/{chunk-NWHEHV3K.js → chunk-EMOVVERN.js} +5 -5
- package/dist/bundle/{chunk-PVKF24ZW.js → chunk-FIVD4HM4.js} +8 -8
- package/dist/bundle/{chunk-QJW35N5V.js → chunk-GC6FLHZF.js} +12 -12
- package/dist/bundle/{chunk-TP7GDWVF.js → chunk-GRFICQTZ.js} +1 -1
- package/dist/bundle/{chunk-X2M6NIQG.js → chunk-HPZRUY6S.js} +1 -1
- package/dist/bundle/{chunk-CLAN3FES.js → chunk-IBTMK5KD.js} +54 -34
- package/dist/bundle/{chunk-5A6ZYNAQ.js → chunk-IQ2XZ62J.js} +18 -18
- package/dist/bundle/{chunk-DBEQI5YM.js → chunk-ITGNDZRR.js} +3 -3
- package/dist/bundle/{chunk-W53EJOFQ.js → chunk-IXZLMFPO.js} +1 -1
- package/dist/bundle/{chunk-TOSCB4SO.js → chunk-J5P5VSRG.js} +16 -10
- package/dist/bundle/{chunk-VIEYMDBR.js → chunk-J6C2QWL5.js} +3 -3
- package/dist/bundle/{chunk-ZBDSHFG4.js → chunk-JG7YMHNB.js} +3427 -3284
- package/dist/bundle/{chunk-RMIYKDUL.js → chunk-JK2SNLU5.js} +17 -17
- package/dist/bundle/{chunk-43EKCUBJ.js → chunk-JP2HJXFO.js} +3 -3
- package/dist/bundle/{chunk-DFCHHR5M.js → chunk-JUKAIXKY.js} +1 -1
- package/dist/bundle/{chunk-5GBUCHRU.js → chunk-KO4VR5NK.js} +4 -4
- package/dist/bundle/{chunk-PPHBRESD.js → chunk-KVXEEKBB.js} +2 -2
- package/dist/bundle/{chunk-SDQGB4KB.js → chunk-L433IDOX.js} +9 -9
- package/dist/bundle/chunk-LA3YU4K7.js +40 -0
- package/dist/bundle/{chunk-ECEZOLOD.js → chunk-LKSNISYV.js} +4 -4
- package/dist/bundle/{chunk-5K7QLJMM.js → chunk-LT5KE44Q.js} +226 -226
- package/dist/bundle/chunk-M763RNWP.js +733 -0
- package/dist/bundle/chunk-M7XLG6AN.js +353 -0
- package/dist/bundle/{chunk-IMJQRPLN.js → chunk-NNMU2TDU.js} +1 -1
- package/dist/bundle/chunk-NTQBS2JL.js +52 -0
- package/dist/bundle/{chunk-HCAZV5NP.js → chunk-NZGI74GS.js} +6 -6
- package/dist/bundle/{chunk-W7HM2VGO.js → chunk-O3VM5PTJ.js} +1 -1
- package/dist/bundle/chunk-OPVNUI4M.js +195 -0
- package/dist/bundle/{chunk-7ELMWE3P.js → chunk-PHXOL5HZ.js} +176 -160
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/{chunk-B3MANLNK.js → chunk-PLRUUXK7.js} +19 -233
- package/dist/bundle/{chunk-RR5MX5TM.js → chunk-PMP37KLR.js} +4 -4
- package/dist/bundle/{chunk-FTFV3HFW.js → chunk-Q27QAB4X.js} +9 -9
- package/dist/bundle/{chunk-2TWQIWWG.js → chunk-QFZD6MTF.js} +35 -29
- package/dist/bundle/{chunk-2QZK5BEP.js → chunk-RVWGFD32.js} +30 -15
- package/dist/bundle/{chunk-MVA5HVKL.js → chunk-S4UUN6LD.js} +18 -0
- package/dist/bundle/{chunk-QGFX5MXL.js → chunk-SEELWPRD.js} +9 -9
- package/dist/bundle/{chunk-SAKK2YRU.js → chunk-SMTTIKZ5.js} +12 -12
- package/dist/bundle/{chunk-X7XUX7A4.js → chunk-TDQJS3JG.js} +10 -10
- package/dist/bundle/{chunk-HC5ZWE5X.js → chunk-TIHDBKA7.js} +2 -2
- package/dist/bundle/{chunk-NHHJHXMQ.js → chunk-U6XA3OOM.js} +2 -2
- package/dist/bundle/{chunk-NXERIDPJ.js → chunk-VQEAZXTV.js} +7 -7
- package/dist/bundle/{chunk-P5BHKKBI.js → chunk-VW5F6FK3.js} +4 -4
- package/dist/bundle/{chunk-XRREFEIW.js → chunk-WCQW4GYO.js} +7 -7
- package/dist/bundle/{chunk-H3TNVEQX.js → chunk-WGBVRDY3.js} +29 -4
- package/dist/bundle/chunk-WRCKE5ND.js +80 -0
- package/dist/bundle/{chunk-TBJYLC5K.js → chunk-X5S5KUSU.js} +75 -75
- package/dist/bundle/command-contract-R2FGN7CQ.js +40 -0
- package/dist/bundle/{command-server-entry-DJKVVZCQ.js → command-server-entry-GJSMDSNE.js} +29 -29
- package/dist/bundle/{decode-FC65Y4IV.js → decode-6PLXHVHW.js} +6 -6
- package/dist/bundle/{dispatch-KOISQ5QJ.js → dispatch-TAQ7635E.js} +8 -8
- package/dist/bundle/{dist-MYZZKZJ7.js → dist-7TGU56B2.js} +1 -1
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/{echarts-FVTUDXDU.js → echarts-UZ7QLRE2.js} +2 -2
- package/dist/bundle/{embed-VNBZFPYH.js → embed-AWLL4EBF.js} +7 -7
- package/dist/bundle/{embedder-6U4NOFRO.js → embedder-MM225YJ6.js} +10 -10
- package/dist/bundle/{failure-FZ6VYKEQ.js → failure-MR2XVHFP.js} +3 -3
- package/dist/bundle/first-run-MAUI6QJ7.js +29 -0
- package/dist/bundle/first-screen-SCDV7TXT.js +40 -0
- package/dist/bundle/hubspot.js +26 -26
- package/dist/bundle/{instructions-HET7BCYK.js → instructions-ZJ7U3QUE.js} +1 -1
- package/dist/bundle/{mcp-RGNRW77S.js → mcp-CNV7F2XZ.js} +2 -2
- package/dist/bundle/meeting-combined-EL5XZIJ5.js +25 -0
- package/dist/bundle/meeting-model-OYXB2NOE.js +25 -0
- package/dist/bundle/{meeting-semantic-JY3OGCBS.js → meeting-semantic-S3DBB7XD.js} +7 -7
- package/dist/bundle/{node-CXZIFHZC.js → node-HGCZGZ4R.js} +2 -2
- package/dist/bundle/{node-sqlite-P3O7XN7Q.js → node-sqlite-RKYSRKEB.js} +8 -8
- package/dist/bundle/oauth-PYDCAQ7Y.js +20 -0
- package/dist/bundle/{open-F4P6YV54.js → open-UCDSQUN2.js} +6 -6
- package/dist/bundle/{openai-4AICLIK3.js → openai-Y4F5ZC7O.js} +16 -16
- package/dist/bundle/{process-5RUXWGYS.js → process-P7FB7YO7.js} +1 -1
- package/dist/bundle/{program-POG5GHUQ.js → program-2D5D32HK.js} +835 -261
- package/dist/bundle/{prompt-NFMDVBZ4.js → prompt-E5TKZ37Q.js} +6 -6
- package/dist/bundle/{recognize-DKN3RY4V.js → recognize-5NYPTSLT.js} +5 -5
- package/dist/bundle/{remote-6QHAGQWY.js → remote-U4LUAHF2.js} +10 -10
- package/dist/bundle/{rerank-M4KHEHUZ.js → rerank-AJAVKK5L.js} +8 -8
- package/dist/bundle/{schemas-JRL3DLMP.js → schemas-QLQ2K6DL.js} +7 -33
- package/dist/bundle/{serve-DNU43ND6.js → serve-4UJ3R5IP.js} +11 -11
- package/dist/bundle/server-CN6VQNNF.js +86 -0
- package/dist/bundle/{server-XJSNF3K5.js → server-OJPCTV77.js} +73 -61
- package/dist/bundle/{source-A3SBLHC4.js → source-VHDK74YS.js} +133 -399
- package/dist/bundle/{sqlite-runtime-EMQAC63N.js → sqlite-runtime-KLEA4XAU.js} +7 -7
- package/dist/bundle/{state-T45CX7VY.js → state-COGSYMVH.js} +7 -7
- package/dist/bundle/{store-6TZ2FCVA.js → store-BJXCSP26.js} +25 -24
- package/dist/bundle/store-HXA2MRWI.js +32 -0
- package/dist/bundle/{store-6LCEVBAZ.js → store-V5UMSWK4.js} +27 -22
- package/dist/bundle/store-maintenance-command-AC7GGLYC.js +73 -0
- package/dist/bundle/surface-ZZNG3OW2.js +72 -0
- package/dist/bundle/writer-CZYA657G.js +86 -0
- package/dist/commands/api.d.ts +4 -4
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/api.js +12 -7
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/crm-shared.d.ts +2 -2
- package/dist/commands/crm-shared.d.ts.map +1 -1
- package/dist/commands/crm-shared.js +20 -4
- package/dist/commands/crm-shared.js.map +1 -1
- package/dist/config.d.ts +46 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +133 -12
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +2 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/context.js.map +1 -1
- package/dist/crm/source.d.ts +7 -2
- package/dist/crm/source.d.ts.map +1 -1
- package/dist/crm/source.js +26 -29
- package/dist/crm/source.js.map +1 -1
- 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/manifest.d.ts.map +1 -1
- package/dist/generated/manifest.js +6 -116
- package/dist/generated/manifest.js.map +1 -1
- package/dist/generated/types.d.ts +160 -0
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/hubspot/transport.d.ts +6 -1
- package/dist/hubspot/transport.d.ts.map +1 -1
- package/dist/hubspot/transport.js +13 -5
- package/dist/hubspot/transport.js.map +1 -1
- package/dist/identity.js +3 -3
- package/dist/identity.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +2 -1
- package/dist/program.js.map +1 -1
- package/dist/setup/texts.en.json +3 -3
- package/dist/setup/texts.es.json +3 -3
- package/dist/setup/texts.ru.json +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/skills/hubspot-cli/SKILL.md +13 -8
- package/skills/hubspot-cli/references/api/api-advanced.md +51 -0
- package/skills/hubspot-cli/references/api/api-basic.md +602 -0
- package/skills/hubspot-cli/references/api/api-batch.md +575 -0
- package/skills/hubspot-cli/references/api.md +3 -2
- package/dist/bundle/command-contract-C6CBFXZF.js +0 -40
- package/dist/bundle/first-run-RPIJZEDT.js +0 -29
- package/dist/bundle/first-screen-RTVMGHAE.js +0 -40
- package/dist/bundle/meeting-combined-L5AGBPYX.js +0 -25
- package/dist/bundle/meeting-model-NTB4RK3F.js +0 -25
- package/dist/bundle/oauth-HNCY4B2S.js +0 -20
- package/dist/bundle/server-C3ZHA7AZ.js +0 -77
- package/dist/bundle/store-CCDNUB6A.js +0 -32
- package/dist/bundle/store-maintenance-command-BRCG6MNA.js +0 -68
- package/dist/commands/comments.d.ts +0 -3
- package/dist/commands/comments.d.ts.map +0 -1
- package/dist/commands/comments.js +0 -114
- package/dist/commands/comments.js.map +0 -1
- package/dist/sample/comments.d.ts +0 -61
- package/dist/sample/comments.d.ts.map +0 -1
- package/dist/sample/comments.js +0 -39
- package/dist/sample/comments.js.map +0 -1
- package/dist/sample/records.d.ts +0 -16
- package/dist/sample/records.d.ts.map +0 -1
- package/dist/sample/records.js +0 -22
- package/dist/sample/records.js.map +0 -1
- package/dist/sample/transport.d.ts +0 -42
- package/dist/sample/transport.d.ts.map +0 -1
- package/dist/sample/transport.js +0 -153
- package/dist/sample/transport.js.map +0 -1
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
throughWrapper
|
|
5
|
+
} from "./chunk-M763RNWP.js";
|
|
6
|
+
import {
|
|
7
|
+
environmentOf,
|
|
8
|
+
readOnlyLockOf
|
|
9
|
+
} from "./chunk-PHXOL5HZ.js";
|
|
10
|
+
import {
|
|
11
|
+
array,
|
|
12
|
+
boolean,
|
|
13
|
+
check,
|
|
14
|
+
pipe,
|
|
15
|
+
record,
|
|
16
|
+
safeParse,
|
|
17
|
+
strictObject,
|
|
18
|
+
string
|
|
19
|
+
} from "./chunk-S4UUN6LD.js";
|
|
20
|
+
import {
|
|
21
|
+
CliError
|
|
22
|
+
} from "./chunk-BUGROVF3.js";
|
|
23
|
+
import {
|
|
24
|
+
__name
|
|
25
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
26
|
+
|
|
27
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/background/relay.js
|
|
28
|
+
import { createHash } from "node:crypto";
|
|
29
|
+
import { chmodSync, lstatSync, mkdirSync, rmSync } from "node:fs";
|
|
30
|
+
import { createConnection, createServer } from "node:net";
|
|
31
|
+
import { tmpdir } from "node:os";
|
|
32
|
+
import { dirname, isAbsolute, join } from "node:path";
|
|
33
|
+
import { PassThrough, Writable } from "node:stream";
|
|
34
|
+
var RELAY_PROTOCOL = 1;
|
|
35
|
+
var requestSchema = strictObject({
|
|
36
|
+
argv: array(string()),
|
|
37
|
+
env: record(string(), string()),
|
|
38
|
+
cwd: pipe(string(), check((path) => isAbsolute(path))),
|
|
39
|
+
tty: boolean(),
|
|
40
|
+
stdinTty: boolean()
|
|
41
|
+
});
|
|
42
|
+
var MAX_CLIENT_LINE = 1024 * 1024;
|
|
43
|
+
var MAX_SERVE_LINE = 64 * 1024 * 1024;
|
|
44
|
+
var MAX_SOCKET_PATH = 100;
|
|
45
|
+
var relayPath = /* @__PURE__ */ __name((lockPath) => {
|
|
46
|
+
const beside = lockPath.replace(/\.lock$/, ".sock");
|
|
47
|
+
if (beside.length <= MAX_SOCKET_PATH)
|
|
48
|
+
return beside;
|
|
49
|
+
const hash = createHash("sha256").update(beside).digest("hex").slice(0, 16);
|
|
50
|
+
const name = join(`wirecat-relay-${process.getuid?.() ?? "user"}`, `${hash}.sock`);
|
|
51
|
+
const temporary = join(tmpdir(), name);
|
|
52
|
+
if (temporary.length <= MAX_SOCKET_PATH || process.platform === "win32")
|
|
53
|
+
return temporary;
|
|
54
|
+
return join("/tmp", name);
|
|
55
|
+
}, "relayPath");
|
|
56
|
+
var privateDirectory = /* @__PURE__ */ __name((dir) => {
|
|
57
|
+
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
58
|
+
const stat = lstatSync(dir);
|
|
59
|
+
const mine = process.getuid === void 0 || stat.uid === process.getuid();
|
|
60
|
+
if (!stat.isDirectory() || !mine || (stat.mode & 63) !== 0) {
|
|
61
|
+
throw new CliError("permission_error", `${dir} is not a private directory, so serve does not listen there`);
|
|
62
|
+
}
|
|
63
|
+
}, "privateDirectory");
|
|
64
|
+
var lines = /* @__PURE__ */ __name((socket, max, onLine, onTooLong) => {
|
|
65
|
+
let buffered = "";
|
|
66
|
+
socket.setEncoding("utf8");
|
|
67
|
+
socket.on("data", (chunk) => {
|
|
68
|
+
buffered += chunk;
|
|
69
|
+
for (let end = buffered.indexOf("\n"); end >= 0; end = buffered.indexOf("\n")) {
|
|
70
|
+
const line = buffered.slice(0, end);
|
|
71
|
+
buffered = buffered.slice(end + 1);
|
|
72
|
+
if (line)
|
|
73
|
+
onLine(line);
|
|
74
|
+
}
|
|
75
|
+
if (buffered.length > max)
|
|
76
|
+
onTooLong();
|
|
77
|
+
});
|
|
78
|
+
}, "lines");
|
|
79
|
+
var frame = /* @__PURE__ */ __name((socket, value) => {
|
|
80
|
+
if (!socket.destroyed)
|
|
81
|
+
socket.write(`${JSON.stringify(value)}
|
|
82
|
+
`);
|
|
83
|
+
}, "frame");
|
|
84
|
+
var listenRelay = /* @__PURE__ */ __name(async (path, run) => {
|
|
85
|
+
privateDirectory(dirname(path));
|
|
86
|
+
rmSync(path, { force: true });
|
|
87
|
+
const open = /* @__PURE__ */ new Set();
|
|
88
|
+
const running = /* @__PURE__ */ new Set();
|
|
89
|
+
const server = createServer((socket) => {
|
|
90
|
+
open.add(socket);
|
|
91
|
+
const stop = new AbortController();
|
|
92
|
+
const stdin = new PassThrough();
|
|
93
|
+
let started = false;
|
|
94
|
+
socket.on("error", () => {
|
|
95
|
+
});
|
|
96
|
+
socket.on("close", () => {
|
|
97
|
+
open.delete(socket);
|
|
98
|
+
stop.abort(new CliError("cancelled", "the client went away", { retryable: false }));
|
|
99
|
+
if (!stdin.writableEnded)
|
|
100
|
+
stdin.end();
|
|
101
|
+
});
|
|
102
|
+
lines(socket, MAX_CLIENT_LINE, (line) => {
|
|
103
|
+
let message;
|
|
104
|
+
try {
|
|
105
|
+
message = JSON.parse(line);
|
|
106
|
+
} catch {
|
|
107
|
+
socket.destroy();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!started) {
|
|
111
|
+
started = true;
|
|
112
|
+
if (message.v !== RELAY_PROTOCOL) {
|
|
113
|
+
frame(socket, { diagnostic: `serve speaks relay protocol ${RELAY_PROTOCOL}; restart it`, exit: 1 });
|
|
114
|
+
socket.end();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const parsed = safeParse(requestSchema, message.run);
|
|
118
|
+
if (!parsed.success) {
|
|
119
|
+
socket.destroy();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
stdin.isTTY = parsed.output.stdinTty;
|
|
123
|
+
if (parsed.output.stdinTty)
|
|
124
|
+
stdin.end();
|
|
125
|
+
const job = serve(socket, parsed.output, stdin, stop.signal, run);
|
|
126
|
+
running.add(job);
|
|
127
|
+
void job.then(() => running.delete(job), () => running.delete(job));
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (typeof message.stdin === "string" && !stdin.writableEnded)
|
|
131
|
+
stdin.write(Buffer.from(message.stdin, "base64"));
|
|
132
|
+
if (message.stdinEnd === true && !stdin.writableEnded)
|
|
133
|
+
stdin.end();
|
|
134
|
+
}, () => socket.destroy());
|
|
135
|
+
});
|
|
136
|
+
await new Promise((resolve, reject) => {
|
|
137
|
+
server.once("error", reject);
|
|
138
|
+
server.listen(path, () => {
|
|
139
|
+
server.off("error", reject);
|
|
140
|
+
resolve();
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
chmodSync(path, 384);
|
|
144
|
+
return {
|
|
145
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
146
|
+
for (const socket of open)
|
|
147
|
+
socket.destroy();
|
|
148
|
+
await new Promise((resolve) => server.close(() => resolve()));
|
|
149
|
+
await Promise.allSettled(running);
|
|
150
|
+
rmSync(path, { force: true });
|
|
151
|
+
}, "close")
|
|
152
|
+
};
|
|
153
|
+
}, "listenRelay");
|
|
154
|
+
var serve = /* @__PURE__ */ __name(async (socket, request, stdin, signal, run) => {
|
|
155
|
+
const streams = {
|
|
156
|
+
data: /* @__PURE__ */ __name((text) => frame(socket, { data: text }), "data"),
|
|
157
|
+
diagnostic: /* @__PURE__ */ __name((text) => frame(socket, { diagnostic: text }), "diagnostic"),
|
|
158
|
+
progress: /* @__PURE__ */ __name((text) => frame(socket, { progress: text }), "progress")
|
|
159
|
+
};
|
|
160
|
+
const stdout = new Writable({
|
|
161
|
+
write: /* @__PURE__ */ __name((chunk, _encoding, done) => {
|
|
162
|
+
frame(socket, { raw: Buffer.from(chunk).toString("base64") });
|
|
163
|
+
done();
|
|
164
|
+
}, "write")
|
|
165
|
+
});
|
|
166
|
+
let code = 1;
|
|
167
|
+
try {
|
|
168
|
+
code = await run(request, { streams, stdin, stdout, signal });
|
|
169
|
+
} finally {
|
|
170
|
+
frame(socket, { exit: code });
|
|
171
|
+
socket.end();
|
|
172
|
+
}
|
|
173
|
+
}, "serve");
|
|
174
|
+
var relayCommand = /* @__PURE__ */ __name((path, request, options) => new Promise((resolve, reject) => {
|
|
175
|
+
const { streams, stdin, stdout, signal, deadlineMs, writes, holder, listens = false } = options;
|
|
176
|
+
const socket = createConnection(path);
|
|
177
|
+
let connected = false;
|
|
178
|
+
let settled = false;
|
|
179
|
+
let timer;
|
|
180
|
+
const forward = /* @__PURE__ */ __name((chunk) => frame(socket, { stdin: Buffer.from(chunk).toString("base64") }), "forward");
|
|
181
|
+
const ended = /* @__PURE__ */ __name(() => frame(socket, { stdinEnd: true }), "ended");
|
|
182
|
+
const brokenPipe = /* @__PURE__ */ __name((error) => {
|
|
183
|
+
if (error.code === "EPIPE")
|
|
184
|
+
finish({ code: 0 });
|
|
185
|
+
}, "brokenPipe");
|
|
186
|
+
const finish = /* @__PURE__ */ __name((outcome) => {
|
|
187
|
+
if (settled)
|
|
188
|
+
return;
|
|
189
|
+
settled = true;
|
|
190
|
+
if (timer)
|
|
191
|
+
clearTimeout(timer);
|
|
192
|
+
stdout.off("error", brokenPipe);
|
|
193
|
+
signal.removeEventListener("abort", aborted);
|
|
194
|
+
stdin.off("data", forward).off("end", ended);
|
|
195
|
+
stdin.pause();
|
|
196
|
+
socket.destroy();
|
|
197
|
+
if ("code" in outcome)
|
|
198
|
+
resolve(outcome.code);
|
|
199
|
+
else
|
|
200
|
+
reject(outcome.error);
|
|
201
|
+
}, "finish");
|
|
202
|
+
const stopped = /* @__PURE__ */ __name(() => writes ? new CliError("outcome_unknown", `${holder} stopped before the command finished; it may have run \u2014 check before repeating it`, { retryable: false }) : new CliError("provider_unavailable", `${holder} stopped before the command finished`, { retryable: true }), "stopped");
|
|
203
|
+
const aborted = /* @__PURE__ */ __name(() => finish(listens ? { code: 0 } : { error: signal.reason }), "aborted");
|
|
204
|
+
if (signal.aborted)
|
|
205
|
+
return aborted();
|
|
206
|
+
signal.addEventListener("abort", aborted, { once: true });
|
|
207
|
+
stdout.on("error", brokenPipe);
|
|
208
|
+
if (deadlineMs !== void 0)
|
|
209
|
+
timer = setTimeout(() => finish({ error: stopped() }), deadlineMs);
|
|
210
|
+
socket.on("connect", () => {
|
|
211
|
+
connected = true;
|
|
212
|
+
frame(socket, { v: RELAY_PROTOCOL, run: request });
|
|
213
|
+
if (request.stdinTty)
|
|
214
|
+
ended();
|
|
215
|
+
else {
|
|
216
|
+
stdin.on("data", forward).once("end", ended);
|
|
217
|
+
stdin.resume();
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
socket.on("error", (error) => {
|
|
221
|
+
if (connected)
|
|
222
|
+
return finish({ error: stopped() });
|
|
223
|
+
finish({
|
|
224
|
+
error: new CliError("provider_unavailable", `${holder} holds the connection but does not answer its relay (${error.code ?? error.message}) \u2014 restart it`, { retryable: false, sent: false })
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
socket.on("close", () => finish({ error: stopped() }));
|
|
228
|
+
lines(socket, MAX_SERVE_LINE, (line) => {
|
|
229
|
+
let message;
|
|
230
|
+
try {
|
|
231
|
+
message = JSON.parse(line);
|
|
232
|
+
} catch {
|
|
233
|
+
return finish({ error: stopped() });
|
|
234
|
+
}
|
|
235
|
+
if (typeof message.data === "string")
|
|
236
|
+
streams.data(message.data);
|
|
237
|
+
if (typeof message.diagnostic === "string")
|
|
238
|
+
streams.diagnostic(message.diagnostic);
|
|
239
|
+
if (typeof message.progress === "string")
|
|
240
|
+
streams.progress?.(message.progress);
|
|
241
|
+
if (typeof message.raw === "string")
|
|
242
|
+
stdout.write(Buffer.from(message.raw, "base64"));
|
|
243
|
+
if (typeof message.exit === "number")
|
|
244
|
+
finish({ code: message.exit });
|
|
245
|
+
}, () => finish({ error: stopped() }));
|
|
246
|
+
}), "relayCommand");
|
|
247
|
+
|
|
248
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
|
|
249
|
+
var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
|
|
250
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
251
|
+
}, "close"),
|
|
252
|
+
feed: void 0,
|
|
253
|
+
storedChats: void 0,
|
|
254
|
+
listen: void 0,
|
|
255
|
+
listenHistory: void 0,
|
|
256
|
+
...connection.watch && watchers ? {
|
|
257
|
+
// A watcher that throws (its output limit, a closed reader) ends its own watch, never serve's.
|
|
258
|
+
watch: /* @__PURE__ */ __name(async (onEvent, signal, onReady) => {
|
|
259
|
+
let watcher;
|
|
260
|
+
try {
|
|
261
|
+
await new Promise((resolve, reject) => {
|
|
262
|
+
watcher = /* @__PURE__ */ __name((event) => {
|
|
263
|
+
try {
|
|
264
|
+
onEvent(event);
|
|
265
|
+
} catch (error) {
|
|
266
|
+
reject(error);
|
|
267
|
+
}
|
|
268
|
+
}, "watcher");
|
|
269
|
+
watchers.add(watcher);
|
|
270
|
+
signal.addEventListener("abort", () => resolve(), { once: true });
|
|
271
|
+
onReady?.();
|
|
272
|
+
if (signal.aborted)
|
|
273
|
+
resolve();
|
|
274
|
+
});
|
|
275
|
+
} finally {
|
|
276
|
+
if (watcher)
|
|
277
|
+
watchers.delete(watcher);
|
|
278
|
+
}
|
|
279
|
+
}, "watch")
|
|
280
|
+
} : { watch: void 0 }
|
|
281
|
+
}), "lentConnection");
|
|
282
|
+
var serveRelay = /* @__PURE__ */ __name((command, messenger) => {
|
|
283
|
+
let held;
|
|
284
|
+
let relay;
|
|
285
|
+
const watchers = /* @__PURE__ */ new Set();
|
|
286
|
+
const borrowed = /* @__PURE__ */ __name(() => {
|
|
287
|
+
const connection = held;
|
|
288
|
+
if (!connection)
|
|
289
|
+
throw new CliError("provider_unavailable", "serve is not connected yet", { retryable: true });
|
|
290
|
+
return lentConnection(connection, watchers);
|
|
291
|
+
}, "borrowed");
|
|
292
|
+
return {
|
|
293
|
+
messenger: {
|
|
294
|
+
...messenger,
|
|
295
|
+
connect: /* @__PURE__ */ __name(async (...args) => {
|
|
296
|
+
held = await messenger.connect(...args);
|
|
297
|
+
return held;
|
|
298
|
+
}, "connect")
|
|
299
|
+
},
|
|
300
|
+
arrived: /* @__PURE__ */ __name((event) => {
|
|
301
|
+
for (const watcher of watchers)
|
|
302
|
+
watcher(event);
|
|
303
|
+
}, "arrived"),
|
|
304
|
+
/** Listens beside the lock; the address goes into it, which is how a client finds it. */
|
|
305
|
+
open: /* @__PURE__ */ __name(async (lockPath, profile) => {
|
|
306
|
+
const environment = environmentOf(command);
|
|
307
|
+
const runCommand = environment.runCommand;
|
|
308
|
+
if (!runCommand)
|
|
309
|
+
return void 0;
|
|
310
|
+
const readOnly = readOnlyLockOf(messenger.app, environment.env ?? process.env);
|
|
311
|
+
const path = relayPath(lockPath);
|
|
312
|
+
relay = await listenRelay(path, (request, io) => runCommand(request.argv, {
|
|
313
|
+
env: {
|
|
314
|
+
...request.env,
|
|
315
|
+
...readOnly ? { [`${messenger.app.envPrefix}_READ_ONLY`]: "1" } : {}
|
|
316
|
+
},
|
|
317
|
+
streams: io.streams,
|
|
318
|
+
stdin: io.stdin,
|
|
319
|
+
stdout: io.stdout,
|
|
320
|
+
tty: request.tty,
|
|
321
|
+
signal: io.signal,
|
|
322
|
+
answer: /* @__PURE__ */ __name(() => null, "answer"),
|
|
323
|
+
relayed: { profile, cwd: request.cwd, connection: borrowed }
|
|
324
|
+
}));
|
|
325
|
+
return { path, protocol: RELAY_PROTOCOL };
|
|
326
|
+
}, "open"),
|
|
327
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
328
|
+
await relay?.close();
|
|
329
|
+
}, "close")
|
|
330
|
+
};
|
|
331
|
+
}, "serveRelay");
|
|
332
|
+
|
|
333
|
+
export {
|
|
334
|
+
RELAY_PROTOCOL,
|
|
335
|
+
relayCommand,
|
|
336
|
+
lentConnection,
|
|
337
|
+
serveRelay
|
|
338
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__name
|
|
5
5
|
} from "./chunk-ZVVMGPBJ.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/mcp/instructions.js
|
|
8
8
|
var instructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => {
|
|
9
9
|
const all = typeof profile !== "string";
|
|
10
10
|
const offers = /* @__PURE__ */ __name((key) => all || writes.includes(key), "offers");
|
|
@@ -5,23 +5,23 @@ import {
|
|
|
5
5
|
installFiles,
|
|
6
6
|
megabytes,
|
|
7
7
|
sharedModelsDirectory
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KO4VR5NK.js";
|
|
9
9
|
import {
|
|
10
10
|
importFrom
|
|
11
11
|
} from "./chunk-Y5E2WNWB.js";
|
|
12
12
|
import {
|
|
13
13
|
CliError
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BUGROVF3.js";
|
|
15
15
|
import {
|
|
16
16
|
__name
|
|
17
17
|
} from "./chunk-ZVVMGPBJ.js";
|
|
18
18
|
|
|
19
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/embeddings/embed.js
|
|
20
20
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
21
21
|
import { availableParallelism } from "node:os";
|
|
22
22
|
import { basename, join as join2 } from "node:path";
|
|
23
23
|
|
|
24
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/embeddings/onnx-runtime.js
|
|
25
25
|
import { createHash } from "node:crypto";
|
|
26
26
|
import { copyFileSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
27
27
|
import { join } from "node:path";
|
|
@@ -678,7 +678,7 @@ var Unzip = /* @__PURE__ */ (function() {
|
|
|
678
678
|
return Unzip2;
|
|
679
679
|
})();
|
|
680
680
|
|
|
681
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
681
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/embeddings/onnx-runtime.js
|
|
682
682
|
var ONNX_RUNTIME_VERSION = "1.30.0";
|
|
683
683
|
var release = /* @__PURE__ */ __name((name, sha256, bytes) => ({
|
|
684
684
|
name,
|
|
@@ -858,7 +858,7 @@ var openSession = /* @__PURE__ */ __name(async (bytes, threads, options = {}) =>
|
|
|
858
858
|
return { ort, session: await ort.InferenceSession.create(bytes, options) };
|
|
859
859
|
}, "openSession");
|
|
860
860
|
|
|
861
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
861
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/embeddings/embed.js
|
|
862
862
|
var textModelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("text", env), "textModelsDirectory");
|
|
863
863
|
var placedText = /* @__PURE__ */ __name((model, directory) => model.files.map((file) => [file, join2(directory, model.id, file.name)]), "placedText");
|
|
864
864
|
var isTextModelInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placedText(model, directory)), "isTextModelInstalled");
|
|
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
CAPABILITY_STATEMENTS,
|
|
5
5
|
storeCapable
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NZGI74GS.js";
|
|
7
7
|
import {
|
|
8
8
|
importFrom
|
|
9
9
|
} from "./chunk-Y5E2WNWB.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
__name
|
|
12
12
|
} from "./chunk-ZVVMGPBJ.js";
|
|
13
13
|
|
|
14
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/sqlite-runtime.js
|
|
15
15
|
import { spawn, spawnSync } from "node:child_process";
|
|
16
16
|
import { readFileSync } from "node:fs";
|
|
17
17
|
import { dirname } from "node:path";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__name
|
|
5
5
|
} from "./chunk-ZVVMGPBJ.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/errors.js
|
|
8
8
|
var errorCodes = [
|
|
9
9
|
"validation_error",
|
|
10
10
|
"configuration_error",
|
|
@@ -39,7 +39,7 @@ var CliError = class extends Error {
|
|
|
39
39
|
};
|
|
40
40
|
var isCliError = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && value[BRAND] === true, "isCliError");
|
|
41
41
|
|
|
42
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
42
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
|
|
43
43
|
var CONTROL = (
|
|
44
44
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
|
|
45
45
|
/[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
|
|
@@ -3,12 +3,12 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
CliError,
|
|
5
5
|
singleLine
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BUGROVF3.js";
|
|
7
7
|
import {
|
|
8
8
|
__name
|
|
9
9
|
} from "./chunk-ZVVMGPBJ.js";
|
|
10
10
|
|
|
11
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/domain/tags.js
|
|
12
12
|
var TAG_TYPES = ["chat", "contact", "message", "task"];
|
|
13
13
|
var TAG = /^[a-z0-9-]{1,32}$/;
|
|
14
14
|
var tagOf = /* @__PURE__ */ __name((value) => {
|