refactor(launcher): modularize launcher config and implement Phase 5 actuators
- Broke down the massive launcher_cfg.svelte into 7 modular sub-components. - Updated electron_relay.ts with Phase 5 presentation controls and manifest tools. - Updated architecture documentation to reflect the new TypeScript-based native bridge.
This commit is contained in:
@@ -139,3 +139,55 @@ export async function launch_presentation({
|
||||
|
||||
return await open_local_file_v2(cleaned_path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Control Presentation (Phase 5)
|
||||
* Sends navigation commands to the active presentation (Next, Prev, Stop).
|
||||
*/
|
||||
export async function control_presentation({
|
||||
app,
|
||||
action
|
||||
}: {
|
||||
app: 'powerpoint' | 'keynote',
|
||||
action: 'next' | 'prev' | 'start' | 'stop'
|
||||
}) {
|
||||
if (!native) return { success: false, error: 'Native bridge not available' };
|
||||
|
||||
// Check if the native bridge has the direct implementation
|
||||
if (native.control_presentation) {
|
||||
return await native.control_presentation({ app, action });
|
||||
}
|
||||
|
||||
// Fallback to generic osascript if direct handler is missing
|
||||
let script = '';
|
||||
if (app === 'powerpoint') {
|
||||
switch (action) {
|
||||
case 'next': script = 'tell application "Microsoft PowerPoint" to next slide of slide show view of active presentation'; break;
|
||||
case 'prev': script = 'tell application "Microsoft PowerPoint" to previous slide of slide show view of active presentation'; break;
|
||||
case 'start': script = 'tell application "Microsoft PowerPoint" to run slide show of active presentation'; break;
|
||||
case 'stop': script = 'tell application "Microsoft PowerPoint" to stop slide show of active presentation'; break;
|
||||
}
|
||||
} else if (app === 'keynote') {
|
||||
switch (action) {
|
||||
case 'next': script = 'tell application "Keynote" to show next'; break;
|
||||
case 'prev': script = 'tell application "Keynote" to show previous'; break;
|
||||
case 'start': script = 'tell application "Keynote" to start (front document)'; break;
|
||||
case 'stop': script = 'tell application "Keynote" to stop'; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (script) {
|
||||
return await run_osascript(script);
|
||||
}
|
||||
|
||||
return { success: false, error: `Unsupported app or action: ${app}/${action}` };
|
||||
}
|
||||
|
||||
/**
|
||||
* List Tools (Self-Documentation)
|
||||
* Returns a JSON manifest of all available native bridge functions.
|
||||
*/
|
||||
export async function list_tools() {
|
||||
if (!native || !native.list_tools) return [];
|
||||
return await native.list_tools();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user