Add a thread details panel
A right-hand column like the web's thread details card: workspace, model and mode, branch with ahead/behind and its PR, uncommitted changes from the server's git status stream, lineage, background work and the goal. Opens on wide terminals; d toggles it.
This commit is contained in:
1 parent
2dac4763d2
commit
248603d9ae
6 files changed
+537
-9
No files matched your search
@@ -43,6 +43,7 @@ Navigation:
|
|||||||
| `x` | dismiss the agent's question |
|
| `x` | dismiss the agent's question |
|
||||||
| `e` | expand all folded turns and work groups |
|
| `e` | expand all folded turns and work groups |
|
||||||
| `o` | load earlier turns |
|
| `o` | load earlier turns |
|
||||||
|
| `d` | show or hide thread details |
|
||||||
| `z` | show the Settled and Snoozed sections |
|
| `z` | show the Settled and Snoozed sections |
|
||||||
| `/` | filter threads by title or project |
|
| `/` | filter threads by title or project |
|
||||||
| `S` | stop the thread |
|
| `S` | stop the thread |
|
||||||
@@ -53,6 +54,7 @@ The layout follows T3 Code's web app, and much of it uses the web app's own code
|
|||||||
|
|
||||||
- **Sidebar:** the same sections (Pinned, Active, Working, then Snoozed and Settled folded to a count) and the same status words: `Working 2m`, `Waiting`, `Approval`, `Input`, `Request`, `Limited`, `Failed`, `Done`. Threads that need you are bold.
|
- **Sidebar:** the same sections (Pinned, Active, Working, then Snoozed and Settled folded to a count) and the same status words: `Working 2m`, `Waiting`, `Approval`, `Input`, `Request`, `Limited`, `Failed`, `Done`. Threads that need you are bold.
|
||||||
- **Conversation:** built by the web app's timeline logic. Each finished turn's work folds into one line (`Worked for 3m 12s`), your messages are right-aligned, and a running turn shows its live step and `Working for 12s`.
|
- **Conversation:** built by the web app's timeline logic. Each finished turn's work folds into one line (`Worked for 3m 12s`), your messages are right-aligned, and a running turn shows its live step and `Working for 12s`.
|
||||||
|
- **Thread details:** a column beside the conversation with the workspace, model and mode, the branch with ahead/behind and its pull request, uncommitted changes per file, lineage (forks and subagents), background work and the goal. It opens by itself on terminals 160 columns or wider; on narrow ones `d` shows it in place of the conversation.
|
||||||
- **Read state:** opening a thread marks it read after a moment, as the web app does. Set `TUI3_NO_VISIT=1` to turn that off.
|
- **Read state:** opening a thread marks it read after a moment, as the web app does. Set `TUI3_NO_VISIT=1` to turn that off.
|
||||||
|
|
||||||
Long threads load as a bounded window of recent turns; press `o` for older ones. If the connection drops, tui3 reconnects with backoff and resubscribes.
|
Long threads load as a bounded window of recent turns; press `o` for older ones. If the connection drops, tui3 reconnects with backoff and resubscribes.
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import {
|
|||||||
type ProviderApprovalDecision,
|
type ProviderApprovalDecision,
|
||||||
type RuntimeRequestId,
|
type RuntimeRequestId,
|
||||||
type ThreadId,
|
type ThreadId,
|
||||||
|
type VcsStatusLocalResult,
|
||||||
|
type VcsStatusRemoteResult,
|
||||||
|
WS_METHODS,
|
||||||
} from "@t3tools/contracts";
|
} from "@t3tools/contracts";
|
||||||
import { applyOrchestrationV2ProjectionEvent } from "@t3tools/client-runtime/state/orchestration-v2-projection";
|
import { applyOrchestrationV2ProjectionEvent } from "@t3tools/client-runtime/state/orchestration-v2-projection";
|
||||||
import { mergeOlderHistoryIntoProjection } from "@t3tools/client-runtime/state/thread-history-merge";
|
import { mergeOlderHistoryIntoProjection } from "@t3tools/client-runtime/state/thread-history-merge";
|
||||||
@@ -55,6 +58,14 @@ export interface ThreadState {
|
|||||||
readonly error?: string;
|
readonly error?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Git status of a working directory, as the server's status stream reports it. */
|
||||||
|
export interface VcsState {
|
||||||
|
readonly status: "loading" | "live" | "error";
|
||||||
|
readonly local: VcsStatusLocalResult | null;
|
||||||
|
readonly remote: VcsStatusRemoteResult | null;
|
||||||
|
readonly error?: string;
|
||||||
|
}
|
||||||
|
|
||||||
type Listener<T> = (value: T) => void;
|
type Listener<T> = (value: T) => void;
|
||||||
|
|
||||||
/** Streaming deltas arrive far faster than a terminal can usefully redraw. */
|
/** Streaming deltas arrive far faster than a terminal can usefully redraw. */
|
||||||
@@ -74,6 +85,13 @@ export function debugLog(message: string): void {
|
|||||||
|
|
||||||
const decodeHistoryPage = Schema.decodeUnknownSync(Schema.toCodecJson(OrchestrationV2ThreadHistoryPage));
|
const decodeHistoryPage = Schema.decodeUnknownSync(Schema.toCodecJson(OrchestrationV2ThreadHistoryPage));
|
||||||
|
|
||||||
|
interface VcsEntry {
|
||||||
|
state: VcsState;
|
||||||
|
readonly listeners: Set<Listener<VcsState>>;
|
||||||
|
fiber: Fiber.Fiber<unknown, unknown> | null;
|
||||||
|
lingerTimer: ReturnType<typeof setTimeout> | null;
|
||||||
|
}
|
||||||
|
|
||||||
interface ThreadEntry {
|
interface ThreadEntry {
|
||||||
state: ThreadState;
|
state: ThreadState;
|
||||||
readonly listeners: Set<Listener<ThreadState>>;
|
readonly listeners: Set<Listener<ThreadState>>;
|
||||||
@@ -97,6 +115,7 @@ export class T3Session {
|
|||||||
private shell: ShellState = { status: { type: "connecting" }, snapshot: null, serverUrl: null };
|
private shell: ShellState = { status: { type: "connecting" }, snapshot: null, serverUrl: null };
|
||||||
private readonly shellListeners = new Set<Listener<ShellState>>();
|
private readonly shellListeners = new Set<Listener<ShellState>>();
|
||||||
private readonly threads = new Map<ThreadId, ThreadEntry>();
|
private readonly threads = new Map<ThreadId, ThreadEntry>();
|
||||||
|
private readonly vcs = new Map<string, VcsEntry>();
|
||||||
|
|
||||||
async start(): Promise<void> {
|
async start(): Promise<void> {
|
||||||
const scope = Effect.runSync(Scope.make());
|
const scope = Effect.runSync(Scope.make());
|
||||||
@@ -114,6 +133,7 @@ export class T3Session {
|
|||||||
this.setShell({ serverUrl: this.connection.target.httpBaseUrl });
|
this.setShell({ serverUrl: this.connection.target.httpBaseUrl });
|
||||||
this.runInScope(this.shellStream());
|
this.runInScope(this.shellStream());
|
||||||
for (const [threadId, entry] of this.threads) entry.fiber = this.runInScope(this.threadStream(threadId));
|
for (const [threadId, entry] of this.threads) entry.fiber = this.runInScope(this.threadStream(threadId));
|
||||||
|
for (const [cwd, entry] of this.vcs) entry.fiber = this.runInScope(this.vcsStream(cwd));
|
||||||
}
|
}
|
||||||
|
|
||||||
async stop(): Promise<void> {
|
async stop(): Promise<void> {
|
||||||
@@ -162,6 +182,30 @@ export class T3Session {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Subscribes to a working directory's git status: branch, changes, and the remote's ahead/behind and PR. */
|
||||||
|
watchVcs(cwd: string, listener: Listener<VcsState>): () => void {
|
||||||
|
let entry = this.vcs.get(cwd);
|
||||||
|
if (!entry) {
|
||||||
|
entry = { state: { status: "loading", local: null, remote: null }, listeners: new Set(), fiber: null, lingerTimer: null };
|
||||||
|
this.vcs.set(cwd, entry);
|
||||||
|
if (this.connection) entry.fiber = this.runInScope(this.vcsStream(cwd));
|
||||||
|
}
|
||||||
|
if (entry.lingerTimer) clearTimeout(entry.lingerTimer);
|
||||||
|
entry.lingerTimer = null;
|
||||||
|
entry.listeners.add(listener);
|
||||||
|
listener(entry.state);
|
||||||
|
const watched = entry;
|
||||||
|
return () => {
|
||||||
|
watched.listeners.delete(listener);
|
||||||
|
if (watched.listeners.size > 0) return;
|
||||||
|
watched.lingerTimer = setTimeout(() => {
|
||||||
|
if (watched.listeners.size > 0 || this.vcs.get(cwd) !== watched) return;
|
||||||
|
this.vcs.delete(cwd);
|
||||||
|
if (watched.fiber) Effect.runFork(Fiber.interrupt(watched.fiber));
|
||||||
|
}, THREAD_LINGER_MS);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/** Fetches the next page of older turns and prepends it. Resolves false when there was nothing to load. */
|
/** Fetches the next page of older turns and prepends it. Resolves false when there was nothing to load. */
|
||||||
async loadEarlier(threadId: ThreadId): Promise<boolean> {
|
async loadEarlier(threadId: ThreadId): Promise<boolean> {
|
||||||
const entry = this.threads.get(threadId);
|
const entry = this.threads.get(threadId);
|
||||||
@@ -309,6 +353,37 @@ export class T3Session {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private vcsStream(cwd: string) {
|
||||||
|
const rpc = this.requireConnection().rpc;
|
||||||
|
return rpc[WS_METHODS.subscribeVcsStatus]({ cwd, includeRemote: true }).pipe(
|
||||||
|
Stream.runForEach((event) =>
|
||||||
|
Effect.sync(() => {
|
||||||
|
switch (event._tag) {
|
||||||
|
case "snapshot":
|
||||||
|
return this.setVcs(cwd, { status: "live", local: event.local, remote: event.remote });
|
||||||
|
case "localUpdated":
|
||||||
|
return this.setVcs(cwd, { status: "live", local: event.local });
|
||||||
|
case "remoteUpdated":
|
||||||
|
return this.setVcs(cwd, { remote: event.remote });
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
Effect.catchCause((cause) =>
|
||||||
|
Effect.sync(() => {
|
||||||
|
const message = prettyCause(cause);
|
||||||
|
if (!isSocketFailure(message)) this.setVcs(cwd, { status: "error", error: message });
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private setVcs(cwd: string, patch: Partial<VcsState>): void {
|
||||||
|
const entry = this.vcs.get(cwd);
|
||||||
|
if (!entry) return;
|
||||||
|
entry.state = { ...entry.state, ...patch };
|
||||||
|
for (const listener of entry.listeners) listener(entry.state);
|
||||||
|
}
|
||||||
|
|
||||||
private connectionLost(message: string): void {
|
private connectionLost(message: string): void {
|
||||||
if (this.stopped || this.recovering) return;
|
if (this.stopped || this.recovering) return;
|
||||||
this.recovering = true;
|
this.recovering = true;
|
||||||
@@ -332,6 +407,7 @@ export class T3Session {
|
|||||||
this.scope = null;
|
this.scope = null;
|
||||||
this.connection = null;
|
this.connection = null;
|
||||||
for (const entry of this.threads.values()) entry.fiber = null;
|
for (const entry of this.threads.values()) entry.fiber = null;
|
||||||
|
for (const entry of this.vcs.values()) entry.fiber = null;
|
||||||
if (scope) await Effect.runPromise(Scope.close(scope, Exit.void));
|
if (scope) await Effect.runPromise(Scope.close(scope, Exit.void));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,158 @@
|
|||||||
|
import type { OrchestrationProjectShell, OrchestrationV2ShellSnapshot, OrchestrationV2ThreadShell } from "@t3tools/contracts";
|
||||||
|
import { formatWorkingDurationLabel } from "@t3tools/client-runtime/state/models";
|
||||||
|
import { homedir } from "node:os";
|
||||||
|
|
||||||
|
import type { VcsState } from "../client/session.ts";
|
||||||
|
import type { StatusTone } from "./threads.ts";
|
||||||
|
|
||||||
|
/** The web's thread details card, reduced to what a terminal column can show. Sections with nothing to say are left out. */
|
||||||
|
export interface ThreadDetails {
|
||||||
|
readonly workspace: {
|
||||||
|
readonly path: string;
|
||||||
|
readonly worktree: boolean;
|
||||||
|
readonly model: string;
|
||||||
|
readonly mode: string | null;
|
||||||
|
};
|
||||||
|
readonly branch: {
|
||||||
|
readonly name: string;
|
||||||
|
readonly upstream: string | null;
|
||||||
|
readonly pullRequest: PullRequestLine | null;
|
||||||
|
} | null;
|
||||||
|
readonly changes: {
|
||||||
|
readonly insertions: number;
|
||||||
|
readonly deletions: number;
|
||||||
|
readonly files: readonly { readonly path: string; readonly insertions: number; readonly deletions: number }[];
|
||||||
|
/** The branch's total against its base, when it differs from the working tree's. */
|
||||||
|
readonly branchTotal: { readonly baseRef: string | null; readonly insertions: number; readonly deletions: number } | null;
|
||||||
|
} | null;
|
||||||
|
readonly lineage: readonly { readonly glyph: string; readonly text: string }[];
|
||||||
|
readonly background: readonly { readonly glyph: string; readonly text: string }[];
|
||||||
|
readonly goal: { readonly objective: string; readonly status: string; readonly tone: StatusTone } | null;
|
||||||
|
/** Git status failed, or the folder isn't a repository. */
|
||||||
|
readonly vcsNote: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PullRequestLine {
|
||||||
|
readonly number: number;
|
||||||
|
readonly title: string | null;
|
||||||
|
readonly state: string;
|
||||||
|
readonly tone: StatusTone;
|
||||||
|
readonly checks: { readonly text: string; readonly tone: StatusTone } | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const RUNTIME_MODE_LABELS: Record<string, string> = {
|
||||||
|
"approval-required": "Supervised",
|
||||||
|
"auto-accept-edits": "Auto-accept edits",
|
||||||
|
auto: "Auto",
|
||||||
|
"full-access": "Full access",
|
||||||
|
};
|
||||||
|
|
||||||
|
/** The folder git runs in: the thread's worktree, else its project's root. */
|
||||||
|
export function detailsCwd(thread: OrchestrationV2ThreadShell, project: OrchestrationProjectShell | undefined): string | null {
|
||||||
|
return thread.worktreePath ?? project?.workspaceRoot ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function threadDetails(
|
||||||
|
thread: OrchestrationV2ThreadShell,
|
||||||
|
project: OrchestrationProjectShell | undefined,
|
||||||
|
vcs: VcsState | null,
|
||||||
|
snapshot: OrchestrationV2ShellSnapshot | null,
|
||||||
|
): ThreadDetails {
|
||||||
|
const local = vcs?.local?.isRepo ? vcs.local : null;
|
||||||
|
const remote = local ? (vcs?.remote ?? null) : null;
|
||||||
|
const path = detailsCwd(thread, project) ?? "";
|
||||||
|
const model = thread.modelSelection.model === "default" ? "Default model" : thread.modelSelection.model;
|
||||||
|
const mode = [thread.interactionMode === "plan" ? "Plan" : "Build", RUNTIME_MODE_LABELS[thread.runtimeMode] ?? thread.runtimeMode].join(" · ");
|
||||||
|
|
||||||
|
const branchName = local?.refName ?? thread.branch;
|
||||||
|
const branch = branchName
|
||||||
|
? {
|
||||||
|
name: branchName,
|
||||||
|
upstream: remote ? (remote.hasUpstream ? `↑${remote.aheadCount} ↓${remote.behindCount}` : local?.hasPrimaryRemote ? "not pushed" : null) : null,
|
||||||
|
pullRequest: pullRequestLine(thread, remote),
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const tree = local?.workingTree;
|
||||||
|
const branchChanges = local?.branchChanges;
|
||||||
|
const changes =
|
||||||
|
tree && (tree.files.length > 0 || (branchChanges && branchChanges.insertions + branchChanges.deletions > 0))
|
||||||
|
? {
|
||||||
|
insertions: tree.insertions,
|
||||||
|
deletions: tree.deletions,
|
||||||
|
files: tree.files,
|
||||||
|
branchTotal:
|
||||||
|
branchChanges && !local?.isDefaultRef && (branchChanges.insertions !== tree.insertions || branchChanges.deletions !== tree.deletions)
|
||||||
|
? { baseRef: branchChanges.baseRef, insertions: branchChanges.insertions, deletions: branchChanges.deletions }
|
||||||
|
: null,
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const threads = snapshot?.threads ?? [];
|
||||||
|
const titleOf = (id: string) => threads.find((other) => other.id === id)?.title ?? "another thread";
|
||||||
|
const lineage: { glyph: string; text: string }[] = [];
|
||||||
|
const parentId = thread.lineage.parentThreadId ?? (thread.forkedFrom?.type === "run" ? thread.forkedFrom.threadId : null);
|
||||||
|
if (parentId) lineage.push({ glyph: "↰", text: `${thread.lineage.relationshipToParent === "subagent" ? "subagent of" : "forked from"} ${quote(titleOf(parentId))}` });
|
||||||
|
const forks = threads.filter((other) => other.lineage.parentThreadId === thread.id && other.lineage.relationshipToParent === "fork" && other.deletedAt === null);
|
||||||
|
if (forks.length > 0) lineage.push({ glyph: "↳", text: forks.length === 1 ? `forked into ${quote(forks[0]!.title)}` : `${forks.length} forks` });
|
||||||
|
const subagents = threads.filter((other) => other.lineage.parentThreadId === thread.id && other.lineage.relationshipToParent === "subagent");
|
||||||
|
const runningSubagents = (thread.pendingBackgroundTasks ?? []).filter((task) => task.kind === "subagent").length;
|
||||||
|
// Idle subagents are left out of the shell, so the running count can exceed what's listed.
|
||||||
|
const subagentCount = Math.max(subagents.length, runningSubagents);
|
||||||
|
if (subagentCount > 0) lineage.push({ glyph: "↳", text: `${plural(subagentCount, "subagent")}${runningSubagents > 0 ? ` (${runningSubagents} running)` : ""}` });
|
||||||
|
|
||||||
|
const background = (thread.pendingBackgroundTasks ?? [])
|
||||||
|
.filter((task) => task.kind !== "subagent")
|
||||||
|
.map((task) => ({ glyph: task.kind === "monitor" ? "◎" : "◐", text: task.description ?? task.kind.replace("_", " ") }));
|
||||||
|
|
||||||
|
const goal = thread.goal
|
||||||
|
? {
|
||||||
|
objective: thread.goal.objective,
|
||||||
|
status: [thread.goal.status.replace("_", " "), thread.goal.timeUsedSeconds ? formatWorkingDurationLabel(thread.goal.timeUsedSeconds * 1000) : ""].filter(Boolean).join(" · "),
|
||||||
|
tone: (thread.goal.status === "active" ? "info" : thread.goal.status === "complete" ? "good" : thread.goal.status === "paused" ? "muted" : "warn") as StatusTone,
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const vcsNote = vcs?.status === "error" ? "Git status unavailable" : vcs?.local && !vcs.local.isRepo ? "Not a git repository" : null;
|
||||||
|
return { workspace: { path: tildify(path), worktree: thread.worktreePath !== null && project !== undefined && thread.worktreePath !== project.workspaceRoot, model, mode }, branch, changes, lineage, background, goal, vcsNote };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The remote's PR for the branch, else the newest PR the thread linked. */
|
||||||
|
function pullRequestLine(thread: OrchestrationV2ThreadShell, remote: VcsState["remote"]): PullRequestLine | null {
|
||||||
|
if (remote?.pr) {
|
||||||
|
const pr = remote.pr;
|
||||||
|
return { number: pr.number, title: pr.title, ...prState(pr.state, pr.isDraft === true), checks: null };
|
||||||
|
}
|
||||||
|
const link = (thread.pullRequests ?? []).filter((candidate) => candidate.source !== "stack-dismissed").at(-1);
|
||||||
|
if (link) {
|
||||||
|
const snapshot = link.snapshot;
|
||||||
|
return {
|
||||||
|
number: link.number,
|
||||||
|
title: snapshot?.title ?? null,
|
||||||
|
...(snapshot ? prState(snapshot.state, snapshot.isDraft) : { state: "linked", tone: "muted" as StatusTone }),
|
||||||
|
checks: snapshot?.checksState ? (CHECKS[snapshot.checksState] ?? null) : null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const linked = thread.linkedPullRequest ?? thread.branchPullRequest;
|
||||||
|
return linked ? { number: linked.number, title: null, state: "linked", tone: "muted", checks: null } : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CHECKS: Record<string, { text: string; tone: StatusTone }> = {
|
||||||
|
passing: { text: "✓ checks", tone: "good" },
|
||||||
|
failing: { text: "✕ checks", tone: "bad" },
|
||||||
|
pending: { text: "◐ checks", tone: "warn" },
|
||||||
|
};
|
||||||
|
|
||||||
|
function prState(state: string, draft: boolean): { state: string; tone: StatusTone } {
|
||||||
|
if (state === "open") return draft ? { state: "draft", tone: "muted" } : { state: "open", tone: "good" };
|
||||||
|
if (state === "merged") return { state: "merged", tone: "input" };
|
||||||
|
return { state, tone: "muted" };
|
||||||
|
}
|
||||||
|
|
||||||
|
function tildify(path: string): string {
|
||||||
|
const home = homedir();
|
||||||
|
return path === home || path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path;
|
||||||
|
}
|
||||||
|
|
||||||
|
const quote = (text: string) => `"${text || "New thread"}"`;
|
||||||
|
const plural = (count: number, noun: string) => `${count} ${noun}${count === 1 ? "" : "s"}`;
|
||||||
+35
-9
@@ -11,10 +11,12 @@ import {
|
|||||||
import type { ProviderApprovalDecision, ThreadId } from "@t3tools/contracts";
|
import type { ProviderApprovalDecision, ThreadId } from "@t3tools/contracts";
|
||||||
import { useEffect, useMemo, useRef, useState } from "react";
|
import { useEffect, useMemo, useRef, useState } from "react";
|
||||||
|
|
||||||
import type { ShellState, T3Session, ThreadState } from "../client/session.ts";
|
import type { ShellState, T3Session, ThreadState, VcsState } from "../client/session.ts";
|
||||||
|
import { detailsCwd, RUNTIME_MODE_LABELS, threadDetails } from "../model/details.ts";
|
||||||
import { buildTimeline, type Timeline } from "../model/timeline.ts";
|
import { buildTimeline, type Timeline } from "../model/timeline.ts";
|
||||||
import { threadRows, type Section } from "../model/threads.ts";
|
import { threadRows, type Section } from "../model/threads.ts";
|
||||||
import { QuestionPanel } from "./QuestionPanel.tsx";
|
import { QuestionPanel } from "./QuestionPanel.tsx";
|
||||||
|
import { DetailsPanel } from "./DetailsPanel.tsx";
|
||||||
import { colors } from "./theme.ts";
|
import { colors } from "./theme.ts";
|
||||||
import { ThreadList } from "./ThreadList.tsx";
|
import { ThreadList } from "./ThreadList.tsx";
|
||||||
import { ThreadView } from "./ThreadView.tsx";
|
import { ThreadView } from "./ThreadView.tsx";
|
||||||
@@ -36,12 +38,11 @@ const COMPOSER_KEYS = [
|
|||||||
{ name: "j", ctrl: true, action: "newline" },
|
{ name: "j", ctrl: true, action: "newline" },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
const RUNTIME_MODE_LABELS: Record<string, string> = {
|
/** The details column opens by itself on terminals at least this wide. */
|
||||||
"approval-required": "Supervised",
|
const DETAILS_AUTO_WIDTH = 160;
|
||||||
"auto-accept-edits": "Auto-accept edits",
|
const DETAILS_WIDTH = 36;
|
||||||
auto: "Auto",
|
/** Below this, the details panel takes the conversation's place instead of a column beside it. */
|
||||||
"full-access": "Full access",
|
const MIN_CONVERSATION_WIDTH = 70;
|
||||||
};
|
|
||||||
|
|
||||||
interface QuestionDraft {
|
interface QuestionDraft {
|
||||||
readonly index: number;
|
readonly index: number;
|
||||||
@@ -58,6 +59,8 @@ export function App(props: { readonly session: T3Session; readonly attachThreadI
|
|||||||
const [filter, setFilter] = useState("");
|
const [filter, setFilter] = useState("");
|
||||||
const [showFolded, setShowFolded] = useState(false);
|
const [showFolded, setShowFolded] = useState(false);
|
||||||
const [expandAll, setExpandAll] = useState(false);
|
const [expandAll, setExpandAll] = useState(false);
|
||||||
|
/** null follows the terminal width; d sets it for the rest of the session. */
|
||||||
|
const [detailsPref, setDetailsPref] = useState<boolean | null>(null);
|
||||||
const [flash, setFlash] = useState<{ text: string; bad?: boolean } | null>(null);
|
const [flash, setFlash] = useState<{ text: string; bad?: boolean } | null>(null);
|
||||||
const [composerLines, setComposerLines] = useState(1);
|
const [composerLines, setComposerLines] = useState(1);
|
||||||
const [composerEmpty, setComposerEmpty] = useState(true);
|
const [composerEmpty, setComposerEmpty] = useState(true);
|
||||||
@@ -116,6 +119,20 @@ export function App(props: { readonly session: T3Session; readonly attachThreadI
|
|||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, [session, watchedId, unread]);
|
}, [session, watchedId, unread]);
|
||||||
|
|
||||||
|
const showDetails = detailsPref ?? width >= DETAILS_AUTO_WIDTH;
|
||||||
|
const project = threadShell ? shell.snapshot?.projects.find((candidate) => candidate.id === threadShell.projectId) : undefined;
|
||||||
|
const vcsCwd = threadShell ? detailsCwd(threadShell, project) : null;
|
||||||
|
const [vcs, setVcs] = useState<{ cwd: string; state: VcsState } | null>(null);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!showDetails || !vcsCwd || shell.status.type !== "live") return;
|
||||||
|
return session.watchVcs(vcsCwd, (state) => setVcs({ cwd: vcsCwd, state }));
|
||||||
|
}, [session, showDetails, vcsCwd, shell.status.type]);
|
||||||
|
const vcsState = vcs?.cwd === vcsCwd ? vcs.state : null;
|
||||||
|
const details = useMemo(
|
||||||
|
() => (showDetails && threadShell ? threadDetails(threadShell, project, vcsState, shell.snapshot) : null),
|
||||||
|
[showDetails, threadShell, project, vcsState, shell.snapshot],
|
||||||
|
);
|
||||||
|
|
||||||
const previousTimeline = useRef<{ id: string; timeline: Timeline } | null>(null);
|
const previousTimeline = useRef<{ id: string; timeline: Timeline } | null>(null);
|
||||||
const timeline = useMemo(() => {
|
const timeline = useMemo(() => {
|
||||||
if (!thread?.projection || !watchedId) return null;
|
if (!thread?.projection || !watchedId) return null;
|
||||||
@@ -254,6 +271,8 @@ export function App(props: { readonly session: T3Session; readonly attachThreadI
|
|||||||
return attachThreadId ? scroll?.scrollBy(-1) : move(-1);
|
return attachThreadId ? scroll?.scrollBy(-1) : move(-1);
|
||||||
case "g":
|
case "g":
|
||||||
return key.shift ? scroll?.scrollTo(scroll.scrollHeight) : scroll?.scrollTo(0);
|
return key.shift ? scroll?.scrollTo(scroll.scrollHeight) : scroll?.scrollTo(0);
|
||||||
|
case "d":
|
||||||
|
return setDetailsPref(!showDetails);
|
||||||
case "e":
|
case "e":
|
||||||
return setExpandAll((value) => !value);
|
return setExpandAll((value) => !value);
|
||||||
case "o":
|
case "o":
|
||||||
@@ -290,6 +309,8 @@ export function App(props: { readonly session: T3Session; readonly attachThreadI
|
|||||||
? "reconnecting…"
|
? "reconnecting…"
|
||||||
: (shell.serverUrl ?? "");
|
: (shell.serverUrl ?? "");
|
||||||
const listWidth = attachThreadId ? 0 : Math.min(46, Math.max(28, Math.floor(width * 0.3)));
|
const listWidth = attachThreadId ? 0 : Math.min(46, Math.max(28, Math.floor(width * 0.3)));
|
||||||
|
const detailsColumn = showDetails && width - listWidth - DETAILS_WIDTH >= MIN_CONVERSATION_WIDTH;
|
||||||
|
const detailsInPlace = showDetails && !detailsColumn;
|
||||||
const composerHeight = Math.min(MAX_COMPOSER_LINES, composerLines) + 2;
|
const composerHeight = Math.min(MAX_COMPOSER_LINES, composerLines) + 2;
|
||||||
const placeholder =
|
const placeholder =
|
||||||
mode !== "input"
|
mode !== "input"
|
||||||
@@ -326,7 +347,11 @@ export function App(props: { readonly session: T3Session; readonly attachThreadI
|
|||||||
<ThreadList rows={rows} collapsed={collapsed} selected={selectedIndex} focused={mode === "nav"} width={listWidth} height={height - 2} filter={filter} now={now} />
|
<ThreadList rows={rows} collapsed={collapsed} selected={selectedIndex} focused={mode === "nav"} width={listWidth} height={height - 2} filter={filter} now={now} />
|
||||||
)}
|
)}
|
||||||
<box flexDirection="column" flexGrow={1} minHeight={0}>
|
<box flexDirection="column" flexGrow={1} minHeight={0}>
|
||||||
{threadId ? (
|
{threadId && detailsInPlace ? (
|
||||||
|
<box flexGrow={1} minHeight={0} flexDirection="column">
|
||||||
|
<DetailsPanel details={details} width={width - listWidth} loading={vcsState?.status !== "live"} inPlace />
|
||||||
|
</box>
|
||||||
|
) : threadId ? (
|
||||||
<ThreadView
|
<ThreadView
|
||||||
project={threadRow?.projectName ?? ""}
|
project={threadRow?.projectName ?? ""}
|
||||||
title={threadShell?.title ?? "Thread"}
|
title={threadShell?.title ?? "Thread"}
|
||||||
@@ -387,6 +412,7 @@ export function App(props: { readonly session: T3Session; readonly attachThreadI
|
|||||||
</box>
|
</box>
|
||||||
) : null}
|
) : null}
|
||||||
</box>
|
</box>
|
||||||
|
{detailsColumn ? <DetailsPanel details={details} width={DETAILS_WIDTH} loading={vcsState?.status !== "live"} /> : null}
|
||||||
</box>
|
</box>
|
||||||
<box flexDirection="row" paddingLeft={2} height={1} flexShrink={0}>
|
<box flexDirection="row" paddingLeft={2} height={1} flexShrink={0}>
|
||||||
{flash ? (
|
{flash ? (
|
||||||
@@ -409,7 +435,7 @@ function hints(mode: Mode, state: { readonly approval: boolean; readonly questio
|
|||||||
return parts.join(" · ");
|
return parts.join(" · ");
|
||||||
}
|
}
|
||||||
const parts = state.attached ? ["j/k scroll"] : ["j/k threads", "/ filter", "z settled"];
|
const parts = state.attached ? ["j/k scroll"] : ["j/k threads", "/ filter", "z settled"];
|
||||||
parts.push("i type", "e expand", "o earlier", "S stop", "q quit");
|
parts.push("i type", "e expand", "o earlier", "d details", "S stop", "q quit");
|
||||||
if (state.question) parts.unshift("1-9 pick · x dismiss");
|
if (state.question) parts.unshift("1-9 pick · x dismiss");
|
||||||
if (state.approval) parts.unshift("y approve · Y always · n decline");
|
if (state.approval) parts.unshift("y approve · Y always · n decline");
|
||||||
return parts.join(" · ");
|
return parts.join(" · ");
|
||||||
|
|||||||
@@ -0,0 +1,159 @@
|
|||||||
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
|
import type { ThreadDetails } from "../model/details.ts";
|
||||||
|
import { colors, statusColor } from "./theme.ts";
|
||||||
|
|
||||||
|
/** Files listed under Changes before the rest fold into a count. */
|
||||||
|
const MAX_FILES = 8;
|
||||||
|
/** Rows stay readable when the panel takes the conversation's place on a narrow terminal. */
|
||||||
|
const IN_PLACE_MAX_WIDTH = 64;
|
||||||
|
|
||||||
|
/** The web's thread details card as a right-hand column: workspace, branch and PR, changes, lineage, background work, goal. */
|
||||||
|
export function DetailsPanel(props: { readonly details: ThreadDetails | null; readonly width: number; readonly loading: boolean; readonly inPlace?: boolean }) {
|
||||||
|
const { details } = props;
|
||||||
|
// In place of the conversation it sits beside the thread list's border and needs none of its own.
|
||||||
|
const width = props.inPlace ? Math.min(props.width, IN_PLACE_MAX_WIDTH) : props.width;
|
||||||
|
const inner = Math.max(10, width - (props.inPlace ? 3 : 4));
|
||||||
|
return (
|
||||||
|
<box {...(props.inPlace ? {} : { border: ["left"] as const, borderColor: colors.border })} width={width} flexShrink={0} flexDirection="column" paddingLeft={1} paddingRight={1} overflow="hidden">
|
||||||
|
{!details ? <text fg={colors.faint}>No thread selected.</text> : <Sections details={details} inner={inner} loading={props.loading} />}
|
||||||
|
</box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Sections({ details, inner, loading }: { readonly details: ThreadDetails; readonly inner: number; readonly loading: boolean }) {
|
||||||
|
const { workspace, branch, changes } = details;
|
||||||
|
const files = changes?.files ?? [];
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Section title="Workspace" first>
|
||||||
|
<text fg={colors.text}>{startTruncate(workspace.path, inner)}</text>
|
||||||
|
{workspace.worktree ? <text fg={colors.faint}>worktree</text> : null}
|
||||||
|
<text fg={colors.muted}>{truncate(workspace.model, inner)}</text>
|
||||||
|
{workspace.mode ? <text fg={colors.muted}>{truncate(workspace.mode, inner)}</text> : null}
|
||||||
|
</Section>
|
||||||
|
|
||||||
|
{branch ? (
|
||||||
|
<Section title="Branch">
|
||||||
|
<Line left={truncate(branch.name, inner - (branch.upstream?.length ?? 0) - 1)} right={branch.upstream ?? ""} />
|
||||||
|
{branch.pullRequest ? (
|
||||||
|
<>
|
||||||
|
<box flexDirection="row">
|
||||||
|
<text fg={colors.text}>{`PR #${branch.pullRequest.number} `}</text>
|
||||||
|
<text fg={statusColor[branch.pullRequest.tone]}>{branch.pullRequest.state}</text>
|
||||||
|
<box flexGrow={1} />
|
||||||
|
{branch.pullRequest.checks ? <text fg={statusColor[branch.pullRequest.checks.tone]}>{branch.pullRequest.checks.text}</text> : null}
|
||||||
|
</box>
|
||||||
|
{branch.pullRequest.title ? <text fg={colors.muted}>{truncate(branch.pullRequest.title, inner)}</text> : null}
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</Section>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{changes ? (
|
||||||
|
<Section title="Changes" right={<Counts insertions={changes.insertions} deletions={changes.deletions} />}>
|
||||||
|
{files.slice(0, MAX_FILES).map((file) => (
|
||||||
|
<FileLine key={file.path} path={file.path} insertions={file.insertions} deletions={file.deletions} inner={inner} />
|
||||||
|
))}
|
||||||
|
{files.length > MAX_FILES ? <text fg={colors.faint}>{`… ${files.length - MAX_FILES} more files`}</text> : null}
|
||||||
|
{files.length === 0 ? <text fg={colors.faint}>Working tree clean</text> : null}
|
||||||
|
{changes.branchTotal ? (
|
||||||
|
<box flexDirection="row">
|
||||||
|
<text fg={colors.faint}>{truncate(`branch vs ${changes.branchTotal.baseRef ?? "base"} `, inner - 12)}</text>
|
||||||
|
<box flexGrow={1} />
|
||||||
|
<Counts insertions={changes.branchTotal.insertions} deletions={changes.branchTotal.deletions} />
|
||||||
|
</box>
|
||||||
|
) : null}
|
||||||
|
</Section>
|
||||||
|
) : loading ? (
|
||||||
|
<Section title="Changes">
|
||||||
|
<text fg={colors.faint}>Loading…</text>
|
||||||
|
</Section>
|
||||||
|
) : null}
|
||||||
|
{details.vcsNote ? <text fg={colors.faint} marginTop={1}>{details.vcsNote}</text> : null}
|
||||||
|
|
||||||
|
{details.lineage.length > 0 ? (
|
||||||
|
<Section title="Lineage">
|
||||||
|
{details.lineage.map((entry) => (
|
||||||
|
<text key={entry.text} fg={colors.muted}>{truncate(`${entry.glyph} ${entry.text}`, inner)}</text>
|
||||||
|
))}
|
||||||
|
</Section>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{details.background.length > 0 ? (
|
||||||
|
<Section title="Background">
|
||||||
|
{details.background.map((task, index) => (
|
||||||
|
<text key={index} fg={colors.info}>{truncate(`${task.glyph} ${task.text}`, inner)}</text>
|
||||||
|
))}
|
||||||
|
</Section>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{details.goal ? (
|
||||||
|
<Section title="Goal">
|
||||||
|
<text fg={colors.text}>{details.goal.objective}</text>
|
||||||
|
<text fg={statusColor[details.goal.tone]}>{details.goal.status}</text>
|
||||||
|
</Section>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Section(props: { readonly title: string; readonly right?: ReactNode; readonly first?: boolean; readonly children: ReactNode }) {
|
||||||
|
return (
|
||||||
|
<box flexDirection="column" marginTop={props.first ? 0 : 1} flexShrink={0}>
|
||||||
|
<box flexDirection="row">
|
||||||
|
<text fg={colors.muted}>
|
||||||
|
<strong>{props.title}</strong>
|
||||||
|
</text>
|
||||||
|
<box flexGrow={1} />
|
||||||
|
{props.right ?? null}
|
||||||
|
</box>
|
||||||
|
{props.children}
|
||||||
|
</box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Line({ left, right }: { readonly left: string; readonly right: string }) {
|
||||||
|
return (
|
||||||
|
<box flexDirection="row">
|
||||||
|
<text fg={colors.text}>{left}</text>
|
||||||
|
<box flexGrow={1} />
|
||||||
|
<text fg={colors.faint}>{right}</text>
|
||||||
|
</box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function FileLine(props: { readonly path: string; readonly insertions: number; readonly deletions: number; readonly inner: number }) {
|
||||||
|
const counts = countsText(props.insertions, props.deletions);
|
||||||
|
return (
|
||||||
|
<box flexDirection="row">
|
||||||
|
<text fg={colors.muted}>{startTruncate(props.path, Math.max(4, props.inner - counts.length - 1))}</text>
|
||||||
|
<box flexGrow={1} />
|
||||||
|
<Counts insertions={props.insertions} deletions={props.deletions} />
|
||||||
|
</box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Counts({ insertions, deletions }: { readonly insertions: number; readonly deletions: number }) {
|
||||||
|
return (
|
||||||
|
<box flexDirection="row">
|
||||||
|
{insertions > 0 ? <text fg={colors.good}>{`+${insertions}`}</text> : null}
|
||||||
|
{insertions > 0 && deletions > 0 ? <text> </text> : null}
|
||||||
|
{deletions > 0 ? <text fg={colors.bad}>{`−${deletions}`}</text> : null}
|
||||||
|
</box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function countsText(insertions: number, deletions: number): string {
|
||||||
|
return [insertions > 0 ? `+${insertions}` : "", deletions > 0 ? `−${deletions}` : ""].filter(Boolean).join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
function truncate(text: string, width: number): string {
|
||||||
|
const single = text.replace(/\s+/g, " ");
|
||||||
|
return single.length > width ? `${single.slice(0, Math.max(0, width - 1))}…` : single;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Keeps the end of a path, where the file name is, as the web's StartTruncatedPath does. */
|
||||||
|
function startTruncate(text: string, width: number): string {
|
||||||
|
return text.length > width ? `…${text.slice(text.length - width + 1)}` : text;
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
import { describe, expect, test } from "bun:test";
|
||||||
|
import type { OrchestrationProjectShell, OrchestrationV2ShellSnapshot, OrchestrationV2ThreadShell } from "@t3tools/contracts";
|
||||||
|
|
||||||
|
import type { VcsState } from "../src/client/session.ts";
|
||||||
|
import { detailsCwd, threadDetails } from "../src/model/details.ts";
|
||||||
|
|
||||||
|
const project = { id: "p1", title: "tasknotes", workspaceRoot: "/repo/tasknotes" } as unknown as OrchestrationProjectShell;
|
||||||
|
const thread = (extra: Record<string, unknown> = {}) =>
|
||||||
|
({
|
||||||
|
id: "t1",
|
||||||
|
title: "Fix sync",
|
||||||
|
projectId: "p1",
|
||||||
|
branch: "feat/sync",
|
||||||
|
worktreePath: "/repo/tasknotes-wt/sync",
|
||||||
|
modelSelection: { instanceId: "codex", model: "gpt-5" },
|
||||||
|
interactionMode: "default",
|
||||||
|
runtimeMode: "approval-required",
|
||||||
|
lineage: { parentThreadId: null, relationshipToParent: null, rootThreadId: "t1" },
|
||||||
|
forkedFrom: null,
|
||||||
|
pendingBackgroundTasks: [],
|
||||||
|
goal: null,
|
||||||
|
deletedAt: null,
|
||||||
|
...extra,
|
||||||
|
}) as unknown as OrchestrationV2ThreadShell;
|
||||||
|
|
||||||
|
const vcs = (local: Record<string, unknown>, remote: Record<string, unknown> | null = null): VcsState =>
|
||||||
|
({
|
||||||
|
status: "live",
|
||||||
|
local: {
|
||||||
|
isRepo: true,
|
||||||
|
hasPrimaryRemote: true,
|
||||||
|
isDefaultRef: false,
|
||||||
|
refName: "feat/sync",
|
||||||
|
hasWorkingTreeChanges: true,
|
||||||
|
workingTree: { files: [], insertions: 0, deletions: 0 },
|
||||||
|
...local,
|
||||||
|
},
|
||||||
|
remote,
|
||||||
|
}) as unknown as VcsState;
|
||||||
|
|
||||||
|
describe("threadDetails", () => {
|
||||||
|
test("runs git in the worktree and labels the workspace", () => {
|
||||||
|
const details = threadDetails(thread(), project, null, null);
|
||||||
|
expect(detailsCwd(thread(), project)).toBe("/repo/tasknotes-wt/sync");
|
||||||
|
expect(detailsCwd(thread({ worktreePath: null }), project)).toBe("/repo/tasknotes");
|
||||||
|
expect(details.workspace).toEqual({ path: "/repo/tasknotes-wt/sync", worktree: true, model: "gpt-5", mode: "Build · Supervised" });
|
||||||
|
// Before git status arrives, the branch comes from the thread.
|
||||||
|
expect(details.branch?.name).toBe("feat/sync");
|
||||||
|
expect(details.changes).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("shows changes, ahead/behind and the remote's PR", () => {
|
||||||
|
const details = threadDetails(
|
||||||
|
thread(),
|
||||||
|
project,
|
||||||
|
vcs(
|
||||||
|
{
|
||||||
|
workingTree: { files: [{ path: "src/a.ts", insertions: 3, deletions: 1 }], insertions: 3, deletions: 1 },
|
||||||
|
branchChanges: { baseRef: "main", insertions: 40, deletions: 2 },
|
||||||
|
},
|
||||||
|
{ hasUpstream: true, aheadCount: 2, behindCount: 0, pr: { number: 41, title: "Fix sync", url: "u", baseRef: "main", headRef: "feat/sync", state: "open", isDraft: false } },
|
||||||
|
),
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
expect(details.branch).toEqual({ name: "feat/sync", upstream: "↑2 ↓0", pullRequest: { number: 41, title: "Fix sync", state: "open", tone: "good", checks: null } });
|
||||||
|
expect(details.changes?.files).toHaveLength(1);
|
||||||
|
expect(details.changes?.branchTotal).toEqual({ baseRef: "main", insertions: 40, deletions: 2 });
|
||||||
|
});
|
||||||
|
|
||||||
|
test("falls back to the thread's linked PR, with its checks", () => {
|
||||||
|
const pullRequests = [
|
||||||
|
{ host: "github.com", repository: "o/r", number: 7, url: "u", source: "created", linkedAt: "2026-01-01T00:00:00Z", stack: null, snapshot: { state: "open", title: "Seven", headBranch: "x", baseBranch: "main", isDraft: true, updatedAt: null, syncedAt: "2026-01-01T00:00:00Z", checksState: "failing" } },
|
||||||
|
];
|
||||||
|
const details = threadDetails(thread({ pullRequests }), project, vcs({}, { hasUpstream: false, aheadCount: 0, behindCount: 0, pr: null }), null);
|
||||||
|
expect(details.branch?.upstream).toBe("not pushed");
|
||||||
|
expect(details.branch?.pullRequest).toEqual({ number: 7, title: "Seven", state: "draft", tone: "muted", checks: { text: "✕ checks", tone: "bad" } });
|
||||||
|
});
|
||||||
|
|
||||||
|
test("lists lineage, background work and the goal", () => {
|
||||||
|
const snapshot = {
|
||||||
|
threads: [
|
||||||
|
{ id: "parent", title: "Plan sync", lineage: { parentThreadId: null, relationshipToParent: null }, deletedAt: null },
|
||||||
|
{ id: "fork", title: "Try another way", lineage: { parentThreadId: "t1", relationshipToParent: "fork" }, deletedAt: null },
|
||||||
|
],
|
||||||
|
} as unknown as OrchestrationV2ShellSnapshot;
|
||||||
|
const details = threadDetails(
|
||||||
|
thread({
|
||||||
|
lineage: { parentThreadId: "parent", relationshipToParent: "fork", rootThreadId: "parent" },
|
||||||
|
pendingBackgroundTasks: [
|
||||||
|
{ taskId: "a", kind: "subagent" },
|
||||||
|
{ taskId: "b", kind: "command", description: "dev server :5173" },
|
||||||
|
],
|
||||||
|
goal: { objective: "Ship sync", status: "active", timeUsedSeconds: 90 },
|
||||||
|
}),
|
||||||
|
project,
|
||||||
|
vcs({}),
|
||||||
|
snapshot,
|
||||||
|
);
|
||||||
|
expect(details.lineage.map((entry) => entry.text)).toEqual(['forked from "Plan sync"', 'forked into "Try another way"', "1 subagent (1 running)"]);
|
||||||
|
expect(details.background).toEqual([{ glyph: "◐", text: "dev server :5173" }]);
|
||||||
|
expect(details.goal).toEqual({ objective: "Ship sync", status: "active · 1m", tone: "info" });
|
||||||
|
});
|
||||||
|
|
||||||
|
test("notes folders that aren't repositories", () => {
|
||||||
|
expect(threadDetails(thread(), project, vcs({ isRepo: false }), null).vcsNote).toBe("Not a git repository");
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in new issue
Block a user