@wootsup/yt-builder-mcp 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -11
- package/dist/catalog/build-catalog.d.ts +63 -0
- package/dist/catalog/build-catalog.d.ts.map +1 -0
- package/dist/catalog/build-catalog.js +166 -0
- package/dist/catalog/build-catalog.js.map +1 -0
- package/dist/gateway/advanced-read-tool.d.ts +37 -0
- package/dist/gateway/advanced-read-tool.d.ts.map +1 -0
- package/dist/gateway/advanced-read-tool.js +156 -0
- package/dist/gateway/advanced-read-tool.js.map +1 -0
- package/dist/gateway/advanced-tool/domains.d.ts +18 -3
- package/dist/gateway/advanced-tool/domains.d.ts.map +1 -1
- package/dist/gateway/advanced-tool/domains.js +28 -9
- package/dist/gateway/advanced-tool/domains.js.map +1 -1
- package/dist/gateway/advanced-tool/register.d.ts.map +1 -1
- package/dist/gateway/advanced-tool/register.js +43 -11
- package/dist/gateway/advanced-tool/register.js.map +1 -1
- package/dist/gateway/essentials.d.ts +14 -4
- package/dist/gateway/essentials.d.ts.map +1 -1
- package/dist/gateway/essentials.js +41 -5
- package/dist/gateway/essentials.js.map +1 -1
- package/dist/gateway/test-support.d.ts +2 -2
- package/dist/gateway/test-support.js +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/install-skill.js +1 -1
- package/dist/proxy/bridge.d.ts +36 -0
- package/dist/proxy/bridge.d.ts.map +1 -0
- package/dist/proxy/bridge.js +129 -0
- package/dist/proxy/bridge.js.map +1 -0
- package/dist/proxy/mode.d.ts +10 -0
- package/dist/proxy/mode.d.ts.map +1 -0
- package/dist/proxy/mode.js +20 -0
- package/dist/proxy/mode.js.map +1 -0
- package/dist/server.d.ts +5 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +13 -3
- package/dist/server.js.map +1 -1
- package/dist/setup-wizard.d.ts.map +1 -1
- package/dist/setup-wizard.js +7 -0
- package/dist/setup-wizard.js.map +1 -1
- package/dist/sites/client-pool.d.ts.map +1 -1
- package/dist/sites/client-pool.js +21 -3
- package/dist/sites/client-pool.js.map +1 -1
- package/dist/sites/registry.d.ts +30 -0
- package/dist/sites/registry.d.ts.map +1 -1
- package/dist/sites/registry.js.map +1 -1
- package/dist/sites/store.d.ts +8 -1
- package/dist/sites/store.d.ts.map +1 -1
- package/dist/sites/store.js +17 -2
- package/dist/sites/store.js.map +1 -1
- package/dist/sites/tools/use-site.d.ts.map +1 -1
- package/dist/sites/tools/use-site.js +26 -6
- package/dist/sites/tools/use-site.js.map +1 -1
- package/dist/tools/bind-guidance.d.ts +80 -0
- package/dist/tools/bind-guidance.d.ts.map +1 -0
- package/dist/tools/bind-guidance.js +95 -0
- package/dist/tools/bind-guidance.js.map +1 -0
- package/dist/tools/elements/builders.d.ts.map +1 -1
- package/dist/tools/elements/builders.js +59 -11
- package/dist/tools/elements/builders.js.map +1 -1
- package/dist/tools/elements/handlers-write.d.ts +19 -2
- package/dist/tools/elements/handlers-write.d.ts.map +1 -1
- package/dist/tools/elements/handlers-write.js +179 -10
- package/dist/tools/elements/handlers-write.js.map +1 -1
- package/dist/tools/elements/handlers.d.ts +6 -1
- package/dist/tools/elements/handlers.d.ts.map +1 -1
- package/dist/tools/elements/handlers.js +74 -7
- package/dist/tools/elements/handlers.js.map +1 -1
- package/dist/tools/elements/layout-hierarchy-rules.d.ts +62 -0
- package/dist/tools/elements/layout-hierarchy-rules.d.ts.map +1 -0
- package/dist/tools/elements/layout-hierarchy-rules.js +154 -0
- package/dist/tools/elements/layout-hierarchy-rules.js.map +1 -0
- package/dist/tools/format/elements-format.d.ts +35 -0
- package/dist/tools/format/elements-format.d.ts.map +1 -1
- package/dist/tools/format/elements-format.js +124 -1
- package/dist/tools/format/elements-format.js.map +1 -1
- package/dist/tools/format/inspection-format.d.ts +18 -0
- package/dist/tools/format/inspection-format.d.ts.map +1 -1
- package/dist/tools/format/inspection-format.js +22 -1
- package/dist/tools/format/inspection-format.js.map +1 -1
- package/dist/tools/format/pages-format.d.ts.map +1 -1
- package/dist/tools/format/pages-format.js +7 -0
- package/dist/tools/format/pages-format.js.map +1 -1
- package/dist/tools/format/sources-format.d.ts +8 -0
- package/dist/tools/format/sources-format.d.ts.map +1 -1
- package/dist/tools/format/sources-format.js +10 -0
- package/dist/tools/format/sources-format.js.map +1 -1
- package/dist/tools/health.d.ts.map +1 -1
- package/dist/tools/health.js +24 -0
- package/dist/tools/health.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/inspection.d.ts +24 -0
- package/dist/tools/inspection.d.ts.map +1 -1
- package/dist/tools/inspection.js +140 -41
- package/dist/tools/inspection.js.map +1 -1
- package/dist/tools/layout-flatten.d.ts +11 -8
- package/dist/tools/layout-flatten.d.ts.map +1 -1
- package/dist/tools/layout-flatten.js +17 -6
- package/dist/tools/layout-flatten.js.map +1 -1
- package/dist/tools/multi-items/builders.d.ts.map +1 -1
- package/dist/tools/multi-items/builders.js +11 -2
- package/dist/tools/multi-items/builders.js.map +1 -1
- package/dist/tools/multi-items/inspect-handler.d.ts +13 -0
- package/dist/tools/multi-items/inspect-handler.d.ts.map +1 -1
- package/dist/tools/multi-items/inspect-handler.js +147 -3
- package/dist/tools/multi-items/inspect-handler.js.map +1 -1
- package/dist/tools/pages/builders.d.ts.map +1 -1
- package/dist/tools/pages/builders.js +88 -25
- package/dist/tools/pages/builders.js.map +1 -1
- package/dist/tools/pages/handlers-read.d.ts +5 -1
- package/dist/tools/pages/handlers-read.d.ts.map +1 -1
- package/dist/tools/pages/handlers-read.js +192 -47
- package/dist/tools/pages/handlers-read.js.map +1 -1
- package/dist/tools/pages/handlers-write.d.ts +95 -1
- package/dist/tools/pages/handlers-write.d.ts.map +1 -1
- package/dist/tools/pages/handlers-write.js +137 -8
- package/dist/tools/pages/handlers-write.js.map +1 -1
- package/dist/tools/pages/index.d.ts +1 -1
- package/dist/tools/pages/index.d.ts.map +1 -1
- package/dist/tools/pages/index.js +1 -1
- package/dist/tools/pages/index.js.map +1 -1
- package/dist/tools/pages/schemas.d.ts +54 -0
- package/dist/tools/pages/schemas.d.ts.map +1 -1
- package/dist/tools/pages/schemas.js +199 -2
- package/dist/tools/pages/schemas.js.map +1 -1
- package/dist/tools/shared-schemas.d.ts.map +1 -1
- package/dist/tools/shared-schemas.js +15 -13
- package/dist/tools/shared-schemas.js.map +1 -1
- package/dist/tools/sources/builders.d.ts.map +1 -1
- package/dist/tools/sources/builders.js +64 -6
- package/dist/tools/sources/builders.js.map +1 -1
- package/dist/tools/sources/handlers-bind.d.ts +13 -1
- package/dist/tools/sources/handlers-bind.d.ts.map +1 -1
- package/dist/tools/sources/handlers-bind.js +163 -1
- package/dist/tools/sources/handlers-bind.js.map +1 -1
- package/dist/tools/sources/handlers.d.ts +3 -0
- package/dist/tools/sources/handlers.d.ts.map +1 -1
- package/dist/tools/sources/handlers.js +43 -6
- package/dist/tools/sources/handlers.js.map +1 -1
- package/dist/tools/sparse-fields.d.ts +23 -0
- package/dist/tools/sparse-fields.d.ts.map +1 -1
- package/dist/tools/sparse-fields.js +29 -0
- package/dist/tools/sparse-fields.js.map +1 -1
- package/dist/tools/sublayout/builders.d.ts +23 -0
- package/dist/tools/sublayout/builders.d.ts.map +1 -0
- package/dist/tools/sublayout/builders.js +54 -0
- package/dist/tools/sublayout/builders.js.map +1 -0
- package/dist/tools/sublayout/index.d.ts +13 -0
- package/dist/tools/sublayout/index.d.ts.map +1 -0
- package/dist/tools/sublayout/index.js +13 -0
- package/dist/tools/sublayout/index.js.map +1 -0
- package/dist/tools/sublayout/inspect-sublayout-handler.d.ts +95 -0
- package/dist/tools/sublayout/inspect-sublayout-handler.d.ts.map +1 -0
- package/dist/tools/sublayout/inspect-sublayout-handler.js +181 -0
- package/dist/tools/sublayout/inspect-sublayout-handler.js.map +1 -0
- package/dist/tools/tool-builder/results.d.ts +31 -0
- package/dist/tools/tool-builder/results.d.ts.map +1 -1
- package/dist/tools/tool-builder/results.js +95 -4
- package/dist/tools/tool-builder/results.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +4 -2
- package/skills/yt-builder-mcp/SKILL.md +146 -81
|
@@ -1 +1 @@
|
|
|
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,E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SAAS,GACzC,MAAM,CAQR"}
|
|
@@ -162,4 +162,33 @@ export function projectionFeedback(items, requested) {
|
|
|
162
162
|
});
|
|
163
163
|
return { available_fields: available, unknown_fields: unknown };
|
|
164
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* F23 (2026-06-09): single source of truth for the LOUD text-leg warning
|
|
167
|
+
* a tool appends to its table header when a `fields[]` projection
|
|
168
|
+
* contained keys that did not exist on any row.
|
|
169
|
+
*
|
|
170
|
+
* Before this helper every read tool assembled the note inline (subtly
|
|
171
|
+
* different wording per tool, and a new tool wiring `projectionFeedback`
|
|
172
|
+
* could silently forget the text-leg note entirely — only the
|
|
173
|
+
* structuredContent `unknown_fields` array surfaced it, which cold
|
|
174
|
+
* agents never read). Centralising the string here means ALL tools
|
|
175
|
+
* surface the identical, self-correcting signal:
|
|
176
|
+
*
|
|
177
|
+
* " (unknown projection fields ignored: type — available: rel_path, …)"
|
|
178
|
+
*
|
|
179
|
+
* Returns the EMPTY string when there is nothing to warn about (feedback
|
|
180
|
+
* undefined, or `unknown_fields` empty) so call-sites can unconditionally
|
|
181
|
+
* append the result to their header.
|
|
182
|
+
*
|
|
183
|
+
* The leading space lets a call-site write `header${warning}` without an
|
|
184
|
+
* extra separator; the parentheses keep it visually scoped inside the
|
|
185
|
+
* header line.
|
|
186
|
+
*/
|
|
187
|
+
export function projectionWarning(feedback) {
|
|
188
|
+
if (feedback === undefined || feedback.unknown_fields.length === 0) {
|
|
189
|
+
return '';
|
|
190
|
+
}
|
|
191
|
+
return (` (unknown projection fields ignored: ${feedback.unknown_fields.join(', ')}` +
|
|
192
|
+
` — available: ${feedback.available_fields.join(', ')})`);
|
|
193
|
+
}
|
|
165
194
|
//# sourceMappingURL=sparse-fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sparse-fields.js","sourceRoot":"","sources":["../../src/tools/sparse-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,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G,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACnC,sEAAsE;IACtE,oEAAoE;IACpE,kEAAkE;IAClE,kBAAkB;IAClB,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QACnC,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,OAAO,GAAG,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;AACpE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,iBAAiB,CAC7B,QAAwC;IAExC,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjE,OAAO,EAAE,CAAC;IACd,CAAC;IACD,OAAO,CACH,wCAAwC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC5E,iBAAiB,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC3D,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sublayout tool builder.
|
|
3
|
+
*
|
|
4
|
+
* Surfaces one tool that operates on the YT5 `< SUBLAYOUT` mechanism
|
|
5
|
+
* (F154 / F93):
|
|
6
|
+
*
|
|
7
|
+
* yootheme_builder_inspect_sublayout
|
|
8
|
+
* → Reports the fragment subtree (bindable leaves with full JSON-Pointer
|
|
9
|
+
* paths) AND the render-time inner grid (gated title/image props), so an
|
|
10
|
+
* agent enriching a panel/grid_item binds the right node and avoids the
|
|
11
|
+
* silent-no-op trap (grid props set but the gate unsatisfied).
|
|
12
|
+
*
|
|
13
|
+
* L2 (advanced lane) — routed via `yootheme_builder_advanced`. It is a
|
|
14
|
+
* specialized layout diagnostic for one element family (panel/grid_item
|
|
15
|
+
* enrichment), not a hot-path every workflow needs (unlike
|
|
16
|
+
* inspect_multi_items_binding, which earns its L1 slot).
|
|
17
|
+
*
|
|
18
|
+
* @license MIT
|
|
19
|
+
*/
|
|
20
|
+
import type { ClientPool } from '../../sites/client-pool.js';
|
|
21
|
+
import { type AnyToolDefinition } from '../tool-builder.js';
|
|
22
|
+
export declare function buildSublayoutTools(pool: ClientPool): readonly AnyToolDefinition[];
|
|
23
|
+
//# sourceMappingURL=builders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/tools/sublayout/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,EAIH,KAAK,iBAAiB,EACzB,MAAM,oBAAoB,CAAC;AAQ5B,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,iBAAiB,EAAE,CA+BlF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sublayout tool builder.
|
|
3
|
+
*
|
|
4
|
+
* Surfaces one tool that operates on the YT5 `< SUBLAYOUT` mechanism
|
|
5
|
+
* (F154 / F93):
|
|
6
|
+
*
|
|
7
|
+
* yootheme_builder_inspect_sublayout
|
|
8
|
+
* → Reports the fragment subtree (bindable leaves with full JSON-Pointer
|
|
9
|
+
* paths) AND the render-time inner grid (gated title/image props), so an
|
|
10
|
+
* agent enriching a panel/grid_item binds the right node and avoids the
|
|
11
|
+
* silent-no-op trap (grid props set but the gate unsatisfied).
|
|
12
|
+
*
|
|
13
|
+
* L2 (advanced lane) — routed via `yootheme_builder_advanced`. It is a
|
|
14
|
+
* specialized layout diagnostic for one element family (panel/grid_item
|
|
15
|
+
* enrichment), not a hot-path every workflow needs (unlike
|
|
16
|
+
* inspect_multi_items_binding, which earns its L1 slot).
|
|
17
|
+
*
|
|
18
|
+
* @license MIT
|
|
19
|
+
*/
|
|
20
|
+
import { withSiteRetry } from '../pool-resolve-helper.js';
|
|
21
|
+
import { ELEMENT_PATH, SITE_ID_SCHEMA, TEMPLATE_ID } from '../shared-schemas.js';
|
|
22
|
+
import { defineTool, readOnly, withSiteMeta, } from '../tool-builder.js';
|
|
23
|
+
import { InspectionCache } from '../multi-items/inspection-cache.js';
|
|
24
|
+
import { INSPECT_SUBLAYOUT_OUTPUT_SCHEMA, handleInspectSublayout, } from './inspect-sublayout-handler.js';
|
|
25
|
+
export function buildSublayoutTools(pool) {
|
|
26
|
+
// One shared inspection cache per tool-build, keyed on (template_id,
|
|
27
|
+
// element_path, global-etag) with a 60s TTL. A write bumps the global
|
|
28
|
+
// etag and naturally invalidates the entry (mirrors multi-items).
|
|
29
|
+
const inspectionCache = new InspectionCache();
|
|
30
|
+
return [
|
|
31
|
+
defineTool({
|
|
32
|
+
name: 'yootheme_builder_inspect_sublayout',
|
|
33
|
+
description: 'Inspects a panel/grid_item `< SUBLAYOUT`: lists the `fragment` subtree ' +
|
|
34
|
+
'bindable leaves (with JSON-Pointer paths to bind on — NOT the container) ' +
|
|
35
|
+
'and the render-time inner grid. Flags `ungated_grid_prop` (blocking): grid ' +
|
|
36
|
+
'props set but the gate (title_align=left / image_align=left|right) ' +
|
|
37
|
+
'unsatisfied → silent no-op. For container↔item binding see ' +
|
|
38
|
+
'inspect_multi_items_binding. ' +
|
|
39
|
+
'Operates on the default site unless site_id is provided.',
|
|
40
|
+
inputSchema: {
|
|
41
|
+
site_id: SITE_ID_SCHEMA,
|
|
42
|
+
template_id: TEMPLATE_ID,
|
|
43
|
+
element_path: ELEMENT_PATH,
|
|
44
|
+
},
|
|
45
|
+
outputSchema: INSPECT_SUBLAYOUT_OUTPUT_SCHEMA,
|
|
46
|
+
annotations: readOnly('Inspect Sublayout'),
|
|
47
|
+
handler: async ({ site_id, ...rest }) => withSiteRetry(pool, site_id, async (client, site) => {
|
|
48
|
+
const deps = { client, cache: inspectionCache };
|
|
49
|
+
return withSiteMeta(await handleInspectSublayout(deps, rest), site);
|
|
50
|
+
}),
|
|
51
|
+
}),
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=builders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.js","sourceRoot":"","sources":["../../../src/tools/sublayout/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EACH,UAAU,EACV,QAAQ,EACR,YAAY,GAEf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EACH,+BAA+B,EAC/B,sBAAsB,GAEzB,MAAM,gCAAgC,CAAC;AAExC,MAAM,UAAU,mBAAmB,CAAC,IAAgB;IAChD,qEAAqE;IACrE,sEAAsE;IACtE,kEAAkE;IAClE,MAAM,eAAe,GAAG,IAAI,eAAe,EAA2B,CAAC;IAEvE,OAAO;QACH,UAAU,CAAC;YACP,IAAI,EAAE,oCAAoC;YAC1C,WAAW,EACP,yEAAyE;gBACzE,2EAA2E;gBAC3E,6EAA6E;gBAC7E,qEAAqE;gBACrE,6DAA6D;gBAC7D,+BAA+B;gBAC/B,0DAA0D;YAC9D,WAAW,EAAE;gBACT,OAAO,EAAE,cAAc;gBACvB,WAAW,EAAE,WAAW;gBACxB,YAAY,EAAE,YAAY;aAC7B;YACD,YAAY,EAAE,+BAA+B;YAC7C,WAAW,EAAE,QAAQ,CAAC,mBAAmB,CAAC;YAC1C,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CACpC,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;gBAChD,MAAM,IAAI,GAAyB,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;gBACtE,OAAO,YAAY,CAAC,MAAM,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACxE,CAAC,CAAC;SACT,CAAC;KACL,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sublayout tool barrel — public entry-point for the YT5 `< SUBLAYOUT`
|
|
3
|
+
* inspection tool (F154 / F93).
|
|
4
|
+
*
|
|
5
|
+
* yootheme_builder_inspect_sublayout
|
|
6
|
+
* → Report the fragment subtree (bindable leaves) + the render-time inner
|
|
7
|
+
* grid (gated props) for a panel/grid_item.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
export { buildSublayoutTools } from './builders.js';
|
|
12
|
+
export { INSPECT_SUBLAYOUT_OUTPUT_SCHEMA, handleInspectSublayout, type SublayoutHandlerDeps, } from './inspect-sublayout-handler.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/sublayout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACH,+BAA+B,EAC/B,sBAAsB,EACtB,KAAK,oBAAoB,GAC5B,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sublayout tool barrel — public entry-point for the YT5 `< SUBLAYOUT`
|
|
3
|
+
* inspection tool (F154 / F93).
|
|
4
|
+
*
|
|
5
|
+
* yootheme_builder_inspect_sublayout
|
|
6
|
+
* → Report the fragment subtree (bindable leaves) + the render-time inner
|
|
7
|
+
* grid (gated props) for a panel/grid_item.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
export { buildSublayoutTools } from './builders.js';
|
|
12
|
+
export { INSPECT_SUBLAYOUT_OUTPUT_SCHEMA, handleInspectSublayout, } from './inspect-sublayout-handler.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/sublayout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACH,+BAA+B,EAC/B,sBAAsB,GAEzB,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `inspect_sublayout` handler — surfaces the YT5 `< SUBLAYOUT` mechanism
|
|
3
|
+
* (F154 / F93) via REST round-trip.
|
|
4
|
+
*
|
|
5
|
+
* YT5's `< SUBLAYOUT` breadcrumb conflates TWO structurally different things:
|
|
6
|
+
*
|
|
7
|
+
* 1. The `fragment` element — a real container node whose bind-able leaves
|
|
8
|
+
* (title, meta, crest image) live in `fragment.children[...]`, NOT on the
|
|
9
|
+
* `panel`/`grid_item` the Customizer first selected.
|
|
10
|
+
* 2. The render-time inner grid — `panel`/`grid_item` build a `uk-grid` from
|
|
11
|
+
* PROPS injected by the container at render. There is NO JSON node for it,
|
|
12
|
+
* and it is GATED: the inner wrapper is only emitted when
|
|
13
|
+
* `title_align === 'left'` / `image_align ∈ {left,right}`. Patching
|
|
14
|
+
* `title_grid_width` without first satisfying the gate is a SILENT no-op.
|
|
15
|
+
*
|
|
16
|
+
* Companion of the PHP `SublayoutInspector` — see
|
|
17
|
+
* src/modules/builder-source-binding/src/SublayoutInspector.php for the
|
|
18
|
+
* report shape. Mirrors the `inspect_multi_items_binding` handler:
|
|
19
|
+
* optional InspectionCache keyed on (template_id, element_path, global-etag).
|
|
20
|
+
*
|
|
21
|
+
* @license MIT
|
|
22
|
+
*/
|
|
23
|
+
import { z } from 'zod';
|
|
24
|
+
import { type RestClient } from '../../client.js';
|
|
25
|
+
import { type ToolResult } from '../tool-builder.js';
|
|
26
|
+
import { InspectionCache } from '../multi-items/inspection-cache.js';
|
|
27
|
+
export declare const INSPECT_SUBLAYOUT_OUTPUT_SCHEMA: z.ZodObject<{
|
|
28
|
+
template_id: z.ZodString;
|
|
29
|
+
report: z.ZodObject<{
|
|
30
|
+
element_path: z.ZodString;
|
|
31
|
+
element_type: z.ZodString;
|
|
32
|
+
is_sublayout_capable: z.ZodBoolean;
|
|
33
|
+
fragments: z.ZodArray<z.ZodObject<{
|
|
34
|
+
fragment_path: z.ZodString;
|
|
35
|
+
child_count: z.ZodNumber;
|
|
36
|
+
bindable_leaves: z.ZodArray<z.ZodObject<{
|
|
37
|
+
leaf_path: z.ZodString;
|
|
38
|
+
element_type: z.ZodString;
|
|
39
|
+
bindable_props: z.ZodArray<z.ZodString>;
|
|
40
|
+
is_bound: z.ZodBoolean;
|
|
41
|
+
bound_source_name: z.ZodNullable<z.ZodString>;
|
|
42
|
+
bound_source_exists: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
grid: z.ZodObject<{
|
|
46
|
+
title: z.ZodObject<{
|
|
47
|
+
gate_prop: z.ZodString;
|
|
48
|
+
gate_value: z.ZodNullable<z.ZodString>;
|
|
49
|
+
gate_satisfied: z.ZodBoolean;
|
|
50
|
+
active_props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
image: z.ZodObject<{
|
|
53
|
+
gate_prop: z.ZodString;
|
|
54
|
+
gate_value: z.ZodNullable<z.ZodString>;
|
|
55
|
+
gate_satisfied: z.ZodBoolean;
|
|
56
|
+
active_props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
warnings: z.ZodArray<z.ZodObject<{
|
|
60
|
+
code: z.ZodString;
|
|
61
|
+
message: z.ZodString;
|
|
62
|
+
props: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
63
|
+
gate_prop: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
no_sublayout: z.ZodBoolean;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
etag: z.ZodString;
|
|
68
|
+
hint: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
severity: z.ZodEnum<{
|
|
70
|
+
advisory: "advisory";
|
|
71
|
+
blocking: "blocking";
|
|
72
|
+
}>;
|
|
73
|
+
message: z.ZodString;
|
|
74
|
+
}, z.core.$strip>>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
/** Severity of the advisory hint attached to every report. */
|
|
77
|
+
export type HintSeverity = 'advisory' | 'blocking';
|
|
78
|
+
/** The structured inspect payload the handler caches + emits. */
|
|
79
|
+
type InspectStructured = Record<string, unknown>;
|
|
80
|
+
export interface SublayoutHandlerDeps {
|
|
81
|
+
readonly client: RestClient;
|
|
82
|
+
/**
|
|
83
|
+
* Optional inspection cache. When provided, results are keyed on
|
|
84
|
+
* (template_id, element_path, global-etag) with a 60s TTL. A write bumps
|
|
85
|
+
* the global etag and naturally invalidates the entry. Omit to disable
|
|
86
|
+
* caching (e.g. shape-pin tests that assert the raw round-trip).
|
|
87
|
+
*/
|
|
88
|
+
readonly cache?: InspectionCache<InspectStructured>;
|
|
89
|
+
}
|
|
90
|
+
export declare function handleInspectSublayout({ client, cache }: SublayoutHandlerDeps, { template_id, element_path }: {
|
|
91
|
+
template_id: string;
|
|
92
|
+
element_path: string;
|
|
93
|
+
}): Promise<ToolResult>;
|
|
94
|
+
export {};
|
|
95
|
+
//# sourceMappingURL=inspect-sublayout-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect-sublayout-handler.d.ts","sourceRoot":"","sources":["../../../src/tools/sublayout/inspect-sublayout-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAuC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAA6C,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAoCrE,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuB1C,CAAC;AAEH,8DAA8D;AAC9D,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,UAAU,CAAC;AAEnD,iEAAiE;AACjE,KAAK,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;CACvD;AAyED,wBAAsB,sBAAsB,CACxC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,oBAAoB,EACvC,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC7E,OAAO,CAAC,UAAU,CAAC,CAuCrB"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `inspect_sublayout` handler — surfaces the YT5 `< SUBLAYOUT` mechanism
|
|
3
|
+
* (F154 / F93) via REST round-trip.
|
|
4
|
+
*
|
|
5
|
+
* YT5's `< SUBLAYOUT` breadcrumb conflates TWO structurally different things:
|
|
6
|
+
*
|
|
7
|
+
* 1. The `fragment` element — a real container node whose bind-able leaves
|
|
8
|
+
* (title, meta, crest image) live in `fragment.children[...]`, NOT on the
|
|
9
|
+
* `panel`/`grid_item` the Customizer first selected.
|
|
10
|
+
* 2. The render-time inner grid — `panel`/`grid_item` build a `uk-grid` from
|
|
11
|
+
* PROPS injected by the container at render. There is NO JSON node for it,
|
|
12
|
+
* and it is GATED: the inner wrapper is only emitted when
|
|
13
|
+
* `title_align === 'left'` / `image_align ∈ {left,right}`. Patching
|
|
14
|
+
* `title_grid_width` without first satisfying the gate is a SILENT no-op.
|
|
15
|
+
*
|
|
16
|
+
* Companion of the PHP `SublayoutInspector` — see
|
|
17
|
+
* src/modules/builder-source-binding/src/SublayoutInspector.php for the
|
|
18
|
+
* report shape. Mirrors the `inspect_multi_items_binding` handler:
|
|
19
|
+
* optional InspectionCache keyed on (template_id, element_path, global-etag).
|
|
20
|
+
*
|
|
21
|
+
* @license MIT
|
|
22
|
+
*/
|
|
23
|
+
import { z } from 'zod';
|
|
24
|
+
import { encodeElementPath, encodeTemplateId } from '../../client.js';
|
|
25
|
+
import { errorResult, jsonResult, structuredResult } from '../tool-builder.js';
|
|
26
|
+
import { capInspectionDepth } from '../multi-items/format/inspection-format.js';
|
|
27
|
+
/** A single render-time inner-grid axis (title | image). */
|
|
28
|
+
const GRID_AXIS_SCHEMA = z.object({
|
|
29
|
+
gate_prop: z.string(),
|
|
30
|
+
gate_value: z.string().nullable(),
|
|
31
|
+
gate_satisfied: z.boolean(),
|
|
32
|
+
active_props: z.record(z.string(), z.unknown()),
|
|
33
|
+
});
|
|
34
|
+
/** A bindable leaf inside a fragment subtree. */
|
|
35
|
+
const BINDABLE_LEAF_SCHEMA = z.object({
|
|
36
|
+
leaf_path: z.string(),
|
|
37
|
+
element_type: z.string(),
|
|
38
|
+
bindable_props: z.array(z.string()),
|
|
39
|
+
is_bound: z.boolean(),
|
|
40
|
+
bound_source_name: z.string().nullable(),
|
|
41
|
+
// null when the registry is not wired (UNKNOWN, never a false miss).
|
|
42
|
+
bound_source_exists: z.boolean().nullable().optional(),
|
|
43
|
+
});
|
|
44
|
+
/** A direct fragment child of the addressed container. */
|
|
45
|
+
const FRAGMENT_SCHEMA = z.object({
|
|
46
|
+
fragment_path: z.string(),
|
|
47
|
+
child_count: z.number().int().nonnegative(),
|
|
48
|
+
bindable_leaves: z.array(BINDABLE_LEAF_SCHEMA),
|
|
49
|
+
});
|
|
50
|
+
/** A single enrichment-hazard warning. */
|
|
51
|
+
const SUBLAYOUT_WARNING_SCHEMA = z.object({
|
|
52
|
+
code: z.string(),
|
|
53
|
+
message: z.string(),
|
|
54
|
+
props: z.array(z.string()).optional(),
|
|
55
|
+
gate_prop: z.string().optional(),
|
|
56
|
+
});
|
|
57
|
+
export const INSPECT_SUBLAYOUT_OUTPUT_SCHEMA = z.object({
|
|
58
|
+
template_id: z.string(),
|
|
59
|
+
report: z.object({
|
|
60
|
+
element_path: z.string(),
|
|
61
|
+
element_type: z.string(),
|
|
62
|
+
is_sublayout_capable: z.boolean(),
|
|
63
|
+
fragments: z.array(FRAGMENT_SCHEMA),
|
|
64
|
+
grid: z.object({
|
|
65
|
+
title: GRID_AXIS_SCHEMA,
|
|
66
|
+
image: GRID_AXIS_SCHEMA,
|
|
67
|
+
}),
|
|
68
|
+
warnings: z.array(SUBLAYOUT_WARNING_SCHEMA),
|
|
69
|
+
no_sublayout: z.boolean(),
|
|
70
|
+
}),
|
|
71
|
+
etag: z.string(),
|
|
72
|
+
// Typed advisory/blocking marker. `blocking` when an ungated grid prop is
|
|
73
|
+
// a silent no-op (the trap this tool exists for); `advisory` otherwise.
|
|
74
|
+
hint: z
|
|
75
|
+
.object({
|
|
76
|
+
severity: z.enum(['advisory', 'blocking']),
|
|
77
|
+
message: z.string(),
|
|
78
|
+
})
|
|
79
|
+
.optional(),
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* Classify the report into an advisory/blocking hint.
|
|
83
|
+
*
|
|
84
|
+
* Precedence: an `ungated_grid_prop` warning (a silent no-op — the trap this
|
|
85
|
+
* tool exists for) is `blocking`; everything else is `advisory`. A
|
|
86
|
+
* sublayout-less element gets a short "nothing to enrich" advisory so the
|
|
87
|
+
* agent does not keep probing.
|
|
88
|
+
*/
|
|
89
|
+
function buildHint(report) {
|
|
90
|
+
const r = (report ?? {});
|
|
91
|
+
const warnings = Array.isArray(r.warnings)
|
|
92
|
+
? r.warnings
|
|
93
|
+
: [];
|
|
94
|
+
const ungated = warnings.find((w) => w.code === 'ungated_grid_prop');
|
|
95
|
+
if (ungated !== undefined && typeof ungated.message === 'string' && ungated.message !== '') {
|
|
96
|
+
return { severity: 'blocking', message: ungated.message };
|
|
97
|
+
}
|
|
98
|
+
if (r.no_sublayout === true) {
|
|
99
|
+
return {
|
|
100
|
+
severity: 'advisory',
|
|
101
|
+
message: 'This element has no `fragment` sublayout child and no inner-grid ' +
|
|
102
|
+
'props — there is nothing to enrich here. Bind a source directly on a ' +
|
|
103
|
+
'leaf via yootheme_builder_element_bind_source, or add a fragment first.',
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (r.is_sublayout_capable === false) {
|
|
107
|
+
return {
|
|
108
|
+
severity: 'advisory',
|
|
109
|
+
message: 'This element type is not sublayout-capable (panel / grid_item). The ' +
|
|
110
|
+
'fragment subtree + inner-grid gate apply only to those containers.',
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
severity: 'advisory',
|
|
115
|
+
message: 'Sublayout looks consistent. Bind the source on a `fragment.children` leaf ' +
|
|
116
|
+
'(use a leaf_path from the report), NOT on this container. Inner-grid props ' +
|
|
117
|
+
'only take effect when their gate (title_align=left / image_align=left|right) ' +
|
|
118
|
+
'is satisfied.',
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Render a structured inspect payload into the ToolResult envelope. The text
|
|
123
|
+
* leg is depth-capped so a deeply-nested report cannot balloon the LLM
|
|
124
|
+
* context; structuredContent stays verbatim so it keeps validating against
|
|
125
|
+
* INSPECT_SUBLAYOUT_OUTPUT_SCHEMA (additionalProperties:false).
|
|
126
|
+
*/
|
|
127
|
+
function renderInspectResult(structured) {
|
|
128
|
+
const text = jsonResult(capInspectionDepth(structured));
|
|
129
|
+
return structuredResult(text, structured);
|
|
130
|
+
}
|
|
131
|
+
export async function handleInspectSublayout({ client, cache }, { template_id, element_path }) {
|
|
132
|
+
const encoded = encodeElementPath(element_path);
|
|
133
|
+
try {
|
|
134
|
+
// When a cache is wired, key on the GLOBAL state etag. Every write
|
|
135
|
+
// bumps it, so a mutated template surfaces a fresh etag → a new key →
|
|
136
|
+
// a guaranteed miss. Read-only repeats within the TTL skip the inspect
|
|
137
|
+
// round-trip below.
|
|
138
|
+
let cacheEtag;
|
|
139
|
+
if (cache !== undefined) {
|
|
140
|
+
cacheEtag = await fetchStateEtag(client);
|
|
141
|
+
if (cacheEtag !== undefined) {
|
|
142
|
+
const cached = cache.get(template_id, element_path, cacheEtag);
|
|
143
|
+
if (cached !== undefined) {
|
|
144
|
+
return renderInspectResult(cached);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const data = await client.get(`/pages/${encodeTemplateId(template_id)}/elements/${encoded}/sublayout/inspect`);
|
|
149
|
+
const hint = buildHint(data.report);
|
|
150
|
+
const structured = { ...data, hint };
|
|
151
|
+
if (cache !== undefined && cacheEtag !== undefined) {
|
|
152
|
+
cache.set(template_id, element_path, cacheEtag, structured);
|
|
153
|
+
}
|
|
154
|
+
return renderInspectResult(structured);
|
|
155
|
+
}
|
|
156
|
+
catch (e) {
|
|
157
|
+
return errorResult({
|
|
158
|
+
error: e,
|
|
159
|
+
context: { template_id, element_path },
|
|
160
|
+
hint: 'Pass the CONTAINER element_path (a `panel` or `grid_item`) — the tool ' +
|
|
161
|
+
'descends into its fragment child itself. Verify the path via ' +
|
|
162
|
+
'yootheme_builder_element_list (JSON-Pointer, RFC-6901: /0/children/1).',
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Read the global state ETag used as the cache-invalidation token. Returns
|
|
168
|
+
* `undefined` (cache disabled for this call) if the etag probe fails or
|
|
169
|
+
* returns a non-string — a missing etag must never poison the cache key, and
|
|
170
|
+
* a probe failure should fall through to a live inspect rather than abort.
|
|
171
|
+
*/
|
|
172
|
+
async function fetchStateEtag(client) {
|
|
173
|
+
try {
|
|
174
|
+
const res = await client.get('/etag');
|
|
175
|
+
return typeof res.etag === 'string' && res.etag !== '' ? res.etag : undefined;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=inspect-sublayout-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect-sublayout-handler.js","sourceRoot":"","sources":["../../../src/tools/sublayout/inspect-sublayout-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAmB,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAmB,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAGhF,4DAA4D;AAC5D,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,cAAc,EAAE,CAAC,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AC"}
|
|
@@ -12,6 +12,25 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import type { ResolvedSite } from '../../sites/registry.js';
|
|
14
14
|
import type { ToolContent, ToolResult } from './types.js';
|
|
15
|
+
/**
|
|
16
|
+
* F80 (2026-06-10): the size at/above which a JSON-document text body is
|
|
17
|
+
* split off into its own content block instead of carrying the in-band
|
|
18
|
+
* `[label @ host] ` site-prefix.
|
|
19
|
+
*
|
|
20
|
+
* Why a threshold rather than "all JSON": a tool host (Claude Code, …)
|
|
21
|
+
* spills only OVERSIZED tool results to a temp file. That file is read
|
|
22
|
+
* back with `jq`, so the bytes must be pure JSON — an in-band prefix
|
|
23
|
+
* corrupts the first line and breaks the parse (the observed F80
|
|
24
|
+
* friction on `page_get_layout`, a multi-kB layout dump). Small JSON
|
|
25
|
+
* envelopes (error results, single-element confirms, short lists) are
|
|
26
|
+
* NEVER dumped, so they keep the in-band prefix — which preserves the
|
|
27
|
+
* long-standing contract that `content[0].text` is the directly-parseable
|
|
28
|
+
* JSON for those results (141 error-matrix / handler tests depend on it).
|
|
29
|
+
*
|
|
30
|
+
* 8 kB is comfortably below any host's spill threshold yet above every
|
|
31
|
+
* small structured envelope this surface emits.
|
|
32
|
+
*/
|
|
33
|
+
export declare const SITE_PREFIX_JSON_SPLIT_THRESHOLD: number;
|
|
15
34
|
/**
|
|
16
35
|
* Convert any JSON-serializable value into the MCP content envelope
|
|
17
36
|
* (2-space JSON). Wave G.6.4b: every payload is deep-walked through
|
|
@@ -37,6 +56,18 @@ export declare function errorResult(opts: {
|
|
|
37
56
|
* Confirm-guard preview helper for destructive tools. Returns the
|
|
38
57
|
* preview `ToolResult` when `confirm` is false; callers `return` it
|
|
39
58
|
* before executing the destructive REST call.
|
|
59
|
+
*
|
|
60
|
+
* F131 (Wave 4a): the blocked-state result is now STRUCTURALLY distinct
|
|
61
|
+
* from a successful mutation. Previously the preview was a plain
|
|
62
|
+
* `jsonResult` with no `isError` — envelope-identical to a success — so a
|
|
63
|
+
* model that did not parse `preview:true` read "delete succeeded" and
|
|
64
|
+
* silently left the element in place (the dry-run / silent-no-op footgun
|
|
65
|
+
* class). Three redundant signals now make the block unmistakable:
|
|
66
|
+
* 1. result-level `isError: true` (hosts that only read the error flag),
|
|
67
|
+
* 2. body `applied: false` + `requires_confirmation: true` (structured
|
|
68
|
+
* consumers),
|
|
69
|
+
* 3. a leading "NOT EXECUTED" line in the human-readable warning text
|
|
70
|
+
* (models that skim prose).
|
|
40
71
|
*/
|
|
41
72
|
export declare function confirmGuard(opts: {
|
|
42
73
|
operation: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../src/tools/tool-builder/results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAU1D;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,UAAU,CAM5F;AAaD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;CAChB,GAAG,UAAU,CAYb;AAED
|
|
1
|
+
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../src/tools/tool-builder/results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAU1D;;;;;;;;;;;;;;;;;GAiBG;AACH,eA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