The console passes a seat verb's arguments on when it holds no definition of the seat (issue 1966)
mesh/delivery merged: source.main moved to novox/mesh-tools@f4b4fb908f37
mesh/delivery-group group fix/1966-seat-reads-bootstrap merged: every member is merged
mesh/check failed (2): mesh-delivery-checker: no published of the tagged version of go-sdk of mesh-delivery…; and 1 more | 7572627affde on f4b4fb908f37
mesh/delivery merged: source.main moved to novox/mesh-tools@f4b4fb908f37
mesh/delivery-group group fix/1966-seat-reads-bootstrap merged: every member is merged
mesh/check failed (2): mesh-delivery-checker: no published of the tagged version of go-sdk of mesh-delivery…; and 1 more | 7572627affde on f4b4fb908f37
A seat verb whose holder announced an empty schema was judged as taking nothing: shanks' tool runner refused "mesh-module-assigner.propose takes no argument changes, why — it takes nothing". The console now judges such a call by the verb's input in the seat's definition this runner holds; where it holds none (it waits for the seat list, holding only the bootstrapped definitions), the arguments go to the holder, which judges its own input, and mesh_describe says the definition is not held instead of showing an empty schema. Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5
This commit is contained in:
@@ -866,6 +866,11 @@ func argumentsAsSent(t target, given map[string]any) (map[string]any, error) {
|
||||
if !t.Seat {
|
||||
return args, nil
|
||||
}
|
||||
t, held := seatDefinitionHeld(t)
|
||||
if !held {
|
||||
// Nothing here says what the verb takes: its holder judges the arguments (issue 1966).
|
||||
return args, nil
|
||||
}
|
||||
declared := map[string]bool{}
|
||||
var names []string
|
||||
if p, ok := schemaAsPassed(t)["properties"].(map[string]any); ok {
|
||||
@@ -893,6 +898,36 @@ func argumentsAsSent(t target, given map[string]any) (map[string]any, error) {
|
||||
return args, nil
|
||||
}
|
||||
|
||||
// seatDefinitionHeld is a seat verb's target with the input the console judges a call by, and whether anything here
|
||||
// says what the verb takes (issue 1966): the schema its holder announced when it declares an argument, else the verb's
|
||||
// input in the seat's definition this runner holds. Neither holds while the runner waits for the seat list holding
|
||||
// only the bootstrapped definitions and the holder announced an empty schema: then a call's arguments are passed on to
|
||||
// the holder, which judges its own input, and mesh_describe says the definition is not held.
|
||||
func seatDefinitionHeld(t target) (target, bool) {
|
||||
if p, ok := asSchema(t.Tool.Input)["properties"].(map[string]any); ok && len(p) > 0 {
|
||||
return t, true
|
||||
}
|
||||
seat, ok := catalogue.SeatNamed(t.Tool.Module)
|
||||
if !ok {
|
||||
return t, false
|
||||
}
|
||||
for _, v := range seat.Serves {
|
||||
if v.Name == t.Tool.Name && v.Input != nil {
|
||||
if raw, err := json.Marshal(v.Input); err == nil {
|
||||
t.Tool.Input = raw
|
||||
}
|
||||
}
|
||||
}
|
||||
return t, true
|
||||
}
|
||||
|
||||
// notHeld is what mesh_describe says of a seat verb whose definition this runner does not hold.
|
||||
func notHeld(seat string) string {
|
||||
return "the seat list this tool runner holds has no definition of " + seat + " yet (it holds the bootstrapped ones " +
|
||||
"until it reads the list): what the verb takes is not known here, so the arguments of a call are passed to " +
|
||||
"its holder, which judges them"
|
||||
}
|
||||
|
||||
// schemaWithoutNode is a tool's schema with `node` taken out, for an address that names the machine.
|
||||
func schemaWithoutNode(raw json.RawMessage) map[string]any {
|
||||
schema := asSchema(raw)
|
||||
@@ -1092,7 +1127,14 @@ func (s *Surface) discover(ctx context.Context, name string, args map[string]any
|
||||
if description == "" {
|
||||
description = t.Name
|
||||
}
|
||||
held := true
|
||||
if t.Seat {
|
||||
t, held = seatDefinitionHeld(t)
|
||||
}
|
||||
described := map[string]any{"address": t.Address, "description": description, "arguments": schemaAsPassed(t)}
|
||||
if !held {
|
||||
described["arguments"] = notHeld(t.Tool.Module)
|
||||
}
|
||||
key := t.Tool.Module + "." + t.Tool.Name
|
||||
if t.Seat {
|
||||
key = "seat:" + key
|
||||
|
||||
Reference in New Issue
Block a user