Documentation
¶
Overview ¶
Package backend owns conversation execution, later-work, and cron.
Index ¶
- Constants
- Variables
- func DeleteSessionIn(ctx context.Context, databaseURL, conversationID string) (int64, error)
- func ExternalMCPAgentsIn(cfg *config.Config, runtimeDir string) ([]string, error)
- func IsBridgeStopped(err error) bool
- func LintTry(workspace, runtimeDir string, overlays []string, baseOverlay string, ...) (protocol.LintResult, error)
- func LoadRuntimeDefinitions(cfg *config.Config, runtimeDir string) (rocketcode.Agents, rocketcode.Skills, error)
- func NoopActivationHook(_ context.Context, _ *protocol.InboundMessage) error
- func OverlayContextFromSkel(got skel.OverlayContext) protocol.OverlayContext
- func Run(ctx context.Context, cfg *config.Config, configPath string, ...) error
- func RunTryTurn(ctx context.Context, workspace, runtimeDir string, overlays []string, ...) (thinking, answer string, err error)
- func ValidateGoalCheckScriptStart(cfg *config.Config, agentName, script string) error
- func ValidateRuntimeDefinitions(workspace, runtimeDir string, channels []string) error
- type ActiveTurnState
- type Bridge
- func (b *Bridge) InterruptActiveTurn() *protocol.InboundMessage
- func (b *Bridge) PickLaterWork(ctx context.Context) error
- func (b *Bridge) RecoverActiveTurn(ctx context.Context, turn *ActiveTurnState) error
- func (b *Bridge) ResetScheduledMessages() error
- func (b *Bridge) ScheduleMessage(delay time.Duration, message string, recurring bool) error
- func (b *Bridge) Start(ctx context.Context) error
- func (b *Bridge) Stop() error
- func (b *Bridge) Submit(ctx context.Context, msg *protocol.InboundMessage) error
- func (b *Bridge) SubmitWhenActive(ctx context.Context, msg *protocol.InboundMessage, ...) error
- func (b *Bridge) SwitchAgent(agent string)
- type Config
- type CronScheduleRun
- type CronScheduleState
- type DevelopmentChat
- type DevelopmentTurnResult
- type EnqueueActivation
- type ExternalMCPSessionState
- type GoalState
- type KeyedConversationLocks
- type Manager
- func (m *Manager) ListCronjobs(channel string) ([]string, error)
- func (m *Manager) LoadOneOffCronjob(target string) (protocol.OneOffCronjob, error)
- func (m *Manager) RunOneOffCronjob(ctx context.Context, job protocol.OneOffCronjob, ...)
- func (m *Manager) Start(ctx context.Context) error
- func (m *Manager) Stop(ctx context.Context) error
- type ObservedSessionEntry
- type PruneStateStats
- type RawRunProgress
- type RawRunResult
- type RunFunc
- type Runtime
- type SessionListOptions
- type SessionService
- func (s *SessionService) AccountGoalTurn(conversationID string) (GoalState, bool, error)
- func (s *SessionService) ActiveGoalThreads() (map[string]ThreadState, error)
- func (s *SessionService) ActiveGoals() (map[string]GoalState, error)
- func (s *SessionService) ActiveTurn(ctx context.Context, turnID string) (ActiveTurnState, bool, error)
- func (s *SessionService) AppendEntryID(ctx context.Context, conversationID string, entry *harness.SessionEntry) (int64, error)
- func (s *SessionService) ApplyPendingRestartNotifications(ctx context.Context) error
- func (s *SessionService) BeginGoal(conversationID, objective, checkScript string, maxTurns int, ...) error
- func (s *SessionService) ClaimCronSchedule(due CronScheduleState, nextDue, now time.Time) (CronScheduleRun, bool, error)
- func (s *SessionService) ClaimScheduledMessage(id, conversationID string, dueAt, now time.Time) (message protocol.ScheduledMessageState, claimed bool, err error)
- func (s *SessionService) ClearActiveTurn(ctx context.Context, turnID string) error
- func (s *SessionService) CompleteCronRun(relativePath string, now time.Time) error
- func (s *SessionService) DeleteScheduledMessage(id string) error
- func (s *SessionService) DeleteThreadQueueItem(id string) error
- func (s *SessionService) DueCronSchedules(now time.Time, limit int) ([]CronScheduleState, error)
- func (s *SessionService) ExternalMCPSession(externalConversationID string) (ExternalMCPSessionState, bool, error)
- func (s *SessionService) ExternalMCPSessionByConversationID(conversationID string) (externalConversationID string, session ExternalMCPSessionState, ok bool, ...)
- func (s *SessionService) Goal(conversationID string) (GoalState, bool, error)
- func (s *SessionService) MarkRestartRequester(ctx context.Context, conversationID string) error
- func (s *SessionService) ObserveEntries(ctx context.Context, conversationID string, lastID int64) ([]ObservedSessionEntry, error)
- func (s *SessionService) PairBusy(pairID string) bool
- func (s *SessionService) PairBusyFor(pairID, conversationID string) bool
- func (s *SessionService) PruneStateBefore(ctx context.Context, cutoff time.Time) (PruneStateStats, error)
- func (s *SessionService) PutMCPWaiter(id string, inbound *protocol.InboundMessage)
- func (s *SessionService) PutScheduledMessage(id string, message *protocol.ScheduledMessageState) error
- func (s *SessionService) PutThreadQueueItem(id string, item *protocol.ThreadQueueItem) error
- func (s *SessionService) RecoverableActiveTurns(ctx context.Context) ([]ActiveTurnState, error)
- func (s *SessionService) RegisterExternalMCPConversation(externalConversationID, managedAgent string, session *ExternalMCPSessionState) error
- func (s *SessionService) ReleaseExternalMCPRecovery(conversationID string) error
- func (s *SessionService) RemoveExternalMCPConversation(externalConversationID string) error
- func (s *SessionService) ReserveExternalMCPRecovery(conversationID string) error
- func (s *SessionService) ReserveWorkflowTurn(conversationID string) (release func(), reserved bool, err error)
- func (s *SessionService) ResetCronSchedules() error
- func (s *SessionService) ResetScheduledMessages(conversationID string) error
- func (s *SessionService) ScheduledMessages() (map[string]protocol.ScheduledMessageState, error)
- func (s *SessionService) ScheduledMessagesForConversation(conversationID string) (map[string]protocol.ScheduledMessageState, error)
- func (s *SessionService) SetPendingSteers(conversationID string, steers []protocol.PendingSteer) error
- func (s *SessionService) SetThreadAgentIfExists(conversationID, agent string) (bool, error)
- func (s *SessionService) StartActiveTurn(ctx context.Context, checkpoint *harness.ActiveTurnCheckpoint) error
- func (s *SessionService) Stop(context.Context) error
- func (s *SessionService) StopGoal(conversationID string) error
- func (s *SessionService) SyncCronSchedules(schedules []CronScheduleState, now time.Time) error
- func (s *SessionService) TakeMCPWaiter(id string) *protocol.InboundMessage
- func (s *SessionService) Thread(conversationID string) (ThreadState, bool, error)
- func (s *SessionService) ThreadQueueForConversation(conversationID string) ([]protocol.ThreadQueueItem, error)
- func (s *SessionService) UpdateGoalStatus(conversationID, status, note string) (GoalState, error)
- func (s *SessionService) UpsertActiveTurn(ctx context.Context, checkpoint *harness.ActiveTurnCheckpoint, ...) error
- func (s *SessionService) UpsertExternalMCPSession(externalConversationID string, session *ExternalMCPSessionState) error
- func (s *SessionService) UpsertThread(conversationID string, thread ThreadState) error
- type SessionSummary
- type SideAskRunner
- type SlackFrontend
- type ThreadCreator
- type ThreadState
Constants ¶
const ( GoalStatusActive = "active" GoalStatusProgress = "progress" GoalStatusComplete = "complete" GoalStatusBlocked = "blocked" GoalStatusStopped = "stopped" GoalStatusBudgetExhausted = "budget_exhausted" )
GoalStatusActive and related constants are persisted goal-loop statuses.
const RawRunExposedToolName = rawRunToolName
RawRunExposedToolName is the tool cron prompts use for human-visible output.
Variables ¶
var ErrRestartRequested = errors.New("restart requested")
ErrRestartRequested indicates rocketclaw should exit so a supervisor can restart it.
Functions ¶
func DeleteSessionIn ¶
DeleteSessionIn removes all entries for one conversation ID and returns deleted rows.
func ExternalMCPAgentsIn ¶
ExternalMCPAgentsIn returns agents externally selectable through MCP in runtimeDir.
func IsBridgeStopped ¶
IsBridgeStopped reports whether err was caused by a stopped bridge.
func LintTry ¶
func LintTry(workspace, runtimeDir string, overlays []string, baseOverlay string, files []protocol.OverlayFile, cfg *config.Config, logger *slog.Logger) (protocol.LintResult, error)
LintTry stages a try tree and lints it.
func LoadRuntimeDefinitions ¶
func LoadRuntimeDefinitions(cfg *config.Config, runtimeDir string) (rocketcode.Agents, rocketcode.Skills, error)
LoadRuntimeDefinitions loads RocketCode definitions from runtimeDir without starting a run.
func NoopActivationHook ¶
func NoopActivationHook(_ context.Context, _ *protocol.InboundMessage) error
NoopActivationHook leaves queued request activation unchanged.
func OverlayContextFromSkel ¶
func OverlayContextFromSkel(got skel.OverlayContext) protocol.OverlayContext
OverlayContextFromSkel copies a live overlay clone into protocol form.
func Run ¶
func Run(ctx context.Context, cfg *config.Config, configPath string, logger *slog.Logger, assemble func(*Runtime) (SlackFrontend, <-chan struct{}, []func(context.Context) error, error)) error
Run starts rocketclaw and blocks until the context is canceled or a fatal error occurs.
func RunTryTurn ¶
func RunTryTurn(ctx context.Context, workspace, runtimeDir string, overlays []string, cfg *config.Config, logger *slog.Logger, chat *DevelopmentChat, baseOverlay string, files []protocol.OverlayFile, agent, prompt string) (thinking, answer string, err error)
RunTryTurn stages a try tree and runs one Development MCP chat turn.
func ValidateGoalCheckScriptStart ¶
ValidateGoalCheckScriptStart validates a goal check script before goal persistence.
func ValidateRuntimeDefinitions ¶
ValidateRuntimeDefinitions loads cron definitions from runtimeDir without mutating scheduler state.
Types ¶
type ActiveTurnState ¶
type ActiveTurnState struct {
Checkpoint harness.ActiveTurnCheckpoint `json:"checkpoint"`
SourceMetadata map[string]string `json:"source_metadata,omitempty"`
PendingSteers []protocol.PendingSteer `json:"pending_steers,omitempty"`
CreatedAt time.Time `json:"created_at,omitzero"`
UpdatedAt time.Time `json:"updated_at,omitzero"`
}
ActiveTurnState records one durable RocketCode active-turn checkpoint.
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge forwards rocketclaw messages into one turn-lived rocketcode run per turn.
func NewConversation ¶
func NewConversation(cfg *config.Config, publisher protocol.OutboundPublisher, bridgeCfg *Config, logger *slog.Logger) *Bridge
NewConversation constructs a rocketcode bridge for one conversation.
func (*Bridge) InterruptActiveTurn ¶
func (b *Bridge) InterruptActiveTurn() *protocol.InboundMessage
InterruptActiveTurn interrupts current work and clears queued work for this bridge.
func (*Bridge) PickLaterWork ¶
PickLaterWork submits the R16 winner after a turn ends, or when a due timer fires on an idle thread.
func (*Bridge) RecoverActiveTurn ¶
func (b *Bridge) RecoverActiveTurn(ctx context.Context, turn *ActiveTurnState) error
RecoverActiveTurn enqueues a startup recovery continuation for this conversation.
func (*Bridge) ResetScheduledMessages ¶
ResetScheduledMessages deletes pending scheduled prompts for this conversation.
func (*Bridge) ScheduleMessage ¶
ScheduleMessage schedules one delayed prompt for this conversation.
func (*Bridge) SubmitWhenActive ¶
func (b *Bridge) SubmitWhenActive(ctx context.Context, msg *protocol.InboundMessage, activation protocol.ActivationHook) error
SubmitWhenActive enqueues one inbound message and runs activation after earlier requests finish.
func (*Bridge) SwitchAgent ¶
SwitchAgent changes the agent used for future turns in this conversation.
type Config ¶
type Config struct {
ConversationID, Agent, AgentAfterRecovery, ManagedConversationID, ExternalConversationID string
OutputTargets []protocol.OutputTarget
RecoveringActiveTurn bool
RequestRestart func(context.Context, string) (string, error)
RequestReload func(context.Context, string) (string, error)
UserQuestionAsker protocol.UserQuestionAsker
StartNewThread func(context.Context, *protocol.StartNewThreadRequest) (protocol.StartNewThreadResult, error)
SessionService *SessionService
SteerDrain rocketcode.SteerDrain
EnqueueActivation EnqueueActivation
}
Config controls one rocketcode bridge conversation.
type CronScheduleRun ¶
CronScheduleRun is a claimed scheduled cron run.
type CronScheduleState ¶
CronScheduleState records one observed scheduled cron trigger.
type DevelopmentChat ¶
type DevelopmentChat struct {
// contains filtered or unexported fields
}
DevelopmentChat is in-memory session history for Development MCP turns.
type DevelopmentTurnResult ¶
type DevelopmentTurnResult struct {
Thinking, Answer string
}
DevelopmentTurnResult is one Development MCP chat turn.
func RunDevelopmentTurn ¶
func RunDevelopmentTurn(ctx context.Context, cfg *config.Config, runtimeDir, agent, prompt string, logger *slog.Logger, chat *DevelopmentChat) (DevelopmentTurnResult, error)
RunDevelopmentTurn runs one live-tools chat turn against a try tree.
type EnqueueActivation ¶
type EnqueueActivation struct {
Fn func(context.Context, *protocol.ThreadQueueItem, *protocol.InboundMessage) error
}
EnqueueActivation posts the consume card for a popped Enqueued Slack Message. The zero value is inert.
func (EnqueueActivation) Activate ¶
func (a EnqueueActivation) Activate(ctx context.Context, item *protocol.ThreadQueueItem, inbound *protocol.InboundMessage) error
Activate runs the consume-card hook, or does nothing when the hook is unset.
type ExternalMCPSessionState ¶
type ExternalMCPSessionState struct {
Agent string `json:"agent,omitempty"`
PrivateConversationID string `json:"private_conversation_id,omitempty"`
ManagedConversationID string `json:"managed_conversation_id,omitempty"`
SlackChannel string `json:"slack_channel,omitempty"`
}
ExternalMCPSessionState binds an external MCP conversation ID to private and managed sessions.
type GoalState ¶
type GoalState struct {
Objective string `json:"objective,omitempty"`
CheckScript string `json:"check_script,omitempty"`
MaxTurns int `json:"max_turns,omitempty"`
TurnsUsed int `json:"turns_used,omitempty"`
Status string `json:"status,omitempty"`
Note string `json:"note,omitempty"`
SlackRecipientTeamID string `json:"slack_recipient_team_id,omitempty"`
SlackRecipientUserID string `json:"slack_recipient_user_id,omitempty"`
CreatedAt time.Time `json:"created_at,omitzero"`
UpdatedAt time.Time `json:"updated_at,omitzero"`
}
GoalState records one active or terminal managed-thread goal loop.
type KeyedConversationLocks ¶
type KeyedConversationLocks struct {
// contains filtered or unexported fields
}
KeyedConversationLocks serializes work per conversation id.
func NewKeyedConversationLocks ¶
func NewKeyedConversationLocks() *KeyedConversationLocks
NewKeyedConversationLocks constructs an empty lock set.
func (*KeyedConversationLocks) Lock ¶
func (l *KeyedConversationLocks) Lock(key string) func()
Lock serializes one conversation id and returns the unlock function.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager loads and runs workspace cron definitions.
func New ¶
func New(workspace, runtimeDir string, channels []string, broadcasts chan<- protocol.Broadcast, store cronScheduleStore, run RunFunc, logger *slog.Logger) *Manager
New constructs a cronjob manager using runtimeDir for effective runtime cron definitions.
func (*Manager) ListCronjobs ¶
ListCronjobs returns top-level cron stems whose configured channel matches channel.
func (*Manager) LoadOneOffCronjob ¶
func (m *Manager) LoadOneOffCronjob(target string) (protocol.OneOffCronjob, error)
LoadOneOffCronjob resolves and loads one live cronjob for a managed Slack thread run.
func (*Manager) RunOneOffCronjob ¶
func (m *Manager) RunOneOffCronjob(ctx context.Context, job protocol.OneOffCronjob, progress *protocol.CronProgress, finish func(context.Context, protocol.CronRunResult, error))
RunOneOffCronjob executes a loaded cronjob once with optional progress delivery.
type ObservedSessionEntry ¶
type ObservedSessionEntry struct {
ID int64
Entry harness.SessionEntry
}
ObservedSessionEntry is one stored rocketcode entry with its row ID.
func ObserveSessionEntries ¶
func ObserveSessionEntries(ctx context.Context, databaseURL, conversationID string, lastID int64) ([]ObservedSessionEntry, error)
ObserveSessionEntries returns replay entries and their row IDs after lastID.
type PruneStateStats ¶
PruneStateStats reports how much stale persisted state was removed.
type RawRunProgress ¶
type RawRunProgress struct {
SessionService *SessionService
ConversationID string
Thinking, Message func(context.Context, string) error
RequestRestart func(context.Context, string) (string, error)
RequestReload func(context.Context, string) (string, error)
StartNewThread func(context.Context, *protocol.StartNewThreadRequest) (protocol.StartNewThreadResult, error)
TextChannel string
}
RawRunProgress controls raw rocketcode run persistence and receives observable output.
type RawRunResult ¶
type RawRunResult struct {
Text, VerbatimMessage string
Attachments []protocol.OutboundAttachment
}
RawRunResult is the observable result of one non-publishing raw rocketcode turn.
func RunRawWithProgress ¶
func RunRawWithProgress(ctx context.Context, cfg *config.Config, agent, prompt string, logger *slog.Logger, progress *RawRunProgress) (result RawRunResult, err error)
RunRawWithProgress executes a raw rocketcode turn and reports optional progress.
type RunFunc ¶
type RunFunc func(context.Context, string, string, *slog.Logger, *RawRunProgress) (protocol.CronRunResult, error)
RunFunc executes one cronjob prompt and returns the cronjob result.
type Runtime ¶
type Runtime struct {
Cfg *config.Config
ConfigPath string
Log *slog.Logger
RunCtx context.Context
Channels protocol.Channels
Sessions *SessionService
Cron *Manager
OverlayMu *sync.Mutex
Reload func(context.Context, string) (string, error)
Restart func(context.Context, string) (string, error)
RecoveredTurns []ActiveTurnState
CannotResume []cannotResumeItem
ExternalMCPUsers map[string]string
RefreshExternalMCPAgents *func() error
TextRouter protocol.PrimaryTextRouter
// contains filtered or unexported fields
}
Runtime is the backend after construction, before frontends.
func (*Runtime) AttachSlack ¶
func (r *Runtime) AttachSlack(slack SlackFrontend)
AttachSlack hooks originator Slack methods into backend thread state.
func (*Runtime) SubmitExternalMCP ¶
func (r *Runtime) SubmitExternalMCP(ctx context.Context, agent, conversationID string, inbound *protocol.InboundMessage, activation protocol.ActivationHook) error
SubmitExternalMCP submits one External MCP inbound.
type SessionListOptions ¶
SessionListOptions bounds read-only session summary inspection.
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
SessionService owns runtime PostgreSQL session and state access inside one rocketclaw process.
func NewSessionServiceIn ¶
func NewSessionServiceIn(databaseURL string, logger *slog.Logger) (*SessionService, error)
NewSessionServiceIn starts a runtime-owned PostgreSQL session service.
func (*SessionService) AccountGoalTurn ¶
func (s *SessionService) AccountGoalTurn(conversationID string) (GoalState, bool, error)
AccountGoalTurn increments one active goal turn and applies budget exhaustion.
func (*SessionService) ActiveGoalThreads ¶
func (s *SessionService) ActiveGoalThreads() (map[string]ThreadState, error)
ActiveGoalThreads returns managed thread state for conversations with active goals.
func (*SessionService) ActiveGoals ¶
func (s *SessionService) ActiveGoals() (map[string]GoalState, error)
ActiveGoals returns persisted active goals keyed by conversation ID.
func (*SessionService) ActiveTurn ¶
func (s *SessionService) ActiveTurn(ctx context.Context, turnID string) (ActiveTurnState, bool, error)
ActiveTurn returns a durable active-turn checkpoint.
func (*SessionService) AppendEntryID ¶
func (s *SessionService) AppendEntryID(ctx context.Context, conversationID string, entry *harness.SessionEntry) (int64, error)
AppendEntryID appends one entry through the runtime service and returns its row ID.
func (*SessionService) ApplyPendingRestartNotifications ¶
func (s *SessionService) ApplyPendingRestartNotifications(ctx context.Context) error
ApplyPendingRestartNotifications appends one developer notice to pending requester sessions.
func (*SessionService) BeginGoal ¶
func (s *SessionService) BeginGoal(conversationID, objective, checkScript string, maxTurns int, recipientTeamID, recipientUserID string) error
BeginGoal records a new active goal for a managed conversation.
func (*SessionService) ClaimCronSchedule ¶
func (s *SessionService) ClaimCronSchedule(due CronScheduleState, nextDue, now time.Time) (CronScheduleRun, bool, error)
ClaimCronSchedule verifies one due scheduled cron trigger and records per-file running state.
func (*SessionService) ClaimScheduledMessage ¶
func (s *SessionService) ClaimScheduledMessage(id, conversationID string, dueAt, now time.Time) (message protocol.ScheduledMessageState, claimed bool, err error)
ClaimScheduledMessage verifies one due scheduled message and advances recurring messages atomically.
func (*SessionService) ClearActiveTurn ¶
func (s *SessionService) ClearActiveTurn(ctx context.Context, turnID string) error
ClearActiveTurn removes an active root-turn checkpoint.
func (*SessionService) CompleteCronRun ¶
func (s *SessionService) CompleteCronRun(relativePath string, now time.Time) error
CompleteCronRun clears per-file scheduled cron running state.
func (*SessionService) DeleteScheduledMessage ¶
func (s *SessionService) DeleteScheduledMessage(id string) error
DeleteScheduledMessage deletes one scheduled message.
func (*SessionService) DeleteThreadQueueItem ¶
func (s *SessionService) DeleteThreadQueueItem(id string) error
DeleteThreadQueueItem deletes one Enqueued Slack Message.
func (*SessionService) DueCronSchedules ¶
func (s *SessionService) DueCronSchedules(now time.Time, limit int) ([]CronScheduleState, error)
DueCronSchedules returns observed scheduled cron definitions due at now.
func (*SessionService) ExternalMCPSession ¶
func (s *SessionService) ExternalMCPSession(externalConversationID string) (ExternalMCPSessionState, bool, error)
ExternalMCPSession returns a persisted external MCP session mapping.
func (*SessionService) ExternalMCPSessionByConversationID ¶
func (s *SessionService) ExternalMCPSessionByConversationID(conversationID string) (externalConversationID string, session ExternalMCPSessionState, ok bool, err error)
ExternalMCPSessionByConversationID returns the public ID and binding for either session ID.
func (*SessionService) Goal ¶
func (s *SessionService) Goal(conversationID string) (GoalState, bool, error)
Goal returns the persisted goal state for a conversation.
func (*SessionService) MarkRestartRequester ¶
func (s *SessionService) MarkRestartRequester(ctx context.Context, conversationID string) error
MarkRestartRequester records that conversationID should see the post-restart notice.
func (*SessionService) ObserveEntries ¶
func (s *SessionService) ObserveEntries(ctx context.Context, conversationID string, lastID int64) ([]ObservedSessionEntry, error)
ObserveEntries loads observed session entries through the runtime service.
func (*SessionService) PairBusy ¶
func (s *SessionService) PairBusy(pairID string) bool
PairBusy reports whether the named conversation pair currently holds a turn.
func (*SessionService) PairBusyFor ¶
func (s *SessionService) PairBusyFor(pairID, conversationID string) bool
PairBusyFor reports whether pairID is busy for a caller other than conversationID.
func (*SessionService) PruneStateBefore ¶
func (s *SessionService) PruneStateBefore(ctx context.Context, cutoff time.Time) (PruneStateStats, error)
PruneStateBefore removes expired thread and external-session state.
func (*SessionService) PutMCPWaiter ¶
func (s *SessionService) PutMCPWaiter(id string, inbound *protocol.InboundMessage)
PutMCPWaiter records an MCP turn waiting on a later-work queue row.
func (*SessionService) PutScheduledMessage ¶
func (s *SessionService) PutScheduledMessage(id string, message *protocol.ScheduledMessageState) error
PutScheduledMessage persists one scheduled message.
func (*SessionService) PutThreadQueueItem ¶
func (s *SessionService) PutThreadQueueItem(id string, item *protocol.ThreadQueueItem) error
PutThreadQueueItem persists one Enqueued Slack Message.
func (*SessionService) RecoverableActiveTurns ¶
func (s *SessionService) RecoverableActiveTurns(ctx context.Context) ([]ActiveTurnState, error)
RecoverableActiveTurns returns remaining active-turn handoff rows for startup recovery.
func (*SessionService) RegisterExternalMCPConversation ¶
func (s *SessionService) RegisterExternalMCPConversation(externalConversationID, managedAgent string, session *ExternalMCPSessionState) error
RegisterExternalMCPConversation atomically persists a managed conversation and its public binding.
func (*SessionService) ReleaseExternalMCPRecovery ¶
func (s *SessionService) ReleaseExternalMCPRecovery(conversationID string) error
ReleaseExternalMCPRecovery releases paired work after recovery is abandoned.
func (*SessionService) RemoveExternalMCPConversation ¶
func (s *SessionService) RemoveExternalMCPConversation(externalConversationID string) error
RemoveExternalMCPConversation removes a failed newly-created conversation and all of its durable state.
func (*SessionService) ReserveExternalMCPRecovery ¶
func (s *SessionService) ReserveExternalMCPRecovery(conversationID string) error
ReserveExternalMCPRecovery makes paired work wait for the recovering owner.
func (*SessionService) ReserveWorkflowTurn ¶
func (s *SessionService) ReserveWorkflowTurn(conversationID string) (release func(), reserved bool, err error)
ReserveWorkflowTurn reserves paired turn ownership for a managed workflow.
func (*SessionService) ResetCronSchedules ¶
func (s *SessionService) ResetCronSchedules() error
ResetCronSchedules clears scheduled cron state at daemon observation start.
func (*SessionService) ResetScheduledMessages ¶
func (s *SessionService) ResetScheduledMessages(conversationID string) error
ResetScheduledMessages deletes pending scheduled messages for one conversation.
func (*SessionService) ScheduledMessages ¶
func (s *SessionService) ScheduledMessages() (map[string]protocol.ScheduledMessageState, error)
ScheduledMessages returns all persisted scheduled messages.
func (*SessionService) ScheduledMessagesForConversation ¶
func (s *SessionService) ScheduledMessagesForConversation(conversationID string) (map[string]protocol.ScheduledMessageState, error)
ScheduledMessagesForConversation returns persisted scheduled messages for one conversation.
func (*SessionService) SetPendingSteers ¶
func (s *SessionService) SetPendingSteers(conversationID string, steers []protocol.PendingSteer) error
SetPendingSteers copies uninjected Slack Steers onto the conversation's active-turn row.
func (*SessionService) SetThreadAgentIfExists ¶
func (s *SessionService) SetThreadAgentIfExists(conversationID, agent string) (bool, error)
SetThreadAgentIfExists updates a managed conversation agent without creating a thread.
func (*SessionService) StartActiveTurn ¶
func (s *SessionService) StartActiveTurn(ctx context.Context, checkpoint *harness.ActiveTurnCheckpoint) error
StartActiveTurn upserts a durable active root-turn checkpoint.
func (*SessionService) Stop ¶
func (s *SessionService) Stop(context.Context) error
Stop closes the runtime service and its database handle.
func (*SessionService) StopGoal ¶
func (s *SessionService) StopGoal(conversationID string) error
StopGoal marks an active goal stopped.
func (*SessionService) SyncCronSchedules ¶
func (s *SessionService) SyncCronSchedules(schedules []CronScheduleState, now time.Time) error
SyncCronSchedules replaces observed scheduled cron definitions.
func (*SessionService) TakeMCPWaiter ¶
func (s *SessionService) TakeMCPWaiter(id string) *protocol.InboundMessage
TakeMCPWaiter removes and returns the MCP waiter for a queue row.
func (*SessionService) Thread ¶
func (s *SessionService) Thread(conversationID string) (ThreadState, bool, error)
Thread returns the persisted managed conversation state.
func (*SessionService) ThreadQueueForConversation ¶
func (s *SessionService) ThreadQueueForConversation(conversationID string) ([]protocol.ThreadQueueItem, error)
ThreadQueueForConversation returns Enqueued Slack Messages in stack order.
func (*SessionService) UpdateGoalStatus ¶
func (s *SessionService) UpdateGoalStatus(conversationID, status, note string) (GoalState, error)
UpdateGoalStatus records a model-controlled goal status update.
func (*SessionService) UpsertActiveTurn ¶
func (s *SessionService) UpsertActiveTurn(ctx context.Context, checkpoint *harness.ActiveTurnCheckpoint, sourceMetadata map[string]string) error
UpsertActiveTurn records a RocketCode active-turn restart handoff checkpoint with source metadata.
func (*SessionService) UpsertExternalMCPSession ¶
func (s *SessionService) UpsertExternalMCPSession(externalConversationID string, session *ExternalMCPSessionState) error
UpsertExternalMCPSession records an external MCP conversation ID mapping.
func (*SessionService) UpsertThread ¶
func (s *SessionService) UpsertThread(conversationID string, thread ThreadState) error
UpsertThread records or updates a text-thread bridge entry.
type SessionSummary ¶
type SessionSummary struct {
ConversationID, LastUserMessage, LastAssistantMessage string
Turns int
LastUpdated time.Time
}
SessionSummary is the compact observable state of one rocketcode session.
func ListSessionsInOptions ¶
func ListSessionsInOptions(ctx context.Context, databaseURL string, options SessionListOptions) ([]SessionSummary, error)
ListSessionsInOptions returns summaries for stored rocketcode sessions.
type SideAskRunner ¶
type SideAskRunner struct {
Config *config.Config
Sessions *SessionService
Logger *slog.Logger
}
SideAskRunner runs one isolated Slack Side Ask against prefixed thread history.
func (SideAskRunner) Run ¶
func (r SideAskRunner) Run(ctx context.Context, req protocol.SideAskRequest) error
Run loads history through the stamped entry and executes one private RocketCode turn.
type SlackFrontend ¶
type SlackFrontend interface {
HandleBroadcast(context.Context, *protocol.Broadcast) protocol.BroadcastAcknowledgement
Start(context.Context) error
Stop(context.Context) error
SendResponse(context.Context, *protocol.OutboundMessage) error
AbortResponse(*protocol.OutboundMessage)
StartNewThreadRoot(context.Context, *protocol.StartNewThreadRequest) (protocol.StartNewThreadRootResult, error)
AskUserQuestion(context.Context, *protocol.AskUserQuestionRequest) (protocol.AskUserQuestionAnswer, error)
DrainSteers(context.Context, string) []string
ActivateEnqueue(context.Context, *protocol.ThreadQueueItem, *protocol.InboundMessage) error
SetPendingSteersSink(protocol.PendingSteersSink)
RestorePendingSteers(string, []protocol.PendingSteer)
DiscardPendingSteers(context.Context, []protocol.PendingSteer)
}
SlackFrontend is the Slack surface cmd constructs.
type ThreadCreator ¶
type ThreadCreator string
ThreadCreator records which subsystem created a managed text conversation.
const ThreadCreatedByCron ThreadCreator = "cron"
ThreadCreatedByCron marks managed conversations created for cron output.
type ThreadState ¶
type ThreadState struct {
Agent string `json:"agent,omitempty"`
CreatedBy ThreadCreator `json:"created_by,omitempty"`
}
ThreadState is the persisted state for one text-thread bridge.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package harnessbridgetest holds test helpers for backend.
|
Package harnessbridgetest holds test helpers for backend. |