Documentation
¶
Overview ¶
Package convert converts OpenHands SDK conversation directories into the Agent Session Format. docs/formats/openhands.md is the mapping and lists every finding code it reports.
Index ¶
Constants ¶
const Harness = "openhands"
Harness is the harness name the sessions carry.
const Source = "openhands"
Source is the format name and the namespace of every extension member and custom entry this converter writes.
const Unit = "files"
Unit names what a report's tally counts: a conversation is a directory of JSON files, one event per file, so each file is a unit.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
func Convert(c *openhands.Conversation, opts Options) (*agentimport.Result, error)
Convert converts a conversation into a session, and each sub-agent it ran into one of its own after it. One report covers them all; a finding in a sub-agent names its directory. Only the main conversation's failure fails the conversion: a sub-agent that cannot be read or converted is a finding.
func ConvertFile ¶
func ConvertFile(path string, opts Options) (*agentimport.Result, error)
ConvertFile reads the conversation whose directory, or a file in it, path names, and converts it with its sub-agents.
Types ¶
type Converted ¶
type Converted struct {
// contains filtered or unexported fields
}
Converted is the set of conversation directories conversions have converted, by their real path. It is safe for concurrent use.
type Options ¶
type Options struct {
// Slim drops what the model never saw and the session format has
// no member for, rather than keeping it in namespaced members: the
// state snapshot, events' members the conversion does not map, the
// structured observations beside their rendered outputs, and the
// agent server's state updates, token IDs, completion logs and
// stream fragments. Each drop is still reported.
Slim bool
// Derive writes the entries the module's derivation rules infer
// from the converted path, each marked agentimport:derived: what a
// shell call published and the revision a commit printed
// (docs/plans/agentimport.md).
Derive bool
// Location is the zone of OpenHands' timestamps, which are local
// time written with no zone; nil reads them as UTC. Either is
// reported.
Location *time.Location
// CreatedAt is the session's created_at when a conversation holds
// no timestamp at all. Zero leaves it the epoch; either is reported.
CreatedAt time.Time
// Alone converts a conversation without its sub-agents, which are
// otherwise read from its subagents directory.
Alone bool
// Converted, when set, records the conversation directories each
// conversion converted, so a caller converting many inputs can skip
// a sub-agent its parent's conversion already holds.
Converted *Converted
}
Options tune a conversion. The zero value keeps everything.