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.
…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.
Contributor
Author
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.
What
Interrupts,
resumeand child agents join the framework-neutral session contract, and the LangGraph session supplies interrupts andresumethrough it.Stacked on #1654 (typed state). Retarget to
mainonce that lands.Core (
@threadplane/core)AgentSnapshot.interrupts?: readonly AgentInterrupt[]: what a paused run waits on. Each has anid, and may carry the backend'svalue, areason, a displaymessageand atoolCallId.AgentSession.resume?(responses, options): answers pending interrupts by id. A response is{ interruptId, status: 'resolved', value? }or{ interruptId, status: 'cancelled' }.AgentSnapshot.subagents?: readonly AgentSubagent[]: child agents in start order, each withid,status(running,complete,error,unknown), its ownmessagesandtoolCalls, and optionalname,description,toolCallId,parentId,error.createFakeAgentSessionpublishes both fields (setInterrupts,setSubagents), recordsresumecalls, removes answered interrupts and takes anonResumehandler.All three are optional, so a session that cannot pause or reports no children is unchanged.
LangGraph native session (breaking)
id: the backend's when it sent one,breakpointfor a static breakpoint, the position (interrupt-0) otherwise.LangGraphInterruptis nowAgentInterruptplus the wire metadata; child observations insubgraphskeep the wire shape asLangGraphWireInterrupt.resume(value?)becomesresume(responses), the core command. There is one resume command, as decided for this milestone.valueis sent as the resume value, exactly as before. No value sends no command, as before.cancelled(LangGraph has no cancelled response; a refusal is a value the graph reads).Callers moved to the new command
answerPendingtest helper) and type tests.langgraph/interrupts,chat/interrupts,deep-agents/filesystem, plus the local state types inchat/debug,chat/subagents,chat/threadsandchat/tool-callsthat redeclaredinterrupts.examples/chat/native: the approval decision, its fixture expectations and the provider tooling.runtime-consumer.mjs,langgraph-candidate/installed-types.ts,ag-ui-candidate/installed-types.ts).Wire changes to know about
Two callers used to wrap a single answer in an id-keyed map. With one interrupt pending the session now sends the plain value, so their expected request bodies changed:
examples/chat/native:command.resumeis'approved'or'denied', not{ [id]: 'approved' }.fixtures/react-parity/runtime: the final approval sendstrue, not{ 'final-approval': true }.The provider-routing diagnostic in
examples/chat/native/tooling/approval-provider-consumer.tssent a resume for an id that is not pending. The session now rejects that locally (covered by its own specs), so the diagnostic sends the id-keyed command through the SDK client instead. Its request footprint changes from 46 to 45 requests.Not in this PR
resume(pauseId, responses)here. Moving it to the core command belongs on top of feat(ag-ui): make the session a core AgentSession #1659, which makes that session a coreAgentSession. Until then the two PRs disagree on that one type, so whichever lands second needs that follow-up.subagents(fromsubgraphs) and AG-UIsubagents: the core shape is here; the sessions supply it next.Chatreadinginterruptsandsubagentsfrom the session.Verification
nx run-many -t runtime-quality,runtime-type-tests,test,type-tests,lint -p core,langgraph,ag-ui,react,angular: pass. LangGraph runtime: 1086 tests.Mutation checks on the new LangGraph logic (not-pending check, cancelled check, published ids, single-interrupt value): each fails tests, then restored.
nx run-many -t test,lintfor the seven touched cockpit React projects: pass. All 41 cockpit React apps type-check against source with a scratch config (the per-app build type check needs the packed packages).examples/chat/native/tooling/run.mjs test: 513 pass.Package lane after a fresh build of core, content, angular, react:
verify-boundaries.mjs --built,verify-packages.mjs,verify-angular-package.mjs,verify-langgraph-candidate.mjs,verify-ag-ui-candidate.mjs: pass.inventory.mjs --check --drift warn: valid.nx run native-conversation-react:provider-test(canonical provider, 45-request footprint): pass.Not run locally: Playwright e2e (cockpit, website),
browser-proof.mjs, and the AG-UI client-tools and Mastra verifiers.🤖 Generated with Claude Code