Documentation
¶
Index ¶
- Constants
- func RenderError(message string) string
- func RenderMessage(msg MessageResponse) string
- func RenderResponse(message string) string
- func RenderStatus(message string) string
- func RenderToolCall(message string) string
- func RunREPL(ctx context.Context, client *Client) error
- func RunSingleShot(ctx context.Context, client *Client, message string) error
- type Client
- type ClientOption
- type Conn
- type MessageResponse
- type Payload
Constants ¶
const ( StatusInProgress = "In Progress" StatusFinished = "Finished" StatusErrored = "Errored" StatusSurrendered = "Surrendered" )
Status constants matching the-holonet protocol.
const ( MessageTypeToolCall = "toolCall" MessageTypeStatusMessage = "statusMessage" MessageTypeResponse = "response" MessageTypeError = "error" )
MessageType constants matching the-holonet protocol.
Variables ¶
This section is empty.
Functions ¶
func RenderError ¶
RenderError renders an error message (red text).
func RenderMessage ¶
func RenderMessage(msg MessageResponse) string
RenderMessage renders a MessageResponse based on its type.
func RenderResponse ¶
RenderResponse renders a response message (normal text).
func RenderStatus ¶
RenderStatus renders a status message (italic text).
func RenderToolCall ¶
RenderToolCall renders a tool call message (dim text).
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages a chat session with the Nullify AI agents.
func NewClient ¶
func NewClient(conn Conn, queryParams map[string]string, opts ...ClientOption) *Client
NewClient creates a new chat client with the given connection.
func (*Client) ReadResponses ¶
func (c *Client) ReadResponses() <-chan MessageResponse
ReadResponses returns a channel that streams responses from the server. The channel is closed when a terminal status is received or an error occurs.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption configures a chat client.
func WithChatID ¶
func WithChatID(id string) ClientOption
WithChatID sets a specific chat ID (for resuming conversations).
func WithSystemPrompt ¶
func WithSystemPrompt(prompt string) ClientOption
WithSystemPrompt sets an extra system prompt.
type MessageResponse ¶
type MessageResponse struct {
Status string `json:"status"`
MessageType string `json:"messageType"`
Message string `json:"message"`
}
MessageResponse is a message received from the Nullify chat WebSocket.
func (*MessageResponse) IsTerminal ¶
func (m *MessageResponse) IsTerminal() bool
IsTerminal returns true if this response indicates the conversation turn is complete.