sdk

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 62 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DirectionBefore = data.DirectionBefore
	DirectionAfter  = data.DirectionAfter
	DirectionLatest = data.DirectionLatest
)
View Source
const (
	TranscriptSelectorTurn        = "Transcript"
	TranscriptSelectorMessage     = "Message"
	TranscriptSelectorToolMessage = "ToolMessage"
)

Variables

This section is empty.

Functions

func EmitFeedActive

func EmitFeedActive(ctx context.Context, bus streaming.Bus, convID, turnID string, spec *FeedSpec, itemCount int, data interface{})

EmitFeedActive publishes a tool_feed_active SSE event with the tool result data.

func EmitFeedInactive

func EmitFeedInactive(ctx context.Context, bus streaming.Bus, convID string, feedID string)

EmitFeedInactive publishes a tool_feed_inactive SSE event.

func NewHandler

func NewHandler(client Client, opts ...HandlerOption) http.Handler

func NewHandlerWithContext

func NewHandlerWithContext(ctx context.Context, client Client, opts ...HandlerOption) (http.Handler, error)

func SelectExecutionPageCount

func SelectExecutionPageCount(turn *TurnState) int

SelectExecutionPageCount returns the total number of execution pages (iterations) in a turn.

func SelectTotalElapsedMs

func SelectTotalElapsedMs(turn *TurnState) int64

SelectTotalElapsedMs returns the total elapsed time for execution in a turn.

func WaitForReady

func WaitForReady(baseURL string, timeout time.Duration) error

Types

type ActiveFeedState

type ActiveFeedState struct {
	FeedID    string          `json:"feedId"`
	Title     string          `json:"title"`
	ItemCount int             `json:"itemCount"`
	Data      json.RawMessage `json:"data,omitempty"`
}

ConversationState is the top-level canonical state for a conversation. ActiveFeedState describes a tool feed matched from the transcript.

type AssistantBubble

type AssistantBubble struct {
	MessageID string
	Content   string
	IsFinal   bool
}

AssistantBubble is the content to render as the assistant's visible response.

func SelectAssistantBubble

func SelectAssistantBubble(turn *TurnState, pageIndex int) *AssistantBubble

SelectAssistantBubble determines what assistant content to display for a turn. Rules (from the proposal):

  1. Exactly one assistant bubble per visible execution page.
  2. If visible page has final content, show final content.
  3. Else if visible page has preamble, show preamble.

type AssistantMessageState

type AssistantMessageState struct {
	MessageID string `json:"messageId"`
	Content   string `json:"content,omitempty"`
}

AssistantMessageState represents a single assistant message fragment.

type AssistantState

type AssistantState struct {
	Preamble *AssistantMessageState `json:"preamble,omitempty"`
	Final    *AssistantMessageState `json:"final,omitempty"`
}

AssistantState holds preamble and final assistant content for a turn.

type AuthProvider

type AuthProvider struct {
	Name  string `json:"name"`
	Label string `json:"label"`
	Mode  string `json:"mode"`
}

type Client

type Client interface {
	Mode() Mode

	// Query sends a user message and returns the agent response (ReAct loop).
	Query(ctx context.Context, input *agentsvc.QueryInput) (*agentsvc.QueryOutput, error)

	// GetMessages returns a cursor-paginated page of messages for a conversation.
	GetMessages(ctx context.Context, input *GetMessagesInput) (*MessagePage, error)

	// StreamEvents subscribes to real-time streaming events for a conversation.
	StreamEvents(ctx context.Context, input *StreamEventsInput) (streaming.Subscription, error)

	// CreateConversation initialises a new conversation record.
	CreateConversation(ctx context.Context, input *CreateConversationInput) (*conversation.Conversation, error)

	// ListConversations returns a cursor-paginated list of conversations.
	ListConversations(ctx context.Context, input *ListConversationsInput) (*ConversationPage, error)
	// ListLinkedConversations returns child conversations for a given parent conversation/turn,
	// including status and latest assistant response.
	ListLinkedConversations(ctx context.Context, input *ListLinkedConversationsInput) (*LinkedConversationPage, error)

	// GetConversation retrieves a single conversation by ID.
	GetConversation(ctx context.Context, id string) (*conversation.Conversation, error)
	// UpdateConversation updates mutable conversation fields such as visibility and shareability.
	UpdateConversation(ctx context.Context, input *UpdateConversationInput) (*conversation.Conversation, error)

	// GetRun returns the current state of a run.
	GetRun(ctx context.Context, id string) (*agrun.RunRowsView, error)

	// CancelTurn aborts the active turn. Returns true if a running turn was found.
	CancelTurn(ctx context.Context, turnID string) (bool, error)
	// SteerTurn injects a user message into a currently running turn.
	SteerTurn(ctx context.Context, input *SteerTurnInput) (*SteerTurnOutput, error)
	// CancelQueuedTurn cancels a queued turn.
	CancelQueuedTurn(ctx context.Context, conversationID, turnID string) error
	// MoveQueuedTurn reorders a queued turn up/down in queue order.
	MoveQueuedTurn(ctx context.Context, input *MoveQueuedTurnInput) error
	// EditQueuedTurn updates queued turn starter message content.
	EditQueuedTurn(ctx context.Context, input *EditQueuedTurnInput) error
	// ForceSteerQueuedTurn cancels queued turn and injects its message into active turn.
	ForceSteerQueuedTurn(ctx context.Context, conversationID, turnID string) (*SteerTurnOutput, error)

	// ResolveElicitation delivers the user response for an elicitation prompt.
	ResolveElicitation(ctx context.Context, input *ResolveElicitationInput) error
	// ListPendingElicitations returns unresolved elicitation prompts for a conversation.
	ListPendingElicitations(ctx context.Context, input *ListPendingElicitationsInput) ([]*PendingElicitation, error)
	// ListPendingToolApprovals returns queued tool approvals for a user/conversation.
	ListPendingToolApprovals(ctx context.Context, input *ListPendingToolApprovalsInput) ([]*PendingToolApproval, error)
	// DecideToolApproval resolves a queued tool request with approve/reject.
	DecideToolApproval(ctx context.Context, input *DecideToolApprovalInput) (*DecideToolApprovalOutput, error)

	// ExecuteTool invokes a registered tool by name and returns its textual result.
	ExecuteTool(ctx context.Context, name string, args map[string]interface{}) (string, error)

	// ListToolDefinitions returns the set of tool definitions available in the workspace.
	ListToolDefinitions(ctx context.Context) ([]ToolDefinitionInfo, error)

	// UploadFile stores a file associated with a conversation.
	UploadFile(ctx context.Context, input *UploadFileInput) (*UploadFileOutput, error)

	// DownloadFile retrieves a previously uploaded file.
	DownloadFile(ctx context.Context, input *DownloadFileInput) (*DownloadFileOutput, error)

	// ListFiles returns all files associated with a conversation.
	ListFiles(ctx context.Context, input *ListFilesInput) (*ListFilesOutput, error)

	// ListResources returns resource names for a workspace kind.
	ListResources(ctx context.Context, input *ListResourcesInput) (*ListResourcesOutput, error)

	// GetResource retrieves a single workspace resource by kind and name.
	GetResource(ctx context.Context, input *ResourceRef) (*GetResourceOutput, error)

	// SaveResource creates or updates a workspace resource.
	SaveResource(ctx context.Context, input *SaveResourceInput) error

	// DeleteResource removes a workspace resource.
	DeleteResource(ctx context.Context, input *ResourceRef) error

	// ExportResources exports all resources of the given kinds.
	ExportResources(ctx context.Context, input *ExportResourcesInput) (*ExportResourcesOutput, error)

	// ImportResources imports resources in bulk.
	ImportResources(ctx context.Context, input *ImportResourcesInput) (*ImportResourcesOutput, error)

	// TerminateConversation cancels all active turns and marks the conversation as canceled.
	TerminateConversation(ctx context.Context, conversationID string) error

	// CompactConversation generates an LLM summary of conversation history, archiving old messages.
	CompactConversation(ctx context.Context, conversationID string) error

	// PruneConversation uses an LLM to select and remove low-value messages from conversation history.
	PruneConversation(ctx context.Context, conversationID string) error

	// GetTranscript returns the canonical conversation state for rendering.
	GetTranscript(ctx context.Context, input *GetTranscriptInput, options ...TranscriptOption) (*ConversationStateResponse, error)

	// GetLiveState returns the current canonical state snapshot with an EventCursor.
	// On SSE connect or reconnect the client should call GetLiveState first, then
	// consume the event stream starting at EventCursor to avoid replaying history
	// and to avoid missing events that arrived between page load and SSE connect.
	GetLiveState(ctx context.Context, conversationID string, options ...TranscriptOption) (*ConversationStateResponse, error)

	// GetPayloads returns a map of payload ID → payload for the given IDs.
	// Used for batch payload resolution in feed rendering, replacing per-step fetches.
	GetPayloads(ctx context.Context, ids []string) (map[string]*conversation.Payload, error)

	// GetA2AAgentCard returns the A2A agent card for the given agent.
	GetA2AAgentCard(ctx context.Context, agentID string) (*a2a.AgentCard, error)

	// SendA2AMessage sends a message to an A2A agent and returns the task envelope.
	SendA2AMessage(ctx context.Context, agentID string, req *a2a.SendMessageRequest) (*a2a.SendMessageResponse, error)

	// ListA2AAgents returns agent IDs that have A2A serving enabled.
	ListA2AAgents(ctx context.Context, agentIDs []string) ([]string, error)

	// GetSchedule returns a schedule by ID.
	GetSchedule(ctx context.Context, id string) (*scheduler.Schedule, error)

	// ListSchedules returns all schedules visible to the caller.
	ListSchedules(ctx context.Context) ([]*scheduler.Schedule, error)

	// UpsertSchedules creates or updates schedules in batch.
	UpsertSchedules(ctx context.Context, schedules []*scheduler.Schedule) error

	// RunScheduleNow triggers immediate execution of a schedule.
	RunScheduleNow(ctx context.Context, id string) error
}

type ConversationPage

type ConversationPage = data.ConversationPage

ConversationPage is the paginated result from ListConversations.

type ConversationState

type ConversationState struct {
	ConversationID string             `json:"conversationId"`
	Turns          []*TurnState       `json:"turns"`
	Feeds          []*ActiveFeedState `json:"feeds,omitempty"`
}

func BuildCanonicalState

func BuildCanonicalState(conversationID string, turns convstore.Transcript) *ConversationState

BuildCanonicalState converts a transcript into the canonical ConversationState. This is the single entry point for producing renderable state from transcript data.

func Reduce

func Reduce(state *ConversationState, event *streaming.Event) *ConversationState

Reducer applies a stream event to a ConversationState, returning the updated state. The reducer is source-agnostic: both live stream events and transcript-derived events feed into the same function.

The reducer is the single owner of state transitions. UI and SDK callers must not infer execution structure outside this function.

type ConversationStateResponse added in v0.1.6

type ConversationStateResponse struct {
	SchemaVersion string             `json:"schemaVersion"`
	Conversation  *ConversationState `json:"conversation"`
	Feeds         []*ActiveFeedState `json:"feeds,omitempty"`
	Usage         *UsageSummary      `json:"usage,omitempty"`
	// EventCursor is an opaque position token in the event stream.
	// On SSE reconnect the client passes this to resume streaming from
	// exactly this point without replaying prior events.
	EventCursor string `json:"eventCursor,omitempty"`
}

ConversationStateResponse is the formal wire contract returned by GetTranscript and GetLiveState. It wraps ConversationState with a schema version, resolved feeds, optional usage, and an event cursor for SSE reconnection.

type ConversationStreamSnapshot added in v0.1.6

type ConversationStreamSnapshot struct {
	ConversationID     string             `json:"conversationId,omitempty"`
	State              *ConversationState `json:"state,omitempty"`
	ActiveTurnID       string             `json:"activeTurnId,omitempty"`
	Feeds              []*ActiveFeedState `json:"feeds,omitempty"`
	PendingElicitation *ElicitationState  `json:"pendingElicitation,omitempty"`
}

type ConversationStreamTracker added in v0.1.5

type ConversationStreamTracker struct {
	// contains filtered or unexported fields
}

ConversationStreamTracker is a small semantic facade over the canonical reducer.

It gives SDK consumers one place to: - apply live stream events - replace/reconcile with transcript snapshots - read the current canonical state

The goal is to keep stream consumers out of direct reducer bookkeeping.

func NewConversationStreamTracker added in v0.1.5

func NewConversationStreamTracker(conversationID string) *ConversationStreamTracker

NewConversationStreamTracker creates a tracker optionally seeded with conversation ID.

func (*ConversationStreamTracker) ActiveTurn added in v0.1.6

func (t *ConversationStreamTracker) ActiveTurn() *TurnState

ActiveTurn returns the latest non-terminal turn when one exists.

func (*ConversationStreamTracker) ActiveTurnID added in v0.1.6

func (t *ConversationStreamTracker) ActiveTurnID() string

ActiveTurnID returns the ID of the latest non-terminal turn.

func (*ConversationStreamTracker) ApplyEvent added in v0.1.5

ApplyEvent applies a single streaming event to the tracked state.

func (*ConversationStreamTracker) ApplyTranscript added in v0.1.5

ApplyTranscript replaces the tracked state with an authoritative transcript snapshot.

func (*ConversationStreamTracker) Clear added in v0.1.6

func (t *ConversationStreamTracker) Clear()

Clear is an alias for Reset to align with the TS tracker surface.

func (*ConversationStreamTracker) ConversationID added in v0.1.6

func (t *ConversationStreamTracker) ConversationID() string

ConversationID returns the currently tracked conversation ID when known.

func (*ConversationStreamTracker) Feeds added in v0.1.6

Feeds returns the currently tracked active feeds.

func (*ConversationStreamTracker) PendingElicitation added in v0.1.6

func (t *ConversationStreamTracker) PendingElicitation() *ElicitationState

PendingElicitation returns the latest pending elicitation when present.

func (*ConversationStreamTracker) Reset added in v0.1.5

func (t *ConversationStreamTracker) Reset()

Reset clears the tracked state.

func (*ConversationStreamTracker) Snapshot added in v0.1.6

Snapshot returns a lightweight immutable view of the current tracked state.

func (*ConversationStreamTracker) State added in v0.1.5

State returns the current canonical state pointer.

func (*ConversationStreamTracker) TrackSubscription added in v0.1.5

func (t *ConversationStreamTracker) TrackSubscription(ctx context.Context, sub streaming.Subscription) error

TrackSubscription consumes a streaming subscription until the context is done or the subscription channel closes, applying every event to the tracker.

type CreateConversationInput

type CreateConversationInput struct {
	AgentID  string
	Title    string
	Metadata map[string]interface{}
}

CreateConversationInput holds fields needed to create a new conversation.

type CreateSessionRequest added in v0.1.2

type CreateSessionRequest struct {
	Username     string `json:"username,omitempty"`
	AccessToken  string `json:"accessToken,omitempty"`
	IDToken      string `json:"idToken,omitempty"`
	RefreshToken string `json:"refreshToken,omitempty"`
	ExpiresAt    string `json:"expiresAt,omitempty"`
}

type DecideToolApprovalInput

type DecideToolApprovalInput struct {
	ID      string                 `json:"id"`
	Action  string                 `json:"action"` // approve|reject
	UserID  string                 `json:"userId,omitempty"`
	Reason  string                 `json:"reason,omitempty"`
	Payload map[string]interface{} `json:"payload,omitempty"`
}

type DecideToolApprovalOutput

type DecideToolApprovalOutput struct {
	Status string `json:"status"`
}

type Direction

type Direction = data.Direction

type DownloadFileInput

type DownloadFileInput struct {
	ConversationID string
	FileID         string
}

DownloadFileInput identifies a file to download.

type DownloadFileOutput

type DownloadFileOutput struct {
	Name        string
	ContentType string
	Data        []byte
}

DownloadFileOutput carries the downloaded file contents.

type EditQueuedTurnInput

type EditQueuedTurnInput struct {
	ConversationID string `json:"conversationId"`
	TurnID         string `json:"turnId"`
	Content        string `json:"content"`
}

type ElicitationDialog

type ElicitationDialog struct {
	ElicitationID   string
	Status          ElicitationStatus
	Message         string
	RequestedSchema json.RawMessage
	CallbackURL     string
	ResponsePayload json.RawMessage
	// IsPending is true when the user needs to respond.
	IsPending bool
}

ElicitationDialog describes the elicitation UI to present to the user.

func SelectElicitationDialog

func SelectElicitationDialog(turn *TurnState) *ElicitationDialog

SelectElicitationDialog returns the elicitation dialog state for a turn, or nil if no elicitation is active.

Rules (from the proposal):

  • Show schema form in a dialog
  • Do not render duplicate inline form or duplicate assistant bubble with the same elicitation text

type ElicitationState

type ElicitationState struct {
	ElicitationID   string            `json:"elicitationId"`
	Status          ElicitationStatus `json:"status"`
	Message         string            `json:"message,omitempty"`
	RequestedSchema json.RawMessage   `json:"requestedSchema,omitempty"`
	CallbackURL     string            `json:"callbackUrl,omitempty"`
	ResponsePayload json.RawMessage   `json:"responsePayload,omitempty"`
}

ElicitationState represents a pending or resolved elicitation within a turn.

type ElicitationStatus

type ElicitationStatus string

ElicitationStatus enumerates elicitation lifecycle states.

const (
	ElicitationStatusPending  ElicitationStatus = "pending"
	ElicitationStatusAccepted ElicitationStatus = "accepted"
	ElicitationStatusDeclined ElicitationStatus = "declined"
	ElicitationStatusCanceled ElicitationStatus = "canceled"
)

type EmbeddedClient

type EmbeddedClient struct {
	// contains filtered or unexported fields
}

func NewEmbedded

func NewEmbedded(agent *agentsvc.Service, conv conversation.Client) (*EmbeddedClient, error)

func NewEmbeddedFromRuntime

func NewEmbeddedFromRuntime(rt *executor.Runtime) (*EmbeddedClient, error)

func (*EmbeddedClient) CancelQueuedTurn

func (c *EmbeddedClient) CancelQueuedTurn(ctx context.Context, conversationID, turnID string) error

func (*EmbeddedClient) CancelTurn

func (c *EmbeddedClient) CancelTurn(ctx context.Context, turnID string) (bool, error)

func (*EmbeddedClient) CompactConversation

func (c *EmbeddedClient) CompactConversation(ctx context.Context, conversationID string) error

func (*EmbeddedClient) CreateConversation

func (c *EmbeddedClient) CreateConversation(ctx context.Context, input *CreateConversationInput) (*conversation.Conversation, error)

func (*EmbeddedClient) DecideToolApproval

func (*EmbeddedClient) DeleteResource

func (c *EmbeddedClient) DeleteResource(ctx context.Context, input *ResourceRef) error

func (*EmbeddedClient) DownloadFile

func (c *EmbeddedClient) DownloadFile(ctx context.Context, input *DownloadFileInput) (*DownloadFileOutput, error)

func (*EmbeddedClient) DownloadGeneratedFile added in v0.1.6

func (c *EmbeddedClient) DownloadGeneratedFile(ctx context.Context, id string) ([]byte, string, string, error)

func (*EmbeddedClient) EditQueuedTurn

func (c *EmbeddedClient) EditQueuedTurn(ctx context.Context, input *EditQueuedTurnInput) error

func (*EmbeddedClient) ExecuteTool

func (c *EmbeddedClient) ExecuteTool(ctx context.Context, name string, args map[string]interface{}) (string, error)

func (*EmbeddedClient) ExportResources

func (c *EmbeddedClient) ExportResources(ctx context.Context, input *ExportResourcesInput) (*ExportResourcesOutput, error)

func (*EmbeddedClient) FeedRegistry

func (c *EmbeddedClient) FeedRegistry() *FeedRegistry

func (*EmbeddedClient) ForceSteerQueuedTurn

func (c *EmbeddedClient) ForceSteerQueuedTurn(ctx context.Context, conversationID, turnID string) (*SteerTurnOutput, error)

func (*EmbeddedClient) GetA2AAgentCard

func (c *EmbeddedClient) GetA2AAgentCard(ctx context.Context, agentID string) (*a2a.AgentCard, error)

func (*EmbeddedClient) GetConversation

func (c *EmbeddedClient) GetConversation(ctx context.Context, id string) (*conversation.Conversation, error)

func (*EmbeddedClient) GetLiveState added in v0.1.6

func (c *EmbeddedClient) GetLiveState(ctx context.Context, conversationID string, options ...TranscriptOption) (*ConversationStateResponse, error)

GetLiveState returns the current canonical state snapshot together with an EventCursor for SSE reconnection. On connect or reconnect the caller should:

  1. Call GetLiveState to get the snapshot and cursor.
  2. Begin consuming the event stream.
  3. Discard events whose CreatedAt is before the cursor timestamp.
  4. Apply subsequent events via Reduce() against the snapshot.

The cursor is an RFC3339Nano timestamp captured just before the snapshot fetch, so any event published concurrently will be at or after the cursor.

func (*EmbeddedClient) GetMessages

func (c *EmbeddedClient) GetMessages(ctx context.Context, input *GetMessagesInput) (*MessagePage, error)

func (*EmbeddedClient) GetPayload

func (c *EmbeddedClient) GetPayload(ctx context.Context, id string) (*conversation.Payload, error)

func (*EmbeddedClient) GetPayloads added in v0.1.6

func (c *EmbeddedClient) GetPayloads(ctx context.Context, ids []string) (map[string]*conversation.Payload, error)

GetPayloads fetches multiple payloads by ID in one call. IDs that are empty or not found are silently omitted from the result.

func (*EmbeddedClient) GetResource

func (c *EmbeddedClient) GetResource(ctx context.Context, input *ResourceRef) (*GetResourceOutput, error)

func (*EmbeddedClient) GetRun

func (c *EmbeddedClient) GetRun(ctx context.Context, id string) (*agrun.RunRowsView, error)

func (*EmbeddedClient) GetSchedule

func (c *EmbeddedClient) GetSchedule(ctx context.Context, id string) (*scheduler.Schedule, error)

func (*EmbeddedClient) GetTranscript

func (*EmbeddedClient) ImportResources

func (c *EmbeddedClient) ImportResources(ctx context.Context, input *ImportResourcesInput) (*ImportResourcesOutput, error)

func (*EmbeddedClient) ListA2AAgents

func (c *EmbeddedClient) ListA2AAgents(ctx context.Context, agentIDs []string) ([]string, error)

func (*EmbeddedClient) ListConversations

func (c *EmbeddedClient) ListConversations(ctx context.Context, input *ListConversationsInput) (*ConversationPage, error)

func (*EmbeddedClient) ListFiles

func (c *EmbeddedClient) ListFiles(ctx context.Context, input *ListFilesInput) (*ListFilesOutput, error)

func (*EmbeddedClient) ListGeneratedFiles added in v0.1.6

func (c *EmbeddedClient) ListGeneratedFiles(ctx context.Context, conversationID string) ([]*gfread.GeneratedFileView, error)

func (*EmbeddedClient) ListLinkedConversations

func (c *EmbeddedClient) ListLinkedConversations(ctx context.Context, input *ListLinkedConversationsInput) (*LinkedConversationPage, error)

func (*EmbeddedClient) ListPendingElicitations

func (c *EmbeddedClient) ListPendingElicitations(ctx context.Context, input *ListPendingElicitationsInput) ([]*PendingElicitation, error)

func (*EmbeddedClient) ListPendingToolApprovals

func (c *EmbeddedClient) ListPendingToolApprovals(ctx context.Context, input *ListPendingToolApprovalsInput) ([]*PendingToolApproval, error)

func (*EmbeddedClient) ListResources

func (c *EmbeddedClient) ListResources(ctx context.Context, input *ListResourcesInput) (*ListResourcesOutput, error)

func (*EmbeddedClient) ListSchedules

func (c *EmbeddedClient) ListSchedules(ctx context.Context) ([]*scheduler.Schedule, error)

func (*EmbeddedClient) ListToolDefinitions

func (c *EmbeddedClient) ListToolDefinitions(_ context.Context) ([]ToolDefinitionInfo, error)

func (*EmbeddedClient) Mode

func (c *EmbeddedClient) Mode() Mode

func (*EmbeddedClient) MoveQueuedTurn

func (c *EmbeddedClient) MoveQueuedTurn(ctx context.Context, input *MoveQueuedTurnInput) error

func (*EmbeddedClient) PruneConversation

func (c *EmbeddedClient) PruneConversation(ctx context.Context, conversationID string) error

func (*EmbeddedClient) Query

func (*EmbeddedClient) RecordOOBAuthElicitation

func (c *EmbeddedClient) RecordOOBAuthElicitation(ctx context.Context, authURL string) error

func (*EmbeddedClient) ResolveElicitation

func (c *EmbeddedClient) ResolveElicitation(ctx context.Context, input *ResolveElicitationInput) error

func (*EmbeddedClient) ResolveFeedData

func (c *EmbeddedClient) ResolveFeedData(ctx context.Context, spec *FeedSpec, conversationID string) (interface{}, error)

func (*EmbeddedClient) RunScheduleNow

func (c *EmbeddedClient) RunScheduleNow(ctx context.Context, id string) error

func (*EmbeddedClient) SaveResource

func (c *EmbeddedClient) SaveResource(ctx context.Context, input *SaveResourceInput) error

func (*EmbeddedClient) SendA2AMessage

func (c *EmbeddedClient) SendA2AMessage(ctx context.Context, agentID string, req *a2a.SendMessageRequest) (*a2a.SendMessageResponse, error)

func (*EmbeddedClient) SetScheduler

func (c *EmbeddedClient) SetScheduler(svc *scheduler.Service)

func (*EmbeddedClient) SteerTurn

func (c *EmbeddedClient) SteerTurn(ctx context.Context, input *SteerTurnInput) (*SteerTurnOutput, error)

func (*EmbeddedClient) StreamEvents

func (*EmbeddedClient) TerminateConversation

func (c *EmbeddedClient) TerminateConversation(ctx context.Context, conversationID string) error

func (*EmbeddedClient) UpdateConversation

func (c *EmbeddedClient) UpdateConversation(ctx context.Context, input *UpdateConversationInput) (*conversation.Conversation, error)

func (*EmbeddedClient) UploadFile

func (*EmbeddedClient) UpsertSchedules

func (c *EmbeddedClient) UpsertSchedules(ctx context.Context, schedules []*scheduler.Schedule) error

type ExecutionPageState

type ExecutionPageState struct {
	PageID                  string            `json:"pageId"`
	AssistantMessageID      string            `json:"assistantMessageId"`
	ParentMessageID         string            `json:"parentMessageId"`
	TurnID                  string            `json:"turnId"`
	Iteration               int               `json:"iteration"`
	Mode                    string            `json:"mode,omitempty"` // "" = normal, "summary" = summary-pass
	Status                  string            `json:"status,omitempty"`
	ModelSteps              []*ModelStepState `json:"modelSteps,omitempty"`
	ToolSteps               []*ToolStepState  `json:"toolSteps,omitempty"`
	PreambleMessageID       string            `json:"preambleMessageId,omitempty"`
	FinalAssistantMessageID string            `json:"finalAssistantMessageId,omitempty"`
	Preamble                string            `json:"preamble,omitempty"`
	Content                 string            `json:"content,omitempty"`
	FinalResponse           bool              `json:"finalResponse"`
}

ExecutionPageState is one iteration of the ReAct loop (model call + tool calls).

func SelectVisibleExecutionPage

func SelectVisibleExecutionPage(turn *TurnState, pageIndex int) *ExecutionPageState

SelectVisibleExecutionPage returns the execution page at the given index. If pageIndex is out of range, returns the active (latest) page. Returns nil if the turn has no execution state.

type ExecutionState

type ExecutionState struct {
	Pages          []*ExecutionPageState `json:"pages"`
	ActivePageIdx  int                   `json:"activePageIndex"`
	TotalElapsedMs int64                 `json:"totalElapsedMs"`
}

ExecutionState aggregates all execution pages (iterations) within a turn.

type ExportResourcesInput

type ExportResourcesInput struct {
	Kinds []string `json:"kinds"` // nil = all
}

ExportResourcesInput controls which resources are exported.

type ExportResourcesOutput

type ExportResourcesOutput struct {
	Resources []Resource `json:"resources"`
}

ExportResourcesOutput carries the exported resources.

type FeedActivation

type FeedActivation struct {
	Kind    string `yaml:"kind,omitempty" json:"kind,omitempty"`       // "history" (default) or "tool_call"
	Scope   string `yaml:"scope,omitempty" json:"scope,omitempty"`     // "last" (default) or "all"
	Service string `yaml:"service,omitempty" json:"service,omitempty"` // optional data-source service for tool_call activation
	Method  string `yaml:"method,omitempty" json:"method,omitempty"`   // optional data-source method for tool_call activation
}

FeedActivation controls how feed data is gathered.

type FeedMatch

type FeedMatch struct {
	Service string `yaml:"service" json:"service"`
	Method  string `yaml:"method" json:"method"`
}

FeedMatch defines which tool calls trigger this feed.

type FeedRegistry

type FeedRegistry struct {
	// contains filtered or unexported fields
}

FeedRegistry loads feed specs from workspace and matches tool calls.

func NewFeedRegistry

func NewFeedRegistry() *FeedRegistry

NewFeedRegistry creates a registry and loads all feed specs from workspace.

func (*FeedRegistry) Match

func (r *FeedRegistry) Match(toolName string) []*FeedSpec

Match returns feed specs that match a tool name (service/method or service:method).

func (*FeedRegistry) MatchAny

func (r *FeedRegistry) MatchAny(toolName string) bool

MatchAny returns true if any feed spec matches the tool name.

func (*FeedRegistry) Reload

func (r *FeedRegistry) Reload()

Reload reloads all feed specs from workspace. Safe for hot-swap.

func (*FeedRegistry) Specs

func (r *FeedRegistry) Specs() []*FeedSpec

Specs returns all loaded feed specs.

type FeedSpec

type FeedSpec struct {
	ID         string                 `yaml:"id" json:"id"`
	Title      string                 `yaml:"title,omitempty" json:"title,omitempty"`
	Match      FeedMatch              `yaml:"match" json:"match"`
	Activation FeedActivation         `yaml:"activation,omitempty" json:"activation,omitempty"`
	DataSource map[string]interface{} `yaml:"dataSource,omitempty" json:"dataSource,omitempty"`
	UI         interface{}            `yaml:"ui,omitempty" json:"ui,omitempty"`
}

FeedSpec describes a tool feed loaded from workspace YAML.

type FeedState

type FeedState struct {
	FeedID    string `json:"feedId"`
	Title     string `json:"title"`
	ItemCount int    `json:"itemCount"`
	ToolName  string `json:"toolName,omitempty"`
}

FeedState tracks active feeds for a conversation.

type FileEntry

type FileEntry struct {
	ID          string
	Name        string
	ContentType string
	Size        int64
}

FileEntry describes a single file in a conversation.

type GetMessagesInput

type GetMessagesInput struct {
	ConversationID string
	Page           *PageInput
	// Optional filters
	ID     string
	TurnID string
	Roles  []string
	Types  []string
}

GetMessagesInput controls which messages are returned for a conversation.

type GetResourceOutput

type GetResourceOutput struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
	Data []byte `json:"data"`
}

GetResourceOutput carries the raw content of a workspace resource.

type GetTranscriptInput

type GetTranscriptInput struct {
	ConversationID    string
	Since             string // optional: turn ID or message ID cursor
	IncludeModelCalls bool
	IncludeToolCalls  bool
}

GetTranscriptInput controls which transcript turns are returned for a conversation.

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields
}

func NewHTTP

func NewHTTP(baseURL string, opts ...HTTPOption) (*HTTPClient, error)

func (*HTTPClient) AuthBrowserSession

func (c *HTTPClient) AuthBrowserSession(ctx context.Context) error

func (*HTTPClient) AuthCreateSession added in v0.1.2

func (c *HTTPClient) AuthCreateSession(ctx context.Context, req *CreateSessionRequest) error

func (*HTTPClient) AuthLocalLogin

func (c *HTTPClient) AuthLocalLogin(ctx context.Context, name string) error

func (*HTTPClient) AuthLocalOOBSession added in v0.1.2

func (c *HTTPClient) AuthLocalOOBSession(ctx context.Context, opts *LocalOOBSessionOptions) error

func (*HTTPClient) AuthMe

func (c *HTTPClient) AuthMe(ctx context.Context) (map[string]interface{}, error)

func (*HTTPClient) AuthOAuthConfig

func (c *HTTPClient) AuthOAuthConfig(ctx context.Context) (*OAuthConfigResponse, error)

func (*HTTPClient) AuthOOBLogin

func (c *HTTPClient) AuthOOBLogin(ctx context.Context, configURL, secretsURL string, scopes []string) (*oauth2.Token, error)

func (*HTTPClient) AuthOOBSession

func (c *HTTPClient) AuthOOBSession(ctx context.Context, secretsURL string, scopes []string) error

func (*HTTPClient) AuthProviders

func (c *HTTPClient) AuthProviders(ctx context.Context) ([]AuthProvider, error)

func (*HTTPClient) AuthSessionExchange

func (c *HTTPClient) AuthSessionExchange(ctx context.Context, idToken string) error

func (*HTTPClient) CancelQueuedTurn

func (c *HTTPClient) CancelQueuedTurn(ctx context.Context, conversationID, turnID string) error

func (*HTTPClient) CancelTurn

func (c *HTTPClient) CancelTurn(ctx context.Context, turnID string) (bool, error)

func (*HTTPClient) CompactConversation

func (c *HTTPClient) CompactConversation(ctx context.Context, conversationID string) error

func (*HTTPClient) CreateConversation

func (c *HTTPClient) CreateConversation(ctx context.Context, input *CreateConversationInput) (*conversation.Conversation, error)

func (*HTTPClient) DecideToolApproval

func (c *HTTPClient) DecideToolApproval(ctx context.Context, input *DecideToolApprovalInput) (*DecideToolApprovalOutput, error)

func (*HTTPClient) DeleteResource

func (c *HTTPClient) DeleteResource(ctx context.Context, input *ResourceRef) error

func (*HTTPClient) DownloadFile

func (c *HTTPClient) DownloadFile(ctx context.Context, input *DownloadFileInput) (*DownloadFileOutput, error)

func (*HTTPClient) EditQueuedTurn

func (c *HTTPClient) EditQueuedTurn(ctx context.Context, input *EditQueuedTurnInput) error

func (*HTTPClient) ExecuteTool

func (c *HTTPClient) ExecuteTool(ctx context.Context, name string, args map[string]interface{}) (string, error)

func (*HTTPClient) ExportResources

func (c *HTTPClient) ExportResources(ctx context.Context, input *ExportResourcesInput) (*ExportResourcesOutput, error)

func (*HTTPClient) ForceSteerQueuedTurn

func (c *HTTPClient) ForceSteerQueuedTurn(ctx context.Context, conversationID, turnID string) (*SteerTurnOutput, error)

func (*HTTPClient) GetA2AAgentCard

func (c *HTTPClient) GetA2AAgentCard(ctx context.Context, agentID string) (*a2a.AgentCard, error)

func (*HTTPClient) GetConversation

func (c *HTTPClient) GetConversation(ctx context.Context, id string) (*conversation.Conversation, error)

func (*HTTPClient) GetLiveState added in v0.1.6

func (c *HTTPClient) GetLiveState(ctx context.Context, conversationID string, options ...TranscriptOption) (*ConversationStateResponse, error)

GetLiveState returns the canonical state snapshot with an EventCursor by delegating to GetTranscript. HTTP clients should prefer a dedicated /live-state endpoint when available; this implementation is a safe fallback.

func (*HTTPClient) GetMessages

func (c *HTTPClient) GetMessages(ctx context.Context, input *GetMessagesInput) (*MessagePage, error)

func (*HTTPClient) GetPayloads added in v0.1.6

func (c *HTTPClient) GetPayloads(ctx context.Context, ids []string) (map[string]*conversation.Payload, error)

func (*HTTPClient) GetResource

func (c *HTTPClient) GetResource(ctx context.Context, input *ResourceRef) (*GetResourceOutput, error)

func (*HTTPClient) GetRun

func (c *HTTPClient) GetRun(ctx context.Context, id string) (*agrun.RunRowsView, error)

func (*HTTPClient) GetSchedule

func (c *HTTPClient) GetSchedule(ctx context.Context, id string) (*scheduler.Schedule, error)

func (*HTTPClient) GetTranscript

func (c *HTTPClient) GetTranscript(ctx context.Context, input *GetTranscriptInput, options ...TranscriptOption) (*ConversationStateResponse, error)

func (*HTTPClient) GetWorkspaceMetadata

func (c *HTTPClient) GetWorkspaceMetadata(ctx context.Context) (*WorkspaceMetadata, error)

func (*HTTPClient) ImportResources

func (c *HTTPClient) ImportResources(ctx context.Context, input *ImportResourcesInput) (*ImportResourcesOutput, error)

func (*HTTPClient) ListA2AAgents

func (c *HTTPClient) ListA2AAgents(ctx context.Context, agentIDs []string) ([]string, error)

func (*HTTPClient) ListConversations

func (c *HTTPClient) ListConversations(ctx context.Context, input *ListConversationsInput) (*ConversationPage, error)

func (*HTTPClient) ListFiles

func (c *HTTPClient) ListFiles(ctx context.Context, input *ListFilesInput) (*ListFilesOutput, error)

func (*HTTPClient) ListLinkedConversations

func (c *HTTPClient) ListLinkedConversations(ctx context.Context, input *ListLinkedConversationsInput) (*LinkedConversationPage, error)

func (*HTTPClient) ListPendingElicitations

func (c *HTTPClient) ListPendingElicitations(ctx context.Context, input *ListPendingElicitationsInput) ([]*PendingElicitation, error)

func (*HTTPClient) ListPendingToolApprovals

func (c *HTTPClient) ListPendingToolApprovals(ctx context.Context, input *ListPendingToolApprovalsInput) ([]*PendingToolApproval, error)

func (*HTTPClient) ListResources

func (c *HTTPClient) ListResources(ctx context.Context, input *ListResourcesInput) (*ListResourcesOutput, error)

func (*HTTPClient) ListSchedules

func (c *HTTPClient) ListSchedules(ctx context.Context) ([]*scheduler.Schedule, error)

func (*HTTPClient) ListToolDefinitions

func (c *HTTPClient) ListToolDefinitions(ctx context.Context) ([]ToolDefinitionInfo, error)

func (*HTTPClient) Mode

func (c *HTTPClient) Mode() Mode

func (*HTTPClient) MoveQueuedTurn

func (c *HTTPClient) MoveQueuedTurn(ctx context.Context, input *MoveQueuedTurnInput) error

func (*HTTPClient) PruneConversation

func (c *HTTPClient) PruneConversation(ctx context.Context, conversationID string) error

func (*HTTPClient) Query

func (*HTTPClient) ResolveElicitation

func (c *HTTPClient) ResolveElicitation(ctx context.Context, input *ResolveElicitationInput) error

func (*HTTPClient) RunScheduleNow

func (c *HTTPClient) RunScheduleNow(ctx context.Context, id string) error

func (*HTTPClient) SaveResource

func (c *HTTPClient) SaveResource(ctx context.Context, input *SaveResourceInput) error

func (*HTTPClient) SendA2AMessage

func (c *HTTPClient) SendA2AMessage(ctx context.Context, agentID string, req *a2a.SendMessageRequest) (*a2a.SendMessageResponse, error)

func (*HTTPClient) SteerTurn

func (c *HTTPClient) SteerTurn(ctx context.Context, input *SteerTurnInput) (*SteerTurnOutput, error)

func (*HTTPClient) StreamEvents

func (c *HTTPClient) StreamEvents(ctx context.Context, input *StreamEventsInput) (streaming.Subscription, error)

func (*HTTPClient) TerminateConversation

func (c *HTTPClient) TerminateConversation(ctx context.Context, conversationID string) error

func (*HTTPClient) UpdateConversation

func (c *HTTPClient) UpdateConversation(ctx context.Context, input *UpdateConversationInput) (*conversation.Conversation, error)

func (*HTTPClient) UploadFile

func (*HTTPClient) UpsertSchedules

func (c *HTTPClient) UpsertSchedules(ctx context.Context, schedules []*scheduler.Schedule) error

type HTTPOption

type HTTPOption func(*HTTPClient)

func WithAuthToken

func WithAuthToken(token string) HTTPOption

WithAuthToken sets a static Bearer token that is sent with every request.

func WithConversationsPath

func WithConversationsPath(path string) HTTPOption

func WithHTTPClient

func WithHTTPClient(client *http.Client) HTTPOption

func WithQueryPath

func WithQueryPath(path string) HTTPOption

func WithSchedulerPath

func WithSchedulerPath(path string) HTTPOption

func WithTokenProvider

func WithTokenProvider(p TokenProvider) HTTPOption

WithTokenProvider sets a dynamic token provider called before each request.

type HandlerOption

type HandlerOption func(*handlerConfig)

HandlerOption customises the handler created by NewHandler.

func WithA2AHandler

func WithA2AHandler(h *svca2a.Handler) HandlerOption

func WithAuth

func WithAuth(cfg *svcauth.Config, sessions *svcauth.Manager, opts ...svcauth.HandlerOption) HandlerOption

func WithScheduler

func WithScheduler(svc *scheduler.Service, handler *scheduler.Handler, opts *SchedulerOptions) HandlerOption

func WithSchedulerHandler

func WithSchedulerHandler(h *scheduler.Handler) HandlerOption

func WithSpeechHandler

func WithSpeechHandler(h *speech.Handler) HandlerOption

func WithWorkflowHandler

func WithWorkflowHandler(h *workflow.Handler) HandlerOption

type ImportResourcesInput

type ImportResourcesInput struct {
	Resources []Resource `json:"resources"`
	Replace   bool       `json:"replace"`
}

ImportResourcesInput carries resources to import in bulk.

type ImportResourcesOutput

type ImportResourcesOutput struct {
	Imported int `json:"imported"`
	Skipped  int `json:"skipped"`
}

ImportResourcesOutput summarises the import operation.

type LinkedConversationEntry

type LinkedConversationEntry struct {
	ConversationID       string     `json:"conversationId"`
	ParentConversationID string     `json:"parentConversationId,omitempty"`
	ParentTurnID         string     `json:"parentTurnId,omitempty"`
	AgentID              string     `json:"agentId,omitempty"`
	Title                string     `json:"title,omitempty"`
	Status               string     `json:"status,omitempty"`
	Response             string     `json:"response,omitempty"`
	CreatedAt            time.Time  `json:"createdAt"`
	UpdatedAt            *time.Time `json:"updatedAt,omitempty"`
}

type LinkedConversationPage

type LinkedConversationPage struct {
	Rows       []*LinkedConversationEntry `json:"rows"`
	NextCursor string                     `json:"nextCursor,omitempty"`
	PrevCursor string                     `json:"prevCursor,omitempty"`
	HasMore    bool                       `json:"hasMore"`
}

type LinkedConversationState

type LinkedConversationState struct {
	ConversationID       string     `json:"conversationId"`
	ParentConversationID string     `json:"parentConversationId,omitempty"`
	ParentTurnID         string     `json:"parentTurnId,omitempty"`
	ToolCallID           string     `json:"toolCallId,omitempty"`
	AgentID              string     `json:"agentId,omitempty"`
	Title                string     `json:"title,omitempty"`
	Status               string     `json:"status,omitempty"`
	Response             string     `json:"response,omitempty"`
	CreatedAt            time.Time  `json:"createdAt,omitempty"`
	UpdatedAt            *time.Time `json:"updatedAt,omitempty"`
}

LinkedConversationState represents a child conversation linked to a parent turn.

func SelectLinkedConversationForToolCall

func SelectLinkedConversationForToolCall(turn *TurnState, toolCallID string) *LinkedConversationState

SelectLinkedConversationForToolCall returns the linked conversation associated with a specific tool call, or nil if none exists. This is the single source of truth for tool→child navigation.

func SelectLinkedConversations

func SelectLinkedConversations(turn *TurnState) []*LinkedConversationState

SelectLinkedConversations returns linked child conversations for a turn.

type ListConversationsInput

type ListConversationsInput struct {
	AgentID          string
	ParentID         string
	ParentTurnID     string
	ExcludeScheduled bool
	Query            string
	Status           string
	Page             *PageInput
}

ListConversationsInput controls the conversation listing query.

type ListFilesInput

type ListFilesInput struct {
	ConversationID string
}

ListFilesInput controls which files are listed.

type ListFilesOutput

type ListFilesOutput struct {
	Files []*FileEntry
}

ListFilesOutput is the result of listing files.

type ListLinkedConversationsInput

type ListLinkedConversationsInput struct {
	ParentConversationID string
	ParentTurnID         string
	Page                 *PageInput
}

type ListPendingElicitationsInput

type ListPendingElicitationsInput struct {
	ConversationID string
}

ListPendingElicitationsInput controls pending elicitation lookup.

type ListPendingToolApprovalsInput

type ListPendingToolApprovalsInput struct {
	UserID         string
	ConversationID string
	Status         string
}

type ListResourcesInput

type ListResourcesInput struct {
	Kind string `json:"kind"`
}

ListResourcesInput controls which resources are listed.

type ListResourcesOutput

type ListResourcesOutput struct {
	Names []string `json:"names"`
}

ListResourcesOutput is the result of listing workspace resources.

type LocalLoginRequest

type LocalLoginRequest struct {
	Name string `json:"name"`
}

type LocalOOBSessionOptions added in v0.1.2

type LocalOOBSessionOptions struct {
	ConfigURL  string
	SecretsURL string
	Scopes     []string
}

type MessagePage

type MessagePage = data.MessagePage

MessagePage is the paginated result from GetMessages.

type Mode

type Mode string
const (
	ModeEmbedded Mode = "embedded"
	ModeHTTP     Mode = "http"
)

type ModelStepState

type ModelStepState struct {
	ModelCallID               string          `json:"modelCallId"`
	AssistantMessageID        string          `json:"assistantMessageId"`
	Provider                  string          `json:"provider,omitempty"`
	Model                     string          `json:"model,omitempty"`
	Status                    string          `json:"status,omitempty"`
	RequestPayloadID          string          `json:"requestPayloadId,omitempty"`
	ResponsePayloadID         string          `json:"responsePayloadId,omitempty"`
	ProviderRequestPayloadID  string          `json:"providerRequestPayloadId,omitempty"`
	ProviderResponsePayloadID string          `json:"providerResponsePayloadId,omitempty"`
	StreamPayloadID           string          `json:"streamPayloadId,omitempty"`
	RequestPayload            json.RawMessage `json:"requestPayload,omitempty"`
	ResponsePayload           json.RawMessage `json:"responsePayload,omitempty"`
	ProviderRequestPayload    json.RawMessage `json:"providerRequestPayload,omitempty"`
	ProviderResponsePayload   json.RawMessage `json:"providerResponsePayload,omitempty"`
	StreamPayload             json.RawMessage `json:"streamPayload,omitempty"`
	StartedAt                 *time.Time      `json:"startedAt,omitempty"`
	CompletedAt               *time.Time      `json:"completedAt,omitempty"`
}

ModelStepState represents a single LLM call within an execution page.

type MoveQueuedTurnInput

type MoveQueuedTurnInput struct {
	ConversationID string `json:"conversationId"`
	TurnID         string `json:"turnId"`
	Direction      string `json:"direction"` // up|down
}

type OAuthConfigResponse

type OAuthConfigResponse struct {
	ConfigURL string   `json:"configURL"`
	Scopes    []string `json:"scopes,omitempty"`
}

type OOBRequest

type OOBRequest struct {
	SecretsURL string   `json:"secretsURL"`
	Scopes     []string `json:"scopes,omitempty"`
}

type PageInput

type PageInput = data.PageInput

Pagination re-exports from data layer.

type PendingElicitation

type PendingElicitation struct {
	ConversationID string                 `json:"conversationId"`
	ElicitationID  string                 `json:"elicitationId"`
	MessageID      string                 `json:"messageId"`
	Status         string                 `json:"status"`
	Role           string                 `json:"role"`
	Type           string                 `json:"type"`
	CreatedAt      time.Time              `json:"createdAt"`
	Content        string                 `json:"content,omitempty"`
	Elicitation    map[string]interface{} `json:"elicitation,omitempty"`
}

PendingElicitation represents one pending elicitation message.

type PendingToolApproval

type PendingToolApproval struct {
	ID             string                 `json:"id"`
	UserID         string                 `json:"userId"`
	ConversationID string                 `json:"conversationId,omitempty"`
	TurnID         string                 `json:"turnId,omitempty"`
	MessageID      string                 `json:"messageId,omitempty"`
	ToolName       string                 `json:"toolName"`
	Title          string                 `json:"title,omitempty"`
	Arguments      map[string]interface{} `json:"arguments,omitempty"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
	Status         string                 `json:"status"`
	Decision       string                 `json:"decision,omitempty"`
	CreatedAt      time.Time              `json:"createdAt"`
	UpdatedAt      *time.Time             `json:"updatedAt,omitempty"`
	ErrorMessage   string                 `json:"errorMessage,omitempty"`
}

type PlanFeedPayload added in v0.1.6

type PlanFeedPayload struct {
	Explanation string      `json:"explanation,omitempty"`
	Steps       []*PlanStep `json:"steps,omitempty"`
}

PlanFeedPayload is the typed payload for plan tool feeds. It replaces untyped map probing for explanation/steps in feed rendering.

type PlanStep added in v0.1.6

type PlanStep struct {
	ID      string `json:"id,omitempty"`
	Step    string `json:"step"`
	Status  string `json:"status,omitempty"`
	Details string `json:"details,omitempty"`
}

PlanStep is one step within a PlanFeedPayload.

type QuerySelector

type QuerySelector struct {
	Limit   int    `json:"limit,omitempty"`
	Offset  int    `json:"offset,omitempty"`
	OrderBy string `json:"orderBy,omitempty"`
}

type ResolveElicitationInput

type ResolveElicitationInput struct {
	ConversationID string
	ElicitationID  string
	Action         string
	Payload        map[string]interface{}
}

ResolveElicitationInput carries the user response for an elicitation prompt.

type Resource

type Resource struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
	Data []byte `json:"data"`
}

Resource is a single workspace resource used for bulk import/export.

type ResourceRef

type ResourceRef struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
}

ResourceRef identifies a workspace resource by kind and name.

type SaveResourceInput

type SaveResourceInput struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
	Data []byte `json:"data"`
}

SaveResourceInput describes a workspace resource to create or update.

type SchedulerOptions

type SchedulerOptions struct {
	EnableAPI      bool
	EnableRunNow   bool
	EnableWatchdog bool
}

SchedulerOptions controls scheduler behavior at the SDK level.

type StarterTask

type StarterTask struct {
	ID          string `json:"id,omitempty"`
	Title       string `json:"title,omitempty"`
	Prompt      string `json:"prompt,omitempty"`
	Description string `json:"description,omitempty"`
	Icon        string `json:"icon,omitempty"`
}

StarterTask describes an agent-specific suggested starter prompt for empty chat state.

type SteerTurnInput

type SteerTurnInput struct {
	ConversationID string `json:"conversationId"`
	TurnID         string `json:"turnId"`
	Content        string `json:"content"`
	Role           string `json:"role,omitempty"` // default "user"
}

type SteerTurnOutput

type SteerTurnOutput struct {
	MessageID      string `json:"messageId"`
	TurnID         string `json:"turnId,omitempty"`
	Status         string `json:"status,omitempty"`
	CanceledTurnID string `json:"canceledTurnId,omitempty"`
}

type StreamEventsInput

type StreamEventsInput struct {
	ConversationID string
	Filter         streaming.Filter
}

StreamEventsInput controls which streaming events to subscribe to.

type TokenProvider

type TokenProvider func(ctx context.Context) (string, error)

TokenProvider is a function that returns a current auth token. It is called before each request, allowing dynamic token refresh.

type ToolDefinitionInfo

type ToolDefinitionInfo struct {
	Name         string                 `json:"name"`
	Description  string                 `json:"description,omitempty"`
	Parameters   map[string]interface{} `json:"parameters,omitempty"`
	Required     []string               `json:"required,omitempty"`
	OutputSchema map[string]interface{} `json:"output_schema,omitempty"`
}

ToolDefinitionInfo is a tool definition returned by ListToolDefinitions.

type ToolStepState

type ToolStepState struct {
	ToolCallID                string          `json:"toolCallId"`
	ToolMessageID             string          `json:"toolMessageId"`
	ToolName                  string          `json:"toolName"`
	Status                    string          `json:"status,omitempty"`
	RequestPayloadID          string          `json:"requestPayloadId,omitempty"`
	ResponsePayloadID         string          `json:"responsePayloadId,omitempty"`
	RequestPayload            json.RawMessage `json:"requestPayload,omitempty"`
	ResponsePayload           json.RawMessage `json:"responsePayload,omitempty"`
	LinkedConversationID      string          `json:"linkedConversationId,omitempty"`
	LinkedConversationAgentID string          `json:"linkedConversationAgentId,omitempty"`
	LinkedConversationTitle   string          `json:"linkedConversationTitle,omitempty"`
	StartedAt                 *time.Time      `json:"startedAt,omitempty"`
	CompletedAt               *time.Time      `json:"completedAt,omitempty"`
}

ToolStepState represents a single tool invocation within an execution page.

type TranscriptOption

type TranscriptOption func(*transcriptOptions)

func WithIncludeFeeds

func WithIncludeFeeds() TranscriptOption

WithIncludeFeeds enables tool feed resolution in the transcript response. When enabled, matching tool calls are scanned and their response payloads fetched to populate the Feeds field on ConversationState.

func WithTranscriptMessageSelector

func WithTranscriptMessageSelector(selector *QuerySelector) TranscriptOption

func WithTranscriptSelector

func WithTranscriptSelector(name string, selector *QuerySelector) TranscriptOption

func WithTranscriptToolMessageSelector

func WithTranscriptToolMessageSelector(selector *QuerySelector) TranscriptOption

func WithTranscriptTurnSelector

func WithTranscriptTurnSelector(selector *QuerySelector) TranscriptOption

type TurnState

type TurnState struct {
	TurnID              string                     `json:"turnId"`
	Status              TurnStatus                 `json:"status"`
	User                *UserMessageState          `json:"user,omitempty"`
	Execution           *ExecutionState            `json:"execution,omitempty"`
	Assistant           *AssistantState            `json:"assistant,omitempty"`
	Elicitation         *ElicitationState          `json:"elicitation,omitempty"`
	LinkedConversations []*LinkedConversationState `json:"linkedConversations,omitempty"`
	CreatedAt           time.Time                  `json:"createdAt,omitempty"`
	QueueSeq            int                        `json:"queueSeq,omitempty"`
	StartedByMessageID  string                     `json:"startedByMessageId,omitempty"`
}

TurnState is the canonical representation of a single conversation turn.

func SelectRenderTurns

func SelectRenderTurns(state *ConversationState) []*TurnState

SelectRenderTurns returns all turns suitable for rendering. It filters out turns that have no meaningful content to display.

type TurnStatus

type TurnStatus string

TurnStatus enumerates canonical turn lifecycle states.

const (
	TurnStatusQueued         TurnStatus = "queued"
	TurnStatusRunning        TurnStatus = "running"
	TurnStatusWaitingForUser TurnStatus = "waiting_for_user"
	TurnStatusCompleted      TurnStatus = "completed"
	TurnStatusFailed         TurnStatus = "failed"
	TurnStatusCanceled       TurnStatus = "canceled"
)

type UpdateConversationInput

type UpdateConversationInput struct {
	ConversationID string `json:"-"`
	Title          string `json:"title,omitempty"`
	Visibility     string `json:"visibility,omitempty"` // private|public
	Shareable      *bool  `json:"shareable,omitempty"`
}

UpdateConversationInput updates mutable conversation fields. At least one of Title, Visibility, or Shareable must be provided.

type UploadFileInput

type UploadFileInput struct {
	ConversationID string
	Name           string
	ContentType    string
	Data           []byte
}

UploadFileInput describes a file to upload.

type UploadFileOutput

type UploadFileOutput struct {
	ID  string
	URI string
}

UploadFileOutput is the result of a file upload.

type UsageSummary added in v0.1.6

type UsageSummary struct {
	TotalInputTokens  int `json:"totalInputTokens,omitempty"`
	TotalOutputTokens int `json:"totalOutputTokens,omitempty"`
}

UsageSummary aggregates token usage for a conversation transcript.

type UserMessageState

type UserMessageState struct {
	MessageID string `json:"messageId"`
	Content   string `json:"content,omitempty"`
}

UserMessageState represents the user message that initiated a turn.

type WorkspaceAgentInfo

type WorkspaceAgentInfo struct {
	ID           string        `json:"id,omitempty"`
	Name         string        `json:"name,omitempty"`
	ModelRef     string        `json:"modelRef,omitempty"`
	StarterTasks []StarterTask `json:"starterTasks,omitempty"`
}

WorkspaceAgentInfo describes a UI-facing agent entry returned by GET /v1/workspace/metadata.

type WorkspaceCapabilities

type WorkspaceCapabilities struct {
	AgentAutoSelection    bool `json:"agentAutoSelection,omitempty"`
	ModelAutoSelection    bool `json:"modelAutoSelection,omitempty"`
	ToolAutoSelection     bool `json:"toolAutoSelection,omitempty"`
	CompactConversation   bool `json:"compactConversation,omitempty"`
	PruneConversation     bool `json:"pruneConversation,omitempty"`
	AnonymousSession      bool `json:"anonymousSession,omitempty"`
	MessageCursor         bool `json:"messageCursor,omitempty"`
	StructuredElicitation bool `json:"structuredElicitation,omitempty"`
	TurnStartedEvent      bool `json:"turnStartedEvent,omitempty"`
}

WorkspaceCapabilities advertises optional backend contracts so clients can adapt UX without probing unsupported features.

type WorkspaceDefaults

type WorkspaceDefaults struct {
	Agent           string `json:"agent,omitempty"`
	Model           string `json:"model,omitempty"`
	Embedder        string `json:"embedder,omitempty"`
	AutoSelectTools bool   `json:"autoSelectTools,omitempty"`
}

type WorkspaceMetadata

type WorkspaceMetadata struct {
	WorkspaceRoot   string                `json:"workspaceRoot,omitempty"`
	DefaultAgent    string                `json:"defaultAgent,omitempty"`
	DefaultModel    string                `json:"defaultModel,omitempty"`
	DefaultEmbedder string                `json:"defaultEmbedder,omitempty"`
	Defaults        *WorkspaceDefaults    `json:"defaults,omitempty"`
	Capabilities    WorkspaceCapabilities `json:"capabilities,omitempty"`
	Agents          []string              `json:"agents,omitempty"`
	Models          []string              `json:"models,omitempty"`
	AgentInfos      []WorkspaceAgentInfo  `json:"agentInfos,omitempty"`
	ModelInfos      []WorkspaceModelInfo  `json:"modelInfos,omitempty"`
	Version         string                `json:"version,omitempty"`
}

WorkspaceMetadata is the workspace bootstrap payload returned by GET /v1/workspace/metadata.

type WorkspaceModelInfo

type WorkspaceModelInfo struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

WorkspaceModelInfo describes a UI-facing model entry returned by GET /v1/workspace/metadata.

Jump to

Keyboard shortcuts

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