items

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package items owns public Items: it projects execution observations to the supported Item variants, merges them into stored Items and builds the ordered public events that report each Item change.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Events

func Events(change Change, outputIndex *int32) []v1.SessionEvent

Events returns the public events that report change, in publication order. outputIndex is the Item's output index, nil when it has none. An unchanged Item reports nothing.

func Identity

func Identity(turn, key string) string

func Merge

func Merge(update Update, previous v1.Item) (v1.Item, error)

Types

type Change

type Change struct {
	// Previous is the stored Item, zero for a new one.
	Previous v1.Item
	Item     v1.Item
	// Output reports whether a new Item takes the Turn's next output index.
	// Inputs, function results included, take none.
	Output bool
	// Delta is the text or command output fragment this observation
	// contributed, nil when it contributed none.
	Delta *string
}

Change is one decided Item write.

func Observe

func Observe(kind string, update Update, stored Stored) (Change, bool, error)

Observe decides how an Update projected from an observation of kind changes its stored Item. It reports false when the Update is superseded and writes nothing.

type Stored

type Stored struct {
	// Item is the stored Item, or the zero Item when the Update adds a new one.
	Item v1.Item
	// NativeMessage reports that the Turn has an assistant message other than
	// this Item. Observe reads it only when the Update NeedsNativeMessage.
	NativeMessage bool
	// FunctionResult is the result the application saved for the call, if any.
	// Observe reads it only for an Update with a ResultCall.
	FunctionResult json.RawMessage
}

Stored is what a Session already holds for an Update's Item.

type Update

type Update struct {
	Item               v1.Item
	AppendText         bool
	CommandOutputDelta *string
	// A legacy aggregate is used only when no native message identity was recorded.
	LegacyFinal bool
}

func Project

func Project(turn, kind string, sequence int64, raw json.RawMessage) ([]Update, error)

func (Update) NeedsNativeMessage

func (u Update) NeedsNativeMessage() bool

NeedsNativeMessage reports whether Observe reads Stored.NativeMessage for u: a legacy aggregate applies only when the Turn recorded no native message.

func (Update) ResultCall

func (u Update) ResultCall() (string, bool)

ResultCall returns the call whose saved result Observe reads for u, a function result.

Jump to

Keyboard shortcuts

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