@wootsup/yt-builder-mcp 0.2.0-alpha.2
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/LICENSE +21 -0
- package/README.md +221 -0
- package/bin/yt-builder-mcp.js +59 -0
- package/dist/auth.d.ts +39 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +93 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +84 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +151 -0
- package/dist/client.js.map +1 -0
- package/dist/clients/claude-code.d.ts +18 -0
- package/dist/clients/claude-code.d.ts.map +1 -0
- package/dist/clients/claude-code.js +53 -0
- package/dist/clients/claude-code.js.map +1 -0
- package/dist/clients/claude-desktop.d.ts +19 -0
- package/dist/clients/claude-desktop.d.ts.map +1 -0
- package/dist/clients/claude-desktop.js +56 -0
- package/dist/clients/claude-desktop.js.map +1 -0
- package/dist/clients/cline.d.ts +26 -0
- package/dist/clients/cline.d.ts.map +1 -0
- package/dist/clients/cline.js +80 -0
- package/dist/clients/cline.js.map +1 -0
- package/dist/clients/codex-cli.d.ts +42 -0
- package/dist/clients/codex-cli.d.ts.map +1 -0
- package/dist/clients/codex-cli.js +194 -0
- package/dist/clients/codex-cli.js.map +1 -0
- package/dist/clients/continue.d.ts +13 -0
- package/dist/clients/continue.d.ts.map +1 -0
- package/dist/clients/continue.js +52 -0
- package/dist/clients/continue.js.map +1 -0
- package/dist/clients/cursor.d.ts +12 -0
- package/dist/clients/cursor.d.ts.map +1 -0
- package/dist/clients/cursor.js +38 -0
- package/dist/clients/cursor.js.map +1 -0
- package/dist/clients/gemini-cli.d.ts +18 -0
- package/dist/clients/gemini-cli.d.ts.map +1 -0
- package/dist/clients/gemini-cli.js +44 -0
- package/dist/clients/gemini-cli.js.map +1 -0
- package/dist/clients/home.d.ts +14 -0
- package/dist/clients/home.d.ts.map +1 -0
- package/dist/clients/home.js +20 -0
- package/dist/clients/home.js.map +1 -0
- package/dist/clients/index.d.ts +52 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +72 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/roo-code.d.ts +23 -0
- package/dist/clients/roo-code.d.ts.map +1 -0
- package/dist/clients/roo-code.js +69 -0
- package/dist/clients/roo-code.js.map +1 -0
- package/dist/clients/zed.d.ts +12 -0
- package/dist/clients/zed.d.ts.map +1 -0
- package/dist/clients/zed.js +41 -0
- package/dist/clients/zed.js.map +1 -0
- package/dist/errors/hints.d.ts +51 -0
- package/dist/errors/hints.d.ts.map +1 -0
- package/dist/errors/hints.js +95 -0
- package/dist/errors/hints.js.map +1 -0
- package/dist/errors/mask.d.ts +35 -0
- package/dist/errors/mask.d.ts.map +1 -0
- package/dist/errors/mask.js +49 -0
- package/dist/errors/mask.js.map +1 -0
- package/dist/errors/sanitize.d.ts +31 -0
- package/dist/errors/sanitize.d.ts.map +1 -0
- package/dist/errors/sanitize.js +90 -0
- package/dist/errors/sanitize.js.map +1 -0
- package/dist/errors.d.ts +42 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +61 -0
- package/dist/errors.js.map +1 -0
- package/dist/gateway/advanced-tool/discovery.d.ts +19 -0
- package/dist/gateway/advanced-tool/discovery.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/discovery.js +53 -0
- package/dist/gateway/advanced-tool/discovery.js.map +1 -0
- package/dist/gateway/advanced-tool/domains.d.ts +42 -0
- package/dist/gateway/advanced-tool/domains.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/domains.js +88 -0
- package/dist/gateway/advanced-tool/domains.js.map +1 -0
- package/dist/gateway/advanced-tool/execute.d.ts +29 -0
- package/dist/gateway/advanced-tool/execute.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/execute.js +54 -0
- package/dist/gateway/advanced-tool/execute.js.map +1 -0
- package/dist/gateway/advanced-tool/index.d.ts +36 -0
- package/dist/gateway/advanced-tool/index.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/index.js +39 -0
- package/dist/gateway/advanced-tool/index.js.map +1 -0
- package/dist/gateway/advanced-tool/register.d.ts +18 -0
- package/dist/gateway/advanced-tool/register.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/register.js +62 -0
- package/dist/gateway/advanced-tool/register.js.map +1 -0
- package/dist/gateway/advanced-tool.d.ts +13 -0
- package/dist/gateway/advanced-tool.d.ts.map +1 -0
- package/dist/gateway/advanced-tool.js +13 -0
- package/dist/gateway/advanced-tool.js.map +1 -0
- package/dist/gateway/capturing-server.d.ts +117 -0
- package/dist/gateway/capturing-server.d.ts.map +1 -0
- package/dist/gateway/capturing-server.js +103 -0
- package/dist/gateway/capturing-server.js.map +1 -0
- package/dist/gateway/essentials.d.ts +49 -0
- package/dist/gateway/essentials.d.ts.map +1 -0
- package/dist/gateway/essentials.js +62 -0
- package/dist/gateway/essentials.js.map +1 -0
- package/dist/gateway/test-support.d.ts +41 -0
- package/dist/gateway/test-support.d.ts.map +1 -0
- package/dist/gateway/test-support.js +60 -0
- package/dist/gateway/test-support.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -0
- package/dist/install-skill.d.ts +35 -0
- package/dist/install-skill.d.ts.map +1 -0
- package/dist/install-skill.js +107 -0
- package/dist/install-skill.js.map +1 -0
- package/dist/platform/index.d.ts +49 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +38 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/server.d.ts +50 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +117 -0
- package/dist/server.js.map +1 -0
- package/dist/setup-cli.d.ts +100 -0
- package/dist/setup-cli.d.ts.map +1 -0
- package/dist/setup-cli.js +355 -0
- package/dist/setup-cli.js.map +1 -0
- package/dist/setup-prompts.d.ts +41 -0
- package/dist/setup-prompts.d.ts.map +1 -0
- package/dist/setup-prompts.js +142 -0
- package/dist/setup-prompts.js.map +1 -0
- package/dist/setup-token.d.ts +38 -0
- package/dist/setup-token.d.ts.map +1 -0
- package/dist/setup-token.js +106 -0
- package/dist/setup-token.js.map +1 -0
- package/dist/setup-wizard-defaults.d.ts +43 -0
- package/dist/setup-wizard-defaults.d.ts.map +1 -0
- package/dist/setup-wizard-defaults.js +160 -0
- package/dist/setup-wizard-defaults.js.map +1 -0
- package/dist/setup-wizard-handshake.d.ts +25 -0
- package/dist/setup-wizard-handshake.d.ts.map +1 -0
- package/dist/setup-wizard-handshake.js +103 -0
- package/dist/setup-wizard-handshake.js.map +1 -0
- package/dist/setup-wizard-types.d.ts +148 -0
- package/dist/setup-wizard-types.d.ts.map +1 -0
- package/dist/setup-wizard-types.js +11 -0
- package/dist/setup-wizard-types.js.map +1 -0
- package/dist/setup-wizard.d.ts +33 -0
- package/dist/setup-wizard.d.ts.map +1 -0
- package/dist/setup-wizard.js +166 -0
- package/dist/setup-wizard.js.map +1 -0
- package/dist/setup.d.ts +17 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +33 -0
- package/dist/setup.js.map +1 -0
- package/dist/tools/elements/builders.d.ts +24 -0
- package/dist/tools/elements/builders.d.ts.map +1 -0
- package/dist/tools/elements/builders.js +150 -0
- package/dist/tools/elements/builders.js.map +1 -0
- package/dist/tools/elements/handlers-write.d.ts +48 -0
- package/dist/tools/elements/handlers-write.d.ts.map +1 -0
- package/dist/tools/elements/handlers-write.js +141 -0
- package/dist/tools/elements/handlers-write.js.map +1 -0
- package/dist/tools/elements/handlers.d.ts +56 -0
- package/dist/tools/elements/handlers.d.ts.map +1 -0
- package/dist/tools/elements/handlers.js +113 -0
- package/dist/tools/elements/handlers.js.map +1 -0
- package/dist/tools/elements/index.d.ts +28 -0
- package/dist/tools/elements/index.d.ts.map +1 -0
- package/dist/tools/elements/index.js +27 -0
- package/dist/tools/elements/index.js.map +1 -0
- package/dist/tools/elements.d.ts +13 -0
- package/dist/tools/elements.d.ts.map +1 -0
- package/dist/tools/elements.js +13 -0
- package/dist/tools/elements.js.map +1 -0
- package/dist/tools/elicitation.d.ts +87 -0
- package/dist/tools/elicitation.d.ts.map +1 -0
- package/dist/tools/elicitation.js +100 -0
- package/dist/tools/elicitation.js.map +1 -0
- package/dist/tools/format/elements-format.d.ts +34 -0
- package/dist/tools/format/elements-format.d.ts.map +1 -0
- package/dist/tools/format/elements-format.js +112 -0
- package/dist/tools/format/elements-format.js.map +1 -0
- package/dist/tools/format/health-format.d.ts +73 -0
- package/dist/tools/format/health-format.d.ts.map +1 -0
- package/dist/tools/format/health-format.js +178 -0
- package/dist/tools/format/health-format.js.map +1 -0
- package/dist/tools/format/inspection-format.d.ts +45 -0
- package/dist/tools/format/inspection-format.d.ts.map +1 -0
- package/dist/tools/format/inspection-format.js +125 -0
- package/dist/tools/format/inspection-format.js.map +1 -0
- package/dist/tools/format/pages-format.d.ts +39 -0
- package/dist/tools/format/pages-format.d.ts.map +1 -0
- package/dist/tools/format/pages-format.js +110 -0
- package/dist/tools/format/pages-format.js.map +1 -0
- package/dist/tools/format/sources-format.d.ts +25 -0
- package/dist/tools/format/sources-format.d.ts.map +1 -0
- package/dist/tools/format/sources-format.js +113 -0
- package/dist/tools/format/sources-format.js.map +1 -0
- package/dist/tools/health.d.ts +22 -0
- package/dist/tools/health.d.ts.map +1 -0
- package/dist/tools/health.js +147 -0
- package/dist/tools/health.js.map +1 -0
- package/dist/tools/index.d.ts +23 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +23 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/inspection.d.ts +14 -0
- package/dist/tools/inspection.d.ts.map +1 -0
- package/dist/tools/inspection.js +115 -0
- package/dist/tools/inspection.js.map +1 -0
- package/dist/tools/layout-flatten.d.ts +63 -0
- package/dist/tools/layout-flatten.d.ts.map +1 -0
- package/dist/tools/layout-flatten.js +95 -0
- package/dist/tools/layout-flatten.js.map +1 -0
- package/dist/tools/pages/builders.d.ts +14 -0
- package/dist/tools/pages/builders.d.ts.map +1 -0
- package/dist/tools/pages/builders.js +97 -0
- package/dist/tools/pages/builders.js.map +1 -0
- package/dist/tools/pages/handlers-read.d.ts +24 -0
- package/dist/tools/pages/handlers-read.d.ts.map +1 -0
- package/dist/tools/pages/handlers-read.js +141 -0
- package/dist/tools/pages/handlers-read.js.map +1 -0
- package/dist/tools/pages/handlers-write.d.ts +21 -0
- package/dist/tools/pages/handlers-write.d.ts.map +1 -0
- package/dist/tools/pages/handlers-write.js +52 -0
- package/dist/tools/pages/handlers-write.js.map +1 -0
- package/dist/tools/pages/index.d.ts +17 -0
- package/dist/tools/pages/index.d.ts.map +1 -0
- package/dist/tools/pages/index.js +17 -0
- package/dist/tools/pages/index.js.map +1 -0
- package/dist/tools/pages/schemas.d.ts +30 -0
- package/dist/tools/pages/schemas.d.ts.map +1 -0
- package/dist/tools/pages/schemas.js +30 -0
- package/dist/tools/pages/schemas.js.map +1 -0
- package/dist/tools/pages.d.ts +13 -0
- package/dist/tools/pages.d.ts.map +1 -0
- package/dist/tools/pages.js +13 -0
- package/dist/tools/pages.js.map +1 -0
- package/dist/tools/progress-phases.d.ts +46 -0
- package/dist/tools/progress-phases.d.ts.map +1 -0
- package/dist/tools/progress-phases.js +48 -0
- package/dist/tools/progress-phases.js.map +1 -0
- package/dist/tools/shared-schemas.d.ts +15 -0
- package/dist/tools/shared-schemas.d.ts.map +1 -0
- package/dist/tools/shared-schemas.js +30 -0
- package/dist/tools/shared-schemas.js.map +1 -0
- package/dist/tools/sources/builders.d.ts +13 -0
- package/dist/tools/sources/builders.d.ts.map +1 -0
- package/dist/tools/sources/builders.js +88 -0
- package/dist/tools/sources/builders.js.map +1 -0
- package/dist/tools/sources/handlers-bind.d.ts +26 -0
- package/dist/tools/sources/handlers-bind.d.ts.map +1 -0
- package/dist/tools/sources/handlers-bind.js +123 -0
- package/dist/tools/sources/handlers-bind.js.map +1 -0
- package/dist/tools/sources/handlers.d.ts +45 -0
- package/dist/tools/sources/handlers.d.ts.map +1 -0
- package/dist/tools/sources/handlers.js +84 -0
- package/dist/tools/sources/handlers.js.map +1 -0
- package/dist/tools/sources/index.d.ts +19 -0
- package/dist/tools/sources/index.d.ts.map +1 -0
- package/dist/tools/sources/index.js +18 -0
- package/dist/tools/sources/index.js.map +1 -0
- package/dist/tools/sources.d.ts +14 -0
- package/dist/tools/sources.d.ts.map +1 -0
- package/dist/tools/sources.js +14 -0
- package/dist/tools/sources.js.map +1 -0
- package/dist/tools/sparse-fields.d.ts +80 -0
- package/dist/tools/sparse-fields.d.ts.map +1 -0
- package/dist/tools/sparse-fields.js +144 -0
- package/dist/tools/sparse-fields.js.map +1 -0
- package/dist/tools/tool-builder/annotations.d.ts +22 -0
- package/dist/tools/tool-builder/annotations.d.ts.map +1 -0
- package/dist/tools/tool-builder/annotations.js +35 -0
- package/dist/tools/tool-builder/annotations.js.map +1 -0
- package/dist/tools/tool-builder/define.d.ts +31 -0
- package/dist/tools/tool-builder/define.d.ts.map +1 -0
- package/dist/tools/tool-builder/define.js +31 -0
- package/dist/tools/tool-builder/define.js.map +1 -0
- package/dist/tools/tool-builder/index.d.ts +28 -0
- package/dist/tools/tool-builder/index.d.ts.map +1 -0
- package/dist/tools/tool-builder/index.js +27 -0
- package/dist/tools/tool-builder/index.js.map +1 -0
- package/dist/tools/tool-builder/results.d.ts +59 -0
- package/dist/tools/tool-builder/results.d.ts.map +1 -0
- package/dist/tools/tool-builder/results.js +125 -0
- package/dist/tools/tool-builder/results.js.map +1 -0
- package/dist/tools/tool-builder/types.d.ts +82 -0
- package/dist/tools/tool-builder/types.d.ts.map +1 -0
- package/dist/tools/tool-builder/types.js +9 -0
- package/dist/tools/tool-builder/types.js.map +1 -0
- package/dist/tools/tool-builder.d.ts +16 -0
- package/dist/tools/tool-builder.d.ts.map +1 -0
- package/dist/tools/tool-builder.js +16 -0
- package/dist/tools/tool-builder.js.map +1 -0
- package/icon.png +0 -0
- package/manifest.json +63 -0
- package/package.json +81 -0
- package/skills/yootheme-builder/SKILL.md +582 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roo Code MCP config writer.
|
|
3
|
+
*
|
|
4
|
+
* Roo Code (formerly Roo Cline) is the VS Code extension
|
|
5
|
+
* `rooveterinaryinc.roo-cline` — a fork of Cline. It follows the
|
|
6
|
+
* same VS Code globalStorage layout but its own settings file is
|
|
7
|
+
* named `mcp_settings.json` (without the legacy `cline_` prefix
|
|
8
|
+
* its parent uses).
|
|
9
|
+
*
|
|
10
|
+
* <vsCodeUserDir>/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json
|
|
11
|
+
*
|
|
12
|
+
* VS Code's `<vsCodeUserDir>` is:
|
|
13
|
+
* macOS: ~/Library/Application Support/Code/User
|
|
14
|
+
* Linux: ~/.config/Code/User
|
|
15
|
+
* Windows: %APPDATA%\Code\User
|
|
16
|
+
*
|
|
17
|
+
* Schema mirrors Claude Desktop's `mcpServers` map.
|
|
18
|
+
*
|
|
19
|
+
* @license MIT
|
|
20
|
+
*/
|
|
21
|
+
import { existsSync } from 'node:fs';
|
|
22
|
+
import { platform } from 'node:os';
|
|
23
|
+
import { join } from 'node:path';
|
|
24
|
+
import { userHome } from './home.js';
|
|
25
|
+
import { patchJsonFile } from './index.js';
|
|
26
|
+
const EXTENSION_ID = 'rooveterinaryinc.roo-cline';
|
|
27
|
+
const SETTINGS_FILENAME = 'mcp_settings.json';
|
|
28
|
+
function vsCodeUserDir() {
|
|
29
|
+
const home = userHome();
|
|
30
|
+
switch (platform()) {
|
|
31
|
+
case 'darwin':
|
|
32
|
+
return join(home, 'Library', 'Application Support', 'Code', 'User');
|
|
33
|
+
case 'win32': {
|
|
34
|
+
const appData = process.env.APPDATA ?? join(home, 'AppData', 'Roaming');
|
|
35
|
+
return join(appData, 'Code', 'User');
|
|
36
|
+
}
|
|
37
|
+
default:
|
|
38
|
+
return join(home, '.config', 'Code', 'User');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function configPath() {
|
|
42
|
+
return join(vsCodeUserDir(), 'globalStorage', EXTENSION_ID, 'settings', SETTINGS_FILENAME);
|
|
43
|
+
}
|
|
44
|
+
function isDetected() {
|
|
45
|
+
const extDir = join(vsCodeUserDir(), 'globalStorage', EXTENSION_ID);
|
|
46
|
+
return existsSync(extDir) || existsSync(configPath());
|
|
47
|
+
}
|
|
48
|
+
export const rooCodeClient = {
|
|
49
|
+
id: 'roo-code',
|
|
50
|
+
label: 'Roo Code (VS Code)',
|
|
51
|
+
configPath,
|
|
52
|
+
isDetected,
|
|
53
|
+
apply: async (serverName, config) => {
|
|
54
|
+
await patchJsonFile(configPath(), (current) => {
|
|
55
|
+
const servers = current.mcpServers !== null &&
|
|
56
|
+
typeof current.mcpServers === 'object' &&
|
|
57
|
+
!Array.isArray(current.mcpServers)
|
|
58
|
+
? { ...current.mcpServers }
|
|
59
|
+
: {};
|
|
60
|
+
servers[serverName] = {
|
|
61
|
+
command: config.command,
|
|
62
|
+
args: config.args,
|
|
63
|
+
env: config.env,
|
|
64
|
+
};
|
|
65
|
+
return { ...current, mcpServers: servers };
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=roo-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roo-code.js","sourceRoot":"","sources":["../../src/clients/roo-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAA2C,MAAM,YAAY,CAAC;AAEpF,MAAM,YAAY,GAAG,4BAA4B,CAAC;AAClD,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C,SAAS,aAAa;IAClB,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,QAAQ,QAAQ,EAAE,EAAE,CAAC;QACjB,KAAK,QAAQ;YACT,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACxE,KAAK,OAAO,CAAC,CAAC,CAAC;YACX,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;YACxE,OAAO,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACzC,CAAC;QACD;YACI,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;AACL,CAAC;AAED,SAAS,UAAU;IACf,OAAO,IAAI,CACP,aAAa,EAAE,EACf,eAAe,EACf,YAAY,EACZ,UAAU,EACV,iBAAiB,CACpB,CAAC;AACN,CAAC;AAED,SAAS,UAAU;IACf,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;IACpE,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAiB;IACvC,EAAE,EAAE,UAAU;IACd,KAAK,EAAE,oBAAoB;IAC3B,UAAU;IACV,UAAU;IACV,KAAK,EAAE,KAAK,EAAE,UAAkB,EAAE,MAAuB,EAAE,EAAE;QACzD,MAAM,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;YAC1C,MAAM,OAAO,GACT,OAAO,CAAC,UAAU,KAAK,IAAI;gBAC3B,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ;gBACtC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;gBAC9B,CAAC,CAAC,EAAE,GAAI,OAAO,CAAC,UAAsC,EAAE;gBACxD,CAAC,CAAC,EAAE,CAAC;YACb,OAAO,CAAC,UAAU,CAAC,GAAG;gBAClB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,GAAG,EAAE,MAAM,CAAC,GAAG;aAClB,CAAC;YACF,OAAO,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;QAC/C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zed MCP config writer.
|
|
3
|
+
*
|
|
4
|
+
* Global: ~/.config/zed/settings.json (JSONC; we treat as JSON for write)
|
|
5
|
+
*
|
|
6
|
+
* Schema: `context_servers` map (Zed-specific naming).
|
|
7
|
+
*
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
import { type ClientWriter } from './index.js';
|
|
11
|
+
export declare const zedClient: ClientWriter;
|
|
12
|
+
//# sourceMappingURL=zed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zed.d.ts","sourceRoot":"","sources":["../../src/clients/zed.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AAMpF,eAAO,MAAM,SAAS,EAAE,YAwBvB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zed MCP config writer.
|
|
3
|
+
*
|
|
4
|
+
* Global: ~/.config/zed/settings.json (JSONC; we treat as JSON for write)
|
|
5
|
+
*
|
|
6
|
+
* Schema: `context_servers` map (Zed-specific naming).
|
|
7
|
+
*
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync } from 'node:fs';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { userHome } from './home.js';
|
|
13
|
+
import { patchJsonFile } from './index.js';
|
|
14
|
+
function configPath() {
|
|
15
|
+
return join(userHome(), '.config', 'zed', 'settings.json');
|
|
16
|
+
}
|
|
17
|
+
export const zedClient = {
|
|
18
|
+
id: 'zed',
|
|
19
|
+
label: 'Zed',
|
|
20
|
+
configPath,
|
|
21
|
+
isDetected: () => existsSync(join(userHome(), '.config', 'zed')),
|
|
22
|
+
apply: async (serverName, config) => {
|
|
23
|
+
await patchJsonFile(configPath(), (current) => {
|
|
24
|
+
const servers = current.context_servers !== null &&
|
|
25
|
+
typeof current.context_servers === 'object' &&
|
|
26
|
+
!Array.isArray(current.context_servers)
|
|
27
|
+
? { ...current.context_servers }
|
|
28
|
+
: {};
|
|
29
|
+
servers[serverName] = {
|
|
30
|
+
command: {
|
|
31
|
+
path: config.command,
|
|
32
|
+
args: config.args,
|
|
33
|
+
env: config.env,
|
|
34
|
+
},
|
|
35
|
+
settings: {},
|
|
36
|
+
};
|
|
37
|
+
return { ...current, context_servers: servers };
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=zed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zed.js","sourceRoot":"","sources":["../../src/clients/zed.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAA2C,MAAM,YAAY,CAAC;AAEpF,SAAS,UAAU;IACf,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAiB;IACnC,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,KAAK;IACZ,UAAU;IACV,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAChE,KAAK,EAAE,KAAK,EAAE,UAAkB,EAAE,MAAuB,EAAE,EAAE;QACzD,MAAM,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;YAC1C,MAAM,OAAO,GACT,OAAO,CAAC,eAAe,KAAK,IAAI;gBAChC,OAAO,OAAO,CAAC,eAAe,KAAK,QAAQ;gBAC3C,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC;gBACnC,CAAC,CAAC,EAAE,GAAI,OAAO,CAAC,eAA2C,EAAE;gBAC7D,CAAC,CAAC,EAAE,CAAC;YACb,OAAO,CAAC,UAAU,CAAC,GAAG;gBAClB,OAAO,EAAE;oBACL,IAAI,EAAE,MAAM,CAAC,OAAO;oBACpB,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,GAAG,EAAE,MAAM,CAAC,GAAG;iBAClB;gBACD,QAAQ,EAAE,EAAE;aACf,CAAC;YACF,OAAO,EAAE,GAAG,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error-code taxonomy + AI-friendly hint messages.
|
|
3
|
+
*
|
|
4
|
+
* `classify(status)` maps the HTTP status of a failed REST call into one
|
|
5
|
+
* of nine canonical `YtbErrorCode` values. `hintFor(code)` returns a
|
|
6
|
+
* recovery-oriented hint string the LLM can act on without re-reading the
|
|
7
|
+
* raw error message.
|
|
8
|
+
*
|
|
9
|
+
* Centralising the taxonomy means every tool's catch-block emits the
|
|
10
|
+
* same vocabulary, and the audit gate can pin the exact set of hints
|
|
11
|
+
* that ship.
|
|
12
|
+
*
|
|
13
|
+
* Reference: `apimapper-mcp/src/modules/apimapper/client.ts:hintFor`
|
|
14
|
+
* (Wave G.6.1 — same shape, ported for the YOOtheme Builder REST API).
|
|
15
|
+
*
|
|
16
|
+
* @license MIT
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Canonical YOOtheme-Builder-MCP error code union.
|
|
20
|
+
*
|
|
21
|
+
* Order is documentary only — `classify()` returns whichever applies.
|
|
22
|
+
*/
|
|
23
|
+
export type YtbErrorCode = 'auth_invalid' | 'auth_missing' | 'forbidden' | 'not_found' | 'conflict_etag' | 'validation_error' | 'rate_limit' | 'server_error' | 'network';
|
|
24
|
+
/** Options for `classify()` — second-tier signals (e.g. response headers). */
|
|
25
|
+
export interface ClassifyOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Whether the response carried a `WWW-Authenticate` header. Used to
|
|
28
|
+
* distinguish `auth_missing` (no bearer sent → server didn't ask for one
|
|
29
|
+
* via WWW-Authenticate; misconfigured client) from `auth_invalid`
|
|
30
|
+
* (server rejected the bearer that WAS sent).
|
|
31
|
+
*/
|
|
32
|
+
readonly hasWwwAuthenticate?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Map an HTTP status into a `YtbErrorCode`.
|
|
36
|
+
*
|
|
37
|
+
* Special-cases:
|
|
38
|
+
* - 401 with `hasWwwAuthenticate: false` → `auth_missing`
|
|
39
|
+
* - 401 with `hasWwwAuthenticate: true` → `auth_invalid` (default)
|
|
40
|
+
* - 412 (Precondition Failed) is treated as `conflict_etag` alongside 409.
|
|
41
|
+
* - Status 0 (no response) → `network`.
|
|
42
|
+
* - Anything we don't recognise (incl. 2xx) → `server_error` so the agent
|
|
43
|
+
* sees a non-empty hint rather than silently swallowing.
|
|
44
|
+
*/
|
|
45
|
+
export declare function classify(status: number, options?: ClassifyOptions): YtbErrorCode;
|
|
46
|
+
/**
|
|
47
|
+
* Return a focused hint describing how the agent (or the user) can
|
|
48
|
+
* recover from a given error code. Always non-empty.
|
|
49
|
+
*/
|
|
50
|
+
export declare function hintFor(code: YtbErrorCode): string;
|
|
51
|
+
//# sourceMappingURL=hints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hints.d.ts","sourceRoot":"","sources":["../../src/errors/hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAClB,cAAc,GACd,cAAc,GACd,WAAW,GACX,WAAW,GACX,eAAe,GACf,kBAAkB,GAClB,YAAY,GACZ,cAAc,GACd,SAAS,CAAC;AAEhB,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CACzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,YAAY,CAYpF;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CA2DlD"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error-code taxonomy + AI-friendly hint messages.
|
|
3
|
+
*
|
|
4
|
+
* `classify(status)` maps the HTTP status of a failed REST call into one
|
|
5
|
+
* of nine canonical `YtbErrorCode` values. `hintFor(code)` returns a
|
|
6
|
+
* recovery-oriented hint string the LLM can act on without re-reading the
|
|
7
|
+
* raw error message.
|
|
8
|
+
*
|
|
9
|
+
* Centralising the taxonomy means every tool's catch-block emits the
|
|
10
|
+
* same vocabulary, and the audit gate can pin the exact set of hints
|
|
11
|
+
* that ship.
|
|
12
|
+
*
|
|
13
|
+
* Reference: `apimapper-mcp/src/modules/apimapper/client.ts:hintFor`
|
|
14
|
+
* (Wave G.6.1 — same shape, ported for the YOOtheme Builder REST API).
|
|
15
|
+
*
|
|
16
|
+
* @license MIT
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Map an HTTP status into a `YtbErrorCode`.
|
|
20
|
+
*
|
|
21
|
+
* Special-cases:
|
|
22
|
+
* - 401 with `hasWwwAuthenticate: false` → `auth_missing`
|
|
23
|
+
* - 401 with `hasWwwAuthenticate: true` → `auth_invalid` (default)
|
|
24
|
+
* - 412 (Precondition Failed) is treated as `conflict_etag` alongside 409.
|
|
25
|
+
* - Status 0 (no response) → `network`.
|
|
26
|
+
* - Anything we don't recognise (incl. 2xx) → `server_error` so the agent
|
|
27
|
+
* sees a non-empty hint rather than silently swallowing.
|
|
28
|
+
*/
|
|
29
|
+
export function classify(status, options = {}) {
|
|
30
|
+
if (status === 0)
|
|
31
|
+
return 'network';
|
|
32
|
+
if (status === 401) {
|
|
33
|
+
return options.hasWwwAuthenticate === false ? 'auth_missing' : 'auth_invalid';
|
|
34
|
+
}
|
|
35
|
+
if (status === 403)
|
|
36
|
+
return 'forbidden';
|
|
37
|
+
if (status === 404)
|
|
38
|
+
return 'not_found';
|
|
39
|
+
if (status === 409 || status === 412)
|
|
40
|
+
return 'conflict_etag';
|
|
41
|
+
if (status === 422)
|
|
42
|
+
return 'validation_error';
|
|
43
|
+
if (status === 429)
|
|
44
|
+
return 'rate_limit';
|
|
45
|
+
if (status >= 500)
|
|
46
|
+
return 'server_error';
|
|
47
|
+
return 'server_error';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Return a focused hint describing how the agent (or the user) can
|
|
51
|
+
* recover from a given error code. Always non-empty.
|
|
52
|
+
*/
|
|
53
|
+
export function hintFor(code) {
|
|
54
|
+
switch (code) {
|
|
55
|
+
case 'auth_invalid':
|
|
56
|
+
return ('Bearer key rejected (HTTP 401, key signature invalid or revoked). ' +
|
|
57
|
+
'Open wp-admin → Tools → "YT Builder MCP" → Bearer Keys, regenerate the ' +
|
|
58
|
+
'key, and update YTB_MCP_BEARER_TOKEN in your AI-client config. ' +
|
|
59
|
+
'Then restart the client.');
|
|
60
|
+
case 'auth_missing':
|
|
61
|
+
return ('No Bearer credential sent (HTTP 401 without WWW-Authenticate echo). ' +
|
|
62
|
+
'Set the YTB_MCP_BEARER_TOKEN environment variable in your AI-client ' +
|
|
63
|
+
'MCP configuration to a key generated by the plugin Settings page.');
|
|
64
|
+
case 'forbidden':
|
|
65
|
+
return ('Permission denied (HTTP 403). Your Bearer key lacks the required ' +
|
|
66
|
+
'scope for this operation. Regenerate a key with the correct ' +
|
|
67
|
+
'scope (read / write / admin) in the plugin Settings page.');
|
|
68
|
+
case 'not_found':
|
|
69
|
+
return ('Resource not found (HTTP 404). Use the matching `*_list` tool ' +
|
|
70
|
+
'(yootheme_builder_pages_list, yootheme_builder_element_list, …) ' +
|
|
71
|
+
'to discover valid IDs / paths. IDs are case-sensitive.');
|
|
72
|
+
case 'conflict_etag':
|
|
73
|
+
return ('Optimistic-lock failed (HTTP 409/412). Another writer changed ' +
|
|
74
|
+
'the state since you fetched it. Call yootheme_builder_get_etag ' +
|
|
75
|
+
'again to get the fresh ETag, then retry your write with that ETag.');
|
|
76
|
+
case 'validation_error':
|
|
77
|
+
return ('Request body failed validation (HTTP 422). Re-check the tool\'s ' +
|
|
78
|
+
'inputSchema and the element-type schema via ' +
|
|
79
|
+
'yootheme_builder_element_type_get_schema for valid `props` keys.');
|
|
80
|
+
case 'rate_limit':
|
|
81
|
+
return ('Rate limit reached (HTTP 429). This is likely Cloudflare or ' +
|
|
82
|
+
'another WAF in front of WordPress, not the plugin itself. Wait ' +
|
|
83
|
+
'a few seconds and retry. If persistent, check the WAF rate-limit ' +
|
|
84
|
+
'rule in your Cloudflare dashboard.');
|
|
85
|
+
case 'server_error':
|
|
86
|
+
return ('Upstream server error (HTTP 5xx or unexpected status). Retry ' +
|
|
87
|
+
'after a short delay; if it persists, check the WordPress error ' +
|
|
88
|
+
'log (wp-content/debug.log) for the underlying PHP exception.');
|
|
89
|
+
case 'network':
|
|
90
|
+
return ('Network or timeout error reaching WordPress. Verify ' +
|
|
91
|
+
'YTB_MCP_WP_URL is correct and reachable from this host (try ' +
|
|
92
|
+
'`curl <YTB_MCP_WP_URL>/wp-json/yt-builder-mcp/v1/health`).');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=hints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hints.js","sourceRoot":"","sources":["../../src/errors/hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA6BH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,UAA2B,EAAE;IAClE,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACnC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC,kBAAkB,KAAK,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC;IAClF,CAAC;IACD,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,WAAW,CAAC;IACvC,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,WAAW,CAAC;IACvC,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,eAAe,CAAC;IAC7D,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,kBAAkB,CAAC;IAC9C,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,YAAY,CAAC;IACxC,IAAI,MAAM,IAAI,GAAG;QAAE,OAAO,cAAc,CAAC;IACzC,OAAO,cAAc,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,IAAkB;IACtC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,cAAc;YACf,OAAO,CACH,oEAAoE;gBACpE,yEAAyE;gBACzE,iEAAiE;gBACjE,0BAA0B,CAC7B,CAAC;QACN,KAAK,cAAc;YACf,OAAO,CACH,sEAAsE;gBACtE,sEAAsE;gBACtE,mEAAmE,CACtE,CAAC;QACN,KAAK,WAAW;YACZ,OAAO,CACH,mEAAmE;gBACnE,8DAA8D;gBAC9D,2DAA2D,CAC9D,CAAC;QACN,KAAK,WAAW;YACZ,OAAO,CACH,gEAAgE;gBAChE,kEAAkE;gBAClE,wDAAwD,CAC3D,CAAC;QACN,KAAK,eAAe;YAChB,OAAO,CACH,gEAAgE;gBAChE,iEAAiE;gBACjE,oEAAoE,CACvE,CAAC;QACN,KAAK,kBAAkB;YACnB,OAAO,CACH,kEAAkE;gBAClE,8CAA8C;gBAC9C,kEAAkE,CACrE,CAAC;QACN,KAAK,YAAY;YACb,OAAO,CACH,8DAA8D;gBAC9D,iEAAiE;gBACjE,mEAAmE;gBACnE,oCAAoC,CACvC,CAAC;QACN,KAAK,cAAc;YACf,OAAO,CACH,+DAA+D;gBAC/D,iEAAiE;gBACjE,8DAA8D,CACjE,CAAC;QACN,KAAK,SAAS;YACV,OAAO,CACH,sDAAsD;gBACtD,8DAA8D;gBAC9D,4DAA4D,CAC/D,CAAC;IACV,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret-masking helpers — Wave G.6.2.
|
|
3
|
+
*
|
|
4
|
+
* `maskBearerToken` rewrites any `Bearer <token>` substring to
|
|
5
|
+
* `Bearer ***masked***`. `sanitizeForLogs` additionally truncates very
|
|
6
|
+
* long strings so a paste of a multi-MB stack trace can't blow the
|
|
7
|
+
* context budget.
|
|
8
|
+
*
|
|
9
|
+
* Defense-in-depth: this is the single choke-point for any string
|
|
10
|
+
* (error message, response body excerpt, log line) that crosses the
|
|
11
|
+
* MCP boundary into the LLM's view.
|
|
12
|
+
*
|
|
13
|
+
* @license MIT
|
|
14
|
+
*/
|
|
15
|
+
/** Maximum length for a sanitised log string. Anything longer is truncated. */
|
|
16
|
+
export declare const LOG_TRUNCATION_LIMIT = 2000;
|
|
17
|
+
/**
|
|
18
|
+
* Replace every `Bearer <opaque-token>` substring with `Bearer ***masked***`.
|
|
19
|
+
*
|
|
20
|
+
* Token-shape is intentionally permissive — we'd rather over-mask than
|
|
21
|
+
* leak. Any non-whitespace run following the literal `Bearer ` is treated
|
|
22
|
+
* as the token and replaced.
|
|
23
|
+
*/
|
|
24
|
+
export declare function maskBearerToken(input: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Sanitise a string before it joins the LLM-visible output:
|
|
27
|
+
* 1. mask any Bearer tokens
|
|
28
|
+
* 2. truncate to `LOG_TRUNCATION_LIMIT` chars with a clear suffix
|
|
29
|
+
*
|
|
30
|
+
* Non-string inputs (null / undefined) collapse to an empty string —
|
|
31
|
+
* caller code typically passes `error?.message` and `?? ''` is a common
|
|
32
|
+
* upstream pattern.
|
|
33
|
+
*/
|
|
34
|
+
export declare function sanitizeForLogs(input: string): string;
|
|
35
|
+
//# sourceMappingURL=mask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../src/errors/mask.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMrD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret-masking helpers — Wave G.6.2.
|
|
3
|
+
*
|
|
4
|
+
* `maskBearerToken` rewrites any `Bearer <token>` substring to
|
|
5
|
+
* `Bearer ***masked***`. `sanitizeForLogs` additionally truncates very
|
|
6
|
+
* long strings so a paste of a multi-MB stack trace can't blow the
|
|
7
|
+
* context budget.
|
|
8
|
+
*
|
|
9
|
+
* Defense-in-depth: this is the single choke-point for any string
|
|
10
|
+
* (error message, response body excerpt, log line) that crosses the
|
|
11
|
+
* MCP boundary into the LLM's view.
|
|
12
|
+
*
|
|
13
|
+
* @license MIT
|
|
14
|
+
*/
|
|
15
|
+
/** Maximum length for a sanitised log string. Anything longer is truncated. */
|
|
16
|
+
export const LOG_TRUNCATION_LIMIT = 2000;
|
|
17
|
+
/**
|
|
18
|
+
* Replace every `Bearer <opaque-token>` substring with `Bearer ***masked***`.
|
|
19
|
+
*
|
|
20
|
+
* Token-shape is intentionally permissive — we'd rather over-mask than
|
|
21
|
+
* leak. Any non-whitespace run following the literal `Bearer ` is treated
|
|
22
|
+
* as the token and replaced.
|
|
23
|
+
*/
|
|
24
|
+
export function maskBearerToken(input) {
|
|
25
|
+
if (input === '')
|
|
26
|
+
return '';
|
|
27
|
+
// The `g` flag handles repeated occurrences in one string.
|
|
28
|
+
return input.replace(/Bearer\s+\S+/g, 'Bearer ***masked***');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Sanitise a string before it joins the LLM-visible output:
|
|
32
|
+
* 1. mask any Bearer tokens
|
|
33
|
+
* 2. truncate to `LOG_TRUNCATION_LIMIT` chars with a clear suffix
|
|
34
|
+
*
|
|
35
|
+
* Non-string inputs (null / undefined) collapse to an empty string —
|
|
36
|
+
* caller code typically passes `error?.message` and `?? ''` is a common
|
|
37
|
+
* upstream pattern.
|
|
38
|
+
*/
|
|
39
|
+
export function sanitizeForLogs(input) {
|
|
40
|
+
if (input === null || input === undefined)
|
|
41
|
+
return '';
|
|
42
|
+
if (input === '')
|
|
43
|
+
return '';
|
|
44
|
+
const masked = maskBearerToken(input);
|
|
45
|
+
if (masked.length <= LOG_TRUNCATION_LIMIT)
|
|
46
|
+
return masked;
|
|
47
|
+
return masked.slice(0, LOG_TRUNCATION_LIMIT) + '... [truncated]';
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=mask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mask.js","sourceRoot":"","sources":["../../src/errors/mask.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IACzC,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC5B,2DAA2D;IAC3D,OAAO,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IACzC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrD,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,MAAM,CAAC,MAAM,IAAI,oBAAoB;QAAE,OAAO,MAAM,CAAC;IACzD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,oBAAoB,CAAC,GAAG,iBAAiB,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sanitizeSecrets` — recursive value-walker that swaps any value at a
|
|
3
|
+
* known-secret key for the sentinel `[REDACTED]`.
|
|
4
|
+
*
|
|
5
|
+
* Wave G.6.4. Pattern ported verbatim from
|
|
6
|
+
* `apimapper-mcp/src/modules/apimapper/credential-sanitizer.ts` because
|
|
7
|
+
* it's the same defense-in-depth shape and the apimapper version is
|
|
8
|
+
* audit-hardened (A4 round 1 + 2).
|
|
9
|
+
*
|
|
10
|
+
* Used on both the error-path (RestError.body excerpts) AND the
|
|
11
|
+
* success-path (jsonResult / structuredResult payloads in
|
|
12
|
+
* `tool-builder.ts`) so a regressing REST handler — or a logging path —
|
|
13
|
+
* can never leak `oauth_refresh_token` / `auth_data` / `bearer` etc.
|
|
14
|
+
* into the LLM's context.
|
|
15
|
+
*
|
|
16
|
+
* Key-list intentionally mirrors apimapper-mcp; review both together
|
|
17
|
+
* when extending.
|
|
18
|
+
*
|
|
19
|
+
* @license MIT
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Recursively walk any JSON-serialisable value and redact any nested
|
|
23
|
+
* value whose key matches a known-secret name. Returns a fresh tree —
|
|
24
|
+
* the input is never mutated.
|
|
25
|
+
*
|
|
26
|
+
* Primitives (string / number / boolean / null / undefined) pass through
|
|
27
|
+
* unchanged. Arrays are mapped element-wise. Objects are reconstructed
|
|
28
|
+
* with `[REDACTED]` substituted at any secret key.
|
|
29
|
+
*/
|
|
30
|
+
export declare function sanitizeSecrets<T>(input: T): T;
|
|
31
|
+
//# sourceMappingURL=sanitize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/errors/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA6CH;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAgB9C"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sanitizeSecrets` — recursive value-walker that swaps any value at a
|
|
3
|
+
* known-secret key for the sentinel `[REDACTED]`.
|
|
4
|
+
*
|
|
5
|
+
* Wave G.6.4. Pattern ported verbatim from
|
|
6
|
+
* `apimapper-mcp/src/modules/apimapper/credential-sanitizer.ts` because
|
|
7
|
+
* it's the same defense-in-depth shape and the apimapper version is
|
|
8
|
+
* audit-hardened (A4 round 1 + 2).
|
|
9
|
+
*
|
|
10
|
+
* Used on both the error-path (RestError.body excerpts) AND the
|
|
11
|
+
* success-path (jsonResult / structuredResult payloads in
|
|
12
|
+
* `tool-builder.ts`) so a regressing REST handler — or a logging path —
|
|
13
|
+
* can never leak `oauth_refresh_token` / `auth_data` / `bearer` etc.
|
|
14
|
+
* into the LLM's context.
|
|
15
|
+
*
|
|
16
|
+
* Key-list intentionally mirrors apimapper-mcp; review both together
|
|
17
|
+
* when extending.
|
|
18
|
+
*
|
|
19
|
+
* @license MIT
|
|
20
|
+
*/
|
|
21
|
+
const SECRET_KEYS = new Set([
|
|
22
|
+
// Generic auth tokens
|
|
23
|
+
'token',
|
|
24
|
+
'bearer',
|
|
25
|
+
'bearer_token',
|
|
26
|
+
'bearerToken',
|
|
27
|
+
// Plugin-internal auth blob
|
|
28
|
+
'auth_data',
|
|
29
|
+
'authData',
|
|
30
|
+
// OAuth flows
|
|
31
|
+
'oauth_refresh_token',
|
|
32
|
+
'oauthRefreshToken',
|
|
33
|
+
'refresh_token',
|
|
34
|
+
'refreshToken',
|
|
35
|
+
'access_token',
|
|
36
|
+
'accessToken',
|
|
37
|
+
// App-secret pairs
|
|
38
|
+
'client_secret',
|
|
39
|
+
'clientSecret',
|
|
40
|
+
'api_key',
|
|
41
|
+
'apiKey',
|
|
42
|
+
'password',
|
|
43
|
+
'secret',
|
|
44
|
+
'secrets',
|
|
45
|
+
'raw_secret',
|
|
46
|
+
'rawSecret',
|
|
47
|
+
// Defense-in-depth additions (cf. apimapper A4 audit round 2)
|
|
48
|
+
'private_key',
|
|
49
|
+
'privateKey',
|
|
50
|
+
'signing_key',
|
|
51
|
+
'signingKey',
|
|
52
|
+
'webhook_secret',
|
|
53
|
+
'webhookSecret',
|
|
54
|
+
'consumer_secret',
|
|
55
|
+
'consumerSecret',
|
|
56
|
+
'consumer_key',
|
|
57
|
+
'consumerKey',
|
|
58
|
+
'session_token',
|
|
59
|
+
'sessionToken',
|
|
60
|
+
'id_token',
|
|
61
|
+
'idToken',
|
|
62
|
+
]);
|
|
63
|
+
/**
|
|
64
|
+
* Recursively walk any JSON-serialisable value and redact any nested
|
|
65
|
+
* value whose key matches a known-secret name. Returns a fresh tree —
|
|
66
|
+
* the input is never mutated.
|
|
67
|
+
*
|
|
68
|
+
* Primitives (string / number / boolean / null / undefined) pass through
|
|
69
|
+
* unchanged. Arrays are mapped element-wise. Objects are reconstructed
|
|
70
|
+
* with `[REDACTED]` substituted at any secret key.
|
|
71
|
+
*/
|
|
72
|
+
export function sanitizeSecrets(input) {
|
|
73
|
+
if (Array.isArray(input)) {
|
|
74
|
+
return input.map((item) => sanitizeSecrets(item));
|
|
75
|
+
}
|
|
76
|
+
if (input !== null && typeof input === 'object') {
|
|
77
|
+
const out = {};
|
|
78
|
+
for (const [k, v] of Object.entries(input)) {
|
|
79
|
+
if (SECRET_KEYS.has(k)) {
|
|
80
|
+
out[k] = '[REDACTED]';
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
out[k] = sanitizeSecrets(v);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
return input;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=sanitize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../../src/errors/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAS;IAChC,sBAAsB;IACtB,OAAO;IACP,QAAQ;IACR,cAAc;IACd,aAAa;IACb,4BAA4B;IAC5B,WAAW;IACX,UAAU;IACV,cAAc;IACd,qBAAqB;IACrB,mBAAmB;IACnB,eAAe;IACf,cAAc;IACd,cAAc;IACd,aAAa;IACb,mBAAmB;IACnB,eAAe;IACf,cAAc;IACd,SAAS;IACT,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,WAAW;IACX,8DAA8D;IAC9D,aAAa;IACb,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,gBAAgB;IAChB,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,cAAc;IACd,aAAa;IACb,eAAe;IACf,cAAc;IACd,UAAU;IACV,SAAS;CACZ,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAI,KAAQ;IACvC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAiB,CAAC;IACtE,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9C,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YACpE,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrB,GAAG,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACJ,GAAG,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC;QACL,CAAC;QACD,OAAO,GAAmB,CAAC;IAC/B,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for the YT Builder MCP package.
|
|
3
|
+
*
|
|
4
|
+
* `RestError` wraps non-2xx responses from the WP REST API with the
|
|
5
|
+
* status, the canonical WP_Error `code` (if present) and the human
|
|
6
|
+
* message. `ConfigError` is thrown when the server is missing
|
|
7
|
+
* environment configuration.
|
|
8
|
+
*
|
|
9
|
+
* Wave G.6.3: `body` is routed through `sanitizeSecrets` at construction
|
|
10
|
+
* time so any secret-bearing field returned by the upstream REST API
|
|
11
|
+
* (e.g. WP_Error data carrying `auth_data` or `oauth_refresh_token`)
|
|
12
|
+
* never lands in the LLM context — even if a future tool decides to
|
|
13
|
+
* echo `error.body` somewhere.
|
|
14
|
+
*
|
|
15
|
+
* @license MIT
|
|
16
|
+
*/
|
|
17
|
+
export interface RestErrorPayload {
|
|
18
|
+
readonly status: number;
|
|
19
|
+
readonly code?: string;
|
|
20
|
+
readonly message: string;
|
|
21
|
+
/** Original parsed JSON body (or null if the body was not JSON). */
|
|
22
|
+
readonly body: unknown;
|
|
23
|
+
}
|
|
24
|
+
export declare class RestError extends Error {
|
|
25
|
+
readonly status: number;
|
|
26
|
+
readonly code?: string;
|
|
27
|
+
readonly body: unknown;
|
|
28
|
+
constructor(payload: RestErrorPayload);
|
|
29
|
+
}
|
|
30
|
+
export declare class ConfigError extends Error {
|
|
31
|
+
constructor(message: string);
|
|
32
|
+
}
|
|
33
|
+
export interface NetworkErrorPayload {
|
|
34
|
+
readonly cause: unknown;
|
|
35
|
+
readonly url: string;
|
|
36
|
+
}
|
|
37
|
+
export declare class NetworkError extends Error {
|
|
38
|
+
readonly cause: unknown;
|
|
39
|
+
readonly url: string;
|
|
40
|
+
constructor(payload: NetworkErrorPayload);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CAC1B;AAED,qBAAa,SAAU,SAAQ,KAAK;IAChC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAgB,IAAI,EAAE,OAAO,CAAC;gBAElB,OAAO,EAAE,gBAAgB;CAUxC;AAED,qBAAa,WAAY,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI9B;AAED,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,YAAa,SAAQ,KAAK;IACnC,SAAgB,KAAK,EAAE,OAAO,CAAC;IAC/B,SAAgB,GAAG,EAAE,MAAM,CAAC;gBAEhB,OAAO,EAAE,mBAAmB;CAM3C"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for the YT Builder MCP package.
|
|
3
|
+
*
|
|
4
|
+
* `RestError` wraps non-2xx responses from the WP REST API with the
|
|
5
|
+
* status, the canonical WP_Error `code` (if present) and the human
|
|
6
|
+
* message. `ConfigError` is thrown when the server is missing
|
|
7
|
+
* environment configuration.
|
|
8
|
+
*
|
|
9
|
+
* Wave G.6.3: `body` is routed through `sanitizeSecrets` at construction
|
|
10
|
+
* time so any secret-bearing field returned by the upstream REST API
|
|
11
|
+
* (e.g. WP_Error data carrying `auth_data` or `oauth_refresh_token`)
|
|
12
|
+
* never lands in the LLM context — even if a future tool decides to
|
|
13
|
+
* echo `error.body` somewhere.
|
|
14
|
+
*
|
|
15
|
+
* @license MIT
|
|
16
|
+
*/
|
|
17
|
+
import { sanitizeSecrets } from './errors/sanitize.js';
|
|
18
|
+
export class RestError extends Error {
|
|
19
|
+
status;
|
|
20
|
+
code;
|
|
21
|
+
body;
|
|
22
|
+
constructor(payload) {
|
|
23
|
+
super(payload.message);
|
|
24
|
+
this.name = 'RestError';
|
|
25
|
+
this.status = payload.status;
|
|
26
|
+
this.code = payload.code;
|
|
27
|
+
// Deep-walk redaction at construction time (Wave G.6.3). The
|
|
28
|
+
// input body is never mutated; sanitizeSecrets returns a fresh
|
|
29
|
+
// tree with redacted secret-keys.
|
|
30
|
+
this.body = sanitizeSecrets(payload.body);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export class ConfigError extends Error {
|
|
34
|
+
constructor(message) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.name = 'ConfigError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export class NetworkError extends Error {
|
|
40
|
+
cause;
|
|
41
|
+
url;
|
|
42
|
+
constructor(payload) {
|
|
43
|
+
super(`Network error contacting ${payload.url}: ${describeCause(payload.cause)}`);
|
|
44
|
+
this.name = 'NetworkError';
|
|
45
|
+
this.cause = payload.cause;
|
|
46
|
+
this.url = payload.url;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function describeCause(cause) {
|
|
50
|
+
if (cause instanceof Error)
|
|
51
|
+
return cause.message;
|
|
52
|
+
if (typeof cause === 'string')
|
|
53
|
+
return cause;
|
|
54
|
+
try {
|
|
55
|
+
return JSON.stringify(cause);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return String(cause);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAUvD,MAAM,OAAO,SAAU,SAAQ,KAAK;IAChB,MAAM,CAAS;IACf,IAAI,CAAU;IACd,IAAI,CAAU;IAE9B,YAAY,OAAyB;QACjC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,6DAA6D;QAC7D,+DAA+D;QAC/D,kCAAkC;QAClC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CACJ;AAED,MAAM,OAAO,WAAY,SAAQ,KAAK;IAClC,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC9B,CAAC;CACJ;AAOD,MAAM,OAAO,YAAa,SAAQ,KAAK;IACnB,KAAK,CAAU;IACf,GAAG,CAAS;IAE5B,YAAY,OAA4B;QACpC,KAAK,CAAC,4BAA4B,OAAO,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClF,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAC3B,CAAC;CACJ;AAED,SAAS,aAAa,CAAC,KAAc;IACjC,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gateway discovery-mode dispatch — handles `{ tool }`-only invocations
|
|
3
|
+
* by returning the target tool's description, JSON-schema, and
|
|
4
|
+
* annotations. Never invokes the target handler.
|
|
5
|
+
*
|
|
6
|
+
* Round-2 (R2-A2-CRIT2) extracted from `gateway/advanced-tool.ts`.
|
|
7
|
+
*
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
11
|
+
import { type ZodRawShape } from 'zod';
|
|
12
|
+
import type { AdvancedToolEntry } from '../capturing-server.js';
|
|
13
|
+
/** Reads the captured config's inputSchema as a Zod raw-shape (or empty). */
|
|
14
|
+
export declare function shapeOf(entry: AdvancedToolEntry): ZodRawShape;
|
|
15
|
+
/** Builds a JSON-schema for a captured tool's inputs, with a defensive fallback. */
|
|
16
|
+
export declare function inputSchemaJson(entry: AdvancedToolEntry): unknown;
|
|
17
|
+
/** Builds the discovery-mode result for a target tool. */
|
|
18
|
+
export declare function discoveryResult(toolName: string, entry: AdvancedToolEntry): CallToolResult;
|
|
19
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/gateway/advanced-tool/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAK,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,6EAA6E;AAC7E,wBAAgB,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,WAAW,CAI7D;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAQjE;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,cAAc,CA0B1F"}
|