persona: the simulator's report says why an Interpreter step kept nothing
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
37a3c83a20
commit
e13824cabc
1 changed files with 4 additions and 1 deletions
|
|
@ -213,7 +213,7 @@ fn done(row: &Value, after: &Value) -> Value {
|
|||
let intentions: Vec<Value> = changes().filter(|change| change["family"] == "intend").map(|change| json!({ "change": change["change"], "id": change["id"], "words": words(change["id"].as_str().unwrap_or_default()) })).collect();
|
||||
let identity: Vec<&Value> = changes().filter(|change| change["family"] == "self" && change["change"] == "identity").map(|change| &change["id"]).collect();
|
||||
let refused: Vec<String> = row["refused"].as_array().into_iter().flatten().map(|refusal| format!("{}: {}", refusal["family"].as_str().unwrap_or_default(), refusal["reason"].as_str().map_or_else(|| refusal["reason"].to_string(), str::to_owned))).collect();
|
||||
json!({ "status": row["status"], "deltas": deltas, "intentions": intentions, "identity": identity, "refused": refused })
|
||||
json!({ "status": row["status"], "error": row["error"], "deltas": deltas, "intentions": intentions, "identity": identity, "refused": refused })
|
||||
}
|
||||
|
||||
fn speaker(line: &Line, member: &Member, operators: &[String], cast: &[String]) -> Speaker {
|
||||
|
|
@ -739,6 +739,9 @@ fn transcript_line(line: &Value) -> String {
|
|||
/// the identity fields changed and what the guards refused with why. Nothing when no Interpreter ran.
|
||||
fn interpreter_words(did: &Value) -> Vec<String> {
|
||||
let mut out = Vec::new();
|
||||
if let Some(error) = did["error"].as_str() {
|
||||
out.push(format!("kept nothing: {}", one_line(error)));
|
||||
}
|
||||
let deltas: Vec<String> = did["deltas"].as_object().into_iter().flatten().map(|(what, count)| format!("{what} x{count}")).collect();
|
||||
out.push(format!("deltas: {}", if deltas.is_empty() { "none".to_owned() } else { deltas.join(", ") }));
|
||||
for intention in did["intentions"].as_array().into_iter().flatten() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue