Documentation
¶
Overview ¶
Package agenttranscript reads the conversation a managed shell is exactly bound to.
It exists to keep two independent seams apart. The conversation-history adapters know how to read a provider's transcripts; `agentcontrol` knows how to address a managed agent. Joining them inside either one would make a terminal read depend on a history store, or a history store depend on tmux. This package is the join, and it is the only thing that has to know both.
It never guesses. The binding comes from an official integration's report, so a shell with no reported session gets `transcript_unavailable` rather than the newest conversation that happens to share its working directory — which is a different conversation often enough to be dangerous, and indistinguishable from the right one when it is wrong.
Index ¶
Constants ¶
const DefaultLimit = 50
DefaultLimit is the number of trailing messages returned when a caller does not choose. A transcript can be very long, and the recent end is the part a caller reaching for a transcript is almost always asking about.
Variables ¶
This section is empty.
Functions ¶
func DefaultAdapters ¶
DefaultAdapters resolves a registered conversation adapter by id.
It reads the same registry the Conversations plugin does, but it does not construct that plugin, and it does not call Detect: the binding already names the exact session, so whether the adapter would have discovered this project on its own is not a question worth asking. That is what lets a transcript read work with the Conversations plugin disabled.
Types ¶
type Adapters ¶
Adapters resolves a conversation-history adapter by its adapter id.
Injected so a test can supply a fake, and so the default can construct only the one adapter it needs rather than every registered adapter.
type Binding ¶
type Binding struct {
// Kind is the catalog family id running in the shell.
Kind string
// Ref is the reported session reference.
Ref agentsession.Ref
}
Binding is the exact conversation one managed shell is bound to.
type Lookup ¶
type Lookup func(agentcontrol.Target) (Binding, bool, error)
Lookup answers which conversation a target is bound to.
It is injected because resolving a target to its project manifest is the CLI's job, and giving this package its own project resolver would be a second answer to a question the CLI already answers.
type Reader ¶
type Reader struct {
Lookup Lookup
Adapters Adapters
// Limit caps how many of the most recent messages are returned when the
// caller asks for no specific number.
Limit int
}
Reader is an agentcontrol.TranscriptReader over the adapter stack.
func (Reader) SessionMessages ¶
func (r Reader) SessionMessages(ctx context.Context, target agentcontrol.Target, limit int) ([]agentcontrol.TranscriptMessage, error)
SessionMessages returns the messages of the conversation bound to target.