Documentation
¶
Index ¶
- Variables
- func GenerateTools(ctx context.Context, schema *proto.Schema, config *config.ProjectConfig) ([]*toolsproto.ActionConfig, error)
- type Capabilities
- type Capability
- type DisplayLayoutConfig
- type ExternalLink
- type ExternalLinks
- type Generator
- type InputConfig
- type InputConfigs
- type LinkConfig
- type LinkConfigs
- type ResponseConfig
- type ResponseConfigs
- type ScalarValue
- type Section
- type Sections
- type Service
- func (s *Service) ConfigureTool(ctx context.Context, updated *toolsproto.ActionConfig) (*toolsproto.ActionConfig, error)
- func (s *Service) DuplicateTool(ctx context.Context, toolID string) (*toolsproto.ActionConfig, error)
- func (s *Service) GetTools(ctx context.Context) (*toolsproto.Tools, error)
- func (s *Service) ResetTools(ctx context.Context) (*toolsproto.Tools, error)
- type ServiceOpt
- type Tool
- type ToolConfig
- type ToolConfigs
- type ToolGroupConfig
- type ToolGroupConfigs
- type ToolGroupLinkConfig
- type ToolGroupLinkConfigs
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSchema = errors.New("invalid schema")
Functions ¶
func GenerateTools ¶
func GenerateTools(ctx context.Context, schema *proto.Schema, config *config.ProjectConfig) ([]*toolsproto.ActionConfig, error)
GenerateTools will return a map of tool configurations generated for the given schema
Types ¶
type Capabilities ¶ added in v0.407.0
type Capabilities map[Capability]bool
type Capability ¶ added in v0.407.0
type Capability string
const ( CapabilityAudit Capability = "audit" CapabilityComments Capability = "comments" )
type DisplayLayoutConfig ¶ added in v0.407.0
type DisplayLayoutConfig struct {
Config any `json:"config,omitempty"`
}
type ExternalLink ¶ added in v0.407.0
type ExternalLinks ¶ added in v0.407.0
type ExternalLinks []*ExternalLink
type Generator ¶
type Generator struct {
Schema *proto.Schema
KeelConfig *config.ProjectConfig
Tools map[string]*Tool
}
func NewGenerator ¶
NewGenerator creates a new tool config generator for the given schema
func (*Generator) GetConfigs ¶
func (g *Generator) GetConfigs() []*toolsproto.ActionConfig
GetConfigs will return the action configs that have been generated, in alphabetical order
type InputConfig ¶ added in v0.407.0
type InputConfig struct {
DisplayName *string `json:"display_name,omitempty"`
DisplayOrder *int32 `json:"display_order,omitempty"`
Visible *bool `json:"visible,omitempty"`
HelpText *string `json:"help_text,omitempty"`
Locked *bool `json:"locked,omitempty"`
Placeholder *string `json:"placeholder,omitempty"`
VisibleCondition *string `json:"visible_condition,omitempty"`
SectionName *string `json:"section_name,omitempty"`
DefaultValue *ScalarValue `json:"default_value,omitempty"`
LookupAction *LinkConfig `json:"lookup_action,omitempty"`
GetEntryAction *LinkConfig `json:"get_entry_action,omitempty"`
}
type InputConfigs ¶ added in v0.407.0
type InputConfigs map[string]InputConfig
type LinkConfig ¶ added in v0.407.0
type LinkConfig struct {
ToolID string `json:"tool_id"`
Deleted *bool `json:"deleted,omitempty"` // if the generated link has been deleted
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
AsDialog *bool `json:"as_dialog,omitempty"`
DisplayOrder *int32 `json:"display_order,omitempty"`
VisibleCondition *string `json:"visible_condition,omitempty"`
DataMapping []any `json:"data_mapping,omitempty"`
}
type LinkConfigs ¶ added in v0.407.0
type LinkConfigs []*LinkConfig
type ResponseConfig ¶ added in v0.407.0
type ResponseConfig struct {
DisplayName *string `json:"display_name,omitempty"`
DisplayOrder *int32 `json:"display_order,omitempty"`
Visible *bool `json:"visible,omitempty"`
HelpText *string `json:"help_text,omitempty"`
ImagePreview *bool `json:"image_preview,omitempty"`
VisibleCondition *string `json:"visible_condition,omitempty"`
SectionName *string `json:"section_name,omitempty"`
Link *LinkConfig `json:"link,omitempty"`
}
type ResponseConfigs ¶ added in v0.407.0
type ResponseConfigs map[string]ResponseConfig
type ScalarValue ¶ added in v0.407.0
type Section ¶ added in v0.407.0
type Section struct {
Name string `json:"name,omitempty"`
Title string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
VisibleCondition *string `json:"visible_condition,omitempty"`
DisplayOrder int32 `json:"display_order,omitempty"`
Visible bool `json:"visible,omitempty"`
}
type Service ¶ added in v0.407.0
type Service struct {
Schema *proto.Schema
Config *config.ProjectConfig
ProjectDir *string
ToolsConfigStorage map[string][]byte
}
func NewService ¶ added in v0.407.0
func NewService(opts ...ServiceOpt) *Service
func (*Service) ConfigureTool ¶ added in v0.407.0
func (s *Service) ConfigureTool(ctx context.Context, updated *toolsproto.ActionConfig) (*toolsproto.ActionConfig, error)
ConfigureTool will take the given updated tool config and update the existing project config with it
func (*Service) DuplicateTool ¶ added in v0.407.0
func (s *Service) DuplicateTool(ctx context.Context, toolID string) (*toolsproto.ActionConfig, error)
DuplicateTool will take the given tool and duplicate it with a new ID, and then store the changes to files.
func (*Service) GetTools ¶ added in v0.407.0
GetTools generates tools based on the schema, reads the configured tools from the project and applies them to the generated ones, returning a complete list of tool configs
func (*Service) ResetTools ¶ added in v0.407.0
ResetTools will remove all the saved tool configs and return the schema generated tools.
type ServiceOpt ¶ added in v0.407.0
type ServiceOpt func(s *Service)
func WithConfig ¶ added in v0.407.0
func WithConfig(cfg *config.ProjectConfig) ServiceOpt
func WithFileStorage ¶ added in v0.407.1
func WithFileStorage(projectDir string) ServiceOpt
WithFileStorage initialises the tools service with file-baased storage enabled in the given project folder
func WithSchema ¶ added in v0.407.0
func WithSchema(schema *proto.Schema) ServiceOpt
func WithToolsConfig ¶ added in v0.407.1
func WithToolsConfig(store map[string][]byte) ServiceOpt
WithToolsConfig initialises the tools service with in-memory tools storage and with the given user configuration. This option will invalidate any filebased storage that may have been set with `WithFileStorage`
type Tool ¶
type Tool struct {
Config *toolsproto.ActionConfig
Model *proto.Model
Action *proto.Action
SortableFields []string
}
type ToolConfig ¶ added in v0.407.0
type ToolConfig struct {
ID string `json:"id,omitempty"`
ActionName string `json:"action_name,omitempty"`
Name *string `json:"name,omitempty"`
Icon *string `json:"icon,omitempty"`
Title *string `json:"title,omitempty"`
HelpText *string `json:"help_text,omitempty"`
Capabilities Capabilities `json:"capabilities,omitempty"`
EntitySingle *string `json:"entity_single,omitempty"`
EntityPlural *string `json:"entity_plural,omitempty"`
Inputs InputConfigs `json:"inputs,omitempty"`
Response ResponseConfigs `json:"response,omitempty"`
ExternalLinks ExternalLinks `json:"external_links,omitempty"`
Sections Sections `json:"sections,omitempty"`
GetEntryAction *LinkConfig `json:"get_entry_action,omitempty"`
CreateEntryAction *LinkConfig `json:"create_entry_action,omitempty"`
RelatedActions LinkConfigs `json:"related_actions,omitempty"`
EntryActivityActions LinkConfigs `json:"entry_activity_actions,omitempty"`
DisplayLayout *DisplayLayoutConfig `json:"display_layout,omitempty"`
EmbeddedTools ToolGroupConfigs `json:"embedded_tools,omitempty"`
}
type ToolConfigs ¶ added in v0.407.0
type ToolConfigs []*ToolConfig
type ToolGroupConfig ¶ added in v0.407.0
type ToolGroupConfig struct {
ID string `json:"id,omitempty"`
Deleted *bool `json:"deleted,omitempty"` // if the generated toolgroup has been deleted
Title *string `json:"title,omitempty"`
DisplayOrder *int32 `json:"display_order,omitempty"`
Visible *bool `json:"visible,omitempty"`
Tools ToolGroupLinkConfigs `json:"tools,omitempty"`
}
type ToolGroupConfigs ¶ added in v0.407.0
type ToolGroupConfigs []*ToolGroupConfig
type ToolGroupLinkConfig ¶ added in v0.407.0
type ToolGroupLinkConfig struct {
Deleted *bool `json:"deleted,omitempty"`
ActionLink *LinkConfig `json:"action_link,omitempty"`
ResponseOverrides map[string]bool `json:"response_overrides,omitempty"`
}
type ToolGroupLinkConfigs ¶ added in v0.407.0
type ToolGroupLinkConfigs []*ToolGroupLinkConfig
type Validator ¶ added in v0.409.2
type Validator struct {
Schema *proto.Schema
Tools *toolsproto.Tools
}
func NewValidator ¶ added in v0.409.2
func NewValidator(schema *proto.Schema, tools *toolsproto.Tools) *Validator
NewValidator creates a new tool validator for the given schema and tools