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

    Class CalypsoDaemon

    A WebSocket daemon hosting one engine for attached surfaces, with a session bus broadcasting activity across them.

    Index
    • Waits aside: the running command steps out of the lane while it waits on something that is not the session's work (a task's next line), so other lines run meanwhile, and takes its turn again before going on. Its surface's STOP still reaches it.

      Type Parameters

      • T

      Parameters

      • waiting: Promise<T>

        What it waits on.

      Returns Promise<T>

      What that resolved with.

    • Returns
          | {
              color: boolean;
              fileDelivery: boolean;
              localFilesystem: boolean;
              pipeSegments: boolean;
              tasks: boolean;
          }
          | null

    • Tells every attached surface the daemon is going away, and why; resolves once each message has left (or a short wait has passed), so the process can exit after it rather than before.

      Parameters

      • cause: "end" | "stop" | "restart"

        Why: a door restart, an administrator's end, or a plain stop.

      • waitMs: number = 500

        The longest it waits for the sends to leave.

      Returns Promise<void>

    • Whether the running command was typed in a browser's terminal.

      Returns boolean

      True for a terminal's chell.

    • Asks the surface running the current command to place a file where its operator can reach it. The host installs a fileDeliver on its engine-side surface that calls this, so download writes to the operator's machine and never to the daemon host's disk.

      Only the request crosses here. The surface fetches the bytes itself from /vfs, which is the same token-gated route a browser already uses to render a file natively.

      Parameters

      Returns Promise<DeliverOutcome>

      Where the file landed and how large it was.

      When no command is executing or the surface disconnects.

    • Opens content in the editor of the surface running the current command and returns the edited result. The host installs a localEdit on its engine-side surface that calls this, so edit opens the operator's own editor and never one on the daemon host.

      Parameters

      • content: string

        The content to edit.

      • extension: string | undefined

        An optional filename extension for syntax mode.

      • Optionalpath: string

        The file being edited, for an editor that stays open and saves back to it (a browser's editor pane).

      Returns Promise<EditOutcome>

      The edited content and whether it changed, or that an editor which stays open took it.

      When no command is executing or the surface disconnects.

    • Sends a typed event from the executing command to its origin surface. Like output, an event is live only: when no command is active or the origin surface is gone, it is dropped.

      Parameters

      • kind: string

        What the data is (games.trek.state).

      • data: unknown

        The event, shaped by its kind.

      Returns boolean

      True when the event was sent to a surface.

    • Takes a hold for work no line of a surface runs (a joblet): it waits in the same lane as every line, and runs beside the lines it shares nothing with (#1273).

      Parameters

      • holds: string[] | "all"

        What the work changes, or 'all'.

      Returns Promise<() => void>

      Gives the hold back; a second call does nothing.

    • Streams an opaque live output chunk from the executing command to its origin surface. Output is live telemetry, distinct from final envelopes; when no command is active or the origin surface is gone, it is dropped.

      Parameters

      • channel: "status" | "data" | "err"

        The output channel that produced the chunk.

      • chunk: string

        The text chunk to forward.

      Returns boolean

      True when the chunk was sent to a surface.

    • Runs a pipeline segment on the surface running the current command, returning its output. The host installs a pipeSegment on its engine-side surface that calls this, so a pipeline's segments run on the client and never on the daemon host. Data crosses the wire base64-encoded.

      Parameters

      • command: string

        The segment command line.

      • input: Buffer

        The bytes to feed the segment.

      Returns Promise<Buffer<ArrayBufferLike>>

      The segment's output bytes.

      When no command is executing or the surface disconnects.

    • Streams structured progress from the executing command to its origin surface. Progress is live-only; when no command is active or the surface is gone, the event is dropped.

      Parameters

      Returns boolean

      True when the event was sent to a surface.

    • Raises a prompt on the surface running the current command, returning its answer. The host installs an engine-side input broker that calls this; the engine therefore prompts through the wire without knowing the transport.

      Parameters

      • request: PromptRelay

      Returns Promise<string>

      The surface's answer.

      When no command is executing, the surface cannot securely collect a requested hidden answer, or the surface disconnects before answering.

    • Runs a host-shell command on the surface running the current command. The daemon never spawns the process itself.

      Parameters

      • command: string

        The shell command without the leading !.

      • toIssuer: boolean = false

      Returns Promise<number>

      The surface process exit code.

      When no command is executing or the surface disconnects.

    • Records whether the daemon's own code still matches its disk, and tells every attached surface when that changes.

      Parameters

      • stale: boolean

        True when the code on disk is not the code this process runs.

      Returns void

    • Starts listening.

      The daemon owns an explicit HTTP server: WebSocket upgrades carry the session contract, and plain requests serve the configured web root (404 when none is configured), so one loopback port carries both the wire and the web surface that speaks it.

      Returns Promise<number>

      The bound port (useful when an ephemeral port was requested).

    • Stops listening and closes all connections.

      Returns Promise<void>

      A promise resolving when the server has closed.

    • The surfaces attached now, each named a terminal or a browser, the one running the current command marked: what who answers.

      Returns { asking?: string; id: string; kind: "chell" | "browser"; you: boolean }[]

      The surfaces, in attach order.

    • Offers terminals: a surface's console as a chell under a pty (terminals.ts). Set once the daemon knows its own address.

      Parameters

      • terminals: Terminals | null

        The terminals, or null to offer none.

      Returns void