Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(runtime): persist hosted search blocks for restart replay
vastsa003bc0aebfa2
diff --git a/apps/desktop/src/components/settings/ModelSelectionPanes.tsx b/apps/desktop/src/components/settings/ModelSelectionPanes.tsxindex 78e88a77d..2c18661c2 100644--- a/apps/desktop/src/components/settings/ModelSelectionPanes.tsx+++ b/apps/desktop/src/components/settings/ModelSelectionPanes.tsx@@ -16,6 +16,7 @@ import {bindingFromModelInfo,formatTokenCount,modelMatchesFilter,+ nativeWebSearchSupportedOn,publishedThinkingLevels,sortThinkingLevels,type ModelBinding,@@ -252,11 +253,10 @@ export function ModelSelectionPanes({if (models.length === 0) setChosenQuery("");}, [models.length]);- // The hosted web search tool only exists on two wire APIs; on any other+ // The hosted web search tool only exists on two wires; on any other// style the opt-in cannot work, so the checkbox stays present but disabled// with an explanatory hint instead of silently doing nothing.- const nativeWebSearchWireCapable =- apiStyle === "responses" || apiStyle === "anthropic_messages";+ const nativeWebSearchWireCapable = nativeWebSearchSupportedOn(apiStyle);/*** The chosen list narrows with the discovered list's rule plus the binding'sdiff --git a/crates/host-core/src/sessions.rs b/crates/host-core/src/sessions.rsindex a5b869186..22f73d3d2 100644--- a/crates/host-core/src/sessions.rs+++ b/crates/host-core/src/sessions.rs@@ -4498,6 +4498,15 @@ mod tests {{ "url": "https://example.com/a", "title": "A" }]}+ ],+ "replay": [+ {+ "type": "hostedSearch",+ "phase": "server_tool_use",+ "blockId": "srvtoolu_01",+ "name": "web_search",+ "input": { "query": "pi-desktop release notes" }+ }]})),session_message: None,@@ -4521,6 +4530,15 @@ mod tests {{ "url": "https://example.com/a", "title": "A" }]}+ ],+ "replay": [+ {+ "type": "hostedSearch",+ "phase": "server_tool_use",+ "blockId": "srvtoolu_01",+ "name": "web_search",+ "input": { "query": "pi-desktop release notes" }+ }]}));@@ -4539,6 +4557,15 @@ mod tests {{ "url": "https://example.com/a", "title": "A" }]}+ ],+ "replay": [+ {+ "type": "hostedSearch",+ "phase": "server_tool_use",+ "blockId": "srvtoolu_01",+ "name": "web_search",+ "input": { "query": "pi-desktop release notes" }+ }]})));diff --git a/docs/adr/0296-provider-hosted-web-search-adapter-capability.md b/docs/adr/0296-provider-hosted-web-search-adapter-capability.mdindex ba56066d0..15a21fc98 100644--- a/docs/adr/0296-provider-hosted-web-search-adapter-capability.md+++ b/docs/adr/0296-provider-hosted-web-search-adapter-capability.md@@ -69,15 +69,16 @@ Two upstream facts forced the design:the pi-ai `Model`, so no new IPC, sidecar parameter, or runtime rebuildhook is needed.-4. **Display data and replay data are separated.** The runtime normalizes- `hostedSearch` blocks into `UiMessage.hostedSearch`- (`status/rounds[]`, one round per provider search/open-page/find-in-page- call, shape-checked, junk ignored) for the activity rows; the raw wire blocks stay inside- pi-ai's message content for replay. Persistence is an additive+4. **Display data and replay data are separated, and both persist.** The+ runtime normalizes `hostedSearch` blocks into `UiMessage.hostedSearch`+ (`status/rounds[]` for activity rows; `replay[]` for the adapter's raw+ content parts, stripped of streaming scratch). Persistence is an additive`hostedSearch` transcript block (`ui_to_record` / `record_to_ui`) — no SQL- migration, per the storage playbook. The wire-slimming functions- (`streamingMessageIdentity`, `applyMessageUpdate`) carry the field so- delta frames cannot drop it.+ migration. `historyToEntries` restores `replay` after thinking and before+ text so convertMessages can ground later turns after a restart. Transcripts+ written without `replay` still render; they just cannot ground. The+ wire-slimming functions (`streamingMessageIdentity`, `applyMessageUpdate`)+ carry the field so delta frames cannot drop it.5. **UI is a transcript activity row per round, not a composer control.**Each round of a `hostedSearch` activity renders as a `HostedSearchRow` on@@ -103,3 +104,6 @@ Two upstream facts forced the design:limitation to revisit with the upstream patch.- Compaction rewrites history and drops search blocks; later turns lose oldgrounding and the model searches again as needed. Documented behavior.+- Search executes on the provider. There is no local fetch, no ask/allow+ prompt, and billing is the provider's. The model-level opt-in (default+ off) is the user consent surface.diff --git a/docs/spec/03-runtime/04-data-storage.md b/docs/spec/03-runtime/04-data-storage.mdindex 72081c12f..2b93813ff 100644--- a/docs/spec/03-runtime/04-data-storage.md+++ b/docs/spec/03-runtime/04-data-storage.md@@ -756,7 +756,10 @@ type Block =status: "searching" | "completed" | "failed";kind?: "search" | "openPage" | "findInPage";query?: string; url?: string;- sources: Array<{ url: string; title?: string }> }> };+ sources: Array<{ url: string; title?: string }> }>;+ replay?: Array<{ type: "hostedSearch"; phase: string;+ blockId?: string; name?: string; input?: unknown;+ status?: string; isError?: boolean; wire?: unknown }> };```- Tool results are stored **post-truncation** (16-tool-result-limits); fulldiff --git a/docs/spec/03-runtime/11-provider-model-system.md b/docs/spec/03-runtime/11-provider-model-system.mdindex e116d5264..cf2710692 100644--- a/docs/spec/03-runtime/11-provider-model-system.md+++ b/docs/spec/03-runtime/11-provider-model-system.md@@ -226,13 +226,17 @@ PI-Desktop must not permanently restrict users to a short fixed model list.explanatory copy is required.10a. `nativeWebSearch` is a two-state opt-in (absent means off; there is nocatalog baseline because models.dev publishes no hosted-tool capability).- When enabled and the provider's resolved wire API is- `anthropic_messages` or `responses`, the adapter attaches the provider's+ When enabled and the model's resolved wire API is `anthropic-messages`,+ `openai-responses`, or `azure-openai-responses` (stored apiStyle+ `anthropic_messages` / `responses`), the adapter attaches the provider'shosted web search tool (`web_search_20250305` / `web_search`), extracts- the search activity into `UiMessage.hostedSearch`, and replays the raw- search blocks on later turns (ADR 0296). The checkbox is disabled when- the provider's API style is neither of those two. Gateways that do not- support the tool surface the provider error; the remedy is unchecking.+ the search activity into `UiMessage.hostedSearch` (`rounds` for display,+ `replay` for convertMessages), and restores those raw blocks on later+ turns including after a restart (ADR 0296). The checkbox is disabled+ when the provider's API style is neither of those two. Gateways that do+ not support the tool surface the provider error; the remedy is unchecking.+ Search runs on the provider: there is no local fetch and no permission+ prompt. Compaction still drops search blocks.11. `ModelInfo` is the published record the settings surface compares against,so a stored binding must not shape its capabilities or reasoning fields.Effective limits, reasoning and thinking levels are resolved through thediff --git a/docs/zh-CN/spec/03-runtime/04-data-storage.md b/docs/zh-CN/spec/03-runtime/04-data-storage.mdindex e16c6932b..7854d8553 100644--- a/docs/zh-CN/spec/03-runtime/04-data-storage.md+++ b/docs/zh-CN/spec/03-runtime/04-data-storage.md@@ -680,7 +680,10 @@ type Block =status: "searching" | "completed" | "failed";kind?: "search" | "openPage" | "findInPage";query?: string; url?: string;- sources: Array<{ url: string; title?: string }> }> };+ sources: Array<{ url: string; title?: string }> }>;+ replay?: Array<{ type: "hostedSearch"; phase: string;+ blockId?: string; name?: string; input?: unknown;+ status?: string; isError?: boolean; wire?: unknown }> };```- 工具结果存储**截断后**(16 个工具结果限制);满diff --git a/docs/zh-CN/spec/03-runtime/11-provider-model-system.md b/docs/zh-CN/spec/03-runtime/11-provider-model-system.mdindex 591d0ab66..78b4948b6 100644--- a/docs/zh-CN/spec/03-runtime/11-provider-model-system.md+++ b/docs/zh-CN/spec/03-runtime/11-provider-model-system.md@@ -202,12 +202,15 @@ PI-Desktop 不得把用户永久限制在一份简短的固定模型列表上。值,存下来的是"跟随目录",而不是一个取值相同的覆盖。因此与 models.dev保持一致本身就是重置,不需要另外的重置控件,也不需要逐项能力的解释文案。10a. `nativeWebSearch` 是两态的主动开启(缺省即关闭;没有目录基线,因为- models.dev 不发布托管工具能力)。启用且提供商解析后的线路 API 是- `anthropic_messages` 或 `responses` 时,适配器会附加提供商托管的联网- 搜索工具(`web_search_20250305` / `web_search`),把搜索活动提取为- `UiMessage.hostedSearch`,并在后续回合回放原始搜索块(ADR 0296)。- 提供商接口风格不属于这两种时复选框禁用。不支持该工具的网关会把- 提供商错误暴露出来;处理方式是取消勾选。+ models.dev 不发布托管工具能力)。启用且模型解析后的线路 API 是+ `anthropic-messages`、`openai-responses` 或 `azure-openai-responses`+ (存储的 apiStyle 为 `anthropic_messages` / `responses`)时,适配器会+ 附加提供商托管的联网搜索工具(`web_search_20250305` / `web_search`),+ 把搜索活动提取为 `UiMessage.hostedSearch`(`rounds` 用于展示,`replay`+ 用于 convertMessages),并在后续回合——包括重启之后——回放这些原始+ 搜索块(ADR 0296)。提供商接口风格不属于这两种时复选框禁用。不支持+ 该工具的网关会把提供商错误暴露出来;处理方式是取消勾选。搜索在提供商+ 侧执行:没有本地抓取,也没有权限询问。压缩仍会丢掉搜索块。11. `ModelInfo` 是设置界面用来对照的已发布记录,因此已存储的 binding 不得塑造它的能力或推理字段。有效上限、推理与思考级别都通过那个确切的 binding解析;有效的传输模态数组还会额外套用显式的附件覆盖。diff --git a/packages/agent-runtime/src/runtime.test.ts b/packages/agent-runtime/src/runtime.test.tsindex 6ef74f4c7..fae90e337 100644--- a/packages/agent-runtime/src/runtime.test.ts+++ b/packages/agent-runtime/src/runtime.test.ts@@ -8288,7 +8288,78 @@ describe("DesktopAgentRuntime hosted web search rounds (ADR 0296)", () => {},{ id: "ws_2", status: "completed", query: "second query", sources: [] },],+ replay: [+ round("ws_1", "completed", "first query", [+ { url: "https://example.com/a", title: "A" },+ ]),+ round("ws_2", "in_progress", "second query"),+ ],});await runtime.dispose();});++ it("replays persisted hostedSearch blocks into model context on restore", async () => {+ const restored = createRuntime({+ history: [+ {+ id: "u1",+ role: "user",+ content: "news?",+ status: "complete",+ createdAt: "2026-09-19T00:00:00.000Z",+ },+ {+ id: "a1",+ role: "assistant",+ content: "here is the news",+ status: "complete",+ createdAt: "2026-09-19T00:00:01.000Z",+ hostedSearch: {+ status: "completed",+ rounds: [+ { id: "srvtoolu_01", status: "completed", query: "news", sources: [] },+ ],+ replay: [+ {+ type: "hostedSearch",+ phase: "server_tool_use",+ blockId: "srvtoolu_01",+ name: "web_search",+ input: { query: "news" },+ },+ {+ type: "hostedSearch",+ phase: "web_search_tool_result",+ blockId: "srvtoolu_01",+ wire: {+ type: "web_search_tool_result",+ encrypted_content: "enc-1",+ },+ },+ ],+ },+ },+ ],+ });+ const assistant = (restored as unknown as { agent: Agent }).agent.state.messages.find(+ (message) => message.role === "assistant",+ ) as { content: unknown[] } | undefined;+ expect(assistant?.content).toEqual([+ {+ type: "hostedSearch",+ phase: "server_tool_use",+ blockId: "srvtoolu_01",+ name: "web_search",+ input: { query: "news" },+ },+ {+ type: "hostedSearch",+ phase: "web_search_tool_result",+ blockId: "srvtoolu_01",+ wire: { type: "web_search_tool_result", encrypted_content: "enc-1" },+ },+ { type: "text", text: "here is the news" },+ ]);+ await restored.dispose();+ });});diff --git a/packages/agent-runtime/src/runtime.ts b/packages/agent-runtime/src/runtime.tsindex f2047c389..572831bf8 100644--- a/packages/agent-runtime/src/runtime.ts+++ b/packages/agent-runtime/src/runtime.ts@@ -96,7 +96,7 @@ import {DEFAULT_SUBAGENT_PERMISSION,formatAskToolOutput,formatSessionMessage,- hostedSearchFromBlocks,+ hostedSearchFromMessage,isCommandShellOption,isToolsOutputParams,MAX_SUBAGENT_CONCURRENCY,@@ -2474,13 +2474,13 @@ Delegation rules:}/* Rebuild pi-ai messages from the persisted transcript, including tool- * call/result pairs — tool rows persist toolCallId/toolName/toolArgs and- * the result (including deferred-tool activation markers), which is- * everything the model context needs. Losing them- * (the pre-D120 behavior) collapsed a reseeded session to bare chat text:- * the model forgot every file it had read and, seeing its own history- * "answer" without visible tool use, stopped calling tools altogether.- * Failed assistant turns stay transcript-only. */+ * call/result pairs and hosted-search replay blocks. Tool rows persist+ * toolCallId/toolName/toolArgs and the result (including deferred-tool+ * activation markers). Hosted search persists the adapter's raw content+ * parts on `hostedSearch.replay` so Anthropic/Responses can ground later+ * turns after a restart. Losing either (the pre-D120 tool behavior)+ * collapsed a reseeded session to bare chat text. Failed assistant turns+ * stay transcript-only. */private historyToEntries(history: UiMessage[]): MessageEntry[] {const api = apiBindingForProviderModel(this.provider).api;const deepSeekCompletionsReplay =@@ -2550,6 +2550,15 @@ Delegation rules:: {}),});}+ const replay = m.hostedSearch?.replay;+ if (Array.isArray(replay)) {+ for (const block of replay) {+ if (!block || typeof block !== "object" || block.type !== "hostedSearch") {+ continue;+ }+ content.push(block as unknown as AssistantMessage["content"][number]);+ }+ }if (m.content?.trim()) {content.push({ type: "text" as const, text: m.content });}@@ -6610,7 +6619,7 @@ Delegation rules:content?: unknown;hostedSearchCitations?: unknown;};- const next = hostedSearchFromBlocks({+ const next = hostedSearchFromMessage({content: record?.content,citations: record?.hostedSearchCitations,});@@ -6815,7 +6824,7 @@ Delegation rules:);}const usage = usageFromPi((event.message as any).usage as Usage | undefined);- const hostedSearch = hostedSearchFromBlocks({+ const hostedSearch = hostedSearchFromMessage({content: (event.message as any).content,citations: (event.message as any).hostedSearchCitations,});diff --git a/packages/shared/src/model-config-import.ts b/packages/shared/src/model-config-import.tsindex a6561dcff..43655a1b9 100644--- a/packages/shared/src/model-config-import.ts+++ b/packages/shared/src/model-config-import.ts@@ -828,6 +828,9 @@ function bindingFromGenericModel(importedContextWindowSource(record?.contextWindowSource) ??(contextWindow === undefined ? base.contextWindowSource : "user"),maxTokens: maxTokens ?? base.maxTokens,+ ...(record?.nativeWebSearch === true || record?.native_web_search === true+ ? { nativeWebSearch: true }+ : {}),};}diff --git a/packages/shared/src/native-web-search.test.ts b/packages/shared/src/native-web-search.test.tsindex c918dc650..a3db453ad 100644--- a/packages/shared/src/native-web-search.test.ts+++ b/packages/shared/src/native-web-search.test.ts@@ -2,7 +2,10 @@ import { describe, expect, it } from "vitest";import {hostedSearchFromBlocks,+ hostedSearchFromMessage,+ hostedSearchReplayBlocks,hostedSearchRounds,+ nativeWebSearchSupportedOn,nativeWebSearchToolFor,resolveNativeWebSearch,} from "./native-web-search.js";@@ -463,3 +466,110 @@ describe("hostedSearchRounds", () => {).toEqual([]);});});++describe("nativeWebSearchSupportedOn", () => {+ it("accepts stored apiStyle and resolved wire spellings", () => {+ expect(nativeWebSearchSupportedOn("responses")).toBe(true);+ expect(nativeWebSearchSupportedOn("anthropic_messages")).toBe(true);+ expect(nativeWebSearchSupportedOn("openai-responses")).toBe(true);+ expect(nativeWebSearchSupportedOn("azure-openai-responses")).toBe(true);+ expect(nativeWebSearchSupportedOn("anthropic-messages")).toBe(true);+ });++ it("rejects wires without a hosted search tool", () => {+ expect(nativeWebSearchSupportedOn("chat_completions")).toBe(false);+ expect(nativeWebSearchSupportedOn("openai-completions")).toBe(false);+ expect(nativeWebSearchSupportedOn("openai_codex_responses")).toBe(false);+ expect(nativeWebSearchSupportedOn(undefined)).toBe(false);+ expect(nativeWebSearchSupportedOn("")).toBe(false);+ });+});++describe("hostedSearchReplayBlocks", () => {+ it("keeps wire payloads and drops streaming scratch", () => {+ expect(+ hostedSearchReplayBlocks([+ {+ type: "hostedSearch",+ phase: "server_tool_use",+ blockId: "srvtoolu_01",+ name: "web_search",+ input: { query: "pi-desktop" },+ index: 2,+ inputJson: "{\"query\":\"pi-desktop\"}",+ },+ {+ type: "hostedSearch",+ phase: "web_search_tool_result",+ blockId: "srvtoolu_01",+ wire: {+ type: "web_search_tool_result",+ encrypted_content: "enc-1",+ },+ },+ { type: "text", text: "answer" },+ ]),+ ).toEqual([+ {+ type: "hostedSearch",+ phase: "server_tool_use",+ blockId: "srvtoolu_01",+ name: "web_search",+ input: { query: "pi-desktop" },+ },+ {+ type: "hostedSearch",+ phase: "web_search_tool_result",+ blockId: "srvtoolu_01",+ wire: {+ type: "web_search_tool_result",+ encrypted_content: "enc-1",+ },+ },+ ]);+ });++ it("ignores junk and empty input", () => {+ expect(hostedSearchReplayBlocks(undefined)).toEqual([]);+ expect(hostedSearchReplayBlocks([{ type: "hostedSearch" }])).toEqual([]);+ expect(hostedSearchReplayBlocks("nope")).toEqual([]);+ });+});++describe("hostedSearchFromMessage", () => {+ it("attaches replay next to the display rounds", () => {+ const content = [+ {+ type: "hostedSearch",+ phase: "web_search_call",+ blockId: "ws_1",+ status: "completed",+ wire: {+ type: "web_search_call",+ id: "ws_1",+ status: "completed",+ action: { type: "search", query: "q" },+ },+ },+ ];+ const search = hostedSearchFromMessage({ content });+ expect(search?.rounds).toEqual([+ { id: "ws_1", status: "completed", query: "q", sources: [] },+ ]);+ expect(search?.replay).toEqual([+ {+ type: "hostedSearch",+ phase: "web_search_call",+ blockId: "ws_1",+ status: "completed",+ wire: {+ type: "web_search_call",+ id: "ws_1",+ status: "completed",+ action: { type: "search", query: "q" },+ },+ },+ ]);+ });+});+diff --git a/packages/shared/src/native-web-search.ts b/packages/shared/src/native-web-search.tsindex 53e9c53eb..a94b34482 100644--- a/packages/shared/src/native-web-search.ts+++ b/packages/shared/src/native-web-search.ts@@ -1,20 +1,14 @@/**- * Single evaluation point for the provider-hosted web search tool.+ * Evaluation helpers for the provider-hosted web search tool.*- * Every consumer — the request assembly in the pi-ai adapters, the runtime,- * and any UI gating — must resolve "does this request carry the hosted web- * search tool" through `resolveNativeWebSearch` and nothing else. Detection- * inputs are deliberately minimal:- *- * - `wireApi` is the RESOLVED wire API for the model (the result of- * `apiBindingForProviderModel`), never the provider's stored apiStyle: a- * model-level catalog pin can select a different wire than the provider- * row, and judging by the stored style produced UI/runtime disagreement- * before.- * - `modelWebSearch` is the `ModelConfig.webSearch` flag derived from the- * user's per-model binding opt-in. models.dev publishes no hosted-tool- * capability, so there is no catalog default: only an explicit user- * opt-in can enable the tool.+ * - `nativeWebSearchSupportedOn` gates the settings checkbox. It accepts+ * stored apiStyle (`responses`, `anthropic_messages`) and resolved wire+ * APIs (`openai-responses`, `anthropic-messages`, `azure-openai-responses`).+ * - `resolveNativeWebSearch` is the runtime decision: capable wire AND the+ * binding opt-in. Adapters then key on `model.webSearch`, which+ * `modelConfigWithBinding` copies from that opt-in.+ * - `hostedSearchFromMessage` is what the runtime persists: display rounds+ * plus raw `replay` blocks for convertMessages after a restart.** Vendor display names, base URL hostnames, and model id substrings are* intentionally not consulted. An endpoint either carries the tool on the@@ -65,6 +59,68 @@ export function nativeWebSearchToolFor(return undefined;}+const NATIVE_WEB_SEARCH_API_STYLES = new Set(["responses", "anthropic_messages"]);++/**+ * Whether a stored apiStyle or a resolved wire API can carry the hosted+ * search tool. Settings UI gates the checkbox with this; it accepts both+ * spellings because the pane sees `responses` / `anthropic_messages` while+ * the runtime sees `openai-responses` / `anthropic-messages`.+ */+export function nativeWebSearchSupportedOn(api: string | undefined): boolean {+ const value = (api ?? "").trim().toLowerCase();+ if (!value) return false;+ if (NATIVE_WEB_SEARCH_WIRE_APIS.has(value)) return true;+ if (NATIVE_WEB_SEARCH_API_STYLES.has(value)) return true;+ return NATIVE_WEB_SEARCH_WIRE_APIS.has(value.replace(/_/g, "-"));+}++/**+ * Capture the adapter's hostedSearch content parts for convertMessages+ * replay. Streaming scratch (`index`, `inputJson`) is dropped; unknown+ * shapes are ignored. Display normalization is `hostedSearchFromBlocks`.+ */+export function hostedSearchReplayBlocks(+ content: unknown,+): import("./types/messages.js").HostedSearchReplayBlock[] {+ if (!Array.isArray(content)) return [];+ const replay: import("./types/messages.js").HostedSearchReplayBlock[] = [];+ for (const part of content) {+ if (!part || typeof part !== "object") continue;+ const block = part as Record<string, unknown>;+ if (block.type !== "hostedSearch") continue;+ const phase = typeof block.phase === "string" ? block.phase.trim() : "";+ if (!phase) continue;+ const next: import("./types/messages.js").HostedSearchReplayBlock = {+ type: "hostedSearch",+ phase,+ };+ if (typeof block.blockId === "string" && block.blockId) next.blockId = block.blockId;+ if (typeof block.name === "string" && block.name) next.name = block.name;+ if (block.input !== undefined) next.input = block.input;+ if (typeof block.status === "string") next.status = block.status;+ if (block.isError === true) next.isError = true;+ if (block.wire && typeof block.wire === "object") next.wire = block.wire;+ replay.push(next);+ }+ return replay;+}++/**+ * Display rounds plus replay payload. Runtime persistence and stream+ * updates go through this so a restart can rebuild the same content+ * parts convertMessages expects.+ */+export function hostedSearchFromMessage(input: {+ content: unknown;+ citations?: unknown;+}): import("./types/messages.js").HostedSearch | undefined {+ const search = hostedSearchFromBlocks(input);+ if (!search) return undefined;+ const replay = hostedSearchReplayBlocks(input.content);+ return replay.length > 0 ? { ...search, replay } : search;+}+/*** Normalize pi-ai hostedSearch content blocks and message citations into the* shared `HostedSearch` shape: one round per provider search call, in blockdiff --git a/packages/shared/src/types/messages.ts b/packages/shared/src/types/messages.tsindex 3ce639178..2ba3d124f 100644--- a/packages/shared/src/types/messages.ts+++ b/packages/shared/src/types/messages.ts@@ -141,6 +141,25 @@ export type HostedSearch = {* any round is still in flight. */status: "searching" | "completed" | "failed";rounds: HostedSearchRound[];+ /**+ * Raw pi-ai hostedSearch content parts, in original block order. Display+ * uses `rounds`; convertMessages replay after a restart uses this. Absent+ * on transcripts written before the field existed — those rows still+ * render, but later turns cannot ground on the old search.+ */+ replay?: HostedSearchReplayBlock[];+};++/** One adapter-captured search block, stripped of streaming scratch. */+export type HostedSearchReplayBlock = {+ type: "hostedSearch";+ phase: string;+ blockId?: string;+ name?: string;+ input?: unknown;+ status?: string;+ isError?: boolean;+ wire?: unknown;};/** One provider search round, in the order the provider issued it. */