sdk

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 91 Imported by: 2

Documentation

Index

Constants

View Source
const (
	TurnStatusQueued         = api.TurnStatusQueued
	TurnStatusRunning        = api.TurnStatusRunning
	TurnStatusWaitingForUser = api.TurnStatusWaitingForUser
	TurnStatusCompleted      = api.TurnStatusCompleted
	TurnStatusFailed         = api.TurnStatusFailed
	TurnStatusCanceled       = api.TurnStatusCanceled
)
View Source
const (
	ElicitationStatusPending  = api.ElicitationStatusPending
	ElicitationStatusAccepted = api.ElicitationStatusAccepted
	ElicitationStatusDeclined = api.ElicitationStatusDeclined
	ElicitationStatusCanceled = api.ElicitationStatusCanceled
)
View Source
const (
	HeaderDebugEnabled    = "X-Agently-Debug"
	HeaderDebugLevel      = "X-Agently-Debug-Level"
	HeaderDebugComponents = "X-Agently-Debug-Components"
)
View Source
const (
	DirectionBefore = api.DirectionBefore
	DirectionAfter  = api.DirectionAfter
	DirectionLatest = api.DirectionLatest
)
View Source
const (
	TranscriptSelectorTurn        = "Transcript"
	TranscriptSelectorMessage     = "Message"
	TranscriptSelectorToolMessage = "ToolMessage"
)

Variables

View Source
var ErrDatasourceStackNotConfigured = errors.New("datasource stack not configured")

ErrDatasourceStackNotConfigured is returned by Backend implementations that have not wired the datasource / overlay services. HTTP handlers translate it into 501 Not Implemented so clients can distinguish from transient errors.

Functions

func NewHandler

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

func NewHandlerWithContext

func NewHandlerWithContext(ctx context.Context, client Backend, 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

func WithDebug added in v0.1.7

func WithDebug(ctx context.Context, components ...string) context.Context

WithDebug enables debug logging for a single SDK call context. When no components are provided, all components are enabled for that context.

func WithDebugOptions added in v0.1.7

func WithDebugOptions(ctx context.Context, opts ...DebugOption) context.Context

WithDebugOptions enables debug logging for a single SDK call context using explicit options such as level and component filters.

Types

type ActivateSkillInput added in v0.1.8

type ActivateSkillInput = api.ActivateSkillInput

type ActivateSkillOutput added in v0.1.8

type ActivateSkillOutput = api.ActivateSkillOutput

type ActiveFeedState

type ActiveFeedState = api.ActiveFeedState

type ApprovalCallback added in v0.1.7

type ApprovalCallback = api.ApprovalCallback

type ApprovalCallbackPayload added in v0.1.7

type ApprovalCallbackPayload = api.ApprovalCallbackPayload

type ApprovalCallbackResult added in v0.1.7

type ApprovalCallbackResult = api.ApprovalCallbackResult

type ApprovalEditor added in v0.1.7

type ApprovalEditor = api.ApprovalEditor

type ApprovalForgeView added in v0.1.7

type ApprovalForgeView = api.ApprovalForgeView

type ApprovalMeta added in v0.1.7

type ApprovalMeta = api.ApprovalMeta

type ApprovalOption added in v0.1.7

type ApprovalOption = api.ApprovalOption

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 narration, show narration.

type AssistantMessageState

type AssistantMessageState = api.AssistantMessageState

type AssistantState

type AssistantState = api.AssistantState

type AsyncOperationState added in v0.1.7

type AsyncOperationState = api.AsyncOperationState

type AuthProvider

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

type Backend added in v0.1.7

type Backend interface {
	Client
}

Backend is the server-side implementation contract used by SDK HTTP handlers. It is intentionally separate from the caller-facing Client concept, even though today it currently embeds the same operation surface.

func NewBackendFromRuntime deprecated added in v0.1.7

func NewBackendFromRuntime(rt *executor.Runtime) (Backend, error)

Deprecated: prefer internal/sdkbackend.FromRuntime for server/bootstrap wiring and NewLocalHTTPFromRuntime for SDK callers.

NewBackendFromRuntime builds the in-process backend implementation used by local handlers and server wiring.

func NewEmbedded deprecated

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

Deprecated: use NewBackendFromRuntime for server wiring and NewLocalHTTPFromRuntime for SDK callers.

NewEmbedded builds the legacy in-process backend wrapper. Prefer NewBackendFromRuntime for server wiring and NewLocalHTTPFromRuntime for SDK callers that should exercise the public endpoint contract.

func NewEmbeddedFromRuntime deprecated

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

Deprecated: use NewBackendFromRuntime for server wiring and NewLocalHTTPFromRuntime for SDK callers.

NewEmbeddedFromRuntime builds an in-process backend over a runtime. Prefer NewLocalHTTPFromRuntime for SDK callers that should exercise the public endpoint contract instead of calling services directly.

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)
	// DeleteConversation deletes a conversation tree owned by the current user.
	DeleteConversation(ctx context.Context, id string) 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) (*PendingToolApprovalPage, 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)

	// ExecuteMCPUIToolCall runs a host-mediated MCP UI guest tool call through
	// the canonical conversation-backed execution path. Bundle-derived
	// approval metadata is honored, so a tool configured for queue approval is
	// routed to the existing approval queue and the response status is
	// "queued" rather than "ok". This is the only path MCP UI guests use for
	// tools/call — direct /v1/tools/execute is intentionally bypassed.
	ExecuteMCPUIToolCall(ctx context.Context, input *MCPUIToolCallInput) (*MCPUIToolCallOutput, error)

	// ListTemplates returns output templates available to the current agent/workspace.
	ListTemplates(ctx context.Context, input *ListTemplatesInput) (*ListTemplatesOutput, error)

	// GetTemplate resolves one output template by name and can request document inclusion.
	GetTemplate(ctx context.Context, input *GetTemplateInput) (*GetTemplateOutput, error)

	// ListToolDefinitions returns the set of tool definitions available in the workspace.
	ListToolDefinitions(ctx context.Context) ([]ToolDefinitionInfo, error)
	// ListSkills returns visible skills for the conversation's current agent.
	ListSkills(ctx context.Context, input *ListSkillsInput) (*ListSkillsOutput, error)
	// ActivateSkill returns the SKILL.md body for a named skill in the conversation context.
	ActivateSkill(ctx context.Context, input *ActivateSkillInput) (*ActivateSkillOutput, error)
	// GetSkillDiagnostics returns load/shadow/validation diagnostics for the current skill registry.
	GetSkillDiagnostics(ctx context.Context) (*SkillDiagnosticsOutput, 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

	// FetchDatasource returns rows for a workspace-registered datasource.
	// Caller identity flows via ctx; the backend reads it when keying the
	// per-user cache and attaches any MCP auth token when the backend is
	// mcp_tool. Implementations that have not wired the datasource stack
	// should return a clear error rather than nil rows.
	FetchDatasource(ctx context.Context, in *api.FetchDatasourceInput) (*api.FetchDatasourceOutput, error)

	// InvalidateDatasourceCache drops cache entries for a datasource in the
	// caller's scope. When InputsHash is empty, the whole datasource range
	// is dropped.
	InvalidateDatasourceCache(ctx context.Context, in *api.InvalidateDatasourceCacheInput) error

	// ListLookupRegistry returns the set of named-token bindings available
	// for a given render context — composed server-side from loaded overlays
	// whose Named binding matches. Used by the web + mobile `/name` hotkey
	// component and by the authored-prompt renderer.
	ListLookupRegistry(ctx context.Context, in *api.ListLookupRegistryInput) (*api.ListLookupRegistryOutput, error)
}

type ConversationPage

type ConversationPage = api.ConversationPage

type ConversationState

type ConversationState = api.ConversationState

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 = api.ConversationStateResponse

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. Returns nil when no events have been applied yet or after Reset/Clear is called. Callers must nil-check the result before dereferencing.

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 = api.CreateConversationInput

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 DebugOption added in v0.1.7

type DebugOption func(*debugOptions)

func WithDebugComponents added in v0.1.7

func WithDebugComponents(components ...string) DebugOption

func WithDebugLevel added in v0.1.7

func WithDebugLevel(level string) DebugOption

type DecideToolApprovalInput

type DecideToolApprovalInput = api.DecideToolApprovalInput

type DecideToolApprovalOutput

type DecideToolApprovalOutput = api.DecideToolApprovalOutput

type Direction

type Direction = api.Direction

type DownloadFileInput

type DownloadFileInput = api.DownloadFileInput

type DownloadFileOutput

type DownloadFileOutput = api.DownloadFileOutput

type EditQueuedTurnInput

type EditQueuedTurnInput = api.EditQueuedTurnInput

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 = api.ElicitationState

type ElicitationStatus

type ElicitationStatus = api.ElicitationStatus

type ExecutionPageState

type ExecutionPageState = api.ExecutionPageState

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 = api.ExecutionState

type ExportResourcesInput

type ExportResourcesInput = api.ExportResourcesInput

type ExportResourcesOutput

type ExportResourcesOutput = api.ExportResourcesOutput

type FeedActivation

type FeedActivation = api.FeedActivation

type FeedMatch

type FeedMatch = api.FeedMatch

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 = api.FeedSpec

type FeedState

type FeedState = api.FeedState

type FileEntry

type FileEntry = api.FileEntry

type GetMessagesInput

type GetMessagesInput = api.GetMessagesInput

type GetResourceOutput

type GetResourceOutput = api.GetResourceOutput

type GetTemplateInput added in v0.1.7

type GetTemplateInput = api.GetTemplateInput

type GetTemplateOutput added in v0.1.7

type GetTemplateOutput = api.GetTemplateOutput

type GetTranscriptInput

type GetTranscriptInput = api.GetTranscriptInput

type HTTPClient

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

func NewHTTP

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

func NewLocalHTTPFromRuntime added in v0.1.7

func NewLocalHTTPFromRuntime(ctx context.Context, rt *executor.Runtime, opts ...HandlerOption) (*HTTPClient, func(), error)

NewLocalHTTPFromRuntime creates an endpoint-backed SDK client for a local runtime. It exposes the runtime through the standard SDK HTTP handler and returns a regular HTTPClient, so SDK callers exercise the same endpoint contract as remote clients.

func (*HTTPClient) ActivateSkill added in v0.1.8

func (c *HTTPClient) ActivateSkill(ctx context.Context, input *ActivateSkillInput) (*ActivateSkillOutput, 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) BaseURL added in v0.1.7

func (c *HTTPClient) BaseURL() string

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) DeleteConversation added in v0.1.9

func (c *HTTPClient) DeleteConversation(ctx context.Context, id string) 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) ExecuteMCPUIToolCall added in v0.1.9

func (c *HTTPClient) ExecuteMCPUIToolCall(ctx context.Context, input *MCPUIToolCallInput) (*MCPUIToolCallOutput, 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) FetchDatasource added in v0.1.8

FetchDatasource dispatches POST /v1/api/datasources/{id}/fetch.

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) GetSkillDiagnostics added in v0.1.8

func (c *HTTPClient) GetSkillDiagnostics(ctx context.Context) (*SkillDiagnosticsOutput, error)

func (*HTTPClient) GetTemplate added in v0.1.7

func (c *HTTPClient) GetTemplate(ctx context.Context, input *GetTemplateInput) (*GetTemplateOutput, 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) GetWorkspaceMetadataWithTarget added in v0.1.7

func (c *HTTPClient) GetWorkspaceMetadataWithTarget(ctx context.Context, target *MetadataTargetContext) (*WorkspaceMetadata, error)

func (*HTTPClient) HTTPClient added in v0.1.7

func (c *HTTPClient) HTTPClient() *http.Client

func (*HTTPClient) ImportResources

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

func (*HTTPClient) InvalidateDatasourceCache added in v0.1.8

func (c *HTTPClient) InvalidateDatasourceCache(ctx context.Context, in *api.InvalidateDatasourceCacheInput) error

InvalidateDatasourceCache dispatches DELETE /v1/api/datasources/{id}/cache.

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) ListLookupRegistry added in v0.1.8

ListLookupRegistry dispatches GET /v1/api/lookups/registry?context=<…>.

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) (*PendingToolApprovalPage, 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) ListSkills added in v0.1.8

func (c *HTTPClient) ListSkills(ctx context.Context, input *ListSkillsInput) (*ListSkillsOutput, error)

func (*HTTPClient) ListTemplates added in v0.1.7

func (c *HTTPClient) ListTemplates(ctx context.Context, input *ListTemplatesInput) (*ListTemplatesOutput, 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 (c *HTTPClient) UploadFile(ctx context.Context, input *UploadFileInput) (*UploadFileOutput, error)

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 WithSessionDebug added in v0.1.7

func WithSessionDebug(level string, components ...string) HTTPOption

WithSessionDebug enables request-scoped debug logging headers for all requests issued by this HTTP client instance.

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 WithCallbackDispatchHandler added in v0.1.8

func WithCallbackDispatchHandler(h *callbackhttp.Handler) HandlerOption

WithCallbackDispatchHandler mounts POST /v1/api/callbacks/dispatch, the workspace-declared forge submit → tool router. Safe to pass a nil handler — the route is not mounted in that case.

func WithMCPUIResourceReader added in v0.1.9

func WithMCPUIResourceReader(reader MCPUIResourceReader) HandlerOption

WithMCPUIResourceReader mounts GET /v1/api/mcp-ui/resources/read?uri=... when the reader is non-nil. The reader resolves UI resources through host-owned runtime code (no browser-side MCP client).

func WithMCPUIToolCaller added in v0.1.9

func WithMCPUIToolCaller(caller MCPUIToolCaller) HandlerOption

WithMCPUIToolCaller mounts POST /v1/api/mcp-ui/tools/call when the caller is non-nil. The caller owns the canonical server-side execution path, including any approval and tool bundle behavior.

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 WithUIBridgeHandler added in v0.1.8

func WithUIBridgeHandler(h http.Handler) HandlerOption

WithUIBridgeHandler mounts the Forge UI bridge RPC endpoint at /v1/ui/rpc.

type ImportResourcesInput

type ImportResourcesInput = api.ImportResourcesInput

type ImportResourcesOutput

type ImportResourcesOutput = api.ImportResourcesOutput

type LinkedConversationEntry

type LinkedConversationEntry = api.LinkedConversationEntry

type LinkedConversationPage

type LinkedConversationPage = api.LinkedConversationPage

type LinkedConversationState

type LinkedConversationState = api.LinkedConversationState

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 = api.ListConversationsInput

type ListFilesInput

type ListFilesInput = api.ListFilesInput

type ListFilesOutput

type ListFilesOutput = api.ListFilesOutput

type ListLinkedConversationsInput

type ListLinkedConversationsInput = api.ListLinkedConversationsInput

type ListPendingElicitationsInput

type ListPendingElicitationsInput = api.ListPendingElicitationsInput

type ListPendingToolApprovalsInput

type ListPendingToolApprovalsInput = api.ListPendingToolApprovalsInput

type ListResourcesInput

type ListResourcesInput = api.ListResourcesInput

type ListResourcesOutput

type ListResourcesOutput = api.ListResourcesOutput

type ListSkillsInput added in v0.1.8

type ListSkillsInput = api.ListSkillsInput

type ListSkillsOutput added in v0.1.8

type ListSkillsOutput = api.ListSkillsOutput

type ListTemplatesInput added in v0.1.7

type ListTemplatesInput = api.ListTemplatesInput

type ListTemplatesOutput added in v0.1.7

type ListTemplatesOutput = api.ListTemplatesOutput

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 MCPUIResourceReadResponse added in v0.1.9

type MCPUIResourceReadResponse struct {
	Uri      string                 `json:"uri"`
	MimeType string                 `json:"mimeType"`
	Text     string                 `json:"text"`
	Meta     map[string]interface{} `json:"_meta,omitempty"`
}

MCPUIResourceReadResponse is the JSON envelope returned by the host-owned browser read endpoint. It is intentionally minimal: only the fields the browser host needs to assemble an iframe srcDoc and validate the resource.

type MCPUIResourceReader added in v0.1.9

type MCPUIResourceReader func(ctx context.Context, uri string) (*mcpschema.ReadResourceResult, error)

MCPUIResourceReader resolves a host-owned MCP UI resource by exact uri. It is the same-origin, narrow read path the browser host uses; the host still owns the MCP transport, so the browser never speaks MCP directly.

type MCPUIToolCallInput added in v0.1.9

type MCPUIToolCallInput = api.MCPUIToolCallInput

type MCPUIToolCallOutput added in v0.1.9

type MCPUIToolCallOutput = api.MCPUIToolCallOutput

type MCPUIToolCaller added in v0.1.9

type MCPUIToolCaller func(ctx context.Context, input *MCPUIToolCallInput) (*MCPUIToolCallOutput, error)

MCPUIToolCaller executes a guest-originated MCP UI tool call through a host-owned, approval-aware backend path.

type MessagePage

type MessagePage = api.MessagePage

type MetadataTargetContext added in v0.1.7

type MetadataTargetContext struct {
	Platform     string
	FormFactor   string
	Surface      string
	Capabilities []string
}

type Mode

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

type ModelStepState

type ModelStepState = api.ModelStepState

type MoveQueuedTurnInput

type MoveQueuedTurnInput = api.MoveQueuedTurnInput

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 = api.PageInput

type PendingElicitation

type PendingElicitation = api.PendingElicitation

type PendingToolApproval

type PendingToolApproval = api.PendingToolApproval

type PendingToolApprovalPage added in v0.1.7

type PendingToolApprovalPage = api.PendingToolApprovalPage

type PlanFeedPayload added in v0.1.6

type PlanFeedPayload = api.PlanFeedPayload

type PlanStep added in v0.1.6

type PlanStep = api.PlanStep

type PlannerState added in v0.1.8

type PlannerState = api.PlannerState

type QuerySelector

type QuerySelector = api.QuerySelector

type ResolveElicitationInput

type ResolveElicitationInput = api.ResolveElicitationInput

type Resource

type Resource = api.Resource

type ResourceRef

type ResourceRef = api.ResourceRef

type SaveResourceInput

type SaveResourceInput = api.SaveResourceInput

type SchedulerOptions

type SchedulerOptions struct {
	EnableAPI      bool
	EnableRunNow   bool
	EnableWatchdog bool
}

SchedulerOptions controls scheduler behavior at the SDK level.

type SessionDebugConfig added in v0.1.7

type SessionDebugConfig struct {
	Enabled    bool
	Level      string
	Components []string
}

type SkillDiagnosticsOutput added in v0.1.8

type SkillDiagnosticsOutput = api.SkillDiagnosticsOutput

type SkillItem added in v0.1.8

type SkillItem = api.SkillItem

type StarterTask

type StarterTask = api.StarterTask

type SteerTurnInput

type SteerTurnInput = api.SteerTurnInput

type SteerTurnOutput

type SteerTurnOutput = api.SteerTurnOutput

type StreamEventsInput

type StreamEventsInput = api.StreamEventsInput

type TemplateListItem added in v0.1.7

type TemplateListItem = api.TemplateListItem

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 = api.ToolDefinitionInfo

type ToolStepState

type ToolStepState = api.ToolStepState

type TranscriptOption

type TranscriptOption func(*transcriptOptions)

func WithIncludeFeeds

func WithIncludeFeeds() TranscriptOption

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 TurnMessageState added in v0.1.8

type TurnMessageState = api.TurnMessageState

type TurnState

type TurnState = api.TurnState

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 = api.TurnStatus

type UpdateConversationInput

type UpdateConversationInput = api.UpdateConversationInput

type UploadFileInput

type UploadFileInput = api.UploadFileInput

type UploadFileOutput

type UploadFileOutput = api.UploadFileOutput

type UsageSummary added in v0.1.6

type UsageSummary = api.UsageSummary

type UserMessageState

type UserMessageState = api.UserMessageState

type WorkspaceAgentInfo

type WorkspaceAgentInfo = api.WorkspaceAgentInfo

type WorkspaceCapabilities

type WorkspaceCapabilities = api.WorkspaceCapabilities

type WorkspaceDefaults

type WorkspaceDefaults = api.WorkspaceDefaults

type WorkspaceMetadata

type WorkspaceMetadata = api.WorkspaceMetadata

type WorkspaceModelInfo

type WorkspaceModelInfo = api.WorkspaceModelInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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