Conversation
|
🟡 agents import sizes: 1 entry point grew
Changed exports (3)
How this worksEach runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement. Compared |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
9277c20 to
5eee444
Compare
5eee444 to
88de7c7
Compare
88de7c7 to
5306161
Compare
5306161 to
98e8640
Compare
Named session records gain an optional activeTargetId, and connect() returns setActiveTarget(), which writes it only while the record still holds the same browser, so a stale connection never resurrects a closed or replaced session. A replacement browser starts with no active tab. NamedBrowserSessions and BrowserSessions also expose their binding through a browser getter. Internal; used by the persistent browser connector.
98e8640 to
dd053df
Compare
| spec: () => | ||
| loadCdpSpec({ browser: this.#browser, sessionId: resolved.sessionId }) |
There was a problem hiding this comment.
Named sessions now remember the agent's current tab, so when the model references
sessionId: "active"with the new connector we add in #2371, it will point at the same tab from one execution to the next. The record stores the tab'stargetIdbecause targets survive reconnects and CDP session ids don't.StoredBrowserSession { sessionId, createdAt, updatedAt, closedAt?, + activeTargetId? } connect(name) → { name, sessionId, restarted, cdp, + activeTargetId?, + setActiveTarget(targetId | undefined): Promise<boolean>, + spec(): Promise<SearchableCdpSpec> }setActiveTargetand the activity touch share one#updatehelper. It writes under the per-name lock only while the record still holds the same browser, and returnsfalseotherwise. A closed or replaced session is never brought back.spec()reads the CDP protocol from this connection's own browser (the path added in refactor(agents): share connector validation and load the CDP spec from a live session #2369). The connector uses it without ever seeing the Browser Run binding.Everything here is internal.
BrowserSessionsgets exported in #2372.Architecture diff
Each outlined box is a component this PR changes, with one green box per change. Grey boxes are unchanged, and dashed boxes arrive later in the stack.
flowchart TB classDef ctx fill:none,stroke:#8c959f,color:#8c959f classDef changes fill:#dafbe1,stroke:#1a7f37,color:#1f2328 classDef later fill:none,stroke:#8c959f,stroke-dasharray:4 3,color:#57606a Agent["Agent (host Durable Object)"]:::ctx BS["BrowserSessions · capability.ts"]:::ctx subgraph NBS["NamedBrowserSessions · session-core.ts"] direction TB N1["+ connect() returns activeTargetId, setActiveTarget()"]:::changes N2["+ connected session gets spec()"]:::changes N3["+ stale connections can't write the record"]:::changes N1 ~~~ N2 ~~~ N3 end subgraph Store["StoredBrowserSession · session-manager.ts"] Sc["+ activeTargetId?"]:::changes end BR["Browser Run"]:::ctx Spec["loadCdpSpec · spec.ts"]:::ctx Next["BrowserSessionConnector (next PR)<br/>reads and saves the active tab"]:::later Agent -->|lifecycle.use| BS BS --> NBS NBS -->|"one record per name"| Store NBS -->|"create · probe · CDP socket"| BR NBS -->|"spec() for this sessionId"| Spec Next -.-> BS style NBS stroke:#1a7f37,stroke-width:2px style Store stroke:#1a7f37,stroke-width:2px