From 27af15aeaf7455996bf8f381bfdd97aa9e61e760 Mon Sep 17 00:00:00 2001 From: flamboh Date: Thu, 3 Dec 2026 10:40:43 +0000 Subject: [PATCH 01/24] feat(server): hide threads from the sidebar Adds thread.hide and thread.unhide. A hidden thread keeps working, and messages, completions and scheduled tasks never unhide it. Hiding clears pin and snooze and keeps settle. Pin, snooze or unhide bring it back. Exposed through the threadHide capability and the MCP organize tool. --- .../src/environment/ServerEnvironment.ts | 1 + apps/server/src/mcp/OrchestratorMcpService.ts | 2 + apps/server/src/mcp/toolkits/thread/tools.ts | 4 +- .../DelegatedCompletionDelivery.test.ts | 48 ++++++ .../Orchestrator.control-reads.test.ts | 146 ++++++++++++++++++ .../src/orchestration-v2/Orchestrator.ts | 38 ++++- .../orchestration-v2/ProjectionStore.test.ts | 26 +++- .../src/orchestration-v2/ProjectionStore.ts | 14 ++ .../src/orchestration-v2/ShellStream.ts | 6 +- .../src/orchestration-v2/ThreadForkService.ts | 1 + .../testkit/OrchestratorScenario.ts | 2 + .../src/provider/agentContextBudget.json | 2 +- apps/server/src/relay/AgentAwarenessRelay.ts | 9 +- apps/server/src/telemetry/FeatureUsage.ts | 1 + packages/contracts/src/environment.ts | 1 + packages/contracts/src/orchestrationV2.ts | 18 +++ packages/contracts/src/orchestratorMcp.ts | 2 + 17 files changed, 313 insertions(+), 8 deletions(-) diff --git a/apps/server/src/environment/ServerEnvironment.ts b/apps/server/src/environment/ServerEnvironment.ts index d518748c74965..37fc0469d2afd 100644 --- a/apps/server/src/environment/ServerEnvironment.ts +++ b/apps/server/src/environment/ServerEnvironment.ts @@ -266,6 +266,7 @@ export const make = Effect.gen(function* () { threadPinReorder: true, threadActiveReorder: true, threadAutoSettleOptOut: true, + threadHide: true, threadProjectFromScratch: true, threadTitleRegeneration: true, commandOutputStreaming: true, diff --git a/apps/server/src/mcp/OrchestratorMcpService.ts b/apps/server/src/mcp/OrchestratorMcpService.ts index 9786a76fe539c..5c759180cae66 100644 --- a/apps/server/src/mcp/OrchestratorMcpService.ts +++ b/apps/server/src/mcp/OrchestratorMcpService.ts @@ -1088,6 +1088,7 @@ function listItemFromShell( ...threadPullRequests(shell.pullRequests), ...threadSettlement(shell), ...threadSnooze(shell, nowMs), + hiddenAt: shell.hiddenAt == null ? null : DateTime.formatIso(shell.hiddenAt), pinned: shell.pinnedAt != null, ...threadBackgroundWork(shell), parentThreadId: shell.lineage.parentThreadId, @@ -1168,6 +1169,7 @@ function threadDetail( archived: projection.thread.archivedAt !== null, ...threadSettlement(projection.thread), ...threadSnooze(shell, nowMs), + hiddenAt: shell.hiddenAt == null ? null : DateTime.formatIso(shell.hiddenAt), pinned: shell.pinnedAt != null, ...threadBackgroundWork(shell), createdAt: DateTime.formatIso(projection.thread.createdAt), diff --git a/apps/server/src/mcp/toolkits/thread/tools.ts b/apps/server/src/mcp/toolkits/thread/tools.ts index 121a4370fa4dd..565c727449001 100644 --- a/apps/server/src/mcp/toolkits/thread/tools.ts +++ b/apps/server/src/mcp/toolkits/thread/tools.ts @@ -33,7 +33,7 @@ import * as McpInvocationContext from "../../McpInvocationContext.ts"; const ThreadOrganizeTool = Tool.make("t3_thread_organize", { description: - "Pin, snooze, settle, archive, or mark a thread unread. Omit `threadId` for this thread. `snooze` needs `snoozedUntil`. Settling this thread applies at turn end. A failed turn or queued message leaves it active.", + "Pin, snooze, hide, settle, archive, or mark a thread unread. Omit `threadId` for this thread. `snooze` needs `snoozedUntil`. Settling this thread applies at turn end. A failed turn or queued message leaves it active.", parameters: Schema.Struct({ environmentId: OrchestratorMcpEnvironmentTarget, threadId: Schema.optional(ThreadId), @@ -42,6 +42,8 @@ const ThreadOrganizeTool = Tool.make("t3_thread_organize", { "unpin", "snooze", "unsnooze", + "hide", + "unhide", "settle", "unsettle", "archive", diff --git a/apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts b/apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts index 324150d2d9f1e..af9bda14b08e5 100644 --- a/apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts +++ b/apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts @@ -816,6 +816,54 @@ it.layer(layerTest)("delegated completion delivery repairs", (it) => { }), ); + it.effect("a delegated completion leaves a hidden parent hidden", () => + Effect.gen(function* () { + const orchestrator = yield* Orchestrator.OrchestratorV2; + const now = yield* DateTime.now; + const threadId = ThreadId.make("thread:delegated-delivery-hidden"); + const runId = RunId.make("run:delegated-delivery-hidden"); + const taskId = NodeId.make("node:delegated-delivery-hidden-task"); + const messageId = MessageId.make(`message:delegated-delivery:${threadId}`); + yield* seedParentWithTerminalTask({ + threadId, + projectId: ProjectId.make("project:delegated-delivery-hidden"), + runId, + rootNodeId: NodeId.make("node:delegated-delivery-hidden-root"), + taskId, + deliveryState: "claimed", + completionWake: "always", + deliveryTaskIds: [taskId], + now, + }); + yield* orchestrator.dispatch({ + type: "thread.hide", + commandId: CommandId.make("command:delegated-delivery-hidden-hide"), + threadId, + }); + const hiddenAt = (yield* orchestrator.getThreadShell(threadId))?.hiddenAt; + assert.isNotNull(hiddenAt); + + yield* orchestrator.dispatch({ + type: "message.dispatch", + commandId: CommandId.make("command:delegated-delivery-hidden"), + threadId, + messageId, + text: `Delegated task ${taskId} reached a terminal state.`, + attachments: [], + dispatchMode: { type: "queue_after_active" }, + createdBy: "agent", + creationSource: "server", + delegatedCompletion: { parentRunId: runId, generation: 1, taskIds: [taskId] }, + }); + + const projection = yield* orchestrator.getThreadProjection(threadId); + assert.isDefined( + projection.messages.find((message) => message.id === messageId)?.delegatedCompletion, + ); + assert.deepEqual(projection.thread.hiddenAt, hiddenAt); + }), + ); + it.effect("counts already delivered siblings in the completion notice", () => Effect.gen(function* () { const orchestrator = yield* Orchestrator.OrchestratorV2; diff --git a/apps/server/src/orchestration-v2/Orchestrator.control-reads.test.ts b/apps/server/src/orchestration-v2/Orchestrator.control-reads.test.ts index 68e90a7ef267b..b5842525c2239 100644 --- a/apps/server/src/orchestration-v2/Orchestrator.control-reads.test.ts +++ b/apps/server/src/orchestration-v2/Orchestrator.control-reads.test.ts @@ -20,6 +20,7 @@ import { RunAttemptId, RunId, RuntimeRequestId, + ScheduledTaskId, ThreadId, TurnItemId, } from "@t3tools/contracts"; @@ -2674,6 +2675,151 @@ it.effect("explicit settle clears snooze atomically and stays idempotent after r }).pipe(Effect.provide(layerTest)), ); +const createHideThread = Effect.fn("test.createHideThread")(function* (name: string) { + const orchestrator = yield* Orchestrator.OrchestratorV2; + const threadId = ThreadId.make(`thread:${name}`); + yield* orchestrator.dispatch({ + type: "thread.create", + commandId: CommandId.make(`create-${name}`), + threadId, + projectId: ProjectId.make(`project:${name}`), + title: "Hidden thread", + modelSelection, + runtimeMode: "full-access", + interactionMode: "default", + branch: null, + worktreePath: null, + createdBy: "user", + creationSource: "web", + }); + return threadId; +}); + +it.effect("hide clears pin and snooze, keeps settle, and pin, snooze or unhide bring it back", () => + Effect.gen(function* () { + const orchestrator = yield* Orchestrator.OrchestratorV2; + const projections = yield* ProjectionStore.ProjectionStoreV2; + const threadId = yield* createHideThread("hide-lifecycle"); + const snoozedUntil = DateTime.formatIso(DateTime.add(yield* DateTime.now, { hours: 1 })); + const hide = (round: string) => + orchestrator.dispatch({ + type: "thread.hide", + commandId: CommandId.make(`hide-${round}`), + threadId, + }); + const expectEverywhere = Effect.fn("test.expectEverywhere")(function* ( + expected: Record, + ) { + assert.deepInclude(yield* projections.getThreadShell(threadId), expected); + assert.deepInclude((yield* projections.getThreadProjection(threadId)).thread, expected); + assert.deepInclude( + (yield* orchestrator.getShellSnapshot()).threads.find((thread) => thread.id === threadId), + expected, + ); + }); + + yield* orchestrator.dispatch({ + type: "thread.settle", + commandId: CommandId.make("settle-before-hide"), + threadId, + }); + yield* orchestrator.dispatch({ + type: "thread.pin", + commandId: CommandId.make("pin-before-hide"), + threadId, + }); + yield* orchestrator.dispatch({ + type: "thread.snooze", + commandId: CommandId.make("snooze-before-hide"), + threadId, + snoozedUntil, + }); + const beforeHide = yield* projections.getThreadShell(threadId); + yield* TestClock.adjust("1 second"); + yield* hide("first"); + const hiddenAt = yield* DateTime.now; + yield* expectEverywhere({ + hiddenAt, + pinnedAt: null, + pinOrderKey: null, + snoozedUntil: null, + snoozedAt: null, + settledOverride: beforeHide?.settledOverride, + }); + + yield* TestClock.adjust("1 second"); + yield* hide("again"); + yield* expectEverywhere({ hiddenAt }); + + yield* orchestrator.dispatch({ + type: "thread.unhide", + commandId: CommandId.make("unhide"), + threadId, + }); + yield* expectEverywhere({ hiddenAt: null }); + + yield* hide("before-pin"); + yield* orchestrator.dispatch({ + type: "thread.pin", + commandId: CommandId.make("pin-hidden"), + threadId, + }); + const pinned = yield* projections.getThreadShell(threadId); + assert.isNull(pinned?.hiddenAt); + assert.isNotNull(pinned?.pinnedAt); + + yield* hide("before-snooze"); + yield* orchestrator.dispatch({ + type: "thread.snooze", + commandId: CommandId.make("snooze-hidden"), + threadId, + snoozedUntil, + }); + yield* expectEverywhere({ hiddenAt: null, snoozedUntil: DateTime.makeUnsafe(snoozedUntil) }); + }).pipe(Effect.provide(layerTest)), +); + +it.effect("composer, agent and scheduled messages leave a hidden thread hidden", () => + Effect.gen(function* () { + const orchestrator = yield* Orchestrator.OrchestratorV2; + const projections = yield* ProjectionStore.ProjectionStoreV2; + const threadId = yield* createHideThread("hide-messages"); + const otherThreadId = yield* createHideThread("hide-messages-sender"); + yield* orchestrator.dispatch({ + type: "thread.hide", + commandId: CommandId.make("hide-messages-hide"), + threadId, + }); + const hiddenAt = (yield* projections.getThreadShell(threadId))?.hiddenAt; + assert.isNotNull(hiddenAt); + + const messages = [ + { name: "composer", createdBy: "user", creationSource: "web" }, + { name: "agent", createdBy: "agent", creationSource: "mcp", senderThreadId: otherThreadId }, + { + name: "scheduled", + createdBy: "user", + creationSource: "web", + scheduledTaskId: ScheduledTaskId.make("scheduled-task:hide-messages"), + }, + ] as const; + for (const { name, ...source } of messages) { + yield* TestClock.adjust("1 second"); + yield* orchestrator.dispatch({ + type: "message.dispatch", + commandId: CommandId.make(`hide-messages-${name}`), + threadId, + messageId: MessageId.make(`message:hide-messages-${name}`), + text: `From ${name}`, + attachments: [], + dispatchMode: { type: "start_immediately" }, + ...source, + }); + assert.deepEqual((yield* projections.getThreadShell(threadId))?.hiddenAt, hiddenAt); + } + }).pipe(Effect.provide(layerTest)), +); + it.effect("keeps a snooze when a live question is cancelled or an approval is answered", () => Effect.gen(function* () { const orchestrator = yield* Orchestrator.OrchestratorV2; diff --git a/apps/server/src/orchestration-v2/Orchestrator.ts b/apps/server/src/orchestration-v2/Orchestrator.ts index 4ea37d7c8614a..023fb1d4f0883 100644 --- a/apps/server/src/orchestration-v2/Orchestrator.ts +++ b/apps/server/src/orchestration-v2/Orchestrator.ts @@ -699,6 +699,8 @@ function commandThreadId(command: OrchestrationV2ServerCommand): ThreadId { case "thread.auto-settle.set": case "thread.pin": case "thread.unpin": + case "thread.hide": + case "thread.unhide": case "thread.pin.reorder": case "thread.active.reorder": case "thread.tag.set": @@ -4659,6 +4661,8 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio | "thread.auto-settle.set" | "thread.pin" | "thread.unpin" + | "thread.hide" + | "thread.unhide" | "thread.pin.reorder" | "thread.tag.set" | "thread.tool-overrides.set" @@ -5394,6 +5398,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio snoozedUntil, limitRecovery: thread.limitRecovery ? { ...thread.limitRecovery, snooze: false } : null, snoozedAt: now, + hiddenAt: null, updatedAt: now, }; } @@ -5417,7 +5422,10 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio } case "thread.pin": { const alreadyPinned = thread.pinnedAt != null; - const promotes = thread.settledOverride === "settled" || thread.snoozedUntil != null; + const promotes = + thread.settledOverride === "settled" || + thread.snoozedUntil != null || + thread.hiddenAt != null; return { ...thread, pinnedAt: alreadyPinned ? thread.pinnedAt : now, @@ -5431,6 +5439,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio snoozedUntil: null, snoozedAt: null, lastSnoozeWakeAt: thread.snoozedUntil == null ? thread.lastSnoozeWakeAt : now, + hiddenAt: null, updatedAt: alreadyPinned && !promotes ? thread.updatedAt : now, }; } @@ -5443,6 +5452,27 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio updatedAt: alreadyUnpinned ? thread.updatedAt : now, }; } + case "thread.hide": { + const alreadyHidden = + thread.hiddenAt != null && thread.pinnedAt == null && thread.snoozedUntil == null; + return { + ...thread, + hiddenAt: thread.hiddenAt ?? now, + pinnedAt: null, + pinOrderKey: null, + snoozedUntil: null, + snoozedAt: null, + updatedAt: alreadyHidden ? thread.updatedAt : now, + }; + } + case "thread.unhide": { + const alreadyVisible = thread.hiddenAt == null; + return { + ...thread, + hiddenAt: null, + updatedAt: alreadyVisible ? thread.updatedAt : now, + }; + } case "thread.pin.reorder": { const keyUnchanged = thread.pinOrderKey === command.orderKey; return { @@ -5981,6 +6011,10 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio return "thread.pinned" as const; case "thread.unpin": return "thread.unpinned" as const; + case "thread.hide": + return "thread.hidden" as const; + case "thread.unhide": + return "thread.unhidden" as const; case "thread.pin.reorder": return "thread.pin-reordered" as const; case "thread.active.reorder": @@ -16975,6 +17009,8 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio case "thread.auto-settle.set": case "thread.pin": case "thread.unpin": + case "thread.hide": + case "thread.unhide": case "thread.pin.reorder": case "thread.active.reorder": case "thread.tag.set": diff --git a/apps/server/src/orchestration-v2/ProjectionStore.test.ts b/apps/server/src/orchestration-v2/ProjectionStore.test.ts index 228c3004ee96c..8059446a7cb7c 100644 --- a/apps/server/src/orchestration-v2/ProjectionStore.test.ts +++ b/apps/server/src/orchestration-v2/ProjectionStore.test.ts @@ -162,6 +162,7 @@ const assertShellIndexCoversShells = Effect.fnUntraced(function* () { | "pinnedAt" | "pinOrderKey" | "snoozedUntil" + | "hiddenAt" >, ) => ({ id: row.id, @@ -172,6 +173,7 @@ const assertShellIndexCoversShells = Effect.fnUntraced(function* () { pinnedAt: iso(row.pinnedAt), pinOrderKey: row.pinOrderKey ?? null, snoozedUntil: iso(row.snoozedUntil), + hiddenAt: iso(row.hiddenAt), }); assert.deepEqual(index.map(trimmed), shells.map(trimmed)); shells.forEach((shell, position) => { @@ -2907,7 +2909,29 @@ const backgroundThreadUpdatesKeepTimestamp = Effect.gen(function* () { occurredAt: DateTime.add(createdAt, { minutes: 55 }), payload: { ...pinned.thread, pinnedAt: null, pinOrderKey: null }, }); - yield* readActivity; + const unpinned = yield* readActivity; + + const hiddenAt = DateTime.add(createdAt, { minutes: 56 }); + yield* store.apply({ + id: EventId.make("event:background-updates:hidden"), + type: "thread.hidden", + threadId, + occurredAt: hiddenAt, + payload: { ...unpinned.thread, hiddenAt }, + }); + const hidden = yield* readActivity; + assert.deepEqual(hidden.thread.hiddenAt, hiddenAt); + yield* assertShellIndexCoversShells(); + + yield* store.apply({ + id: EventId.make("event:background-updates:unhidden"), + type: "thread.unhidden", + threadId, + occurredAt: DateTime.add(createdAt, { minutes: 57 }), + payload: { ...hidden.thread, hiddenAt: null }, + }); + assert.isNull((yield* readActivity).thread.hiddenAt); + yield* assertShellIndexCoversShells(); }); it.effect("SQL projection keeps background thread updates out of updatedAt", () => diff --git a/apps/server/src/orchestration-v2/ProjectionStore.ts b/apps/server/src/orchestration-v2/ProjectionStore.ts index d7ea43543d2bd..252b0470a2b80 100644 --- a/apps/server/src/orchestration-v2/ProjectionStore.ts +++ b/apps/server/src/orchestration-v2/ProjectionStore.ts @@ -529,6 +529,7 @@ export interface ActiveShellIndexEntry extends Pick< | "pinnedAt" | "pinOrderKey" | "snoozedUntil" + | "hiddenAt" > { /** False only when no run, request, work item, or watch can make the shell live. */ readonly mayBeLive: boolean; @@ -1096,6 +1097,8 @@ export function applyToProjection( case "thread.auto-settle-set": case "thread.pinned": case "thread.unpinned": + case "thread.hidden": + case "thread.unhidden": case "thread.pin-reordered": case "thread.metadata-updated": case "thread.runtime-mode-updated": @@ -1284,6 +1287,7 @@ export type AgentAwarenessThread = ProjectThreadAwarenessV2Input["thread"] & | "archivedAt" | "snoozedUntil" | "snoozedAt" + | "hiddenAt" | "pendingGuestMessageCount" | "activeRunId" | "latestRunId" @@ -2084,6 +2088,7 @@ export function threadShellFromProjection( snoozedUntil: projection.thread.snoozedUntil ?? null, snoozedAt: projection.thread.snoozedAt ?? null, pinnedAt: projection.thread.pinnedAt ?? null, + hiddenAt: projection.thread.hiddenAt ?? null, autoSettleDisabledAt: projection.thread.autoSettleDisabledAt ?? null, pinOrderKey: projection.thread.pinOrderKey ?? null, @@ -2393,6 +2398,7 @@ function shellFromState(input: { snoozedUntil: input.state.thread.snoozedUntil ?? null, snoozedAt: input.state.thread.snoozedAt ?? null, pinnedAt: input.state.thread.pinnedAt ?? null, + hiddenAt: input.state.thread.hiddenAt ?? null, autoSettleDisabledAt: input.state.thread.autoSettleDisabledAt ?? null, pinOrderKey: input.state.thread.pinOrderKey ?? null, @@ -2605,6 +2611,8 @@ export const layer: Layer.Layer` @@ -10184,6 +10196,7 @@ export const layer: Layer.Layer !isOlderSettledThreadShell(thread, beforeMs) || thread.pinnedAt != null || + thread.hiddenAt != null || (thread.snoozedUntil != null && DateTime.toEpochMillis(thread.snoozedUntil) > nowMs) || isLiveSubagentShell(thread) || ancestorIds.has(thread.id) || @@ -330,7 +331,7 @@ export function activeShellRowsForSubscriber( /** * Opted-in snapshots keep the 25 newest settled top-level threads (and ties) and count the rest per * project in `olderSettled`; clients page them with `getOlderSettledThreads`. Older rows stay while - * pinned, snoozed, live, above a kept subagent or side chat, or the parent of a task in a linked + * pinned, hidden, snoozed, live, above a kept subagent or side chat, or the parent of a task in a linked * environment, so walks over shell rows and other environments' tasks still find them. */ export function omitOlderSettledShells(input: { @@ -397,6 +398,7 @@ function shellSubscriberThreadIds( beforeMs === undefined || !isOlderSettledThreadShell(entry, beforeMs) || entry.pinnedAt != null || + entry.hiddenAt != null || entry.snoozedUntil != null || entry.mayBeLive || entry.hasRemoteTasks || @@ -543,6 +545,8 @@ const ACKNOWLEDGED_THREAD_EVENTS: ReadonlySet = new Set< "thread.auto-settle-set", "thread.pinned", "thread.unpinned", + "thread.hidden", + "thread.unhidden", "thread.pin-reordered", "thread.active-reordered", "thread.model-selection-updated", diff --git a/apps/server/src/orchestration-v2/ThreadForkService.ts b/apps/server/src/orchestration-v2/ThreadForkService.ts index 2981b4ccfb519..698062439dfa0 100644 --- a/apps/server/src/orchestration-v2/ThreadForkService.ts +++ b/apps/server/src/orchestration-v2/ThreadForkService.ts @@ -139,6 +139,7 @@ export const layer: Layer.Layer = Layer.succeed( snoozedAt: null, lastSnoozeWakeAt: null, pinnedAt: null, + hiddenAt: null, pinOrderKey: null, activeOrderKey: null, autoSettleDisabledAt: null, diff --git a/apps/server/src/orchestration-v2/testkit/OrchestratorScenario.ts b/apps/server/src/orchestration-v2/testkit/OrchestratorScenario.ts index 7209626697c7e..3b87c8d57696f 100644 --- a/apps/server/src/orchestration-v2/testkit/OrchestratorScenario.ts +++ b/apps/server/src/orchestration-v2/testkit/OrchestratorScenario.ts @@ -152,6 +152,8 @@ function commandThreadIds(command: OrchestrationV2Command): ReadonlyArray ({ feature: "thread.archive" }), "thread.snooze": () => ({ feature: "thread.snooze" }), "thread.pin": () => ({ feature: "thread.pin" }), + "thread.hide": () => ({ feature: "thread.hide" }), "thread.settle": () => ({ feature: "thread.settle" }), "thread.pull-request.link": () => ({ feature: "thread.pull_request.link" }), "thread.pull-request.watch": (command) => diff --git a/packages/contracts/src/environment.ts b/packages/contracts/src/environment.ts index 731a674b7852f..69d3d11400675 100644 --- a/packages/contracts/src/environment.ts +++ b/packages/contracts/src/environment.ts @@ -143,6 +143,7 @@ export const ExecutionEnvironmentCapabilities = Schema.Struct({ threadPinReorder: Schema.optionalKey(Schema.Boolean), threadActiveReorder: Schema.optionalKey(Schema.Boolean), threadAutoSettleOptOut: Schema.optionalKey(Schema.Boolean), + threadHide: Schema.optionalKey(Schema.Boolean), threadProjectFromScratch: Schema.optionalKey(Schema.Boolean), threadTitleRegeneration: Schema.optionalKey(Schema.Boolean), threadVisitedTracking: Schema.optionalKey(Schema.Boolean), diff --git a/packages/contracts/src/orchestrationV2.ts b/packages/contracts/src/orchestrationV2.ts index 68f90a24532f6..30262a2f8379a 100644 --- a/packages/contracts/src/orchestrationV2.ts +++ b/packages/contracts/src/orchestrationV2.ts @@ -611,6 +611,7 @@ export const OrchestrationV2AppThread = Schema.Struct({ limitRecovery: Schema.optional(Schema.NullOr(OrchestrationV2LimitRecovery)), guestShare: Schema.optional(Schema.NullOr(ThreadGuestShare)), pinnedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtc)), + hiddenAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtc)), autoSettleDisabledAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtc)), pinOrderKey: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)), activeOrderKey: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)), @@ -2317,6 +2318,8 @@ export const OrchestrationV2DomainEvent = Schema.Union([ "thread.pinned", "thread.auto-settle-set", "thread.unpinned", + "thread.hidden", + "thread.unhidden", "thread.pin-reordered", "thread.active-reordered", "thread.tags-updated", @@ -2589,6 +2592,7 @@ export const OrchestrationV2ThreadShell = Schema.Struct({ snoozedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtc)), limitRecovery: Schema.optional(Schema.NullOr(OrchestrationV2LimitRecovery)), pinnedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtc)), + hiddenAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtc)), autoSettleDisabledAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtc)), pinOrderKey: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)), activeOrderKey: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)), @@ -2769,6 +2773,7 @@ export const OrchestrationV2AppThreadJson = OrchestrationV2AppThread.mapFields(( snoozedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), lastSnoozeWakeAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), pinnedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), + hiddenAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), autoSettleDisabledAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), lastVisitedAt: Schema.NullOr(Schema.DateTimeUtcFromString).pipe( Schema.withDecodingDefault(Effect.succeed(null)), @@ -3237,6 +3242,7 @@ export const OrchestrationV2ThreadShellJson = OrchestrationV2ThreadShell.mapFiel snoozedUntil: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), snoozedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), pinnedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), + hiddenAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), autoSettleDisabledAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), lastVisitedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), titleRegeneration: Schema.optional( @@ -3292,6 +3298,8 @@ export const OrchestrationV2DomainEventJson = Schema.Union([ "thread.pinned", "thread.auto-settle-set", "thread.unpinned", + "thread.hidden", + "thread.unhidden", "thread.pin-reordered", "thread.active-reordered", "thread.tags-updated", @@ -3572,6 +3580,16 @@ export const OrchestrationV2Command = Schema.Union([ commandId: CommandId, threadId: ThreadId, }), + Schema.Struct({ + type: Schema.Literal("thread.hide"), + commandId: CommandId, + threadId: ThreadId, + }), + Schema.Struct({ + type: Schema.Literal("thread.unhide"), + commandId: CommandId, + threadId: ThreadId, + }), Schema.Struct({ type: Schema.Literal("thread.tag.set"), commandId: CommandId, diff --git a/packages/contracts/src/orchestratorMcp.ts b/packages/contracts/src/orchestratorMcp.ts index 9a637e9d82f09..7bff33a278a2b 100644 --- a/packages/contracts/src/orchestratorMcp.ts +++ b/packages/contracts/src/orchestratorMcp.ts @@ -419,6 +419,7 @@ export const OrchestratorMcpThreadListItem = Schema.Struct({ settledAt: Schema.NullOr(IsoDateTime), snoozed: Schema.Boolean, snoozedUntil: Schema.NullOr(IsoDateTime), + hiddenAt: Schema.optional(Schema.NullOr(IsoDateTime)), /** Absent from linked environments that predate it. */ pinned: Schema.optional(Schema.Boolean), /** Absent from linked environments that predate it. */ @@ -496,6 +497,7 @@ export const OrchestratorMcpThreadDetail = Schema.Struct({ settledAt: Schema.NullOr(IsoDateTime), snoozed: Schema.Boolean, snoozedUntil: Schema.NullOr(IsoDateTime), + hiddenAt: Schema.optional(Schema.NullOr(IsoDateTime)), /** Absent from linked environments that predate it. */ pinned: Schema.optional(Schema.Boolean), /** Absent from linked environments that predate it. */ From 4d6698cb47b94296b63cdb54df235e107923ace2 Mon Sep 17 00:00:00 2001 From: flamboh Date: Thu, 3 Dec 2026 10:41:12 +0000 Subject: [PATCH 02/24] feat(web): Hidden fold in the sidebar Hide and Unhide in the thread menus and command palette, a collapsed Hidden fold after Settled, undo, and no completion notifications or announcements for hidden threads. Hidden rows stay out of every drag. --- .../components/BackgroundThreadAnnouncer.tsx | 2 +- apps/web/src/components/CommandPalette.tsx | 5 +- .../CommandPaletteThreadActions.tsx | 4 + .../src/components/Sidebar.browser.test.tsx | 2 + apps/web/src/components/Sidebar.drag.test.ts | 25 ++ apps/web/src/components/Sidebar.drag.ts | 12 +- apps/web/src/components/Sidebar.logic.test.ts | 30 +++ apps/web/src/components/Sidebar.logic.ts | 30 ++- apps/web/src/components/Sidebar.tsx | 218 +++++++++++++----- ...hreadNotificationCoordinator.logic.test.ts | 13 +- .../ThreadNotificationCoordinator.logic.ts | 7 +- .../ThreadNotificationCoordinator.tsx | 4 +- .../backgroundThreadAnnouncement.test.ts | 6 +- .../backgroundThreadAnnouncement.ts | 6 +- .../components/chat/useThreadLifecycle.tsx | 36 ++- .../settings/SidebarRowLayoutRow.tsx | 1 + .../components/sidebar/SidebarListMarkers.tsx | 6 +- .../components/sidebar/SidebarThreadRow.tsx | 46 +++- .../sidebar/SidebarThreadUndoNotice.tsx | 8 + .../src/components/threadActionMenu.logic.ts | 11 + apps/web/src/contextMenuFallback.ts | 25 ++ apps/web/src/hooks/showThreadUndoNotice.ts | 18 +- .../web/src/hooks/useThreadActionMenu.test.ts | 1 + apps/web/src/hooks/useThreadActionMenu.ts | 11 + apps/web/src/hooks/useThreadActions.ts | 81 ++++++- apps/web/src/i18n/translations/de.json | 44 ++++ apps/web/src/i18n/translations/en.json | 43 ++++ apps/web/src/i18n/translations/es.json | 41 ++++ apps/web/src/i18n/translations/fr.json | 42 ++++ apps/web/src/i18n/translations/ja.json | 41 ++++ apps/web/src/i18n/translations/ko.json | 41 ++++ apps/web/src/i18n/translations/pl.json | 49 ++++ apps/web/src/i18n/translations/pt-BR.json | 42 ++++ apps/web/src/i18n/translations/ru.json | 50 ++++ apps/web/src/i18n/translations/sv.json | 43 ++++ apps/web/src/i18n/translations/zh.json | 41 ++++ apps/web/src/state/entities.ts | 7 + docs/user/thread-sidebar.md | 15 +- .../client-runtime/src/operations/commands.ts | 16 ++ packages/client-runtime/src/state/models.ts | 2 + .../src/state/orchestrationV2Projection.ts | 2 + .../src/state/threadCommands.ts | 30 +++ .../client-runtime/src/state/threadInbox.ts | 3 + .../client-runtime/src/state/threadUndo.ts | 5 +- 44 files changed, 1059 insertions(+), 106 deletions(-) diff --git a/apps/web/src/components/BackgroundThreadAnnouncer.tsx b/apps/web/src/components/BackgroundThreadAnnouncer.tsx index 649898cf2e5a5..2acfd7a0d577a 100644 --- a/apps/web/src/components/BackgroundThreadAnnouncer.tsx +++ b/apps/web/src/components/BackgroundThreadAnnouncer.tsx @@ -54,7 +54,7 @@ export function startBackgroundThreadAnnouncements( runId: thread.latestRun?.runId ?? null, runStatus: resolveBackgroundThreadRunStatus(thread), activeRunId: thread.runtime?.activeRunId ?? null, - snoozed: effectiveSnoozed(thread, { now }), + quiet: thread.hiddenAt != null || effectiveSnoozed(thread, { now }), }); } const next = nextBackgroundThreadAnnouncement(memory, snapshots, openThreadKey); diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index bac6531d468d2..f5d176ecda822 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -962,7 +962,10 @@ function OpenCommandPaletteDialog(props: { : null; const now = new Date().toISOString(); const openableThreads = threads.filter( - (thread) => thread.settledOverride !== "settled" && !effectiveSnoozed(thread, { now }), + (thread) => + thread.hiddenAt == null && + thread.settledOverride !== "settled" && + !effectiveSnoozed(thread, { now }), ); const latestThread = groupedProjectKeys ? (sortThreads( diff --git a/apps/web/src/components/CommandPaletteThreadActions.tsx b/apps/web/src/components/CommandPaletteThreadActions.tsx index 77adbd8c0e2e8..5250049869022 100644 --- a/apps/web/src/components/CommandPaletteThreadActions.tsx +++ b/apps/web/src/components/CommandPaletteThreadActions.tsx @@ -4,6 +4,8 @@ import { CircleCheckIcon, ClockIcon, CopyIcon, + EyeIcon, + EyeOffIcon, FolderIcon, FolderPlusIcon, GitBranchIcon, @@ -34,6 +36,8 @@ const ICONS: Record = { "circle-check": CircleCheckIcon, clock: ClockIcon, copy: CopyIcon, + eye: EyeIcon, + "eye-off": EyeOffIcon, folder: FolderIcon, "folder-plus": FolderPlusIcon, "git-branch": GitBranchIcon, diff --git a/apps/web/src/components/Sidebar.browser.test.tsx b/apps/web/src/components/Sidebar.browser.test.tsx index 9d1eb30b44b0d..3ecf81d284b56 100644 --- a/apps/web/src/components/Sidebar.browser.test.tsx +++ b/apps/web/src/components/Sidebar.browser.test.tsx @@ -1038,6 +1038,7 @@ describe("sidebar settled pagination", () => { [ activeProject.environmentId, { + environment: { capabilities: {} }, scratchWorkspaceRoot: null, shellThreadFamilies: false, } as unknown as EnvironmentServerConfig, @@ -1116,6 +1117,7 @@ describe("sidebar settled pagination", () => { [ activeProject.environmentId, { + environment: { capabilities: {} }, scratchWorkspaceRoot: null, shellThreadFamilies: false, } as unknown as EnvironmentServerConfig, diff --git a/apps/web/src/components/Sidebar.drag.test.ts b/apps/web/src/components/Sidebar.drag.test.ts index e1febcd68d533..8ade308bfe78b 100644 --- a/apps/web/src/components/Sidebar.drag.test.ts +++ b/apps/web/src/components/Sidebar.drag.test.ts @@ -491,6 +491,31 @@ describe("sidebar drag projection", () => { expect(result.get("s")?.y).toBe(13); }); + it("moves the Hidden fold with Settled, keeping Show more's gap above it", () => { + const items = [ + pinnedHeader, + divider, + thread("a1", "active"), + thread("a2", "active"), + settledHeader, + thread("s", "settled"), + marker("hidden-header"), + thread("h", "hidden"), + ]; + const strategy = createSidebarSortingStrategy({ + items, + settledOrder: ["a1", "s"], + settledExpanded: true, + }); + const args = layout(items, "a1", "s"); + for (const rect of args.rects.slice(6)) { + rect.top += 30; + rect.bottom += 30; + } + expect(strategy({ ...args, index: 6 })?.y).toBe(-46); + expect(strategy({ ...args, index: 7 })?.y).toBe(-46); + }); + it("keeps a collapsed settled target without inserting a hidden row", () => { const items = [ pinnedHeader, diff --git a/apps/web/src/components/Sidebar.drag.ts b/apps/web/src/components/Sidebar.drag.ts index 76f2c9bf3a3ec..e4dadaef68403 100644 --- a/apps/web/src/components/Sidebar.drag.ts +++ b/apps/web/src/components/Sidebar.drag.ts @@ -17,7 +17,8 @@ const isShelfHeader = (item: SidebarListItem | undefined) => item?.kind === "marker" && (item.marker === "working-header" || item.marker === "snoozed-header" || - item.marker === "settled-header"); + item.marker === "settled-header" || + item.marker === "hidden-header"); export function restrictBelowSidebarLabel( { transform, containerNodeRect, draggingNodeRect }: Parameters[0], @@ -120,6 +121,7 @@ export function createSidebarSortingStrategy(input: { working: [], snoozed: [], settled: [], + hidden: [], }; let cardHeight = input.cardHeight; let slimHeight = input.slimHeight; @@ -190,6 +192,10 @@ export function createSidebarSortingStrategy(input: { } marker("settled-header"); section("settled"); + if (items.some((item) => item.kind === "marker" && item.marker === "hidden-header")) { + marker("hidden-header"); + projected.push(...groups.hidden); + } const heights = projected.map((item) => { const index = indices.get(sidebarListItemId(item)); const rect = index === undefined ? undefined : rects[index]; @@ -228,6 +234,10 @@ export function createSidebarSortingStrategy(input: { } const index = indices.get(sidebarListItemId(item)); const rect = index === undefined ? undefined : rects[index]; + const previousRect = index === undefined ? undefined : rects[index - 1]; + if (item.kind === "marker" && item.marker === "hidden-header" && rect && previousRect) { + top += Math.max(0, rect.top - previousRect.bottom - 1); + } if (index !== undefined && rect) result[index] = { ...stationary, y: top - rect.top }; top += heights[projectedIndex]! + 1; } diff --git a/apps/web/src/components/Sidebar.logic.test.ts b/apps/web/src/components/Sidebar.logic.test.ts index b8eb9704b2ea2..0113ea25be310 100644 --- a/apps/web/src/components/Sidebar.logic.test.ts +++ b/apps/web/src/components/Sidebar.logic.test.ts @@ -1277,6 +1277,36 @@ describe("Working shelf (beta)", () => { }, ); + it("keeps hidden rows out of every drop, both ways", () => { + const withHidden: readonly SidebarListItem[] = [ + ...items, + marker("hidden-header"), + row("h1", "hidden"), + ]; + expect(resolveSidebarDropTarget(withHidden, "a1", "h1")).toBeNull(); + expect(resolveSidebarDropVerb("active", "hidden")).toBeNull(); + expect(resolveSidebarDropVerb("hidden", "active")).toBeNull(); + for (const overKey of ["p1", "a2", "s1"]) { + const target = resolveSidebarDropTarget(withHidden, "h1", overKey); + expect( + target === null + ? { kind: "none" } + : planSidebarThreadDrop({ + activeKey: "h1", + activeSection: "hidden", + target, + pinnedOrder: ["p1"], + pinnedKeysById: new Map([["p1", "m"]]), + activeOrder: ["a1", "a2"], + activeKeysById: new Map([ + ["a1", "f"], + ["a2", "t"], + ]), + }), + ).toEqual({ kind: "none" }); + } + }); + it("arranges the rows it can write when another row's server cannot store an order", () => { const plan = planSidebarThreadDrop({ activeKey: "a2", diff --git a/apps/web/src/components/Sidebar.logic.ts b/apps/web/src/components/Sidebar.logic.ts index b7407b729bc99..0f86daeeb8d29 100644 --- a/apps/web/src/components/Sidebar.logic.ts +++ b/apps/web/src/components/Sidebar.logic.ts @@ -200,15 +200,18 @@ export function useRetainedValue(key: string | null, value: T | null): T | nu export const animateSidebarLayoutChanges: AnimateLayoutChanges = (args) => args.isSorting ? defaultAnimateLayoutChanges(args) : false; -// Snoozed rows cannot accept drops without a wake time. Working rows only drag out as chat context. +// Snoozed rows cannot accept drops without a wake time. Working and hidden rows only drag out as +// chat context, and hidden threads leave Hidden only by an explicit Unhide, Pin or Snooze. -export type SidebarSection = "pinned" | "active" | "working" | "snoozed" | "settled"; +export type SidebarSection = "pinned" | "active" | "working" | "snoozed" | "settled" | "hidden"; export function resolveSidebarThreadSection(input: { + readonly hidden: boolean; readonly snoozed: boolean; readonly settled: boolean; readonly pinned: boolean; }): SidebarSection { + if (input.hidden) return "hidden"; if (input.snoozed) return "snoozed"; if (input.settled) return "settled"; if (input.pinned) return "pinned"; @@ -224,7 +227,8 @@ export type SidebarListMarker = | "pinned-divider" | "working-header" | "snoozed-header" - | "settled-header"; + | "settled-header" + | "hidden-header"; export function sidebarMarkerId(marker: SidebarListMarker): string { return `${SIDEBAR_MARKER_PREFIX}${marker}`; @@ -247,6 +251,7 @@ function sectionAtSidebarSlot(items: readonly SidebarListItem[], index: number): else if (item.marker === "working-header") section = "working"; else if (item.marker === "snoozed-header") section = "snoozed"; else if (item.marker === "settled-header") section = "settled"; + else if (item.marker === "hidden-header") section = "hidden"; } return section; } @@ -268,7 +273,7 @@ export function resolveSidebarDropTarget( const moved = items.filter((_, index) => index !== activeIndex); moved.splice(overIndex, 0, items[activeIndex]!); const section = sectionAtSidebarSlot(moved, overIndex); - if (section === "working" || section === "snoozed") return null; + if (section === "working" || section === "snoozed" || section === "hidden") return null; const pinnedOrder: string[] = []; const activeOrder: string[] = []; let currentSection: SidebarSection = "pinned"; @@ -310,13 +315,21 @@ type SidebarThreadDropPlan = } | { readonly kind: "settle" }; -export type SidebarDropVerb = "pin" | "unpin" | "settle" | "unsettle" | "wake"; +export type SidebarDropVerb = "pin" | "unpin" | "settle" | "unsettle" | "wake" | "unhide"; export function resolveSidebarDropVerb( from: SidebarSection, to: SidebarSection | null, ): SidebarDropVerb | null { - if (to === null || to === from || to === "working" || to === "snoozed") return null; + if ( + to === null || + to === from || + from === "hidden" || + to === "working" || + to === "snoozed" || + to === "hidden" + ) + return null; if (to === "pinned") return "pin"; if (to === "settled") return "settle"; if (from === "pinned") return "unpin"; @@ -401,7 +414,7 @@ export function planSidebarThreadDrop(input: { activeKeysById, activeReorderableKeys, } = input; - if (activeSection === "working") return { kind: "none" }; + if (activeSection === "working" || activeSection === "hidden") return { kind: "none" }; if (input.supportsSettlement === false && (target.section === "settled" || activeSettled)) { return { kind: "none" }; } @@ -1382,7 +1395,7 @@ export function getFallbackThreadIdAfterDelete< > & ThreadSortInput & ThreadSnoozeShell & - Pick, + Pick & { readonly hiddenAt?: string | null }, >(input: { threads: readonly T[]; deletedThreadId: T["id"]; @@ -1406,6 +1419,7 @@ export function getFallbackThreadIdAfterDelete< thread.id !== deletedThreadId && !deletedThreadIds?.has(thread.id) && thread.settledOverride !== "settled" && + thread.hiddenAt == null && !effectiveSnoozed(thread, { now }) && !isShownUnderParent( { environmentId: thread.environmentId, threadId: thread.id }, diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index 1f4dcd8dbede2..2295c15a0702a 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -357,6 +357,7 @@ const REVEAL_ROW_CLASS_NAME = "flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-left text-sm text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground aria-disabled:cursor-default"; const SETTLED_SHELF_EXPANDED_KEY = "t3code:sidebar:settled-expanded"; const SNOOZED_SHELF_EXPANDED_KEY = "t3code:sidebar:snoozed-expanded"; +const HIDDEN_SHELF_EXPANDED_KEY = "t3code:sidebar:hidden-expanded"; const WORKING_SHELF_EXPANDED_KEY = "t3code:sidebar:working-expanded"; const inboxReturns = createInboxReturnTracker(); @@ -488,6 +489,11 @@ function useSidebarThreads(input: { false, Schema.Boolean, ); + const [hiddenShelfExpanded, setHiddenShelfExpanded] = useLocalStorage( + HIDDEN_SHELF_EXPANDED_KEY, + false, + Schema.Boolean, + ); const [workingShelfExpanded, setWorkingShelfExpanded] = useLocalStorage( WORKING_SHELF_EXPANDED_KEY, false, @@ -519,8 +525,14 @@ function useSidebarThreads(input: { clockKey: `${nowMinute}:${snoozeWakeClock}:${inboxReturnsVersion}`, }); - const { pinnedThreads, activeThreads, workingThreads, snoozedThreads, settledThreads } = - partition; + const { + pinnedThreads, + activeThreads, + workingThreads, + snoozedThreads, + settledThreads, + hiddenThreads, + } = partition; // Older settled threads load in pages; the shelf lists them only as far as they are loaded. const olderSettledShelf = useOlderSettledShelf({ scopes: olderSettledScopes([...serverConfigs.keys()], scopedProjectKeys), @@ -550,6 +562,9 @@ function useSidebarThreads(input: { const visibleSnoozedThreads = snoozedShelfExpanded ? snoozedThreads : routeThreadOnly(snoozedThreads, shelfRouteThreadKey); + const visibleHiddenThreads = hiddenShelfExpanded + ? hiddenThreads + : routeThreadOnly(hiddenThreads, shelfRouteThreadKey); const visibleWorkingThreads = workingShelfExpanded ? workingThreads : routeThreadOnly(workingThreads, routeRowThreadKey); @@ -588,6 +603,7 @@ function useSidebarThreads(input: { ...visibleWorkingThreads, ...visibleSnoozedThreads, ...renderedSettledThreads, + ...visibleHiddenThreads, ]; const sectionByThreadKey = new Map(); for (const [list, section] of [ @@ -596,6 +612,7 @@ function useSidebarThreads(input: { [workingThreads, "working"], [snoozedThreads, "snoozed"], [settledThreads, "settled"], + [hiddenThreads, "hidden"], ] as const) { for (const thread of list) sectionByThreadKey.set(threadShellKey(thread), section); } @@ -609,6 +626,7 @@ function useSidebarThreads(input: { ...workingThreads, ...snoozedThreads, ...settledThreads, + ...hiddenThreads, ], settledVisibleCount, settledCount, @@ -623,6 +641,8 @@ function useSidebarThreads(input: { toggleSettledShelf: () => setSettledShelfExpanded((value) => !value), snoozedShelfExpanded, toggleSnoozedShelf: () => setSnoozedShelfExpanded((value) => !value), + hiddenShelfExpanded, + toggleHiddenShelf: () => setHiddenShelfExpanded((value) => !value), workingShelfExpanded, toggleWorkingShelf: () => setWorkingShelfExpanded((value) => !value), projectFolders, @@ -638,6 +658,7 @@ function useSidebarThreads(input: { }), renderedSettledThreads, visibleSnoozedThreads, + visibleHiddenThreads, visibleWorkingThreads, orderedThreadKeys: orderedThreads.map(threadShellKey), threadByKey: new Map(orderedThreads.map((thread) => [threadShellKey(thread), thread] as const)), @@ -681,6 +702,7 @@ function partitionSidebarThreads(input: SidebarThreadPartitionInput) { : active; const snoozed: EnvironmentThreadShell[] = []; const settled: EnvironmentThreadShell[] = []; + const hidden: EnvironmentThreadShell[] = []; const { draggableThreadKeys, activeReorderableThreadKeys } = resolveSidebarReorderableThreadKeys({ threads: visible, serverConfigs, @@ -708,17 +730,20 @@ function partitionSidebarThreads(input: SidebarThreadPartitionInput) { ); } else { const section = resolveSidebarThreadSection({ + hidden: thread.hiddenAt != null, snoozed: configLoaded && effectiveSnoozed(thread, { now: preciseNow }), settled: configLoaded && thread.settledOverride === "settled", pinned: thread.pinnedAt != null, }); - (section === "snoozed" - ? snoozed - : section === "settled" - ? settled - : section === "pinned" - ? pinned - : inbox(thread) + (section === "hidden" + ? hidden + : section === "snoozed" + ? snoozed + : section === "settled" + ? settled + : section === "pinned" + ? pinned + : inbox(thread) ).push(thread); } } @@ -755,6 +780,7 @@ function partitionSidebarThreads(input: SidebarThreadPartitionInput) { firstValidTimestampMs(right.snoozedUntil ?? null), ), settledThreads: sortSettledThreads(settled), + hiddenThreads: sortThreadsForSidebar(hidden), visibleThreads: visible, snoozeNow: preciseNow, }; @@ -795,13 +821,16 @@ function isOptimisticDropReleased(input: { if (thread === undefined || thread.archivedAt !== null) { return true; } - const canonicalSection = effectiveSnoozed(thread, { now }) - ? "snoozed" - : thread.settledOverride === "settled" - ? "settled" - : thread.pinnedAt != null - ? "pinned" - : "active"; + const canonicalSection = + thread.hiddenAt != null + ? "hidden" + : effectiveSnoozed(thread, { now }) + ? "snoozed" + : thread.settledOverride === "settled" + ? "settled" + : thread.pinnedAt != null + ? "pinned" + : "active"; if ( canonicalSection !== optimisticDrop.sourceSection && canonicalSection !== optimisticDrop.section @@ -977,6 +1006,8 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve unsettleThread, snoozeThread, unsnoozeThread, + hideThread, + unhideThread, pinThread, unpinThread, confirmAndUnpinThread, @@ -1380,6 +1411,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve workingThreads, snoozedThreads, settledThreads, + hiddenThreads, snoozeNow, searchableThreads, settledVisibleCount, @@ -1391,6 +1423,8 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve toggleSettledShelf, snoozedShelfExpanded, toggleSnoozedShelf, + hiddenShelfExpanded, + toggleHiddenShelf, workingShelfExpanded, toggleWorkingShelf, projectFolders, @@ -1398,6 +1432,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve toggleProjectFolderShowAll, renderedSettledThreads, visibleSnoozedThreads, + visibleHiddenThreads, visibleWorkingThreads, orderedThreadKeys, threadByKey, @@ -1699,6 +1734,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve return thread && !settledKeys.has(key) && !snoozedKeys.has(key) && + thread.hiddenAt == null && !coParkingKeys?.has(key) ? [scopeThreadRef(thread.environmentId, thread.id)] : []; @@ -1711,6 +1747,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve const thread = readThreadShell(ref); return ( thread !== null && + thread.hiddenAt == null && thread.settledOverride !== "settled" && !effectiveSnoozed(thread, { now }) ); @@ -1803,6 +1840,22 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve } })(); }; + const attemptHideChange = (threadRef: ScopedThreadRef, hidden: boolean) => { + void (async () => { + const result = await (hidden ? hideThread(threadRef) : unhideThread(threadRef)); + if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) { + const error = squashAtomCommandFailure(result); + toastManager.add( + stackedThreadToast({ + type: "error", + title: hidden ? gt`Failed to hide thread` : gt`Failed to unhide thread`, + description: thrownErrorMessage(error, m) ?? gt`An error occurred.`, + }), + ); + } + })(); + }; + const attemptUnhide = (threadRef: ScopedThreadRef) => attemptHideChange(threadRef, false); const restrictBelowPins: Modifier = (args) => restrictBelowSidebarLabel(args, dragLabelOffsetRef.current); const dndModifiers = [ @@ -1970,6 +2023,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve const ref = parseScopedThreadKey(key); if (ref === null) continue; if (action === "unsettle") attemptUnsettle(ref); + else if (action === "unhide") attemptUnhide(ref); else attemptUnsnooze(ref); } }, @@ -2050,6 +2104,38 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve event.activatorEvent instanceof PointerEvent ? event.activatorEvent.clientY : null, }); }; + const showMoreSettledRow = + settledShelfExpanded && hiddenSettledCount > 0 ? ( +
  • + +
  • + ) : null; const hasProjectFolders = projectFolders !== null && projectFolders.length > 0; const sidebarListItemsFresh = ((): readonly SidebarListItem[] => { const rowsOf = ( @@ -2067,7 +2153,8 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve activeThreads.length + workingThreads.length + snoozedThreads.length + - settledCount === + settledCount + + hiddenThreads.length === 0 ) { return []; @@ -2091,6 +2178,10 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve const settledRows = rowsOf(renderedSettledThreads, "settled"); items.push({ kind: "marker", marker: "settled-placeholder" }); items.push(...settledRows); + if (hiddenThreads.length > 0) { + items.push({ kind: "marker", marker: "hidden-header" }); + items.push(...rowsOf(visibleHiddenThreads, "hidden")); + } return items; })(); // Preserve the list while streamed updates leave order unchanged to retain row memoization. @@ -2131,9 +2222,12 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve dragState === null && sidebarListItems.length + visibleDraftSessionCount > 0; // Cache on both fields so layout-key changes trigger the effect even when animate is unchanged. const listMotionPass = { layoutKey: listMotionLayoutKey, animate: listMotionAnimate }; - const shelfExpansionKey = [workingShelfExpanded, snoozedShelfExpanded, settledShelfExpanded].join( - ":", - ); + const shelfExpansionKey = [ + workingShelfExpanded, + snoozedShelfExpanded, + settledShelfExpanded, + hiddenShelfExpanded, + ].join(":"); const previousShelfExpansionKeyRef = useRef(shelfExpansionKey); // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- records moved rows and updates list motion after each layout-affecting commit useLayoutEffect(() => { @@ -2778,9 +2872,8 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve projectByKey.get(`${thread.environmentId}:${thread.projectId}`)?.workspaceRoot ?? null; const configLoaded = serverConfigs.has(thread.environmentId); - const supportsAutoSettleOptOut = - serverConfigs.get(thread.environmentId)?.environment.capabilities - .threadAutoSettleOptOut === true; + const capabilities = serverConfigs.get(thread.environmentId)?.environment.capabilities; + const supportsAutoSettleOptOut = capabilities?.threadAutoSettleOptOut === true; const isRegeneratingTitle = thread.titleRegeneration != null; const isSettled = settledThreadKeysRef.current.has(threadKey); const isSnoozed = snoozedThreadKeysRef.current.has(threadKey); @@ -2816,6 +2909,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve } : null, isPinned, + isHidden: thread.hiddenAt != null, isSettled, autoSettleEnabled: thread.autoSettleDisabledAt == null, isSnoozed, @@ -2840,6 +2934,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve autoSettleOptOut: supportsAutoSettleOptOut, snooze: configLoaded, pinning: configLoaded, + hide: capabilities?.threadHide === true, titleRegeneration: configLoaded, }, snoozePresets, @@ -2921,6 +3016,10 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve case "unpin": attemptUnpin(threadRef); return; + case "hide": + case "unhide": + attemptHideChange(threadRef, clicked.value === "hide"); + return; case "turn-into-project": { const result = await turnThreadIntoProject(threadRef); if (result._tag === "Success") { @@ -3550,7 +3649,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve workingThreads.length + snoozedThreads.length === 0 && - (settledCount === 0 || scopedProjectGroups.length > 0) ? ( + (settledCount + hiddenThreads.length === 0 || scopedProjectGroups.length > 0) ? (
    {projects.length === 0 ? ( <> @@ -3569,7 +3668,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve ) : scopedProjectGroups.length > 0 ? ( <> - {settledCount > 0 + {settledCount + hiddenThreads.length > 0 ? scopedProjectGroups.length > 1 ? gt`No active threads in these projects` : gt`No active threads in ${{ project: scopedProjectGroups[0]!.displayName }}` @@ -3650,20 +3749,29 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve layout={rowLayout} navigationParent={ folderRow ?? - (section === "working" || section === "snoozed" || section === "settled" + (section === "working" || + section === "snoozed" || + section === "settled" || + section === "hidden" ? `shelf:${section}` : undefined) } variantAction={ - section === "snoozed" - ? "unsnooze" - : section === "settled" - ? "unsettle" - : "settle" + section === "hidden" + ? "unhide" + : section === "snoozed" + ? "unsnooze" + : section === "settled" + ? "unsettle" + : "settle" } settlementSupported={serverConfigs.has(thread.environmentId)} snoozeSupported={serverConfigs.has(thread.environmentId)} pinningSupported={serverConfigs.has(thread.environmentId)} + hideSupported={ + serverConfigs.get(thread.environmentId)?.environment.capabilities + .threadHide === true + } isPinned={thread.pinnedAt != null} dropVerb={ dragState?.activeKey === threadKey @@ -3720,6 +3828,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve onUnsettle={attemptUnsettle} onSnooze={attemptSnooze} onUnsnooze={attemptUnsnooze} + onUnhide={attemptUnhide} onUnpin={attemptUnpin} onAcknowledgeWoke={acknowledgeWoke} onFileDropThreads={handleThreadFileDrop} @@ -3892,6 +4001,21 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve />, ); break; + case "hidden-header": + if (showMoreSettledRow !== null) items.push(showMoreSettledRow); + items.push( + , + ); + break; case "settled-placeholder": items.push( 0 ? ( -
  • - -
  • - ) : null} + {hiddenThreads.length === 0 ? showMoreSettledRow : null} diff --git a/apps/web/src/components/ThreadNotificationCoordinator.logic.test.ts b/apps/web/src/components/ThreadNotificationCoordinator.logic.test.ts index 0efca647316ba..d8727b2bf931e 100644 --- a/apps/web/src/components/ThreadNotificationCoordinator.logic.test.ts +++ b/apps/web/src/components/ThreadNotificationCoordinator.logic.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it, vi } from "vite-plus/test"; import { createThreadNotificationGate, - isSnoozedForNotification, + isQuietForNotification, RELEASED_COMPLETION_GRACE_MS, type ThreadNotificationObservation, } from "./ThreadNotificationCoordinator.logic"; @@ -218,7 +218,7 @@ describe("createThreadNotificationGate", () => { }); }); -describe("isSnoozedForNotification", () => { +describe("isQuietForNotification", () => { const snoozedAt = Date.parse("2026-01-01T11:00:00.000Z"); const wakeAt = Date.parse("2026-01-01T12:00:00.000Z"); const thread = { @@ -240,7 +240,14 @@ describe("isSnoozedForNotification", () => { wakeAt - 1, false, ], + [ + "on a hidden thread that never snoozed", + { hasPendingApprovals: false, hasPendingUserInput: false, hiddenAt: thread.snoozedAt }, + later, + later, + true, + ], ])("a completion %s is suppressed: %s", (_name, shell, completedAt, now, expected) => { - expect(isSnoozedForNotification(shell, completedAt, now)).toBe(expected); + expect(isQuietForNotification(shell, completedAt, now)).toBe(expected); }); }); diff --git a/apps/web/src/components/ThreadNotificationCoordinator.logic.ts b/apps/web/src/components/ThreadNotificationCoordinator.logic.ts index 057d976a17837..ceb6d51561db5 100644 --- a/apps/web/src/components/ThreadNotificationCoordinator.logic.ts +++ b/apps/web/src/components/ThreadNotificationCoordinator.logic.ts @@ -22,14 +22,15 @@ export interface ThreadNotificationObservation { export const RELEASED_COMPLETION_GRACE_MS = 5_000; /** - * Whether completion notifications are suppressed by snooze. A completion that landed + * Whether completion notifications are suppressed by hide or snooze. A completion that landed * during the snooze stays suppressed even when its update is processed after the wake. */ -export function isSnoozedForNotification( - thread: ThreadSnoozeShell, +export function isQuietForNotification( + thread: ThreadSnoozeShell & { readonly hiddenAt?: string | null }, completedAt: number | null, now: number, ): boolean { + if (thread.hiddenAt != null) return true; if (effectiveSnoozed(thread, { now: new Date(now).toISOString() })) return true; if (completedAt === null) return false; if (thread.snoozedAt != null && completedAt < Date.parse(thread.snoozedAt)) return false; diff --git a/apps/web/src/components/ThreadNotificationCoordinator.tsx b/apps/web/src/components/ThreadNotificationCoordinator.tsx index 7f91d48643bbf..7b036fd06bc8c 100644 --- a/apps/web/src/components/ThreadNotificationCoordinator.tsx +++ b/apps/web/src/components/ThreadNotificationCoordinator.tsx @@ -37,7 +37,7 @@ import { resolveBackgroundThreadRequest } from "./backgroundThreadAnnouncement"; import { resolveSidebarThreadStatus, type SidebarThreadStatus } from "./Sidebar.logic"; import { createThreadNotificationGate, - isSnoozedForNotification, + isQuietForNotification, type ThreadNotificationKind, type ThreadNotificationObservation, } from "./ThreadNotificationCoordinator.logic"; @@ -308,7 +308,7 @@ export function startThreadNotifications( entry.gate.observe(state.thread.id, prior, state, { archived: state.thread.archivedAt !== null, quiet: state.raw.latestRunStopRequested === true, - snoozed: isSnoozedForNotification(state.thread, state.completedAt, now), + snoozed: isQuietForNotification(state.thread, state.completedAt, now), }); } }; diff --git a/apps/web/src/components/backgroundThreadAnnouncement.test.ts b/apps/web/src/components/backgroundThreadAnnouncement.test.ts index 51d3c693f9904..f448f6c12ea6e 100644 --- a/apps/web/src/components/backgroundThreadAnnouncement.test.ts +++ b/apps/web/src/components/backgroundThreadAnnouncement.test.ts @@ -26,7 +26,7 @@ function thread( runId: firstRun, runStatus: "running", activeRunId: null, - snoozed: false, + quiet: false, ...state, }; } @@ -143,8 +143,8 @@ describe("nextBackgroundThreadAnnouncement", () => { it("keeps a snoozed thread quiet, even after it wakes", () => { expect( speak([ - { threads: [login({ snoozed: true })] }, - { threads: [login({ snoozed: true, runStatus: "completed" })] }, + { threads: [login({ quiet: true })] }, + { threads: [login({ quiet: true, runStatus: "completed" })] }, { threads: [login({ runStatus: "completed" })] }, ]), ).toEqual([]); diff --git a/apps/web/src/components/backgroundThreadAnnouncement.ts b/apps/web/src/components/backgroundThreadAnnouncement.ts index debacd3fe9a39..e788dbd5ff864 100644 --- a/apps/web/src/components/backgroundThreadAnnouncement.ts +++ b/apps/web/src/components/backgroundThreadAnnouncement.ts @@ -23,8 +23,8 @@ export interface BackgroundThreadSnapshot { readonly runStatus: OrchestrationV2RunStatus | null; /** The run doing work now, which can be older than a queued run cancelled while it ran. */ readonly activeRunId: RunId | null; - /** A snoozed thread stays hidden until its timer, so it stays quiet too. */ - readonly snoozed: boolean; + /** A snoozed or hidden thread is out of the user's view, so it stays quiet too. */ + readonly quiet: boolean; } /** The request and its id come from the same source, so a subagent's request never takes the parent's id. */ @@ -95,7 +95,7 @@ export function nextBackgroundThreadAnnouncement( requestId: thread.requestId, settledRunId: settled ? thread.runId : (before?.settledRunId ?? null), }); - if (before === undefined || thread.key === openThreadKey || thread.snoozed) continue; + if (before === undefined || thread.key === openThreadKey || thread.quiet) continue; if ( thread.request !== null && (thread.request !== before.request || thread.requestId !== before.requestId) diff --git a/apps/web/src/components/chat/useThreadLifecycle.tsx b/apps/web/src/components/chat/useThreadLifecycle.tsx index 897a4e03a07ef..8008f2db5e3db 100644 --- a/apps/web/src/components/chat/useThreadLifecycle.tsx +++ b/apps/web/src/components/chat/useThreadLifecycle.tsx @@ -52,7 +52,7 @@ import { } from "@t3tools/client-runtime/state/runtime"; import { useUiStateStore } from "../../uiStateStore"; import { type ChatMessage, DEFAULT_INTERACTION_MODE } from "../../types"; -import { AlarmClockIcon, CheckCircle2Icon } from "lucide-react"; +import { AlarmClockIcon, CheckCircle2Icon, EyeOffIcon } from "lucide-react"; import { stackedThreadToast, toastManager } from "../ui/toast"; import { titleRegenerationToast } from "../threadTitleRegenerationToast"; import { newMessageId } from "~/lib/utils"; @@ -196,7 +196,7 @@ export function useThreadLifecycle(input: ThreadLifecycleInput) { const messages = useMessages(); const navigate = useNavigate(); const router = useRouter(); - const { settleThread, pinThread, confirmAndUnpinThread } = useThreadActions(); + const { settleThread, pinThread, confirmAndUnpinThread, unhideThread } = useThreadActions(); const canWriteSourceControl = useEnvironmentScope(environmentId, AuthSourceControlWriteScope); const canTriageThread = !useEnvironmentScopeDenied(environmentId, AuthOrchestrationOperateScope); const switchGitRef = useAtomCommand(vcsEnvironment.switchRef, { reportFailure: false }); @@ -321,6 +321,27 @@ export function useThreadLifecycle(input: ThreadLifecycleInput) { setUnsnoozingThreadKey((current) => (current === threadKey ? null : current)); }; const handleUnsnoozeActiveThreadStable = useStableCallback(handleUnsnoozeActiveThread); + const activeThreadHidden = activeThreadShell?.hiddenAt != null; + const [unhidingThreadKey, setUnhidingThreadKey] = useState(null); + const isUnhiding = unhidingThreadKey !== null && unhidingThreadKey === activeThreadKey; + const handleUnhideActiveThread = async () => { + if (!activeThreadRef) return; + const threadKey = scopedThreadKey(activeThreadRef); + setUnhidingThreadKey(threadKey); + const result = await unhideThread(activeThreadRef); + if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) { + const error = squashAtomCommandFailure(result); + toastManager.add( + stackedThreadToast({ + type: "error", + title: m(msg("Failed to unhide thread")), + description: thrownErrorMessage(error, m) ?? m(msg("An error occurred.")), + }), + ); + } + setUnhidingThreadKey((current) => (current === threadKey ? null : current)); + }; + const handleUnhideActiveThreadStable = useStableCallback(handleUnhideActiveThread); const [restoringBranchThreadKeys, setRestoringBranchThreadKeys] = useState>( () => new Set(), ); @@ -662,7 +683,16 @@ export function useThreadLifecycle(input: ThreadLifecycleInput) { Date.parse(snoozedUntil) > Date.parse(snoozeNow) ? snoozeWakeLabel(snoozedUntil, { now: snoozeNow }, messages) : null; - const threadStatusLine = activeThreadSnoozed ? ( + const threadStatusLine = activeThreadHidden ? ( + } + label={gt({ context: "thread status" })`Hidden`} + clockMinute={nowMinute} + actionLabel={isUnhiding ? gt`Unhiding...` : gt`Unhide`} + actionDisabled={!canOperateThread || isUnhiding} + onAction={() => void handleUnhideActiveThreadStable()} + /> + ) : activeThreadSnoozed ? ( limitRecoveryHoldsSnooze ? null : ( } diff --git a/apps/web/src/components/settings/SidebarRowLayoutRow.tsx b/apps/web/src/components/settings/SidebarRowLayoutRow.tsx index bf38b2c57c320..f63520dbba142 100644 --- a/apps/web/src/components/settings/SidebarRowLayoutRow.tsx +++ b/apps/web/src/components/settings/SidebarRowLayoutRow.tsx @@ -818,6 +818,7 @@ function PreviewSidebar(props: { layout: SidebarRowLayout }) { onUnsettle={noop} onSnooze={noop} onUnsnooze={noop} + onUnhide={noop} onUnpin={noop} onAcknowledgeWoke={noop} /> diff --git a/apps/web/src/components/sidebar/SidebarListMarkers.tsx b/apps/web/src/components/sidebar/SidebarListMarkers.tsx index da9444a5c1b24..211c23b7c3995 100644 --- a/apps/web/src/components/sidebar/SidebarListMarkers.tsx +++ b/apps/web/src/components/sidebar/SidebarListMarkers.tsx @@ -111,7 +111,7 @@ export function SidebarDragBoundary(props: { } export function SidebarSectionHeader(props: { - marker: "working-header" | "snoozed-header" | "settled-header"; + marker: "working-header" | "snoozed-header" | "settled-header" | "hidden-header"; label: string; /** A muted trailing count. */ count: number; @@ -125,7 +125,9 @@ export function SidebarSectionHeader(props: { ? "working" : props.marker === "snoozed-header" ? "snoozed" - : "settled"; + : props.marker === "hidden-header" + ? "hidden" + : "settled"; return ( ; } -export type SidebarSweepAction = "settle" | "unsettle" | "unsnooze"; +export type SidebarSweepAction = "settle" | "unsettle" | "unsnooze" | "unhide"; const dropVerbBadge: Record = { pin: ( <> @@ -634,6 +635,12 @@ const dropVerbBadge: Record = { Wake ), + unhide: ( + <> + + Unhide + + ), }; const TOP_STATUS_ICONS = { @@ -664,6 +671,7 @@ type SidebarThreadRowProps = { settlementSupported: boolean; snoozeSupported: boolean; pinningSupported: boolean; + hideSupported?: boolean | undefined; isPinned: boolean; sortable?: SortableThreadRowBag | undefined; dropVerb: SidebarDropVerb | null; @@ -708,6 +716,7 @@ type SidebarThreadRowProps = { onUnsettle: (threadRef: ScopedThreadRef) => void; onSnooze: (threadRef: ScopedThreadRef, preset: Pick) => void; onUnsnooze: (threadRef: ScopedThreadRef) => void; + onUnhide: (threadRef: ScopedThreadRef) => void; onUnpin: (threadRef: ScopedThreadRef) => void; onAcknowledgeWoke: (threadRef: ScopedThreadRef, visitedAt: string) => void; onFileDropThreads?: ((threadRef: ScopedThreadRef, files: File[]) => void) | undefined; @@ -798,6 +807,7 @@ export const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThr onThreadClick, onUnsettle, onUnsnooze, + onUnhide, onUnpin, readOpensPullRequestsInRightPanel, renamingTitle, @@ -1087,6 +1097,11 @@ export const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThr event.stopPropagation(); onUnsnooze(threadRef); }; + const handleUnhideClick = (event: ReactMouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + onUnhide(threadRef); + }; const handleUnpinClick = (event: ReactMouseEvent) => { event.preventDefault(); event.stopPropagation(); @@ -1139,7 +1154,7 @@ export const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThr const rowSurfaceClassName = cn( "group/sidebar-row relative w-full cursor-pointer overflow-hidden rounded-md text-left outline-none select-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring", - variantAction === "unsettle" && + (variantAction === "unsettle" || variantAction === "unhide") && !props.isActive && "[&:not(:hover):not(:focus-within)_*:not(.live-activity-focus_*)]:text-secondary-label", props.isActive @@ -1868,7 +1883,32 @@ export const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThr
    )} - {variantAction === "unsnooze" ? ( + {variantAction === "unhide" ? ( + !props.hideSupported ? null : ( + + } + label={ + <> + Unhide thread + + } + > + + + ) + ) : variantAction === "unsnooze" ? ( !props.snoozeSupported ? null : (