| 2376 | agent_tool_calls_push(&p->calls, &p->current); |
| 2377 | p->parse_pos += close_len; |
| 2378 | p->state = AGENT_DSML_DONE; |
| 2379 | return; |
| 2380 | } |
| 2381 | if (agent_dsml_close_tag_at(p->raw + p->parse_pos, invoke, &close_len)) { |
| 2382 | agent_tool_calls_push(&p->calls, &p->current); |
| 2383 | p->parse_pos += close_len; |
| 2384 | continue; |
| 2385 | } |
| 2386 | |
| 2387 | char *tag_end = strchr(p->raw + p->parse_pos, '>'); |
| 2388 | if (!tag_end) return; |
| 2389 | size_t tag_len = (size_t)(tag_end - (p->raw + p->parse_pos)) + 1; |
| 2390 | char *tag = xstrndup(p->raw + p->parse_pos, tag_len); |
| 2391 | |
| 2392 | if (agent_dsml_open_tag_is(tag, invoke)) { |
| 2393 | agent_tool_call_free(&p->current); |
| 2394 | p->current.name = agent_parse_attr(tag, "name"); |
| 2395 | if (!p->current.name) { |
no test coverage detected