(t *testing.T)
| 262 | } |
| 263 | |
| 264 | func TestResume(t *testing.T) { |
| 265 | ctx := context.Background() |
| 266 | eventLog := memoryEventLog() |
| 267 | |
| 268 | registry := map[string]agent.Agent{ |
| 269 | "root": AgentFunc(func(inputs []*proto.Message, tm agent.Executor, o agent.OutputHandler) { |
| 270 | if _, err := tm.Exec(ctx, "test-conv", "child-task", &proto.AgentStart{ |
| 271 | AgentId: "child", |
| 272 | Messages: inputs, |
| 273 | }, nil); err != nil { |
| 274 | t.Fatal(err) |
| 275 | } |
| 276 | if o != nil { |
| 277 | o(&proto.AgentOutputs{ |
| 278 | Messages: []*proto.Message{text("assistant", "root done")}, |
| 279 | }) |
| 280 | } |
| 281 | }), |
| 282 | "child": AgentFunc(func(inputs []*proto.Message, tm agent.Executor, o agent.OutputHandler) { |
| 283 | time.Sleep(100 * time.Millisecond) |
| 284 | if o != nil { |
| 285 | o(&proto.AgentOutputs{ |
| 286 | Messages: []*proto.Message{text("assistant", "child done")}, |
| 287 | }) |
| 288 | } |
| 289 | }), |
| 290 | } |
| 291 | |
| 292 | tm := DefaultExecutor(eventLog, registry) |
| 293 | if _, err := tm.Exec(ctx, "test-conv", "root-task", &proto.AgentStart{ |
| 294 | AgentId: "root", |
| 295 | Messages: []*proto.Message{text("user", "hello!")}, |
| 296 | }, nil); err != nil { |
| 297 | t.Fatal(err) |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | func TestResumeAgentIDMismatch(t *testing.T) { |
| 302 | ctx := context.Background() |
nothing calls this directly
no test coverage detected