| 8704 | while (m->tail) tool_memory_remove_entry_locked(m, m->tail); |
| 8705 | if (m->by_id) raxFree(m->by_id); |
| 8706 | if (m->by_block) raxFree(m->by_block); |
| 8707 | memset(m, 0, sizeof(*m)); |
| 8708 | } |
| 8709 | |
| 8710 | /* Single live protocol-tool state. |
| 8711 | * |
| 8712 | * This is not an implementation of durable remote conversation storage. It is |
| 8713 | * only an in-memory binding from protocol tool-call IDs to the current sampled |
| 8714 | * KV frontier. If it does not match, DS4 falls back to the same prefix and |
| 8715 | * disk-cache machinery used by chat/completions, or returns a clear error for |
| 8716 | * tool-result-only requests that have no replayable prefix. */ |
| 8717 | static void live_tool_state_clear_locked(live_tool_state *st) { |
| 8718 | if (!st) return; |
| 8719 | stop_list_clear(&st->call_ids); |
| 8720 | free(st->visible_text); |
| 8721 | st->visible_text = NULL; |
| 8722 | st->visible_len = 0; |
no test coverage detected