Compose execution observers in order

This commit is contained in:
2026-11-14 01:26:49 +00:00
parent a07e95fd17
commit 23fb55f9df
4 changed files with 108 additions and 2 deletions

View File

@@ -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