| 898 | } |
| 899 | |
| 900 | fn tool_result_from_core(result: a3s_code_core::ToolCallResult) -> ToolResult { |
| 901 | ToolResult { |
| 902 | name: result.name, |
| 903 | output: result.output, |
| 904 | exit_code: result.exit_code, |
| 905 | metadata_json: result.metadata.as_ref().map(serde_json::Value::to_string), |
| 906 | document_runtime_json: result |
| 907 | .metadata |
| 908 | .as_ref() |
| 909 | .and_then(|metadata| metadata.get("document_runtime")) |
| 910 | .map(serde_json::Value::to_string), |
| 911 | error_kind_json: result |
| 912 | .error_kind |
| 913 | .as_ref() |
| 914 | .and_then(|k| serde_json::to_string(k).ok()), |
| 915 | } |
| 916 | } |
| 917 | |
| 918 | fn normalize_program_script_options(options: serde_json::Value) -> napi::Result<serde_json::Value> { |
| 919 | let obj = options |