Compose execution observers in order
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"go.maximumdirect.net/promptkit/internal/domain"
|
||||
"go.maximumdirect.net/promptkit/internal/observation"
|
||||
)
|
||||
|
||||
// ExecutionObserver receives immutable metadata events synchronously. Callers
|
||||
@@ -16,6 +17,12 @@ import (
|
||||
// event, and Promptkit keeps no asynchronous queue or durable history.
|
||||
type ExecutionObserver func(ExecutionEvent)
|
||||
|
||||
// ComposeObservers returns a synchronous ordered fan-out of non-nil observers.
|
||||
// It copies the input slice; a panic propagates and prevents later callbacks.
|
||||
func ComposeObservers(observers ...ExecutionObserver) ExecutionObserver {
|
||||
return observation.Compose[ExecutionEvent](observers...)
|
||||
}
|
||||
|
||||
// ExecutionEventKind identifies one point in an execution's lifecycle.
|
||||
type ExecutionEventKind string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user