Compare commits

..
Author SHA1 Message Date
Julius Marmingeandcodex e2309c1afc fix(terminal): address ghostty refresh review
Co-authored-by: codex <[email protected]>
2026-07-20 18:16:32 +02:00
Pixel Perfect 2bc4029e81 Keep scroll anchor stable at the scrollback cap and fix config order
- Once scrollback is full its length stops growing while writes keep
  evicting lines, so the preserved viewport drifted toward the tail;
  fall back to counting written newlines at the cap
- Parse config.ghostty before config so config wins conflicts, matching
  Ghostty's own load order
2026-07-20 18:05:01 +02:00
Pixel Perfect 4f4a2ede59 Address second-round review findings
- Preserve a scrolled-back viewport when session output arrives:
  ghostty-web snaps to the bottom on every write, so re-anchor the
  viewport by the number of lines the write pushed into scrollback
- Read both config and config.ghostty when they coexist in a Ghostty
  config directory instead of letting the first shadow the second
- Linkify mailto/ftp/ssh/git/tel/magnet/gemini/gopher/news URLs in the
  terminal and open non-http schemes with the OS handler, keeping the
  in-app preview flow for http(s)
2026-07-20 18:05:01 +02:00
Pixel Perfect 36d1cc6578 Re-run session sync after WASM init and merge Ghostty config files
- Bump a terminal epoch when the deferred WASM setup finishes so the
  session sync effect re-runs against the live terminal even when no
  session field changed during the load, completing the exited-at-mount
  handling
- Read config.ghostty as an alternate config file name and merge the
  XDG and macOS Application Support configs in Ghostty's load order
  instead of stopping at the first existing file
2026-07-20 18:05:01 +02:00
Pixel Perfect c1caaa3520 Handle init failure surfacing and empty XDG_CONFIG_HOME
- Attach a rejection handler to the terminal WASM init so a load
  failure logs, shows a message in the viewport, and clears on retry
  instead of leaving a blank pane and an unhandled rejection
- Treat an empty XDG_CONFIG_HOME as unset per the XDG spec instead of
  resolving the Ghostty config relative to the server cwd
2026-07-20 18:05:01 +02:00
Pixel Perfect 7266fafbf6 Address review findings on the ghostty-web terminal
- Retry WASM init on a later mount instead of caching a rejected
  promise until page reload
- Blur non-active terminals after open(): ghostty-web focuses
  unconditionally, letting the last-mounted split steal focus
- Seed the session snapshot with version 0 and a closed status at mount
  so an already-exited session still surfaces its exit and closes the
  viewport
- Keep CSS generic font keywords (monospace, system-ui, ...) unquoted
  when building the terminal font stack
- Resolve named Ghostty themes from the Linux system dirs
  (/usr/share/ghostty/themes, /usr/local/share/ghostty/themes) too
2026-07-20 18:05:01 +02:00
Pixel Perfect a6ff5725cc Allow WebAssembly in the desktop renderer CSP
The desktop protocol's Content-Security-Policy blocked the ghostty-web
terminal from initializing: script-src had no 'wasm-unsafe-eval', so
WebAssembly compilation was rejected, and connect-src had no data:, so
the library's embedded WASM payload fetch failed. Add both sources.
2026-07-20 18:05:01 +02:00
Pixel Perfect 87998f7c2a Replace xterm.js with ghostty-web in the web terminal
Swap the thread terminal drawer from @xterm/xterm to ghostty-web, the
libghostty-vt based drop-in. The server terminal protocol is unchanged;
the swap is contained to the client renderer:

- Gate terminal creation on the ghostty-web WASM init and replay the
  session buffer that arrives before it resolves
- Invert custom key handler returns (ghostty-web treats true as
  "consumed", the opposite of xterm.js)
- Convert link provider rows/ranges between the 1-based terminal-links
  helpers and ghostty-web's 0-based coordinates, and drop the built-in
  providers whose activate() bypasses the app's preview flow
- Guard zero-length writes: ghostty-web 0.4.0 alloc(0) returns an
  out-of-bounds pointer and crashes on status-only session updates
- Adapt at-bottom checks to ghostty-web's inverted viewportY semantics

Also style the terminal from the user's local Ghostty config when one
exists: the server parses font-family/font-size/theme (resolving named
themes from the user themes dir or the Ghostty.app bundle) into an
optional ServerConfig.terminalStyle field, and the drawer applies it
over the app-derived defaults. Nerd Font fallbacks cover powerline and
devicon glyphs, and the mount is painted with the theme background so
partial-cell fringes match the canvas.
2026-07-20 18:05:01 +02:00
39 changed files with 1205 additions and 1626 deletions

No files matched your search

@@ -57,11 +57,11 @@ describe("ElectronProtocol", () => {
assert.equal(yield* Effect.promise(() => response.text()), "ok"); assert.equal(yield* Effect.promise(() => response.text()), "ok");
assert.include( assert.include(
response.headers.get("content-security-policy") ?? "", response.headers.get("content-security-policy") ?? "",
"script-src 'self' 'unsafe-inline' https://clerk.t3.codes https://challenges.cloudflare.com", "script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval' https://clerk.t3.codes https://challenges.cloudflare.com",
); );
assert.include( assert.include(
response.headers.get("content-security-policy") ?? "", response.headers.get("content-security-policy") ?? "",
"connect-src 'self' http: https: ws: wss:", "connect-src 'self' data: http: https: ws: wss:",
); );
assert.include( assert.include(
response.headers.get("content-security-policy") ?? "", response.headers.get("content-security-policy") ?? "",
@@ -212,10 +212,18 @@ describe("ElectronProtocol", () => {
assert.deepEqual(directives["script-src"], [ assert.deepEqual(directives["script-src"], [
"'self'", "'self'",
"'unsafe-inline'", "'unsafe-inline'",
"'wasm-unsafe-eval'",
"https://clerk.t3.codes", "https://clerk.t3.codes",
"https://challenges.cloudflare.com", "https://challenges.cloudflare.com",
]); ]);
assert.deepEqual(directives["connect-src"], ["'self'", "http:", "https:", "ws:", "wss:"]); assert.deepEqual(directives["connect-src"], [
"'self'",
"data:",
"http:",
"https:",
"ws:",
"wss:",
]);
assert.deepEqual(directives["img-src"], [ assert.deepEqual(directives["img-src"], [
"'self'", "'self'",
"t3code:", "t3code:",
@@ -71,6 +71,8 @@ export function makeDesktopContentSecurityPolicy(input: DesktopProtocolRegistrat
const scriptSources = [ const scriptSources = [
"'self'", "'self'",
"'unsafe-inline'", "'unsafe-inline'",
// Required to compile the ghostty-web terminal's WebAssembly module.
"'wasm-unsafe-eval'",
...(clerkOrigin ? [clerkOrigin] : []), ...(clerkOrigin ? [clerkOrigin] : []),
"https://challenges.cloudflare.com", "https://challenges.cloudflare.com",
]; ];
@@ -79,7 +81,8 @@ export function makeDesktopContentSecurityPolicy(input: DesktopProtocolRegistrat
// the build-configured Clerk, relay, and OTLP endpoints. Those environment // the build-configured Clerk, relay, and OTLP endpoints. Those environment
// origins are not known when this response policy is created, so restrict // origins are not known when this response policy is created, so restrict
// connections by the network schemes the client supports instead of by host. // connections by the network schemes the client supports instead of by host.
const connectSources = ["'self'", "http:", "https:", "ws:", "wss:"]; // data: allows ghostty-web to fetch its embedded WebAssembly payload.
const connectSources = ["'self'", "data:", "http:", "https:", "ws:", "wss:"];
return [ return [
"default-src 'self'", "default-src 'self'",
@@ -342,7 +342,6 @@ export const makeOrchestrationIntegrationHarness = (
hasWorkingTreeChanges: false, hasWorkingTreeChanges: false,
workingTree: { files: [], insertions: 0, deletions: 0 }, workingTree: { files: [], insertions: 0, deletions: 0 },
}), }),
refreshChangeRequestStatus: () => Effect.succeed(null),
refreshStatus: () => Effect.die("refreshStatus should not be called in this test"), refreshStatus: () => Effect.die("refreshStatus should not be called in this test"),
streamStatus: () => Stream.empty, streamStatus: () => Stream.empty,
}), }),
+1 -38
View File
@@ -895,13 +895,11 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
insertions: 0, insertions: 0,
deletions: 0, deletions: 0,
}, },
statusRefName: null,
hasUpstream: false, hasUpstream: false,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
aheadOfDefaultCount: 0, aheadOfDefaultCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "pending" },
}); });
}), }),
); );
@@ -927,13 +925,11 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
insertions: 0, insertions: 0,
deletions: 0, deletions: 0,
}, },
statusRefName: null,
hasUpstream: false, hasUpstream: false,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
aheadOfDefaultCount: 0, aheadOfDefaultCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "pending" },
}); });
}), }),
); );
@@ -1315,7 +1311,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
}), }),
); );
it.effect("status reports provider availability failures without leaking diagnostics", () => it.effect("status is resilient to gh lookup failures and returns pr null", () =>
Effect.gen(function* () { Effect.gen(function* () {
const repoDir = yield* makeTempDir("t3code-git-manager-"); const repoDir = yield* makeTempDir("t3code-git-manager-");
yield* initRepo(repoDir); yield* initRepo(repoDir);
@@ -1337,39 +1333,6 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
const status = yield* manager.status({ cwd: repoDir }); const status = yield* manager.status({ cwd: repoDir });
expect(status.refName).toBe("feature/status-no-gh"); expect(status.refName).toBe("feature/status-no-gh");
expect(status.pr).toBeNull(); expect(status.pr).toBeNull();
expect(status.changeRequestLookup).toEqual({
_tag: "failed",
provider: "github",
reason: "provider_unavailable",
});
}),
);
it.effect("status reports source control authentication failures", () =>
Effect.gen(function* () {
const repoDir = yield* makeTempDir("t3code-git-manager-");
yield* initRepo(repoDir);
yield* runGit(repoDir, ["checkout", "-b", "feature/status-auth"]);
const remoteDir = yield* createBareRemote();
yield* runGit(repoDir, ["remote", "add", "origin", remoteDir]);
yield* runGit(repoDir, ["push", "-u", "origin", "feature/status-auth"]);
const { manager } = yield* makeManager({
ghScenario: {
failWith: new GitHubCli.GitHubCliAuthenticationError({
command: "gh",
cwd: repoDir,
cause: new Error("private authentication output"),
}),
},
});
const status = yield* manager.status({ cwd: repoDir });
expect(status.changeRequestLookup).toEqual({
_tag: "failed",
provider: "github",
reason: "authentication_required",
});
}), }),
); );
+17 -51
View File
@@ -25,7 +25,6 @@ import {
GitStackedAction, GitStackedAction,
VcsStatusInput, VcsStatusInput,
type VcsStatusLocalResult, type VcsStatusLocalResult,
type VcsStatusChangeRequestLookup,
type VcsStatusRemoteResult, type VcsStatusRemoteResult,
VcsStatusResult, VcsStatusResult,
ModelSelection, ModelSelection,
@@ -50,7 +49,7 @@ import * as ServerSettings from "../serverSettings.ts";
import type { GitManagerServiceError } from "@t3tools/contracts"; import type { GitManagerServiceError } from "@t3tools/contracts";
import * as GitVcsDriver from "../vcs/GitVcsDriver.ts"; import * as GitVcsDriver from "../vcs/GitVcsDriver.ts";
import * as SourceControlProviderRegistry from "../sourceControl/SourceControlProviderRegistry.ts"; import * as SourceControlProviderRegistry from "../sourceControl/SourceControlProviderRegistry.ts";
import type { ChangeRequest, SourceControlProviderError } from "@t3tools/contracts"; import type { ChangeRequest } from "@t3tools/contracts";
export interface GitActionProgressReporter { export interface GitActionProgressReporter {
readonly publish: (event: GitActionProgressEvent) => Effect.Effect<void, never>; readonly publish: (event: GitActionProgressEvent) => Effect.Effect<void, never>;
@@ -104,32 +103,6 @@ function isNotGitRepositoryError(error: GitCommandError): boolean {
return error.message.toLowerCase().includes("not a git repository"); return error.message.toLowerCase().includes("not a git repository");
} }
function lookupFailureReason(error: SourceControlProviderError): VcsStatusChangeRequestLookup {
const tags = new Set<string>();
let current: unknown = error;
for (let depth = 0; depth < 6 && current !== null && typeof current === "object"; depth += 1) {
if ("_tag" in current && typeof current._tag === "string") {
tags.add(current._tag);
}
if ("status" in current && (current.status === 401 || current.status === 403)) {
return {
_tag: "failed",
provider: error.provider,
reason: "authentication_required",
};
}
current = "cause" in current ? current.cause : null;
}
const hasTagSuffix = (suffix: string) => [...tags].some((tag) => tag.endsWith(suffix));
const reason = hasTagSuffix("AuthenticationError")
? "authentication_required"
: hasTagSuffix("UnavailableError") || tags.has("VcsProcessSpawnError")
? "provider_unavailable"
: "lookup_failed";
return { _tag: "failed", provider: error.provider, reason };
}
interface OpenPrInfo { interface OpenPrInfo {
number: number; number: number;
title: string; title: string;
@@ -806,36 +779,29 @@ export const make = Effect.gen(function* () {
return null; return null;
} }
let pr: VcsStatusRemoteResult["pr"] = null; const pr =
let changeRequestLookup: VcsStatusChangeRequestLookup = { _tag: "succeeded" }; details.branch !== null
if (details.branch !== null) { ? yield* findLatestPr(cwd, {
const lookup = yield* findLatestPr(cwd, { branch: details.branch,
branch: details.branch, upstreamRef: details.upstreamRef,
upstreamRef: details.upstreamRef, }).pipe(
}).pipe( Effect.map((latest) => {
Effect.match({ if (!latest) return null;
onFailure: (error) => ({ error }), // On the default branch, only surface open PRs.
onSuccess: (latest) => ({ latest }), // Merged/closed matches are usually reverse-merge history, not the thread's PR context.
}), if (details.isDefaultBranch && latest.state !== "open") return null;
); return toStatusPr(latest);
if ("error" in lookup) { }),
changeRequestLookup = lookupFailureReason(lookup.error); Effect.orElseSucceed(() => null),
} else { )
const latest = lookup.latest; : null;
if (latest && (!details.isDefaultBranch || latest.state === "open")) {
pr = toStatusPr(latest);
}
}
}
return { return {
statusRefName: details.branch,
hasUpstream: details.hasUpstream, hasUpstream: details.hasUpstream,
aheadCount: details.aheadCount, aheadCount: details.aheadCount,
behindCount: details.behindCount, behindCount: details.behindCount,
aheadOfDefaultCount: details.aheadOfDefaultCount, aheadOfDefaultCount: details.aheadOfDefaultCount,
pr, pr,
changeRequestLookup,
} satisfies VcsStatusRemoteResult; } satisfies VcsStatusRemoteResult;
}); });
const remoteStatusResultCache = yield* Cache.makeWith((cwd: string) => readRemoteStatus(cwd), { const remoteStatusResultCache = yield* Cache.makeWith((cwd: string) => readRemoteStatus(cwd), {
@@ -66,13 +66,11 @@ describe("GitWorkflowService", () => {
insertions: 0, insertions: 0,
deletions: 0, deletions: 0,
}, },
statusRefName: null,
hasUpstream: false, hasUpstream: false,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
aheadOfDefaultCount: 0, aheadOfDefaultCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}); });
}).pipe( }).pipe(
Effect.provide( Effect.provide(
@@ -112,13 +112,11 @@ function nonRepositoryLocalStatus(): VcsStatusLocalResult {
function nonRepositoryStatus(): VcsStatusResult { function nonRepositoryStatus(): VcsStatusResult {
return { return {
...nonRepositoryLocalStatus(), ...nonRepositoryLocalStatus(),
statusRefName: null,
hasUpstream: false, hasUpstream: false,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
aheadOfDefaultCount: 0, aheadOfDefaultCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}; };
} }
@@ -1,6 +1,4 @@
// @effect-diagnostics nodeBuiltinImport:off // @effect-diagnostics nodeBuiltinImport:off
/* oxlint-disable t3code/no-manual-effect-runtime-in-tests */
// This integration harness owns a ManagedRuntime and exercises its Promise boundary directly.
import * as NodeFS from "node:fs"; import * as NodeFS from "node:fs";
import * as NodeOS from "node:os"; import * as NodeOS from "node:os";
import * as NodePath from "node:path"; import * as NodePath from "node:path";
@@ -16,7 +14,6 @@ import {
CommandId, CommandId,
DEFAULT_PROVIDER_INTERACTION_MODE, DEFAULT_PROVIDER_INTERACTION_MODE,
EventId, EventId,
GitManagerError,
MessageId, MessageId,
ProjectId, ProjectId,
ThreadId, ThreadId,
@@ -200,16 +197,6 @@ async function waitForEvent(
return poll(); return poll();
} }
async function waitForCondition(predicate: () => boolean, timeoutMs = 5_000): Promise<void> {
const deadline = (await Effect.runPromise(Clock.currentTimeMillis)) + timeoutMs;
while (!predicate()) {
if ((await Effect.runPromise(Clock.currentTimeMillis)) >= deadline) {
throw new Error("Timed out waiting for condition.");
}
await Effect.runPromise(Effect.sleep("10 millis"));
}
}
function runGit(cwd: string, args: ReadonlyArray<string>) { function runGit(cwd: string, args: ReadonlyArray<string>) {
return NodeChildProcess.execFileSync("git", args, { return NodeChildProcess.execFileSync("git", args, {
cwd, cwd,
@@ -293,10 +280,6 @@ describe("CheckpointReactor", () => {
readonly providerSessionCwd?: string; readonly providerSessionCwd?: string;
readonly providerName?: ProviderDriverKind; readonly providerName?: ProviderDriverKind;
readonly gitStatusRefreshCalls?: Array<string>; readonly gitStatusRefreshCalls?: Array<string>;
readonly changeRequestStatusRefreshCalls?: Array<string>;
readonly failGitStatusRefresh?: boolean;
readonly failChangeRequestStatusRefresh?: boolean;
readonly gitStatusRefreshWait?: Promise<void>;
}) { }) {
const cwd = createGitRepository(); const cwd = createGitRepository();
tempDirs.push(cwd); tempDirs.push(cwd);
@@ -328,45 +311,14 @@ describe("CheckpointReactor", () => {
Effect.sync(() => { Effect.sync(() => {
options?.gitStatusRefreshCalls?.push(cwd); options?.gitStatusRefreshCalls?.push(cwd);
}).pipe( }).pipe(
Effect.andThen( Effect.as({
options?.gitStatusRefreshWait isRepo: true,
? Effect.promise(() => options.gitStatusRefreshWait!) hasPrimaryRemote: false,
: Effect.void, isDefaultRef: true,
), refName: "main",
Effect.andThen( hasWorkingTreeChanges: false,
options?.failGitStatusRefresh workingTree: { files: [], insertions: 0, deletions: 0 },
? Effect.fail( }),
new GitManagerError({
operation: "refreshLocalStatus",
cwd,
detail: "test failure",
}),
)
: Effect.succeed({
isRepo: true as const,
hasPrimaryRemote: false,
isDefaultRef: true,
refName: "main",
hasWorkingTreeChanges: false,
workingTree: { files: [], insertions: 0, deletions: 0 },
}),
),
),
refreshChangeRequestStatus: (cwd: string) =>
Effect.sync(() => {
options?.changeRequestStatusRefreshCalls?.push(cwd);
}).pipe(
Effect.andThen(
options?.failChangeRequestStatusRefresh
? Effect.fail(
new GitManagerError({
operation: "refreshChangeRequestStatus",
cwd,
detail: "test failure",
}),
)
: Effect.succeed(null),
),
), ),
refreshStatus: () => Effect.die("refreshStatus should not be called in this test"), refreshStatus: () => Effect.die("refreshStatus should not be called in this test"),
streamStatus: () => Stream.empty, streamStatus: () => Stream.empty,
@@ -544,13 +496,11 @@ describe("CheckpointReactor", () => {
).toBe("v2\n"); ).toBe("v2\n");
}); });
it("refreshes local and change request status on turn completion using the session cwd", async () => { it("refreshes local git status state on turn completion using the session cwd", async () => {
const gitStatusRefreshCalls: string[] = []; const gitStatusRefreshCalls: string[] = [];
const changeRequestStatusRefreshCalls: string[] = [];
const harness = await createHarness({ const harness = await createHarness({
seedFilesystemCheckpoints: false, seedFilesystemCheckpoints: false,
gitStatusRefreshCalls, gitStatusRefreshCalls,
changeRequestStatusRefreshCalls,
}); });
harness.provider.emit({ harness.provider.emit({
@@ -566,105 +516,10 @@ describe("CheckpointReactor", () => {
await harness.drain(); await harness.drain();
expect(gitStatusRefreshCalls).toEqual([harness.cwd]); expect(gitStatusRefreshCalls).toEqual([harness.cwd]);
expect(changeRequestStatusRefreshCalls).toEqual([harness.cwd]);
});
it("falls back to the thread worktree when no provider session is available", async () => {
const gitStatusRefreshCalls: string[] = [];
const changeRequestStatusRefreshCalls: string[] = [];
const harness = await createHarness({
hasSession: false,
seedFilesystemCheckpoints: false,
gitStatusRefreshCalls,
changeRequestStatusRefreshCalls,
});
harness.provider.emit({
type: "turn.completed",
eventId: EventId.make("evt-turn-completed-refresh-fallback"),
provider: ProviderDriverKind.make("codex"),
createdAt: "2026-01-01T00:00:00.000Z",
threadId: ThreadId.make("thread-1"),
turnId: asTurnId("turn-refresh-fallback"),
payload: { state: "completed" },
});
await harness.drain();
expect(gitStatusRefreshCalls).toEqual([harness.cwd]);
expect(changeRequestStatusRefreshCalls).toEqual([harness.cwd]);
});
it.each([
{ name: "local", failGitStatusRefresh: true, failChangeRequestStatusRefresh: false },
{ name: "change request", failGitStatusRefresh: false, failChangeRequestStatusRefresh: true },
])("runs both completion refreshes when the $name refresh fails", async (failure) => {
const gitStatusRefreshCalls: string[] = [];
const changeRequestStatusRefreshCalls: string[] = [];
const harness = await createHarness({
seedFilesystemCheckpoints: false,
gitStatusRefreshCalls,
changeRequestStatusRefreshCalls,
failGitStatusRefresh: failure.failGitStatusRefresh,
failChangeRequestStatusRefresh: failure.failChangeRequestStatusRefresh,
});
harness.provider.emit({
type: "turn.completed",
eventId: EventId.make(`evt-turn-completed-${failure.name}-refresh-failure`),
provider: ProviderDriverKind.make("codex"),
createdAt: "2026-01-01T00:00:00.000Z",
threadId: ThreadId.make("thread-1"),
turnId: asTurnId(`turn-${failure.name}-refresh-failure`),
payload: { state: "completed" },
});
await harness.drain();
expect(gitStatusRefreshCalls).toEqual([harness.cwd]);
expect(changeRequestStatusRefreshCalls).toEqual([harness.cwd]);
});
it("starts change request refresh without waiting for local refresh", async () => {
const gitStatusRefreshCalls: string[] = [];
const changeRequestStatusRefreshCalls: string[] = [];
let releaseLocalRefresh: (() => void) | undefined;
const gitStatusRefreshWait = new Promise<void>((resolve) => {
releaseLocalRefresh = resolve;
});
const harness = await createHarness({
seedFilesystemCheckpoints: false,
gitStatusRefreshCalls,
changeRequestStatusRefreshCalls,
gitStatusRefreshWait,
});
harness.provider.emit({
type: "turn.completed",
eventId: EventId.make("evt-turn-completed-independent-refreshes"),
provider: ProviderDriverKind.make("codex"),
createdAt: "2026-01-01T00:00:00.000Z",
threadId: ThreadId.make("thread-1"),
turnId: asTurnId("turn-independent-refreshes"),
payload: { state: "completed" },
});
const draining = harness.drain();
await waitForCondition(
() => gitStatusRefreshCalls.length === 1 && changeRequestStatusRefreshCalls.length === 1,
);
expect(gitStatusRefreshCalls).toEqual([harness.cwd]);
expect(changeRequestStatusRefreshCalls).toEqual([harness.cwd]);
releaseLocalRefresh?.();
await draining;
}); });
it("ignores auxiliary thread turn completion while primary turn is active", async () => { it("ignores auxiliary thread turn completion while primary turn is active", async () => {
const gitStatusRefreshCalls: string[] = []; const harness = await createHarness({ seedFilesystemCheckpoints: false });
const changeRequestStatusRefreshCalls: string[] = [];
const harness = await createHarness({
seedFilesystemCheckpoints: false,
gitStatusRefreshCalls,
changeRequestStatusRefreshCalls,
});
const createdAt = "2026-01-01T00:00:00.000Z"; const createdAt = "2026-01-01T00:00:00.000Z";
await Effect.runPromise( await Effect.runPromise(
@@ -716,20 +571,6 @@ describe("CheckpointReactor", () => {
const midReadModel = await harness.readModel(); const midReadModel = await harness.readModel();
const midThread = midReadModel.threads.find((entry) => entry.id === ThreadId.make("thread-1")); const midThread = midReadModel.threads.find((entry) => entry.id === ThreadId.make("thread-1"));
expect(midThread?.checkpoints).toHaveLength(0); expect(midThread?.checkpoints).toHaveLength(0);
expect(gitStatusRefreshCalls).toEqual([]);
expect(changeRequestStatusRefreshCalls).toEqual([]);
harness.provider.emit({
type: "turn.completed",
eventId: EventId.make("evt-turn-completed-missing-id"),
provider: ProviderDriverKind.make("codex"),
createdAt: "2026-01-01T00:00:00.000Z",
threadId: ThreadId.make("thread-1"),
payload: { state: "completed" },
});
await harness.drain();
expect(gitStatusRefreshCalls).toEqual([]);
expect(changeRequestStatusRefreshCalls).toEqual([]);
harness.provider.emit({ harness.provider.emit({
type: "turn.completed", type: "turn.completed",
@@ -526,73 +526,25 @@ const make = Effect.gen(function* () {
}, },
); );
const refreshGitStatusFromTurnCompletion = Effect.fn("refreshGitStatusFromTurnCompletion")( const refreshLocalGitStatusFromTurnCompletion = Effect.fn(
function* (event: Extract<ProviderRuntimeEvent, { type: "turn.completed" }>) { "refreshLocalGitStatusFromTurnCompletion",
const turnId = toTurnId(event.turnId); )(function* (event: Extract<ProviderRuntimeEvent, { type: "turn.completed" }>) {
const thread = yield* resolveThreadDetail(event.threadId); const sessionRuntime = yield* resolveSessionRuntimeForThread(event.threadId);
if ( if (Option.isNone(sessionRuntime)) {
thread?.session?.activeTurnId && return;
(!turnId || !sameId(thread.session.activeTurnId, turnId)) }
) {
return;
}
const sessionRuntime = yield* resolveSessionRuntimeForThread(event.threadId); yield* vcsStatusBroadcaster.refreshLocalStatus(sessionRuntime.value.cwd).pipe(
let cwd = Option.getOrUndefined(sessionRuntime)?.cwd; Effect.catch((error) =>
if (!cwd) { Effect.logWarning("failed to refresh local git status after turn completion", {
if (thread) { threadId: event.threadId,
cwd = yield* resolveCheckpointCwd({ turnId: event.turnId ?? null,
threadId: thread.id, cwd: sessionRuntime.value.cwd,
thread, detail: error.message,
projects: yield* resolveThreadProjects(thread.projectId), }),
preferSessionRuntime: true, ),
}); );
} });
}
if (!cwd) {
return;
}
const [local, remote] = yield* Effect.all(
[
vcsStatusBroadcaster.refreshLocalStatus(cwd).pipe(
Effect.catch((error) =>
Effect.logWarning("failed to refresh local git status after turn completion", {
threadId: event.threadId,
turnId: event.turnId ?? null,
cwd,
detail: error.message,
}).pipe(Effect.as(undefined)),
),
),
vcsStatusBroadcaster.refreshChangeRequestStatus(cwd).pipe(
Effect.catch((error) =>
Effect.logWarning("failed to refresh change request status after turn completion", {
threadId: event.threadId,
turnId: event.turnId ?? null,
cwd,
detail: error.message,
}).pipe(Effect.as(undefined)),
),
),
],
{ concurrency: "unbounded" },
);
if (local && remote && remote.statusRefName !== local.refName) {
yield* vcsStatusBroadcaster.refreshChangeRequestStatus(cwd).pipe(
Effect.catch((error) =>
Effect.logWarning("failed to reconcile change request status after branch change", {
threadId: event.threadId,
turnId: event.turnId ?? null,
cwd,
detail: error.message,
}),
),
);
}
},
);
const ensurePreTurnBaselineFromDomainTurnStart = Effect.fn( const ensurePreTurnBaselineFromDomainTurnStart = Effect.fn(
"ensurePreTurnBaselineFromDomainTurnStart", "ensurePreTurnBaselineFromDomainTurnStart",
@@ -838,7 +790,7 @@ const make = Effect.gen(function* () {
if (event.type === "turn.completed") { if (event.type === "turn.completed") {
const turnId = toTurnId(event.turnId); const turnId = toTurnId(event.turnId);
yield* refreshGitStatusFromTurnCompletion(event); yield* refreshLocalGitStatusFromTurnCompletion(event);
yield* captureCheckpointFromTurnCompletion(event).pipe( yield* captureCheckpointFromTurnCompletion(event).pipe(
Effect.catch((error) => Effect.catch((error) =>
Effect.flatMap(nowIso, (createdAt) => Effect.flatMap(nowIso, (createdAt) =>
@@ -262,12 +262,10 @@ describe("ProviderCommandReactor", () => {
insertions: 0, insertions: 0,
deletions: 0, deletions: 0,
}, },
statusRefName: "renamed-branch",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" as const },
}), }),
); );
const generateBranchName = vi.fn<TextGenerationShape["generateBranchName"]>((_) => const generateBranchName = vi.fn<TextGenerationShape["generateBranchName"]>((_) =>
@@ -360,8 +358,6 @@ describe("ProviderCommandReactor", () => {
getStatus: () => Effect.die("getStatus should not be called in this test"), getStatus: () => Effect.die("getStatus should not be called in this test"),
refreshLocalStatus: () => refreshLocalStatus: () =>
Effect.die("refreshLocalStatus should not be called in this test"), Effect.die("refreshLocalStatus should not be called in this test"),
refreshChangeRequestStatus: () =>
Effect.die("refreshChangeRequestStatus should not be called in this test"),
refreshStatus, refreshStatus,
streamStatus: () => Stream.die("streamStatus should not be called in this test"), streamStatus: () => Stream.die("streamStatus should not be called in this test"),
}), }),
-22
View File
@@ -4823,12 +4823,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
}), }),
remoteStatus: () => remoteStatus: () =>
Effect.succeed({ Effect.succeed({
statusRefName: "main",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}), }),
status: () => status: () =>
Effect.succeed({ Effect.succeed({
@@ -4838,12 +4836,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
refName: "main", refName: "main",
hasWorkingTreeChanges: false, hasWorkingTreeChanges: false,
workingTree: { files: [], insertions: 0, deletions: 0 }, workingTree: { files: [], insertions: 0, deletions: 0 },
statusRefName: "main",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}), }),
runStackedAction: (input, options) => runStackedAction: (input, options) =>
Effect.gen(function* () { Effect.gen(function* () {
@@ -4957,12 +4953,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
refName: "main", refName: "main",
hasWorkingTreeChanges: false, hasWorkingTreeChanges: false,
workingTree: { files: [], insertions: 0, deletions: 0 }, workingTree: { files: [], insertions: 0, deletions: 0 },
statusRefName: "main",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}), }),
}, },
reviewService: { reviewService: {
@@ -5151,12 +5145,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
Effect.sync(() => { Effect.sync(() => {
statusCalls += 1; statusCalls += 1;
return { return {
statusRefName: "main",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" as const },
}; };
}), }),
status: () => status: () =>
@@ -5169,12 +5161,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
refName: "main", refName: "main",
hasWorkingTreeChanges: true, hasWorkingTreeChanges: true,
workingTree: { files: [], insertions: 0, deletions: 0 }, workingTree: { files: [], insertions: 0, deletions: 0 },
statusRefName: "main",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" as const },
}; };
}), }),
}, },
@@ -5232,12 +5222,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
Effect.sync(() => { Effect.sync(() => {
statusCalls += 1; statusCalls += 1;
return { return {
statusRefName: "feature/demo",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" as const },
}; };
}), }),
status: () => status: () =>
@@ -5250,12 +5238,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
refName: "feature/demo", refName: "feature/demo",
hasWorkingTreeChanges: true, hasWorkingTreeChanges: true,
workingTree: { files: [], insertions: 0, deletions: 0 }, workingTree: { files: [], insertions: 0, deletions: 0 },
statusRefName: "feature/demo",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" as const },
}; };
}), }),
runStackedAction: () => Effect.fail(gitError), runStackedAction: () => Effect.fail(gitError),
@@ -5307,12 +5293,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
remoteStatus: () => remoteStatus: () =>
Effect.sleep(Duration.seconds(2)).pipe( Effect.sleep(Duration.seconds(2)).pipe(
Effect.as({ Effect.as({
statusRefName: "main",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" as const },
}), }),
), ),
}, },
@@ -5355,12 +5339,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
remoteStatus: () => remoteStatus: () =>
Effect.sleep(Duration.seconds(2)).pipe( Effect.sleep(Duration.seconds(2)).pipe(
Effect.as({ Effect.as({
statusRefName: "feature/demo",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" as const },
}), }),
), ),
runStackedAction: () => runStackedAction: () =>
@@ -5438,12 +5420,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
remoteStatus: () => remoteStatus: () =>
Effect.sleep(Duration.seconds(2)).pipe( Effect.sleep(Duration.seconds(2)).pipe(
Effect.as({ Effect.as({
statusRefName: "feature/demo",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" as const },
}), }),
), ),
runStackedAction: () => runStackedAction: () =>
@@ -6764,12 +6744,10 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
insertions: 0, insertions: 0,
deletions: 0, deletions: 0,
}, },
statusRefName: "t3code/bootstrap-refName",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" as const },
}), }),
); );
const fetchRemote = vi.fn( const fetchRemote = vi.fn(
@@ -0,0 +1,76 @@
import { describe, expect, it } from "vite-plus/test";
import {
ghosttyThemeSearchPaths,
parseGhosttyConfig,
splitThemeSelection,
} from "./ghosttyStyle.ts";
const posixPath = {
isAbsolute: (value: string) => value.startsWith("/"),
join: (...segments: ReadonlyArray<string>) =>
segments
.map((segment, index) =>
index === 0 ? segment.replace(/\/$/, "") : segment.replace(/^\//, ""),
)
.join("/"),
};
const windowsPath = {
isAbsolute: (value: string) => /^[A-Za-z]:[\\/]/.test(value),
join: (...segments: ReadonlyArray<string>) => segments.join("\\"),
};
describe("parseGhosttyConfig", () => {
it("omits empty scalar color assignments", () => {
const config = parseGhosttyConfig(`
background =
foreground = ""
cursor-color = #c0ffee
`);
expect(config.colors.background).toBeUndefined();
expect(config.colors.foreground).toBeUndefined();
expect(config.colors.cursor).toBe("#c0ffee");
});
});
describe("splitThemeSelection", () => {
it("keeps a Windows absolute theme path as a bare selection", () => {
expect(splitThemeSelection("C:/Users/Alex/Ghostty Themes/t3code")).toEqual({
light: "C:/Users/Alex/Ghostty Themes/t3code",
dark: "C:/Users/Alex/Ghostty Themes/t3code",
});
});
it("still parses explicit light and dark theme selections", () => {
expect(splitThemeSelection("light:Day,dark:Night")).toEqual({
light: "Day",
dark: "Night",
});
});
});
describe("ghosttyThemeSearchPaths", () => {
it("searches beside the macOS Application Support config", () => {
const candidates = ghosttyThemeSearchPaths(posixPath, {
home: "/Users/alex",
xdgConfigHome: "/Users/alex/.config",
themeName: "t3code",
});
expect(candidates).toContain(
"/Users/alex/Library/Application Support/com.mitchellh.ghostty/themes/t3code",
);
});
it("tries an absolute theme file before named-theme directories", () => {
const candidates = ghosttyThemeSearchPaths(windowsPath, {
home: "C:\\Users\\alex",
xdgConfigHome: "C:\\Users\\alex\\.config",
themeName: "D:\\themes\\t3code",
});
expect(candidates[0]).toBe("D:\\themes\\t3code");
});
});
+289
View File
@@ -0,0 +1,289 @@
import * as NodeOS from "node:os";
import type { ServerTerminalStyle, ServerTerminalThemeColors } from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
const PALETTE_SIZE = 16;
interface GhosttyConfigValues {
readonly fontFamily: ReadonlyArray<string>;
readonly fontSize: number | undefined;
readonly theme: string | undefined;
readonly colors: MutableThemeColors;
}
interface MutableThemeColors {
background?: string | undefined;
foreground?: string | undefined;
cursor?: string | undefined;
selectionBackground?: string | undefined;
selectionForeground?: string | undefined;
palette: Array<string>;
}
function emptyColors(): MutableThemeColors {
return { palette: Array.from({ length: PALETTE_SIZE }, () => "") };
}
function stripQuotes(value: string): string {
if (value.length >= 2 && value.startsWith('"') && value.endsWith('"')) {
return value.slice(1, -1);
}
return value;
}
function applyColorEntry(colors: MutableThemeColors, key: string, value: string): void {
// Empty assignments are resets, not colors. Keeping an empty scalar here
// would later violate ServerConfig's TrimmedNonEmptyString schema and make
// the whole server.getConfig response fail to encode.
if (value.length === 0) return;
switch (key) {
case "background":
colors.background = value;
return;
case "foreground":
colors.foreground = value;
return;
case "cursor-color":
colors.cursor = value;
return;
case "selection-background":
colors.selectionBackground = value;
return;
case "selection-foreground":
colors.selectionForeground = value;
return;
case "palette": {
const match = value.match(/^(\d+)\s*=\s*(\S+)$/);
if (!match) return;
const index = Number(match[1]);
if (!Number.isInteger(index) || index < 0 || index >= PALETTE_SIZE) return;
colors.palette[index] = match[2] ?? "";
return;
}
default:
return;
}
}
/** Parse Ghostty's `key = value` config format, keeping only what the web terminal uses. */
export function parseGhosttyConfig(source: string): GhosttyConfigValues {
const fontFamily: Array<string> = [];
let fontSize: number | undefined;
let theme: string | undefined;
const colors = emptyColors();
for (const rawLine of source.split("\n")) {
const line = rawLine.trim();
if (line.length === 0 || line.startsWith("#")) continue;
const separatorIndex = line.indexOf("=");
if (separatorIndex <= 0) continue;
const key = line.slice(0, separatorIndex).trim();
const value = stripQuotes(line.slice(separatorIndex + 1).trim());
switch (key) {
case "font-family":
// Repeated entries build a fallback chain; an empty value resets it.
if (value.length === 0) {
fontFamily.length = 0;
} else {
fontFamily.push(value);
}
break;
case "font-size": {
const parsed = Number(value);
if (Number.isFinite(parsed) && parsed > 0) {
fontSize = parsed;
}
break;
}
case "theme":
theme = value.length > 0 ? value : undefined;
break;
default:
applyColorEntry(colors, key, value);
break;
}
}
return { fontFamily, fontSize, theme, colors };
}
/** Split `theme = light:A,dark:B` into per-mode names; a bare name applies to both. */
export function splitThemeSelection(theme: string): { light?: string; dark?: string } {
const result: { light?: string; dark?: string } = {};
let hasModeSelection = false;
for (const part of theme.split(",")) {
const match = /^\s*(light|dark):(.*)$/.exec(part);
if (!match) continue;
const mode = match[1];
const name = (match[2] ?? "").trim();
if (name.length === 0) continue;
hasModeSelection = true;
if (mode === "light") result.light = name;
if (mode === "dark") result.dark = name;
}
// A colon is also part of a Windows drive path (C:/theme), and may be part
// of another valid bare theme identifier. Only enter per-mode parsing when
// an explicit light: or dark: selection was recognized.
return hasModeSelection ? result : { light: theme, dark: theme };
}
function hasAnyColor(colors: MutableThemeColors): boolean {
return (
colors.background !== undefined ||
colors.foreground !== undefined ||
colors.cursor !== undefined ||
colors.selectionBackground !== undefined ||
colors.selectionForeground !== undefined ||
colors.palette.some((entry) => entry.length > 0)
);
}
function mergeColors(base: MutableThemeColors, override: MutableThemeColors): MutableThemeColors {
return {
background: override.background ?? base.background,
foreground: override.foreground ?? base.foreground,
cursor: override.cursor ?? base.cursor,
selectionBackground: override.selectionBackground ?? base.selectionBackground,
selectionForeground: override.selectionForeground ?? base.selectionForeground,
palette: base.palette.map((entry, index) => {
const overrideEntry = override.palette[index] ?? "";
return overrideEntry.length > 0 ? overrideEntry : entry;
}),
};
}
function toThemeColors(colors: MutableThemeColors): ServerTerminalThemeColors | undefined {
if (!hasAnyColor(colors)) return undefined;
return {
...(colors.background !== undefined ? { background: colors.background } : {}),
...(colors.foreground !== undefined ? { foreground: colors.foreground } : {}),
...(colors.cursor !== undefined ? { cursor: colors.cursor } : {}),
...(colors.selectionBackground !== undefined
? { selectionBackground: colors.selectionBackground }
: {}),
...(colors.selectionForeground !== undefined
? { selectionForeground: colors.selectionForeground }
: {}),
palette: colors.palette,
};
}
// Bundled theme locations by platform: the macOS app bundle and the
// Linux system resource dirs documented by Ghostty.
const GHOSTTY_SYSTEM_THEME_DIRS = [
"/Applications/Ghostty.app/Contents/Resources/ghostty/themes",
"/usr/share/ghostty/themes",
"/usr/local/share/ghostty/themes",
];
export function ghosttyThemeSearchPaths(
path: Pick<Path.Path, "isAbsolute" | "join">,
input: { readonly home: string; readonly xdgConfigHome: string; readonly themeName: string },
): ReadonlyArray<string> {
return [
...(path.isAbsolute(input.themeName) ? [input.themeName] : []),
path.join(input.xdgConfigHome, "ghostty", "themes", input.themeName),
path.join(
input.home,
"Library",
"Application Support",
"com.mitchellh.ghostty",
"themes",
input.themeName,
),
...GHOSTTY_SYSTEM_THEME_DIRS.map((dir) => path.join(dir, input.themeName)),
];
}
/**
* Load terminal font and theme colors from the user's local Ghostty config.
* Best effort by design: any missing file or parse problem yields `undefined`
* so the client falls back to its built-in terminal appearance.
*/
export const loadGhosttyTerminalStyle: Effect.Effect<
ServerTerminalStyle | undefined,
never,
FileSystem.FileSystem | Path.Path
> = Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const home = NodeOS.homedir();
// Per the XDG spec an empty XDG_CONFIG_HOME must be treated as unset.
const xdgConfigHomeEnv = process.env["XDG_CONFIG_HOME"];
const xdgConfigHome =
xdgConfigHomeEnv !== undefined && xdgConfigHomeEnv.length > 0
? xdgConfigHomeEnv
: path.join(home, ".config");
const readFirstExisting = (candidates: ReadonlyArray<string>) =>
Effect.gen(function* () {
for (const candidate of candidates) {
const exists = yield* fs.exists(candidate).pipe(Effect.orElseSucceed(() => false));
if (!exists) continue;
const content = yield* fs
.readFileString(candidate)
.pipe(Effect.orElseSucceed(() => undefined));
if (content !== undefined) return content;
}
return undefined;
});
// Ghostty reads the XDG config first and the macOS Application Support
// config after it, so later files override earlier values. It also accepts
// config.ghostty as the file name. Merge every location that exists instead
// of stopping at the first match.
const configDirs = [
path.join(xdgConfigHome, "ghostty"),
path.join(home, "Library", "Application Support", "com.mitchellh.ghostty"),
];
const configSources: Array<string> = [];
for (const dir of configDirs) {
// Read both file names when they coexist so neither shadows the other;
// Ghostty loads config.ghostty before config, so config wins conflicts.
for (const candidate of [path.join(dir, "config.ghostty"), path.join(dir, "config")]) {
const source = yield* readFirstExisting([candidate]);
if (source !== undefined) configSources.push(source);
}
}
if (configSources.length === 0) return undefined;
const config = parseGhosttyConfig(configSources.join("\n"));
const loadThemeColors = (themeName: string) =>
Effect.gen(function* () {
const themeSource = yield* readFirstExisting(
ghosttyThemeSearchPaths(path, { home, xdgConfigHome, themeName }),
);
if (themeSource === undefined) return emptyColors();
return parseGhosttyConfig(themeSource).colors;
});
const themeSelection = config.theme ? splitThemeSelection(config.theme) : {};
const resolveModeColors = (themeName: string | undefined) =>
Effect.gen(function* () {
const themeColors = themeName ? yield* loadThemeColors(themeName) : emptyColors();
// Explicit colors in the user config override the selected theme.
return toThemeColors(mergeColors(themeColors, config.colors));
});
const light = yield* resolveModeColors(themeSelection.light);
const dark = yield* resolveModeColors(themeSelection.dark);
const style: ServerTerminalStyle = {
...(config.fontFamily.length > 0 ? { fontFamily: config.fontFamily } : {}),
...(config.fontSize !== undefined ? { fontSize: config.fontSize } : {}),
...(light !== undefined ? { light } : {}),
...(dark !== undefined ? { dark } : {}),
};
const hasAnyValue =
style.fontFamily !== undefined ||
style.fontSize !== undefined ||
style.light !== undefined ||
style.dark !== undefined;
return hasAnyValue ? style : undefined;
}).pipe(Effect.orElseSucceed(() => undefined));
-2
View File
@@ -1521,13 +1521,11 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
refName: details.branch, refName: details.branch,
hasWorkingTreeChanges: details.hasWorkingTreeChanges, hasWorkingTreeChanges: details.hasWorkingTreeChanges,
workingTree: details.workingTree, workingTree: details.workingTree,
statusRefName: details.branch,
hasUpstream: details.hasUpstream, hasUpstream: details.hasUpstream,
aheadCount: details.aheadCount, aheadCount: details.aheadCount,
behindCount: details.behindCount, behindCount: details.behindCount,
aheadOfDefaultCount: details.aheadOfDefaultCount, aheadOfDefaultCount: details.aheadOfDefaultCount,
pr: null, pr: null,
changeRequestLookup: { _tag: "pending" as const },
})), })),
); );
@@ -5,7 +5,6 @@ import * as Deferred from "effect/Deferred";
import * as Duration from "effect/Duration"; import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect"; import * as Effect from "effect/Effect";
import * as Exit from "effect/Exit"; import * as Exit from "effect/Exit";
import * as Fiber from "effect/Fiber";
import * as FileSystem from "effect/FileSystem"; import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer"; import * as Layer from "effect/Layer";
import * as Logger from "effect/Logger"; import * as Logger from "effect/Logger";
@@ -40,12 +39,10 @@ const baseLocalStatus: VcsStatusLocalResult = {
}; };
const baseRemoteStatus: VcsStatusRemoteResult = { const baseRemoteStatus: VcsStatusRemoteResult = {
statusRefName: "feature/status-broadcast",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}; };
const remoteStatusWithPr: VcsStatusRemoteResult = { const remoteStatusWithPr: VcsStatusRemoteResult = {
@@ -148,7 +145,6 @@ describe("VcsStatusBroadcaster", () => {
}; };
state.currentRemoteStatus = { state.currentRemoteStatus = {
...baseRemoteStatus, ...baseRemoteStatus,
statusRefName: "feature/updated-status",
aheadCount: 2, aheadCount: 2,
}; };
const refreshed = yield* broadcaster.refreshStatus("/repo"); const refreshed = yield* broadcaster.refreshStatus("/repo");
@@ -170,44 +166,7 @@ describe("VcsStatusBroadcaster", () => {
}).pipe(Effect.provide(makeTestLayer(state))); }).pipe(Effect.provide(makeTestLayer(state)));
}); });
it.effect( it.effect("keeps the cached snapshot unchanged when a refresh branch fails", () => {
"retains a same-branch cached PR across lookup failure and clears it on recovery",
() => {
const state: Parameters<typeof makeTestLayer>[0] = {
currentLocalStatus: baseLocalStatus,
currentRemoteStatus: remoteStatusWithPr,
localStatusCalls: 0,
remoteStatusCalls: 0,
localInvalidationCalls: 0,
remoteInvalidationCalls: 0,
};
return Effect.gen(function* () {
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
yield* broadcaster.getStatus({ cwd: "/repo" });
state.currentRemoteStatus = {
...baseRemoteStatus,
changeRequestLookup: {
_tag: "failed",
provider: "github",
reason: "lookup_failed",
},
};
const failed = yield* broadcaster.refreshChangeRequestStatus("/repo");
assert.deepStrictEqual(failed, {
...state.currentRemoteStatus,
pr: remoteStatusWithPr.pr,
});
state.currentRemoteStatus = baseRemoteStatus;
const recovered = yield* broadcaster.refreshChangeRequestStatus("/repo");
assert.deepStrictEqual(recovered, baseRemoteStatus);
}).pipe(Effect.provide(makeTestLayer(state)));
},
);
it.effect("keeps a successful local refresh when the remote refresh fails", () => {
const state = { const state = {
currentLocalStatus: baseLocalStatus, currentLocalStatus: baseLocalStatus,
currentRemoteStatus: baseRemoteStatus, currentRemoteStatus: baseRemoteStatus,
@@ -269,17 +228,7 @@ describe("VcsStatusBroadcaster", () => {
const cached = yield* broadcaster.getStatus({ cwd: "/repo" }); const cached = yield* broadcaster.getStatus({ cwd: "/repo" });
assert.isTrue(Exit.isFailure(refreshExit)); assert.isTrue(Exit.isFailure(refreshExit));
assert.deepStrictEqual(cached, { assert.deepStrictEqual(cached, baseStatus);
...baseStatus,
...state.currentLocalStatus,
statusRefName: null,
hasUpstream: false,
aheadCount: 0,
behindCount: 0,
aheadOfDefaultCount: 0,
pr: null,
changeRequestLookup: { _tag: "pending" },
});
}).pipe(Effect.provide(testLayer)); }).pipe(Effect.provide(testLayer));
}); });
@@ -310,13 +259,7 @@ describe("VcsStatusBroadcaster", () => {
assert.deepStrictEqual(refreshedLocal, state.currentLocalStatus); assert.deepStrictEqual(refreshedLocal, state.currentLocalStatus);
assert.deepStrictEqual(cached, { assert.deepStrictEqual(cached, {
...state.currentLocalStatus, ...state.currentLocalStatus,
statusRefName: null, ...baseRemoteStatus,
hasUpstream: false,
aheadCount: 0,
behindCount: 0,
aheadOfDefaultCount: 0,
pr: null,
changeRequestLookup: { _tag: "pending" },
}); });
assert.equal(state.localStatusCalls, 2); assert.equal(state.localStatusCalls, 2);
assert.equal(state.remoteStatusCalls, 1); assert.equal(state.remoteStatusCalls, 1);
@@ -426,7 +369,7 @@ describe("VcsStatusBroadcaster", () => {
}).pipe(Effect.provide(makeTestLayer(state))); }).pipe(Effect.provide(makeTestLayer(state)));
}); });
it.effect("keeps lightweight change request polling when Git fetches are disabled", () => { it.effect("loads remote status once when periodic refreshes are disabled", () => {
const state = { const state = {
currentLocalStatus: baseLocalStatus, currentLocalStatus: baseLocalStatus,
currentRemoteStatus: remoteStatusWithPr, currentRemoteStatus: remoteStatusWithPr,
@@ -475,15 +418,8 @@ describe("VcsStatusBroadcaster", () => {
assert.deepStrictEqual(state.remoteStatusRefreshUpstreamValues, [false]); assert.deepStrictEqual(state.remoteStatusRefreshUpstreamValues, [false]);
yield* TestClock.adjust(Duration.minutes(2)); yield* TestClock.adjust(Duration.minutes(2));
assert.equal(state.remoteStatusCalls, 5); assert.equal(state.remoteStatusCalls, 1);
assert.equal(state.remoteInvalidationCalls, 0); assert.equal(state.remoteInvalidationCalls, 0);
assert.deepStrictEqual(state.remoteStatusRefreshUpstreamValues, [
false,
false,
false,
false,
false,
]);
yield* Scope.close(scope, Exit.void); yield* Scope.close(scope, Exit.void);
}).pipe(Effect.provide(Layer.merge(makeTestLayer(state), TestClock.layer()))); }).pipe(Effect.provide(Layer.merge(makeTestLayer(state), TestClock.layer())));
@@ -640,74 +576,17 @@ describe("VcsStatusBroadcaster", () => {
assert.equal(state.remoteInvalidationCalls, 0); assert.equal(state.remoteInvalidationCalls, 0);
yield* TestClock.adjust(Duration.seconds(59)); yield* TestClock.adjust(Duration.seconds(59));
assert.equal(state.remoteStatusCalls, 2); assert.equal(state.remoteStatusCalls, 1);
assert.equal(state.remoteInvalidationCalls, 0);
yield* TestClock.adjust(Duration.seconds(1)); yield* TestClock.adjust(Duration.seconds(1));
yield* Effect.yieldNow; yield* Effect.yieldNow;
assert.equal(state.remoteStatusCalls, 3); assert.equal(state.remoteStatusCalls, 2);
assert.equal(state.remoteInvalidationCalls, 1); assert.equal(state.remoteInvalidationCalls, 1);
yield* Scope.close(scope, Exit.void); yield* Scope.close(scope, Exit.void);
}).pipe(Effect.provide(Layer.merge(makeTestLayer(state), TestClock.layer()))); }).pipe(Effect.provide(Layer.merge(makeTestLayer(state), TestClock.layer())));
}); });
it.effect("retries a failed upstream refresh after the failure backoff", () => {
const refreshUpstreamValues: Array<boolean | undefined> = [];
let failedUpstreamRefresh = false;
const testLayer = VcsStatusBroadcaster.layer.pipe(
Layer.provideMerge(NodeServices.layer),
Layer.provide(
Layer.mock(GitWorkflowService.GitWorkflowService)({
localStatus: () => Effect.succeed(baseLocalStatus),
remoteStatus: (_input, options) => {
refreshUpstreamValues.push(options?.refreshUpstream);
if (options?.refreshUpstream && !failedUpstreamRefresh) {
failedUpstreamRefresh = true;
return Effect.fail(
new GitManagerError({
operation: "VcsStatusBroadcaster.test",
cwd: "/repo",
detail: "upstream refresh failure",
}),
);
}
return Effect.succeed(baseRemoteStatus);
},
invalidateRemoteStatus: () => Effect.void,
}),
),
);
return Effect.gen(function* () {
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
yield* broadcaster.getStatus({ cwd: "/repo" });
const scope = yield* Scope.make();
const snapshotDeferred = yield* Deferred.make<void>();
yield* Stream.runForEach(
broadcaster.streamStatus(
{ cwd: "/repo" },
{ automaticRemoteRefreshInterval: Effect.succeed(Duration.minutes(5)) },
),
(event) =>
event._tag === "snapshot"
? Deferred.succeed(snapshotDeferred, undefined).pipe(Effect.ignore)
: Effect.void,
).pipe(Effect.forkIn(scope));
yield* Deferred.await(snapshotDeferred);
yield* Effect.yieldNow;
yield* TestClock.adjust(Duration.minutes(5));
assert.isTrue(failedUpstreamRefresh);
assert.equal(refreshUpstreamValues.at(-1), true);
yield* TestClock.adjust(Duration.seconds(30));
assert.deepStrictEqual(refreshUpstreamValues.slice(-2), [true, true]);
yield* Scope.close(scope, Exit.void);
}).pipe(Effect.provide(Layer.merge(testLayer, TestClock.layer())));
});
it("backs off remote refresh failures exponentially and honors larger configured intervals", () => { it("backs off remote refresh failures exponentially and honors larger configured intervals", () => {
assert.equal( assert.equal(
Duration.toMillis(VcsStatusBroadcaster.remoteRefreshFailureDelay(1, Duration.seconds(1))), Duration.toMillis(VcsStatusBroadcaster.remoteRefreshFailureDelay(1, Duration.seconds(1))),
@@ -752,104 +631,6 @@ describe("VcsStatusBroadcaster", () => {
}); });
}); });
it.effect("coalesces concurrent lightweight refreshes for the same worktree", () => {
let calls = 0;
return Effect.gen(function* () {
const started = yield* Deferred.make<void>();
const release = yield* Deferred.make<void>();
const testLayer = VcsStatusBroadcaster.layer.pipe(
Layer.provideMerge(NodeServices.layer),
Layer.provide(
Layer.mock(GitWorkflowService.GitWorkflowService)({
remoteStatus: () =>
Effect.sync(() => {
calls += 1;
return calls;
}).pipe(
Effect.flatMap((call) =>
call === 1
? Effect.succeed(baseRemoteStatus)
: Deferred.succeed(started, undefined).pipe(
Effect.ignore,
Effect.andThen(Deferred.await(release)),
Effect.as(baseRemoteStatus),
),
),
),
localStatus: () => Effect.succeed(baseLocalStatus),
}),
),
);
yield* Effect.gen(function* () {
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
yield* broadcaster.getStatus({ cwd: "/repo" });
const firstRefresh = yield* Effect.forkChild(
broadcaster.refreshChangeRequestStatus("/repo"),
);
yield* Deferred.await(started);
const secondRefresh = yield* Effect.forkChild(
broadcaster.refreshChangeRequestStatus("/repo"),
);
yield* Effect.yieldNow;
yield* TestClock.adjust(Duration.millis(10));
yield* Deferred.succeed(release, undefined);
yield* Fiber.join(firstRefresh);
yield* Fiber.join(secondRefresh);
assert.equal(calls, 2);
}).pipe(Effect.provide(testLayer));
});
});
it.effect("does not let an old branch lookup satisfy a queued new branch lookup", () => {
let calls = 0;
let currentRefName = baseLocalStatus.refName;
return Effect.gen(function* () {
const started = yield* Deferred.make<void>();
const release = yield* Deferred.make<void>();
const testLayer = VcsStatusBroadcaster.layer.pipe(
Layer.provideMerge(NodeServices.layer),
Layer.provide(
Layer.mock(GitWorkflowService.GitWorkflowService)({
localStatus: () => Effect.succeed({ ...baseLocalStatus, refName: currentRefName }),
invalidateLocalStatus: () => Effect.void,
remoteStatus: () => {
calls += 1;
const status = { ...baseRemoteStatus, statusRefName: currentRefName };
return calls === 2
? Deferred.succeed(started, undefined).pipe(
Effect.ignore,
Effect.andThen(Deferred.await(release)),
Effect.as(status),
)
: Effect.succeed(status);
},
}),
),
);
yield* Effect.gen(function* () {
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
yield* broadcaster.getStatus({ cwd: "/repo" });
const oldBranchRefresh = yield* Effect.forkChild(
broadcaster.refreshChangeRequestStatus("/repo"),
);
yield* Deferred.await(started);
currentRefName = "feature/new-branch";
yield* broadcaster.refreshLocalStatus("/repo");
const newBranchRefresh = yield* Effect.forkChild(
broadcaster.refreshChangeRequestStatus("/repo"),
);
yield* TestClock.adjust(Duration.millis(10));
yield* Deferred.succeed(release, undefined);
yield* Fiber.join(oldBranchRefresh);
const refreshed = yield* Fiber.join(newBranchRefresh);
assert.equal(calls, 3);
assert.equal(refreshed?.statusRefName, "feature/new-branch");
}).pipe(Effect.provide(testLayer));
});
});
it.effect("stops the remote poller after the last stream subscriber disconnects", () => { it.effect("stops the remote poller after the last stream subscriber disconnects", () => {
const state = { const state = {
currentLocalStatus: baseLocalStatus, currentLocalStatus: baseLocalStatus,
+45 -144
View File
@@ -1,5 +1,4 @@
import * as Cause from "effect/Cause"; import * as Cause from "effect/Cause";
import * as Clock from "effect/Clock";
import * as Context from "effect/Context"; import * as Context from "effect/Context";
import * as Duration from "effect/Duration"; import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect"; import * as Effect from "effect/Effect";
@@ -9,7 +8,7 @@ import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer"; import * as Layer from "effect/Layer";
import * as PubSub from "effect/PubSub"; import * as PubSub from "effect/PubSub";
import * as Ref from "effect/Ref"; import * as Ref from "effect/Ref";
import * as Semaphore from "effect/Semaphore"; import * as Schedule from "effect/Schedule";
import * as Scope from "effect/Scope"; import * as Scope from "effect/Scope";
import * as Stream from "effect/Stream"; import * as Stream from "effect/Stream";
import * as SynchronizedRef from "effect/SynchronizedRef"; import * as SynchronizedRef from "effect/SynchronizedRef";
@@ -134,11 +133,6 @@ interface ActiveRemotePoller {
readonly subscriberCount: number; readonly subscriberCount: number;
} }
interface RefreshLock {
readonly semaphore: Semaphore.Semaphore;
readonly users: number;
}
interface StreamStatusOptions { interface StreamStatusOptions {
readonly automaticRemoteRefreshInterval?: Effect.Effect<Duration.Duration, never>; readonly automaticRemoteRefreshInterval?: Effect.Effect<Duration.Duration, never>;
} }
@@ -166,9 +160,6 @@ export class VcsStatusBroadcaster extends Context.Service<
readonly refreshLocalStatus: ( readonly refreshLocalStatus: (
cwd: string, cwd: string,
) => Effect.Effect<VcsStatusLocalResult, GitManagerServiceError>; ) => Effect.Effect<VcsStatusLocalResult, GitManagerServiceError>;
readonly refreshChangeRequestStatus: (
cwd: string,
) => Effect.Effect<VcsStatusRemoteResult | null, GitManagerServiceError>;
readonly refreshStatus: (cwd: string) => Effect.Effect<VcsStatusResult, GitManagerServiceError>; readonly refreshStatus: (cwd: string) => Effect.Effect<VcsStatusResult, GitManagerServiceError>;
readonly streamStatus: ( readonly streamStatus: (
input: VcsStatusInput, input: VcsStatusInput,
@@ -199,51 +190,6 @@ export const make = Effect.gen(function* () {
); );
const cacheRef = yield* Ref.make(new Map<string, CachedVcsStatus>()); const cacheRef = yield* Ref.make(new Map<string, CachedVcsStatus>());
const pollersRef = yield* SynchronizedRef.make(new Map<string, ActiveRemotePoller>()); const pollersRef = yield* SynchronizedRef.make(new Map<string, ActiveRemotePoller>());
const refreshLocksRef = yield* Ref.make(new Map<string, RefreshLock>());
const refreshLocksGuard = yield* Semaphore.make(1);
const backgroundRefreshSemaphore = yield* Semaphore.make(4);
const lastRemoteRefreshRef = yield* Ref.make(
new Map<string, { readonly completionId: number; readonly refreshUpstream: boolean }>(),
);
const refreshCompletionCounterRef = yield* Ref.make(0);
const withCwdRefreshLock = <A, E, R>(
cwd: string,
effect: Effect.Effect<A, E, R>,
): Effect.Effect<A, E, R> =>
Effect.acquireUseRelease(
refreshLocksGuard.withPermits(1)(
Effect.gen(function* () {
const locks = yield* Ref.get(refreshLocksRef);
const existing = locks.get(cwd);
if (existing) {
yield* Ref.set(
refreshLocksRef,
new Map(locks).set(cwd, { ...existing, users: existing.users + 1 }),
);
return existing.semaphore;
}
const semaphore = yield* Semaphore.make(1);
yield* Ref.set(refreshLocksRef, new Map(locks).set(cwd, { semaphore, users: 1 }));
return semaphore;
}),
),
(lock) => lock.withPermits(1)(effect),
(lock) =>
refreshLocksGuard.withPermits(1)(
Ref.update(refreshLocksRef, (locks) => {
const existing = locks.get(cwd);
if (!existing || existing.semaphore !== lock) return locks;
const next = new Map(locks);
if (existing.users === 1) {
next.delete(cwd);
} else {
next.set(cwd, { ...existing, users: existing.users - 1 });
}
return next;
}),
),
);
const getCachedStatus = Effect.fn("VcsStatusBroadcaster.getCachedStatus")(function* ( const getCachedStatus = Effect.fn("VcsStatusBroadcaster.getCachedStatus")(function* (
cwd: string, cwd: string,
@@ -283,18 +229,9 @@ export const make = Effect.gen(function* () {
const updateCachedRemoteStatus = Effect.fn("VcsStatusBroadcaster.updateCachedRemoteStatus")( const updateCachedRemoteStatus = Effect.fn("VcsStatusBroadcaster.updateCachedRemoteStatus")(
function* (cwd: string, remote: VcsStatusRemoteResult | null, options?: { publish?: boolean }) { function* (cwd: string, remote: VcsStatusRemoteResult | null, options?: { publish?: boolean }) {
const cached = yield* getCachedStatus(cwd);
const previousRemote = cached?.remote?.value ?? null;
const resolvedRemote =
remote?.changeRequestLookup._tag === "failed" &&
remote.pr === null &&
previousRemote?.statusRefName === remote.statusRefName &&
previousRemote.pr !== null
? { ...remote, pr: previousRemote.pr }
: remote;
const nextRemote = { const nextRemote = {
fingerprint: fingerprintStatusPart(resolvedRemote), fingerprint: fingerprintStatusPart(remote),
value: resolvedRemote, value: remote,
} satisfies CachedValue<VcsStatusRemoteResult | null>; } satisfies CachedValue<VcsStatusRemoteResult | null>;
const shouldPublish = yield* Ref.modify(cacheRef, (cache) => { const shouldPublish = yield* Ref.modify(cacheRef, (cache) => {
const previous = cache.get(cwd) ?? { local: null, remote: null }; const previous = cache.get(cwd) ?? { local: null, remote: null };
@@ -311,12 +248,12 @@ export const make = Effect.gen(function* () {
cwd, cwd,
event: { event: {
_tag: "remoteUpdated", _tag: "remoteUpdated",
remote: resolvedRemote, remote,
}, },
}); });
} }
return resolvedRemote; return remote;
}, },
); );
@@ -392,9 +329,7 @@ export const make = Effect.gen(function* () {
const [local, remote] = yield* Effect.all( const [local, remote] = yield* Effect.all(
[ [
cached?.local ? Effect.succeed(cached.local.value) : workflow.localStatus({ cwd }), cached?.local ? Effect.succeed(cached.local.value) : workflow.localStatus({ cwd }),
cached?.remote cached?.remote ? Effect.succeed(cached.remote.value) : workflow.remoteStatus({ cwd }),
? Effect.succeed(cached.remote.value)
: refreshRemoteStatus(cwd, { refreshUpstream: false }),
], ],
{ concurrency: "unbounded" }, { concurrency: "unbounded" },
); );
@@ -420,57 +355,26 @@ export const make = Effect.gen(function* () {
cwd: string, cwd: string,
options?: { readonly refreshUpstream?: boolean }, options?: { readonly refreshUpstream?: boolean },
) { ) {
const wantsUpstream = options?.refreshUpstream !== false; if (options?.refreshUpstream !== false) {
const observedCompletionId = (yield* Ref.get(lastRemoteRefreshRef)).get(cwd)?.completionId ?? 0; yield* workflow.invalidateRemoteStatus(cwd);
return yield* withCwdRefreshLock( }
cwd, const remote = yield* workflow.remoteStatus({ cwd }, options);
backgroundRefreshSemaphore.withPermits(1)( return yield* updateCachedRemoteStatus(cwd, remote, { publish: true });
Effect.gen(function* () {
const previousRefresh = (yield* Ref.get(lastRemoteRefreshRef)).get(cwd);
const cached = yield* getCachedStatus(cwd);
const cachedRemoteMatchesLocal =
cached?.local?.value.refName === cached?.remote?.value?.statusRefName;
if (
previousRefresh &&
previousRefresh.completionId > observedCompletionId &&
(!wantsUpstream || previousRefresh.refreshUpstream) &&
cachedRemoteMatchesLocal
) {
return cached?.remote?.value ?? null;
}
if (wantsUpstream) {
yield* workflow.invalidateRemoteStatus(cwd);
}
const remote = yield* workflow.remoteStatus({ cwd }, options);
const updated = yield* updateCachedRemoteStatus(cwd, remote, { publish: true });
const completionId = yield* Ref.updateAndGet(
refreshCompletionCounterRef,
(current) => current + 1,
);
yield* Ref.update(lastRemoteRefreshRef, (refreshes) =>
new Map(refreshes).set(cwd, { completionId, refreshUpstream: wantsUpstream }),
);
return updated;
}),
),
);
}); });
const refreshChangeRequestStatus: VcsStatusBroadcaster["Service"]["refreshChangeRequestStatus"] =
Effect.fn("VcsStatusBroadcaster.refreshChangeRequestStatus")(function* (rawCwd) {
const cwd = yield* withFileSystem(normalizeCwd(rawCwd));
return yield* refreshRemoteStatus(cwd, { refreshUpstream: false });
});
const refreshStatus: VcsStatusBroadcaster["Service"]["refreshStatus"] = Effect.fn( const refreshStatus: VcsStatusBroadcaster["Service"]["refreshStatus"] = Effect.fn(
"VcsStatusBroadcaster.refreshStatus", "VcsStatusBroadcaster.refreshStatus",
)(function* (rawCwd) { )(function* (rawCwd) {
const cwd = yield* withFileSystem(normalizeCwd(rawCwd)); const cwd = yield* withFileSystem(normalizeCwd(rawCwd));
yield* Effect.all([workflow.invalidateLocalStatus(cwd), workflow.invalidateRemoteStatus(cwd)], {
concurrency: "unbounded",
discard: true,
});
const [local, remote] = yield* Effect.all( const [local, remote] = yield* Effect.all(
[refreshLocalStatusCore(cwd), refreshRemoteStatus(cwd)], [workflow.localStatus({ cwd }), workflow.remoteStatus({ cwd })],
{ concurrency: "unbounded" }, { concurrency: "unbounded" },
); );
return mergeGitStatusParts(local, remote); return yield* updateCachedStatus(cwd, local, remote, { publish: true });
}); });
const makeRemoteRefreshLoop = ( const makeRemoteRefreshLoop = (
@@ -481,39 +385,23 @@ export const make = Effect.gen(function* () {
return Effect.gen(function* () { return Effect.gen(function* () {
const consecutiveFailuresRef = yield* Ref.make(0); const consecutiveFailuresRef = yield* Ref.make(0);
const needsInitialRefreshRef = yield* Ref.make(refreshImmediately); const needsInitialRefreshRef = yield* Ref.make(refreshImmediately);
const now = yield* Clock.currentTimeMillis; const refreshRemoteStatusIfEnabled = Effect.gen(function* () {
const lastLightweightRefreshRef = yield* Ref.make(now);
const lastUpstreamRefreshRef = yield* Ref.make(now);
const runOnce = Effect.fn("VcsStatusBroadcaster.remoteRefreshLoop.runOnce")(function* () {
const configuredInterval = yield* automaticRemoteRefreshInterval; const configuredInterval = yield* automaticRemoteRefreshInterval;
const activeInterval = Duration.isZero(configuredInterval)
? DEFAULT_VCS_STATUS_REFRESH_INTERVAL
: configuredInterval;
const needsInitialRefresh = yield* Ref.get(needsInitialRefreshRef); const needsInitialRefresh = yield* Ref.get(needsInitialRefreshRef);
const currentTime = yield* Clock.currentTimeMillis; if (Duration.isZero(configuredInterval) && !needsInitialRefresh) {
const nextLightweightAt = return activeInterval;
(yield* Ref.get(lastLightweightRefreshRef)) +
Duration.toMillis(DEFAULT_VCS_STATUS_REFRESH_INTERVAL);
const nextUpstreamAt = Duration.isZero(configuredInterval)
? Number.POSITIVE_INFINITY
: (yield* Ref.get(lastUpstreamRefreshRef)) + Duration.toMillis(configuredInterval);
if (!needsInitialRefresh) {
yield* Effect.sleep(
Duration.millis(Math.max(0, Math.min(nextLightweightAt, nextUpstreamAt) - currentTime)),
);
} }
const refreshTime = yield* Clock.currentTimeMillis;
const refreshUpstream =
!Duration.isZero(configuredInterval) &&
(needsInitialRefresh || refreshTime >= nextUpstreamAt);
const exit = yield* refreshRemoteStatus(cwd, { const exit = yield* refreshRemoteStatus(cwd, {
refreshUpstream, refreshUpstream: !Duration.isZero(configuredInterval),
}).pipe(Effect.exit); }).pipe(Effect.exit);
yield* Ref.set(lastLightweightRefreshRef, refreshTime);
if (Exit.isSuccess(exit)) { if (Exit.isSuccess(exit)) {
if (refreshUpstream) yield* Ref.set(lastUpstreamRefreshRef, refreshTime);
yield* Ref.set(needsInitialRefreshRef, false); yield* Ref.set(needsInitialRefreshRef, false);
yield* Ref.set(consecutiveFailuresRef, 0); yield* Ref.set(consecutiveFailuresRef, 0);
return; return activeInterval;
} }
const interruptionReasons = exit.cause.reasons.filter(Cause.isInterruptReason); const interruptionReasons = exit.cause.reasons.filter(Cause.isInterruptReason);
@@ -525,19 +413,33 @@ export const make = Effect.gen(function* () {
consecutiveFailuresRef, consecutiveFailuresRef,
(count) => count + 1, (count) => count + 1,
); );
const nextDelay = remoteRefreshFailureDelay( const nextDelay = remoteRefreshFailureDelay(consecutiveFailures, activeInterval);
consecutiveFailures,
DEFAULT_VCS_STATUS_REFRESH_INTERVAL,
);
yield* Effect.logWarning("VCS remote status refresh failed", { yield* Effect.logWarning("VCS remote status refresh failed", {
cwdLength: cwd.length, cwdLength: cwd.length,
...remoteRefreshFailureDiagnostics(exit.cause), ...remoteRefreshFailureDiagnostics(exit.cause),
consecutiveFailures, consecutiveFailures,
nextDelayMs: Duration.toMillis(nextDelay), nextDelayMs: Duration.toMillis(nextDelay),
}); });
yield* Effect.sleep(nextDelay); return nextDelay;
}); });
return yield* runOnce().pipe(Effect.forever);
if (!refreshImmediately) {
const configuredInterval = yield* automaticRemoteRefreshInterval;
yield* Effect.sleep(
Duration.isZero(configuredInterval)
? DEFAULT_VCS_STATUS_REFRESH_INTERVAL
: configuredInterval,
);
}
return yield* refreshRemoteStatusIfEnabled.pipe(
Effect.repeat(
Schedule.identity<Duration.Duration>().pipe(
Schedule.addDelay((delay) => Effect.succeed(delay)),
),
),
Effect.asVoid,
);
}); });
}; };
@@ -633,7 +535,6 @@ export const make = Effect.gen(function* () {
return VcsStatusBroadcaster.of({ return VcsStatusBroadcaster.of({
getStatus, getStatus,
refreshLocalStatus, refreshLocalStatus,
refreshChangeRequestStatus,
refreshStatus, refreshStatus,
streamStatus, streamStatus,
}); });
+3
View File
@@ -81,6 +81,7 @@ import * as ProviderMaintenanceRunner from "./provider/providerMaintenanceRunner
import * as ServerLifecycleEvents from "./serverLifecycleEvents.ts"; import * as ServerLifecycleEvents from "./serverLifecycleEvents.ts";
import * as ServerRuntimeStartup from "./serverRuntimeStartup.ts"; import * as ServerRuntimeStartup from "./serverRuntimeStartup.ts";
import * as ServerSettings from "./serverSettings.ts"; import * as ServerSettings from "./serverSettings.ts";
import { loadGhosttyTerminalStyle } from "./terminal/ghosttyStyle.ts";
import * as TerminalManager from "./terminal/Manager.ts"; import * as TerminalManager from "./terminal/Manager.ts";
import * as PreviewAutomationBroker from "./mcp/PreviewAutomationBroker.ts"; import * as PreviewAutomationBroker from "./mcp/PreviewAutomationBroker.ts";
import * as PreviewManager from "./preview/Manager.ts"; import * as PreviewManager from "./preview/Manager.ts";
@@ -1065,6 +1066,7 @@ const makeWsRpcLayer = (
const loadServerConfig = Effect.gen(function* () { const loadServerConfig = Effect.gen(function* () {
const keybindingsConfig = yield* keybindings.loadConfigState; const keybindingsConfig = yield* keybindings.loadConfigState;
const terminalStyle = yield* loadGhosttyTerminalStyle;
const providers = yield* providerRegistry.getProviders; const providers = yield* providerRegistry.getProviders;
const settings = ServerSettings.redactServerSettingsForClient( const settings = ServerSettings.redactServerSettingsForClient(
yield* serverSettings.getSettings, yield* serverSettings.getSettings,
@@ -1081,6 +1083,7 @@ const makeWsRpcLayer = (
issues: keybindingsConfig.issues, issues: keybindingsConfig.issues,
providers, providers,
availableEditors: yield* externalLauncher.resolveAvailableEditors(), availableEditors: yield* externalLauncher.resolveAvailableEditors(),
...(terminalStyle !== undefined ? { terminalStyle } : {}),
observability: { observability: {
logsDirectoryPath: config.logsDir, logsDirectoryPath: config.logsDir,
localTracingEnabled: true, localTracingEnabled: true,
+1 -2
View File
@@ -31,10 +31,9 @@
"@t3tools/shared": "workspace:*", "@t3tools/shared": "workspace:*",
"@tanstack/react-pacer": "^0.19.4", "@tanstack/react-pacer": "^0.19.4",
"@tanstack/react-router": "^1.160.2", "@tanstack/react-router": "^1.160.2",
"@xterm/addon-fit": "^0.11.0",
"@xterm/xterm": "^6.0.0",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"effect": "catalog:", "effect": "catalog:",
"ghostty-web": "0.4.0",
"jose": "catalog:", "jose": "catalog:",
"lexical": "^0.41.0", "lexical": "^0.41.0",
"lucide-react": "^0.564.0", "lucide-react": "^0.564.0",
@@ -24,58 +24,14 @@ function status(overrides: Partial<VcsStatusResult> = {}): VcsStatusResult {
insertions: 0, insertions: 0,
deletions: 0, deletions: 0,
}, },
statusRefName: "feature/test",
hasUpstream: true, hasUpstream: true,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
...overrides, ...overrides,
}; };
} }
describe("when: change request lookup is not confirmed", () => {
it.each([
{ _tag: "pending" as const },
{
_tag: "failed" as const,
provider: "github" as const,
reason: "authentication_required" as const,
},
])("never offers PR creation for $._tag lookup", (changeRequestLookup) => {
const gitStatus = status({ aheadCount: 2, changeRequestLookup });
assert.equal(resolveQuickAction(gitStatus, false).action, "push");
const prItem = buildMenuItems(gitStatus, false).find((item) => item.id === "pr");
assert.equal(prItem?.disabled, true);
assert.notEqual(prItem?.label, "Create PR");
});
it("keeps an existing PR actionable when a refresh fails", () => {
const gitStatus = status({
pr: {
number: 42,
title: "Existing PR",
url: "https://example.com/pr/42",
baseRef: "main",
headRef: "feature/test",
state: "open",
},
changeRequestLookup: {
_tag: "failed",
provider: "github",
reason: "lookup_failed",
},
});
assert.equal(resolveQuickAction(gitStatus, false).kind, "open_pr");
assert.equal(
buildMenuItems(gitStatus, false).find((item) => item.id === "pr")?.label,
"View PR",
);
});
});
describe("when: ref is clean and has an open PR", () => { describe("when: ref is clean and has an open PR", () => {
it("resolveQuickAction opens the existing PR", () => { it("resolveQuickAction opens the existing PR", () => {
const quick = resolveQuickAction( const quick = resolveQuickAction(
@@ -3,11 +3,7 @@ import type {
GitStackedAction, GitStackedAction,
VcsStatusResult, VcsStatusResult,
} from "@t3tools/contracts"; } from "@t3tools/contracts";
import { import { isTemporaryWorktreeBranch } from "@t3tools/shared/git";
canCreateChangeRequest,
getChangeRequestAvailability,
isTemporaryWorktreeBranch,
} from "@t3tools/shared/git";
import { import {
DEFAULT_CHANGE_REQUEST_TERMINOLOGY, DEFAULT_CHANGE_REQUEST_TERMINOLOGY,
getChangeRequestTerminology, getChangeRequestTerminology,
@@ -105,9 +101,7 @@ export function buildMenuItems(
const hasBranch = gitStatus.refName !== null; const hasBranch = gitStatus.refName !== null;
const hasChanges = gitStatus.hasWorkingTreeChanges; const hasChanges = gitStatus.hasWorkingTreeChanges;
const changeRequestAvailability = getChangeRequestAvailability(gitStatus); const hasOpenPr = gitStatus.pr?.state === "open";
const hasOpenPr = changeRequestAvailability === "open";
const lookupSucceeded = changeRequestAvailability === "available";
const isBehind = gitStatus.behindCount > 0; const isBehind = gitStatus.behindCount > 0;
const hasDefaultBranchDelta = (gitStatus.aheadOfDefaultCount ?? gitStatus.aheadCount) > 0; const hasDefaultBranchDelta = (gitStatus.aheadOfDefaultCount ?? gitStatus.aheadCount) > 0;
const canPushWithoutUpstream = hasPrimaryRemote && !gitStatus.hasUpstream; const canPushWithoutUpstream = hasPrimaryRemote && !gitStatus.hasUpstream;
@@ -122,7 +116,7 @@ export function buildMenuItems(
!isBusy && !isBusy &&
hasBranch && hasBranch &&
!hasChanges && !hasChanges &&
canCreateChangeRequest(gitStatus) && !hasOpenPr &&
hasDefaultBranchDelta && hasDefaultBranchDelta &&
!isBehind && !isBehind &&
(gitStatus.hasUpstream || canPushWithoutUpstream); (gitStatus.hasUpstream || canPushWithoutUpstream);
@@ -161,11 +155,7 @@ export function buildMenuItems(
} }
: { : {
id: "pr", id: "pr",
label: lookupSucceeded label: `Create ${terminology.shortLabel}`,
? `Create ${terminology.shortLabel}`
: changeRequestAvailability === "pending"
? `Checking ${terminology.shortLabel} status`
: `${terminology.shortLabel} status unavailable`,
disabled: !canCreatePr, disabled: !canCreatePr,
icon: "pr", icon: "pr",
kind: "open_dialog", kind: "open_dialog",
@@ -195,9 +185,7 @@ export function resolveQuickAction(
const hasBranch = gitStatus.refName !== null; const hasBranch = gitStatus.refName !== null;
const hasChanges = gitStatus.hasWorkingTreeChanges; const hasChanges = gitStatus.hasWorkingTreeChanges;
const changeRequestAvailability = getChangeRequestAvailability(gitStatus); const hasOpenPr = gitStatus.pr?.state === "open";
const hasOpenPr = changeRequestAvailability === "open";
const lookupSucceeded = changeRequestAvailability === "available";
const isAhead = gitStatus.aheadCount > 0; const isAhead = gitStatus.aheadCount > 0;
const hasDefaultBranchDelta = (gitStatus.aheadOfDefaultCount ?? gitStatus.aheadCount) > 0; const hasDefaultBranchDelta = (gitStatus.aheadOfDefaultCount ?? gitStatus.aheadCount) > 0;
const isBehind = gitStatus.behindCount > 0; const isBehind = gitStatus.behindCount > 0;
@@ -217,7 +205,7 @@ export function resolveQuickAction(
if (!gitStatus.hasUpstream && !hasPrimaryRemote) { if (!gitStatus.hasUpstream && !hasPrimaryRemote) {
return { label: "Commit", disabled: false, kind: "run_action", action: "commit" }; return { label: "Commit", disabled: false, kind: "run_action", action: "commit" };
} }
if (hasOpenPr || isDefaultRef || !lookupSucceeded) { if (hasOpenPr || isDefaultRef) {
return { label: "Commit & push", disabled: false, kind: "run_action", action: "commit_push" }; return { label: "Commit & push", disabled: false, kind: "run_action", action: "commit_push" };
} }
return { return {
@@ -250,7 +238,7 @@ export function resolveQuickAction(
hint: "No local commits to push.", hint: "No local commits to push.",
}; };
} }
if (hasOpenPr || isDefaultRef || !lookupSucceeded) { if (hasOpenPr || isDefaultRef) {
return { return {
label: "Push", label: "Push",
disabled: false, disabled: false,
@@ -284,7 +272,7 @@ export function resolveQuickAction(
} }
if (isAhead) { if (isAhead) {
if (hasOpenPr || isDefaultRef || !lookupSucceeded) { if (hasOpenPr || isDefaultRef) {
return { return {
label: "Push", label: "Push",
disabled: false, disabled: false,
@@ -304,21 +292,6 @@ export function resolveQuickAction(
return { label: `View ${terminology.shortLabel}`, disabled: false, kind: "open_pr" }; return { label: `View ${terminology.shortLabel}`, disabled: false, kind: "open_pr" };
} }
if (!lookupSucceeded) {
return {
label:
changeRequestAvailability === "pending"
? `Checking ${terminology.shortLabel} status`
: `${terminology.shortLabel} status unavailable`,
disabled: true,
kind: "show_hint",
hint:
changeRequestAvailability === "pending"
? `Checking for an existing ${terminology.singular}.`
: `${terminology.shortLabel} status could not be checked.`,
};
}
if (hasDefaultBranchDelta && !isDefaultRef) { if (hasDefaultBranchDelta && !isDefaultRef) {
return { return {
label: `Create ${terminology.shortLabel}`, label: `Create ${terminology.shortLabel}`,
-18
View File
@@ -21,7 +21,6 @@ import {
ThreadStatusLabel, ThreadStatusLabel,
ThreadWorktreeIndicator, ThreadWorktreeIndicator,
} from "./ThreadStatusIndicators"; } from "./ThreadStatusIndicators";
import { changeRequestLookupWarning } from "./ThreadStatusIndicators.logic";
import { ProjectFavicon } from "./ProjectFavicon"; import { ProjectFavicon } from "./ProjectFavicon";
import { useAtomValue } from "@effect/atom-react"; import { useAtomValue } from "@effect/atom-react";
import { autoAnimate } from "@formkit/auto-animate"; import { autoAnimate } from "@formkit/auto-animate";
@@ -471,7 +470,6 @@ export const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThr
}); });
const pr = resolveThreadPr(thread.branch, gitStatus.data); const pr = resolveThreadPr(thread.branch, gitStatus.data);
const prStatus = prStatusIndicator(pr, gitStatus.data?.sourceControlProvider); const prStatus = prStatusIndicator(pr, gitStatus.data?.sourceControlProvider);
const lookupWarning = changeRequestLookupWarning(thread.branch, gitStatus.data);
const terminalStatus = terminalStatusFromRunningIds(runningTerminalIds); const terminalStatus = terminalStatusFromRunningIds(runningTerminalIds);
const isConfirmingArchive = confirmingArchiveThreadKey === threadKey && !isThreadRunning; const isConfirmingArchive = confirmingArchiveThreadKey === threadKey && !isThreadRunning;
const threadMetaClassName = isConfirmingArchive const threadMetaClassName = isConfirmingArchive
@@ -713,22 +711,6 @@ export const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThr
<TooltipPopup side="top">{prStatus.tooltip}</TooltipPopup> <TooltipPopup side="top">{prStatus.tooltip}</TooltipPopup>
</Tooltip> </Tooltip>
)} )}
{lookupWarning && (
<Tooltip>
<TooltipTrigger
render={
<span
role="img"
aria-label={lookupWarning}
className="inline-flex items-center justify-center text-amber-600/70 dark:text-amber-300/70"
/>
}
>
<TriangleAlertIcon className="size-3" />
</TooltipTrigger>
<TooltipPopup side="top">{lookupWarning}</TooltipPopup>
</Tooltip>
)}
{threadStatus && <ThreadStatusLabel status={threadStatus} />} {threadStatus && <ThreadStatusLabel status={threadStatus} />}
{renamingThreadKey === threadKey ? ( {renamingThreadKey === threadKey ? (
<input <input
@@ -1,26 +0,0 @@
import type { VcsStatusResult } from "@t3tools/contracts";
import { resolveChangeRequestPresentation } from "../sourceControlPresentation";
export function changeRequestLookupWarning(
threadBranch: string | null,
gitStatus: VcsStatusResult | null,
): string | null {
if (
threadBranch === null ||
gitStatus === null ||
gitStatus.refName !== threadBranch ||
gitStatus.changeRequestLookup._tag !== "failed"
) {
return null;
}
const presentation = resolveChangeRequestPresentation(gitStatus.sourceControlProvider);
switch (gitStatus.changeRequestLookup.reason) {
case "authentication_required":
return `${presentation.shortName} status unavailable: authentication required.`;
case "provider_unavailable":
return `${presentation.shortName} status unavailable: provider integration unavailable.`;
case "lookup_failed":
return `${presentation.shortName} status unavailable: lookup failed.`;
}
}
@@ -1,58 +1,9 @@
import { ThreadId, type VcsStatusResult } from "@t3tools/contracts"; import { ThreadId } from "@t3tools/contracts";
import { renderToStaticMarkup } from "react-dom/server"; import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it } from "vite-plus/test"; import { describe, expect, it } from "vite-plus/test";
import { changeRequestLookupWarning } from "./ThreadStatusIndicators.logic";
import { ThreadWorktreeIndicator } from "./ThreadStatusIndicators"; import { ThreadWorktreeIndicator } from "./ThreadStatusIndicators";
const failedStatus: VcsStatusResult = {
isRepo: true,
sourceControlProvider: { kind: "github", name: "GitHub", baseUrl: "https://github.com" },
hasPrimaryRemote: true,
isDefaultRef: false,
refName: "feature/sidebar-indicator",
hasWorkingTreeChanges: false,
workingTree: { files: [], insertions: 0, deletions: 0 },
statusRefName: "feature/sidebar-indicator",
hasUpstream: true,
aheadCount: 0,
behindCount: 0,
pr: null,
changeRequestLookup: {
_tag: "failed",
provider: "github",
reason: "authentication_required",
},
};
describe("changeRequestLookupWarning", () => {
it("returns actionable provider copy for the matching thread branch", () => {
expect(changeRequestLookupWarning("feature/sidebar-indicator", failedStatus)).toBe(
"PR status unavailable: authentication required.",
);
});
it("does not leak warnings across branches", () => {
expect(changeRequestLookupWarning("feature/other", failedStatus)).toBeNull();
});
it("keeps the refresh warning when a cached open PR remains actionable", () => {
expect(
changeRequestLookupWarning("feature/sidebar-indicator", {
...failedStatus,
pr: {
number: 42,
title: "Cached open PR",
url: "https://example.com/pr/42",
baseRef: "main",
headRef: "feature/sidebar-indicator",
state: "open",
},
}),
).toBe("PR status unavailable: authentication required.");
});
});
describe("ThreadWorktreeIndicator", () => { describe("ThreadWorktreeIndicator", () => {
it("renders the worktree folder and branch in an accessible label", () => { it("renders the worktree folder and branch in an accessible label", () => {
const markup = renderToStaticMarkup( const markup = renderToStaticMarkup(
@@ -4,13 +4,7 @@ import {
scopeThreadRef, scopeThreadRef,
} from "@t3tools/client-runtime/environment"; } from "@t3tools/client-runtime/environment";
import type { VcsStatusResult } from "@t3tools/contracts"; import type { VcsStatusResult } from "@t3tools/contracts";
import { import { CloudIcon, FolderGit2Icon, GitPullRequestIcon, TerminalIcon } from "lucide-react";
CloudIcon,
FolderGit2Icon,
GitPullRequestIcon,
TerminalIcon,
TriangleAlertIcon,
} from "lucide-react";
import { useMemo } from "react"; import { useMemo } from "react";
import { useEnvironment, usePrimaryEnvironmentId } from "../state/environments"; import { useEnvironment, usePrimaryEnvironmentId } from "../state/environments";
import { useProject } from "../state/entities"; import { useProject } from "../state/entities";
@@ -20,7 +14,6 @@ import { vcsEnvironment } from "../state/vcs";
import { useUiStateStore } from "../uiStateStore"; import { useUiStateStore } from "../uiStateStore";
import { resolveChangeRequestPresentation } from "../sourceControlPresentation"; import { resolveChangeRequestPresentation } from "../sourceControlPresentation";
import { resolveThreadStatusPill, type ThreadStatusPill } from "./Sidebar.logic"; import { resolveThreadStatusPill, type ThreadStatusPill } from "./Sidebar.logic";
import { changeRequestLookupWarning } from "./ThreadStatusIndicators.logic";
import type { SidebarThreadSummary } from "../types"; import type { SidebarThreadSummary } from "../types";
import { formatWorktreePathForDisplay } from "../worktreeCleanup"; import { formatWorktreePathForDisplay } from "../worktreeCleanup";
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip"; import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
@@ -215,7 +208,6 @@ export function ThreadRowLeadingStatus({ thread }: { thread: SidebarThreadSummar
); );
const pr = resolveThreadPr(thread.branch, gitStatus.data); const pr = resolveThreadPr(thread.branch, gitStatus.data);
const prStatus = prStatusIndicator(pr, gitStatus.data?.sourceControlProvider); const prStatus = prStatusIndicator(pr, gitStatus.data?.sourceControlProvider);
const lookupWarning = changeRequestLookupWarning(thread.branch, gitStatus.data);
const threadStatus = resolveThreadStatusPill({ const threadStatus = resolveThreadStatusPill({
thread: { thread: {
...thread, ...thread,
@@ -223,7 +215,7 @@ export function ThreadRowLeadingStatus({ thread }: { thread: SidebarThreadSummar
}, },
}); });
if (!prStatus && !lookupWarning && !threadStatus) { if (!prStatus && !threadStatus) {
return null; return null;
} }
@@ -244,21 +236,6 @@ export function ThreadRowLeadingStatus({ thread }: { thread: SidebarThreadSummar
<TooltipPopup side="top">{prStatus.tooltip}</TooltipPopup> <TooltipPopup side="top">{prStatus.tooltip}</TooltipPopup>
</Tooltip> </Tooltip>
) : null} ) : null}
{lookupWarning ? (
<Tooltip>
<TooltipTrigger
render={
<span
aria-label={lookupWarning}
className="inline-flex items-center justify-center text-amber-600/70 dark:text-amber-300/70"
/>
}
>
<TriangleAlertIcon className="size-3" />
</TooltipTrigger>
<TooltipPopup side="top">{lookupWarning}</TooltipPopup>
</Tooltip>
) : null}
{threadStatus ? <ThreadStatusLabel status={threadStatus} /> : null} {threadStatus ? <ThreadStatusLabel status={threadStatus} /> : null}
</span> </span>
); );
File diff suppressed because it is too large. Load diff
@@ -329,8 +329,7 @@ function GitFetchIntervalSettings() {
</div> </div>
<p className="max-w-2xl text-xs leading-relaxed text-muted-foreground"> <p className="max-w-2xl text-xs leading-relaxed text-muted-foreground">
Refresh remote branch status in the background. Set this to 0 seconds if Git credentials Refresh remote branch status in the background. Set this to 0 seconds if Git credentials
or security keys should only be prompted by explicit Git actions. Lightweight pull or or security keys should only be prompted by explicit Git actions.
merge request status checks continue without fetching Git remotes.
</p> </p>
</div> </div>
<div className="flex shrink-0 items-center gap-2"> <div className="flex shrink-0 items-center gap-2">
-1
View File
@@ -8,7 +8,6 @@ import { createHashHistory, createBrowserHistory } from "@tanstack/react-router"
import "@fontsource-variable/dm-sans/index.css"; import "@fontsource-variable/dm-sans/index.css";
import "@fontsource/jetbrains-mono/400.css"; import "@fontsource/jetbrains-mono/400.css";
import "@fontsource/jetbrains-mono/500.css"; import "@fontsource/jetbrains-mono/500.css";
import "@xterm/xterm/css/xterm.css";
import "./index.css"; import "./index.css";
import { isElectron } from "./env"; import { isElectron } from "./env";
+35
View File
@@ -0,0 +1,35 @@
import { describe, expect, it } from "vite-plus/test";
import { shouldFocusTerminalAfterSetup } from "./terminal-focus";
describe("shouldFocusTerminalAfterSetup", () => {
it("focuses the active terminal on its first setup", () => {
expect(
shouldFocusTerminalAfterSetup({
autoFocus: true,
hasMounted: false,
restorePreviousTerminalFocus: false,
}),
).toBe(true);
});
it("does not steal focus when terminal style causes a remount", () => {
expect(
shouldFocusTerminalAfterSetup({
autoFocus: true,
hasMounted: true,
restorePreviousTerminalFocus: false,
}),
).toBe(false);
});
it("restores focus when the terminal itself was focused before remount", () => {
expect(
shouldFocusTerminalAfterSetup({
autoFocus: false,
hasMounted: true,
restorePreviousTerminalFocus: true,
}),
).toBe(true);
});
});
+7
View File
@@ -0,0 +1,7 @@
export function shouldFocusTerminalAfterSetup(input: {
readonly autoFocus: boolean;
readonly hasMounted: boolean;
readonly restorePreviousTerminalFocus: boolean;
}): boolean {
return input.restorePreviousTerminalFocus || (!input.hasMounted && input.autoFocus);
}
+18
View File
@@ -37,6 +37,24 @@ describe("extractTerminalLinks", () => {
]); ]);
}); });
it("finds non-http scheme urls", () => {
const line = "email mailto:[email protected] or clone ssh://[email protected]/t3/t3code.git now";
expect(extractTerminalLinks(line)).toEqual([
{
kind: "url",
text: "mailto:[email protected]",
start: 6,
end: 28,
},
{
kind: "url",
text: "ssh://[email protected]/t3/t3code.git",
start: 38,
end: 72,
},
]);
});
it("trims trailing punctuation from links", () => { it("trims trailing punctuation from links", () => {
const line = "(https://example.com/docs), ./src/main.ts:12."; const line = "(https://example.com/docs), ./src/main.ts:12.";
expect(extractTerminalLinks(line)).toEqual([ expect(extractTerminalLinks(line)).toEqual([
+4 -1
View File
@@ -36,7 +36,10 @@ export interface WrappedTerminalLinkLine {
segments: ReadonlyArray<WrappedTerminalLinkLineSegment>; segments: ReadonlyArray<WrappedTerminalLinkLineSegment>;
} }
const URL_PATTERN = /https?:\/\/[^\s"'`<>]+/g; // Also matches the non-http schemes ghostty and other terminals linkify;
// authority-style schemes require // while opaque ones take a bare payload.
const URL_PATTERN =
/(?:https?|ftp|ssh|git|gemini|gopher):\/\/[^\s"'`<>]+|(?:mailto|tel|news|magnet):[^\s"'`<>:][^\s"'`<>]*/g;
const FILE_PATH_PATTERN = const FILE_PATH_PATTERN =
/(?:~\/|\.{1,2}\/|\/|[A-Za-z]:[\\/]|\\\\)[^\s"'`<>]+|[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)+(?::\d+){0,2}/g; /(?:~\/|\.{1,2}\/|\/|[A-Za-z]:[\\/]|\\\\)[^\s"'`<>]+|[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)+(?::\d+){0,2}/g;
const TRAILING_PUNCTUATION_PATTERN = /[.,;!?]+$/; const TRAILING_PUNCTUATION_PATTERN = /[.,;!?]+$/;
@@ -1,64 +0,0 @@
import type { VcsStatusResult } from "@t3tools/contracts";
import { describe, expect, it } from "vite-plus/test";
import { buildMenuItems, resolveQuickAction } from "./gitActions.ts";
function status(overrides: Partial<VcsStatusResult> = {}): VcsStatusResult {
return {
isRepo: true,
hasPrimaryRemote: true,
isDefaultRef: false,
refName: "feature/test",
hasWorkingTreeChanges: false,
workingTree: { files: [], insertions: 0, deletions: 0 },
statusRefName: "feature/test",
hasUpstream: true,
aheadCount: 0,
behindCount: 0,
pr: null,
changeRequestLookup: { _tag: "succeeded" },
...overrides,
};
}
describe("change request certainty", () => {
it.each([
{ _tag: "pending" as const },
{
_tag: "failed" as const,
provider: "github" as const,
reason: "lookup_failed" as const,
},
])("never creates a PR while lookup is $._tag", (changeRequestLookup) => {
const ahead = status({ aheadCount: 1, changeRequestLookup });
const dirty = status({ hasWorkingTreeChanges: true, changeRequestLookup });
expect(resolveQuickAction(ahead, false).action).toBe("push");
expect(resolveQuickAction(dirty, false).action).toBe("commit_push");
expect(buildMenuItems(ahead, false).find((item) => item.id === "pr")?.disabled).toBe(true);
});
it("allows creation after a successful lookup confirms absence", () => {
expect(resolveQuickAction(status({ aheadCount: 1 }), false).action).toBe("create_pr");
});
it("keeps a cached open PR actionable when lookup fails", () => {
const gitStatus = status({
pr: {
number: 42,
title: "Existing PR",
url: "https://example.com/pr/42",
baseRef: "main",
headRef: "feature/test",
state: "open",
},
changeRequestLookup: {
_tag: "failed",
provider: "github",
reason: "lookup_failed",
},
});
expect(resolveQuickAction(gitStatus, false).kind).toBe("open_pr");
});
});
@@ -4,11 +4,7 @@ import type {
GitStackedAction, GitStackedAction,
VcsStatusResult, VcsStatusResult,
} from "@t3tools/contracts"; } from "@t3tools/contracts";
import { import { isTemporaryWorktreeBranch } from "@t3tools/shared/git";
canCreateChangeRequest,
getChangeRequestAvailability,
isTemporaryWorktreeBranch,
} from "@t3tools/shared/git";
export type GitActionIconName = "commit" | "push" | "pr"; export type GitActionIconName = "commit" | "push" | "pr";
@@ -95,9 +91,7 @@ export function buildMenuItems(
const hasBranch = gitStatus.refName !== null; const hasBranch = gitStatus.refName !== null;
const hasChanges = gitStatus.hasWorkingTreeChanges; const hasChanges = gitStatus.hasWorkingTreeChanges;
const changeRequestAvailability = getChangeRequestAvailability(gitStatus); const hasOpenPr = gitStatus.pr?.state === "open";
const hasOpenPr = changeRequestAvailability === "open";
const lookupSucceeded = changeRequestAvailability === "available";
const isBehind = gitStatus.behindCount > 0; const isBehind = gitStatus.behindCount > 0;
const canPushWithoutUpstream = hasOriginRemote && !gitStatus.hasUpstream; const canPushWithoutUpstream = hasOriginRemote && !gitStatus.hasUpstream;
const canCommit = !isBusy && hasChanges; const canCommit = !isBusy && hasChanges;
@@ -112,7 +106,7 @@ export function buildMenuItems(
!isBusy && !isBusy &&
hasBranch && hasBranch &&
!hasChanges && !hasChanges &&
canCreateChangeRequest(gitStatus) && !hasOpenPr &&
gitStatus.aheadCount > 0 && gitStatus.aheadCount > 0 &&
!isBehind && !isBehind &&
(gitStatus.hasUpstream || canPushWithoutUpstream); (gitStatus.hasUpstream || canPushWithoutUpstream);
@@ -145,11 +139,7 @@ export function buildMenuItems(
} }
: { : {
id: "pr", id: "pr",
label: lookupSucceeded label: "Create PR",
? "Create PR"
: changeRequestAvailability === "pending"
? "Checking PR status"
: "PR status unavailable",
disabled: !canCreatePr, disabled: !canCreatePr,
icon: "pr", icon: "pr",
kind: "open_dialog", kind: "open_dialog",
@@ -179,9 +169,7 @@ export function resolveQuickAction(
const hasBranch = gitStatus.refName !== null; const hasBranch = gitStatus.refName !== null;
const hasChanges = gitStatus.hasWorkingTreeChanges; const hasChanges = gitStatus.hasWorkingTreeChanges;
const changeRequestAvailability = getChangeRequestAvailability(gitStatus); const hasOpenPr = gitStatus.pr?.state === "open";
const hasOpenPr = changeRequestAvailability === "open";
const lookupSucceeded = changeRequestAvailability === "available";
const isAhead = gitStatus.aheadCount > 0; const isAhead = gitStatus.aheadCount > 0;
const isBehind = gitStatus.behindCount > 0; const isBehind = gitStatus.behindCount > 0;
const isDiverged = isAhead && isBehind; const isDiverged = isAhead && isBehind;
@@ -199,7 +187,7 @@ export function resolveQuickAction(
if (!gitStatus.hasUpstream && !hasOriginRemote) { if (!gitStatus.hasUpstream && !hasOriginRemote) {
return { label: "Commit", disabled: false, kind: "run_action", action: "commit" }; return { label: "Commit", disabled: false, kind: "run_action", action: "commit" };
} }
if (hasOpenPr || isDefaultBranch || !lookupSucceeded) { if (hasOpenPr || isDefaultBranch) {
return { label: "Commit & push", disabled: false, kind: "run_action", action: "commit_push" }; return { label: "Commit & push", disabled: false, kind: "run_action", action: "commit_push" };
} }
return { return {
@@ -233,7 +221,7 @@ export function resolveQuickAction(
hint: "No local commits to push.", hint: "No local commits to push.",
}; };
} }
if (hasOpenPr || isDefaultBranch || !lookupSucceeded) { if (hasOpenPr || isDefaultBranch) {
return { return {
label: "Push", label: "Push",
disabled: false, disabled: false,
@@ -267,7 +255,7 @@ export function resolveQuickAction(
} }
if (isAhead) { if (isAhead) {
if (hasOpenPr || isDefaultBranch || !lookupSucceeded) { if (hasOpenPr || isDefaultBranch) {
return { return {
label: "Push", label: "Push",
disabled: false, disabled: false,
@@ -287,19 +275,6 @@ export function resolveQuickAction(
return { label: "View PR", disabled: false, kind: "open_pr" }; return { label: "View PR", disabled: false, kind: "open_pr" };
} }
if (!lookupSucceeded) {
return {
label:
changeRequestAvailability === "pending" ? "Checking PR status" : "PR status unavailable",
disabled: true,
kind: "show_hint",
hint:
changeRequestAvailability === "pending"
? "Checking for an existing PR."
: "PR status could not be checked.",
};
}
return { return {
label: "Commit", label: "Commit",
disabled: true, disabled: true,
-14
View File
@@ -7,7 +7,6 @@ import {
GitRunStackedActionResult, GitRunStackedActionResult,
GitRunStackedActionInput, GitRunStackedActionInput,
GitResolvePullRequestResult, GitResolvePullRequestResult,
VcsStatusChangeRequestLookup,
} from "./git.ts"; } from "./git.ts";
const decodeCreateWorktreeInput = Schema.decodeUnknownSync(VcsCreateWorktreeInput); const decodeCreateWorktreeInput = Schema.decodeUnknownSync(VcsCreateWorktreeInput);
@@ -17,19 +16,6 @@ const decodePreparePullRequestThreadInput = Schema.decodeUnknownSync(
const decodeRunStackedActionInput = Schema.decodeUnknownSync(GitRunStackedActionInput); const decodeRunStackedActionInput = Schema.decodeUnknownSync(GitRunStackedActionInput);
const decodeRunStackedActionResult = Schema.decodeUnknownSync(GitRunStackedActionResult); const decodeRunStackedActionResult = Schema.decodeUnknownSync(GitRunStackedActionResult);
const decodeResolvePullRequestResult = Schema.decodeUnknownSync(GitResolvePullRequestResult); const decodeResolvePullRequestResult = Schema.decodeUnknownSync(GitResolvePullRequestResult);
const decodeChangeRequestLookup = Schema.decodeUnknownSync(VcsStatusChangeRequestLookup);
describe("VcsStatusChangeRequestLookup", () => {
it.each([
{ _tag: "pending" },
{ _tag: "succeeded" },
{ _tag: "failed", provider: "github", reason: "authentication_required" },
{ _tag: "failed", provider: "gitlab", reason: "provider_unavailable" },
{ _tag: "failed", provider: "bitbucket", reason: "lookup_failed" },
])("decodes provider-neutral lookup state $._tag", (lookup) => {
expect(decodeChangeRequestLookup(lookup)).toEqual(lookup);
});
});
describe("VcsCreateWorktreeInput", () => { describe("VcsCreateWorktreeInput", () => {
it("accepts omitted newRefName for existing-refName worktrees", () => { it("accepts omitted newRefName for existing-refName worktrees", () => {
+1 -17
View File
@@ -1,10 +1,6 @@
import * as Schema from "effect/Schema"; import * as Schema from "effect/Schema";
import { NonNegativeInt, PositiveInt, ThreadId, TrimmedNonEmptyString } from "./baseSchemas.ts"; import { NonNegativeInt, PositiveInt, ThreadId, TrimmedNonEmptyString } from "./baseSchemas.ts";
import { import { SourceControlProviderError, SourceControlProviderInfo } from "./sourceControl.ts";
SourceControlProviderError,
SourceControlProviderInfo,
SourceControlProviderKind,
} from "./sourceControl.ts";
import { VcsDriverKind } from "./vcs.ts"; import { VcsDriverKind } from "./vcs.ts";
const TrimmedNonEmptyStringSchema = TrimmedNonEmptyString; const TrimmedNonEmptyStringSchema = TrimmedNonEmptyString;
@@ -202,16 +198,6 @@ const VcsStatusChangeRequest = Schema.Struct({
state: VcsStatusChangeRequestState, state: VcsStatusChangeRequestState,
}); });
export const VcsStatusChangeRequestLookup = Schema.Union([
Schema.TaggedStruct("pending", {}),
Schema.TaggedStruct("succeeded", {}),
Schema.TaggedStruct("failed", {
provider: SourceControlProviderKind,
reason: Schema.Literals(["authentication_required", "provider_unavailable", "lookup_failed"]),
}),
]);
export type VcsStatusChangeRequestLookup = typeof VcsStatusChangeRequestLookup.Type;
const VcsStatusLocalShape = { const VcsStatusLocalShape = {
isRepo: Schema.Boolean, isRepo: Schema.Boolean,
sourceControlProvider: Schema.optional(SourceControlProviderInfo), sourceControlProvider: Schema.optional(SourceControlProviderInfo),
@@ -233,13 +219,11 @@ const VcsStatusLocalShape = {
}; };
const VcsStatusRemoteShape = { const VcsStatusRemoteShape = {
statusRefName: Schema.NullOr(TrimmedNonEmptyStringSchema),
hasUpstream: Schema.Boolean, hasUpstream: Schema.Boolean,
aheadCount: NonNegativeInt, aheadCount: NonNegativeInt,
behindCount: NonNegativeInt, behindCount: NonNegativeInt,
aheadOfDefaultCount: Schema.optional(NonNegativeInt), aheadOfDefaultCount: Schema.optional(NonNegativeInt),
pr: Schema.NullOr(VcsStatusChangeRequest), pr: Schema.NullOr(VcsStatusChangeRequest),
changeRequestLookup: VcsStatusChangeRequestLookup,
}; };
export const VcsStatusLocalResult = Schema.Struct(VcsStatusLocalShape); export const VcsStatusLocalResult = Schema.Struct(VcsStatusLocalShape);
+24
View File
@@ -406,6 +406,28 @@ export const ServerSignalProcessResult = Schema.Struct({
}); });
export type ServerSignalProcessResult = typeof ServerSignalProcessResult.Type; export type ServerSignalProcessResult = typeof ServerSignalProcessResult.Type;
/** Terminal colors parsed from the user's Ghostty theme (hex strings like "#1e1e2e"). */
export const ServerTerminalThemeColors = Schema.Struct({
background: Schema.optional(TrimmedNonEmptyString),
foreground: Schema.optional(TrimmedNonEmptyString),
cursor: Schema.optional(TrimmedNonEmptyString),
selectionBackground: Schema.optional(TrimmedNonEmptyString),
selectionForeground: Schema.optional(TrimmedNonEmptyString),
/** ANSI palette slots 0-15; empty string for slots the theme does not define. */
palette: Schema.optional(Schema.Array(Schema.String)),
});
export type ServerTerminalThemeColors = typeof ServerTerminalThemeColors.Type;
/** Terminal appearance derived from the user's local Ghostty config, when present. */
export const ServerTerminalStyle = Schema.Struct({
/** font-family fallback chain in config order. */
fontFamily: Schema.optional(Schema.Array(TrimmedNonEmptyString)),
fontSize: Schema.optional(Schema.Number),
light: Schema.optional(ServerTerminalThemeColors),
dark: Schema.optional(ServerTerminalThemeColors),
});
export type ServerTerminalStyle = typeof ServerTerminalStyle.Type;
export const ServerConfig = Schema.Struct({ export const ServerConfig = Schema.Struct({
environment: ExecutionEnvironmentDescriptor, environment: ExecutionEnvironmentDescriptor,
auth: ServerAuthDescriptor, auth: ServerAuthDescriptor,
@@ -421,6 +443,8 @@ export const ServerConfig = Schema.Struct({
shellResumeCompletionMarker: Schema.optionalKey(Schema.Boolean), shellResumeCompletionMarker: Schema.optionalKey(Schema.Boolean),
/** Whether thread subscriptions can emit an opt-in catch-up completion marker. */ /** Whether thread subscriptions can emit an opt-in catch-up completion marker. */
threadResumeCompletionMarker: Schema.optionalKey(Schema.Boolean), threadResumeCompletionMarker: Schema.optionalKey(Schema.Boolean),
/** Absent when no Ghostty config exists or it cannot be read. */
terminalStyle: Schema.optional(ServerTerminalStyle),
}); });
export type ServerConfig = typeof ServerConfig.Type; export type ServerConfig = typeof ServerConfig.Type;
-103
View File
@@ -79,38 +79,12 @@ describe("isTemporaryWorktreeBranch", () => {
}); });
describe("applyGitStatusStreamEvent", () => { describe("applyGitStatusStreamEvent", () => {
const localStatus = {
isRepo: true as const,
hasPrimaryRemote: true,
isDefaultRef: false,
refName: "feature/demo",
hasWorkingTreeChanges: false,
workingTree: { files: [], insertions: 0, deletions: 0 },
};
it("keeps an initial snapshot pending until remote lookup completes", () => {
expect(
applyGitStatusStreamEvent(null, {
_tag: "snapshot",
local: localStatus,
remote: null,
}),
).toMatchObject({
refName: "feature/demo",
statusRefName: null,
pr: null,
changeRequestLookup: { _tag: "pending" },
});
});
it("treats a remote-only update as a repository when local state is missing", () => { it("treats a remote-only update as a repository when local state is missing", () => {
const remote: VcsStatusRemoteResult = { const remote: VcsStatusRemoteResult = {
statusRefName: null,
hasUpstream: true, hasUpstream: true,
aheadCount: 2, aheadCount: 2,
behindCount: 1, behindCount: 1,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}; };
expect(applyGitStatusStreamEvent(null, { _tag: "remoteUpdated", remote })).toEqual({ expect(applyGitStatusStreamEvent(null, { _tag: "remoteUpdated", remote })).toEqual({
@@ -120,12 +94,10 @@ describe("applyGitStatusStreamEvent", () => {
refName: null, refName: null,
hasWorkingTreeChanges: false, hasWorkingTreeChanges: false,
workingTree: { files: [], insertions: 0, deletions: 0 }, workingTree: { files: [], insertions: 0, deletions: 0 },
statusRefName: null,
hasUpstream: true, hasUpstream: true,
aheadCount: 2, aheadCount: 2,
behindCount: 1, behindCount: 1,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}); });
}); });
@@ -146,21 +118,17 @@ describe("applyGitStatusStreamEvent", () => {
insertions: 1, insertions: 1,
deletions: 0, deletions: 0,
}, },
statusRefName: "feature/demo",
hasUpstream: false, hasUpstream: false,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}; };
const remote: VcsStatusRemoteResult = { const remote: VcsStatusRemoteResult = {
statusRefName: "feature/demo",
hasUpstream: true, hasUpstream: true,
aheadCount: 2, aheadCount: 2,
behindCount: 1, behindCount: 1,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}; };
expect(applyGitStatusStreamEvent(current, { _tag: "remoteUpdated", remote })).toEqual({ expect(applyGitStatusStreamEvent(current, { _tag: "remoteUpdated", remote })).toEqual({
@@ -169,77 +137,6 @@ describe("applyGitStatusStreamEvent", () => {
aheadCount: 2, aheadCount: 2,
behindCount: 1, behindCount: 1,
pr: null, pr: null,
changeRequestLookup: { _tag: "succeeded" },
}); });
}); });
it("clears remote state when a local update switches branches", () => {
const current: VcsStatusResult = {
isRepo: true,
hasPrimaryRemote: true,
isDefaultRef: false,
refName: "feature/old",
hasWorkingTreeChanges: false,
workingTree: { files: [], insertions: 0, deletions: 0 },
statusRefName: "feature/old",
hasUpstream: true,
aheadCount: 0,
behindCount: 0,
pr: {
number: 12,
title: "Old branch PR",
url: "https://example.com/pr/12",
baseRef: "main",
headRef: "feature/old",
state: "open",
},
changeRequestLookup: { _tag: "succeeded" },
};
expect(
applyGitStatusStreamEvent(current, {
_tag: "localUpdated",
local: { ...current, refName: "feature/new" },
}),
).toMatchObject({
refName: "feature/new",
statusRefName: null,
pr: null,
changeRequestLookup: { _tag: "pending" },
});
});
it("ignores a late remote update calculated for a previous branch", () => {
const current: VcsStatusResult = {
...localStatus,
refName: "feature/new",
statusRefName: null,
hasUpstream: false,
aheadCount: 0,
behindCount: 0,
pr: null,
changeRequestLookup: { _tag: "pending" },
};
expect(
applyGitStatusStreamEvent(current, {
_tag: "remoteUpdated",
remote: {
statusRefName: "feature/old",
hasUpstream: true,
aheadCount: 1,
behindCount: 0,
pr: {
number: 12,
title: "Old branch PR",
url: "https://example.com/pr/12",
baseRef: "main",
headRef: "feature/old",
state: "open",
},
changeRequestLookup: { _tag: "succeeded" },
},
}),
).toEqual(current);
});
}); });
+1 -30
View File
@@ -203,37 +203,25 @@ export function detectSourceControlProviderFromGitRemoteUrl(
} }
const EMPTY_GIT_STATUS_REMOTE: VcsStatusRemoteResult = { const EMPTY_GIT_STATUS_REMOTE: VcsStatusRemoteResult = {
statusRefName: null,
hasUpstream: false, hasUpstream: false,
aheadCount: 0, aheadCount: 0,
behindCount: 0, behindCount: 0,
aheadOfDefaultCount: 0, aheadOfDefaultCount: 0,
pr: null, pr: null,
changeRequestLookup: { _tag: "pending" },
}; };
function remoteStatusForLocal(
local: VcsStatusLocalResult,
remote: VcsStatusRemoteResult | null,
): VcsStatusRemoteResult {
return remote !== null && remote.statusRefName === local.refName
? remote
: EMPTY_GIT_STATUS_REMOTE;
}
export function mergeGitStatusParts( export function mergeGitStatusParts(
local: VcsStatusLocalResult, local: VcsStatusLocalResult,
remote: VcsStatusRemoteResult | null, remote: VcsStatusRemoteResult | null,
): VcsStatusResult { ): VcsStatusResult {
return { return {
...local, ...local,
...remoteStatusForLocal(local, remote), ...(remote ?? EMPTY_GIT_STATUS_REMOTE),
}; };
} }
function toRemoteStatusPart(status: VcsStatusResult): VcsStatusRemoteResult { function toRemoteStatusPart(status: VcsStatusResult): VcsStatusRemoteResult {
return { return {
statusRefName: status.statusRefName,
hasUpstream: status.hasUpstream, hasUpstream: status.hasUpstream,
aheadCount: status.aheadCount, aheadCount: status.aheadCount,
behindCount: status.behindCount, behindCount: status.behindCount,
@@ -241,7 +229,6 @@ function toRemoteStatusPart(status: VcsStatusResult): VcsStatusRemoteResult {
? {} ? {}
: { aheadOfDefaultCount: status.aheadOfDefaultCount }), : { aheadOfDefaultCount: status.aheadOfDefaultCount }),
pr: status.pr, pr: status.pr,
changeRequestLookup: status.changeRequestLookup,
}; };
} }
@@ -282,22 +269,6 @@ export function applyGitStatusStreamEvent(
event.remote, event.remote,
); );
} }
if (event.remote?.statusRefName !== current.refName) {
return current;
}
return mergeGitStatusParts(toLocalStatusPart(current), event.remote); return mergeGitStatusParts(toLocalStatusPart(current), event.remote);
} }
} }
export type ChangeRequestAvailability = "pending" | "failed" | "open" | "available";
export function getChangeRequestAvailability(status: VcsStatusResult): ChangeRequestAvailability {
if (status.pr?.state === "open") return "open";
if (status.changeRequestLookup._tag === "pending") return "pending";
if (status.changeRequestLookup._tag === "failed") return "failed";
return "available";
}
export function canCreateChangeRequest(status: VcsStatusResult): boolean {
return getChangeRequestAvailability(status) === "available";
}
+8 -74
View File
@@ -6,30 +6,12 @@ settings:
catalogs: catalogs:
default: default:
'@effect/openapi-generator':
specifier: 4.0.0-beta.78
version: 4.0.0-beta.78
'@effect/tsgo':
specifier: 0.13.2
version: 0.13.2
'@noble/curves':
specifier: 1.9.1
version: 1.9.1
'@noble/hashes':
specifier: 1.8.0
version: 1.8.0
'@pierre/diffs': '@pierre/diffs':
specifier: 1.3.0-beta.5 specifier: 1.3.0-beta.5
version: 1.3.0-beta.5 version: 1.3.0-beta.5
'@typescript/native-preview':
specifier: 7.0.0-dev.20260604.1
version: 7.0.0-dev.20260604.1
jose: jose:
specifier: 6.2.2 specifier: 6.2.2
version: 6.2.2 version: 6.2.2
typescript:
specifier: ~6.0.3
version: 6.0.3
vite-plus: vite-plus:
specifier: 0.2.2 specifier: 0.2.2
version: 0.2.2 version: 0.2.2
@@ -562,18 +544,15 @@ importers:
'@tanstack/react-router': '@tanstack/react-router':
specifier: ^1.160.2 specifier: ^1.160.2
version: 1.170.10([email protected]([email protected]))([email protected]) version: 1.170.10([email protected]([email protected]))([email protected])
'@xterm/addon-fit':
specifier: ^0.11.0
version: 0.11.0
'@xterm/xterm':
specifier: ^6.0.0
version: 6.0.0
class-variance-authority: class-variance-authority:
specifier: ^0.7.1 specifier: ^0.7.1
version: 0.7.1 version: 0.7.1
effect: effect:
specifier: 4.0.0-beta.78 specifier: 4.0.0-beta.78
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5) version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
ghostty-web:
specifier: 0.4.0
version: 0.4.0
jose: jose:
specifier: 'catalog:' specifier: 'catalog:'
version: 6.2.2 version: 6.2.2
@@ -3300,56 +3279,48 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
'@oxfmt/[email protected]': '@oxfmt/[email protected]':
resolution: {integrity: sha512-p4Y/+RYk9Bk5WO+zHSUXAClRmZ2fbJCejMuCAsU2HhyME4jqf6Ftt/mJYEwIah1wGCBDYOB7wEGV1x5bCEZ6hA==} resolution: {integrity: sha512-p4Y/+RYk9Bk5WO+zHSUXAClRmZ2fbJCejMuCAsU2HhyME4jqf6Ftt/mJYEwIah1wGCBDYOB7wEGV1x5bCEZ6hA==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
'@oxfmt/[email protected]': '@oxfmt/[email protected]':
resolution: {integrity: sha512-By6tRALAZsno0F4zedmtG+wdMvJiJmJoXM4d3+A9zHE4HRXLqXITwRH8mgrlcXc5yJM2g2W3riRPwTYdgemZLQ==} resolution: {integrity: sha512-By6tRALAZsno0F4zedmtG+wdMvJiJmJoXM4d3+A9zHE4HRXLqXITwRH8mgrlcXc5yJM2g2W3riRPwTYdgemZLQ==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
libc: [glibc]
'@oxfmt/[email protected]': '@oxfmt/[email protected]':
resolution: {integrity: sha512-skYeG+RgvyzspqVEBsEprL90OYYZfoVNqB3HcCNR6QDJyXKOzfDRT3zncnHmUaFluIlBHuY23mU1b5WGgR98hA==} resolution: {integrity: sha512-skYeG+RgvyzspqVEBsEprL90OYYZfoVNqB3HcCNR6QDJyXKOzfDRT3zncnHmUaFluIlBHuY23mU1b5WGgR98hA==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [glibc]
'@oxfmt/[email protected]': '@oxfmt/[email protected]':
resolution: {integrity: sha512-FFgACrZOXAXUh5KQh2mt1CDOVOZmn+QzHP71wM9QobNwyQvoFfyAeefVUltW83g3sm7LTiH3yfFqLLVUpA5ZFQ==} resolution: {integrity: sha512-FFgACrZOXAXUh5KQh2mt1CDOVOZmn+QzHP71wM9QobNwyQvoFfyAeefVUltW83g3sm7LTiH3yfFqLLVUpA5ZFQ==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [musl]
'@oxfmt/[email protected]': '@oxfmt/[email protected]':
resolution: {integrity: sha512-Nm/BAOfQeFiiKd502mZn/GAVKJwtd0RdCg17G3Wz/WSOIQmDi3+7/SZH4BHn1Ye5KvTVH3ua8WvfwLLycNIuvA==} resolution: {integrity: sha512-Nm/BAOfQeFiiKd502mZn/GAVKJwtd0RdCg17G3Wz/WSOIQmDi3+7/SZH4BHn1Ye5KvTVH3ua8WvfwLLycNIuvA==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
libc: [glibc]
'@oxfmt/[email protected]': '@oxfmt/[email protected]':
resolution: {integrity: sha512-BiSy5Ku3mQqyxS6YIqAJgd403wEUWvI7kerfzPxc2l/txZVmZM0pSj7oDM+4bGBExowxOi7o73jEam1W0EDTZg==} resolution: {integrity: sha512-BiSy5Ku3mQqyxS6YIqAJgd403wEUWvI7kerfzPxc2l/txZVmZM0pSj7oDM+4bGBExowxOi7o73jEam1W0EDTZg==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@oxfmt/[email protected]': '@oxfmt/[email protected]':
resolution: {integrity: sha512-BCRkJiotz5s9afLYD2LuMvzAoDYx9H17E/YbDyu4xK7l4zHDPeny9ErSXL//i/nJyaOwRk08x4b8cgJC00+JDg==} resolution: {integrity: sha512-BCRkJiotz5s9afLYD2LuMvzAoDYx9H17E/YbDyu4xK7l4zHDPeny9ErSXL//i/nJyaOwRk08x4b8cgJC00+JDg==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@oxfmt/[email protected]': '@oxfmt/[email protected]':
resolution: {integrity: sha512-4Oaxe1qrGgXfpCJ1C/ERJ2iCtV2rN1R79ga9fsfyVHfSQRu/hVW780u2KDqZWFZ/iGTHODJji0JemxqFZ63eIQ==} resolution: {integrity: sha512-4Oaxe1qrGgXfpCJ1C/ERJ2iCtV2rN1R79ga9fsfyVHfSQRu/hVW780u2KDqZWFZ/iGTHODJji0JemxqFZ63eIQ==}
@@ -3452,56 +3423,48 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
'@oxlint/[email protected]': '@oxlint/[email protected]':
resolution: {integrity: sha512-JGHS9Mnr7iWyyLDxgCv1MhzVpAckgptg00F2gnxt/GD7lQ2SW1BRcxHqhSTaSdDpjWRrBkBxMMh4+Hn3aVtExg==} resolution: {integrity: sha512-JGHS9Mnr7iWyyLDxgCv1MhzVpAckgptg00F2gnxt/GD7lQ2SW1BRcxHqhSTaSdDpjWRrBkBxMMh4+Hn3aVtExg==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
'@oxlint/[email protected]': '@oxlint/[email protected]':
resolution: {integrity: sha512-AOYgBZqxNshrg83P9v0RYv+m8s10Cqkj4/PxXFDhcS3k7FqsIG5+CxErshZCIN7G8iy4Y+VGfAsuEdar8AcbBg==} resolution: {integrity: sha512-AOYgBZqxNshrg83P9v0RYv+m8s10Cqkj4/PxXFDhcS3k7FqsIG5+CxErshZCIN7G8iy4Y+VGfAsuEdar8AcbBg==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
libc: [glibc]
'@oxlint/[email protected]': '@oxlint/[email protected]':
resolution: {integrity: sha512-QMybPS5ij3/vrKG67mqzHwW++91sYxK/PPUVi6SBtNCEzW4niS52fVBdXbQ6nou0wWbUPEpx8Sl/ZjtgE3clXA==} resolution: {integrity: sha512-QMybPS5ij3/vrKG67mqzHwW++91sYxK/PPUVi6SBtNCEzW4niS52fVBdXbQ6nou0wWbUPEpx8Sl/ZjtgE3clXA==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [glibc]
'@oxlint/[email protected]': '@oxlint/[email protected]':
resolution: {integrity: sha512-gOc3W7JV0PXRpIL7stUlLe3Wa9Gp0Kdlup87IT3gHDvPKck2xNgMIl/Gs2lldYY2lyXZDC4rWi3hmoLUobkgbQ==} resolution: {integrity: sha512-gOc3W7JV0PXRpIL7stUlLe3Wa9Gp0Kdlup87IT3gHDvPKck2xNgMIl/Gs2lldYY2lyXZDC4rWi3hmoLUobkgbQ==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [musl]
'@oxlint/[email protected]': '@oxlint/[email protected]':
resolution: {integrity: sha512-rpGxph+FjjHcYI5q6uxB3Az+tnfmEnDbSA8+PK9ZE/VzyUAkvBOMeuY7ZQMhu5mpZH7YQDsTdW6Cx4kV/msc6w==} resolution: {integrity: sha512-rpGxph+FjjHcYI5q6uxB3Az+tnfmEnDbSA8+PK9ZE/VzyUAkvBOMeuY7ZQMhu5mpZH7YQDsTdW6Cx4kV/msc6w==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
libc: [glibc]
'@oxlint/[email protected]': '@oxlint/[email protected]':
resolution: {integrity: sha512-WND+uhf/Ko13SLqQMWQUgsZuLvYYEvL0ZKgg0tgGYfLqxG7l8Ju123fHDMJyYSDl5E3bUbpFUuii/OvMreFQzw==} resolution: {integrity: sha512-WND+uhf/Ko13SLqQMWQUgsZuLvYYEvL0ZKgg0tgGYfLqxG7l8Ju123fHDMJyYSDl5E3bUbpFUuii/OvMreFQzw==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@oxlint/[email protected]': '@oxlint/[email protected]':
resolution: {integrity: sha512-SrpbrUL70nG9vh6zP4/oKHWgLuHquwsr7MW9XOn0olBVgh10Uqr8qscKhQoBGEn6olK/IUpn5GSKcdQ5AjUhGA==} resolution: {integrity: sha512-SrpbrUL70nG9vh6zP4/oKHWgLuHquwsr7MW9XOn0olBVgh10Uqr8qscKhQoBGEn6olK/IUpn5GSKcdQ5AjUhGA==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@oxlint/[email protected]': '@oxlint/[email protected]':
resolution: {integrity: sha512-qkrsEn6NmgFKr7U/QnezQMb+q/vzAy0Dd9Y95gQGQTyjzDLN+HRZMuM5u70iyH4nBLCfKBzhjMsYCehKay2jyg==} resolution: {integrity: sha512-qkrsEn6NmgFKr7U/QnezQMb+q/vzAy0Dd9Y95gQGQTyjzDLN+HRZMuM5u70iyH4nBLCfKBzhjMsYCehKay2jyg==}
@@ -4037,7 +4000,6 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-QoSx2EkyrrdZ6kcyE8stqZ62t0Yra8Fs5ia9lOxJrh6TMQJK7gQKmscdTHf7pOXKREKrVwOtJcQG3qVSfc866A==} resolution: {integrity: sha512-QoSx2EkyrrdZ6kcyE8stqZ62t0Yra8Fs5ia9lOxJrh6TMQJK7gQKmscdTHf7pOXKREKrVwOtJcQG3qVSfc866A==}
@@ -4051,14 +4013,12 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-b/CgbwAJpmrRLp02RPfhbudf5tZnN9nsPWK82znefso832etkem8H7FSZwxrOI9djcdTP7U6YfNhbRnh7djErg==} resolution: {integrity: sha512-b/CgbwAJpmrRLp02RPfhbudf5tZnN9nsPWK82znefso832etkem8H7FSZwxrOI9djcdTP7U6YfNhbRnh7djErg==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-uwNwFpwKeNiZawfAWBgg0VIztPTV3ihhh1vV334h9ivnNLorxnQMU6Fz8wG1Zb4Qh9LC1/MkcyT3YlDXG3Rsgg==} resolution: {integrity: sha512-uwNwFpwKeNiZawfAWBgg0VIztPTV3ihhh1vV334h9ivnNLorxnQMU6Fz8wG1Zb4Qh9LC1/MkcyT3YlDXG3Rsgg==}
@@ -4072,14 +4032,12 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-4EII1iNGRUN5WwGbF/kOh/EIkoDN9HsupgLQoXfY+D1oyJm7/F4t5PYU5n8SWZgG0FEwakyM8pGgwcBYruGTlA==} resolution: {integrity: sha512-4EII1iNGRUN5WwGbF/kOh/EIkoDN9HsupgLQoXfY+D1oyJm7/F4t5PYU5n8SWZgG0FEwakyM8pGgwcBYruGTlA==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
libc: [glibc]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-zY1bul7OWr7DFBiJ++wofXvnr8B45ce3QsQUhKrIhXsygAh7bTkwyeM1bi1a2g5C/yC/N8TZyGDEoMfm/l9mpg==} resolution: {integrity: sha512-zY1bul7OWr7DFBiJ++wofXvnr8B45ce3QsQUhKrIhXsygAh7bTkwyeM1bi1a2g5C/yC/N8TZyGDEoMfm/l9mpg==}
@@ -4093,14 +4051,12 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
libc: [glibc]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-AH8oq3XqQo4IibpVXvPeLDI5pzkpYn0WiZAfT05kFzoJ6tQNzwRdDYQ45M8I/gslbodRZwW8uxLhbSBbkv96rA==} resolution: {integrity: sha512-AH8oq3XqQo4IibpVXvPeLDI5pzkpYn0WiZAfT05kFzoJ6tQNzwRdDYQ45M8I/gslbodRZwW8uxLhbSBbkv96rA==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
libc: [glibc]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-0frlsT/f4Ft6I7SMESTKnF3cZsdicQn1dCMkF/jT9wDLE+gGoiQfv1nmT9e+s7s/fekvvy6tZM2jHvI2tkbJDQ==} resolution: {integrity: sha512-0frlsT/f4Ft6I7SMESTKnF3cZsdicQn1dCMkF/jT9wDLE+gGoiQfv1nmT9e+s7s/fekvvy6tZM2jHvI2tkbJDQ==}
@@ -4114,14 +4070,12 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
libc: [glibc]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-cLnjV3xfo7KslbU41Z7z8BH/E1y5mzUYzAqih1d1MDaIGZRCMqTijqLv76/P7fyHuvUcfGsIpqCdddbxLLK9rA==} resolution: {integrity: sha512-cLnjV3xfo7KslbU41Z7z8BH/E1y5mzUYzAqih1d1MDaIGZRCMqTijqLv76/P7fyHuvUcfGsIpqCdddbxLLK9rA==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-XABVmGp9Tg0WspTVvwduTc4fpqy6JnAUrSQe6OuyqD/03nI7r0O9OWUkMIwFrjKAIqolvqoA4ZrJppgwE0Gxmw==} resolution: {integrity: sha512-XABVmGp9Tg0WspTVvwduTc4fpqy6JnAUrSQe6OuyqD/03nI7r0O9OWUkMIwFrjKAIqolvqoA4ZrJppgwE0Gxmw==}
@@ -4135,14 +4089,12 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-0phclDw1spsL7dUB37sIARuis2tAgomCJXAHZlpt8PXZ4Ba0dRP1e+66lsRqrfhISeN9bEGNjQs+T/Fbd7oYGw==} resolution: {integrity: sha512-0phclDw1spsL7dUB37sIARuis2tAgomCJXAHZlpt8PXZ4Ba0dRP1e+66lsRqrfhISeN9bEGNjQs+T/Fbd7oYGw==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-bV4fzswuzVcKD90o/VM6QqKxnxlDq0g2BISDLNVmxrnhpv1DDbyPhCIjYfvzYLV+MvkKKnQt2Q6AO86SEBULUQ==} resolution: {integrity: sha512-bV4fzswuzVcKD90o/VM6QqKxnxlDq0g2BISDLNVmxrnhpv1DDbyPhCIjYfvzYLV+MvkKKnQt2Q6AO86SEBULUQ==}
@@ -4156,7 +4108,6 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-0ag/hEgXOwgw4t8QyQvUCxvEg+V0KBcA6YuOx9g0r02MprutRF5dyljgm3EmR02O292UX7UeS6HzWHAl6KgyhA==} resolution: {integrity: sha512-0ag/hEgXOwgw4t8QyQvUCxvEg+V0KBcA6YuOx9g0r02MprutRF5dyljgm3EmR02O292UX7UeS6HzWHAl6KgyhA==}
@@ -4616,7 +4567,6 @@ packages:
engines: {node: '>= 20'} engines: {node: '>= 20'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
'@tailwindcss/[email protected]': '@tailwindcss/[email protected]':
resolution: {integrity: sha512-WZA0CHRL/SP1TRbA5mp9htsppSEkWuQ4KsSUumYQnyl8ZdT39ntwqmz4IUHGN6p4XdSlYfJwM4rRzZLShHsGAQ==} resolution: {integrity: sha512-WZA0CHRL/SP1TRbA5mp9htsppSEkWuQ4KsSUumYQnyl8ZdT39ntwqmz4IUHGN6p4XdSlYfJwM4rRzZLShHsGAQ==}
@@ -4630,7 +4580,6 @@ packages:
engines: {node: '>= 20'} engines: {node: '>= 20'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
'@tailwindcss/[email protected]': '@tailwindcss/[email protected]':
resolution: {integrity: sha512-qMFzxI2YlBOLW5PhblzuSWlWfwLHaneBE0xHzLrBgNtqN6mWfs+qYbhryGSXQjFYB1Dzf5w+LN5qbUTPhW7Y5g==} resolution: {integrity: sha512-qMFzxI2YlBOLW5PhblzuSWlWfwLHaneBE0xHzLrBgNtqN6mWfs+qYbhryGSXQjFYB1Dzf5w+LN5qbUTPhW7Y5g==}
@@ -4644,7 +4593,6 @@ packages:
engines: {node: '>= 20'} engines: {node: '>= 20'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@tailwindcss/[email protected]': '@tailwindcss/[email protected]':
resolution: {integrity: sha512-5r1X2FKnCMUPlXTWRYpHdPYUY6a1Ar/t7P24OuiEdEOmms5lyqjDRvVY1yy9Rmioh+AunQ0rWiOTPE8F9A3v5g==} resolution: {integrity: sha512-5r1X2FKnCMUPlXTWRYpHdPYUY6a1Ar/t7P24OuiEdEOmms5lyqjDRvVY1yy9Rmioh+AunQ0rWiOTPE8F9A3v5g==}
@@ -4658,7 +4606,6 @@ packages:
engines: {node: '>= 20'} engines: {node: '>= 20'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@tailwindcss/[email protected]': '@tailwindcss/[email protected]':
resolution: {integrity: sha512-MGFB5cVPvshR85MTJkEvqDUnuNoysrsRxd6vnk1Lf2tbiqNlXpHYZqkqOQalydienEWOHHFyyuTSYRsLfxFJ2Q==} resolution: {integrity: sha512-MGFB5cVPvshR85MTJkEvqDUnuNoysrsRxd6vnk1Lf2tbiqNlXpHYZqkqOQalydienEWOHHFyyuTSYRsLfxFJ2Q==}
@@ -5125,28 +5072,24 @@ packages:
engines: {node: '>=20.0.0'} engines: {node: '>=20.0.0'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
'@voidzero-dev/[email protected]': '@voidzero-dev/[email protected]':
resolution: {integrity: sha512-YGtvTHT7qP4c5pZmM4kLL78/d8hj2NS150R92cR2SVOW/l9Ilq5R5WrEiMA4k5Ea3B++IJWZT5MRFI0tW9qlcg==} resolution: {integrity: sha512-YGtvTHT7qP4c5pZmM4kLL78/d8hj2NS150R92cR2SVOW/l9Ilq5R5WrEiMA4k5Ea3B++IJWZT5MRFI0tW9qlcg==}
engines: {node: '>=20.0.0'} engines: {node: '>=20.0.0'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
'@voidzero-dev/[email protected]': '@voidzero-dev/[email protected]':
resolution: {integrity: sha512-FvaMI/vsy4PVM+Qd73K+KM8blfCAfaoZaGaGWNrrlMryhyPThXPnHoB1AQcrKbEAWb+z2fc4zLS4sH+8uI65fw==} resolution: {integrity: sha512-FvaMI/vsy4PVM+Qd73K+KM8blfCAfaoZaGaGWNrrlMryhyPThXPnHoB1AQcrKbEAWb+z2fc4zLS4sH+8uI65fw==}
engines: {node: '>=20.0.0'} engines: {node: '>=20.0.0'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@voidzero-dev/[email protected]': '@voidzero-dev/[email protected]':
resolution: {integrity: sha512-ZsMochHqXqxj2sGTJNJzz3vabppbe4BFgZAjJfsnVzkwR7jv6c5p1BM71LFWxP4qd5LL0TJT7lbeRhALlI44RQ==} resolution: {integrity: sha512-ZsMochHqXqxj2sGTJNJzz3vabppbe4BFgZAjJfsnVzkwR7jv6c5p1BM71LFWxP4qd5LL0TJT7lbeRhALlI44RQ==}
engines: {node: '>=20.0.0'} engines: {node: '>=20.0.0'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@voidzero-dev/[email protected]': '@voidzero-dev/[email protected]':
resolution: {integrity: sha512-noBNyJufux0cf18eDpQLOQUZ1Kybfx9zlr+yQ6gAnxMEsQXSvYqZgWymfRDesBE3G/0XB5bg+AUtWijp3TwVcw==} resolution: {integrity: sha512-noBNyJufux0cf18eDpQLOQUZ1Kybfx9zlr+yQ6gAnxMEsQXSvYqZgWymfRDesBE3G/0XB5bg+AUtWijp3TwVcw==}
@@ -5194,12 +5137,6 @@ packages:
resolution: {integrity: sha512-A9gOqLdi6cV4ibazAjcQufGj0B1y/vDqYrcuP6d/6x8P27gRS8643Dj9o1dEKtB6O7fwxb2FgBmJS2mX7gpvdw==} resolution: {integrity: sha512-A9gOqLdi6cV4ibazAjcQufGj0B1y/vDqYrcuP6d/6x8P27gRS8643Dj9o1dEKtB6O7fwxb2FgBmJS2mX7gpvdw==}
engines: {node: '>=14.6'} engines: {node: '>=14.6'}
'@xterm/[email protected]':
resolution: {integrity: sha512-jYcgT6xtVYhnhgxh3QgYDnnNMYTcf8ElbxxFzX0IZo+vabQqSPAjC3c1wJrKB5E19VwQei89QCiZZP86DCPF7g==}
'@xterm/[email protected]':
resolution: {integrity: sha512-TQwDdQGtwwDt+2cgKDLn0IRaSxYu1tSUjgKarSDkUM0ZNiSRXFpjxEsvc/Zgc5kq5omJ+V0a8/kIM2WD3sMOYg==}
'@yuuang/[email protected]': '@yuuang/[email protected]':
resolution: {integrity: sha512-eDYLT0kVBkp7e2BwdRDmt6N1rkeDPUHDefk3ZX0/nok+GLsqfy1WBoSL3Yg7HVXN1EyW8OBVc2uK8Zq8HbmaSA==} resolution: {integrity: sha512-eDYLT0kVBkp7e2BwdRDmt6N1rkeDPUHDefk3ZX0/nok+GLsqfy1WBoSL3Yg7HVXN1EyW8OBVc2uK8Zq8HbmaSA==}
engines: {node: '>= 12'} engines: {node: '>= 12'}
@@ -7046,6 +6983,9 @@ packages:
resolution: {integrity: sha512-VilgtJj/ALgGY77fiLam5iD336eSWi96Q15JSAG1zi8NRBysm3LXKdGnHb4m5cuyxvOLQQKWpBZAT6ni4FI2iQ==} resolution: {integrity: sha512-VilgtJj/ALgGY77fiLam5iD336eSWi96Q15JSAG1zi8NRBysm3LXKdGnHb4m5cuyxvOLQQKWpBZAT6ni4FI2iQ==}
engines: {node: '>=6'} engines: {node: '>=6'}
[email protected]:
resolution: {integrity: sha512-0puDBik2qapbD/QQBW9o5ZHfXnZBqZWx/ctBiVtKZ6ZLds4NYb+wZuw1cRLXZk9zYovIQ908z3rvFhexAvc5Hg==}
[email protected]: [email protected]:
resolution: {integrity: sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==} resolution: {integrity: sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==}
@@ -7672,7 +7612,6 @@ packages:
engines: {node: '>= 12.0.0'} engines: {node: '>= 12.0.0'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
[email protected]: [email protected]:
resolution: {integrity: sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==} resolution: {integrity: sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==}
@@ -7693,7 +7632,6 @@ packages:
engines: {node: '>= 12.0.0'} engines: {node: '>= 12.0.0'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
[email protected]: [email protected]:
resolution: {integrity: sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==} resolution: {integrity: sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==}
@@ -7714,7 +7652,6 @@ packages:
engines: {node: '>= 12.0.0'} engines: {node: '>= 12.0.0'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
[email protected]: [email protected]:
resolution: {integrity: sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==} resolution: {integrity: sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==}
@@ -7735,7 +7672,6 @@ packages:
engines: {node: '>= 12.0.0'} engines: {node: '>= 12.0.0'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
[email protected]: [email protected]:
resolution: {integrity: sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==} resolution: {integrity: sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==}
@@ -15198,10 +15134,6 @@ snapshots:
'@xmldom/[email protected]': {} '@xmldom/[email protected]': {}
'@xterm/[email protected]': {}
'@xterm/[email protected]': {}
'@yuuang/[email protected]': '@yuuang/[email protected]':
optional: true optional: true
@@ -17523,6 +17455,8 @@ snapshots:
[email protected]: {} [email protected]: {}
[email protected]: {}
[email protected]: {} [email protected]: {}
[email protected]: [email protected]: