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

    Interface BrasaEngine

    The hostable shell engine.

    One engine serves one session: it executes command lines against the shared session state and answers completion requests. Hosts own the output destination (via the sink) and the input source (a readline loop, a socket); the engine owns everything between.

    interface BrasaEngine {
        ambient_listen?(listener: (event: AmbientEvent) => void): () => void;
        command_stopped?(): boolean;
        file_read?(filePath: string): Promise<Buffer<ArrayBufferLike>>;
        file_stream?(filePath: string): Promise<FileByteStream>;
        file_write?(filePath: string, bytes: Buffer): Promise<void>;
        joblets_running?(): JobletRunning[];
        jobs_resume?(): number;
        line_abort?(id?: string): boolean;
        line_cancel?(id?: string): boolean;
        line_complete(linePrefix: string): Promise<CompletionResult>;
        line_execute(
            line: string,
            options?: LineOptions,
        ): 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): LineHolds;
        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: a sampler's refreshed model, a watch changing state.

      Parameters

      • listener: (event: AmbientEvent) => void

        Receives each ambient event.

      Returns () => void

      Function that unsubscribes.

    • Whether the command the caller runs inside was stopped (its output and questions are no one's).

      Returns boolean

    • Reads one ChRIS file's raw bytes, resolved against the session's working directory. The seam a hosting daemon uses to serve file content to surfaces that render it natively (an image in a browser panel) rather than through a 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, resolved as Engine.file_read resolves. A hosting daemon serves a download through it, so a large file reaches the surface as it arrives and is never held whole.

      Parameters

      • filePath: string

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

      Returns Promise<FileByteStream>

      The stream and its size when known.

    • Writes bytes to one ChRIS path, resolved against the session's working directory. The twin of Engine.file_read: a surface that cannot reach the machine's disk (a browser) hands its bytes to the daemon, which puts them in the store through the kernel like any other write.

      Parameters

      • filePath: string

        The destination path (absolute or cwd-relative).

      • bytes: Buffer

        The content to write.

      Returns Promise<void>

    • The joblets running now, for a host that warns before a restart ends them.

      Returns JobletRunning[]

      Them, by number.

    • Picks up the backend's jobs that were running when the session last ended (core/runner.ts). A host calls it once, after installing its surface, which says whether the tasks tier is granted.

      Returns number

      How many went on.

    • Aborts a running command, cancellable or not; the host abandons one that does not end.

      Parameters

      • Optionalid: string

      Returns boolean

    • Requests cancellation of a running command when it supports it (Ctrl-C).

      Parameters

      • Optionalid: string

        The line, as its host named it; the most recent when omitted.

      Returns boolean

      True when the command accepted the request.

    • Executes one input line and returns one envelope per executed command.

      Parameters

      • line: string

        The raw input line (may contain ;, |, >, !).

      • Optionaloptions: LineOptions

      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 execution order.

    • What a line holds of the session while it runs, for a host that runs lines side by side: the pieces its commands change, none for a read, or 'all' when the line cannot say.

      Parameters

      • line: string

        The line.

      Returns LineHolds

      Its pieces, or 'all'.

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

      Parameters

      • origin: string

        The surface's origin.

      Returns void

    • Returns the session'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 from a surface: the addressable thing the operator most recently indicated. The engine retains it as session truth (last write wins) so engine-side consumers can answer "what is the operator regarding" without any surface geometry crossing the seam.

      Parameters

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

        The indicated address with its provenance.

      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 (a surface detached).

      Parameters

      • owner: string

        The owner whose watches end.

      Returns void

    • Opens or closes a liveness watch on a subject for one owner (a surface id, or the operator at a console). While any owner watches a subject, the engine samples it and publishes refreshed models as ambient events.

      Parameters

      • subject: string

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

      • owner: string

        Who holds the watch.

      • on: boolean

        True to watch, false to release.

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

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