Documentation
¶
Overview ¶
Package toolkit defines the runtime Tool and ToolKit model used by agents.
Tools are persisted configuration resources backed directly by pkgs/store/kv. A ToolKit is a per-agent runtime view filtered by RuntimeProfile, ownership, enabled state, optional workspace policy, and executor availability.
Index ¶
- Constants
- Variables
- func NormalizePolicy(policy *apitypes.ToolkitPolicy) (*apitypes.ToolkitPolicy, error)
- func ToRedactedSpec(tool Tool) (apitypes.ToolSpec, error)
- func ToSpec(tool Tool) (apitypes.ToolSpec, error)
- type BuildRequest
- type Builder
- type HTTPArgumentBinding
- type HTTPAuth
- type HTTPRequest
- type InvokeRequest
- type Server
- type Tool
- type ToolKit
- type ToolTrigger
- type ToolTriggerExample
- type ToolType
Constants ¶
const ( MaxHTTPTimeout = 60 * time.Second MaxHTTPResponseBytes = 4 << 20 )
Variables ¶
Functions ¶
func NormalizePolicy ¶
func NormalizePolicy(policy *apitypes.ToolkitPolicy) (*apitypes.ToolkitPolicy, error)
NormalizePolicy validates and returns a copy of a ToolKit exposure policy.
func ToRedactedSpec ¶
ToRedactedSpec returns the Admin read representation without direct secrets.
Types ¶
type BuildRequest ¶
type Builder ¶
type Builder struct {
Tools *Server
}
func (*Builder) ResolveInvoke ¶
func (b *Builder) ResolveInvoke(ctx context.Context, req InvokeRequest) (Tool, json.RawMessage, error)
ResolveInvoke re-reads and reauthorizes a Tool immediately before dispatch.
type HTTPArgumentBinding ¶
type HTTPAuth ¶
type HTTPAuth struct {
Method string `json:"method"`
BearerToken *string `json:"bearer_token,omitempty"`
Header *string `json:"header,omitempty"`
APIKey *string `json:"api_key,omitempty"`
Credential *string `json:"credential,omitempty"`
Region *string `json:"region,omitempty"`
Service *string `json:"service,omitempty"`
Action *string `json:"action,omitempty"`
Version *string `json:"version,omitempty"`
}
type HTTPRequest ¶
type HTTPRequest struct {
URL string `json:"url"`
Method string `json:"method"`
Auth HTTPAuth `json:"auth"`
Headers map[string]string `json:"headers,omitempty"`
Query []HTTPArgumentBinding `json:"query,omitempty"`
Body []HTTPArgumentBinding `json:"body,omitempty"`
ResponsePointer *string `json:"response_pointer,omitempty"`
SuccessStatusCodes []int `json:"success_status_codes,omitempty"`
Timeout time.Duration `json:"timeout"`
MaxResponseBytes int64 `json:"max_response_bytes"`
}
type InvokeRequest ¶
type InvokeRequest struct {
Build BuildRequest
Name string
Args json.RawMessage
}
type Tool ¶
type Tool struct {
Name string `json:"name"`
Type ToolType `json:"type"`
Description *string `json:"description,omitempty"`
Enabled bool `json:"enabled"`
Version *string `json:"version,omitempty"`
InputSchema jsonschema.Schema `json:"input_schema"`
Triggers []ToolTrigger `json:"triggers,omitempty"`
Metadata json.RawMessage `json:"metadata,omitempty"`
HTTP *HTTPRequest `json:"http,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Tool is the persisted configuration for one canonically named capability.
func MergeDirectSecrets ¶
MergeDirectSecrets retains omitted direct secrets only when the auth method is unchanged. It returns an independently owned, executable declaration.
func NormalizeTool ¶
type ToolTrigger ¶
type ToolTrigger struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Patterns []string `json:"patterns,omitempty"`
Examples []ToolTriggerExample `json:"examples,omitempty"`
Metadata json.RawMessage `json:"metadata,omitempty"`
}
type ToolTriggerExample ¶
type ToolTriggerExample struct {
Input string `json:"input"`
Args json.RawMessage `json:"args,omitempty"`
Output *string `json:"output,omitempty"`
}