Skip to content

kb v0.52

Choose a tag to compare

@github-actions github-actions released this 16 Nov 14:49
· 196 commits to main since this release
fae028a

kb v0.52 and kb-code v9.2 — "Mirror"

kb gets a terminal. An agent session running on your machine can now be watched
and typed into from the session page in the browser, on a desktop or a phone,
and mirrored into a local terminal's own scrollback. The terminal tier is
SPA-only and off by default. The release also brings the session catalogue: one
page per session, parent and child lineage, a session card, and a work view that
groups sessions. kb-code shows that card's code side.

kb-code v9.2 ships in this same release and shares this note (see "kb-code"
below); there is no separate kb-code-v9.2 note file, as with v0.51 and kb-code
v9.1.

Before you upgrade

  • The terminal is off. Nothing changes unless you add [terminal] with
    enabled = true to kb.toml. The keys are enabled, runner_socket
    (default /run/kb-term/runner/runner.sock), ticket_ttl_secs (default 30,
    1 to 120), refuse_token_callers (default true) and runner_timeout_secs
    (default 5, 1 to 60); see docs/configuration.md. Terminal routes need an exact
    browser Origin and an intent header, the WebSocket needs a single-use ticket,
    and the loopback bypass does not apply. There is no kb CLI verb for it.
  • The terminal needs host pieces the kb container cannot hold: the runner
    kb-termd, the local client kb-term, the compiled tap and a pinned private
    tmux 3.7c. scripts/install-kb-term.sh installs them from the new
    kb-term-<ver>-x86_64-unknown-linux-gnu.tar.gz release archive (Linux x86_64,
    glibc 2.39 or newer, a systemd user manager). The installer verifies the
    checksum and, with gh signed in, the build provenance. Full steps and
    rollback: docs/kb-term-install.md.
  • Three operator steps, in order: (1) one sudo line installs the tmpfiles
    file so /run/kb-term exists with a stable inode; (2) start kb-termd;
    (3) add the bind mount /run/kb-term/runner:/run/kb-term/runner to the kb
    container (only that directory; the per-session holder sockets never go in).
    kb-termd must run as the same uid as the kb container user that reads the
    socket, because the runner socket is mode 0600 and peer-uid checked. Order is
    tmpfiles, then kb-termd, then the container.
  • One kb schema migration: V0047 adds three nullable columns to sessions
    (parent_session_id, root_session_id, project_slug) and an index on
    root_session_id (kb schema 46 to 47). It is additive, backfills nothing and
    runs on boot. A daemon built before V0047 refuses to boot on an upgraded
    index.db, as with V0046: take a kb backup first if you may roll back.
    kb-code has no new migration.
  • omp lineage for old sessions is filled by kb sessions backfill-tree
    (dry run by default, --apply writes, never overwrites a value). It reads the
    host's omp sessions tree and needs a running daemon.
  • To stop omp subagents showing up as live sessions of their own, update the
    kb-memory plugin hooks (A1 below). Without the update nothing breaks; those
    rows simply stay as before.

kb-term: "Mirror"

The terminal tier is one design in five pieces: a tmux holder per session, a tap
that reads it, a runner that owns them, a WebSocket relay in the kb daemon and
two readers (the SPA and the local mirror).

  • Holder, tap and runner (T0 to T10, T13). kb-termd starts a private tmux
    per session and serves runner.sock; the tap decodes tmux control mode, strips
    the escape sequences the viewer must not receive, keeps a numbered ring so a
    reconnect resumes where it left off, and seeds a new viewer from a twin of the
    screen at a quiet point. Viewers can answer terminal queries, paste, press
    Enter and send named keys, and a grid-ownership rule decides who sets the size.
    Per-harness launch profiles and kb-term doctor check the setup (#222, #219,
    #220, #226, #227, #229, #230, #232, #236, #237, #240, #233).
  • The WebSocket relay (T12, T11). /api/terms and the terminal WebSocket sit
    behind [terminal] enabled, with the gate in the handler and term.* events;
    a config edit restarts the daemon in place and open terminal sockets close with
    code 1012 while the holders keep running (#225, #268).
  • Desktop panel (T14). The terminal panel on /sessions/:sid, with seed and
    resume and guards so a reply cannot go to the wrong session (#260).
  • Phone: Watch/Read and Drive (T17, T18). Read mode is a scroller with pinch
    and resume handling. Drive mode adds a composer, a key bar, a choice bar, guards
    for Claude's prompts, Fit to phone and image upload (#284, #289).
  • Pictures (T15, T21, T24). omp pictures draw in place from a content-hash
    store through a media route with a lightbox; the live tail swaps inline images
    for references and the page has an Images strip (#282, #286). The kitty
    graphics core for kb-term attach landed with T24 (#285), but see "Known
    limits".
  • Local mirror (T16). kb-term attach|new|ls|doctor mirrors a session into the
    terminal's own scrollback, with a dim one-row label for each picture. It is a
    host-local tool, not a kb verb (#258).
  • Install archive (T19). The release workflow builds the kb-term archive and
    install-kb-term.sh installs it (#244).
  • Tests and docs (T25, T23). A real-stack end-to-end lane runs real tmux, the
    tap, kb-termd, kb-server and the SPA with a fake harness (#287). The
    reference is docs/kb-term.md, the install guide is docs/kb-term-install.md, and
    docs/configuration.md and docs/http-api.md carry the keys and routes (#292).
    The terminal rulings are amendments to existing invariants, not new ones (T22,
    #218).

Track A: the session catalogue

  • omp identity (A1 to A6). An omp subagent no longer takes the process's
    identity or creates a live row, and the adapters stamp the job id (#221).
    Commit trailers read KB_SESSION_ID, and kb doctor names where the trailer
    id comes from (#238).
  • Lineage (A2, V0047). Sessions carry parent, root and project slug, stamped at
    capture time (#223).
  • The session card (A3). GET /api/sessions/{session_id}/card is one read
    model with paged children and kb sessions card; resume targets the root
    session (#231).
  • The /sessions/:sid page (A4). A per-session page with a collapsed
    subagent list and the slot the terminal panel fills (#234).
  • kb-code's card lane (A5). Commits, reviews, findings and presence by
    session, fetched by kb's SPA (#239).
  • The work view (A6). GET /api/sessions/work groups sessions by a named
    ladder rather than a score (#238).

Post-merge fixes

  • FXA4 (#253): the A4 session page, post-merge fix-ups.
  • FXT0, FXT2, FXT3, FXT4, FXT5, FXT6 (#264): tap, mirror stand-in checker and
    tmux-script fix-ups.
  • FXT1, FXT8, FXT10 (#265): runner, wire and launch-profile fix-ups.
  • FXA2, FXA3, FXA5, FXA6, FXT20, FXT22 (#266): lineage, card, work view,
    image-reference and doc-gate fix-ups.
  • FXT9 (#250): legacy resize ownership, pump teardown.
  • FXT13 (#246): a malformed runner answer can no longer wipe the terminal
    directory; the beat tolerates a bad terminal id.
  • FXIDS (#272): the runner client no longer overwrites an operation's session id
    with the envelope id.
  • FXINTRUN (#271): the relay maps every runner error code to a proper 4xx or
    503 instead of 502, opens the SPA viewer before input, adds the grid, resize and
    viewer-close routes, and uses one terminal-id grammar everywhere.
  • FXBUSY (#283): the relay retries a tap join the tap deferred with "busy".
  • FXEPOCH (#290): a terminal reconnect carries the tap epoch, so it continues
    instead of reseeding.
  • FXINPUT (#291): keys typed in the panel reach the pane.
  • FXUPLOAD (#293): the upload quota scan tolerates files renamed or removed by
    a concurrent upload.
  • FXZOOM (#288): Library semantic-zoom keys and pinch step from the current
    rung, not a stale one.
  • FXDENY (#262): audited advisory exception for libsqlite3-sys
    RUSTSEC-2026-0459 in deny.toml.

kb-code

  • Session card lane (v9.2). kb-code answers kb's session card with the commits,
    reviews, findings and presence for a session (A5, #239). kb-code gains no
    terminal concept: the one live call direction is still kb-code to kb.
  • No kb-code schema migration.

Also in this release

Not part of kb-term or Track A, but merged since v0.51:

  • Addressed asks on the slate. kb slate ask --to, kb slate wait #n, the
    per-prompt delta carrying answers on a session's own asks, and the phone
    answering and addressing asks.
  • Agent-hardening round (AH1 to AH12). A verified resume-command table, slate
    deltas that open with the untrusted-data frame, a timed-out kb write that says it
    may have landed (#210), kb daemon proving "still ours" with a lifetime lock
    (#216), mobile sheets that answer the platform close request (#215), and a
    compile-free gate pinning that ONNX Runtime stays in kb-embedder (#211).
  • Dependencies. Rust 1.96.1 pinned, the web and actions groups, rusqlite 0.40,
    scraper 0.29, and a lock bump that clears the ammonia, zstd, rustix and
    event-listener advisories.

Known limits

  • T4 local-mirror tail re-check is pending. The scrollback result for the local
    mirror was measured once (docs/kb-term.md records it); the re-check of its tail
    has not been done.
  • --graphics is not wired. T24 shipped its core only: kb-term attach --graphics is not available, and the core has never run against a real Ghostty or
    kitty.
  • Real-device phone checks are pending. The phone Read and Drive modes are
    covered by unit and end-to-end tests, not yet by a pass on physical phones.
  • Linux x86_64 only for the kb-term archive; no aarch64 build.
  • The terminal tier is not exposed on a public mirror, and none may be added.

API

  • New, behind [terminal] enabled and the handler gate: the /api/terms family
    (list, launch, kill, read, history, paste, enter, keys, grid, take-size,
    release-size, resize, viewer-close, upload, ticket mint, and
    /api/terms/media/{sha256}) and the terminal WebSocket, which
    accepts ?from=, ?epoch= and ?mseq=. See docs/http-api.md.
  • GET /api/sessions/{session_id}/card (kb-session-card/1), GET /api/sessions/work
    and POST /api/sessions/backfill-tree.
  • Session responses carry parent_session_id, root_session_id and
    project_slug.
  • kb sessions card, kb sessions backfill-tree and kb-term attach|new|ls|doctor
    are new CLI forms. kb-term is not a kb verb.

Known issues in this release (found on the first real-host install)

These are fixed on main in #299 and ship in the next release. The workarounds below apply to v0.52.

  • kb-termd does not start after a reboot. The shipped kb-termd.service has no [Install] section, so systemctl --user enable kb-termd.service enables nothing. Workaround:
    mkdir -p ~/.config/systemd/user/default.target.wants
    ln -s ../kb-termd.service ~/.config/systemd/user/default.target.wants/kb-termd.service
    systemctl --user daemon-reload
  • Harnesses launched in a terminal exit 127, or run with kb's hooks silently off. kb-termd copies an allowlisted environment (PATH, KB_SESSIONS_DIR, ...) into every pane from its own environment, and the systemd user manager usually has neither your harness directories on PATH nor KB_SESSIONS_DIR. Without KB_SESSIONS_DIR the kb hooks are no-ops in the pane: no beats, so no terminal-to-session binding and no capture. Workaround: a user-unit drop-in, then systemctl --user daemon-reload && systemctl --user restart kb-termd.service:
    # ~/.config/systemd/user/kb-termd.service.d/env.conf
    [Service]
    Environment=PATH=%h/.local/bin:<the dirs holding your harnesses>:/usr/local/bin:/usr/bin
    Environment=KB_SESSIONS_DIR=<the same value your shell exports>
    On main, kb-term doctor checks the runner's own environment and the installer prints this drop-in pre-filled.
  • /api/terms reports the wrong cols/rows for a live terminal (the window height and the bracketed-paste flag). This is display only; the real grid is right.