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

observation

package
v0.0.0-...-c703685 Latest Latest
Warning

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

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

Documentation

Overview

Package observation contains decoded, read-only session facts. These values carry no backend request IDs, process handles, or execution capabilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandAction

type CommandAction struct{ Type, Command, Path, Query string }

type Context

type Context struct {
	Tokens, Window uint64
	Known          bool
}

type Event

type Event struct {
	At, Started                                 time.Time
	Kind                                        Kind
	ThreadID, TurnID, ItemID, Delta, TurnStatus string
	Item                                        Item
	Thread                                      Thread
	ThreadStatus, ProcessID, Stdin              string
	Context                                     Context
}

Event is an immutable observation. Started is present on retained item completions; synthetic starts and deltas are the replay consumer's policy.

type FileChange

type FileChange struct {
	Path, Diff string
	Kind       struct{ Type, MovePath string }
}

type Item

type Item struct {
	SavedPath                                          string
	CompactionReference                                string // Exact retained replacement bound to this native boundary.
	UserShell                                          bool   // Host-identified command entered by the user.
	ID, Type, Status, Text, Delivery, Phase, Cwd, Path string
	Command, ProcessID, ClientID                       string
	Tool                                               string
	Server                                             string         // MCP server identity.
	Arguments, Result, Error                           jsontext.Value // Opaque MCP input and outcome.
	DurationMS                                         *int64
	Summary                                            []string
	Content                                            jsontext.Value
	AggregatedOutput                                   *string
	ExitCode                                           *int
	Questions                                          []Question
	Changes                                            []FileChange
	CommandActions                                     []CommandAction
	Query                                              string
	Action                                             *WebSearchAction
	Results                                            *int
}

Item contains the retained facts used by session presentation. Content and question options preserve opaque user-content blocks for their own consumer; raw/private reasoning is never included.

type ItemRef

type ItemRef struct{ ThreadID, TurnID, ItemID string }

ItemRef preserves host identity independently of display names and feed order.

type Kind

type Kind string
const (
	TurnStarted       Kind = "turn/started"
	TurnCompleted     Kind = "turn/completed"
	ItemStarted       Kind = "item/started"
	ItemCompleted     Kind = "item/completed"
	AgentDelta        Kind = "item/agentMessage/delta"
	ReasoningDelta    Kind = "item/reasoning/summaryTextDelta"
	CommandDelta      Kind = "item/commandExecution/outputDelta"
	ProviderStarted   Kind = "replay/providerStarted"
	ProviderCompleted Kind = "replay/providerCompleted"
)
const ReasoningPart Kind = "item/reasoning/summaryPartAdded"

type Question

type Question struct {
	ID, Header, Question, Title string
	IsSecret                    bool
	Options                     jsontext.Value
}

type Source

type Source struct {
	Thread, Cwd string
	Events      []Event
	Unsupported map[string]int
	Bytes       int
}

Source is one decoded rollout, before timing synthesis or retained-record joins.

type TextEvent

type TextEvent struct {
	At    time.Time
	Kind  Kind
	Item  TextItem
	Delta string
}

type TextItem

type TextItem struct {
	Ref                  ItemRef
	Type, Text, Status   string
	Summary              []string
	AsyncQuestion, Final bool
}

TextItem contains only authored text and public-summary facts. User text is supplied by its Conversation consumer; no raw/private reasoning is carried.

type TextScope

type TextScope struct{ Thread, Turn *scope.Store }

TextScope carries application-owned correlation stores. A nil Turn admits only authoritative completion text, without reviving a closed turn's state.

type TextUpdate

type TextUpdate struct {
	Ref                       ItemRef
	Replaces                  string
	Kind, Phase, Text, Status string
	Observed, Completed       time.Time
	Thought                   time.Duration
	Live                      bool
	Sequence                  uint64
}

TextUpdate is a transient projection into an existing feed, not another transcript. Sequence is assigned by the feed consumer before terminal pacing.

type Thread

type Thread struct {
	ID, Nickname, Path, Role string
	NonAttachable            bool
}

Thread is admitted metadata, not a filesystem or host-request capability.

type Transcript

type Transcript interface {
	// current is false only when the application knows another turn is active.
	TurnCompleted(thread, turn, status string, at time.Time, current bool, stores TextScope) []TextUpdate
	Observe(TextEvent, bool, TextScope) []TextUpdate
	ProviderStarted(thread string, at time.Time, store *scope.Store) []TextUpdate
	OtherItemStarted(thread string, store *scope.Store) []TextUpdate
}

Transcript observes admitted text without execution, storage or renderer capabilities. Historical projection is deliberately separate from live state.

type WebSearchAction

type WebSearchAction struct {
	Type, Query, URL, Pattern string
	Queries                   []string
}

Jump to

Keyboard shortcuts

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