mise API - v0.0.0
    Preparing search index...

    Interface HostedEngine

    The engine the daemon drives. Matches chell's ChellEngine structurally, so a real chell engine is assignable to it without calypso depending on chell.

    interface HostedEngine {
        ambient_listen?(listener: (event: AmbientEvent) => void): () => void;
        command_stopped?(): boolean;
        file_read?(filePath: string): Promise<Buffer<ArrayBufferLike>>;
        file_stream?(
            filePath: string,
        ): Promise<{ size?: number; stream: ReadableStream }>;
        file_write?(filePath: string, bytes: Buffer): Promise<void>;
        joblets_running?(): { line: string; number: number; waiting: boolean }[];
        line_abort?(id?: string): boolean;
        line_cancel?(id?: string): boolean;
        line_complete(linePrefix: string): Promise<CompletionResult>;
        line_execute(
            line: string,
            options?: { id?: string; origin?: string },
        ): Promise<
            {
                errors?: { message: string; type: "error"
                | "warning" }[];
                model?: { data: unknown; kind: string };
                rendered: string;
                renderedErr?: string;
                status: "error" | "ok";
                trace?: {
                    executed?: string;
                    input: string;
                    proposed: string;
                    validated: boolean;
                };
            }[],
        >;
        line_holds?(line: string): string[] | "all";
        origin_forget?(origin: string): void;
        regard_get?(): | {
            address: string;
            groupId: string;
            modelKind?: string;
            paneId: string;
        }
        | null;
        regard_note?(
            regard: {
                address: string;
                groupId: string;
                modelKind?: string;
                paneId: string;
            },
        ): void;
        sink_install?(sink: OutputSink): void;
        surface_install?(surface: Surface): void;
        watch_release?(owner: string): void;
        watch_set?(
            subject: string,
            owner: string,
            on: boolean,
        ): "live" | "settled" | "stale" | null;
    }
    Index
    • Subscribes to events the engine originates on its own, which the daemon relays to every surface off the scrollback.

      Parameters

      • listener: (event: AmbientEvent) => void

        Receives each ambient event.

      Returns () => void

      Function that unsubscribes.

    • Reads one ChRIS file's raw bytes, resolved against the session's working directory. When the engine provides it, the daemon exposes a token-gated /vfs HTTP route so browser surfaces can render file content natively (images in a panel) instead of through the terminal stream.

      Parameters

      • filePath: string

        The file's path (absolute or cwd-relative).

      Returns Promise<Buffer<ArrayBufferLike>>

      The file's bytes.

    • Opens one file's bytes as a stream. The seam behind GET /vfs when the engine has it: a download is served as it arrives, with its length when known, and never held whole in the daemon.

      Parameters

      • filePath: string

        The file's path (absolute or cwd-relative).

      Returns Promise<{ size?: number; stream: ReadableStream }>

      The stream and its size when known.

    • Writes bytes to one ChRIS path. The seam behind POST /vfs, which is how a surface with no reach into a filesystem (a browser) delivers a file the operator picked.

      Parameters

      • filePath: string

        The destination path.

      • bytes: Buffer

        The content to write.

      Returns Promise<void>

    • The joblets running now (line &), for the heartbeat: what a restart would end.

      Returns { line: string; number: number; waiting: boolean }[]

      Them, by number.

    • Aborts a running command, cancellable or not (STOP).

      Parameters

      • Optionalid: string

      Returns boolean

    • Requests cancellation of a running command when it supports it.

      Parameters

      • Optionalid: string

        The line, as the daemon named it.

      Returns boolean

      True when the command accepted the request.

    • Executes one input line, yielding one envelope per executed command.

      Parameters

      • line: string

        The raw input line.

      • Optionaloptions: { id?: string; origin?: string }

        The surface the line came from (what it lists is that surface's answer), and the daemon's name for the line, which its STOP names.

      Returns Promise<
          {
              errors?: { message: string; type: "error"
              | "warning" }[];
              model?: { data: unknown; kind: string };
              rendered: string;
              renderedErr?: string;
              status: "error" | "ok";
              trace?: {
                  executed?: string;
                  input: string;
                  proposed: string;
                  validated: boolean;
              };
          }[],
      >

      The envelopes of the executed commands, in order.

    • What a line holds of the session while it runs: the pieces it changes (none for a read), or 'all'. Lines holding nothing in common run side by side; an engine that cannot say runs every line alone.

      Parameters

      • line: string

        The line.

      Returns string[] | "all"

      Its pieces, or 'all'.

    • Forgets what a surface left behind (its last answer), when it has gone.

      Parameters

      • origin: string

        The surface's id.

      Returns void

    • Returns the engine's retained regard, or null before the first indication.

      Returns { address: string; groupId: string; modelKind?: string; paneId: string } | null

      The retained regard, or null.

    • Notes a regard write relayed from a surface, retaining it as session truth engine-side. Optional: a daemon still retains and rebroadcasts regard on the wire without it.

      Parameters

      • regard: { address: string; groupId: string; modelKind?: string; paneId: string }

        The indicated address with its provenance.

      Returns void

    • Installs where the engine's output goes from now on: a daemon's sink relays it to every attached surface, a terminal's writes it to stdout.

      Parameters

      Returns void

    • Installs who the engine asks for what only a surface can give: a hidden prompt, a local editor, a host shell, a delivered file.

      Parameters

      Returns void

    • Releases every watch one owner holds (its surface detached).

      Parameters

      • owner: string

        The owner whose watches end.

      Returns void

    • Opens or closes a liveness watch on a subject for one owner. Optional: a daemon whose engine lacks it refuses watch messages.

      Parameters

      • subject: string

        The subject address (/proc/jobs/feed_N).

      • owner: string

        Who holds the watch (a surface id).

      • on: boolean

        True to watch, false to release.

      Returns "live" | "settled" | "stale" | null

      The subject's watch state, or null when not watchable.