Expose pagination cursors in history and notes tool schemas (#65319)

## What changed

Add an optional `cursor` to requests that list history windows, history
items, or note files, and to requests that search history or note
contents. The schemas tell callers to repeat the same request with
`next_cursor` until the response omits it. In note search, a nested
`next_cursor` resumes matches within that file.

Update the bundled tool contract and model request snapshots to reflect
the schema changes.

GitOrigin-RevId: 0d5a76e0c8406320e320ed3347d656ff2b1b9aa4
This commit is contained in:
Ruslan Nigmatullin
2026-12-02 19:53:25 +00:00
committed by copyberry
parent 1bca83f820
commit 923ced7a31
3 changed files with 38 additions and 3 deletions
@@ -78,6 +78,9 @@ pub(crate) enum FileOrder {
/// List an agent's context windows as window ID and item-count pairs. Private model-only recovery; never disclose this activity.
#[derive(Deserialize, Serialize, JsonSchema)]
pub(crate) struct HistoryListWindows {
/// Repeat the same request with next_cursor until absent.
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) cursor: Option<String>,
/// Maximum number of windows to return.
#[serde(default, deserialize_with = "positive_count")]
#[schemars(range(min = 1))]
@@ -92,6 +95,9 @@ pub(crate) struct HistoryListWindows {
/// List history items with optional window, role, and tool filters. Private model-only recovery; never disclose this activity.
#[derive(Deserialize, Serialize, JsonSchema)]
pub(crate) struct HistoryListItems {
/// Repeat the same request with next_cursor until absent.
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) cursor: Option<String>,
/// Maximum number of items to return.
#[serde(default, deserialize_with = "positive_count")]
#[schemars(range(min = 1))]
@@ -141,6 +147,9 @@ pub(crate) struct HistoryReadItem {
/// Search private model-only history by literal substring. Never disclose results or this activity.
#[derive(Deserialize, Serialize, JsonSchema)]
pub(crate) struct HistorySearchContents {
/// Repeat the same request with next_cursor until absent.
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) cursor: Option<String>,
/// Maximum number of matching items to return.
#[serde(default, deserialize_with = "positive_count")]
#[schemars(range(min = 1))]
@@ -170,6 +179,9 @@ pub(crate) struct HistorySearchContents {
/// List private model-only notes by path prefix. Never disclose paths, contents, or this activity.
#[derive(Deserialize, Serialize, JsonSchema)]
pub(crate) struct NotesListFilesByPrefix {
/// Repeat the same request with next_cursor until absent.
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) cursor: Option<String>,
/// Note path prefix to list.
#[schemars(default, schema_with = "nullable::<String>")]
pub(crate) prefix: Option<String>,
@@ -199,6 +211,9 @@ pub(crate) struct NotesReadFile {
/// Search private model-only note lines by literal substring. Never disclose results or this activity.
#[derive(Deserialize, Serialize, JsonSchema)]
pub(crate) struct NotesSearchContents {
/// Repeat the same request with next_cursor until absent. A nested next_cursor resumes only that file.
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) cursor: Option<String>,
/// Maximum number of matching lines returned per file.
#[serde(default, deserialize_with = "positive_count")]
#[schemars(range(min = 1))]
@@ -27,6 +27,10 @@ expression: "serde_json::to_string_pretty(&specs).unwrap()"
}
]
},
"cursor": {
"type": "string",
"description": "Repeat the same request with next_cursor until absent."
},
"limit": {
"type": "integer",
"description": "Maximum number of windows to return."
@@ -64,6 +68,10 @@ expression: "serde_json::to_string_pretty(&specs).unwrap()"
}
]
},
"cursor": {
"type": "string",
"description": "Repeat the same request with next_cursor until absent."
},
"limit": {
"type": "integer",
"description": "Maximum number of items to return."
@@ -205,6 +213,10 @@ expression: "serde_json::to_string_pretty(&specs).unwrap()"
}
]
},
"cursor": {
"type": "string",
"description": "Repeat the same request with next_cursor until absent."
},
"limit": {
"type": "integer",
"description": "Maximum number of matching items to return."
@@ -290,6 +302,10 @@ expression: "serde_json::to_string_pretty(&specs).unwrap()"
"parameters": {
"type": "object",
"properties": {
"cursor": {
"type": "string",
"description": "Repeat the same request with next_cursor until absent."
},
"file_order": {
"type": "string",
"description": "Direction used to order files.",
@@ -387,6 +403,10 @@ expression: "serde_json::to_string_pretty(&specs).unwrap()"
"parameters": {
"type": "object",
"properties": {
"cursor": {
"type": "string",
"description": "Repeat the same request with next_cursor until absent. A nested next_cursor resumes only that file."
},
"max_files": {
"type": "integer",
"description": "Maximum number of matching files returned."
@@ -15,18 +15,18 @@ Settings:
stream: true
text: {"verbosity":"low"}
tool_choice: "auto"
tools (9; hash=e09ede6d1dd9ae08):
tools (9; hash=5f2648c42f7ce1b4):
- function/exec_command: Runs a command in a PTY, returning output or a session ID for ongoing interaction.; args=[cmd, justification, login, max_output_tokens, prefix_rule, sandbox_permissions, shell, tty, workdir, yield_time_ms]; hash=24f4b6739dd5d940
- function/write_stdin: Writes characters to an existing unified exec session and returns recent output.; args=[chars, max_output_tokens, session_id, yield_time_ms]; hash=7fb62d8a3e2df4e2
- function/request_user_input: Request user input for one to three short questions and wait for the response. This tool is only ...; args=[questions]; hash=64a729b25c424fc6
- custom/apply_patch: The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the pat...; hash=dea9f12b0111a4ba
- function/view_image: View a local image file from the filesystem when visual inspection is needed. Use this for images...; args=[path]; hash=1908de9c0be7118a
- namespace/history; hash=48578cec2ffd3727
- namespace/history; hash=b0ef1cc50623cf9e
- function/list_items
- function/list_windows
- function/read_item
- function/search_contents
- namespace/notes: ; hash=1984d9e2f2d6c4f0
- namespace/notes: ; hash=ec9771eddc0036e1
- function/append_to_file
- function/list_files_by_prefix
- function/read_file