Add paginated history reads to the cloud client (#59075)

## Why

`Attach` delivers live events only. Clients also need access to stored turn metadata and item content.

## What changed

- Add `Client::list_turns` and `Client::list_items` using native gRPC history endpoints, with optional turn filtering for items.
- Expose page limits, sort order, access mode, and forward/backward cursors. Each call returns one page in server order without automatic pagination or retries.
- Preserve raw response and row payloads alongside typed summaries and item timestamps. Retain unknown item variants and command sources without typed summaries.
- Document cursor reuse and history/live overlap: history pages do not provide an atomic boundary with `Attach`, and coordinated reconciliation still requires caller-managed state.

## Testing

Add wire-fixture tests for request encoding, explicit pagination, raw payload preservation, unknown data, malformed rows, empty pages, RPC errors without retries, and diagnostic redaction.

GitOrigin-RevId: f507530b8e431236bc7e19d867517af56f74644f
This commit is contained in:
Benjamin Carlsson
2026-11-03 06:34:51 +00:00
committed by copyberry
parent f9e7b19df8
commit bc4116e4cd
9 changed files with 623 additions and 32 deletions
+2 -2
View File
@@ -215,17 +215,17 @@ pub(crate) fn summary(item: wire::Item) -> Result<Option<ItemSummary>, DecodeFai
.into_iter()
.map(command_action)
.collect::<Result<_, _>>()?,
status: required(value.status)?.into(),
source: match value.source {
None | Some(1) => CommandExecutionSource::Agent,
Some(2) => CommandExecutionSource::UserShell,
Some(3) => CommandExecutionSource::UnifiedExecStartup,
Some(4) => CommandExecutionSource::UnifiedExecInteraction,
Some(_) => return Err(DecodeFailure::UnsupportedCommandSource),
Some(_) => return Ok(None),
},
aggregated_output: value.output,
duration_ms: value.duration_ms,
exit_code: value.exit_code,
status: required(value.status)?.into(),
}),
Some(wire::Value::FileChange(value)) => ItemSummary::FileChange {
id: required(value.id)?,