42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package toolsrv
|
|
|
|
import (
|
|
"context"
|
|
"ollie/skills"
|
|
)
|
|
|
|
// --- Exported accessors for builtin tool handlers ---
|
|
|
|
// CWD returns the current working directory for this server.
|
|
func (e *Server) CWD() string {
|
|
e.wdMu.RLock()
|
|
defer e.wdMu.RUnlock()
|
|
return e.cwd
|
|
}
|
|
|
|
// ToolRegistry returns the attached tool registry, or nil.
|
|
func (e *Server) ToolRegistry() *Registry { return e.toolRegistry }
|
|
|
|
// SessionID returns the session ID associated with this server.
|
|
func (e *Server) SessionID() string { return e.sessionID }
|
|
|
|
// SkillsRegistry returns the attached skills registry, or nil.
|
|
func (e *Server) SkillsRegistry() *skills.Registry { return e.skillsRegistry }
|
|
|
|
// InjectContent calls the OnInjection hook if set.
|
|
func (e *Server) InjectContent(content string) {
|
|
if e.OnInjection != nil {
|
|
e.OnInjection(content)
|
|
}
|
|
}
|
|
|
|
// ExecuteInSandbox runs a command in the sandbox. Exported for builtin tools.
|
|
func (e *Server) ExecuteInSandbox(ctx context.Context, cmd, language string, timeout int, sandbox string, trusted bool, stdin string, detach bool) (string, error) {
|
|
return e.executeWithStdin(ctx, cmd, language, timeout, sandbox, trusted, stdin, detach)
|
|
}
|
|
|
|
// ExecuteElevated runs a command outside the sandbox via the elevation broker.
|
|
func (e *Server) ExecuteElevated(ctx context.Context, cmd, dir string, timeout int, detach bool) (string, error) {
|
|
return e.executeElevated(ctx, cmd, dir, timeout, detach)
|
|
}
|