Skip to content

refactor(eve)!: let the session stream own the frontend lifecycle - #4854

Open
OwenKephart wants to merge 3 commits into
v27/instrumentationfrom
v27/observable-session
Open

OwenKephart wants to merge 3 commits into
v27/instrumentationfrom
v27/observable-session

Conversation

@OwenKephart

@OwenKephart OwenKephart commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The frontend followed a continuous stream but also maintained a local turn lifecycle, so transport timing could disagree with committed state. This PR makes the stream authoritative through flat snapshots and shared selectors. Commands resolve on acceptance; response rows own answers after the POST round trip. The TUI uses delivery identities instead of matching message text. Stacked on #4695; related to #4930.

  • Snapshots expose view, previews, messages, agents, events, session, status, and error. Status is idle | busy | resuming; errors are separate.
  • All five callbacks remain: onEvent, onError, onFinish, onSessionChange, and asynchronous prepareSend. Optimistic echo still precedes asynchronous preparation.
  • Tool parts use streaming partial input followed by shared CallState; kind and step index are required. Reduced turn/task types, duplicate interaction maps, and local responded state are removed.
  • Concurrent answers and stream-before-acknowledgement work without retracting another submission. Immutable table snapshots reuse copies for progress-only updates.

resume() resolves at catch-up, not turn completion. Lower-level MessageResponse.result() still follows the response. Prewarming, cancellation, child following, and followIdle remain supported. The unnamed-remote fallback is retained: an initial protocol-3 delivery can lack caller attribution when parent lineage is untrusted. The commands API redesign remains above v27, not duplicated here.

Production code: 684 fewer lines (+1,092/−1,776). Removes frontend-local turn lifecycles, redundant interaction projections, and duplicate snapshot data; shared tables and call state drive the remaining store and hooks. Excludes tests/fixtures, generated copies, docs, and tooling.

Validation

  • The frontend retcon passed 45 focused tests, including both receipt/stream orderings and competing answer submissions.
  • At assembled head b1c123f55, the D8 runtime is identical to the validated snapshot: package typecheck/declarations, docs, invariant guard, targeted lint, formatting, and diff checks passed. Targeted unit groups passed 269 tests with one pre-existing expected failure.
  • Earlier generated-template and template-copy drift checks passed; these files did not change in the D8 restack.
  • Focused framework typecheck scripts pass for Next, named Next, TanStack, Nuxt, and SvelteKit after the consumer follow-through in feat(eve)!: consolidate pre-1.0 agent and session contracts #4855.
  • No independently green claim for every intermediate PR. No full integration/scenario/e2e or browser run.

Latest type-only follow-through at assembled head 390f9e5b3: AgentMessageResult.error.message
is restored to string. Package typecheck/declaration build, targeted lint, formatting, and diff
checks pass. Runtime tests were not rerun for this annotation-only correction. The invariant guard
reports only the unreleased tool/v93 contract hash; generation remains deferred to the agreed
final assembled-source pass. No reports or baselines were rewritten.

Checklist

  • I added tests and documentation where relevant
  • I added a changeset if this touches the published eve package
  • DCO sign-off passes for every commit (git commit --signoff)

@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
eve-docs Error Error v0 Oct 20, 2026 5:34pm UTC
eve-pkg Error Error v0 Oct 20, 2026 5:34pm UTC

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Bundle + Package Summary: apps/fixtures/weather-agent

Key takeaways

  • No notable deltas vs v27/instrumentation (27a92d6).

Delta vs v27/instrumentation (27a92d6)

Area Metric Baseline Current Delta
Package Packed tarball 7.66 MB 7.65 MB -10.4 kB ✅
Package Unpacked publish size 26.93 MB 26.90 MB -39.0 kB ✅
Package Installed footprint 75.01 MB 74.97 MB -39.0 kB ✅
Package Published files 4202 4198 -4
Package Installed files 8211 8207 -4
Package Installed package instances 34 34 0
Package Distinct installed package names 32 32 0
Package Installed dependency edges 51 51 0
Package Installed optional peer edges 9 9 0
Runtime Unique function payloads 2 2 0
Runtime Total function bytes 24.54 MB 24.53 MB -7.2 kB ✅
Runtime Public routes 17 17 0
Changed function payloads vs v27/instrumentation (27a92d6) (2)
Function Status Baseline Current Delta Route changes
functions/__server.func changed 12.27 MB 12.27 MB -3.6 kB ✅ none
functions/.well-known/workflow/v1/flow.func changed 12.27 MB 12.27 MB -3.6 kB ✅ none

eve init install

Metric Baseline Current Delta
Installed footprint 113.30 MB 113.26 MB -39.0 kB ✅
Installed packages 97 97 0
dependencies 4 4 0
devDependencies 2 2 0
Dependency package bytes 45.07 MB 45.04 MB -39.0 kB ✅
devDependency package bytes 5.11 MB 5.11 MB 0 B ➖
Build Metadata
  • Preset: vercel
  • Nitro: nitro@3.0.260903-beta
  • Output directory: apps/fixtures/weather-agent/.vercel/output
  • Build metadata timestamp: 2026-10-14T23:48:55.301Z
  • Route aliases: 17 public, 1 internal (18 total aliases)
  • Vercel routes in config: 20
  • Severity legend: 🔴 dominant/large, 🟠 notable, 🟡 watch, ⚪ small
Package Drill-Down

Package Details

  • Package: eve@0.79.1
  • Package directory: packages/eve
  • Tarball: 7.65 MB (eve-0.79.1.tgz)
  • Unpacked payload: 26.90 MB across 4198 published files
  • Installed footprint: 74.97 MB across 8207 installed files
  • Installed root package: 26.90 MB
  • Installed dependencies: 48.08 MB
  • Installed package instances: 34
  • Distinct installed package names: 32
  • Installed dependency edges: 51
  • Installed optional peer edges: 9
  • Runtime dependencies: 2
  • Peer dependencies: 7 (6 optional)

Installed footprint is measured from an isolated temporary npm install of the packed tarball.
Graph metrics read only package.json files in package directories directly beneath a node_modules boundary, including nested boundaries. Each directory is one package instance; distinct names come from those manifests. Dependency edges count each unique name in dependencies or optionalDependencies per instance; optional peer edges count peerDependencies marked optional.

Heavy installed dependencies

  • eve: 26.90 MB (35.9%)
  • @rolldown/binding-linux-x64-gnu: 19.81 MB (26.4%)
  • ai: 8.20 MB (10.9%)
  • zod: 6.15 MB (8.2%)
  • undici: 3.56 MB (4.8%)
Publish payload breakdown
Published file size
🟠 dist/src/compiled/shadcn-registry/index.js       [#####...................] 3.85 MB 14.3%
🟠 dist/src/compiled/@photon-ai/chat-adapter-ime... [###.....................] 2.29 MB 8.5%
🟠 dist/src/compiled/@ai-sdk/code-mode/index.js     [#.......................] 1.03 MB 3.8%
🟡 dist/src/compiled/@vercel/blob/index.js          [#.......................] 604.9 kB 2.2%
🟡 dist/src/compiled/_chunks/workflow/undici-D-I... [#.......................] 521.9 kB 1.9%
🔴 Other published files                            [########################] 18.61 MB 69.2%
Installed footprint breakdown
Installed package size
🔴 eve                             [########################] 26.90 MB 35.9%
🔴 @rolldown/binding-linux-x64-gnu [##################......] 19.81 MB 26.4%
🔴 ai                              [#######.................] 8.20 MB 10.9%
🔴 zod                             [#####...................] 6.15 MB 8.2%
🟠 undici                          [###.....................] 3.56 MB 4.8%
🟠 nitro                           [##......................] 1.89 MB 2.5%
🔴 Other installed packages        [########................] 8.46 MB 11.3%
Runtime dependencies (2)
Package Range Notes
nitro 3.0.260903-beta
undici 8.10.2
Peer dependencies (7)
Package Range Notes
@opentelemetry/api ^1.0.0 optional peer
ai catalog:
braintrust ^3.0.0 optional peer
chat ^4.41.0 optional peer
dd-trace ^6.13.0 optional peer
just-bash ^3.1.0 optional peer
microsandbox ^0.5.0 optional peer
eve init install drill-down

eve init install details

  • Command: eve init my-agent
  • Package manager: npm
  • Installed footprint: 113.26 MB across 10102 installed files
  • Installed packages: 97 total (91 transitive-only)
  • dependencies: 4 direct packages totaling 45.04 MB
  • devDependencies: 2 direct packages totaling 5.11 MB
  • Other transitive package files: 63.11 MB

Installed footprint is measured from an isolated temporary eve init my-agent using the current packed eve tarball.

Heavy installed dependencies

  • @typescript/typescript-linux-x64: 27.95 MB (24.7%)
  • eve: 26.90 MB (23.7%)
  • @rolldown/binding-linux-x64-gnu: 19.81 MB (17.5%)
  • zod: 9.76 MB (8.6%)
  • ai: 8.20 MB (7.2%)
Installed footprint breakdown
Installed package size
🔴 @typescript/typescript-linux-x64 [########################] 27.95 MB 24.7%
🔴 eve                              [#######################.] 26.90 MB 23.7%
🔴 @rolldown/binding-linux-x64-gnu  [#################.......] 19.81 MB 17.5%
🔴 zod                              [########................] 9.76 MB 8.6%
🔴 ai                               [#######.................] 8.20 MB 7.2%
🟠 undici                           [###.....................] 3.56 MB 3.1%
🔴 Other installed packages         [###############.........] 17.09 MB 15.1%
dependencies (4)
Package Range Installed size Share
@vercel/connect 2.2.0 188.7 kB 0.2%
ai ^7.0.137 8.20 MB 7.2%
eve file:eve-0.79.1.tgz 26.90 MB 23.7%
zod 4.5.4 9.76 MB 8.6%
devDependencies (2)
Package Range Installed size Share
@types/node 24.x 2.61 MB 2.3%
typescript 7.0.2 2.50 MB 2.2%
Function Drill-Down

Payload Size Graph

Unique function payload size and share of total
🔴 functions/.well-known/workflow/v1/flow.func     [########################] 12.27 MB 50.0%
🔴 functions/__server.func                         [########################] 12.27 MB 50.0%

Top Function Payloads

🟠 functions/.well-known/workflow/v1/flow.func • 1 public route • 12.27 MB
Metric Value
Public routes /.well-known/workflow/v1/flow
Runtime nodejs24.x
Handler index.mjs
Payload 12.27 MB
Function files 12.27 MB across 122 files
Traced dependencies 0 B
Signal 🟠 Bundled file _chunks/vercel.web.mjs is 4.26 MB (34.7%)

🟠 🔎 Dependency Analysis

📦 Bundled files:

Bundled file size
🟠 _chunks/vercel.web.mjs                         [######################..] 4.26 MB 34.7%
🟠 _libs/undici.mjs                               [#####...................] 1.01 MB 8.2%
🟡 _chunks/sandbox3.mjs                           [####....................] 815.4 kB 6.6%
🟡 _chunks/compiled-artifacts-instrumentation.mjs [####....................] 733.9 kB 6.0%
🟡 _chunks/token-util-Bla5Z0G9.mjs                [####....................] 704.7 kB 5.7%
🟠 Other bundled files                            [########################] 4.75 MB 38.7%

🧾 Vercel Config

{
  "handler": "index.mjs",
  "launcherType": "Nodejs",
  "shouldAddHelpers": false,
  "supportsResponseStreaming": true,
  "runtime": "nodejs24.x",
  "maxDuration": "max",
  "experimentalTriggers": [
    {
      "type": "queue/v2beta",
      "topic": "__eve776561746865722d6167656e74_wkf_workflow_*",
      "consumer": "default",
      "retryAfterSeconds": 5,
      "initialDelaySeconds": 0
    }
  ],
  "environment": {
    "WORKFLOW_PRECONDITION_GUARD": "1"
  }
}

🟠 functions/__server.func • 16 public routes, 1 internal alias • 12.27 MB
Metric Value
Public routes /
/.well-known/workflow/v1/webhook/[token]
/eve/v1/callback/[token]
/eve/v1/connections/[name]/callback/[attemptId]/[token]
/eve/v1/connections/[name]/callback/[token]
/eve/v1/health
/eve/v1/info
/eve/v1/session
/eve/v1/session/[parentSessionId]/subagents/[callId]/[childSessionId]/stream
/eve/v1/session/[sessionId]
/eve/v1/session/[sessionId]/cancel
/eve/v1/session/[sessionId]/clear
/eve/v1/session/[sessionId]/compact
/eve/v1/session/[sessionId]/reset
/eve/v1/session/[sessionId]/stream
/eve/v1/session/[sessionId]/stubs
Internal aliases /__server
Runtime nodejs24.x
Handler index.mjs
Payload 12.27 MB
Function files 12.27 MB across 122 files
Traced dependencies 0 B
Signal 🟠 Bundled file _chunks/vercel.web.mjs is 4.26 MB (34.7%)

🟠 🔎 Dependency Analysis

📦 Bundled files:

Bundled file size
🟠 _chunks/vercel.web.mjs                         [######################..] 4.26 MB 34.7%
🟠 _libs/undici.mjs                               [#####...................] 1.01 MB 8.2%
🟡 _chunks/sandbox3.mjs                           [####....................] 815.4 kB 6.6%
🟡 _chunks/compiled-artifacts-instrumentation.mjs [####....................] 733.9 kB 6.0%
🟡 _chunks/token-util-Bla5Z0G9.mjs                [####....................] 704.7 kB 5.7%
🟠 Other bundled files                            [########################] 4.75 MB 38.7%

🧾 Vercel Config

{
  "handler": "index.mjs",
  "launcherType": "Nodejs",
  "shouldAddHelpers": false,
  "supportsResponseStreaming": true,
  "runtime": "nodejs24.x"
}

Build Timing: e2e/fixtures/agent-tools-sandbox

This is an informational timing measurement inside eve build, from preflight through publication. Output-size measurement and profile writing are excluded.

Build mode: deployable Vercel build with sandbox template prewarm included.

  • Build pipeline: 3.78 s -> 3.83 s (+53.7 ms) vs v27/instrumentation (27a92d6).
  • Timing is informational: shared GitHub runners are too variable for a hard timing budget.
Detailed phase timings vs `v27/instrumentation (27a92d6)`
Phase Baseline Current Delta
extension.check 0.5 ms 0.5 ms 0.0 ms
project.resolve 0.4 ms 0.4 ms 0.0 ms
workspace.create 0.6 ms 0.6 ms 0.0 ms
host.prepare 729.2 ms 777.1 ms +47.9 ms
vercel.service-prefix.resolve 2.5 ms 1.8 ms -0.7 ms
nitro.create 816.5 ms 859.9 ms +43.4 ms
sandbox.prewarm 200.4 ms 229.8 ms +29.4 ms
nitro.cache.prepare 0.3 ms 0.2 ms -0.1 ms
nitro.prepare 0.8 ms 0.7 ms -0.1 ms
nitro.public-assets 0.8 ms 0.8 ms 0.0 ms
nitro.prerender 0.5 ms 0.6 ms +0.1 ms
nitro.bundle 1.88 s 1.82 s -64.1 ms
nitro.cache.write 0.5 ms 0.4 ms -0.1 ms
vercel.workflow-function.materialize 55.4 ms 59.4 ms +4.0 ms
agent-summary.emit 0.7 ms 0.7 ms 0.0 ms
connect-manifest.emit 0.4 ms 0.3 ms -0.1 ms
nitro.close 0.1 ms 0.1 ms 0.0 ms
output.publish 3.7 ms 3.6 ms -0.1 ms
workspace.remove 3.2 ms 2.9 ms -0.3 ms

Comment thread packages/eve/src/client/eve-agent-store.ts Outdated
Comment thread packages/eve/src/protocol/event-dedupe.ts
Comment thread packages/eve/src/client/eve-agent-store.ts Outdated
Comment thread packages/eve/src/client/eve-agent-store.ts
Comment thread packages/eve/src/execution/session/turn-step.ts Outdated
Comment thread packages/eve/src/client/eve-agent-store.ts

@vercel vercel Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Orphaned test file imports a deleted module, breaking typecheck and unit tests on a clean checkout

Fix on Vercel

Comment thread packages/eve/src/client/eve-agent-store.ts

@vercel vercel Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestions:

  1. The v27 refactor left consumer files referencing removed/renamed session-event APIs, so tsc -p tsconfig.build.json fails with 12 errors and aborts the Vercel build.
  1. teamsChannel.test.ts references an undefined makeEvent helper and the unimported UnstampedMessageStreamEvent type in a describe block that tests a now-dead Teams sign-in-button feature, causing a ReferenceError at test-collection time that fails the entire file.

Fix on Vercel

@OwenKephart
OwenKephart force-pushed the v27/observable-session branch from 006bcf6 to 6c4a58f Compare October 15, 2026 20:01
@OwenKephart
OwenKephart force-pushed the v27/observable-session branch from 6c4a58f to 5dcff66 Compare October 16, 2026 00:05
@OwenKephart
OwenKephart force-pushed the v27/observable-session branch from 5dcff66 to eadf15a Compare October 16, 2026 01:28
@OwenKephart
OwenKephart force-pushed the v27/observable-session branch from eadf15a to f2611b4 Compare October 16, 2026 02:01
@OwenKephart
OwenKephart force-pushed the v27/observable-session branch from f2611b4 to 9e8046c Compare October 16, 2026 16:19
…state

Signed-off-by: owenkephart <owen.kephart@vercel.com>

@AndrewBarba AndrewBarba left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Holding approval on doc breakage that survives to the stack top; the fixes are small.

Framework guides still use the removed API:

  • docs/guides/frontend/tanstack.mdx:117,130, sveltekit.mdx:53, nuxt.mdx:62 compute isBusy from status === "submitted" || "streaming". Status is now idle | busy | resuming, so the composer never disables (it's also a TS no-overlap error).
  • tanstack.mdx:130 renders agent.data.messages; data is gone, so a copied sample throws on first render.
  • Fix: status === "busy" and agent.messages / messages.value.

Important:

  • Public TSDoc in react|vue|svelte/use-eve-agent.ts still describes ready | submitted | streaming | error and data.messages.
  • client/eve-agent-store.ts:414-424: turn.started clears #error, so resume() replay can fire onError once for every failed turn in history (mostly resume: true with initialSession and no initialEvents). The docs promise no historical callbacks. Skip onError and the clear while #resumePromise is set, and add a store test.
  • apps/templates/eve-chat-template/docs/how-the-chatbot-works.md:300,447 still use agent.data.*.

Minor: a stalled POST freezes all snapshot publishes (#publish returns while #posting > 0); resume().finally resets #finishes, dropping onFinish for a turn settling during catch-up; the snapshot doc comment sits on AcceptedDelivery.

@AndrewBarba

Copy link
Copy Markdown
Collaborator

Fixed at the top of the atomic stack in b4b80a9 (on v27/lab-fixes, #4855). The TanStack, SvelteKit, and Nuxt guides now use status === "busy" and agent.messages. The React, Vue, and Svelte TSDoc describes the flat snapshot and idle | busy | resuming, and the chat template docs use agent.messages and agent.view.interactions. Also fixed from #4574: tool part state (not status) and the flat-snapshot line in the upgrade guide. pnpm docs:check passes. The resume() onError replay remains a follow-up.

@AndrewBarba AndrewBarba left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving: the guide and TSDoc breakage is fixed at the top of the atomic stack in b4b80a9. The resume() onError replay and the snapshot publish gating are follow-ups.

Signed-off-by: Andrew Barba <barba@hey.com>
Signed-off-by: Andrew Barba <barba@hey.com>

This branch had an error being deployed

2 failed deployments
Preview – eve-pkg — a6f4d791 Deployed Oct 20, 2026 by vercel[bot]
Preview – eve-docs — a6f4d791 Deployed Oct 20, 2026 by vercel[bot]
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.

2 participants