Add execution control request contracts

This commit is contained in:
2026-11-14 17:36:03 +00:00
parent 0e4f590f5a
commit 2066579e09
7 changed files with 73 additions and 0 deletions

View File

@@ -85,6 +85,21 @@ const (
// own private execution snapshot for RunPrepared. Excessively deep or large
// JSON-shaped values are rejected for safety.
type RunRequest struct {
// OperationTimeout selects a whole-operation budget when positive. Run
// applies it across preparation and execution; PrepareExecution retains it
// for RunPrepared, without counting preparation or idle time. Zero or a
// negative value selects no additional timeout. This is independent of the
// provider generation timeout. Cancellation remains cooperative.
OperationTimeout time.Duration `json:"-" yaml:"-"`
// OnPrepared synchronously receives detached, credential-redacted details of
// the logical request after preparation and admission, before generation,
// if execution reaches that point. Admission remains held, and callback time
// consumes OperationTimeout. The callback owns the delivered mutable values;
// its closure is shared and must synchronize any shared state. It has no
// error return, and a panic propagates after resource cleanup. Prepare and
// ValidateRequest do not invoke it; PrepareExecution retains the selected
// function for RunPrepared and Discard releases it.
OnPrepared func(context.Context, PreparedRun) `json:"-" yaml:"-"`
// CaptureExchange requests an immutable snapshot of a completed run, even
// when its structural validation fails. Operational errors return no result.
// The snapshot is returned in RunResult.Exchange; see [Exchange] for its