Merge origin/main into dev (second round)
Resolve 21 conflicts from latest main (provider profiles, Windows fixes, 0.1.55-rc.1). Fix all type errors and syntax issues from merge artifacts.
This commit is contained in:
@@ -301,7 +301,8 @@ describe("TerminalManager", () => {
|
||||
describe("subscribeTerminalsChanged", () => {
|
||||
it("emits cwd snapshots when terminals are created", async () => {
|
||||
manager = createTerminalManager();
|
||||
const snapshots: Array<{ cwd: string; terminals: Array<{ name: string; title?: string }> }> = [];
|
||||
const snapshots: Array<{ cwd: string; terminals: Array<{ name: string; title?: string }> }> =
|
||||
[];
|
||||
const unsubscribe = manager.subscribeTerminalsChanged((input) => {
|
||||
snapshots.push({
|
||||
cwd: input.cwd,
|
||||
@@ -327,37 +328,33 @@ describe("TerminalManager", () => {
|
||||
unsubscribe();
|
||||
});
|
||||
|
||||
it(
|
||||
"emits updated terminal titles after debounced title changes",
|
||||
async () => {
|
||||
await withShell("/bin/sh", async () => {
|
||||
manager = createTerminalManager();
|
||||
const snapshots: Array<Array<{ id: string; title?: string }>> = [];
|
||||
const unsubscribe = manager.subscribeTerminalsChanged((input) => {
|
||||
snapshots.push(
|
||||
input.terminals.map((terminal) => ({
|
||||
id: terminal.id,
|
||||
...(terminal.title ? { title: terminal.title } : {}),
|
||||
})),
|
||||
);
|
||||
});
|
||||
|
||||
const session = await manager.createTerminal({ cwd: "/tmp" });
|
||||
session.send({ type: "input", data: "printf '\\033]0;Logs\\007'\r" });
|
||||
|
||||
await waitForCondition(
|
||||
() =>
|
||||
snapshots.some((snapshot) =>
|
||||
snapshot.some((terminal) => terminal.id === session.id && terminal.title === "Logs"),
|
||||
),
|
||||
10000,
|
||||
it("emits updated terminal titles after debounced title changes", async () => {
|
||||
await withShell("/bin/sh", async () => {
|
||||
manager = createTerminalManager();
|
||||
const snapshots: Array<Array<{ id: string; title?: string }>> = [];
|
||||
const unsubscribe = manager.subscribeTerminalsChanged((input) => {
|
||||
snapshots.push(
|
||||
input.terminals.map((terminal) => ({
|
||||
id: terminal.id,
|
||||
...(terminal.title ? { title: terminal.title } : {}),
|
||||
})),
|
||||
);
|
||||
|
||||
unsubscribe();
|
||||
});
|
||||
},
|
||||
10000,
|
||||
);
|
||||
|
||||
const session = await manager.createTerminal({ cwd: "/tmp" });
|
||||
session.send({ type: "input", data: "printf '\\033]0;Logs\\007'\r" });
|
||||
|
||||
await waitForCondition(
|
||||
() =>
|
||||
snapshots.some((snapshot) =>
|
||||
snapshot.some((terminal) => terminal.id === session.id && terminal.title === "Logs"),
|
||||
),
|
||||
10000,
|
||||
);
|
||||
|
||||
unsubscribe();
|
||||
});
|
||||
}, 10000);
|
||||
|
||||
it("emits empty snapshot when last terminal is removed", async () => {
|
||||
manager = createTerminalManager();
|
||||
|
||||
@@ -125,7 +125,9 @@ describe("Terminal", () => {
|
||||
|
||||
it("humanizes interpreter-backed package manager commands", () => {
|
||||
expect(
|
||||
humanizeProcessTitle("/usr/local/bin/node /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js run dev"),
|
||||
humanizeProcessTitle(
|
||||
"/usr/local/bin/node /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js run dev",
|
||||
),
|
||||
).toBe("npm run dev");
|
||||
expect(
|
||||
humanizeProcessTitle("/usr/bin/env FOO=bar /opt/homebrew/bin/node /tmp/npm-cli.js test"),
|
||||
@@ -361,7 +363,7 @@ describe("Terminal", () => {
|
||||
await createTerminal({
|
||||
cwd: homeDir,
|
||||
command: "/bin/zsh",
|
||||
args: ["-c", "printf '%s\\n%s\\n' \"${ZDOTDIR-}\" \"${PASEO_TEST_REAL_ZDOTDIR-}\""],
|
||||
args: ["-c", 'printf \'%s\\n%s\\n\' "${ZDOTDIR-}" "${PASEO_TEST_REAL_ZDOTDIR-}"'],
|
||||
env: {
|
||||
HOME: homeDir,
|
||||
ZDOTDIR: realZdotdir,
|
||||
@@ -453,8 +455,7 @@ describe("Terminal", () => {
|
||||
await waitForLines(session, ["$"]);
|
||||
session.send({
|
||||
type: "input",
|
||||
data:
|
||||
"printf '\\033]0;First\\007\\033]0;Second\\007\\033]0;Final\\007'\r",
|
||||
data: "printf '\\033]0;First\\007\\033]0;Second\\007\\033]0;Final\\007'\r",
|
||||
});
|
||||
|
||||
await waitForTitle(session, (title) => title === "Final");
|
||||
|
||||
@@ -158,7 +158,9 @@ export function resolveZshShellIntegrationDir(): string {
|
||||
return fileURLToPath(new URL("./shell-integration/zsh", import.meta.url));
|
||||
}
|
||||
|
||||
export function buildTerminalEnvironment(input: BuildTerminalEnvironmentInput): Record<string, string> {
|
||||
export function buildTerminalEnvironment(
|
||||
input: BuildTerminalEnvironmentInput,
|
||||
): Record<string, string> {
|
||||
const baseEnv: Record<string, string> = {
|
||||
...process.env,
|
||||
...input.env,
|
||||
@@ -433,10 +435,7 @@ function extractLastOutputLines(terminal: TerminalType, limit: number): string[]
|
||||
}
|
||||
|
||||
function stripAnsiSequences(input: string): string {
|
||||
return input.replace(
|
||||
/\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\].*?(?:\x07|\x1b\\))/g,
|
||||
"",
|
||||
);
|
||||
return input.replace(/\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\].*?(?:\x07|\x1b\\))/g, "");
|
||||
}
|
||||
|
||||
function extractLastOutputLinesFromText(text: string, limit: number): string[] {
|
||||
@@ -577,8 +576,8 @@ export async function createTerminal(options: CreateTerminalOptions): Promise<Te
|
||||
}
|
||||
|
||||
const initialTitle = command
|
||||
? humanizeProcessTitle([command, ...args].join(" ")) ??
|
||||
normalizeProcessTitle([command, ...args].join(" "))
|
||||
? (humanizeProcessTitle([command, ...args].join(" ")) ??
|
||||
normalizeProcessTitle([command, ...args].join(" ")))
|
||||
: undefined;
|
||||
emitTitleChange(initialTitle);
|
||||
|
||||
@@ -605,7 +604,10 @@ export async function createTerminal(options: CreateTerminalOptions): Promise<Te
|
||||
}, TERMINAL_TITLE_DEBOUNCE_MS);
|
||||
});
|
||||
|
||||
function buildExitInfo(input?: { exitCode?: number | null; signal?: number | null }): TerminalExitInfo {
|
||||
function buildExitInfo(input?: {
|
||||
exitCode?: number | null;
|
||||
signal?: number | null;
|
||||
}): TerminalExitInfo {
|
||||
const lastOutputLines = extractLastOutputLines(terminal, TERMINAL_EXIT_OUTPUT_LINE_LIMIT);
|
||||
return {
|
||||
exitCode: input?.exitCode ?? null,
|
||||
|
||||
Reference in New Issue
Block a user