From 2a94d627b2f5844140d0f6ebe90e34f604e8e25b Mon Sep 17 00:00:00 2001 From: Osvaldo Ortega Date: Fri, 20 Nov 2026 11:30:26 -0800 Subject: [PATCH] chat: add optional host-side search of retained turns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return stable match locations in visible prompts and replies. Require browsing so clients can reveal a result without loading the gap or changing another client’s view. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Generated/Commands.generated.cs | 72 ++++++++++++ .../JsonSerializerContext.generated.cs | 5 + .../Generated/State.generated.cs | 8 ++ .../TypesRoundTripFixtures.cs | 4 + clients/go/ahptypes/commands.generated.go | 55 +++++++++ clients/go/ahptypes/roundtrip_fixture_test.go | 8 ++ clients/go/ahptypes/state.generated.go | 6 + .../generated/Commands.generated.kt | 79 +++++++++++++ .../generated/Messages.generated.kt | 3 + .../generated/State.generated.kt | 10 +- .../agenthostprotocol/RoundTripCorpusTest.kt | 4 + clients/rust/crates/ahp-types/src/commands.rs | 69 ++++++++++++ clients/rust/crates/ahp-types/src/state.rs | 11 +- .../ahp-types/tests/roundtrip_corpus.rs | 5 +- .../Generated/Commands.generated.swift | 102 +++++++++++++++++ .../Generated/Messages.generated.swift | 4 + .../Generated/State.generated.swift | 11 ++ .../TypesRoundTripFixtureTests.swift | 4 + .../typescript/test/types-round-trip.test.ts | 4 +- .../20261120-chat-history-search.json | 4 + docs/specification/chat-channel.md | 18 +++ docs/specification/subscriptions.md | 2 +- schema/actions.schema.json | 10 ++ schema/commands.schema.json | 105 ++++++++++++++++++ schema/errors.schema.json | 105 ++++++++++++++++++ schema/notifications.schema.json | 10 ++ schema/state.schema.json | 10 ++ scripts/generate-csharp.ts | 4 +- scripts/generate-go.ts | 4 +- scripts/generate-json-schema.test.ts | 20 ++++ scripts/generate-kotlin.ts | 7 +- scripts/generate-rust.ts | 4 +- scripts/generate-swift.ts | 8 +- types/channels-chat/commands.ts | 69 ++++++++++++ types/channels-chat/state.ts | 8 +- types/common/messages.ts | 3 + .../105-search-chat-turns-params.json | 8 ++ .../106-search-chat-turns-result.json | 8 ++ .../107-chat-history-search-snapshot.json | 16 +++ .../108-search-chat-turns-continuation.json | 8 ++ types/version/message-checks.ts | 1 + 41 files changed, 885 insertions(+), 11 deletions(-) create mode 100644 docs/.changes/20261120-chat-history-search.json create mode 100644 types/test-cases/round-trips/105-search-chat-turns-params.json create mode 100644 types/test-cases/round-trips/106-search-chat-turns-result.json create mode 100644 types/test-cases/round-trips/107-chat-history-search-snapshot.json create mode 100644 types/test-cases/round-trips/108-search-chat-turns-continuation.json diff --git a/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/Commands.generated.cs b/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/Commands.generated.cs index 6b04221f4..dfcacb350 100644 --- a/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/Commands.generated.cs +++ b/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/Commands.generated.cs @@ -140,6 +140,16 @@ public enum ChatTurnReadDirection After, } +/// The searchable side of a completed turn. +[JsonConverter(typeof(WireEnumConverter))] +public enum ChatTurnMatchKind +{ + [WireValue("request")] + Request, + [WireValue("response")] + Response, +} + /// Native filesystem path grammar used by a host environment. [JsonConverter(typeof(WireEnumConverter))] public enum PathStyle @@ -1934,6 +1944,68 @@ public sealed record ReadChatTurnsResult public bool HasAfter { get; init; } } +/// A match locator, not a snippet, text offset, or response-part identifier. +public sealed record ChatTurnMatch +{ + public required string TurnId { get; init; } + + public ChatTurnMatchKind Kind { get; init; } + + /// Zero-based index of this nonempty match in forward text order on this + /// side of the turn, for the same query and flags. + public long Occurrence { get; init; } +} + +/// Searches visible request and response text in retained completed turns. +/// Returns match locators newest first, independently of the subscription. +/// Requires `ChatState.historyBrowsing.search`. +public sealed record SearchChatTurnsParams +{ + /// Chat URI. + public required string Channel { get; init; } + + /// Optional JSON-serializable metadata associated with this request. + /// Receivers MUST ignore keys they do not understand. + [JsonPropertyName("_meta")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public Dictionary? Meta { get; init; } + + /// Maximum matches in the page; defaults to 100. The host may return fewer. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public long? Limit { get; init; } + + /// Opaque cursor for the same chat, query and effective flags; omit to start at the newest turn. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Cursor { get; init; } + + /// Nonempty literal text, or a pattern when `isRegex` is true. + public required string Query { get; init; } + + /// Case-sensitive matching; defaults to false. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? MatchCase { get; init; } + + /// Require whole-word matches; defaults to false. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? WholeWord { get; init; } + + /// Treat the query as a regular expression; defaults to false. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? IsRegex { get; init; } +} + +/// One page of match locators, which may end within a turn or side. +public sealed record SearchChatTurnsResult +{ + /// Resume after the last result or scanned position. A bounded scan may + /// return no matches with an advancing cursor; only absence means done. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? NextCursor { get; init; } + + /// Match locators in reverse transcript order. + public required List Items { get; init; } +} + /// Stop receiving updates for a channel. public sealed record UnsubscribeParams { diff --git a/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/JsonSerializerContext.generated.cs b/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/JsonSerializerContext.generated.cs index eb3f220ca..7e5172c4c 100644 --- a/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/JsonSerializerContext.generated.cs +++ b/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/JsonSerializerContext.generated.cs @@ -138,6 +138,7 @@ namespace Microsoft.AgentHostProtocol; [JsonSerializable(typeof(ChatDraftChangedAction))] [JsonSerializable(typeof(ChatErrorAction))] [JsonSerializable(typeof(ChatHistoryBrowsingCapability))] +[JsonSerializable(typeof(ChatHistorySearchCapability))] [JsonSerializable(typeof(ChatInputAnswer))] [JsonSerializable(typeof(ChatInputAnswerChangedAction))] [JsonSerializable(typeof(ChatInputAnswered))] @@ -199,6 +200,8 @@ namespace Microsoft.AgentHostProtocol; [JsonSerializable(typeof(ChatTurnCancelledAction))] [JsonSerializable(typeof(ChatTurnCompleteAction))] [JsonSerializable(typeof(ChatTurnIndexEntry))] +[JsonSerializable(typeof(ChatTurnMatch))] +[JsonSerializable(typeof(ChatTurnMatchKind))] [JsonSerializable(typeof(ChatTurnReadDirection))] [JsonSerializable(typeof(ChatTurnResumeAction))] [JsonSerializable(typeof(ChatTurnsLoadedAction))] @@ -370,6 +373,8 @@ namespace Microsoft.AgentHostProtocol; [JsonSerializable(typeof(RuleCustomization))] [JsonSerializable(typeof(RunAutomationParams))] [JsonSerializable(typeof(RunAutomationResult))] +[JsonSerializable(typeof(SearchChatTurnsParams))] +[JsonSerializable(typeof(SearchChatTurnsResult))] [JsonSerializable(typeof(SessionActiveClient))] [JsonSerializable(typeof(SessionActiveClientRemovedAction))] [JsonSerializable(typeof(SessionActiveClientSetAction))] diff --git a/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/State.generated.cs b/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/State.generated.cs index e697d0a0b..0bf1532c7 100644 --- a/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/State.generated.cs +++ b/clients/dotnet/src/AgentHostProtocol.Abstractions/Generated/State.generated.cs @@ -2175,6 +2175,14 @@ public sealed record MultipleChatsCapability /// Presence advertises `listChatTurns` and `readChatTurns` for this chat. public sealed record ChatHistoryBrowsingCapability +{ + /// Presence advertises host-side search; omit for browsing-only chats. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public ChatHistorySearchCapability? Search { get; init; } +} + +/// Presence advertises `searchChatTurns`. Open a result with `readChatTurns`. +public sealed record ChatHistorySearchCapability { } diff --git a/clients/dotnet/tests/AgentHostProtocol.Tests/TypesRoundTripFixtures.cs b/clients/dotnet/tests/AgentHostProtocol.Tests/TypesRoundTripFixtures.cs index 4937291ba..b4bbb9193 100644 --- a/clients/dotnet/tests/AgentHostProtocol.Tests/TypesRoundTripFixtures.cs +++ b/clients/dotnet/tests/AgentHostProtocol.Tests/TypesRoundTripFixtures.cs @@ -174,6 +174,10 @@ private static (object decoded, string reencoded) DecodeAndReencode(string type, return Wrap(Ser.Deserialize(inputJson)); case "ReadChatTurnsResult": return Wrap(Ser.Deserialize(inputJson)); + case "SearchChatTurnsParams": + return Wrap(Ser.Deserialize(inputJson)); + case "SearchChatTurnsResult": + return Wrap(Ser.Deserialize(inputJson)); case "Snapshot": return Wrap(Ser.Deserialize(inputJson)); case "SubscribeParams": diff --git a/clients/go/ahptypes/commands.generated.go b/clients/go/ahptypes/commands.generated.go index a1cffbd9e..e19a409f4 100644 --- a/clients/go/ahptypes/commands.generated.go +++ b/clients/go/ahptypes/commands.generated.go @@ -55,6 +55,14 @@ const ( ChatTurnReadDirectionAfter ChatTurnReadDirection = "after" ) +// The searchable side of a completed turn. +type ChatTurnMatchKind string + +const ( + ChatTurnMatchKindRequest ChatTurnMatchKind = "request" + ChatTurnMatchKindResponse ChatTurnMatchKind = "response" +) + // Native filesystem path grammar used by a host environment. type PathStyle string @@ -1387,6 +1395,53 @@ type ReadChatTurnsResult struct { HasAfter bool `json:"hasAfter"` } +// A match locator, not a snippet, text offset, or response-part identifier. +type ChatTurnMatch struct { + TurnId string `json:"turnId"` + Kind ChatTurnMatchKind `json:"kind"` + // Zero-based index of this nonempty match in forward text order on this + // side of the turn, for the same query and flags. + Occurrence int64 `json:"occurrence"` +} + +// Searches visible request and response text in retained completed turns. +// Returns match locators newest first, independently of the subscription. +// Requires `ChatState.historyBrowsing.search`. +type SearchChatTurnsParams struct { + // Channel URI this command targets. + Channel URI `json:"channel"` + // Optional JSON-serializable metadata associated with this request. + // Receivers MUST ignore keys they do not understand. + Meta map[string]json.RawMessage `json:"_meta,omitempty"` + // Maximum number of entries to return in this page. The server SHOULD respect + // this bound but MAY return fewer entries and MAY impose its own upper cap. + // Omit to let the server choose the page size. + Limit *int64 `json:"limit,omitempty"` + // Opaque pagination cursor from a previous {@link PaginatedResult.nextCursor}. + // Omit to fetch the first page. Cursors are server-defined and MUST be treated + // as opaque — do not parse, modify, or persist them across connections. An + // unrecognised cursor SHOULD be rejected with an `InvalidParams` error. + Cursor *string `json:"cursor,omitempty"` + // Nonempty literal text, or a pattern when `isRegex` is true. + Query string `json:"query"` + // Case-sensitive matching; defaults to false. + MatchCase *bool `json:"matchCase,omitempty"` + // Require whole-word matches; defaults to false. + WholeWord *bool `json:"wholeWord,omitempty"` + // Treat the query as a regular expression; defaults to false. + IsRegex *bool `json:"isRegex,omitempty"` +} + +// One page of match locators, which may end within a turn or side. +type SearchChatTurnsResult struct { + // Opaque cursor for the next page. Present when more entries exist beyond the + // returned page; absent signals the end of the collection. Pass it back as + // {@link PaginatedParams.cursor} to fetch the following page. + NextCursor *string `json:"nextCursor,omitempty"` + // Match locators in reverse transcript order. + Items []ChatTurnMatch `json:"items"` +} + // Stop receiving updates for a channel. type UnsubscribeParams struct { // Channel URI to unsubscribe from diff --git a/clients/go/ahptypes/roundtrip_fixture_test.go b/clients/go/ahptypes/roundtrip_fixture_test.go index 9d470a215..c6ec5ea0c 100644 --- a/clients/go/ahptypes/roundtrip_fixture_test.go +++ b/clients/go/ahptypes/roundtrip_fixture_test.go @@ -278,6 +278,14 @@ func decodeAndReencode(t *testing.T, name, typ, inputJSON string) string { var v ReadChatTurnsResult dec(&v) return enc(&v) + case "SearchChatTurnsParams": + var v SearchChatTurnsParams + dec(&v) + return enc(&v) + case "SearchChatTurnsResult": + var v SearchChatTurnsResult + dec(&v) + return enc(&v) case "ChatSource": var v ChatSource dec(&v) diff --git a/clients/go/ahptypes/state.generated.go b/clients/go/ahptypes/state.generated.go index e1292043e..e55a9171c 100644 --- a/clients/go/ahptypes/state.generated.go +++ b/clients/go/ahptypes/state.generated.go @@ -878,6 +878,12 @@ type MultipleChatsCapability struct { // Presence advertises `listChatTurns` and `readChatTurns` for this chat. type ChatHistoryBrowsingCapability struct { + // Presence advertises host-side search; omit for browsing-only chats. + Search *ChatHistorySearchCapability `json:"search,omitempty"` +} + +// Presence advertises `searchChatTurns`. Open a result with `readChatTurns`. +type ChatHistorySearchCapability struct { } // Options for the {@link AgentCapabilities.multipleWorkingDirectories} capability. diff --git a/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Commands.generated.kt b/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Commands.generated.kt index 096f2e94f..abea80936 100644 --- a/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Commands.generated.kt +++ b/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Commands.generated.kt @@ -111,6 +111,17 @@ enum class ChatTurnReadDirection { AFTER } +/** + * The searchable side of a completed turn. + */ +@Serializable +enum class ChatTurnMatchKind { + @SerialName("request") + REQUEST, + @SerialName("response") + RESPONSE +} + /** * Native filesystem path grammar used by a host environment. */ @@ -1686,6 +1697,74 @@ data class ReadChatTurnsResult( val hasAfter: Boolean ) +@Serializable +data class ChatTurnMatch( + val turnId: String, + val kind: ChatTurnMatchKind, + /** + * Zero-based index of this nonempty match in forward text order on this + * side of the turn, for the same query and flags. + */ + val occurrence: Long +) + +@Serializable +data class SearchChatTurnsParams( + /** + * Channel URI this command targets. + */ + val channel: String, + /** + * Optional JSON-serializable metadata associated with this request. + * Receivers MUST ignore keys they do not understand. + */ + @SerialName("_meta") + val meta: Map? = null, + /** + * Maximum number of entries to return in this page. The server SHOULD respect + * this bound but MAY return fewer entries and MAY impose its own upper cap. + * Omit to let the server choose the page size. + */ + val limit: Long? = null, + /** + * Opaque pagination cursor from a previous {@link PaginatedResult.nextCursor}. + * Omit to fetch the first page. Cursors are server-defined and MUST be treated + * as opaque — do not parse, modify, or persist them across connections. An + * unrecognised cursor SHOULD be rejected with an `InvalidParams` error. + */ + val cursor: String? = null, + /** + * Nonempty literal text, or a pattern when `isRegex` is true. + */ + val query: String, + /** + * Case-sensitive matching; defaults to false. + */ + val matchCase: Boolean? = null, + /** + * Require whole-word matches; defaults to false. + */ + val wholeWord: Boolean? = null, + /** + * Treat the query as a regular expression; defaults to false. + */ + val isRegex: Boolean? = null +) + +@Serializable +data class SearchChatTurnsResult( + /** + * Opaque cursor for the next page. Present when more entries exist beyond the + * returned page; absent signals the end of the collection. Pass it back as + * {@link PaginatedParams.cursor} to fetch the following page. + */ + val nextCursor: String? = null, + /** + * Match locators in reverse transcript order. + */ + val items: List +) + @Serializable data class UnsubscribeParams( /** diff --git a/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Messages.generated.kt b/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Messages.generated.kt index d3cf31552..9aa4e5c3f 100644 --- a/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Messages.generated.kt +++ b/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Messages.generated.kt @@ -137,6 +137,9 @@ object AhpCommands { fun readChatTurns(id: Long, params: ReadChatTurnsParams): JsonRpcRequest = JsonRpcRequest(id = id, method = "readChatTurns", params = params) + fun searchChatTurns(id: Long, params: SearchChatTurnsParams): JsonRpcRequest = + JsonRpcRequest(id = id, method = "searchChatTurns", params = params) + fun authenticate(id: Long, params: AuthenticateParams): JsonRpcRequest = JsonRpcRequest(id = id, method = "authenticate", params = params) diff --git a/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/State.generated.kt b/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/State.generated.kt index dd0bf54b3..e8ea5fa24 100644 --- a/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/State.generated.kt +++ b/clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/State.generated.kt @@ -1645,7 +1645,15 @@ data class MultipleChatsCapability( ) @Serializable -class ChatHistoryBrowsingCapability +data class ChatHistoryBrowsingCapability( + /** + * Presence advertises host-side search; omit for browsing-only chats. + */ + val search: ChatHistorySearchCapability? = null +) + +@Serializable +class ChatHistorySearchCapability @Serializable data class MultipleWorkingDirectoriesCapability( diff --git a/clients/kotlin/src/test/kotlin/com/microsoft/agenthostprotocol/RoundTripCorpusTest.kt b/clients/kotlin/src/test/kotlin/com/microsoft/agenthostprotocol/RoundTripCorpusTest.kt index f36aa4712..047e00640 100644 --- a/clients/kotlin/src/test/kotlin/com/microsoft/agenthostprotocol/RoundTripCorpusTest.kt +++ b/clients/kotlin/src/test/kotlin/com/microsoft/agenthostprotocol/RoundTripCorpusTest.kt @@ -37,6 +37,8 @@ import com.microsoft.agenthostprotocol.generated.ListChatTurnsParams import com.microsoft.agenthostprotocol.generated.ListChatTurnsResult import com.microsoft.agenthostprotocol.generated.ReadChatTurnsParams import com.microsoft.agenthostprotocol.generated.ReadChatTurnsResult +import com.microsoft.agenthostprotocol.generated.SearchChatTurnsParams +import com.microsoft.agenthostprotocol.generated.SearchChatTurnsResult import com.microsoft.agenthostprotocol.generated.Customization import com.microsoft.agenthostprotocol.generated.Implementation import com.microsoft.agenthostprotocol.generated.InitializeResult @@ -276,6 +278,8 @@ class RoundTripCorpusTest { "ListChatTurnsResult" -> rt(ListChatTurnsResult.serializer()) "ReadChatTurnsParams" -> rt(ReadChatTurnsParams.serializer()) "ReadChatTurnsResult" -> rt(ReadChatTurnsResult.serializer()) + "SearchChatTurnsParams" -> rt(SearchChatTurnsParams.serializer()) + "SearchChatTurnsResult" -> rt(SearchChatTurnsResult.serializer()) "ChatSource" -> rt(ChatSource.serializer()) "Snapshot" -> rt(Snapshot.serializer()) "SubscribeParams" -> rt(SubscribeParams.serializer()) diff --git a/clients/rust/crates/ahp-types/src/commands.rs b/clients/rust/crates/ahp-types/src/commands.rs index f6fa29a8c..70b3cd25c 100644 --- a/clients/rust/crates/ahp-types/src/commands.rs +++ b/clients/rust/crates/ahp-types/src/commands.rs @@ -123,6 +123,15 @@ pub enum ChatTurnReadDirection { After, } +/// The searchable side of a completed turn. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ChatTurnMatchKind { + #[serde(rename = "request")] + Request, + #[serde(rename = "response")] + Response, +} + /// Native filesystem path grammar used by a host environment. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum PathStyle { @@ -1796,6 +1805,66 @@ pub struct ReadChatTurnsResult { pub has_after: bool, } +/// A match locator, not a snippet, text offset, or response-part identifier. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ChatTurnMatch { + pub turn_id: String, + pub kind: ChatTurnMatchKind, + /// Zero-based index of this nonempty match in forward text order on this + /// side of the turn, for the same query and flags. + pub occurrence: i64, +} + +/// Searches visible request and response text in retained completed turns. +/// Returns match locators newest first, independently of the subscription. +/// Requires `ChatState.historyBrowsing.search`. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SearchChatTurnsParams { + /// Channel URI this command targets. + pub channel: Uri, + /// Optional JSON-serializable metadata associated with this request. + /// Receivers MUST ignore keys they do not understand. + #[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")] + pub meta: Option, + /// Maximum number of entries to return in this page. The server SHOULD respect + /// this bound but MAY return fewer entries and MAY impose its own upper cap. + /// Omit to let the server choose the page size. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// Opaque pagination cursor from a previous {@link PaginatedResult.nextCursor}. + /// Omit to fetch the first page. Cursors are server-defined and MUST be treated + /// as opaque — do not parse, modify, or persist them across connections. An + /// unrecognised cursor SHOULD be rejected with an `InvalidParams` error. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cursor: Option, + /// Nonempty literal text, or a pattern when `isRegex` is true. + pub query: String, + /// Case-sensitive matching; defaults to false. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub match_case: Option, + /// Require whole-word matches; defaults to false. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub whole_word: Option, + /// Treat the query as a regular expression; defaults to false. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub is_regex: Option, +} + +/// One page of match locators, which may end within a turn or side. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SearchChatTurnsResult { + /// Opaque cursor for the next page. Present when more entries exist beyond the + /// returned page; absent signals the end of the collection. Pass it back as + /// {@link PaginatedParams.cursor} to fetch the following page. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub next_cursor: Option, + /// Match locators in reverse transcript order. + pub items: Vec, +} + /// Stop receiving updates for a channel. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] diff --git a/clients/rust/crates/ahp-types/src/state.rs b/clients/rust/crates/ahp-types/src/state.rs index d22918829..576678b37 100644 --- a/clients/rust/crates/ahp-types/src/state.rs +++ b/clients/rust/crates/ahp-types/src/state.rs @@ -1968,9 +1968,18 @@ pub struct MultipleChatsCapability { } /// Presence advertises `listChatTurns` and `readChatTurns` for this chat. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)] +#[serde(rename_all = "camelCase")] +pub struct ChatHistoryBrowsingCapability { + /// Presence advertises host-side search; omit for browsing-only chats. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub search: Option, +} + +/// Presence advertises `searchChatTurns`. Open a result with `readChatTurns`. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ChatHistoryBrowsingCapability {} +pub struct ChatHistorySearchCapability {} /// Options for the {@link AgentCapabilities.multipleWorkingDirectories} capability. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)] diff --git a/clients/rust/crates/ahp-types/tests/roundtrip_corpus.rs b/clients/rust/crates/ahp-types/tests/roundtrip_corpus.rs index 432bb94e1..3622963a5 100644 --- a/clients/rust/crates/ahp-types/tests/roundtrip_corpus.rs +++ b/clients/rust/crates/ahp-types/tests/roundtrip_corpus.rs @@ -32,7 +32,8 @@ use ahp_types::{ AuthenticateParams, ChangesetOperationTarget, ChatSource, CreateChatParams, CreateTcpConnectionParams, Implementation, InitializeResult, ListChatTurnsParams, ListChatTurnsResult, ReadChatTurnsParams, ReadChatTurnsResult, ReconnectParams, - ReconnectResult, ResourceReadParams, ResourceReadResult, SubscribeParams, SubscribeResult, + ReconnectResult, ResourceReadParams, ResourceReadResult, SearchChatTurnsParams, + SearchChatTurnsResult, SubscribeParams, SubscribeResult, }, common::StringOrMarkdown, messages::JsonRpcMessage, @@ -236,6 +237,8 @@ fn decode_and_reencode(file: &str, type_name: &str, input_json: &str) -> Result< "ListChatTurnsResult" => round_trip!(ListChatTurnsResult), "ReadChatTurnsParams" => round_trip!(ReadChatTurnsParams), "ReadChatTurnsResult" => round_trip!(ReadChatTurnsResult), + "SearchChatTurnsParams" => round_trip!(SearchChatTurnsParams), + "SearchChatTurnsResult" => round_trip!(SearchChatTurnsResult), "ChatSource" => round_trip!(ChatSource), "Snapshot" => round_trip!(Snapshot), "SubscribeParams" => round_trip!(SubscribeParams), diff --git a/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Commands.generated.swift b/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Commands.generated.swift index 5363caa10..072374acd 100644 --- a/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Commands.generated.swift +++ b/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Commands.generated.swift @@ -78,6 +78,12 @@ public enum ChatTurnReadDirection: String, Codable, Sendable { case after = "after" } +/// The searchable side of a completed turn. +public enum ChatTurnMatchKind: String, Codable, Sendable { + case request = "request" + case response = "response" +} + /// Native filesystem path grammar used by a host environment. public enum PathStyle: String, Codable, Sendable { case posix = "posix" @@ -2044,6 +2050,97 @@ public struct ReadChatTurnsResult: Codable, Sendable, Equatable { } } +public struct ChatTurnMatch: Codable, Sendable, Equatable { + public var turnId: String + public var kind: ChatTurnMatchKind + /// Zero-based index of this nonempty match in forward text order on this + /// side of the turn, for the same query and flags. + public var occurrence: Int + + public init( + turnId: String, + kind: ChatTurnMatchKind, + occurrence: Int + ) { + self.turnId = turnId + self.kind = kind + self.occurrence = occurrence + } +} + +public struct SearchChatTurnsParams: Codable, Sendable, Equatable { + /// Channel URI this command targets. + public var channel: String + /// Optional JSON-serializable metadata associated with this request. + /// Receivers MUST ignore keys they do not understand. + public var meta: [String: AnyCodable]? + /// Maximum number of entries to return in this page. The server SHOULD respect + /// this bound but MAY return fewer entries and MAY impose its own upper cap. + /// Omit to let the server choose the page size. + public var limit: Int? + /// Opaque pagination cursor from a previous {@link PaginatedResult.nextCursor}. + /// Omit to fetch the first page. Cursors are server-defined and MUST be treated + /// as opaque — do not parse, modify, or persist them across connections. An + /// unrecognised cursor SHOULD be rejected with an `InvalidParams` error. + public var cursor: String? + /// Nonempty literal text, or a pattern when `isRegex` is true. + public var query: String + /// Case-sensitive matching; defaults to false. + public var matchCase: Bool? + /// Require whole-word matches; defaults to false. + public var wholeWord: Bool? + /// Treat the query as a regular expression; defaults to false. + public var isRegex: Bool? + + enum CodingKeys: String, CodingKey { + case channel + case meta = "_meta" + case limit + case cursor + case query + case matchCase + case wholeWord + case isRegex + } + + public init( + channel: String, + meta: [String: AnyCodable]? = nil, + limit: Int? = nil, + cursor: String? = nil, + query: String, + matchCase: Bool? = nil, + wholeWord: Bool? = nil, + isRegex: Bool? = nil + ) { + self.channel = channel + self.meta = meta + self.limit = limit + self.cursor = cursor + self.query = query + self.matchCase = matchCase + self.wholeWord = wholeWord + self.isRegex = isRegex + } +} + +public struct SearchChatTurnsResult: Codable, Sendable, Equatable { + /// Opaque cursor for the next page. Present when more entries exist beyond the + /// returned page; absent signals the end of the collection. Pass it back as + /// {@link PaginatedParams.cursor} to fetch the following page. + public var nextCursor: String? + /// Match locators in reverse transcript order. + public var items: [ChatTurnMatch] + + public init( + nextCursor: String? = nil, + items: [ChatTurnMatch] + ) { + self.nextCursor = nextCursor + self.items = items + } +} + public struct UnsubscribeParams: Codable, Sendable, Equatable { /// Channel URI to unsubscribe from public var channel: String @@ -3093,6 +3190,11 @@ extension ReadChatTurnsParams: AHPCommand { public static let method = "readChatTurns" } +extension SearchChatTurnsParams: AHPCommand { + public typealias Result = SearchChatTurnsResult + public static let method = "searchChatTurns" +} + extension CreateTerminalParams: AHPCommand { public typealias Result = AHPNullResult public static let method = "createTerminal" diff --git a/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Messages.generated.swift b/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Messages.generated.swift index 2afb27e9d..28cd20c24 100644 --- a/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Messages.generated.swift +++ b/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Messages.generated.swift @@ -141,6 +141,10 @@ public enum AHPCommands { JsonRpcRequest(id: id, method: "readChatTurns", params: params) } + public static func searchChatTurns(id: Int, params: SearchChatTurnsParams) -> JsonRpcRequest { + JsonRpcRequest(id: id, method: "searchChatTurns", params: params) + } + public static func authenticate(id: Int, params: AuthenticateParams) -> JsonRpcRequest { JsonRpcRequest(id: id, method: "authenticate", params: params) } diff --git a/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/State.generated.swift b/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/State.generated.swift index dd461c9be..c9b3ef86d 100644 --- a/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/State.generated.swift +++ b/clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/State.generated.swift @@ -1642,6 +1642,17 @@ public struct MultipleChatsCapability: Codable, Sendable, Equatable { } public struct ChatHistoryBrowsingCapability: Codable, Sendable, Equatable { + /// Presence advertises host-side search; omit for browsing-only chats. + public var search: ChatHistorySearchCapability? + + public init( + search: ChatHistorySearchCapability? = nil + ) { + self.search = search + } +} + +public struct ChatHistorySearchCapability: Codable, Sendable, Equatable { public init( diff --git a/clients/swift/AgentHostProtocol/Tests/AgentHostProtocolClientTests/TypesRoundTripFixtureTests.swift b/clients/swift/AgentHostProtocol/Tests/AgentHostProtocolClientTests/TypesRoundTripFixtureTests.swift index 9713a69b7..6a3573078 100644 --- a/clients/swift/AgentHostProtocol/Tests/AgentHostProtocolClientTests/TypesRoundTripFixtureTests.swift +++ b/clients/swift/AgentHostProtocol/Tests/AgentHostProtocolClientTests/TypesRoundTripFixtureTests.swift @@ -198,6 +198,10 @@ final class TypesRoundTripFixtureTests: XCTestCase { return try reencode(dec.decode(ReadChatTurnsParams.self, from: inputData)) case "ReadChatTurnsResult": return try reencode(dec.decode(ReadChatTurnsResult.self, from: inputData)) + case "SearchChatTurnsParams": + return try reencode(dec.decode(SearchChatTurnsParams.self, from: inputData)) + case "SearchChatTurnsResult": + return try reencode(dec.decode(SearchChatTurnsResult.self, from: inputData)) case "ChatSource": return try reencode(dec.decode(ChatSource.self, from: inputData)) case "Snapshot": diff --git a/clients/typescript/test/types-round-trip.test.ts b/clients/typescript/test/types-round-trip.test.ts index 6ef5ff2c9..8a1bb9cb2 100644 --- a/clients/typescript/test/types-round-trip.test.ts +++ b/clients/typescript/test/types-round-trip.test.ts @@ -68,7 +68,7 @@ import type { TcpDataParams, TcpEofParams, TcpResetParams } from '../src/types/c import type { CreateTcpConnectionParams } from '../src/types/channels-tcp/commands.js'; import type { ChatSource, CreateChatParams, ListChatTurnsParams, ListChatTurnsResult, ReadChatTurnsParams, - ReadChatTurnsResult, + ReadChatTurnsResult, SearchChatTurnsParams, SearchChatTurnsResult, } from '../src/types/channels-chat/commands.js'; // ─── Fixture directory ─────────────────────────────────────────────────────── @@ -257,6 +257,8 @@ function bindToType(file: string, type: string, parsed: unknown): void { case 'ListChatTurnsResult': void (parsed as ListChatTurnsResult); break; case 'ReadChatTurnsParams': void (parsed as ReadChatTurnsParams); break; case 'ReadChatTurnsResult': void (parsed as ReadChatTurnsResult); break; + case 'SearchChatTurnsParams': void (parsed as SearchChatTurnsParams); break; + case 'SearchChatTurnsResult': void (parsed as SearchChatTurnsResult); break; case 'ChatSource': void (parsed as ChatSource); break; case 'Snapshot': void (parsed as Snapshot); break; case 'SubscribeParams': void (parsed as SubscribeParams); break; diff --git a/docs/.changes/20261120-chat-history-search.json b/docs/.changes/20261120-chat-history-search.json new file mode 100644 index 000000000..66b239408 --- /dev/null +++ b/docs/.changes/20261120-chat-history-search.json @@ -0,0 +1,4 @@ +{ + "type": "added", + "message": "Chats with `historyBrowsing.search` support `searchChatTurns` to find occurrences in visible retained request and response text. Open a match with `readChatTurns` without loading the intervening history." +} diff --git a/docs/specification/chat-channel.md b/docs/specification/chat-channel.md index 87279cc83..aee851198 100644 --- a/docs/specification/chat-channel.md +++ b/docs/specification/chat-channel.md @@ -84,6 +84,23 @@ Cursors are opaque and scoped to the connection, method, and chat. They are not Return `InvalidParams` (`-32602`) for malformed, unrecognized or mis-scoped cursors, or an invalid direction or limit. An unavailable command, including for a chat that does not advertise `historyBrowsing`, returns `MethodNotFound` (`-32601`); a host that implements the command returns `NotFound` (`-32008`) for an unknown chat. Unsupported is not an empty index. Clients without support can still use their subscribed state and the existing explicit `fetchTurns` backfill operation. +#### Search visible text + +A host that supports `searchChatTurns` advertises `"historyBrowsing": { "search": {} }` in the chat snapshot. A browsing-only host omits `search`; clients MUST NOT infer search support from the ability to list or read turns. Search uses the same visibility, access checks, and read-only guarantees as browsing. Queries and selected matches are private to the caller, not shared chat state. + +`searchChatTurns` returns `{ turnId, kind, occurrence }` locators, not snippets or offsets. Search only text that can be revealed to the caller: + +- `request`: the full visible initiating `Message.text`, not its index preview. Exclude hidden requests and system notifications. +- `response`: visible text of `markdown` response parts in stream order. Match their displayed text (for example, a link's label, not its destination or Markdown delimiters), separately per part. Matches do not cross parts. Do not search reasoning, tool names, calls, arguments or output, attachments, content references, other response-part kinds, metadata, or raw provider transcripts. + +Omitted `matchCase`, `wholeWord` and `isRegex` each mean `false`: the default query is literal, case-insensitive, and may match inside words. A regex uses ECMAScript Unicode matching, case-insensitive unless `matchCase` is true. Whole-word mode applies ECMAScript word boundaries at word ends. Match left to right without overlap, ignoring zero-width matches. A host SHOULD bound regex execution; reject an invalid or over-budget pattern rather than report a partial scan as exhaustive. + +Number nonempty matches **from zero in forward text order**, restarting for each side of each turn and continuing across the visible Markdown parts of the response. Return turns **newest first**; within a turn return response before request and occurrences in descending order. For example, searching `map` in a request `map` and a response `map then map` yields `response:1`, `response:0`, `request:0`. A page may end between these matches. To reveal a match outside the subscription, read `around` its turn ID and locate the same forward occurrence on that side. The client need not load the intervening transcript. + +Omit `cursor` to start at the newest turn. The default `limit` is 100 matches; it must be a positive integer and the host may return fewer. Search follows the [continuation and error rules](#continuation-and-errors) for the prompt index, but binds each cursor to the query and effective flags as well as the connection, method and chat. A cursor can resume within one side of a turn. An empty `items` page with an advancing `nextCursor` is not a final “no matches”; only an absent cursor ends the traversal. + +An unavailable search command returns `MethodNotFound` (`-32601`), including on a browsing-only chat; it does not return an empty result. An empty query or invalid or over-budget regex returns `InvalidParams` (`-32602`). + ### Reasoning timing [`ReasoningResponsePart`](/reference/chat#reasoningresponsepart) may include a producer-recorded `startedAt` timestamp and a final `duration` in non-negative integer milliseconds. Timing is optional: an absent duration means unfinished or unknown, not zero. Clients MUST treat a supplied duration as producer-owned data rather than measuring replay, subtracting their local clock from `startedAt`, or substituting a minimum display value into stored state. @@ -425,6 +442,7 @@ This section lists wire methods that are interpreted in the context of a chat UR | `fetchTurns` | request | Ask the host to load older historical turns into this chat state. | | `listChatTurns` | request | Page the retained prompt index without loading turns into state. | | `readChatTurns` | request | Read a bounded window around, before, or after a retained turn. | +| `searchChatTurns` | request | Find occurrences in visible retained request and response text. | | `completions` | request | Chat-scoped inline completions (e.g. user-message mentions). | `createChat` is dispatched against the owning session URI (`params.channel = "ahp-session:/"`). diff --git a/docs/specification/subscriptions.md b/docs/specification/subscriptions.md index 58405cfce..7c3f5a452 100644 --- a/docs/specification/subscriptions.md +++ b/docs/specification/subscriptions.md @@ -53,7 +53,7 @@ route any message using only its `method` and `params.channel`. | `resourceRead`, `resourceWrite`, `resourceList`, `resourceCopy`, `resourceDelete`, `resourceMove`, `resourceResolve`, `resourceMkdir`, `resourceRequest`, `createResourceWatch` | `ahp-root://`. Either peer can send these requests. | | `runAutomation`, `fetchAutomationRuns` | `ahp-automations://` | | `createSession`, `disposeSession`, `createChat` | The session URI. For `createSession`, this is the URI of the new session. | -| `fetchTurns`, `listChatTurns`, `readChatTurns`, `completions`, `disposeChat` | The chat URI | +| `fetchTurns`, `listChatTurns`, `readChatTurns`, `searchChatTurns`, `completions`, `disposeChat` | The chat URI | | `moveChat` | The URI of the chat to move | | `createTerminal`, `disposeTerminal` | The terminal URI. For `createTerminal`, this is the URI of the new terminal. | | `createTcpConnection` | The URI of the new TCP channel | diff --git a/schema/actions.schema.json b/schema/actions.schema.json index bbcad23b5..2c95306b6 100644 --- a/schema/actions.schema.json +++ b/schema/actions.schema.json @@ -5239,6 +5239,16 @@ "ChatHistoryBrowsingCapability": { "type": "object", "description": "Presence advertises `listChatTurns` and `readChatTurns` for this chat.", + "properties": { + "search": { + "$ref": "#/$defs/ChatHistorySearchCapability", + "description": "Presence advertises host-side search; omit for browsing-only chats." + } + } + }, + "ChatHistorySearchCapability": { + "type": "object", + "description": "Presence advertises `searchChatTurns`. Open a result with `readChatTurns`.", "properties": {} }, "ChatState": { diff --git a/schema/commands.schema.json b/schema/commands.schema.json index a81423d1b..48530e55a 100644 --- a/schema/commands.schema.json +++ b/schema/commands.schema.json @@ -1760,6 +1760,93 @@ "hasAfter" ] }, + "ChatTurnMatch": { + "type": "object", + "description": "A match locator, not a snippet, text offset, or response-part identifier.", + "properties": { + "turnId": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/ChatTurnMatchKind" + }, + "occurrence": { + "type": "integer", + "description": "Zero-based index of this nonempty match in forward text order on this\nside of the turn, for the same query and flags.", + "minimum": 0 + } + }, + "required": [ + "turnId", + "kind", + "occurrence" + ] + }, + "SearchChatTurnsParams": { + "type": "object", + "description": "Searches visible request and response text in retained completed turns.\nReturns match locators newest first, independently of the subscription.\nRequires `ChatState.historyBrowsing.search`.", + "properties": { + "channel": { + "$ref": "#/$defs/URI", + "description": "Chat URI." + }, + "_meta": { + "type": "object", + "additionalProperties": {}, + "description": "Optional JSON-serializable metadata associated with this request.\nReceivers MUST ignore keys they do not understand." + }, + "limit": { + "type": "integer", + "description": "Maximum matches in the page; defaults to 100. The host may return fewer.", + "minimum": 1 + }, + "cursor": { + "type": "string", + "description": "Opaque cursor for the same chat, query and effective flags; omit to start at the newest turn." + }, + "query": { + "type": "string", + "description": "Nonempty literal text, or a pattern when `isRegex` is true.", + "minLength": 1 + }, + "matchCase": { + "type": "boolean", + "description": "Case-sensitive matching; defaults to false." + }, + "wholeWord": { + "type": "boolean", + "description": "Require whole-word matches; defaults to false." + }, + "isRegex": { + "type": "boolean", + "description": "Treat the query as a regular expression; defaults to false." + } + }, + "required": [ + "channel", + "query" + ] + }, + "SearchChatTurnsResult": { + "type": "object", + "description": "One page of match locators, which may end within a turn or side.", + "properties": { + "nextCursor": { + "type": "string", + "description": "Resume after the last result or scanned position. A bounded scan may\nreturn no matches with an advancing cursor; only absence means done." + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ChatTurnMatch" + }, + "description": "Match locators in reverse transcript order." + } + }, + "required": [ + "items" + ] + }, "CreateTerminalParams": { "type": "object", "description": "Creates a new terminal on the server.\n\nAfter creation, the client should subscribe to the terminal URI to receive\nstate updates. The server dispatches `root/terminalsChanged` to update the\nroot terminal list.", @@ -4723,6 +4810,16 @@ "ChatHistoryBrowsingCapability": { "type": "object", "description": "Presence advertises `listChatTurns` and `readChatTurns` for this chat.", + "properties": { + "search": { + "$ref": "#/$defs/ChatHistorySearchCapability", + "description": "Presence advertises host-side search; omit for browsing-only chats." + } + } + }, + "ChatHistorySearchCapability": { + "type": "object", + "description": "Presence advertises `searchChatTurns`. Open a result with `readChatTurns`.", "properties": {} }, "ChatState": { @@ -11337,6 +11434,14 @@ "type": "string", "description": "Which contiguous window of completed turns to read, relative to an anchor." }, + "ChatTurnMatchKind": { + "enum": [ + "request", + "response" + ], + "type": "string", + "description": "The searchable side of a completed turn." + }, "TerminalClaim": { "oneOf": [ { diff --git a/schema/errors.schema.json b/schema/errors.schema.json index 6d192ce4a..dfcd27e2f 100644 --- a/schema/errors.schema.json +++ b/schema/errors.schema.json @@ -2608,6 +2608,16 @@ "ChatHistoryBrowsingCapability": { "type": "object", "description": "Presence advertises `listChatTurns` and `readChatTurns` for this chat.", + "properties": { + "search": { + "$ref": "#/$defs/ChatHistorySearchCapability", + "description": "Presence advertises host-side search; omit for browsing-only chats." + } + } + }, + "ChatHistorySearchCapability": { + "type": "object", + "description": "Presence advertises `searchChatTurns`. Open a result with `readChatTurns`.", "properties": {} }, "ChatState": { @@ -7986,6 +7996,93 @@ "hasAfter" ] }, + "ChatTurnMatch": { + "type": "object", + "description": "A match locator, not a snippet, text offset, or response-part identifier.", + "properties": { + "turnId": { + "type": "string" + }, + "kind": { + "$ref": "#/$defs/ChatTurnMatchKind" + }, + "occurrence": { + "type": "integer", + "description": "Zero-based index of this nonempty match in forward text order on this\nside of the turn, for the same query and flags.", + "minimum": 0 + } + }, + "required": [ + "turnId", + "kind", + "occurrence" + ] + }, + "SearchChatTurnsParams": { + "type": "object", + "description": "Searches visible request and response text in retained completed turns.\nReturns match locators newest first, independently of the subscription.\nRequires `ChatState.historyBrowsing.search`.", + "properties": { + "channel": { + "$ref": "#/$defs/URI", + "description": "Chat URI." + }, + "_meta": { + "type": "object", + "additionalProperties": {}, + "description": "Optional JSON-serializable metadata associated with this request.\nReceivers MUST ignore keys they do not understand." + }, + "limit": { + "type": "integer", + "description": "Maximum matches in the page; defaults to 100. The host may return fewer.", + "minimum": 1 + }, + "cursor": { + "type": "string", + "description": "Opaque cursor for the same chat, query and effective flags; omit to start at the newest turn." + }, + "query": { + "type": "string", + "description": "Nonempty literal text, or a pattern when `isRegex` is true.", + "minLength": 1 + }, + "matchCase": { + "type": "boolean", + "description": "Case-sensitive matching; defaults to false." + }, + "wholeWord": { + "type": "boolean", + "description": "Require whole-word matches; defaults to false." + }, + "isRegex": { + "type": "boolean", + "description": "Treat the query as a regular expression; defaults to false." + } + }, + "required": [ + "channel", + "query" + ] + }, + "SearchChatTurnsResult": { + "type": "object", + "description": "One page of match locators, which may end within a turn or side.", + "properties": { + "nextCursor": { + "type": "string", + "description": "Resume after the last result or scanned position. A bounded scan may\nreturn no matches with an advancing cursor; only absence means done." + }, + "items": { + "type": "array", + "items": { + "$ref": "#/$defs/ChatTurnMatch" + }, + "description": "Match locators in reverse transcript order." + } + }, + "required": [ + "items" + ] + }, "CreateTerminalParams": { "type": "object", "description": "Creates a new terminal on the server.\n\nAfter creation, the client should subscribe to the terminal URI to receive\nstate updates. The server dispatches `root/terminalsChanged` to update the\nroot terminal list.", @@ -9541,6 +9638,14 @@ "type": "string", "description": "Which contiguous window of completed turns to read, relative to an anchor." }, + "ChatTurnMatchKind": { + "enum": [ + "request", + "response" + ], + "type": "string", + "description": "The searchable side of a completed turn." + }, "ChangesetOperationTarget": { "oneOf": [ { diff --git a/schema/notifications.schema.json b/schema/notifications.schema.json index ab56ff2f5..2d627ac68 100644 --- a/schema/notifications.schema.json +++ b/schema/notifications.schema.json @@ -2910,6 +2910,16 @@ "ChatHistoryBrowsingCapability": { "type": "object", "description": "Presence advertises `listChatTurns` and `readChatTurns` for this chat.", + "properties": { + "search": { + "$ref": "#/$defs/ChatHistorySearchCapability", + "description": "Presence advertises host-side search; omit for browsing-only chats." + } + } + }, + "ChatHistorySearchCapability": { + "type": "object", + "description": "Presence advertises `searchChatTurns`. Open a result with `readChatTurns`.", "properties": {} }, "ChatState": { diff --git a/schema/state.schema.json b/schema/state.schema.json index d8ba5d9ab..7317babd1 100644 --- a/schema/state.schema.json +++ b/schema/state.schema.json @@ -2519,6 +2519,16 @@ "ChatHistoryBrowsingCapability": { "type": "object", "description": "Presence advertises `listChatTurns` and `readChatTurns` for this chat.", + "properties": { + "search": { + "$ref": "#/$defs/ChatHistorySearchCapability", + "description": "Presence advertises host-side search; omit for browsing-only chats." + } + } + }, + "ChatHistorySearchCapability": { + "type": "object", + "description": "Presence advertises `searchChatTurns`. Open a result with `readChatTurns`.", "properties": {} }, "ChatState": { diff --git a/scripts/generate-csharp.ts b/scripts/generate-csharp.ts index c86653665..ebfe6ca20 100644 --- a/scripts/generate-csharp.ts +++ b/scripts/generate-csharp.ts @@ -794,6 +794,7 @@ const STATE_STRUCTS: { name: string; omitDiscriminants?: boolean; csName?: strin { name: 'AgentCapabilities' }, { name: 'MultipleChatsCapability' }, { name: 'ChatHistoryBrowsingCapability' }, + { name: 'ChatHistorySearchCapability' }, { name: 'MultipleWorkingDirectoriesCapability' }, { name: 'SessionModelInfo' }, { name: 'ModelSelection' }, @@ -2329,7 +2330,7 @@ function generateActionsFile(project: Project): string { // ─── Commands File Generator ───────────────────────────────────────────────── -const COMMAND_ENUMS = ['ReconnectResultType', 'ChatSourceKind', 'ChatMoveDestinationKind', 'ChatTurnReadDirection', 'PathStyle', 'ContentEncoding', 'CompletionItemKind', 'ResourceType', 'ResourceWriteMode', 'AuthenticateTargetKind']; +const COMMAND_ENUMS = ['ReconnectResultType', 'ChatSourceKind', 'ChatMoveDestinationKind', 'ChatTurnReadDirection', 'ChatTurnMatchKind', 'PathStyle', 'ContentEncoding', 'CompletionItemKind', 'ResourceType', 'ResourceWriteMode', 'AuthenticateTargetKind']; const COMMAND_STRUCTS: { name: string; omitDiscriminants?: boolean; csName?: string }[] = [ { name: 'CreateTcpConnectionParams' }, { name: 'CreateTcpConnectionResult' }, @@ -2383,6 +2384,7 @@ const COMMAND_STRUCTS: { name: string; omitDiscriminants?: boolean; csName?: str { name: 'FetchTurnsParams' }, { name: 'FetchTurnsResult' }, { name: 'ChatTurnIndexEntry' }, { name: 'ListChatTurnsParams' }, { name: 'ListChatTurnsResult' }, { name: 'ReadChatTurnsParams' }, { name: 'ReadChatTurnsResult' }, + { name: 'ChatTurnMatch' }, { name: 'SearchChatTurnsParams' }, { name: 'SearchChatTurnsResult' }, { name: 'UnsubscribeParams' }, { name: 'DispatchActionParams' }, { name: 'McpServerAuthenticateTarget' }, { name: 'AuthenticateParams' }, { name: 'AuthenticateResult' }, diff --git a/scripts/generate-go.ts b/scripts/generate-go.ts index 271e4df25..71ebb0720 100644 --- a/scripts/generate-go.ts +++ b/scripts/generate-go.ts @@ -777,6 +777,7 @@ const STATE_STRUCTS: { name: string; omitDiscriminants?: boolean; goName?: strin { name: 'AgentCapabilities' }, { name: 'MultipleChatsCapability' }, { name: 'ChatHistoryBrowsingCapability' }, + { name: 'ChatHistorySearchCapability' }, { name: 'MultipleWorkingDirectoriesCapability' }, { name: 'SessionModelInfo' }, { name: 'ModelSelection' }, @@ -1841,7 +1842,7 @@ function generateActionsFile(project: Project): string { // ─── Commands File Generator ───────────────────────────────────────────────── -const COMMAND_ENUMS = ['ReconnectResultType', 'ChatSourceKind', 'ChatMoveDestinationKind', 'ChatTurnReadDirection', 'PathStyle', 'ContentEncoding', 'CompletionItemKind', 'ResourceType', 'ResourceWriteMode', 'AuthenticateTargetKind']; +const COMMAND_ENUMS = ['ReconnectResultType', 'ChatSourceKind', 'ChatMoveDestinationKind', 'ChatTurnReadDirection', 'ChatTurnMatchKind', 'PathStyle', 'ContentEncoding', 'CompletionItemKind', 'ResourceType', 'ResourceWriteMode', 'AuthenticateTargetKind']; const COMMAND_STRUCTS: { name: string; omitDiscriminants?: boolean; goName?: string }[] = [ { name: 'CreateTcpConnectionParams' }, { name: 'CreateTcpConnectionResult' }, @@ -1882,6 +1883,7 @@ const COMMAND_STRUCTS: { name: string; omitDiscriminants?: boolean; goName?: str { name: 'FetchTurnsParams' }, { name: 'FetchTurnsResult' }, { name: 'ChatTurnIndexEntry' }, { name: 'ListChatTurnsParams' }, { name: 'ListChatTurnsResult' }, { name: 'ReadChatTurnsParams' }, { name: 'ReadChatTurnsResult' }, + { name: 'ChatTurnMatch' }, { name: 'SearchChatTurnsParams' }, { name: 'SearchChatTurnsResult' }, { name: 'UnsubscribeParams' }, { name: 'DispatchActionParams' }, { name: 'McpServerAuthenticateTarget' }, { name: 'AuthenticateParams' }, { name: 'AuthenticateResult' }, diff --git a/scripts/generate-json-schema.test.ts b/scripts/generate-json-schema.test.ts index f1d210c6a..6687818fc 100644 --- a/scripts/generate-json-schema.test.ts +++ b/scripts/generate-json-schema.test.ts @@ -644,6 +644,26 @@ describe('generated JSON schemas', () => { assert.ok(!(defs.ChatState.required as string[]).includes('historyBrowsing')); }); + it('keeps chat history search optional and its match locators addressable', () => { + if (file !== 'commands.schema.json') { + return; + } + const defs = schema.$defs as Record; + const cap = defs.ChatHistoryBrowsingCapability; + assert.ok(schemaAccepts(schema, cap, {})); + assert.ok(schemaAccepts(schema, cap, { search: {} })); + assert.ok(!schemaAccepts(schema, cap, { search: true })); + + const params = { channel: 'ahp-chat:/c1', query: 'map' }; + assert.ok(schemaAccepts(schema, defs.SearchChatTurnsParams, params)); + for (const invalid of [{ query: '' }, { limit: 0 }, { limit: 1.5 }]) { + assert.ok(!schemaAccepts(schema, defs.SearchChatTurnsParams, { ...params, ...invalid })); + } + for (const invalid of [{ kind: 'reasoning', occurrence: 0 }, { kind: 'response', occurrence: -1 }]) { + assert.ok(!schemaAccepts(schema, defs.SearchChatTurnsResult, { items: [{ turnId: 't1', ...invalid }] })); + } + }); + it('constrains stable chat move destinations and results', () => { if (file !== 'commands.schema.json') { return; diff --git a/scripts/generate-kotlin.ts b/scripts/generate-kotlin.ts index 2680cbf2f..ae2d60ed8 100644 --- a/scripts/generate-kotlin.ts +++ b/scripts/generate-kotlin.ts @@ -1028,6 +1028,7 @@ const STATE_STRUCTS = [ 'AgentCapabilities', 'MultipleChatsCapability', 'ChatHistoryBrowsingCapability', + 'ChatHistorySearchCapability', 'MultipleWorkingDirectoriesCapability', 'SessionModelInfo', 'ModelSelection', 'AgentSelection', 'ConfigPropertySchema', 'ConfigSchema', 'PendingMessage', 'ChatState', 'ChatSummary', 'SideChatSelection', 'SessionState', 'SessionActiveClient', @@ -1819,7 +1820,7 @@ function generateActionsFile(project: Project): string { // ─── Commands File Generator ───────────────────────────────────────────────── -const COMMAND_ENUMS = ['ReconnectResultType', 'ChatSourceKind', 'ChatMoveDestinationKind', 'ChatTurnReadDirection', 'PathStyle', 'ContentEncoding', 'CompletionItemKind', 'ResourceType', 'ResourceWriteMode', 'AuthenticateTargetKind']; +const COMMAND_ENUMS = ['ReconnectResultType', 'ChatSourceKind', 'ChatMoveDestinationKind', 'ChatTurnReadDirection', 'ChatTurnMatchKind', 'PathStyle', 'ContentEncoding', 'CompletionItemKind', 'ResourceType', 'ResourceWriteMode', 'AuthenticateTargetKind']; const COMMAND_STRUCTS = [ 'CreateTcpConnectionParams', 'CreateTcpConnectionResult', @@ -1856,6 +1857,7 @@ const COMMAND_STRUCTS = [ 'FetchTurnsParams', 'FetchTurnsResult', 'ChatTurnIndexEntry', 'ListChatTurnsParams', 'ListChatTurnsResult', 'ReadChatTurnsParams', 'ReadChatTurnsResult', + 'ChatTurnMatch', 'SearchChatTurnsParams', 'SearchChatTurnsResult', 'UnsubscribeParams', 'DispatchActionParams', 'McpServerAuthenticateTarget', 'AuthenticateParams', 'AuthenticateResult', @@ -2396,6 +2398,9 @@ object AhpCommands { fun readChatTurns(id: Long, params: ReadChatTurnsParams): JsonRpcRequest = JsonRpcRequest(id = id, method = "readChatTurns", params = params) + fun searchChatTurns(id: Long, params: SearchChatTurnsParams): JsonRpcRequest = + JsonRpcRequest(id = id, method = "searchChatTurns", params = params) + fun authenticate(id: Long, params: AuthenticateParams): JsonRpcRequest = JsonRpcRequest(id = id, method = "authenticate", params = params) diff --git a/scripts/generate-rust.ts b/scripts/generate-rust.ts index 6bffd79e2..438a3563e 100644 --- a/scripts/generate-rust.ts +++ b/scripts/generate-rust.ts @@ -879,6 +879,7 @@ const STATE_STRUCTS: { name: string; omitDiscriminants?: boolean; rustName?: str { name: 'AgentCapabilities' }, { name: 'MultipleChatsCapability' }, { name: 'ChatHistoryBrowsingCapability' }, + { name: 'ChatHistorySearchCapability' }, { name: 'MultipleWorkingDirectoriesCapability' }, { name: 'SessionModelInfo' }, { name: 'ModelSelection' }, @@ -1913,7 +1914,7 @@ pub struct ActionEnvelope { // ─── Commands File Generator ───────────────────────────────────────────────── -const COMMAND_ENUMS = ['ReconnectResultType', 'ChatSourceKind', 'ChatMoveDestinationKind', 'ChatTurnReadDirection', 'PathStyle', 'ContentEncoding', 'CompletionItemKind', 'ResourceType', 'ResourceWriteMode', 'AuthenticateTargetKind']; +const COMMAND_ENUMS = ['ReconnectResultType', 'ChatSourceKind', 'ChatMoveDestinationKind', 'ChatTurnReadDirection', 'ChatTurnMatchKind', 'PathStyle', 'ContentEncoding', 'CompletionItemKind', 'ResourceType', 'ResourceWriteMode', 'AuthenticateTargetKind']; const COMMAND_STRUCTS: { name: string; omitDiscriminants?: boolean; rustName?: string }[] = [ { name: 'CreateTcpConnectionParams' }, { name: 'CreateTcpConnectionResult' }, @@ -1956,6 +1957,7 @@ const COMMAND_STRUCTS: { name: string; omitDiscriminants?: boolean; rustName?: s { name: 'FetchTurnsParams' }, { name: 'FetchTurnsResult' }, { name: 'ChatTurnIndexEntry' }, { name: 'ListChatTurnsParams' }, { name: 'ListChatTurnsResult' }, { name: 'ReadChatTurnsParams' }, { name: 'ReadChatTurnsResult' }, + { name: 'ChatTurnMatch' }, { name: 'SearchChatTurnsParams' }, { name: 'SearchChatTurnsResult' }, { name: 'UnsubscribeParams' }, { name: 'DispatchActionParams' }, { name: 'McpServerAuthenticateTarget', omitDiscriminants: true }, { name: 'AuthenticateParams' }, { name: 'AuthenticateResult' }, diff --git a/scripts/generate-swift.ts b/scripts/generate-swift.ts index 21af58a16..4f626b57c 100644 --- a/scripts/generate-swift.ts +++ b/scripts/generate-swift.ts @@ -751,6 +751,7 @@ const STATE_STRUCTS = [ 'AgentCapabilities', 'MultipleChatsCapability', 'ChatHistoryBrowsingCapability', + 'ChatHistorySearchCapability', 'MultipleWorkingDirectoriesCapability', 'SessionModelInfo', 'ModelSelection', 'AgentSelection', 'ConfigPropertySchema', 'ConfigSchema', 'PendingMessage', 'ChatState', 'ChatSummary', 'SideChatSelection', 'SessionState', 'SessionActiveClient', @@ -1767,7 +1768,7 @@ public func isClientDispatchable(_ action: StateAction) -> Bool { // ─── Commands File Generator ───────────────────────────────────────────────── -const COMMAND_ENUMS = ['ReconnectResultType', 'ChatSourceKind', 'ChatMoveDestinationKind', 'ChatTurnReadDirection', 'PathStyle', 'ContentEncoding', 'CompletionItemKind', 'ResourceType', 'ResourceWriteMode', 'AuthenticateTargetKind']; +const COMMAND_ENUMS = ['ReconnectResultType', 'ChatSourceKind', 'ChatMoveDestinationKind', 'ChatTurnReadDirection', 'ChatTurnMatchKind', 'PathStyle', 'ContentEncoding', 'CompletionItemKind', 'ResourceType', 'ResourceWriteMode', 'AuthenticateTargetKind']; const COMMAND_STRUCTS = [ 'CreateTcpConnectionParams', 'CreateTcpConnectionResult', @@ -1803,6 +1804,7 @@ const COMMAND_STRUCTS = [ 'FetchTurnsParams', 'FetchTurnsResult', 'ChatTurnIndexEntry', 'ListChatTurnsParams', 'ListChatTurnsResult', 'ReadChatTurnsParams', 'ReadChatTurnsResult', + 'ChatTurnMatch', 'SearchChatTurnsParams', 'SearchChatTurnsResult', 'UnsubscribeParams', 'DispatchActionParams', 'McpServerAuthenticateTarget', 'AuthenticateParams', 'AuthenticateResult', @@ -2390,6 +2392,10 @@ public enum AHPCommands { JsonRpcRequest(id: id, method: "readChatTurns", params: params) } + public static func searchChatTurns(id: Int, params: SearchChatTurnsParams) -> JsonRpcRequest { + JsonRpcRequest(id: id, method: "searchChatTurns", params: params) + } + public static func authenticate(id: Int, params: AuthenticateParams) -> JsonRpcRequest { JsonRpcRequest(id: id, method: "authenticate", params: params) } diff --git a/types/channels-chat/commands.ts b/types/channels-chat/commands.ts index ef4c204b8..d70019f51 100644 --- a/types/channels-chat/commands.ts +++ b/types/channels-chat/commands.ts @@ -355,3 +355,72 @@ export interface ReadChatTurnsResult { /** Whether retained completed turns follow this window. */ hasAfter: boolean; } + +/** + * The searchable side of a completed turn. + * @exhaustive + */ +export const enum ChatTurnMatchKind { + Request = 'request', + Response = 'response', +} + +/** A match locator, not a snippet, text offset, or response-part identifier. */ +export interface ChatTurnMatch { + turnId: string; + kind: ChatTurnMatchKind; + /** + * Zero-based index of this nonempty match in forward text order on this + * side of the turn, for the same query and flags. + * @integer + * @minimum 0 + */ + occurrence: number; +} + +/** + * Searches visible request and response text in retained completed turns. + * Returns match locators newest first, independently of the subscription. + * Requires `ChatState.historyBrowsing.search`. + * + * @see {@link /specification/chat-channel#search-visible-text | Search visible text} + * @category Commands + * @method searchChatTurns + * @direction Client → Server + * @messageType Request + * @version 1 + */ +export interface SearchChatTurnsParams extends BaseParams, PaginatedParams { + /** Chat URI. */ + channel: URI; + /** + * Nonempty literal text, or a pattern when `isRegex` is true. + * @minLength 1 + */ + query: string; + /** Case-sensitive matching; defaults to false. */ + matchCase?: boolean; + /** Require whole-word matches; defaults to false. */ + wholeWord?: boolean; + /** Treat the query as a regular expression; defaults to false. */ + isRegex?: boolean; + /** Opaque cursor for the same chat, query and effective flags; omit to start at the newest turn. */ + cursor?: string; + /** + * Maximum matches in the page; defaults to 100. The host may return fewer. + * @integer + * @minimum 1 + */ + limit?: number; +} + +/** One page of match locators, which may end within a turn or side. */ +export interface SearchChatTurnsResult extends PaginatedResult { + /** Match locators in reverse transcript order. */ + items: ChatTurnMatch[]; + /** + * Resume after the last result or scanned position. A bounded scan may + * return no matches with an advancing cursor; only absence means done. + */ + nextCursor?: string; +} diff --git a/types/channels-chat/state.ts b/types/channels-chat/state.ts index f6483bd08..6ce572f3a 100644 --- a/types/channels-chat/state.ts +++ b/types/channels-chat/state.ts @@ -32,7 +32,13 @@ import type { // ─── Chat State ────────────────────────────────────────────────────────────── /** Presence advertises `listChatTurns` and `readChatTurns` for this chat. */ -export interface ChatHistoryBrowsingCapability {} +export interface ChatHistoryBrowsingCapability { + /** Presence advertises host-side search; omit for browsing-only chats. */ + search?: ChatHistorySearchCapability; +} + +/** Presence advertises `searchChatTurns`. Open a result with `readChatTurns`. */ +export interface ChatHistorySearchCapability {} /** * Full state for a single chat, loaded when a client subscribes to the chat's diff --git a/types/common/messages.ts b/types/common/messages.ts index 1329a7c03..fc25b95b3 100644 --- a/types/common/messages.ts +++ b/types/common/messages.ts @@ -63,6 +63,8 @@ import type { ListChatTurnsResult, ReadChatTurnsParams, ReadChatTurnsResult, + SearchChatTurnsParams, + SearchChatTurnsResult, } from '../channels-chat/commands.js'; import type { CreateTerminalParams, @@ -180,6 +182,7 @@ export interface CommandMap { 'disposeChat': { params: DisposeChatParams; result: null }; 'listChatTurns': { params: ListChatTurnsParams; result: ListChatTurnsResult }; 'readChatTurns': { params: ReadChatTurnsParams; result: ReadChatTurnsResult }; + 'searchChatTurns': { params: SearchChatTurnsParams; result: SearchChatTurnsResult }; 'createTerminal': { params: CreateTerminalParams; result: null }; 'disposeTerminal': { params: DisposeTerminalParams; result: null }; 'createResourceWatch': { params: CreateResourceWatchParams; result: CreateResourceWatchResult }; diff --git a/types/test-cases/round-trips/105-search-chat-turns-params.json b/types/test-cases/round-trips/105-search-chat-turns-params.json new file mode 100644 index 000000000..0f758991b --- /dev/null +++ b/types/test-cases/round-trips/105-search-chat-turns-params.json @@ -0,0 +1,8 @@ +{ + "name": "search-chat-turns-params", + "group": "A", + "description": "A search page retains its query and all search modifiers.", + "type": "SearchChatTurnsParams", + "input": { "channel": "ahp-chat:/c1", "query": "des[i]gn", "matchCase": false, "wholeWord": true, "isRegex": true, "cursor": "matches", "limit": 3 }, + "acceptableOutputs": [{ "channel": "ahp-chat:/c1", "query": "des[i]gn", "matchCase": false, "wholeWord": true, "isRegex": true, "cursor": "matches", "limit": 3 }] +} diff --git a/types/test-cases/round-trips/106-search-chat-turns-result.json b/types/test-cases/round-trips/106-search-chat-turns-result.json new file mode 100644 index 000000000..e257446da --- /dev/null +++ b/types/test-cases/round-trips/106-search-chat-turns-result.json @@ -0,0 +1,8 @@ +{ + "name": "search-chat-turns-result", + "group": "A", + "description": "Repeated matches are located per side in forward text, but delivered in reverse; a final page omits nextCursor.", + "type": "SearchChatTurnsResult", + "input": { "items": [{ "turnId": "t1", "kind": "response", "occurrence": 1 }, { "turnId": "t1", "kind": "response", "occurrence": 0 }, { "turnId": "t1", "kind": "request", "occurrence": 0 }] }, + "acceptableOutputs": [{ "items": [{ "turnId": "t1", "kind": "response", "occurrence": 1 }, { "turnId": "t1", "kind": "response", "occurrence": 0 }, { "turnId": "t1", "kind": "request", "occurrence": 0 }] }] +} diff --git a/types/test-cases/round-trips/107-chat-history-search-snapshot.json b/types/test-cases/round-trips/107-chat-history-search-snapshot.json new file mode 100644 index 000000000..19a35dc71 --- /dev/null +++ b/types/test-cases/round-trips/107-chat-history-search-snapshot.json @@ -0,0 +1,16 @@ +{ + "name": "chat-history-search-snapshot", + "group": "A", + "description": "A chat can advertise host-side search alongside the browsing commands that reveal a match.", + "type": "Snapshot", + "input": { + "resource": "ahp-chat:/c1", + "fromSeq": 10, + "state": { "resource": "ahp-chat:/c1", "title": "Design", "status": 1, "modifiedAt": "2026-11-18T12:00:00Z", "turns": [], "historyBrowsing": { "search": {} } } + }, + "acceptableOutputs": [{ + "resource": "ahp-chat:/c1", + "fromSeq": 10, + "state": { "resource": "ahp-chat:/c1", "title": "Design", "status": 1, "modifiedAt": "2026-11-18T12:00:00Z", "turns": [], "historyBrowsing": { "search": {} } } + }] +} diff --git a/types/test-cases/round-trips/108-search-chat-turns-continuation.json b/types/test-cases/round-trips/108-search-chat-turns-continuation.json new file mode 100644 index 000000000..ed24cbca7 --- /dev/null +++ b/types/test-cases/round-trips/108-search-chat-turns-continuation.json @@ -0,0 +1,8 @@ +{ + "name": "search-chat-turns-continuation", + "group": "A", + "description": "A scan budget can run out before a match: an empty page with a continuation is not the final result.", + "type": "SearchChatTurnsResult", + "input": { "items": [], "nextCursor": "scanned-to-t45" }, + "acceptableOutputs": [{ "items": [], "nextCursor": "scanned-to-t45" }] +} diff --git a/types/version/message-checks.ts b/types/version/message-checks.ts index f2c678455..00ce1d27c 100644 --- a/types/version/message-checks.ts +++ b/types/version/message-checks.ts @@ -62,6 +62,7 @@ type _ExpectedCommands = | 'disposeChat' | 'listChatTurns' | 'readChatTurns' + | 'searchChatTurns' | 'createTerminal' | 'disposeTerminal' | 'createResourceWatch'