From 4923099cfb7b10ce67782c8ba5838dad12c32c26 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 13 May 2026 12:34:36 -0400 Subject: [PATCH] feat(launcher): add device launch timing override --- .../MODULE__AE_Events_PressMgmt_Launcher.md | 3 +- ...__AE_Events_Launcher_Native_integration.md | 7 +- documentation/TODO__Agents.md | 2 + .../ae_launcher__default_launch_profiles.ts | 2 +- .../ae_events_stores__launcher_defaults.ts | 2 + .../launcher_cfg_launch_timing.svelte | 223 ++++++++++++++++++ .../[event_id]/(launcher)/launcher_cfg.svelte | 5 +- .../(launcher)/launcher_file_cont.svelte | 28 ++- 8 files changed, 264 insertions(+), 8 deletions(-) create mode 100644 src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_launch_timing.svelte diff --git a/documentation/MODULE__AE_Events_PressMgmt_Launcher.md b/documentation/MODULE__AE_Events_PressMgmt_Launcher.md index c66bf3d2..3b37e31a 100644 --- a/documentation/MODULE__AE_Events_PressMgmt_Launcher.md +++ b/documentation/MODULE__AE_Events_PressMgmt_Launcher.md @@ -326,7 +326,8 @@ immediately. See `PROJECT__AE_Events_Launcher_Native_integration.md` Section 8. These are the initial built-in defaults shipped with the Launcher. They are the Svelte-side fallbacks used when neither device config nor event config defines a profile for the file extension. Each canonical profile can have multiple extension aliases. `post_delay_ms` is part -of the profile object, so a device-specific `launch_profiles` entry can override it later. +of the profile object, so a device-specific `other_json.launcher.post_delay_ms` override can +tune it later without changing the profile table. | Profile name | Extension aliases | Default app | Display mode | Post delay | Notes | |---|---|---|---|---|---| diff --git a/documentation/PROJECT__AE_Events_Launcher_Native_integration.md b/documentation/PROJECT__AE_Events_Launcher_Native_integration.md index 331569a1..c80153d3 100644 --- a/documentation/PROJECT__AE_Events_Launcher_Native_integration.md +++ b/documentation/PROJECT__AE_Events_Launcher_Native_integration.md @@ -202,9 +202,10 @@ The native layer should not invent or guess a default launch path. The built-in defaults are organized as canonical profile names plus extension aliases. That lets multiple file types share one profile without repeating the same app/script details. -The profile object also carries `post_delay_ms`, so a device-specific `launch_profiles` -override can tune the delay without changing the bridge contract. URL-based presentations -remain a special pseudo-extension handled separately from the cache open flow. +The profile object also carries `post_delay_ms`, and a device-specific +`other_json.launcher.post_delay_ms` override can tune the delay without changing the bridge +contract. URL-based presentations remain a special pseudo-extension handled separately from +the cache open flow. ### Native Template Formats diff --git a/documentation/TODO__Agents.md b/documentation/TODO__Agents.md index a7f647d7..aec94c90 100644 --- a/documentation/TODO__Agents.md +++ b/documentation/TODO__Agents.md @@ -20,6 +20,8 @@ guessing defaults. - [x] `native:copy-from-cache-to-temp` primitive added — copy to tmp, caller decides launch - [x] `native:launch-from-cache` executes a provided `native_template` string — AppleScript or `shell:` prefix; no Electron-side fallback - [x] `get_launch_profile()` in `launcher_file_cont.svelte` reads from device config then event config; resolves to a `native_template` string and passes it to `launch_from_cache` +- [x] Built-in Launcher defaults refactored into canonical profile names plus extension aliases +- [x] Device-level Launch Timing section added under Launcher Configuration → Device, with `other_json.launcher.post_delay_ms` override **Svelte-side migration — remaining before May 26:** - [ ] **[Launcher] Built-in Svelte default profiles** — move the built-in presentation/media diff --git a/src/lib/ae_events/ae_launcher__default_launch_profiles.ts b/src/lib/ae_events/ae_launcher__default_launch_profiles.ts index 565eab18..5c57917b 100644 --- a/src/lib/ae_events/ae_launcher__default_launch_profiles.ts +++ b/src/lib/ae_events/ae_launcher__default_launch_profiles.ts @@ -43,7 +43,7 @@ export interface LaunchProfile { post_script?: string; /** * Milliseconds to wait after open_cmd before running post_script. - * Default: 2000. Can be overridden per device via launch_profiles. + * Default: 2000. Can be overridden per device via other_json.launcher.post_delay_ms. */ post_delay_ms?: number; diff --git a/src/lib/stores/ae_events_stores__launcher_defaults.ts b/src/lib/stores/ae_events_stores__launcher_defaults.ts index c357d023..4bc9155b 100644 --- a/src/lib/stores/ae_events_stores__launcher_defaults.ts +++ b/src/lib/stores/ae_events_stores__launcher_defaults.ts @@ -38,6 +38,7 @@ export interface LauncherLocState { show_section__controller: boolean; section_state__health: SectionState; section_state__native_os: SectionState; + section_state__launch_timing: SectionState; section_state__sync_timers: SectionState; section_state__updates: SectionState; section_state__controller: SectionState; @@ -158,6 +159,7 @@ export const launcher_loc_defaults: LauncherLocState = { // Values: 'collapsed' | 'auto' | 'pinned' section_state__health: 'auto', section_state__native_os: 'collapsed', + section_state__launch_timing: 'collapsed', section_state__sync_timers: 'collapsed', section_state__updates: 'collapsed', section_state__controller: 'auto', diff --git a/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_launch_timing.svelte b/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_launch_timing.svelte new file mode 100644 index 00000000..cfd240ae --- /dev/null +++ b/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_launch_timing.svelte @@ -0,0 +1,223 @@ + + + + {#if $ae_loc.edit_mode && !$ae_loc.is_native} +
+ + Dev Preview — visible for layout only; save requires the native + device record +
+ {/if} + +
+

+ Native Open Delay +

+

+ Overrides the built-in `post_delay_ms` for this device. Leave blank + to use the profile default for each extension/profile. +

+ +
+ + + +
+ +
+ + Current: + {#if get_current_delay_ms() === null} + profile defaults + {:else} + {get_current_delay_ms()} ms + {/if} + + +
+ + {#if save_status} +
+ {save_status} +
+ {/if} +
+
\ No newline at end of file diff --git a/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte b/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte index be4de9be..bf7daba6 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte @@ -32,6 +32,7 @@ import Launcher_Cfg_Controller from './cfg_components/launcher_cfg_controller.sv import Launcher_Cfg_Screen_Saver from './cfg_components/launcher_cfg_screen_saver.svelte'; import Launcher_Cfg_App_Modes from './cfg_components/launcher_cfg_app_modes.svelte'; import Launcher_Cfg_Local_Actions from './cfg_components/launcher_cfg_local_actions.svelte'; +import Launcher_Cfg_Launch_Timing from './cfg_components/launcher_cfg_launch_timing.svelte'; import { Bug, Code, @@ -150,7 +151,7 @@ function handle_section_expand(current_key: string) { -
+
{#if active_tab === 'setup'}
handle_section_expand('health')} /> handle_section_expand('native_os')} /> + handle_section_expand('launch_timing')} /> {#if $ae_loc.is_native} diff --git a/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte b/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte index e4b21710..862525b4 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte @@ -128,10 +128,34 @@ function get_launch_profile( extension: string, file_obj?: any ): LaunchProfile { - const device_profiles = ($ae_loc as any).native_device?.launch_profiles ?? null; + const native_device = ($ae_loc as any).native_device ?? null; + const device_profiles = + native_device?.other_json?.launcher?.launch_profiles ?? + native_device?.launch_profiles ?? + null; const local_profiles = ($events_loc as any).launcher?.launch_profiles ?? null; const display_override = file_obj?.cfg_json?.display_override ?? null; - return resolve_launch_profile(extension, display_override, device_profiles, local_profiles); + const profile = resolve_launch_profile( + extension, + display_override, + device_profiles, + local_profiles + ); + + const device_post_delay_ms = + native_device?.other_json?.launcher?.post_delay_ms ?? + native_device?.post_delay_ms ?? + null; + const parsed_delay_ms = + typeof device_post_delay_ms === 'string' + ? Number(device_post_delay_ms) + : device_post_delay_ms; + + if (Number.isFinite(parsed_delay_ms) && parsed_delay_ms >= 0) { + profile.post_delay_ms = parsed_delay_ms; + } + + return profile; } onMount(() => {