feat(0144a): tool registry framework para device-mesh
Anade pkg/tools/devicemesh con Client HTTP al device_agent + ToolRegistry con 16 tools standard (exec, fs.*, git.*, docker.*, proc.*, pkg.*, shell.eval). RegisterBuiltins filtra por mode user/sudo via RequiresApproval flag. Hook al pkg/decision con ActionKindDeviceMesh + DeviceMeshAction. Runner soporta dispatch via NewRunnerWithDeviceMesh (back-compat NewRunner). Tests: 25 nuevos en devicemesh + 4 en runner. Build clean.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// devicemesh.go: pure data type for "call a device mesh tool" actions.
|
||||
//
|
||||
// The runtime decides which agent has which tool registry (user vs sudo).
|
||||
// The decision layer only describes *what* to call; the runner in
|
||||
// shell/effects/ resolves the registry and dispatches.
|
||||
package decision
|
||||
|
||||
// DeviceMeshAction describes an invocation of a registered devicemesh tool.
|
||||
// It is a pure value — no client, no registry, just the name + input.
|
||||
//
|
||||
// Fields:
|
||||
//
|
||||
// - Tool: the registered tool name in the agent's devicemesh.ToolRegistry
|
||||
// (ex "exec", "fs.read", "fs.write").
|
||||
// - Input: LLM-supplied arguments. Will be validated by the registry
|
||||
// before reaching the network.
|
||||
// - ResultKey: optional. The runtime stores the tool result under this key
|
||||
// in the conversation state so the LLM can refer to it later. Empty
|
||||
// string means "do not store, just send back as a tool message".
|
||||
type DeviceMeshAction struct {
|
||||
Tool string
|
||||
Input map[string]any
|
||||
ResultKey string
|
||||
}
|
||||
@@ -31,6 +31,7 @@ const (
|
||||
ActionKindMCP ActionKind = "mcp"
|
||||
ActionKindLLM ActionKind = "llm"
|
||||
ActionKindDelegate ActionKind = "delegate"
|
||||
ActionKindDeviceMesh ActionKind = "device_mesh"
|
||||
)
|
||||
|
||||
// Action is a pure description of what the shell should do.
|
||||
@@ -45,6 +46,7 @@ type Action struct {
|
||||
MCP *tools.MCPCallSpec
|
||||
LLM *LLMAction
|
||||
Delegate *DelegateAction
|
||||
DeviceMesh *DeviceMeshAction
|
||||
}
|
||||
|
||||
type ReplyAction struct {
|
||||
|
||||
Reference in New Issue
Block a user