(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e agent.Executor, handler agent.OutputHandler)
| 187 | |
| 188 | func (m *mockPlanner) Close() error { return nil } |
| 189 | func (m *mockPlanner) Connect(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e agent.Executor, handler agent.OutputHandler) error { |
| 190 | var lastText string |
| 191 | for _, m := range start.Messages { |
| 192 | if textMsg := m.GetContent().GetText(); textMsg != nil { |
| 193 | lastText = textMsg.Text |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | // Step 1: User -> Local |
| 198 | if strings.HasPrefix(lastText, "Send the word") { |
| 199 | inputs := append(start.Messages, &proto.Message{ |
| 200 | Role: "assistant", |
| 201 | Content: &proto.Content{ |
| 202 | Type: &proto.Content_Text{ |
| 203 | Text: &proto.TextContent{Text: "oRanGe"}, |
| 204 | }, |
| 205 | }, |
| 206 | }) |
| 207 | _, err := e.Exec(ctx, conversationID, "local-echo", &proto.AgentStart{ |
| 208 | AgentId: "local-echo-agent", |
| 209 | Messages: inputs, |
| 210 | }, handler) |
| 211 | return err |
| 212 | } |
| 213 | |
| 214 | // Step 2: Local -> Remote |
| 215 | if lastText == "orange" { |
| 216 | inputs := append(start.Messages, &proto.Message{ |
| 217 | Role: "assistant", |
| 218 | Content: &proto.Content{ |
| 219 | Type: &proto.Content_Text{ |
| 220 | Text: &proto.TextContent{Text: lastText}, |
| 221 | }, |
| 222 | }, |
| 223 | }) |
| 224 | _, err := e.Exec(ctx, conversationID, "remote-text", &proto.AgentStart{ |
| 225 | AgentId: "remote-text-processor", |
| 226 | Messages: inputs, |
| 227 | }, handler) |
| 228 | return err |
| 229 | } |
| 230 | |
| 231 | // Step 3: Remote -> Uppercase |
| 232 | if strings.HasPrefix(lastText, "Remote Prefix:") { |
| 233 | inputs := append(start.Messages, &proto.Message{ |
| 234 | Role: "assistant", |
| 235 | Content: &proto.Content{ |
| 236 | Type: &proto.Content_Text{ |
| 237 | Text: &proto.TextContent{Text: lastText}, |
| 238 | }, |
| 239 | }, |
| 240 | }) |
| 241 | _, err := e.Exec(ctx, conversationID, "uppercase-task", &proto.AgentStart{ |
| 242 | AgentId: "uppercase", |
| 243 | Messages: inputs, |
| 244 | }, handler) |
| 245 | return err |
| 246 | } |
nothing calls this directly
no test coverage detected