Documentation
¶
Index ¶
- func NewPersistentRepo(localHooks map[string]taskengine.HookRepo, dbInstance libdb.DBManager, ...) taskengine.HookRepo
- func NewSimpleProvider(hooks map[string]taskengine.HookRepo) taskengine.HookRepo
- type ArgLocation
- type HookCallRecord
- type HookResponse
- type MockHookRepo
- func (m *MockHookRepo) CallCount() int
- func (m *MockHookRepo) Exec(ctx context.Context, startingTime time.Time, input any, ...) (any, taskengine.DataType, error)
- func (m *MockHookRepo) GetSchemasForSupportedHooks(ctx context.Context) (map[string]*openapi3.T, error)
- func (m *MockHookRepo) GetToolsForHookByName(ctx context.Context, name string) ([]taskengine.Tool, error)
- func (m *MockHookRepo) LastCall() *HookCallRecord
- func (m *MockHookRepo) Reset()
- func (m *MockHookRepo) Supports(ctx context.Context) ([]string, error)
- func (m *MockHookRepo) WithErrorSequence(errors ...error) *MockHookRepo
- func (m *MockHookRepo) WithResponse(hookType string, response HookResponse) *MockHookRepo
- type OpenAPIToolProtocol
- func (p *OpenAPIToolProtocol) ExecuteTool(ctx context.Context, endpointURL string, httpClient *http.Client, ...) (interface{}, taskengine.DataType, error)
- func (p *OpenAPIToolProtocol) FetchSchema(ctx context.Context, endpointURL string, httpClient *http.Client) (*openapi3.T, error)
- func (p *OpenAPIToolProtocol) FetchTools(ctx context.Context, endpointURL string, injectParams map[string]ParamArg, ...) ([]taskengine.Tool, error)
- type ParamArg
- type PersistentRepo
- func (p *PersistentRepo) Exec(ctx context.Context, startingTime time.Time, input any, ...) (any, taskengine.DataType, error)
- func (p *PersistentRepo) GetSchemasForSupportedHooks(ctx context.Context) (map[string]*openapi3.T, error)
- func (p *PersistentRepo) GetToolsForHookByName(ctx context.Context, name string) ([]taskengine.Tool, error)
- func (p *PersistentRepo) Supports(ctx context.Context) ([]string, error)
- type SimpleRepo
- func (m *SimpleRepo) Exec(ctx context.Context, startingTime time.Time, input any, ...) (any, taskengine.DataType, error)
- func (m *SimpleRepo) GetSchemasForSupportedHooks(ctx context.Context) (map[string]*openapi3.T, error)
- func (m *SimpleRepo) GetToolsForHookByName(ctx context.Context, name string) ([]taskengine.Tool, error)
- func (m *SimpleRepo) Supports(ctx context.Context) ([]string, error)
- type ToolProtocol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPersistentRepo ¶
func NewPersistentRepo( localHooks map[string]taskengine.HookRepo, dbInstance libdb.DBManager, httpClient *http.Client, ) taskengine.HookRepo
func NewSimpleProvider ¶
func NewSimpleProvider(hooks map[string]taskengine.HookRepo) taskengine.HookRepo
Types ¶
type ArgLocation ¶ added in v0.0.74
type ArgLocation int
const ( ArgLocationQuery ArgLocation = iota ArgLocationHeader ArgLocationPath ArgLocationBody )
type HookCallRecord ¶
type HookCallRecord struct { Args taskengine.HookCall Input any }
HookCallRecord now only stores the arguments passed to the hook.
type HookResponse ¶
HookResponse is simplified to only contain the direct output and optional OpenAPI schema.
type MockHookRepo ¶
type MockHookRepo struct { Calls []HookCallRecord ResponseMap map[string]HookResponse DefaultResponse HookResponse ErrorSequence []error // contains filtered or unexported fields }
MockHookRepo is a mock implementation of the HookRepo interface.
func NewMockHookRegistry ¶
func NewMockHookRegistry() *MockHookRepo
NewMockHookRegistry returns a new instance of MockHookRepo.
func (*MockHookRepo) CallCount ¶
func (m *MockHookRepo) CallCount() int
CallCount returns number of times Exec was called
func (*MockHookRepo) Exec ¶
func (m *MockHookRepo) Exec( ctx context.Context, startingTime time.Time, input any, args *taskengine.HookCall, ) (any, taskengine.DataType, error)
Exec simulates execution of a hook call using the new simplified signature.
func (*MockHookRepo) GetSchemasForSupportedHooks ¶ added in v0.0.74
func (m *MockHookRepo) GetSchemasForSupportedHooks(ctx context.Context) (map[string]*openapi3.T, error)
GetSchemasForSupportedHooks returns OpenAPI schemas for all mocked hooks.
func (*MockHookRepo) GetToolsForHookByName ¶ added in v0.0.74
func (m *MockHookRepo) GetToolsForHookByName(ctx context.Context, name string) ([]taskengine.Tool, error)
func (*MockHookRepo) LastCall ¶
func (m *MockHookRepo) LastCall() *HookCallRecord
LastCall returns the most recent hook call
func (*MockHookRepo) Reset ¶
func (m *MockHookRepo) Reset()
Reset clears all recorded calls and resets counters
func (*MockHookRepo) Supports ¶
func (m *MockHookRepo) Supports(ctx context.Context) ([]string, error)
func (*MockHookRepo) WithErrorSequence ¶
func (m *MockHookRepo) WithErrorSequence(errors ...error) *MockHookRepo
WithErrorSequence sets a sequence of errors to return
func (*MockHookRepo) WithResponse ¶
func (m *MockHookRepo) WithResponse(hookType string, response HookResponse) *MockHookRepo
WithResponse configures a response for a specific hook type using the new simplified HookResponse.
type OpenAPIToolProtocol ¶ added in v0.0.74
type OpenAPIToolProtocol struct{}
func (*OpenAPIToolProtocol) ExecuteTool ¶ added in v0.0.74
func (p *OpenAPIToolProtocol) ExecuteTool( ctx context.Context, endpointURL string, httpClient *http.Client, injectParams map[string]ParamArg, toolCall taskengine.ToolCall, ) (interface{}, taskengine.DataType, error)
ExecuteTool performs a tool call by making a corresponding HTTP request.
func (*OpenAPIToolProtocol) FetchSchema ¶ added in v0.0.74
func (*OpenAPIToolProtocol) FetchTools ¶ added in v0.0.74
type ParamArg ¶ added in v0.0.74
type ParamArg struct { Name string Value string In ArgLocation }
type PersistentRepo ¶
type PersistentRepo struct {
// contains filtered or unexported fields
}
PersistentRepo implements taskengine.HookRepo using a single OpenAPI-based protocol.
func (*PersistentRepo) Exec ¶
func (p *PersistentRepo) Exec( ctx context.Context, startingTime time.Time, input any, args *taskengine.HookCall, ) (any, taskengine.DataType, error)
Exec executes a hook by name.
func (*PersistentRepo) GetSchemasForSupportedHooks ¶ added in v0.0.74
func (p *PersistentRepo) GetSchemasForSupportedHooks(ctx context.Context) (map[string]*openapi3.T, error)
GetSchemasForSupportedHooks returns OpenAPI schemas for all remote hooks.
func (*PersistentRepo) GetToolsForHookByName ¶ added in v0.0.74
func (p *PersistentRepo) GetToolsForHookByName(ctx context.Context, name string) ([]taskengine.Tool, error)
GetToolsForHookByName returns the list of tools exposed by the remote hook.
type SimpleRepo ¶
type SimpleRepo struct {
// contains filtered or unexported fields
}
SimpleRepo holds a map of locally registered hooks.
func (*SimpleRepo) Exec ¶
func (m *SimpleRepo) Exec( ctx context.Context, startingTime time.Time, input any, args *taskengine.HookCall, ) (any, taskengine.DataType, error)
func (*SimpleRepo) GetSchemasForSupportedHooks ¶ added in v0.0.74
func (m *SimpleRepo) GetSchemasForSupportedHooks(ctx context.Context) (map[string]*openapi3.T, error)
GetSchemasForSupportedHooks aggregates the schemas from all registered hooks.
func (*SimpleRepo) GetToolsForHookByName ¶ added in v0.0.74
func (m *SimpleRepo) GetToolsForHookByName(ctx context.Context, name string) ([]taskengine.Tool, error)
type ToolProtocol ¶ added in v0.0.74
type ToolProtocol interface { FetchSchema(ctx context.Context, endpointURL string, httpClient *http.Client) (*openapi3.T, error) FetchTools(ctx context.Context, endpointURL string, injectParams map[string]ParamArg, httpClient *http.Client) ([]taskengine.Tool, error) ExecuteTool( ctx context.Context, endpointURL string, httpClient *http.Client, injectParams map[string]ParamArg, toolCall taskengine.ToolCall, ) (interface{}, taskengine.DataType, error) }
ToolProtocol defines the methods required to interact with a remote service that exposes tools via a standardized protocol (e.g., OpenAPI). It is responsible for discovering available tools and executing tool calls. ToolProtocol defines the interface for interacting with remote tools via OpenAPI.