@wootsup/yt-builder-mcp 1.0.0 → 1.0.1
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/manifest.json +1 -1
- package/package.json +1 -1
- package/skills/{yootheme-builder → yt-builder-mcp}/SKILL.md +1 -1
- package/dist/auth.d.ts +0 -39
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -93
- package/dist/auth.js.map +0 -1
- package/dist/client.d.ts +0 -84
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -151
- package/dist/client.js.map +0 -1
- package/dist/clients/claude-code.d.ts +0 -18
- package/dist/clients/claude-code.d.ts.map +0 -1
- package/dist/clients/claude-code.js +0 -53
- package/dist/clients/claude-code.js.map +0 -1
- package/dist/clients/claude-desktop.d.ts +0 -19
- package/dist/clients/claude-desktop.d.ts.map +0 -1
- package/dist/clients/claude-desktop.js +0 -56
- package/dist/clients/claude-desktop.js.map +0 -1
- package/dist/clients/cline.d.ts +0 -26
- package/dist/clients/cline.d.ts.map +0 -1
- package/dist/clients/cline.js +0 -80
- package/dist/clients/cline.js.map +0 -1
- package/dist/clients/codex-cli.d.ts +0 -42
- package/dist/clients/codex-cli.d.ts.map +0 -1
- package/dist/clients/codex-cli.js +0 -194
- package/dist/clients/codex-cli.js.map +0 -1
- package/dist/clients/continue.d.ts +0 -13
- package/dist/clients/continue.d.ts.map +0 -1
- package/dist/clients/continue.js +0 -52
- package/dist/clients/continue.js.map +0 -1
- package/dist/clients/cursor.d.ts +0 -12
- package/dist/clients/cursor.d.ts.map +0 -1
- package/dist/clients/cursor.js +0 -38
- package/dist/clients/cursor.js.map +0 -1
- package/dist/clients/gemini-cli.d.ts +0 -18
- package/dist/clients/gemini-cli.d.ts.map +0 -1
- package/dist/clients/gemini-cli.js +0 -44
- package/dist/clients/gemini-cli.js.map +0 -1
- package/dist/clients/home.d.ts +0 -14
- package/dist/clients/home.d.ts.map +0 -1
- package/dist/clients/home.js +0 -20
- package/dist/clients/home.js.map +0 -1
- package/dist/clients/index.d.ts +0 -52
- package/dist/clients/index.d.ts.map +0 -1
- package/dist/clients/index.js +0 -72
- package/dist/clients/index.js.map +0 -1
- package/dist/clients/roo-code.d.ts +0 -23
- package/dist/clients/roo-code.d.ts.map +0 -1
- package/dist/clients/roo-code.js +0 -69
- package/dist/clients/roo-code.js.map +0 -1
- package/dist/clients/zed.d.ts +0 -12
- package/dist/clients/zed.d.ts.map +0 -1
- package/dist/clients/zed.js +0 -41
- package/dist/clients/zed.js.map +0 -1
- package/dist/errors/hints.d.ts +0 -51
- package/dist/errors/hints.d.ts.map +0 -1
- package/dist/errors/hints.js +0 -95
- package/dist/errors/hints.js.map +0 -1
- package/dist/errors/mask.d.ts +0 -35
- package/dist/errors/mask.d.ts.map +0 -1
- package/dist/errors/mask.js +0 -49
- package/dist/errors/mask.js.map +0 -1
- package/dist/errors/sanitize.d.ts +0 -31
- package/dist/errors/sanitize.d.ts.map +0 -1
- package/dist/errors/sanitize.js +0 -90
- package/dist/errors/sanitize.js.map +0 -1
- package/dist/errors.d.ts +0 -42
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -61
- package/dist/errors.js.map +0 -1
- package/dist/gateway/advanced-tool/discovery.d.ts +0 -19
- package/dist/gateway/advanced-tool/discovery.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/discovery.js +0 -53
- package/dist/gateway/advanced-tool/discovery.js.map +0 -1
- package/dist/gateway/advanced-tool/domains.d.ts +0 -47
- package/dist/gateway/advanced-tool/domains.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/domains.js +0 -94
- package/dist/gateway/advanced-tool/domains.js.map +0 -1
- package/dist/gateway/advanced-tool/execute.d.ts +0 -29
- package/dist/gateway/advanced-tool/execute.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/execute.js +0 -54
- package/dist/gateway/advanced-tool/execute.js.map +0 -1
- package/dist/gateway/advanced-tool/index.d.ts +0 -36
- package/dist/gateway/advanced-tool/index.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/index.js +0 -39
- package/dist/gateway/advanced-tool/index.js.map +0 -1
- package/dist/gateway/advanced-tool/register.d.ts +0 -18
- package/dist/gateway/advanced-tool/register.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/register.js +0 -69
- package/dist/gateway/advanced-tool/register.js.map +0 -1
- package/dist/gateway/advanced-tool.d.ts +0 -13
- package/dist/gateway/advanced-tool.d.ts.map +0 -1
- package/dist/gateway/advanced-tool.js +0 -13
- package/dist/gateway/advanced-tool.js.map +0 -1
- package/dist/gateway/capturing-server.d.ts +0 -117
- package/dist/gateway/capturing-server.d.ts.map +0 -1
- package/dist/gateway/capturing-server.js +0 -103
- package/dist/gateway/capturing-server.js.map +0 -1
- package/dist/gateway/essentials.d.ts +0 -49
- package/dist/gateway/essentials.d.ts.map +0 -1
- package/dist/gateway/essentials.js +0 -79
- package/dist/gateway/essentials.js.map +0 -1
- package/dist/gateway/test-support.d.ts +0 -41
- package/dist/gateway/test-support.d.ts.map +0 -1
- package/dist/gateway/test-support.js +0 -60
- package/dist/gateway/test-support.js.map +0 -1
- package/dist/index.d.ts +0 -25
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -77
- package/dist/index.js.map +0 -1
- package/dist/install-skill.d.ts +0 -35
- package/dist/install-skill.d.ts.map +0 -1
- package/dist/install-skill.js +0 -107
- package/dist/install-skill.js.map +0 -1
- package/dist/platform/index.d.ts +0 -49
- package/dist/platform/index.d.ts.map +0 -1
- package/dist/platform/index.js +0 -38
- package/dist/platform/index.js.map +0 -1
- package/dist/server.d.ts +0 -50
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -153
- package/dist/server.js.map +0 -1
- package/dist/setup-cli.d.ts +0 -100
- package/dist/setup-cli.d.ts.map +0 -1
- package/dist/setup-cli.js +0 -355
- package/dist/setup-cli.js.map +0 -1
- package/dist/setup-prompts.d.ts +0 -41
- package/dist/setup-prompts.d.ts.map +0 -1
- package/dist/setup-prompts.js +0 -142
- package/dist/setup-prompts.js.map +0 -1
- package/dist/setup-token.d.ts +0 -38
- package/dist/setup-token.d.ts.map +0 -1
- package/dist/setup-token.js +0 -106
- package/dist/setup-token.js.map +0 -1
- package/dist/setup-wizard-defaults.d.ts +0 -43
- package/dist/setup-wizard-defaults.d.ts.map +0 -1
- package/dist/setup-wizard-defaults.js +0 -160
- package/dist/setup-wizard-defaults.js.map +0 -1
- package/dist/setup-wizard-handshake.d.ts +0 -25
- package/dist/setup-wizard-handshake.d.ts.map +0 -1
- package/dist/setup-wizard-handshake.js +0 -103
- package/dist/setup-wizard-handshake.js.map +0 -1
- package/dist/setup-wizard-types.d.ts +0 -148
- package/dist/setup-wizard-types.d.ts.map +0 -1
- package/dist/setup-wizard-types.js +0 -11
- package/dist/setup-wizard-types.js.map +0 -1
- package/dist/setup-wizard.d.ts +0 -33
- package/dist/setup-wizard.d.ts.map +0 -1
- package/dist/setup-wizard.js +0 -166
- package/dist/setup-wizard.js.map +0 -1
- package/dist/setup.d.ts +0 -17
- package/dist/setup.d.ts.map +0 -1
- package/dist/setup.js +0 -33
- package/dist/setup.js.map +0 -1
- package/dist/skill-loader.d.ts +0 -51
- package/dist/skill-loader.d.ts.map +0 -1
- package/dist/skill-loader.js +0 -78
- package/dist/skill-loader.js.map +0 -1
- package/dist/tools/elements/builders.d.ts +0 -24
- package/dist/tools/elements/builders.d.ts.map +0 -1
- package/dist/tools/elements/builders.js +0 -177
- package/dist/tools/elements/builders.js.map +0 -1
- package/dist/tools/elements/handlers-write.d.ts +0 -49
- package/dist/tools/elements/handlers-write.d.ts.map +0 -1
- package/dist/tools/elements/handlers-write.js +0 -148
- package/dist/tools/elements/handlers-write.js.map +0 -1
- package/dist/tools/elements/handlers.d.ts +0 -61
- package/dist/tools/elements/handlers.d.ts.map +0 -1
- package/dist/tools/elements/handlers.js +0 -170
- package/dist/tools/elements/handlers.js.map +0 -1
- package/dist/tools/elements/index.d.ts +0 -28
- package/dist/tools/elements/index.d.ts.map +0 -1
- package/dist/tools/elements/index.js +0 -27
- package/dist/tools/elements/index.js.map +0 -1
- package/dist/tools/elements.d.ts +0 -13
- package/dist/tools/elements.d.ts.map +0 -1
- package/dist/tools/elements.js +0 -13
- package/dist/tools/elements.js.map +0 -1
- package/dist/tools/elicitation.d.ts +0 -87
- package/dist/tools/elicitation.d.ts.map +0 -1
- package/dist/tools/elicitation.js +0 -100
- package/dist/tools/elicitation.js.map +0 -1
- package/dist/tools/format/elements-format.d.ts +0 -40
- package/dist/tools/format/elements-format.d.ts.map +0 -1
- package/dist/tools/format/elements-format.js +0 -194
- package/dist/tools/format/elements-format.js.map +0 -1
- package/dist/tools/format/health-format.d.ts +0 -73
- package/dist/tools/format/health-format.d.ts.map +0 -1
- package/dist/tools/format/health-format.js +0 -178
- package/dist/tools/format/health-format.js.map +0 -1
- package/dist/tools/format/inspection-format.d.ts +0 -58
- package/dist/tools/format/inspection-format.d.ts.map +0 -1
- package/dist/tools/format/inspection-format.js +0 -164
- package/dist/tools/format/inspection-format.js.map +0 -1
- package/dist/tools/format/pages-format.d.ts +0 -42
- package/dist/tools/format/pages-format.d.ts.map +0 -1
- package/dist/tools/format/pages-format.js +0 -113
- package/dist/tools/format/pages-format.js.map +0 -1
- package/dist/tools/format/sources-format.d.ts +0 -25
- package/dist/tools/format/sources-format.d.ts.map +0 -1
- package/dist/tools/format/sources-format.js +0 -208
- package/dist/tools/format/sources-format.js.map +0 -1
- package/dist/tools/health.d.ts +0 -22
- package/dist/tools/health.d.ts.map +0 -1
- package/dist/tools/health.js +0 -147
- package/dist/tools/health.js.map +0 -1
- package/dist/tools/index.d.ts +0 -23
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -25
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/inspection.d.ts +0 -14
- package/dist/tools/inspection.d.ts.map +0 -1
- package/dist/tools/inspection.js +0 -125
- package/dist/tools/inspection.js.map +0 -1
- package/dist/tools/layout-flatten.d.ts +0 -75
- package/dist/tools/layout-flatten.d.ts.map +0 -1
- package/dist/tools/layout-flatten.js +0 -107
- package/dist/tools/layout-flatten.js.map +0 -1
- package/dist/tools/multi-items/builders.d.ts +0 -23
- package/dist/tools/multi-items/builders.d.ts.map +0 -1
- package/dist/tools/multi-items/builders.js +0 -56
- package/dist/tools/multi-items/builders.js.map +0 -1
- package/dist/tools/multi-items/clean-implode-handler.d.ts +0 -28
- package/dist/tools/multi-items/clean-implode-handler.d.ts.map +0 -1
- package/dist/tools/multi-items/clean-implode-handler.js +0 -40
- package/dist/tools/multi-items/clean-implode-handler.js.map +0 -1
- package/dist/tools/multi-items/index.d.ts +0 -18
- package/dist/tools/multi-items/index.d.ts.map +0 -1
- package/dist/tools/multi-items/index.js +0 -18
- package/dist/tools/multi-items/index.js.map +0 -1
- package/dist/tools/multi-items/inspect-handler.d.ts +0 -41
- package/dist/tools/multi-items/inspect-handler.d.ts.map +0 -1
- package/dist/tools/multi-items/inspect-handler.js +0 -50
- package/dist/tools/multi-items/inspect-handler.js.map +0 -1
- package/dist/tools/multi-items/item-container-map.d.ts +0 -41
- package/dist/tools/multi-items/item-container-map.d.ts.map +0 -1
- package/dist/tools/multi-items/item-container-map.js +0 -73
- package/dist/tools/multi-items/item-container-map.js.map +0 -1
- package/dist/tools/pages/builders.d.ts +0 -14
- package/dist/tools/pages/builders.d.ts.map +0 -1
- package/dist/tools/pages/builders.js +0 -115
- package/dist/tools/pages/builders.js.map +0 -1
- package/dist/tools/pages/handlers-read.d.ts +0 -33
- package/dist/tools/pages/handlers-read.d.ts.map +0 -1
- package/dist/tools/pages/handlers-read.js +0 -161
- package/dist/tools/pages/handlers-read.js.map +0 -1
- package/dist/tools/pages/handlers-write.d.ts +0 -21
- package/dist/tools/pages/handlers-write.d.ts.map +0 -1
- package/dist/tools/pages/handlers-write.js +0 -52
- package/dist/tools/pages/handlers-write.js.map +0 -1
- package/dist/tools/pages/index.d.ts +0 -17
- package/dist/tools/pages/index.d.ts.map +0 -1
- package/dist/tools/pages/index.js +0 -17
- package/dist/tools/pages/index.js.map +0 -1
- package/dist/tools/pages/schemas.d.ts +0 -30
- package/dist/tools/pages/schemas.d.ts.map +0 -1
- package/dist/tools/pages/schemas.js +0 -30
- package/dist/tools/pages/schemas.js.map +0 -1
- package/dist/tools/pages.d.ts +0 -13
- package/dist/tools/pages.d.ts.map +0 -1
- package/dist/tools/pages.js +0 -13
- package/dist/tools/pages.js.map +0 -1
- package/dist/tools/progress-phases.d.ts +0 -46
- package/dist/tools/progress-phases.d.ts.map +0 -1
- package/dist/tools/progress-phases.js +0 -48
- package/dist/tools/progress-phases.js.map +0 -1
- package/dist/tools/shared-schemas.d.ts +0 -15
- package/dist/tools/shared-schemas.d.ts.map +0 -1
- package/dist/tools/shared-schemas.js +0 -30
- package/dist/tools/shared-schemas.js.map +0 -1
- package/dist/tools/sources/builders.d.ts +0 -13
- package/dist/tools/sources/builders.d.ts.map +0 -1
- package/dist/tools/sources/builders.js +0 -103
- package/dist/tools/sources/builders.js.map +0 -1
- package/dist/tools/sources/handlers-bind.d.ts +0 -28
- package/dist/tools/sources/handlers-bind.d.ts.map +0 -1
- package/dist/tools/sources/handlers-bind.js +0 -129
- package/dist/tools/sources/handlers-bind.js.map +0 -1
- package/dist/tools/sources/handlers.d.ts +0 -45
- package/dist/tools/sources/handlers.d.ts.map +0 -1
- package/dist/tools/sources/handlers.js +0 -91
- package/dist/tools/sources/handlers.js.map +0 -1
- package/dist/tools/sources/index.d.ts +0 -19
- package/dist/tools/sources/index.d.ts.map +0 -1
- package/dist/tools/sources/index.js +0 -18
- package/dist/tools/sources/index.js.map +0 -1
- package/dist/tools/sources.d.ts +0 -14
- package/dist/tools/sources.d.ts.map +0 -1
- package/dist/tools/sources.js +0 -14
- package/dist/tools/sources.js.map +0 -1
- package/dist/tools/sparse-fields.d.ts +0 -80
- package/dist/tools/sparse-fields.d.ts.map +0 -1
- package/dist/tools/sparse-fields.js +0 -144
- package/dist/tools/sparse-fields.js.map +0 -1
- package/dist/tools/tool-builder/annotations.d.ts +0 -55
- package/dist/tools/tool-builder/annotations.d.ts.map +0 -1
- package/dist/tools/tool-builder/annotations.js +0 -86
- package/dist/tools/tool-builder/annotations.js.map +0 -1
- package/dist/tools/tool-builder/define.d.ts +0 -31
- package/dist/tools/tool-builder/define.d.ts.map +0 -1
- package/dist/tools/tool-builder/define.js +0 -31
- package/dist/tools/tool-builder/define.js.map +0 -1
- package/dist/tools/tool-builder/index.d.ts +0 -28
- package/dist/tools/tool-builder/index.d.ts.map +0 -1
- package/dist/tools/tool-builder/index.js +0 -27
- package/dist/tools/tool-builder/index.js.map +0 -1
- package/dist/tools/tool-builder/results.d.ts +0 -59
- package/dist/tools/tool-builder/results.d.ts.map +0 -1
- package/dist/tools/tool-builder/results.js +0 -125
- package/dist/tools/tool-builder/results.js.map +0 -1
- package/dist/tools/tool-builder/types.d.ts +0 -82
- package/dist/tools/tool-builder/types.d.ts.map +0 -1
- package/dist/tools/tool-builder/types.js +0 -9
- package/dist/tools/tool-builder/types.js.map +0 -1
- package/dist/tools/tool-builder.d.ts +0 -16
- package/dist/tools/tool-builder.d.ts.map +0 -1
- package/dist/tools/tool-builder.js +0 -16
- package/dist/tools/tool-builder.js.map +0 -1
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Element-tool write handlers (add/update/move/clone/delete).
|
|
3
|
-
*
|
|
4
|
-
* Wave G.4.0 split: read handlers + shared types in `./handlers.ts`.
|
|
5
|
-
* Wave G.4.1: `handleElementDelete` consults `deps.elicitation` when
|
|
6
|
-
* `confirm` is undefined — falls back to the explicit preview when
|
|
7
|
-
* elicitation is unavailable.
|
|
8
|
-
* Wave G.5: every handler emits 2-phase client-side progress
|
|
9
|
-
* (`PHASE_SEND` → `PHASE_CONFIRM`) when the caller supplied a
|
|
10
|
-
* `progressToken` — see `../progress-phases.ts` for the contract.
|
|
11
|
-
*
|
|
12
|
-
* @license MIT
|
|
13
|
-
*/
|
|
14
|
-
import { type HandlerExtra, type ToolResult } from '../tool-builder.js';
|
|
15
|
-
import type { ElementsHandlerDeps } from './handlers.js';
|
|
16
|
-
export declare function handleElementAdd({ client }: ElementsHandlerDeps, input: {
|
|
17
|
-
template_id: string;
|
|
18
|
-
parent_path: string;
|
|
19
|
-
element_type: string;
|
|
20
|
-
props?: Record<string, unknown>;
|
|
21
|
-
children?: Record<string, unknown>[];
|
|
22
|
-
etag: string;
|
|
23
|
-
}, extra?: HandlerExtra): Promise<ToolResult>;
|
|
24
|
-
export declare function handleElementUpdateSettings({ client }: ElementsHandlerDeps, input: {
|
|
25
|
-
template_id: string;
|
|
26
|
-
element_path: string;
|
|
27
|
-
props: Record<string, unknown>;
|
|
28
|
-
merge?: boolean;
|
|
29
|
-
etag: string;
|
|
30
|
-
}, extra?: HandlerExtra): Promise<ToolResult>;
|
|
31
|
-
export declare function handleElementMove({ client }: ElementsHandlerDeps, input: {
|
|
32
|
-
template_id: string;
|
|
33
|
-
element_path: string;
|
|
34
|
-
to_parent_path: string;
|
|
35
|
-
to_index: number;
|
|
36
|
-
etag: string;
|
|
37
|
-
}, extra?: HandlerExtra): Promise<ToolResult>;
|
|
38
|
-
export declare function handleElementClone({ client }: ElementsHandlerDeps, input: {
|
|
39
|
-
template_id: string;
|
|
40
|
-
element_path: string;
|
|
41
|
-
etag: string;
|
|
42
|
-
}, extra?: HandlerExtra): Promise<ToolResult>;
|
|
43
|
-
export declare function handleElementDelete({ client, elicitation }: ElementsHandlerDeps, input: {
|
|
44
|
-
template_id: string;
|
|
45
|
-
element_path: string;
|
|
46
|
-
etag: string;
|
|
47
|
-
confirm?: boolean;
|
|
48
|
-
}, extra?: HandlerExtra): Promise<ToolResult>;
|
|
49
|
-
//# sourceMappingURL=handlers-write.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers-write.d.ts","sourceRoot":"","sources":["../../../src/tools/elements/handlers-write.ts"],"names":[],"mappings":"AAAA;;;;;;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AAE,MAAM,EAAE,EAAE,mBAAmB,EAC/B,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAClE,KAAK,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,UAAU,CAAC,CAmBrB;AAiCD,wBAAsB,mBAAmB,CACrC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,mBAAmB,EAC5C,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,EACrF,KAAK,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,UAAU,CAAC,CAwBrB"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Element-tool write handlers (add/update/move/clone/delete).
|
|
3
|
-
*
|
|
4
|
-
* Wave G.4.0 split: read handlers + shared types in `./handlers.ts`.
|
|
5
|
-
* Wave G.4.1: `handleElementDelete` consults `deps.elicitation` when
|
|
6
|
-
* `confirm` is undefined — falls back to the explicit preview when
|
|
7
|
-
* elicitation is unavailable.
|
|
8
|
-
* Wave G.5: every handler emits 2-phase client-side progress
|
|
9
|
-
* (`PHASE_SEND` → `PHASE_CONFIRM`) when the caller supplied a
|
|
10
|
-
* `progressToken` — see `../progress-phases.ts` for the contract.
|
|
11
|
-
*
|
|
12
|
-
* @license MIT
|
|
13
|
-
*/
|
|
14
|
-
import { elicitConfirmation } from '@getimo/mcp-toolkit';
|
|
15
|
-
import { encodeElementPath } from '../../client.js';
|
|
16
|
-
import { PHASE_CONFIRM, PHASE_SEND } from '../progress-phases.js';
|
|
17
|
-
import { confirmGuard, createProgressReporter, errorResult, jsonResult, } from '../tool-builder.js';
|
|
18
|
-
// ─── element_add ─────────────────────────────────────────────────────
|
|
19
|
-
export async function handleElementAdd({ client }, input, extra) {
|
|
20
|
-
const { template_id, etag, ...body } = input;
|
|
21
|
-
const progress = extra ? createProgressReporter(extra) : null;
|
|
22
|
-
await progress?.report(0, 2, PHASE_SEND);
|
|
23
|
-
try {
|
|
24
|
-
const data = await client.post(`/pages/${encodeURIComponent(template_id)}/elements`, { body, etag });
|
|
25
|
-
await progress?.report(2, 2, PHASE_CONFIRM);
|
|
26
|
-
return jsonResult(data);
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
return errorResult({
|
|
30
|
-
error: e,
|
|
31
|
-
context: input,
|
|
32
|
-
hint: 'On 412 refresh via yootheme_builder_get_etag and retry. On 400 ' +
|
|
33
|
-
'check `element_type` is valid via yootheme_builder_element_types_list.',
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// ─── element_update_settings ─────────────────────────────────────────
|
|
38
|
-
export async function handleElementUpdateSettings({ client }, input, extra) {
|
|
39
|
-
const { template_id, element_path, props, merge, etag } = input;
|
|
40
|
-
const encoded = encodeElementPath(element_path);
|
|
41
|
-
const progress = extra ? createProgressReporter(extra) : null;
|
|
42
|
-
await progress?.report(0, 2, PHASE_SEND);
|
|
43
|
-
try {
|
|
44
|
-
// T5 / F-12: forward `merge` only when explicitly true so older PHP
|
|
45
|
-
// builds (which ignore unknown keys anyway) get the same byte-for-
|
|
46
|
-
// byte body they did before.
|
|
47
|
-
const body = { props };
|
|
48
|
-
if (merge === true) {
|
|
49
|
-
body.merge = true;
|
|
50
|
-
}
|
|
51
|
-
const data = await client.put(`/pages/${encodeURIComponent(template_id)}/elements/${encoded}/settings`, { body, etag });
|
|
52
|
-
await progress?.report(2, 2, PHASE_CONFIRM);
|
|
53
|
-
return jsonResult(data);
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
return errorResult({
|
|
57
|
-
error: e,
|
|
58
|
-
context: { template_id, element_path },
|
|
59
|
-
hint: 'On 412 refresh via yootheme_builder_get_etag and retry. To merge ' +
|
|
60
|
-
'props instead of replacing, pass `merge:true` (server deep-merges ' +
|
|
61
|
-
'the request into current props).',
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// ─── element_move ────────────────────────────────────────────────────
|
|
66
|
-
export async function handleElementMove({ client }, input, extra) {
|
|
67
|
-
const { template_id, element_path, to_parent_path, to_index, etag } = input;
|
|
68
|
-
const encoded = encodeElementPath(element_path);
|
|
69
|
-
const progress = extra ? createProgressReporter(extra) : null;
|
|
70
|
-
await progress?.report(0, 2, PHASE_SEND);
|
|
71
|
-
try {
|
|
72
|
-
const data = await client.post(`/pages/${encodeURIComponent(template_id)}/elements/${encoded}/move`, { body: { to_parent_path, to_index }, etag });
|
|
73
|
-
await progress?.report(2, 2, PHASE_CONFIRM);
|
|
74
|
-
return jsonResult(data);
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
return errorResult({
|
|
78
|
-
error: e,
|
|
79
|
-
context: { template_id, element_path, to_parent_path, to_index },
|
|
80
|
-
hint: 'Verify destination parent accepts the element type. On 412 refresh ' +
|
|
81
|
-
'ETag and retry.',
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
// ─── element_clone ───────────────────────────────────────────────────
|
|
86
|
-
export async function handleElementClone({ client }, input, extra) {
|
|
87
|
-
const { template_id, element_path, etag } = input;
|
|
88
|
-
const encoded = encodeElementPath(element_path);
|
|
89
|
-
const progress = extra ? createProgressReporter(extra) : null;
|
|
90
|
-
await progress?.report(0, 2, PHASE_SEND);
|
|
91
|
-
try {
|
|
92
|
-
const data = await client.post(`/pages/${encodeURIComponent(template_id)}/elements/${encoded}/clone`, { etag });
|
|
93
|
-
await progress?.report(2, 2, PHASE_CONFIRM);
|
|
94
|
-
return jsonResult(data);
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
return errorResult({
|
|
98
|
-
error: e,
|
|
99
|
-
context: { template_id, element_path },
|
|
100
|
-
hint: 'On 412 refresh via yootheme_builder_get_etag and retry.',
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// ─── element_delete (destructive — elicitation + confirm-guard) ─────
|
|
105
|
-
//
|
|
106
|
-
// Wave G.4.1 — destructive confirm via MCP elicitation. Progress
|
|
107
|
-
// reports (Wave G.5) only start AFTER the confirm gate clears.
|
|
108
|
-
async function resolveDeleteConfirm(elicitation, template_id, element_path, confirm) {
|
|
109
|
-
if (confirm === true)
|
|
110
|
-
return null;
|
|
111
|
-
if (confirm === false || !elicitation) {
|
|
112
|
-
return confirmGuard({
|
|
113
|
-
operation: 'delete element',
|
|
114
|
-
details: { template_id, element_path },
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
const accepted = await elicitConfirmation(elicitation, `Permanently delete element at "${element_path}" in template ` +
|
|
118
|
-
`"${template_id}"? This cannot be undone.`);
|
|
119
|
-
return accepted
|
|
120
|
-
? null
|
|
121
|
-
: confirmGuard({
|
|
122
|
-
operation: 'delete element',
|
|
123
|
-
details: { template_id, element_path },
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
export async function handleElementDelete({ client, elicitation }, input, extra) {
|
|
127
|
-
const { template_id, element_path, etag, confirm } = input;
|
|
128
|
-
const blocked = await resolveDeleteConfirm(elicitation, template_id, element_path, confirm);
|
|
129
|
-
if (blocked)
|
|
130
|
-
return blocked;
|
|
131
|
-
const encoded = encodeElementPath(element_path);
|
|
132
|
-
const progress = extra ? createProgressReporter(extra) : null;
|
|
133
|
-
await progress?.report(0, 2, PHASE_SEND);
|
|
134
|
-
try {
|
|
135
|
-
const data = await client.delete(`/pages/${encodeURIComponent(template_id)}/elements/${encoded}`, { etag });
|
|
136
|
-
await progress?.report(2, 2, PHASE_CONFIRM);
|
|
137
|
-
return jsonResult(data);
|
|
138
|
-
}
|
|
139
|
-
catch (e) {
|
|
140
|
-
return errorResult({
|
|
141
|
-
error: e,
|
|
142
|
-
context: { template_id, element_path },
|
|
143
|
-
hint: 'On 412 refresh via yootheme_builder_get_etag and retry. On 404 the ' +
|
|
144
|
-
'element may already be gone — verify with yootheme_builder_element_list.',
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
//# sourceMappingURL=handlers-write.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers-write.js","sourceRoot":"","sources":["../../../src/tools/elements/handlers-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EACH,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,UAAU,GAGb,MAAM,oBAAoB,CAAC;AAG5B,wEAAwE;AAExE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,EAAE,MAAM,EAAuB,EAC/B,KAOC,EACD,KAAoB;IAEpB,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC7C,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,MAAM,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IACzC,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAC1B,UAAU,kBAAkB,CAAC,WAAW,CAAC,WAAW,EACpD,EAAE,IAAI,EAAE,IAAI,EAAE,CACjB,CAAC;QACF,MAAM,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IA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I,EACA,qEAAqE;gBACrE,0EAA0E;SACjF,CAAC,CAAC;IACP,CAAC;AACL,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Element-tool read handlers + shared types/schemas.
|
|
3
|
-
*
|
|
4
|
-
* Split out of the original `src/tools/elements.ts` (Wave G.4.0). Write
|
|
5
|
-
* handlers (add/update/move/clone/delete) live in `./handlers-write.ts`
|
|
6
|
-
* to keep each file under the 200-LoC budget.
|
|
7
|
-
*
|
|
8
|
-
* Handler responsibilities:
|
|
9
|
-
* - call the REST endpoint via `deps.client`,
|
|
10
|
-
* - map REST data to the toolkit output builders (`tableResult`,
|
|
11
|
-
* `detailResult`),
|
|
12
|
-
* - wrap in `structuredResult` to carry the typed
|
|
13
|
-
* `structuredContent` payload,
|
|
14
|
-
* - on error, return `errorResult` with `context` + `hint`.
|
|
15
|
-
*
|
|
16
|
-
* @license MIT
|
|
17
|
-
*/
|
|
18
|
-
import { z } from 'zod';
|
|
19
|
-
import { type RestClient } from '../../client.js';
|
|
20
|
-
import type { McpServerWithElicitation } from '../elicitation.js';
|
|
21
|
-
import { type ToolResult } from '../tool-builder.js';
|
|
22
|
-
export declare const ELEMENT_LIST_OUTPUT_SCHEMA: z.ZodObject<{
|
|
23
|
-
items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
24
|
-
total: z.ZodNumber;
|
|
25
|
-
template_id: z.ZodString;
|
|
26
|
-
next_cursor: z.ZodOptional<z.ZodString>;
|
|
27
|
-
projected_fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
|
-
}, z.core.$strip>;
|
|
29
|
-
export declare const ELEMENT_GET_OUTPUT_SCHEMA: z.ZodObject<{
|
|
30
|
-
template_id: z.ZodString;
|
|
31
|
-
element_path: z.ZodString;
|
|
32
|
-
element_type: z.ZodString;
|
|
33
|
-
label: z.ZodOptional<z.ZodString>;
|
|
34
|
-
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
35
|
-
children_count: z.ZodNumber;
|
|
36
|
-
}, z.core.$strip>;
|
|
37
|
-
export interface ElementsHandlerDeps {
|
|
38
|
-
readonly client: RestClient;
|
|
39
|
-
/**
|
|
40
|
-
* Optional MCP elicitation capability. When present, destructive
|
|
41
|
-
* tools (`element_delete`) prompt the user for confirmation via the
|
|
42
|
-
* elicitation channel instead of demanding an explicit
|
|
43
|
-
* `confirm: true` round-trip. When absent, tools fall back to the
|
|
44
|
-
* preview-then-retry flow.
|
|
45
|
-
*/
|
|
46
|
-
readonly elicitation?: McpServerWithElicitation;
|
|
47
|
-
}
|
|
48
|
-
export declare function handleElementList({ client }: ElementsHandlerDeps, { template_id, fields, root_path, depth, limit, cursor, }: {
|
|
49
|
-
template_id: string;
|
|
50
|
-
fields?: readonly string[];
|
|
51
|
-
root_path?: string;
|
|
52
|
-
depth?: number;
|
|
53
|
-
limit?: number;
|
|
54
|
-
cursor?: string;
|
|
55
|
-
}): Promise<ToolResult>;
|
|
56
|
-
export declare function handleElementGet({ client }: ElementsHandlerDeps, { template_id, element_path }: {
|
|
57
|
-
template_id: string;
|
|
58
|
-
element_path: string;
|
|
59
|
-
}): Promise<ToolResult>;
|
|
60
|
-
export { handleElementAdd, handleElementClone, handleElementDelete, handleElementMove, handleElementUpdateSettings, } from './handlers-write.js';
|
|
61
|
-
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/tools/elements/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAYlE,OAAO,EAGH,KAAK,UAAU,EAClB,MAAM,oBAAoB,CAAC;AAI5B,eAAO,MAAM,0BAA0B;;;;;;iBAOrC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;iBAOpC,CAAC;AAIH,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACnD;AAyBD,wBAAsB,iBAAiB,CACnC,EAAE,MAAM,EAAE,EAAE,mBAAmB,EAC/B,EACI,WAAW,EACX,MAAM,EACN,SAAS,EACT,KAAK,EACL,KAAK,EACL,MAAM,GACT,EAAE;IACC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,GACF,OAAO,CAAC,UAAU,CAAC,CA4ErB;AAID,wBAAsB,gBAAgB,CAClC,EAAE,MAAM,EAAE,EAAE,mBAAmB,EAC/B,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC7E,OAAO,CAAC,UAAU,CAAC,CA8CrB;AAGD,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,GAC9B,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Element-tool read handlers + shared types/schemas.
|
|
3
|
-
*
|
|
4
|
-
* Split out of the original `src/tools/elements.ts` (Wave G.4.0). Write
|
|
5
|
-
* handlers (add/update/move/clone/delete) live in `./handlers-write.ts`
|
|
6
|
-
* to keep each file under the 200-LoC budget.
|
|
7
|
-
*
|
|
8
|
-
* Handler responsibilities:
|
|
9
|
-
* - call the REST endpoint via `deps.client`,
|
|
10
|
-
* - map REST data to the toolkit output builders (`tableResult`,
|
|
11
|
-
* `detailResult`),
|
|
12
|
-
* - wrap in `structuredResult` to carry the typed
|
|
13
|
-
* `structuredContent` payload,
|
|
14
|
-
* - on error, return `errorResult` with `context` + `hint`.
|
|
15
|
-
*
|
|
16
|
-
* @license MIT
|
|
17
|
-
*/
|
|
18
|
-
import { detailResult, tableResult } from '@getimo/mcp-toolkit';
|
|
19
|
-
import { z } from 'zod';
|
|
20
|
-
import { encodeElementPath } from '../../client.js';
|
|
21
|
-
import { ELEMENTS_COMPACT_COLUMNS, ELEMENTS_TABLE_COLUMNS, buildElementDetail, mapElementRow, } from '../format/elements-format.js';
|
|
22
|
-
import { DEFAULT_FIELDS_ELEMENT_LIST, projectFields, projectedFieldsEcho, } from '../sparse-fields.js';
|
|
23
|
-
import { errorResult, structuredResult, } from '../tool-builder.js';
|
|
24
|
-
// ─── outputSchemas (Wave G.2 §4) ─────────────────────────────────────
|
|
25
|
-
export const ELEMENT_LIST_OUTPUT_SCHEMA = z.object({
|
|
26
|
-
items: z.array(z.record(z.string(), z.unknown())),
|
|
27
|
-
total: z.number(),
|
|
28
|
-
template_id: z.string(),
|
|
29
|
-
// N-01: present only when the call was paginated and more rows remain.
|
|
30
|
-
next_cursor: z.string().optional(),
|
|
31
|
-
projected_fields: z.array(z.string()).optional(),
|
|
32
|
-
});
|
|
33
|
-
export const ELEMENT_GET_OUTPUT_SCHEMA = z.object({
|
|
34
|
-
template_id: z.string(),
|
|
35
|
-
element_path: z.string(),
|
|
36
|
-
element_type: z.string(),
|
|
37
|
-
label: z.string().optional(),
|
|
38
|
-
props: z.record(z.string(), z.unknown()).optional(),
|
|
39
|
-
children_count: z.number(),
|
|
40
|
-
});
|
|
41
|
-
// ─── element_list ────────────────────────────────────────────────────
|
|
42
|
-
/**
|
|
43
|
-
* N-01 (Audit v4): build slim text-table columns from a caller-supplied
|
|
44
|
-
* `fields[]` projection. The default compact text table truncates at
|
|
45
|
-
* 2000 chars (~26 of 96 nodes); projecting to a couple of narrow
|
|
46
|
-
* columns lets the FULL node list fit in the 8000-char `full` budget.
|
|
47
|
-
*
|
|
48
|
-
* Width heuristic: paths get a wide column, everything else a modest
|
|
49
|
-
* one. Labels are uppercased for the header to match the toolkit style.
|
|
50
|
-
*/
|
|
51
|
-
function columnsFromFields(fields) {
|
|
52
|
-
return fields.map((key) => {
|
|
53
|
-
const isPath = key === 'path' || key === 'rel_path' || key === 'parent_path';
|
|
54
|
-
return {
|
|
55
|
-
key,
|
|
56
|
-
label: key.replace(/_/g, ' ').toUpperCase(),
|
|
57
|
-
width: isPath ? 48 : 16,
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
export async function handleElementList({ client }, { template_id, fields, root_path, depth, limit, cursor, }) {
|
|
62
|
-
try {
|
|
63
|
-
// N-01 (Audit-v3): forward the transport-safe scoping params as
|
|
64
|
-
// query string. The REST layer returns the pagination envelope
|
|
65
|
-
// `{items, next_cursor, total}` when `limit` is set, else the flat
|
|
66
|
-
// `{elements, total}` shape — handle both.
|
|
67
|
-
const qs = new URLSearchParams();
|
|
68
|
-
if (typeof root_path === 'string' && root_path !== '') {
|
|
69
|
-
qs.set('root_path', root_path);
|
|
70
|
-
}
|
|
71
|
-
if (typeof depth === 'number')
|
|
72
|
-
qs.set('depth', String(depth));
|
|
73
|
-
if (typeof limit === 'number')
|
|
74
|
-
qs.set('limit', String(limit));
|
|
75
|
-
if (typeof cursor === 'string' && cursor !== '')
|
|
76
|
-
qs.set('cursor', cursor);
|
|
77
|
-
const query = qs.toString();
|
|
78
|
-
const data = await client.get(`/pages/${encodeURIComponent(template_id)}/elements${query !== '' ? `?${query}` : ''}`);
|
|
79
|
-
// Paginated envelope uses `items`; flat shape uses `elements`.
|
|
80
|
-
const rawSource = Array.isArray(data.items)
|
|
81
|
-
? data.items
|
|
82
|
-
: Array.isArray(data.elements)
|
|
83
|
-
? data.elements
|
|
84
|
-
: [];
|
|
85
|
-
const mapped = rawSource
|
|
86
|
-
.filter((x) => x !== null && typeof x === 'object')
|
|
87
|
-
.map(mapElementRow);
|
|
88
|
-
const items = projectFields(mapped, fields, DEFAULT_FIELDS_ELEMENT_LIST);
|
|
89
|
-
const echo = projectedFieldsEcho(fields, DEFAULT_FIELDS_ELEMENT_LIST);
|
|
90
|
-
// N-01 (Audit v4): when the caller passes an explicit narrow
|
|
91
|
-
// `fields[]`, render the text table from the projected (slim)
|
|
92
|
-
// rows with `full` detail (8000 chars) so the WHOLE node list
|
|
93
|
-
// survives — the default compact table caps at 2000 chars and
|
|
94
|
-
// hides ~70 of a 96-node template. Without `fields[]` keep the
|
|
95
|
-
// auto-scaling behaviour (full columns, count-driven level).
|
|
96
|
-
const hasNarrowProjection = Array.isArray(fields) && fields.length > 0;
|
|
97
|
-
const toolkitResult = hasNarrowProjection
|
|
98
|
-
? tableResult(items, {
|
|
99
|
-
columns: columnsFromFields(fields),
|
|
100
|
-
header: (count) => `${String(count)} elements in template "${template_id}"`,
|
|
101
|
-
footer: 'Use yootheme_builder_element_get <path> for full data.',
|
|
102
|
-
}, 'full')
|
|
103
|
-
: tableResult(mapped, {
|
|
104
|
-
columns: [...ELEMENTS_TABLE_COLUMNS],
|
|
105
|
-
compactColumns: [...ELEMENTS_COMPACT_COLUMNS],
|
|
106
|
-
header: (count) => `${String(count)} elements in template "${template_id}"`,
|
|
107
|
-
footer: 'Use yootheme_builder_element_get <path> for full data.',
|
|
108
|
-
});
|
|
109
|
-
return structuredResult(toolkitResult, {
|
|
110
|
-
items,
|
|
111
|
-
total: typeof data.total === 'number' ? data.total : items.length,
|
|
112
|
-
template_id,
|
|
113
|
-
...(typeof data.next_cursor === 'string' && data.next_cursor !== ''
|
|
114
|
-
? { next_cursor: data.next_cursor }
|
|
115
|
-
: {}),
|
|
116
|
-
...(echo !== undefined ? { projected_fields: [...echo] } : {}),
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
catch (e) {
|
|
120
|
-
return errorResult({
|
|
121
|
-
error: e,
|
|
122
|
-
context: { template_id },
|
|
123
|
-
hint: 'Verify the template_id via yootheme_builder_pages_list.',
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
// ─── element_get ─────────────────────────────────────────────────────
|
|
128
|
-
export async function handleElementGet({ client }, { template_id, element_path }) {
|
|
129
|
-
const encoded = encodeElementPath(element_path);
|
|
130
|
-
try {
|
|
131
|
-
const data = await client.get(`/pages/${encodeURIComponent(template_id)}/elements/${encoded}`);
|
|
132
|
-
const elementType = typeof data.element_type === 'string'
|
|
133
|
-
? data.element_type
|
|
134
|
-
: typeof data.type === 'string'
|
|
135
|
-
? data.type
|
|
136
|
-
: '';
|
|
137
|
-
const label = typeof data.label === 'string' ? data.label : undefined;
|
|
138
|
-
const propsRaw = data.props;
|
|
139
|
-
const props = propsRaw !== null && typeof propsRaw === 'object'
|
|
140
|
-
? propsRaw
|
|
141
|
-
: undefined;
|
|
142
|
-
const children = Array.isArray(data.children) ? data.children : [];
|
|
143
|
-
const toolkitResult = detailResult(buildElementDetail({
|
|
144
|
-
path: element_path,
|
|
145
|
-
element_type: elementType,
|
|
146
|
-
label,
|
|
147
|
-
props,
|
|
148
|
-
children: children,
|
|
149
|
-
}));
|
|
150
|
-
return structuredResult(toolkitResult, {
|
|
151
|
-
template_id,
|
|
152
|
-
element_path,
|
|
153
|
-
element_type: elementType,
|
|
154
|
-
...(label !== undefined ? { label } : {}),
|
|
155
|
-
...(props !== undefined ? { props } : {}),
|
|
156
|
-
children_count: children.length,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
catch (e) {
|
|
160
|
-
return errorResult({
|
|
161
|
-
error: e,
|
|
162
|
-
context: { template_id, element_path },
|
|
163
|
-
hint: 'Paths are JSON-Pointer style ("/0/children/1"). Use ' +
|
|
164
|
-
'yootheme_builder_element_list to enumerate valid paths.',
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
// Re-export write handlers so callers can import from this barrel.
|
|
169
|
-
export { handleElementAdd, handleElementClone, handleElementDelete, handleElementMove, handleElementUpdateSettings, } from './handlers-write.js';
|
|
170
|
-
//# sourceMappingURL=handlers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../src/tools/elements/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAoB,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAmB,MAAM,iBAAiB,CAAC;AAErE,OAAO,EACH,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,GAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,2BAA2B,EAC3B,aAAa,EACb,mBAAmB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,WAAW,EACX,gBAAgB,GAEnB,MAAM,oBAAoB,CAAC;AAE5B,wEAAwE;AAExE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,uEAAuE;IACvE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBA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B,kBAAkB,CAAC;YACf,IAAI,EAAE,YAAY;YAClB,YAAY,EAAE,WAAW;YACzB,KAAK;YACL,KAAK;YACL,QAAQ,EAAE,QAAqC;SAClD,CAAC,CACL,CAAC;QACF,OAAO,gBAAgB,CAAC,aAAa,EAAE;YACnC,WAAW;YACX,YAAY;YACZ,YAAY,EAAE,WAAW;YACzB,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,cAAc,EAAE,QAAQ,CAAC,MAAM;SAClC,CAAC,CAAC;IACP,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,WAAW,CAAC;YACf,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE;YACtC,IAAI,EACA,sDAAsD;gBACtD,yDAAyD;SAChE,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED,mEAAmE;AACnE,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,GAC9B,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Element-tool barrel — public entry-point for the 7 element tools.
|
|
3
|
-
*
|
|
4
|
-
* yootheme_builder_element_list
|
|
5
|
-
* → list all elements in a template (flat, with paths)
|
|
6
|
-
* yootheme_builder_element_get
|
|
7
|
-
* → fetch one element by JSON-Pointer
|
|
8
|
-
* yootheme_builder_element_add
|
|
9
|
-
* → POST new element
|
|
10
|
-
* yootheme_builder_element_update_settings
|
|
11
|
-
* → PUT props on an existing element
|
|
12
|
-
* yootheme_builder_element_move
|
|
13
|
-
* → relocate within tree
|
|
14
|
-
* yootheme_builder_element_clone
|
|
15
|
-
* → duplicate as sibling
|
|
16
|
-
* yootheme_builder_element_delete (destructive — elicit/confirm)
|
|
17
|
-
*
|
|
18
|
-
* Wave G.4.0 — file split from the monolithic `src/tools/elements.ts`
|
|
19
|
-
* (382 LoC) into `index.ts` (this file, re-exports), `builders.ts`
|
|
20
|
-
* (defineTool factory list, ≤200 LoC), and `handlers.ts` (handler
|
|
21
|
-
* bodies, ≤300 LoC). Tool surface is unchanged — see
|
|
22
|
-
* `tests/tools/elements-split.test.ts` for the snapshot proof.
|
|
23
|
-
*
|
|
24
|
-
* @license MIT
|
|
25
|
-
*/
|
|
26
|
-
export { buildElementsTools } from './builders.js';
|
|
27
|
-
export type { ElementsHandlerDeps } from './handlers.js';
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/elements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Element-tool barrel — public entry-point for the 7 element tools.
|
|
3
|
-
*
|
|
4
|
-
* yootheme_builder_element_list
|
|
5
|
-
* → list all elements in a template (flat, with paths)
|
|
6
|
-
* yootheme_builder_element_get
|
|
7
|
-
* → fetch one element by JSON-Pointer
|
|
8
|
-
* yootheme_builder_element_add
|
|
9
|
-
* → POST new element
|
|
10
|
-
* yootheme_builder_element_update_settings
|
|
11
|
-
* → PUT props on an existing element
|
|
12
|
-
* yootheme_builder_element_move
|
|
13
|
-
* → relocate within tree
|
|
14
|
-
* yootheme_builder_element_clone
|
|
15
|
-
* → duplicate as sibling
|
|
16
|
-
* yootheme_builder_element_delete (destructive — elicit/confirm)
|
|
17
|
-
*
|
|
18
|
-
* Wave G.4.0 — file split from the monolithic `src/tools/elements.ts`
|
|
19
|
-
* (382 LoC) into `index.ts` (this file, re-exports), `builders.ts`
|
|
20
|
-
* (defineTool factory list, ≤200 LoC), and `handlers.ts` (handler
|
|
21
|
-
* bodies, ≤300 LoC). Tool surface is unchanged — see
|
|
22
|
-
* `tests/tools/elements-split.test.ts` for the snapshot proof.
|
|
23
|
-
*
|
|
24
|
-
* @license MIT
|
|
25
|
-
*/
|
|
26
|
-
export { buildElementsTools } from './builders.js';
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/elements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/tools/elements.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backwards-compatible re-export shim.
|
|
3
|
-
*
|
|
4
|
-
* Wave G.4.0 split the original 382-LoC `elements.ts` into
|
|
5
|
-
* `./elements/{index, handlers, builders}.ts`. This shim keeps the
|
|
6
|
-
* legacy import path (`from '../tools/elements.js'`) working for
|
|
7
|
-
* downstream callers and tests. New code should import from
|
|
8
|
-
* `./elements/index.js` directly.
|
|
9
|
-
*
|
|
10
|
-
* @license MIT
|
|
11
|
-
*/
|
|
12
|
-
export { buildElementsTools } from './elements/index.js';
|
|
13
|
-
//# sourceMappingURL=elements.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/tools/elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/tools/elements.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backwards-compatible re-export shim.
|
|
3
|
-
*
|
|
4
|
-
* Wave G.4.0 split the original 382-LoC `elements.ts` into
|
|
5
|
-
* `./elements/{index, handlers, builders}.ts`. This shim keeps the
|
|
6
|
-
* legacy import path (`from '../tools/elements.js'`) working for
|
|
7
|
-
* downstream callers and tests. New code should import from
|
|
8
|
-
* `./elements/index.js` directly.
|
|
9
|
-
*
|
|
10
|
-
* @license MIT
|
|
11
|
-
*/
|
|
12
|
-
export { buildElementsTools } from './elements/index.js';
|
|
13
|
-
//# sourceMappingURL=elements.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/tools/elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Targeted-elicitation support (Wave G.4 — Design §3.4 / §4.18).
|
|
3
|
-
*
|
|
4
|
-
* Three tool sites use elicitation:
|
|
5
|
-
* - element_delete (destructive confirm)
|
|
6
|
-
* - element_unbind_source (destructive confirm)
|
|
7
|
-
* - element_bind_source (ambiguity resolution: ≥2 sources with the
|
|
8
|
-
* same `source_name` → ask the user which one)
|
|
9
|
-
*
|
|
10
|
-
* Architecture mirrors `~/Projekte/wootsup/packages/apimapper-mcp/src/
|
|
11
|
-
* modules/apimapper/elicitation.ts` (the reference Goldstandard impl):
|
|
12
|
-
*
|
|
13
|
-
* 1. `toElicitationCapability(server)` — typed adapter that bridges the
|
|
14
|
-
* SDK's stricter discriminated `ElicitRequestFormParams` to the
|
|
15
|
-
* toolkit's looser `ElicitInputParams`. ONE documented cast, justified
|
|
16
|
-
* by the toolkit only ever emitting form-mode requests.
|
|
17
|
-
* 2. `ElicitationCandidate` + `renderCandidateList` — a candidate is
|
|
18
|
-
* `{ id, label }`; the list renders as a readable bullet block for the
|
|
19
|
-
* mandatory non-elicitation fallback error.
|
|
20
|
-
* 3. `ambiguityFallbackError` — the structured `errorResult` returned
|
|
21
|
-
* when elicitation is unavailable (unsupported client) or declined.
|
|
22
|
-
* Lists every candidate so the LLM (or operator) has an actionable
|
|
23
|
-
* recovery path: "retry with explicit param X set to one of …".
|
|
24
|
-
*
|
|
25
|
-
* MANDATORY non-elicitation fallback: `elicitChoice` returns `null` on a
|
|
26
|
-
* client without elicitation support, on decline, and on cancel. Every
|
|
27
|
-
* call site MUST then return a structured `errorResult` listing the
|
|
28
|
-
* candidates with a recovery hint — never hang, never guess, never
|
|
29
|
-
* silently pick.
|
|
30
|
-
*
|
|
31
|
-
* @license MIT
|
|
32
|
-
*/
|
|
33
|
-
import type { McpServerWithElicitation } from '@getimo/mcp-toolkit';
|
|
34
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
35
|
-
import { type ToolResult } from './tool-builder.js';
|
|
36
|
-
export type { McpServerWithElicitation };
|
|
37
|
-
/**
|
|
38
|
-
* Build the `McpServerWithElicitation` capability object the toolkit's
|
|
39
|
-
* `elicitChoice` / `elicitConfirmation` consume, from the real `McpServer`.
|
|
40
|
-
*
|
|
41
|
-
* Why an adapter and not the bare `McpServer`:
|
|
42
|
-
* The toolkit's `McpServerWithElicitation.server.elicitInput` is typed
|
|
43
|
-
* with the loose `ElicitInputParams` (`mode: "form" | "url"`,
|
|
44
|
-
* `requestedSchema?: Record<string, unknown>`). The SDK's
|
|
45
|
-
* `Server.elicitInput` is the stricter discriminated
|
|
46
|
-
* `ElicitRequestFormParams | ElicitRequestURLParams` with a fully-typed
|
|
47
|
-
* `requestedSchema`. A real `McpServer` is therefore NOT structurally
|
|
48
|
-
* assignable to `McpServerWithElicitation` — the parameter types are
|
|
49
|
-
* contravariantly incompatible.
|
|
50
|
-
*
|
|
51
|
-
* The toolkit's `elicitChoice` / `elicitConfirmation` ALWAYS call with
|
|
52
|
-
* `mode: "form"` and a `requestedSchema` whose properties are plain
|
|
53
|
-
* `{ type: "string", enum: [...] }` / `{ type: "boolean" }` shapes —
|
|
54
|
-
* i.e. always a valid `ElicitRequestFormParams` at runtime. This adapter
|
|
55
|
-
* is the single, documented interop boundary that re-narrows the loose
|
|
56
|
-
* toolkit params to the SDK's form-params type.
|
|
57
|
-
*/
|
|
58
|
-
export declare function toElicitationCapability(realServer: McpServer): McpServerWithElicitation;
|
|
59
|
-
/**
|
|
60
|
-
* A disambiguation candidate. `id` is the value a tool needs (source ID,
|
|
61
|
-
* credential ID, …); `label` is a human-readable name shown in the
|
|
62
|
-
* elicitation prompt and the fallback error list.
|
|
63
|
-
*/
|
|
64
|
-
export interface ElicitationCandidate {
|
|
65
|
-
readonly id: string;
|
|
66
|
-
readonly label: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Render a candidate list as a readable bullet block for the structured
|
|
70
|
-
* fallback error — so a client without elicitation support still gets a
|
|
71
|
-
* fully actionable recovery path.
|
|
72
|
-
*/
|
|
73
|
-
export declare function renderCandidateList(candidates: readonly ElicitationCandidate[]): string;
|
|
74
|
-
/**
|
|
75
|
-
* Build the structured `errorResult` returned when elicitation is
|
|
76
|
-
* unavailable (unsupported client) or the user declined / cancelled. The
|
|
77
|
-
* error names every candidate and tells the caller exactly which
|
|
78
|
-
* parameter to supply on retry.
|
|
79
|
-
*/
|
|
80
|
-
export declare function ambiguityFallbackError(opts: {
|
|
81
|
-
code: string;
|
|
82
|
-
paramName: string;
|
|
83
|
-
what: string;
|
|
84
|
-
candidates: readonly ElicitationCandidate[];
|
|
85
|
-
context: Record<string, unknown>;
|
|
86
|
-
}): ToolResult;
|
|
87
|
-
//# sourceMappingURL=elicitation.d.ts.map
|