Documentation
¶
Index ¶
- func ContextLogger(ctx context.Context) *slog.Logger
- func JoinSessionPath(baseURL, sessionID string, segments ...string) (string, error)
- type ChatContext
- type ChatEvent
- type ContextType
- type CreateSessionPayload
- type Result
- type SessionHistory
- type SessionHistoryItem
- type SessionHistoryToolRef
- type SessionLimitError
- type SessionList
- type SessionMetadata
- type Stream
- type TaskAction
- type TaskDetails
- type TaskStatusEvent
- type TaskStatusStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextLogger ¶
ContextLogger exposes the slog logger stored in the provided context, if any.
Types ¶
type ChatContext ¶
type ChatContext struct {
Type ContextType `json:"type"`
ID string `json:"id"`
}
ChatContext represents an entity reference shared with the Kai agent.
type ChatEvent ¶
type ChatEvent struct {
Event string `json:"event" yaml:"event"`
Data any `json:"data,omitempty" yaml:"data,omitempty"`
}
ChatEvent represents a single server-sent event emitted by the Kai agent API.
type ContextType ¶
type ContextType string
ContextType enumerates the supported Kai context entity types.
const ( ContextTypeControlPlane ContextType = "control_plane" ContextTypeDataPlane ContextType = "data_plane" ContextTypeRoute ContextType = "route" ContextTypePlugin ContextType = "plugin" ContextTypeService ContextType = "service" ContextTypeConsumer ContextType = "consumer" ContextTypeActiveTracingSession ContextType = "active_tracing_session" )
type CreateSessionPayload ¶
type CreateSessionPayload struct {
Name string `json:"name"`
}
type Result ¶
type Result struct {
Prompt string `json:"prompt" yaml:"prompt"`
Response string `json:"response" yaml:"response"`
Events []ChatEvent `json:"events" yaml:"events"`
}
Result captures the aggregated chat response and all underlying events.
type SessionHistory ¶
type SessionHistory struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
History []SessionHistoryItem `json:"history"`
}
func GetSessionHistory ¶
func GetSessionHistory( ctx context.Context, client *http.Client, baseURL, token, sessionID string, ) (*SessionHistory, error)
GetSessionHistory retrieves full chat history for a session.
type SessionHistoryItem ¶
type SessionHistoryToolRef ¶
type SessionLimitError ¶
SessionLimitError indicates the server refused to create a session because the maximum was reached.
func (*SessionLimitError) Error ¶
func (e *SessionLimitError) Error() string
type SessionList ¶
type SessionList []SessionMetadata
func ListSessions ¶
func ListSessions(ctx context.Context, client *http.Client, baseURL, token string) (SessionList, error)
ListSessions retrieves available sessions for the current user.
type SessionMetadata ¶
type SessionMetadata struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
}
func CreateSession ¶
func CreateSession(ctx context.Context, client *http.Client, baseURL, token, name string) (*SessionMetadata, error)
CreateSession creates a new chat session and returns metadata.
type Stream ¶
type Stream struct {
Events <-chan ChatEvent
// contains filtered or unexported fields
}
Stream represents an active chat stream returning events incrementally.
func AnalyzeTaskStream ¶
func ChatStream ¶
func ChatStream(ctx context.Context, client *http.Client, baseURL, token, prompt string) (*Stream, error)
ChatStream executes the chat request and streams events to the caller.
func ChatStreamSession ¶
func ChatStreamSession( ctx context.Context, client *http.Client, baseURL, token, sessionID, prompt string, contextEntities []ChatContext, ) (*Stream, error)
ChatStreamSession streams chat tied to an existing session.
type TaskAction ¶
type TaskAction string
const ( TaskActionStart TaskAction = "start" TaskActionStop TaskAction = "stop" )
type TaskDetails ¶
type TaskDetails struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
TriggerID string `json:"trigger_id"`
Type string `json:"type"`
Context []ChatContext `json:"context"`
ToolCallMetadata map[string]any `json:"tool_call_metadata"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
ConfirmationMessage string `json:"confirmation_message"`
}
func ListActiveTasks ¶
func UpdateTask ¶
func UpdateTask( ctx context.Context, client *http.Client, baseURL, token, sessionID, taskID string, action TaskAction, ) (*TaskDetails, error)
type TaskStatusEvent ¶
type TaskStatusStream ¶
type TaskStatusStream struct {
Events <-chan TaskStatusEvent
// contains filtered or unexported fields
}
func StreamTaskStatus ¶
func (*TaskStatusStream) Err ¶
func (s *TaskStatusStream) Err() error