@native-sdk/cli 0.8.3 → 0.8.4

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 (89) hide show
  1. package/build/app.zig +50 -3
  2. package/build.zig +131 -360
  3. package/native-sdk.d.ts +4 -0
  4. package/package.json +9 -9
  5. package/packages/core/compile-surface/core.ts +90 -1
  6. package/packages/core/package-lock.json +2 -2
  7. package/packages/core/package.json +1 -1
  8. package/packages/core/sdk/core.d.ts +65 -2
  9. package/packages/core/sdk/core.ts +189 -33
  10. package/packages/core/sdk/events.d.ts +14 -0
  11. package/packages/core/sdk/events.ts +18 -0
  12. package/packages/core/src/checker.ts +61 -1
  13. package/packages/core/src/devhost.ts +3 -3
  14. package/packages/core/src/diagnostics.ts +4 -4
  15. package/skill-data/core/SKILL.md +4 -2
  16. package/skill-data/core/references/project-anatomy.md +2 -1
  17. package/skill-data/core/references/web-engines-packaging-debugging.md +3 -1
  18. package/skill-data/native-ui/SKILL.md +8 -8
  19. package/skill-data/ts-core/SKILL.md +16 -13
  20. package/src/app_runner/ts_core_main.zig +25 -2
  21. package/src/embed/host.zig +6 -0
  22. package/src/embed/ui_host.zig +2 -0
  23. package/src/platform/linux/root.zig +1 -0
  24. package/src/platform/macos/appkit_host.h +10 -0
  25. package/src/platform/macos/appkit_host.m +515 -93
  26. package/src/platform/macos/capture_info_plist.c +25 -0
  27. package/src/platform/macos/cef_host.mm +22 -0
  28. package/src/platform/macos/root.zig +68 -0
  29. package/src/platform/null_platform.zig +58 -0
  30. package/src/platform/root.zig +7 -0
  31. package/src/platform/types.zig +100 -0
  32. package/src/platform/windows/root.zig +56 -0
  33. package/src/platform/windows/webview2_host.cpp +171 -0
  34. package/src/primitives/app_manifest/types.zig +2 -0
  35. package/src/primitives/canvas/code_tests.zig +9 -9
  36. package/src/primitives/canvas/events.zig +12 -11
  37. package/src/primitives/canvas/frame.zig +44 -9
  38. package/src/primitives/canvas/icons/mic.svg +1 -0
  39. package/src/primitives/canvas/icons.zig +2 -0
  40. package/src/primitives/canvas/root.zig +8 -0
  41. package/src/primitives/canvas/text_span_tests.zig +39 -0
  42. package/src/primitives/canvas/ui.zig +23 -4
  43. package/src/primitives/canvas/ui_markup.zig +15 -0
  44. package/src/primitives/canvas/ui_markup_compiled.zig +9 -0
  45. package/src/primitives/canvas/ui_markup_compiled_tests.zig +1 -1
  46. package/src/primitives/canvas/ui_markup_tests.zig +5 -0
  47. package/src/primitives/canvas/ui_markup_view.zig +9 -0
  48. package/src/primitives/canvas/ui_markup_view_tests.zig +9 -6
  49. package/src/primitives/canvas/ui_schema.zig +19 -10
  50. package/src/primitives/canvas/ui_schema_tests.zig +5 -3
  51. package/src/primitives/canvas/ui_tests.zig +18 -4
  52. package/src/primitives/canvas/widget_invalidation.zig +9 -2
  53. package/src/primitives/canvas/widget_render.zig +296 -114
  54. package/src/primitives/canvas/widget_runtime_tests.zig +133 -0
  55. package/src/primitives/canvas/widget_text_input.zig +10 -10
  56. package/src/primitives/canvas/widget_tree.zig +1 -1
  57. package/src/primitives/canvas/widgets.zig +29 -5
  58. package/src/root.zig +10 -0
  59. package/src/runtime/automation_widget_dispatch.zig +1 -0
  60. package/src/runtime/bridge_payload.zig +2 -0
  61. package/src/runtime/canvas_frame.zig +13 -2
  62. package/src/runtime/canvas_frame_invalidation_tests.zig +35 -10
  63. package/src/runtime/canvas_widget_anchored_tests.zig +83 -0
  64. package/src/runtime/canvas_widget_events.zig +69 -24
  65. package/src/runtime/canvas_widget_runtime.zig +101 -6
  66. package/src/runtime/canvas_widget_scroll_driver_tests.zig +47 -4
  67. package/src/runtime/canvas_widget_scroll_drivers.zig +3 -3
  68. package/src/runtime/canvas_widget_semantics_tests.zig +2 -0
  69. package/src/runtime/canvas_widget_split_tree_tests.zig +228 -0
  70. package/src/runtime/canvas_widget_state.zig +6 -1
  71. package/src/runtime/canvas_widget_text_tests.zig +112 -3
  72. package/src/runtime/effects.zig +313 -2
  73. package/src/runtime/effects_audio_capture_tests.zig +251 -0
  74. package/src/runtime/root.zig +3 -0
  75. package/src/runtime/tests.zig +1 -0
  76. package/src/runtime/ts_core_host.zig +401 -32
  77. package/src/runtime/ts_core_host_tests.zig +407 -0
  78. package/src/runtime/ts_ui_app.zig +39 -1
  79. package/src/runtime/ui_app.zig +18 -3
  80. package/src/runtime/ui_app_tests.zig +48 -0
  81. package/src/runtime/view.zig +2 -0
  82. package/src/runtime/view_widget_scroll.zig +56 -5
  83. package/src/runtime/view_widget_text.zig +24 -5
  84. package/src/runtime/view_widget_tree.zig +1 -1
  85. package/src/tooling/manifest.zig +1034 -0
  86. package/src/tooling/package.zig +837 -6
  87. package/src/tooling/raw_manifest.zig +35 -0
  88. package/src/tooling/templates.zig +55 -0
  89. package/tools/corewire/emit_facade.zig +36 -0
package/build.zig CHANGED
@@ -783,6 +783,11 @@ pub fn build(b: *std.Build) void {
783
783
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSAccessibilityProgressIndicatorRole" },
784
784
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "view.accessibilityRole = NativeSdkAccessibilityRoleForNativeViewKind(kind)" },
785
785
  });
786
+ addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-audio-capture-start-stop-serialized", "Verify asynchronous ScreenCaptureKit startup cannot publish a stream after stop returns", &.{
787
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "@property(nonatomic, strong) NSLock *lifecycleLock;" },
788
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "[strongSelf.lifecycleLock lock];\n if (![strongSelf.target isCaptureActive]) {\n [strongSelf.lifecycleLock unlock];\n return;\n }\n strongSelf.stream = stream;" },
789
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "[self.lifecycleLock lock];\n SCStream *stream = self.stream;\n self.stream = nil;\n [self.lifecycleLock unlock];" },
790
+ });
786
791
  addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-gpu-input-repaints-retained-canvas", "Verify GPU input wakes retained canvas frames", &.{
787
792
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "- (void)requestRetainedCanvasFrame" },
788
793
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "[self requestRetainedCanvasFrame];" },
@@ -1017,6 +1022,8 @@ pub fn build(b: *std.Build) void {
1017
1022
  addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-gpu-packet-blur-effects", "Verify AppKit GPU packet presenter applies blur effects", &.{
1018
1023
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkPacketApplyBlur" },
1019
1024
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "CGBitmapContextGetData(context)" },
1025
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkGaussianBoxRadii" },
1026
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "vImageBoxConvolve_ARGB8888" },
1020
1027
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSIntersectionRect(rect, clipRect)" },
1021
1028
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkPacketTransformRect(transformValue, NativeSdkPacketRect(effect[@\"rect\"]))" },
1022
1029
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "return NativeSdkPacketApplyBlur(effect, opacity, context, scale, transformValue, hasClip, clipRect)" },
@@ -1414,6 +1421,7 @@ pub fn build(b: *std.Build) void {
1414
1421
  addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-soundboard", "Run soundboard example tests", "examples/soundboard", .managed),
1415
1422
  addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-video-player", "Run video player example tests", "examples/video-player", .managed),
1416
1423
  addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-soundboard-ts", "Run soundboard-ts example tests", "examples/soundboard-ts", .managed),
1424
+ addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-voice-memo", "Run voice memo example tests", "examples/voice-memo", .managed),
1417
1425
  addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-deck", "Run deck example tests", "examples/deck", .managed),
1418
1426
  addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-markdown-viewer", "Run markdown viewer example tests", "examples/markdown-viewer", .managed),
1419
1427
  addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-code-editor", "Run code editor example tests", "examples/code-editor", .managed),
@@ -2284,7 +2292,7 @@ pub fn build(b: *std.Build) void {
2284
2292
  canvas_preview_smoke_run.step.dependOn(&cli_exe.step);
2285
2293
  canvas_preview_smoke_step.dependOn(&canvas_preview_smoke_run.step);
2286
2294
 
2287
- const gpu_components_smoke_step = b.step("test-gpu-components-smoke", "Run macOS GPU components automation smoke test");
2295
+ const gpu_components_smoke_step = b.step("test-gpu-components-smoke", "Run the TypeScript component gallery automation smoke test");
2288
2296
  const gpu_components_smoke_build = managedExampleRun(b, cli_exe, &.{ "build", "-Dplatform=macos", "-Dweb-engine=system", "-Dautomation=true", "-Doptimize=Debug" });
2289
2297
  gpu_components_smoke_build.setCwd(b.path("examples/gpu-components"));
2290
2298
  const gpu_components_smoke_run = b.addSystemCommand(&.{
@@ -2296,361 +2304,115 @@ pub fn build(b: *std.Build) void {
2296
2304
  \\case "$cli" in /*) ;; *) cli="../../$cli" ;; esac
2297
2305
  \\automation_dir=".zig-cache/native-sdk-automation"
2298
2306
  \\mkdir -p "$automation_dir"
2299
- \\# Startup latencies are load-sensitive on shared CI/agent machines.
2300
- \\# NATIVE_SDK_SMOKE_BUDGET_MS raises the first-frame latency budget (default
2301
- \\# stays 150 ms) and the automation-ready ceiling (default stays
2302
- \\# 500 ms; the ceiling never drops below it) without weakening the
2303
- \\# local defaults; every correctness assertion stays strict.
2304
- \\smoke_budget_ms="${NATIVE_SDK_SMOKE_BUDGET_MS:-150}"
2305
- \\case "$smoke_budget_ms" in ''|*[!0-9]*) echo "NATIVE_SDK_SMOKE_BUDGET_MS must be a positive integer of milliseconds: $smoke_budget_ms" >&2; exit 1 ;; esac
2306
- \\if [ "$smoke_budget_ms" -le 0 ]; then echo "NATIVE_SDK_SMOKE_BUDGET_MS must be a positive integer of milliseconds: $smoke_budget_ms" >&2; exit 1; fi
2307
- \\smoke_budget_ns=$((smoke_budget_ms * 1000000))
2308
- \\ready_budget_ms="$smoke_budget_ms"
2309
- \\if [ "$ready_budget_ms" -lt 500 ]; then ready_budget_ms=500; fi
2310
- \\ready_budget_ns=$((ready_budget_ms * 1000000))
2311
- \\rm -f "$automation_dir/snapshot.txt" "$automation_dir/accessibility.txt" "$automation_dir/windows.txt" "$automation_dir"/command*.txt
2307
+ \\rm -f "$automation_dir/snapshot.txt" "$automation_dir/accessibility.txt" "$automation_dir/windows.txt" "$automation_dir/screenshot-components-canvas.png" "$automation_dir/screenshot-components-house.png" "$automation_dir/screenshot-components-geist.png" "$automation_dir"/command*.txt
2312
2308
  \\"$app" > .zig-cache/native-sdk-gpu-components-smoke.log 2>&1 &
2313
2309
  \\pid=$!
2314
2310
  \\trap 'status=$?; kill "$pid" >/dev/null 2>&1 || true; wait "$pid" >/dev/null 2>&1 || true; if [ "$status" -ne 0 ]; then echo "---- app log (.zig-cache/native-sdk-gpu-components-smoke.log) ----" >&2; cat .zig-cache/native-sdk-gpu-components-smoke.log >&2 2>/dev/null || true; fi' EXIT
2315
2311
  \\ready="$("$cli" automate wait 2>&1)"
2316
2312
  \\case "$ready" in *"ready=true"*) ;; *) echo "gpu-components automation snapshot was not ready" >&2; exit 1 ;; esac
2317
- \\ready_uptime="$(printf '%s\n' "$ready" | sed -n 's/.*runtime_uptime_ns=\([0-9][0-9]*\).*/\1/p')"
2318
- \\case "$ready_uptime" in ''|*[!0-9]*) echo "gpu-components automation ready uptime was missing" >&2; exit 1 ;; esac
2319
- \\if [ "$ready_uptime" -le 0 ] || [ "$ready_uptime" -gt "$ready_budget_ns" ]; then echo "gpu-components automation ready exceeded $ready_budget_ms ms: $ready_uptime ns" >&2; exit 1; fi
2320
- \\snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2321
- \\case "$snapshot" in *'window @w1 "Native SDK GPU Components"'*) ;; *) echo "gpu-components window was missing from snapshot" >&2; exit 1 ;; esac
2322
- \\case "$snapshot" in *'view @w1/main kind=webview'*) echo "components should not create an implicit main WebView" >&2; exit 1 ;; *) ;; esac
2323
- \\case "$snapshot" in *'source kind=html bytes=0'*) echo "components should not publish an empty default WebView source" >&2; exit 1 ;; *) ;; esac
2324
- \\attempts=0
2325
- \\while [ "$attempts" -lt 50 ]; do
2326
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2327
- \\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_nonblank=true'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
2328
- \\ attempts=$((attempts + 1))
2329
- \\ sleep 0.1
2330
- \\done
2331
- \\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_nonblank=true'*) ;; *) echo "components GPU surface was not ready and nonblank" >&2; exit 1 ;; esac
2332
- \\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "components GPU frame was not packet-representable" >&2; exit 1 ;; esac
2333
- \\first_frame_latency="$(printf '%s\n' "$snapshot" | sed -n 's/.*view @w1\/components-canvas kind=gpu_surface.* gpu_first_frame_latency_ns=\([0-9][0-9]*\).*/\1/p')"
2334
- \\case "$first_frame_latency" in ''|*[!0-9]*) echo "components GPU first frame latency was missing" >&2; exit 1 ;; esac
2335
- \\if [ "$first_frame_latency" -le 0 ] || [ "$first_frame_latency" -gt "$smoke_budget_ns" ]; then echo "components GPU first frame exceeded $smoke_budget_ms ms: $first_frame_latency ns" >&2; exit 1; fi
2336
- \\# The runtime publishes its own fixed 150 ms budget verdict. Within that
2337
- \\# budget the verdict must agree exactly; beyond it (reachable only when
2338
- \\# NATIVE_SDK_SMOKE_BUDGET_MS > 150) the runtime must report the overrun honestly.
2339
- \\if [ "$first_frame_latency" -le 150000000 ]; then
2340
- \\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_first_frame_latency_budget_ns=150000000'*'gpu_first_frame_latency_budget_exceeded=0'*'gpu_first_frame_latency_budget_ok=true'*) ;; *) echo "components GPU first frame exceeded the latency budget" >&2; exit 1 ;; esac
2341
- \\else
2342
- \\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_first_frame_latency_budget_ns=150000000'*'gpu_first_frame_latency_budget_ok=false'*) ;; *) echo "components runtime did not report the first-frame budget overrun" >&2; exit 1 ;; esac
2343
- \\fi
2344
- \\gpu_frame_from_snapshot() {
2345
- \\ printf '%s\n' "$snapshot" | sed -n 's/.*view @w1\/components-canvas kind=gpu_surface.* gpu_frame=\([0-9][0-9]*\).*/\1/p'
2313
+ \\snapshot="$automation_dir/snapshot.txt"
2314
+ \\widget_id() {
2315
+ \\ role="$1"
2316
+ \\ name="$2"
2317
+ \\ sed -n "s/.*widget @w1\\/components-canvas#\\([0-9][0-9]*\\) role=$role name=\\\"$name\\\".*/\\1/p" "$snapshot" | head -1
2346
2318
  \\}
2347
- \\canvas_revision_from_snapshot() {
2348
- \\ printf '%s\n' "$snapshot" | sed -n 's/.*view @w1\/components-canvas kind=gpu_surface.* canvas_revision=\([0-9][0-9]*\).*/\1/p'
2349
- \\}
2350
- \\snapshot_contains() {
2351
- \\ case "$snapshot" in *"$1"*) return 0 ;; *) return 1 ;; esac
2352
- \\}
2353
- \\case "$snapshot" in *'widget @w1/components-canvas#113 role=checkbox'*'value=1'*'actions=[focus,toggle]'*) ;; *) echo "checkbox widget was not initially selected" >&2; exit 1 ;; esac
2354
- \\case "$snapshot" in *'widget @w1/components-canvas#114 role=switch'*'value=1'*'actions=[focus,toggle]'*) ;; *) echo "switch widget was not initially selected" >&2; exit 1 ;; esac
2355
- \\case "$snapshot" in *'widget @w1/components-canvas#116 role=progressbar'*'value=1'*) ;; *) echo "progress widget was missing from the initial snapshot" >&2; exit 1 ;; esac
2356
- \\case "$snapshot" in *'widget @w1/components-canvas#117 role=tab'*'value=1'*'actions=[focus,select]'*) ;; *) echo "small segmented control was not initially selected" >&2; exit 1 ;; esac
2357
- \\case "$snapshot" in *'widget @w1/components-canvas#119 role=tab'*'value=0'*'actions=[focus,select]'*) ;; *) echo "large segmented control was not initially available" >&2; exit 1 ;; esac
2358
- \\case "$snapshot" in *'widget @w1/components-canvas#142 role=menuitem'*'actions=[focus,press,select]'*) ;; *) echo "menu item widget was not initially actionable" >&2; exit 1 ;; esac
2359
- \\case "$snapshot" in *'widget @w1/components-canvas#86 role=tab'*'actions=[focus,press,select]'*) ;; *) echo "theme toolbar trigger was not initially actionable" >&2; exit 1 ;; esac
2360
- \\case "$snapshot" in *'widget @w1/components-canvas#83 role=button'*'actions=[focus,press]'*) ;; *) echo "refresh toolbar widget was not initially actionable" >&2; exit 1 ;; esac
2361
- \\gpu_frame_before="$(gpu_frame_from_snapshot)"
2362
- \\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
2363
- \\gpu_frame_after="$gpu_frame_before"
2364
- \\canvas_revision_before="$(canvas_revision_from_snapshot)"
2365
- \\case "$canvas_revision_before" in ''|*[!0-9]*) canvas_revision_before=0 ;; esac
2366
- \\canvas_revision_after="$canvas_revision_before"
2367
- \\"$cli" automate widget-click components-canvas 86 >/dev/null 2>&1
2368
- \\attempts=0
2369
- \\while [ "$attempts" -lt 50 ]; do
2370
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2371
- \\ gpu_frame_after="$(gpu_frame_from_snapshot)"
2372
- \\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
2373
- \\ canvas_revision_after="$(canvas_revision_from_snapshot)"
2374
- \\ case "$canvas_revision_after" in ''|*[!0-9]*) canvas_revision_after=0 ;; esac
2375
- \\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ] || [ "$canvas_revision_after" -gt "$canvas_revision_before" ]; then
2376
- \\ if snapshot_contains 'GPU component theme: ' && snapshot_contains ' from native_view. Count 1.' && snapshot_contains 'view @w1/components-canvas kind=gpu_surface' && snapshot_contains 'canvas_frame_gpu_packet_unsupported=0' && snapshot_contains 'canvas_frame_gpu_packet_representable=true'; then break; fi
2377
- \\ fi
2378
- \\ attempts=$((attempts + 1))
2379
- \\ sleep 0.1
2380
- \\done
2381
- \\if [ "$gpu_frame_after" -le "$gpu_frame_before" ] && [ "$canvas_revision_after" -le "$canvas_revision_before" ]; then echo "theme automation command did not update the retained GPU canvas" >&2; exit 1; fi
2382
- \\case "$snapshot" in *'GPU component theme: '*' from native_view. Count 1.'*) ;; *) echo "theme automation command did not update status" >&2; exit 1 ;; esac
2383
- \\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "theme automation command did not present a packet-renderable GPU frame" >&2; exit 1 ;; esac
2384
- \\"$cli" automate widget-action components-canvas 111 focus >/dev/null 2>&1
2385
- \\attempts=0
2386
- \\while [ "$attempts" -lt 50 ]; do
2387
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2388
- \\ case "$snapshot" in *'widget @w1/components-canvas#111 role=textbox'*'focused=true'*'text="native-sdk"'*) break ;; esac
2389
- \\ attempts=$((attempts + 1))
2390
- \\ sleep 0.1
2391
- \\done
2392
- \\case "$snapshot" in *'widget @w1/components-canvas#111 role=textbox'*'focused=true'*'text="native-sdk"'*) ;; *) echo "widget focus automation did not focus retained text" >&2; exit 1 ;; esac
2393
- \\"$cli" automate widget-key components-canvas z z >/dev/null 2>&1
2394
- \\attempts=0
2395
- \\while [ "$attempts" -lt 50 ]; do
2396
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2397
- \\ case "$snapshot" in *'widget @w1/components-canvas#111 role=textbox'*'focused=true'*'text="native-sdkz"'*) break ;; esac
2398
- \\ attempts=$((attempts + 1))
2399
- \\ sleep 0.1
2400
- \\done
2401
- \\case "$snapshot" in *'widget @w1/components-canvas#111 role=textbox'*'focused=true'*'text="native-sdkz"'*) ;; *) echo "widget keyboard automation did not update retained text" >&2; exit 1 ;; esac
2402
- \\"$cli" automate widget-key components-canvas tab >/dev/null 2>&1
2403
- \\attempts=0
2404
- \\while [ "$attempts" -lt 50 ]; do
2405
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2406
- \\ case "$snapshot" in *'widget @w1/components-canvas#112 role=textbox'*'focused=true'*) break ;; esac
2407
- \\ attempts=$((attempts + 1))
2408
- \\ sleep 0.1
2409
- \\done
2410
- \\case "$snapshot" in *'widget @w1/components-canvas#112 role=textbox'*'focused=true'*) ;; *) echo "widget keyboard automation did not move focus" >&2; exit 1 ;; esac
2411
- \\"$cli" automate widget-action components-canvas 105 press >/dev/null 2>&1
2412
- \\attempts=0
2413
- \\while [ "$attempts" -lt 50 ]; do
2414
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2415
- \\ if snapshot_contains 'Keyed icon_button #105.' && snapshot_contains 'widget @w1/components-canvas#105 role=button' && snapshot_contains 'actions=[focus,press]'; then break; fi
2416
- \\ attempts=$((attempts + 1))
2417
- \\ sleep 0.1
2418
- \\done
2419
- \\if ! snapshot_contains 'Keyed icon_button #105.' || ! snapshot_contains 'widget @w1/components-canvas#105 role=button' || ! snapshot_contains 'actions=[focus,press]'; then echo "icon button automation press did not update status" >&2; exit 1; fi
2420
- \\"$cli" automate widget-action components-canvas 111 set-text native-engine >/dev/null 2>&1
2421
- \\attempts=0
2422
- \\while [ "$attempts" -lt 50 ]; do
2423
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2424
- \\ case "$snapshot" in *'widget @w1/components-canvas#111 role=textbox'*'text="native-engine"'*) break ;; esac
2425
- \\ attempts=$((attempts + 1))
2426
- \\ sleep 0.1
2427
- \\done
2428
- \\case "$snapshot" in *'widget @w1/components-canvas#111 role=textbox'*'text="native-engine"'*) ;; *) echo "text field automation did not update retained text" >&2; exit 1 ;; esac
2429
- \\"$cli" automate widget-action components-canvas 115 increment >/dev/null 2>&1
2430
- \\attempts=0
2431
- \\while [ "$attempts" -lt 50 ]; do
2432
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2433
- \\ case "$snapshot" in *'Keyed slider #115: value '*)
2434
- \\ case "$snapshot" in *'widget @w1/components-canvas#115 role=slider'*'value=0.62'*) ;; *'widget @w1/components-canvas#115 role=slider'*) break ;; esac
2435
- \\ ;;
2436
- \\ esac
2437
- \\ attempts=$((attempts + 1))
2438
- \\ sleep 0.1
2439
- \\done
2440
- \\case "$snapshot" in *'Keyed slider #115: value '*) ;; *) echo "slider automation increment did not update status" >&2; exit 1 ;; esac
2441
- \\case "$snapshot" in *'widget @w1/components-canvas#115 role=slider'*'value=0.62'*) echo "slider automation increment did not change value" >&2; exit 1 ;; *'widget @w1/components-canvas#115 role=slider'*) ;; *) echo "slider widget was missing after increment" >&2; exit 1 ;; esac
2442
- \\gpu_frame_before="$(gpu_frame_from_snapshot)"
2443
- \\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
2444
- \\gpu_frame_after="$gpu_frame_before"
2445
- \\"$cli" automate widget-drag components-canvas 115 0.25 0.82 >/dev/null 2>&1
2446
- \\attempts=0
2447
- \\while [ "$attempts" -lt 50 ]; do
2448
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2449
- \\ gpu_frame_after="$(gpu_frame_from_snapshot)"
2450
- \\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
2451
- \\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ]; then
2452
- \\ if snapshot_contains 'Clicked slider #115: value 0.82.' && snapshot_contains 'widget @w1/components-canvas#115 role=slider' && { snapshot_contains 'value=0.82' || snapshot_contains 'value=0.819'; }; then
2453
- \\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
2454
- \\ fi
2455
- \\ fi
2456
- \\ attempts=$((attempts + 1))
2457
- \\ sleep 0.1
2458
- \\done
2459
- \\if [ "$gpu_frame_after" -le "$gpu_frame_before" ]; then echo "slider automation drag did not request a GPU frame" >&2; exit 1; fi
2460
- \\if ! snapshot_contains 'Clicked slider #115: value 0.82.' || ! snapshot_contains 'widget @w1/components-canvas#115 role=slider' || { ! snapshot_contains 'value=0.82' && ! snapshot_contains 'value=0.819'; }; then echo "slider automation drag did not update retained slider state" >&2; exit 1; fi
2461
- \\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "slider automation drag did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
2462
- \\"$cli" automate widget-action components-canvas 156 press >/dev/null 2>&1
2463
- \\attempts=0
2464
- \\while [ "$attempts" -lt 50 ]; do
2465
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2466
- \\ if snapshot_contains 'Keyed data_cell #156: selected.' && snapshot_contains 'widget @w1/components-canvas#156 role=gridcell' && snapshot_contains 'focused=true' && snapshot_contains 'value=1'; then break; fi
2467
- \\ attempts=$((attempts + 1))
2468
- \\ sleep 0.1
2469
- \\done
2470
- \\if ! snapshot_contains 'Keyed data_cell #156: selected.' || ! snapshot_contains 'widget @w1/components-canvas#156 role=gridcell' || ! snapshot_contains 'focused=true' || ! snapshot_contains 'value=1'; then echo "grid cell automation press did not focus and report status" >&2; exit 1; fi
2471
- \\gpu_frame_before="$(gpu_frame_from_snapshot)"
2472
- \\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
2473
- \\gpu_frame_after="$gpu_frame_before"
2474
- \\"$cli" automate widget-click components-canvas 119 >/dev/null 2>&1
2475
- \\attempts=0
2476
- \\while [ "$attempts" -lt 50 ]; do
2477
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2478
- \\ gpu_frame_after="$(gpu_frame_from_snapshot)"
2479
- \\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
2480
- \\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ]; then
2481
- \\ if snapshot_contains 'Clicked segmented_control #119: selected.' && snapshot_contains 'widget @w1/components-canvas#117 role=tab' && snapshot_contains 'value=0' && snapshot_contains 'widget @w1/components-canvas#119 role=tab' && snapshot_contains 'focused=true' && snapshot_contains 'value=1'; then
2482
- \\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
2483
- \\ fi
2484
- \\ fi
2485
- \\ attempts=$((attempts + 1))
2486
- \\ sleep 0.1
2487
- \\done
2488
- \\if [ "$gpu_frame_after" -le "$gpu_frame_before" ]; then echo "segmented control automation click did not request a GPU frame" >&2; exit 1; fi
2489
- \\if ! snapshot_contains 'Clicked segmented_control #119: selected.' || ! snapshot_contains 'widget @w1/components-canvas#117 role=tab' || ! snapshot_contains 'value=0' || ! snapshot_contains 'widget @w1/components-canvas#119 role=tab' || ! snapshot_contains 'focused=true' || ! snapshot_contains 'value=1'; then echo "segmented control automation click did not update retained selection state" >&2; exit 1; fi
2490
- \\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "segmented control automation click did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
2491
- \\# The catalog's project menu is an ACTIONS menu (no sibling declares a
2492
- \\# committed row), so automation select mints NO selection: value
2493
- \\# stays 0. Automation focus follows the pointer contract (rows take
2494
- \\# focus QUIETLY, no visible affordance), so nothing repaints and no
2495
- \\# frame is requested — the republished snapshot alone carries the
2496
- \\# focus move. A picker menu would mint value=1 and repaint; the
2497
- \\# select specimen's committed-row tests cover that register.
2498
- \\"$cli" automate widget-action components-canvas 142 select >/dev/null 2>&1
2499
2319
  \\attempts=0
2500
2320
  \\while [ "$attempts" -lt 50 ]; do
2501
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2502
- \\ case "$(printf '%s\\n' "$snapshot" | grep -F 'components-canvas#142 role=menuitem' | head -1)" in *'focused=true'*'value=0'*) break ;; esac
2321
+ \\ ready_snapshot="$(cat "$snapshot" 2>/dev/null || true)"
2322
+ \\ case "$ready_snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_nonblank=true'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
2503
2323
  \\ attempts=$((attempts + 1))
2504
2324
  \\ sleep 0.1
2505
2325
  \\done
2506
- \\menu_item_line="$(printf '%s\\n' "$snapshot" | grep -F 'components-canvas#142 role=menuitem' | head -1)"
2507
- \\case "$menu_item_line" in *'focused=true'*'value=0'*) ;; *) echo "menu item automation select did not move quiet focus without minting a selection" >&2; exit 1 ;; esac
2508
- \\"$cli" automate widget-action components-canvas 113 toggle >/dev/null 2>&1
2509
- \\attempts=0
2510
- \\while [ "$attempts" -lt 50 ]; do
2511
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2512
- \\ if snapshot_contains 'Keyed checkbox #113: off.' && snapshot_contains 'widget @w1/components-canvas#113 role=checkbox' && snapshot_contains 'value=0'; then break; fi
2513
- \\ attempts=$((attempts + 1))
2514
- \\ sleep 0.1
2326
+ \\case "$ready_snapshot" in *'window @w1 "Native SDK GPU Components"'*) ;; *) echo "gpu-components window was missing" >&2; exit 1 ;; esac
2327
+ \\case "$ready_snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_nonblank=true'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "component gallery GPU surface was not ready" >&2; exit 1 ;; esac
2328
+ \\case "$ready_snapshot" in *'view @w1/main kind=webview'*) echo "component gallery created an implicit WebView" >&2; exit 1 ;; *) ;; esac
2329
+ \\"$cli" automate assert 'role=tree name="Components"' 'role=treeitem name="Components".*state=\[expanded\]' 'role=treeitem name="Accordion".*state=\[selected\]' 'role=group name="Details".*state=\[selected,expanded\]' 'name="Accordion details are visible. The model owns this expanded state."'
2330
+ \\"$cli" automate assert 'role=group name="Theme"' 'role=button name="Default".*state=\[selected\]' 'role=button name="Geist"'
2331
+ \\"$cli" automate screenshot components-canvas >/dev/null 2>&1
2332
+ \\cp "$automation_dir/screenshot-components-canvas.png" "$automation_dir/screenshot-components-house.png"
2333
+ \\rm -f "$automation_dir/screenshot-components-canvas.png"
2334
+ \\theme_geist_id="$(widget_id button Geist)"
2335
+ \\case "$theme_geist_id" in ''|*[!0-9]*) echo "Geist theme toggle id was missing" >&2; exit 1 ;; esac
2336
+ \\"$cli" automate widget-click components-canvas "$theme_geist_id" >/dev/null 2>&1
2337
+ \\"$cli" automate assert 'role=button name="Geist".*state=\[[^]]*selected'
2338
+ \\"$cli" automate screenshot components-canvas >/dev/null 2>&1
2339
+ \\cp "$automation_dir/screenshot-components-canvas.png" "$automation_dir/screenshot-components-geist.png"
2340
+ \\test -s "$automation_dir/screenshot-components-house.png" || { echo "house theme screenshot was empty" >&2; exit 1; }
2341
+ \\test -s "$automation_dir/screenshot-components-geist.png" || { echo "Geist theme screenshot was empty" >&2; exit 1; }
2342
+ \\if cmp -s "$automation_dir/screenshot-components-house.png" "$automation_dir/screenshot-components-geist.png"; then echo "theme toggle did not change rendered pixels" >&2; exit 1; fi
2343
+ \\accordion_id="$(widget_id group Details)"
2344
+ \\case "$accordion_id" in ''|*[!0-9]*) echo "accordion id was missing" >&2; exit 1 ;; esac
2345
+ \\"$cli" automate widget-action components-canvas "$accordion_id" toggle >/dev/null 2>&1
2346
+ \\"$cli" automate assert --absent 'name="Accordion details are visible. The model owns this expanded state."'
2347
+ \\"$cli" automate widget-action components-canvas "$accordion_id" toggle >/dev/null 2>&1
2348
+ \\"$cli" automate assert 'name="Accordion details are visible. The model owns this expanded state."'
2349
+ \\accordion_row_id="$(widget_id treeitem Accordion)"
2350
+ \\case "$accordion_row_id" in ''|*[!0-9]*) echo "accordion navigation id was missing" >&2; exit 1 ;; esac
2351
+ \\"$cli" automate widget-action components-canvas "$accordion_row_id" focus >/dev/null 2>&1
2352
+ \\arrow_count=0
2353
+ \\while [ "$arrow_count" -lt 33 ]; do
2354
+ \\ "$cli" automate widget-key components-canvas arrowdown >/dev/null 2>&1
2355
+ \\ arrow_count=$((arrow_count + 1))
2515
2356
  \\done
2516
- \\if ! snapshot_contains 'Keyed checkbox #113: off.' || ! snapshot_contains 'widget @w1/components-canvas#113 role=checkbox' || ! snapshot_contains 'value=0'; then echo "checkbox automation toggle did not update the retained widget snapshot" >&2; exit 1; fi
2517
- \\gpu_frame_before="$(gpu_frame_from_snapshot)"
2518
- \\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
2519
- \\gpu_frame_after="$gpu_frame_before"
2520
- \\"$cli" automate widget-click components-canvas 113 >/dev/null 2>&1
2521
- \\attempts=0
2522
- \\while [ "$attempts" -lt 50 ]; do
2523
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2524
- \\ gpu_frame_after="$(gpu_frame_from_snapshot)"
2525
- \\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
2526
- \\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ]; then
2527
- \\ if snapshot_contains 'Clicked checkbox #113: on.' && snapshot_contains 'widget @w1/components-canvas#113 role=checkbox' && snapshot_contains 'value=1'; then
2528
- \\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
2529
- \\ fi
2530
- \\ fi
2531
- \\ attempts=$((attempts + 1))
2532
- \\ sleep 0.1
2533
- \\done
2534
- \\if [ "$gpu_frame_after" -le "$gpu_frame_before" ]; then echo "checkbox automation click did not request a GPU frame" >&2; exit 1; fi
2535
- \\if ! snapshot_contains 'Clicked checkbox #113: on.' || ! snapshot_contains 'widget @w1/components-canvas#113 role=checkbox' || ! snapshot_contains 'value=1'; then echo "checkbox automation click did not route through pointer input" >&2; exit 1; fi
2536
- \\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "checkbox automation click did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
2537
- \\"$cli" automate widget-action components-canvas 114 toggle >/dev/null 2>&1
2538
- \\attempts=0
2539
- \\while [ "$attempts" -lt 50 ]; do
2540
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2541
- \\ if snapshot_contains 'Keyed switch_control #114: off.' && snapshot_contains 'widget @w1/components-canvas#114 role=switch' && snapshot_contains 'value=0'; then break; fi
2542
- \\ attempts=$((attempts + 1))
2543
- \\ sleep 0.1
2544
- \\done
2545
- \\if ! snapshot_contains 'Keyed switch_control #114: off.' || ! snapshot_contains 'widget @w1/components-canvas#114 role=switch' || ! snapshot_contains 'value=0'; then echo "switch automation toggle did not wake the idle app" >&2; exit 1; fi
2546
- \\gpu_frame_before="$(gpu_frame_from_snapshot)"
2547
- \\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
2548
- \\gpu_frame_after="$gpu_frame_before"
2549
- \\"$cli" automate widget-click components-canvas 114 >/dev/null 2>&1
2550
- \\attempts=0
2551
- \\while [ "$attempts" -lt 50 ]; do
2552
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2553
- \\ gpu_frame_after="$(gpu_frame_from_snapshot)"
2554
- \\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
2555
- \\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ]; then
2556
- \\ if snapshot_contains 'Clicked switch_control #114: on.' && snapshot_contains 'widget @w1/components-canvas#114 role=switch' && snapshot_contains 'value=1'; then
2557
- \\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
2558
- \\ fi
2559
- \\ fi
2560
- \\ attempts=$((attempts + 1))
2561
- \\ sleep 0.1
2562
- \\done
2563
- \\if [ "$gpu_frame_after" -le "$gpu_frame_before" ]; then echo "switch automation click did not request a GPU frame" >&2; exit 1; fi
2564
- \\if ! snapshot_contains 'Clicked switch_control #114: on.' || ! snapshot_contains 'widget @w1/components-canvas#114 role=switch' || ! snapshot_contains 'value=1'; then echo "switch automation click did not route through pointer input" >&2; exit 1; fi
2565
- \\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "switch automation click did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
2566
- \\gpu_frame_before="$(gpu_frame_from_snapshot)"
2567
- \\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
2568
- \\gpu_frame_after="$gpu_frame_before"
2569
- \\canvas_revision_before="$(canvas_revision_from_snapshot)"
2570
- \\case "$canvas_revision_before" in ''|*[!0-9]*) canvas_revision_before=0 ;; esac
2571
- \\canvas_revision_after="$canvas_revision_before"
2572
- \\"$cli" automate widget-action components-canvas 120 increment >/dev/null 2>&1
2573
- \\attempts=0
2574
- \\while [ "$attempts" -lt 50 ]; do
2575
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2576
- \\ gpu_frame_after="$(gpu_frame_from_snapshot)"
2577
- \\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
2578
- \\ canvas_revision_after="$(canvas_revision_from_snapshot)"
2579
- \\ case "$canvas_revision_after" in ''|*[!0-9]*) canvas_revision_after=0 ;; esac
2580
- \\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ] || [ "$canvas_revision_after" -gt "$canvas_revision_before" ]; then
2581
- \\ if snapshot_contains 'Keyed list #120: offset 56.' && snapshot_contains 'widget @w1/components-canvas#120 role=list' && snapshot_contains 'scroll=[offset=56,viewport=56,content=168]'; then
2582
- \\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
2583
- \\ fi
2584
- \\ fi
2585
- \\ attempts=$((attempts + 1))
2586
- \\ sleep 0.1
2587
- \\done
2588
- \\if [ "$gpu_frame_after" -le "$gpu_frame_before" ] && [ "$canvas_revision_after" -le "$canvas_revision_before" ]; then echo "list automation increment did not update the retained GPU canvas" >&2; exit 1; fi
2589
- \\if ! snapshot_contains 'Keyed list #120: offset 56.' || ! snapshot_contains 'widget @w1/components-canvas#120 role=list' || ! snapshot_contains 'scroll=[offset=56,viewport=56,content=168]'; then echo "list automation increment did not update retained scroll semantics" >&2; exit 1; fi
2590
- \\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "list automation increment did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
2591
- \\gpu_frame_before="$(gpu_frame_from_snapshot)"
2592
- \\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
2593
- \\gpu_frame_after="$gpu_frame_before"
2594
- \\canvas_revision_before="$(canvas_revision_from_snapshot)"
2595
- \\case "$canvas_revision_before" in ''|*[!0-9]*) canvas_revision_before=0 ;; esac
2596
- \\canvas_revision_after="$canvas_revision_before"
2597
- \\"$cli" automate widget-action components-canvas 150 increment >/dev/null 2>&1
2598
- \\attempts=0
2599
- \\while [ "$attempts" -lt 50 ]; do
2600
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2601
- \\ gpu_frame_after="$(gpu_frame_from_snapshot)"
2602
- \\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
2603
- \\ canvas_revision_after="$(canvas_revision_from_snapshot)"
2604
- \\ case "$canvas_revision_after" in ''|*[!0-9]*) canvas_revision_after=0 ;; esac
2605
- \\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ] || [ "$canvas_revision_after" -gt "$canvas_revision_before" ]; then
2606
- \\ if snapshot_contains 'Keyed table #150: offset 56.' && snapshot_contains 'widget @w1/components-canvas#150 role=grid' && snapshot_contains 'scroll=[offset=56,viewport=28,content=140]'; then
2607
- \\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
2608
- \\ fi
2609
- \\ fi
2610
- \\ attempts=$((attempts + 1))
2611
- \\ sleep 0.1
2612
- \\done
2613
- \\if [ "$gpu_frame_after" -le "$gpu_frame_before" ] && [ "$canvas_revision_after" -le "$canvas_revision_before" ]; then echo "data grid automation increment did not update the retained GPU canvas" >&2; exit 1; fi
2614
- \\if ! snapshot_contains 'Keyed table #150: offset 56.' || ! snapshot_contains 'widget @w1/components-canvas#150 role=grid' || ! snapshot_contains 'scroll=[offset=56,viewport=28,content=140]'; then echo "data grid automation increment did not update retained scroll semantics" >&2; exit 1; fi
2615
- \\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "data grid automation increment did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
2616
- \\gpu_frame_before="$(gpu_frame_from_snapshot)"
2617
- \\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
2618
- \\gpu_frame_after="$gpu_frame_before"
2619
- \\canvas_revision_before="$(canvas_revision_from_snapshot)"
2620
- \\case "$canvas_revision_before" in ''|*[!0-9]*) canvas_revision_before=0 ;; esac
2621
- \\canvas_revision_after="$canvas_revision_before"
2622
- \\"$cli" automate widget-wheel components-canvas 130 20 >/dev/null 2>&1
2623
- \\attempts=0
2624
- \\while [ "$attempts" -lt 50 ]; do
2625
- \\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
2626
- \\ gpu_frame_after="$(gpu_frame_from_snapshot)"
2627
- \\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
2628
- \\ canvas_revision_after="$(canvas_revision_from_snapshot)"
2629
- \\ case "$canvas_revision_after" in ''|*[!0-9]*) canvas_revision_after=0 ;; esac
2630
- \\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ] || [ "$canvas_revision_after" -gt "$canvas_revision_before" ]; then
2631
- \\ case "$snapshot" in *'widget @w1/components-canvas#130 role=group'*'scroll=[offset=84,viewport=56,content=140]'*)
2632
- \\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
2633
- \\ ;;
2634
- \\ esac
2635
- \\ fi
2636
- \\ attempts=$((attempts + 1))
2637
- \\ sleep 0.1
2638
- \\done
2639
- \\if [ "$gpu_frame_after" -le "$gpu_frame_before" ] && [ "$canvas_revision_after" -le "$canvas_revision_before" ]; then echo "scroll automation wheel did not update the retained GPU canvas" >&2; exit 1; fi
2640
- \\case "$snapshot" in *'widget @w1/components-canvas#130 role=group'*'scroll=[offset=84,viewport=56,content=140]'*) ;; *) echo "scroll automation wheel did not update retained scroll semantics" >&2; exit 1 ;; esac
2641
- \\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "scroll automation wheel did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
2642
- \\input_timestamp="$(printf '%s\n' "$snapshot" | sed -n 's/.*view @w1\/components-canvas kind=gpu_surface.* gpu_input_timestamp_ns=\([0-9][0-9]*\).*/\1/p')"
2643
- \\case "$input_timestamp" in ''|*[!0-9]*) echo "components GPU input timestamp was missing after widget interaction" >&2; exit 1 ;; esac
2644
- \\if [ "$input_timestamp" -le 0 ]; then echo "components GPU input timestamp was not recorded" >&2; exit 1; fi
2645
- \\input_latency="$(printf '%s\n' "$snapshot" | sed -n 's/.*view @w1\/components-canvas kind=gpu_surface.* gpu_input_latency_ns=\([0-9][0-9]*\).*/\1/p')"
2646
- \\case "$input_latency" in ''|*[!0-9]*) echo "components GPU input latency was missing after widget interaction" >&2; exit 1 ;; esac
2647
- \\# gpu_input_latency now stamps at the RESPONDING present's completion
2648
- \\# (input to glass), which legitimately spans the paced render wait —
2649
- \\# up to a couple of display intervals while animations hold the paced
2650
- \\# loop. Assert an explicit input-to-glass bound (the perf harness
2651
- \\# budgets the same channel at 100 ms) instead of the one-interval
2652
- \\# budget flag the old completion-channel stamp happened to satisfy.
2653
- \\if [ "$input_latency" -le 0 ] || [ "$input_latency" -gt 100000000 ]; then echo "components GPU input-to-glass latency was implausible: $input_latency ns" >&2; exit 1; fi
2357
+ \\"$cli" automate assert 'role=treeitem name="Tree".*state=\[[^]]*selected' 'role=text name="Tree"'
2358
+ \\scroll_line="$(grep 'name="Scrollable component tree"' "$snapshot" | head -1)"
2359
+ \\case "$scroll_line" in *'scroll=[offset=0,'*) echo "tree selection did not scroll the final row into view" >&2; exit 1 ;; *'scroll=[offset='*) ;; *) echo "component tree scroll semantics were missing" >&2; exit 1 ;; esac
2360
+ \\"$cli" automate widget-key components-canvas arrowleft >/dev/null 2>&1
2361
+ \\"$cli" automate widget-key components-canvas arrowleft >/dev/null 2>&1
2362
+ \\"$cli" automate assert --absent 'role=treeitem name="Accordion"'
2363
+ \\"$cli" automate widget-key components-canvas arrowright >/dev/null 2>&1
2364
+ \\"$cli" automate assert 'role=treeitem name="Accordion"'
2365
+ \\dropdown_row_id="$(widget_id treeitem "Dropdown Menu")"
2366
+ \\case "$dropdown_row_id" in ''|*[!0-9]*) echo "dropdown navigation id was missing" >&2; exit 1 ;; esac
2367
+ \\"$cli" automate widget-action components-canvas "$dropdown_row_id" press >/dev/null 2>&1
2368
+ \\"$cli" automate assert 'role=text name="Dropdown Menu"' 'role=button name="Actions"'
2369
+ \\actions_id="$(widget_id button Actions)"
2370
+ \\case "$actions_id" in ''|*[!0-9]*) echo "dropdown trigger id was missing" >&2; exit 1 ;; esac
2371
+ \\"$cli" automate widget-click components-canvas "$actions_id" >/dev/null 2>&1
2372
+ \\"$cli" automate assert 'role=menu name=""' 'role=menuitem name="Duplicate"' 'role=menuitem name="Rename"' 'role=menuitem name="Download"' 'role=menuitem name="Delete"'
2373
+ \\"$cli" automate widget-key components-canvas arrowdown >/dev/null 2>&1
2374
+ \\"$cli" automate widget-key components-canvas arrowdown >/dev/null 2>&1
2375
+ \\"$cli" automate widget-key components-canvas enter >/dev/null 2>&1
2376
+ \\"$cli" automate assert --absent 'role=menu name=""' 'role=menuitem name="Duplicate"'
2377
+ \\"$cli" automate assert 'role=text name="Last action: Rename"'
2378
+ \\"$cli" automate widget-click components-canvas "$actions_id" >/dev/null 2>&1
2379
+ \\"$cli" automate widget-key components-canvas arrowup >/dev/null 2>&1
2380
+ \\"$cli" automate widget-key components-canvas enter >/dev/null 2>&1
2381
+ \\"$cli" automate assert 'role=text name="Last action: Delete"'
2382
+ \\select_row_id="$(widget_id treeitem Select)"
2383
+ \\case "$select_row_id" in ''|*[!0-9]*) echo "select navigation id was missing" >&2; exit 1 ;; esac
2384
+ \\"$cli" automate widget-action components-canvas "$select_row_id" press >/dev/null 2>&1
2385
+ \\"$cli" automate assert 'role=text name="Select"' 'role=button name="Environment selector"'
2386
+ \\select_id="$(widget_id button "Environment selector")"
2387
+ \\case "$select_id" in ''|*[!0-9]*) echo "select trigger id was missing" >&2; exit 1 ;; esac
2388
+ \\"$cli" automate widget-click components-canvas "$select_id" >/dev/null 2>&1
2389
+ \\"$cli" automate assert 'role=menuitem name="Production".*state=\[selected\]' 'role=menuitem name="Staging"' 'role=menuitem name="Development"'
2390
+ \\"$cli" automate widget-key components-canvas arrowdown >/dev/null 2>&1
2391
+ \\"$cli" automate widget-key components-canvas arrowdown >/dev/null 2>&1
2392
+ \\"$cli" automate widget-key components-canvas enter >/dev/null 2>&1
2393
+ \\"$cli" automate assert --absent 'role=menu name=""'
2394
+ \\"$cli" automate widget-click components-canvas "$select_id" >/dev/null 2>&1
2395
+ \\"$cli" automate assert 'role=menuitem name="Staging".*state=\[selected\]'
2396
+ \\"$cli" automate widget-key components-canvas arrowup >/dev/null 2>&1
2397
+ \\"$cli" automate widget-key components-canvas arrowup >/dev/null 2>&1
2398
+ \\"$cli" automate widget-key components-canvas enter >/dev/null 2>&1
2399
+ \\"$cli" automate widget-click components-canvas "$select_id" >/dev/null 2>&1
2400
+ \\"$cli" automate assert 'role=menuitem name="Production".*state=\[selected\]'
2401
+ \\"$cli" automate widget-key components-canvas escape >/dev/null 2>&1
2402
+ \\"$cli" automate assert --absent 'role=menu name=""'
2403
+ \\navigation_scroll_id="$(widget_id group "Scrollable component tree")"
2404
+ \\case "$navigation_scroll_id" in ''|*[!0-9]*) echo "component navigation scroll id was missing" >&2; exit 1 ;; esac
2405
+ \\"$cli" automate widget-wheel components-canvas "$navigation_scroll_id" 220 >/dev/null 2>&1
2406
+ \\switch_row_id="$(widget_id treeitem Switch)"
2407
+ \\case "$switch_row_id" in ''|*[!0-9]*) echo "switch navigation id was missing" >&2; exit 1 ;; esac
2408
+ \\"$cli" automate widget-action components-canvas "$switch_row_id" press >/dev/null 2>&1
2409
+ \\"$cli" automate assert 'role=text name="Switch"' 'role=switch name="Notifications".*value=1' 'role=switch name="Airplane mode".*value=0'
2410
+ \\airplane_id="$(widget_id switch "Airplane mode")"
2411
+ \\case "$airplane_id" in ''|*[!0-9]*) echo "airplane mode switch id was missing" >&2; exit 1 ;; esac
2412
+ \\"$cli" automate widget-click components-canvas "$airplane_id" >/dev/null 2>&1
2413
+ \\"$cli" automate assert 'role=switch name="Notifications".*value=1' 'role=switch name="Airplane mode".*value=1'
2414
+ \\"$cli" automate screenshot components-canvas >/dev/null 2>&1
2415
+ \\test -s "$automation_dir/screenshot-components-canvas.png" || { echo "component gallery screenshot was empty" >&2; exit 1; }
2654
2416
  \\echo "gpu-components smoke ok"
2655
2417
  ,
2656
2418
  "sh",
@@ -2895,19 +2657,28 @@ pub fn build(b: *std.Build) void {
2895
2657
  const notarize_step = b.step("notarize", "Package, sign with identity, and notarize for macOS distribution");
2896
2658
  notarize_step.dependOn(&notarize_run.step);
2897
2659
 
2898
- const dmg_script = b.addSystemCommand(&.{
2899
- "sh", "-c",
2900
- b.fmt(
2901
- \\APP="zig-out/package/native-sdk-{s}-macos-{s}.app"
2902
- \\DMG="zig-out/package/native-sdk-{s}-macos-{s}.dmg"
2903
- \\test -d "$APP" || {{ echo "run 'zig build package' first" >&2; exit 1; }}
2904
- \\hdiutil create -volname "native-sdk" -srcfolder "$APP" -ov -format UDZO "$DMG"
2905
- \\echo "created $DMG"
2906
- , .{ package_version, optimize_name, package_version, optimize_name }),
2660
+ // Run the same styled archive path app developers get from
2661
+ // `native package --archive`: generated/custom background, Applications
2662
+ // alias, Finder geometry, then compressed UDZO output. Keeping this as a
2663
+ // CLI invocation means the repository helper cannot drift into producing
2664
+ // a plainer image than the product surface it documents.
2665
+ const dmg_run = b.addRunArtifact(host_cli_exe);
2666
+ dmg_run.addArgs(&.{
2667
+ "package",
2668
+ "--target",
2669
+ "macos",
2670
+ "--output",
2671
+ b.fmt("zig-out/package/native-sdk-{s}-macos-{s}.app", .{ package_version, optimize_name }),
2672
+ "--binary",
2907
2673
  });
2908
- dmg_script.step.dependOn(&package_run.step);
2909
- const dmg_step = b.step("dmg", "Create macOS .dmg disk image from the packaged .app");
2910
- dmg_step.dependOn(&dmg_script.step);
2674
+ dmg_run.addFileArg(embed_lib.getEmittedBin());
2675
+ dmg_run.addArgs(&.{ "--manifest", "app.zon", "--assets", "assets", "--optimize", optimize_name, "--signing", @tagName(signing_mode), "--web-engine", @tagName(web_engine), "--cef-dir", cef_dir, "--archive" });
2676
+ if (cef_auto_install) dmg_run.addArg("--cef-auto-install");
2677
+ dmg_run.step.dependOn(&embed_lib.step);
2678
+ dmg_run.step.dependOn(&bundle_run.step);
2679
+ dmg_run.has_side_effects = true;
2680
+ const dmg_step = b.step("dmg", "Create a styled macOS .dmg with a drag-to-Applications layout");
2681
+ dmg_step.dependOn(&dmg_run.step);
2911
2682
 
2912
2683
  const cef_bundle_script = b.addSystemCommand(&.{
2913
2684
  "sh", "-c",
@@ -3163,18 +2934,18 @@ fn tsCoreE2eArtifact(
3163
2934
  const scaffold_ide_mod = module(b, target, optimize, "tests/ts-core/scaffold_ide_e2e_tests.zig");
3164
2935
  scaffold_ide_mod.addImport("tooling", tooling_mod);
3165
2936
 
3166
- // The ai-chat-ts example's core and markup, tested the same way:
2937
+ // The Chatbot example's core and markup, tested the same way:
3167
2938
  // the chat client for an OpenAI-compatible endpoint, driven through
3168
2939
  // the fake fetch feed (no network) with its shipping markup.
3169
2940
  const ai_chat_fixture = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
3170
- .entry = "examples/ai-chat-ts/src/core.ts",
3171
- .src_dir = b.path("examples/ai-chat-ts/src"),
2941
+ .entry = "examples/chatbot/src/core.ts",
2942
+ .src_dir = b.path("examples/chatbot/src"),
3172
2943
  .name = "ai_chat_core",
3173
2944
  });
3174
2945
  const ai_chat_core_mod = ai_chat_fixture.module;
3175
2946
  const ai_chat_stage = b.addWriteFiles();
3176
2947
  const ai_chat_root = ai_chat_stage.addCopyFile(b.path("tests/ts-core/ai_chat_e2e_tests.zig"), "ai_chat_e2e_tests.zig");
3177
- _ = ai_chat_stage.addCopyFile(b.path("examples/ai-chat-ts/src/app.native"), "app.native");
2948
+ _ = ai_chat_stage.addCopyFile(b.path("examples/chatbot/src/app.native"), "app.native");
3178
2949
  const ai_chat_mod = b.createModule(.{
3179
2950
  .root_source_file = ai_chat_root,
3180
2951
  .target = target,