propagate parent session status context

This commit is contained in:
Shoubhit Dash
2026-05-31 17:21:06 +05:30
parent f401f01c05
commit 522322980e
6 changed files with 98 additions and 23 deletions
+14 -9
View File
@@ -57,6 +57,7 @@ type Input = {
assistantMessage: SessionLegacy.Assistant
sessionID: SessionID
model: Provider.Model
statusContext?: SessionStatus.SetContext
}
export interface Interface {
@@ -777,7 +778,7 @@ export const layer = Layer.effect(
sessionID: ctx.assistantMessage.sessionID,
error: ctx.assistantMessage.error,
})
yield* status.set(ctx.sessionID, { type: "idle" })
yield* status.set(ctx.sessionID, { type: "idle" }, ctx.statusContext)
})
const process = Effect.fn("SessionProcessor.process")(function* (streamInput: LLM.StreamInput) {
@@ -789,7 +790,7 @@ export const layer = Layer.effect(
yield* Effect.gen(function* () {
ctx.currentText = undefined
ctx.reasoningMap = {}
yield* status.set(ctx.sessionID, { type: "busy" })
yield* status.set(ctx.sessionID, { type: "busy" }, ctx.statusContext)
const stream = llm.stream(streamInput)
yield* stream.pipe(
@@ -829,13 +830,17 @@ export const layer = Layer.effect(
: Effect.void
return event.pipe(
Effect.andThen(
status.set(ctx.sessionID, {
type: "retry",
attempt: info.attempt,
message: info.message,
action: info.action,
next: info.next,
}),
status.set(
ctx.sessionID,
{
type: "retry",
attempt: info.attempt,
message: info.message,
action: info.action,
next: info.next,
},
ctx.statusContext,
),
),
)
},