Documentation
¶
Overview ¶
Package casebound hosts the case-channel agent: a Slack mention in the channel of a channel-mode Case. The turn runs as a durable agentkit process on the ReAct strategy, so this package spawns it and finishes it; Slack SDK imports are forbidden here and everything user-facing crosses the Host port as plain text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConversationMessage ¶
ConversationMessage is a single pre-fetched Slack message handed to the runtime. The host resolves display names; the runtime only formats.
type Host ¶ added in v0.3.0
type Host interface {
// Reply posts the agent's answer to the thread.
Reply(ctx context.Context, channelID, threadTS, text string) error
// ReportFailure tells the user the turn could not finish. reason is the
// technical cause; the host decides how much of it to show.
ReportFailure(ctx context.Context, channelID, threadTS, reason string) error
}
Host is the Slack-facing surface a finished turn needs.
It exists because a turn no longer ends where it started: the run is a durable process, so its answer is posted from the completion handler — on whichever instance committed the terminal transition — rather than by the caller of StartTurn.
type HostFuncs ¶ added in v0.3.0
type HostFuncs struct {
ReplyFn func(ctx context.Context, channelID, threadTS, text string) error
ReportFailureFn func(ctx context.Context, channelID, threadTS, reason string) error
}
HostFuncs is a struct-of-funcs adapter for tests and minimal hosts. A missing entry is an error rather than a no-op: silently dropping the answer to a mention is indistinguishable from the agent having had nothing to say.
type Result ¶
type Result struct {
Status Status
// ProcessID names the run. Set for StatusStarted, and for StatusDuplicate
// where it names the run the earlier delivery started.
ProcessID agentkit.ProcessID
// Busy describes the run holding the thread, when it could still be read.
Busy *agentkernel.BusyTurn
}
Result is the outcome of StartTurn.
type TurnRequest ¶
type TurnRequest struct {
// Session is the persisted Session for this thread. It must already exist:
// its ID is the turn-lock subject, so the row has to be claimed before a
// turn can be spawned.
Session *model.Session
ChannelID string
ThreadTS string
MentionTS string
MentionText string
// MentionUserID is the Slack user who mentioned the bot. It becomes the
// access actor for the whole run, so tools see exactly what that person may
// see. A turn without it is refused: a run with no actor is read by the
// usecase layer as a system context and would bypass private-case access
// control entirely.
MentionUserID string
BotUserID string
Workspace *model.WorkspaceEntry
Case *model.Case
Actions []*model.Action
CurrentAction *model.Action
// SystemMessages is the conversation snapshot inlined into the system
// prompt; it is non-empty only for a fresh session. DeltaMessages is what
// arrived since the previous mention.
SystemMessages []ConversationMessage
DeltaMessages []ConversationMessage
// TriggerTS is the Slack TS of the event that started this turn. It is the
// idempotency key, which is what makes a re-delivered Slack event resolve to
// the run it already started instead of starting a second one.
TriggerTS string
}
TurnRequest collects what the host resolved before handing control over. The runtime never touches the Slack service: the conversation is pre-fetched and everything user-facing goes back through Host.
type UseCase ¶
type UseCase struct {
// contains filtered or unexported fields
}
UseCase starts and finishes case-channel agent turns.
A turn is a durable process: StartTurn builds the prompts and spawns it, then returns. The run is driven by the agent worker one checkpointed transition at a time, and its answer is posted by onFinish.
func New ¶
func New(repo interfaces.Repository, host Host, locator agentkernel.Locator, models agentkernel.ModelPolicy, ) (*UseCase, error)
New builds a casebound UseCase. locator is used only to describe the run holding a thread when a turn is refused as busy; a nil locator leaves that description empty rather than failing the turn.