Documentation
¶
Index ¶
- type DataPayload
- type Emitter
- type EndPayload
- type ErrorPayload
- type Event
- func NewDataEvent(chunk interface{}, sequence int64) Event
- func NewEndEvent(duration time.Duration, eventCount int64, summary string) Event
- func NewErrorEvent(err error, message string, retryable bool) Event
- func NewProgressEvent(current, total int64, message string) Event
- func NewStartEvent(toolName, requestID string, args map[string]interface{}) Event
- type EventType
- type Executor
- type ExecutorConfig
- type ExecutorState
- type ProgressPayload
- type StartPayload
- type StreamingToolHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataPayload ¶
type DataPayload struct {
Chunk interface{} `json:"chunk"`
Sequence int64 `json:"sequence"`
Total *int64 `json:"total,omitempty"`
}
DataPayload contains data event payload
type Emitter ¶
type Emitter interface {
// EmitData sends a data chunk
EmitData(data interface{}) error
// EmitProgress sends a progress update
EmitProgress(current, total int64, message string) error
// Context returns the execution context (for cancellation)
Context() context.Context
}
Emitter is the interface provided to streaming tools for emitting events
type EndPayload ¶
type EndPayload struct {
Duration time.Duration `json:"duration_ms"`
EventCount int64 `json:"event_count,omitempty"`
Summary string `json:"summary,omitempty"`
}
EndPayload contains completion event data
type ErrorPayload ¶
type ErrorPayload struct {
Error error `json:"-"`
Message string `json:"message"`
Retryable bool `json:"retryable"`
}
ErrorPayload contains error event data
type Event ¶
Event represents a streaming event
func NewDataEvent ¶
NewDataEvent creates a data event
func NewEndEvent ¶
NewEndEvent creates an end event
func NewErrorEvent ¶
NewErrorEvent creates an error event
func NewProgressEvent ¶
NewProgressEvent creates a progress event
func NewStartEvent ¶
NewStartEvent creates a start event
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor manages streaming tool execution
func NewExecutor ¶
func NewExecutor(config ExecutorConfig, logger *slog.Logger) *Executor
NewExecutor creates a new executor
func (*Executor) Execute ¶
func (e *Executor) Execute( ctx context.Context, toolName string, requestID string, args map[string]interface{}, handler StreamingToolHandler, ) <-chan Event
Execute runs a streaming tool and returns an event channel
func (*Executor) State ¶
func (e *Executor) State() ExecutorState
State returns the current execution state
type ExecutorConfig ¶
type ExecutorConfig struct {
BufferSize int
Timeout time.Duration
MaxEvents int64
MaxConcurrent int // v2 feature: semaphore-based concurrency control
}
ExecutorConfig configures the executor
func DefaultExecutorConfig ¶
func DefaultExecutorConfig() ExecutorConfig
DefaultExecutorConfig returns default configuration
type ExecutorState ¶
type ExecutorState string
ExecutorState represents the execution state
const ( StateInit ExecutorState = "init" StateRunning ExecutorState = "running" StateDone ExecutorState = "done" StateError ExecutorState = "error" StateCanceled ExecutorState = "canceled" )
type ProgressPayload ¶
type ProgressPayload struct {
Current int64 `json:"current"`
Total int64 `json:"total"`
Percentage float64 `json:"percentage"`
Message string `json:"message,omitempty"`
}
ProgressPayload contains progress event data
type StartPayload ¶
type StartPayload struct {
ToolName string `json:"tool_name"`
RequestID string `json:"request_id"`
Args map[string]interface{} `json:"args,omitempty"`
}
StartPayload contains start event data