Documentation
¶
Index ¶
- Constants
- Variables
- func BuildAgentAccountSessionKey(agentID string, channel string, chatType string, accountID string, ref string, ...) string
- func BuildAgentSessionKey(agentID string, channel string, chatType string, ref string, threadID string) string
- func BuildRoomAgentSessionKey(conversationID string, agentID string, roomType string) string
- func BuildRoomSharedSessionKey(conversationID string) string
- func GetSessionKeyValidationError(raw string) string
- func GoalMetadataBool(metadata map[string]any, key string) bool
- func GoalMetadataString(metadata map[string]any, key string) string
- func GoalRoomCollaborationObserved(goal Goal) bool
- func GoalRoomCollaborationRequired(goal Goal) bool
- func GoalRoomLeadAgentID(goal Goal) string
- func GoalRoomLeadAgentName(goal Goal) string
- func HasChatInput(content string, attachments []ChatAttachment) bool
- func IsCurrentGoalStatus(status GoalStatus) bool
- func IsRoomSharedSessionKey(raw string) bool
- func IsRuntimeAccountingGoalStatus(status GoalStatus) bool
- func IsRuntimeGoalStatus(status GoalStatus) bool
- func IsStructuredSessionKey(raw string) bool
- func IsTranscriptNativeMessage(message Message) bool
- func MessageRole(message Message) string
- func MessageRoundID(message Message) string
- func NormalizeExecutionKind(kind string) string
- func NormalizeOverlapPolicy(policy string) string
- func NormalizeSessionChatType(chatType string) string
- func NormalizeSessionKeyChannelSegment(channel string) string
- func NormalizeStoredChannelType(channel string) string
- func ParseRoomConversationID(raw string) string
- func RequireStructuredSessionKey(raw string) (string, error)
- func ShouldGuideRunningRound(policy ChatDeliveryPolicy) bool
- func ShouldQueueRunningRound(policy ChatDeliveryPolicy) bool
- func TypeScriptDefinitions() string
- type AddRoomMemberRequest
- type Agent
- type AgentPrivateEvent
- type AgentPrivateEventPage
- type AgentPrivateParticipant
- type AgentPrivateThread
- type AgentPrivateThreadPage
- type BlockGoalRequest
- type ChatAttachment
- func ChatAttachmentFromMap(value map[string]any) ChatAttachment
- func ChatAttachmentsFromAny(value any) []ChatAttachment
- func NormalizeChatAttachment(value ChatAttachment, defaultAgentID string) ChatAttachment
- func NormalizeChatAttachments(values []ChatAttachment, defaultAgentID string) []ChatAttachment
- type ChatAttachmentKind
- type ChatAttachmentScope
- type ChatDeliveryPolicy
- type CompleteGoalRequest
- type ConversationContextAggregate
- type ConversationRecord
- type CreateConversationRequest
- type CreateGoalRequest
- type CreateJobInput
- type CreateRequest
- type CreateRoomDirectedMessageRequest
- type CreateRoomPublicMessageRequest
- type CreateRoomRequest
- type CronDailyReport
- type CronDailyReportInput
- type CronDailyReportTask
- type CronDailyReportTotals
- type CronJob
- type CronRun
- type CronTaskEvent
- type CronTaskHealth
- type CronTaskHistoryItem
- type CronTaskHistorySearchInput
- type CronTaskStatus
- type DeleteJobResult
- type DeliveryTarget
- type EventMessage
- func GoalEventEnvelope(sessionKey string, eventType EventType, goal Goal, payload map[string]any) EventMessage
- func NewChatAckEvent(sessionKey string, reqID string, roundID string, pending []map[string]any) EventMessage
- func NewErrorEvent(sessionKey string, message string) EventMessage
- func NewEvent(eventType EventType, data map[string]any) EventMessage
- func NewInputQueueEvent(sessionKey string, items []InputQueueItem) EventMessage
- func NewPermissionRequestResolvedEvent(sessionKey string, requestID string, status string) EventMessage
- func NewPongEvent(sessionKey string) EventMessage
- func NewRoundStatusEvent(sessionKey string, roundID string, status string, resultSubtype string) EventMessage
- type EventType
- type ExecutionResult
- type Goal
- type GoalContinuation
- type GoalEvent
- type GoalStatus
- type GoalUpdateSource
- type GoalUsage
- type HeartbeatConfig
- type HeartbeatStatus
- type HeartbeatUpdateInput
- type HeartbeatWakeRequest
- type HeartbeatWakeResult
- type InboundWebSocketMessage
- type InputQueueItem
- type InputQueueScope
- type InputQueueSource
- type MemberRecord
- type Message
- type MessagePage
- type OptionalInt64
- type Options
- type RoomAggregate
- type RoomDirectedMessageRecord
- type RoomRecord
- type RoomReplyRoute
- type RoomReplyRouteMode
- type RoomWakePolicy
- type RoundStatusData
- type Schedule
- type Session
- type SessionKey
- type SessionKeyKind
- type SessionRecord
- type SessionRoundIndex
- type SessionRoundIndexItem
- type SessionStatusData
- type SessionTarget
- type Source
- type StructuredSessionKeyError
- type SystemEvent
- type UpdateConversationRequest
- type UpdateGoalRequest
- type UpdateJobInput
- type UpdateRequest
- type UpdateRoomRequest
- type ValidateNameResponse
- type WorkspaceFileArtifactBlock
Constants ¶
const ( // OptionRuntimeKind 表示创建/续用 SDK session 时使用的 runtime 类型。 OptionRuntimeKind = "runtime_kind" // OptionRuntimeProvider 表示创建/续用 SDK session 时使用的 provider key。 OptionRuntimeProvider = "runtime_provider" // OptionRuntimeModel 表示创建/续用 SDK session 时使用的模型。 OptionRuntimeModel = "runtime_model" )
const ( // ScheduleKindEvery 表示固定间隔调度。 ScheduleKindEvery = "every" // ScheduleKindCron 表示 cron 表达式调度。 ScheduleKindCron = "cron" // ScheduleKindAt 表示单次定时。 ScheduleKindAt = "at" // SessionTargetIsolated 表示每次运行都创建新会话。 SessionTargetIsolated = "isolated" // SessionTargetMain 表示写入主自动化会话。 SessionTargetMain = "main" // SessionTargetBound 表示绑定到现有结构化会话。 SessionTargetBound = "bound" // SessionTargetNamed 表示绑定到命名自动化会话。 SessionTargetNamed = "named" // WakeModeNow 表示立即唤醒。 WakeModeNow = "now" // WakeModeNextHeartbeat 表示在下一次 heartbeat 时消费。 WakeModeNextHeartbeat = "next-heartbeat" // DeliveryModeNone 表示不做外部投递。 DeliveryModeNone = "none" // DeliveryModeLast 表示投递到最近通道。 DeliveryModeLast = "last" // DeliveryModeExplicit 表示投递到显式目标。 DeliveryModeExplicit = "explicit" // DeliveryStatusNotRequired 表示该 run 不需要额外投递。 DeliveryStatusNotRequired = "not_required" // DeliveryStatusSkipped 表示无需重复投递或没有可投递内容。 DeliveryStatusSkipped = "skipped" // DeliveryStatusSucceeded 表示投递成功。 DeliveryStatusSucceeded = "succeeded" // DeliveryStatusFailed 表示投递失败。 DeliveryStatusFailed = "failed" // DeliveryStatusNotAttempted 表示 run 在投递前失败或被取消。 DeliveryStatusNotAttempted = "not_attempted" // DeliveryStatusPending 表示 run 尚未结束,投递状态未定。 DeliveryStatusPending = "pending" // SourceKindUserPage 表示来自页面创建。 SourceKindUserPage = "user_page" // SourceKindAgent 表示来自 Agent 创建。 SourceKindAgent = "agent" // SourceKindCLI 表示来自 CLI 创建。 SourceKindCLI = "cli" // SourceKindSystem 表示来自系统创建。 SourceKindSystem = "system" // RunStatusPending 表示已登记但未开始执行。 RunStatusPending = "pending" // RunStatusRunning 表示执行中。 RunStatusRunning = "running" // RunStatusSucceeded 表示执行成功。 RunStatusSucceeded = "succeeded" // RunStatusFailed 表示执行失败。 RunStatusFailed = "failed" // RunStatusCancelled 表示执行取消。 RunStatusCancelled = "cancelled" // RunStatusQueuedToMain 表示已排入主会话队列。 RunStatusQueuedToMain = "queued_to_main_session" // RunStatusSkipped 表示因重叠策略跳过本次触发。 RunStatusSkipped = "skipped" // OverlapPolicySkip 表示已有执行时跳过新触发。 OverlapPolicySkip = "skip" // OverlapPolicyAllow 表示允许同一任务并发执行。 OverlapPolicyAllow = "allow" // ExecutionKindAgent 表示由 Agent 会话执行任务。 ExecutionKindAgent = "agent" // ExecutionKindScript 表示直接在 workspace 中执行脚本任务。 ExecutionKindScript = "script" // TaskEventActionCreate 表示创建定时任务。 TaskEventActionCreate = "create" // TaskEventActionUpdate 表示修改定时任务。 TaskEventActionUpdate = "update" // TaskEventActionEnable 表示启用定时任务。 TaskEventActionEnable = "enable" // TaskEventActionDisable 表示停用定时任务。 TaskEventActionDisable = "disable" // TaskEventActionDelete 表示删除定时任务。 TaskEventActionDelete = "delete" // TaskEventActionRunNow 表示手动立即运行。 TaskEventActionRunNow = "run_now" // TaskEventActionRecover 表示手动恢复卡住运行。 TaskEventActionRecover = "recover" // TaskEventActionRetryDelivery 表示手动重试投递。 TaskEventActionRetryDelivery = "retry_delivery" // TaskEventActionAutoRetryDelivery 表示系统自动重试投递。 TaskEventActionAutoRetryDelivery = "auto_retry_delivery" // HeartbeatTargetNone 表示不投递。 HeartbeatTargetNone = "none" // HeartbeatTargetLast 表示投递到最近通道。 HeartbeatTargetLast = "last" // HeartbeatTargetExplicit 表示投递到显式目标。 HeartbeatTargetExplicit = "explicit" )
const ( ChatAttachmentKindText ChatAttachmentKind = "text" ChatAttachmentKindImage ChatAttachmentKind = "image" ChatAttachmentKindFile ChatAttachmentKind = "file" ChatAttachmentScopeAgentWorkspace ChatAttachmentScope = "agent_workspace" ChatAttachmentScopeRoomConversation ChatAttachmentScope = "room_conversation" )
const ( GoalMetadataRoomGoalScope = "room_goal_scope" GoalMetadataRoomGoalLeadAgentID = "room_goal_lead_agent_id" GoalMetadataRoomGoalLeadAgentName = "room_goal_lead_agent_name" GoalMetadataRoomGoalLoopSlug = "room_goal_loop_slug" GoalMetadataRoomGoalLoopTitle = "room_goal_loop_title" GoalMetadataRoomGoalCollaborationRequired = "room_goal_collaboration_required" GoalMetadataRoomGoalCollaborationObserved = "room_goal_collaboration_observed" GoalMetadataRoomGoalCollaborationAgentID = "room_goal_collaboration_agent_id" GoalMetadataRoomGoalCollaborationRoundID = "room_goal_collaboration_round_id" GoalMetadataRoomGoalCollaborationObservedAt = "room_goal_collaboration_observed_at" GoalMetadataRoomGoalCollaborationRequirementRound = "room_goal_collaboration_requirement_round_id" )
const ( // RoomTypeDM 表示单成员直聊房间。 RoomTypeDM = "dm" // RoomTypeGroup 表示多人协作房间。 RoomTypeGroup = "room" // ConversationTypeDM 表示 DM 主对话。 ConversationTypeDM = "dm" // ConversationTypeMain 表示 Room 主对话。 ConversationTypeMain = "room_main" // ConversationTypeTopic 表示 Room 话题对话。 ConversationTypeTopic = "topic" // MemberTypeUser 表示用户成员。 MemberTypeUser = "user" // MemberTypeAgent 表示 Agent 成员。 MemberTypeAgent = "agent" )
const ( // SessionChannelWebSocketSegment 表示 session_key 中的 WebSocket 通道段。 SessionChannelWebSocketSegment = "ws" // SessionChannelDiscordSegment 表示 session_key 中的 Discord 通道段。 SessionChannelDiscordSegment = "dg" // SessionChannelTelegramSegment 表示 session_key 中的 Telegram 通道段。 SessionChannelTelegramSegment = "tg" // SessionChannelDingTalkSegment 表示 session_key 中的钉钉通道段。 SessionChannelDingTalkSegment = "dt" // SessionChannelWeChatSegment 表示 session_key 中的微信通道段。 SessionChannelWeChatSegment = "wx" // SessionChannelWeixinPersonalSegment 表示个人微信 iLink 通道段。 SessionChannelWeixinPersonalSegment = "weixin-personal" // SessionChannelFeishuSegment 表示 session_key 中的飞书通道段。 SessionChannelFeishuSegment = "fs" // SessionChannelInternalSegment 表示 session_key 中的内部通道段。 SessionChannelInternalSegment = "internal" // SessionChannelWebSocket 表示持久化后的 WebSocket 通道类型。 SessionChannelWebSocket = "websocket" // SessionChannelDiscord 表示持久化后的 Discord 通道类型。 SessionChannelDiscord = "discord" // SessionChannelTelegram 表示持久化后的 Telegram 通道类型。 SessionChannelTelegram = "telegram" // SessionChannelDingTalk 表示持久化后的钉钉通道类型。 SessionChannelDingTalk = "dingtalk" // SessionChannelWeChat 表示持久化后的微信通道类型。 SessionChannelWeChat = "wechat" // SessionChannelWeixinPersonal 表示持久化后的个人微信 iLink 通道类型。 SessionChannelWeixinPersonal = "weixin-personal" // SessionChannelFeishu 表示持久化后的飞书通道类型。 SessionChannelFeishu = "feishu" // AutomationInboxSessionRef 表示定时任务投递到 Agent 时使用的固定内部会话。 AutomationInboxSessionRef = "automation-inbox" )
const ( WorkspaceFileArtifactOperationWrite = "write" WorkspaceFileArtifactOperationUpdate = "update" )
const ( WorkspaceFileArtifactKindFile = "file" WorkspaceFileArtifactKindImage = "image" WorkspaceFileArtifactKindMarkdown = "markdown" WorkspaceFileArtifactKindHTML = "html" WorkspaceFileArtifactKindMermaid = "mermaid" WorkspaceFileArtifactKindSVG = "svg" WorkspaceFileArtifactKindPDF = "pdf" )
const ChatAckTimeoutMS = 10000
ChatAckTimeoutMS 是客户端等待 chat_ack 的上限(毫秒)。 服务端不强制该窗口,但承诺在此之前回 ack; 前端据此设置本地超时,两侧同源避免漂移。
const (
// ContentBlockTypeWorkspaceFileArtifact 表示 Agent 在工作区生成或更新的文件产物。
ContentBlockTypeWorkspaceFileArtifact = "workspace_file_artifact"
)
const (
WorkspaceFileArtifactScopeAgentWorkspace = "agent_workspace"
)
Variables ¶
var ( // ErrJobNotFound 表示任务不存在。 ErrJobNotFound = errors.New("scheduled task not found") // ErrRunNotFound 表示任务运行记录不存在。 ErrRunNotFound = errors.New("scheduled task run not found") // ErrHeartbeatConfigInvalid 表示 heartbeat 配置非法。 ErrHeartbeatConfigInvalid = errors.New("heartbeat config is invalid") )
var ErrInvalidSessionKey = errors.New("invalid structured session_key")
ErrInvalidSessionKey 表示 session_key 不符合结构化协议。
Functions ¶
func BuildAgentAccountSessionKey ¶ added in v0.1.21
func BuildAgentAccountSessionKey(agentID string, channel string, chatType string, accountID string, ref string, threadID string) string
BuildAgentAccountSessionKey 构建带外部通道账号作用域的 agent key。
func BuildAgentSessionKey ¶
func BuildAgentSessionKey(agentID string, channel string, chatType string, ref string, threadID string) string
BuildAgentSessionKey 构建 agent 作用域 key。
func BuildRoomAgentSessionKey ¶
BuildRoomAgentSessionKey 构建 Room 成员侧的 agent session_key。
func BuildRoomSharedSessionKey ¶
BuildRoomSharedSessionKey 构建共享 room key。
func GetSessionKeyValidationError ¶
GetSessionKeyValidationError 返回结构化 session_key 校验错误。
func GoalMetadataBool ¶ added in v0.1.16
GoalMetadataBool 从 Goal metadata 中读取布尔值。
func GoalMetadataString ¶ added in v0.1.16
GoalMetadataString 从 Goal metadata 中读取字符串值。
func GoalRoomCollaborationObserved ¶ added in v0.1.16
GoalRoomCollaborationObserved 判断 Room Goal 是否已有非负责人可见协作证据。
func GoalRoomCollaborationRequired ¶ added in v0.1.16
GoalRoomCollaborationRequired 判断 Room Goal 是否要求非负责人可见协作。
func GoalRoomLeadAgentID ¶ added in v0.1.16
GoalRoomLeadAgentID 返回 Room Goal 的负责人 Agent。
func GoalRoomLeadAgentName ¶ added in v0.1.16
GoalRoomLeadAgentName 返回 Room Goal 的负责人展示名。
func HasChatInput ¶ added in v0.1.6
func HasChatInput(content string, attachments []ChatAttachment) bool
HasChatInput 判断一次用户输入是否包含正文或附件。
func IsCurrentGoalStatus ¶ added in v0.1.15
func IsCurrentGoalStatus(status GoalStatus) bool
IsCurrentGoalStatus 判断状态是否属于当前 Goal。
func IsRoomSharedSessionKey ¶
IsRoomSharedSessionKey 判断是否为 Room 共享消息流 key。
func IsRuntimeAccountingGoalStatus ¶ added in v0.1.15
func IsRuntimeAccountingGoalStatus(status GoalStatus) bool
IsRuntimeAccountingGoalStatus 判断状态是否应作为运行中 round 的 Goal usage 目标。
func IsRuntimeGoalStatus ¶ added in v0.1.15
func IsRuntimeGoalStatus(status GoalStatus) bool
IsRuntimeGoalStatus 判断状态是否应注入运行时上下文。
func IsStructuredSessionKey ¶
IsStructuredSessionKey 判断是否合法。
func IsTranscriptNativeMessage ¶
IsTranscriptNativeMessage 表示该 durable message 是否属于 cc transcript 原生真相。 当前只有 assistant 正文快照属于 transcript 原生消息; result / system / task_progress 等都需要由 Nexus overlay 补齐。
func NormalizeExecutionKind ¶ added in v0.1.10
NormalizeExecutionKind 返回执行体类型的默认值。
func NormalizeOverlapPolicy ¶ added in v0.1.2
NormalizeOverlapPolicy 返回重叠触发策略的默认值。
func NormalizeSessionChatType ¶
NormalizeSessionChatType 统一 chat_type 的默认值和枚举。
func NormalizeSessionKeyChannelSegment ¶
NormalizeSessionKeyChannelSegment 把外部输入统一成 session_key 使用的 channel 段。
func NormalizeStoredChannelType ¶
NormalizeStoredChannelType 把 channel 归一成持久化和运行时使用的名称。
func ParseRoomConversationID ¶
ParseRoomConversationID 读取 Room 共享流里的 conversation_id。
func RequireStructuredSessionKey ¶
RequireStructuredSessionKey 要求必须是结构化 session_key。
func ShouldGuideRunningRound ¶ added in v0.1.2
func ShouldGuideRunningRound(policy ChatDeliveryPolicy) bool
ShouldGuideRunningRound 判断运行中会话是否接收 hook 引导输入。
func ShouldQueueRunningRound ¶ added in v0.1.2
func ShouldQueueRunningRound(policy ChatDeliveryPolicy) bool
ShouldQueueRunningRound 判断运行中会话默认是否接收排队输入。
func TypeScriptDefinitions ¶
func TypeScriptDefinitions() string
TypeScriptDefinitions 返回生成前端类型定义所需内容。
Types ¶
type AddRoomMemberRequest ¶
type AddRoomMemberRequest struct {
AgentID string `json:"agent_id"`
}
AddRoomMemberRequest 表示追加成员请求。
type Agent ¶
type Agent struct {
AgentID string `json:"agent_id"`
Name string `json:"name"`
WorkspacePath string `json:"workspace_path"`
IsMain bool `json:"is_main,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Headline string `json:"headline,omitempty"`
ProfileMarkdown string `json:"profile_markdown,omitempty"`
Options Options `json:"options"`
CreatedAt time.Time `json:"created_at"`
Status string `json:"status"`
Avatar string `json:"avatar,omitempty"`
Description string `json:"description,omitempty"`
VibeTags []string `json:"vibe_tags,omitempty"`
SkillsCount int `json:"skills_count"`
OwnerUserID string `json:"-"`
}
Agent 表示对外 Agent 模型。
type AgentPrivateEvent ¶ added in v0.1.9
type AgentPrivateEvent struct {
MessageID string `json:"message_id"`
ThreadID string `json:"thread_id"`
Direction string `json:"direction"`
SourceAgentID string `json:"source_agent_id"`
Recipients []string `json:"recipients"`
Content string `json:"content,omitempty"`
ReplyRoute RoomReplyRoute `json:"reply_route"`
WakePolicy RoomWakePolicy `json:"wake_policy,omitempty"`
DelaySeconds int `json:"delay_seconds,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
RoomID string `json:"room_id,omitempty"`
RoomName string `json:"room_name,omitempty"`
RoomType string `json:"room_type,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
ConversationTitle string `json:"conversation_title,omitempty"`
Participants []AgentPrivateParticipant `json:"participants"`
Timestamp int64 `json:"timestamp"`
}
AgentPrivateEvent 表示私域线程内的一条可见 directed message。
type AgentPrivateEventPage ¶ added in v0.1.9
type AgentPrivateEventPage struct {
Thread AgentPrivateThread `json:"thread"`
Items []AgentPrivateEvent `json:"items"`
}
AgentPrivateEventPage 表示私域线程事件列表响应。
type AgentPrivateParticipant ¶ added in v0.1.9
type AgentPrivateParticipant struct {
AgentID string `json:"agent_id"`
Name string `json:"name,omitempty"`
Avatar string `json:"avatar,omitempty"`
}
AgentPrivateParticipant 表示私域投影里的 Agent 参与者摘要。
type AgentPrivateThread ¶ added in v0.1.9
type AgentPrivateThread struct {
ThreadID string `json:"thread_id"`
AgentID string `json:"agent_id"`
Scope string `json:"scope"`
ParticipantAgentIDs []string `json:"participant_agent_ids"`
PeerAgentIDs []string `json:"peer_agent_ids"`
Participants []AgentPrivateParticipant `json:"participants"`
RoomID string `json:"room_id,omitempty"`
RoomName string `json:"room_name,omitempty"`
RoomType string `json:"room_type,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
ConversationTitle string `json:"conversation_title,omitempty"`
LastMessageID string `json:"last_message_id,omitempty"`
LastContentPreview string `json:"last_content_preview,omitempty"`
LastTimestamp int64 `json:"last_timestamp,omitempty"`
MessageCount int `json:"message_count"`
}
AgentPrivateThread 表示从某个 Agent 视角聚合出来的一条私域会话线索。
type AgentPrivateThreadPage ¶ added in v0.1.9
type AgentPrivateThreadPage struct {
Items []AgentPrivateThread `json:"items"`
}
AgentPrivateThreadPage 表示私域线程列表响应。
type BlockGoalRequest ¶ added in v0.1.15
type BlockGoalRequest struct {
Reason string `json:"reason"`
NeededInput string `json:"needed_input,omitempty"`
RoundID string `json:"round_id,omitempty"`
}
BlockGoalRequest 表示阻塞 Goal 的请求。
type ChatAttachment ¶ added in v0.1.6
type ChatAttachment struct {
FileName string `json:"file_name"`
WorkspacePath string `json:"workspace_path"`
WorkspaceAgentID string `json:"workspace_agent_id,omitempty"`
RoomID string `json:"room_id,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
Scope ChatAttachmentScope `json:"scope,omitempty"`
Kind ChatAttachmentKind `json:"kind"`
MIMEType string `json:"mime_type,omitempty"`
Size int64 `json:"size,omitempty"`
}
ChatAttachment 表示一次用户输入绑定的应用层附件。
func ChatAttachmentFromMap ¶ added in v0.1.6
func ChatAttachmentFromMap(value map[string]any) ChatAttachment
ChatAttachmentFromMap 从 map payload 中解析单个附件。
func ChatAttachmentsFromAny ¶ added in v0.1.6
func ChatAttachmentsFromAny(value any) []ChatAttachment
ChatAttachmentsFromAny 从弱类型 payload 中解析附件列表。
func NormalizeChatAttachment ¶ added in v0.1.6
func NormalizeChatAttachment(value ChatAttachment, defaultAgentID string) ChatAttachment
NormalizeChatAttachment 归一化单个聊天附件。
func NormalizeChatAttachments ¶ added in v0.1.6
func NormalizeChatAttachments(values []ChatAttachment, defaultAgentID string) []ChatAttachment
NormalizeChatAttachments 归一化并过滤无效附件。
type ChatAttachmentKind ¶ added in v0.1.6
type ChatAttachmentKind string
ChatAttachmentKind 表示聊天附件的粗粒度类型。
func NormalizeChatAttachmentKind ¶ added in v0.1.6
func NormalizeChatAttachmentKind(value string) ChatAttachmentKind
NormalizeChatAttachmentKind 归一化附件类型。
type ChatAttachmentScope ¶ added in v0.1.6
type ChatAttachmentScope string
func NormalizeChatAttachmentScope ¶ added in v0.1.6
func NormalizeChatAttachmentScope(value string, conversationID string) ChatAttachmentScope
NormalizeChatAttachmentScope 归一化附件存储作用域。
type ChatDeliveryPolicy ¶ added in v0.1.2
type ChatDeliveryPolicy string
ChatDeliveryPolicy 表示新输入遇到运行中会话时的投递策略。
const ( // ChatDeliveryPolicyQueue 表示把新输入排入当前流式会话,不中断正在执行的 round。 ChatDeliveryPolicyQueue ChatDeliveryPolicy = "queue" // ChatDeliveryPolicyGuide 表示把新输入暂存在运行时,等待 PostToolUse hook 注入当前 round。 ChatDeliveryPolicyGuide ChatDeliveryPolicy = "guide" // ChatDeliveryPolicyInterrupt 表示先中断当前运行,再启动新的 round。 ChatDeliveryPolicyInterrupt ChatDeliveryPolicy = "interrupt" // ChatDeliveryPolicyAuto 预留给后续智能选择;当前等价于 queue。 ChatDeliveryPolicyAuto ChatDeliveryPolicy = "auto" )
func NormalizeChatDeliveryPolicy ¶ added in v0.1.2
func NormalizeChatDeliveryPolicy(value string) ChatDeliveryPolicy
NormalizeChatDeliveryPolicy 归一化前端传入的投递策略。
type CompleteGoalRequest ¶ added in v0.1.15
type CompleteGoalRequest struct {
Summary string `json:"summary,omitempty"`
RoundID string `json:"round_id,omitempty"`
}
CompleteGoalRequest 表示完成 Goal 的请求。
type ConversationContextAggregate ¶
type ConversationContextAggregate struct {
Room RoomRecord `json:"room"`
Members []MemberRecord `json:"members"`
MemberAgents []Agent `json:"member_agents,omitempty"`
Conversation ConversationRecord `json:"conversation"`
Sessions []SessionRecord `json:"sessions"`
}
ConversationContextAggregate 表示房间对话上下文聚合。
type ConversationRecord ¶
type ConversationRecord struct {
ID string `json:"id"`
RoomID string `json:"room_id"`
ConversationType string `json:"conversation_type"`
Title string `json:"title,omitempty"`
MessageCount int `json:"message_count"`
LastActivityAt time.Time `json:"last_activity_at,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
ConversationRecord 表示房间对话记录。
type CreateConversationRequest ¶
type CreateConversationRequest struct {
Title string `json:"title,omitempty"`
}
CreateConversationRequest 表示创建话题请求。
type CreateGoalRequest ¶ added in v0.1.15
type CreateGoalRequest struct {
SessionKey string `json:"session_key"`
Objective string `json:"objective"`
TokenBudget *int64 `json:"token_budget,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
RoundID string `json:"round_id,omitempty"`
OwnerUserID string `json:"owner_user_id,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
CreateGoalRequest 表示创建 Goal 的请求。
type CreateJobInput ¶ added in v0.1.2
type CreateJobInput struct {
Name string `json:"name"`
AgentID string `json:"agent_id"`
Schedule Schedule `json:"schedule"`
Instruction string `json:"instruction"`
ExecutionKind string `json:"execution_kind,omitempty"`
SessionTarget SessionTarget `json:"session_target"`
Delivery DeliveryTarget `json:"delivery"`
Source Source `json:"source"`
OverlapPolicy string `json:"overlap_policy,omitempty"`
Enabled bool `json:"enabled"`
}
CreateJobInput 表示创建请求。
func (CreateJobInput) Normalized ¶ added in v0.1.2
func (i CreateJobInput) Normalized() CreateJobInput
Normalized 返回标准化副本。
func (CreateJobInput) Validate ¶ added in v0.1.2
func (i CreateJobInput) Validate() error
Validate 校验创建请求。
type CreateRequest ¶
type CreateRequest struct {
Name string `json:"name"`
Options *Options `json:"options,omitempty"`
Avatar string `json:"avatar,omitempty"`
Description string `json:"description,omitempty"`
VibeTags []string `json:"vibe_tags,omitempty"`
}
CreateRequest 表示创建 Agent 请求。
type CreateRoomDirectedMessageRequest ¶ added in v0.1.12
type CreateRoomDirectedMessageRequest struct {
// SourceAgentID 只能由受控运行时注入,不能从 JSON body 写入。
SourceAgentID string `json:"-"`
Recipients []string `json:"recipients"`
Content string `json:"content"`
WakePolicy RoomWakePolicy `json:"wake_policy,omitempty"`
ReplyRoute RoomReplyRoute `json:"reply_route"`
DelaySeconds int `json:"delay_seconds,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
}
CreateRoomDirectedMessageRequest 表示创建 Room directed message 的请求。
type CreateRoomPublicMessageRequest ¶ added in v0.1.12
type CreateRoomPublicMessageRequest struct {
// SourceAgentID 只能由受控运行时注入,不能从 JSON body 写入。
SourceAgentID string `json:"-"`
Content string `json:"content"`
CorrelationID string `json:"correlation_id,omitempty"`
}
CreateRoomPublicMessageRequest 表示 Room 成员主动发布公区消息的请求。
type CreateRoomRequest ¶
type CreateRoomRequest struct {
AgentIDs []string `json:"agent_ids"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Title string `json:"title,omitempty"`
Avatar string `json:"avatar,omitempty"`
SkillNames []string `json:"skill_names,omitempty"`
HostAgentID string `json:"host_agent_id,omitempty"`
HostAutoReplyEnabled bool `json:"host_auto_reply_enabled,omitempty"`
PrivateMessagesEnabled bool `json:"private_messages_enabled,omitempty"`
}
CreateRoomRequest 表示创建房间请求。
type CronDailyReport ¶ added in v0.1.10
type CronDailyReport struct {
Date string `json:"date"`
Timezone string `json:"timezone"`
AgentID string `json:"agent_id,omitempty"`
JobID string `json:"job_id,omitempty"`
StartAt time.Time `json:"start_at"`
EndAt time.Time `json:"end_at"`
Totals CronDailyReportTotals `json:"totals"`
Tasks []CronDailyReportTask `json:"tasks"`
}
CronDailyReport 表示指定日期的任务运行和投递日报。
type CronDailyReportInput ¶ added in v0.1.10
CronDailyReportInput 表示日报查询输入。
type CronDailyReportTask ¶ added in v0.1.10
type CronDailyReportTask struct {
JobID string `json:"job_id"`
Name string `json:"name"`
AgentID string `json:"agent_id"`
Deleted bool `json:"deleted,omitempty"`
Enabled bool `json:"enabled"`
Running bool `json:"running"`
RunningRunID string `json:"running_run_id,omitempty"`
RecoveryRunID string `json:"recovery_run_id,omitempty"`
NextRunAt *time.Time `json:"next_run_at,omitempty"`
LastRunAt *time.Time `json:"last_run_at,omitempty"`
LastRunStatus string `json:"last_run_status,omitempty"`
LastDeliveryStatus string `json:"last_delivery_status,omitempty"`
FailureStreak int `json:"failure_streak,omitempty"`
LastError *string `json:"last_error,omitempty"`
LatestExecutionError *string `json:"latest_execution_error,omitempty"`
LatestDeliveryError *string `json:"latest_delivery_error,omitempty"`
Signals []string `json:"signals,omitempty"`
SuggestedTools []string `json:"suggested_tools,omitempty"`
ExecutionFailedRunIDs []string `json:"execution_failed_run_ids,omitempty"`
ManualRedeliveryRunIDs []string `json:"manual_redelivery_run_ids,omitempty"`
DeliveryPendingRunIDs []string `json:"delivery_pending_run_ids,omitempty"`
DeliverySkippedRunIDs []string `json:"delivery_skipped_run_ids,omitempty"`
DeliveryDeadLetterRunIDs []string `json:"delivery_dead_letter_run_ids,omitempty"`
Runs []CronRun `json:"runs"`
Totals CronDailyReportTotals `json:"totals"`
}
CronDailyReportTask 表示日报里单个任务的运行与投递情况。
type CronDailyReportTotals ¶ added in v0.1.10
type CronDailyReportTotals struct {
TaskCount int `json:"task_count"`
EnabledTaskCount int `json:"enabled_task_count"`
RunningTaskCount int `json:"running_task_count"`
RunCount int `json:"run_count"`
SucceededRunCount int `json:"succeeded_run_count"`
FailedRunCount int `json:"failed_run_count"`
CancelledRunCount int `json:"cancelled_run_count"`
SkippedRunCount int `json:"skipped_run_count"`
DeliveredRunCount int `json:"delivered_run_count"`
DeliveryFailedRunCount int `json:"delivery_failed_run_count"`
DeliveryPendingRunCount int `json:"delivery_pending_run_count"`
DeliverySkippedRunCount int `json:"delivery_skipped_run_count"`
DeliveryDeadLetterRunCount int `json:"delivery_dead_letter_run_count"`
DeliveryNotNeededCount int `json:"delivery_not_needed_count"`
DeliveryNotAttemptedCount int `json:"delivery_not_attempted_count"`
}
CronDailyReportTotals 表示定时任务日报聚合计数。
type CronJob ¶ added in v0.1.2
type CronJob struct {
JobID string `json:"job_id"`
OwnerUserID string `json:"-"`
Name string `json:"name"`
AgentID string `json:"agent_id"`
Schedule Schedule `json:"schedule"`
Instruction string `json:"instruction"`
ExecutionKind string `json:"execution_kind,omitempty"`
SessionTarget SessionTarget `json:"session_target"`
Delivery DeliveryTarget `json:"delivery"`
Source Source `json:"source"`
OverlapPolicy string `json:"overlap_policy,omitempty"`
Enabled bool `json:"enabled"`
NextRunAt *time.Time `json:"next_run_at,omitempty"`
Running bool `json:"running"`
RunningRunID string `json:"running_run_id,omitempty"`
RunningStartedAt *time.Time `json:"running_started_at,omitempty"`
LastRunAt *time.Time `json:"last_run_at,omitempty"`
LastRunStatus string `json:"last_run_status,omitempty"`
FailureStreak int `json:"failure_streak,omitempty"`
LastError *string `json:"last_error,omitempty"`
LastDeliveryStatus string `json:"last_delivery_status,omitempty"`
}
CronJob 表示对外暴露的定时任务视图。
type CronRun ¶ added in v0.1.2
type CronRun struct {
RunID string `json:"run_id"`
JobID string `json:"job_id"`
OwnerUserID string `json:"-"`
Status string `json:"status"`
TriggerKind string `json:"trigger_kind,omitempty"`
SessionKey string `json:"session_key,omitempty"`
RoundID string `json:"round_id,omitempty"`
SessionID *string `json:"session_id,omitempty"`
MessageCount int `json:"message_count,omitempty"`
DeliveryMode string `json:"delivery_mode,omitempty"`
DeliveryTo string `json:"delivery_to,omitempty"`
DeliveryStatus string `json:"delivery_status,omitempty"`
DeliveryError *string `json:"delivery_error,omitempty"`
DeliveredAt *time.Time `json:"delivered_at,omitempty"`
DeliveryAttempts int `json:"delivery_attempts,omitempty"`
DeliveryNextAttemptAt *time.Time `json:"delivery_next_attempt_at,omitempty"`
DeliveryDeadLetterAt *time.Time `json:"delivery_dead_letter_at,omitempty"`
ScheduledFor *time.Time `json:"scheduled_for,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
Attempts int `json:"attempts"`
ErrorMessage *string `json:"error_message,omitempty"`
ResultSummary *string `json:"result_summary,omitempty"`
AssistantText *string `json:"assistant_text,omitempty"`
ResultText *string `json:"result_text,omitempty"`
ArtifactPath *string `json:"artifact_path,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
CronRun 表示 run ledger 条目。
type CronTaskEvent ¶ added in v0.1.10
type CronTaskEvent struct {
EventID string `json:"event_id"`
JobID string `json:"job_id"`
OwnerUserID string `json:"-"`
AgentID string `json:"agent_id"`
Action string `json:"action"`
ActorUserID string `json:"actor_user_id,omitempty"`
ActorAgentID string `json:"actor_agent_id,omitempty"`
RunID string `json:"run_id,omitempty"`
Detail map[string]any `json:"detail,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
CronTaskEvent 表示定时任务管理动作审计记录。
type CronTaskHealth ¶ added in v0.1.10
type CronTaskHealth struct {
State string `json:"state"`
Signals []string `json:"signals,omitempty"`
SuggestedTools []string `json:"suggested_tools,omitempty"`
RecoveryAvailable bool `json:"recovery_available"`
RecoveryRunID string `json:"recovery_run_id,omitempty"`
ManualRedeliveryAvailable bool `json:"manual_redelivery_available"`
ManualRedeliveryRunIDs []string `json:"manual_redelivery_run_ids,omitempty"`
DeliveryFailedRunCount int `json:"delivery_failed_run_count,omitempty"`
DeliveryPendingRunCount int `json:"delivery_pending_run_count,omitempty"`
DeliveryPendingRunIDs []string `json:"delivery_pending_run_ids,omitempty"`
DeliverySkippedRunCount int `json:"delivery_skipped_run_count,omitempty"`
DeliverySkippedRunIDs []string `json:"delivery_skipped_run_ids,omitempty"`
DeliveryDeadLetterCount int `json:"delivery_dead_letter_count,omitempty"`
DeliveryDeadLetterRunIDs []string `json:"delivery_dead_letter_run_ids,omitempty"`
FailedRunCount int `json:"failed_run_count,omitempty"`
ExecutionFailedRunIDs []string `json:"execution_failed_run_ids,omitempty"`
LatestExecutionError *string `json:"latest_execution_error,omitempty"`
LatestDeliveryError *string `json:"latest_delivery_error,omitempty"`
RunningForSeconds int64 `json:"running_for_seconds,omitempty"`
}
CronTaskHealth 表示单个定时任务的可操作健康摘要。
type CronTaskHistoryItem ¶ added in v0.1.10
type CronTaskHistoryItem struct {
JobID string `json:"job_id"`
Name string `json:"name,omitempty"`
AgentID string `json:"agent_id,omitempty"`
Deleted bool `json:"deleted"`
Enabled *bool `json:"enabled,omitempty"`
Running bool `json:"running,omitempty"`
NextRunAt *time.Time `json:"next_run_at,omitempty"`
LastRunAt *time.Time `json:"last_run_at,omitempty"`
LastRunStatus string `json:"last_run_status,omitempty"`
LastDeliveryStatus string `json:"last_delivery_status,omitempty"`
LatestAction string `json:"latest_action,omitempty"`
LatestEventAt *time.Time `json:"latest_event_at,omitempty"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
RunCount int `json:"run_count,omitempty"`
}
CronTaskHistoryItem 表示可供 Agent 继续管理或追溯的任务候选。
type CronTaskHistorySearchInput ¶ added in v0.1.10
type CronTaskHistorySearchInput struct {
Query string
AgentID string
IncludeActive bool
IncludeDeleted bool
Limit int
}
CronTaskHistorySearchInput 表示按自然语言线索定位当前或历史任务的查询。
type CronTaskStatus ¶ added in v0.1.10
type CronTaskStatus struct {
Job CronJob `json:"job"`
Health CronTaskHealth `json:"health"`
RecentRuns []CronRun `json:"recent_runs"`
RecentEvents []CronTaskEvent `json:"recent_events"`
}
CronTaskStatus 表示单个任务的配置、健康摘要与最近观测记录。
type DeleteJobResult ¶ added in v0.1.10
type DeleteJobResult struct {
JobID string `json:"job_id"`
AgentID string `json:"agent_id,omitempty"`
Deleted bool `json:"deleted"`
ActiveRunID string `json:"active_run_id,omitempty"`
CancelledRunID string `json:"cancelled_run_id,omitempty"`
CancelledActiveRun bool `json:"cancelled_active_run,omitempty"`
}
DeleteJobResult 表示删除定时任务后的可解释结果。
type DeliveryTarget ¶ added in v0.1.2
type DeliveryTarget struct {
Mode string `json:"mode"`
Channel string `json:"channel,omitempty"`
To string `json:"to,omitempty"`
AccountID string `json:"account_id,omitempty"`
ThreadID string `json:"thread_id,omitempty"`
}
DeliveryTarget 表示自动化外部投递目标。
func (DeliveryTarget) Normalized ¶ added in v0.1.2
func (d DeliveryTarget) Normalized() DeliveryTarget
Normalized 返回带默认值的投递目标副本。
func (DeliveryTarget) Validate ¶ added in v0.1.2
func (d DeliveryTarget) Validate() error
Validate 校验投递目标。
type EventMessage ¶
type EventMessage struct {
EnvelopeID string `json:"envelope_id,omitempty"`
ProtocolVersion int `json:"protocol_version"`
DeliveryMode string `json:"delivery_mode,omitempty"`
EventType EventType `json:"event_type"`
SessionKey string `json:"session_key,omitempty"`
SessionSeq *int64 `json:"session_seq,omitempty"`
RoomID string `json:"room_id,omitempty"`
RoomSeq *int64 `json:"room_seq,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
AgentID string `json:"agent_id,omitempty"`
MessageID string `json:"message_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
CausedBy string `json:"caused_by,omitempty"`
Data map[string]any `json:"data"`
Timestamp int64 `json:"timestamp"`
}
EventMessage 对齐前后端统一 envelope。
func GoalEventEnvelope ¶ added in v0.1.15
func GoalEventEnvelope(sessionKey string, eventType EventType, goal Goal, payload map[string]any) EventMessage
GoalEventEnvelope 构造 WebSocket Goal 事件。
func NewChatAckEvent ¶
func NewChatAckEvent(sessionKey string, reqID string, roundID string, pending []map[string]any) EventMessage
NewChatAckEvent 构造 chat_ack 事件。
func NewErrorEvent ¶
func NewErrorEvent(sessionKey string, message string) EventMessage
NewErrorEvent 构造错误事件。
func NewEvent ¶
func NewEvent(eventType EventType, data map[string]any) EventMessage
NewEvent 构造通用事件。
func NewInputQueueEvent ¶ added in v0.1.2
func NewInputQueueEvent(sessionKey string, items []InputQueueItem) EventMessage
NewInputQueueEvent 构造 input_queue 快照事件。
func NewPermissionRequestResolvedEvent ¶
func NewPermissionRequestResolvedEvent(sessionKey string, requestID string, status string) EventMessage
NewPermissionRequestResolvedEvent 构造权限请求结束事件。
func NewRoundStatusEvent ¶
func NewRoundStatusEvent(sessionKey string, roundID string, status string, resultSubtype string) EventMessage
NewRoundStatusEvent 构造 round_status 事件。
type EventType ¶
type EventType string
EventType 表示统一事件类型。
const ( EventTypeMessage EventType = "message" EventTypeStream EventType = "stream" EventTypeChatAck EventType = "chat_ack" EventTypeInputQueue EventType = "input_queue" EventTypeRoundStatus EventType = "round_status" EventTypeSessionStatus EventType = "session_status" EventTypeGoalCreated EventType = "goal_created" EventTypeGoalUpdated EventType = "goal_updated" EventTypeGoalStatusChanged EventType = "goal_status_changed" EventTypeGoalProgress EventType = "goal_progress" EventTypeGoalContinuation EventType = "goal_continuation" EventTypeGoalCleared EventType = "goal_cleared" EventTypePermissionRequest EventType = "permission_request" EventTypePermissionRequestResolved EventType = "permission_request_resolved" EventTypeAgentRuntimeEvent EventType = "agent_runtime_event" EventTypeWorkspaceEvent EventType = "workspace_event" EventTypeDirectoryChanged EventType = "directory_changed" EventTypeScheduledTaskChanged EventType = "scheduled_task_changed" EventTypeRoomMemberAdded EventType = "room_member_added" EventTypeRoomMemberRemoved EventType = "room_member_removed" EventTypeRoomDeleted EventType = "room_deleted" EventTypeRoomDirectedMessage EventType = "room_directed_message" EventTypeRoomDirectedMessageConsumed EventType = "room_directed_message_consumed" EventTypeRoomResyncRequired EventType = "room_resync_required" EventTypeSessionResyncRequired EventType = "session_resync_required" EventTypeStreamStart EventType = "stream_start" EventTypeStreamEnd EventType = "stream_end" EventTypeStreamCancelled EventType = "stream_cancelled" EventTypeError EventType = "error" EventTypePong EventType = "pong" )
type ExecutionResult ¶ added in v0.1.2
type ExecutionResult struct {
JobID string `json:"job_id"`
RunID *string `json:"run_id,omitempty"`
Status string `json:"status"`
SessionKey string `json:"session_key"`
ScheduledFor *time.Time `json:"scheduled_for,omitempty"`
RoundID *string `json:"round_id,omitempty"`
SessionID *string `json:"session_id,omitempty"`
MessageCount int `json:"message_count"`
ErrorMessage *string `json:"error_message,omitempty"`
}
ExecutionResult 表示一次手动触发或后台触发的返回体。
type Goal ¶ added in v0.1.15
type Goal struct {
ID string `json:"id"`
SessionKey string `json:"session_key"`
Objective string `json:"objective"`
Status GoalStatus `json:"status"`
TokenBudget *int64 `json:"token_budget,omitempty"`
Usage GoalUsage `json:"usage"`
TimeUsedSeconds int64 `json:"time_used_seconds,omitempty"`
ContinuationCount int `json:"continuation_count"`
EmptyProgressCount int `json:"empty_progress_count"`
Version int64 `json:"version"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
BlockedAt *time.Time `json:"blocked_at,omitempty"`
LastError string `json:"last_error,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
Goal 表示一个 session 的当前长程目标。
func (Goal) RemainingTokens ¶ added in v0.1.15
RemainingTokens 返回剩余 token 预算;没有预算时返回 nil。
type GoalContinuation ¶ added in v0.1.15
type GoalContinuation struct {
Goal Goal `json:"goal"`
RoundID string `json:"round_id"`
Prompt string `json:"prompt"`
HiddenFromUser bool `json:"hidden_from_user"`
Synthetic bool `json:"synthetic"`
Purpose string `json:"purpose"`
Metadata map[string]string `json:"metadata,omitempty"`
}
GoalContinuation 表示一次由系统触发的隐藏 Goal 续跑输入。
type GoalEvent ¶ added in v0.1.15
type GoalEvent struct {
ID string `json:"id"`
GoalID string `json:"goal_id"`
SessionKey string `json:"session_key"`
EventType string `json:"event_type"`
Source GoalUpdateSource `json:"source"`
RoundID string `json:"round_id,omitempty"`
Payload map[string]any `json:"payload,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
GoalEvent 表示 Goal 审计事件。
type GoalStatus ¶ added in v0.1.15
type GoalStatus string
GoalStatus 表示会话 Goal 的生命周期状态。
const ( GoalStatusActive GoalStatus = "active" GoalStatusPaused GoalStatus = "paused" GoalStatusComplete GoalStatus = "complete" GoalStatusBlocked GoalStatus = "blocked" GoalStatusBudgetLimited GoalStatus = "budget_limited" GoalStatusUsageLimited GoalStatus = "usage_limited" )
func NormalizeGoalStatus ¶ added in v0.1.15
func NormalizeGoalStatus(status GoalStatus) GoalStatus
NormalizeGoalStatus 规范化 Goal 状态。
type GoalUpdateSource ¶ added in v0.1.15
type GoalUpdateSource string
GoalUpdateSource 表示 Goal 状态变化来源。
const ( GoalUpdateSourceUser GoalUpdateSource = "user" GoalUpdateSourceModel GoalUpdateSource = "model" GoalUpdateSourceSystem GoalUpdateSource = "system" GoalUpdateSourceExternal GoalUpdateSource = "external" )
type GoalUsage ¶ added in v0.1.15
type GoalUsage struct {
InputTokens int64 `json:"input_tokens,omitempty"`
OutputTokens int64 `json:"output_tokens,omitempty"`
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens,omitempty"`
CacheReadInputTokens int64 `json:"cache_read_input_tokens,omitempty"`
ReasoningTokens int64 `json:"reasoning_tokens,omitempty"`
TotalTokens int64 `json:"total_tokens,omitempty"`
RuntimeSeconds int64 `json:"runtime_seconds,omitempty"`
}
GoalUsage 记录 Goal 长程执行累计用量。
func (GoalUsage) BudgetTokens ¶ added in v0.1.15
BudgetTokens 按 Codex Goal 口径统计预算 token:非缓存输入 token + 输出 token。
type HeartbeatConfig ¶ added in v0.1.2
type HeartbeatConfig struct {
AgentID string `json:"agent_id"`
Enabled bool `json:"enabled"`
EverySeconds int `json:"every_seconds"`
TargetMode string `json:"target_mode"`
AckMaxChars int `json:"ack_max_chars"`
}
HeartbeatConfig 表示持久化 heartbeat 配置。
func DefaultHeartbeatConfig ¶ added in v0.1.2
func DefaultHeartbeatConfig(agentID string) HeartbeatConfig
DefaultHeartbeatConfig 返回默认 heartbeat 配置。
func (HeartbeatConfig) Normalized ¶ added in v0.1.2
func (c HeartbeatConfig) Normalized() HeartbeatConfig
Normalized 返回带默认值的配置副本。
func (HeartbeatConfig) Validate ¶ added in v0.1.2
func (c HeartbeatConfig) Validate() error
Validate 校验配置。
type HeartbeatStatus ¶ added in v0.1.2
type HeartbeatStatus struct {
AgentID string `json:"agent_id"`
Enabled bool `json:"enabled"`
EverySeconds int `json:"every_seconds"`
TargetMode string `json:"target_mode"`
AckMaxChars int `json:"ack_max_chars"`
Running bool `json:"running"`
PendingWake bool `json:"pending_wake"`
NextRunAt *time.Time `json:"next_run_at,omitempty"`
LastHeartbeatAt *time.Time `json:"last_heartbeat_at,omitempty"`
LastAckAt *time.Time `json:"last_ack_at,omitempty"`
DeliveryError *string `json:"delivery_error,omitempty"`
}
HeartbeatStatus 表示运行态和配置快照。
type HeartbeatUpdateInput ¶ added in v0.1.2
type HeartbeatUpdateInput struct {
Enabled bool `json:"enabled"`
EverySeconds int `json:"every_seconds"`
TargetMode string `json:"target_mode"`
AckMaxChars int `json:"ack_max_chars"`
}
HeartbeatUpdateInput 表示 heartbeat 配置更新请求。
type HeartbeatWakeRequest ¶ added in v0.1.2
HeartbeatWakeRequest 表示唤醒请求。
type HeartbeatWakeResult ¶ added in v0.1.2
type HeartbeatWakeResult struct {
AgentID string `json:"agent_id"`
Mode string `json:"mode"`
Scheduled bool `json:"scheduled"`
}
HeartbeatWakeResult 表示手动唤醒返回。
type InboundWebSocketMessage ¶
type InboundWebSocketMessage struct {
Type string `json:"type"`
SessionKey string `json:"session_key,omitempty"`
}
InboundWebSocketMessage 表示前端发送给服务端的基础消息。
type InputQueueItem ¶ added in v0.1.2
type InputQueueItem struct {
ID string `json:"id"`
Scope InputQueueScope `json:"scope"`
SessionKey string `json:"session_key"`
RoomID string `json:"room_id,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
AgentID string `json:"agent_id,omitempty"`
SourceAgentID string `json:"source_agent_id,omitempty"`
SourceMessageID string `json:"source_message_id,omitempty"`
TargetAgentIDs []string `json:"target_agent_ids,omitempty"`
Source InputQueueSource `json:"source"`
Content string `json:"content"`
Attachments []ChatAttachment `json:"attachments,omitempty"`
DeliveryPolicy ChatDeliveryPolicy `json:"delivery_policy"`
ReplyRoute RoomReplyRoute `json:"reply_route,omitempty"`
OwnerUserID string `json:"owner_user_id,omitempty"`
RootRoundID string `json:"root_round_id,omitempty"`
HopIndex int `json:"hop_index,omitempty"`
QueueOrder int64 `json:"queue_order,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
InputQueueItem 表示后端同步的待发送队列项。
type InputQueueScope ¶ added in v0.1.2
type InputQueueScope string
InputQueueScope 表示待发送队列所在的会话面。
const ( InputQueueScopeDM InputQueueScope = "dm" InputQueueScopeRoom InputQueueScope = "room" )
func NormalizeInputQueueScope ¶ added in v0.1.2
func NormalizeInputQueueScope(value string) InputQueueScope
NormalizeInputQueueScope 归一化队列作用域。
type InputQueueSource ¶ added in v0.1.2
type InputQueueSource string
InputQueueSource 表示队列项来源。
const ( InputQueueSourceUser InputQueueSource = "user" InputQueueSourceAgentPublicMention InputQueueSource = "agent_public_mention" InputQueueSourceAgentRoomMessage InputQueueSource = "agent_room_directed_message" )
func NormalizeInputQueueSource ¶ added in v0.1.2
func NormalizeInputQueueSource(value string) InputQueueSource
NormalizeInputQueueSource 归一化队列来源。
type MemberRecord ¶
type MemberRecord struct {
ID string `json:"id"`
RoomID string `json:"room_id"`
MemberType string `json:"member_type"`
MemberUserID string `json:"member_user_id,omitempty"`
MemberAgentID string `json:"member_agent_id,omitempty"`
JoinedAt time.Time `json:"joined_at,omitempty"`
}
MemberRecord 表示房间成员记录。
type MessagePage ¶
type MessagePage struct {
Items []Message `json:"items"`
HasMore bool `json:"has_more"`
NextBeforeRoundID *string `json:"next_before_round_id,omitempty"`
NextBeforeRoundTimestamp *int64 `json:"next_before_round_timestamp,omitempty"`
}
MessagePage 表示按 round 分页的消息历史结果。
type OptionalInt64 ¶ added in v0.1.15
OptionalInt64 表示 JSON 字段的三态:缺省、null、整数值。
func (*OptionalInt64) UnmarshalJSON ¶ added in v0.1.15
func (v *OptionalInt64) UnmarshalJSON(data []byte) error
UnmarshalJSON 记录字段是否出现,并保留 null 与整数值的差异。
type Options ¶
type Options struct {
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
PermissionMode string `json:"permission_mode,omitempty"`
AllowedTools []string `json:"allowed_tools,omitempty"`
DisallowedTools []string `json:"disallowed_tools,omitempty"`
MaxTurns *int `json:"max_turns,omitempty"`
MaxThinkingTokens *int `json:"max_thinking_tokens,omitempty"`
MCPServers map[string]any `json:"mcp_servers,omitempty"`
SettingSources []string `json:"setting_sources,omitempty"`
}
Options 表示 Agent 运行时配置。
type RoomAggregate ¶
type RoomAggregate struct {
Room RoomRecord `json:"room"`
Members []MemberRecord `json:"members"`
}
RoomAggregate 表示房间聚合。
type RoomDirectedMessageRecord ¶ added in v0.1.12
type RoomDirectedMessageRecord struct {
MessageID string `json:"message_id"`
RoomID string `json:"room_id"`
ConversationID string `json:"conversation_id"`
SourceAgentID string `json:"source_agent_id"`
Recipients []string `json:"recipients"`
Content string `json:"content,omitempty"`
WakePolicy RoomWakePolicy `json:"wake_policy,omitempty"`
ReplyRoute RoomReplyRoute `json:"reply_route"`
DelaySeconds int `json:"delay_seconds,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
Timestamp int64 `json:"timestamp"`
}
RoomDirectedMessageRecord 表示 Room directed message 的 append-only 持久化记录。
type RoomRecord ¶
type RoomRecord struct {
ID string `json:"id"`
OwnerUserID string `json:"-"`
RoomType string `json:"room_type"`
Name string `json:"name,omitempty"`
Description string `json:"description"`
Avatar string `json:"avatar,omitempty"`
SkillNames []string `json:"skill_names"`
HostAgentID string `json:"host_agent_id,omitempty"`
HostAutoReplyEnabled bool `json:"host_auto_reply_enabled"`
PrivateMessagesEnabled bool `json:"private_messages_enabled"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
RoomRecord 表示房间记录。
type RoomReplyRoute ¶ added in v0.1.12
type RoomReplyRoute struct {
Mode RoomReplyRouteMode `json:"mode"`
Recipients []string `json:"recipients,omitempty"`
WakePolicy RoomWakePolicy `json:"wake_policy,omitempty"`
NextReplyRoute *RoomReplyRoute `json:"next_reply_route,omitempty"`
}
RoomReplyRoute 表示 directed message 触发后的 final reply 投影规则。
type RoomReplyRouteMode ¶ added in v0.1.12
type RoomReplyRouteMode string
RoomReplyRouteMode 表示 directed message 唤醒后的回复投影位置。
const ( RoomReplyRoutePublic RoomReplyRouteMode = "public" RoomReplyRoutePrivate RoomReplyRouteMode = "private" RoomReplyRouteNone RoomReplyRouteMode = "none" )
type RoomWakePolicy ¶ added in v0.1.3
type RoomWakePolicy string
RoomWakePolicy 表示 directed message 是否触发目标成员运行。
const ( RoomWakePolicyNone RoomWakePolicy = "none" RoomWakePolicyImmediate RoomWakePolicy = "immediate" RoomWakePolicyDelayed RoomWakePolicy = "delayed" )
type RoundStatusData ¶
type RoundStatusData struct {
RoundID string `json:"round_id"`
Status string `json:"status"`
IsTerminal bool `json:"is_terminal"`
ResultSubtype string `json:"result_subtype,omitempty"`
}
RoundStatusData 表示 round 生命周期事件。
type Schedule ¶ added in v0.1.2
type Schedule struct {
Kind string `json:"kind"`
RunAt *string `json:"run_at,omitempty"`
IntervalSeconds *int `json:"interval_seconds,omitempty"`
CronExpression *string `json:"cron_expression,omitempty"`
Timezone string `json:"timezone,omitempty"`
}
Schedule 表示结构化调度定义。
func (Schedule) Normalized ¶ added in v0.1.2
Normalized 返回带默认值的调度副本。
type Session ¶
type Session struct {
SessionKey string `json:"session_key"`
AgentID string `json:"agent_id"`
SessionID *string `json:"session_id"`
RoomSessionID *string `json:"room_session_id"`
RoomID *string `json:"room_id"`
ConversationID *string `json:"conversation_id"`
ChannelType string `json:"channel_type"`
ChatType string `json:"chat_type"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
LastActivity time.Time `json:"last_activity"`
Title string `json:"title"`
MessageCount int `json:"message_count"`
Options map[string]any `json:"options"`
IsActive bool `json:"is_active"`
}
Session 表示对外暴露的统一会话模型。
type SessionKey ¶
type SessionKey struct {
Raw string `json:"raw"`
Kind SessionKeyKind `json:"kind"`
IsStructured bool `json:"is_structured"`
AgentID string `json:"agent_id,omitempty"`
Channel string `json:"channel,omitempty"`
ChatType string `json:"chat_type,omitempty"`
AccountID string `json:"account_id,omitempty"`
Ref string `json:"ref,omitempty"`
ThreadID string `json:"thread_id,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
RoomRef string `json:"room_ref,omitempty"`
}
SessionKey 表示结构化会话键。
type SessionKeyKind ¶
type SessionKeyKind string
SessionKeyKind 表示协议族。
const ( // SessionKeyKindAgent 表示 agent 私有运行时。 SessionKeyKindAgent SessionKeyKind = "agent" // SessionKeyKindRoom 表示共享 room 流。 SessionKeyKindRoom SessionKeyKind = "room" // SessionKeyKindUnknown 表示无法识别。 SessionKeyKindUnknown SessionKeyKind = "unknown" )
type SessionRecord ¶
type SessionRecord struct {
ID string `json:"id"`
ConversationID string `json:"conversation_id"`
AgentID string `json:"agent_id"`
RuntimeID string `json:"runtime_id"`
VersionNo int `json:"version_no"`
BranchKey string `json:"branch_key"`
IsPrimary bool `json:"is_primary"`
SDKSessionID string `json:"sdk_session_id,omitempty"`
Status string `json:"status"`
LastActivityAt time.Time `json:"last_activity_at,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
SessionRecord 表示房间内的运行时会话索引。
type SessionRoundIndex ¶ added in v0.1.23
type SessionRoundIndex struct {
Items []SessionRoundIndexItem `json:"items"`
}
SessionRoundIndex 表示 session 级 round 导航索引。
type SessionRoundIndexItem ¶ added in v0.1.23
type SessionRoundIndexItem struct {
RoundID string `json:"round_id"`
Title string `json:"title,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
Status string `json:"status,omitempty"`
DurationMS *int64 `json:"duration_ms,omitempty"`
IsLive bool `json:"is_live,omitempty"`
HasUserMessage bool `json:"has_user_message,omitempty"`
AgentIDs []string `json:"agent_ids,omitempty"`
}
SessionRoundIndexItem 表示一个 round 的轻量导航元数据。
type SessionStatusData ¶
type SessionStatusData struct {
IsGenerating bool `json:"is_generating"`
RunningRoundIDs []string `json:"running_round_ids,omitempty"`
}
SessionStatusData 表示 session 生命周期事件。
type SessionTarget ¶ added in v0.1.2
type SessionTarget struct {
Kind string `json:"kind"`
BoundSessionKey string `json:"bound_session_key,omitempty"`
NamedSessionKey string `json:"named_session_key,omitempty"`
WakeMode string `json:"wake_mode,omitempty"`
}
SessionTarget 表示执行目标会话。
func (SessionTarget) Normalized ¶ added in v0.1.2
func (t SessionTarget) Normalized() SessionTarget
Normalized 返回带默认值的会话目标副本。
func (SessionTarget) Validate ¶ added in v0.1.2
func (t SessionTarget) Validate() error
Validate 校验会话目标。
type Source ¶ added in v0.1.2
type Source struct {
Kind string `json:"kind"`
CreatorAgentID string `json:"creator_agent_id,omitempty"`
ContextType string `json:"context_type,omitempty"`
ContextID string `json:"context_id,omitempty"`
ContextLabel string `json:"context_label,omitempty"`
SessionKey string `json:"session_key,omitempty"`
SessionLabel string `json:"session_label,omitempty"`
}
Source 表示任务来源元数据。
func (Source) Normalized ¶ added in v0.1.2
Normalized 返回带默认值的来源副本。
type StructuredSessionKeyError ¶
type StructuredSessionKeyError struct {
Message string
}
StructuredSessionKeyError 对齐前端 HTTP 入口的 422 校验错误。
func (StructuredSessionKeyError) Error ¶
func (e StructuredSessionKeyError) Error() string
type SystemEvent ¶ added in v0.1.2
type SystemEvent struct {
EventID string
EventType string
SourceType string
SourceID string
Payload string
Status string
CreatedAt time.Time
}
SystemEvent 表示 heartbeat/main-session 消费的系统事件。
type UpdateConversationRequest ¶
type UpdateConversationRequest struct {
Title string `json:"title,omitempty"`
}
UpdateConversationRequest 表示更新话题请求。
type UpdateGoalRequest ¶ added in v0.1.15
type UpdateGoalRequest struct {
Objective *string `json:"objective,omitempty"`
TokenBudget OptionalInt64 `json:"token_budget,omitempty"`
OwnerUserID string `json:"owner_user_id,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
UpdateGoalRequest 表示更新 Goal 的请求。
type UpdateJobInput ¶ added in v0.1.2
type UpdateJobInput struct {
Name *string `json:"name,omitempty"`
Schedule *Schedule `json:"schedule,omitempty"`
Instruction *string `json:"instruction,omitempty"`
ExecutionKind *string `json:"execution_kind,omitempty"`
SessionTarget *SessionTarget `json:"session_target,omitempty"`
Delivery *DeliveryTarget `json:"delivery,omitempty"`
Source *Source `json:"source,omitempty"`
OverlapPolicy *string `json:"overlap_policy,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
UpdateJobInput 表示更新请求。
type UpdateRequest ¶
type UpdateRequest struct {
Name *string `json:"name,omitempty"`
Options *Options `json:"options,omitempty"`
Avatar *string `json:"avatar,omitempty"`
Description *string `json:"description,omitempty"`
VibeTags []string `json:"vibe_tags,omitempty"`
}
UpdateRequest 表示更新 Agent 请求。
type UpdateRoomRequest ¶
type UpdateRoomRequest struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Title string `json:"title,omitempty"`
Avatar *string `json:"avatar,omitempty"`
SkillNames *[]string `json:"skill_names,omitempty"`
HostAgentID *string `json:"host_agent_id,omitempty"`
HostAutoReplyEnabled *bool `json:"host_auto_reply_enabled,omitempty"`
PrivateMessagesEnabled *bool `json:"private_messages_enabled,omitempty"`
}
UpdateRoomRequest 表示更新房间请求。
type ValidateNameResponse ¶
type ValidateNameResponse struct {
Name string `json:"name"`
NormalizedName string `json:"normalized_name"`
IsValid bool `json:"is_valid"`
IsAvailable bool `json:"is_available"`
WorkspacePath string `json:"workspace_path,omitempty"`
Reason string `json:"reason,omitempty"`
}
ValidateNameResponse 对齐当前校验协议。
type WorkspaceFileArtifactBlock ¶ added in v0.1.6
type WorkspaceFileArtifactBlock struct {
ID string `json:"id,omitempty"`
Type string `json:"type"`
Path string `json:"path"`
DisplayPath string `json:"display_path,omitempty"`
Label string `json:"label,omitempty"`
Title string `json:"title,omitempty"`
ArtifactKind string `json:"artifact_kind,omitempty"`
MIMEType string `json:"mime_type,omitempty"`
Operation string `json:"operation,omitempty"`
Scope string `json:"scope,omitempty"`
WorkspaceAgentID string `json:"workspace_agent_id,omitempty"`
SourceToolUseID string `json:"source_tool_use_id,omitempty"`
SourceToolName string `json:"source_tool_name,omitempty"`
}
WorkspaceFileArtifactBlock 描述对话中可直接打开的工作区文件产物。
func (WorkspaceFileArtifactBlock) Map ¶ added in v0.1.6
func (b WorkspaceFileArtifactBlock) Map() map[string]any
Map 转成动态消息块,供现有 transcript map 写入链路复用。
Source Files
¶
- constant_session_option.go
- generate.go
- model_agent.go
- model_agent_private_domain.go
- model_automation.go
- model_automation_heartbeat.go
- model_automation_input.go
- model_automation_job.go
- model_automation_report.go
- model_automation_schedule.go
- model_automation_target.go
- model_chat_attachment.go
- model_delivery_policy.go
- model_event.go
- model_goal.go
- model_input_queue.go
- model_room.go
- model_room_directed_message.go
- model_room_request.go
- model_session.go
- model_session_key.go
- model_session_message.go
- model_workspace_file_artifact.go
- typescript_event.go