Milestone 6: canvas for health and leaving

Devices report freshness per vault every 30 s (counts only); the canvas
shows current / behind / offline, held secrets in red, and a Nudge that
reaches the device at its next check-in. Notes kept in two versions can
be compared side by side and tidied on the hub's copy. Handovers are
reviewed in the vault panel; people can be removed from the team and
restored with a one-time link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 09:47:28 +07:00
parent 193cb06f85
commit 8be559817c
15 changed files with 744 additions and 57 deletions

View File

@@ -7,11 +7,27 @@ export interface Vault {
name: string;
can_manage: boolean;
delete_from_devices: boolean;
/** Notes kept in two versions (S4), from the hub's copy. */
tidy: { note: string; copy: string; label: string }[];
/** Departures needing a manager: waiting for the device, or received for review. */
handovers: { id: number; person: string; device: string; state: 'waiting' | 'received' }[];
}
export type Status = 'current' | 'behind' | 'offline';
export interface Health {
status: Status;
last_seen: number | null;
last_synced: number | null;
waiting: number;
held_secrets: number;
holding: boolean;
}
export interface Device {
id: string;
label: string;
health: Health;
}
export interface Person {
@@ -20,6 +36,8 @@ export interface Person {
owner: boolean;
/** Invited but not joined yet. */
invited: boolean;
/** Removed from the team (shown to the owner, restorable). */
removed: boolean;
devices: Device[];
}
@@ -45,6 +63,15 @@ export interface LogEntry {
detail: string;
}
export interface Comparison {
note: string;
copy: string;
label: string;
note_text: string | null;
copy_text: string | null;
note_exists: boolean;
}
export class SignedOut extends Error {}
async function call<T>(method: string, path: string, body?: unknown): Promise<T> {
@@ -77,5 +104,14 @@ export const api = {
vaultSetting: (vault: string, deleteFromDevices: boolean) =>
call<object>('POST', '/api/vaults/settings', { vault, delete_from_devices: deleteFromDevices }),
renameDevice: (deviceId: string, label: string) => call<object>('POST', '/api/devices/rename', { device_id: deviceId, label }),
nudge: (deviceId: string) => call<object>('POST', '/api/nudge', { device_id: deviceId }),
compare: (vault: string, copy: string) => call<Comparison>('POST', '/api/tidy/compare', { vault, copy }),
resolve: (vault: string, copy: string, keep: 'note' | 'copy' | 'both') =>
call<{ message: string }>('POST', '/api/tidy/resolve', { vault, copy, keep }),
handoverShow: (id: number) => call<string[]>('POST', '/api/handovers/show', { id }),
handoverDecide: (id: number, decision: 'keep' | 'discard' | 'skip') =>
call<{ message: string }>('POST', '/api/handovers/decide', { id, decision }),
teamRemove: (person: string) => call<object>('POST', '/api/team/remove', { person }),
teamRestore: (person: string) => call<{ link: string }>('POST', '/api/team/restore', { person }),
removeDevice: (deviceId: string) => call<object>('POST', '/api/device/remove', { device_id: deviceId }),
};