@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,561 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
UNTRUSTED,
|
|
5
|
+
UNTRUSTED_NEUTRAL,
|
|
6
|
+
agentArguments,
|
|
7
|
+
agentJson
|
|
8
|
+
} from "./chunk-AVUMH42T.js";
|
|
9
|
+
import {
|
|
10
|
+
onlineDeps,
|
|
11
|
+
refuseLacking,
|
|
12
|
+
servicesFor,
|
|
13
|
+
storeModeDeps
|
|
14
|
+
} from "./chunk-JG7YMHNB.js";
|
|
15
|
+
import {
|
|
16
|
+
callerOf
|
|
17
|
+
} from "./chunk-7VHBS5BJ.js";
|
|
18
|
+
import {
|
|
19
|
+
DEFAULT_OUTPUT_BYTES,
|
|
20
|
+
ENTITIES,
|
|
21
|
+
LOCAL_WRITE,
|
|
22
|
+
REMOTE_WRITE,
|
|
23
|
+
answerSchema,
|
|
24
|
+
judgedAnswer,
|
|
25
|
+
judgedEffects,
|
|
26
|
+
listOf,
|
|
27
|
+
refuseStoreChange,
|
|
28
|
+
sealed,
|
|
29
|
+
startRecording
|
|
30
|
+
} from "./chunk-PHXOL5HZ.js";
|
|
31
|
+
import {
|
|
32
|
+
currentCaller,
|
|
33
|
+
keepsSuccess,
|
|
34
|
+
runContextOf,
|
|
35
|
+
withCaller
|
|
36
|
+
} from "./chunk-FIVD4HM4.js";
|
|
37
|
+
import {
|
|
38
|
+
inRun,
|
|
39
|
+
newRunId
|
|
40
|
+
} from "./chunk-IBTMK5KD.js";
|
|
41
|
+
import {
|
|
42
|
+
storeDamaged
|
|
43
|
+
} from "./chunk-DW23LM47.js";
|
|
44
|
+
import {
|
|
45
|
+
failureContext
|
|
46
|
+
} from "./chunk-WGBVRDY3.js";
|
|
47
|
+
import {
|
|
48
|
+
fetchesAt,
|
|
49
|
+
keyForCommand,
|
|
50
|
+
levelFor,
|
|
51
|
+
readKeysForCommand
|
|
52
|
+
} from "./chunk-3TEFE6YU.js";
|
|
53
|
+
import {
|
|
54
|
+
MAX_BUFFERED_INPUT
|
|
55
|
+
} from "./chunk-KVXEEKBB.js";
|
|
56
|
+
import {
|
|
57
|
+
traceIdOf
|
|
58
|
+
} from "./chunk-X5S5KUSU.js";
|
|
59
|
+
import {
|
|
60
|
+
errorObjectOf,
|
|
61
|
+
itemEnvelopeSchema,
|
|
62
|
+
listEnvelopeSchema,
|
|
63
|
+
mcpErrorResult,
|
|
64
|
+
toJsonSchema,
|
|
65
|
+
toStandardJsonSchema
|
|
66
|
+
} from "./chunk-J5P5VSRG.js";
|
|
67
|
+
import {
|
|
68
|
+
array,
|
|
69
|
+
boolean,
|
|
70
|
+
description,
|
|
71
|
+
integer,
|
|
72
|
+
looseObject,
|
|
73
|
+
maxLength,
|
|
74
|
+
maxValue,
|
|
75
|
+
minLength,
|
|
76
|
+
minValue,
|
|
77
|
+
number,
|
|
78
|
+
optional,
|
|
79
|
+
pipe,
|
|
80
|
+
record,
|
|
81
|
+
regex,
|
|
82
|
+
safeParse,
|
|
83
|
+
strictObject,
|
|
84
|
+
string,
|
|
85
|
+
summarize,
|
|
86
|
+
unknown
|
|
87
|
+
} from "./chunk-S4UUN6LD.js";
|
|
88
|
+
import {
|
|
89
|
+
CliError,
|
|
90
|
+
errorCodes
|
|
91
|
+
} from "./chunk-BUGROVF3.js";
|
|
92
|
+
import {
|
|
93
|
+
__name
|
|
94
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
95
|
+
|
|
96
|
+
// 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/surface.js
|
|
97
|
+
import { randomUUID } from "node:crypto";
|
|
98
|
+
|
|
99
|
+
// 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/tool.js
|
|
100
|
+
var limit = optional(pipe(number(), integer(), minValue(1), maxValue(100), description("how many")));
|
|
101
|
+
var page = optional(pipe(number(), integer(), minValue(1), description("which page, from 1")));
|
|
102
|
+
var message = pipe(
|
|
103
|
+
string(),
|
|
104
|
+
maxLength(256),
|
|
105
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point
|
|
106
|
+
regex(/^[^\s\x00-\x1F\x7F-\x9F]+$/, "a message id has no spaces or control characters"),
|
|
107
|
+
description("message id")
|
|
108
|
+
);
|
|
109
|
+
var READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
|
|
110
|
+
var WRITE = {
|
|
111
|
+
readOnlyHint: false,
|
|
112
|
+
destructiveHint: true,
|
|
113
|
+
idempotentHint: false,
|
|
114
|
+
openWorldHint: true
|
|
115
|
+
};
|
|
116
|
+
var tool = /* @__PURE__ */ __name((definition) => definition, "tool");
|
|
117
|
+
var chatOf = /* @__PURE__ */ __name((messenger) => pipe(string(), minLength(1), description(messenger.chatArgument)), "chatOf");
|
|
118
|
+
var tierOf = /* @__PURE__ */ __name((key, definition, messenger) => {
|
|
119
|
+
if (definition.annotations.readOnlyHint === true)
|
|
120
|
+
return "read";
|
|
121
|
+
if (/^admin|_admin/.test(key))
|
|
122
|
+
return "admin";
|
|
123
|
+
if (/delete|ban|kick|remove|purge|block/.test(key))
|
|
124
|
+
return "destructive";
|
|
125
|
+
if (/draft/.test(key))
|
|
126
|
+
return "draft";
|
|
127
|
+
if (key === "messages_pin" && messenger?.quietPins === false)
|
|
128
|
+
return "write-public";
|
|
129
|
+
if (/mark_read|mark_unread|read_mark|archive|mute|pin|tag|note|label|folder|alias|save|_(un)?star$/.test(key))
|
|
130
|
+
return "write-private";
|
|
131
|
+
return "write-public";
|
|
132
|
+
}, "tierOf");
|
|
133
|
+
var effectsOf = /* @__PURE__ */ __name((definition) => {
|
|
134
|
+
if (definition.effects)
|
|
135
|
+
return definition.effects;
|
|
136
|
+
const { readOnlyHint, openWorldHint } = definition.annotations;
|
|
137
|
+
if (readOnlyHint === true)
|
|
138
|
+
return { remote: openWorldHint === false ? "none" : "read", local: "read" };
|
|
139
|
+
return openWorldHint === false ? LOCAL_WRITE : REMOTE_WRITE;
|
|
140
|
+
}, "effectsOf");
|
|
141
|
+
var outcomeOf = /* @__PURE__ */ __name((result) => {
|
|
142
|
+
if (!result.isError)
|
|
143
|
+
return { status: "ok" };
|
|
144
|
+
const code = result.structuredContent?.error?.code;
|
|
145
|
+
const error = typeof code === "string" ? code : "generic_failure";
|
|
146
|
+
return { status: error === "permission_error" ? "refused" : "failed", error };
|
|
147
|
+
}, "outcomeOf");
|
|
148
|
+
var commandOf = /* @__PURE__ */ __name((name, definition) => definition.command ?? name.replaceAll("_", " "), "commandOf");
|
|
149
|
+
var toolKey = /* @__PURE__ */ __name((name, definition) => definition.key !== void 0 ? definition.key : keyForCommand(commandOf(name, definition).split(" ")), "toolKey");
|
|
150
|
+
var inputOf = /* @__PURE__ */ __name((definition, syncAllowed) => strictObject(syncAllowed || !("sync_first" in definition.input.entries) ? definition.input.entries : Object.fromEntries(Object.entries(definition.input.entries).filter(([name]) => !["sync_first", "sync_time", "max_chats", "max_messages"].includes(name)))), "inputOf");
|
|
151
|
+
var syncAllowedFor = /* @__PURE__ */ __name((key, defaults) => {
|
|
152
|
+
const permissions = defaults.settings.permissions ?? {};
|
|
153
|
+
const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
|
|
154
|
+
return shared && (!key.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key.replaceAll("_", ".")}.sync-first`).level));
|
|
155
|
+
}, "syncAllowedFor");
|
|
156
|
+
var entryRunner = /* @__PURE__ */ __name((registration) => {
|
|
157
|
+
const run = callRunner(registration);
|
|
158
|
+
const { log } = registration;
|
|
159
|
+
return async (key, definition, args, ctx) => {
|
|
160
|
+
const startedAt = Date.now();
|
|
161
|
+
const command = `mcp ${commandOf(key, definition)}`;
|
|
162
|
+
const traceId = traceIdOf(ctx?.mcpReq?._meta?.traceparent);
|
|
163
|
+
const app = registration.messenger?.app;
|
|
164
|
+
const caller = registration.callers ? callerOf(ctx, key, registration.callers) : currentCaller();
|
|
165
|
+
const env = registration.defaults.env ?? process.env;
|
|
166
|
+
const settings = registration.defaults.settings;
|
|
167
|
+
const recording = key !== "runs_search" && settings.keepFailedRuns !== false && app?.appName ? startRecording({
|
|
168
|
+
app,
|
|
169
|
+
command,
|
|
170
|
+
...settings.profile === void 0 ? {} : { profile: settings.profile },
|
|
171
|
+
env,
|
|
172
|
+
record: keepsSuccess({ record: settings.record ?? true, fromFlag: false, env, caller }),
|
|
173
|
+
keepFailed: true,
|
|
174
|
+
trace: false,
|
|
175
|
+
format: "json",
|
|
176
|
+
context: runContextOf({ bin: app.command, command, env, caller }),
|
|
177
|
+
...settings.keepRunsForDays === void 0 ? {} : { keepDays: settings.keepRunsForDays },
|
|
178
|
+
...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
|
|
179
|
+
...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
|
|
180
|
+
...traceId === void 0 ? {} : { traceId }
|
|
181
|
+
}) : void 0;
|
|
182
|
+
const profile = registration.defaults.settings.profile;
|
|
183
|
+
const scope = {
|
|
184
|
+
runId: recording?.runId ?? newRunId(new Date(startedAt), command),
|
|
185
|
+
command,
|
|
186
|
+
startedAt,
|
|
187
|
+
...profile === void 0 ? {} : { profile },
|
|
188
|
+
...traceId === void 0 ? {} : { traceId },
|
|
189
|
+
...recording ? { events: recording.events } : {}
|
|
190
|
+
};
|
|
191
|
+
const work = /* @__PURE__ */ __name(() => inRun(scope, () => {
|
|
192
|
+
const input = inputOf(definition, syncAllowedFor(key, registration.defaults));
|
|
193
|
+
const parsed = safeParse(input, args);
|
|
194
|
+
return parsed.success ? run(key, definition, parsed.output, ctx) : failed(new CliError("validation_error", `${commandOf(key, definition)}: ${summarize(parsed.issues)}`, {
|
|
195
|
+
arguments: toJsonSchema(input)
|
|
196
|
+
}), app?.errors);
|
|
197
|
+
}), "work");
|
|
198
|
+
const result = await (caller ? withCaller(caller, work) : work());
|
|
199
|
+
if (recording) {
|
|
200
|
+
if (result.isError) {
|
|
201
|
+
const error = result.structuredContent?.error;
|
|
202
|
+
const code = error?.code && errorCodes.includes(error.code) ? error.code : void 0;
|
|
203
|
+
await recording.fail(code ? new CliError(code, "MCP operation failed") : new Error("MCP operation failed")).catch(() => void 0);
|
|
204
|
+
} else
|
|
205
|
+
await recording.succeed(result.structuredContent).catch(() => void 0);
|
|
206
|
+
}
|
|
207
|
+
await log?.({
|
|
208
|
+
tool: key,
|
|
209
|
+
tier: tierOf(key, definition, registration.messenger),
|
|
210
|
+
...outcomeOf(result),
|
|
211
|
+
startedAt,
|
|
212
|
+
finishedAt: Date.now()
|
|
213
|
+
}, caller)?.catch(() => void 0);
|
|
214
|
+
return result;
|
|
215
|
+
};
|
|
216
|
+
}, "entryRunner");
|
|
217
|
+
var callRunner = /* @__PURE__ */ __name(({ messenger, session, withStore, withServices, defaults, around, targets }) => {
|
|
218
|
+
const where = {
|
|
219
|
+
profile: defaults.settings.profile,
|
|
220
|
+
env: defaults.env,
|
|
221
|
+
pictures: defaults.settings.pictureSearch,
|
|
222
|
+
reranker: defaults.settings.searchReranker
|
|
223
|
+
};
|
|
224
|
+
return async (key, definition, args, ctx) => {
|
|
225
|
+
const path = commandOf(key, definition).split(" ");
|
|
226
|
+
const run = `mcp ${path.join(" ")}`;
|
|
227
|
+
try {
|
|
228
|
+
const execute = /* @__PURE__ */ __name(async () => {
|
|
229
|
+
const syncAllowed = syncAllowedFor(key, defaults);
|
|
230
|
+
if (Buffer.byteLength(JSON.stringify(args)) > MAX_BUFFERED_INPUT)
|
|
231
|
+
throw new CliError("validation_error", "tool arguments exceed the buffered input limit", {
|
|
232
|
+
reason: "input.too-large",
|
|
233
|
+
max_bytes: MAX_BUFFERED_INPUT,
|
|
234
|
+
retryable: false
|
|
235
|
+
});
|
|
236
|
+
definition.check?.(args);
|
|
237
|
+
if (definition.changesStore)
|
|
238
|
+
refuseStoreChange(messenger.app, defaults.env);
|
|
239
|
+
refuseLacking(messenger, path);
|
|
240
|
+
for (const permission of readKeysForCommand(path)) {
|
|
241
|
+
if (levelFor(defaults.settings.permissions ?? {}, permission).level === "deny")
|
|
242
|
+
throw new CliError("permission_error", `profile denies ${permission}`, { permission });
|
|
243
|
+
}
|
|
244
|
+
if (args.sync_first && !syncAllowed)
|
|
245
|
+
throw new CliError("permission_error", "messages.sync-first is not allowed by this profile");
|
|
246
|
+
if (definition.custom) {
|
|
247
|
+
const result2 = await definition.custom(args, { ...defaults, signal: ctx.mcpReq.signal }, ctx);
|
|
248
|
+
return answered(result2, definition.outputLimit?.(args, defaults), targets);
|
|
249
|
+
}
|
|
250
|
+
if (definition.local)
|
|
251
|
+
return answered(await definition.local(args, defaults), definition.outputLimit?.(args, defaults), targets);
|
|
252
|
+
const { online, stored: local, served } = definition;
|
|
253
|
+
const stored = local && (!definition.storedWhen || definition.storedWhen(args)) ? local : void 0;
|
|
254
|
+
const result = stored ? await withStore((store, account) => stored(store, account, args, { ...defaults, signal: ctx.mcpReq.signal }, (work) => session.use(run, work)), {
|
|
255
|
+
name: run
|
|
256
|
+
}) : served && withServices ? await withServices((services, connect) => served(services, args, defaults, connect), { name: run }) : served && messenger.history === "store" ? await withStore((store, account) => served(servicesFor({
|
|
257
|
+
...storeModeDeps(messenger, store, account, defaults.guard),
|
|
258
|
+
...where,
|
|
259
|
+
embedders: defaults.embedders
|
|
260
|
+
}), args, defaults, (work) => session.use(run, async (adapter, release) => {
|
|
261
|
+
try {
|
|
262
|
+
return await work(adapter);
|
|
263
|
+
} finally {
|
|
264
|
+
await release();
|
|
265
|
+
}
|
|
266
|
+
})), { name: run }) : served ? await session.use(run, (adapter, release) => served(servicesFor(onlineDeps(messenger, adapter, defaults.guard, where)), args, defaults, (work) => (async () => {
|
|
267
|
+
try {
|
|
268
|
+
return await work(adapter);
|
|
269
|
+
} finally {
|
|
270
|
+
await release();
|
|
271
|
+
}
|
|
272
|
+
})())) : await session.use(run, (adapter, release) => online(adapter, args, { ...defaults, release }));
|
|
273
|
+
return answered(result, definition.outputLimit?.(args, defaults), targets);
|
|
274
|
+
}, "execute");
|
|
275
|
+
return around ? await around(key, definition, execute) : await execute();
|
|
276
|
+
} catch (error) {
|
|
277
|
+
return failed(error, messenger?.app?.errors, effectsOf(definition));
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}, "callRunner");
|
|
281
|
+
var outputSchemaOf = /* @__PURE__ */ __name((definition) => {
|
|
282
|
+
if (!definition.output)
|
|
283
|
+
return looseObject({});
|
|
284
|
+
const entity = ENTITIES[definition.output.entity];
|
|
285
|
+
return definition.output.list ? listEnvelopeSchema(entity) : itemEnvelopeSchema(entity);
|
|
286
|
+
}, "outputSchemaOf");
|
|
287
|
+
var Picture = class {
|
|
288
|
+
static {
|
|
289
|
+
__name(this, "Picture");
|
|
290
|
+
}
|
|
291
|
+
bytes;
|
|
292
|
+
mimeType;
|
|
293
|
+
about;
|
|
294
|
+
constructor(bytes, mimeType, about) {
|
|
295
|
+
this.bytes = bytes;
|
|
296
|
+
this.mimeType = mimeType;
|
|
297
|
+
this.about = about;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
var BinaryResource = class {
|
|
301
|
+
static {
|
|
302
|
+
__name(this, "BinaryResource");
|
|
303
|
+
}
|
|
304
|
+
base64;
|
|
305
|
+
mimeType;
|
|
306
|
+
uri;
|
|
307
|
+
about;
|
|
308
|
+
constructor(base64, mimeType, uri, about) {
|
|
309
|
+
this.base64 = base64;
|
|
310
|
+
this.mimeType = mimeType;
|
|
311
|
+
this.uri = uri;
|
|
312
|
+
this.about = about;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
var answered = /* @__PURE__ */ __name((answer, maxBytes = DEFAULT_OUTPUT_BYTES, targets) => {
|
|
316
|
+
const bounded = /* @__PURE__ */ __name((result) => {
|
|
317
|
+
if (maxBytes !== 0 && Buffer.byteLength(JSON.stringify(result.content)) > maxBytes)
|
|
318
|
+
throw new CliError("invalid_response", "tool output exceeds its byte limit \u2014 reduce limit or use a narrower request", { reason: "output.too-large", max_bytes: maxBytes, retryable: false });
|
|
319
|
+
return result;
|
|
320
|
+
}, "bounded");
|
|
321
|
+
if (answer === null || Array.isArray(answer) || typeof answer !== "object")
|
|
322
|
+
throw new CliError("invalid_response", "tool result must be an object", { retryable: false });
|
|
323
|
+
const objectBody = /* @__PURE__ */ __name((value) => {
|
|
324
|
+
const serialized = JSON.parse(agentJson(value));
|
|
325
|
+
if (serialized === null || Array.isArray(serialized) || typeof serialized !== "object")
|
|
326
|
+
throw new CliError("invalid_response", "serialized tool result must be an object", { retryable: false });
|
|
327
|
+
return serialized;
|
|
328
|
+
}, "objectBody");
|
|
329
|
+
if (answer instanceof BinaryResource) {
|
|
330
|
+
const about = sealed(answer.about);
|
|
331
|
+
return bounded({
|
|
332
|
+
structuredContent: objectBody(about),
|
|
333
|
+
content: [
|
|
334
|
+
{ type: "resource", resource: { uri: answer.uri, mimeType: answer.mimeType, blob: answer.base64 } },
|
|
335
|
+
{ type: "text", text: agentJson(about) }
|
|
336
|
+
]
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
if (answer instanceof Picture) {
|
|
340
|
+
const about = sealed(answer.about);
|
|
341
|
+
return bounded({
|
|
342
|
+
structuredContent: objectBody(about),
|
|
343
|
+
content: [
|
|
344
|
+
{ type: "image", data: Buffer.from(answer.bytes).toString("base64"), mimeType: answer.mimeType },
|
|
345
|
+
{ type: "text", text: agentJson(about) }
|
|
346
|
+
]
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
const body = objectBody(sealed(targets ? judgedAnswer(answer, targets) : answer));
|
|
350
|
+
return bounded({ content: [{ type: "text", text: JSON.stringify(body) }], structuredContent: body });
|
|
351
|
+
}, "answered");
|
|
352
|
+
var failed = /* @__PURE__ */ __name((error, errors, effects) => {
|
|
353
|
+
const judged = judgedEffects(effects);
|
|
354
|
+
const context = { ...failureContext(errors), ...judged ? { effects: judged } : {} };
|
|
355
|
+
return mcpErrorResult(JSON.parse(agentJson(errorObjectOf(storeDamaged(error), context))));
|
|
356
|
+
}, "failed");
|
|
357
|
+
|
|
358
|
+
// 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/surface.js
|
|
359
|
+
var MATCHES = 8;
|
|
360
|
+
var ANSWER = answerSchema();
|
|
361
|
+
var agentAnswer = /* @__PURE__ */ __name((prefix, writes) => {
|
|
362
|
+
const meta = pipe(looseObject({}), description(`run facts; ${prefix}_tools_search shows the full answer`));
|
|
363
|
+
const next = optional(pipe(array(looseObject({})), description("steps to run next: command and args")));
|
|
364
|
+
return looseObject(writes ? { item: optional(unknown()), next, meta } : {
|
|
365
|
+
items: optional(array(unknown())),
|
|
366
|
+
item: optional(unknown()),
|
|
367
|
+
page: optional(looseObject({ has_more: boolean() })),
|
|
368
|
+
next,
|
|
369
|
+
missing: optional(array(looseObject({ field: string(), why: string() }))),
|
|
370
|
+
meta
|
|
371
|
+
});
|
|
372
|
+
}, "agentAnswer");
|
|
373
|
+
var listedAs = /* @__PURE__ */ __name((prefix, writes) => {
|
|
374
|
+
const checked = toStandardJsonSchema(ANSWER);
|
|
375
|
+
const shown = toStandardJsonSchema(agentAnswer(prefix, writes))["~standard"].jsonSchema;
|
|
376
|
+
return { "~standard": { ...checked["~standard"], jsonSchema: shown } };
|
|
377
|
+
}, "listedAs");
|
|
378
|
+
var normal = /* @__PURE__ */ __name((command) => command.trim().toLowerCase().split(/[\s_-]+/).join(" "), "normal");
|
|
379
|
+
var STOP_WORDS = new Set("a an the to of in on at by for from with into out about and or but is are be been was were it its this that these those which who whom whose what when where how do does did can could should would will my our your their his her them they we you i one some any all each every another other".split(" "));
|
|
380
|
+
var wordsOf = /* @__PURE__ */ __name((text) => text.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean), "wordsOf");
|
|
381
|
+
var stem = /* @__PURE__ */ __name((word) => {
|
|
382
|
+
const bare = word.replace(/'s$/u, "");
|
|
383
|
+
if (bare.length > 4 && bare.endsWith("ies"))
|
|
384
|
+
return `${bare.slice(0, -3)}y`;
|
|
385
|
+
for (const ending of ["ing", "ed", "es", "s"])
|
|
386
|
+
if (bare.length - ending.length >= 3 && bare.endsWith(ending))
|
|
387
|
+
return bare.slice(0, -ending.length);
|
|
388
|
+
return bare;
|
|
389
|
+
}, "stem");
|
|
390
|
+
var sameWord = /* @__PURE__ */ __name((asked, known) => {
|
|
391
|
+
if (asked === known)
|
|
392
|
+
return true;
|
|
393
|
+
const [short, long] = asked.length <= known.length ? [asked, known] : [known, asked];
|
|
394
|
+
return short.length >= 3 && long.startsWith(short);
|
|
395
|
+
}, "sameWord");
|
|
396
|
+
var fieldsOf = /* @__PURE__ */ __name((command, one) => [
|
|
397
|
+
[4, [...wordsOf(command), ...(one.aliases ?? []).flatMap(wordsOf)]],
|
|
398
|
+
[2, wordsOf(one.title)],
|
|
399
|
+
[1, [...wordsOf(one.description), ...(one.keywords ?? []).flatMap(wordsOf), ...Object.keys(one.input.entries)]]
|
|
400
|
+
].map(([weight, words]) => [weight, [...new Set(words.map(stem))]]), "fieldsOf");
|
|
401
|
+
var search = /* @__PURE__ */ __name((commands, query) => {
|
|
402
|
+
const named = normal(query);
|
|
403
|
+
const all = Object.entries(commands);
|
|
404
|
+
if (!named)
|
|
405
|
+
return all.map((entry) => entry).sort((a, b) => a[0].localeCompare(b[0]));
|
|
406
|
+
const words = [
|
|
407
|
+
...new Set(wordsOf(query).filter((word) => word.length > 1 && !STOP_WORDS.has(word)).map(stem))
|
|
408
|
+
];
|
|
409
|
+
return all.map((entry) => {
|
|
410
|
+
const fields = fieldsOf(entry[0], entry[1]);
|
|
411
|
+
const weights = words.map((word) => fields.reduce((best, [weight, known]) => known.some((one) => sameWord(word, one)) ? Math.max(best, weight) : best, 0));
|
|
412
|
+
const matched = weights.filter((weight) => weight > 0).length;
|
|
413
|
+
const exact = normal(entry[0]) === named || (entry[1].aliases ?? []).some((alias) => normal(alias) === named);
|
|
414
|
+
return { entry, matched, rank: (exact ? 1e3 : 0) + matched * 10 + weights.reduce((a, b) => a + b, 0) };
|
|
415
|
+
}).filter(({ matched, rank }) => matched > 0 || rank >= 1e3).sort((a, b) => b.rank - a.rank || a.entry[0].localeCompare(b.entry[0])).map(({ entry }) => entry);
|
|
416
|
+
}, "search");
|
|
417
|
+
var nearest = /* @__PURE__ */ __name((commands, asked) => {
|
|
418
|
+
const words = normal(asked).split(" ");
|
|
419
|
+
return Object.keys(commands).map((one) => ({ one, shared: words.filter((word) => normal(one).split(" ").includes(word)).length })).filter(({ shared }) => shared > 0).sort((a, b) => b.shared - a.shared).slice(0, 3).map(({ one }) => one);
|
|
420
|
+
}, "nearest");
|
|
421
|
+
var runnableOnly = /* @__PURE__ */ __name((result, offered) => {
|
|
422
|
+
const body = result.structuredContent;
|
|
423
|
+
if (result.isError || !Array.isArray(body?.next))
|
|
424
|
+
return result;
|
|
425
|
+
const next = body.next.filter((step) => step.command === void 0 || offered(step.command));
|
|
426
|
+
const { next: _, ...rest } = body;
|
|
427
|
+
const kept = next.length > 0 ? { ...rest, next } : rest;
|
|
428
|
+
return {
|
|
429
|
+
...result,
|
|
430
|
+
structuredContent: kept,
|
|
431
|
+
content: result.content.map((part) => part.type === "text" ? { ...part, text: JSON.stringify(kept) } : part)
|
|
432
|
+
};
|
|
433
|
+
}, "runnableOnly");
|
|
434
|
+
var takesNothing = /* @__PURE__ */ __name((one) => Object.values(one.input.entries).every((entry) => entry.type === "optional"), "takesNothing");
|
|
435
|
+
var sampleOf = /* @__PURE__ */ __name((commands) => {
|
|
436
|
+
const reading = Object.entries(commands).filter(([, one]) => !one.writes);
|
|
437
|
+
const bare = reading.filter(([, one]) => takesNothing(one));
|
|
438
|
+
return bare.find(([command]) => command.endsWith(" list"))?.[0] ?? bare[0]?.[0] ?? reading[0]?.[0] ?? Object.keys(commands)[0] ?? "";
|
|
439
|
+
}, "sampleOf");
|
|
440
|
+
var registerCommands = /* @__PURE__ */ __name((server, prefix, commands, errors, withheld, isMessenger) => {
|
|
441
|
+
const byNormal = new Map(Object.keys(commands).map((command) => [normal(command), command]));
|
|
442
|
+
const messenger = isMessenger ?? Object.keys(commands).some((command) => command.split(" ")[0] === "messages");
|
|
443
|
+
const tasks = messenger ? '"unread", "send message", "chat members"' : '"list", "show", "change a setting"';
|
|
444
|
+
const sample = messenger ? "messages list" : sampleOf(commands);
|
|
445
|
+
const untrusted = messenger ? UNTRUSTED : UNTRUSTED_NEUTRAL;
|
|
446
|
+
server.registerTool(`${prefix}_tools_search`, {
|
|
447
|
+
outputSchema: toStandardJsonSchema(looseObject({})),
|
|
448
|
+
title: "Find a command",
|
|
449
|
+
description: `Find the command for a task \u2014 ${tasks} \u2014 before calling ${prefix}_read or ${prefix}_write with it. Each match gives its command, whether it writes, its arguments and the shape of its answer. With no words, lists every command and title, without arguments.`,
|
|
450
|
+
inputSchema: toStandardJsonSchema(strictObject({ query: optional(pipe(string(), description("words that describe the task"))) })),
|
|
451
|
+
annotations: { ...READ, openWorldHint: false, idempotentHint: true }
|
|
452
|
+
}, async ({ query }) => {
|
|
453
|
+
const found = search(commands, query ?? "");
|
|
454
|
+
const items = query?.trim() ? found.slice(0, MATCHES).map(([command, one]) => ({
|
|
455
|
+
command,
|
|
456
|
+
title: one.title,
|
|
457
|
+
description: one.description,
|
|
458
|
+
writes: one.writes,
|
|
459
|
+
availability: one.availability?.() ?? { available: true },
|
|
460
|
+
arguments: toJsonSchema(one.input),
|
|
461
|
+
output: toJsonSchema(one.output ?? ANSWER)
|
|
462
|
+
})) : found.map(([command, one]) => ({
|
|
463
|
+
command,
|
|
464
|
+
title: one.title,
|
|
465
|
+
writes: one.writes,
|
|
466
|
+
availability: one.availability?.() ?? { available: true }
|
|
467
|
+
}));
|
|
468
|
+
const { next: _paging, ...list } = listOf(`${prefix}_tools_search`, {
|
|
469
|
+
items,
|
|
470
|
+
limit: Math.max(items.length, query?.trim() ? MATCHES : 1),
|
|
471
|
+
has_more: found.length > items.length
|
|
472
|
+
});
|
|
473
|
+
return answered(list);
|
|
474
|
+
});
|
|
475
|
+
const callers = {
|
|
476
|
+
env: process.env,
|
|
477
|
+
client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
|
|
478
|
+
connectionId: randomUUID()
|
|
479
|
+
};
|
|
480
|
+
const runner = /* @__PURE__ */ __name((writing) => async ({ command: asked, arguments: given }, ctx) => {
|
|
481
|
+
try {
|
|
482
|
+
const command = byNormal.get(normal(asked));
|
|
483
|
+
const one = command === void 0 ? void 0 : commands[command];
|
|
484
|
+
if (command === void 0 || !one) {
|
|
485
|
+
withheld?.(normal(asked));
|
|
486
|
+
const near = nearest(commands, asked);
|
|
487
|
+
throw new CliError("validation_error", `no command "${asked}" here${near.length ? ` \u2014 did you mean ${near.map((name) => `"${name}"`).join(", ")}?` : ""}; ${prefix}_tools_search finds one`);
|
|
488
|
+
}
|
|
489
|
+
if (one.writes !== writing)
|
|
490
|
+
throw new CliError("validation_error", `"${command}" ${writing ? "only reads" : "writes"}: call it with ${prefix}_${writing ? "read" : "write"}`);
|
|
491
|
+
const args = writing ? agentArguments(given ?? {}) : given ?? {};
|
|
492
|
+
const caller = currentCaller() ?? callerOf(ctx, command.replace(/[ -]/g, "_"), callers);
|
|
493
|
+
if (one.checked)
|
|
494
|
+
return runnableOnly(await withCaller(caller, () => one.run(args, ctx)), (named) => byNormal.has(normal(named)));
|
|
495
|
+
const parsed = safeParse(strictObject(one.input.entries), args);
|
|
496
|
+
if (!parsed.success)
|
|
497
|
+
throw new CliError("validation_error", `${command}: ${summarize(parsed.issues)}`, {
|
|
498
|
+
arguments: toJsonSchema(one.input)
|
|
499
|
+
});
|
|
500
|
+
return runnableOnly(await withCaller(caller, () => one.run(parsed.output, ctx)), (named) => byNormal.has(normal(named)));
|
|
501
|
+
} catch (error) {
|
|
502
|
+
return failed(error, errors);
|
|
503
|
+
}
|
|
504
|
+
}, "runner");
|
|
505
|
+
const call = strictObject({
|
|
506
|
+
command: pipe(string(), minLength(1), description(`a command ${prefix}_tools_search returned: "${sample}"`)),
|
|
507
|
+
arguments: optional(pipe(record(string(), unknown()), description("that command's arguments")))
|
|
508
|
+
});
|
|
509
|
+
server.registerTool(`${prefix}_read`, {
|
|
510
|
+
outputSchema: listedAs(prefix, false),
|
|
511
|
+
title: "Run a reading command",
|
|
512
|
+
description: `Run one command that only reads, with the arguments ${prefix}_tools_search showed. ${untrusted}`,
|
|
513
|
+
inputSchema: toStandardJsonSchema(call),
|
|
514
|
+
annotations: READ
|
|
515
|
+
}, runner(false));
|
|
516
|
+
if (Object.values(commands).some((one) => one.writes))
|
|
517
|
+
server.registerTool(`${prefix}_write`, {
|
|
518
|
+
outputSchema: listedAs(prefix, true),
|
|
519
|
+
title: "Run a writing command",
|
|
520
|
+
description: `Run one command that changes something \u2014 ${messenger ? "sends, edits, deletes, joins" : "creates, edits, deletes"} \u2014 with the arguments ${prefix}_tools_search showed. ${untrusted}`,
|
|
521
|
+
inputSchema: toStandardJsonSchema(call),
|
|
522
|
+
annotations: WRITE
|
|
523
|
+
}, runner(true));
|
|
524
|
+
}, "registerCommands");
|
|
525
|
+
var surfaceCommands = /* @__PURE__ */ __name((tools, registration) => {
|
|
526
|
+
const run = entryRunner(registration);
|
|
527
|
+
return Object.fromEntries(Object.entries(tools).map(([key, definition]) => [
|
|
528
|
+
commandOf(key, definition),
|
|
529
|
+
{
|
|
530
|
+
title: definition.title,
|
|
531
|
+
description: definition.description,
|
|
532
|
+
writes: definition.annotations.readOnlyHint !== true,
|
|
533
|
+
input: inputOf(definition, syncAllowedFor(key, registration.defaults)),
|
|
534
|
+
...definition.output ? { output: outputSchemaOf(definition) } : {},
|
|
535
|
+
checked: true,
|
|
536
|
+
run: /* @__PURE__ */ __name((args, ctx) => run(key, definition, args, ctx), "run")
|
|
537
|
+
}
|
|
538
|
+
]));
|
|
539
|
+
}, "surfaceCommands");
|
|
540
|
+
var outputOf = /* @__PURE__ */ __name(({ entity, view }) => answerSchema(ENTITIES[view ? `${entity}.${view}` : entity] ?? unknown()), "outputOf");
|
|
541
|
+
|
|
542
|
+
export {
|
|
543
|
+
message,
|
|
544
|
+
READ,
|
|
545
|
+
WRITE,
|
|
546
|
+
tool,
|
|
547
|
+
chatOf,
|
|
548
|
+
tierOf,
|
|
549
|
+
outcomeOf,
|
|
550
|
+
commandOf,
|
|
551
|
+
toolKey,
|
|
552
|
+
Picture,
|
|
553
|
+
BinaryResource,
|
|
554
|
+
answered,
|
|
555
|
+
failed,
|
|
556
|
+
normal,
|
|
557
|
+
search,
|
|
558
|
+
registerCommands,
|
|
559
|
+
surfaceCommands,
|
|
560
|
+
outputOf
|
|
561
|
+
};
|
|
@@ -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/executable.js
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import { win32 } from "node:path";
|
|
10
10
|
var variable = /* @__PURE__ */ __name((env, name) => Object.entries(env).find(([key]) => key.toUpperCase() === name)?.[1], "variable");
|
|
@@ -2,16 +2,16 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
alive
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IXZLMFPO.js";
|
|
6
6
|
import {
|
|
7
7
|
resolvePaths,
|
|
8
8
|
writeSecurely
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-X5S5KUSU.js";
|
|
10
10
|
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/background/lock.js
|
|
15
15
|
import { existsSync, linkSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
16
16
|
import { dirname, join } from "node:path";
|
|
17
17
|
var lockPath = /* @__PURE__ */ __name((app, profile, env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "serve", `${profile}.lock`), "lockPath");
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
SERVICE
|
|
5
|
+
} from "./chunk-CYADK744.js";
|
|
6
|
+
import {
|
|
7
|
+
integer,
|
|
8
|
+
maxLength,
|
|
9
|
+
minValue,
|
|
10
|
+
number,
|
|
11
|
+
object,
|
|
12
|
+
optional,
|
|
13
|
+
pipe,
|
|
14
|
+
regex,
|
|
15
|
+
safeParse,
|
|
16
|
+
string
|
|
17
|
+
} from "./chunk-S4UUN6LD.js";
|
|
18
|
+
import {
|
|
19
|
+
CliError
|
|
20
|
+
} from "./chunk-BUGROVF3.js";
|
|
21
|
+
import {
|
|
22
|
+
__name
|
|
23
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
24
|
+
|
|
25
|
+
// dist/hubspot/account.js
|
|
26
|
+
var DETAILS = object({
|
|
27
|
+
portalId: pipe(number(), integer(), minValue(1)),
|
|
28
|
+
uiDomain: pipe(string(), regex(/^[a-z0-9.-]{1,253}$/i)),
|
|
29
|
+
timeZone: pipe(string(), maxLength(64)),
|
|
30
|
+
accountType: pipe(string(), maxLength(64)),
|
|
31
|
+
companyCurrency: optional(string())
|
|
32
|
+
});
|
|
33
|
+
var accountDetails = /* @__PURE__ */ __name(async (hub) => {
|
|
34
|
+
const parsed = safeParse(DETAILS, await hub.get("/account-info/2026-03/details"));
|
|
35
|
+
if (!parsed.success)
|
|
36
|
+
throw new CliError("invalid_response", `${SERVICE}'s account details do not have the documented shape`);
|
|
37
|
+
const { companyCurrency, ...details } = parsed.output;
|
|
38
|
+
return {
|
|
39
|
+
...details,
|
|
40
|
+
...companyCurrency && /^[A-Z]{3}$/.test(companyCurrency) ? { companyCurrency } : {}
|
|
41
|
+
};
|
|
42
|
+
}, "accountDetails");
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
accountDetails
|
|
46
|
+
};
|