@wootsup/yt-builder-mcp 1.1.7 → 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 +14 -10
- package/bin/yt-builder-mcp.js +55 -40
- package/dist/auth.d.ts +18 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +18 -0
- package/dist/auth.js.map +1 -1
- 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/cli/invocation-decision.d.ts +57 -0
- package/dist/cli/invocation-decision.d.ts.map +1 -0
- package/dist/cli/invocation-decision.js +86 -0
- package/dist/cli/invocation-decision.js.map +1 -0
- package/dist/client.d.ts +28 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +40 -1
- package/dist/client.js.map +1 -1
- package/dist/clients/claude-code.d.ts.map +1 -1
- package/dist/clients/claude-code.js +3 -1
- package/dist/clients/claude-code.js.map +1 -1
- package/dist/clients/claude-desktop.d.ts.map +1 -1
- package/dist/clients/claude-desktop.js +3 -1
- package/dist/clients/claude-desktop.js.map +1 -1
- package/dist/clients/cline.d.ts.map +1 -1
- package/dist/clients/cline.js +3 -1
- package/dist/clients/cline.js.map +1 -1
- package/dist/clients/codex-cli.d.ts +1 -1
- package/dist/clients/codex-cli.d.ts.map +1 -1
- package/dist/clients/codex-cli.js +98 -0
- package/dist/clients/codex-cli.js.map +1 -1
- package/dist/clients/continue.d.ts.map +1 -1
- package/dist/clients/continue.js +70 -1
- package/dist/clients/continue.js.map +1 -1
- package/dist/clients/cursor.d.ts.map +1 -1
- package/dist/clients/cursor.js +3 -1
- package/dist/clients/cursor.js.map +1 -1
- package/dist/clients/gemini-cli.d.ts.map +1 -1
- package/dist/clients/gemini-cli.js +3 -1
- package/dist/clients/gemini-cli.js.map +1 -1
- package/dist/clients/index.d.ts +104 -0
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +141 -0
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/roo-code.d.ts.map +1 -1
- package/dist/clients/roo-code.js +3 -1
- package/dist/clients/roo-code.js.map +1 -1
- package/dist/clients/zed.d.ts.map +1 -1
- package/dist/clients/zed.js +3 -1
- package/dist/clients/zed.js.map +1 -1
- 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 +55 -5
- package/dist/gateway/essentials.js.map +1 -1
- package/dist/gateway/test-support.d.ts +3 -3
- package/dist/gateway/test-support.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -1
- 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 +6 -4
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +14 -4
- package/dist/server.js.map +1 -1
- package/dist/setup-cli.d.ts +41 -0
- package/dist/setup-cli.d.ts.map +1 -1
- package/dist/setup-cli.js +163 -1
- package/dist/setup-cli.js.map +1 -1
- package/dist/setup-prompts.d.ts +23 -0
- package/dist/setup-prompts.d.ts.map +1 -1
- package/dist/setup-prompts.js +76 -1
- package/dist/setup-prompts.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/bootstrap.d.ts +41 -0
- package/dist/sites/bootstrap.d.ts.map +1 -0
- package/dist/sites/bootstrap.js +58 -0
- package/dist/sites/bootstrap.js.map +1 -0
- package/dist/sites/client-pool.d.ts +33 -0
- package/dist/sites/client-pool.d.ts.map +1 -1
- package/dist/sites/client-pool.js +69 -1
- 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/index.d.ts.map +1 -1
- package/dist/sites/tools/index.js +9 -1
- package/dist/sites/tools/index.js.map +1 -1
- package/dist/sites/tools/use-site.d.ts +47 -0
- package/dist/sites/tools/use-site.d.ts.map +1 -0
- package/dist/sites/tools/use-site.js +203 -0
- package/dist/sites/tools/use-site.js.map +1 -0
- 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 +75 -18
- package/dist/tools/elements/builders.js.map +1 -1
- package/dist/tools/elements/handlers-write.d.ts +20 -3
- package/dist/tools/elements/handlers-write.d.ts.map +1 -1
- package/dist/tools/elements/handlers-write.js +372 -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 +77 -10
- 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 +134 -12
- package/dist/tools/format/elements-format.js.map +1 -1
- package/dist/tools/format/inspection-format.d.ts +29 -0
- package/dist/tools/format/inspection-format.d.ts.map +1 -1
- package/dist/tools/format/inspection-format.js +99 -22
- 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 +297 -5
- 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 +18 -3
- package/dist/tools/multi-items/builders.js.map +1 -1
- package/dist/tools/multi-items/clean-implode-handler.d.ts.map +1 -1
- package/dist/tools/multi-items/clean-implode-handler.js +2 -2
- package/dist/tools/multi-items/clean-implode-handler.js.map +1 -1
- package/dist/tools/multi-items/format/inspection-format.d.ts +41 -0
- package/dist/tools/multi-items/format/inspection-format.d.ts.map +1 -0
- package/dist/tools/multi-items/format/inspection-format.js +64 -0
- package/dist/tools/multi-items/format/inspection-format.js.map +1 -0
- package/dist/tools/multi-items/inspect-handler.d.ts +50 -2
- package/dist/tools/multi-items/inspect-handler.d.ts.map +1 -1
- package/dist/tools/multi-items/inspect-handler.js +237 -10
- package/dist/tools/multi-items/inspect-handler.js.map +1 -1
- package/dist/tools/multi-items/inspection-cache.d.ts +85 -0
- package/dist/tools/multi-items/inspection-cache.d.ts.map +1 -0
- package/dist/tools/multi-items/inspection-cache.js +126 -0
- package/dist/tools/multi-items/inspection-cache.js.map +1 -0
- package/dist/tools/pages/builders.d.ts +31 -2
- package/dist/tools/pages/builders.d.ts.map +1 -1
- package/dist/tools/pages/builders.js +173 -17
- package/dist/tools/pages/builders.js.map +1 -1
- package/dist/tools/pages/handlers-read.d.ts +6 -2
- package/dist/tools/pages/handlers-read.d.ts.map +1 -1
- package/dist/tools/pages/handlers-read.js +228 -26
- package/dist/tools/pages/handlers-read.js.map +1 -1
- package/dist/tools/pages/handlers-write.d.ts +143 -7
- package/dist/tools/pages/handlers-write.d.ts.map +1 -1
- package/dist/tools/pages/handlers-write.js +215 -11
- 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 +166 -0
- package/dist/tools/pages/schemas.d.ts.map +1 -1
- package/dist/tools/pages/schemas.js +347 -0
- 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 +26 -11
- 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 +219 -5
- 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 +45 -8
- 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/dist/uninstall-skill.d.ts +52 -0
- package/dist/uninstall-skill.d.ts.map +1 -0
- package/dist/uninstall-skill.js +146 -0
- package/dist/uninstall-skill.js.map +1 -0
- package/dist/uninstall.d.ts +73 -0
- package/dist/uninstall.d.ts.map +1 -0
- package/dist/uninstall.js +82 -0
- package/dist/uninstall.js.map +1 -0
- package/icon.png +0 -0
- package/manifest.json +10 -10
- package/package.json +7 -3
- package/skills/yt-builder-mcp/SKILL.md +157 -88
|
@@ -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;;;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EAAE;YACtC,IAAI,EACA,wEAAwE;gBACxE,+DAA+D;gBAC/D,wEAAwE;SAC/E,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,cAAc,CAAC,MAAkB;IAC5C,IAAI,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAqB,OAAO,CAAC,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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gBAAgB,CAC5B,aAAa,EAAE;IACX,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,EACD,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3C,UAAU,CAgBZ"}
|
|
@@ -21,6 +21,52 @@ function stringify(value) {
|
|
|
21
21
|
return String(value);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* F80 (2026-06-10): the size at/above which a JSON-document text body is
|
|
26
|
+
* split off into its own content block instead of carrying the in-band
|
|
27
|
+
* `[label @ host] ` site-prefix.
|
|
28
|
+
*
|
|
29
|
+
* Why a threshold rather than "all JSON": a tool host (Claude Code, …)
|
|
30
|
+
* spills only OVERSIZED tool results to a temp file. That file is read
|
|
31
|
+
* back with `jq`, so the bytes must be pure JSON — an in-band prefix
|
|
32
|
+
* corrupts the first line and breaks the parse (the observed F80
|
|
33
|
+
* friction on `page_get_layout`, a multi-kB layout dump). Small JSON
|
|
34
|
+
* envelopes (error results, single-element confirms, short lists) are
|
|
35
|
+
* NEVER dumped, so they keep the in-band prefix — which preserves the
|
|
36
|
+
* long-standing contract that `content[0].text` is the directly-parseable
|
|
37
|
+
* JSON for those results (141 error-matrix / handler tests depend on it).
|
|
38
|
+
*
|
|
39
|
+
* 8 kB is comfortably below any host's spill threshold yet above every
|
|
40
|
+
* small structured envelope this surface emits.
|
|
41
|
+
*/
|
|
42
|
+
export const SITE_PREFIX_JSON_SPLIT_THRESHOLD = 8 * 1024;
|
|
43
|
+
/**
|
|
44
|
+
* Detect whether a text body is a PURE JSON DOCUMENT (object or array)
|
|
45
|
+
* LARGE enough that a host might spill it to a `jq`-read temp file.
|
|
46
|
+
* Tools like `page_get_layout` emit `jsonResult(data)` whose
|
|
47
|
+
* `content[0].text` IS the JSON payload; for a large layout that text
|
|
48
|
+
* lands in the dump verbatim, so an in-band `[label @ host] ` prefix
|
|
49
|
+
* would corrupt the first bytes.
|
|
50
|
+
*
|
|
51
|
+
* Only OBJECT / ARRAY documents qualify (a bare scalar like `"hello"`
|
|
52
|
+
* stays in-band). The cheap length + first-glyph pre-checks avoid a
|
|
53
|
+
* JSON.parse on every human-readable table on the hot path.
|
|
54
|
+
*/
|
|
55
|
+
function isLargeJsonDocumentText(text) {
|
|
56
|
+
if (text.length < SITE_PREFIX_JSON_SPLIT_THRESHOLD)
|
|
57
|
+
return false;
|
|
58
|
+
const trimmed = text.trimStart();
|
|
59
|
+
const first = trimmed.charAt(0);
|
|
60
|
+
if (first !== '{' && first !== '[')
|
|
61
|
+
return false;
|
|
62
|
+
try {
|
|
63
|
+
const parsed = JSON.parse(trimmed);
|
|
64
|
+
return parsed !== null && typeof parsed === 'object';
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
24
70
|
/**
|
|
25
71
|
* Convert any JSON-serializable value into the MCP content envelope
|
|
26
72
|
* (2-space JSON). Wave G.6.4b: every payload is deep-walked through
|
|
@@ -66,15 +112,29 @@ export function errorResult(opts) {
|
|
|
66
112
|
* Confirm-guard preview helper for destructive tools. Returns the
|
|
67
113
|
* preview `ToolResult` when `confirm` is false; callers `return` it
|
|
68
114
|
* before executing the destructive REST call.
|
|
115
|
+
*
|
|
116
|
+
* F131 (Wave 4a): the blocked-state result is now STRUCTURALLY distinct
|
|
117
|
+
* from a successful mutation. Previously the preview was a plain
|
|
118
|
+
* `jsonResult` with no `isError` — envelope-identical to a success — so a
|
|
119
|
+
* model that did not parse `preview:true` read "delete succeeded" and
|
|
120
|
+
* silently left the element in place (the dry-run / silent-no-op footgun
|
|
121
|
+
* class). Three redundant signals now make the block unmistakable:
|
|
122
|
+
* 1. result-level `isError: true` (hosts that only read the error flag),
|
|
123
|
+
* 2. body `applied: false` + `requires_confirmation: true` (structured
|
|
124
|
+
* consumers),
|
|
125
|
+
* 3. a leading "NOT EXECUTED" line in the human-readable warning text
|
|
126
|
+
* (models that skim prose).
|
|
69
127
|
*/
|
|
70
128
|
export function confirmGuard(opts) {
|
|
71
129
|
return jsonResult({
|
|
72
130
|
preview: true,
|
|
73
|
-
|
|
131
|
+
applied: false,
|
|
132
|
+
requires_confirmation: true,
|
|
133
|
+
warning: `NOT EXECUTED — DESTRUCTIVE operation requires confirmation. The "${opts.operation}" call was BLOCKED and nothing was changed.`,
|
|
74
134
|
operation: opts.operation,
|
|
75
135
|
details: opts.details,
|
|
76
136
|
instruction: 'Ask the user to confirm, then call again with `confirm: true`.',
|
|
77
|
-
});
|
|
137
|
+
}, { isError: true });
|
|
78
138
|
}
|
|
79
139
|
/**
|
|
80
140
|
* Sanitise a single content item from a toolkit builder. Text items
|
|
@@ -158,11 +218,28 @@ export function withSiteMeta(result, site) {
|
|
|
158
218
|
catch {
|
|
159
219
|
host = site.url;
|
|
160
220
|
}
|
|
161
|
-
|
|
221
|
+
// F178 (2026-06-12): when a call was routed via the PROCESS-WIDE
|
|
222
|
+
// default/override (i.e. the caller omitted `site_id`), append a
|
|
223
|
+
// ` · default` marker INSIDE the visible prefix so the human SEES the
|
|
224
|
+
// call was not isolated from concurrent `use_site` switches. An
|
|
225
|
+
// explicit `site_id` (or a legacy fixture without `resolvedVia`) gets
|
|
226
|
+
// the plain prefix.
|
|
227
|
+
const routedViaSharedDefault = site.resolvedVia === 'registry_default'
|
|
228
|
+
|| site.resolvedVia === 'active_override';
|
|
229
|
+
const marker = routedViaSharedDefault ? ' · default' : '';
|
|
230
|
+
const prefix = `[${displayLabel} @ ${host}${marker}] `;
|
|
231
|
+
// `resolved_site_id` is stamped LÜCKENLOS on every site-bound result
|
|
232
|
+
// (it mirrors `site_id` but names the concept the agent reasons about
|
|
233
|
+
// — "which site did this call actually land on"). `resolved_via` is
|
|
234
|
+
// only stamped when known, so legacy fixtures add no noise.
|
|
162
235
|
const meta = {
|
|
163
236
|
site_id: site.id,
|
|
164
237
|
site_url: site.url,
|
|
165
238
|
platform: site.platform.kind,
|
|
239
|
+
resolved_site_id: site.id,
|
|
240
|
+
...(site.resolvedVia !== undefined
|
|
241
|
+
? { resolved_via: site.resolvedVia }
|
|
242
|
+
: {}),
|
|
166
243
|
};
|
|
167
244
|
// W12-R1.2 (A4-F2): site-awareness is the LOAD-BEARING surface for
|
|
168
245
|
// Claude-Desktop users. When the wrapped result has no text content
|
|
@@ -172,10 +249,24 @@ export function withSiteMeta(result, site) {
|
|
|
172
249
|
// text block so the prefix is ALWAYS the first visible glyph.
|
|
173
250
|
// Trim the trailing space — a standalone prefix block reads better
|
|
174
251
|
// without it.
|
|
252
|
+
//
|
|
253
|
+
// F80 (2026-06-10): the SAME synthetic-block path is taken when the
|
|
254
|
+
// first text body is a PURE JSON DOCUMENT (page_get_layout etc.).
|
|
255
|
+
// Concatenating the prefix in-band there yields `[label @ host] {...}`
|
|
256
|
+
// — not valid JSON — which corrupts the harness's file-dump of an
|
|
257
|
+
// oversized result and breaks `jq`. Routing JSON documents through the
|
|
258
|
+
// synthetic block keeps the JSON byte-pure while the human still sees
|
|
259
|
+
// the marker first. Human-readable text (tables / details / prose)
|
|
260
|
+
// keeps the in-band prefix unchanged.
|
|
175
261
|
const firstItem = result.content[0];
|
|
262
|
+
const firstIsLargeJsonDoc = firstItem !== undefined
|
|
263
|
+
&& firstItem.type === 'text'
|
|
264
|
+
&& typeof firstItem.text === 'string'
|
|
265
|
+
&& isLargeJsonDocumentText(firstItem.text);
|
|
176
266
|
const needsSynthetic = result.content.length === 0
|
|
177
267
|
|| firstItem === undefined
|
|
178
|
-
|| firstItem.type !== 'text'
|
|
268
|
+
|| firstItem.type !== 'text'
|
|
269
|
+
|| firstIsLargeJsonDoc;
|
|
179
270
|
const newContent = needsSynthetic
|
|
180
271
|
? [
|
|
181
272
|
{ type: 'text', text: prefix.trimEnd() },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C,SAAS,CAAC;IACpB,OAAO;QACH,OAAO,EAAE,WAAW;QACpB,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,GAAG,CAAC,aAAa,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,iBAAiB,EAAE,cAAc;KACpC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `uninstall-skill` — the inverse of {@link installSkill}.
|
|
3
|
+
*
|
|
4
|
+
* Removes the bundled skill directory from the user's agent-skill folder
|
|
5
|
+
* (`~/.claude/skills/yt-builder-mcp/`, plus the legacy
|
|
6
|
+
* `~/.claude/skills/yootheme-builder/`) and strips the marker block this
|
|
7
|
+
* package appended to `~/AGENTS.md`.
|
|
8
|
+
*
|
|
9
|
+
* Idempotent + non-destructive to the user's own content: only OUR
|
|
10
|
+
* `## YT Builder MCP` marker section is removed from AGENTS.md; every
|
|
11
|
+
* other line the user wrote is preserved verbatim.
|
|
12
|
+
*
|
|
13
|
+
* @license MIT
|
|
14
|
+
*/
|
|
15
|
+
export interface UninstallSkillOptions {
|
|
16
|
+
/** Dir that holds the installed skill folder(s). Default `~/.claude/skills`. */
|
|
17
|
+
readonly targetSkillsDir?: string;
|
|
18
|
+
/** AGENTS.md file the marker block was appended to. Default `~/AGENTS.md`. */
|
|
19
|
+
readonly targetAgentsFile?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface UninstallSkillResult {
|
|
22
|
+
/** True when at least one skill directory was removed. */
|
|
23
|
+
readonly skillRemoved: boolean;
|
|
24
|
+
/** Absolute path of the canonical skill dir that was targeted. */
|
|
25
|
+
readonly skillTargetDir: string;
|
|
26
|
+
/** True when the marker block was stripped from AGENTS.md. */
|
|
27
|
+
readonly markerRemoved: boolean;
|
|
28
|
+
/** Absolute AGENTS.md path that was inspected / mutated. */
|
|
29
|
+
readonly agentsFile: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* True when a skill folder OR an AGENTS.md marker is present — used by
|
|
33
|
+
* the uninstall CLI to decide whether to surface the "remove skill"
|
|
34
|
+
* checkbox at all.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isSkillInstalled(opts?: UninstallSkillOptions): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Strip our `## YT Builder MCP` marker section from an AGENTS.md body.
|
|
39
|
+
*
|
|
40
|
+
* The block installSkill writes is:
|
|
41
|
+
*
|
|
42
|
+
* \n\n## YT Builder MCP\n\n<MARKER_LINE>\n<a few prose lines>\n
|
|
43
|
+
*
|
|
44
|
+
* It is always appended at EOF. We locate the `## YT Builder MCP`
|
|
45
|
+
* heading whose following lines contain {@link MARKER_LINE}, then remove
|
|
46
|
+
* from that heading (collapsing the blank lines that preceded it) up to
|
|
47
|
+
* the next top-level/section heading (`# ` or `## `) or EOF. Returns the
|
|
48
|
+
* cleaned body, or `null` when no marker block was found (no-op).
|
|
49
|
+
*/
|
|
50
|
+
export declare function stripMarkerBlock(body: string): string | null;
|
|
51
|
+
export declare function uninstallSkill(options?: UninstallSkillOptions): Promise<UninstallSkillResult>;
|
|
52
|
+
//# sourceMappingURL=uninstall-skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uninstall-skill.d.ts","sourceRoot":"","sources":["../src/uninstall-skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAgBH,MAAM,WAAW,qBAAqB;IAClC,gFAAgF;IAChF,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,8EAA8E;IAC9E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,oBAAoB;IACjC,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC/B;AAUD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,qBAA0B,GAAG,OAAO,CAc1E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoD5D;AAED,wBAAsB,cAAc,CAChC,OAAO,GAAE,qBAA0B,GACpC,OAAO,CAAC,oBAAoB,CAAC,CAgC/B"}
|