MCPcopy Create free account
hub / github.com/GCWing/BitFun / compact_json_for_session_view

Function compact_json_for_session_view

src/apps/desktop/src/api/agentic_api.rs:455–474  ·  view source on GitHub ↗
(value: &mut serde_json::Value, remaining_budget: &mut usize)

Source from the content-addressed store, hash-verified

453}
454
455fn compact_json_for_session_view(value: &mut serde_json::Value, remaining_budget: &mut usize) {
456 match value {
457 serde_json::Value::String(text) => {
458 if let Some(preview) = truncate_string_for_session_view(text, remaining_budget) {
459 *text = preview;
460 }
461 }
462 serde_json::Value::Array(items) => {
463 for item in items {
464 compact_json_for_session_view(item, remaining_budget);
465 }
466 }
467 serde_json::Value::Object(map) => {
468 for item in map.values_mut() {
469 compact_json_for_session_view(item, remaining_budget);
470 }
471 }
472 _ => {}
473 }
474}
475
476fn compact_tool_results_for_session_view(turns: &mut [DialogTurnData]) {
477 let mut remaining_budget = SESSION_VIEW_TOOL_RESULT_TOTAL_CHAR_BUDGET;

Callers 1

Calls 1

Tested by

no test coverage detected