feat: add config-owned direct submit runtime
Keep browser-attached workflows on the configured direct-skill path and align the Zhihu export/browser regression contracts with the current ws merge state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -667,7 +667,7 @@ fn normalize_callback_result(
|
||||
}))
|
||||
}
|
||||
"eval" if result.callback == EVAL_CALLBACK_NAME => {
|
||||
let value = result.payload.get("value").and_then(Value::as_str)?;
|
||||
let value = result.payload.get("value")?.clone();
|
||||
Some(BrowserCallbackResponse::Success(BrowserCallbackSuccess {
|
||||
success: true,
|
||||
data: json!({ "text": value }),
|
||||
@@ -1403,4 +1403,36 @@ mod tests {
|
||||
other => panic!("expected Success, got {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn normalize_callback_result_path_a_eval_accepts_structured_value_payload() {
|
||||
let request = make_request("eval");
|
||||
let result = CallbackResult {
|
||||
callback: "sgclawOnEval".to_string(),
|
||||
request_url: "http://127.0.0.1:17888/sgclaw/browser-helper.html".to_string(),
|
||||
target_url: Some("https://www.zhihu.com/hot".to_string()),
|
||||
action: Some("sgBrowserExcuteJsCodeByDomain".to_string()),
|
||||
payload: json!({
|
||||
"value": {
|
||||
"source": "https://www.zhihu.com/hot",
|
||||
"rows": [[1, "问题一", "344万"]]
|
||||
}
|
||||
}),
|
||||
};
|
||||
|
||||
let response = normalize_callback_result(&request, result, Duration::from_millis(10));
|
||||
assert!(response.is_some(), "Path A eval should accept structured values");
|
||||
match response.unwrap() {
|
||||
super::super::callback_backend::BrowserCallbackResponse::Success(s) => {
|
||||
assert_eq!(
|
||||
s.data.get("text").unwrap(),
|
||||
&json!({
|
||||
"source": "https://www.zhihu.com/hot",
|
||||
"rows": [[1, "问题一", "344万"]]
|
||||
})
|
||||
);
|
||||
}
|
||||
other => panic!("expected Success, got {other:?}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user