fix(bridge): expose copy_from_cache_to_temp + harden launch_presentation

copy_from_cache_to_temp IPC handler was registered in file_handlers.ts
but never added to the preload bridge, making it unreachable from Svelte
despite being the documented preferred primitive for custom launch flows.

launch_presentation was the last handler still using osascript -e with
inline path injection. Converted to the temp-.scpt-file approach already
used by run_osascript and launch_from_cache — prevents breakage on
presentation filenames with spaces, quotes, or parentheses.

Also adds a pre-copy existence check to launch_from_cache so a missing
cache entry returns a meaningful error instead of a raw ENOENT.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-05-11 17:15:36 -04:00
parent c5a368aee5
commit ca4fddd57f
9 changed files with 62 additions and 35 deletions

View File

@@ -136,6 +136,9 @@ function registerFileHandlers() {
const expanded_temp = (0, file_utils_1.expandPath)(temp_root);
const target = path.join(expanded_temp, filename);
console.log(`Native: Launching from Cache -> ${filename}`);
if (!fs.existsSync(source)) {
return { success: false, error: `File not in cache: ${hash}` };
}
if (!fs.existsSync(expanded_temp))
fs.mkdirSync(expanded_temp, { recursive: true });
// 1. Copy the file to temp folder with original name