Documentation
¶
Index ¶
- func NewCmdInfo(f util.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command
- func RunOnce(client *HivemindClient, message string, out func(string)) error
- func RunTUI(client *HivemindClient) error
- type ChatMessage
- type ChatOptions
- type HivemindClient
- type StreamCallback
- type TeamHTTPClient
- func (c *TeamHTTPClient) Broadcast(ctx context.Context, teamID, content string) error
- func (c *TeamHTTPClient) CreateTeam(ctx context.Context, req command.CreateTeamReq) (*command.TeamState, error)
- func (c *TeamHTTPClient) DissolveTeam(ctx context.Context, teamID string) error
- func (c *TeamHTTPClient) GetTeam(ctx context.Context, teamID string) (*command.TeamState, error)
- func (c *TeamHTTPClient) ListTemplates(ctx context.Context) ([]command.TemplateInfo, error)
- func (c *TeamHTTPClient) SendMessage(ctx context.Context, teamID, recipientLabel, content string) error
- type ToolCallCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCmdInfo ¶
func RunOnce ¶
func RunOnce(client *HivemindClient, message string, out func(string)) error
RunOnce performs a single chat request (non-interactive mode) with streaming output to stdout.
func RunTUI ¶
func RunTUI(client *HivemindClient) error
RunTUI starts the interactive chat TUI using direct terminal output. This approach avoids alt-screen mode so that text can be freely selected and copied.
Types ¶
type ChatMessage ¶
ChatMessage is a single message in the OpenAI Chat Completions format.
type ChatOptions ¶
type ChatOptions struct {
ServerAddr string
Session string
Model string
genericclioptions.IOStreams
// contains filtered or unexported fields
}
func NewChatOptions ¶
func NewChatOptions(f util.Factory, ioStreams genericclioptions.IOStreams) *ChatOptions
func (*ChatOptions) Complete ¶
func (o *ChatOptions) Complete(args []string) error
type HivemindClient ¶
type HivemindClient struct {
BaseURL string
SessionKey string
Model string
HTTPClient *http.Client
}
HivemindClient is the HTTP client for hivemind /v1/chat/completions.
func NewHivemindClient ¶
func NewHivemindClient(baseURL, sessionKey, model string, httpClient *http.Client) *HivemindClient
NewHivemindClient creates a new client.
func (*HivemindClient) Chat ¶
func (c *HivemindClient) Chat(ctx context.Context, messages []ChatMessage) (string, error)
Chat sends messages and returns the full response (non-streaming).
func (*HivemindClient) ChatStream ¶
func (c *HivemindClient) ChatStream(ctx context.Context, messages []ChatMessage, cb StreamCallback, toolCb ToolCallCallback) (string, error)
ChatStream sends messages and streams the response, calling cb for each delta. toolCb is called when a tool call is detected (may be nil). Returns the full assistant reply when done.
type StreamCallback ¶
type StreamCallback func(delta string)
StreamCallback is called for each text delta during streaming.
type TeamHTTPClient ¶ added in v0.2.0
type TeamHTTPClient struct {
// contains filtered or unexported fields
}
TeamHTTPClient implements command.TeamAPI by calling the Hivemind /v1/teams HTTP API.
func NewTeamHTTPClient ¶ added in v0.2.0
func NewTeamHTTPClient(baseURL, sessionKey string, httpClient *http.Client) *TeamHTTPClient
NewTeamHTTPClient creates a new TeamHTTPClient.
func (*TeamHTTPClient) Broadcast ¶ added in v0.2.0
func (c *TeamHTTPClient) Broadcast(ctx context.Context, teamID, content string) error
Broadcast implements command.TeamAPI.
func (*TeamHTTPClient) CreateTeam ¶ added in v0.2.0
func (c *TeamHTTPClient) CreateTeam(ctx context.Context, req command.CreateTeamReq) (*command.TeamState, error)
CreateTeam implements command.TeamAPI.
func (*TeamHTTPClient) DissolveTeam ¶ added in v0.2.0
func (c *TeamHTTPClient) DissolveTeam(ctx context.Context, teamID string) error
DissolveTeam implements command.TeamAPI.
func (*TeamHTTPClient) ListTemplates ¶ added in v0.2.0
func (c *TeamHTTPClient) ListTemplates(ctx context.Context) ([]command.TemplateInfo, error)
ListTemplates implements command.TeamAPI.
func (*TeamHTTPClient) SendMessage ¶ added in v0.2.0
func (c *TeamHTTPClient) SendMessage(ctx context.Context, teamID, recipientLabel, content string) error
SendMessage implements command.TeamAPI.
type ToolCallCallback ¶
type ToolCallCallback func(name string)
ToolCallCallback is called when a tool call is detected in the stream. name is the tool function name, arguments is the JSON arguments string.