| 1 | package main |
| 2 | |
| 3 | import "encoding/json" |
| 4 | |
| 5 | func (a *App) EditRemoteTabGoal(tabID, objective string, maxGoalRounds *uint64) error { |
| 6 | if err := a.requireRemoteExecutionProtocol(tabID); err != nil { |
| 7 | return err |
| 8 | } |
| 9 | if err := a.requireRemoteGoalLifecycle(tabID); err != nil { |
| 10 | return err |
| 11 | } |
| 12 | client, base, expectedPath, err := a.remoteTabCommandTarget(tabID) |
| 13 | if err != nil { |
| 14 | return err |
| 15 | } |
| 16 | ctx, cancel := commandContext(a) |
| 17 | defer cancel() |
| 18 | body, _ := json.Marshal(map[string]any{"objective": objective, "maxGoalRounds": maxGoalRounds}) |
| 19 | return servePostForSession(ctx, client, serveURL(base, "/goal/edit"), body, expectedPath) |
| 20 | } |
| 21 |