Enhance: Integrate Aether Native Bridge and update V3 deployment plan

- Updated +layout.ts to detect window.aetherNative and prioritize hydrated config.
- Mapped native operational paths (cache, recordings) to global location store.
- Refined NATIVE_APP_V3_REWRITE_PLAN.md with Two-Step Bootstrap strategy.
- Updated TODO.md with project progress and next-gen launcher priorities.
This commit is contained in:
Scott Idem
2026-01-23 14:08:37 -05:00
parent 4d932fcd2c
commit 20b41ebaef
4 changed files with 116 additions and 77 deletions

View File

@@ -121,30 +121,66 @@ export async function load({ fetch, params, parent, route, url }) {
let result: any = null;
let api_error = false;
try {
if (log_lvl) console.log(`ROOT LOAD: Starting site lookup V3 for ${fqdn}...`);
// Use dedicated Agent Key for Bootstrap and include the unauthenticated bypass header ONLY for this request
const bootstrap_api_cfg = {
...ae_api_init,
api_secret_key: 'IDF68Em5X4HTZlswRNgepQ',
headers: {
...ae_api_init.headers,
'x-aether-api-key': 'IDF68Em5X4HTZlswRNgepQ',
'x-no-account-id': 'bypass' // Force explicit bypass for bootstrap
}
};
let is_native = false;
result = await lookup_site_domain_v3({
api_cfg: bootstrap_api_cfg,
fqdn,
view: 'base',
log_lvl
});
if (log_lvl) console.log(`ROOT LOAD: Site lookup result for ${fqdn}:`, result);
} catch (err) {
console.error(`ROOT LOAD: Site lookup critical failure for ${fqdn}.`, err);
api_error = true;
// Detect Aether Native Bridge (Electron)
if (typeof window !== 'undefined' && (window as any).aetherNative) {
is_native = true;
if (log_lvl) console.log('ROOT LOAD: Detected Aether Native Bridge. Requesting device config...');
try {
const native_device_config = await (window as any).aetherNative.getDeviceConfig();
if (native_device_config) {
if (log_lvl) console.log('ROOT LOAD: Native device config received:', native_device_config);
// Map native device config to the expected result structure
result = {
...native_device_config,
// Ensure naming consistency
account_id: native_device_config.account_id || native_device_config.account_id_random,
site_id: native_device_config.site_id || native_device_config.site_id_random,
site_domain_id: native_device_config.site_domain_id || native_device_config.site_domain_id_random,
};
// Inject native device metadata into the location state
if (native_device_config.native_device) {
ae_loc_init['native_device'] = native_device_config.native_device;
// Map specific operational paths
ae_loc_init['local_file_cache_path'] = native_device_config.native_device.local_file_cache_path;
ae_loc_init['host_file_temp_path'] = native_device_config.native_device.host_file_temp_path;
ae_loc_init['recording_path'] = native_device_config.native_device.recording_path;
}
}
} catch (err) {
console.error('ROOT LOAD: Failed to fetch native device config.', err);
}
}
// Perform standard FQDN lookup if not native or if native fetch failed
if (!result) {
try {
if (log_lvl) console.log(`ROOT LOAD: Starting site lookup V3 for ${fqdn}...`);
// Use dedicated Agent Key for Bootstrap and include the unauthenticated bypass header ONLY for this request
const bootstrap_api_cfg = {
...ae_api_init,
api_secret_key: 'IDF68Em5X4HTZlswRNgepQ',
headers: {
...ae_api_init.headers,
'x-aether-api-key': 'IDF68Em5X4HTZlswRNgepQ',
'x-no-account-id': 'bypass' // Force explicit bypass for bootstrap
}
};
result = await lookup_site_domain_v3({
api_cfg: bootstrap_api_cfg,
fqdn,
view: 'base',
log_lvl
});
if (log_lvl) console.log(`ROOT LOAD: Site lookup result for ${fqdn}:`, result);
} catch (err) {
console.error(`ROOT LOAD: Site lookup critical failure for ${fqdn}.`, err);
api_error = true;
}
}
// Defensive check: if result is false (common from API helper) or null, use emergency ghost
@@ -166,8 +202,7 @@ export async function load({ fetch, params, parent, route, url }) {
}
const json_data = result;
// CRITICAL: SvelteKit hydration can fail if these are undefined
// V3 ID Vision: Use account_id (random string) instead of account_id_random
// ... rest of the mapping logic ...
account_id = json_data.account_id || json_data.account_id_random || 'ghost';
data_struct.account_id = account_id;
ae_acct.account_id = account_id;
@@ -178,6 +213,7 @@ export async function load({ fetch, params, parent, route, url }) {
ae_acct.api.account_id = account_id;
ae_acct.api.headers['x-account-id'] = account_id;
ae_loc_init['is_native'] = is_native;
ae_loc_init['account_id'] = account_id;
ae_loc_init['account_code'] = json_data.account_code || 'ghost';
ae_loc_init['account_name'] = json_data.account_name || 'Ghost Account';

View File

@@ -1,3 +1,8 @@
# Aether (AE) Event Launcher Module (v3)
This directory contains the files for the new Event Launcher module (v3). Detailed documentation to follow.
This should be able to run in 3 modes:
* Default - What most users will see for demo purposes
* Onsite - This is what is set onsite, usually just in the Speaker Ready Room
* Native App - This is for the native app version of Aether and used on the MacBook laptops in each of the session rooms