refactor api server around rpc services

This commit is contained in:
lpf
2026-03-15 01:00:41 +08:00
parent 341e578c9f
commit 231529e907
32 changed files with 5956 additions and 3614 deletions

View File

@@ -69,16 +69,20 @@ func (t *SubagentConfigTool) SetConfigPath(path string) {
func (t *SubagentConfigTool) Execute(ctx context.Context, args map[string]interface{}) (string, error) {
_ = ctx
switch stringArgFromMap(args, "action") {
case "upsert":
result, err := UpsertConfigSubagent(t.getConfigPath(), cloneSubagentConfigArgs(args))
if err != nil {
return "", err
}
return marshalSubagentConfigPayload(result)
default:
return "", fmt.Errorf("unsupported action")
action := stringArgFromMap(args, "action")
handlers := map[string]func() (string, error){
"upsert": func() (string, error) {
result, err := UpsertConfigSubagent(t.getConfigPath(), cloneSubagentConfigArgs(args))
if err != nil {
return "", err
}
return marshalSubagentConfigPayload(result)
},
}
if handler := handlers[action]; handler != nil {
return handler()
}
return "", fmt.Errorf("%w: %s", ErrUnsupportedAction, action)
}
func (t *SubagentConfigTool) getConfigPath() string {