From 0139b4459c2320319eee2a737843137d5a92069c Mon Sep 17 00:00:00 2001 From: Sawyer Hood Date: Thu, 16 Jul 2026 01:51:04 -0700 Subject: [PATCH 1/3] Page giant turns' work and collapse the active-turn frontier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Very long single turns (observed: 335 min / 7,025 events / 27 MB) froze the browser: active turns rendered every event as a flat row, and expanding a completed turn's "Worked for…" section fetched the entire un-truncated turn in one response. Top-level segment pagination stays untouched — every visible response keeps its initiating user message — and all new bounding happens inside a turn's work section, the lesson from the #711 revert. Server: - turn-summary-details gains work-item paging: `workItemLimit` serves the newest N work items with an `earlierCursor` for progressively revealing older windows; `afterSeq` serves an exact catch-up range. Windows resolve from the indexed item/completed sequence, items straddling a window edge project fully from their completion payload, and paged rows get the same 32 KB output truncation as the timeline (full detail stays un-truncated). - Active turns past ~48 finished work items collapse their settled prefix into a partial "Worked so far" turn row (`partial: true`); recent work, running commands, approvals, and questions stay flat below it. The collapse frontier is derived from indexed completion counts and moves in 24-item chunks, so row identity churns at most once per chunk and the row converges to the normal completed "Worked for…" row at the same id. - Conversation outline selects only message-producing and turn-lifecycle events instead of reading every event (re-land of the #711 outline query, plus lifecycle events so completed-turn grouping matches the timeline). App: - LazyTurnRowBody pages large turns (partial rows and >60-item completed turns) through immutable per-window segment queries with a nested "Show earlier work" control; revealed work is keyed by summary-row id so it survives collapse/expand, live growth, and the completion transition, and prepending anchors scroll like "Load older messages". Verified against a copy of the 39 MB sample thread: the active giant turn's latest page drops from ~7,000 rows / 27 MB to 69 rows / ~420 KB; paged expansion serves ~210 KB windows in ~15 ms with full coverage and no duplicates; the outline builds in ~50 ms. UI exercised end-to-end in the dev app (expand, page, scroll stability). Co-Authored-By: Claude Fable 5 --- .../thread/timeline/ThreadTimelineRows.tsx | 102 +++- .../thread/timeline/useTurnWorkSegments.ts | 259 +++++++++ apps/app/src/hooks/queries/query-keys.ts | 27 + apps/app/src/lib/api.ts | 10 + .../src/lib/side-chat-create-request.test.ts | 1 + .../src/test/fixtures/thread-timeline-rows.ts | 1 + .../useThreadTimelinePages.test.ts | 1 + apps/server/src/routes/threads/data.ts | 79 ++- .../threads/timeline-output-truncation.ts | 48 +- apps/server/src/services/threads/timeline.ts | 233 ++++++++- .../timeline-output-truncation.test.ts | 1 + .../threads/turn-work-pagination.test.ts | 490 ++++++++++++++++++ packages/db/src/data/events.ts | 167 ++++++ packages/db/src/data/index.ts | 5 + .../bundled-types/bb-plugin-sdk.d.ts | 22 +- packages/server-contract/src/api/threads.ts | 39 ++ .../server-contract/src/thread-timeline.ts | 10 + .../server-contract/test/contract.test.ts | 23 +- .../thread-view/src/build-thread-timeline.ts | 168 +++++- .../src/completed-turn-grouping.ts | 57 +- packages/thread-view/src/index.ts | 1 + .../src/timeline-message-helpers.ts | 43 ++ .../thread-view/src/timeline-row-title.ts | 14 + .../test/partial-turn-collapse.test.ts | 310 +++++++++++ .../timeline-cli-rendering.snapshots.test.ts | 1 + .../test/timeline-row-title.test.ts | 1 + plans/long-thread-timeline-pagination.md | 227 ++++++++ .../fake/smoke/timeline-response.test.ts | 1 + 28 files changed, 2282 insertions(+), 59 deletions(-) create mode 100644 apps/app/src/components/thread/timeline/useTurnWorkSegments.ts create mode 100644 apps/server/test/services/threads/turn-work-pagination.test.ts create mode 100644 packages/thread-view/test/partial-turn-collapse.test.ts create mode 100644 plans/long-thread-timeline-pagination.md diff --git a/apps/app/src/components/thread/timeline/ThreadTimelineRows.tsx b/apps/app/src/components/thread/timeline/ThreadTimelineRows.tsx index 1e83e4684b..e08ab1ba3e 100644 --- a/apps/app/src/components/thread/timeline/ThreadTimelineRows.tsx +++ b/apps/app/src/components/thread/timeline/ThreadTimelineRows.tsx @@ -100,6 +100,7 @@ import { timelineRowsSignature, } from "./timelineRowSignatures.js"; import { NESTED_TIMELINE_GROUP_LINE_CLASS_NAME } from "./timeline-nested-group-line.js"; +import { useTurnWorkSegments } from "./useTurnWorkSegments.js"; import { getThreadRoutePath } from "@/lib/route-paths"; import { useThreadTimelineTurnSummaryDetails } from "@/hooks/queries/thread-queries"; import { @@ -1170,8 +1171,12 @@ function TimelineExpandableBody({ compactActivityIntents={compactActivityIntents} // Completed turn details live under "Worked for..." as archival // context; pending "Working" rows keep the streaming affordance. + // Partial "Worked so far" rows are archival too — their live tail + // renders outside the collapse. showAssistantMessageActions={ - showAssistantMessageActions && row.status === "pending" + showAssistantMessageActions && + row.status === "pending" && + !row.partial } /> ); @@ -1272,6 +1277,14 @@ function TurnRowBody({ ); } +/** + * Turns whose summary counts at most this many work items load their full + * detail in one un-truncated fetch. Larger turns page through + * `useTurnWorkSegments` — newest work first, with "Show earlier work" + * progressively revealing older windows. + */ +const FULL_TURN_DETAIL_MAX_ITEMS = 60; + function LazyTurnRowBody({ compactActivityIntents, row, @@ -1284,6 +1297,10 @@ function LazyTurnRowBody({ threadId: rowThreadId, turnId: rowTurnId, } = row; + // Partial rows always page (they exist because the turn is large and still + // growing); completed rows page only past the size threshold. + const usePagedWork = + row.partial || row.summaryCount > FULL_TURN_DETAIL_MAX_ITEMS; const identity = useMemo( () => buildTurnSummaryDetailsIdentity({ @@ -1297,18 +1314,43 @@ function LazyTurnRowBody({ ); const { data: detail, - isError, + isError: isFullDetailError, refetch, - } = useThreadTimelineTurnSummaryDetails(identity); + } = useThreadTimelineTurnSummaryDetails(identity, { + enabled: !usePagedWork, + }); + const workSegments = useTurnWorkSegments({ + enabled: usePagedWork, + rowId: row.id, + sourceSeqEnd: rowSourceSeqEnd, + sourceSeqStart: rowSourceSeqStart, + threadId: threadId ?? rowThreadId, + turnId: rowTurnId, + }); + const bottomAnchor = useBottomAnchoredScroll(); + const loadEarlierWork = workSegments.loadEarlierWork; + const handleShowEarlierWork = useCallback((): void => { + // Revealed earlier work inserts above the reader's position; anchor the + // scroll so the visible rows do not jump. + bottomAnchor?.captureScrollAnchor(); + loadEarlierWork(); + }, [bottomAnchor, loadEarlierWork]); + const retryWorkSegments = workSegments.retry; const handleRetry = useCallback((): void => { + if (usePagedWork) { + retryWorkSegments(); + return; + } void refetch(); - }, [refetch]); - const rows = detail - ? // Lazy turn-detail children belong to a completed turn — flag the + }, [refetch, retryWorkSegments, usePagedWork]); + const rawRows = usePagedWork ? workSegments.rows : (detail?.rows ?? null); + const rows = rawRows + ? // Lazy turn-detail children belong to settled work — flag the // scope as closed so trailing work in the children collapses into a // step-summary at end-of-input, matching the inline-children path. - getViewRows(detail.rows, { closedScope: true }) + getViewRows(rawRows, { closedScope: true }) : null; + const isError = usePagedWork ? workSegments.isError : isFullDetailError; if (!rows && isError) { return ( @@ -1328,17 +1370,43 @@ function LazyTurnRowBody({ ); } if (rows) { + const showEarlierWorkControl = + usePagedWork && (workSegments.hasEarlierWork || workSegments.isError); return ( - +
+ {showEarlierWorkControl ? ( +
+ +
+ ) : null} + +
); } return ( diff --git a/apps/app/src/components/thread/timeline/useTurnWorkSegments.ts b/apps/app/src/components/thread/timeline/useTurnWorkSegments.ts new file mode 100644 index 0000000000..000571542a --- /dev/null +++ b/apps/app/src/components/thread/timeline/useTurnWorkSegments.ts @@ -0,0 +1,259 @@ +import { useCallback, useEffect, useMemo, useRef } from "react"; +import { useQueries } from "@tanstack/react-query"; +import { atom, useAtom } from "jotai"; +import { atomFamily } from "jotai-family"; +import type { TimelineRow } from "@bb/server-contract"; +import * as api from "@/lib/api"; +import { threadTurnWorkSegmentQueryKey } from "@/hooks/queries/query-keys"; + +/** Work items per "Show earlier work" page. */ +export const TURN_WORK_SEGMENT_ITEM_LIMIT = 40; + +/** + * One immutable window of a turn's work. `page` covers the newest + * `TURN_WORK_SEGMENT_ITEM_LIMIT` work items strictly below `beforeSeq` + * (the server reports where the page actually started via its + * `earlierCursor`). `range` covers `(afterSeq, endSeq]` exactly — used to pick + * up work that collapsed into a partial "Worked so far" summary after the + * previous fetch. Both are stable descriptions of history, so their query + * results never need refetching. + */ +type TurnWorkSegmentParam = + | { kind: "page"; beforeSeq: number } + | { kind: "range"; afterSeq: number; endSeq: number }; + +interface TurnWorkSegmentsState { + /** Ordered oldest → newest by covered window. */ + segments: TurnWorkSegmentParam[]; + /** Highest sequence any fetched segment covers; appends start above it. */ + coveredEndSeq: number; +} + +/** + * Keyed by the summary row id (stable across the partial → completed + * transition), so work the user has progressively revealed stays revealed + * across collapse/expand cycles, live-turn growth, and turn completion. + * In-memory only — a reload starts back at the newest page. + */ +const turnWorkSegmentsAtomFamily = atomFamily((_rowKey: string) => + atom(null), +); + +function segmentDescriptor(segment: TurnWorkSegmentParam): string { + return segment.kind === "page" + ? `page:${segment.beforeSeq}:${TURN_WORK_SEGMENT_ITEM_LIMIT}` + : `range:${segment.afterSeq}:${segment.endSeq}`; +} + +/** + * Segment windows can share an item when its events straddle their boundary + * (started in the older window, completed in the newer). Both windows project + * the same row id; the newer window's version has the completed payload, and + * the older window's position preserves chronological start order. + */ +function mergeSegmentRows(orderedSegmentRows: TimelineRow[][]): TimelineRow[] { + const rowsById = new Map(); + const orderedIds: string[] = []; + for (const segmentRows of orderedSegmentRows) { + for (const row of segmentRows) { + if (!rowsById.has(row.id)) { + orderedIds.push(row.id); + } + rowsById.set(row.id, row); + } + } + return orderedIds.flatMap((id) => { + const row = rowsById.get(id); + return row === undefined ? [] : [row]; + }); +} + +export interface UseTurnWorkSegmentsArgs { + enabled: boolean; + /** Stable identity of the summary row this expansion belongs to. */ + rowId: string; + sourceSeqEnd: number; + sourceSeqStart: number; + threadId: string; + turnId: string; +} + +export interface UseTurnWorkSegmentsResult { + /** Null until the first segment resolves. */ + rows: TimelineRow[] | null; + hasEarlierWork: boolean; + isLoadingEarlier: boolean; + isError: boolean; + loadEarlierWork: () => void; + retry: () => void; +} + +export function useTurnWorkSegments({ + enabled, + rowId, + sourceSeqEnd, + sourceSeqStart, + threadId, + turnId, +}: UseTurnWorkSegmentsArgs): UseTurnWorkSegmentsResult { + const atomKey = `${threadId}:${rowId}`; + const [state, setState] = useAtom(turnWorkSegmentsAtomFamily(atomKey)); + + // The row's range floor participates in requests but must not re-key + // segment queries: it can shift when a partial row converges to the + // completed summary, and the already-fetched windows stay valid. + const sourceSeqStartRef = useRef(sourceSeqStart); + sourceSeqStartRef.current = sourceSeqStart; + + useEffect(() => { + if (!enabled) { + return; + } + setState((current) => { + if (current === null) { + return { + segments: [{ kind: "page", beforeSeq: sourceSeqEnd + 1 }], + coveredEndSeq: sourceSeqEnd, + }; + } + if (sourceSeqEnd > current.coveredEndSeq) { + // The partial summary absorbed more finished work (or the turn + // completed): append exactly the newly covered range, leaving every + // already-fetched window untouched. + return { + segments: [ + ...current.segments, + { + kind: "range", + afterSeq: current.coveredEndSeq, + endSeq: sourceSeqEnd, + }, + ], + coveredEndSeq: sourceSeqEnd, + }; + } + return current; + }); + }, [enabled, setState, sourceSeqEnd]); + + const segments = useMemo( + () => state?.segments ?? [], + [state], + ); + const orderedSegments = useMemo(() => { + const upperBound = (segment: TurnWorkSegmentParam): number => + segment.kind === "page" ? segment.beforeSeq - 1 : segment.endSeq; + return [...segments].sort((left, right) => upperBound(left) - upperBound(right)); + }, [segments]); + + const queries = useQueries({ + queries: orderedSegments.map((segment) => ({ + queryKey: threadTurnWorkSegmentQueryKey( + threadId, + turnId, + segmentDescriptor(segment), + ), + queryFn: ({ signal }: { signal?: AbortSignal }) => + segment.kind === "page" + ? api.getThreadTimelineTurnSummaryDetails({ + id: threadId, + signal, + turnId, + sourceSeqStart: sourceSeqStartRef.current, + sourceSeqEnd: segment.beforeSeq - 1, + workItemLimit: TURN_WORK_SEGMENT_ITEM_LIMIT, + }) + : api.getThreadTimelineTurnSummaryDetails({ + id: threadId, + signal, + turnId, + sourceSeqStart: sourceSeqStartRef.current, + sourceSeqEnd: segment.endSeq, + afterSeq: segment.afterSeq, + }), + enabled, + staleTime: Infinity, + meta: { + errorMessage: "Failed to load turn work.", + showErrorToast: false, + }, + })), + }); + + // useQueries returns a fresh array every render; recompute the merged rows + // only when a segment's data reference actually changes so the merged + // array's identity stays stable for the WeakMap-keyed view-row cache. + const mergedRowsRef = useRef<{ + segmentData: (TimelineRow[] | undefined)[]; + rows: TimelineRow[] | null; + }>({ segmentData: [], rows: null }); + const segmentData = queries.map((query) => query.data?.rows); + const previous = mergedRowsRef.current; + if ( + segmentData.length !== previous.segmentData.length || + segmentData.some((data, index) => data !== previous.segmentData[index]) + ) { + const resolved = segmentData.flatMap((data) => + data === undefined ? [] : [data], + ); + mergedRowsRef.current = { + segmentData, + rows: resolved.length === 0 ? null : mergeSegmentRows(resolved), + }; + } + const rows = mergedRowsRef.current.rows; + + // Earlier-work paging state lives on the oldest page segment: its response + // carries the cursor for the next-older window. + const oldestPageIndex = orderedSegments.findIndex( + (segment) => segment.kind === "page", + ); + const oldestPageQuery = + oldestPageIndex === -1 ? undefined : queries[oldestPageIndex]; + const earlierCursor = + oldestPageQuery?.data?.workPage?.earlierCursor ?? null; + + const loadEarlierWork = useCallback(() => { + if (earlierCursor === null) { + return; + } + setState((current) => { + if (current === null) { + return current; + } + const alreadyLoaded = current.segments.some( + (segment) => + segment.kind === "page" && + segment.beforeSeq === earlierCursor.beforeSeq, + ); + if (alreadyLoaded) { + return current; + } + return { + ...current, + segments: [ + { kind: "page", beforeSeq: earlierCursor.beforeSeq }, + ...current.segments, + ], + }; + }); + }, [earlierCursor, setState]); + + const retry = useCallback(() => { + for (const query of queries) { + if (query.isError) { + void query.refetch(); + } + } + }, [queries]); + + return { + rows, + hasEarlierWork: earlierCursor !== null, + isLoadingEarlier: + oldestPageQuery !== undefined && oldestPageQuery.isPending, + isError: queries.some((query) => query.isError), + loadEarlierWork, + retry, + }; +} diff --git a/apps/app/src/hooks/queries/query-keys.ts b/apps/app/src/hooks/queries/query-keys.ts index adf2a6e1b8..8eba651f32 100644 --- a/apps/app/src/hooks/queries/query-keys.ts +++ b/apps/app/src/hooks/queries/query-keys.ts @@ -906,6 +906,33 @@ export function threadTimelineTurnSummaryDetailsQueryKey({ ]; } +/** + * One immutable window of a large turn's work rows (see useTurnWorkSegments). + * Shares the turn-summary-details prefix so thread-level invalidation and + * cleanup cover both families. + */ +export type ThreadTurnWorkSegmentQueryKey = readonly [ + typeof THREAD_TIMELINE_TURN_SUMMARY_DETAILS_QUERY_KEY, + string, + string, + "work-segment", + string, +]; + +export function threadTurnWorkSegmentQueryKey( + threadId: string, + turnId: string, + segmentDescriptor: string, +): ThreadTurnWorkSegmentQueryKey { + return [ + THREAD_TIMELINE_TURN_SUMMARY_DETAILS_QUERY_KEY, + threadId, + turnId, + "work-segment", + segmentDescriptor, + ]; +} + export function threadTimelineQueryKeyPrefix( threadId: string, ): ThreadTimelineQueryKeyPrefix { diff --git a/apps/app/src/lib/api.ts b/apps/app/src/lib/api.ts index 06454c3c9d..65492cf05a 100644 --- a/apps/app/src/lib/api.ts +++ b/apps/app/src/lib/api.ts @@ -132,6 +132,10 @@ interface GetThreadTimelineArgs { interface GetThreadTimelineTurnSummaryDetailsArgs extends TimelineTurnSummaryDetailsRequest { id: string; signal?: AbortSignal; + /** Newest-page request: cap the response to this many work items. */ + workItemLimit?: number; + /** Fixed-range request: only events with sequence > afterSeq. */ + afterSeq?: number; } interface GetEnvironmentFilePreviewArgs { @@ -1656,6 +1660,8 @@ export async function getThreadTimelineTurnSummaryDetails({ turnId, sourceSeqStart, sourceSeqEnd, + workItemLimit, + afterSeq, }: GetThreadTimelineTurnSummaryDetailsArgs): Promise { return request( apiClient.threads[":id"].timeline["turn-summary-details"].$get( @@ -1665,6 +1671,10 @@ export async function getThreadTimelineTurnSummaryDetails({ turnId, sourceSeqStart: String(sourceSeqStart), sourceSeqEnd: String(sourceSeqEnd), + ...(workItemLimit === undefined + ? {} + : { workItemLimit: String(workItemLimit) }), + ...(afterSeq === undefined ? {} : { afterSeq: String(afterSeq) }), }, }, requestOptions(signal), diff --git a/apps/app/src/lib/side-chat-create-request.test.ts b/apps/app/src/lib/side-chat-create-request.test.ts index 6ccb028dcc..91a59247cf 100644 --- a/apps/app/src/lib/side-chat-create-request.test.ts +++ b/apps/app/src/lib/side-chat-create-request.test.ts @@ -105,6 +105,7 @@ describe("resolveSideChatReplyReference", () => { status: "completed", summaryCount: 0, completedAt: 9, + partial: false, children: [ conversationRow("assistant", anchor), conversationRow("user", "And the latest message."), diff --git a/apps/app/src/test/fixtures/thread-timeline-rows.ts b/apps/app/src/test/fixtures/thread-timeline-rows.ts index d88494455b..623c0b1e7f 100644 --- a/apps/app/src/test/fixtures/thread-timeline-rows.ts +++ b/apps/app/src/test/fixtures/thread-timeline-rows.ts @@ -1108,6 +1108,7 @@ export function turnRow({ status, summaryCount, completedAt: completedAtFromDuration(base.startedAt, durationMs), + partial: false, children, }; } diff --git a/apps/app/src/views/thread-detail/useThreadTimelinePages.test.ts b/apps/app/src/views/thread-detail/useThreadTimelinePages.test.ts index a4a6dbd310..f658bba483 100644 --- a/apps/app/src/views/thread-detail/useThreadTimelinePages.test.ts +++ b/apps/app/src/views/thread-detail/useThreadTimelinePages.test.ts @@ -83,6 +83,7 @@ function turnSummaryRow(args: TimelineTestRowArgs): TimelineTurnRow { startedAt: args.sequence, createdAt: args.sequence, kind: "turn", + partial: false, status: "completed", summaryCount: 1, completedAt: args.sequence, diff --git a/apps/server/src/routes/threads/data.ts b/apps/server/src/routes/threads/data.ts index f488bb3896..6bc4fa2d52 100644 --- a/apps/server/src/routes/threads/data.ts +++ b/apps/server/src/routes/threads/data.ts @@ -47,10 +47,13 @@ import { buildThreadConversationOutline, buildThreadTimeline, buildTimelineTurnSummaryDetails, + buildTimelineTurnWorkPage, THREAD_TIMELINE_DEFAULT_SEGMENT_LIMIT, THREAD_TIMELINE_SEGMENT_LIMIT_MAX, + TIMELINE_TURN_WORK_ITEM_LIMIT_MAX, type ThreadTimelinePageKind, type ThreadTimelinePageRequest, + type TimelineTurnWorkPageMode, } from "../../services/threads/timeline.js"; import { buildThreadTimelineCacheKey, @@ -58,7 +61,10 @@ import { createThreadTimelineCache, } from "../../services/threads/timeline-cache.js"; import { createTimelineLatestRowsCache } from "../../services/threads/timeline-latest-rows-cache.js"; -import { truncateTimelineResponseOutputs } from "../../services/threads/timeline-output-truncation.js"; +import { + truncateTimelineResponseOutputs, + truncateTimelineRowsOutputs, +} from "../../services/threads/timeline-output-truncation.js"; import { computeTimelineRowDelta } from "@bb/server-contract"; import { findThreadEvent, @@ -233,6 +239,37 @@ function parseThreadTimelinePage( }; } +function parseTimelineTurnWorkPageMode(query: { + afterSeq?: string; + workItemLimit?: string; +}): TimelineTurnWorkPageMode | null { + if (query.workItemLimit !== undefined && query.afterSeq !== undefined) { + throw new ApiError( + 400, + "invalid_request", + "workItemLimit and afterSeq are mutually exclusive", + ); + } + if (query.workItemLimit !== undefined) { + return { + kind: "page", + workItemLimit: parseBoundedPositiveOptionalInteger({ + defaultValue: TIMELINE_TURN_WORK_ITEM_LIMIT_MAX, + max: TIMELINE_TURN_WORK_ITEM_LIMIT_MAX, + name: "workItemLimit", + value: query.workItemLimit, + }), + }; + } + if (query.afterSeq !== undefined) { + return { + kind: "range", + afterSeq: parseInteger(query.afterSeq, "afterSeq"), + }; + } + return null; +} + export async function requireThreadStorageTarget( deps: WorkSessionDeps, args: RequireThreadStorageTargetArgs, @@ -461,18 +498,36 @@ export function registerThreadDataRoutes(app: Hono, deps: AppDeps): void { const includeProviderUnhandledOperations = deps.config.isDevelopment || getAppSettings(deps.db).showUnhandledProviderEvents; - return context.json( - buildTimelineTurnSummaryDetails(deps.db, thread, { - includeProviderUnhandledOperations, - providerDisplayName: resolveThreadProviderDisplayName( - deps, - thread.providerId, - ), - turnId: query.turnId, - sourceSeqStart: parseInteger(query.sourceSeqStart, "sourceSeqStart"), - sourceSeqEnd: parseInteger(query.sourceSeqEnd, "sourceSeqEnd"), - }), + const providerDisplayName = resolveThreadProviderDisplayName( + deps, + thread.providerId, ); + const selection = { + turnId: query.turnId, + sourceSeqStart: parseInteger(query.sourceSeqStart, "sourceSeqStart"), + sourceSeqEnd: parseInteger(query.sourceSeqEnd, "sourceSeqEnd"), + }; + + const mode = parseTimelineTurnWorkPageMode(query); + if (mode === null) { + return context.json( + buildTimelineTurnSummaryDetails(deps.db, thread, { + includeProviderUnhandledOperations, + providerDisplayName, + ...selection, + }), + ); + } + const page = buildTimelineTurnWorkPage(deps.db, thread, { + includeProviderUnhandledOperations, + mode, + providerDisplayName, + ...selection, + }); + return context.json({ + ...page, + rows: truncateTimelineRowsOutputs(page.rows), + }); }); get(routes.output, (context) => { diff --git a/apps/server/src/services/threads/timeline-output-truncation.ts b/apps/server/src/services/threads/timeline-output-truncation.ts index 45419cdd8c..df1ed5a013 100644 --- a/apps/server/src/services/threads/timeline-output-truncation.ts +++ b/apps/server/src/services/threads/timeline-output-truncation.ts @@ -14,20 +14,23 @@ import type { ThreadTimelineResponse, TimelineRow } from "@bb/server-contract"; */ export const DEFAULT_MAX_INLINE_OUTPUT_CHARS = 32_000; -function truncateString(value: string, max: number): string { +function truncateString(value: string, max: number, hint: string): string { if (value.length <= max) { return value; } const dropped = value.length - max; - return `${value.slice(0, max)}\n…[${dropped.toLocaleString()} more characters truncated — open the turn to view the full output]`; + return `${value.slice(0, max)}\n…[${dropped.toLocaleString()} more characters truncated${hint}]`; } -function truncateRow(row: TimelineRow, max: number): TimelineRow { +const TIMELINE_TRUNCATION_HINT = " — open the turn to view the full output"; +const TURN_WORK_PAGE_TRUNCATION_HINT = ""; + +function truncateRow(row: TimelineRow, max: number, hint: string): TimelineRow { if (row.kind === "turn") { if (!row.children) { return row; } - const children = truncateRows(row.children, max); + const children = truncateRows(row.children, max, hint); return children === row.children ? row : { ...row, children }; } @@ -38,16 +41,18 @@ function truncateRow(row: TimelineRow, max: number): TimelineRow { switch (row.workKind) { case "command": case "tool": { - const output = truncateString(row.output, max); + const output = truncateString(row.output, max, hint); return output === row.output ? row : { ...row, output }; } case "file-change": { const diff = - row.change.diff === null ? null : truncateString(row.change.diff, max); + row.change.diff === null + ? null + : truncateString(row.change.diff, max, hint); const stdout = - row.stdout === null ? null : truncateString(row.stdout, max); + row.stdout === null ? null : truncateString(row.stdout, max, hint); const stderr = - row.stderr === null ? null : truncateString(row.stderr, max); + row.stderr === null ? null : truncateString(row.stderr, max, hint); if ( diff === row.change.diff && stdout === row.stdout && @@ -63,8 +68,8 @@ function truncateRow(row: TimelineRow, max: number): TimelineRow { }; } case "delegation": { - const output = truncateString(row.output, max); - const childRows = truncateRows(row.childRows, max); + const output = truncateString(row.output, max, hint); + const childRows = truncateRows(row.childRows, max, hint); if (output === row.output && childRows === row.childRows) { return row; } @@ -75,10 +80,14 @@ function truncateRow(row: TimelineRow, max: number): TimelineRow { } } -function truncateRows(rows: TimelineRow[], max: number): TimelineRow[] { +function truncateRows( + rows: TimelineRow[], + max: number, + hint: string, +): TimelineRow[] { let changed = false; const next = rows.map((row) => { - const truncated = truncateRow(row, max); + const truncated = truncateRow(row, max, hint); if (truncated !== row) { changed = true; } @@ -91,6 +100,19 @@ export function truncateTimelineResponseOutputs( response: ThreadTimelineResponse, max: number = DEFAULT_MAX_INLINE_OUTPUT_CHARS, ): ThreadTimelineResponse { - const rows = truncateRows(response.rows, max); + const rows = truncateRows(response.rows, max, TIMELINE_TRUNCATION_HINT); return rows === response.rows ? response : { ...response, rows }; } + +/** + * Same cap for paged turn-work rows. Full (un-paged) turn detail stays + * un-truncated — it is the "view the full output" escape hatch — but paged + * responses exist precisely because the turn is enormous, and a single page + * containing a few ~1 MB command outputs would defeat the point of paging. + */ +export function truncateTimelineRowsOutputs( + rows: TimelineRow[], + max: number = DEFAULT_MAX_INLINE_OUTPUT_CHARS, +): TimelineRow[] { + return truncateRows(rows, max, TURN_WORK_PAGE_TRUNCATION_HINT); +} diff --git a/apps/server/src/services/threads/timeline.ts b/apps/server/src/services/threads/timeline.ts index 9dcbad0be1..1b8892bb83 100644 --- a/apps/server/src/services/threads/timeline.ts +++ b/apps/server/src/services/threads/timeline.ts @@ -2,6 +2,7 @@ import { buildThreadTimelineFromEvents, THREAD_TIMELINE_EXCLUDED_EVENT_TYPES, buildThreadTimelineTurnDetailsFromEvents, + buildThreadTimelineTurnWorkPageFromEvents, compactThreadTimelineSummaryEvents, type AcceptedClientRequestContext, type ThreadEventWithMeta, @@ -15,11 +16,16 @@ import type { ThreadConversationOutlineAttachmentSummary, ThreadTimelineResponse, TimelineTurnSummaryDetailsResponse, + TimelineTurnWorkPageCursor, } from "@bb/server-contract"; import { + countTurnWorkItemCompletions, findTimelineSegmentAnchorSequenceAfter, + getActiveStoredTurnId, getEnvironment, getTimelineSegmentAnchorAtSequence, + getTurnWorkItemCompletionSequenceByIndex, + hasTurnCompletedEvent, listContextWindowUsageRows, listRecentStoredEventRows, listStoredClientTurnRequestIdsInRange, @@ -27,11 +33,13 @@ import { listStoredEventRowsInRange, listLatestBackgroundTaskStateRowsByItemIds, listLatestOpenBackgroundTaskStateRowsForThread, + listStoredConversationOutlineEventRows, listStoredTimelineWindowEventRows, listStoredToolCallRowsByItemIds, listStoredTurnInputAcceptedRowsByClientRequestIds, listStoredTurnStartedRowsByTurnIdsUpToSequence, listTimelineSegmentAnchorsDescending, + listTurnWorkItemCompletionSequencesDescending, } from "@bb/db"; import type { DbConnection, StoredEventRow } from "@bb/db"; import { ApiError } from "../../errors.js"; @@ -119,8 +127,76 @@ interface BuildTimelineTurnSummaryDetailsOptions extends TimelineTurnSummarySele providerDisplayName?: string; } +/** + * How a paged turn-work request bounds its window. `page` serves the newest + * `workItemLimit` work items at or below the requested range end and reports + * an `earlierCursor` for the rest; `range` serves exactly + * `(afterSeq, sourceSeqEnd]`, used to append work that collapsed into a + * partial turn summary after the client's previous fetch. + */ +export type TimelineTurnWorkPageMode = + | { kind: "page"; workItemLimit: number } + | { kind: "range"; afterSeq: number }; + +interface BuildTimelineTurnWorkPageOptions extends TimelineTurnSummarySelection { + includeProviderUnhandledOperations: boolean; + mode: TimelineTurnWorkPageMode; + providerDisplayName?: string; +} + export const THREAD_TIMELINE_DEFAULT_SEGMENT_LIMIT = 20; export const THREAD_TIMELINE_SEGMENT_LIMIT_MAX = 100; +export const TIMELINE_TURN_WORK_ITEM_LIMIT_MAX = 200; + +/** + * Active-turn collapse tuning. Once a running turn accumulates + * `KEEP + CHUNK` finished work items, everything up to a chunk-aligned + * frontier collapses into a partial "Worked so far" summary row; at least + * `KEEP` finished items stay visible below it. The frontier only moves in + * `CHUNK`-item steps so row identity churn (and the scroll adjustments it + * causes) happens at most once per chunk, not per completion. + */ +const ACTIVE_TURN_COLLAPSE_KEEP_ITEMS = 24; +const ACTIVE_TURN_COLLAPSE_CHUNK_ITEMS = 24; + +/** + * Collapse frontier for the thread's currently-running turn, if any: work-item + * completions at or before the returned sequence are summarized instead of + * rendered flat. Derived from indexed completion counts only — never from + * event payloads — so it stays cheap on turns with tens of thousands of + * events. Deterministic per (thread, maxSeq), which keeps it compatible with + * the per-maxSeq timeline response cache. + */ +function resolveActiveTurnCollapseFrontiers( + db: DbConnection, + threadId: string, +): ReadonlyMap | undefined { + const activeTurnId = getActiveStoredTurnId(db, threadId); + if (activeTurnId === null) { + return undefined; + } + const completionCount = countTurnWorkItemCompletions(db, { + threadId, + turnId: activeTurnId, + }); + const collapsedCount = + Math.floor( + (completionCount - ACTIVE_TURN_COLLAPSE_KEEP_ITEMS) / + ACTIVE_TURN_COLLAPSE_CHUNK_ITEMS, + ) * ACTIVE_TURN_COLLAPSE_CHUNK_ITEMS; + if (collapsedCount < ACTIVE_TURN_COLLAPSE_CHUNK_ITEMS) { + return undefined; + } + const frontierSeq = getTurnWorkItemCompletionSequenceByIndex(db, { + threadId, + turnId: activeTurnId, + index: collapsedCount - 1, + }); + if (frontierSeq === null) { + return undefined; + } + return new Map([[activeTurnId, frontierSeq]]); +} export type ThreadTimelineBuildProfileStage = | "event-query" @@ -1014,6 +1090,10 @@ function buildThreadTimelineInternal( toThreadEventWithMeta(row), ), }; + const activeTurnCollapseFrontiers = + options.page.kind === "latest" + ? resolveActiveTurnCollapseFrontiers(db, thread.id) + : undefined; const timeline = measureThreadTimelineStage( profile, "thread-view-projection", @@ -1024,6 +1104,7 @@ function buildThreadTimelineInternal( events: decodedEvents, options: { ...commonProjectionOptions, + activeTurnCollapseFrontiers, contextOnlyToolCallIds: eventSelection.contextOnlyToolCallIds, includeNestedRows, providerId: thread.providerId, @@ -1127,21 +1208,22 @@ function toConversationOutlineAttachmentSummary( /** * Projects the entire thread into a lightweight conversation outline for the * table-of-contents minimap. Unlike {@link buildThreadTimeline}, this is not - * paginated: it reads every event and reuses the same + * paginated: it spans the whole thread and reuses the same * {@link buildThreadTimelineFromEvents} projection so each outline item's `id` * is identical to the timeline row it represents. That identity is what lets * the minimap scroll-spy the loaded window and jump to a message once it is * paginated in. Only conversation rows survive, and each is reduced to the few - * fields the minimap renders. + * fields the minimap renders — so only message-producing and turn-lifecycle + * events are selected, keeping cost independent of how much tool/command work + * the thread performed. */ export function buildThreadConversationOutline( db: DbConnection, thread: Thread, options: BuildThreadConversationOutlineOptions, ): ThreadConversationOutlineResponse { - const rawEventRows = listRecentStoredEventRows(db, { + const rawEventRows = listStoredConversationOutlineEventRows(db, { threadId: thread.id, - excludedTypes: THREAD_TIMELINE_EXCLUDED_EVENT_TYPES, }); const decodedRawEvents = rawEventRows.map((row) => toThreadEventWithMeta(row), @@ -1313,6 +1395,7 @@ export function buildTimelineTurnSummaryDetails( if (children.kind !== "missing-match") { return { rows: children.rows, + workPage: null, }; } @@ -1320,3 +1403,145 @@ export function buildTimelineTurnSummaryDetails( `Timeline turn summary details could not match range ${options.sourceSeqStart}-${options.sourceSeqEnd}`, ); } + +/** + * Serves one window of a turn's work rows for the progressive "Worked for…" / + * "Worked so far" expansion. Unlike {@link buildTimelineTurnSummaryDetails} + * this never loads the whole turn: `page` mode resolves its lower bound from + * the indexed work-item-completion sequence so a request touches at most + * ~`workItemLimit` items' events, and `range` mode is already bounded by the + * caller. Items whose events straddle a window edge still project fully from + * their `item/completed` payload; the client deduplicates row ids across + * windows, preferring the newer window's version. + * + * Degrades instead of erroring: a window that no longer contains any rows for + * the requested turn (pruned events, stale cursor) returns empty rows with no + * earlier cursor. + */ +export function buildTimelineTurnWorkPage( + db: DbConnection, + thread: Thread, + options: BuildTimelineTurnWorkPageOptions, +): TimelineTurnSummaryDetailsResponse { + if (options.sourceSeqStart > options.sourceSeqEnd) { + throw new ApiError( + 400, + "invalid_request", + "sourceSeqStart must be less than or equal to sourceSeqEnd", + ); + } + + const upper = options.sourceSeqEnd; + const emptyWorkPage = + options.mode.kind === "page" ? { earlierCursor: null } : null; + let lower: number; + let earlierCursor: TimelineTurnWorkPageCursor | null = null; + if (options.mode.kind === "range") { + lower = options.mode.afterSeq + 1; + if (lower > upper) { + return { rows: [], workPage: null }; + } + } else { + const workItemLimit = options.mode.workItemLimit; + const completionSequences = listTurnWorkItemCompletionSequencesDescending( + db, + { + threadId: thread.id, + turnId: options.turnId, + sequenceStart: options.sourceSeqStart, + sequenceEnd: upper, + limit: workItemLimit + 1, + }, + ); + const newestExcludedCompletionSeq = completionSequences[workItemLimit]; + if (newestExcludedCompletionSeq !== undefined) { + // The page starts just after the newest completion that did not make the + // page, so the oldest included item's started/delta events stay in + // window with it. + lower = newestExcludedCompletionSeq + 1; + earlierCursor = { beforeSeq: lower }; + } else { + lower = options.sourceSeqStart; + } + } + + const exactEventRows = listStoredEventRowsInRange(db, { + threadId: thread.id, + seqStart: lower, + seqEnd: upper, + }); + const clientRequestIds = listStoredClientTurnRequestIdsInRange(db, { + threadId: thread.id, + seqStart: lower, + seqEnd: upper, + }); + const exactAcceptedInputRows = exactEventRows.filter( + (row) => row.type === "turn/input/accepted", + ); + const futureAcceptedInputRows = + listStoredTurnInputAcceptedRowsByClientRequestIds(db, { + threadId: thread.id, + afterSequence: upper, + clientRequestIds, + }); + const acceptedInputRowsByTurn = partitionAcceptedInputRowsByRequestedTurn({ + acceptedInputRows: [...exactAcceptedInputRows, ...futureAcceptedInputRows], + turnId: options.turnId, + }); + const exactEventRowsForRequestedTurn = filterExactEventRowsForRequestedTurn({ + acceptedClientRequestIdsForOtherTurns: + acceptedInputRowsByTurn.acceptedClientRequestIdsForOtherTurns, + exactEventRows, + turnId: options.turnId, + }); + const eventRows = mergeStoredEventRowsById([ + ...exactEventRowsForRequestedTurn.rows, + ...acceptedInputRowsByTurn.requestedTurnRows, + ]); + + const hasTurnScopedRowsForRequestedTurn = eventRows.some( + (row) => row.scopeKind === "turn" && row.turnId === options.turnId, + ); + if (!hasTurnScopedRowsForRequestedTurn) { + return { rows: [], workPage: emptyWorkPage }; + } + + const eventRowsWithParentedChildren = ensureTimelineWindowParentedRows(db, { + includeParentContext: false, + threadId: thread.id, + rows: eventRows, + }).rows; + const eventRowsWithTurnStarts = ensureTimelineWindowTurnStartedRows(db, { + threadId: thread.id, + rows: eventRowsWithParentedChildren, + }); + const eventRowsWithBackgroundTaskState = + ensureTimelineWindowBackgroundTaskStateRows(db, { + threadId: thread.id, + rows: eventRowsWithTurnStarts, + }); + + const rows = buildThreadTimelineTurnWorkPageFromEvents({ + events: eventRowsWithBackgroundTaskState.map((row) => + toThreadEventWithMeta(row), + ), + options: { + includeProviderUnhandledOperations: + options.includeProviderUnhandledOperations, + providerDisplayName: options.providerDisplayName, + threadStatus: thread.status, + threadName: thread.title ?? thread.titleFallback ?? "", + turnFinished: hasTurnCompletedEvent(db, { + threadId: thread.id, + turnId: options.turnId, + }), + turnId: options.turnId, + workspaceRoot: resolveThreadWorkspaceRoot(db, thread), + }, + }); + + return { + rows, + workPage: options.mode.kind === "page" ? { earlierCursor } : null, + }; +} diff --git a/apps/server/test/services/threads/timeline-output-truncation.test.ts b/apps/server/test/services/threads/timeline-output-truncation.test.ts index fc55a3bd27..7edcfc8e43 100644 --- a/apps/server/test/services/threads/timeline-output-truncation.test.ts +++ b/apps/server/test/services/threads/timeline-output-truncation.test.ts @@ -85,6 +85,7 @@ describe("truncateTimelineResponseOutputs", () => { status: "completed", summaryCount: 1, completedAt: 1, + partial: false, children: [commandRow(big)], }; const out = truncateTimelineResponseOutputs(response([turn])); diff --git a/apps/server/test/services/threads/turn-work-pagination.test.ts b/apps/server/test/services/threads/turn-work-pagination.test.ts new file mode 100644 index 0000000000..5fc492e829 --- /dev/null +++ b/apps/server/test/services/threads/turn-work-pagination.test.ts @@ -0,0 +1,490 @@ +import { describe, expect, it } from "vitest"; +import { + encodeClientTurnRequestIdNumber, + threadScope, + turnScope, +} from "@bb/domain"; +import type { ClientTurnRequestId, Thread } from "@bb/domain"; +import { + createConnection, + createProject, + createThread, + insertEvents, + migrate, + noopNotifier, + upsertHost, +} from "@bb/db"; +import type { DbConnection } from "@bb/db"; +import type { TimelineRow, TimelineTurnRow } from "@bb/server-contract"; +import { + buildThreadConversationOutline, + buildThreadTimeline, + buildTimelineTurnWorkPage, +} from "../../../src/services/threads/timeline.js"; + +const TURN_ID = "turn-1"; +const providerThreadId = "provider-root"; + +const execution = { + model: "gpt-5", + serviceTier: "default", + reasoningLevel: "medium", + permissionMode: "full", + source: "client/turn/requested", +} as const; + +interface SetupResult { + db: DbConnection; + thread: Thread; +} + +function setup(): SetupResult { + const db = createConnection(":memory:"); + migrate(db); + const host = upsertHost(db, noopNotifier, { + name: "test-host", + type: "persistent", + }); + const { project } = createProject(db, noopNotifier, { + name: "test-project", + source: { type: "local_path", hostId: host.id, path: "/tmp/test" }, + }); + const thread = createThread(db, noopNotifier, { + projectId: project.id, + providerId: "claude-code", + }); + return { db, thread }; +} + +function requestId(value: number): ClientTurnRequestId { + return encodeClientTurnRequestIdNumber({ value }); +} + +interface TurnScaffoldArgs { + db: DbConnection; + thread: Thread; + requestValue: number; + startSeq: number; + turnId?: string; + promptText?: string; +} + +/** Inserts user request + turn/started + input accepted; returns next seq. */ +function insertTurnScaffold({ + db, + thread, + requestValue, + startSeq, + turnId = TURN_ID, + promptText = "Do the work.", +}: TurnScaffoldArgs): number { + const clientRequestId = requestId(requestValue); + insertEvents(db, noopNotifier, [ + { + threadId: thread.id, + sequence: startSeq, + type: "client/turn/requested", + scope: threadScope(), + itemId: null, + itemKind: null, + data: JSON.stringify({ + direction: "outbound", + source: "tell", + initiator: "user", + request: { method: "turn/start", params: {} }, + requestId: clientRequestId, + senderThreadId: null, + input: [{ type: "text", text: promptText, mentions: [] }], + target: { kind: "new-turn" }, + execution, + }), + }, + { + threadId: thread.id, + sequence: startSeq + 1, + type: "turn/started", + scope: turnScope(turnId), + providerThreadId, + itemId: null, + itemKind: null, + data: JSON.stringify({}), + }, + { + threadId: thread.id, + sequence: startSeq + 2, + type: "turn/input/accepted", + scope: turnScope(turnId), + providerThreadId, + itemId: null, + itemKind: null, + data: JSON.stringify({ clientRequestId }), + }, + ]); + return startSeq + 3; +} + +interface InsertCommandPairArgs { + db: DbConnection; + thread: Thread; + seq: number; + turnId?: string; +} + +/** Inserts one started/completed command pair at (seq, seq + 1). */ +function insertCommandPair({ + db, + thread, + seq, + turnId = TURN_ID, +}: InsertCommandPairArgs): void { + const itemId = `cmd-${seq}`; + const item = { + type: "commandExecution", + id: itemId, + command: `echo ${seq}`, + cwd: "/repo", + aggregatedOutput: `out ${seq}`, + exitCode: 0, + status: "completed", + approvalStatus: null, + }; + insertEvents(db, noopNotifier, [ + { + threadId: thread.id, + sequence: seq, + type: "item/started", + scope: turnScope(turnId), + providerThreadId, + itemId, + itemKind: "commandExecution", + data: JSON.stringify({ item: { ...item, status: "pending" } }), + }, + { + threadId: thread.id, + sequence: seq + 1, + type: "item/completed", + scope: turnScope(turnId), + providerThreadId, + itemId, + itemKind: "commandExecution", + data: JSON.stringify({ item }), + }, + ]); +} + +interface InsertAssistantMessageArgs { + db: DbConnection; + thread: Thread; + seq: number; + text: string; + turnId?: string; +} + +function insertAssistantMessage({ + db, + thread, + seq, + text, + turnId = TURN_ID, +}: InsertAssistantMessageArgs): void { + insertEvents(db, noopNotifier, [ + { + threadId: thread.id, + sequence: seq, + type: "item/completed", + scope: turnScope(turnId), + providerThreadId, + itemId: `assistant-${seq}`, + itemKind: "agentMessage", + data: JSON.stringify({ + item: { type: "agentMessage", id: `assistant-${seq}`, text }, + }), + }, + ]); +} + +interface InsertTurnCompletedArgs { + db: DbConnection; + thread: Thread; + seq: number; + turnId?: string; +} + +function insertTurnCompleted({ + db, + thread, + seq, + turnId = TURN_ID, +}: InsertTurnCompletedArgs): void { + insertEvents(db, noopNotifier, [ + { + threadId: thread.id, + sequence: seq, + type: "turn/completed", + scope: turnScope(turnId), + providerThreadId, + itemId: null, + itemKind: null, + data: JSON.stringify({ status: "completed" }), + }, + ]); +} + +function latestTimelineRows(db: DbConnection, thread: Thread): TimelineRow[] { + return buildThreadTimeline(db, thread, { + includeProviderUnhandledOperations: false, + maxSeq: 0, + page: { kind: "latest", segmentLimit: 20 }, + }).rows; +} + +function turnRows(rows: TimelineRow[]): TimelineTurnRow[] { + return rows.filter((row): row is TimelineTurnRow => row.kind === "turn"); +} + +function visibleCommandCount(rows: TimelineRow[]): number { + return rows.filter( + (row) => row.kind === "work" && row.workKind === "command", + ).length; +} + +/** Command pairs at sequences 10/11, 12/13, … (count pairs). */ +function insertCommandPairs( + db: DbConnection, + thread: Thread, + count: number, +): number { + let seq = 10; + for (let index = 0; index < count; index += 1) { + insertCommandPair({ db, thread, seq }); + seq += 2; + } + return seq; +} + +describe("active-turn collapse frontier", () => { + it("keeps small active turns fully flat", () => { + const { db, thread } = setup(); + insertTurnScaffold({ db, thread, requestValue: 1, startSeq: 1 }); + insertCommandPairs(db, thread, 40); + + const rows = latestTimelineRows(db, thread); + expect(turnRows(rows)).toEqual([]); + expect(visibleCommandCount(rows)).toBe(40); + }); + + it("collapses in chunk-aligned steps once the turn grows", () => { + const { db, thread } = setup(); + insertTurnScaffold({ db, thread, requestValue: 1, startSeq: 1 }); + insertCommandPairs(db, thread, 60); + + const rows = latestTimelineRows(db, thread); + const [partialRow] = turnRows(rows); + expect(partialRow).toBeDefined(); + expect(partialRow.partial).toBe(true); + expect(partialRow.turnId).toBe(TURN_ID); + // 60 completions → floor((60-24)/24)*24 = 24 collapsed, 36 visible. + expect(partialRow.summaryCount).toBe(24); + expect(visibleCommandCount(rows)).toBe(36); + + // 11 more completions stay within the chunk: frontier unchanged. + let seq = 10 + 60 * 2; + for (let index = 0; index < 11; index += 1) { + insertCommandPair({ db, thread, seq }); + seq += 2; + } + const withinChunkRows = latestTimelineRows(db, thread); + expect(turnRows(withinChunkRows)[0]?.summaryCount).toBe(24); + expect(visibleCommandCount(withinChunkRows)).toBe(47); + + // The next completion crosses the chunk boundary: one 24-item step. + insertCommandPair({ db, thread, seq }); + const nextChunkRows = latestTimelineRows(db, thread); + expect(turnRows(nextChunkRows)[0]?.summaryCount).toBe(48); + expect(visibleCommandCount(nextChunkRows)).toBe(24); + }); + + it("does not collapse completed turns via the frontier path", () => { + const { db, thread } = setup(); + insertTurnScaffold({ db, thread, requestValue: 1, startSeq: 1 }); + const seq = insertCommandPairs(db, thread, 60); + insertAssistantMessage({ db, thread, seq, text: "All done." }); + insertTurnCompleted({ db, thread, seq: seq + 1 }); + + const rows = latestTimelineRows(db, thread); + const [turnRow] = turnRows(rows); + expect(turnRow).toBeDefined(); + expect(turnRow.partial).toBe(false); + expect(turnRow.status).toBe("completed"); + expect(turnRow.summaryCount).toBe(60); + expect(visibleCommandCount(rows)).toBe(0); + }); +}); + +describe("buildTimelineTurnWorkPage", () => { + const pageBaseOptions = { + includeProviderUnhandledOperations: false, + turnId: TURN_ID, + }; + + function setupCompletedTurn(commandCount: number): { + db: DbConnection; + thread: Thread; + turnRow: TimelineTurnRow; + } { + const { db, thread } = setup(); + insertTurnScaffold({ db, thread, requestValue: 1, startSeq: 1 }); + const seq = insertCommandPairs(db, thread, commandCount); + insertAssistantMessage({ db, thread, seq, text: "All done." }); + insertTurnCompleted({ db, thread, seq: seq + 1 }); + const [turnRow] = turnRows(latestTimelineRows(db, thread)); + expect(turnRow).toBeDefined(); + return { db, thread, turnRow }; + } + + function pageCommands(rows: TimelineRow[]): string[] { + return rows.flatMap((row) => + row.kind === "work" && row.workKind === "command" ? [row.command] : [], + ); + } + + it("pages newest-first through a completed turn's work", () => { + const { db, thread, turnRow } = setupCompletedTurn(10); + + const firstPage = buildTimelineTurnWorkPage(db, thread, { + ...pageBaseOptions, + sourceSeqStart: turnRow.sourceSeqStart, + sourceSeqEnd: turnRow.sourceSeqEnd, + mode: { kind: "page", workItemLimit: 4 }, + }); + // Commands sit at 10/11 … 28/29; the summary row's range ends at the + // last work completion (the terminal message renders in the main + // timeline), so the newest 4-item page is exactly the last four commands. + expect(pageCommands(firstPage.rows)).toEqual([ + "echo 22", + "echo 24", + "echo 26", + "echo 28", + ]); + expect(firstPage.rows.some((row) => row.kind === "conversation")).toBe( + false, + ); + const firstCursor = firstPage.workPage?.earlierCursor; + expect(firstCursor).toEqual({ beforeSeq: 22 }); + + const secondPage = buildTimelineTurnWorkPage(db, thread, { + ...pageBaseOptions, + sourceSeqStart: turnRow.sourceSeqStart, + sourceSeqEnd: (firstCursor?.beforeSeq ?? 0) - 1, + mode: { kind: "page", workItemLimit: 4 }, + }); + expect(pageCommands(secondPage.rows)).toEqual([ + "echo 14", + "echo 16", + "echo 18", + "echo 20", + ]); + + const thirdPage = buildTimelineTurnWorkPage(db, thread, { + ...pageBaseOptions, + sourceSeqStart: turnRow.sourceSeqStart, + sourceSeqEnd: (secondPage.workPage?.earlierCursor?.beforeSeq ?? 0) - 1, + mode: { kind: "page", workItemLimit: 4 }, + }); + expect(pageCommands(thirdPage.rows)).toEqual(["echo 10", "echo 12"]); + expect(thirdPage.workPage).toEqual({ earlierCursor: null }); + }); + + it("serves an exact catch-up range", () => { + const { db, thread, turnRow } = setupCompletedTurn(10); + + const range = buildTimelineTurnWorkPage(db, thread, { + ...pageBaseOptions, + sourceSeqStart: turnRow.sourceSeqStart, + sourceSeqEnd: 17, + mode: { kind: "range", afterSeq: 13 }, + }); + expect(pageCommands(range.rows)).toEqual(["echo 14", "echo 16"]); + expect(range.workPage).toBeNull(); + + const emptyRange = buildTimelineTurnWorkPage(db, thread, { + ...pageBaseOptions, + sourceSeqStart: turnRow.sourceSeqStart, + sourceSeqEnd: 13, + mode: { kind: "range", afterSeq: 13 }, + }); + expect(emptyRange.rows).toEqual([]); + }); + + it("degrades to an empty page when the window has no rows for the turn", () => { + const { db, thread, turnRow } = setupCompletedTurn(2); + + const page = buildTimelineTurnWorkPage(db, thread, { + ...pageBaseOptions, + turnId: "turn-missing", + sourceSeqStart: turnRow.sourceSeqStart, + sourceSeqEnd: turnRow.sourceSeqEnd, + mode: { kind: "page", workItemLimit: 4 }, + }); + expect(page.rows).toEqual([]); + expect(page.workPage).toEqual({ earlierCursor: null }); + }); +}); + +describe("conversation outline targeted selection", () => { + it("matches the timeline's top-level conversation rows", () => { + const { db, thread } = setup(); + let seq = insertTurnScaffold({ + db, + thread, + requestValue: 1, + startSeq: 1, + promptText: "First prompt.", + }); + insertCommandPair({ db, thread, seq }); + seq += 2; + // Interim assistant message: folded into the completed turn's summary, so + // it must NOT surface as an outline item. + insertAssistantMessage({ db, thread, seq, text: "Interim thoughts." }); + seq += 1; + insertCommandPair({ db, thread, seq }); + seq += 2; + insertAssistantMessage({ db, thread, seq, text: "First final answer." }); + insertTurnCompleted({ db, thread, seq: seq + 1 }); + seq += 2; + + seq = insertTurnScaffold({ + db, + thread, + requestValue: 2, + startSeq: seq, + turnId: "turn-2", + promptText: "Second prompt.", + }); + insertCommandPair({ db, thread, seq, turnId: "turn-2" }); + seq += 2; + insertAssistantMessage({ + db, + thread, + seq, + text: "Second final answer.", + turnId: "turn-2", + }); + insertTurnCompleted({ db, thread, seq: seq + 1, turnId: "turn-2" }); + + const outline = buildThreadConversationOutline(db, thread, { maxSeq: 0 }); + const timelineConversationRows = latestTimelineRows(db, thread).filter( + (row) => row.kind === "conversation", + ); + + expect(outline.items.map((item) => item.id)).toEqual( + timelineConversationRows.map((row) => row.id), + ); + expect(outline.items.map((item) => item.preview)).toEqual([ + "First prompt.", + "First final answer.", + "Second prompt.", + "Second final answer.", + ]); + }); +}); diff --git a/packages/db/src/data/events.ts b/packages/db/src/data/events.ts index 751f89178f..26813c3b77 100644 --- a/packages/db/src/data/events.ts +++ b/packages/db/src/data/events.ts @@ -1654,6 +1654,173 @@ export function listRecentStoredEventRows( .all(); } +export interface ListStoredConversationOutlineEventRowsArgs { + threadId: string; +} + +/** + * The conversation outline renders only user/assistant messages. Selecting + * command, tool, diff, goal, and usage events made its cost scale with all + * work performed in a thread even though none of those rows can reach the + * result. Turn lifecycle and error events are still selected — they are one + * row per turn and they decide completed-turn grouping, which determines + * whether an interim assistant message is (correctly) folded away instead of + * surfacing as an outline item the timeline never renders. + */ +export function listStoredConversationOutlineEventRows( + db: DbConnection, + args: ListStoredConversationOutlineEventRowsArgs, +): StoredEventRow[] { + const directConversationTypes = [ + "client/turn/requested", + "turn/input/accepted", + "turn/started", + "turn/completed", + "provider/error", + "system/error", + "system/thread/interrupted", + "item/agentMessage/delta", + "system/manager/user_message", + ] satisfies ThreadEventType[]; + const agentItemTypes = [ + "item/started", + "item/completed", + ] satisfies ThreadEventType[]; + + return db + .select(storedEventRowFields) + .from(events) + .where( + and( + eq(events.threadId, args.threadId), + or( + inArray(events.type, directConversationTypes), + and( + inArray(events.type, agentItemTypes), + or( + eq(events.itemKind, "agentMessage"), + sql`json_extract(${events.data}, '$.item.type') = 'agentMessage'`, + ), + ), + ), + ), + ) + .orderBy(events.sequence) + .all(); +} + +/** + * A "work item completion" is an `item/completed` event whose item is not + * reasoning — the unit the timeline's turn-work pagination and the active-turn + * collapse frontier count in. Reasoning completions are excluded because they + * never render as work rows, so counting them would make page sizes drift with + * how chatty a model's thinking is. + */ +function turnWorkItemCompletionConditions(args: { + threadId: string; + turnId: string; +}): SQL | undefined { + return and( + eq(events.threadId, args.threadId), + eq(events.turnId, args.turnId), + eq(events.type, "item/completed"), + sql`(${events.itemKind} IS NULL OR ${events.itemKind} <> 'reasoning')`, + ); +} + +export interface ListTurnWorkItemCompletionSequencesDescendingArgs { + threadId: string; + turnId: string; + /** Inclusive lower sequence bound. */ + sequenceStart: number; + /** Inclusive upper sequence bound. */ + sequenceEnd: number; + limit: number; +} + +export function listTurnWorkItemCompletionSequencesDescending( + db: DbConnection, + args: ListTurnWorkItemCompletionSequencesDescendingArgs, +): number[] { + return db + .select({ sequence: events.sequence }) + .from(events) + .where( + and( + turnWorkItemCompletionConditions(args), + gte(events.sequence, args.sequenceStart), + lte(events.sequence, args.sequenceEnd), + ), + ) + .orderBy(desc(events.sequence)) + .limit(args.limit) + .all() + .map((row) => row.sequence); +} + +export interface CountTurnWorkItemCompletionsArgs { + threadId: string; + turnId: string; +} + +export function countTurnWorkItemCompletions( + db: DbConnection, + args: CountTurnWorkItemCompletionsArgs, +): number { + const row = db + .select({ count: sql`count(*)` }) + .from(events) + .where(turnWorkItemCompletionConditions(args)) + .get(); + return row?.count ?? 0; +} + +export interface GetTurnWorkItemCompletionSequenceByIndexArgs { + threadId: string; + turnId: string; + /** Zero-based index in ascending sequence order. */ + index: number; +} + +export function getTurnWorkItemCompletionSequenceByIndex( + db: DbConnection, + args: GetTurnWorkItemCompletionSequenceByIndexArgs, +): number | null { + const row = db + .select({ sequence: events.sequence }) + .from(events) + .where(turnWorkItemCompletionConditions(args)) + .orderBy(events.sequence) + .limit(1) + .offset(args.index) + .get(); + return row?.sequence ?? null; +} + +export interface HasTurnCompletedEventArgs { + threadId: string; + turnId: string; +} + +export function hasTurnCompletedEvent( + db: DbConnection, + args: HasTurnCompletedEventArgs, +): boolean { + const row = db + .select({ sequence: events.sequence }) + .from(events) + .where( + and( + eq(events.threadId, args.threadId), + eq(events.turnId, args.turnId), + eq(events.type, "turn/completed"), + ), + ) + .limit(1) + .get(); + return row !== undefined; +} + export interface StandardTimelineSegmentAnchorRow { rowId: string; sequence: number; diff --git a/packages/db/src/data/index.ts b/packages/db/src/data/index.ts index 28b67a3dd0..485df51030 100644 --- a/packages/db/src/data/index.ts +++ b/packages/db/src/data/index.ts @@ -291,9 +291,13 @@ export { appendStoredThreadEvent, appendStoredThreadEventInTransaction, appendStoredThreadEventsInTransaction, + countTurnWorkItemCompletions, findStoredClientTurnRequestSequenceByRequestId, findStoredEventRow, getActiveStoredTurnId, + getTurnWorkItemCompletionSequenceByIndex, + hasTurnCompletedEvent, + listTurnWorkItemCompletionSequencesDescending, hasRootStoredTurnStarted, hasStoredTurnStarted, getLastStoredProviderThreadId, @@ -309,6 +313,7 @@ export { listCompletedTurnsByThreadIds, listEvents, listRecentStoredEventRows, + listStoredConversationOutlineEventRows, listTimelineSegmentAnchorsDescending, findTimelineSegmentAnchorSequenceAfter, getTimelineSegmentAnchorAtSequence, diff --git a/packages/plugin-sdk/bundled-types/bb-plugin-sdk.d.ts b/packages/plugin-sdk/bundled-types/bb-plugin-sdk.d.ts index ebbdf423db..64db880b74 100644 --- a/packages/plugin-sdk/bundled-types/bb-plugin-sdk.d.ts +++ b/packages/plugin-sdk/bundled-types/bb-plugin-sdk.d.ts @@ -6556,9 +6556,9 @@ declare const terminalSessionSchema: z$1.ZodObject<{ cols: z$1.ZodNumber; rows: z$1.ZodNumber; status: z$1.ZodEnum<{ + running: "running"; starting: "starting"; disconnected: "disconnected"; - running: "running"; exited: "exited"; }>; exitCode: z$1.ZodNullable; @@ -6587,9 +6587,9 @@ declare const terminalListResponseSchema: z$1.ZodObject<{ cols: z$1.ZodNumber; rows: z$1.ZodNumber; status: z$1.ZodEnum<{ + running: "running"; starting: "starting"; disconnected: "disconnected"; - running: "running"; exited: "exited"; }>; exitCode: z$1.ZodNullable; @@ -7285,6 +7285,15 @@ interface TimelineTurnRow extends TimelineRowBase { status: TimelineRowStatus; summaryCount: number; completedAt: number | null; + /** + * True while the turn is still running and this row summarizes only the + * finished prefix of its work — the live tail renders as sibling rows below. + * On turn completion the row converges to the normal completed summary + * (`partial: false`) at the same row id. `completedAt` on a partial row is + * the time of the newest collapsed work, so "Worked so far (…)" durations + * reflect covered work rather than the whole turn. + */ + partial: boolean; children: TimelineRow[] | null; } type TimelineSourceRow = TimelineConversationRow | TimelineWorkRow | TimelineSystemRow; @@ -8636,6 +8645,8 @@ declare const timelineTurnSummaryDetailsQuerySchema: z$1.ZodObject<{ turnId: z$1.ZodString; sourceSeqStart: z$1.ZodString; sourceSeqEnd: z$1.ZodString; + workItemLimit: z$1.ZodOptional; + afterSeq: z$1.ZodOptional; }, z$1.core.$strip>; type TimelineTurnSummaryDetailsQuery = z$1.infer; declare const threadStorageFilesQuerySchema: z$1.ZodObject<{ @@ -8658,6 +8669,11 @@ declare const threadStoragePathsQuerySchema: z$1.ZodObject<{ type ThreadStoragePathsQuery = z$1.infer; declare const timelineTurnSummaryDetailsResponseSchema: z$1.ZodObject<{ rows: z$1.ZodArray>>; + workPage: z$1.ZodNullable>; + }, z$1.core.$strict>>; }, z$1.core.$strip>; type TimelineTurnSummaryDetailsResponse = z$1.infer; declare const threadTimelineResponseSchema: z$1.ZodObject<{ @@ -8842,8 +8858,8 @@ declare const threadTimelineResponseSchema: z$1.ZodObject<{ updatedAt: z$1.ZodNumber; objective: z$1.ZodString; status: z$1.ZodEnum<{ - active: "active"; paused: "paused"; + active: "active"; budgetLimited: "budgetLimited"; complete: "complete"; }>; diff --git a/packages/server-contract/src/api/threads.ts b/packages/server-contract/src/api/threads.ts index b2dbb6fa3e..5124087cfe 100644 --- a/packages/server-contract/src/api/threads.ts +++ b/packages/server-contract/src/api/threads.ts @@ -584,11 +584,45 @@ export const timelineTurnSummaryDetailsQuerySchema = z.object({ turnId: z.string().min(1), sourceSeqStart: z.string().regex(/^\d+$/), sourceSeqEnd: z.string().regex(/^\d+$/), + /** + * Work-item pagination for large turns. When present, the response contains + * only the newest `workItemLimit` work items at or below `sourceSeqEnd` + * (instead of the whole range) plus `workPage` metadata with a cursor for + * progressively revealing earlier work. Omitted = full detail (legacy + * behavior, still used for small turns). + */ + workItemLimit: z.string().regex(/^[1-9]\d*$/).optional(), + /** + * Lower sequence bound (exclusive) for a fixed-range fetch. Used to append + * work that collapsed into a partial turn summary after the client's last + * fetch: the response covers (afterSeq, sourceSeqEnd] exactly and carries no + * pagination metadata. Mutually exclusive with `workItemLimit`. + */ + afterSeq: z.string().regex(/^\d+$/).optional(), }); export type TimelineTurnSummaryDetailsQuery = z.infer< typeof timelineTurnSummaryDetailsQuerySchema >; +export const timelineTurnWorkPageCursorSchema = z + .object({ + /** Request the next-older page with `sourceSeqEnd = beforeSeq - 1`. */ + beforeSeq: z.number().int().positive(), + }) + .strict(); +export type TimelineTurnWorkPageCursor = z.infer< + typeof timelineTurnWorkPageCursorSchema +>; + +export const timelineTurnWorkPageMetadataSchema = z + .object({ + earlierCursor: timelineTurnWorkPageCursorSchema.nullable(), + }) + .strict(); +export type TimelineTurnWorkPageMetadata = z.infer< + typeof timelineTurnWorkPageMetadataSchema +>; + export const threadEventsQuerySchema = z .object({ afterSeq: z.string().regex(/^\d+$/), @@ -654,6 +688,11 @@ export type TimelineTurnSummaryDetailsRequest = z.infer< export const timelineTurnSummaryDetailsResponseSchema = z.object({ rows: z.array(timelineRowSchema), + /** + * Present only on `workItemLimit` (paged) requests. `earlierCursor` is null + * once the page reaches `sourceSeqStart`. + */ + workPage: timelineTurnWorkPageMetadataSchema.nullable(), }); export type TimelineTurnSummaryDetailsResponse = z.infer< typeof timelineTurnSummaryDetailsResponseSchema diff --git a/packages/server-contract/src/thread-timeline.ts b/packages/server-contract/src/thread-timeline.ts index c844d84e0c..0fca15fdea 100644 --- a/packages/server-contract/src/thread-timeline.ts +++ b/packages/server-contract/src/thread-timeline.ts @@ -483,6 +483,15 @@ export interface TimelineTurnRow extends TimelineRowBase { status: TimelineRowStatus; summaryCount: number; completedAt: number | null; + /** + * True while the turn is still running and this row summarizes only the + * finished prefix of its work — the live tail renders as sibling rows below. + * On turn completion the row converges to the normal completed summary + * (`partial: false`) at the same row id. `completedAt` on a partial row is + * the time of the newest collapsed work, so "Worked so far (…)" durations + * reflect covered work rather than the whole turn. + */ + partial: boolean; children: TimelineRow[] | null; } @@ -493,6 +502,7 @@ export const timelineTurnRowSchema: z.ZodType = z.lazy(() => status: timelineRowStatusSchema, summaryCount: z.number().int().nonnegative(), completedAt: z.number().nullable(), + partial: z.boolean(), children: z.array(timelineRowSchema).nullable(), }), ); diff --git a/packages/server-contract/test/contract.test.ts b/packages/server-contract/test/contract.test.ts index 073f4b2d96..2540119bc3 100644 --- a/packages/server-contract/test/contract.test.ts +++ b/packages/server-contract/test/contract.test.ts @@ -232,6 +232,14 @@ const OPTIONAL_SERVER_FIELD_GROUPS: readonly OptionalServerFieldGroup[] = [ "threadTimelineQuerySchema.afterSequence", ], }, + { + reason: + "Turn work detail requests omit both paging selectors for legacy full detail; workItemLimit asks for the newest page of a large turn, afterSeq for a fixed catch-up range, and the two are mutually exclusive.", + fields: [ + "timelineTurnSummaryDetailsQuerySchema.workItemLimit", + "timelineTurnSummaryDetailsQuerySchema.afterSeq", + ], + }, { reason: "Timeline responses omit context-window usage when the provider did not report it.", @@ -1025,9 +1033,22 @@ describe("server-contract canonical schemas", () => { ).toThrow("Project path must be an absolute path."); expect( - timelineTurnSummaryDetailsResponseSchema.parse({ rows: [] }), + timelineTurnSummaryDetailsResponseSchema.parse({ + rows: [], + workPage: null, + }), + ).toEqual({ + rows: [], + workPage: null, + }); + expect( + timelineTurnSummaryDetailsResponseSchema.parse({ + rows: [], + workPage: { earlierCursor: { beforeSeq: 42 } }, + }), ).toEqual({ rows: [], + workPage: { earlierCursor: { beforeSeq: 42 } }, }); }); diff --git a/packages/thread-view/src/build-thread-timeline.ts b/packages/thread-view/src/build-thread-timeline.ts index 73ae0dbf0b..6c7374c85d 100644 --- a/packages/thread-view/src/build-thread-timeline.ts +++ b/packages/thread-view/src/build-thread-timeline.ts @@ -53,6 +53,7 @@ import { parsePendingSteersFromClientRequest } from "./user-message-parsing.js"; import { getOrderedThreadEvents } from "./group-event-projection-turns.js"; import { groupCompletedTurnMessages, + groupPartialTurnMessages, type CompletedTurnSummaryItem, } from "./completed-turn-grouping.js"; import { extractThreadContextWindowUsage } from "./thread-context-window-usage.js"; @@ -97,6 +98,16 @@ interface ThreadTimelineFromEventsBaseOptions { * the thread has no environment (the path is then left as-is). */ workspaceRoot: string | null; + /** + * Per-turn collapse frontiers for in-flight turns (turnId → event sequence). + * Settled work at or before the frontier collapses into a partial + * "Worked so far" turn summary row instead of rendering flat, bounding row + * count and payload for very long-running turns. Computed by the server from + * an indexed work-item-completion query with chunked hysteresis, so it only + * moves in coarse steps. Absent (or a turn missing from the map) = today's + * fully-flat active-turn rendering. + */ + activeTurnCollapseFrontiers?: ReadonlyMap; } export interface ThreadTimelineFromEventsOptions extends ThreadTimelineFromEventsBaseOptions { @@ -157,6 +168,7 @@ export type ThreadTimelineTurnDetailsFromEventsResult = }; interface BuildTurnRowsArgs { + collapseFrontierSeq?: number; includeNestedRows: boolean; rowIdPrefix: string; turn: EventProjectionTurn; @@ -173,6 +185,7 @@ interface TimelineMessageBounds { interface BuildTurnSummaryRowArgs { completedAt: number | null; includeNestedRows: boolean; + partial: boolean; rowIdPrefix: string; segmentIndex: number | null; sourceMessages: EventProjectionMessage[]; @@ -182,8 +195,9 @@ interface BuildTurnSummaryRowArgs { turn: EventProjectionTurn; } -interface BuildCompletedTurnSummaryRowsArgs { +interface BuildTurnSummaryItemRowsArgs { includeNestedRows: boolean; + partial: boolean; rowIdPrefix: string; summaryItems: CompletedTurnSummaryItem[]; turn: EventProjectionTurn; @@ -191,6 +205,7 @@ interface BuildCompletedTurnSummaryRowsArgs { } interface BuildTimelineRowsOptions { + activeTurnCollapseFrontiers?: ReadonlyMap; includeNestedRows: boolean; rowIdPrefix: string; workspaceRoot: string | null; @@ -955,6 +970,7 @@ function getTurnBounds(turn: EventProjectionTurn): TimelineMessageBounds { function buildTurnSummaryRow({ completedAt, includeNestedRows, + partial, rowIdPrefix, segmentIndex, sourceMessages, @@ -968,7 +984,7 @@ function buildTurnSummaryRow({ } const bounds = - segmentIndex === null || sourceMessages.length === 0 + (segmentIndex === null && !partial) || sourceMessages.length === 0 ? getTurnBounds(turn) : getTimelineMessageBounds(sourceMessages); const rowId = @@ -990,17 +1006,19 @@ function buildTurnSummaryRow({ status: turn.status, summaryCount, completedAt: resolvedCompletedAt, + partial, children: includeNestedRows ? sourceRows : null, }; } -function buildCompletedTurnSummaryRows({ +function buildTurnSummaryItemRows({ includeNestedRows, + partial, rowIdPrefix, summaryItems, turn, workspaceRoot, -}: BuildCompletedTurnSummaryRowsArgs): TimelineRow[] { +}: BuildTurnSummaryItemRowsArgs): TimelineRow[] { const rows: TimelineRow[] = []; for (const item of summaryItems) { if (item.kind === "ungrouped-message") { @@ -1026,6 +1044,7 @@ function buildCompletedTurnSummaryRows({ const turnRow = buildTurnSummaryRow({ completedAt: item.completedAt, includeNestedRows, + partial, rowIdPrefix, segmentIndex: item.segmentIndex, sourceMessages: item.sourceMessages, @@ -1041,17 +1060,43 @@ function buildCompletedTurnSummaryRows({ return rows; } -function buildTurnRows({ +function buildPartialTurnRows({ + collapseFrontierSeq, includeNestedRows, rowIdPrefix, turn, workspaceRoot, -}: BuildTurnRowsArgs): TimelineRow[] { +}: BuildTurnRowsArgs & { collapseFrontierSeq: number }): TimelineRow[] { + const { summaryItems, tailMessages } = groupPartialTurnMessages( + turn, + collapseFrontierSeq, + ); + const summaryRows = buildTurnSummaryItemRows({ + includeNestedRows, + partial: true, + rowIdPrefix, + summaryItems, + turn, + workspaceRoot, + }); + const tailRows = tailMessages.flatMap((message) => + convertMessage(message, { includeNestedRows, rowIdPrefix, workspaceRoot }), + ); + return [...summaryRows, ...tailRows]; +} + +function buildTurnRows(args: BuildTurnRowsArgs): TimelineRow[] { + const { collapseFrontierSeq, includeNestedRows, rowIdPrefix, workspaceRoot } = + args; + const turn = args.turn; const messages = turn.messages ?? []; const isCompletedTurn = turn.status !== "pending" && turn.completedAt !== null; if (!isCompletedTurn) { + if (collapseFrontierSeq !== undefined) { + return buildPartialTurnRows({ ...args, collapseFrontierSeq }); + } return messages.flatMap((message) => convertMessage(message, { includeNestedRows, @@ -1069,8 +1114,9 @@ function buildTurnRows({ const trailingRows = trailingMessages.flatMap((message) => convertMessage(message, { includeNestedRows, rowIdPrefix, workspaceRoot }), ); - const summaryRows = buildCompletedTurnSummaryRows({ + const summaryRows = buildTurnSummaryItemRows({ includeNestedRows, + partial: false, rowIdPrefix, summaryItems, turn, @@ -1175,6 +1221,9 @@ function buildTimelineRows( rows, buildTurnRows({ turn: entry.turn, + collapseFrontierSeq: options.activeTurnCollapseFrontiers?.get( + entry.turn.turnId, + ), includeNestedRows, rowIdPrefix: options.rowIdPrefix, workspaceRoot: options.workspaceRoot, @@ -1210,6 +1259,7 @@ export function buildThreadTimelineFromEvents( const rows = [ ...buildTimelineRows(projection, { + activeTurnCollapseFrontiers: args.options.activeTurnCollapseFrontiers, includeNestedRows: args.options.includeNestedRows, rowIdPrefix: ROOT_TIMELINE_ROW_ID_PREFIX, workspaceRoot: args.options.workspaceRoot, @@ -1261,6 +1311,110 @@ export function buildThreadTimelineFromEvents( }; } +export interface BuildThreadTimelineTurnWorkPageFromEventsOptions { + includeProviderUnhandledOperations: boolean; + providerDisplayName?: string; + threadStatus: Thread["status"]; + /** See {@link ThreadTimelineFromEventsBaseOptions.threadName}. */ + threadName: string; + /** + * Whether the requested turn has finished (a `turn/completed` event exists). + * Work that still projects as pending inside a finished turn's page window + * never completed — it is reported as interrupted, matching turn + * finalization. Inside a still-running turn, pending work is dropped from + * the page instead: it renders live in the visible tail. + */ + turnFinished: boolean; + turnId: string; + /** See {@link ThreadTimelineFromEventsBaseOptions.workspaceRoot}. */ + workspaceRoot: string | null; +} + +export interface BuildThreadTimelineTurnWorkPageFromEventsArgs { + events: ThreadEventWithMeta[]; + options: BuildThreadTimelineTurnWorkPageFromEventsOptions; +} + +function isPendingStatusRow(row: TimelineRow): boolean { + switch (row.kind) { + case "work": + return row.status === "pending"; + case "system": + return row.status === "pending"; + case "conversation": + case "turn": + return false; + default: + return assertNever(row); + } +} + +function finalizePendingStatusRow(row: TimelineRow): TimelineRow { + if (row.kind === "work" && row.status === "pending") { + return { ...row, status: "interrupted" }; + } + if (row.kind === "system" && row.status === "pending") { + return { ...row, status: "interrupted" }; + } + return row; +} + +/** + * Projects one page window of a turn's work into detail rows for the + * "Worked for…" / "Worked so far" expansion. Unlike + * {@link buildThreadTimelineTurnDetailsFromEvents} this accepts windows that + * cover only part of the turn: when the window includes the turn's completion + * the completed-turn grouping applies and the summary children are returned + * (terminal and trailing rows are already rendered in the main timeline); + * when it does not, the turn projects as in-flight and the flat work rows are + * returned directly. Rows the main timeline renders at the top level — user + * messages, ungroupable system/debug rows — are filtered out so a page never + * duplicates them. + */ +export function buildThreadTimelineTurnWorkPageFromEvents( + args: BuildThreadTimelineTurnWorkPageFromEventsArgs, +): TimelineRow[] { + const projection = buildEventProjectionEntries(args.events, { + includeDebugRawEvents: false, + includeProviderUnhandledOperations: + args.options.includeProviderUnhandledOperations, + providerDisplayName: args.options.providerDisplayName, + threadStatus: args.options.threadStatus, + threadName: args.options.threadName, + turnMessageDetail: "full", + }); + const rows = buildTimelineRows(projection, { + includeNestedRows: true, + rowIdPrefix: ROOT_TIMELINE_ROW_ID_PREFIX, + workspaceRoot: args.options.workspaceRoot, + }); + + const turnSummaryRows = rows.filter( + (row): row is TimelineTurnSummaryRow => + row.kind === "turn" && row.turnId === args.options.turnId, + ); + const pageRows = + turnSummaryRows.length > 0 + ? turnSummaryRows.flatMap((row) => row.children ?? []) + : rows.filter((row) => { + if (row.kind === "conversation" && row.role === "user") { + return false; + } + if (row.kind === "system" && row.systemKind === "debug") { + return false; + } + if (row.kind === "turn") { + return false; + } + return true; + }); + + if (args.options.turnFinished) { + return pageRows.map((row) => finalizePendingStatusRow(row)); + } + return pageRows.filter((row) => !isPendingStatusRow(row)); +} + export function buildThreadTimelineTurnDetailsFromEvents( args: BuildThreadTimelineTurnDetailsFromEventsArgs, ): ThreadTimelineTurnDetailsFromEventsResult { diff --git a/packages/thread-view/src/completed-turn-grouping.ts b/packages/thread-view/src/completed-turn-grouping.ts index 37a4b0f519..1a874539f0 100644 --- a/packages/thread-view/src/completed-turn-grouping.ts +++ b/packages/thread-view/src/completed-turn-grouping.ts @@ -4,7 +4,10 @@ import type { } from "./event-projection-types.js"; import { getProjectionSummaryCount } from "./apply-turn-message-detail.js"; import { getMessageStartedAt } from "./format-helpers.js"; -import { isTimelineUngroupableMessage } from "./timeline-message-helpers.js"; +import { + isSettledTimelineMessage, + isTimelineUngroupableMessage, +} from "./timeline-message-helpers.js"; export interface CompletedTurnSummaryGroup { kind: "summary"; @@ -135,7 +138,15 @@ function groupCompletedTurnSummaryMessages( completedAt: turn.completedAt, segmentIndex: null, sourceMessages: summaryMessages, - summaryCount: turn.summaryCount, + // Derived from the given messages when they are available: for a + // completed turn that equals turn.summaryCount (counting stops at the + // terminal message), but a partial collapse passes only the settled + // prefix. Summary-detail projections drop a completed turn's messages + // entirely, leaving turn.summaryCount as the only carrier. + summaryCount: + summaryMessages.length === 0 + ? turn.summaryCount + : getProjectionSummaryCount(summaryMessages, undefined), }, ]; } @@ -204,3 +215,45 @@ export function groupCompletedTurnMessages( trailingMessages, }; } + +export interface PartialTurnMessageGroups { + /** + * Grouped summary items for the collapsed prefix, built with the same + * segmentation as {@link groupCompletedTurnMessages} so row ids and boundary + * splits stay stable when the turn later completes. + */ + summaryItems: CompletedTurnSummaryItem[]; + /** Messages that stay flat below the collapse: everything after the frontier plus unsettled work before it. */ + tailMessages: EventProjectionMessage[]; +} + +/** + * Splits an in-flight turn's messages at the collapse frontier. Messages whose + * source range ends at or before the frontier and whose work is settled form + * the collapsed prefix; everything else (newer work, running commands, waiting + * approvals/questions) stays visible. The prefix is grouped exactly like a + * completed turn so the resulting summary rows keep their identity across the + * turn-completion transition. + */ +export function groupPartialTurnMessages( + turn: EventProjectionTurn, + collapseFrontierSeq: number, +): PartialTurnMessageGroups { + const messages = turn.messages ?? []; + const prefixMessages: EventProjectionMessage[] = []; + const tailMessages: EventProjectionMessage[] = []; + for (const message of messages) { + if ( + message.sourceSeqEnd <= collapseFrontierSeq && + isSettledTimelineMessage(message) + ) { + prefixMessages.push(message); + continue; + } + tailMessages.push(message); + } + return { + summaryItems: groupCompletedTurnSummaryMessages(turn, prefixMessages), + tailMessages, + }; +} diff --git a/packages/thread-view/src/index.ts b/packages/thread-view/src/index.ts index 48bc23a5e3..9e317e1d45 100644 --- a/packages/thread-view/src/index.ts +++ b/packages/thread-view/src/index.ts @@ -42,6 +42,7 @@ export type { FileChangeAction } from "./file-change-summary.js"; export { buildThreadTimelineFromEvents, buildThreadTimelineTurnDetailsFromEvents, + buildThreadTimelineTurnWorkPageFromEvents, } from "./build-thread-timeline.js"; export { extractThreadTimelineActivePromptMode } from "./active-prompt-mode-extraction.js"; export { extractThreadTimelineGoal } from "./goal-snapshot-extraction.js"; diff --git a/packages/thread-view/src/timeline-message-helpers.ts b/packages/thread-view/src/timeline-message-helpers.ts index 574d7e9f9c..577e9b6076 100644 --- a/packages/thread-view/src/timeline-message-helpers.ts +++ b/packages/thread-view/src/timeline-message-helpers.ts @@ -34,6 +34,49 @@ export function isTimelineSummaryCountedMessage( return !isTimelineUngroupableMessage(message); } +/** + * Whether a message's work is finished — nothing about it can still change + * except through later events that would extend its source range. Only settled + * messages are eligible for the partial-turn collapse: running commands, + * waiting approvals, unanswered questions, and live background tasks must stay + * visible while their turn is active. + */ +export function isSettledTimelineMessage( + message: EventProjectionMessage, +): boolean { + switch (message.kind) { + case "command": + case "tool-call": + case "file-edit": + case "web-search": + case "web-fetch": + case "image-view": + case "delegation": + return message.status !== "pending"; + case "workflow": + return message.status !== "pending"; + case "permission-grant-lifecycle": + return ( + message.lifecycle === "granted" || + message.lifecycle === "denied" || + message.lifecycle === "interrupted" + ); + case "user-question-lifecycle": + return ( + message.lifecycle === "answered" || + message.lifecycle === "interrupted" + ); + case "assistant-text": + return message.status !== "streaming"; + case "operation": + return message.status !== "pending"; + case "user": + case "error": + case "debug/raw-event": + return true; + } +} + export function findLastTerminalTimelineMessage( messages: readonly EventProjectionMessage[], ): EventProjectionMessage | undefined { diff --git a/packages/thread-view/src/timeline-row-title.ts b/packages/thread-view/src/timeline-row-title.ts index af2f728fa6..4d0e8db322 100644 --- a/packages/thread-view/src/timeline-row-title.ts +++ b/packages/thread-view/src/timeline-row-title.ts @@ -1261,6 +1261,20 @@ function mapWorkSummaryTitle( } function mapTurnTitle(row: TimelineViewTurnRow): TimelineTitle { + if (row.partial) { + // A partial summary covers only the finished prefix of a still-running + // turn; the live tail renders below it. It reads as a settled recap + // ("Worked so far (2h 5m)") — never the shimmering "Working" treatment, + // which belongs to the turn's live frontier. + const partialDurationDeco = completedTurnDurationDecoration( + row.startedAt, + row.completedAt, + ); + return makeTitle({ + segments: [segment("Worked so far", { shimmer: false, accent: "subtle" })], + decorations: partialDurationDeco === null ? [] : [partialDurationDeco], + }); + } const isPending = row.status === "pending"; const durationDeco = isPending ? durationDecoration(row.startedAt, row.completedAt, { em: true }) diff --git a/packages/thread-view/test/partial-turn-collapse.test.ts b/packages/thread-view/test/partial-turn-collapse.test.ts new file mode 100644 index 0000000000..667377f8a5 --- /dev/null +++ b/packages/thread-view/test/partial-turn-collapse.test.ts @@ -0,0 +1,310 @@ +import { describe, expect, it } from "vitest"; +import type { ThreadEventRow } from "@bb/domain"; +import type { TimelineRow, TimelineTurnRow } from "@bb/server-contract"; +import { + buildThreadTimelineFromEvents, + buildThreadTimelineTurnWorkPageFromEvents, +} from "../src/index.js"; +import { EMPTY_ACCEPTED_CLIENT_REQUEST_CONTEXT } from "../src/accepted-client-request-context.js"; +import { + createTimelineEventFactory, + fromRows, +} from "./timeline-test-harness.js"; + +const BASE_OPTIONS = { + includeDebugRawEvents: false, + includeNestedRows: false, + includeProviderUnhandledOperations: false, + isLatestPage: true, + threadStatus: "active" as const, + threadName: "", + turnMessageDetail: "summary" as const, + workspaceRoot: null, +}; + +interface CommandPairArgs { + seq: number; +} + +function buildTimelineRowsFromEvents( + rows: ThreadEventRow[], + overrides: Partial[0]["options"]> = {}, +): TimelineRow[] { + return buildThreadTimelineFromEvents({ + acceptedClientRequestContext: EMPTY_ACCEPTED_CLIENT_REQUEST_CONTEXT, + contextWindowEvents: [], + events: fromRows(rows), + options: { ...BASE_OPTIONS, ...overrides }, + }).rows; +} + +function turnRows(rows: TimelineRow[]): TimelineTurnRow[] { + return rows.filter((row): row is TimelineTurnRow => row.kind === "turn"); +} + +function commandRowCommands(rows: TimelineRow[]): string[] { + return rows.flatMap((row) => + row.kind === "work" && row.workKind === "command" ? [row.command] : [], + ); +} + +describe("active-turn partial collapse", () => { + const event = () => createTimelineEventFactory({ threadId: "thread-1" }); + + function commandPair( + factory: ReturnType, + { seq }: CommandPairArgs, + ): ThreadEventRow[] { + return [ + factory.commandStarted({ + seq, + itemId: `cmd-${seq}`, + command: `echo ${seq}`, + }), + factory.commandCompleted({ + seq: seq + 1, + itemId: `cmd-${seq}`, + command: `echo ${seq}`, + aggregatedOutput: `out ${seq}`, + exitCode: 0, + }), + ]; + } + + function activeTurnEvents(factory: ReturnType): ThreadEventRow[] { + return [ + factory.clientTurnRequested({ + seq: 1, + requestId: "creq_23456789ab", + text: "do the work", + }), + factory.turnStarted({ seq: 2 }), + factory.inputAccepted({ seq: 3, clientRequestId: "creq_23456789ab" }), + // A long-running command that never completes: settled-ness, not + // sequence position, must decide visibility. + factory.commandStarted({ + seq: 8, + itemId: "cmd-pending", + command: "sleep infinity", + }), + ...commandPair(factory, { seq: 10 }), + ...commandPair(factory, { seq: 12 }), + ...commandPair(factory, { seq: 14 }), + ...commandPair(factory, { seq: 16 }), + ...commandPair(factory, { seq: 18 }), + ]; + } + + it("collapses settled work at or before the frontier into a partial turn row", () => { + const factory = event(); + const rows = buildTimelineRowsFromEvents(activeTurnEvents(factory), { + activeTurnCollapseFrontiers: new Map([["turn-1", 15]]), + }); + + const [partialRow] = turnRows(rows); + expect(partialRow).toBeDefined(); + expect(partialRow.partial).toBe(true); + expect(partialRow.status).toBe("pending"); + expect(partialRow.summaryCount).toBe(3); + expect(partialRow.sourceSeqStart).toBe(10); + expect(partialRow.sourceSeqEnd).toBe(15); + expect(partialRow.completedAt).toBe(15); + expect(partialRow.children).toBeNull(); + + // Collapsed commands are gone from the flat rows; newer work and the + // still-running command stay visible. + const visibleCommands = commandRowCommands(rows); + expect(visibleCommands).toEqual([ + "sleep infinity", + "echo 16", + "echo 18", + ]); + }); + + it("keeps the summary row id stable across the completion transition", () => { + const partialFactory = event(); + const partialRows = buildTimelineRowsFromEvents( + activeTurnEvents(partialFactory), + { + activeTurnCollapseFrontiers: new Map([["turn-1", 15]]), + }, + ); + const [partialRow] = turnRows(partialRows); + + const completedFactory = event(); + const completedRows = buildTimelineRowsFromEvents([ + ...activeTurnEvents(completedFactory), + completedFactory.assistantCompleted({ + seq: 40, + itemId: "assistant-final", + text: "All done.", + }), + completedFactory.turnCompleted({ seq: 41 }), + ]); + const [completedRow] = turnRows(completedRows); + + expect(completedRow).toBeDefined(); + expect(completedRow.id).toBe(partialRow.id); + expect(completedRow.partial).toBe(false); + expect(completedRow.status).toBe("completed"); + // The completed summary now covers the whole turn's work. + expect(completedRow.summaryCount).toBeGreaterThan( + partialRow.summaryCount, + ); + }); + + it("renders flat rows when no frontier is provided", () => { + const rows = buildTimelineRowsFromEvents(activeTurnEvents(event())); + expect(turnRows(rows)).toEqual([]); + expect(commandRowCommands(rows)).toHaveLength(6); + }); + + it("ignores frontiers for other turns", () => { + const rows = buildTimelineRowsFromEvents(activeTurnEvents(event()), { + activeTurnCollapseFrontiers: new Map([["turn-other", 15]]), + }); + expect(turnRows(rows)).toEqual([]); + }); +}); + +describe("buildThreadTimelineTurnWorkPageFromEvents", () => { + const pageOptions = { + includeProviderUnhandledOperations: false, + threadStatus: "active" as const, + threadName: "", + turnId: "turn-1", + workspaceRoot: null, + }; + + it("returns summary children for a window that includes the turn completion", () => { + const factory = createTimelineEventFactory({ threadId: "thread-1" }); + const rows = buildThreadTimelineTurnWorkPageFromEvents({ + events: fromRows([ + factory.clientTurnRequested({ + seq: 1, + requestId: "creq_23456789ab", + text: "do the work", + }), + factory.turnStarted({ seq: 2 }), + factory.inputAccepted({ seq: 3, clientRequestId: "creq_23456789ab" }), + factory.commandStarted({ + seq: 10, + itemId: "cmd-10", + command: "echo 10", + }), + factory.commandCompleted({ + seq: 11, + itemId: "cmd-10", + command: "echo 10", + aggregatedOutput: "out", + exitCode: 0, + }), + factory.assistantCompleted({ + seq: 20, + itemId: "assistant-final", + text: "All done.", + }), + factory.turnCompleted({ seq: 21 }), + ]), + options: { ...pageOptions, turnFinished: true }, + }); + + expect(commandRowCommands(rows)).toEqual(["echo 10"]); + // The terminal response and the user prompt render in the main timeline, + // never inside the work expansion. + expect(rows.some((row) => row.kind === "conversation")).toBe(false); + }); + + it("projects a completed item fully from a window missing its start event", () => { + const factory = createTimelineEventFactory({ threadId: "thread-1" }); + const rows = buildThreadTimelineTurnWorkPageFromEvents({ + events: fromRows([ + factory.turnStarted({ seq: 2 }), + factory.commandCompleted({ + seq: 11, + itemId: "cmd-10", + command: "echo 10", + aggregatedOutput: "straddled output", + exitCode: 0, + }), + ]), + options: { ...pageOptions, turnFinished: true }, + }); + + const commandRow = rows.find( + (row): row is Extract => + row.kind === "work" && row.workKind === "command", + ); + expect(commandRow).toBeDefined(); + expect(commandRow?.command).toBe("echo 10"); + expect(commandRow?.output).toBe("straddled output"); + expect(commandRow?.status).toBe("completed"); + }); + + it("drops pending work from a running turn's window and finalizes it for a finished turn", () => { + const factory = createTimelineEventFactory({ threadId: "thread-1" }); + const windowEvents = [ + factory.turnStarted({ seq: 2 }), + factory.commandStarted({ + seq: 8, + itemId: "cmd-pending", + command: "sleep infinity", + }), + factory.commandStarted({ + seq: 10, + itemId: "cmd-10", + command: "echo 10", + }), + factory.commandCompleted({ + seq: 11, + itemId: "cmd-10", + command: "echo 10", + aggregatedOutput: "out", + exitCode: 0, + }), + ]; + + const runningRows = buildThreadTimelineTurnWorkPageFromEvents({ + events: fromRows(windowEvents), + options: { ...pageOptions, turnFinished: false }, + }); + expect(commandRowCommands(runningRows)).toEqual(["echo 10"]); + + const finishedFactory = createTimelineEventFactory({ + threadId: "thread-1", + }); + const finishedRows = buildThreadTimelineTurnWorkPageFromEvents({ + events: fromRows([ + finishedFactory.turnStarted({ seq: 2 }), + finishedFactory.commandStarted({ + seq: 8, + itemId: "cmd-pending", + command: "sleep infinity", + }), + finishedFactory.commandStarted({ + seq: 10, + itemId: "cmd-10", + command: "echo 10", + }), + finishedFactory.commandCompleted({ + seq: 11, + itemId: "cmd-10", + command: "echo 10", + aggregatedOutput: "out", + exitCode: 0, + }), + ]), + options: { ...pageOptions, turnFinished: true }, + }); + const pendingRow = finishedRows.find( + (row) => + row.kind === "work" && + row.workKind === "command" && + row.command === "sleep infinity", + ); + expect(pendingRow).toBeDefined(); + expect(pendingRow?.kind === "work" && pendingRow.status).toBe( + "interrupted", + ); + }); +}); diff --git a/packages/thread-view/test/timeline-cli-rendering.snapshots.test.ts b/packages/thread-view/test/timeline-cli-rendering.snapshots.test.ts index 956a59711d..ac78ea022b 100644 --- a/packages/thread-view/test/timeline-cli-rendering.snapshots.test.ts +++ b/packages/thread-view/test/timeline-cli-rendering.snapshots.test.ts @@ -465,6 +465,7 @@ describe("timeline CLI rendering snapshots", () => { status: "completed", summaryCount: 0, completedAt: null, + partial: false, children: null, } satisfies TimelineRow, ], diff --git a/packages/thread-view/test/timeline-row-title.test.ts b/packages/thread-view/test/timeline-row-title.test.ts index 40567eda31..60c0aec5ef 100644 --- a/packages/thread-view/test/timeline-row-title.test.ts +++ b/packages/thread-view/test/timeline-row-title.test.ts @@ -384,6 +384,7 @@ function turnRow(): TimelineViewTurnRow { status: "completed", summaryCount: 1, completedAt: 3_661_001, + partial: false, children: null, }; } diff --git a/plans/long-thread-timeline-pagination.md b/plans/long-thread-timeline-pagination.md new file mode 100644 index 0000000000..f0d11ab12b --- /dev/null +++ b/plans/long-thread-timeline-pagination.md @@ -0,0 +1,227 @@ +# Long-thread timeline: diagnosis and pagination plan + +Status: implemented (Phases A–C). Remaining follow-up: bounded event *selection* +for giant turns (§4 Phase B "server reads only what it serves") — the projection +now collapses giant active turns and pages their detail, but a cache-miss build +still reads/parses every event in the window (~600 ms on the 27 MB sample turn, +once per appended event batch). Measured results are in PR notes. + +## 1. Problem, quantified + +Sample threads (live `bb.db`, read-only): + +| Thread | Events | `data` bytes | Notes | +|---|---|---|---| +| `thr_n8ptu7bf8f` | 13,473 | 39.0 MB | one 335-min turn = 7,025 events / 27.0 MB | +| `thr_y7dr6tikex` | 9,245 | 11.8 MB | UX discussion thread | +| `thr_c9ra5h9buj` | 4,094 | 7.2 MB | 162-min turn ≈ 2,242 events / 3.6 MB | + +Inside the 7,025-event turn: + +- `item/completed` + `commandExecution` = 1,263 events, **21.3 MB of the 27 MB** — completed command items carry full output; the largest single events are **~1.1 MB each**. +- Every work item is stored 2–3×: `item/started` (2.7 MB) + `outputDelta` events (2.3 MB) + `item/completed`. +- The turn is **one timeline segment**: a single user prompt followed by ~5.5 hours of work. + +Skeleton math for the whole 39 MB thread: user prompts + turn metadata + final agent +messages ≈ **240 KB** (~160× smaller). Everything else is intermediate work that the +decided UX says should live behind "Worked for…" / "Show earlier work". + +## 2. What already exists (do not rebuild) + +The current main branch already has most of the machinery, and one failed attempt to +learn from: + +- **Logical-segment pagination** — timeline pages are anchored on user-message rows + (`client/turn/requested` anchors), so a page never starts mid-response. + Server: `apps/server/src/services/threads/timeline-pagination.ts`, + `resolveTimelineSegmentWindow` in `apps/server/src/services/threads/timeline.ts` + (default 20 segments, max 100). Client: `useThreadTimelineController.ts` + (`loadOlderTimelineRows`, prepend with scroll-anchor restore via + `BottomAnchoredScrollBody.captureScrollAnchor`). +- **Completed-turn collapse** — `buildTurnRows` + (`packages/thread-view/src/build-thread-timeline.ts:1044`) collapses a completed turn + into a `kind:"turn"` row ("Worked for…", `timeline-row-title.ts:1263`) with + `children: null`; the final response renders outside the collapse + (`completed-turn-grouping.ts`). Expansion lazily fetches detail via + `GET routes.timelineTurnSummaryDetails` (`apps/server/src/routes/threads/data.ts:459`) + keyed by `(turnId, sourceSeqStart, sourceSeqEnd)` → `LazyTurnRowBody` + (`ThreadTimelineRows.tsx:1275`). +- **Delta live updates** — WS is invalidation-only; refetch passes + `afterSequence = previous.maxSeq` and the server returns a row delta + (`computeTimelineRowDelta`); client merges via `applyTimelineDelta`. +- **Inline output truncation** — `timeline-output-truncation.ts` caps tool/command + output at 32 KB in the timeline response (NOT applied to the turn-summary-details + route, which is the "see full output" path). +- **Storage-side hygiene** — retention sweep truncates old completed-item outputs + (`completed-event-output-truncation`), and `event-pruning.ts` deletes resolved item + deltas / progress events beyond per-thread thresholds. +- **The reverted attempt** — PR #711 bounded raw-event and rendered-row windows by + row/byte budgets (7.9 MB → 405 KB initial response) but was **server-only**: the cut + fell at arbitrary row boundaries inside a turn, so users saw agent work without its + initiating prompt behind a generic "Load older" control. Reverted in #722 "while the + pagination UX is reconsidered". Lesson: **the budget cut must land inside the turn's + collapsed body, never at the top-level page boundary.** + +## 3. Gap analysis — why long turns still freeze + +1. **Active turns never collapse.** `buildTurnRows` emits *every* message as raw rows + while `turn.status === "pending"`. A 7k-event running turn means: + - server re-reads and re-projects the whole turn window on every delta tick + (the segment window includes the entire in-flight turn); + - the client reprojects the whole loaded window per tick + (`buildTimelineViewRows` WeakMap cache misses on every new array); + - the DOM grows unbounded — `TimelineRowsList` has **no virtualization**. + This is the browser-freeze case. +2. **Expanding a completed giant turn is one unbounded fetch.** + `timelineTurnSummaryDetails` returns the *entire* turn window, un-truncated. + For the sample turn that is ~7k events / 27 MB parsed, projected, and mounted as + nested rows in one shot. +3. **Conversation outline reads the whole thread** on every `maxSeq` bump + (`buildThreadConversationOutline` / `listRecentStoredEventRows` with no limit), + softened only by an LRU cache. #711's targeted outline query was reverted with the + rest. +4. **No list virtualization** — secondary once 1–2 are fixed, since collapse bounds + visible rows. + +## 4. Design + +Top-level segment pagination stays exactly as is (it already satisfies "always show the +initiating user message" and "Load older messages only for genuinely older +conversations"). All new bounding happens **inside a turn's work section**. + +### Phase A — paged turn detail ("Show earlier work") + +Extend the turn-summary-details contract with a work-item cursor: + +- Request: `(turnId, sourceSeqStart, sourceSeqEnd)` + optional + `beforeSeq` (cursor) + `workItemLimit` (default ~50 items, plus a byte budget). +- Response: newest `workItemLimit` work items' rows within the range, plus + `{ hasEarlierWork, earlierCursor }`. Omitting the cursor params preserves today's + full-detail behavior for small turns (and for the CLI/SDK, which keep the raw + `routes.events` surface regardless). +- **Page in item space, not event space.** Select the last N distinct `item_id`s (by + `item/completed` sequence) in the range, then load all events for those items — + `events_thread_turn_type_item_sequence_idx` supports this. This keeps + started/completed pairs together so `buildThreadTimelineFromEvents` sees whole items. +- **Snap page boundaries to grouping boundaries** (assistant-message step boundaries, + `externalUserBoundarySeqs`) so `bundle-summary`/`step-summary` grouping doesn't + produce half-bundles at a seam. Cursor = sequence of the boundary event. +- **Apply the 32 KB inline truncation to paged detail.** Today's un-truncated detail + response is only tenable because turns were assumed small; a 50-item page with + 1.1 MB command outputs is still tens of MB. Add a per-item "show full output" fetch + (small route: full data for one `(turnId, itemId)`) to preserve the full-output + affordance. + +Client (`LazyTurnRowBody`): keep an ordered list of loaded pages per turn row id; +render chronologically with a nested "Show earlier work" control at the top that +fetches `earlierCursor` and prepends (reusing the existing scroll-anchor capture). +Expansion shows the newest page first, per the decided UX. + +### Phase B — active-turn frontier collapse ("Worked for … so far") + +Change `buildTurnRows` for in-flight turns: + +- Partition the turn's messages into: + - **live tail**: the most recent K finished work items (K ≈ 20–30), plus *all* + pending/running items, questions, approvals, plan updates, and streaming text — + these render as raw rows exactly like today; + - **collapsed prefix**: older finished work → a single partial turn-summary row + ("Worked for 2h 10m so far", stable row id derived from `turnId`, `children: null`), + expandable via the same Phase A paged-detail route (range = turn start → + collapse frontier). +- **Hysteresis to avoid per-tick churn**: collapse only when the finished tail exceeds + 2K items, and move a chunk (K items) at once. The summary row's + `sourceSeqEnd` then changes at most once per chunk, keeping row identity stable and + delta diffs small between migrations. +- **Server reads only what it serves.** The event selection for the latest page should + fetch the collapsed prefix's *aggregates* (item counts by kind via indexed + `COUNT`, min/max `created_at`) instead of its events. This is the structural win: + per-tick projection cost becomes O(tail), independent of turn length — the 27 MB + turn costs the same to stream as a 30-second one. +- **Completion convergence**: when the turn completes, the standard completed-turn + path produces the normal "Worked for…" row between prompt and final response. Client + keeps already-loaded detail pages keyed by `turnId` (not by row id), so work the user + revealed during the run stays revealed; the partial-row → completed-row transition is + a row replacement at a stable position, and `BottomAnchoredScrollBody` already + restores scroll across content-height changes. + +### Phase C — remaining unbounded reads (independent, lower risk) + +- Re-land the **targeted conversation-outline query** (select only message-producing + event types with a `WHERE type IN (...)` on the existing thread+type+sequence index), + as #711 did, this time as its own change. +- Optional: **virtualize `TimelineRowsList`** for very large loaded windows. After + Phases A/B the visible row count is bounded (segments × a few rows each), so treat + this as a follow-up only if profiling still shows DOM cost. + +### Sizing check against the sample turn + +- Initial latest page containing the giant *completed* turn: turn row + final response + ≈ a few KB (vs 27 MB projected today when expanded, and vs thousands of raw rows if + it were active). +- Expanding it: newest ~50 items, truncated ≈ low hundreds of KB. +- Active-turn tick: projection over ≤ ~60 items regardless of turn age. + +## 5. Contract and surface changes + +- `packages/server-contract/src/api/threads.ts`: extend the turn-summary-details query + schema (`beforeSeq`, `workItemLimit`) and response (`hasEarlierWork`, + `earlierCursor`); new per-item full-output query. Fill defaults at the route boundary + per repo convention (no optional-with-hidden-default fields internally). +- `packages/thread-view`: partial-turn summary row variant (or a `phase: "in-progress"` + field on the existing `kind:"turn"` row — prefer extending the existing row so the + client render path is shared). +- No change to `routes.events` / CLI / SDK raw-event surfaces; agents keep full + fidelity. Document the timeline route behavior change (bounded active-turn + projection) in the route docs since it is non-obvious to consumers that relied on + every event appearing in the projection — that was #711's flagged compatibility risk. + +## 6. Edge cases to handle + +- **Mid-turn user steering** (`turn/input/accepted`, 76 in the sample turn): completed + grouping already splits summaries on external user boundaries and keeps those user + messages visible. Paged detail cursors must stay within one summary range; the + active-turn collapse frontier must not swallow a user boundary silently — split the + partial summary the same way. +- **Interrupted/failed turns**: `isCompletedTurn` requires `completedAt !== null`; + verify interrupted turns (`system/thread/interrupted`) still converge to the + completed-collapse path rather than staying in the flat active rendering forever. +- **Pruned events under a cursor**: retention sweeps delete old deltas/outputs; a + stale `earlierCursor` should degrade to "earlier work unavailable", not a 400. + (Top-level stale cursors already recover this way in the controller.) +- **Row identity across the collapse frontier**: rows migrating from live tail into the + collapsed prefix disappear from the top-level list; chunked migration + stable + summary row id keeps `preserveTimelineRowIdentity` and React.memo effective. +- **Delta correctness**: `computeTimelineRowDelta` must treat the partial summary row's + chunk-step changes as row updates, not full-response invalidations. + +## 7. Verification plan + +- Unit: extend `timeline-pagination.test.ts` patterns for paged detail (item-space + cursors, boundary snapping, steering-message splits); in-memory SQLite via + `createConnection(":memory:")` + `migrate(db)` per repo rules. +- Real-data QA (read-only): copy `bb.db` into a scratch data dir and attach a dev app + (`BB_SERVER_PORT` attach mode / `scripts/bb-dev-app`); load `thr_n8ptu7bf8f` and + measure: initial timeline response size, expand-page size, and per-tick main-thread + time with the 7k-event turn simulated as active. +- Targets: initial latest page < 500 KB on the 39 MB thread; expand page < 300 KB; + active-turn delta tick independent of turn length; no scroll jump on collapse + migration, expansion, or "Show earlier work" prepend. + +## 8. Open questions + +1. Tail size K and page size: fixed counts vs byte-budgeted (probably both: item count + cap + byte cap, whichever hits first). +2. Should the partial summary row show live aggregate counts ("412 commands so far") + or just duration? Counts are cheap (indexed COUNT) and useful. +3. Does anything besides the app consume the timeline projection (public thread pages, + plugins)? Audit before changing active-turn projection shape. +4. Whether Phase C virtualization is needed at all post-A/B — decide from profiling, + not up front. + +## Suggested sequencing + +Phase A (paged completed-turn detail) ships alone and immediately fixes the +"expand a giant turn" freeze with zero change to live behavior. Phase B builds on A's +route. Phase C is independent. Each phase is separately revertible — the #711 lesson +applied to rollout, not just design. diff --git a/tests/integration/fake/smoke/timeline-response.test.ts b/tests/integration/fake/smoke/timeline-response.test.ts index aa0a8b7d37..e21be71b9d 100644 --- a/tests/integration/fake/smoke/timeline-response.test.ts +++ b/tests/integration/fake/smoke/timeline-response.test.ts @@ -78,6 +78,7 @@ describe("timeline response helpers", () => { status: "completed", summaryCount: 1, completedAt: null, + partial: false, children: [ASSISTANT_ROW], }, ]); From d331ee98a8bd2fb0b848e7db99de7031c8a2fda9 Mon Sep 17 00:00:00 2001 From: Sawyer Hood Date: Thu, 16 Jul 2026 02:35:49 -0700 Subject: [PATCH 2/3] Address review findings on turn-work pagination MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correctness: - Bound the collapse-frontier queries (active turn lookup, completion count, nth completion) by the build's maxSeq so a response cached per (thread, maxSeq) never bakes in turn state from events appended after that revision, and pass the same frontiers into the conversation outline so its items always correspond to top-level timeline rows (the minimap's jump-to-message contract). - Guard the partial collapse against an empty settled prefix: previously the single-group fast path fell back to turn.summaryCount and whole-turn bounds, emitting a bogus "Worked so far" row above the same rows rendered flat. - Keep agent/system-initiated steer messages in paged work windows: they fold into summary children for completed turns, so dropping every user row made them unreachable in paged expansions. - Treat NULL-item_kind legacy completions like the outline query does (fall back to the payload's item type) so reasoning completions on old threads don't inflate page windows or the collapse frontier. - Keep the "Show earlier work" control mounted in a loading state while the next-older window fetches instead of flickering out mid-load. - Re-key segment windows (generation bump) when a turn finishes so work that never completed reappears finalized as interrupted instead of silently vanishing from an already-open expansion. - Include `partial` in the turn-row render signature; forward workItemLimit/afterSeq through the SDK so the paging contract isn't accepted-but-ignored there. Efficiency: - Add a partial covering index (thread_id, turn_id, sequence, item_kind) WHERE type='item/completed' — EXPLAIN QUERY PLAN showed the frontier and paging queries doing per-row table seeks (or whole-thread scans for the OFFSET variant) against the existing indexes. Generated via drizzle-kit. - Gate the outline's json_extract fallback to NULL-item_kind rows so typed tool/command events never parse their payloads; include plan items, which also project to assistant text. Cleanup: - Extract the duplicated turn-window event selection pipeline into a shared helper used by both the full-detail and paged paths; fold the pending-row predicates into one type guard; drop a redundant client-side re-sort and simplify the segment row merge to Map semantics. Co-Authored-By: Claude Fable 5 --- .../thread/timeline/ThreadTimelineRows.tsx | 1 + .../thread/timeline/timelineRowSignatures.ts | 1 + .../thread/timeline/useTurnWorkSegments.ts | 105 +- apps/server/src/services/threads/timeline.ts | 142 +- .../threads/turn-work-pagination.test.ts | 28 +- packages/db/drizzle/0076_lovely_namorita.sql | 1 + packages/db/drizzle/meta/0076_snapshot.json | 3399 +++++++++++++++++ packages/db/drizzle/meta/_journal.json | 7 + packages/db/src/data/events.ts | 86 +- packages/db/src/data/index.ts | 1 + packages/db/src/schema.ts | 9 + packages/db/test/migrate.test.ts | 4 + packages/sdk/src/areas/threads.ts | 6 + .../thread-view/src/build-thread-timeline.ts | 29 +- .../src/completed-turn-grouping.ts | 8 + .../test/partial-turn-collapse.test.ts | 12 + 16 files changed, 3730 insertions(+), 109 deletions(-) create mode 100644 packages/db/drizzle/0076_lovely_namorita.sql create mode 100644 packages/db/drizzle/meta/0076_snapshot.json diff --git a/apps/app/src/components/thread/timeline/ThreadTimelineRows.tsx b/apps/app/src/components/thread/timeline/ThreadTimelineRows.tsx index e08ab1ba3e..f83fe02f09 100644 --- a/apps/app/src/components/thread/timeline/ThreadTimelineRows.tsx +++ b/apps/app/src/components/thread/timeline/ThreadTimelineRows.tsx @@ -1325,6 +1325,7 @@ function LazyTurnRowBody({ sourceSeqEnd: rowSourceSeqEnd, sourceSeqStart: rowSourceSeqStart, threadId: threadId ?? rowThreadId, + turnActive: row.partial, turnId: rowTurnId, }); const bottomAnchor = useBottomAnchoredScroll(); diff --git a/apps/app/src/components/thread/timeline/timelineRowSignatures.ts b/apps/app/src/components/thread/timeline/timelineRowSignatures.ts index 733179215c..339e55d464 100644 --- a/apps/app/src/components/thread/timeline/timelineRowSignatures.ts +++ b/apps/app/src/components/thread/timeline/timelineRowSignatures.ts @@ -320,6 +320,7 @@ function computeTimelineRowRenderSignature(row: ThreadTimelineViewRow): string { row.status, row.summaryCount, row.completedAt, + row.partial, row.children ? timelineRowsSignature(row.children) : null, ]); case "work": diff --git a/apps/app/src/components/thread/timeline/useTurnWorkSegments.ts b/apps/app/src/components/thread/timeline/useTurnWorkSegments.ts index 000571542a..d17fcb741f 100644 --- a/apps/app/src/components/thread/timeline/useTurnWorkSegments.ts +++ b/apps/app/src/components/thread/timeline/useTurnWorkSegments.ts @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useMemo, useRef } from "react"; +import { useCallback, useEffect, useRef } from "react"; import { useQueries } from "@tanstack/react-query"; import { atom, useAtom } from "jotai"; import { atomFamily } from "jotai-family"; @@ -15,18 +15,30 @@ export const TURN_WORK_SEGMENT_ITEM_LIMIT = 40; * (the server reports where the page actually started via its * `earlierCursor`). `range` covers `(afterSeq, endSeq]` exactly — used to pick * up work that collapsed into a partial "Worked so far" summary after the - * previous fetch. Both are stable descriptions of history, so their query - * results never need refetching. + * previous fetch. Both are stable descriptions of history while the turn + * runs; on turn completion the windows are refetched once so work that never + * completed is re-served with its finalized (interrupted) status. */ type TurnWorkSegmentParam = | { kind: "page"; beforeSeq: number } | { kind: "range"; afterSeq: number; endSeq: number }; interface TurnWorkSegmentsState { - /** Ordered oldest → newest by covered window. */ + /** + * Ordered oldest → newest by covered window — an invariant of how segments + * are created: the initial page first, older pages only ever prepended, + * catch-up ranges only ever appended above the covered end. + */ segments: TurnWorkSegmentParam[]; /** Highest sequence any fetched segment covers; appends start above it. */ coveredEndSeq: number; + /** + * Bumped when the turn finishes so every window re-keys and refetches: + * while the turn ran, windows dropped still-pending work (it rendered live + * in the flat tail); after completion that work is finalized as interrupted + * and must appear in the expansion instead of silently vanishing. + */ + generation: number; } /** @@ -39,33 +51,32 @@ const turnWorkSegmentsAtomFamily = atomFamily((_rowKey: string) => atom(null), ); -function segmentDescriptor(segment: TurnWorkSegmentParam): string { - return segment.kind === "page" - ? `page:${segment.beforeSeq}:${TURN_WORK_SEGMENT_ITEM_LIMIT}` - : `range:${segment.afterSeq}:${segment.endSeq}`; +function segmentDescriptor( + segment: TurnWorkSegmentParam, + generation: number, +): string { + const window = + segment.kind === "page" + ? `page:${segment.beforeSeq}:${TURN_WORK_SEGMENT_ITEM_LIMIT}` + : `range:${segment.afterSeq}:${segment.endSeq}`; + return `g${generation}:${window}`; } /** * Segment windows can share an item when its events straddle their boundary * (started in the older window, completed in the newer). Both windows project - * the same row id; the newer window's version has the completed payload, and - * the older window's position preserves chronological start order. + * the same row id; a JS Map keeps the first insertion's position (the older + * window's chronological slot) while the last set wins the payload (the newer + * window's completed version). */ function mergeSegmentRows(orderedSegmentRows: TimelineRow[][]): TimelineRow[] { const rowsById = new Map(); - const orderedIds: string[] = []; for (const segmentRows of orderedSegmentRows) { for (const row of segmentRows) { - if (!rowsById.has(row.id)) { - orderedIds.push(row.id); - } rowsById.set(row.id, row); } } - return orderedIds.flatMap((id) => { - const row = rowsById.get(id); - return row === undefined ? [] : [row]; - }); + return [...rowsById.values()]; } export interface UseTurnWorkSegmentsArgs { @@ -75,6 +86,8 @@ export interface UseTurnWorkSegmentsArgs { sourceSeqEnd: number; sourceSeqStart: number; threadId: string; + /** True while the summary row's turn is still running (partial row). */ + turnActive: boolean; turnId: string; } @@ -94,6 +107,7 @@ export function useTurnWorkSegments({ sourceSeqEnd, sourceSeqStart, threadId, + turnActive, turnId, }: UseTurnWorkSegmentsArgs): UseTurnWorkSegmentsResult { const atomKey = `${threadId}:${rowId}`; @@ -114,6 +128,7 @@ export function useTurnWorkSegments({ return { segments: [{ kind: "page", beforeSeq: sourceSeqEnd + 1 }], coveredEndSeq: sourceSeqEnd, + generation: 0, }; } if (sourceSeqEnd > current.coveredEndSeq) { @@ -121,6 +136,7 @@ export function useTurnWorkSegments({ // completed): append exactly the newly covered range, leaving every // already-fetched window untouched. return { + ...current, segments: [ ...current.segments, { @@ -136,22 +152,31 @@ export function useTurnWorkSegments({ }); }, [enabled, setState, sourceSeqEnd]); - const segments = useMemo( - () => state?.segments ?? [], - [state], - ); - const orderedSegments = useMemo(() => { - const upperBound = (segment: TurnWorkSegmentParam): number => - segment.kind === "page" ? segment.beforeSeq - 1 : segment.endSeq; - return [...segments].sort((left, right) => upperBound(left) - upperBound(right)); - }, [segments]); + // While the turn runs, windows drop work that is still pending (it renders + // live in the flat tail). When the turn finishes, work that never completed + // is finalized as interrupted — bump the generation so every window re-keys + // and refetches with finalized statuses instead of silently losing it. + const wasTurnActiveRef = useRef(turnActive); + useEffect(() => { + if (wasTurnActiveRef.current && !turnActive) { + setState((current) => + current === null + ? current + : { ...current, generation: current.generation + 1 }, + ); + } + wasTurnActiveRef.current = turnActive; + }, [setState, turnActive]); + + const segments = state?.segments ?? []; + const generation = state?.generation ?? 0; const queries = useQueries({ - queries: orderedSegments.map((segment) => ({ + queries: segments.map((segment) => ({ queryKey: threadTurnWorkSegmentQueryKey( threadId, turnId, - segmentDescriptor(segment), + segmentDescriptor(segment, generation), ), queryFn: ({ signal }: { signal?: AbortSignal }) => segment.kind === "page" @@ -204,12 +229,19 @@ export function useTurnWorkSegments({ const rows = mergedRowsRef.current.rows; // Earlier-work paging state lives on the oldest page segment: its response - // carries the cursor for the next-older window. - const oldestPageIndex = orderedSegments.findIndex( + // carries the cursor for the next-older window. While that query is still + // pending (right after "Show earlier work"), the control must stay mounted + // in its loading state rather than flickering away, so `hasEarlierWork` + // holds true until the page resolves and reports its own cursor. + const oldestPageIndex = segments.findIndex( (segment) => segment.kind === "page", ); const oldestPageQuery = oldestPageIndex === -1 ? undefined : queries[oldestPageIndex]; + const isLoadingEarlier = + oldestPageQuery !== undefined && + oldestPageQuery.isPending && + rows !== null; const earlierCursor = oldestPageQuery?.data?.workPage?.earlierCursor ?? null; @@ -239,19 +271,20 @@ export function useTurnWorkSegments({ }); }, [earlierCursor, setState]); + const queriesRef = useRef(queries); + queriesRef.current = queries; const retry = useCallback(() => { - for (const query of queries) { + for (const query of queriesRef.current) { if (query.isError) { void query.refetch(); } } - }, [queries]); + }, []); return { rows, - hasEarlierWork: earlierCursor !== null, - isLoadingEarlier: - oldestPageQuery !== undefined && oldestPageQuery.isPending, + hasEarlierWork: isLoadingEarlier || earlierCursor !== null, + isLoadingEarlier, isError: queries.some((query) => query.isError), loadEarlierWork, retry, diff --git a/apps/server/src/services/threads/timeline.ts b/apps/server/src/services/threads/timeline.ts index 1b8892bb83..ee809b923c 100644 --- a/apps/server/src/services/threads/timeline.ts +++ b/apps/server/src/services/threads/timeline.ts @@ -21,7 +21,7 @@ import type { import { countTurnWorkItemCompletions, findTimelineSegmentAnchorSequenceAfter, - getActiveStoredTurnId, + getActiveStoredTurnIdAtSequence, getEnvironment, getTimelineSegmentAnchorAtSequence, getTurnWorkItemCompletionSequenceByIndex, @@ -164,20 +164,27 @@ const ACTIVE_TURN_COLLAPSE_CHUNK_ITEMS = 24; * completions at or before the returned sequence are summarized instead of * rendered flat. Derived from indexed completion counts only — never from * event payloads — so it stays cheap on turns with tens of thousands of - * events. Deterministic per (thread, maxSeq), which keeps it compatible with - * the per-maxSeq timeline response cache. + * events. Every query is bounded by `maxSeq`, so the result is deterministic + * per (thread, maxSeq) even while events keep appending — the timeline + * response cache and the conversation outline cache both key on that revision + * and must see identical projections for it. */ function resolveActiveTurnCollapseFrontiers( db: DbConnection, threadId: string, + maxSeq: number, ): ReadonlyMap | undefined { - const activeTurnId = getActiveStoredTurnId(db, threadId); + const activeTurnId = getActiveStoredTurnIdAtSequence(db, { + threadId, + sequenceEnd: maxSeq, + }); if (activeTurnId === null) { return undefined; } const completionCount = countTurnWorkItemCompletions(db, { threadId, turnId: activeTurnId, + sequenceEnd: maxSeq, }); const collapsedCount = Math.floor( @@ -191,6 +198,7 @@ function resolveActiveTurnCollapseFrontiers( threadId, turnId: activeTurnId, index: collapsedCount - 1, + sequenceEnd: maxSeq, }); if (frontierSeq === null) { return undefined; @@ -1092,7 +1100,7 @@ function buildThreadTimelineInternal( }; const activeTurnCollapseFrontiers = options.page.kind === "latest" - ? resolveActiveTurnCollapseFrontiers(db, thread.id) + ? resolveActiveTurnCollapseFrontiers(db, thread.id, options.maxSeq) : undefined; const timeline = measureThreadTimelineStage( profile, @@ -1240,6 +1248,16 @@ export function buildThreadConversationOutline( contextWindowEvents: [], events: decodedEvents, options: { + // Same frontiers as the timeline build at this revision: a settled + // interim assistant message collapsed into a partial "Worked so far" + // summary must not surface as an outline item, or the minimap would + // list ids the timeline never renders and jump-to-message would page + // the whole thread hunting for them. + activeTurnCollapseFrontiers: resolveActiveTurnCollapseFrontiers( + db, + thread.id, + options.maxSeq, + ), includeDebugRawEvents: false, includeNestedRows: false, includeProviderUnhandledOperations: false, @@ -1269,30 +1287,40 @@ export function buildThreadConversationOutline( return { items, maxSeq: options.maxSeq }; } -export function buildTimelineTurnSummaryDetails( +interface SelectTurnWindowEventRowsArgs { + seqEnd: number; + seqStart: number; + turnId: string; +} + +interface TurnWindowEventSelection { + /** Window rows filtered to the requested turn plus its accepted inputs. */ + eventRows: StoredEventRow[]; + /** Pre-merge filter result; the full-detail path derives exact range bounds from it. */ + exactEventRowsForRequestedTurn: FilterExactEventRowsForRequestedTurnResult; +} + +/** + * Shared selection pipeline for a turn-detail window: fetch the raw sequence + * range, resolve accepted steer inputs (which may land after the range), + * partition them by requested turn, and drop other turns' rows. Both the full + * turn-detail path and the paged work path use this; they differ only in + * bounds policy and how missing turn rows are reported. + */ +function selectTurnWindowEventRows( db: DbConnection, thread: Thread, - options: BuildTimelineTurnSummaryDetailsOptions, -): TimelineTurnSummaryDetailsResponse { - if (options.sourceSeqStart > options.sourceSeqEnd) { - throw new ApiError( - 400, - "invalid_request", - "sourceSeqStart must be less than or equal to sourceSeqEnd", - ); - } - - const includeProviderUnhandledOperations = - options.includeProviderUnhandledOperations; + args: SelectTurnWindowEventRowsArgs, +): TurnWindowEventSelection { const exactEventRows = listStoredEventRowsInRange(db, { threadId: thread.id, - seqStart: options.sourceSeqStart, - seqEnd: options.sourceSeqEnd, + seqStart: args.seqStart, + seqEnd: args.seqEnd, }); const clientRequestIds = listStoredClientTurnRequestIdsInRange(db, { threadId: thread.id, - seqStart: options.sourceSeqStart, - seqEnd: options.sourceSeqEnd, + seqStart: args.seqStart, + seqEnd: args.seqEnd, }); const exactAcceptedInputRows = exactEventRows.filter( (row) => row.type === "turn/input/accepted", @@ -1300,23 +1328,49 @@ export function buildTimelineTurnSummaryDetails( const futureAcceptedInputRows = listStoredTurnInputAcceptedRowsByClientRequestIds(db, { threadId: thread.id, - afterSequence: options.sourceSeqEnd, + afterSequence: args.seqEnd, clientRequestIds, }); const acceptedInputRowsByTurn = partitionAcceptedInputRowsByRequestedTurn({ acceptedInputRows: [...exactAcceptedInputRows, ...futureAcceptedInputRows], - turnId: options.turnId, + turnId: args.turnId, }); const exactEventRowsForRequestedTurn = filterExactEventRowsForRequestedTurn({ acceptedClientRequestIdsForOtherTurns: acceptedInputRowsByTurn.acceptedClientRequestIdsForOtherTurns, exactEventRows, - turnId: options.turnId, + turnId: args.turnId, }); - const eventRows = mergeStoredEventRowsById([ - ...exactEventRowsForRequestedTurn.rows, - ...acceptedInputRowsByTurn.requestedTurnRows, - ]); + return { + eventRows: mergeStoredEventRowsById([ + ...exactEventRowsForRequestedTurn.rows, + ...acceptedInputRowsByTurn.requestedTurnRows, + ]), + exactEventRowsForRequestedTurn, + }; +} + +export function buildTimelineTurnSummaryDetails( + db: DbConnection, + thread: Thread, + options: BuildTimelineTurnSummaryDetailsOptions, +): TimelineTurnSummaryDetailsResponse { + if (options.sourceSeqStart > options.sourceSeqEnd) { + throw new ApiError( + 400, + "invalid_request", + "sourceSeqStart must be less than or equal to sourceSeqEnd", + ); + } + + const includeProviderUnhandledOperations = + options.includeProviderUnhandledOperations; + const { eventRows, exactEventRowsForRequestedTurn } = + selectTurnWindowEventRows(db, thread, { + seqStart: options.sourceSeqStart, + seqEnd: options.sourceSeqEnd, + turnId: options.turnId, + }); const hasTurnScopedRowsForRequestedTurn = eventRows.some( (row) => row.scopeKind === "turn" && row.turnId === options.turnId, @@ -1465,39 +1519,11 @@ export function buildTimelineTurnWorkPage( } } - const exactEventRows = listStoredEventRowsInRange(db, { - threadId: thread.id, - seqStart: lower, - seqEnd: upper, - }); - const clientRequestIds = listStoredClientTurnRequestIdsInRange(db, { - threadId: thread.id, + const { eventRows } = selectTurnWindowEventRows(db, thread, { seqStart: lower, seqEnd: upper, - }); - const exactAcceptedInputRows = exactEventRows.filter( - (row) => row.type === "turn/input/accepted", - ); - const futureAcceptedInputRows = - listStoredTurnInputAcceptedRowsByClientRequestIds(db, { - threadId: thread.id, - afterSequence: upper, - clientRequestIds, - }); - const acceptedInputRowsByTurn = partitionAcceptedInputRowsByRequestedTurn({ - acceptedInputRows: [...exactAcceptedInputRows, ...futureAcceptedInputRows], - turnId: options.turnId, - }); - const exactEventRowsForRequestedTurn = filterExactEventRowsForRequestedTurn({ - acceptedClientRequestIdsForOtherTurns: - acceptedInputRowsByTurn.acceptedClientRequestIdsForOtherTurns, - exactEventRows, turnId: options.turnId, }); - const eventRows = mergeStoredEventRowsById([ - ...exactEventRowsForRequestedTurn.rows, - ...acceptedInputRowsByTurn.requestedTurnRows, - ]); const hasTurnScopedRowsForRequestedTurn = eventRows.some( (row) => row.scopeKind === "turn" && row.turnId === options.turnId, diff --git a/apps/server/test/services/threads/turn-work-pagination.test.ts b/apps/server/test/services/threads/turn-work-pagination.test.ts index 5fc492e829..a8f92fae4c 100644 --- a/apps/server/test/services/threads/turn-work-pagination.test.ts +++ b/apps/server/test/services/threads/turn-work-pagination.test.ts @@ -9,6 +9,7 @@ import { createConnection, createProject, createThread, + getLatestThreadSequence, insertEvents, migrate, noopNotifier, @@ -233,7 +234,9 @@ function insertTurnCompleted({ function latestTimelineRows(db: DbConnection, thread: Thread): TimelineRow[] { return buildThreadTimeline(db, thread, { includeProviderUnhandledOperations: false, - maxSeq: 0, + // The collapse frontier is bounded by maxSeq for cache determinism, so + // the build must see the real revision like the route does. + maxSeq: getLatestThreadSequence(db, { threadId: thread.id }), page: { kind: "latest", segmentLimit: 20 }, }).rows; } @@ -304,6 +307,25 @@ describe("active-turn collapse frontier", () => { expect(visibleCommandCount(nextChunkRows)).toBe(24); }); + it("derives the frontier only from events at or below maxSeq", () => { + const { db, thread } = setup(); + insertTurnScaffold({ db, thread, requestValue: 1, startSeq: 1 }); + insertCommandPairs(db, thread, 72); + + // Build at an older revision (60 completions): the 12 newer pairs must + // not advance the frontier baked into that revision's cached response. + const olderMaxSeq = 10 + 60 * 2 - 1; + const rows = buildThreadTimeline(db, thread, { + includeProviderUnhandledOperations: false, + maxSeq: olderMaxSeq, + page: { kind: "latest", segmentLimit: 20 }, + }).rows; + expect(turnRows(rows)[0]?.summaryCount).toBe(24); + + const latestRows = latestTimelineRows(db, thread); + expect(turnRows(latestRows)[0]?.summaryCount).toBe(48); + }); + it("does not collapse completed turns via the frontier path", () => { const { db, thread } = setup(); insertTurnScaffold({ db, thread, requestValue: 1, startSeq: 1 }); @@ -472,7 +494,9 @@ describe("conversation outline targeted selection", () => { }); insertTurnCompleted({ db, thread, seq: seq + 1, turnId: "turn-2" }); - const outline = buildThreadConversationOutline(db, thread, { maxSeq: 0 }); + const outline = buildThreadConversationOutline(db, thread, { + maxSeq: getLatestThreadSequence(db, { threadId: thread.id }), + }); const timelineConversationRows = latestTimelineRows(db, thread).filter( (row) => row.kind === "conversation", ); diff --git a/packages/db/drizzle/0076_lovely_namorita.sql b/packages/db/drizzle/0076_lovely_namorita.sql new file mode 100644 index 0000000000..87ec89b427 --- /dev/null +++ b/packages/db/drizzle/0076_lovely_namorita.sql @@ -0,0 +1 @@ +CREATE INDEX `events_turn_completion_idx` ON `events` (`thread_id`,`turn_id`,`sequence`,`item_kind`) WHERE "type" = 'item/completed'; \ No newline at end of file diff --git a/packages/db/drizzle/meta/0076_snapshot.json b/packages/db/drizzle/meta/0076_snapshot.json new file mode 100644 index 0000000000..7b56613048 --- /dev/null +++ b/packages/db/drizzle/meta/0076_snapshot.json @@ -0,0 +1,3399 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "bfc7a109-bb01-4d14-ada9-1e9a2c6b7e02", + "prevId": "aeb5c487-c5f2-4a7c-862d-8895f1e2f6b9", + "tables": { + "app_settings": { + "name": "app_settings", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "caffeinate": { + "name": "caffeinate", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "show_keyboard_hints": { + "name": "show_keyboard_hints", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "show_unhandled_provider_events": { + "name": "show_unhandled_provider_events", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "codex_memory_enabled": { + "name": "codex_memory_enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "claude_code_memory_enabled": { + "name": "claude_code_memory_enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "codex_subagents_disabled": { + "name": "codex_subagents_disabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "claude_code_subagents_disabled": { + "name": "claude_code_subagents_disabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "claude_code_workflows_disabled": { + "name": "claude_code_workflows_disabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "keybinding_overrides": { + "name": "keybinding_overrides", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'[]'" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_theme": { + "name": "app_theme", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "theme_id": { + "name": "theme_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "favicon_color": { + "name": "favicon_color", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'default'" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "apikey": { + "name": "apikey", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "start": { + "name": "start", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "prefix": { + "name": "prefix", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "referenceId": { + "name": "referenceId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "refillInterval": { + "name": "refillInterval", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "refillAmount": { + "name": "refillAmount", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastRefillAt": { + "name": "lastRefillAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rateLimitEnabled": { + "name": "rateLimitEnabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rateLimitTimeWindow": { + "name": "rateLimitTimeWindow", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rateLimitMax": { + "name": "rateLimitMax", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "requestCount": { + "name": "requestCount", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "remaining": { + "name": "remaining", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastRequest": { + "name": "lastRequest", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expiresAt": { + "name": "expiresAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "permissions": { + "name": "permissions", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "configId": { + "name": "configId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "apikey_key_unique": { + "name": "apikey_key_unique", + "columns": [ + "key" + ], + "isUnique": true + }, + "apikey_reference_id_idx": { + "name": "apikey_reference_id_idx", + "columns": [ + "referenceId" + ], + "isUnique": false + }, + "apikey_config_id_idx": { + "name": "apikey_config_id_idx", + "columns": [ + "configId" + ], + "isUnique": false + } + }, + "foreignKeys": { + "apikey_referenceId_user_id_fk": { + "name": "apikey_referenceId_user_id_fk", + "tableFrom": "apikey", + "tableTo": "user", + "columnsFrom": [ + "referenceId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user": { + "name": "user", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "emailVerified": { + "name": "emailVerified", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "user_email_unique": { + "name": "user_email_unique", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "environments": { + "name": "environments", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "host_id": { + "name": "host_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "managed": { + "name": "managed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "is_git_repo": { + "name": "is_git_repo", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "is_worktree": { + "name": "is_worktree", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "branch_name": { + "name": "branch_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "base_branch": { + "name": "base_branch", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "default_branch": { + "name": "default_branch", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "merge_base_branch": { + "name": "merge_base_branch", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "destroy_attempt_id": { + "name": "destroy_attempt_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "workspace_provision_type": { + "name": "workspace_provision_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'provisioning'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "environments_host_path_idx": { + "name": "environments_host_path_idx", + "columns": [ + "host_id", + "path" + ], + "isUnique": true + }, + "environments_project_idx": { + "name": "environments_project_idx", + "columns": [ + "project_id" + ], + "isUnique": false + }, + "environments_status_idx": { + "name": "environments_status_idx", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": { + "environments_project_id_projects_id_fk": { + "name": "environments_project_id_projects_id_fk", + "tableFrom": "environments", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environments_host_id_hosts_id_fk": { + "name": "environments_host_id_hosts_id_fk", + "tableFrom": "environments", + "tableTo": "hosts", + "columnsFrom": [ + "host_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "events": { + "name": "events", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "environment_id": { + "name": "environment_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scope_kind": { + "name": "scope_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "turn_id": { + "name": "turn_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_thread_id": { + "name": "provider_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sequence": { + "name": "sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "item_id": { + "name": "item_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "item_kind": { + "name": "item_kind", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "data": { + "name": "data", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "events_thread_sequence_idx": { + "name": "events_thread_sequence_idx", + "columns": [ + "thread_id", + "sequence" + ], + "isUnique": true + }, + "events_thread_type_item_kind_sequence_idx": { + "name": "events_thread_type_item_kind_sequence_idx", + "columns": [ + "thread_id", + "type", + "item_kind", + "sequence" + ], + "isUnique": false + }, + "events_thread_type_sequence_idx": { + "name": "events_thread_type_sequence_idx", + "columns": [ + "thread_id", + "type", + "sequence" + ], + "isUnique": false + }, + "events_thread_turn_type_item_sequence_idx": { + "name": "events_thread_turn_type_item_sequence_idx", + "columns": [ + "thread_id", + "turn_id", + "type", + "item_id", + "sequence" + ], + "isUnique": false + }, + "events_environment_idx": { + "name": "events_environment_idx", + "columns": [ + "environment_id" + ], + "isUnique": false + }, + "events_completed_item_truncation_idx": { + "name": "events_completed_item_truncation_idx", + "columns": [ + "item_kind", + "created_at", + "id" + ], + "isUnique": false, + "where": "\"events\".\"type\" = 'item/completed'" + }, + "events_turn_completion_idx": { + "name": "events_turn_completion_idx", + "columns": [ + "thread_id", + "turn_id", + "sequence", + "item_kind" + ], + "isUnique": false, + "where": "\"type\" = 'item/completed'" + } + }, + "foreignKeys": { + "events_thread_id_threads_id_fk": { + "name": "events_thread_id_threads_id_fk", + "tableFrom": "events", + "tableTo": "threads", + "columnsFrom": [ + "thread_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "events_environment_id_environments_id_fk": { + "name": "events_environment_id_environments_id_fk", + "tableFrom": "events", + "tableTo": "environments", + "columnsFrom": [ + "environment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": { + "events_scope_shape_check": { + "name": "events_scope_shape_check", + "value": "(\n (\"events\".\"scope_kind\" = 'turn' AND \"events\".\"turn_id\" IS NOT NULL)\n OR\n (\"events\".\"scope_kind\" = 'thread' AND \"events\".\"turn_id\" IS NULL)\n )" + } + } + }, + "host_daemon_sessions": { + "name": "host_daemon_sessions", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "host_id": { + "name": "host_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "instance_id": { + "name": "instance_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "host_name": { + "name": "host_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "host_type": { + "name": "host_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "data_dir": { + "name": "data_dir", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "protocol_version": { + "name": "protocol_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "heartbeat_interval_ms": { + "name": "heartbeat_interval_ms", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "lease_timeout_ms": { + "name": "lease_timeout_ms", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "lease_expires_at": { + "name": "lease_expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "closed_at": { + "name": "closed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "close_reason": { + "name": "close_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "host_daemon_sessions_host_status_idx": { + "name": "host_daemon_sessions_host_status_idx", + "columns": [ + "host_id", + "status" + ], + "isUnique": false + }, + "host_daemon_sessions_host_latest_idx": { + "name": "host_daemon_sessions_host_latest_idx", + "columns": [ + "host_id", + "updated_at", + "created_at", + "id" + ], + "isUnique": false + }, + "host_daemon_sessions_closed_prune_idx": { + "name": "host_daemon_sessions_closed_prune_idx", + "columns": [ + "status", + "closed_at", + "id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "host_daemon_sessions_host_id_hosts_id_fk": { + "name": "host_daemon_sessions_host_id_hosts_id_fk", + "tableFrom": "host_daemon_sessions", + "tableTo": "hosts", + "columnsFrom": [ + "host_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "hosts": { + "name": "hosts", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "connect_machine_id": { + "name": "connect_machine_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "destroyed_at": { + "name": "destroyed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_rejected_protocol_version": { + "name": "last_rejected_protocol_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "hosts_last_seen_idx": { + "name": "hosts_last_seen_idx", + "columns": [ + "last_seen_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugins": { + "name": "plugins", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provenance": { + "name": "provenance", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'direct'" + }, + "catalog_entry_id": { + "name": "catalog_entry_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_kind": { + "name": "source_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'path'" + }, + "source_path": { + "name": "source_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_builtin_name": { + "name": "source_builtin_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_npm_package": { + "name": "source_npm_package", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_npm_registry": { + "name": "source_npm_registry", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_npm_requested_spec": { + "name": "source_npm_requested_spec", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_npm_spec_kind": { + "name": "source_npm_spec_kind", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_url": { + "name": "source_git_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_subdirectory": { + "name": "source_git_subdirectory", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_requested_ref": { + "name": "source_git_requested_ref", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_ref_kind": { + "name": "source_git_ref_kind", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "npm_resolved_version": { + "name": "npm_resolved_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "npm_integrity": { + "name": "npm_integrity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "git_resolved_commit": { + "name": "git_resolved_commit", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_update_check_at": { + "name": "last_update_check_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "available_compatible_version": { + "name": "available_compatible_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "newest_incompatible_version": { + "name": "newest_incompatible_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "update_status_detail": { + "name": "update_status_detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_failure_version": { + "name": "last_failure_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_failure_at": { + "name": "last_failure_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_failure_detail": { + "name": "last_failure_detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "active_artifact_id": { + "name": "active_artifact_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "normalization_version": { + "name": "normalization_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "root_dir": { + "name": "root_dir", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "removed_at": { + "name": "removed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "installed_at": { + "name": "installed_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "plugins_active_artifact_id_plugin_artifacts_id_fk": { + "name": "plugins_active_artifact_id_plugin_artifacts_id_fk", + "tableFrom": "plugins", + "tableTo": "plugin_artifacts", + "columnsFrom": [ + "active_artifact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "maintenance_scan_cursors": { + "name": "maintenance_scan_cursors", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "policy": { + "name": "policy", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "item_kind": { + "name": "item_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "output_path": { + "name": "output_path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_created_at": { + "name": "last_created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_event_id": { + "name": "last_event_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "maintenance_scan_cursors_path_idx": { + "name": "maintenance_scan_cursors_path_idx", + "columns": [ + "policy", + "version", + "item_kind", + "output_path" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "pending_interactions": { + "name": "pending_interactions", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "origin_kind": { + "name": "origin_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'provider'" + }, + "turn_id": { + "name": "turn_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_thread_id": { + "name": "provider_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_request_id": { + "name": "provider_request_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "renderer_id": { + "name": "renderer_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "resolution": { + "name": "resolution", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status_reason": { + "name": "status_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "resolved_at": { + "name": "resolved_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "pending_interactions_provider_request_idx": { + "name": "pending_interactions_provider_request_idx", + "columns": [ + "provider_id", + "provider_thread_id", + "provider_request_id" + ], + "isUnique": true + }, + "pending_interactions_thread_created_idx": { + "name": "pending_interactions_thread_created_idx", + "columns": [ + "thread_id", + "created_at" + ], + "isUnique": false + }, + "pending_interactions_thread_status_created_idx": { + "name": "pending_interactions_thread_status_created_idx", + "columns": [ + "thread_id", + "status", + "created_at" + ], + "isUnique": false + }, + "pending_interactions_status_created_idx": { + "name": "pending_interactions_status_created_idx", + "columns": [ + "status", + "created_at" + ], + "isUnique": false + }, + "pending_interactions_plugin_status_created_idx": { + "name": "pending_interactions_plugin_status_created_idx", + "columns": [ + "plugin_id", + "status", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "pending_interactions_thread_id_threads_id_fk": { + "name": "pending_interactions_thread_id_threads_id_fk", + "tableFrom": "pending_interactions", + "tableTo": "threads", + "columnsFrom": [ + "thread_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_artifacts": { + "name": "plugin_artifacts", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_kind": { + "name": "source_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "npm_resolved_version": { + "name": "npm_resolved_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "git_resolved_commit": { + "name": "git_resolved_commit", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "integrity": { + "name": "integrity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "validation_result": { + "name": "validation_result", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "validated_at": { + "name": "validated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "plugin_artifacts_plugin_idx": { + "name": "plugin_artifacts_plugin_idx", + "columns": [ + "plugin_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_kv": { + "name": "plugin_kv", + "columns": { + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "plugin_kv_plugin_id_key_pk": { + "columns": [ + "plugin_id", + "key" + ], + "name": "plugin_kv_plugin_id_key_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_schedules": { + "name": "plugin_schedules", + "columns": { + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cron": { + "name": "cron", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "next_run_at": { + "name": "next_run_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_run_at": { + "name": "last_run_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_status": { + "name": "last_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "plugin_schedules_plugin_id_name_pk": { + "columns": [ + "plugin_id", + "name" + ], + "name": "plugin_schedules_plugin_id_name_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_settings": { + "name": "plugin_settings", + "columns": { + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "plugin_settings_plugin_id_key_pk": { + "columns": [ + "plugin_id", + "key" + ], + "name": "plugin_settings_plugin_id_key_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_state_snapshots": { + "name": "plugin_state_snapshots", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "from_artifact_id": { + "name": "from_artifact_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "to_artifact_id": { + "name": "to_artifact_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "snapshot_path": { + "name": "snapshot_path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "database_path": { + "name": "database_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "state_path": { + "name": "state_path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "secrets_path": { + "name": "secrets_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "registration_path": { + "name": "registration_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rollback_candidate_version": { + "name": "rollback_candidate_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rollback_source_fingerprint": { + "name": "rollback_source_fingerprint", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rollback_bb_version": { + "name": "rollback_bb_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rollback_sdk_version": { + "name": "rollback_sdk_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rollback_detail": { + "name": "rollback_detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "retained_until": { + "name": "retained_until", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "plugin_state_snapshots_plugin_idx": { + "name": "plugin_state_snapshots_plugin_idx", + "columns": [ + "plugin_id" + ], + "isUnique": false + }, + "plugin_state_snapshots_retention_idx": { + "name": "plugin_state_snapshots_retention_idx", + "columns": [ + "retained_until" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "project_execution_defaults": { + "name": "project_execution_defaults", + "columns": { + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "service_tier": { + "name": "service_tier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reasoning_level": { + "name": "reasoning_level", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "permission_mode": { + "name": "permission_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "project_execution_defaults_project_idx": { + "name": "project_execution_defaults_project_idx", + "columns": [ + "project_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "project_execution_defaults_project_id_projects_id_fk": { + "name": "project_execution_defaults_project_id_projects_id_fk", + "tableFrom": "project_execution_defaults", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "project_sources": { + "name": "project_sources", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "host_id": { + "name": "host_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_default": { + "name": "is_default", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "project_sources_project_idx": { + "name": "project_sources_project_idx", + "columns": [ + "project_id" + ], + "isUnique": false + }, + "project_sources_host_idx": { + "name": "project_sources_host_idx", + "columns": [ + "host_id" + ], + "isUnique": false + }, + "project_sources_project_host_idx": { + "name": "project_sources_project_host_idx", + "columns": [ + "project_id", + "host_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "project_sources_project_id_projects_id_fk": { + "name": "project_sources_project_id_projects_id_fk", + "tableFrom": "project_sources", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "project_sources_host_id_hosts_id_fk": { + "name": "project_sources_host_id_hosts_id_fk", + "tableFrom": "project_sources", + "tableTo": "hosts", + "columnsFrom": [ + "host_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": { + "project_sources_shape_check": { + "name": "project_sources_shape_check", + "value": "(\n \"project_sources\".\"type\" = 'local_path' AND \"project_sources\".\"host_id\" IS NOT NULL AND \"project_sources\".\"path\" IS NOT NULL\n )" + } + } + }, + "projects": { + "name": "projects", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'standard'" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "git_remote_url": { + "name": "git_remote_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_key": { + "name": "sort_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'V'" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "projects_updated_idx": { + "name": "projects_updated_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + }, + "projects_deleted_idx": { + "name": "projects_deleted_idx", + "columns": [ + "deleted_at" + ], + "isUnique": false + }, + "projects_sort_idx": { + "name": "projects_sort_idx", + "columns": [ + "sort_key", + "id" + ], + "isUnique": false + }, + "projects_personal_singleton_idx": { + "name": "projects_personal_singleton_idx", + "columns": [ + "kind" + ], + "isUnique": true, + "where": "\"projects\".\"kind\" = 'personal'" + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "prompt_history_entries": { + "name": "prompt_history_entries", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "request_sequence": { + "name": "request_sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "input": { + "name": "input", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "prompt_history_entries_thread_request_idx": { + "name": "prompt_history_entries_thread_request_idx", + "columns": [ + "thread_id", + "request_sequence" + ], + "isUnique": true + }, + "prompt_history_entries_project_scope_created_idx": { + "name": "prompt_history_entries_project_scope_created_idx", + "columns": [ + "project_id", + "scope", + "created_at", + "request_sequence", + "id" + ], + "isUnique": false + }, + "prompt_history_entries_thread_scope_created_idx": { + "name": "prompt_history_entries_thread_scope_created_idx", + "columns": [ + "thread_id", + "scope", + "created_at", + "request_sequence", + "id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "prompt_history_entries_project_id_projects_id_fk": { + "name": "prompt_history_entries_project_id_projects_id_fk", + "tableFrom": "prompt_history_entries", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "prompt_history_entries_thread_id_threads_id_fk": { + "name": "prompt_history_entries_thread_id_threads_id_fk", + "tableFrom": "prompt_history_entries", + "tableTo": "threads", + "columnsFrom": [ + "thread_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "queued_thread_messages": { + "name": "queued_thread_messages", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sender_thread_id": { + "name": "sender_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reasoning_level": { + "name": "reasoning_level", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "permission_mode": { + "name": "permission_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "service_tier": { + "name": "service_tier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "group_with_next": { + "name": "group_with_next", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "claimed_at": { + "name": "claimed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "claim_token": { + "name": "claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_key": { + "name": "sort_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "queued_thread_messages_thread_created_idx": { + "name": "queued_thread_messages_thread_created_idx", + "columns": [ + "thread_id", + "created_at", + "id" + ], + "isUnique": false + }, + "queued_thread_messages_thread_sort_idx": { + "name": "queued_thread_messages_thread_sort_idx", + "columns": [ + "thread_id", + "sort_key", + "id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "queued_thread_messages_thread_id_threads_id_fk": { + "name": "queued_thread_messages_thread_id_threads_id_fk", + "tableFrom": "queued_thread_messages", + "tableTo": "threads", + "columnsFrom": [ + "thread_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "system_experiments": { + "name": "system_experiments", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "claude_code_mock_cli_traffic": { + "name": "claude_code_mock_cli_traffic", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "thread_splits": { + "name": "thread_splits", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "plugins": { + "name": "plugins", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "terminal_sessions": { + "name": "terminal_sessions", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "environment_id": { + "name": "environment_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "host_id": { + "name": "host_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "daemon_session_id": { + "name": "daemon_session_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "initial_cwd": { + "name": "initial_cwd", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cols": { + "name": "cols", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rows": { + "name": "rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "exit_code": { + "name": "exit_code", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "close_reason": { + "name": "close_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_user_input_at": { + "name": "last_user_input_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "terminal_sessions_thread_status_updated_idx": { + "name": "terminal_sessions_thread_status_updated_idx", + "columns": [ + "thread_id", + "status", + "updated_at" + ], + "isUnique": false + }, + "terminal_sessions_environment_status_idx": { + "name": "terminal_sessions_environment_status_idx", + "columns": [ + "environment_id", + "status" + ], + "isUnique": false + }, + "terminal_sessions_host_status_idx": { + "name": "terminal_sessions_host_status_idx", + "columns": [ + "host_id", + "status" + ], + "isUnique": false + }, + "terminal_sessions_daemon_session_idx": { + "name": "terminal_sessions_daemon_session_idx", + "columns": [ + "daemon_session_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "terminal_sessions_thread_id_threads_id_fk": { + "name": "terminal_sessions_thread_id_threads_id_fk", + "tableFrom": "terminal_sessions", + "tableTo": "threads", + "columnsFrom": [ + "thread_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "terminal_sessions_environment_id_environments_id_fk": { + "name": "terminal_sessions_environment_id_environments_id_fk", + "tableFrom": "terminal_sessions", + "tableTo": "environments", + "columnsFrom": [ + "environment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "terminal_sessions_host_id_hosts_id_fk": { + "name": "terminal_sessions_host_id_hosts_id_fk", + "tableFrom": "terminal_sessions", + "tableTo": "hosts", + "columnsFrom": [ + "host_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "terminal_sessions_daemon_session_id_host_daemon_sessions_id_fk": { + "name": "terminal_sessions_daemon_session_id_host_daemon_sessions_id_fk", + "tableFrom": "terminal_sessions", + "tableTo": "host_daemon_sessions", + "columnsFrom": [ + "daemon_session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_dynamic_context_file_states": { + "name": "thread_dynamic_context_file_states", + "columns": { + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "file_key": { + "name": "file_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_status": { + "name": "content_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "shown_at": { + "name": "shown_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "thread_dynamic_context_file_states_thread_file_idx": { + "name": "thread_dynamic_context_file_states_thread_file_idx", + "columns": [ + "thread_id", + "file_key" + ], + "isUnique": true + } + }, + "foreignKeys": { + "thread_dynamic_context_file_states_thread_id_threads_id_fk": { + "name": "thread_dynamic_context_file_states_thread_id_threads_id_fk", + "tableFrom": "thread_dynamic_context_file_states", + "tableTo": "threads", + "columnsFrom": [ + "thread_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_folders": { + "name": "thread_folders", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "thread_folders_name_idx": { + "name": "thread_folders_name_idx", + "columns": [ + "name" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_search_segments": { + "name": "thread_search_segments", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_kind": { + "name": "source_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_key": { + "name": "source_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_seq": { + "name": "source_seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "thread_search_segments_source_idx": { + "name": "thread_search_segments_source_idx", + "columns": [ + "thread_id", + "source_kind", + "source_key" + ], + "isUnique": true + }, + "thread_search_segments_thread_idx": { + "name": "thread_search_segments_thread_idx", + "columns": [ + "thread_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "thread_search_segments_thread_id_threads_id_fk": { + "name": "thread_search_segments_thread_id_threads_id_fk", + "tableFrom": "thread_search_segments", + "tableTo": "threads", + "columnsFrom": [ + "thread_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_tabs": { + "name": "thread_tabs", + "columns": { + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "tabs_json": { + "name": "tabs_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "revision": { + "name": "revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "thread_tabs_thread_id_threads_id_fk": { + "name": "thread_tabs_thread_id_threads_id_fk", + "tableFrom": "thread_tabs", + "tableTo": "threads", + "columnsFrom": [ + "thread_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "threads": { + "name": "threads", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "environment_id": { + "name": "environment_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model_override": { + "name": "model_override", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reasoning_level_override": { + "name": "reasoning_level_override", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "title_fallback": { + "name": "title_fallback", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "folder_id": { + "name": "folder_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'starting'" + }, + "parent_thread_id": { + "name": "parent_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_thread_id": { + "name": "source_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "origin_kind": { + "name": "origin_kind", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "child_origin": { + "name": "child_origin", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "origin_plugin_id": { + "name": "origin_plugin_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'visible'" + }, + "archived_at": { + "name": "archived_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pinned_at": { + "name": "pinned_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pin_sort_key": { + "name": "pin_sort_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_read_at": { + "name": "last_read_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "latest_attention_at": { + "name": "latest_attention_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "threads_project_updated_idx": { + "name": "threads_project_updated_idx", + "columns": [ + "project_id", + "updated_at" + ], + "isUnique": false + }, + "threads_project_archived_deleted_idx": { + "name": "threads_project_archived_deleted_idx", + "columns": [ + "project_id", + "archived_at", + "deleted_at", + "id" + ], + "isUnique": false + }, + "threads_pin_sort_idx": { + "name": "threads_pin_sort_idx", + "columns": [ + "archived_at", + "deleted_at", + "pin_sort_key", + "id" + ], + "isUnique": false, + "where": "\"threads\".\"pinned_at\" IS NOT NULL" + }, + "threads_environment_idx": { + "name": "threads_environment_idx", + "columns": [ + "environment_id" + ], + "isUnique": false + }, + "threads_parent_idx": { + "name": "threads_parent_idx", + "columns": [ + "parent_thread_id" + ], + "isUnique": false + }, + "threads_source_origin_idx": { + "name": "threads_source_origin_idx", + "columns": [ + "source_thread_id", + "origin_kind" + ], + "isUnique": false + }, + "threads_folder_archived_deleted_idx": { + "name": "threads_folder_archived_deleted_idx", + "columns": [ + "folder_id", + "archived_at", + "deleted_at", + "id" + ], + "isUnique": false + }, + "threads_archived_status_idx": { + "name": "threads_archived_status_idx", + "columns": [ + "archived_at", + "status" + ], + "isUnique": false + }, + "threads_environment_archived_deleted_idx": { + "name": "threads_environment_archived_deleted_idx", + "columns": [ + "environment_id", + "archived_at", + "deleted_at" + ], + "isUnique": false + }, + "threads_active_maintenance_idx": { + "name": "threads_active_maintenance_idx", + "columns": [ + "status" + ], + "isUnique": false, + "where": "\"threads\".\"deleted_at\" IS NULL" + } + }, + "foreignKeys": { + "threads_project_id_projects_id_fk": { + "name": "threads_project_id_projects_id_fk", + "tableFrom": "threads", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "threads_environment_id_environments_id_fk": { + "name": "threads_environment_id_environments_id_fk", + "tableFrom": "threads", + "tableTo": "environments", + "columnsFrom": [ + "environment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "threads_folder_id_thread_folders_id_fk": { + "name": "threads_folder_id_thread_folders_id_fk", + "tableFrom": "threads", + "tableTo": "thread_folders", + "columnsFrom": [ + "folder_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "threads_parent_thread_id_threads_id_fk": { + "name": "threads_parent_thread_id_threads_id_fk", + "tableFrom": "threads", + "tableTo": "threads", + "columnsFrom": [ + "parent_thread_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "threads_source_thread_id_threads_id_fk": { + "name": "threads_source_thread_id_threads_id_fk", + "tableFrom": "threads", + "tableTo": "threads", + "columnsFrom": [ + "source_thread_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index 166ef763ed..b2e0213dee 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -533,6 +533,13 @@ "when": 1784216319756, "tag": "0075_productive_zeigeist", "breakpoints": true + }, + { + "idx": 76, + "version": "6", + "when": 1784240978886, + "tag": "0076_lovely_namorita", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/src/data/events.ts b/packages/db/src/data/events.ts index 26813c3b77..1710454e4c 100644 --- a/packages/db/src/data/events.ts +++ b/packages/db/src/data/events.ts @@ -6,6 +6,7 @@ import { gte, inArray, isNotNull, + isNull, lt, lte, max, @@ -1680,12 +1681,20 @@ export function listStoredConversationOutlineEventRows( "system/error", "system/thread/interrupted", "item/agentMessage/delta", + "item/plan/delta", "system/manager/user_message", ] satisfies ThreadEventType[]; const agentItemTypes = [ "item/started", "item/completed", ] satisfies ThreadEventType[]; + // Plan items project to assistant text too (parseAssistantFinalText). The + // json_extract fallback runs only for legacy rows written before the + // item_kind column — typed rows never touch the (potentially huge) payload. + const conversationItemKinds = [ + "agentMessage", + "plan", + ] satisfies ThreadEventItemType[]; return db .select(storedEventRowFields) @@ -1698,8 +1707,11 @@ export function listStoredConversationOutlineEventRows( and( inArray(events.type, agentItemTypes), or( - eq(events.itemKind, "agentMessage"), - sql`json_extract(${events.data}, '$.item.type') = 'agentMessage'`, + inArray(events.itemKind, conversationItemKinds), + and( + isNull(events.itemKind), + sql`json_extract(${events.data}, '$.item.type') IN ('agentMessage', 'plan')`, + ), ), ), ), @@ -1714,17 +1726,25 @@ export function listStoredConversationOutlineEventRows( * reasoning — the unit the timeline's turn-work pagination and the active-turn * collapse frontier count in. Reasoning completions are excluded because they * never render as work rows, so counting them would make page sizes drift with - * how chatty a model's thinking is. + * how chatty a model's thinking is. Legacy rows written before the item_kind + * column fall back to the item payload's type. All completion queries are + * bounded by `sequenceEnd` so results are deterministic per (thread, maxSeq) — + * the timeline response cache keys on that revision. */ function turnWorkItemCompletionConditions(args: { threadId: string; turnId: string; + sequenceEnd: number; }): SQL | undefined { return and( eq(events.threadId, args.threadId), eq(events.turnId, args.turnId), eq(events.type, "item/completed"), - sql`(${events.itemKind} IS NULL OR ${events.itemKind} <> 'reasoning')`, + lte(events.sequence, args.sequenceEnd), + sql`CASE + WHEN ${events.itemKind} IS NOT NULL THEN ${events.itemKind} <> 'reasoning' + ELSE COALESCE(json_extract(${events.data}, '$.item.type'), '') <> 'reasoning' + END`, ); } @@ -1749,7 +1769,6 @@ export function listTurnWorkItemCompletionSequencesDescending( and( turnWorkItemCompletionConditions(args), gte(events.sequence, args.sequenceStart), - lte(events.sequence, args.sequenceEnd), ), ) .orderBy(desc(events.sequence)) @@ -1761,6 +1780,8 @@ export function listTurnWorkItemCompletionSequencesDescending( export interface CountTurnWorkItemCompletionsArgs { threadId: string; turnId: string; + /** Inclusive upper sequence bound (the build's maxSeq). */ + sequenceEnd: number; } export function countTurnWorkItemCompletions( @@ -1780,6 +1801,8 @@ export interface GetTurnWorkItemCompletionSequenceByIndexArgs { turnId: string; /** Zero-based index in ascending sequence order. */ index: number; + /** Inclusive upper sequence bound (the build's maxSeq). */ + sequenceEnd: number; } export function getTurnWorkItemCompletionSequenceByIndex( @@ -1797,6 +1820,59 @@ export function getTurnWorkItemCompletionSequenceByIndex( return row?.sequence ?? null; } +export interface GetActiveStoredTurnIdAtSequenceArgs { + threadId: string; + /** Inclusive upper sequence bound (the build's maxSeq). */ + sequenceEnd: number; +} + +/** + * Bounded variant of {@link getActiveStoredTurnId}: the turn that was running + * as of `sequenceEnd`. Used by the collapse-frontier resolution so a timeline + * response cached per (thread, maxSeq) never bakes in turn state from events + * appended after that revision. + */ +export function getActiveStoredTurnIdAtSequence( + db: DbQueryConnection, + args: GetActiveStoredTurnIdAtSequenceArgs, +): string | null { + const latestStarted = db + .select({ turnId: events.turnId }) + .from(events) + .where( + and( + eq(events.threadId, args.threadId), + eq(events.type, "turn/started"), + lte(events.sequence, args.sequenceEnd), + isNotNull(events.turnId), + isRootTurnStartedEventData, + ), + ) + .orderBy(desc(events.sequence)) + .limit(1) + .get(); + + if (!latestStarted?.turnId) { + return null; + } + + const completed = db + .select({ sequence: events.sequence }) + .from(events) + .where( + and( + eq(events.threadId, args.threadId), + eq(events.turnId, latestStarted.turnId), + eq(events.type, "turn/completed"), + lte(events.sequence, args.sequenceEnd), + ), + ) + .limit(1) + .get(); + + return completed ? null : latestStarted.turnId; +} + export interface HasTurnCompletedEventArgs { threadId: string; turnId: string; diff --git a/packages/db/src/data/index.ts b/packages/db/src/data/index.ts index 485df51030..4a8ac0b739 100644 --- a/packages/db/src/data/index.ts +++ b/packages/db/src/data/index.ts @@ -295,6 +295,7 @@ export { findStoredClientTurnRequestSequenceByRequestId, findStoredEventRow, getActiveStoredTurnId, + getActiveStoredTurnIdAtSequence, getTurnWorkItemCompletionSequenceByIndex, hasTurnCompletedEvent, listTurnWorkItemCompletionSequencesDescending, diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts index 69f0e2be23..368ca3b1f6 100644 --- a/packages/db/src/schema.ts +++ b/packages/db/src/schema.ts @@ -662,6 +662,15 @@ export const events = sqliteTable( index("events_completed_item_truncation_idx") .on(table.itemKind, table.createdAt, table.id) .where(sql`${table.type} = 'item/completed'`), + // Covering index for turn work-item completion queries (collapse frontier + // + turn-work paging): count/nth/descending-list all resolve without + // touching row payloads. item_kind is included so the reasoning exclusion + // stays an index-only residual. The WHERE expression must stay + // unqualified: SQLite rejects table-qualified column references in + // partial-index predicates. + index("events_turn_completion_idx") + .on(table.threadId, table.turnId, table.sequence, table.itemKind) + .where(sql`"type" = 'item/completed'`), check( "events_scope_shape_check", sql`( diff --git a/packages/db/test/migrate.test.ts b/packages/db/test/migrate.test.ts index 3d7e5b511f..d26a15b3c6 100644 --- a/packages/db/test/migrate.test.ts +++ b/packages/db/test/migrate.test.ts @@ -222,6 +222,9 @@ function dropRewindAddedTables(db: DbConnection): void { // schema (thread folder columns + thread_folders table), thread tabs, and // normalized plugin persistence tables. db.$client.prepare("DROP TABLE IF EXISTS thread_tabs").run(); + // Index added by 0074; the events table itself predates the rewind point, + // so only the index must be dropped for the forward re-migrate. + db.$client.prepare("DROP INDEX IF EXISTS events_turn_completion_idx").run(); db.$client.prepare("DROP TABLE IF EXISTS automation_runs").run(); db.$client.prepare("DROP TABLE IF EXISTS automations").run(); db.$client.prepare("DROP TABLE IF EXISTS app_theme").run(); @@ -2941,6 +2944,7 @@ describe("migrate", () => { "events_thread_turn_type_item_sequence_idx", "events_thread_type_item_kind_sequence_idx", "events_thread_type_sequence_idx", + "events_turn_completion_idx", ]); const migrationCreatedAts = db.$client diff --git a/packages/sdk/src/areas/threads.ts b/packages/sdk/src/areas/threads.ts index 02bbea06b3..f2b3249e37 100644 --- a/packages/sdk/src/areas/threads.ts +++ b/packages/sdk/src/areas/threads.ts @@ -908,6 +908,12 @@ export function createThreadsArea(args: CreateSdkAreaArgs): ThreadsArea { turnId: input.turnId, sourceSeqStart: input.sourceSeqStart, sourceSeqEnd: input.sourceSeqEnd, + ...(input.workItemLimit === undefined + ? {} + : { workItemLimit: input.workItemLimit }), + ...(input.afterSeq === undefined + ? {} + : { afterSeq: input.afterSeq }), }, }), ); diff --git a/packages/thread-view/src/build-thread-timeline.ts b/packages/thread-view/src/build-thread-timeline.ts index 6c7374c85d..5119331703 100644 --- a/packages/thread-view/src/build-thread-timeline.ts +++ b/packages/thread-view/src/build-thread-timeline.ts @@ -1335,7 +1335,9 @@ export interface BuildThreadTimelineTurnWorkPageFromEventsArgs { options: BuildThreadTimelineTurnWorkPageFromEventsOptions; } -function isPendingStatusRow(row: TimelineRow): boolean { +function isPendingStatusRow( + row: TimelineRow, +): row is Extract { switch (row.kind) { case "work": return row.status === "pending"; @@ -1350,13 +1352,24 @@ function isPendingStatusRow(row: TimelineRow): boolean { } function finalizePendingStatusRow(row: TimelineRow): TimelineRow { - if (row.kind === "work" && row.status === "pending") { - return { ...row, status: "interrupted" }; - } - if (row.kind === "system" && row.status === "pending") { - return { ...row, status: "interrupted" }; + return isPendingStatusRow(row) ? { ...row, status: "interrupted" } : row; +} + +/** + * User rows the main timeline renders at the top level must not repeat inside + * a work page — but agent/system-initiated steers are summary-groupable + * (mirrors isTimelineSummaryGroupableSteerMessage), fold INTO the summary for + * completed turns, and therefore must stay in the page or they would be + * unreachable anywhere in the UI. + */ +function isTopLevelUserConversationRow(row: TimelineRow): boolean { + if (row.kind !== "conversation" || row.role !== "user") { + return false; } - return row; + const isGroupableSteer = + row.turnRequest.kind === "steer" && + (row.initiator === "agent" || row.initiator === "system"); + return !isGroupableSteer; } /** @@ -1397,7 +1410,7 @@ export function buildThreadTimelineTurnWorkPageFromEvents( turnSummaryRows.length > 0 ? turnSummaryRows.flatMap((row) => row.children ?? []) : rows.filter((row) => { - if (row.kind === "conversation" && row.role === "user") { + if (isTopLevelUserConversationRow(row)) { return false; } if (row.kind === "system" && row.systemKind === "debug") { diff --git a/packages/thread-view/src/completed-turn-grouping.ts b/packages/thread-view/src/completed-turn-grouping.ts index 1a874539f0..f321bd1e90 100644 --- a/packages/thread-view/src/completed-turn-grouping.ts +++ b/packages/thread-view/src/completed-turn-grouping.ts @@ -252,6 +252,14 @@ export function groupPartialTurnMessages( } tailMessages.push(message); } + if (prefixMessages.length === 0) { + // Nothing settled below the frontier (e.g. every counted completion + // belongs to still-running or suppressed work): no summary row. Without + // this guard the single-group fast path would fall back to + // turn.summaryCount and whole-turn bounds, emitting a bogus "Worked so + // far" row above the same rows rendered flat. + return { summaryItems: [], tailMessages }; + } return { summaryItems: groupCompletedTurnSummaryMessages(turn, prefixMessages), tailMessages, diff --git a/packages/thread-view/test/partial-turn-collapse.test.ts b/packages/thread-view/test/partial-turn-collapse.test.ts index 667377f8a5..939a35cd36 100644 --- a/packages/thread-view/test/partial-turn-collapse.test.ts +++ b/packages/thread-view/test/partial-turn-collapse.test.ts @@ -153,6 +153,18 @@ describe("active-turn partial collapse", () => { ); }); + it("emits no partial row when nothing settled sits below the frontier", () => { + const factory = event(); + const rows = buildTimelineRowsFromEvents(activeTurnEvents(factory), { + // Frontier below every message's end: the settled prefix is empty, so + // no "Worked so far" row may appear (a bogus one would double-count the + // flat rows below it). + activeTurnCollapseFrontiers: new Map([["turn-1", 9]]), + }); + expect(turnRows(rows)).toEqual([]); + expect(commandRowCommands(rows)).toHaveLength(6); + }); + it("renders flat rows when no frontier is provided", () => { const rows = buildTimelineRowsFromEvents(activeTurnEvents(event())); expect(turnRows(rows)).toEqual([]); From ee850f1cefafc48c3dd92d59127a31ce7db61e9e Mon Sep 17 00:00:00 2001 From: Sawyer Hood Date: Thu, 16 Jul 2026 02:44:21 -0700 Subject: [PATCH 3/3] Regenerate templates after contract and migration changes Co-Authored-By: Claude Fable 5 --- packages/templates/src/generated/plugin-sdk-dts.generated.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/templates/src/generated/plugin-sdk-dts.generated.ts b/packages/templates/src/generated/plugin-sdk-dts.generated.ts index 1a1157da49..f55b3d6f20 100644 --- a/packages/templates/src/generated/plugin-sdk-dts.generated.ts +++ b/packages/templates/src/generated/plugin-sdk-dts.generated.ts @@ -2,6 +2,6 @@ // Generated by packages/templates/scripts/generate-templates.mjs from // @bb/plugin-sdk/bundled-types. Do not edit directly. -export const PLUGIN_SDK_DTS = "// Portable type declarations for `@bb/plugin-sdk`. Unpublished BB\n// workspace contracts are flattened; public subpaths may reuse the\n// package root without requiring any other @bb/* package.\n//\n// Confused by the API, or need a symbol that isn't here? Clone the BB repo\n// and read the real source: https://github.com/ymichael/bb\n\nimport { ComponentType } from 'react';\nimport Database from 'better-sqlite3';\nimport { Context } from 'hono';\nimport * as z from 'zod';\nimport { z as z$1 } from 'zod';\n\n/**\n * A value that survives a JSON round trip without coercion or data loss.\n *\n * Host boundaries still validate values at runtime because TypeScript cannot\n * exclude non-finite numbers and plugin bundles can bypass static types.\n */\ntype JsonValue$1 = string | number | boolean | null | JsonValue$1[] | {\n [key: string]: JsonValue$1;\n};\n\n/** A JSON-safe path segment reported by a Standard Schema validation issue. */\ntype PluginRpcIssuePathSegment = string | number;\n/** Validator-neutral validation detail carried by an RPC error envelope. */\ninterface PluginRpcValidationIssue {\n message: string;\n path?: PluginRpcIssuePathSegment[];\n}\n/** Stable wire error categories for plugin RPC. */\ntype PluginRpcErrorCode = \"invalid_json\" | \"invalid_input\" | \"handler_error\" | \"invalid_output\" | \"non_json_result\" | \"unknown_method\";\n/** Structured RPC failure returned as `{ ok: false, error }`. */\ninterface PluginRpcError {\n code: PluginRpcErrorCode;\n message: string;\n issues?: PluginRpcValidationIssue[];\n}\n/**\n * The validator-neutral subset of Standard Schema v1 used by plugin RPC.\n * Zod 4 schemas implement this interface directly; other validators can do\n * the same without becoming part of BB's public protocol.\n */\ninterface StandardSchemaV1 {\n readonly \"~standard\": {\n readonly version: 1;\n readonly vendor: string;\n readonly validate: (value: unknown) => StandardSchemaV1Result | Promise>;\n readonly types?: {\n readonly input: Input;\n readonly output: Output;\n };\n };\n}\ntype StandardSchemaV1Result = {\n readonly value: Output;\n readonly issues?: undefined;\n} | {\n readonly issues: readonly StandardSchemaV1Issue[];\n};\ninterface StandardSchemaV1Issue {\n readonly message: string;\n readonly path?: PropertyKey | readonly (PropertyKey | {\n readonly key: PropertyKey;\n })[];\n}\ntype StandardSchemaV1InferInput = NonNullable[\"input\"];\ntype StandardSchemaV1InferOutput = NonNullable[\"output\"];\ninterface PluginRpcMethodContract {\n readonly input: InputSchema;\n readonly output: OutputSchema;\n}\ntype PluginRpcContract = Readonly>;\n/** Define a shared RPC contract while preserving exact method/schema types. */\ndeclare function defineRpcContract(contract: Contract): Contract;\ntype PluginRpcHandlers = {\n [Method in keyof Contract]: (input: StandardSchemaV1InferOutput) => StandardSchemaV1InferInput | Promise>;\n};\ntype PluginRpcCallInput = StandardSchemaV1InferInput;\ntype PluginRpcCallArgs = null extends PluginRpcCallInput ? [input?: PluginRpcCallInput] : [input: PluginRpcCallInput];\ntype PluginRpcResult = StandardSchemaV1InferOutput;\n\n/**\n * The `@bb/plugin-sdk/app` contract (plugin design §5.2) — pure types with no\n * side effects. The BB app imports these to keep its real implementation in\n * sync (`satisfies PluginSdkApp`). Plugin authors import the same shapes through\n * `@bb/plugin-sdk/app`.\n *\n * Per-slot props are versioned contracts: additive-only within an SDK major.\n */\n/** Props passed to a `homepageSection` component. */\ninterface PluginHomepageSectionProps {\n /** Project in view on the compose surface; null when none is selected. */\n projectId: string | null;\n}\n/**\n * Props passed to a `settingsSection` component.\n *\n * Deliberately empty in V1; versioned additive like the other slot props.\n */\ninterface PluginSettingsSectionProps {\n}\n/** Props passed to a `navPanel` component (it owns its whole route). */\ninterface PluginNavPanelProps {\n /**\n * The route remainder after the panel root, \"\" at the root. The panel's\n * route is `/plugins///*`, so a deep link like\n * `/plugins/notes/notes/work/ideas.md` renders the panel with\n * `subPath: \"work/ideas.md\"`. Navigate within the panel via\n * `useBbNavigate().toPluginPanel(path, { subPath })` — browser\n * back/forward then walks panel-internal history.\n */\n subPath: string;\n}\n/** Props passed to a panel tab opened by a `threadPanelAction`. */\ninterface PluginThreadPanelProps {\n threadId: string;\n /**\n * The JSON value the action's `openPanel` call passed (round-tripped\n * through persistence, so the tab restores across reloads); null when the\n * action opened the panel without params.\n */\n params: JsonValue$1 | null;\n}\n/** Props passed to a `composerAccessory` component. */\ninterface PluginComposerAccessoryProps {\n projectId: string | null;\n threadId: string | null;\n}\ninterface PluginPendingInteractionView {\n id: string;\n threadId: string;\n title: string;\n payload: JsonValue$1;\n createdAt: number;\n expiresAt: number | null;\n}\ninterface PluginPendingInteractionProps {\n interaction: PluginPendingInteractionView;\n submit(value: JsonValue$1): Promise;\n cancel(): Promise;\n}\n/**\n * Props for a `sidebarFooterAction` — host-rendered (no plugin component).\n * Deliberately empty; the registration's `run` carries the behavior.\n */\ninterface PluginSidebarFooterActionProps {\n}\n/**\n * Where a file being opened by a `fileOpener` lives. `path` semantics follow\n * the source: workspace paths are relative to the environment's worktree,\n * thread-storage paths are relative to the thread's storage root, host paths\n * are absolute on the thread's host.\n */\ninterface PluginFileOpenerSource {\n kind: \"workspace\" | \"host\" | \"thread-storage\";\n threadId: string | null;\n environmentId: string | null;\n projectId: string | null;\n}\n/** Props passed to a `fileOpener` component (rendered as a panel file tab). */\ninterface PluginFileOpenerProps {\n path: string;\n source: PluginFileOpenerSource;\n}\n/**\n * Message context passed to a `messageDirective` component — the assistant\n * (or nested agent) message that contained the directive.\n */\ninterface PluginMessageDirectiveMessage {\n id: string;\n threadId: string;\n turnId: string | null;\n projectId: string | null;\n}\n/**\n * Open a worktree-relative file in the host's workspace file viewer. Returns\n * true when the host accepted the path; false when the path is invalid or the\n * viewer declined it.\n */\ntype PluginMessageDirectiveOpenWorkspaceFile = (path: string) => boolean;\ninterface PluginMessageDirectiveThreadPanelOptions {\n /** A `threadPanelAction` id registered by this same plugin. */\n actionId: string;\n title?: string;\n params?: JsonValue$1;\n}\n/** Open this plugin's registered action in the current thread side panel. */\ntype PluginMessageDirectiveOpenThreadPanel = (options: PluginMessageDirectiveThreadPanelOptions) => boolean;\n/**\n * Props passed to a `messageDirective` component. Attributes are untrusted\n * strings parsed from the directive; the plugin validates its own fields.\n */\ninterface PluginMessageDirectiveProps {\n /** Parsed, untrusted directive attributes (e.g. `{ file: \"demo.html\" }`). */\n attributes: Readonly>;\n /** Original directive source text (useful for diagnostics / crash fallback). */\n source: string;\n message: PluginMessageDirectiveMessage;\n /**\n * Opens a worktree-relative file in the host's workspace file viewer. Null\n * when the message surface has no workspace viewer available.\n */\n openWorkspaceFile: PluginMessageDirectiveOpenWorkspaceFile | null;\n /**\n * Opens one of this plugin's own `threadPanelAction` components in the\n * current thread side panel. Omitted by older hosts; null on message\n * surfaces without a thread panel.\n */\n openThreadPanel?: PluginMessageDirectiveOpenThreadPanel | null;\n}\ninterface PluginHomepageSectionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n title: string;\n component: ComponentType;\n}\ninterface PluginSettingsSectionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Optional host-rendered section heading. */\n title?: string;\n /**\n * Optional one-line host-rendered subheading under `title`, in the built-in\n * SettingsSection idiom (ignored when `title` is absent).\n */\n description?: string;\n component: ComponentType;\n}\ninterface PluginNavPanelRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n title: string;\n /** Icon hint (BB icon name); unknown names fall back to a generic icon. */\n icon: string;\n /** URL segment under `/plugins//`; letters, digits, `-`, `_`. */\n path: string;\n component: ComponentType;\n /**\n * Optional component rendered on the right side of the shared title bar\n * (e.g. a sync button or a count). Contained separately from the body: a\n * throwing headerContent is hidden without breaking the title bar.\n */\n headerContent?: ComponentType;\n}\n/** Context handed to a `threadPanelAction`'s `run`. */\ninterface PluginThreadPanelActionContext {\n /** The thread whose panel launcher invoked the action. */\n threadId: string;\n /**\n * Open a tab in the thread's side panel rendering this action's\n * `component`. `title` labels the tab (default: the action's `title`);\n * `params` must be JSON-serializable — it is persisted with the tab and\n * reaches the component as its `params` prop. Opening with params\n * identical to an already-open tab of this action focuses that tab\n * (updating its title) instead of duplicating it. May be called more than\n * once (different params ⇒ multiple tabs) or not at all.\n */\n openPanel(options?: {\n title?: string;\n params?: JsonValue$1;\n }): void;\n}\ninterface PluginThreadPanelActionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Label of the action row in the panel's new-tab launcher. */\n title: string;\n /**\n * Icon hint (BB icon name) used when the plugin ships no logo; the\n * launcher row and opened tabs prefer the plugin's logo.\n */\n icon?: string;\n /** Rendered inside every panel tab this action opens. */\n component: ComponentType;\n /**\n * Runs when the user activates the action: call your RPC methods, show a\n * toast, and/or open panel tabs via `context.openPanel`. Omitted =\n * immediately open a panel tab with defaults. Errors (sync or async) are\n * contained and logged; they never break the launcher.\n */\n run?(context: PluginThreadPanelActionContext): void | Promise;\n}\ninterface PluginComposerAccessoryRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n component: ComponentType;\n}\ninterface PluginPendingInteractionRegistration {\n /** Matches `rendererId` passed to `bb.ui.requestInput`. */\n id: string;\n component: ComponentType;\n}\n/** Context handed to a `sidebarFooterAction`'s `run`. */\ninterface PluginSidebarFooterActionContext {\n /**\n * Navigate to this plugin's Settings detail page\n * (`/settings/plugins/`), where declarative settings and\n * `settingsSection` slots render.\n */\n openSettings(): void;\n}\n/**\n * An icon button in the app sidebar footer (next to Settings / bug report).\n * Host-rendered for consistent chrome — plugins supply icon, label, and\n * `run` behavior only.\n */\ninterface PluginSidebarFooterActionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Tooltip and accessible label for the icon button. */\n title: string;\n /** Icon hint (BB icon name); unknown names fall back to a generic icon. */\n icon: string;\n /**\n * Runs when the user activates the action (e.g. call `openSettings()`,\n * open a panel via other surfaces, toast). Errors (sync or async) are\n * contained and logged; they never break the sidebar.\n */\n run(context: PluginSidebarFooterActionContext): void | Promise;\n}\n/**\n * Register this plugin as a viewer/editor for file extensions. The user\n * picks (and can set as default) an opener per extension via the file tab's\n * \"Open with\" menu; matching files opened in the panel then render\n * `component` in a plugin tab instead of the built-in preview. Applies to\n * working-tree, host, and thread-storage files — never to git-ref snapshots\n * (diff views always use the built-in preview). The built-in preview stays\n * one menu click away, and a missing/disabled opener falls back to it.\n */\ninterface PluginFileOpenerRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Label in the \"Open with\" menu (e.g. \"Notes editor\"). */\n title: string;\n /** Lowercase extensions without the dot (e.g. [\"md\", \"mdx\"]). */\n extensions: readonly string[];\n component: ComponentType;\n}\n/**\n * Register a leaf message directive rendered inside assistant (and nested\n * agent) message Markdown. `id` is the directive name: `inline-vis` matches\n * `::inline-vis{file=\"demo.html\"}`.\n */\ninterface PluginMessageDirectiveRegistration {\n /**\n * The directive name. Lowercase kebab-case beginning with a letter.\n */\n id: string;\n component: ComponentType;\n}\ninterface PluginAppSlots {\n homepageSection(registration: PluginHomepageSectionRegistration): void;\n settingsSection(registration: PluginSettingsSectionRegistration): void;\n navPanel(registration: PluginNavPanelRegistration): void;\n threadPanelAction(registration: PluginThreadPanelActionRegistration): void;\n composerAccessory(registration: PluginComposerAccessoryRegistration): void;\n pendingInteraction(registration: PluginPendingInteractionRegistration): void;\n sidebarFooterAction(registration: PluginSidebarFooterActionRegistration): void;\n fileOpener(registration: PluginFileOpenerRegistration): void;\n messageDirective(registration: PluginMessageDirectiveRegistration): void;\n}\ninterface PluginAppBuilder {\n slots: PluginAppSlots;\n}\ntype PluginAppSetup = (app: PluginAppBuilder) => void;\n/**\n * The opaque product of `definePluginApp` — a plugin's `app.tsx` default\n * export. The host re-runs `setup` against a fresh collector on every\n * (re)interpretation, replacing that plugin's registrations wholesale.\n */\ninterface PluginAppDefinition {\n /** Brand the host checks before interpreting a bundle's default export. */\n readonly __bbPluginApp: true;\n readonly setup: PluginAppSetup;\n}\ninterface PluginRpcClient {\n /**\n * Invoke one of the plugin's `bb.rpc` methods (POST\n * /api/v1/plugins/<id>/rpc/<method>). Resolves with the method's\n * inferred output; rejects with an `Error` carrying the server's message,\n * stable `code`, and validation `issues` when present.\n */\n call>(method: Method, ...args: PluginRpcCallArgs): Promise>;\n}\ninterface PluginSettingsState {\n /**\n * Effective non-secret setting values (secret settings are excluded —\n * read them server-side). Undefined while loading or unavailable.\n */\n values: Record | undefined;\n isLoading: boolean;\n}\n/** State of the app's shared realtime connection to the bb server. */\ntype PluginRealtimeConnectionState = \"connecting\" | \"connected\" | \"reconnecting\";\n/** Where `useComposer()` writes: the active thread's draft or the new-thread draft. */\ntype PluginComposerScope = {\n kind: \"thread\";\n threadId: string;\n} | {\n kind: \"new-thread\";\n projectId: string | null;\n};\n/** An @-mention pill bound to one of the calling plugin's mention providers. */\ninterface PluginComposerMention {\n /** Mention provider id registered by THIS plugin via `bb.ui.registerMentionProvider`. */\n provider: string;\n /** Item id your provider's `resolve` will receive at send time. */\n id: string;\n /** Pill text shown in the composer. */\n label: string;\n}\n/**\n * Programmatic access to the chat composer draft — the same shared draft the\n * built-in \"Add to chat\" affordances (file preview, diff, terminal selections)\n * write to. Inside a thread context writes land in that thread's draft;\n * anywhere else (nav panel, homepage section) they seed the new-thread\n * composer draft, which persists until the user sends or clears it.\n */\ninterface PluginComposerApi {\n scope: PluginComposerScope;\n /** Current plain text for this composer scope. */\n readonly text: string;\n /**\n * Replace the draft's plain text. Attachments are preserved. Inline mentions\n * outside the changed range are preserved and rebased; mentions overlapped\n * by the replacement are removed because their text representation changed.\n */\n setText(next: string): void;\n /**\n * Replace the draft's plain text from the latest committed value. Uses the\n * same structured-state reconciliation as `setText`.\n */\n updateText(updater: (current: string) => string): void;\n /** Clear plain text without clearing independently attached files. */\n clear(): void;\n /**\n * Append text to the draft as a `> ` blockquote block and focus the\n * composer. Blank text is a no-op. This is the \"reference this selection\n * in chat\" primitive.\n */\n addQuote(text: string): void;\n /**\n * Insert an @-mention pill that resolves through this plugin's mention\n * provider at send time — the durable way to reference an entity whose\n * content should be fetched fresh when the message is sent.\n */\n insertMention(mention: PluginComposerMention): void;\n /** Focus the composer caret at the end of the draft. */\n focus(): void;\n}\n/** Current app selection, derived from the route. */\ninterface BbContext {\n projectId: string | null;\n threadId: string | null;\n}\ninterface BbNavigate {\n toThread(threadId: string): void;\n toProject(projectId: string): void;\n /**\n * Navigate to one of this plugin's own nav panels by its `path`.\n * `subPath` targets a location inside the panel (the component's\n * `subPath` prop); `replace` swaps the current history entry instead of\n * pushing — use it for redirects so back does not bounce.\n */\n toPluginPanel(path: string, options?: {\n subPath?: string;\n replace?: boolean;\n }): void;\n /**\n * Navigate to the root compose surface (the new-thread screen). Pass\n * `initialPrompt` to seed the composer draft and `focusPrompt` to focus the\n * composer on arrival — the pairing behind \"Create via chat\" style entry\n * points that drop the user into chat with a prefilled prompt.\n */\n toCompose(options?: {\n initialPrompt?: string;\n focusPrompt?: boolean;\n }): void;\n}\n/**\n * Everything `@bb/plugin-sdk/app` resolves to at runtime. The BB app builds\n * the real implementation and `satisfies` this interface; `bb plugin build`\n * shims the specifier to that object on `globalThis.__bbPluginRuntime`.\n */\ninterface PluginSdkApp {\n definePluginApp(setup: PluginAppSetup): PluginAppDefinition;\n useRpc(): PluginRpcClient;\n useRealtime(channel: string, handler: (payload: unknown) => void): void;\n /**\n * Observe the same shared connection that delivers `useRealtime` signals.\n * Use a subsequent transition to `connected` to reconcile server state that\n * may have changed while ephemeral signals could not be delivered. The first\n * connection can transition from `connecting` and is not a reconnection.\n */\n useRealtimeConnectionState(): PluginRealtimeConnectionState;\n useSettings(): PluginSettingsState;\n useBbContext(): BbContext;\n useBbNavigate(): BbNavigate;\n useComposer(): PluginComposerApi;\n}\n\n/**\n * App-wide server-backed preferences.\n * Client-local settings stay in the frontend localStorage helpers instead.\n */\ndeclare const appSettingsSchema: z$1.ZodObject<{\n caffeinate: z$1.ZodBoolean;\n showKeyboardHints: z$1.ZodBoolean;\n showUnhandledProviderEvents: z$1.ZodBoolean;\n codexMemoryEnabled: z$1.ZodBoolean;\n claudeCodeMemoryEnabled: z$1.ZodBoolean;\n codexSubagentsDisabled: z$1.ZodBoolean;\n claudeCodeSubagentsDisabled: z$1.ZodBoolean;\n claudeCodeWorkflowsDisabled: z$1.ZodBoolean;\n}, z$1.core.$strict>;\ntype AppSettings = z$1.infer;\n\ndeclare const appKeybindingOverridesSchema: z$1.ZodArray;\n shortcut: z$1.ZodNullable>;\n}, z$1.core.$strict>>;\ntype AppKeybindingOverrides = z$1.infer;\n\ndeclare const appThemeSchema: z$1.ZodObject<{\n themeId: z$1.ZodString;\n customCss: z$1.ZodNullable;\n faviconColor: z$1.ZodEnum<{\n default: \"default\";\n red: \"red\";\n orange: \"orange\";\n yellow: \"yellow\";\n green: \"green\";\n teal: \"teal\";\n blue: \"blue\";\n purple: \"purple\";\n pink: \"pink\";\n }>;\n}, z$1.core.$strip>;\ntype AppTheme = z$1.infer;\n/**\n * The complete appearance selection a client sends when changing the palette\n * and/or favicon tint. The server validates `themeId` (built-in id or an\n * existing custom theme) and resolves the CSS from disk for custom themes.\n * Callers changing only one facet must carry the other facet forward explicitly.\n */\ndeclare const appThemeSelectionSchema: z$1.ZodObject<{\n themeId: z$1.ZodString;\n faviconColor: z$1.ZodEnum<{\n default: \"default\";\n red: \"red\";\n orange: \"orange\";\n yellow: \"yellow\";\n green: \"green\";\n teal: \"teal\";\n blue: \"blue\";\n purple: \"purple\";\n pink: \"pink\";\n }>;\n}, z$1.core.$strip>;\ntype AppThemeSelection = z$1.infer;\n\ndeclare const changedMessageSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"changed\">;\n entity: z$1.ZodLiteral<\"thread\">;\n id: z$1.ZodOptional;\n metadata: z$1.ZodOptional;\n eventTypes: z$1.ZodOptional>>>>;\n hasPendingInteraction: z$1.ZodOptional;\n projectId: z$1.ZodOptional;\n }, z$1.core.$strict>>;\n changes: z$1.ZodReadonly>>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"changed\">;\n entity: z$1.ZodLiteral<\"project\">;\n id: z$1.ZodOptional;\n changes: z$1.ZodReadonly>>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"changed\">;\n entity: z$1.ZodLiteral<\"environment\">;\n id: z$1.ZodOptional;\n changes: z$1.ZodReadonly>>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"changed\">;\n entity: z$1.ZodLiteral<\"host\">;\n id: z$1.ZodOptional;\n changes: z$1.ZodReadonly>>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"changed\">;\n entity: z$1.ZodLiteral<\"system\">;\n changes: z$1.ZodReadonly>>;\n}, z$1.core.$strict>], \"entity\">;\ntype ChangedMessage = z$1.infer;\n\ndeclare const environmentSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n name: z$1.ZodNullable;\n projectId: z$1.ZodString;\n hostId: z$1.ZodString;\n path: z$1.ZodNullable;\n managed: z$1.ZodBoolean;\n isGitRepo: z$1.ZodBoolean;\n isWorktree: z$1.ZodBoolean;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n branchName: z$1.ZodNullable;\n baseBranch: z$1.ZodNullable;\n defaultBranch: z$1.ZodNullable;\n mergeBaseBranch: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n ready: \"ready\";\n retiring: \"retiring\";\n destroying: \"destroying\";\n destroyed: \"destroyed\";\n }>;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype Environment = z$1.infer;\n\n/**\n * User-opt-in experiments (the Settings → Experiments toggles). Distinct from\n * `FeatureFlags`: flags are operator-set via env at server start, experiments\n * are user-toggled at runtime and persisted server-side so server-owned\n * policy (e.g. skill injection) can honor them.\n *\n * Every experiment defaults to off — opting in is the point.\n */\ndeclare const experimentsSchema: z$1.ZodObject<{\n claudeCodeMockCliTraffic: z$1.ZodBoolean;\n threadSplits: z$1.ZodBoolean;\n plugins: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype Experiments = z$1.infer;\n\ndeclare const hostSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n name: z$1.ZodString;\n type: z$1.ZodEnum<{\n persistent: \"persistent\";\n }>;\n status: z$1.ZodEnum<{\n connected: \"connected\";\n disconnected: \"disconnected\";\n }>;\n lastSeenAt: z$1.ZodNullable;\n lastRejectedProtocolVersion: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype Host = z$1.infer;\n\ninterface JsonObject {\n [key: string]: JsonValue;\n}\ntype JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;\n\ndeclare const pendingInteractionResolutionSchema: z$1.ZodUnion;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"allow_for_session\">;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"deny\">;\n}, z$1.core.$strip>], \"decision\">, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_answer\">;\n answers: z$1.ZodRecord;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin_submitted\">;\n}, z$1.core.$strip>]>;\ntype PendingInteractionResolution = z$1.infer;\ndeclare const providerPendingInteractionSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n resolved: \"resolved\";\n }>;\n statusReason: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n expiresAt: z$1.ZodOptional>;\n resolvedAt: z$1.ZodNullable;\n turnId: z$1.ZodString;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n origin: z$1.ZodOptional;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n }, z$1.core.$strip>>;\n payload: z$1.ZodUnion;\n subject: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n itemId: z$1.ZodString;\n command: z$1.ZodString;\n cwd: z$1.ZodNullable;\n actions: z$1.ZodArray;\n command: z$1.ZodString;\n name: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"listFiles\">;\n command: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"search\">;\n command: z$1.ZodString;\n query: z$1.ZodNullable;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"unknown\">;\n command: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n sessionGrant: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"file_change\">;\n itemId: z$1.ZodString;\n writeScope: z$1.ZodNullable;\n sessionGrant: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"permission_grant\">;\n itemId: z$1.ZodString;\n toolName: z$1.ZodNullable;\n permissions: z$1.ZodObject<{\n network: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>;\n }, z$1.core.$strip>], \"kind\">;\n reason: z$1.ZodNullable;\n availableDecisions: z$1.ZodArray>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_question\">;\n questions: z$1.ZodArray;\n multiSelect: z$1.ZodBoolean;\n options: z$1.ZodOptional;\n }, z$1.core.$strip>>>;\n allowFreeText: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>]>;\n resolution: z$1.ZodNullable;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"allow_for_session\">;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"deny\">;\n }, z$1.core.$strip>], \"decision\">, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_answer\">;\n answers: z$1.ZodRecord;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>]>>;\n}, z$1.core.$strip>;\ntype ProviderPendingInteraction = z$1.infer;\ndeclare const pluginPendingInteractionSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n resolved: \"resolved\";\n }>;\n statusReason: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n expiresAt: z$1.ZodOptional>;\n resolvedAt: z$1.ZodNullable;\n turnId: z$1.ZodNullable;\n origin: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n rendererId: z$1.ZodString;\n }, z$1.core.$strip>;\n payload: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n title: z$1.ZodString;\n data: z$1.ZodType>;\n }, z$1.core.$strip>;\n resolution: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype PluginPendingInteraction = z$1.infer;\ntype PendingInteraction = ProviderPendingInteraction | PluginPendingInteraction;\n\ndeclare const projectSourceSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n projectId: z$1.ZodString;\n isDefault: z$1.ZodBoolean;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n type: z$1.ZodLiteral<\"local_path\">;\n hostId: z$1.ZodString;\n path: z$1.ZodString;\n}, z$1.core.$strip>;\ntype ProjectSource = z$1.infer;\n\ndeclare const resolvedThreadExecutionOptionsSchema: z$1.ZodObject<{\n seq: z$1.ZodOptional;\n model: z$1.ZodString;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n source: z$1.ZodEnum<{\n \"client/thread/start\": \"client/thread/start\";\n \"client/turn/requested\": \"client/turn/requested\";\n \"client/turn/start\": \"client/turn/start\";\n }>;\n}, z$1.core.$strip>;\ntype ResolvedThreadExecutionOptions = z$1.infer;\ndeclare const projectExecutionDefaultsSchema: z$1.ZodObject<{\n providerId: z$1.ZodString;\n model: z$1.ZodString;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n}, z$1.core.$strip>;\ntype ProjectExecutionDefaults = z$1.infer;\n\n/** All thread events — provider-originated or system-originated. */\ndeclare const threadEventSchema: z$1.ZodPipe;\n threadId: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/identity\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"turn/started\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"turn/completed\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n error: z$1.ZodOptional>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"turn/input/accepted\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n clientRequestId: z$1.ZodString;\n scope: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"turn\">;\n turnId: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n}, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/name/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n threadName: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/compacted\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/goal/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n objective: z$1.ZodString;\n status: z$1.ZodEnum<{\n paused: \"paused\";\n active: \"active\";\n budgetLimited: \"budgetLimited\";\n complete: \"complete\";\n }>;\n tokenBudget: z$1.ZodNullable;\n tokensUsed: z$1.ZodNumber;\n timeUsedSeconds: z$1.ZodNumber;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/goal/cleared\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/started\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n item: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"userMessage\">;\n id: z$1.ZodString;\n content: z$1.ZodArray;\n text: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n clientRequestId: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"agentMessage\">;\n id: z$1.ZodString;\n text: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commandExecution\">;\n id: z$1.ZodString;\n command: z$1.ZodString;\n cwd: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n approvalStatus: z$1.ZodNullable>;\n aggregatedOutput: z$1.ZodOptional;\n exitCode: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n truncation: z$1.ZodOptional>;\n result: z$1.ZodOptional>;\n resultText: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"fileChange\">;\n id: z$1.ZodString;\n changes: z$1.ZodArray;\n movePath: z$1.ZodOptional;\n diff: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n approvalStatus: z$1.ZodNullable>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"webSearch\">;\n id: z$1.ZodString;\n queries: z$1.ZodArray;\n resultText: z$1.ZodNullable;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"webFetch\">;\n id: z$1.ZodString;\n url: z$1.ZodString;\n prompt: z$1.ZodNullable;\n pattern: z$1.ZodNullable;\n resultText: z$1.ZodNullable;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"imageView\">;\n id: z$1.ZodString;\n path: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"toolCall\">;\n id: z$1.ZodString;\n server: z$1.ZodOptional;\n tool: z$1.ZodString;\n arguments: z$1.ZodOptional>;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n result: z$1.ZodOptional;\n error: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n truncation: z$1.ZodOptional>;\n result: z$1.ZodOptional>;\n resultText: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"reasoning\">;\n id: z$1.ZodString;\n summary: z$1.ZodArray;\n content: z$1.ZodArray;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"plan\">;\n id: z$1.ZodString;\n text: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"contextCompaction\">;\n id: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"backgroundTask\">;\n id: z$1.ZodString;\n taskType: z$1.ZodString;\n description: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n running: \"running\";\n paused: \"paused\";\n completed: \"completed\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n skipTranscript: z$1.ZodBoolean;\n workflowName: z$1.ZodOptional;\n workflow: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodOptional>;\n summary: z$1.ZodOptional;\n error: z$1.ZodOptional;\n outputFile: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/completed\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n item: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"userMessage\">;\n id: z$1.ZodString;\n content: z$1.ZodArray;\n text: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n clientRequestId: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"agentMessage\">;\n id: z$1.ZodString;\n text: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commandExecution\">;\n id: z$1.ZodString;\n command: z$1.ZodString;\n cwd: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n approvalStatus: z$1.ZodNullable>;\n aggregatedOutput: z$1.ZodOptional;\n exitCode: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n truncation: z$1.ZodOptional>;\n result: z$1.ZodOptional>;\n resultText: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"fileChange\">;\n id: z$1.ZodString;\n changes: z$1.ZodArray;\n movePath: z$1.ZodOptional;\n diff: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n approvalStatus: z$1.ZodNullable>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"webSearch\">;\n id: z$1.ZodString;\n queries: z$1.ZodArray;\n resultText: z$1.ZodNullable;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"webFetch\">;\n id: z$1.ZodString;\n url: z$1.ZodString;\n prompt: z$1.ZodNullable;\n pattern: z$1.ZodNullable;\n resultText: z$1.ZodNullable;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"imageView\">;\n id: z$1.ZodString;\n path: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"toolCall\">;\n id: z$1.ZodString;\n server: z$1.ZodOptional;\n tool: z$1.ZodString;\n arguments: z$1.ZodOptional>;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n result: z$1.ZodOptional;\n error: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n truncation: z$1.ZodOptional>;\n result: z$1.ZodOptional>;\n resultText: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"reasoning\">;\n id: z$1.ZodString;\n summary: z$1.ZodArray;\n content: z$1.ZodArray;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"plan\">;\n id: z$1.ZodString;\n text: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"contextCompaction\">;\n id: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"backgroundTask\">;\n id: z$1.ZodString;\n taskType: z$1.ZodString;\n description: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n running: \"running\";\n paused: \"paused\";\n completed: \"completed\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n skipTranscript: z$1.ZodBoolean;\n workflowName: z$1.ZodOptional;\n workflow: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodOptional>;\n summary: z$1.ZodOptional;\n error: z$1.ZodOptional;\n outputFile: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/agentMessage/delta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/commandExecution/outputDelta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n reset: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/fileChange/outputDelta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/reasoning/summaryTextDelta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/reasoning/textDelta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/plan/delta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/mcpToolCall/progress\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n message: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/toolCall/progress\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n message: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/backgroundTask/progress\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n item: z$1.ZodObject<{\n type: z$1.ZodLiteral<\"backgroundTask\">;\n id: z$1.ZodString;\n taskType: z$1.ZodString;\n description: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n running: \"running\";\n paused: \"paused\";\n completed: \"completed\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n skipTranscript: z$1.ZodBoolean;\n workflowName: z$1.ZodOptional;\n workflow: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodOptional>;\n summary: z$1.ZodOptional;\n error: z$1.ZodOptional;\n outputFile: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/backgroundTask/completed\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n item: z$1.ZodObject<{\n type: z$1.ZodLiteral<\"backgroundTask\">;\n id: z$1.ZodString;\n taskType: z$1.ZodString;\n description: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n running: \"running\";\n paused: \"paused\";\n completed: \"completed\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n skipTranscript: z$1.ZodBoolean;\n workflowName: z$1.ZodOptional;\n workflow: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodOptional>;\n summary: z$1.ZodOptional;\n error: z$1.ZodOptional;\n outputFile: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/tokenUsage/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n tokenUsage: z$1.ZodObject<{\n total: z$1.ZodObject<{\n totalTokens: z$1.ZodNumber;\n inputTokens: z$1.ZodNumber;\n cachedInputTokens: z$1.ZodNumber;\n outputTokens: z$1.ZodNumber;\n reasoningOutputTokens: z$1.ZodNumber;\n }, z$1.core.$strip>;\n last: z$1.ZodObject<{\n totalTokens: z$1.ZodNumber;\n inputTokens: z$1.ZodNumber;\n cachedInputTokens: z$1.ZodNumber;\n outputTokens: z$1.ZodNumber;\n reasoningOutputTokens: z$1.ZodNumber;\n }, z$1.core.$strip>;\n modelContextWindow: z$1.ZodNullable;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/contextWindowUsage/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n contextWindowUsage: z$1.ZodObject<{\n usedTokens: z$1.ZodNullable;\n modelContextWindow: z$1.ZodNullable;\n estimated: z$1.ZodBoolean;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"turn/plan/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n plan: z$1.ZodArray>;\n }, z$1.core.$strip>>;\n explanation: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"turn/diff/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n diff: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider/error\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n message: z$1.ZodString;\n detail: z$1.ZodOptional;\n willRetry: z$1.ZodOptional;\n errorInfo: z$1.ZodOptional;\n providerCode: z$1.ZodNullable;\n httpStatusCode: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider/warning\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n category: z$1.ZodEnum<{\n deprecation: \"deprecation\";\n config: \"config\";\n general: \"general\";\n }>;\n summary: z$1.ZodOptional;\n details: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider/modelFallback\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n originalModel: z$1.ZodString;\n fallbackModel: z$1.ZodString;\n reason: z$1.ZodEnum<{\n refusal: \"refusal\";\n provider: \"provider\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider/unhandled\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerId: z$1.ZodString;\n rawType: z$1.ZodString;\n rawEvent: z$1.ZodObject<{\n jsonrpc: z$1.ZodLiteral<\"2.0\">;\n id: z$1.ZodOptional>;\n method: z$1.ZodString;\n params: z$1.ZodOptional>>;\n }, z$1.core.$strip>;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>], \"type\">, z$1.ZodObject<{\n scope: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"turn\">;\n turnId: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n}, z$1.core.$strip>>, z$1.ZodIntersection;\n threadId: z$1.ZodString;\n direction: z$1.ZodLiteral<\"outbound\">;\n source: z$1.ZodEnum<{\n spawn: \"spawn\";\n tell: \"tell\";\n }>;\n initiator: z$1.ZodEnum<{\n system: \"system\";\n user: \"user\";\n agent: \"agent\";\n }>;\n request: z$1.ZodObject<{\n method: z$1.ZodEnum<{\n \"thread/start\": \"thread/start\";\n \"turn/start\": \"turn/start\";\n }>;\n params: z$1.ZodRecord;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"client/turn/requested\">;\n threadId: z$1.ZodString;\n direction: z$1.ZodLiteral<\"outbound\">;\n requestId: z$1.ZodString;\n source: z$1.ZodEnum<{\n spawn: \"spawn\";\n tell: \"tell\";\n }>;\n initiator: z$1.ZodEnum<{\n system: \"system\";\n user: \"user\";\n agent: \"agent\";\n }>;\n senderThreadId: z$1.ZodNullable;\n systemMessageKind: z$1.ZodOptional>;\n systemMessageSubject: z$1.ZodOptional;\n threadId: z$1.ZodString;\n threadName: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread-batch\">;\n count: z$1.ZodNumber;\n }, z$1.core.$strip>], \"kind\">>>;\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n inputGroups: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>>>;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread-start\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"new-turn\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"auto\">;\n expectedTurnId: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"steer\">;\n expectedTurnId: z$1.ZodNullable;\n }, z$1.core.$strip>], \"kind\">;\n request: z$1.ZodObject<{\n method: z$1.ZodEnum<{\n \"thread/start\": \"thread/start\";\n \"turn/start\": \"turn/start\";\n }>;\n params: z$1.ZodRecord;\n }, z$1.core.$strip>;\n execution: z$1.ZodObject<{\n seq: z$1.ZodOptional;\n model: z$1.ZodString;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n source: z$1.ZodEnum<{\n \"client/thread/start\": \"client/thread/start\";\n \"client/turn/requested\": \"client/turn/requested\";\n \"client/turn/start\": \"client/turn/start\";\n }>;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"client/turn/start\">;\n threadId: z$1.ZodString;\n direction: z$1.ZodLiteral<\"outbound\">;\n source: z$1.ZodEnum<{\n spawn: \"spawn\";\n tell: \"tell\";\n }>;\n initiator: z$1.ZodEnum<{\n system: \"system\";\n user: \"user\";\n agent: \"agent\";\n }>;\n request: z$1.ZodObject<{\n method: z$1.ZodEnum<{\n \"thread/start\": \"thread/start\";\n \"turn/start\": \"turn/start\";\n }>;\n params: z$1.ZodRecord;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/error\">;\n threadId: z$1.ZodString;\n code: z$1.ZodOptional;\n message: z$1.ZodString;\n detail: z$1.ZodOptional;\n reconnectAttempt: z$1.ZodOptional;\n reconnectTotal: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/manager/user_message\">;\n threadId: z$1.ZodString;\n text: z$1.ZodString;\n toolCallId: z$1.ZodOptional;\n turnId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/thread/interrupted\">;\n threadId: z$1.ZodString;\n reason: z$1.ZodEnum<{\n \"manual-stop\": \"manual-stop\";\n \"host-daemon-restarted\": \"host-daemon-restarted\";\n \"provider-turn-idle\": \"provider-turn-idle\";\n }>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/operation\">;\n threadId: z$1.ZodString;\n operation: z$1.ZodString;\n status: z$1.ZodString;\n message: z$1.ZodString;\n operationId: z$1.ZodString;\n metadata: z$1.ZodOptional>>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/permissionGrant/lifecycle\">;\n threadId: z$1.ZodString;\n interactionId: z$1.ZodString;\n providerId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n resolved: \"resolved\";\n }>;\n resolution: z$1.ZodDefault;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"allow_for_session\">;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"deny\">;\n }, z$1.core.$strip>], \"decision\">>>;\n statusReason: z$1.ZodDefault>;\n subject: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"permission_grant\">;\n itemId: z$1.ZodString;\n toolName: z$1.ZodNullable;\n permissions: z$1.ZodObject<{\n network: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/userQuestion/lifecycle\">;\n threadId: z$1.ZodString;\n interactionId: z$1.ZodString;\n providerId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n resolved: \"resolved\";\n }>;\n resolution: z$1.ZodDefault;\n answers: z$1.ZodRecord;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>>;\n statusReason: z$1.ZodDefault>;\n payload: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_question\">;\n questions: z$1.ZodArray;\n multiSelect: z$1.ZodBoolean;\n options: z$1.ZodOptional;\n }, z$1.core.$strip>>>;\n allowFreeText: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/thread-provisioning\">;\n threadId: z$1.ZodString;\n provisioningId: z$1.ZodString;\n status: z$1.ZodEnum<{\n completed: \"completed\";\n failed: \"failed\";\n active: \"active\";\n cancelled: \"cancelled\";\n }>;\n environmentId: z$1.ZodString;\n entries: z$1.ZodArray;\n key: z$1.ZodString;\n text: z$1.ZodString;\n startedAt: z$1.ZodOptional;\n status: z$1.ZodOptional>;\n metadata: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/provider-turn-watchdog\">;\n threadId: z$1.ZodString;\n reason: z$1.ZodLiteral<\"provider-turn-idle\">;\n thresholdMs: z$1.ZodNumber;\n elapsedMs: z$1.ZodNumber;\n activeTurnId: z$1.ZodString;\n activeTurnStartedAt: z$1.ZodNumber;\n lastActivityEventSequence: z$1.ZodNumber;\n lastActivityEventType: z$1.ZodString;\n lastActivityEventAt: z$1.ZodNumber;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodNullable;\n firedAt: z$1.ZodNumber;\n}, z$1.core.$strip>]>, z$1.ZodObject<{\n scope: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"turn\">;\n turnId: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n}, z$1.core.$strip>>]>>;\ntype ThreadEvent = z$1.infer;\ntype ThreadEventType = ThreadEvent[\"type\"];\n\ndeclare const providerInfoSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n displayName: z$1.ZodString;\n logoUrl: z$1.ZodNullable;\n capabilities: z$1.ZodObject<{\n supportsArchive: z$1.ZodBoolean;\n supportsRename: z$1.ZodBoolean;\n supportsServiceTier: z$1.ZodBoolean;\n supportsUserQuestion: z$1.ZodBoolean;\n supportsFork: z$1.ZodBoolean;\n supportedPermissionModes: z$1.ZodArray>;\n }, z$1.core.$strip>;\n composerActions: z$1.ZodArray;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plan\">;\n command: z$1.ZodObject<{\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n trailingText: z$1.ZodString;\n }, z$1.core.$strip>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"goal\">;\n command: z$1.ZodObject<{\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n trailingText: z$1.ZodString;\n }, z$1.core.$strip>;\n }, z$1.core.$strip>], \"kind\">>;\n available: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype ProviderInfo = z$1.infer;\n\ndeclare const threadEventScopeSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread\">;\n}, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"turn\">;\n turnId: z$1.ZodString;\n}, z$1.core.$strip>], \"kind\">;\ntype ThreadEventScope = z$1.infer;\n\ntype ThreadEventByType = {\n [TType in ThreadEventType]: Extract;\n};\ntype ThreadEventForType = ThreadEventByType[TType];\ntype StoredThreadEventDataFromEvent = Omit;\ninterface ThreadEventRowBase {\n id: string;\n scope: ThreadEventScope;\n threadId: string;\n seq: number;\n createdAt: number;\n}\ntype ThreadEventRowFromEvent = ThreadEventRowBase & {\n type: TEvent[\"type\"];\n data: StoredThreadEventDataFromEvent;\n};\ntype ThreadEventRowOfType = ThreadEventRowFromEvent>;\ntype ThreadEventRow = {\n [TType in ThreadEventType]: ThreadEventRowOfType;\n}[ThreadEventType];\n\ndeclare const threadStatusSchema: z$1.ZodEnum<{\n error: \"error\";\n active: \"active\";\n starting: \"starting\";\n idle: \"idle\";\n stopping: \"stopping\";\n}>;\ntype ThreadStatus = z$1.infer;\n\ndeclare const threadTimelinePendingTodosSchema: z$1.ZodObject<{\n sourceSeq: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n items: z$1.ZodArray;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype ThreadTimelinePendingTodos = z$1.infer;\n\ndeclare const threadQueuedMessageSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n content: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodString;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n groupWithNext: z$1.ZodBoolean;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype ThreadQueuedMessage = z$1.infer;\n\ndeclare const workspaceFileListResponseSchema: z$1.ZodObject<{\n files: z$1.ZodArray>;\n truncated: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype WorkspaceFileListResponse = z$1.infer;\ndeclare const workspacePathListResponseSchema: z$1.ZodObject<{\n paths: z$1.ZodArray;\n path: z$1.ZodString;\n name: z$1.ZodString;\n score: z$1.ZodNumber;\n positions: z$1.ZodArray;\n }, z$1.core.$strip>>;\n truncated: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype WorkspacePathListResponse = z$1.infer;\n\ndeclare const createProjectSourceRequestSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n hostId: z$1.ZodString;\n type: z$1.ZodLiteral<\"local_path\">;\n path: z$1.ZodPipe>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n hostId: z$1.ZodString;\n type: z$1.ZodLiteral<\"clone\">;\n targetPath: z$1.ZodOptional>>;\n remoteUrl: z$1.ZodOptional;\n}, z$1.core.$strict>], \"type\">;\ntype CreateProjectSourceRequest = z$1.infer;\ndeclare const createProjectRequestSchema: z$1.ZodObject<{\n name: z$1.ZodString;\n source: z$1.ZodObject<{\n hostId: z$1.ZodString;\n type: z$1.ZodLiteral<\"local_path\">;\n path: z$1.ZodPipe>;\n }, z$1.core.$strict>;\n}, z$1.core.$strip>;\ntype CreateProjectRequest = z$1.infer;\ndeclare const threadFolderSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n name: z$1.ZodString;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n}, z$1.core.$strict>;\ntype ThreadFolderResponse = z$1.infer;\ndeclare const createThreadFolderRequestSchema: z$1.ZodObject<{\n name: z$1.ZodString;\n}, z$1.core.$strict>;\ntype CreateThreadFolderRequest = z$1.infer;\ndeclare const updateThreadFolderRequestSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n name: z$1.ZodString;\n}, z$1.core.$strict>;\ntype UpdateThreadFolderRequest = z$1.infer;\ndeclare const deleteThreadFolderRequestSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n}, z$1.core.$strict>;\ntype DeleteThreadFolderRequest = z$1.infer;\ndeclare const threadFolderMutationResponseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n name: z$1.ZodString;\n updatedThreadCount: z$1.ZodNumber;\n}, z$1.core.$strict>;\ntype ThreadFolderMutationResponse = z$1.infer;\ndeclare const reorderProjectRequestSchema: z$1.ZodObject<{\n previousProjectId: z$1.ZodNullable;\n nextProjectId: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype ReorderProjectRequest = z$1.infer;\ndeclare const projectListQuerySchema: z$1.ZodObject<{\n include: z$1.ZodOptional;\n includePersonal: z$1.ZodOptional>;\n}, z$1.core.$strip>;\ntype ProjectListQuery = z$1.infer;\ndeclare const projectFilesQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional>;\n limit: z$1.ZodOptional>;\n hostId: z$1.ZodOptional;\n environmentId: z$1.ZodOptional, z$1.ZodOptional>>;\n}, z$1.core.$strip>;\ntype ProjectFilesQuery = z$1.infer;\ndeclare const projectPathsQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional>;\n limit: z$1.ZodOptional>;\n includeFiles: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n includeDirectories: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n hostId: z$1.ZodOptional;\n environmentId: z$1.ZodOptional, z$1.ZodOptional>>;\n}, z$1.core.$strip>;\ntype ProjectPathsQuery = z$1.infer;\ndeclare const projectFileContentQuerySchema: z$1.ZodObject<{\n path: z$1.ZodString;\n hostId: z$1.ZodOptional;\n environmentId: z$1.ZodOptional, z$1.ZodOptional>>;\n}, z$1.core.$strip>;\ntype ProjectFileContentQuery = z$1.infer;\ndeclare const projectBranchesQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional;\n limit: z$1.ZodOptional;\n hostId: z$1.ZodString;\n selectedBranch: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ProjectBranchesQuery = z$1.infer;\ndeclare const projectBranchesResponseSchema: z$1.ZodObject<{\n branches: z$1.ZodArray;\n branchesTruncated: z$1.ZodBoolean;\n checkout: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"branch\">;\n branchName: z$1.ZodString;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"detached\">;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unborn\">;\n branchName: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n defaultBranch: z$1.ZodNullable;\n defaultBranchRelation: z$1.ZodNullable>;\n hasUncommittedChanges: z$1.ZodBoolean;\n operation: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"none\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"merge\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"rebase\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"cherry-pick\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"revert\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>], \"kind\">;\n originDefaultBranch: z$1.ZodNullable;\n remoteBranches: z$1.ZodArray;\n remoteBranchesTruncated: z$1.ZodBoolean;\n selectedBranch: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n defaultWorktreeBaseBranch: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype ProjectBranchesResponse = z$1.infer;\ndeclare const promptHistoryQuerySchema: z$1.ZodObject<{\n limit: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype PromptHistoryQuery = z$1.infer;\ndeclare const promptHistoryResponseSchema: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n}, z$1.core.$strip>>;\ntype PromptHistoryResponse = z$1.infer;\ndeclare const updateProjectRequestSchema: z$1.ZodObject<{\n name: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype UpdateProjectRequest = z$1.infer;\ndeclare const updateProjectSourceRequestSchema: z$1.ZodObject<{\n type: z$1.ZodLiteral<\"local_path\">;\n path: z$1.ZodOptional>>;\n isDefault: z$1.ZodOptional>;\n}, z$1.core.$strict>;\ntype UpdateProjectSourceRequest = z$1.infer;\ndeclare const commandListResponseSchema: z$1.ZodObject<{\n commands: z$1.ZodArray;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n description: z$1.ZodNullable;\n argumentHint: z$1.ZodNullable;\n pluginId: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype CommandListResponse = z$1.infer;\n/** Query for the complete command catalog available to a project and provider. */\ndeclare const projectCommandsQuerySchema: z$1.ZodObject<{\n provider: z$1.ZodString;\n hostId: z$1.ZodOptional;\n environmentId: z$1.ZodOptional, z$1.ZodOptional>>;\n}, z$1.core.$strict>;\ntype ProjectCommandsQuery = z$1.infer;\ndeclare const projectResponseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodEnum<{\n personal: \"personal\";\n standard: \"standard\";\n }>;\n name: z$1.ZodString;\n gitRemoteUrl: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n sources: z$1.ZodArray;\n hostId: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype ProjectResponse = z$1.infer;\ndeclare const projectWithThreadsResponseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodEnum<{\n personal: \"personal\";\n standard: \"standard\";\n }>;\n name: z$1.ZodString;\n gitRemoteUrl: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n sources: z$1.ZodArray;\n hostId: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>>;\n threads: z$1.ZodArray;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n activity: z$1.ZodObject<{\n activeWorkflowCount: z$1.ZodNumber;\n activeBackgroundAgentCount: z$1.ZodNumber;\n activeBackgroundCommandCount: z$1.ZodNumber;\n activePlanModeCount: z$1.ZodNumber;\n activeGoalCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n pinSortKey: z$1.ZodNullable;\n hasPendingInteraction: z$1.ZodBoolean;\n environmentHostId: z$1.ZodNullable;\n environmentName: z$1.ZodNullable;\n environmentBranchName: z$1.ZodNullable;\n environmentWorkspaceDisplayKind: z$1.ZodEnum<{\n \"managed-worktree\": \"managed-worktree\";\n \"unmanaged-worktree\": \"unmanaged-worktree\";\n other: \"other\";\n }>;\n }, z$1.core.$strip>>;\n defaultExecutionOptions: z$1.ZodNullable;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype ProjectWithThreadsResponse = z$1.infer;\ndeclare const uploadedPromptAttachmentSchema: z$1.ZodObject<{\n type: z$1.ZodEnum<{\n localImage: \"localImage\";\n localFile: \"localFile\";\n }>;\n path: z$1.ZodString;\n name: z$1.ZodString;\n mimeType: z$1.ZodOptional;\n sizeBytes: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype UploadedPromptAttachment = z$1.infer;\n\ndeclare const updateEnvironmentRequestSchema: z$1.ZodObject<{\n mergeBaseBranch: z$1.ZodOptional>;\n name: z$1.ZodOptional>;\n}, z$1.core.$strip>;\ntype UpdateEnvironmentRequest = z$1.infer;\n/**\n * Query for searching paths in an environment's workspace. Unlike the\n * project-scoped variant this needs no `environmentId` — the environment is\n * the route param — and is project-agnostic, so it works for projectless\n * (personal) environments too.\n */\ndeclare const environmentPathsQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional;\n limit: z$1.ZodOptional;\n includeFiles: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n includeDirectories: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n}, z$1.core.$strip>;\ntype EnvironmentPathsQuery = z$1.infer;\ndeclare const environmentDiffBranchesQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional;\n limit: z$1.ZodOptional;\n selectedBranch: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype EnvironmentDiffBranchesQuery = z$1.infer;\ndeclare const environmentDiffBranchesResponseSchema: z$1.ZodObject<{\n branches: z$1.ZodArray;\n branchesTruncated: z$1.ZodBoolean;\n remoteBranches: z$1.ZodArray;\n remoteBranchesTruncated: z$1.ZodBoolean;\n selectedBranch: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype EnvironmentDiffBranchesResponse = z$1.infer;\ndeclare const environmentStatusQuerySchema: z$1.ZodObject<{\n mergeBaseBranch: z$1.ZodOptional>;\n}, z$1.core.$strip>;\ntype EnvironmentStatusQuery = z$1.infer;\ndeclare const environmentDiffQuerySchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n target: z$1.ZodLiteral<\"uncommitted\">;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseBranch: z$1.ZodPipe;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"all\">;\n mergeBaseBranch: z$1.ZodPipe;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n}, z$1.core.$strip>], \"target\">;\ntype EnvironmentDiffQuery = z$1.infer;\n/**\n * Query for fetching a single file's contents at one side of a diff target.\n * Used by the diff card to reparse the card's patch with full old/new contents\n * so `@pierre/diffs` can render expand-context buttons between hunks.\n *\n * For `branch_committed` / `all`, callers pass the resolved merge-base SHA\n * (`mergeBaseRef`, surfaced by `workspace.diff`) rather than the branch name\n * — the diff itself was computed against that SHA, so reading the old side\n * from the same SHA keeps the file content aligned with the hunk line\n * numbers. Reading from the branch tip is wrong whenever the branch has\n * moved past the merge-base since the file existed there.\n */\ndeclare const environmentDiffFileQuerySchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n target: z$1.ZodLiteral<\"uncommitted\">;\n path: z$1.ZodString;\n side: z$1.ZodEnum<{\n old: \"old\";\n new: \"new\";\n }>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseRef: z$1.ZodString;\n path: z$1.ZodString;\n side: z$1.ZodEnum<{\n old: \"old\";\n new: \"new\";\n }>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"all\">;\n mergeBaseRef: z$1.ZodString;\n path: z$1.ZodString;\n side: z$1.ZodEnum<{\n old: \"old\";\n new: \"new\";\n }>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n path: z$1.ZodString;\n side: z$1.ZodEnum<{\n old: \"old\";\n new: \"new\";\n }>;\n}, z$1.core.$strip>], \"target\">;\ntype EnvironmentDiffFileQuery = z$1.infer;\ndeclare const environmentDiffFileResponseSchema: z$1.ZodObject<{\n path: z$1.ZodString;\n content: z$1.ZodString;\n contentEncoding: z$1.ZodEnum<{\n base64: \"base64\";\n utf8: \"utf8\";\n }>;\n mimeType: z$1.ZodOptional;\n sizeBytes: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype EnvironmentDiffFileResponse = z$1.infer;\ndeclare const environmentArchiveThreadsResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n archivedThreadIds: z$1.ZodArray;\n}, z$1.core.$strip>;\ntype EnvironmentArchiveThreadsResponse = z$1.infer;\ndeclare const pullRequestMergeMethodSchema: z$1.ZodEnum<{\n merge: \"merge\";\n rebase: \"rebase\";\n squash: \"squash\";\n}>;\ntype PullRequestMergeMethod = z$1.infer;\ndeclare const commitActionResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n action: z$1.ZodLiteral<\"commit\">;\n message: z$1.ZodString;\n commitSha: z$1.ZodString;\n commitSubject: z$1.ZodString;\n}, z$1.core.$strip>;\ntype CommitActionResponse = z$1.infer;\ndeclare const squashMergeActionResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n action: z$1.ZodLiteral<\"squash_merge\">;\n merged: z$1.ZodBoolean;\n message: z$1.ZodString;\n commitSha: z$1.ZodString;\n commitSubject: z$1.ZodString;\n}, z$1.core.$strip>;\ntype SquashMergeActionResponse = z$1.infer;\ndeclare const pullRequestReadyActionResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n action: z$1.ZodLiteral<\"pull_request_ready\">;\n message: z$1.ZodString;\n}, z$1.core.$strip>;\ntype PullRequestReadyActionResponse = z$1.infer;\ndeclare const pullRequestMergeActionResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n action: z$1.ZodLiteral<\"pull_request_merge\">;\n method: z$1.ZodEnum<{\n merge: \"merge\";\n rebase: \"rebase\";\n squash: \"squash\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strip>;\ntype PullRequestMergeActionResponse = z$1.infer;\ndeclare const pullRequestDraftActionResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n action: z$1.ZodLiteral<\"pull_request_draft\">;\n message: z$1.ZodString;\n}, z$1.core.$strip>;\ntype PullRequestDraftActionResponse = z$1.infer;\ndeclare const environmentStatusResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n workspace: z$1.ZodObject<{\n workingTree: z$1.ZodObject<{\n insertions: z$1.ZodNumber;\n deletions: z$1.ZodNumber;\n files: z$1.ZodArray;\n insertions: z$1.ZodNullable;\n deletions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n hasUncommittedChanges: z$1.ZodBoolean;\n state: z$1.ZodEnum<{\n clean: \"clean\";\n untracked: \"untracked\";\n dirty_uncommitted: \"dirty_uncommitted\";\n committed_unmerged: \"committed_unmerged\";\n dirty_and_committed_unmerged: \"dirty_and_committed_unmerged\";\n }>;\n }, z$1.core.$strip>;\n checkout: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"branch\">;\n branchName: z$1.ZodString;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"detached\">;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unborn\">;\n branchName: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n branch: z$1.ZodObject<{\n currentBranch: z$1.ZodNullable;\n defaultBranch: z$1.ZodString;\n }, z$1.core.$strip>;\n mergeBase: z$1.ZodNullable;\n insertions: z$1.ZodNullable;\n deletions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n mergeBaseBranch: z$1.ZodString;\n baseRef: z$1.ZodNullable;\n aheadCount: z$1.ZodNumber;\n behindCount: z$1.ZodNumber;\n hasCommittedUnmergedChanges: z$1.ZodBoolean;\n commits: z$1.ZodArray>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"not_applicable\">;\n reason: z$1.ZodEnum<{\n non_git_environment: \"non_git_environment\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n unknown: \"unknown\";\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>], \"outcome\">;\n/**\n * Structured pull-request lookup outcome. \"absent\" is a real answer — the\n * host checked and the branch has no PR (non-git environments resolve to\n * \"absent\" without a daemon call). \"unavailable\" means the lookup itself\n * failed (gh missing, not authenticated, timeout, unreachable workspace), so\n * callers must not render it as \"no PR exists\".\n */\ndeclare const environmentPullRequestResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n pullRequest: z$1.ZodObject<{\n number: z$1.ZodNumber;\n title: z$1.ZodString;\n state: z$1.ZodEnum<{\n merged: \"merged\";\n draft: \"draft\";\n open: \"open\";\n closed: \"closed\";\n }>;\n url: z$1.ZodString;\n baseRefName: z$1.ZodString;\n headRefName: z$1.ZodString;\n updatedAt: z$1.ZodString;\n checks: z$1.ZodObject<{\n state: z$1.ZodEnum<{\n unknown: \"unknown\";\n pending: \"pending\";\n passing: \"passing\";\n failing: \"failing\";\n no_checks: \"no_checks\";\n }>;\n totalCount: z$1.ZodNumber;\n passedCount: z$1.ZodNumber;\n failedCount: z$1.ZodNumber;\n pendingCount: z$1.ZodNumber;\n }, z$1.core.$strict>;\n review: z$1.ZodObject<{\n state: z$1.ZodEnum<{\n none: \"none\";\n approved: \"approved\";\n changes_requested: \"changes_requested\";\n review_required: \"review_required\";\n review_requested: \"review_requested\";\n }>;\n reviewRequestCount: z$1.ZodNumber;\n }, z$1.core.$strict>;\n mergeability: z$1.ZodObject<{\n state: z$1.ZodEnum<{\n unknown: \"unknown\";\n draft: \"draft\";\n mergeable: \"mergeable\";\n conflicts: \"conflicts\";\n blocked: \"blocked\";\n }>;\n mergeStateStatus: z$1.ZodNullable>;\n mergeable: z$1.ZodNullable>;\n }, z$1.core.$strict>;\n attention: z$1.ZodEnum<{\n none: \"none\";\n merged: \"merged\";\n draft: \"draft\";\n closed: \"closed\";\n changes_requested: \"changes_requested\";\n review_requested: \"review_requested\";\n conflicts: \"conflicts\";\n blocked: \"blocked\";\n checks_failed: \"checks_failed\";\n checks_pending: \"checks_pending\";\n ready_to_merge: \"ready_to_merge\";\n }>;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"absent\">;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n message: z$1.ZodString;\n}, z$1.core.$strict>], \"outcome\">;\ntype EnvironmentPullRequestResponse = z$1.infer;\ndeclare const environmentDiffResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n diff: z$1.ZodObject<{\n diff: z$1.ZodString;\n truncated: z$1.ZodBoolean;\n shortstat: z$1.ZodString;\n files: z$1.ZodString;\n mergeBaseRef: z$1.ZodNullable;\n }, z$1.core.$strip>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"not_applicable\">;\n reason: z$1.ZodEnum<{\n non_git_environment: \"non_git_environment\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n unknown: \"unknown\";\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>], \"outcome\">;\ntype EnvironmentDiffResponse = z$1.infer;\ndeclare const environmentDiffFilesResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n files: z$1.ZodArray;\n changeKind: z$1.ZodEnum<{\n deleted: \"deleted\";\n added: \"added\";\n modified: \"modified\";\n renamed: \"renamed\";\n copied: \"copied\";\n type_changed: \"type_changed\";\n }>;\n additions: z$1.ZodNumber;\n deletions: z$1.ZodNumber;\n binary: z$1.ZodBoolean;\n origin: z$1.ZodEnum<{\n untracked: \"untracked\";\n tracked: \"tracked\";\n }>;\n loadMode: z$1.ZodEnum<{\n auto: \"auto\";\n on_demand: \"on_demand\";\n too_large: \"too_large\";\n }>;\n }, z$1.core.$strip>>;\n shortstat: z$1.ZodString;\n mergeBaseRef: z$1.ZodNullable;\n initialPatches: z$1.ZodArray>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"not_applicable\">;\n reason: z$1.ZodEnum<{\n non_git_environment: \"non_git_environment\";\n too_many_files: \"too_many_files\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n unknown: \"unknown\";\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>], \"outcome\">;\ntype EnvironmentDiffFilesResponse = z$1.infer;\ndeclare const environmentDiffPatchResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n patches: z$1.ZodArray>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"not_applicable\">;\n reason: z$1.ZodEnum<{\n non_git_environment: \"non_git_environment\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n unknown: \"unknown\";\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>], \"outcome\">;\ntype EnvironmentDiffPatchResponse = z$1.infer;\n/**\n * Body for `POST /diff/patch`: the diff target plus the list of new paths whose\n * patches the client wants. A POST (not GET) because the repeated `paths` array\n * cannot survive flat query parsing. The client supplies only new paths; the\n * server re-derives each file's rename/copy pairing (`previousPath`) from its\n * own TOC.\n */\ndeclare const environmentDiffPatchRequestSchema: z$1.ZodObject<{\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"uncommitted\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"all\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">;\n paths: z$1.ZodArray;\n}, z$1.core.$strict>;\ntype EnvironmentDiffPatchRequest = z$1.infer;\ntype EnvironmentStatusResponse = z$1.infer;\n\ndeclare const providerUsageResponseSchema: z$1.ZodObject<{\n codex: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n claudeCode: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n cursor: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n}, z$1.core.$strip>;\ntype ProviderUsageResponse = z$1.infer;\ntype HostDaemonCommandTransport = \"settled\" | \"onlineRpc\";\ntype HostDaemonCommandEnvironmentLane = \"read\" | \"write\";\ntype HostDaemonFlushEventsBeforeResult = boolean | \"when-initiated\";\ninterface HostDaemonCommandDescriptor {\n type: Type;\n schema: Schema;\n resultSchema: ResultSchema;\n transport: Transport;\n retryable: Retryable;\n flushEventsBeforeResult: HostDaemonFlushEventsBeforeResult;\n envLane: HostDaemonCommandEnvironmentLane | null;\n}\ndeclare const hostDaemonCommandRegistry: {\n \"thread.start\": HostDaemonCommandDescriptor<\"thread.start\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n projectId: z$1.ZodString;\n providerId: z$1.ZodString;\n acpLaunchSpec: z$1.ZodOptional;\n env: z$1.ZodRecord;\n cwd: z$1.ZodOptional;\n modelCli: z$1.ZodOptional;\n selectFlag: z$1.ZodOptional;\n primaryModels: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodTransform<{\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n } | undefined, {\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n }>>>;\n reasoningCli: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n nativeReasoning: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n permissionCli: z$1.ZodOptional>;\n workspaceWrite: z$1.ZodOptional>;\n readonly: z$1.ZodOptional>;\n insertAfterArgs: z$1.ZodOptional;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n options: z$1.ZodIntersection;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n claudeCodePermissionMode: z$1.ZodOptional>;\n claudeCodeMockCliTraffic: z$1.ZodOptional>;\n workflowsEnabled: z$1.ZodBoolean;\n memoryEnabled: z$1.ZodOptional;\n providerSubagentsEnabled: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"full\">;\n permissionEscalation: z$1.ZodNull;\n }, z$1.core.$strip>, z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"workspace-write\">;\n permissionEscalation: z$1.ZodEnum<{\n ask: \"ask\";\n deny: \"deny\";\n }>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"readonly\">;\n permissionEscalation: z$1.ZodEnum<{\n ask: \"ask\";\n deny: \"deny\";\n }>;\n }, z$1.core.$strip>], \"permissionMode\">>;\n instructions: z$1.ZodString;\n dynamicTools: z$1.ZodArray>;\n injectedSkillSources: z$1.ZodArray;\n treeHash: z$1.ZodString;\n entryPath: z$1.ZodString;\n sourceType: z$1.ZodEnum<{\n builtin: \"builtin\";\n \"data-dir\": \"data-dir\";\n }>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n name: z$1.ZodString;\n description: z$1.ZodString;\n kind: z$1.ZodLiteral<\"workspace-path\">;\n sourceType: z$1.ZodLiteral<\"project\">;\n sourceRootPath: z$1.ZodString;\n skillFilePath: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n disallowedTools: z$1.ZodOptional>;\n instructionMode: z$1.ZodEnum<{\n append: \"append\";\n replace: \"replace\";\n }>;\n type: z$1.ZodLiteral<\"thread.start\">;\n requestId: z$1.ZodString;\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n builtin: \"builtin\";\n project: \"project\";\n user: \"user\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n inputGroups: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n builtin: \"builtin\";\n project: \"project\";\n user: \"user\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>>>;\n threadStoragePath: z$1.ZodOptional;\n fork: z$1.ZodOptional>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n providerThreadId: z$1.ZodString;\n }, z$1.core.$strip>, \"settled\", false>;\n \"turn.submit\": HostDaemonCommandDescriptor<\"turn.submit\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n type: z$1.ZodLiteral<\"turn.submit\">;\n requestId: z$1.ZodString;\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n builtin: \"builtin\";\n project: \"project\";\n user: \"user\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n inputGroups: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n builtin: \"builtin\";\n project: \"project\";\n user: \"user\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>>>;\n options: z$1.ZodIntersection;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n claudeCodePermissionMode: z$1.ZodOptional>;\n claudeCodeMockCliTraffic: z$1.ZodOptional>;\n workflowsEnabled: z$1.ZodBoolean;\n memoryEnabled: z$1.ZodOptional;\n providerSubagentsEnabled: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"full\">;\n permissionEscalation: z$1.ZodNull;\n }, z$1.core.$strip>, z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"workspace-write\">;\n permissionEscalation: z$1.ZodEnum<{\n ask: \"ask\";\n deny: \"deny\";\n }>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"readonly\">;\n permissionEscalation: z$1.ZodEnum<{\n ask: \"ask\";\n deny: \"deny\";\n }>;\n }, z$1.core.$strip>], \"permissionMode\">>;\n acpLaunchSpec: z$1.ZodOptional;\n env: z$1.ZodRecord;\n cwd: z$1.ZodOptional;\n modelCli: z$1.ZodOptional;\n selectFlag: z$1.ZodOptional;\n primaryModels: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodTransform<{\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n } | undefined, {\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n }>>>;\n reasoningCli: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n nativeReasoning: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n permissionCli: z$1.ZodOptional>;\n workspaceWrite: z$1.ZodOptional>;\n readonly: z$1.ZodOptional>;\n insertAfterArgs: z$1.ZodOptional;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n resumeContext: z$1.ZodObject<{\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n instructionMode: z$1.ZodEnum<{\n append: \"append\";\n replace: \"replace\";\n }>;\n projectId: z$1.ZodString;\n providerId: z$1.ZodString;\n acpLaunchSpec: z$1.ZodOptional;\n env: z$1.ZodRecord;\n cwd: z$1.ZodOptional;\n modelCli: z$1.ZodOptional;\n selectFlag: z$1.ZodOptional;\n primaryModels: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodTransform<{\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n } | undefined, {\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n }>>>;\n reasoningCli: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n nativeReasoning: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n permissionCli: z$1.ZodOptional>;\n workspaceWrite: z$1.ZodOptional>;\n readonly: z$1.ZodOptional>;\n insertAfterArgs: z$1.ZodOptional;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n instructions: z$1.ZodString;\n dynamicTools: z$1.ZodArray>;\n injectedSkillSources: z$1.ZodArray;\n treeHash: z$1.ZodString;\n entryPath: z$1.ZodString;\n sourceType: z$1.ZodEnum<{\n builtin: \"builtin\";\n \"data-dir\": \"data-dir\";\n }>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n name: z$1.ZodString;\n description: z$1.ZodString;\n kind: z$1.ZodLiteral<\"workspace-path\">;\n sourceType: z$1.ZodLiteral<\"project\">;\n sourceRootPath: z$1.ZodString;\n skillFilePath: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n disallowedTools: z$1.ZodOptional>;\n providerThreadId: z$1.ZodString;\n }, z$1.core.$strict>;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n mode: z$1.ZodLiteral<\"start\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n mode: z$1.ZodLiteral<\"auto\">;\n expectedTurnId: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n mode: z$1.ZodLiteral<\"steer\">;\n expectedTurnId: z$1.ZodNullable;\n }, z$1.core.$strip>], \"mode\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n appliedAs: z$1.ZodEnum<{\n steer: \"steer\";\n \"new-turn\": \"new-turn\";\n }>;\n }, z$1.core.$strip>, \"settled\", false>;\n \"thread.stop\": HostDaemonCommandDescriptor<\"thread.stop\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n type: z$1.ZodLiteral<\"thread.stop\">;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"thread.rename\": HostDaemonCommandDescriptor<\"thread.rename\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n type: z$1.ZodLiteral<\"thread.rename\">;\n title: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"thread.archive\": HostDaemonCommandDescriptor<\"thread.archive\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"thread.archive\">;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"thread.unarchive\": HostDaemonCommandDescriptor<\"thread.unarchive\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n type: z$1.ZodLiteral<\"thread.unarchive\">;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"interactive.resolve\": HostDaemonCommandDescriptor<\"interactive.resolve\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n type: z$1.ZodLiteral<\"interactive.resolve\">;\n interactionId: z$1.ZodString;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n resolution: z$1.ZodUnion;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"allow_for_session\">;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"deny\">;\n }, z$1.core.$strip>], \"decision\">, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_answer\">;\n answers: z$1.ZodRecord;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin_submitted\">;\n }, z$1.core.$strip>]>;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"codex.inference.complete\": HostDaemonCommandDescriptor<\"codex.inference.complete\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"codex.inference.complete\">;\n model: z$1.ZodString;\n prompt: z$1.ZodString;\n outputSchema: z$1.ZodType>;\n timeoutMs: z$1.ZodNumber;\n }, z$1.core.$strict>, z$1.ZodObject<{\n model: z$1.ZodString;\n value: z$1.ZodType>;\n }, z$1.core.$strip>, \"settled\", false>;\n \"codex.voice.transcribe\": HostDaemonCommandDescriptor<\"codex.voice.transcribe\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"codex.voice.transcribe\">;\n model: z$1.ZodString;\n audioBase64: z$1.ZodString;\n mimeType: z$1.ZodString;\n filename: z$1.ZodString;\n prompt: z$1.ZodNullable;\n timeoutMs: z$1.ZodNumber;\n }, z$1.core.$strict>, z$1.ZodObject<{\n model: z$1.ZodString;\n text: z$1.ZodString;\n }, z$1.core.$strip>, \"settled\", false>;\n \"environment.provision\": HostDaemonCommandDescriptor<\"environment.provision\", z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n environmentId: z$1.ZodString;\n type: z$1.ZodLiteral<\"environment.provision\">;\n initiator: z$1.ZodNullable>;\n workspaceProvisionType: z$1.ZodLiteral<\"unmanaged\">;\n path: z$1.ZodString;\n checkout: z$1.ZodOptional;\n name: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"new\">;\n name: z$1.ZodString;\n baseBranch: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodString;\n type: z$1.ZodLiteral<\"environment.provision\">;\n initiator: z$1.ZodNullable>;\n sourcePath: z$1.ZodString;\n targetPath: z$1.ZodString;\n branchName: z$1.ZodString;\n baseBranch: z$1.ZodNullable;\n setupTimeoutMs: z$1.ZodNumber;\n workspaceProvisionType: z$1.ZodLiteral<\"managed-worktree\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodString;\n type: z$1.ZodLiteral<\"environment.provision\">;\n initiator: z$1.ZodNullable>;\n workspaceProvisionType: z$1.ZodLiteral<\"personal\">;\n targetPath: z$1.ZodString;\n }, z$1.core.$strict>], \"workspaceProvisionType\">, z$1.ZodObject<{\n path: z$1.ZodString;\n isGitRepo: z$1.ZodBoolean;\n isWorktree: z$1.ZodBoolean;\n branchName: z$1.ZodNullable;\n defaultBranch: z$1.ZodNullable;\n transcript: z$1.ZodArray;\n key: z$1.ZodString;\n text: z$1.ZodString;\n startedAt: z$1.ZodOptional;\n status: z$1.ZodOptional>;\n metadata: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, \"settled\", false>;\n \"project.clone\": HostDaemonCommandDescriptor<\"project.clone\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"project.clone\">;\n remoteUrl: z$1.ZodString;\n projectSlug: z$1.ZodString;\n targetPath: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodString;\n gitRemoteUrl: z$1.ZodNullable;\n }, z$1.core.$strict>, \"settled\", false>;\n \"environment.provision.cancel\": HostDaemonCommandDescriptor<\"environment.provision.cancel\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n type: z$1.ZodLiteral<\"environment.provision.cancel\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n aborted: z$1.ZodBoolean;\n }, z$1.core.$strip>, \"settled\", false>;\n \"environment.destroy\": HostDaemonCommandDescriptor<\"environment.destroy\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"environment.destroy\">;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"workspace.commit\": HostDaemonCommandDescriptor<\"workspace.commit\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.commit\">;\n message: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n commitSha: z$1.ZodString;\n commitSubject: z$1.ZodString;\n }, z$1.core.$strip>, \"settled\", false>;\n \"workspace.squash_merge\": HostDaemonCommandDescriptor<\"workspace.squash_merge\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.squash_merge\">;\n targetBranch: z$1.ZodString;\n commitMessage: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n commitSha: z$1.ZodString;\n commitSubject: z$1.ZodString;\n merged: z$1.ZodBoolean;\n }, z$1.core.$strip>, \"settled\", false>;\n \"workspace.pull_request_action\": HostDaemonCommandDescriptor<\"workspace.pull_request_action\", z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.pull_request_action\">;\n operation: z$1.ZodLiteral<\"ready\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.pull_request_action\">;\n operation: z$1.ZodLiteral<\"draft\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.pull_request_action\">;\n operation: z$1.ZodLiteral<\"merge\">;\n method: z$1.ZodEnum<{\n merge: \"merge\";\n squash: \"squash\";\n rebase: \"rebase\";\n }>;\n }, z$1.core.$strict>], \"operation\">, z$1.ZodObject<{}, z$1.core.$strict>, \"settled\", false>;\n \"host.list_files\": HostDaemonCommandDescriptor<\"host.list_files\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.list_files\">;\n path: z$1.ZodString;\n query: z$1.ZodOptional;\n limit: z$1.ZodNumber;\n }, z$1.core.$strip>, z$1.ZodObject<{\n files: z$1.ZodArray>;\n truncated: z$1.ZodBoolean;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.list_paths\": HostDaemonCommandDescriptor<\"host.list_paths\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.list_paths\">;\n path: z$1.ZodString;\n query: z$1.ZodOptional;\n limit: z$1.ZodNumber;\n includeFiles: z$1.ZodBoolean;\n includeDirectories: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n paths: z$1.ZodArray;\n path: z$1.ZodString;\n name: z$1.ZodString;\n score: z$1.ZodNumber;\n positions: z$1.ZodArray;\n }, z$1.core.$strip>>;\n truncated: z$1.ZodBoolean;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.mkdir\": HostDaemonCommandDescriptor<\"host.mkdir\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.mkdir\">;\n path: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n recursive: z$1.ZodBoolean;\n }, z$1.core.$strict>, z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n }, z$1.core.$strict>, \"onlineRpc\", false>;\n \"host.move_path\": HostDaemonCommandDescriptor<\"host.move_path\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.move_path\">;\n sourcePath: z$1.ZodString;\n destinationPath: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n }, z$1.core.$strict>, \"onlineRpc\", false>;\n \"host.remove_path\": HostDaemonCommandDescriptor<\"host.remove_path\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.remove_path\">;\n path: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n recursive: z$1.ZodBoolean;\n }, z$1.core.$strict>, z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n }, z$1.core.$strict>, \"onlineRpc\", false>;\n \"host.browse_directory\": HostDaemonCommandDescriptor<\"host.browse_directory\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.browse_directory\">;\n path: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n directory: z$1.ZodString;\n parent: z$1.ZodNullable;\n entries: z$1.ZodArray;\n name: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.paths_exist\": HostDaemonCommandDescriptor<\"host.paths_exist\", z$1.ZodObject<{\n paths: z$1.ZodPipe, z$1.ZodTransform>;\n type: z$1.ZodLiteral<\"host.paths_exist\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n existence: z$1.ZodRecord;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"project.inspect\": HostDaemonCommandDescriptor<\"project.inspect\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"project.inspect\">;\n path: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodString;\n gitRemoteUrl: z$1.ZodNullable;\n }, z$1.core.$strict>, \"onlineRpc\", true>;\n \"project.clone_default_path\": HostDaemonCommandDescriptor<\"project.clone_default_path\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"project.clone_default_path\">;\n projectSlug: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodString;\n }, z$1.core.$strict>, \"onlineRpc\", true>;\n \"host.pick_folder\": HostDaemonCommandDescriptor<\"host.pick_folder\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.pick_folder\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, \"onlineRpc\", false>;\n \"host.caffeinate\": HostDaemonCommandDescriptor<\"host.caffeinate\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.caffeinate\">;\n enabled: z$1.ZodBoolean;\n }, z$1.core.$strict>, z$1.ZodObject<{\n enabled: z$1.ZodBoolean;\n supported: z$1.ZodBoolean;\n }, z$1.core.$strict>, \"onlineRpc\", false>;\n \"connect-tunnel.ensure-identity\": HostDaemonCommandDescriptor<\"connect-tunnel.ensure-identity\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"connect-tunnel.ensure-identity\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n label: z$1.ZodString;\n baseDomain: z$1.ZodString;\n }, z$1.core.$strict>, \"onlineRpc\", true>;\n \"host.list_commands\": HostDaemonCommandDescriptor<\"host.list_commands\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.list_commands\">;\n providerId: z$1.ZodString;\n cwd: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n commands: z$1.ZodArray;\n origin: z$1.ZodEnum<{\n project: \"project\";\n user: \"user\";\n }>;\n description: z$1.ZodNullable;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.list_branches\": HostDaemonCommandDescriptor<\"host.list_branches\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.list_branches\">;\n path: z$1.ZodString;\n query: z$1.ZodOptional;\n selectedBranch: z$1.ZodOptional;\n limit: z$1.ZodNumber;\n }, z$1.core.$strip>, z$1.ZodObject<{\n branches: z$1.ZodArray;\n branchesTruncated: z$1.ZodBoolean;\n checkout: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"branch\">;\n branchName: z$1.ZodString;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"detached\">;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unborn\">;\n branchName: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n defaultBranch: z$1.ZodNullable;\n defaultBranchRelation: z$1.ZodNullable>;\n hasUncommittedChanges: z$1.ZodBoolean;\n operation: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"none\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"merge\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"rebase\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"cherry-pick\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"revert\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>], \"kind\">;\n originDefaultBranch: z$1.ZodNullable;\n remoteBranches: z$1.ZodArray;\n remoteBranchesTruncated: z$1.ZodBoolean;\n selectedBranch: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.file_metadata\": HostDaemonCommandDescriptor<\"host.file_metadata\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.file_metadata\">;\n path: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodString;\n modifiedAtMs: z$1.ZodNumber;\n sizeBytes: z$1.ZodNumber;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.read_file\": HostDaemonCommandDescriptor<\"host.read_file\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.read_file\">;\n path: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n ref: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n path: z$1.ZodString;\n content: z$1.ZodString;\n contentEncoding: z$1.ZodEnum<{\n base64: \"base64\";\n utf8: \"utf8\";\n }>;\n mimeType: z$1.ZodOptional;\n sizeBytes: z$1.ZodNumber;\n modifiedAtMs: z$1.ZodOptional;\n sha256: z$1.ZodString;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.read_file_relative\": HostDaemonCommandDescriptor<\"host.read_file_relative\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.read_file_relative\">;\n rootPath: z$1.ZodString;\n path: z$1.ZodString;\n dotfiles: z$1.ZodEnum<{\n deny: \"deny\";\n allow: \"allow\";\n }>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodString;\n content: z$1.ZodString;\n contentEncoding: z$1.ZodEnum<{\n base64: \"base64\";\n utf8: \"utf8\";\n }>;\n mimeType: z$1.ZodOptional;\n sizeBytes: z$1.ZodNumber;\n modifiedAtMs: z$1.ZodOptional;\n sha256: z$1.ZodString;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.write_file\": HostDaemonCommandDescriptor<\"host.write_file\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.write_file\">;\n path: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n content: z$1.ZodString;\n contentEncoding: z$1.ZodEnum<{\n base64: \"base64\";\n utf8: \"utf8\";\n }>;\n createParents: z$1.ZodBoolean;\n expectedSha256: z$1.ZodOptional>;\n mode: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"written\">;\n sha256: z$1.ZodString;\n sizeBytes: z$1.ZodNumber;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"conflict\">;\n currentSha256: z$1.ZodNullable;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", false>;\n \"provider.list_models\": HostDaemonCommandDescriptor<\"provider.list_models\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider.list_models\">;\n providerId: z$1.ZodString;\n acpLaunchSpec: z$1.ZodOptional;\n env: z$1.ZodRecord;\n cwd: z$1.ZodOptional;\n modelCli: z$1.ZodOptional;\n selectFlag: z$1.ZodOptional;\n primaryModels: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodTransform<{\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n } | undefined, {\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n }>>>;\n reasoningCli: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n nativeReasoning: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n permissionCli: z$1.ZodOptional>;\n workspaceWrite: z$1.ZodOptional>;\n readonly: z$1.ZodOptional>;\n insertAfterArgs: z$1.ZodOptional;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n models: z$1.ZodArray;\n description: z$1.ZodString;\n }, z$1.core.$strip>>;\n defaultReasoningEffort: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n isDefault: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n selectedOnlyModels: z$1.ZodArray;\n description: z$1.ZodString;\n }, z$1.core.$strip>>;\n defaultReasoningEffort: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n isDefault: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"known_acp_agents.status\": HostDaemonCommandDescriptor<\"known_acp_agents.status\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"known_acp_agents.status\">;\n agents: z$1.ZodArray>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n agents: z$1.ZodArray;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>, \"onlineRpc\", true>;\n \"provider.usage\": HostDaemonCommandDescriptor<\"provider.usage\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider.usage\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n codex: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n claudeCode: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n cursor: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"provider_cli.status\": HostDaemonCommandDescriptor<\"provider_cli.status\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider_cli.status\">;\n }, z$1.core.$strict>, z$1.ZodRecord, z$1.ZodObject<{\n displayName: z$1.ZodString;\n executableName: z$1.ZodString;\n executablePath: z$1.ZodNullable;\n installed: z$1.ZodBoolean;\n installSource: z$1.ZodEnum<{\n external: \"external\";\n notInstalled: \"notInstalled\";\n npmGlobal: \"npmGlobal\";\n }>;\n currentVersion: z$1.ZodNullable;\n latestVersion: z$1.ZodNullable;\n minimumSupportedVersion: z$1.ZodNullable;\n npmPackageName: z$1.ZodNullable;\n npmGlobalPackageVersion: z$1.ZodNullable;\n installAction: z$1.ZodNullable;\n label: z$1.ZodEnum<{\n Install: \"Install\";\n Update: \"Update\";\n }>;\n commandKind: z$1.ZodEnum<{\n exec: \"exec\";\n shell: \"shell\";\n }>;\n command: z$1.ZodString;\n }, z$1.core.$strip>>;\n needsUpdate: z$1.ZodBoolean;\n versionUnsupported: z$1.ZodBoolean;\n }, z$1.core.$strip>>, \"onlineRpc\", true>;\n \"provider_cli.install\": HostDaemonCommandDescriptor<\"provider_cli.install\", z$1.ZodObject<{\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n actionKind: z$1.ZodEnum<{\n install: \"install\";\n update: \"update\";\n }>;\n type: z$1.ZodLiteral<\"provider_cli.install\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n events: z$1.ZodArray;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n command: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"output\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n stream: z$1.ZodEnum<{\n stdout: \"stdout\";\n stderr: \"stderr\";\n }>;\n text: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"completed\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n exitCode: z$1.ZodNullable;\n signal: z$1.ZodNullable;\n success: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"error\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n }, z$1.core.$strict>, \"onlineRpc\", false>;\n \"workspace.status\": HostDaemonCommandDescriptor<\"workspace.status\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.status\">;\n mergeBaseBranch: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n workspaceStatus: z$1.ZodObject<{\n workingTree: z$1.ZodObject<{\n insertions: z$1.ZodNumber;\n deletions: z$1.ZodNumber;\n files: z$1.ZodArray;\n insertions: z$1.ZodNullable;\n deletions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n hasUncommittedChanges: z$1.ZodBoolean;\n state: z$1.ZodEnum<{\n clean: \"clean\";\n untracked: \"untracked\";\n dirty_uncommitted: \"dirty_uncommitted\";\n committed_unmerged: \"committed_unmerged\";\n dirty_and_committed_unmerged: \"dirty_and_committed_unmerged\";\n }>;\n }, z$1.core.$strip>;\n checkout: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"branch\">;\n branchName: z$1.ZodString;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"detached\">;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unborn\">;\n branchName: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n branch: z$1.ZodObject<{\n currentBranch: z$1.ZodNullable;\n defaultBranch: z$1.ZodString;\n }, z$1.core.$strip>;\n mergeBase: z$1.ZodNullable;\n insertions: z$1.ZodNullable;\n deletions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n mergeBaseBranch: z$1.ZodString;\n baseRef: z$1.ZodNullable;\n aheadCount: z$1.ZodNumber;\n behindCount: z$1.ZodNumber;\n hasCommittedUnmergedChanges: z$1.ZodBoolean;\n commits: z$1.ZodArray>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n unknown: \"unknown\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", true>;\n \"workspace.diff\": HostDaemonCommandDescriptor<\"workspace.diff\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.diff\">;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"uncommitted\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"all\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">;\n maxDiffBytes: z$1.ZodNumber;\n maxFileListBytes: z$1.ZodNumber;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n diff: z$1.ZodObject<{\n diff: z$1.ZodString;\n truncated: z$1.ZodBoolean;\n shortstat: z$1.ZodString;\n files: z$1.ZodString;\n mergeBaseRef: z$1.ZodNullable;\n }, z$1.core.$strip>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n unknown: \"unknown\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", true>;\n \"workspace.diffFiles\": HostDaemonCommandDescriptor<\"workspace.diffFiles\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.diffFiles\">;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"uncommitted\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"all\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n files: z$1.ZodArray;\n statusLetter: z$1.ZodEnum<{\n M: \"M\";\n A: \"A\";\n D: \"D\";\n R: \"R\";\n C: \"C\";\n T: \"T\";\n }>;\n additions: z$1.ZodNumber;\n deletions: z$1.ZodNumber;\n binary: z$1.ZodBoolean;\n origin: z$1.ZodEnum<{\n untracked: \"untracked\";\n tracked: \"tracked\";\n }>;\n }, z$1.core.$strip>>;\n shortstat: z$1.ZodString;\n mergeBaseRef: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n unknown: \"unknown\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", true>;\n \"workspace.diffPatch\": HostDaemonCommandDescriptor<\"workspace.diffPatch\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.diffPatch\">;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"uncommitted\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"all\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">;\n paths: z$1.ZodArray;\n maxBytesPerFile: z$1.ZodNumber;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n patches: z$1.ZodArray>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n unknown: \"unknown\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", true>;\n \"workspace.pull_request\": HostDaemonCommandDescriptor<\"workspace.pull_request\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.pull_request\">;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n pullRequest: z$1.ZodObject<{\n number: z$1.ZodNumber;\n title: z$1.ZodString;\n state: z$1.ZodEnum<{\n OPEN: \"OPEN\";\n CLOSED: \"CLOSED\";\n MERGED: \"MERGED\";\n }>;\n url: z$1.ZodString;\n isDraft: z$1.ZodBoolean;\n baseRefName: z$1.ZodString;\n headRefName: z$1.ZodString;\n updatedAt: z$1.ZodString;\n checks: z$1.ZodArray;\n conclusion: z$1.ZodNullable>;\n url: z$1.ZodNullable;\n }, z$1.core.$strict>>;\n reviewDecision: z$1.ZodNullable>;\n reviewRequestCount: z$1.ZodNumber;\n mergeStateStatus: z$1.ZodNullable>;\n mergeable: z$1.ZodNullable>;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"absent\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n message: z$1.ZodString;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", true>;\n};\ntype HostDaemonCommandRegistry = typeof hostDaemonCommandRegistry;\ntype AnyHostDaemonCommandDescriptor = HostDaemonCommandRegistry[keyof HostDaemonCommandRegistry];\ntype HostDaemonCommandDescriptorForTransport = Extract;\ntype HostDaemonResultSchemaMapForTransport = {\n [Descriptor in HostDaemonCommandDescriptorForTransport as Descriptor[\"type\"]]: Descriptor[\"resultSchema\"];\n};\ntype HostDaemonOnlineRpcResultSchemaMap = HostDaemonResultSchemaMapForTransport<\"onlineRpc\">;\ntype HostDaemonOnlineRpcResultByType = {\n [K in keyof HostDaemonOnlineRpcResultSchemaMap]: z$1.infer;\n};\n\ndeclare const pickFolderResponseSchema: z$1.ZodObject<{\n path: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype PickFolderResponse = z$1.infer;\ndeclare const pathsExistRequestSchema: z$1.ZodObject<{\n paths: z$1.ZodPipe, z$1.ZodTransform>;\n}, z$1.core.$strip>;\ntype PathsExistRequest = z$1.infer;\ndeclare const pathsExistResponseSchema: z$1.ZodObject<{\n existence: z$1.ZodRecord;\n}, z$1.core.$strip>;\ntype PathsExistResponse = z$1.infer;\ndeclare const providerCliStatusResponseSchema: z$1.ZodRecord, z$1.ZodObject<{\n displayName: z$1.ZodString;\n executableName: z$1.ZodString;\n executablePath: z$1.ZodNullable;\n installed: z$1.ZodBoolean;\n installSource: z$1.ZodEnum<{\n external: \"external\";\n notInstalled: \"notInstalled\";\n npmGlobal: \"npmGlobal\";\n }>;\n currentVersion: z$1.ZodNullable;\n latestVersion: z$1.ZodNullable;\n minimumSupportedVersion: z$1.ZodNullable;\n npmPackageName: z$1.ZodNullable;\n npmGlobalPackageVersion: z$1.ZodNullable;\n installAction: z$1.ZodNullable;\n label: z$1.ZodEnum<{\n Install: \"Install\";\n Update: \"Update\";\n }>;\n commandKind: z$1.ZodEnum<{\n exec: \"exec\";\n shell: \"shell\";\n }>;\n command: z$1.ZodString;\n }, z$1.core.$strip>>;\n needsUpdate: z$1.ZodBoolean;\n versionUnsupported: z$1.ZodBoolean;\n}, z$1.core.$strip>>;\ntype ProviderCliStatusResponse = z$1.infer;\ndeclare const providerCliInstallRequestSchema: z$1.ZodObject<{\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n actionKind: z$1.ZodEnum<{\n install: \"install\";\n update: \"update\";\n }>;\n}, z$1.core.$strip>;\ntype ProviderCliInstallRequest = z$1.infer;\ndeclare const providerCliInstallEventSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"started\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n command: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"output\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n stream: z$1.ZodEnum<{\n stdout: \"stdout\";\n stderr: \"stderr\";\n }>;\n text: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"completed\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n exitCode: z$1.ZodNullable;\n signal: z$1.ZodNullable;\n success: z$1.ZodBoolean;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"error\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strip>], \"type\">;\ntype ProviderCliInstallEvent = z$1.infer;\n\ninterface CreateFilePreviewResponse {\n baseUrl: string;\n expiresAtMs: number;\n}\ntype HostFileReadResponse = HostDaemonOnlineRpcResultByType[\"host.read_file\"];\ntype HostFileWriteResponse = HostDaemonOnlineRpcResultByType[\"host.write_file\"];\ntype HostFileListResponse = HostDaemonOnlineRpcResultByType[\"host.list_files\"];\ntype HostPathListResponse = HostDaemonOnlineRpcResultByType[\"host.list_paths\"];\ntype HostMkdirResponse = HostDaemonOnlineRpcResultByType[\"host.mkdir\"];\ntype HostMovePathResponse = HostDaemonOnlineRpcResultByType[\"host.move_path\"];\ntype HostRemovePathResponse = HostDaemonOnlineRpcResultByType[\"host.remove_path\"];\n\n/**\n * Query for `GET /hosts/:id/directory`, the interactive path browser's\n * single-level directory read. `path` is an absolute directory on the host;\n * omitting it lists the host's home directory (the daemon resolves it, since a\n * remote caller cannot know the host's home).\n */\ndeclare const hostDirectoryQuerySchema: z$1.ZodObject<{\n path: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype HostDirectoryQuery = z$1.infer;\ndeclare const hostDirectoryListingSchema: z$1.ZodObject<{\n directory: z$1.ZodString;\n parent: z$1.ZodNullable;\n entries: z$1.ZodArray;\n name: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype HostDirectoryListing = z$1.infer;\n/** Project name is sent so the daemon can derive its host-local checkout path. */\ndeclare const hostCloneDefaultPathQuerySchema: z$1.ZodObject<{\n projectId: z$1.ZodString;\n}, z$1.core.$strip>;\ntype HostCloneDefaultPathQuery = z$1.infer;\ndeclare const hostCloneDefaultPathResponseSchema: z$1.ZodObject<{\n path: z$1.ZodString;\n}, z$1.core.$strict>;\ntype HostCloneDefaultPathResponse = z$1.infer;\ndeclare const createHostJoinCodeResponseSchema: z$1.ZodObject<{\n joinCode: z$1.ZodString;\n hostId: z$1.ZodString;\n expiresAt: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype CreateHostJoinCodeResponse = z$1.infer;\ndeclare const updateHostRequestSchema: z$1.ZodObject<{\n name: z$1.ZodString;\n}, z$1.core.$strict>;\ntype UpdateHostRequest = z$1.infer;\ntype HostPathsExistRequest = PathsExistRequest;\ntype HostPathsExistResponse = PathsExistResponse;\ndeclare const hostPickFolderRequestSchema: z$1.ZodObject<{\n clientHostId: z$1.ZodString;\n}, z$1.core.$strict>;\ntype HostPickFolderRequest = z$1.infer;\ntype HostPickFolderResponse = PickFolderResponse;\ntype HostProviderCliStatusResponse = ProviderCliStatusResponse;\ntype HostProviderCliInstallRequest = ProviderCliInstallRequest;\ntype HostProviderCliInstallEvent = ProviderCliInstallEvent;\n\ndeclare const pluginUpdateCheckEntrySchema: z$1.ZodObject<{\n id: z$1.ZodString;\n outcome: z$1.ZodEnum<{\n unavailable: \"unavailable\";\n incompatible: \"incompatible\";\n current: \"current\";\n \"update-available\": \"update-available\";\n pinned: \"pinned\";\n }>;\n devMode: z$1.ZodOptional>;\n installed: z$1.ZodObject<{\n version: z$1.ZodString;\n display: z$1.ZodString;\n }, z$1.core.$strip>;\n candidate: z$1.ZodOptional>;\n blocked: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n detail: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype PluginUpdateCheckEntry = z$1.infer;\ndeclare const pluginApplyUpdateResultSchema: z$1.ZodObject<{\n applied: z$1.ZodBoolean;\n from: z$1.ZodObject<{\n version: z$1.ZodString;\n display: z$1.ZodString;\n }, z$1.core.$strip>;\n to: z$1.ZodOptional>;\n outcome: z$1.ZodEnum<{\n current: \"current\";\n updated: \"updated\";\n \"rolled-back\": \"rolled-back\";\n }>;\n detail: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype PluginApplyUpdateResult$1 = z$1.infer;\ndeclare const pluginSourceDetailSchema: z$1.ZodObject<{\n requested: z$1.ZodString;\n resolved: z$1.ZodString;\n integrity: z$1.ZodOptional;\n registry: z$1.ZodOptional;\n engines: z$1.ZodObject<{\n bb: z$1.ZodOptional;\n bbPluginSdk: z$1.ZodOptional;\n }, z$1.core.$strip>;\n installedAt: z$1.ZodOptional;\n history: z$1.ZodArray>;\n}, z$1.core.$strip>;\ntype PluginSourceDetail = z$1.infer;\ndeclare const installedPluginSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n source: z$1.ZodString;\n rootDir: z$1.ZodString;\n version: z$1.ZodString;\n provenance: z$1.ZodEnum<{\n builtin: \"builtin\";\n direct: \"direct\";\n catalog: \"catalog\";\n }>;\n isOrphanedBuiltin: z$1.ZodBoolean;\n catalogEntryId: z$1.ZodOptional;\n sourceDisplay: z$1.ZodString;\n updateState: z$1.ZodObject<{\n outcome: z$1.ZodOptional>;\n availableVersion: z$1.ZodOptional;\n blockedVersion: z$1.ZodOptional;\n blockedReasons: z$1.ZodOptional>;\n lastCheckAt: z$1.ZodOptional;\n lastFailure: z$1.ZodOptional>;\n }, z$1.core.$strip>;\n enabled: z$1.ZodBoolean;\n description: z$1.ZodNullable;\n name: z$1.ZodNullable;\n icon: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n running: \"running\";\n missing: \"missing\";\n incompatible: \"incompatible\";\n disabled: \"disabled\";\n degraded: \"degraded\";\n \"needs-configuration\": \"needs-configuration\";\n }>;\n statusDetail: z$1.ZodNullable;\n handlerStats: z$1.ZodObject<{\n count: z$1.ZodNumber;\n totalMs: z$1.ZodNumber;\n maxMs: z$1.ZodNumber;\n errorCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n services: z$1.ZodArray;\n }, z$1.core.$strip>>;\n schedules: z$1.ZodArray;\n lastStatus: z$1.ZodNullable>;\n lastError: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n cliCommand: z$1.ZodNullable>;\n hasSettings: z$1.ZodBoolean;\n app: z$1.ZodObject<{\n hasApp: z$1.ZodBoolean;\n bundle: z$1.ZodNullable;\n hash: z$1.ZodString;\n sdkMajor: z$1.ZodNumber;\n sdkVersion: z$1.ZodString;\n compatible: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n logoUrl: z$1.ZodNullable;\n logoDarkUrl: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype InstalledPlugin = z$1.infer;\ndeclare const pluginListResponseSchema: z$1.ZodObject<{\n enabled: z$1.ZodBoolean;\n plugins: z$1.ZodArray;\n isOrphanedBuiltin: z$1.ZodBoolean;\n catalogEntryId: z$1.ZodOptional;\n sourceDisplay: z$1.ZodString;\n updateState: z$1.ZodObject<{\n outcome: z$1.ZodOptional>;\n availableVersion: z$1.ZodOptional;\n blockedVersion: z$1.ZodOptional;\n blockedReasons: z$1.ZodOptional>;\n lastCheckAt: z$1.ZodOptional;\n lastFailure: z$1.ZodOptional>;\n }, z$1.core.$strip>;\n enabled: z$1.ZodBoolean;\n description: z$1.ZodNullable;\n name: z$1.ZodNullable;\n icon: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n running: \"running\";\n missing: \"missing\";\n incompatible: \"incompatible\";\n disabled: \"disabled\";\n degraded: \"degraded\";\n \"needs-configuration\": \"needs-configuration\";\n }>;\n statusDetail: z$1.ZodNullable;\n handlerStats: z$1.ZodObject<{\n count: z$1.ZodNumber;\n totalMs: z$1.ZodNumber;\n maxMs: z$1.ZodNumber;\n errorCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n services: z$1.ZodArray;\n }, z$1.core.$strip>>;\n schedules: z$1.ZodArray;\n lastStatus: z$1.ZodNullable>;\n lastError: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n cliCommand: z$1.ZodNullable>;\n hasSettings: z$1.ZodBoolean;\n app: z$1.ZodObject<{\n hasApp: z$1.ZodBoolean;\n bundle: z$1.ZodNullable;\n hash: z$1.ZodString;\n sdkMajor: z$1.ZodNumber;\n sdkVersion: z$1.ZodString;\n compatible: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n logoUrl: z$1.ZodNullable;\n logoDarkUrl: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype PluginListResponse = z$1.infer;\ndeclare const pluginReloadResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n plugins: z$1.ZodArray;\n isOrphanedBuiltin: z$1.ZodBoolean;\n catalogEntryId: z$1.ZodOptional;\n sourceDisplay: z$1.ZodString;\n updateState: z$1.ZodObject<{\n outcome: z$1.ZodOptional>;\n availableVersion: z$1.ZodOptional;\n blockedVersion: z$1.ZodOptional;\n blockedReasons: z$1.ZodOptional>;\n lastCheckAt: z$1.ZodOptional;\n lastFailure: z$1.ZodOptional>;\n }, z$1.core.$strip>;\n enabled: z$1.ZodBoolean;\n description: z$1.ZodNullable;\n name: z$1.ZodNullable;\n icon: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n running: \"running\";\n missing: \"missing\";\n incompatible: \"incompatible\";\n disabled: \"disabled\";\n degraded: \"degraded\";\n \"needs-configuration\": \"needs-configuration\";\n }>;\n statusDetail: z$1.ZodNullable;\n handlerStats: z$1.ZodObject<{\n count: z$1.ZodNumber;\n totalMs: z$1.ZodNumber;\n maxMs: z$1.ZodNumber;\n errorCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n services: z$1.ZodArray;\n }, z$1.core.$strip>>;\n schedules: z$1.ZodArray;\n lastStatus: z$1.ZodNullable>;\n lastError: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n cliCommand: z$1.ZodNullable>;\n hasSettings: z$1.ZodBoolean;\n app: z$1.ZodObject<{\n hasApp: z$1.ZodBoolean;\n bundle: z$1.ZodNullable;\n hash: z$1.ZodString;\n sdkMajor: z$1.ZodNumber;\n sdkVersion: z$1.ZodString;\n compatible: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n logoUrl: z$1.ZodNullable;\n logoDarkUrl: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype PluginReloadResponse = z$1.infer;\ndeclare const pluginRemoveResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n}, z$1.core.$strip>;\ntype PluginRemoveResponse = z$1.infer;\ndeclare const pluginSettingsResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n schema: z$1.ZodRecord;\n secret: z$1.ZodOptional>;\n default: z$1.ZodOptional;\n label: z$1.ZodString;\n description: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"boolean\">;\n default: z$1.ZodOptional;\n label: z$1.ZodString;\n description: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"select\">;\n options: z$1.ZodArray;\n default: z$1.ZodOptional;\n label: z$1.ZodString;\n description: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"project\">;\n default: z$1.ZodOptional;\n label: z$1.ZodString;\n description: z$1.ZodOptional;\n }, z$1.core.$strict>], \"type\">>;\n values: z$1.ZodRecord>>;\n}, z$1.core.$strip>;\ntype PluginSettingsResponse = z$1.infer;\ndeclare const pluginTokenResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n token: z$1.ZodString;\n}, z$1.core.$strip>;\ntype PluginTokenResponse = z$1.infer;\ndeclare const pluginCatalogStatusSchema: z$1.ZodObject<{\n pluginCount: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype PluginCatalogStatus = z$1.infer;\ndeclare const pluginCatalogSearchResultSchema: z$1.ZodObject<{\n entryId: z$1.ZodString;\n displayName: z$1.ZodString;\n description: z$1.ZodString;\n icon: z$1.ZodNullable;\n category: z$1.ZodString;\n source: z$1.ZodString;\n installed: z$1.ZodBoolean;\n compatible: z$1.ZodBoolean;\n incompatibleReason: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype PluginCatalogSearchResult$1 = z$1.infer;\n\ndeclare const systemExecutionOptionsResponseSchema: z$1.ZodObject<{\n providers: z$1.ZodArray;\n capabilities: z$1.ZodObject<{\n supportsArchive: z$1.ZodBoolean;\n supportsRename: z$1.ZodBoolean;\n supportsServiceTier: z$1.ZodBoolean;\n supportsUserQuestion: z$1.ZodBoolean;\n supportsFork: z$1.ZodBoolean;\n supportedPermissionModes: z$1.ZodArray>;\n }, z$1.core.$strip>;\n composerActions: z$1.ZodArray;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plan\">;\n command: z$1.ZodObject<{\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n trailingText: z$1.ZodString;\n }, z$1.core.$strip>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"goal\">;\n command: z$1.ZodObject<{\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n trailingText: z$1.ZodString;\n }, z$1.core.$strip>;\n }, z$1.core.$strip>], \"kind\">>;\n available: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n models: z$1.ZodArray;\n description: z$1.ZodString;\n }, z$1.core.$strip>>;\n defaultReasoningEffort: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n isDefault: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n selectedOnlyModels: z$1.ZodArray;\n description: z$1.ZodString;\n }, z$1.core.$strip>>;\n defaultReasoningEffort: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n isDefault: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n modelLoadError: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype SystemExecutionOptionsResponse = z$1.infer;\ndeclare const systemExecutionOptionsQuerySchema: z$1.ZodObject<{\n providerId: z$1.ZodOptional;\n hostId: z$1.ZodOptional;\n environmentId: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype SystemExecutionOptionsQuery = z$1.infer;\n/** Omission preserves the existing behavior of reading the primary machine. */\ndeclare const systemUsageLimitsQuerySchema: z$1.ZodObject<{\n hostId: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype SystemUsageLimitsQuery = z$1.infer;\ndeclare const systemVoiceTranscriptionResponseSchema: z$1.ZodObject<{\n text: z$1.ZodString;\n}, z$1.core.$strip>;\ntype SystemVoiceTranscriptionResponse = z$1.infer;\ndeclare const systemConfigResponseSchema: z$1.ZodObject<{\n generalSettings: z$1.ZodObject<{\n caffeinate: z$1.ZodBoolean;\n showKeyboardHints: z$1.ZodBoolean;\n showUnhandledProviderEvents: z$1.ZodBoolean;\n codexMemoryEnabled: z$1.ZodBoolean;\n claudeCodeMemoryEnabled: z$1.ZodBoolean;\n codexSubagentsDisabled: z$1.ZodBoolean;\n claudeCodeSubagentsDisabled: z$1.ZodBoolean;\n claudeCodeWorkflowsDisabled: z$1.ZodBoolean;\n }, z$1.core.$strict>;\n keybindings: z$1.ZodArray;\n desktopOnly: z$1.ZodBoolean;\n shortcut: z$1.ZodObject<{\n key: z$1.ZodString;\n mod: z$1.ZodBoolean;\n meta: z$1.ZodBoolean;\n control: z$1.ZodBoolean;\n alt: z$1.ZodBoolean;\n shift: z$1.ZodBoolean;\n }, z$1.core.$strict>;\n when: z$1.ZodObject<{\n all: z$1.ZodArray>;\n none: z$1.ZodArray>;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>>;\n defaultKeybindings: z$1.ZodArray;\n desktopOnly: z$1.ZodBoolean;\n shortcut: z$1.ZodObject<{\n key: z$1.ZodString;\n mod: z$1.ZodBoolean;\n meta: z$1.ZodBoolean;\n control: z$1.ZodBoolean;\n alt: z$1.ZodBoolean;\n shift: z$1.ZodBoolean;\n }, z$1.core.$strict>;\n when: z$1.ZodObject<{\n all: z$1.ZodArray>;\n none: z$1.ZodArray>;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>>;\n keybindingOverrides: z$1.ZodArray;\n shortcut: z$1.ZodNullable>;\n }, z$1.core.$strict>>;\n experiments: z$1.ZodObject<{\n claudeCodeMockCliTraffic: z$1.ZodBoolean;\n threadSplits: z$1.ZodBoolean;\n plugins: z$1.ZodBoolean;\n }, z$1.core.$strip>;\n appearance: z$1.ZodObject<{\n themeId: z$1.ZodString;\n customCss: z$1.ZodNullable;\n faviconColor: z$1.ZodEnum<{\n default: \"default\";\n red: \"red\";\n orange: \"orange\";\n yellow: \"yellow\";\n green: \"green\";\n teal: \"teal\";\n blue: \"blue\";\n purple: \"purple\";\n pink: \"pink\";\n }>;\n }, z$1.core.$strip>;\n customThemes: z$1.ZodArray;\n pluginThemes: z$1.ZodArray;\n }, z$1.core.$strip>>;\n featureFlags: z$1.ZodObject<{\n placeholder: z$1.ZodBoolean;\n }, z$1.core.$strip>;\n hostDaemonPort: z$1.ZodNullable;\n primaryHostId: z$1.ZodNullable;\n primaryHostPlatform: z$1.ZodNullable>;\n voiceTranscriptionEnabled: z$1.ZodBoolean;\n dataDir: z$1.ZodString;\n}, z$1.core.$strip>;\ntype SystemConfigResponse = z$1.infer;\ndeclare const systemAttentionResponseSchema: z$1.ZodObject<{\n hasAttention: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype SystemAttentionResponse = z$1.infer;\n/**\n * Theme catalog: the on-disk custom-theme directory plus the discovered custom\n * themes and the active palette. Drives `bb theme list` / `bb theme dir`.\n */\ndeclare const themeCatalogResponseSchema: z$1.ZodObject<{\n dir: z$1.ZodString;\n custom: z$1.ZodArray;\n plugins: z$1.ZodArray;\n }, z$1.core.$strip>>;\n active: z$1.ZodObject<{\n themeId: z$1.ZodString;\n customCss: z$1.ZodNullable;\n faviconColor: z$1.ZodEnum<{\n default: \"default\";\n red: \"red\";\n orange: \"orange\";\n yellow: \"yellow\";\n green: \"green\";\n teal: \"teal\";\n blue: \"blue\";\n purple: \"purple\";\n pink: \"pink\";\n }>;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>;\ntype ThemeCatalogResponse = z$1.infer;\ndeclare const systemVersionResponseSchema: z$1.ZodObject<{\n currentVersion: z$1.ZodString;\n latestVersion: z$1.ZodNullable;\n source: z$1.ZodLiteral<\"npm\">;\n updateAvailable: z$1.ZodBoolean;\n isDevelopment: z$1.ZodBoolean;\n upgradeCommand: z$1.ZodString;\n}, z$1.core.$strip>;\ntype SystemVersionResponse = z$1.infer;\ndeclare const systemConfigReloadResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n}, z$1.core.$strip>;\ntype SystemConfigReloadResponse = z$1.infer;\n\ndeclare const terminalSessionSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodNullable;\n environmentId: z$1.ZodNullable;\n hostId: z$1.ZodString;\n title: z$1.ZodString;\n initialCwd: z$1.ZodString;\n cols: z$1.ZodNumber;\n rows: z$1.ZodNumber;\n status: z$1.ZodEnum<{\n starting: \"starting\";\n disconnected: \"disconnected\";\n running: \"running\";\n exited: \"exited\";\n }>;\n exitCode: z$1.ZodNullable;\n closeReason: z$1.ZodNullable>;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n lastUserInputAt: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TerminalSession = z$1.infer;\ndeclare const terminalListResponseSchema: z$1.ZodObject<{\n sessions: z$1.ZodArray;\n environmentId: z$1.ZodNullable;\n hostId: z$1.ZodString;\n title: z$1.ZodString;\n initialCwd: z$1.ZodString;\n cols: z$1.ZodNumber;\n rows: z$1.ZodNumber;\n status: z$1.ZodEnum<{\n starting: \"starting\";\n disconnected: \"disconnected\";\n running: \"running\";\n exited: \"exited\";\n }>;\n exitCode: z$1.ZodNullable;\n closeReason: z$1.ZodNullable>;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n lastUserInputAt: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype TerminalListResponse = z$1.infer;\ndeclare const createTerminalRequestSchema: z$1.ZodObject<{\n cols: z$1.ZodNumber;\n rows: z$1.ZodNumber;\n start: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n mode: z$1.ZodLiteral<\"command\">;\n command: z$1.ZodString;\n }, z$1.core.$strict>], \"mode\">>;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread\">;\n threadId: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"environment\">;\n environmentId: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"host_path\">;\n hostId: z$1.ZodString;\n cwd: z$1.ZodNullable;\n }, z$1.core.$strict>], \"kind\">;\n title: z$1.ZodOptional;\n}, z$1.core.$strict>;\ntype CreateTerminalRequest = z$1.infer;\ndeclare const updateTerminalRequestSchema: z$1.ZodObject<{\n title: z$1.ZodString;\n}, z$1.core.$strict>;\ntype UpdateTerminalRequest = z$1.infer;\ndeclare const terminalInputRequestSchema: z$1.ZodObject<{\n dataBase64: z$1.ZodString;\n}, z$1.core.$strict>;\ntype TerminalInputRequest = z$1.infer;\ndeclare const terminalResizeRequestSchema: z$1.ZodObject<{\n cols: z$1.ZodNumber;\n rows: z$1.ZodNumber;\n}, z$1.core.$strict>;\ntype TerminalResizeRequest = z$1.infer;\ndeclare const terminalOutputQuerySchema: z$1.ZodObject<{\n sinceSeq: z$1.ZodOptional>;\n tailBytes: z$1.ZodOptional>;\n limitChunks: z$1.ZodOptional>;\n}, z$1.core.$strict>;\ntype TerminalOutputQuery = z$1.infer;\ndeclare const terminalOutputResponseSchema: z$1.ZodObject<{\n chunks: z$1.ZodArray>;\n nextSeq: z$1.ZodNumber;\n truncated: z$1.ZodBoolean;\n}, z$1.core.$strict>;\ntype TerminalOutputResponse = z$1.infer;\n\ndeclare const timelineRowStatusSchema: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n}>;\ntype TimelineRowStatus = z$1.infer;\ndeclare const timelineRowBaseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype TimelineRowBase = z$1.infer;\ndeclare const timelineConversationRowSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"conversation\">;\n text: z$1.ZodString;\n attachments: z$1.ZodNullable;\n localImagePaths: z$1.ZodArray;\n localFilePaths: z$1.ZodArray;\n }, z$1.core.$strip>>;\n role: z$1.ZodLiteral<\"user\">;\n initiator: z$1.ZodEnum<{\n user: \"user\";\n agent: \"agent\";\n system: \"system\";\n }>;\n senderThreadId: z$1.ZodNullable;\n systemMessageKind: z$1.ZodEnum<{\n \"ownership-assigned\": \"ownership-assigned\";\n \"ownership-removed\": \"ownership-removed\";\n \"child-needs-attention\": \"child-needs-attention\";\n \"child-completed\": \"child-completed\";\n \"child-failed\": \"child-failed\";\n \"child-interrupted\": \"child-interrupted\";\n \"child-outcome-batch\": \"child-outcome-batch\";\n unlabeled: \"unlabeled\";\n }>;\n systemMessageSubject: z$1.ZodNullable;\n threadId: z$1.ZodString;\n threadName: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread-batch\">;\n count: z$1.ZodNumber;\n }, z$1.core.$strip>], \"kind\">>;\n turnRequest: z$1.ZodObject<{\n kind: z$1.ZodEnum<{\n message: \"message\";\n steer: \"steer\";\n }>;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n accepted: \"accepted\";\n }>;\n }, z$1.core.$strip>;\n mentions: z$1.ZodArray;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"conversation\">;\n text: z$1.ZodString;\n attachments: z$1.ZodNullable;\n localImagePaths: z$1.ZodArray;\n localFilePaths: z$1.ZodArray;\n }, z$1.core.$strip>>;\n role: z$1.ZodLiteral<\"assistant\">;\n turnRequest: z$1.ZodNull;\n}, z$1.core.$strip>], \"role\">;\ntype TimelineConversationRow = z$1.infer;\ndeclare const timelineSystemRowSchema: z$1.ZodUnion;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"system\">;\n title: z$1.ZodString;\n detail: z$1.ZodNullable;\n status: z$1.ZodNullable>;\n systemKind: z$1.ZodEnum<{\n error: \"error\";\n debug: \"debug\";\n reconnect: \"reconnect\";\n }>;\n}, z$1.core.$strip>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"system\">;\n title: z$1.ZodString;\n detail: z$1.ZodNullable;\n status: z$1.ZodNullable>;\n systemKind: z$1.ZodLiteral<\"operation\">;\n operationKind: z$1.ZodEnum<{\n generic: \"generic\";\n compaction: \"compaction\";\n \"thread-provisioning\": \"thread-provisioning\";\n \"thread-interrupted\": \"thread-interrupted\";\n \"provider-unhandled\": \"provider-unhandled\";\n warning: \"warning\";\n deprecation: \"deprecation\";\n }>;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>, z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"system\">;\n title: z$1.ZodString;\n detail: z$1.ZodNullable;\n systemKind: z$1.ZodLiteral<\"operation\">;\n operationKind: z$1.ZodLiteral<\"parent-change\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n parentChange: z$1.ZodObject<{\n action: z$1.ZodEnum<{\n assign: \"assign\";\n release: \"release\";\n transfer: \"transfer\";\n }>;\n previousParentThreadId: z$1.ZodNullable;\n previousParentThreadTitle: z$1.ZodNullable;\n nextParentThreadId: z$1.ZodNullable;\n nextParentThreadTitle: z$1.ZodNullable;\n }, z$1.core.$strip>;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>], \"operationKind\">]>;\ntype TimelineSystemRow = z$1.infer;\ninterface TimelineWorkRowBase extends TimelineRowBase {\n kind: \"work\";\n status: TimelineRowStatus;\n}\ndeclare const timelineCommandWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"command\">;\n callId: z$1.ZodString;\n command: z$1.ZodString;\n cwd: z$1.ZodNullable;\n source: z$1.ZodNullable;\n output: z$1.ZodString;\n exitCode: z$1.ZodNullable;\n completedAt: z$1.ZodNullable;\n approvalStatus: z$1.ZodNullable>;\n activityIntents: z$1.ZodArray;\n command: z$1.ZodString;\n name: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"list_files\">;\n command: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"search\">;\n command: z$1.ZodString;\n query: z$1.ZodNullable;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"unknown\">;\n command: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n}, z$1.core.$strip>;\ntype TimelineCommandWorkRow = z$1.infer;\ndeclare const timelineToolWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"tool\">;\n callId: z$1.ZodString;\n toolName: z$1.ZodString;\n toolArgs: z$1.ZodNullable>>>;\n output: z$1.ZodString;\n completedAt: z$1.ZodNullable;\n approvalStatus: z$1.ZodNullable>;\n activityIntents: z$1.ZodArray;\n command: z$1.ZodString;\n name: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"list_files\">;\n command: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"search\">;\n command: z$1.ZodString;\n query: z$1.ZodNullable;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"unknown\">;\n command: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n}, z$1.core.$strip>;\ntype TimelineToolWorkRow = z$1.infer;\ndeclare const timelineFileChangeWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"file-change\">;\n callId: z$1.ZodString;\n change: z$1.ZodObject<{\n path: z$1.ZodString;\n kind: z$1.ZodNullable;\n movePath: z$1.ZodNullable;\n diff: z$1.ZodNullable;\n diffStats: z$1.ZodObject<{\n added: z$1.ZodNumber;\n removed: z$1.ZodNumber;\n }, z$1.core.$strip>;\n }, z$1.core.$strip>;\n stdout: z$1.ZodNullable;\n stderr: z$1.ZodNullable;\n approvalStatus: z$1.ZodNullable>;\n}, z$1.core.$strip>;\ntype TimelineFileChangeWorkRow = z$1.infer;\ndeclare const timelineWebSearchWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"web-search\">;\n callId: z$1.ZodString;\n queries: z$1.ZodArray;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TimelineWebSearchWorkRow = z$1.infer;\ndeclare const timelineWebFetchWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"web-fetch\">;\n callId: z$1.ZodString;\n url: z$1.ZodString;\n prompt: z$1.ZodNullable;\n pattern: z$1.ZodNullable;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TimelineWebFetchWorkRow = z$1.infer;\ndeclare const timelineImageViewWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"image-view\">;\n callId: z$1.ZodString;\n path: z$1.ZodString;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TimelineImageViewWorkRow = z$1.infer;\ndeclare const timelineApprovalWorkRowSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"approval\">;\n interactionId: z$1.ZodString;\n target: z$1.ZodObject<{\n itemId: z$1.ZodString;\n toolName: z$1.ZodNullable;\n }, z$1.core.$strip>;\n approvalKind: z$1.ZodLiteral<\"file-edit\">;\n lifecycle: z$1.ZodEnum<{\n denied: \"denied\";\n waiting: \"waiting\";\n }>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"approval\">;\n interactionId: z$1.ZodString;\n target: z$1.ZodObject<{\n itemId: z$1.ZodString;\n toolName: z$1.ZodNullable;\n }, z$1.core.$strip>;\n approvalKind: z$1.ZodLiteral<\"permission-grant\">;\n lifecycle: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n denied: \"denied\";\n resolving: \"resolving\";\n granted: \"granted\";\n }>;\n grantScope: z$1.ZodNullable>;\n statusReason: z$1.ZodNullable;\n}, z$1.core.$strip>], \"approvalKind\">;\ntype TimelineApprovalWorkRow = z$1.infer;\ndeclare const timelineQuestionWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"question\">;\n interactionId: z$1.ZodString;\n lifecycle: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n answered: \"answered\";\n }>;\n questions: z$1.ZodArray;\n multiSelect: z$1.ZodBoolean;\n options: z$1.ZodOptional;\n }, z$1.core.$strip>>>;\n allowFreeText: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n answers: z$1.ZodNullable;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>>;\n statusReason: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TimelineQuestionWorkRow = z$1.infer;\ninterface TimelineDelegationWorkRow extends TimelineWorkRowBase {\n workKind: \"delegation\";\n callId: string;\n toolName: string;\n subagentType: string | null;\n description: string | null;\n output: string;\n completedAt: number | null;\n childRows: TimelineRow[];\n}\n/**\n * A provider background task — a dynamic workflow (Claude Code Workflow tool)\n * or a backgrounded shell command (Bash run_in_background), discriminated by\n * `taskType`. The row outlives its spawning turn: progress and terminal state\n * arrive via thread-scoped events folded into this single row. `workflow` is\n * the merged phase/agent tree, present only for workflows; null for shell\n * commands and for workflows the provider reported no progress records for\n * (degraded rendering falls back to description + summary).\n */\ndeclare const timelineWorkflowWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"workflow\">;\n itemId: z$1.ZodString;\n taskType: z$1.ZodString;\n workflowName: z$1.ZodNullable;\n description: z$1.ZodString;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n running: \"running\";\n paused: \"paused\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n workflow: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodNullable>;\n summary: z$1.ZodNullable;\n error: z$1.ZodNullable;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TimelineWorkflowWorkRow = z$1.infer;\ntype TimelineWorkRow = TimelineCommandWorkRow | TimelineToolWorkRow | TimelineFileChangeWorkRow | TimelineWebSearchWorkRow | TimelineWebFetchWorkRow | TimelineImageViewWorkRow | TimelineApprovalWorkRow | TimelineQuestionWorkRow | TimelineDelegationWorkRow | TimelineWorkflowWorkRow;\ninterface TimelineTurnRow extends TimelineRowBase {\n kind: \"turn\";\n turnId: string;\n status: TimelineRowStatus;\n summaryCount: number;\n completedAt: number | null;\n children: TimelineRow[] | null;\n}\ntype TimelineSourceRow = TimelineConversationRow | TimelineWorkRow | TimelineSystemRow;\ntype TimelineRow = TimelineSourceRow | TimelineTurnRow;\n\ndeclare const createThreadRequestSchema: z$1.ZodObject<{\n projectId: z$1.ZodString;\n providerId: z$1.ZodOptional;\n origin: z$1.ZodEnum<{\n plugin: \"plugin\";\n app: \"app\";\n cli: \"cli\";\n sdk: \"sdk\";\n }>;\n originPluginId: z$1.ZodOptional;\n visibility: z$1.ZodOptional>;\n title: z$1.ZodOptional;\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodOptional;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n executionInputSources: z$1.ZodOptional>;\n model: z$1.ZodOptional>;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n environment: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"reuse\">;\n environmentId: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host\">;\n hostId: z$1.ZodOptional;\n workspace: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"unmanaged\">;\n path: z$1.ZodNullable;\n branch: z$1.ZodOptional;\n name: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"new\">;\n baseBranch: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"managed-worktree\">;\n baseBranch: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"named\">;\n name: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"default\">;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"personal\">;\n }, z$1.core.$strip>], \"type\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"project-default\">;\n }, z$1.core.$strip>], \"type\">;\n parentThreadId: z$1.ZodOptional;\n folderId: z$1.ZodOptional>;\n sourceThreadId: z$1.ZodOptional;\n sourceSeqEnd: z$1.ZodOptional;\n startedOnBehalfOf: z$1.ZodDefault;\n senderThreadId: z$1.ZodString;\n }, z$1.core.$strip>>>;\n originKind: z$1.ZodDefault>>;\n childOrigin: z$1.ZodDefault>>;\n}, z$1.core.$strip>;\ntype CreateThreadRequest = z$1.infer;\ndeclare const sendMessageRequestSchema: z$1.ZodObject<{\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodOptional;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n executionInputSources: z$1.ZodOptional>;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n mode: z$1.ZodEnum<{\n steer: \"steer\";\n start: \"start\";\n auto: \"auto\";\n \"queue-if-active\": \"queue-if-active\";\n \"steer-if-active\": \"steer-if-active\";\n }>;\n senderThreadId: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype SendMessageRequest = z$1.infer;\ndeclare const createQueuedMessageRequestSchema: z$1.ZodObject<{\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodOptional;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n executionInputSources: z$1.ZodOptional>;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n senderThreadId: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype CreateQueuedMessageRequest = z$1.infer;\ndeclare const sendQueuedMessageRequestSchema: z$1.ZodObject<{\n mode: z$1.ZodEnum<{\n steer: \"steer\";\n auto: \"auto\";\n }>;\n}, z$1.core.$strip>;\ntype SendQueuedMessageRequest = z$1.infer;\ndeclare const reorderQueuedMessageRequestSchema: z$1.ZodObject<{\n previousQueuedMessageId: z$1.ZodNullable;\n nextQueuedMessageId: z$1.ZodNullable;\n groupBoundaryQueuedMessageId: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ReorderQueuedMessageRequest = z$1.infer;\ndeclare const setQueuedMessageGroupBoundaryRequestSchema: z$1.ZodObject<{\n expectedGroupedPrefixQueuedMessageIds: z$1.ZodArray;\n groupBoundaryQueuedMessageId: z$1.ZodString;\n}, z$1.core.$strip>;\ntype SetQueuedMessageGroupBoundaryRequest = z$1.infer;\ndeclare const sendQueuedMessageResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n queuedMessage: z$1.ZodObject<{\n id: z$1.ZodString;\n content: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodString;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n groupWithNext: z$1.ZodBoolean;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>;\ntype SendQueuedMessageResponse = z$1.infer;\ndeclare const threadListResponseSchema: z$1.ZodArray;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n activity: z$1.ZodObject<{\n activeWorkflowCount: z$1.ZodNumber;\n activeBackgroundAgentCount: z$1.ZodNumber;\n activeBackgroundCommandCount: z$1.ZodNumber;\n activePlanModeCount: z$1.ZodNumber;\n activeGoalCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n pinSortKey: z$1.ZodNullable;\n hasPendingInteraction: z$1.ZodBoolean;\n environmentHostId: z$1.ZodNullable;\n environmentName: z$1.ZodNullable;\n environmentBranchName: z$1.ZodNullable;\n environmentWorkspaceDisplayKind: z$1.ZodEnum<{\n \"managed-worktree\": \"managed-worktree\";\n \"unmanaged-worktree\": \"unmanaged-worktree\";\n other: \"other\";\n }>;\n}, z$1.core.$strip>>;\ntype ThreadListResponse = z$1.infer;\ndeclare const threadSearchResponseSchema: z$1.ZodObject<{\n active: z$1.ZodObject<{\n total: z$1.ZodNumber;\n results: z$1.ZodArray;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n activity: z$1.ZodObject<{\n activeWorkflowCount: z$1.ZodNumber;\n activeBackgroundAgentCount: z$1.ZodNumber;\n activeBackgroundCommandCount: z$1.ZodNumber;\n activePlanModeCount: z$1.ZodNumber;\n activeGoalCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n pinSortKey: z$1.ZodNullable;\n hasPendingInteraction: z$1.ZodBoolean;\n environmentHostId: z$1.ZodNullable;\n environmentName: z$1.ZodNullable;\n environmentBranchName: z$1.ZodNullable;\n environmentWorkspaceDisplayKind: z$1.ZodEnum<{\n \"managed-worktree\": \"managed-worktree\";\n \"unmanaged-worktree\": \"unmanaged-worktree\";\n other: \"other\";\n }>;\n }, z$1.core.$strip>;\n matches: z$1.ZodArray;\n text: z$1.ZodString;\n highlightRanges: z$1.ZodArray>;\n sourceSeq: z$1.ZodNullable;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>;\n archived: z$1.ZodObject<{\n total: z$1.ZodNumber;\n results: z$1.ZodArray;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n activity: z$1.ZodObject<{\n activeWorkflowCount: z$1.ZodNumber;\n activeBackgroundAgentCount: z$1.ZodNumber;\n activeBackgroundCommandCount: z$1.ZodNumber;\n activePlanModeCount: z$1.ZodNumber;\n activeGoalCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n pinSortKey: z$1.ZodNullable;\n hasPendingInteraction: z$1.ZodBoolean;\n environmentHostId: z$1.ZodNullable;\n environmentName: z$1.ZodNullable;\n environmentBranchName: z$1.ZodNullable;\n environmentWorkspaceDisplayKind: z$1.ZodEnum<{\n \"managed-worktree\": \"managed-worktree\";\n \"unmanaged-worktree\": \"unmanaged-worktree\";\n other: \"other\";\n }>;\n }, z$1.core.$strip>;\n matches: z$1.ZodArray;\n text: z$1.ZodString;\n highlightRanges: z$1.ZodArray>;\n sourceSeq: z$1.ZodNullable;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>;\ntype ThreadSearchResponse = z$1.infer;\ndeclare const threadResponseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n projectId: z$1.ZodString;\n environmentId: z$1.ZodNullable;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n canSpawnChild: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype ThreadResponse = z$1.infer;\ndeclare const threadGetQuerySchema: z$1.ZodObject<{\n include: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ThreadGetQuery = z$1.infer;\ndeclare const threadWithIncludesResponseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n projectId: z$1.ZodString;\n environmentId: z$1.ZodNullable;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n canSpawnChild: z$1.ZodBoolean;\n environment: z$1.ZodOptional;\n projectId: z$1.ZodString;\n hostId: z$1.ZodString;\n path: z$1.ZodNullable;\n managed: z$1.ZodBoolean;\n isGitRepo: z$1.ZodBoolean;\n isWorktree: z$1.ZodBoolean;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n branchName: z$1.ZodNullable;\n baseBranch: z$1.ZodNullable;\n defaultBranch: z$1.ZodNullable;\n mergeBaseBranch: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n ready: \"ready\";\n retiring: \"retiring\";\n destroying: \"destroying\";\n destroyed: \"destroyed\";\n }>;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n }, z$1.core.$strip>>>;\n host: z$1.ZodOptional;\n status: z$1.ZodEnum<{\n disconnected: \"disconnected\";\n connected: \"connected\";\n }>;\n lastSeenAt: z$1.ZodNullable;\n lastRejectedProtocolVersion: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n }, z$1.core.$strip>>>;\n}, z$1.core.$strip>;\ntype ThreadWithIncludesResponse = z$1.infer;\ndeclare const threadPendingInteractionsResponseSchema: z$1.ZodArray;\n statusReason: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n expiresAt: z$1.ZodOptional>;\n resolvedAt: z$1.ZodNullable;\n turnId: z$1.ZodString;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n origin: z$1.ZodOptional;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n }, z$1.core.$strip>>;\n payload: z$1.ZodUnion;\n subject: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n itemId: z$1.ZodString;\n command: z$1.ZodString;\n cwd: z$1.ZodNullable;\n actions: z$1.ZodArray;\n command: z$1.ZodString;\n name: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"listFiles\">;\n command: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"search\">;\n command: z$1.ZodString;\n query: z$1.ZodNullable;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"unknown\">;\n command: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n sessionGrant: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"file_change\">;\n itemId: z$1.ZodString;\n writeScope: z$1.ZodNullable;\n sessionGrant: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"permission_grant\">;\n itemId: z$1.ZodString;\n toolName: z$1.ZodNullable;\n permissions: z$1.ZodObject<{\n network: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>;\n }, z$1.core.$strip>], \"kind\">;\n reason: z$1.ZodNullable;\n availableDecisions: z$1.ZodArray>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_question\">;\n questions: z$1.ZodArray;\n multiSelect: z$1.ZodBoolean;\n options: z$1.ZodOptional;\n }, z$1.core.$strip>>>;\n allowFreeText: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>]>;\n resolution: z$1.ZodNullable;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"allow_for_session\">;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"deny\">;\n }, z$1.core.$strip>], \"decision\">, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_answer\">;\n answers: z$1.ZodRecord;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>]>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n resolved: \"resolved\";\n }>;\n statusReason: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n expiresAt: z$1.ZodOptional>;\n resolvedAt: z$1.ZodNullable;\n turnId: z$1.ZodNullable;\n origin: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n rendererId: z$1.ZodString;\n }, z$1.core.$strip>;\n payload: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n title: z$1.ZodString;\n data: z$1.ZodType>;\n }, z$1.core.$strip>;\n resolution: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>]>>;\ntype ThreadPendingInteractionsResponse = z$1.infer;\ndeclare const threadQueuedMessageListResponseSchema: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodString;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n groupWithNext: z$1.ZodBoolean;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n}, z$1.core.$strip>>;\ntype ThreadQueuedMessageListResponse = z$1.infer;\ndeclare const threadChildSummaryResponseSchema: z$1.ZodObject<{\n nonDeletedChildCount: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype ThreadChildSummaryResponse = z$1.infer;\ndeclare const deleteThreadRequestSchema: z$1.ZodObject<{\n childThreadsConfirmed: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype DeleteThreadRequest = z$1.infer;\ndeclare const updateThreadRequestSchema: z$1.ZodObject<{\n title: z$1.ZodOptional>;\n folderId: z$1.ZodOptional>;\n parentThreadId: z$1.ZodOptional>;\n model: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>>;\n}, z$1.core.$strip>;\ntype UpdateThreadRequest = z$1.infer;\ndeclare const reorderPinnedThreadRequestSchema: z$1.ZodObject<{\n previousThreadId: z$1.ZodNullable;\n nextThreadId: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype ReorderPinnedThreadRequest = z$1.infer;\n/**\n * Requested placement for a thread opened in the app's split layout. Edge\n * placements add panes through the eighth pane; at the cap they replace the\n * focused pane. `replace` always replaces the focused pane.\n */\ndeclare const threadOpenSplitSchema: z$1.ZodEnum<{\n right: \"right\";\n down: \"down\";\n left: \"left\";\n top: \"top\";\n replace: \"replace\";\n}>;\ntype ThreadOpenSplit = z$1.infer;\n/** Optional secondary-panel file to open with a thread. */\ndeclare const threadOpenFileSchema: z$1.ZodObject<{\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n path: z$1.ZodString;\n lineNumber: z$1.ZodNullable;\n}, z$1.core.$strict>;\ntype ThreadOpenFile = z$1.infer;\n/** Response for POST /threads/:id/open: how many connected clients received it. */\ndeclare const threadOpenResponseSchema: z$1.ZodObject<{\n delivered: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype ThreadOpenResponse = z$1.infer;\ndeclare const threadArchiveAllResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n archivedThreadIds: z$1.ZodArray;\n}, z$1.core.$strip>;\ntype ThreadArchiveAllResponse = z$1.infer;\ndeclare const threadListQuerySchema: z$1.ZodObject<{\n projectId: z$1.ZodOptional;\n parentThreadId: z$1.ZodOptional;\n sourceThreadId: z$1.ZodOptional;\n archived: z$1.ZodOptional>;\n folderId: z$1.ZodOptional;\n unfiled: z$1.ZodOptional>;\n hasParent: z$1.ZodOptional>;\n originKind: z$1.ZodOptional>;\n excludeSideChats: z$1.ZodOptional>;\n childOrigin: z$1.ZodOptional>;\n limit: z$1.ZodOptional;\n offset: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ThreadListQuery = z$1.infer;\ndeclare const threadSearchQuerySchema: z$1.ZodObject<{\n query: z$1.ZodString;\n limitPerGroup: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ThreadSearchQuery = z$1.infer;\ndeclare const threadTimelineQuerySchema: z$1.ZodObject<{\n includeNestedRows: z$1.ZodOptional>;\n segmentLimit: z$1.ZodOptional;\n beforeAnchorSeq: z$1.ZodOptional;\n beforeAnchorId: z$1.ZodOptional;\n summaryOnly: z$1.ZodOptional>;\n afterSequence: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ThreadTimelineQuery = z$1.infer;\ndeclare const timelineTurnSummaryDetailsQuerySchema: z$1.ZodObject<{\n turnId: z$1.ZodString;\n sourceSeqStart: z$1.ZodString;\n sourceSeqEnd: z$1.ZodString;\n}, z$1.core.$strip>;\ntype TimelineTurnSummaryDetailsQuery = z$1.infer;\ndeclare const threadStorageFilesQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional;\n limit: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ThreadStorageFilesQuery = z$1.infer;\ndeclare const threadStoragePathsQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional;\n limit: z$1.ZodOptional;\n includeFiles: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n includeDirectories: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n}, z$1.core.$strip>;\ntype ThreadStoragePathsQuery = z$1.infer;\ndeclare const timelineTurnSummaryDetailsResponseSchema: z$1.ZodObject<{\n rows: z$1.ZodArray>>;\n}, z$1.core.$strip>;\ntype TimelineTurnSummaryDetailsResponse = z$1.infer;\ndeclare const threadTimelineResponseSchema: z$1.ZodObject<{\n rows: z$1.ZodArray>>;\n activePromptMode: z$1.ZodNullable;\n providerId: z$1.ZodEnum<{\n codex: \"codex\";\n \"claude-code\": \"claude-code\";\n }>;\n prompt: z$1.ZodString;\n }, z$1.core.$strict>>;\n activeThinking: z$1.ZodNullable>;\n activeWorkflow: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"workflow\">;\n itemId: z$1.ZodString;\n taskType: z$1.ZodString;\n workflowName: z$1.ZodNullable;\n description: z$1.ZodString;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n running: \"running\";\n paused: \"paused\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n workflow: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodNullable>;\n summary: z$1.ZodNullable;\n error: z$1.ZodNullable;\n completedAt: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n activeBackgroundCommands: z$1.ZodArray;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"workflow\">;\n itemId: z$1.ZodString;\n taskType: z$1.ZodString;\n workflowName: z$1.ZodNullable;\n description: z$1.ZodString;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n running: \"running\";\n paused: \"paused\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n workflow: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodNullable>;\n summary: z$1.ZodNullable;\n error: z$1.ZodNullable;\n completedAt: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n pendingTodos: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n goal: z$1.ZodNullable;\n tokenBudget: z$1.ZodNullable;\n tokensUsed: z$1.ZodNumber;\n timeUsedSeconds: z$1.ZodNumber;\n }, z$1.core.$strip>>;\n modelFallback: z$1.ZodNullable;\n message: z$1.ZodString;\n }, z$1.core.$strip>>;\n contextWindowUsage: z$1.ZodOptional>;\n timelinePage: z$1.ZodObject<{\n kind: z$1.ZodEnum<{\n latest: \"latest\";\n older: \"older\";\n }>;\n segmentLimit: z$1.ZodNumber;\n returnedSegmentCount: z$1.ZodNumber;\n hasOlderRows: z$1.ZodBoolean;\n olderCursor: z$1.ZodNullable>;\n }, z$1.core.$strict>;\n maxSeq: z$1.ZodNumber;\n delta: z$1.ZodOptional>>;\n rowOrder: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype ThreadTimelineResponse = z$1.infer;\ndeclare const threadConversationOutlineResponseSchema: z$1.ZodObject<{\n items: z$1.ZodArray;\n preview: z$1.ZodString;\n attachmentSummary: z$1.ZodNullable>;\n }, z$1.core.$strict>>;\n maxSeq: z$1.ZodNumber;\n}, z$1.core.$strict>;\ntype ThreadConversationOutlineResponse = z$1.infer;\ndeclare const threadStorageFileListResponseSchema: z$1.ZodObject<{\n files: z$1.ZodArray>;\n truncated: z$1.ZodBoolean;\n storageRootPath: z$1.ZodString;\n}, z$1.core.$strip>;\ntype ThreadStorageFileListResponse = z$1.infer;\ndeclare const threadStoragePathListResponseSchema: z$1.ZodObject<{\n paths: z$1.ZodArray;\n path: z$1.ZodString;\n name: z$1.ZodString;\n score: z$1.ZodNumber;\n positions: z$1.ZodArray;\n }, z$1.core.$strip>>;\n truncated: z$1.ZodBoolean;\n storageRootPath: z$1.ZodString;\n}, z$1.core.$strip>;\ntype ThreadStoragePathListResponse = z$1.infer;\n\ndeclare const threadTabsResponseSchema: z$1.ZodObject<{\n revision: z$1.ZodNumber;\n tabs: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"git-diff\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n actionId: z$1.ZodString;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"plugin-panel\">;\n paramsJson: z$1.ZodNullable;\n pluginId: z$1.ZodString;\n title: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"workspace-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n projectId: z$1.ZodNullable;\n source: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"working-tree\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"head\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"merge-base\">;\n ref: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">;\n statusLabel: z$1.ZodNullable>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"host-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n threadId: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n isPinned: z$1.ZodBoolean;\n kind: z$1.ZodLiteral<\"thread-storage-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n threadId: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"browser\">;\n title: z$1.ZodNullable;\n url: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"new-tab\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"side-chat\">;\n sourceMessageText: z$1.ZodString;\n sourceSeqEnd: z$1.ZodNullable;\n threadId: z$1.ZodNullable;\n title: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"terminal\">;\n terminalId: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n}, z$1.core.$strict>;\ntype ThreadTabsResponse = z$1.infer;\ndeclare const updateThreadTabsRequestSchema: z$1.ZodObject<{\n expectedRevision: z$1.ZodNumber;\n tabs: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"git-diff\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n actionId: z$1.ZodString;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"plugin-panel\">;\n paramsJson: z$1.ZodNullable;\n pluginId: z$1.ZodString;\n title: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"workspace-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n projectId: z$1.ZodNullable;\n source: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"working-tree\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"head\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"merge-base\">;\n ref: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">;\n statusLabel: z$1.ZodNullable>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"host-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n threadId: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n isPinned: z$1.ZodBoolean;\n kind: z$1.ZodLiteral<\"thread-storage-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n threadId: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"browser\">;\n title: z$1.ZodNullable;\n url: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"new-tab\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"side-chat\">;\n sourceMessageText: z$1.ZodString;\n sourceSeqEnd: z$1.ZodNullable;\n threadId: z$1.ZodNullable;\n title: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"terminal\">;\n terminalId: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n}, z$1.core.$strict>;\ntype UpdateThreadTabsRequest = z$1.infer;\n\ninterface EnvironmentGetArgs {\n environmentId: string;\n}\ntype EnvironmentMergeBaseBranchUpdateValue = Exclude;\ntype EnvironmentNameUpdateValue = Exclude;\ninterface EnvironmentMergeBaseBranchUpdate {\n mergeBaseBranch: EnvironmentMergeBaseBranchUpdateValue;\n name?: EnvironmentNameUpdateValue;\n}\ninterface EnvironmentNameUpdate {\n mergeBaseBranch?: EnvironmentMergeBaseBranchUpdateValue;\n name: EnvironmentNameUpdateValue;\n}\ntype EnvironmentUpdateFields = EnvironmentMergeBaseBranchUpdate | EnvironmentNameUpdate;\ntype EnvironmentUpdateArgs = EnvironmentUpdateFields & {\n environmentId: string;\n};\ninterface EnvironmentStatusArgs extends EnvironmentStatusQuery {\n environmentId: string;\n}\ntype EnvironmentDiffArgs = EnvironmentDiffQuery & {\n environmentId: string;\n};\ntype EnvironmentDiffFileArgs = EnvironmentDiffFileQuery & {\n environmentId: string;\n};\ninterface EnvironmentDiffBranchesArgs extends EnvironmentDiffBranchesQuery {\n environmentId: string;\n}\ninterface EnvironmentCommitArgs {\n environmentId: string;\n}\ninterface EnvironmentSquashMergeArgs {\n environmentId: string;\n mergeBaseBranch: string;\n}\ninterface EnvironmentPullRequestMergeArgs {\n environmentId: string;\n method: PullRequestMergeMethod;\n}\ntype EnvironmentDiffPatchArgs = EnvironmentDiffPatchRequest & {\n environmentId: string;\n};\ninterface EnvironmentPathsArgs extends EnvironmentPathsQuery {\n environmentId: string;\n}\ntype EnvironmentArchiveThreadsResult = EnvironmentArchiveThreadsResponse;\ntype EnvironmentCommitResult = CommitActionResponse;\ntype EnvironmentDiffResult = EnvironmentDiffResponse;\ntype EnvironmentDiffBranchesResult = EnvironmentDiffBranchesResponse;\ntype EnvironmentDiffFileResult = EnvironmentDiffFileResponse;\ntype EnvironmentDiffFilesResult = EnvironmentDiffFilesResponse;\ntype EnvironmentDiffPatchResult = EnvironmentDiffPatchResponse;\ntype EnvironmentGetResult = Environment;\ntype EnvironmentMarkPullRequestDraftResult = PullRequestDraftActionResponse;\ntype EnvironmentMarkPullRequestReadyResult = PullRequestReadyActionResponse;\ntype EnvironmentMergePullRequestResult = PullRequestMergeActionResponse;\ntype EnvironmentPathsResult = WorkspacePathListResponse;\ntype EnvironmentPullRequestResult = EnvironmentPullRequestResponse;\ntype EnvironmentSquashMergeResult = SquashMergeActionResponse;\ntype EnvironmentStatusResult = EnvironmentStatusResponse;\ntype EnvironmentUpdateResult = Environment;\ninterface EnvironmentsArea {\n archiveThreads(args: EnvironmentGetArgs): Promise;\n commit(args: EnvironmentCommitArgs): Promise;\n diff(args: EnvironmentDiffArgs): Promise;\n diffBranches(args: EnvironmentDiffBranchesArgs): Promise;\n diffFile(args: EnvironmentDiffFileArgs): Promise;\n diffFiles(args: EnvironmentDiffArgs): Promise;\n diffPatch(args: EnvironmentDiffPatchArgs): Promise;\n get(args: EnvironmentGetArgs): Promise;\n pullRequest(args: EnvironmentGetArgs): Promise;\n markPullRequestDraft(args: EnvironmentGetArgs): Promise;\n markPullRequestReady(args: EnvironmentGetArgs): Promise;\n mergePullRequest(args: EnvironmentPullRequestMergeArgs): Promise;\n paths(args: EnvironmentPathsArgs): Promise;\n squashMerge(args: EnvironmentSquashMergeArgs): Promise;\n status(args: EnvironmentStatusArgs): Promise;\n update(args: EnvironmentUpdateArgs): Promise;\n}\n\n/**\n * Host file primitives. `hostId` may be omitted to target the server's\n * primary (local) host. `rootPath`, when set, confines the target beneath\n * that absolute root on the host (symlink-safe).\n */\ninterface FileReadArgs {\n hostId?: string;\n path: string;\n rootPath?: string;\n}\ninterface FileWriteArgs {\n hostId?: string;\n path: string;\n rootPath?: string;\n content: string;\n /** Defaults to \"utf8\". */\n contentEncoding?: \"utf8\" | \"base64\";\n /** Defaults to false. */\n createParents?: boolean;\n /**\n * Optimistic-concurrency guard: omitted → unconditional write; a hash →\n * write only when the current content hashes to it (use `read().sha256`);\n * null → create-only. A failed guard resolves to the `conflict` outcome.\n */\n expectedSha256?: string | null;\n /** POSIX permission bits used when creating a file (for example 0o600). */\n mode?: number;\n}\ninterface FileListArgs {\n hostId?: string;\n path: string;\n query?: string;\n limit?: number;\n}\ninterface PathListArgs extends FileListArgs {\n includeFiles: boolean;\n includeDirectories: boolean;\n}\ninterface FileMkdirArgs {\n hostId?: string;\n path: string;\n rootPath?: string;\n recursive?: boolean;\n}\ninterface FileMoveArgs {\n hostId?: string;\n sourcePath: string;\n destinationPath: string;\n rootPath?: string;\n}\ninterface FileRemoveArgs {\n hostId?: string;\n path: string;\n rootPath?: string;\n recursive?: boolean;\n}\ninterface FilePreviewArgs {\n hostId?: string;\n rootPath: string;\n ttlMs?: number;\n}\ntype FileReadResult = HostFileReadResponse;\ntype FileWriteResult = HostFileWriteResponse;\ntype FileListResult = HostFileListResponse;\ntype PathListResult = HostPathListResponse;\ntype FileMkdirResult = HostMkdirResponse;\ntype FileMoveResult = HostMovePathResponse;\ntype FileRemoveResult = HostRemovePathResponse;\ntype FilePreviewResult = CreateFilePreviewResponse;\ninterface FilesArea {\n read(args: FileReadArgs): Promise;\n write(args: FileWriteArgs): Promise;\n list(args: FileListArgs): Promise;\n listPaths(args: PathListArgs): Promise;\n mkdir(args: FileMkdirArgs): Promise;\n move(args: FileMoveArgs): Promise;\n remove(args: FileRemoveArgs): Promise;\n createPreview(args: FilePreviewArgs): Promise;\n}\n\ninterface GuideRenderArgs {\n chapter?: string;\n}\ninterface GuideRenderResult {\n chapter?: string;\n content: string;\n}\ninterface GuideArea {\n render(args?: GuideRenderArgs): GuideRenderResult;\n}\n\ninterface HostGetArgs {\n hostId: string;\n}\ninterface HostUpdateArgs extends UpdateHostRequest {\n hostId: string;\n}\ninterface HostDirectoryArgs extends HostDirectoryQuery {\n hostId: string;\n}\ninterface HostCloneDefaultPathArgs extends HostCloneDefaultPathQuery {\n hostId: string;\n}\ninterface HostPathsExistArgs extends HostPathsExistRequest {\n hostId: string;\n}\ninterface HostPickFolderArgs extends HostPickFolderRequest {\n hostId: string;\n}\ninterface HostProviderCliInstallArgs extends HostProviderCliInstallRequest {\n hostId: string;\n}\ntype HostCreateJoinCodeResult = CreateHostJoinCodeResponse;\ntype HostDeleteResult = {\n ok: true;\n};\ntype HostDirectoryResult = HostDirectoryListing;\ntype HostGetResult = Host;\ntype HostCloneDefaultPathResult = HostCloneDefaultPathResponse;\ntype HostProviderCliInstallResult = HostProviderCliInstallEvent[];\ntype HostListResult = Host[];\ntype HostPathsExistResult = HostPathsExistResponse;\ntype HostPickFolderResult = HostPickFolderResponse;\ntype HostProviderCliStatusResult = HostProviderCliStatusResponse;\ntype HostUpdateResult = Host;\ninterface HostsArea {\n createJoinCode(): Promise;\n delete(args: HostGetArgs): Promise;\n directory(args: HostDirectoryArgs): Promise;\n get(args: HostGetArgs): Promise;\n cloneDefaultPath(args: HostCloneDefaultPathArgs): Promise;\n installProviderCli(args: HostProviderCliInstallArgs): Promise;\n list(): Promise;\n pathsExist(args: HostPathsExistArgs): Promise;\n pickFolder(args: HostPickFolderArgs): Promise;\n providerCliStatus(args: HostGetArgs): Promise;\n update(args: HostUpdateArgs): Promise;\n}\n\ninterface ProjectListArgs {\n include?: ProjectListQuery[\"include\"];\n /** Include the singleton personal project. Defaults to false for compatibility. */\n includePersonal?: boolean;\n}\ninterface ProjectCreateArgs extends CreateProjectRequest {\n}\ninterface ProjectGetArgs {\n projectId: string;\n}\ninterface ProjectUpdateArgs extends UpdateProjectRequest {\n projectId: string;\n}\ninterface ProjectDeleteArgs {\n projectId: string;\n}\ninterface ProjectReorderArgs extends ReorderProjectRequest {\n projectId: string;\n}\ninterface ProjectPromptHistoryArgs extends PromptHistoryQuery {\n projectId: string;\n}\n/** Select one project workspace source, or omit both for the primary host. */\ntype ProjectWorkspaceRoutingArgs = {\n environmentId: string;\n hostId?: never;\n} | {\n environmentId?: never;\n hostId: string;\n} | {\n environmentId?: never;\n hostId?: never;\n};\ntype ProjectFilesArgs = ProjectWorkspaceRoutingArgs & Omit & {\n projectId: string;\n};\ntype ProjectPathsArgs = ProjectWorkspaceRoutingArgs & Omit & {\n projectId: string;\n};\ntype ProjectCommandsArgs = ProjectWorkspaceRoutingArgs & Omit & {\n projectId: string;\n};\ntype ProjectFileContentArgs = ProjectWorkspaceRoutingArgs & Omit & {\n projectId: string;\n};\ninterface ProjectBranchesArgs extends ProjectBranchesQuery {\n projectId: string;\n}\ninterface ProjectDefaultExecutionOptionsArgs {\n projectId: string;\n}\ninterface ProjectAttachmentFileLike {\n arrayBuffer(): Promise;\n readonly name: string;\n readonly type?: string;\n}\ninterface ProjectAttachmentUploadArgsBase {\n /** MIME override. Omit to use the File/Blob type, when available. */\n mimeType?: string;\n projectId: string;\n}\n/**\n * Upload bytes owned by this SDK client. A bare Blob/byte buffer needs an\n * explicit filename; File-like values can supply their own name.\n */\ntype ProjectAttachmentUploadArgs = ProjectAttachmentUploadArgsBase & ({\n clientFile: ProjectAttachmentFileLike;\n filename?: string;\n} | {\n clientFile: ArrayBuffer | Blob | Uint8Array;\n filename: string;\n});\ninterface ProjectAttachmentReadArgs {\n path: string;\n projectId: string;\n}\ntype ProjectSourceAddArgs = CreateProjectSourceRequest & {\n projectId: string;\n};\ninterface ProjectSourceUpdateArgs extends UpdateProjectSourceRequest {\n projectId: string;\n sourceId: string;\n}\ninterface ProjectSourceDeleteArgs {\n projectId: string;\n sourceId: string;\n}\ntype ProjectBranchesResult = ProjectBranchesResponse;\ninterface ProjectAttachmentReadResult {\n bytes: Uint8Array;\n mimeType: string;\n sizeBytes: number;\n}\ntype ProjectAttachmentUploadResult = UploadedPromptAttachment;\ntype ProjectCommandsResult = CommandListResponse;\ntype ProjectCreateResult = ProjectResponse;\ntype ProjectDefaultExecutionOptionsResult = ProjectExecutionDefaults | null;\ntype ProjectDeleteResult = {\n ok: true;\n};\ninterface ProjectFileContentResult {\n /** UTF-8 text or base64, as selected by `contentEncoding`. */\n content: string;\n contentEncoding: \"utf8\" | \"base64\";\n mimeType: string;\n sizeBytes: number;\n}\ntype ProjectFilesResult = WorkspaceFileListResponse;\ntype ProjectGetResult = ProjectResponse;\ntype ProjectListResult = ProjectResponse[] | ProjectWithThreadsResponse[];\ntype ProjectPathsResult = WorkspacePathListResponse;\ntype ProjectPromptHistoryResult = PromptHistoryResponse;\ntype ProjectReorderResult = ProjectResponse[];\ntype ProjectSourceAddResult = ProjectSource;\ntype ProjectSourceDeleteResult = {\n ok: true;\n};\ntype ProjectSourceUpdateResult = ProjectSource;\ntype ProjectUpdateResult = ProjectResponse;\ninterface ProjectSourcesArea {\n add(args: ProjectSourceAddArgs): Promise;\n delete(args: ProjectSourceDeleteArgs): Promise;\n update(args: ProjectSourceUpdateArgs): Promise;\n}\ninterface ProjectAttachmentsArea {\n read(args: ProjectAttachmentReadArgs): Promise;\n upload(args: ProjectAttachmentUploadArgs): Promise;\n}\ninterface ProjectsArea {\n attachments: ProjectAttachmentsArea;\n branches(args: ProjectBranchesArgs): Promise;\n commands(args: ProjectCommandsArgs): Promise;\n create(args: ProjectCreateArgs): Promise;\n defaultExecutionOptions(args: ProjectDefaultExecutionOptionsArgs): Promise;\n delete(args: ProjectDeleteArgs): Promise;\n fileContent(args: ProjectFileContentArgs): Promise;\n files(args: ProjectFilesArgs): Promise;\n get(args: ProjectGetArgs): Promise;\n list(args?: ProjectListArgs): Promise;\n paths(args: ProjectPathsArgs): Promise;\n promptHistory(args: ProjectPromptHistoryArgs): Promise;\n reorder(args: ProjectReorderArgs): Promise;\n sources: ProjectSourcesArea;\n update(args: ProjectUpdateArgs): Promise;\n}\n\n/** Select exactly one provider-discovery host source, or omit both for primary. */\ntype ProviderHostRoutingArgs = {\n environmentId: string;\n hostId?: never;\n} | {\n environmentId?: never;\n hostId: string;\n} | {\n environmentId?: never;\n hostId?: never;\n};\ntype ProviderListArgs = ProviderHostRoutingArgs;\ntype ProviderModelsArgs = ProviderHostRoutingArgs & {\n providerId?: string;\n};\ntype ProviderListResult = ProviderInfo[];\ntype ProviderModelsResult = SystemExecutionOptionsResponse;\ninterface ProvidersArea {\n /** List providers on the environment host, explicit host, or primary host. */\n list(args?: ProviderListArgs): Promise;\n /** List models on the environment host, explicit host, or primary host. */\n models(args?: ProviderModelsArgs): Promise;\n}\n\ninterface PluginIdArgs {\n pluginId: string;\n}\n/** Install directly from a path:, git:, npm:, or builtin: source spec. */\ninterface PluginInstallArgs {\n source: string;\n}\n/** Install an entry from BB's official catalog. */\ninterface PluginCatalogInstallArgs {\n entryId: string;\n}\ninterface PluginReloadArgs {\n pluginId?: string;\n}\ninterface PluginSettingsUpdateArgs extends PluginIdArgs {\n values: Record;\n}\ninterface PluginTokenArgs extends PluginIdArgs {\n rotate?: boolean;\n}\ninterface PluginCheckUpdatesArgs {\n pluginId?: string;\n}\ninterface PluginRpcArgs extends PluginIdArgs {\n input?: JsonValue;\n method: string;\n outputSchema: z$1.ZodType;\n}\ninterface PluginCatalogSearchArgs {\n query: string;\n}\ntype PluginDisableResult = InstalledPlugin;\ntype PluginEnableResult = InstalledPlugin;\ntype PluginGetSettingsResult = PluginSettingsResponse;\ntype PluginInstallResult = InstalledPlugin;\ntype PluginListResult = PluginListResponse;\ntype PluginReloadResult = PluginReloadResponse;\ntype PluginRemoveResult = PluginRemoveResponse;\ntype PluginTokenResult = PluginTokenResponse;\ntype PluginUpdateSettingsResult = PluginSettingsResponse;\ntype PluginGetSourceResult = PluginSourceDetail;\ntype PluginCheckUpdatesResult = PluginUpdateCheckEntry[];\ntype PluginApplyUpdateResult = PluginApplyUpdateResult$1;\ntype PluginCatalogStatusResult = PluginCatalogStatus;\ntype PluginCatalogSearchResult = PluginCatalogSearchResult$1[];\ninterface PluginCatalogArea {\n install(args: PluginCatalogInstallArgs): Promise;\n search(args: PluginCatalogSearchArgs): Promise;\n status(): Promise;\n}\ninterface PluginsArea {\n applyUpdate(args: PluginIdArgs): Promise;\n callRpc(args: PluginRpcArgs): Promise;\n checkUpdates(args?: PluginCheckUpdatesArgs): Promise;\n catalog: PluginCatalogArea;\n disable(args: PluginIdArgs): Promise;\n enable(args: PluginIdArgs): Promise;\n getSettings(args: PluginIdArgs): Promise;\n getSource(args: PluginIdArgs): Promise;\n install(args: PluginInstallArgs): Promise;\n list(): Promise;\n listUpdateResults(): Promise;\n reload(args?: PluginReloadArgs): Promise;\n remove(args: PluginIdArgs): Promise;\n token(args: PluginTokenArgs): Promise;\n updateSettings(args: PluginSettingsUpdateArgs): Promise;\n}\n\ntype BbRealtimeUnsubscribe = () => void;\ntype BbRealtimeEventName = \"thread:changed\" | \"project:changed\" | \"environment:changed\" | \"host:changed\" | \"system:changed\" | \"system:config-changed\" | \"realtime:connection\";\ntype ThreadRealtimeEvent = Extract;\ntype ProjectRealtimeEvent = Extract;\ntype EnvironmentRealtimeEvent = Extract;\ntype HostRealtimeEvent = Extract;\ntype SystemRealtimeEvent = Extract;\ntype BbRealtimeConnectionState = \"connecting\" | \"connected\" | \"disconnected\";\ninterface BbRealtimeConnectionEvent {\n reconnectDelayMs: number | null;\n reconnected: boolean;\n state: BbRealtimeConnectionState;\n}\n/**\n * Entity-changed events are delivered as one shared object to every matching\n * listener; their payload types are readonly so a listener cannot mutate what\n * the next listener receives.\n */\ninterface BbRealtimeEventMap {\n \"thread:changed\": ThreadRealtimeEvent;\n \"project:changed\": ProjectRealtimeEvent;\n \"environment:changed\": EnvironmentRealtimeEvent;\n \"host:changed\": HostRealtimeEvent;\n \"system:changed\": SystemRealtimeEvent;\n \"system:config-changed\": SystemRealtimeEvent;\n \"realtime:connection\": BbRealtimeConnectionEvent;\n}\ntype BbRealtimeCallback = (event: BbRealtimeEventMap[TEventName]) => void;\ninterface ThreadRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"thread:changed\">;\n event: \"thread:changed\";\n threadId?: string;\n}\ninterface ProjectRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"project:changed\">;\n event: \"project:changed\";\n projectId?: string;\n}\ninterface EnvironmentRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"environment:changed\">;\n environmentId?: string;\n event: \"environment:changed\";\n}\ninterface HostRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"host:changed\">;\n event: \"host:changed\";\n hostId?: string;\n}\ninterface SystemRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"system:changed\">;\n event: \"system:changed\";\n}\ninterface SystemConfigRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"system:config-changed\">;\n event: \"system:config-changed\";\n}\n/**\n * Connection listeners are pure observers — they never open or hold the\n * socket. A listener registered while a socket already exists receives the\n * latest connection event as a snapshot on the next microtask, so a status\n * UI mounted after connect still learns the current state.\n */\ninterface RealtimeConnectionSubscribeArgs {\n callback: BbRealtimeCallback<\"realtime:connection\">;\n event: \"realtime:connection\";\n}\ntype BbRealtimeSubscribeArgsUnion = ThreadRealtimeSubscribeArgs | ProjectRealtimeSubscribeArgs | EnvironmentRealtimeSubscribeArgs | HostRealtimeSubscribeArgs | SystemRealtimeSubscribeArgs | SystemConfigRealtimeSubscribeArgs | RealtimeConnectionSubscribeArgs;\ntype BbRealtimeSubscribeArgs = Extract;\ninterface BbRealtime {\n subscribe(args: BbRealtimeSubscribeArgs): BbRealtimeUnsubscribe;\n}\n\ninterface StatusGetArgs {\n projectId?: string;\n threadId?: string;\n}\ninterface StatusThreadSummary {\n environmentId: string | null;\n id: string;\n parentThreadId: string | null;\n pinnedAt: number | null;\n projectId: string;\n status: ThreadStatus;\n title: string | null;\n}\ntype StatusProject = ProjectResponse;\ntype StatusChildThreads = ThreadListResponse;\ninterface StatusResult {\n childThreads: StatusChildThreads | null;\n pendingTodos: ThreadTimelinePendingTodos | null;\n project: StatusProject | null;\n thread: StatusThreadSummary | null;\n}\ninterface StatusArea {\n get(args?: StatusGetArgs): Promise;\n}\n\ntype ThemeGetResult = AppTheme;\ntype ThemeCatalogResult = ThemeCatalogResponse;\ntype ThemeSetInput = AppThemeSelection;\ntype ThemeSetResult = AppTheme;\ninterface ThemeArea {\n /** The active app palette, resolved server-side (built-in id or custom CSS). */\n get(): Promise;\n /** The custom-theme directory plus discovered themes and the active palette. */\n catalog(): Promise;\n /** Set the complete app appearance selection in one request. */\n set(selection: ThemeSetInput): Promise;\n /**\n * Activate a palette by id while preserving the active favicon color. This\n * compatibility shorthand reads the active appearance before writing the\n * complete selection; prefer the object form when both values are known.\n */\n set(themeId: string): Promise;\n}\n\ninterface SystemVersionArgs {\n force?: boolean;\n}\ninterface SystemVoiceTranscriptionArgs {\n file: Blob;\n prompt?: string;\n}\ntype SystemAttentionResult = SystemAttentionResponse;\ntype SystemConfigResult = SystemConfigResponse;\ntype SystemExecutionOptionsResult = SystemExecutionOptionsResponse;\ntype SystemReloadConfigResult = SystemConfigReloadResponse;\ntype SystemVoiceTranscriptionResult = SystemVoiceTranscriptionResponse;\ntype SystemUpdateExperimentsResult = Experiments;\ntype SystemUpdateGeneralSettingsResult = AppSettings;\ntype SystemUpdateKeyboardSettingsResult = AppKeybindingOverrides;\ntype SystemUsageLimitsResult = ProviderUsageResponse;\ntype SystemVersionResult = SystemVersionResponse;\ninterface SystemArea {\n attention(): Promise;\n config(): Promise;\n executionOptions(args?: SystemExecutionOptionsQuery): Promise;\n reloadConfig(): Promise;\n transcribeVoice(args: SystemVoiceTranscriptionArgs): Promise;\n updateExperiments(args: Experiments): Promise;\n updateGeneralSettings(args: AppSettings): Promise;\n updateKeyboardSettings(args: AppKeybindingOverrides): Promise;\n usageLimits(args?: SystemUsageLimitsQuery): Promise;\n version(args?: SystemVersionArgs): Promise;\n}\n\ninterface TerminalThreadScope {\n cwd?: never;\n environmentId?: never;\n hostId?: never;\n kind: \"thread\";\n threadId: string;\n}\ninterface TerminalEnvironmentScope {\n environmentId: string;\n cwd?: never;\n hostId?: never;\n kind: \"environment\";\n threadId?: never;\n}\ninterface TerminalHostPathListScope {\n /** Optional exact initial working-directory filter on the selected host. */\n cwd?: string;\n environmentId?: never;\n hostId: string;\n kind: \"host_path\";\n threadId?: never;\n}\ninterface TerminalHostPathCreateScope {\n /** Null starts in the selected host's home directory. */\n cwd: string | null;\n environmentId?: never;\n hostId: string;\n kind: \"host_path\";\n threadId?: never;\n}\ntype TerminalListScope = TerminalThreadScope | TerminalEnvironmentScope | TerminalHostPathListScope;\ntype TerminalCreateScope = TerminalThreadScope | TerminalEnvironmentScope | TerminalHostPathCreateScope;\ninterface TerminalListArgs {\n scope: TerminalListScope;\n}\ninterface TerminalCreateArgs {\n cols: number;\n rows: number;\n scope: TerminalCreateScope;\n start?: CreateTerminalRequest[\"start\"];\n title?: string;\n}\ninterface TerminalTargetArgs {\n terminalId: string;\n}\ntype TerminalGetArgs = TerminalTargetArgs;\ninterface TerminalRenameArgs extends TerminalTargetArgs {\n title: UpdateTerminalRequest[\"title\"];\n}\ninterface TerminalCloseArgs extends TerminalTargetArgs {\n mode: \"force\" | \"if-clean\";\n}\ninterface TerminalInputArgs extends TerminalTargetArgs {\n dataBase64: TerminalInputRequest[\"dataBase64\"];\n}\ninterface TerminalResizeArgs extends TerminalTargetArgs {\n cols: TerminalResizeRequest[\"cols\"];\n rows: TerminalResizeRequest[\"rows\"];\n}\ninterface TerminalOutputArgs extends TerminalTargetArgs {\n limitChunks?: TerminalOutputQuery[\"limitChunks\"];\n sinceSeq?: TerminalOutputQuery[\"sinceSeq\"];\n tailBytes?: TerminalOutputQuery[\"tailBytes\"];\n}\ntype TerminalRestartArgs = TerminalTargetArgs;\ntype TerminalListResult = TerminalListResponse;\ntype TerminalCreateResult = TerminalSession;\ntype TerminalGetResult = TerminalSession;\ntype TerminalRenameResult = TerminalSession;\ntype TerminalCloseResult = TerminalSession;\ntype TerminalInputResult = TerminalSession;\ntype TerminalResizeResult = TerminalSession;\ntype TerminalOutputResult = TerminalOutputResponse;\ntype TerminalRestartResult = TerminalSession;\ninterface TerminalsArea {\n close(args: TerminalCloseArgs): Promise;\n create(args: TerminalCreateArgs): Promise;\n get(args: TerminalGetArgs): Promise;\n input(args: TerminalInputArgs): Promise;\n list(args: TerminalListArgs): Promise;\n output(args: TerminalOutputArgs): Promise;\n rename(args: TerminalRenameArgs): Promise;\n /**\n * Replace a terminal with a shell at the same scope, size, and title.\n * The original command is not replayed because terminal sessions do not\n * persist launch commands. The replacement has a new terminal ID.\n */\n restart(args: TerminalRestartArgs): Promise;\n resize(args: TerminalResizeArgs): Promise;\n}\n\ninterface ThreadListArgs {\n archived?: boolean;\n excludeSideChats?: boolean;\n folderId?: string;\n hasParent?: boolean;\n limit?: number;\n offset?: number;\n originKind?: ThreadListQuery[\"originKind\"];\n parentThreadId?: string;\n projectId?: string;\n sourceThreadId?: string;\n unfiled?: boolean;\n}\ninterface ThreadSearchArgs extends ThreadSearchQuery {\n}\ninterface ThreadGetArgs {\n include?: ThreadGetQuery[\"include\"];\n threadId: string;\n}\ntype ThreadGetResult = ThreadResponse | ThreadWithIncludesResponse;\ntype ThreadListResult = ThreadListResponse;\ntype ThreadSearchResult = ThreadSearchResponse;\ninterface ThreadOutputResponse {\n output: string | null;\n}\ntype ThreadMutationResult = ThreadResponse;\ntype ThreadSpawnResult = ThreadResponse;\ntype ThreadInteractionGetResult = PendingInteraction;\ntype ThreadInteractionListResult = ThreadPendingInteractionsResponse;\ntype ThreadInteractionResolveResult = PendingInteraction;\ntype ThreadInteractionRespondResult = PendingInteraction;\ntype ThreadInteractionCancelResult = PendingInteraction;\ntype ThreadEventsListResult = ThreadEventRow[];\ntype ThreadEventWaitResult = ThreadEventRow | null;\ntype ThreadTimelineResult = ThreadTimelineResponse;\ntype ThreadArchiveResult = ThreadArchiveAllResponse;\ntype ThreadOpenResult = ThreadOpenResponse;\ntype ThreadDeleteResult = {\n ok: true;\n};\ntype ThreadSendResult = {\n ok: true;\n};\ntype ThreadStopResult = {\n ok: true;\n};\ntype ThreadUnarchiveResult = {\n ok: true;\n};\ntype ThreadArchiveAllResult = ThreadArchiveAllResponse;\ntype ThreadReadStateResult = ThreadResponse;\ntype ThreadPinOrderResult = ThreadListResponse;\ntype ThreadPromptHistoryResult = PromptHistoryResponse;\ntype ThreadQueuedMessagesResult = ThreadQueuedMessageListResponse;\ntype ThreadQueuedMessageCreateResult = ThreadQueuedMessage;\ntype ThreadQueuedMessageDeleteResult = {\n ok: true;\n};\ntype ThreadQueuedMessageReorderResult = ThreadQueuedMessageListResponse;\ntype ThreadQueuedMessageSendResult = SendQueuedMessageResponse;\ntype ThreadQueuedMessageGroupBoundaryResult = ThreadQueuedMessageListResponse;\ntype ThreadTabsResult = ThreadTabsResponse;\ntype ThreadTabsUpdateResult = ThreadTabsResponse;\ntype ThreadStorageFilesResult = ThreadStorageFileListResponse;\ntype ThreadStoragePathsResult = ThreadStoragePathListResponse;\ntype ThreadChildSummaryResult = ThreadChildSummaryResponse;\ntype ThreadDefaultExecutionOptionsResult = ResolvedThreadExecutionOptions | null;\ntype ThreadConversationOutlineResult = ThreadConversationOutlineResponse;\ntype ThreadTimelineTurnSummaryDetailsResult = TimelineTurnSummaryDetailsResponse;\ninterface ThreadSpawnBaseArgs extends Omit {\n childOrigin?: CreateThreadRequest[\"childOrigin\"];\n origin?: CreateThreadRequest[\"origin\"];\n originKind?: CreateThreadRequest[\"originKind\"];\n startedOnBehalfOf?: CreateThreadRequest[\"startedOnBehalfOf\"];\n}\ntype ThreadSpawnArgs = ThreadSpawnBaseArgs & ({\n input: CreateThreadRequest[\"input\"];\n prompt?: never;\n} | {\n input?: never;\n prompt: string;\n});\ninterface ThreadUpdateArgs extends UpdateThreadRequest {\n threadId: string;\n}\ninterface ThreadDeleteArgs extends DeleteThreadRequest {\n threadId: string;\n}\ninterface ThreadSendArgs extends SendMessageRequest {\n threadId: string;\n}\ninterface ThreadStatusArgs {\n threadId: string;\n}\ninterface ThreadPromptHistoryArgs extends PromptHistoryQuery {\n threadId: string;\n}\ninterface ThreadPinOrderArgs extends ReorderPinnedThreadRequest {\n threadId: string;\n}\ninterface ThreadQueuedMessageArgs {\n threadId: string;\n}\ninterface ThreadQueuedMessageCreateArgs extends CreateQueuedMessageRequest {\n threadId: string;\n}\ninterface ThreadQueuedMessageTargetArgs {\n queuedMessageId: string;\n threadId: string;\n}\ninterface ThreadQueuedMessageSendArgs extends ThreadQueuedMessageTargetArgs, SendQueuedMessageRequest {\n}\ninterface ThreadQueuedMessageReorderArgs extends ThreadQueuedMessageTargetArgs, ReorderQueuedMessageRequest {\n}\ninterface ThreadQueuedMessageGroupBoundaryArgs extends SetQueuedMessageGroupBoundaryRequest {\n threadId: string;\n}\ninterface ThreadStorageFilesArgs extends ThreadStorageFilesQuery {\n threadId: string;\n}\ninterface ThreadStoragePathsArgs extends ThreadStoragePathsQuery {\n threadId: string;\n}\ninterface ThreadTimelineTurnSummaryDetailsArgs extends TimelineTurnSummaryDetailsQuery {\n threadId: string;\n}\ninterface ThreadTabsUpdateArgs extends UpdateThreadTabsRequest {\n threadId: string;\n}\ninterface ThreadOpenArgs {\n threadId: string;\n split?: ThreadOpenSplit;\n file: ThreadOpenFile | null;\n}\ninterface ThreadEventsListArgs {\n afterSeq?: string;\n limit?: string;\n threadId: string;\n}\ninterface ThreadEventWaitArgs {\n afterSeq?: string;\n threadId: string;\n type: string;\n waitMs: string;\n}\ninterface ThreadTimelineArgs extends ThreadTimelineQuery {\n threadId: string;\n}\ninterface ThreadOutputArgs {\n threadId: string;\n}\ninterface ThreadInteractionListArgs {\n threadId: string;\n}\ninterface ThreadInteractionGetArgs extends ThreadInteractionListArgs {\n interactionId: string;\n}\ninterface ThreadInteractionResolveArgs extends ThreadInteractionGetArgs {\n resolution: PendingInteractionResolution;\n}\ninterface ThreadInteractionRespondArgs extends ThreadInteractionGetArgs {\n value: JsonValue;\n}\ntype ThreadWaitTarget = {\n kind: \"status\";\n status: ThreadStatus;\n} | {\n kind: \"event\";\n eventType: string;\n};\ninterface ThreadWaitArgs {\n event?: string;\n pollIntervalMs?: number;\n status?: ThreadStatus;\n threadId: string;\n timeoutMs?: number;\n}\ntype ThreadWaitResult = {\n event: NonNullable;\n matched: true;\n target: Extract;\n threadId: string;\n} | {\n matched: true;\n target: Extract;\n thread: ThreadGetResult;\n threadId: string;\n};\ninterface ThreadInteractionsArea {\n cancel(args: ThreadInteractionGetArgs): Promise;\n get(args: ThreadInteractionGetArgs): Promise;\n list(args: ThreadInteractionListArgs): Promise;\n resolve(args: ThreadInteractionResolveArgs): Promise;\n respond(args: ThreadInteractionRespondArgs): Promise;\n}\ninterface ThreadEventsArea {\n list(args: ThreadEventsListArgs): Promise;\n wait(args: ThreadEventWaitArgs): Promise;\n}\ninterface ThreadQueuedMessagesArea {\n create(args: ThreadQueuedMessageCreateArgs): Promise;\n delete(args: ThreadQueuedMessageTargetArgs): Promise;\n list(args: ThreadQueuedMessageArgs): Promise;\n reorder(args: ThreadQueuedMessageReorderArgs): Promise;\n send(args: ThreadQueuedMessageSendArgs): Promise;\n setGroupBoundary(args: ThreadQueuedMessageGroupBoundaryArgs): Promise;\n}\ninterface ThreadTabsArea {\n get(args: ThreadStatusArgs): Promise;\n update(args: ThreadTabsUpdateArgs): Promise;\n}\ninterface ThreadsArea {\n archive(args: ThreadStatusArgs): Promise;\n archiveAll(args: ThreadStatusArgs): Promise;\n childSummary(args: ThreadStatusArgs): Promise;\n conversationOutline(args: ThreadStatusArgs): Promise;\n defaultExecutionOptions(args: ThreadStatusArgs): Promise;\n delete(args: ThreadDeleteArgs): Promise;\n events: ThreadEventsArea;\n get(args: ThreadGetArgs): Promise;\n interactions: ThreadInteractionsArea;\n list(args?: ThreadListArgs): Promise;\n markRead(args: ThreadStatusArgs): Promise;\n markUnread(args: ThreadStatusArgs): Promise;\n open(args: ThreadOpenArgs): Promise;\n output(args: ThreadOutputArgs): Promise;\n pin(args: ThreadStatusArgs): Promise;\n promptHistory(args: ThreadPromptHistoryArgs): Promise;\n queuedMessages: ThreadQueuedMessagesArea;\n reorderPinned(args: ThreadPinOrderArgs): Promise;\n search(args: ThreadSearchArgs): Promise;\n send(args: ThreadSendArgs): Promise;\n spawn(args: ThreadSpawnArgs): Promise;\n stop(args: ThreadStatusArgs): Promise;\n tabs: ThreadTabsArea;\n timeline(args: ThreadTimelineArgs): Promise;\n timelineTurnSummaryDetails(args: ThreadTimelineTurnSummaryDetailsArgs): Promise;\n storageFiles(args: ThreadStorageFilesArgs): Promise;\n storagePaths(args: ThreadStoragePathsArgs): Promise;\n unarchive(args: ThreadStatusArgs): Promise;\n unpin(args: ThreadStatusArgs): Promise;\n update(args: ThreadUpdateArgs): Promise;\n wait(args: ThreadWaitArgs): Promise;\n}\n\ntype ThreadFolderCreateResult = ThreadFolderResponse;\ntype ThreadFolderUpdateResult = ThreadFolderMutationResponse;\ntype ThreadFolderDeleteResult = ThreadFolderMutationResponse;\ntype ThreadFolderListResult = ThreadFolderResponse[];\ninterface ThreadFoldersArea {\n create(args: CreateThreadFolderRequest): Promise;\n delete(args: DeleteThreadFolderRequest): Promise;\n list(): Promise;\n update(args: UpdateThreadFolderRequest): Promise;\n}\n\ninterface BbSdk extends BbRealtime {\n environments: EnvironmentsArea;\n files: FilesArea;\n guide: GuideArea;\n hosts: HostsArea;\n projects: ProjectsArea;\n plugins: PluginsArea;\n providers: ProvidersArea;\n status: StatusArea;\n system: SystemArea;\n terminals: TerminalsArea;\n theme: ThemeArea;\n threadFolders: ThreadFoldersArea;\n threads: ThreadsArea;\n}\n\n/**\n * The backend plugin API contract — the `bb` object handed to a plugin's\n * `server.ts` factory (`export default function plugin(bb: BbPluginApi)`).\n *\n * Types only: the implementation lives in the BB server\n * (apps/server/src/services/plugins/plugin-api.ts), which imports these\n * shapes so the contract and the implementation cannot drift. Plugin authors\n * import them type-only (`import type { BbPluginApi } from\n * \"@bb/plugin-sdk\"`); the import is erased when BB loads the file.\n *\n * Runtime classes stay host-side. NeedsConfigurationError in particular is\n * matched by NAME, so plugin code needs no runtime import:\n * `throw Object.assign(new Error(msg), { name: \"NeedsConfigurationError\" })`.\n */\ninterface PluginLogger {\n debug(message: string): void;\n info(message: string): void;\n warn(message: string): void;\n error(message: string): void;\n}\n/**\n * Declarative settings descriptors (`bb.settings.define`). Deliberately plain\n * data — not zod — so the host can render settings forms and the CLI can\n * parse values without executing plugin code.\n */\ntype PluginSettingDescriptor = {\n type: \"string\";\n label: string;\n description?: string;\n /** Stored in a 0600 file under /plugins//secrets/, never in the db or sent to the frontend. */\n secret?: true;\n default?: string;\n} | {\n type: \"boolean\";\n label: string;\n description?: string;\n default?: boolean;\n} | {\n type: \"select\";\n label: string;\n description?: string;\n options: string[];\n default?: string;\n} | {\n type: \"project\";\n label: string;\n description?: string;\n default?: string;\n};\ntype PluginSettingDescriptors = Record;\ntype PluginSettingValue = string | boolean;\n/** `default` present → non-optional value; absent → `T | undefined`. */\ntype PluginSettingsValues> = {\n [K in keyof Ds]: Ds[K] extends {\n default: string | boolean;\n } ? PluginSettingValueOf : PluginSettingValueOf | undefined;\n};\ntype PluginSettingValueOf = D extends {\n type: \"boolean\";\n} ? boolean : string;\ninterface PluginSettingsHandle> {\n /** Load-safe: callable inside the factory. */\n get(): Promise>;\n /** Fires after values change through the settings route/CLI. */\n onChange(listener: (next: PluginSettingsValues, prev: PluginSettingsValues) => void): void;\n}\ninterface PluginSettings {\n define>(descriptors: Ds): PluginSettingsHandle;\n}\ninterface PluginKvStorage {\n get(key: string): Promise;\n set(key: string, value: unknown): Promise;\n delete(key: string): Promise;\n list(prefix?: string): Promise;\n}\ninterface PluginStorage {\n /** Namespaced JSON key-value rows in bb.db; values ≤256KB each. */\n kv: PluginKvStorage;\n /**\n * Open (or reuse the path of) the plugin's own SQLite database at\n * /plugins//data.db — the server's better-sqlite3, WAL mode,\n * busy_timeout 5000. Handles are host-tracked and closed on\n * dispose/reload; a closed handle throws on use.\n */\n database(): Database.Database;\n /**\n * Ordered-statement migration helper: statement index = migration id in a\n * `_bb_migrations` table; unapplied statements run in one transaction.\n * Append-only — never reorder or edit shipped statements.\n */\n migrate(db: Database.Database, statements: string[]): void;\n}\n/**\n * Thread lifecycle events a plugin can observe (design §4.5). Observe-only:\n * handlers run fire-and-forget after the transition is applied and can never\n * block or veto it. `thread` is the same public DTO GET /threads/:id serves.\n */\ninterface PluginThreadEventPayloads {\n /** Fired after a thread row is created. */\n \"thread.created\": {\n thread: ThreadResponse;\n };\n /** Fired when a thread transitions into `active`. */\n \"thread.active\": {\n thread: ThreadResponse;\n };\n /** Fired when a thread transitions into `idle`. `lastAssistantText` is\n * assembled the same way GET /threads/:id/output is. */\n \"thread.idle\": {\n thread: ThreadResponse;\n lastAssistantText: string | null;\n };\n /** Fired when a thread transitions into `error`. `error` is the latest\n * system/error event message, when one exists. */\n \"thread.failed\": {\n thread: ThreadResponse;\n error: string | null;\n };\n /** Fired after a thread is soft-deleted. */\n \"thread.deleted\": {\n thread: ThreadResponse;\n };\n}\ntype PluginThreadEventName = keyof PluginThreadEventPayloads;\ntype PluginThreadEventHandler = (payload: PluginThreadEventPayloads[E]) => void | Promise;\ntype PluginHttpAuthMode = \"local\" | \"token\" | \"none\";\ntype PluginHttpHandler = (context: Context) => Response | Promise;\ninterface PluginHttp {\n /**\n * Register an HTTP route, mounted at\n * `/api/v1/plugins//http/`. Auth modes (default \"local\"):\n * - \"local\": Origin/Host must be a local BB app origin; non-GET requires\n * content-type application/json (forces a CORS preflight).\n * - \"token\": requires the per-plugin token (`bb plugin token `) via\n * the x-bb-plugin-token header or ?token=.\n * - \"none\": no checks — only for signature-verified webhooks.\n */\n route(method: string, path: string, handler: PluginHttpHandler, opts?: {\n auth?: PluginHttpAuthMode;\n }): void;\n}\ninterface PluginRpc {\n /**\n * Register a Standard Schema-driven rpc contract and its inferred handlers,\n * served at POST\n * `/api/v1/plugins//rpc/` with \"local\" auth semantics. The\n * host validates input before invocation and output before strict JSON\n * serialization. The response is `{ ok: true, result }` or\n * `{ ok: false, error: { code, message, issues? } }`.\n */\n register(contract: Contract, handlers: PluginRpcHandlers): void;\n}\ninterface PluginRealtime {\n /**\n * Broadcast an ephemeral `plugin-signal` WS message\n * `{ pluginId, channel, payload }` to every connected client (V1 has no\n * per-channel subscriptions). `payload` must be JSON-serializable;\n * `undefined` is normalized to `null`. Nothing is persisted.\n */\n publish(channel: string, payload: unknown): void;\n}\ninterface PluginBackground {\n /**\n * Register a long-lived background service. `start` runs after the\n * factory completes and should resolve when `signal` aborts\n * (dispose/reload/disable/shutdown). A crash restarts it with capped\n * exponential backoff; throwing NeedsConfigurationError marks the plugin\n * `needs-configuration` and stops restarting until the next load.\n */\n service(name: string, service: {\n start(signal: AbortSignal): void | Promise;\n }): void;\n /**\n * Register a cron schedule (5-field expression, server-local time). The\n * durable row keyed (pluginId, name) is upserted at load; the periodic\n * sweep claims due rows with a CAS on next_run_at, but only while this\n * plugin is loaded. Failures land in last_status/last_error, visible in\n * `bb plugin list`.\n */\n schedule(name: string, cron: string, fn: () => void | Promise): void;\n}\ninterface PluginCliCommandInfo {\n name: string;\n summary: string;\n usage: string;\n}\n/** Context forwarded from the invoking CLI when known; all fields optional. */\ninterface PluginCliContext {\n cwd?: string;\n threadId?: string;\n projectId?: string;\n /** Aborted when the invoking CLI HTTP request disconnects. */\n signal?: AbortSignal;\n}\ntype PluginInteractionCancelReason = \"user\" | \"request-aborted\" | \"thread-stopped\" | \"thread-deleted\" | \"plugin-disposed\" | \"server-restarted\" | \"timeout\";\ntype PluginInteractionResult = {\n outcome: \"submitted\";\n value: JsonValue$1;\n} | {\n outcome: \"cancelled\";\n reason: PluginInteractionCancelReason;\n};\ninterface PluginInteractionRequest {\n threadId: string;\n rendererId: string;\n title: string;\n payload: JsonValue$1;\n /** Defaults to ten minutes; capped at one hour. */\n timeoutMs?: number;\n}\ninterface PluginCliResult {\n exitCode: number;\n stdout?: string;\n stderr?: string;\n}\ninterface PluginCliRegistration {\n /** Top-level command name (`bb …`): lowercase [a-z0-9-]+, and not\n * a core bb command (see RESERVED_BB_CLI_COMMANDS in the server). */\n name: string;\n summary: string;\n /** Subcommand metadata rendered in help and the plugin-commands skill\n * without executing plugin code. Parsing argv is plugin-owned. */\n commands?: PluginCliCommandInfo[];\n run(argv: string[], ctx: PluginCliContext): PluginCliResult | Promise;\n}\ninterface PluginCli {\n /**\n * Register this plugin's `bb` subcommand. One registration per factory\n * execution; a repeated call is rejected. Core bb commands always win\n * name collisions; reserved names are rejected at registration.\n */\n register(registration: PluginCliRegistration): void;\n}\n/** Per-turn context handed to bb.agents context providers (design §4.4). */\n/** MCP-style content parts a native tool may return (design §4.4). */\ntype PluginAgentToolContentPart = {\n type: \"text\";\n text: string;\n} | {\n type: \"image\";\n data: string;\n mimeType: string;\n};\ntype PluginAgentToolResult = string | {\n content: PluginAgentToolContentPart[];\n isError?: boolean;\n};\n/** Per-call context handed to a native tool's execute (design §4.4). */\ninterface PluginAgentToolContext {\n threadId: string;\n projectId: string;\n /** The tool-call request's abort signal (aborts if the daemon round-trip\n * is torn down mid-call). */\n signal: AbortSignal;\n}\ninterface PluginAgentToolRegistrationBase {\n /** Tool name shown to the model: [a-zA-Z0-9_-]+, unique across plugins,\n * and not a built-in dynamic tool (see RESERVED_AGENT_TOOL_NAMES in the\n * server). */\n name: string;\n description: string;\n /**\n * Optional usage snippet appended to the thread instructions whenever\n * this tool is in the session's tool set (mirrors the built-in\n * update_environment_directory guidance). Limited to 4096 characters.\n */\n instructions?: string;\n}\n/** Stable, plain-data context resolved by the server for one agent session. */\ninterface PluginAgentConfigurationContext {\n thread: {\n id: string;\n title: string | null;\n parentThreadId: string | null;\n sourceThreadId: string | null;\n };\n project: {\n id: string;\n kind: \"standard\" | \"personal\";\n name: string;\n gitRemoteUrl: string | null;\n };\n environment: {\n id: string;\n name: string | null;\n path: string | null;\n workspaceProvisionType: \"unmanaged\" | \"managed-worktree\" | \"personal\";\n branchName: string | null;\n };\n host: {\n id: string;\n name: string;\n };\n provider: {\n id: string;\n model: string;\n };\n sideChat: boolean;\n origin: {\n kind: \"fork\" | \"side-chat\" | null;\n pluginId: string | null;\n };\n}\n/** Per-resolution selection returned by {@link PluginAgents.configure}. */\ninterface PluginAgentConfiguration {\n /** Tool names registered by this plugin. Duplicate or unknown names reject\n * this plugin's complete selection for the resolution. */\n tools: string[];\n /** Skill frontmatter names from this plugin's manifest skill roots.\n * Duplicate or unknown names reject this plugin's complete selection. */\n skills: string[];\n /** Optional dynamic instructions. Output is truncated to 4096 characters. */\n instructions?: string;\n}\ninterface PluginAgents {\n /**\n * Select this plugin's statically registered tools and manifest skills for\n * each thread/session resolution, with optional dynamic instructions. The\n * callback is synchronous and runs at `thread.start` / `turn.submit`; it\n * never rebuilds registrations. Exactly one callback may be registered per\n * factory execution. A throw, malformed result, duplicate id, unknown id,\n * or more than 256 tool/skill ids fails closed for this plugin only.\n *\n * Tools take effect when the provider session is next started or resumed;\n * an already-running session is not hot-mutated. Instructions are resolved\n * for the next turn. Skill changes follow BB's environment runtime policy:\n * a busy runtime keeps its current catalog until a safe relaunch. Side-chat\n * threads receive `sideChat: true`, and their returned tool, skill, and\n * dynamic-instruction selections apply at the same boundaries. Independent\n * side-chat safety policy (such as permission escalation) is unchanged.\n */\n configure(provider: (context: PluginAgentConfigurationContext) => PluginAgentConfiguration): void;\n /**\n * Register a native dynamic tool (design §4.4). `parameters` is either a\n * zod schema (validated per call; execute receives the parsed value) or a\n * plain JSON-schema object (no validation; execute receives the raw\n * arguments as `unknown`). Tool-set changes apply on the NEXT session\n * start — a tool registered mid-session is not hot-added to running\n * provider sessions. A second registration of the same name within this\n * plugin is rejected; a name already registered by another plugin is\n * rejected and surfaced as this plugin's status detail.\n */\n registerTool(tool: PluginAgentToolRegistrationBase & {\n parameters: Schema;\n execute(params: z.output, ctx: PluginAgentToolContext): PluginAgentToolResult | Promise;\n }): void;\n registerTool(tool: PluginAgentToolRegistrationBase & {\n /** Raw JSON-schema escape hatch; params arrive unvalidated. */\n parameters: Record;\n execute(params: unknown, ctx: PluginAgentToolContext): PluginAgentToolResult | Promise;\n }): void;\n /**\n * Contribute a dynamic section appended to thread instructions. The\n * provider runs when a thread's runtime command config is resolved\n * (thread.start / turn.submit); return null to contribute nothing for\n * that resolution. Must be synchronous and fast — it sits on the\n * thread-start path. Output longer than 4096 characters is truncated; a\n * throwing provider is logged against the plugin and contributes nothing.\n * A repeated registration within one factory execution is rejected.\n * This legacy contribution is not applied to side-chat threads; use\n * configure() when sideChat-aware dynamic instructions are required.\n */\n contributeInstructions(provider: (ctx: {\n threadId: string;\n projectId: string;\n }) => string | null): void;\n}\ninterface PluginThreadActionContext {\n threadId: string;\n projectId: string;\n}\ninterface PluginThreadActionToast {\n kind: \"success\" | \"error\" | \"info\";\n message: string;\n}\ntype PluginThreadActionResult = void | {\n toast?: PluginThreadActionToast;\n};\ninterface PluginThreadActionRegistration {\n /** Unique within this plugin: [a-zA-Z0-9_-]+ (becomes a URL segment). */\n id: string;\n /** Button label rendered in the thread header. */\n title: string;\n /** Optional icon name; the host falls back to a generic icon. */\n icon?: string;\n /** Optional confirmation prompt the host shows before running. */\n confirm?: string;\n /**\n * Runs server-side when the user clicks the action. The host shows a\n * pending state while in flight, the returned toast on completion, and an\n * automatic error toast when this throws.\n */\n run(ctx: PluginThreadActionContext): PluginThreadActionResult | Promise;\n}\ntype PluginMentionTrigger = \"@\" | \"#\" | \"$\" | \"!\" | \"~\";\n/** Search context handed to a mention provider (design §4.9). `projectId`/\n * `threadId` are null when the composer has not committed one yet. */\ninterface PluginMentionSearchContext {\n trigger: PluginMentionTrigger;\n query: string;\n projectId: string | null;\n threadId: string | null;\n}\n/** One row a mention provider returns from `search`. `id` is the provider's\n * own item id — the host namespaces it before it reaches the wire. */\ninterface PluginMentionItem {\n id: string;\n title: string;\n subtitle?: string;\n icon?: string;\n}\ninterface PluginMentionProviderRegistration {\n /** Unique within this plugin: [a-zA-Z0-9_-]+ (no \":\" — the host composes\n * wire item ids as \":\"). */\n id: string;\n /** Section label shown above this provider's rows in the mention menu. */\n label: string;\n /**\n * Composer trigger characters this provider should answer. Omit to use the\n * default `@` mention trigger. Valid triggers are `@`, `#`, `$`, `!`, and `~`.\n */\n triggers?: readonly PluginMentionTrigger[];\n /**\n * Runs server-side as the user types after one of this provider's triggers\n * in the composer. Each call is time-boxed (2s) and failure-isolated: a slow\n * or throwing provider contributes an empty list — it can never break the\n * mention menu.\n */\n search(ctx: PluginMentionSearchContext): PluginMentionItem[] | Promise;\n /**\n * Resolves one picked item into agent context, called once per unique\n * item at message send time. The returned `context` is attached to the\n * message as an agent-visible (user-hidden) prompt input. Throwing blocks\n * the send with a visible error.\n */\n resolve(itemId: string): {\n context: string;\n } | Promise<{\n context: string;\n }>;\n}\ninterface PluginUi {\n /** Block until the app submits or cancels a plugin-owned composer form. */\n requestInput(request: PluginInteractionRequest, options?: {\n signal?: AbortSignal;\n }): Promise;\n /**\n * Register a thread action rendered in the shipped app's thread header\n * (design §4.9). Multiple actions per plugin; ids must be unique within\n * the plugin. Invoked via POST /plugins/:id/actions/:actionId.\n */\n registerThreadAction(action: PluginThreadActionRegistration): void;\n /**\n * Register a mention provider for the shipped app's composer (design §4.9).\n * Providers default to the `@` trigger and may opt into `#`, `$`, `!`, or\n * `~` with `triggers`. Items group under `label` in the mention menu; a\n * picked item becomes a `{ kind: \"plugin\" }` mention resource whose context\n * is resolved once at send time. Multiple providers per plugin; ids must be\n * unique within the plugin.\n */\n registerMentionProvider(provider: PluginMentionProviderRegistration): void;\n}\ninterface PluginEvents {\n /**\n * Add a thread lifecycle listener. Multiple listeners for the same event are\n * additive and run independently in registration order.\n */\n on(event: E, handler: PluginThreadEventHandler): void;\n}\ninterface PluginServerApi {\n /**\n * This BB server's own loopback base URL (e.g. \"http://127.0.0.1:38886\"),\n * which serves the SPA + /api + /ws. For plugins that proxy or relay\n * traffic back to the server itself (e.g. a tunnel). Bind-gated like\n * `bb.sdk`: reading it before the server is listening throws, so prefer\n * reading it from handlers, services, and timers.\n */\n readonly loopbackBaseUrl: string;\n}\ninterface PluginSharedPortTunnelIdentity {\n /** Gate routing label assigned to this machine. */\n label: string;\n /** Gate apex without a scheme, e.g. \"getbb.app\". */\n baseDomain: string;\n}\ninterface PluginHosts {\n /**\n * Ensure this enrolled host has a gate label and return its read-only public\n * identity. The daemon chooses the trusted gate and desired label; plugins\n * cannot influence either credential-bearing destination.\n */\n ensureSharedPortTunnel(hostId: string): Promise;\n /**\n * Replace this plugin's desired shared-loopback ports for one host. The\n * server aggregates declarations, owns generations, and delivers the\n * resulting set to that host's daemon. Tunnel identity is deliberately not\n * accepted here: it is owned by the daemon's trusted enrollment.\n */\n declareSharedPorts(hostId: string, ports: readonly number[]): void;\n}\ninterface PluginStatusApi {\n /**\n * Mark this plugin `needs-configuration` (with a message shown in\n * `bb plugin list` and the UI) instead of failing — e.g. a factory or\n * service that finds no API key configured. Cleared on the next load;\n * saving settings does not auto-reload in V1, so ask the user to\n * `bb plugin reload ` after configuring.\n */\n needsConfiguration(message: string): void;\n}\n/**\n * The API object handed to a plugin's factory (design §4). Implemented by\n * the BB server; this contract is what plugin `server.ts` files compile\n * against.\n */\ninterface BbPluginApi {\n /** The plugin's own id (namespaces storage, routes, commands). */\n readonly pluginId: string;\n /** Leveled, plugin-scoped logger. */\n readonly log: PluginLogger;\n /** Declarative settings (design §4.2). */\n readonly settings: PluginSettings;\n /** Namespaced KV + per-plugin database (design §4.3). */\n readonly storage: PluginStorage;\n /** HTTP routes under /api/v1/plugins//http/* (design §4.6). */\n readonly http: PluginHttp;\n /** RPC methods under /api/v1/plugins//rpc/ (design §4.6). */\n readonly rpc: PluginRpc;\n /** Ephemeral push to connected frontends (design §4.7). */\n readonly realtime: PluginRealtime;\n /** Long-lived services + cron schedules (design §4.8). */\n readonly background: PluginBackground;\n /** Agent-facing `bb` CLI subcommand (design §4.4). */\n readonly cli: PluginCli;\n /** Per-turn agent context contributions (design §4.4). */\n readonly agents: PluginAgents;\n /** Host-rendered UI contributions (design §4.9). */\n readonly ui: PluginUi;\n /** Additive plugin lifecycle listeners (design §4.5). */\n readonly events: PluginEvents;\n /** Plugin-reported status (needs-configuration). */\n readonly status: PluginStatusApi;\n /** Read-only facts about the running server (loopback base URL). */\n readonly server: PluginServerApi;\n /** Server-to-daemon host control-plane declarations. */\n readonly hosts: PluginHosts;\n /**\n * The full BB SDK, bound to this server over loopback (design §4.1).\n * Bind-gated: reading this before the host binds the SDK throws. The real\n * server binds it before loading plugins, so it is available from the\n * moment factories run there — but isolated harnesses may not, so prefer\n * using it from handlers, services, and timers for portability.\n * `threads.spawn` defaults `origin` to \"plugin\" and `originPluginId` to\n * this plugin's id so spawned threads are attributed automatically.\n */\n readonly sdk: BbSdk;\n /**\n * Register cleanup to run on reload/disable/shutdown. Hooks run LIFO.\n * The sanctioned place to clear timers and close connections.\n */\n onDispose(hook: () => void | Promise): void;\n}\n\nexport { defineRpcContract };\nexport type { BbContext, BbNavigate, BbPluginApi, JsonValue$1 as JsonValue, PluginAgentConfiguration, PluginAgentConfigurationContext, PluginAgentToolContentPart, PluginAgentToolContext, PluginAgentToolRegistrationBase, PluginAgentToolResult, PluginAgents, PluginAppBuilder, PluginAppDefinition, PluginAppSetup, PluginAppSlots, PluginBackground, PluginCli, PluginCliCommandInfo, PluginCliContext, PluginCliRegistration, PluginCliResult, PluginComposerAccessoryProps, PluginComposerAccessoryRegistration, PluginComposerApi, PluginComposerMention, PluginComposerScope, PluginEvents, PluginFileOpenerProps, PluginFileOpenerRegistration, PluginFileOpenerSource, PluginHomepageSectionProps, PluginHomepageSectionRegistration, PluginHosts, PluginHttp, PluginHttpAuthMode, PluginHttpHandler, PluginInteractionCancelReason, PluginInteractionRequest, PluginInteractionResult, PluginKvStorage, PluginLogger, PluginMentionItem, PluginMentionProviderRegistration, PluginMentionSearchContext, PluginMentionTrigger, PluginMessageDirectiveMessage, PluginMessageDirectiveOpenThreadPanel, PluginMessageDirectiveOpenWorkspaceFile, PluginMessageDirectiveProps, PluginMessageDirectiveRegistration, PluginMessageDirectiveThreadPanelOptions, PluginNavPanelProps, PluginNavPanelRegistration, PluginPendingInteractionProps, PluginPendingInteractionRegistration, PluginPendingInteractionView, PluginRealtime, PluginRealtimeConnectionState, PluginRpc, PluginRpcCallArgs, PluginRpcClient, PluginRpcContract, PluginRpcError, PluginRpcErrorCode, PluginRpcHandlers, PluginRpcIssuePathSegment, PluginRpcMethodContract, PluginRpcResult, PluginRpcValidationIssue, PluginSdkApp, PluginServerApi, PluginSettingDescriptor, PluginSettingDescriptors, PluginSettingValue, PluginSettings, PluginSettingsHandle, PluginSettingsSectionProps, PluginSettingsSectionRegistration, PluginSettingsState, PluginSettingsValues, PluginSharedPortTunnelIdentity, PluginSidebarFooterActionContext, PluginSidebarFooterActionProps, PluginSidebarFooterActionRegistration, PluginStatusApi, PluginStorage, PluginThreadActionContext, PluginThreadActionRegistration, PluginThreadActionResult, PluginThreadActionToast, PluginThreadEventHandler, PluginThreadEventName, PluginThreadEventPayloads, PluginThreadPanelActionContext, PluginThreadPanelActionRegistration, PluginThreadPanelProps, PluginUi, StandardSchemaV1, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, StandardSchemaV1Issue, StandardSchemaV1Result };\n"; +export const PLUGIN_SDK_DTS = "// Portable type declarations for `@bb/plugin-sdk`. Unpublished BB\n// workspace contracts are flattened; public subpaths may reuse the\n// package root without requiring any other @bb/* package.\n//\n// Confused by the API, or need a symbol that isn't here? Clone the BB repo\n// and read the real source: https://github.com/ymichael/bb\n\nimport { ComponentType } from 'react';\nimport Database from 'better-sqlite3';\nimport { Context } from 'hono';\nimport * as z from 'zod';\nimport { z as z$1 } from 'zod';\n\n/**\n * A value that survives a JSON round trip without coercion or data loss.\n *\n * Host boundaries still validate values at runtime because TypeScript cannot\n * exclude non-finite numbers and plugin bundles can bypass static types.\n */\ntype JsonValue$1 = string | number | boolean | null | JsonValue$1[] | {\n [key: string]: JsonValue$1;\n};\n\n/** A JSON-safe path segment reported by a Standard Schema validation issue. */\ntype PluginRpcIssuePathSegment = string | number;\n/** Validator-neutral validation detail carried by an RPC error envelope. */\ninterface PluginRpcValidationIssue {\n message: string;\n path?: PluginRpcIssuePathSegment[];\n}\n/** Stable wire error categories for plugin RPC. */\ntype PluginRpcErrorCode = \"invalid_json\" | \"invalid_input\" | \"handler_error\" | \"invalid_output\" | \"non_json_result\" | \"unknown_method\";\n/** Structured RPC failure returned as `{ ok: false, error }`. */\ninterface PluginRpcError {\n code: PluginRpcErrorCode;\n message: string;\n issues?: PluginRpcValidationIssue[];\n}\n/**\n * The validator-neutral subset of Standard Schema v1 used by plugin RPC.\n * Zod 4 schemas implement this interface directly; other validators can do\n * the same without becoming part of BB's public protocol.\n */\ninterface StandardSchemaV1 {\n readonly \"~standard\": {\n readonly version: 1;\n readonly vendor: string;\n readonly validate: (value: unknown) => StandardSchemaV1Result | Promise>;\n readonly types?: {\n readonly input: Input;\n readonly output: Output;\n };\n };\n}\ntype StandardSchemaV1Result = {\n readonly value: Output;\n readonly issues?: undefined;\n} | {\n readonly issues: readonly StandardSchemaV1Issue[];\n};\ninterface StandardSchemaV1Issue {\n readonly message: string;\n readonly path?: PropertyKey | readonly (PropertyKey | {\n readonly key: PropertyKey;\n })[];\n}\ntype StandardSchemaV1InferInput = NonNullable[\"input\"];\ntype StandardSchemaV1InferOutput = NonNullable[\"output\"];\ninterface PluginRpcMethodContract {\n readonly input: InputSchema;\n readonly output: OutputSchema;\n}\ntype PluginRpcContract = Readonly>;\n/** Define a shared RPC contract while preserving exact method/schema types. */\ndeclare function defineRpcContract(contract: Contract): Contract;\ntype PluginRpcHandlers = {\n [Method in keyof Contract]: (input: StandardSchemaV1InferOutput) => StandardSchemaV1InferInput | Promise>;\n};\ntype PluginRpcCallInput = StandardSchemaV1InferInput;\ntype PluginRpcCallArgs = null extends PluginRpcCallInput ? [input?: PluginRpcCallInput] : [input: PluginRpcCallInput];\ntype PluginRpcResult = StandardSchemaV1InferOutput;\n\n/**\n * The `@bb/plugin-sdk/app` contract (plugin design §5.2) — pure types with no\n * side effects. The BB app imports these to keep its real implementation in\n * sync (`satisfies PluginSdkApp`). Plugin authors import the same shapes through\n * `@bb/plugin-sdk/app`.\n *\n * Per-slot props are versioned contracts: additive-only within an SDK major.\n */\n/** Props passed to a `homepageSection` component. */\ninterface PluginHomepageSectionProps {\n /** Project in view on the compose surface; null when none is selected. */\n projectId: string | null;\n}\n/**\n * Props passed to a `settingsSection` component.\n *\n * Deliberately empty in V1; versioned additive like the other slot props.\n */\ninterface PluginSettingsSectionProps {\n}\n/** Props passed to a `navPanel` component (it owns its whole route). */\ninterface PluginNavPanelProps {\n /**\n * The route remainder after the panel root, \"\" at the root. The panel's\n * route is `/plugins///*`, so a deep link like\n * `/plugins/notes/notes/work/ideas.md` renders the panel with\n * `subPath: \"work/ideas.md\"`. Navigate within the panel via\n * `useBbNavigate().toPluginPanel(path, { subPath })` — browser\n * back/forward then walks panel-internal history.\n */\n subPath: string;\n}\n/** Props passed to a panel tab opened by a `threadPanelAction`. */\ninterface PluginThreadPanelProps {\n threadId: string;\n /**\n * The JSON value the action's `openPanel` call passed (round-tripped\n * through persistence, so the tab restores across reloads); null when the\n * action opened the panel without params.\n */\n params: JsonValue$1 | null;\n}\n/** Props passed to a `composerAccessory` component. */\ninterface PluginComposerAccessoryProps {\n projectId: string | null;\n threadId: string | null;\n}\ninterface PluginPendingInteractionView {\n id: string;\n threadId: string;\n title: string;\n payload: JsonValue$1;\n createdAt: number;\n expiresAt: number | null;\n}\ninterface PluginPendingInteractionProps {\n interaction: PluginPendingInteractionView;\n submit(value: JsonValue$1): Promise;\n cancel(): Promise;\n}\n/**\n * Props for a `sidebarFooterAction` — host-rendered (no plugin component).\n * Deliberately empty; the registration's `run` carries the behavior.\n */\ninterface PluginSidebarFooterActionProps {\n}\n/**\n * Where a file being opened by a `fileOpener` lives. `path` semantics follow\n * the source: workspace paths are relative to the environment's worktree,\n * thread-storage paths are relative to the thread's storage root, host paths\n * are absolute on the thread's host.\n */\ninterface PluginFileOpenerSource {\n kind: \"workspace\" | \"host\" | \"thread-storage\";\n threadId: string | null;\n environmentId: string | null;\n projectId: string | null;\n}\n/** Props passed to a `fileOpener` component (rendered as a panel file tab). */\ninterface PluginFileOpenerProps {\n path: string;\n source: PluginFileOpenerSource;\n}\n/**\n * Message context passed to a `messageDirective` component — the assistant\n * (or nested agent) message that contained the directive.\n */\ninterface PluginMessageDirectiveMessage {\n id: string;\n threadId: string;\n turnId: string | null;\n projectId: string | null;\n}\n/**\n * Open a worktree-relative file in the host's workspace file viewer. Returns\n * true when the host accepted the path; false when the path is invalid or the\n * viewer declined it.\n */\ntype PluginMessageDirectiveOpenWorkspaceFile = (path: string) => boolean;\ninterface PluginMessageDirectiveThreadPanelOptions {\n /** A `threadPanelAction` id registered by this same plugin. */\n actionId: string;\n title?: string;\n params?: JsonValue$1;\n}\n/** Open this plugin's registered action in the current thread side panel. */\ntype PluginMessageDirectiveOpenThreadPanel = (options: PluginMessageDirectiveThreadPanelOptions) => boolean;\n/**\n * Props passed to a `messageDirective` component. Attributes are untrusted\n * strings parsed from the directive; the plugin validates its own fields.\n */\ninterface PluginMessageDirectiveProps {\n /** Parsed, untrusted directive attributes (e.g. `{ file: \"demo.html\" }`). */\n attributes: Readonly>;\n /** Original directive source text (useful for diagnostics / crash fallback). */\n source: string;\n message: PluginMessageDirectiveMessage;\n /**\n * Opens a worktree-relative file in the host's workspace file viewer. Null\n * when the message surface has no workspace viewer available.\n */\n openWorkspaceFile: PluginMessageDirectiveOpenWorkspaceFile | null;\n /**\n * Opens one of this plugin's own `threadPanelAction` components in the\n * current thread side panel. Omitted by older hosts; null on message\n * surfaces without a thread panel.\n */\n openThreadPanel?: PluginMessageDirectiveOpenThreadPanel | null;\n}\ninterface PluginHomepageSectionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n title: string;\n component: ComponentType;\n}\ninterface PluginSettingsSectionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Optional host-rendered section heading. */\n title?: string;\n /**\n * Optional one-line host-rendered subheading under `title`, in the built-in\n * SettingsSection idiom (ignored when `title` is absent).\n */\n description?: string;\n component: ComponentType;\n}\ninterface PluginNavPanelRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n title: string;\n /** Icon hint (BB icon name); unknown names fall back to a generic icon. */\n icon: string;\n /** URL segment under `/plugins//`; letters, digits, `-`, `_`. */\n path: string;\n component: ComponentType;\n /**\n * Optional component rendered on the right side of the shared title bar\n * (e.g. a sync button or a count). Contained separately from the body: a\n * throwing headerContent is hidden without breaking the title bar.\n */\n headerContent?: ComponentType;\n}\n/** Context handed to a `threadPanelAction`'s `run`. */\ninterface PluginThreadPanelActionContext {\n /** The thread whose panel launcher invoked the action. */\n threadId: string;\n /**\n * Open a tab in the thread's side panel rendering this action's\n * `component`. `title` labels the tab (default: the action's `title`);\n * `params` must be JSON-serializable — it is persisted with the tab and\n * reaches the component as its `params` prop. Opening with params\n * identical to an already-open tab of this action focuses that tab\n * (updating its title) instead of duplicating it. May be called more than\n * once (different params ⇒ multiple tabs) or not at all.\n */\n openPanel(options?: {\n title?: string;\n params?: JsonValue$1;\n }): void;\n}\ninterface PluginThreadPanelActionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Label of the action row in the panel's new-tab launcher. */\n title: string;\n /**\n * Icon hint (BB icon name) used when the plugin ships no logo; the\n * launcher row and opened tabs prefer the plugin's logo.\n */\n icon?: string;\n /** Rendered inside every panel tab this action opens. */\n component: ComponentType;\n /**\n * Runs when the user activates the action: call your RPC methods, show a\n * toast, and/or open panel tabs via `context.openPanel`. Omitted =\n * immediately open a panel tab with defaults. Errors (sync or async) are\n * contained and logged; they never break the launcher.\n */\n run?(context: PluginThreadPanelActionContext): void | Promise;\n}\ninterface PluginComposerAccessoryRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n component: ComponentType;\n}\ninterface PluginPendingInteractionRegistration {\n /** Matches `rendererId` passed to `bb.ui.requestInput`. */\n id: string;\n component: ComponentType;\n}\n/** Context handed to a `sidebarFooterAction`'s `run`. */\ninterface PluginSidebarFooterActionContext {\n /**\n * Navigate to this plugin's Settings detail page\n * (`/settings/plugins/`), where declarative settings and\n * `settingsSection` slots render.\n */\n openSettings(): void;\n}\n/**\n * An icon button in the app sidebar footer (next to Settings / bug report).\n * Host-rendered for consistent chrome — plugins supply icon, label, and\n * `run` behavior only.\n */\ninterface PluginSidebarFooterActionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Tooltip and accessible label for the icon button. */\n title: string;\n /** Icon hint (BB icon name); unknown names fall back to a generic icon. */\n icon: string;\n /**\n * Runs when the user activates the action (e.g. call `openSettings()`,\n * open a panel via other surfaces, toast). Errors (sync or async) are\n * contained and logged; they never break the sidebar.\n */\n run(context: PluginSidebarFooterActionContext): void | Promise;\n}\n/**\n * Register this plugin as a viewer/editor for file extensions. The user\n * picks (and can set as default) an opener per extension via the file tab's\n * \"Open with\" menu; matching files opened in the panel then render\n * `component` in a plugin tab instead of the built-in preview. Applies to\n * working-tree, host, and thread-storage files — never to git-ref snapshots\n * (diff views always use the built-in preview). The built-in preview stays\n * one menu click away, and a missing/disabled opener falls back to it.\n */\ninterface PluginFileOpenerRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Label in the \"Open with\" menu (e.g. \"Notes editor\"). */\n title: string;\n /** Lowercase extensions without the dot (e.g. [\"md\", \"mdx\"]). */\n extensions: readonly string[];\n component: ComponentType;\n}\n/**\n * Register a leaf message directive rendered inside assistant (and nested\n * agent) message Markdown. `id` is the directive name: `inline-vis` matches\n * `::inline-vis{file=\"demo.html\"}`.\n */\ninterface PluginMessageDirectiveRegistration {\n /**\n * The directive name. Lowercase kebab-case beginning with a letter.\n */\n id: string;\n component: ComponentType;\n}\ninterface PluginAppSlots {\n homepageSection(registration: PluginHomepageSectionRegistration): void;\n settingsSection(registration: PluginSettingsSectionRegistration): void;\n navPanel(registration: PluginNavPanelRegistration): void;\n threadPanelAction(registration: PluginThreadPanelActionRegistration): void;\n composerAccessory(registration: PluginComposerAccessoryRegistration): void;\n pendingInteraction(registration: PluginPendingInteractionRegistration): void;\n sidebarFooterAction(registration: PluginSidebarFooterActionRegistration): void;\n fileOpener(registration: PluginFileOpenerRegistration): void;\n messageDirective(registration: PluginMessageDirectiveRegistration): void;\n}\ninterface PluginAppBuilder {\n slots: PluginAppSlots;\n}\ntype PluginAppSetup = (app: PluginAppBuilder) => void;\n/**\n * The opaque product of `definePluginApp` — a plugin's `app.tsx` default\n * export. The host re-runs `setup` against a fresh collector on every\n * (re)interpretation, replacing that plugin's registrations wholesale.\n */\ninterface PluginAppDefinition {\n /** Brand the host checks before interpreting a bundle's default export. */\n readonly __bbPluginApp: true;\n readonly setup: PluginAppSetup;\n}\ninterface PluginRpcClient {\n /**\n * Invoke one of the plugin's `bb.rpc` methods (POST\n * /api/v1/plugins/<id>/rpc/<method>). Resolves with the method's\n * inferred output; rejects with an `Error` carrying the server's message,\n * stable `code`, and validation `issues` when present.\n */\n call>(method: Method, ...args: PluginRpcCallArgs): Promise>;\n}\ninterface PluginSettingsState {\n /**\n * Effective non-secret setting values (secret settings are excluded —\n * read them server-side). Undefined while loading or unavailable.\n */\n values: Record | undefined;\n isLoading: boolean;\n}\n/** State of the app's shared realtime connection to the bb server. */\ntype PluginRealtimeConnectionState = \"connecting\" | \"connected\" | \"reconnecting\";\n/** Where `useComposer()` writes: the active thread's draft or the new-thread draft. */\ntype PluginComposerScope = {\n kind: \"thread\";\n threadId: string;\n} | {\n kind: \"new-thread\";\n projectId: string | null;\n};\n/** An @-mention pill bound to one of the calling plugin's mention providers. */\ninterface PluginComposerMention {\n /** Mention provider id registered by THIS plugin via `bb.ui.registerMentionProvider`. */\n provider: string;\n /** Item id your provider's `resolve` will receive at send time. */\n id: string;\n /** Pill text shown in the composer. */\n label: string;\n}\n/**\n * Programmatic access to the chat composer draft — the same shared draft the\n * built-in \"Add to chat\" affordances (file preview, diff, terminal selections)\n * write to. Inside a thread context writes land in that thread's draft;\n * anywhere else (nav panel, homepage section) they seed the new-thread\n * composer draft, which persists until the user sends or clears it.\n */\ninterface PluginComposerApi {\n scope: PluginComposerScope;\n /** Current plain text for this composer scope. */\n readonly text: string;\n /**\n * Replace the draft's plain text. Attachments are preserved. Inline mentions\n * outside the changed range are preserved and rebased; mentions overlapped\n * by the replacement are removed because their text representation changed.\n */\n setText(next: string): void;\n /**\n * Replace the draft's plain text from the latest committed value. Uses the\n * same structured-state reconciliation as `setText`.\n */\n updateText(updater: (current: string) => string): void;\n /** Clear plain text without clearing independently attached files. */\n clear(): void;\n /**\n * Append text to the draft as a `> ` blockquote block and focus the\n * composer. Blank text is a no-op. This is the \"reference this selection\n * in chat\" primitive.\n */\n addQuote(text: string): void;\n /**\n * Insert an @-mention pill that resolves through this plugin's mention\n * provider at send time — the durable way to reference an entity whose\n * content should be fetched fresh when the message is sent.\n */\n insertMention(mention: PluginComposerMention): void;\n /** Focus the composer caret at the end of the draft. */\n focus(): void;\n}\n/** Current app selection, derived from the route. */\ninterface BbContext {\n projectId: string | null;\n threadId: string | null;\n}\ninterface BbNavigate {\n toThread(threadId: string): void;\n toProject(projectId: string): void;\n /**\n * Navigate to one of this plugin's own nav panels by its `path`.\n * `subPath` targets a location inside the panel (the component's\n * `subPath` prop); `replace` swaps the current history entry instead of\n * pushing — use it for redirects so back does not bounce.\n */\n toPluginPanel(path: string, options?: {\n subPath?: string;\n replace?: boolean;\n }): void;\n /**\n * Navigate to the root compose surface (the new-thread screen). Pass\n * `initialPrompt` to seed the composer draft and `focusPrompt` to focus the\n * composer on arrival — the pairing behind \"Create via chat\" style entry\n * points that drop the user into chat with a prefilled prompt.\n */\n toCompose(options?: {\n initialPrompt?: string;\n focusPrompt?: boolean;\n }): void;\n}\n/**\n * Everything `@bb/plugin-sdk/app` resolves to at runtime. The BB app builds\n * the real implementation and `satisfies` this interface; `bb plugin build`\n * shims the specifier to that object on `globalThis.__bbPluginRuntime`.\n */\ninterface PluginSdkApp {\n definePluginApp(setup: PluginAppSetup): PluginAppDefinition;\n useRpc(): PluginRpcClient;\n useRealtime(channel: string, handler: (payload: unknown) => void): void;\n /**\n * Observe the same shared connection that delivers `useRealtime` signals.\n * Use a subsequent transition to `connected` to reconcile server state that\n * may have changed while ephemeral signals could not be delivered. The first\n * connection can transition from `connecting` and is not a reconnection.\n */\n useRealtimeConnectionState(): PluginRealtimeConnectionState;\n useSettings(): PluginSettingsState;\n useBbContext(): BbContext;\n useBbNavigate(): BbNavigate;\n useComposer(): PluginComposerApi;\n}\n\n/**\n * App-wide server-backed preferences.\n * Client-local settings stay in the frontend localStorage helpers instead.\n */\ndeclare const appSettingsSchema: z$1.ZodObject<{\n caffeinate: z$1.ZodBoolean;\n showKeyboardHints: z$1.ZodBoolean;\n showUnhandledProviderEvents: z$1.ZodBoolean;\n codexMemoryEnabled: z$1.ZodBoolean;\n claudeCodeMemoryEnabled: z$1.ZodBoolean;\n codexSubagentsDisabled: z$1.ZodBoolean;\n claudeCodeSubagentsDisabled: z$1.ZodBoolean;\n claudeCodeWorkflowsDisabled: z$1.ZodBoolean;\n}, z$1.core.$strict>;\ntype AppSettings = z$1.infer;\n\ndeclare const appKeybindingOverridesSchema: z$1.ZodArray;\n shortcut: z$1.ZodNullable>;\n}, z$1.core.$strict>>;\ntype AppKeybindingOverrides = z$1.infer;\n\ndeclare const appThemeSchema: z$1.ZodObject<{\n themeId: z$1.ZodString;\n customCss: z$1.ZodNullable;\n faviconColor: z$1.ZodEnum<{\n default: \"default\";\n red: \"red\";\n orange: \"orange\";\n yellow: \"yellow\";\n green: \"green\";\n teal: \"teal\";\n blue: \"blue\";\n purple: \"purple\";\n pink: \"pink\";\n }>;\n}, z$1.core.$strip>;\ntype AppTheme = z$1.infer;\n/**\n * The complete appearance selection a client sends when changing the palette\n * and/or favicon tint. The server validates `themeId` (built-in id or an\n * existing custom theme) and resolves the CSS from disk for custom themes.\n * Callers changing only one facet must carry the other facet forward explicitly.\n */\ndeclare const appThemeSelectionSchema: z$1.ZodObject<{\n themeId: z$1.ZodString;\n faviconColor: z$1.ZodEnum<{\n default: \"default\";\n red: \"red\";\n orange: \"orange\";\n yellow: \"yellow\";\n green: \"green\";\n teal: \"teal\";\n blue: \"blue\";\n purple: \"purple\";\n pink: \"pink\";\n }>;\n}, z$1.core.$strip>;\ntype AppThemeSelection = z$1.infer;\n\ndeclare const changedMessageSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"changed\">;\n entity: z$1.ZodLiteral<\"thread\">;\n id: z$1.ZodOptional;\n metadata: z$1.ZodOptional;\n eventTypes: z$1.ZodOptional>>>>;\n hasPendingInteraction: z$1.ZodOptional;\n projectId: z$1.ZodOptional;\n }, z$1.core.$strict>>;\n changes: z$1.ZodReadonly>>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"changed\">;\n entity: z$1.ZodLiteral<\"project\">;\n id: z$1.ZodOptional;\n changes: z$1.ZodReadonly>>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"changed\">;\n entity: z$1.ZodLiteral<\"environment\">;\n id: z$1.ZodOptional;\n changes: z$1.ZodReadonly>>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"changed\">;\n entity: z$1.ZodLiteral<\"host\">;\n id: z$1.ZodOptional;\n changes: z$1.ZodReadonly>>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"changed\">;\n entity: z$1.ZodLiteral<\"system\">;\n changes: z$1.ZodReadonly>>;\n}, z$1.core.$strict>], \"entity\">;\ntype ChangedMessage = z$1.infer;\n\ndeclare const environmentSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n name: z$1.ZodNullable;\n projectId: z$1.ZodString;\n hostId: z$1.ZodString;\n path: z$1.ZodNullable;\n managed: z$1.ZodBoolean;\n isGitRepo: z$1.ZodBoolean;\n isWorktree: z$1.ZodBoolean;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n branchName: z$1.ZodNullable;\n baseBranch: z$1.ZodNullable;\n defaultBranch: z$1.ZodNullable;\n mergeBaseBranch: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n ready: \"ready\";\n retiring: \"retiring\";\n destroying: \"destroying\";\n destroyed: \"destroyed\";\n }>;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype Environment = z$1.infer;\n\n/**\n * User-opt-in experiments (the Settings → Experiments toggles). Distinct from\n * `FeatureFlags`: flags are operator-set via env at server start, experiments\n * are user-toggled at runtime and persisted server-side so server-owned\n * policy (e.g. skill injection) can honor them.\n *\n * Every experiment defaults to off — opting in is the point.\n */\ndeclare const experimentsSchema: z$1.ZodObject<{\n claudeCodeMockCliTraffic: z$1.ZodBoolean;\n threadSplits: z$1.ZodBoolean;\n plugins: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype Experiments = z$1.infer;\n\ndeclare const hostSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n name: z$1.ZodString;\n type: z$1.ZodEnum<{\n persistent: \"persistent\";\n }>;\n status: z$1.ZodEnum<{\n connected: \"connected\";\n disconnected: \"disconnected\";\n }>;\n lastSeenAt: z$1.ZodNullable;\n lastRejectedProtocolVersion: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype Host = z$1.infer;\n\ninterface JsonObject {\n [key: string]: JsonValue;\n}\ntype JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;\n\ndeclare const pendingInteractionResolutionSchema: z$1.ZodUnion;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"allow_for_session\">;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"deny\">;\n}, z$1.core.$strip>], \"decision\">, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_answer\">;\n answers: z$1.ZodRecord;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin_submitted\">;\n}, z$1.core.$strip>]>;\ntype PendingInteractionResolution = z$1.infer;\ndeclare const providerPendingInteractionSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n resolved: \"resolved\";\n }>;\n statusReason: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n expiresAt: z$1.ZodOptional>;\n resolvedAt: z$1.ZodNullable;\n turnId: z$1.ZodString;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n origin: z$1.ZodOptional;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n }, z$1.core.$strip>>;\n payload: z$1.ZodUnion;\n subject: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n itemId: z$1.ZodString;\n command: z$1.ZodString;\n cwd: z$1.ZodNullable;\n actions: z$1.ZodArray;\n command: z$1.ZodString;\n name: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"listFiles\">;\n command: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"search\">;\n command: z$1.ZodString;\n query: z$1.ZodNullable;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"unknown\">;\n command: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n sessionGrant: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"file_change\">;\n itemId: z$1.ZodString;\n writeScope: z$1.ZodNullable;\n sessionGrant: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"permission_grant\">;\n itemId: z$1.ZodString;\n toolName: z$1.ZodNullable;\n permissions: z$1.ZodObject<{\n network: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>;\n }, z$1.core.$strip>], \"kind\">;\n reason: z$1.ZodNullable;\n availableDecisions: z$1.ZodArray>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_question\">;\n questions: z$1.ZodArray;\n multiSelect: z$1.ZodBoolean;\n options: z$1.ZodOptional;\n }, z$1.core.$strip>>>;\n allowFreeText: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>]>;\n resolution: z$1.ZodNullable;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"allow_for_session\">;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"deny\">;\n }, z$1.core.$strip>], \"decision\">, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_answer\">;\n answers: z$1.ZodRecord;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>]>>;\n}, z$1.core.$strip>;\ntype ProviderPendingInteraction = z$1.infer;\ndeclare const pluginPendingInteractionSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n resolved: \"resolved\";\n }>;\n statusReason: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n expiresAt: z$1.ZodOptional>;\n resolvedAt: z$1.ZodNullable;\n turnId: z$1.ZodNullable;\n origin: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n rendererId: z$1.ZodString;\n }, z$1.core.$strip>;\n payload: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n title: z$1.ZodString;\n data: z$1.ZodType>;\n }, z$1.core.$strip>;\n resolution: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype PluginPendingInteraction = z$1.infer;\ntype PendingInteraction = ProviderPendingInteraction | PluginPendingInteraction;\n\ndeclare const projectSourceSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n projectId: z$1.ZodString;\n isDefault: z$1.ZodBoolean;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n type: z$1.ZodLiteral<\"local_path\">;\n hostId: z$1.ZodString;\n path: z$1.ZodString;\n}, z$1.core.$strip>;\ntype ProjectSource = z$1.infer;\n\ndeclare const resolvedThreadExecutionOptionsSchema: z$1.ZodObject<{\n seq: z$1.ZodOptional;\n model: z$1.ZodString;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n source: z$1.ZodEnum<{\n \"client/thread/start\": \"client/thread/start\";\n \"client/turn/requested\": \"client/turn/requested\";\n \"client/turn/start\": \"client/turn/start\";\n }>;\n}, z$1.core.$strip>;\ntype ResolvedThreadExecutionOptions = z$1.infer;\ndeclare const projectExecutionDefaultsSchema: z$1.ZodObject<{\n providerId: z$1.ZodString;\n model: z$1.ZodString;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n}, z$1.core.$strip>;\ntype ProjectExecutionDefaults = z$1.infer;\n\n/** All thread events — provider-originated or system-originated. */\ndeclare const threadEventSchema: z$1.ZodPipe;\n threadId: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/identity\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"turn/started\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"turn/completed\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n error: z$1.ZodOptional>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"turn/input/accepted\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n clientRequestId: z$1.ZodString;\n scope: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"turn\">;\n turnId: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n}, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/name/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n threadName: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/compacted\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/goal/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n objective: z$1.ZodString;\n status: z$1.ZodEnum<{\n paused: \"paused\";\n active: \"active\";\n budgetLimited: \"budgetLimited\";\n complete: \"complete\";\n }>;\n tokenBudget: z$1.ZodNullable;\n tokensUsed: z$1.ZodNumber;\n timeUsedSeconds: z$1.ZodNumber;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/goal/cleared\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/started\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n item: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"userMessage\">;\n id: z$1.ZodString;\n content: z$1.ZodArray;\n text: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n clientRequestId: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"agentMessage\">;\n id: z$1.ZodString;\n text: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commandExecution\">;\n id: z$1.ZodString;\n command: z$1.ZodString;\n cwd: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n approvalStatus: z$1.ZodNullable>;\n aggregatedOutput: z$1.ZodOptional;\n exitCode: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n truncation: z$1.ZodOptional>;\n result: z$1.ZodOptional>;\n resultText: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"fileChange\">;\n id: z$1.ZodString;\n changes: z$1.ZodArray;\n movePath: z$1.ZodOptional;\n diff: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n approvalStatus: z$1.ZodNullable>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"webSearch\">;\n id: z$1.ZodString;\n queries: z$1.ZodArray;\n resultText: z$1.ZodNullable;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"webFetch\">;\n id: z$1.ZodString;\n url: z$1.ZodString;\n prompt: z$1.ZodNullable;\n pattern: z$1.ZodNullable;\n resultText: z$1.ZodNullable;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"imageView\">;\n id: z$1.ZodString;\n path: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"toolCall\">;\n id: z$1.ZodString;\n server: z$1.ZodOptional;\n tool: z$1.ZodString;\n arguments: z$1.ZodOptional>;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n result: z$1.ZodOptional;\n error: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n truncation: z$1.ZodOptional>;\n result: z$1.ZodOptional>;\n resultText: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"reasoning\">;\n id: z$1.ZodString;\n summary: z$1.ZodArray;\n content: z$1.ZodArray;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"plan\">;\n id: z$1.ZodString;\n text: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"contextCompaction\">;\n id: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"backgroundTask\">;\n id: z$1.ZodString;\n taskType: z$1.ZodString;\n description: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n running: \"running\";\n paused: \"paused\";\n completed: \"completed\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n skipTranscript: z$1.ZodBoolean;\n workflowName: z$1.ZodOptional;\n workflow: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodOptional>;\n summary: z$1.ZodOptional;\n error: z$1.ZodOptional;\n outputFile: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/completed\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n item: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"userMessage\">;\n id: z$1.ZodString;\n content: z$1.ZodArray;\n text: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n clientRequestId: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"agentMessage\">;\n id: z$1.ZodString;\n text: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commandExecution\">;\n id: z$1.ZodString;\n command: z$1.ZodString;\n cwd: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n approvalStatus: z$1.ZodNullable>;\n aggregatedOutput: z$1.ZodOptional;\n exitCode: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n truncation: z$1.ZodOptional>;\n result: z$1.ZodOptional>;\n resultText: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"fileChange\">;\n id: z$1.ZodString;\n changes: z$1.ZodArray;\n movePath: z$1.ZodOptional;\n diff: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n approvalStatus: z$1.ZodNullable>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"webSearch\">;\n id: z$1.ZodString;\n queries: z$1.ZodArray;\n resultText: z$1.ZodNullable;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"webFetch\">;\n id: z$1.ZodString;\n url: z$1.ZodString;\n prompt: z$1.ZodNullable;\n pattern: z$1.ZodNullable;\n resultText: z$1.ZodNullable;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"imageView\">;\n id: z$1.ZodString;\n path: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"toolCall\">;\n id: z$1.ZodString;\n server: z$1.ZodOptional;\n tool: z$1.ZodString;\n arguments: z$1.ZodOptional>;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n result: z$1.ZodOptional;\n error: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n truncation: z$1.ZodOptional>;\n result: z$1.ZodOptional>;\n resultText: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"reasoning\">;\n id: z$1.ZodString;\n summary: z$1.ZodArray;\n content: z$1.ZodArray;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"plan\">;\n id: z$1.ZodString;\n text: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"contextCompaction\">;\n id: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"backgroundTask\">;\n id: z$1.ZodString;\n taskType: z$1.ZodString;\n description: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n running: \"running\";\n paused: \"paused\";\n completed: \"completed\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n skipTranscript: z$1.ZodBoolean;\n workflowName: z$1.ZodOptional;\n workflow: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodOptional>;\n summary: z$1.ZodOptional;\n error: z$1.ZodOptional;\n outputFile: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/agentMessage/delta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/commandExecution/outputDelta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n reset: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/fileChange/outputDelta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/reasoning/summaryTextDelta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/reasoning/textDelta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/plan/delta\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n delta: z$1.ZodString;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/mcpToolCall/progress\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n message: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/toolCall/progress\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n itemId: z$1.ZodString;\n message: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/backgroundTask/progress\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n item: z$1.ZodObject<{\n type: z$1.ZodLiteral<\"backgroundTask\">;\n id: z$1.ZodString;\n taskType: z$1.ZodString;\n description: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n running: \"running\";\n paused: \"paused\";\n completed: \"completed\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n skipTranscript: z$1.ZodBoolean;\n workflowName: z$1.ZodOptional;\n workflow: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodOptional>;\n summary: z$1.ZodOptional;\n error: z$1.ZodOptional;\n outputFile: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"item/backgroundTask/completed\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n item: z$1.ZodObject<{\n type: z$1.ZodLiteral<\"backgroundTask\">;\n id: z$1.ZodString;\n taskType: z$1.ZodString;\n description: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n failed: \"failed\";\n interrupted: \"interrupted\";\n }>;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n running: \"running\";\n paused: \"paused\";\n completed: \"completed\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n skipTranscript: z$1.ZodBoolean;\n workflowName: z$1.ZodOptional;\n workflow: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodOptional>;\n summary: z$1.ZodOptional;\n error: z$1.ZodOptional;\n outputFile: z$1.ZodOptional;\n parentToolCallId: z$1.ZodOptional;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/tokenUsage/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n tokenUsage: z$1.ZodObject<{\n total: z$1.ZodObject<{\n totalTokens: z$1.ZodNumber;\n inputTokens: z$1.ZodNumber;\n cachedInputTokens: z$1.ZodNumber;\n outputTokens: z$1.ZodNumber;\n reasoningOutputTokens: z$1.ZodNumber;\n }, z$1.core.$strip>;\n last: z$1.ZodObject<{\n totalTokens: z$1.ZodNumber;\n inputTokens: z$1.ZodNumber;\n cachedInputTokens: z$1.ZodNumber;\n outputTokens: z$1.ZodNumber;\n reasoningOutputTokens: z$1.ZodNumber;\n }, z$1.core.$strip>;\n modelContextWindow: z$1.ZodNullable;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"thread/contextWindowUsage/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n contextWindowUsage: z$1.ZodObject<{\n usedTokens: z$1.ZodNullable;\n modelContextWindow: z$1.ZodNullable;\n estimated: z$1.ZodBoolean;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"turn/plan/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n plan: z$1.ZodArray>;\n }, z$1.core.$strip>>;\n explanation: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"turn/diff/updated\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n diff: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider/error\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n message: z$1.ZodString;\n detail: z$1.ZodOptional;\n willRetry: z$1.ZodOptional;\n errorInfo: z$1.ZodOptional;\n providerCode: z$1.ZodNullable;\n httpStatusCode: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider/warning\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n category: z$1.ZodEnum<{\n deprecation: \"deprecation\";\n config: \"config\";\n general: \"general\";\n }>;\n summary: z$1.ZodOptional;\n details: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider/modelFallback\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n originalModel: z$1.ZodString;\n fallbackModel: z$1.ZodString;\n reason: z$1.ZodEnum<{\n refusal: \"refusal\";\n provider: \"provider\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider/unhandled\">;\n threadId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerId: z$1.ZodString;\n rawType: z$1.ZodString;\n rawEvent: z$1.ZodObject<{\n jsonrpc: z$1.ZodLiteral<\"2.0\">;\n id: z$1.ZodOptional>;\n method: z$1.ZodString;\n params: z$1.ZodOptional>>;\n }, z$1.core.$strip>;\n parentToolCallId: z$1.ZodOptional;\n}, z$1.core.$strip>], \"type\">, z$1.ZodObject<{\n scope: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"turn\">;\n turnId: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n}, z$1.core.$strip>>, z$1.ZodIntersection;\n threadId: z$1.ZodString;\n direction: z$1.ZodLiteral<\"outbound\">;\n source: z$1.ZodEnum<{\n spawn: \"spawn\";\n tell: \"tell\";\n }>;\n initiator: z$1.ZodEnum<{\n system: \"system\";\n user: \"user\";\n agent: \"agent\";\n }>;\n request: z$1.ZodObject<{\n method: z$1.ZodEnum<{\n \"thread/start\": \"thread/start\";\n \"turn/start\": \"turn/start\";\n }>;\n params: z$1.ZodRecord;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"client/turn/requested\">;\n threadId: z$1.ZodString;\n direction: z$1.ZodLiteral<\"outbound\">;\n requestId: z$1.ZodString;\n source: z$1.ZodEnum<{\n spawn: \"spawn\";\n tell: \"tell\";\n }>;\n initiator: z$1.ZodEnum<{\n system: \"system\";\n user: \"user\";\n agent: \"agent\";\n }>;\n senderThreadId: z$1.ZodNullable;\n systemMessageKind: z$1.ZodOptional>;\n systemMessageSubject: z$1.ZodOptional;\n threadId: z$1.ZodString;\n threadName: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread-batch\">;\n count: z$1.ZodNumber;\n }, z$1.core.$strip>], \"kind\">>>;\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n inputGroups: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>>>;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread-start\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"new-turn\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"auto\">;\n expectedTurnId: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"steer\">;\n expectedTurnId: z$1.ZodNullable;\n }, z$1.core.$strip>], \"kind\">;\n request: z$1.ZodObject<{\n method: z$1.ZodEnum<{\n \"thread/start\": \"thread/start\";\n \"turn/start\": \"turn/start\";\n }>;\n params: z$1.ZodRecord;\n }, z$1.core.$strip>;\n execution: z$1.ZodObject<{\n seq: z$1.ZodOptional;\n model: z$1.ZodString;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n source: z$1.ZodEnum<{\n \"client/thread/start\": \"client/thread/start\";\n \"client/turn/requested\": \"client/turn/requested\";\n \"client/turn/start\": \"client/turn/start\";\n }>;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"client/turn/start\">;\n threadId: z$1.ZodString;\n direction: z$1.ZodLiteral<\"outbound\">;\n source: z$1.ZodEnum<{\n spawn: \"spawn\";\n tell: \"tell\";\n }>;\n initiator: z$1.ZodEnum<{\n system: \"system\";\n user: \"user\";\n agent: \"agent\";\n }>;\n request: z$1.ZodObject<{\n method: z$1.ZodEnum<{\n \"thread/start\": \"thread/start\";\n \"turn/start\": \"turn/start\";\n }>;\n params: z$1.ZodRecord;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/error\">;\n threadId: z$1.ZodString;\n code: z$1.ZodOptional;\n message: z$1.ZodString;\n detail: z$1.ZodOptional;\n reconnectAttempt: z$1.ZodOptional;\n reconnectTotal: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/manager/user_message\">;\n threadId: z$1.ZodString;\n text: z$1.ZodString;\n toolCallId: z$1.ZodOptional;\n turnId: z$1.ZodOptional;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/thread/interrupted\">;\n threadId: z$1.ZodString;\n reason: z$1.ZodEnum<{\n \"manual-stop\": \"manual-stop\";\n \"host-daemon-restarted\": \"host-daemon-restarted\";\n \"provider-turn-idle\": \"provider-turn-idle\";\n }>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/operation\">;\n threadId: z$1.ZodString;\n operation: z$1.ZodString;\n status: z$1.ZodString;\n message: z$1.ZodString;\n operationId: z$1.ZodString;\n metadata: z$1.ZodOptional>>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/permissionGrant/lifecycle\">;\n threadId: z$1.ZodString;\n interactionId: z$1.ZodString;\n providerId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n resolved: \"resolved\";\n }>;\n resolution: z$1.ZodDefault;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"allow_for_session\">;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"deny\">;\n }, z$1.core.$strip>], \"decision\">>>;\n statusReason: z$1.ZodDefault>;\n subject: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"permission_grant\">;\n itemId: z$1.ZodString;\n toolName: z$1.ZodNullable;\n permissions: z$1.ZodObject<{\n network: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/userQuestion/lifecycle\">;\n threadId: z$1.ZodString;\n interactionId: z$1.ZodString;\n providerId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n resolved: \"resolved\";\n }>;\n resolution: z$1.ZodDefault;\n answers: z$1.ZodRecord;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>>;\n statusReason: z$1.ZodDefault>;\n payload: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_question\">;\n questions: z$1.ZodArray;\n multiSelect: z$1.ZodBoolean;\n options: z$1.ZodOptional;\n }, z$1.core.$strip>>>;\n allowFreeText: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/thread-provisioning\">;\n threadId: z$1.ZodString;\n provisioningId: z$1.ZodString;\n status: z$1.ZodEnum<{\n completed: \"completed\";\n failed: \"failed\";\n active: \"active\";\n cancelled: \"cancelled\";\n }>;\n environmentId: z$1.ZodString;\n entries: z$1.ZodArray;\n key: z$1.ZodString;\n text: z$1.ZodString;\n startedAt: z$1.ZodOptional;\n status: z$1.ZodOptional>;\n metadata: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"system/provider-turn-watchdog\">;\n threadId: z$1.ZodString;\n reason: z$1.ZodLiteral<\"provider-turn-idle\">;\n thresholdMs: z$1.ZodNumber;\n elapsedMs: z$1.ZodNumber;\n activeTurnId: z$1.ZodString;\n activeTurnStartedAt: z$1.ZodNumber;\n lastActivityEventSequence: z$1.ZodNumber;\n lastActivityEventType: z$1.ZodString;\n lastActivityEventAt: z$1.ZodNumber;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodNullable;\n firedAt: z$1.ZodNumber;\n}, z$1.core.$strip>]>, z$1.ZodObject<{\n scope: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"turn\">;\n turnId: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n}, z$1.core.$strip>>]>>;\ntype ThreadEvent = z$1.infer;\ntype ThreadEventType = ThreadEvent[\"type\"];\n\ndeclare const providerInfoSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n displayName: z$1.ZodString;\n logoUrl: z$1.ZodNullable;\n capabilities: z$1.ZodObject<{\n supportsArchive: z$1.ZodBoolean;\n supportsRename: z$1.ZodBoolean;\n supportsServiceTier: z$1.ZodBoolean;\n supportsUserQuestion: z$1.ZodBoolean;\n supportsFork: z$1.ZodBoolean;\n supportedPermissionModes: z$1.ZodArray>;\n }, z$1.core.$strip>;\n composerActions: z$1.ZodArray;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plan\">;\n command: z$1.ZodObject<{\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n trailingText: z$1.ZodString;\n }, z$1.core.$strip>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"goal\">;\n command: z$1.ZodObject<{\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n trailingText: z$1.ZodString;\n }, z$1.core.$strip>;\n }, z$1.core.$strip>], \"kind\">>;\n available: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype ProviderInfo = z$1.infer;\n\ndeclare const threadEventScopeSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread\">;\n}, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"turn\">;\n turnId: z$1.ZodString;\n}, z$1.core.$strip>], \"kind\">;\ntype ThreadEventScope = z$1.infer;\n\ntype ThreadEventByType = {\n [TType in ThreadEventType]: Extract;\n};\ntype ThreadEventForType = ThreadEventByType[TType];\ntype StoredThreadEventDataFromEvent = Omit;\ninterface ThreadEventRowBase {\n id: string;\n scope: ThreadEventScope;\n threadId: string;\n seq: number;\n createdAt: number;\n}\ntype ThreadEventRowFromEvent = ThreadEventRowBase & {\n type: TEvent[\"type\"];\n data: StoredThreadEventDataFromEvent;\n};\ntype ThreadEventRowOfType = ThreadEventRowFromEvent>;\ntype ThreadEventRow = {\n [TType in ThreadEventType]: ThreadEventRowOfType;\n}[ThreadEventType];\n\ndeclare const threadStatusSchema: z$1.ZodEnum<{\n error: \"error\";\n active: \"active\";\n starting: \"starting\";\n idle: \"idle\";\n stopping: \"stopping\";\n}>;\ntype ThreadStatus = z$1.infer;\n\ndeclare const threadTimelinePendingTodosSchema: z$1.ZodObject<{\n sourceSeq: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n items: z$1.ZodArray;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype ThreadTimelinePendingTodos = z$1.infer;\n\ndeclare const threadQueuedMessageSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n content: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodString;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n groupWithNext: z$1.ZodBoolean;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype ThreadQueuedMessage = z$1.infer;\n\ndeclare const workspaceFileListResponseSchema: z$1.ZodObject<{\n files: z$1.ZodArray>;\n truncated: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype WorkspaceFileListResponse = z$1.infer;\ndeclare const workspacePathListResponseSchema: z$1.ZodObject<{\n paths: z$1.ZodArray;\n path: z$1.ZodString;\n name: z$1.ZodString;\n score: z$1.ZodNumber;\n positions: z$1.ZodArray;\n }, z$1.core.$strip>>;\n truncated: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype WorkspacePathListResponse = z$1.infer;\n\ndeclare const createProjectSourceRequestSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n hostId: z$1.ZodString;\n type: z$1.ZodLiteral<\"local_path\">;\n path: z$1.ZodPipe>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n hostId: z$1.ZodString;\n type: z$1.ZodLiteral<\"clone\">;\n targetPath: z$1.ZodOptional>>;\n remoteUrl: z$1.ZodOptional;\n}, z$1.core.$strict>], \"type\">;\ntype CreateProjectSourceRequest = z$1.infer;\ndeclare const createProjectRequestSchema: z$1.ZodObject<{\n name: z$1.ZodString;\n source: z$1.ZodObject<{\n hostId: z$1.ZodString;\n type: z$1.ZodLiteral<\"local_path\">;\n path: z$1.ZodPipe>;\n }, z$1.core.$strict>;\n}, z$1.core.$strip>;\ntype CreateProjectRequest = z$1.infer;\ndeclare const threadFolderSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n name: z$1.ZodString;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n}, z$1.core.$strict>;\ntype ThreadFolderResponse = z$1.infer;\ndeclare const createThreadFolderRequestSchema: z$1.ZodObject<{\n name: z$1.ZodString;\n}, z$1.core.$strict>;\ntype CreateThreadFolderRequest = z$1.infer;\ndeclare const updateThreadFolderRequestSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n name: z$1.ZodString;\n}, z$1.core.$strict>;\ntype UpdateThreadFolderRequest = z$1.infer;\ndeclare const deleteThreadFolderRequestSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n}, z$1.core.$strict>;\ntype DeleteThreadFolderRequest = z$1.infer;\ndeclare const threadFolderMutationResponseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n name: z$1.ZodString;\n updatedThreadCount: z$1.ZodNumber;\n}, z$1.core.$strict>;\ntype ThreadFolderMutationResponse = z$1.infer;\ndeclare const reorderProjectRequestSchema: z$1.ZodObject<{\n previousProjectId: z$1.ZodNullable;\n nextProjectId: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype ReorderProjectRequest = z$1.infer;\ndeclare const projectListQuerySchema: z$1.ZodObject<{\n include: z$1.ZodOptional;\n includePersonal: z$1.ZodOptional>;\n}, z$1.core.$strip>;\ntype ProjectListQuery = z$1.infer;\ndeclare const projectFilesQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional>;\n limit: z$1.ZodOptional>;\n hostId: z$1.ZodOptional;\n environmentId: z$1.ZodOptional, z$1.ZodOptional>>;\n}, z$1.core.$strip>;\ntype ProjectFilesQuery = z$1.infer;\ndeclare const projectPathsQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional>;\n limit: z$1.ZodOptional>;\n includeFiles: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n includeDirectories: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n hostId: z$1.ZodOptional;\n environmentId: z$1.ZodOptional, z$1.ZodOptional>>;\n}, z$1.core.$strip>;\ntype ProjectPathsQuery = z$1.infer;\ndeclare const projectFileContentQuerySchema: z$1.ZodObject<{\n path: z$1.ZodString;\n hostId: z$1.ZodOptional;\n environmentId: z$1.ZodOptional, z$1.ZodOptional>>;\n}, z$1.core.$strip>;\ntype ProjectFileContentQuery = z$1.infer;\ndeclare const projectBranchesQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional;\n limit: z$1.ZodOptional;\n hostId: z$1.ZodString;\n selectedBranch: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ProjectBranchesQuery = z$1.infer;\ndeclare const projectBranchesResponseSchema: z$1.ZodObject<{\n branches: z$1.ZodArray;\n branchesTruncated: z$1.ZodBoolean;\n checkout: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"branch\">;\n branchName: z$1.ZodString;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"detached\">;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unborn\">;\n branchName: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n defaultBranch: z$1.ZodNullable;\n defaultBranchRelation: z$1.ZodNullable>;\n hasUncommittedChanges: z$1.ZodBoolean;\n operation: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"none\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"merge\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"rebase\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"cherry-pick\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"revert\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>], \"kind\">;\n originDefaultBranch: z$1.ZodNullable;\n remoteBranches: z$1.ZodArray;\n remoteBranchesTruncated: z$1.ZodBoolean;\n selectedBranch: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n defaultWorktreeBaseBranch: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype ProjectBranchesResponse = z$1.infer;\ndeclare const promptHistoryQuerySchema: z$1.ZodObject<{\n limit: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype PromptHistoryQuery = z$1.infer;\ndeclare const promptHistoryResponseSchema: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n}, z$1.core.$strip>>;\ntype PromptHistoryResponse = z$1.infer;\ndeclare const updateProjectRequestSchema: z$1.ZodObject<{\n name: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype UpdateProjectRequest = z$1.infer;\ndeclare const updateProjectSourceRequestSchema: z$1.ZodObject<{\n type: z$1.ZodLiteral<\"local_path\">;\n path: z$1.ZodOptional>>;\n isDefault: z$1.ZodOptional>;\n}, z$1.core.$strict>;\ntype UpdateProjectSourceRequest = z$1.infer;\ndeclare const commandListResponseSchema: z$1.ZodObject<{\n commands: z$1.ZodArray;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n description: z$1.ZodNullable;\n argumentHint: z$1.ZodNullable;\n pluginId: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype CommandListResponse = z$1.infer;\n/** Query for the complete command catalog available to a project and provider. */\ndeclare const projectCommandsQuerySchema: z$1.ZodObject<{\n provider: z$1.ZodString;\n hostId: z$1.ZodOptional;\n environmentId: z$1.ZodOptional, z$1.ZodOptional>>;\n}, z$1.core.$strict>;\ntype ProjectCommandsQuery = z$1.infer;\ndeclare const projectResponseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodEnum<{\n personal: \"personal\";\n standard: \"standard\";\n }>;\n name: z$1.ZodString;\n gitRemoteUrl: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n sources: z$1.ZodArray;\n hostId: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype ProjectResponse = z$1.infer;\ndeclare const projectWithThreadsResponseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodEnum<{\n personal: \"personal\";\n standard: \"standard\";\n }>;\n name: z$1.ZodString;\n gitRemoteUrl: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n sources: z$1.ZodArray;\n hostId: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>>;\n threads: z$1.ZodArray;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n activity: z$1.ZodObject<{\n activeWorkflowCount: z$1.ZodNumber;\n activeBackgroundAgentCount: z$1.ZodNumber;\n activeBackgroundCommandCount: z$1.ZodNumber;\n activePlanModeCount: z$1.ZodNumber;\n activeGoalCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n pinSortKey: z$1.ZodNullable;\n hasPendingInteraction: z$1.ZodBoolean;\n environmentHostId: z$1.ZodNullable;\n environmentName: z$1.ZodNullable;\n environmentBranchName: z$1.ZodNullable;\n environmentWorkspaceDisplayKind: z$1.ZodEnum<{\n \"managed-worktree\": \"managed-worktree\";\n \"unmanaged-worktree\": \"unmanaged-worktree\";\n other: \"other\";\n }>;\n }, z$1.core.$strip>>;\n defaultExecutionOptions: z$1.ZodNullable;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype ProjectWithThreadsResponse = z$1.infer;\ndeclare const uploadedPromptAttachmentSchema: z$1.ZodObject<{\n type: z$1.ZodEnum<{\n localImage: \"localImage\";\n localFile: \"localFile\";\n }>;\n path: z$1.ZodString;\n name: z$1.ZodString;\n mimeType: z$1.ZodOptional;\n sizeBytes: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype UploadedPromptAttachment = z$1.infer;\n\ndeclare const updateEnvironmentRequestSchema: z$1.ZodObject<{\n mergeBaseBranch: z$1.ZodOptional>;\n name: z$1.ZodOptional>;\n}, z$1.core.$strip>;\ntype UpdateEnvironmentRequest = z$1.infer;\n/**\n * Query for searching paths in an environment's workspace. Unlike the\n * project-scoped variant this needs no `environmentId` — the environment is\n * the route param — and is project-agnostic, so it works for projectless\n * (personal) environments too.\n */\ndeclare const environmentPathsQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional;\n limit: z$1.ZodOptional;\n includeFiles: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n includeDirectories: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n}, z$1.core.$strip>;\ntype EnvironmentPathsQuery = z$1.infer;\ndeclare const environmentDiffBranchesQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional;\n limit: z$1.ZodOptional;\n selectedBranch: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype EnvironmentDiffBranchesQuery = z$1.infer;\ndeclare const environmentDiffBranchesResponseSchema: z$1.ZodObject<{\n branches: z$1.ZodArray;\n branchesTruncated: z$1.ZodBoolean;\n remoteBranches: z$1.ZodArray;\n remoteBranchesTruncated: z$1.ZodBoolean;\n selectedBranch: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype EnvironmentDiffBranchesResponse = z$1.infer;\ndeclare const environmentStatusQuerySchema: z$1.ZodObject<{\n mergeBaseBranch: z$1.ZodOptional>;\n}, z$1.core.$strip>;\ntype EnvironmentStatusQuery = z$1.infer;\ndeclare const environmentDiffQuerySchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n target: z$1.ZodLiteral<\"uncommitted\">;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseBranch: z$1.ZodPipe;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"all\">;\n mergeBaseBranch: z$1.ZodPipe;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n}, z$1.core.$strip>], \"target\">;\ntype EnvironmentDiffQuery = z$1.infer;\n/**\n * Query for fetching a single file's contents at one side of a diff target.\n * Used by the diff card to reparse the card's patch with full old/new contents\n * so `@pierre/diffs` can render expand-context buttons between hunks.\n *\n * For `branch_committed` / `all`, callers pass the resolved merge-base SHA\n * (`mergeBaseRef`, surfaced by `workspace.diff`) rather than the branch name\n * — the diff itself was computed against that SHA, so reading the old side\n * from the same SHA keeps the file content aligned with the hunk line\n * numbers. Reading from the branch tip is wrong whenever the branch has\n * moved past the merge-base since the file existed there.\n */\ndeclare const environmentDiffFileQuerySchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n target: z$1.ZodLiteral<\"uncommitted\">;\n path: z$1.ZodString;\n side: z$1.ZodEnum<{\n old: \"old\";\n new: \"new\";\n }>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseRef: z$1.ZodString;\n path: z$1.ZodString;\n side: z$1.ZodEnum<{\n old: \"old\";\n new: \"new\";\n }>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"all\">;\n mergeBaseRef: z$1.ZodString;\n path: z$1.ZodString;\n side: z$1.ZodEnum<{\n old: \"old\";\n new: \"new\";\n }>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n target: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n path: z$1.ZodString;\n side: z$1.ZodEnum<{\n old: \"old\";\n new: \"new\";\n }>;\n}, z$1.core.$strip>], \"target\">;\ntype EnvironmentDiffFileQuery = z$1.infer;\ndeclare const environmentDiffFileResponseSchema: z$1.ZodObject<{\n path: z$1.ZodString;\n content: z$1.ZodString;\n contentEncoding: z$1.ZodEnum<{\n base64: \"base64\";\n utf8: \"utf8\";\n }>;\n mimeType: z$1.ZodOptional;\n sizeBytes: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype EnvironmentDiffFileResponse = z$1.infer;\ndeclare const environmentArchiveThreadsResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n archivedThreadIds: z$1.ZodArray;\n}, z$1.core.$strip>;\ntype EnvironmentArchiveThreadsResponse = z$1.infer;\ndeclare const pullRequestMergeMethodSchema: z$1.ZodEnum<{\n merge: \"merge\";\n rebase: \"rebase\";\n squash: \"squash\";\n}>;\ntype PullRequestMergeMethod = z$1.infer;\ndeclare const commitActionResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n action: z$1.ZodLiteral<\"commit\">;\n message: z$1.ZodString;\n commitSha: z$1.ZodString;\n commitSubject: z$1.ZodString;\n}, z$1.core.$strip>;\ntype CommitActionResponse = z$1.infer;\ndeclare const squashMergeActionResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n action: z$1.ZodLiteral<\"squash_merge\">;\n merged: z$1.ZodBoolean;\n message: z$1.ZodString;\n commitSha: z$1.ZodString;\n commitSubject: z$1.ZodString;\n}, z$1.core.$strip>;\ntype SquashMergeActionResponse = z$1.infer;\ndeclare const pullRequestReadyActionResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n action: z$1.ZodLiteral<\"pull_request_ready\">;\n message: z$1.ZodString;\n}, z$1.core.$strip>;\ntype PullRequestReadyActionResponse = z$1.infer;\ndeclare const pullRequestMergeActionResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n action: z$1.ZodLiteral<\"pull_request_merge\">;\n method: z$1.ZodEnum<{\n merge: \"merge\";\n rebase: \"rebase\";\n squash: \"squash\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strip>;\ntype PullRequestMergeActionResponse = z$1.infer;\ndeclare const pullRequestDraftActionResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n action: z$1.ZodLiteral<\"pull_request_draft\">;\n message: z$1.ZodString;\n}, z$1.core.$strip>;\ntype PullRequestDraftActionResponse = z$1.infer;\ndeclare const environmentStatusResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n workspace: z$1.ZodObject<{\n workingTree: z$1.ZodObject<{\n insertions: z$1.ZodNumber;\n deletions: z$1.ZodNumber;\n files: z$1.ZodArray;\n insertions: z$1.ZodNullable;\n deletions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n hasUncommittedChanges: z$1.ZodBoolean;\n state: z$1.ZodEnum<{\n clean: \"clean\";\n untracked: \"untracked\";\n dirty_uncommitted: \"dirty_uncommitted\";\n committed_unmerged: \"committed_unmerged\";\n dirty_and_committed_unmerged: \"dirty_and_committed_unmerged\";\n }>;\n }, z$1.core.$strip>;\n checkout: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"branch\">;\n branchName: z$1.ZodString;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"detached\">;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unborn\">;\n branchName: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n branch: z$1.ZodObject<{\n currentBranch: z$1.ZodNullable;\n defaultBranch: z$1.ZodString;\n }, z$1.core.$strip>;\n mergeBase: z$1.ZodNullable;\n insertions: z$1.ZodNullable;\n deletions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n mergeBaseBranch: z$1.ZodString;\n baseRef: z$1.ZodNullable;\n aheadCount: z$1.ZodNumber;\n behindCount: z$1.ZodNumber;\n hasCommittedUnmergedChanges: z$1.ZodBoolean;\n commits: z$1.ZodArray>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"not_applicable\">;\n reason: z$1.ZodEnum<{\n non_git_environment: \"non_git_environment\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n unknown: \"unknown\";\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>], \"outcome\">;\n/**\n * Structured pull-request lookup outcome. \"absent\" is a real answer — the\n * host checked and the branch has no PR (non-git environments resolve to\n * \"absent\" without a daemon call). \"unavailable\" means the lookup itself\n * failed (gh missing, not authenticated, timeout, unreachable workspace), so\n * callers must not render it as \"no PR exists\".\n */\ndeclare const environmentPullRequestResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n pullRequest: z$1.ZodObject<{\n number: z$1.ZodNumber;\n title: z$1.ZodString;\n state: z$1.ZodEnum<{\n merged: \"merged\";\n draft: \"draft\";\n open: \"open\";\n closed: \"closed\";\n }>;\n url: z$1.ZodString;\n baseRefName: z$1.ZodString;\n headRefName: z$1.ZodString;\n updatedAt: z$1.ZodString;\n checks: z$1.ZodObject<{\n state: z$1.ZodEnum<{\n unknown: \"unknown\";\n pending: \"pending\";\n passing: \"passing\";\n failing: \"failing\";\n no_checks: \"no_checks\";\n }>;\n totalCount: z$1.ZodNumber;\n passedCount: z$1.ZodNumber;\n failedCount: z$1.ZodNumber;\n pendingCount: z$1.ZodNumber;\n }, z$1.core.$strict>;\n review: z$1.ZodObject<{\n state: z$1.ZodEnum<{\n none: \"none\";\n approved: \"approved\";\n changes_requested: \"changes_requested\";\n review_required: \"review_required\";\n review_requested: \"review_requested\";\n }>;\n reviewRequestCount: z$1.ZodNumber;\n }, z$1.core.$strict>;\n mergeability: z$1.ZodObject<{\n state: z$1.ZodEnum<{\n unknown: \"unknown\";\n draft: \"draft\";\n mergeable: \"mergeable\";\n conflicts: \"conflicts\";\n blocked: \"blocked\";\n }>;\n mergeStateStatus: z$1.ZodNullable>;\n mergeable: z$1.ZodNullable>;\n }, z$1.core.$strict>;\n attention: z$1.ZodEnum<{\n none: \"none\";\n merged: \"merged\";\n draft: \"draft\";\n closed: \"closed\";\n changes_requested: \"changes_requested\";\n review_requested: \"review_requested\";\n conflicts: \"conflicts\";\n blocked: \"blocked\";\n checks_failed: \"checks_failed\";\n checks_pending: \"checks_pending\";\n ready_to_merge: \"ready_to_merge\";\n }>;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"absent\">;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n message: z$1.ZodString;\n}, z$1.core.$strict>], \"outcome\">;\ntype EnvironmentPullRequestResponse = z$1.infer;\ndeclare const environmentDiffResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n diff: z$1.ZodObject<{\n diff: z$1.ZodString;\n truncated: z$1.ZodBoolean;\n shortstat: z$1.ZodString;\n files: z$1.ZodString;\n mergeBaseRef: z$1.ZodNullable;\n }, z$1.core.$strip>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"not_applicable\">;\n reason: z$1.ZodEnum<{\n non_git_environment: \"non_git_environment\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n unknown: \"unknown\";\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>], \"outcome\">;\ntype EnvironmentDiffResponse = z$1.infer;\ndeclare const environmentDiffFilesResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n files: z$1.ZodArray;\n changeKind: z$1.ZodEnum<{\n deleted: \"deleted\";\n added: \"added\";\n modified: \"modified\";\n renamed: \"renamed\";\n copied: \"copied\";\n type_changed: \"type_changed\";\n }>;\n additions: z$1.ZodNumber;\n deletions: z$1.ZodNumber;\n binary: z$1.ZodBoolean;\n origin: z$1.ZodEnum<{\n untracked: \"untracked\";\n tracked: \"tracked\";\n }>;\n loadMode: z$1.ZodEnum<{\n auto: \"auto\";\n on_demand: \"on_demand\";\n too_large: \"too_large\";\n }>;\n }, z$1.core.$strip>>;\n shortstat: z$1.ZodString;\n mergeBaseRef: z$1.ZodNullable;\n initialPatches: z$1.ZodArray>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"not_applicable\">;\n reason: z$1.ZodEnum<{\n non_git_environment: \"non_git_environment\";\n too_many_files: \"too_many_files\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n unknown: \"unknown\";\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>], \"outcome\">;\ntype EnvironmentDiffFilesResponse = z$1.infer;\ndeclare const environmentDiffPatchResponseSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n patches: z$1.ZodArray>;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"not_applicable\">;\n reason: z$1.ZodEnum<{\n non_git_environment: \"non_git_environment\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n unknown: \"unknown\";\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>], \"outcome\">;\ntype EnvironmentDiffPatchResponse = z$1.infer;\n/**\n * Body for `POST /diff/patch`: the diff target plus the list of new paths whose\n * patches the client wants. A POST (not GET) because the repeated `paths` array\n * cannot survive flat query parsing. The client supplies only new paths; the\n * server re-derives each file's rename/copy pairing (`previousPath`) from its\n * own TOC.\n */\ndeclare const environmentDiffPatchRequestSchema: z$1.ZodObject<{\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"uncommitted\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"all\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">;\n paths: z$1.ZodArray;\n}, z$1.core.$strict>;\ntype EnvironmentDiffPatchRequest = z$1.infer;\ntype EnvironmentStatusResponse = z$1.infer;\n\ndeclare const providerUsageResponseSchema: z$1.ZodObject<{\n codex: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n claudeCode: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n cursor: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n}, z$1.core.$strip>;\ntype ProviderUsageResponse = z$1.infer;\ntype HostDaemonCommandTransport = \"settled\" | \"onlineRpc\";\ntype HostDaemonCommandEnvironmentLane = \"read\" | \"write\";\ntype HostDaemonFlushEventsBeforeResult = boolean | \"when-initiated\";\ninterface HostDaemonCommandDescriptor {\n type: Type;\n schema: Schema;\n resultSchema: ResultSchema;\n transport: Transport;\n retryable: Retryable;\n flushEventsBeforeResult: HostDaemonFlushEventsBeforeResult;\n envLane: HostDaemonCommandEnvironmentLane | null;\n}\ndeclare const hostDaemonCommandRegistry: {\n \"thread.start\": HostDaemonCommandDescriptor<\"thread.start\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n projectId: z$1.ZodString;\n providerId: z$1.ZodString;\n acpLaunchSpec: z$1.ZodOptional;\n env: z$1.ZodRecord;\n cwd: z$1.ZodOptional;\n modelCli: z$1.ZodOptional;\n selectFlag: z$1.ZodOptional;\n primaryModels: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodTransform<{\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n } | undefined, {\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n }>>>;\n reasoningCli: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n nativeReasoning: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n permissionCli: z$1.ZodOptional>;\n workspaceWrite: z$1.ZodOptional>;\n readonly: z$1.ZodOptional>;\n insertAfterArgs: z$1.ZodOptional;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n options: z$1.ZodIntersection;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n claudeCodePermissionMode: z$1.ZodOptional>;\n claudeCodeMockCliTraffic: z$1.ZodOptional>;\n workflowsEnabled: z$1.ZodBoolean;\n memoryEnabled: z$1.ZodOptional;\n providerSubagentsEnabled: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"full\">;\n permissionEscalation: z$1.ZodNull;\n }, z$1.core.$strip>, z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"workspace-write\">;\n permissionEscalation: z$1.ZodEnum<{\n ask: \"ask\";\n deny: \"deny\";\n }>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"readonly\">;\n permissionEscalation: z$1.ZodEnum<{\n ask: \"ask\";\n deny: \"deny\";\n }>;\n }, z$1.core.$strip>], \"permissionMode\">>;\n instructions: z$1.ZodString;\n dynamicTools: z$1.ZodArray>;\n injectedSkillSources: z$1.ZodArray;\n treeHash: z$1.ZodString;\n entryPath: z$1.ZodString;\n sourceType: z$1.ZodEnum<{\n builtin: \"builtin\";\n \"data-dir\": \"data-dir\";\n }>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n name: z$1.ZodString;\n description: z$1.ZodString;\n kind: z$1.ZodLiteral<\"workspace-path\">;\n sourceType: z$1.ZodLiteral<\"project\">;\n sourceRootPath: z$1.ZodString;\n skillFilePath: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n disallowedTools: z$1.ZodOptional>;\n instructionMode: z$1.ZodEnum<{\n append: \"append\";\n replace: \"replace\";\n }>;\n type: z$1.ZodLiteral<\"thread.start\">;\n requestId: z$1.ZodString;\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n builtin: \"builtin\";\n project: \"project\";\n user: \"user\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n inputGroups: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n builtin: \"builtin\";\n project: \"project\";\n user: \"user\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>>>;\n threadStoragePath: z$1.ZodOptional;\n fork: z$1.ZodOptional>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n providerThreadId: z$1.ZodString;\n }, z$1.core.$strip>, \"settled\", false>;\n \"turn.submit\": HostDaemonCommandDescriptor<\"turn.submit\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n type: z$1.ZodLiteral<\"turn.submit\">;\n requestId: z$1.ZodString;\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n builtin: \"builtin\";\n project: \"project\";\n user: \"user\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n inputGroups: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n builtin: \"builtin\";\n project: \"project\";\n user: \"user\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>>>;\n options: z$1.ZodIntersection;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n claudeCodePermissionMode: z$1.ZodOptional>;\n claudeCodeMockCliTraffic: z$1.ZodOptional>;\n workflowsEnabled: z$1.ZodBoolean;\n memoryEnabled: z$1.ZodOptional;\n providerSubagentsEnabled: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"full\">;\n permissionEscalation: z$1.ZodNull;\n }, z$1.core.$strip>, z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"workspace-write\">;\n permissionEscalation: z$1.ZodEnum<{\n ask: \"ask\";\n deny: \"deny\";\n }>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n permissionMode: z$1.ZodLiteral<\"readonly\">;\n permissionEscalation: z$1.ZodEnum<{\n ask: \"ask\";\n deny: \"deny\";\n }>;\n }, z$1.core.$strip>], \"permissionMode\">>;\n acpLaunchSpec: z$1.ZodOptional;\n env: z$1.ZodRecord;\n cwd: z$1.ZodOptional;\n modelCli: z$1.ZodOptional;\n selectFlag: z$1.ZodOptional;\n primaryModels: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodTransform<{\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n } | undefined, {\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n }>>>;\n reasoningCli: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n nativeReasoning: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n permissionCli: z$1.ZodOptional>;\n workspaceWrite: z$1.ZodOptional>;\n readonly: z$1.ZodOptional>;\n insertAfterArgs: z$1.ZodOptional;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n resumeContext: z$1.ZodObject<{\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n instructionMode: z$1.ZodEnum<{\n append: \"append\";\n replace: \"replace\";\n }>;\n projectId: z$1.ZodString;\n providerId: z$1.ZodString;\n acpLaunchSpec: z$1.ZodOptional;\n env: z$1.ZodRecord;\n cwd: z$1.ZodOptional;\n modelCli: z$1.ZodOptional;\n selectFlag: z$1.ZodOptional;\n primaryModels: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodTransform<{\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n } | undefined, {\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n }>>>;\n reasoningCli: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n nativeReasoning: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n permissionCli: z$1.ZodOptional>;\n workspaceWrite: z$1.ZodOptional>;\n readonly: z$1.ZodOptional>;\n insertAfterArgs: z$1.ZodOptional;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n instructions: z$1.ZodString;\n dynamicTools: z$1.ZodArray>;\n injectedSkillSources: z$1.ZodArray;\n treeHash: z$1.ZodString;\n entryPath: z$1.ZodString;\n sourceType: z$1.ZodEnum<{\n builtin: \"builtin\";\n \"data-dir\": \"data-dir\";\n }>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n name: z$1.ZodString;\n description: z$1.ZodString;\n kind: z$1.ZodLiteral<\"workspace-path\">;\n sourceType: z$1.ZodLiteral<\"project\">;\n sourceRootPath: z$1.ZodString;\n skillFilePath: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n disallowedTools: z$1.ZodOptional>;\n providerThreadId: z$1.ZodString;\n }, z$1.core.$strict>;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n mode: z$1.ZodLiteral<\"start\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n mode: z$1.ZodLiteral<\"auto\">;\n expectedTurnId: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n mode: z$1.ZodLiteral<\"steer\">;\n expectedTurnId: z$1.ZodNullable;\n }, z$1.core.$strip>], \"mode\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n appliedAs: z$1.ZodEnum<{\n steer: \"steer\";\n \"new-turn\": \"new-turn\";\n }>;\n }, z$1.core.$strip>, \"settled\", false>;\n \"thread.stop\": HostDaemonCommandDescriptor<\"thread.stop\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n type: z$1.ZodLiteral<\"thread.stop\">;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"thread.rename\": HostDaemonCommandDescriptor<\"thread.rename\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n type: z$1.ZodLiteral<\"thread.rename\">;\n title: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"thread.archive\": HostDaemonCommandDescriptor<\"thread.archive\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"thread.archive\">;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"thread.unarchive\": HostDaemonCommandDescriptor<\"thread.unarchive\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n type: z$1.ZodLiteral<\"thread.unarchive\">;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"interactive.resolve\": HostDaemonCommandDescriptor<\"interactive.resolve\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n threadId: z$1.ZodString;\n type: z$1.ZodLiteral<\"interactive.resolve\">;\n interactionId: z$1.ZodString;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n resolution: z$1.ZodUnion;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"allow_for_session\">;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"deny\">;\n }, z$1.core.$strip>], \"decision\">, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_answer\">;\n answers: z$1.ZodRecord;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin_submitted\">;\n }, z$1.core.$strip>]>;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"codex.inference.complete\": HostDaemonCommandDescriptor<\"codex.inference.complete\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"codex.inference.complete\">;\n model: z$1.ZodString;\n prompt: z$1.ZodString;\n outputSchema: z$1.ZodType>;\n timeoutMs: z$1.ZodNumber;\n }, z$1.core.$strict>, z$1.ZodObject<{\n model: z$1.ZodString;\n value: z$1.ZodType>;\n }, z$1.core.$strip>, \"settled\", false>;\n \"codex.voice.transcribe\": HostDaemonCommandDescriptor<\"codex.voice.transcribe\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"codex.voice.transcribe\">;\n model: z$1.ZodString;\n audioBase64: z$1.ZodString;\n mimeType: z$1.ZodString;\n filename: z$1.ZodString;\n prompt: z$1.ZodNullable;\n timeoutMs: z$1.ZodNumber;\n }, z$1.core.$strict>, z$1.ZodObject<{\n model: z$1.ZodString;\n text: z$1.ZodString;\n }, z$1.core.$strip>, \"settled\", false>;\n \"environment.provision\": HostDaemonCommandDescriptor<\"environment.provision\", z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n environmentId: z$1.ZodString;\n type: z$1.ZodLiteral<\"environment.provision\">;\n initiator: z$1.ZodNullable>;\n workspaceProvisionType: z$1.ZodLiteral<\"unmanaged\">;\n path: z$1.ZodString;\n checkout: z$1.ZodOptional;\n name: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"new\">;\n name: z$1.ZodString;\n baseBranch: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodString;\n type: z$1.ZodLiteral<\"environment.provision\">;\n initiator: z$1.ZodNullable>;\n sourcePath: z$1.ZodString;\n targetPath: z$1.ZodString;\n branchName: z$1.ZodString;\n baseBranch: z$1.ZodNullable;\n setupTimeoutMs: z$1.ZodNumber;\n workspaceProvisionType: z$1.ZodLiteral<\"managed-worktree\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodString;\n type: z$1.ZodLiteral<\"environment.provision\">;\n initiator: z$1.ZodNullable>;\n workspaceProvisionType: z$1.ZodLiteral<\"personal\">;\n targetPath: z$1.ZodString;\n }, z$1.core.$strict>], \"workspaceProvisionType\">, z$1.ZodObject<{\n path: z$1.ZodString;\n isGitRepo: z$1.ZodBoolean;\n isWorktree: z$1.ZodBoolean;\n branchName: z$1.ZodNullable;\n defaultBranch: z$1.ZodNullable;\n transcript: z$1.ZodArray;\n key: z$1.ZodString;\n text: z$1.ZodString;\n startedAt: z$1.ZodOptional;\n status: z$1.ZodOptional>;\n metadata: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, \"settled\", false>;\n \"project.clone\": HostDaemonCommandDescriptor<\"project.clone\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"project.clone\">;\n remoteUrl: z$1.ZodString;\n projectSlug: z$1.ZodString;\n targetPath: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodString;\n gitRemoteUrl: z$1.ZodNullable;\n }, z$1.core.$strict>, \"settled\", false>;\n \"environment.provision.cancel\": HostDaemonCommandDescriptor<\"environment.provision.cancel\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n type: z$1.ZodLiteral<\"environment.provision.cancel\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n aborted: z$1.ZodBoolean;\n }, z$1.core.$strip>, \"settled\", false>;\n \"environment.destroy\": HostDaemonCommandDescriptor<\"environment.destroy\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"environment.destroy\">;\n }, z$1.core.$strict>, z$1.ZodObject<{}, z$1.core.$strip>, \"settled\", false>;\n \"workspace.commit\": HostDaemonCommandDescriptor<\"workspace.commit\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.commit\">;\n message: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n commitSha: z$1.ZodString;\n commitSubject: z$1.ZodString;\n }, z$1.core.$strip>, \"settled\", false>;\n \"workspace.squash_merge\": HostDaemonCommandDescriptor<\"workspace.squash_merge\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.squash_merge\">;\n targetBranch: z$1.ZodString;\n commitMessage: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n commitSha: z$1.ZodString;\n commitSubject: z$1.ZodString;\n merged: z$1.ZodBoolean;\n }, z$1.core.$strip>, \"settled\", false>;\n \"workspace.pull_request_action\": HostDaemonCommandDescriptor<\"workspace.pull_request_action\", z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.pull_request_action\">;\n operation: z$1.ZodLiteral<\"ready\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.pull_request_action\">;\n operation: z$1.ZodLiteral<\"draft\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.pull_request_action\">;\n operation: z$1.ZodLiteral<\"merge\">;\n method: z$1.ZodEnum<{\n merge: \"merge\";\n squash: \"squash\";\n rebase: \"rebase\";\n }>;\n }, z$1.core.$strict>], \"operation\">, z$1.ZodObject<{}, z$1.core.$strict>, \"settled\", false>;\n \"host.list_files\": HostDaemonCommandDescriptor<\"host.list_files\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.list_files\">;\n path: z$1.ZodString;\n query: z$1.ZodOptional;\n limit: z$1.ZodNumber;\n }, z$1.core.$strip>, z$1.ZodObject<{\n files: z$1.ZodArray>;\n truncated: z$1.ZodBoolean;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.list_paths\": HostDaemonCommandDescriptor<\"host.list_paths\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.list_paths\">;\n path: z$1.ZodString;\n query: z$1.ZodOptional;\n limit: z$1.ZodNumber;\n includeFiles: z$1.ZodBoolean;\n includeDirectories: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n paths: z$1.ZodArray;\n path: z$1.ZodString;\n name: z$1.ZodString;\n score: z$1.ZodNumber;\n positions: z$1.ZodArray;\n }, z$1.core.$strip>>;\n truncated: z$1.ZodBoolean;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.mkdir\": HostDaemonCommandDescriptor<\"host.mkdir\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.mkdir\">;\n path: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n recursive: z$1.ZodBoolean;\n }, z$1.core.$strict>, z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n }, z$1.core.$strict>, \"onlineRpc\", false>;\n \"host.move_path\": HostDaemonCommandDescriptor<\"host.move_path\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.move_path\">;\n sourcePath: z$1.ZodString;\n destinationPath: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n }, z$1.core.$strict>, \"onlineRpc\", false>;\n \"host.remove_path\": HostDaemonCommandDescriptor<\"host.remove_path\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.remove_path\">;\n path: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n recursive: z$1.ZodBoolean;\n }, z$1.core.$strict>, z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n }, z$1.core.$strict>, \"onlineRpc\", false>;\n \"host.browse_directory\": HostDaemonCommandDescriptor<\"host.browse_directory\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.browse_directory\">;\n path: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n directory: z$1.ZodString;\n parent: z$1.ZodNullable;\n entries: z$1.ZodArray;\n name: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.paths_exist\": HostDaemonCommandDescriptor<\"host.paths_exist\", z$1.ZodObject<{\n paths: z$1.ZodPipe, z$1.ZodTransform>;\n type: z$1.ZodLiteral<\"host.paths_exist\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n existence: z$1.ZodRecord;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"project.inspect\": HostDaemonCommandDescriptor<\"project.inspect\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"project.inspect\">;\n path: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodString;\n gitRemoteUrl: z$1.ZodNullable;\n }, z$1.core.$strict>, \"onlineRpc\", true>;\n \"project.clone_default_path\": HostDaemonCommandDescriptor<\"project.clone_default_path\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"project.clone_default_path\">;\n projectSlug: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodString;\n }, z$1.core.$strict>, \"onlineRpc\", true>;\n \"host.pick_folder\": HostDaemonCommandDescriptor<\"host.pick_folder\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.pick_folder\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, \"onlineRpc\", false>;\n \"host.caffeinate\": HostDaemonCommandDescriptor<\"host.caffeinate\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.caffeinate\">;\n enabled: z$1.ZodBoolean;\n }, z$1.core.$strict>, z$1.ZodObject<{\n enabled: z$1.ZodBoolean;\n supported: z$1.ZodBoolean;\n }, z$1.core.$strict>, \"onlineRpc\", false>;\n \"connect-tunnel.ensure-identity\": HostDaemonCommandDescriptor<\"connect-tunnel.ensure-identity\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"connect-tunnel.ensure-identity\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n label: z$1.ZodString;\n baseDomain: z$1.ZodString;\n }, z$1.core.$strict>, \"onlineRpc\", true>;\n \"host.list_commands\": HostDaemonCommandDescriptor<\"host.list_commands\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.list_commands\">;\n providerId: z$1.ZodString;\n cwd: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n commands: z$1.ZodArray;\n origin: z$1.ZodEnum<{\n project: \"project\";\n user: \"user\";\n }>;\n description: z$1.ZodNullable;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.list_branches\": HostDaemonCommandDescriptor<\"host.list_branches\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.list_branches\">;\n path: z$1.ZodString;\n query: z$1.ZodOptional;\n selectedBranch: z$1.ZodOptional;\n limit: z$1.ZodNumber;\n }, z$1.core.$strip>, z$1.ZodObject<{\n branches: z$1.ZodArray;\n branchesTruncated: z$1.ZodBoolean;\n checkout: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"branch\">;\n branchName: z$1.ZodString;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"detached\">;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unborn\">;\n branchName: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n defaultBranch: z$1.ZodNullable;\n defaultBranchRelation: z$1.ZodNullable>;\n hasUncommittedChanges: z$1.ZodBoolean;\n operation: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"none\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"merge\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"rebase\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"cherry-pick\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"revert\">;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n hasConflicts: z$1.ZodBoolean;\n }, z$1.core.$strip>], \"kind\">;\n originDefaultBranch: z$1.ZodNullable;\n remoteBranches: z$1.ZodArray;\n remoteBranchesTruncated: z$1.ZodBoolean;\n selectedBranch: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.file_metadata\": HostDaemonCommandDescriptor<\"host.file_metadata\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.file_metadata\">;\n path: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodString;\n modifiedAtMs: z$1.ZodNumber;\n sizeBytes: z$1.ZodNumber;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.read_file\": HostDaemonCommandDescriptor<\"host.read_file\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.read_file\">;\n path: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n ref: z$1.ZodOptional;\n }, z$1.core.$strip>, z$1.ZodObject<{\n path: z$1.ZodString;\n content: z$1.ZodString;\n contentEncoding: z$1.ZodEnum<{\n base64: \"base64\";\n utf8: \"utf8\";\n }>;\n mimeType: z$1.ZodOptional;\n sizeBytes: z$1.ZodNumber;\n modifiedAtMs: z$1.ZodOptional;\n sha256: z$1.ZodString;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.read_file_relative\": HostDaemonCommandDescriptor<\"host.read_file_relative\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.read_file_relative\">;\n rootPath: z$1.ZodString;\n path: z$1.ZodString;\n dotfiles: z$1.ZodEnum<{\n deny: \"deny\";\n allow: \"allow\";\n }>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n path: z$1.ZodString;\n content: z$1.ZodString;\n contentEncoding: z$1.ZodEnum<{\n base64: \"base64\";\n utf8: \"utf8\";\n }>;\n mimeType: z$1.ZodOptional;\n sizeBytes: z$1.ZodNumber;\n modifiedAtMs: z$1.ZodOptional;\n sha256: z$1.ZodString;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"host.write_file\": HostDaemonCommandDescriptor<\"host.write_file\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host.write_file\">;\n path: z$1.ZodString;\n rootPath: z$1.ZodOptional;\n content: z$1.ZodString;\n contentEncoding: z$1.ZodEnum<{\n base64: \"base64\";\n utf8: \"utf8\";\n }>;\n createParents: z$1.ZodBoolean;\n expectedSha256: z$1.ZodOptional>;\n mode: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"written\">;\n sha256: z$1.ZodString;\n sizeBytes: z$1.ZodNumber;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"conflict\">;\n currentSha256: z$1.ZodNullable;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", false>;\n \"provider.list_models\": HostDaemonCommandDescriptor<\"provider.list_models\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider.list_models\">;\n providerId: z$1.ZodString;\n acpLaunchSpec: z$1.ZodOptional;\n env: z$1.ZodRecord;\n cwd: z$1.ZodOptional;\n modelCli: z$1.ZodOptional;\n selectFlag: z$1.ZodOptional;\n primaryModels: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodTransform<{\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n } | undefined, {\n listArgs: string[];\n primaryModels: string[];\n selectFlag?: string | undefined;\n }>>>;\n reasoningCli: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n nativeReasoning: z$1.ZodOptional>;\n levelValues: z$1.ZodOptional & z$1.core.$partial, z$1.ZodString>>;\n defaultLevel: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n permissionCli: z$1.ZodOptional>;\n workspaceWrite: z$1.ZodOptional>;\n readonly: z$1.ZodOptional>;\n insertAfterArgs: z$1.ZodOptional;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n models: z$1.ZodArray;\n description: z$1.ZodString;\n }, z$1.core.$strip>>;\n defaultReasoningEffort: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n isDefault: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n selectedOnlyModels: z$1.ZodArray;\n description: z$1.ZodString;\n }, z$1.core.$strip>>;\n defaultReasoningEffort: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n isDefault: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"known_acp_agents.status\": HostDaemonCommandDescriptor<\"known_acp_agents.status\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"known_acp_agents.status\">;\n agents: z$1.ZodArray>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n agents: z$1.ZodArray;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>, \"onlineRpc\", true>;\n \"provider.usage\": HostDaemonCommandDescriptor<\"provider.usage\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider.usage\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n codex: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n claudeCode: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n cursor: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n status: z$1.ZodLiteral<\"ok\">;\n planLabel: z$1.ZodNullable;\n windows: z$1.ZodArray;\n cost: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"not_installed\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"unauthenticated\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"expired\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n status: z$1.ZodLiteral<\"error\">;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"status\">;\n }, z$1.core.$strip>, \"onlineRpc\", true>;\n \"provider_cli.status\": HostDaemonCommandDescriptor<\"provider_cli.status\", z$1.ZodObject<{\n type: z$1.ZodLiteral<\"provider_cli.status\">;\n }, z$1.core.$strict>, z$1.ZodRecord, z$1.ZodObject<{\n displayName: z$1.ZodString;\n executableName: z$1.ZodString;\n executablePath: z$1.ZodNullable;\n installed: z$1.ZodBoolean;\n installSource: z$1.ZodEnum<{\n external: \"external\";\n notInstalled: \"notInstalled\";\n npmGlobal: \"npmGlobal\";\n }>;\n currentVersion: z$1.ZodNullable;\n latestVersion: z$1.ZodNullable;\n minimumSupportedVersion: z$1.ZodNullable;\n npmPackageName: z$1.ZodNullable;\n npmGlobalPackageVersion: z$1.ZodNullable;\n installAction: z$1.ZodNullable;\n label: z$1.ZodEnum<{\n Install: \"Install\";\n Update: \"Update\";\n }>;\n commandKind: z$1.ZodEnum<{\n exec: \"exec\";\n shell: \"shell\";\n }>;\n command: z$1.ZodString;\n }, z$1.core.$strip>>;\n needsUpdate: z$1.ZodBoolean;\n versionUnsupported: z$1.ZodBoolean;\n }, z$1.core.$strip>>, \"onlineRpc\", true>;\n \"provider_cli.install\": HostDaemonCommandDescriptor<\"provider_cli.install\", z$1.ZodObject<{\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n actionKind: z$1.ZodEnum<{\n install: \"install\";\n update: \"update\";\n }>;\n type: z$1.ZodLiteral<\"provider_cli.install\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n events: z$1.ZodArray;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n command: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"output\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n stream: z$1.ZodEnum<{\n stdout: \"stdout\";\n stderr: \"stderr\";\n }>;\n text: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"completed\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n exitCode: z$1.ZodNullable;\n signal: z$1.ZodNullable;\n success: z$1.ZodBoolean;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"error\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n message: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n }, z$1.core.$strict>, \"onlineRpc\", false>;\n \"workspace.status\": HostDaemonCommandDescriptor<\"workspace.status\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.status\">;\n mergeBaseBranch: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n workspaceStatus: z$1.ZodObject<{\n workingTree: z$1.ZodObject<{\n insertions: z$1.ZodNumber;\n deletions: z$1.ZodNumber;\n files: z$1.ZodArray;\n insertions: z$1.ZodNullable;\n deletions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n hasUncommittedChanges: z$1.ZodBoolean;\n state: z$1.ZodEnum<{\n clean: \"clean\";\n untracked: \"untracked\";\n dirty_uncommitted: \"dirty_uncommitted\";\n committed_unmerged: \"committed_unmerged\";\n dirty_and_committed_unmerged: \"dirty_and_committed_unmerged\";\n }>;\n }, z$1.core.$strip>;\n checkout: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"branch\">;\n branchName: z$1.ZodString;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"detached\">;\n headSha: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unborn\">;\n branchName: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"unknown\">;\n reason: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n branch: z$1.ZodObject<{\n currentBranch: z$1.ZodNullable;\n defaultBranch: z$1.ZodString;\n }, z$1.core.$strip>;\n mergeBase: z$1.ZodNullable;\n insertions: z$1.ZodNullable;\n deletions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n mergeBaseBranch: z$1.ZodString;\n baseRef: z$1.ZodNullable;\n aheadCount: z$1.ZodNumber;\n behindCount: z$1.ZodNumber;\n hasCommittedUnmergedChanges: z$1.ZodBoolean;\n commits: z$1.ZodArray>;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n unknown: \"unknown\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", true>;\n \"workspace.diff\": HostDaemonCommandDescriptor<\"workspace.diff\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.diff\">;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"uncommitted\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"all\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">;\n maxDiffBytes: z$1.ZodNumber;\n maxFileListBytes: z$1.ZodNumber;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n diff: z$1.ZodObject<{\n diff: z$1.ZodString;\n truncated: z$1.ZodBoolean;\n shortstat: z$1.ZodString;\n files: z$1.ZodString;\n mergeBaseRef: z$1.ZodNullable;\n }, z$1.core.$strip>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n unknown: \"unknown\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", true>;\n \"workspace.diffFiles\": HostDaemonCommandDescriptor<\"workspace.diffFiles\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.diffFiles\">;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"uncommitted\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"all\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n files: z$1.ZodArray;\n statusLetter: z$1.ZodEnum<{\n M: \"M\";\n A: \"A\";\n D: \"D\";\n R: \"R\";\n C: \"C\";\n T: \"T\";\n }>;\n additions: z$1.ZodNumber;\n deletions: z$1.ZodNumber;\n binary: z$1.ZodBoolean;\n origin: z$1.ZodEnum<{\n untracked: \"untracked\";\n tracked: \"tracked\";\n }>;\n }, z$1.core.$strip>>;\n shortstat: z$1.ZodString;\n mergeBaseRef: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n unknown: \"unknown\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", true>;\n \"workspace.diffPatch\": HostDaemonCommandDescriptor<\"workspace.diffPatch\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.diffPatch\">;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"uncommitted\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"branch_committed\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"all\">;\n mergeBaseBranch: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"commit\">;\n sha: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">;\n paths: z$1.ZodArray;\n maxBytesPerFile: z$1.ZodNumber;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n patches: z$1.ZodArray>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n failure: z$1.ZodObject<{\n code: z$1.ZodEnum<{\n path_not_found: \"path_not_found\";\n not_git_repo: \"not_git_repo\";\n not_worktree: \"not_worktree\";\n workspace_type_mismatch: \"workspace_type_mismatch\";\n permission_denied: \"permission_denied\";\n unknown_environment: \"unknown_environment\";\n unknown: \"unknown\";\n }>;\n workspacePath: z$1.ZodString;\n message: z$1.ZodString;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", true>;\n \"workspace.pull_request\": HostDaemonCommandDescriptor<\"workspace.pull_request\", z$1.ZodObject<{\n environmentId: z$1.ZodString;\n workspaceContext: z$1.ZodObject<{\n workspacePath: z$1.ZodString;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n }, z$1.core.$strip>;\n type: z$1.ZodLiteral<\"workspace.pull_request\">;\n }, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"available\">;\n pullRequest: z$1.ZodObject<{\n number: z$1.ZodNumber;\n title: z$1.ZodString;\n state: z$1.ZodEnum<{\n OPEN: \"OPEN\";\n CLOSED: \"CLOSED\";\n MERGED: \"MERGED\";\n }>;\n url: z$1.ZodString;\n isDraft: z$1.ZodBoolean;\n baseRefName: z$1.ZodString;\n headRefName: z$1.ZodString;\n updatedAt: z$1.ZodString;\n checks: z$1.ZodArray;\n conclusion: z$1.ZodNullable>;\n url: z$1.ZodNullable;\n }, z$1.core.$strict>>;\n reviewDecision: z$1.ZodNullable>;\n reviewRequestCount: z$1.ZodNumber;\n mergeStateStatus: z$1.ZodNullable>;\n mergeable: z$1.ZodNullable>;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"absent\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n outcome: z$1.ZodLiteral<\"unavailable\">;\n message: z$1.ZodString;\n }, z$1.core.$strict>], \"outcome\">, \"onlineRpc\", true>;\n};\ntype HostDaemonCommandRegistry = typeof hostDaemonCommandRegistry;\ntype AnyHostDaemonCommandDescriptor = HostDaemonCommandRegistry[keyof HostDaemonCommandRegistry];\ntype HostDaemonCommandDescriptorForTransport = Extract;\ntype HostDaemonResultSchemaMapForTransport = {\n [Descriptor in HostDaemonCommandDescriptorForTransport as Descriptor[\"type\"]]: Descriptor[\"resultSchema\"];\n};\ntype HostDaemonOnlineRpcResultSchemaMap = HostDaemonResultSchemaMapForTransport<\"onlineRpc\">;\ntype HostDaemonOnlineRpcResultByType = {\n [K in keyof HostDaemonOnlineRpcResultSchemaMap]: z$1.infer;\n};\n\ndeclare const pickFolderResponseSchema: z$1.ZodObject<{\n path: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype PickFolderResponse = z$1.infer;\ndeclare const pathsExistRequestSchema: z$1.ZodObject<{\n paths: z$1.ZodPipe, z$1.ZodTransform>;\n}, z$1.core.$strip>;\ntype PathsExistRequest = z$1.infer;\ndeclare const pathsExistResponseSchema: z$1.ZodObject<{\n existence: z$1.ZodRecord;\n}, z$1.core.$strip>;\ntype PathsExistResponse = z$1.infer;\ndeclare const providerCliStatusResponseSchema: z$1.ZodRecord, z$1.ZodObject<{\n displayName: z$1.ZodString;\n executableName: z$1.ZodString;\n executablePath: z$1.ZodNullable;\n installed: z$1.ZodBoolean;\n installSource: z$1.ZodEnum<{\n external: \"external\";\n notInstalled: \"notInstalled\";\n npmGlobal: \"npmGlobal\";\n }>;\n currentVersion: z$1.ZodNullable;\n latestVersion: z$1.ZodNullable;\n minimumSupportedVersion: z$1.ZodNullable;\n npmPackageName: z$1.ZodNullable;\n npmGlobalPackageVersion: z$1.ZodNullable;\n installAction: z$1.ZodNullable;\n label: z$1.ZodEnum<{\n Install: \"Install\";\n Update: \"Update\";\n }>;\n commandKind: z$1.ZodEnum<{\n exec: \"exec\";\n shell: \"shell\";\n }>;\n command: z$1.ZodString;\n }, z$1.core.$strip>>;\n needsUpdate: z$1.ZodBoolean;\n versionUnsupported: z$1.ZodBoolean;\n}, z$1.core.$strip>>;\ntype ProviderCliStatusResponse = z$1.infer;\ndeclare const providerCliInstallRequestSchema: z$1.ZodObject<{\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n actionKind: z$1.ZodEnum<{\n install: \"install\";\n update: \"update\";\n }>;\n}, z$1.core.$strip>;\ntype ProviderCliInstallRequest = z$1.infer;\ndeclare const providerCliInstallEventSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"started\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n command: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"output\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n stream: z$1.ZodEnum<{\n stdout: \"stdout\";\n stderr: \"stderr\";\n }>;\n text: z$1.ZodString;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"completed\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n exitCode: z$1.ZodNullable;\n signal: z$1.ZodNullable;\n success: z$1.ZodBoolean;\n}, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"error\">;\n provider: z$1.ZodEnum<{\n codex: \"codex\";\n claudeCode: \"claudeCode\";\n cursor: \"cursor\";\n }>;\n message: z$1.ZodString;\n}, z$1.core.$strip>], \"type\">;\ntype ProviderCliInstallEvent = z$1.infer;\n\ninterface CreateFilePreviewResponse {\n baseUrl: string;\n expiresAtMs: number;\n}\ntype HostFileReadResponse = HostDaemonOnlineRpcResultByType[\"host.read_file\"];\ntype HostFileWriteResponse = HostDaemonOnlineRpcResultByType[\"host.write_file\"];\ntype HostFileListResponse = HostDaemonOnlineRpcResultByType[\"host.list_files\"];\ntype HostPathListResponse = HostDaemonOnlineRpcResultByType[\"host.list_paths\"];\ntype HostMkdirResponse = HostDaemonOnlineRpcResultByType[\"host.mkdir\"];\ntype HostMovePathResponse = HostDaemonOnlineRpcResultByType[\"host.move_path\"];\ntype HostRemovePathResponse = HostDaemonOnlineRpcResultByType[\"host.remove_path\"];\n\n/**\n * Query for `GET /hosts/:id/directory`, the interactive path browser's\n * single-level directory read. `path` is an absolute directory on the host;\n * omitting it lists the host's home directory (the daemon resolves it, since a\n * remote caller cannot know the host's home).\n */\ndeclare const hostDirectoryQuerySchema: z$1.ZodObject<{\n path: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype HostDirectoryQuery = z$1.infer;\ndeclare const hostDirectoryListingSchema: z$1.ZodObject<{\n directory: z$1.ZodString;\n parent: z$1.ZodNullable;\n entries: z$1.ZodArray;\n name: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype HostDirectoryListing = z$1.infer;\n/** Project name is sent so the daemon can derive its host-local checkout path. */\ndeclare const hostCloneDefaultPathQuerySchema: z$1.ZodObject<{\n projectId: z$1.ZodString;\n}, z$1.core.$strip>;\ntype HostCloneDefaultPathQuery = z$1.infer;\ndeclare const hostCloneDefaultPathResponseSchema: z$1.ZodObject<{\n path: z$1.ZodString;\n}, z$1.core.$strict>;\ntype HostCloneDefaultPathResponse = z$1.infer;\ndeclare const createHostJoinCodeResponseSchema: z$1.ZodObject<{\n joinCode: z$1.ZodString;\n hostId: z$1.ZodString;\n expiresAt: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype CreateHostJoinCodeResponse = z$1.infer;\ndeclare const updateHostRequestSchema: z$1.ZodObject<{\n name: z$1.ZodString;\n}, z$1.core.$strict>;\ntype UpdateHostRequest = z$1.infer;\ntype HostPathsExistRequest = PathsExistRequest;\ntype HostPathsExistResponse = PathsExistResponse;\ndeclare const hostPickFolderRequestSchema: z$1.ZodObject<{\n clientHostId: z$1.ZodString;\n}, z$1.core.$strict>;\ntype HostPickFolderRequest = z$1.infer;\ntype HostPickFolderResponse = PickFolderResponse;\ntype HostProviderCliStatusResponse = ProviderCliStatusResponse;\ntype HostProviderCliInstallRequest = ProviderCliInstallRequest;\ntype HostProviderCliInstallEvent = ProviderCliInstallEvent;\n\ndeclare const pluginUpdateCheckEntrySchema: z$1.ZodObject<{\n id: z$1.ZodString;\n outcome: z$1.ZodEnum<{\n unavailable: \"unavailable\";\n incompatible: \"incompatible\";\n current: \"current\";\n \"update-available\": \"update-available\";\n pinned: \"pinned\";\n }>;\n devMode: z$1.ZodOptional>;\n installed: z$1.ZodObject<{\n version: z$1.ZodString;\n display: z$1.ZodString;\n }, z$1.core.$strip>;\n candidate: z$1.ZodOptional>;\n blocked: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n detail: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype PluginUpdateCheckEntry = z$1.infer;\ndeclare const pluginApplyUpdateResultSchema: z$1.ZodObject<{\n applied: z$1.ZodBoolean;\n from: z$1.ZodObject<{\n version: z$1.ZodString;\n display: z$1.ZodString;\n }, z$1.core.$strip>;\n to: z$1.ZodOptional>;\n outcome: z$1.ZodEnum<{\n current: \"current\";\n updated: \"updated\";\n \"rolled-back\": \"rolled-back\";\n }>;\n detail: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype PluginApplyUpdateResult$1 = z$1.infer;\ndeclare const pluginSourceDetailSchema: z$1.ZodObject<{\n requested: z$1.ZodString;\n resolved: z$1.ZodString;\n integrity: z$1.ZodOptional;\n registry: z$1.ZodOptional;\n engines: z$1.ZodObject<{\n bb: z$1.ZodOptional;\n bbPluginSdk: z$1.ZodOptional;\n }, z$1.core.$strip>;\n installedAt: z$1.ZodOptional;\n history: z$1.ZodArray>;\n}, z$1.core.$strip>;\ntype PluginSourceDetail = z$1.infer;\ndeclare const installedPluginSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n source: z$1.ZodString;\n rootDir: z$1.ZodString;\n version: z$1.ZodString;\n provenance: z$1.ZodEnum<{\n builtin: \"builtin\";\n direct: \"direct\";\n catalog: \"catalog\";\n }>;\n isOrphanedBuiltin: z$1.ZodBoolean;\n catalogEntryId: z$1.ZodOptional;\n sourceDisplay: z$1.ZodString;\n updateState: z$1.ZodObject<{\n outcome: z$1.ZodOptional>;\n availableVersion: z$1.ZodOptional;\n blockedVersion: z$1.ZodOptional;\n blockedReasons: z$1.ZodOptional>;\n lastCheckAt: z$1.ZodOptional;\n lastFailure: z$1.ZodOptional>;\n }, z$1.core.$strip>;\n enabled: z$1.ZodBoolean;\n description: z$1.ZodNullable;\n name: z$1.ZodNullable;\n icon: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n running: \"running\";\n missing: \"missing\";\n incompatible: \"incompatible\";\n disabled: \"disabled\";\n degraded: \"degraded\";\n \"needs-configuration\": \"needs-configuration\";\n }>;\n statusDetail: z$1.ZodNullable;\n handlerStats: z$1.ZodObject<{\n count: z$1.ZodNumber;\n totalMs: z$1.ZodNumber;\n maxMs: z$1.ZodNumber;\n errorCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n services: z$1.ZodArray;\n }, z$1.core.$strip>>;\n schedules: z$1.ZodArray;\n lastStatus: z$1.ZodNullable>;\n lastError: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n cliCommand: z$1.ZodNullable>;\n hasSettings: z$1.ZodBoolean;\n app: z$1.ZodObject<{\n hasApp: z$1.ZodBoolean;\n bundle: z$1.ZodNullable;\n hash: z$1.ZodString;\n sdkMajor: z$1.ZodNumber;\n sdkVersion: z$1.ZodString;\n compatible: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n logoUrl: z$1.ZodNullable;\n logoDarkUrl: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype InstalledPlugin = z$1.infer;\ndeclare const pluginListResponseSchema: z$1.ZodObject<{\n enabled: z$1.ZodBoolean;\n plugins: z$1.ZodArray;\n isOrphanedBuiltin: z$1.ZodBoolean;\n catalogEntryId: z$1.ZodOptional;\n sourceDisplay: z$1.ZodString;\n updateState: z$1.ZodObject<{\n outcome: z$1.ZodOptional>;\n availableVersion: z$1.ZodOptional;\n blockedVersion: z$1.ZodOptional;\n blockedReasons: z$1.ZodOptional>;\n lastCheckAt: z$1.ZodOptional;\n lastFailure: z$1.ZodOptional>;\n }, z$1.core.$strip>;\n enabled: z$1.ZodBoolean;\n description: z$1.ZodNullable;\n name: z$1.ZodNullable;\n icon: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n running: \"running\";\n missing: \"missing\";\n incompatible: \"incompatible\";\n disabled: \"disabled\";\n degraded: \"degraded\";\n \"needs-configuration\": \"needs-configuration\";\n }>;\n statusDetail: z$1.ZodNullable;\n handlerStats: z$1.ZodObject<{\n count: z$1.ZodNumber;\n totalMs: z$1.ZodNumber;\n maxMs: z$1.ZodNumber;\n errorCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n services: z$1.ZodArray;\n }, z$1.core.$strip>>;\n schedules: z$1.ZodArray;\n lastStatus: z$1.ZodNullable>;\n lastError: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n cliCommand: z$1.ZodNullable>;\n hasSettings: z$1.ZodBoolean;\n app: z$1.ZodObject<{\n hasApp: z$1.ZodBoolean;\n bundle: z$1.ZodNullable;\n hash: z$1.ZodString;\n sdkMajor: z$1.ZodNumber;\n sdkVersion: z$1.ZodString;\n compatible: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n logoUrl: z$1.ZodNullable;\n logoDarkUrl: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype PluginListResponse = z$1.infer;\ndeclare const pluginReloadResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n plugins: z$1.ZodArray;\n isOrphanedBuiltin: z$1.ZodBoolean;\n catalogEntryId: z$1.ZodOptional;\n sourceDisplay: z$1.ZodString;\n updateState: z$1.ZodObject<{\n outcome: z$1.ZodOptional>;\n availableVersion: z$1.ZodOptional;\n blockedVersion: z$1.ZodOptional;\n blockedReasons: z$1.ZodOptional>;\n lastCheckAt: z$1.ZodOptional;\n lastFailure: z$1.ZodOptional>;\n }, z$1.core.$strip>;\n enabled: z$1.ZodBoolean;\n description: z$1.ZodNullable;\n name: z$1.ZodNullable;\n icon: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n running: \"running\";\n missing: \"missing\";\n incompatible: \"incompatible\";\n disabled: \"disabled\";\n degraded: \"degraded\";\n \"needs-configuration\": \"needs-configuration\";\n }>;\n statusDetail: z$1.ZodNullable;\n handlerStats: z$1.ZodObject<{\n count: z$1.ZodNumber;\n totalMs: z$1.ZodNumber;\n maxMs: z$1.ZodNumber;\n errorCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n services: z$1.ZodArray;\n }, z$1.core.$strip>>;\n schedules: z$1.ZodArray;\n lastStatus: z$1.ZodNullable>;\n lastError: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n cliCommand: z$1.ZodNullable>;\n hasSettings: z$1.ZodBoolean;\n app: z$1.ZodObject<{\n hasApp: z$1.ZodBoolean;\n bundle: z$1.ZodNullable;\n hash: z$1.ZodString;\n sdkMajor: z$1.ZodNumber;\n sdkVersion: z$1.ZodString;\n compatible: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>;\n logoUrl: z$1.ZodNullable;\n logoDarkUrl: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype PluginReloadResponse = z$1.infer;\ndeclare const pluginRemoveResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n}, z$1.core.$strip>;\ntype PluginRemoveResponse = z$1.infer;\ndeclare const pluginSettingsResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n schema: z$1.ZodRecord;\n secret: z$1.ZodOptional>;\n default: z$1.ZodOptional;\n label: z$1.ZodString;\n description: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"boolean\">;\n default: z$1.ZodOptional;\n label: z$1.ZodString;\n description: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"select\">;\n options: z$1.ZodArray;\n default: z$1.ZodOptional;\n label: z$1.ZodString;\n description: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"project\">;\n default: z$1.ZodOptional;\n label: z$1.ZodString;\n description: z$1.ZodOptional;\n }, z$1.core.$strict>], \"type\">>;\n values: z$1.ZodRecord>>;\n}, z$1.core.$strip>;\ntype PluginSettingsResponse = z$1.infer;\ndeclare const pluginTokenResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n token: z$1.ZodString;\n}, z$1.core.$strip>;\ntype PluginTokenResponse = z$1.infer;\ndeclare const pluginCatalogStatusSchema: z$1.ZodObject<{\n pluginCount: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype PluginCatalogStatus = z$1.infer;\ndeclare const pluginCatalogSearchResultSchema: z$1.ZodObject<{\n entryId: z$1.ZodString;\n displayName: z$1.ZodString;\n description: z$1.ZodString;\n icon: z$1.ZodNullable;\n category: z$1.ZodString;\n source: z$1.ZodString;\n installed: z$1.ZodBoolean;\n compatible: z$1.ZodBoolean;\n incompatibleReason: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype PluginCatalogSearchResult$1 = z$1.infer;\n\ndeclare const systemExecutionOptionsResponseSchema: z$1.ZodObject<{\n providers: z$1.ZodArray;\n capabilities: z$1.ZodObject<{\n supportsArchive: z$1.ZodBoolean;\n supportsRename: z$1.ZodBoolean;\n supportsServiceTier: z$1.ZodBoolean;\n supportsUserQuestion: z$1.ZodBoolean;\n supportsFork: z$1.ZodBoolean;\n supportedPermissionModes: z$1.ZodArray>;\n }, z$1.core.$strip>;\n composerActions: z$1.ZodArray;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plan\">;\n command: z$1.ZodObject<{\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n trailingText: z$1.ZodString;\n }, z$1.core.$strip>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"goal\">;\n command: z$1.ZodObject<{\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n trailingText: z$1.ZodString;\n }, z$1.core.$strip>;\n }, z$1.core.$strip>], \"kind\">>;\n available: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n models: z$1.ZodArray;\n description: z$1.ZodString;\n }, z$1.core.$strip>>;\n defaultReasoningEffort: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n isDefault: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n selectedOnlyModels: z$1.ZodArray;\n description: z$1.ZodString;\n }, z$1.core.$strip>>;\n defaultReasoningEffort: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n isDefault: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n modelLoadError: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype SystemExecutionOptionsResponse = z$1.infer;\ndeclare const systemExecutionOptionsQuerySchema: z$1.ZodObject<{\n providerId: z$1.ZodOptional;\n hostId: z$1.ZodOptional;\n environmentId: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype SystemExecutionOptionsQuery = z$1.infer;\n/** Omission preserves the existing behavior of reading the primary machine. */\ndeclare const systemUsageLimitsQuerySchema: z$1.ZodObject<{\n hostId: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype SystemUsageLimitsQuery = z$1.infer;\ndeclare const systemVoiceTranscriptionResponseSchema: z$1.ZodObject<{\n text: z$1.ZodString;\n}, z$1.core.$strip>;\ntype SystemVoiceTranscriptionResponse = z$1.infer;\ndeclare const systemConfigResponseSchema: z$1.ZodObject<{\n generalSettings: z$1.ZodObject<{\n caffeinate: z$1.ZodBoolean;\n showKeyboardHints: z$1.ZodBoolean;\n showUnhandledProviderEvents: z$1.ZodBoolean;\n codexMemoryEnabled: z$1.ZodBoolean;\n claudeCodeMemoryEnabled: z$1.ZodBoolean;\n codexSubagentsDisabled: z$1.ZodBoolean;\n claudeCodeSubagentsDisabled: z$1.ZodBoolean;\n claudeCodeWorkflowsDisabled: z$1.ZodBoolean;\n }, z$1.core.$strict>;\n keybindings: z$1.ZodArray;\n desktopOnly: z$1.ZodBoolean;\n shortcut: z$1.ZodObject<{\n key: z$1.ZodString;\n mod: z$1.ZodBoolean;\n meta: z$1.ZodBoolean;\n control: z$1.ZodBoolean;\n alt: z$1.ZodBoolean;\n shift: z$1.ZodBoolean;\n }, z$1.core.$strict>;\n when: z$1.ZodObject<{\n all: z$1.ZodArray>;\n none: z$1.ZodArray>;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>>;\n defaultKeybindings: z$1.ZodArray;\n desktopOnly: z$1.ZodBoolean;\n shortcut: z$1.ZodObject<{\n key: z$1.ZodString;\n mod: z$1.ZodBoolean;\n meta: z$1.ZodBoolean;\n control: z$1.ZodBoolean;\n alt: z$1.ZodBoolean;\n shift: z$1.ZodBoolean;\n }, z$1.core.$strict>;\n when: z$1.ZodObject<{\n all: z$1.ZodArray>;\n none: z$1.ZodArray>;\n }, z$1.core.$strict>;\n }, z$1.core.$strict>>;\n keybindingOverrides: z$1.ZodArray;\n shortcut: z$1.ZodNullable>;\n }, z$1.core.$strict>>;\n experiments: z$1.ZodObject<{\n claudeCodeMockCliTraffic: z$1.ZodBoolean;\n threadSplits: z$1.ZodBoolean;\n plugins: z$1.ZodBoolean;\n }, z$1.core.$strip>;\n appearance: z$1.ZodObject<{\n themeId: z$1.ZodString;\n customCss: z$1.ZodNullable;\n faviconColor: z$1.ZodEnum<{\n default: \"default\";\n red: \"red\";\n orange: \"orange\";\n yellow: \"yellow\";\n green: \"green\";\n teal: \"teal\";\n blue: \"blue\";\n purple: \"purple\";\n pink: \"pink\";\n }>;\n }, z$1.core.$strip>;\n customThemes: z$1.ZodArray;\n pluginThemes: z$1.ZodArray;\n }, z$1.core.$strip>>;\n featureFlags: z$1.ZodObject<{\n placeholder: z$1.ZodBoolean;\n }, z$1.core.$strip>;\n hostDaemonPort: z$1.ZodNullable;\n primaryHostId: z$1.ZodNullable;\n primaryHostPlatform: z$1.ZodNullable>;\n voiceTranscriptionEnabled: z$1.ZodBoolean;\n dataDir: z$1.ZodString;\n}, z$1.core.$strip>;\ntype SystemConfigResponse = z$1.infer;\ndeclare const systemAttentionResponseSchema: z$1.ZodObject<{\n hasAttention: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype SystemAttentionResponse = z$1.infer;\n/**\n * Theme catalog: the on-disk custom-theme directory plus the discovered custom\n * themes and the active palette. Drives `bb theme list` / `bb theme dir`.\n */\ndeclare const themeCatalogResponseSchema: z$1.ZodObject<{\n dir: z$1.ZodString;\n custom: z$1.ZodArray;\n plugins: z$1.ZodArray;\n }, z$1.core.$strip>>;\n active: z$1.ZodObject<{\n themeId: z$1.ZodString;\n customCss: z$1.ZodNullable;\n faviconColor: z$1.ZodEnum<{\n default: \"default\";\n red: \"red\";\n orange: \"orange\";\n yellow: \"yellow\";\n green: \"green\";\n teal: \"teal\";\n blue: \"blue\";\n purple: \"purple\";\n pink: \"pink\";\n }>;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>;\ntype ThemeCatalogResponse = z$1.infer;\ndeclare const systemVersionResponseSchema: z$1.ZodObject<{\n currentVersion: z$1.ZodString;\n latestVersion: z$1.ZodNullable;\n source: z$1.ZodLiteral<\"npm\">;\n updateAvailable: z$1.ZodBoolean;\n isDevelopment: z$1.ZodBoolean;\n upgradeCommand: z$1.ZodString;\n}, z$1.core.$strip>;\ntype SystemVersionResponse = z$1.infer;\ndeclare const systemConfigReloadResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n}, z$1.core.$strip>;\ntype SystemConfigReloadResponse = z$1.infer;\n\ndeclare const terminalSessionSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodNullable;\n environmentId: z$1.ZodNullable;\n hostId: z$1.ZodString;\n title: z$1.ZodString;\n initialCwd: z$1.ZodString;\n cols: z$1.ZodNumber;\n rows: z$1.ZodNumber;\n status: z$1.ZodEnum<{\n running: \"running\";\n starting: \"starting\";\n disconnected: \"disconnected\";\n exited: \"exited\";\n }>;\n exitCode: z$1.ZodNullable;\n closeReason: z$1.ZodNullable>;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n lastUserInputAt: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TerminalSession = z$1.infer;\ndeclare const terminalListResponseSchema: z$1.ZodObject<{\n sessions: z$1.ZodArray;\n environmentId: z$1.ZodNullable;\n hostId: z$1.ZodString;\n title: z$1.ZodString;\n initialCwd: z$1.ZodString;\n cols: z$1.ZodNumber;\n rows: z$1.ZodNumber;\n status: z$1.ZodEnum<{\n running: \"running\";\n starting: \"starting\";\n disconnected: \"disconnected\";\n exited: \"exited\";\n }>;\n exitCode: z$1.ZodNullable;\n closeReason: z$1.ZodNullable>;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n lastUserInputAt: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype TerminalListResponse = z$1.infer;\ndeclare const createTerminalRequestSchema: z$1.ZodObject<{\n cols: z$1.ZodNumber;\n rows: z$1.ZodNumber;\n start: z$1.ZodOptional;\n }, z$1.core.$strict>, z$1.ZodObject<{\n mode: z$1.ZodLiteral<\"command\">;\n command: z$1.ZodString;\n }, z$1.core.$strict>], \"mode\">>;\n target: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread\">;\n threadId: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"environment\">;\n environmentId: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"host_path\">;\n hostId: z$1.ZodString;\n cwd: z$1.ZodNullable;\n }, z$1.core.$strict>], \"kind\">;\n title: z$1.ZodOptional;\n}, z$1.core.$strict>;\ntype CreateTerminalRequest = z$1.infer;\ndeclare const updateTerminalRequestSchema: z$1.ZodObject<{\n title: z$1.ZodString;\n}, z$1.core.$strict>;\ntype UpdateTerminalRequest = z$1.infer;\ndeclare const terminalInputRequestSchema: z$1.ZodObject<{\n dataBase64: z$1.ZodString;\n}, z$1.core.$strict>;\ntype TerminalInputRequest = z$1.infer;\ndeclare const terminalResizeRequestSchema: z$1.ZodObject<{\n cols: z$1.ZodNumber;\n rows: z$1.ZodNumber;\n}, z$1.core.$strict>;\ntype TerminalResizeRequest = z$1.infer;\ndeclare const terminalOutputQuerySchema: z$1.ZodObject<{\n sinceSeq: z$1.ZodOptional>;\n tailBytes: z$1.ZodOptional>;\n limitChunks: z$1.ZodOptional>;\n}, z$1.core.$strict>;\ntype TerminalOutputQuery = z$1.infer;\ndeclare const terminalOutputResponseSchema: z$1.ZodObject<{\n chunks: z$1.ZodArray>;\n nextSeq: z$1.ZodNumber;\n truncated: z$1.ZodBoolean;\n}, z$1.core.$strict>;\ntype TerminalOutputResponse = z$1.infer;\n\ndeclare const timelineRowStatusSchema: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n}>;\ntype TimelineRowStatus = z$1.infer;\ndeclare const timelineRowBaseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype TimelineRowBase = z$1.infer;\ndeclare const timelineConversationRowSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"conversation\">;\n text: z$1.ZodString;\n attachments: z$1.ZodNullable;\n localImagePaths: z$1.ZodArray;\n localFilePaths: z$1.ZodArray;\n }, z$1.core.$strip>>;\n role: z$1.ZodLiteral<\"user\">;\n initiator: z$1.ZodEnum<{\n user: \"user\";\n agent: \"agent\";\n system: \"system\";\n }>;\n senderThreadId: z$1.ZodNullable;\n systemMessageKind: z$1.ZodEnum<{\n \"ownership-assigned\": \"ownership-assigned\";\n \"ownership-removed\": \"ownership-removed\";\n \"child-needs-attention\": \"child-needs-attention\";\n \"child-completed\": \"child-completed\";\n \"child-failed\": \"child-failed\";\n \"child-interrupted\": \"child-interrupted\";\n \"child-outcome-batch\": \"child-outcome-batch\";\n unlabeled: \"unlabeled\";\n }>;\n systemMessageSubject: z$1.ZodNullable;\n threadId: z$1.ZodString;\n threadName: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"thread-batch\">;\n count: z$1.ZodNumber;\n }, z$1.core.$strip>], \"kind\">>;\n turnRequest: z$1.ZodObject<{\n kind: z$1.ZodEnum<{\n message: \"message\";\n steer: \"steer\";\n }>;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n accepted: \"accepted\";\n }>;\n }, z$1.core.$strip>;\n mentions: z$1.ZodArray;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"conversation\">;\n text: z$1.ZodString;\n attachments: z$1.ZodNullable;\n localImagePaths: z$1.ZodArray;\n localFilePaths: z$1.ZodArray;\n }, z$1.core.$strip>>;\n role: z$1.ZodLiteral<\"assistant\">;\n turnRequest: z$1.ZodNull;\n}, z$1.core.$strip>], \"role\">;\ntype TimelineConversationRow = z$1.infer;\ndeclare const timelineSystemRowSchema: z$1.ZodUnion;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"system\">;\n title: z$1.ZodString;\n detail: z$1.ZodNullable;\n status: z$1.ZodNullable>;\n systemKind: z$1.ZodEnum<{\n error: \"error\";\n debug: \"debug\";\n reconnect: \"reconnect\";\n }>;\n}, z$1.core.$strip>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"system\">;\n title: z$1.ZodString;\n detail: z$1.ZodNullable;\n status: z$1.ZodNullable>;\n systemKind: z$1.ZodLiteral<\"operation\">;\n operationKind: z$1.ZodEnum<{\n generic: \"generic\";\n compaction: \"compaction\";\n \"thread-provisioning\": \"thread-provisioning\";\n \"thread-interrupted\": \"thread-interrupted\";\n \"provider-unhandled\": \"provider-unhandled\";\n warning: \"warning\";\n deprecation: \"deprecation\";\n }>;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>, z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"system\">;\n title: z$1.ZodString;\n detail: z$1.ZodNullable;\n systemKind: z$1.ZodLiteral<\"operation\">;\n operationKind: z$1.ZodLiteral<\"parent-change\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n parentChange: z$1.ZodObject<{\n action: z$1.ZodEnum<{\n assign: \"assign\";\n release: \"release\";\n transfer: \"transfer\";\n }>;\n previousParentThreadId: z$1.ZodNullable;\n previousParentThreadTitle: z$1.ZodNullable;\n nextParentThreadId: z$1.ZodNullable;\n nextParentThreadTitle: z$1.ZodNullable;\n }, z$1.core.$strip>;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>], \"operationKind\">]>;\ntype TimelineSystemRow = z$1.infer;\ninterface TimelineWorkRowBase extends TimelineRowBase {\n kind: \"work\";\n status: TimelineRowStatus;\n}\ndeclare const timelineCommandWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"command\">;\n callId: z$1.ZodString;\n command: z$1.ZodString;\n cwd: z$1.ZodNullable;\n source: z$1.ZodNullable;\n output: z$1.ZodString;\n exitCode: z$1.ZodNullable;\n completedAt: z$1.ZodNullable;\n approvalStatus: z$1.ZodNullable>;\n activityIntents: z$1.ZodArray;\n command: z$1.ZodString;\n name: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"list_files\">;\n command: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"search\">;\n command: z$1.ZodString;\n query: z$1.ZodNullable;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"unknown\">;\n command: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n}, z$1.core.$strip>;\ntype TimelineCommandWorkRow = z$1.infer;\ndeclare const timelineToolWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"tool\">;\n callId: z$1.ZodString;\n toolName: z$1.ZodString;\n toolArgs: z$1.ZodNullable>>>;\n output: z$1.ZodString;\n completedAt: z$1.ZodNullable;\n approvalStatus: z$1.ZodNullable>;\n activityIntents: z$1.ZodArray;\n command: z$1.ZodString;\n name: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"list_files\">;\n command: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"search\">;\n command: z$1.ZodString;\n query: z$1.ZodNullable;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"unknown\">;\n command: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n}, z$1.core.$strip>;\ntype TimelineToolWorkRow = z$1.infer;\ndeclare const timelineFileChangeWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"file-change\">;\n callId: z$1.ZodString;\n change: z$1.ZodObject<{\n path: z$1.ZodString;\n kind: z$1.ZodNullable;\n movePath: z$1.ZodNullable;\n diff: z$1.ZodNullable;\n diffStats: z$1.ZodObject<{\n added: z$1.ZodNumber;\n removed: z$1.ZodNumber;\n }, z$1.core.$strip>;\n }, z$1.core.$strip>;\n stdout: z$1.ZodNullable;\n stderr: z$1.ZodNullable;\n approvalStatus: z$1.ZodNullable>;\n}, z$1.core.$strip>;\ntype TimelineFileChangeWorkRow = z$1.infer;\ndeclare const timelineWebSearchWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"web-search\">;\n callId: z$1.ZodString;\n queries: z$1.ZodArray;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TimelineWebSearchWorkRow = z$1.infer;\ndeclare const timelineWebFetchWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"web-fetch\">;\n callId: z$1.ZodString;\n url: z$1.ZodString;\n prompt: z$1.ZodNullable;\n pattern: z$1.ZodNullable;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TimelineWebFetchWorkRow = z$1.infer;\ndeclare const timelineImageViewWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"image-view\">;\n callId: z$1.ZodString;\n path: z$1.ZodString;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TimelineImageViewWorkRow = z$1.infer;\ndeclare const timelineApprovalWorkRowSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"approval\">;\n interactionId: z$1.ZodString;\n target: z$1.ZodObject<{\n itemId: z$1.ZodString;\n toolName: z$1.ZodNullable;\n }, z$1.core.$strip>;\n approvalKind: z$1.ZodLiteral<\"file-edit\">;\n lifecycle: z$1.ZodEnum<{\n denied: \"denied\";\n waiting: \"waiting\";\n }>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"approval\">;\n interactionId: z$1.ZodString;\n target: z$1.ZodObject<{\n itemId: z$1.ZodString;\n toolName: z$1.ZodNullable;\n }, z$1.core.$strip>;\n approvalKind: z$1.ZodLiteral<\"permission-grant\">;\n lifecycle: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n denied: \"denied\";\n resolving: \"resolving\";\n granted: \"granted\";\n }>;\n grantScope: z$1.ZodNullable>;\n statusReason: z$1.ZodNullable;\n}, z$1.core.$strip>], \"approvalKind\">;\ntype TimelineApprovalWorkRow = z$1.infer;\ndeclare const timelineQuestionWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"question\">;\n interactionId: z$1.ZodString;\n lifecycle: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n answered: \"answered\";\n }>;\n questions: z$1.ZodArray;\n multiSelect: z$1.ZodBoolean;\n options: z$1.ZodOptional;\n }, z$1.core.$strip>>>;\n allowFreeText: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n answers: z$1.ZodNullable;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>>;\n statusReason: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TimelineQuestionWorkRow = z$1.infer;\ninterface TimelineDelegationWorkRow extends TimelineWorkRowBase {\n workKind: \"delegation\";\n callId: string;\n toolName: string;\n subagentType: string | null;\n description: string | null;\n output: string;\n completedAt: number | null;\n childRows: TimelineRow[];\n}\n/**\n * A provider background task — a dynamic workflow (Claude Code Workflow tool)\n * or a backgrounded shell command (Bash run_in_background), discriminated by\n * `taskType`. The row outlives its spawning turn: progress and terminal state\n * arrive via thread-scoped events folded into this single row. `workflow` is\n * the merged phase/agent tree, present only for workflows; null for shell\n * commands and for workflows the provider reported no progress records for\n * (degraded rendering falls back to description + summary).\n */\ndeclare const timelineWorkflowWorkRowSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n turnId: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"workflow\">;\n itemId: z$1.ZodString;\n taskType: z$1.ZodString;\n workflowName: z$1.ZodNullable;\n description: z$1.ZodString;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n running: \"running\";\n paused: \"paused\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n workflow: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodNullable>;\n summary: z$1.ZodNullable;\n error: z$1.ZodNullable;\n completedAt: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype TimelineWorkflowWorkRow = z$1.infer;\ntype TimelineWorkRow = TimelineCommandWorkRow | TimelineToolWorkRow | TimelineFileChangeWorkRow | TimelineWebSearchWorkRow | TimelineWebFetchWorkRow | TimelineImageViewWorkRow | TimelineApprovalWorkRow | TimelineQuestionWorkRow | TimelineDelegationWorkRow | TimelineWorkflowWorkRow;\ninterface TimelineTurnRow extends TimelineRowBase {\n kind: \"turn\";\n turnId: string;\n status: TimelineRowStatus;\n summaryCount: number;\n completedAt: number | null;\n /**\n * True while the turn is still running and this row summarizes only the\n * finished prefix of its work — the live tail renders as sibling rows below.\n * On turn completion the row converges to the normal completed summary\n * (`partial: false`) at the same row id. `completedAt` on a partial row is\n * the time of the newest collapsed work, so \"Worked so far (…)\" durations\n * reflect covered work rather than the whole turn.\n */\n partial: boolean;\n children: TimelineRow[] | null;\n}\ntype TimelineSourceRow = TimelineConversationRow | TimelineWorkRow | TimelineSystemRow;\ntype TimelineRow = TimelineSourceRow | TimelineTurnRow;\n\ndeclare const createThreadRequestSchema: z$1.ZodObject<{\n projectId: z$1.ZodString;\n providerId: z$1.ZodOptional;\n origin: z$1.ZodEnum<{\n plugin: \"plugin\";\n app: \"app\";\n cli: \"cli\";\n sdk: \"sdk\";\n }>;\n originPluginId: z$1.ZodOptional;\n visibility: z$1.ZodOptional>;\n title: z$1.ZodOptional;\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodOptional;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n executionInputSources: z$1.ZodOptional>;\n model: z$1.ZodOptional>;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n environment: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"reuse\">;\n environmentId: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"host\">;\n hostId: z$1.ZodOptional;\n workspace: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n type: z$1.ZodLiteral<\"unmanaged\">;\n path: z$1.ZodNullable;\n branch: z$1.ZodOptional;\n name: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"new\">;\n baseBranch: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"managed-worktree\">;\n baseBranch: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"named\">;\n name: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"default\">;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"personal\">;\n }, z$1.core.$strip>], \"type\">;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"project-default\">;\n }, z$1.core.$strip>], \"type\">;\n parentThreadId: z$1.ZodOptional;\n folderId: z$1.ZodOptional>;\n sourceThreadId: z$1.ZodOptional;\n sourceSeqEnd: z$1.ZodOptional;\n startedOnBehalfOf: z$1.ZodDefault;\n senderThreadId: z$1.ZodString;\n }, z$1.core.$strip>>>;\n originKind: z$1.ZodDefault>>;\n childOrigin: z$1.ZodDefault>>;\n}, z$1.core.$strip>;\ntype CreateThreadRequest = z$1.infer;\ndeclare const sendMessageRequestSchema: z$1.ZodObject<{\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodOptional;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n executionInputSources: z$1.ZodOptional>;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n mode: z$1.ZodEnum<{\n steer: \"steer\";\n start: \"start\";\n auto: \"auto\";\n \"queue-if-active\": \"queue-if-active\";\n \"steer-if-active\": \"steer-if-active\";\n }>;\n senderThreadId: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype SendMessageRequest = z$1.infer;\ndeclare const createQueuedMessageRequestSchema: z$1.ZodObject<{\n input: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodOptional;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n executionInputSources: z$1.ZodOptional>;\n serviceTier: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>;\n permissionMode: z$1.ZodOptional>;\n }, z$1.core.$strict>>;\n senderThreadId: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype CreateQueuedMessageRequest = z$1.infer;\ndeclare const sendQueuedMessageRequestSchema: z$1.ZodObject<{\n mode: z$1.ZodEnum<{\n steer: \"steer\";\n auto: \"auto\";\n }>;\n}, z$1.core.$strip>;\ntype SendQueuedMessageRequest = z$1.infer;\ndeclare const reorderQueuedMessageRequestSchema: z$1.ZodObject<{\n previousQueuedMessageId: z$1.ZodNullable;\n nextQueuedMessageId: z$1.ZodNullable;\n groupBoundaryQueuedMessageId: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ReorderQueuedMessageRequest = z$1.infer;\ndeclare const setQueuedMessageGroupBoundaryRequestSchema: z$1.ZodObject<{\n expectedGroupedPrefixQueuedMessageIds: z$1.ZodArray;\n groupBoundaryQueuedMessageId: z$1.ZodString;\n}, z$1.core.$strip>;\ntype SetQueuedMessageGroupBoundaryRequest = z$1.infer;\ndeclare const sendQueuedMessageResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n queuedMessage: z$1.ZodObject<{\n id: z$1.ZodString;\n content: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodString;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n groupWithNext: z$1.ZodBoolean;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n }, z$1.core.$strip>;\n}, z$1.core.$strip>;\ntype SendQueuedMessageResponse = z$1.infer;\ndeclare const threadListResponseSchema: z$1.ZodArray;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n activity: z$1.ZodObject<{\n activeWorkflowCount: z$1.ZodNumber;\n activeBackgroundAgentCount: z$1.ZodNumber;\n activeBackgroundCommandCount: z$1.ZodNumber;\n activePlanModeCount: z$1.ZodNumber;\n activeGoalCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n pinSortKey: z$1.ZodNullable;\n hasPendingInteraction: z$1.ZodBoolean;\n environmentHostId: z$1.ZodNullable;\n environmentName: z$1.ZodNullable;\n environmentBranchName: z$1.ZodNullable;\n environmentWorkspaceDisplayKind: z$1.ZodEnum<{\n \"managed-worktree\": \"managed-worktree\";\n \"unmanaged-worktree\": \"unmanaged-worktree\";\n other: \"other\";\n }>;\n}, z$1.core.$strip>>;\ntype ThreadListResponse = z$1.infer;\ndeclare const threadSearchResponseSchema: z$1.ZodObject<{\n active: z$1.ZodObject<{\n total: z$1.ZodNumber;\n results: z$1.ZodArray;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n activity: z$1.ZodObject<{\n activeWorkflowCount: z$1.ZodNumber;\n activeBackgroundAgentCount: z$1.ZodNumber;\n activeBackgroundCommandCount: z$1.ZodNumber;\n activePlanModeCount: z$1.ZodNumber;\n activeGoalCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n pinSortKey: z$1.ZodNullable;\n hasPendingInteraction: z$1.ZodBoolean;\n environmentHostId: z$1.ZodNullable;\n environmentName: z$1.ZodNullable;\n environmentBranchName: z$1.ZodNullable;\n environmentWorkspaceDisplayKind: z$1.ZodEnum<{\n \"managed-worktree\": \"managed-worktree\";\n \"unmanaged-worktree\": \"unmanaged-worktree\";\n other: \"other\";\n }>;\n }, z$1.core.$strip>;\n matches: z$1.ZodArray;\n text: z$1.ZodString;\n highlightRanges: z$1.ZodArray>;\n sourceSeq: z$1.ZodNullable;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>;\n archived: z$1.ZodObject<{\n total: z$1.ZodNumber;\n results: z$1.ZodArray;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n activity: z$1.ZodObject<{\n activeWorkflowCount: z$1.ZodNumber;\n activeBackgroundAgentCount: z$1.ZodNumber;\n activeBackgroundCommandCount: z$1.ZodNumber;\n activePlanModeCount: z$1.ZodNumber;\n activeGoalCount: z$1.ZodNumber;\n }, z$1.core.$strip>;\n pinSortKey: z$1.ZodNullable;\n hasPendingInteraction: z$1.ZodBoolean;\n environmentHostId: z$1.ZodNullable;\n environmentName: z$1.ZodNullable;\n environmentBranchName: z$1.ZodNullable;\n environmentWorkspaceDisplayKind: z$1.ZodEnum<{\n \"managed-worktree\": \"managed-worktree\";\n \"unmanaged-worktree\": \"unmanaged-worktree\";\n other: \"other\";\n }>;\n }, z$1.core.$strip>;\n matches: z$1.ZodArray;\n text: z$1.ZodString;\n highlightRanges: z$1.ZodArray>;\n sourceSeq: z$1.ZodNullable;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strict>;\n}, z$1.core.$strict>;\ntype ThreadSearchResponse = z$1.infer;\ndeclare const threadResponseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n projectId: z$1.ZodString;\n environmentId: z$1.ZodNullable;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n canSpawnChild: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype ThreadResponse = z$1.infer;\ndeclare const threadGetQuerySchema: z$1.ZodObject<{\n include: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ThreadGetQuery = z$1.infer;\ndeclare const threadWithIncludesResponseSchema: z$1.ZodObject<{\n id: z$1.ZodString;\n projectId: z$1.ZodString;\n environmentId: z$1.ZodNullable;\n providerId: z$1.ZodString;\n title: z$1.ZodNullable;\n titleFallback: z$1.ZodNullable;\n folderId: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n }>;\n parentThreadId: z$1.ZodNullable;\n sourceThreadId: z$1.ZodNullable;\n originKind: z$1.ZodNullable>;\n childOrigin: z$1.ZodNullable>;\n originPluginId: z$1.ZodNullable;\n visibility: z$1.ZodEnum<{\n visible: \"visible\";\n hidden: \"hidden\";\n }>;\n archivedAt: z$1.ZodNullable;\n pinnedAt: z$1.ZodNullable;\n deletedAt: z$1.ZodNullable;\n lastReadAt: z$1.ZodNullable;\n latestAttentionAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n runtime: z$1.ZodObject<{\n displayStatus: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n stopping: \"stopping\";\n idle: \"idle\";\n starting: \"starting\";\n active: \"active\";\n \"host-reconnecting\": \"host-reconnecting\";\n \"waiting-for-host\": \"waiting-for-host\";\n }>;\n hostReconnectGraceExpiresAt: z$1.ZodNullable;\n }, z$1.core.$strip>;\n canSpawnChild: z$1.ZodBoolean;\n environment: z$1.ZodOptional;\n projectId: z$1.ZodString;\n hostId: z$1.ZodString;\n path: z$1.ZodNullable;\n managed: z$1.ZodBoolean;\n isGitRepo: z$1.ZodBoolean;\n isWorktree: z$1.ZodBoolean;\n workspaceProvisionType: z$1.ZodEnum<{\n unmanaged: \"unmanaged\";\n \"managed-worktree\": \"managed-worktree\";\n personal: \"personal\";\n }>;\n branchName: z$1.ZodNullable;\n baseBranch: z$1.ZodNullable;\n defaultBranch: z$1.ZodNullable;\n mergeBaseBranch: z$1.ZodNullable;\n status: z$1.ZodEnum<{\n error: \"error\";\n provisioning: \"provisioning\";\n ready: \"ready\";\n retiring: \"retiring\";\n destroying: \"destroying\";\n destroyed: \"destroyed\";\n }>;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n }, z$1.core.$strip>>>;\n host: z$1.ZodOptional;\n status: z$1.ZodEnum<{\n disconnected: \"disconnected\";\n connected: \"connected\";\n }>;\n lastSeenAt: z$1.ZodNullable;\n lastRejectedProtocolVersion: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n }, z$1.core.$strip>>>;\n}, z$1.core.$strip>;\ntype ThreadWithIncludesResponse = z$1.infer;\ndeclare const threadPendingInteractionsResponseSchema: z$1.ZodArray;\n statusReason: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n expiresAt: z$1.ZodOptional>;\n resolvedAt: z$1.ZodNullable;\n turnId: z$1.ZodString;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n origin: z$1.ZodOptional;\n providerId: z$1.ZodString;\n providerThreadId: z$1.ZodString;\n providerRequestId: z$1.ZodString;\n }, z$1.core.$strip>>;\n payload: z$1.ZodUnion;\n subject: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n itemId: z$1.ZodString;\n command: z$1.ZodString;\n cwd: z$1.ZodNullable;\n actions: z$1.ZodArray;\n command: z$1.ZodString;\n name: z$1.ZodString;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"listFiles\">;\n command: z$1.ZodString;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"search\">;\n command: z$1.ZodString;\n query: z$1.ZodNullable;\n path: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n type: z$1.ZodLiteral<\"unknown\">;\n command: z$1.ZodString;\n }, z$1.core.$strip>], \"type\">>;\n sessionGrant: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"file_change\">;\n itemId: z$1.ZodString;\n writeScope: z$1.ZodNullable;\n sessionGrant: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"permission_grant\">;\n itemId: z$1.ZodString;\n toolName: z$1.ZodNullable;\n permissions: z$1.ZodObject<{\n network: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>;\n }, z$1.core.$strip>], \"kind\">;\n reason: z$1.ZodNullable;\n availableDecisions: z$1.ZodArray>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_question\">;\n questions: z$1.ZodArray;\n multiSelect: z$1.ZodBoolean;\n options: z$1.ZodOptional;\n }, z$1.core.$strip>>>;\n allowFreeText: z$1.ZodBoolean;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>]>;\n resolution: z$1.ZodNullable;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"allow_for_session\">;\n grantedPermissions: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n fileSystem: z$1.ZodNullable;\n write: z$1.ZodArray;\n }, z$1.core.$strip>>;\n }, z$1.core.$strict>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n decision: z$1.ZodLiteral<\"deny\">;\n }, z$1.core.$strip>], \"decision\">, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"user_answer\">;\n answers: z$1.ZodRecord;\n freeText: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>]>>;\n}, z$1.core.$strip>, z$1.ZodObject<{\n id: z$1.ZodString;\n threadId: z$1.ZodString;\n status: z$1.ZodEnum<{\n pending: \"pending\";\n interrupted: \"interrupted\";\n resolving: \"resolving\";\n resolved: \"resolved\";\n }>;\n statusReason: z$1.ZodNullable;\n createdAt: z$1.ZodNumber;\n expiresAt: z$1.ZodOptional>;\n resolvedAt: z$1.ZodNullable;\n turnId: z$1.ZodNullable;\n origin: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n rendererId: z$1.ZodString;\n }, z$1.core.$strip>;\n payload: z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n title: z$1.ZodString;\n data: z$1.ZodType>;\n }, z$1.core.$strip>;\n resolution: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>]>>;\ntype ThreadPendingInteractionsResponse = z$1.infer;\ndeclare const threadQueuedMessageListResponseSchema: z$1.ZodArray>;\n type: z$1.ZodLiteral<\"text\">;\n text: z$1.ZodString;\n mentions: z$1.ZodDefault;\n threadId: z$1.ZodString;\n projectId: z$1.ZodOptional;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"project\">;\n projectId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"path\">;\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n entryKind: z$1.ZodEnum<{\n file: \"file\";\n directory: \"directory\";\n }>;\n path: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"command\">;\n trigger: z$1.ZodEnum<{\n \"/\": \"/\";\n }>;\n name: z$1.ZodString;\n source: z$1.ZodEnum<{\n command: \"command\";\n skill: \"skill\";\n }>;\n origin: z$1.ZodEnum<{\n user: \"user\";\n project: \"project\";\n builtin: \"builtin\";\n }>;\n label: z$1.ZodString;\n argumentHint: z$1.ZodNullable;\n }, z$1.core.$strip>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"plugin\">;\n pluginId: z$1.ZodString;\n icon: z$1.ZodOptional>;\n itemId: z$1.ZodString;\n label: z$1.ZodString;\n }, z$1.core.$strip>], \"kind\">;\n }, z$1.core.$strip>>>;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"image\">;\n url: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localImage\">;\n path: z$1.ZodString;\n }, z$1.core.$strip>, z$1.ZodObject<{\n visibility: z$1.ZodOptional>;\n type: z$1.ZodLiteral<\"localFile\">;\n path: z$1.ZodString;\n name: z$1.ZodOptional;\n sizeBytes: z$1.ZodOptional;\n mimeType: z$1.ZodOptional;\n }, z$1.core.$strip>], \"type\">>;\n model: z$1.ZodString;\n reasoningLevel: z$1.ZodEnum<{\n none: \"none\";\n low: \"low\";\n medium: \"medium\";\n high: \"high\";\n xhigh: \"xhigh\";\n ultracode: \"ultracode\";\n max: \"max\";\n ultra: \"ultra\";\n }>;\n permissionMode: z$1.ZodEnum<{\n readonly: \"readonly\";\n full: \"full\";\n \"workspace-write\": \"workspace-write\";\n }>;\n serviceTier: z$1.ZodEnum<{\n default: \"default\";\n fast: \"fast\";\n }>;\n groupWithNext: z$1.ZodBoolean;\n createdAt: z$1.ZodNumber;\n updatedAt: z$1.ZodNumber;\n}, z$1.core.$strip>>;\ntype ThreadQueuedMessageListResponse = z$1.infer;\ndeclare const threadChildSummaryResponseSchema: z$1.ZodObject<{\n nonDeletedChildCount: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype ThreadChildSummaryResponse = z$1.infer;\ndeclare const deleteThreadRequestSchema: z$1.ZodObject<{\n childThreadsConfirmed: z$1.ZodBoolean;\n}, z$1.core.$strip>;\ntype DeleteThreadRequest = z$1.infer;\ndeclare const updateThreadRequestSchema: z$1.ZodObject<{\n title: z$1.ZodOptional>;\n folderId: z$1.ZodOptional>;\n parentThreadId: z$1.ZodOptional>;\n model: z$1.ZodOptional>;\n reasoningLevel: z$1.ZodOptional>>;\n}, z$1.core.$strip>;\ntype UpdateThreadRequest = z$1.infer;\ndeclare const reorderPinnedThreadRequestSchema: z$1.ZodObject<{\n previousThreadId: z$1.ZodNullable;\n nextThreadId: z$1.ZodNullable;\n}, z$1.core.$strip>;\ntype ReorderPinnedThreadRequest = z$1.infer;\n/**\n * Requested placement for a thread opened in the app's split layout. Edge\n * placements add panes through the eighth pane; at the cap they replace the\n * focused pane. `replace` always replaces the focused pane.\n */\ndeclare const threadOpenSplitSchema: z$1.ZodEnum<{\n right: \"right\";\n down: \"down\";\n left: \"left\";\n top: \"top\";\n replace: \"replace\";\n}>;\ntype ThreadOpenSplit = z$1.infer;\n/** Optional secondary-panel file to open with a thread. */\ndeclare const threadOpenFileSchema: z$1.ZodObject<{\n source: z$1.ZodEnum<{\n workspace: \"workspace\";\n \"thread-storage\": \"thread-storage\";\n }>;\n path: z$1.ZodString;\n lineNumber: z$1.ZodNullable;\n}, z$1.core.$strict>;\ntype ThreadOpenFile = z$1.infer;\n/** Response for POST /threads/:id/open: how many connected clients received it. */\ndeclare const threadOpenResponseSchema: z$1.ZodObject<{\n delivered: z$1.ZodNumber;\n}, z$1.core.$strip>;\ntype ThreadOpenResponse = z$1.infer;\ndeclare const threadArchiveAllResponseSchema: z$1.ZodObject<{\n ok: z$1.ZodLiteral;\n archivedThreadIds: z$1.ZodArray;\n}, z$1.core.$strip>;\ntype ThreadArchiveAllResponse = z$1.infer;\ndeclare const threadListQuerySchema: z$1.ZodObject<{\n projectId: z$1.ZodOptional;\n parentThreadId: z$1.ZodOptional;\n sourceThreadId: z$1.ZodOptional;\n archived: z$1.ZodOptional>;\n folderId: z$1.ZodOptional;\n unfiled: z$1.ZodOptional>;\n hasParent: z$1.ZodOptional>;\n originKind: z$1.ZodOptional>;\n excludeSideChats: z$1.ZodOptional>;\n childOrigin: z$1.ZodOptional>;\n limit: z$1.ZodOptional;\n offset: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ThreadListQuery = z$1.infer;\ndeclare const threadSearchQuerySchema: z$1.ZodObject<{\n query: z$1.ZodString;\n limitPerGroup: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ThreadSearchQuery = z$1.infer;\ndeclare const threadTimelineQuerySchema: z$1.ZodObject<{\n includeNestedRows: z$1.ZodOptional>;\n segmentLimit: z$1.ZodOptional;\n beforeAnchorSeq: z$1.ZodOptional;\n beforeAnchorId: z$1.ZodOptional;\n summaryOnly: z$1.ZodOptional>;\n afterSequence: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ThreadTimelineQuery = z$1.infer;\ndeclare const timelineTurnSummaryDetailsQuerySchema: z$1.ZodObject<{\n turnId: z$1.ZodString;\n sourceSeqStart: z$1.ZodString;\n sourceSeqEnd: z$1.ZodString;\n workItemLimit: z$1.ZodOptional;\n afterSeq: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype TimelineTurnSummaryDetailsQuery = z$1.infer;\ndeclare const threadStorageFilesQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional;\n limit: z$1.ZodOptional;\n}, z$1.core.$strip>;\ntype ThreadStorageFilesQuery = z$1.infer;\ndeclare const threadStoragePathsQuerySchema: z$1.ZodObject<{\n query: z$1.ZodOptional;\n limit: z$1.ZodOptional;\n includeFiles: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n includeDirectories: z$1.ZodEnum<{\n true: \"true\";\n false: \"false\";\n }>;\n}, z$1.core.$strip>;\ntype ThreadStoragePathsQuery = z$1.infer;\ndeclare const timelineTurnSummaryDetailsResponseSchema: z$1.ZodObject<{\n rows: z$1.ZodArray>>;\n workPage: z$1.ZodNullable>;\n }, z$1.core.$strict>>;\n}, z$1.core.$strip>;\ntype TimelineTurnSummaryDetailsResponse = z$1.infer;\ndeclare const threadTimelineResponseSchema: z$1.ZodObject<{\n rows: z$1.ZodArray>>;\n activePromptMode: z$1.ZodNullable;\n providerId: z$1.ZodEnum<{\n codex: \"codex\";\n \"claude-code\": \"claude-code\";\n }>;\n prompt: z$1.ZodString;\n }, z$1.core.$strict>>;\n activeThinking: z$1.ZodNullable>;\n activeWorkflow: z$1.ZodNullable;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"workflow\">;\n itemId: z$1.ZodString;\n taskType: z$1.ZodString;\n workflowName: z$1.ZodNullable;\n description: z$1.ZodString;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n running: \"running\";\n paused: \"paused\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n workflow: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodNullable>;\n summary: z$1.ZodNullable;\n error: z$1.ZodNullable;\n completedAt: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n activeBackgroundCommands: z$1.ZodArray;\n sourceSeqStart: z$1.ZodNumber;\n sourceSeqEnd: z$1.ZodNumber;\n startedAt: z$1.ZodNumber;\n createdAt: z$1.ZodNumber;\n kind: z$1.ZodLiteral<\"work\">;\n status: z$1.ZodEnum<{\n error: \"error\";\n pending: \"pending\";\n completed: \"completed\";\n interrupted: \"interrupted\";\n }>;\n workKind: z$1.ZodLiteral<\"workflow\">;\n itemId: z$1.ZodString;\n taskType: z$1.ZodString;\n workflowName: z$1.ZodNullable;\n description: z$1.ZodString;\n taskStatus: z$1.ZodEnum<{\n pending: \"pending\";\n completed: \"completed\";\n running: \"running\";\n paused: \"paused\";\n failed: \"failed\";\n killed: \"killed\";\n stopped: \"stopped\";\n }>;\n workflow: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n agents: z$1.ZodArray;\n model: z$1.ZodString;\n attempt: z$1.ZodNumber;\n cached: z$1.ZodBoolean;\n lastProgressAt: z$1.ZodNumber;\n phaseIndex: z$1.ZodOptional;\n phaseTitle: z$1.ZodOptional;\n agentType: z$1.ZodOptional;\n isolation: z$1.ZodOptional;\n queuedAt: z$1.ZodOptional;\n startedAt: z$1.ZodOptional;\n lastToolName: z$1.ZodOptional;\n lastToolSummary: z$1.ZodOptional;\n promptPreview: z$1.ZodOptional;\n resultPreview: z$1.ZodOptional;\n error: z$1.ZodOptional;\n tokens: z$1.ZodOptional;\n toolCalls: z$1.ZodOptional;\n durationMs: z$1.ZodOptional;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n usage: z$1.ZodNullable>;\n summary: z$1.ZodNullable;\n error: z$1.ZodNullable;\n completedAt: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n pendingTodos: z$1.ZodNullable;\n }, z$1.core.$strip>>;\n }, z$1.core.$strip>>;\n goal: z$1.ZodNullable;\n tokenBudget: z$1.ZodNullable;\n tokensUsed: z$1.ZodNumber;\n timeUsedSeconds: z$1.ZodNumber;\n }, z$1.core.$strip>>;\n modelFallback: z$1.ZodNullable;\n message: z$1.ZodString;\n }, z$1.core.$strip>>;\n contextWindowUsage: z$1.ZodOptional>;\n timelinePage: z$1.ZodObject<{\n kind: z$1.ZodEnum<{\n latest: \"latest\";\n older: \"older\";\n }>;\n segmentLimit: z$1.ZodNumber;\n returnedSegmentCount: z$1.ZodNumber;\n hasOlderRows: z$1.ZodBoolean;\n olderCursor: z$1.ZodNullable>;\n }, z$1.core.$strict>;\n maxSeq: z$1.ZodNumber;\n delta: z$1.ZodOptional>>;\n rowOrder: z$1.ZodOptional>;\n }, z$1.core.$strip>>;\n}, z$1.core.$strip>;\ntype ThreadTimelineResponse = z$1.infer;\ndeclare const threadConversationOutlineResponseSchema: z$1.ZodObject<{\n items: z$1.ZodArray;\n preview: z$1.ZodString;\n attachmentSummary: z$1.ZodNullable>;\n }, z$1.core.$strict>>;\n maxSeq: z$1.ZodNumber;\n}, z$1.core.$strict>;\ntype ThreadConversationOutlineResponse = z$1.infer;\ndeclare const threadStorageFileListResponseSchema: z$1.ZodObject<{\n files: z$1.ZodArray>;\n truncated: z$1.ZodBoolean;\n storageRootPath: z$1.ZodString;\n}, z$1.core.$strip>;\ntype ThreadStorageFileListResponse = z$1.infer;\ndeclare const threadStoragePathListResponseSchema: z$1.ZodObject<{\n paths: z$1.ZodArray;\n path: z$1.ZodString;\n name: z$1.ZodString;\n score: z$1.ZodNumber;\n positions: z$1.ZodArray;\n }, z$1.core.$strip>>;\n truncated: z$1.ZodBoolean;\n storageRootPath: z$1.ZodString;\n}, z$1.core.$strip>;\ntype ThreadStoragePathListResponse = z$1.infer;\n\ndeclare const threadTabsResponseSchema: z$1.ZodObject<{\n revision: z$1.ZodNumber;\n tabs: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"git-diff\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n actionId: z$1.ZodString;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"plugin-panel\">;\n paramsJson: z$1.ZodNullable;\n pluginId: z$1.ZodString;\n title: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"workspace-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n projectId: z$1.ZodNullable;\n source: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"working-tree\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"head\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"merge-base\">;\n ref: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">;\n statusLabel: z$1.ZodNullable>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"host-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n threadId: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n isPinned: z$1.ZodBoolean;\n kind: z$1.ZodLiteral<\"thread-storage-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n threadId: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"browser\">;\n title: z$1.ZodNullable;\n url: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"new-tab\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"side-chat\">;\n sourceMessageText: z$1.ZodString;\n sourceSeqEnd: z$1.ZodNullable;\n threadId: z$1.ZodNullable;\n title: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"terminal\">;\n terminalId: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n}, z$1.core.$strict>;\ntype ThreadTabsResponse = z$1.infer;\ndeclare const updateThreadTabsRequestSchema: z$1.ZodObject<{\n expectedRevision: z$1.ZodNumber;\n tabs: z$1.ZodArray;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"git-diff\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n actionId: z$1.ZodString;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"plugin-panel\">;\n paramsJson: z$1.ZodNullable;\n pluginId: z$1.ZodString;\n title: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"workspace-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n projectId: z$1.ZodNullable;\n source: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"working-tree\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"head\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n kind: z$1.ZodLiteral<\"merge-base\">;\n ref: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">;\n statusLabel: z$1.ZodNullable>;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"host-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n threadId: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n isPinned: z$1.ZodBoolean;\n kind: z$1.ZodLiteral<\"thread-storage-file-preview\">;\n lineRange: z$1.ZodNullable>;\n path: z$1.ZodString;\n threadId: z$1.ZodNullable;\n }, z$1.core.$strict>, z$1.ZodObject<{\n environmentId: z$1.ZodNullable;\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"browser\">;\n title: z$1.ZodNullable;\n url: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"new-tab\">;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"side-chat\">;\n sourceMessageText: z$1.ZodString;\n sourceSeqEnd: z$1.ZodNullable;\n threadId: z$1.ZodNullable;\n title: z$1.ZodString;\n }, z$1.core.$strict>, z$1.ZodObject<{\n id: z$1.ZodString;\n kind: z$1.ZodLiteral<\"terminal\">;\n terminalId: z$1.ZodString;\n }, z$1.core.$strict>], \"kind\">>;\n}, z$1.core.$strict>;\ntype UpdateThreadTabsRequest = z$1.infer;\n\ninterface EnvironmentGetArgs {\n environmentId: string;\n}\ntype EnvironmentMergeBaseBranchUpdateValue = Exclude;\ntype EnvironmentNameUpdateValue = Exclude;\ninterface EnvironmentMergeBaseBranchUpdate {\n mergeBaseBranch: EnvironmentMergeBaseBranchUpdateValue;\n name?: EnvironmentNameUpdateValue;\n}\ninterface EnvironmentNameUpdate {\n mergeBaseBranch?: EnvironmentMergeBaseBranchUpdateValue;\n name: EnvironmentNameUpdateValue;\n}\ntype EnvironmentUpdateFields = EnvironmentMergeBaseBranchUpdate | EnvironmentNameUpdate;\ntype EnvironmentUpdateArgs = EnvironmentUpdateFields & {\n environmentId: string;\n};\ninterface EnvironmentStatusArgs extends EnvironmentStatusQuery {\n environmentId: string;\n}\ntype EnvironmentDiffArgs = EnvironmentDiffQuery & {\n environmentId: string;\n};\ntype EnvironmentDiffFileArgs = EnvironmentDiffFileQuery & {\n environmentId: string;\n};\ninterface EnvironmentDiffBranchesArgs extends EnvironmentDiffBranchesQuery {\n environmentId: string;\n}\ninterface EnvironmentCommitArgs {\n environmentId: string;\n}\ninterface EnvironmentSquashMergeArgs {\n environmentId: string;\n mergeBaseBranch: string;\n}\ninterface EnvironmentPullRequestMergeArgs {\n environmentId: string;\n method: PullRequestMergeMethod;\n}\ntype EnvironmentDiffPatchArgs = EnvironmentDiffPatchRequest & {\n environmentId: string;\n};\ninterface EnvironmentPathsArgs extends EnvironmentPathsQuery {\n environmentId: string;\n}\ntype EnvironmentArchiveThreadsResult = EnvironmentArchiveThreadsResponse;\ntype EnvironmentCommitResult = CommitActionResponse;\ntype EnvironmentDiffResult = EnvironmentDiffResponse;\ntype EnvironmentDiffBranchesResult = EnvironmentDiffBranchesResponse;\ntype EnvironmentDiffFileResult = EnvironmentDiffFileResponse;\ntype EnvironmentDiffFilesResult = EnvironmentDiffFilesResponse;\ntype EnvironmentDiffPatchResult = EnvironmentDiffPatchResponse;\ntype EnvironmentGetResult = Environment;\ntype EnvironmentMarkPullRequestDraftResult = PullRequestDraftActionResponse;\ntype EnvironmentMarkPullRequestReadyResult = PullRequestReadyActionResponse;\ntype EnvironmentMergePullRequestResult = PullRequestMergeActionResponse;\ntype EnvironmentPathsResult = WorkspacePathListResponse;\ntype EnvironmentPullRequestResult = EnvironmentPullRequestResponse;\ntype EnvironmentSquashMergeResult = SquashMergeActionResponse;\ntype EnvironmentStatusResult = EnvironmentStatusResponse;\ntype EnvironmentUpdateResult = Environment;\ninterface EnvironmentsArea {\n archiveThreads(args: EnvironmentGetArgs): Promise;\n commit(args: EnvironmentCommitArgs): Promise;\n diff(args: EnvironmentDiffArgs): Promise;\n diffBranches(args: EnvironmentDiffBranchesArgs): Promise;\n diffFile(args: EnvironmentDiffFileArgs): Promise;\n diffFiles(args: EnvironmentDiffArgs): Promise;\n diffPatch(args: EnvironmentDiffPatchArgs): Promise;\n get(args: EnvironmentGetArgs): Promise;\n pullRequest(args: EnvironmentGetArgs): Promise;\n markPullRequestDraft(args: EnvironmentGetArgs): Promise;\n markPullRequestReady(args: EnvironmentGetArgs): Promise;\n mergePullRequest(args: EnvironmentPullRequestMergeArgs): Promise;\n paths(args: EnvironmentPathsArgs): Promise;\n squashMerge(args: EnvironmentSquashMergeArgs): Promise;\n status(args: EnvironmentStatusArgs): Promise;\n update(args: EnvironmentUpdateArgs): Promise;\n}\n\n/**\n * Host file primitives. `hostId` may be omitted to target the server's\n * primary (local) host. `rootPath`, when set, confines the target beneath\n * that absolute root on the host (symlink-safe).\n */\ninterface FileReadArgs {\n hostId?: string;\n path: string;\n rootPath?: string;\n}\ninterface FileWriteArgs {\n hostId?: string;\n path: string;\n rootPath?: string;\n content: string;\n /** Defaults to \"utf8\". */\n contentEncoding?: \"utf8\" | \"base64\";\n /** Defaults to false. */\n createParents?: boolean;\n /**\n * Optimistic-concurrency guard: omitted → unconditional write; a hash →\n * write only when the current content hashes to it (use `read().sha256`);\n * null → create-only. A failed guard resolves to the `conflict` outcome.\n */\n expectedSha256?: string | null;\n /** POSIX permission bits used when creating a file (for example 0o600). */\n mode?: number;\n}\ninterface FileListArgs {\n hostId?: string;\n path: string;\n query?: string;\n limit?: number;\n}\ninterface PathListArgs extends FileListArgs {\n includeFiles: boolean;\n includeDirectories: boolean;\n}\ninterface FileMkdirArgs {\n hostId?: string;\n path: string;\n rootPath?: string;\n recursive?: boolean;\n}\ninterface FileMoveArgs {\n hostId?: string;\n sourcePath: string;\n destinationPath: string;\n rootPath?: string;\n}\ninterface FileRemoveArgs {\n hostId?: string;\n path: string;\n rootPath?: string;\n recursive?: boolean;\n}\ninterface FilePreviewArgs {\n hostId?: string;\n rootPath: string;\n ttlMs?: number;\n}\ntype FileReadResult = HostFileReadResponse;\ntype FileWriteResult = HostFileWriteResponse;\ntype FileListResult = HostFileListResponse;\ntype PathListResult = HostPathListResponse;\ntype FileMkdirResult = HostMkdirResponse;\ntype FileMoveResult = HostMovePathResponse;\ntype FileRemoveResult = HostRemovePathResponse;\ntype FilePreviewResult = CreateFilePreviewResponse;\ninterface FilesArea {\n read(args: FileReadArgs): Promise;\n write(args: FileWriteArgs): Promise;\n list(args: FileListArgs): Promise;\n listPaths(args: PathListArgs): Promise;\n mkdir(args: FileMkdirArgs): Promise;\n move(args: FileMoveArgs): Promise;\n remove(args: FileRemoveArgs): Promise;\n createPreview(args: FilePreviewArgs): Promise;\n}\n\ninterface GuideRenderArgs {\n chapter?: string;\n}\ninterface GuideRenderResult {\n chapter?: string;\n content: string;\n}\ninterface GuideArea {\n render(args?: GuideRenderArgs): GuideRenderResult;\n}\n\ninterface HostGetArgs {\n hostId: string;\n}\ninterface HostUpdateArgs extends UpdateHostRequest {\n hostId: string;\n}\ninterface HostDirectoryArgs extends HostDirectoryQuery {\n hostId: string;\n}\ninterface HostCloneDefaultPathArgs extends HostCloneDefaultPathQuery {\n hostId: string;\n}\ninterface HostPathsExistArgs extends HostPathsExistRequest {\n hostId: string;\n}\ninterface HostPickFolderArgs extends HostPickFolderRequest {\n hostId: string;\n}\ninterface HostProviderCliInstallArgs extends HostProviderCliInstallRequest {\n hostId: string;\n}\ntype HostCreateJoinCodeResult = CreateHostJoinCodeResponse;\ntype HostDeleteResult = {\n ok: true;\n};\ntype HostDirectoryResult = HostDirectoryListing;\ntype HostGetResult = Host;\ntype HostCloneDefaultPathResult = HostCloneDefaultPathResponse;\ntype HostProviderCliInstallResult = HostProviderCliInstallEvent[];\ntype HostListResult = Host[];\ntype HostPathsExistResult = HostPathsExistResponse;\ntype HostPickFolderResult = HostPickFolderResponse;\ntype HostProviderCliStatusResult = HostProviderCliStatusResponse;\ntype HostUpdateResult = Host;\ninterface HostsArea {\n createJoinCode(): Promise;\n delete(args: HostGetArgs): Promise;\n directory(args: HostDirectoryArgs): Promise;\n get(args: HostGetArgs): Promise;\n cloneDefaultPath(args: HostCloneDefaultPathArgs): Promise;\n installProviderCli(args: HostProviderCliInstallArgs): Promise;\n list(): Promise;\n pathsExist(args: HostPathsExistArgs): Promise;\n pickFolder(args: HostPickFolderArgs): Promise;\n providerCliStatus(args: HostGetArgs): Promise;\n update(args: HostUpdateArgs): Promise;\n}\n\ninterface ProjectListArgs {\n include?: ProjectListQuery[\"include\"];\n /** Include the singleton personal project. Defaults to false for compatibility. */\n includePersonal?: boolean;\n}\ninterface ProjectCreateArgs extends CreateProjectRequest {\n}\ninterface ProjectGetArgs {\n projectId: string;\n}\ninterface ProjectUpdateArgs extends UpdateProjectRequest {\n projectId: string;\n}\ninterface ProjectDeleteArgs {\n projectId: string;\n}\ninterface ProjectReorderArgs extends ReorderProjectRequest {\n projectId: string;\n}\ninterface ProjectPromptHistoryArgs extends PromptHistoryQuery {\n projectId: string;\n}\n/** Select one project workspace source, or omit both for the primary host. */\ntype ProjectWorkspaceRoutingArgs = {\n environmentId: string;\n hostId?: never;\n} | {\n environmentId?: never;\n hostId: string;\n} | {\n environmentId?: never;\n hostId?: never;\n};\ntype ProjectFilesArgs = ProjectWorkspaceRoutingArgs & Omit & {\n projectId: string;\n};\ntype ProjectPathsArgs = ProjectWorkspaceRoutingArgs & Omit & {\n projectId: string;\n};\ntype ProjectCommandsArgs = ProjectWorkspaceRoutingArgs & Omit & {\n projectId: string;\n};\ntype ProjectFileContentArgs = ProjectWorkspaceRoutingArgs & Omit & {\n projectId: string;\n};\ninterface ProjectBranchesArgs extends ProjectBranchesQuery {\n projectId: string;\n}\ninterface ProjectDefaultExecutionOptionsArgs {\n projectId: string;\n}\ninterface ProjectAttachmentFileLike {\n arrayBuffer(): Promise;\n readonly name: string;\n readonly type?: string;\n}\ninterface ProjectAttachmentUploadArgsBase {\n /** MIME override. Omit to use the File/Blob type, when available. */\n mimeType?: string;\n projectId: string;\n}\n/**\n * Upload bytes owned by this SDK client. A bare Blob/byte buffer needs an\n * explicit filename; File-like values can supply their own name.\n */\ntype ProjectAttachmentUploadArgs = ProjectAttachmentUploadArgsBase & ({\n clientFile: ProjectAttachmentFileLike;\n filename?: string;\n} | {\n clientFile: ArrayBuffer | Blob | Uint8Array;\n filename: string;\n});\ninterface ProjectAttachmentReadArgs {\n path: string;\n projectId: string;\n}\ntype ProjectSourceAddArgs = CreateProjectSourceRequest & {\n projectId: string;\n};\ninterface ProjectSourceUpdateArgs extends UpdateProjectSourceRequest {\n projectId: string;\n sourceId: string;\n}\ninterface ProjectSourceDeleteArgs {\n projectId: string;\n sourceId: string;\n}\ntype ProjectBranchesResult = ProjectBranchesResponse;\ninterface ProjectAttachmentReadResult {\n bytes: Uint8Array;\n mimeType: string;\n sizeBytes: number;\n}\ntype ProjectAttachmentUploadResult = UploadedPromptAttachment;\ntype ProjectCommandsResult = CommandListResponse;\ntype ProjectCreateResult = ProjectResponse;\ntype ProjectDefaultExecutionOptionsResult = ProjectExecutionDefaults | null;\ntype ProjectDeleteResult = {\n ok: true;\n};\ninterface ProjectFileContentResult {\n /** UTF-8 text or base64, as selected by `contentEncoding`. */\n content: string;\n contentEncoding: \"utf8\" | \"base64\";\n mimeType: string;\n sizeBytes: number;\n}\ntype ProjectFilesResult = WorkspaceFileListResponse;\ntype ProjectGetResult = ProjectResponse;\ntype ProjectListResult = ProjectResponse[] | ProjectWithThreadsResponse[];\ntype ProjectPathsResult = WorkspacePathListResponse;\ntype ProjectPromptHistoryResult = PromptHistoryResponse;\ntype ProjectReorderResult = ProjectResponse[];\ntype ProjectSourceAddResult = ProjectSource;\ntype ProjectSourceDeleteResult = {\n ok: true;\n};\ntype ProjectSourceUpdateResult = ProjectSource;\ntype ProjectUpdateResult = ProjectResponse;\ninterface ProjectSourcesArea {\n add(args: ProjectSourceAddArgs): Promise;\n delete(args: ProjectSourceDeleteArgs): Promise;\n update(args: ProjectSourceUpdateArgs): Promise;\n}\ninterface ProjectAttachmentsArea {\n read(args: ProjectAttachmentReadArgs): Promise;\n upload(args: ProjectAttachmentUploadArgs): Promise;\n}\ninterface ProjectsArea {\n attachments: ProjectAttachmentsArea;\n branches(args: ProjectBranchesArgs): Promise;\n commands(args: ProjectCommandsArgs): Promise;\n create(args: ProjectCreateArgs): Promise;\n defaultExecutionOptions(args: ProjectDefaultExecutionOptionsArgs): Promise;\n delete(args: ProjectDeleteArgs): Promise;\n fileContent(args: ProjectFileContentArgs): Promise;\n files(args: ProjectFilesArgs): Promise;\n get(args: ProjectGetArgs): Promise;\n list(args?: ProjectListArgs): Promise;\n paths(args: ProjectPathsArgs): Promise;\n promptHistory(args: ProjectPromptHistoryArgs): Promise;\n reorder(args: ProjectReorderArgs): Promise;\n sources: ProjectSourcesArea;\n update(args: ProjectUpdateArgs): Promise;\n}\n\n/** Select exactly one provider-discovery host source, or omit both for primary. */\ntype ProviderHostRoutingArgs = {\n environmentId: string;\n hostId?: never;\n} | {\n environmentId?: never;\n hostId: string;\n} | {\n environmentId?: never;\n hostId?: never;\n};\ntype ProviderListArgs = ProviderHostRoutingArgs;\ntype ProviderModelsArgs = ProviderHostRoutingArgs & {\n providerId?: string;\n};\ntype ProviderListResult = ProviderInfo[];\ntype ProviderModelsResult = SystemExecutionOptionsResponse;\ninterface ProvidersArea {\n /** List providers on the environment host, explicit host, or primary host. */\n list(args?: ProviderListArgs): Promise;\n /** List models on the environment host, explicit host, or primary host. */\n models(args?: ProviderModelsArgs): Promise;\n}\n\ninterface PluginIdArgs {\n pluginId: string;\n}\n/** Install directly from a path:, git:, npm:, or builtin: source spec. */\ninterface PluginInstallArgs {\n source: string;\n}\n/** Install an entry from BB's official catalog. */\ninterface PluginCatalogInstallArgs {\n entryId: string;\n}\ninterface PluginReloadArgs {\n pluginId?: string;\n}\ninterface PluginSettingsUpdateArgs extends PluginIdArgs {\n values: Record;\n}\ninterface PluginTokenArgs extends PluginIdArgs {\n rotate?: boolean;\n}\ninterface PluginCheckUpdatesArgs {\n pluginId?: string;\n}\ninterface PluginRpcArgs extends PluginIdArgs {\n input?: JsonValue;\n method: string;\n outputSchema: z$1.ZodType;\n}\ninterface PluginCatalogSearchArgs {\n query: string;\n}\ntype PluginDisableResult = InstalledPlugin;\ntype PluginEnableResult = InstalledPlugin;\ntype PluginGetSettingsResult = PluginSettingsResponse;\ntype PluginInstallResult = InstalledPlugin;\ntype PluginListResult = PluginListResponse;\ntype PluginReloadResult = PluginReloadResponse;\ntype PluginRemoveResult = PluginRemoveResponse;\ntype PluginTokenResult = PluginTokenResponse;\ntype PluginUpdateSettingsResult = PluginSettingsResponse;\ntype PluginGetSourceResult = PluginSourceDetail;\ntype PluginCheckUpdatesResult = PluginUpdateCheckEntry[];\ntype PluginApplyUpdateResult = PluginApplyUpdateResult$1;\ntype PluginCatalogStatusResult = PluginCatalogStatus;\ntype PluginCatalogSearchResult = PluginCatalogSearchResult$1[];\ninterface PluginCatalogArea {\n install(args: PluginCatalogInstallArgs): Promise;\n search(args: PluginCatalogSearchArgs): Promise;\n status(): Promise;\n}\ninterface PluginsArea {\n applyUpdate(args: PluginIdArgs): Promise;\n callRpc(args: PluginRpcArgs): Promise;\n checkUpdates(args?: PluginCheckUpdatesArgs): Promise;\n catalog: PluginCatalogArea;\n disable(args: PluginIdArgs): Promise;\n enable(args: PluginIdArgs): Promise;\n getSettings(args: PluginIdArgs): Promise;\n getSource(args: PluginIdArgs): Promise;\n install(args: PluginInstallArgs): Promise;\n list(): Promise;\n listUpdateResults(): Promise;\n reload(args?: PluginReloadArgs): Promise;\n remove(args: PluginIdArgs): Promise;\n token(args: PluginTokenArgs): Promise;\n updateSettings(args: PluginSettingsUpdateArgs): Promise;\n}\n\ntype BbRealtimeUnsubscribe = () => void;\ntype BbRealtimeEventName = \"thread:changed\" | \"project:changed\" | \"environment:changed\" | \"host:changed\" | \"system:changed\" | \"system:config-changed\" | \"realtime:connection\";\ntype ThreadRealtimeEvent = Extract;\ntype ProjectRealtimeEvent = Extract;\ntype EnvironmentRealtimeEvent = Extract;\ntype HostRealtimeEvent = Extract;\ntype SystemRealtimeEvent = Extract;\ntype BbRealtimeConnectionState = \"connecting\" | \"connected\" | \"disconnected\";\ninterface BbRealtimeConnectionEvent {\n reconnectDelayMs: number | null;\n reconnected: boolean;\n state: BbRealtimeConnectionState;\n}\n/**\n * Entity-changed events are delivered as one shared object to every matching\n * listener; their payload types are readonly so a listener cannot mutate what\n * the next listener receives.\n */\ninterface BbRealtimeEventMap {\n \"thread:changed\": ThreadRealtimeEvent;\n \"project:changed\": ProjectRealtimeEvent;\n \"environment:changed\": EnvironmentRealtimeEvent;\n \"host:changed\": HostRealtimeEvent;\n \"system:changed\": SystemRealtimeEvent;\n \"system:config-changed\": SystemRealtimeEvent;\n \"realtime:connection\": BbRealtimeConnectionEvent;\n}\ntype BbRealtimeCallback = (event: BbRealtimeEventMap[TEventName]) => void;\ninterface ThreadRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"thread:changed\">;\n event: \"thread:changed\";\n threadId?: string;\n}\ninterface ProjectRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"project:changed\">;\n event: \"project:changed\";\n projectId?: string;\n}\ninterface EnvironmentRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"environment:changed\">;\n environmentId?: string;\n event: \"environment:changed\";\n}\ninterface HostRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"host:changed\">;\n event: \"host:changed\";\n hostId?: string;\n}\ninterface SystemRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"system:changed\">;\n event: \"system:changed\";\n}\ninterface SystemConfigRealtimeSubscribeArgs {\n callback: BbRealtimeCallback<\"system:config-changed\">;\n event: \"system:config-changed\";\n}\n/**\n * Connection listeners are pure observers — they never open or hold the\n * socket. A listener registered while a socket already exists receives the\n * latest connection event as a snapshot on the next microtask, so a status\n * UI mounted after connect still learns the current state.\n */\ninterface RealtimeConnectionSubscribeArgs {\n callback: BbRealtimeCallback<\"realtime:connection\">;\n event: \"realtime:connection\";\n}\ntype BbRealtimeSubscribeArgsUnion = ThreadRealtimeSubscribeArgs | ProjectRealtimeSubscribeArgs | EnvironmentRealtimeSubscribeArgs | HostRealtimeSubscribeArgs | SystemRealtimeSubscribeArgs | SystemConfigRealtimeSubscribeArgs | RealtimeConnectionSubscribeArgs;\ntype BbRealtimeSubscribeArgs = Extract;\ninterface BbRealtime {\n subscribe(args: BbRealtimeSubscribeArgs): BbRealtimeUnsubscribe;\n}\n\ninterface StatusGetArgs {\n projectId?: string;\n threadId?: string;\n}\ninterface StatusThreadSummary {\n environmentId: string | null;\n id: string;\n parentThreadId: string | null;\n pinnedAt: number | null;\n projectId: string;\n status: ThreadStatus;\n title: string | null;\n}\ntype StatusProject = ProjectResponse;\ntype StatusChildThreads = ThreadListResponse;\ninterface StatusResult {\n childThreads: StatusChildThreads | null;\n pendingTodos: ThreadTimelinePendingTodos | null;\n project: StatusProject | null;\n thread: StatusThreadSummary | null;\n}\ninterface StatusArea {\n get(args?: StatusGetArgs): Promise;\n}\n\ntype ThemeGetResult = AppTheme;\ntype ThemeCatalogResult = ThemeCatalogResponse;\ntype ThemeSetInput = AppThemeSelection;\ntype ThemeSetResult = AppTheme;\ninterface ThemeArea {\n /** The active app palette, resolved server-side (built-in id or custom CSS). */\n get(): Promise;\n /** The custom-theme directory plus discovered themes and the active palette. */\n catalog(): Promise;\n /** Set the complete app appearance selection in one request. */\n set(selection: ThemeSetInput): Promise;\n /**\n * Activate a palette by id while preserving the active favicon color. This\n * compatibility shorthand reads the active appearance before writing the\n * complete selection; prefer the object form when both values are known.\n */\n set(themeId: string): Promise;\n}\n\ninterface SystemVersionArgs {\n force?: boolean;\n}\ninterface SystemVoiceTranscriptionArgs {\n file: Blob;\n prompt?: string;\n}\ntype SystemAttentionResult = SystemAttentionResponse;\ntype SystemConfigResult = SystemConfigResponse;\ntype SystemExecutionOptionsResult = SystemExecutionOptionsResponse;\ntype SystemReloadConfigResult = SystemConfigReloadResponse;\ntype SystemVoiceTranscriptionResult = SystemVoiceTranscriptionResponse;\ntype SystemUpdateExperimentsResult = Experiments;\ntype SystemUpdateGeneralSettingsResult = AppSettings;\ntype SystemUpdateKeyboardSettingsResult = AppKeybindingOverrides;\ntype SystemUsageLimitsResult = ProviderUsageResponse;\ntype SystemVersionResult = SystemVersionResponse;\ninterface SystemArea {\n attention(): Promise;\n config(): Promise;\n executionOptions(args?: SystemExecutionOptionsQuery): Promise;\n reloadConfig(): Promise;\n transcribeVoice(args: SystemVoiceTranscriptionArgs): Promise;\n updateExperiments(args: Experiments): Promise;\n updateGeneralSettings(args: AppSettings): Promise;\n updateKeyboardSettings(args: AppKeybindingOverrides): Promise;\n usageLimits(args?: SystemUsageLimitsQuery): Promise;\n version(args?: SystemVersionArgs): Promise;\n}\n\ninterface TerminalThreadScope {\n cwd?: never;\n environmentId?: never;\n hostId?: never;\n kind: \"thread\";\n threadId: string;\n}\ninterface TerminalEnvironmentScope {\n environmentId: string;\n cwd?: never;\n hostId?: never;\n kind: \"environment\";\n threadId?: never;\n}\ninterface TerminalHostPathListScope {\n /** Optional exact initial working-directory filter on the selected host. */\n cwd?: string;\n environmentId?: never;\n hostId: string;\n kind: \"host_path\";\n threadId?: never;\n}\ninterface TerminalHostPathCreateScope {\n /** Null starts in the selected host's home directory. */\n cwd: string | null;\n environmentId?: never;\n hostId: string;\n kind: \"host_path\";\n threadId?: never;\n}\ntype TerminalListScope = TerminalThreadScope | TerminalEnvironmentScope | TerminalHostPathListScope;\ntype TerminalCreateScope = TerminalThreadScope | TerminalEnvironmentScope | TerminalHostPathCreateScope;\ninterface TerminalListArgs {\n scope: TerminalListScope;\n}\ninterface TerminalCreateArgs {\n cols: number;\n rows: number;\n scope: TerminalCreateScope;\n start?: CreateTerminalRequest[\"start\"];\n title?: string;\n}\ninterface TerminalTargetArgs {\n terminalId: string;\n}\ntype TerminalGetArgs = TerminalTargetArgs;\ninterface TerminalRenameArgs extends TerminalTargetArgs {\n title: UpdateTerminalRequest[\"title\"];\n}\ninterface TerminalCloseArgs extends TerminalTargetArgs {\n mode: \"force\" | \"if-clean\";\n}\ninterface TerminalInputArgs extends TerminalTargetArgs {\n dataBase64: TerminalInputRequest[\"dataBase64\"];\n}\ninterface TerminalResizeArgs extends TerminalTargetArgs {\n cols: TerminalResizeRequest[\"cols\"];\n rows: TerminalResizeRequest[\"rows\"];\n}\ninterface TerminalOutputArgs extends TerminalTargetArgs {\n limitChunks?: TerminalOutputQuery[\"limitChunks\"];\n sinceSeq?: TerminalOutputQuery[\"sinceSeq\"];\n tailBytes?: TerminalOutputQuery[\"tailBytes\"];\n}\ntype TerminalRestartArgs = TerminalTargetArgs;\ntype TerminalListResult = TerminalListResponse;\ntype TerminalCreateResult = TerminalSession;\ntype TerminalGetResult = TerminalSession;\ntype TerminalRenameResult = TerminalSession;\ntype TerminalCloseResult = TerminalSession;\ntype TerminalInputResult = TerminalSession;\ntype TerminalResizeResult = TerminalSession;\ntype TerminalOutputResult = TerminalOutputResponse;\ntype TerminalRestartResult = TerminalSession;\ninterface TerminalsArea {\n close(args: TerminalCloseArgs): Promise;\n create(args: TerminalCreateArgs): Promise;\n get(args: TerminalGetArgs): Promise;\n input(args: TerminalInputArgs): Promise;\n list(args: TerminalListArgs): Promise;\n output(args: TerminalOutputArgs): Promise;\n rename(args: TerminalRenameArgs): Promise;\n /**\n * Replace a terminal with a shell at the same scope, size, and title.\n * The original command is not replayed because terminal sessions do not\n * persist launch commands. The replacement has a new terminal ID.\n */\n restart(args: TerminalRestartArgs): Promise;\n resize(args: TerminalResizeArgs): Promise;\n}\n\ninterface ThreadListArgs {\n archived?: boolean;\n excludeSideChats?: boolean;\n folderId?: string;\n hasParent?: boolean;\n limit?: number;\n offset?: number;\n originKind?: ThreadListQuery[\"originKind\"];\n parentThreadId?: string;\n projectId?: string;\n sourceThreadId?: string;\n unfiled?: boolean;\n}\ninterface ThreadSearchArgs extends ThreadSearchQuery {\n}\ninterface ThreadGetArgs {\n include?: ThreadGetQuery[\"include\"];\n threadId: string;\n}\ntype ThreadGetResult = ThreadResponse | ThreadWithIncludesResponse;\ntype ThreadListResult = ThreadListResponse;\ntype ThreadSearchResult = ThreadSearchResponse;\ninterface ThreadOutputResponse {\n output: string | null;\n}\ntype ThreadMutationResult = ThreadResponse;\ntype ThreadSpawnResult = ThreadResponse;\ntype ThreadInteractionGetResult = PendingInteraction;\ntype ThreadInteractionListResult = ThreadPendingInteractionsResponse;\ntype ThreadInteractionResolveResult = PendingInteraction;\ntype ThreadInteractionRespondResult = PendingInteraction;\ntype ThreadInteractionCancelResult = PendingInteraction;\ntype ThreadEventsListResult = ThreadEventRow[];\ntype ThreadEventWaitResult = ThreadEventRow | null;\ntype ThreadTimelineResult = ThreadTimelineResponse;\ntype ThreadArchiveResult = ThreadArchiveAllResponse;\ntype ThreadOpenResult = ThreadOpenResponse;\ntype ThreadDeleteResult = {\n ok: true;\n};\ntype ThreadSendResult = {\n ok: true;\n};\ntype ThreadStopResult = {\n ok: true;\n};\ntype ThreadUnarchiveResult = {\n ok: true;\n};\ntype ThreadArchiveAllResult = ThreadArchiveAllResponse;\ntype ThreadReadStateResult = ThreadResponse;\ntype ThreadPinOrderResult = ThreadListResponse;\ntype ThreadPromptHistoryResult = PromptHistoryResponse;\ntype ThreadQueuedMessagesResult = ThreadQueuedMessageListResponse;\ntype ThreadQueuedMessageCreateResult = ThreadQueuedMessage;\ntype ThreadQueuedMessageDeleteResult = {\n ok: true;\n};\ntype ThreadQueuedMessageReorderResult = ThreadQueuedMessageListResponse;\ntype ThreadQueuedMessageSendResult = SendQueuedMessageResponse;\ntype ThreadQueuedMessageGroupBoundaryResult = ThreadQueuedMessageListResponse;\ntype ThreadTabsResult = ThreadTabsResponse;\ntype ThreadTabsUpdateResult = ThreadTabsResponse;\ntype ThreadStorageFilesResult = ThreadStorageFileListResponse;\ntype ThreadStoragePathsResult = ThreadStoragePathListResponse;\ntype ThreadChildSummaryResult = ThreadChildSummaryResponse;\ntype ThreadDefaultExecutionOptionsResult = ResolvedThreadExecutionOptions | null;\ntype ThreadConversationOutlineResult = ThreadConversationOutlineResponse;\ntype ThreadTimelineTurnSummaryDetailsResult = TimelineTurnSummaryDetailsResponse;\ninterface ThreadSpawnBaseArgs extends Omit {\n childOrigin?: CreateThreadRequest[\"childOrigin\"];\n origin?: CreateThreadRequest[\"origin\"];\n originKind?: CreateThreadRequest[\"originKind\"];\n startedOnBehalfOf?: CreateThreadRequest[\"startedOnBehalfOf\"];\n}\ntype ThreadSpawnArgs = ThreadSpawnBaseArgs & ({\n input: CreateThreadRequest[\"input\"];\n prompt?: never;\n} | {\n input?: never;\n prompt: string;\n});\ninterface ThreadUpdateArgs extends UpdateThreadRequest {\n threadId: string;\n}\ninterface ThreadDeleteArgs extends DeleteThreadRequest {\n threadId: string;\n}\ninterface ThreadSendArgs extends SendMessageRequest {\n threadId: string;\n}\ninterface ThreadStatusArgs {\n threadId: string;\n}\ninterface ThreadPromptHistoryArgs extends PromptHistoryQuery {\n threadId: string;\n}\ninterface ThreadPinOrderArgs extends ReorderPinnedThreadRequest {\n threadId: string;\n}\ninterface ThreadQueuedMessageArgs {\n threadId: string;\n}\ninterface ThreadQueuedMessageCreateArgs extends CreateQueuedMessageRequest {\n threadId: string;\n}\ninterface ThreadQueuedMessageTargetArgs {\n queuedMessageId: string;\n threadId: string;\n}\ninterface ThreadQueuedMessageSendArgs extends ThreadQueuedMessageTargetArgs, SendQueuedMessageRequest {\n}\ninterface ThreadQueuedMessageReorderArgs extends ThreadQueuedMessageTargetArgs, ReorderQueuedMessageRequest {\n}\ninterface ThreadQueuedMessageGroupBoundaryArgs extends SetQueuedMessageGroupBoundaryRequest {\n threadId: string;\n}\ninterface ThreadStorageFilesArgs extends ThreadStorageFilesQuery {\n threadId: string;\n}\ninterface ThreadStoragePathsArgs extends ThreadStoragePathsQuery {\n threadId: string;\n}\ninterface ThreadTimelineTurnSummaryDetailsArgs extends TimelineTurnSummaryDetailsQuery {\n threadId: string;\n}\ninterface ThreadTabsUpdateArgs extends UpdateThreadTabsRequest {\n threadId: string;\n}\ninterface ThreadOpenArgs {\n threadId: string;\n split?: ThreadOpenSplit;\n file: ThreadOpenFile | null;\n}\ninterface ThreadEventsListArgs {\n afterSeq?: string;\n limit?: string;\n threadId: string;\n}\ninterface ThreadEventWaitArgs {\n afterSeq?: string;\n threadId: string;\n type: string;\n waitMs: string;\n}\ninterface ThreadTimelineArgs extends ThreadTimelineQuery {\n threadId: string;\n}\ninterface ThreadOutputArgs {\n threadId: string;\n}\ninterface ThreadInteractionListArgs {\n threadId: string;\n}\ninterface ThreadInteractionGetArgs extends ThreadInteractionListArgs {\n interactionId: string;\n}\ninterface ThreadInteractionResolveArgs extends ThreadInteractionGetArgs {\n resolution: PendingInteractionResolution;\n}\ninterface ThreadInteractionRespondArgs extends ThreadInteractionGetArgs {\n value: JsonValue;\n}\ntype ThreadWaitTarget = {\n kind: \"status\";\n status: ThreadStatus;\n} | {\n kind: \"event\";\n eventType: string;\n};\ninterface ThreadWaitArgs {\n event?: string;\n pollIntervalMs?: number;\n status?: ThreadStatus;\n threadId: string;\n timeoutMs?: number;\n}\ntype ThreadWaitResult = {\n event: NonNullable;\n matched: true;\n target: Extract;\n threadId: string;\n} | {\n matched: true;\n target: Extract;\n thread: ThreadGetResult;\n threadId: string;\n};\ninterface ThreadInteractionsArea {\n cancel(args: ThreadInteractionGetArgs): Promise;\n get(args: ThreadInteractionGetArgs): Promise;\n list(args: ThreadInteractionListArgs): Promise;\n resolve(args: ThreadInteractionResolveArgs): Promise;\n respond(args: ThreadInteractionRespondArgs): Promise;\n}\ninterface ThreadEventsArea {\n list(args: ThreadEventsListArgs): Promise;\n wait(args: ThreadEventWaitArgs): Promise;\n}\ninterface ThreadQueuedMessagesArea {\n create(args: ThreadQueuedMessageCreateArgs): Promise;\n delete(args: ThreadQueuedMessageTargetArgs): Promise;\n list(args: ThreadQueuedMessageArgs): Promise;\n reorder(args: ThreadQueuedMessageReorderArgs): Promise;\n send(args: ThreadQueuedMessageSendArgs): Promise;\n setGroupBoundary(args: ThreadQueuedMessageGroupBoundaryArgs): Promise;\n}\ninterface ThreadTabsArea {\n get(args: ThreadStatusArgs): Promise;\n update(args: ThreadTabsUpdateArgs): Promise;\n}\ninterface ThreadsArea {\n archive(args: ThreadStatusArgs): Promise;\n archiveAll(args: ThreadStatusArgs): Promise;\n childSummary(args: ThreadStatusArgs): Promise;\n conversationOutline(args: ThreadStatusArgs): Promise;\n defaultExecutionOptions(args: ThreadStatusArgs): Promise;\n delete(args: ThreadDeleteArgs): Promise;\n events: ThreadEventsArea;\n get(args: ThreadGetArgs): Promise;\n interactions: ThreadInteractionsArea;\n list(args?: ThreadListArgs): Promise;\n markRead(args: ThreadStatusArgs): Promise;\n markUnread(args: ThreadStatusArgs): Promise;\n open(args: ThreadOpenArgs): Promise;\n output(args: ThreadOutputArgs): Promise;\n pin(args: ThreadStatusArgs): Promise;\n promptHistory(args: ThreadPromptHistoryArgs): Promise;\n queuedMessages: ThreadQueuedMessagesArea;\n reorderPinned(args: ThreadPinOrderArgs): Promise;\n search(args: ThreadSearchArgs): Promise;\n send(args: ThreadSendArgs): Promise;\n spawn(args: ThreadSpawnArgs): Promise;\n stop(args: ThreadStatusArgs): Promise;\n tabs: ThreadTabsArea;\n timeline(args: ThreadTimelineArgs): Promise;\n timelineTurnSummaryDetails(args: ThreadTimelineTurnSummaryDetailsArgs): Promise;\n storageFiles(args: ThreadStorageFilesArgs): Promise;\n storagePaths(args: ThreadStoragePathsArgs): Promise;\n unarchive(args: ThreadStatusArgs): Promise;\n unpin(args: ThreadStatusArgs): Promise;\n update(args: ThreadUpdateArgs): Promise;\n wait(args: ThreadWaitArgs): Promise;\n}\n\ntype ThreadFolderCreateResult = ThreadFolderResponse;\ntype ThreadFolderUpdateResult = ThreadFolderMutationResponse;\ntype ThreadFolderDeleteResult = ThreadFolderMutationResponse;\ntype ThreadFolderListResult = ThreadFolderResponse[];\ninterface ThreadFoldersArea {\n create(args: CreateThreadFolderRequest): Promise;\n delete(args: DeleteThreadFolderRequest): Promise;\n list(): Promise;\n update(args: UpdateThreadFolderRequest): Promise;\n}\n\ninterface BbSdk extends BbRealtime {\n environments: EnvironmentsArea;\n files: FilesArea;\n guide: GuideArea;\n hosts: HostsArea;\n projects: ProjectsArea;\n plugins: PluginsArea;\n providers: ProvidersArea;\n status: StatusArea;\n system: SystemArea;\n terminals: TerminalsArea;\n theme: ThemeArea;\n threadFolders: ThreadFoldersArea;\n threads: ThreadsArea;\n}\n\n/**\n * The backend plugin API contract — the `bb` object handed to a plugin's\n * `server.ts` factory (`export default function plugin(bb: BbPluginApi)`).\n *\n * Types only: the implementation lives in the BB server\n * (apps/server/src/services/plugins/plugin-api.ts), which imports these\n * shapes so the contract and the implementation cannot drift. Plugin authors\n * import them type-only (`import type { BbPluginApi } from\n * \"@bb/plugin-sdk\"`); the import is erased when BB loads the file.\n *\n * Runtime classes stay host-side. NeedsConfigurationError in particular is\n * matched by NAME, so plugin code needs no runtime import:\n * `throw Object.assign(new Error(msg), { name: \"NeedsConfigurationError\" })`.\n */\ninterface PluginLogger {\n debug(message: string): void;\n info(message: string): void;\n warn(message: string): void;\n error(message: string): void;\n}\n/**\n * Declarative settings descriptors (`bb.settings.define`). Deliberately plain\n * data — not zod — so the host can render settings forms and the CLI can\n * parse values without executing plugin code.\n */\ntype PluginSettingDescriptor = {\n type: \"string\";\n label: string;\n description?: string;\n /** Stored in a 0600 file under /plugins//secrets/, never in the db or sent to the frontend. */\n secret?: true;\n default?: string;\n} | {\n type: \"boolean\";\n label: string;\n description?: string;\n default?: boolean;\n} | {\n type: \"select\";\n label: string;\n description?: string;\n options: string[];\n default?: string;\n} | {\n type: \"project\";\n label: string;\n description?: string;\n default?: string;\n};\ntype PluginSettingDescriptors = Record;\ntype PluginSettingValue = string | boolean;\n/** `default` present → non-optional value; absent → `T | undefined`. */\ntype PluginSettingsValues> = {\n [K in keyof Ds]: Ds[K] extends {\n default: string | boolean;\n } ? PluginSettingValueOf : PluginSettingValueOf | undefined;\n};\ntype PluginSettingValueOf = D extends {\n type: \"boolean\";\n} ? boolean : string;\ninterface PluginSettingsHandle> {\n /** Load-safe: callable inside the factory. */\n get(): Promise>;\n /** Fires after values change through the settings route/CLI. */\n onChange(listener: (next: PluginSettingsValues, prev: PluginSettingsValues) => void): void;\n}\ninterface PluginSettings {\n define>(descriptors: Ds): PluginSettingsHandle;\n}\ninterface PluginKvStorage {\n get(key: string): Promise;\n set(key: string, value: unknown): Promise;\n delete(key: string): Promise;\n list(prefix?: string): Promise;\n}\ninterface PluginStorage {\n /** Namespaced JSON key-value rows in bb.db; values ≤256KB each. */\n kv: PluginKvStorage;\n /**\n * Open (or reuse the path of) the plugin's own SQLite database at\n * /plugins//data.db — the server's better-sqlite3, WAL mode,\n * busy_timeout 5000. Handles are host-tracked and closed on\n * dispose/reload; a closed handle throws on use.\n */\n database(): Database.Database;\n /**\n * Ordered-statement migration helper: statement index = migration id in a\n * `_bb_migrations` table; unapplied statements run in one transaction.\n * Append-only — never reorder or edit shipped statements.\n */\n migrate(db: Database.Database, statements: string[]): void;\n}\n/**\n * Thread lifecycle events a plugin can observe (design §4.5). Observe-only:\n * handlers run fire-and-forget after the transition is applied and can never\n * block or veto it. `thread` is the same public DTO GET /threads/:id serves.\n */\ninterface PluginThreadEventPayloads {\n /** Fired after a thread row is created. */\n \"thread.created\": {\n thread: ThreadResponse;\n };\n /** Fired when a thread transitions into `active`. */\n \"thread.active\": {\n thread: ThreadResponse;\n };\n /** Fired when a thread transitions into `idle`. `lastAssistantText` is\n * assembled the same way GET /threads/:id/output is. */\n \"thread.idle\": {\n thread: ThreadResponse;\n lastAssistantText: string | null;\n };\n /** Fired when a thread transitions into `error`. `error` is the latest\n * system/error event message, when one exists. */\n \"thread.failed\": {\n thread: ThreadResponse;\n error: string | null;\n };\n /** Fired after a thread is soft-deleted. */\n \"thread.deleted\": {\n thread: ThreadResponse;\n };\n}\ntype PluginThreadEventName = keyof PluginThreadEventPayloads;\ntype PluginThreadEventHandler = (payload: PluginThreadEventPayloads[E]) => void | Promise;\ntype PluginHttpAuthMode = \"local\" | \"token\" | \"none\";\ntype PluginHttpHandler = (context: Context) => Response | Promise;\ninterface PluginHttp {\n /**\n * Register an HTTP route, mounted at\n * `/api/v1/plugins//http/`. Auth modes (default \"local\"):\n * - \"local\": Origin/Host must be a local BB app origin; non-GET requires\n * content-type application/json (forces a CORS preflight).\n * - \"token\": requires the per-plugin token (`bb plugin token `) via\n * the x-bb-plugin-token header or ?token=.\n * - \"none\": no checks — only for signature-verified webhooks.\n */\n route(method: string, path: string, handler: PluginHttpHandler, opts?: {\n auth?: PluginHttpAuthMode;\n }): void;\n}\ninterface PluginRpc {\n /**\n * Register a Standard Schema-driven rpc contract and its inferred handlers,\n * served at POST\n * `/api/v1/plugins//rpc/` with \"local\" auth semantics. The\n * host validates input before invocation and output before strict JSON\n * serialization. The response is `{ ok: true, result }` or\n * `{ ok: false, error: { code, message, issues? } }`.\n */\n register(contract: Contract, handlers: PluginRpcHandlers): void;\n}\ninterface PluginRealtime {\n /**\n * Broadcast an ephemeral `plugin-signal` WS message\n * `{ pluginId, channel, payload }` to every connected client (V1 has no\n * per-channel subscriptions). `payload` must be JSON-serializable;\n * `undefined` is normalized to `null`. Nothing is persisted.\n */\n publish(channel: string, payload: unknown): void;\n}\ninterface PluginBackground {\n /**\n * Register a long-lived background service. `start` runs after the\n * factory completes and should resolve when `signal` aborts\n * (dispose/reload/disable/shutdown). A crash restarts it with capped\n * exponential backoff; throwing NeedsConfigurationError marks the plugin\n * `needs-configuration` and stops restarting until the next load.\n */\n service(name: string, service: {\n start(signal: AbortSignal): void | Promise;\n }): void;\n /**\n * Register a cron schedule (5-field expression, server-local time). The\n * durable row keyed (pluginId, name) is upserted at load; the periodic\n * sweep claims due rows with a CAS on next_run_at, but only while this\n * plugin is loaded. Failures land in last_status/last_error, visible in\n * `bb plugin list`.\n */\n schedule(name: string, cron: string, fn: () => void | Promise): void;\n}\ninterface PluginCliCommandInfo {\n name: string;\n summary: string;\n usage: string;\n}\n/** Context forwarded from the invoking CLI when known; all fields optional. */\ninterface PluginCliContext {\n cwd?: string;\n threadId?: string;\n projectId?: string;\n /** Aborted when the invoking CLI HTTP request disconnects. */\n signal?: AbortSignal;\n}\ntype PluginInteractionCancelReason = \"user\" | \"request-aborted\" | \"thread-stopped\" | \"thread-deleted\" | \"plugin-disposed\" | \"server-restarted\" | \"timeout\";\ntype PluginInteractionResult = {\n outcome: \"submitted\";\n value: JsonValue$1;\n} | {\n outcome: \"cancelled\";\n reason: PluginInteractionCancelReason;\n};\ninterface PluginInteractionRequest {\n threadId: string;\n rendererId: string;\n title: string;\n payload: JsonValue$1;\n /** Defaults to ten minutes; capped at one hour. */\n timeoutMs?: number;\n}\ninterface PluginCliResult {\n exitCode: number;\n stdout?: string;\n stderr?: string;\n}\ninterface PluginCliRegistration {\n /** Top-level command name (`bb …`): lowercase [a-z0-9-]+, and not\n * a core bb command (see RESERVED_BB_CLI_COMMANDS in the server). */\n name: string;\n summary: string;\n /** Subcommand metadata rendered in help and the plugin-commands skill\n * without executing plugin code. Parsing argv is plugin-owned. */\n commands?: PluginCliCommandInfo[];\n run(argv: string[], ctx: PluginCliContext): PluginCliResult | Promise;\n}\ninterface PluginCli {\n /**\n * Register this plugin's `bb` subcommand. One registration per factory\n * execution; a repeated call is rejected. Core bb commands always win\n * name collisions; reserved names are rejected at registration.\n */\n register(registration: PluginCliRegistration): void;\n}\n/** Per-turn context handed to bb.agents context providers (design §4.4). */\n/** MCP-style content parts a native tool may return (design §4.4). */\ntype PluginAgentToolContentPart = {\n type: \"text\";\n text: string;\n} | {\n type: \"image\";\n data: string;\n mimeType: string;\n};\ntype PluginAgentToolResult = string | {\n content: PluginAgentToolContentPart[];\n isError?: boolean;\n};\n/** Per-call context handed to a native tool's execute (design §4.4). */\ninterface PluginAgentToolContext {\n threadId: string;\n projectId: string;\n /** The tool-call request's abort signal (aborts if the daemon round-trip\n * is torn down mid-call). */\n signal: AbortSignal;\n}\ninterface PluginAgentToolRegistrationBase {\n /** Tool name shown to the model: [a-zA-Z0-9_-]+, unique across plugins,\n * and not a built-in dynamic tool (see RESERVED_AGENT_TOOL_NAMES in the\n * server). */\n name: string;\n description: string;\n /**\n * Optional usage snippet appended to the thread instructions whenever\n * this tool is in the session's tool set (mirrors the built-in\n * update_environment_directory guidance). Limited to 4096 characters.\n */\n instructions?: string;\n}\n/** Stable, plain-data context resolved by the server for one agent session. */\ninterface PluginAgentConfigurationContext {\n thread: {\n id: string;\n title: string | null;\n parentThreadId: string | null;\n sourceThreadId: string | null;\n };\n project: {\n id: string;\n kind: \"standard\" | \"personal\";\n name: string;\n gitRemoteUrl: string | null;\n };\n environment: {\n id: string;\n name: string | null;\n path: string | null;\n workspaceProvisionType: \"unmanaged\" | \"managed-worktree\" | \"personal\";\n branchName: string | null;\n };\n host: {\n id: string;\n name: string;\n };\n provider: {\n id: string;\n model: string;\n };\n sideChat: boolean;\n origin: {\n kind: \"fork\" | \"side-chat\" | null;\n pluginId: string | null;\n };\n}\n/** Per-resolution selection returned by {@link PluginAgents.configure}. */\ninterface PluginAgentConfiguration {\n /** Tool names registered by this plugin. Duplicate or unknown names reject\n * this plugin's complete selection for the resolution. */\n tools: string[];\n /** Skill frontmatter names from this plugin's manifest skill roots.\n * Duplicate or unknown names reject this plugin's complete selection. */\n skills: string[];\n /** Optional dynamic instructions. Output is truncated to 4096 characters. */\n instructions?: string;\n}\ninterface PluginAgents {\n /**\n * Select this plugin's statically registered tools and manifest skills for\n * each thread/session resolution, with optional dynamic instructions. The\n * callback is synchronous and runs at `thread.start` / `turn.submit`; it\n * never rebuilds registrations. Exactly one callback may be registered per\n * factory execution. A throw, malformed result, duplicate id, unknown id,\n * or more than 256 tool/skill ids fails closed for this plugin only.\n *\n * Tools take effect when the provider session is next started or resumed;\n * an already-running session is not hot-mutated. Instructions are resolved\n * for the next turn. Skill changes follow BB's environment runtime policy:\n * a busy runtime keeps its current catalog until a safe relaunch. Side-chat\n * threads receive `sideChat: true`, and their returned tool, skill, and\n * dynamic-instruction selections apply at the same boundaries. Independent\n * side-chat safety policy (such as permission escalation) is unchanged.\n */\n configure(provider: (context: PluginAgentConfigurationContext) => PluginAgentConfiguration): void;\n /**\n * Register a native dynamic tool (design §4.4). `parameters` is either a\n * zod schema (validated per call; execute receives the parsed value) or a\n * plain JSON-schema object (no validation; execute receives the raw\n * arguments as `unknown`). Tool-set changes apply on the NEXT session\n * start — a tool registered mid-session is not hot-added to running\n * provider sessions. A second registration of the same name within this\n * plugin is rejected; a name already registered by another plugin is\n * rejected and surfaced as this plugin's status detail.\n */\n registerTool(tool: PluginAgentToolRegistrationBase & {\n parameters: Schema;\n execute(params: z.output, ctx: PluginAgentToolContext): PluginAgentToolResult | Promise;\n }): void;\n registerTool(tool: PluginAgentToolRegistrationBase & {\n /** Raw JSON-schema escape hatch; params arrive unvalidated. */\n parameters: Record;\n execute(params: unknown, ctx: PluginAgentToolContext): PluginAgentToolResult | Promise;\n }): void;\n /**\n * Contribute a dynamic section appended to thread instructions. The\n * provider runs when a thread's runtime command config is resolved\n * (thread.start / turn.submit); return null to contribute nothing for\n * that resolution. Must be synchronous and fast — it sits on the\n * thread-start path. Output longer than 4096 characters is truncated; a\n * throwing provider is logged against the plugin and contributes nothing.\n * A repeated registration within one factory execution is rejected.\n * This legacy contribution is not applied to side-chat threads; use\n * configure() when sideChat-aware dynamic instructions are required.\n */\n contributeInstructions(provider: (ctx: {\n threadId: string;\n projectId: string;\n }) => string | null): void;\n}\ninterface PluginThreadActionContext {\n threadId: string;\n projectId: string;\n}\ninterface PluginThreadActionToast {\n kind: \"success\" | \"error\" | \"info\";\n message: string;\n}\ntype PluginThreadActionResult = void | {\n toast?: PluginThreadActionToast;\n};\ninterface PluginThreadActionRegistration {\n /** Unique within this plugin: [a-zA-Z0-9_-]+ (becomes a URL segment). */\n id: string;\n /** Button label rendered in the thread header. */\n title: string;\n /** Optional icon name; the host falls back to a generic icon. */\n icon?: string;\n /** Optional confirmation prompt the host shows before running. */\n confirm?: string;\n /**\n * Runs server-side when the user clicks the action. The host shows a\n * pending state while in flight, the returned toast on completion, and an\n * automatic error toast when this throws.\n */\n run(ctx: PluginThreadActionContext): PluginThreadActionResult | Promise;\n}\ntype PluginMentionTrigger = \"@\" | \"#\" | \"$\" | \"!\" | \"~\";\n/** Search context handed to a mention provider (design §4.9). `projectId`/\n * `threadId` are null when the composer has not committed one yet. */\ninterface PluginMentionSearchContext {\n trigger: PluginMentionTrigger;\n query: string;\n projectId: string | null;\n threadId: string | null;\n}\n/** One row a mention provider returns from `search`. `id` is the provider's\n * own item id — the host namespaces it before it reaches the wire. */\ninterface PluginMentionItem {\n id: string;\n title: string;\n subtitle?: string;\n icon?: string;\n}\ninterface PluginMentionProviderRegistration {\n /** Unique within this plugin: [a-zA-Z0-9_-]+ (no \":\" — the host composes\n * wire item ids as \":\"). */\n id: string;\n /** Section label shown above this provider's rows in the mention menu. */\n label: string;\n /**\n * Composer trigger characters this provider should answer. Omit to use the\n * default `@` mention trigger. Valid triggers are `@`, `#`, `$`, `!`, and `~`.\n */\n triggers?: readonly PluginMentionTrigger[];\n /**\n * Runs server-side as the user types after one of this provider's triggers\n * in the composer. Each call is time-boxed (2s) and failure-isolated: a slow\n * or throwing provider contributes an empty list — it can never break the\n * mention menu.\n */\n search(ctx: PluginMentionSearchContext): PluginMentionItem[] | Promise;\n /**\n * Resolves one picked item into agent context, called once per unique\n * item at message send time. The returned `context` is attached to the\n * message as an agent-visible (user-hidden) prompt input. Throwing blocks\n * the send with a visible error.\n */\n resolve(itemId: string): {\n context: string;\n } | Promise<{\n context: string;\n }>;\n}\ninterface PluginUi {\n /** Block until the app submits or cancels a plugin-owned composer form. */\n requestInput(request: PluginInteractionRequest, options?: {\n signal?: AbortSignal;\n }): Promise;\n /**\n * Register a thread action rendered in the shipped app's thread header\n * (design §4.9). Multiple actions per plugin; ids must be unique within\n * the plugin. Invoked via POST /plugins/:id/actions/:actionId.\n */\n registerThreadAction(action: PluginThreadActionRegistration): void;\n /**\n * Register a mention provider for the shipped app's composer (design §4.9).\n * Providers default to the `@` trigger and may opt into `#`, `$`, `!`, or\n * `~` with `triggers`. Items group under `label` in the mention menu; a\n * picked item becomes a `{ kind: \"plugin\" }` mention resource whose context\n * is resolved once at send time. Multiple providers per plugin; ids must be\n * unique within the plugin.\n */\n registerMentionProvider(provider: PluginMentionProviderRegistration): void;\n}\ninterface PluginEvents {\n /**\n * Add a thread lifecycle listener. Multiple listeners for the same event are\n * additive and run independently in registration order.\n */\n on(event: E, handler: PluginThreadEventHandler): void;\n}\ninterface PluginServerApi {\n /**\n * This BB server's own loopback base URL (e.g. \"http://127.0.0.1:38886\"),\n * which serves the SPA + /api + /ws. For plugins that proxy or relay\n * traffic back to the server itself (e.g. a tunnel). Bind-gated like\n * `bb.sdk`: reading it before the server is listening throws, so prefer\n * reading it from handlers, services, and timers.\n */\n readonly loopbackBaseUrl: string;\n}\ninterface PluginSharedPortTunnelIdentity {\n /** Gate routing label assigned to this machine. */\n label: string;\n /** Gate apex without a scheme, e.g. \"getbb.app\". */\n baseDomain: string;\n}\ninterface PluginHosts {\n /**\n * Ensure this enrolled host has a gate label and return its read-only public\n * identity. The daemon chooses the trusted gate and desired label; plugins\n * cannot influence either credential-bearing destination.\n */\n ensureSharedPortTunnel(hostId: string): Promise;\n /**\n * Replace this plugin's desired shared-loopback ports for one host. The\n * server aggregates declarations, owns generations, and delivers the\n * resulting set to that host's daemon. Tunnel identity is deliberately not\n * accepted here: it is owned by the daemon's trusted enrollment.\n */\n declareSharedPorts(hostId: string, ports: readonly number[]): void;\n}\ninterface PluginStatusApi {\n /**\n * Mark this plugin `needs-configuration` (with a message shown in\n * `bb plugin list` and the UI) instead of failing — e.g. a factory or\n * service that finds no API key configured. Cleared on the next load;\n * saving settings does not auto-reload in V1, so ask the user to\n * `bb plugin reload ` after configuring.\n */\n needsConfiguration(message: string): void;\n}\n/**\n * The API object handed to a plugin's factory (design §4). Implemented by\n * the BB server; this contract is what plugin `server.ts` files compile\n * against.\n */\ninterface BbPluginApi {\n /** The plugin's own id (namespaces storage, routes, commands). */\n readonly pluginId: string;\n /** Leveled, plugin-scoped logger. */\n readonly log: PluginLogger;\n /** Declarative settings (design §4.2). */\n readonly settings: PluginSettings;\n /** Namespaced KV + per-plugin database (design §4.3). */\n readonly storage: PluginStorage;\n /** HTTP routes under /api/v1/plugins//http/* (design §4.6). */\n readonly http: PluginHttp;\n /** RPC methods under /api/v1/plugins//rpc/ (design §4.6). */\n readonly rpc: PluginRpc;\n /** Ephemeral push to connected frontends (design §4.7). */\n readonly realtime: PluginRealtime;\n /** Long-lived services + cron schedules (design §4.8). */\n readonly background: PluginBackground;\n /** Agent-facing `bb` CLI subcommand (design §4.4). */\n readonly cli: PluginCli;\n /** Per-turn agent context contributions (design §4.4). */\n readonly agents: PluginAgents;\n /** Host-rendered UI contributions (design §4.9). */\n readonly ui: PluginUi;\n /** Additive plugin lifecycle listeners (design §4.5). */\n readonly events: PluginEvents;\n /** Plugin-reported status (needs-configuration). */\n readonly status: PluginStatusApi;\n /** Read-only facts about the running server (loopback base URL). */\n readonly server: PluginServerApi;\n /** Server-to-daemon host control-plane declarations. */\n readonly hosts: PluginHosts;\n /**\n * The full BB SDK, bound to this server over loopback (design §4.1).\n * Bind-gated: reading this before the host binds the SDK throws. The real\n * server binds it before loading plugins, so it is available from the\n * moment factories run there — but isolated harnesses may not, so prefer\n * using it from handlers, services, and timers for portability.\n * `threads.spawn` defaults `origin` to \"plugin\" and `originPluginId` to\n * this plugin's id so spawned threads are attributed automatically.\n */\n readonly sdk: BbSdk;\n /**\n * Register cleanup to run on reload/disable/shutdown. Hooks run LIFO.\n * The sanctioned place to clear timers and close connections.\n */\n onDispose(hook: () => void | Promise): void;\n}\n\nexport { defineRpcContract };\nexport type { BbContext, BbNavigate, BbPluginApi, JsonValue$1 as JsonValue, PluginAgentConfiguration, PluginAgentConfigurationContext, PluginAgentToolContentPart, PluginAgentToolContext, PluginAgentToolRegistrationBase, PluginAgentToolResult, PluginAgents, PluginAppBuilder, PluginAppDefinition, PluginAppSetup, PluginAppSlots, PluginBackground, PluginCli, PluginCliCommandInfo, PluginCliContext, PluginCliRegistration, PluginCliResult, PluginComposerAccessoryProps, PluginComposerAccessoryRegistration, PluginComposerApi, PluginComposerMention, PluginComposerScope, PluginEvents, PluginFileOpenerProps, PluginFileOpenerRegistration, PluginFileOpenerSource, PluginHomepageSectionProps, PluginHomepageSectionRegistration, PluginHosts, PluginHttp, PluginHttpAuthMode, PluginHttpHandler, PluginInteractionCancelReason, PluginInteractionRequest, PluginInteractionResult, PluginKvStorage, PluginLogger, PluginMentionItem, PluginMentionProviderRegistration, PluginMentionSearchContext, PluginMentionTrigger, PluginMessageDirectiveMessage, PluginMessageDirectiveOpenThreadPanel, PluginMessageDirectiveOpenWorkspaceFile, PluginMessageDirectiveProps, PluginMessageDirectiveRegistration, PluginMessageDirectiveThreadPanelOptions, PluginNavPanelProps, PluginNavPanelRegistration, PluginPendingInteractionProps, PluginPendingInteractionRegistration, PluginPendingInteractionView, PluginRealtime, PluginRealtimeConnectionState, PluginRpc, PluginRpcCallArgs, PluginRpcClient, PluginRpcContract, PluginRpcError, PluginRpcErrorCode, PluginRpcHandlers, PluginRpcIssuePathSegment, PluginRpcMethodContract, PluginRpcResult, PluginRpcValidationIssue, PluginSdkApp, PluginServerApi, PluginSettingDescriptor, PluginSettingDescriptors, PluginSettingValue, PluginSettings, PluginSettingsHandle, PluginSettingsSectionProps, PluginSettingsSectionRegistration, PluginSettingsState, PluginSettingsValues, PluginSharedPortTunnelIdentity, PluginSidebarFooterActionContext, PluginSidebarFooterActionProps, PluginSidebarFooterActionRegistration, PluginStatusApi, PluginStorage, PluginThreadActionContext, PluginThreadActionRegistration, PluginThreadActionResult, PluginThreadActionToast, PluginThreadEventHandler, PluginThreadEventName, PluginThreadEventPayloads, PluginThreadPanelActionContext, PluginThreadPanelActionRegistration, PluginThreadPanelProps, PluginUi, StandardSchemaV1, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, StandardSchemaV1Issue, StandardSchemaV1Result };\n"; export const PLUGIN_SDK_APP_DTS = "// Portable type declarations for `@bb/plugin-sdk`. Unpublished BB\n// workspace contracts are flattened; public subpaths may reuse the\n// package root without requiring any other @bb/* package.\n//\n// Confused by the API, or need a symbol that isn't here? Clone the BB repo\n// and read the real source: https://github.com/ymichael/bb\n\nimport { ComponentType } from 'react';\n\n/** A JSON-safe path segment reported by a Standard Schema validation issue. */\ntype PluginRpcIssuePathSegment = string | number;\n/** Validator-neutral validation detail carried by an RPC error envelope. */\ninterface PluginRpcValidationIssue {\n message: string;\n path?: PluginRpcIssuePathSegment[];\n}\n/** Stable wire error categories for plugin RPC. */\ntype PluginRpcErrorCode = \"invalid_json\" | \"invalid_input\" | \"handler_error\" | \"invalid_output\" | \"non_json_result\" | \"unknown_method\";\n/** Structured RPC failure returned as `{ ok: false, error }`. */\ninterface PluginRpcError {\n code: PluginRpcErrorCode;\n message: string;\n issues?: PluginRpcValidationIssue[];\n}\n/**\n * The validator-neutral subset of Standard Schema v1 used by plugin RPC.\n * Zod 4 schemas implement this interface directly; other validators can do\n * the same without becoming part of BB's public protocol.\n */\ninterface StandardSchemaV1 {\n readonly \"~standard\": {\n readonly version: 1;\n readonly vendor: string;\n readonly validate: (value: unknown) => StandardSchemaV1Result | Promise>;\n readonly types?: {\n readonly input: Input;\n readonly output: Output;\n };\n };\n}\ntype StandardSchemaV1Result = {\n readonly value: Output;\n readonly issues?: undefined;\n} | {\n readonly issues: readonly StandardSchemaV1Issue[];\n};\ninterface StandardSchemaV1Issue {\n readonly message: string;\n readonly path?: PropertyKey | readonly (PropertyKey | {\n readonly key: PropertyKey;\n })[];\n}\ntype StandardSchemaV1InferInput = NonNullable[\"input\"];\ntype StandardSchemaV1InferOutput = NonNullable[\"output\"];\ninterface PluginRpcMethodContract {\n readonly input: InputSchema;\n readonly output: OutputSchema;\n}\ntype PluginRpcContract = Readonly>;\ntype PluginRpcHandlers = {\n [Method in keyof Contract]: (input: StandardSchemaV1InferOutput) => StandardSchemaV1InferInput | Promise>;\n};\ntype PluginRpcCallInput = StandardSchemaV1InferInput;\ntype PluginRpcCallArgs = null extends PluginRpcCallInput ? [input?: PluginRpcCallInput] : [input: PluginRpcCallInput];\ntype PluginRpcResult = StandardSchemaV1InferOutput;\n\n/**\n * A value that survives a JSON round trip without coercion or data loss.\n *\n * Host boundaries still validate values at runtime because TypeScript cannot\n * exclude non-finite numbers and plugin bundles can bypass static types.\n */\ntype JsonValue = string | number | boolean | null | JsonValue[] | {\n [key: string]: JsonValue;\n};\n\n/**\n * The `@bb/plugin-sdk/app` contract (plugin design §5.2) — pure types with no\n * side effects. The BB app imports these to keep its real implementation in\n * sync (`satisfies PluginSdkApp`). Plugin authors import the same shapes through\n * `@bb/plugin-sdk/app`.\n *\n * Per-slot props are versioned contracts: additive-only within an SDK major.\n */\n/** Props passed to a `homepageSection` component. */\ninterface PluginHomepageSectionProps {\n /** Project in view on the compose surface; null when none is selected. */\n projectId: string | null;\n}\n/**\n * Props passed to a `settingsSection` component.\n *\n * Deliberately empty in V1; versioned additive like the other slot props.\n */\ninterface PluginSettingsSectionProps {\n}\n/** Props passed to a `navPanel` component (it owns its whole route). */\ninterface PluginNavPanelProps {\n /**\n * The route remainder after the panel root, \"\" at the root. The panel's\n * route is `/plugins///*`, so a deep link like\n * `/plugins/notes/notes/work/ideas.md` renders the panel with\n * `subPath: \"work/ideas.md\"`. Navigate within the panel via\n * `useBbNavigate().toPluginPanel(path, { subPath })` — browser\n * back/forward then walks panel-internal history.\n */\n subPath: string;\n}\n/** Props passed to a panel tab opened by a `threadPanelAction`. */\ninterface PluginThreadPanelProps {\n threadId: string;\n /**\n * The JSON value the action's `openPanel` call passed (round-tripped\n * through persistence, so the tab restores across reloads); null when the\n * action opened the panel without params.\n */\n params: JsonValue | null;\n}\n/** Props passed to a `composerAccessory` component. */\ninterface PluginComposerAccessoryProps {\n projectId: string | null;\n threadId: string | null;\n}\ninterface PluginPendingInteractionView {\n id: string;\n threadId: string;\n title: string;\n payload: JsonValue;\n createdAt: number;\n expiresAt: number | null;\n}\ninterface PluginPendingInteractionProps {\n interaction: PluginPendingInteractionView;\n submit(value: JsonValue): Promise;\n cancel(): Promise;\n}\n/**\n * Props for a `sidebarFooterAction` — host-rendered (no plugin component).\n * Deliberately empty; the registration's `run` carries the behavior.\n */\ninterface PluginSidebarFooterActionProps {\n}\n/**\n * Where a file being opened by a `fileOpener` lives. `path` semantics follow\n * the source: workspace paths are relative to the environment's worktree,\n * thread-storage paths are relative to the thread's storage root, host paths\n * are absolute on the thread's host.\n */\ninterface PluginFileOpenerSource {\n kind: \"workspace\" | \"host\" | \"thread-storage\";\n threadId: string | null;\n environmentId: string | null;\n projectId: string | null;\n}\n/** Props passed to a `fileOpener` component (rendered as a panel file tab). */\ninterface PluginFileOpenerProps {\n path: string;\n source: PluginFileOpenerSource;\n}\n/**\n * Message context passed to a `messageDirective` component — the assistant\n * (or nested agent) message that contained the directive.\n */\ninterface PluginMessageDirectiveMessage {\n id: string;\n threadId: string;\n turnId: string | null;\n projectId: string | null;\n}\n/**\n * Open a worktree-relative file in the host's workspace file viewer. Returns\n * true when the host accepted the path; false when the path is invalid or the\n * viewer declined it.\n */\ntype PluginMessageDirectiveOpenWorkspaceFile = (path: string) => boolean;\ninterface PluginMessageDirectiveThreadPanelOptions {\n /** A `threadPanelAction` id registered by this same plugin. */\n actionId: string;\n title?: string;\n params?: JsonValue;\n}\n/** Open this plugin's registered action in the current thread side panel. */\ntype PluginMessageDirectiveOpenThreadPanel = (options: PluginMessageDirectiveThreadPanelOptions) => boolean;\n/**\n * Props passed to a `messageDirective` component. Attributes are untrusted\n * strings parsed from the directive; the plugin validates its own fields.\n */\ninterface PluginMessageDirectiveProps {\n /** Parsed, untrusted directive attributes (e.g. `{ file: \"demo.html\" }`). */\n attributes: Readonly>;\n /** Original directive source text (useful for diagnostics / crash fallback). */\n source: string;\n message: PluginMessageDirectiveMessage;\n /**\n * Opens a worktree-relative file in the host's workspace file viewer. Null\n * when the message surface has no workspace viewer available.\n */\n openWorkspaceFile: PluginMessageDirectiveOpenWorkspaceFile | null;\n /**\n * Opens one of this plugin's own `threadPanelAction` components in the\n * current thread side panel. Omitted by older hosts; null on message\n * surfaces without a thread panel.\n */\n openThreadPanel?: PluginMessageDirectiveOpenThreadPanel | null;\n}\ninterface PluginHomepageSectionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n title: string;\n component: ComponentType;\n}\ninterface PluginSettingsSectionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Optional host-rendered section heading. */\n title?: string;\n /**\n * Optional one-line host-rendered subheading under `title`, in the built-in\n * SettingsSection idiom (ignored when `title` is absent).\n */\n description?: string;\n component: ComponentType;\n}\ninterface PluginNavPanelRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n title: string;\n /** Icon hint (BB icon name); unknown names fall back to a generic icon. */\n icon: string;\n /** URL segment under `/plugins//`; letters, digits, `-`, `_`. */\n path: string;\n component: ComponentType;\n /**\n * Optional component rendered on the right side of the shared title bar\n * (e.g. a sync button or a count). Contained separately from the body: a\n * throwing headerContent is hidden without breaking the title bar.\n */\n headerContent?: ComponentType;\n}\n/** Context handed to a `threadPanelAction`'s `run`. */\ninterface PluginThreadPanelActionContext {\n /** The thread whose panel launcher invoked the action. */\n threadId: string;\n /**\n * Open a tab in the thread's side panel rendering this action's\n * `component`. `title` labels the tab (default: the action's `title`);\n * `params` must be JSON-serializable — it is persisted with the tab and\n * reaches the component as its `params` prop. Opening with params\n * identical to an already-open tab of this action focuses that tab\n * (updating its title) instead of duplicating it. May be called more than\n * once (different params ⇒ multiple tabs) or not at all.\n */\n openPanel(options?: {\n title?: string;\n params?: JsonValue;\n }): void;\n}\ninterface PluginThreadPanelActionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Label of the action row in the panel's new-tab launcher. */\n title: string;\n /**\n * Icon hint (BB icon name) used when the plugin ships no logo; the\n * launcher row and opened tabs prefer the plugin's logo.\n */\n icon?: string;\n /** Rendered inside every panel tab this action opens. */\n component: ComponentType;\n /**\n * Runs when the user activates the action: call your RPC methods, show a\n * toast, and/or open panel tabs via `context.openPanel`. Omitted =\n * immediately open a panel tab with defaults. Errors (sync or async) are\n * contained and logged; they never break the launcher.\n */\n run?(context: PluginThreadPanelActionContext): void | Promise;\n}\ninterface PluginComposerAccessoryRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n component: ComponentType;\n}\ninterface PluginPendingInteractionRegistration {\n /** Matches `rendererId` passed to `bb.ui.requestInput`. */\n id: string;\n component: ComponentType;\n}\n/** Context handed to a `sidebarFooterAction`'s `run`. */\ninterface PluginSidebarFooterActionContext {\n /**\n * Navigate to this plugin's Settings detail page\n * (`/settings/plugins/`), where declarative settings and\n * `settingsSection` slots render.\n */\n openSettings(): void;\n}\n/**\n * An icon button in the app sidebar footer (next to Settings / bug report).\n * Host-rendered for consistent chrome — plugins supply icon, label, and\n * `run` behavior only.\n */\ninterface PluginSidebarFooterActionRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Tooltip and accessible label for the icon button. */\n title: string;\n /** Icon hint (BB icon name); unknown names fall back to a generic icon. */\n icon: string;\n /**\n * Runs when the user activates the action (e.g. call `openSettings()`,\n * open a panel via other surfaces, toast). Errors (sync or async) are\n * contained and logged; they never break the sidebar.\n */\n run(context: PluginSidebarFooterActionContext): void | Promise;\n}\n/**\n * Register this plugin as a viewer/editor for file extensions. The user\n * picks (and can set as default) an opener per extension via the file tab's\n * \"Open with\" menu; matching files opened in the panel then render\n * `component` in a plugin tab instead of the built-in preview. Applies to\n * working-tree, host, and thread-storage files — never to git-ref snapshots\n * (diff views always use the built-in preview). The built-in preview stays\n * one menu click away, and a missing/disabled opener falls back to it.\n */\ninterface PluginFileOpenerRegistration {\n /** Unique within the plugin; letters, digits, `-`, `_`. */\n id: string;\n /** Label in the \"Open with\" menu (e.g. \"Notes editor\"). */\n title: string;\n /** Lowercase extensions without the dot (e.g. [\"md\", \"mdx\"]). */\n extensions: readonly string[];\n component: ComponentType;\n}\n/**\n * Register a leaf message directive rendered inside assistant (and nested\n * agent) message Markdown. `id` is the directive name: `inline-vis` matches\n * `::inline-vis{file=\"demo.html\"}`.\n */\ninterface PluginMessageDirectiveRegistration {\n /**\n * The directive name. Lowercase kebab-case beginning with a letter.\n */\n id: string;\n component: ComponentType;\n}\ninterface PluginAppSlots {\n homepageSection(registration: PluginHomepageSectionRegistration): void;\n settingsSection(registration: PluginSettingsSectionRegistration): void;\n navPanel(registration: PluginNavPanelRegistration): void;\n threadPanelAction(registration: PluginThreadPanelActionRegistration): void;\n composerAccessory(registration: PluginComposerAccessoryRegistration): void;\n pendingInteraction(registration: PluginPendingInteractionRegistration): void;\n sidebarFooterAction(registration: PluginSidebarFooterActionRegistration): void;\n fileOpener(registration: PluginFileOpenerRegistration): void;\n messageDirective(registration: PluginMessageDirectiveRegistration): void;\n}\ninterface PluginAppBuilder {\n slots: PluginAppSlots;\n}\ntype PluginAppSetup = (app: PluginAppBuilder) => void;\n/**\n * The opaque product of `definePluginApp` — a plugin's `app.tsx` default\n * export. The host re-runs `setup` against a fresh collector on every\n * (re)interpretation, replacing that plugin's registrations wholesale.\n */\ninterface PluginAppDefinition {\n /** Brand the host checks before interpreting a bundle's default export. */\n readonly __bbPluginApp: true;\n readonly setup: PluginAppSetup;\n}\ninterface PluginRpcClient {\n /**\n * Invoke one of the plugin's `bb.rpc` methods (POST\n * /api/v1/plugins/<id>/rpc/<method>). Resolves with the method's\n * inferred output; rejects with an `Error` carrying the server's message,\n * stable `code`, and validation `issues` when present.\n */\n call>(method: Method, ...args: PluginRpcCallArgs): Promise>;\n}\ninterface PluginSettingsState {\n /**\n * Effective non-secret setting values (secret settings are excluded —\n * read them server-side). Undefined while loading or unavailable.\n */\n values: Record | undefined;\n isLoading: boolean;\n}\n/** State of the app's shared realtime connection to the bb server. */\ntype PluginRealtimeConnectionState = \"connecting\" | \"connected\" | \"reconnecting\";\n/** Where `useComposer()` writes: the active thread's draft or the new-thread draft. */\ntype PluginComposerScope = {\n kind: \"thread\";\n threadId: string;\n} | {\n kind: \"new-thread\";\n projectId: string | null;\n};\n/** An @-mention pill bound to one of the calling plugin's mention providers. */\ninterface PluginComposerMention {\n /** Mention provider id registered by THIS plugin via `bb.ui.registerMentionProvider`. */\n provider: string;\n /** Item id your provider's `resolve` will receive at send time. */\n id: string;\n /** Pill text shown in the composer. */\n label: string;\n}\n/**\n * Programmatic access to the chat composer draft — the same shared draft the\n * built-in \"Add to chat\" affordances (file preview, diff, terminal selections)\n * write to. Inside a thread context writes land in that thread's draft;\n * anywhere else (nav panel, homepage section) they seed the new-thread\n * composer draft, which persists until the user sends or clears it.\n */\ninterface PluginComposerApi {\n scope: PluginComposerScope;\n /** Current plain text for this composer scope. */\n readonly text: string;\n /**\n * Replace the draft's plain text. Attachments are preserved. Inline mentions\n * outside the changed range are preserved and rebased; mentions overlapped\n * by the replacement are removed because their text representation changed.\n */\n setText(next: string): void;\n /**\n * Replace the draft's plain text from the latest committed value. Uses the\n * same structured-state reconciliation as `setText`.\n */\n updateText(updater: (current: string) => string): void;\n /** Clear plain text without clearing independently attached files. */\n clear(): void;\n /**\n * Append text to the draft as a `> ` blockquote block and focus the\n * composer. Blank text is a no-op. This is the \"reference this selection\n * in chat\" primitive.\n */\n addQuote(text: string): void;\n /**\n * Insert an @-mention pill that resolves through this plugin's mention\n * provider at send time — the durable way to reference an entity whose\n * content should be fetched fresh when the message is sent.\n */\n insertMention(mention: PluginComposerMention): void;\n /** Focus the composer caret at the end of the draft. */\n focus(): void;\n}\n/** Current app selection, derived from the route. */\ninterface BbContext {\n projectId: string | null;\n threadId: string | null;\n}\ninterface BbNavigate {\n toThread(threadId: string): void;\n toProject(projectId: string): void;\n /**\n * Navigate to one of this plugin's own nav panels by its `path`.\n * `subPath` targets a location inside the panel (the component's\n * `subPath` prop); `replace` swaps the current history entry instead of\n * pushing — use it for redirects so back does not bounce.\n */\n toPluginPanel(path: string, options?: {\n subPath?: string;\n replace?: boolean;\n }): void;\n /**\n * Navigate to the root compose surface (the new-thread screen). Pass\n * `initialPrompt` to seed the composer draft and `focusPrompt` to focus the\n * composer on arrival — the pairing behind \"Create via chat\" style entry\n * points that drop the user into chat with a prefilled prompt.\n */\n toCompose(options?: {\n initialPrompt?: string;\n focusPrompt?: boolean;\n }): void;\n}\n/**\n * Everything `@bb/plugin-sdk/app` resolves to at runtime. The BB app builds\n * the real implementation and `satisfies` this interface; `bb plugin build`\n * shims the specifier to that object on `globalThis.__bbPluginRuntime`.\n */\ninterface PluginSdkApp {\n definePluginApp(setup: PluginAppSetup): PluginAppDefinition;\n useRpc(): PluginRpcClient;\n useRealtime(channel: string, handler: (payload: unknown) => void): void;\n /**\n * Observe the same shared connection that delivers `useRealtime` signals.\n * Use a subsequent transition to `connected` to reconcile server state that\n * may have changed while ephemeral signals could not be delivered. The first\n * connection can transition from `connecting` and is not a reconnection.\n */\n useRealtimeConnectionState(): PluginRealtimeConnectionState;\n useSettings(): PluginSettingsState;\n useBbContext(): BbContext;\n useBbNavigate(): BbNavigate;\n useComposer(): PluginComposerApi;\n}\n\ndeclare const definePluginApp: (setup: PluginAppSetup) => PluginAppDefinition;\ndeclare const useRpc: , StandardSchemaV1>>>>() => PluginRpcClient;\ndeclare const useRealtime: (channel: string, handler: (payload: unknown) => void) => void;\ndeclare const useRealtimeConnectionState: () => PluginRealtimeConnectionState;\ndeclare const useSettings: () => PluginSettingsState;\ndeclare const useBbContext: () => BbContext;\ndeclare const useBbNavigate: () => BbNavigate;\ndeclare const useComposer: () => PluginComposerApi;\n\nexport { definePluginApp, useBbContext, useBbNavigate, useComposer, useRealtime, useRealtimeConnectionState, useRpc, useSettings };\nexport type { BbContext, BbNavigate, JsonValue, PluginAppBuilder, PluginAppDefinition, PluginAppSetup, PluginAppSlots, PluginComposerAccessoryProps, PluginComposerAccessoryRegistration, PluginComposerApi, PluginComposerMention, PluginComposerScope, PluginFileOpenerProps, PluginFileOpenerRegistration, PluginFileOpenerSource, PluginHomepageSectionProps, PluginHomepageSectionRegistration, PluginMessageDirectiveMessage, PluginMessageDirectiveOpenThreadPanel, PluginMessageDirectiveOpenWorkspaceFile, PluginMessageDirectiveProps, PluginMessageDirectiveRegistration, PluginMessageDirectiveThreadPanelOptions, PluginNavPanelProps, PluginNavPanelRegistration, PluginPendingInteractionProps, PluginPendingInteractionRegistration, PluginPendingInteractionView, PluginRealtimeConnectionState, PluginRpcCallArgs, PluginRpcClient, PluginRpcContract, PluginRpcError, PluginRpcErrorCode, PluginRpcHandlers, PluginRpcIssuePathSegment, PluginRpcMethodContract, PluginRpcResult, PluginRpcValidationIssue, PluginSdkApp, PluginSettingsSectionProps, PluginSettingsSectionRegistration, PluginSettingsState, PluginSidebarFooterActionContext, PluginSidebarFooterActionProps, PluginSidebarFooterActionRegistration, PluginThreadPanelActionContext, PluginThreadPanelActionRegistration, PluginThreadPanelProps, StandardSchemaV1, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, StandardSchemaV1Issue, StandardSchemaV1Result };\n";