MCPcopy Create free account
hub / github.com/antirez/ds4 / agent_split_lines

Function agent_split_lines

ds4_agent.c:5499–5517  ·  view source on GitHub ↗

Split a text buffer into line spans. content_end excludes CR/LF so callers * can print or compare line content without newline spelling differences. */

Source from the content-addressed store, hash-verified

5497 * the live KV, so busy /save requests are deferred until a stable append-only
5498 * point and then executed by the worker thread. */
5499static bool agent_worker_save_session_now(agent_worker *w, char sha_out[41],
5500 int *tokens_out,
5501 char *err, size_t err_len) {
5502 if (!agent_worker_has_user_session(w)) {
5503 snprintf(err, err_len, "nothing to save");
5504 return false;
5505 }
5506 if (w->image_count) {
5507 snprintf(err, err_len,
5508 "sessions containing images cannot be saved yet");
5509 return false;
5510 }
5511
5512 const bool text_only = w->transcript.len >= agent_worker_effective_ctx_size(w);
5513 if (!text_only &&
5514 agent_worker_sync_tokens(w, &w->transcript, false, err, err_len) != 0)
5515 return false;
5516 if (!agent_mkdir_p(w->cache_dir)) {
5517 snprintf(err, err_len, "failed to create %s", w->cache_dir);
5518 return false;
5519 }
5520

Callers 4

agent_read_rangeFunction · 0.85
agent_search_fileFunction · 0.85

Calls 1

agent_line_spans_pushFunction · 0.85

Tested by

no test coverage detected