# extensions

<!-- Code generated by gomarkdoc. DO NOT EDIT -->

# extensions

```go
import "github.com/goppydae/sharur/extensions"
```

## Index

- [func LoadErrors\(errs \[\]error\) error](<#LoadErrors>)
- [func Serve\(impl Plugin\)](<#Serve>)
- [type AgentState](<#AgentState>)
- [type GRPCClient](<#GRPCClient>)
  - [func \(m \*GRPCClient\) AfterCompact\(ctx context.Context, freedTokens int\)](<#GRPCClient.AfterCompact>)
  - [func \(m \*GRPCClient\) AfterProviderResponse\(ctx context.Context, content string, numToolCalls int\)](<#GRPCClient.AfterProviderResponse>)
  - [func \(m \*GRPCClient\) AfterToolCall\(ctx context.Context, call \*agent.ToolCall, result \*tools.ToolResult\) \*tools.ToolResult](<#GRPCClient.AfterToolCall>)
  - [func \(m \*GRPCClient\) AgentEnd\(ctx context.Context\)](<#GRPCClient.AgentEnd>)
  - [func \(m \*GRPCClient\) AgentStart\(ctx context.Context\)](<#GRPCClient.AgentStart>)
  - [func \(m \*GRPCClient\) BeforeCompact\(ctx context.Context, prep agent.CompactionPrep\) \*agent.CompactionResult](<#GRPCClient.BeforeCompact>)
  - [func \(m \*GRPCClient\) BeforePrompt\(ctx context.Context, state \*agent.AgentState\) \*agent.AgentState](<#GRPCClient.BeforePrompt>)
  - [func \(m \*GRPCClient\) BeforeProviderRequest\(ctx context.Context, req \*llm.CompletionRequest\) \*llm.CompletionRequest](<#GRPCClient.BeforeProviderRequest>)
  - [func \(m \*GRPCClient\) BeforeToolCall\(ctx context.Context, call \*agent.ToolCall, args json.RawMessage\) \(\*tools.ToolResult, bool\)](<#GRPCClient.BeforeToolCall>)
  - [func \(m \*GRPCClient\) Degraded\(\) \(bool, error\)](<#GRPCClient.Degraded>)
  - [func \(m \*GRPCClient\) ModifyContext\(ctx context.Context, messages \[\]types.Message\) \[\]types.Message](<#GRPCClient.ModifyContext>)
  - [func \(m \*GRPCClient\) ModifyInput\(ctx context.Context, text string\) agent.InputResult](<#GRPCClient.ModifyInput>)
  - [func \(m \*GRPCClient\) ModifySystemPrompt\(prompt string\) string](<#GRPCClient.ModifySystemPrompt>)
  - [func \(m \*GRPCClient\) Name\(\) string](<#GRPCClient.Name>)
  - [func \(m \*GRPCClient\) SessionEnd\(ctx context.Context, sessionID string, reason agent.SessionEndReason\)](<#GRPCClient.SessionEnd>)
  - [func \(m \*GRPCClient\) SessionStart\(ctx context.Context, sessionID string, reason agent.SessionStartReason\)](<#GRPCClient.SessionStart>)
  - [func \(m \*GRPCClient\) Tools\(\) \[\]tools.Tool](<#GRPCClient.Tools>)
  - [func \(m \*GRPCClient\) TurnEnd\(ctx context.Context\)](<#GRPCClient.TurnEnd>)
  - [func \(m \*GRPCClient\) TurnStart\(ctx context.Context\)](<#GRPCClient.TurnStart>)
- [type GRPCServer](<#GRPCServer>)
  - [func \(m \*GRPCServer\) AfterCompact\(ctx context.Context, req \*proto.AfterCompactRequest\) \(\*proto.Empty, error\)](<#GRPCServer.AfterCompact>)
  - [func \(m \*GRPCServer\) AfterProviderResponse\(ctx context.Context, req \*proto.AfterProviderResponseRequest\) \(\*proto.Empty, error\)](<#GRPCServer.AfterProviderResponse>)
  - [func \(m \*GRPCServer\) AfterToolCall\(ctx context.Context, req \*proto.AfterToolCallRequest\) \(\*proto.AfterToolCallResponse, error\)](<#GRPCServer.AfterToolCall>)
  - [func \(m \*GRPCServer\) AgentEnd\(ctx context.Context, \_ \*proto.Empty\) \(\*proto.Empty, error\)](<#GRPCServer.AgentEnd>)
  - [func \(m \*GRPCServer\) AgentStart\(ctx context.Context, \_ \*proto.Empty\) \(\*proto.Empty, error\)](<#GRPCServer.AgentStart>)
  - [func \(m \*GRPCServer\) BeforeCompact\(ctx context.Context, req \*proto.BeforeCompactRequest\) \(\*proto.BeforeCompactResponse, error\)](<#GRPCServer.BeforeCompact>)
  - [func \(m \*GRPCServer\) BeforePrompt\(ctx context.Context, req \*proto.BeforePromptRequest\) \(\*proto.BeforePromptResponse, error\)](<#GRPCServer.BeforePrompt>)
  - [func \(m \*GRPCServer\) BeforeProviderRequest\(ctx context.Context, req \*proto.BeforeProviderRequestRequest\) \(\*proto.BeforeProviderRequestResponse, error\)](<#GRPCServer.BeforeProviderRequest>)
  - [func \(m \*GRPCServer\) BeforeToolCall\(ctx context.Context, req \*proto.BeforeToolCallRequest\) \(\*proto.BeforeToolCallResponse, error\)](<#GRPCServer.BeforeToolCall>)
  - [func \(m \*GRPCServer\) ExecuteTool\(ctx context.Context, req \*proto.ExecuteToolRequest\) \(\*proto.ExecuteToolResponse, error\)](<#GRPCServer.ExecuteTool>)
  - [func \(m \*GRPCServer\) ModifyContext\(ctx context.Context, req \*proto.ModifyContextRequest\) \(\*proto.ModifyContextResponse, error\)](<#GRPCServer.ModifyContext>)
  - [func \(m \*GRPCServer\) ModifyInput\(ctx context.Context, req \*proto.ModifyInputRequest\) \(\*proto.ModifyInputResponse, error\)](<#GRPCServer.ModifyInput>)
  - [func \(m \*GRPCServer\) ModifySystemPrompt\(ctx context.Context, req \*proto.ModifySystemPromptRequest\) \(\*proto.ModifySystemPromptResponse, error\)](<#GRPCServer.ModifySystemPrompt>)
  - [func \(m \*GRPCServer\) Name\(ctx context.Context, \_ \*proto.Empty\) \(\*proto.NameResponse, error\)](<#GRPCServer.Name>)
  - [func \(m \*GRPCServer\) SessionEnd\(ctx context.Context, req \*proto.SessionEndRequest\) \(\*proto.Empty, error\)](<#GRPCServer.SessionEnd>)
  - [func \(m \*GRPCServer\) SessionStart\(ctx context.Context, req \*proto.SessionStartRequest\) \(\*proto.Empty, error\)](<#GRPCServer.SessionStart>)
  - [func \(m \*GRPCServer\) Tools\(ctx context.Context, \_ \*proto.Empty\) \(\*proto.ToolsResponse, error\)](<#GRPCServer.Tools>)
  - [func \(m \*GRPCServer\) TurnEnd\(ctx context.Context, \_ \*proto.Empty\) \(\*proto.Empty, error\)](<#GRPCServer.TurnEnd>)
  - [func \(m \*GRPCServer\) TurnStart\(ctx context.Context, \_ \*proto.Empty\) \(\*proto.Empty, error\)](<#GRPCServer.TurnStart>)
- [type Loader](<#Loader>)
  - [func NewLoader\(dirs \[\]string, pythonPath string\) \*Loader](<#NewLoader>)
  - [func \(l \*Loader\) Cleanup\(\)](<#Loader.Cleanup>)
  - [func \(l \*Loader\) Load\(\) \(\[\]agent.Extension, \[\]error\)](<#Loader.Load>)
  - [func \(l \*Loader\) LoadOrLog\(\) \[\]agent.Extension](<#Loader.LoadOrLog>)
- [type NoopPlugin](<#NoopPlugin>)
  - [func \(n \*NoopPlugin\) AfterCompact\(\_ context.Context, \_ int\)](<#NoopPlugin.AfterCompact>)
  - [func \(n \*NoopPlugin\) AfterProviderResponse\(\_ context.Context, \_ string, \_ int\)](<#NoopPlugin.AfterProviderResponse>)
  - [func \(n \*NoopPlugin\) AfterToolCall\(\_ context.Context, \_ ToolCall, result ToolResult\) ToolResult](<#NoopPlugin.AfterToolCall>)
  - [func \(n \*NoopPlugin\) AgentEnd\(\_ context.Context\)](<#NoopPlugin.AgentEnd>)
  - [func \(n \*NoopPlugin\) AgentStart\(\_ context.Context\)](<#NoopPlugin.AgentStart>)
  - [func \(n \*NoopPlugin\) BeforeCompact\(\_ context.Context, \_ agent.CompactionPrep\) \*agent.CompactionResult](<#NoopPlugin.BeforeCompact>)
  - [func \(n \*NoopPlugin\) BeforePrompt\(\_ context.Context, state AgentState\) AgentState](<#NoopPlugin.BeforePrompt>)
  - [func \(n \*NoopPlugin\) BeforeProviderRequest\(\_ context.Context, requestJSON string\) string](<#NoopPlugin.BeforeProviderRequest>)
  - [func \(n \*NoopPlugin\) BeforeToolCall\(\_ context.Context, \_ ToolCall, \_ json.RawMessage\) \(ToolResult, bool\)](<#NoopPlugin.BeforeToolCall>)
  - [func \(n \*NoopPlugin\) ExecuteTool\(\_ context.Context, name string, \_ json.RawMessage\) ToolResult](<#NoopPlugin.ExecuteTool>)
  - [func \(n \*NoopPlugin\) ModifyContext\(\_ context.Context, messagesJSON string\) string](<#NoopPlugin.ModifyContext>)
  - [func \(n \*NoopPlugin\) ModifyInput\(\_ context.Context, \_ string\) agent.InputResult](<#NoopPlugin.ModifyInput>)
  - [func \(n \*NoopPlugin\) ModifySystemPrompt\(prompt string\) string](<#NoopPlugin.ModifySystemPrompt>)
  - [func \(n \*NoopPlugin\) Name\(\) string](<#NoopPlugin.Name>)
  - [func \(n \*NoopPlugin\) SessionEnd\(\_ context.Context, \_ string, \_ agent.SessionEndReason\)](<#NoopPlugin.SessionEnd>)
  - [func \(n \*NoopPlugin\) SessionStart\(\_ context.Context, \_ string, \_ agent.SessionStartReason\)](<#NoopPlugin.SessionStart>)
  - [func \(n \*NoopPlugin\) Tools\(\) \[\]ToolDefinition](<#NoopPlugin.Tools>)
  - [func \(n \*NoopPlugin\) TurnEnd\(\_ context.Context\)](<#NoopPlugin.TurnEnd>)
  - [func \(n \*NoopPlugin\) TurnStart\(\_ context.Context\)](<#NoopPlugin.TurnStart>)
- [type Plugin](<#Plugin>)
- [type RemoteTool](<#RemoteTool>)
  - [func \(t \*RemoteTool\) Description\(\) string](<#RemoteTool.Description>)
  - [func \(t \*RemoteTool\) Execute\(ctx context.Context, args json.RawMessage, update tools.ToolUpdate\) \(\*tools.ToolResult, error\)](<#RemoteTool.Execute>)
  - [func \(t \*RemoteTool\) IsReadOnly\(\) bool](<#RemoteTool.IsReadOnly>)
  - [func \(t \*RemoteTool\) Name\(\) string](<#RemoteTool.Name>)
  - [func \(t \*RemoteTool\) Schema\(\) json.RawMessage](<#RemoteTool.Schema>)
- [type SkillLoader](<#SkillLoader>)
  - [func NewSkillLoader\(dirs \[\]string\) \*SkillLoader](<#NewSkillLoader>)
  - [func \(l \*SkillLoader\) Load\(\) \(\[\]agent.Extension, error\)](<#SkillLoader.Load>)
- [type SkillTool](<#SkillTool>)
  - [func \(s \*SkillTool\) Description\(\) string](<#SkillTool.Description>)
  - [func \(s \*SkillTool\) Execute\(ctx context.Context, args json.RawMessage, update tools.ToolUpdate\) \(\*tools.ToolResult, error\)](<#SkillTool.Execute>)
  - [func \(s \*SkillTool\) IsReadOnly\(\) bool](<#SkillTool.IsReadOnly>)
  - [func \(s \*SkillTool\) Name\(\) string](<#SkillTool.Name>)
  - [func \(s \*SkillTool\) Schema\(\) json.RawMessage](<#SkillTool.Schema>)
- [type SkillsMetadataExtension](<#SkillsMetadataExtension>)
  - [func NewSkillsMetadataExtension\(allSkills \[\]\*skills.Skill\) \*SkillsMetadataExtension](<#NewSkillsMetadataExtension>)
  - [func \(s \*SkillsMetadataExtension\) ModifySystemPrompt\(prompt string\) string](<#SkillsMetadataExtension.ModifySystemPrompt>)
  - [func \(s \*SkillsMetadataExtension\) Tools\(\) \[\]tools.Tool](<#SkillsMetadataExtension.Tools>)
- [type ToolCall](<#ToolCall>)
- [type ToolDefinition](<#ToolDefinition>)
- [type ToolResult](<#ToolResult>)


<a name="LoadErrors"></a>
## func LoadErrors

```go
func LoadErrors(errs []error) error
```

LoadErrors joins all errors from a Load call into a single error, or nil if there were none.

<a name="Serve"></a>
## func Serve

```go
func Serve(impl Plugin)
```

Serve starts a gRPC server on the Unix socket path provided via SHARUR\_SOCKET\_PATH. This is the entry point for extension binaries.

<a name="AgentState"></a>
## type AgentState

AgentState is the mutable prompt state passed to BeforePrompt.

```go
type AgentState struct {
    SystemPrompt  string
    Model         string
    Provider      string
    ThinkingLevel string
}
```

<a name="GRPCClient"></a>
## type GRPCClient

GRPCClient is an implementation of agent.Extension that talks over RPC. It runs on the host side when a plugin binary is loaded.

If Name\(\) or Tools\(\) fail, the client is marked degraded and all subsequent tool executions return an error rather than silently doing nothing.

```go
type GRPCClient struct {
    // contains filtered or unexported fields
}
```

<a name="GRPCClient.AfterCompact"></a>
### func \(\*GRPCClient\) AfterCompact

```go
func (m *GRPCClient) AfterCompact(ctx context.Context, freedTokens int)
```



<a name="GRPCClient.AfterProviderResponse"></a>
### func \(\*GRPCClient\) AfterProviderResponse

```go
func (m *GRPCClient) AfterProviderResponse(ctx context.Context, content string, numToolCalls int)
```



<a name="GRPCClient.AfterToolCall"></a>
### func \(\*GRPCClient\) AfterToolCall

```go
func (m *GRPCClient) AfterToolCall(ctx context.Context, call *agent.ToolCall, result *tools.ToolResult) *tools.ToolResult
```



<a name="GRPCClient.AgentEnd"></a>
### func \(\*GRPCClient\) AgentEnd

```go
func (m *GRPCClient) AgentEnd(ctx context.Context)
```



<a name="GRPCClient.AgentStart"></a>
### func \(\*GRPCClient\) AgentStart

```go
func (m *GRPCClient) AgentStart(ctx context.Context)
```



<a name="GRPCClient.BeforeCompact"></a>
### func \(\*GRPCClient\) BeforeCompact

```go
func (m *GRPCClient) BeforeCompact(ctx context.Context, prep agent.CompactionPrep) *agent.CompactionResult
```



<a name="GRPCClient.BeforePrompt"></a>
### func \(\*GRPCClient\) BeforePrompt

```go
func (m *GRPCClient) BeforePrompt(ctx context.Context, state *agent.AgentState) *agent.AgentState
```



<a name="GRPCClient.BeforeProviderRequest"></a>
### func \(\*GRPCClient\) BeforeProviderRequest

```go
func (m *GRPCClient) BeforeProviderRequest(ctx context.Context, req *llm.CompletionRequest) *llm.CompletionRequest
```



<a name="GRPCClient.BeforeToolCall"></a>
### func \(\*GRPCClient\) BeforeToolCall

```go
func (m *GRPCClient) BeforeToolCall(ctx context.Context, call *agent.ToolCall, args json.RawMessage) (*tools.ToolResult, bool)
```



<a name="GRPCClient.Degraded"></a>
### func \(\*GRPCClient\) Degraded

```go
func (m *GRPCClient) Degraded() (bool, error)
```

Degraded reports whether the extension failed to initialise. Callers can surface this to the user rather than letting the failure be silent.

<a name="GRPCClient.ModifyContext"></a>
### func \(\*GRPCClient\) ModifyContext

```go
func (m *GRPCClient) ModifyContext(ctx context.Context, messages []types.Message) []types.Message
```



<a name="GRPCClient.ModifyInput"></a>
### func \(\*GRPCClient\) ModifyInput

```go
func (m *GRPCClient) ModifyInput(ctx context.Context, text string) agent.InputResult
```



<a name="GRPCClient.ModifySystemPrompt"></a>
### func \(\*GRPCClient\) ModifySystemPrompt

```go
func (m *GRPCClient) ModifySystemPrompt(prompt string) string
```



<a name="GRPCClient.Name"></a>
### func \(\*GRPCClient\) Name

```go
func (m *GRPCClient) Name() string
```



<a name="GRPCClient.SessionEnd"></a>
### func \(\*GRPCClient\) SessionEnd

```go
func (m *GRPCClient) SessionEnd(ctx context.Context, sessionID string, reason agent.SessionEndReason)
```



<a name="GRPCClient.SessionStart"></a>
### func \(\*GRPCClient\) SessionStart

```go
func (m *GRPCClient) SessionStart(ctx context.Context, sessionID string, reason agent.SessionStartReason)
```



<a name="GRPCClient.Tools"></a>
### func \(\*GRPCClient\) Tools

```go
func (m *GRPCClient) Tools() []tools.Tool
```

Tools queries the extension process for its tool definitions and returns RemoteTool wrappers that execute each tool over the ExecuteTool RPC.

<a name="GRPCClient.TurnEnd"></a>
### func \(\*GRPCClient\) TurnEnd

```go
func (m *GRPCClient) TurnEnd(ctx context.Context)
```



<a name="GRPCClient.TurnStart"></a>
### func \(\*GRPCClient\) TurnStart

```go
func (m *GRPCClient) TurnStart(ctx context.Context)
```



<a name="GRPCServer"></a>
## type GRPCServer

GRPCServer is the gRPC server that runs inside the plugin binary. It adapts the Plugin interface to the proto service.

```go
type GRPCServer struct {
    proto.UnimplementedExtensionServer
    Impl Plugin
}
```

<a name="GRPCServer.AfterCompact"></a>
### func \(\*GRPCServer\) AfterCompact

```go
func (m *GRPCServer) AfterCompact(ctx context.Context, req *proto.AfterCompactRequest) (*proto.Empty, error)
```



<a name="GRPCServer.AfterProviderResponse"></a>
### func \(\*GRPCServer\) AfterProviderResponse

```go
func (m *GRPCServer) AfterProviderResponse(ctx context.Context, req *proto.AfterProviderResponseRequest) (*proto.Empty, error)
```



<a name="GRPCServer.AfterToolCall"></a>
### func \(\*GRPCServer\) AfterToolCall

```go
func (m *GRPCServer) AfterToolCall(ctx context.Context, req *proto.AfterToolCallRequest) (*proto.AfterToolCallResponse, error)
```



<a name="GRPCServer.AgentEnd"></a>
### func \(\*GRPCServer\) AgentEnd

```go
func (m *GRPCServer) AgentEnd(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)
```



<a name="GRPCServer.AgentStart"></a>
### func \(\*GRPCServer\) AgentStart

```go
func (m *GRPCServer) AgentStart(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)
```



<a name="GRPCServer.BeforeCompact"></a>
### func \(\*GRPCServer\) BeforeCompact

```go
func (m *GRPCServer) BeforeCompact(ctx context.Context, req *proto.BeforeCompactRequest) (*proto.BeforeCompactResponse, error)
```



<a name="GRPCServer.BeforePrompt"></a>
### func \(\*GRPCServer\) BeforePrompt

```go
func (m *GRPCServer) BeforePrompt(ctx context.Context, req *proto.BeforePromptRequest) (*proto.BeforePromptResponse, error)
```



<a name="GRPCServer.BeforeProviderRequest"></a>
### func \(\*GRPCServer\) BeforeProviderRequest

```go
func (m *GRPCServer) BeforeProviderRequest(ctx context.Context, req *proto.BeforeProviderRequestRequest) (*proto.BeforeProviderRequestResponse, error)
```



<a name="GRPCServer.BeforeToolCall"></a>
### func \(\*GRPCServer\) BeforeToolCall

```go
func (m *GRPCServer) BeforeToolCall(ctx context.Context, req *proto.BeforeToolCallRequest) (*proto.BeforeToolCallResponse, error)
```



<a name="GRPCServer.ExecuteTool"></a>
### func \(\*GRPCServer\) ExecuteTool

```go
func (m *GRPCServer) ExecuteTool(ctx context.Context, req *proto.ExecuteToolRequest) (*proto.ExecuteToolResponse, error)
```



<a name="GRPCServer.ModifyContext"></a>
### func \(\*GRPCServer\) ModifyContext

```go
func (m *GRPCServer) ModifyContext(ctx context.Context, req *proto.ModifyContextRequest) (*proto.ModifyContextResponse, error)
```



<a name="GRPCServer.ModifyInput"></a>
### func \(\*GRPCServer\) ModifyInput

```go
func (m *GRPCServer) ModifyInput(ctx context.Context, req *proto.ModifyInputRequest) (*proto.ModifyInputResponse, error)
```



<a name="GRPCServer.ModifySystemPrompt"></a>
### func \(\*GRPCServer\) ModifySystemPrompt

```go
func (m *GRPCServer) ModifySystemPrompt(ctx context.Context, req *proto.ModifySystemPromptRequest) (*proto.ModifySystemPromptResponse, error)
```



<a name="GRPCServer.Name"></a>
### func \(\*GRPCServer\) Name

```go
func (m *GRPCServer) Name(ctx context.Context, _ *proto.Empty) (*proto.NameResponse, error)
```



<a name="GRPCServer.SessionEnd"></a>
### func \(\*GRPCServer\) SessionEnd

```go
func (m *GRPCServer) SessionEnd(ctx context.Context, req *proto.SessionEndRequest) (*proto.Empty, error)
```



<a name="GRPCServer.SessionStart"></a>
### func \(\*GRPCServer\) SessionStart

```go
func (m *GRPCServer) SessionStart(ctx context.Context, req *proto.SessionStartRequest) (*proto.Empty, error)
```



<a name="GRPCServer.Tools"></a>
### func \(\*GRPCServer\) Tools

```go
func (m *GRPCServer) Tools(ctx context.Context, _ *proto.Empty) (*proto.ToolsResponse, error)
```



<a name="GRPCServer.TurnEnd"></a>
### func \(\*GRPCServer\) TurnEnd

```go
func (m *GRPCServer) TurnEnd(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)
```



<a name="GRPCServer.TurnStart"></a>
### func \(\*GRPCServer\) TurnStart

```go
func (m *GRPCServer) TurnStart(ctx context.Context, _ *proto.Empty) (*proto.Empty, error)
```



<a name="Loader"></a>
## type Loader

Loader discovers and loads extensions \(executable binaries and scripts\).

```go
type Loader struct {
    Dirs       []string
    PythonPath string
    // contains filtered or unexported fields
}
```

<a name="NewLoader"></a>
### func NewLoader

```go
func NewLoader(dirs []string, pythonPath string) *Loader
```

NewLoader creates a new extension loader.

<a name="Loader.Cleanup"></a>
### func \(\*Loader\) Cleanup

```go
func (l *Loader) Cleanup()
```

Cleanup kills all running extension subprocesses and removes their socket files.

<a name="Loader.Load"></a>
### func \(\*Loader\) Load

```go
func (l *Loader) Load() ([]agent.Extension, []error)
```

Load discovers extensions, starts them as subprocesses, and returns gRPC client interfaces. Extensions that fail to load are logged and skipped; the returned error accumulates all failures so callers can distinguish "nothing loaded" from "everything succeeded".

<a name="Loader.LoadOrLog"></a>
### func \(\*Loader\) LoadOrLog

```go
func (l *Loader) LoadOrLog() []agent.Extension
```

LoadOrLog calls Load and logs any errors, returning only the successfully loaded extensions.

<a name="NoopPlugin"></a>
## type NoopPlugin

NoopPlugin is a base Plugin implementation with no\-op defaults. Embed it in your Plugin struct and override only what you need.

```go
type NoopPlugin struct {
    NameStr string
}
```

<a name="NoopPlugin.AfterCompact"></a>
### func \(\*NoopPlugin\) AfterCompact

```go
func (n *NoopPlugin) AfterCompact(_ context.Context, _ int)
```



<a name="NoopPlugin.AfterProviderResponse"></a>
### func \(\*NoopPlugin\) AfterProviderResponse

```go
func (n *NoopPlugin) AfterProviderResponse(_ context.Context, _ string, _ int)
```



<a name="NoopPlugin.AfterToolCall"></a>
### func \(\*NoopPlugin\) AfterToolCall

```go
func (n *NoopPlugin) AfterToolCall(_ context.Context, _ ToolCall, result ToolResult) ToolResult
```



<a name="NoopPlugin.AgentEnd"></a>
### func \(\*NoopPlugin\) AgentEnd

```go
func (n *NoopPlugin) AgentEnd(_ context.Context)
```



<a name="NoopPlugin.AgentStart"></a>
### func \(\*NoopPlugin\) AgentStart

```go
func (n *NoopPlugin) AgentStart(_ context.Context)
```



<a name="NoopPlugin.BeforeCompact"></a>
### func \(\*NoopPlugin\) BeforeCompact

```go
func (n *NoopPlugin) BeforeCompact(_ context.Context, _ agent.CompactionPrep) *agent.CompactionResult
```



<a name="NoopPlugin.BeforePrompt"></a>
### func \(\*NoopPlugin\) BeforePrompt

```go
func (n *NoopPlugin) BeforePrompt(_ context.Context, state AgentState) AgentState
```



<a name="NoopPlugin.BeforeProviderRequest"></a>
### func \(\*NoopPlugin\) BeforeProviderRequest

```go
func (n *NoopPlugin) BeforeProviderRequest(_ context.Context, requestJSON string) string
```



<a name="NoopPlugin.BeforeToolCall"></a>
### func \(\*NoopPlugin\) BeforeToolCall

```go
func (n *NoopPlugin) BeforeToolCall(_ context.Context, _ ToolCall, _ json.RawMessage) (ToolResult, bool)
```



<a name="NoopPlugin.ExecuteTool"></a>
### func \(\*NoopPlugin\) ExecuteTool

```go
func (n *NoopPlugin) ExecuteTool(_ context.Context, name string, _ json.RawMessage) ToolResult
```



<a name="NoopPlugin.ModifyContext"></a>
### func \(\*NoopPlugin\) ModifyContext

```go
func (n *NoopPlugin) ModifyContext(_ context.Context, messagesJSON string) string
```



<a name="NoopPlugin.ModifyInput"></a>
### func \(\*NoopPlugin\) ModifyInput

```go
func (n *NoopPlugin) ModifyInput(_ context.Context, _ string) agent.InputResult
```



<a name="NoopPlugin.ModifySystemPrompt"></a>
### func \(\*NoopPlugin\) ModifySystemPrompt

```go
func (n *NoopPlugin) ModifySystemPrompt(prompt string) string
```



<a name="NoopPlugin.Name"></a>
### func \(\*NoopPlugin\) Name

```go
func (n *NoopPlugin) Name() string
```



<a name="NoopPlugin.SessionEnd"></a>
### func \(\*NoopPlugin\) SessionEnd

```go
func (n *NoopPlugin) SessionEnd(_ context.Context, _ string, _ agent.SessionEndReason)
```



<a name="NoopPlugin.SessionStart"></a>
### func \(\*NoopPlugin\) SessionStart

```go
func (n *NoopPlugin) SessionStart(_ context.Context, _ string, _ agent.SessionStartReason)
```



<a name="NoopPlugin.Tools"></a>
### func \(\*NoopPlugin\) Tools

```go
func (n *NoopPlugin) Tools() []ToolDefinition
```



<a name="NoopPlugin.TurnEnd"></a>
### func \(\*NoopPlugin\) TurnEnd

```go
func (n *NoopPlugin) TurnEnd(_ context.Context)
```



<a name="NoopPlugin.TurnStart"></a>
### func \(\*NoopPlugin\) TurnStart

```go
func (n *NoopPlugin) TurnStart(_ context.Context)
```



<a name="Plugin"></a>
## type Plugin

Plugin is the interface that standalone gRPC extension binaries implement. Embed NoopPlugin and override only the methods you need.

```go
type Plugin interface {
    Name() string
    Tools() []ToolDefinition
    ExecuteTool(ctx context.Context, name string, args json.RawMessage) ToolResult
    BeforePrompt(ctx context.Context, state AgentState) AgentState
    BeforeToolCall(ctx context.Context, call ToolCall, args json.RawMessage) (ToolResult, bool)
    AfterToolCall(ctx context.Context, call ToolCall, result ToolResult) ToolResult
    ModifySystemPrompt(prompt string) string

    SessionStart(ctx context.Context, sessionID string, reason agent.SessionStartReason)
    SessionEnd(ctx context.Context, sessionID string, reason agent.SessionEndReason)
    AgentStart(ctx context.Context)
    AgentEnd(ctx context.Context)
    TurnStart(ctx context.Context)
    TurnEnd(ctx context.Context)
    ModifyInput(ctx context.Context, text string) agent.InputResult
    ModifyContext(ctx context.Context, messagesJSON string) string
    BeforeProviderRequest(ctx context.Context, requestJSON string) string
    AfterProviderResponse(ctx context.Context, content string, numToolCalls int)
    BeforeCompact(ctx context.Context, prep agent.CompactionPrep) *agent.CompactionResult
    AfterCompact(ctx context.Context, freedTokens int)
}
```

<a name="RemoteTool"></a>
## type RemoteTool

RemoteTool is a tools.Tool that executes over the extension's ExecuteTool gRPC.

```go
type RemoteTool struct {
    // contains filtered or unexported fields
}
```

<a name="RemoteTool.Description"></a>
### func \(\*RemoteTool\) Description

```go
func (t *RemoteTool) Description() string
```



<a name="RemoteTool.Execute"></a>
### func \(\*RemoteTool\) Execute

```go
func (t *RemoteTool) Execute(ctx context.Context, args json.RawMessage, update tools.ToolUpdate) (*tools.ToolResult, error)
```



<a name="RemoteTool.IsReadOnly"></a>
### func \(\*RemoteTool\) IsReadOnly

```go
func (t *RemoteTool) IsReadOnly() bool
```



<a name="RemoteTool.Name"></a>
### func \(\*RemoteTool\) Name

```go
func (t *RemoteTool) Name() string
```



<a name="RemoteTool.Schema"></a>
### func \(\*RemoteTool\) Schema

```go
func (t *RemoteTool) Schema() json.RawMessage
```



<a name="SkillLoader"></a>
## type SkillLoader

SkillLoader discovers and loads Markdown\-based skills.

```go
type SkillLoader struct {
    Dirs []string
}
```

<a name="NewSkillLoader"></a>
### func NewSkillLoader

```go
func NewSkillLoader(dirs []string) *SkillLoader
```

NewSkillLoader creates a new loader for Markdown skills.

<a name="SkillLoader.Load"></a>
### func \(\*SkillLoader\) Load

```go
func (l *SkillLoader) Load() ([]agent.Extension, error)
```

Load finds all skills and returns a SkillsMetadataExtension.

<a name="SkillTool"></a>
## type SkillTool

SkillTool implements tools.Tool for a single Markdown\-based skill.

```go
type SkillTool struct {
    // contains filtered or unexported fields
}
```

<a name="SkillTool.Description"></a>
### func \(\*SkillTool\) Description

```go
func (s *SkillTool) Description() string
```



<a name="SkillTool.Execute"></a>
### func \(\*SkillTool\) Execute

```go
func (s *SkillTool) Execute(ctx context.Context, args json.RawMessage, update tools.ToolUpdate) (*tools.ToolResult, error)
```



<a name="SkillTool.IsReadOnly"></a>
### func \(\*SkillTool\) IsReadOnly

```go
func (s *SkillTool) IsReadOnly() bool
```



<a name="SkillTool.Name"></a>
### func \(\*SkillTool\) Name

```go
func (s *SkillTool) Name() string
```



<a name="SkillTool.Schema"></a>
### func \(\*SkillTool\) Schema

```go
func (s *SkillTool) Schema() json.RawMessage
```



<a name="SkillsMetadataExtension"></a>
## type SkillsMetadataExtension

SkillsMetadataExtension lists all available skills in the system prompt.

```go
type SkillsMetadataExtension struct {
    agent.NoopExtension
    // contains filtered or unexported fields
}
```

<a name="NewSkillsMetadataExtension"></a>
### func NewSkillsMetadataExtension

```go
func NewSkillsMetadataExtension(allSkills []*skills.Skill) *SkillsMetadataExtension
```

NewSkillsMetadataExtension creates an extension that adds skill metadata to the prompt.

<a name="SkillsMetadataExtension.ModifySystemPrompt"></a>
### func \(\*SkillsMetadataExtension\) ModifySystemPrompt

```go
func (s *SkillsMetadataExtension) ModifySystemPrompt(prompt string) string
```

ModifySystemPrompt injects a brief list of skills into the system prompt. This tells the agent it can call these skills \(as tools\) when needed.

<a name="SkillsMetadataExtension.Tools"></a>
### func \(\*SkillsMetadataExtension\) Tools

```go
func (s *SkillsMetadataExtension) Tools() []tools.Tool
```

Tools returns a SkillTool for each loaded skill.

<a name="ToolCall"></a>
## type ToolCall

ToolCall describes a tool invocation passed to Plugin hook methods.

```go
type ToolCall struct {
    Name string
    Args json.RawMessage
}
```

<a name="ToolDefinition"></a>
## type ToolDefinition

ToolDefinition describes a tool contributed by a Plugin.

```go
type ToolDefinition struct {
    Name        string
    Description string
    Schema      json.RawMessage
    IsReadOnly  bool
}
```

<a name="ToolResult"></a>
## type ToolResult

ToolResult is the outcome of a tool call or an interception.

```go
type ToolResult struct {
    Content string
    IsError bool
}
```

Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
