Merge fix/post-sessions-response-shape: POST /sessions returns full shape

This commit is contained in:
jay 2026-05-16 22:18:54 +02:00
commit 2c627ea095
1 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/**
* S-09 multi-session CRUD routes.
*
* POST /sessions { id, name }
* POST /sessions { id, name, state, lastOutputAt }
* GET /sessions [{ id, name, description, state, lastOutputAt }]
* PATCH /sessions/:id updates @description
* DELETE /sessions/:id kills tmux session, optionally clears buffer
@ -110,7 +110,9 @@ async function handleCreate(
try {
const id = await spawnSession({ name });
sendJson(res, 201, { id, name });
// Include state + lastOutputAt to match the GET /sessions response shape
// so iOS clients can decode the response with the same type.
sendJson(res, 201, { id, name, state: "idle", lastOutputAt: "" });
} catch (err) {
sendJson(res, 500, { error: "internal_error", message: String(err) });
}