@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,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source-tool builders — pure `defineTool` factory list.
|
|
3
|
-
*
|
|
4
|
-
* Split out of `src/tools/sources.ts` (Wave G.4.0b). See `./handlers.ts`
|
|
5
|
-
* for the handler bodies.
|
|
6
|
-
*
|
|
7
|
-
* @license MIT
|
|
8
|
-
*/
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
import { ELEMENT_PATH, ETAG, TEMPLATE_ID } from '../shared-schemas.js';
|
|
11
|
-
import { FIELDS } from '../sparse-fields.js';
|
|
12
|
-
import { defineTool, destructive, mutating, readOnly, } from '../tool-builder.js';
|
|
13
|
-
import { BINDING_OUTPUT_SCHEMA, SOURCES_LIST_OUTPUT_SCHEMA, handleElementBindSource, handleElementGetBinding, handleElementUnbindSource, handleSourcesList, } from './handlers.js';
|
|
14
|
-
export function buildSourcesTools(client, deps) {
|
|
15
|
-
const handlerDeps = {
|
|
16
|
-
client,
|
|
17
|
-
elicitation: deps?.elicitation,
|
|
18
|
-
};
|
|
19
|
-
return [
|
|
20
|
-
defineTool({
|
|
21
|
-
name: 'yootheme_builder_sources_list',
|
|
22
|
-
description: 'List Builder sources grouped by origin (apimapper/wordpress/' +
|
|
23
|
-
'essentials). Returns name+label per source — pick one for ' +
|
|
24
|
-
'`element_bind_source`. Pass `fields[]` to narrow each row.',
|
|
25
|
-
inputSchema: {
|
|
26
|
-
fields: FIELDS,
|
|
27
|
-
},
|
|
28
|
-
outputSchema: SOURCES_LIST_OUTPUT_SCHEMA,
|
|
29
|
-
annotations: readOnly('List Sources'),
|
|
30
|
-
handler: (input) => handleSourcesList(handlerDeps, input),
|
|
31
|
-
}),
|
|
32
|
-
defineTool({
|
|
33
|
-
name: 'yootheme_builder_element_get_binding',
|
|
34
|
-
description: 'Read the source binding attached to an element — the bound source name, ' +
|
|
35
|
-
'the field-mappings (which source field feeds which element prop) and the ' +
|
|
36
|
-
'query arguments/directives. Returns the empty object if the element is not bound.',
|
|
37
|
-
inputSchema: {
|
|
38
|
-
template_id: TEMPLATE_ID,
|
|
39
|
-
element_path: ELEMENT_PATH,
|
|
40
|
-
},
|
|
41
|
-
outputSchema: BINDING_OUTPUT_SCHEMA,
|
|
42
|
-
annotations: readOnly('Get Source Binding'),
|
|
43
|
-
handler: (input) => handleElementGetBinding(handlerDeps, input),
|
|
44
|
-
}),
|
|
45
|
-
defineTool({
|
|
46
|
-
name: 'yootheme_builder_element_bind_source',
|
|
47
|
-
description: 'Binds a Builder source to an element (sets `props.source`). Use bindingLevel ' +
|
|
48
|
-
'"item" on Multi-Items containers (grid/slideshow/switcher/…) to bind on the ' +
|
|
49
|
-
'first *_item child instead of the container itself. Requires ETag.',
|
|
50
|
-
inputSchema: {
|
|
51
|
-
template_id: TEMPLATE_ID,
|
|
52
|
-
element_path: ELEMENT_PATH,
|
|
53
|
-
source_name: z
|
|
54
|
-
.string()
|
|
55
|
-
.min(1)
|
|
56
|
-
.describe('Source name as listed by yootheme_builder_sources_list ' +
|
|
57
|
-
'(e.g. "wp_posts", "apimapper_my-flow").'),
|
|
58
|
-
source_id: z
|
|
59
|
-
.string()
|
|
60
|
-
.optional()
|
|
61
|
-
.describe('Optional explicit "<origin>:<name>" id; skips ambiguity ' +
|
|
62
|
-
'resolution when ≥2 sources share `source_name`.'),
|
|
63
|
-
field_mappings: z
|
|
64
|
-
.record(z.string(), z.string())
|
|
65
|
-
.optional()
|
|
66
|
-
.describe('Optional {prop_name: source_field_name} map written to `source.props`. ' +
|
|
67
|
-
'Pass "__node_item__" (or "__node_item__:<field>") as the value to ' +
|
|
68
|
-
'emit YT-Pro INHERIT bindings ("Node - Item (Source/Items)" picker ' +
|
|
69
|
-
'entry) on child *_item elements.'),
|
|
70
|
-
bindingLevel: z
|
|
71
|
-
.enum(['auto', 'container', 'item'])
|
|
72
|
-
.optional()
|
|
73
|
-
.describe('Multi-Items binding level. "auto" (default): item if target is a *_item, ' +
|
|
74
|
-
'container otherwise. "item": container targets resolve to their first ' +
|
|
75
|
-
'*_item child. "container": binds on the container, response carries a ' +
|
|
76
|
-
'warning because YT-Pro will clone the container N times.'),
|
|
77
|
-
etag: ETAG,
|
|
78
|
-
},
|
|
79
|
-
annotations: mutating('Bind Source'),
|
|
80
|
-
handler: (input) => handleElementBindSource(handlerDeps, input),
|
|
81
|
-
}),
|
|
82
|
-
defineTool({
|
|
83
|
-
name: 'yootheme_builder_element_unbind_source',
|
|
84
|
-
description: 'Remove the source binding from an element. Clears `props.source`. Destructive ' +
|
|
85
|
-
'in the sense that it may break dynamic-content rendering — always ask the ' +
|
|
86
|
-
'user to confirm. Requires ETag.',
|
|
87
|
-
inputSchema: {
|
|
88
|
-
template_id: TEMPLATE_ID,
|
|
89
|
-
element_path: ELEMENT_PATH,
|
|
90
|
-
etag: ETAG,
|
|
91
|
-
confirm: z
|
|
92
|
-
.boolean()
|
|
93
|
-
.optional()
|
|
94
|
-
.describe('Must be true to execute. On supporting hosts the agent is prompted ' +
|
|
95
|
-
'via MCP elicitation when omitted; otherwise the call returns a ' +
|
|
96
|
-
'preview and the agent must retry with `confirm: true`.'),
|
|
97
|
-
},
|
|
98
|
-
annotations: destructive('Unbind Source'),
|
|
99
|
-
handler: (input) => handleElementUnbindSource(handlerDeps, input),
|
|
100
|
-
}),
|
|
101
|
-
];
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=builders.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builders.js","sourceRoot":"","sources":["../../../src/tools/sources/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACH,UAAU,EACV,WAAW,EACX,QAAQ,EACR,QAAQ,GAEX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,qBAAqB,EACrB,0BAA0B,EAE1B,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,GACpB,MAAM,eAAe,CAAC;AAEvB,MAAM,UAAU,iBAAiB,CAC7B,MAAkB,EAClB,IAAkC;IAElC,MAAM,WAAW,GAAuB;QACpC,MAAM;QACN,WAAW,EAAE,IAAI,EAAE,WAAW;KACjC,CAAC;IAEF,OAAO;QACH,UAAU,CAAC;YACP,IAAI,EAAE,+BAA+B;YACrC,WAAW,EACP,8DAA8D;gBAC9D,4DAA4D;gBAC5D,4DAA4D;YAChE,WAAW,EAAE;gBACT,MAAM,EAAE,MAAM;aACjB;YACD,YAAY,EAAE,0BAA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2EAA2E;oBACvE,wEAAwE;oBACxE,wEAAwE;oBACxE,0DAA0D,CACjE;gBACL,IAAI,EAAE,IAAI;aACb;YACD,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAC;YACpC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,uBAAuB,CAAC,WAAW,EAAE,KAAK,CAAC;SAClE,CAAC;QAEF,UAAU,CAAC;YACP,IAAI,EAAE,wCAAwC;YAC9C,WAAW,EACP,gFAAgF;gBAChF,4EAA4E;gBAC5E,iCAAiC;YACrC,WAAW,EAAE;gBACT,WAAW,EAAE,WAAW;gBACxB,YAAY,EAAE,YAAY;gBAC1B,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,CAAC;qBACL,OAAO,EAAE;qBACT,QAAQ,EAAE;qBACV,QAAQ,CACL,qEAAqE;oBACjE,iEAAiE;oBACjE,wDAAwD,CAC/D;aACR;YACD,WAAW,EAAE,WAAW,CAAC,eAAe,CAAC;YACzC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,yBAAyB,CAAC,WAAW,EAAE,KAAK,CAAC;SACpE,CAAC;KACL,CAAC;AACN,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source-binding write handlers (`element_bind_source`,
|
|
3
|
-
* `element_unbind_source`).
|
|
4
|
-
*
|
|
5
|
-
* Split out of `./handlers.ts` to keep each file under the 200-LoC
|
|
6
|
-
* budget. Wave G.4.2 adds destructive-confirm elicitation;
|
|
7
|
-
* Wave G.4.3 adds ambiguity-resolution elicitation.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import { type ToolResult } from '../tool-builder.js';
|
|
12
|
-
import type { SourcesHandlerDeps } from './handlers.js';
|
|
13
|
-
export declare function handleElementBindSource({ client, elicitation }: SourcesHandlerDeps, input: {
|
|
14
|
-
template_id: string;
|
|
15
|
-
element_path: string;
|
|
16
|
-
source_name: string;
|
|
17
|
-
source_id?: string;
|
|
18
|
-
etag: string;
|
|
19
|
-
bindingLevel?: 'auto' | 'container' | 'item';
|
|
20
|
-
field_mappings?: Record<string, string>;
|
|
21
|
-
}): Promise<ToolResult>;
|
|
22
|
-
export declare function handleElementUnbindSource({ client, elicitation }: SourcesHandlerDeps, input: {
|
|
23
|
-
template_id: string;
|
|
24
|
-
element_path: string;
|
|
25
|
-
etag: string;
|
|
26
|
-
confirm?: boolean;
|
|
27
|
-
}): Promise<ToolResult>;
|
|
28
|
-
//# sourceMappingURL=handlers-bind.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers-bind.d.ts","sourceRoot":"","sources":["../../../src/tools/sources/handlers-bind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAcH,OAAO,EAIH,KAAK,UAAU,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAwBxD,wBAAsB,uBAAuB,CACzC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,kBAAkB,EAC3C,KAAK,EAAE;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C,GACF,OAAO,CAAC,UAAU,CAAC,CA6ErB;AAID,wBAAsB,yBAAyB,CAC3C,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,kBAAkB,EAC3C,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GACtF,OAAO,CAAC,UAAU,CAAC,CAoCrB"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source-binding write handlers (`element_bind_source`,
|
|
3
|
-
* `element_unbind_source`).
|
|
4
|
-
*
|
|
5
|
-
* Split out of `./handlers.ts` to keep each file under the 200-LoC
|
|
6
|
-
* budget. Wave G.4.2 adds destructive-confirm elicitation;
|
|
7
|
-
* Wave G.4.3 adds ambiguity-resolution elicitation.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import { elicitChoice, elicitConfirmation } from '@getimo/mcp-toolkit';
|
|
12
|
-
import { encodeElementPath } from '../../client.js';
|
|
13
|
-
import { flattenSourcesPayload, mapSourceRow, } from '../format/sources-format.js';
|
|
14
|
-
import { ambiguityFallbackError, } from '../elicitation.js';
|
|
15
|
-
import { confirmGuard, errorResult, jsonResult, } from '../tool-builder.js';
|
|
16
|
-
// ─── element_bind_source (G.4.3 — ambiguity resolution) ─────────────
|
|
17
|
-
/**
|
|
18
|
-
* Look up sources matching `source_name`. Returns at most one row per
|
|
19
|
-
* (name + origin) tuple; cross-plugin name collisions yield multiple
|
|
20
|
-
* candidates that need disambiguation.
|
|
21
|
-
*
|
|
22
|
-
* TODO(v0.3): cache /sources per session to avoid the round-trip on
|
|
23
|
-
* every bind. The current "fetch on every bind" call is the only REST
|
|
24
|
-
* round-trip introduced by ambiguity resolution and dominates bind
|
|
25
|
-
* latency — see tests/perf/bind-latency.test.ts for the pin.
|
|
26
|
-
*/
|
|
27
|
-
async function fetchSourceCandidates(client, source_name) {
|
|
28
|
-
const data = await client.get('/sources');
|
|
29
|
-
const payload = data.sources ?? data;
|
|
30
|
-
const flat = flattenSourcesPayload(payload);
|
|
31
|
-
return flat.map(mapSourceRow).filter((r) => r.name === source_name);
|
|
32
|
-
}
|
|
33
|
-
export async function handleElementBindSource({ client, elicitation }, input) {
|
|
34
|
-
const { template_id, element_path, source_name, source_id, etag, bindingLevel, field_mappings } = input;
|
|
35
|
-
const encoded = encodeElementPath(element_path);
|
|
36
|
-
// Wave G.4.3 — ambiguity resolution.
|
|
37
|
-
//
|
|
38
|
-
// If `source_id` is supplied, the caller has already disambiguated;
|
|
39
|
-
// skip the /sources lookup entirely.
|
|
40
|
-
//
|
|
41
|
-
// Otherwise look up rows matching `source_name`:
|
|
42
|
-
// - 0 matches: fall through to the bind call; the REST plugin
|
|
43
|
-
// returns its own structured 404 with a precise hint (sources
|
|
44
|
-
// can be added between the lookup and the call).
|
|
45
|
-
// - 1 match: unique → bind directly.
|
|
46
|
-
// - ≥2 matches: cross-plugin collision (e.g. an apimapper flow
|
|
47
|
-
// AND a wordpress source both named "Posts"). Elicit a choice
|
|
48
|
-
// on supporting hosts; on unsupported hosts, return a
|
|
49
|
-
// structured `ambiguityFallbackError` listing every candidate
|
|
50
|
-
// so the agent can retry with `source_id`.
|
|
51
|
-
let resolvedBody = { source_name };
|
|
52
|
-
if (bindingLevel !== undefined) {
|
|
53
|
-
resolvedBody.bindingLevel = bindingLevel;
|
|
54
|
-
}
|
|
55
|
-
if (field_mappings !== undefined) {
|
|
56
|
-
resolvedBody.field_mappings = field_mappings;
|
|
57
|
-
}
|
|
58
|
-
if (source_id === undefined) {
|
|
59
|
-
const candidates = await fetchSourceCandidates(client, source_name);
|
|
60
|
-
if (candidates.length > 1) {
|
|
61
|
-
const elicitCandidates = candidates.map((c) => ({
|
|
62
|
-
id: `${c.origin}:${c.name}`,
|
|
63
|
-
label: `${c.label || c.name} (${c.origin}${c.kind ? `/${c.kind}` : ''})`,
|
|
64
|
-
}));
|
|
65
|
-
const picked = elicitation
|
|
66
|
-
? await elicitChoice(elicitation, `Multiple sources named "${source_name}" exist. Pick which ` +
|
|
67
|
-
`one to bind to "${element_path}".`, elicitCandidates.map((c) => c.id))
|
|
68
|
-
: null;
|
|
69
|
-
if (picked === null) {
|
|
70
|
-
return ambiguityFallbackError({
|
|
71
|
-
code: 'source_ambiguous',
|
|
72
|
-
paramName: 'source_id',
|
|
73
|
-
what: 'sources',
|
|
74
|
-
candidates: elicitCandidates,
|
|
75
|
-
context: { template_id, element_path, source_name },
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
resolvedBody = { ...resolvedBody, source_id: picked };
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
resolvedBody = { ...resolvedBody, source_id };
|
|
83
|
-
}
|
|
84
|
-
try {
|
|
85
|
-
const data = await client.put(`/pages/${encodeURIComponent(template_id)}/elements/${encoded}/binding`, { body: resolvedBody, etag });
|
|
86
|
-
return jsonResult(data);
|
|
87
|
-
}
|
|
88
|
-
catch (e) {
|
|
89
|
-
return errorResult({
|
|
90
|
-
error: e,
|
|
91
|
-
context: { template_id, element_path, source_name, ...(source_id ? { source_id } : {}) },
|
|
92
|
-
hint: 'Verify source_name via yootheme_builder_sources_list. On 412 ' +
|
|
93
|
-
'refresh ETag and retry.',
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
// ─── element_unbind_source (destructive — G.4.2) ────────────────────
|
|
98
|
-
export async function handleElementUnbindSource({ client, elicitation }, input) {
|
|
99
|
-
const { template_id, element_path, etag, confirm } = input;
|
|
100
|
-
if (confirm !== true) {
|
|
101
|
-
if (confirm === false || !elicitation) {
|
|
102
|
-
return confirmGuard({
|
|
103
|
-
operation: 'unbind source',
|
|
104
|
-
details: { template_id, element_path },
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
const accepted = await elicitConfirmation(elicitation, `Unbind the dynamic source from element "${element_path}" in template ` +
|
|
108
|
-
`"${template_id}"? This may break dynamic-content rendering.`);
|
|
109
|
-
if (!accepted) {
|
|
110
|
-
return confirmGuard({
|
|
111
|
-
operation: 'unbind source',
|
|
112
|
-
details: { template_id, element_path },
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const encoded = encodeElementPath(element_path);
|
|
117
|
-
try {
|
|
118
|
-
const data = await client.delete(`/pages/${encodeURIComponent(template_id)}/elements/${encoded}/binding`, { etag });
|
|
119
|
-
return jsonResult(data);
|
|
120
|
-
}
|
|
121
|
-
catch (e) {
|
|
122
|
-
return errorResult({
|
|
123
|
-
error: e,
|
|
124
|
-
context: { template_id, element_path },
|
|
125
|
-
hint: 'On 412 refresh via yootheme_builder_get_etag and retry.',
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=handlers-bind.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers-bind.js","sourceRoot":"","sources":["../../../src/tools/sources/handlers-bind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAmB,MAAM,iBAAiB,CAAC;AACrE,OAAO,EACH,qBAAqB,EACrB,YAAY,GAEf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACH,sBAAsB,GAEzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,YAAY,EACZ,WAAW,EACX,UAAU,GAEb,MAAM,oBAAoB,CAAC;AAG5B,uEAAuE;AAEvE;;;;;;;;;GASG;AACH,KAAK,UAAU,qBAAqB,CAChC,MAAkB,EAClB,WAAmB;IAEnB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,CAAwB,UAAU,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;IACrC,MAAM,IAAI,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,CA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|
|
|
1
|
-
/**
|
|
2
|
-
* Source-binding read handlers + shared types/schemas.
|
|
3
|
-
*
|
|
4
|
-
* Split out of `src/tools/sources.ts` (Wave G.4.0b). Write handlers
|
|
5
|
-
* (`element_bind_source` with G.4.3 ambiguity resolution,
|
|
6
|
-
* `element_unbind_source` with G.4.2 elicit-confirm) live in
|
|
7
|
-
* `./handlers-bind.ts`.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import { z } from 'zod';
|
|
12
|
-
import { type RestClient } from '../../client.js';
|
|
13
|
-
import type { McpServerWithElicitation } from '../elicitation.js';
|
|
14
|
-
import { type ToolResult } from '../tool-builder.js';
|
|
15
|
-
export declare const SOURCES_LIST_OUTPUT_SCHEMA: z.ZodObject<{
|
|
16
|
-
items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
17
|
-
total: z.ZodNumber;
|
|
18
|
-
projected_fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
|
-
}, z.core.$strip>;
|
|
20
|
-
export declare const BINDING_OUTPUT_SCHEMA: z.ZodObject<{
|
|
21
|
-
template_id: z.ZodString;
|
|
22
|
-
element_path: z.ZodString;
|
|
23
|
-
binding: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
24
|
-
has_binding: z.ZodBoolean;
|
|
25
|
-
}, z.core.$strip>;
|
|
26
|
-
export interface SourcesHandlerDeps {
|
|
27
|
-
readonly client: RestClient;
|
|
28
|
-
/**
|
|
29
|
-
* Optional MCP elicitation capability. When present,
|
|
30
|
-
* `element_unbind_source` prompts for destructive confirmation and
|
|
31
|
-
* `element_bind_source` prompts for cross-plugin disambiguation
|
|
32
|
-
* via the elicitation channel. When absent, both fall back to
|
|
33
|
-
* structured-error / preview flows.
|
|
34
|
-
*/
|
|
35
|
-
readonly elicitation?: McpServerWithElicitation;
|
|
36
|
-
}
|
|
37
|
-
export declare function handleSourcesList({ client }: SourcesHandlerDeps, { fields }: {
|
|
38
|
-
fields?: readonly string[];
|
|
39
|
-
}): Promise<ToolResult>;
|
|
40
|
-
export declare function handleElementGetBinding({ client }: SourcesHandlerDeps, { template_id, element_path }: {
|
|
41
|
-
template_id: string;
|
|
42
|
-
element_path: string;
|
|
43
|
-
}): Promise<ToolResult>;
|
|
44
|
-
export { handleElementBindSource, handleElementUnbindSource, } from './handlers-bind.js';
|
|
45
|
-
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/tools/sources/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOrE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAMlE,OAAO,EAGH,KAAK,UAAU,EAClB,MAAM,oBAAoB,CAAC;AAI5B,eAAO,MAAM,0BAA0B;;;;iBAIrC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;iBAKhC,CAAC;AAEH,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACnD;AAID,wBAAsB,iBAAiB,CACnC,EAAE,MAAM,EAAE,EAAE,kBAAkB,EAC9B,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3C,OAAO,CAAC,UAAU,CAAC,CA0BrB;AAID,wBAAsB,uBAAuB,CACzC,EAAE,MAAM,EAAE,EAAE,kBAAkB,EAC9B,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC7E,OAAO,CAAC,UAAU,CAAC,CAgCrB;AAID,OAAO,EACH,uBAAuB,EACvB,yBAAyB,GAC5B,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source-binding read handlers + shared types/schemas.
|
|
3
|
-
*
|
|
4
|
-
* Split out of `src/tools/sources.ts` (Wave G.4.0b). Write handlers
|
|
5
|
-
* (`element_bind_source` with G.4.3 ambiguity resolution,
|
|
6
|
-
* `element_unbind_source` with G.4.2 elicit-confirm) live in
|
|
7
|
-
* `./handlers-bind.ts`.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import { detailResult, tableResult } from '@getimo/mcp-toolkit';
|
|
12
|
-
import { z } from 'zod';
|
|
13
|
-
import { encodeElementPath } from '../../client.js';
|
|
14
|
-
import { SOURCES_TABLE_COLUMNS, buildBindingDetail, flattenSourcesPayload, mapSourceRow, } from '../format/sources-format.js';
|
|
15
|
-
import { DEFAULT_FIELDS_SOURCES_LIST, projectFields, projectedFieldsEcho, } from '../sparse-fields.js';
|
|
16
|
-
import { errorResult, structuredResult, } from '../tool-builder.js';
|
|
17
|
-
// ─── outputSchemas (Wave G.2 §4) ─────────────────────────────────────
|
|
18
|
-
export const SOURCES_LIST_OUTPUT_SCHEMA = z.object({
|
|
19
|
-
items: z.array(z.record(z.string(), z.unknown())),
|
|
20
|
-
total: z.number(),
|
|
21
|
-
projected_fields: z.array(z.string()).optional(),
|
|
22
|
-
});
|
|
23
|
-
export const BINDING_OUTPUT_SCHEMA = z.object({
|
|
24
|
-
template_id: z.string(),
|
|
25
|
-
element_path: z.string(),
|
|
26
|
-
binding: z.record(z.string(), z.unknown()),
|
|
27
|
-
has_binding: z.boolean(),
|
|
28
|
-
});
|
|
29
|
-
// ─── sources_list ────────────────────────────────────────────────────
|
|
30
|
-
export async function handleSourcesList({ client }, { fields }) {
|
|
31
|
-
try {
|
|
32
|
-
const data = await client.get('/sources');
|
|
33
|
-
const payload = data.sources ?? data;
|
|
34
|
-
const flat = flattenSourcesPayload(payload);
|
|
35
|
-
const mapped = flat.map(mapSourceRow);
|
|
36
|
-
const mappedRecords = mapped;
|
|
37
|
-
const items = projectFields(mappedRecords, fields, DEFAULT_FIELDS_SOURCES_LIST);
|
|
38
|
-
const echo = projectedFieldsEcho(fields, DEFAULT_FIELDS_SOURCES_LIST);
|
|
39
|
-
const toolkitResult = tableResult(mappedRecords, {
|
|
40
|
-
columns: [...SOURCES_TABLE_COLUMNS],
|
|
41
|
-
header: (count) => `${String(count)} sources`,
|
|
42
|
-
footer: 'Use yootheme_builder_element_bind_source to bind one.',
|
|
43
|
-
});
|
|
44
|
-
return structuredResult(toolkitResult, {
|
|
45
|
-
items,
|
|
46
|
-
total: items.length,
|
|
47
|
-
...(echo !== undefined ? { projected_fields: [...echo] } : {}),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
catch (e) {
|
|
51
|
-
return errorResult({
|
|
52
|
-
error: e,
|
|
53
|
-
context: {},
|
|
54
|
-
hint: 'Run yootheme_builder_diagnose to verify auth.',
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// ─── element_get_binding ─────────────────────────────────────────────
|
|
59
|
-
export async function handleElementGetBinding({ client }, { template_id, element_path }) {
|
|
60
|
-
const encoded = encodeElementPath(element_path);
|
|
61
|
-
try {
|
|
62
|
-
const data = await client.get(`/pages/${encodeURIComponent(template_id)}/elements/${encoded}/binding`);
|
|
63
|
-
const binding = data !== null && typeof data === 'object' ? data : {};
|
|
64
|
-
// F-01-Mapping (Audit v4): trust the BE-computed `has_binding`
|
|
65
|
-
// flag (BindingSerializer SSoT) — it also flips true for an
|
|
66
|
-
// item-level binding that has field_mappings but no source_name.
|
|
67
|
-
// Fall back to the source_name heuristic only when absent.
|
|
68
|
-
const hasBinding = typeof binding.has_binding === 'boolean'
|
|
69
|
-
? binding.has_binding
|
|
70
|
-
: typeof binding.source_name === 'string' &&
|
|
71
|
-
binding.source_name.length > 0;
|
|
72
|
-
const toolkitResult = detailResult(buildBindingDetail({ template_id, element_path, binding }));
|
|
73
|
-
return structuredResult(toolkitResult, {
|
|
74
|
-
template_id,
|
|
75
|
-
element_path,
|
|
76
|
-
binding,
|
|
77
|
-
has_binding: hasBinding,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
return errorResult({
|
|
82
|
-
error: e,
|
|
83
|
-
context: { template_id, element_path },
|
|
84
|
-
hint: 'Verify element_path via yootheme_builder_element_list.',
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
// Re-export write handlers so builders can import everything from this
|
|
89
|
-
// barrel and we keep a single `SourcesHandlerDeps` definition.
|
|
90
|
-
export { handleElementBindSource, handleElementUnbindSource, } from './handlers-bind.js';
|
|
91
|
-
//# sourceMappingURL=handlers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../src/tools/sources/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAmB,MAAM,iBAAiB,CAAC;AACrE,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,GACf,MAAM,6BAA6B,CAAC;AAErC,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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,MAAM,aAAa,GAAG,YAAY,CAC9B,kBAAkB,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAC7D,CAAC;QACF,OAAO,gBAAgB,CAAC,aAAa,EAAE;YACnC,WAAW;YACX,YAAY;YACZ,OAAO;YACP,WAAW,EAAE,UAAU;SAC1B,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,EAAE,wDAAwD;SACjE,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED,uEAAuE;AACvE,+DAA+D;AAC/D,OAAO,EACH,uBAAuB,EACvB,yBAAyB,GAC5B,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source-tool barrel — public entry-point for the 4 source-binding tools.
|
|
3
|
-
*
|
|
4
|
-
* yootheme_builder_sources_list
|
|
5
|
-
* → list available Builder sources
|
|
6
|
-
* yootheme_builder_element_get_binding
|
|
7
|
-
* → read source binding on an element
|
|
8
|
-
* yootheme_builder_element_bind_source
|
|
9
|
-
* → set source binding (PUT; G.4.3 ambiguity resolution)
|
|
10
|
-
* yootheme_builder_element_unbind_source
|
|
11
|
-
* → remove binding (DELETE; G.4.2 elicit-confirm)
|
|
12
|
-
*
|
|
13
|
-
* Wave G.4.0b — split out of the original `src/tools/sources.ts`.
|
|
14
|
-
*
|
|
15
|
-
* @license MIT
|
|
16
|
-
*/
|
|
17
|
-
export { buildSourcesTools } from './builders.js';
|
|
18
|
-
export type { SourcesHandlerDeps } from './handlers.js';
|
|
19
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/sources/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Source-tool barrel — public entry-point for the 4 source-binding tools.
|
|
3
|
-
*
|
|
4
|
-
* yootheme_builder_sources_list
|
|
5
|
-
* → list available Builder sources
|
|
6
|
-
* yootheme_builder_element_get_binding
|
|
7
|
-
* → read source binding on an element
|
|
8
|
-
* yootheme_builder_element_bind_source
|
|
9
|
-
* → set source binding (PUT; G.4.3 ambiguity resolution)
|
|
10
|
-
* yootheme_builder_element_unbind_source
|
|
11
|
-
* → remove binding (DELETE; G.4.2 elicit-confirm)
|
|
12
|
-
*
|
|
13
|
-
* Wave G.4.0b — split out of the original `src/tools/sources.ts`.
|
|
14
|
-
*
|
|
15
|
-
* @license MIT
|
|
16
|
-
*/
|
|
17
|
-
export { buildSourcesTools } from './builders.js';
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/sources/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/tools/sources.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backwards-compatible re-export shim.
|
|
3
|
-
*
|
|
4
|
-
* Wave G.4.0b split the original 228-LoC `sources.ts` into
|
|
5
|
-
* `./sources/{index, handlers, builders}.ts` after Wave G.4.2/G.4.3
|
|
6
|
-
* added elicitation + ambiguity-resolution logic that pushed it well
|
|
7
|
-
* over the 200-LoC budget. This shim keeps the legacy import path
|
|
8
|
-
* (`from '../tools/sources.js'`) working for downstream callers and
|
|
9
|
-
* tests. New code should import from `./sources/index.js` directly.
|
|
10
|
-
*
|
|
11
|
-
* @license MIT
|
|
12
|
-
*/
|
|
13
|
-
export { buildSourcesTools } from './sources/index.js';
|
|
14
|
-
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../src/tools/sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/tools/sources.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backwards-compatible re-export shim.
|
|
3
|
-
*
|
|
4
|
-
* Wave G.4.0b split the original 228-LoC `sources.ts` into
|
|
5
|
-
* `./sources/{index, handlers, builders}.ts` after Wave G.4.2/G.4.3
|
|
6
|
-
* added elicitation + ambiguity-resolution logic that pushed it well
|
|
7
|
-
* over the 200-LoC budget. This shim keeps the legacy import path
|
|
8
|
-
* (`from '../tools/sources.js'`) working for downstream callers and
|
|
9
|
-
* tests. New code should import from `./sources/index.js` directly.
|
|
10
|
-
*
|
|
11
|
-
* @license MIT
|
|
12
|
-
*/
|
|
13
|
-
export { buildSourcesTools } from './sources/index.js';
|
|
14
|
-
//# sourceMappingURL=sources.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/tools/sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sparse-fields helper — projects per-item field whitelists onto tool
|
|
3
|
-
* responses and exposes per-tool default-sets that the AI client can rely
|
|
4
|
-
* on when calling read tools without a `fields` parameter.
|
|
5
|
-
*
|
|
6
|
-
* Design references:
|
|
7
|
-
*
|
|
8
|
-
* - §3.5 Sparse-Fields Adaption: 4 read tools opt-in to `fields[]`;
|
|
9
|
-
* the toolkit's `pickFields` is used directly; `projected_fields` is
|
|
10
|
-
* echoed in the result envelope so the LLM can confirm exactly which
|
|
11
|
-
* keys were kept.
|
|
12
|
-
* - §4.4.1 — when used together with `flat: true` projection runs
|
|
13
|
-
* AFTER the depth-first walk so paths are stable before narrowing.
|
|
14
|
-
*
|
|
15
|
-
* Reference implementation pattern: `connections.ts:721, 779-792, 810`
|
|
16
|
-
* in `@wootsup/apimapper-mcp`.
|
|
17
|
-
*
|
|
18
|
-
* The defaults are pure constants so they can be imported, exported, and
|
|
19
|
-
* asserted against in tests without any side-effects.
|
|
20
|
-
*
|
|
21
|
-
* @license MIT
|
|
22
|
-
*/
|
|
23
|
-
import { z } from 'zod';
|
|
24
|
-
/**
|
|
25
|
-
* Optional whitelist of fields. Per Design §3.5 the cap is 40 to stop
|
|
26
|
-
* runaway prompts from blowing up the request size; nested paths
|
|
27
|
-
* (`props.title`) are supported by the toolkit's `pickFields`.
|
|
28
|
-
*/
|
|
29
|
-
export declare const FIELDS: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
30
|
-
/**
|
|
31
|
-
* Flag enabling client-side flattening on `page_get_layout`. When true
|
|
32
|
-
* the response shape switches from `{layout, etag}` to
|
|
33
|
-
* `{elements: [...], etag}` and `fields[]` projection becomes meaningful.
|
|
34
|
-
*/
|
|
35
|
-
export declare const FLAT: z.ZodDefault<z.ZodBoolean>;
|
|
36
|
-
/**
|
|
37
|
-
* Default fields echoed when the caller omits `fields`. Following the
|
|
38
|
-
* apimapper-mcp convention these are **echo-only** — projection itself
|
|
39
|
-
* is skipped (default-all preserved) but `projected_fields` still
|
|
40
|
-
* surfaces the implicit compact set so the AI can plan future requests.
|
|
41
|
-
*/
|
|
42
|
-
export declare const DEFAULT_FIELDS_PAGES_LIST: readonly string[];
|
|
43
|
-
export declare const DEFAULT_FIELDS_ELEMENT_LIST: readonly string[];
|
|
44
|
-
export declare const DEFAULT_FIELDS_SCHEMA: readonly string[];
|
|
45
|
-
export declare const DEFAULT_FIELDS_SOURCES_LIST: readonly string[];
|
|
46
|
-
export declare const DEFAULT_FIELDS_TYPES_LIST: readonly string[];
|
|
47
|
-
/**
|
|
48
|
-
* element_get defaults to "all" because the AI often needs the full
|
|
49
|
-
* props payload for follow-up edits; sparse projection here is opt-in
|
|
50
|
-
* with nested-path support.
|
|
51
|
-
*/
|
|
52
|
-
export declare const DEFAULT_FIELDS_ELEMENT_GET: readonly string[] | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* Project an array of items to the requested fields. Returns items
|
|
55
|
-
* unchanged when `fields` is undefined (default-all). Skips non-object
|
|
56
|
-
* entries without crashing (they pass through as-is).
|
|
57
|
-
*
|
|
58
|
-
* @param items - The items to project.
|
|
59
|
-
* @param fields - The whitelist; `undefined` skips projection.
|
|
60
|
-
* @param _defaults - Per-tool default set, accepted for interface symmetry
|
|
61
|
-
* with `projectedFieldsEcho` (unused for actual projection — default-all
|
|
62
|
-
* semantics matches the apimapper-mcp reference, see `connections.ts:789`).
|
|
63
|
-
*/
|
|
64
|
-
export declare function projectFields<T extends Record<string, unknown>>(items: readonly T[], fields: readonly string[] | undefined, _defaults: readonly string[]): T[];
|
|
65
|
-
/**
|
|
66
|
-
* Project a single object via the same `pickFields` rules. Returns the
|
|
67
|
-
* object unchanged when `fields` is undefined.
|
|
68
|
-
*/
|
|
69
|
-
export declare function projectFieldsSingle<T extends Record<string, unknown>>(obj: T, fields: readonly string[] | undefined, _defaults: readonly string[] | undefined): T;
|
|
70
|
-
/**
|
|
71
|
-
* Compute the `projected_fields` echo. Returns the caller-requested
|
|
72
|
-
* fields when provided; otherwise returns the per-tool default set so
|
|
73
|
-
* the AI client knows exactly which compact view it implicitly opted into.
|
|
74
|
-
*
|
|
75
|
-
* @returns `undefined` only when neither `requested` nor `defaults` was set
|
|
76
|
-
* (e.g. `element_get` with no opt-in) — callers should omit
|
|
77
|
-
* `projected_fields` from the structuredContent in that case.
|
|
78
|
-
*/
|
|
79
|
-
export declare function projectedFieldsEcho(requested: readonly string[] | undefined, defaults: readonly string[] | undefined): readonly string[] | undefined;
|
|
80
|
-
//# sourceMappingURL=sparse-fields.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sparse-fields.d.ts","sourceRoot":"","sources":["../../src/tools/sparse-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;GAIG;AACH,eAAO,MAAM,MAAM,wCASd,CAAC;AAEN;;;;GAIG;AACH,eAAO,MAAM,IAAI,4BAMZ,CAAC;AAIN;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAMtD,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EAIxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAIlD,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EAKxD,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAKtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAE,GAAG,SAAqB,CAAC;AAInF;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EACrC,SAAS,EAAE,SAAS,MAAM,EAAE,GAC7B,CAAC,EAAE,CAWL;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,GAAG,EAAE,CAAC,EACN,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EACrC,SAAS,EAAE,SA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