Files
Hermit/include/cst_parliament.h
T
WHCandCursor de9ee28773 feat: password Realm, single-chair login, shared parliament context (0.9.12)
Derive Realm keys from a user password (Argon2id, no private key on disk).
Login claims the sole chair with handover; peers share parliament context;
--new-project clears it. CLI peer/discover helpers and Docker alpine recipe
included; headless empty-answer retries raised for unattended runs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-28 23:06:51 +08:00

52 lines
1.6 KiB
C

#ifndef CST_PARLIAMENT_H
#define CST_PARLIAMENT_H
#include "cst_realm.h"
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Parliament is one shared whole across agents. Password unlock claims the
* single chair on the logging-in device; peers sync the same context. A new
* project replaces all parliament context. */
typedef struct {
char parliament_id[64];
char project_id[64];
char chair_instance[64];
char chair_device[128];
unsigned long revision;
char status[32]; /* idle | open | dissolved */
} cst_parliament_meta_t;
int cst_parliament_path(char *out, size_t n);
int cst_parliament_load(cst_parliament_meta_t *m);
int cst_parliament_save(const cst_parliament_meta_t *m);
/* Login: unlock Realm with password, enroll/ensure instance, claim chair,
* return handover summary (malloc'd) or NULL. */
char *cst_parliament_login(const char *password, const char *instance_id,
const char *device_label, char *err, size_t err_sz);
/* Only one chair: previous chair is demoted; handover notes left in meta. */
int cst_parliament_claim_chair(const char *instance_id, const char *device_label);
/* Probe local environment as device-private context (malloc'd text). */
char *cst_parliament_device_context(void);
/* New project: wipe shared parliament context; keep Realm keys. */
int cst_parliament_new_project(const char *project_id);
/* Append/replace synchronized context blob (all agents share this file). */
int cst_parliament_context_put(const char *text);
char *cst_parliament_context_get(void);
#ifdef __cplusplus
}
#endif
#endif