@native-sdk/cli 0.10.0 → 0.11.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 +8 -6
- package/bin/native.js +2 -1
- package/build/app.zig +320 -60
- package/build/corewire.zig +53 -0
- package/build/test_shards.zig +49 -0
- package/build/ts_run.mjs +3 -3
- package/build.zig +1818 -87
- package/package.json +19 -14
- package/packages/core/compile-surface/core.ts +134 -72
- package/packages/core/package-lock.json +75 -357
- package/packages/core/package.json +25 -4
- package/packages/core/scripts/compiler_command.mjs +17 -12
- package/packages/core/scripts/compiler_typecheck.mjs +1 -0
- package/packages/core/scripts/gen_declarations.mjs +3 -2
- package/packages/core/scripts/gen_service_surface.mjs +22 -10
- package/packages/core/scripts/install_scriptc.mjs +182 -0
- package/packages/core/scripts/invoke_scriptc.mjs +18 -0
- package/packages/core/scripts/merge_static_archives.mjs +6 -1
- package/packages/core/scripts/npm_static_spike.mjs +2 -2
- package/packages/core/scripts/run_external_core_compiler.mjs +22 -10
- package/packages/core/scripts/run_external_service_compiler.mjs +15 -15
- package/packages/core/scripts/run_library_compiler.mjs +51 -0
- package/packages/core/scripts/run_native_tests.mjs +22 -0
- package/packages/core/scripts/scriptc-toolchain.json +101 -0
- package/packages/core/scripts/scriptc_toolchain.mjs +121 -0
- package/packages/core/scripts/stage_external_core.mjs +57 -1
- package/packages/core/scripts/surface_manifest_diff.mjs +19 -12
- package/packages/core/sdk/bytes.d.ts +2 -0
- package/packages/core/sdk/bytes.ts +86 -0
- package/packages/core/sdk/core.d.ts +308 -4
- package/packages/core/sdk/core.ts +320 -84
- package/packages/core/sdk/events.d.ts +247 -0
- package/packages/core/sdk/events.ts +230 -2
- package/packages/core/sdk/internal/image_identity.d.ts +7 -0
- package/packages/core/sdk/internal/image_identity.ts +71 -0
- package/packages/core/sdk/internal/markdown_policy.d.ts +5 -0
- package/packages/core/sdk/internal/markdown_policy.ts +878 -0
- package/packages/core/sdk/text.d.ts +27 -0
- package/packages/core/sdk/text.ts +206 -15
- package/packages/core/sdk/theme.d.ts +251 -0
- package/packages/core/sdk/theme.ts +267 -0
- package/packages/core/src/authorization.ts +137 -0
- package/packages/core/src/automation_commands.ts +201 -0
- package/packages/core/src/automation_interactions.ts +92 -0
- package/packages/core/src/bridge_descriptors.ts +104 -0
- package/packages/core/src/builtin_coordination.ts +172 -0
- package/packages/core/src/canvas_frame_coordination.ts +81 -0
- package/packages/core/src/canvas_presentation_lifecycle.ts +84 -0
- package/packages/core/src/canvas_scene_observation.ts +145 -0
- package/packages/core/src/chart_content.ts +161 -0
- package/packages/core/src/chart_plans.ts +432 -0
- package/packages/core/src/checker.ts +166 -19
- package/packages/core/src/code_content.ts +580 -0
- package/packages/core/src/command_coordination.ts +140 -0
- package/packages/core/src/component_composition.ts +94 -0
- package/packages/core/src/component_construction.ts +149 -0
- package/packages/core/src/contract.ts +25 -7
- package/packages/core/src/control_appearance.ts +232 -0
- package/packages/core/src/control_commands.ts +115 -0
- package/packages/core/src/control_content.ts +105 -0
- package/packages/core/src/control_geometry.ts +107 -0
- package/packages/core/src/control_payloads.ts +119 -0
- package/packages/core/src/control_primitives.ts +134 -0
- package/packages/core/src/devhost.ts +82 -7
- package/packages/core/src/devhost_journal.mjs +30 -7
- package/packages/core/src/effect_plans.ts +71 -0
- package/packages/core/src/flow_measurement.ts +121 -0
- package/packages/core/src/font_registry.ts +37 -0
- package/packages/core/src/glyph_atlas.ts +86 -0
- package/packages/core/src/gpu_packet_preparation.ts +130 -0
- package/packages/core/src/gpu_planning.ts +123 -0
- package/packages/core/src/gpu_presentation.ts +55 -0
- package/packages/core/src/host_flow.ts +89 -0
- package/packages/core/src/host_input_regions.ts +165 -0
- package/packages/core/src/image_registry.ts +66 -0
- package/packages/core/src/indicator_plans.ts +132 -0
- package/packages/core/src/infer.ts +150 -8
- package/packages/core/src/input_composition.ts +116 -0
- package/packages/core/src/intrinsic_measure.ts +100 -0
- package/packages/core/src/layout_coordination.ts +207 -0
- package/packages/core/src/leaf_plans.ts +134 -0
- package/packages/core/src/markup_development.ts +160 -0
- package/packages/core/src/measurement_coordination.ts +185 -0
- package/packages/core/src/modules.ts +1 -1
- package/packages/core/src/motion_sampling.ts +100 -0
- package/packages/core/src/paragraph_layout.ts +192 -0
- package/packages/core/src/portable_sources.json +74 -0
- package/packages/core/src/portable_sources.ts +17 -0
- package/packages/core/src/registered_font.ts +93 -0
- package/packages/core/src/render_animation_lifecycle.ts +128 -0
- package/packages/core/src/render_coordination.ts +170 -0
- package/packages/core/src/render_resources.ts +234 -0
- package/packages/core/src/runtime_policy.ts +3930 -0
- package/packages/core/src/scalar_text.ts +84 -0
- package/packages/core/src/service_contract.ts +2 -1
- package/packages/core/src/session_codecs.ts +309 -0
- package/packages/core/src/shell_admission.ts +126 -0
- package/packages/core/src/shell_coordination.ts +93 -0
- package/packages/core/src/sqlite_cli.ts +11 -0
- package/packages/core/src/status_validation.ts +232 -0
- package/packages/core/src/stream_policy.ts +63 -0
- package/packages/core/src/surface_recipes.ts +136 -0
- package/packages/core/src/system_admission.ts +60 -0
- package/packages/core/src/terminal_paint.ts +436 -0
- package/packages/core/src/text_document_width.ts +81 -0
- package/packages/core/src/text_measurement_cache.ts +69 -0
- package/packages/core/src/text_query_layout.ts +179 -0
- package/packages/core/src/text_run_layout.ts +410 -0
- package/packages/core/src/text_span_queries.ts +355 -0
- package/packages/core/src/typed_ast.ts +18 -1
- package/packages/core/src/types.ts +7 -5
- package/packages/core/src/vector_effects.ts +98 -0
- package/packages/core/src/vector_raster.ts +243 -0
- package/packages/core/src/view_components.ts +2415 -0
- package/packages/core/src/view_coordination.ts +198 -0
- package/packages/core/src/view_frontend.ts +980 -0
- package/packages/core/src/widget_audits.ts +202 -0
- package/packages/core/src/widget_changes.ts +258 -0
- package/packages/core/src/widget_metrics.ts +139 -0
- package/packages/core/src/widget_motion.ts +171 -0
- package/packages/core/src/widget_paint.ts +272 -0
- package/packages/core/src/widget_paint_walk.ts +203 -0
- package/packages/core/src/widget_presentation.ts +141 -0
- package/packages/core/src/widget_routing.ts +262 -0
- package/packages/core/src/window_lifecycle.ts +92 -0
- package/packages/core/testing/index.ts +430 -0
- package/schemas/app.schema.json +13 -0
- package/skill-data/core/SKILL.md +2 -2
- package/skill-data/core/references/web-engines-packaging-debugging.md +2 -1
- package/skill-data/native-ui/SKILL.md +76 -17
- package/skill-data/ts-core/SKILL.md +113 -9
- package/skill-data/ts-services/SKILL.md +1 -1
- package/skill-data/ts-services/references/service-surface.md +264 -144
- package/src/app_runner/root.zig +25 -12
- package/src/app_runner/ts_compiled_view.zig +1631 -0
- package/src/app_runner/ts_core_main.zig +143 -10
- package/src/app_runner/ts_core_mobile.zig +24 -12
- package/src/automation/server.zig +1 -3
- package/src/automation/snapshot.zig +9 -637
- package/src/automation/snapshot_reference.zig +656 -0
- package/src/automation/snapshot_serialization.zig +566 -0
- package/src/platform/linux/gtk_host.c +36 -24
- package/src/platform/linux/gtk_pixels.h +118 -0
- package/src/platform/linux/gtk_pixels_test.c +241 -0
- package/src/platform/linux/root.zig +2 -0
- package/src/platform/macos/appkit_host.m +188 -30
- package/src/platform/macos/pointer_motion_test.m +96 -0
- package/src/platform/macos/scroll_driver_test.m +105 -0
- package/src/platform/macos/spectrum_bins.h +34 -0
- package/src/platform/macos/spectrum_bins_test.c +56 -0
- package/src/platform/macos/text_keyboard_test.m +80 -0
- package/src/platform/macos/widget_focus_test.m +66 -0
- package/src/platform/null_platform.zig +26 -2
- package/src/platform/null_platform_tests.zig +13 -0
- package/src/platform/root.zig +1 -0
- package/src/platform/types.zig +13 -0
- package/src/platform/windows/root.zig +2 -0
- package/src/platform/windows/webview2_host.cpp +7 -2
- package/src/primitives/app_manifest/comptime_scene.zig +1 -1
- package/src/primitives/app_manifest/root.zig +2 -0
- package/src/primitives/app_manifest/tests.zig +4 -1
- package/src/primitives/app_manifest/validation.zig +2 -0
- package/src/primitives/canvas/a11y_audit.zig +3 -1
- package/src/primitives/canvas/canvas_frame_coordination_policy.zig +134 -0
- package/src/primitives/canvas/chart_content_policy.zig +75 -0
- package/src/primitives/canvas/chart_plan_policy.zig +196 -0
- package/src/primitives/canvas/code_content_policy.zig +162 -0
- package/src/primitives/canvas/commands.zig +29 -1
- package/src/primitives/canvas/component_composition.zig +125 -0
- package/src/primitives/canvas/component_composition_policy.zig +44 -0
- package/src/primitives/canvas/component_construction_policy.zig +187 -0
- package/src/primitives/canvas/container_layout_policy.zig +87 -0
- package/src/primitives/canvas/control_appearance_policy.zig +142 -0
- package/src/primitives/canvas/control_command_policy.zig +75 -0
- package/src/primitives/canvas/control_content_policy.zig +90 -0
- package/src/primitives/canvas/control_geometry_policy.zig +165 -0
- package/src/primitives/canvas/control_payload_policy.zig +48 -0
- package/src/primitives/canvas/control_primitive_policy.zig +129 -0
- package/src/primitives/canvas/effect_plan_policy.zig +96 -0
- package/src/primitives/canvas/events.zig +1027 -1
- package/src/primitives/canvas/flow_measurement_policy.zig +237 -0
- package/src/primitives/canvas/frame.zig +92 -23
- package/src/primitives/canvas/glyph_atlas_policy.zig +40 -0
- package/src/primitives/canvas/gpu.zig +10 -0
- package/src/primitives/canvas/gpu_packet_preparation_policy.zig +325 -0
- package/src/primitives/canvas/gpu_planning_policy.zig +364 -0
- package/src/primitives/canvas/gpu_presentation_policy.zig +74 -0
- package/src/primitives/canvas/grid_layout_policy.zig +51 -0
- package/src/primitives/canvas/indicator_plan_policy.zig +128 -0
- package/src/primitives/canvas/intrinsic_layout_policy.zig +87 -0
- package/src/primitives/canvas/intrinsic_measure_policy.zig +128 -0
- package/src/primitives/canvas/layout_audit.zig +5 -2
- package/src/primitives/canvas/layout_coordination_policy.zig +262 -0
- package/src/primitives/canvas/leaf_plan_policy.zig +117 -0
- package/src/primitives/canvas/markdown.zig +13 -3
- package/src/primitives/canvas/markdown_content_policy.zig +227 -0
- package/src/primitives/canvas/markdown_image_binding.zig +81 -0
- package/src/primitives/canvas/measurement_coordination_policy.zig +288 -0
- package/src/primitives/canvas/numeric_capabilities.zig +14 -0
- package/src/primitives/canvas/reference.zig +12 -6
- package/src/primitives/canvas/registered_font_policy.zig +152 -0
- package/src/primitives/canvas/render.zig +48 -0
- package/src/primitives/canvas/render_cache_policy.zig +184 -0
- package/src/primitives/canvas/render_coordination_policy.zig +163 -0
- package/src/primitives/canvas/render_damage_policy.zig +160 -0
- package/src/primitives/canvas/render_effects.zig +14 -0
- package/src/primitives/canvas/render_generic_resources.zig +14 -0
- package/src/primitives/canvas/render_images.zig +14 -0
- package/src/primitives/canvas/render_layers.zig +14 -0
- package/src/primitives/canvas/render_override_policy.zig +119 -0
- package/src/primitives/canvas/render_paths.zig +14 -0
- package/src/primitives/canvas/render_plan_policy.zig +199 -0
- package/src/primitives/canvas/render_resource_policy.zig +476 -0
- package/src/primitives/canvas/root.zig +100 -0
- package/src/primitives/canvas/semantic_tree_policy.zig +158 -0
- package/src/primitives/canvas/serialization.zig +8 -1
- package/src/primitives/canvas/surface_layout_policy.zig +36 -0
- package/src/primitives/canvas/surface_recipe_policy.zig +231 -0
- package/src/primitives/canvas/terminal_grid.zig +10 -696
- package/src/primitives/canvas/terminal_grid_reference.zig +709 -0
- package/src/primitives/canvas/terminal_paint_policy.zig +191 -0
- package/src/primitives/canvas/text.zig +1 -0
- package/src/primitives/canvas/text_atlas.zig +113 -0
- package/src/primitives/canvas/text_cache_policy.zig +94 -0
- package/src/primitives/canvas/text_document_policy.zig +120 -0
- package/src/primitives/canvas/text_layout.zig +51 -2
- package/src/primitives/canvas/text_layout_cache.zig +29 -0
- package/src/primitives/canvas/text_layout_hash.zig +1 -0
- package/src/primitives/canvas/text_layout_types.zig +3 -0
- package/src/primitives/canvas/text_measure_cache.zig +46 -0
- package/src/primitives/canvas/text_measurement_policy.zig +124 -0
- package/src/primitives/canvas/text_metrics.zig +23 -0
- package/src/primitives/canvas/text_query_policy.zig +156 -0
- package/src/primitives/canvas/text_run_policy.zig +252 -0
- package/src/primitives/canvas/text_scalar_policy.zig +156 -0
- package/src/primitives/canvas/text_span_query_policy.zig +232 -0
- package/src/primitives/canvas/text_spans.zig +280 -8
- package/src/primitives/canvas/text_tests.zig +10 -0
- package/src/primitives/canvas/tokens.zig +38 -0
- package/src/primitives/canvas/ui.zig +250 -83
- package/src/primitives/canvas/ui_markup.zig +139 -33
- package/src/primitives/canvas/ui_markup_compiled.zig +319 -59
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +225 -0
- package/src/primitives/canvas/ui_markup_contract.zig +146 -14
- package/src/primitives/canvas/ui_markup_contract_tests.zig +77 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +56 -0
- package/src/primitives/canvas/ui_markup_tests.zig +116 -0
- package/src/primitives/canvas/ui_markup_view.zig +258 -32
- package/src/primitives/canvas/ui_markup_view_tests.zig +142 -10
- package/src/primitives/canvas/ui_schema.zig +13 -1
- package/src/primitives/canvas/ui_schema_tests.zig +11 -7
- package/src/primitives/canvas/ui_tests.zig +1 -0
- package/src/primitives/canvas/vector.zig +36 -2
- package/src/primitives/canvas/vector_effect_policy.zig +236 -0
- package/src/primitives/canvas/vector_raster_policy.zig +190 -0
- package/src/primitives/canvas/virtual_extent_policy.zig +292 -0
- package/src/primitives/canvas/virtual_extents.zig +99 -3
- package/src/primitives/canvas/virtual_flow_policy.zig +108 -0
- package/src/primitives/canvas/widget_audit_policy.zig +293 -0
- package/src/primitives/canvas/widget_change_policy.zig +298 -0
- package/src/primitives/canvas/widget_invalidation.zig +113 -2
- package/src/primitives/canvas/widget_layout.zig +673 -128
- package/src/primitives/canvas/widget_layout_tests.zig +4 -0
- package/src/primitives/canvas/widget_metric_policy.zig +126 -0
- package/src/primitives/canvas/widget_metrics.zig +45 -6
- package/src/primitives/canvas/widget_paint_policy.zig +166 -0
- package/src/primitives/canvas/widget_paint_walk_policy.zig +252 -0
- package/src/primitives/canvas/widget_presentation_policy.zig +168 -0
- package/src/primitives/canvas/widget_render.zig +744 -74
- package/src/primitives/canvas/widget_render_controls.zig +1217 -133
- package/src/primitives/canvas/widget_render_scroll.zig +11 -3
- package/src/primitives/canvas/widget_render_style.zig +94 -0
- package/src/primitives/canvas/widget_render_surfaces.zig +61 -50
- package/src/primitives/canvas/widget_routing.zig +75 -0
- package/src/primitives/canvas/widget_routing_policy.zig +135 -0
- package/src/primitives/canvas/widget_runtime.zig +20 -1
- package/src/primitives/canvas/widget_semantics.zig +25 -0
- package/src/primitives/canvas/widget_text_input.zig +86 -23
- package/src/primitives/canvas/widget_text_select.zig +1 -0
- package/src/primitives/canvas/widget_tree.zig +8 -1
- package/src/primitives/canvas/widgets.zig +42 -12
- package/src/primitives/canvas/wrapped_layout_policy.zig +104 -0
- package/src/root.zig +21 -0
- package/src/runtime/accessibility_policy.zig +122 -0
- package/src/runtime/api.zig +28 -0
- package/src/runtime/app_dispatch_policy.zig +68 -0
- package/src/runtime/authorization_policy.zig +150 -0
- package/src/runtime/automation_command_policy.zig +241 -0
- package/src/runtime/automation_interaction_policy.zig +107 -0
- package/src/runtime/automation_snapshot.zig +52 -22
- package/src/runtime/automation_snapshot_reference.zig +290 -0
- package/src/runtime/automation_widget_dispatch.zig +267 -355
- package/src/runtime/automation_widget_dispatch_reference.zig +900 -0
- package/src/runtime/blob_policy.zig +58 -0
- package/src/runtime/blob_reference.zig +64 -0
- package/src/runtime/bridge_descriptor_policy.zig +206 -0
- package/src/runtime/builtin_bridge.zig +180 -44
- package/src/runtime/builtin_coordination_policy.zig +121 -0
- package/src/runtime/callback_policy_test_reference.zig +97 -0
- package/src/runtime/canvas_drag_policy.zig +94 -0
- package/src/runtime/canvas_fonts.zig +38 -10
- package/src/runtime/canvas_frame.zig +590 -134
- package/src/runtime/canvas_frame_helpers.zig +1 -0
- package/src/runtime/canvas_hover_policy.zig +131 -0
- package/src/runtime/canvas_images.zig +59 -30
- package/src/runtime/canvas_keyboard_focus_policy.zig +154 -0
- package/src/runtime/canvas_limits.zig +1 -1
- package/src/runtime/canvas_presentation_lifecycle_policy.zig +86 -0
- package/src/runtime/canvas_scene_observation_policy.zig +181 -0
- package/src/runtime/canvas_widget_context_menu.zig +4 -4
- package/src/runtime/canvas_widget_display.zig +110 -9
- package/src/runtime/canvas_widget_events.zig +718 -328
- package/src/runtime/canvas_widget_runtime.zig +437 -81
- package/src/runtime/canvas_widget_scroll_drivers.zig +39 -1
- package/src/runtime/canvas_widget_scroll_tests.zig +31 -0
- package/src/runtime/canvas_widget_state.zig +93 -56
- package/src/runtime/channel_sources.zig +80 -0
- package/src/runtime/command_policy.zig +161 -0
- package/src/runtime/component_policy.zig +83 -0
- package/src/runtime/core.zig +156 -6
- package/src/runtime/desktop_files.zig +189 -0
- package/src/runtime/effects.zig +466 -29
- package/src/runtime/effects_tests.zig +28 -0
- package/src/runtime/file_policy_test_reference.zig +113 -0
- package/src/runtime/flow.zig +418 -341
- package/src/runtime/flow_reference.zig +1426 -0
- package/src/runtime/font_registry_policy.zig +72 -0
- package/src/runtime/frame_profile.zig +24 -33
- package/src/runtime/gpu_surface_events.zig +97 -35
- package/src/runtime/host_event_pump.zig +303 -0
- package/src/runtime/host_event_pump_reference.zig +268 -0
- package/src/runtime/host_flow_policy.zig +155 -0
- package/src/runtime/host_input_regions_policy.zig +156 -0
- package/src/runtime/image_registry_policy.zig +94 -0
- package/src/runtime/input_composition_policy.zig +138 -0
- package/src/runtime/journal_policy.zig +66 -0
- package/src/runtime/journal_reference.zig +53 -0
- package/src/runtime/lifecycle_policy_test_reference.zig +97 -0
- package/src/runtime/markup_development_policy.zig +91 -0
- package/src/runtime/media_surface.zig +40 -1
- package/src/runtime/motion_sampling_policy.zig +159 -0
- package/src/runtime/recording_policy.zig +42 -0
- package/src/runtime/render_animation_policy.zig +206 -0
- package/src/runtime/replay_policy.zig +66 -0
- package/src/runtime/replay_policy_reference.zig +326 -0
- package/src/runtime/replay_progress_policy.zig +64 -0
- package/src/runtime/replay_progress_reference.zig +34 -0
- package/src/runtime/request_policy_test_reference.zig +188 -0
- package/src/runtime/root.zig +13 -0
- package/src/runtime/session_blobs.zig +157 -58
- package/src/runtime/session_blobs_reference.zig +692 -0
- package/src/runtime/session_codec.zig +361 -0
- package/src/runtime/session_codec_reference.zig +1027 -0
- package/src/runtime/session_journal.zig +246 -983
- package/src/runtime/session_record.zig +224 -45
- package/src/runtime/session_replay.zig +157 -415
- package/src/runtime/session_tests.zig +552 -0
- package/src/runtime/shell_admission_policy.zig +225 -0
- package/src/runtime/shell_coordination_policy.zig +138 -0
- package/src/runtime/shell_layout.zig +126 -1
- package/src/runtime/snapshot_policy.zig +60 -0
- package/src/runtime/snapshot_reference.zig +64 -0
- package/src/runtime/state.zig +16 -0
- package/src/runtime/status_validation.zig +190 -0
- package/src/runtime/system_admission_policy.zig +140 -0
- package/src/runtime/system_services.zig +46 -36
- package/src/runtime/tests.zig +1 -0
- package/src/runtime/ts_canvas_hooks.zig +261 -0
- package/src/runtime/ts_canvas_hooks_tests.zig +279 -0
- package/src/runtime/ts_canvas_icons.zig +234 -0
- package/src/runtime/ts_core_host.zig +2325 -411
- package/src/runtime/ts_core_host_tests.zig +1982 -0
- package/src/runtime/ts_test_host.zig +699 -0
- package/src/runtime/ts_ui_app.zig +1087 -45
- package/src/runtime/ui_app.zig +1117 -629
- package/src/runtime/ui_app_provenance.zig +147 -5
- package/src/runtime/ui_app_provenance_reference.zig +370 -0
- package/src/runtime/ui_app_tests.zig +619 -9
- package/src/runtime/ui_app_window_tests.zig +89 -0
- package/src/runtime/view.zig +25 -0
- package/src/runtime/view_canvas.zig +30 -6
- package/src/runtime/view_coordination_policy.zig +147 -0
- package/src/runtime/view_widget_control.zig +51 -14
- package/src/runtime/view_widget_scroll.zig +16 -5
- package/src/runtime/view_widget_text.zig +153 -68
- package/src/runtime/view_widget_tree.zig +460 -56
- package/src/runtime/webview_view_bridge_tests.zig +2 -0
- package/src/runtime/widget_motion_policy.zig +238 -0
- package/src/runtime/window_command_bridge_tests.zig +63 -0
- package/src/runtime/window_lifecycle_policy.zig +127 -0
- package/src/runtime/window_storage.zig +74 -8
- package/src/runtime/window_view_runtime.zig +148 -33
- package/src/runtime/window_views.zig +163 -10
- package/src/tooling/codesign.zig +125 -74
- package/src/tooling/components/identity_tests.zig +62 -36
- package/src/tooling/components/stepper.native +24 -0
- package/src/tooling/components/stepper.zig +0 -19
- package/src/tooling/components/timeline-item.native +22 -0
- package/src/tooling/components/timeline.native +5 -3
- package/src/tooling/components/timeline_item.zig +0 -32
- package/src/tooling/eject_components.zig +76 -8
- package/src/tooling/ios.zig +66 -12
- package/src/tooling/manifest.zig +35 -0
- package/src/tooling/package.zig +85 -1
- package/src/tooling/raw_manifest.zig +6 -0
- package/src/tooling/templates.zig +15 -3
- package/src/tooling/ts_core.zig +13 -3
- package/src/tooling/verbs.zig +22 -0
- package/tools/corewire/build_profile.mjs +54 -0
- package/tools/corewire/contract_intake.ts +303 -0
- package/tools/corewire/contract_intake.zig +82 -0
- package/tools/corewire/core.test.ts +166 -0
- package/tools/corewire/core_abi.zig +51 -0
- package/tools/corewire/core_cases.ts +233 -0
- package/tools/corewire/core_contract.ts +407 -0
- package/tools/corewire/core_emission.ts +136 -0
- package/tools/corewire/core_emission.zig +69 -0
- package/tools/corewire/core_goldens.json +3110 -0
- package/tools/corewire/core_policy.ts +14 -0
- package/tools/corewire/core_policy.zig +48 -0
- package/tools/corewire/core_projection.ts +360 -0
- package/tools/corewire/core_vocabulary.ts +6 -0
- package/tools/corewire/emit.zig +19 -1590
- package/tools/corewire/emit_facade.ts +714 -0
- package/tools/corewire/emit_facade.zig +10 -3752
- package/tools/corewire/emit_mirror.ts +290 -0
- package/tools/corewire/emit_profile.ts +50 -0
- package/tools/corewire/emit_service.ts +331 -0
- package/tools/corewire/emit_service.zig +23 -842
- package/tools/corewire/entry.test.ts +95 -0
- package/tools/corewire/entry_coordination.ts +127 -0
- package/tools/corewire/entry_coordination.zig +190 -0
- package/tools/corewire/facade_templates.ts +85 -0
- package/tools/corewire/filesystem.test.ts +166 -0
- package/tools/corewire/filesystem_coordination.ts +213 -0
- package/tools/corewire/filesystem_coordination.zig +245 -0
- package/tools/corewire/intake.test.ts +35 -0
- package/tools/corewire/intake_cases.ts +55 -0
- package/tools/corewire/intake_goldens.json +12237 -0
- package/tools/corewire/invocation.test.ts +24 -0
- package/tools/corewire/invocation.ts +175 -0
- package/tools/corewire/invocation.zig +136 -0
- package/tools/corewire/invocation_cases.ts +60 -0
- package/tools/corewire/invocation_fixture.ts +33 -0
- package/tools/corewire/invocation_goldens.json +1143 -0
- package/tools/corewire/invocation_tests.zig +111 -0
- package/tools/corewire/invocation_usage.ts +2 -0
- package/tools/corewire/lossless_projection.ts +96 -0
- package/tools/corewire/main.zig +7 -680
- package/tools/corewire/main_reference.zig +415 -0
- package/tools/corewire/mirror_templates.ts +55 -0
- package/tools/corewire/profile.test.ts +248 -0
- package/tools/corewire/profile.zig +56 -0
- package/tools/corewire/profile_emission.ts +202 -0
- package/tools/corewire/profile_library.json +29 -0
- package/tools/corewire/profile_tests.zig +136 -0
- package/tools/corewire/service.test.ts +75 -0
- package/tools/corewire/service_cases.ts +61 -0
- package/tools/corewire/service_contract.zig +40 -146
- package/tools/corewire/service_goldens.json +650 -0
- package/tools/corewire/service_projection.zig +52 -0
- package/tools/corewire/service_templates.ts +14 -0
- package/tools/corewire/shim_rt.zig +9 -0
- package/tools/corewire/sidecar.zig +267 -1438
- package/tools/corewire/emit_profile.zig +0 -521
package/src/runtime/flow.zig
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
const builtin_coordination = @import("builtin_coordination_policy.zig");
|
|
2
|
+
const authorization = @import("authorization_policy.zig");
|
|
1
3
|
const std = @import("std");
|
|
2
4
|
const geometry = @import("geometry");
|
|
3
5
|
const trace = @import("trace");
|
|
4
6
|
const json = @import("json");
|
|
5
7
|
const validation = @import("validation.zig");
|
|
8
|
+
const command_policy = @import("command_policy.zig");
|
|
6
9
|
const runtime_api = @import("api.zig");
|
|
7
10
|
const runtime_async_bridge = @import("async_bridge.zig");
|
|
8
11
|
const runtime_automation_snapshot = @import("automation_snapshot.zig");
|
|
9
12
|
const runtime_automation_widget_dispatch = @import("automation_widget_dispatch.zig");
|
|
10
|
-
const automation_commands = @import("
|
|
13
|
+
const automation_commands = @import("automation_command_policy.zig");
|
|
11
14
|
const launch_timing = @import("launch_timing.zig");
|
|
12
15
|
const runtime_clock = @import("clock.zig");
|
|
13
16
|
const runtime_state = @import("state.zig");
|
|
@@ -25,6 +28,9 @@ const bridge = @import("../bridge/root.zig");
|
|
|
25
28
|
const extensions = @import("../extensions/root.zig");
|
|
26
29
|
const app_manifest = @import("app_manifest");
|
|
27
30
|
const platform = @import("../platform/root.zig");
|
|
31
|
+
const host_flow = @import("host_flow_policy.zig");
|
|
32
|
+
const native_reference = @import("flow_reference.zig");
|
|
33
|
+
const HostEventPump = @import("host_event_pump.zig").HostEventPump;
|
|
28
34
|
const security = @import("../security/root.zig");
|
|
29
35
|
|
|
30
36
|
const validateCommandName = validation.validateCommandName;
|
|
@@ -59,6 +65,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
59
65
|
const RunContext = struct {
|
|
60
66
|
runtime: *Runtime,
|
|
61
67
|
app: App,
|
|
68
|
+
host_events: HostEventPump,
|
|
62
69
|
};
|
|
63
70
|
|
|
64
71
|
fn WindowViewMethods() type {
|
|
@@ -90,6 +97,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
pub fn run(self: *Runtime, app: App) anyerror!void {
|
|
100
|
+
const policy = app.host_flow_policy orelse return native_reference.RuntimeFlow(Runtime).run(self, app);
|
|
93
101
|
var init_fields: [3]trace.Field = undefined;
|
|
94
102
|
init_fields[0] = trace.string("app", app.name);
|
|
95
103
|
init_fields[1] = trace.string("platform", self.options.platform.name);
|
|
@@ -99,81 +107,58 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
99
107
|
init_field_count += 1;
|
|
100
108
|
}
|
|
101
109
|
log(self, "runtime.init", "runtime initialized", init_fields[0..init_field_count]);
|
|
102
|
-
try app_manifest.validateCommands(self.options.commands);
|
|
103
|
-
try self.options.platform.services.configureSecurityPolicy(self.options.security);
|
|
104
|
-
try self.options.platform.services.configureMenus(self.options.menus);
|
|
105
|
-
try self.options.platform.services.configureShortcuts(self.options.shortcuts);
|
|
106
|
-
// Automation liveness: the drain (`consumeAutomationCommand`,
|
|
107
|
-
// in `frame` below) runs at most once per frame_requested
|
|
108
|
-
// turn, and an idle app produces no frames — so a queued
|
|
109
|
-
// command must WAKE the loop the way user input does. The
|
|
110
|
-
// arrival watcher polls the dropbox slot on its own thread
|
|
111
|
-
// and asks the platform for one coalesced frame tick through
|
|
112
|
-
// its thread-safe `request_frame_fn` whenever a command is
|
|
113
|
-
// pending. Consumption itself stays on the frame boundary,
|
|
114
|
-
// so command order, one-command-per-frame, and session
|
|
115
|
-
// recording/replay (commands nest inside recorded
|
|
116
|
-
// frame_requested events) are unchanged; only the frame's
|
|
117
|
-
// ARRIVAL time moves. No automation server (any non-dev
|
|
118
|
-
// build) means no thread and no polls at all.
|
|
119
110
|
var command_watcher: automation.Watcher = undefined;
|
|
120
111
|
var command_watcher_running = false;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
112
|
+
var cleanup_armed = false;
|
|
113
|
+
var context: RunContext = .{ .runtime = self, .app = app, .host_events = .{ .allocator = self.owned_allocator, .policy = policy } };
|
|
114
|
+
defer if (cleanup_armed) {
|
|
115
|
+
const cleanup = host_flow.plan(policy, .cleanup, .{ .a = @intFromBool(self.app_stop_delivered), .b = @intFromBool(command_watcher_running) });
|
|
116
|
+
for (cleanup) |action| switch (action) {
|
|
117
|
+
0 => break,
|
|
118
|
+
1 => context.host_events.deinit(),
|
|
119
|
+
2 => {
|
|
120
|
+
self.app_stop_delivered = true;
|
|
121
|
+
app.stop(self) catch |err| log(self, "app.stop.failed", @errorName(err), &.{trace.string("app", app.name)});
|
|
122
|
+
},
|
|
123
|
+
3 => self.disarmMediaSurfaceWakes(),
|
|
124
|
+
4 => command_watcher.stop(),
|
|
125
|
+
else => unreachable,
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const program = host_flow.plan(policy, .run, .{});
|
|
129
|
+
for (program) |action| switch (action) {
|
|
130
|
+
0 => break,
|
|
131
|
+
1 => if (app.command_policy) |commands| try command_policy.catalog(commands, self.options.commands) else try app_manifest.validateCommands(self.options.commands),
|
|
132
|
+
2 => try self.options.platform.services.configureSecurityPolicy(self.options.security),
|
|
133
|
+
3 => try self.options.platform.services.configureMenus(self.options.menus),
|
|
134
|
+
4 => try self.options.platform.services.configureShortcuts(self.options.shortcuts),
|
|
135
|
+
5 => {
|
|
136
|
+
const watcher_admission = host_flow.gate(policy, 4, @intFromBool(self.options.automation != null), @intFromBool(self.options.platform.services.request_frame_fn != null));
|
|
137
|
+
if (watcher_admission != 0) {
|
|
138
|
+
const server = self.options.automation.?;
|
|
139
|
+
if (watcher_admission == 1) {
|
|
140
|
+
const request_fn = self.options.platform.services.request_frame_fn.?;
|
|
141
|
+
command_watcher_running = command_watcher.start(server, .{
|
|
142
|
+
.context = self.options.platform.services.context,
|
|
143
|
+
.request_fn = request_fn,
|
|
144
|
+
});
|
|
145
|
+
if (host_flow.gate(policy, 5, @intFromBool(command_watcher_running), 0) != 0) {
|
|
146
|
+
log(self, "automation.watcher_failed", "automation command watcher thread did not start; commands drain on the next unrelated frame", &.{});
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
// A platform without the cross-thread frame request
|
|
150
|
+
// keeps the old behavior (commands drain on whatever
|
|
151
|
+
// frame arrives next); say so once instead of wedging
|
|
152
|
+
// silently.
|
|
153
|
+
log(self, "automation.watcher_unsupported", "platform has no cross-thread frame request; automation commands drain on the next unrelated frame", &.{});
|
|
154
|
+
}
|
|
129
155
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
log(self, "automation.watcher_unsupported", "platform has no cross-thread frame request; automation commands drain on the next unrelated frame", &.{});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
// Stopped (joined) before the platform loop's resources go
|
|
139
|
-
// away, so the watcher can never call into a dead host.
|
|
140
|
-
defer if (command_watcher_running) command_watcher.stop();
|
|
141
|
-
|
|
142
|
-
// Media-surface wake teardown: producers a slow app forgot
|
|
143
|
-
// to release may push (and try to wake this platform) at
|
|
144
|
-
// any later time from their own threads. Disarm their wake
|
|
145
|
-
// bindings before the caller's later-declared defers tear
|
|
146
|
-
// the host down — declared BEFORE the app-stop defer below
|
|
147
|
-
// so it runs AFTER the stop hook (LIFO), letting the hook
|
|
148
|
-
// join producer threads first. The same run-exit ordering
|
|
149
|
-
// that stops the automation arrival watcher.
|
|
150
|
-
defer self.disarmMediaSurfaceWakes();
|
|
151
|
-
|
|
152
|
-
// Teardown ordering contract: everything the app must do
|
|
153
|
-
// against the live platform — silencing an active audio
|
|
154
|
-
// player, disarming platform timers, joining effect workers
|
|
155
|
-
// that post through the platform's wake service — happens in
|
|
156
|
-
// the app's stop hook, and that hook is guaranteed to run
|
|
157
|
-
// before run() returns. The app's OWN deinit cannot serve
|
|
158
|
-
// this purpose: it is typically a `defer` in main that runs
|
|
159
|
-
// only after the runner's later-declared defers have already
|
|
160
|
-
// destroyed the platform host and freed the runtime, so any
|
|
161
|
-
// platform service call from there dereferences freed memory
|
|
162
|
-
// (the quit-while-audio-plays use-after-free). The platform's
|
|
163
|
-
// `.app_shutdown` event delivers the stop hook on the normal
|
|
164
|
-
// quit path; this defer delivers it when the loop exits any
|
|
165
|
-
// other way (an error unwind, a host that stops without a
|
|
166
|
-
// shutdown event) — exactly once either way, gated by
|
|
167
|
-
// `app_stop_delivered`.
|
|
168
|
-
defer if (!self.app_stop_delivered) {
|
|
169
|
-
self.app_stop_delivered = true;
|
|
170
|
-
app.stop(self) catch |err| log(self, "app.stop.failed", @errorName(err), &.{trace.string("app", app.name)});
|
|
156
|
+
cleanup_armed = true;
|
|
157
|
+
},
|
|
158
|
+
6 => try self.options.platform.run(handlePlatformEvent, &context),
|
|
159
|
+
7 => log(self, "runtime.done", "runtime finished", &.{}),
|
|
160
|
+
else => unreachable,
|
|
171
161
|
};
|
|
172
|
-
|
|
173
|
-
var context: RunContext = .{ .runtime = self, .app = app };
|
|
174
|
-
try self.options.platform.run(handlePlatformEvent, &context);
|
|
175
|
-
|
|
176
|
-
log(self, "runtime.done", "runtime finished", &.{});
|
|
177
162
|
}
|
|
178
163
|
|
|
179
164
|
fn reservePrimaryStartupWindow(self: *Runtime) anyerror!void {
|
|
@@ -202,93 +187,139 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
202
187
|
}
|
|
203
188
|
|
|
204
189
|
pub fn dispatchPlatformEvent(self: *Runtime, app: App, event_value: platform.Event) anyerror!void {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
recorder.commitEvent();
|
|
214
|
-
if (recorder.wantsCheckpoint(self.frame_index)) {
|
|
215
|
-
recorder.recordCheckpoint(self.frame_index, self.sessionStateFingerprint());
|
|
216
|
-
}
|
|
217
|
-
// Seal on shutdown, here rather than only at run() exit:
|
|
218
|
-
// a host that terminates without unwinding the platform
|
|
219
|
-
// loop still leaves a whole journal behind.
|
|
220
|
-
if (event_value == .app_shutdown) recorder.finish();
|
|
190
|
+
const policy = app.host_flow_policy orelse return native_reference.RuntimeFlow(Runtime).dispatchPlatformEvent(self, app, event_value);
|
|
191
|
+
const kind = host_flow.eventKind(event_value);
|
|
192
|
+
const entry = host_flow.plan(policy, .journal_enter, .{ .kind = kind, .a = @intFromBool(self.options.session_recorder != null), .b = @intFromBool(self.invalidated) });
|
|
193
|
+
for (entry) |action| switch (action) {
|
|
194
|
+
0 => break,
|
|
195
|
+
1 => self.options.session_recorder.?.stageEvent(event_value),
|
|
196
|
+
2 => log(self, "platform.event", null, &.{trace.string("event", event_value.name())}),
|
|
197
|
+
else => unreachable,
|
|
221
198
|
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
199
|
+
defer {
|
|
200
|
+
const exit = host_flow.plan(policy, .journal_exit, .{ .kind = kind, .a = @intFromBool(self.options.session_recorder != null) });
|
|
201
|
+
for (exit) |action| switch (action) {
|
|
202
|
+
0 => break,
|
|
203
|
+
1 => self.options.session_recorder.?.commitEvent(),
|
|
204
|
+
2 => {
|
|
205
|
+
const recorder = self.options.session_recorder.?;
|
|
206
|
+
if (recorder.wantsCheckpoint(self.frame_index)) recorder.recordCheckpoint(self.frame_index, self.sessionStateFingerprint());
|
|
207
|
+
},
|
|
208
|
+
3 => self.options.session_recorder.?.finish(),
|
|
209
|
+
else => unreachable,
|
|
210
|
+
};
|
|
226
211
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
212
|
+
errdefer |err| if (host_flow.gate(policy, 9, kind, 0) != 0) recordDispatchError(self, "app_start", err);
|
|
213
|
+
const program = host_flow.plan(policy, .platform_event, .{ .kind = kind });
|
|
214
|
+
var scene_value: ?app_manifest.ShellConfig = null;
|
|
215
|
+
var was_open = false;
|
|
216
|
+
var routed_drop: ?runtime_api.CanvasWidgetFileDropEvent = null;
|
|
217
|
+
for (program) |byte| switch (@as(host_flow.Action, @enumFromInt(byte))) {
|
|
218
|
+
.end => break,
|
|
219
|
+
.install => {
|
|
220
|
+
self.shell_layout_policy = app.shell_layout_policy;
|
|
221
|
+
self.view_coordination_policy = app.view_coordination_policy;
|
|
222
|
+
self.window_lifecycle_policy = app.window_lifecycle_policy;
|
|
223
|
+
self.image_registry_policy = app.image_registry_policy;
|
|
224
|
+
self.font_registry_policy = app.font_registry_policy;
|
|
225
|
+
self.shell_coordination_policy = app.shell_coordination_policy;
|
|
226
|
+
self.shell_admission_policy = app.shell_admission_policy;
|
|
227
|
+
self.system_admission_policy = app.system_admission_policy;
|
|
228
|
+
self.bridge_descriptor_policy = app.bridge_descriptor_policy;
|
|
229
|
+
self.authorization_policy = app.authorization_policy;
|
|
230
|
+
self.builtin_coordination_policy = app.builtin_coordination_policy;
|
|
231
|
+
self.automation_command_policy = app.automation_command_policy;
|
|
232
|
+
self.automation_interaction_policy = app.automation_interaction_policy;
|
|
233
|
+
self.snapshot_policy = app.snapshot_policy;
|
|
234
|
+
self.frame_profile.policy = app.snapshot_policy;
|
|
235
|
+
self.command_policy = app.command_policy;
|
|
236
|
+
self.text_cache_policy = app.text_cache_policy;
|
|
237
|
+
self.render_cache_policy = app.render_cache_policy;
|
|
238
|
+
self.render_plan_policy = app.render_plan_policy;
|
|
239
|
+
self.render_override_policy = app.render_override_policy;
|
|
240
|
+
self.render_damage_policy = app.render_damage_policy;
|
|
241
|
+
self.host_flow_policy = app.host_flow_policy;
|
|
242
|
+
},
|
|
243
|
+
.lap_start => {
|
|
236
244
|
launch_timing.lap("app_start");
|
|
245
|
+
},
|
|
246
|
+
.reserve => {
|
|
237
247
|
try reservePrimaryStartupWindow(self);
|
|
248
|
+
},
|
|
249
|
+
.start => {
|
|
238
250
|
try app.start(self);
|
|
251
|
+
},
|
|
252
|
+
.extensions_start => {
|
|
239
253
|
if (self.options.extensions) |registry| try registry.startAll(extensionContext(self));
|
|
254
|
+
},
|
|
255
|
+
.lifecycle_start => {
|
|
240
256
|
try dispatchEvent(self, app, .{ .lifecycle = .start });
|
|
257
|
+
},
|
|
258
|
+
.lap_started => {
|
|
241
259
|
launch_timing.lap("app_started");
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
260
|
+
},
|
|
261
|
+
.scene => {
|
|
262
|
+
scene_value = try app.scene();
|
|
263
|
+
},
|
|
264
|
+
.load => {
|
|
265
|
+
if (host_flow.gate(policy, 8, @intFromBool(scene_value != null), 0) != 0) try loadScene(self, app, scene_value.?) else try loadStartupWindows(self, app);
|
|
266
|
+
},
|
|
267
|
+
.lap_loaded => {
|
|
247
268
|
launch_timing.lap("scene_loaded");
|
|
269
|
+
},
|
|
270
|
+
.startup_dirty => {
|
|
248
271
|
self.invalidateFor(.startup, null);
|
|
272
|
+
},
|
|
273
|
+
.start_log => {
|
|
249
274
|
log(self, "app.start", "app started", &.{trace.string("app", app.name)});
|
|
250
275
|
},
|
|
251
|
-
.
|
|
276
|
+
.activate => {
|
|
252
277
|
try WindowViewMethods().setAppActive(self, true);
|
|
253
|
-
try dispatchEvent(self, app, .{ .lifecycle = .activate });
|
|
254
|
-
emitAppLifecycleEvent(self, "app:activate") catch |err| log(self, "app.activate.emit_failed", @errorName(err), &.{});
|
|
255
278
|
},
|
|
256
|
-
.
|
|
257
|
-
// The app-active register flips FIRST — before the
|
|
258
|
-
// tooltip reset and before the app hears the
|
|
259
|
-
// lifecycle event — so a model that rebuilds FROM
|
|
260
|
-
// its deactivation callback adopts under a runtime
|
|
261
|
-
// that already knows the app is inactive: the
|
|
262
|
-
// adoption arm's reveal/arm paths are gated on this
|
|
263
|
-
// register and stay silent.
|
|
279
|
+
.deactivate => {
|
|
264
280
|
try WindowViewMethods().setAppActive(self, false);
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
// the app hears the lifecycle event, so a model that
|
|
268
|
-
// rebuilds on deactivate adopts against clean
|
|
269
|
-
// tooltip state instead of a stale shown slot.
|
|
281
|
+
},
|
|
282
|
+
.tooltip_reset => {
|
|
270
283
|
try CanvasWidgetEventMethods().resetCanvasTooltipIntentForAppDeactivation(self);
|
|
284
|
+
},
|
|
285
|
+
.lifecycle_activate => {
|
|
286
|
+
try dispatchEvent(self, app, .{ .lifecycle = .activate });
|
|
287
|
+
},
|
|
288
|
+
.lifecycle_deactivate => {
|
|
271
289
|
try dispatchEvent(self, app, .{ .lifecycle = .deactivate });
|
|
290
|
+
},
|
|
291
|
+
.emit_activate => {
|
|
292
|
+
emitAppLifecycleEvent(self, "app:activate") catch |err| log(self, "app.activate.emit_failed", @errorName(err), &.{});
|
|
293
|
+
},
|
|
294
|
+
.emit_deactivate => {
|
|
272
295
|
emitAppLifecycleEvent(self, "app:deactivate") catch |err| log(self, "app.deactivate.emit_failed", @errorName(err), &.{});
|
|
273
296
|
},
|
|
274
|
-
.
|
|
275
|
-
self.appearance =
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
// advance batches and retained wrap results must miss
|
|
279
|
-
// rather than serve metrics measured under the
|
|
280
|
-
// previous appearance.
|
|
297
|
+
.appearance => {
|
|
298
|
+
self.appearance = event_value.appearance_changed;
|
|
299
|
+
},
|
|
300
|
+
.text_generation => {
|
|
281
301
|
canvas.bumpTextMeasureGeneration();
|
|
282
|
-
try dispatchEvent(self, app, .{ .appearance_changed = appearance });
|
|
283
302
|
},
|
|
284
|
-
.
|
|
285
|
-
self.
|
|
303
|
+
.appearance_event => {
|
|
304
|
+
try dispatchEvent(self, app, .{ .appearance_changed = event_value.appearance_changed });
|
|
305
|
+
},
|
|
306
|
+
.surface => {
|
|
307
|
+
self.surface = event_value.surface_resized;
|
|
308
|
+
},
|
|
309
|
+
.surface_window => {
|
|
310
|
+
const surface_value = event_value.surface_resized;
|
|
286
311
|
if (WindowViewMethods().findWindowIndexById(self, surface_value.id)) |index| {
|
|
287
312
|
self.windows[index].info.frame.width = surface_value.size.width;
|
|
288
313
|
self.windows[index].info.frame.height = surface_value.size.height;
|
|
289
314
|
self.windows[index].info.scale_factor = surface_value.scale_factor;
|
|
290
315
|
}
|
|
316
|
+
},
|
|
317
|
+
.surface_layout => {
|
|
318
|
+
const surface_value = event_value.surface_resized;
|
|
291
319
|
WindowViewMethods().relayoutShellViews(self, surface_value.id) catch |err| log(self, "shell.relayout_failed", @errorName(err), &.{trace.uint("window_id", surface_value.id)});
|
|
320
|
+
},
|
|
321
|
+
.surface_emit => {
|
|
322
|
+
const surface_value = event_value.surface_resized;
|
|
292
323
|
var detail_buffer: [512]u8 = undefined;
|
|
293
324
|
var detail_writer = std.Io.Writer.fixed(&detail_buffer);
|
|
294
325
|
try detail_writer.print("{{\"width\":{d},\"height\":{d},\"scale\":{d},\"safeAreaInsets\":{{\"top\":{d},\"right\":{d},\"bottom\":{d},\"left\":{d}}},\"keyboardInsets\":{{\"top\":{d},\"right\":{d},\"bottom\":{d},\"left\":{d}}}}}", .{
|
|
@@ -305,7 +336,12 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
305
336
|
surface_value.keyboard_insets.left,
|
|
306
337
|
});
|
|
307
338
|
emitWindowEvent(self, surface_value.id, "resize", detail_writer.buffered()) catch |err| log(self, "window.resize.emit_failed", @errorName(err), &.{});
|
|
308
|
-
|
|
339
|
+
},
|
|
340
|
+
.surface_dirty => {
|
|
341
|
+
self.invalidateFor(.surface_resize, geometry.RectF.fromSize(event_value.surface_resized.size));
|
|
342
|
+
},
|
|
343
|
+
.surface_log => {
|
|
344
|
+
const surface_value = event_value.surface_resized;
|
|
309
345
|
const fields = [_]trace.Field{
|
|
310
346
|
trace.float("width", surface_value.size.width),
|
|
311
347
|
trace.float("height", surface_value.size.height),
|
|
@@ -313,18 +349,26 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
313
349
|
};
|
|
314
350
|
log(self, "surface.resize", "surface updated", &fields);
|
|
315
351
|
},
|
|
316
|
-
.
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
const was_open = if (WindowViewMethods().findWindowIndexById(self, state.id)) |index| self.windows[index].info.open else false;
|
|
352
|
+
.capture_open => {
|
|
353
|
+
const state = event_value.window_frame_changed;
|
|
354
|
+
was_open = if (WindowViewMethods().findWindowIndexById(self, state.id)) |index| self.windows[index].info.open else false;
|
|
355
|
+
},
|
|
356
|
+
.window_update => {
|
|
357
|
+
const state = event_value.window_frame_changed;
|
|
323
358
|
WindowViewMethods().updateWindowState(self, state) catch |err| log(self, "window.state.update_failed", @errorName(err), &.{trace.string("label", state.label)});
|
|
359
|
+
},
|
|
360
|
+
.window_layout => {
|
|
361
|
+
const state = event_value.window_frame_changed;
|
|
324
362
|
WindowViewMethods().relayoutShellViews(self, state.id) catch |err| log(self, "shell.relayout_failed", @errorName(err), &.{trace.uint("window_id", state.id)});
|
|
363
|
+
},
|
|
364
|
+
.window_save => {
|
|
365
|
+
const state = event_value.window_frame_changed;
|
|
325
366
|
if (self.options.window_state_store) |store| {
|
|
326
367
|
store.saveWindow(WindowViewMethods().runtimeWindowStateForPersistence(self, state)) catch |err| log(self, "window.state.save_failed", @errorName(err), &.{trace.string("label", state.label)});
|
|
327
368
|
}
|
|
369
|
+
},
|
|
370
|
+
.window_log => {
|
|
371
|
+
const state = event_value.window_frame_changed;
|
|
328
372
|
log(self, "window.frame", "window frame updated", &.{
|
|
329
373
|
trace.string("label", state.label),
|
|
330
374
|
trace.float("x", state.frame.x),
|
|
@@ -332,38 +376,94 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
332
376
|
trace.float("width", state.frame.width),
|
|
333
377
|
trace.float("height", state.frame.height),
|
|
334
378
|
});
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
// comes from runtime storage, which outlives the
|
|
340
|
-
// event's transient slices.
|
|
379
|
+
},
|
|
380
|
+
.window_close => {
|
|
381
|
+
const state = event_value.window_frame_changed;
|
|
382
|
+
if (host_flow.gate(policy, 1, @intFromBool(was_open), @intFromBool(state.open)) != 0) {
|
|
341
383
|
const label = if (WindowViewMethods().findWindowIndexById(self, state.id)) |index| self.windows[index].info.label else state.label;
|
|
342
384
|
try dispatchEvent(self, app, .{ .window_closed = .{ .window_id = state.id, .label = label } });
|
|
343
385
|
}
|
|
344
386
|
},
|
|
345
|
-
.
|
|
346
|
-
|
|
347
|
-
// window LOSING key here also drops its views'
|
|
348
|
-
// tooltip conversations there.
|
|
387
|
+
.focus_window => {
|
|
388
|
+
const window_id = event_value.window_focused;
|
|
349
389
|
if (WindowViewMethods().findWindowIndexById(self, window_id)) |index| try WindowViewMethods().setFocusedIndex(self, index);
|
|
390
|
+
},
|
|
391
|
+
.dirty => {
|
|
350
392
|
self.invalidated = true;
|
|
351
393
|
},
|
|
352
|
-
.
|
|
353
|
-
|
|
354
|
-
// their pointer stream, so the host reports the
|
|
355
|
-
// focus edge explicitly. Keep the canvas widget id
|
|
356
|
-
// as per-view focus memory while its view blurs:
|
|
357
|
-
// inactive terminal/text carets paint honestly, and
|
|
358
|
-
// clicking back into the canvas resumes its normal
|
|
359
|
-
// pointer-driven widget focus path.
|
|
394
|
+
.focus_view => {
|
|
395
|
+
const focus = event_value.view_focused;
|
|
360
396
|
try WindowViewMethods().setFocusedView(self, focus.window_id, focus.label);
|
|
361
|
-
self.invalidated = true;
|
|
362
397
|
},
|
|
363
|
-
.
|
|
364
|
-
|
|
365
|
-
|
|
398
|
+
.frame => {
|
|
399
|
+
try frame(self, app);
|
|
400
|
+
},
|
|
401
|
+
.bridge => {
|
|
402
|
+
try handleBridgeMessage(self, app, event_value.bridge_message);
|
|
403
|
+
},
|
|
404
|
+
.tray_log => {
|
|
405
|
+
const action = event_value.tray_action;
|
|
366
406
|
log(self, "tray.action", "tray item selected", &.{ trace.uint("status_item_id", action.status_item_id), trace.uint("item_id", action.item_id) });
|
|
407
|
+
},
|
|
408
|
+
.shortcut_event => {
|
|
409
|
+
try dispatchEvent(self, app, .{ .shortcut = event_value.shortcut });
|
|
410
|
+
},
|
|
411
|
+
.shortcut_emit => {
|
|
412
|
+
const shortcut = event_value.shortcut;
|
|
413
|
+
emitShortcutEvent(self, shortcut) catch |err| log(self, "shortcut.emit_failed", @errorName(err), &.{trace.string("id", shortcut.id)});
|
|
414
|
+
},
|
|
415
|
+
.command_dirty => {
|
|
416
|
+
self.invalidateFor(.command, null);
|
|
417
|
+
},
|
|
418
|
+
.gpu_resize_log => {
|
|
419
|
+
const resize_event = event_value.gpu_surface_resized;
|
|
420
|
+
log(self, "gpu_surface.resize", "gpu surface resized", &.{
|
|
421
|
+
trace.string("label", resize_event.label),
|
|
422
|
+
trace.float("width", resize_event.frame.width),
|
|
423
|
+
trace.float("height", resize_event.frame.height),
|
|
424
|
+
trace.float("scale", resize_event.scale_factor),
|
|
425
|
+
});
|
|
426
|
+
},
|
|
427
|
+
.drop_route => {
|
|
428
|
+
const drop = event_value.files_dropped;
|
|
429
|
+
routed_drop = self.routeCanvasWidgetFileDrop(drop, &self.widget_event_route_entries) catch |err| blk: {
|
|
430
|
+
const refusal: u8 = switch (err) {
|
|
431
|
+
error.WindowNotFound => 1,
|
|
432
|
+
error.ViewNotFound => 2,
|
|
433
|
+
error.InvalidViewOptions => 3,
|
|
434
|
+
else => 4,
|
|
435
|
+
};
|
|
436
|
+
if (host_flow.gate(policy, 7, refusal, 0) == 0) return @as(anyerror!void, err);
|
|
437
|
+
break :blk null;
|
|
438
|
+
};
|
|
439
|
+
},
|
|
440
|
+
.drop_widget => {
|
|
441
|
+
if (host_flow.gate(policy, 8, @intFromBool(routed_drop != null), 0) != 0) try dispatchEvent(self, app, .{ .canvas_widget_file_drop = routed_drop.? });
|
|
442
|
+
},
|
|
443
|
+
.drop_event => {
|
|
444
|
+
try dispatchEvent(self, app, .{ .files_dropped = event_value.files_dropped });
|
|
445
|
+
},
|
|
446
|
+
.drop_emit => {
|
|
447
|
+
const drop = event_value.files_dropped;
|
|
448
|
+
emitFileDropEvent(self, drop) catch |err| log(self, "drop.files.emit_failed", @errorName(err), &.{trace.uint("window_id", drop.window_id)});
|
|
449
|
+
},
|
|
450
|
+
.lifecycle_stop => {
|
|
451
|
+
try dispatchEvent(self, app, .{ .lifecycle = .stop });
|
|
452
|
+
},
|
|
453
|
+
.extensions_stop => {
|
|
454
|
+
if (self.options.extensions) |registry| try registry.stopAll(extensionContext(self));
|
|
455
|
+
},
|
|
456
|
+
.mark_stop => {
|
|
457
|
+
self.app_stop_delivered = true;
|
|
458
|
+
},
|
|
459
|
+
.stop => {
|
|
460
|
+
try app.stop(self);
|
|
461
|
+
},
|
|
462
|
+
.stop_log => {
|
|
463
|
+
log(self, "app.stop", "app stopped", &.{trace.string("app", app.name)});
|
|
464
|
+
},
|
|
465
|
+
.command_tray_action => {
|
|
466
|
+
const action = event_value.tray_action;
|
|
367
467
|
try dispatchCommand(self, app, .{
|
|
368
468
|
.name = SystemServiceMethods().statusItemCommandNameForItem(self, action.status_item_id, action.item_id),
|
|
369
469
|
.source = .tray,
|
|
@@ -371,17 +471,16 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
371
471
|
.tray_item_id = action.item_id,
|
|
372
472
|
});
|
|
373
473
|
},
|
|
374
|
-
.
|
|
474
|
+
.command_shortcut => {
|
|
475
|
+
const shortcut = event_value.shortcut;
|
|
375
476
|
try dispatchCommand(self, app, .{
|
|
376
477
|
.name = shortcut.id,
|
|
377
478
|
.source = .shortcut,
|
|
378
479
|
.window_id = shortcut.window_id,
|
|
379
480
|
});
|
|
380
|
-
try dispatchEvent(self, app, .{ .shortcut = shortcut });
|
|
381
|
-
emitShortcutEvent(self, shortcut) catch |err| log(self, "shortcut.emit_failed", @errorName(err), &.{trace.string("id", shortcut.id)});
|
|
382
|
-
self.invalidateFor(.command, null);
|
|
383
481
|
},
|
|
384
|
-
.
|
|
482
|
+
.command_native_command => {
|
|
483
|
+
const command = event_value.native_command;
|
|
385
484
|
try dispatchCommand(self, app, .{
|
|
386
485
|
.name = command.name,
|
|
387
486
|
.source = WindowViewMethods().commandSourceForNativeView(self, command.window_id, command.view_label),
|
|
@@ -389,64 +488,16 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
389
488
|
.view_label = command.view_label,
|
|
390
489
|
});
|
|
391
490
|
},
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
// `dispatchPlatformEvent` reaches the platform callback,
|
|
395
|
-
// latches its failure flag, and exits the whole app — so a
|
|
396
|
-
// runtime-side capacity or render fault on a keystroke,
|
|
397
|
-
// click, scroll, resize, or frame tick must land in the
|
|
398
|
-
// dispatch-error ring (loud, queryable, traced at `.err`)
|
|
399
|
-
// while the app keeps running. The failing interaction is
|
|
400
|
-
// refused; the next one starts clean. The TestHarness's
|
|
401
|
-
// `.propagate` policy still returns the error so tests
|
|
402
|
-
// fail loud instead of leaving silent stale frames.
|
|
403
|
-
.gpu_surface_frame => |frame_event| GpuSurfaceEventMethods().dispatchGpuSurfaceFrame(self, app, frame_event) catch |err| {
|
|
404
|
-
recordDispatchError(self, "gpu_surface_frame", err);
|
|
405
|
-
if (self.dispatch_error_policy == .propagate) return err;
|
|
406
|
-
},
|
|
407
|
-
.gpu_surface_resized => |resize_event| {
|
|
408
|
-
GpuSurfaceEventMethods().dispatchGpuSurfaceResized(self, app, resize_event) catch |err| {
|
|
409
|
-
recordDispatchError(self, "gpu_surface_resized", err);
|
|
410
|
-
if (self.dispatch_error_policy == .propagate) return err;
|
|
411
|
-
};
|
|
412
|
-
log(self, "gpu_surface.resize", "gpu surface resized", &.{
|
|
413
|
-
trace.string("label", resize_event.label),
|
|
414
|
-
trace.float("width", resize_event.frame.width),
|
|
415
|
-
trace.float("height", resize_event.frame.height),
|
|
416
|
-
trace.float("scale", resize_event.scale_factor),
|
|
417
|
-
});
|
|
418
|
-
},
|
|
419
|
-
.gpu_surface_input => |input_event| GpuSurfaceEventMethods().dispatchGpuSurfaceInput(self, app, input_event) catch |err| {
|
|
420
|
-
recordDispatchError(self, "gpu_surface_input", err);
|
|
421
|
-
if (self.dispatch_error_policy == .propagate) return err;
|
|
422
|
-
},
|
|
423
|
-
.gpu_surface_scroll_driver => |driver_event| ScrollDriverMethods().dispatchGpuSurfaceScrollDriver(self, app, driver_event) catch |err| {
|
|
424
|
-
recordDispatchError(self, "gpu_surface_scroll_driver", err);
|
|
425
|
-
if (self.dispatch_error_policy == .propagate) return err;
|
|
426
|
-
},
|
|
427
|
-
.context_menu_action => |action_event| ContextMenuMethods().dispatchContextMenuAction(self, app, action_event) catch |err| {
|
|
428
|
-
recordDispatchError(self, "context_menu_action", err);
|
|
429
|
-
if (self.dispatch_error_policy == .propagate) return err;
|
|
430
|
-
},
|
|
431
|
-
.widget_accessibility_action => |action_event| {
|
|
432
|
-
_ = self.dispatchCanvasWidgetAccessibilityAction(app, action_event.window_id, action_event.label, .{
|
|
433
|
-
.id = action_event.id,
|
|
434
|
-
.action = canvasWidgetAccessibilityActionKindFromPlatform(action_event.action),
|
|
435
|
-
.text = action_event.text,
|
|
436
|
-
.selection = if (action_event.selection) |selection| .{ .anchor = selection.start, .focus = selection.end } else null,
|
|
437
|
-
}) catch |err| {
|
|
438
|
-
recordDispatchError(self, "widget_accessibility_action", err);
|
|
439
|
-
if (self.dispatch_error_policy == .propagate) return err;
|
|
440
|
-
};
|
|
441
|
-
},
|
|
442
|
-
.menu_command => |command| {
|
|
491
|
+
.command_menu_command => {
|
|
492
|
+
const command = event_value.menu_command;
|
|
443
493
|
try dispatchCommand(self, app, .{
|
|
444
494
|
.name = command.name,
|
|
445
495
|
.source = .menu,
|
|
446
496
|
.window_id = command.window_id,
|
|
447
497
|
});
|
|
448
498
|
},
|
|
449
|
-
.
|
|
499
|
+
.command_tray_command => {
|
|
500
|
+
const command = event_value.tray_command;
|
|
450
501
|
try dispatchCommand(self, app, .{
|
|
451
502
|
.name = command.name,
|
|
452
503
|
.source = .tray,
|
|
@@ -454,126 +505,103 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
454
505
|
.status_item_id = command.status_item_id,
|
|
455
506
|
});
|
|
456
507
|
},
|
|
457
|
-
.
|
|
508
|
+
.command_notification_command => {
|
|
509
|
+
const command = event_value.notification_command;
|
|
458
510
|
try dispatchCommand(self, app, .{
|
|
459
511
|
.name = command.name,
|
|
460
512
|
.source = .notification,
|
|
461
513
|
.window_id = command.window_id,
|
|
462
514
|
});
|
|
463
515
|
},
|
|
464
|
-
.
|
|
465
|
-
try dispatchEvent(self, app, .{ .timer =
|
|
516
|
+
.event_timer => {
|
|
517
|
+
try dispatchEvent(self, app, .{ .timer = event_value.timer });
|
|
466
518
|
},
|
|
467
|
-
.
|
|
468
|
-
try dispatchEvent(self, app, .{ .audio =
|
|
519
|
+
.event_audio => {
|
|
520
|
+
try dispatchEvent(self, app, .{ .audio = event_value.audio });
|
|
469
521
|
},
|
|
470
|
-
.
|
|
471
|
-
try dispatchEvent(self, app, .{ .video =
|
|
522
|
+
.event_video => {
|
|
523
|
+
try dispatchEvent(self, app, .{ .video = event_value.video });
|
|
472
524
|
},
|
|
473
|
-
.
|
|
525
|
+
.event_wake => {
|
|
474
526
|
try dispatchEvent(self, app, .effects_wake);
|
|
475
527
|
},
|
|
476
|
-
.
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
error.InvalidViewOptions,
|
|
481
|
-
=> null,
|
|
482
|
-
else => return err,
|
|
528
|
+
.capability_gpu_surface_frame => {
|
|
529
|
+
GpuSurfaceEventMethods().dispatchGpuSurfaceFrame(self, app, event_value.gpu_surface_frame) catch |err| {
|
|
530
|
+
recordDispatchError(self, "gpu_surface_frame", err);
|
|
531
|
+
if (host_flow.gate(policy, 2, @intFromBool(self.dispatch_error_policy == .propagate), 0) != 0) return @as(anyerror!void, err);
|
|
483
532
|
};
|
|
484
|
-
if (widget_drop_event) |drop_event| {
|
|
485
|
-
try dispatchEvent(self, app, .{ .canvas_widget_file_drop = drop_event });
|
|
486
|
-
}
|
|
487
|
-
try dispatchEvent(self, app, .{ .files_dropped = drop });
|
|
488
|
-
emitFileDropEvent(self, drop) catch |err| log(self, "drop.files.emit_failed", @errorName(err), &.{trace.uint("window_id", drop.window_id)});
|
|
489
|
-
self.invalidateFor(.command, null);
|
|
490
533
|
},
|
|
491
|
-
.
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
// second time (the hook contract is exactly-once).
|
|
497
|
-
self.app_stop_delivered = true;
|
|
498
|
-
try app.stop(self);
|
|
499
|
-
log(self, "app.stop", "app stopped", &.{trace.string("app", app.name)});
|
|
534
|
+
.capability_gpu_surface_resized => {
|
|
535
|
+
GpuSurfaceEventMethods().dispatchGpuSurfaceResized(self, app, event_value.gpu_surface_resized) catch |err| {
|
|
536
|
+
recordDispatchError(self, "gpu_surface_resized", err);
|
|
537
|
+
if (host_flow.gate(policy, 2, @intFromBool(self.dispatch_error_policy == .propagate), 0) != 0) return @as(anyerror!void, err);
|
|
538
|
+
};
|
|
500
539
|
},
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
log(self, "runtime.event", null, &event_fields);
|
|
507
|
-
// A handler/update error degrades — recorded and observable,
|
|
508
|
-
// never fatal. Propagating it would reach the platform
|
|
509
|
-
// callback, set `failed`, and exit the whole app. The tag
|
|
510
|
-
// name (not `Event.name()`, which for commands aliases
|
|
511
|
-
// transient command-name storage) keeps ring records static.
|
|
512
|
-
// Under the TestHarness's `.propagate` policy the recorded
|
|
513
|
-
// error additionally returns, so capacity errors fail tests
|
|
514
|
-
// instead of leaving silent stale frames.
|
|
515
|
-
app.event(self, event_value) catch |err| {
|
|
516
|
-
recordDispatchError(self, @tagName(event_value), err);
|
|
517
|
-
if (self.dispatch_error_policy == .propagate) return err;
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
switch (event_value) {
|
|
521
|
-
.command => {
|
|
522
|
-
if (self.options.extensions) |registry| {
|
|
523
|
-
registry.dispatchCommand(extensionContext(self), .{ .name = event_value.command.name }) catch |err| {
|
|
524
|
-
recordDispatchError(self, "extension.command", err);
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
self.invalidateFor(.command, null);
|
|
540
|
+
.capability_gpu_surface_input => {
|
|
541
|
+
GpuSurfaceEventMethods().dispatchGpuSurfaceInput(self, app, event_value.gpu_surface_input) catch |err| {
|
|
542
|
+
recordDispatchError(self, "gpu_surface_input", err);
|
|
543
|
+
if (host_flow.gate(policy, 2, @intFromBool(self.dispatch_error_policy == .propagate), 0) != 0) return @as(anyerror!void, err);
|
|
544
|
+
};
|
|
528
545
|
},
|
|
529
|
-
.
|
|
530
|
-
|
|
546
|
+
.capability_gpu_surface_scroll_driver => {
|
|
547
|
+
ScrollDriverMethods().dispatchGpuSurfaceScrollDriver(self, app, event_value.gpu_surface_scroll_driver) catch |err| {
|
|
548
|
+
recordDispatchError(self, "gpu_surface_scroll_driver", err);
|
|
549
|
+
if (host_flow.gate(policy, 2, @intFromBool(self.dispatch_error_policy == .propagate), 0) != 0) return @as(anyerror!void, err);
|
|
550
|
+
};
|
|
531
551
|
},
|
|
532
|
-
.
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
.audio => {},
|
|
538
|
-
.video => {},
|
|
539
|
-
.files_dropped => {},
|
|
540
|
-
.gpu_surface_frame => {},
|
|
541
|
-
.gpu_surface_resized => {},
|
|
542
|
-
.gpu_surface_input => {},
|
|
543
|
-
.canvas_widget_pointer => {},
|
|
544
|
-
.canvas_widget_keyboard => {},
|
|
545
|
-
.canvas_widget_scroll => {},
|
|
546
|
-
.canvas_widget_file_drop => {},
|
|
547
|
-
.canvas_widget_drag => {},
|
|
548
|
-
.canvas_widget_context_menu => {
|
|
549
|
-
self.invalidateFor(.command, null);
|
|
552
|
+
.capability_context_menu_action => {
|
|
553
|
+
ContextMenuMethods().dispatchContextMenuAction(self, app, event_value.context_menu_action) catch |err| {
|
|
554
|
+
recordDispatchError(self, "context_menu_action", err);
|
|
555
|
+
if (host_flow.gate(policy, 2, @intFromBool(self.dispatch_error_policy == .propagate), 0) != 0) return @as(anyerror!void, err);
|
|
556
|
+
};
|
|
550
557
|
},
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
.canvas_widget_context_menu_dismissed => {},
|
|
557
|
-
.canvas_widget_context_menu_request => {
|
|
558
|
-
// The app loop answers by mounting the anchored
|
|
559
|
-
// fallback surface: a visual change.
|
|
560
|
-
self.invalidateFor(.command, null);
|
|
558
|
+
.capability_widget_context_menu_action => {
|
|
559
|
+
AutomationWidgetMethods().dispatchWidgetContextMenuItem(self, app, event_value.widget_context_menu_action) catch |err| {
|
|
560
|
+
recordDispatchError(self, "widget_context_menu_action", err);
|
|
561
|
+
if (host_flow.gate(policy, 2, @intFromBool(self.dispatch_error_policy == .propagate), 0) != 0) return @as(anyerror!void, err);
|
|
562
|
+
};
|
|
561
563
|
},
|
|
562
|
-
.
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
564
|
+
.capability_widget_accessibility_action => {
|
|
565
|
+
const action_event = event_value.widget_accessibility_action;
|
|
566
|
+
_ = self.dispatchCanvasWidgetAccessibilityAction(app, action_event.window_id, action_event.label, .{
|
|
567
|
+
.id = action_event.id,
|
|
568
|
+
.action = canvasWidgetAccessibilityActionKindFromPlatform(action_event.action),
|
|
569
|
+
.text = action_event.text,
|
|
570
|
+
.selection = if (action_event.selection) |selection| .{ .anchor = selection.start, .focus = selection.end } else null,
|
|
571
|
+
}) catch |err| {
|
|
572
|
+
recordDispatchError(self, "widget_accessibility_action", err);
|
|
573
|
+
if (host_flow.gate(policy, 2, @intFromBool(self.dispatch_error_policy == .propagate), 0) != 0) return @as(anyerror!void, err);
|
|
574
|
+
};
|
|
568
575
|
},
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
pub fn dispatchEvent(self: *Runtime, app: App, event_value: Event) anyerror!void {
|
|
580
|
+
const policy = app.host_flow_policy orelse return native_reference.RuntimeFlow(Runtime).dispatchEvent(self, app, event_value);
|
|
581
|
+
const program = host_flow.plan(policy, .app_event, .{ .kind = host_flow.appKind(event_value) });
|
|
582
|
+
for (program) |action| switch (action) {
|
|
583
|
+
0 => break,
|
|
584
|
+
1 => if (self.options.extensions) |registry| {
|
|
585
|
+
registry.dispatchCommand(extensionContext(self), .{ .name = event_value.command.name }) catch |err| recordDispatchError(self, "extension.command", err);
|
|
586
|
+
},
|
|
587
|
+
2 => self.invalidateFor(.command, null),
|
|
588
|
+
3 => self.invalidateFor(.state, null),
|
|
589
|
+
4 => log(self, "runtime.event", null, &.{trace.string("event", event_value.name())}),
|
|
590
|
+
5 => app.event(self, event_value) catch |err| {
|
|
591
|
+
recordDispatchError(self, @tagName(event_value), err);
|
|
592
|
+
if (host_flow.gate(policy, 2, @intFromBool(self.dispatch_error_policy == .propagate), 0) != 0) return @as(anyerror!void, err);
|
|
593
|
+
},
|
|
594
|
+
else => unreachable,
|
|
595
|
+
};
|
|
572
596
|
}
|
|
573
597
|
|
|
574
598
|
pub fn dispatchCommand(self: *Runtime, app: App, command: CommandEvent) anyerror!void {
|
|
575
|
-
|
|
576
|
-
|
|
599
|
+
const plan: command_policy.Dispatch = if (self.command_policy) |policy| command_policy.dispatch(policy, command.name) else native: {
|
|
600
|
+
try validateCommandName(command.name);
|
|
601
|
+
break :native if (std.mem.eql(u8, command.name, platform.update_check_command)) .updater else .app;
|
|
602
|
+
};
|
|
603
|
+
if (plan == .invalid) return error.InvalidCommand;
|
|
604
|
+
if (plan == .updater) {
|
|
577
605
|
self.options.platform.services.checkForUpdates(true) catch |err| switch (err) {
|
|
578
606
|
error.UnsupportedService => return dispatchEvent(self, app, .{ .command = command }),
|
|
579
607
|
else => return err,
|
|
@@ -618,7 +646,8 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
618
646
|
});
|
|
619
647
|
app.event(self, .{ .lifecycle = .frame }) catch |err| {
|
|
620
648
|
recordDispatchError(self, "lifecycle", err);
|
|
621
|
-
if (self.dispatch_error_policy == .propagate)
|
|
649
|
+
const propagate = if (app.host_flow_policy) |policy| host_flow.gate(policy, 2, @intFromBool(self.dispatch_error_policy == .propagate), 0) != 0 else self.dispatch_error_policy == .propagate;
|
|
650
|
+
if (propagate) return err;
|
|
622
651
|
};
|
|
623
652
|
}
|
|
624
653
|
|
|
@@ -643,6 +672,11 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
643
672
|
}
|
|
644
673
|
|
|
645
674
|
fn handlePlatformEvent(context: *anyopaque, event_value: platform.Event) anyerror!void {
|
|
675
|
+
const run_context: *RunContext = @ptrCast(@alignCast(context));
|
|
676
|
+
try run_context.host_events.dispatch(context, dispatchHostEvent, event_value);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
fn dispatchHostEvent(context: *anyopaque, event_value: platform.Event) anyerror!void {
|
|
646
680
|
const run_context: *RunContext = @ptrCast(@alignCast(context));
|
|
647
681
|
try run_context.runtime.dispatchPlatformEvent(run_context.app, event_value);
|
|
648
682
|
}
|
|
@@ -704,21 +738,30 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
704
738
|
}
|
|
705
739
|
|
|
706
740
|
fn loadScene(self: *Runtime, app: App, scene: app_manifest.ShellConfig) anyerror!void {
|
|
707
|
-
|
|
741
|
+
if (self.shell_admission_policy) |policy|
|
|
742
|
+
try @import("shell_admission_policy.zig").scene(policy, scene, &.{})
|
|
743
|
+
else
|
|
744
|
+
try app_manifest.validateShell(scene, &.{});
|
|
708
745
|
if (scene.windows.len == 0) {
|
|
709
746
|
log(self, "scene.load", "loaded empty app scene", &.{trace.string("app", app.name)});
|
|
710
747
|
return;
|
|
711
748
|
}
|
|
712
749
|
|
|
713
750
|
const uses_default_empty_source = appUsesDefaultEmptyWebViewSource(App, app);
|
|
714
|
-
const source = if (
|
|
751
|
+
const source = if (if (self.shell_coordination_policy) |policy|
|
|
752
|
+
@import("shell_coordination_policy.zig").scene(policy, scene.windows, uses_default_empty_source).decisions != 0
|
|
753
|
+
else
|
|
754
|
+
sceneNeedsMainWebView(scene) or !uses_default_empty_source)
|
|
715
755
|
try WindowViewMethods().copyLoadedSource(self, try app.webViewSource())
|
|
716
756
|
else
|
|
717
757
|
null;
|
|
718
758
|
if (source != null and !self.options.web_layer) return error.WebViewLayerNotBuilt;
|
|
719
759
|
self.loaded_source = source;
|
|
720
760
|
|
|
721
|
-
const startup_uses_source =
|
|
761
|
+
const startup_uses_source = if (self.shell_coordination_policy) |policy|
|
|
762
|
+
@import("shell_coordination_policy.zig").scene(policy, scene.windows[0..1], uses_default_empty_source).choices[0] & 4 != 0
|
|
763
|
+
else
|
|
764
|
+
sceneWindowUsesAppSource(scene.windows[0], uses_default_empty_source);
|
|
722
765
|
try loadStartupSceneWindow(
|
|
723
766
|
self,
|
|
724
767
|
scene.windows[0],
|
|
@@ -726,7 +769,11 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
726
769
|
if (startup_uses_source) .allow_source_less else .never_source,
|
|
727
770
|
);
|
|
728
771
|
for (scene.windows[1..]) |window| {
|
|
729
|
-
if (
|
|
772
|
+
if (if (self.shell_coordination_policy) |policy|
|
|
773
|
+
@import("shell_coordination_policy.zig").scene(policy, &.{window}, uses_default_empty_source).choices[0] & 4 != 0
|
|
774
|
+
else
|
|
775
|
+
sceneWindowUsesAppSource(window, uses_default_empty_source))
|
|
776
|
+
{
|
|
730
777
|
_ = try WindowViewMethods().createShellWindowWithSourceMode(self, window, source, source != null);
|
|
731
778
|
} else {
|
|
732
779
|
_ = try WindowViewMethods().createSourcelessShellWindow(self, window);
|
|
@@ -840,7 +887,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
840
887
|
self.invalidateFor(.command, null);
|
|
841
888
|
return;
|
|
842
889
|
}
|
|
843
|
-
const response =
|
|
890
|
+
const response = authorization.dispatch(self.authorization_policy, dispatcher, message.bytes, .{ .origin = message.origin, .window_id = message.window_id, .webview_label = message.webview_label }, &response_buffer);
|
|
844
891
|
try completeBridgeResponse(self, message.window_id, message.webview_label, response);
|
|
845
892
|
self.invalidateFor(.command, null);
|
|
846
893
|
log(self, "bridge.dispatch", "bridge request handled", &.{
|
|
@@ -852,7 +899,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
852
899
|
fn handleAsyncBridgeMessage(self: *Runtime, dispatcher: bridge.Dispatcher, message: platform.BridgeMessage) anyerror!bool {
|
|
853
900
|
const request = bridge.parseRequest(message.bytes) catch return false;
|
|
854
901
|
const handler = dispatcher.async_registry.find(request.command) orelse return false;
|
|
855
|
-
if (!dispatcher.policy
|
|
902
|
+
if (!authorization.bridgeAllows(self.authorization_policy, dispatcher.policy, request.command, message.origin)) {
|
|
856
903
|
var response_buffer: [bridge.max_response_bytes]u8 = undefined;
|
|
857
904
|
const response = bridge.writeErrorResponse(&response_buffer, request.id, .permission_denied, "Bridge command is not permitted");
|
|
858
905
|
try completeBridgeResponse(self, message.window_id, message.webview_label, response);
|
|
@@ -951,7 +998,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
951
998
|
try handleBridgeMessage(self, app, .{ .bytes = command.value, .origin = "zero://inline", .window_id = 1, .webview_label = "main" });
|
|
952
999
|
},
|
|
953
1000
|
.resize => {
|
|
954
|
-
const parsed = try parseAutomationResizeCommand(command.value);
|
|
1001
|
+
const parsed = try parseAutomationResizeCommand(self.automation_command_policy, command.value);
|
|
955
1002
|
try dispatchPlatformEvent(self, app, .{ .surface_resized = .{
|
|
956
1003
|
.id = 1,
|
|
957
1004
|
.size = geometry.SizeF.init(parsed.width, parsed.height),
|
|
@@ -964,7 +1011,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
964
1011
|
};
|
|
965
1012
|
},
|
|
966
1013
|
.native_command => {
|
|
967
|
-
const parsed = try parseAutomationNativeCommand(command.value);
|
|
1014
|
+
const parsed = try parseAutomationNativeCommand(self.automation_command_policy, command.value);
|
|
968
1015
|
try dispatchPlatformEvent(self, app, .{ .native_command = .{
|
|
969
1016
|
.name = parsed.name,
|
|
970
1017
|
.window_id = 1,
|
|
@@ -972,41 +1019,41 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
972
1019
|
} });
|
|
973
1020
|
},
|
|
974
1021
|
.widget_action => {
|
|
975
|
-
try AutomationWidgetMethods().dispatchAutomationWidgetAction(self, app, try parseAutomationWidgetAction(command.value));
|
|
1022
|
+
try AutomationWidgetMethods().dispatchAutomationWidgetAction(self, app, try parseAutomationWidgetAction(self.automation_command_policy, command.value));
|
|
976
1023
|
},
|
|
977
1024
|
.widget_click => {
|
|
978
|
-
try AutomationWidgetMethods().dispatchAutomationWidgetClick(self, app, try parseAutomationWidgetTarget(command.value));
|
|
1025
|
+
try AutomationWidgetMethods().dispatchAutomationWidgetClick(self, app, try parseAutomationWidgetTarget(self.automation_command_policy, command.value));
|
|
979
1026
|
},
|
|
980
1027
|
.widget_hold => {
|
|
981
|
-
try AutomationWidgetMethods().dispatchAutomationWidgetHold(self, app, try parseAutomationWidgetTarget(command.value));
|
|
1028
|
+
try AutomationWidgetMethods().dispatchAutomationWidgetHold(self, app, try parseAutomationWidgetTarget(self.automation_command_policy, command.value));
|
|
982
1029
|
},
|
|
983
1030
|
.widget_context_press => {
|
|
984
|
-
try AutomationWidgetMethods().dispatchAutomationWidgetContextPress(self, app, try parseAutomationWidgetTarget(command.value));
|
|
1031
|
+
try AutomationWidgetMethods().dispatchAutomationWidgetContextPress(self, app, try parseAutomationWidgetTarget(self.automation_command_policy, command.value));
|
|
985
1032
|
},
|
|
986
1033
|
.widget_context_menu => {
|
|
987
|
-
try AutomationWidgetMethods().dispatchAutomationWidgetContextMenuItem(self, app, try parseAutomationWidgetContextMenuItem(command.value));
|
|
1034
|
+
try AutomationWidgetMethods().dispatchAutomationWidgetContextMenuItem(self, app, try parseAutomationWidgetContextMenuItem(self.automation_command_policy, command.value));
|
|
988
1035
|
},
|
|
989
1036
|
.widget_drag => {
|
|
990
|
-
try AutomationWidgetMethods().dispatchAutomationWidgetPointerDrag(self, app, try parseAutomationWidgetPointerDrag(command.value));
|
|
1037
|
+
try AutomationWidgetMethods().dispatchAutomationWidgetPointerDrag(self, app, try parseAutomationWidgetPointerDrag(self.automation_command_policy, command.value));
|
|
991
1038
|
},
|
|
992
1039
|
.widget_wheel => {
|
|
993
|
-
try AutomationWidgetMethods().dispatchAutomationWidgetWheel(self, app, try parseAutomationWidgetWheel(command.value));
|
|
1040
|
+
try AutomationWidgetMethods().dispatchAutomationWidgetWheel(self, app, try parseAutomationWidgetWheel(self.automation_command_policy, command.value));
|
|
994
1041
|
},
|
|
995
1042
|
.widget_key => {
|
|
996
|
-
try AutomationWidgetMethods().dispatchAutomationWidgetKeyInput(self, app, try parseAutomationWidgetKey(command.value));
|
|
1043
|
+
try AutomationWidgetMethods().dispatchAutomationWidgetKeyInput(self, app, try parseAutomationWidgetKey(self.automation_command_policy, command.value));
|
|
997
1044
|
},
|
|
998
1045
|
.widget_pinch => {
|
|
999
|
-
try AutomationWidgetMethods().dispatchAutomationWidgetPinch(self, app, try parseAutomationWidgetPinch(command.value));
|
|
1046
|
+
try AutomationWidgetMethods().dispatchAutomationWidgetPinch(self, app, try parseAutomationWidgetPinch(self.automation_command_policy, command.value));
|
|
1000
1047
|
},
|
|
1001
1048
|
.menu_command => {
|
|
1002
1049
|
try dispatchPlatformEvent(self, app, .{ .menu_command = .{
|
|
1003
|
-
.name = try parseAutomationCommandName(command.value),
|
|
1050
|
+
.name = try parseAutomationCommandName(self.automation_command_policy, command.value),
|
|
1004
1051
|
.window_id = 1,
|
|
1005
1052
|
} });
|
|
1006
1053
|
},
|
|
1007
1054
|
.shortcut => {
|
|
1008
1055
|
try dispatchPlatformEvent(self, app, .{ .shortcut = .{
|
|
1009
|
-
.id = try parseAutomationCommandName(command.value),
|
|
1056
|
+
.id = try parseAutomationCommandName(self.automation_command_policy, command.value),
|
|
1010
1057
|
.key = "",
|
|
1011
1058
|
.window_id = 1,
|
|
1012
1059
|
} });
|
|
@@ -1018,7 +1065,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
1018
1065
|
// UiApp's window fallback are all the real path. A
|
|
1019
1066
|
// stale or unknown item id is loud driver misuse,
|
|
1020
1067
|
// like widget-click on an unmounted widget.
|
|
1021
|
-
const target = try parseAutomationTrayTarget(command.value);
|
|
1068
|
+
const target = try parseAutomationTrayTarget(self.automation_command_policy, command.value);
|
|
1022
1069
|
if (!SystemServiceMethods().statusItemMenuItemActionable(self, target.status_item_id, target.item_id)) return error.InvalidCommand;
|
|
1023
1070
|
try dispatchPlatformEvent(self, app, .{ .tray_action = .{
|
|
1024
1071
|
.status_item_id = target.status_item_id,
|
|
@@ -1026,7 +1073,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
1026
1073
|
} });
|
|
1027
1074
|
},
|
|
1028
1075
|
.focus_view => {
|
|
1029
|
-
try WindowViewMethods().focusView(self, 1, try parseAutomationViewLabel(command.value));
|
|
1076
|
+
try WindowViewMethods().focusView(self, 1, try parseAutomationViewLabel(self.automation_command_policy, command.value));
|
|
1030
1077
|
},
|
|
1031
1078
|
.focus_next_view => {
|
|
1032
1079
|
_ = try WindowViewMethods().focusNextView(self, 1);
|
|
@@ -1053,7 +1100,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
1053
1100
|
self.invalidateFor(.command, null);
|
|
1054
1101
|
},
|
|
1055
1102
|
.provenance => {
|
|
1056
|
-
try AutomationWidgetMethods().dispatchAutomationProvenance(self, app, try parseAutomationProvenanceTarget(command.value));
|
|
1103
|
+
try AutomationWidgetMethods().dispatchAutomationProvenance(self, app, try parseAutomationProvenanceTarget(self.automation_command_policy, command.value));
|
|
1057
1104
|
},
|
|
1058
1105
|
.wait => {},
|
|
1059
1106
|
}
|
|
@@ -1067,7 +1114,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
1067
1114
|
/// artifacts across captures.
|
|
1068
1115
|
pub fn publishAutomationScreenshot(self: *Runtime, value: []const u8) anyerror!void {
|
|
1069
1116
|
const server = self.options.automation orelse return;
|
|
1070
|
-
const parsed = try parseAutomationScreenshotCommand(value);
|
|
1117
|
+
const parsed = try parseAutomationScreenshotCommand(self.automation_command_policy, value);
|
|
1071
1118
|
// Screenshots address a gpu_surface view by label across ALL
|
|
1072
1119
|
// open windows, like the widget verbs — a secondary window's
|
|
1073
1120
|
// canvas captures the same way the main one does.
|
|
@@ -1141,7 +1188,37 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
1141
1188
|
const resolveWindowSelector = BuiltinBridgeMethods.resolveWindowSelector;
|
|
1142
1189
|
const writeWindowListJson = BuiltinBridgeMethods.writeWindowListJson;
|
|
1143
1190
|
|
|
1191
|
+
fn handleCompiledBuiltinBridgeMessage(self: *Runtime, app: App, message: platform.BridgeMessage) anyerror!bool {
|
|
1192
|
+
const request = bridge.parseRequest(message.bytes) catch return false;
|
|
1193
|
+
const plan = builtin_coordination.route(self.builtin_coordination_policy.?, .none, request.command);
|
|
1194
|
+
if (plan.family() == .none) return false;
|
|
1195
|
+
var response_buffer: [bridge.max_response_bytes]u8 = undefined;
|
|
1196
|
+
var result_buffer: [bridge.max_result_bytes]u8 = undefined;
|
|
1197
|
+
if (!allowsBuiltinBridgeCommand(self, request.command, message.origin, plan.permission())) {
|
|
1198
|
+
const response = bridge.writeErrorResponse(&response_buffer, request.id, .permission_denied, plan.deniedMessage());
|
|
1199
|
+
try completeBridgeResponse(self, message.window_id, message.webview_label, response);
|
|
1200
|
+
self.invalidateFor(.command, null);
|
|
1201
|
+
return true;
|
|
1202
|
+
}
|
|
1203
|
+
const response = switch (plan.family()) {
|
|
1204
|
+
.none => unreachable,
|
|
1205
|
+
.command => dispatchCommandBridgeCommand(self, app, request, message.window_id, message.webview_label, &result_buffer, &response_buffer),
|
|
1206
|
+
.window => dispatchWindowBridgeCommand(self, request, &result_buffer, &response_buffer),
|
|
1207
|
+
.view => dispatchViewBridgeCommand(self, request, message.window_id, &result_buffer, &response_buffer),
|
|
1208
|
+
.webview => dispatchWebViewBridgeCommand(self, request, message.window_id, &result_buffer, &response_buffer),
|
|
1209
|
+
.platform => dispatchPlatformBridgeCommand(self, request, &result_buffer, &response_buffer),
|
|
1210
|
+
.dialog => dispatchDialogBridgeCommand(self, request, &result_buffer, &response_buffer),
|
|
1211
|
+
.os => dispatchOsBridgeCommand(self, request, message.origin, &result_buffer, &response_buffer),
|
|
1212
|
+
.clipboard => dispatchClipboardBridgeCommand(self, request, &result_buffer, &response_buffer),
|
|
1213
|
+
.credentials => dispatchCredentialBridgeCommand(self, request, &result_buffer, &response_buffer),
|
|
1214
|
+
};
|
|
1215
|
+
try completeBridgeResponse(self, message.window_id, message.webview_label, response);
|
|
1216
|
+
self.invalidateFor(.command, null);
|
|
1217
|
+
return true;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1144
1220
|
fn handleBuiltinBridgeMessage(self: *Runtime, app: App, message: platform.BridgeMessage) anyerror!bool {
|
|
1221
|
+
if (self.builtin_coordination_policy != null) return handleCompiledBuiltinBridgeMessage(self, app, message);
|
|
1145
1222
|
const request = bridge.parseRequest(message.bytes) catch return false;
|
|
1146
1223
|
const is_command = std.mem.startsWith(u8, request.command, "native-sdk.command.");
|
|
1147
1224
|
const is_window = std.mem.startsWith(u8, request.command, "native-sdk.window.");
|