Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

Simplify the persisted event schema.

debajyoti-truefoundryb286e942fedf
diff --git a/packages/harness/src/agentSession/README.md b/packages/harness/src/agentSession/README.md
index 2468b7b10..e69de29bb 100644
--- a/packages/harness/src/agentSession/README.md
+++ b/packages/harness/src/agentSession/README.md
@@ -1,16 +0,0 @@
-# agentSession
-
-Middle library: durable sessions/turns over `ISessionStore`, wired to the public harness for execution.
-
-**Deps:** `agentSession → harness`. Never reverse.
-
-## Scope
-
-- Zod product contracts (`schemas/`) — no `sequence_number`, no SSE envelopes
-- `Sessions` / `SessionHandle` / `TurnHandle` — storage + `run()` / `stream()`
-- `ISessionStore` + `InMemorySessionStore` (reference impl)
-- `ITurnResourceResolver` / `TurnResourceResolver` — per-run secrets/providers
-
-## Not in v1
-
-Private gateway adoption (handlers, Redis store, ActiveTurnRegistry, SSE fan-out, `/subscribe`) is **out of scope**. §4 of the design plan is a mapping sketch only — gradual adapt later; this package does not replace private gateway code.
diff --git a/packages/harness/src/agentSession/index.ts b/packages/harness/src/agentSession/index.ts
index 66e2d2bc8..3115ab8fc 100644
--- a/packages/harness/src/agentSession/index.ts
+++ b/packages/harness/src/agentSession/index.ts
@@ -30,7 +30,6 @@ export {
SessionEventSchema,
TurnCreatedEventSchema,
TurnDoneEventSchema,
- TurnEventSchema,
} from './schemas/events';
export type {
PersistedTurnEvent,
@@ -38,7 +37,6 @@ export type {
SessionEventItem,
TurnCreatedEvent,
TurnDoneEvent,
- TurnEvent,
} from './schemas/events';
export { TokenPaginationSchema } from './schemas/pagination';
diff --git a/packages/harness/src/agentSession/schemas/events.ts b/packages/harness/src/agentSession/schemas/events.ts
index d2d3d16ac..3e12f36a0 100644
--- a/packages/harness/src/agentSession/schemas/events.ts
+++ b/packages/harness/src/agentSession/schemas/events.ts
@@ -56,9 +56,11 @@ export const TurnDoneEventSchema = z
})
.openapi('TurnDoneEvent');
-/** Persisted turn content events — no deltas, no lifecycle. */
-export const TurnEventSchema = z
+/** Built-in durable turn events — lifecycle + content; no deltas, no passthrough. */
+export const SessionEventSchema = z
.discriminatedUnion('type', [
+ TurnCreatedEventSchema,
+ TurnDoneEventSchema,
ModelMessageEventSchema,
ToolResponseEventSchema,
ThreadCreatedEventSchema,
@@ -69,11 +71,6 @@ export const TurnEventSchema = z
ToolApprovalRequiredEventSchema,
ToolResponseRequiredEventSchema,
])
- .openapi('TurnEvent');
-
-/** turn.created, turn.done, or a persisted turn event — no deltas. */
-export const SessionEventSchema = z
- .discriminatedUnion('type', [TurnCreatedEventSchema, TurnDoneEventSchema, ...TurnEventSchema.options])
.openapi('SessionEvent');
/** One row on the session timeline: which turn emitted the event plus the event payload. */
@@ -86,7 +83,6 @@ export const SessionEventItemSchema = z
export type TurnCreatedEvent = z.infer<typeof TurnCreatedEventSchema>;
export type TurnDoneEvent = z.infer<typeof TurnDoneEventSchema>;
-export type TurnEvent = z.infer<typeof TurnEventSchema>;
export type SessionEvent = z.infer<typeof SessionEventSchema>;
/**
* Durable turn event log entries: {@link SessionEvent} plus any registered