Clarify artifact reader ownership transfer
This commit is contained in:
8
types.go
8
types.go
@@ -295,15 +295,17 @@ type Artifact struct {
|
||||
//
|
||||
// Read may be called concurrently. It must honor ctx cancellation to make
|
||||
// Prepare, PrepareExecution, and Run responsive to cancellation. The engine
|
||||
// passes a copied ref and immediately copies the returned Artifact.Body; it
|
||||
// does not retain either value. Readers supply artifact metadata, and the
|
||||
// passes a copied ref and defensively copies the returned Artifact.Body.
|
||||
// A successful Read transfers the returned artifact and its mutable body
|
||||
// storage to Promptkit. The reader must not mutate them through retained
|
||||
// aliases after return. Private buffers may be reused only when the returned
|
||||
// storage is independent. Readers supply artifact metadata, and the
|
||||
// engine assigns an input-map name only when the returned artifact name is
|
||||
// empty.
|
||||
//
|
||||
// An injected reader owns any application-specific path containment,
|
||||
// authorization, content-size, and content-type policy. It must protect
|
||||
// sensitive references and bodies in its logging and in any copies it retains.
|
||||
// It may reuse or mutate the returned artifact and body after Read returns.
|
||||
//
|
||||
// Returning a non-nil error makes the engine return an error matching
|
||||
// ErrArtifactLoad while preserving the reader error through errors.Is.
|
||||
|
||||
Reference in New Issue
Block a user