Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Design model

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

Define how syscall-backed standard streams are exposed as three Beskid modules (System.Input, System.Output, System.Error) without leaking raw file descriptors or host APIs into user code.

flowchart TB
  app[Application or Console.Format]
  streams[System.Input / Output / Error]
  syscall[System.Syscall ReadWith WriteWith]
  builtin[__syscall_read / __syscall_write]
  app --> streams --> syscall --> builtin

Console I/O streams are thin facades: they select Descriptor::Standard(StandardStream) and translate Beskid string values to UTF-8 byte buffers. Styling, cursor motion, and color live in corelib_console and appear on stdout/stderr only as opaque UTF-8 after ANSI escape model composition.

StandardStreamTypical fdModuleReadWrite
Stdin0System.InputRead, ReadLineResultForbidden
Stdout1System.OutputForbiddenWrite, WriteLine
Stderr2System.ErrorForbiddenWrite, WriteLine

User code must not pass integer fds to ReadWith / WriteWith for these helpers. Arbitrary descriptors, sockets, and pipes are out of scope for v1 stream modules.

  • Every read must use Syscall.ReadWith with Descriptor::Standard(Stdin) only (IO-001).
  • Every stdout write must use Descriptor::Standard(Stdout); stderr must use Stderr (IO-002).
  • WriteLine(text) must perform Write(text) then Write("\n") as LF only—no implicit CRLF in the API (IO-003, decision D-TC-012).
  • Write failures must panic with stable messages; read paths must return Result (IO-004, IO-005).
  • Stream modules must not parse or validate ANSI sequences (IO-006).
DirectionAPI shapeRationale
ReadResult<string, SyscallError>EOF and syscall errors are ordinary control flow
WritePanic on failurev1 CLI treats broken stdout as fatal

Console.FormatLine and control renderers must call System.Output or System.Error after producing a final string. They must not bypass syscall descriptors with host-specific writes. Capability probing runs in Console capabilities, not inside Output.bd.

  • Contract IDs IO-001IO-006 are enforced by runtime module structure and corelib integration tests that exercise stdin/stdout/stderr through the public API.
  • Styled output paths are verified indirectly via console tests that call System.Output after Ansi gating.