Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ This is a personal fork of [pingdotgg/t3code](https://github.com/pingdotgg/t3cod

- **Switch back to the previous thread.** In the desktop app, Ctrl+Tab toggles between the current and previously viewed thread or unsent draft, including across projects and environments. It works while typing in the composer or terminal and follows the focused pane in split view. The pair lasts for the current app session. On web and desktop, snoozing or archiving the open thread yourself returns you to that previous thread, unless **Return to previous thread** is off in Settings → Extras; an agent's or scheduled archive leaves it on screen.

- **Move a thread to the top.** The command palette moves the current thread to the top of Pinned, Active, or its custom group, counting members hidden by filters or folded groups, and keeps its group. Pinned always accepts it. Active and custom groups accept it only while the Working shelf is off outside folder mode; otherwise they sort by activity and the action is not offered there. Drafts, subagents, side chats, and archived, snoozed, or settled threads can't be moved this way.

- **Custom thread groups.** Organize threads from any project or environment into named groups. Pick a group on the new-thread view or with **New thread in group** in the command palette, and move threads (several at once with Cmd/Ctrl-click) by dragging, from their menu, or from the palette. The Thread groups dialog places each group above or below Active; mobile shows the same groups and order, and **Arrange threads** moves threads between them. Forks join their source's group, and pinned, snoozed, settled, and archived threads return to their group. Settings → Extras can add a Thread groups toolbar button.

- **Rename and snooze from the command palette.** Rename current thread edits the title inside the palette input. Snooze current thread lists your configured snooze options with their wake times, including Until it's done, and also parses a typed time such as `45m`, `2pm`, or `fri 9am`; a snoozed thread offers Wake current thread instead. Both are available as unbound keybinding commands (Thread: Rename, Thread: Snooze) that open the palette straight into that step. Thread: Snooze Until Done snoozes a working thread until it's done in one keystroke and opens the snooze step otherwise; Settings → Extras can make it always open the snooze step.
Expand Down Expand Up @@ -41,7 +39,7 @@ This is a personal fork of [pingdotgg/t3code](https://github.com/pingdotgg/t3cod
- **Hideable panel toggles** — Settings → Extras → Panels can hide the terminal drawer and right panel toggles from the thread header, in single and split view, for keyboard-driven use; the header then stops reserving room for them and the shortcuts keep working. They show by default.
- **Mobile swipe-right actions** — swiping a thread row right reveals Pin (Unpin on a pinned row), Fork, and Archive, in that order. Pin needs a server that supports pinning and Fork a conversation that can be forked; each has a twin in the row's long-press menu. Pin and Archive keep you on the list; Fork opens the new copy. Archive stays innermost, so a full swipe right still archives, or asks first when the thread has queued messages.
- **Session import** — import an external Claude Code or Codex CLI session as a native thread from Project Settings, into the project checkout or one of its existing worktrees; the native session continues in T3. Sessions already owned by a T3 thread show as linked; importing one again forks it into a fresh thread, so the original keeps its session.
- **Recent archived threads and archive browser** — the thread list ends with a folded **Archived** shelf of your most recently archived threads on web, desktop, and mobile; set its size in Settings → Extras (Settings → General on mobile). Opening one shows it as archived, and Unarchive or a new message restores it. On web and desktop the shelf follows the sidebar's project and environment filters, and the full archive in Settings groups threads by repository across environments, follows the Settings scope, and is searchable by title, project, path, environment, or model. Archived subagent threads stay out of both the shelf and the archive on every client. The command palette adds **Open archived threads**, also scoped to the current project. Tag hiding also applies to the shelf; while enabled, archived threads outside the live list cannot be opened.
- **Recent archived threads and archive browser** — the thread list ends with a folded **Archived** shelf of your most recently archived threads on web, desktop, and mobile; set its size in Settings → Extras (Settings → General on mobile). Opening one shows it as archived, and Unarchive or a new message restores it. On web and desktop the shelf follows the sidebar's project and environment filters, and the full archive in Settings groups threads by repository across environments, follows the Settings scope, and is searchable by title, project, path, environment, or model. Archived subagent threads stay out of both the shelf and the archive on every client. Tag hiding also applies to the shelf; while enabled, archived threads outside the live list cannot be opened.
- **Offline mobile archive queue** — archiving or unarchiving on mobile while an environment is disconnected takes effect immediately on the phone: an archived thread moves to the Archived shelf marked Pending, with an Undo action, and the change syncs on reconnect. Archiving a thread that is still working queues an archive-when-done, and cancelling a pending archive works offline too. Discarding queued messages asks first, from the phone's last known state; a confirmed discard archives right away on reconnect, and an archive the server refuses shows why. A later choice for the same thread replaces the pending one.
- **Thread-list filters** — on web and desktop, the thread sidebar narrows the list along independent axes:
- **Project** — show any combination of projects, or hide individual projects; both choices persist across relaunches.
Expand Down
35 changes: 0 additions & 35 deletions apps/web/src/components/CommandPalette.logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type { Thread } from "../types";
import { makeThreadFixture } from "../test-fixtures";
import {
buildArchiveCurrentThreadAction,
buildArchivedThreadsActionItems,
buildCurrentThreadActionItems,
newThreadNoProjectIndex,
buildNestedSearchItems,
Expand Down Expand Up @@ -433,40 +432,6 @@ describe("buildSnoozeThreadViewItems", () => {
});
});

describe("buildArchivedThreadsActionItems", () => {
it("offers only the unfiltered entry without a resolvable project", () => {
expect(
buildArchivedThreadsActionItems({
projectFilterKey: null,
projectTitle: "Ignored",
icon: null,
openArchived: vi.fn(),
}).map((item) => item.value),
).toEqual(["action:archived-threads"]);
});

it("adds a project-scoped entry naming the current project", async () => {
const openArchived = vi.fn(async () => undefined);
const items = buildArchivedThreadsActionItems({
projectFilterKey: "github.com/t3tools/t3code",
projectTitle: "T3 Code",
icon: null,
openArchived,
});

expect(items.map((item) => item.value)).toEqual([
"action:archived-threads",
"action:archived-threads-in-project",
]);
expect(items[1]).toMatchObject({ title: "Open archived threads in T3 Code" });

await items[0]?.run();
expect(openArchived).toHaveBeenCalledWith(null);
await items[1]?.run();
expect(openArchived).toHaveBeenCalledWith("github.com/t3tools/t3code");
});
});

describe("linked pull request thread navigation", () => {
it("keeps archived relations searchable and routes them through the PR environment", async () => {
const environmentId = EnvironmentId.make("remote");
Expand Down
44 changes: 0 additions & 44 deletions apps/web/src/components/CommandPalette.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -866,50 +866,6 @@ export function buildSnoozeThreadViewItems(input: {
return items;
}

export function buildArchivedThreadsActionItems(input: {
/** Logical group key of the open thread's project, when there is one. */
readonly projectFilterKey: string | null;
readonly projectTitle: string | null;
readonly icon: ReactNode;
readonly openArchived: (projectFilterKey: string | null) => Promise<void>;
}): CommandPaletteActionItem[] {
const items: CommandPaletteActionItem[] = [
{
kind: "action",
value: "action:archived-threads",
searchTerms: ["open archived threads", "archived", "archive", "history", "settings"],
title: "Open archived threads",
icon: input.icon,
run: async () => {
await input.openArchived(null);
},
},
];

if (input.projectFilterKey !== null && input.projectTitle !== null) {
const projectFilterKey = input.projectFilterKey;
items.push({
kind: "action",
value: "action:archived-threads-in-project",
searchTerms: [
"open archived threads",
"archived",
"archive",
"project",
"current project",
input.projectTitle,
],
title: `Open archived threads in ${input.projectTitle}`,
icon: input.icon,
run: async () => {
await input.openArchived(projectFilterKey);
},
});
}

return items;
}

export type BuildThreadActionItemsThread = Pick<
SidebarThreadSummary,
| "archivedAt"
Expand Down
80 changes: 1 addition & 79 deletions apps/web/src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ import {
GitForkIcon,
MessageSquareDashedIcon,
GroupIcon,
ArrowUpToLineIcon,
LinkIcon,
MessageSquareIcon,
NotebookPenIcon,
Expand Down Expand Up @@ -184,9 +183,7 @@ import {
usePrimaryEnvironmentId,
} from "../state/environments";
import {
readEnvironmentServerConfigLoaded,
readEnvironmentSupportsSnoozeUntilDone,
readThreadShells,
useProjects,
useServerConfigs,
useThreadShell,
Expand All @@ -195,7 +192,6 @@ import {
useHiddenThreadKeys,
useEnvironmentThreadRefs,
useVisibleThreadShells,
useThreadShells,
waitForProject,
} from "../state/entities";
import { useIsLabsPanelProject } from "../state/labs";
Expand Down Expand Up @@ -297,7 +293,6 @@ import {
} from "./CommandPalette.logic";
import { useThreadGroupCatalog } from "../hooks/useThreadGroups";
import { groupMovableThreads, moveThreadsToGroup } from "../lib/threadGroupMove";
import { planThreadMoveToTop } from "../lib/threadMoveToTop";
import { useThreadSelectionStore } from "../threadSelectionStore";
import { openThreadGroupsDialog } from "./sidebar/threadGroupsDialogStore";
import { threadGroupId } from "@t3tools/shared/threadGroups";
Expand Down Expand Up @@ -436,10 +431,6 @@ function threadActionIcon(id: CommandPaletteThreadActionId): ReactNode {
}
}

// Fork: the dialog unmounts between invocations; keep an unfinished reorder
// across openings.
const pendingMovesToTop = new Set<string>();

async function reportThreadActionFailure(
title: string,
run: () => Promise<AtomCommandResult<unknown, unknown>>,
Expand All @@ -457,22 +448,6 @@ async function reportThreadActionFailure(
return result._tag === "Success";
}

// Stops on failure; each successful key write remains a valid placement.
async function writeMoveToTopKeys(
assignments: ReadonlyArray<{ readonly threadRef: ScopedThreadRef; readonly orderKey: string }>,
reorder: (
threadRef: ScopedThreadRef,
orderKey: string,
) => Promise<AtomCommandResult<unknown, unknown>>,
): Promise<void> {
for (const assignment of assignments) {
const moved = await reportThreadActionFailure("Failed to move thread to top", () =>
reorder(assignment.threadRef, assignment.orderKey),
);
if (!moved) return;
}
}

export function CommandPalette({ children }: { children: ReactNode }) {
useCommandPaletteMount();
const state = useCommandPaletteStore();
Expand Down Expand Up @@ -679,8 +654,6 @@ function OpenCommandPaletteDialog(props: {
unsnoozeThread,
forkThread,
setThreadCustomGroup,
reorderActiveThread,
reorderPinnedThread,
} = useThreadActions();
// Fork: custom thread groups.
const customGroupCatalog = useThreadGroupCatalog();
Expand All @@ -692,14 +665,10 @@ function OpenCommandPaletteDialog(props: {
reportFailure: false,
});
const timestampFormat = useClientSettings((s) => s.timestampFormat);
// Snooze state, presets and move-to-top plans read the clock at minute precision.
// Snooze state and presets read the clock at minute precision.
const nowMinute = useNowMinute();
const renderNow = new Date(`${nowMinute}:00.000Z`);
const snoozeShortcutUntilDone = useClientSettings((s) => s.snoozeShortcutUntilDone);
// The sidebar's Working shelf and folder mode sort Active by activity, not order keys.
const activeKeyOrdered = useClientSettings(
(s) => !s.sidebarWorkingShelfEnabled && !s.boringSidebarEnabled,
);
const paletteRouteTarget = useThreadRouteTarget();
const projects = useProjects();
const accentTint = useAccentTintSettings();
Expand Down Expand Up @@ -773,7 +742,6 @@ function OpenCommandPaletteDialog(props: {
delegatedUnderParent,
),
);
const allThreads = useThreadShells();
const serverConfigs = useServerConfigs();
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
const providersByEnvironment = useEnvironmentProviders();
Expand Down Expand Up @@ -1972,52 +1940,6 @@ function OpenCommandPaletteDialog(props: {
}
}

// Fork: group-aware "Move to top", planned against the full group or pinned
// shelf so search, filters and folded groups cannot change what "top" is.
const canReorderSection = (environmentId: EnvironmentId) => serverConfigs.has(environmentId);
const moveToTopPlan = planThreadMoveToTop({
threads: allThreads,
threadRef: currentThreadRef,
groups: customGroupCatalog.groups,
now: renderNow.toISOString(),
activeKeyOrdered,
canReorder: canReorderSection,
});
if (moveToTopPlan !== null && currentThreadRef !== null) {
const threadRef = currentThreadRef;
actionItems.push({
kind: "action",
value: "action:thread:move-to-top",
title: "Move current thread to top",
searchTerms: ["move", "top", "reorder", "group", "current thread"],
icon: <ArrowUpToLineIcon className={ITEM_ICON_CLASS} />,
...(moveToTopPlan.disabledReason
? { disabled: true, description: moveToTopPlan.disabledReason }
: {}),
run: async () => {
if (pendingMovesToTop.size > 0) return;
// Re-read shells at execution: a snooze or another client's reorder
// may have landed while the palette was open.
const plan = planThreadMoveToTop({
threads: readThreadShells(),
threadRef,
groups: customGroupCatalog.groups,
// oxlint-disable-next-line react/purity -- runs in an event handler (oxc#27309)
now: new Date().toISOString(),
activeKeyOrdered,
canReorder: readEnvironmentServerConfigLoaded,
});
if (plan === null || plan.disabledReason) return;
const moveKey = `${threadRef.environmentId}:${threadRef.threadId}`;
pendingMovesToTop.add(moveKey);
await writeMoveToTopKeys(
plan.assignments,
plan.section === "pinned" ? reorderPinnedThread : reorderActiveThread,
).finally(() => pendingMovesToTop.delete(moveKey));
},
});
}

// Fork: a sidebar multi-selection takes over the group move; rows on
// servers without group support are left out of the count and the move.
const selectedThreads =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "../../desktopThreadLink";
import { appAtomRegistry } from "../../rpc/atomRegistry";
import { readThreadShell } from "../../state/entities";
import { orchestrationEnvironment } from "../../state/orchestration";
import { archivedSnapshotAtom } from "../../lib/archivedThreadsState";
import { primaryEnvironmentIdAtom } from "../../state/primaryEnvironment";
import { environmentShell } from "../../state/shell";
import { buildThreadRouteParams, resolveThreadRouteRef } from "../../threadRoutes";
Expand Down Expand Up @@ -44,10 +44,7 @@ function waitForThreadList(environmentId: EnvironmentId): Promise<boolean> {
async function hasArchivedThread(threadRef: ScopedThreadRef): Promise<boolean | null> {
const result = await executeAtomQuery(
appAtomRegistry,
orchestrationEnvironment.archivedShellSnapshot({
environmentId: threadRef.environmentId,
input: {},
}),
archivedSnapshotAtom(threadRef.environmentId),
{
label: "thread link archived lookup",
reportFailure: false,
Expand Down
6 changes: 2 additions & 4 deletions apps/web/src/components/labs/LabParts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as Option from "effect/Option";
import { AsyncResult, Atom } from "effect/reactivity";
import { useEffect, useState } from "react";

import { liveArchivedShellSnapshotAtom } from "../../lib/archivedThreadsState";
import { archivedSnapshotAtom } from "../../lib/archivedThreadsState";
import { cn } from "~/lib/utils";
import { useThreadShell } from "../../state/entities";
import { appAtomRegistry } from "../../rpc/atomRegistry";
Expand Down Expand Up @@ -117,9 +117,7 @@ function archivedOwnerShell(
environmentId: EnvironmentId,
threadId: string,
): EnvironmentThreadShell | null {
const snapshot = Option.getOrNull(
AsyncResult.value(get(liveArchivedShellSnapshotAtom(environmentId))),
);
const snapshot = Option.getOrNull(AsyncResult.value(get(archivedSnapshotAtom(environmentId))));
const thread = snapshot?.threads.find((candidate) => candidate.id === threadId);
return thread ? presentThreadShell(environmentId, thread) : null;
}
Expand Down
Loading
Loading