Name a session in the import list, and let one be deleted
Three things about finding a session in a list of seventy, and one about getting rid of it. **A name beats anything inferred.** `/rename` appends a `custom-title` record, so if somebody has said what a session is, that is the row. Eleven of the seventy here turned out to be named already and none of it showed. **Otherwise the last thing said, not the first.** The question this list answers is "which one was I just in", and a session's opening line is the least distinctive thing about it -- several of these begin with the same slash command. Finding that last message took three tries, and the two wrong ones are worth recording because they failed in opposite directions. Grepping the user record type caught tool results, which are *also* user records -- so a session that ended mid-tool showed a tail of empty records and a row saying nothing was said, when plenty had been. Narrowing to a string `content` fixed those two and broke twenty others, because a message carrying an attachment stores its text in a list. Excluding `tool_use_id` keeps both shapes of a real message and drops the one that is not: seven rows still have nothing to show, and those are sessions that really are empty. **Sorted by when it was last used**, and the time is on the row. Naming was tried as the first sort key and is a worse list -- it buries what somebody was just doing under everything they ever named. A name is for recognising a row, not for ordering it, so it stays as the title and as a word beside it. **And a session can be deleted**, which is asked before it is done. The transcript *is* the session, so this ends any chance of resuming that conversation, and the dialog says exactly that rather than "are you sure?". Deletion resolves the id against what the machine reported, like importing, so no path crosses the wire in either direction. Looked at on the emulator, including the dialog -- which is where the delete button turned out to be missing entirely after a patch that compiled fine, and where the row layout got its second look.
This commit is contained in:
1 parent
6bbc829a3e
commit
233689ced6
4 files changed
+223
-39
No files matched your search
@@ -53,6 +53,10 @@ pub fn router(manager: Arc<SessionManager>) -> Router {
|
||||
.route("/setups", get(list_setups).post(add_setup))
|
||||
.route("/setups/probe", post(probe_setup))
|
||||
.route("/setups/{id}/importable", get(list_importable))
|
||||
.route(
|
||||
"/setups/{id}/importable/{session}",
|
||||
delete(delete_importable),
|
||||
)
|
||||
.route(
|
||||
"/setups/{id}",
|
||||
get(read_setup).put(update_setup).delete(delete_setup),
|
||||
@@ -398,6 +402,25 @@ async fn list_importable(
|
||||
Ok(axum::Json(found))
|
||||
}
|
||||
|
||||
/// Removes a Claude Code session from a machine.
|
||||
///
|
||||
/// The transcript *is* the session, so this ends any chance of resuming
|
||||
/// that conversation -- including from an ai-app session already importing
|
||||
/// it. The phone confirms before calling this; the server does not
|
||||
/// second-guess a decision somebody was shown the cost of.
|
||||
async fn delete_importable(
|
||||
State(manager): State<Arc<SessionManager>>,
|
||||
UrlPath((id, session)): UrlPath<(String, String)>,
|
||||
) -> Result<StatusCode, ApiError> {
|
||||
let setup = setup_by_id(&manager, &id)?;
|
||||
let transport = crate::session::transport::Transport::for_setup(&setup);
|
||||
crate::session::import::delete(&transport, &session)
|
||||
.await
|
||||
.map_err(bad_request)?;
|
||||
tracing::info!("deleted Claude Code session {session} from setup {id}");
|
||||
Ok(StatusCode::NO_CONTENT)
|
||||
}
|
||||
|
||||
async fn spawn_session(
|
||||
State(manager): State<Arc<SessionManager>>,
|
||||
axum::Json(body): axum::Json<SpawnRequest>,
|
||||
|
||||
Reference in new issue
Block a user