Skip to content

[FEATURE] infer daemon hosts the AG-UI WebSocket binding and supervises session workers #1399

Description

@edenreich

Part of #1396

Depends on #1395, #1398

Summary

infer daemon becomes the one owner of external connections. It hosts the AG-UI WebSocket binding that the extension bridge turns into in #1395, keeps a registry of threads, and runs each thread in a session worker (#1398). Clients never spawn infer headless.

The binding is a relay. Worker stdout lines go to the subscribed clients as bare frames, one AG-UI event per frame with no envelope, and client frames go to the worker's stdin. That gives the socket everything #1395 originally asked for: bare events, one run per turn, the cancelled outcome and one approval contract.

A new context internal/sessions owns the thread registry and the worker supervision. The binding in internal/protocols/agui and the Telegram channel are its driving adapters, and the worker process is its infrastructure adapter.

Acceptance Criteria

  • infer daemon serves ws://127.0.0.1:<port>/ws with the Origin check and token browser_hello handshake, and boots with only the binding enabled (today it refuses to start unless channels, scheduler or heartbeat is on)
  • browser_hello carries client (extension or desktop). There is one extension connection, which a new one replaces, and any number of desktop connections
  • browser_hello_ack carries protocol_version. Any valid-token hello is accepted, and one without a version is logged as a warning
  • A thread is a project dir plus a conversation id, and runs in one session worker spawned in that project dir
  • Worker stdout lines reach every client subscribed to the thread unchanged, one per frame
  • new_session and resume_conversation take project_dir plus thread options (model, agent mode, system prompt and custom instructions overrides, sandbox directories, max turns) and answer with MESSAGES_SNAPSHOT. threadId on the thread's runs is its conversation id
  • CUSTOM approval_request reaches every client of the thread. The first approval_response (ipc.ApprovalResponse: tool_call_id, approved, scope) goes to the worker, and CUSTOM approval_resolved {tool_call_id} goes to the thread's other clients
  • user_message, interrupt, user_question_response and computer_use_control are forwarded to the worker unchanged
  • list_conversations, list_history, list_skills, list_models, select_model, set_mode and tool_request / tool_result keep their shapes and are scoped to a project dir
  • Idle workers exit after a timeout. A worker that crashes mid-turn ends its open run with RUN_ERROR
  • infer chat no longer runs the in-process panel mirror (extension_chat.go, its event bridge subscription)
  • internal/sessions/README.md explains what the context owns and how the binding, Telegram and the workers plug in
  • Integration tests cover two clients on one thread, approval first-answer-wins, resume snapshot and a worker crash

Activity

  1. added
    enhancement
    on Sep 28, 2026
  2. inference-gateway-releaser commented on Sep 30, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.219.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleased

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions