Skip to content

Commit eacd2a0

Browse files
feat(Handler/ext-host-proxy): Add handler for proxying extension host API calls
- Implements new proxy handler in Mountain backend to forward extension host requests to Cocoon sidecar process via Vine IPC - Creates basic scaffolding for RPC communication between Sky UI and extension host process - Uses placeholder process ID (1234) temporarily until dynamic process management is implemented - Includes initial argument handling that will be expanded with structured API call validation - Prepares ground for running VS Code extensions by enabling command proxying through Track dispatcher - Required for MVP Path A strategy to reuse existing extensions via Cocoon shim layer - TODOs indicate future work needed for production readiness (process ID management, payload validation)
1 parent f51417b commit eacd2a0

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Source/handlers/proxy.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use serde_json::{json, Value};
2+
use tauri::{AppHandle, Runtime, Window};
3+
use crate::vine; // Use the Vine IPC layer
4+
5+
pub async fn handle_ext_host_proxy<R: Runtime>(
6+
_app: AppHandle<R>,
7+
_window: Window<R>,
8+
args: Vec<Value>,
9+
) -> Result<Value, String> {
10+
println!("[Proxy Handler] Proxying call to Cocoon: {:?}", args);
11+
// TODO: Identify target Cocoon process instance
12+
let target_process_id = 1234; // Placeholder
13+
14+
// TODO: Robust arg handling - expect specific structure for API call
15+
let request_payload = args.get(0).cloned().unwrap_or(json!(null));
16+
17+
// Use Vine to send the request and await response
18+
match vine::send_to_sidecar(target_process_id, request_payload).await {
19+
Ok(response) => Ok(response),
20+
Err(e) => Err(format!("Cocoon IPC Error: {}", e)),
21+
}
22+
}

0 commit comments

Comments
 (0)