Documentation
¶
Index ¶
- type ActorContext
- type Attachment
- type ChatMessage
- type Envelope
- type ExecutionTarget
- type InputType
- type MessageRole
- type MessageStreamMessage
- type MessageType
- type ModelOptions
- type RouteContext
- type RuntimeOptions
- type StreamBody
- type StreamError
- type StreamEventType
- type StreamPayload
- type TaskInput
- type TaskPolicy
- type TaskType
- type TraceContext
- type WorkerTaskBody
- type WorkerTaskMessage
- type WorkspaceOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActorContext ¶
type ActorContext struct {
UserID string `json:"user_id,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Channel string `json:"channel,omitempty"`
ExternalID string `json:"external_id,omitempty"`
AccountID string `json:"account_id,omitempty"`
}
ActorContext describes the identity of the task initiator.
type Attachment ¶
type Attachment struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
MimeType string `json:"mime_type,omitempty"`
URL string `json:"url,omitempty"`
}
Attachment describes an attachment available in task input.
type ChatMessage ¶
type ChatMessage struct {
Role MessageRole `json:"role"`
Content string `json:"content"`
}
ChatMessage is a compact conversation message snapshot.
type Envelope ¶
type Envelope[T any] struct { ID string `json:"id"` Type MessageType `json:"type"` CreatedAt time.Time `json:"created_at"` Trace TraceContext `json:"trace"` Route RouteContext `json:"route"` Body T `json:"body"` Metadata map[string]any `json:"metadata,omitempty"` }
Envelope is the generic domain message envelope used on MQ topics.
type ExecutionTarget ¶
type ExecutionTarget struct {
AssistantID string `json:"assistant_id,omitempty"`
Skills []string `json:"skills,omitempty"`
Tools []string `json:"tools,omitempty"`
}
ExecutionTarget describes the execution target and capability scope for this task.
type MessageRole ¶
type MessageRole string
MessageRole represents the producer role in conversations or stream messages.
const ( // MessageRoleUser represents human user or external user messages. MessageRoleUser MessageRole = "user" // MessageRoleAssistant represents assistant messages. MessageRoleAssistant MessageRole = "assistant" // MessageRoleSystem represents system messages. MessageRoleSystem MessageRole = "system" // MessageRoleTool represents tool result messages. MessageRoleTool MessageRole = "tool" )
type MessageStreamMessage ¶
type MessageStreamMessage = Envelope[StreamBody]
MessageStreamMessage is the stream message protocol from Worker to Server (forwarded to UI).
type MessageType ¶
type MessageType string
MessageType represents the top-level type of domain messages.
const ( // MessageTypeWorkerTask represents task messages from Server to Worker. MessageTypeWorkerTask MessageType = "worker.task" // MessageTypeStream represents stream messages from Worker to Server (forwarded to UI). MessageTypeStream MessageType = "message.stream" )
type ModelOptions ¶
type ModelOptions struct {
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
BaseURL string `json:"base_url,omitempty"`
BaseURLHasV1 bool `json:"base_url_has_v1,omitempty"`
APIKey string `json:"api_key,omitempty"`
}
ModelOptions carries the LLM call configuration for one worker task.
type RouteContext ¶
type RouteContext struct {
OrgID uint `json:"org_id"`
SessionID string `json:"session_id,omitempty"`
WorkerID uint `json:"worker_id,omitempty"`
}
RouteContext carries routing information for message delivery and tenant isolation.
type RuntimeOptions ¶
type RuntimeOptions struct {
Kind string `json:"kind,omitempty"`
WorkDir string `json:"work_dir,omitempty"`
MaxStep int `json:"max_step,omitempty"`
}
RuntimeOptions controls the execution parameters for Worker Runtime.
type StreamBody ¶
type StreamBody struct {
Seq int64 `json:"seq"`
Event StreamEventType `json:"event"`
Payload StreamPayload `json:"payload"`
RunCompleted *events.RunCompletedPayload `json:"run_completed,omitempty"`
Error *StreamError `json:"error,omitempty"`
}
StreamBody is a single streaming event payload from Worker to Server to UI.
type StreamError ¶
StreamError describes terminal or recoverable errors in streaming execution.
type StreamEventType ¶
type StreamEventType string
StreamEventType represents event types in Worker execution streams.
const ( // StreamEventRunStarted indicates a run has started. StreamEventRunStarted StreamEventType = "run.started" // StreamEventRunCompleted indicates a run completed successfully. StreamEventRunCompleted StreamEventType = "run.completed" // StreamEventRunFailed indicates a run failed. StreamEventRunFailed StreamEventType = "run.failed" // StreamEventMessageDelta indicates incremental text output from assistant. StreamEventMessageDelta StreamEventType = "message.delta" // StreamEventReasoningDelta indicates incremental reasoning output from assistant. StreamEventReasoningDelta StreamEventType = "reasoning.delta" // StreamEventMessageCompleted indicates the final assistant message is generated. StreamEventMessageCompleted StreamEventType = "message.completed" // StreamEventToolCallStarted indicates a tool call has started. StreamEventToolCallStarted StreamEventType = "tool_call.started" // StreamEventToolCallFinished indicates a tool call has finished. StreamEventToolCallFinished StreamEventType = "tool_call.finished" // StreamEventTodoSnapshot indicates the full runtime todo list is available. StreamEventTodoSnapshot StreamEventType = "todo.snapshot" // StreamEventTodoUpdated indicates the runtime todo list changed. StreamEventTodoUpdated StreamEventType = "todo.updated" // StreamEventArtifactDeclared indicates a generated artifact was declared. StreamEventArtifactDeclared StreamEventType = "artifact.declared" // StreamEventApprovalRequested indicates the engine needs user approval for a tool call. StreamEventApprovalRequested StreamEventType = "approval.requested" // StreamEventApprovalResolved indicates an approval request has been resolved. StreamEventApprovalResolved StreamEventType = "approval.resolved" )
type StreamPayload ¶
type StreamPayload struct {
MessageID string `json:"message_id,omitempty"`
Role MessageRole `json:"role,omitempty"`
Content string `json:"content,omitempty"`
Usage *events.UsagePayload `json:"usage,omitempty"`
ToolCall *events.ToolCallPayload `json:"tool_call,omitempty"`
ToolResult *events.ToolCallResultPayload `json:"tool_result,omitempty"`
Todos []events.RuntimeTodoItem `json:"todos,omitempty"`
Artifact *events.ArtifactPayload `json:"artifact,omitempty"`
ApprovalRequest *events.ApprovalRequestPayload `json:"approval_request,omitempty"`
ApprovalDecision *events.ApprovalDecisionPayload `json:"approval_decision,omitempty"`
}
StreamPayload carries the specific content of streaming events.
type TaskInput ¶
type TaskInput struct {
Type InputType `json:"type"`
Messages []ChatMessage `json:"messages,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
TaskInput is the standardized task input consumed by Worker Runtime.
type TaskPolicy ¶
type TaskPolicy struct {
RequireApproval bool `json:"require_approval,omitempty"`
PermissionMode string `json:"permission_mode,omitempty"` // "bypass" | "on-request" | "auto"; empty defaults to bypass
}
TaskPolicy carries the policy switches that Worker tasks must follow.
type TaskType ¶
type TaskType string
TaskType represents the type of task requested for Worker execution.
const ( // TaskTypeAgentRun requests the Worker to execute an Agent run. TaskTypeAgentRun TaskType = "agent.run" )
type TraceContext ¶
type TraceContext struct {
TraceID string `json:"trace_id"`
RequestID string `json:"request_id,omitempty"`
TaskID string `json:"task_id,omitempty"`
RunID string `json:"run_id,omitempty"`
ParentID string `json:"parent_id,omitempty"`
}
TraceContext carries distributed tracing identifiers across UI, Server, Worker, and Runtime.
type WorkerTaskBody ¶
type WorkerTaskBody struct {
TaskType TaskType `json:"task_type"`
Actor ActorContext `json:"actor"`
Execution ExecutionTarget `json:"execution"`
Workspace WorkspaceOptions `json:"workspace,omitempty"`
Input TaskInput `json:"input"`
Model ModelOptions `json:"model,omitempty"`
Runtime RuntimeOptions `json:"runtime,omitempty"`
Policy TaskPolicy `json:"policy,omitempty"`
}
WorkerTaskBody is the payload of task messages from Server to Worker.
type WorkerTaskMessage ¶
type WorkerTaskMessage = Envelope[WorkerTaskBody]
WorkerTaskMessage is the task message protocol from Server to Worker.
type WorkspaceOptions ¶
type WorkspaceOptions struct {
ProjectID string `json:"project_id,omitempty"`
TaskID string `json:"task_id,omitempty"`
}
WorkspaceOptions identifies the isolated project workspace for a task run.