fork

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxEvents       = 200
	DefaultMaxContextBytes = 256 * 1024
)

Variables

This section is empty.

Functions

func CoalesceAdjacentModelMessages added in v0.2.0

func CoalesceAdjacentModelMessages(values []store.ExecutionEvent) []store.ExecutionEvent

CoalesceAdjacentModelMessages joins streamed harness v2 chunks from the same prompt before fork retention is applied. Stored events remain immutable; the returned slice is a fork-context read model whose sequence/content identity points at the newest included chunk.

func SameHarnessV2ModelMessage added in v0.2.0

func SameHarnessV2ModelMessage(left, right store.ExecutionEvent) bool

SameHarnessV2ModelMessage reports whether two model-message events belong to the same harness v2 prompt and can therefore be adjacent stream chunks.

func SanitizeTaskNamePrefix

func SanitizeTaskNamePrefix(value string) string

Types

type Context

type Context struct {
	SourceNamespace string         `json:"sourceNamespace"`
	SourceTask      string         `json:"sourceTask"`
	AfterSeq        int64          `json:"afterSeq"`
	Events          []EventSummary `json:"events"`
	Truncated       bool           `json:"truncated"`
}

func BuildContext

func BuildContext(namespace, taskName string, afterSeq int64, events []store.ExecutionEvent, maxEvents int) Context

BuildContext returns a bounded, already-sanitized summary of events up to afterSeq.

func BuildContextWithLimits

func BuildContextWithLimits(
	namespace,
	taskName string,
	afterSeq int64,
	events []store.ExecutionEvent,
	maxEvents int,
	maxBytes int,
) Context

BuildContextWithLimits returns a bounded, already-sanitized summary of events up to afterSeq. Events are selected newest-first, then returned in chronological order. The byte limit bounds the marshaled Context payload that may be embedded into a forked Task prompt.

type EventSummary

type EventSummary struct {
	Seq         int64           `json:"seq"`
	Type        string          `json:"type"`
	Severity    string          `json:"severity"`
	Summary     string          `json:"summary,omitempty"`
	ToolName    string          `json:"toolName,omitempty"`
	ToolCallID  string          `json:"toolCallID,omitempty"`
	Content     json.RawMessage `json:"content,omitempty"`
	ContentText string          `json:"contentText,omitempty"`
}

Jump to

Keyboard shortcuts

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