Documentation
¶
Overview ¶
Package command provides command execution functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewUpstream ¶
NewUpstream creates a new instance of CommandUpstream.
Returns:
- upstream.Upstream: A new instance of the command upstream.
Side Effects:
- None.
Summary: Initializes NewUpstream operation.
Parameters:
- TODO: Document parameters.
Returns:
- TODO: Document returns.
Errors:
- TODO: Document errors.
Side Effects:
- None.
Types ¶
type Upstream ¶
type Upstream struct {
// contains filtered or unexported fields
}
Upstream implements the upstream.Upstream interface for services that are exposed as command-line tools.
It discovers and registers tools based on a list of commands defined in the service configuration.
Summary: Represents a Upstream.
func (*Upstream) Register ¶
func (u *Upstream) Register( ctx context.Context, serviceConfig *configv1.UpstreamServiceConfig, toolManager tool.ManagerInterface, promptManager prompt.ManagerInterface, resourceManager resource.ManagerInterface, isReload bool, ) (string, []*configv1.ToolDefinition, []*configv1.ResourceDefinition, error)
Register processes the configuration for a command-line service, creates a new tool for each defined command, and registers them with the tool manager.
Parameters:
- ctx (context.Context): The context for the registration process.
- serviceConfig (*configv1.UpstreamServiceConfig): The configuration for the upstream service.
- toolManager (tool.ManagerInterface): The manager where discovered tools will be registered.
- promptManager (prompt.ManagerInterface): The manager where discovered prompts will be registered.
- resourceManager (resource.ManagerInterface): The manager where discovered resources will be registered.
- isReload (bool): Indicates whether this is a configuration reload.
Returns:
- string: The unique service ID.
- []*configv1.ToolDefinition: A list of registered tool definitions.
- []*configv1.ResourceDefinition: A list of registered resource definitions.
- error: An error if registration fails.
Side Effects:
- Starts a health checker for the service.
- Registers tools and prompts with their respective managers.
Summary: Executes Register operation.
Parameters:
- TODO: Document parameters.
Returns:
- TODO: Document returns.
Errors:
- TODO: Document errors.
Side Effects:
- None.
func (*Upstream) Shutdown ¶
Shutdown implements the upstream.Upstream interface.
Parameters:
- ctx (context.Context): The context for the shutdown operation (currently unused).
Returns:
- error: Always returns nil.
Side Effects:
- Stops the health checker.
Summary: Executes Shutdown operation.
Parameters:
- TODO: Document parameters.
Returns:
- TODO: Document returns.
Errors:
- TODO: Document errors.
Side Effects:
- None.