feat(claw): delete a session and its turn history over http
A session the human is done with has to be removable, and removing it
must mean forgetting it: `DELETE /v1/sessions/{key}` drops the dispatch
record and the turn history recorded under the key, so re-creating the
same name starts an empty chat instead of replaying someone else's
turns. The route refuses a leased key, because the running turn's own
save would either fail against the missing record or write the session
back after the delete; the inventory is not narrowed to the
`interactive:` prefix, so a forge key deletes on the same route.
The history purge rides the hub, which owns the turn table, and it
lands after the record does: the purge is the one step this side cannot
undo, so it never runs for a delete the dispatcher refused. Purging on
the no-record path as well is what makes a half-done delete repairable
— a retried DELETE finishes the purge instead of 404-ing with the old
turns still under the key, where a session created again under the same
name would replay them.
The sessions routes stay off the agent token's allowlist in
tools/contract: the agent must not be able to delete the conversation
it is serving.
This commit is contained in:
1 parent
263184ff8e
commit
8db1e2aa11
5 files changed
+375
-2
No files matched your search
@@ -126,6 +126,7 @@ POST /v1/sessions {"name"} — create an empty interactive se
|
||||
POST /v1/sessions/{key}/messages {"text": "..."} -> 202
|
||||
GET /v1/sessions/{key}/events SSE turn events (see below); ?since=<seq> resumes a cursor
|
||||
GET /v1/sessions/{key}/history one page of older turns: ?before=<seq>&limit=<n>
|
||||
DELETE /v1/sessions/{key} drop a session and its turn history
|
||||
GET /v1/watches POST /v1/watches DELETE /v1/watches/{forge}/{repo}
|
||||
GET /v1/bootstrap {"soul": bool, "user": bool}
|
||||
POST /v1/ingest {"source","key","payload"} -> 202
|
||||
|
||||
Reference in new issue
Block a user