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 SkillDetailData
- type SkillInstallBody
- type SkillInstallMessage
- type SkillListItem
- type SkillManagementBody
- type SkillManagementMessage
- type SkillManagementResponse
- 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 {
ID string `json:"id,omitempty"`
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" // MessageTypeSkillInstall represents skill installation requests from Server to Worker. // Deprecated: use MessageTypeSkillManagement instead. MessageTypeSkillInstall MessageType = "skill.install" // MessageTypeSkillManagement represents unified skill management requests from Server to Worker. MessageTypeSkillManagement MessageType = "skill.management" )
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 SkillDetailData ¶ added in v0.1.10
type SkillDetailData struct {
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
Source string `json:"source"`
Trust string `json:"trust"`
Version string `json:"version"`
SkillMD string `json:"skill_md"`
Tags []string `json:"tags"`
Files []string `json:"files"`
}
SkillDetailData represents the full detail of an installed skill, including the SKILL.md body content, returned by the worker for the "detail" action.
type SkillInstallBody ¶ added in v0.1.1
type SkillInstallBody struct {
Source string `json:"source"` // "Leros" | "github" | "skills-sh" | "url"
SkillID string `json:"skill_id"` // the CLI install <identifier> argument
}
SkillInstallBody carries the source hint and skill identifier for installation. Deprecated: use SkillManagementBody instead.
type SkillInstallMessage ¶ added in v0.1.1
type SkillInstallMessage = Envelope[SkillInstallBody]
SkillInstallMessage is the message protocol from Server to Worker for skill installation. Deprecated: use SkillManagementMessage with Action="install" instead.
type SkillListItem ¶ added in v0.1.10
type SkillListItem struct {
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
Source string `json:"source"`
Trust string `json:"trust"`
}
SkillListItem represents an installed skill in the list response.
type SkillManagementBody ¶ added in v0.1.10
type SkillManagementBody struct {
Action string `json:"action"` // "install" | "list" | "uninstall" | "detail" | "import"
Source string `json:"source,omitempty"` // for install: "Leros" | "github" | "skills-sh" | "url"
SkillID string `json:"skill_id,omitempty"` // for install: the CLI install <identifier> argument
Version string `json:"version,omitempty"` // optional version for install
Name string `json:"name,omitempty"` // for uninstall / detail: the skill name
// DownloadURL is the URL (or local path) from which the worker downloads
// the skill file during an "import" action.
DownloadURL string `json:"download_url,omitempty"`
// ReplyTo is the NATS inbox for sending the response back to the server.
// JetStream does not preserve the NATS Reply header, so the inbox is
// injected into the body by the server-side Request method.
ReplyTo string `json:"reply_to,omitempty"`
}
SkillManagementBody carries the action and parameters for skill management.
type SkillManagementMessage ¶ added in v0.1.10
type SkillManagementMessage = Envelope[SkillManagementBody]
SkillManagementMessage is the unified skill management message from Server to Worker.
type SkillManagementResponse ¶ added in v0.1.10
type SkillManagementResponse struct {
Success bool `json:"success"`
Action string `json:"action"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
Data json.RawMessage `json:"data,omitempty"` // for list action: []SkillListItem
}
SkillManagementResponse is the response returned by the worker for skill management requests.
type StreamBody ¶
type StreamBody struct {
Seq int64 `json:"seq"`
Event StreamEventType `json:"event"`
Payload StreamPayload `json:"payload"`
ReplyToMessageIDs []string `json:"reply_to_message_ids,omitempty"`
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.