Add experimental thread memory summary reads (#56465)

## What changed

Add `thread/memory/read` to return `{summary}` for a thread that has been started or resumed. Read `memory_summary.md` from the thread's resolved memory version, honoring thread-specific configuration overrides without falling back to another version.

Return `null` when memory use is disabled or the selected summary is missing, unreadable, or blank.

## Testing

Extend app-server integration coverage to check explicit and automatic memory version selection, disabled memory use, and missing summaries without fallback.

GitOrigin-RevId: b218f31e379c69ccbacb444bb9d6ee920cd4882b
This commit is contained in:
jif
2026-10-23 12:35:58 +00:00
committed by copyberry
parent 90894a780d
commit b559e6a398
9 changed files with 126 additions and 13 deletions
@@ -720,6 +720,12 @@ client_request_definitions! {
serialization: thread_id(params.thread_id),
response: v2::ThreadMemoryModeSetResponse,
},
#[experimental("thread/memory/read")]
ThreadMemoryRead => "thread/memory/read" {
params: v2::ThreadMemoryReadParams,
serialization: thread_id(params.thread_id),
response: v2::ThreadMemoryReadResponse,
},
#[experimental("memory/status")]
MemoryStatus => "memory/status" {
params: v2::MemoryStatusParams,
@@ -1,10 +1,27 @@
//! Readiness for selecting v2 memory context after background consolidation.
//! Memory readiness and summary reads using a loaded thread's selected pipeline.
use crate::JsonSchema;
use crate::TS;
use serde::Deserialize;
use serde::Serialize;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadMemoryReadParams {
/// The thread must already be started or resumed.
pub thread_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadMemoryReadResponse {
/// Summary from the thread's selected memory version. Null when memory use is
/// disabled or the selected summary is missing, unreadable, or blank.
pub summary: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]