zcode-app-cli 3.14.4-33 → 3.15.3-35

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 (75) hide show
  1. package/README.md +18 -4
  2. package/bin/zcode.js +4 -0
  3. package/docs/CONFIGURATION.md +68 -6
  4. package/docs/CONFIGURATION.zh-CN.md +52 -4
  5. package/docs/PROVIDER_CONFIG.md +25 -0
  6. package/docs/PROVIDER_CONFIG.zh-CN.md +20 -0
  7. package/package.json +4 -2
  8. package/vendor/cli-config.cjs +159 -0
  9. package/vendor/extraction.json +38 -5
  10. package/vendor/node_modules/@zcode/tui/dist/index.js +474 -85
  11. package/vendor/packages/browser-use-plugin/README.md +1 -1
  12. package/vendor/packages/browser-use-plugin/docs/api.json +1 -1
  13. package/vendor/packages/browser-use-plugin/docs/overview.md +6 -6
  14. package/vendor/packages/browser-use-plugin/docs/playwright.md +3 -3
  15. package/vendor/packages/browser-use-plugin/docs/workflow.md +2 -2
  16. package/vendor/packages/browser-use-plugin/scripts/browser-client.mjs +5 -7
  17. package/vendor/packages/browser-use-plugin/scripts/build.mjs +0 -1
  18. package/vendor/packages/browser-use-plugin/skills/control-browser/SKILL.md +9 -9
  19. package/vendor/packages/bundled-skills/skills/dynamic-workflows/SKILL.md +760 -687
  20. package/vendor/packages/bundled-skills/skills/dynamic-workflows/examples.md +310 -1
  21. package/vendor/packages/bundled-skills/skills/dynamic-workflows/patterns.md +336 -4
  22. package/vendor/packages/documents-plugin/.zcode-plugin/plugin.json +2 -2
  23. package/vendor/packages/documents-plugin/package.json +2 -2
  24. package/vendor/packages/documents-plugin/skills/docx/LICENSE.txt +10 -10
  25. package/vendor/packages/node-repl-host/.zcode-plugin/plugin.json +1 -1
  26. package/vendor/packages/node-repl-host/dist/mcp/server.js +116 -48
  27. package/vendor/packages/node-repl-host/package.json +1 -1
  28. package/vendor/packages/node-repl-host/scripts/build.mjs +4 -4
  29. package/vendor/packages/pdf-plugin/.zcode-plugin/plugin.json +2 -2
  30. package/vendor/packages/pdf-plugin/package.json +2 -2
  31. package/vendor/packages/pdf-plugin/skills/pdf/LICENSE.txt +10 -10
  32. package/vendor/packages/pdf-plugin/skills/pdf/references/resume-altacv.tex +1 -1
  33. package/vendor/packages/plugin-creator-plugin/skills/plugin-creator/SKILL.md +1 -1
  34. package/vendor/packages/plugin-creator-plugin/skills/plugin-creator/references/plugin-json-spec.md +1 -1
  35. package/vendor/packages/presentations-plugin/.zcode-plugin/plugin.json +2 -2
  36. package/vendor/packages/presentations-plugin/package.json +2 -2
  37. package/vendor/packages/presentations-plugin/skills/pptx/LICENSE.txt +10 -10
  38. package/vendor/packages/restore-legacy-sessions-plugin/skills/restore-legacy-sessions/SKILL.md +1 -1
  39. package/vendor/packages/spreadsheets-plugin/.zcode-plugin/plugin.json +2 -2
  40. package/vendor/packages/spreadsheets-plugin/package.json +2 -2
  41. package/vendor/packages/spreadsheets-plugin/skills/xlsx/LICENSE.txt +10 -10
  42. package/vendor/packages/visualize-plugin/.zcode-plugin/plugin.json +10 -0
  43. package/vendor/packages/visualize-plugin/package.json +8 -0
  44. package/vendor/packages/visualize-plugin/skills/visualize/LICENSE.md +5 -0
  45. package/vendor/packages/visualize-plugin/skills/visualize/SKILL.md +277 -0
  46. package/vendor/packages/visualize-plugin/skills/visualize/assets/calendar.js +273 -0
  47. package/vendor/packages/visualize-plugin/skills/visualize/assets/runtime-manifest.json +16 -0
  48. package/vendor/packages/visualize-plugin/skills/visualize/assets/standalone-host-bridge.js +256 -0
  49. package/vendor/packages/visualize-plugin/skills/visualize/assets/standalone-shell.js +183 -0
  50. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/d3-7.9.0.min.js +2 -0
  51. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/d3-7.9.0.min.js.LICENSE +13 -0
  52. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/floating-ui-core-1.7.3.min.js +1 -0
  53. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/floating-ui-core-1.7.3.min.js.LICENSE +20 -0
  54. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/floating-ui-dom-1.7.4.min.js +1 -0
  55. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/floating-ui-dom-1.7.4.min.js.LICENSE +20 -0
  56. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/lucide-1.17.0.js +19521 -0
  57. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/lucide-1.17.0.js.LICENSE +43 -0
  58. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/manifest.json +57 -0
  59. package/vendor/packages/visualize-plugin/skills/visualize/assets/visualize.css +1222 -0
  60. package/vendor/packages/visualize-plugin/skills/visualize/assets/visualize.html +517 -0
  61. package/vendor/packages/visualize-plugin/skills/visualize/examples/calendar.html +10 -0
  62. package/vendor/packages/visualize-plugin/skills/visualize/references/api.md +128 -0
  63. package/vendor/packages/visualize-plugin/skills/visualize/references/styles.md +3 -0
  64. package/vendor/packages/visualize-plugin/skills/visualize/scripts/render.py +248 -0
  65. package/vendor/packages/visualize-plugin/skills/visualize/scripts/vendor.py +56 -0
  66. package/vendor/packages/visualize-plugin/skills/visualize/tweak.md +62 -0
  67. package/vendor/packages/visualize-plugin/skills/visualize/widgets/calendar.md +90 -0
  68. package/vendor/packages/zcode-cua-plugin/.zcode-plugin/plugin.json +1 -1
  69. package/vendor/packages/zcode-cua-plugin/docs/computer-use.md +1 -1
  70. package/vendor/packages/zcode-cua-plugin/package.json +1 -1
  71. package/vendor/packages/zcode-cua-plugin/scripts/computer-use-client.mjs +35 -41
  72. package/vendor/packages/zcode-guide-plugin/skills/zcode-configuration-guide/SKILL.md +2 -2
  73. package/vendor/provider/zcode-builtin.json +96 -1
  74. package/vendor/zcode.cjs +1622 -1425
  75. package/zcode-runtime.lock.json +3 -3
@@ -0,0 +1,248 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import re
5
+ import sys
6
+ from html import escape
7
+ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
8
+ from pathlib import Path
9
+ from vendor import embed_vendor_scripts
10
+
11
+ _SKILL_DIRECTORY = Path(__file__).resolve().parents[1]
12
+ _FRAGMENT_PLACEHOLDER = "<!--__INLINE_VISUALIZATION_FRAGMENT__-->"
13
+ _MAX_FRAGMENT_BYTES = 1_000_000
14
+ _DOCUMENT_MARKUP = re.compile(r"<!doctype\s|<\s*(?:html|head|body)(?:\s|>)", re.IGNORECASE)
15
+ _HOST_API_REFERENCE = re.compile(r"\b(?:window|globalThis)\.zcode\b")
16
+ _RESOURCE_SOURCES = " ".join(
17
+ (
18
+ "blob:",
19
+ "data:",
20
+ "https://cdnjs.cloudflare.com",
21
+ "https://cdn.jsdelivr.net",
22
+ "https://esm.sh",
23
+ "https://fonts.bunny.net",
24
+ "https://fonts.googleapis.com",
25
+ "https://fonts.gstatic.com",
26
+ "https://unpkg.com",
27
+ ),
28
+ )
29
+ _FRAME_CSP = "; ".join(
30
+ (
31
+ "default-src 'none'",
32
+ f"script-src 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval' {_RESOURCE_SOURCES}",
33
+ f"style-src 'unsafe-inline' {_RESOURCE_SOURCES}",
34
+ f"img-src {_RESOURCE_SOURCES}",
35
+ f"font-src {_RESOURCE_SOURCES}",
36
+ f"media-src {_RESOURCE_SOURCES}",
37
+ "worker-src blob:",
38
+ "connect-src blob: data:",
39
+ "frame-src 'none'",
40
+ "object-src 'none'",
41
+ "base-uri 'none'",
42
+ "form-action 'none'",
43
+ ),
44
+ )
45
+ # A srcdoc frame inherits the shell CSP, so the shell must permit resources
46
+ # which the stricter inner frame policy may load.
47
+ _SHELL_CSP = _FRAME_CSP.replace("frame-src 'none'", "frame-src 'self'")
48
+
49
+
50
+ def _read_fragment(source: Path) -> str:
51
+ if source.is_symlink() or not source.is_file():
52
+ raise ValueError(f"source must be a regular file: {source}")
53
+ if source.stat().st_size > _MAX_FRAGMENT_BYTES:
54
+ raise ValueError("source fragment exceeds the 1 MB size limit")
55
+ fragment = source.read_text(encoding="utf-8")
56
+ if _DOCUMENT_MARKUP.search(fragment):
57
+ raise ValueError("source must be an HTML fragment, not a complete document")
58
+ return fragment
59
+
60
+
61
+ def _default_title(source: Path) -> str:
62
+ words = source.stem.replace("-", " ").replace("_", " ").split()
63
+ return " ".join(word.capitalize() for word in words) or "Visualization"
64
+
65
+
66
+ def calendar_script(fragment: str) -> str:
67
+ """Register the bundled element before a fragment uses it in HTML or JavaScript."""
68
+ if re.search(r"\bviz-calendar\b", fragment, re.IGNORECASE) is None:
69
+ return ""
70
+ source = (_SKILL_DIRECTORY / "assets" / "calendar.js").read_text(encoding="utf-8")
71
+ return "<script>" + source.replace("</script", "<\\/script") + "</script>"
72
+
73
+
74
+ def _render_document(fragment: str, title: str) -> str:
75
+ stylesheet = (_SKILL_DIRECTORY / "assets" / "visualize.css").read_text(
76
+ encoding="utf-8",
77
+ )
78
+ inner_kit = (_SKILL_DIRECTORY / "assets" / "visualize.html").read_text(
79
+ encoding="utf-8",
80
+ )
81
+ host_bridge = (
82
+ (_SKILL_DIRECTORY / "assets" / "standalone-host-bridge.js")
83
+ .read_text(
84
+ encoding="utf-8",
85
+ )
86
+ .replace("</script", r"<\/script")
87
+ )
88
+ shell = (
89
+ (_SKILL_DIRECTORY / "assets" / "standalone-shell.js")
90
+ .read_text(
91
+ encoding="utf-8",
92
+ )
93
+ .replace("</script", r"<\/script")
94
+ )
95
+ inner_html = embed_vendor_scripts(inner_kit.replace(_FRAGMENT_PLACEHOLDER, calendar_script(fragment) + fragment))
96
+ document_title = escape(title)
97
+ frame_html = f"""<!doctype html>
98
+ <html lang="en" data-visualize-standalone>
99
+ <head>
100
+ <meta charset="utf-8">
101
+ <meta name="viewport" content="width=device-width, initial-scale=1">
102
+ <meta name="referrer" content="no-referrer">
103
+ <meta http-equiv="Content-Security-Policy" content="{_FRAME_CSP}">
104
+ <title>{document_title}</title>
105
+ <style>{stylesheet}
106
+ html>body{{padding:0}}</style>
107
+ </head>
108
+ <body>
109
+ <script type="application/json" id="zcode-visualization-widget-state">__ZCODE_VISUALIZATION_WIDGET_STATE__</script>
110
+ <script>{host_bridge}</script>
111
+ {inner_html}
112
+ </body>
113
+ </html>
114
+ """
115
+ return f"""<!doctype html>
116
+ <html lang="en" data-visualize-standalone>
117
+ <head>
118
+ <meta charset="utf-8">
119
+ <meta name="viewport" content="width=device-width, initial-scale=1">
120
+ <meta name="referrer" content="no-referrer">
121
+ <meta http-equiv="Content-Security-Policy" content="{_SHELL_CSP}">
122
+ <title>{document_title}</title>
123
+ <style>:root{{color-scheme:light dark;background:light-dark(rgb(255 255 255), rgb(24 24 24))}}html,body{{margin:0}}body{{box-sizing:border-box;padding:1rem;background:inherit}}iframe{{display:block;width:100%;height:calc(100vh - 2rem);margin:0 auto;border:0}}</style>
124
+ </head>
125
+ <body>
126
+ <iframe id="zcode-visualization" sandbox="allow-scripts" referrerpolicy="no-referrer" title="{document_title}" data-srcdoc="{escape(frame_html)}"></iframe>
127
+ <script>{shell}</script>
128
+ </body>
129
+ </html>
130
+ """
131
+
132
+
133
+ def render(fragment_path: Path, title: str | None = None) -> str:
134
+ return _render_document(_read_fragment(fragment_path), title or _default_title(fragment_path))
135
+
136
+
137
+ def export_html(
138
+ source: Path,
139
+ destination: Path,
140
+ *,
141
+ title: str | None = None,
142
+ force: bool = False,
143
+ ) -> bool:
144
+ if destination.is_symlink():
145
+ raise ValueError(f"destination cannot be a symbolic link: {destination}")
146
+ if source.resolve() == destination.resolve() or (
147
+ destination.exists() and source.samefile(destination)
148
+ ):
149
+ raise ValueError("source and destination must be different files")
150
+
151
+ fragment = _read_fragment(source)
152
+ document = _render_document(fragment, title or _default_title(source))
153
+ destination.parent.mkdir(parents=True, exist_ok=True)
154
+ with destination.open("w" if force else "x", encoding="utf-8", newline="\n") as output:
155
+ output.write(document)
156
+ return _HOST_API_REFERENCE.search(fragment) is not None
157
+
158
+
159
+ def serve(document: str, port: int) -> None:
160
+ encoded_document = document.encode("utf-8")
161
+
162
+ class Handler(BaseHTTPRequestHandler):
163
+ def do_GET(self) -> None:
164
+ if self.path not in ("/", "/index.html"):
165
+ self.send_error(404)
166
+ return
167
+ self.send_response(200)
168
+ self.send_header("Content-Type", "text/html; charset=utf-8")
169
+ self.send_header("Content-Length", str(len(encoded_document)))
170
+ self.end_headers()
171
+ self.wfile.write(encoded_document)
172
+
173
+ def log_message(self, format: str, *args: object) -> None:
174
+ pass
175
+
176
+ server = ThreadingHTTPServer(("127.0.0.1", port), Handler)
177
+ print(f"http://127.0.0.1:{server.server_port}/", flush=True)
178
+ try:
179
+ server.serve_forever()
180
+ except KeyboardInterrupt:
181
+ pass
182
+
183
+
184
+ def main(argv: list[str] | None = None) -> int:
185
+ parser = argparse.ArgumentParser(
186
+ description="Render an inline visualization fragment as standalone HTML.",
187
+ )
188
+ parser.add_argument("fragment", type=Path, help="absolute fragment HTML path")
189
+ parser.add_argument(
190
+ "destination",
191
+ type=Path,
192
+ nargs="?",
193
+ help="optional output HTML path",
194
+ )
195
+ parser.add_argument(
196
+ "--title",
197
+ help="document title; defaults to the fragment file name",
198
+ )
199
+ parser.add_argument(
200
+ "--force",
201
+ action="store_true",
202
+ help="replace the destination if it already exists",
203
+ )
204
+ parser.add_argument(
205
+ "--serve",
206
+ action="store_true",
207
+ help="serve the rendered visualization locally",
208
+ )
209
+ parser.add_argument(
210
+ "--port",
211
+ type=int,
212
+ default=0,
213
+ help="local serve port; defaults to any free port",
214
+ )
215
+ args = parser.parse_args(argv)
216
+ if args.serve and args.destination is not None:
217
+ parser.error("destination cannot be used with --serve")
218
+ if args.destination is not None and args.destination.exists() and not args.force:
219
+ parser.error("destination already exists; pass --force to replace it")
220
+
221
+ try:
222
+ if args.destination is not None:
223
+ references_host_api = export_html(
224
+ args.fragment,
225
+ args.destination,
226
+ title=args.title,
227
+ force=args.force,
228
+ )
229
+ if references_host_api:
230
+ print(
231
+ "warning: the source references window.zcode; verify APIs beyond "
232
+ "widgetState/setWidgetState before hosting",
233
+ file=sys.stderr,
234
+ )
235
+ print(args.destination)
236
+ else:
237
+ document = render(args.fragment, args.title)
238
+ if args.serve:
239
+ serve(document, args.port)
240
+ else:
241
+ sys.stdout.write(document)
242
+ except (OSError, UnicodeError, ValueError) as exc:
243
+ parser.error(str(exc))
244
+ return 0
245
+
246
+
247
+ if __name__ == "__main__":
248
+ raise SystemExit(main())
@@ -0,0 +1,56 @@
1
+ """Use the pinned browser distributions in standalone HTML without a network request."""
2
+
3
+ import base64
4
+ import hashlib
5
+ import json
6
+ import re
7
+ from html import escape
8
+ from html.parser import HTMLParser
9
+ from pathlib import Path
10
+
11
+ _VENDOR = Path(__file__).resolve().parents[1] / "assets" / "vendor"
12
+
13
+
14
+ def embed_vendor_scripts(html: str) -> str:
15
+ manifest = json.loads((_VENDOR / "manifest.json").read_text(encoding="utf-8"))
16
+ resources = {entry["url"]: entry for entry in manifest["resources"]}
17
+ if len(resources) != len(manifest["resources"]):
18
+ raise ValueError("duplicate bundled resource URL")
19
+ data_urls: dict[str, str] = {}
20
+ offsets = [0] + [match.end() for match in re.finditer("\n", html)]
21
+ replacements: list[tuple[int, int, str]] = []
22
+
23
+ class Parser(HTMLParser):
24
+ def handle_starttag(self, tag, attrs):
25
+ if tag != "script":
26
+ return
27
+ src = next((value for name, value in attrs if name == "src"), None)
28
+ entry = resources.get(src)
29
+ if entry is None:
30
+ return
31
+ if src not in data_urls:
32
+ file = entry["file"]
33
+ if not re.fullmatch(r"[a-z0-9][a-z0-9.-]*\.js", file):
34
+ raise ValueError("invalid bundled resource path")
35
+ contents = (_VENDOR / file).read_bytes()
36
+ if hashlib.sha256(contents).hexdigest() != entry["sha256"]:
37
+ raise ValueError(f"bundled resource hash mismatch: {file}")
38
+ data_urls[src] = "data:text/javascript;base64," + base64.b64encode(contents).decode("ascii")
39
+ # 保留 async/id/onload 等属性;只换 src,不改变脚本顺序或重写作者的脚本正文。
40
+ attributes = " ".join(
41
+ name if value is None else f'{name}="{escape(data_urls[src] if name == "src" else value, quote=True)}"'
42
+ for name, value in attrs
43
+ )
44
+ line, column = self.getpos()
45
+ start = offsets[line - 1] + column
46
+ raw = self.get_starttag_text()
47
+ replacements.append((start, start + len(raw), "<script " + attributes + ("/>" if raw.endswith("/>") else ">")))
48
+
49
+ Parser(convert_charrefs=False).feed(html)
50
+ parts = []
51
+ previous = 0
52
+ for start, end, replacement in replacements:
53
+ parts.extend((html[previous:start], replacement))
54
+ previous = end
55
+ parts.append(html[previous:])
56
+ return "".join(parts)
@@ -0,0 +1,62 @@
1
+ # UI mockup variants and design controls
2
+
3
+ ## Variant carousel
4
+
5
+ - Show one complete design at a time. Make the named designs meaningfully different in layout and interaction, beyond recoloring one design. Keep side-by-side layouts when the user explicitly asks for simultaneous comparison.
6
+ - Use one `.viz-carousel` root with an `aria-label` and one direct child per design, each labeled with a unique, short `data-variant` name. Start with only the first design visible and mark the others `hidden`.
7
+ - The runtime supplies previous/next buttons, a count, and a named picker at the bottom center. It switches designs without replacing their DOM, so local interactions and state survive. Do not generate carousel JavaScript, navigation markup, or CSS.
8
+ - Keep the carousel outside product-scoped mockup styles. The carousel is an exception to the mockup utility rule; use product-specific styles inside each variant. The carousel reserves bottom space for its controls. Give every variant the same responsive stage height, sized for the tallest design, so navigation stays in place when switching. At narrow widths, increase the shared stage height or reflow the product content so nothing clips.
9
+ - Use stable, descriptive names that can be referenced in feedback. Do not submit feedback on navigation or start animation or audio when a variant becomes visible.
10
+ - For another language, set `data-previous-label` and `data-next-label` on the root. The count and names update automatically. Navigation stays local; it does not persist a selection or submit it to the model.
11
+
12
+ ```html
13
+ <div class="viz-carousel" aria-label="Music player designs">
14
+ <section data-variant="Minimal" aria-label="Minimal music player">
15
+ <!-- Complete interactive player with product-specific styles -->
16
+ </section>
17
+ <section data-variant="Editorial" aria-label="Editorial music player" hidden>
18
+ <!-- A distinct design, with its own controls and state -->
19
+ </section>
20
+ <section data-variant="Studio" aria-label="Studio music player" hidden>
21
+ <!-- A third design -->
22
+ </section>
23
+ </div>
24
+ ```
25
+
26
+ ## Design controls
27
+
28
+ The app supplies a small `Tweak` object-binding helper. It sends controls to the host and applies returned values to your bound objects; it does not render the Tweak.js panel. Do not import Tweak.js or generate host API wiring, callback IDs, DOM event listeners, theme synchronization, or a controls launcher.
29
+
30
+ Render the mock's initial state first. Guard the optional helper so the same HTML still works in hosts and standalone renderers without design controls:
31
+
32
+ ```js
33
+ const state = { radius: 18, accent: "#7c3aed", playing: true };
34
+ const player = document.getElementById("music-player");
35
+
36
+ function render() {
37
+ player.style.borderRadius = `${state.radius}px`;
38
+ player.style.setProperty("--player-accent", state.accent);
39
+ player.querySelector("button").textContent = state.playing ? "Pause" : "Play";
40
+ }
41
+ render();
42
+
43
+ if (globalThis.Tweak) {
44
+ const tweak = new Tweak({ container: player, onChange: render });
45
+ tweak.addSlider(state, "radius", { label: "Corner radius", min: 0, max: 40, unit: "px" });
46
+ tweak.addColorPicker(state, "accent", { label: "Accent", reference: "--player-accent" });
47
+ tweak.addToggle(state, "playing", { label: "Playing" });
48
+ }
49
+ ```
50
+
51
+ Give each component a descriptive `aria-label` for its group heading. Use a separate `Tweak` instance for each independently editable element; the host combines the groups in one panel. Keep the registered element alive and update its styles or descendants in `onChange` rather than replacing it.
52
+
53
+ For a variant carousel, bind `Tweak` to the independently editable components inside each variant, with matching descriptive `aria-label` values. Do not also add a Tweak select for the active variant.
54
+
55
+ - `addSlider(object, property, { min, max, step = 1, unit?, label?, reference? })` binds a number. `unit` is display context in the label, not part of the numeric value.
56
+ - `addColorPicker(object, property, { label?, reference? })` binds a hex color string.
57
+ - `addToggle(object, property, { label?, reference? })` binds a boolean.
58
+ - `addSelect(object, property, { options, label?, reference? })` binds a string. Options can be strings or `{ label, value }` objects.
59
+
60
+ The helper updates the bound property before calling `onChange`, including reset and temporary original preview. Make `onChange` a deterministic local render function, not a network write or irreversible action. Initial values are the current mock state. Use at most 12 controls per component and 12 options per select. Optional `reference` hints identify a token or state property, for example `--player-accent` or `player.radius`; use no spaces or punctuation other than `_ - . / : @ $ #`.
61
+
62
+ The host owns opening, closing, reset, and submitting changes. Missing annotation support is inert (`tweak.supported` is false). Page cleanup is automatic; call `tweak.dispose()` only if removing the component before navigation.
@@ -0,0 +1,90 @@
1
+ # Calendar
2
+
3
+ Use the bundled `<viz-calendar>` for a day schedule when this composition fits. Its Shadow DOM owns layout, colors and typography, including overlap lanes and event durations. The element applies the shared `.widget` class and a 12px content inset automatically; do not wrap it in another card or add another inset. Its flat surface uses the host card radius, corner shape and thin outline; event colors use the environment palette. Event labels stay 14px in both short and full-day views; longer ranges compact the spacing, not the type. Short blocks show only the title instead of stretching the whole schedule for secondary text. Hover, focus or tap an event to see its full title, time and detail in the shared tooltip. Use custom HTML for a different calendar view. [Complete static example](../examples/calendar.html).
4
+
5
+ ## JavaScript data
6
+
7
+ Assign an array directly to `calendar.events`. Configure it before appending so the first render includes the events. The host registers the component synchronously before running the fragment; use the literal `viz-calendar` name in HTML or JavaScript so it can include the runtime. No import, initialization or custom CSS is needed.
8
+
9
+ ```html
10
+ <div id="calendar-host"></div>
11
+ <script>
12
+ {
13
+ const root = document.getElementById("calendar-host");
14
+ const calendar = document.createElement("viz-calendar");
15
+ calendar.setAttribute("date", "2026-09-08");
16
+ calendar.setAttribute("start", "11:00");
17
+ calendar.setAttribute("end", "14:00");
18
+ calendar.events = [
19
+ { title: "Standup", start: "12:00", end: "12:30" },
20
+ { title: "Email block", start: "12:00", end: "12:30", tone: "green" },
21
+ { title: "Design sync", start: "13:00", end: "14:00", video: true },
22
+ ];
23
+ root.append(calendar);
24
+ }
25
+ </script>
26
+ ```
27
+
28
+ Keep the element reference for updates: `calendar.events = updatedEvents` redraws synchronously. Replace the array to update; changing an array or event in place does not trigger a render. Text is escaped by the renderer, so JavaScript values need no HTML-attribute escaping.
29
+
30
+ The property takes precedence over the `events` attribute until assigned `undefined`, which restores attribute input. Assign `[]` to clear the schedule. Property data is not reflected into HTML attributes; keep it separately when saving or restoring the fragment. Properties assigned before registration are picked up on upgrade.
31
+
32
+ ## Event selection
33
+
34
+ Add `interactive` when the fragment handles event selection. Each event becomes a native button, supporting click, Enter and Space. Listen on the calendar or an ancestor:
35
+
36
+ ```js
37
+ const selection = document.createElement("output");
38
+ selection.setAttribute("aria-live", "polite");
39
+ calendar.after(selection);
40
+ calendar.setAttribute("interactive", "");
41
+ calendar.addEventListener("eventselect", ({ detail: { event } }) => {
42
+ // Update a local detail view using the selected source event.
43
+ selection.textContent = `${event.title} · ${event.start}-${event.end}`;
44
+ });
45
+ ```
46
+
47
+ `eventselect` bubbles across Shadow DOM. Its `detail.event` is the original supplied object, including any caller-owned ID; `detail.index` is its position in the input array, before sorting or clipping. Without `interactive`, event buttons expose their details without emitting a selection. Selection does not change calendar data or contact a service. Interactive events use the host's cursor preference and a subtle hover tint.
48
+
49
+ ## Switching days
50
+
51
+ The component renders one day and has no built-in tabs. Add the shared [Tabs](../SKILL.md#tabs) outside it only when there are two or more supplied days to switch between; omit tabs for a single day. On selection, assign the chosen day's `date` and `events` to the same element. Do not invent more days to fill a tab bar.
52
+
53
+ ## Static HTML
54
+
55
+ For a fixed snapshot, the JSON attribute remains sufficient:
56
+
57
+ ```html
58
+ <viz-calendar
59
+ date="2026-09-08"
60
+ start="11:00"
61
+ end="14:00"
62
+ now="11:50"
63
+ events='[{"title":"Standup","start":"12:00","end":"12:30"},{"title":"Design sync","start":"13:00","end":"14:00","video":true}]'
64
+ >
65
+ </viz-calendar>
66
+ ```
67
+
68
+ Escape HTML attribute content, including apostrophes as `&#39;` inside single-quoted JSON. Attribute changes redraw synchronously when no JavaScript property overrides the events.
69
+
70
+ ## Configuration
71
+
72
+ | Attribute | Meaning |
73
+ | -------------- | ----------------------------------------------------------------- |
74
+ | `date` | Required calendar date, `YYYY-MM-DD`. |
75
+ | `start`, `end` | Visible time window; defaults to `09:00`-`17:00`. |
76
+ | `now` | Optional current-time marker. Supply only when verified. |
77
+ | `time-zone` | Optional short zone label; does not convert timestamps. |
78
+ | `lang` | Date-formatting locale; defaults to the host language. |
79
+ | `empty-label` | Empty-state text; defaults to "No events". |
80
+ | `interactive` | Boolean attribute; enables event buttons that emit `eventselect`. |
81
+
82
+ Use the three hours around the next event for a brief check-in or the requested range for a full-day view. Times are local wall-clock `HH:MM`, with `24:00` allowed as an end. Convert source timestamps to the requested date and zone before passing them in.
83
+
84
+ Each event requires `title`, `start` and `end`. Optional fields are `tone` (`blue`, `green`, `red`, `orange`, `purple`, `yellow`), `detail` (short secondary text) and `video` (a boolean that shows a video-call icon). Tones use the environment's theme variables, such as `--green`; omitted tones default to blue. Keep a small, consistent palette for source calendars or categories. Supply at most 200 events; events outside the visible window are clipped or omitted. Invalid data produces an inline error that clears when valid data is supplied.
85
+
86
+ ## Rendering and updates
87
+
88
+ The component builds its styled shadow tree synchronously on connection and updates it synchronously on assignment. An existing declarative shadow root is preserved during upgrade unless JavaScript event data was supplied, in which case that data is rendered.
89
+
90
+ This is a supplied snapshot. It has no connector, booking, background clock or network access. Refresh data in the host and pass the resulting array to `events`; update `now` separately when needed. Keep extra facts in the surrounding response.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "computer-use",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "Computer Use: automate desktop apps with mouse, keyboard, and UI element control.",
5
5
  "author": {
6
6
  "name": "Z.ai"
@@ -344,7 +344,7 @@ Minimize round trips while keeping the state fresh:
344
344
 
345
345
  ```typescript
346
346
  await target.click(42);
347
- await target.setValue(42, "openai.com");
347
+ await target.setValue(42, "example.com");
348
348
  await target.pressKey("Return");
349
349
  await target.typeText("hello");
350
350
  await target.scroll(42, "down", 1);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@zcode/zcode-cua-plugin",
4
- "version": "0.6.3",
4
+ "version": "0.6.4",
5
5
  "private": true,
6
6
  "description": "ZCode CUA SDK and skill package; execution is provided by the shared node_repl host.",
7
7
  "license": "MIT",