@wirecat/hubspot-cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/LICENSE +204 -0
- package/README.md +256 -2
- package/contracts/wirecat.json +1965 -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-422MCA7S.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-2TWQIWWG.js +1328 -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-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-BKXDHU3G.js +1395 -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-H3TNVEQX.js +782 -0
- package/dist/bundle/chunk-HC5ZWE5X.js +193 -0
- package/dist/bundle/chunk-HCAZV5NP.js +95 -0
- package/dist/bundle/chunk-HTAN663T.js +4045 -0
- package/dist/bundle/chunk-HZRQLAHO.js +16 -0
- package/dist/bundle/chunk-IMJQRPLN.js +92 -0
- package/dist/bundle/chunk-JLDBMEKZ.js +106 -0
- package/dist/bundle/chunk-JRCPCVPI.js +9393 -0
- package/dist/bundle/chunk-LNV33FDC.js +786 -0
- package/dist/bundle/chunk-LOBVOGOE.js +66 -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-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-SAKK2YRU.js +218 -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-TOSCB4SO.js +1227 -0
- package/dist/bundle/chunk-TP7GDWVF.js +6848 -0
- package/dist/bundle/chunk-UUMUL4L3.js +72 -0
- package/dist/bundle/chunk-VIEYMDBR.js +41 -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-WQBX7XYP.js +26174 -0
- package/dist/bundle/chunk-X2M6NIQG.js +18 -0
- package/dist/bundle/chunk-X7XUX7A4.js +1846 -0
- package/dist/bundle/chunk-XRREFEIW.js +372 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-ZBDSHFG4.js +40933 -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-MYZZKZJ7.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-RPIJZEDT.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-POG5GHUQ.js +9241 -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-C3ZHA7AZ.js +77 -0
- package/dist/bundle/server-XJSNF3K5.js +207 -0
- package/dist/bundle/source-A3SBLHC4.js +934 -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-CCDNUB6A.js +32 -0
- package/dist/bundle/store-maintenance-command-BRCG6MNA.js +68 -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 +65 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.js.map +1 -0
- package/dist/commands/crm-shared.d.ts +8 -0
- package/dist/commands/crm-shared.d.ts.map +1 -0
- package/dist/commands/crm-shared.js +93 -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 +22 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +28 -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 +32 -0
- package/dist/crm/source.d.ts.map +1 -0
- package/dist/crm/source.js +369 -0
- package/dist/crm/source.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 +6499 -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 +76 -0
- package/dist/hubspot/transport.d.ts.map +1 -0
- package/dist/hubspot/transport.js +346 -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 +77 -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/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/records.d.ts +16 -0
- package/dist/sample/records.d.ts.map +1 -0
- package/dist/sample/records.js +22 -0
- package/dist/sample/records.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +153 -0
- package/dist/sample/transport.js.map +1 -0
- package/dist/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 +97 -0
- package/skills/hubspot-cli/references/api/api-basic.md +462 -0
- package/skills/hubspot-cli/references/api/api-batch.md +149 -0
- package/skills/hubspot-cli/references/api/api-search.md +147 -0
- package/skills/hubspot-cli/references/api.md +15 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
holdLock,
|
|
5
|
+
readLock,
|
|
6
|
+
releaseLock,
|
|
7
|
+
takeLock
|
|
8
|
+
} from "./chunk-24ERVFJP.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// 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/mcp/http/state.js
|
|
14
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
15
|
+
|
|
16
|
+
// 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/mcp/http/activity.js
|
|
17
|
+
import { randomBytes } from "node:crypto";
|
|
18
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
19
|
+
import { dirname } from "node:path";
|
|
20
|
+
var WRITE_EVERY_MS = 2e3;
|
|
21
|
+
var TOOL_NAME = /^[A-Za-z0-9_.-]{1,64}$/;
|
|
22
|
+
var httpActivityFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.activity.json`, "httpActivityFile");
|
|
23
|
+
var localDay = /* @__PURE__ */ __name((ms) => {
|
|
24
|
+
const d = new Date(ms);
|
|
25
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
26
|
+
}, "localDay");
|
|
27
|
+
var readActivity = /* @__PURE__ */ __name((path) => {
|
|
28
|
+
if (!existsSync(path))
|
|
29
|
+
return {};
|
|
30
|
+
try {
|
|
31
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
32
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
33
|
+
} catch {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
}, "readActivity");
|
|
37
|
+
var calledTools = /* @__PURE__ */ __name((body) => (Array.isArray(body) ? body : [body]).flatMap((message) => {
|
|
38
|
+
if (!message || typeof message !== "object")
|
|
39
|
+
return [];
|
|
40
|
+
const { method, params } = message;
|
|
41
|
+
const name = params?.name;
|
|
42
|
+
return method === "tools/call" && typeof name === "string" && TOOL_NAME.test(name) ? [name] : [];
|
|
43
|
+
}), "calledTools");
|
|
44
|
+
var activityRecorder = /* @__PURE__ */ __name((path, now = Date.now) => {
|
|
45
|
+
const activity = readActivity(path);
|
|
46
|
+
let timer;
|
|
47
|
+
const write = /* @__PURE__ */ __name(() => {
|
|
48
|
+
timer = void 0;
|
|
49
|
+
try {
|
|
50
|
+
mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
51
|
+
const temporary = `${path}.${randomBytes(8).toString("hex")}.tmp`;
|
|
52
|
+
writeFileSync(temporary, JSON.stringify(activity), { mode: 384, flag: "wx" });
|
|
53
|
+
chmodSync(temporary, 384);
|
|
54
|
+
renameSync(temporary, path);
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
}, "write");
|
|
58
|
+
return {
|
|
59
|
+
record: /* @__PURE__ */ __name((clientId, tools) => {
|
|
60
|
+
const at = now();
|
|
61
|
+
const iso = new Date(at).toISOString();
|
|
62
|
+
const day = localDay(at);
|
|
63
|
+
const before = activity[clientId];
|
|
64
|
+
const counted = before?.day === day ? before.toolCalls : 0;
|
|
65
|
+
const last = tools.at(-1);
|
|
66
|
+
activity[clientId] = {
|
|
67
|
+
lastRequestAt: iso,
|
|
68
|
+
day,
|
|
69
|
+
toolCalls: counted + tools.length,
|
|
70
|
+
...last ? { lastTool: last, lastToolAt: iso } : before?.lastTool ? { lastTool: before.lastTool, ...before.lastToolAt ? { lastToolAt: before.lastToolAt } : {} } : {}
|
|
71
|
+
};
|
|
72
|
+
if (last) {
|
|
73
|
+
clearTimeout(timer);
|
|
74
|
+
write();
|
|
75
|
+
} else if (!timer) {
|
|
76
|
+
timer = setTimeout(write, WRITE_EVERY_MS);
|
|
77
|
+
timer.unref();
|
|
78
|
+
}
|
|
79
|
+
}, "record"),
|
|
80
|
+
flush: /* @__PURE__ */ __name(() => {
|
|
81
|
+
if (!timer)
|
|
82
|
+
return;
|
|
83
|
+
clearTimeout(timer);
|
|
84
|
+
write();
|
|
85
|
+
}, "flush")
|
|
86
|
+
};
|
|
87
|
+
}, "activityRecorder");
|
|
88
|
+
|
|
89
|
+
// 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/mcp/http/state.js
|
|
90
|
+
var ACCESS_SECONDS = 60 * 60;
|
|
91
|
+
var REFRESH_SECONDS = 30 * 24 * 60 * 60;
|
|
92
|
+
var readStored = /* @__PURE__ */ __name((path) => existsSync2(path) ? JSON.parse(readFileSync2(path, "utf8")) : { clients: [], tokens: [] }, "readStored");
|
|
93
|
+
var mcpHttpMarker = /* @__PURE__ */ __name((envPrefix) => `${envPrefix}_MCP_HTTP`, "mcpHttpMarker");
|
|
94
|
+
var httpLogFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.log`, "httpLogFile");
|
|
95
|
+
var httpLockFile = /* @__PURE__ */ __name((tokenFile) => `${tokenFile.replace(/\.json$/, "")}.lock`, "httpLockFile");
|
|
96
|
+
var httpLaunchFile = /* @__PURE__ */ __name((lockFile) => `${lockFile.replace(/\.lock$/, "")}.launch.json`, "httpLaunchFile");
|
|
97
|
+
var readHttpLaunch = /* @__PURE__ */ __name((path) => {
|
|
98
|
+
try {
|
|
99
|
+
const launch = JSON.parse(readFileSync2(path, "utf8"));
|
|
100
|
+
return typeof launch.invocation === "string" && Array.isArray(launch.argv) && launch.argv.every((word) => typeof word === "string") && typeof launch.env === "object" && launch.env !== null ? launch : void 0;
|
|
101
|
+
} catch {
|
|
102
|
+
return void 0;
|
|
103
|
+
}
|
|
104
|
+
}, "readHttpLaunch");
|
|
105
|
+
var readHttpLock = /* @__PURE__ */ __name((path) => {
|
|
106
|
+
const lock = readLock(path);
|
|
107
|
+
return lock && typeof lock.port === "number" && typeof lock.publicUrl === "string" ? lock : void 0;
|
|
108
|
+
}, "readHttpLock");
|
|
109
|
+
var httpLock = /* @__PURE__ */ __name((path, first) => {
|
|
110
|
+
let current = first;
|
|
111
|
+
const held = takeLock(path, current);
|
|
112
|
+
return {
|
|
113
|
+
held,
|
|
114
|
+
update: /* @__PURE__ */ __name((change) => {
|
|
115
|
+
current = { ...current, ...change };
|
|
116
|
+
holdLock(path, current);
|
|
117
|
+
}, "update"),
|
|
118
|
+
release: /* @__PURE__ */ __name(() => releaseLock(path), "release")
|
|
119
|
+
};
|
|
120
|
+
}, "httpLock");
|
|
121
|
+
var signedInClients = /* @__PURE__ */ __name((tokenFile, now = Date.now()) => {
|
|
122
|
+
const seconds = Math.floor(now / 1e3);
|
|
123
|
+
const { clients, tokens } = readStored(tokenFile);
|
|
124
|
+
const activity = readActivity(httpActivityFile(tokenFile));
|
|
125
|
+
const today = localDay(now);
|
|
126
|
+
const last = /* @__PURE__ */ new Map();
|
|
127
|
+
for (const token of tokens) {
|
|
128
|
+
if (token.expiresAt <= seconds)
|
|
129
|
+
continue;
|
|
130
|
+
const issued = token.expiresAt - (token.kind === "access" ? ACCESS_SECONDS : REFRESH_SECONDS);
|
|
131
|
+
last.set(token.clientId, Math.max(last.get(token.clientId) ?? 0, issued));
|
|
132
|
+
}
|
|
133
|
+
return clients.filter((client) => last.has(client.id)).map((client) => {
|
|
134
|
+
const did = activity[client.id];
|
|
135
|
+
return {
|
|
136
|
+
claimedName: client.name ?? null,
|
|
137
|
+
lastLoginAt: new Date((last.get(client.id) ?? 0) * 1e3).toISOString(),
|
|
138
|
+
lastRequestAt: did?.lastRequestAt ?? null,
|
|
139
|
+
lastTool: did?.lastTool ?? null,
|
|
140
|
+
lastToolAt: did?.lastToolAt ?? null,
|
|
141
|
+
toolCallsToday: did?.day === today ? did.toolCalls : 0
|
|
142
|
+
};
|
|
143
|
+
}).sort((a, b) => b.lastLoginAt.localeCompare(a.lastLoginAt));
|
|
144
|
+
}, "signedInClients");
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
httpActivityFile,
|
|
148
|
+
calledTools,
|
|
149
|
+
activityRecorder,
|
|
150
|
+
ACCESS_SECONDS,
|
|
151
|
+
REFRESH_SECONDS,
|
|
152
|
+
readStored,
|
|
153
|
+
mcpHttpMarker,
|
|
154
|
+
httpLogFile,
|
|
155
|
+
httpLockFile,
|
|
156
|
+
httpLaunchFile,
|
|
157
|
+
readHttpLaunch,
|
|
158
|
+
readHttpLock,
|
|
159
|
+
httpLock,
|
|
160
|
+
signedInClients
|
|
161
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
singleLine
|
|
5
|
+
} from "./chunk-DB2XKHI4.js";
|
|
6
|
+
import {
|
|
7
|
+
__name
|
|
8
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
9
|
+
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/names.js
|
|
11
|
+
var FIRST_PARTY_TOOLS = [
|
|
12
|
+
{ name: "tg", package: "@wirecat/tg-cli" },
|
|
13
|
+
{ name: "max", package: "@wirecat/max-cli" },
|
|
14
|
+
{ name: "wa", package: "@wirecat/whatsapp-cli" },
|
|
15
|
+
{ name: "zm", package: "@wirecat/zoom-cli" },
|
|
16
|
+
{ name: "drive", package: "@wirecat/drive-cli" },
|
|
17
|
+
{ name: "memo", package: "@wirecat/cli-memo" },
|
|
18
|
+
{ name: "mail", package: "@wirecat/mail-cli" },
|
|
19
|
+
// memo reads email today; the name is held for a tool of its own.
|
|
20
|
+
{ name: "email" }
|
|
21
|
+
];
|
|
22
|
+
var BUILT_IN_COMMANDS = ["help", "version", "shortcuts", "doctor", "update", "upgrade", "app"];
|
|
23
|
+
var RESERVED_NAMES = [
|
|
24
|
+
...FIRST_PARTY_TOOLS.map((tool) => tool.name),
|
|
25
|
+
...BUILT_IN_COMMANDS,
|
|
26
|
+
"wcat"
|
|
27
|
+
];
|
|
28
|
+
var TOOL_NAME = /^[a-z][a-z0-9-]{0,39}$/;
|
|
29
|
+
var PROGRAM_PREFIX = "wcat-";
|
|
30
|
+
var DESCRIBE_FLAG = "--wcat-describe";
|
|
31
|
+
var DESCRIBE_MAX_BYTES = 64 * 1024;
|
|
32
|
+
var DISPATCH_FLAG = "--wcat-dispatch";
|
|
33
|
+
|
|
34
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/describe.js
|
|
35
|
+
var DESCRIBE_FORMAT = 1;
|
|
36
|
+
var DESCRIBE_MANIFEST_FORMAT = 2;
|
|
37
|
+
var describeAnswer = /* @__PURE__ */ __name((tool, manifest) => {
|
|
38
|
+
const answer = {
|
|
39
|
+
wcat_describe: DESCRIBE_FORMAT,
|
|
40
|
+
name: tool.command,
|
|
41
|
+
version: tool.version,
|
|
42
|
+
description: tool.description,
|
|
43
|
+
...tool.docs ? { docs_url: tool.docs } : {}
|
|
44
|
+
};
|
|
45
|
+
if (!manifest)
|
|
46
|
+
return answer;
|
|
47
|
+
const full = {
|
|
48
|
+
...answer,
|
|
49
|
+
wcat_describe: DESCRIBE_MANIFEST_FORMAT,
|
|
50
|
+
desktop: manifest.desktop,
|
|
51
|
+
manifest_sha256: manifest.sha256
|
|
52
|
+
};
|
|
53
|
+
return Buffer.byteLength(`${JSON.stringify(full)}
|
|
54
|
+
`) > DESCRIBE_MAX_BYTES ? answer : full;
|
|
55
|
+
}, "describeAnswer");
|
|
56
|
+
var MAX_TEXT = 200;
|
|
57
|
+
var clean = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim() !== "" ? singleLine(value.trim()).slice(0, MAX_TEXT) : void 0, "clean");
|
|
58
|
+
var parseDescribe = /* @__PURE__ */ __name((text) => {
|
|
59
|
+
let answer;
|
|
60
|
+
try {
|
|
61
|
+
answer = JSON.parse(text);
|
|
62
|
+
} catch {
|
|
63
|
+
return void 0;
|
|
64
|
+
}
|
|
65
|
+
if (typeof answer !== "object" || answer === null || !("wcat_describe" in answer))
|
|
66
|
+
return void 0;
|
|
67
|
+
const { version, description, docs_url: docs, manifest_sha256: sha } = answer;
|
|
68
|
+
const url = clean(docs);
|
|
69
|
+
return {
|
|
70
|
+
version: clean(version) ?? "",
|
|
71
|
+
description: clean(description) ?? "",
|
|
72
|
+
...url && /^https?:\/\//.test(url) ? { docs: url } : {},
|
|
73
|
+
...typeof sha === "string" && /^[0-9a-f]{64}$/.test(sha) ? { manifestSha256: sha } : {}
|
|
74
|
+
};
|
|
75
|
+
}, "parseDescribe");
|
|
76
|
+
|
|
77
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/shim.js
|
|
78
|
+
import { lstatSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
79
|
+
import { join } from "node:path";
|
|
80
|
+
var SHIM_FORMAT = 2;
|
|
81
|
+
var MARK = /^(?:#|REM) wirecat-shim (\d+) (launcher|shortcut) (\S+)\r?$/m;
|
|
82
|
+
var NOTE = {
|
|
83
|
+
launcher: "Written by @wirecat/cli-base. Any WireCat tool rewrites it when it breaks; it is safe to delete.",
|
|
84
|
+
shortcut: "Made by `wcat shortcuts add`; `wcat shortcuts remove` takes it out."
|
|
85
|
+
};
|
|
86
|
+
var shellQuote = /* @__PURE__ */ __name((text) => `'${text.replaceAll("'", `'\\''`)}'`, "shellQuote");
|
|
87
|
+
var launcherBody = /* @__PURE__ */ __name((dir, target, name) => [
|
|
88
|
+
'ok() { [ -f "$1" ] && [ -x "$1" ]; }',
|
|
89
|
+
`dir=${shellQuote(dir)}`,
|
|
90
|
+
`target=${shellQuote(join(dir, target))}`,
|
|
91
|
+
'if ! ok "$target"; then',
|
|
92
|
+
' for t in "$dir"/wcat-*; do',
|
|
93
|
+
' if ok "$t"; then target=$t; break; fi',
|
|
94
|
+
" done",
|
|
95
|
+
"fi",
|
|
96
|
+
`if ok "$target"; then exec "$target" ${DISPATCH_FLAG} "$@"; fi`,
|
|
97
|
+
'if [ -z "$WIRECAT_LAUNCHER_SKIP" ]; then',
|
|
98
|
+
" WIRECAT_LAUNCHER_SKIP=1; export WIRECAT_LAUNCHER_SKIP",
|
|
99
|
+
" set -f; oldifs=$IFS; IFS=:",
|
|
100
|
+
" for d in $PATH; do",
|
|
101
|
+
` if [ -n "$d" ] && [ "$d" != "$dir" ] && ok "$d/${name}"; then IFS=$oldifs; exec "$d/${name}" "$@"; fi`,
|
|
102
|
+
" done",
|
|
103
|
+
" IFS=$oldifs; set +f",
|
|
104
|
+
"fi",
|
|
105
|
+
`printf '%s\\n' "${name}: $target is missing and no other ${name}-* program was found in $dir or on PATH." \\`,
|
|
106
|
+
` "This launcher is safe to delete: $dir/${name}" >&2`,
|
|
107
|
+
"exit 127"
|
|
108
|
+
], "launcherBody");
|
|
109
|
+
var shimFiles = /* @__PURE__ */ __name((kind, { dir, name, target, platform }) => {
|
|
110
|
+
const mark = `wirecat-shim ${SHIM_FORMAT} ${kind} ${target}`;
|
|
111
|
+
const extra = kind === "launcher" ? ` ${DISPATCH_FLAG}` : "";
|
|
112
|
+
if (platform !== "win32")
|
|
113
|
+
return [
|
|
114
|
+
{
|
|
115
|
+
path: join(dir, name),
|
|
116
|
+
text: [
|
|
117
|
+
"#!/bin/sh",
|
|
118
|
+
`# ${mark}`,
|
|
119
|
+
`# ${NOTE[kind]}`,
|
|
120
|
+
...kind === "launcher" ? launcherBody(dir, target, name) : [`exec ${shellQuote(join(dir, target))} "$@"`],
|
|
121
|
+
""
|
|
122
|
+
].join("\n")
|
|
123
|
+
}
|
|
124
|
+
];
|
|
125
|
+
return [
|
|
126
|
+
{
|
|
127
|
+
path: join(dir, `${name}.cmd`),
|
|
128
|
+
text: ["@ECHO off", `REM ${mark}`, `REM ${NOTE[kind]}`, `"%~dp0${target}"${extra} %*`, ""].join("\r\n")
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
path: join(dir, `${name}.ps1`),
|
|
132
|
+
text: [
|
|
133
|
+
`# ${mark}`,
|
|
134
|
+
`# ${NOTE[kind]}`,
|
|
135
|
+
// PowerShell hands a .cmd its arguments unquoted, so `a&b` would run `b`; npm and pnpm write a .ps1 beside
|
|
136
|
+
// their .cmd, and it is started instead whenever it is there.
|
|
137
|
+
`$stem = Join-Path $PSScriptRoot "${target.replace(/\.(cmd|exe|bat)$/i, "")}"`,
|
|
138
|
+
`$target = if (Test-Path -LiteralPath "$stem.ps1") { "$stem.ps1" } else { Join-Path $PSScriptRoot "${target}" }`,
|
|
139
|
+
"if ($MyInvocation.ExpectingInput) {",
|
|
140
|
+
` $input | & $target${extra} @args`,
|
|
141
|
+
"} else {",
|
|
142
|
+
` & $target${extra} @args`,
|
|
143
|
+
"}",
|
|
144
|
+
"exit $LASTEXITCODE",
|
|
145
|
+
""
|
|
146
|
+
].join("\r\n")
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
}, "shimFiles");
|
|
150
|
+
var parseShim = /* @__PURE__ */ __name((text) => {
|
|
151
|
+
const found = MARK.exec(text.split("\n", 3).join("\n"));
|
|
152
|
+
if (!found)
|
|
153
|
+
return void 0;
|
|
154
|
+
return { format: Number(found[1]), kind: found[2], target: found[3] };
|
|
155
|
+
}, "parseShim");
|
|
156
|
+
var MAX_SHIM_BYTES = 4096;
|
|
157
|
+
var fileState = /* @__PURE__ */ __name((path) => {
|
|
158
|
+
let stat;
|
|
159
|
+
try {
|
|
160
|
+
stat = lstatSync(path);
|
|
161
|
+
} catch (error) {
|
|
162
|
+
return error.code === "ENOENT" ? { state: "missing" } : { state: "foreign" };
|
|
163
|
+
}
|
|
164
|
+
if (!stat.isFile() || stat.size > MAX_SHIM_BYTES)
|
|
165
|
+
return { state: "foreign" };
|
|
166
|
+
try {
|
|
167
|
+
const text = readFileSync(path, "utf8");
|
|
168
|
+
const mark = parseShim(text);
|
|
169
|
+
return mark ? { state: "ours", mark, text } : { state: "foreign" };
|
|
170
|
+
} catch {
|
|
171
|
+
return { state: "foreign" };
|
|
172
|
+
}
|
|
173
|
+
}, "fileState");
|
|
174
|
+
var exists = /* @__PURE__ */ __name((path) => {
|
|
175
|
+
try {
|
|
176
|
+
return statSync(path).isFile();
|
|
177
|
+
} catch {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}, "exists");
|
|
181
|
+
var writeShim = /* @__PURE__ */ __name(({ path, text }) => {
|
|
182
|
+
const temporary = `${path}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
183
|
+
try {
|
|
184
|
+
writeFileSync(temporary, text, { mode: 493 });
|
|
185
|
+
renameSync(temporary, path);
|
|
186
|
+
} finally {
|
|
187
|
+
rmSync(temporary, { force: true });
|
|
188
|
+
}
|
|
189
|
+
}, "writeShim");
|
|
190
|
+
|
|
191
|
+
export {
|
|
192
|
+
FIRST_PARTY_TOOLS,
|
|
193
|
+
BUILT_IN_COMMANDS,
|
|
194
|
+
TOOL_NAME,
|
|
195
|
+
PROGRAM_PREFIX,
|
|
196
|
+
DESCRIBE_FLAG,
|
|
197
|
+
DESCRIBE_MAX_BYTES,
|
|
198
|
+
DISPATCH_FLAG,
|
|
199
|
+
describeAnswer,
|
|
200
|
+
parseDescribe,
|
|
201
|
+
SHIM_FORMAT,
|
|
202
|
+
shimFiles,
|
|
203
|
+
fileState,
|
|
204
|
+
exists,
|
|
205
|
+
writeShim
|
|
206
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError
|
|
5
|
+
} from "./chunk-DB2XKHI4.js";
|
|
6
|
+
import {
|
|
7
|
+
__name
|
|
8
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
9
|
+
|
|
10
|
+
// 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/cli/input-policy.js
|
|
11
|
+
var MAX_BUFFERED_INPUT = 16 * 1024 * 1024;
|
|
12
|
+
var MAX_SECRET_INPUT = 64 * 1024;
|
|
13
|
+
var policies = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
var inputPolicy = /* @__PURE__ */ __name((input) => policies.get(input) ?? {}, "inputPolicy");
|
|
15
|
+
var provideInputPolicy = /* @__PURE__ */ __name((input, policy) => {
|
|
16
|
+
const previous = policies.get(input);
|
|
17
|
+
policies.set(input, policy);
|
|
18
|
+
return () => {
|
|
19
|
+
if (previous)
|
|
20
|
+
policies.set(input, previous);
|
|
21
|
+
else
|
|
22
|
+
policies.delete(input);
|
|
23
|
+
};
|
|
24
|
+
}, "provideInputPolicy");
|
|
25
|
+
var bufferedInput = /* @__PURE__ */ __name((input, options = {}) => {
|
|
26
|
+
const policy = inputPolicy(input);
|
|
27
|
+
const maxBytes = options.maxBytes ?? policy.maxBytes ?? MAX_BUFFERED_INPUT;
|
|
28
|
+
const signals = [options.signal, policy.signal].filter((one) => one !== void 0);
|
|
29
|
+
const signal = signals.length ? AbortSignal.any(signals) : void 0;
|
|
30
|
+
const state = input;
|
|
31
|
+
if (state.readableEnded)
|
|
32
|
+
return Promise.resolve(Buffer.alloc(0));
|
|
33
|
+
if (state.destroyed)
|
|
34
|
+
return Promise.reject(new CliError("validation_error", "input closed before EOF", { reason: "input.closed" }));
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
const chunks = [];
|
|
37
|
+
let bytes = 0;
|
|
38
|
+
const cleanup = /* @__PURE__ */ __name(() => {
|
|
39
|
+
input.off("data", data).off("end", end).off("error", error).off("close", closed);
|
|
40
|
+
signal?.removeEventListener("abort", aborted);
|
|
41
|
+
input.pause();
|
|
42
|
+
}, "cleanup");
|
|
43
|
+
const error = /* @__PURE__ */ __name((cause) => {
|
|
44
|
+
cleanup();
|
|
45
|
+
reject(cause);
|
|
46
|
+
}, "error");
|
|
47
|
+
const aborted = /* @__PURE__ */ __name(() => error(new CliError("cancelled", "input cancelled", { retryable: false })), "aborted");
|
|
48
|
+
const closed = /* @__PURE__ */ __name(() => error(new CliError("validation_error", "input closed before EOF", { reason: "input.closed" })), "closed");
|
|
49
|
+
const end = /* @__PURE__ */ __name(() => {
|
|
50
|
+
cleanup();
|
|
51
|
+
resolve(Buffer.concat(chunks, bytes));
|
|
52
|
+
}, "end");
|
|
53
|
+
const data = /* @__PURE__ */ __name((chunk) => {
|
|
54
|
+
const buffer = Buffer.from(chunk);
|
|
55
|
+
bytes += buffer.length;
|
|
56
|
+
if (bytes > maxBytes) {
|
|
57
|
+
error(new CliError("validation_error", `buffered input exceeds ${maxBytes} bytes \u2014 use a smaller input or --max-input-bytes`, {
|
|
58
|
+
reason: "input.too-large",
|
|
59
|
+
max_bytes: maxBytes,
|
|
60
|
+
retryable: false
|
|
61
|
+
}));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
chunks.push(buffer);
|
|
65
|
+
}, "data");
|
|
66
|
+
if (signal?.aborted) {
|
|
67
|
+
aborted();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
input.on("data", data).once("end", end).once("error", error).once("close", closed);
|
|
71
|
+
signal?.addEventListener("abort", aborted, { once: true });
|
|
72
|
+
input.resume();
|
|
73
|
+
});
|
|
74
|
+
}, "bufferedInput");
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
MAX_BUFFERED_INPUT,
|
|
78
|
+
MAX_SECRET_INPUT,
|
|
79
|
+
inputPolicy,
|
|
80
|
+
provideInputPolicy,
|
|
81
|
+
bufferedInput
|
|
82
|
+
};
|