2026-11-14 01:16:38 +00:00
|
|
|
package promptkit
|
|
|
|
|
|
|
|
|
|
import "go.maximumdirect.net/promptkit/internal/domain"
|
|
|
|
|
|
|
|
|
|
const exchangeString = "promptkit.Exchange{opaque}"
|
|
|
|
|
|
2026-11-14 01:35:06 +00:00
|
|
|
// Exchange is an immutable, reusable in-process snapshot of a completed
|
|
|
|
|
// conversation. It is not a persistence or restart format. Different engines
|
|
|
|
|
// can continue it, and independent branches do not alter one another.
|
2026-11-14 01:16:38 +00:00
|
|
|
type Exchange struct{ internal *domain.Exchange }
|
|
|
|
|
|
|
|
|
|
// ExchangeDetails contains a detached copy of an exchange's logical history.
|
|
|
|
|
type ExchangeDetails struct {
|
|
|
|
|
RunID string `json:"run_id"`
|
|
|
|
|
ParentRunID string `json:"parent_run_id,omitempty"`
|
|
|
|
|
Messages []RenderedMessage `json:"messages"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-14 01:35:06 +00:00
|
|
|
// Details returns detached history, or zero details for a nil or empty handle.
|
|
|
|
|
// Messages include caller and model content and require appropriate handling.
|
2026-11-14 01:16:38 +00:00
|
|
|
func (e *Exchange) Details() ExchangeDetails {
|
|
|
|
|
if e == nil || e.internal == nil {
|
|
|
|
|
return ExchangeDetails{}
|
|
|
|
|
}
|
|
|
|
|
return ExchangeDetails{RunID: e.internal.RunID(), ParentRunID: e.internal.ParentRunID(), Messages: fromDomainRenderedMessages(e.internal.Messages())}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String returns an opaque representation without conversation content.
|
|
|
|
|
func (e Exchange) String() string { return exchangeString }
|
|
|
|
|
|
|
|
|
|
// GoString returns an opaque representation without conversation content.
|
|
|
|
|
func (e Exchange) GoString() string { return exchangeString }
|