subagentstream

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package subagentstream merges host delegation events into a Runner's single adaptor Event stream as SubagentUpdate values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(ctx context.Context, stream adaptor.Stream, bus EventBus) adaptor.Stream

Merge returns a Stream that carries every event of stream plus one adaptor.SubagentUpdate per delegation event published for stream.RunID() on bus. Per-source ordering is preserved (parent events in stream order, delegation events in bus order); the two sources interleave as they arrive. RunID, Result, and Cancel delegate to the parent stream, and the merged Events channel closes after the parent stream ends (terminal SubagentUpdate markers are synthesized for delegations that never reported one). A nil bus returns stream unchanged.

ctx bounds the bus subscription; cancel it (or the parent run) to detach. Like the parent stream, the merged channel must be drained.

func SubagentEvent

SubagentEvent projects one DelegationEvent onto the adaptor event vocabulary. The 19 DelegationEventKinds collapse onto the three SubagentUpdate kinds (started / delta / finished); the full detail — original kind, status, remote identifiers, tool payloads, errors — is preserved in Data so nothing is lost in the projection.

The canonical projection lives in a2adelegation so host-side merging and delegation service injection produce identical SubagentUpdate values.

Types

type EventBus

type EventBus interface {
	// SubscribeRun returns delegation events associated with runID until ctx
	// is canceled or the subscription closes.
	SubscribeRun(ctx context.Context, runID string) <-chan a2adelegation.DelegationEvent
}

EventBus is the minimal host-side subscription contract Merge consumes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL