opencode_types

package
v0.0.257 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 4 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromOpencode added in v0.0.18

func FromOpencode(events []Event, _ string) []types.AgentEvent

Types

type CacheTokens added in v0.0.18

type CacheTokens struct {
	Read  int `json:"read"`
	Write int `json:"write"`
}

type ErrorData

type ErrorData struct {
	Message string `json:"message"`
}

type ErrorDetail

type ErrorDetail struct {
	Name string     `json:"name"`
	Data *ErrorData `json:"data"`
}

type Event

type Event struct {
	Type      EventType    `json:"type"`
	Timestamp int64        `json:"timestamp,omitempty"`
	SessionID string       `json:"sessionID,omitempty"`
	Part      any          `json:"part,omitempty"`
	Error     *ErrorDetail `json:"error,omitempty"`
	Done      bool         `json:"done,omitempty"`
}

func ToOpencode

func ToOpencode(events []types.AgentEvent, sessionID string) []Event

type EventType added in v0.0.18

type EventType string
const (
	EvtReasoning  EventType = "reasoning"
	EvtText       EventType = "text"
	EvtError      EventType = "error"
	EvtDone       EventType = "done"
	EvtStepStart  EventType = "step_start"
	EvtStepFinish EventType = "step_finish"
	EvtToolUse    EventType = "tool_use"
)

type PartType added in v0.0.18

type PartType string
const (
	PartReasoning  PartType = "reasoning"
	PartText       PartType = "text"
	PartTool       PartType = "tool"
	PartStepStart  PartType = "step-start"
	PartStepFinish PartType = "step-finish"
)

type ReasoningPart

type ReasoningPart struct {
	ID   string     `json:"id"`
	Type PartType   `json:"type"`
	Text string     `json:"text"`
	Time *TimeRange `json:"time,omitempty"`
}

type StepFinishPart added in v0.0.18

type StepFinishPart struct {
	ID        string   `json:"id"`
	SessionID string   `json:"sessionID"`
	MessageID string   `json:"messageID"`
	Type      PartType `json:"type"`
	Reason    string   `json:"reason"`
	Snapshot  string   `json:"snapshot,omitempty"`
	Cost      float64  `json:"cost"`
	Tokens    Tokens   `json:"tokens"`
}

type StepStartPart added in v0.0.18

type StepStartPart struct {
	ID        string   `json:"id"`
	SessionID string   `json:"sessionID"`
	MessageID string   `json:"messageID"`
	Type      PartType `json:"type"`
	Snapshot  string   `json:"snapshot,omitempty"`
}

type TextPart

type TextPart struct {
	ID   string     `json:"id"`
	Type PartType   `json:"type"`
	Text string     `json:"text"`
	Time *TimeRange `json:"time,omitempty"`
}

type TimeRange added in v0.0.18

type TimeRange struct {
	Start int64 `json:"start"`
	End   int64 `json:"end,omitempty"`
}

type Tokens added in v0.0.18

type Tokens struct {
	Input     int         `json:"input"`
	Output    int         `json:"output"`
	Reasoning int         `json:"reasoning"`
	Cache     CacheTokens `json:"cache"`
}

type ToolUsePart

type ToolUsePart struct {
	ID     string       `json:"id"`
	Type   PartType     `json:"type"`
	CallID string       `json:"callID"`
	Tool   string       `json:"tool"`
	State  ToolUseState `json:"state"`
}

type ToolUseState

type ToolUseState struct {
	Input    map[string]any `json:"input,omitempty"`
	Output   string         `json:"output,omitempty"`
	Stderr   string         `json:"stderr,omitempty"`
	ExitCode int            `json:"exit_code"`
	Error    string         `json:"error,omitempty"`
	Status   string         `json:"status,omitempty"`
	Title    string         `json:"title,omitempty"`
	Time     *TimeRange     `json:"time,omitempty"`
}

Jump to

Keyboard shortcuts

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