@wootsup/yt-builder-mcp 1.2.0 → 1.4.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.
Files changed (241) hide show
  1. package/README.md +16 -12
  2. package/dist/catalog/build-catalog.d.ts +63 -0
  3. package/dist/catalog/build-catalog.d.ts.map +1 -0
  4. package/dist/catalog/build-catalog.js +166 -0
  5. package/dist/catalog/build-catalog.js.map +1 -0
  6. package/dist/cli/doctor-command.d.ts +21 -0
  7. package/dist/cli/doctor-command.d.ts.map +1 -0
  8. package/dist/cli/doctor-command.js +111 -0
  9. package/dist/cli/doctor-command.js.map +1 -0
  10. package/dist/cli/invocation-decision.d.ts.map +1 -1
  11. package/dist/cli/invocation-decision.js +2 -0
  12. package/dist/cli/invocation-decision.js.map +1 -1
  13. package/dist/client.d.ts +14 -0
  14. package/dist/client.d.ts.map +1 -1
  15. package/dist/client.js +9 -0
  16. package/dist/client.js.map +1 -1
  17. package/dist/diagnostics/ca-trust.d.ts +16 -0
  18. package/dist/diagnostics/ca-trust.d.ts.map +1 -0
  19. package/dist/diagnostics/ca-trust.js +54 -0
  20. package/dist/diagnostics/ca-trust.js.map +1 -0
  21. package/dist/diagnostics/diagnose-network-error.d.ts +37 -0
  22. package/dist/diagnostics/diagnose-network-error.d.ts.map +1 -0
  23. package/dist/diagnostics/diagnose-network-error.js +158 -0
  24. package/dist/diagnostics/diagnose-network-error.js.map +1 -0
  25. package/dist/diagnostics/doctor.d.ts +62 -0
  26. package/dist/diagnostics/doctor.d.ts.map +1 -0
  27. package/dist/diagnostics/doctor.js +165 -0
  28. package/dist/diagnostics/doctor.js.map +1 -0
  29. package/dist/gateway/advanced-read-tool.d.ts +37 -0
  30. package/dist/gateway/advanced-read-tool.d.ts.map +1 -0
  31. package/dist/gateway/advanced-read-tool.js +156 -0
  32. package/dist/gateway/advanced-read-tool.js.map +1 -0
  33. package/dist/gateway/advanced-tool/domains.d.ts +18 -3
  34. package/dist/gateway/advanced-tool/domains.d.ts.map +1 -1
  35. package/dist/gateway/advanced-tool/domains.js +28 -9
  36. package/dist/gateway/advanced-tool/domains.js.map +1 -1
  37. package/dist/gateway/advanced-tool/register.d.ts.map +1 -1
  38. package/dist/gateway/advanced-tool/register.js +43 -11
  39. package/dist/gateway/advanced-tool/register.js.map +1 -1
  40. package/dist/gateway/essentials.d.ts +14 -4
  41. package/dist/gateway/essentials.d.ts.map +1 -1
  42. package/dist/gateway/essentials.js +46 -5
  43. package/dist/gateway/essentials.js.map +1 -1
  44. package/dist/gateway/test-support.d.ts +2 -2
  45. package/dist/gateway/test-support.js +2 -2
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +45 -0
  48. package/dist/index.js.map +1 -1
  49. package/dist/install-skill.d.ts +1 -1
  50. package/dist/install-skill.js +2 -2
  51. package/dist/net/extra-headers.d.ts +66 -0
  52. package/dist/net/extra-headers.d.ts.map +1 -0
  53. package/dist/net/extra-headers.js +164 -0
  54. package/dist/net/extra-headers.js.map +1 -0
  55. package/dist/net/internal-host.d.ts +45 -0
  56. package/dist/net/internal-host.d.ts.map +1 -0
  57. package/dist/net/internal-host.js +164 -0
  58. package/dist/net/internal-host.js.map +1 -0
  59. package/dist/net/proxy-dispatcher.d.ts +40 -0
  60. package/dist/net/proxy-dispatcher.d.ts.map +1 -0
  61. package/dist/net/proxy-dispatcher.js +65 -0
  62. package/dist/net/proxy-dispatcher.js.map +1 -0
  63. package/dist/proxy/bridge.d.ts +43 -0
  64. package/dist/proxy/bridge.d.ts.map +1 -0
  65. package/dist/proxy/bridge.js +155 -0
  66. package/dist/proxy/bridge.js.map +1 -0
  67. package/dist/proxy/mode.d.ts +10 -0
  68. package/dist/proxy/mode.d.ts.map +1 -0
  69. package/dist/proxy/mode.js +20 -0
  70. package/dist/proxy/mode.js.map +1 -0
  71. package/dist/server.d.ts +5 -3
  72. package/dist/server.d.ts.map +1 -1
  73. package/dist/server.js +13 -3
  74. package/dist/server.js.map +1 -1
  75. package/dist/setup-ca-env.d.ts +40 -0
  76. package/dist/setup-ca-env.d.ts.map +1 -0
  77. package/dist/setup-ca-env.js +58 -0
  78. package/dist/setup-ca-env.js.map +1 -0
  79. package/dist/setup-ca-reprobe.d.ts +38 -0
  80. package/dist/setup-ca-reprobe.d.ts.map +1 -0
  81. package/dist/setup-ca-reprobe.js +68 -0
  82. package/dist/setup-ca-reprobe.js.map +1 -0
  83. package/dist/setup-cli.d.ts +37 -2
  84. package/dist/setup-cli.d.ts.map +1 -1
  85. package/dist/setup-cli.js +178 -4
  86. package/dist/setup-cli.js.map +1 -1
  87. package/dist/setup-npx-spec.d.ts +44 -0
  88. package/dist/setup-npx-spec.d.ts.map +1 -0
  89. package/dist/setup-npx-spec.js +66 -0
  90. package/dist/setup-npx-spec.js.map +1 -0
  91. package/dist/setup-prompts.d.ts +14 -1
  92. package/dist/setup-prompts.d.ts.map +1 -1
  93. package/dist/setup-prompts.js +53 -1
  94. package/dist/setup-prompts.js.map +1 -1
  95. package/dist/setup-wizard-defaults.d.ts.map +1 -1
  96. package/dist/setup-wizard-defaults.js +29 -5
  97. package/dist/setup-wizard-defaults.js.map +1 -1
  98. package/dist/setup-wizard-handshake.d.ts +4 -4
  99. package/dist/setup-wizard-handshake.d.ts.map +1 -1
  100. package/dist/setup-wizard-handshake.js +46 -12
  101. package/dist/setup-wizard-handshake.js.map +1 -1
  102. package/dist/setup-wizard-types.d.ts +81 -0
  103. package/dist/setup-wizard-types.d.ts.map +1 -1
  104. package/dist/setup-wizard.d.ts +2 -2
  105. package/dist/setup-wizard.d.ts.map +1 -1
  106. package/dist/setup-wizard.js +140 -18
  107. package/dist/setup-wizard.js.map +1 -1
  108. package/dist/sites/client-pool.d.ts +8 -1
  109. package/dist/sites/client-pool.d.ts.map +1 -1
  110. package/dist/sites/client-pool.js +34 -4
  111. package/dist/sites/client-pool.js.map +1 -1
  112. package/dist/sites/registry.d.ts +30 -0
  113. package/dist/sites/registry.d.ts.map +1 -1
  114. package/dist/sites/registry.js.map +1 -1
  115. package/dist/sites/store.d.ts +8 -1
  116. package/dist/sites/store.d.ts.map +1 -1
  117. package/dist/sites/store.js +17 -2
  118. package/dist/sites/store.js.map +1 -1
  119. package/dist/sites/tools/use-site.d.ts.map +1 -1
  120. package/dist/sites/tools/use-site.js +26 -6
  121. package/dist/sites/tools/use-site.js.map +1 -1
  122. package/dist/tools/bind-guidance.d.ts +80 -0
  123. package/dist/tools/bind-guidance.d.ts.map +1 -0
  124. package/dist/tools/bind-guidance.js +95 -0
  125. package/dist/tools/bind-guidance.js.map +1 -0
  126. package/dist/tools/elements/builders.d.ts.map +1 -1
  127. package/dist/tools/elements/builders.js +63 -13
  128. package/dist/tools/elements/builders.js.map +1 -1
  129. package/dist/tools/elements/handlers-write.d.ts +19 -2
  130. package/dist/tools/elements/handlers-write.d.ts.map +1 -1
  131. package/dist/tools/elements/handlers-write.js +179 -10
  132. package/dist/tools/elements/handlers-write.js.map +1 -1
  133. package/dist/tools/elements/handlers.d.ts +8 -2
  134. package/dist/tools/elements/handlers.d.ts.map +1 -1
  135. package/dist/tools/elements/handlers.js +76 -28
  136. package/dist/tools/elements/handlers.js.map +1 -1
  137. package/dist/tools/elements/layout-hierarchy-rules.d.ts +62 -0
  138. package/dist/tools/elements/layout-hierarchy-rules.d.ts.map +1 -0
  139. package/dist/tools/elements/layout-hierarchy-rules.js +154 -0
  140. package/dist/tools/elements/layout-hierarchy-rules.js.map +1 -0
  141. package/dist/tools/format/elements-format.d.ts +35 -0
  142. package/dist/tools/format/elements-format.d.ts.map +1 -1
  143. package/dist/tools/format/elements-format.js +124 -1
  144. package/dist/tools/format/elements-format.js.map +1 -1
  145. package/dist/tools/format/health-format.d.ts +3 -0
  146. package/dist/tools/format/health-format.d.ts.map +1 -1
  147. package/dist/tools/format/health-format.js +21 -4
  148. package/dist/tools/format/health-format.js.map +1 -1
  149. package/dist/tools/format/inspection-format.d.ts +18 -0
  150. package/dist/tools/format/inspection-format.d.ts.map +1 -1
  151. package/dist/tools/format/inspection-format.js +22 -1
  152. package/dist/tools/format/inspection-format.js.map +1 -1
  153. package/dist/tools/format/pages-format.d.ts.map +1 -1
  154. package/dist/tools/format/pages-format.js +7 -0
  155. package/dist/tools/format/pages-format.js.map +1 -1
  156. package/dist/tools/format/sources-format.d.ts +8 -0
  157. package/dist/tools/format/sources-format.d.ts.map +1 -1
  158. package/dist/tools/format/sources-format.js +10 -0
  159. package/dist/tools/format/sources-format.js.map +1 -1
  160. package/dist/tools/health.d.ts.map +1 -1
  161. package/dist/tools/health.js +56 -0
  162. package/dist/tools/health.js.map +1 -1
  163. package/dist/tools/index.d.ts.map +1 -1
  164. package/dist/tools/index.js +4 -0
  165. package/dist/tools/index.js.map +1 -1
  166. package/dist/tools/inspection.d.ts +24 -0
  167. package/dist/tools/inspection.d.ts.map +1 -1
  168. package/dist/tools/inspection.js +140 -41
  169. package/dist/tools/inspection.js.map +1 -1
  170. package/dist/tools/layout-flatten.d.ts +11 -8
  171. package/dist/tools/layout-flatten.d.ts.map +1 -1
  172. package/dist/tools/layout-flatten.js +17 -6
  173. package/dist/tools/layout-flatten.js.map +1 -1
  174. package/dist/tools/multi-items/builders.d.ts.map +1 -1
  175. package/dist/tools/multi-items/builders.js +11 -2
  176. package/dist/tools/multi-items/builders.js.map +1 -1
  177. package/dist/tools/multi-items/inspect-handler.d.ts +13 -0
  178. package/dist/tools/multi-items/inspect-handler.d.ts.map +1 -1
  179. package/dist/tools/multi-items/inspect-handler.js +147 -3
  180. package/dist/tools/multi-items/inspect-handler.js.map +1 -1
  181. package/dist/tools/pages/builders.d.ts.map +1 -1
  182. package/dist/tools/pages/builders.js +153 -39
  183. package/dist/tools/pages/builders.js.map +1 -1
  184. package/dist/tools/pages/handlers-read.d.ts +40 -5
  185. package/dist/tools/pages/handlers-read.d.ts.map +1 -1
  186. package/dist/tools/pages/handlers-read.js +404 -76
  187. package/dist/tools/pages/handlers-read.js.map +1 -1
  188. package/dist/tools/pages/handlers-write.d.ts +95 -1
  189. package/dist/tools/pages/handlers-write.d.ts.map +1 -1
  190. package/dist/tools/pages/handlers-write.js +137 -8
  191. package/dist/tools/pages/handlers-write.js.map +1 -1
  192. package/dist/tools/pages/index.d.ts +1 -1
  193. package/dist/tools/pages/index.d.ts.map +1 -1
  194. package/dist/tools/pages/index.js +1 -1
  195. package/dist/tools/pages/index.js.map +1 -1
  196. package/dist/tools/pages/schemas.d.ts +74 -5
  197. package/dist/tools/pages/schemas.d.ts.map +1 -1
  198. package/dist/tools/pages/schemas.js +243 -8
  199. package/dist/tools/pages/schemas.js.map +1 -1
  200. package/dist/tools/shared-schemas.d.ts +3 -0
  201. package/dist/tools/shared-schemas.d.ts.map +1 -1
  202. package/dist/tools/shared-schemas.js +43 -13
  203. package/dist/tools/shared-schemas.js.map +1 -1
  204. package/dist/tools/sources/builders.d.ts.map +1 -1
  205. package/dist/tools/sources/builders.js +93 -10
  206. package/dist/tools/sources/builders.js.map +1 -1
  207. package/dist/tools/sources/handlers-bind.d.ts +13 -1
  208. package/dist/tools/sources/handlers-bind.d.ts.map +1 -1
  209. package/dist/tools/sources/handlers-bind.js +163 -1
  210. package/dist/tools/sources/handlers-bind.js.map +1 -1
  211. package/dist/tools/sources/handlers.d.ts +12 -1
  212. package/dist/tools/sources/handlers.d.ts.map +1 -1
  213. package/dist/tools/sources/handlers.js +103 -16
  214. package/dist/tools/sources/handlers.js.map +1 -1
  215. package/dist/tools/sparse-fields.d.ts +73 -0
  216. package/dist/tools/sparse-fields.d.ts.map +1 -1
  217. package/dist/tools/sparse-fields.js +136 -0
  218. package/dist/tools/sparse-fields.js.map +1 -1
  219. package/dist/tools/sublayout/builders.d.ts +23 -0
  220. package/dist/tools/sublayout/builders.d.ts.map +1 -0
  221. package/dist/tools/sublayout/builders.js +54 -0
  222. package/dist/tools/sublayout/builders.js.map +1 -0
  223. package/dist/tools/sublayout/index.d.ts +13 -0
  224. package/dist/tools/sublayout/index.d.ts.map +1 -0
  225. package/dist/tools/sublayout/index.js +13 -0
  226. package/dist/tools/sublayout/index.js.map +1 -0
  227. package/dist/tools/sublayout/inspect-sublayout-handler.d.ts +95 -0
  228. package/dist/tools/sublayout/inspect-sublayout-handler.d.ts.map +1 -0
  229. package/dist/tools/sublayout/inspect-sublayout-handler.js +181 -0
  230. package/dist/tools/sublayout/inspect-sublayout-handler.js.map +1 -0
  231. package/dist/tools/tool-builder/results.d.ts +31 -0
  232. package/dist/tools/tool-builder/results.d.ts.map +1 -1
  233. package/dist/tools/tool-builder/results.js +95 -4
  234. package/dist/tools/tool-builder/results.js.map +1 -1
  235. package/dist/update/update-check.d.ts +56 -0
  236. package/dist/update/update-check.d.ts.map +1 -0
  237. package/dist/update/update-check.js +155 -0
  238. package/dist/update/update-check.js.map +1 -0
  239. package/manifest.json +1 -1
  240. package/package.json +5 -2
  241. package/skills/yt-builder-mcp/SKILL.md +148 -82
@@ -46,6 +46,84 @@ export const FLAT = z
46
46
  .default(false)
47
47
  .describe('When true, response is a flat [{path, element_type, ...}] array. Enables ' +
48
48
  'fields[] projection. Default: false (nested layout, no projection).');
49
+ /**
50
+ * G-B (Glöckle 2026-06-26): an OPTIONAL caller-supplied cap on the size of
51
+ * the LLM-visible text leg of a high-volume read tool, so an agent on a
52
+ * tight context budget can bound a single read instead of relying solely on
53
+ * the toolkit's count-driven default cap (2000 / 4000 / 8000 chars). Cuts
54
+ * the TEXT leg only — structuredContent (the UI / typed payload) is never
55
+ * truncated, so a host that surfaces structuredContent still sees the full
56
+ * result. Floor of 200 stops a pathological `max_chars: 1` from yielding an
57
+ * all-marker, no-content body.
58
+ */
59
+ export const MAX_CHARS = z
60
+ .number()
61
+ .int()
62
+ .min(200)
63
+ .max(100_000)
64
+ .optional()
65
+ .describe('Optional cap (chars) on the text output, overriding the default detail ' +
66
+ 'cap. Truncates the LLM-visible text leg only (structuredContent stays ' +
67
+ 'complete). Use to bound a single read on a tight context budget — e.g. ' +
68
+ 'max_chars:2000.');
69
+ /**
70
+ * G-B: shared opaque offset-cursor codec for client-side pagination.
71
+ *
72
+ * `pages_list` (B2) shipped a private copy of this; `sources_list` (G-B) needs
73
+ * the identical contract (a `base64url("o:<n>")` token, also tolerant of the
74
+ * raw `o:<n>` form for hand-crafted iteration). Extracted here so both list
75
+ * tools encode/decode byte-identically — a cursor handed back to either tool
76
+ * means the same offset.
77
+ */
78
+ export function decodeOffsetCursor(cursor) {
79
+ if (cursor === undefined || cursor === '')
80
+ return 0;
81
+ let raw = cursor;
82
+ if (!/^o:\d+$/.test(cursor)) {
83
+ try {
84
+ raw = Buffer.from(cursor.replace(/-/g, '+').replace(/_/g, '/'), 'base64').toString('utf8');
85
+ }
86
+ catch {
87
+ return 0;
88
+ }
89
+ }
90
+ const m = /^o:(\d+)$/.exec(raw);
91
+ return m ? Number(m[1]) : 0;
92
+ }
93
+ export function encodeOffsetCursor(offset) {
94
+ return Buffer.from(`o:${offset}`, 'utf8').toString('base64url');
95
+ }
96
+ /** Marker appended when {@link applyMaxChars} truncates a text leg. */
97
+ const TRUNCATION_MARKER = '\n--- TRUNCATED by max_chars ---';
98
+ /**
99
+ * G-B: cap the text leg of an already-built tool result at `maxChars`.
100
+ *
101
+ * Pure: returns a NEW result, never mutates. Truncates ONLY the first text
102
+ * content block (the LLM-visible leg) when it exceeds `maxChars`; every other
103
+ * block — and `structuredContent` / `_meta` — passes through untouched so the
104
+ * UI / typed payload remains complete. A no-op when `maxChars` is undefined,
105
+ * when the first block is not text, or when the text is already within budget.
106
+ *
107
+ * The slice reserves room for the truncation marker so the returned text never
108
+ * exceeds `maxChars`.
109
+ */
110
+ export function applyMaxChars(result, maxChars) {
111
+ if (maxChars === undefined)
112
+ return result;
113
+ const first = result.content[0];
114
+ if (first === undefined || first.type !== 'text' || typeof first.text !== 'string') {
115
+ return result;
116
+ }
117
+ if (first.text.length <= maxChars)
118
+ return result;
119
+ const room = Math.max(0, maxChars - TRUNCATION_MARKER.length);
120
+ const truncated = first.text.slice(0, room) + TRUNCATION_MARKER;
121
+ const rest = result.content.slice(1);
122
+ return {
123
+ ...result,
124
+ content: [{ ...first, text: truncated }, ...rest],
125
+ };
126
+ }
49
127
  // ─── Default field-sets per tool ─────────────────────────────────────
50
128
  /**
51
129
  * Default fields echoed when the caller omits `fields`. Following the
@@ -162,4 +240,62 @@ export function projectionFeedback(items, requested) {
162
240
  });
163
241
  return { available_fields: available, unknown_fields: unknown };
164
242
  }
243
+ /**
244
+ * F23 (2026-06-09): single source of truth for the LOUD text-leg warning
245
+ * a tool appends to its table header when a `fields[]` projection
246
+ * contained keys that did not exist on any row.
247
+ *
248
+ * Before this helper every read tool assembled the note inline (subtly
249
+ * different wording per tool, and a new tool wiring `projectionFeedback`
250
+ * could silently forget the text-leg note entirely — only the
251
+ * structuredContent `unknown_fields` array surfaced it, which cold
252
+ * agents never read). Centralising the string here means ALL tools
253
+ * surface the identical, self-correcting signal:
254
+ *
255
+ * " (unknown projection fields ignored: type — available: rel_path, …)"
256
+ *
257
+ * Returns the EMPTY string when there is nothing to warn about (feedback
258
+ * undefined, or `unknown_fields` empty) so call-sites can unconditionally
259
+ * append the result to their header.
260
+ *
261
+ * The leading space lets a call-site write `header${warning}` without an
262
+ * extra separator; the parentheses keep it visually scoped inside the
263
+ * header line.
264
+ */
265
+ export function projectionWarning(feedback) {
266
+ if (feedback === undefined || feedback.unknown_fields.length === 0) {
267
+ return '';
268
+ }
269
+ return (` (unknown projection fields ignored: ${feedback.unknown_fields.join(', ')}` +
270
+ ` — available: ${feedback.available_fields.join(', ')})`);
271
+ }
272
+ // ─── Text-table column projection ────────────────────────────────────
273
+ /** Field keys that get a wide text-table column (paths, URLs, hash ids). */
274
+ const WIDE_FIELD_KEYS = new Set([
275
+ 'path',
276
+ 'rel_path',
277
+ 'parent_path',
278
+ 'url',
279
+ 'home_url',
280
+ 'site_url',
281
+ 'template_id',
282
+ 'permalink',
283
+ ]);
284
+ /**
285
+ * Build slim text-table columns from a caller-supplied `fields[]` projection,
286
+ * so a list tool's TEXT leg (what the LLM reads) honors `fields` instead of
287
+ * always rendering the full row set. Without this the projection only narrows
288
+ * the structuredContent leg while the text table still emits — and gets
289
+ * truncated at — every column (the Glöckle "fields[] ignored" finding).
290
+ *
291
+ * Width heuristic: path / URL / id-like keys get a wide column, everything
292
+ * else a modest one; labels are uppercased to match the toolkit style.
293
+ */
294
+ export function columnsFromFields(fields) {
295
+ return fields.map((key) => ({
296
+ key,
297
+ label: key.replace(/_/g, ' ').toUpperCase(),
298
+ width: WIDE_FIELD_KEYS.has(key) ? 48 : 16,
299
+ }));
300
+ }
165
301
  //# 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,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wEAAwE;AAExE;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC;KAClB,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACxB,GAAG,CAAC,EAAE,CAAC;KACP,QAAQ,EAAE;KACV,QAAQ,CACL,4EAA4E;IACxE,mFAAmF;IACnF,iFAAiF;IACjF,kBAAkB,CACzB,CAAC;AAEN;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC;KAChB,OAAO,EAAE;KACT,OAAO,CAAC,KAAK,CAAC;KACd,QAAQ,CACL,2EAA2E;IACvE,qEAAqE,CAC5E,CAAC;AAEN,wEAAwE;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IACxD,IAAI;IACJ,OAAO;IACP,MAAM;IACN,gBAAgB;IAChB,aAAa;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC1D,MAAM;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G;QACH,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE;QAC3C,KAAK,EAAE,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;KAC5C,CAAC,CAAC,CAAC;AACR,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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,CAAC;QAC1D,OAAO,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAClF,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,SAAS,CAAC;IACrB,CAAC;AACL,CAAC"}
@@ -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;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,UAAU,CAQb;AAuBD;;;;;;;GAOG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,UAAU,EAC7C,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,YAAY,GACnB,CAAC,CA2DH;AAED,wBAAgB,gBA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