model

package
v0.99.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package model provides shared data types for UI views and transport.

Package model provides shared data types for UI views and transport.

Package model provides shared data types for UI views and transport.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentChatAttachment added in v0.98.2

type AgentChatAttachment struct {
	FileID   string `json:"file_id"`
	MIMEType string `json:"mime_type,omitempty"`
	Kind     string `json:"kind,omitempty"`
	// URL is a same-origin preview/download path for the web UI when available.
	URL string `json:"url,omitempty"`
}

AgentChatAttachment is a multimodal attachment shown in chat history.

type AgentChatMessage added in v0.95.0

type AgentChatMessage struct {
	Role               string                `json:"role"`
	Kind               string                `json:"kind"`
	Text               string                `json:"text"`
	HTML               string                `json:"html"`
	Attachments        []AgentChatAttachment `json:"attachments,omitempty"`
	ToolName           string                `json:"tool_name"`
	ToolStatus         string                `json:"tool_status"`
	ToolStdout         string                `json:"tool_stdout"`
	ToolStderr         string                `json:"tool_stderr"`
	DurationMs         int64                 `json:"duration_ms,omitempty"`
	TurnDurationMs     int64                 `json:"turn_duration_ms,omitempty"`
	ThinkingDurationMs int64                 `json:"thinking_duration_ms,omitempty"`
	RunDurationMs      int64                 `json:"run_duration_ms,omitempty"`
	CreatedAt          time.Time             `json:"created_at"`
}

AgentChatMessage is one user or assistant turn for chat UI display.

type AgentKnowledge added in v0.98.1

type AgentKnowledge struct {
	ID        int64     `json:"id"`
	Path      string    `json:"path"`
	Title     string    `json:"title"`
	Tags      []string  `json:"tags"`
	Summary   string    `json:"summary"`
	Content   string    `json:"content"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

AgentKnowledge represents one knowledge-base markdown document for UI and transport.

type AgentMemoryFact added in v0.98.1

type AgentMemoryFact struct {
	ID        int64     `json:"id"`
	Scope     string    `json:"scope"`
	Key       string    `json:"key"`
	Value     string    `json:"value"`
	Pinned    bool      `json:"pinned"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

AgentMemoryFact is one keyed fact in a memory scope for UI and transport.

type AgentPlan added in v0.94.0

type AgentPlan struct {
	PlanID    string    `json:"plan_id"`
	URI       string    `json:"uri"`
	Title     string    `json:"title"`
	CreatedAt time.Time `json:"created_at"`
}

AgentPlan represents a persisted plan document for UI display.

type AgentScheduledTask added in v0.95.0

type AgentScheduledTask struct {
	TaskID          string     `json:"task_id"`
	Name            string     `json:"name"`
	ScheduleKind    string     `json:"schedule_kind"`
	Cron            string     `json:"cron"`
	RunAt           *time.Time `json:"run_at"`
	Prompt          string     `json:"prompt"`
	State           string     `json:"state"`
	SourceSessionID string     `json:"source_session_id"`
	LastRunAt       *time.Time `json:"last_run_at"`
	NextRunAt       *time.Time `json:"next_run_at"`
	CreatedAt       time.Time  `json:"created_at"`
	UpdatedAt       time.Time  `json:"updated_at"`
}

AgentScheduledTask represents one scheduled task for UI display and transport.

type AgentScheduledTaskRun added in v0.95.0

type AgentScheduledTaskRun struct {
	RunID        string     `json:"run_id"`
	TaskID       string     `json:"task_id"`
	RunSessionID string     `json:"run_session_id"`
	State        string     `json:"state"`
	Reply        string     `json:"reply"`
	Error        string     `json:"error"`
	StartedAt    time.Time  `json:"started_at"`
	FinishedAt   *time.Time `json:"finished_at"`
}

AgentScheduledTaskRun represents one scheduled task execution for UI display.

type AgentSession added in v0.93.0

type AgentSession struct {
	Flag   string `json:"flag"`
	Title  string `json:"title"`
	UID    string `json:"uid"`
	LeafID string `json:"leaf_id"`
	State  string `json:"state"`
	// Model holds the session-level chat model override (empty = global default).
	Model string `json:"model,omitempty"`
	// ThinkingLevel holds the session-level reasoning intensity (empty = default).
	ThinkingLevel string `json:"thinking_level,omitempty"`
	// ApprovalMode holds the session-level approval mode (manual|auto|off; empty = user default).
	ApprovalMode string `json:"approval_mode,omitempty"`
	// Preview is a short last-message snippet for session list rows.
	Preview string `json:"preview,omitempty"`
	// Pinned reports whether the session is pinned to the top of the list.
	Pinned bool `json:"pinned,omitempty"`
	// Archived reports whether the session is hidden from the default list.
	Archived bool `json:"archived,omitempty"`
	// Activity is a runtime list status: "running", "needs_approval", or empty.
	Activity        string            `json:"activity,omitempty"`
	TotalDurationMs int64             `json:"total_duration_ms,omitempty"`
	TodoSummary     *AgentTodoSummary `json:"todo_summary,omitempty"`
	CreatedAt       time.Time         `json:"created_at"`
	UpdatedAt       time.Time         `json:"updated_at"`
}

AgentSession represents a chat agent session for UI display and transport.

type AgentSessionDayGroup added in v0.98.1

type AgentSessionDayGroup struct {
	Label string         `json:"label"`
	Key   string         `json:"key"`
	Items []AgentSession `json:"items"`
}

AgentSessionDayGroup is one calendar-day bucket for the agents session list.

type AgentSessionEntry added in v0.93.0

type AgentSessionEntry struct {
	Flag        string    `json:"flag"`
	SessionID   string    `json:"session_id"`
	ParentID    string    `json:"parent_id"`
	EntryType   string    `json:"entry_type"`
	PayloadJSON string    `json:"payload_json"`
	CreatedAt   time.Time `json:"created_at"`
}

AgentSessionEntry represents one append-only node in a chat session tree for UI display.

type AgentSessionSummary added in v0.98.1

type AgentSessionSummary struct {
	ID          int64      `json:"id"`
	SessionFlag string     `json:"session_flag"`
	Scope       string     `json:"scope"`
	Title       string     `json:"title"`
	Summary     string     `json:"summary"`
	Status      string     `json:"status"`
	Error       string     `json:"error,omitempty"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
	ClaimedAt   *time.Time `json:"claimed_at,omitempty"`
}

AgentSessionSummary is a searchable summary derived from an archived chat session.

type AgentSkill added in v0.93.0

type AgentSkill struct {
	Flag                   string           `json:"flag"`
	Name                   string           `json:"name"`
	Description            string           `json:"description"`
	Content                string           `json:"content"`
	BaseDir                string           `json:"base_dir"`
	Source                 string           `json:"source"`
	Enabled                bool             `json:"enabled"`
	DisableModelInvocation bool             `json:"disable_model_invocation"`
	Files                  []AgentSkillFile `json:"files,omitempty"`
	CreatedAt              time.Time        `json:"created_at"`
	UpdatedAt              time.Time        `json:"updated_at"`
}

AgentSkill represents an agent skill definition for UI display and transport.

type AgentSkillFile added in v0.94.0

type AgentSkillFile struct {
	SkillFlag string    `json:"skill_flag"`
	Path      string    `json:"path"`
	Content   string    `json:"content"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

AgentSkillFile represents one auxiliary file in an agent skill directory.

type AgentSubagent added in v0.93.0

type AgentSubagent struct {
	Flag         string    `json:"flag"`
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	SystemPrompt string    `json:"system_prompt"`
	Tools        []string  `json:"tools"`
	Skills       []string  `json:"skills"`
	Model        string    `json:"model"`
	Source       string    `json:"source"`
	Enabled      bool      `json:"enabled"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

AgentSubagent represents a chat assistant subagent definition for UI display and transport.

type AgentSubagentFormParams added in v0.94.0

type AgentSubagentFormParams struct {
	Item            AgentSubagent              `json:"item"`
	IsNew           bool                       `json:"is_new"`
	Errors          map[string]string          `json:"errors,omitempty"`
	AvailableTools  []string                   `json:"available_tools"`
	AvailableSkills []AgentSubagentSkillOption `json:"available_skills"`
}

AgentSubagentFormParams carries data for rendering the subagent create/edit form.

type AgentSubagentSkillOption added in v0.94.0

type AgentSubagentSkillOption struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

AgentSubagentSkillOption is one selectable skill in the subagent form.

type AgentSubagentTask added in v0.94.0

type AgentSubagentTask struct {
	ID           int64      `json:"id"`
	SessionID    string     `json:"session_id"`
	SubagentName string     `json:"subagent_name"`
	Description  string     `json:"description"`
	Prompt       string     `json:"prompt"`
	Status       string     `json:"status"`
	Result       string     `json:"result"`
	ErrorText    string     `json:"error_text"`
	Depth        int        `json:"depth"`
	StartedAt    time.Time  `json:"started_at"`
	FinishedAt   *time.Time `json:"finished_at,omitempty"`
	CreatedAt    time.Time  `json:"created_at"`
	UpdatedAt    time.Time  `json:"updated_at"`
}

AgentSubagentTask represents one delegated subagent task for UI display and transport.

type AgentTodo added in v0.98.0

type AgentTodo struct {
	ItemID    string `json:"item_id"`
	Content   string `json:"content"`
	Status    string `json:"status"`
	SortOrder int    `json:"sort_order"`
}

AgentTodo represents one session checklist item for UI display.

type AgentTodoSummary added in v0.98.0

type AgentTodoSummary struct {
	Total      int    `json:"total"`
	Done       int    `json:"done"`
	Active     int    `json:"active"`
	InProgress string `json:"in_progress,omitempty"`
}

AgentTodoSummary is aggregate checklist progress for session list display.

type ConfigItem

type ConfigItem struct {
	ID        int64     `json:"id"`
	UID       string    `json:"uid"`
	Topic     string    `json:"topic"`
	Key       string    `json:"key"`
	Value     types.KV  `json:"value"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

ConfigItem represents a row from the configs database table.

type DataEvent added in v0.99.0

type DataEvent struct {
	EventID    string         `json:"event_id"`
	EventType  string         `json:"event_type"`
	Source     string         `json:"source"`
	Capability string         `json:"capability,omitempty"`
	EntityID   string         `json:"entity_id,omitempty"`
	CreatedAt  time.Time      `json:"created_at"`
	Data       map[string]any `json:"data,omitempty"`
}

DataEvent is a durable business event row for UI tables.

type FunctionDefinition added in v0.99.0

type FunctionDefinition struct {
	ID                  int64     `json:"id"`
	Name                string    `json:"name"`
	Status              string    `json:"status"`
	Version             int       `json:"version,omitempty"`
	CreatedBy           string    `json:"created_by,omitempty"`
	MetadataDraft       string    `json:"metadata_draft,omitempty"`
	EntrypointDraft     string    `json:"entrypoint_draft,omitempty"`
	SourceDraft         string    `json:"source_draft,omitempty"`
	MetadataPublished   *string   `json:"metadata_published,omitempty"`
	EntrypointPublished *string   `json:"entrypoint_published,omitempty"`
	SourcePublished     *string   `json:"source_published,omitempty"`
	CreatedAt           time.Time `json:"created_at"`
	UpdatedAt           time.Time `json:"updated_at"`
}

FunctionDefinition is a named function definition row for catalog and UI use.

type FunctionDefinitionVersion added in v0.99.0

type FunctionDefinitionVersion struct {
	ID           int64     `json:"id"`
	FunctionName string    `json:"function_name"`
	Version      int       `json:"version"`
	Metadata     string    `json:"metadata"`
	Entrypoint   string    `json:"entrypoint"`
	Source       string    `json:"source"`
	CreatedAt    time.Time `json:"created_at"`
}

FunctionDefinitionVersion is an immutable published snapshot of a named function.

type FunctionRun added in v0.99.0

type FunctionRun struct {
	ID             int64     `json:"id"`
	FunctionName   string    `json:"function_name"`
	Version        int       `json:"version"`
	Status         string    `json:"status"`
	DurationMs     int64     `json:"duration_ms,omitempty"`
	ExitCode       *int      `json:"exit_code,omitempty"`
	Error          string    `json:"error,omitempty"`
	ResultJSON     *string   `json:"result_json,omitempty"`
	IdempotencyKey *string   `json:"idempotency_key,omitempty"`
	CreatedAt      time.Time `json:"created_at"`
}

FunctionRun is one invocation of a named function for audit and idempotent replay.

type NotificationRecord added in v0.99.0

type NotificationRecord struct {
	ID              int64          `json:"id"`
	UID             string         `json:"uid,omitempty"`
	Channel         string         `json:"channel"`
	RuleID          string         `json:"rule_id,omitempty"`
	TemplateID      string         `json:"template_id,omitempty"`
	Summary         string         `json:"summary,omitempty"`
	Status          string         `json:"status"`
	ErrorMsg        string         `json:"error_msg,omitempty"`
	PayloadSnapshot map[string]any `json:"payload_snapshot,omitempty"`
	CorrelationID   string         `json:"correlation_id,omitempty"`
	EscalateAt      *time.Time     `json:"escalate_at,omitempty"`
	ReadAt          *time.Time     `json:"read_at,omitempty"`
	CreatedAt       time.Time      `json:"created_at"`
}

NotificationRecord is a notification delivery history row for UI and gateway use.

type NotifyChannel

type NotifyChannel struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	Protocol  string    `json:"protocol"`
	URI       string    `json:"uri"` // masked for display
	Enabled   bool      `json:"enabled"`
	IsDefault bool      `json:"is_default"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

NotifyChannel represents a configured notification channel for UI display. The URI is masked for display; raw URI is never exposed to the client.

type NotifyRule

type NotifyRule struct {
	ID             int64     `json:"id"`
	RuleID         string    `json:"rule_id"`
	Name           string    `json:"name"`
	Action         string    `json:"action"`
	EventPattern   string    `json:"event_pattern"`
	ChannelPattern string    `json:"channel_pattern"`
	Condition      string    `json:"condition"`
	Priority       int       `json:"priority"`
	ParamsJSON     string    `json:"params_json"` // JSON string for form display
	Enabled        bool      `json:"enabled"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

NotifyRule represents a notification routing rule for UI display.

type NotifyTemplate added in v0.97.0

type NotifyTemplate struct {
	ID              int64     `json:"id"`
	TemplateID      string    `json:"template_id"`
	Name            string    `json:"name"`
	Description     string    `json:"description"`
	DefaultFormat   string    `json:"default_format"`
	DefaultTemplate string    `json:"default_template"`
	OverridesJSON   string    `json:"overrides_json"` // JSON array string for form display
	IsDefault       bool      `json:"is_default"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

NotifyTemplate represents a notification message template for UI display and forms.

type NotifyTemplateOverride added in v0.99.0

type NotifyTemplateOverride struct {
	Channel  string `json:"channel"`
	Format   string `json:"format"`
	Template string `json:"template"`
}

NotifyTemplateOverride is a channel-specific template body stored as JSON.

type PermissionsView added in v0.99.0

type PermissionsView struct {
	Defaults permission.Config `json:"defaults"`
	User     permission.Config `json:"user"`
}

PermissionsView is the narrow permission editor input for UI forms.

type PipelineDefinition added in v0.99.0

type PipelineDefinition struct {
	ID            int64   `json:"id"`
	Name          string  `json:"name"`
	Description   string  `json:"description,omitempty"`
	Status        string  `json:"status"`
	Version       int     `json:"version,omitempty"`
	CreatedBy     string  `json:"created_by,omitempty"`
	YamlDraft     string  `json:"yaml_draft,omitempty"`
	YamlPublished *string `json:"yaml_published,omitempty"`
}

PipelineDefinition is a pipeline definition row for UI and engine catalog use.

type PipelineRun added in v0.99.0

type PipelineRun struct {
	ID            int64      `json:"id"`
	PipelineName  string     `json:"pipeline_name,omitempty"`
	EventID       string     `json:"event_id"`
	EventType     string     `json:"event_type,omitempty"`
	TriggerSource string     `json:"trigger_source,omitempty"`
	Status        int        `json:"status"`
	Error         string     `json:"error,omitempty"`
	CreatedAt     time.Time  `json:"created_at"`
	StartedAt     time.Time  `json:"started_at"`
	CompletedAt   *time.Time `json:"completed_at,omitempty"`
}

PipelineRun is a pipeline run row for UI and engine persistence.

type PipelineRunInfo added in v0.99.0

type PipelineRunInfo struct {
	ID            int64  `json:"id"`
	PipelineName  string `json:"pipeline_name"`
	EventID       string `json:"event_id"`
	Status        string `json:"status"`
	TriggerSource string `json:"trigger_source,omitempty"`
}

PipelineRunInfo links a data event to a matching pipeline run for UI display.

type PipelineStepRun added in v0.99.0

type PipelineStepRun struct {
	ID          int64          `json:"id,omitempty"`
	StepName    string         `json:"step_name"`
	Capability  string         `json:"capability,omitempty"`
	Operation   string         `json:"operation,omitempty"`
	Status      int            `json:"status"`
	Attempt     int            `json:"attempt,omitempty"`
	StartedAt   time.Time      `json:"started_at"`
	CompletedAt *time.Time     `json:"completed_at,omitempty"`
	Error       string         `json:"error,omitempty"`
	Params      map[string]any `json:"params,omitempty"`
	Result      map[string]any `json:"result,omitempty"`
}

PipelineStepRun is a pipeline step run row for UI and engine persistence.

type ResourceLink struct {
	SourceEventID    string `json:"source_event_id"`
	TargetEventID    string `json:"target_event_id"`
	SourceApp        string `json:"source_app,omitempty"`
	TargetApp        string `json:"target_app,omitempty"`
	SourceCapability string `json:"source_capability,omitempty"`
	TargetCapability string `json:"target_capability,omitempty"`
	SourceEntityID   string `json:"source_entity_id,omitempty"`
	TargetEntityID   string `json:"target_entity_id,omitempty"`
	PipelineRunID    int64  `json:"pipeline_run_id,omitempty"`
	PipelineName     string `json:"pipeline_name,omitempty"`
}

ResourceLink records a capability resource edge created during a pipeline step.

type TokenItem

type TokenItem struct {
	Token      string     `json:"token"`
	UID        types.Uid  `json:"uid"`
	Scopes     []string   `json:"scopes"`
	CreatedAt  time.Time  `json:"created_at"`
	LastUsedAt *time.Time `json:"last_used_at,omitempty"`
	ExpiredAt  time.Time  `json:"expired_at"`
}

TokenItem represents a token row displayed in the token management UI.

type Workflow added in v0.99.0

type Workflow struct {
	ID             int64            `json:"id"`
	Name           string           `json:"name"`
	Describe       string           `json:"describe,omitempty"`
	Enabled        bool             `json:"enabled"`
	Resumable      bool             `json:"resumable,omitempty"`
	MaxConcurrency int              `json:"max_concurrency,omitempty"`
	Pipeline       []string         `json:"pipeline,omitempty"`
	Inputs         []map[string]any `json:"inputs,omitempty"`
}

Workflow is a workflow definition row for UI and catalog use.

type WorkflowRun added in v0.99.0

type WorkflowRun struct {
	ID           int64      `json:"id"`
	WorkflowID   *int64     `json:"workflow_id,omitempty"`
	WorkflowName string     `json:"workflow_name,omitempty"`
	Status       int        `json:"status"`
	TriggerType  string     `json:"trigger_type,omitempty"`
	StartedAt    time.Time  `json:"started_at"`
	CreatedAt    time.Time  `json:"created_at"`
	CompletedAt  *time.Time `json:"completed_at,omitempty"`
	Error        string     `json:"error,omitempty"`
}

WorkflowRun is a workflow run row for UI and engine persistence.

type WorkflowStepRun added in v0.99.0

type WorkflowStepRun struct {
	ID          int64          `json:"id,omitempty"`
	StepID      string         `json:"step_id"`
	StepName    string         `json:"step_name"`
	Action      string         `json:"action,omitempty"`
	ActionType  string         `json:"action_type,omitempty"`
	Attempt     int            `json:"attempt,omitempty"`
	Status      int            `json:"status"`
	StartedAt   time.Time      `json:"started_at"`
	CompletedAt *time.Time     `json:"completed_at,omitempty"`
	Error       string         `json:"error,omitempty"`
	Params      map[string]any `json:"params,omitempty"`
	Result      map[string]any `json:"result,omitempty"`
}

WorkflowStepRun is a workflow step run row for UI and engine persistence.

type WorkflowTaskRow added in v0.99.0

type WorkflowTaskRow struct {
	TaskID   string         `json:"task_id"`
	Action   string         `json:"action"`
	Describe string         `json:"describe,omitempty"`
	Params   map[string]any `json:"params,omitempty"`
	Vars     []string       `json:"vars,omitempty"`
	Conn     []string       `json:"conn,omitempty"`
	Retry    map[string]any `json:"retry,omitempty"`
}

WorkflowTaskRow is a normalized workflow task row used to rebuild metadata.

type WorkflowTrigger added in v0.99.0

type WorkflowTrigger struct {
	ID         int64          `json:"id"`
	WorkflowID int64          `json:"workflow_id"`
	Type       string         `json:"type"`
	Enabled    bool           `json:"enabled"`
	Rule       map[string]any `json:"rule,omitempty"`
}

WorkflowTrigger is a workflow trigger row for UI and metadata rebuild.

Jump to

Keyboard shortcuts

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