pkg/ezagentapi/service_operations.go
package ezagentapi
import (
"context"
"git.cafe/ezterry/ez-agent/pkg/protocol"
)
// SendError sends a protocol error frame.
func (c *Conn) SendError(ctx context.Context, code, message, requestID string) error {
return c.sendFrame(ctx, protocol.Error{Type: "error", Code: code, Message: message, RequestID: requestID})
}
// SendToolCall sends a tool invocation to a capability peer.
func (c *Conn) SendToolCall(ctx context.Context, call protocol.ToolCallIPC) error {
call.Type = "tool_call"
return c.sendFrame(ctx, call)
}
// SendToolAbort sends a tool abort request to a capability peer.
func (c *Conn) SendToolAbort(ctx context.Context, toolCallID string) error {
return c.sendFrame(ctx, protocol.ToolAbort{Type: "tool_abort", ToolCallID: toolCallID})
}
// SendToolInfoRequest requests tool metadata from a capability peer.
func (c *Conn) SendToolInfoRequest(ctx context.Context, names []string, requestID string) error {
return c.sendFrame(ctx, protocol.ToolInfoRequest{Type: "tool_info_request", Names: names, RequestID: requestID})
}
// SendPluginCall sends a plugin invocation to a capability peer.
func (c *Conn) SendPluginCall(ctx context.Context, call protocol.PluginCallIPC) error {
call.Type = "plugin_call"
return c.sendFrame(ctx, call)
}
// SendPluginInfoRequest requests plugin metadata from a capability peer.
func (c *Conn) SendPluginInfoRequest(ctx context.Context, names []string, requestID string) error {
return c.sendFrame(ctx, protocol.PluginInfoRequest{Type: "plugin_info_request", Names: names, RequestID: requestID})
}
// SendMacroCallIPC sends a macro invocation to a capability peer.
func (c *Conn) SendMacroCallIPC(ctx context.Context, call protocol.MacroCallIPC) error {
call.Type = "macro_call_ipc"
return c.sendFrame(ctx, call)
}
// SendMacroInfoRequest requests macro metadata from a capability peer.
func (c *Conn) SendMacroInfoRequest(ctx context.Context, names []string, requestID string) error {
return c.sendFrame(ctx, protocol.MacroInfoRequest{Type: "macro_info_request", Names: names, RequestID: requestID})
}