fix: make tool progress live-only (#38217)

This commit is contained in:
Kit Langton 2026-07-22 10:40:07 -04:00 committed by GitHub
commit 5a9ed4d350
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 337 additions and 89 deletions

View file

@ -3,8 +3,7 @@ export * as SessionEvent from "./session-event.js"
import { Schema } from "effect"
import { optional } from "./schema.js"
import { Event } from "./event.js"
import { ToolContent } from "./llm.js"
import { FinishReason } from "./llm.js"
import { FinishReason, ToolContent } from "./llm.js"
import { Model } from "./model.js"
import { NonNegativeInt, PositiveInt, RelativePath } from "./schema.js"
import { FileAttachment } from "./prompt.js"
@ -410,13 +409,9 @@ export namespace Tool {
})
export type Called = typeof Called.Type
/**
* Replayable bounded running-tool state. Tools should checkpoint semantic
* transitions or at a bounded cadence, not persist every stdout/stderr chunk.
*/
export const Progress = Event.durable({
/** Live replacement snapshot for a running tool. */
export const Progress = Event.ephemeral({
type: "session.tool.progress",
...options,
schema: {
...ToolBase,
structured: Schema.Record(Schema.String, Schema.Unknown),
@ -445,6 +440,8 @@ export namespace Tool {
schema: {
...ToolBase,
error: SessionError.Error,
content: Schema.NonEmptyArray(ToolContent).pipe(optional),
metadata: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
result: Schema.Unknown.pipe(optional),
executed: Schema.Boolean,
resultState: SessionMessage.ProviderState.pipe(optional),