feat: /realm in TUI, daemon instance takeover (0.9.16)

Pidfile records instance+port; login restarts the service when the seat
changes. TUI /realm status|login|stop; prompts discourage filler chatter.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WHC
2026-10-29 11:00:34 +08:00
co-authored by Cursor
parent e610d70c30
commit a3e115539e
8 changed files with 202 additions and 24 deletions
+9 -2
View File
@@ -449,7 +449,10 @@ char *cst_parliament_status_text(void) {
cst_parliament_load(&m);
char sid[64] = {0};
int sess = cst_parliament_session_ok(sid, sizeof(sid));
int svc = cst_parliament_daemon_running();
int svc_pid = 0, svc_port = 0;
char svc_id[64] = {0};
int svc = cst_parliament_daemon_info(&svc_pid, svc_id, sizeof(svc_id),
&svc_port) == 0;
cst_buf_printf(&b, "realm %s\n", pw ? "password" : "file-keys/legacy");
cst_buf_printf(&b, "parliament %s project=%s rev=%lu\n",
m.status[0] ? m.status : "idle",
@@ -460,6 +463,10 @@ char *cst_parliament_status_text(void) {
m.chair_device[0] ? " @ " : "", m.chair_device);
cst_buf_printf(&b, "login %s%s%s\n", sess ? "ok" : "required",
sess && sid[0] ? " as " : "", sess ? sid : "");
cst_buf_printf(&b, "service %s\n", svc ? "running" : "stopped");
if (svc)
cst_buf_printf(&b, "service running pid=%d id=%s port=%d\n", svc_pid,
svc_id[0] ? svc_id : "-", svc_port);
else
cst_buf_puts(&b, "service stopped\n");
return cst_buf_steal(&b);
}