Cotal TypeScript packages
    Preparing search index...

    Interface MeshEntry

    The registry of meshes this machine can reach, so a cotal spawn from any directory can find which mesh to join, with which creds and personas. One record per broker cotal up started here, plus any an operator registered by hand with cotal meshes add — a mesh running on another machine, which no local command could otherwise describe. MeshEntry.origin is which, and decides what may delete the record without being told to.

    Stored as one JSON file per mesh (~/.cotal/meshes/<space>.json) rather than a single meshes.json: concurrent up/down never read-modify-write the same file (no lost-update race), a crash damages at most one entry, and it mirrors the existing per-process pid files under ~/.cotal. A separate ~/.cotal/current-mesh holds the default space from any directory (the kubectl current-context analogue).

    Each record stores the mesh's root path, not its secrets — trust material stays in that project's .cotal/auth; the registry just makes it findable from elsewhere.

    interface MeshEntry {
        attachHost?: string;
        catalogError?: string;
        catalogFetchedAt?: string;
        catalogId?: string;
        catalogKind?: string;
        catalogName?: string;
        catalogOwner?: string;
        catalogRole?: string;
        catalogRoot?: string;
        catalogSlug?: string;
        maxFileStore?: number;
        maxSessions?: number;
        mode: "auth" | "open" | "user";
        nativeHost?: string;
        nativeMembers?: {
            process: { pid: number; token: string };
            role: "auth" | "broker" | "delivery" | "manager";
        }[];
        origin?: "catalog"
        | "up"
        | "manual";
        policy?: { eventPayloads?: "withheld"; events?: "required" };
        policyCheckedAt?: string;
        root: string;
        server: string;
        space: string;
        stoppedByDown?: true;
        stoppedWithAgents?: true;
        storeDir?: string;
        tlsRequired?: boolean;
        ts: string;
        unchecked?: boolean;
        unencryptedOverlay?: boolean;
        userAuth?: UserAuthInfo;
    }
    Index
    attachHost?: string

    The host the operator bound this mesh to, when they bound it somewhere reachable (up --host). It is the manager's attach/console BIND address, and it is recorded because it is a DECISION, not a derivable fact: a broker dial address is deliberately not treated as a manager bind address (see the note in Manager's constructor), so nothing downstream can reconstruct it. Every later manager launch for this mesh — same-root repair, adopting a preserved listener, a manifest deploy — reads it back, or the attach face silently reverts to loopback and remote cotal attach dies. Absent means the operator never asked for exposure: loopback, as before.

    catalogError?: string
    catalogFetchedAt?: string
    catalogId?: string

    Provider catalog metadata used only for display and snapshot reconciliation.

    catalogKind?: string
    catalogName?: string
    catalogOwner?: string

    Opaque account key for a catalog-owned record. Present iff origin === "catalog"; it keeps two signed-in accounts at one IdP separate without persisting the subject in the registry.

    catalogRole?: string
    catalogRoot?: string

    The machine-home catalog root that keeps a discovered space's provider-owned client material after its project root is bound elsewhere. Present only on catalog entries. An unbound catalog entry has root === catalogRoot; setup may move root to a project while this custody root and userAuth.sentinelCredsPath stay unchanged.

    catalogSlug?: string
    maxFileStore?: number

    The JetStream file storage cap in bytes the running broker was started with (cotal up --max-file-store). down --preserve-state copies it into the preserved launch so the resume re-renders it, and a refresh compares a requested cap against it. Absent means the broker runs on nats-server's dynamic default.

    maxSessions?: number

    The operator-set live-session ceiling for this mesh's manager (cotal up --max-sessions / cotal supervise --max-sessions). Recorded because it is a DECISION, not a derivable fact: the plane defaults to 64 when the option is omitted, and a same-root repair, resume, or spawn -f that restarts the manager without this field silently drops a raised ceiling back to 64. Absent means the operator never asked: the default stands. The browser console opens one session per pane, so the right number is roughly agents × panes.

    mode: "auth" | "open" | "user"

    How the broker authenticates: static per-agent JWT creds (auth), none (open), or per-USER auth (user) — login + bearer through the space's auth service. user is its own connect path: it must never be treated as auth with missing creds, nor as open.

    nativeHost?: string

    Creation-pinned native members retained when the project folder is moved or deleted.

    nativeMembers?: {
        process: { pid: number; token: string };
        role: "auth" | "broker" | "delivery" | "manager";
    }[]
    origin?: "catalog" | "up" | "manual"

    Who put this record here — and therefore what may take it out. up (the default, and what any record written without the field is) means THIS machine started the mesh. A liveness verdict does not delete it: the record is the restart authority for this root, so a dead broker is reported offline until cotal down or cotal meshes rm names it. A mismatch (credentials rejected, mode flipped, or the root's on-disk auth now belonging to a different space) still drops an up record, because connecting through it would be wrong. cotal down / cotal clean all still drop it when they tear down this root, because cotal up writes it back. manual means an operator registered it by hand (cotal meshes add) — typically a mesh running on another machine, whose record nothing here can reconstruct.

    A manual record is removed or downgraded only by an act that NAMES it, or by a launch that demonstrably BECOMES that mesh:

    • cotal meshes rm (drops it) and cotal meshes add --force (replaces it);
    • a cotal up that actually starts the broker for that same space, server and root — it now runs the mesh, so it claims the record and cotal down clears it again. Nothing else infers its way past: not the liveness sweep, not the classified preflight prune, not cotal down / cotal clean all sweeping a shared root, and not a cotal up REFRESH that merely found a broker already answering (it starts nothing, so it keeps the origin). A cotal up for that space anywhere else refuses outright rather than reclaim the name.
    policy?: { eventPayloads?: "withheld"; events?: "required" }

    Closed space policy carried by a user-auth registration. Absent preserves the generic launch behavior; events: "required" forbids a connector session from joining without its event plane.

    policyCheckedAt?: string

    Last successful or attempted trusted policy refresh for a pre-policy manual user registration.

    root: string

    Absolute project root for this mesh's personas. Catalog credentials may remain at catalogRoot.

    server: string

    The broker URL, e.g. nats://127.0.0.1:4222.

    space: string

    The space name — also the registry filename stem.

    stoppedByDown?: true

    This folder's completed legacy down kept the registration. The next up clears this receipt.

    stoppedWithAgents?: true

    The completed legacy down also confirmed the manager's shutdown with agent retirement.

    storeDir?: string

    The JetStream store directory the broker was started with (cotal up --store-dir, or the root's default), as a resolved absolute path. A same-root repair up reopens it; an explicit --store-dir that disagrees is refused. Absent means the record was written before this field existed, and a repair then opens the root's default store and says so.

    tlsRequired?: boolean

    TLS-REQUIRED CLIENT INTENT: this broker serves TLS, so every first-party connection resolved through this record must REQUIRE it rather than merely tolerate it. Absent means no such decision was recorded (and is what any record written before this field means).

    It is deliberately a bare flag and NOT the cert or key paths. Those live in the broker launch policy under the workspace root, because this record is machine-home state that feeds status output, join links and mesh messages — none of which should carry a path to a private key.

    Why the flag has to exist at all, rather than clients inferring TLS from the broker: a NATS client that omits the requirement still CONNECTS to a TLS broker, by upgrading the same socket once it reads tls_required in the server's INFO. But that INFO is unauthenticated plaintext, so an on-path attacker can forge one without it — and a client with no requirement of its own will then send its credentials in the clear. The flag is what turns "encrypted if the server says so" into "encrypted or refuse".

    ts: string

    ISO timestamp of when the record was written.

    unchecked?: boolean

    Present and true when space add --force wrote the record without checking the broker, so its mode is what the operator gave, not what the broker was seen to enforce. Absent means it was checked, or the record predates this field.

    unencryptedOverlay?: boolean

    Present and true when the operator EXPLICITLY accepted registering an overlay address that this build cannot encrypt (--allow-unencrypted-overlay). Recorded rather than inferred: the address class is re-derivable from server, but CONSENT is not, and a dial that happens long after the tunnel went down should be able to tell that a human agreed to the dependency rather than reading agreement out of an address. Absent means no such acceptance was given, which is every record written before the flag existed.

    userAuth?: UserAuthInfo

    The user-auth client metadata, present iff mode === "user" — how a connect from any directory on THIS machine finds the login target and exchange. Local operator config, not broker truth: it lives under the user's protected registry dir and is trusted the way the registry itself is; remote/cross-machine discovery is explicitly out of its scope.