| 2653 | // ============================================================================= |
| 2654 | |
| 2655 | const char* rcli_action_execute(RCLIHandle handle, const char* action_name, const char* args_json) { |
| 2656 | if (!handle || !action_name) return ""; |
| 2657 | auto* engine = static_cast<RCLIEngine*>(handle); |
| 2658 | |
| 2659 | std::lock_guard<std::mutex> lock(engine->mutex); |
| 2660 | auto result = engine->actions.execute(action_name, args_json ? args_json : "{}"); |
| 2661 | |
| 2662 | engine->last_action_result = result.raw_json; |
| 2663 | |
| 2664 | if (engine->action_cb) { |
| 2665 | engine->action_cb(action_name, result.raw_json.c_str(), result.success ? 1 : 0, engine->action_ud); |
| 2666 | } |
| 2667 | |
| 2668 | return engine->last_action_result.c_str(); |
| 2669 | } |
| 2670 | |
| 2671 | const char* rcli_action_list(RCLIHandle handle) { |
| 2672 | if (!handle) return "[]"; |