sessions get titles, /rename and /rm

- .meta carries a title: the first user line is stored once, /rename
  [ID] TITLE replaces it. Reopening preserves the title and the original
  creation time.
- /sessions shows the title, locally and over the link; the protocol's
  sessions event carries it. Old sessions without a stored title fall back
  to their first user line when listed.
- /rm ID removes a session that is not open: JSONL, meta, saved agent
  profile and logs/<id>; the open session is refused, /rm last resolves
  the newest.
- tests: test_session (auto title, explicit title survives reopen, old-log
  fallback, recursive removal), test_protocol (title, rename, rm, errors),
  test_ui (title, rename, rm). make check green.
This commit is contained in:
lotherk committed 2026-11-16 12:10:06 +00:00
1 parent a01bfe9df1
commit dd135f3b33
18 files changed
+643 -34

No files matched your search

+10 -1
View File
@@ -225,15 +225,24 @@ int sp_session_folder_history(const char *dir, const char *cwd,
int sp_session_load(const struct sp_session_info *, struct sp_conv *conv,
size_t *loaded, struct sp_buf *err);
/* one line of a session listing: id, mtime, bytes; newest first */
/* one line of a session listing: id, title, mtime, bytes; newest first */
struct sp_session_brief {
char id[64];
char title[96]; /* set title, or the first user line */
long mtime;
size_t bytes;
};
/* up to max entries from dir; returns the count (0..max), or -1 */
int sp_session_list(const char *dir, struct sp_session_brief *v,
size_t max);
/* give a session a title (one line, at most 95 bytes) */
int sp_session_set_title(const char *dir, const char *id,
const char *title, struct sp_buf *err);
/*
* Remove a session: its log, meta, saved profile and the logs/<id> directory.
* The caller must not delete the session its engine has open.
*/
int sp_session_delete(const char *dir, const char *id, struct sp_buf *err);
/* ----------------------------------------------------------------- agent */