Extend square-hole creation flow with visual asset timeout guard

This commit is contained in:
kdletters
2026-05-05 15:27:09 +08:00
parent 2252afb080
commit 60b667a9d1
30 changed files with 2838 additions and 215 deletions

View File

@@ -17,15 +17,14 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection.procedures().create_square_hole_agent_session_then(
procedure_input,
move |_, result| {
connection
.procedures()
.create_square_hole_agent_session_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_agent_session_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -67,15 +66,14 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection.procedures().submit_square_hole_agent_message_then(
procedure_input,
move |_, result| {
connection
.procedures()
.submit_square_hole_agent_message_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_agent_session_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -126,14 +124,15 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.compile_square_hole_draft_then(procedure_input, move |_, result| {
connection.procedures().compile_square_hole_draft_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_agent_session_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -151,20 +150,25 @@ impl SpacetimeClient {
summary_text: input.summary_text,
tags_json: input.tags_json,
cover_image_src: input.cover_image_src,
background_prompt: input.background_prompt,
background_image_src: input.background_image_src,
shape_options_json: input.shape_options_json,
hole_options_json: input.hole_options_json,
shape_count: input.shape_count,
difficulty: input.difficulty,
updated_at_micros: input.updated_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.update_square_hole_work_then(procedure_input, move |_, result| {
connection.procedures().update_square_hole_work_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_work_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -182,14 +186,15 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.publish_square_hole_work_then(procedure_input, move |_, result| {
connection.procedures().publish_square_hole_work_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_work_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -221,14 +226,15 @@ impl SpacetimeClient {
procedure_input: SquareHoleWorksListInput,
) -> Result<Vec<SquareHoleWorkProfileRecord>, SpacetimeClientError> {
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.list_square_hole_works_then(procedure_input, move |_, result| {
connection.procedures().list_square_hole_works_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_works_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -244,14 +250,15 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.get_square_hole_work_detail_then(procedure_input, move |_, result| {
connection.procedures().get_square_hole_work_detail_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_work_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -267,14 +274,15 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.delete_square_hole_work_then(procedure_input, move |_, result| {
connection.procedures().delete_square_hole_work_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_works_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -291,14 +299,15 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.start_square_hole_run_then(procedure_input, move |_, result| {
connection.procedures().start_square_hole_run_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_run_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -341,21 +350,21 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.drop_square_hole_shape_then(procedure_input, move |_, result| {
connection.procedures().drop_square_hole_shape_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_drop_shape_procedure_result)
.map(|mut confirmation| {
if confirmation.accepted {
confirmation.run.last_confirmed_action_id =
Some(client_event_id);
confirmation.run.last_confirmed_action_id = Some(client_event_id);
}
confirmation
});
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -395,14 +404,15 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.restart_square_hole_run_then(procedure_input, move |_, result| {
connection.procedures().restart_square_hole_run_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_run_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}
@@ -418,14 +428,15 @@ impl SpacetimeClient {
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.finish_square_hole_time_up_then(procedure_input, move |_, result| {
connection.procedures().finish_square_hole_time_up_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_square_hole_run_procedure_result);
send_once(&sender, mapped);
});
},
);
})
.await
}