Help us shape the future of Go! Take the 2026 Go Developer Survey

payload

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package payload renders the payloads in tool responses. Payloads are Temporal's customer application data, such as workflow inputs and results, memos, heartbeat details and failure details. Each target's payload_handling says how a response shows them: omitted, passed through as stored, or decoded by the target's codec server.

A tool adds each payload of a response to one Batch, which returns the Field that stands for the payload in the response, and then renders the Batch once, which fills in every Field with at most one codec request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	// contains filtered or unexported fields
}

A Batch holds the payloads of one tool response, so that they are rendered together.

func (*Batch) Add

func (b *Batch) Add(p *commonpb.Payload) *Field

Add adds p to b and returns the Field that stands for it, which stays empty until Render.

func (*Batch) AddAll

func (b *Batch) AddAll(ps *commonpb.Payloads) []*Field

AddAll adds each of ps to b and returns the Fields that stand for them, in order; the slice is empty but not nil when ps has no payloads.

func (*Batch) Render

func (b *Batch) Render(ctx context.Context) error

Render fills in the Field of each payload in b as the target's payload_handling says. To decode, it sends every payload to the codec server in one request; each payload it cannot decode is omitted with reason decode_failed and an error that says why, and the cause goes to the log. Render returns an error only when ctx ends before the payloads are decoded.

type Field

type Field struct {
	Handling  string  `json:"handling" jsonschema:"decoded, passthrough or omitted"`
	Value     any     `` /* 164-byte string literal not displayed */
	Encoding  *string `` /* 297-byte string literal not displayed */
	Data      *string `` /* 183-byte string literal not displayed */
	SizeBytes *int    `` /* 140-byte string literal not displayed */
	Reason    string  `` /* 178-byte string literal not displayed */
	Error     string  `` /* 178-byte string literal not displayed */
}

Field is a payload in a tool response. Batch.Render fills it in.

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer renders the payloads of each target's tool responses.

func NewRenderer

func NewRenderer(cfg *config.Config, logger *slog.Logger) (*Renderer, error)

NewRenderer returns the Renderer for cfg's targets. logger gets the cause of each payload that is not decoded.

func (*Renderer) Batch

func (r *Renderer) Batch(target string) *Batch

Batch returns an empty Batch for a response about the named target.

func (*Renderer) CheckCodec

func (r *Renderer) CheckCodec(ctx context.Context, target string) string

CheckCodec sends the codec server of the named target, which must decode payloads, a decode request with no payloads, and returns why it failed, worded for agents, or "" if it succeeded. The cause of a failure goes to the log.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL