Repository navigation
Conversation
AgentSession and AgentSnapshot take a second type parameter for application
state. The snapshot gains an optional, deeply readonly `state`, and `submit`
accepts `{ message, state }` with a partial state as well as plain text.
A session is told its state type by one declaration: `type<T>()` for the type
alone, or any Standard Schema value to also check each state as it arrives.
`readState` runs that check for session implementations. The fake session
holds, sets and validates state the same way.
No backend session supplies `state` yet; LangGraph and AG-UI follow.
createSession takes a stateType, either type<T>() or a Standard Schema. createAgentSession publishes the state document as the typed state of the core snapshot, checks it once per document when a schema is declared, and reports a rejected document in stateIssues without failing the run. A session created without a state reports none until one is supplied.
The session createSession returns now publishes the core snapshot itself: messages, tool calls, error, usage and typed state beside the protocol evidence. createAgentSession is removed. retry rejects when the failure leaves the backend outcome open, as the core contract requires, and the literal state document a request sends is no longer published.
…ntract The snapshot gains optional interrupts and subagents, and the session an optional resume(responses) that answers pending interrupts by id. The fake session publishes both fields and records resume calls.
Every published interrupt has an id, and resume takes the core contract's responses in place of a bare value. One pending interrupt receives its response's value; several are answered as one map keyed by backend id. Callers in the cockpit examples, the native conversation example and the parity fixtures move to the new command.
…he client only The raw session has loaded nothing at that point, so its resume rejects for a missing pause, not for the unmatched id. The session's own specs cover the rejection; the diagnostic keeps the provider routing evidence.
…already merged by its final head)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…blish core child agents
…d by its final head)
…separate reused run ids
…alls as readonly observations
…at-render-interrupt
…y merged by its final head)
…at-render-interrupt
This branch has not been deployed
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
React
Chatcan now answer the interrupts a session reports insnapshot.interrupts, through an opt-inrenderInterruptprop. The app draws the card;Chatwires the answer tosession.resume.Stacked on #1682, which is stacked on #1678 and #1681. Until they merge, this PR's diff also shows their changes. The commit that belongs to this PR is
feat(react): answer session interrupts from Chat with renderInterrupt.What changed
renderInterrupt(interrupt, respond), off unless set.Chatshows nothing for an interrupt by itself: which value answers an interrupt is the backend's contract, so there is no built-in card. This was a product decision.respond.resolve(value)/respond.cancel()record an answer.Chatholds each one until every pending interrupt has an answer, then sends them together with onesession.resume, because a paused run continues once.respond.answeredandrespond.sendinglet a card disable itself.approvalslot, so the composer placeholder and the return of focus work as they do forapproval.onInterruptErrorreceives a rejectedresume; the answers are dropped so the person can answer again. With no handler the failure is reported as an unhandled error rather than swallowed.renderInterruptis ignored whileapprovalis set and on a session with noresume, so existing apps are unchanged.Verification
nx run-many -t test,type-tests,lint -p reactpasses, with newChattests over the fake session: nothing shown without the prop, one interrupt, several held then sent together, a refused answer, andapprovaltaking precedence.inventory.mjs --check --drift warnpasses.🤖 Generated with Claude Code