feat(console): console CLI runner + AgentsConsole session wiring (text mode)#1706
Open
toubatbrian wants to merge 3 commits into
Open
feat(console): console CLI runner + AgentsConsole session wiring (text mode)#1706toubatbrian wants to merge 3 commits into
toubatbrian wants to merge 3 commits into
Conversation
Add the `console` CLI subcommand and an in-process console runner that lets a local broker (e.g. the LiveKit CLI `lk session` daemon) drive a Node agent over TCP. `runConsole` loads the agent, opens a `TcpSessionTransport` to `--connect-addr`, sets up the `AgentsConsole` singleton, and runs the agent entrypoint in-process (mirroring python's `_run_tcp_console` / `JobExecutorType.THREAD`). `AgentSession._startImpl` now wires its `SessionHost` from the `AgentsConsole` singleton when console mode is active, and `JobContext` gained fake-job support (`isFakeJob`, no-op connect/deleteRoom/recording) so a console job without a backing LiveKit room behaves correctly. Ships text-mode console; audio-mode session wiring is a follow-up. Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: 1c83731 The changes in this PR will be included in the next version bump. This PR includes changesets to release 34 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80f07b4e63
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
acquireIo now attaches the TCP audio bridges by default (voice mode); text-mode drivers disable them at runtime via update_io, so one wiring path serves both modes. Co-authored-by: Cursor <cursoragent@cursor.com>
a21e5b0 to
1d80080
Compare
5 tasks
…arden runConsole Console review follow-ups: - Route the `--record` flag to `Job.enableRecording` so console sessions actually record (drop the dead `AgentsConsole.record` field). - Drain `ctx.shutdownCallbacks` in the runConsole finally block, matching the normal worker path (runConsole bypasses the ProcPool). - Load the agent via `pathToFileURL().href` for correct Windows imports. - Validate the `--connect-addr` port strictly (digits only, 1-65535). - Document the deferred TranscriptSynchronizer parity gap and correct the changeset to reflect audio IO being attached by default. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third and final PR in the series that ports the TCP console/session machinery from python
livekit-agentsso a local broker (e.g. the LiveKit CLIlk sessiondaemon) can drive a Node agent over TCP. Stacked on #1694 (console audio IO).This PR adds the glue that actually runs an agent in console mode:
agents/src/console.ts(runConsole) — an in-process runner that bypasses the websocket worker and ProcPool entirely. It loads the agent, opens aTcpSessionTransportto--connect-addr, sets up theAgentsConsolesingleton, fabricates afakeJobRunningJobInfo/JobContext, and runs the agent entrypoint on the current event loop. This mirrors python's_run_tcp_console, which relies onJobExecutorType.THREADto keep the job in-process so theAgentsConsolesingleton is shared with the agent'sAgentSession. (JS has no in-process/THREAD executor andAgentServerrequires WS credentials, so a self-contained runner is the clean equivalent.)AgentsConsolesingleton (voice/console_io.ts) — carries the console transport + audio bridges from the runner into theAgentSession.AgentSession._startImplnow acquires console IO and builds itsSessionHostfrom the singleton when console mode is active, instead of the RoomIO path.JobContextfake-job support —isFakeJob, plus no-opconnect/deleteRoom/initRecordingand a guarded_onSessionEnd(no cloud upload / URL parse) so a console job without a backing LiveKit room behaves correctly.consoleCLI subcommand —console --connect-addr <host:port> [--record].Ships text mode (the agent is driven over the session transport: text in via
runInput, events out). Audio-mode session wiring is intentionally a follow-up — the PR #1694 audio bridges are constructed and routed at the transport level, but not attached to the session pipeline yet.Test plan
pnpm build:agentsgreenAgentsConsole.acquireIo(text-mode IO unset, double-acquire guard, singleton);JobContextfake-job guards (isFakeJob, no-op connect/deleteRoom/initRecording)agent_session/agent_activity/remote_session/console_io/jobsuites (23 + 10 passing)