| 8468 | return 0; |
| 8469 | } |
| 8470 | |
| 8471 | /* ============================================================================ |
| 8472 | * Model Worker Thread |
| 8473 | * ============================================================================ |
| 8474 | */ |
| 8475 | |
| 8476 | /* DSML structure is a machine-readable grammar, so once the model has clearly |
| 8477 | * started a tool stanza we decode grammar bytes greedily. Parameter values are |
| 8478 | * different: they can be shell commands, code, file contents, or edit bodies, |
| 8479 | * and should keep the configured sampling behavior. The only exception is a |
| 8480 | * parameter closing tag once it is clearly DSML syntax, not ordinary text such |
| 8481 | * as HTML/XML/code containing "</". |
| 8482 | * |
| 8483 | * This helper is intentionally derived only from the current streaming parser |
| 8484 | * state. The state object is local to one assistant round, so malformed output, |
| 8485 | * EOS, Ctrl+C, or the next turn cannot accidentally leave sampling greedy. */ |
| 8486 | static bool agent_stream_wants_greedy_sampling(const agent_stream_renderer *sr) { |
| 8487 | if (!sr || !sr->parser) return false; |
| 8488 | if (sr->parser->state == AGENT_DSML_ERROR || |
no test coverage detected