mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
Order provider facts before late delivery receipts
This commit is contained in:
+1
@@ -69,6 +69,7 @@ export function createStructuredAgentSessionHostMutationContext(
|
||||
input.runtimeState.currentEventSink(sessionId)?.sink
|
||||
),
|
||||
publishWorkChanged: (sessionId) => input.clientDelivery.publishGenerationEnded(sessionId),
|
||||
sealEventSink: (sessionId) => input.runtimeState.sealEventSink(sessionId),
|
||||
captureChildWorkStops: input.clientDelivery.captureChildWorkStops,
|
||||
childWorkOpen: input.clientDelivery.childWorkOpen,
|
||||
childWorkIncomplete: input.clientDelivery.childWorkIncomplete,
|
||||
|
||||
+2
@@ -215,6 +215,8 @@ export class StructuredAgentSessionHostRuntimeState {
|
||||
return created
|
||||
}
|
||||
|
||||
sealEventSink = (sessionId: string): void => this.eventSinks.get(sessionId)?.seal()
|
||||
|
||||
/** Failed sinks retain permanent barrier errors; discard instead of reusing them. */
|
||||
currentEventSink(sessionId: string): DeferredStructuredAgentSessionEventSink | undefined {
|
||||
const existing = this.eventSinks.get(sessionId)
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ export class StructuredAgentSessionSinkQueue {
|
||||
this.dispatch.push(operation)
|
||||
}
|
||||
|
||||
private seal(): void {
|
||||
seal(): void {
|
||||
if (this.target) {
|
||||
const operation = this.dispatch.seal(this.target)
|
||||
if (operation) {
|
||||
|
||||
+2
@@ -162,6 +162,7 @@ export type DeferredStructuredAgentSessionEventSink = {
|
||||
unbind(): void
|
||||
followSnapshots(source: StructuredAgentSessionSnapshotSource): Promise<void>
|
||||
liveText(): readonly AgentJournalRenderItem[]
|
||||
seal(): void
|
||||
close(): void
|
||||
drained(): Promise<StructuredAgentSessionSinkBarrier>
|
||||
lifecycleBarrier(): Promise<StructuredAgentSessionSinkBarrier>
|
||||
@@ -320,6 +321,7 @@ export function createDeferredStructuredAgentSessionEventSink(deps: {
|
||||
unbind: () => queue.unbind(),
|
||||
followSnapshots: (source) => queue.snapshots.follow(source),
|
||||
liveText: queue.liveText,
|
||||
seal: () => queue.seal(),
|
||||
close: () => {
|
||||
queue.flushLiveText()
|
||||
queue.close()
|
||||
|
||||
+2
@@ -58,6 +58,8 @@ export async function settleStructuredAgentSessionLateDispatch(
|
||||
session.journal,
|
||||
input.clientMessageId,
|
||||
async () => {
|
||||
// Earlier provider facts take their writer position before this receipt.
|
||||
context.sealEventSink(input.sessionId)
|
||||
await session.journal.settleLateDispatch(settlement)
|
||||
}
|
||||
)
|
||||
|
||||
+1
@@ -37,6 +37,7 @@ export type StructuredAgentSessionMutationContext = {
|
||||
publishChildWork: (sessionId: string, evidence: AgentChildWorkEvidence[]) => void
|
||||
/** Republish held-work changes without journal rows. */
|
||||
publishWorkChanged: (sessionId: string) => void
|
||||
sealEventSink: (sessionId: string) => void
|
||||
captureChildWorkStops: (sessionId: string, handleIds: readonly string[]) => CapturedChildWorkStops
|
||||
/** Includes running child work without records. */
|
||||
childWorkOpen: (sessionId: string) => boolean
|
||||
|
||||
Reference in New Issue
Block a user