diff --git a/skills b/skills index 1aa59d848..8030aef02 160000 --- a/skills +++ b/skills @@ -1 +1 @@ -Subproject commit 1aa59d8483918e467eb416270c4e1c8f6ef73fe2 +Subproject commit 8030aef027b7227b2fd63bf1e31bdf9d8e806383 diff --git a/src-tauri/src/runtime/qjs_skill_instance.rs b/src-tauri/src/runtime/qjs_skill_instance.rs index e57d5c234..795752dcd 100644 --- a/src-tauri/src/runtime/qjs_skill_instance.rs +++ b/src-tauri/src/runtime/qjs_skill_instance.rs @@ -459,6 +459,17 @@ async fn handle_message( let result = handle_js_void_call(ctx, "onTick", "{}").await; let _ = reply.send(result); } + SkillMessage::Error { error_type, message, source, recoverable } => { + let args = serde_json::json!({ + "type": error_type, + "message": message, + "source": source, + "recoverable": recoverable, + }); + if let Err(e) = handle_js_void_call(ctx, "onError", &args.to_string()).await { + log::warn!("[skill:{}] onError() handler failed: {e}", skill_id); + } + } SkillMessage::Rpc { method, params, reply } => { let result = match method.as_str() { "oauth/complete" => { diff --git a/src-tauri/src/runtime/types.rs b/src-tauri/src/runtime/types.rs index 2abe6945c..7616e6065 100644 --- a/src-tauri/src/runtime/types.rs +++ b/src-tauri/src/runtime/types.rs @@ -86,6 +86,13 @@ pub enum SkillMessage { Tick { reply: tokio::sync::oneshot::Sender>, }, + /// Notify the skill of an error from an async operation. + Error { + error_type: String, + message: String, + source: Option, + recoverable: bool, + }, /// Generic JSON-RPC call (for methods not covered by specific variants). Rpc { method: String,