Documentation
¶
Index ¶
- Constants
- func BackfillPhasePrompts(phases []model.PhaseItem)
- func GenerateToken() (string, error)
- func MaskToken(token string) string
- func ValidatePathReference(ref model.PathReference) error
- func ValidatePathReferences(refs []model.PathReference) error
- func ValidateSegments(segments []model.Segment) error
- type AppError
- type AuthCredentials
- type CreateSessionInput
- type ErrorKind
- type GlobalAppSettings
- type QueueFeedbackInput
- type RevokedFeedbackResult
- type SecuritySettings
- type Store
- func (s *Store) AckReports(ctx context.Context, projectID, taskID string, throughSequence int64) (*model.AckSummary, error)
- func (s *Store) AddReport(ctx context.Context, input model.AddReportInput) (*model.ReportResult, error)
- func (s *Store) ArchiveFeedbackSession(ctx context.Context, idOrWorkflow string) (*model.FeedbackSession, error)
- func (s *Store) CancelFeedbackSession(ctx context.Context, idOrWorkflow string) (*model.FeedbackSession, error)
- func (s *Store) CheckFeedback(ctx context.Context, input model.CheckFeedbackInput) (*model.CheckFeedbackResult, error)
- func (s *Store) Close() error
- func (s *Store) CloseTask(ctx context.Context, projectID, taskID string, expectedRevision int64, ...) (*model.MutationResult, error)
- func (s *Store) CreateCredential(ctx context.Context, cred *model.MCPCredential) error
- func (s *Store) CreateFeedbackSession(ctx context.Context, input CreateSessionInput) (*model.FeedbackSession, error)
- func (s *Store) CreateTask(ctx context.Context, input model.CreateTaskInput) (*model.Task, error)
- func (s *Store) CreateUserNorm(ctx context.Context, norm *model.UserNorm) error
- func (s *Store) DB() *gorm.DB
- func (s *Store) DeleteCredential(ctx context.Context, id uint) error
- func (s *Store) DeleteFeedbackSession(ctx context.Context, sessionID string) (*model.FeedbackSession, error)
- func (s *Store) DeleteNote(ctx context.Context, id uint) error
- func (s *Store) DeleteUserNorm(ctx context.Context, name string) error
- func (s *Store) DeleteWorkflowDraft(ctx context.Context, workflowID string) error
- func (s *Store) EnsureEnvMCPCredential(ctx context.Context, envToken string) (*model.MCPCredential, error)
- func (s *Store) FindCredentialByToken(ctx context.Context, token string) (*model.MCPCredential, error)
- func (s *Store) GetAuthCredentials(ctx context.Context) (*AuthCredentials, error)
- func (s *Store) GetAuthCredentialsWithDB(ctx context.Context, db *gorm.DB) (*AuthCredentials, error)
- func (s *Store) GetCheckpointByRevision(ctx context.Context, workflowID string, revision int) (*model.WorkflowCheckpoint, error)
- func (s *Store) GetCredential(ctx context.Context, id uint) (*model.MCPCredential, error)
- func (s *Store) GetCurrentFeedbackSession(ctx context.Context, projectDir string) (*model.FeedbackSession, error)
- func (s *Store) GetFeedbackSession(ctx context.Context, sessionID string) (*model.FeedbackSession, error)
- func (s *Store) GetGlobalAppSettings(ctx context.Context) (*GlobalAppSettings, error)
- func (s *Store) GetGlobalAppSettingsWithDB(ctx context.Context, db *gorm.DB) (*GlobalAppSettings, error)
- func (s *Store) GetHumanPreferredPhase(ctx context.Context, workflowID string) (string, error)
- func (s *Store) GetLatestCheckpoint(ctx context.Context, workflowID string) (*model.WorkflowCheckpoint, error)
- func (s *Store) GetLatestWorkflowFeedbackSession(ctx context.Context, workflowID string) (*model.FeedbackSession, error)
- func (s *Store) GetNote(ctx context.Context, id uint) (*model.WorkflowNote, error)
- func (s *Store) GetNoteByKey(ctx context.Context, workflowID, noteKey string) (*model.WorkflowNote, error)
- func (s *Store) GetSessionsByWorkflow(ctx context.Context, workflowID string, limit int) ([]model.FeedbackSession, error)
- func (s *Store) GetSettings(ctx context.Context) (map[string]any, error)
- func (s *Store) GetSettingsWithDB(ctx context.Context, db *gorm.DB) (map[string]any, error)
- func (s *Store) GetTask(ctx context.Context, projectID, taskID string) (*model.Task, error)
- func (s *Store) GetUserNorm(ctx context.Context, name string) (*model.UserNorm, error)
- func (s *Store) GetWorkflowDraft(ctx context.Context, workflowID string) (*model.WorkflowDraft, error)
- func (s *Store) GetWorkflowPhase(ctx context.Context, workflowID string) (*model.WorkflowPhaseState, error)
- func (s *Store) GetWorkflowPhaseWithDefaults(ctx context.Context, workflowID string) (currentPhaseID string, phases []model.PhaseItem, err error)
- func (s *Store) HasAnyCredential(ctx context.Context) (bool, error)
- func (s *Store) KeepaliveFeedbackSession(ctx context.Context, sessionID string, extendSec int) (*model.FeedbackSession, error)
- func (s *Store) ListActiveUserNorms(ctx context.Context) ([]model.UserNorm, error)
- func (s *Store) ListCheckpoints(ctx context.Context, workflowID string, limit int) ([]model.WorkflowCheckpoint, error)
- func (s *Store) ListCredentials(ctx context.Context) ([]model.MCPCredential, error)
- func (s *Store) ListFeedbackSessions(ctx context.Context, projectDir, status string, limit int) ([]model.FeedbackSession, error)
- func (s *Store) ListFeedbackSessionsBrief(ctx context.Context, projectDir, status string, limit int) ([]model.FeedbackSession, error)
- func (s *Store) ListNotes(ctx context.Context, workflowID string, sessionID string, limit int) ([]model.WorkflowNote, error)
- func (s *Store) ListPendingQueuedFeedbacks(ctx context.Context, workflowID string) ([]model.QueuedFeedback, error)
- func (s *Store) ListTasks(ctx context.Context, projectID, state, cursor string, limit int, ...) (*model.TaskPage, error)
- func (s *Store) ListUserNorms(ctx context.Context) ([]model.UserNorm, error)
- func (s *Store) ListWorkflowFeedbackSessions(ctx context.Context, workflowID string) ([]model.FeedbackSession, error)
- func (s *Store) ListWorkflowSummaries(ctx context.Context, projectDir, hostName string, limit int) ([]map[string]any, error)
- func (s *Store) MarkSessionConsumedByAI(ctx context.Context, sessionID string, consumedAt ...time.Time) error
- func (s *Store) MarkWorkflowHistorySessionsConsumed(ctx context.Context, workflowID string) error
- func (s *Store) QueueWorkflowFeedback(ctx context.Context, input QueueFeedbackInput) (*model.QueuedFeedback, error)
- func (s *Store) ReadFeedbacks(ctx context.Context, projectID, taskID string, afterSequence int64, limit int) ([]model.Feedback, error)
- func (s *Store) ReadReports(ctx context.Context, projectID, taskID string, afterSequence int64, limit int) (*model.ReportPage, error)
- func (s *Store) RegenerateCredentialToken(ctx context.Context, id uint) (*model.MCPCredential, string, error)
- func (s *Store) RenameFeedbackSession(ctx context.Context, idOrWorkflow, newTitle string) (*model.FeedbackSession, error)
- func (s *Store) ResetAuthCredentials(ctx context.Context) error
- func (s *Store) RestoreFeedbackSession(ctx context.Context, session *model.FeedbackSession) (*model.FeedbackSession, error)
- func (s *Store) RevokeQueuedFeedback(ctx context.Context, queuedID uint) (*RevokedFeedbackResult, error)
- func (s *Store) RevokeSessionFeedback(ctx context.Context, sessionID string) (*RevokedFeedbackResult, *model.FeedbackSession, error)
- func (s *Store) SaveAuthCredentials(ctx context.Context, username, password string) error
- func (s *Store) SaveCheckpoint(ctx context.Context, cp *model.WorkflowCheckpoint) error
- func (s *Store) SaveNote(ctx context.Context, note *model.WorkflowNote) error
- func (s *Store) SaveSettings(ctx context.Context, settings map[string]any) error
- func (s *Store) SaveWorkflowDraft(ctx context.Context, workflowID string, activeIndex int, draftsJSON string) (*model.WorkflowDraft, error)
- func (s *Store) SeedBuiltinNorms(ctx context.Context) error
- func (s *Store) SendFeedback(ctx context.Context, input model.SendFeedbackInput) (*model.Feedback, error)
- func (s *Store) SetWaitPolicy(ctx context.Context, input model.SetWaitPolicyInput) (*model.MutationResult, error)
- func (s *Store) SetWorkflowPhase(ctx context.Context, workflowID, phaseID string, isHumanClick bool) error
- func (s *Store) SetWorkflowPhaseConfig(ctx context.Context, workflowID string, phases []model.PhaseItem) error
- func (s *Store) SubmitFeedback(ctx context.Context, input SubmitFeedbackInput) (*model.FeedbackSession, error)
- func (s *Store) SupersedeOldCheckpoints(ctx context.Context, workflowID string, currentRevision int) error
- func (s *Store) Sync(ctx context.Context, input model.SyncInput) (*model.SyncResult, error)
- func (s *Store) UnarchiveFeedbackSession(ctx context.Context, idOrWorkflow string) (*model.FeedbackSession, error)
- func (s *Store) UpdateCheckpointStatus(ctx context.Context, workflowID string, revision int, status string) error
- func (s *Store) UpdateCredential(ctx context.Context, id uint, updates map[string]any) (*model.MCPCredential, error)
- func (s *Store) UpdateNote(ctx context.Context, id uint, content string) error
- func (s *Store) UpdateSessionMaxChecks(ctx context.Context, idOrWorkflow string, maxChecks int) (*model.FeedbackSession, error)
- func (s *Store) UpdateSessionPromptWait(ctx context.Context, idOrWorkflow string, waitMinutes int) (*model.FeedbackSession, error)
- func (s *Store) UpdateSessionUserPresence(ctx context.Context, idOrWorkflow string, presence string) (*model.FeedbackSession, error)
- func (s *Store) UpdateSessionWaitCountdown(ctx context.Context, idOrWorkflow string, countdownMinutes int) (*model.FeedbackSession, error)
- func (s *Store) UpdateStages(ctx context.Context, input model.UpdateStagesInput) (*model.MutationResult, error)
- func (s *Store) UpdateTask(ctx context.Context, input model.UpdateTaskInput) (*model.MutationResult, error)
- func (s *Store) UpdateTaskHeartbeat(ctx context.Context, projectID, taskID, role, sessionID string) error
- func (s *Store) UpdateUserNorm(ctx context.Context, name string, updates map[string]any) (*model.UserNorm, error)
- func (s *Store) WithTx(ctx context.Context, fn func(tx *gorm.DB) error) error
- type SubmitFeedbackInput
Constants ¶
const ( CredentialTokenPrefix = "rm-" CredentialTokenBytes = 32 CredentialNameMaxLen = 128 CredentialNoteMaxLen = 512 CredentialMaxCount = 50 )
const ( NormNameMaxLen = 128 NormSummaryMaxLen = 500 NormContentMaxLen = 20000 NormMaxCount = 50 )
const ( GlobalSettingsKey = "app_settings" AuthCredentialsKey = "auth_credentials" )
const DefaultAgentModesContent = `` /* 2776-byte string literal not displayed */
const DefaultAgentModesSummary = "会话场景模式 playbook(online 值守 / away 安全兜底 / autopilot 外部编排)+ Phase 0-7 开发工作流。"
const DefaultServerInstructions = `` /* 4684-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func BackfillPhasePrompts ¶ added in v1.1.0
BackfillPhasePrompts fills in missing Prompt fields from DefaultPhaseTemplate.
func GenerateToken ¶ added in v1.1.0
func ValidatePathReference ¶
func ValidatePathReference(ref model.PathReference) error
func ValidatePathReferences ¶
func ValidatePathReferences(refs []model.PathReference) error
func ValidateSegments ¶
Types ¶
type AppError ¶
func NewConflictError ¶
func NewInvalidInputError ¶
func NewNotFoundError ¶
func NewTaskClosedError ¶
type AuthCredentials ¶
type CreateSessionInput ¶
type CreateSessionInput struct {
SessionID string `json:"session_id,omitempty"`
WorkflowID string `json:"workflow_id,omitempty"`
CredentialID uint `json:"credential_id,omitempty"`
EnvHostName string `json:"env_host_name,omitempty"`
CredentialHostName string `json:"credential_host_name,omitempty"`
ProjectDirectory string `json:"project_directory"`
Title string `json:"title,omitempty"`
Summary string `json:"summary"`
UserPresence string `json:"user_presence,omitempty"`
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
}
type GlobalAppSettings ¶
type GlobalAppSettings struct {
HostName string `json:"hostName"`
DefaultTimeoutSeconds int `json:"defaultTimeoutSeconds"`
PromptWaitMinutes int `json:"promptWaitMinutes"`
MaxNoFeedbackChecks int `json:"maxNoFeedbackChecks"`
DefaultWaitCountdownMinutes int `json:"defaultWaitCountdownMinutes"`
UserPresence string `json:"userPresence"`
UserMemory string `json:"userMemory"`
ServerInstructions string `json:"serverInstructions"`
PhaseTemplate []model.PhaseItem `json:"phaseTemplate"`
Security SecuritySettings `json:"security"`
FlowPrompts struct {
Online struct {
WaitPollPrompt string `json:"waitPollPrompt"`
ExhaustedPrompt string `json:"exhaustedPrompt"`
} `json:"online"`
Away struct {
ImmediatePrompt string `json:"immediatePrompt"`
} `json:"away"`
Autopilot struct {
ImmediatePrompt string `json:"immediatePrompt"`
} `json:"autopilot"`
} `json:"flowPrompts"`
}
type QueueFeedbackInput ¶
type QueueFeedbackInput struct {
WorkflowID string `json:"workflow_id"`
HostName string `json:"host_name,omitempty"`
ProjectDirectory string `json:"project_directory,omitempty"`
ResponseText string `json:"response_text"`
UserMessages []string `json:"user_messages,omitempty"`
Images []model.SessionImage `json:"images,omitempty"`
}
type RevokedFeedbackResult ¶
type RevokedFeedbackResult struct {
SessionID string `json:"session_id,omitempty"`
WorkflowID string `json:"workflow_id,omitempty"`
QueuedID uint `json:"queued_id,omitempty"`
ResponseText string `json:"response_text"`
UserMessages []string `json:"user_messages"`
Images []model.SessionImage `json:"images"`
}
type SecuritySettings ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AckReports ¶
func (*Store) AddReport ¶
func (s *Store) AddReport(ctx context.Context, input model.AddReportInput) (*model.ReportResult, error)
func (*Store) ArchiveFeedbackSession ¶
func (*Store) CancelFeedbackSession ¶
func (*Store) CheckFeedback ¶
func (s *Store) CheckFeedback(ctx context.Context, input model.CheckFeedbackInput) (*model.CheckFeedbackResult, error)
func (*Store) CreateCredential ¶ added in v1.1.0
func (*Store) CreateFeedbackSession ¶
func (s *Store) CreateFeedbackSession(ctx context.Context, input CreateSessionInput) (*model.FeedbackSession, error)
func (*Store) CreateTask ¶
func (*Store) CreateUserNorm ¶ added in v1.1.0
func (*Store) DeleteCredential ¶ added in v1.1.0
func (*Store) DeleteFeedbackSession ¶ added in v1.6.0
func (s *Store) DeleteFeedbackSession(ctx context.Context, sessionID string) (*model.FeedbackSession, error)
DeleteFeedbackSession 物理删除会话记录,维护工作流状态并级联清理(D-159)
func (*Store) DeleteNote ¶ added in v1.1.0
func (*Store) DeleteUserNorm ¶ added in v1.1.0
func (*Store) DeleteWorkflowDraft ¶
DeleteWorkflowDraft 删除工作流草稿数据
func (*Store) EnsureEnvMCPCredential ¶ added in v1.3.0
func (s *Store) EnsureEnvMCPCredential(ctx context.Context, envToken string) (*model.MCPCredential, error)
EnsureEnvMCPCredential 确保环境变量 RELAYMESH_MCP_TOKEN 在数据库中存在对应的可管理凭据
func (*Store) FindCredentialByToken ¶ added in v1.1.0
func (*Store) GetAuthCredentials ¶
func (s *Store) GetAuthCredentials(ctx context.Context) (*AuthCredentials, error)
GetAuthCredentials 获取数据库中持久化的账号密码
func (*Store) GetAuthCredentialsWithDB ¶
func (s *Store) GetAuthCredentialsWithDB(ctx context.Context, db *gorm.DB) (*AuthCredentials, error)
GetAuthCredentialsWithDB 从指定 DB (支持事务) 获取数据库中持久化的账号密码
func (*Store) GetCheckpointByRevision ¶ added in v1.1.0
func (*Store) GetCredential ¶ added in v1.1.0
func (*Store) GetCurrentFeedbackSession ¶
func (*Store) GetFeedbackSession ¶
func (*Store) GetGlobalAppSettings ¶
func (s *Store) GetGlobalAppSettings(ctx context.Context) (*GlobalAppSettings, error)
GetGlobalAppSettings 获取强类型系统全局配置,含完备默认值
func (*Store) GetGlobalAppSettingsWithDB ¶
func (s *Store) GetGlobalAppSettingsWithDB(ctx context.Context, db *gorm.DB) (*GlobalAppSettings, error)
GetGlobalAppSettingsWithDB 从指定 DB (支持事务 tx) 获取强类型系统全局配置
func (*Store) GetHumanPreferredPhase ¶ added in v1.1.0
func (*Store) GetLatestCheckpoint ¶ added in v1.1.0
func (*Store) GetLatestWorkflowFeedbackSession ¶
func (s *Store) GetLatestWorkflowFeedbackSession(ctx context.Context, workflowID string) (*model.FeedbackSession, error)
GetLatestWorkflowFeedbackSession 自动查找某工作流下最近的会话(优先 pending 活跃轮次,其次最新轮次)
func (*Store) GetNoteByKey ¶ added in v1.1.0
func (*Store) GetSessionsByWorkflow ¶ added in v1.1.0
func (*Store) GetSettings ¶
GetSettings 从数据库获取全局配置,若不存在返回默认 map
func (*Store) GetSettingsWithDB ¶
GetSettingsWithDB 从指定 DB (支持事务 tx) 获取全局配置
func (*Store) GetUserNorm ¶ added in v1.1.0
func (*Store) GetWorkflowDraft ¶
func (s *Store) GetWorkflowDraft(ctx context.Context, workflowID string) (*model.WorkflowDraft, error)
GetWorkflowDraft 获取工作流对应的草稿数据,若不存在返回 nil, nil
func (*Store) GetWorkflowPhase ¶ added in v1.1.0
func (*Store) GetWorkflowPhaseWithDefaults ¶ added in v1.1.0
func (*Store) HasAnyCredential ¶ added in v1.1.0
func (*Store) KeepaliveFeedbackSession ¶
func (*Store) ListActiveUserNorms ¶ added in v1.1.0
func (*Store) ListCheckpoints ¶ added in v1.1.0
func (*Store) ListCredentials ¶ added in v1.1.0
func (*Store) ListFeedbackSessions ¶
func (*Store) ListFeedbackSessionsBrief ¶ added in v1.3.0
func (s *Store) ListFeedbackSessionsBrief(ctx context.Context, projectDir, status string, limit int) ([]model.FeedbackSession, error)
ListFeedbackSessionsBrief 获取轻量会话列表(通过字段投影排除大体积正文 summary、response_text、user_messages 和 images,专供小带宽场景下的列表加载)
func (*Store) ListPendingQueuedFeedbacks ¶
func (*Store) ListUserNorms ¶ added in v1.1.0
func (*Store) ListWorkflowFeedbackSessions ¶ added in v1.3.0
func (s *Store) ListWorkflowFeedbackSessions(ctx context.Context, workflowID string) ([]model.FeedbackSession, error)
ListWorkflowFeedbackSessions 获取指定工作流的所有完整会话(按 created_at ASC 升序,包含完整图文正文,按需呈现对话流)
func (*Store) ListWorkflowSummaries ¶ added in v1.1.0
func (*Store) MarkSessionConsumedByAI ¶
func (*Store) MarkWorkflowHistorySessionsConsumed ¶ added in v1.6.0
MarkWorkflowHistorySessionsConsumed 自动将某工作流下所有已完成但未被消费的历史轮次批量打标为已消费(D-159)
func (*Store) QueueWorkflowFeedback ¶
func (s *Store) QueueWorkflowFeedback(ctx context.Context, input QueueFeedbackInput) (*model.QueuedFeedback, error)
func (*Store) ReadFeedbacks ¶ added in v1.1.0
func (*Store) ReadReports ¶
func (*Store) RegenerateCredentialToken ¶ added in v1.1.0
func (*Store) RenameFeedbackSession ¶
func (*Store) ResetAuthCredentials ¶
ResetAuthCredentials 删除数据库中的账号密码记录,回退为环境变量值
func (*Store) RestoreFeedbackSession ¶ added in v1.6.0
func (s *Store) RestoreFeedbackSession(ctx context.Context, session *model.FeedbackSession) (*model.FeedbackSession, error)
RestoreFeedbackSession 复原被删除的会话(支持撤销删除)
func (*Store) RevokeQueuedFeedback ¶
func (*Store) RevokeSessionFeedback ¶
func (s *Store) RevokeSessionFeedback(ctx context.Context, sessionID string) (*RevokedFeedbackResult, *model.FeedbackSession, error)
func (*Store) SaveAuthCredentials ¶
SaveAuthCredentials 保存或更新账号密码至数据库
func (*Store) SaveCheckpoint ¶ added in v1.1.0
func (*Store) SaveSettings ¶
SaveSettings 保存全局配置至数据库
func (*Store) SaveWorkflowDraft ¶
func (s *Store) SaveWorkflowDraft(ctx context.Context, workflowID string, activeIndex int, draftsJSON string) (*model.WorkflowDraft, error)
SaveWorkflowDraft 保存或更新工作流草稿数据
func (*Store) SeedBuiltinNorms ¶ added in v1.5.0
func (*Store) SendFeedback ¶
func (*Store) SetWaitPolicy ¶
func (s *Store) SetWaitPolicy(ctx context.Context, input model.SetWaitPolicyInput) (*model.MutationResult, error)
func (*Store) SetWorkflowPhase ¶ added in v1.1.0
func (*Store) SetWorkflowPhaseConfig ¶ added in v1.1.0
func (*Store) SubmitFeedback ¶
func (s *Store) SubmitFeedback(ctx context.Context, input SubmitFeedbackInput) (*model.FeedbackSession, error)
func (*Store) SupersedeOldCheckpoints ¶ added in v1.1.0
func (*Store) UnarchiveFeedbackSession ¶
func (*Store) UpdateCheckpointStatus ¶ added in v1.1.0
func (*Store) UpdateCredential ¶ added in v1.1.0
func (*Store) UpdateNote ¶ added in v1.1.0
func (*Store) UpdateSessionMaxChecks ¶
func (*Store) UpdateSessionPromptWait ¶
func (*Store) UpdateSessionUserPresence ¶
func (*Store) UpdateSessionWaitCountdown ¶
func (*Store) UpdateStages ¶ added in v1.1.0
func (s *Store) UpdateStages(ctx context.Context, input model.UpdateStagesInput) (*model.MutationResult, error)
func (*Store) UpdateTask ¶
func (s *Store) UpdateTask(ctx context.Context, input model.UpdateTaskInput) (*model.MutationResult, error)
func (*Store) UpdateTaskHeartbeat ¶ added in v1.1.0
func (*Store) UpdateUserNorm ¶ added in v1.1.0
type SubmitFeedbackInput ¶
type SubmitFeedbackInput struct {
SessionID string `json:"session_id"`
ResponseText string `json:"response_text"`
UserMessages []string `json:"user_messages,omitempty"`
Images []model.SessionImage `json:"images,omitempty"`
}