tools

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package tools defines canonical Tool Registry contracts.

Index

Constants

View Source
const (
	// ToolSourceBuiltin marks daemon-defined tools.
	ToolSourceBuiltin = SourceBuiltin
	// ToolSourceMCP marks tools discovered from MCP servers.
	ToolSourceMCP = SourceMCP
	// ToolSourceExtension marks tools provided by extensions.
	ToolSourceExtension = SourceExtension
	// ToolSourceDynamic marks future runtime-assembled tools.
	ToolSourceDynamic = SourceDynamic
)
View Source
const (
	// BuiltinSourceOwner is the source owner for daemon-compiled AGH tools.
	BuiltinSourceOwner = "daemon"
)
View Source
const (
	// ToolResourceKind is the canonical desired-state resource kind for tool records.
	ToolResourceKind resources.ResourceKind = "tool"
)

Variables

View Source
var (
	// ErrToolNotFound reports an unknown tool id.
	ErrToolNotFound = errors.New("tools: tool not found")
	// ErrToolConflict reports a canonical id or sanitized-name conflict.
	ErrToolConflict = errors.New("tools: tool conflict")
	// ErrToolUnavailable reports an unavailable tool.
	ErrToolUnavailable = errors.New("tools: tool unavailable")
	// ErrToolDenied reports policy denial.
	ErrToolDenied = errors.New("tools: tool denied")
	// ErrToolApprovalRequired reports required approval.
	ErrToolApprovalRequired = errors.New("tools: tool approval required")
	// ErrToolInvalidInput reports invalid tool input.
	ErrToolInvalidInput = errors.New("tools: invalid tool input")
	// ErrToolResultTooLarge reports result budget overflow.
	ErrToolResultTooLarge = errors.New("tools: tool result too large")
	// ErrToolBackendFailed reports a backend adapter failure.
	ErrToolBackendFailed = errors.New("tools: backend failed")
	// ErrToolCanceled reports call cancellation.
	ErrToolCanceled = errors.New("tools: tool call canceled")
	// ErrToolTimedOut reports call deadline expiration.
	ErrToolTimedOut = errors.New("tools: tool call timed out")
)

Functions

func ApprovalInputDigest

func ApprovalInputDigest(input json.RawMessage, suppliedDigest string) (string, error)

ApprovalInputDigest returns the stable digest binding used for local approvals.

func CanonicalIDSegment

func CanonicalIDSegment(raw string) (string, error)

CanonicalIDSegment normalizes one external name into a provider-safe segment.

func CanonicalJSON

func CanonicalJSON(raw json.RawMessage) ([]byte, error)

CanonicalJSON returns RFC 8785/JCS-compatible canonical JSON bytes.

func NewResourceCodec

func NewResourceCodec() (resources.KindCodec[Tool], error)

NewResourceCodec builds the canonical tool resource codec.

func SchemaDigest

func SchemaDigest(raw json.RawMessage) (string, error)

SchemaDigest returns the lowercase SHA-256 digest of a canonical JSON Schema subtree.

func ValidateHandle

func ValidateHandle(handle Handle) error

ValidateHandle rejects nil or malformed handles before dispatch.

func ValidateJSONObject

func ValidateJSONObject(field string, raw json.RawMessage, required bool) error

ValidateJSONObject validates a JSON Schema object payload.

func ValidateProvider

func ValidateProvider(provider Provider) error

ValidateProvider rejects nil or malformed providers before registry use.

Types

type AgentToolPolicy

type AgentToolPolicy struct {
	Tools     []ToolPattern `json:"-"`
	Toolsets  []ToolsetID   `json:"toolsets,omitempty"`
	DenyTools []ToolPattern `json:"-"`
}

AgentToolPolicy captures agent-local allow and deny grammar.

type ApprovalBridge

type ApprovalBridge interface {
	RequestToolApproval(ctx context.Context, scope Scope, call CallRequest, view *ToolView) error
}

ApprovalBridge mediates approval-required calls before provider execution.

type ApprovalGrant

type ApprovalGrant struct {
	ApprovalToken string    `json:"approval_token"`
	ExpiresAt     time.Time `json:"expires_at"`
	ToolID        ToolID    `json:"tool_id"`
	InputDigest   string    `json:"input_digest"`
}

ApprovalGrant is the raw approval token returned only to authenticated local callers.

type ApprovalRequest

type ApprovalRequest struct {
	ToolID      ToolID          `json:"tool_id"`
	SessionID   string          `json:"session_id"`
	WorkspaceID string          `json:"workspace_id,omitempty"`
	AgentName   string          `json:"agent_name,omitempty"`
	Input       json.RawMessage `json:"input,omitempty"`
	InputDigest string          `json:"input_digest,omitempty"`
}

ApprovalRequest describes one concrete local approval-token issuance request.

type ApprovalTokenConsumer

type ApprovalTokenConsumer interface {
	ConsumeToolApproval(ctx context.Context, scope Scope, call CallRequest) error
}

ApprovalTokenConsumer validates and consumes local approval references.

type ApprovalTokenIssuer

type ApprovalTokenIssuer interface {
	CreateToolApproval(ctx context.Context, scope Scope, req ApprovalRequest) (ApprovalGrant, error)
}

ApprovalTokenIssuer mints local single-use approval references.

type ApprovalTokenStore

type ApprovalTokenStore struct {
	// contains filtered or unexported fields
}

ApprovalTokenStore keeps local approval references in daemon memory only.

func NewApprovalTokenStore

func NewApprovalTokenStore(ttl time.Duration, opts ...ApprovalTokenStoreOption) *ApprovalTokenStore

NewApprovalTokenStore builds a daemon-memory approval token store.

func (*ApprovalTokenStore) ConsumeToolApproval

func (s *ApprovalTokenStore) ConsumeToolApproval(ctx context.Context, scope Scope, call CallRequest) error

ConsumeToolApproval validates and consumes a single-use approval token.

func (*ApprovalTokenStore) CreateToolApproval

func (s *ApprovalTokenStore) CreateToolApproval(
	ctx context.Context,
	scope Scope,
	req ApprovalRequest,
) (ApprovalGrant, error)

CreateToolApproval mints a single-use approval token bound to one invocation.

type ApprovalTokenStoreOption

type ApprovalTokenStoreOption func(*ApprovalTokenStore)

ApprovalTokenStoreOption customizes an in-memory approval token store.

func WithApprovalTokenClock

func WithApprovalTokenClock(now func() time.Time) ApprovalTokenStoreOption

WithApprovalTokenClock overrides the approval-token clock for tests.

func WithApprovalTokenRandom

func WithApprovalTokenRandom(random io.Reader) ApprovalTokenStoreOption

WithApprovalTokenRandom overrides the random source for tests.

type ArtifactRef

type ArtifactRef struct {
	URI      string `json:"uri"`
	Name     string `json:"name,omitempty"`
	MIMEType string `json:"mime_type,omitempty"`
	Bytes    int64  `json:"bytes,omitempty"`
}

ArtifactRef points to a durable tool output artifact.

type Availability

type Availability struct {
	Registered  bool         `json:"registered"`
	Enabled     bool         `json:"enabled"`
	Available   bool         `json:"available"`
	Authorized  bool         `json:"authorized"`
	Executable  bool         `json:"executable"`
	Conflicted  bool         `json:"conflicted"`
	ReasonCodes []ReasonCode `json:"reason_codes,omitempty"`
}

Availability records composable tool availability state.

func Available

func Available() Availability

Available returns the default executable availability for healthy native tools.

func Unavailable

func Unavailable(reason ReasonCode) Availability

Unavailable returns a deterministic unavailable state for missing native dependencies.

func (Availability) Validate

func (a Availability) Validate() error

Validate checks availability state consistency.

type BackendKind

type BackendKind string

BackendKind identifies the executable backend class.

const (
	// BackendNativeGo executes a daemon-compiled Go handler.
	BackendNativeGo BackendKind = "native_go"
	// BackendExtensionHost executes through the extension host subprocess runtime.
	BackendExtensionHost BackendKind = "extension_host"
	// BackendMCP executes through daemon-owned MCP client adapters.
	BackendMCP BackendKind = "mcp"
	// BackendBridge is reserved for a later bridge adapter TechSpec.
	BackendBridge BackendKind = "bridge"
)

func (BackendKind) Validate

func (k BackendKind) Validate(field string) error

Validate ensures the backend kind is documented.

type BackendRef

type BackendRef struct {
	Kind                 BackendKind `json:"kind"`
	ExtensionID          string      `json:"extension_id,omitempty"`
	Handler              string      `json:"handler,omitempty"`
	MCPServer            string      `json:"mcp_server,omitempty"`
	MCPTool              string      `json:"mcp_tool,omitempty"`
	NativeName           string      `json:"native_name,omitempty"`
	RequiresCapabilities []string    `json:"requires_capabilities,omitempty"`
}

BackendRef binds a descriptor to its executable backend.

func (BackendRef) Validate

func (b BackendRef) Validate(field string) error

Validate ensures the backend reference has the fields required for its kind.

type CallRequest

type CallRequest struct {
	ToolID               ToolID          `json:"tool_id"`
	ToolCallID           string          `json:"tool_call_id,omitempty"`
	TurnID               string          `json:"turn_id,omitempty"`
	SessionID            string          `json:"session_id,omitempty"`
	WorkspaceID          string          `json:"workspace_id,omitempty"`
	AgentName            string          `json:"agent_name,omitempty"`
	ActorKind            string          `json:"actor_kind,omitempty"`
	CorrelationID        string          `json:"correlation_id,omitempty"`
	Input                json.RawMessage `json:"input"`
	SensitiveInputFields []string        `json:"sensitive_input_fields,omitempty"`
	ApprovalToken        string          `json:"approval_token,omitempty"`
}

CallRequest is the canonical dispatch request.

type DefaultResultLimiter

type DefaultResultLimiter struct {
	// contains filtered or unexported fields
}

DefaultResultLimiter applies descriptor/default byte caps and secret redaction.

func NewResultLimiter

func NewResultLimiter(defaultMaxBytes int64, sensitiveFields ...string) *DefaultResultLimiter

NewResultLimiter builds the default registry result limiter.

func (*DefaultResultLimiter) Apply

Apply redacts sensitive fields, computes byte size, and truncates deterministically.

type Descriptor

type Descriptor struct {
	ID                  ToolID          `json:"id"`
	Backend             BackendRef      `json:"backend"`
	DisplayTitle        string          `json:"display_title,omitempty"`
	Description         string          `json:"description"`
	InputSchema         json.RawMessage `json:"input_schema"`
	OutputSchema        json.RawMessage `json:"output_schema,omitempty"`
	InputSchemaDigest   string          `json:"input_schema_digest"`
	OutputSchemaDigest  string          `json:"output_schema_digest,omitempty"`
	Source              SourceRef       `json:"source"`
	Visibility          Visibility      `json:"visibility"`
	Risk                RiskClass       `json:"risk"`
	ReadOnly            bool            `json:"read_only"`
	Destructive         bool            `json:"destructive"`
	OpenWorld           bool            `json:"open_world"`
	RequiresInteraction bool            `json:"requires_interaction"`
	ConcurrencySafe     bool            `json:"concurrency_safe"`
	MaxResultBytes      int64           `json:"max_result_bytes,omitempty"`
	Toolsets            []ToolsetID     `json:"toolsets,omitempty"`
	Tags                []string        `json:"tags,omitempty"`
	SearchHints         []string        `json:"search_hints,omitempty"`
}

Descriptor is the normalized runtime metadata used for indexing and dispatch.

func DescriptorWithSchemaDigests

func DescriptorWithSchemaDigests(descriptor Descriptor) (Descriptor, error)

DescriptorWithSchemaDigests returns a descriptor with canonical schema digests populated.

func (Descriptor) Tool

func (d Descriptor) Tool() Tool

Tool returns the cold resource shape for a runtime descriptor.

func (Descriptor) Validate

func (d Descriptor) Validate() error

Validate ensures the descriptor is dispatchable metadata.

type EffectivePolicyEvaluator

type EffectivePolicyEvaluator struct {
	// contains filtered or unexported fields
}

EffectivePolicyEvaluator computes policy below the ACP permission ceiling.

func NewEffectivePolicyEvaluator

func NewEffectivePolicyEvaluator(
	inputs PolicyInputs,
	toolsets ToolsetCatalog,
	universe []ToolID,
) (*EffectivePolicyEvaluator, error)

NewEffectivePolicyEvaluator validates and prepares a policy evaluator.

func (*EffectivePolicyEvaluator) Evaluate

Evaluate computes the effective decision for one descriptor.

type EffectiveToolDecision

type EffectiveToolDecision struct {
	VisibleToOperator    bool         `json:"visible_to_operator"`
	VisibleToSession     bool         `json:"visible_to_session"`
	Callable             bool         `json:"callable"`
	ApprovalRequired     bool         `json:"approval_required"`
	SystemPermissionMode string       `json:"system_permission_mode,omitempty"`
	SessionPolicyResult  string       `json:"session_policy_result,omitempty"`
	AgentPolicyResult    string       `json:"agent_policy_result,omitempty"`
	RegistryPolicyResult string       `json:"registry_policy_result,omitempty"`
	SourcePolicyResult   string       `json:"source_policy_result,omitempty"`
	AvailabilityResult   string       `json:"availability_result,omitempty"`
	HookResult           string       `json:"hook_result,omitempty"`
	ReasonCodes          []ReasonCode `json:"reason_codes,omitempty"`
}

EffectiveToolDecision records the combined policy and availability decision.

type ErrorCode

type ErrorCode string

ErrorCode is the stable public tool error code.

const (
	// ErrorCodeNotFound maps to ErrToolNotFound.
	ErrorCodeNotFound ErrorCode = "tool_not_found"
	// ErrorCodeConflict maps to ErrToolConflict.
	ErrorCodeConflict ErrorCode = "tool_conflict"
	// ErrorCodeUnavailable maps to ErrToolUnavailable.
	ErrorCodeUnavailable ErrorCode = "tool_unavailable"
	// ErrorCodeDenied maps to ErrToolDenied.
	ErrorCodeDenied ErrorCode = "tool_denied"
	// ErrorCodeApprovalRequired maps to ErrToolApprovalRequired.
	ErrorCodeApprovalRequired ErrorCode = "tool_approval_required"
	// ErrorCodeInvalidInput maps to ErrToolInvalidInput.
	ErrorCodeInvalidInput ErrorCode = "tool_invalid_input"
	// ErrorCodeResultTooLarge maps to ErrToolResultTooLarge.
	ErrorCodeResultTooLarge ErrorCode = "tool_result_too_large"
	// ErrorCodeBackendFailed maps to ErrToolBackendFailed.
	ErrorCodeBackendFailed ErrorCode = "tool_backend_failed"
	// ErrorCodeCanceled maps to ErrToolCanceled.
	ErrorCodeCanceled ErrorCode = "tool_canceled"
	// ErrorCodeTimedOut maps to ErrToolTimedOut.
	ErrorCodeTimedOut ErrorCode = "tool_timed_out"
)

type ExtensionProvideToolsResponse

type ExtensionProvideToolsResponse struct {
	Tools []ExtensionToolRuntimeDescriptor `json:"tools"`
}

ExtensionProvideToolsResponse is the extension host runtime descriptor response.

type ExtensionToolCallRequest

type ExtensionToolCallRequest struct {
	ToolID    ToolID          `json:"tool_id"`
	Handler   string          `json:"handler"`
	SessionID string          `json:"session_id,omitempty"`
	Input     json.RawMessage `json:"input"`
}

ExtensionToolCallRequest is the extension host call request.

type ExtensionToolCallResponse

type ExtensionToolCallResponse struct {
	Result ToolResult `json:"result"`
}

ExtensionToolCallResponse is the extension host call response.

type ExtensionToolInvoker

type ExtensionToolInvoker interface {
	ProvideTools(ctx context.Context, extensionID string) ([]ExtensionToolRuntimeDescriptor, error)
	CallTool(ctx context.Context, extensionID string, req ExtensionToolCallRequest) (ToolResult, error)
}

ExtensionToolInvoker invokes out-of-process extension tool providers.

type ExtensionToolRuntimeDescriptor

type ExtensionToolRuntimeDescriptor struct {
	ID                 ToolID    `json:"id"`
	Handler            string    `json:"handler"`
	InputSchemaDigest  string    `json:"input_schema_digest"`
	OutputSchemaDigest string    `json:"output_schema_digest,omitempty"`
	ReadOnly           bool      `json:"read_only"`
	Risk               RiskClass `json:"risk"`
	Capabilities       []string  `json:"capabilities,omitempty"`
}

ExtensionToolRuntimeDescriptor is the runtime reconciliation proof for an extension tool.

func (ExtensionToolRuntimeDescriptor) Validate

Validate checks runtime reconciliation metadata for an extension tool.

type ExternalDefault

type ExternalDefault string

ExternalDefault controls default policy for external executable sources.

const (
	// ExternalDefaultDisabled denies external sources unless explicitly granted.
	ExternalDefaultDisabled ExternalDefault = "disabled"
	// ExternalDefaultAsk allows external sources but requires approval.
	ExternalDefaultAsk ExternalDefault = "ask"
	// ExternalDefaultEnabled allows external sources subject to the ACP ceiling.
	ExternalDefaultEnabled ExternalDefault = "enabled"
)

type Handle

type Handle interface {
	Descriptor() Descriptor
	Availability(ctx context.Context, scope Scope) Availability
	Call(ctx context.Context, req CallRequest) (ToolResult, error)
}

Handle is the executable runtime contract for one tool.

type HookRunner

type HookRunner interface {
	PreCall(ctx context.Context, call CallRequest) (CallRequest, EffectiveToolDecision, error)
	PostCall(ctx context.Context, call CallRequest, result ToolResult) (ToolResult, error)
	PostError(ctx context.Context, call CallRequest, err error) error
}

HookRunner runs typed registry hooks around dispatch.

type MCPAuthStatus

type MCPAuthStatus struct {
	ServerName   string     `json:"server_name"`
	Status       string     `json:"status"`
	AuthType     string     `json:"auth_type,omitempty"`
	ClientID     string     `json:"client_id,omitempty"`
	Scopes       []string   `json:"scopes,omitempty"`
	ExpiresAt    *time.Time `json:"expires_at,omitempty"`
	Refreshable  bool       `json:"refreshable"`
	TokenPresent bool       `json:"token_present"`
	Diagnostic   string     `json:"diagnostic,omitempty"`
}

MCPAuthStatus is a redacted auth diagnostic for external MCP sources.

type MCPAuthStatusProvider

type MCPAuthStatusProvider interface {
	Status(ctx context.Context, source SourceRef) (MCPAuthStatus, error)
}

MCPAuthStatusProvider returns redacted MCP auth status for diagnostics.

type MCPCallExecutor

type MCPCallExecutor interface {
	ListTools(ctx context.Context, source SourceRef) ([]MCPToolDescriptor, error)
	CallTool(ctx context.Context, source SourceRef, req MCPToolCallRequest) (ToolResult, error)
}

MCPCallExecutor lists and calls MCP tools without exposing credential material.

type MCPProvider

type MCPProvider struct {
	// contains filtered or unexported fields
}

MCPProvider adapts daemon-owned MCP discovery and calls into registry descriptors.

func NewMCPProvider

func NewMCPProvider(
	sources MCPSourceLister,
	exec MCPCallExecutor,
	auth MCPAuthStatusProvider,
) (*MCPProvider, error)

NewMCPProvider creates a registry provider for daemon-owned MCP call-through.

func (*MCPProvider) ID

func (p *MCPProvider) ID() SourceRef

ID returns aggregate provider provenance.

func (*MCPProvider) List

func (p *MCPProvider) List(ctx context.Context, _ Scope) ([]Descriptor, error)

List discovers configured MCP tools and normalizes them into registry descriptors.

func (*MCPProvider) Resolve

func (p *MCPProvider) Resolve(ctx context.Context, scope Scope, id ToolID) (Handle, bool, error)

Resolve returns a handle for one discovered MCP tool.

type MCPSourceLister

type MCPSourceLister interface {
	ListMCPSources(ctx context.Context) ([]SourceRef, error)
}

MCPSourceLister returns configured MCP server sources for dynamic discovery.

type MCPSourceListerFunc

type MCPSourceListerFunc func(context.Context) ([]SourceRef, error)

MCPSourceListerFunc adapts a function into an MCP source lister.

func (MCPSourceListerFunc) ListMCPSources

func (f MCPSourceListerFunc) ListMCPSources(ctx context.Context) ([]SourceRef, error)

ListMCPSources returns configured MCP server sources.

type MCPToolCallRequest

type MCPToolCallRequest struct {
	ToolID      ToolID          `json:"tool_id"`
	RawToolName string          `json:"raw_tool_name"`
	Input       json.RawMessage `json:"input"`
}

MCPToolCallRequest is the daemon-owned MCP adapter call request.

type MCPToolCallResponse

type MCPToolCallResponse struct {
	Result ToolResult `json:"result"`
}

MCPToolCallResponse is the daemon-owned MCP adapter call response.

type MCPToolDescriptor

type MCPToolDescriptor struct {
	ID           ToolID          `json:"id"`
	RawName      string          `json:"raw_name"`
	Title        string          `json:"title,omitempty"`
	Description  string          `json:"description,omitempty"`
	InputSchema  json.RawMessage `json:"input_schema"`
	OutputSchema json.RawMessage `json:"output_schema,omitempty"`
	Source       SourceRef       `json:"source"`
	ReadOnly     bool            `json:"read_only"`
}

MCPToolDescriptor describes one externally discovered MCP tool.

type NativeAvailabilityFunc

type NativeAvailabilityFunc func(ctx context.Context, scope Scope) Availability

NativeAvailabilityFunc computes runtime availability for one daemon-compiled tool.

type NativeProvider

type NativeProvider struct {
	// contains filtered or unexported fields
}

NativeProvider serves daemon-compiled native_go tools.

func NewNativeProvider

func NewNativeProvider(source SourceRef, nativeTools ...NativeTool) (*NativeProvider, error)

NewNativeProvider validates and indexes native tools for one source.

func (*NativeProvider) ID

func (p *NativeProvider) ID() SourceRef

ID returns the provider provenance.

func (*NativeProvider) List

func (p *NativeProvider) List(_ context.Context, _ Scope) ([]Descriptor, error)

List returns deterministic native descriptors.

func (*NativeProvider) Resolve

func (p *NativeProvider) Resolve(_ context.Context, scope Scope, id ToolID) (Handle, bool, error)

Resolve returns the executable handle for one native tool.

type NativeTool

type NativeTool struct {
	Descriptor   Descriptor
	Call         NativeToolFunc
	Availability NativeAvailabilityFunc
}

NativeTool binds one descriptor to an in-process daemon handler.

type NativeToolFunc

type NativeToolFunc func(ctx context.Context, scope Scope, req CallRequest) (ToolResult, error)

NativeToolFunc is the daemon-compiled function signature for native tools.

type PermissionMode

type PermissionMode string

PermissionMode mirrors ACP's static approval modes without importing config.

const (
	// PermissionModeDenyAll requires explicit approval for every tool call.
	PermissionModeDenyAll PermissionMode = "deny-all"
	// PermissionModeApproveReads auto-approves read-only tools.
	PermissionModeApproveReads PermissionMode = "approve-reads"
	// PermissionModeApproveAll auto-approves otherwise allowed tools.
	PermissionModeApproveAll PermissionMode = "approve-all"
)

type PolicyEvaluator

type PolicyEvaluator interface {
	Evaluate(ctx context.Context, scope Scope, d Descriptor) (EffectiveToolDecision, error)
}

PolicyEvaluator computes the effective policy decision for a descriptor.

type PolicyInputResolver

type PolicyInputResolver interface {
	Resolve(ctx context.Context, scope Scope) (PolicyInputs, error)
	DefaultToolsets(ctx context.Context, scope Scope) ([]ToolsetID, error)
}

PolicyInputResolver resolves effective policy inputs for the current caller scope.

func NewStaticPolicyInputResolver

func NewStaticPolicyInputResolver(inputs PolicyInputs, defaultToolsets ...ToolsetID) PolicyInputResolver

NewStaticPolicyInputResolver returns a resolver for callers with fixed policy inputs.

type PolicyInputs

type PolicyInputs struct {
	ToolsDisabled        bool
	SystemPermissionMode PermissionMode
	ExternalDefault      ExternalDefault
	ApprovalAvailable    bool
	TrustedSources       []SourceGrant
	AllowSources         []SourceGrant
	AllowTools           []ToolPattern
	AllowToolsets        []ToolsetID
	DenyTools            []ToolPattern
	Agent                AgentToolPolicy
	Session              SessionToolPolicy
}

PolicyInputs contains the config-neutral inputs for effective policy.

func DefaultPolicyInputs

func DefaultPolicyInputs() PolicyInputs

DefaultPolicyInputs returns conservative registry defaults.

type Provider

type Provider interface {
	ID() SourceRef
	List(ctx context.Context, scope Scope) ([]Descriptor, error)
	Resolve(ctx context.Context, scope Scope, id ToolID) (Handle, bool, error)
}

Provider contributes descriptors and executable handles from one source.

type ReasonCode

type ReasonCode string

ReasonCode is a deterministic machine-readable reason.

const (
	// ReasonIDEmpty reports an empty id.
	ReasonIDEmpty ReasonCode = "id_empty"
	// ReasonIDEmptySegment reports a missing namespace segment.
	ReasonIDEmptySegment ReasonCode = "id_empty_segment"
	// ReasonIDInvalidFormat reports a grammar violation.
	ReasonIDInvalidFormat ReasonCode = "id_invalid_format"
	// ReasonIDReservedConflict reports ambiguous reserved separator usage.
	ReasonIDReservedConflict ReasonCode = "reserved_conflict"
	// ReasonReservedNamespace reports an extension or external source claiming a reserved namespace.
	ReasonReservedNamespace ReasonCode = "reserved_namespace"
	// ReasonIDTooLong reports an id over the provider-safe limit.
	ReasonIDTooLong ReasonCode = "id_too_long"
	// ReasonDependencyMissing reports a missing dependency.
	ReasonDependencyMissing ReasonCode = "dependency_missing"
	// ReasonBackendUnhealthy reports an unhealthy backend.
	ReasonBackendUnhealthy ReasonCode = "backend_unhealthy"
	// ReasonBackendNotExecutable reports a descriptor without an executable backend.
	ReasonBackendNotExecutable ReasonCode = "backend_not_executable"
	// ReasonExtensionInactive reports an inactive extension.
	ReasonExtensionInactive ReasonCode = "extension_inactive"
	// ReasonExtensionRuntimeMismatch reports a manifest/runtime mismatch.
	ReasonExtensionRuntimeMismatch ReasonCode = "extension_runtime_mismatch"
	// ReasonExtensionCapabilityMissing reports a missing extension capability.
	ReasonExtensionCapabilityMissing ReasonCode = "extension_capability_missing"
	// ReasonExtensionSourceForbidden reports a denied or unconfigured extension source.
	ReasonExtensionSourceForbidden ReasonCode = "extension_source_forbidden"
	// ReasonExtensionNotInstalled reports a missing installed extension.
	ReasonExtensionNotInstalled ReasonCode = "extension_not_installed"
	// ReasonExtensionValidationFailed reports extension lifecycle validation failure.
	ReasonExtensionValidationFailed ReasonCode = "extension_validation_failed"
	// ReasonRuntimeDescriptorMissing reports a missing runtime descriptor.
	ReasonRuntimeDescriptorMissing ReasonCode = "runtime_descriptor_missing"
	// ReasonRuntimeDescriptorMismatch reports a runtime descriptor mismatch.
	ReasonRuntimeDescriptorMismatch ReasonCode = "runtime_descriptor_mismatch"
	// ReasonHandlerMissing reports a missing extension handler.
	ReasonHandlerMissing ReasonCode = "handler_missing"
	// ReasonMCPUnreachable reports an unreachable MCP server.
	ReasonMCPUnreachable ReasonCode = "mcp_unreachable"
	// ReasonMCPAuthUnconfigured reports missing MCP auth configuration.
	ReasonMCPAuthUnconfigured ReasonCode = "mcp_auth_unconfigured"
	// ReasonMCPAuthRequired reports that MCP login is required.
	ReasonMCPAuthRequired ReasonCode = "mcp_auth_required"
	// ReasonMCPAuthExpired reports expired MCP auth.
	ReasonMCPAuthExpired ReasonCode = "mcp_auth_expired"
	// ReasonMCPAuthInvalid reports invalid MCP auth.
	ReasonMCPAuthInvalid ReasonCode = "mcp_auth_invalid"
	// ReasonMCPAuthRefreshFailed reports failed MCP auth refresh.
	ReasonMCPAuthRefreshFailed ReasonCode = "mcp_auth_refresh_failed"
	// ReasonNetworkRawTokenRejected reports raw claim-token fields in network payloads.
	ReasonNetworkRawTokenRejected ReasonCode = "network_raw_token_rejected"
	// ReasonSourceDisabled reports a disabled source.
	ReasonSourceDisabled ReasonCode = "source_disabled"
	// ReasonPolicyDenied reports a policy denial.
	ReasonPolicyDenied ReasonCode = "policy_denied"
	// ReasonVisibilityDenied reports a descriptor hidden from a scoped projection.
	ReasonVisibilityDenied ReasonCode = "visibility_denied"
	// ReasonApprovalRequired reports required approval.
	ReasonApprovalRequired ReasonCode = "approval_required"
	// ReasonApprovalUnreachable reports no available approval channel.
	ReasonApprovalUnreachable ReasonCode = "approval_unreachable"
	// ReasonApprovalTimedOut reports approval timeout.
	ReasonApprovalTimedOut ReasonCode = "approval_timed_out"
	// ReasonApprovalCanceled reports approval cancellation.
	ReasonApprovalCanceled ReasonCode = "approval_canceled"
	// ReasonApprovalTokenMissing reports a missing local approval token.
	ReasonApprovalTokenMissing ReasonCode = "approval_token_missing"
	// ReasonApprovalTokenExpired reports an expired local approval token.
	ReasonApprovalTokenExpired ReasonCode = "approval_token_expired"
	// ReasonApprovalTokenMismatch reports a local approval token binding mismatch.
	ReasonApprovalTokenMismatch ReasonCode = "approval_token_mismatch"
	// ReasonApprovalTokenReplayed reports a replayed local approval token.
	ReasonApprovalTokenReplayed ReasonCode = "approval_token_replayed"
	// ReasonSessionDenied reports session lineage denial.
	ReasonSessionDenied ReasonCode = "session_denied"
	// ReasonScopeMismatch reports caller-supplied scope conflicting with trusted scope.
	ReasonScopeMismatch ReasonCode = "scope_mismatch"
	// ReasonMemorySubagentWriteDenied reports a sub-agent direct memory write denial.
	ReasonMemorySubagentWriteDenied ReasonCode = "memory_subagent_write_denied"
	// ReasonHookDenied reports hook denial.
	ReasonHookDenied ReasonCode = "hook_denied"
	// ReasonSchemaInvalid reports invalid JSON schema.
	ReasonSchemaInvalid ReasonCode = "schema_invalid"
	// ReasonConflictedID reports a canonical id conflict.
	ReasonConflictedID ReasonCode = "conflicted_id"
	// ReasonConflictedSanitizedName reports an external-name sanitization conflict.
	ReasonConflictedSanitizedName ReasonCode = "conflicted_sanitized_name"
	// ReasonResultBudgetExceeded reports a result budget violation.
	ReasonResultBudgetExceeded ReasonCode = "result_budget_exceeded"
	// ReasonCallCanceled reports dispatch cancellation.
	ReasonCallCanceled ReasonCode = "call_canceled"
	// ReasonCallTimedOut reports dispatch deadline expiration.
	ReasonCallTimedOut ReasonCode = "call_timed_out"
	// ReasonSecretMetadata reports sensitive metadata in a public envelope.
	ReasonSecretMetadata ReasonCode = "secret_metadata"
	// ReasonToolsetUnknown reports a policy reference to an unknown toolset.
	ReasonToolsetUnknown ReasonCode = "toolset_unknown"
	// ReasonToolsetCycle reports recursive toolset membership.
	ReasonToolsetCycle ReasonCode = "toolset_cycle"
	// ReasonToolUnknown reports a policy reference to an unknown tool.
	ReasonToolUnknown ReasonCode = "tool_unknown"
	// ReasonConfigPathForbidden reports an agent-immutable config path.
	ReasonConfigPathForbidden ReasonCode = "config_path_forbidden"
	// ReasonConfigSecretPathForbidden reports a secret-bearing config path.
	ReasonConfigSecretPathForbidden ReasonCode = "config_secret_path_forbidden" // #nosec G101 -- reason code.
	// ReasonConfigTrustRootForbidden reports a trust-root config path.
	ReasonConfigTrustRootForbidden ReasonCode = "config_trust_root_forbidden"
	// ReasonConfigScopeNotAllowed reports an unsupported config write scope.
	ReasonConfigScopeNotAllowed ReasonCode = "config_scope_not_allowed"
	// ReasonConfigValidationFailed reports a validated config writer rejection.
	ReasonConfigValidationFailed ReasonCode = "config_validation_failed"
	// ReasonHookSourceImmutable reports a non-config hook source mutation attempt.
	ReasonHookSourceImmutable ReasonCode = "hook_source_immutable"
	// ReasonHookSecretInputForbidden reports a secret-bearing hook executor input.
	ReasonHookSecretInputForbidden ReasonCode = "hook_secret_input_forbidden"
	// ReasonHookValidationFailed reports a hook normalization or validation rejection.
	ReasonHookValidationFailed ReasonCode = "hook_validation_failed"
	// ReasonAutomationScopeForbidden reports an automation scope or source mutation denial.
	ReasonAutomationScopeForbidden ReasonCode = "automation_scope_forbidden"
	// ReasonAutomationSecretInputForbidden reports forbidden raw automation secret material.
	ReasonAutomationSecretInputForbidden ReasonCode = "automation_secret_input_forbidden" // #nosec G101 -- reason code.
	// ReasonAutomationValidationFailed reports automation manager or model validation rejection.
	ReasonAutomationValidationFailed ReasonCode = "automation_validation_failed"
	// ReasonAutonomySessionRequired reports a session-bound autonomy call without a caller session.
	ReasonAutonomySessionRequired ReasonCode = "autonomy_session_required"
	// ReasonAutonomyNoActiveLease reports no active run lease for the caller session.
	ReasonAutonomyNoActiveLease ReasonCode = "autonomy_no_active_lease"
	// ReasonAutonomyForeignRun reports a run id outside the caller session's active lease.
	ReasonAutonomyForeignRun ReasonCode = "autonomy_foreign_run"
	// ReasonAutonomyLeaseExpired reports an expired or non-active caller lease.
	ReasonAutonomyLeaseExpired ReasonCode = "autonomy_lease_expired"
	// ReasonAutonomyLeaseAlreadyHeld reports multiple active leases for one session.
	ReasonAutonomyLeaseAlreadyHeld ReasonCode = "autonomy_lease_already_held"
)

func MCPAuthStatusReason

func MCPAuthStatusReason(status MCPAuthStatus) (ReasonCode, bool)

MCPAuthStatusReason maps redacted MCP auth status to registry reason codes.

func ReasonOf

func ReasonOf(err error) (ReasonCode, bool)

ReasonOf extracts the primary deterministic reason from an error.

func (ReasonCode) Validate

func (r ReasonCode) Validate(field string) error

Validate ensures the reason code is documented.

type Redaction

type Redaction struct {
	Path   string     `json:"path"`
	Reason ReasonCode `json:"reason"`
	Bytes  int64      `json:"bytes,omitempty"`
}

Redaction records a redaction applied before a result crosses surfaces.

type Registry

type Registry interface {
	List(ctx context.Context, scope Scope) ([]ToolView, error)
	Search(ctx context.Context, scope Scope, q SearchQuery) ([]ToolView, error)
	Get(ctx context.Context, scope Scope, id ToolID) (ToolView, error)
	Call(ctx context.Context, scope Scope, req CallRequest) (ToolResult, error)
}

Registry owns tool discovery and dispatch for all surfaces.

type RegistryOption

type RegistryOption func(*RuntimeRegistry)

RegistryOption configures a runtime registry.

func WithApprovalBridge

func WithApprovalBridge(bridge ApprovalBridge) RegistryOption

WithApprovalBridge wires approval-required calls into a session permission path.

func WithDefaultMaxResultBytes

func WithDefaultMaxResultBytes(maxBytes int64) RegistryOption

WithDefaultMaxResultBytes sets the fallback result budget for silent descriptors.

func WithHookRunner

func WithHookRunner(hooks HookRunner) RegistryOption

WithHookRunner wires registry-owned call hooks into dispatch.

func WithPolicyEvaluator

func WithPolicyEvaluator(evaluator PolicyEvaluator) RegistryOption

WithPolicyEvaluator injects a custom evaluator for tests or composition roots.

func WithPolicyInputResolver

func WithPolicyInputResolver(resolver PolicyInputResolver, toolsets ToolsetCatalog) RegistryOption

WithPolicyInputResolver configures a scope-aware effective policy evaluator.

func WithPolicyInputs

func WithPolicyInputs(inputs PolicyInputs, toolsets ToolsetCatalog) RegistryOption

WithPolicyInputs configures the default effective policy evaluator.

func WithProviders

func WithProviders(providers ...Provider) RegistryOption

WithProviders registers provider sources for indexing.

func WithResultLimiter

func WithResultLimiter(limiter ResultLimiter) RegistryOption

WithResultLimiter wires result budget and redaction enforcement.

func WithSensitiveResultFields

func WithSensitiveResultFields(fields ...string) RegistryOption

WithSensitiveResultFields configures extra field names redacted from results.

func WithToolEventSink

func WithToolEventSink(events ToolEventSink) RegistryOption

WithToolEventSink wires structured dispatch events into observability.

type ResultLimiter

type ResultLimiter interface {
	Apply(ctx context.Context, d Descriptor, result ToolResult) (ToolResult, error)
}

ResultLimiter applies descriptor result budgets and redaction policy.

type RiskClass

type RiskClass string

RiskClass classifies the safety posture of a tool.

const (
	// RiskRead marks read-only local inspection.
	RiskRead RiskClass = "read"
	// RiskMutating marks state-changing behavior.
	RiskMutating RiskClass = "mutating"
	// RiskOpenWorld marks access to arbitrary external state.
	RiskOpenWorld RiskClass = "open_world"
	// RiskDestructive marks destructive or irreversible behavior.
	RiskDestructive RiskClass = "destructive"
)

func (RiskClass) Validate

func (r RiskClass) Validate(field string) error

Validate ensures the risk class is documented.

type RuntimeRegistry

type RuntimeRegistry struct {
	// contains filtered or unexported fields
}

RuntimeRegistry indexes providers and produces scoped projections.

func NewRegistry

func NewRegistry(opts ...RegistryOption) (*RuntimeRegistry, error)

NewRegistry validates providers and returns a deterministic registry.

func (*RuntimeRegistry) Call

func (r *RuntimeRegistry) Call(ctx context.Context, scope Scope, req CallRequest) (ToolResult, error)

Call runs the central provider-agnostic registry dispatch pipeline.

func (*RuntimeRegistry) Get

func (r *RuntimeRegistry) Get(ctx context.Context, scope Scope, id ToolID) (ToolView, error)

Get returns one tool from the scoped projection.

func (*RuntimeRegistry) GetToolset

func (r *RuntimeRegistry) GetToolset(ctx context.Context, scope Scope, id ToolsetID) (ToolsetView, error)

GetToolset returns one named toolset with expansion diagnostics for the supplied scope.

func (*RuntimeRegistry) List

func (r *RuntimeRegistry) List(ctx context.Context, scope Scope) ([]ToolView, error)

List returns an operator or session projection based on Scope.Operator.

func (*RuntimeRegistry) ListToolsets

func (r *RuntimeRegistry) ListToolsets(ctx context.Context, scope Scope) ([]ToolsetView, error)

ListToolsets returns named toolsets with expansion diagnostics for the supplied scope.

func (*RuntimeRegistry) OperatorProjection

func (r *RuntimeRegistry) OperatorProjection(ctx context.Context, scope Scope) ([]ToolView, error)

OperatorProjection returns all registered tools with diagnostics.

func (*RuntimeRegistry) Search

func (r *RuntimeRegistry) Search(ctx context.Context, scope Scope, q SearchQuery) ([]ToolView, error)

Search filters the scoped projection by descriptor text and provenance.

func (*RuntimeRegistry) SessionProjection

func (r *RuntimeRegistry) SessionProjection(ctx context.Context, scope Scope) ([]ToolView, error)

SessionProjection returns only callable tools for the effective session.

type Scope

type Scope struct {
	WorkspaceID string `json:"workspace_id,omitempty"`
	SessionID   string `json:"session_id,omitempty"`
	AgentName   string `json:"agent_name,omitempty"`
	ActorKind   string `json:"actor_kind,omitempty"`
	Operator    bool   `json:"operator,omitempty"`
}

Scope identifies the caller context used for projections and dispatch.

type SearchQuery

type SearchQuery struct {
	Query string `json:"query"`
	Limit int    `json:"limit,omitempty"`
}

SearchQuery describes a registry search request.

type SessionToolPolicy

type SessionToolPolicy struct {
	Enforced bool     `json:"enforced"`
	Tools    []ToolID `json:"tools,omitempty"`
}

SessionToolPolicy captures concrete resolved lineage atoms.

type SourceGrant

type SourceGrant struct {
	Kind  SourceKind `json:"kind"`
	Owner string     `json:"owner"`
}

SourceGrant grants policy to one descriptor source owner.

func ParseSourceGrant

func ParseSourceGrant(raw string) (SourceGrant, error)

ParseSourceGrant parses kind:owner source policy entries.

func (SourceGrant) Match

func (g SourceGrant) Match(source SourceRef) bool

Match reports whether the grant covers the descriptor source.

func (SourceGrant) Validate

func (g SourceGrant) Validate(field string) error

Validate ensures the grant can match a source deterministically.

type SourceKind

type SourceKind string

SourceKind identifies the provenance class for a descriptor.

const (
	// SourceBuiltin marks daemon-defined tools.
	SourceBuiltin SourceKind = "builtin"
	// SourceMCP marks tools discovered from MCP servers.
	SourceMCP SourceKind = "mcp"
	// SourceExtension marks tools provided by extensions.
	SourceExtension SourceKind = "extension"
	// SourceDynamic marks future runtime-assembled tools.
	SourceDynamic SourceKind = "dynamic"
)

func (SourceKind) String

func (k SourceKind) String() string

String returns the stable source kind text.

func (SourceKind) Validate

func (k SourceKind) Validate(field string) error

Validate ensures the source kind is documented.

type SourceRef

type SourceRef struct {
	Kind            SourceKind `json:"kind"`
	Owner           string     `json:"owner"`
	RawServerName   string     `json:"raw_server_name,omitempty"`
	RawToolName     string     `json:"raw_tool_name,omitempty"`
	ResourceID      string     `json:"resource_id,omitempty"`
	ResourceVersion string     `json:"resource_version,omitempty"`
	WorkspaceID     string     `json:"workspace_id,omitempty"`
	Scope           string     `json:"scope,omitempty"`
}

SourceRef preserves provenance without creating alternate tool identities.

func BuiltinSource

func BuiltinSource() SourceRef

BuiltinSource returns the provenance shared by daemon-compiled AGH tools.

func (SourceRef) Validate

func (s SourceRef) Validate(field string) error

Validate ensures source provenance can support deterministic diagnostics.

type Tool

type Tool struct {
	ID                  ToolID          `json:"id"`
	Backend             BackendRef      `json:"backend"`
	DisplayTitle        string          `json:"display_title,omitempty"`
	Description         string          `json:"description"`
	InputSchema         json.RawMessage `json:"input_schema"`
	OutputSchema        json.RawMessage `json:"output_schema,omitempty"`
	InputSchemaDigest   string          `json:"input_schema_digest"`
	OutputSchemaDigest  string          `json:"output_schema_digest,omitempty"`
	Source              SourceRef       `json:"source"`
	Visibility          Visibility      `json:"visibility"`
	Risk                RiskClass       `json:"risk"`
	ReadOnly            bool            `json:"read_only"`
	Destructive         bool            `json:"destructive"`
	OpenWorld           bool            `json:"open_world"`
	RequiresInteraction bool            `json:"requires_interaction"`
	ConcurrencySafe     bool            `json:"concurrency_safe"`
	MaxResultBytes      int64           `json:"max_result_bytes,omitempty"`
	Toolsets            []ToolsetID     `json:"toolsets,omitempty"`
	Tags                []string        `json:"tags,omitempty"`
	SearchHints         []string        `json:"search_hints,omitempty"`
}

Tool is the cold desired-state resource spec for a registry tool.

func (Tool) Descriptor

func (t Tool) Descriptor() Descriptor

Descriptor converts a cold resource into the runtime descriptor shape.

func (Tool) Validate

func (t Tool) Validate() error

Validate ensures the cold resource can normalize into a descriptor.

type ToolCallEvent

type ToolCallEvent struct {
	Kind                 ToolCallEventKind `json:"kind"`
	ToolID               ToolID            `json:"tool_id"`
	DisplayTitle         string            `json:"display_title,omitempty"`
	SourceKind           SourceKind        `json:"source_kind,omitempty"`
	SourceOwner          string            `json:"source_owner,omitempty"`
	WorkspaceID          string            `json:"workspace_id,omitempty"`
	SessionID            string            `json:"session_id,omitempty"`
	AgentName            string            `json:"agent_name,omitempty"`
	Risk                 RiskClass         `json:"risk,omitempty"`
	ReadOnly             bool              `json:"read_only"`
	Destructive          bool              `json:"destructive"`
	OpenWorld            bool              `json:"open_world"`
	ApprovalMode         string            `json:"approval_mode,omitempty"`
	Decision             string            `json:"decision,omitempty"`
	ReasonCodes          []ReasonCode      `json:"reason_codes,omitempty"`
	DurationMS           int64             `json:"duration_ms,omitempty"`
	ResultBytes          int64             `json:"result_bytes,omitempty"`
	Truncated            bool              `json:"truncated"`
	CorrelationID        string            `json:"correlation_id,omitempty"`
	ErrorCode            ErrorCode         `json:"error_code,omitempty"`
	InputDigest          string            `json:"input_digest,omitempty"`
	RedactedInputFields  []string          `json:"redacted_input_fields,omitempty"`
	ResultDigest         string            `json:"result_digest,omitempty"`
	ResultRedactionPaths []string          `json:"result_redaction_paths,omitempty"`
}

ToolCallEvent is the redacted dispatch event envelope emitted by Registry.Call.

type ToolCallEventKind

type ToolCallEventKind string

ToolCallEventKind identifies one structured dispatch observability event.

const (
	// ToolCallStarted reports that dispatch passed identity resolution and began.
	ToolCallStarted ToolCallEventKind = "tool.call_started"
	// ToolCallCompleted reports successful provider execution and result limiting.
	ToolCallCompleted ToolCallEventKind = "tool.call_completed"
	// ToolCallFailed reports schema, hook, backend, cancellation, or timeout failures.
	ToolCallFailed ToolCallEventKind = "tool.call_failed"
	// ToolCallDenied reports policy, availability, approval, conflict, or hook denial.
	ToolCallDenied ToolCallEventKind = "tool.call_denied"
	// ToolResultTruncated reports deterministic result truncation.
	ToolResultTruncated ToolCallEventKind = "tool.result_truncated"
)

type ToolContent

type ToolContent struct {
	Type     string                     `json:"type"`
	Text     string                     `json:"text,omitempty"`
	Data     json.RawMessage            `json:"data,omitempty"`
	MIMEType string                     `json:"mime_type,omitempty"`
	Metadata map[string]json.RawMessage `json:"metadata,omitempty"`
}

ToolContent is one typed content block returned by a tool.

type ToolError

type ToolError struct {
	Code        ErrorCode    `json:"code"`
	ToolID      ToolID       `json:"tool_id,omitempty"`
	Message     string       `json:"message"`
	ReasonCodes []ReasonCode `json:"reason_codes,omitempty"`
	Err         error        `json:"-"`
}

ToolError carries stable reason codes with a wrapped cause.

func NewToolError

func NewToolError(code ErrorCode, id ToolID, message string, err error, reasons ...ReasonCode) *ToolError

NewToolError builds a stable tool error envelope.

func (*ToolError) Error

func (e *ToolError) Error() string

Error returns the public error message.

func (*ToolError) Unwrap

func (e *ToolError) Unwrap() error

Unwrap returns the wrapped cause.

type ToolEventData

type ToolEventData struct {
	StartedAt time.Time
	Input     json.RawMessage
	Result    ToolResult
	Err       error
}

ToolEventData carries per-outcome event details.

type ToolEventSink

type ToolEventSink interface {
	EmitToolEvent(ctx context.Context, event ToolCallEvent) error
}

ToolEventSink receives redacted dispatch events from the registry.

type ToolID

type ToolID string

ToolID is the canonical public tool identity.

const (
	// ToolIDToolList lists tools in the caller's effective registry projection.
	ToolIDToolList ToolID = "agh__tool_list"
	// ToolIDToolSearch searches tools in the caller's effective registry projection.
	ToolIDToolSearch ToolID = "agh__tool_search"
	// ToolIDToolInfo reads one tool descriptor and diagnostics view.
	ToolIDToolInfo ToolID = "agh__tool_info"
	// ToolIDSkillList lists skills through the existing skill registry.
	ToolIDSkillList ToolID = "agh__skill_list"
	// ToolIDSkillSearch searches skills through the existing skill registry.
	ToolIDSkillSearch ToolID = "agh__skill_search"
	// ToolIDSkillView reads one skill and its verified body.
	ToolIDSkillView ToolID = "agh__skill_view"
	// ToolIDNetworkPeers lists visible network peers.
	ToolIDNetworkPeers ToolID = "agh__network_peers"
	// ToolIDNetworkStatus reads daemon-owned network runtime status.
	ToolIDNetworkStatus ToolID = "agh__network_status"
	// ToolIDNetworkChannels lists active AGH network channels.
	ToolIDNetworkChannels ToolID = "agh__network_channels"
	// ToolIDNetworkInbox reads queued inbound network messages for one local session.
	ToolIDNetworkInbox ToolID = "agh__network_inbox"
	// ToolIDNetworkSend sends one network message through the existing network manager.
	ToolIDNetworkSend ToolID = "agh__network_send"
	// ToolIDNetworkChannelCreate registers one AGH network channel with a stated purpose.
	ToolIDNetworkChannelCreate ToolID = "agh__network_channel_create"
	// ToolIDNetworkThreads lists public network thread summaries.
	ToolIDNetworkThreads ToolID = "agh__network_threads"
	// ToolIDNetworkThreadMessages reads messages in one public network thread.
	ToolIDNetworkThreadMessages ToolID = "agh__network_thread_messages"
	// ToolIDNetworkDirects lists direct-room summaries.
	ToolIDNetworkDirects ToolID = "agh__network_directs"
	// ToolIDNetworkDirectResolve creates or returns one deterministic direct room.
	ToolIDNetworkDirectResolve ToolID = "agh__network_direct_resolve"
	// ToolIDNetworkDirectMessages reads messages in one direct room.
	ToolIDNetworkDirectMessages ToolID = "agh__network_direct_messages"
	// ToolIDNetworkWork reads one network work lifecycle row.
	ToolIDNetworkWork ToolID = "agh__network_work"
	// ToolIDSessionList lists runtime sessions.
	ToolIDSessionList ToolID = "agh__session_list"
	// ToolIDSessionStatus reads one runtime session snapshot.
	ToolIDSessionStatus ToolID = "agh__session_status"
	// ToolIDSessionHistory reads grouped turn history for one session.
	ToolIDSessionHistory ToolID = "agh__session_history"
	// ToolIDSessionEvents reads persisted events for one session.
	ToolIDSessionEvents ToolID = "agh__session_events"
	// ToolIDSessionDescribe reads a composite read-only session description.
	ToolIDSessionDescribe ToolID = "agh__session_describe"
	// ToolIDSessionHealth reads metadata-only session health and wake eligibility.
	ToolIDSessionHealth ToolID = "agh__session_health"
	// ToolIDAgentHeartbeatStatus reads resolved Heartbeat policy, wake state, health, and wake audit.
	ToolIDAgentHeartbeatStatus ToolID = "agh__agent_heartbeat_status"
	// ToolIDAgentHeartbeatWake requests one managed advisory Heartbeat wake decision.
	ToolIDAgentHeartbeatWake ToolID = "agh__agent_heartbeat_wake"
	// ToolIDWorkspaceList lists registered workspaces.
	ToolIDWorkspaceList ToolID = "agh__workspace_list"
	// ToolIDWorkspaceInfo reads one registered workspace record.
	ToolIDWorkspaceInfo ToolID = "agh__workspace_info"
	// ToolIDWorkspaceDescribe reads one resolved workspace detail projection.
	ToolIDWorkspaceDescribe ToolID = "agh__workspace_describe"
	// ToolIDAgentCreate authors one AGENT.md definition at global or workspace scope.
	ToolIDAgentCreate ToolID = "agh__agent_create"
	// ToolIDProviderModelsList lists the daemon provider model catalog.
	ToolIDProviderModelsList ToolID = "agh__provider_models_list"
	// ToolIDProviderModelsRefresh refreshes one or more provider model catalog sources.
	ToolIDProviderModelsRefresh ToolID = "agh__provider_models_refresh"
	// ToolIDProviderModelsStatus reads provider model catalog source status.
	ToolIDProviderModelsStatus ToolID = "agh__provider_models_status"
	// ToolIDMemoryList lists memory headers visible for a scope.
	ToolIDMemoryList ToolID = "agh__memory_list"
	// ToolIDMemoryShow reads one memory document through the current memory store.
	ToolIDMemoryShow ToolID = "agh__memory_show"
	// ToolIDMemorySearch recalls memory documents through the active memory provider.
	ToolIDMemorySearch ToolID = "agh__memory_search"
	// ToolIDMemoryPropose submits a controller-backed memory proposal.
	ToolIDMemoryPropose ToolID = "agh__memory_propose"
	// ToolIDMemoryNote records a controller-backed ad-hoc memory note.
	ToolIDMemoryNote ToolID = "agh__memory_note"
	// ToolIDMemoryHealth reads Memory v2 health and derived catalog state.
	ToolIDMemoryHealth ToolID = "agh__memory_health"
	// ToolIDMemoryScopeShow reports effective Memory v2 scope resolution.
	ToolIDMemoryScopeShow ToolID = "agh__memory_scope_show"
	// ToolIDMemoryAdminHistory lists Memory v2 operation history without reusing the removed legacy ID.
	ToolIDMemoryAdminHistory ToolID = "agh__memory_admin_history"
	// ToolIDMemoryReindex rebuilds Memory v2 derived indexes.
	ToolIDMemoryReindex ToolID = "agh__memory_reindex"
	// ToolIDMemoryPromote promotes one Memory v2 entry across scopes.
	ToolIDMemoryPromote ToolID = "agh__memory_promote"
	// ToolIDMemoryReset resets derived Memory v2 state.
	ToolIDMemoryReset ToolID = "agh__memory_reset"
	// ToolIDMemoryReload invalidates future Memory v2 snapshots.
	ToolIDMemoryReload ToolID = "agh__memory_reload"
	// ToolIDMemoryDecisionsList lists Memory v2 controller decisions.
	ToolIDMemoryDecisionsList ToolID = "agh__memory_decisions_list"
	// ToolIDMemoryDecisionsShow reads one Memory v2 controller decision.
	ToolIDMemoryDecisionsShow ToolID = "agh__memory_decisions_show"
	// ToolIDMemoryDecisionsRevert reverts one applied Memory v2 controller decision.
	ToolIDMemoryDecisionsRevert ToolID = "agh__memory_decisions_revert"
	// ToolIDMemoryRecallTrace reads one materialized Memory v2 recall trace.
	ToolIDMemoryRecallTrace ToolID = "agh__memory_recall_trace"
	// ToolIDMemoryDreamStatus reads live Memory v2 dreaming status.
	ToolIDMemoryDreamStatus ToolID = "agh__memory_dream_status"
	// ToolIDMemoryDreamList lists Memory v2 dreaming run records.
	ToolIDMemoryDreamList ToolID = "agh__memory_dream_list"
	// ToolIDMemoryDreamShow reads one Memory v2 dreaming run record.
	ToolIDMemoryDreamShow ToolID = "agh__memory_dream_show"
	// ToolIDMemoryDreamTrigger triggers Memory v2 dream consolidation.
	ToolIDMemoryDreamTrigger ToolID = "agh__memory_dream_trigger"
	// ToolIDMemoryDreamRetry retries Memory v2 dream consolidation.
	ToolIDMemoryDreamRetry ToolID = "agh__memory_dream_retry"
	// ToolIDMemoryDailyList lists Memory v2 daily operation logs.
	ToolIDMemoryDailyList ToolID = "agh__memory_daily_list"
	// ToolIDMemoryExtractorStatus reads Memory v2 extractor queue status.
	ToolIDMemoryExtractorStatus ToolID = "agh__memory_extractor_status"
	// ToolIDMemoryExtractorFailures lists Memory v2 extractor failures.
	ToolIDMemoryExtractorFailures ToolID = "agh__memory_extractor_failures"
	// ToolIDMemoryExtractorRetry retries Memory v2 extractor failures.
	ToolIDMemoryExtractorRetry ToolID = "agh__memory_extractor_retry"
	// ToolIDMemoryExtractorDrain drains the Memory v2 extractor queue.
	ToolIDMemoryExtractorDrain ToolID = "agh__memory_extractor_drain"
	// ToolIDMemoryProviderList lists Memory v2 providers.
	ToolIDMemoryProviderList ToolID = "agh__memory_provider_list"
	// ToolIDMemoryProviderGet reads one Memory v2 provider.
	ToolIDMemoryProviderGet ToolID = "agh__memory_provider_get"
	// ToolIDMemoryProviderSelect selects the active Memory v2 provider.
	ToolIDMemoryProviderSelect ToolID = "agh__memory_provider_select"
	// ToolIDMemoryProviderEnable enables one Memory v2 provider.
	ToolIDMemoryProviderEnable ToolID = "agh__memory_provider_enable"
	// ToolIDMemoryProviderDisable disables one Memory v2 provider.
	ToolIDMemoryProviderDisable ToolID = "agh__memory_provider_disable"
	// ToolIDMemorySessionLedger reads one materialized Memory v2 session ledger.
	ToolIDMemorySessionLedger ToolID = "agh__memory_session_ledger"
	// ToolIDMemorySessionReplay replays one materialized Memory v2 session ledger.
	ToolIDMemorySessionReplay ToolID = "agh__memory_session_replay"
	// ToolIDMemorySessionsPrune prunes Memory v2 session ledgers.
	ToolIDMemorySessionsPrune ToolID = "agh__memory_sessions_prune"
	// ToolIDMemorySessionsRepair repairs Memory v2 session ledgers.
	ToolIDMemorySessionsRepair ToolID = "agh__memory_sessions_repair"
	// ToolIDListLogs reads redacted runtime logs.
	ToolIDListLogs ToolID = "agh__logs"
	// ToolIDObserveMetrics reads daemon observability health and metrics.
	ToolIDObserveMetrics ToolID = "agh__observe_metrics"
	// ToolIDObserveSearch searches redacted observability events.
	ToolIDObserveSearch ToolID = "agh__observe_search"
	// ToolIDBridgesList lists bridge instances without secret bindings.
	ToolIDBridgesList ToolID = "agh__bridges_list"
	// ToolIDBridgesStatus reads bridge status and health without credentials.
	ToolIDBridgesStatus ToolID = "agh__bridges_status"
	// ToolIDTaskList lists task summaries through the task service.
	ToolIDTaskList ToolID = "agh__task_list"
	// ToolIDTaskRead reads one task view through the task service.
	ToolIDTaskRead ToolID = "agh__task_read"
	// ToolIDTaskCreate creates one root task through the task service.
	ToolIDTaskCreate ToolID = "agh__task_create"
	// ToolIDTaskChildCreate creates one child task through the task service.
	ToolIDTaskChildCreate ToolID = "agh__task_child_create"
	// ToolIDTaskUpdate updates one task through the task service.
	ToolIDTaskUpdate ToolID = "agh__task_update"
	// ToolIDTaskCancel cancels one task through the task service.
	ToolIDTaskCancel ToolID = "agh__task_cancel"
	// ToolIDTaskRunList lists task runs through the task service.
	ToolIDTaskRunList ToolID = "agh__task_run_list"
	// ToolIDTaskRunReviewRequest requests a review for one terminal task run.
	ToolIDTaskRunReviewRequest ToolID = "agh__task_run_review_request"
	// ToolIDTaskRunReviewList lists task-run reviews through the task service.
	ToolIDTaskRunReviewList ToolID = "agh__task_run_review_list"
	// ToolIDTaskRunReviewShow reads one task-run review through the task service.
	ToolIDTaskRunReviewShow ToolID = "agh__task_run_review_show"
	// ToolIDTaskExecutionProfileGet reads one task execution profile.
	ToolIDTaskExecutionProfileGet ToolID = "agh__task_execution_profile_get"
	// ToolIDTaskExecutionProfileSet updates one task execution profile.
	ToolIDTaskExecutionProfileSet ToolID = "agh__task_execution_profile_set"
	// ToolIDTaskExecutionProfileDelete removes one task execution profile.
	ToolIDTaskExecutionProfileDelete ToolID = "agh__task_execution_profile_delete"
	// ToolIDTaskNotificationSubscribe creates one bridge notification subscription for a task.
	ToolIDTaskNotificationSubscribe ToolID = "agh__task_notification_subscribe"
	// ToolIDTaskNotificationList lists bridge notification subscriptions for a task.
	ToolIDTaskNotificationList ToolID = "agh__task_notification_list"
	// ToolIDTaskNotificationShow reads one bridge notification subscription for a task.
	ToolIDTaskNotificationShow ToolID = "agh__task_notification_show"
	// ToolIDTaskNotificationDelete deletes one bridge notification subscription for a task.
	ToolIDTaskNotificationDelete ToolID = "agh__task_notification_delete"
	// ToolIDTaskRunClaimNext claims the next run for the caller session.
	ToolIDTaskRunClaimNext ToolID = "agh__task_run_claim_next"
	// ToolIDTaskRunHeartbeat extends the caller session's active run lease.
	ToolIDTaskRunHeartbeat ToolID = "agh__task_run_heartbeat"
	// ToolIDTaskRunComplete completes the caller session's active run lease.
	ToolIDTaskRunComplete ToolID = "agh__task_run_complete"
	// ToolIDTaskRunFail fails the caller session's active run lease.
	ToolIDTaskRunFail ToolID = "agh__task_run_fail"
	// ToolIDTaskRunRelease releases the caller session's active run lease.
	ToolIDTaskRunRelease ToolID = "agh__task_run_release"
	// ToolIDTaskRunReviewSubmit submits the caller session's bound task-run review verdict.
	ToolIDTaskRunReviewSubmit ToolID = "agh__task_run_review_submit"
	// ToolIDConfigShow shows the redacted effective config.
	ToolIDConfigShow ToolID = "agh__config_show"
	// ToolIDConfigList lists redacted effective config entries.
	ToolIDConfigList ToolID = "agh__config_list"
	// ToolIDConfigGet reads one redacted effective config entry.
	ToolIDConfigGet ToolID = "agh__config_get"
	// ToolIDConfigSet mutates one validated config overlay value.
	ToolIDConfigSet ToolID = "agh__config_set"
	// ToolIDConfigUnset removes one validated config overlay value.
	ToolIDConfigUnset ToolID = "agh__config_unset"
	// ToolIDConfigDiff compares defaults/global config against the effective view.
	ToolIDConfigDiff ToolID = "agh__config_diff"
	// ToolIDConfigPath reports resolved config paths.
	ToolIDConfigPath ToolID = "agh__config_path"
	// ToolIDHooksList lists resolved hooks.
	ToolIDHooksList ToolID = "agh__hooks_list"
	// ToolIDHooksInfo reads one resolved hook.
	ToolIDHooksInfo ToolID = "agh__hooks_info"
	// ToolIDHooksEvents lists supported hook events.
	ToolIDHooksEvents ToolID = "agh__hooks_events"
	// ToolIDHooksRuns lists hook run audit records.
	ToolIDHooksRuns ToolID = "agh__hooks_runs"
	// ToolIDHooksCreate creates one config-backed hook declaration.
	ToolIDHooksCreate ToolID = "agh__hooks_create"
	// ToolIDHooksUpdate updates one config-backed hook declaration.
	ToolIDHooksUpdate ToolID = "agh__hooks_update"
	// ToolIDHooksDelete deletes one config-backed hook declaration.
	ToolIDHooksDelete ToolID = "agh__hooks_delete"
	// ToolIDHooksEnable enables one config-backed hook declaration.
	ToolIDHooksEnable ToolID = "agh__hooks_enable"
	// ToolIDHooksDisable disables one config-backed hook declaration.
	ToolIDHooksDisable ToolID = "agh__hooks_disable"
	// ToolIDAutomationJobsList lists automation jobs through the automation manager.
	ToolIDAutomationJobsList ToolID = "agh__automation_jobs_list"
	// ToolIDAutomationJobsGet reads one automation job through the automation manager.
	ToolIDAutomationJobsGet ToolID = "agh__automation_jobs_get"
	// ToolIDAutomationJobsCreate creates one dynamic automation job through the automation manager.
	ToolIDAutomationJobsCreate ToolID = "agh__automation_jobs_create"
	// ToolIDAutomationJobsUpdate updates one automation job through the automation manager.
	ToolIDAutomationJobsUpdate ToolID = "agh__automation_jobs_update"
	// ToolIDAutomationJobsDelete deletes one dynamic automation job through the automation manager.
	ToolIDAutomationJobsDelete ToolID = "agh__automation_jobs_delete"
	// ToolIDAutomationJobsEnable enables one automation job through the automation manager.
	ToolIDAutomationJobsEnable ToolID = "agh__automation_jobs_enable"
	// ToolIDAutomationJobsDisable disables one automation job through the automation manager.
	ToolIDAutomationJobsDisable ToolID = "agh__automation_jobs_disable"
	// ToolIDAutomationJobsTrigger manually triggers one automation job through the automation manager.
	ToolIDAutomationJobsTrigger ToolID = "agh__automation_jobs_trigger"
	// ToolIDAutomationJobsHistory lists run history for one automation job.
	ToolIDAutomationJobsHistory ToolID = "agh__automation_jobs_history"
	// ToolIDAutomationTriggersList lists automation triggers through the automation manager.
	ToolIDAutomationTriggersList ToolID = "agh__automation_triggers_list"
	// ToolIDAutomationTriggersGet reads one automation trigger through the automation manager.
	ToolIDAutomationTriggersGet ToolID = "agh__automation_triggers_get"
	// ToolIDAutomationTriggersCreate creates one dynamic automation trigger through the automation manager.
	ToolIDAutomationTriggersCreate ToolID = "agh__automation_triggers_create"
	// ToolIDAutomationTriggersUpdate updates one automation trigger through the automation manager.
	ToolIDAutomationTriggersUpdate ToolID = "agh__automation_triggers_update"
	// ToolIDAutomationTriggersDelete deletes one dynamic automation trigger through the automation manager.
	ToolIDAutomationTriggersDelete ToolID = "agh__automation_triggers_delete"
	// ToolIDAutomationTriggersEnable enables one automation trigger through the automation manager.
	ToolIDAutomationTriggersEnable ToolID = "agh__automation_triggers_enable"
	// ToolIDAutomationTriggersDisable disables one automation trigger through the automation manager.
	ToolIDAutomationTriggersDisable ToolID = "agh__automation_triggers_disable"
	// ToolIDAutomationTriggersHistory lists run history for one automation trigger.
	ToolIDAutomationTriggersHistory ToolID = "agh__automation_triggers_history"
	// ToolIDAutomationRunsList lists automation run records through the automation manager.
	ToolIDAutomationRunsList ToolID = "agh__automation_runs_list"
	// ToolIDAutomationRunsGet reads one automation run record through the automation manager.
	ToolIDAutomationRunsGet ToolID = "agh__automation_runs_get"
	// ToolIDExtensionsSearch searches configured extension marketplace sources.
	ToolIDExtensionsSearch ToolID = "agh__extensions_search"
	// ToolIDExtensionsList lists installed extensions through the extension registry.
	ToolIDExtensionsList ToolID = "agh__extensions_list"
	// ToolIDExtensionsInfo reads one installed extension status.
	ToolIDExtensionsInfo ToolID = "agh__extensions_info"
	// ToolIDExtensionsInstall installs one extension through a managed local or marketplace source.
	ToolIDExtensionsInstall ToolID = "agh__extensions_install"
	// ToolIDExtensionsUpdate updates one or more marketplace-installed extensions.
	ToolIDExtensionsUpdate ToolID = "agh__extensions_update"
	// ToolIDExtensionsRemove removes one managed installed extension.
	ToolIDExtensionsRemove ToolID = "agh__extensions_remove"
	// ToolIDExtensionsEnable enables one installed extension.
	ToolIDExtensionsEnable ToolID = "agh__extensions_enable"
	// ToolIDExtensionsDisable disables one installed extension.
	ToolIDExtensionsDisable ToolID = "agh__extensions_disable"
	// ToolIDBundlesList lists the extension bundle catalog and active bundle records.
	ToolIDBundlesList ToolID = "agh__bundles_list"
	// ToolIDBundlesInfo reads one active bundle record.
	ToolIDBundlesInfo ToolID = "agh__bundles_info"
	// ToolIDBundlesActivate activates one extension bundle profile.
	ToolIDBundlesActivate ToolID = "agh__bundles_activate"
	// ToolIDBundlesDeactivate deactivates one bundle activation.
	ToolIDBundlesDeactivate ToolID = "agh__bundles_deactivate"
	// ToolIDBundlesStatus reports bundle catalog, activation, and network-default status.
	ToolIDBundlesStatus ToolID = "agh__bundles_status"
	// ToolIDResourcesList lists desired-state resource records.
	ToolIDResourcesList ToolID = "agh__resources_list"
	// ToolIDResourcesInfo reads one desired-state resource record.
	ToolIDResourcesInfo ToolID = "agh__resources_info"
	// ToolIDResourcesSnapshot reads a filtered desired-state resource snapshot.
	ToolIDResourcesSnapshot ToolID = "agh__resources_snapshot"
	// ToolIDMCPStatus probes one configured MCP server without exposing login/logout as tools.
	ToolIDMCPStatus ToolID = "agh__mcp_status"
	// ToolIDMCPAuthStatus reads redacted MCP auth diagnostics for one configured server.
	ToolIDMCPAuthStatus ToolID = "agh__mcp_auth_status"
)

func CanonicalToolID

func CanonicalToolID(namespace string, segments ...string) (ToolID, error)

CanonicalToolID builds a ToolID from raw namespace segments.

func Canonicalize

func Canonicalize(rawServer, rawTool string) (ToolID, error)

Canonicalize normalizes one raw MCP server/tool pair into the canonical registry ToolID.

func (ToolID) MarshalText

func (id ToolID) MarshalText() ([]byte, error)

MarshalText encodes the validated id.

func (ToolID) Namespace

func (id ToolID) Namespace() (string, error)

Namespace returns the leading namespace segment.

func (ToolID) Segments

func (id ToolID) Segments() ([]string, error)

Segments returns a copy of the namespace segments.

func (ToolID) String

func (id ToolID) String() string

String returns the canonical string value.

func (*ToolID) UnmarshalText

func (id *ToolID) UnmarshalText(text []byte) error

UnmarshalText decodes and validates an id.

func (ToolID) Validate

func (id ToolID) Validate() error

Validate ensures the tool id follows the canonical grammar.

type ToolPattern

type ToolPattern struct {
	// contains filtered or unexported fields
}

ToolPattern matches exact ToolIDs or namespace-prefix wildcards.

func ParseToolPattern

func ParseToolPattern(raw string) (ToolPattern, error)

ParseToolPattern validates one exact ToolID or namespace-prefix wildcard.

func ParseToolPatterns

func ParseToolPatterns(values []string) ([]ToolPattern, error)

ParseToolPatterns validates a list of policy patterns.

func (ToolPattern) Match

func (p ToolPattern) Match(id ToolID) bool

Match reports whether the pattern covers the given canonical ToolID.

func (ToolPattern) String

func (p ToolPattern) String() string

String returns the stable policy expression.

type ToolResult

type ToolResult struct {
	Content    []ToolContent              `json:"content,omitempty"`
	Structured json.RawMessage            `json:"structured,omitempty"`
	Preview    string                     `json:"preview,omitempty"`
	Artifacts  []ArtifactRef              `json:"artifacts,omitempty"`
	Metadata   map[string]json.RawMessage `json:"metadata,omitempty"`
	Redactions []Redaction                `json:"redactions,omitempty"`
	Truncated  bool                       `json:"truncated"`
	Bytes      int64                      `json:"bytes"`
	DurationMS int64                      `json:"duration_ms"`
}

ToolResult is the canonical result envelope for all backends.

func (ToolResult) Validate

func (r ToolResult) Validate(maxBytes int64) error

Validate checks the public result envelope and metadata safety.

type ToolSource

type ToolSource = SourceKind

ToolSource preserves the public source-name type used by existing resource contracts.

type ToolView

type ToolView struct {
	Descriptor   Descriptor            `json:"descriptor"`
	Availability Availability          `json:"availability"`
	Decision     EffectiveToolDecision `json:"decision"`
}

ToolView is a descriptor plus effective diagnostics for a caller.

type Toolset

type Toolset struct {
	ID       ToolsetID   `json:"id"`
	Tools    []string    `json:"tools,omitempty"`
	Toolsets []ToolsetID `json:"toolsets,omitempty"`
}

Toolset groups exact tools, patterns, and nested toolsets.

func (Toolset) Validate

func (t Toolset) Validate() error

Validate ensures the toolset is syntactically expandable.

type ToolsetCatalog

type ToolsetCatalog struct {
	// contains filtered or unexported fields
}

ToolsetCatalog expands named toolsets into concrete ToolID atoms.

func NewToolsetCatalog

func NewToolsetCatalog(toolsets ...Toolset) (ToolsetCatalog, error)

NewToolsetCatalog validates and indexes toolsets by ID.

func (ToolsetCatalog) Expand

func (c ToolsetCatalog) Expand(id ToolsetID, universe []ToolID) ([]ToolID, error)

Expand resolves one toolset into concrete ToolID atoms.

func (ToolsetCatalog) ExpandPatterns

func (c ToolsetCatalog) ExpandPatterns(
	patterns []ToolPattern,
	toolsetIDs []ToolsetID,
	universe []ToolID,
) ([]ToolID, error)

ExpandPatterns resolves patterns and toolsets into concrete ToolID atoms.

func (ToolsetCatalog) Get

func (c ToolsetCatalog) Get(id ToolsetID) (Toolset, bool)

Get returns one known toolset definition.

func (ToolsetCatalog) IDs

func (c ToolsetCatalog) IDs() []ToolsetID

IDs returns the known toolset IDs in deterministic order.

func (ToolsetCatalog) List

func (c ToolsetCatalog) List() []Toolset

List returns all known toolsets in deterministic order.

type ToolsetID

type ToolsetID string

ToolsetID is the canonical public toolset identity.

const (
	// ToolsetIDBootstrap groups registry self-inspection tools.
	ToolsetIDBootstrap ToolsetID = "agh__bootstrap"
	// ToolsetIDCatalog groups registry and skill catalog tools.
	ToolsetIDCatalog ToolsetID = "agh__catalog"
	// ToolsetIDCoordination groups network coordination tools.
	ToolsetIDCoordination ToolsetID = "agh__coordination"
	// ToolsetIDTasks groups bounded task tools.
	ToolsetIDTasks ToolsetID = "agh__tasks"
	// ToolsetIDAutonomy groups session-bound task-run autonomy tools.
	ToolsetIDAutonomy ToolsetID = "agh__autonomy"
	// ToolsetIDSessions groups read-only runtime session tools.
	ToolsetIDSessions ToolsetID = "agh__sessions"
	// ToolsetIDAuthoredContext groups managed Soul/Heartbeat read and wake tools.
	ToolsetIDAuthoredContext ToolsetID = "agh__authored_context"
	// ToolsetIDWorkspace groups workspace inspection and managed agent authoring tools.
	ToolsetIDWorkspace ToolsetID = "agh__workspace"
	// ToolsetIDProviderModels groups provider model catalog tools.
	ToolsetIDProviderModels ToolsetID = "agh__provider_models"
	// ToolsetIDMemory groups Memory v2 read and proposal tools.
	ToolsetIDMemory ToolsetID = "agh__memory"
	// ToolsetIDMemoryAdmin groups Memory v2 operational tools.
	ToolsetIDMemoryAdmin ToolsetID = "agh__memory_admin"
	// ToolsetIDObserve groups read-only observability tools.
	ToolsetIDObserve ToolsetID = "agh__observe"
	// ToolsetIDBridges groups read-only bridge inspection tools.
	ToolsetIDBridges ToolsetID = "agh__bridges"
	// ToolsetIDConfig groups validated config tools.
	ToolsetIDConfig ToolsetID = "agh__config"
	// ToolsetIDHooks groups hook introspection and mutable config-backed hook tools.
	ToolsetIDHooks ToolsetID = "agh__hooks"
	// ToolsetIDAutomation groups automation lifecycle and run inspection tools.
	ToolsetIDAutomation ToolsetID = "agh__automation"
	// ToolsetIDExtensions groups extension discovery and lifecycle tools.
	ToolsetIDExtensions ToolsetID = "agh__extensions"
	// ToolsetIDBundles groups extension bundle lifecycle tools.
	ToolsetIDBundles ToolsetID = "agh__bundles"
	// ToolsetIDResources groups desired-state resource inspection tools.
	ToolsetIDResources ToolsetID = "agh__resources"
	// ToolsetIDMCP groups MCP probe and status diagnostics.
	ToolsetIDMCP ToolsetID = "agh__mcp"
	// ToolsetIDMCPAuth groups redacted MCP auth diagnostics.
	ToolsetIDMCPAuth ToolsetID = "agh__mcp_auth"
)

func (ToolsetID) MarshalText

func (id ToolsetID) MarshalText() ([]byte, error)

MarshalText encodes the validated id.

func (ToolsetID) String

func (id ToolsetID) String() string

String returns the canonical string value.

func (*ToolsetID) UnmarshalText

func (id *ToolsetID) UnmarshalText(text []byte) error

UnmarshalText decodes and validates an id.

func (ToolsetID) Validate

func (id ToolsetID) Validate() error

Validate ensures the toolset id follows the canonical grammar.

type ToolsetView

type ToolsetView struct {
	Toolset       Toolset      `json:"toolset"`
	ExpandedTools []ToolID     `json:"expanded_tools,omitempty"`
	ReasonCodes   []ReasonCode `json:"reason_codes,omitempty"`
}

ToolsetView is a named toolset plus its current expansion diagnostics.

type ValidationError

type ValidationError struct {
	Field  string
	Reason ReasonCode
	Detail string
}

ValidationError describes deterministic contract validation failures.

func NewValidationError

func NewValidationError(field string, reason ReasonCode, detail string) *ValidationError

NewValidationError builds a deterministic validation error.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error returns a stable validation message.

type Visibility

type Visibility string

Visibility identifies which surfaces may display a descriptor.

const (
	// VisibilityInternal limits a tool to daemon-internal use.
	VisibilityInternal Visibility = "internal"
	// VisibilityOperator exposes a tool to operator diagnostics.
	VisibilityOperator Visibility = "operator"
	// VisibilitySession exposes a tool to session-scoped views.
	VisibilitySession Visibility = "session"
	// VisibilityModel exposes a tool to model-visible projections.
	VisibilityModel Visibility = "model"
)

func (Visibility) Validate

func (v Visibility) Validate(field string) error

Validate ensures the visibility is documented.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL