Archived
Say what each verb replaces, so the agent is pointed at it instead of a shell command (hq ADR 0242)
A seat's verb names the shell commands it is the mesh's way to do, and a module says it for its own tools in its manifest; the tools verb and module list --json carry both, for the console's search, the agent's instructions and the guard on its shell.
This commit is contained in:
@@ -182,6 +182,9 @@ func moduleCommand(ctx context.Context, args []string) error {
|
||||
Requires []string `json:"requires,omitempty"`
|
||||
Claims []string `json:"claims,omitempty"`
|
||||
Capabilities []string `json:"capabilities,omitempty"`
|
||||
// Replaces is what each of its own tools replaces (novox/hq ADR 0242), for the console's
|
||||
// search and the agent's instructions.
|
||||
Replaces map[string][]string `json:"replaces,omitempty"`
|
||||
}
|
||||
out := make([]listed, 0, len(entries))
|
||||
for _, e := range entries {
|
||||
@@ -189,7 +192,7 @@ func moduleCommand(ctx context.Context, args []string) error {
|
||||
l := listed{Module: m.Module, Version: m.Version, Built: e.Source.BuiltFrom, Head: e.Source.Head,
|
||||
Current: e.Provided || e.Source.Repository == "" || e.Source.Current(), Provided: e.Provided,
|
||||
On: append([]string{}, e.On...), Provides: m.Offers(), Requires: m.Requires,
|
||||
Capabilities: m.Capabilities, Tools: declaresTools(m)}
|
||||
Capabilities: m.Capabilities, Tools: declaresTools(m), Replaces: m.Replaces}
|
||||
for _, c := range m.Claims {
|
||||
l.Claims = append(l.Claims, c.At()+"/"+c.Name)
|
||||
}
|
||||
|
||||
@@ -970,9 +970,15 @@ func seatTools() map[string]any {
|
||||
}
|
||||
var tools []map[string]any
|
||||
for _, v := range s.Serves {
|
||||
tools = append(tools, map[string]any{
|
||||
tool := map[string]any{
|
||||
"name": v.Name, "description": v.Description, "input": v.Input, "output": v.Output,
|
||||
})
|
||||
}
|
||||
// What the verb is the mesh's way to do (novox/hq ADR 0242): read by the console's search and
|
||||
// the agent's instructions.
|
||||
if len(v.Replaces) > 0 {
|
||||
tool["replaces"] = v.Replaces
|
||||
}
|
||||
tools = append(tools, tool)
|
||||
}
|
||||
seats = append(seats, map[string]any{"seat": s.Name, "scope": s.Scope, "tools": tools})
|
||||
}
|
||||
|
||||
@@ -144,6 +144,23 @@ func TestToolsAnswersTheSeatsRecords(t *testing.T) {
|
||||
if !found {
|
||||
t.Fatal("the mesh-controller seat is not in the listing")
|
||||
}
|
||||
// And what a verb replaces travels with it (novox/hq ADR 0242): the console and the agent's
|
||||
// instructions read it from here.
|
||||
var journal []string
|
||||
for _, s := range seats {
|
||||
if s["seat"] != catalogue.ServiceManagerSeat {
|
||||
continue
|
||||
}
|
||||
tools, _ := s["tools"].([]map[string]any)
|
||||
for _, tool := range tools {
|
||||
if tool["name"] == "journal" {
|
||||
journal, _ = tool["replaces"].([]string)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(journal) == 0 || journal[0] != "journalctl" {
|
||||
t.Fatalf("the service manager's journal does not say it replaces journalctl: %v", journal)
|
||||
}
|
||||
}
|
||||
|
||||
// A JSON verb's answer is parsed from what the command wrote to standard output alone; a warning it
|
||||
|
||||
Reference in New Issue
Block a user