Documentation
¶
Index ¶
- Variables
- type ConversationSummary
- type CreateConversationRequest
- type CreateConversationResponse
- type GetRequest
- type GetResponse
- type PostRequest
- type Service
- func (s *Service) Approve(ctx context.Context, messageID, action, reason string) error
- func (s *Service) AttachApproval(svc approval.Service)
- func (s *Service) AttachCore(core *corellm.Service)
- func (s *Service) AttachDefaults(d *execcfg.Defaults)
- func (s *Service) AttachElicitationService(es *elicitation.Service)
- func (s *Service) AttachFileService(fs *fservice.Service)
- func (s *Service) AttachManager(mgr *conversation.Manager, tp *tool.Policy, fp *fluxpol.Policy)
- func (s *Service) AttacheAgentFinder(agentFinder agent.Finder)
- func (s *Service) Cancel(conversationID string) bool
- func (s *Service) CancelTurn(turnID string) bool
- func (s *Service) Compact(ctx context.Context, conversationID string) error
- func (s *Service) ConversationClient() apiconv.Client
- func (s *Service) CreateConversation(ctx context.Context, in CreateConversationRequest) (*CreateConversationResponse, error)
- func (s *Service) DAO() *datly.Service
- func (s *Service) DeleteConversation(ctx context.Context, id string) error
- func (s *Service) DeleteMessage(ctx context.Context, convID, messageID string) error
- func (s *Service) Elicit(ctx context.Context, messageID, action string, payload map[string]interface{}) error
- func (s *Service) ElicitationService() *elicitation.Service
- func (s *Service) Generate(ctx context.Context, input *corellm.GenerateInput) (*corellm.GenerateOutput, error)
- func (s *Service) Get(ctx context.Context, req GetRequest) (*GetResponse, error)
- func (s *Service) GetConversation(ctx context.Context, id string) (*ConversationSummary, error)
- func (s *Service) GetPayload(ctx context.Context, id string) ([]byte, string, error)
- func (s *Service) ListConversations(ctx context.Context, input *apiconv.Input) ([]ConversationSummary, error)
- func (s *Service) MatchToolFeedSpec(ctx context.Context, conversationID, sinceID string) ([]*toolfeed.FeedSpec, error)
- func (s *Service) Post(ctx context.Context, conversationID string, req PostRequest) (string, error)
- func (s *Service) PreflightPost(ctx context.Context, conversationID string, req PostRequest) error
- func (s *Service) PrepareToolContext(ctx context.Context, convID string, args map[string]interface{}) (context.Context, map[string]interface{}, error)
- func (s *Service) Query(ctx context.Context, input *agentpkg.QueryInput) (*agentpkg.QueryOutput, error)
- func (s *Service) SetConversationStatus(ctx context.Context, conversationID string, status string) error
- func (s *Service) SetLastAssistentMessageStatus(ctx context.Context, conversationID, status string) error
- func (s *Service) SetMessageStatus(ctx context.Context, messageID, status string) error
- func (s *Service) SetTurnStatus(ctx context.Context, turnID, status string, errorMessage ...string) error
- func (s *Service) UserByUsername(ctx context.Context, username string) (string, error)
- type UploadedAttachment
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("payload not found") ErrNoContent = errors.New("no content") )
Functions ¶
This section is empty.
Types ¶
type ConversationSummary ¶
type ConversationSummary struct {
ID string `json:"id"`
Title string `json:"title"`
Summary *string `json:"summary"`
}
ConversationSummary lists id + title only.
type CreateConversationRequest ¶
type CreateConversationRequest struct {
Model string `json:"model"`
Agent string `json:"agent"`
Tools string `json:"tools"` // comma-separated
Title string `json:"title"`
Visibility string `json:"visibility"`
}
CreateConversationRequest mirrors HTTP payload for POST /conversations.
type CreateConversationResponse ¶
type CreateConversationResponse struct {
ID string `json:"id"`
Title string `json:"title"`
CreatedAt string `json:"createdAt"`
Model string `json:"model,omitempty"`
Agent string `json:"agent,omitempty"`
Tools string `json:"tools,omitempty"`
}
CreateConversationResponse echoes created entity details.
type GetRequest ¶
type GetRequest struct {
ConversationID string
IncludeModelCallPayload bool
SinceID string // optional: inclusive slice starting from this message id
IncludeToolCall bool
ToolExtensions []*toolfeed.FeedSpec
}
GetRequest defines inputs to fetch messages.
type GetResponse ¶
type GetResponse struct {
Conversation *apiconv.Conversation
}
GetResponse carries the rich conversation view for the given request.
type PostRequest ¶
type PostRequest struct {
Content string `json:"content"`
Agent string `json:"agent,omitempty"`
Model string `json:"model,omitempty"`
Tools []string `json:"tools"`
Context map[string]interface{} `json:"context,omitempty"`
// Optional single-turn overrides
ToolCallExposure *agent.ToolCallExposure `json:"toolCallExposure,omitempty"`
AutoSummarize *bool `json:"autoSummarize,omitempty"`
DisableChains bool `json:"disableChains,omitempty"`
AllowedChains []string `json:"allowedChains"`
// Attachments carries staged upload descriptors returned by Forge upload endpoint.
// Each item must include at least name and uri (relative to storage root), optionally size, stagingFolder, mime.
Attachments []UploadedAttachment `json:"attachments,omitempty"`
}
PostRequest defines inputs to submit a user message.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service exposes message retrieval independent of HTTP concerns.
func NewService ¶
func NewService() *Service
func NewServiceFromEnv ¶ added in v0.2.1
NewServiceFromEnv wires conversation client using environment configuration. Returns an error when conversation client cannot be initialized so that callers can fail fast instead of starting partially configured services.
func NewServiceWithClient ¶ added in v0.2.2
NewServiceWithClient constructs a chat service bound to a provided conversation client and shared datly.
func (*Service) Approve ¶
Approve processes an approval decision for a message. It acknowledges "cancel" without persisting any changes; for accept/decline it stores the status and forwards to the approval service when configured.
func (*Service) AttachApproval ¶
AttachApproval configures the approval service bridge for policy decisions.
func (*Service) AttachCore ¶ added in v0.2.1
func (*Service) AttachDefaults ¶ added in v0.2.1
func (*Service) AttachElicitationService ¶
func (s *Service) AttachElicitationService(es *elicitation.Service)
AttachElicitationService wires the elicitation service to avoid ad-hoc constructions.
func (*Service) AttachFileService ¶
AttachFileService wires the Forge file service instance so that attachment reads can reuse the same staging root and resolution.
func (*Service) AttachManager ¶
AttachManager configures the conversation manager and optional default policies.
func (*Service) AttacheAgentFinder ¶ added in v0.2.1
func (*Service) Cancel ¶
Cancel aborts all in-flight turns for the given conversation; returns true if any were cancelled.
func (*Service) CancelTurn ¶
CancelTurn aborts a specific user turn (keyed by messageId) if running.
func (*Service) Compact ¶ added in v0.2.1
Compact creates a summary message and flags prior messages as compacted (excluding elicitation I/O).
func (*Service) ConversationClient ¶
ConversationClient exposes the underlying conversation client for handlers that need fine-grained operations without adding more methods to this service.
func (*Service) CreateConversation ¶
func (s *Service) CreateConversation(ctx context.Context, in CreateConversationRequest) (*CreateConversationResponse, error)
CreateConversation persists a new conversation using DAO store.
func (*Service) DeleteConversation ¶
DeleteConversation removes a conversation and cascades to dependent rows via DB FKs. It delegates to the underlying conversation client implementation.
func (*Service) DeleteMessage ¶ added in v0.2.2
DeleteMessage removes a message from a conversation via the underlying client.
func (*Service) Elicit ¶
func (s *Service) Elicit(ctx context.Context, messageID, action string, payload map[string]interface{}) error
Elicit processes an elicitation decision (accept/decline/cancel) and forwards the result to an MCP waiter if present.
func (*Service) ElicitationService ¶
func (s *Service) ElicitationService() *elicitation.Service
func (*Service) Generate ¶ added in v0.2.1
func (s *Service) Generate(ctx context.Context, input *corellm.GenerateInput) (*corellm.GenerateOutput, error)
Generate exposes low-level core LLM generate bypassing agentic enrichment.
func (*Service) Get ¶
func (s *Service) Get(ctx context.Context, req GetRequest) (*GetResponse, error)
Get fetches a conversation using the rich transcript API.
func (*Service) GetConversation ¶
GetConversation returns id + title by conversation id.
func (*Service) GetPayload ¶
GetPayload returns raw payload bytes and a content-type. It does not return metadata.
func (*Service) ListConversations ¶
func (s *Service) ListConversations(ctx context.Context, input *apiconv.Input) ([]ConversationSummary, error)
ListConversations returns all conversation summaries.
func (*Service) MatchToolFeedSpec ¶ added in v0.2.1
func (s *Service) MatchToolFeedSpec(ctx context.Context, conversationID, sinceID string) ([]*toolfeed.FeedSpec, error)
ResolveToolExtensions computes applicable ToolExtensions for a conversation by inspecting observed tool calls and matching them against workspace extensions. When no tools are observed it includes any extensions with activation.kind==tool_call so that the hook can invoke them live.
func (*Service) Post ¶
Post accepts a user message and triggers asynchronous processing via manager. Returns generated message ID that can be used to track status.
func (*Service) PreflightPost ¶
PreflightPost validates minimal conditions before accepting a post. It ensures an agent can be determined either from request or conversation defaults.
func (*Service) PrepareToolContext ¶ added in v0.2.1
func (s *Service) PrepareToolContext(ctx context.Context, convID string, args map[string]interface{}) (context.Context, map[string]interface{}, error)
PrepareToolContext enriches args with conversation context (conversationId, lastTurnId) and returns a context carrying the conversationId for downstream services. convID must be non-empty.
func (*Service) Query ¶ added in v0.2.2
func (s *Service) Query(ctx context.Context, input *agentpkg.QueryInput) (*agentpkg.QueryOutput, error)
Query executes a synchronous agent turn using the configured conversation manager. It bubbles up any errors from downstream services without printing.
func (*Service) SetConversationStatus ¶
func (*Service) SetLastAssistentMessageStatus ¶ added in v0.2.2
func (s *Service) SetLastAssistentMessageStatus(ctx context.Context, conversationID, status string) error
SetLastAssistentMessageStatus updates the latest turn in a conversation.
func (*Service) SetMessageStatus ¶
SetMessageStatus patches a message status.