Finalize conversation and execution group documentation

This commit is contained in:
2026-11-14 01:35:06 +00:00
parent 31cc0069fc
commit 5c135c5b28
13 changed files with 96 additions and 18 deletions

View File

@@ -43,11 +43,20 @@ type CoordinationResult struct {
}
// Coordinate advances one branch from Start using ordinary runs. Next is called
// initially even for a zero budget and receives each completed result once.
// initially even for a zero budget and receives each completed result once,
// including the final permitted response. The initial exchange is not itself a
// newly delivered result. Each started continuation consumes one turn; retries
// and structural repairs do not. Callback work runs after admission is released.
// A nil request stops; requesting a run without remaining budget exhausts it.
// Callback and execution errors retain their identities. Cancellation observed
// before delivery returns the single completed response as Undelivered;
// cancellation after callback invocation does not replay that response.
// cancellation after callback invocation does not replay that response. Context
// cancellation takes precedence over a callback's returned action or error.
// Start must be a captured exchange, Next non-nil, and AdditionalTurns
// nonnegative; invalid values match ErrInvalidRequest. A nil engine returns
// ErrInvalidConfig. The selected request is copied and its ContinueFrom is
// replaced by the coordinator's current exchange. The request observer runs
// before the coordinator observer for each continuation.
func (e *Engine) Coordinate(ctx context.Context, req CoordinateRequest) (CoordinationResult, error) {
if e == nil || e.internal == nil {
return CoordinationResult{}, fmt.Errorf("%w: engine is nil", ErrInvalidConfig)