Repo iniciado

This commit is contained in:
2026-03-03 23:19:23 +00:00
commit c126187c5a
32 changed files with 2719 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
// Package tools defines pure, declarative tool specifications.
// No execution happens here — only data describing what tools exist and their contracts.
package tools
// ToolKind identifies the category of a tool.
type ToolKind string
const (
ToolKindSSH ToolKind = "ssh"
ToolKindHTTP ToolKind = "http"
ToolKindScript ToolKind = "script"
ToolKindFileOps ToolKind = "file_ops"
ToolKindMCP ToolKind = "mcp"
)
// ToolSpec is a pure description of a tool — what it does and what it accepts.
// The actual execution lives in shell/effects/.
type ToolSpec struct {
Name string
Kind ToolKind
Description string
Parameters []ParameterSpec
}
type ParameterSpec struct {
Name string
Type string
Description string
Required bool
}
// Registry is a map of available tools, keyed by name.
type Registry map[string]ToolSpec
// Add returns a new Registry with the given spec added.
func (r Registry) Add(spec ToolSpec) Registry {
out := make(Registry, len(r)+1)
for k, v := range r {
out[k] = v
}
out[spec.Name] = spec
return out
}
// Get looks up a tool spec by name.
func (r Registry) Get(name string) (ToolSpec, bool) {
spec, ok := r[name]
return spec, ok
}
// Names returns all registered tool names.
func (r Registry) Names() []string {
names := make([]string, 0, len(r))
for k := range r {
names = append(names, k)
}
return names
}
+37
View File
@@ -0,0 +1,37 @@
package tools
// SSHCommandSpec describes an SSH command to execute. Pure data — no execution.
type SSHCommandSpec struct {
Target string // references a named target in ssh config
Command string
Timeout string
}
// HTTPCallSpec describes an HTTP call to make. Pure data.
type HTTPCallSpec struct {
Method string
URL string
Headers map[string]string
Body string
Timeout string
}
// ScriptSpec describes a script to run. Pure data.
type ScriptSpec struct {
Name string
Args []string
Timeout string
}
// FileOpsSpec describes a file operation. Pure data.
type FileOpsSpec struct {
Op string // read | write | list | delete
Path string
}
// MCPCallSpec describes a call to an MCP server. Pure data.
type MCPCallSpec struct {
ServerName string
ToolName string
Arguments map[string]any
}