Prepare requests with captured conversation history

This commit is contained in:
2026-11-14 01:16:38 +00:00
parent fcd0485340
commit 26530808e0
10 changed files with 136 additions and 3 deletions

View File

@@ -85,6 +85,10 @@ const (
// own private execution snapshot for RunPrepared. Excessively deep or large
// JSON-shaped values are rejected for safety.
type RunRequest struct {
// CaptureExchange requests an immutable snapshot of a completed run.
CaptureExchange bool
// ContinueFrom supplies captured history and implies capture of the new run.
ContinueFrom *Exchange `json:"-" yaml:"-"`
// PromptID is the required prompt identifier. A namespace-scoped engine view
// qualifies a slashless caller value; otherwise it selects the exact
// configured ID.
@@ -160,6 +164,8 @@ type RunRequest struct {
// timestamps use RFC 3339 and zero timing values are omitted. Hash formats are
// opaque.
type PreparedRun struct {
// ParentRunID identifies the immediate source exchange, if any.
ParentRunID string `json:"parent_run_id,omitempty"`
// PromptID is the selected prompt identifier.
PromptID string `json:"prompt_id"`
// PromptHash is an opaque equality value for the selected definition.
@@ -187,8 +193,8 @@ type PreparedRun struct {
// RenderedPromptHash is an opaque equality value for SessionID and Messages.
RenderedPromptHash string `json:"rendered_prompt_hash"`
// Messages are the complete effective messages that Run or RunPrepared passes
// to the LLM client: definition messages in rendered order followed by any
// RunRequest.AppendedMessages in caller order.
// to the LLM client: captured history, if any, followed by definition
// messages and RunRequest.AppendedMessages in caller order.
Messages []RenderedMessage `json:"messages"`
// StartTime is the UTC time at which preparation began.
StartTime time.Time `json:"start_time,omitempty"`
@@ -207,6 +213,10 @@ type PreparedRun struct {
// use RFC 3339 and zero timing values are omitted. Run IDs and hash formats are
// opaque.
type RunResult struct {
// Exchange holds captured conversation history when requested.
Exchange *Exchange `json:"-" yaml:"-"`
// ParentRunID identifies the immediate source exchange, if any.
ParentRunID string `json:"parent_run_id,omitempty"`
// RunID is an opaque identifier for this invocation.
RunID string `json:"run_id"`
// Artifact contains the generated output and derived metadata.