Skip to content

feat!: add v1 subagents to the agent runtime and deliver session events through ClientSessionOperations.notify - #183

Open
EugeneTheDev wants to merge 1 commit into
eugenethedev/subagents-stack/07-v2-closefrom
eugenethedev/subagents-stack/08-agent
Open

EugeneTheDev wants to merge 1 commit into
eugenethedev/subagents-stack/07-v2-closefrom
eugenethedev/subagents-stack/08-agent

Conversation

@EugeneTheDev

@EugeneTheDev EugeneTheDev commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Part 8 of 11 of the stacked split of #158 (v1 subagents).

Contents

  • ClientSessionOperations.notify now takes a SessionEvent: either Update, or Opened, which only the client
    runtime delivers. The two-argument notify becomes an extension (import com.agentclientprotocol.common.notify).
  • v1 agent subagents:
    • AgentSubagents.announce, AgentSubagentFactory, AgentSubagentContext and AgentSubagentSession;
    • the session wrappers in agent.internal, and the SessionTable snapshot of roots and subagents;
    • the load replay window, which closes from onResponseQueued.
  • Callers updated: the e2e recording client, the TCK v1 agent, the terminal sample client and the README example.
  • acp API dump: the agent and common blocks.
  • AGENTS.md: "Shared state", "v1 agent" and "Structuring long comments".
  • Tests: AgentSubagentsTest, ReplayWindowTest, AgentTest, the client tests that implement notify, the new
    ScriptedAgentTransport helper, and the integration SimpleAgentTest and FeaturesTest. These run the final
    agent against master's v1 client, and pass.

Breaking changes

  • ClientSessionOperations.notify(notification: SessionUpdate, _meta: JsonElement?) is replaced by notify(event: SessionEvent).

    // before
    override suspend fun notify(notification: SessionUpdate, _meta: JsonElement?) {
        render(notification)
    }
    
    // after
    override suspend fun notify(event: SessionEvent) {
        when (event) {
            is SessionEvent.Update -> render(event.update)
            is SessionEvent.Opened -> markLive(event.response)
        }
    }

    Agent code calling client.notify(update) or client.notify(update, meta) keeps compiling through the extension com.agentclientprotocol.common.notify, but must be recompiled and may need that import.

    In this PR the client still delivers only SessionEvent.Update; it starts delivering Opened in feat(client)!: add v1 subagent sessions and the Opened marker to the client runtime #184.

Caveats

  • The exception to the rules (hybrid imports): master's client/ClientSessionHolder.kt and
    client/ClientSessionImpl.kt are in master form, each with one added line,
    import com.agentclientprotocol.common.notify. 09 deletes both files.
  • Behavior ahead of the layer: master's v1 client never delivers SessionEvent.Opened. The KDoc of
    SessionEvent, ClientSessionOperations.notify and RemoteClientSessionOperations, the README example and
    TerminalClientSupport all describe or handle it.
  • Unresolved KDoc links until 09:
    • SessionEvent.kt:33 → client.BaseClientSession.subagents;
    • ClientSessionOperations.kt:47 → client.ClientSubagentSession.
      No Dokka task exists, so check can't catch them.
  • Coverage gaps until 09: master's ClientSessionHolderTest is deleted, and master's unknown-session test
    leaves SimpleAgentTest. Their replacements arrive in 09.
  • @Suppress("DEPRECATION") in ClientEarlySessionUpdatesTest and FeaturesTest comes before the
    deprecations, which land in 09.

Stack

  1. chore: add the multi-agent orchestration tooling #176 — chore: add the multi-agent orchestration tooling
  2. build: move buildSrc to build-logic and check that internal packages hold no public API #177 — build: move buildSrc to build-logic and check that internal packages hold no public API
  3. docs(samples): give each sample its own package, run task and README #178 — docs(samples): give each sample its own package, run task and README
  4. refactor: move MaybeUndefined to the model package and runtime internals to internal packages #179 — refactor: move MaybeUndefined to the model package and runtime internals to internal packages
  5. feat(protocol)!: order handler starts by arrival and add response hooks #180 — feat(protocol)!: order handler starts by arrival and add response hooks
  6. feat(model): add the v1 subagent models and promote session/close to stable #181 — feat(model): add the v1 subagent models and promote session/close to stable
  7. fix(client): make v2 close and delete idempotent and add PendingPermissions #182 — fix(client): make v2 close and delete idempotent and add PendingPermissions
  8. feat!: add v1 subagents to the agent runtime and deliver session events through ClientSessionOperations.notify #183 — feat!: add v1 subagents to the agent runtime and deliver session events through ClientSessionOperations.notify ← this PR
  9. feat(client)!: add v1 subagent sessions and the Opened marker to the client runtime #184 — feat(client)!: add v1 subagent sessions and the Opened marker to the client runtime
  10. test(client): cover v1 client openings and subagents over the wire and across transports #185 — test(client): cover v1 client openings and subagents over the wire and across transports
  11. docs(samples): add a subagents sample #186 — docs(samples): add a subagents sample

Next steps

…n events

- `ClientSessionOperations.notify` takes a `SessionEvent`: an `Update`, or the
  `Opened` marker that the client runtime delivers. The two-argument `notify`
  is now an extension.
- The v1 agent runtime supports subagents: `AgentSubagents`, its factory,
  context and session, the session wrappers in `agent.internal`, and the
  load replay window.
- The v1 client keeps its runtime; `ClientSessionHolder` and
  `ClientSessionImpl` import the `notify` extension.
- Update the callers: the e2e recording client, the v1 TCK agent, the
  terminal sample client and the README example.
- Tests: `AgentSubagentsTest`, `ReplayWindowTest`, and the agent, client and
  integration tests that implement or call `notify`. Remove the old
  `ClientSessionHolderTest` and the unknown-session test from
  `SimpleAgentTest`; the client layer replaces them.
- `acp` API dump: the agent and common blocks.
- AGENTS.md: "Shared state", "v1 agent" and "Structuring long comments".
@EugeneTheDev
EugeneTheDev force-pushed the eugenethedev/subagents-stack/08-agent branch from a327e0d to 8c7d9bb Compare December 4, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant