import type { Problem } from '../application/types.js'; import type { TopologyNodeKind } from './topology.js'; /** * Durable storage for *sketches*: nodes the owner has drawn but not yet added to * the fleet, and where every node sits on the canvas. * * This file is deliberately invisible to `loadConfig`. An incomplete agent in * `roles:` would be started by `ours-fleet up`, and an incomplete watchdog or * loop is a hard `ConfigError` that makes the entire fleet unloadable — so a * draft cannot live in fleet.yaml at all. Being outside the config also makes * "visible but not launchable" true at the daemon level rather than in the UI. * * Nothing here is authoritative and nothing here is a secret: the schema admits * only presentational coordinates and a small allowlist of plain draft fields, * so `env:`/`vars:` values can never reach it. */ export declare const TOPOLOGY_DRAFT_VERSION = 1; export type DraftFieldValue = string | number | boolean; export interface DraftPosition { x: number; y: number; } export interface DraftNode { id: string; kind: TopologyNodeKind; fields: Record; } export interface DraftEdge { kind: 'oversees' | 'watches' | 'targets'; from: string; to: string; } export interface DraftTutorial { step: number; dismissed: boolean; } export interface TopologyDraft { version: number; positions: Record; drafts: { nodes: DraftNode[]; edges: DraftEdge[]; }; tutorial: DraftTutorial; } export interface TopologyDraftRead { draft: TopologyDraft; revision: string; /** Set when the stored file was unusable and an empty draft is being served. */ problem?: Problem; /** False when the file was written by a newer console and must not be clobbered. */ writable: boolean; } export interface TopologyDraftWriteResult { draft: TopologyDraft; revision: string; } export declare const emptyDraft: () => TopologyDraft; export interface TopologyDraftStoreOptions { dir?: string; } export declare class TopologyDraftStore { readonly path: string; private readonly dir; constructor(options?: TopologyDraftStoreOptions); /** * Never throws. A missing, unreadable, oversized, malformed or future-version * sidecar degrades to an empty draft plus a `problem` the console can show as * a banner — losing sketches is bad, but blocking the console on them is worse. */ read(): TopologyDraftRead; /** * Revision-guarded, atomic, 0600. Strict on the way in: an out-of-bounds * coordinate, an unknown field or an unparseable id is refused with a reason * rather than silently dropped, because the caller is the console's own * editor and a silent drop would look like data loss. */ write(baseRevision: string, next: unknown): Promise; private readRaw; }